ordering-ui-external 1.2.3 → 1.3.0

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.
Files changed (97) hide show
  1. package/_bundles/{0.ordering-ui.fc62fe574704c7c4d033.js → 0.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  2. package/_bundles/{1.ordering-ui.fc62fe574704c7c4d033.js → 1.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  3. package/_bundles/{3.ordering-ui.fc62fe574704c7c4d033.js → 3.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  4. package/_bundles/{4.ordering-ui.fc62fe574704c7c4d033.js → 4.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  5. package/_bundles/5.ordering-ui.aee3f88f00476e436e39.js +1 -0
  6. package/_bundles/{6.ordering-ui.fc62fe574704c7c4d033.js → 6.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  7. package/_bundles/7.ordering-ui.aee3f88f00476e436e39.js +2 -0
  8. package/_bundles/{7.ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → 7.ordering-ui.aee3f88f00476e436e39.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.fc62fe574704c7c4d033.js → 8.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  10. package/_bundles/{9.ordering-ui.fc62fe574704c7c4d033.js → 9.ordering-ui.aee3f88f00476e436e39.js} +1 -1
  11. package/_bundles/ordering-ui.aee3f88f00476e436e39.js +2 -0
  12. package/_bundles/{ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → ordering-ui.aee3f88f00476e436e39.js.LICENSE.txt} +0 -0
  13. package/_modules/components/AutoScroll/styles.js +3 -3
  14. package/_modules/hooks/useIsMounted.js +24 -0
  15. package/_modules/index.js +8 -0
  16. package/_modules/themes/five/index.js +33 -1
  17. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +2 -2
  18. package/_modules/themes/five/src/components/BusinessController/styles.js +42 -42
  19. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +12 -2
  20. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +5 -2
  21. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +10 -3
  22. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +7 -3
  23. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -0
  24. package/_modules/themes/five/src/components/MultiCheckout/styles.js +1 -1
  25. package/_modules/themes/five/src/components/MyOrders/index.js +9 -3
  26. package/_modules/themes/five/src/components/NavigationBar/index.js +159 -0
  27. package/_modules/themes/five/src/components/NavigationBar/styles.js +33 -0
  28. package/_modules/themes/five/src/components/OrderDetails/index.js +71 -41
  29. package/_modules/themes/five/src/components/ProfessionalBusinessFilter/index.js +96 -0
  30. package/_modules/themes/five/src/components/ProfessionalBusinessFilter/styles.js +48 -0
  31. package/_modules/themes/five/src/components/ProfessionalFilter/index.js +35 -7
  32. package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +10 -4
  33. package/_modules/themes/five/src/components/ProfessionalInfo/index.js +120 -0
  34. package/_modules/themes/five/src/components/ProfessionalInfo/styles.js +100 -0
  35. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +36 -13
  36. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +21 -18
  37. package/_modules/themes/five/src/components/ReviewProfessional/index.js +314 -0
  38. package/_modules/themes/five/src/components/ReviewProfessional/styles.js +137 -0
  39. package/_modules/themes/five/src/components/SignUpApproval/index.js +106 -0
  40. package/_modules/themes/five/src/components/SignUpApproval/styles.js +71 -0
  41. package/_modules/themes/five/src/components/SignUpBusiness/index.js +7 -383
  42. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +405 -0
  43. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +110 -0
  44. package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +400 -0
  45. package/_modules/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
  46. package/_modules/themes/five/src/components/SignUpDriver/index.js +7 -383
  47. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +405 -0
  48. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +106 -0
  49. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +400 -0
  50. package/_modules/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
  51. package/_modules/themes/five/src/components/SingleProductCard/styles.js +1 -1
  52. package/_modules/utils/index.js +103 -0
  53. package/package.json +2 -2
  54. package/src/components/AutoScroll/styles.js +11 -12
  55. package/src/hooks/useIsMounted.js +18 -0
  56. package/src/index.js +2 -0
  57. package/src/themes/five/index.js +9 -1
  58. package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
  59. package/src/themes/five/src/components/BusinessController/styles.js +3 -6
  60. package/src/themes/five/src/components/BusinessProductsCategories/index.js +10 -2
  61. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +5 -0
  62. package/src/themes/five/src/components/BusinessProductsListing/index.js +8 -2
  63. package/src/themes/five/src/components/BusinessProductsListing/styles.js +1 -1
  64. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -0
  65. package/src/themes/five/src/components/MultiCheckout/index.js +1 -0
  66. package/src/themes/five/src/components/MultiCheckout/styles.js +1 -0
  67. package/src/themes/five/src/components/MyOrders/index.js +6 -3
  68. package/src/themes/five/src/components/NavigationBar/index.js +104 -0
  69. package/src/themes/five/src/components/NavigationBar/styles.js +44 -0
  70. package/src/themes/five/src/components/OrderDetails/index.js +19 -11
  71. package/src/themes/five/src/components/ProfessionalBusinessFilter/index.js +82 -0
  72. package/src/themes/five/src/components/ProfessionalBusinessFilter/styles.js +71 -0
  73. package/src/themes/five/src/components/ProfessionalFilter/index.js +30 -7
  74. package/src/themes/five/src/components/ProfessionalFilter/styles.js +15 -2
  75. package/src/themes/five/src/components/ProfessionalInfo/index.js +133 -0
  76. package/src/themes/five/src/components/ProfessionalInfo/styles.js +140 -0
  77. package/src/themes/five/src/components/RenderProductsLayout/index.js +37 -16
  78. package/src/themes/five/src/components/RenderProductsLayout/styles.js +6 -1
  79. package/src/themes/five/src/components/ReviewProfessional/index.js +239 -0
  80. package/src/themes/five/src/components/ReviewProfessional/styles.js +233 -0
  81. package/src/themes/five/src/components/SignUpApproval/index.js +108 -0
  82. package/src/themes/five/src/components/SignUpApproval/styles.js +98 -0
  83. package/src/themes/five/src/components/SignUpBusiness/index.js +10 -374
  84. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +382 -0
  85. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +256 -0
  86. package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +378 -0
  87. package/src/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
  88. package/src/themes/five/src/components/SignUpDriver/index.js +10 -374
  89. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +382 -0
  90. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +262 -0
  91. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +378 -0
  92. package/src/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
  93. package/src/themes/five/src/components/SingleProductCard/styles.js +3 -1
  94. package/src/utils/index.js +54 -0
  95. package/_bundles/5.ordering-ui.fc62fe574704c7c4d033.js +0 -1
  96. package/_bundles/7.ordering-ui.fc62fe574704c7c4d033.js +0 -2
  97. package/_bundles/ordering-ui.fc62fe574704c7c4d033.js +0 -2
@@ -0,0 +1,400 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SignUpDriver = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactHookForm = require("react-hook-form");
13
+
14
+ var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
15
+
16
+ var _Confirm = require("../../../Confirm");
17
+
18
+ var _InputPhoneNumber = require("../../../../../../../components/InputPhoneNumber");
19
+
20
+ var _libphonenumberJs = _interopRequireDefault(require("libphonenumber-js"));
21
+
22
+ var _styledComponents = require("styled-components");
23
+
24
+ var _Inputs = require("../../../../styles/Inputs");
25
+
26
+ var _Buttons = require("../../../../styles/Buttons");
27
+
28
+ var _Checkbox = require("../../../../../../../styles/Checkbox");
29
+
30
+ var _utils = require("../../../../../../../utils");
31
+
32
+ var _AiOutlineEye = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEye"));
33
+
34
+ var _AiOutlineEyeInvisible = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEyeInvisible"));
35
+
36
+ var _orderingComponentsExternal = require("ordering-components-external");
37
+
38
+ var _styles = require("./styles");
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
+
42
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
+
44
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
45
+
46
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
47
+
48
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
49
+
50
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
51
+
52
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
53
+
54
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
55
+
56
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
57
+
58
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
59
+
60
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
61
+
62
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
63
+
64
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
65
+
66
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
67
+
68
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
69
+
70
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
71
+
72
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
73
+
74
+ var notValidationFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'address_notes'];
75
+
76
+ var SignUpDriverUI = function SignUpDriverUI(props) {
77
+ var _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _configs$verification, _theme$images, _theme$images$general, _props$beforeMidEleme, _props$beforeMidCompo, _validationFields$fie12, _validationFields$fie13, _props$afterMidElemen, _props$afterMidCompon, _configs$terms_and_co, _configs$terms_and_co2;
78
+
79
+ var handleChangeInput = props.handleChangeInput,
80
+ handleButtonSignupClick = props.handleButtonSignupClick,
81
+ handleReCaptcha = props.handleReCaptcha,
82
+ useChekoutFileds = props.useChekoutFileds,
83
+ validationFields = props.validationFields,
84
+ showField = props.showField,
85
+ isRequiredField = props.isRequiredField,
86
+ formState = props.formState,
87
+ handleSuccessSignup = props.handleSuccessSignup,
88
+ isPopup = props.isPopup,
89
+ externalPhoneNumber = props.externalPhoneNumber,
90
+ saveCustomerUser = props.saveCustomerUser,
91
+ fieldsNotValid = props.fieldsNotValid,
92
+ signupData = props.signupData,
93
+ enableReCaptcha = props.enableReCaptcha;
94
+ var theme = (0, _styledComponents.useTheme)();
95
+
96
+ var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
97
+ _useLanguage2 = _slicedToArray(_useLanguage, 2),
98
+ t = _useLanguage2[1];
99
+
100
+ var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
101
+ _useConfig2 = _slicedToArray(_useConfig, 1),
102
+ configs = _useConfig2[0].configs;
103
+
104
+ var formMethods = (0, _reactHookForm.useForm)();
105
+
106
+ var _useState = (0, _react.useState)({
107
+ open: false,
108
+ content: []
109
+ }),
110
+ _useState2 = _slicedToArray(_useState, 2),
111
+ alertState = _useState2[0],
112
+ setAlertState = _useState2[1];
113
+
114
+ var emailInput = (0, _react.useRef)(null);
115
+
116
+ var _useState3 = (0, _react.useState)(''),
117
+ _useState4 = _slicedToArray(_useState3, 2),
118
+ userPhoneNumber = _useState4[0],
119
+ setUserPhoneNumber = _useState4[1];
120
+
121
+ var _useState5 = (0, _react.useState)(null),
122
+ _useState6 = _slicedToArray(_useState5, 2),
123
+ isValidPhoneNumber = _useState6[0],
124
+ setIsValidPhoneNumber = _useState6[1];
125
+
126
+ var _useState7 = (0, _react.useState)(false),
127
+ _useState8 = _slicedToArray(_useState7, 2),
128
+ passwordSee = _useState8[0],
129
+ setPasswordSee = _useState8[1];
130
+
131
+ var showInputPhoneNumber = ((_validationFields$fie = validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie2 = validationFields.fields) === null || _validationFields$fie2 === void 0 ? void 0 : (_validationFields$fie3 = _validationFields$fie2.checkout) === null || _validationFields$fie3 === void 0 ? void 0 : (_validationFields$fie4 = _validationFields$fie3.cellphone) === null || _validationFields$fie4 === void 0 ? void 0 : _validationFields$fie4.enabled) !== null && _validationFields$fie !== void 0 ? _validationFields$fie : false) || (configs === null || configs === void 0 ? void 0 : (_configs$verification = configs.verification_phone_required) === null || _configs$verification === void 0 ? void 0 : _configs$verification.value) === '1';
132
+
133
+ var togglePasswordView = function togglePasswordView() {
134
+ setPasswordSee(!passwordSee);
135
+ };
136
+
137
+ var closeAlert = function closeAlert() {
138
+ setAlertState({
139
+ open: false,
140
+ content: []
141
+ });
142
+ };
143
+
144
+ var onSubmit = function onSubmit() {
145
+ var _validationFields$fie5, _validationFields$fie6, _validationFields$fie7, _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$verification2;
146
+
147
+ var isPhoneNumberValid = userPhoneNumber ? isValidPhoneNumber : true;
148
+
149
+ if (!userPhoneNumber && (validationFields !== null && validationFields !== void 0 && (_validationFields$fie5 = validationFields.fields) !== null && _validationFields$fie5 !== void 0 && (_validationFields$fie6 = _validationFields$fie5.checkout) !== null && _validationFields$fie6 !== void 0 && (_validationFields$fie7 = _validationFields$fie6.cellphone) !== null && _validationFields$fie7 !== void 0 && _validationFields$fie7.enabled && validationFields !== null && validationFields !== void 0 && (_validationFields$fie8 = validationFields.fields) !== null && _validationFields$fie8 !== void 0 && (_validationFields$fie9 = _validationFields$fie8.checkout) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie10 = _validationFields$fie9.cellphone) !== null && _validationFields$fie10 !== void 0 && _validationFields$fie10.required || (configs === null || configs === void 0 ? void 0 : (_configs$verification2 = configs.verification_phone_required) === null || _configs$verification2 === void 0 ? void 0 : _configs$verification2.value) === '1')) {
150
+ setAlertState({
151
+ open: true,
152
+ content: [t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.')]
153
+ });
154
+ return;
155
+ }
156
+
157
+ if (!isPhoneNumberValid) {
158
+ setAlertState({
159
+ open: true,
160
+ content: [t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')]
161
+ });
162
+ return;
163
+ }
164
+
165
+ handleButtonSignupClick && handleButtonSignupClick();
166
+
167
+ if (!formState.loading && formState.result.result && !formState.result.error) {
168
+ handleSuccessSignup(formState.result.result);
169
+ }
170
+ };
171
+
172
+ var handleChangePhoneNumber = function handleChangePhoneNumber(number, isValid) {
173
+ setUserPhoneNumber(number);
174
+ var phoneNumberParser = null;
175
+ var phoneNumber = {
176
+ country_phone_code: {
177
+ name: 'country_phone_code',
178
+ value: ''
179
+ },
180
+ cellphone: {
181
+ name: 'cellphone',
182
+ value: ''
183
+ }
184
+ };
185
+
186
+ if (isValid) {
187
+ phoneNumberParser = (0, _libphonenumberJs.default)(number);
188
+ }
189
+
190
+ if (phoneNumberParser) {
191
+ phoneNumber = {
192
+ country_phone_code: {
193
+ name: 'country_phone_code',
194
+ value: phoneNumberParser.countryCallingCode
195
+ },
196
+ cellphone: {
197
+ name: 'cellphone',
198
+ value: phoneNumberParser.nationalNumber
199
+ }
200
+ };
201
+ }
202
+
203
+ handleChangeInput(phoneNumber, true);
204
+ };
205
+
206
+ var handleChangeInputEmail = function handleChangeInputEmail(e) {
207
+ handleChangeInput({
208
+ target: {
209
+ name: 'email',
210
+ value: e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, '')
211
+ }
212
+ });
213
+ formMethods.setValue('email', e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, ''));
214
+
215
+ if (emailInput !== null && emailInput !== void 0 && emailInput.current) {
216
+ emailInput.current.value = e.target.value.toLowerCase().replace(/[&,()%";:ç?<>{}\\[\]\s]/g, '');
217
+ }
218
+ };
219
+
220
+ (0, _react.useEffect)(function () {
221
+ var _formState$result, _formState$result3, _formState$result4;
222
+
223
+ if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
224
+ var _formState$result2;
225
+
226
+ setAlertState({
227
+ open: true,
228
+ content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
229
+ });
230
+ } else if (!formState.loading && !((_formState$result3 = formState.result) !== null && _formState$result3 !== void 0 && _formState$result3.error) && (_formState$result4 = formState.result) !== null && _formState$result4 !== void 0 && _formState$result4.result) {
231
+ var _formState$result5;
232
+
233
+ saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
234
+ }
235
+ }, [formState]);
236
+ (0, _react.useEffect)(function () {
237
+ if (Object.keys(formMethods.errors).length > 0) {
238
+ setAlertState({
239
+ open: true,
240
+ content: Object.values(formMethods.errors).map(function (error) {
241
+ return error.message;
242
+ })
243
+ });
244
+ }
245
+ }, [formMethods.errors]);
246
+ (0, _react.useEffect)(function () {
247
+ if (!validationFields.loading) {
248
+ var _validationFields$fie11;
249
+
250
+ Object.values(validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie11 = validationFields.fields) === null || _validationFields$fie11 === void 0 ? void 0 : _validationFields$fie11.checkout).map(function (field) {
251
+ return !notValidationFields.includes(field.code) && (field.code === 'email' ? formMethods.register('email', {
252
+ required: isRequiredField(field.code) ? t('VALIDATION_ERROR_EMAIL_REQUIRED', 'The field Email is required').replace('_attribute_', t('EMAIL', 'Email')) : null,
253
+ pattern: {
254
+ value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
255
+ message: t('INVALID_ERROR_EMAIL', 'Invalid email address').replace('_attribute_', t('EMAIL', 'Email'))
256
+ }
257
+ }) : formMethods.register(field.code, {
258
+ required: isRequiredField(field.code) ? t("VALIDATION_ERROR_".concat(field.code.toUpperCase(), "_REQUIRED"), "".concat(field.name, " is required")).replace('_attribute_', t(field.name, field.code)) : null
259
+ }));
260
+ });
261
+ }
262
+ }, [formMethods]);
263
+ (0, _react.useEffect)(function () {
264
+ Object.keys(signupData).map(function (fieldName) {
265
+ formMethods.setValue(fieldName, signupData[fieldName]);
266
+ });
267
+ }, [signupData]);
268
+ (0, _react.useEffect)(function () {
269
+ if (externalPhoneNumber) {
270
+ setUserPhoneNumber(externalPhoneNumber);
271
+ handleChangePhoneNumber(externalPhoneNumber, true);
272
+ }
273
+ }, [externalPhoneNumber]);
274
+ (0, _react.useEffect)(function () {
275
+ handleChangeInput({
276
+ target: {
277
+ name: 'level',
278
+ value: 4
279
+ }
280
+ });
281
+ }, []);
282
+ return /*#__PURE__*/_react.default.createElement(_styles.SignUpDriverContainer, null, /*#__PURE__*/_react.default.createElement(_styles.SignUpHeroWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.SignUpHero, {
283
+ bgimage: (_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$general = _theme$images.general) === null || _theme$images$general === void 0 ? void 0 : _theme$images$general.driverSignUpHero
284
+ })), /*#__PURE__*/_react.default.createElement(_styles.FormSide, null, /*#__PURE__*/_react.default.createElement("h1", null, t('TITLE_DRIVER_SIGNUP', 'Get Started')), /*#__PURE__*/_react.default.createElement(_styles.FormInput, {
285
+ noValidate: true,
286
+ isPopup: isPopup,
287
+ onSubmit: formMethods.handleSubmit(onSubmit),
288
+ isSkeleton: useChekoutFileds && (validationFields === null || validationFields === void 0 ? void 0 : validationFields.loading)
289
+ }, (_props$beforeMidEleme = props.beforeMidElements) === null || _props$beforeMidEleme === void 0 ? void 0 : _props$beforeMidEleme.map(function (BeforeMidElements, i) {
290
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
291
+ key: i
292
+ }, BeforeMidElements);
293
+ }), (_props$beforeMidCompo = props.beforeMidComponents) === null || _props$beforeMidCompo === void 0 ? void 0 : _props$beforeMidCompo.map(function (BeforeMidComponents, i) {
294
+ return /*#__PURE__*/_react.default.createElement(BeforeMidComponents, _extends({
295
+ key: i
296
+ }, props));
297
+ }), !(useChekoutFileds && validationFields !== null && validationFields !== void 0 && validationFields.loading) ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie12 = validationFields.fields) === null || _validationFields$fie12 === void 0 ? void 0 : _validationFields$fie12.checkout) && (0, _utils.sortInputFields)({
298
+ values: validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie13 = validationFields.fields) === null || _validationFields$fie13 === void 0 ? void 0 : _validationFields$fie13.checkout
299
+ }).map(function (field) {
300
+ return showField && showField(field.code) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
301
+ key: field.id
302
+ }, field.code === 'email' ? /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
303
+ type: field.type,
304
+ name: field.code,
305
+ "aria-label": field.code,
306
+ className: "form",
307
+ placeholder: t(field.code.toUpperCase(), field.name),
308
+ onChange: handleChangeInputEmail,
309
+ ref: function ref(e) {
310
+ emailInput.current = e;
311
+ },
312
+ required: !!field.required,
313
+ autoComplete: "off"
314
+ }) : /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
315
+ type: field.type,
316
+ name: field.code,
317
+ "aria-label": field.code,
318
+ className: "form",
319
+ placeholder: t(field.code.toUpperCase(), field.name),
320
+ onChange: handleChangeInput,
321
+ required: field.required,
322
+ autoComplete: "off"
323
+ }));
324
+ }), !!showInputPhoneNumber && /*#__PURE__*/_react.default.createElement(_styles.PhoneNumberWrapper, null, /*#__PURE__*/_react.default.createElement(_InputPhoneNumber.InputPhoneNumber, {
325
+ value: userPhoneNumber,
326
+ setValue: handleChangePhoneNumber,
327
+ handleIsValid: setIsValidPhoneNumber
328
+ })), (!fieldsNotValid || fieldsNotValid && !fieldsNotValid.includes('password')) && /*#__PURE__*/_react.default.createElement(_styles.WrapperPassword, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
329
+ type: !passwordSee ? 'password' : 'text',
330
+ name: "password",
331
+ "aria-label": "password",
332
+ className: "form",
333
+ placeholder: t('PASSWORD', 'Password'),
334
+ onChange: handleChangeInput,
335
+ required: true,
336
+ ref: formMethods.register({
337
+ required: isRequiredField('password') ? t('VALIDATION_ERROR_PASSWORD_REQUIRED', 'The field Password is required').replace('_attribute_', t('PASSWORD', 'password')) : null,
338
+ minLength: {
339
+ value: 8,
340
+ message: t('VALIDATION_ERROR_PASSWORD_MIN_STRING', 'The Password must be at least 8 characters.').replace('_attribute_', t('PASSWORD', 'Password')).replace('_min_', 8)
341
+ }
342
+ })
343
+ }), /*#__PURE__*/_react.default.createElement(_styles.TogglePassword, {
344
+ onClick: togglePasswordView
345
+ }, !passwordSee ? /*#__PURE__*/_react.default.createElement(_AiOutlineEye.default, null) : /*#__PURE__*/_react.default.createElement(_AiOutlineEyeInvisible.default, null))), (_props$afterMidElemen = props.afterMidElements) === null || _props$afterMidElemen === void 0 ? void 0 : _props$afterMidElemen.map(function (MidElement, i) {
346
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
347
+ key: i
348
+ }, MidElement);
349
+ }), (_props$afterMidCompon = props.afterMidComponents) === null || _props$afterMidCompon === void 0 ? void 0 : _props$afterMidCompon.map(function (MidComponent, i) {
350
+ return /*#__PURE__*/_react.default.createElement(MidComponent, _extends({
351
+ key: i
352
+ }, props));
353
+ })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _toConsumableArray(Array(5)).map(function (_, i) {
354
+ return /*#__PURE__*/_react.default.createElement(_styles.SkeletonWrapper, {
355
+ key: i
356
+ }, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
357
+ height: 43
358
+ }));
359
+ })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
360
+ handleReCaptcha: handleReCaptcha
361
+ })), (configs === null || configs === void 0 ? void 0 : (_configs$terms_and_co = configs.terms_and_conditions) === null || _configs$terms_and_co === void 0 ? void 0 : _configs$terms_and_co.value) === 'true' && /*#__PURE__*/_react.default.createElement(_styles.TermsConditionWrapper, null, /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
362
+ name: "acceptTerms",
363
+ ref: formMethods.register({
364
+ required: t('ERROR_ACCEPT_TERMS', 'You must accept the Terms & Conditions.')
365
+ }),
366
+ id: "acceptTerms"
367
+ }), /*#__PURE__*/_react.default.createElement("label", {
368
+ htmlFor: "acceptTerms"
369
+ }, /*#__PURE__*/_react.default.createElement("span", null, t('TERMS_AND_CONDITIONS_TEXT', 'I’m agree with')), /*#__PURE__*/_react.default.createElement("a", {
370
+ href: configs === null || configs === void 0 ? void 0 : (_configs$terms_and_co2 = configs.terms_and_conditions_url) === null || _configs$terms_and_co2 === void 0 ? void 0 : _configs$terms_and_co2.value,
371
+ target: "_blank",
372
+ rel: "noopener noreferrer"
373
+ }, t('TERMS_AND_CONDITIONS', 'Terms & Conditions')))), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
374
+ color: "primary",
375
+ type: "submit",
376
+ disabled: formState.loading || (validationFields === null || validationFields === void 0 ? void 0 : validationFields.loading)
377
+ }, formState.loading ? "".concat(t('LOADING', 'Loading'), "...") : t('SUBMIT', 'Submit')))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
378
+ title: t('SIGN_UP_FOR_BUSINESS', 'Sign up for business'),
379
+ content: alertState.content,
380
+ acceptText: t('ACCEPT', 'Accept'),
381
+ open: alertState.open,
382
+ onClose: function onClose() {
383
+ return closeAlert();
384
+ },
385
+ onAccept: function onAccept() {
386
+ return closeAlert();
387
+ },
388
+ closeOnBackdrop: false
389
+ }));
390
+ };
391
+
392
+ var SignUpDriver = function SignUpDriver(props) {
393
+ var signUpDriverProps = _objectSpread(_objectSpread({}, props), {}, {
394
+ UIComponent: SignUpDriverUI
395
+ });
396
+
397
+ return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.SignupForm, signUpDriverProps);
398
+ };
399
+
400
+ exports.SignUpDriver = SignUpDriver;
@@ -123,7 +123,7 @@ var QuantityContainer = _styledComponents.default.div(_templateObject22 || (_tem
123
123
 
124
124
  exports.QuantityContainer = QuantityContainer;
125
125
 
126
- var RibbonBox = _styledComponents.default.div(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n position: absolute;\n padding: 2px 8px;\n box-sizing: border-box;\n z-index: 10;\n color: ", ";\n font-weight: 400;\n font-size: 10px;\n line-height: 13px;\n top: -4px;\n right: -3px;\n background-color: ", ";\n max-width: 50px;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n ", "\n ", "\n ", "\n ", "\n"])), function (props) {
126
+ var RibbonBox = _styledComponents.default.div(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n position: absolute;\n padding: 2px 8px;\n box-sizing: border-box;\n z-index: 10;\n color: ", ";\n font-weight: 400;\n font-size: 10px;\n line-height: 13px;\n top: -4px;\n right: -3px;\n background-color: ", ";\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n max-width: 70px;\n word-break: break-all;\n\n ", "\n ", "\n ", "\n ", "\n"])), function (props) {
127
127
  return props.theme.colors.colorTextSignForm;
128
128
  }, function (props) {
129
129
  return props.theme.colors.primary;
@@ -729,6 +729,109 @@ var reviewCommentList = function reviewCommentList(type) {
729
729
  }]
730
730
  }
731
731
  },
732
+ professional: {
733
+ 1: {
734
+ title: t('PROFESSIONAL_QUICK_COMMENT_TITLE_1', 'What went wrong?'),
735
+ list: [{
736
+ key: 0,
737
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_0', 'Not handled with care')
738
+ }, {
739
+ key: 1,
740
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_1', 'Poor communication')
741
+ }, {
742
+ key: 2,
743
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_2', 'COVID-19 issue')
744
+ }, {
745
+ key: 3,
746
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_3', 'Didn\'t follow instructions')
747
+ }, {
748
+ key: 4,
749
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_4', 'Rude')
750
+ }, {
751
+ key: 5,
752
+ content: t('PROFESSIONAL_QUICK_COMMENT_1_5', 'Not on-time')
753
+ }]
754
+ },
755
+ 2: {
756
+ title: t('PROFESSIONAL_QUICK_COMMENT_TITLE_2', 'What went wrong?'),
757
+ list: [{
758
+ key: 0,
759
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_0', 'Not handled with care')
760
+ }, {
761
+ key: 1,
762
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_1', 'Poor communication')
763
+ }, {
764
+ key: 2,
765
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_2', 'COVID-19 issue')
766
+ }, {
767
+ key: 3,
768
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_3', 'Didn\'t follow instructions')
769
+ }, {
770
+ key: 4,
771
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_4', 'Rude')
772
+ }, {
773
+ key: 5,
774
+ content: t('PROFESSIONAL_QUICK_COMMENT_2_5', 'Not on-time')
775
+ }]
776
+ },
777
+ 3: {
778
+ title: t('PROFESSIONAL_QUICK_COMMENT_TITLE_3', 'What could have been better?'),
779
+ list: [{
780
+ key: 0,
781
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_0', 'Not handled with care')
782
+ }, {
783
+ key: 1,
784
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_1', 'Poor communication')
785
+ }, {
786
+ key: 2,
787
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_2', 'COVID-19 issue')
788
+ }, {
789
+ key: 3,
790
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_3', 'Didn\'t follow instructions')
791
+ }, {
792
+ key: 4,
793
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_4', 'Rude')
794
+ }, {
795
+ key: 5,
796
+ content: t('PROFESSIONAL_QUICK_COMMENT_3_5', 'Not on-time')
797
+ }]
798
+ },
799
+ 4: {
800
+ title: t('PROFESSIONAL_QUICK_COMMENT_TITLE_4', ' Tell us more'),
801
+ list: [{
802
+ key: 0,
803
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_0', 'Not handled with care')
804
+ }, {
805
+ key: 1,
806
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_1', 'Poor communication')
807
+ }, {
808
+ key: 2,
809
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_2', 'COVID-19 issue')
810
+ }, {
811
+ key: 3,
812
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_3', 'Didn\'t follow instructions')
813
+ }, {
814
+ key: 4,
815
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_4', 'Rude')
816
+ }, {
817
+ key: 5,
818
+ content: t('PROFESSIONAL_QUICK_COMMENT_4_5', 'Not on-time')
819
+ }]
820
+ },
821
+ 5: {
822
+ title: t('PROFESSIONAL_QUICK_COMMENT_TITLE_5', 'What went well?'),
823
+ list: [{
824
+ key: 0,
825
+ content: t('PROFESSIONAL_QUICK_COMMENT_5_0', 'Perfect service')
826
+ }, {
827
+ key: 1,
828
+ content: t('PROFESSIONAL_QUICK_COMMENT_5_1', 'Excellent communication')
829
+ }, {
830
+ key: 2,
831
+ content: t('PROFESSIONAL_QUICK_COMMENT_5_2', 'Cordial service')
832
+ }]
833
+ }
834
+ },
732
835
  product: {
733
836
  like: [{
734
837
  key: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "libphonenumber-js": "^1.9.4",
84
84
  "lodash": "^4.17.19",
85
85
  "moment": "^2.29.4",
86
- "ordering-components-external": "1.1.4",
86
+ "ordering-components-external": "1.2.0",
87
87
  "polished": "^3.6.6",
88
88
  "react-bootstrap-icons": "^1.7.2",
89
89
  "react-calendar": "^3.3.1",
@@ -17,6 +17,7 @@ export const AutoscrollContainer = styled.span`
17
17
  color: #000000;
18
18
  border: 1px solid #D9D9D9;
19
19
  opacity: 0.8;
20
+ z-index: 120;
20
21
  }
21
22
 
22
23
  #right-autoscroll{
@@ -49,8 +50,7 @@ export const AutoscrollContainer = styled.span`
49
50
  #left-autoscroll{
50
51
  ${props => props.theme?.rtl && css`
51
52
  right: 94%;
52
- `
53
- }
53
+ `}
54
54
  }
55
55
  }
56
56
 
@@ -58,26 +58,25 @@ export const AutoscrollContainer = styled.span`
58
58
  width: ${props => props.modal && '100%'};
59
59
  display: inherit;
60
60
  ${props => props.modal && css`
61
- #left-autoscroll{
61
+ #left-autoscroll {
62
62
  opacity: 0;
63
63
  }
64
- #right-autoscroll{
64
+ #right-autoscroll {
65
65
  opacity: 0;
66
66
  }
67
67
  `}
68
68
  }
69
69
 
70
70
  @media (min-width: 1024px){
71
- #right-autoscroll{
72
- ${props => props.theme?.rtl && css`
73
- left: 97%;
74
- `}
75
- }
76
- #left-autoscroll{
71
+ #right-autoscroll {
72
+ ${props => props.theme?.rtl && css`
73
+ left: 97%;
74
+ `}
75
+ }
76
+ #left-autoscroll {
77
77
  ${props => props.theme?.rtl && css`
78
78
  right: 97%;
79
- `
79
+ `}
80
80
  }
81
81
  }
82
- }
83
82
  `
@@ -0,0 +1,18 @@
1
+ import { useRef, useEffect, useCallback } from 'react'
2
+
3
+ export const useIsMounted = () => {
4
+ const isMounted = useRef(false)
5
+ useEffect(() => {
6
+ isMounted.current = true
7
+
8
+ return () => {
9
+ isMounted.current = false
10
+ }
11
+ }, [])
12
+
13
+ const mounted = useCallback(() => {
14
+ return isMounted.current
15
+ }, [])
16
+
17
+ return mounted()
18
+ }
package/src/index.js CHANGED
@@ -99,6 +99,7 @@ import { useOnlineStatus } from './hooks/useOnlineStatus'
99
99
  import { useWindowSize } from './hooks/useWindowSize'
100
100
  import { useCountdownTimer } from './hooks/useCountdownTimer'
101
101
  import { useIntersectionObserver } from './hooks/useIntersectionObserver'
102
+ import { useIsMounted } from './hooks/useIsMounted'
102
103
 
103
104
  import { Button } from './styles/Buttons'
104
105
  import { Input, InputGroup, InputPrimary, InputGroupLeft, InputGroupPrimary, InputGroupRight, InputSecundary, TextArea } from './styles/Inputs'
@@ -238,6 +239,7 @@ export {
238
239
  useWindowSize,
239
240
  useCountdownTimer,
240
241
  useIntersectionObserver,
242
+ useIsMounted,
241
243
  // Styles
242
244
  Button,
243
245
  Input,