@tap-payments/auth-jsconnect 2.3.80-test → 2.3.84-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.
Files changed (23) hide show
  1. package/build/features/app/brand/brandStore.d.ts +3 -3
  2. package/build/features/app/brand/brandStore.js +133 -114
  3. package/build/features/app/connectExpress/connectExpressStore.d.ts +3 -3
  4. package/build/features/app/connectExpress/connectExpressStore.js +80 -76
  5. package/build/features/app/entity/entityStore.d.ts +3 -3
  6. package/build/features/app/entity/entityStore.js +130 -120
  7. package/build/features/app/individual/individualStore.d.ts +4 -4
  8. package/build/features/app/individual/individualStore.js +227 -219
  9. package/build/features/app/tax/taxStore.d.ts +2 -2
  10. package/build/features/app/tax/taxStore.js +59 -55
  11. package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -2
  12. package/build/features/brand/screens/BrandInfo/BrandInfo.js +7 -6
  13. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +5 -4
  14. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +5 -4
  15. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +3 -9
  16. package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -2
  17. package/build/features/entity/screens/EntityName/EntityName.js +3 -2
  18. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +19 -18
  19. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -2
  20. package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +3 -2
  21. package/build/features/shared/Button/IndividualActionButtons.js +2 -2
  22. package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -3
  23. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, AsyncThunkParams, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  interface VerifyLeadTokenProps {
5
5
  token: string;
@@ -63,14 +63,14 @@ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").Asyn
63
63
  export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
64
64
  data: any;
65
65
  formData: Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">;
66
- }, Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">, {}>;
66
+ }, AsyncThunkParams<Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">>, {}>;
67
67
  export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
68
68
  leadId: string;
69
69
  }, {}>;
70
70
  export declare const updateBrandActivities: import("@reduxjs/toolkit").AsyncThunk<{
71
71
  data: any;
72
72
  formData: BrandActivitiesFormValues;
73
- }, BrandActivitiesFormValues, {}>;
73
+ }, AsyncThunkParams<BrandActivitiesFormValues>, {}>;
74
74
  export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
75
75
  customerBases: any;
76
76
  expectedSales: any;
@@ -263,70 +263,73 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
263
263
  });
264
264
  });
265
265
  });
