ordering-ui-external 1.2.3 → 1.3.1

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 (99) hide show
  1. package/_bundles/{0.ordering-ui.fc62fe574704c7c4d033.js → 0.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  2. package/_bundles/{1.ordering-ui.fc62fe574704c7c4d033.js → 1.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  3. package/_bundles/{3.ordering-ui.fc62fe574704c7c4d033.js → 3.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  4. package/_bundles/{4.ordering-ui.fc62fe574704c7c4d033.js → 4.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  5. package/_bundles/5.ordering-ui.51c00e5a30bb4c51b2e4.js +1 -0
  6. package/_bundles/{6.ordering-ui.fc62fe574704c7c4d033.js → 6.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  7. package/_bundles/7.ordering-ui.51c00e5a30bb4c51b2e4.js +2 -0
  8. package/_bundles/{7.ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → 7.ordering-ui.51c00e5a30bb4c51b2e4.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.fc62fe574704c7c4d033.js → 8.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  10. package/_bundles/{9.ordering-ui.fc62fe574704c7c4d033.js → 9.ordering-ui.51c00e5a30bb4c51b2e4.js} +1 -1
  11. package/_bundles/ordering-ui.51c00e5a30bb4c51b2e4.js +2 -0
  12. package/_bundles/{ordering-ui.fc62fe574704c7c4d033.js.LICENSE.txt → ordering-ui.51c00e5a30bb4c51b2e4.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/Checkout/index.js +1 -1
  25. package/_modules/themes/five/src/components/MultiCheckout/styles.js +1 -1
  26. package/_modules/themes/five/src/components/MyOrders/index.js +9 -3
  27. package/_modules/themes/five/src/components/NavigationBar/index.js +159 -0
  28. package/_modules/themes/five/src/components/NavigationBar/styles.js +33 -0
  29. package/_modules/themes/five/src/components/OrderDetails/index.js +71 -41
  30. package/_modules/themes/five/src/components/ProfessionalBusinessFilter/index.js +96 -0
  31. package/_modules/themes/five/src/components/ProfessionalBusinessFilter/styles.js +48 -0
  32. package/_modules/themes/five/src/components/ProfessionalFilter/index.js +35 -7
  33. package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +10 -4
  34. package/_modules/themes/five/src/components/ProfessionalInfo/index.js +120 -0
  35. package/_modules/themes/five/src/components/ProfessionalInfo/styles.js +100 -0
  36. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +36 -13
  37. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +21 -18
  38. package/_modules/themes/five/src/components/ReviewProfessional/index.js +314 -0
  39. package/_modules/themes/five/src/components/ReviewProfessional/styles.js +137 -0
  40. package/_modules/themes/five/src/components/SignUpApproval/index.js +106 -0
  41. package/_modules/themes/five/src/components/SignUpApproval/styles.js +71 -0
  42. package/_modules/themes/five/src/components/SignUpBusiness/index.js +7 -383
  43. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +405 -0
  44. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +110 -0
  45. package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +400 -0
  46. package/_modules/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
  47. package/_modules/themes/five/src/components/SignUpDriver/index.js +7 -383
  48. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +405 -0
  49. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +106 -0
  50. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +400 -0
  51. package/_modules/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
  52. package/_modules/themes/five/src/components/SingleProductCard/styles.js +1 -1
  53. package/_modules/utils/index.js +103 -0
  54. package/package.json +2 -2
  55. package/src/components/AutoScroll/styles.js +11 -12
  56. package/src/hooks/useIsMounted.js +18 -0
  57. package/src/index.js +2 -0
  58. package/src/themes/five/index.js +9 -1
  59. package/src/themes/five/src/components/BusinessBasicInformation/index.js +1 -1
  60. package/src/themes/five/src/components/BusinessController/styles.js +3 -6
  61. package/src/themes/five/src/components/BusinessProductsCategories/index.js +10 -2
  62. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +5 -0
  63. package/src/themes/five/src/components/BusinessProductsListing/index.js +8 -2
  64. package/src/themes/five/src/components/BusinessProductsListing/styles.js +1 -1
  65. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +2 -0
  66. package/src/themes/five/src/components/Checkout/index.js +1 -1
  67. package/src/themes/five/src/components/MultiCheckout/index.js +1 -0
  68. package/src/themes/five/src/components/MultiCheckout/styles.js +1 -0
  69. package/src/themes/five/src/components/MyOrders/index.js +6 -3
  70. package/src/themes/five/src/components/NavigationBar/index.js +104 -0
  71. package/src/themes/five/src/components/NavigationBar/styles.js +44 -0
  72. package/src/themes/five/src/components/OrderDetails/index.js +19 -11
  73. package/src/themes/five/src/components/ProfessionalBusinessFilter/index.js +82 -0
  74. package/src/themes/five/src/components/ProfessionalBusinessFilter/styles.js +71 -0
  75. package/src/themes/five/src/components/ProfessionalFilter/index.js +30 -7
  76. package/src/themes/five/src/components/ProfessionalFilter/styles.js +15 -2
  77. package/src/themes/five/src/components/ProfessionalInfo/index.js +133 -0
  78. package/src/themes/five/src/components/ProfessionalInfo/styles.js +140 -0
  79. package/src/themes/five/src/components/RenderProductsLayout/index.js +37 -16
  80. package/src/themes/five/src/components/RenderProductsLayout/styles.js +6 -1
  81. package/src/themes/five/src/components/ReviewProfessional/index.js +239 -0
  82. package/src/themes/five/src/components/ReviewProfessional/styles.js +233 -0
  83. package/src/themes/five/src/components/SignUpApproval/index.js +108 -0
  84. package/src/themes/five/src/components/SignUpApproval/styles.js +98 -0
  85. package/src/themes/five/src/components/SignUpBusiness/index.js +10 -374
  86. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +382 -0
  87. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/styles.js +256 -0
  88. package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +378 -0
  89. package/src/themes/five/src/components/SignUpBusiness/{styles.js → layouts/OldSignUpBusiness/styles.js} +0 -0
  90. package/src/themes/five/src/components/SignUpDriver/index.js +10 -374
  91. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +382 -0
  92. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/styles.js +262 -0
  93. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +378 -0
  94. package/src/themes/five/src/components/SignUpDriver/{styles.js → layouts/OldSignUpDriver/styles.js} +0 -0
  95. package/src/themes/five/src/components/SingleProductCard/styles.js +3 -1
  96. package/src/utils/index.js +54 -0
  97. package/_bundles/5.ordering-ui.fc62fe574704c7c4d033.js +0 -1
  98. package/_bundles/7.ordering-ui.fc62fe574704c7c4d033.js +0 -2
  99. package/_bundles/ordering-ui.fc62fe574704c7c4d033.js +0 -2
@@ -1,400 +1,24 @@
1
1
  "use strict";
2
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
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.SignUpBusiness = void 0;
9
7
 
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");
8
+ var _react = _interopRequireDefault(require("react"));
25
9
 
26
- var _Buttons = require("../../styles/Buttons");
10
+ var _OldSignUpBusiness = require("./layouts/OldSignUpBusiness");
27
11
 
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");
12
+ var _NewSignUpBusiness = require("./layouts/NewSignUpBusiness");
39
13
 
40
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
15
 
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 SignUpBusinessUI = function SignUpBusinessUI(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: 2
279
- }
280
- });
281
- }, []);
282
- return /*#__PURE__*/_react.default.createElement(_styles.SignupBusinessContainer, 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.businessSignUpHero
284
- })), /*#__PURE__*/_react.default.createElement(_styles.FormSide, null, /*#__PURE__*/_react.default.createElement("h1", null, t('SIGN_UP_NOW', 'Sign up now')), /*#__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
16
  var SignUpBusiness = function SignUpBusiness(props) {
393
- var signUpBusinessProps = _objectSpread(_objectSpread({}, props), {}, {
394
- UIComponent: SignUpBusinessUI
395
- });
17
+ var layout = props.layout;
18
+
19
+ var _layout = layout !== null && layout !== void 0 ? layout : 'old';
396
20
 
397
- return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.SignupForm, signUpBusinessProps);
21
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, _layout === 'old' && /*#__PURE__*/_react.default.createElement(_OldSignUpBusiness.SignUpBusiness, props), _layout === 'new' && /*#__PURE__*/_react.default.createElement(_NewSignUpBusiness.SignUpBusiness, props));
398
22
  };
399
23
 
400
24
  exports.SignUpBusiness = SignUpBusiness;