@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.
- package/README.md +34 -34
- package/build/@types/app.d.ts +1 -0
- package/build/app/settings.d.ts +0 -1
- package/build/app/settings.js +6 -16
- package/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/constants/app.js +32 -2
- package/build/features/app/bank/bankStore.d.ts +5 -1
- package/build/features/app/bank/bankStore.js +62 -57
- package/build/features/app/brand/brandStore.d.ts +5 -1
- package/build/features/app/brand/brandStore.js +70 -65
- package/build/features/app/connectExpress/connectExpressStore.js +9 -3
- package/build/features/app/entity/entityStore.d.ts +5 -1
- package/build/features/app/entity/entityStore.js +75 -70
- package/build/features/app/individual/individualStore.d.ts +5 -1
- package/build/features/app/individual/individualStore.js +88 -83
- package/build/features/app/tax/taxStore.d.ts +5 -1
- package/build/features/app/tax/taxStore.js +51 -46
- package/build/features/auth/Auth.d.ts +3 -2
- package/build/features/auth/Auth.js +5 -13
- package/build/features/bank/Bank.d.ts +4 -2
- package/build/features/bank/Bank.js +35 -35
- package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
- package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/features/brand/Brand.d.ts +4 -2
- package/build/features/brand/Brand.js +35 -34
- package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/brand/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
- package/build/features/brand/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/brand/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/features/business/Business.d.ts +3 -2
- package/build/features/business/Business.js +5 -13
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
- package/build/features/connect/Connect.d.ts +3 -2
- package/build/features/connect/Connect.js +5 -13
- package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
- package/build/features/connectExpress/ConnectExpress.js +3 -6
- package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +1 -1
- package/build/features/connectExpress/screens/Mobile/Mobile.js +6 -3
- package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
- package/build/features/connectExpress/screens/NID/IDNumber.js +7 -2
- package/build/features/connectExpress/screens/NID/NID.js +6 -5
- package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +3 -7
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +8 -100
- package/build/features/entity/Entity.d.ts +4 -2
- package/build/features/entity/Entity.js +35 -36
- package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
- package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/features/featuresScreens.js +25 -0
- package/build/features/individual/Individual.d.ts +4 -2
- package/build/features/individual/Individual.js +35 -36
- package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
- package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/features/password/Password.d.ts +4 -2
- package/build/features/password/Password.js +5 -13
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
- package/build/features/shared/Button/FlowsButtons.js +6 -4
- package/build/features/shared/DataLoading/DataLoading.d.ts +5 -0
- package/build/features/shared/DataLoading/DataLoading.js +55 -0
- package/build/features/shared/DataLoading/index.d.ts +2 -0
- package/build/features/shared/DataLoading/index.js +2 -0
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -1
- package/build/features/signIn/SignIn.d.ts +3 -2
- package/build/features/signIn/SignIn.js +4 -13
- package/build/features/tax/Tax.d.ts +4 -2
- package/build/features/tax/Tax.js +35 -37
- package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
- package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
- package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
- package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.d.ts +2 -2
- package/build/hooks/useAppConfig.js +5 -3
- package/build/hooks/useVerifyToken.d.ts +15 -0
- package/build/hooks/useVerifyToken.js +25 -0
- package/build/index.d.ts +11 -11
- package/build/index.js +12 -22
- package/package.json +1 -1
- package/build/features/connectExpress/screens/Brand/Brand.d.ts +0 -0
- package/build/features/connectExpress/screens/Brand/Brand.js +0 -1
- package/build/features/connectExpress/screens/Brand/BrandList.d.ts +0 -10
- package/build/features/connectExpress/screens/Brand/BrandList.js +0 -106
- package/build/features/connectExpress/screens/Brand/BrandName.d.ts +0 -8
- package/build/features/connectExpress/screens/Brand/BrandName.js +0 -142
- package/build/features/connectExpress/screens/Brand/SalesChannels.d.ts +0 -5
- package/build/features/connectExpress/screens/Brand/SalesChannels.js +0 -38
- package/build/features/connectExpress/screens/Brand/Segments.d.ts +0 -8
- package/build/features/connectExpress/screens/Brand/Segments.js +0 -74
- package/build/features/connectExpress/screens/Brand/TAC.d.ts +0 -6
- package/build/features/connectExpress/screens/Brand/TAC.js +0 -84
- package/build/features/connectExpress/screens/Brand/TeamSize.d.ts +0 -8
- package/build/features/connectExpress/screens/Brand/TeamSize.js +0 -74
- package/build/features/connectExpress/screens/Brand/index.d.ts +0 -0
- package/build/features/connectExpress/screens/Brand/index.js +0 -1
- package/build/features/connectExpress/screens/Brand/validation.d.ts +0 -38
- package/build/features/connectExpress/screens/Brand/validation.js +0 -134
|
@@ -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
|
|
14
|
-
import { useAppTheme,
|
|
15
|
-
import {
|
|
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 {
|
|
31
|
+
import { reactElement } from '../../utils';
|
|
21
32
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
-
import { BANK_SCREENS_NAVIGATION
|
|
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 (
|
|
38
|
+
var Bank = memo(function (_a) {
|
|
39
|
+
var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
|
|
28
40
|
var theme = useAppTheme().theme;
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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));
|
|
@@ -56,14 +63,7 @@ export function BankLib(props) {
|
|
|
56
63
|
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Bank, __assign({}, props)) })));
|
|
57
64
|
}
|
|
58
65
|
export function renderBankLib(config, elementId) {
|
|
59
|
-
reactElement(elementId).render
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var element = document.getElementById(elementId);
|
|
63
|
-
setTimeout(function () {
|
|
64
|
-
var _a;
|
|
65
|
-
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
66
|
-
removeElement(DIALOG_ID);
|
|
67
|
-
elementId && reactElement(elementId).unmount();
|
|
68
|
-
}, 1000);
|
|
66
|
+
var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
|
|
67
|
+
render(_jsx(BankLib, __assign({}, config)));
|
|
68
|
+
return { unmount: unmount };
|
|
69
69
|
}
|
|
@@ -9,107 +9,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { memo
|
|
14
|
-
import {
|
|
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
|
|
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
|
|
52
|
-
|
|
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);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { LibConfig } from '../../@types';
|
|
3
3
|
export interface BrandLibProps extends LibConfig {
|
|
4
|
+
verifyToken?: string;
|
|
4
5
|
}
|
|
5
6
|
export declare function BrandLib(props: BrandLibProps): JSX.Element;
|
|
6
|
-
export declare function renderBrandLib(config: BrandLibProps, elementId: string):
|
|
7
|
-
|
|
7
|
+
export declare function renderBrandLib(config: BrandLibProps, elementId: string): {
|
|
8
|
+
unmount: () => void;
|
|
9
|
+
};
|
|
@@ -9,44 +9,52 @@ 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
|
|
14
|
-
import { useAppTheme, useAppDispatch, useAppSelector, useErrorListener, useAppConfig, useStepStartedListener } from '../../hooks';
|
|
15
|
-
import {
|
|
24
|
+
import { memo } from 'react';
|
|
25
|
+
import { useAppTheme, useAppDispatch, 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 {
|
|
31
|
+
import { reactElement } from '../../utils';
|
|
21
32
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
-
import { BRAND_SCREENS_NAVIGATION
|
|
33
|
+
import { BRAND_SCREENS_NAVIGATION } from '../../constants';
|
|
23
34
|
import { brandFeatureScreens } from '../featuresScreens';
|
|
24
35
|
import CustomFooter from '../shared/Footer';
|
|
25
36
|
import { brandSelector, verifyLeadToken } from '../app/brand/brandStore';
|
|
26
37
|
import Background from '../shared/Background';
|
|
27
|
-
var Brand = memo(function (
|
|
38
|
+
var Brand = memo(function (_a) {
|
|
39
|
+
var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
|
|
28
40
|
var theme = useAppTheme().theme;
|
|
29
41
|
var dispatch = useAppDispatch();
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
useAppConfig(__assign({ navigation: BRAND_SCREENS_NAVIGATION }, props));
|
|
42
|
+
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
43
|
+
var _c = useAppSelector(brandSelector), customLoading = _c.customLoading, loading = _c.loading, brandError = _c.error;
|
|
44
|
+
useAppConfig(__assign(__assign({ navigation: BRAND_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
|
|
33
45
|
useErrorListener(brandError || error);
|
|
34
46
|
useStepStartedListener();
|
|
35
|
-
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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: brandFeatureScreens.map(function (_a, index) {
|
|
47
|
+
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.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
|
+
});
|
|
56
|
+
var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
|
|
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) {
|
|
50
58
|
var Element = _a.element, name = _a.name;
|
|
51
59
|
var isActive = activeScreen.name === name;
|
|
52
60
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -56,14 +64,7 @@ export function BrandLib(props) {
|
|
|
56
64
|
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Brand, __assign({}, props)) })));
|
|
57
65
|
}
|
|
58
66
|
export function renderBrandLib(config, elementId) {
|
|
59
|
-
reactElement(elementId).render
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
var element = document.getElementById(elementId);
|
|
63
|
-
setTimeout(function () {
|
|
64
|
-
var _a;
|
|
65
|
-
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
66
|
-
removeElement(DIALOG_ID);
|
|
67
|
-
elementId && reactElement(elementId).unmount();
|
|
68
|
-
}, 1000);
|
|
67
|
+
var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
|
|
68
|
+
render(_jsx(BrandLib, __assign({}, config)));
|
|
69
|
+
return { unmount: unmount };
|
|
69
70
|
}
|
|
@@ -9,107 +9,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { memo
|
|
14
|
-
import {
|
|
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 { brandSelector } from '../../../app/brand/brandStore';
|
|
21
|
-
import
|
|
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(brandSelector).data;
|
|
51
|
-
var
|
|
52
|
-
|
|
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
|
-
brand: brandName,
|
|
81
|
-
business_type: entityLegalName,
|
|
82
|
-
license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
|
|
83
|
-
bank_name: bankName,
|
|
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);
|
|
@@ -3,5 +3,6 @@ import { LibConfig } from '../../@types';
|
|
|
3
3
|
export interface BusinessLibProps extends LibConfig {
|
|
4
4
|
}
|
|
5
5
|
export declare function BusinessLib(props: BusinessLibProps): JSX.Element;
|
|
6
|
-
export declare function renderBusinessLib(config: BusinessLibProps, elementId: string):
|
|
7
|
-
|
|
6
|
+
export declare function renderBusinessLib(config: BusinessLibProps, elementId: string): {
|
|
7
|
+
unmount: () => void;
|
|
8
|
+
};
|
|
@@ -19,8 +19,8 @@ import AnimationFlow from '../../components/AnimationFlow';
|
|
|
19
19
|
import { store } from '../../app/store';
|
|
20
20
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
21
21
|
import Collapse from '../../components/Collapse';
|
|
22
|
-
import { getParameterByName, reactElement
|
|
23
|
-
import { BUSINESS_SCREENS_NAVIGATION
|
|
22
|
+
import { getParameterByName, reactElement } from '../../utils';
|
|
23
|
+
import { BUSINESS_SCREENS_NAVIGATION } from '../../constants';
|
|
24
24
|
import { businessFeatureScreens } from '../featuresScreens';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
import Background from '../shared/Background';
|
|
@@ -56,15 +56,7 @@ export function BusinessLib(props) {
|
|
|
56
56
|
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(Business, __assign({}, props)) })));
|
|
57
57
|
}
|
|
58
58
|
export function renderBusinessLib(config, elementId) {
|
|
59
|
-
reactElement(elementId).render
|
|
60
|
-
}
|
|
61
|
-
|
|
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);
|
|
59
|
+
var _a = reactElement(elementId), render = _a.render, unmount = _a.unmount;
|
|
60
|
+
render(_jsx(BusinessLib, __assign({}, config)));
|
|
61
|
+
return { unmount: unmount };
|
|
70
62
|
}
|