ordering-ui-external 14.1.83 → 14.1.84

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.
@@ -367,12 +367,12 @@ var PhoneAutocompleteUI = function PhoneAutocompleteUI(props) {
367
367
  hideTitle: true,
368
368
  orderTypes: orderTypes
369
369
  }), configTypes.includes(orderState === null || orderState === void 0 || (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.PhoneAutocompleteContainer, null, /*#__PURE__*/_react.default.createElement("h2", null, t('ADDING_CUSTOMERS_PHONE_NUMBER', 'Adding the customers’ phone number')), /*#__PURE__*/_react.default.createElement(_styles.WrappBtn, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
370
- color: inputValue || userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options6 = orderState.options) !== null && _orderState$options6 !== void 0 && (_orderState$options6 = _orderState$options6.address) !== null && _orderState$options6 !== void 0 && _orderState$options6.address ? 'primary' : 'secundary',
370
+ color: inputValue || phone || userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options6 = orderState.options) !== null && _orderState$options6 !== void 0 && (_orderState$options6 = _orderState$options6.address) !== null && _orderState$options6 !== void 0 && _orderState$options6.address ? 'primary' : 'secundary',
371
371
  onMouseDown: function onMouseDown() {
372
372
  var _orderState$options7;
373
373
  return !(userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options7 = orderState.options) !== null && _orderState$options7 !== void 0 && (_orderState$options7 = _orderState$options7.address) !== null && _orderState$options7 !== void 0 && _orderState$options7.address) && !optSelected ? createNewUser() : handleFindClick();
374
374
  },
