ordering-ui-external 1.4.5 → 1.5.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 (155) hide show
  1. package/_bundles/{0.ordering-ui.9c913f613f7ccfd32dd9.js → 0.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  2. package/_bundles/{1.ordering-ui.9c913f613f7ccfd32dd9.js → 1.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  3. package/_bundles/{2.ordering-ui.9c913f613f7ccfd32dd9.js → 2.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  4. package/_bundles/{4.ordering-ui.9c913f613f7ccfd32dd9.js → 4.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  5. package/_bundles/{5.ordering-ui.9c913f613f7ccfd32dd9.js → 5.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  6. package/_bundles/{6.ordering-ui.9c913f613f7ccfd32dd9.js → 6.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  7. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js → 7.ordering-ui.5de718771fdf8a9bc402.js} +2 -2
  8. package/_bundles/{7.ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → 7.ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.9c913f613f7ccfd32dd9.js → 8.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  10. package/_bundles/{9.ordering-ui.9c913f613f7ccfd32dd9.js → 9.ordering-ui.5de718771fdf8a9bc402.js} +1 -1
  11. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js → ordering-ui.5de718771fdf8a9bc402.js} +2 -2
  12. package/_bundles/{ordering-ui.9c913f613f7ccfd32dd9.js.LICENSE.txt → ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt} +0 -0
  13. package/_modules/components/LogoutButton/index.js +9 -4
  14. package/_modules/components/PaymentOptions/index.js +14 -7
  15. package/_modules/components/SpinnerLoader/styles.js +1 -1
  16. package/_modules/components/UserProfileForm/index.js +15 -2
  17. package/_modules/components/UserProfileForm/styles.js +1 -1
  18. package/_modules/hooks/useRecaptcha.js +62 -0
  19. package/_modules/themes/five/src/components/AddressForm/styles.js +3 -3
  20. package/_modules/themes/five/src/components/AddressList/index.js +1 -1
  21. package/_modules/themes/five/src/components/AddressList/styles.js +1 -1
  22. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +5 -5
  23. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +12 -10
  24. package/_modules/themes/five/src/components/BusinessController/index.js +6 -4
  25. package/_modules/themes/five/src/components/BusinessController/styles.js +10 -4
  26. package/_modules/themes/five/src/components/BusinessListingSearch/index.js +21 -6
  27. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +6 -17
  28. package/_modules/themes/five/src/components/BusinessProductsCategories/styles.js +3 -4
  29. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +11 -3
  30. package/_modules/themes/five/src/components/BusinessProductsListing/styles.js +2 -2
  31. package/_modules/themes/five/src/components/BusinessReviews/index.js +16 -8
  32. package/_modules/themes/five/src/components/BusinessReviews/styles.js +6 -4
  33. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +58 -34
  34. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +40 -23
  35. package/_modules/themes/five/src/components/DriverTips/styles.js +1 -1
  36. package/_modules/themes/five/src/components/Footer/index.js +2 -1
  37. package/_modules/themes/five/src/components/Footer/styles.js +1 -1
  38. package/_modules/themes/five/src/components/Header/index.js +18 -11
  39. package/_modules/themes/five/src/components/Header/styles.js +7 -7
  40. package/_modules/themes/five/src/components/HomeHero/index.js +0 -15
  41. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +116 -31
  42. package/_modules/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +36 -37
  43. package/_modules/themes/five/src/components/LoginForm/index.js +62 -21
  44. package/_modules/themes/five/src/components/LoginForm/styles.js +1 -1
  45. package/_modules/themes/five/src/components/Messages/index.js +19 -3
  46. package/_modules/themes/five/src/components/MultiOrdersDetails/styles.js +6 -6
  47. package/_modules/themes/five/src/components/MyOrders/index.js +4 -4
  48. package/_modules/themes/five/src/components/NavigationBar/index.js +145 -34
  49. package/_modules/themes/five/src/components/NavigationBar/styles.js +1 -1
  50. package/_modules/themes/five/src/components/OrderDetails/index.js +46 -7
  51. package/_modules/themes/five/src/components/OrderDetails/styles.js +11 -3
  52. package/_modules/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  53. package/_modules/themes/five/src/components/PaymentOptions/index.js +23 -16
  54. package/_modules/themes/five/src/components/PaymentOptions/styles.js +1 -1
  55. package/_modules/themes/five/src/components/ProductForm/index.js +9 -7
  56. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +10 -4
  57. package/_modules/themes/five/src/components/ProductItemAccordion/styles.js +11 -3
  58. package/_modules/themes/five/src/components/ProductShare/ProductCopyURL.js +61 -0
  59. package/_modules/themes/five/src/components/ProductShare/index.js +107 -0
  60. package/_modules/themes/five/src/components/ProductShare/styles.js +40 -0
  61. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
  62. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +18 -16
  63. package/_modules/themes/five/src/components/ReviewProduct/index.js +5 -3
  64. package/_modules/themes/five/src/components/ReviewProduct/styles.js +19 -3
  65. package/_modules/themes/five/src/components/SearchProducts/index.js +13 -2
  66. package/_modules/themes/five/src/components/SignUpApproval/index.js +6 -6
  67. package/_modules/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +57 -17
  68. package/_modules/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +57 -17
  69. package/_modules/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +57 -17
  70. package/_modules/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +57 -17
  71. package/_modules/themes/five/src/components/SignUpForm/index.js +60 -20
  72. package/_modules/themes/five/src/components/SignUpForm/styles.js +2 -2
  73. package/_modules/themes/five/src/components/SingleProductCard/index.js +36 -2
  74. package/_modules/themes/five/src/components/UserProfileForm/index.js +105 -8
  75. package/_modules/themes/five/src/components/UserProfileForm/styles.js +30 -17
  76. package/_modules/utils/index.js +26 -11
  77. package/index-template.js +11 -1
  78. package/package.json +2 -2
  79. package/src/components/LogoutButton/index.js +10 -8
  80. package/src/components/PaymentOptions/index.js +16 -11
  81. package/src/components/SpinnerLoader/styles.js +1 -0
  82. package/src/components/UserProfileForm/index.js +12 -2
  83. package/src/components/UserProfileForm/styles.js +1 -1
  84. package/src/hooks/useRecaptcha.js +40 -0
  85. package/src/themes/five/src/components/AddressForm/styles.js +3 -2
  86. package/src/themes/five/src/components/AddressList/index.js +1 -1
  87. package/src/themes/five/src/components/AddressList/styles.js +2 -2
  88. package/src/themes/five/src/components/BusinessBasicInformation/index.js +74 -71
  89. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +69 -20
  90. package/src/themes/five/src/components/BusinessController/index.js +3 -1
  91. package/src/themes/five/src/components/BusinessController/styles.js +8 -0
  92. package/src/themes/five/src/components/BusinessListingSearch/index.js +16 -1
  93. package/src/themes/five/src/components/BusinessProductsCategories/index.js +6 -18
  94. package/src/themes/five/src/components/BusinessProductsCategories/styles.js +1 -1
  95. package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
  96. package/src/themes/five/src/components/BusinessProductsListing/styles.js +2 -3
  97. package/src/themes/five/src/components/BusinessReviews/index.js +17 -10
  98. package/src/themes/five/src/components/BusinessReviews/styles.js +7 -0
  99. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +64 -19
  100. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +99 -1
  101. package/src/themes/five/src/components/DriverTips/styles.js +1 -1
  102. package/src/themes/five/src/components/Footer/index.js +9 -5
  103. package/src/themes/five/src/components/Footer/styles.js +2 -6
  104. package/src/themes/five/src/components/Header/index.js +16 -8
  105. package/src/themes/five/src/components/Header/styles.js +49 -8
  106. package/src/themes/five/src/components/HomeHero/index.js +0 -6
  107. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/index.js +163 -60
  108. package/src/themes/five/src/components/HomeHero/layouts/OriginalHomeHero/styles.js +145 -82
  109. package/src/themes/five/src/components/LoginForm/index.js +30 -4
  110. package/src/themes/five/src/components/LoginForm/styles.js +8 -0
  111. package/src/themes/five/src/components/Messages/index.js +8 -2
  112. package/src/themes/five/src/components/MultiOrdersDetails/styles.js +34 -1
  113. package/src/themes/five/src/components/MyOrders/index.js +4 -4
  114. package/src/themes/five/src/components/NavigationBar/index.js +153 -39
  115. package/src/themes/five/src/components/NavigationBar/styles.js +2 -2
  116. package/src/themes/five/src/components/OrderDetails/index.js +45 -8
  117. package/src/themes/five/src/components/OrderDetails/styles.js +50 -0
  118. package/src/themes/five/src/components/PaymentOptionStripe/index.js +2 -14
  119. package/src/themes/five/src/components/PaymentOptions/index.js +13 -7
  120. package/src/themes/five/src/components/PaymentOptions/styles.js +5 -0
  121. package/src/themes/five/src/components/ProductForm/index.js +9 -7
  122. package/src/themes/five/src/components/ProductItemAccordion/index.js +67 -53
  123. package/src/themes/five/src/components/ProductItemAccordion/styles.js +26 -0
  124. package/src/themes/five/src/components/ProductShare/ProductCopyURL.js +53 -0
  125. package/src/themes/five/src/components/ProductShare/index.js +104 -0
  126. package/src/themes/five/src/components/ProductShare/styles.js +165 -0
  127. package/src/themes/five/src/components/RenderProductsLayout/index.js +2 -8
  128. package/src/themes/five/src/components/RenderProductsLayout/styles.js +5 -0
  129. package/src/themes/five/src/components/ReviewProduct/index.js +10 -3
  130. package/src/themes/five/src/components/ReviewProduct/styles.js +43 -0
  131. package/src/themes/five/src/components/SearchProducts/index.js +16 -3
  132. package/src/themes/five/src/components/SignUpApproval/index.js +8 -7
  133. package/src/themes/five/src/components/SignUpBusiness/layouts/NewSignUpBusiness/index.js +26 -2
  134. package/src/themes/five/src/components/SignUpBusiness/layouts/OldSignUpBusiness/index.js +26 -2
  135. package/src/themes/five/src/components/SignUpDriver/layouts/NewSignUpDriver/index.js +26 -2
  136. package/src/themes/five/src/components/SignUpDriver/layouts/OldSignUpDriver/index.js +26 -2
  137. package/src/themes/five/src/components/SignUpForm/index.js +26 -1
  138. package/src/themes/five/src/components/SignUpForm/styles.js +9 -2
  139. package/src/themes/five/src/components/SingleProductCard/index.js +26 -1
  140. package/src/themes/five/src/components/UserPopover/index.js +1 -1
  141. package/src/themes/five/src/components/UserProfileForm/index.js +83 -5
  142. package/src/themes/five/src/components/UserProfileForm/styles.js +49 -0
  143. package/src/utils/index.js +36 -9
  144. package/template/app.js +12 -11
  145. package/template/assets/images/amex.svg +30 -0
  146. package/template/assets/images/diners.svg +16 -0
  147. package/template/assets/images/discover.svg +17 -0
  148. package/template/assets/images/jcb.svg +33 -0
  149. package/template/assets/images/unionpay.svg +25 -0
  150. package/template/components/HelmetTags/index.js +1 -1
  151. package/template/components/ScrollToTop/index.js +7 -5
  152. package/template/pages/BusinessProductsList/index.js +8 -4
  153. package/template/pages/MyOrders/index.js +4 -1
  154. package/template/pages/OrderDetails/index.js +11 -2
  155. package/template/pages/Profile/index.js +8 -2
@@ -10,6 +10,7 @@ var _orderingComponentsExternal = require("ordering-components-external");
10
10
  var _SearchBar = require("../SearchBar");
11
11
  var _styledComponents = require("styled-components");
12
12
  var _BusinessProductsList = require("../BusinessProductsList");
13
+ var _groceries = require("../BusinessProductsList/layouts/groceries");
13
14
  var _styles = require("./styles");
14
15
  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); }
15
16
  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; }
@@ -24,8 +25,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
24
25
  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; }
25
26
  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; }
