@tap-payments/auth-jsconnect 2.0.71-test → 2.0.75-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/@types/app.d.ts +5 -2
- package/build/@types/form.d.ts +4 -1
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/data.d.ts +2 -0
- package/build/api/data.js +16 -1
- package/build/api/entity.d.ts +3 -1
- package/build/api/index.d.ts +2 -0
- package/build/api/individual.d.ts +48 -19
- package/build/constants/api.d.ts +2 -0
- package/build/constants/api.js +5 -1
- package/build/features/app/business/businessStore.d.ts +1 -3
- package/build/features/app/business/businessStore.js +68 -164
- package/build/features/app/connect/connectStore.d.ts +1 -0
- package/build/features/app/connect/connectStore.js +66 -37
- package/build/features/app/entity/entityStore.js +3 -3
- package/build/features/business/screens/Activities/Activities.js +1 -6
- package/build/features/business/screens/Activities/ActivitiesList.js +7 -6
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -3
- package/build/features/business/screens/Activities/SalesChannels.js +0 -96
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/connect/screens/Merchant/Merchant.js +9 -1
- package/build/features/connect/screens/Mobile/Mobile.js +4 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +6 -5
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_
|
|
|
63
63
|
import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
65
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var payload, data, leadResponse, brandInfo, boardResponse, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
66
|
+
var payload, data, leadResponse, brandInfo, boardResponse, entity_activities, data_1, countryIso2, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
67
67
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
68
68
|
return __generator(this, function (_h) {
|
|
69
69
|
switch (_h.label) {
|
|
@@ -82,15 +82,23 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
82
82
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
83
83
|
case 2:
|
|
84
84
|
leadResponse = _h.sent();
|
|
85
|
+
entity_activities = leadResponse.data.entity_activities;
|
|
86
|
+
if (!!entity_activities) return [3, 4];
|
|
87
|
+
return [4, API.dataService.getActivities()];
|
|
88
|
+
case 3:
|
|
89
|
+
data_1 = _h.sent();
|
|
90
|
+
leadResponse.data = __assign(__assign({}, leadResponse.data), { entity_activities: data_1.list });
|
|
91
|
+
_h.label = 4;
|
|
92
|
+
case 4:
|
|
85
93
|
countryIso2 = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.country_code;
|
|
86
94
|
board_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_id;
|
|
87
95
|
board_info_id = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.board_info_id;
|
|
88
|
-
if (!(!!board_id && !!board_info_id)) return [3,
|
|
96
|
+
if (!(!!board_id && !!board_info_id)) return [3, 6];
|
|
89
97
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
90
|
-
case
|
|
98
|
+
case 5:
|
|
91
99
|
boardResponse = _h.sent();
|
|
92
|
-
_h.label =
|
|
93
|
-
case
|
|
100
|
+
_h.label = 6;
|
|
101
|
+
case 6:
|
|
94
102
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && isKW(countryIso2)) {
|
|
95
103
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
96
104
|
}
|
|
@@ -104,38 +112,32 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
104
112
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
105
113
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
106
114
|
hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
|
|
107
|
-
if (!hasBusinessCompleted) return [3,
|
|
115
|
+
if (!hasBusinessCompleted) return [3, 8];
|
|
108
116
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
109
|
-
case
|
|
117
|
+
case 7:
|
|
110
118
|
_h.sent();
|
|
111
119
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
112
120
|
return [3, 17];
|
|
113
|
-
case
|
|
114
|
-
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3,
|
|
121
|
+
case 8:
|
|
122
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
|
|
115
123
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
116
124
|
return [3, 17];
|
|
117
|
-
case
|
|
118
|
-
if (!hasBusinessCustomersCompleted) return [3,
|
|
125
|
+
case 9:
|
|
126
|
+
if (!hasBusinessCustomersCompleted) return [3, 10];
|
|
119
127
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
120
128
|
return [3, 17];
|
|
121
|
-
case 8:
|
|
122
|
-
if (!hasBusinessCRActivitiesCompleted) return [3, 12];
|
|
123
|
-
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
124
|
-
case 9:
|
|
125
|
-
_h.sent();
|
|
126
|
-
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
127
129
|
case 10:
|
|
130
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 13];
|
|
131
|
+
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
132
|
+
case 11:
|
|
128
133
|
_h.sent();
|
|
129
134
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
130
135
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
131
|
-
case
|
|
136
|
+
case 12:
|
|
132
137
|
brandInfo = _h.sent();
|
|
133
138
|
return [3, 17];
|
|
134
|
-
case 12:
|
|
135
|
-
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
136
|
-
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
137
139
|
case 13:
|
|
138
|
-
|
|
140
|
+
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
139
141
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
140
142
|
case 14:
|
|
141
143
|
brandInfo = _h.sent();
|
|
@@ -197,7 +199,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
197
199
|
case 1:
|
|
198
200
|
data = (_j.sent()).data;
|
|
199
201
|
brandInfo = undefined;
|
|
200
|
-
if (!!data.errors) return [3,
|
|
202
|
+
if (!!data.errors) return [3, 14];
|
|
201
203
|
thunkApi.dispatch(updateStepName(stepName));
|
|
202
204
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
203
205
|
case 2:
|
|
@@ -211,29 +213,28 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
211
213
|
isIdentityAuthStep = data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH;
|
|
212
214
|
if (!isNID) return [3, 3];
|
|
213
215
|
thunkApi.dispatch(handleNextScreenStep());
|
|
214
|
-
return [3,
|
|
216
|
+
return [3, 14];
|
|
215
217
|
case 3:
|
|
216
218
|
if (!(isIdentityAuthStep && isKW(countryIso2))) return [3, 4];
|
|
217
219
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CIVIL_ID_STEP'));
|
|
218
|
-
return [3,
|
|
220
|
+
return [3, 14];
|
|
219
221
|
case 4:
|
|
220
222
|
if (!hasBusinessCompleted) return [3, 6];
|
|
221
223
|
return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
|
|
222
224
|
case 5:
|
|
223
225
|
_j.sent();
|
|
224
226
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
225
|
-
return [3,
|
|
227
|
+
return [3, 14];
|
|
226
228
|
case 6:
|
|
227
229
|
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 7];
|
|
228
230
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
229
|
-
return [3,
|
|
231
|
+
return [3, 14];
|
|
230
232
|
case 7:
|
|
231
233
|
if (!hasBusinessCustomersCompleted) return [3, 8];
|
|
232
234
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
233
|
-
return [3,
|
|
235
|
+
return [3, 14];
|
|
234
236
|
case 8:
|
|
235
237
|
if (!hasBusinessCRActivitiesCompleted) return [3, 11];
|
|
236
|
-
thunkApi.dispatch(retrieveChannels());
|
|
237
238
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
238
239
|
case 9:
|
|
239
240
|
_j.sent();
|
|
@@ -241,21 +242,18 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
241
242
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
242
243
|
case 10:
|
|
243
244
|
brandInfo = _j.sent();
|
|
244
|
-
return [3,
|
|
245
|
+
return [3, 14];
|
|
245
246
|
case 11:
|
|
246
|
-
if (!hasBusinessCRInfoCompleted) return [3,
|
|
247
|
-
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
248
|
-
case 12:
|
|
249
|
-
_j.sent();
|
|
247
|
+
if (!hasBusinessCRInfoCompleted) return [3, 13];
|
|
250
248
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
251
|
-
case
|
|
249
|
+
case 12:
|
|
252
250
|
brandInfo = _j.sent();
|
|
253
251
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
254
|
-
return [3,
|
|
255
|
-
case
|
|
252
|
+
return [3, 14];
|
|
253
|
+
case 13:
|
|
256
254
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
257
|
-
_j.label =
|
|
258
|
-
case
|
|
255
|
+
_j.label = 14;
|
|
256
|
+
case 14: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
|
|
259
257
|
}
|
|
260
258
|
});
|
|
261
259
|
}); });
|
|
@@ -383,21 +381,6 @@ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', fun
|
|
|
383
381
|
}
|
|
384
382
|
});
|
|
385
383
|
}); });
|
|
386
|
-
export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
387
|
-
var body, data;
|
|
388
|
-
return __generator(this, function (_a) {
|
|
389
|
-
switch (_a.label) {
|
|
390
|
-
case 0:
|
|
391
|
-
body = {
|
|
392
|
-
page: 0
|
|
393
|
-
};
|
|
394
|
-
return [4, API.dataService.getChannelsOfServices(body)];
|
|
395
|
-
case 1:
|
|
396
|
-
data = _a.sent();
|
|
397
|
-
return [2, data];
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
}); });
|
|
401
384
|
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
402
385
|
var data;
|
|
403
386
|
return __generator(this, function (_a) {
|
|
@@ -424,7 +407,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', funct
|
|
|
424
407
|
});
|
|
425
408
|
}); });
|
|
426
409
|
export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
427
|
-
var _a, settings, business, payload, data, accountBody, accountData;
|
|
410
|
+
var _a, settings, business, payload, data, entity_activities, list, accountBody, accountData;
|
|
428
411
|
var _b, _c, _d, _e, _f, _g;
|
|
429
412
|
return __generator(this, function (_h) {
|
|
430
413
|
switch (_h.label) {
|
|
@@ -442,6 +425,14 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
442
425
|
return [4, API.leadService.updateLead(payload)];
|
|
443
426
|
case 1:
|
|
444
427
|
data = _h.sent();
|
|
428
|
+
entity_activities = data.entity_activities;
|
|
429
|
+
if (!!entity_activities) return [3, 3];
|
|
430
|
+
return [4, API.dataService.getActivities()];
|
|
431
|
+
case 2:
|
|
432
|
+
list = (_h.sent()).list;
|
|
433
|
+
data.entity_activities = list;
|
|
434
|
+
_h.label = 3;
|
|
435
|
+
case 3:
|
|
445
436
|
accountBody = {
|
|
446
437
|
lead_id: (_e = business.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.id,
|
|
447
438
|
notify: {
|
|
@@ -453,11 +444,8 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
453
444
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM
|
|
454
445
|
};
|
|
455
446
|
return [4, API.accountService.createAccount(accountBody)];
|
|
456
|
-
case
|
|
447
|
+
case 4:
|
|
457
448
|
accountData = _h.sent();
|
|
458
|
-
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
459
|
-
case 3:
|
|
460
|
-
_h.sent();
|
|
461
449
|
thunkApi.dispatch(handleNextScreenStep());
|
|
462
450
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
|
|
463
451
|
return [2, { data: data, formData: params, accountData: accountData }];
|
|
@@ -465,31 +453,26 @@ export var updateLeadBusinessType = createAsyncThunk('updateLeadBusinessType', f
|
|
|
465
453
|
});
|
|
466
454
|
}); });
|
|
467
455
|
export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
468
|
-
var _a, settings, business,
|
|
456
|
+
var _a, settings, business, activities, stepName, id, requestBody, data;
|
|
469
457
|
var _b, _c, _d, _e, _f;
|
|
470
458
|
return __generator(this, function (_g) {
|
|
471
459
|
switch (_g.label) {
|
|
472
460
|
case 0:
|
|
473
461
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
474
|
-
channel = params.salesChannels.map(function (_a) {
|
|
475
|
-
var id = _a.id;
|
|
476
|
-
return id;
|
|
477
|
-
});
|
|
478
462
|
activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
479
|
-
var
|
|
480
|
-
return
|
|
463
|
+
var id = _a.id;
|
|
464
|
+
return ({ id: id });
|
|
481
465
|
});
|
|
482
466
|
stepName = BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES;
|
|
483
467
|
id = (_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.id;
|
|
484
468
|
requestBody = {
|
|
485
469
|
id: id,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
business_operation_start_at: params.operationStartDate
|
|
470
|
+
activities: activities,
|
|
471
|
+
operations: {
|
|
472
|
+
start_date: params.operationStartDate
|
|
490
473
|
},
|
|
491
474
|
step_name: stepName,
|
|
492
|
-
encryption_contract: ['
|
|
475
|
+
encryption_contract: ['operations.start_date']
|
|
493
476
|
};
|
|
494
477
|
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
495
478
|
case 1:
|
|
@@ -645,7 +628,6 @@ var initialState = {
|
|
|
645
628
|
},
|
|
646
629
|
activitiesData: {
|
|
647
630
|
activities: [],
|
|
648
|
-
salesChannels: [],
|
|
649
631
|
operationStartDate: new Date().toString()
|
|
650
632
|
},
|
|
651
633
|
customersData: {
|
|
@@ -678,10 +660,10 @@ export var businessSlice = createSlice({
|
|
|
678
660
|
state.customLoading = true;
|
|
679
661
|
})
|
|
680
662
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
681
|
-
var _a, _b, _c, _d
|
|
663
|
+
var _a, _b, _c, _d;
|
|
682
664
|
state.error = null;
|
|
683
665
|
state.customLoading = false;
|
|
684
|
-
var
|
|
666
|
+
var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
|
|
685
667
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
686
668
|
if (description) {
|
|
687
669
|
state.error = description;
|
|
@@ -690,7 +672,7 @@ export var businessSlice = createSlice({
|
|
|
690
672
|
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
|
|
691
673
|
state.data.verify.token = token;
|
|
692
674
|
state.data.otpData.isNID = false;
|
|
693
|
-
var
|
|
675
|
+
var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
|
|
694
676
|
var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
|
|
695
677
|
? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
|
|
696
678
|
: (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
@@ -698,42 +680,21 @@ export var businessSlice = createSlice({
|
|
|
698
680
|
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
699
681
|
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
700
682
|
}
|
|
701
|
-
var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
|
|
702
|
-
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
703
|
-
var _j = brand || {}, website = _j.website, social = _j.social;
|
|
704
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
705
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
706
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
707
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
|
|
708
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
|
|
709
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
710
|
-
selectedChannels = [websiteData, socialData];
|
|
711
|
-
else if (isHasTwitter || isHasInstagram)
|
|
712
|
-
selectedChannels = [socialData];
|
|
713
|
-
else if (isHasWebsite)
|
|
714
|
-
selectedChannels = [websiteData];
|
|
715
|
-
if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
716
|
-
selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
717
|
-
var _a;
|
|
718
|
-
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.id === storedChannel; });
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
state.data.activitiesData.salesChannels = selectedChannels;
|
|
722
683
|
var activities = entity_activities || [];
|
|
723
684
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
724
685
|
var _a;
|
|
725
|
-
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) {
|
|
686
|
+
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return activity.id === value.id; });
|
|
726
687
|
});
|
|
727
688
|
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
728
689
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
729
690
|
if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
|
|
730
|
-
var licenseNumber_1 = (
|
|
731
|
-
var
|
|
691
|
+
var licenseNumber_1 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
|
|
692
|
+
var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
|
|
732
693
|
var licenseList = (responseBody || {}).licenseList;
|
|
733
694
|
var selectedLicenseData = selectedLicense;
|
|
734
695
|
if (!!licenseNumber_1) {
|
|
735
696
|
selectedLicenseData =
|
|
736
|
-
((
|
|
697
|
+
((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
|
|
737
698
|
var license = _a.license;
|
|
738
699
|
return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_1;
|
|
739
700
|
})) ||
|
|
@@ -770,10 +731,10 @@ export var businessSlice = createSlice({
|
|
|
770
731
|
state.error = null;
|
|
771
732
|
})
|
|
772
733
|
.addCase(verifyLeadOTP.fulfilled, function (state, action) {
|
|
773
|
-
var _a, _b, _c, _d
|
|
734
|
+
var _a, _b, _c, _d;
|
|
774
735
|
state.loading = false;
|
|
775
736
|
state.error = null;
|
|
776
|
-
var
|
|
737
|
+
var _e = action.payload, data = _e.data, formData = _e.formData, brandInfo = _e.brandInfo;
|
|
777
738
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
778
739
|
if (description) {
|
|
779
740
|
state.error = description;
|
|
@@ -781,7 +742,7 @@ export var businessSlice = createSlice({
|
|
|
781
742
|
}
|
|
782
743
|
state.data.otpData = formData;
|
|
783
744
|
state.data.otpData.responseBody = data;
|
|
784
|
-
var
|
|
745
|
+
var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
|
|
785
746
|
var issuingDate = (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at)
|
|
786
747
|
? brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_operation_start_at
|
|
787
748
|
: (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.issuing_date;
|
|
@@ -789,42 +750,21 @@ export var businessSlice = createSlice({
|
|
|
789
750
|
var formattedDate = moment(issuingDate).format('YYYY-MM-DD');
|
|
790
751
|
state.data.activitiesData.operationStartDate = convertNumbers2English(formattedDate);
|
|
791
752
|
}
|
|
792
|
-
var channels = (_c = state.data.businessTypeData.responseBody) === null || _c === void 0 ? void 0 : _c.channelList;
|
|
793
|
-
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
794
|
-
var _j = brand || {}, website = _j.website, social = _j.social;
|
|
795
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
796
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
797
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
798
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
|
|
799
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
|
|
800
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
801
|
-
selectedChannels = [websiteData, socialData];
|
|
802
|
-
else if (isHasTwitter || isHasInstagram)
|
|
803
|
-
selectedChannels = [socialData];
|
|
804
|
-
else if (isHasWebsite)
|
|
805
|
-
selectedChannels = [websiteData];
|
|
806
|
-
if (((_d = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _d === void 0 ? void 0 : _d.length) > 0) {
|
|
807
|
-
selectedChannels = channels === null || channels === void 0 ? void 0 : channels.filter(function (channel) {
|
|
808
|
-
var _a;
|
|
809
|
-
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.channel_services) === null || _a === void 0 ? void 0 : _a.find(function (storedChannel) { return channel.name.en.toLowerCase() === storedChannel.toLowerCase(); });
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
state.data.activitiesData.salesChannels = selectedChannels;
|
|
813
753
|
var activities = entity_activities || [];
|
|
814
754
|
var selectedActivity = activities === null || activities === void 0 ? void 0 : activities.filter(function (activity) {
|
|
815
755
|
var _a;
|
|
816
|
-
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) {
|
|
756
|
+
return (_a = brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.activities) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id === activity.id; });
|
|
817
757
|
});
|
|
818
758
|
state.data.activitiesData.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [activities === null || activities === void 0 ? void 0 : activities[0]];
|
|
819
759
|
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activities: activities });
|
|
820
760
|
if (!!(entity === null || entity === void 0 ? void 0 : entity.license)) {
|
|
821
|
-
var licenseNumber_2 = (
|
|
822
|
-
var
|
|
761
|
+
var licenseNumber_2 = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
|
|
762
|
+
var _g = state.data.businessTypeData || {}, responseBody = _g.responseBody, selectedLicense = _g.selectedLicense;
|
|
823
763
|
var licenseList = (responseBody || {}).licenseList;
|
|
824
764
|
var selectedLicenseData = selectedLicense;
|
|
825
765
|
if (!!licenseNumber_2) {
|
|
826
766
|
selectedLicenseData =
|
|
827
|
-
((
|
|
767
|
+
((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
|
|
828
768
|
var license = _a.license;
|
|
829
769
|
return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber_2;
|
|
830
770
|
})) ||
|
|
@@ -967,42 +907,6 @@ export var businessSlice = createSlice({
|
|
|
967
907
|
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
968
908
|
state.error = action.error.message;
|
|
969
909
|
state.loading = false;
|
|
970
|
-
})
|
|
971
|
-
.addCase(retrieveChannels.pending, function (state) {
|
|
972
|
-
state.error = null;
|
|
973
|
-
state.loading = true;
|
|
974
|
-
})
|
|
975
|
-
.addCase(retrieveChannels.fulfilled, function (state, action) {
|
|
976
|
-
var _a;
|
|
977
|
-
state.error = null;
|
|
978
|
-
state.loading = false;
|
|
979
|
-
var data = action.payload || {};
|
|
980
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
981
|
-
if (description) {
|
|
982
|
-
state.error = description;
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
var channels = data.list || [];
|
|
986
|
-
state.data.businessTypeData.responseBody = __assign(__assign({}, state.data.businessTypeData.responseBody), { channelList: channels });
|
|
987
|
-
var brand = (state.data.verify.responseBody || {}).brand;
|
|
988
|
-
var selectedChannels = (!!(channels === null || channels === void 0 ? void 0 : channels[0]) && [channels === null || channels === void 0 ? void 0 : channels[0]]) || [];
|
|
989
|
-
var _b = brand || {}, website = _b.website, social = _b.social;
|
|
990
|
-
var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
|
|
991
|
-
var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
|
|
992
|
-
var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
|
|
993
|
-
var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'website'; });
|
|
994
|
-
var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name.en.toLocaleLowerCase() === 'social media'; });
|
|
995
|
-
if (isHasWebsite && (isHasTwitter || isHasInstagram))
|
|
996
|
-
selectedChannels = [websiteData, socialData];
|
|
997
|
-
else if (isHasTwitter || isHasInstagram)
|
|
998
|
-
selectedChannels = [socialData];
|
|
999
|
-
else if (isHasWebsite)
|
|
1000
|
-
selectedChannels = [websiteData];
|
|
1001
|
-
state.data.activitiesData.salesChannels = selectedChannels;
|
|
1002
|
-
})
|
|
1003
|
-
.addCase(retrieveChannels.rejected, function (state, action) {
|
|
1004
|
-
state.error = action.error.message;
|
|
1005
|
-
state.loading = false;
|
|
1006
910
|
})
|
|
1007
911
|
.addCase(updateLeadBusinessType.pending, function (state) {
|
|
1008
912
|
state.loading = true;
|
|
@@ -23,6 +23,7 @@ export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
23
23
|
response: any;
|
|
24
24
|
formData: OTPFormValues;
|
|
25
25
|
leadData: any;
|
|
26
|
+
selectedChannels: any;
|
|
26
27
|
}, OTPFormValues, {}>;
|
|
27
28
|
interface verifyPACIParams {
|
|
28
29
|
onSuccess?: () => void | Promise<void>;
|
|
@@ -215,16 +215,17 @@ export var resendOTPNID = createAsyncThunk('resendOTPNID', function (params, thu
|
|
|
215
215
|
});
|
|
216
216
|
}); });
|
|
217
217
|
export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
-
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, individualInfo, payload, data, leadData, isNewUser, params_1;
|
|
219
|
-
var _c, _d;
|
|
220
|
-
return __generator(this, function (
|
|
221
|
-
switch (
|
|
218
|
+
var _a, connect, settings, isAbsher, _b, mobileData, nidData, responseBody, individualInfo, selectedChannels, payload, data, leadData, isNewUser, brand, params_1;
|
|
219
|
+
var _c, _d, _e, _f;
|
|
220
|
+
return __generator(this, function (_g) {
|
|
221
|
+
switch (_g.label) {
|
|
222
222
|
case 0:
|
|
223
223
|
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
224
224
|
isAbsher = connect.data.otpData.isAbsher;
|
|
225
225
|
_b = connect.data, mobileData = _b.mobileData, nidData = _b.nidData;
|
|
226
226
|
responseBody = (isAbsher ? nidData : mobileData).responseBody;
|
|
227
227
|
individualInfo = undefined;
|
|
228
|
+
selectedChannels = undefined;
|
|
228
229
|
payload = {
|
|
229
230
|
data: params.otp,
|
|
230
231
|
auth_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token,
|
|
@@ -239,20 +240,26 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
239
240
|
};
|
|
240
241
|
return [4, API.authService.verifyAuth(payload)];
|
|
241
242
|
case 1:
|
|
242
|
-
data = (
|
|
243
|
-
if (!!data.errors) return [3,
|
|
243
|
+
data = (_g.sent()).data;
|
|
244
|
+
if (!!data.errors) return [3, 7];
|
|
244
245
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
245
246
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.lead_id)];
|
|
246
247
|
case 2:
|
|
247
|
-
leadData = (
|
|
248
|
+
leadData = (_g.sent()).data;
|
|
248
249
|
individualInfo = leadData;
|
|
249
250
|
isNewUser = leadData === null || leadData === void 0 ? void 0 : leadData.is_new_individual;
|
|
250
|
-
|
|
251
|
+
if (!!!((_e = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _e === void 0 ? void 0 : _e.id)) return [3, 4];
|
|
252
|
+
return [4, API.brandService.retrieveBrand((_f = leadData === null || leadData === void 0 ? void 0 : leadData.brand) === null || _f === void 0 ? void 0 : _f.id)];
|
|
251
253
|
case 3:
|
|
252
|
-
|
|
254
|
+
brand = (_g.sent()).brand;
|
|
255
|
+
selectedChannels = brand === null || brand === void 0 ? void 0 : brand.channel_services;
|
|
256
|
+
_g.label = 4;
|
|
257
|
+
case 4: return [4, thunkApi.dispatch(retrieveBrandList(individualInfo === null || individualInfo === void 0 ? void 0 : individualInfo.individual_id))];
|
|
258
|
+
case 5:
|
|
259
|
+
_g.sent();
|
|
253
260
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
254
|
-
case
|
|
255
|
-
|
|
261
|
+
case 6:
|
|
262
|
+
_g.sent();
|
|
256
263
|
if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
|
|
257
264
|
params_1 = {
|
|
258
265
|
individualId: data === null || data === void 0 ? void 0 : data.individual_id,
|
|
@@ -265,8 +272,8 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
265
272
|
? thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'))
|
|
266
273
|
: thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
|
|
267
274
|
}
|
|
268
|
-
|
|
269
|
-
case
|
|
275
|
+
_g.label = 7;
|
|
276
|
+
case 7: return [2, { response: data, formData: params, leadData: individualInfo, selectedChannels: selectedChannels }];
|
|
270
277
|
}
|
|
271
278
|
});
|
|
272
279
|
}); });
|
|
@@ -437,48 +444,66 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
437
444
|
});
|
|
438
445
|
}); });
|
|
439
446
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
440
|
-
var _a, settings, connect, instagram, twitter, _b, otpData, brandData,
|
|
441
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
442
|
-
return __generator(this, function (
|
|
443
|
-
switch (
|
|
447
|
+
var _a, settings, connect, instagram, twitter, _b, otpData, brandData, responseBody, isExistingUser, isOther, brand, payload, data, hasWebsite, hasTwitter, hasInstagram, hasAppleApp, hasPlayApp, hasCallCenter, hasPhysicalStore, links, salesBackendBody, salesChannelsPayload;
|
|
448
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
449
|
+
return __generator(this, function (_w) {
|
|
450
|
+
switch (_w.label) {
|
|
444
451
|
case 0:
|
|
445
452
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
446
453
|
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) : '';
|
|
447
454
|
twitter = !!((_e = params.links) === null || _e === void 0 ? void 0 : _e.twitter) ? "".concat(TWITTER_URL, "/").concat((_f = params.links) === null || _f === void 0 ? void 0 : _f.twitter) : '';
|
|
448
455
|
_b = connect.data, otpData = _b.otpData, brandData = _b.brandData;
|
|
449
|
-
isAbsher = otpData.isAbsher;
|
|
450
456
|
responseBody = otpData.responseBody;
|
|
451
457
|
isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.is_new_individual) === false;
|
|
452
458
|
isOther = !!((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) ? ((_h = params.selectedBrandItem) === null || _h === void 0 ? void 0 : _h.id) === 'other' : true;
|
|
453
|
-
brand =
|
|
459
|
+
brand = {
|
|
460
|
+
name: {
|
|
454
461
|
en: params.brandName,
|
|
455
462
|
ar: params.brandName,
|
|
456
463
|
zh: params.brandName
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
id: (_k = params.selectedBrandItem) === null || _k === void 0 ? void 0 : _k.id,
|
|
460
|
-
name: undefined
|
|
461
|
-
}));
|
|
464
|
+
}
|
|
465
|
+
};
|
|
462
466
|
payload = {
|
|
463
467
|
brand: brand,
|
|
464
|
-
id: (isExistingUser ? (
|
|
468
|
+
id: (isExistingUser ? (_j = brandData.responseBody) === null || _j === void 0 ? void 0 : _j.lead_id : (_k = otpData.responseBody) === null || _k === void 0 ? void 0 : _k.lead_id) || '',
|
|
465
469
|
terms_conditions_accepted: isExistingUser && !isOther ? undefined : params.termAndConditionChecked,
|
|
466
470
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_BRAND,
|
|
467
|
-
encryption_contract: [
|
|
468
|
-
'brand.name.en',
|
|
469
|
-
'brand.name.ar',
|
|
470
|
-
'brand.name.zh',
|
|
471
|
-
'brand.website',
|
|
472
|
-
'brand.social[0]',
|
|
473
|
-
'brand.social[1]'
|
|
474
|
-
]
|
|
471
|
+
encryption_contract: ['brand.name.en', 'brand.name.ar', 'brand.name.zh']
|
|
475
472
|
};
|
|
476
473
|
return [4, API.leadService.updateLead(payload)];
|
|
477
474
|
case 1:
|
|
478
|
-
data =
|
|
475
|
+
data = _w.sent();
|
|
476
|
+
hasWebsite = !!((_l = params.links) === null || _l === void 0 ? void 0 : _l.website);
|
|
477
|
+
hasTwitter = !!((_m = params.links) === null || _m === void 0 ? void 0 : _m.twitter);
|
|
478
|
+
hasInstagram = !!((_o = params.links) === null || _o === void 0 ? void 0 : _o.instagram);
|
|
479
|
+
hasAppleApp = !!((_p = params.links) === null || _p === void 0 ? void 0 : _p.apple_store);
|
|
480
|
+
hasPlayApp = !!((_q = params.links) === null || _q === void 0 ? void 0 : _q.play_store);
|
|
481
|
+
hasCallCenter = !!((_r = params.links) === null || _r === void 0 ? void 0 : _r.call_center);
|
|
482
|
+
hasPhysicalStore = !!((_s = params.links) === null || _s === void 0 ? void 0 : _s.physical_store);
|
|
483
|
+
links = params.links;
|
|
484
|
+
salesBackendBody = [];
|
|
485
|
+
if (hasWebsite)
|
|
486
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_7VoC2322123xgg9250S9L806', address: links.website });
|
|
487
|
+
if (hasTwitter)
|
|
488
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_cLGQ2322123rmQk259q9s815', address: links.twitter });
|
|
489
|
+
if (hasInstagram)
|
|
490
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_cLGQ2322123rmQk259q9s815', address: links.instagram });
|
|
491
|
+
if (hasAppleApp)
|
|
492
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_2kLg2322123pK5C25V49K815', address: links.apple_store });
|
|
493
|
+
if (hasPlayApp)
|
|
494
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_2kLg2322123pK5C25V49K815', address: links.play_store });
|
|
495
|
+
if (hasCallCenter)
|
|
496
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_aCg923221233eUv255x9V816', address: links.call_center });
|
|
497
|
+
if (hasPhysicalStore)
|
|
498
|
+
salesBackendBody === null || salesBackendBody === void 0 ? void 0 : salesBackendBody.push({ id: 'sales_channel_1aQ52322123Xt7K25Qv9d815', address: links.physical_store });
|
|
499
|
+
salesChannelsPayload = {
|
|
500
|
+
id: (_t = data === null || data === void 0 ? void 0 : data.brand) === null || _t === void 0 ? void 0 : _t.id,
|
|
501
|
+
channel_services: salesBackendBody
|
|
502
|
+
};
|
|
503
|
+
API.brandService.updateBrandSales(salesChannelsPayload);
|
|
479
504
|
thunkApi.dispatch(updateLeadSuccess());
|
|
480
505
|
thunkApi.dispatch(handleNextScreenStep());
|
|
481
|
-
(
|
|
506
|
+
(_v = (_u = settings.data.appConfig).onStepCompleted) === null || _v === void 0 ? void 0 : _v.call(_u, settings.data.activeScreen.name, params);
|
|
482
507
|
return [2, { response: data, formData: params }];
|
|
483
508
|
}
|
|
484
509
|
});
|
|
@@ -591,7 +616,11 @@ var initialState = {
|
|
|
591
616
|
links: {
|
|
592
617
|
website: '',
|
|
593
618
|
twitter: '',
|
|
594
|
-
instagram: ''
|
|
619
|
+
instagram: '',
|
|
620
|
+
apple_store: '',
|
|
621
|
+
play_store: '',
|
|
622
|
+
call_center: '',
|
|
623
|
+
physical_store: ''
|
|
595
624
|
},
|
|
596
625
|
selectedBrandItem: {},
|
|
597
626
|
responseBody: {
|
|
@@ -767,7 +796,7 @@ export var connectSlice = createSlice({
|
|
|
767
796
|
.addCase(verifyAuth.fulfilled, function (state, action) {
|
|
768
797
|
var _a, _b;
|
|
769
798
|
state.error = null;
|
|
770
|
-
var _c = action.payload, formData = _c.formData, response = _c.response, leadData = _c.leadData;
|
|
799
|
+
var _c = action.payload, formData = _c.formData, response = _c.response, leadData = _c.leadData, selectedChannels = _c.selectedChannels;
|
|
771
800
|
var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
772
801
|
if (description) {
|
|
773
802
|
state.loading = false;
|