ordering-ui-external 1.6.8 → 1.7.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 (103) hide show
  1. package/_bundles/{0.ordering-ui.7635bd47ae9a481b3f59.js → 0.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  2. package/_bundles/{1.ordering-ui.7635bd47ae9a481b3f59.js → 1.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  3. package/_bundles/{2.ordering-ui.7635bd47ae9a481b3f59.js → 2.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  4. package/_bundles/{4.ordering-ui.7635bd47ae9a481b3f59.js → 4.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  5. package/_bundles/{5.ordering-ui.7635bd47ae9a481b3f59.js → 5.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  6. package/_bundles/{6.ordering-ui.7635bd47ae9a481b3f59.js → 6.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  7. package/_bundles/{7.ordering-ui.7635bd47ae9a481b3f59.js → 7.ordering-ui.8b7044a2b34939a44465.js} +1 -1
  8. package/_bundles/{7.ordering-ui.7635bd47ae9a481b3f59.js.LICENSE.txt → 7.ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.7635bd47ae9a481b3f59.js → 8.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  10. package/_bundles/{9.ordering-ui.7635bd47ae9a481b3f59.js → 9.ordering-ui.8b7044a2b34939a44465.js} +0 -0
  11. package/_bundles/ordering-ui.8b7044a2b34939a44465.js +2 -0
  12. package/_bundles/{ordering-ui.7635bd47ae9a481b3f59.js.LICENSE.txt → ordering-ui.8b7044a2b34939a44465.js.LICENSE.txt} +0 -0
  13. package/_modules/components/BusinessInformation/index.js +8 -10
  14. package/_modules/components/LoginForm/index.js +58 -17
  15. package/_modules/components/SignUpForm/index.js +61 -20
  16. package/_modules/themes/callcenterOriginal/src/components/LoginForm/index.js +71 -25
  17. package/_modules/themes/callcenterOriginal/src/components/SignUpForm/index.js +60 -19
  18. package/_modules/themes/eight/src/components/LoginForm/index.js +63 -20
  19. package/_modules/themes/eight/src/components/SignUpForm/index.js +63 -22
  20. package/_modules/themes/five/src/components/BusinessController/index.js +2 -2
  21. package/_modules/themes/five/src/components/BusinessPreorder/index.js +6 -45
  22. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +1 -1
  23. package/_modules/themes/five/src/components/Checkout/index.js +19 -3
  24. package/_modules/themes/five/src/components/Checkout/styles.js +5 -3
  25. package/_modules/themes/five/src/components/Header/index.js +3 -3
  26. package/_modules/themes/five/src/components/Header/styles.js +1 -1
  27. package/_modules/themes/five/src/components/MomentControl/index.js +1 -41
  28. package/_modules/themes/five/src/components/OrderDetails/OrderBillSection.js +2 -2
  29. package/_modules/themes/five/src/components/OrderDetails/index.js +14 -16
  30. package/_modules/themes/five/src/components/OrderDetails/styles.js +7 -3
  31. package/_modules/themes/five/src/components/PaymentOptions/index.js +3 -6
  32. package/_modules/themes/five/src/components/PlaceSpot/styles.js +2 -2
  33. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +7 -4
  34. package/_modules/themes/five/src/components/ProductOption/index.js +1 -1
  35. package/_modules/themes/five/src/components/ProductOptionSubOption/index.js +1 -1
  36. package/_modules/themes/five/src/components/ProfessionalProfile/index.js +1 -1
  37. package/_modules/themes/five/src/components/ServiceForm/index.js +136 -24
  38. package/_modules/themes/five/src/components/ServiceForm/styles.js +45 -3
  39. package/_modules/themes/four/src/components/LoginForm/index.js +64 -20
  40. package/_modules/themes/four/src/components/LoginForm/styles.js +5 -3
  41. package/_modules/themes/four/src/components/SignUpForm/index.js +67 -22
  42. package/_modules/themes/four/src/components/SignUpForm/styles.js +5 -3
  43. package/_modules/themes/franchise/src/components/LoginForm/index.js +61 -20
  44. package/_modules/themes/franchise/src/components/SignUpForm/index.js +57 -16
  45. package/_modules/themes/seven/src/components/LoginForm/index.js +60 -17
  46. package/_modules/themes/seven/src/components/SignUpForm/index.js +60 -19
  47. package/_modules/themes/six/src/components/LoginForm/index.js +62 -20
  48. package/_modules/themes/six/src/components/SignUpForm/index.js +58 -17
  49. package/_modules/themes/three/src/components/LoginForm/index.js +64 -20
  50. package/_modules/themes/three/src/components/LoginForm/styles.js +5 -3
  51. package/_modules/themes/three/src/components/SignUpForm/index.js +63 -18
  52. package/_modules/themes/three/src/components/SignUpForm/styles.js +5 -3
  53. package/_modules/themes/two/src/components/LoginForm/index.js +57 -17
  54. package/_modules/themes/two/src/components/SignUpForm/index.js +57 -17
  55. package/_modules/utils/index.js +56 -2
  56. package/package.json +2 -2
  57. package/src/components/BusinessInformation/index.js +8 -6
  58. package/src/components/LoginForm/index.js +32 -6
  59. package/src/components/SignUpForm/index.js +27 -2
  60. package/src/themes/callcenterOriginal/src/components/LoginForm/index.js +30 -2
  61. package/src/themes/callcenterOriginal/src/components/SignUpForm/index.js +27 -1
  62. package/src/themes/eight/src/components/LoginForm/index.js +30 -0
  63. package/src/themes/eight/src/components/SignUpForm/index.js +27 -1
  64. package/src/themes/five/src/components/BusinessController/index.js +2 -2
  65. package/src/themes/five/src/components/BusinessPreorder/index.js +6 -46
  66. package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -1
  67. package/src/themes/five/src/components/Checkout/index.js +28 -3
  68. package/src/themes/five/src/components/Checkout/styles.js +30 -0
  69. package/src/themes/five/src/components/Header/index.js +7 -6
  70. package/src/themes/five/src/components/Header/styles.js +1 -3
  71. package/src/themes/five/src/components/MomentControl/index.js +1 -42
  72. package/src/themes/five/src/components/OrderDetails/OrderBillSection.js +1 -1
  73. package/src/themes/five/src/components/OrderDetails/index.js +10 -8
  74. package/src/themes/five/src/components/OrderDetails/styles.js +21 -1
  75. package/src/themes/five/src/components/PaymentOptions/index.js +25 -26
  76. package/src/themes/five/src/components/PlaceSpot/styles.js +14 -4
  77. package/src/themes/five/src/components/ProductItemAccordion/index.js +7 -3
  78. package/src/themes/five/src/components/ProductOption/index.js +1 -1
  79. package/src/themes/five/src/components/ProductOptionSubOption/index.js +1 -1
  80. package/src/themes/five/src/components/ProfessionalProfile/index.js +1 -1
  81. package/src/themes/five/src/components/ServiceForm/index.js +151 -11
  82. package/src/themes/five/src/components/ServiceForm/styles.js +148 -0
  83. package/src/themes/four/src/components/LoginForm/index.js +37 -5
  84. package/src/themes/four/src/components/LoginForm/styles.js +4 -0
  85. package/src/themes/four/src/components/SignUpForm/index.js +39 -5
  86. package/src/themes/four/src/components/SignUpForm/styles.js +4 -0
  87. package/src/themes/franchise/src/components/LoginForm/index.js +26 -1
  88. package/src/themes/franchise/src/components/SignUpForm/index.js +27 -1
  89. package/src/themes/seven/src/components/LoginForm/index.js +31 -0
  90. package/src/themes/seven/src/components/SignUpForm/index.js +27 -1
  91. package/src/themes/six/src/components/LoginForm/index.js +28 -1
  92. package/src/themes/six/src/components/SignUpForm/index.js +27 -1
  93. package/src/themes/three/src/components/LoginForm/index.js +38 -6
  94. package/src/themes/three/src/components/LoginForm/styles.js +4 -0
  95. package/src/themes/three/src/components/SignUpForm/index.js +40 -4
  96. package/src/themes/three/src/components/SignUpForm/styles.js +4 -0
  97. package/src/themes/two/src/components/LoginForm/index.js +25 -1
  98. package/src/themes/two/src/components/SignUpForm/index.js +28 -3
  99. package/src/utils/index.js +53 -0
  100. package/template/app.js +15 -3
  101. package/template/config.json +1 -0
  102. package/template/pages/BusinessProductsList/index.js +2 -2
  103. package/_bundles/ordering-ui.7635bd47ae9a481b3f59.js +0 -2
@@ -23,6 +23,7 @@ var _Confirm = require("../../../../../components/Confirm");
23
23
  var _SpinnerLoader = require("../../../../../components/SpinnerLoader");
24
24
  var _SmsLogin = require("../../../../../components/SmsLogin");
25
25
  var _useCountdownTimer3 = require("../../../../../hooks/useCountdownTimer");
26
+ var _useRecaptcha3 = require("../../../../../hooks/useRecaptcha");
26
27
  var _utils = require("../../../../../utils");
27
28
  var _styles2 = require("./styles");
28
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -70,38 +71,48 @@ var LoginFormUI = function LoginFormUI(props) {
70
71
  _useConfig2 = _slicedToArray(_useConfig, 1),
71
72
  configs = _useConfig2[0].configs;
72
73
  var formMethods = (0, _reactHookForm.useForm)();
74
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
75
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
76
+ recaptchaConfig = _useRecaptcha2[0];
73
77
  var _useState = (0, _react.useState)({
78
+ version: '',
79
+ siteKey: ''
80
+ }),
81
+ _useState2 = _slicedToArray(_useState, 2),
82
+ reCaptchaVersion = _useState2[0],
83
+ setRecaptchaVersion = _useState2[1];
84
+ var _useState3 = (0, _react.useState)({
74
85
  open: false,
75
86
  content: []
76
87
  }),
77
- _useState2 = _slicedToArray(_useState, 2),
78
- alertState = _useState2[0],
79
- setAlertState = _useState2[1];
88
+ _useState4 = _slicedToArray(_useState3, 2),
89
+ alertState = _useState4[0],
90
+ setAlertState = _useState4[1];
80
91
  var _useSession = (0, _orderingComponentsExternal.useSession)(),
81
92
  _useSession2 = _slicedToArray(_useSession, 2),
82
93
  login = _useSession2[1].login;
83
94
  var theme = (0, _styledComponents.useTheme)();
84
- var _useState3 = (0, _react.useState)(false),
85
- _useState4 = _slicedToArray(_useState3, 2),
86
- passwordSee = _useState4[0],
87
- setPasswordSee = _useState4[1];
88
- var emailInput = (0, _react.useRef)(null);
89
95
  var _useState5 = (0, _react.useState)(false),
90
96
  _useState6 = _slicedToArray(_useState5, 2),
91
- loginWithOtpState = _useState6[0],
92
- setLoginWithOtpState = _useState6[1];
97
+ passwordSee = _useState6[0],
98
+ setPasswordSee = _useState6[1];
99
+ var emailInput = (0, _react.useRef)(null);
93
100
  var _useState7 = (0, _react.useState)(false),
94
101
  _useState8 = _slicedToArray(_useState7, 2),
95
- willVerifyOtpState = _useState8[0],
96
- setWillVerifyOtpState = _useState8[1];
102
+ loginWithOtpState = _useState8[0],
103
+ setLoginWithOtpState = _useState8[1];
97
104
  var _useState9 = (0, _react.useState)(false),
98
105
  _useState10 = _slicedToArray(_useState9, 2),
99
- validPhoneFieldState = _useState10[0],
100
- setValidPhoneField = _useState10[1];
101
- var _useState11 = (0, _react.useState)(''),
106
+ willVerifyOtpState = _useState10[0],
107
+ setWillVerifyOtpState = _useState10[1];
108
+ var _useState11 = (0, _react.useState)(false),
102
109
  _useState12 = _slicedToArray(_useState11, 2),
103
- otpState = _useState12[0],
104
- setOtpState = _useState12[1];
110
+ validPhoneFieldState = _useState12[0],
111
+ setValidPhoneField = _useState12[1];
112
+ var _useState13 = (0, _react.useState)(''),
113
+ _useState14 = _slicedToArray(_useState13, 2),
114
+ otpState = _useState14[0],
115
+ setOtpState = _useState14[1];
105
116
  var _useCountdownTimer = (0, _useCountdownTimer3.useCountdownTimer)(600, !(checkPhoneCodeState !== null && checkPhoneCodeState !== void 0 && checkPhoneCodeState.loading) && willVerifyOtpState),
106
117
  _useCountdownTimer2 = _slicedToArray(_useCountdownTimer, 3),
107
118
  otpLeftTime = _useCountdownTimer2[0],
@@ -224,10 +235,30 @@ var LoginFormUI = function LoginFormUI(props) {
224
235
  (0, _react.useEffect)(function () {
225
236
  var _formState$result;
226
237
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
227
- var _formState$result2;
238
+ var _formState$result2, _formState$result2$re, _formState$result3;
239
+ if (((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : (_formState$result2$re = _formState$result2.result) === null || _formState$result2$re === void 0 ? void 0 : _formState$result2$re[0]) === 'ERROR_AUTH_VERIFICATION_CODE') {
240
+ var _configs$security_rec;
241
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
242
+ var _configs$security_rec2;
243
+ setRecaptchaVersion({
244
+ version: 'v2',
245
+ siteKey: configs === null || configs === void 0 ? void 0 : (_configs$security_rec2 = configs.security_recaptcha_site_key) === null || _configs$security_rec2 === void 0 ? void 0 : _configs$security_rec2.value
246
+ });
247
+ setAlertState({
248
+ open: true,
249
+ content: [t('TRY_AGAIN', 'Please try again')]
250
+ });
251
+ return;
252
+ }
253
+ setAlertState({
254
+ open: true,
255
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
256
+ });
257
+ return;
258
+ }
228
259
  setAlertState({
229
260
  open: true,
230
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
261
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
231
262
  });
232
263
  }
233
264
  }, [formState]);
@@ -292,6 +323,14 @@ var LoginFormUI = function LoginFormUI(props) {
292
323
  resetOtpLeftTime();
293
324
  }
294
325
  }, [verifyPhoneState]);
326
+ (0, _react.useEffect)(function () {
327
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
328
+ setRecaptchaVersion({
329
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
330
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
331
+ });
332
+ }
333
+ }, [recaptchaConfig]);
295
334
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_props$beforeElements = props.beforeElements) === null || _props$beforeElements === void 0 ? void 0 : _props$beforeElements.map(function (BeforeElement, i) {
296
335
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
297
336
  key: i
@@ -411,7 +450,10 @@ var LoginFormUI = function LoginFormUI(props) {
411
450
  return /*#__PURE__*/_react.default.createElement(MidComponent, _extends({
412
451
  key: i
413
452
  }, props));
414
- }), !loginWithOtpState && /*#__PURE__*/_react.default.createElement(_styles2.RedirectLink, {
453
+ }), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles2.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
454
+ handleReCaptcha: handleReCaptcha,
455
+ reCaptchaVersion: reCaptchaVersion
456
+ })), !loginWithOtpState && /*#__PURE__*/_react.default.createElement(_styles2.RedirectLink, {
415
457
  isPopup: isPopup
416
458
  }, elementLinkToForgotPassword), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles2.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
417
459
  handleReCaptcha: handleReCaptcha
@@ -456,6 +498,7 @@ var LoginFormUI = function LoginFormUI(props) {
456
498
  };
457
499
  var LoginForm = function LoginForm(props) {
458
500
  var loginControllerProps = _objectSpread(_objectSpread({}, props), {}, {
501
+ isRecaptchaEnable: true,
459
502
  UIComponent: LoginFormUI
460
503
  });
461
504
  return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.LoginForm, loginControllerProps);
@@ -21,6 +21,7 @@ var _Checkbox = require("../../../../../styles/Checkbox");
21
21
  var _styles2 = require("./styles");
22
22
  var _Confirm = require("../../../../../components/Confirm");
23
23
  var _utils = require("../../../../../utils");
24
+ var _useRecaptcha3 = require("../../../../../hooks/useRecaptcha");
24
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
26
  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); }