26
27
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
+ var layoutOne = 'groceries';
27
29
  var SearchProducts = function SearchProducts(props) {
28
- var _theme$images, _theme$images$logos, _theme$defaultLanguag, _theme$defaultLanguag2;
30
+ var _configs$use_parent_c, _configs$use_parent_c2, _theme$images, _theme$images$logos, _theme$defaultLanguag, _theme$defaultLanguag2;
29
31
  var onClose = props.onClose,
30
32
  searchValue = props.searchValue,
31
33
  handleChangeSearch = props.handleChangeSearch,
@@ -39,11 +41,20 @@ var SearchProducts = function SearchProducts(props) {
39
41
  var _useEvent = (0, _orderingComponentsExternal.useEvent)(),
40
42
  _useEvent2 = _slicedToArray(_useEvent, 1),
41
43
  events = _useEvent2[0];
44
+ var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
45
+ _useConfig2 = _slicedToArray(_useConfig, 1),
46
+ configs = _useConfig2[0].configs;
42
47
  var searchRef = (0, _react.useRef)();
48
+ var isUseParentCategory = (configs === null || configs === void 0 ? void 0 : (_configs$use_parent_c = configs.use_parent_category) === null || _configs$use_parent_c === void 0 ? void 0 : _configs$use_parent_c.value) === 'true' || (configs === null || configs === void 0 ? void 0 : (_configs$use_parent_c2 = configs.use_parent_category) === null || _configs$use_parent_c2 === void 0 ? void 0 : _configs$use_parent_c2.value) === '1';
49
+ var frontLayout = business === null || business === void 0 ? void 0 : business.front_layout;
50
+ var businessLayout = {
51
+ layoutOne: frontLayout === layoutOne && isUseParentCategory
52
+ };
43
53
  var handleGoToPage = function handleGoToPage(data) {
44
54
  events.emit('go_to_page', data);
45
55
  document.body.style.overflowY = 'auto';
46
56
  };
57
+ var BusinessLayoutProductsList = businessLayout.layoutOne ? _groceries.BusinessProductsList : _BusinessProductsList.BusinessProductsList;
47
58
  (0, _react.useEffect)(function () {
48
59
  var _searchRef$current;
49
60
  (searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.focus) && searchRef.current.focus();
@@ -69,7 +80,7 @@ var SearchProducts = function SearchProducts(props) {
69
80
  forwardRef: searchRef
70
81
  })), /*#__PURE__*/_react.default.createElement(_styles.CancelButton, {
71
82
  onClick: onClose
72
- }, t('CANCEL', 'Cancel')))), searchValue && /*#__PURE__*/_react.default.createElement(_styles.BusinessProductsListContainer, null, /*#__PURE__*/_react.default.createElement(_styles.BusinessProductsListWrapper, null, /*#__PURE__*/_react.default.createElement(_BusinessProductsList.BusinessProductsList, _extends({}, props, {
83
+ }, t('CANCEL', 'Cancel')))), searchValue && /*#__PURE__*/_react.default.createElement(_styles.BusinessProductsListContainer, null, /*#__PURE__*/_react.default.createElement(_styles.BusinessProductsListWrapper, null, /*#__PURE__*/_react.default.createElement(BusinessLayoutProductsList, _extends({}, props, {
73
84
  categories: [{
74
85
  id: null,
75
86
  name: t('ALL', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag = theme.defaultLanguages) === null || _theme$defaultLanguag === void 0 ? void 0 : _theme$defaultLanguag.ALL) || 'All')
@@ -32,8 +32,8 @@ var SignUpApproval = function SignUpApproval(props) {
32
32
  onCancel = props.onCancel;
33
33
  var contactEmail = 'support@ordering.co';
34
34
  var showDomain = false;
35
- var logoImgUrl = businessType === '2' ? approvalType === 'automatic' ? (_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.CongratulationApproval : (_theme$images2 = theme.images) === null || _theme$images2 === void 0 ? void 0 : (_theme$images2$genera = _theme$images2.general) === null || _theme$images2$genera === void 0 ? void 0 : _theme$images2$genera.CongratulationNoApproval : approvalType === 'automatic' ? (_theme$images3 = theme.images) === null || _theme$images3 === void 0 ? void 0 : (_theme$images3$genera = _theme$images3.general) === null || _theme$images3$genera === void 0 ? void 0 : _theme$images3$genera.driverCongratulationApproval : (_theme$images4 = theme.images) === null || _theme$images4 === void 0 ? void 0 : (_theme$images4$genera = _theme$images4.general) === null || _theme$images4$genera === void 0 ? void 0 : _theme$images4$genera.driverCongratulationNoApproval;
36
- var userType = businessType === '2' ? 'business' : 'driver';
35
+ var logoImgUrl = businessType === 2 ? approvalType === 'automatic' ? (_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.CongratulationApproval : (_theme$images2 = theme.images) === null || _theme$images2 === void 0 ? void 0 : (_theme$images2$genera = _theme$images2.general) === null || _theme$images2$genera === void 0 ? void 0 : _theme$images2$genera.CongratulationNoApproval : approvalType === 'automatic' ? (_theme$images3 = theme.images) === null || _theme$images3 === void 0 ? void 0 : (_theme$images3$genera = _theme$images3.general) === null || _theme$images3$genera === void 0 ? void 0 : _theme$images3$genera.driverCongratulationApproval : (_theme$images4 = theme.images) === null || _theme$images4 === void 0 ? void 0 : (_theme$images4$genera = _theme$images4.general) === null || _theme$images4$genera === void 0 ? void 0 : _theme$images4$genera.driverCongratulationNoApproval;
36
+ var userType = businessType === 2 ? 'business' : 'driver';
37
37
  return /*#__PURE__*/_react.default.createElement(_styles.Container, null, /*#__PURE__*/_react.default.createElement(_styles.HeaderSection, null, showDomain && /*#__PURE__*/_react.default.createElement(_styles.Title, null, "Domain or Brand"), /*#__PURE__*/_react.default.createElement(_styles.LogoImage, {
38
38
  approvalType: approvalType === 'automatic',
39
39
  src: logoImgUrl
@@ -58,16 +58,16 @@ var SignUpApproval = function SignUpApproval(props) {
58
58
  href: dashboardLoginUrl,
59
59
  target: "_blank",
60
60
  rel: "noopener noreferrer"
61
- }, dashboardUrl)))))) : /*#__PURE__*/_react.default.createElement(_styles.BodySection, null, businessType === 'business' ? /*#__PURE__*/_react.default.createElement(_styles.DescriptionContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Description, null, /*#__PURE__*/_react.default.createElement("span", {
61
+ }, dashboardUrl)))))) : /*#__PURE__*/_react.default.createElement(_styles.BodySection, null, userType === 'business' ? /*#__PURE__*/_react.default.createElement(_styles.DescriptionContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Description, null, /*#__PURE__*/_react.default.createElement("span", {
62
62
  className: "bigger"
63
63
  }, t('YOUR_STORE_UNDER_APPROVAL', 'Your store is under approval'))), /*#__PURE__*/_react.default.createElement(_styles.Description, null, t('BUSINESS_SIGNUP_MESSAGE', 'We will contact you as soon as possible')), /*#__PURE__*/_react.default.createElement(_styles.Description, null, t('FEEL_FREE_CONTACT_US', 'feel free to contact us at '), " ", /*#__PURE__*/_react.default.createElement("a", {
64
64
  className: "green-text",
65
- href: "mailto:".concat(contactEmail)
65
+ href: "mailto:".concat(t('SIGNUP_DRIVER_EMAIL', contactEmail))
66
66
  }, contactEmail))) : /*#__PURE__*/_react.default.createElement(_styles.DescriptionContainer, null, /*#__PURE__*/_react.default.createElement(_styles.Description, null, /*#__PURE__*/_react.default.createElement("span", {
67
67
  className: "bigger"
68
68
  }, t('REQUEST_TO_START_UNDER_APPROVAL', 'Your request to start as a driver is under approval.'))), /*#__PURE__*/_react.default.createElement(_styles.Description, null, t('BUSINESS_SIGNUP_MESSAGE', 'We will contact you as soon as possible')), /*#__PURE__*/_react.default.createElement(_styles.Description, null, t('FEEL_FREE_CONTACT_US', 'feel free to contact us at '), " ", /*#__PURE__*/_react.default.createElement("a", {
69
69
  className: "green-text",
70
- href: "mailto:".concat(contactEmail)
70
+ href: "mailto:".concat(t('SIGNUP_DRIVER_EMAIL', contactEmail))
71
71
  }, contactEmail)))), /*#__PURE__*/_react.default.createElement(_styles.FooterSection, null, /*#__PURE__*/_react.default.createElement(_styles.ActionGroup, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
72
72
  outline: true,
73
73
  color: "primary",
@@ -83,7 +83,7 @@ var SignUpApproval = function SignUpApproval(props) {
83
83
  }
84
84
  }, t('ACCEPT', 'Accept'))), approvalType === 'automatic' && userType === 'business' && /*#__PURE__*/_react.default.createElement(_styles.ContactSection, null, t('CONTACT_US_QUESTIONS', 'If you have some questions do no hestitate to contact us at '), " ", /*#__PURE__*/_react.default.createElement("a", {
85
85
  className: "green-text",
86
- href: "mailto:".concat(contactEmail)
86
+ href: "mailto:".concat(t('SIGNUP_DRIVER_EMAIL', contactEmail))
87
87
  }, contactEmail))));
