@tap-payments/auth-jsconnect 2.4.83-test → 2.4.85-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.
|
@@ -109,6 +109,19 @@ export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk
|
|
|
109
109
|
fulfilledMeta?: unknown;
|
|
110
110
|
rejectedMeta?: unknown;
|
|
111
111
|
}>;
|
|
112
|
+
export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
|
|
113
|
+
data: any;
|
|
114
|
+
countryCode: CountryCode;
|
|
115
|
+
}, string, {
|
|
116
|
+
state?: unknown;
|
|
117
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
118
|
+
extra?: unknown;
|
|
119
|
+
rejectValue?: unknown;
|
|
120
|
+
serializedErrorType?: unknown;
|
|
121
|
+
pendingMeta?: unknown;
|
|
122
|
+
fulfilledMeta?: unknown;
|
|
123
|
+
rejectedMeta?: unknown;
|
|
124
|
+
}>;
|
|
112
125
|
export declare const retrieveSegmentDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
113
126
|
segmentLocation: any;
|
|
114
127
|
segmentProfit: any;
|
|
@@ -395,6 +395,26 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
}); });
|
|
398
|
+
export var retrieveLead = createAsyncThunk('connect/retrieveLead', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
399
|
+
var settings, data, countryCode, phone;
|
|
400
|
+
var _a;
|
|
401
|
+
return __generator(this, function (_b) {
|
|
402
|
+
switch (_b.label) {
|
|
403
|
+
case 0:
|
|
404
|
+
settings = thunkApi.getState().settings;
|
|
405
|
+
return [4, API.leadService.retrieveLead(leadId)];
|
|
406
|
+
case 1:
|
|
407
|
+
data = (_b.sent()).data;
|
|
408
|
+
if ((_a = data.errors) === null || _a === void 0 ? void 0 : _a.length)
|
|
409
|
+
throw new Error(data.errors[0].description);
|
|
410
|
+
countryCode = settings.data.businessCountry;
|
|
411
|
+
phone = (data.contact || {}).phone;
|
|
412
|
+
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
413
|
+
countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
|
|
414
|
+
return [2, { data: data, countryCode: countryCode }];
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}); });
|
|
398
418
|
export var retrieveSegmentDataList = createAsyncThunk('connectRetrieveSegmentDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
399
419
|
var dataBody, _a, segmentLocation, segmentProfit, segmentTech;
|
|
400
420
|
return __generator(this, function (_b) {
|
|
@@ -501,8 +521,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
501
521
|
id: '',
|
|
502
522
|
name: {
|
|
503
523
|
en: brandName,
|
|
504
|
-
ar: brandName
|
|
505
|
-
zh: brandName
|
|
524
|
+
ar: brandName
|
|
506
525
|
}
|
|
507
526
|
};
|
|
508
527
|
payload = {
|
|
@@ -1035,6 +1054,43 @@ export var connectSlice = createSlice({
|
|
|
1035
1054
|
.addCase(updateLeadSuccess.rejected, function (state, action) {
|
|
1036
1055
|
state.loading = false;
|
|
1037
1056
|
state.error = action.error.message;
|
|
1057
|
+
})
|
|
1058
|
+
.addCase(retrieveLead.fulfilled, function (state, action) {
|
|
1059
|
+
var _a;
|
|
1060
|
+
state.customLoading = false;
|
|
1061
|
+
state.error = null;
|
|
1062
|
+
var _b = action.payload, data = _b.data, countryCode = _b.countryCode;
|
|
1063
|
+
var _c = data || {}, name = _c.name, contact = _c.contact, brand = _c.brand, identification = _c.identification, date_of_birth = _c.date_of_birth;
|
|
1064
|
+
var _d = contact || {}, email = _d.email, phone = _d.phone;
|
|
1065
|
+
var fullName = concatenateObjectValues(name, ['first', 'middle', 'last']);
|
|
1066
|
+
if (!!fullName) {
|
|
1067
|
+
var capitalizedName = capitalizeTheFirstLetterOfEachWord(fullName);
|
|
1068
|
+
state.data.individualData.name = capitalizedName;
|
|
1069
|
+
}
|
|
1070
|
+
if (email)
|
|
1071
|
+
state.data.individualData.email = email;
|
|
1072
|
+
if (phone === null || phone === void 0 ? void 0 : phone.number) {
|
|
1073
|
+
state.data.mobileData.mobile = phone.number;
|
|
1074
|
+
state.data.individualData.mobile = phone.number;
|
|
1075
|
+
}
|
|
1076
|
+
if (!!countryCode) {
|
|
1077
|
+
state.data.mobileData.countryCode = countryCode;
|
|
1078
|
+
state.data.individualData.countryCode = countryCode;
|
|
1079
|
+
}
|
|
1080
|
+
if ((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en)
|
|
1081
|
+
state.data.brandData.brandName = brand.name.en;
|
|
1082
|
+
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
1083
|
+
state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
1084
|
+
if (date_of_birth)
|
|
1085
|
+
state.data.nidData.dob = date_of_birth;
|
|
1086
|
+
})
|
|
1087
|
+
.addCase(retrieveLead.pending, function (state) {
|
|
1088
|
+
state.customLoading = true;
|
|
1089
|
+
state.error = null;
|
|
1090
|
+
})
|
|
1091
|
+
.addCase(retrieveLead.rejected, function (state, action) {
|
|
1092
|
+
state.customLoading = false;
|
|
1093
|
+
state.error = action.error.message;
|
|
1038
1094
|
});
|
|
1039
1095
|
}
|
|
1040
1096
|
});
|
|
@@ -9,6 +9,42 @@ 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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
+
};
|
|
12
48
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
49
|
import React, { memo } from 'react';
|
|
14
50
|
import { createRoot } from 'react-dom/client';
|
|
@@ -17,7 +53,7 @@ import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepSta
|
|
|
17
53
|
import { handleCurrentActiveScreen, settingsSelector, handleOpen } from '../../app/settings';
|
|
18
54
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
19
55
|
import { store } from '../../app/store';
|
|
20
|
-
import { connectSelector, setDefaultCountryCode } from '../app/connect/connectStore';
|
|
56
|
+
import { connectSelector, retrieveLead, setDefaultCountryCode } from '../app/connect/connectStore';
|
|
21
57
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
22
58
|
import Collapse from '../../components/Collapse';
|
|
23
59
|
import { isKW, findOrCreateElementAndInject, initializeGTM, sendCustomEventToGTM, sendCustomDimension, sendPageView } from '../../utils';
|
|
@@ -28,8 +64,23 @@ var Connect = memo(function (props) {
|
|
|
28
64
|
var theme = useAppTheme().theme;
|
|
29
65
|
var dispatch = useAppDispatch();
|
|
30
66
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
-
var _b = useAppSelector(connectSelector), connectError = _b.error, loading = _b.loading;
|
|
32
|
-
|
|
67
|
+
var _b = useAppSelector(connectSelector), connectError = _b.error, loading = _b.loading, customLoading = _b.customLoading;
|
|
68
|
+
var onVerifyConfigTokenSuccess = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
+
var lead_id;
|
|
70
|
+
return __generator(this, function (_a) {
|
|
71
|
+
switch (_a.label) {
|
|
72
|
+
case 0:
|
|
73
|
+
lead_id = (data || {}).lead_id;
|
|
74
|
+
if (!lead_id) return [3, 2];
|
|
75
|
+
return [4, dispatch(retrieveLead(lead_id))];
|
|
76
|
+
case 1:
|
|
77
|
+
_a.sent();
|
|
78
|
+
_a.label = 2;
|
|
79
|
+
case 2: return [2];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}); };
|
|
83
|
+
useAppConfig(__assign(__assign(__assign({ navigation: CONNECT_SCREENS_NAVIGATION, maturity: 'full' }, props), { configToken: props.configToken }), (props.configToken && { onVerifyConfigTokenSuccess: onVerifyConfigTokenSuccess })));
|
|
33
84
|
useErrorListener(connectError || error, {
|
|
34
85
|
event: 'Send Event',
|
|
35
86
|
event_category: 'User Registration Flow',
|
|
@@ -69,7 +120,7 @@ var Connect = memo(function (props) {
|
|
|
69
120
|
var handleDialogClose = function () {
|
|
70
121
|
dispatch(handleOpen(false));
|
|
71
122
|
};
|
|
72
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
|
|
123
|
+
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', onConfirm: handleDialogClose, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: false }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: false }, { children: connectFeatureScreens.map(function (_a, index) {
|
|
73
124
|
var Element = _a.element, name = _a.name;
|
|
74
125
|
var isActive = activeScreen.name === name;
|
|
75
126
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|