ordering-ui-admin-external 1.21.2 → 1.22.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 (33) hide show
  1. package/_bundles/{ordering-ui-admin.787be5e673d9764f2bf0.js → ordering-ui-admin.825f0823f4b81b92e41b.js} +2 -2
  2. package/_modules/components/Delivery/DriversGroupLogs/index.js +3 -3
  3. package/_modules/components/Delivery/DriversLogs/index.js +13 -0
  4. package/_modules/components/Delivery/UserDetails/index.js +9 -4
  5. package/_modules/components/Delivery/UserDetailsMenu/index.js +3 -0
  6. package/_modules/components/MyProducts/AdvancedSettings/OrderType.js +2 -2
  7. package/_modules/components/MyProducts/AdvancedSettings/index.js +14 -18
  8. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -2
  9. package/_modules/components/Stores/BusinessDetails/index.js +4 -0
  10. package/_modules/components/Stores/BusinessQRCodeOption/index.js +168 -0
  11. package/_modules/components/Stores/BusinessQRCodeOption/styles.js +39 -0
  12. package/_modules/components/Stores/BusinessQRCodeOptions/index.js +111 -0
  13. package/_modules/components/Stores/BusinessQRCodeOptions/styles.js +48 -0
  14. package/_modules/components/Stores/BusinessSummary/index.js +1 -1
  15. package/_modules/components/Stores/index.js +14 -0
  16. package/_modules/utils/index.js +24 -2
  17. package/package.json +3 -2
  18. package/src/components/Delivery/DriversGroupLogs/index.js +2 -4
  19. package/src/components/Delivery/DriversLogs/index.js +8 -0
  20. package/src/components/Delivery/UserDetails/index.js +8 -0
  21. package/src/components/Delivery/UserDetailsMenu/index.js +2 -1
  22. package/src/components/MyProducts/AdvancedSettings/OrderType.js +2 -2
  23. package/src/components/MyProducts/AdvancedSettings/index.js +14 -15
  24. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +3 -2
  25. package/src/components/Stores/BusinessDetails/index.js +7 -0
  26. package/src/components/Stores/BusinessQRCodeOption/index.js +178 -0
  27. package/src/components/Stores/BusinessQRCodeOption/styles.js +113 -0
  28. package/src/components/Stores/BusinessQRCodeOptions/index.js +112 -0
  29. package/src/components/Stores/BusinessQRCodeOptions/styles.js +63 -0
  30. package/src/components/Stores/BusinessSummary/index.js +1 -1
  31. package/src/components/Stores/index.js +4 -0
  32. package/src/utils/index.js +16 -0
  33. /package/_bundles/{ordering-ui-admin.787be5e673d9764f2bf0.js.LICENSE.txt → ordering-ui-admin.825f0823f4b81b92e41b.js.LICENSE.txt} +0 -0
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PublishingOptionContainer = exports.PublishingOption = exports.PublishingName = exports.PublishingListWrapper = exports.PublishingContainer = exports.MainContainer = void 0;
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
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
+ 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
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
+ var MainContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n height: 100%;\n"])));
14
+ exports.MainContainer = MainContainer;
15
+ var PublishingContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 100%;\n overflow-x: hidden;\n flex: 1;\n h1 {\n color: ", ";\n font-size: 20px;\n font-weight: 700;\n }\n @media (min-width: 576px) {\n padding: 20px;\n }\n"])), function (props) {
16
+ return props.theme.colors.headingColor;
17
+ });
18
+ exports.PublishingContainer = PublishingContainer;
19
+ var PublishingListWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n margin: 20px 0;\n"])), function (props) {
20
+ return props.theme.colors.borderColor;
21
+ });
22
+ exports.PublishingListWrapper = PublishingListWrapper;
23
+ var PublishingOptionContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid ", ";\n padding: 12px 18px;\n ", "\n"])), function (props) {
24
+ return props.theme.colors.borderColor;
25
+ }, function (_ref) {
26
+ var active = _ref.active;
27
+ return active && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n border-bottom: 1px solid ", ";\n background-color: ", ";\n "])), function (props) {
28
+ return props.theme.colors.primary;
29
+ }, function (props) {
30
+ return props.theme.colors.primary;
31
+ }, function (props) {
32
+ return props.theme.colors.backgroundInfo;
33
+ });
34
+ });
35
+ exports.PublishingOptionContainer = PublishingOptionContainer;
36
+ var PublishingOption = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n align-items: flex-start;\n flex-direction: column;\n cursor: pointer;\n color: ", ";\n \n > svg {\n font-size: 20px;\n &.fill {\n color: ", ";\n }\n }\n"])), function (props) {
37
+ return props.theme.colors.headingColor;
38
+ }, function (props) {
39
+ return props.theme.colors.primary;
40
+ });
41
+ exports.PublishingOption = PublishingOption;
42
+ var PublishingName = _styledComponents.default.span(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 14px;\n ", "\n"])), function (props) {
43
+ return props.theme.colors.headingColor;
44
+ }, function (props) {
45
+ var _props$theme;
46
+ return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n margin-left: 10px;\n "]))) : (0, _styledComponents.css)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n margin-right: 10px;\n "])));
47
+ });
48
+ exports.PublishingName = PublishingName;
@@ -91,7 +91,7 @@ var BusinessSummary = function BusinessSummary(props) {
91
91
  var _businessState$busine2;
92
92
  window.open("https://".concat(ordering.project, ".tryordering.com/store/").concat(businessState === null || businessState === void 0 ? void 0 : (_businessState$busine2 = businessState.business) === null || _businessState$busine2 === void 0 ? void 0 : _businessState$busine2.slug), '_blank');
93
93
  };