266
- export var updateBrand = createAsyncThunk('brandUpdateBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
267
- var _a, settings, brand, _b, id, data_status, isNameNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, requestBody, brandData, activities, activityList;
268
- var _c, _d, _e, _f;
269
- return __generator(this, function (_g) {
270
- switch (_g.label) {
271
- case 0:
272
- _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
273
- _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, id = _b.id, data_status = _b.data_status;
274
- isNameNonEditable = hasNoneEditableValue(data_status, 'name');
275
- isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
276
- isSegmentTypeNonEditable = hasNoneEditableValue(data_status, 'segment.type');
277
- isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
278
- salesChannels = params.salesChannels, brandName = params.brandName, segment = params.segment, teamSize = params.teamSize, brandLogoId = params.brandLogoId;
279
- segmentId = isSegmentTypeNonEditable ? undefined : segment && { id: segment.id };
280
- teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
281
- getAddress = function (value, isTwitter, isWeb) {
282
- if (isTwitter)
283
- return '@' + value.replaceAll('@', '');
284
- if (isWeb)
285
- return 'https://www.' + value.replaceAll('https://www.', '');
286
- return value;
287
- };
288
- channel_services = isChannelServicesNonEditable
289
- ? undefined
290
- : salesChannels.map(function (channel) {
291
- var _a;
292
- return {
293
- id: channel.id,
294
- address: getAddress(channel.address || '', isTwitter(channel.code), isWebsite(channel.code)),
295
- sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
296
- return { id: sub.id, address: getAddress(sub.address || '', isTwitter(sub.code), isWebsite(sub.code)) };
297
- })
298
- };
299
- });
300
- requestBody = {
301
- id: id,
302
- name: isNameNonEditable || !brandName ? undefined : { en: brandName, ar: brandName },
303
- logo: brandLogoId,
304
- segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId },
305
- channel_services: channel_services
306
- };
307
- return [4, API.brandService.updateBrandInfo(requestBody)];
308
- case 1:
309
- brandData = (_g.sent()).brand;
310
- activities = (((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}).activities;
311
- return [4, thunkApi.dispatch(retrieveDataList())];
312
- case 2:
313
- _g.sent();
314
- if (activities) {
315
- brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
316
- }
317
- if (!!activities) return [3, 4];
318
- return [4, API.dataService.getActivities()];
319
- case 3:
320
- activityList = (_g.sent()).list;
321
- brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
322
- _g.label = 4;
323
- case 4:
324
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
325
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
326
- return [2, { data: __assign({}, brandData), formData: params }];
327
- }
266
+ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
267
+ var formData = _a.formData, originalFormData = _a.originalFormData;
268
+ return __awaiter(void 0, void 0, void 0, function () {
269
+ var _b, settings, brand, _c, id, data_status, isNameNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, requestBody, brandData, activities, activityList;
270
+ var _d, _e, _f, _g;
271
+ return __generator(this, function (_h) {
272
+ switch (_h.label) {
273
+ case 0:
274
+ _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
275
+ _c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, id = _c.id, data_status = _c.data_status;
276
+ isNameNonEditable = hasNoneEditableValue(data_status, 'name');
277
+ isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
278
+ isSegmentTypeNonEditable = hasNoneEditableValue(data_status, 'segment.type');
279
+ isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
280
+ salesChannels = formData.salesChannels, brandName = formData.brandName, segment = formData.segment, teamSize = formData.teamSize, brandLogoId = formData.brandLogoId;
281
+ segmentId = isSegmentTypeNonEditable ? undefined : segment && { id: segment.id };
282
+ teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
283
+ getAddress = function (value, isTwitter, isWeb) {
284
+ if (isTwitter)
285
+ return '@' + value.replaceAll('@', '');
286
+ if (isWeb)
287
+ return 'https://www.' + value.replaceAll('https://www.', '');
288
+ return value;
289
+ };
290
+ channel_services = isChannelServicesNonEditable
291
+ ? undefined
292
+ : salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.map(function (channel) {
293
+ var _a;
294
+ return {
295
+ id: channel.id,
296
+ address: getAddress(channel.address || '', isTwitter(channel.code), isWebsite(channel.code)),
297
+ sub: (_a = channel.sub) === null || _a === void 0 ? void 0 : _a.map(function (sub) {
298
+ return { id: sub.id, address: getAddress(sub.address || '', isTwitter(sub.code), isWebsite(sub.code)) };
299
+ })
300
+ };
301
+ });
302
+ requestBody = {
303
+ id: id,
304
+ name: isNameNonEditable || !brandName ? undefined : { en: brandName, ar: brandName },
305
+ logo: brandLogoId,
306
+ segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId },
307
+ channel_services: channel_services
308
+ };
309
+ return [4, API.brandService.updateBrandInfo(requestBody)];
310
+ case 1:
311
+ brandData = (_h.sent()).brand;
312
+ activities = (((_e = brand.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.entity) || {}).activities;
313
+ return [4, thunkApi.dispatch(retrieveDataList())];
314
+ case 2:
315
+ _h.sent();
316
+ if (activities) {
317
+ brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
318
+ }
319
+ if (!!activities) return [3, 4];
320
+ return [4, API.dataService.getActivities()];
321
+ case 3:
322
+ activityList = (_h.sent()).list;
323
+ brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
324
+ _h.label = 4;
325
+ case 4:
326
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
327
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, id);
328
+ return [2, { data: __assign({}, brandData), formData: originalFormData }];
329
+ }
330
+ });
328
331
  });
329
- }); });
332
+ });
330
333
  export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
331
334
  var data;
332
335
  return __generator(this, function (_a) {
@@ -338,57 +341,62 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
338
341
  }
339
342
  });
340
343
  }); });