88
88
  };
89
89
  exports.SignUpApproval = SignUpApproval;
@@ -16,6 +16,7 @@ var _Inputs = require("../../../../styles/Inputs");
16
16
  var _Buttons = require("../../../../styles/Buttons");
17
17
  var _Checkbox = require("../../../../../../../styles/Checkbox");
18
18
  var _utils = require("../../../../../../../utils");
19
+ var _useRecaptcha3 = require("../../../../../../../hooks/useRecaptcha");
19
20
  var _AiOutlineEye = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEye"));
20
21
  var _AiOutlineEyeInvisible = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEyeInvisible"));
21
22
  var _orderingComponentsExternal = require("ordering-components-external");
@@ -70,19 +71,29 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
70
71
  _useState2 = _slicedToArray(_useState, 2),
71
72
  alertState = _useState2[0],
72
73
  setAlertState = _useState2[1];
73
- var emailInput = (0, _react.useRef)(null);
74
- var _useState3 = (0, _react.useState)(''),
74
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
75
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
76
+ recaptchaConfig = _useRecaptcha2[0];
77
+ var _useState3 = (0, _react.useState)({
78
+ version: '',
79
+ siteKey: ''
80
+ }),
75
81
  _useState4 = _slicedToArray(_useState3, 2),
76
- userPhoneNumber = _useState4[0],
77
- setUserPhoneNumber = _useState4[1];
78
- var _useState5 = (0, _react.useState)(null),
82
+ reCaptchaVersion = _useState4[0],
83
+ setRecaptchaVersion = _useState4[1];
84
+ var emailInput = (0, _react.useRef)(null);
85
+ var _useState5 = (0, _react.useState)(''),
79
86
  _useState6 = _slicedToArray(_useState5, 2),
