@tap-payments/auth-jsconnect 2.6.2-test → 2.6.4-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/build/@types/app.d.ts +84 -0
- package/build/@types/form.d.ts +7 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/entity.js +32 -1
- package/build/api/index.d.ts +6 -2
- package/build/api/operator.d.ts +5 -0
- package/build/api/operator.js +21 -1
- package/build/app/settings.d.ts +5 -1
- package/build/app/settings.js +43 -4
- package/build/assets/locales/ar.json +12 -1
- package/build/assets/locales/en.json +12 -1
- package/build/components/SimpleList/SimpleList.js +1 -1
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +5 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +14 -2
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/bank/bankStore.js +28 -1
- package/build/features/app/brand/brandStore.d.ts +1 -0
- package/build/features/app/brand/brandStore.js +28 -1
- package/build/features/app/connectExpress/connectExpressStore.d.ts +15 -4
- package/build/features/app/connectExpress/connectExpressStore.js +248 -30
- package/build/features/app/entity/entityStore.d.ts +1 -0
- package/build/features/app/entity/entityStore.js +28 -1
- package/build/features/app/individual/individualStore.d.ts +1 -0
- package/build/features/app/individual/individualStore.js +28 -1
- package/build/features/app/password/passwordStore.d.ts +1 -0
- package/build/features/app/password/passwordStore.js +28 -1
- package/build/features/app/tax/taxStore.d.ts +1 -0
- package/build/features/app/tax/taxStore.js +28 -1
- package/build/features/bank/Bank.d.ts +1 -0
- package/build/features/bank/Bank.js +4 -4
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/brand/Brand.d.ts +1 -0
- package/build/features/brand/Brand.js +4 -4
- package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/connectExpress/ConnectExpress.d.ts +0 -1
- package/build/features/connectExpress/ConnectExpress.js +6 -9
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.d.ts +5 -0
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +93 -0
- package/build/features/connectExpress/screens/AuthenticationList/BrandList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/BrandList.js +81 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.d.ts +11 -0
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +96 -0
- package/build/features/connectExpress/screens/AuthenticationList/MerchantList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/MerchantList.js +100 -0
- package/build/features/connectExpress/screens/AuthenticationList/TerminalList.d.ts +10 -0
- package/build/features/connectExpress/screens/AuthenticationList/TerminalList.js +101 -0
- package/build/features/connectExpress/screens/AuthenticationList/index.d.ts +3 -0
- package/build/features/connectExpress/screens/AuthenticationList/index.js +2 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.d.ts +17 -0
- package/build/features/connectExpress/screens/AuthenticationList/validation.js +9 -0
- package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -6
- package/build/features/entity/Entity.d.ts +1 -0
- package/build/features/entity/Entity.js +4 -4
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/featuresScreens.js +5 -0
- package/build/features/individual/Individual.d.ts +1 -0
- package/build/features/individual/Individual.js +4 -4
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/password/Password.d.ts +1 -0
- package/build/features/password/Password.js +16 -4
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/features/shared/Button/FlowsButtons.d.ts +3 -1
- package/build/features/shared/Button/FlowsButtons.js +14 -11
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +3 -1
- package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +2 -2
- package/build/features/tax/Tax.d.ts +1 -0
- package/build/features/tax/Tax.js +4 -4
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -5
- package/build/hooks/useAppConfig.js +4 -3
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
31
31
|
response: any;
|
|
32
32
|
formData: void;
|
|
33
33
|
} | undefined, void, {}>;
|
|
34
|
+
export declare const onCloseCompleteTax: import("@reduxjs/toolkit").AsyncThunk<void, void, {}>;
|
|
34
35
|
declare type VerifyData = {
|
|
35
36
|
token: string;
|
|
36
37
|
};
|
|
@@ -49,7 +49,7 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
52
|
-
import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep, handlePublicKey } from '../../../app/settings';
|
|
52
|
+
import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep, handlePublicKey, onCloseComplete } from '../../../app/settings';
|
|
53
53
|
import { TAX_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
|
|
@@ -278,6 +278,21 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
|
|
|
278
278
|
}
|
|
279
279
|
});
|
|
280
280
|
}); });
|
|
281
|
+
export var onCloseCompleteTax = createAsyncThunk('password/onCloseCompleteTax', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
282
|
+
var tax, id;
|
|
283
|
+
var _a;
|
|
284
|
+
return __generator(this, function (_b) {
|
|
285
|
+
switch (_b.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
tax = thunkApi.getState().tax;
|
|
288
|
+
id = (((_a = tax.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant) || {}).id;
|
|
289
|
+
return [4, thunkApi.dispatch(onCloseComplete(id))];
|
|
290
|
+
case 1:
|
|
291
|
+
_b.sent();
|
|
292
|
+
return [2];
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}); });
|
|
281
296
|
var initialState = {
|
|
282
297
|
error: null,
|
|
283
298
|
loading: false,
|
|
@@ -441,6 +456,18 @@ export var taxSlice = createSlice({
|
|
|
441
456
|
state.loading = false;
|
|
442
457
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { updateBoardSuccessLoading: false });
|
|
443
458
|
state.error = action.error.message;
|
|
459
|
+
})
|
|
460
|
+
.addCase(onCloseCompleteTax.pending, function (state) {
|
|
461
|
+
state.loading = true;
|
|
462
|
+
state.error = null;
|
|
463
|
+
})
|
|
464
|
+
.addCase(onCloseCompleteTax.fulfilled, function (state) {
|
|
465
|
+
state.loading = false;
|
|
466
|
+
state.error = null;
|
|
467
|
+
})
|
|
468
|
+
.addCase(onCloseCompleteTax.rejected, function (state, action) {
|
|
469
|
+
state.loading = false;
|
|
470
|
+
state.error = action.error.message;
|
|
444
471
|
});
|
|
445
472
|
}
|
|
446
473
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { LibConfig } from '../../@types';
|
|
3
3
|
export interface BankLibProps extends LibConfig {
|
|
4
4
|
verifyToken?: string;
|
|
5
|
+
configToken?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function BankElement(props: BankLibProps): JSX.Element;
|
|
7
8
|
export declare function renderBankLib(config: BankLibProps, elementId: string): {
|
|
@@ -36,11 +36,11 @@ import { bankFeatureScreens } from '../featuresScreens';
|
|
|
36
36
|
import { bankSelector, verifyLeadToken } from '../app/bank/bankStore';
|
|
37
37
|
import Background from '../shared/Background';
|
|
38
38
|
var Bank = memo(function (_a) {
|
|
39
|
-
var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
|
|
39
|
+
var verifyToken = _a.verifyToken, configToken = _a.configToken, props = __rest(_a, ["verifyToken", "configToken"]);
|
|
40
40
|
var theme = useAppTheme().theme;
|
|
41
|
-
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
41
|
+
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
|
|
42
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 }));
|
|
43
|
+
useAppConfig(__assign(__assign({ configToken: configToken, navigation: BANK_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
|
|
44
44
|
useErrorListener(bankError || error);
|
|
45
45
|
useStepStartedListener();
|
|
46
46
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
|
|
@@ -55,7 +55,7 @@ var Bank = memo(function (_a) {
|
|
|
55
55
|
navigation: featureScreensNavigation,
|
|
56
56
|
open: open,
|
|
57
57
|
internalToken: verifyToken,
|
|
58
|
-
settingLoading: settingLoading
|
|
58
|
+
settingLoading: configToken ? internalLoading : settingLoading
|
|
59
59
|
});
|
|
60
60
|
var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
|
|
61
61
|
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', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: isMaturityExpress }, { children: bankFeatureScreens.map(function (_a, index) {
|
|
@@ -11,12 +11,21 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo } from 'react';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
15
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
16
|
+
import { SCOPE_AUTH } from '../../../../constants';
|
|
17
|
+
import { bankSelector, onCloseCompleteBank } from '../../../app/bank/bankStore';
|
|
16
18
|
import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
|
|
17
19
|
var SuccessWithFlowButtons = function () {
|
|
18
|
-
var
|
|
19
|
-
var _a =
|
|
20
|
-
|
|
20
|
+
var dispatch = useAppDispatch();
|
|
21
|
+
var _a = useAppSelector(bankSelector), data = _a.data, loading = _a.loading;
|
|
22
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
|
+
var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
|
|
24
|
+
var redirectUrl = settingsData.appConfig.redirectUrl;
|
|
25
|
+
var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
|
|
26
|
+
var onClose = function () {
|
|
27
|
+
dispatch(onCloseCompleteBank());
|
|
28
|
+
};
|
|
29
|
+
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
|
|
21
30
|
};
|
|
22
31
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { LibConfig } from '../../@types';
|
|
3
3
|
export interface BrandLibProps extends LibConfig {
|
|
4
4
|
verifyToken?: string;
|
|
5
|
+
configToken?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function BrandElement(props: BrandLibProps): JSX.Element;
|
|
7
8
|
export declare function renderBrandLib(config: BrandLibProps, elementId: string): {
|
|
@@ -36,11 +36,11 @@ import { brandFeatureScreens } from '../featuresScreens';
|
|
|
36
36
|
import { brandSelector, verifyLeadToken } from '../app/brand/brandStore';
|
|
37
37
|
import Background from '../shared/Background';
|
|
38
38
|
var Brand = memo(function (_a) {
|
|
39
|
-
var verifyToken = _a.verifyToken, props = __rest(_a, ["verifyToken"]);
|
|
39
|
+
var verifyToken = _a.verifyToken, configToken = _a.configToken, props = __rest(_a, ["verifyToken", "configToken"]);
|
|
40
40
|
var theme = useAppTheme().theme;
|
|
41
|
-
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
41
|
+
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading, internalLoading = _b.internalLoading;
|
|
42
42
|
var _c = useAppSelector(brandSelector), customLoading = _c.customLoading, loading = _c.loading, brandError = _c.error;
|
|
43
|
-
useAppConfig(__assign(__assign({ navigation: BRAND_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
|
|
43
|
+
useAppConfig(__assign(__assign({ configToken: configToken, navigation: BRAND_SCREENS_NAVIGATION }, props), { disableSettingFetching: !!verifyToken }));
|
|
44
44
|
useErrorListener(brandError || error);
|
|
45
45
|
useStepStartedListener();
|
|
46
46
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, featureScreensNavigation = data.featureScreensNavigation, merchant = data.merchant, isMaturityExpress = data.isMaturityExpress;
|
|
@@ -55,7 +55,7 @@ var Brand = memo(function (_a) {
|
|
|
55
55
|
navigation: featureScreensNavigation,
|
|
56
56
|
open: open,
|
|
57
57
|
internalToken: verifyToken,
|
|
58
|
-
settingLoading: settingLoading
|
|
58
|
+
settingLoading: configToken ? internalLoading : settingLoading
|
|
59
59
|
});
|
|
60
60
|
var initialLoading = verifyToken ? settingLoading : settingLoading || customLoading;
|
|
61
61
|
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', screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: isMaturityExpress }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: isMaturityExpress }, { children: brandFeatureScreens.map(function (_a, index) {
|
|
@@ -11,12 +11,21 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { memo } from 'react';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
15
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
16
|
+
import { SCOPE_AUTH } from '../../../../constants';
|
|
17
|
+
import { brandSelector, onCloseCompleteBrand } from '../../../app/brand/brandStore';
|
|
16
18
|
import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
|
|
17
19
|
var SuccessWithFlowButtons = function () {
|
|
18
|
-
var
|
|
19
|
-
var _a =
|
|
20
|
-
|
|
20
|
+
var dispatch = useAppDispatch();
|
|
21
|
+
var _a = useAppSelector(brandSelector), data = _a.data, loading = _a.loading;
|
|
22
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
23
|
+
var isScopeAuthentication = settingsData.appConfig.scope === SCOPE_AUTH;
|
|
24
|
+
var redirectUrl = settingsData.appConfig.redirectUrl;
|
|
25
|
+
var _b = data.verify.responseBody || {}, flows = _b.flows, entity = _b.entity, brand = _b.brand, bank = _b.bank_account, merchant = _b.merchant, user = _b.user, business = _b.business, board_id = _b.board_id, board_info_id = _b.board_info_id, name = _b.name, individuals = _b.individuals;
|
|
26
|
+
var onClose = function () {
|
|
27
|
+
dispatch(onCloseCompleteBrand());
|
|
28
|
+
};
|
|
29
|
+
return (_jsx(SuccessFlowButtons, { flowName: data.flowName, loading: loading, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [], onClose: isScopeAuthentication && redirectUrl ? onClose : undefined }));
|
|
21
30
|
};
|
|
22
31
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -64,7 +64,7 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
|
|
|
64
64
|
import { handleCurrentActiveScreen, settingsSelector } from '../../app/settings';
|
|
65
65
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
66
66
|
import { store } from '../../app/store';
|
|
67
|
-
import { connectExpressSelector, setIsLeadIdPassed,
|
|
67
|
+
import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setShowBoard } from '../app/connectExpress/connectExpressStore';
|
|
68
68
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
69
69
|
import Collapse from '../../components/Collapse';
|
|
70
70
|
import { isKW, findOrCreateElementAndInject, sendPageView } from '../../utils';
|
|
@@ -78,11 +78,9 @@ var ConnectExpress = memo(function (_a) {
|
|
|
78
78
|
var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
|
|
79
79
|
var _c = useAppSelector(connectExpressSelector), connectExpressError = _c.error, loading = _c.loading, customLoading = _c.customLoading, connectData = _c.data;
|
|
80
80
|
var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
-
var _a,
|
|
81
|
+
var _a, lead_id, board;
|
|
82
82
|
return __generator(this, function (_b) {
|
|
83
|
-
_a = data || {},
|
|
84
|
-
if (post === null || post === void 0 ? void 0 : post.url)
|
|
85
|
-
dispatch(setPostUrl(post.url));
|
|
83
|
+
_a = data || {}, lead_id = _a.lead_id, board = _a.board;
|
|
86
84
|
if (lead_id) {
|
|
87
85
|
dispatch(setIsLeadIdPassed(true));
|
|
88
86
|
dispatch(setLeadId(lead_id));
|
|
@@ -92,14 +90,13 @@ var ConnectExpress = memo(function (_a) {
|
|
|
92
90
|
return [2];
|
|
93
91
|
});
|
|
94
92
|
}); };
|
|
95
|
-
useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_EXPRESS_SCREENS_NAVIGATION, maturity: 'express' }, props), { configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
|
|
93
|
+
useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_EXPRESS_SCREENS_NAVIGATION, maturity: 'express' }, props), { postURL: postURL, configToken: configToken }), (configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
|
|
96
94
|
useErrorListener(connectExpressError || error);
|
|
97
95
|
useStepStartedListener();
|
|
98
96
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open, merchant = data.merchant;
|
|
99
97
|
React.useEffect(function () {
|
|
100
98
|
if (!postURL)
|
|
101
|
-
throw new Error('postURL is required and you
|
|
102
|
-
dispatch(setPostUrl(postURL));
|
|
99
|
+
throw new Error('postURL is required and you have to pass it in the lib configuration!');
|
|
103
100
|
if (typeof showBoard === 'boolean')
|
|
104
101
|
dispatch(setShowBoard(showBoard));
|
|
105
102
|
sendPageView({
|
|
@@ -113,7 +110,7 @@ var ConnectExpress = memo(function (_a) {
|
|
|
113
110
|
dispatch(retrieveLeadIdentityByIdAsync(connectData.leadId));
|
|
114
111
|
return;
|
|
115
112
|
}
|
|
116
|
-
if (leadId) {
|
|
113
|
+
if (leadId && props.scope !== 'auth') {
|
|
117
114
|
dispatch(setIsLeadIdPassed(true));
|
|
118
115
|
dispatch(setLeadId(leadId));
|
|
119
116
|
dispatch(retrieveLeadIdentityByIdAsync(leadId));
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Collapse from '@mui/material/Collapse';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
+
import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
|
|
21
|
+
import { AuthForType } from '../../../../@types';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import Button from '../../../shared/Button';
|
|
25
|
+
import { clearError, connectExpressSelector, updateOperatorInfoAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
26
|
+
import { useLanguage } from '../../../../hooks';
|
|
27
|
+
import { AuthenticationListValidationSchema } from './validation';
|
|
28
|
+
import BrandList from './BrandList';
|
|
29
|
+
import EntityList from './EntityList';
|
|
30
|
+
import MerchantList from './MerchantList';
|
|
31
|
+
import TerminalList from './TerminalList';
|
|
32
|
+
var ListType;
|
|
33
|
+
(function (ListType) {
|
|
34
|
+
ListType["BrandList"] = "BrandList";
|
|
35
|
+
ListType["EntityList"] = "EntityList";
|
|
36
|
+
ListType["MerchantList"] = "MerchantList";
|
|
37
|
+
ListType["TerminalList"] = "TerminalList";
|
|
38
|
+
})(ListType || (ListType = {}));
|
|
39
|
+
var AuthenticationList = function (_a) {
|
|
40
|
+
var _b;
|
|
41
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
42
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error, merchantLoading = _c.merchantLoading, terminalLoading = _c.terminalLoading;
|
|
43
|
+
var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo, merchantInfo = _d.merchantInfo, terminalInfo = _d.terminalInfo;
|
|
44
|
+
var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
|
|
45
|
+
var _f = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}, brandList = _f.brandList, entityList = _f.entityList;
|
|
46
|
+
var otpData = data.otpData;
|
|
47
|
+
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
48
|
+
React.useEffect(function () {
|
|
49
|
+
sendCustomEventToGTM({
|
|
50
|
+
event: 'Send Event',
|
|
51
|
+
event_category: 'User Authentication Flow',
|
|
52
|
+
event_action: 'Authentication List Step'
|
|
53
|
+
});
|
|
54
|
+
}, []);
|
|
55
|
+
var methods = useForm({
|
|
56
|
+
resolver: yupResolver(AuthenticationListValidationSchema()),
|
|
57
|
+
defaultValues: {
|
|
58
|
+
brandInfo: brandInfo,
|
|
59
|
+
entityInfo: entityInfo,
|
|
60
|
+
merchantInfo: merchantInfo,
|
|
61
|
+
terminalInfo: terminalInfo
|
|
62
|
+
},
|
|
63
|
+
mode: 'onChange'
|
|
64
|
+
});
|
|
65
|
+
var t = useTranslation().t;
|
|
66
|
+
var isAr = useLanguage().isAr;
|
|
67
|
+
var dispatch = useAppDispatch();
|
|
68
|
+
var onSubmit = function (formData) {
|
|
69
|
+
dispatch(updateOperatorInfoAsync(deepCopy(formData)));
|
|
70
|
+
};
|
|
71
|
+
var onBack = function () {
|
|
72
|
+
var _a;
|
|
73
|
+
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
74
|
+
var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
75
|
+
dispatch(handlePrevScreenStep(screen));
|
|
76
|
+
};
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
if (error)
|
|
79
|
+
dispatch(clearError());
|
|
80
|
+
}, [methods.formState.isValid]);
|
|
81
|
+
var disabled = !methods.formState.isValid || !!error || merchantLoading || terminalLoading;
|
|
82
|
+
var handleMenuClick = function (flag) {
|
|
83
|
+
if (error)
|
|
84
|
+
dispatch(clearError());
|
|
85
|
+
setListActive(flag);
|
|
86
|
+
};
|
|
87
|
+
var isBrandList = listActive === ListType.BrandList;
|
|
88
|
+
var isEntityList = listActive === ListType.EntityList;
|
|
89
|
+
var isMerchantList = listActive === ListType.MerchantList;
|
|
90
|
+
var isTerminalList = listActive === ListType.TerminalList;
|
|
91
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isEntityList && !isMerchantList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { list: entityList || [], countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(MerchantList, { show: !isBrandList && !isEntityList && !isTerminalList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TerminalList, { show: !isBrandList && !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.TerminalList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
92
|
+
};
|
|
93
|
+
export default React.memo(AuthenticationList);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BrandInfo } from '../../../../@types';
|
|
3
|
+
interface BrandListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<BrandInfo>;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
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
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import { useLanguage } from '../../../../hooks';
|
|
30
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
31
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
32
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
34
|
+
import Text from '../../../../components/Text';
|
|
35
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
36
|
+
import Collapse from '../../../../components/Collapse';
|
|
37
|
+
var BrandContainer = styled(Box)(function () { return ({
|
|
38
|
+
display: 'flex'
|
|
39
|
+
}); });
|
|
40
|
+
var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
41
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
42
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
43
|
+
});
|
|
44
|
+
var BrandList = function (_a) {
|
|
45
|
+
var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
|
|
46
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
47
|
+
var t = useTranslation().t;
|
|
48
|
+
var isAr = useLanguage().isAr;
|
|
49
|
+
var control = useFormContext().control;
|
|
50
|
+
var brandInfoControl = useController({ control: control, name: 'brandInfo' });
|
|
51
|
+
var brandInfo = brandInfoControl.field.value;
|
|
52
|
+
var onOpenBrandList = function (event) {
|
|
53
|
+
var _a;
|
|
54
|
+
setAnchorEl(event.currentTarget);
|
|
55
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
56
|
+
};
|
|
57
|
+
var onCloseBrandList = function () {
|
|
58
|
+
var _a;
|
|
59
|
+
setAnchorEl(null);
|
|
60
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
61
|
+
};
|
|
62
|
+
var getBrandName = function (brand) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
if (!brand)
|
|
65
|
+
return '';
|
|
66
|
+
return (isAr ? (_a = brand.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = brand.name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
67
|
+
};
|
|
68
|
+
var getBrandId = function (brand) {
|
|
69
|
+
if (!brand)
|
|
70
|
+
return '';
|
|
71
|
+
return brand.id || '';
|
|
72
|
+
};
|
|
73
|
+
var onSelectItem = function (brand) {
|
|
74
|
+
brandInfoControl.field.onChange(brand);
|
|
75
|
+
onCloseBrandList();
|
|
76
|
+
};
|
|
77
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputSelect, { label: t('select_brand_label'), onClick: !!anchorEl ? onCloseBrandList : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(brandInfo)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
78
|
+
return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(brandInfo) }, { children: t(getBrandName(item)) })) }), getBrandId(item) === getBrandId(brandInfo) && _jsx(CheckIcon, {})] }));
|
|
79
|
+
} }) }))] }) })));
|
|
80
|
+
};
|
|
81
|
+
export default React.memo(BrandList);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CountryCode, EntityLicenseAuth } from '../../../../@types';
|
|
3
|
+
interface EntityListProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
list: Array<EntityLicenseAuth>;
|
|
6
|
+
countryList: Array<CountryCode>;
|
|
7
|
+
onListOpen?: () => void;
|
|
8
|
+
onListClose?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ show, list, countryList, ...rest }: EntityListProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
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
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import { useTranslation } from 'react-i18next';
|
|
26
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
27
|
+
import Box from '@mui/material/Box';
|
|
28
|
+
import { styled } from '@mui/material/styles';
|
|
29
|
+
import { useLanguage } from '../../../../hooks';
|
|
30
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
31
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
32
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
33
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
34
|
+
import Text from '../../../../components/Text';
|
|
35
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
36
|
+
import Collapse from '../../../../components/Collapse';
|
|
37
|
+
import Icon from '../../../../components/Icon';
|
|
38
|
+
var EntityContainer = styled(Box)(function () { return ({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center'
|
|
41
|
+
}); });
|
|
42
|
+
var EntityCountryFlag = styled(Icon)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return ({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
marginInlineEnd: theme.spacing(1.25)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var EntityNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
50
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
51
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
52
|
+
});
|
|
53
|
+
var EntityList = function (_a) {
|
|
54
|
+
var show = _a.show, list = _a.list, countryList = _a.countryList, rest = __rest(_a, ["show", "list", "countryList"]);
|
|
55
|
+
var _b = React.useState(null), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
56
|
+
var t = useTranslation().t;
|
|
57
|
+
var isAr = useLanguage().isAr;
|
|
58
|
+
var control = useFormContext().control;
|
|
59
|
+
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
60
|
+
var selectedEntity = selectedEntityControl.field.value;
|
|
61
|
+
var onOpenEntityList = function (event) {
|
|
62
|
+
var _a;
|
|
63
|
+
setAnchorEl(event.currentTarget);
|
|
64
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
65
|
+
};
|
|
66
|
+
var onCloseEntityList = function () {
|
|
67
|
+
var _a;
|
|
68
|
+
setAnchorEl(null);
|
|
69
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
70
|
+
};
|
|
71
|
+
var getLegalName = function (entity) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if (!entity)
|
|
74
|
+
return '';
|
|
75
|
+
return (isAr ? (_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
76
|
+
};
|
|
77
|
+
var getEntityId = function (entity) {
|
|
78
|
+
if (!entity)
|
|
79
|
+
return '';
|
|
80
|
+
return entity.id || '';
|
|
81
|
+
};
|
|
82
|
+
var getCountryFlag = function (entity) {
|
|
83
|
+
var _a;
|
|
84
|
+
if (!entity)
|
|
85
|
+
return '';
|
|
86
|
+
return ((_a = countryList.find(function (country) { return country.iso2.toLocaleLowerCase() === entity.country.toLocaleLowerCase(); })) === null || _a === void 0 ? void 0 : _a.logo) || '';
|
|
87
|
+
};
|
|
88
|
+
var onSelectItem = function (brand) {
|
|
89
|
+
selectedEntityControl.field.onChange(brand);
|
|
90
|
+
onCloseEntityList();
|
|
91
|
+
};
|
|
92
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_entity_label'), onClick: !!anchorEl ? onCloseEntityList : onOpenEntityList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('select_entity_placeholder'), value: t(getLegalName(selectedEntity)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (entity) {
|
|
93
|
+
return (_jsxs(_Fragment, { children: [_jsxs(EntityContainer, { children: [_jsx(EntityCountryFlag, { src: getCountryFlag(entity) }), _jsx(EntityNameText, __assign({ isSelected: getEntityId(entity) === getEntityId(selectedEntity) }, { children: t(getLegalName(entity)) }))] }), getEntityId(entity) === getEntityId(selectedEntity) && _jsx(CheckIcon, {})] }));
|
|
94
|
+
} }) }))] })) })));
|
|
95
|
+
};
|
|
96
|
+
export default React.memo(EntityList);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface MerchantListProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onListOpen?: () => void;
|
|
5
|
+
onListClose?: () => void;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
isVerified?: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MerchantListProps & React.RefAttributes<unknown>>>;
|
|
10
|
+
export default _default;
|