94
- var itemsExcluded = !!spoonityConfig ? ['publishing'] : ['publishing', 'spoonity_key'];
94
+ var itemsExcluded = !!spoonityConfig ? ['publishing', 'personalization'] : ['publishing', 'spoonity_key', 'personalization'];
95
95
  var businessConfigs = [{
96
96
  key: 'store_details',
97
97
  value: t('STORE_DETAILS', 'Store details')
@@ -273,6 +273,18 @@ Object.defineProperty(exports, "BusinessPublishing", {
273
273
  return _BusinessPublishing.BusinessPublishing;
274
274
  }
275
275
  });
276
+ Object.defineProperty(exports, "BusinessQRCodeOption", {
277
+ enumerable: true,
278
+ get: function get() {
279
+ return _BusinessQRCodeOption.BusinessQRCodeOption;
280
+ }
281
+ });
282
+ Object.defineProperty(exports, "BusinessQRCodeOptions", {
283
+ enumerable: true,
284
+ get: function get() {
285
+ return _BusinessQRCodeOptions.BusinessQRCodeOptions;
286
+ }
287
+ });
276
288
  Object.defineProperty(exports, "BusinessSalesChannel", {
277
289
  enumerable: true,
278
290
  get: function get() {
@@ -686,6 +698,8 @@ var _BusinessTypes = require("./BusinessTypes");
686
698
  var _BusinessVideos = require("./BusinessVideos");
687
699
  var _BusinessWebhooks = require("./BusinessWebhooks");
688
700
  var _BusinessWidgets = require("./BusinessWidgets");
701
+ var _BusinessQRCodeOption = require("./BusinessQRCodeOption");
702
+ var _BusinessQRCodeOptions = require("./BusinessQRCodeOptions");
689
703
  var _SeoOptions = require("./SeoOptions");
690
704
  var _AddBusinessForm = require("./AddBusinessForm");
691
705
  var _WizardBusiness = require("./WizardBusiness");
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.widgetURL = exports.verifyDecimals = exports.stringToSlug = exports.sortInputFields = exports.shape = exports.setStorageItem = exports.scrollTo = exports.ribbonValues = exports.reviewCommentList = exports.removeStorageItem = exports.orderRejectCommentList = exports.optimizeImage = exports.getUniqueId = exports.getStorageItem = exports.getStarWidth = exports.getSeconds = exports.getMinutes = exports.getIconCard = exports.getHours = exports.getCurrentDiffDays = exports.getAgoMinutes = exports.formatUrlVideo = exports.formatSeconds = exports.firstLetterCapital = exports.fieldsToSort = exports.convertHoursToMinutes = exports.convertHMS = exports.checkSiteUrl = exports.checkPreSiteUrl = exports.capitalize = exports.bytesConverter = exports.DriverTipsOptions = void 0;
6
+ exports.widgetURL = exports.verifyDecimals = exports.stringToSlug = exports.sortInputFields = exports.shape = exports.setStorageItem = exports.scrollTo = exports.ribbonValues = exports.reviewCommentList = exports.removeStorageItem = exports.orderRejectCommentList = exports.optimizeImage = exports.getUniqueId = exports.getStorageItem = exports.getStarWidth = exports.getSeconds = exports.getMinutes = exports.getIconCard = exports.getHours = exports.getCurrentDiffDays = exports.getAgoMinutes = exports.formatUrlVideo = exports.formatSeconds = exports.firstLetterCapital = exports.fieldsToSort = exports.convertHoursToMinutes = exports.convertHMS = exports.checkValidUrlFormat = exports.checkSiteUrl = exports.checkPreSiteUrl = exports.capitalize = exports.bytesConverter = exports.DriverTipsOptions = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _FaCcMastercard = _interopRequireDefault(require("@meronex/icons/fa/FaCcMastercard"));
9
9
  var _FaCcVisa = _interopRequireDefault(require("@meronex/icons/fa/FaCcVisa"));
@@ -358,9 +358,31 @@ var checkPreSiteUrl = function checkPreSiteUrl(url, fallback) {
358
358
  };
359
359
 
360
360
  /**
361
- * default value for bitton
361
+ * Function to validate URL
362
+ * @param {string} url URL of page
362
363
  */
363
364
  exports.checkPreSiteUrl = checkPreSiteUrl;
365
+ var checkValidUrlFormat = function checkValidUrlFormat(url) {
366
+ if (!url) return;
367
+ var pattern = new RegExp('^(https?:\\/\\/)?' +
368
+ // protocol
369
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
370
+ // domain name
371
+ '((\\d{1,3}\\.){3}\\d{1,3}))' +
372
+ // OR ip (v4) address
373
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' +
374
+ // port and path
375
+ '(\\?[;&a-z\\d%_.~+=-]*)?' +
376
+ // query string
377
+ '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
378
+
379
+ return pattern.test(url);
380
+ };
381
+
382
+ /**
383
+ * default value for bitton
384
+ */
385
+ exports.checkValidUrlFormat = checkValidUrlFormat;
364
386
  var ribbonValues = {
365
387
  color: '#0083FE',
366
388
  text: 'ribbon',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-admin-external",
3
- "version": "1.21.2",
3
+ "version": "1.22.0",
4
4
  "description": "Ordering UI Admin Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -83,7 +83,7 @@
83
83
  "lodash": "^4.17.20",
84
84
  "moment": "^2.29.1",
85
85
  "moment-range": "^4.0.2",
86
- "ordering-components-admin-external": "1.21.1",
86
+ "ordering-components-admin-external": "1.22.0",
87
87
  "polished": "^3.6.7",
88
88
  "prop-types": "^15.7.2",
89
89
  "react-big-calendar": "^1.4.2",
@@ -100,6 +100,7 @@
100
100
  "react-otp-input": "^2.4.0",
101
101
  "react-phone-number-input": "^3.1.23",
102
102
  "react-popper": "^2.3.0",
103
+ "react-qr-code": "^2.0.11",
103
104
  "react-summernote": "^2.0.2",
104
105
  "react-to-print": "^2.14.6",
105
106
  "react-toastify": "^6.1.0",
@@ -14,7 +14,7 @@ import {
14
14
  DataListTable
15
15
  } from './styles'
16
16
 
17
- const DriversGroupLogsUI = (props) => {
17
+ export const DriversGroupLogsUI = (props) => {
18
18
  const {
19
19
  logsList,
20
20
  paginationProps,
@@ -71,8 +71,6 @@ const DriversGroupLogsUI = (props) => {
71
71
  }
72
72
  }, [logsList.logs, paginationProps])
73
73
 
74
- console.log(logsList)
75
-
76
74
  return (
77
75
  <>
78
76
  <DriversGroupLogsContainer
@@ -133,7 +131,7 @@ const DriversGroupLogsUI = (props) => {
133
131
  </td>
134
132
  <td>
135
133
  <DataListTable>
136
- {(typeof log?.data === 'object' ? Object.values(log?.data) : log?.data).map((item, i) => (
134
+ {log?.data && (typeof log?.data === 'object' ? Object.values(log?.data) : log?.data).map((item, i) => (
137
135
  <tbody key={i}>
138
136
  <tr>
139
137
  <td>{getAttributeName(item?.attribute)}</td>
@@ -0,0 +1,8 @@
1
+ import React from 'react'
2
+ import { DriversLogs as DriversLogsController } from 'ordering-components-admin-external'
3
+
4
+ export const DriversLogs = (props) => {
5
+ return (
6
+ <DriversLogsController {...props} />
7
+ )
8
+ }
@@ -10,6 +10,8 @@ import { Personalization, Modal, Schedule } from '../../Shared'
10
10
  import { UserDetailsMenu } from '../UserDetailsMenu'
11
11
  import { UserProfileForm } from '../UserProfileForm'
12
12
  import { UserMetaFields } from '../../Users'
13
+ import { DriversLogs } from '../DriversLogs'
14
+ import { DriversGroupLogsUI } from '../DriversGroupLogs'
13
15
  import { DriverGroupSetting } from '../DriverGroupSetting'
14
16
  import { ArrowsAngleContract, ArrowsAngleExpand, ThreeDots } from 'react-bootstrap-icons'
15
17
  import { Switch, Button, IconButton } from '../../../styles'
@@ -195,6 +197,12 @@ export const UserDetailsUI = (props) => {
195
197
  </ActionsForm>
196
198
  </ScheduleSection>
197
199
  )}
200
+ {currentMenuSelected === 'logs' && (
201
+ <DriversLogs
202
+ userId={userState.user?.id}
203
+ UIComponent={DriversGroupLogsUI}
204
+ />
205
+ )}
198
206
  {currentMenuSelected === 'orders' && (
199
207
  <OrdersManager
200
208
  isSelectedOrders
@@ -19,7 +19,8 @@ export const UserDetailsMenu = (props) => {
19
19
  { key: 'profile', content: t('PROFILE', 'Profile') },
20
20
  { key: 'driver_group', content: t('DRIVER_GROUP', 'Driver group') },
21
21
  { key: 'saved_places', content: t('SAVED_PLACES', 'Saved places') },
22
- { key: 'schedule', content: t('SCHEDULE', 'Schedule') }
22
+ { key: 'schedule', content: t('SCHEDULE', 'Schedule') },
23
+ { key: 'logs', content: t('LOGS', 'Logs') }
23
24
  // { key: 'metafields', content: t('METAFIELDS', 'Metafields') },
24
25
  // { key: 'personalization', content: t('PERSONALIZATION', 'Personalization') }
25
26
  ] : [
@@ -28,9 +28,9 @@ export const OrderType = (props) => {
28
28
  />
29
29
  </FormControl>
30
30
  <FormControl>
31
- <label>{t('CALL_TO_ACTION', 'Call to action')}</label>
31
+ <label>{t('EXPORT_CALL_TO_ACTION', 'Call to action')}</label>
32
32
  <Input
33
- placeholder={t('CALL_TO_ACTION', 'Call to action')}
33
+ placeholder={t('EXPORT_CALL_TO_ACTION', 'Call to action')}
34
34
  defaultValue={typeValues?.call_to_action || ''}
35
35
  onChange={(e) => handleUpdateThemeValue(e.target.value, [path, 'call_to_action'].join('.'))}
36
36
  />
@@ -47,7 +47,7 @@ export const AdvancedSettings = (props) => {
47
47
  { name: '', type: 'hidden', path: 'business_listing_view.hidden' },
48
48
  { name: t('BUSINESS_LISTING_IMAGE', 'Business listing image'), type: 'image', path: 'business_listing_view.components.business_hero.components.image' },
49
49
  { name: t('PREVIOUS_ORDERS_BLOCK', 'Previous orders block'), type: 'hidden', path: 'business_listing_view.components.previous_orders_block.hidden' },
50
- { name: t('Highest_rated_business_block', 'Highest rated business block'), type: 'hidden', path: 'business_listing_view.components.highest_rated_business_block.hidden' },
50
+ { name: t('HIGHEST_RATED_BUSINESS_BLOCK', 'Highest rated business block'), type: 'hidden', path: 'business_listing_view.components.highest_rated_business_block.hidden' },
51
51
  { name: t('CATEGORIES_BLOCK', 'Categories block'), type: 'hidden', path: 'business_listing_view.components.categories.hidden' },
52
52
  { name: t('AMOUNT_OF_BUSINESSES_TO_DISPLAY_PER_ROW', 'Amount of businesses to display per row:'), type: 'position', path: 'business_listing_view.components.layout.rows' },
53
53
  { name: t('SEARCH_BOX', 'Search box'), type: 'hidden', path: 'business_listing_view.components.search.hidden' },
@@ -123,39 +123,38 @@ export const AdvancedSettings = (props) => {
123
123
 
124
124
  const myAccountList = [
125
125
  { name: t('USER_IMAGE', 'User image'), type: 'hidden', path: 'profile.components.picture.hidden' },
126
- { name: t('BIRTHDAY', 'Birthday'), type: 'hidden', path: 'profile.components.birthday.hidden' },
126
+ { name: t('EXPORT_BIRTHDAY', 'Birthday'), type: 'hidden', path: 'profile.components.birthday.hidden' },
127
127
  { name: t('LANGUAGES', 'Languages'), type: 'hidden', path: 'profile.components.languages.hidden' },
128
128
  { name: t('ADDRESS_LIST', 'Address list'), type: 'hidden', path: 'profile.components.address_list.hidden' }
129
129
  ]
130
130
 
131
131
  const activeOrderBlockList = [
132
- { name: t('MAP', 'Map'), type: 'hidden', path: 'orders.components.map.hidden' },
133
132
  { name: t('BUSINESS_LOGO', 'Business logo'), type: 'hidden', path: 'orders.components.business_logo.hidden' },
134
- { name: t('BUSINESS_NAME', 'Business name'), type: 'hidden', path: 'orders.components.business_name.hidden' },
133
+ { name: t('EXPORT_BUSINESS_NAME', 'Business name'), type: 'hidden', path: 'orders.components.business_name.hidden' },
135
134
  { name: t('ORDER_NUMBER', 'Order number'), type: 'hidden', path: 'orders.components.order_number.hidden' },
136
135
  { name: t('ORDER_DATE', 'Order date'), type: 'hidden', path: 'orders.components.date.hidden' },
137
- { name: t('REVIEW_ORDER_BUTTON', 'Review order button'), type: 'hidden', path: 'orders.components.review_order_button.hidden' },
138
- { name: t('REORDER_BUTTON', 'Reorder button'), type: 'hidden', path: 'orders.components.reorder_button.hidden' },
136
+ { name: t('EXPORT_REVIEW_ORDER_BUTTON', 'Review order button'), type: 'hidden', path: 'orders.components.review_order_button.hidden' },
137
+ { name: t('EXPORT_REORDER_BUTTON', 'Reorder button'), type: 'hidden', path: 'orders.components.reorder_button.hidden' },
139
138
  { name: t('FAVORITE_BUTTON', 'Favorite button'), type: 'hidden', path: 'orders.components.favorite.hidden' },
140
139
  { name: t('ORDER_STATUS', 'Order status'), type: 'hidden', path: 'orders.components.order_status.hidden' },
141
- { name: t('PREVIOUS_ORDER_BLOCK', 'Previous order block'), type: 'hidden', path: 'orders.components.past_orders.hidden' },
142
- { name: t('BUSINESS_TAB', 'Business tab'), type: 'hidden', path: 'orders.components.business_tab.hidden' },
143
- { name: t('PRODUCTS_TAB', 'Products tab'), type: 'hidden', path: 'orders.components.products_tab.hidden' }
140
+ { name: t('EXPORT_PREVIOUS_ORDER_BLOCK', 'Previous order block'), type: 'hidden', path: 'orders.components.past_orders.hidden' },
141
+ { name: t('EXPORT_BUSINESS_TAB', 'Business tab'), type: 'hidden', path: 'orders.components.business_tab.hidden' },
142
+ { name: t('EXPORT_PRODUCTS_TAB', 'Products tab'), type: 'hidden', path: 'orders.components.products_tab.hidden' }
144
143
  ]
145
144
 
146
145
  const menuOptionList = [
147
- { name: t('BROWSE_AND_SEARCH', 'Browse and search'), type: 'hidden', path: 'bar_menu.components.browse.hidden' },
148
- { name: t('WALLET', 'Wallet'), type: 'hidden', path: 'bar_menu.components.wallet.hidden' },
146
+ { name: t('EXPORT_BROWSE_AND_SEARCH', 'Browse and search'), type: 'hidden', path: 'bar_menu.components.browse.hidden' },
147
+ { name: t('WALLETS', 'Wallets'), type: 'hidden', path: 'bar_menu.components.wallet.hidden' },
149
148
  { name: t('PROMOTIONS', 'Promotions'), type: 'hidden', path: 'bar_menu.components.promotions.hidden' },
150
149
  { name: t('MESSAGES', 'Messages'), type: 'hidden', path: 'bar_menu.components.messages.hidden' },
151
150
  { name: t('HELP', 'Help'), type: 'hidden', path: 'bar_menu.components.help.hidden' },
152
- { name: t('SECURITY', 'Security'), type: 'hidden', path: 'bar_menu.components.sessions.hidden' },
153
- { name: t('MY_FAVORITES', 'My favorites'), type: 'hidden', path: 'bar_menu.components.favorites.hidden' }
151
+ { name: t('EXPORT_SECURITY', 'Security'), type: 'hidden', path: 'bar_menu.components.sessions.hidden' },
152
+ { name: t('EXPORT_MY_FAVORITES', 'My favorites'), type: 'hidden', path: 'bar_menu.components.favorites.hidden' }
154
153
  ]
155
154
 
156
155
  const thirdPartyCodeList = [
157
- { name: t('HEAD', 'Head'), type: 'input', path: 'third_party_code.head' },
158
- { name: t('BODY', 'Body'), type: 'input', path: 'third_party_code.body' }
156
+ { name: t('EXPORT_HEAD', 'Head'), type: 'input', path: 'third_party_code.head' },
157
+ { name: t('EXPORT_BODY', 'Body'), type: 'input', path: 'third_party_code.body' }
159
158
  ]
160
159
 
161
160
  const buttonList = [
@@ -214,10 +214,11 @@ export const BusinessDeliveryZoneInformation = (props) => {
214
214
  disabled={!isMyZone}
215
215
  placeholder={`1 - 99 ${configState?.configs?.distance_unit?.value}`}
216
216
  name='distance'
217
- maxLength={2}
218
217
  value={formState.changes?.data?.distance ?? zone?.data?.distance ?? ''}
219
218
  onInput={(e) => {
220
- e.target.value = e.target.value.match(`^[${e.target.value === '0' ? '1' : '0'}-9]{1,2}$`)
219
+ e.target.value = (Number(e.target.value) > 99 || e.target.value === '.' || (e.target.value.match(/\./g) || []).length > 1)
220
+ ? e.target.value.slice(0, -1)
221
+ : e.target.value.match(`^[${e.target.value === '0' ? '1' : '0'}-9/.]{1,9}$`)
221
222
  }}
222
223
  onChange={e => handleChangeInput(e, configState?.configs?.distance_unit?.value)}
223
224
  ref={register({
@@ -27,6 +27,7 @@ import {
27
27
  BarContainer
28
28
  } from './styles'
29
29
  import { BusinessSalesChannel } from '../BusinessSalesChannel'
30
+ import { BusinessQRCodeOptions } from '../BusinessQRCodeOptions'
30
31
 
31
32
  export const BusinessDetailsUI = (props) => {
32
33
  const {
@@ -305,6 +306,12 @@ export const BusinessDetailsUI = (props) => {
305
306
  setIsExtendExtraOpen={setIsExtendExtraOpen}
306
307
  />
307
308
  )} */}
309
+ {selectedItem === 'publishing' && isAdmin && (
310
+ <BusinessQRCodeOptions
311
+ business={businessState?.business}
312
+ setIsExtendExtraOpen={setIsExtendExtraOpen}
313
+ />
314
+ )}
308
315
  {selectedItem === 'sales_channels' && (
309
316
  <BusinessSalesChannel
310
317
  business={businessState?.business}
@@ -0,0 +1,178 @@
1
+ import React, { useEffect, useState, useRef } from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { useWindowSize } from '../../../hooks/useWindowSize'
4
+ import { Button, Input } from '../../../styles'
5
+ import { X as Close } from 'react-bootstrap-icons'
6
+ import QRCode from 'react-qr-code'
7
+ import ReactToPrint from 'react-to-print'
8
+ import { Alert } from '../../Shared'
9
+ import { checkSiteUrl, checkValidUrlFormat } from '../../../utils'
10
+ import {
11
+ Container,
12
+ ButtonGroup,
13
+ Header,
14
+ CloseButton,
15
+ FormControl,
16
+ QRCodeLayout
17
+ } from './styles'
18
+
19
+ export const BusinessQRCodeOption = (props) => {
20
+ const {
21
+ open,
22
+ item,
23
+ business,
24
+ onClose,
25
+ siteState
26
+ } = props
27
+
28
+ const [, t] = useLanguage()
29
+ const { width } = useWindowSize()
30
+ const [isMenuOpen, setIsMenuOpen] = useState(false)
31
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
32
+ const [code, setCode] = useState(null)
33
+
34
+ const numberRef = useRef(null)
35
+ const printerRef = useRef()
36
+ const siteRef = useRef()
37
+
38
+ const closeAlert = () => {
39
+ setAlertState({
40
+ open: false,
41
+ content: []
42
+ })
43
+ }
44
+
45
+ const generateQRCode = () => {
46
+ const errors = []
47
+ if (!(siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended') && !siteRef?.current?.value) {
48
+ errors.push(t('VALIDATION_ERROR_REQUIRED', 'URL is required').replace('_attribute_', t('URL', 'Url')))
49
+ }
50
+ if (siteRef?.current?.value && !checkValidUrlFormat(siteRef?.current?.value)) {
51
+ errors.push(t('VALIDATION_ERROR_URL', 'The URL format is not valid').replace('_attribute_', 'URL'))
52
+ }
53
+ if (item?.key !== 'pick_up' && !numberRef?.current?.value) {
54
+ errors.push(
55
+ item?.key === 'eat_in'
56
+ ? t('VALIDATION_ERROR_REQUIRED', 'Table number is required').replace('_attribute_', t('TABLE_NUMBER', 'Table number'))
57
+ : t('VALIDATION_ERROR_REQUIRED', 'Spot number is required').replace('_attribute_', t('SPOT_NUMBER', 'Spot number'))
58
+ )
59
+ }
60
+ if (errors.length > 0) {
61
+ setAlertState({
62
+ open: true,
63
+ content: errors
64
+ })
65
+ return
66
+ }
67
+ const storeUrl = siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended'
68
+ ? `https://${siteState?.site?.domain}/store/${business?.slug}`
69
+ : `${checkSiteUrl(siteRef?.current?.value)}store/${business?.slug}`
70
+ const tsNumber = item?.key !== 'pick_up'
71
+ ? (item?.key === 'eat_in'
72
+ ? `&table_numer=${numberRef?.current?.value}`
73
+ : `&spot_numer=${numberRef?.current?.value}`)
74
+ : ''
75
+ const compltedUrl = `${storeUrl}?order_type=${item.value}${tsNumber}`
76
+ console.log(compltedUrl)
77
+ setCode(compltedUrl)
78
+ }
79
+
80
+ const actionSidebar = (value) => {
81
+ if (!value) {
82
+ onClose && onClose()
83
+ }
84
+ setIsMenuOpen(value)
85
+ document.getElementById('qrOption').style.width = value
86
+ ? width > 1000 ? '500px' : '100%'
87
+ : '0'
88
+ }
89
+
90
+ useEffect(() => {
91
+ if (isMenuOpen) {
92
+ if (width < 1000) {
93
+ document.getElementById('qrOption').style.width = '100%'
94
+ } else {
95
+ document.getElementById('qrOption').style.width = '500px'
96
+ }
97
+ }
98
+ }, [width])
99
+
100
+ useEffect(() => {
101
+ if (!open) return
102
+ actionSidebar(true)
103
+ }, [open])
104
+
105
+ useEffect(() => {
106
+ setCode(null)
107
+ if (numberRef?.current) {
108
+ numberRef.current.value = ''
109
+ }
110
+ }, [item])
111
+
112
+ return (
113
+ <Container id='qrOption'>
114
+ <Header>
115
+ {item?.title && (<h1>{item?.title}</h1>)}
116
+ <CloseButton>
117
+ <Close onClick={() => onClose && onClose()} />
118
+ </CloseButton>
119
+ </Header>
120
+ {code && (
121
+ <QRCodeLayout ref={printerRef}>
122
+ <QRCode
123
+ size={256}
124
+ style={{ height: 'auto', maxWidth: '100%', width: '100%' }}
125
+ value={code}
126
+ viewBox='0 0 256 256'
127
+ />
128
+ </QRCodeLayout>
129
+ )}
130
+ {item?.key === 'pick_up' ? (
131
+ <p>{t('GENERATE_QR_CODE', 'Generate QR Code')}</p>
132
+ ) : (
133
+ <FormControl>
134
+ <label>{item?.key === 'eat_in' ? t('TABLE_NUMBER', 'Table number') : t('SPOT_NUMBER', 'Spot number')}</label>
135
+ <Input
136
+ placeholder='0'
137
+ ref={numberRef}
138
+ />
139
+ </FormControl>
140
+ )}
141
+ {!(siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended') && (
142
+ <FormControl isMargin>
143
+ <label>{t('ADD_YOUR_SITE_URL', 'Add your site url')}</label>
144
+ <Input
145
+ placeholder='https://yourdomain.com'
146
+ ref={siteRef}
147
+ />
148
+ </FormControl>
149
+ )}
150
+ <ButtonGroup>
151
+ <Button color='primary' outline onClick={generateQRCode}>
152
+ {t('GENERATE_CODE', 'Generate Code')}
153
+ </Button>
154
+ <ReactToPrint
155
+ trigger={() => (
156
+ <Button
157
+ color='primary'
158
+ disabled={!code}
159
+ >
160
+ {t('PRINT', 'Print')}
161
+ </Button>
162
+ )}
163
+ content={() => printerRef.current}
164
+ removeAfterPrint
165
+ />
166
+ </ButtonGroup>
167
+ <Alert
168
+ title={t('ORDERING', 'Ordering')}
169
+ content={alertState.content}
170
+ acceptText={t('ACCEPT', 'Accept')}
171
+ open={alertState.open}
172
+ onClose={() => closeAlert()}
173
+ onAccept={() => closeAlert()}
174
+ closeOnBackdrop={false}
175
+ />
176
+ </Container>
177
+ )
178
+ }
@@ -0,0 +1,113 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ padding: 20px;
5
+ overflow: auto;
6
+ transition: 0.3s;
7
+ box-sizing: border-box;
8
+ display: flex;
9
+ flex-direction: column;
10
+
11
+ > button {
12
+ margin-top: 20px;
13
+ position: sticky;
14
+ top: 100%;
15
+ width: fit-content;
16
+ height: 42px;
17
+ margin-bottom: 20px;
18
+ }
19
+
20
+ @media (min-width: 1000px) {
21
+ width: 0;
22
+ ${props => props.theme?.rtl ? css`
23
+ border-right: 1px solid #E9ECEF;
24
+ ` : css`
25
+ border-left: 1px solid #E9ECEF;
26
+ `}
27
+ }
28
+ > p {
29
+ font-weight: 400;
30
+ font-size: 14px;
31
+ line-height: 24px;
32
+ margin: 0;
33
+ }
34
+ `
35
+
36
+ export const ButtonGroup = styled.div`
37
+ display: flex;
38
+ flex-direction: column;
39
+ margin-top: 27px;
40
+
41
+ button {
42
+ height: 44px;
43
+ border-radius: 8px;
44
+ width: 100%;
45
+ margin-bottom: 10px;
46
+ @media (min-width: 576px) {
47
+ margin-bottom: 0;
48
+ width: fit-content;
49
+ &:first-child {
50
+ margin-right: 15px;
51
+ ${props => props.theme.rtl && css`
52
+ margin-right: 0;
53
+ margin-left: 15px;
54
+ `}
55
+ }
56
+ }
57
+ }
58
+ @media (min-width: 576px) {
59
+ flex-direction: row;
60
+ }
61
+ `
62
+
63
+ export const Header = styled.div`
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: space-between;
67
+ margin-bottom: 20px;
68
+ h1 {
69
+ font-size: 20px;
70
+ color: ${props => props.theme.colors.headingColor};
71
+ font-weight: 600;
72
+ margin: 0;
73
+ }
74
+ `
75
+
76
+ export const CloseButton = styled.div`
77
+ display: none;
78
+ @media (min-width: 1000px) {
79
+ display: flex;
80
+ align-items: center;
81
+ > svg {
82
+ cursor: pointer;
83
+ font-size: 24px;
84
+ color: ${props => props.theme.colors.headingColor};
85
+ ${props => props.theme?.rtl ? css`
86
+ margin-right: 10px;
87
+ ` : css`
88
+ margin-left: 10px;
89
+ `}
90
+ }
91
+ }
92
+ `
93
+
94
+ export const FormControl = styled.div`
95
+ label {
96
+ font-weight: 400;
97
+ font-size: 14px;
98
+ line-height: 24px;
99
+ margin-bottom: 6px;
100
+ }
101
+ input {
102
+ width: 100%;
103
+ height: 44px;
104
+ }
105
+
106
+ ${({ isMargin }) => isMargin && css`
107
+ margin-top: 10px;
108
+ `}
109
+ `
110
+
111
+ export const QRCodeLayout = styled.div`
112
+ margin-bottom: 20px;
113
+ `