80
- isValidPhoneNumber = _useState6[0],
81
- setIsValidPhoneNumber = _useState6[1];
82
- var _useState7 = (0, _react.useState)(false),
87
+ userPhoneNumber = _useState6[0],
88
+ setUserPhoneNumber = _useState6[1];
89
+ var _useState7 = (0, _react.useState)(null),
83
90
  _useState8 = _slicedToArray(_useState7, 2),
84
- passwordSee = _useState8[0],
85
- setPasswordSee = _useState8[1];
91
+ isValidPhoneNumber = _useState8[0],
92
+ setIsValidPhoneNumber = _useState8[1];
93
+ var _useState9 = (0, _react.useState)(false),
94
+ _useState10 = _slicedToArray(_useState9, 2),
95
+ passwordSee = _useState10[0],
96
+ setPasswordSee = _useState10[1];
86
97
  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';
87
98
  var togglePasswordView = function togglePasswordView() {
88
99
  setPasswordSee(!passwordSee);
@@ -158,16 +169,36 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
158
169
  }
159
170
  };
160
171
  (0, _react.useEffect)(function () {
161
- var _formState$result, _formState$result3, _formState$result4;
172
+ var _formState$result, _formState$result4, _formState$result5;
162
173
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
163
- var _formState$result2;
174
+ var _formState$result2, _formState$result2$re, _formState$result3;
175
+ 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') {
176
+ var _configs$security_rec;
177
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
178
+ var _configs$security_rec2;
179
+ setRecaptchaVersion({
180
+ version: 'v2',
181
+ 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
182
+ });
183
+ setAlertState({
184
+ open: true,
185
+ content: [t('TRY_AGAIN', 'Please try again')]
186
+ });
187
+ return;
188
+ }
189
+ setAlertState({
190
+ open: true,
191
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
192
+ });
193
+ return;
194
+ }
164
195
  setAlertState({
165
196
  open: true,
166
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
197
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
167
198
  });
