@tap-payments/auth-jsconnect 2.0.3 → 2.0.6
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 +5 -0
- package/build/@types/form.d.ts +4 -1
- package/build/api/auth.d.ts +20 -3
- package/build/api/axios.js +8 -9
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +9 -2
- package/build/api/entity.d.ts +13 -1
- package/build/api/entity.js +20 -2
- package/build/api/index.d.ts +7 -4
- package/build/api/lead.d.ts +3 -1
- package/build/api/lead.js +14 -2
- package/build/assets/locales/ar.json +4 -1
- package/build/assets/locales/en.json +4 -1
- package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
- package/build/components/AnimationFlow/AnimationFlow.js +2 -2
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +16 -4
- package/build/components/FileInput/DragAndDrop.d.ts +7 -0
- package/build/components/FileInput/DragAndDrop.js +39 -0
- package/build/components/FileInput/UploadInput.d.ts +7 -0
- package/build/components/FileInput/UploadInput.js +38 -0
- package/build/components/FileInput/index.d.ts +3 -0
- package/build/components/FileInput/index.js +3 -0
- package/build/constants/api.d.ts +3 -1
- package/build/constants/api.js +7 -3
- package/build/constants/app.d.ts +5 -0
- package/build/constants/app.js +55 -9
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +1 -0
- package/build/constants/validation.d.ts +2 -0
- package/build/constants/validation.js +2 -0
- package/build/features/app/bank/bankStore.d.ts +1 -0
- package/build/features/app/bank/bankStore.js +61 -20
- package/build/features/app/business/businessStore.d.ts +3 -5
- package/build/features/app/business/businessStore.js +149 -50
- package/build/features/app/connect/connectStore.d.ts +5 -10
- package/build/features/app/connect/connectStore.js +135 -41
- package/build/features/app/individual/individualStore.d.ts +3 -2
- package/build/features/app/individual/individualStore.js +52 -39
- package/build/features/app/password/passwordStore.d.ts +32 -1
- package/build/features/app/password/passwordStore.js +199 -16
- package/build/features/app/tax/taxStore.js +21 -14
- package/build/features/bank/Bank.js +3 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.d.ts +3 -0
- package/build/features/bank/screens/BankDetails/BankStatement.js +38 -0
- package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
- package/build/features/bank/screens/BankDetails/validation.js +1 -0
- package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/bank/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/bank/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/bank/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
- package/build/features/business/Business.js +3 -4
- package/build/features/business/screens/Activities/Activities.js +2 -1
- package/build/features/business/screens/Activities/LicenseName.d.ts +5 -0
- package/build/features/business/screens/Activities/LicenseName.js +30 -0
- package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
- package/build/features/business/screens/OTP/OTPInput.js +3 -9
- package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/business/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/business/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/business/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -17
- package/build/features/connect/Connect.js +1 -1
- package/build/features/connect/screens/Merchant/BrandList.js +1 -5
- package/build/features/connect/screens/Merchant/Merchant.js +10 -8
- package/build/features/connect/screens/Merchant/validation.js +4 -2
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
- package/build/features/connect/screens/NID/IDNumber.js +1 -1
- package/build/features/connect/screens/NID/NID.js +2 -2
- package/build/features/connect/screens/OTP/OTPInput.js +3 -13
- package/build/features/featuresScreens.js +20 -5
- package/build/features/individual/Individual.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
- package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/individual/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/individual/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/individual/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
- package/build/features/password/Password.js +11 -6
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
- package/build/features/password/screens/OTP/OTP.d.ts +8 -0
- package/build/features/password/screens/OTP/OTP.js +78 -0
- package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/password/screens/OTP/OTPInput.js +46 -0
- package/build/features/password/screens/OTP/index.d.ts +3 -0
- package/build/features/password/screens/OTP/index.js +2 -0
- package/build/features/password/screens/OTP/validation.d.ts +8 -0
- package/build/features/password/screens/OTP/validation.js +4 -0
- package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/password/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/password/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/password/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/password/screens/Success/Success.js +8 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +24 -16
- package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
- package/build/features/password/screens/Verify/OTPInput.js +1 -1
- package/build/features/shared/Button/Button.js +1 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
- package/build/features/shared/Button/FlowsButtons.js +90 -6
- package/build/features/shared/Button/SuccessButton.js +31 -13
- package/build/features/shared/UploadFile/UploadFile.d.ts +21 -0
- package/build/features/shared/UploadFile/UploadFile.js +77 -0
- package/build/features/shared/UploadFile/index.d.ts +2 -0
- package/build/features/shared/UploadFile/index.js +2 -0
- package/build/features/tax/Tax.js +3 -4
- package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/tax/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/tax/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/tax/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +23 -15
- package/build/hooks/useAppTheme.js +3 -2
- package/build/index.css +4 -0
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +1 -2
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +6 -1
- package/package.json +2 -1
|
@@ -62,7 +62,7 @@ import { BusinessType, FlowsTypes } from '../../../@types';
|
|
|
62
62
|
import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
63
63
|
import { convertNumbers2English, getFlowUrl, hasKey } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
|
-
export var verifyLeadToken = createAsyncThunk('
|
|
65
|
+
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var payload, data, leadResponse;
|
|
67
67
|
return __generator(this, function (_a) {
|
|
68
68
|
switch (_a.label) {
|
|
@@ -108,7 +108,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
108
108
|
});
|
|
109
109
|
}); });
|
|
110
110
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted;
|
|
111
|
+
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, payload, data, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted;
|
|
112
112
|
var _b, _c, _d, _e;
|
|
113
113
|
return __generator(this, function (_f) {
|
|
114
114
|
switch (_f.label) {
|
|
@@ -128,7 +128,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
128
128
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
129
129
|
case 1:
|
|
130
130
|
data = (_f.sent()).data;
|
|
131
|
-
if (!!data.errors) return [3,
|
|
131
|
+
if (!!data.errors) return [3, 9];
|
|
132
132
|
thunkApi.dispatch(updateStepName(stepName));
|
|
133
133
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
134
134
|
case 2:
|
|
@@ -136,42 +136,46 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
136
136
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
137
137
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
138
138
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
139
|
+
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
|
|
139
140
|
if (!isNID) return [3, 3];
|
|
140
141
|
thunkApi.dispatch(handleNextScreenStep());
|
|
141
|
-
return [3,
|
|
142
|
+
return [3, 9];
|
|
142
143
|
case 3:
|
|
143
144
|
if (!hasBusinessCompleted) return [3, 5];
|
|
144
145
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_e = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _e === void 0 ? void 0 : _e.id))];
|
|
145
146
|
case 4:
|
|
146
147
|
_f.sent();
|
|
147
148
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
148
|
-
return [3,
|
|
149
|
+
return [3, 9];
|
|
149
150
|
case 5:
|
|
150
|
-
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 6];
|
|
152
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
153
|
+
return [3, 9];
|
|
154
|
+
case 6:
|
|
155
|
+
if (!hasBusinessCRInfoCompleted) return [3, 8];
|
|
156
|
+
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
157
|
+
case 7:
|
|
158
|
+
_f.sent();
|
|
159
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
160
|
+
return [3, 9];
|
|
161
|
+
case 8:
|
|
162
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
163
|
+
_f.label = 9;
|
|
164
|
+
case 9: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
|
|
158
165
|
}
|
|
159
166
|
});
|
|
160
167
|
}); });
|
|
161
168
|
export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
|
-
var _a, settings, business, identification_id_type, stepName,
|
|
163
|
-
var _b, _c, _d
|
|
164
|
-
return __generator(this, function (
|
|
165
|
-
switch (
|
|
169
|
+
var _a, settings, business, identification_id_type, stepName, requestBody, data;
|
|
170
|
+
var _b, _c, _d;
|
|
171
|
+
return __generator(this, function (_e) {
|
|
172
|
+
switch (_e.label) {
|
|
166
173
|
case 0:
|
|
167
174
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
168
175
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
169
176
|
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
170
|
-
headers = {
|
|
171
|
-
lead_id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
172
|
-
device_identifier: (_d = (_c = settings.data.deviceInfo) === null || _c === void 0 ? void 0 : _c.browser) === null || _d === void 0 ? void 0 : _d.browser_id
|
|
173
|
-
};
|
|
174
177
|
requestBody = {
|
|
178
|
+
id: ((_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.id) || '',
|
|
175
179
|
identification_id: params.nid,
|
|
176
180
|
identification_id_type: identification_id_type,
|
|
177
181
|
date_of_birth: params.dob,
|
|
@@ -179,18 +183,57 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
179
183
|
step_name: stepName,
|
|
180
184
|
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
181
185
|
};
|
|
182
|
-
return [4, API.leadService.updateLeadIdentity(requestBody
|
|
186
|
+
return [4, API.leadService.updateLeadIdentity(requestBody)];
|
|
183
187
|
case 1:
|
|
184
|
-
data = (
|
|
185
|
-
if (!data.errors
|
|
188
|
+
data = (_e.sent()).data;
|
|
189
|
+
if (!data.errors) {
|
|
186
190
|
thunkApi.dispatch(updateStepName(stepName));
|
|
187
191
|
thunkApi.dispatch(handleNextScreenStep());
|
|
188
|
-
(
|
|
192
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
189
193
|
}
|
|
190
194
|
return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
191
195
|
}
|
|
192
196
|
});
|
|
193
197
|
}); });
|
|
198
|
+
export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
199
|
+
var _a, settings, business, _b, nid, dob, type, stepName, requestBody, data;
|
|
200
|
+
var _c;
|
|
201
|
+
return __generator(this, function (_d) {
|
|
202
|
+
switch (_d.label) {
|
|
203
|
+
case 0:
|
|
204
|
+
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
205
|
+
_b = business.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
|
|
206
|
+
stepName = BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
207
|
+
requestBody = {
|
|
208
|
+
id: ((_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.id) || '',
|
|
209
|
+
identification_id: nid,
|
|
210
|
+
identification_id_type: type,
|
|
211
|
+
date_of_birth: dob,
|
|
212
|
+
country_code: settings.data.businessCountry.iso2,
|
|
213
|
+
step_name: stepName,
|
|
214
|
+
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
215
|
+
};
|
|
216
|
+
return [4, API.leadService.updateLeadIdentity(requestBody)];
|
|
217
|
+
case 1:
|
|
218
|
+
data = (_d.sent()).data;
|
|
219
|
+
if (!data.errors) {
|
|
220
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
221
|
+
}
|
|
222
|
+
return [2, data];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}); });
|
|
226
|
+
export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
227
|
+
var data;
|
|
228
|
+
return __generator(this, function (_a) {
|
|
229
|
+
switch (_a.label) {
|
|
230
|
+
case 0: return [4, API.dataService.getChannelsOfServices()];
|
|
231
|
+
case 1:
|
|
232
|
+
data = (_a.sent()).data;
|
|
233
|
+
return [2, data];
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}); });
|
|
194
237
|
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
238
|
var data;
|
|
196
239
|
return __generator(this, function (_a) {
|
|
@@ -242,7 +285,7 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
242
285
|
});
|
|
243
286
|
}); });
|
|
244
287
|
export var createAccount = createAsyncThunk('createAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
245
|
-
var _a, settings, business, requestBody, data
|
|
288
|
+
var _a, settings, business, requestBody, data;
|
|
246
289
|
var _b, _c, _d;
|
|
247
290
|
return __generator(this, function (_e) {
|
|
248
291
|
switch (_e.label) {
|
|
@@ -261,15 +304,14 @@ export var createAccount = createAsyncThunk('createAccount', function (params, t
|
|
|
261
304
|
return [4, API.accountService.createAccount(requestBody)];
|
|
262
305
|
case 1:
|
|
263
306
|
data = (_e.sent()).data;
|
|
264
|
-
channels = undefined;
|
|
265
307
|
if (!!data.errors) return [3, 3];
|
|
266
|
-
return [4,
|
|
308
|
+
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
267
309
|
case 2:
|
|
268
|
-
|
|
310
|
+
_e.sent();
|
|
269
311
|
thunkApi.dispatch(handleNextScreenStep());
|
|
270
312
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
271
313
|
_e.label = 3;
|
|
272
|
-
case 3: return [2, { data: data
|
|
314
|
+
case 3: return [2, { data: data }];
|
|
273
315
|
}
|
|
274
316
|
});
|
|
275
317
|
}); });
|
|
@@ -311,7 +353,7 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
|
|
|
311
353
|
}
|
|
312
354
|
});
|
|
313
355
|
}); });
|
|
314
|
-
export var retrieveDataList = createAsyncThunk('
|
|
356
|
+
export var retrieveDataList = createAsyncThunk('bankRetrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
315
357
|
var _a, customerBases, expectedSales, expectedCustomerSales;
|
|
316
358
|
return __generator(this, function (_b) {
|
|
317
359
|
switch (_b.label) {
|
|
@@ -365,7 +407,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
365
407
|
}
|
|
366
408
|
});
|
|
367
409
|
}); });
|
|
368
|
-
export var updateLeadSuccess = createAsyncThunk('
|
|
410
|
+
export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
369
411
|
var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
|
|
370
412
|
var _c, _d, _e, _f, _g;
|
|
371
413
|
return __generator(this, function (_h) {
|
|
@@ -403,13 +445,15 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
|
|
|
403
445
|
return [4, API.leadService.updateLead(payload)];
|
|
404
446
|
case 1:
|
|
405
447
|
data = (_h.sent()).data;
|
|
448
|
+
if (!!data.errors) return [3, 3];
|
|
406
449
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
407
450
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
408
451
|
return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data.entity) === null || _g === void 0 ? void 0 : _g.id))];
|
|
409
452
|
case 2:
|
|
410
453
|
_h.sent();
|
|
411
454
|
thunkApi.dispatch(handleNextScreenStep());
|
|
412
|
-
|
|
455
|
+
_h.label = 3;
|
|
456
|
+
case 3: return [2, { response: data, formData: params }];
|
|
413
457
|
}
|
|
414
458
|
});
|
|
415
459
|
}); });
|
|
@@ -527,10 +571,10 @@ export var businessSlice = createSlice({
|
|
|
527
571
|
state.error = null;
|
|
528
572
|
})
|
|
529
573
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
530
|
-
var _a;
|
|
574
|
+
var _a, _b, _c;
|
|
531
575
|
state.loading = false;
|
|
532
576
|
state.error = null;
|
|
533
|
-
var
|
|
577
|
+
var _d = action.payload, data = _d.data, formData = _d.formData;
|
|
534
578
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
535
579
|
if (description) {
|
|
536
580
|
state.error = description;
|
|
@@ -538,15 +582,31 @@ export var businessSlice = createSlice({
|
|
|
538
582
|
}
|
|
539
583
|
state.data.otpData = formData;
|
|
540
584
|
state.data.otpData.responseBody = data;
|
|
585
|
+
var _e = state.data.verify.responseBody || {}, entity = _e.entity, entity_activities = _e.entity_activities, business_type = _e.business_type;
|
|
586
|
+
var issuingDate = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
587
|
+
if (!!issuingDate) {
|
|
588
|
+
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
589
|
+
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
590
|
+
}
|
|
591
|
+
var activities = entity_activities || [];
|
|
592
|
+
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities[0];
|
|
593
|
+
if (!!selectedActivity)
|
|
594
|
+
state.data.activitiesData.activities = [selectedActivity];
|
|
595
|
+
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
596
|
+
if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
|
|
597
|
+
state.data.businessTypeData.selectedLicense = {
|
|
598
|
+
legal_name: entity === null || entity === void 0 ? void 0 : entity.legal_name,
|
|
599
|
+
license: { number: (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number },
|
|
600
|
+
type: business_type
|
|
601
|
+
};
|
|
602
|
+
}
|
|
541
603
|
})
|
|
542
604
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
543
605
|
state.loading = false;
|
|
544
606
|
state.error = action.error.message;
|
|
545
607
|
})
|
|
546
|
-
.addCase(updateLeadIdentity.pending, function (state
|
|
547
|
-
|
|
548
|
-
if (!((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend))
|
|
549
|
-
state.loading = true;
|
|
608
|
+
.addCase(updateLeadIdentity.pending, function (state) {
|
|
609
|
+
state.loading = true;
|
|
550
610
|
state.error = null;
|
|
551
611
|
})
|
|
552
612
|
.addCase(updateLeadIdentity.fulfilled, function (state, action) {
|
|
@@ -567,6 +627,25 @@ export var businessSlice = createSlice({
|
|
|
567
627
|
.addCase(updateLeadIdentity.rejected, function (state, action) {
|
|
568
628
|
state.loading = false;
|
|
569
629
|
state.error = action.error.message;
|
|
630
|
+
})
|
|
631
|
+
.addCase(resendOTPLeadIdentity.pending, function (state) {
|
|
632
|
+
state.error = null;
|
|
633
|
+
})
|
|
634
|
+
.addCase(resendOTPLeadIdentity.fulfilled, function (state, action) {
|
|
635
|
+
var _a;
|
|
636
|
+
state.error = null;
|
|
637
|
+
var data = action.payload;
|
|
638
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
639
|
+
if (description) {
|
|
640
|
+
state.error = description;
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
state.data.nidData.responseBody = data;
|
|
644
|
+
state.data.otpData.otp = '';
|
|
645
|
+
state.data.otpData.isNID = true;
|
|
646
|
+
})
|
|
647
|
+
.addCase(resendOTPLeadIdentity.rejected, function (state, action) {
|
|
648
|
+
state.error = action.error.message;
|
|
570
649
|
})
|
|
571
650
|
.addCase(retrieveEntityList.pending, function (state) {
|
|
572
651
|
state.error = null;
|
|
@@ -594,7 +673,7 @@ export var businessSlice = createSlice({
|
|
|
594
673
|
}
|
|
595
674
|
}
|
|
596
675
|
licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
|
|
597
|
-
state.data.businessTypeData.responseBody = { licenseList: licenseList };
|
|
676
|
+
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { licenseList: licenseList });
|
|
598
677
|
var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
|
|
599
678
|
var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
|
|
600
679
|
var license = _a.license;
|
|
@@ -628,6 +707,30 @@ export var businessSlice = createSlice({
|
|
|
628
707
|
.addCase(retrieveEntityInfo.rejected, function (state, action) {
|
|
629
708
|
state.error = action.error.message;
|
|
630
709
|
state.loading = false;
|
|
710
|
+
})
|
|
711
|
+
.addCase(retrieveChannels.pending, function (state) {
|
|
712
|
+
state.error = null;
|
|
713
|
+
state.loading = true;
|
|
714
|
+
})
|
|
715
|
+
.addCase(retrieveChannels.fulfilled, function (state, action) {
|
|
716
|
+
var _a;
|
|
717
|
+
state.error = null;
|
|
718
|
+
state.loading = false;
|
|
719
|
+
var data = action.payload || {};
|
|
720
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
721
|
+
if (description) {
|
|
722
|
+
state.error = description;
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
var channels = data || [];
|
|
726
|
+
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
|
|
727
|
+
var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
|
|
728
|
+
if (!!selectedChannel)
|
|
729
|
+
state.data.activitiesData.salesChannels = [selectedChannel];
|
|
730
|
+
})
|
|
731
|
+
.addCase(retrieveChannels.rejected, function (state, action) {
|
|
732
|
+
state.error = action.error.message;
|
|
733
|
+
state.loading = false;
|
|
631
734
|
})
|
|
632
735
|
.addCase(updateLeadBusinessType.pending, function (state) {
|
|
633
736
|
state.loading = true;
|
|
@@ -666,24 +769,20 @@ export var businessSlice = createSlice({
|
|
|
666
769
|
state.error = null;
|
|
667
770
|
})
|
|
668
771
|
.addCase(createAccount.fulfilled, function (state, action) {
|
|
669
|
-
var _a
|
|
772
|
+
var _a;
|
|
670
773
|
state.loading = false;
|
|
671
774
|
state.error = null;
|
|
672
|
-
var
|
|
673
|
-
var
|
|
674
|
-
if (message) {
|
|
675
|
-
state.error = message;
|
|
775
|
+
var data = action.payload.data;
|
|
776
|
+
var _b = ((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}, message = _b.message, description = _b.description;
|
|
777
|
+
if (message || description) {
|
|
778
|
+
state.error = message || description;
|
|
676
779
|
return;
|
|
677
780
|
}
|
|
678
781
|
if ((data === null || data === void 0 ? void 0 : data.status) === 'ALREADY_TAKEN') {
|
|
679
782
|
state.error = 'signup_user_exists_error';
|
|
680
783
|
return;
|
|
681
784
|
}
|
|
682
|
-
|
|
683
|
-
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, data), state.data.businessTypeData.responseBody), { channelList: channels });
|
|
684
|
-
var selectedChannel = channels === null || channels === void 0 ? void 0 : channels[0];
|
|
685
|
-
if (!!selectedChannel)
|
|
686
|
-
state.data.activitiesData.salesChannels = [selectedChannel];
|
|
785
|
+
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), data);
|
|
687
786
|
})
|
|
688
787
|
.addCase(createAccount.rejected, function (state, action) {
|
|
689
788
|
state.loading = false;
|
|
@@ -3,23 +3,18 @@ import { ResponseData, MobileFormValues, NIDFormValues, OTPFormValues, Individua
|
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
response: any;
|
|
6
|
-
formData: MobileFormValues
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}, MobileFormValues & {
|
|
10
|
-
isResend: boolean;
|
|
11
|
-
}, {}>;
|
|
6
|
+
formData: MobileFormValues;
|
|
7
|
+
}, MobileFormValues, {}>;
|
|
8
|
+
export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
12
9
|
export declare const createNIDAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
13
10
|
response: any;
|
|
14
11
|
formData: {
|
|
15
12
|
type: string;
|
|
16
13
|
nid: string;
|
|
17
14
|
dob: string;
|
|
18
|
-
isResend: boolean;
|
|
19
15
|
};
|
|
20
|
-
}, NIDFormValues
|
|
21
|
-
|
|
22
|
-
}, {}>;
|
|
16
|
+
}, NIDFormValues, {}>;
|
|
17
|
+
export declare const resendOTPNID: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
|
|
23
18
|
export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
24
19
|
response: any;
|
|
25
20
|
formData: OTPFormValues;
|
|
@@ -82,7 +82,7 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
82
82
|
return [4, API.authService.createAuth(requestBody)];
|
|
83
83
|
case 1:
|
|
84
84
|
data = (_c.sent()).data;
|
|
85
|
-
if (!data.errors
|
|
85
|
+
if (!data.errors) {
|
|
86
86
|
thunkApi.dispatch(handleNextScreenStep());
|
|
87
87
|
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
88
88
|
}
|
|
@@ -90,13 +90,37 @@ export var createMobileAuth = createAsyncThunk('createMobileAuth', function (par
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}); });
|
|
93
|
-
export var
|
|
94
|
-
var _a, settings, connect,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
switch (_d.label) {
|
|
93
|
+
export var resendOTPMobile = createAsyncThunk('resendOTPMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
|
+
var _a, settings, connect, _b, mobile, countryCode, requestBody, data;
|
|
95
|
+
return __generator(this, function (_c) {
|
|
96
|
+
switch (_c.label) {
|
|
98
97
|
case 0:
|
|
99
98
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
99
|
+
_b = connect.data.mobileData, mobile = _b.mobile, countryCode = _b.countryCode;
|
|
100
|
+
requestBody = {
|
|
101
|
+
lang: settings.data.language,
|
|
102
|
+
user_credentail: {
|
|
103
|
+
phone: mobile || '',
|
|
104
|
+
code: countryCode.idd_prefix.toString()
|
|
105
|
+
},
|
|
106
|
+
sign_in: false,
|
|
107
|
+
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_MOBILE,
|
|
108
|
+
encryption_contract: ['user_credentail.phone', 'user_credentail.code']
|
|
109
|
+
};
|
|
110
|
+
return [4, API.authService.createAuth(requestBody)];
|
|
111
|
+
case 1:
|
|
112
|
+
data = (_c.sent()).data;
|
|
113
|
+
return [2, data];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); });
|
|
117
|
+
export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
+
var settings, identification_id_type, requestBody, data;
|
|
119
|
+
var _a, _b;
|
|
120
|
+
return __generator(this, function (_c) {
|
|
121
|
+
switch (_c.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
settings = thunkApi.getState().settings;
|
|
100
124
|
identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
|
|
101
125
|
requestBody = {
|
|
102
126
|
lang: settings.data.language,
|
|
@@ -117,15 +141,46 @@ export var createNIDAuth = createAsyncThunk('createNIDAuth', function (params, t
|
|
|
117
141
|
};
|
|
118
142
|
return [4, API.authService.createAuth(requestBody)];
|
|
119
143
|
case 1:
|
|
120
|
-
data = (
|
|
121
|
-
if (!data.errors
|
|
144
|
+
data = (_c.sent()).data;
|
|
145
|
+
if (!data.errors) {
|
|
122
146
|
thunkApi.dispatch(handleNextScreenStep());
|
|
123
|
-
(
|
|
147
|
+
(_b = (_a = settings.data.appConfig).onStepCompleted) === null || _b === void 0 ? void 0 : _b.call(_a, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
124
148
|
}
|
|
125
149
|
return [2, { response: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
126
150
|
}
|
|
127
151
|
});
|
|
128
152
|
}); });
|
|
153
|
+
export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var _a, settings, connect, _b, nid, dob, type, requestBody, data;
|
|
155
|
+
return __generator(this, function (_c) {
|
|
156
|
+
switch (_c.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
159
|
+
_b = connect.data.nidData, nid = _b.nid, dob = _b.dob, type = _b.type;
|
|
160
|
+
requestBody = {
|
|
161
|
+
lang: settings.data.language,
|
|
162
|
+
user_credentail: {
|
|
163
|
+
identification_id: nid,
|
|
164
|
+
identification_id_type: type,
|
|
165
|
+
date_of_birth: dob,
|
|
166
|
+
country_code: settings.data.businessCountry.iso2
|
|
167
|
+
},
|
|
168
|
+
sign_in: false,
|
|
169
|
+
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_NID,
|
|
170
|
+
encryption_contract: [
|
|
171
|
+
'user_credentail.country_code',
|
|
172
|
+
'user_credentail.identification_id',
|
|
173
|
+
'user_credentail.identification_id_type',
|
|
174
|
+
'user_credentail.date_of_birth'
|
|
175
|
+
]
|
|
176
|
+
};
|
|
177
|
+
return [4, API.authService.createAuth(requestBody)];
|
|
178
|
+
case 1:
|
|
179
|
+
data = (_c.sent()).data;
|
|
180
|
+
return [2, data];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}); });
|
|
129
184
|
export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
185
|
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, payload, data, params_1, params_2;
|
|
131
186
|
var _c, _d;
|
|
@@ -186,11 +241,11 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
|
|
|
186
241
|
});
|
|
187
242
|
}); });
|
|
188
243
|
export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
189
|
-
var
|
|
190
|
-
return __generator(this, function (
|
|
191
|
-
switch (
|
|
244
|
+
var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
|
|
245
|
+
return __generator(this, function (_b) {
|
|
246
|
+
switch (_b.label) {
|
|
192
247
|
case 0:
|
|
193
|
-
|
|
248
|
+
settings = thunkApi.getState().settings;
|
|
194
249
|
businessCountry = settings.data.businessCountry;
|
|
195
250
|
payload = {
|
|
196
251
|
individual_id: params.individualId,
|
|
@@ -204,7 +259,7 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
|
|
|
204
259
|
API.leadService.createLead(payload)
|
|
205
260
|
])];
|
|
206
261
|
case 1:
|
|
207
|
-
|
|
262
|
+
_a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
|
|
208
263
|
if (!data.errors) {
|
|
209
264
|
thunkApi.dispatch(handleNextScreenStep(params.stepName));
|
|
210
265
|
}
|
|
@@ -254,10 +309,10 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
254
309
|
});
|
|
255
310
|
}); });
|
|
256
311
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
257
|
-
var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, payload, data;
|
|
258
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
259
|
-
return __generator(this, function (
|
|
260
|
-
switch (
|
|
312
|
+
var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, isOther, brand, payload, data;
|
|
313
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
314
|
+
return __generator(this, function (_p) {
|
|
315
|
+
switch (_p.label) {
|
|
261
316
|
case 0:
|
|
262
317
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
263
318
|
instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
|
|
@@ -266,27 +321,36 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
266
321
|
isAbsher = otpData.isAbsher;
|
|
267
322
|
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
268
323
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
|
|
324
|
+
isOther = ((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) === 'other';
|
|
325
|
+
brand = __assign({ name: {
|
|
326
|
+
en: params.brandName,
|
|
327
|
+
ar: params.brandName,
|
|
328
|
+
zh: params.brandName
|
|
329
|
+
}, website: (_h = params.links) === null || _h === void 0 ? void 0 : _h.website, social: [twitter, instagram] }, (isExistingUser &&
|
|
330
|
+
!isOther && {
|
|
331
|
+
id: (_j = params.selectedBrandItem) === null || _j === void 0 ? void 0 : _j.id,
|
|
332
|
+
name: undefined
|
|
333
|
+
}));
|
|
269
334
|
payload = {
|
|
270
|
-
brand:
|
|
271
|
-
|
|
272
|
-
en: params.brandName,
|
|
273
|
-
ar: params.brandName,
|
|
274
|
-
zh: params.brandName
|
|
275
|
-
},
|
|
276
|
-
website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
|
|
277
|
-
social: [twitter, instagram]
|
|
278
|
-
},
|
|
279
|
-
id: (isExistingUser ? (_h = brandData.responseBody) === null || _h === void 0 ? void 0 : _h.lead_id : (_j = otpData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id) || '',
|
|
335
|
+
brand: brand,
|
|
336
|
+
id: (isExistingUser ? (_k = brandData.responseBody) === null || _k === void 0 ? void 0 : _k.lead_id : (_l = otpData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id) || '',
|
|
280
337
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
281
338
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
282
|
-
encryption_contract: [
|
|
339
|
+
encryption_contract: [
|
|
340
|
+
'brand.name.en',
|
|
341
|
+
'brand.name.ar',
|
|
342
|
+
'brand.name.zh',
|
|
343
|
+
'brand.website',
|
|
344
|
+
'brand.social[0]',
|
|
345
|
+
'brand.social[1]'
|
|
346
|
+
]
|
|
283
347
|
};
|
|
284
348
|
return [4, API.leadService.updateLead(payload)];
|
|
285
349
|
case 1:
|
|
286
|
-
data = (
|
|
350
|
+
data = (_p.sent()).data;
|
|
287
351
|
if (!data.errors) {
|
|
288
352
|
thunkApi.dispatch(handleNextScreenStep());
|
|
289
|
-
(
|
|
353
|
+
(_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, params);
|
|
290
354
|
}
|
|
291
355
|
return [2, { response: data, formData: params }];
|
|
292
356
|
}
|
|
@@ -437,7 +501,6 @@ export var connectSlice = createSlice({
|
|
|
437
501
|
.addCase(createMobileAuth.fulfilled, function (state, action) {
|
|
438
502
|
var _a;
|
|
439
503
|
state.loading = false;
|
|
440
|
-
state.customLoading = false;
|
|
441
504
|
state.error = null;
|
|
442
505
|
var _b = action.payload, formData = _b.formData, response = _b.response;
|
|
443
506
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
@@ -449,16 +512,30 @@ export var connectSlice = createSlice({
|
|
|
449
512
|
state.data.mobileData.responseBody = response;
|
|
450
513
|
state.data.otpData.isAbsher = false;
|
|
451
514
|
})
|
|
452
|
-
.addCase(createMobileAuth.pending, function (state
|
|
453
|
-
|
|
454
|
-
state.customLoading = true;
|
|
455
|
-
if (!action.meta.arg.isResend)
|
|
456
|
-
state.loading = true;
|
|
515
|
+
.addCase(createMobileAuth.pending, function (state) {
|
|
516
|
+
state.loading = true;
|
|
457
517
|
state.error = null;
|
|
458
518
|
})
|
|
459
519
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
460
520
|
state.loading = false;
|
|
461
|
-
state.
|
|
521
|
+
state.error = action.error.message;
|
|
522
|
+
})
|
|
523
|
+
.addCase(resendOTPMobile.fulfilled, function (state, action) {
|
|
524
|
+
var _a;
|
|
525
|
+
state.error = null;
|
|
526
|
+
var response = action.payload;
|
|
527
|
+
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
528
|
+
if (description) {
|
|
529
|
+
state.error = description;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
state.data.mobileData.responseBody = response;
|
|
533
|
+
state.data.otpData.isAbsher = false;
|
|
534
|
+
})
|
|
535
|
+
.addCase(resendOTPMobile.pending, function (state) {
|
|
536
|
+
state.error = null;
|
|
537
|
+
})
|
|
538
|
+
.addCase(resendOTPMobile.rejected, function (state, action) {
|
|
462
539
|
state.error = action.error.message;
|
|
463
540
|
})
|
|
464
541
|
.addCase(createNIDAuth.fulfilled, function (state, action) {
|
|
@@ -475,14 +552,31 @@ export var connectSlice = createSlice({
|
|
|
475
552
|
state.data.nidData.responseBody = response;
|
|
476
553
|
state.data.otpData.isAbsher = true;
|
|
477
554
|
})
|
|
478
|
-
.addCase(createNIDAuth.pending, function (state
|
|
479
|
-
|
|
480
|
-
state.loading = ((_a = action.meta.arg) === null || _a === void 0 ? void 0 : _a.isResend) ? false : true;
|
|
555
|
+
.addCase(createNIDAuth.pending, function (state) {
|
|
556
|
+
state.loading = true;
|
|
481
557
|
state.error = null;
|
|
482
558
|
})
|
|
483
559
|
.addCase(createNIDAuth.rejected, function (state, action) {
|
|
484
560
|
state.loading = false;
|
|
485
561
|
state.error = action.error.message;
|
|
562
|
+
})
|
|
563
|
+
.addCase(resendOTPNID.fulfilled, function (state, action) {
|
|
564
|
+
var _a;
|
|
565
|
+
state.error = null;
|
|
566
|
+
var response = action.payload;
|
|
567
|
+
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
568
|
+
if (description) {
|
|
569
|
+
state.error = description;
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
state.data.nidData.responseBody = response;
|
|
573
|
+
state.data.otpData.isAbsher = true;
|
|
574
|
+
})
|
|
575
|
+
.addCase(resendOTPNID.pending, function (state) {
|
|
576
|
+
state.error = null;
|
|
577
|
+
})
|
|
578
|
+
.addCase(resendOTPNID.rejected, function (state, action) {
|
|
579
|
+
state.error = action.error.message;
|
|
486
580
|
})
|
|
487
581
|
.addCase(verifyAuth.fulfilled, function (state, action) {
|
|
488
582
|
var _a;
|