@tap-payments/auth-jsconnect 2.4.11-test → 2.4.13-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/entity.d.ts +1 -1
- package/build/features/app/bank/bankStore.js +4 -2
- package/build/features/app/brand/brandStore.js +29 -28
- package/build/features/app/tax/taxStore.js +3 -6
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +22 -6
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +12 -7
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +2 -1
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +13 -5
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +1 -1
- package/build/features/shared/SalesChannels/SalesChannel.js +5 -1
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +1 -1
- package/package.json +1 -1
package/build/api/entity.d.ts
CHANGED
|
@@ -208,8 +208,10 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (_
|
|
|
208
208
|
documentId = document === null || document === void 0 ? void 0 : document.id;
|
|
209
209
|
requestBody = {
|
|
210
210
|
wallet_id: (_j = (_h = (_g = (_f = (_e = bank.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.business) === null || _f === void 0 ? void 0 : _f.entity) === null || _g === void 0 ? void 0 : _g.merchant) === null || _h === void 0 ? void 0 : _h.wallet) === null || _j === void 0 ? void 0 : _j.id,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
bank_account: __assign(__assign({ iban: isIBANNonEditable || isIBANMasked ? undefined : iban, beneficiary_name: isBeneficiaryNameNonEditable ? undefined : beneficiaryName, bank_name: isBankNameNonEditable ? undefined : bankName }, (!isConfirmPolicyNonEditable && {
|
|
212
|
+
acknowledged_by: (_k = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _k === void 0 ? void 0 : _k.id,
|
|
213
|
+
is_acknowledged: confirmPolicy
|
|
214
|
+
})), (!(isBankStatementIdNonEditable || documentId || !hasDocument) && {
|
|
213
215
|
document: {
|
|
214
216
|
type: DocumentPurpose.BANK_STATEMENT,
|
|
215
217
|
files: bankStatementId || []
|
|
@@ -279,14 +279,14 @@ export var checkBrandNameAvailability = createAsyncThunk('checkBrandNameAvailabi
|
|
|
279
279
|
export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thunkApi) {
|
|
280
280
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
281
281
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
282
|
-
var _b, settings, brand,
|
|
283
|
-
var _e, _f
|
|
284
|
-
return __generator(this, function (
|
|
285
|
-
switch (
|
|
282
|
+
var _b, settings, brand, brandRes, _c, id, data_status, isNameENNonEditable, isNameARNonEditable, isChannelServicesNonEditable, isSegmentTypeNonEditable, isSegmentTeamsNonEditable, salesChannels, brandName, segment, teamSize, brandLogoId, segmentId, teamSizeId, getAddress, channel_services, brandNameIsEditable, requestBody, brandData, activities, activityList;
|
|
283
|
+
var _d, _e, _f;
|
|
284
|
+
return __generator(this, function (_g) {
|
|
285
|
+
switch (_g.label) {
|
|
286
286
|
case 0:
|
|
287
287
|
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
brandRes = (brand.data.verify.responseBody || {}).brand;
|
|
289
|
+
_c = brandRes || {}, id = _c.id, data_status = _c.data_status;
|
|
290
290
|
isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
|
|
291
291
|
isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
|
|
292
292
|
isChannelServicesNonEditable = hasNoneEditableValue(data_status, 'channel_services');
|
|
@@ -320,26 +320,26 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (_a, thun
|
|
|
320
320
|
en: !isNameENNonEditable ? brandName : undefined,
|
|
321
321
|
ar: !isNameARNonEditable ? brandName : undefined
|
|
322
322
|
}
|
|
323
|
-
})), { logo: brandLogoId,
|
|
323
|
+
})), { logo: brandLogoId, segment: !segmentId && !teamSizeId ? undefined : { type: segmentId, team: teamSizeId }, channel_services: channel_services });
|
|
324
324
|
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
325
325
|
case 1:
|
|
326
|
-
brandData = (
|
|
327
|
-
activities = (((
|
|
326
|
+
brandData = (_g.sent()).brand;
|
|
327
|
+
activities = (((_d = brand.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.entity) || {}).activities;
|
|
328
328
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
329
329
|
case 2:
|
|
330
|
-
|
|
330
|
+
_g.sent();
|
|
331
331
|
if (activities) {
|
|
332
332
|
brandData = __assign(__assign({}, brandData), { entity_activities: activities || {} });
|
|
333
333
|
}
|
|
334
334
|
if (!!activities) return [3, 4];
|
|
335
335
|
return [4, API.dataService.getActivities()];
|
|
336
336
|
case 3:
|
|
337
|
-
activityList = (
|
|
337
|
+
activityList = (_g.sent()).list;
|
|
338
338
|
brandData = __assign(__assign({}, brandData), { entity_activities: activityList || {} });
|
|
339
|
-
|
|
339
|
+
_g.label = 4;
|
|
340
340
|
case 4:
|
|
341
341
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
|
|
342
|
-
(
|
|
342
|
+
(_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, id);
|
|
343
343
|
return [2, { data: __assign({}, brandData), formData: originalFormData }];
|
|
344
344
|
}
|
|
345
345
|
});
|
|
@@ -359,13 +359,14 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
|
|
|
359
359
|
export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities', function (_a, thunkApi) {
|
|
360
360
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
361
361
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
362
|
-
var _b, settings, brand, _c, data_status, id, brandActivities, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
|
|
363
|
-
var
|
|
364
|
-
return __generator(this, function (
|
|
365
|
-
switch (
|
|
362
|
+
var _b, settings, brand, _c, brandRes, notification, _d, data_status, id, brandActivities, terms, isActivitiesNonEditable, isCustomerBaseLocationNonEditable, isCustomerBaseNonEditable, isTermsNonEditable, isSalesRangeNonEditable, activities, customerLocations, expectedCustomer, expectedSale, termAndConditionChecked, refundPolicy, transactionPolicy, isTermsUndefined, isAllTermsAgreed, isTermsAvailable, removedActivities, payload, requestBody, customerLocation, customerBaseId, salesId, customerBase, brandData;
|
|
363
|
+
var _e, _f, _g, _h;
|
|
364
|
+
return __generator(this, function (_j) {
|
|
365
|
+
switch (_j.label) {
|
|
366
366
|
case 0:
|
|
367
367
|
_b = thunkApi.getState(), settings = _b.settings, brand = _b.brand;
|
|
368
|
-
_c =
|
|
368
|
+
_c = brand.data.verify.responseBody || {}, brandRes = _c.brand, notification = _c.notification;
|
|
369
|
+
_d = brandRes || {}, data_status = _d.data_status, id = _d.id, brandActivities = _d.activities, terms = _d.terms;
|
|
369
370
|
isActivitiesNonEditable = hasNoneEditableValue(data_status, 'activities');
|
|
370
371
|
isCustomerBaseLocationNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base_location');
|
|
371
372
|
isCustomerBaseNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'customer_base');
|
|
@@ -373,6 +374,8 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
|
|
|
373
374
|
isSalesRangeNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.operations, 'sales_range');
|
|
374
375
|
activities = formData.activities, customerLocations = formData.customerLocations, expectedCustomer = formData.expectedCustomer, expectedSale = formData.expectedSale, termAndConditionChecked = formData.termAndConditionChecked, refundPolicy = formData.refundPolicy, transactionPolicy = formData.transactionPolicy;
|
|
375
376
|
isTermsUndefined = termAndConditionChecked === undefined && refundPolicy === undefined && transactionPolicy === undefined;
|
|
377
|
+
isAllTermsAgreed = ((_e = terms === null || terms === void 0 ? void 0 : terms.filter(function (t) { return t === null || t === void 0 ? void 0 : t.agree; })) === null || _e === void 0 ? void 0 : _e.length) === 3;
|
|
378
|
+
isTermsAvailable = !(isTermsNonEditable && isTermsUndefined) && !isAllTermsAgreed;
|
|
376
379
|
removedActivities = (activities === null || activities === void 0 ? void 0 : activities.length) > 0 &&
|
|
377
380
|
(brandActivities || []).filter(function (brandActivity) { return !(activities || []).some(function (activity) { return activity.id === brandActivity.id; }); });
|
|
378
381
|
if (!(!isActivitiesNonEditable && (removedActivities === null || removedActivities === void 0 ? void 0 : removedActivities.length) > 0)) return [3, 2];
|
|
@@ -382,15 +385,13 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
|
|
|
382
385
|
};
|
|
383
386
|
return [4, API.brandService.removeBrandActivity(payload)];
|
|
384
387
|
case 1:
|
|
385
|
-
|
|
386
|
-
|
|
388
|
+
_j.sent();
|
|
389
|
+
_j.label = 2;
|
|
387
390
|
case 2:
|
|
388
|
-
requestBody = {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES
|
|
393
|
-
};
|
|
391
|
+
requestBody = __assign(__assign({ id: id, activities: isActivitiesNonEditable ? undefined : activities }, (isTermsAvailable && {
|
|
392
|
+
term_by: (_f = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _f === void 0 ? void 0 : _f.id,
|
|
393
|
+
term: ['general', 'refund', 'chargeback']
|
|
394
|
+
})), { step_name: BRAND_STEP_NAMES.BRAND_ACTIVITIES });
|
|
394
395
|
customerLocation = (customerLocations || []).map(function (location) { return ({
|
|
395
396
|
id: location.id
|
|
396
397
|
}); });
|
|
@@ -404,9 +405,9 @@ export var updateBrandActivities = createAsyncThunk('brandUpdateBrandActivities'
|
|
|
404
405
|
}
|
|
405
406
|
return [4, API.brandService.updateBrandInfo(requestBody)];
|
|
406
407
|
case 3:
|
|
407
|
-
brandData = (
|
|
408
|
+
brandData = (_j.sent()).data;
|
|
408
409
|
thunkApi.dispatch(handleNextScreenStep());
|
|
409
|
-
(
|
|
410
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, id);
|
|
410
411
|
return [2, { data: __assign({}, brandData), formData: originalFormData }];
|
|
411
412
|
}
|
|
412
413
|
});
|
|
@@ -186,13 +186,10 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (_a, thunk
|
|
|
186
186
|
isDocumentsNonEditable = hasNoneEditableValue(data_status, 'documents');
|
|
187
187
|
document = getRecentDocumentBasedOnPurpose(documents, DocumentPurpose.TAX_DOCUMENT);
|
|
188
188
|
vatId = formData.vatId, confirmPolicy = formData.confirmPolicy, documentId = formData.documentId;
|
|
189
|
-
requestBody = {
|
|
190
|
-
id: id,
|
|
191
|
-
vat_id: isTaxNumberNonEditable ? undefined : vatId,
|
|
189
|
+
requestBody = __assign(__assign({ id: id, vat_id: isTaxNumberNonEditable ? undefined : vatId }, (!isConfirmPolicyNonEditable && {
|
|
192
190
|
vat_acknowledged_by: (_g = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _g === void 0 ? void 0 : _g.id,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
191
|
+
is_vat_acknowledged: confirmPolicy
|
|
192
|
+
})), { step_name: TAX_STEP_NAMES.TAX_INFO });
|
|
196
193
|
return [4, API.entityService.updateEntityInfo(requestBody)];
|
|
197
194
|
case 1:
|
|
198
195
|
data = (_l.sent()).data;
|
|
@@ -35,11 +35,11 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
35
35
|
flexDirection: 'column'
|
|
36
36
|
}); });
|
|
37
37
|
var BrandActivities = function (_a) {
|
|
38
|
-
var _b;
|
|
39
|
-
var
|
|
38
|
+
var _b, _c, _d, _e, _f;
|
|
39
|
+
var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
|
|
40
40
|
var dispatch = useAppDispatch();
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var _h = useAppSelector(brandSelector), data = _h.data, loading = _h.loading, error = _h.error;
|
|
42
|
+
var _j = data.brandActivities, activities = _j.activities, customerLocations = _j.customerLocations, expectedCustomer = _j.expectedCustomer, expectedSale = _j.expectedSale, termAndConditionChecked = _j.termAndConditionChecked, refundPolicy = _j.refundPolicy, transactionPolicy = _j.transactionPolicy;
|
|
43
43
|
var ListType;
|
|
44
44
|
(function (ListType) {
|
|
45
45
|
ListType["ActivitiesList"] = "ActivitiesList";
|
|
@@ -61,7 +61,7 @@ var BrandActivities = function (_a) {
|
|
|
61
61
|
mode: 'onChange'
|
|
62
62
|
});
|
|
63
63
|
useSetFromDefaultValues(methods, data.brandActivities, true);
|
|
64
|
-
var
|
|
64
|
+
var _k = ((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}, data_status = _k.data_status, data_verification = _k.data_verification, operations = _k.operations;
|
|
65
65
|
var originalReadOnly = useFormReadOnly(methods);
|
|
66
66
|
var noneEditable = useDataNoneEditable(data_status, [
|
|
67
67
|
'activities',
|
|
@@ -77,6 +77,22 @@ var BrandActivities = function (_a) {
|
|
|
77
77
|
'operations.sales_range'
|
|
78
78
|
]);
|
|
79
79
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
80
|
+
var locations = methods.watch('customerLocations');
|
|
81
|
+
var isCustomerLocationsHasVerifiedValue = React.useMemo(function () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
var locationIds = locations === null || locations === void 0 ? void 0 : locations.map(function (_a) {
|
|
84
|
+
var id = _a.id;
|
|
85
|
+
return id;
|
|
86
|
+
});
|
|
87
|
+
var Ids = (_b = (_a = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _a === void 0 ? void 0 : _a.locations) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
88
|
+
var id = _a.id;
|
|
89
|
+
return id;
|
|
90
|
+
});
|
|
91
|
+
return (locationIds === null || locationIds === void 0 ? void 0 : locationIds.length) === (Ids === null || Ids === void 0 ? void 0 : Ids.length) && locationIds.every(function (locationId) { return Ids.includes(locationId); });
|
|
92
|
+
}, [locations, operations]);
|
|
93
|
+
var isCustomerLocationsVerified = dataVerified['operations.customer_base_location'] && isCustomerLocationsHasVerifiedValue;
|
|
94
|
+
var isExpectedSalesRangeVerified = dataVerified['operations.sales_range'] && ((_c = operations === null || operations === void 0 ? void 0 : operations.sales) === null || _c === void 0 ? void 0 : _c.id) === ((_d = methods.watch('expectedSale')) === null || _d === void 0 ? void 0 : _d.id);
|
|
95
|
+
var isExpectedCustomersVerified = dataVerified['operations.customer_base'] && ((_e = operations === null || operations === void 0 ? void 0 : operations.customer_base) === null || _e === void 0 ? void 0 : _e.id) === ((_f = methods.watch('expectedCustomer')) === null || _f === void 0 ? void 0 : _f.id);
|
|
80
96
|
var onSubmit = function (data) {
|
|
81
97
|
dispatch(updateBrandActivities(getFelids(data)));
|
|
82
98
|
};
|
|
@@ -93,6 +109,6 @@ var BrandActivities = function (_a) {
|
|
|
93
109
|
var isCustomerBaseListActive = listActive === ListType.CustomerBaseList;
|
|
94
110
|
var isExpectedCustomerListActive = listActive === ListType.ExpectedCustomerList;
|
|
95
111
|
var isExpectedSalesListActive = listActive === ListType.ExpectedSalesList;
|
|
96
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { readOnly: readOnly['activities'] || noneEditable['activities'], show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { readOnly: readOnly['customerLocations'] || noneEditable['operations.customer_base_location'], show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); }, isVerified:
|
|
112
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivitiesList, { readOnly: readOnly['activities'] || noneEditable['activities'], show: !isCustomerBaseListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ActivitiesList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(CustomerBase, { readOnly: readOnly['customerLocations'] || noneEditable['operations.customer_base_location'], show: !isActivitiesListActive && !isExpectedCustomerListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.CustomerBaseList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isCustomerLocationsVerified }), _jsx(ExpectedCustomers, { readOnly: readOnly['expectedCustomer'] || noneEditable['operations.customer_base'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedSalesListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedCustomerList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedCustomersVerified }), _jsx(ExpectedSalesRange, { readOnly: readOnly['expectedSale'] || noneEditable['operations.sales_range'], show: !isActivitiesListActive && !isCustomerBaseListActive && !isExpectedCustomerListActive, onListOpen: function () { return handleMenuClick(ListType.ExpectedSalesList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isExpectedSalesRangeVerified }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(TAC, { readOnly: readOnly['termAndConditionChecked'] || noneEditable['terms'] }), _jsx(RefundPolicy, { readOnly: readOnly['refundPolicy'] || noneEditable['terms'] }), _jsx(TransactionPolicy, { readOnly: readOnly['transactionPolicy'] || noneEditable['terms'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
97
113
|
};
|
|
98
114
|
export default BrandActivities;
|
|
@@ -39,15 +39,16 @@ var ListType;
|
|
|
39
39
|
ListType["TeamSizeList"] = "TeamSizeList";
|
|
40
40
|
})(ListType || (ListType = {}));
|
|
41
41
|
var BrandInfo = function (_a) {
|
|
42
|
-
var _b
|
|
43
|
-
var
|
|
42
|
+
var _b, _c, _d, _e;
|
|
43
|
+
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
44
|
+
var _g = React.useState(false), brandNameChecking = _g[0], setBrandNameChecking = _g[1];
|
|
44
45
|
var dispatch = useAppDispatch();
|
|
45
46
|
var t = useTranslation().t;
|
|
46
47
|
var isAr = useLanguage().isAr;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
48
|
+
var _h = useAppSelector(brandSelector), data = _h.data, loading = _h.loading, error = _h.error, uploadingBrandLogo = _h.uploadingBrandLogo;
|
|
49
|
+
var _j = data.brandData, brandName = _j.brandName, segment = _j.segment, teamSize = _j.teamSize, salesChannels = _j.salesChannels, brandLogoId = _j.brandLogoId, responseBody = _j.responseBody;
|
|
50
|
+
var _k = data.verify.responseBody || {}, brand = _k.brand, flows = _k.flows;
|
|
51
|
+
var _l = brand || {}, logo_details = _l.logo_details, data_status = _l.data_status, data_verification = _l.data_verification, name = _l.name, resSegment = _l.segment;
|
|
51
52
|
var methods = useForm({
|
|
52
53
|
resolver: yupResolver(BrandValidationSchema()),
|
|
53
54
|
defaultValues: {
|
|
@@ -59,6 +60,7 @@ var BrandInfo = function (_a) {
|
|
|
59
60
|
},
|
|
60
61
|
mode: 'onChange'
|
|
61
62
|
});
|
|
63
|
+
var watch = methods.watch;
|
|
62
64
|
useSetFromDefaultValues(methods, data.brandData, true);
|
|
63
65
|
var defaultBrandLogoFile = React.useMemo(function () { return logo_details && __assign(__assign({}, logo_details), { docId: '' }); }, [logo_details]);
|
|
64
66
|
var originalReadOnly = useFormReadOnly(methods, { brandLogoId: defaultBrandLogoFile });
|
|
@@ -66,6 +68,9 @@ var BrandInfo = function (_a) {
|
|
|
66
68
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
67
69
|
var dataVerified = useDataVerified(data_verification, ['logo', 'name.en', 'name.ar', 'segment.teams', 'segment.type']);
|
|
68
70
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
71
|
+
var isBrandNameVerified = dataVerified['name.en'] && dataVerified['name.ar'] && ((name === null || name === void 0 ? void 0 : name.en) === watch('brandName') || (name === null || name === void 0 ? void 0 : name.ar) === watch('brandName'));
|
|
72
|
+
var isSegmentVerified = dataVerified['segment.type'] && ((_b = resSegment === null || resSegment === void 0 ? void 0 : resSegment.type) === null || _b === void 0 ? void 0 : _b.id) === ((_c = watch('segment')) === null || _c === void 0 ? void 0 : _c.id);
|
|
73
|
+
var isTeamSizeVerified = dataVerified['segment.teams'] && ((_d = resSegment === null || resSegment === void 0 ? void 0 : resSegment.team) === null || _d === void 0 ? void 0 : _d.id) === ((_e = watch('teamSize')) === null || _e === void 0 ? void 0 : _e.id);
|
|
69
74
|
var onSubmit = function (data) {
|
|
70
75
|
dispatch(updateBrand(getFelids(data)));
|
|
71
76
|
};
|
|
@@ -95,6 +100,6 @@ var BrandInfo = function (_a) {
|
|
|
95
100
|
};
|
|
96
101
|
var isSegmentsListActive = listActive === ListType.SegmentsList;
|
|
97
102
|
var isTeamSizeListActive = listActive === ListType.TeamSizeList;
|
|
98
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified:
|
|
103
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, { readOnly: readOnly['brandName'] || (noneEditable['name.en'] && noneEditable['name.ar']), show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking, isVerified: isBrandNameVerified }), _jsx(BrandLogo, { defaultFile: defaultBrandLogoFile, readOnly: readOnly['brandLogoId'], show: !listActive, isVerified: dataVerified['logo'] }), _jsx(Segments, { readOnly: readOnly['segment'] || noneEditable['segment.type'], show: !isTeamSizeListActive, onListOpen: function () { return handleMenuClick(ListType.SegmentsList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isSegmentVerified }), _jsx(TeamSize, { readOnly: readOnly['teamSize'] || noneEditable['segment.teams'], show: !isSegmentsListActive, onListOpen: function () { return handleMenuClick(ListType.TeamSizeList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isTeamSizeVerified }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(SalesChannels, { readOnly: readOnly['salesChannels'] || noneEditable['channel_services'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] }))] })) })) }));
|
|
99
104
|
};
|
|
100
105
|
export default BrandInfo;
|
|
@@ -35,6 +35,7 @@ var BrandLogo = function (_a) {
|
|
|
35
35
|
var dispatch = useAppDispatch();
|
|
36
36
|
var _c = useAppSelector(brandSelector), data = _c.data, error = _c.error, loading = _c.loading;
|
|
37
37
|
var logo_details = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) || {}).logo_details;
|
|
38
|
+
var id = brandLogoIdControl.field.value;
|
|
38
39
|
var handleBrandLogoChange = function (id) {
|
|
39
40
|
if (error)
|
|
40
41
|
dispatch(clearError());
|
|
@@ -47,6 +48,6 @@ var BrandLogo = function (_a) {
|
|
|
47
48
|
dispatch(clearBrandLogo());
|
|
48
49
|
brandLogoIdControl.field.onChange(undefined);
|
|
49
50
|
};
|
|
50
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified }) }) })));
|
|
51
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadWrapper, { id: 'brandLogoId', readOnly: readOnly, fileRemoveType: FileRemoveType.BRAND_LOGO_FILE_ID, control: control, label: t('title_brand_logo'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('description_brand_logo'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleBrandLogoChange, isSubmitting: loading, onDeleteFile: handleReset, defaultFile: defaultFile, purpose: DocumentPurpose.BRAND_LOGO, validFileFormats: VALID_FILE_FORMATS_FOR_IMAGE, fileUploadingStatus: function (uploading) { return dispatch(uploadingBrandLogoStatus(uploading)); }, isVerified: isVerified && !id }) }) })));
|
|
51
52
|
};
|
|
52
53
|
export default BrandLogo;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useController, useFormContext } from 'react-hook-form';
|
|
4
4
|
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
5
|
-
import { hasVerifiedValue, mapSalesChannel } from '../../../../utils';
|
|
5
|
+
import { hasVerifiedValue, isTwitter, isWebsite, mapSalesChannel } from '../../../../utils';
|
|
6
6
|
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
7
7
|
import SalesChannel from '../../../shared/SalesChannels';
|
|
8
8
|
var SalesChannels = function (_a) {
|
|
@@ -13,16 +13,24 @@ var SalesChannels = function (_a) {
|
|
|
13
13
|
var _c = useController({ control: control, name: 'salesChannels' }), fieldState = _c.fieldState, field = _c.field;
|
|
14
14
|
var _d = useAppSelector(brandSelector), data = _d.data, error = _d.error;
|
|
15
15
|
var brand = (data.verify.responseBody || {}).brand;
|
|
16
|
-
var isChannelVerified = function (id) {
|
|
17
|
-
return hasVerifiedValue(brand === null || brand === void 0 ? void 0 : brand.data_verification, "channel_services.".concat(id));
|
|
18
|
-
};
|
|
19
16
|
var channelList = (data.verify.responseBody || {}).channel_list;
|
|
17
|
+
var isChannelVerified = function (id, selected) {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
var initial = (_b = (_a = brand === null || brand === void 0 ? void 0 : brand.channel_services) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, function (sale) { return (sale === null || sale === void 0 ? void 0 : sale.id) === id; });
|
|
20
|
+
var _c = initial || {}, address = _c.address, code = _c.code;
|
|
21
|
+
var initialAddress = isTwitter(code || '')
|
|
22
|
+
? address === null || address === void 0 ? void 0 : address.replaceAll('@', '')
|
|
23
|
+
: isWebsite(code || '')
|
|
24
|
+
? address === null || address === void 0 ? void 0 : address.replaceAll('https://www.', '')
|
|
25
|
+
: address;
|
|
26
|
+
return hasVerifiedValue(brand === null || brand === void 0 ? void 0 : brand.data_verification, "channel_services.".concat(id)) && initialAddress === (selected === null || selected === void 0 ? void 0 : selected.address);
|
|
27
|
+
};
|
|
20
28
|
var selectedSalesChannels = React.useMemo(function () { return mapSalesChannel(field.value); }, [(field.value || []).length]);
|
|
21
29
|
var onChange = function (channels) {
|
|
22
30
|
if (error)
|
|
23
31
|
dispatch(clearError());
|
|
24
32
|
field.onChange(channels);
|
|
25
33
|
};
|
|
26
|
-
return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id) { return isChannelVerified(id); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
34
|
+
return (_jsx(SalesChannel, { readOnly: readOnly, isChannelVerified: function (id, selected) { return isChannelVerified(id, selected); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, list: channelList, onChange: onChange, defaultValue: selectedSalesChannels }));
|
|
27
35
|
};
|
|
28
36
|
export default SalesChannels;
|
|
@@ -8,7 +8,7 @@ interface SalesChannelProps {
|
|
|
8
8
|
selectFirstIconListener?: string | number | boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
readOnly?: boolean;
|
|
11
|
-
isChannelVerified?: (id: string) => boolean;
|
|
11
|
+
isChannelVerified?: (id: string, selected?: SaleChannel) => boolean;
|
|
12
12
|
}
|
|
13
13
|
declare const _default: React.MemoExoticComponent<({ list, onChange, error, disabled, readOnly, defaultValue, selectFirstIconListener, isChannelVerified }: SalesChannelProps) => JSX.Element>;
|
|
14
14
|
export default _default;
|
|
@@ -142,9 +142,13 @@ var SalesChannel = function (_a) {
|
|
|
142
142
|
selectFirstIcon(defaultValue);
|
|
143
143
|
}
|
|
144
144
|
}, [selectFirstIconListener]);
|
|
145
|
+
var selectedChannel = React.useMemo(function () { return selectedSalas.find(function (_a) {
|
|
146
|
+
var id = _a.id;
|
|
147
|
+
return id === activeSaleIconId;
|
|
148
|
+
}); }, [selectedSalas, activeSaleIconId]);
|
|
145
149
|
return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: { mb: 3 } }, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), list.map(function (channel, index) {
|
|
146
150
|
var _a, _b;
|
|
147
151
|
return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disabled: disabled || readOnly, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onSelectSalesChannel(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, "".concat(channel.id, "-indx").concat(index)));
|
|
148
|
-
}), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { readOnly: readOnly, error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas, isVerified: isChannelVerified === null || isChannelVerified === void 0 ? void 0 : isChannelVerified(activeSaleIconId) }, 'saleChannelIconsInput')] }));
|
|
152
|
+
}), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { readOnly: readOnly, error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas, isVerified: isChannelVerified === null || isChannelVerified === void 0 ? void 0 : isChannelVerified(activeSaleIconId, selectedChannel) }, 'saleChannelIconsInput')] }));
|
|
149
153
|
};
|
|
150
154
|
export default React.memo(SalesChannel);
|
|
@@ -170,7 +170,7 @@ var UploadMultipleFile = function (_a) {
|
|
|
170
170
|
};
|
|
171
171
|
var fileExists = fileInfoArray.length > 0;
|
|
172
172
|
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
|
|
173
|
-
return (_jsx(UploadFile, { readOnly: readOnly, required: required, purpose: purpose, fileType: fileType, title: fileTitle, isVerified: isVerified, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
|
|
173
|
+
return (_jsx(UploadFile, { readOnly: readOnly, required: required, purpose: purpose, fileType: fileType, title: fileTitle, isVerified: isVerified && (defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles.length) === uploadedFileCount, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
|
|
174
174
|
borderBottom: index === fileArray.length - 1 ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : ''
|
|
175
175
|
}, onSuccess: handleSuccess, onDelete: handleDelete, onUpdate: handleUpdate }, index));
|
|
176
176
|
}) })), _jsx(Collapse, __assign({ in: !readOnly }, { children: _jsx(InputContainerStyled, __assign({ sx: { mt: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })) }))] }));
|