@brightlayer-ui/react-native-auth-workflow
Version:
Re-usable workflow components for Authentication and Registration within Eaton applications.
43 lines (42 loc) • 2.92 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import { useRegistrationContext, useRegistrationWorkflowContext } from '../../contexts';
import { SuccessScreenBase } from '../SuccessScreen';
import { useTranslation } from 'react-i18next';
/**
* Full screen component that renders a Success Screen for the accounts that already exists in the records
*
* @param {SuccessScreenProps} props - Props of SuccessScreen component
*
* @category Component
*/
export const ExistingAccountSuccessScreen = (props) => {
const { t } = useTranslation();
const { navigate, routeConfig } = useRegistrationContext();
const { resetScreenData } = useRegistrationWorkflowContext();
const { canDismiss = true, onDismiss = () => navigate(routeConfig.LOGIN), WorkflowCardHeaderProps, WorkflowCardActionsProps, WorkflowCardBodyProps, EmptyStateProps } = props, otherExistingAccountSuccessScreenProps = __rest(props, ["canDismiss", "onDismiss", "WorkflowCardHeaderProps", "WorkflowCardActionsProps", "WorkflowCardBodyProps", "EmptyStateProps"]);
const workflowCardHeaderProps = Object.assign(Object.assign({ title: t('bluiRegistration:REGISTRATION.STEPS.COMPLETE') }, WorkflowCardHeaderProps), { onIconPress: () => {
navigate(routeConfig.LOGIN);
resetScreenData();
} });
const workflowCardBodyProps = Object.assign({ scrollable: false }, WorkflowCardBodyProps);
const workflowCardActionsProps = Object.assign(Object.assign({ nextLabel: t('bluiCommon:ACTIONS.CONTINUE'), showNext: true, canGoNext: canDismiss, fullWidthButton: true }, WorkflowCardActionsProps), { onNext: () => {
var _a;
onDismiss();
resetScreenData();
(_a = WorkflowCardActionsProps === null || WorkflowCardActionsProps === void 0 ? void 0 : WorkflowCardActionsProps.onNext) === null || _a === void 0 ? void 0 : _a.call(WorkflowCardActionsProps);
} });
const icon = { family: 'material', name: 'person' };
const emptyStatesProps = Object.assign({ icon: icon, title: t('bluiCommon:MESSAGES.WELCOME'), description: t('bluiRegistration:REGISTRATION.SUCCESS_EXISTING') }, EmptyStateProps);
return (React.createElement(SuccessScreenBase, Object.assign({ WorkflowCardHeaderProps: workflowCardHeaderProps, WorkflowCardActionsProps: workflowCardActionsProps, WorkflowCardBodyProps: workflowCardBodyProps, EmptyStateProps: emptyStatesProps }, otherExistingAccountSuccessScreenProps)));
};