@tap-payments/auth-jsconnect 2.1.56-test → 2.1.59-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +34 -34
  2. package/build/@types/app.d.ts +1 -0
  3. package/build/app/settings.d.ts +0 -1
  4. package/build/app/settings.js +6 -16
  5. package/build/assets/locales/ar.json +3 -1
  6. package/build/assets/locales/en.json +3 -1
  7. package/build/constants/app.js +32 -2
  8. package/build/features/app/bank/bankStore.d.ts +5 -1
  9. package/build/features/app/bank/bankStore.js +62 -57
  10. package/build/features/app/brand/brandStore.d.ts +5 -1
  11. package/build/features/app/brand/brandStore.js +70 -65
  12. package/build/features/app/connectExpress/connectExpressStore.js +9 -3
  13. package/build/features/app/entity/entityStore.d.ts +5 -1
  14. package/build/features/app/entity/entityStore.js +75 -70
  15. package/build/features/app/individual/individualStore.d.ts +5 -1
  16. package/build/features/app/individual/individualStore.js +88 -83
  17. package/build/features/app/tax/taxStore.d.ts +5 -1
  18. package/build/features/app/tax/taxStore.js +51 -46
  19. package/build/features/auth/Auth.d.ts +3 -2
  20. package/build/features/auth/Auth.js +5 -13
  21. package/build/features/bank/Bank.d.ts +4 -2
  22. package/build/features/bank/Bank.js +35 -35
  23. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  24. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  25. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  26. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  27. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  28. package/build/features/brand/Brand.d.ts +4 -2
  29. package/build/features/brand/Brand.js +35 -34
  30. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  31. package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  32. package/build/features/brand/screens/PrepareDataLoading/index.d.ts +2 -0
  33. package/build/features/brand/screens/PrepareDataLoading/index.js +2 -0
  34. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/business/Business.d.ts +3 -2
  36. package/build/features/business/Business.js +5 -13
  37. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  38. package/build/features/connect/Connect.d.ts +3 -2
  39. package/build/features/connect/Connect.js +5 -13
  40. package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
  41. package/build/features/connectExpress/ConnectExpress.js +3 -6
  42. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +1 -1
  43. package/build/features/connectExpress/screens/Mobile/Mobile.js +6 -3
  44. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  45. package/build/features/connectExpress/screens/NID/IDNumber.js +7 -2
  46. package/build/features/connectExpress/screens/NID/NID.js +6 -5
  47. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +3 -7
  48. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -100
  49. package/build/features/entity/Entity.d.ts +4 -2
  50. package/build/features/entity/Entity.js +35 -36
  51. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  52. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  53. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  54. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  55. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  56. package/build/features/featuresScreens.js +25 -0
  57. package/build/features/individual/Individual.d.ts +4 -2
  58. package/build/features/individual/Individual.js +35 -36
  59. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  60. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  61. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  62. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  63. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  64. package/build/features/password/Password.d.ts +4 -2
  65. package/build/features/password/Password.js +5 -13
  66. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  67. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  68. package/build/features/shared/Button/FlowsButtons.js +6 -4
  69. package/build/features/shared/DataLoading/DataLoading.d.ts +5 -0
  70. package/build/features/shared/DataLoading/DataLoading.js +55 -0
  71. package/build/features/shared/DataLoading/index.d.ts +2 -0
  72. package/build/features/shared/DataLoading/index.js +2 -0
  73. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -1
  74. package/build/features/signIn/SignIn.d.ts +3 -2
  75. package/build/features/signIn/SignIn.js +4 -13
  76. package/build/features/tax/Tax.d.ts +4 -2
  77. package/build/features/tax/Tax.js +35 -37
  78. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  79. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  80. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  81. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  82. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  83. package/build/hooks/index.d.ts +1 -0
  84. package/build/hooks/index.js +1 -0
  85. package/build/hooks/useAppConfig.d.ts +2 -2
  86. package/build/hooks/useAppConfig.js +5 -3
  87. package/build/hooks/useVerifyToken.d.ts +15 -0
  88. package/build/hooks/useVerifyToken.js +25 -0
  89. package/build/index.d.ts +11 -11
  90. package/build/index.js +12 -22
  91. package/package.json +1 -1
  92. package/build/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
  93. package/build/features/connectExpress/screens/Brand/Brand.js +0 -1
  94. package/build/features/connectExpress/screens/Brand/BrandList.d.ts +0 -10
  95. package/build/features/connectExpress/screens/Brand/BrandList.js +0 -106
  96. package/build/features/connectExpress/screens/Brand/BrandName.d.ts +0 -8
  97. package/build/features/connectExpress/screens/Brand/BrandName.js +0 -142
  98. package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +0 -5
  99. package/build/features/connectExpress/screens/Brand/SalesChannels.js +0 -38
  100. package/build/features/connectExpress/screens/Brand/Segments.d.ts +0 -8
  101. package/build/features/connectExpress/screens/Brand/Segments.js +0 -74
  102. package/build/features/connectExpress/screens/Brand/TAC.d.ts +0 -6
  103. package/build/features/connectExpress/screens/Brand/TAC.js +0 -84
  104. package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +0 -8
  105. package/build/features/connectExpress/screens/Brand/TeamSize.js +0 -74
  106. package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
  107. package/build/features/connectExpress/screens/Brand/index.js +0 -1
  108. package/build/features/connectExpress/screens/Brand/validation.d.ts +0 -38
  109. package/build/features/connectExpress/screens/Brand/validation.js +0 -134
