ordering-ui-admin-external 1.21.2 → 1.22.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 (35) hide show
  1. package/_bundles/{ordering-ui-admin.787be5e673d9764f2bf0.js → ordering-ui-admin.74d9674ca663b087cda3.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/Orders/OrdersTable/styles.js +1 -1
  9. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -2
  10. package/_modules/components/Stores/BusinessDetails/index.js +4 -0
  11. package/_modules/components/Stores/BusinessQRCodeOption/index.js +168 -0
  12. package/_modules/components/Stores/BusinessQRCodeOption/styles.js +39 -0
  13. package/_modules/components/Stores/BusinessQRCodeOptions/index.js +111 -0
  14. package/_modules/components/Stores/BusinessQRCodeOptions/styles.js +48 -0
  15. package/_modules/components/Stores/BusinessSummary/index.js +1 -1
  16. package/_modules/components/Stores/index.js +14 -0
  17. package/_modules/utils/index.js +24 -2
  18. package/package.json +3 -2
  19. package/src/components/Delivery/DriversGroupLogs/index.js +2 -4
  20. package/src/components/Delivery/DriversLogs/index.js +8 -0
  21. package/src/components/Delivery/UserDetails/index.js +8 -0
  22. package/src/components/Delivery/UserDetailsMenu/index.js +2 -1
  23. package/src/components/MyProducts/AdvancedSettings/OrderType.js +2 -2
  24. package/src/components/MyProducts/AdvancedSettings/index.js +14 -15
  25. package/src/components/Orders/OrdersTable/styles.js +2 -2
  26. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +3 -2
  27. package/src/components/Stores/BusinessDetails/index.js +7 -0
  28. package/src/components/Stores/BusinessQRCodeOption/index.js +178 -0
  29. package/src/components/Stores/BusinessQRCodeOption/styles.js +113 -0
  30. package/src/components/Stores/BusinessQRCodeOptions/index.js +112 -0
  31. package/src/components/Stores/BusinessQRCodeOptions/styles.js +63 -0
  32. package/src/components/Stores/BusinessSummary/index.js +1 -1
  33. package/src/components/Stores/index.js +4 -0
  34. package/src/utils/index.js +16 -0
  35. /package/_bundles/{ordering-ui-admin.787be5e673d9764f2bf0.js.LICENSE.txt → ordering-ui-admin.74d9674ca663b087cda3.js.LICENSE.txt} +0 -0
@@ -0,0 +1,112 @@
1
+ import React, { useState } from 'react'
2
+ import { useTheme } from 'styled-components'
3
+ import { useLanguage, BusinessQRCodeOptions as BusinessQRCodeOptionsController } from 'ordering-components-admin-external'
4
+ import BsChevronRight from '@meronex/icons/bs/BsChevronRight'
5
+ import { Modal } from '../../Shared'
6
+ import { useWindowSize } from '../../../hooks/useWindowSize'
7
+ import { BusinessQRCodeOption } from '../BusinessQRCodeOption'
8
+
9
+ import {
10
+ MainContainer,
11
+ PublishingContainer,
12
+ PublishingListWrapper,
13
+ PublishingOptionContainer,
14
+ PublishingOption,
15
+ PublishingName
16
+ } from './styles'
17
+
18
+ const BusinessQRCodeOptionsUI = (props) => {
19
+ const {
20
+ setIsExtendExtraOpen,
21
+ siteState
22
+ } = props
23
+
24
+ const [, t] = useLanguage()
25
+ const theme = useTheme()
26
+ const { width } = useWindowSize()
27
+ const [isOpen, setIsOpen] = useState(false)
28
+ const [itemSelected, setItemSelected] = useState(null)
29
+
30
+ const publishingItems = [
31
+ {
32
+ key: 'pick_up',
33
+ value: 2,
34
+ title: t('QR_CODE_FOR_PICKUP', 'QR Code for Pickup')
35
+ },
36
+ {
37
+ key: 'eat_in',
38
+ value: 3,
39
+ title: t('QR_CODE_FOR_EATIN', 'QR Code for Eat in')
40
+ },
41
+ {
42
+ key: 'curbside',
43
+ value: 4,
44
+ title: t('QR_CODE_FOR_CURBSIDE', 'QR Code for Curbside')
45
+ },
46
+ {
47
+ key: 'driver_thru',
48
+ value: 5,
49
+ title: t('QR_CODE_FOR_DRIVE_THRU', 'QR Code for Drive Thru')
50
+ }
51
+ ]
52
+
53
+ const handleAction = (value, item = null) => {
54
+ setItemSelected(item)
55
+ setIsExtendExtraOpen(value)
56
+ setIsOpen(value)
57
+ }
58
+
59
+ return (
60
+ <MainContainer>
61
+ <PublishingContainer>
62
+ <h1>{t('PUBLISHING', 'Publishing')}</h1>
63
+
64
+ <PublishingListWrapper>
65
+ {publishingItems.map((item, i) => (
66
+ <PublishingOptionContainer key={i} onClick={() => handleAction(true, item)} active={item.key === itemSelected?.key}>
67
+ <PublishingOption>
68
+ <PublishingName>{item?.title}</PublishingName>
69
+ </PublishingOption>
70
+ <BsChevronRight style={{ color: theme.colors.lightGray }} />
71
+ </PublishingOptionContainer>
72
+ ))}
73
+ </PublishingListWrapper>
74
+ </PublishingContainer>
75
+
76
+ {width >= 1000 ? (
77
+ isOpen && (
78
+ <BusinessQRCodeOption
79
+ business={props.business}
80
+ open={isOpen}
81
+ item={itemSelected}
82
+ onClose={() => handleAction(false)}
83
+ />
84
+ )
85
+ ) : (
86
+ isOpen && (
87
+ <Modal
88
+ width='80%'
89
+ open={isOpen}
90
+ onClose={() => handleAction(false)}
91
+ >
92
+ <BusinessQRCodeOption
93
+ business={props.business}
94
+ siteState={siteState}
95
+ open={isOpen}
96
+ item={itemSelected}
97
+ onClose={() => handleAction(false)}
98
+ />
99
+ </Modal>
100
+ )
101
+ )}
102
+ </MainContainer>
103
+ )
104
+ }
105
+
106
+ export const BusinessQRCodeOptions = (props) => {
107
+ const businessQRcodeOptionsProps = {
108
+ ...props,
109
+ UIComponent: BusinessQRCodeOptionsUI
110
+ }
111
+ return <BusinessQRCodeOptionsController {...businessQRcodeOptionsProps} />
112
+ }
@@ -0,0 +1,63 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const MainContainer = styled.div`
4
+ display: flex;
5
+ height: 100%;
6
+ `
7
+
8
+ export const PublishingContainer = styled.div`
9
+ height: 100%;
10
+ overflow-x: hidden;
11
+ flex: 1;
12
+ h1 {
13
+ color: ${props => props.theme.colors.headingColor};
14
+ font-size: 20px;
15
+ font-weight: 700;
16
+ }
17
+ @media (min-width: 576px) {
18
+ padding: 20px;
19
+ }
20
+ `
21
+
22
+ export const PublishingListWrapper = styled.div`
23
+ border-top: 1px solid ${props => props.theme.colors.borderColor};
24
+ margin: 20px 0;
25
+ `
26
+
27
+ export const PublishingOptionContainer = styled.div`
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: space-between;
31
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
32
+ padding: 12px 18px;
33
+ ${({ active }) => active && css`
34
+ border-top: 1px solid ${props => props.theme.colors.primary};
35
+ border-bottom: 1px solid ${props => props.theme.colors.primary};
36
+ background-color: ${props => props.theme.colors.backgroundInfo};
37
+ `}
38
+ `
39
+
40
+ export const PublishingOption = styled.div`
41
+ display: flex;
42
+ align-items: flex-start;
43
+ flex-direction: column;
44
+ cursor: pointer;
45
+ color: ${props => props.theme.colors.headingColor};
46
+
47
+ > svg {
48
+ font-size: 20px;
49
+ &.fill {
50
+ color: ${props => props.theme.colors.primary};
51
+ }
52
+ }
53
+ `
54
+
55
+ export const PublishingName = styled.span`
56
+ color: ${props => props.theme.colors.headingColor};
57
+ font-size: 14px;
58
+ ${props => props.theme?.rtl ? css`
59
+ margin-left: 10px;
60
+ ` : css`
61
+ margin-right: 10px;
62
+ `}
63
+ `
@@ -59,7 +59,7 @@ export const BusinessSummary = (props) => {
59
59
  window.open(`https://${ordering.project}.tryordering.com/store/${businessState?.business?.slug}`, '_blank')
60
60
  }
61
61
 
62
- const itemsExcluded = !!spoonityConfig ? ['publishing'] : ['publishing', 'spoonity_key']
62
+ const itemsExcluded = !!spoonityConfig ? ['publishing', 'personalization'] : ['publishing', 'spoonity_key', 'personalization']
63
63
 
64
64
  const businessConfigs = [
65
65
  {
@@ -33,6 +33,8 @@ import { BusinessTypes } from './BusinessTypes'
33
33
  import { BusinessVideos } from './BusinessVideos'
34
34
  import { BusinessWebhooks } from './BusinessWebhooks'
35
35
  import { BusinessWidgets } from './BusinessWidgets'
36
+ import { BusinessQRCodeOption } from './BusinessQRCodeOption'
37
+ import { BusinessQRCodeOptions } from './BusinessQRCodeOptions'
36
38
  import { SeoOptions } from './SeoOptions'
37
39
  import { AddBusinessForm } from './AddBusinessForm'
38
40
  import { WizardBusiness } from './WizardBusiness'
@@ -143,6 +145,8 @@ export {
143
145
  BusinessVideos,
144
146
  BusinessWebhooks,
145
147
  BusinessWidgets,
148
+ BusinessQRCodeOption,
149
+ BusinessQRCodeOptions,
146
150
  SeoOptions,
147
151
  AddBusinessForm,
148
152
  WizardBusiness,
@@ -261,6 +261,22 @@ export const checkPreSiteUrl = (url, fallback) => {
261
261
  return url[0] === '/' ? url : `/${url}`
262
262
  }
263
263
 
264
+ /**
265
+ * Function to validate URL
266
+ * @param {string} url URL of page
267
+ */
268
+ export const checkValidUrlFormat = (url) => {
269
+ if (!url) return
270
+ const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
271
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
272
+ '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
273
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
274
+ '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
275
+ '(\\#[-a-z\\d_]*)?$', 'i') // fragment locator
276
+
277
+ return pattern.test(url)
278
+ }
279
+
264
280
  /**
265
281
  * default value for bitton
266
282
  */