341
- export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
342
- var _a, settings, brand, _b, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
343
- var _c, _d, _e;
344
- return __generator(this, function (_f) {
345
- switch (_f.label) {
346
- case 0:
347
- _a = thunkApi.getState(), settings = _a.settings, brand = _a.brand;
348
- _b = ((_c = brand.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) || {}, data_status = _b.data_status, id = _b.id, brandActivities = _b.activities;
349
- isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
350
- isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
351
- isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
352
- isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
353
- isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
354
- activities = params.activities, customerLocations = params.customerLocations, expectedCustomer = params.expectedCustomer, expectedSale = params.expectedSale;
355
- removedActivities = (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
356
- if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
357
- payload = {
358
- id: id,
359
- activities: removedActivities
360
- };
361
- return [4, API.brandService.removeBrandActivity(payload)];
362
- case 1:
363
- _f.sent();
364
- _f.label = 2;
365
- case 2:
366
- requestBody = {
367
- id: id,
368
- activities: isActivitiesNonEditable ? undefined : activities,
369
- term: isTermsNonEditable ? undefined : ['general', 'refund', 'chargeback'],
370
- step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
371
- };
372
- customerLocation = customerLocations.map(function (location) { return ({
373
- id: location.id
374
- }); });
375
- customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
376
- salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
377
- customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
378
- if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
379
- requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
380
- if (salesId && !isSalesRangeNonEditable) {
381
- requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
382
- }
383
- return [4, API.brandService.updateBrandInfo(requestBody)];
384
- case 3:
385
- brandData = (_f.sent()).data;
386
- thunkApi.dispatch(handleNextScreenStep());
387
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, id);
388
- return [2, { data: __assign({}, brandData), formData: params }];
389
- }
344
+ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (_a, thunkApi) {
345
+ var formData = _a.formData, originalFormData = _a.originalFormData;
346
+ return __awaiter(void 0, void 0, void 0, function () {
347
+ var _b, settings, brand, _c, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
348
+ var _d, _e, _f;
349
+ return __generator(this, function (_g) {
350
+ switch (_g.label) {
351
+ case 0:
352
+ _b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
353
+ _c = ((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.brand) || {}, data_status = _c.data_status, id = _c.id, brandActivities = _c.activities;
354
+ isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
355
+ isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
356
+ isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
357
+ isTermsNonEditable = hasNoneEditableValue(data_status, 'terms');
358
+ isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
359
+ activities = formData.activities, customerLocations = formData.customerLocations, expectedCustomer = formData.expectedCustomer, expectedSale = formData.expectedSale, termAndConditionChecked = formData.termAndConditionChecked, refundPolicy = formData.refundPolicy, transactionPolicy = formData.transactionPolicy;
360
+ isTermsUndefined = termAndConditionChecked === undefined && refundPolicy === undefined && transactionPolicy === undefined;
361
+ removedActivities = (activities === null || activities === void 0 ? void 0 : activities.length) > 0 &&
362
+ (brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
363
+ if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
364
+ payload = {
365
+ id: id,
366
+ activities: removedActivities
367
+ };
368
+ return [4, API.brandService.removeBrandActivity(payload)];
369
+ case 1:
370
+ _g.sent();
371
+ _g.label = 2;
372
+ case 2:
373
+ requestBody = {
374
+ id: id,
375
+ activities: isActivitiesNonEditable ? undefined : activities,
376
+ term: isTermsNonEditable || isTermsUndefined ? undefined : ['general', 'refund', 'chargeback'],
377
+ step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
378
+ };
379
+ customerLocation = (customerLocations || []).map(function (location) { return ({
380
+ id: location.id
381
+ }); });
382
+ customerBaseId = (expectedCustomer === null || expectedCustomer === void 0 ? void 0 : expectedCustomer.id) && { id: expectedCustomer.id, period: 'monthly' };
383
+ salesId = (expectedSale === null || expectedSale === void 0 ? void 0 : expectedSale.id) && { id: expectedSale.id, period: 'monthly' };
384
+ customerBase = (customerBaseId || customerLocation.length) && __assign(__assign({}, (customerBaseId && !isCustomerBaseNonEditable && { id: expectedCustomer.id, period: 'monthly' })), (customerLocation.length && !isCustomerBaseLocationNonEditable && { locations: customerLocation }));
385
+ if (customerBase && !(isCustomerBaseNonEditable && isCustomerBaseLocationNonEditable))
386
+ requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { customer_base: customerBase }) });
387
+ if (salesId && !isSalesRangeNonEditable) {
388
+ requestBody = __assign(__assign({}, requestBody), { operations: __assign(__assign({}, requestBody.operations), { sales: salesId }) });
389
+ }
390
+ return [4, API.brandService.updateBrandInfo(requestBody)];
391
+ case 3:
392
+ brandData = (_g.sent()).data;
393
+ thunkApi.dispatch(handleNextScreenStep());
394
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
395
+ return [2, { data: __assign({}, brandData), formData: originalFormData }];
396
+ }
397
+ });
390
398
  });
391
- }); });
399
+ });
392
400
  export var retrieveDataList = createAsyncThunk('brandRetrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
401
  var settings, countryISO2, dataBody, salesDataBody, _a, customerBases, expectedSales, expectedCustomerSales;
394
402
  return __generator(this, function (_b) {
@@ -617,7 +625,7 @@ export var brandSlice = createSlice({
617
625
  state.loading = false;
618
626
  state.error = null;
619
627
  var _a = action.payload, data = _a.data, formData = _a.formData;
620
- var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations;
628
+ var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations, terms = data.terms;
621
629
  var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
622
630
  return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
623
631
  });
@@ -631,6 +639,17 @@ export var brandSlice = createSlice({
631
639
  state.data.brandActivities.expectedSale = sales;
632
640
  if (!!customerBase)
633
641
  state.data.brandActivities.expectedCustomer = customerBase;
642
+ terms === null || terms === void 0 ? void 0 : terms.forEach(function (element) {
643
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
644
+ state.data.brandActivities.termAndConditionChecked = element.agree;
645
+ }
646
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'chargeback') {
647
+ state.data.brandActivities.transactionPolicy = element.agree;
648
+ }
649
+ if ((element === null || element === void 0 ? void 0 : element.term) === 'refund') {
650
+ state.data.brandActivities.refundPolicy = element.agree;
651
+ }
652
+ });
634
653
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities });
635
654
  })
