@tap-payments/auth-jsconnect 1.0.40 → 1.0.44
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 +10 -33
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +5 -1
- package/build/api/entity.d.ts +5 -6
- package/build/api/index.d.ts +2 -2
- package/build/api/lead.d.ts +1 -2
- package/build/api/lead.js +3 -7
- package/build/components/AnimationFlow/BottomSheet.js +5 -23
- package/build/components/Footer/Footer.d.ts +3 -1
- package/build/components/Footer/Footer.js +11 -47
- package/build/constants/api.d.ts +2 -2
- package/build/constants/api.js +5 -5
- package/build/constants/dummy.d.ts +14 -36
- package/build/constants/dummy.js +29 -53
- package/build/features/app/business/businessStore.d.ts +9 -7
- package/build/features/app/business/businessStore.js +98 -60
- package/build/features/app/connect/connectStore.js +1 -1
- package/build/features/business/screens/Activities/Activities.js +6 -1
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
- package/build/features/business/screens/BusinessType/CompanyLicense.d.ts +2 -2
- package/build/features/business/screens/BusinessType/CompanyLicense.js +9 -6
- package/build/features/business/screens/BusinessType/FreelanceLicense.d.ts +2 -2
- package/build/features/business/screens/BusinessType/FreelanceLicense.js +9 -9
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.js +14 -4
- package/build/features/business/screens/Customers/Customers.js +17 -10
- package/build/features/business/screens/Customers/ExpectedCustomers.js +14 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +14 -4
- package/build/features/connect/screens/Individual/Email.js +1 -1
- package/build/features/connect/screens/Merchant/BrandName.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +1 -2
- package/build/features/connect/screens/NID/NID.js +1 -2
- package/build/features/shared/Containers/FeatureContainer.js +1 -1
- package/build/features/shared/Containers/ScreenContainer.js +1 -1
- package/build/features/shared/Footer/Footer.js +7 -1
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/hooks/useElementSizeById.d.ts +6 -0
- package/build/hooks/useElementSizeById.js +12 -0
- package/package.json +126 -126
|
@@ -173,7 +173,7 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
173
173
|
}
|
|
174
174
|
});
|
|
175
175
|
}); });
|
|
176
|
-
export var
|
|
176
|
+
export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
177
177
|
var business, leadId, data;
|
|
178
178
|
var _a;
|
|
179
179
|
return __generator(this, function (_b) {
|
|
@@ -181,22 +181,7 @@ export var retrieveCRInfos = createAsyncThunk('retrieveCRInfos', function (param
|
|
|
181
181
|
case 0:
|
|
182
182
|
business = thunkApi.getState().business;
|
|
183
183
|
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
184
|
-
return [4, API.leadService.
|
|
185
|
-
case 1:
|
|
186
|
-
data = (_b.sent()).data;
|
|
187
|
-
return [2, { data: data }];
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
}); });
|
|
191
|
-
export var retrieveFLInfos = createAsyncThunk('retrieveFLInfos', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
-
var business, leadId, data;
|
|
193
|
-
var _a;
|
|
194
|
-
return __generator(this, function (_b) {
|
|
195
|
-
switch (_b.label) {
|
|
196
|
-
case 0:
|
|
197
|
-
business = thunkApi.getState().business;
|
|
198
|
-
leadId = (_a = business.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.id;
|
|
199
|
-
return [4, API.leadService.retrieveFLInfos(leadId)];
|
|
184
|
+
return [4, API.leadService.retrieveEntityList(leadId)];
|
|
200
185
|
case 1:
|
|
201
186
|
data = (_b.sent()).data;
|
|
202
187
|
return [2, { data: data }];
|
|
@@ -265,52 +250,86 @@ export var createAccount = createAsyncThunk('createAccount', function (params, t
|
|
|
265
250
|
});
|
|
266
251
|
}); });
|
|
267
252
|
export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
-
var _a, settings, business, requestBody, headers, data;
|
|
269
|
-
var _b, _c, _d;
|
|
270
|
-
return __generator(this, function (
|
|
271
|
-
switch (
|
|
253
|
+
var _a, settings, business, channel, activities, requestBody, headers, data;
|
|
254
|
+
var _b, _c, _d, _e;
|
|
255
|
+
return __generator(this, function (_f) {
|
|
256
|
+
switch (_f.label) {
|
|
272
257
|
case 0:
|
|
273
258
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
259
|
+
channel = params.salesChannels.map(function (_a) {
|
|
260
|
+
var value = _a.value;
|
|
261
|
+
return value;
|
|
262
|
+
});
|
|
263
|
+
activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
264
|
+
var id = _a.id;
|
|
265
|
+
return id === null || id === void 0 ? void 0 : id.toString();
|
|
266
|
+
});
|
|
274
267
|
requestBody = {
|
|
275
|
-
activities:
|
|
276
|
-
channel_services:
|
|
268
|
+
activities: activities,
|
|
269
|
+
channel_services: channel,
|
|
277
270
|
business_operation_start_at: params.operationStartDate,
|
|
278
271
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES
|
|
279
272
|
};
|
|
280
|
-
headers = { entity_id: (
|
|
273
|
+
headers = { entity_id: (_c = business.data.businessInfo.responseBody) === null || _c === void 0 ? void 0 : _c.entity_id };
|
|
281
274
|
return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
|
|
282
275
|
case 1:
|
|
283
|
-
data = (
|
|
276
|
+
data = (_f.sent()).data;
|
|
284
277
|
if (!data.errors) {
|
|
278
|
+
thunkApi.dispatch(retrieveDataList());
|
|
285
279
|
thunkApi.dispatch(handleNextScreenStep());
|
|
286
|
-
(
|
|
280
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, requestBody);
|
|
287
281
|
}
|
|
288
282
|
return [2, { data: data, formData: __assign({}, params) }];
|
|
289
283
|
}
|
|
290
284
|
});
|
|
291
285
|
}); });
|
|
286
|
+
export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
287
|
+
var customerBases, expectedSales, expectedCustomerSales;
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0: return [4, API.dataService.getCustomerBases()];
|
|
291
|
+
case 1:
|
|
292
|
+
customerBases = _a.sent();
|
|
293
|
+
return [4, API.dataService.getExpectedSales()];
|
|
294
|
+
case 2:
|
|
295
|
+
expectedSales = _a.sent();
|
|
296
|
+
return [4, API.dataService.getExpectedCutomerSales()];
|
|
297
|
+
case 3:
|
|
298
|
+
expectedCustomerSales = _a.sent();
|
|
299
|
+
return [2, {
|
|
300
|
+
customerBasesData: customerBases === null || customerBases === void 0 ? void 0 : customerBases.data,
|
|
301
|
+
expectedSalesData: expectedSales === null || expectedSales === void 0 ? void 0 : expectedSales.data,
|
|
302
|
+
expectedCustomerSalesData: expectedCustomerSales === null || expectedCustomerSales === void 0 ? void 0 : expectedCustomerSales.data
|
|
303
|
+
}];
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}); });
|
|
292
307
|
export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
293
|
-
var _a, settings, business, requestBody, headers, data;
|
|
294
|
-
var _b, _c, _d;
|
|
295
|
-
return __generator(this, function (
|
|
296
|
-
switch (
|
|
308
|
+
var _a, settings, business, customerBase, requestBody, headers, data;
|
|
309
|
+
var _b, _c, _d, _e, _f;
|
|
310
|
+
return __generator(this, function (_g) {
|
|
311
|
+
switch (_g.label) {
|
|
297
312
|
case 0:
|
|
298
313
|
_a = thunkApi.getState(), settings = _a.settings, business = _a.business;
|
|
314
|
+
customerBase = params.customerLocations.map(function (_a) {
|
|
315
|
+
var value = _a.value;
|
|
316
|
+
return value;
|
|
317
|
+
});
|
|
299
318
|
requestBody = {
|
|
300
|
-
customers_base:
|
|
301
|
-
customers_served_monthly: params.expectedCustomers,
|
|
302
|
-
yearly_sales_range: params.
|
|
319
|
+
customers_base: customerBase,
|
|
320
|
+
customers_served_monthly: ((_b = params.expectedCustomers) === null || _b === void 0 ? void 0 : _b.value) || '',
|
|
321
|
+
yearly_sales_range: ((_c = params.expectedCustomers) === null || _c === void 0 ? void 0 : _c.value) || '',
|
|
303
322
|
agree_refund: params.refundPolicy,
|
|
304
323
|
agree_chargeback: params.transactionPolicy,
|
|
305
324
|
step_name: BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS
|
|
306
325
|
};
|
|
307
|
-
headers = { entity_id: (
|
|
326
|
+
headers = { entity_id: (_d = business.data.otpData.responseBody) === null || _d === void 0 ? void 0 : _d.id };
|
|
308
327
|
return [4, API.entityService.updateEntityInfo(requestBody, { headers: headers })];
|
|
309
328
|
case 1:
|
|
310
|
-
data = (
|
|
329
|
+
data = (_g.sent()).data;
|
|
311
330
|
if (!data.errors) {
|
|
312
331
|
thunkApi.dispatch(handleNextScreenStep());
|
|
313
|
-
(
|
|
332
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
|
|
314
333
|
}
|
|
315
334
|
return [2, { data: data, formData: __assign({}, params) }];
|
|
316
335
|
}
|
|
@@ -476,43 +495,29 @@ export var businessSlice = createSlice({
|
|
|
476
495
|
state.loading = false;
|
|
477
496
|
state.error = action.error.message;
|
|
478
497
|
})
|
|
479
|
-
.addCase(
|
|
498
|
+
.addCase(retrieveEntityList.pending, function (state) {
|
|
480
499
|
state.loading = true;
|
|
481
500
|
state.error = null;
|
|
482
501
|
})
|
|
483
|
-
.addCase(
|
|
502
|
+
.addCase(retrieveEntityList.fulfilled, function (state, action) {
|
|
484
503
|
var _a;
|
|
485
504
|
state.loading = false;
|
|
486
505
|
state.error = null;
|
|
487
506
|
var data = action.payload.data;
|
|
488
507
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
489
508
|
if (!description) {
|
|
490
|
-
|
|
491
|
-
|
|
509
|
+
var fl = data.fl, cr = data.cr;
|
|
510
|
+
if (Array.isArray(cr)) {
|
|
511
|
+
state.data.crInfos = cr;
|
|
492
512
|
state.data.businessTypeData.businessType = BusinessType.CR;
|
|
493
513
|
}
|
|
514
|
+
if (Array.isArray(fl)) {
|
|
515
|
+
state.data.flInfos = fl;
|
|
516
|
+
state.data.businessTypeData.businessType = BusinessType.FL;
|
|
517
|
+
}
|
|
494
518
|
}
|
|
495
519
|
})
|
|
496
|
-
.addCase(
|
|
497
|
-
state.loading = false;
|
|
498
|
-
state.error = action.error.message;
|
|
499
|
-
})
|
|
500
|
-
.addCase(retrieveFLInfos.pending, function (state) {
|
|
501
|
-
state.loading = true;
|
|
502
|
-
state.error = null;
|
|
503
|
-
})
|
|
504
|
-
.addCase(retrieveFLInfos.fulfilled, function (state, action) {
|
|
505
|
-
var _a;
|
|
506
|
-
state.loading = false;
|
|
507
|
-
state.error = null;
|
|
508
|
-
var data = action.payload.data;
|
|
509
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
510
|
-
if (!description) {
|
|
511
|
-
state.data.flInfos = data === null || data === void 0 ? void 0 : data.licenses;
|
|
512
|
-
state.data.businessTypeData.businessType = BusinessType.FL;
|
|
513
|
-
}
|
|
514
|
-
})
|
|
515
|
-
.addCase(retrieveFLInfos.rejected, function (state, action) {
|
|
520
|
+
.addCase(retrieveEntityList.rejected, function (state, action) {
|
|
516
521
|
state.loading = false;
|
|
517
522
|
state.error = action.error.message;
|
|
518
523
|
})
|
|
@@ -600,6 +605,39 @@ export var businessSlice = createSlice({
|
|
|
600
605
|
.addCase(updateActivitiesInfo.rejected, function (state, action) {
|
|
601
606
|
state.loading = false;
|
|
602
607
|
state.error = action.error.message;
|
|
608
|
+
})
|
|
609
|
+
.addCase(retrieveDataList.pending, function (state) {
|
|
610
|
+
state.loading = true;
|
|
611
|
+
state.error = null;
|
|
612
|
+
})
|
|
613
|
+
.addCase(retrieveDataList.fulfilled, function (state, action) {
|
|
614
|
+
var _a, _b, _c;
|
|
615
|
+
state.loading = false;
|
|
616
|
+
state.error = null;
|
|
617
|
+
var _d = action.payload, customerBasesData = _d.customerBasesData, expectedSalesData = _d.expectedSalesData, expectedCustomerSalesData = _d.expectedCustomerSalesData;
|
|
618
|
+
var description = (((_a = customerBasesData === null || customerBasesData === void 0 ? void 0 : customerBasesData.errors) === null || _a === void 0 ? void 0 : _a[0]) ||
|
|
619
|
+
((_b = expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData.errors) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
620
|
+
((_c = expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData.errors) === null || _c === void 0 ? void 0 : _c[0]) ||
|
|
621
|
+
{}).description;
|
|
622
|
+
if (description) {
|
|
623
|
+
state.error = description;
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
var data = state.data.activitiesData.responseBody;
|
|
627
|
+
state.data.activitiesData.responseBody = __assign(__assign({}, data), { customerBases: customerBasesData || [], expectedSales: expectedSalesData.data || [], expectedCustomerSales: expectedCustomerSalesData.data || [] });
|
|
628
|
+
var selectedCustomerBase = customerBasesData === null || customerBasesData === void 0 ? void 0 : customerBasesData[0];
|
|
629
|
+
if (!!selectedCustomerBase)
|
|
630
|
+
state.data.customersData.customerLocations = [selectedCustomerBase];
|
|
631
|
+
var selectedExpectedSale = expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData[(expectedSalesData === null || expectedSalesData === void 0 ? void 0 : expectedSalesData.length) - 1];
|
|
632
|
+
if (!!selectedExpectedSale)
|
|
633
|
+
state.data.customersData.expectedSalesRange = selectedExpectedSale;
|
|
634
|
+
var selectedExpectedCustomerSale = expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData[(expectedCustomerSalesData === null || expectedCustomerSalesData === void 0 ? void 0 : expectedCustomerSalesData.length) - 1];
|
|
635
|
+
if (!!selectedExpectedCustomerSale)
|
|
636
|
+
state.data.customersData.expectedCustomers = selectedExpectedCustomerSale;
|
|
637
|
+
})
|
|
638
|
+
.addCase(retrieveDataList.rejected, function (state, action) {
|
|
639
|
+
state.loading = false;
|
|
640
|
+
state.error = action.error.message;
|
|
603
641
|
})
|
|
604
642
|
.addCase(updateCustomersInfo.pending, function (state) {
|
|
605
643
|
state.loading = true;
|
|
@@ -535,7 +535,7 @@ export var connectSlice = createSlice({
|
|
|
535
535
|
var firstName = (name_1 === null || name_1 === void 0 ? void 0 : name_1.first) + ' ';
|
|
536
536
|
var middleName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.middle) + ' ' : '';
|
|
537
537
|
var thirdName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.third) ? (name_1 === null || name_1 === void 0 ? void 0 : name_1.third) + ' ' : '';
|
|
538
|
-
var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.
|
|
538
|
+
var lastName = !!(name_1 === null || name_1 === void 0 ? void 0 : name_1.last) ? name_1 === null || name_1 === void 0 ? void 0 : name_1.last : '';
|
|
539
539
|
if (!!name_1) {
|
|
540
540
|
var capitalizedName = capitalizeTheFirstLetterOfEachWord(firstName + middleName + thirdName + lastName);
|
|
541
541
|
state.data.individualData.name = capitalizedName;
|
|
@@ -40,9 +40,10 @@ var Activities = function () {
|
|
|
40
40
|
var t = useTranslation().t;
|
|
41
41
|
var _d = useSelector(businessSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
42
42
|
var businessTypeResponse = data.businessTypeData.responseBody;
|
|
43
|
+
var activitiesData = data.activitiesData;
|
|
43
44
|
var methods = useForm({
|
|
44
45
|
resolver: yupResolver(ActivitiesValidationSchema),
|
|
45
|
-
defaultValues:
|
|
46
|
+
defaultValues: activitiesData,
|
|
46
47
|
mode: 'onChange'
|
|
47
48
|
});
|
|
48
49
|
var onSubmit = function (data) {
|
|
@@ -55,6 +56,10 @@ var Activities = function () {
|
|
|
55
56
|
var onBack = function () {
|
|
56
57
|
dispatch(handlePrevScreenStep());
|
|
57
58
|
};
|
|
59
|
+
React.useEffect(function () {
|
|
60
|
+
var salesChannels = activitiesData.salesChannels;
|
|
61
|
+
methods.setValue('salesChannels', salesChannels);
|
|
62
|
+
}, [activitiesData.salesChannels]);
|
|
58
63
|
React.useEffect(function () {
|
|
59
64
|
if (error)
|
|
60
65
|
dispatch(clearError());
|
|
@@ -12,7 +12,7 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
12
12
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
13
13
|
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
14
14
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
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" | "
|
|
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" | "value" | "components" | "componentsProps" | "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
18
|
warningType?: "alert" | "error" | "hint" | undefined;
|
|
@@ -21,7 +21,7 @@ import Form from '../../../../components/Form';
|
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
22
22
|
import { useLanguage } from '../../../../hooks';
|
|
23
23
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
24
|
-
import { businessSelector, clearError,
|
|
24
|
+
import { businessSelector, clearError, retrieveEntityList, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
25
25
|
import { BusinessType as BusinessTypeEnum } from '../../../../@types';
|
|
26
26
|
import Button from '../../../shared/Button';
|
|
27
27
|
import { CRValidationSchema, FLValidationSchema } from './validation';
|
|
@@ -42,8 +42,7 @@ var BusinessType = function (_a) {
|
|
|
42
42
|
mode: 'onChange'
|
|
43
43
|
});
|
|
44
44
|
React.useEffect(function () {
|
|
45
|
-
dispatch(
|
|
46
|
-
dispatch(retrieveCRInfos());
|
|
45
|
+
dispatch(retrieveEntityList());
|
|
47
46
|
}, []);
|
|
48
47
|
React.useEffect(function () {
|
|
49
48
|
var businessType = businessTypeData.businessType;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { License } from '../../../../@types';
|
|
3
3
|
interface CompanyLicenseProps {
|
|
4
4
|
show: boolean;
|
|
5
|
-
list: Array<
|
|
5
|
+
list: Array<License>;
|
|
6
6
|
onSelectLicense?: (number: string) => void;
|
|
7
7
|
onListOpen?: () => void;
|
|
8
8
|
onListClose?: () => void;
|
|
@@ -43,7 +43,7 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
43
43
|
import Text from '../../../../components/Text';
|
|
44
44
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
45
45
|
import Collapse from '../../../../components/Collapse';
|
|
46
|
-
import {
|
|
46
|
+
import { OTHER_LICENSE } from '../../../../constants';
|
|
47
47
|
import CRNumber from './CRNumber';
|
|
48
48
|
var InputStyled = styled(Input)(function (_a) {
|
|
49
49
|
var theme = _a.theme;
|
|
@@ -88,19 +88,22 @@ var CompanyLicense = function (_a) {
|
|
|
88
88
|
setSelectedLicense(first);
|
|
89
89
|
setValue('crNumber', getLicenseNumber(first), { shouldValidate: true });
|
|
90
90
|
if (!hasOther)
|
|
91
|
-
array = __spreadArray(__spreadArray([], array, true), [
|
|
91
|
+
array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
|
|
92
92
|
setLicenseList(array);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}, [show, list]);
|
|
96
96
|
var getLicenseNumber = function (item) {
|
|
97
|
-
|
|
97
|
+
var _a;
|
|
98
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
98
99
|
};
|
|
99
100
|
var getLicenseName = function (item) {
|
|
100
|
-
|
|
101
|
+
var _a, _b;
|
|
102
|
+
return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
101
103
|
};
|
|
102
104
|
var isOtherLicense = function (item) {
|
|
103
|
-
|
|
105
|
+
var _a;
|
|
106
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.en) === 'other';
|
|
104
107
|
};
|
|
105
108
|
var onSelectItem = function (license) {
|
|
106
109
|
setSelectedLicense(license);
|
|
@@ -112,7 +115,7 @@ var CompanyLicense = function (_a) {
|
|
|
112
115
|
};
|
|
113
116
|
var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
|
|
114
117
|
var showCRNumber = !anchorEl;
|
|
115
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_commercial_register_no'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: '
|
|
118
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_commercial_register_no'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
116
119
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
|
|
117
120
|
? t(getLicenseNumber(item))
|
|
118
121
|
: isAr
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { License } from '../../../../@types';
|
|
3
3
|
interface FreelanceLicenseProps {
|
|
4
4
|
show: boolean;
|
|
5
|
-
list: Array<
|
|
5
|
+
list: Array<License>;
|
|
6
6
|
onSelectLicense?: (number: string) => void;
|
|
7
7
|
onListOpen?: () => void;
|
|
8
8
|
onListClose?: () => void;
|
|
@@ -42,7 +42,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
42
42
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
43
43
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
44
44
|
import Input from '../../../shared/Input';
|
|
45
|
-
import {
|
|
45
|
+
import { OTHER_LICENSE } from '../../../../constants';
|
|
46
46
|
import SimpleList from '../../../../components/SimpleList';
|
|
47
47
|
import FLNumber from './FLNumber';
|
|
48
48
|
var InputStyled = styled(Input)(function (_a) {
|
|
@@ -88,22 +88,22 @@ var FreelanceLicense = function (_a) {
|
|
|
88
88
|
setSelectedLicense(first);
|
|
89
89
|
setValue('flNumber', getLicenseNumber(first), { shouldValidate: true });
|
|
90
90
|
if (!hasOther)
|
|
91
|
-
array = __spreadArray(__spreadArray([], array, true), [
|
|
91
|
+
array = __spreadArray(__spreadArray([], array, true), [OTHER_LICENSE], false);
|
|
92
92
|
setLicenseList(array);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}, [show, list]);
|
|
96
96
|
var getLicenseNumber = function (item) {
|
|
97
|
-
|
|
97
|
+
var _a;
|
|
98
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
98
99
|
};
|
|
99
100
|
var isOtherLicense = function (item) {
|
|
100
|
-
|
|
101
|
+
var _a;
|
|
102
|
+
return ((_a = item === null || item === void 0 ? void 0 : item.license) === null || _a === void 0 ? void 0 : _a.number) === 'other';
|
|
101
103
|
};
|
|
102
104
|
var getLicenseName = function (item) {
|
|
103
|
-
var _a, _b
|
|
104
|
-
return ((
|
|
105
|
-
? (_c = (_b = (_a = item === null || item === void 0 ? void 0 : item.license_specialities) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.speciality) === null || _c === void 0 ? void 0 : _c.name
|
|
106
|
-
: (_f = (_e = (_d = item === null || item === void 0 ? void 0 : item.license_specialities) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.speciality) === null || _f === void 0 ? void 0 : _f.name_en) || '');
|
|
105
|
+
var _a, _b;
|
|
106
|
+
return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
107
107
|
};
|
|
108
108
|
var onSelectItem = function (license) {
|
|
109
109
|
setSelectedLicense(license);
|
|
@@ -115,7 +115,7 @@ var FreelanceLicense = function (_a) {
|
|
|
115
115
|
};
|
|
116
116
|
var hasList = (licenseList === null || licenseList === void 0 ? void 0 : licenseList.length) > 0;
|
|
117
117
|
var showFLNumber = !anchorEl;
|
|
118
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_freelance_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_fl'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: '
|
|
118
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('enter_freelance_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_fl'), value: t(getLicenseName(selectedLicense)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
119
119
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selectedLicense) }, { children: isOtherLicense(item)
|
|
120
120
|
? t(getLicenseNumber(item))
|
|
121
121
|
: isAr
|
|
@@ -12,7 +12,7 @@ export declare const InputLabelStyled: import("@emotion/styled").StyledComponent
|
|
|
12
12
|
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
13
13
|
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
14
14
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
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" | "
|
|
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" | "value" | "components" | "componentsProps" | "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
18
|
warningType?: "alert" | "error" | "hint" | undefined;
|
|
@@ -22,6 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import * as React from 'react';
|
|
25
|
+
import { useSelector } from 'react-redux';
|
|
25
26
|
import Box from '@mui/material/Box';
|
|
26
27
|
import { useTranslation } from 'react-i18next';
|
|
27
28
|
import { useController, useFormContext } from 'react-hook-form';
|
|
@@ -34,7 +35,7 @@ import Input from '../../../../components/Input';
|
|
|
34
35
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
36
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
36
37
|
import { useLanguage } from '../../../../hooks';
|
|
37
|
-
import {
|
|
38
|
+
import { businessSelector } from '../../../app/business/businessStore';
|
|
38
39
|
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
39
40
|
var theme = _a.theme;
|
|
40
41
|
return (__assign({ margin: theme.spacing(2.5, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
@@ -73,12 +74,15 @@ var SimpleListStyled = styled((SimpleList))(function () { return ({
|
|
|
73
74
|
}); });
|
|
74
75
|
var customerLocations = function (_a) {
|
|
75
76
|
var rest = __rest(_a, []);
|
|
76
|
-
var
|
|
77
|
-
var
|
|
77
|
+
var _b = React.useState([]), customerLocationsList = _b[0], setCustomerLocationsList = _b[1];
|
|
78
|
+
var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
|
|
78
79
|
var t = useTranslation().t;
|
|
79
80
|
var isAr = useLanguage().isAr;
|
|
80
81
|
var control = useFormContext().control;
|
|
81
82
|
var customerLocationsControl = useController({ name: 'customerLocations', control: control });
|
|
83
|
+
var data = useSelector(businessSelector).data;
|
|
84
|
+
var activitiesData = data.activitiesData;
|
|
85
|
+
var response = activitiesData.responseBody;
|
|
82
86
|
var onOpenList = function (event) {
|
|
83
87
|
var _a;
|
|
84
88
|
setAnchorEl(event.currentTarget);
|
|
@@ -89,6 +93,12 @@ var customerLocations = function (_a) {
|
|
|
89
93
|
setAnchorEl(null);
|
|
90
94
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
91
95
|
};
|
|
96
|
+
React.useEffect(function () {
|
|
97
|
+
var _a;
|
|
98
|
+
if (((_a = response === null || response === void 0 ? void 0 : response.customerBases) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
99
|
+
setCustomerLocationsList(response === null || response === void 0 ? void 0 : response.customerBases);
|
|
100
|
+
}
|
|
101
|
+
}, [response === null || response === void 0 ? void 0 : response.customerBases]);
|
|
92
102
|
var checkRemainingCondition = function (item) {
|
|
93
103
|
return !!customerLocationsValue.find(function (location) {
|
|
94
104
|
return location.id === item.id;
|
|
@@ -102,7 +112,7 @@ var customerLocations = function (_a) {
|
|
|
102
112
|
var customerLocationsValue = customerLocationsControl.field.value;
|
|
103
113
|
var customerLocationSelected = customerLocationsValue[customerLocationsValue.length - 1];
|
|
104
114
|
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('select_customer_base') }), _jsx(InputStyled, { readOnly: true, value: isAr ? customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.nameAR : customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: customerLocationsList, placeholder: 'choose_customer_base', onSelectItem: onSelectItem, renderItem: function (item) {
|
|
105
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.
|
|
115
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (customerLocationsValue === null || customerLocationsValue === void 0 ? void 0 : customerLocationsValue.id) }, { children: isAr ? item.titleAr : item.title })) })), item.id === (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(CheckIconStyled, {}), checkRemainingCondition(item) && item.id != (customerLocationSelected === null || customerLocationSelected === void 0 ? void 0 : customerLocationSelected.id) && _jsx(RemainingCheck, {})] }));
|
|
106
116
|
} }) }))] }) })));
|
|
107
117
|
};
|
|
108
118
|
export default React.memo(customerLocations);
|