@tap-payments/auth-jsconnect 2.4.98-test → 2.4.99-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/app/settings.js +4 -3
- package/build/features/app/bank/bankStore.js +12 -7
- package/build/features/app/brand/brandStore.js +20 -15
- package/build/features/app/business/businessStore.js +26 -21
- package/build/features/app/entity/entityStore.js +8 -3
- package/build/features/app/individual/individualStore.js +29 -24
- package/build/features/app/password/passwordStore.js +13 -8
- package/build/features/app/tax/taxStore.js +12 -7
- package/package.json +1 -1
package/build/app/settings.js
CHANGED
|
@@ -51,7 +51,7 @@ import { getStoredData, storeData, isArray, findItem, getBrowserInfo, getFingerP
|
|
|
51
51
|
import { DefaultDeviceInfo, LOCAL_STORAGE_KEYS } from '../constants';
|
|
52
52
|
import i18n from '../i18n';
|
|
53
53
|
import { updateLocale } from '../utils/locale';
|
|
54
|
-
import API, { setAxiosGlobalHeaders } from '../api';
|
|
54
|
+
import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../api';
|
|
55
55
|
export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
56
|
var settings, _a, appConfig, language, _b, client, device, os, disableLocale, maturity, disableCountries, configToken, onVerifyConfigTokenSuccess, _c, visitorId, locale, configInfo, matureData, lang, initPayload, _d, country_list, ip_info, merchant, operator, config, list, _e, ip, latitude, longitude, domain, language_1, country, scope, public_key, maturity_1, board_maturity, deviceInfo, isValidOperator, countries, countryCode, isKWOrSA, businessCountry;
|
|
57
57
|
return __generator(this, function (_f) {
|
|
@@ -70,7 +70,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
70
70
|
setAxiosGlobalHeaders({
|
|
71
71
|
bi: visitorId || '',
|
|
72
72
|
mdn: encryptString(params.mdn || window.location.origin),
|
|
73
|
-
authorization:
|
|
73
|
+
authorization: configInfo.publicKey
|
|
74
74
|
});
|
|
75
75
|
initPayload = __assign(__assign({ type: 'website', app_client_version: 'js-auth-connect', requirer_browser: "".concat(client === null || client === void 0 ? void 0 : client.name, " , ").concat(client === null || client === void 0 ? void 0 : client.version), os: "".concat(os === null || os === void 0 ? void 0 : os.name, " , ").concat(os === null || os === void 0 ? void 0 : os.version), locale: language }, (configToken && { config_token: configToken })), { data_required: {
|
|
76
76
|
country_list: !disableCountries
|
|
@@ -125,7 +125,7 @@ export var fetchAppSettingsSync = createAsyncThunk('fetchAppSettingsSync', funct
|
|
|
125
125
|
},
|
|
126
126
|
source: 'browser'
|
|
127
127
|
};
|
|
128
|
-
setAxiosGlobalHeaders(__assign(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization:
|
|
128
|
+
setAxiosGlobalHeaders(__assign(__assign(__assign({}, getRequestHeaders(deviceInfo)), { authorization: configInfo.publicKey, mdn: encryptString(params.mdn || window.location.origin), cu: window.location.href }), (matureData && { maturity: matureData })));
|
|
129
129
|
isValidOperator = operator === 'valid';
|
|
130
130
|
countries = sortCountries(list);
|
|
131
131
|
countryCode = configInfo.businessCountryCode;
|
|
@@ -190,6 +190,7 @@ export var settingsSlice = createSlice({
|
|
|
190
190
|
if (!action.payload)
|
|
191
191
|
return;
|
|
192
192
|
state.data.appConfig.publicKey = action.payload;
|
|
193
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), { authorization: action.payload }));
|
|
193
194
|
},
|
|
194
195
|
handleSwitchCalender: function (state, action) {
|
|
195
196
|
state.data.isHijri = action.payload;
|
|
@@ -72,8 +72,9 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
72
72
|
throw new Error(data.errors[0].description);
|
|
73
73
|
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
|
|
74
74
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
75
|
-
if (publicKey)
|
|
75
|
+
if (publicKey) {
|
|
76
76
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
77
|
+
}
|
|
77
78
|
if (!board_id) return [3, 6];
|
|
78
79
|
if (!board_info_id) return [3, 3];
|
|
79
80
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
@@ -142,10 +143,10 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
|
|
|
142
143
|
});
|
|
143
144
|
}); });
|
|
144
145
|
export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
-
var _a, bank, settings, responseBody, payload, data;
|
|
146
|
-
var _b, _c, _d;
|
|
147
|
-
return __generator(this, function (
|
|
148
|
-
switch (
|
|
146
|
+
var _a, bank, settings, responseBody, payload, data, publicKey;
|
|
147
|
+
var _b, _c, _d, _e;
|
|
148
|
+
return __generator(this, function (_f) {
|
|
149
|
+
switch (_f.label) {
|
|
149
150
|
case 0:
|
|
150
151
|
_a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
|
|
151
152
|
responseBody = bank.data.verify.responseBody;
|
|
@@ -158,9 +159,13 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
158
159
|
};
|
|
159
160
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
160
161
|
case 1:
|
|
161
|
-
data = (
|
|
162
|
+
data = (_f.sent()).data;
|
|
162
163
|
if (!data.errors) {
|
|
163
|
-
|
|
164
|
+
publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
|
|
165
|
+
if (publicKey) {
|
|
166
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
167
|
+
}
|
|
168
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
164
169
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
165
170
|
}
|
|
166
171
|
return [2, { data: data, formData: params }];
|
|
@@ -86,8 +86,9 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
86
86
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
87
|
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
|
|
88
88
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
89
|
-
if (publicKey)
|
|
89
|
+
if (publicKey) {
|
|
90
90
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
91
|
+
}
|
|
91
92
|
if (!board_id) {
|
|
92
93
|
throw new Error('Internal server error');
|
|
93
94
|
}
|
|
@@ -160,10 +161,10 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
160
161
|
});
|
|
161
162
|
}); });
|
|
162
163
|
export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
163
|
-
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
|
|
164
|
-
var _e, _f, _g, _h, _j, _k, _l;
|
|
165
|
-
return __generator(this, function (
|
|
166
|
-
switch (
|
|
164
|
+
var _a, brand, settings, responseBody, payload, data, publicKey, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
|
|
165
|
+
var _e, _f, _g, _h, _j, _k, _l, _m;
|
|
166
|
+
return __generator(this, function (_o) {
|
|
167
|
+
switch (_o.label) {
|
|
167
168
|
case 0:
|
|
168
169
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
169
170
|
responseBody = brand.data.verify.responseBody;
|
|
@@ -176,9 +177,13 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
176
177
|
};
|
|
177
178
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
178
179
|
case 1:
|
|
179
|
-
data = (
|
|
180
|
+
data = (_o.sent()).data;
|
|
180
181
|
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
181
182
|
throw new Error(data.errors[0].description);
|
|
183
|
+
publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
|
|
184
|
+
if (publicKey) {
|
|
185
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
186
|
+
}
|
|
182
187
|
_b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
183
188
|
if (!board_id) {
|
|
184
189
|
throw new Error('Internal server error');
|
|
@@ -187,22 +192,22 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
187
192
|
if (!board_info_id) return [3, 3];
|
|
188
193
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
189
194
|
case 2:
|
|
190
|
-
boardInfoData =
|
|
191
|
-
|
|
195
|
+
boardInfoData = _o.sent();
|
|
196
|
+
_o.label = 3;
|
|
192
197
|
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
193
198
|
case 4:
|
|
194
|
-
boardData =
|
|
195
|
-
_c = ((
|
|
199
|
+
boardData = _o.sent();
|
|
200
|
+
_c = ((_h = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _h === void 0 ? void 0 : _h.recipient) || {}, id = _c.id, type = _c.type;
|
|
196
201
|
serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
|
|
197
202
|
return [4, retrieveIndividualData(type, boardData, serviceCallBack)];
|
|
198
203
|
case 5:
|
|
199
|
-
_d =
|
|
204
|
+
_d = _o.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
|
|
200
205
|
boardData = boardRes;
|
|
201
206
|
individualData = individualRes;
|
|
202
|
-
(
|
|
207
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
|
|
203
208
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
204
209
|
case 6:
|
|
205
|
-
salesChannels =
|
|
210
|
+
salesChannels = _o.sent();
|
|
206
211
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
207
212
|
return [2, {
|
|
208
213
|
data: data,
|
|
@@ -213,8 +218,8 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
213
218
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
214
219
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
215
220
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
216
|
-
name: (
|
|
217
|
-
contact: (
|
|
221
|
+
name: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.names,
|
|
222
|
+
contact: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.contact,
|
|
218
223
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
219
224
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
220
225
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
@@ -79,8 +79,9 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
79
79
|
if (data.mw_error)
|
|
80
80
|
throw new Error(data.mw_error);
|
|
81
81
|
publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
|
|
82
|
-
if (publicKey)
|
|
82
|
+
if (publicKey) {
|
|
83
83
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
84
|
+
}
|
|
84
85
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
85
86
|
if (countryIso2)
|
|
86
87
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -192,10 +193,10 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
192
193
|
});
|
|
193
194
|
}); });
|
|
194
195
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
|
-
var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
|
|
196
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
197
|
-
return __generator(this, function (
|
|
198
|
-
switch (
|
|
196
|
+
var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
|
|
197
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
198
|
+
return __generator(this, function (_k) {
|
|
199
|
+
switch (_k.label) {
|
|
199
200
|
case 0:
|
|
200
201
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
201
202
|
isNID = business.data.otpData.isNID;
|
|
@@ -210,20 +211,24 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
210
211
|
};
|
|
211
212
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
212
213
|
case 1:
|
|
213
|
-
data = (
|
|
214
|
+
data = (_k.sent()).data;
|
|
214
215
|
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
215
216
|
throw new Error(data.errors[0].description);
|
|
217
|
+
publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
|
|
218
|
+
if (publicKey) {
|
|
219
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
220
|
+
}
|
|
216
221
|
isicActivityList = undefined;
|
|
217
222
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
218
223
|
case 2:
|
|
219
|
-
leadData = (
|
|
224
|
+
leadData = (_k.sent()).data;
|
|
220
225
|
thunkApi.dispatch(updateStepName(stepName));
|
|
221
226
|
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
|
|
222
227
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
223
228
|
countryIso2 = country_code;
|
|
224
229
|
if (countryIso2)
|
|
225
230
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
226
|
-
(
|
|
231
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
|
|
227
232
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
228
233
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
229
234
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
@@ -232,14 +237,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
232
237
|
if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
|
|
233
238
|
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
234
239
|
case 3:
|
|
235
|
-
|
|
236
|
-
|
|
240
|
+
_k.sent();
|
|
241
|
+
_k.label = 4;
|
|
237
242
|
case 4:
|
|
238
243
|
if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
|
|
239
244
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
240
245
|
case 5:
|
|
241
|
-
|
|
242
|
-
|
|
246
|
+
_k.sent();
|
|
247
|
+
_k.label = 6;
|
|
243
248
|
case 6:
|
|
244
249
|
if (!isNID) return [3, 7];
|
|
245
250
|
thunkApi.dispatch(handleNextScreenStep());
|
|
@@ -253,12 +258,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
253
258
|
if (!board_id) return [3, 11];
|
|
254
259
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
255
260
|
case 9:
|
|
256
|
-
boardResponse =
|
|
261
|
+
boardResponse = _k.sent();
|
|
257
262
|
leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
|
|
258
263
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
259
264
|
case 10:
|
|
260
|
-
|
|
261
|
-
|
|
265
|
+
_k.sent();
|
|
266
|
+
_k.label = 11;
|
|
262
267
|
case 11:
|
|
263
268
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
264
269
|
return [3, 22];
|
|
@@ -274,30 +279,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
274
279
|
if (!hasBusinessCRActivitiesCompleted) return [3, 18];
|
|
275
280
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
276
281
|
case 15:
|
|
277
|
-
list = (
|
|
282
|
+
list = (_k.sent()).list;
|
|
278
283
|
isicActivityList = list || [];
|
|
279
284
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
280
285
|
case 16:
|
|
281
|
-
|
|
286
|
+
_k.sent();
|
|
282
287
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
283
288
|
case 17:
|
|
284
|
-
brandData =
|
|
289
|
+
brandData = _k.sent();
|
|
285
290
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
286
291
|
return [3, 22];
|
|
287
292
|
case 18:
|
|
288
293
|
if (!hasBusinessCRInfoCompleted) return [3, 21];
|
|
289
294
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
290
295
|
case 19:
|
|
291
|
-
list = (
|
|
296
|
+
list = (_k.sent()).list;
|
|
292
297
|
isicActivityList = list || [];
|
|
293
298
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
294
299
|
case 20:
|
|
295
|
-
brandData =
|
|
300
|
+
brandData = _k.sent();
|
|
296
301
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
297
302
|
return [3, 22];
|
|
298
303
|
case 21:
|
|
299
304
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
300
|
-
|
|
305
|
+
_k.label = 22;
|
|
301
306
|
case 22: return [2, { data: data, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
302
307
|
}
|
|
303
308
|
});
|
|
@@ -89,8 +89,9 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
89
89
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
90
90
|
}
|
|
91
91
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
92
|
-
if (publicKey)
|
|
92
|
+
if (publicKey) {
|
|
93
93
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
94
|
+
}
|
|
94
95
|
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 10];
|
|
95
96
|
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
96
97
|
if (!board_id) return [3, 6];
|
|
@@ -169,7 +170,7 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
169
170
|
});
|
|
170
171
|
}); });
|
|
171
172
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_2, type_2, serviceCallBack, _d, boardRes, individualRes, entityId;
|
|
173
|
+
var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, individualData, _b, board_id, board_info_id, config, publicKey, _c, id_2, type_2, serviceCallBack, _d, boardRes, individualRes, entityId;
|
|
173
174
|
var _e, _f, _g, _h, _j, _k, _l;
|
|
174
175
|
return __generator(this, function (_m) {
|
|
175
176
|
switch (_m.label) {
|
|
@@ -188,7 +189,11 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
188
189
|
data = (_m.sent()).data;
|
|
189
190
|
individualData = undefined;
|
|
190
191
|
if (!!data.errors) return [3, 10];
|
|
191
|
-
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
192
|
+
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
|
|
193
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
194
|
+
if (publicKey) {
|
|
195
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
196
|
+
}
|
|
192
197
|
if (!board_id) return [3, 6];
|
|
193
198
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
194
199
|
case 2:
|
|
@@ -99,8 +99,9 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
99
99
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
100
100
|
}
|
|
101
101
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
102
|
-
if (publicKey)
|
|
102
|
+
if (publicKey) {
|
|
103
103
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
104
|
+
}
|
|
104
105
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
105
106
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
106
107
|
return [3, 16];
|
|
@@ -422,10 +423,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
422
423
|
});
|
|
423
424
|
}); });
|
|
424
425
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
425
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, countryCode, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
|
|
426
|
-
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
427
|
-
return __generator(this, function (
|
|
428
|
-
switch (
|
|
426
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, boardInfoStatus, publicKey, countryCode, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
|
|
427
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
428
|
+
return __generator(this, function (_r) {
|
|
429
|
+
switch (_r.label) {
|
|
429
430
|
case 0:
|
|
430
431
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
431
432
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -440,55 +441,59 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
440
441
|
};
|
|
441
442
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
442
443
|
case 1:
|
|
443
|
-
data = (
|
|
444
|
+
data = (_r.sent()).data;
|
|
444
445
|
boardInfoStatus = undefined;
|
|
445
446
|
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
446
447
|
throw new Error(data.errors[0].description);
|
|
448
|
+
publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
|
|
449
|
+
if (publicKey) {
|
|
450
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
451
|
+
}
|
|
447
452
|
if (!board_id) return [3, 3];
|
|
448
453
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
449
454
|
case 2:
|
|
450
|
-
boardData =
|
|
451
|
-
|
|
455
|
+
boardData = _r.sent();
|
|
456
|
+
_r.label = 3;
|
|
452
457
|
case 3:
|
|
453
|
-
countryCode = (
|
|
458
|
+
countryCode = (_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.country;
|
|
454
459
|
if (!(board_id && board_info_id)) return [3, 6];
|
|
455
460
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
456
461
|
case 4:
|
|
457
|
-
boardInfoData =
|
|
462
|
+
boardInfoData = _r.sent();
|
|
458
463
|
notification = (boardInfoData || {}).notification;
|
|
459
464
|
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
460
465
|
if (!(id && type)) return [3, 6];
|
|
461
466
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
462
467
|
case 5:
|
|
463
|
-
data_3 = (
|
|
468
|
+
data_3 = (_r.sent()).data;
|
|
464
469
|
individualData = data_3 || {};
|
|
465
|
-
|
|
470
|
+
_r.label = 6;
|
|
466
471
|
case 6:
|
|
467
472
|
if (countryCode)
|
|
468
473
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
469
474
|
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
|
|
470
|
-
if (!((
|
|
471
|
-
return [4, thunkApi.dispatch(getIndividualList((
|
|
475
|
+
if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
|
|
476
|
+
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
|
|
472
477
|
case 7:
|
|
473
|
-
|
|
474
|
-
|
|
478
|
+
_r.sent();
|
|
479
|
+
_r.label = 8;
|
|
475
480
|
case 8: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
476
481
|
case 9:
|
|
477
|
-
boardInfoStatus =
|
|
482
|
+
boardInfoStatus = _r.sent();
|
|
478
483
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
479
484
|
return [3, 13];
|
|
480
485
|
case 10:
|
|
481
|
-
birthCountry = ((
|
|
486
|
+
birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
|
|
482
487
|
if (!birthCountry) return [3, 12];
|
|
483
488
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
484
489
|
case 11:
|
|
485
|
-
|
|
486
|
-
|
|
490
|
+
_r.sent();
|
|
491
|
+
_r.label = 12;
|
|
487
492
|
case 12:
|
|
488
493
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
489
|
-
|
|
494
|
+
_r.label = 13;
|
|
490
495
|
case 13:
|
|
491
|
-
(
|
|
496
|
+
(_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, { otp: params.otp });
|
|
492
497
|
individuals = (boardData || {}).individuals;
|
|
493
498
|
_d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
|
|
494
499
|
return [2, {
|
|
@@ -499,8 +504,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
499
504
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
500
505
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
501
506
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
502
|
-
name: (
|
|
503
|
-
contact: (
|
|
507
|
+
name: (_p = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _p === void 0 ? void 0 : _p.names,
|
|
508
|
+
contact: (_q = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _q === void 0 ? void 0 : _q.contact,
|
|
504
509
|
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
505
510
|
countries: countries,
|
|
506
511
|
countryCode: countryCode,
|
|
@@ -69,8 +69,9 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
|
|
|
69
69
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
|
|
70
70
|
_a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id, config = _a.config;
|
|
71
71
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
72
|
-
if (publicKey)
|
|
72
|
+
if (publicKey) {
|
|
73
73
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
74
|
+
}
|
|
74
75
|
if (!board_id) return [3, 7];
|
|
75
76
|
if (!board_info_id) return [3, 3];
|
|
76
77
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
@@ -148,10 +149,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrievePasswordBoardDetails
|
|
|
148
149
|
});
|
|
149
150
|
}); });
|
|
150
151
|
export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
-
var _a, password, settings, responseBody, payload, data, flows, hasPasswordCompleted;
|
|
152
|
-
var _b, _c, _d, _e;
|
|
153
|
-
return __generator(this, function (
|
|
154
|
-
switch (
|
|
152
|
+
var _a, password, settings, responseBody, payload, data, publicKey, flows, hasPasswordCompleted;
|
|
153
|
+
var _b, _c, _d, _e, _f;
|
|
154
|
+
return __generator(this, function (_g) {
|
|
155
|
+
switch (_g.label) {
|
|
155
156
|
case 0:
|
|
156
157
|
_a = thunkApi.getState(), password = _a.password, settings = _a.settings;
|
|
157
158
|
responseBody = password.data.verify.responseBody;
|
|
@@ -164,11 +165,15 @@ export var verifyPasswordLeadOTP = createAsyncThunk('verifyPasswordLeadOTP', fun
|
|
|
164
165
|
};
|
|
165
166
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
166
167
|
case 1:
|
|
167
|
-
data = (
|
|
168
|
+
data = (_g.sent()).data;
|
|
168
169
|
if (!data.errors) {
|
|
169
|
-
|
|
170
|
+
publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
|
|
171
|
+
if (publicKey) {
|
|
172
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
173
|
+
}
|
|
174
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
170
175
|
flows = (responseBody || {}).flows;
|
|
171
|
-
hasPasswordCompleted = ((
|
|
176
|
+
hasPasswordCompleted = ((_f = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
172
177
|
if (hasPasswordCompleted) {
|
|
173
178
|
thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
174
179
|
}
|
|
@@ -73,8 +73,9 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
73
73
|
if (isInternally)
|
|
74
74
|
data.step_name = TAX_STEP_NAMES.TAX_INFO;
|
|
75
75
|
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
76
|
-
if (publicKey)
|
|
76
|
+
if (publicKey) {
|
|
77
77
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
78
|
+
}
|
|
78
79
|
if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 6];
|
|
79
80
|
if (!data.board_info_id) return [3, 3];
|
|
80
81
|
return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
|
|
@@ -156,10 +157,10 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveTaxEntityInfo', functi
|
|
|
156
157
|
});
|
|
157
158
|
}); });
|
|
158
159
|
export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
159
|
-
var _a, tax, settings, responseBody, payload, data;
|
|
160
|
-
var _b, _c, _d, _e;
|
|
161
|
-
return __generator(this, function (
|
|
162
|
-
switch (
|
|
160
|
+
var _a, tax, settings, responseBody, payload, data, publicKey;
|
|
161
|
+
var _b, _c, _d, _e, _f;
|
|
162
|
+
return __generator(this, function (_g) {
|
|
163
|
+
switch (_g.label) {
|
|
163
164
|
case 0:
|
|
164
165
|
_a = thunkApi.getState(), tax = _a.tax, settings = _a.settings;
|
|
165
166
|
responseBody = tax.data.verify.responseBody;
|
|
@@ -172,10 +173,14 @@ export var verifyTaxLeadOTP = createAsyncThunk('verifyTaxLeadOTP', function (par
|
|
|
172
173
|
};
|
|
173
174
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
174
175
|
case 1:
|
|
175
|
-
data = (
|
|
176
|
+
data = (_g.sent()).data;
|
|
176
177
|
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
177
178
|
throw new Error(data.errors[0].description);
|
|
178
|
-
|
|
179
|
+
publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
|
|
180
|
+
if (publicKey) {
|
|
181
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
182
|
+
}
|
|
183
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
|
|
179
184
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('TAX_TAX_DETAILS_STEP')); });
|
|
180
185
|
return [2, { data: data, formData: params }];
|
|
181
186
|
}
|