@tap-payments/auth-jsconnect 2.1.53-test → 2.1.55-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.
@@ -143,6 +143,12 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
143
143
  prev: '',
144
144
  order: 7
145
145
  },
146
+ {
147
+ name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
148
+ next: '',
149
+ prev: '',
150
+ order: 8
151
+ },
146
152
  {
147
153
  name: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
148
154
  next: '',
@@ -1,6 +1,12 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
+ export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
5
+ data: any;
6
+ countryCode: CountryCode;
7
+ boardInfo: any;
8
+ boardData: any;
9
+ }, string, {}>;
4
10
  export declare const getLeadByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
5
11
  data: any;
6
12
  countryCode: CountryCode;
@@ -85,13 +91,13 @@ export interface ConnectExpressData {
85
91
  businessData: BusinessDataFormValues;
86
92
  }
87
93
  export interface ConnectExpressState extends SharedState<ConnectExpressData & ResponseData> {
94
+ customLoading?: boolean;
88
95
  }
89
96
  export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpressState, {
90
97
  setLeadId(state: ConnectExpressState, action: ActionState<string>): void;
91
98
  setIsLeadIdPassed: (state: ConnectExpressState, action: ActionState<boolean>) => void;
92
99
  clearError: (state: ConnectExpressState) => void;
93
100
  setError(state: ConnectExpressState, action: ActionState<string>): void;
94
- setResponseData: (state: ConnectExpressState, action: ActionState<ResponseData['responseData']>) => void;
95
101
  stopLoader: (state: ConnectExpressState) => void;
96
102
  resetMobileScreen: (state: ConnectExpressState, action: ActionState<CountryCode>) => void;
97
103
  resetNIDScreen: (state: ConnectExpressState) => void;
@@ -101,7 +107,7 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpre
101
107
  resetStore: (state: ConnectExpressState) => void;
102
108
  resetIndividualScreen: (state: ConnectExpressState) => void;
103
109
  }, "connectExpress/store">;
104
- export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setResponseData: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<Record<string, any> | undefined, string>, setPostUrl: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
110
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setPostUrl: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
105
111
  declare const _default: import("redux").Reducer<ConnectExpressState, import("redux").AnyAction>;
106
112
  export default _default;
107
113
  export declare const connectExpressSelector: (state: RootState) => ConnectExpressState;
@@ -62,6 +62,48 @@ import API from '../../../api';
62
62
  import { CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
63
63
  import { defaultCountry } from '../../../constants';
64
64
  import { getIndividualName, capitalizeTheFirstLetterOfEachWord, getEighteenYearsAgo, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA } from '../../../utils';
65
+ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var settings, countryCode, boardInfo, boardData, leadData, data, phone, _a, boardInfoRes, boardDataRes, leadDataRes;
67
+ var _b;
68
+ return __generator(this, function (_c) {
69
+ switch (_c.label) {
70
+ case 0:
71
+ settings = thunkApi.getState().settings;
72
+ countryCode = settings.data.businessCountry;
73
+ leadData = undefined;
74
+ return [4, API.leadService.retrieveLeadIdentity(leadId)];
75
+ case 1:
76
+ data = _c.sent();
77
+ phone = (data.contact || {}).phone;
78
+ if (phone === null || phone === void 0 ? void 0 : phone.country_code)
79
+ countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
80
+ if (!(((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'registered')) return [3, 5];
81
+ if (!(data.board_id && data.board_info_id)) return [3, 3];
82
+ return [4, Promise.all([
83
+ API.boardService.retrieveBoardInfo({ id: data.board_id, infoId: data.board_info_id }),
84
+ API.boardService.retrieveBoardDetails(data.board_id),
85
+ thunkApi.dispatch(getLeadByIdAsync(leadId)).unwrap()
86
+ ])];
87
+ case 2:
88
+ _a = _c.sent(), boardInfoRes = _a[0], boardDataRes = _a[1], leadDataRes = _a[2];
89
+ boardInfo = boardInfoRes;
90
+ boardData = boardDataRes;
91
+ leadData = leadDataRes === null || leadDataRes === void 0 ? void 0 : leadDataRes.data;
92
+ thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
93
+ return [3, 4];
94
+ case 3:
95
+ thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
96
+ _c.label = 4;
97
+ case 4: return [3, 6];
98
+ case 5:
99
+ if (!(data === null || data === void 0 ? void 0 : data.identification) && (data === null || data === void 0 ? void 0 : data.phone)) {
100
+ thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
101
+ }
102
+ _c.label = 6;
103
+ case 6: return [2, { data: __assign(__assign({}, data), leadData), countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
104
+ }
105
+ });
106
+ }); });
65
107
  export var getLeadByIdAsync = createAsyncThunk('expressConnect/getLeadByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
108
  var settings, countryCode, data, phone;
67
109
  return __generator(this, function (_a) {
@@ -193,7 +235,7 @@ export var createCivilIdAuthAsync = createAsyncThunk('connectExpress/createCivil
193
235
  });
194
236
  }); });