@@ -9,106 +9,14 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect, useState } from 'react';
14
- import { useTranslation } from 'react-i18next';
15
- import { styled } from '@mui/material/styles';
16
- import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
- import { useAppSelector, useLanguage } from '../../../../hooks';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import { useAppSelector } from '../../../../hooks';
19
15
  import { businessSelector } from '../../../app/business/businessStore';
20
- import { concatenateObjectValues, getResetFlowUrl, shortenBrand, shortenString, showLastFour } from '../../../../utils';
21
- import Box from '@mui/material/Box';
22
- import Text from '../../../../components/Text';
23
- import Container from '../../../shared/Containers/ScreenContainer';
24
- import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
- import { settingsSelector } from '../../../../app/settings';
26
- var TitleStyled = styled(Text)(function (_a) {
27
- var _b;
28
- var theme = _a.theme;
29
- return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
30
- });
31
- var ContainerStyled = styled(Container)(function (_a) {
32
- var theme = _a.theme;
33
- return ({
34
- justifyContent: 'space-between',
35
- minHeight: theme.spacing(30),
36
- alignItems: 'center'
37
- });
38
- });
39
- var ButtonGroupStyled = styled(Box)(function (_a) {
40
- var theme = _a.theme;
41
- return ({
42
- width: '100%',
43
- paddingTop: theme.spacing(3)
44
- });
45
- });
16
+ import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
46
17
  var SuccessWithFlowButtons = function () {
47
- var _a, _b, _c, _d, _e, _f;
48
- var t = useTranslation().t;
49
- var isAr = useLanguage().isAr;
50
18
  var data = useAppSelector(businessSelector).data;
51
- var _g = data.verify.responseBody || {}, flows = _g.flows, nameObj = _g.name, entity = _g.entity, brand = _g.brand, bank = _g.bank_account, merchant = _g.merchant, identification = _g.identification, business = _g.business;
52
- var _h = useState([]), buttons = _h[0], setButtons = _h[1];
53
- var _j = nameObj || {}, en = _j.en, ar = _j.ar;
54
- var username = isAr ? concatenateObjectValues(ar || en, ['first', 'last']) : concatenateObjectValues(en, ['first', 'last']);
55
- var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
56
- var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.bank_name, 20) || t('bank');
57
- var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
58
- var taxID = (entity === null || entity === void 0 ? void 0 : entity.vat_id) || '';
59
- var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
60
- var entityLegalName = shortenString(isAr ? (_d = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _d === void 0 ? void 0 : _d.ar : (_e = entity === null || entity === void 0 ? void 0 : entity.legal_name) === null || _e === void 0 ? void 0 : _e.en, 20) || '';
61
- var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
62
- var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
63
- var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_f = identification === null || identification === void 0 ? void 0 : identification.id) === null || _f === void 0 ? void 0 : _f.slice(-2)) : '';
64
- var settings = useAppSelector(settingsSelector);
65
- var _k = data.verify.responseBody || { contact: {}, board_id: '' }, board_id = _k.board_id, board_info_id = _k.board_info_id;
66
- var contact = business === null || business === void 0 ? void 0 : business.primary_contact;
67
- var email = (contact || { email: '' }).email;
68
- var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, board_id, board_info_id);
69
- var reMapFlowData = function (flows) {
70
- if (flows === void 0) { flows = []; }
71
- var images = ICONS_NAMES;
72
- var mappedFlows = flows
73
- .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
74
- .map(function (_a) {
75
- var name = _a.name, url = _a.url, status = _a.status;
76
- var type = status === 'completed' ? 'completed' : 'pending';
77
- var title = t("".concat(name, "_flow_").concat(type), {
78
- individual_name: username.toLowerCase() + maskedId,
79
- business_type: entityLegalName,
80
- license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
81
- bank_name: bankName,
82
- brand: brandName,
83
- iban: iban ? t('masking_symbols') + iban : '',
84
- tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
85
- });
86
- var isCompleted = status === 'completed' && name !== 'password';
87
- var isIndividual = name === 'individual';
88
- var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
89
- var hoverSrc = "".concat(name, "_white_icon");
90
- return {
91
- name: name,
92
- status: status,
93
- title: title,
94
- href: url,
95
- src: images[src],
96
- hoverSrc: images[hoverSrc],
97
- isCompleted: isCompleted,
98
- sx: isIndividual ? { textTransform: 'capitalize' } : {}
99
- };
100
- });
101
- setButtons(mappedFlows);
102
- };
103
- useEffect(function () {
104
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
105
- reMapFlowData(flows);
106
- }, [flows, isAr]);
107
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
108
- flowName: data.flowName,
109
- email: email,
110
- emailUrl: url,
111
- brandName: shortenBrand(brandName)
112
- } }) })] }));
19
+ var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name;
20
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, flows: flows || [] }));
113
21
  };
