@tap-payments/auth-jsconnect 1.0.31 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +5 -1
- package/build/@types/form.d.ts +23 -1
- package/build/api/account.d.ts +15 -0
- package/build/api/account.js +9 -0
- package/build/api/axios.d.ts +2 -0
- package/build/api/axios.js +10 -0
- package/build/api/data.d.ts +6 -0
- package/build/api/data.js +17 -0
- package/build/api/entity.d.ts +20 -0
- package/build/api/entity.js +9 -0
- package/build/api/index.d.ts +22 -2
- package/build/api/index.js +9 -1
- package/build/api/lead.d.ts +22 -0
- package/build/api/lead.js +21 -1
- package/build/app/settings.js +12 -18
- package/build/components/Input/Input.d.ts +1 -1
- package/build/components/Input/Input.js +3 -2
- package/build/components/Slide/Slide.d.ts +1 -1
- package/build/components/Warning/Warning.d.ts +1 -1
- package/build/components/Warning/Warning.js +13 -2
- package/build/constants/api.d.ts +8 -0
- package/build/constants/api.js +17 -1
- package/build/constants/app.d.ts +11 -1
- package/build/constants/app.js +11 -1
- package/build/constants/assets.js +1 -1
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/business/businessStore.d.ts +73 -4
- package/build/features/app/business/businessStore.js +500 -7
- package/build/features/app/connect/connectStore.d.ts +11 -3
- package/build/features/app/connect/connectStore.js +88 -43
- package/build/features/bank/screens/BankDetails/validation.js +2 -1
- package/build/features/business/Business.js +7 -3
- package/build/features/business/screens/Activities/Activities.js +13 -13
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +2 -2
- package/build/features/business/screens/Activities/ActivitiesList.js +14 -4
- package/build/features/business/screens/Activities/OperationStartDate.js +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +11 -2
- package/build/features/business/screens/BusinessType/BusinessType.d.ts +1 -8
- package/build/features/business/screens/BusinessType/BusinessType.js +25 -27
- package/build/features/business/screens/Confirm/Confirm.js +10 -11
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +3 -3
- package/build/features/business/screens/Customers/Customers.js +3 -2
- package/build/features/business/screens/IDBOD/DOB.js +1 -1
- package/build/features/business/screens/IDBOD/IDBOD.js +19 -12
- package/build/features/business/screens/OTP/OTP.d.ts +2 -5
- package/build/features/business/screens/OTP/OTP.js +18 -15
- package/build/features/business/screens/OTP/OTPInput.js +20 -5
- package/build/features/business/screens/Success/Success.js +6 -0
- package/build/features/business/screens/Verify/OTPInput.js +7 -3
- package/build/features/business/screens/Verify/Verify.d.ts +1 -9
- package/build/features/business/screens/Verify/Verify.js +16 -17
- package/build/features/business/screens/Verify/index.d.ts +1 -2
- package/build/features/connect/screens/Individual/Individual.js +6 -1
- package/build/features/connect/screens/Individual/Name.js +10 -1
- package/build/features/connect/screens/Individual/validation.js +3 -2
- package/build/features/connect/screens/Merchant/Merchant.js +6 -1
- package/build/features/connect/screens/Mobile/Mobile.js +6 -1
- package/build/features/connect/screens/NID/NID.js +6 -1
- package/build/features/connect/screens/OTP/OTP.js +6 -1
- package/build/features/connect/screens/Password/Password.js +7 -2
- package/build/features/featuresScreens.js +3 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +2 -4
- package/build/features/shared/Button/AbsherButton.js +1 -1
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/hooks/useAppConfig.js +99 -24
- package/build/theme/palette.js +4 -0
- package/build/utils/string.d.ts +25 -0
- package/build/utils/string.js +56 -0
- package/package.json +1 -1
|
@@ -28,8 +28,10 @@ export declare const verifyAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
28
28
|
leadResponse: any;
|
|
29
29
|
formData: OTPFormValues;
|
|
30
30
|
}, OTPFormValues, {}>;
|
|
31
|
-
export declare const
|
|
31
|
+
export declare const createVerifyAuthPassword: import("@reduxjs/toolkit").AsyncThunk<{
|
|
32
32
|
response: any;
|
|
33
|
+
createAuthResponse: any;
|
|
34
|
+
leadResponse: any;
|
|
33
35
|
formData: PasswordFormValues;
|
|
34
36
|
}, PasswordFormValues, {}>;
|
|
35
37
|
export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -55,7 +57,7 @@ export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
55
57
|
export interface ConnectData {
|
|
56
58
|
countries: Array<CountryCode>;
|
|
57
59
|
businessCountry: CountryCode;
|
|
58
|
-
mobileData: MobileFormValues & ResponseData;
|
|
60
|
+
mobileData: (MobileFormValues | undefined) & ResponseData;
|
|
59
61
|
nidData: NIDFormValues & ResponseData & {
|
|
60
62
|
type: string;
|
|
61
63
|
};
|
|
@@ -71,8 +73,14 @@ export interface ConnectState extends SharedState<ConnectData> {
|
|
|
71
73
|
export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectState, {
|
|
72
74
|
clearError: (state: ConnectState) => void;
|
|
73
75
|
stopLoader: (state: ConnectState) => void;
|
|
76
|
+
resetMobileScreen: (state: ConnectState) => void;
|
|
77
|
+
resetNIDScreen: (state: ConnectState) => void;
|
|
78
|
+
resetOTPScreen: (state: ConnectState) => void;
|
|
79
|
+
resetPasswordScreen: (state: ConnectState) => void;
|
|
80
|
+
resetIndividualScreen: (state: ConnectState) => void;
|
|
81
|
+
resetMerchantScreen: (state: ConnectState) => void;
|
|
74
82
|
}, "connect/store">;
|
|
75
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
83
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMerchantScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetPasswordScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
76
84
|
declare const _default: import("redux").Reducer<ConnectState, import("redux").AnyAction>;
|
|
77
85
|
export default _default;
|
|
78
86
|
export declare const connectSelector: (state: RootState) => ConnectState;
|
|
@@ -51,7 +51,7 @@ import { handleNextScreenStep } from '../../../app/settings';
|
|
|
51
51
|
import API from '../../../api';
|
|
52
52
|
import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE } from '../../../constants';
|
|
53
53
|
import { defaultCountry } from '../../../constants';
|
|
54
|
-
import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord } from '../../../utils';
|
|
54
|
+
import { getIndividualName, getClientEmailUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
|
|
55
55
|
export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
56
|
var settings, countriesBody, list, businessCountry;
|
|
57
57
|
return __generator(this, function (_a) {
|
|
@@ -178,36 +178,57 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
}); });
|
|
181
|
-
export var
|
|
182
|
-
var _a, connect, settings,
|
|
183
|
-
var
|
|
184
|
-
return __generator(this, function (
|
|
185
|
-
switch (
|
|
181
|
+
export var createVerifyAuthPassword = createAsyncThunk('verifyAuthPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
182
|
+
var _a, connect, settings, _b, businessCountry, mobileData, mobile, countryCode, requestBody, data, payload, response, leadResponse, leadPayload;
|
|
183
|
+
var _c, _d, _e;
|
|
184
|
+
return __generator(this, function (_f) {
|
|
185
|
+
switch (_f.label) {
|
|
186
186
|
case 0:
|
|
187
187
|
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
_b = connect.data, businessCountry = _b.businessCountry, mobileData = _b.mobileData;
|
|
189
|
+
mobile = mobileData.mobile, countryCode = mobileData.countryCode;
|
|
190
|
+
requestBody = {
|
|
191
|
+
user_credentail: {
|
|
192
|
+
phone: mobile || '',
|
|
193
|
+
code: countryCode.idd_prefix.toString()
|
|
194
|
+
},
|
|
195
|
+
device_info: settings.data.deviceInfo,
|
|
196
|
+
sign_in: true,
|
|
197
|
+
step_name: CONNECT_STEP_NAMES.CREATE_AUTH_PASSWORD,
|
|
198
|
+
encryption_contract: ['user_credentail.phone', 'user_credentail.code']
|
|
199
|
+
};
|
|
200
|
+
return [4, API.authService.createAuth(requestBody)];
|
|
201
|
+
case 1:
|
|
202
|
+
data = (_f.sent()).data;
|
|
190
203
|
payload = {
|
|
191
204
|
data: params.password,
|
|
192
|
-
auth_token:
|
|
193
|
-
auth_type:
|
|
194
|
-
device_token:
|
|
195
|
-
service_name:
|
|
196
|
-
new_user:
|
|
205
|
+
auth_token: data === null || data === void 0 ? void 0 : data.auth_token,
|
|
206
|
+
auth_type: data === null || data === void 0 ? void 0 : data.auth_type,
|
|
207
|
+
device_token: data === null || data === void 0 ? void 0 : data.device_token,
|
|
208
|
+
service_name: data === null || data === void 0 ? void 0 : data.service_name,
|
|
209
|
+
new_user: data === null || data === void 0 ? void 0 : data.new_user,
|
|
197
210
|
sign_in: true,
|
|
198
|
-
remember_me:
|
|
199
|
-
scopes:
|
|
211
|
+
remember_me: data === null || data === void 0 ? void 0 : data.remember_me,
|
|
212
|
+
scopes: data === null || data === void 0 ? void 0 : data.scopes,
|
|
200
213
|
step_name: CONNECT_STEP_NAMES.VERIFY_AUTH_PASSWORD,
|
|
201
214
|
encryption_contract: ['data']
|
|
202
215
|
};
|
|
203
216
|
return [4, API.authService.verifyAuth(payload)];
|
|
204
|
-
case
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
(_c =
|
|
209
|
-
|
|
210
|
-
|
|
217
|
+
case 2:
|
|
218
|
+
response = _f.sent();
|
|
219
|
+
leadResponse = undefined;
|
|
220
|
+
leadPayload = {
|
|
221
|
+
individual_id: (_c = response.data) === null || _c === void 0 ? void 0 : _c.individual_id,
|
|
222
|
+
country_code: businessCountry.iso2
|
|
223
|
+
};
|
|
224
|
+
if (!(!data.errors && !response.data.errors)) return [3, 4];
|
|
225
|
+
return [4, API.leadService.createLead(leadPayload)];
|
|
226
|
+
case 3:
|
|
227
|
+
leadResponse = _f.sent();
|
|
228
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
229
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { password: params.password });
|
|
230
|
+
_f.label = 4;
|
|
231
|
+
case 4: return [2, { response: response.data, createAuthResponse: data, leadResponse: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, formData: params }];
|
|
211
232
|
}
|
|
212
233
|
});
|
|
213
234
|
}); });
|
|
@@ -256,15 +277,18 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
|
|
|
256
277
|
});
|
|
257
278
|
}); });
|
|
258
279
|
export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
|
-
var _a, settings, connect, headers, payload, data;
|
|
260
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
261
|
-
return __generator(this, function (
|
|
262
|
-
switch (
|
|
280
|
+
var _a, settings, connect, isNewUser, headers, payload, data;
|
|
281
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
282
|
+
return __generator(this, function (_m) {
|
|
283
|
+
switch (_m.label) {
|
|
263
284
|
case 0:
|
|
264
285
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
286
|
+
isNewUser = (_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
|
|
265
287
|
headers = {
|
|
266
|
-
lead_id:
|
|
267
|
-
|
|
288
|
+
lead_id: !isNewUser
|
|
289
|
+
? (_c = connect.data.passwordData.responseBody) === null || _c === void 0 ? void 0 : _c.lead_id
|
|
290
|
+
: ((_d = connect.data.otpData.responseBody) === null || _d === void 0 ? void 0 : _d.lead_id) || '',
|
|
291
|
+
device_identifier: (_f = (_e = settings.data.deviceInfo) === null || _e === void 0 ? void 0 : _e.browser) === null || _f === void 0 ? void 0 : _f.browser_id
|
|
268
292
|
};
|
|
269
293
|
payload = {
|
|
270
294
|
brand: {
|
|
@@ -273,8 +297,8 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
273
297
|
ar: params.brandName,
|
|
274
298
|
zh: params.brandName
|
|
275
299
|
},
|
|
276
|
-
website: (
|
|
277
|
-
social: [(
|
|
300
|
+
website: (_g = params.links) === null || _g === void 0 ? void 0 : _g.website,
|
|
301
|
+
social: [(_h = params.links) === null || _h === void 0 ? void 0 : _h.twitter, (_j = params.links) === null || _j === void 0 ? void 0 : _j.instagram]
|
|
278
302
|
},
|
|
279
303
|
terms_conditions_accepted: params.termAndConditionChecked,
|
|
280
304
|
step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
|
|
@@ -282,10 +306,10 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
|
|
|
282
306
|
};
|
|
283
307
|
return [4, API.leadService.updateLead(payload, { headers: headers })];
|
|
284
308
|
case 1:
|
|
285
|
-
data = (
|
|
309
|
+
data = (_m.sent()).data;
|
|
286
310
|
if (!data.errors) {
|
|
287
311
|
thunkApi.dispatch(handleNextScreenStep());
|
|
288
|
-
(
|
|
312
|
+
(_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, params);
|
|
289
313
|
}
|
|
290
314
|
return [2, { response: data, formData: params }];
|
|
291
315
|
}
|
|
@@ -411,6 +435,24 @@ export var connectSlice = createSlice({
|
|
|
411
435
|
},
|
|
412
436
|
stopLoader: function (state) {
|
|
413
437
|
state.loading = false;
|
|
438
|
+
},
|
|
439
|
+
resetMobileScreen: function (state) {
|
|
440
|
+
state.data.mobileData = __assign(__assign({}, state.data.mobileData), initialState.data.mobileData);
|
|
441
|
+
},
|
|
442
|
+
resetNIDScreen: function (state) {
|
|
443
|
+
state.data.nidData = __assign(__assign({}, state.data.nidData), initialState.data.nidData);
|
|
444
|
+
},
|
|
445
|
+
resetOTPScreen: function (state) {
|
|
446
|
+
state.data.otpData = __assign(__assign({}, state.data.otpData), initialState.data.otpData);
|
|
447
|
+
},
|
|
448
|
+
resetPasswordScreen: function (state) {
|
|
449
|
+
state.data.passwordData = initialState.data.passwordData;
|
|
450
|
+
},
|
|
451
|
+
resetIndividualScreen: function (state) {
|
|
452
|
+
state.data.individualData = initialState.data.individualData;
|
|
453
|
+
},
|
|
454
|
+
resetMerchantScreen: function (state) {
|
|
455
|
+
state.data.brandData = initialState.data.brandData;
|
|
414
456
|
}
|
|
415
457
|
},
|
|
416
458
|
extraReducers: function (builder) {
|
|
@@ -487,7 +529,7 @@ export var connectSlice = createSlice({
|
|
|
487
529
|
var name_1 = leadResponse.name, contact = leadResponse.contact;
|
|
488
530
|
var email = (contact || {}).email;
|
|
489
531
|
if (!!name_1) {
|
|
490
|
-
var capitalizedName = capitalizeTheFirstLetterOfEachWord((name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.last));
|
|
532
|
+
var capitalizedName = capitalizeTheFirstLetterOfEachWord((name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.third) + ' ' + (name_1 === null || name_1 === void 0 ? void 0 : name_1.last));
|
|
491
533
|
state.data.individualData.name = capitalizedName;
|
|
492
534
|
}
|
|
493
535
|
if (!!email)
|
|
@@ -504,24 +546,26 @@ export var connectSlice = createSlice({
|
|
|
504
546
|
state.loading = false;
|
|
505
547
|
state.error = action.error.message;
|
|
506
548
|
})
|
|
507
|
-
.addCase(
|
|
508
|
-
var _a;
|
|
549
|
+
.addCase(createVerifyAuthPassword.fulfilled, function (state, action) {
|
|
550
|
+
var _a, _b, _c;
|
|
509
551
|
state.loading = false;
|
|
510
552
|
state.error = null;
|
|
511
|
-
var
|
|
512
|
-
var
|
|
513
|
-
|
|
514
|
-
|
|
553
|
+
var _d = action.payload, formData = _d.formData, response = _d.response, createAuthResponse = _d.createAuthResponse, leadResponse = _d.leadResponse;
|
|
554
|
+
var error = ((_a = createAuthResponse === null || createAuthResponse === void 0 ? void 0 : createAuthResponse.errors) === null || _a === void 0 ? void 0 : _a[0]) || {};
|
|
555
|
+
var description = (((_b = response === null || response === void 0 ? void 0 : response.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
|
|
556
|
+
var leadError = ((_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.errors) === null || _c === void 0 ? void 0 : _c[0]) || {};
|
|
557
|
+
if ((error === null || error === void 0 ? void 0 : error.description) || description || (leadError === null || leadError === void 0 ? void 0 : leadError.description)) {
|
|
558
|
+
state.error = (error === null || error === void 0 ? void 0 : error.description) || description;
|
|
515
559
|
return;
|
|
516
560
|
}
|
|
517
561
|
state.data.passwordData.password = formData.password;
|
|
518
|
-
state.data.passwordData.responseBody =
|
|
562
|
+
state.data.passwordData.responseBody = leadResponse;
|
|
519
563
|
})
|
|
520
|
-
.addCase(
|
|
564
|
+
.addCase(createVerifyAuthPassword.pending, function (state) {
|
|
521
565
|
state.loading = true;
|
|
522
566
|
state.error = null;
|
|
523
567
|
})
|
|
524
|
-
.addCase(
|
|
568
|
+
.addCase(createVerifyAuthPassword.rejected, function (state, action) {
|
|
525
569
|
state.loading = false;
|
|
526
570
|
state.error = action.error.message;
|
|
527
571
|
})
|
|
@@ -605,6 +649,7 @@ export var connectSlice = createSlice({
|
|
|
605
649
|
state.error = description;
|
|
606
650
|
return;
|
|
607
651
|
}
|
|
652
|
+
removeRequestHeaders();
|
|
608
653
|
})
|
|
609
654
|
.addCase(updateLeadSuccess.pending, function (state) {
|
|
610
655
|
state.loading = true;
|
|
@@ -616,6 +661,6 @@ export var connectSlice = createSlice({
|
|
|
616
661
|
});
|
|
617
662
|
}
|
|
618
663
|
});
|
|
619
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader;
|
|
664
|
+
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen, resetPasswordScreen = _a.resetPasswordScreen;
|
|
620
665
|
export default connectSlice.reducer;
|
|
621
666
|
export var connectSelector = function (state) { return state.connect; };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REGEX_FULL_NAME } from '../../../../constants';
|
|
1
2
|
import * as yup from 'yup';
|
|
2
3
|
export var BankValidation = yup.object().shape({
|
|
3
4
|
iban: yup
|
|
@@ -9,6 +10,6 @@ export var BankValidation = yup.object().shape({
|
|
|
9
10
|
bankName: yup.string().required('bank_name_required'),
|
|
10
11
|
beneficiaryName: yup
|
|
11
12
|
.string()
|
|
12
|
-
.matches(
|
|
13
|
+
.matches(REGEX_FULL_NAME, 'beneficiary_name_invalid')
|
|
13
14
|
.required('beneficiary_name_required')
|
|
14
15
|
});
|
|
@@ -15,7 +15,7 @@ import { styled } from '@mui/material/styles';
|
|
|
15
15
|
import Box from '@mui/material/Box';
|
|
16
16
|
import { useAppTheme, useAppDispatch, useAppSelector, useAppConfig, useErrorListener } from '../../hooks';
|
|
17
17
|
import { settingsSelector } from '../../app/settings';
|
|
18
|
-
import { verifyLeadToken } from '../app/business/businessStore';
|
|
18
|
+
import { getCountries, verifyLeadToken } from '../app/business/businessStore';
|
|
19
19
|
import AnimationFlow from '../../components/AnimationFlow';
|
|
20
20
|
import { store } from '../../app/store';
|
|
21
21
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
@@ -41,7 +41,7 @@ var Business = memo(function (props) {
|
|
|
41
41
|
var theme = useAppTheme().theme;
|
|
42
42
|
var dispatch = useAppDispatch();
|
|
43
43
|
var data = useAppSelector(settingsSelector).data;
|
|
44
|
-
useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props));
|
|
44
|
+
var loading = useAppConfig(__assign({ navigation: BUSINESS_SCREENS_NAVIGATION }, props)).loading;
|
|
45
45
|
useErrorListener();
|
|
46
46
|
var activeScreen = data.activeScreen;
|
|
47
47
|
var verifyToken = function () {
|
|
@@ -51,7 +51,11 @@ var Business = memo(function (props) {
|
|
|
51
51
|
dispatch(verifyLeadToken(token));
|
|
52
52
|
};
|
|
53
53
|
useEffect(function () {
|
|
54
|
-
|
|
54
|
+
if (!loading)
|
|
55
|
+
verifyToken();
|
|
56
|
+
}, [loading]);
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
dispatch(getCountries());
|
|
55
59
|
}, []);
|
|
56
60
|
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(Container, { children: businessFeatureScreens.map(function (_a, index) {
|
|
57
61
|
var Element = _a.element, name = _a.name;
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
|
+
import { useSelector } from 'react-redux';
|
|
14
15
|
import { styled } from '@mui/material/styles';
|
|
15
16
|
import ActivitiesList from './ActivitiesList';
|
|
16
17
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
@@ -18,36 +19,34 @@ import { useAppDispatch, useLanguage } from '../../../../hooks';
|
|
|
18
19
|
import Form from '../../../../components/Form';
|
|
19
20
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
20
21
|
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import {
|
|
22
|
-
import { handleNextScreenStep, handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
-
import { ACTIVITIES, SALES_CHANNELS } from '../../../../constants';
|
|
22
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
24
23
|
import Button from '../../../shared/Button';
|
|
25
24
|
import SalesChannels from './SalesChannels';
|
|
26
25
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
27
26
|
import Collapse from '../../../../components/Collapse';
|
|
28
27
|
import OperationStartDate from './OperationStartDate';
|
|
28
|
+
import { businessSelector, updateActivitiesInfo } from '../../../app/business/businessStore';
|
|
29
|
+
import { ActivitiesValidationSchema } from './validation';
|
|
29
30
|
var FormStyled = styled(Form)(function () { return ({
|
|
30
31
|
display: 'flex',
|
|
31
32
|
flexDirection: 'column'
|
|
32
33
|
}); });
|
|
33
34
|
var Activities = function () {
|
|
34
|
-
var _a
|
|
35
|
-
var _b = React.useState(false),
|
|
35
|
+
var _a;
|
|
36
|
+
var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
37
|
+
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
36
38
|
var dispatch = useAppDispatch();
|
|
37
39
|
var isAr = useLanguage().isAr;
|
|
38
40
|
var t = useTranslation().t;
|
|
41
|
+
var data = useSelector(businessSelector).data;
|
|
42
|
+
var response = data.businessInfo.responseBody;
|
|
39
43
|
var methods = useForm({
|
|
40
44
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
41
|
-
defaultValues:
|
|
42
|
-
activities: [ACTIVITIES[0]],
|
|
43
|
-
salesChannels: [SALES_CHANNELS[0]],
|
|
44
|
-
operationStartDate: '2000-01-01'
|
|
45
|
-
},
|
|
45
|
+
defaultValues: data.activitiesData,
|
|
46
46
|
mode: 'onChange'
|
|
47
47
|
});
|
|
48
48
|
var onSubmit = function (data) {
|
|
49
|
-
|
|
50
|
-
dispatch(handleNextScreenStep());
|
|
49
|
+
dispatch(updateActivitiesInfo(__assign({}, data)));
|
|
51
50
|
};
|
|
52
51
|
var handleCollapseOpenClose = function (flag) {
|
|
53
52
|
console.log('flag', flag);
|
|
@@ -59,6 +58,7 @@ var Activities = function () {
|
|
|
59
58
|
var handleMenuClick = function () {
|
|
60
59
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
var activities_list = ((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
62
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [!!activities_list && (_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid }, { children: t('next') })) }))] })) })) }));
|
|
63
63
|
};
|
|
64
64
|
export default Activities;
|
|
@@ -15,7 +15,7 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
15
15
|
export declare const InputStyled: import("@emotion/styled").StyledComponent<Pick<import("../../../../components/Input").InputProps, "name" | "type" | "className" | "style" | "classes" | "color" | "margin" | "translate" | "slot" | "title" | "ref" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "size" | "disabled" | "error" | "components" | "componentsProps" | "value" | "autoFocus" | "fullWidth" | "required" | "rows" | "inputProps" | "inputRef" | "readOnly" | "autoComplete" | "disableInjectingGlobalStyles" | "endAdornment" | "inputComponent" | "multiline" | "renderSuffix" | "maxRows" | "minRows" | "startAdornment" | "disableUnderline" | "onEnterPressed" | "warningMessage"> & {
|
|
16
16
|
placeholder?: string | undefined;
|
|
17
17
|
hide?: boolean | undefined;
|
|
18
|
-
warningType?: "alert" | "error" | undefined;
|
|
18
|
+
warningType?: "alert" | "error" | "hint" | undefined;
|
|
19
19
|
} & {} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
20
20
|
export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<{
|
|
21
21
|
children?: React.ReactNode;
|
|
@@ -28,7 +28,7 @@ export declare const CheckIconStyled: import("@emotion/styled").StyledComponent<
|
|
|
28
28
|
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
29
29
|
titleAccess?: string | undefined;
|
|
30
30
|
viewBox?: string | undefined;
|
|
31
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "key" | "id" | "lang" | "tabIndex" | "role" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "spacing" | "elevation" | "in" | "max" | "href" | "orientation" | "media" | "target" | "origin" | "min" | "viewBox" | "
|
|
31
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "key" | "id" | "lang" | "tabIndex" | "role" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "method" | "spacing" | "elevation" | "in" | "max" | "href" | "orientation" | "media" | "target" | "origin" | "min" | "viewBox" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & {
|
|
32
32
|
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
33
33
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
34
34
|
export declare const NameContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
@@ -31,6 +31,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
31
31
|
};
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
33
|
import * as React from 'react';
|
|
34
|
+
import { useSelector } from 'react-redux';
|
|
34
35
|
import Box from '@mui/material/Box';
|
|
35
36
|
import { alpha, styled } from '@mui/material/styles';
|
|
36
37
|
import Text from '../../../../components/Text';
|
|
@@ -38,12 +39,12 @@ import Input from '../../../../components/Input';
|
|
|
38
39
|
import { useTranslation } from 'react-i18next';
|
|
39
40
|
import { useController, useFormContext } from 'react-hook-form';
|
|
40
41
|
import { useLanguage } from '../../../../hooks';
|
|
41
|
-
import { ACTIVITIES } from '../../../../constants';
|
|
42
42
|
import { BusinessType } from '../../../../@types';
|
|
43
43
|
import Collapse from '../../../../components/Collapse';
|
|
44
44
|
import SimpleList from '../../../../components/SimpleList';
|
|
45
45
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
46
46
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
47
|
+
import { businessSelector } from '../../../app/business/businessStore';
|
|
47
48
|
import CheckIcon from '@mui/icons-material/Check';
|
|
48
49
|
import { MandatoryStyled } from './SalesChannels';
|
|
49
50
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
@@ -76,15 +77,24 @@ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { r
|
|
|
76
77
|
});
|
|
77
78
|
var ActivitiesList = function (_a) {
|
|
78
79
|
var rest = __rest(_a, []);
|
|
79
|
-
var
|
|
80
|
-
var
|
|
80
|
+
var _b = React.useState([]), activitiesMenuList = _b[0], setActivitiesMenuList = _b[1];
|
|
81
|
+
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
81
82
|
var t = useTranslation().t;
|
|
82
83
|
var isAr = useLanguage().isAr;
|
|
83
84
|
var control = useFormContext().control;
|
|
84
85
|
var activitiesControl = useController({ name: 'activities', control: control });
|
|
85
86
|
var controlValue = activitiesControl.field.value;
|
|
86
|
-
var
|
|
87
|
+
var data = useSelector(businessSelector).data;
|
|
88
|
+
var businessTypeData = data.businessTypeData;
|
|
89
|
+
var response = businessTypeData.responseBody;
|
|
90
|
+
var businessType = businessTypeData.businessType;
|
|
87
91
|
var isCR = businessType === BusinessType.CR;
|
|
92
|
+
React.useEffect(function () {
|
|
93
|
+
var _a;
|
|
94
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.activities) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
95
|
+
setActivitiesMenuList(response === null || response === void 0 ? void 0 : response.activities);
|
|
96
|
+
}
|
|
97
|
+
}, [response === null || response === void 0 ? void 0 : response.activities]);
|
|
88
98
|
var onOpenList = function (event) {
|
|
89
99
|
var _a;
|
|
90
100
|
setAnchorEl(event.currentTarget);
|
|
@@ -14,7 +14,7 @@ import { InputLabelStyled } from './ActivitiesList';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import DatePicker from '../../../../components/DatePicker';
|
|
17
|
-
import { ScreenContainer } from '
|
|
17
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
18
|
import { MandatoryStyled } from './SalesChannels';
|
|
19
19
|
var OperationStartDate = function (_a) {
|
|
20
20
|
var _b;
|
|
@@ -20,13 +20,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
import * as React from 'react';
|
|
23
|
+
import { useSelector } from 'react-redux';
|
|
23
24
|
import Box from '@mui/material/Box';
|
|
24
25
|
import { alpha, styled } from '@mui/material/styles';
|
|
25
26
|
import { useTranslation } from 'react-i18next';
|
|
26
27
|
import { useController, useFormContext } from 'react-hook-form';
|
|
27
28
|
import { useLanguage } from '../../../../hooks';
|
|
28
29
|
import Text from '../../../../components/Text';
|
|
29
|
-
import {
|
|
30
|
+
import { businessSelector } from '../../../app/business/businessStore';
|
|
30
31
|
import CheckBox from '../../../../components/CheckBox';
|
|
31
32
|
import Warning from '../../../../components/Warning';
|
|
32
33
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -75,13 +76,21 @@ export var CollapseStyled = styled(Collapse)(function (_a) {
|
|
|
75
76
|
});
|
|
76
77
|
var SalesChannels = function () {
|
|
77
78
|
var _a;
|
|
78
|
-
var
|
|
79
|
+
var _b = React.useState([]), channelsMenuList = _b[0], setChannelsMenuList = _b[1];
|
|
79
80
|
var t = useTranslation().t;
|
|
80
81
|
var isAr = useLanguage().isAr;
|
|
81
82
|
var control = useFormContext().control;
|
|
82
83
|
var channelsControl = useController({ name: 'salesChannels', control: control });
|
|
83
84
|
var channelsChecked = channelsControl.field.value;
|
|
84
85
|
var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
86
|
+
var data = useSelector(businessSelector).data;
|
|
87
|
+
var response = data.businessInfo.responseBody;
|
|
88
|
+
React.useEffect(function () {
|
|
89
|
+
var _a;
|
|
90
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.channelList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
91
|
+
setChannelsMenuList(response === null || response === void 0 ? void 0 : response.channelList);
|
|
92
|
+
}
|
|
93
|
+
}, [response === null || response === void 0 ? void 0 : response.channelList]);
|
|
85
94
|
var handleSalesChannelChange = function (event, checked) {
|
|
86
95
|
var selected = channelsMenuList.find(function (channel) { return channel.id.toString() === event.target.id; });
|
|
87
96
|
var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BusinessType as BusinessTypeEnum } from '../../../../@types';
|
|
3
2
|
export interface BusinessTypeProps {
|
|
4
|
-
businessType: BusinessTypeEnum;
|
|
5
3
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<{
|
|
7
|
-
({ businessType }: BusinessTypeProps): JSX.Element;
|
|
8
|
-
defaultProps: {
|
|
9
|
-
businessType: BusinessTypeEnum;
|
|
10
|
-
};
|
|
11
|
-
}>;
|
|
4
|
+
declare const _default: React.MemoExoticComponent<({}: BusinessTypeProps) => JSX.Element>;
|
|
12
5
|
export default _default;
|