ordering-ui-external 2.4.0 → 2.4.2
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/_bundles/{7.ordering-ui.514c8d0a101626d93843.js → 7.ordering-ui.f617c2b14777b5518ddc.js} +1 -1
- package/_bundles/ordering-ui.f617c2b14777b5518ddc.js +2 -0
- package/_modules/themes/five/src/components/PhoneAutocomplete/index.js +8 -4
- package/package.json +2 -2
- package/src/themes/five/src/components/PhoneAutocomplete/index.js +8 -3
- package/_bundles/ordering-ui.514c8d0a101626d93843.js +0 -2
- /package/_bundles/{0.ordering-ui.514c8d0a101626d93843.js → 0.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{1.ordering-ui.514c8d0a101626d93843.js → 1.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{2.ordering-ui.514c8d0a101626d93843.js → 2.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{4.ordering-ui.514c8d0a101626d93843.js → 4.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{5.ordering-ui.514c8d0a101626d93843.js → 5.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{6.ordering-ui.514c8d0a101626d93843.js → 6.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{7.ordering-ui.514c8d0a101626d93843.js.LICENSE.txt → 7.ordering-ui.f617c2b14777b5518ddc.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.514c8d0a101626d93843.js → 8.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{9.ordering-ui.514c8d0a101626d93843.js → 9.ordering-ui.f617c2b14777b5518ddc.js} +0 -0
- /package/_bundles/{ordering-ui.514c8d0a101626d93843.js.LICENSE.txt → ordering-ui.f617c2b14777b5518ddc.js.LICENSE.txt} +0 -0
|
@@ -42,6 +42,7 @@ var PhoneAutocompleteUI = function PhoneAutocompleteUI(props) {
|
|
|
42
42
|
customersPhones = props.customersPhones,
|
|
43
43
|
setCustomersPhones = props.setCustomersPhones,
|
|
44
44
|
openModal = props.openModal,
|
|
45
|
+
limitPhoneLength = props.limitPhoneLength,
|
|
45
46
|
setOpenModal = props.setOpenModal,
|
|
46
47
|
onChangeNumber = props.onChangeNumber,
|
|
47
48
|
setCustomerState = props.setCustomerState,
|
|
@@ -131,7 +132,7 @@ var PhoneAutocompleteUI = function PhoneAutocompleteUI(props) {
|
|
|
131
132
|
setInputValue(inputValue);
|
|
132
133
|
onChangeNumber(inputValue);
|
|
133
134
|
}
|
|
134
|
-
if (inputValue && inputValue.length >
|
|
135
|
+
if (inputValue && inputValue.length > limitPhoneLength || !/^[0-9]+$/.test(inputValue)) {
|
|
135
136
|
return;
|
|
136
137
|
}
|
|
137
138
|
setInputValue(inputValue);
|
|
@@ -158,14 +159,14 @@ var PhoneAutocompleteUI = function PhoneAutocompleteUI(props) {
|
|
|
158
159
|
};
|
|
159
160
|
var createNewUser = function createNewUser() {
|
|
160
161
|
var _optSelected$value;
|
|
161
|
-
if (optSelected && (optSelected === null || optSelected === void 0 ? void 0 : (_optSelected$value = optSelected.value) === null || _optSelected$value === void 0 ? void 0 : _optSelected$value.length) ===
|
|
162
|
+
if (optSelected && (optSelected === null || optSelected === void 0 ? void 0 : (_optSelected$value = optSelected.value) === null || _optSelected$value === void 0 ? void 0 : _optSelected$value.length) === limitPhoneLength || !optSelected && phone.length === limitPhoneLength) {
|
|
162
163
|
setOpenModal(_objectSpread(_objectSpread({}, openModal), {}, {
|
|
163
164
|
signup: true
|
|
164
165
|
}));
|
|
165
166
|
} else {
|
|
166
167
|
setAlertState({
|
|
167
168
|
open: true,
|
|
168
|
-
content: t('ERROR_MIN_CHARACTERS_PHONE', 'The Phone / Mobile must be
|
|
169
|
+
content: t('ERROR_MIN_CHARACTERS_PHONE', 'The Phone / Mobile must be :length: characters').replace(':length:', limitPhoneLength)
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
};
|
|
@@ -272,4 +273,7 @@ var PhoneAutocomplete = function PhoneAutocomplete(props) {
|
|
|
272
273
|
}, props);
|
|
273
274
|
return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.PhoneAutocomplete, phoneProps);
|
|
274
275
|
};
|
|
275
|
-
exports.PhoneAutocomplete = PhoneAutocomplete;
|
|
276
|
+
exports.PhoneAutocomplete = PhoneAutocomplete;
|
|
277
|
+
PhoneAutocompleteUI.defaultProps = {
|
|
278
|
+
limitPhoneLength: 10
|
|
279
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"description": "Ordering UI Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"libphonenumber-js": "^1.9.4",
|
|
87
87
|
"lodash": "^4.17.19",
|
|
88
88
|
"moment": "^2.29.4",
|
|
89
|
-
"ordering-components-external": "2.5.
|
|
89
|
+
"ordering-components-external": "2.5.1",
|
|
90
90
|
"polished": "^3.6.6",
|
|
91
91
|
"react-bootstrap-icons": "^1.7.2",
|
|
92
92
|
"react-calendar": "^3.3.1",
|
|
@@ -34,6 +34,7 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
34
34
|
customersPhones,
|
|
35
35
|
setCustomersPhones,
|
|
36
36
|
openModal,
|
|
37
|
+
limitPhoneLength,
|
|
37
38
|
setOpenModal,
|
|
38
39
|
onChangeNumber,
|
|
39
40
|
setCustomerState,
|
|
@@ -88,7 +89,7 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
88
89
|
setInputValue(inputValue)
|
|
89
90
|
onChangeNumber(inputValue)
|
|
90
91
|
}
|
|
91
|
-
if ((inputValue && inputValue.length >
|
|
92
|
+
if ((inputValue && inputValue.length > limitPhoneLength) || !(/^[0-9]+$/.test(inputValue))) {
|
|
92
93
|
return
|
|
93
94
|
}
|
|
94
95
|
setInputValue(inputValue)
|
|
@@ -107,12 +108,12 @@ const PhoneAutocompleteUI = (props) => {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
const createNewUser = () => {
|
|
110
|
-
if ((optSelected && optSelected?.value?.length ===
|
|
111
|
+
if ((optSelected && optSelected?.value?.length === limitPhoneLength) || (!optSelected && phone.length === limitPhoneLength)) {
|
|
111
112
|
setOpenModal({ ...openModal, signup: true })
|
|
112
113
|
} else {
|
|
113
114
|
setAlertState({
|
|
114
115
|
open: true,
|
|
115
|
-
content: t('ERROR_MIN_CHARACTERS_PHONE', 'The Phone / Mobile must be
|
|
116
|
+
content: t('ERROR_MIN_CHARACTERS_PHONE', 'The Phone / Mobile must be :length: characters').replace(':length:', limitPhoneLength)
|
|
116
117
|
})
|
|
117
118
|
}
|
|
118
119
|
}
|
|
@@ -239,3 +240,7 @@ export const PhoneAutocomplete = (props) => {
|
|
|
239
240
|
|
|
240
241
|
return <PhoneAutocompleteController {...phoneProps} />
|
|
241
242
|
}
|
|
243
|
+
|
|
244
|
+
PhoneAutocompleteUI.defaultProps = {
|
|
245
|
+
limitPhoneLength: 10
|
|
246
|
+
}
|