375
- disabled: !inputValue && !(userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options8 = orderState.options) !== null && _orderState$options8 !== void 0 && (_orderState$options8 = _orderState$options8.address) !== null && _orderState$options8 !== void 0 && _orderState$options8.address) && !optSelected
375
+ disabled: !inputValue && !phone && !(userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options8 = orderState.options) !== null && _orderState$options8 !== void 0 && (_orderState$options8 = _orderState$options8.address) !== null && _orderState$options8 !== void 0 && _orderState$options8.address) && !optSelected
376
376
  }, !(userCustomer && orderState !== null && orderState !== void 0 && (_orderState$options9 = orderState.options) !== null && _orderState$options9 !== void 0 && (_orderState$options9 = _orderState$options9.address) !== null && _orderState$options9 !== void 0 && _orderState$options9.address) && !optSelected ? t('CREATE_CUSTOMER', 'Create new customer') : "".concat(t('CONTINUE_WITH', 'Continue with'), " ").concat(userName))), /*#__PURE__*/_react.default.createElement(_styles.SelectContainer, {
377
377
  onPaste: handleOnPaste
378
378
  }, /*#__PURE__*/_react.default.createElement(_MdcCellphoneAndroid.default, {
@@ -388,7 +388,7 @@ var PhoneAutocompleteUI = function PhoneAutocompleteUI(props) {
388
388
  noOptionsMessage: function noOptionsMessage() {
389
389
  return (inputValue === null || inputValue === void 0 ? void 0 : inputValue.length) > 6 ? t('NO_OPTIONS', 'No options') : t('TYPE_AT_LEAST_NUMBER_SUGGEST', 'Type at least 7 numbers for suggesstions');
390
390
  },
391
- inputValue: !optSelected ? inputValue : '',
391
+ inputValue: !optSelected ? phone || inputValue : '',
392
392
  onChange: onChange,
393
393
  onInputChange: onInputChange,
394
394
  isLoading: customersPhones === null || customersPhones === void 0 ? void 0 : customersPhones.loading,
@@ -221,11 +221,12 @@ var SignUpFormUI = function SignUpFormUI(props) {
221
221
  }, [formState]);
222
222
  (0, _react.useEffect)(function () {
223
223
  if (Object.keys(formMethods.errors).length > 0) {
224
+ var content = Object.values(formMethods.errors).map(function (error) {
225
+ return error.message || Object.keys(formMethods.errors)[0] === 'email' && error.type === 'pattern' && t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email'));
226
+ });
224
227
  setAlertState({
225
228
  open: true,
226
- content: Object.values(formMethods.errors).map(function (error) {
227
- return error.message;
228
- })
229
+ content: content
229
230
  });
230
231
  }
231
232
  }, [formMethods.errors]);
@@ -221,7 +221,7 @@ var UserFormDetailsUI = exports.UserFormDetailsUI = function UserFormDetailsUI(p
221
221
  (0, _react.useEffect)(function () {
222
222
  if (Object.keys(formMethods.errors).length > 0) {
223
223
  var content = Object.values(formMethods.errors).map(function (error) {
224
- return error.message;
224
+ return error.message || Object.keys(formMethods.errors)[0] === 'email' && error.type === 'pattern' && t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email'));
225
225
  });
226
226
  if (!isValidPhoneNumber && userPhoneNumber) {
227
227
  content.push(t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid.'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.83",
3
+ "version": "14.1.84",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -304,9 +304,9 @@ const PhoneAutocompleteUI = (props) => {
304
304
  </h2>
305
305
  <WrappBtn>
306
306
  <Button
307
- color={(inputValue || (userCustomer && orderState?.options?.address?.address)) ? 'primary' : 'secundary'}
307
+ color={((inputValue || phone) || (userCustomer && orderState?.options?.address?.address)) ? 'primary' : 'secundary'}
308
308
  onMouseDown={() => !(userCustomer && orderState?.options?.address?.address) && !optSelected ? createNewUser() : handleFindClick()}
309
- disabled={(!inputValue && !(userCustomer && orderState?.options?.address?.address) && !optSelected)}
309
+ disabled={((!inputValue && !phone) && !(userCustomer && orderState?.options?.address?.address) && !optSelected)}
310
310
  >
311
311
  {
312
312
  !(userCustomer && orderState?.options?.address?.address) && !optSelected
@@ -325,7 +325,7 @@ const PhoneAutocompleteUI = (props) => {
325
325
  placeholder={t('PHONE_NUMBER', 'Phone number')}
326
326
  value={optSelected}
327
327
  noOptionsMessage={() => inputValue?.length > 6 ? t('NO_OPTIONS', 'No options') : t('TYPE_AT_LEAST_NUMBER_SUGGEST', 'Type at least 7 numbers for suggesstions')}
328
- inputValue={!optSelected ? inputValue : ''}
328
+ inputValue={!optSelected ? phone || inputValue : ''}
329
329
  onChange={onChange}
330
330
  onInputChange={onInputChange}
331
331
  isLoading={customersPhones?.loading}
@@ -193,9 +193,14 @@ const SignUpFormUI = (props) => {
193
193
 
194
194
  useEffect(() => {
195
195
  if (Object.keys(formMethods.errors).length > 0) {
196
+ const content = Object.values(formMethods.errors).map(
197
+ error => error.message ||
198
+ (Object.keys(formMethods.errors)[0] === 'email' && error.type === 'pattern' &&
199
+ t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email')))
200
+ )
196
201
  setAlertState({
197
202
  open: true,
198
- content: Object.values(formMethods.errors).map(error => error.message)
203
+ content
199
204
  })
200
205
  }
201
206
  }, [formMethods.errors])
@@ -182,7 +182,11 @@ export const UserFormDetailsUI = (props) => {
182
182
 
183
183
  useEffect(() => {
184
184
  if (Object.keys(formMethods.errors).length > 0) {
185
- const content = Object.values(formMethods.errors).map(error => error.message)
185
+ const content = Object.values(formMethods.errors).map(
186
+ error => error.message ||
187
+ (Object.keys(formMethods.errors)[0] === 'email' && error.type === 'pattern' &&
188
+ t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email')))
189
+ )
186
190
  if (!isValidPhoneNumber && userPhoneNumber) {
187
191
  content.push(t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid.'))
188
192
  }