114
22
  export default memo(SuccessWithFlowButtons);
@@ -4,5 +4,6 @@ export interface ConnectLibProps extends LibConfig {
4
4
  onClose?: () => void;
5
5
  }
6
6
  export declare function ConnectLib(props: ConnectLibProps): JSX.Element;
7
- export declare function renderConnectLib(config: ConnectLibProps, elementId: string): void;
8
- export declare function unmountConnectLib(elementId: string, unmountTimeout?: number): void;
7
+ export declare function renderConnectLib(config: ConnectLibProps, elementId: string): {
8
+ unmount: () => void;
9
+ };
@@ -30,8 +30,8 @@ import { store } from '../../app/store';
30
30
  import { connectSelector, setDefaultCountryCode } from '../app/connect/connectStore';
31
31
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
32
32
  import Collapse from '../../components/Collapse';
33
- import { reactElement, removeElement, isKW } from '../../utils';
34
- import { CONNECT_SCREENS_NAVIGATION, DIALOG_ID } from '../../constants';
33
+ import { reactElement, isKW } from '../../utils';
34
+ import { CONNECT_SCREENS_NAVIGATION } from '../../constants';
35
35
  import { connectFeatureScreens } from '../featuresScreens';
36
36
  import CustomFooter from '../shared/Footer';
37
37
  import Background from '../shared/Background';
@@ -70,15 +70,7 @@ export function ConnectLib(props) {
70
70
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Connect, __assign({}, props)) })));
71
71
  }
72
72
  export function renderConnectLib(config, elementId) {
73
- reactElement(elementId).render(_jsx(ConnectLib, __assign({}, config)));
74
- }
75
- export function unmountConnectLib(elementId, unmountTimeout) {
76
- if (unmountTimeout === void 0) { unmountTimeout = 1000; }
77
- var element = document.getElementById(elementId);
78
- setTimeout(function () {
79
- var _a;
80
- ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
81
- removeElement(DIALOG_ID);
82
- elementId && reactElement(elementId).unmount();
83
- }, unmountTimeout);
73
+ var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
74
+ render(_jsx(ConnectLib, __assign({}, config)));
75
+ return { unmount: unmount };
84
76
  }
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { LibConfig } from '../../@types';
3
3
  export interface ConnectExpressLibProps extends LibConfig {
4
- onClose?: () => void;
5
4
  leadId?: string;
6
5
  postURL: string;
7
6
  }