168
- } 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) {
169
- var _formState$result5;
170
- saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
199
+ } 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) {
200
+ var _formState$result6;
201
+ saveCustomerUser && saveCustomerUser((_formState$result6 = formState.result) === null || _formState$result6 === void 0 ? void 0 : _formState$result6.result);
171
202
  }
172
203
  }, [formState]);
173
204
  (0, _react.useEffect)(function () {
@@ -207,6 +238,14 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
207
238
  handleChangePhoneNumber(externalPhoneNumber, true);
208
239
  }
209
240
  }, [externalPhoneNumber]);
241
+ (0, _react.useEffect)(function () {
242
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
243
+ setRecaptchaVersion({
244
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
245
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
246
+ });
247
+ }
248
+ }, [recaptchaConfig]);
210
249
  (0, _react.useEffect)(function () {
211
250
  handleChangeInput({
212
251
  target: {
@@ -297,7 +336,8 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
297
336
  height: 43
298
337
  }));
299
338
  })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
300
- handleReCaptcha: handleReCaptcha
339
+ handleReCaptcha: handleReCaptcha,
340
+ reCaptchaVersion: reCaptchaVersion
301
341
  })), (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, {
302
342
  name: "acceptTerms",
303
343
  ref: formMethods.register({
@@ -16,6 +16,7 @@ var _Inputs = require("../../../../styles/Inputs");
16
16
  var _Buttons = require("../../../../styles/Buttons");
17
17
  var _Checkbox = require("../../../../../../../styles/Checkbox");
18
18
  var _utils = require("../../../../../../../utils");
19
+ var _useRecaptcha3 = require("../../../../../../../hooks/useRecaptcha");
19
20
  var _AiOutlineEye = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEye"));
20
21
  var _AiOutlineEyeInvisible = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEyeInvisible"));
21
22
  var _orderingComponentsExternal = require("ordering-components-external");
@@ -70,19 +71,29 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
70
71
  _useState2 = _slicedToArray(_useState, 2),
71
72
  alertState = _useState2[0],
72
73
  setAlertState = _useState2[1];
73
- var emailInput = (0, _react.useRef)(null);
74
- var _useState3 = (0, _react.useState)(''),
74
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
75
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
76
+ recaptchaConfig = _useRecaptcha2[0];
77
+ var _useState3 = (0, _react.useState)({
78
+ version: '',
79
+ siteKey: ''
80
+ }),
75
81
  _useState4 = _slicedToArray(_useState3, 2),
76
- userPhoneNumber = _useState4[0],
77
- setUserPhoneNumber = _useState4[1];
78
- var _useState5 = (0, _react.useState)(null),
82
+ reCaptchaVersion = _useState4[0],
83
+ setRecaptchaVersion = _useState4[1];
84
+ var emailInput = (0, _react.useRef)(null);
85
+ var _useState5 = (0, _react.useState)(''),
79
86
  _useState6 = _slicedToArray(_useState5, 2),
80
- isValidPhoneNumber = _useState6[0],
81
- setIsValidPhoneNumber = _useState6[1];
82
- var _useState7 = (0, _react.useState)(false),
87
+ userPhoneNumber = _useState6[0],
88
+ setUserPhoneNumber = _useState6[1];
89
+ var _useState7 = (0, _react.useState)(null),
83
90
  _useState8 = _slicedToArray(_useState7, 2),
84
- passwordSee = _useState8[0],
85
- setPasswordSee = _useState8[1];
91
+ isValidPhoneNumber = _useState8[0],
92
+ setIsValidPhoneNumber = _useState8[1];
93
+ var _useState9 = (0, _react.useState)(false),
94
+ _useState10 = _slicedToArray(_useState9, 2),
95
+ passwordSee = _useState10[0],
96
+ setPasswordSee = _useState10[1];
86
97
  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';
87
98
  var togglePasswordView = function togglePasswordView() {
88
99
  setPasswordSee(!passwordSee);
@@ -158,16 +169,36 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
158
169
  }
159
170
  };
160
171
  (0, _react.useEffect)(function () {
161
- var _formState$result, _formState$result3, _formState$result4;
172
+ var _formState$result, _formState$result4, _formState$result5;
162
173
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
163
- var _formState$result2;
174
+ var _formState$result2, _formState$result2$re, _formState$result3;
175
+ 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') {
176
+ var _configs$security_rec;
177
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
178
+ var _configs$security_rec2;
179
+ setRecaptchaVersion({
180
+ version: 'v2',
181
+ 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
182
+ });
183
+ setAlertState({
184
+ open: true,
185
+ content: [t('TRY_AGAIN', 'Please try again')]
186
+ });
187
+ return;
188
+ }
189
+ setAlertState({
190
+ open: true,
191
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
192
+ });
193
+ return;
194
+ }
164
195
  setAlertState({
165
196
  open: true,
166
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
197
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
167
198
  });
168
- } 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) {
169
- var _formState$result5;
170
- saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
199
+ } 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) {
200
+ var _formState$result6;
201
+ saveCustomerUser && saveCustomerUser((_formState$result6 = formState.result) === null || _formState$result6 === void 0 ? void 0 : _formState$result6.result);
171
202
  }