26
27
  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; }
@@ -73,32 +74,42 @@ var SignUpFormUI = function SignUpFormUI(props) {
73
74
  _useState2 = _slicedToArray(_useState, 2),
74
75
  alertState = _useState2[0],
75
76
  setAlertState = _useState2[1];
77
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
78
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
79
+ recaptchaConfig = _useRecaptcha2[0];
80
+ var _useState3 = (0, _react.useState)({
81
+ version: '',
82
+ siteKey: ''
83
+ }),
84
+ _useState4 = _slicedToArray(_useState3, 2),
85
+ reCaptchaVersion = _useState4[0],
86
+ setRecaptchaVersion = _useState4[1];
76
87
  var _useSession = (0, _orderingComponentsExternal.useSession)(),
77
88
  _useSession2 = _slicedToArray(_useSession, 2),
78
89
  login = _useSession2[1].login;
79
90
  var emailInput = (0, _react.useRef)(null);
80
91
  var isFacebookLogin = (configs === null || configs === void 0 ? void 0 : (_configs$facebook_log = configs.facebook_login) === null || _configs$facebook_log === void 0 ? void 0 : _configs$facebook_log.value) === 'true';
81
- var _useState3 = (0, _react.useState)(''),
82
- _useState4 = _slicedToArray(_useState3, 2),
83
- userPhoneNumber = _useState4[0],
84
- setUserPhoneNumber = _useState4[1];
85
- var _useState5 = (0, _react.useState)(null),
92
+ var _useState5 = (0, _react.useState)(''),
86
93
  _useState6 = _slicedToArray(_useState5, 2),
87
- isValidPhoneNumber = _useState6[0],
88
- setIsValidPhoneNumber = _useState6[1];
89
- var _useState7 = (0, _react.useState)(false),
94
+ userPhoneNumber = _useState6[0],
95
+ setUserPhoneNumber = _useState6[1];
96
+ var _useState7 = (0, _react.useState)(null),
90
97
  _useState8 = _slicedToArray(_useState7, 2),
91
- passwordSee = _useState8[0],
92
- setPasswordSee = _useState8[1];
93
- 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;
98
+ isValidPhoneNumber = _useState8[0],
99
+ setIsValidPhoneNumber = _useState8[1];
94
100
  var _useState9 = (0, _react.useState)(false),
95
101
  _useState10 = _slicedToArray(_useState9, 2),
96
- isSignupBusiness = _useState10[0],
97
- setIsSignupBusiness = _useState10[1];
102
+ passwordSee = _useState10[0],
103
+ setPasswordSee = _useState10[1];
104
+ 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;
98
105
  var _useState11 = (0, _react.useState)(false),
99
106
  _useState12 = _slicedToArray(_useState11, 2),
100
- isSignupEmail = _useState12[0],
101
- setIsSignupEmail = _useState12[1];
107
+ isSignupBusiness = _useState12[0],
108
+ setIsSignupBusiness = _useState12[1];
109
+ var _useState13 = (0, _react.useState)(false),
110
+ _useState14 = _slicedToArray(_useState13, 2),
111
+ isSignupEmail = _useState14[0],
112
+ setIsSignupEmail = _useState14[1];
102
113
  var initParams = {
103
114
  client_id: configs === null || configs === void 0 ? void 0 : (_configs$google_login = configs.google_login_client_id) === null || _configs$google_login === void 0 ? void 0 : _configs$google_login.value,
104
115
  cookiepolicy: 'single_host_origin',
@@ -199,16 +210,36 @@ var SignUpFormUI = function SignUpFormUI(props) {
199
210
  }
200
211
  };
201
212
  (0, _react.useEffect)(function () {
202
- var _formState$result, _formState$result3, _formState$result4;
213
+ var _formState$result, _formState$result4, _formState$result5;
203
214
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
204
- var _formState$result2;
215
+ var _formState$result2, _formState$result2$re, _formState$result3;
216
+ if (((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : (_formState$result2$re = _formState$result2.result) === null || _formState$result2$re === void 0 ? void 0 : _formState$result2$re[0]) === 'ERROR_AUTH_VERIFICATION_CODE') {
217
+ var _configs$security_rec;
218
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
219
+ var _configs$security_rec2;
220
+ setRecaptchaVersion({
221
+ version: 'v2',
222
+ siteKey: configs === null || configs === void 0 ? void 0 : (_configs$security_rec2 = configs.security_recaptcha_site_key) === null || _configs$security_rec2 === void 0 ? void 0 : _configs$security_rec2.value
223
+ });
224
+ setAlertState({
225
+ open: true,
226
+ content: [t('TRY_AGAIN', 'Please try again')]
227
+ });
228
+ return;
229
+ }
230
+ setAlertState({
231
+ open: true,
232
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
233
+ });
234
+ return;
235
+ }
205
236
  setAlertState({
206
237
  open: true,
207
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
238
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
208
239
  });
209
- } 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) {
210
- var _formState$result5;
211
- saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
240
+ } else if (!formState.loading && !((_formState$result4 = formState.result) !== null && _formState$result4 !== void 0 && _formState$result4.error) && (_formState$result5 = formState.result) !== null && _formState$result5 !== void 0 && _formState$result5.result) {
241
+ var _formState$result6;
242
+ saveCustomerUser && saveCustomerUser((_formState$result6 = formState.result) === null || _formState$result6 === void 0 ? void 0 : _formState$result6.result);
212
243
  }
213
244
  }, [formState]);