@@ -24,7 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import React, { memo } from 'react';
25
25
  import { FeatureContainer } from '../shared/Containers';
26
26
  import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useAppDispatch } from '../../hooks';
27
- import { handleCurrentActiveScreen, settingsSelector, handleOpen } from '../../app/settings';
27
+ import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
28
28
  import AnimationFlow from '../../components/AnimationFlow';
29
29
  import { store } from '../../app/store';
30
30
  import { connectExpressSelector, setIsLeadIdPassed, setPostUrl, setLeadId, retrieveLeadIdentityByIdAsync } from '../app/connectExpress/connectExpressStore';
@@ -36,7 +36,7 @@ import { connectExpressFeatureScreens } from '../featuresScreens';
36
36
  import CustomFooter from '../shared/Footer';
37
37
  import Background from '../shared/Background';
38
38
  var ConnectExpress = memo(function (_a) {
39
- var leadId = _a.leadId, postURL = _a.postURL, onClose = _a.onClose, props = __rest(_a, ["leadId", "postURL", "onClose"]);
39
+ var leadId = _a.leadId, postURL = _a.postURL, props = __rest(_a, ["leadId", "postURL"]);
40
40
  var theme = useAppTheme().theme;
41
41
  var dispatch = useAppDispatch();
42
42
  var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
@@ -63,10 +63,7 @@ var ConnectExpress = memo(function (_a) {
63
63
  dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
64
64
  }
65
65
  }, [settingLoading]);
66
- var handleDialogClose = function () {
67
- dispatch(handleOpen(false));
68
- };
69
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectExpressFeatureScreens.map(function (_a, index) {
66
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectExpressFeatureScreens.map(function (_a, index) {
70
67
  var Element = _a.element, name = _a.name;
71
68
  var isActive = activeScreen.name === name;
72
69
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -56,6 +56,6 @@ var CreateAccountLoader = function (_a) {
56
56
  React.useEffect(function () {
57
57
  dispatch(createAccountAsync());
58
58
  }, []);
59
- return (_jsx(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: _jsxs(TitleContainerStyled, { children: [_jsx(Container, { children: _jsx(LottieFile, { file: LottieAnimationFiles.account_creation, loop: true, height: 'unset' }) }), _jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t('creating_account_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('creating_account_description') })] })] }) })));
59
+ return (_jsx(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: _jsxs(TitleContainerStyled, { children: [_jsx(Container, { children: _jsx(LottieFile, { file: LottieAnimationFiles.account_creation, loop: true, height: '375px' }) }), _jsxs(_Fragment, { children: [_jsx(VerifyPACITitleStyled, { children: t('creating_account_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('creating_account_description') })] })] }) })));
60
60
  };
61
61
  export default React.memo(CreateAccountLoader);
@@ -68,13 +68,16 @@ var OrBoxStyled = styled(Box)(function (_a) {
68
68
  });
69
69
  });
70
70
  var Mobile = function (_a) {
71
+ var _b, _c;
71
72
  var settingData = useAppSelector(settingsSelector).data;
72
- var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
73
- var _c = React.useState(false), anchor = _c[0], setAnchor = _c[1];
73
+ var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
74
+ var _e = React.useState(false), anchor = _e[0], setAnchor = _e[1];
74
75
  var t = useTranslation().t;
75
76
  var isAr = useLanguage().isAr;
76
77
  var dispatch = useAppDispatch();
77
78
  var isKuwait = useCountry(settingData.businessCountry.iso2).isKuwait;
79
+ var responseData = data.responseData, isLeadIdPassed = data.isLeadIdPassed;
80
+ var isLeadIdentityIdAvailable = !((_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id);
78
81
  var methods = useForm({
79
82
  resolver: yupResolver(PhoneValidationSchema),
80
83
  defaultValues: data.mobileData,
@@ -101,6 +104,6 @@ var Mobile = function (_a) {
101
104
  setAnchor(false);
102
105
  };
103
106
  var disabled = !methods.formState.isValid || !!error;
104
- return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !anchor, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !anchor, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
107
+ return (_jsxs(ScreenContainer, { children: [_jsx(MIDTitle, { show: !anchor, title: t('join_our_community'), description: t('ide_terms_and_conditions_description') }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) }))] }));
105
108
  };
106
109
  export default React.memo(Mobile);
@@ -73,15 +73,12 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
73
73
  marginInlineStart: theme.spacing(1)
74
74
  });
75
75
  });
76
- var InputStyled = styled(Input)(function (_a) {
77
- var theme = _a.theme;
78
- return ({
79
- direction: 'ltr',
80
- '& .MuiInputBase-input': {
81
- cursor: 'auto'
82
- }
83
- });
84
- });
76
+ var InputStyled = styled(Input)(function () { return ({
77
+ direction: 'ltr',
78
+ '& .MuiInputBase-input': {
79
+ cursor: 'auto'
80
+ }
81
+ }); });
85
82
  var MobileNumber = React.forwardRef(function (_a, ref) {
86
83
  var _b, _c, _d;
87
84
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
@@ -14,6 +14,7 @@ import * as React from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useController, useFormContext } from 'react-hook-form';
17
+ import { useAppSelector } from '../../../../hooks';
17
18
  import { styled, alpha } from '@mui/material/styles';
18
19
  import Text from '../../../../components/Text';
19
20
  import Input from '../../../shared/Input';
@@ -23,6 +24,7 @@ import Collapse from '../../../../components/Collapse';
23
24
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
25
  import { removeAllCharsFromNumber } from '../../../../utils';
25
26
  import { ID_NUMBER_LENGTH } from '../../../../constants';
27
+ import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
26
28
  var LabelContainerStyled = styled(Box)(function (_a) {
27
29
  var theme = _a.theme;
28
30
  return ({
@@ -36,11 +38,12 @@ var InputLabelStyled = styled(Text)(function (_a) {
36
38
  return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
37
39
  });
38
40
  var IDNumber = React.forwardRef(function (_a, ref) {
39
- var _b;
41
+ var _b, _c, _d;
40
42
  var show = _a.show;
41
43
  var t = useTranslation().t;
42
44
  var control = useFormContext().control;
43
45
  var nidControl = useController({ control: control, name: 'nid' });
46
+ var data = useAppSelector(connectExpressSelector).data;
44
47
  var handleIdChange = function (_a) {
45
48
  var target = _a.target;
46
49
  var value = removeAllCharsFromNumber(target.value);
@@ -51,6 +54,8 @@ var IDNumber = React.forwardRef(function (_a, ref) {
51
54
  };
52
55
  var nidValue = nidControl.field.value;
53
56
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
54
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
57
+ var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
58
+ var isLeadIdentityIdAvailable = !!((_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id);
59
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
55
60
  });
56
61
  export default React.memo(IDNumber);
@@ -57,12 +57,12 @@ var OrBoxStyled = styled(Box)(function (_a) {
57
57
  });
58
58
  });
59
59
  var NID = function (_a) {
60
- var _b, _c, _d;
61
- var _e = React.useState(false), collapse = _e[0], setCollapse = _e[1];
60
+ var _b, _c;
61
+ var _d = React.useState(false), collapse = _d[0], setCollapse = _d[1];
62
62
  var isAr = useLanguage().isAr;
63
63
  var dispatch = useAppDispatch();
64
64
  var t = useTranslation().t;
65
- var _f = useAppSelector(connectExpressSelector), data = _f.data, loading = _f.loading, error = _f.error;
65
+ var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
66
66
  var methods = useForm({
67
67
  resolver: yupResolver(NIDValidationSchema),
68
68
  defaultValues: data.nidData,
@@ -84,7 +84,8 @@ var NID = function (_a) {
84
84
  dispatch(handlePrevScreenStep());
85
85
  };
86
86
  var disabled = !methods.formState.isValid || !!error;
87
- var isLeadIdentityIdAvailable = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id;
88
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isLeadIdentityIdAvailable }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
87
+ var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
88
+ var isLeadIdentityIdAvailable = (_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id;
89
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable && !methods.formState.isValid : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
89
90
  };
90
91
  export default React.memo(NID);
@@ -15,7 +15,6 @@ import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useController, useFormContext } from 'react-hook-form';
17
17
  import { styled, alpha } from '@mui/material/styles';
18
- import { useAppSelector } from '../../../../hooks';
19
18
  import Text from '../../../../components/Text';
20
19
  import Input from '../../../shared/Input';
21
20
  import ClearIcon from '../../../shared/ClearIcon';
@@ -24,7 +23,6 @@ import Collapse from '../../../../components/Collapse';
24
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
24
  import { removeAllCharsFromNumber } from '../../../../utils';
26
25
  import { ID_NUMBER_LENGTH } from '../../../../constants';
27
- import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
28
26
  var LabelContainerStyled = styled(Box)(function (_a) {
29
27
  var theme = _a.theme;
30
28
  return ({
@@ -38,13 +36,11 @@ var InputLabelStyled = styled(Text)(function (_a) {
38
36
  return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
39
37
  });
40
38
  var IDNumber = React.forwardRef(function (_a, ref) {
41
- var _b, _c, _d, _e;
39
+ var _b;
42
40
  var show = _a.show;
43
41
  var t = useTranslation().t;
44
42
  var control = useFormContext().control;
45
43
  var nidControl = useController({ control: control, name: 'nid' });
46
- var data = useAppSelector(connectExpressSelector).data;
47
- var isIDAvailable = (_d = (_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id;
48
44
  var handleIdChange = function (_a) {
49
45
  var target = _a.target;
50
46
  var value = removeAllCharsFromNumber(target.value);
@@ -54,7 +50,7 @@ var IDNumber = React.forwardRef(function (_a, ref) {
54
50
  nidControl.field.onChange('');
55
51
  };
56
52
  var nidValue = nidControl.field.value;
57
- var error = (_e = nidControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
58
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', disabled: isIDAvailable, inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
53
+ var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
54
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
59
55
  });
60
56
  export default React.memo(IDNumber);
@@ -9,111 +9,19 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect, useState } from 'react';
14
- import { useTranslation } from 'react-i18next';
15
- import { styled } from '@mui/material/styles';
16
- import { FlowsButtons } from '../../../shared/Button';
17
- import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
18
- import { useAppSelector, useLanguage } from '../../../../hooks';
19
- import { getResetFlowUrl, showLastFour, concatenateObjectValues, shortenString, shortenBrand } from '../../../../utils';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo } from 'react';
14
+ import { useAppSelector } from '../../../../hooks';
20
15
  import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
21
- import Box from '@mui/material/Box';
22
- import Text from '../../../../components/Text';
23
- import Container from '../../../shared/Containers/ScreenContainer';
24
- import AcceptancePayouts from '../../../shared/AcceptancePayouts';
25
- import { settingsSelector } from '../../../../app/settings';
26
- var TitleStyled = styled(Text)(function (_a) {
27
- var _b;
28
- var theme = _a.theme;
29
- return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
30
- });
31
- var ContainerStyled = styled(Container)(function (_a) {
32
- var theme = _a.theme;
33
- return ({
34
- justifyContent: 'space-between',
35
- minHeight: theme.spacing(30),
36
- alignItems: 'center'
37
- });
38
- });
39
- var ButtonGroupStyled = styled(Box)(function (_a) {
40
- var theme = _a.theme;
41
- return ({
42
- width: '100%',
43
- paddingTop: theme.spacing(3)
44
- });
45
- });
16
+ import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
46
17
  var SuccessWithFlowButtons = function () {
47
- var _a, _b, _c;
48
- var _d = useState([]), buttons = _d[0], setButtons = _d[1];
49
- var t = useTranslation().t;
50
- var isAr = useLanguage().isAr;
51
18
  var data = useAppSelector(connectExpressSelector).data;
52
- var settings = useAppSelector(settingsSelector);
53
- var _e = data.responseData, boardData = _e.boardData, leadData = _e.leadData, boardInfo = _e.boardInfo;
54
- var _f = leadData || {}, brand = _f.brand, entity = _f.entity;
55
- var _g = boardData || {}, business = _g.business, merchant = _g.merchant, bank = _g.bank_account, user = _g.user;
19
+ var _a = data.responseData || {}, boardData = _a.boardData, leadData = _a.leadData, boardInfo = _a.boardInfo;
20
+ var _b = leadData || {}, brand = _b.brand, entity = _b.entity, name = _b.name;
21
+ var _c = boardData || {}, business = _c.business, merchant = _c.merchant, bank = _c.bank_account, user = _c.user;
56
22
  var flows = (boardInfo || {}).info;
57
- var _h = user || {}, names = _h.names, identification = _h.identification;
58
- var primary_contact = (business || {}).primary_contact;
59
- var _j = entity || {}, license = _j.license, vat_id = _j.vat_id, legal_name = _j.legal_name;
60
- var username = isAr ? concatenateObjectValues((names === null || names === void 0 ? void 0 : names.ar) || (names === null || names === void 0 ? void 0 : names.en), ['first', 'last']) : concatenateObjectValues(names === null || names === void 0 ? void 0 : names.en, ['first', 'last']);
61
- var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
62
- var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
63
- var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
64
- var taxID = vat_id || '';
65
- var brandName = (isAr ? (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.en) || '';
66
- var entityLegalName = shortenString(isAr ? legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar : legal_name === null || legal_name === void 0 ? void 0 : legal_name.en, 20) || '';
67
- var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
68
- var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
69
- var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_c = identification === null || identification === void 0 ? void 0 : identification.id) === null || _c === void 0 ? void 0 : _c.slice(-2)) : '';
70
23
  var boardInfoId = boardInfo === null || boardInfo === void 0 ? void 0 : boardInfo.id;
71
24
  var boardId = boardData === null || boardData === void 0 ? void 0 : boardData.id;
72
- var email = (primary_contact || {}).email;
73
- var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
74
- var reMapFlowData = function (flows) {
75
- if (flows === void 0) { flows = []; }
76
- var images = ICONS_NAMES;
77
- var mappedFlows = flows
78
- .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
79
- .map(function (_a) {
80
- var name = _a.name, url = _a.url, status = _a.status;
81
- var type = status === 'completed' ? 'completed' : 'pending';
82
- var title = t("".concat(name, "_flow_").concat(type), {
83
- individual_name: username.toLowerCase() + maskedId,
84
- brand: brandName,
85
- business_type: entityLegalName,
86
- license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
87
- bank_name: bankName,
88
- iban: iban ? t('masking_symbols') + iban : '',
89
- tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
90
- });
91
- var isCompleted = status === 'completed' && name !== 'password';
92
- var isIndividual = name === 'individual';
93
- var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
94
- var hoverSrc = "".concat(name, "_white_icon");
95
- return {
96
- name: name,
97
- status: status,
98
- title: title,
99
- href: url,
100
- src: images[src],
101
- hoverSrc: images[hoverSrc],
102
- isCompleted: isCompleted,
103
- sx: isIndividual ? { textTransform: 'capitalize' } : {}
104
- };
105
- });
106
- setButtons(mappedFlows);
107
- };
108
- useEffect(function () {
109
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
110
- reMapFlowData(flows);
111
- }, [flows, isAr]);
112
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
113
- flowName: data.flowName,
114
- email: email || '',
115
- emailUrl: url,
116
- brandName: shortenBrand(brandName)
117
- } }) })] }));
25
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, boardId: boardId, boardInfoId: boardInfoId, brand: brand, business: business, entity: entity, flows: flows || [], merchant: merchant, user: __assign({ names: { en: name } }, user) }));
118
26
  };
119
27
  export default memo(SuccessWithFlowButtons);
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { LibConfig } from '../../@types';
3
3
  export interface EntityLibProps extends LibConfig {
4
+ verifyToken?: string;
4
5
  }
5
6
  export declare function EntityLib(props: EntityLibProps): JSX.Element;
6
- export declare function renderEntityLib(config: EntityLibProps, elementId: string): void;
7
- export declare function unmountEntityLib(elementId: string, unmountTimeout?: number): void;
7
+ export declare function renderEntityLib(config: EntityLibProps, elementId: string): {
8
+ unmount: () => void;
9
+ };
@@ -9,44 +9,51 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { memo, useEffect } from 'react';
14
- import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
15
- import { handleLanguage, settingsSelector } from '../../app/settings';
24
+ import { memo } from 'react';
25
+ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener, useVerifyToken } from '../../hooks';
26
+ import { settingsSelector } from '../../app/settings';
16
27
  import AnimationFlow from '../../components/AnimationFlow';
17
28
  import { store } from '../../app/store';
18
29
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
19
30
  import Collapse from '../../components/Collapse';
20
- import { getParameterByName, reactElement, removeElement } from '../../utils';
31
+ import { reactElement } from '../../utils';
21
32
  import { FeatureContainer } from '../shared/Containers';
22
- import { DIALOG_ID, ENTITY_SCREENS_NAVIGATION } from '../../constants';
33
+ import { ENTITY_SCREENS_NAVIGATION } from '../../constants';
23
34
  import { entityFeatureScreens } from '../featuresScreens';
24
35
  import CustomFooter from '../shared/Footer';
25
36
  import { entitySelector, verifyLeadToken } from '../app/entity/entityStore';
26
37
  import Background from '../shared/Background';
27
- var Entity = memo(function (props) {
38
+ var Entity = memo(function (_a) {
39
+ var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
28
40
  var theme = useAppTheme().theme;
29
- var dispatch = useAppDispatch();
30
- var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
31
- var _b = useAppSelector(entitySelector), customLoading = _b.customLoading, entityError = _b.error, loading = _b.loading;
32
- useAppConfig(__assign({ navigation: ENTITY_SCREENS_NAVIGATION }, props));
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
+ var _c = useAppSelector(entitySelector), customLoading = _c.customLoading, entityError = _c.error, loading = _c.loading;
43
+ useAppConfig(__assign(__assign({ navigation: ENTITY_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
33
44
  useErrorListener(entityError || error);
34
45
  useStepStartedListener();
35
- var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
36
- var verifyToken = function () {
37
- var token = getParameterByName('token');
38
- var lang = getParameterByName('lang');
39
- if (lang)
40
- dispatch(handleLanguage(lang));
41
- if (!token)
42
- throw new Error('Auth token is not found!');
43
- dispatch(verifyLeadToken(token));
44
- };
45
- useEffect(function () {
46
- if (!settingLoading)
47
- verifyToken();
48
- }, [settingLoading]);
49
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: entityFeatureScreens.map(function (_a, index) {
46
+ var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation;
47
+ useVerifyToken({
48
+ verify: verifyLeadToken,
49
+ loadingScreenName: 'ENTITY_LOADING_DATA_STEP',
50
+ navigation: featureScreensNavigation,
51
+ open: open,
52
+ internalToken: verifyToken,
53
+ settingLoading: settingLoading
54
+ });
55
+ var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
56
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: initialLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, open: open, error: error, loading: initialLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: entityFeatureScreens.map(function (_a, index) {
50
57
  var Element = _a.element, name = _a.name;
51
58
  var isActive = activeScreen.name === name;
52
59
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -56,15 +63,7 @@ export function EntityLib(props) {
56
63
  return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Entity, __assign({}, props)) })));
57
64
  }
58
65
  export function renderEntityLib(config, elementId) {
59
- reactElement(elementId).render(_jsx(EntityLib, __assign({}, config)));
60
- }
61
- export function unmountEntityLib(elementId, unmountTimeout) {
62
- if (unmountTimeout === void 0) { unmountTimeout = 1000; }
63
- var element = document.getElementById(elementId);
64
- setTimeout(function () {
65
- var _a;
66
- ((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
67
- removeElement(DIALOG_ID);
68
- elementId && reactElement(elementId).unmount();
69
- }, unmountTimeout);
66
+ var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
67
+ render(_jsx(EntityLib, __assign({}, config)));
68
+ return { unmount: unmount };
70
69
  }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const PrepareDataLoading: () => JSX.Element;
3
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
+ export default _default;