@tap-payments/auth-jsconnect 2.1.58-test → 2.1.60-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 (46) hide show
  1. package/build/constants/app.js +24 -0
  2. package/build/features/app/bank/bankStore.d.ts +5 -1
  3. package/build/features/app/bank/bankStore.js +62 -57
  4. package/build/features/app/brand/brandStore.js +2 -0
  5. package/build/features/app/entity/entityStore.d.ts +5 -1
  6. package/build/features/app/entity/entityStore.js +75 -70
  7. package/build/features/app/individual/individualStore.d.ts +5 -1
  8. package/build/features/app/individual/individualStore.js +88 -83
  9. package/build/features/app/tax/taxStore.d.ts +5 -1
  10. package/build/features/app/tax/taxStore.js +51 -46
  11. package/build/features/bank/Bank.js +31 -24
  12. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  13. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  14. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  15. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  16. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  17. package/build/features/brand/Brand.js +12 -21
  18. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  19. package/build/features/connectExpress/screens/Mobile/Mobile.js +1 -1
  20. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  21. package/build/features/entity/Entity.js +31 -24
  22. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  23. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  24. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  25. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  26. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  27. package/build/features/featuresScreens.js +20 -0
  28. package/build/features/individual/Individual.js +31 -24
  29. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  30. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  31. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  32. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  33. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  34. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/shared/Button/FlowsButtons.js +1 -1
  36. package/build/features/tax/Tax.js +31 -24
  37. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  38. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  39. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  40. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  41. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  42. package/build/hooks/index.d.ts +1 -0
  43. package/build/hooks/index.js +1 -0
  44. package/build/hooks/useVerifyToken.d.ts +15 -0
  45. package/build/hooks/useVerifyToken.js +25 -0
  46. package/package.json +1 -1
@@ -52,53 +52,58 @@ import { FlowsTypes } from '../../../@types';
52
52
  import { hasKey } from '../../../utils';
53
53
  import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2 } from '../../../app/settings';
54
54
  import { TAX_STEP_NAMES } from '../../../constants';
