@tap-payments/auth-jsconnect 2.0.90-test → 2.0.91-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/assets/locales/ar.json +6 -0
- package/build/assets/locales/en.json +6 -0
- package/build/features/connect/screens/Merchant/BrandList.js +1 -1
- package/build/features/connect/screens/Merchant/Merchant.js +6 -5
- package/build/features/connect/screens/Merchant/SalesChannels.js +10 -3
- package/build/features/connect/screens/Merchant/SocialMedia.js +9 -3
- package/build/features/connect/screens/Merchant/validation.js +38 -28
- package/package.json +1 -1
|
@@ -258,5 +258,11 @@
|
|
|
258
258
|
"cr_kw_max_length": "May you please verify the entered commercial registration number. (Note - the commercial registration minimum of 3 may contains characters and digits).",
|
|
259
259
|
"fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
|
|
260
260
|
"title_license_certificate": "License Certificate",
|
|
261
|
+
"brand_name_already_exist": "Profile Name already exists",
|
|
262
|
+
"enter_at_least_one_call_center": "Please enter at least one call center number",
|
|
263
|
+
"enter_at_least_one_mobile_app": "Please enter at least one mobile app store",
|
|
264
|
+
"enter_at_least_one_physical_store": "Please enter at least one physical store",
|
|
265
|
+
"enter_at_least_one_website": "Please enter at least one website",
|
|
266
|
+
"enter_at_least_one_social_media": "Please enter at least one social media",
|
|
261
267
|
"homemaker_reg": "Home maker"
|
|
262
268
|
}
|
|
@@ -278,5 +278,11 @@
|
|
|
278
278
|
"cr_kw_max_length": "May you please verify the entered commercial registration number. (Note - the commercial registration minimum of 3 may contains characters and digits).",
|
|
279
279
|
"fl_kw_max_length": "May you please verify the entered freelancer registration reference. (Note - the freelancer registration may contains characters and digits).",
|
|
280
280
|
"title_license_certificate": "License Certificate",
|
|
281
|
+
"brand_name_already_exist": "Profile Name already exists",
|
|
282
|
+
"enter_at_least_one_call_center": "Please enter at least one call center number",
|
|
283
|
+
"enter_at_least_one_mobile_app": "Please enter at least one mobile app store",
|
|
284
|
+
"enter_at_least_one_physical_store": "Please enter at least one physical store",
|
|
285
|
+
"enter_at_least_one_website": "Please enter at least one website",
|
|
286
|
+
"enter_at_least_one_social_media": "Please enter at least one social media",
|
|
281
287
|
"homemaker_reg": "Home maker"
|
|
282
288
|
}
|
|
@@ -64,7 +64,8 @@ var Merchant = function (_a) {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
67
|
-
|
|
67
|
+
var screen = isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP';
|
|
68
|
+
dispatch(handlePrevScreenStep(screen));
|
|
68
69
|
};
|
|
69
70
|
React.useEffect(function () {
|
|
70
71
|
if (error)
|
|
@@ -72,12 +73,12 @@ var Merchant = function (_a) {
|
|
|
72
73
|
}, [methods.formState.isValid]);
|
|
73
74
|
React.useEffect(function () {
|
|
74
75
|
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
|
|
75
|
-
methods.setError('brandName', { message: '
|
|
76
|
+
methods.setError('brandName', { message: 'brand_name_already_exist' });
|
|
76
77
|
}, [responseBody]);
|
|
77
78
|
React.useEffect(function () {
|
|
78
79
|
if (selectedBrandItem.id) {
|
|
79
|
-
methods.setValue('selectedBrandItem', selectedBrandItem
|
|
80
|
-
methods.setValue('salesChannels', selectedBrandItem.channel_services || []
|
|
80
|
+
methods.setValue('selectedBrandItem', selectedBrandItem);
|
|
81
|
+
methods.setValue('salesChannels', selectedBrandItem.channel_services || []);
|
|
81
82
|
}
|
|
82
83
|
}, [selectedBrandItem]);
|
|
83
84
|
React.useEffect(function () {
|
|
@@ -86,7 +87,7 @@ var Merchant = function (_a) {
|
|
|
86
87
|
}, [salesChannels]);
|
|
87
88
|
React.useEffect(function () {
|
|
88
89
|
if (termAndConditionChecked === true)
|
|
89
|
-
methods.setValue('termAndConditionChecked', termAndConditionChecked
|
|
90
|
+
methods.setValue('termAndConditionChecked', termAndConditionChecked);
|
|
90
91
|
}, [termAndConditionChecked]);
|
|
91
92
|
var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
|
|
92
93
|
var disabled = brandErrChecks || brandNameChecking || ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.response_code) === '5';
|
|
@@ -76,10 +76,10 @@ var SalesChannels = function (_a) {
|
|
|
76
76
|
var _b;
|
|
77
77
|
var t = useTranslation().t;
|
|
78
78
|
var isAr = useLanguage().isAr;
|
|
79
|
-
var
|
|
79
|
+
var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
|
|
80
80
|
var dispatch = useAppDispatch();
|
|
81
81
|
var channelsControl = useController({ control: control, name: 'salesChannels' });
|
|
82
|
-
var
|
|
82
|
+
var _d = useAppSelector(connectSelector), data = _d.data, error = _d.error;
|
|
83
83
|
var channelList = (data.brandData.responseBody || {}).channel_list;
|
|
84
84
|
var isChecked = function (id) {
|
|
85
85
|
var item = channelsControl.field.value.find(function (item) { return item.id === id; });
|
|
@@ -93,7 +93,14 @@ var SalesChannels = function (_a) {
|
|
|
93
93
|
channelsControl.field.onChange(filterChannels);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
|
|
96
|
+
var brandName = getValues('brandName');
|
|
97
|
+
var newChannel = __assign({}, channel);
|
|
98
|
+
if (newChannel.id === 'website' && brandName) {
|
|
99
|
+
var brandValue = brandName.replaceAll(' ', '-').toLowerCase();
|
|
100
|
+
var address = (brandValue[brandValue.length - 1] === '-' ? brandValue.slice(0, -1) : brandValue) + '.com';
|
|
101
|
+
newChannel.address = address;
|
|
102
|
+
}
|
|
103
|
+
channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsControl.field.value, true), [newChannel], false));
|
|
97
104
|
}
|
|
98
105
|
};
|
|
99
106
|
var warningMessage = (_b = channelsControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
@@ -120,7 +120,14 @@ var SocialMedia = function (_a) {
|
|
|
120
120
|
};
|
|
121
121
|
var setDefaultActiveSocialId = React.useCallback(function () {
|
|
122
122
|
var _a;
|
|
123
|
-
|
|
123
|
+
var idExist = selectedChannels.find(function (channel) {
|
|
124
|
+
var _a;
|
|
125
|
+
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
126
|
+
return channel.sub.find(function (subChannel) { return subChannel.address; });
|
|
127
|
+
}
|
|
128
|
+
return channel.id === activeSocialId;
|
|
129
|
+
});
|
|
130
|
+
if (selectedChannels.length >= 1 && !idExist) {
|
|
124
131
|
var firstChannel = selectedChannels[0];
|
|
125
132
|
if ((_a = firstChannel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
126
133
|
setActiveSocialId(firstChannel.sub[0].id);
|
|
@@ -134,8 +141,7 @@ var SocialMedia = function (_a) {
|
|
|
134
141
|
setDefaultActiveSocialId();
|
|
135
142
|
}, [setDefaultActiveSocialId]);
|
|
136
143
|
var hasError = React.useMemo(function () {
|
|
137
|
-
var _a;
|
|
138
|
-
return ['enter_at_least_one', 'ide_not_valid_url'].includes(((_a = salesChannelsState.error) === null || _a === void 0 ? void 0 : _a.message) || '');
|
|
144
|
+
return ['enter_at_least_one', 'invalid_url'].some(function (error) { var _a, _b; return (_b = (_a = salesChannelsState.error) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.includes(error); });
|
|
139
145
|
}, [salesChannelsState]);
|
|
140
146
|
var linksErrorMsg = (_b = salesChannelsState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
141
147
|
return (_jsx(Box, { children: _jsx(Collapse, __assign({ in: show && selectedChannels.length > 0 }, { children: _jsxs(Box, __assign({ sx: { mb: 3, direction: 'ltr' } }, { children: [_jsx(SocialMediaGroupStyled, __assign({ exclusive: true, onChange: function (e, value) {
|
|
@@ -11,11 +11,11 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
11
11
|
if (length === 0)
|
|
12
12
|
return true;
|
|
13
13
|
if (length < 3 || !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
|
|
14
|
-
return this.createError({ message: '
|
|
14
|
+
return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
|
|
15
15
|
return true;
|
|
16
16
|
}
|
|
17
17
|
})
|
|
18
|
-
.required('
|
|
18
|
+
.required('enter_brand_name_english_chars_numbers_space'),
|
|
19
19
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
20
20
|
salesChannels: yup
|
|
21
21
|
.array()
|
|
@@ -31,27 +31,32 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
31
31
|
var channels = (value || []);
|
|
32
32
|
var dic = {};
|
|
33
33
|
channels.forEach(function (channel) {
|
|
34
|
-
var _a, _b;
|
|
34
|
+
var _a, _b, _c;
|
|
35
35
|
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
36
|
+
var key_1 = (_b = channel.id) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
37
|
+
if (key_1)
|
|
38
|
+
dic[key_1] = [];
|
|
36
39
|
channel.sub.forEach(function (sub) {
|
|
37
|
-
|
|
38
|
-
var key = (_a = sub.id) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
39
|
-
if (key)
|
|
40
|
-
dic[key] = sub.address || '';
|
|
40
|
+
dic[key_1].push(sub.address || '');
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
|
-
var key = (
|
|
44
|
+
var key = (_c = channel.id) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
45
45
|
if (key)
|
|
46
|
-
dic[key] = channel.address || '';
|
|
46
|
+
dic[key] = [channel.address || ''];
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
for (var key in dic) {
|
|
50
|
+
var values = dic[key];
|
|
51
|
+
var atLestOne = values.every(function (item) { return item === ''; });
|
|
52
|
+
if (atLestOne)
|
|
53
|
+
return this.createError({ message: "enter_at_least_one_".concat(key) });
|
|
54
|
+
if (key === 'website') {
|
|
55
|
+
var isWebsite = values.every(function (item) { return item === '' || item.match(REGEX_WEBSITE); });
|
|
56
|
+
if (!isWebsite)
|
|
57
|
+
return this.createError({ message: 'invalid_url' });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
55
60
|
return true;
|
|
56
61
|
}
|
|
57
62
|
})
|
|
@@ -72,27 +77,32 @@ export var MerchantValidationSchema = function (isNewBrand) {
|
|
|
72
77
|
var channels = (value || []);
|
|
73
78
|
var dic = {};
|
|
74
79
|
channels.forEach(function (channel) {
|
|
75
|
-
var _a, _b;
|
|
80
|
+
var _a, _b, _c;
|
|
76
81
|
if ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) {
|
|
82
|
+
var key_2 = (_b = channel.id) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
83
|
+
if (key_2)
|
|
84
|
+
dic[key_2] = [];
|
|
77
85
|
channel.sub.forEach(function (sub) {
|
|
78
|
-
|
|
79
|
-
var key = (_a = sub.id) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
80
|
-
if (key)
|
|
81
|
-
dic[key] = sub.address || '';
|
|
86
|
+
dic[key_2].push(sub.address || '');
|
|
82
87
|
});
|
|
83
88
|
}
|
|
84
89
|
else {
|
|
85
|
-
var key = (
|
|
90
|
+
var key = (_c = channel.id) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
86
91
|
if (key)
|
|
87
|
-
dic[key] = channel.address || '';
|
|
92
|
+
dic[key] = [channel.address || ''];
|
|
88
93
|
}
|
|
89
94
|
});
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
for (var key in dic) {
|
|
96
|
+
var values = dic[key];
|
|
97
|
+
var atLestOne = values.every(function (item) { return item === ''; });
|
|
98
|
+
if (atLestOne)
|
|
99
|
+
return this.createError({ message: "enter_at_least_one_".concat(key) });
|
|
100
|
+
if (key === 'website') {
|
|
101
|
+
var isWebsite = values.every(function (item) { return item === '' || item.match(REGEX_WEBSITE); });
|
|
102
|
+
if (!isWebsite)
|
|
103
|
+
return this.createError({ message: 'invalid_url' });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
96
106
|
return true;
|
|
97
107
|
}
|
|
98
108
|
})
|