172
203
  }, [formState]);
173
204
  (0, _react.useEffect)(function () {
@@ -207,6 +238,14 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
207
238
  handleChangePhoneNumber(externalPhoneNumber, true);
208
239
  }
209
240
  }, [externalPhoneNumber]);
241
+ (0, _react.useEffect)(function () {
242
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
243
+ setRecaptchaVersion({
244
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
245
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
246
+ });
247
+ }
248
+ }, [recaptchaConfig]);
210
249
  (0, _react.useEffect)(function () {
211
250
  handleChangeInput({
212
251
  target: {
@@ -293,7 +332,8 @@ var SignUpBusinessUI = function SignUpBusinessUI(props) {
293
332
  height: 43
294
333
  }));
295
334
  })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
296
- handleReCaptcha: handleReCaptcha
335
+ handleReCaptcha: handleReCaptcha,
336
+ reCaptchaVersion: reCaptchaVersion
297
337
  })), (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, {
298
338
  name: "acceptTerms",
299
339
  ref: formMethods.register({
@@ -16,6 +16,7 @@ var _Inputs = require("../../../../styles/Inputs");
16
16
  var _Buttons = require("../../../../styles/Buttons");
17
17
  var _Checkbox = require("../../../../../../../styles/Checkbox");
18
18
  var _utils = require("../../../../../../../utils");
19
+ var _useRecaptcha3 = require("../../../../../../../hooks/useRecaptcha");
19
20
  var _AiOutlineEye = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEye"));
20
21
  var _AiOutlineEyeInvisible = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEyeInvisible"));
21
22
  var _orderingComponentsExternal = require("ordering-components-external");
@@ -70,19 +71,29 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
70
71
  _useState2 = _slicedToArray(_useState, 2),
71
72
  alertState = _useState2[0],
72
73
  setAlertState = _useState2[1];
73
- var emailInput = (0, _react.useRef)(null);
74
- var _useState3 = (0, _react.useState)(''),
74
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
75
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
76
+ recaptchaConfig = _useRecaptcha2[0];
77
+ var _useState3 = (0, _react.useState)({
78
+ version: '',
79
+ siteKey: ''
80
+ }),
75
81
  _useState4 = _slicedToArray(_useState3, 2),
76
- userPhoneNumber = _useState4[0],
77
- setUserPhoneNumber = _useState4[1];
78
- var _useState5 = (0, _react.useState)(null),
82
+ reCaptchaVersion = _useState4[0],
83
+ setRecaptchaVersion = _useState4[1];
84
+ var emailInput = (0, _react.useRef)(null);
85
+ var _useState5 = (0, _react.useState)(''),
79
86
  _useState6 = _slicedToArray(_useState5, 2),
80
- isValidPhoneNumber = _useState6[0],
81
- setIsValidPhoneNumber = _useState6[1];
82
- var _useState7 = (0, _react.useState)(false),
87
+ userPhoneNumber = _useState6[0],
88
+ setUserPhoneNumber = _useState6[1];
89
+ var _useState7 = (0, _react.useState)(null),
83
90
  _useState8 = _slicedToArray(_useState7, 2),
84
- passwordSee = _useState8[0],
85
- setPasswordSee = _useState8[1];
91
+ isValidPhoneNumber = _useState8[0],
92
+ setIsValidPhoneNumber = _useState8[1];
93
+ var _useState9 = (0, _react.useState)(false),
94
+ _useState10 = _slicedToArray(_useState9, 2),
95
+ passwordSee = _useState10[0],
96
+ setPasswordSee = _useState10[1];
86
97
  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';
87
98
  var togglePasswordView = function togglePasswordView() {
88
99
  setPasswordSee(!passwordSee);
@@ -158,16 +169,36 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
158
169
  }
159
170
  };
160
171
  (0, _react.useEffect)(function () {
161
- var _formState$result, _formState$result3, _formState$result4;
172
+ var _formState$result, _formState$result4, _formState$result5;
162
173
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
163
- var _formState$result2;
174
+ var _formState$result2, _formState$result2$re, _formState$result3;
175
+ 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') {
176
+ var _configs$security_rec;
177
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
178
+ var _configs$security_rec2;
179
+ setRecaptchaVersion({
180
+ version: 'v2',
181
+ 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
182
+ });
183
+ setAlertState({
184
+ open: true,
185
+ content: [t('TRY_AGAIN', 'Please try again')]
186
+ });
187
+ return;
188
+ }
189
+ setAlertState({
190
+ open: true,
191
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
192
+ });
193
+ return;
194
+ }
164
195
  setAlertState({
165
196
  open: true,
166
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
197
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
167
198
  });
168
- } 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) {
169
- var _formState$result5;
170
- saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
199
+ } 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) {
200
+ var _formState$result6;
201
+ saveCustomerUser && saveCustomerUser((_formState$result6 = formState.result) === null || _formState$result6 === void 0 ? void 0 : _formState$result6.result);
171
202
  }