195
237
  export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
196
- var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, otpData, _c, auth_token, device_token, service_name, payload, data, isSaudi, next_1;
238
+ var _a, settings, connectExpress, _b, responseData, leadId, isLeadIdPassed, otpData, _c, auth_token, device_token, service_name, payload, data, isSaudi, next;
197
239
  var _d, _e;
198
240
  return __generator(this, function (_f) {
199
241
  switch (_f.label) {
@@ -223,10 +265,8 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
223
265
  _f.sent();
224
266
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
225
267
  isSaudi = isSA(settings.data.businessCountry.iso2);
226
- if (!isLeadIdPassed && otpData.authFor === AuthForType.MOBILE) {
227
- next_1 = isSaudi ? 'CONNECT_EXPRESS_NID_MISSED_STEP' : 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP';
228
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(next_1)); });
229
- }
268
+ next = isSaudi ? 'CONNECT_EXPRESS_NID_MISSED_STEP' : 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP';
269
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(next)); });
230
270
  return [2, data];
231
271
  }
232
272
  });
@@ -569,6 +609,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
569
609
  var initialState = {
570
610
  error: null,
571
611
  loading: false,
612
+ customLoading: false,
572
613
  data: {
573
614
  isLeadIdPassed: false,
574
615
  postURL: '',
@@ -616,13 +657,6 @@ export var connectSlice = createSlice({
616
657
  setError: function (state, action) {
617
658
  state.error = action.payload;
618
659
  },
619
- setResponseData: function (state, action) {
620
- var _a;
621
- var leadData = (action.payload || {}).leadData;
622
- state.data.nidData.nid = (_a = leadData === null || leadData === void 0 ? void 0 : leadData.identification) === null || _a === void 0 ? void 0 : _a.id;
623
- state.data.nidData.dob = leadData === null || leadData === void 0 ? void 0 : leadData.date_of_birth;
624
- state.data.responseData = __assign(__assign({}, state.data.responseData), action.payload);
625
- },
626
660
  stopLoader: function (state) {
627
661
  state.loading = false;
628
662
  },
@@ -650,6 +684,27 @@ export var connectSlice = createSlice({
650
684
  },
651
685
  extraReducers: function (builder) {
652
686
  builder
687
+ .addCase(retrieveLeadIdentityByIdAsync.pending, function (state) {
688
+ state.error = null;
689
+ state.customLoading = true;
690
+ })
691
+ .addCase(retrieveLeadIdentityByIdAsync.fulfilled, function (state, action) {
692
+ state.customLoading = false;
693
+ var _a = action.payload, data = _a.data, countryCode = _a.countryCode, boardInfo = _a.boardInfo, boardData = _a.boardData;
694
+ state.data.responseData = __assign(__assign({}, state.data.responseData), { leadData: data, boardInfo: boardInfo, boardData: boardData });
695
+ var _b = data || {}, identification = _b.identification, date_of_birth = _b.date_of_birth, contact = _b.contact;
696
+ state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
697
+ state.data.nidData.dob = date_of_birth;
698
+ var phone = (contact || {}).phone;
699
+ if (phone) {
700
+ state.data.mobileData.mobile = phone === null || phone === void 0 ? void 0 : phone.number;
701
+ state.data.mobileData.countryCode = countryCode;
702
+ }
703
+ })
704
+ .addCase(retrieveLeadIdentityByIdAsync.rejected, function (state, action) {
705
+ state.customLoading = false;
706
+ state.error = action.error.message;
707
+ })
653
708
  .addCase(getLeadByIdAsync.pending, function (state) {
654
709
  state.error = null;
655
710
  state.loading = true;
@@ -905,6 +960,6 @@ export var connectSlice = createSlice({
905
960
  });
906
961
  }
907
962
  });
908
- export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setResponseData = _a.setResponseData, setPostUrl = _a.setPostUrl, setLeadId = _a.setLeadId, resetIndividualScreen = _a.resetIndividualScreen;
963
+ export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setPostUrl = _a.setPostUrl, setLeadId = _a.setLeadId, resetIndividualScreen = _a.resetIndividualScreen;
909
964
  export default connectSlice.reducer;
910
965
  export var connectExpressSelector = function (state) { return state.connectExpress; };
@@ -9,42 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
12
  var __rest = (this && this.__rest) || function (s, e) {
49
13
  var t = {};
50
14
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -63,8 +27,7 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
63
27
  import { handleCurrentActiveScreen, settingsSelector, handleOpen } from '../../app/settings';
64
28
  import AnimationFlow from '../../components/AnimationFlow';
65
29
  import { store } from '../../app/store';
66
- import { connectExpressSelector, setIsLeadIdPassed, setResponseData, setPostUrl, setLeadId } from '../app/connectExpress/connectExpressStore';
67
- import API from '../../api';
30
+ import { connectExpressSelector, setIsLeadIdPassed, setPostUrl, setLeadId, retrieveLeadIdentityByIdAsync } from '../app/connectExpress/connectExpressStore';
68
31
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
69
32
  import Collapse from '../../components/Collapse';
70
33
  import { reactElement, isKW } from '../../utils';
@@ -77,31 +40,23 @@ var ConnectExpress = memo(function (_a) {
77
40
  var theme = useAppTheme().theme;
78
41
  var dispatch = useAppDispatch();
79
42
  var _b = useAppSelector(settingsSelector), data = _b.data, error = _b.error, settingLoading = _b.loading;
80
- var _c = useAppSelector(connectExpressSelector), connectExpressError = _c.error, loading = _c.loading;
81
- var prepare = function () { return __awaiter(void 0, void 0, void 0, function () {
82
- var leadData;
83
- return __generator(this, function (_a) {
84
- switch (_a.label) {
85
- case 0:
86
- if (!postURL)
87
- throw new Error('postURL is required and you ave to pass it in the lib configuration!');
88
- dispatch(setPostUrl(postURL));
89
- if (!leadId)
90
- return [2];
91
- dispatch(setIsLeadIdPassed(true));
92
- dispatch(setLeadId(leadId));
93
- return [4, API.leadService.retrieveLeadIdentity(leadId)];
94
- case 1:
95
- leadData = _a.sent();
96
- dispatch(setResponseData({ leadData: leadData }));
97
- return [2];
98
- }
99
- });
100
- }); };
101
- useAppConfig(__assign(__assign({ navigation: CONNECT_EXPRESS_SCREENS_NAVIGATION }, props), { prepare: prepare }));
43
+ var _c = useAppSelector(connectExpressSelector), connectExpressError = _c.error, loading = _c.loading, customLoading = _c.customLoading;
44
+ useAppConfig(__assign({ navigation: CONNECT_EXPRESS_SCREENS_NAVIGATION }, props));
102
45
  useErrorListener(connectExpressError || error);
103
46
  useStepStartedListener();
104
47
  var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
48
+ React.useEffect(function () {
49
+ if (!postURL)
50
+ throw new Error('postURL is required and you ave to pass it in the lib configuration!');
51
+ dispatch(setPostUrl(postURL));
52
+ }, []);
53
+ React.useEffect(function () {
54
+ if (data.isValidOperator && props.open && !settingLoading && leadId) {
55
+ dispatch(setIsLeadIdPassed(true));
56
+ dispatch(setLeadId(leadId));
57
+ dispatch(retrieveLeadIdentityByIdAsync(leadId));
58
+ }
59
+ }, [data.isValidOperator, settingLoading]);
105
60
  React.useEffect(function () {
106
61
  var _a;
107
62
  if (!settingLoading && isKW((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2)) {
@@ -111,7 +66,7 @@ var ConnectExpress = memo(function (_a) {
111
66
  var handleDialogClose = function () {
112
67
  dispatch(handleOpen(false));
113
68
  };
114
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectExpressFeatureScreens.map(function (_a, index) {
69
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onClose: onClose, onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectExpressFeatureScreens.map(function (_a, index) {
115
70
  var Element = _a.element, name = _a.name;
116
71
  var isActive = activeScreen.name === name;
117
72
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface AccountAlreadyCreatedProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: AccountAlreadyCreatedProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useAppDispatch } from '../../../../hooks';
5
+ import SuccessScreen from '../../../shared/SuccessScreen';
6
+ import { handleOpen } from '../../../../app/settings';
7
+ var AccountAlreadyCreated = function (_a) {
8
+ var t = useTranslation().t;
9
+ var dispatch = useAppDispatch();
10
+ var onSuccess = function () {
11
+ dispatch(handleOpen(false));
12
+ };
13
+ return (_jsx(SuccessScreen, { title: t('express_account_already_created_title'), description: t('express_account_already_created_description'), onSuccess: onSuccess, successTitle: t('express_account_already_created_close_button') }));
14
+ };
15
+ export default React.memo(AccountAlreadyCreated);
@@ -0,0 +1,3 @@
1
+ import AccountAlreadyCreated, { AccountAlreadyCreatedProps } from './AccountAlreadyCreated';
2
+ export type { AccountAlreadyCreatedProps };
3
+ export default AccountAlreadyCreated;
@@ -0,0 +1,2 @@
1
+ import AccountAlreadyCreated from './AccountAlreadyCreated';
2
+ export default AccountAlreadyCreated;
@@ -19,6 +19,7 @@ import ConnectExpressCollectIndividualScreen from './connectExpress/screens/Coll
19
19
  import ConnectExpressCollectBusinessScreen from './connectExpress/screens/CollectBusinessInfo';
20
20
  import ConnectExpressCreateAccountLoaderScreen from './connectExpress/screens/CreateAccountLoader';
21
21
  import ConnectExpressSuccessFlowButtonsScreen from '../features/connectExpress/screens/SuccessWithFlowButtons';
22
+ import ConnectExpressAccountAlreadyCreatedScreen from '../features/connectExpress/screens/AccountAlreadyCreated';
22
23
  import CustomersPage from './business/screens/Customers';
23
24
  import IDBODPage from './business/screens/IDBOD';
24
25
  import BusinessVerifyPage from './business/screens/Verify';
@@ -152,6 +153,10 @@ export var connectExpressFeatureScreens = [
152
153
  name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
153
154
  element: ConnectExpressCollectBusinessScreen
154
155
  },
156
+ {
157
+ name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
158
+ element: ConnectExpressAccountAlreadyCreatedScreen
159
+ },
155
160
  {
156
161
  name: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
157
162
  element: ConnectExpressSuccessFlowButtonsScreen
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { FlowsTypes } from '../../../@types';
3
+ interface SuccessFlowButtonsProps {
4
+ brand: any;
5
+ entity: any;
6
+ business: any;
7
+ merchant: any;
8
+ bank: any;
9
+ user: any;
10
+ flows: any[];
11
+ boardInfoId: string;
12
+ boardId: string;
13
+ flowName: FlowsTypes;
14
+ }
15
+ declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName }: SuccessFlowButtonsProps) => JSX.Element>;
16
+ export default _default;
@@ -0,0 +1,112 @@
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 { 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';
20
+ import { settingsSelector } from '../../../app/settings';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../components/Text';
23
+ import Container from '../Containers/ScreenContainer';
24
+ import AcceptancePayouts from '../AcceptancePayouts';
25
+ var TitleStyled = styled(Text)(function (_a) {
26
+ var _b;
27
+ var theme = _a.theme;
28
+ 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)));
29
+ });
30
+ var ContainerStyled = styled(Container)(function (_a) {
31
+ var theme = _a.theme;
32
+ return ({
33
+ justifyContent: 'space-between',
34
+ minHeight: theme.spacing(30),
35
+ alignItems: 'center'
36
+ });
37
+ });
38
+ var ButtonGroupStyled = styled(Box)(function (_a) {
39
+ var theme = _a.theme;
40
+ return ({
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
43
+ });
44
+ });
45
+ var SuccessFlowButtons = function (_a) {
46
+ var _b, _c, _d;
47
+ var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName;
48
+ var _e = useState([]), buttons = _e[0], setButtons = _e[1];
49
+ var t = useTranslation().t;
50
+ var isAr = useLanguage().isAr;
51
+ var settings = useAppSelector(settingsSelector);
52
+ var _f = user || {}, names = _f.names, identification = _f.identification;
53
+ var primary_contact = (business || {}).primary_contact;
54
+ var _g = entity || {}, license = _g.license, vat_id = _g.vat_id, legal_name = _g.legal_name;
55
+ var username = isAr ? concatenateObjectValues((names === null || names === void 0 ? void 0 : names.ar) || (names === null || names === void 0 ? void 0 : names.en), ['first', 'last']) : concatenateObjectValues(names === null || names === void 0 ? void 0 : names.en, ['first', 'last']);
56
+ var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
57
+ var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
58
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
59
+ var taxID = vat_id || '';
60
+ 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) || '';
61
+ var entityLegalName = shortenString(isAr ? legal_name === null || legal_name === void 0 ? void 0 : legal_name.ar : legal_name === null || legal_name === void 0 ? void 0 : legal_name.en, 20) || '';
62
+ var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
63
+ var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
64
+ var maskedId = (identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
65
+ var email = (primary_contact || {}).email;
66
+ var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, boardId, boardInfoId);
67
+ var reMapFlowData = function (flows) {
68
+ if (flows === void 0) { flows = []; }
69
+ var images = ICONS_NAMES;
70
+ var mappedFlows = flows
71
+ .filter(function (item) { return item === null || item === void 0 ? void 0 : item.name; })
72
+ .map(function (_a) {
73
+ var name = _a.name, url = _a.url, status = _a.status;
74
+ var type = status === 'completed' ? 'completed' : 'pending';
75
+ var title = t("".concat(name, "_flow_").concat(type), {
76
+ individual_name: username.toLowerCase() + maskedId,
77
+ brand: brandName,
78
+ business_type: entityLegalName,
79
+ license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
80
+ bank_name: bankName,
81
+ iban: iban ? t('masking_symbols') + iban : '',
82
+ tax_id: taxID ? t('masking_symbols') + showLastFour(taxID) : ''
83
+ });
84
+ var isCompleted = status === 'completed' && name !== 'password';
85
+ var isIndividual = name === 'individual';
86
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
87
+ var hoverSrc = "".concat(name, "_white_icon");
88
+ return {
89
+ name: name,
90
+ status: status,
91
+ title: title,
92
+ href: url,
93
+ src: images[src],
94
+ hoverSrc: images[hoverSrc],
95
+ isCompleted: isCompleted,
96
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
97
+ };
98
+ });
99
+ setButtons(mappedFlows);
100
+ };
101
+ useEffect(function () {
102
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
103
+ reMapFlowData(flows);
104
+ }, [flows, isAr]);
105
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
106
+ flowName: flowName,
107
+ email: email || '',
108
+ emailUrl: url,
109
+ brandName: shortenBrand(brandName)
110
+ } }) })] }));
111
+ };
112
+ export default memo(SuccessFlowButtons);
@@ -0,0 +1,2 @@
1
+ import FlowsButtons from './SuccessFlowButtons';
2
+ export default FlowsButtons;
@@ -0,0 +1,2 @@
1
+ import FlowsButtons from './SuccessFlowButtons';
2
+ export default FlowsButtons;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.53-test",
3
+ "version": "2.1.55-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const FlowButtons: () => JSX.Element;
3
- declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
- export default _default;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
3
- export var FlowButtons = function () {
4
- return _jsx("div", { children: "FlowButtons" });
5
- };
6
- export default React.memo(FlowButtons);
@@ -1,2 +0,0 @@
1
- import FlowsButtons from './FlowButtons';
2
- export default FlowsButtons;
@@ -1,2 +0,0 @@
1
- import FlowsButtons from './FlowButtons';
2
- export default FlowsButtons;