55
- export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, boardData, boardInfoData, info, countryIso2, hasTaxCompleted;
57
- var _a, _b, _c;
58
- return __generator(this, function (_d) {
59
- switch (_d.label) {
60
- case 0:
61
- payload = {
62
- service_name: 'tap_email',
63
- verify_token: token
64
- };
65
- return [4, API.leadService.verifyLeadToken(payload)];
66
- case 1:
67
- data = (_d.sent()).data;
68
- boardInfoData = undefined;
69
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
70
- if (!data.id) return [3, 4];
71
- return [4, API.boardService.retrieveBoardInfoStatus(data.id)];
72
- case 2:
73
- boardInfoData = _d.sent();
74
- return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
75
- case 3:
76
- boardData = _d.sent();
77
- _d.label = 4;
78
- case 4:
79
- info = (boardInfoData || {}).info;
80
- countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
81
- if (countryIso2)
82
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
83
- hasTaxCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
84
- if (hasTaxCompleted) {
85
- thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
86
- }
87
- else if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
88
- thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
89
- }
90
- else if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
91
- thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
92
- }
93
- _d.label = 5;
94
- case 5: return [2, {
95
- data: data,
96
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
97
- token: token
98
- }];
99
- }
55
+ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
+ var token = _a.token, isInternally = _a.isInternally;
57
+ return __awaiter(void 0, void 0, void 0, function () {
58
+ var payload, data, boardData, boardInfoData, info, countryIso2, hasTaxCompleted;
59
+ var _b, _c, _d;
60
+ return __generator(this, function (_e) {
61
+ switch (_e.label) {
62
+ case 0:
63
+ payload = {
64
+ service_name: 'tap_email',
65
+ verify_token: token
66
+ };
67
+ return [4, API.leadService.verifyLeadToken(payload)];
68
+ case 1:
69
+ data = (_e.sent()).data;
70
+ boardInfoData = undefined;
71
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
72
+ if (isInternally)
73
+ data.step_name = TAX_STEP_NAMES.TAX_INFO;
74
+ if (!data.id) return [3, 4];
75
+ return [4, API.boardService.retrieveBoardInfoStatus(data.id)];
76
+ case 2:
77
+ boardInfoData = _e.sent();
78
+ return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
79
+ case 3:
80
+ boardData = _e.sent();
81
+ _e.label = 4;
82
+ case 4:
83
+ info = (boardInfoData || {}).info;
84
+ countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
85
+ if (countryIso2)
86
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
87
+ hasTaxCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'tax'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
88
+ if (hasTaxCompleted) {
89
+ thunkApi.dispatch(handleNextScreenStep('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
90
+ }
91
+ else if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
92
+ thunkApi.dispatch(handleCurrentActiveScreen('TAX_VERIFY_STEP'));
93
+ }
94
+ else if (data.step_name === TAX_STEP_NAMES.TAX_INFO) {
95
+ thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP'));
96
+ }
97
+ _e.label = 5;
98
+ case 5: return [2, {
99
+ data: data,
100
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
101
+ token: token
102
+ }];
103
+ }
104
+ });
100
105
  });
101
- }); });
106
+ });
102
107
  export var resendOTP = createAsyncThunk('resendOTPTax', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
103
108
  var tax, payload, data;
104
109
  return __generator(this, function (_a) {
@@ -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, useErrorListener, useAppConfig, useStepStartedListener } from '../../hooks';
15
- import { handleLanguage, settingsSelector } from '../../app/settings';
24
+ import { memo } from 'react';
25
+ import { useAppTheme, useAppSelector, useErrorListener, useAppConfig, 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 } from '../../utils';
31
+ import { reactElement } from '../../utils';
21
32
  import { FeatureContainer } from '../shared/Containers';
22
33
  import { BANK_SCREENS_NAVIGATION } from '../../constants';
23
34
  import { bankFeatureScreens } from '../featuresScreens';
24
35
  import CustomFooter from '../shared/Footer';
25
36
  import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
26
37
  import Background from '../shared/Background';
27
- var Bank = memo(function (props) {
38
+ var Bank = 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(bankSelector), customLoading = _b.customLoading, loading = _b.loading, bankError = _b.error;
32
- useAppConfig(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props));
41
+ var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
42
+ var _c = useAppSelector(bankSelector), customLoading = _c.customLoading, loading = _c.loading, bankError = _c.error;
43
+ useAppConfig(__assign(__assign({ navigation: BANK_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
33
44
  useErrorListener(bankError || 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 && open)
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, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.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: 'BANK_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, loading: initialLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: bankFeatureScreens.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));
@@ -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;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import DataLoading from '../../../shared/DataLoading';
4
+ export var PrepareDataLoading = function () {
5
+ return _jsx(DataLoading, {});
6
+ };
7
+ export default memo(PrepareDataLoading);
@@ -0,0 +1,2 @@
1
+ import PrepareDataLoading from './PrepareDataLoading';
2
+ export default PrepareDataLoading;
@@ -0,0 +1,2 @@
1
+ import PrepareDataLoading from './PrepareDataLoading';
2
+ export default PrepareDataLoading;
@@ -9,107 +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';
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 { bankSelector } from '../../../app/bank/bankStore';
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(bankSelector).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, user = _g.user, 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.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 identification = user.identification;
64
- 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)) : '';
65
- var settings = useAppSelector(settingsSelector);
66
- var _k = data.verify.responseBody || { contact: {}, board_id: '' }, board_id = _k.board_id, board_info_id = _k.board_info_id;
67
- var contact = business === null || business === void 0 ? void 0 : business.primary_contact;
68
- var email = (contact || { email: '' }).email;
69
- var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, board_id, board_info_id);
70
- var reMapFlowData = function (flows) {
71
- if (flows === void 0) { flows = []; }
72
- var images = ICONS_NAMES;
73
- var mappedFlows = flows
74
- .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
75
- .map(function (_a) {
76
- var name = _a.name, url = _a.url, status = _a.status;
77
- var type = status === 'completed' ? 'completed' : 'pending';
78
- var title = t("".concat(name, "_flow_").concat(type), {
79
- individual_name: username.toLowerCase() + maskedId,
80
- business_type: entityLegalName,
81
- license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
82
- bank_name: bankName,
83
- brand: brandName,
84
- iban: iban ? t('masking_symbols') + iban : '',
85
- tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
86
- });
87
- var isCompleted = status === 'completed' && name !== 'password';
88
- var isIndividual = name === 'individual';
89
- var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
90
- var hoverSrc = "".concat(name, "_white_icon");
91
- return {
92
- name: name,
93
- status: status,
94
- title: title,
95
- href: url,
96
- src: images[src],
97
- hoverSrc: images[hoverSrc],
98
- isCompleted: isCompleted,
99
- sx: isIndividual ? { textTransform: 'capitalize' } : {}
100
- };
101
- });
102
- setButtons(mappedFlows);
103
- };
104
- useEffect(function () {
105
- if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
106
- reMapFlowData(flows);
107
- }, [flows, isAr]);
108
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
109
- flowName: data.flowName,
110
- email: email,
111
- emailUrl: url,
112
- brandName: shortenBrand(brandName)
113
- } }) })] }));
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 || [] }));
114
21
  };