172
203
  }, [formState]);
173
204
  (0, _react.useEffect)(function () {
@@ -207,6 +238,14 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
207
238
  handleChangePhoneNumber(externalPhoneNumber, true);
208
239
  }
209
240
  }, [externalPhoneNumber]);
241
+ (0, _react.useEffect)(function () {
242
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
243
+ setRecaptchaVersion({
244
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
245
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
246
+ });
247
+ }
248
+ }, [recaptchaConfig]);
210
249
  (0, _react.useEffect)(function () {
211
250
  handleChangeInput({
212
251
  target: {
@@ -297,7 +336,8 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
297
336
  height: 43
298
337
  }));
299
338
  })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
300
- handleReCaptcha: handleReCaptcha
339
+ handleReCaptcha: handleReCaptcha,
340
+ reCaptchaVersion: reCaptchaVersion
301
341
  })), (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, {
302
342
  name: "acceptTerms",
303
343
  ref: formMethods.register({
@@ -16,6 +16,7 @@ var _Inputs = require("../../../../styles/Inputs");
16
16
  var _Buttons = require("../../../../styles/Buttons");
17
17
  var _Checkbox = require("../../../../../../../styles/Checkbox");
18
18
  var _utils = require("../../../../../../../utils");
19
+ var _useRecaptcha3 = require("../../../../../../../hooks/useRecaptcha");
19
20
  var _AiOutlineEye = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEye"));
20
21
  var _AiOutlineEyeInvisible = _interopRequireDefault(require("@meronex/icons/ai/AiOutlineEyeInvisible"));
21
22
  var _orderingComponentsExternal = require("ordering-components-external");
@@ -70,19 +71,29 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
70
71
  _useState2 = _slicedToArray(_useState, 2),
71
72
  alertState = _useState2[0],
72
73
  setAlertState = _useState2[1];
73
- var emailInput = (0, _react.useRef)(null);
74
- var _useState3 = (0, _react.useState)(''),
74
+ var _useRecaptcha = (0, _useRecaptcha3.useRecaptcha)(enableReCaptcha),
75
+ _useRecaptcha2 = _slicedToArray(_useRecaptcha, 1),
76
+ recaptchaConfig = _useRecaptcha2[0];
77
+ var _useState3 = (0, _react.useState)({
78
+ version: '',
79
+ siteKey: ''
80
+ }),
75
81
  _useState4 = _slicedToArray(_useState3, 2),
76
- userPhoneNumber = _useState4[0],
77
- setUserPhoneNumber = _useState4[1];
78
- var _useState5 = (0, _react.useState)(null),
82
+ reCaptchaVersion = _useState4[0],
83
+ setRecaptchaVersion = _useState4[1];
84
+ var emailInput = (0, _react.useRef)(null);
85
+ var _useState5 = (0, _react.useState)(''),
79
86
  _useState6 = _slicedToArray(_useState5, 2),
80
- isValidPhoneNumber = _useState6[0],
81
- setIsValidPhoneNumber = _useState6[1];
82
- var _useState7 = (0, _react.useState)(false),
87
+ userPhoneNumber = _useState6[0],
88
+ setUserPhoneNumber = _useState6[1];
89
+ var _useState7 = (0, _react.useState)(null),
83
90
  _useState8 = _slicedToArray(_useState7, 2),
84
- passwordSee = _useState8[0],
85
- setPasswordSee = _useState8[1];
91
+ isValidPhoneNumber = _useState8[0],
92
+ setIsValidPhoneNumber = _useState8[1];
93
+ var _useState9 = (0, _react.useState)(false),
94
+ _useState10 = _slicedToArray(_useState9, 2),
95
+ passwordSee = _useState10[0],
96
+ setPasswordSee = _useState10[1];
86
97
  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';
87
98
  var togglePasswordView = function togglePasswordView() {
88
99
  setPasswordSee(!passwordSee);
@@ -158,16 +169,36 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
158
169
  }
159
170
  };
160
171
  (0, _react.useEffect)(function () {
161
- var _formState$result, _formState$result3, _formState$result4;
172
+ var _formState$result, _formState$result4, _formState$result5;
162
173
  if (!formState.loading && (_formState$result = formState.result) !== null && _formState$result !== void 0 && _formState$result.error) {
163
- var _formState$result2;
174
+ var _formState$result2, _formState$result2$re, _formState$result3;
175
+ 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') {
176
+ var _configs$security_rec;
177
+ if (configs !== null && configs !== void 0 && (_configs$security_rec = configs.security_recaptcha_site_key) !== null && _configs$security_rec !== void 0 && _configs$security_rec.value) {
178
+ var _configs$security_rec2;
179
+ setRecaptchaVersion({
180
+ version: 'v2',
181
+ 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
182
+ });
183
+ setAlertState({
184
+ open: true,
185
+ content: [t('TRY_AGAIN', 'Please try again')]
186
+ });
187
+ return;
188
+ }
189
+ setAlertState({
190
+ open: true,
191
+ content: [t('CONFIG_DOESNOT_RECAPTCHA_KEY', 'the config doesn\'t have recaptcha site key')]
192
+ });
193
+ return;
194
+ }
164
195
  setAlertState({
165
196
  open: true,
166
- content: ((_formState$result2 = formState.result) === null || _formState$result2 === void 0 ? void 0 : _formState$result2.result) || [t('ERROR', 'Error')]
197
+ content: ((_formState$result3 = formState.result) === null || _formState$result3 === void 0 ? void 0 : _formState$result3.result) || [t('ERROR', 'Error')]
167
198
  });
168
- } 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) {
169
- var _formState$result5;
170
- saveCustomerUser && saveCustomerUser((_formState$result5 = formState.result) === null || _formState$result5 === void 0 ? void 0 : _formState$result5.result);
199
+ } 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) {
200
+ var _formState$result6;
201
+ saveCustomerUser && saveCustomerUser((_formState$result6 = formState.result) === null || _formState$result6 === void 0 ? void 0 : _formState$result6.result);
171
202
  }
172
203
  }, [formState]);
