@tap-payments/auth-jsconnect 2.4.69-test → 2.4.70-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 +9 -0
- package/build/@types/form.d.ts +0 -1
- package/build/features/app/brand/brandStore.d.ts +0 -2
- package/build/features/app/brand/brandStore.js +13 -21
- package/build/features/app/connect/connectStore.d.ts +14 -0
- package/build/features/app/connect/connectStore.js +88 -41
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +0 -1
- package/build/features/connect/screens/Merchant/BrandList.js +13 -3
- package/build/features/connect/screens/Merchant/Merchant.js +18 -8
- package/build/features/connect/screens/Merchant/SegmentLocations.d.ts +8 -0
- package/build/features/connect/screens/Merchant/SegmentLocations.js +66 -0
- package/build/features/connect/screens/Merchant/SegmentProfits.d.ts +8 -0
- package/build/features/connect/screens/Merchant/{Segments.js → SegmentProfits.js} +16 -16
- package/build/features/connect/screens/Merchant/SegmentTechs.d.ts +8 -0
- package/build/features/connect/screens/Merchant/SegmentTechs.js +66 -0
- package/build/features/connect/screens/Merchant/validation.d.ts +9 -3
- package/build/features/connect/screens/Merchant/validation.js +6 -2
- package/package.json +1 -1
- package/build/features/connect/screens/Merchant/Segments.d.ts +0 -8
package/build/@types/app.d.ts
CHANGED
package/build/@types/form.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export type IndividualFormValues = {
|
|
|
31
31
|
export type BrandFormValues = {
|
|
32
32
|
brandName: string;
|
|
33
33
|
brandLogoId?: string;
|
|
34
|
-
segment?: Segment | undefined;
|
|
35
34
|
segmentLocation?: Segment | undefined;
|
|
36
35
|
segmentProfit?: Segment | undefined;
|
|
37
36
|
segmentTech?: Segment | undefined;
|
|
@@ -21,7 +21,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
21
21
|
notification: any;
|
|
22
22
|
};
|
|
23
23
|
salesChannels: any;
|
|
24
|
-
segmentsList: any;
|
|
25
24
|
teamSizeList: any;
|
|
26
25
|
segmentLocationList: any;
|
|
27
26
|
segmentProfitList: any;
|
|
@@ -65,7 +64,6 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
65
64
|
notification: any;
|
|
66
65
|
};
|
|
67
66
|
salesChannels: any;
|
|
68
|
-
segmentsList: any;
|
|
69
67
|
teamSizeList: any;
|
|
70
68
|
segmentLocationList: any;
|
|
71
69
|
segmentProfitList: any;
|
|
@@ -66,7 +66,7 @@ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retr
|
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
|
|
67
67
|
var token = _a.token, isInternally = _a.isInternally;
|
|
68
68
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
-
var payload, data, countryIso2, _b, board_id, board_info_id,
|
|
69
|
+
var payload, data, countryIso2, _b, board_id, board_info_id, segmentLocationList, segmentProfitList, segmentTechList, salesChannels, teamSizeList, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, _e, segmentLocation, segmentProfit, segmentTech;
|
|
70
70
|
var _f, _g, _h, _j;
|
|
71
71
|
return __generator(this, function (_k) {
|
|
72
72
|
switch (_k.label) {
|
|
@@ -91,7 +91,7 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
91
91
|
individualData = undefined;
|
|
92
92
|
if (isInternally)
|
|
93
93
|
data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
|
|
94
|
-
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3,
|
|
94
|
+
if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 9];
|
|
95
95
|
if (!board_info_id) return [3, 3];
|
|
96
96
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
97
97
|
case 2:
|
|
@@ -118,18 +118,15 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
118
118
|
segmentLocationList = segmentLocation;
|
|
119
119
|
segmentProfitList = segmentProfit;
|
|
120
120
|
segmentTechList = segmentTech;
|
|
121
|
-
return [4, API.dataService.getSegments({ page: 0 })];
|
|
122
|
-
case 7:
|
|
123
|
-
segmentsList = _k.sent();
|
|
124
121
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
125
|
-
case
|
|
122
|
+
case 7:
|
|
126
123
|
salesChannels = _k.sent();
|
|
127
124
|
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
128
|
-
case
|
|
125
|
+
case 8:
|
|
129
126
|
teamSizeList = _k.sent();
|
|
130
127
|
thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
|
|
131
|
-
_k.label =
|
|
132
|
-
case
|
|
128
|
+
_k.label = 9;
|
|
129
|
+
case 9: return [2, {
|
|
133
130
|
data: data,
|
|
134
131
|
individualData: individualData,
|
|
135
132
|
boardResponse: {
|
|
@@ -145,7 +142,6 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
145
142
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
146
143
|
},
|
|
147
144
|
salesChannels: salesChannels,
|
|
148
|
-
segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
|
|
149
145
|
teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
|
|
150
146
|
segmentLocationList: segmentLocationList,
|
|
151
147
|
segmentProfitList: segmentProfitList,
|
|
@@ -174,7 +170,7 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
174
170
|
});
|
|
175
171
|
}); });
|
|
176
172
|
export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
177
|
-
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, _e, segmentLocation, segmentProfit, segmentTech,
|
|
173
|
+
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, _e, segmentLocation, segmentProfit, segmentTech, salesChannels, teamSizeList;
|
|
178
174
|
var _f, _g, _h, _j, _k, _l, _m;
|
|
179
175
|
return __generator(this, function (_o) {
|
|
180
176
|
switch (_o.label) {
|
|
@@ -217,14 +213,11 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
217
213
|
return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
|
|
218
214
|
case 6:
|
|
219
215
|
_e = _o.sent(), segmentLocation = _e.segmentLocation, segmentProfit = _e.segmentProfit, segmentTech = _e.segmentTech;
|
|
220
|
-
return [4, API.dataService.getSegments({ page: 0 })];
|
|
221
|
-
case 7:
|
|
222
|
-
segmentsList = _o.sent();
|
|
223
216
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
224
|
-
case
|
|
217
|
+
case 7:
|
|
225
218
|
salesChannels = _o.sent();
|
|
226
219
|
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
227
|
-
case
|
|
220
|
+
case 8:
|
|
228
221
|
teamSizeList = _o.sent();
|
|
229
222
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
230
223
|
return [2, {
|
|
@@ -243,7 +236,6 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
243
236
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
244
237
|
},
|
|
245
238
|
salesChannels: salesChannels,
|
|
246
|
-
segmentsList: segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.list,
|
|
247
239
|
teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
|
|
248
240
|
segmentLocationList: segmentLocation,
|
|
249
241
|
segmentProfitList: segmentProfit,
|
|
@@ -596,7 +588,7 @@ export var brandSlice = createSlice({
|
|
|
596
588
|
var _a, _b, _c, _d, _e, _f;
|
|
597
589
|
state.error = null;
|
|
598
590
|
state.customLoading = false;
|
|
599
|
-
var _g = action.payload, data = _g.data, token = _g.token, boardResponse = _g.boardResponse,
|
|
591
|
+
var _g = action.payload, data = _g.data, token = _g.token, boardResponse = _g.boardResponse, teamSizeList = _g.teamSizeList, salesChannels = _g.salesChannels, individualData = _g.individualData, segmentLocationList = _g.segmentLocationList, segmentProfitList = _g.segmentProfitList, segmentTechList = _g.segmentTechList;
|
|
600
592
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
601
593
|
state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
|
|
602
594
|
var selectedSegmentLocation = (_b = segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.filter(function (location) {
|
|
@@ -628,7 +620,7 @@ export var brandSlice = createSlice({
|
|
|
628
620
|
state.data.brandData.teamSize = selectedTeamSize;
|
|
629
621
|
var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
|
|
630
622
|
state.data.brandData.salesChannels = mappedSalesChannels;
|
|
631
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, activities: entity === null || entity === void 0 ? void 0 : entity.activities,
|
|
623
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, activities: entity === null || entity === void 0 ? void 0 : entity.activities, teamSizeList: teamSizeList, individualData: individualData, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList });
|
|
632
624
|
state.data.verify.token = token;
|
|
633
625
|
})
|
|
634
626
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
@@ -654,7 +646,7 @@ export var brandSlice = createSlice({
|
|
|
654
646
|
var _a, _b, _c, _d, _e, _f;
|
|
655
647
|
state.loading = false;
|
|
656
648
|
state.error = null;
|
|
657
|
-
var _g = action.payload, data = _g.data, boardResponse = _g.boardResponse, formData = _g.formData,
|
|
649
|
+
var _g = action.payload, data = _g.data, boardResponse = _g.boardResponse, formData = _g.formData, teamSizeList = _g.teamSizeList, salesChannels = _g.salesChannels, individualData = _g.individualData, segmentLocationList = _g.segmentLocationList, segmentProfitList = _g.segmentProfitList, segmentTechList = _g.segmentTechList;
|
|
658
650
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
659
651
|
state.data.otpData = formData;
|
|
660
652
|
state.data.otpData.responseBody = data;
|
|
@@ -688,7 +680,7 @@ export var brandSlice = createSlice({
|
|
|
688
680
|
state.data.brandActivities.refundPolicy = element.agree;
|
|
689
681
|
}
|
|
690
682
|
});
|
|
691
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], activities: entity === null || entity === void 0 ? void 0 : entity.activities, salesChannels: mappedSalesChannels,
|
|
683
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], activities: entity === null || entity === void 0 ? void 0 : entity.activities, salesChannels: mappedSalesChannels, teamSizeList: teamSizeList, individualData: individualData, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList });
|
|
692
684
|
})
|
|
693
685
|
.addCase(verifyBrandLeadOTP.rejected, function (state, action) {
|
|
694
686
|
state.loading = false;
|
|
@@ -109,6 +109,20 @@ export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk
|
|
|
109
109
|
fulfilledMeta?: unknown;
|
|
110
110
|
rejectedMeta?: unknown;
|
|
111
111
|
}>;
|
|
112
|
+
export declare const retrieveSegmentDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
113
|
+
segmentLocation: any;
|
|
114
|
+
segmentProfit: any;
|
|
115
|
+
segmentTech: any;
|
|
116
|
+
}, void, {
|
|
117
|
+
state?: unknown;
|
|
118
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
119
|
+
extra?: unknown;
|
|
120
|
+
rejectValue?: unknown;
|
|
121
|
+
serializedErrorType?: unknown;
|
|
122
|
+
pendingMeta?: unknown;
|
|
123
|
+
fulfilledMeta?: unknown;
|
|
124
|
+
rejectedMeta?: unknown;
|
|
125
|
+
}>;
|
|
112
126
|
export declare const updateLeadBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
113
127
|
response: any;
|
|
114
128
|
formData: BrandFormValues & {
|
|
@@ -363,17 +363,17 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
363
363
|
});
|
|
364
364
|
}); });
|
|
365
365
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
366
|
-
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse,
|
|
367
|
-
var
|
|
368
|
-
return __generator(this, function (
|
|
369
|
-
switch (
|
|
366
|
+
var _a, settings, connect, lead_id, phoneCountry, payload, leadResponse, _b, segmentLocation, segmentProfit, segmentTech, err_3, teamSize, err_4, brand;
|
|
367
|
+
var _c, _d, _e, _f, _g;
|
|
368
|
+
return __generator(this, function (_h) {
|
|
369
|
+
switch (_h.label) {
|
|
370
370
|
case 0:
|
|
371
371
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
372
372
|
lead_id = (connect.data.otpData.responseBody || {}).lead_id;
|
|
373
|
-
phoneCountry = (
|
|
373
|
+
phoneCountry = (_d = (_c = params.countryCode) === null || _c === void 0 ? void 0 : _c.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString();
|
|
374
374
|
payload = {
|
|
375
375
|
id: lead_id || '',
|
|
376
|
-
country_code: (
|
|
376
|
+
country_code: (_e = settings.data.businessCountry) === null || _e === void 0 ? void 0 : _e.iso2,
|
|
377
377
|
name: getIndividualName(params.name),
|
|
378
378
|
contact: __assign({ email: params.email }, (params.mobile && { phone: { country_code: phoneCountry, number: params.mobile } })),
|
|
379
379
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_INDIVIDUAL,
|
|
@@ -381,52 +381,78 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
381
381
|
};
|
|
382
382
|
return [4, API.leadService.updateLead(payload)];
|
|
383
383
|
case 1:
|
|
384
|
-
leadResponse =
|
|
385
|
-
|
|
384
|
+
leadResponse = _h.sent();
|
|
385
|
+
_h.label = 2;
|
|
386
386
|
case 2:
|
|
387
|
-
|
|
388
|
-
return [4,
|
|
387
|
+
_h.trys.push([2, 4, , 5]);
|
|
388
|
+
return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
|
|
389
389
|
case 3:
|
|
390
|
-
|
|
391
|
-
leadResponse.
|
|
390
|
+
_b = _h.sent(), segmentLocation = _b.segmentLocation, segmentProfit = _b.segmentProfit, segmentTech = _b.segmentTech;
|
|
391
|
+
leadResponse.segment_location_list = segmentLocation;
|
|
392
|
+
leadResponse.segment_profit_list = segmentProfit;
|
|
393
|
+
leadResponse.segment_tech_list = segmentTech;
|
|
392
394
|
return [3, 5];
|
|
393
395
|
case 4:
|
|
394
|
-
err_3 =
|
|
396
|
+
err_3 = _h.sent();
|
|
395
397
|
return [3, 5];
|
|
396
398
|
case 5:
|
|
397
|
-
|
|
399
|
+
_h.trys.push([5, 7, , 8]);
|
|
398
400
|
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
399
401
|
case 6:
|
|
400
|
-
teamSize =
|
|
402
|
+
teamSize = _h.sent();
|
|
401
403
|
leadResponse.team_size_list = teamSize.list;
|
|
402
404
|
return [3, 8];
|
|
403
405
|
case 7:
|
|
404
|
-
err_4 =
|
|
406
|
+
err_4 = _h.sent();
|
|
405
407
|
return [3, 8];
|
|
406
408
|
case 8:
|
|
407
409
|
if (!leadResponse.brand) return [3, 10];
|
|
408
410
|
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
409
411
|
case 9:
|
|
410
|
-
brand = (
|
|
412
|
+
brand = (_h.sent()).brand;
|
|
411
413
|
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
412
|
-
|
|
414
|
+
_h.label = 10;
|
|
413
415
|
case 10:
|
|
414
|
-
(
|
|
416
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
|
|
415
417
|
thunkApi.dispatch(handleNextScreenStep());
|
|
416
418
|
return [2, { leadResponse: leadResponse, formData: params }];
|
|
417
419
|
}
|
|
418
420
|
});
|
|
419
421
|
}); });
|
|
422
|
+
export var retrieveSegmentDataList = createAsyncThunk('connectRetrieveSegmentDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
423
|
+
var dataBody, _a, segmentLocation, segmentProfit, segmentTech;
|
|
424
|
+
return __generator(this, function (_b) {
|
|
425
|
+
switch (_b.label) {
|
|
426
|
+
case 0:
|
|
427
|
+
dataBody = {
|
|
428
|
+
page: 0,
|
|
429
|
+
limit: 50
|
|
430
|
+
};
|
|
431
|
+
return [4, Promise.all([
|
|
432
|
+
API.dataService.getSegmentLocation(dataBody),
|
|
433
|
+
API.dataService.getSegmentProfit(dataBody),
|
|
434
|
+
API.dataService.getSegmentTech(dataBody)
|
|
435
|
+
])];
|
|
436
|
+
case 1:
|
|
437
|
+
_a = _b.sent(), segmentLocation = _a[0].list, segmentProfit = _a[1].list, segmentTech = _a[2].list;
|
|
438
|
+
return [2, {
|
|
439
|
+
segmentLocation: segmentLocation,
|
|
440
|
+
segmentProfit: segmentProfit,
|
|
441
|
+
segmentTech: segmentTech
|
|
442
|
+
}];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}); });
|
|
420
446
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
421
|
-
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
|
|
422
|
-
var _b, _c, _d, _e, _f
|
|
423
|
-
return __generator(this, function (
|
|
424
|
-
switch (
|
|
447
|
+
var _a, settings, connect, responseBody, leadBrandId, isNewBrand, brandName, salesChannels, selectedBrandItem, brandLogoId, segmentLocation, segmentProfit, segmentTech, teamSize, termAndConditionChecked, getAddress, channel_services, payload_1, brandReqBody_1, brand_1, brandNameBody, payload, lead, brandReqBody, brand;
|
|
448
|
+
var _b, _c, _d, _e, _f;
|
|
449
|
+
return __generator(this, function (_g) {
|
|
450
|
+
switch (_g.label) {
|
|
425
451
|
case 0:
|
|
426
452
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
427
453
|
responseBody = connect.data.otpData.responseBody;
|
|
428
454
|
leadBrandId = responseBody === null || responseBody === void 0 ? void 0 : responseBody.brand_id;
|
|
429
|
-
isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem;
|
|
455
|
+
isNewBrand = params.isNewBrand, brandName = params.brandName, salesChannels = params.salesChannels, selectedBrandItem = params.selectedBrandItem, brandLogoId = params.brandLogoId, segmentLocation = params.segmentLocation, segmentProfit = params.segmentProfit, segmentTech = params.segmentTech, teamSize = params.teamSize, termAndConditionChecked = params.termAndConditionChecked;
|
|
430
456
|
getAddress = function (value, isTwitter, isWeb) {
|
|
431
457
|
if (isTwitter)
|
|
432
458
|
return '@' + value;
|
|
@@ -455,22 +481,22 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
455
481
|
};
|
|
456
482
|
return [4, API.leadService.updateLead(payload_1)];
|
|
457
483
|
case 1:
|
|
458
|
-
|
|
459
|
-
|
|
484
|
+
_g.sent();
|
|
485
|
+
_g.label = 2;
|
|
460
486
|
case 2:
|
|
461
487
|
brandReqBody_1 = {
|
|
462
488
|
id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
|
|
463
489
|
channel_services: channel_services,
|
|
464
490
|
term: ['general'],
|
|
465
|
-
segment: {
|
|
491
|
+
segment: __assign(__assign(__assign(__assign({}, ((segmentLocation === null || segmentLocation === void 0 ? void 0 : segmentLocation.id) && { location_type: { id: segmentLocation.id } })), ((segmentProfit === null || segmentProfit === void 0 ? void 0 : segmentProfit.id) && { profit_type: { id: segmentProfit.id } })), ((segmentTech === null || segmentTech === void 0 ? void 0 : segmentTech.id) && { tech_type: { id: segmentTech.id } })), { team: { id: (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) || '' } }),
|
|
466
492
|
step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
|
|
467
493
|
};
|
|
468
494
|
return [4, API.brandService.updateBrandInfo(brandReqBody_1)];
|
|
469
495
|
case 3:
|
|
470
|
-
brand_1 =
|
|
496
|
+
brand_1 = _g.sent();
|
|
471
497
|
thunkApi.dispatch(updateLeadSuccess());
|
|
472
498
|
thunkApi.dispatch(handleNextScreenStep());
|
|
473
|
-
(
|
|
499
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, params);
|
|
474
500
|
return [2, { response: brand_1, formData: params }];
|
|
475
501
|
case 4:
|
|
476
502
|
brandNameBody = {
|
|
@@ -489,24 +515,24 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
489
515
|
};
|
|
490
516
|
return [4, API.leadService.updateLead(payload)];
|
|
491
517
|
case 5:
|
|
492
|
-
lead =
|
|
518
|
+
lead = _g.sent();
|
|
493
519
|
if (!lead.brand) {
|
|
494
520
|
console.error('Internal server error: brand is not created');
|
|
495
521
|
throw new Error('Internal server error');
|
|
496
522
|
}
|
|
497
523
|
brandReqBody = {
|
|
498
|
-
id: ((
|
|
524
|
+
id: ((_d = lead.brand) === null || _d === void 0 ? void 0 : _d.id) || '',
|
|
499
525
|
channel_services: channel_services,
|
|
500
526
|
term: ['general'],
|
|
501
527
|
step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO,
|
|
502
|
-
segment: {
|
|
528
|
+
segment: __assign(__assign(__assign(__assign({}, ((segmentLocation === null || segmentLocation === void 0 ? void 0 : segmentLocation.id) && { location_type: { id: segmentLocation.id } })), ((segmentProfit === null || segmentProfit === void 0 ? void 0 : segmentProfit.id) && { profit_type: { id: segmentProfit.id } })), ((segmentTech === null || segmentTech === void 0 ? void 0 : segmentTech.id) && { tech_type: { id: segmentTech.id } })), { team: { id: (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) || '' } })
|
|
503
529
|
};
|
|
504
530
|
return [4, API.brandService.updateBrandInfo(brandReqBody)];
|
|
505
531
|
case 6:
|
|
506
|
-
brand =
|
|
532
|
+
brand = _g.sent();
|
|
507
533
|
thunkApi.dispatch(updateLeadSuccess());
|
|
508
534
|
thunkApi.dispatch(handleNextScreenStep());
|
|
509
|
-
(
|
|
535
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, params);
|
|
510
536
|
return [2, { response: brand, formData: params }];
|
|
511
537
|
}
|
|
512
538
|
});
|
|
@@ -616,7 +642,9 @@ var initialState = {
|
|
|
616
642
|
brandData: {
|
|
617
643
|
brandName: '',
|
|
618
644
|
salesChannels: [],
|
|
619
|
-
|
|
645
|
+
segmentLocation: undefined,
|
|
646
|
+
segmentProfit: undefined,
|
|
647
|
+
segmentTech: undefined,
|
|
620
648
|
teamSize: undefined,
|
|
621
649
|
termAndConditionChecked: false,
|
|
622
650
|
selectedBrandItem: {},
|
|
@@ -825,10 +853,10 @@ export var connectSlice = createSlice({
|
|
|
825
853
|
state.error = action.error.message;
|
|
826
854
|
})
|
|
827
855
|
.addCase(updateLeadIndividual.fulfilled, function (state, action) {
|
|
828
|
-
var _a, _b, _c;
|
|
856
|
+
var _a, _b, _c, _d, _e, _f;
|
|
829
857
|
state.loading = false;
|
|
830
858
|
state.error = null;
|
|
831
|
-
var
|
|
859
|
+
var _g = action.payload, formData = _g.formData, leadResponse = _g.leadResponse;
|
|
832
860
|
var brand = leadResponse.brand, rest = __rest(leadResponse, ["brand"]);
|
|
833
861
|
if (brand) {
|
|
834
862
|
var channel_services = brand.channel_services, terms = brand.terms;
|
|
@@ -841,10 +869,17 @@ export var connectSlice = createSlice({
|
|
|
841
869
|
}
|
|
842
870
|
var selectedBrand = ((_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0]) || leadResponse.brand;
|
|
843
871
|
state.data.brandData.brandName = (_c = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.name) === null || _c === void 0 ? void 0 : _c.en;
|
|
844
|
-
state.data.brandData.
|
|
845
|
-
var
|
|
846
|
-
|
|
847
|
-
|
|
872
|
+
state.data.brandData.segmentLocation = (_d = rest.segment_location_list) === null || _d === void 0 ? void 0 : _d.find(function (location) {
|
|
873
|
+
var _a, _b;
|
|
874
|
+
return location.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.location_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
875
|
+
});
|
|
876
|
+
state.data.brandData.segmentProfit = (_e = rest.segment_profit_list) === null || _e === void 0 ? void 0 : _e.find(function (profit) {
|
|
877
|
+
var _a, _b;
|
|
878
|
+
return profit.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.profit_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
879
|
+
});
|
|
880
|
+
state.data.brandData.segmentTech = (_f = rest.segment_tech_list) === null || _f === void 0 ? void 0 : _f.find(function (tech) {
|
|
881
|
+
var _a, _b;
|
|
882
|
+
return tech.id === ((_b = (_a = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _a === void 0 ? void 0 : _a.tech_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
848
883
|
});
|
|
849
884
|
state.data.brandData.teamSize = rest.team_size_list.find(function (_a) {
|
|
850
885
|
var _b, _c;
|
|
@@ -861,6 +896,18 @@ export var connectSlice = createSlice({
|
|
|
861
896
|
.addCase(updateLeadIndividual.rejected, function (state, action) {
|
|
862
897
|
state.loading = false;
|
|
863
898
|
state.error = action.error.message;
|
|
899
|
+
})
|
|
900
|
+
.addCase(retrieveSegmentDataList.pending, function (state) {
|
|
901
|
+
state.loading = true;
|
|
902
|
+
state.error = null;
|
|
903
|
+
})
|
|
904
|
+
.addCase(retrieveSegmentDataList.fulfilled, function (state) {
|
|
905
|
+
state.loading = false;
|
|
906
|
+
state.error = null;
|
|
907
|
+
})
|
|
908
|
+
.addCase(retrieveSegmentDataList.rejected, function (state, action) {
|
|
909
|
+
state.loading = false;
|
|
910
|
+
state.error = action.error.message;
|
|
864
911
|
})
|
|
865
912
|
.addCase(updateLeadBrand.fulfilled, function (state, action) {
|
|
866
913
|
state.loading = false;
|
|
@@ -37,7 +37,6 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
37
37
|
}); });
|
|
38
38
|
var ListType;
|
|
39
39
|
(function (ListType) {
|
|
40
|
-
ListType["SegmentsList"] = "SegmentsList";
|
|
41
40
|
ListType["TeamSizeList"] = "TeamSizeList";
|
|
42
41
|
ListType["SegmentLocationList"] = "SegmentLocationList";
|
|
43
42
|
ListType["SegmentProfitList"] = "SegmentProfitList";
|
|
@@ -49,7 +49,7 @@ var BrandList = function (_a) {
|
|
|
49
49
|
var t = useTranslation().t;
|
|
50
50
|
var isAr = useLanguage().isAr;
|
|
51
51
|
var data = useAppSelector(connectSelector).data;
|
|
52
|
-
var _c = data.individualData.responseBody || {},
|
|
52
|
+
var _c = data.individualData.responseBody || {}, segment_location_list = _c.segment_location_list, segment_profit_list = _c.segment_profit_list, segment_tech_list = _c.segment_tech_list, team_size_list = _c.team_size_list;
|
|
53
53
|
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
54
54
|
var selectedBrandControl = useController({ control: control, name: 'selectedBrandItem' });
|
|
55
55
|
var selectedBrand = selectedBrandControl.field.value;
|
|
@@ -82,10 +82,20 @@ var BrandList = function (_a) {
|
|
|
82
82
|
setValue('salesChannels', [], { shouldValidate: true });
|
|
83
83
|
setValue('brandName', '');
|
|
84
84
|
}
|
|
85
|
-
setValue('
|
|
85
|
+
setValue('segmentLocation', segment_location_list.find(function (_a) {
|
|
86
86
|
var _b, _c;
|
|
87
87
|
var id = _a.id;
|
|
88
|
-
return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.
|
|
88
|
+
return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.location_type) === null || _c === void 0 ? void 0 : _c.id) === id;
|
|
89
|
+
}), { shouldValidate: true });
|
|
90
|
+
setValue('segmentProfit', segment_profit_list.find(function (_a) {
|
|
91
|
+
var _b, _c;
|
|
92
|
+
var id = _a.id;
|
|
93
|
+
return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.profit_type) === null || _c === void 0 ? void 0 : _c.id) === id;
|
|
94
|
+
}), { shouldValidate: true });
|
|
95
|
+
setValue('segmentTech', segment_tech_list.find(function (_a) {
|
|
96
|
+
var _b, _c;
|
|
97
|
+
var id = _a.id;
|
|
98
|
+
return ((_c = (_b = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _b === void 0 ? void 0 : _b.tech_type) === null || _c === void 0 ? void 0 : _c.id) === id;
|
|
89
99
|
}), { shouldValidate: true });
|
|
90
100
|
setValue('teamSize', team_size_list.find(function (_a) {
|
|
91
101
|
var _b, _c;
|
|
@@ -29,10 +29,14 @@ import BrandName from './BrandName';
|
|
|
29
29
|
import TAC from './TAC';
|
|
30
30
|
import BrandList from './BrandList';
|
|
31
31
|
import SalesChannels from './SalesChannels';
|
|
32
|
-
import
|
|
32
|
+
import SegmentLocations from './SegmentLocations';
|
|
33
|
+
import SegmentProfits from './SegmentProfits';
|
|
34
|
+
import SegmentTechs from './SegmentTechs';
|
|
33
35
|
var ListType;
|
|
34
36
|
(function (ListType) {
|
|
35
|
-
ListType["
|
|
37
|
+
ListType["SegmentLocationList"] = "SegmentLocationList";
|
|
38
|
+
ListType["SegmentProfitList"] = "SegmentProfitList";
|
|
39
|
+
ListType["SegmentTechList"] = "SegmentTechList";
|
|
36
40
|
ListType["TeamSizeList"] = "TeamSizeList";
|
|
37
41
|
ListType["BrandList"] = "BrandList";
|
|
38
42
|
ListType["BusinessList"] = "BusinessList";
|
|
@@ -42,7 +46,7 @@ var Merchant = function (_a) {
|
|
|
42
46
|
var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
|
|
43
47
|
var _e = React.useState(false), isRequiredNewBrand = _e[0], setIsRequiredNewBrand = _e[1];
|
|
44
48
|
var _f = useAppSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error;
|
|
45
|
-
var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels,
|
|
49
|
+
var _g = data.brandData, brandName = _g.brandName, selectedBrandItem = _g.selectedBrandItem, termAndConditionChecked = _g.termAndConditionChecked, responseBody = _g.responseBody, salesChannels = _g.salesChannels, segmentLocation = _g.segmentLocation, segmentProfit = _g.segmentProfit, segmentTech = _g.segmentTech, teamSize = _g.teamSize;
|
|
46
50
|
var brandList = (responseBody || {}).brand_list;
|
|
47
51
|
var _h = React.useState(), listActive = _h[0], setListActive = _h[1];
|
|
48
52
|
React.useEffect(function () {
|
|
@@ -59,7 +63,9 @@ var Merchant = function (_a) {
|
|
|
59
63
|
selectedBrandItem: selectedBrandItem,
|
|
60
64
|
termAndConditionChecked: termAndConditionChecked,
|
|
61
65
|
salesChannels: salesChannels,
|
|
62
|
-
|
|
66
|
+
segmentLocation: segmentLocation,
|
|
67
|
+
segmentProfit: segmentProfit,
|
|
68
|
+
segmentTech: segmentTech,
|
|
63
69
|
teamSize: teamSize
|
|
64
70
|
},
|
|
65
71
|
mode: 'onChange'
|
|
@@ -75,11 +81,13 @@ var Merchant = function (_a) {
|
|
|
75
81
|
dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
76
82
|
};
|
|
77
83
|
React.useEffect(function () {
|
|
78
|
-
methods.setValue('
|
|
84
|
+
methods.setValue('segmentLocation', segmentLocation);
|
|
85
|
+
methods.setValue('segmentProfit', segmentProfit);
|
|
86
|
+
methods.setValue('segmentTech', segmentTech);
|
|
79
87
|
methods.setValue('teamSize', teamSize);
|
|
80
88
|
if (brandName)
|
|
81
89
|
methods.trigger('brandName');
|
|
82
|
-
}, [
|
|
90
|
+
}, [segmentLocation, segmentProfit, segmentTech, teamSize, brandName]);
|
|
83
91
|
React.useEffect(function () {
|
|
84
92
|
if (error)
|
|
85
93
|
dispatch(clearError());
|
|
@@ -103,9 +111,11 @@ var Merchant = function (_a) {
|
|
|
103
111
|
var handleMenuClick = function (flag) {
|
|
104
112
|
setListActive(flag);
|
|
105
113
|
};
|
|
106
|
-
var
|
|
114
|
+
var isSegmentLocationListActive = listActive === ListType.SegmentLocationList;
|
|
115
|
+
var isSegmentProfitListActive = listActive === ListType.SegmentProfitList;
|
|
116
|
+
var isSegmentTechListActive = listActive === ListType.SegmentTechList;
|
|
107
117
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
108
118
|
var isBrandListActive = listActive === ListType.BrandList;
|
|
109
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !
|
|
119
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: hasBrandList && !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive, list: brandList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SegmentLocations, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentProfits, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentLocationListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentProfitList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(SegmentTechs, { show: !isTeamSizeListActive && !isBrandListActive && !isSegmentLocationListActive && !isSegmentProfitListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentTechList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(TeamSize, { show: !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive && !isBrandListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !listActive }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
110
120
|
};
|
|
111
121
|
export default React.memo(Merchant);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface SegmentLocationsProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onListOpen?: () => void;
|
|
5
|
+
onListClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const SegmentLocations: ({ show, onListOpen, onListClose }: SegmentLocationsProps) => JSX.Element;
|
|
8
|
+
export default SegmentLocations;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
27
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
30
|
+
});
|
|
31
|
+
var SegmentLocations = function (_a) {
|
|
32
|
+
var _b, _c, _d, _e;
|
|
33
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
34
|
+
var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
|
|
35
|
+
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var isAr = useLanguage().isAr;
|
|
38
|
+
var data = useAppSelector(connectSelector).data;
|
|
39
|
+
var control = useFormContext().control;
|
|
40
|
+
var segmentLocationList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_location_list) || [];
|
|
41
|
+
var segmentControl = useController({ control: control, name: 'segmentLocation' });
|
|
42
|
+
var segment = segmentControl.field.value;
|
|
43
|
+
var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
if ((segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.length) > 0) {
|
|
46
|
+
setSegmentList(segmentLocationList);
|
|
47
|
+
}
|
|
48
|
+
}, [segmentLocationList]);
|
|
49
|
+
var onOpenList = function (event) {
|
|
50
|
+
setAnchorEl(event.currentTarget);
|
|
51
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
52
|
+
};
|
|
53
|
+
var onCloseList = function () {
|
|
54
|
+
setAnchorEl(null);
|
|
55
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
56
|
+
};
|
|
57
|
+
var onSelectItem = function (segment) {
|
|
58
|
+
onCloseList();
|
|
59
|
+
segmentControl.field.onChange(segment);
|
|
60
|
+
};
|
|
61
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputSelect, { required: true, label: t('segment_location_title'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIcon, {})] }));
|
|
64
|
+
} }) }))] })) })));
|
|
65
|
+
};
|
|
66
|
+
export default SegmentLocations;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface SegmentProfitsProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onListOpen?: () => void;
|
|
5
|
+
onListClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const SegmentProfits: ({ show, onListOpen, onListClose }: SegmentProfitsProps) => JSX.Element;
|
|
8
|
+
export default SegmentProfits;
|
|
@@ -10,25 +10,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { connectSelector } from '../../../app/connect/connectStore';
|
|
14
|
-
import Collapse from '../../../../components/Collapse';
|
|
15
|
-
import { ScreenContainer } from '../../../../features/shared/Containers';
|
|
16
|
-
import InputSelect from '../../../../features/shared/InputSelect';
|
|
17
|
-
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
18
13
|
import React from 'react';
|
|
19
14
|
import { useTranslation } from 'react-i18next';
|
|
20
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
21
|
-
import SimpleList from '../../../../components/SimpleList';
|
|
22
|
-
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
23
|
-
import CheckIcon from '../../../shared/CheckIcon';
|
|
24
16
|
import Box from '@mui/material/Box';
|
|
25
17
|
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
26
20
|
import Text from '../../../../components/Text';
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
27
27
|
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
28
|
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
29
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
30
30
|
});
|
|
31
|
-
var
|
|
31
|
+
var SegmentProfits = function (_a) {
|
|
32
32
|
var _b, _c, _d, _e;
|
|
33
33
|
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
34
34
|
var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
|
|
@@ -37,15 +37,15 @@ var Segments = function (_a) {
|
|
|
37
37
|
var isAr = useLanguage().isAr;
|
|
38
38
|
var data = useAppSelector(connectSelector).data;
|
|
39
39
|
var control = useFormContext().control;
|
|
40
|
-
var
|
|
41
|
-
var segmentControl = useController({ control: control, name: '
|
|
40
|
+
var segmentProfitList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_profit_list) || [];
|
|
41
|
+
var segmentControl = useController({ control: control, name: 'segmentProfit' });
|
|
42
42
|
var segment = segmentControl.field.value;
|
|
43
43
|
var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
44
44
|
React.useEffect(function () {
|
|
45
|
-
if ((
|
|
46
|
-
setSegmentList(
|
|
45
|
+
if ((segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.length) > 0) {
|
|
46
|
+
setSegmentList(segmentProfitList);
|
|
47
47
|
}
|
|
48
|
-
}, [
|
|
48
|
+
}, [segmentProfitList]);
|
|
49
49
|
var onOpenList = function (event) {
|
|
50
50
|
setAnchorEl(event.currentTarget);
|
|
51
51
|
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
@@ -58,9 +58,9 @@ var Segments = function (_a) {
|
|
|
58
58
|
onCloseList();
|
|
59
59
|
segmentControl.field.onChange(segment);
|
|
60
60
|
};
|
|
61
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputSelect, { required: true, label: t('
|
|
61
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputSelect, { required: true, label: t('segment_profit_title'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
62
62
|
var _a, _b;
|
|
63
63
|
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIcon, {})] }));
|
|
64
64
|
} }) }))] })) })));
|
|
65
65
|
};
|
|
66
|
-
export default
|
|
66
|
+
export default SegmentProfits;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface SegmentTechsProps {
|
|
3
|
+
show: boolean;
|
|
4
|
+
onListOpen?: () => void;
|
|
5
|
+
onListClose?: () => void;
|
|
6
|
+
}
|
|
7
|
+
declare const SegmentTechs: ({ show, onListOpen, onListClose }: SegmentTechsProps) => JSX.Element;
|
|
8
|
+
export default SegmentTechs;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
20
|
+
import Text from '../../../../components/Text';
|
|
21
|
+
import Collapse from '../../../../components/Collapse';
|
|
22
|
+
import { EndAdornmentExpanded } from '../../../shared/EndAdornment';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import InputSelect from '../../../shared/InputSelect';
|
|
25
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
26
|
+
import { connectSelector } from '../../../app/connect/connectStore';
|
|
27
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
28
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
29
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
|
|
30
|
+
});
|
|
31
|
+
var SegmentTechs = function (_a) {
|
|
32
|
+
var _b, _c, _d, _e;
|
|
33
|
+
var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
|
|
34
|
+
var _f = React.useState([]), segmentList = _f[0], setSegmentList = _f[1];
|
|
35
|
+
var _g = React.useState(null), anchorEl = _g[0], setAnchorEl = _g[1];
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var isAr = useLanguage().isAr;
|
|
38
|
+
var data = useAppSelector(connectSelector).data;
|
|
39
|
+
var control = useFormContext().control;
|
|
40
|
+
var segmentTechList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.segment_tech_list) || [];
|
|
41
|
+
var segmentControl = useController({ control: control, name: 'segmentTech' });
|
|
42
|
+
var segment = segmentControl.field.value;
|
|
43
|
+
var error = (_c = segmentControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
if ((segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.length) > 0) {
|
|
46
|
+
setSegmentList(segmentTechList);
|
|
47
|
+
}
|
|
48
|
+
}, [segmentTechList]);
|
|
49
|
+
var onOpenList = function (event) {
|
|
50
|
+
setAnchorEl(event.currentTarget);
|
|
51
|
+
onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
|
|
52
|
+
};
|
|
53
|
+
var onCloseList = function () {
|
|
54
|
+
setAnchorEl(null);
|
|
55
|
+
onListClose === null || onListClose === void 0 ? void 0 : onListClose();
|
|
56
|
+
};
|
|
57
|
+
var onSelectItem = function (segment) {
|
|
58
|
+
onCloseList();
|
|
59
|
+
segmentControl.field.onChange(segment);
|
|
60
|
+
};
|
|
61
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputSelect, { required: true, label: t('segment_tech_title'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(EndAdornmentExpanded, { anchorEl: anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIcon, {})] }));
|
|
64
|
+
} }) }))] })) })));
|
|
65
|
+
};
|
|
66
|
+
export default SegmentTechs;
|
|
@@ -9,7 +9,9 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
9
9
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
10
10
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
11
|
}>>[] | undefined>;
|
|
12
|
-
|
|
12
|
+
segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
13
|
+
segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
14
|
+
segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
13
15
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
14
16
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
15
17
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -22,7 +24,9 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
22
24
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
23
25
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
24
26
|
}>>[] | undefined>;
|
|
25
|
-
|
|
27
|
+
segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
28
|
+
segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
29
|
+
segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
26
30
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
27
31
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
28
32
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -35,7 +39,9 @@ export declare const MerchantValidationSchema: (isNewBrand?: boolean) => yup.Obj
|
|
|
35
39
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
36
40
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
37
41
|
}>>[] | undefined>;
|
|
38
|
-
|
|
42
|
+
segmentLocation: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
43
|
+
segmentProfit: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
44
|
+
segmentTech: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
39
45
|
teamSize: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
40
46
|
brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
47
|
}>>>;
|
|
@@ -86,7 +86,9 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
86
86
|
})
|
|
87
87
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
88
88
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
89
|
-
|
|
89
|
+
segmentLocation: yup.object().required('alert_choose_segment_location'),
|
|
90
|
+
segmentProfit: yup.object().required('alert_choose_segment_profit'),
|
|
91
|
+
segmentTech: yup.object().required('alert_choose_segment_tech'),
|
|
90
92
|
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
91
93
|
salesChannels: yup
|
|
92
94
|
.array()
|
|
@@ -128,7 +130,9 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
128
130
|
}
|
|
129
131
|
})
|
|
130
132
|
.required('choose_atleast_one_channel'),
|
|
131
|
-
|
|
133
|
+
segmentLocation: yup.object().required('alert_choose_segment_location'),
|
|
134
|
+
segmentProfit: yup.object().required('alert_choose_segment_profit'),
|
|
135
|
+
segmentTech: yup.object().required('alert_choose_segment_tech'),
|
|
132
136
|
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
133
137
|
brandName: yup.string().optional()
|
|
134
138
|
});
|
package/package.json
CHANGED