115
22
  export default memo(SuccessWithFlowButtons);
@@ -21,14 +21,14 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
- import { memo, useEffect } from 'react';
25
- import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig, useStepStartedListener } from '../../hooks';
26
- import { handleCurrentActiveScreen, handleLanguage, settingsSelector } from '../../app/settings';
24
+ import { memo } from 'react';
25
+ import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig, useStepStartedListener, useVerifyToken } from '../../hooks';
26
+ import { settingsSelector } from '../../app/settings';
27
27
  import AnimationFlow from '../../components/AnimationFlow';
28
28
  import { store } from '../../app/store';
29
29
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
30
30
  import Collapse from '../../components/Collapse';
31
- import { getParameterByName, reactElement } from '../../utils';
31
+ import { reactElement } from '../../utils';
32
32
  import { FeatureContainer } from '../shared/Containers';
33
33
  import { BRAND_SCREENS_NAVIGATION } from '../../constants';
34
34
  import { brandFeatureScreens } from '../featuresScreens';
@@ -45,23 +45,14 @@ var Brand = memo(function (_a) {
45
45
  useErrorListener(brandError || error);
46
46
  useStepStartedListener();
47
47
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation;
48
- var verifyTokenFun = function () {
49
- var token = getParameterByName('token') || verifyToken;
50
- var lang = getParameterByName('lang');
51
- if (lang)
52
- dispatch(handleLanguage(lang));
53
- if (!token)
54
- throw new Error('Auth token is not found!');
55
- dispatch(verifyLeadToken({ token: token, isInternally: !!verifyToken }));
56
- };
57
- useEffect(function () {
58
- if (!settingLoading && open)
59
- verifyTokenFun();
60
- }, [settingLoading, open]);
61
- useEffect(function () {
62
- if (verifyToken && open)
63
- dispatch(handleCurrentActiveScreen('BRAND_LOADING_DATA_STEP'));
64
- }, [featureScreensNavigation]);
48
+ useVerifyToken({
49
+ verify: verifyLeadToken,
50
+ loadingScreenName: 'BRAND_LOADING_DATA_STEP',
51
+ navigation: featureScreensNavigation,
52
+ open: open,
53
+ internalToken: verifyToken,
54
+ settingLoading: settingLoading
55
+ });
65
56
  var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
66
57
  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, loading: initialLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: brandFeatureScreens.map(function (_a, index) {
67
58
  var Element = _a.element, name = _a.name;
@@ -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);
@@ -104,6 +104,6 @@ var Mobile = function (_a) {
104
104
  setAnchor(false);
105
105
  };
106
106
  var disabled = !methods.formState.isValid || !!error;
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: !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: 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') })))] }))] }))] })) }))] }));
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') })))] }))] }))] })) }))] }));
108
108
  };
109
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"]);
@@ -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 } from '../../utils';
31
+ import { reactElement } from '../../utils';
21
32
  import { FeatureContainer } from '../shared/Containers';
22
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));
@@ -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;