173
204
  (0, _react.useEffect)(function () {
@@ -207,6 +238,14 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
207
238
  handleChangePhoneNumber(externalPhoneNumber, true);
208
239
  }
209
240
  }, [externalPhoneNumber]);
241
+ (0, _react.useEffect)(function () {
242
+ if (recaptchaConfig !== null && recaptchaConfig !== void 0 && recaptchaConfig.siteKey) {
243
+ setRecaptchaVersion({
244
+ version: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.version,
245
+ siteKey: recaptchaConfig === null || recaptchaConfig === void 0 ? void 0 : recaptchaConfig.siteKey
246
+ });
247
+ }
248
+ }, [recaptchaConfig]);
210
249
  (0, _react.useEffect)(function () {
211
250
  handleChangeInput({
212
251
  target: {
@@ -293,7 +332,8 @@ var SignUpDriverUI = function SignUpDriverUI(props) {
293
332
  height: 43
294
333
  }));
295
334
  })), props.isRecaptchaEnable && enableReCaptcha && /*#__PURE__*/_react.default.createElement(_styles.ReCaptchaWrapper, null, /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.ReCaptcha, {
296
- handleReCaptcha: handleReCaptcha
335
+ handleReCaptcha: handleReCaptcha,
336
+ reCaptchaVersion: reCaptchaVersion
297
337
  })), (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, {
298
338
  name: "acceptTerms",
299
339
  ref: formMethods.register({