214
245
  (0, _react.useEffect)(function () {
@@ -248,6 +279,14 @@ var SignUpFormUI = function SignUpFormUI(props) {
248
279
  handleChangePhoneNumber(externalPhoneNumber, true);
249
280
  }
250
281
  }, [externalPhoneNumber]);
282
+ (0, _react.useEffect)(function () {
283
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
284
+ setRecaptchaVersion({
285
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
286
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
287
+ });
288
+ }
289
+ }, [recaptchaConfig]);
251
290
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (_props$beforeElements = props.beforeElements) === null || _props$beforeElements === void 0 ? void 0 : _props$beforeElements.map(function (BeforeElement, i) {
252
291
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
253
292
  key: i
@@ -387,7 +426,8 @@ var SignUpFormUI = function SignUpFormUI(props) {
387
426
  height: 43
388
427
  }));
389
428
  })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles2.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
390
- handleReCaptcha: handleReCaptcha
429
+ handleReCaptcha: handleReCaptcha,
430
+ reCaptchaVersion: reCaptchaVersion
391
431
  })), (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(_styles2.TermsConditionWrapper, null, /*#__PURE__*/_react.default.createElement(_Checkbox.Checkbox, {
392
432
  name: "acceptTerms",
393
433
  ref: formMethods.register({
@@ -431,6 +471,7 @@ var SignUpFormUI = function SignUpFormUI(props) {
431
471
  };
432
472
  var SignUpForm = function SignUpForm(props) {
433
473
  var loginControllerProps = _objectSpread(_objectSpread({}, props), {}, {
474
+ isRecaptchaEnable: true,
434
475
  UIComponent: SignUpFormUI
435
476
  });
436
477
  return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.SignupForm, loginControllerProps);
@@ -167,8 +167,8 @@ var BusinessControllerUI = function BusinessControllerUI(props) {
167
167
  }
168
168
  }, (business === null || business === void 0 ? void 0 : (_business$ribbon = business.ribbon) === null || _business$ribbon === void 0 ? void 0 : _business$ribbon.enabled) && /*#__PURE__*/_react.default.createElement(_styles.RibbonBox, {
169
169
  bgColor: business === null || business === void 0 ? void 0 : (_business$ribbon2 = business.ribbon) === null || _business$ribbon2 === void 0 ? void 0 : _business$ribbon2.color,
170
- colorText: (0, _utils.lightenDarkenColor)(business === null || business === void 0 ? void 0 : (_business$ribbon3 = business.ribbon) === null || _business$ribbon3 === void 0 ? void 0 : _business$ribbon3.color, -200),
171
- borderRibbon: (0, _utils.lightenDarkenColor)(business === null || business === void 0 ? void 0 : (_business$ribbon4 = business.ribbon) === null || _business$ribbon4 === void 0 ? void 0 : _business$ribbon4.color, -200),
170
+ colorText: (0, _utils.lightenDarkenColor)(business === null || business === void 0 ? void 0 : (_business$ribbon3 = business.ribbon) === null || _business$ribbon3 === void 0 ? void 0 : _business$ribbon3.color),
171
+ borderRibbon: (0, _utils.lightenDarkenColor)(business === null || business === void 0 ? void 0 : (_business$ribbon4 = business.ribbon) === null || _business$ribbon4 === void 0 ? void 0 : _business$ribbon4.color),
172
172
  isRoundRect: (business === null || business === void 0 ? void 0 : (_business$ribbon5 = business.ribbon) === null || _business$ribbon5 === void 0 ? void 0 : _business$ribbon5.shape) === (_utils.shape === null || _utils.shape === void 0 ? void 0 : _utils.shape.rectangleRound),
173
173
  isCapsule: (business === null || business === void 0 ? void 0 : (_business$ribbon6 = business.ribbon) === null || _business$ribbon6 === void 0 ? void 0 : _business$ribbon6.shape) === (_utils.shape === null || _utils.shape === void 0 ? void 0 : _utils.shape.capsuleShape)
174
174
  }, business === null || business === void 0 ? void 0 : (_business$ribbon7 = business.ribbon) === null || _business$ribbon7 === void 0 ? void 0 : _business$ribbon7.text), /*#__PURE__*/_react.default.createElement(_styles.BusinessHero, null, isSkeleton ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
@@ -22,6 +22,7 @@ var _react2 = require("swiper/react");
22
22
  var _swiper = _interopRequireWildcard(require("swiper"));
23
23
  require("swiper/swiper-bundle.min.css");
24
24
  require("swiper/swiper.min.css");
25
+ var _utils = require("../../../../../utils");
25
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
27
  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); }
27
28
  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; }
@@ -100,56 +101,16 @@ var BusinessPreorderUI = function BusinessPreorderUI(props) {
100
101
  var day = (0, _moment.default)(curdate).format('d');
101
102
  setIsEnabled(menu.schedule[day].enabled || false);
102
103
  };
103
- var getTimes = function getTimes(curdate, menu) {
104
+ var getTimeList = function getTimeList(curdate, menu) {
104
105
  validateSelectedDate(curdate, menu);
105
- var date = new Date();
106
106
  var dateParts = curdate.split('-');
107
107
  var dateSeleted = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
108
- var times = [];
109
- for (var k = 0; k < menu.schedule[dateSeleted.getDay()].lapses.length; k++) {
110
- var open = {
111
- hour: menu.schedule[dateSeleted.getDay()].lapses[k].open.hour,
112
- minute: menu.schedule[dateSeleted.getDay()].lapses[k].open.minute
113
- };
114
- var close = {
115
- hour: menu.schedule[dateSeleted.getDay()].lapses[k].close.hour,
116
- minute: menu.schedule[dateSeleted.getDay()].lapses[k].close.minute
117
- };
118
- for (var i = open.hour; i <= close.hour; i++) {
119
- if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
120
- var hour = '';
121
- var meridian = '';
122
- if (!is12Hours) hour = i < 10 ? '0' + i : i;else {
123
- if (i === 0) {
124
- hour = '12';
125
- meridian = ' ' + t('AM', 'AM');
126
- } else if (i > 0 && i < 12) {
127
- hour = i < 10 ? '0' + i : i;
128
- meridian = ' ' + t('AM', 'AM');
129
- } else if (i === 12) {
130
- hour = '12';
131
- meridian = ' ' + t('PM', 'PM');
132
- } else {
133
- hour = i - 12 < 10 ? '0' + (i - 12) : i - 12;
134
- meridian = ' ' + t('PM', 'PM');
135
- }
136
- }
137
- for (var j = i === open.hour ? open.minute : 0; j <= (i === close.hour ? close.minute : 59); j += 15) {
138
- if (i !== date.getHours() || j >= date.getMinutes() || date.getDate() !== dateSeleted.getDate()) {
139
- times.push({
140
- text: hour + ':' + (j < 10 ? '0' + j : j) + meridian,
141
- value: (i < 10 ? '0' + i : i) + ':' + (j < 10 ? '0' + j : j)
142
- });
143
- }
144
- }
145
- }
146
- }
147
- }
108
+ var times = (0, _utils.getTimes)(dateSeleted, menu === null || menu === void 0 ? void 0 : menu.schedule, is12Hours);
148
109
  return times;
149
110
  };
150
111
  (0, _react.useEffect)(function () {
151
112
  var selectedMenu = menu ? menu !== null && menu !== void 0 && menu.use_business_schedule ? business : menu : business;
152
- var _times = getTimes(dateSelected, selectedMenu);
113
+ var _times = getTimeList(dateSelected, selectedMenu);
153
114
  setTimeList(_times);
154
115
  }, [dateSelected, menu, business]);
155
116
  (0, _react.useEffect)(function () {
@@ -198,13 +159,13 @@ var BusinessPreorderUI = function BusinessPreorderUI(props) {
198
159
  watchSlidesProgress: true,
199
160
  className: "swiper-datelist",
200
161
  preventClicksPropagation: false
201
- }, datesList.slice(0, Number(maxDays || (configs === null || configs === void 0 ? void 0 : (_configs$max_days_pre3 = configs.max_days_preorder) === null || _configs$max_days_pre3 === void 0 ? void 0 : _configs$max_days_pre3.value) || 6, 10)).map(function (date) {
162
+ }, datesList.slice(0, Number(maxDays || (configs === null || configs === void 0 ? void 0 : (_configs$max_days_pre3 = configs.max_days_preorder) === null || _configs$max_days_pre3 === void 0 ? void 0 : _configs$max_days_pre3.value) || 6, 10)).map(function (date, i) {
202
163
  var dateParts = date.split('-');
203
164
  var _date = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
204
165
  var dayName = t('DAY' + (_date.getDay() >= 1 ? _date.getDay() : 7)).substring(0, 2);
205
166
  var dayNumber = (_date.getDate() < 10 ? '0' : '') + _date.getDate();
206
167
  return /*#__PURE__*/_react.default.createElement(_react2.SwiperSlide, {
207
- key: dayNumber
168
+ key: i
208
169
  }, /*#__PURE__*/_react.default.createElement(_styles.Day, {
209
170
  selected: dateSelected === date,
210
171
  onClick: function onClick() {
@@ -299,7 +299,7 @@ var BusinessProductsListingUI = function BusinessProductsListingUI(props) {
299
299
  return function () {
300
300
  events.off('change_view', handleChangePage);
301
301
  };
302
- }, [openProduct]);
302
+ }, []);
303
303
  (0, _react.useEffect)(function () {
304
304
  window.addEventListener('scroll', handleScroll);
305
305
  return function () {
@@ -11,6 +11,7 @@ var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skelet
11
11
  var _styledComponents = require("styled-components");
12
12
  var _Modal = require("../Modal");
13
13
  var _orderingComponentsExternal = require("ordering-components-external");
14
+ var _useWindowSize = require("../../../../../hooks/useWindowSize");
14
15
  var _UpsellingPage = require("../UpsellingPage");
15
16
  var _libphonenumberJs = _interopRequireDefault(require("libphonenumber-js"));
16
17
  var _reactRouterDom = require("react-router-dom");
@@ -106,6 +107,7 @@ var CheckoutUI = function CheckoutUI(props) {
106
107
  _useEvent2 = _slicedToArray(_useEvent, 1),
107
108
  events = _useEvent2[0];
108
109
  var history = (0, _reactRouterDom.useHistory)();
110
+ var windowSize = (0, _useWindowSize.useWindowSize)();
109
111
  var _useState = (0, _react.useState)(false),
110
112
  _useState2 = _slicedToArray(_useState, 2),
111
113
  errorCash = _useState2[0],
@@ -226,6 +228,11 @@ var CheckoutUI = function CheckoutUI(props) {
226
228
  }
227
229
  setUserErrors(errors);
228
230
  };
231
+ var handleScrollTo = function handleScrollTo() {
232
+ if (!(!paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2)) return;
233
+ var scrollElement = document.querySelector('.paymentsContainer');
234
+ window.scrollTo(0, scrollElement.offsetTop - 20);
235
+ };
229
236
  (0, _react.useEffect)(function () {
230
237
  var _validationFields$fie14;
231
238
  if (validationFields && validationFields !== null && validationFields !== void 0 && (_validationFields$fie14 = validationFields.fields) !== null && _validationFields$fie14 !== void 0 && _validationFields$fie14.checkout) {
@@ -366,7 +373,9 @@ var CheckoutUI = function CheckoutUI(props) {
366
373
  onChange: function onChange(val) {
367
374
  return handleChangeDeliveryOption(val);
368
375
  }
369
- })), /*#__PURE__*/_react.default.createElement(_styles.CheckOutDivider, null)), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.PaymentMethodContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('PAYMENT_METHODS', 'Payment Methods')), !cartState.loading && (cart === null || cart === void 0 ? void 0 : cart.status) === 4 && /*#__PURE__*/_react.default.createElement(_styles.WarningMessage, {
376
+ })), /*#__PURE__*/_react.default.createElement(_styles.CheckOutDivider, null)), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.PaymentMethodContainer, {
377
+ className: "paymentsContainer"
378
+ }, /*#__PURE__*/_react.default.createElement("h1", null, t('PAYMENT_METHODS', 'Payment Methods')), !cartState.loading && (cart === null || cart === void 0 ? void 0 : cart.status) === 4 && /*#__PURE__*/_react.default.createElement(_styles.WarningMessage, {
370
379
  style: {
371
380
  marginTop: 20
372
381
  }
@@ -414,13 +423,20 @@ var CheckoutUI = function CheckoutUI(props) {
414
423
  useKioskApp: useKioskApp,
415
424
  isCheckout: true,
416
425
  isProducts: (cart === null || cart === void 0 ? void 0 : (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0
417
- })), !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
426
+ })), windowSize.width >= 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
418
427
  color: !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? 'secundary' : 'primary',
419
428
  disabled: isDisablePlaceOrderButton,
420
429
  onClick: function onClick() {
421
430
  return handlePlaceOrder();
422
431
  }
423
- }, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie18 = validationFields.fields) === null || _validationFields$fie18 === void 0 ? void 0 : (_validationFields$fie19 = _validationFields$fie18.checkout) === null || _validationFields$fie19 === void 0 ? void 0 : (_validationFields$fie20 = _validationFields$fie19.driver_tip) === null || _validationFields$fie20 === void 0 ? void 0 : _validationFields$fie20.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie21 = validationFields.fields) === null || _validationFields$fie21 === void 0 ? void 0 : (_validationFields$fie22 = _validationFields$fie21.checkout) === null || _validationFields$fie22 === void 0 ? void 0 : (_validationFields$fie23 = _validationFields$fie22.driver_tip) === null || _validationFields$fie23 === void 0 ? void 0 : _validationFields$fie23.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.'))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
432
+ }, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie18 = validationFields.fields) === null || _validationFields$fie18 === void 0 ? void 0 : (_validationFields$fie19 = _validationFields$fie18.checkout) === null || _validationFields$fie19 === void 0 ? void 0 : (_validationFields$fie20 = _validationFields$fie19.driver_tip) === null || _validationFields$fie20 === void 0 ? void 0 : _validationFields$fie20.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie21 = validationFields.fields) === null || _validationFields$fie21 === void 0 ? void 0 : (_validationFields$fie22 = _validationFields$fie21.checkout) === null || _validationFields$fie22 === void 0 ? void 0 : (_validationFields$fie23 = _validationFields$fie22.driver_tip) === null || _validationFields$fie23 === void 0 ? void 0 : _validationFields$fie23.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
433
+ color: !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? 'secundary' : 'primary'
434
+ // disabled={isDisablePlaceOrderButton}
435
+ ,
436
+ onClick: function onClick() {
437
+ return isDisablePlaceOrderButton ? handleScrollTo('.paymentsContainer') : handlePlaceOrder();
438
+ }
439
+ }, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), /*#__PURE__*/_react.default.createElement(_Confirm.Alert, {
424
440
  title: t('CUSTOMER_DETAILS', 'Customer Details'),
425
441
  content: alertState.content,
426
442
  acceptText: t('ACCEPT', 'Accept'),
@@ -4,9 +4,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.WrapperUserDetails = exports.WrapperRightContainer = exports.WrapperPlaceOrderButton = exports.WrapperLeftContent = exports.WrapperLeftContainer = exports.WrapperActionsInput = exports.WarningText = exports.WarningMessage = exports.WalletPaymentOptionContainer = exports.UserDetailsContainer = exports.SelectSpotContainer = exports.PaymentMethodContainer = exports.NotFoundImage = exports.DriverTipDivider = exports.DriverTipContainer = exports.DeliveryOptionsContainer = exports.Container = exports.CheckOutDivider = exports.CartsList = exports.CartHeader = exports.CartContainer = exports.BusinessDetailsContainer = void 0;
7
+ exports.WrapperUserDetails = exports.WrapperRightContainer = exports.WrapperPlaceOrderButton = exports.WrapperLeftContent = exports.WrapperLeftContainer = exports.WrapperActionsInput = exports.WarningText = exports.WarningMessage = exports.WalletPaymentOptionContainer = exports.UserDetailsContainer = exports.SelectSpotContainer = exports.PaymentMethodContainer = exports.NotFoundImage = exports.MobileWrapperPlaceOrderButton = exports.DriverTipDivider = exports.DriverTipContainer = exports.DeliveryOptionsContainer = exports.Container = exports.CheckOutDivider = exports.CartsList = exports.CartHeader = exports.CartContainer = exports.BusinessDetailsContainer = void 0;
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23;
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24;
10
10
  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); }
