@tap-payments/auth-jsconnect 2.4.70-test → 2.4.71-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 +1 -0
- package/build/@types/form.d.ts +6 -3
- package/build/assets/locales/ar.json +3 -3
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +13 -6
- package/build/features/app/brand/brandStore.d.ts +19 -9
- package/build/features/app/brand/brandStore.js +141 -126
- package/build/features/app/connect/connectStore.d.ts +4 -4
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +14 -51
- package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +1 -2
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +2 -14
- package/build/features/brand/screens/BrandInfo/BrandName.d.ts +1 -2
- package/build/features/brand/screens/BrandInfo/BrandName.js +2 -3
- package/build/features/brand/screens/BrandInfo/validation.d.ts +0 -12
- package/build/features/brand/screens/BrandInfo/validation.js +0 -4
- package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.d.ts +5 -0
- package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +102 -0
- package/build/features/brand/screens/BrandSegmentInfo/index.d.ts +2 -0
- package/build/features/brand/screens/BrandSegmentInfo/index.js +2 -0
- package/build/features/brand/screens/BrandSegmentInfo/validation.d.ts +17 -0
- package/build/features/brand/screens/BrandSegmentInfo/validation.js +9 -0
- package/build/features/featuresScreens.js +5 -0
- package/package.json +1 -1
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentLocations.d.ts +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentLocations.js +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentProfits.d.ts +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentProfits.js +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentTechs.d.ts +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/SegmentTechs.js +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/TeamSize.d.ts +0 -0
- /package/build/features/brand/screens/{BrandInfo → BrandSegmentInfo}/TeamSize.js +0 -0
package/build/@types/app.d.ts
CHANGED
package/build/@types/form.d.ts
CHANGED
|
@@ -31,14 +31,17 @@ export type IndividualFormValues = {
|
|
|
31
31
|
export type BrandFormValues = {
|
|
32
32
|
brandName: string;
|
|
33
33
|
brandLogoId?: string;
|
|
34
|
+
salesChannels: Array<SaleChannel>;
|
|
35
|
+
termAndConditionChecked?: boolean;
|
|
36
|
+
selectedBrandItem: BrandInfo;
|
|
37
|
+
};
|
|
38
|
+
export type BrandSegmentFormValues = {
|
|
34
39
|
segmentLocation?: Segment | undefined;
|
|
35
40
|
segmentProfit?: Segment | undefined;
|
|
36
41
|
segmentTech?: Segment | undefined;
|
|
37
42
|
teamSize?: TeamSize | undefined;
|
|
38
|
-
salesChannels: Array<SaleChannel>;
|
|
39
|
-
termAndConditionChecked?: boolean;
|
|
40
|
-
selectedBrandItem: BrandInfo;
|
|
41
43
|
};
|
|
44
|
+
export type ConnectBrandFormValues = BrandFormValues & BrandSegmentFormValues;
|
|
42
45
|
export type BrandActivitiesFormValues = {
|
|
43
46
|
activities: Array<Activity>;
|
|
44
47
|
customerLocations: Array<CustomerLocation>;
|
|
@@ -409,9 +409,9 @@
|
|
|
409
409
|
"physical_store_label": "متجر",
|
|
410
410
|
"social_media_label": "وسائل التواصل الاجتماعي",
|
|
411
411
|
"selected_activities": "اختر الأنشطة",
|
|
412
|
-
"
|
|
413
|
-
"
|
|
414
|
-
"
|
|
412
|
+
"segment_location_title": "الموقع",
|
|
413
|
+
"segment_tech_title": "التقنية",
|
|
414
|
+
"segment_profit_title": "الربح",
|
|
415
415
|
"alert_choose_segment_location": "يُرجى تحديد الموقع",
|
|
416
416
|
"alert_choose_segment_profit": "يُرجى تحديد الربح",
|
|
417
417
|
"alert_choose_segment_tech": "الرجاء تحديد التقنية"
|
package/build/constants/app.d.ts
CHANGED
package/build/constants/app.js
CHANGED
|
@@ -501,33 +501,39 @@ export var BRAND_SCREENS_NAVIGATION = [
|
|
|
501
501
|
},
|
|
502
502
|
{
|
|
503
503
|
name: 'BRAND_INFO_STEP',
|
|
504
|
-
next: '
|
|
504
|
+
next: 'BRAND_SEGMENT_INFO_STEP',
|
|
505
505
|
prev: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
506
506
|
order: 2
|
|
507
507
|
},
|
|
508
508
|
{
|
|
509
|
-
name: '
|
|
510
|
-
next: '
|
|
509
|
+
name: 'BRAND_SEGMENT_INFO_STEP',
|
|
510
|
+
next: 'BRAND_ACTIVITIES_STEP',
|
|
511
511
|
prev: 'BRAND_INFO_STEP',
|
|
512
512
|
order: 3
|
|
513
513
|
},
|
|
514
|
+
{
|
|
515
|
+
name: 'BRAND_ACTIVITIES_STEP',
|
|
516
|
+
next: 'BRAND_DETAILS_SUCCESS_STEP',
|
|
517
|
+
prev: 'BRAND_SEGMENT_INFO_STEP',
|
|
518
|
+
order: 4
|
|
519
|
+
},
|
|
514
520
|
{
|
|
515
521
|
name: 'BRAND_DETAILS_SUCCESS_STEP',
|
|
516
522
|
next: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
517
523
|
prev: 'BRAND_ACTIVITIES_STEP',
|
|
518
|
-
order:
|
|
524
|
+
order: 5
|
|
519
525
|
},
|
|
520
526
|
{
|
|
521
527
|
name: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
522
528
|
next: 'BRAND_RESET_PASSWORD_SUCCESS',
|
|
523
529
|
prev: '',
|
|
524
|
-
order:
|
|
530
|
+
order: 6
|
|
525
531
|
},
|
|
526
532
|
{
|
|
527
533
|
name: 'BRAND_RESET_PASSWORD_SUCCESS',
|
|
528
534
|
next: '',
|
|
529
535
|
prev: 'BRAND_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
530
|
-
order:
|
|
536
|
+
order: 6
|
|
531
537
|
}
|
|
532
538
|
];
|
|
533
539
|
export var DefaultDeviceInfo = {
|
|
@@ -661,6 +667,7 @@ export var ENTITY_STEP_NAMES = {
|
|
|
661
667
|
export var BRAND_STEP_NAMES = {
|
|
662
668
|
PHONE_AUTH: 'brand_phone_auth',
|
|
663
669
|
BRAND_INFO: 'brand_info',
|
|
670
|
+
BRAND_SEGMENT_INFO: 'brand_segment_info',
|
|
664
671
|
BRAND_ACTIVITIES: 'brand_activities',
|
|
665
672
|
BRAND_SUCCESS: 'brand_completed'
|
|
666
673
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, AsyncThunkParams, BrandActivitiesFormValues, BrandFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, AsyncThunkParams, BrandActivitiesFormValues, BrandFormValues, BrandSegmentFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
interface VerifyLeadTokenProps {
|
|
5
5
|
token: string;
|
|
@@ -21,10 +21,6 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
21
21
|
notification: any;
|
|
22
22
|
};
|
|
23
23
|
salesChannels: any;
|
|
24
|
-
teamSizeList: any;
|
|
25
|
-
segmentLocationList: any;
|
|
26
|
-
segmentProfitList: any;
|
|
27
|
-
segmentTechList: any;
|
|
28
24
|
token: string;
|
|
29
25
|
}, VerifyLeadTokenProps, {
|
|
30
26
|
state?: unknown;
|
|
@@ -64,10 +60,6 @@ export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
64
60
|
notification: any;
|
|
65
61
|
};
|
|
66
62
|
salesChannels: any;
|
|
67
|
-
teamSizeList: any;
|
|
68
|
-
segmentLocationList: any;
|
|
69
|
-
segmentProfitList: any;
|
|
70
|
-
segmentTechList: any;
|
|
71
63
|
formData: OTPFormValues;
|
|
72
64
|
}, OTPFormValues, {
|
|
73
65
|
state?: unknown;
|
|
@@ -139,6 +131,10 @@ export declare const checkBrandNameAvailability: import("@reduxjs/toolkit").Asyn
|
|
|
139
131
|
export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
140
132
|
data: any;
|
|
141
133
|
formData: Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">;
|
|
134
|
+
teamSizeList: any;
|
|
135
|
+
segmentLocationList: any;
|
|
136
|
+
segmentProfitList: any;
|
|
137
|
+
segmentTechList: any;
|
|
142
138
|
}, AsyncThunkParams<Omit<BrandFormValues, "termAndConditionChecked" | "selectedBrandItem">>, {
|
|
143
139
|
state?: unknown;
|
|
144
140
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -149,6 +145,19 @@ export declare const updateBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
149
145
|
fulfilledMeta?: unknown;
|
|
150
146
|
rejectedMeta?: unknown;
|
|
151
147
|
}>;
|
|
148
|
+
export declare const updateSegmentBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
149
|
+
data: any;
|
|
150
|
+
formData: BrandSegmentFormValues;
|
|
151
|
+
}, AsyncThunkParams<BrandSegmentFormValues>, {
|
|
152
|
+
state?: unknown;
|
|
153
|
+
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
154
|
+
extra?: unknown;
|
|
155
|
+
rejectValue?: unknown;
|
|
156
|
+
serializedErrorType?: unknown;
|
|
157
|
+
pendingMeta?: unknown;
|
|
158
|
+
fulfilledMeta?: unknown;
|
|
159
|
+
rejectedMeta?: unknown;
|
|
160
|
+
}>;
|
|
152
161
|
export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
153
162
|
leadId: string;
|
|
154
163
|
}, {
|
|
@@ -209,6 +218,7 @@ export interface BrandData {
|
|
|
209
218
|
verify: ResponseData & VerifyData;
|
|
210
219
|
otpData: OTPFormValues & ResponseData;
|
|
211
220
|
brandData: Omit<BrandFormValues, 'selectedBrandItem' | 'termAndConditionChecked'> & ResponseData;
|
|
221
|
+
brandSegmentData: BrandSegmentFormValues & ResponseData;
|
|
212
222
|
brandActivities: BrandActivitiesFormValues & ResponseData;
|
|
213
223
|
flowName: FlowsTypes;
|
|
214
224
|
}
|
|
@@ -66,10 +66,10 @@ 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,
|
|
70
|
-
var _f, _g, _h
|
|
71
|
-
return __generator(this, function (
|
|
72
|
-
switch (
|
|
69
|
+
var payload, data, countryIso2, _b, board_id, board_info_id, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
|
|
70
|
+
var _e, _f, _g, _h;
|
|
71
|
+
return __generator(this, function (_j) {
|
|
72
|
+
switch (_j.label) {
|
|
73
73
|
case 0:
|
|
74
74
|
payload = {
|
|
75
75
|
service_name: 'tap_email',
|
|
@@ -77,7 +77,7 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
77
77
|
};
|
|
78
78
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
79
79
|
case 1:
|
|
80
|
-
data = (
|
|
80
|
+
data = (_j.sent()).data;
|
|
81
81
|
if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
|
|
82
82
|
throw new Error(data.errors[0].description);
|
|
83
83
|
}
|
|
@@ -91,42 +91,33 @@ 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, 7];
|
|
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:
|
|
98
|
-
boardInfoData =
|
|
99
|
-
|
|
98
|
+
boardInfoData = _j.sent();
|
|
99
|
+
_j.label = 3;
|
|
100
100
|
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
101
101
|
case 4:
|
|
102
|
-
boardData =
|
|
103
|
-
_c = ((
|
|
102
|
+
boardData = _j.sent();
|
|
103
|
+
_c = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
|
|
104
104
|
serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
|
|
105
105
|
return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
|
|
106
106
|
case 5:
|
|
107
|
-
_d =
|
|
107
|
+
_d = _j.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
|
|
108
108
|
boardData = boardRes;
|
|
109
109
|
individualData = individualRes;
|
|
110
110
|
if (!countryIso2) {
|
|
111
|
-
countryIso2 = (
|
|
111
|
+
countryIso2 = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
112
112
|
if (countryIso2)
|
|
113
113
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
114
114
|
}
|
|
115
|
-
return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
|
|
116
|
-
case 6:
|
|
117
|
-
_e = _k.sent(), segmentLocation = _e.segmentLocation, segmentProfit = _e.segmentProfit, segmentTech = _e.segmentTech;
|
|
118
|
-
segmentLocationList = segmentLocation;
|
|
119
|
-
segmentProfitList = segmentProfit;
|
|
120
|
-
segmentTechList = segmentTech;
|
|
121
115
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
122
|
-
case
|
|
123
|
-
salesChannels =
|
|
124
|
-
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
125
|
-
case 8:
|
|
126
|
-
teamSizeList = _k.sent();
|
|
116
|
+
case 6:
|
|
117
|
+
salesChannels = _j.sent();
|
|
127
118
|
thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP'));
|
|
128
|
-
|
|
129
|
-
case
|
|
119
|
+
_j.label = 7;
|
|
120
|
+
case 7: return [2, {
|
|
130
121
|
data: data,
|
|
131
122
|
individualData: individualData,
|
|
132
123
|
boardResponse: {
|
|
@@ -135,17 +126,13 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
135
126
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
136
127
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
137
128
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
138
|
-
name: (
|
|
139
|
-
contact: (
|
|
129
|
+
name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
|
|
130
|
+
contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
|
|
140
131
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
141
132
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
142
133
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
143
134
|
},
|
|
144
135
|
salesChannels: salesChannels,
|
|
145
|
-
teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
|
|
146
|
-
segmentLocationList: segmentLocationList,
|
|
147
|
-
segmentProfitList: segmentProfitList,
|
|
148
|
-
segmentTechList: segmentTechList,
|
|
149
136
|
token: token
|
|
150
137
|
}];
|
|
151
138
|
}
|
|
@@ -170,24 +157,24 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
170
157
|
});
|
|
171
158
|
}); });
|
|
172
159
|
export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
|
-
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes,
|
|
174
|
-
var _f, _g, _h, _j, _k, _l
|
|
175
|
-
return __generator(this, function (
|
|
176
|
-
switch (
|
|
160
|
+
var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, salesChannels;
|
|
161
|
+
var _e, _f, _g, _h, _j, _k, _l;
|
|
162
|
+
return __generator(this, function (_m) {
|
|
163
|
+
switch (_m.label) {
|
|
177
164
|
case 0:
|
|
178
165
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
179
166
|
responseBody = brand.data.verify.responseBody;
|
|
180
167
|
payload = {
|
|
181
168
|
data: params.otp,
|
|
182
|
-
service_name: (
|
|
169
|
+
service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
|
|
183
170
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
184
171
|
step_name: BRAND_STEP_NAMES.PHONE_AUTH,
|
|
185
172
|
encryption_contract: ['data']
|
|
186
173
|
};
|
|
187
174
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
188
175
|
case 1:
|
|
189
|
-
data = (
|
|
190
|
-
if ((
|
|
176
|
+
data = (_m.sent()).data;
|
|
177
|
+
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
191
178
|
throw new Error(data.errors[0].description);
|
|
192
179
|
_b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
193
180
|
if (!board_id) {
|
|
@@ -197,28 +184,22 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
197
184
|
if (!board_info_id) return [3, 3];
|
|
198
185
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
199
186
|
case 2:
|
|
200
|
-
boardInfoData =
|
|
201
|
-
|
|
187
|
+
boardInfoData = _m.sent();
|
|
188
|
+
_m.label = 3;
|
|
202
189
|
case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
203
190
|
case 4:
|
|
204
|
-
boardData =
|
|
205
|
-
_c = ((
|
|
191
|
+
boardData = _m.sent();
|
|
192
|
+
_c = ((_g = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _g === void 0 ? void 0 : _g.recipient) || {}, id = _c.id, type = _c.type;
|
|
206
193
|
serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
|
|
207
194
|
return [4, retrieveIndividualData(type, boardData, serviceCallBack)];
|
|
208
195
|
case 5:
|
|
209
|
-
_d =
|
|
196
|
+
_d = _m.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
|
|
210
197
|
boardData = boardRes;
|
|
211
198
|
individualData = individualRes;
|
|
212
|
-
(
|
|
213
|
-
return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
|
|
214
|
-
case 6:
|
|
215
|
-
_e = _o.sent(), segmentLocation = _e.segmentLocation, segmentProfit = _e.segmentProfit, segmentTech = _e.segmentTech;
|
|
199
|
+
(_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
|
|
216
200
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
217
|
-
case
|
|
218
|
-
salesChannels =
|
|
219
|
-
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
220
|
-
case 8:
|
|
221
|
-
teamSizeList = _o.sent();
|
|
201
|
+
case 6:
|
|
202
|
+
salesChannels = _m.sent();
|
|
222
203
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
223
204
|
return [2, {
|
|
224
205
|
data: data,
|
|
@@ -229,17 +210,13 @@ export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function
|
|
|
229
210
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
230
211
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
231
212
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
232
|
-
name: (
|
|
233
|
-
contact: (
|
|
213
|
+
name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
|
|
214
|
+
contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
|
|
234
215
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
235
216
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
236
217
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
|
|
237
218
|
},
|
|
238
219
|
salesChannels: salesChannels,
|
|
239
|
-
teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
|
|
240
|
-
segmentLocationList: segmentLocation,
|
|
241
|
-
segmentProfitList: segmentProfit,
|
|
242
|
-
segmentTechList: segmentTech,
|
|
243
220
|
formData: params
|
|
244
221
|
}];
|
|
245
222
|
}
|
|
@@ -326,8 +303,8 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
326
303
|
export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
|
|
327
304
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
328
305
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
329
|
-
var _b, settings, brand, brandRes, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable,
|
|
330
|
-
var
|
|
306
|
+
var _b, settings, brand, brandRes, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, salesChannels, brandName, brandLogoId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, _d, segmentLocation, segmentProfit, segmentTech, teamSizeList;
|
|
307
|
+
var _e, _f;
|
|
331
308
|
return __generator(this, function (_g) {
|
|
332
309
|
switch (_g.label) {
|
|
333
310
|
case 0:
|
|
@@ -337,16 +314,7 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
|
|
|
337
314
|
isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
|
|
338
315
|
isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
|
|
339
316
|
isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
|
|
340
|
-
|
|
341
|
-
isSegmentProfitNonEditable = hasNoneEditableValue(data_status, 'segment.profit_type');
|
|
342
|
-
isSegmentTechNonEditable = hasNoneEditableValue(data_status, 'segment.tech_type');
|
|
343
|
-
isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
|
|
344
|
-
salesChannels = formData.salesChannels, brandName = formData.brandName, segmentLocation = formData.segmentLocation, segmentProfit = formData.segmentProfit, segmentTech = formData.segmentTech, teamSize = formData.teamSize, brandLogoId = formData.brandLogoId;
|
|
345
|
-
segmentLocationId = isSegmentLocationNonEditable ? undefined : segmentLocation && { id: segmentLocation.id };
|
|
346
|
-
segmentProfitId = isSegmentProfitNonEditable ? undefined : segmentProfit && { id: segmentProfit.id };
|
|
347
|
-
segmentTechId = isSegmentTechNonEditable ? undefined : segmentTech && { id: segmentTech.id };
|
|
348
|
-
teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
|
|
349
|
-
hasSegment = segmentLocationId || segmentProfitId || segmentTechId || teamSizeId;
|
|
317
|
+
salesChannels = formData.salesChannels, brandName = formData.brandName, brandLogoId = formData.brandLogoId;
|
|
350
318
|
getAddress = function (value, isTwitter, isWeb) {
|
|
351
319
|
if (isTwitter)
|
|
352
320
|
return '@' + value.replaceAll('@', '');
|
|
@@ -367,14 +335,59 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
|
|
|
367
335
|
};
|
|
368
336
|
});
|
|
369
337
|
brandNameIsEditable = brandName && !(isNameENNonEditable && isNameARNonEditable);
|
|
370
|
-
requestBody = __assign(__assign(
|
|
338
|
+
requestBody = __assign(__assign({ id: id }, (brandNameIsEditable && {
|
|
371
339
|
name: {
|
|
372
340
|
en: !isNameENNonEditable ? brandName : undefined,
|
|
373
341
|
ar: !isNameARNonEditable ? brandName : undefined
|
|
374
342
|
}
|
|
375
|
-
})), { logo: brandLogoId
|
|
343
|
+
})), { logo: brandLogoId, channel_services: channel_services });
|
|
344
|
+
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
345
|
+
case 1:
|
|
346
|
+
brandData = (_g.sent()).brand;
|
|
347
|
+
return [4, thunkApi.dispatch(retrieveSegmentDataList()).unwrap()];
|
|
348
|
+
case 2:
|
|
349
|
+
_d = _g.sent(), segmentLocation = _d.segmentLocation, segmentProfit = _d.segmentProfit, segmentTech = _d.segmentTech;
|
|
350
|
+
return [4, API.dataService.getTeamSize({ page: 0 })];
|
|
351
|
+
case 3:
|
|
352
|
+
teamSizeList = _g.sent();
|
|
353
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
354
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
355
|
+
return [2, {
|
|
356
|
+
data: __assign({}, brandData),
|
|
357
|
+
formData: originalFormData,
|
|
358
|
+
teamSizeList: teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.list,
|
|
359
|
+
segmentLocationList: segmentLocation,
|
|
360
|
+
segmentProfitList: segmentProfit,
|
|
361
|
+
segmentTechList: segmentTech
|
|
362
|
+
}];
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
export var updateSegmentBrand = createAsyncThunk('brandUpdateBrandSegment', function (_a, thunkApi) {
|
|
368
|
+
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
369
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
370
|
+
var _b, settings, brand, brandRes, _c, id, data_status, isSegmentLocationNonEditable, isSegmentProfitNonEditable, isSegmentTechNonEditable, isSegmentTeamsNonEditable, segmentLocation, segmentProfit, segmentTech, teamSize, segmentLocationId, segmentProfitId, segmentTechId, teamSizeId, hasSegment, requestBody, brandData, activities, activityList;
|
|
371
|
+
var _d, _e, _f;
|
|
372
|
+
return __generator(this, function (_g) {
|
|
373
|
+
switch (_g.label) {
|
|
374
|
+
case 0:
|
|
375
|
+
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
376
|
+
brandRes = (brand.data.verify.responseBody || {}).brand;
|
|
377
|
+
_c = brandRes || {}, id = _c.id, data_status = _c.data_status;
|
|
378
|
+
isSegmentLocationNonEditable = hasNoneEditableValue(data_status, 'segment.location_type');
|
|
379
|
+
isSegmentProfitNonEditable = hasNoneEditableValue(data_status, 'segment.profit_type');
|
|
380
|
+
isSegmentTechNonEditable = hasNoneEditableValue(data_status, 'segment.tech_type');
|
|
381
|
+
isSegmentTeamsNonEditable = hasNoneEditableValue(data_status, 'segment.teams');
|
|
382
|
+
segmentLocation = formData.segmentLocation, segmentProfit = formData.segmentProfit, segmentTech = formData.segmentTech, teamSize = formData.teamSize;
|
|
383
|
+
segmentLocationId = isSegmentLocationNonEditable ? undefined : segmentLocation && { id: segmentLocation.id };
|
|
384
|
+
segmentProfitId = isSegmentProfitNonEditable ? undefined : segmentProfit && { id: segmentProfit.id };
|
|
385
|
+
segmentTechId = isSegmentTechNonEditable ? undefined : segmentTech && { id: segmentTech.id };
|
|
386
|
+
teamSizeId = isSegmentTeamsNonEditable ? undefined : teamSize && { id: teamSize.id };
|
|
387
|
+
hasSegment = segmentLocationId || segmentProfitId || segmentTechId || teamSizeId;
|
|
388
|
+
requestBody = __assign({ id: id }, (hasSegment && {
|
|
376
389
|
segment: { location_type: segmentLocationId, profit_type: segmentProfitId, tech_type: segmentTechId, team: teamSizeId }
|
|
377
|
-
}))
|
|
390
|
+
}));
|
|
378
391
|
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
379
392
|
case 1:
|
|
380
393
|
brandData = (_g.sent()).brand;
|
|
@@ -546,6 +559,12 @@ var initialState = {
|
|
|
546
559
|
brandName: '',
|
|
547
560
|
salesChannels: []
|
|
548
561
|
},
|
|
562
|
+
brandSegmentData: {
|
|
563
|
+
segmentLocation: undefined,
|
|
564
|
+
segmentTech: undefined,
|
|
565
|
+
segmentProfit: undefined,
|
|
566
|
+
teamSize: undefined
|
|
567
|
+
},
|
|
549
568
|
brandActivities: {
|
|
550
569
|
activities: [],
|
|
551
570
|
customerLocations: [],
|
|
@@ -585,42 +604,22 @@ export var brandSlice = createSlice({
|
|
|
585
604
|
state.customLoading = true;
|
|
586
605
|
})
|
|
587
606
|
.addCase(verifyLeadToken.fulfilled, function (state, action) {
|
|
588
|
-
var _a, _b
|
|
607
|
+
var _a, _b;
|
|
589
608
|
state.error = null;
|
|
590
609
|
state.customLoading = false;
|
|
591
|
-
var
|
|
610
|
+
var _c = action.payload, data = _c.data, token = _c.token, boardResponse = _c.boardResponse, salesChannels = _c.salesChannels, individualData = _c.individualData;
|
|
592
611
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
593
612
|
state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
|
|
594
|
-
|
|
595
|
-
var _a, _b;
|
|
596
|
-
return location.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.location_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
597
|
-
})) === null || _b === void 0 ? void 0 : _b[0];
|
|
598
|
-
var selectedSegmentProfit = (_c = segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.filter(function (profit) {
|
|
599
|
-
var _a, _b;
|
|
600
|
-
return profit.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.profit_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
601
|
-
})) === null || _c === void 0 ? void 0 : _c[0];
|
|
602
|
-
var selectedSegmentTech = (_d = segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.filter(function (tech) {
|
|
603
|
-
var _a, _b;
|
|
604
|
-
return tech.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.tech_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
605
|
-
})) === null || _d === void 0 ? void 0 : _d[0];
|
|
606
|
-
var selectedTeamSize = (_e = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.filter(function (team) {
|
|
607
|
-
var _a, _b;
|
|
608
|
-
return team.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team) === null || _b === void 0 ? void 0 : _b.id);
|
|
609
|
-
})) === null || _e === void 0 ? void 0 : _e[0];
|
|
610
|
-
(_f = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _f === void 0 ? void 0 : _f.forEach(function (element) {
|
|
613
|
+
(_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.forEach(function (element) {
|
|
611
614
|
if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
|
|
612
615
|
state.data.brandActivities.termAndConditionChecked = element.agree;
|
|
613
616
|
state.data.brandActivities.transactionPolicy = element.agree;
|
|
614
617
|
state.data.brandActivities.refundPolicy = element.agree;
|
|
615
618
|
}
|
|
616
619
|
});
|
|
617
|
-
state.data.brandData.segmentLocation = selectedSegmentLocation;
|
|
618
|
-
state.data.brandData.segmentProfit = selectedSegmentProfit;
|
|
619
|
-
state.data.brandData.segmentTech = selectedSegmentTech;
|
|
620
|
-
state.data.brandData.teamSize = selectedTeamSize;
|
|
621
620
|
var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
|
|
622
621
|
state.data.brandData.salesChannels = mappedSalesChannels;
|
|
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,
|
|
622
|
+
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, individualData: individualData });
|
|
624
623
|
state.data.verify.token = token;
|
|
625
624
|
})
|
|
626
625
|
.addCase(verifyLeadToken.rejected, function (state, action) {
|
|
@@ -643,44 +642,24 @@ export var brandSlice = createSlice({
|
|
|
643
642
|
state.error = null;
|
|
644
643
|
})
|
|
645
644
|
.addCase(verifyBrandLeadOTP.fulfilled, function (state, action) {
|
|
646
|
-
var _a, _b
|
|
645
|
+
var _a, _b;
|
|
647
646
|
state.loading = false;
|
|
648
647
|
state.error = null;
|
|
649
|
-
var
|
|
648
|
+
var _c = action.payload, data = _c.data, boardResponse = _c.boardResponse, formData = _c.formData, salesChannels = _c.salesChannels, individualData = _c.individualData;
|
|
650
649
|
var brand = boardResponse.brand, entity = boardResponse.entity;
|
|
651
650
|
state.data.otpData = formData;
|
|
652
651
|
state.data.otpData.responseBody = data;
|
|
653
652
|
state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
|
|
654
|
-
var selectedTeamSize = (_b = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.filter(function (team) {
|
|
655
|
-
var _a, _b;
|
|
656
|
-
return team.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team) === null || _b === void 0 ? void 0 : _b.id);
|
|
657
|
-
})) === null || _b === void 0 ? void 0 : _b[0];
|
|
658
|
-
var selectedSegmentLocation = (_c = segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.filter(function (location) {
|
|
659
|
-
var _a, _b;
|
|
660
|
-
return location.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.location_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
661
|
-
})) === null || _c === void 0 ? void 0 : _c[0];
|
|
662
|
-
var selectedSegmentProfit = (_d = segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.filter(function (profit) {
|
|
663
|
-
var _a, _b;
|
|
664
|
-
return profit.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.profit_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
665
|
-
})) === null || _d === void 0 ? void 0 : _d[0];
|
|
666
|
-
var selectedSegmentTech = (_e = segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.filter(function (tech) {
|
|
667
|
-
var _a, _b;
|
|
668
|
-
return tech.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.tech_type) === null || _b === void 0 ? void 0 : _b.id);
|
|
669
|
-
})) === null || _e === void 0 ? void 0 : _e[0];
|
|
670
|
-
state.data.brandData.segmentLocation = selectedSegmentLocation;
|
|
671
|
-
state.data.brandData.segmentProfit = selectedSegmentProfit;
|
|
672
|
-
state.data.brandData.segmentTech = selectedSegmentTech;
|
|
673
|
-
state.data.brandData.teamSize = selectedTeamSize;
|
|
674
653
|
var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
|
|
675
654
|
state.data.brandData.salesChannels = mappedSalesChannels;
|
|
676
|
-
(
|
|
655
|
+
(_b = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _b === void 0 ? void 0 : _b.forEach(function (element) {
|
|
677
656
|
if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
|
|
678
657
|
state.data.brandActivities.termAndConditionChecked = element.agree;
|
|
679
658
|
state.data.brandActivities.transactionPolicy = element.agree;
|
|
680
659
|
state.data.brandActivities.refundPolicy = element.agree;
|
|
681
660
|
}
|
|
682
661
|
});
|
|
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,
|
|
662
|
+
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, individualData: individualData });
|
|
684
663
|
})
|
|
685
664
|
.addCase(verifyBrandLeadOTP.rejected, function (state, action) {
|
|
686
665
|
state.loading = false;
|
|
@@ -706,12 +685,48 @@ export var brandSlice = createSlice({
|
|
|
706
685
|
.addCase(updateBrand.fulfilled, function (state, action) {
|
|
707
686
|
state.loading = false;
|
|
708
687
|
state.error = null;
|
|
688
|
+
var _a = action.payload, data = _a.data, formData = _a.formData, segmentLocationList = _a.segmentLocationList, segmentProfitList = _a.segmentProfitList, segmentTechList = _a.segmentTechList, teamSizeList = _a.teamSizeList;
|
|
689
|
+
var segment = data.segment;
|
|
690
|
+
state.data.brandData = formData;
|
|
691
|
+
var selectedSegmentLocation = segmentLocationList === null || segmentLocationList === void 0 ? void 0 : segmentLocationList.find(function (location) {
|
|
692
|
+
var _a;
|
|
693
|
+
return location.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.location_type) === null || _a === void 0 ? void 0 : _a.id);
|
|
694
|
+
});
|
|
695
|
+
var selectedSegmentProfit = segmentProfitList === null || segmentProfitList === void 0 ? void 0 : segmentProfitList.find(function (profit) {
|
|
696
|
+
var _a;
|
|
697
|
+
return profit.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.profit_type) === null || _a === void 0 ? void 0 : _a.id);
|
|
698
|
+
});
|
|
699
|
+
var selectedSegmentTech = segmentTechList === null || segmentTechList === void 0 ? void 0 : segmentTechList.find(function (tech) {
|
|
700
|
+
var _a;
|
|
701
|
+
return tech.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.tech_type) === null || _a === void 0 ? void 0 : _a.id);
|
|
702
|
+
});
|
|
703
|
+
var selectedTeamSize = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.find(function (team) {
|
|
704
|
+
var _a;
|
|
705
|
+
return team.id === ((_a = segment === null || segment === void 0 ? void 0 : segment.team) === null || _a === void 0 ? void 0 : _a.id);
|
|
706
|
+
});
|
|
707
|
+
state.data.brandSegmentData.segmentLocation = selectedSegmentLocation;
|
|
708
|
+
state.data.brandSegmentData.segmentProfit = selectedSegmentProfit;
|
|
709
|
+
state.data.brandSegmentData.segmentTech = selectedSegmentTech;
|
|
710
|
+
state.data.brandSegmentData.teamSize = selectedTeamSize;
|
|
711
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { teamSizeList: teamSizeList, segmentLocationList: segmentLocationList, segmentProfitList: segmentProfitList, segmentTechList: segmentTechList });
|
|
712
|
+
})
|
|
713
|
+
.addCase(updateBrand.rejected, function (state, action) {
|
|
714
|
+
state.loading = false;
|
|
715
|
+
state.error = action.error.message;
|
|
716
|
+
})
|
|
717
|
+
.addCase(updateSegmentBrand.pending, function (state) {
|
|
718
|
+
state.loading = true;
|
|
719
|
+
state.error = null;
|
|
720
|
+
})
|
|
721
|
+
.addCase(updateSegmentBrand.fulfilled, function (state, action) {
|
|
722
|
+
state.loading = false;
|
|
723
|
+
state.error = null;
|
|
709
724
|
var _a = action.payload, data = _a.data, formData = _a.formData;
|
|
710
725
|
var entity_activities = data.entity_activities, activities = data.activities, operations = data.operations, terms = data.terms;
|
|
711
726
|
var selectedActivity = entity_activities === null || entity_activities === void 0 ? void 0 : entity_activities.filter(function (activity) {
|
|
712
727
|
return activities === null || activities === void 0 ? void 0 : activities.find(function (value) { return activity.id === value.id; });
|
|
713
728
|
});
|
|
714
|
-
state.data.
|
|
729
|
+
state.data.brandSegmentData = formData;
|
|
715
730
|
state.data.brandActivities.activities = (selectedActivity === null || selectedActivity === void 0 ? void 0 : selectedActivity.length) > 0 ? selectedActivity : [];
|
|
716
731
|
var _b = operations || {}, customer_base = _b.customer_base, sales = _b.sales;
|
|
717
732
|
var _c = customer_base || {}, locations = _c.locations, customerBase = __rest(_c, ["locations"]);
|
|
@@ -729,6 +744,10 @@ export var brandSlice = createSlice({
|
|
|
729
744
|
}
|
|
730
745
|
});
|
|
731
746
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { activities: entity_activities });
|
|
747
|
+
})
|
|
748
|
+
.addCase(updateSegmentBrand.rejected, function (state, action) {
|
|
749
|
+
state.loading = false;
|
|
750
|
+
state.error = action.error.message;
|
|
732
751
|
})
|
|
733
752
|
.addCase(updateBrandActivities.rejected, function (state, action) {
|
|
734
753
|
state.loading = false;
|
|
@@ -741,10 +760,6 @@ export var brandSlice = createSlice({
|
|
|
741
760
|
.addCase(updateBrandActivities.fulfilled, function (state) {
|
|
742
761
|
state.loading = false;
|
|
743
762
|
state.error = null;
|
|
744
|
-
})
|
|
745
|
-
.addCase(updateBrand.rejected, function (state, action) {
|
|
746
|
-
state.loading = false;
|
|
747
|
-
state.error = action.error.message;
|
|
748
763
|
})
|
|
749
764
|
.addCase(retrieveSegmentDataList.pending, function (state) {
|
|
750
765
|
state.loading = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, AuthForType,
|
|
2
|
+
import { ActionState, AuthForType, ConnectBrandFormValues, CivilFormValues, CountryCode, FlowsTypes, IndividualFormValues, MobileFormValues, NIDFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
response: any;
|
|
@@ -125,10 +125,10 @@ export declare const retrieveSegmentDataList: import("@reduxjs/toolkit").AsyncTh
|
|
|
125
125
|
}>;
|
|
126
126
|
export declare const updateLeadBrand: import("@reduxjs/toolkit").AsyncThunk<{
|
|
127
127
|
response: any;
|
|
128
|
-
formData: BrandFormValues & {
|
|
128
|
+
formData: import("../../../@types").BrandFormValues & import("../../../@types").BrandSegmentFormValues & {
|
|
129
129
|
isNewBrand: boolean;
|
|
130
130
|
};
|
|
131
|
-
}, BrandFormValues & {
|
|
131
|
+
}, import("../../../@types").BrandFormValues & import("../../../@types").BrandSegmentFormValues & {
|
|
132
132
|
isNewBrand: boolean;
|
|
133
133
|
}, {
|
|
134
134
|
state?: unknown;
|
|
@@ -199,7 +199,7 @@ export interface ConnectData {
|
|
|
199
199
|
authFor: AuthForType;
|
|
200
200
|
};
|
|
201
201
|
individualData: IndividualFormValues & ResponseData;
|
|
202
|
-
brandData:
|
|
202
|
+
brandData: ConnectBrandFormValues & ResponseData;
|
|
203
203
|
flowName: FlowsTypes;
|
|
204
204
|
}
|
|
205
205
|
export interface ConnectState extends SharedState<ConnectData> {
|
|
@@ -10,57 +10,39 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
13
|
import React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
|
-
import Form from '../../../../components/Form';
|
|
17
16
|
import { styled } from '@mui/material/styles';
|
|
18
17
|
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
18
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
19
19
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
|
-
import
|
|
20
|
+
import Form from '../../../../components/Form';
|
|
21
|
+
import { mapSalesChannel } from '../../../../utils';
|
|
21
22
|
import Button from '../../../shared/Button';
|
|
22
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
23
|
import { clearError, brandSelector, updateBrand, retrieveBoardStatus } from '../../../app/brand/brandStore';
|
|
24
|
-
import {
|
|
25
|
-
import TeamSize from '../../../brand/screens/BrandInfo/TeamSize';
|
|
26
|
-
import Collapse from '../../../../components/Collapse';
|
|
27
|
-
import { mapSalesChannel } from '../../../../utils';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
28
25
|
import BrandName from './BrandName';
|
|
29
26
|
import SalesChannels from './SalesChannels';
|
|
30
27
|
import BrandLogo from './BrandLogo';
|
|
31
|
-
import
|
|
32
|
-
import SegmentProfits from './SegmentProfits';
|
|
33
|
-
import SegmentTechs from './SegmentTechs';
|
|
28
|
+
import { BrandValidationSchema } from './validation';
|
|
34
29
|
var FormStyled = styled(Form)(function () { return ({
|
|
35
30
|
display: 'flex',
|
|
36
31
|
flexDirection: 'column'
|
|
37
32
|
}); });
|
|
38
|
-
var ListType;
|
|
39
|
-
(function (ListType) {
|
|
40
|
-
ListType["TeamSizeList"] = "TeamSizeList";
|
|
41
|
-
ListType["SegmentLocationList"] = "SegmentLocationList";
|
|
42
|
-
ListType["SegmentProfitList"] = "SegmentProfitList";
|
|
43
|
-
ListType["SegmentTechList"] = "SegmentTechList";
|
|
44
|
-
})(ListType || (ListType = {}));
|
|
45
33
|
var BrandInfo = function (_a) {
|
|
46
|
-
var _b
|
|
47
|
-
var _k = React.useState(), listActive = _k[0], setListActive = _k[1];
|
|
48
|
-
var _l = React.useState(false), brandNameChecking = _l[0], setBrandNameChecking = _l[1];
|
|
34
|
+
var _b = React.useState(false), brandNameChecking = _b[0], setBrandNameChecking = _b[1];
|
|
49
35
|
var dispatch = useAppDispatch();
|
|
50
36
|
var t = useTranslation().t;
|
|
51
37
|
var isAr = useLanguage().isAr;
|
|
52
|
-
var
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
38
|
+
var _c = useAppSelector(brandSelector), data = _c.data, loading = _c.loading, error = _c.error, uploadingBrandLogo = _c.uploadingBrandLogo;
|
|
39
|
+
var _d = data.brandData, brandName = _d.brandName, salesChannels = _d.salesChannels, brandLogoId = _d.brandLogoId, responseBody = _d.responseBody;
|
|
40
|
+
var _e = data.verify.responseBody || {}, brand = _e.brand, flows = _e.flows;
|
|
41
|
+
var _f = brand || {}, logo_details = _f.logo_details, data_status = _f.data_status, data_verification = _f.data_verification, name = _f.name;
|
|
56
42
|
var methods = useForm({
|
|
57
43
|
resolver: yupResolver(BrandValidationSchema()),
|
|
58
44
|
defaultValues: {
|
|
59
45
|
brandName: brandName,
|
|
60
|
-
segmentLocation: segmentLocation,
|
|
61
|
-
segmentProfit: segmentProfit,
|
|
62
|
-
segmentTech: segmentTech,
|
|
63
|
-
teamSize: teamSize,
|
|
64
46
|
salesChannels: salesChannels,
|
|
65
47
|
brandLogoId: brandLogoId
|
|
66
48
|
},
|
|
@@ -70,23 +52,11 @@ var BrandInfo = function (_a) {
|
|
|
70
52
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
71
53
|
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
72
54
|
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
73
|
-
var noneEditable = useDataNoneEditable(data_status, [
|
|
74
|
-
'name.en',
|
|
75
|
-
'name.ar',
|
|
76
|
-
'segment.location_type',
|
|
77
|
-
'segment.profit_type',
|
|
78
|
-
'segment.tech_type',
|
|
79
|
-
'segment.teams',
|
|
80
|
-
'channel_services'
|
|
81
|
-
]);
|
|
55
|
+
var noneEditable = useDataNoneEditable(data_status, ['name.en', 'name.ar', 'channel_services', 'logo']);
|
|
82
56
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
83
|
-
var dataVerified = useDataVerified(data_verification, ['logo', 'name.en', 'name.ar'
|
|
57
|
+
var dataVerified = useDataVerified(data_verification, ['logo', 'name.en', 'name.ar']);
|
|
84
58
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
85
59
|
var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
|
|
86
|
-
var isSegmentLocationVerified = dataVerified['segment.location_type'] && ((_b = resSegment === null || resSegment === void 0 ? void 0 : resSegment.location_type) === null || _b === void 0 ? void 0 : _b.id) === ((_c = watch('segmentLocation')) === null || _c === void 0 ? void 0 : _c.id);
|
|
87
|
-
var isSegmentProfitVerified = dataVerified['segment.profit_type'] && ((_d = resSegment === null || resSegment === void 0 ? void 0 : resSegment.profit_type) === null || _d === void 0 ? void 0 : _d.id) === ((_e = watch('segmentProfit')) === null || _e === void 0 ? void 0 : _e.id);
|
|
88
|
-
var isSegmentTechVerified = dataVerified['segment.tech_type'] && ((_f = resSegment === null || resSegment === void 0 ? void 0 : resSegment.tech_type) === null || _f === void 0 ? void 0 : _f.id) === ((_g = watch('segmentTech')) === null || _g === void 0 ? void 0 : _g.id);
|
|
89
|
-
var isTeamSizeVerified = dataVerified['segment.teams'] && ((_h = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _h === void 0 ? void 0 : _h.id) === ((_j = watch('teamSize')) === null || _j === void 0 ? void 0 : _j.id);
|
|
90
60
|
var onSubmit = function (data) {
|
|
91
61
|
dispatch(updateBrand(getFelids(data)));
|
|
92
62
|
};
|
|
@@ -111,13 +81,6 @@ var BrandInfo = function (_a) {
|
|
|
111
81
|
}, [responseBody]);
|
|
112
82
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
113
83
|
var disabled = brandErrChecks || brandNameChecking || uploadingBrandLogo;
|
|
114
|
-
|
|
115
|
-
setListActive(flag);
|
|
116
|
-
};
|
|
117
|
-
var isSegmentLocationListActive = listActive === ListType.SegmentLocationList;
|
|
118
|
-
var isSegmentProfitListActive = listActive === ListType.SegmentProfitList;
|
|
119
|
-
var isSegmentTechListActive = listActive === ListType.SegmentTechList;
|
|
120
|
-
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
121
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: isBrandNameVerified }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive, isVerified: dataVerified['logo'] }), _jsx(SegmentLocations, { readOnly: readOnly['segmentLocation'], show: !isTeamSizeListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentLocationList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentLocationVerified }), _jsx(SegmentProfits, { readOnly: readOnly['segmentProfit'], show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentProfitList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentProfitVerified }), _jsx(SegmentTechs, { readOnly: readOnly['segmentTech'], show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentProfitListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentTechList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentTechVerified }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isTeamSizeVerified }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
84
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: isBrandNameVerified }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], isVerified: dataVerified['logo'] }), _jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] })) })) }));
|
|
122
85
|
};
|
|
123
86
|
export default BrandInfo;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FileDetails } from '../../../../@types';
|
|
3
3
|
type BrandLogoProps = {
|
|
4
|
-
show: boolean;
|
|
5
4
|
readOnly?: boolean;
|
|
6
5
|
defaultFile?: FileDetails;
|
|
7
6
|
isVerified?: boolean;
|
|
8
7
|
};
|
|
9
|
-
declare const BrandLogo: ({
|
|
8
|
+
declare const BrandLogo: ({ readOnly, defaultFile, isVerified }: BrandLogoProps) => JSX.Element;
|
|
10
9
|
export default BrandLogo;
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { useTranslation } from 'react-i18next';
|
|
14
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
@@ -16,7 +5,6 @@ import { styled } from '@mui/material/styles';
|
|
|
16
5
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
6
|
import { DocumentPurpose } from '../../../../@types';
|
|
18
7
|
import { FileRemoveType, VALID_FILE_FORMATS_FOR_IMAGE } from '../../../../constants';
|
|
19
|
-
import Collapse from '../../../../components/Collapse';
|
|
20
8
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
9
|
import { UploadWrapper } from '../../../shared/UploadFile';
|
|
22
10
|
import { brandSelector, uploadingBrandLogoStatus, clearBrandLogo, clearError } from '../../../app/brand/brandStore';
|
|
@@ -28,7 +16,7 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
28
16
|
});
|
|
29
17
|
var BrandLogo = function (_a) {
|
|
30
18
|
var _b;
|
|
31
|
-
var
|
|
19
|
+
var readOnly = _a.readOnly, defaultFile = _a.defaultFile, isVerified = _a.isVerified;
|
|
32
20
|
var t = useTranslation().t;
|
|
33
21
|
var control = useFormContext().control;
|
|
34
22
|
var brandLogoIdControl = useController({ name: 'brandLogoId', control: control });
|
|
@@ -48,6 +36,6 @@ var BrandLogo = function (_a) {
|
|
|
48
36
|
dispatch(clearBrandLogo());
|
|
49
37
|
brandLogoIdControl.field.onChange(undefined);
|
|
50
38
|
};
|
|
51
|
-
return (_jsx(
|
|
39
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified && !id }) }));
|
|
52
40
|
};
|
|
53
41
|
export default BrandLogo;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface BrandNameProps {
|
|
3
|
-
show: boolean;
|
|
4
3
|
fetchingBrandName: (flag: boolean) => void;
|
|
5
4
|
brandNameChecking: boolean;
|
|
6
5
|
readOnly?: boolean;
|
|
7
6
|
isVerified?: boolean;
|
|
8
7
|
}
|
|
9
|
-
declare const _default: React.MemoExoticComponent<({
|
|
8
|
+
declare const _default: React.MemoExoticComponent<({ brandNameChecking, fetchingBrandName, readOnly, isVerified }: BrandNameProps) => JSX.Element>;
|
|
10
9
|
export default _default;
|
|
@@ -58,7 +58,6 @@ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
|
58
58
|
import { FieldType } from '../../../../@types';
|
|
59
59
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
60
60
|
import Tooltip from '../../../../components/Tooltip';
|
|
61
|
-
import Collapse from '../../../../components/Collapse';
|
|
62
61
|
import Text from '../../../../components/Text';
|
|
63
62
|
import Input from '../../../shared/Input';
|
|
64
63
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -97,7 +96,7 @@ var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
|
97
96
|
var cancelToken = null;
|
|
98
97
|
var BrandName = function (_a) {
|
|
99
98
|
var _b, _c;
|
|
100
|
-
var
|
|
99
|
+
var brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
101
100
|
var dispatch = useAppDispatch();
|
|
102
101
|
var _d = React.useState(false), isHovered = _d[0], setIsHovered = _d[1];
|
|
103
102
|
var t = useTranslation().t;
|
|
@@ -136,6 +135,6 @@ var BrandName = function (_a) {
|
|
|
136
135
|
var clearBrandName = function () {
|
|
137
136
|
brandControl.field.onChange('');
|
|
138
137
|
};
|
|
139
|
-
return (
|
|
138
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { readOnly: readOnly, onChange: handleBrandNameChange, value: brandNameValue || '', disabled: isNonEditable, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: brandNameValue, loading: brandNameChecking, isVerified: isVerified, error: error, onClear: clearBrandName }) })] })));
|
|
140
139
|
};
|
|
141
140
|
export default React.memo(BrandName);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const BrandValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
-
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>>;
|
|
5
|
-
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>>;
|
|
6
|
-
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>>;
|
|
7
|
-
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>>;
|
|
8
4
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
5
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
6
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,10 +12,6 @@ export declare const BrandValidationSchema: () => yup.ObjectSchema<import("yup/l
|
|
|
16
12
|
}>>[] | undefined>;
|
|
17
13
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
18
14
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
-
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>>;
|
|
20
|
-
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>>;
|
|
21
|
-
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>>;
|
|
22
|
-
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>>;
|
|
23
15
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
16
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
25
17
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -31,10 +23,6 @@ export declare const BrandValidationSchema: () => yup.ObjectSchema<import("yup/l
|
|
|
31
23
|
}>>[] | undefined>;
|
|
32
24
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
33
25
|
brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
34
|
-
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>>;
|
|
35
|
-
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>>;
|
|
36
|
-
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>>;
|
|
37
|
-
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>>;
|
|
38
26
|
salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
39
27
|
id: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
40
28
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -83,10 +83,6 @@ export var BrandValidationSchema = function () {
|
|
|
83
83
|
}
|
|
84
84
|
})
|
|
85
85
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
86
|
-
segmentLocation: yup.object().required('alert_choose_segment_location'),
|
|
87
|
-
segmentProfit: yup.object().required('alert_choose_segment_profit'),
|
|
88
|
-
segmentTech: yup.object().required('alert_choose_segment_tech'),
|
|
89
|
-
teamSize: yup.object().required('alert_choose_teamSize'),
|
|
90
86
|
salesChannels: yup
|
|
91
87
|
.array()
|
|
92
88
|
.min(1, 'choose_atleast_one_channel')
|
|
@@ -0,0 +1,102 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { FormProvider, useForm } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { useAppDispatch, useAppSelector, useDataNoneEditable, useFormReadOnly, useLanguage, useSetFromDefaultValues, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
18
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
19
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
|
+
import Collapse from '../../../../components/Collapse';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
+
import { clearError, brandSelector, updateSegmentBrand } from '../../../app/brand/brandStore';
|
|
24
|
+
import Button from '../../../shared/Button';
|
|
25
|
+
import SegmentLocations from './SegmentLocations';
|
|
26
|
+
import SegmentProfits from './SegmentProfits';
|
|
27
|
+
import SegmentTechs from './SegmentTechs';
|
|
28
|
+
import { BrandValidationSchema } from './validation';
|
|
29
|
+
import TeamSize from './TeamSize';
|
|
30
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flexDirection: 'column'
|
|
33
|
+
}); });
|
|
34
|
+
var ListType;
|
|
35
|
+
(function (ListType) {
|
|
36
|
+
ListType["TeamSizeList"] = "TeamSizeList";
|
|
37
|
+
ListType["SegmentLocationList"] = "SegmentLocationList";
|
|
38
|
+
ListType["SegmentProfitList"] = "SegmentProfitList";
|
|
39
|
+
ListType["SegmentTechList"] = "SegmentTechList";
|
|
40
|
+
})(ListType || (ListType = {}));
|
|
41
|
+
var BrandInfo = function (_a) {
|
|
42
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
43
|
+
var _k = React.useState(), listActive = _k[0], setListActive = _k[1];
|
|
44
|
+
var dispatch = useAppDispatch();
|
|
45
|
+
var t = useTranslation().t;
|
|
46
|
+
var isAr = useLanguage().isAr;
|
|
47
|
+
var _l = useAppSelector(brandSelector), data = _l.data, loading = _l.loading, error = _l.error;
|
|
48
|
+
var _m = data.brandSegmentData, segmentLocation = _m.segmentLocation, segmentProfit = _m.segmentProfit, segmentTech = _m.segmentTech, teamSize = _m.teamSize;
|
|
49
|
+
var brand = (data.verify.responseBody || {}).brand;
|
|
50
|
+
var _o = brand || {}, data_status = _o.data_status, data_verification = _o.data_verification, resSegment = _o.segment;
|
|
51
|
+
var methods = useForm({
|
|
52
|
+
resolver: yupResolver(BrandValidationSchema()),
|
|
53
|
+
defaultValues: {
|
|
54
|
+
segmentLocation: segmentLocation,
|
|
55
|
+
segmentProfit: segmentProfit,
|
|
56
|
+
segmentTech: segmentTech,
|
|
57
|
+
teamSize: teamSize
|
|
58
|
+
},
|
|
59
|
+
mode: 'onChange'
|
|
60
|
+
});
|
|
61
|
+
var watch = methods.watch;
|
|
62
|
+
useSetFromDefaultValues(methods, data.brandSegmentData, true);
|
|
63
|
+
var originalReadOnly = useFormReadOnly(methods);
|
|
64
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
65
|
+
'segment.location_type',
|
|
66
|
+
'segment.profit_type',
|
|
67
|
+
'segment.tech_type',
|
|
68
|
+
'segment.teams'
|
|
69
|
+
]);
|
|
70
|
+
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
71
|
+
var dataVerified = useDataVerified(data_verification, [
|
|
72
|
+
'segment.location_type',
|
|
73
|
+
'segment.profit_type',
|
|
74
|
+
'segment.tech_type',
|
|
75
|
+
'segment.teams'
|
|
76
|
+
]);
|
|
77
|
+
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
78
|
+
var isSegmentLocationVerified = dataVerified['segment.location_type'] && ((_b = resSegment === null || resSegment === void 0 ? void 0 : resSegment.location_type) === null || _b === void 0 ? void 0 : _b.id) === ((_c = watch('segmentLocation')) === null || _c === void 0 ? void 0 : _c.id);
|
|
79
|
+
var isSegmentProfitVerified = dataVerified['segment.profit_type'] && ((_d = resSegment === null || resSegment === void 0 ? void 0 : resSegment.profit_type) === null || _d === void 0 ? void 0 : _d.id) === ((_e = watch('segmentProfit')) === null || _e === void 0 ? void 0 : _e.id);
|
|
80
|
+
var isSegmentTechVerified = dataVerified['segment.tech_type'] && ((_f = resSegment === null || resSegment === void 0 ? void 0 : resSegment.tech_type) === null || _f === void 0 ? void 0 : _f.id) === ((_g = watch('segmentTech')) === null || _g === void 0 ? void 0 : _g.id);
|
|
81
|
+
var isTeamSizeVerified = dataVerified['segment.teams'] && ((_h = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _h === void 0 ? void 0 : _h.id) === ((_j = watch('teamSize')) === null || _j === void 0 ? void 0 : _j.id);
|
|
82
|
+
var onSubmit = function (data) {
|
|
83
|
+
dispatch(updateSegmentBrand(getFelids(data)));
|
|
84
|
+
};
|
|
85
|
+
var onBack = function () {
|
|
86
|
+
dispatch(handlePrevScreenStep());
|
|
87
|
+
};
|
|
88
|
+
React.useEffect(function () {
|
|
89
|
+
if (error)
|
|
90
|
+
dispatch(clearError());
|
|
91
|
+
}, [methods.formState.isValid]);
|
|
92
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
93
|
+
var handleMenuClick = function (flag) {
|
|
94
|
+
setListActive(flag);
|
|
95
|
+
};
|
|
96
|
+
var isSegmentLocationListActive = listActive === ListType.SegmentLocationList;
|
|
97
|
+
var isSegmentProfitListActive = listActive === ListType.SegmentProfitList;
|
|
98
|
+
var isSegmentTechListActive = listActive === ListType.SegmentTechList;
|
|
99
|
+
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
100
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(SegmentLocations, { readOnly: readOnly['segmentLocation'], show: !isTeamSizeListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentLocationList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentLocationVerified }), _jsx(SegmentProfits, { readOnly: readOnly['segmentProfit'], show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentProfitList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentProfitVerified }), _jsx(SegmentTechs, { readOnly: readOnly['segmentTech'], show: !isTeamSizeListActive && !isSegmentLocationListActive && !isSegmentProfitListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentTechList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentTechVerified }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentLocationListActive && !isSegmentProfitListActive && !isSegmentTechListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isTeamSizeVerified }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
|
|
101
|
+
};
|
|
102
|
+
export default BrandInfo;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const BrandValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
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>>;
|
|
4
|
+
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>>;
|
|
5
|
+
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>>;
|
|
6
|
+
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>>;
|
|
7
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
8
|
+
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>>;
|
|
9
|
+
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>>;
|
|
10
|
+
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>>;
|
|
11
|
+
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>>;
|
|
12
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
13
|
+
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>>;
|
|
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>>;
|
|
15
|
+
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>>;
|
|
16
|
+
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>>;
|
|
17
|
+
}>>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export var BrandValidationSchema = function () {
|
|
3
|
+
return yup.object().shape({
|
|
4
|
+
segmentLocation: yup.object().required('alert_choose_segment_location'),
|
|
5
|
+
segmentTech: yup.object().required('alert_choose_segment_tech'),
|
|
6
|
+
segmentProfit: yup.object().required('alert_choose_segment_profit'),
|
|
7
|
+
teamSize: yup.object().required('alert_choose_teamSize')
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -72,6 +72,7 @@ import EntityResetPasswordSuccessPage from './entity/screens/ResetPasswordSucces
|
|
|
72
72
|
import EntityDataLoadingPage from './entity/screens/PrepareDataLoading';
|
|
73
73
|
import BrandVerifyPage from './brand/screens/Verify';
|
|
74
74
|
import BrandInfoPage from './brand/screens/BrandInfo';
|
|
75
|
+
import BrandSegmentPage from './brand/screens/BrandSegmentInfo';
|
|
75
76
|
import BrandActivitiesPage from './brand/screens/BrandActivities';
|
|
76
77
|
import BrandSuccessPage from './brand/screens/Success';
|
|
77
78
|
import BrandSuccessWithFlowPage from './brand/screens/SuccessWithFlowButtons';
|
|
@@ -369,6 +370,10 @@ export var brandFeatureScreens = [
|
|
|
369
370
|
name: 'BRAND_INFO_STEP',
|
|
370
371
|
element: BrandInfoPage
|
|
371
372
|
},
|
|
373
|
+
{
|
|
374
|
+
name: 'BRAND_SEGMENT_INFO_STEP',
|
|
375
|
+
element: BrandSegmentPage
|
|
376
|
+
},
|
|
372
377
|
{
|
|
373
378
|
name: 'BRAND_ACTIVITIES_STEP',
|
|
374
379
|
element: BrandActivitiesPage
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|