636
655
  .addCase(updateBrandActivities.rejected, function (state, action) {
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues } from '../../../@types';
2
+ import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
4
  export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
5
5
  data: any;
@@ -87,11 +87,11 @@ interface verifyPACIAsyncParams {
87
87
  export declare const updateLeadIndividualAsync: import("@reduxjs/toolkit").AsyncThunk<{
88
88
  response: any;
89
89
  formData: IndividualFormValues;
90
- }, IndividualFormValues, {}>;
90
+ }, AsyncThunkParams<IndividualFormValues>, {}>;
91
91
  export declare const updateLeadBusinessDataAsync: import("@reduxjs/toolkit").AsyncThunk<{
92
92
  response: any;
93
93
  formData: BusinessDataFormValues;
94
- }, BusinessDataFormValues, {}>;
94
+ }, AsyncThunkParams<BusinessDataFormValues>, {}>;
95
95
  interface ResponseData {
96
96
  responseData?: Record<string, any>;
97
97
  }
@@ -639,84 +639,88 @@ export var createAccountAsync = createAsyncThunk('connectExpress/createAccountAs
639
639
  }
640
640
  });
641
641
  }); });
642
- export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
643
- var _a, settings, connectExpress, id, phoneCountry, payload, data, needToCollectMoreInfo, creatingAccount, isSaudi;
644
- var _b, _c, _d, _e, _f, _g;
645
- return __generator(this, function (_h) {
646
- switch (_h.label) {
647
- case 0:
648
- _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
649
- id = (((_b = connectExpress.data.responseData) === null || _b === void 0 ? void 0 : _b.leadData) || {}).id;
650
- phoneCountry = (_d = (_c = params.countryCode) === null || _c === void 0 ? void 0 : _c.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
651
- payload = {
652
- id: id || '',
653
- country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2,
654
- name: getIndividualName(params.name),
655
- contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
656
- step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
657
- encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number']
658
- };
659
- return [4, API.leadService.updateLeadExpress(payload)];
660
- case 1:
661
- data = _h.sent();
662
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
663
- needToCollectMoreInfo = data.step_name === 'collect_info';
664
- creatingAccount = data.step_name === 'create_account';
665
- if (creatingAccount) {
666
- sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
667
- }
668
- if (!needToCollectMoreInfo) return [3, 4];
669
- isSaudi = isSA(settings.data.businessCountry.iso2);
670
- if (!isSaudi) return [3, 3];
671
- return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
672
- case 2:
673
- _h.sent();
674
- _h.label = 3;
675
- case 3:
676
- sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
677
- _h.label = 4;
678
- case 4: return [2, { response: data, formData: params }];
679
- }
680
- });
681
- }); });
682
- export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
683
- var _a, settings, connectExpress, isNonSA, isFL, _b, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
684
- var _c, _d, _e, _f;
685
- return __generator(this, function (_g) {
686
- switch (_g.label) {
687
- case 0:
688
- _a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
689
- isNonSA = !isSA(settings.data.businessCountry.iso2);
690
- isFL = ((_c = params.selectedLicense) === null || _c === void 0 ? void 0 : _c.type) === BusinessType.FL;
691
- _b = connectExpress.data, responseData = _b.responseData, isLeadIdPassed = _b.isLeadIdPassed;
692
- id = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).id;
693
- brandNameBody = {
694
- name: {
695
- en: params.brandName,
696
- ar: params.brandName,
697
- zh: params.brandName
642
+ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (_a, thunkApi) {
643
+ var formData = _a.formData, originalFormData = _a.originalFormData;
644
+ return __awaiter(void 0, void 0, void 0, function () {
645
+ var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, isSaudi;
646
+ var _c, _d, _e, _f, _g;
647
+ return __generator(this, function (_h) {
648
+ switch (_h.label) {
649
+ case 0:
650
+ _b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
651
+ id = (((_c = connectExpress.data.responseData) === null || _c === void 0 ? void 0 : _c.leadData) || {}).id;
652
+ countryCode = formData.countryCode, name = formData.name, email = formData.email, mobile = formData.mobile;
653
+ phoneCountry = (_d = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
654
+ isContactAvailable = email || mobile;
655
+ payload = __assign(__assign({ id: id || '', country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2, name: getIndividualName(name) }, (isContactAvailable && {
656
+ contact: __assign({ email: email }, (mobile && { phone: { country_code: phoneCountry, number: mobile } }))
657
+ })), { step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL, encryption_contract: ['name.first', 'name.middle', 'name.last', 'contact.email', 'contact.phone.country_code', 'contact.phone.number'] });
658
+ return [4, API.leadService.updateLeadExpress(payload)];
659
+ case 1:
660
+ data = _h.sent();
661
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, formData);
662
+ needToCollectMoreInfo = data.step_name === 'collect_info';
663
+ creatingAccount = data.step_name === 'create_account';
664
+ if (creatingAccount) {
665
+ sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
698
666
  }
699
- };
700
- payload = {
701
- id: id || '',
702
- brand: brandNameBody,
703
- license_number: isNonSA && isFL ? '' : params.licenseNumber,
704
- license_type: isFL ? LicenseType.FL : LicenseType.CR,
705
- business_type: (_d = params.selectedLicense) === null || _d === void 0 ? void 0 : _d.type,
706
- is_acknowledged: true,
707
- terms_conditions_accepted: !isLeadIdPassed ? params.termAndConditionChecked : undefined,
708
- step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
709
- encryption_contract: ['license_number', 'business_type', 'license_type']
710
- };
711
- return [4, API.leadService.updateLeadExpress(payload)];
712
- case 1:
713
- data = _g.sent();
714
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
715
- thunkApi.dispatch(handleNextScreenStep());
716
- return [2, { response: data, formData: params }];
717
- }
667
+ if (!needToCollectMoreInfo) return [3, 4];
668
+ isSaudi = isSA(settings.data.businessCountry.iso2);
669
+ if (!isSaudi) return [3, 3];
670
+ return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
671
+ case 2:
672
+ _h.sent();
673
+ _h.label = 3;
674
+ case 3:
675
+ sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
676
+ _h.label = 4;
677
+ case 4: return [2, { response: data, formData: originalFormData }];
678
+ }
679
+ });
718
680
  });
719
- }); });
681
+ });
682
+ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDataAsync ', function (_a, thunkApi) {
683
+ var formData = _a.formData, originalFormData = _a.originalFormData;
684
+ return __awaiter(void 0, void 0, void 0, function () {
685
+ var _b, settings, connectExpress, selectedLicense, brandName, licenseNumber, termAndConditionChecked, isNonSA, isFL, _c, responseData, isLeadIdPassed, id, brandNameBody, payload, data;
686
+ var _d, _e;
687
+ return __generator(this, function (_f) {
688
+ switch (_f.label) {
689
+ case 0:
690
+ _b = thunkApi.getState(), settings = _b.settings, connectExpress = _b.connectExpress;
691
+ selectedLicense = formData.selectedLicense, brandName = formData.brandName, licenseNumber = formData.licenseNumber, termAndConditionChecked = formData.termAndConditionChecked;
692
+ isNonSA = !isSA(settings.data.businessCountry.iso2);
693
+ isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
694
+ _c = connectExpress.data, responseData = _c.responseData, isLeadIdPassed = _c.isLeadIdPassed;
695
+ id = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).id;
696
+ brandNameBody = {
697
+ name: {
698
+ en: brandName,
699
+ ar: brandName,
700
+ zh: brandName
701
+ }
702
+ };
703
+ payload = {
704
+ id: id || '',
705
+ brand: brandNameBody,
706
+ license_number: isNonSA && isFL ? '' : licenseNumber,
707
+ license_type: (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) ? (isFL ? LicenseType.FL : LicenseType.CR) : undefined,
708
+ business_type: selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type,
709
+ is_acknowledged: true,
710
+ terms_conditions_accepted: !isLeadIdPassed ? termAndConditionChecked : undefined,
711
+ step_name: CONNECT_EXPRESS_STEP_NAMES.UPDATE_LEAD_BRAND_BUSINESS,
712
+ encryption_contract: ['license_number', 'business_type', 'license_type']
713
+ };
714
+ return [4, API.leadService.updateLeadExpress(payload)];
715
+ case 1:
716
+ data = _f.sent();
717
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, formData);
718
+ thunkApi.dispatch(handleNextScreenStep());
719
+ return [2, { response: data, formData: originalFormData }];
720
+ }
721
+ });
722
+ });
723
+ });
720
724
  var initialState = {
721
725
  error: null,
722
726
  loading: false,
@@ -1,5 +1,5 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { ActionState, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { ActionState, AsyncThunkParams, EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  interface VerifyLeadTokenProps {
4
4
  token: string;
5
5
  isInternally?: boolean;
@@ -48,11 +48,11 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
48
48
  export declare const updateEntityName: import("@reduxjs/toolkit").AsyncThunk<{
49
49
  data: any;
50
50
  formData: EntityNameFormValues;
51
- }, EntityNameFormValues, {}>;
51
+ }, AsyncThunkParams<EntityNameFormValues>, {}>;
52
52
  export declare const updateEntityCapital: import("@reduxjs/toolkit").AsyncThunk<{
53
53
  data: any;
54
54
  formData: EntityCapitalFormValues;
55
- }, EntityCapitalFormValues, {}>;
55
+ }, AsyncThunkParams<EntityCapitalFormValues>, {}>;
56
56
  export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
57
57
  response: any;
58
58
  formData: void;