11
11
  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; }
12
12
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
@@ -67,4 +67,6 @@ exports.CartHeader = CartHeader;
67
67
  var SelectSpotContainer = _styledComponents.default.div(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral([""])));
68
68
  exports.SelectSpotContainer = SelectSpotContainer;
69
69
  var WrapperActionsInput = _styledComponents.default.div(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n input {\n width: 100%;\n }\n h1 {\n font-size: 20px;\n }\n"])));
70
- exports.WrapperActionsInput = WrapperActionsInput;
70
+ exports.WrapperActionsInput = WrapperActionsInput;
71
+ var MobileWrapperPlaceOrderButton = _styledComponents.default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n position: fixed;\n width: 100vw;\n left: 0;\n bottom: 0;\n background-color: white;\n padding: 15px 25px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n z-index: 1006;\n box-shadow: 0px 4px 10px rgb(0 0 0 / 12%);\n\n span {\n font-weight: 600;\n font-size: 16px;\n\n @media (min-width: 1200px) {\n font-size: 18px;\n padding-left: 20px;\n }\n }\n\n button {\n min-height: 44px;\n border-radius: 7.6px;\n }\n"])));
72
+ exports.MobileWrapperPlaceOrderButton = MobileWrapperPlaceOrderButton;
@@ -10,7 +10,7 @@ var _reactRouterDom = require("react-router-dom");
10
10
  var _orderingComponentsExternal = require("ordering-components-external");
11
11
  var _styledComponents = require("styled-components");
12
12
  var _AiOutlineClose = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineClose"));
13
- var _LanguageSelector = require("../LanguageSelector");
13
+ var _LanguageSelector = require("../../../../../components/LanguageSelector");
14
14
  var _reactBootstrapIcons = require("react-bootstrap-icons");
15
15
  var _TiWarningOutline = _interopRequireDefault(require("@meronex/icons/ti/TiWarningOutline"));
16
16
  var _OrderTypeSelectorContent = require("../OrderTypeSelectorContent");
@@ -362,7 +362,7 @@ var Header = function Header(props) {
362
362
  onClick: function onClick(variant) {
363
363
  return openModal(variant);
364
364
  }
365
- })), isCustomerMode && /*#__PURE__*/_react.default.createElement(_LanguageSelector.LanguageSelector, null), windowSize.width > 768 && /*#__PURE__*/_react.default.createElement(_UserPopover.UserPopover, {
365
+ })), windowSize.width > 768 && /*#__PURE__*/_react.default.createElement(_UserPopover.UserPopover, {
366
366
  withLogout: true,
367
367
  isCustomerMode: isCustomerMode,
368
368
  open: openPopover.user,
@@ -372,7 +372,7 @@ var Header = function Header(props) {
372
372
  onClose: function onClose() {
373
373
  return handleClosePopover('user');
374
374
  }
375
- }))))), onlineStatus && isShowOrderOptions && !props.isCustomLayout && !isCustomerMode && (windowSize.width > 768 && windowSize.width <= 820 ? /*#__PURE__*/_react.default.createElement(_styles.SubMenu, null, isFarAway && /*#__PURE__*/_react.default.createElement(_styles.FarAwayMessage, null, /*#__PURE__*/_react.default.createElement(_TiWarningOutline.default, null), /*#__PURE__*/_react.default.createElement("span", null, t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address'))), /*#__PURE__*/_react.default.createElement(_styles.AddressMenu, {
375
+ })), /*#__PURE__*/_react.default.createElement(_styles.LanguageSelectorWrapper, null, /*#__PURE__*/_react.default.createElement(_LanguageSelector.LanguageSelector, null))))), onlineStatus && isShowOrderOptions && !props.isCustomLayout && !isCustomerMode && (windowSize.width > 768 && windowSize.width <= 820 ? /*#__PURE__*/_react.default.createElement(_styles.SubMenu, null, isFarAway && /*#__PURE__*/_react.default.createElement(_styles.FarAwayMessage, null, /*#__PURE__*/_react.default.createElement(_TiWarningOutline.default, null), /*#__PURE__*/_react.default.createElement("span", null, t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address'))), /*#__PURE__*/_react.default.createElement(_styles.AddressMenu, {
376
376
  onClick: function onClick() {
377
377
  return openModal('address');
378
378
  }
@@ -39,7 +39,7 @@ var RightHeader = _styledComponents.default.div(_templateObject7 || (_templateOb
39
39
  exports.RightHeader = RightHeader;
40
40
  var Menu = _styledComponents.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n\n #select-input {\n border-radius: 7.6px;\n\n #list {\n border-radius: 7.6px;\n }\n\n ", "\n }\n\n &.left-header {\n background: #F8F9FA;\n border: none;\n box-sizing: border-box;\n border-radius: 50px;\n margin: 0 15px;\n flex-grow: 1;\n padding: 0 10px;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n height: 44px;\n\n @media (min-width: 821px) {\n border: 1px solid #DEE2E6;\n justify-content: space-between;\n }\n\n @media (min-width: 1024px) {\n padding: 0 20px;\n margin: 0 70px;\n }\n\n @media (min-width: 1200px) {\n padding: 0 30px;\n margin: 0 100px;\n }\n\n @media (min-width: 1500px) {\n padding: 0 30px;\n margin: 0 130px;\n }\n }\n\n > *:not(:last-child) {\n margin: 0 5px;\n }\n\n > span {\n #select-input {\n background: transparent !important;\n }\n }\n\n .moment-popover {\n border-left: 1px solid #DEE2E6;\n border-right: 1px solid #DEE2E6;\n height: 100%;\n justify-content: center;\n width: 200px;\n display: none;\n\n @media (min-width: 1175px) {\n width: 250px;\n }\n \n @media (min-width: 1400px) {\n width: 400px;\n }\n\n > div:first-child {\n width: 100%;\n display: flex;\n justify-content: center;\n }\n }\n\n .address-popover {\n flex-grow: 1;\n display: none;\n > div:first-child {\n width: 100%;\n }\n }\n\n .order-type {\n padding: 0 10px;\n\n @media (min-width: 1200px) {\n padding: 0 20px;\n }\n }\n\n\n @media (min-width: 821px) {\n .moment-popover,\n .address-popover {\n display: flex;\n }\n }\n"])), function (_ref) {
41
41
  var isCustomerMode = _ref.isCustomerMode;
42
- return !isCustomerMode && (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin: 0px 10px;\n height: 40px;\n border-color: #CCC;\n background-color: #CCC !important;\n\n svg {\n font-size: 16px;\n }\n\n > div:first-child {\n height: 100%;\n padding-left: 10px;\n padding-right: 10px;\n\n @media (min-width: 993px) {\n padding-left: 13px;\n padding-right: 13px;\n }\n }\n "])));
42
+ return !isCustomerMode && (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin: 0px 5px;\n height: 40px;\n\n svg {\n font-size: 16px;\n }\n\n > div:first-child {\n height: 100%;\n padding-left: 10px;\n padding-right: 10px;\n\n @media (min-width: 993px) {\n padding-left: 13px;\n padding-right: 13px;\n }\n }\n "])));
43
43
  });
44
44
  exports.Menu = Menu;
45
45
  var MenuItem = _styledComponents.default.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n"])));
@@ -91,49 +91,9 @@ var MomentControlUI = function MomentControlUI(props) {
91
91
  };
92
92
  var getTimes = function getTimes(curdate, schedule) {
93
93
  validateSelectedDate(curdate, schedule);
94
- var date = new Date();
95
94
  var dateParts = curdate.split('-');
96
95
  var dateSeleted = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
97
- var times = [];
98
- for (var k = 0; k < schedule[dateSeleted.getDay()].lapses.length; k++) {
99
- var open = {
100
- hour: schedule[dateSeleted.getDay()].lapses[k].open.hour,
101
- minute: schedule[dateSeleted.getDay()].lapses[k].open.minute
102
- };
103
- var close = {
104
- hour: schedule[dateSeleted.getDay()].lapses[k].close.hour,
105
- minute: schedule[dateSeleted.getDay()].lapses[k].close.minute
106
- };
107
- for (var i = open.hour; i <= close.hour; i++) {
108
- if (date.getDate() !== dateSeleted.getDate() || i >= date.getHours()) {
109
- var hour = '';
110
- var meridian = '';
111
- if (!is12hours) hour = i < 10 ? '0' + i : i;else {
112
- if (i === 0) {
113
- hour = '12';
114
- meridian = ' ' + t('AM', 'AM');
115
- } else if (i > 0 && i < 12) {
116
- hour = i < 10 ? '0' + i : i;
117
- meridian = ' ' + t('AM', 'AM');
118
- } else if (i === 12) {
119
- hour = '12';
120
- meridian = ' ' + t('PM', 'PM');
121
- } else {
122
- hour = i - 12 < 10 ? '0' + (i - 12) : i - 12;
123
- meridian = ' ' + t('PM', 'PM');
124
- }
125
- }
126
- for (var j = i === open.hour ? open.minute : 0; j <= (i === close.hour ? close.minute : 59); j += 15) {
127
- if (i !== date.getHours() || j >= date.getMinutes() || date.getDate() !== dateSeleted.getDate()) {
128
- times.push({
129
- text: hour + ':' + (j < 10 ? '0' + j : j) + meridian,
130
- value: (i < 10 ? '0' + i : i) + ':' + (j < 10 ? '0' + j : j)
131
- });
132
- }
133
- }
134
- }
135
- }
136
- }
96
+ var times = getTimes(dateSeleted, schedule, is12hours);
137
97
  return times;
138
98
  };
139
99
  var setLocalMoment = function setLocalMoment() {
@@ -168,7 +168,7 @@ var OrderBillSection = function OrderBillSection(props) {
168
168
  marginTop: 10
169
169
  }
170
170
  }, order === null || order === void 0 ? void 0 : (_order$payment_events2 = order.payment_events) === null || _order$payment_events2 === void 0 ? void 0 : _order$payment_events2.map(function (event) {
171
- var _walletName$event$wal, _event$wallet_event, _event$wallet_event$w, _event$paymethod, _event$data, _event$data2;
171
+ var _walletName$event$wal, _event$wallet_event, _event$wallet_event$w, _event$paymethod, _event$paymethod2, _event$data, _event$data2;
172
172
  return event.amount > 0 && /*#__PURE__*/_react.default.createElement("div", {
173
173
  key: event.id,
174
174
  style: {
@@ -183,7 +183,7 @@ var OrderBillSection = function OrderBillSection(props) {
183
183
  display: 'flex',
184
184
  flexDirection: 'column'
185
185
  }
186
- }, /*#__PURE__*/_react.default.createElement("span", null, event !== null && event !== void 0 && event.wallet_event ? (_walletName$event$wal = walletName[event === null || event === void 0 ? void 0 : (_event$wallet_event = event.wallet_event) === null || _event$wallet_event === void 0 ? void 0 : (_event$wallet_event$w = _event$wallet_event.wallet) === null || _event$wallet_event$w === void 0 ? void 0 : _event$wallet_event$w.type]) === null || _walletName$event$wal === void 0 ? void 0 : _walletName$event$wal.name : event === null || event === void 0 ? void 0 : (_event$paymethod = event.paymethod) === null || _event$paymethod === void 0 ? void 0 : _event$paymethod.name), (event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.charge_id) && /*#__PURE__*/_react.default.createElement("span", null, "".concat(t('CODE', 'Code'), ": ").concat(event === null || event === void 0 ? void 0 : (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.charge_id))), /*#__PURE__*/_react.default.createElement("span", null, "-", parsePrice(event.amount, {
186
+ }, /*#__PURE__*/_react.default.createElement("span", null, event !== null && event !== void 0 && event.wallet_event ? (_walletName$event$wal = walletName[event === null || event === void 0 ? void 0 : (_event$wallet_event = event.wallet_event) === null || _event$wallet_event === void 0 ? void 0 : (_event$wallet_event$w = _event$wallet_event.wallet) === null || _event$wallet_event$w === void 0 ? void 0 : _event$wallet_event$w.type]) === null || _walletName$event$wal === void 0 ? void 0 : _walletName$event$wal.name : t(event === null || event === void 0 ? void 0 : (_event$paymethod = event.paymethod) === null || _event$paymethod === void 0 ? void 0 : _event$paymethod.name.toUpperCase(), event === null || event === void 0 ? void 0 : (_event$paymethod2 = event.paymethod) === null || _event$paymethod2 === void 0 ? void 0 : _event$paymethod2.name)), (event === null || event === void 0 ? void 0 : (_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.charge_id) && /*#__PURE__*/_react.default.createElement("span", null, "".concat(t('CODE', 'Code'), ": ").concat(event === null || event === void 0 ? void 0 : (_event$data2 = event.data) === null || _event$data2 === void 0 ? void 0 : _event$data2.charge_id))), /*#__PURE__*/_react.default.createElement("span", null, "-", parsePrice(event.amount, {
187
187
  isTruncable: true
188
188
  })));
189
189
  }))));