ordering-ui-admin-external 1.23.4 → 1.24.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 (106) hide show
  1. package/_bundles/{ordering-ui-admin.152c2c4d99f05215f0c3.js → ordering-ui-admin.0c354f3e7da49f56465b.js} +2 -2
  2. package/_modules/components/CartRecovery/RecoveryActionAdd/index.js +325 -0
  3. package/_modules/components/CartRecovery/RecoveryGeneral/index.js +41 -17
  4. package/_modules/components/Delivery/DriversCompaniesList/styles.js +1 -1
  5. package/_modules/components/Delivery/DriversCompaniesListing/index.js +20 -2
  6. package/_modules/components/Delivery/DriversCompaniesListing/styles.js +2 -2
  7. package/_modules/components/Delivery/DriversCompanyAddForm/GeneralForm/index.js +122 -0
  8. package/_modules/components/Delivery/DriversCompanyAddForm/GeneralForm/styles.js +21 -0
  9. package/_modules/components/Delivery/DriversCompanyAddForm/ScheduleForm/index.js +27 -0
  10. package/_modules/components/Delivery/DriversCompanyAddForm/ScheduleForm/styles.js +14 -0
  11. package/_modules/components/Delivery/DriversCompanyAddForm/WebhooksForm/index.js +60 -0
  12. package/_modules/components/Delivery/DriversCompanyAddForm/WebhooksForm/styles.js +16 -0
  13. package/_modules/components/Delivery/DriversCompanyAddForm/index.js +114 -0
  14. package/_modules/components/Delivery/DriversCompanyAddForm/styles.js +18 -0
  15. package/_modules/components/MyProducts/AdvancedSettings/index.js +66 -82
  16. package/_modules/components/MyProducts/AdvancedSettings/styles.js +40 -44
  17. package/_modules/components/MyProducts/CustomDomain/index.js +150 -0
  18. package/_modules/components/MyProducts/CustomDomain/styles.js +38 -0
  19. package/_modules/components/MyProducts/OrderingWebsite/SelectBusiness.js +59 -0
  20. package/_modules/components/MyProducts/OrderingWebsite/SelectFranchise.js +59 -0
  21. package/_modules/components/MyProducts/OrderingWebsite/index.js +65 -36
  22. package/_modules/components/MyProducts/OrderingWebsite/styles.js +70 -35
  23. package/_modules/components/MyProducts/UploadAudio/index.js +170 -0
  24. package/_modules/components/MyProducts/UploadAudio/styles.js +30 -0
  25. package/_modules/components/MyProducts/index.js +8 -1
  26. package/_modules/components/Orders/DeliveriesLocation/index.js +1 -0
  27. package/_modules/components/Orders/OrderBill/index.js +4 -3
  28. package/_modules/components/Orders/OrderContactInformation/index.js +14 -12
  29. package/_modules/components/Orders/OrderDetails/index.js +6 -131
  30. package/_modules/components/Orders/OrdersTable/index.js +2 -2
  31. package/_modules/components/Settings/NotificationSetting/index.js +1 -1
  32. package/_modules/components/Settings/SettingsList/index.js +1 -1
  33. package/_modules/components/Settings/SettingsList/styles.js +2 -2
  34. package/_modules/components/Shared/InputPhoneNumber/index.js +3 -2
  35. package/_modules/components/SidebarMenu/index.js +22 -22
  36. package/_modules/components/Stores/BusinessDetails/index.js +6 -3
  37. package/_modules/components/Stores/BusinessDeviceDetail/index.js +66 -16
  38. package/_modules/components/Stores/BusinessDeviceDetail/styles.js +7 -5
  39. package/_modules/components/Stores/BusinessProductsListing/index.js +18 -16
  40. package/_modules/components/Stores/BusinessSalesChannel/index.js +13 -4
  41. package/_modules/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
  42. package/_modules/components/Stores/BusinessSalesFacebook/index.js +2 -2
  43. package/_modules/components/Stores/BusinessSalesGoogle/index.js +2 -2
  44. package/_modules/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +3 -2
  45. package/_modules/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
  46. package/_modules/components/Stores/BusinessSalesInstagram/index.js +3 -5
  47. package/_modules/components/Stores/BusinessSummary/index.js +11 -9
  48. package/_modules/components/Users/CustomersListing/index.js +5 -3
  49. package/_modules/utils/index.js +211 -3
  50. package/index-template.js +1 -1
  51. package/index.html +1 -0
  52. package/package.json +2 -2
  53. package/public/push/onesignal/OneSignalSDKUpdaterWorker.js +1 -0
  54. package/public/push/onesignal/OneSignalSDKWorker.js +1 -0
  55. package/src/components/CartRecovery/RecoveryActionAdd/index.js +355 -0
  56. package/src/components/CartRecovery/RecoveryGeneral/index.js +23 -4
  57. package/src/components/Delivery/DriversCompaniesList/styles.js +1 -1
  58. package/src/components/Delivery/DriversCompaniesListing/index.js +29 -12
  59. package/src/components/Delivery/DriversCompaniesListing/styles.js +1 -1
  60. package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/index.js +120 -0
  61. package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/styles.js +32 -0
  62. package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/index.js +29 -0
  63. package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/styles.js +11 -0
  64. package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/index.js +69 -0
  65. package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/styles.js +24 -0
  66. package/src/components/Delivery/DriversCompanyAddForm/index.js +121 -0
  67. package/src/components/Delivery/DriversCompanyAddForm/styles.js +39 -0
  68. package/src/components/MyProducts/AdvancedSettings/index.js +35 -36
  69. package/src/components/MyProducts/AdvancedSettings/styles.js +3 -11
  70. package/src/components/MyProducts/CustomDomain/index.js +137 -0
  71. package/src/components/MyProducts/CustomDomain/styles.js +103 -0
  72. package/src/components/MyProducts/OrderingWebsite/SelectBusiness.js +47 -0
  73. package/src/components/MyProducts/OrderingWebsite/SelectFranchise.js +47 -0
  74. package/src/components/MyProducts/OrderingWebsite/index.js +99 -42
  75. package/src/components/MyProducts/OrderingWebsite/styles.js +126 -7
  76. package/src/components/MyProducts/UploadAudio/index.js +168 -0
  77. package/src/components/MyProducts/UploadAudio/styles.js +120 -0
  78. package/src/components/MyProducts/index.js +3 -1
  79. package/src/components/Orders/DeliveriesLocation/index.js +1 -0
  80. package/src/components/Orders/OrderBill/index.js +9 -6
  81. package/src/components/Orders/OrderContactInformation/index.js +5 -1
  82. package/src/components/Orders/OrderDetails/index.js +7 -35
  83. package/src/components/Orders/OrdersTable/index.js +3 -1
  84. package/src/components/Settings/NotificationSetting/index.js +2 -0
  85. package/src/components/Settings/SettingsList/index.js +53 -53
  86. package/src/components/Settings/SettingsList/styles.js +2 -1
  87. package/src/components/Settings/SettingsSelectUI/index.js +1 -1
  88. package/src/components/Shared/InputPhoneNumber/index.js +2 -2
  89. package/src/components/SidebarMenu/index.js +1 -0
  90. package/src/components/Stores/BusinessDetails/index.js +4 -1
  91. package/src/components/Stores/BusinessDeviceDetail/index.js +46 -7
  92. package/src/components/Stores/BusinessDeviceDetail/styles.js +11 -0
  93. package/src/components/Stores/BusinessProductsListing/index.js +6 -2
  94. package/src/components/Stores/BusinessSalesChannel/index.js +12 -6
  95. package/src/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
  96. package/src/components/Stores/BusinessSalesFacebook/index.js +3 -3
  97. package/src/components/Stores/BusinessSalesGoogle/index.js +3 -3
  98. package/src/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +2 -2
  99. package/src/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
  100. package/src/components/Stores/BusinessSalesInstagram/index.js +3 -3
  101. package/src/components/Stores/BusinessSummary/index.js +6 -2
  102. package/src/components/Users/CustomersListing/index.js +2 -3
  103. package/src/utils/index.js +59 -1
  104. package/template/app.js +76 -3
  105. package/template/config.json +1 -0
  106. /package/_bundles/{ordering-ui-admin.152c2c4d99f05215f0c3.js.LICENSE.txt → ordering-ui-admin.0c354f3e7da49f56465b.js.LICENSE.txt} +0 -0
@@ -51,7 +51,8 @@ export const BusinessDetailsUI = (props) => {
51
51
  actionStatus,
52
52
  handleUpdatePreorderConfigs,
53
53
  handleUpdateSpoonityKey,
54
- spoonityKeyState
54
+ spoonityKeyState,
55
+ siteState
55
56
  } = props
56
57
 
57
58
  const history = useHistory()
@@ -185,6 +186,7 @@ export const BusinessDetailsUI = (props) => {
185
186
  handleDeleteBusiness={handleDeleteBusiness}
186
187
  extraOpen={extraOpen}
187
188
  spoonityConfig={spoonityConfig}
189
+ siteState={siteState}
188
190
  />
189
191
  )}
190
192
  {extraOpen && (
@@ -316,6 +318,7 @@ export const BusinessDetailsUI = (props) => {
316
318
  <BusinessSalesChannel
317
319
  business={businessState?.business}
318
320
  setIsExtendExtraOpen={setIsExtendExtraOpen}
321
+ siteState={siteState}
319
322
  />
320
323
  )}
321
324
  {selectedItem === 'layout' && (
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage, BusinessDeviceDetail as BusinessDeviceDetailController } from 'ordering-components-admin-external'
3
- import { ThreeDots, ArrowsAngleContract, ArrowsAngleExpand } from 'react-bootstrap-icons'
3
+ import { ThreeDots, ArrowsAngleContract, ArrowsAngleExpand, PersonFill } from 'react-bootstrap-icons'
4
4
  import { Button, IconButton, DefaultSelect, Input } from '../../../styles'
5
5
  import { Select } from '../../../styles/Select/FirstSelect'
6
6
  import { useTheme } from 'styled-components'
@@ -34,7 +34,9 @@ const BusinessDeviceDetailUI = (props) => {
34
34
 
35
35
  const [isExpand, setIsExpand] = useState(false)
36
36
  const [businessOptions, setBusinessOptions] = useState(null)
37
- const [searchValue, setSearchValue] = useState('')
37
+ const [ownerOptions, setOwnerOptions] = useState(null)
38
+ const [businessSearchVal, setBusinessSearchVal] = useState('')
39
+ const [userSearchVal, setUserSearchVal] = useState('')
38
40
  const [alertState, setAlertState] = useState({ open: false, content: [] })
39
41
 
40
42
  const moreOptions = [
@@ -72,13 +74,28 @@ const BusinessDeviceDetailUI = (props) => {
72
74
  if (businessList?.loading) return
73
75
 
74
76
  const options = businessList?.businesses
75
- .filter(option => option?.name.toLocaleLowerCase().includes(searchValue.toLocaleLowerCase()))
77
+ .filter(option => option?.name.toLocaleLowerCase().includes(businessSearchVal.toLocaleLowerCase()))
76
78
  .map(business => ({
77
79
  value: business?.id,
78
80
  content: <Option><Logo src={business?.logo || theme.images?.dummies?.businessLogo} />{business?.name}</Option>
79
81
  }))
80
82
  setBusinessOptions(options)
81
- }, [searchValue, businessList])
83
+ }, [businessSearchVal, businessList])
84
+
85
+ useEffect(() => {
86
+ if (!businessList?.loading && (formState?.changes?.business_id || selectedDevice?.business_id)) {
87
+ const owners = businessList?.businesses.find(business => business.id === (formState?.changes?.business_id || selectedDevice?.business_id))?.owners
88
+ if (owners?.length > 0) {
89
+ const options = owners
90
+ .filter(option => option?.name.toLocaleLowerCase().includes(userSearchVal.toLocaleLowerCase()))
91
+ .map(user => ({
92
+ value: user?.id,
93
+ content: <Option>{user?.photo ? <Logo src={user?.photo} /> : <PersonFill />}{user?.name} {user?.lastname}</Option>
94
+ }))
95
+ setOwnerOptions(options)
96
+ }
97
+ }
98
+ }, [userSearchVal, selectedDevice, formState?.changes?.business_id, businessList])
82
99
 
83
100
  useEffect(() => {
84
101
  if (formState?.result?.error) {
@@ -137,11 +154,33 @@ const BusinessDeviceDetailUI = (props) => {
137
154
  isShowSearchBar
138
155
  searchBarIsCustomLayout
139
156
  searchBarIsNotLazyLoad
140
- searchValue={searchValue}
141
- handleChangeSearch={(val) => setSearchValue(val)}
157
+ searchValue={businessSearchVal}
158
+ handleChangeSearch={(val) => setBusinessSearchVal(val)}
142
159
  />
143
160
  )}
144
161
  </SelectWrapper>
162
+ {(formState?.changes?.business_id || selectedDevice?.business_id) && (
163
+ <SelectWrapper>
164
+ <label>{t('BUSINESS_OWNER', 'Business owner')}</label>
165
+ {businessList?.loading ? (
166
+ <Skeleton height={44} />
167
+ ) : (
168
+ <Select
169
+ options={ownerOptions}
170
+ className='select'
171
+ defaultValue={formState?.changes?.user_id ?? selectedDevice?.user_id}
172
+ placeholder={t('SELECT_OPTION', 'Select an option')}
173
+ onChange={(value) => handleChangeFormState({ user_id: value })}
174
+ isShowSearchBar
175
+ searchBarIsCustomLayout
176
+ searchBarIsNotLazyLoad
177
+ searchValue={userSearchVal}
178
+ handleChangeSearch={(val) => setUserSearchVal(val)}
179
+ />
180
+ )}
181
+ </SelectWrapper>
182
+ )}
183
+
145
184
  {selectedDevice && (
146
185
  <FormControl>
147
186
  <label>{t('DEVICE_CODE', 'Device Code')}</label>
@@ -177,7 +216,7 @@ export const BusinessDeviceDetail = (props) => {
177
216
  const businessDeviceDetailProps = {
178
217
  ...props,
179
218
  UIComponent: BusinessDeviceDetailUI,
180
- propsToFetch: ['id', 'name', 'logo']
219
+ propsToFetch: ['id', 'name', 'logo', 'owners']
181
220
  }
182
221
  return <BusinessDeviceDetailController {...businessDeviceDetailProps} />
183
222
  }
@@ -114,6 +114,7 @@ export const SelectWrapper = styled.div`
114
114
  color: ${props => props.theme.colors.secundaryContrast};
115
115
  }
116
116
  .list {
117
+ width: 100%;
117
118
  background-color: ${props => props.theme.colors.secundary};
118
119
  border: none;
119
120
 
@@ -145,6 +146,16 @@ export const Option = styled.div`
145
146
  font-size: 14px;
146
147
  line-height: 24px;
147
148
  color: ${props => props.theme.colors.secundaryContrast};
149
+ word-break: break-all;
150
+ svg {
151
+ min-width: 25px;
152
+ height: 25px;
153
+ margin-right: 15px;
154
+ ${props => props.theme.rtl && css`
155
+ margin-left: 15px;
156
+ margin-right: 0;
157
+ `}
158
+ }
148
159
  `
149
160
 
150
161
  export const Logo = styled.img`
@@ -74,7 +74,8 @@ const BusinessProductsListingUI = (props) => {
74
74
  setFees,
75
75
  getBusiness,
76
76
  businessTypes,
77
- setBusinessTypes
77
+ setBusinessTypes,
78
+ siteState
78
79
  } = props
79
80
 
80
81
  const history = useHistory()
@@ -210,7 +211,10 @@ const BusinessProductsListingUI = (props) => {
210
211
  }
211
212
 
212
213
  const handleOpenSite = () => {
213
- window.open(`https://${ordering.project}.tryordering.com/store/${businessState?.business?.slug}`, '_blank')
214
+ const url = siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended'
215
+ ? `https://${siteState?.site?.domain}/store/${businessState?.business?.slug}`
216
+ : `https://${ordering.project}.tryordering.com/store/${businessState?.business?.slug}`
217
+ window.open(url, '_blank')
214
218
  }
215
219
 
216
220
  const handleOpenAddBusiness = () => {
@@ -1,5 +1,5 @@
1
- import React, { useState } from 'react'
2
- import { useLanguage } from 'ordering-components-admin-external'
1
+ import React, { useMemo, useState } from 'react'
2
+ import { useLanguage, useApi } from 'ordering-components-admin-external'
3
3
  import { useWindowSize } from '../../../hooks/useWindowSize'
4
4
  import { useTheme } from 'styled-components'
5
5
  import { Button } from '../../../styles'
@@ -17,9 +17,10 @@ import {
17
17
  } from './styles'
18
18
 
19
19
  export const BusinessSalesChannel = (props) => {
20
- const { setIsExtendExtraOpen, business } = props
20
+ const { setIsExtendExtraOpen, business, siteState } = props
21
21
 
22
22
  const [, t] = useLanguage()
23
+ const [ordering] = useApi()
23
24
  const theme = useTheme()
24
25
  const { width } = useWindowSize()
25
26
 
@@ -52,6 +53,10 @@ export const BusinessSalesChannel = (props) => {
52
53
  setSelectedItem(null)
53
54
  }
54
55
 
56
+ const storeUrl = useMemo(() => (siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended' && siteState?.ssl_status !== 'error'
57
+ ? `https://${siteState?.site?.domain}/store/${business?.slug}`
58
+ : `https://${ordering.project}.tryordering.com/store/${business?.slug}`), [siteState, business])
59
+
55
60
  return (
56
61
  <Container>
57
62
  <SalesContainer>
@@ -94,27 +99,28 @@ export const BusinessSalesChannel = (props) => {
94
99
  <>
95
100
  {selectedItem?.key === 'facebook' && (
96
101
  <BusinessSalesFacebook
97
- businessSlug={business.slug}
98
102
  socialItem={selectedItem}
103
+ storeUrl={storeUrl}
99
104
  onClose={handleCloseDetail}
100
105
  />
101
106
  )}
102
107
  {selectedItem?.key === 'tiktok' && (
103
108
  <BusinessSalesTiktok
109
+ storeUrl={storeUrl}
104
110
  socialItem={selectedItem}
105
111
  onClose={handleCloseDetail}
106
112
  />
107
113
  )}
108
114
  {selectedItem?.key === 'instagram' && (
109
115
  <BusinessSalesInstagram
110
- businessSlug={business.slug}
116
+ storeUrl={storeUrl}
111
117
  socialItem={selectedItem}
112
118
  onClose={handleCloseDetail}
113
119
  />
114
120
  )}
115
121
  {selectedItem?.key === 'google_my_business' && (
116
122
  <BusinessSalesGoogle
117
- businessSlug={business.slug}
123
+ storeUrl={storeUrl}
118
124
  socialItem={selectedItem}
119
125
  onClose={handleCloseDetail}
120
126
  />
@@ -8,7 +8,7 @@ import {
8
8
  CopyInputWrapper
9
9
  } from './styles'
10
10
 
11
- export const FacebookProfile = ({ businessSlug }) => {
11
+ export const FacebookProfile = ({ storeUrl }) => {
12
12
  const [, t] = useLanguage()
13
13
  const theme = useTheme()
14
14
 
@@ -20,7 +20,7 @@ export const FacebookProfile = ({ businessSlug }) => {
20
20
  <p>{t('BUSINESS_FACEBOOK_PROFILE_STEP1_DESC', 'Copy this link below. It’s your unique Ordering link for facebook.')}</p>
21
21
  <CopyInputWrapper>
22
22
  <Input
23
- defaultValue='https://yourbusinessname.com/store/storename'
23
+ defaultValue={storeUrl || 'https://yourbusinessname.com/store/storename'}
24
24
  disabled
25
25
  />
26
26
  </CopyInputWrapper>
@@ -4,7 +4,7 @@ import { useWindowSize } from '../../../hooks/useWindowSize'
4
4
  import {
5
5
  Container,
6
6
  Header,
7
- LeftHeader,
7
+ LeftHeader
8
8
  // Tabs,
9
9
  // Tab
10
10
  } from './styles'
@@ -14,7 +14,7 @@ import { FacebookProfile } from './FacebookProfile'
14
14
  import { FacebookPost } from './FacebookPost'
15
15
 
16
16
  export const BusinessSalesFacebook = (props) => {
17
- const { onClose, socialItem, businessSlug } = props
17
+ const { onClose, socialItem, storeUrl } = props
18
18
 
19
19
  const { width } = useWindowSize()
20
20
  // const [, t] = useLanguage()
@@ -74,7 +74,7 @@ export const BusinessSalesFacebook = (props) => {
74
74
  </Tab>
75
75
  ))}
76
76
  </Tabs> */}
77
- {selectedTab === 'profile' && <FacebookProfile businessSlug={businessSlug} />}
77
+ {selectedTab === 'profile' && <FacebookProfile storeUrl={storeUrl} />}
78
78
  {selectedTab === 'post' && <FacebookPost />}
79
79
  </Container>
80
80
  )
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage } from 'ordering-components-admin-external'
3
3
  import { useWindowSize } from '../../../hooks/useWindowSize'
4
4
  import { IconButton, Input } from '../../../styles'
5
- import { XLg, Files } from 'react-bootstrap-icons'
5
+ import { XLg } from 'react-bootstrap-icons'
6
6
  import { useTheme } from 'styled-components'
7
7
  import {
8
8
  Container,
@@ -14,7 +14,7 @@ import {
14
14
  } from './styles'
15
15
 
16
16
  export const BusinessSalesGoogle = (props) => {
17
- const { onClose, socialItem, businessSlug } = props
17
+ const { onClose, socialItem, storeUrl } = props
18
18
 
19
19
  const { width } = useWindowSize()
20
20
  const [, t] = useLanguage()
@@ -77,7 +77,7 @@ export const BusinessSalesGoogle = (props) => {
77
77
  <p>{t('BUSINESS_GOOGLE_STEP3_DESC', 'Scroll down and find Order ahead links and Menu link fields. Paste the link below.')}</p>
78
78
  <CopyInputWrapper isBottom>
79
79
  <Input
80
- defaultValue='https://yourbusinessname.com/store/storename'
80
+ defaultValue={storeUrl || 'https://yourbusinessname.com/store/storename'}
81
81
  disabled
82
82
  />
83
83
  </CopyInputWrapper>
@@ -9,7 +9,7 @@ import {
9
9
  ImageWrapper
10
10
  } from './styles'
11
11
 
12
- export const AdvancedInstagram = (props) => {
12
+ export const AdvancedInstagram = ({ storeUrl }) => {
13
13
  const [, t] = useLanguage()
14
14
  const theme = useTheme()
15
15
 
@@ -40,7 +40,7 @@ export const AdvancedInstagram = (props) => {
40
40
  />
41
41
  <CopyInputWrapper isBottom>
42
42
  <Input
43
- defaultValue='https://yourbusinessname.com/store/storename'
43
+ defaultValue={storeUrl || 'https://yourbusinessname.com/store/storename'}
44
44
  disabled
45
45
  />
46
46
  </CopyInputWrapper>
@@ -8,7 +8,7 @@ import {
8
8
  CopyInputWrapper
9
9
  } from './styles'
10
10
 
11
- export const GeneralInstagram = ({ businessSlug }) => {
11
+ export const GeneralInstagram = ({ storeUrl }) => {
12
12
  const [, t] = useLanguage()
13
13
  const theme = useTheme()
14
14
 
@@ -37,7 +37,7 @@ export const GeneralInstagram = ({ businessSlug }) => {
37
37
  <p>{t('BUSINESS_INSTAGRAM_GENERAL_STEP5_DESC', 'Just add this link to the website field:')}</p>
38
38
  <CopyInputWrapper isBottom>
39
39
  <Input
40
- defaultValue='https://yourbusinessname.com/store/storename'
40
+ defaultValue={storeUrl || 'https://yourbusinessname.com/store/storename'}
41
41
  disabled
42
42
  />
43
43
  </CopyInputWrapper>
@@ -14,7 +14,7 @@ import {
14
14
  } from './styles'
15
15
 
16
16
  export const BusinessSalesInstagram = (props) => {
17
- const { onClose, socialItem, businessSlug } = props
17
+ const { onClose, socialItem, storeUrl } = props
18
18
 
19
19
  const { width } = useWindowSize()
20
20
  const [, t] = useLanguage()
@@ -74,8 +74,8 @@ export const BusinessSalesInstagram = (props) => {
74
74
  </Tab>
75
75
  ))}
76
76
  </Tabs>
77
- {selectedTab === 'general' && <GeneralInstagram businessSlug={businessSlug} />}
78
- {selectedTab === 'advanced' && <AdvancedInstagram businessSlug={businessSlug} />}
77
+ {selectedTab === 'general' && <GeneralInstagram storeUrl={storeUrl} />}
78
+ {selectedTab === 'advanced' && <AdvancedInstagram />}
79
79
  </Container>
80
80
  )
81
81
  }
@@ -38,7 +38,8 @@ export const BusinessSummary = (props) => {
38
38
  handleDuplicateBusiness,
39
39
  handleDeleteBusiness,
40
40
  extraOpen,
41
- spoonityConfig
41
+ spoonityConfig,
42
+ siteState
42
43
  } = props
43
44
  const [, t] = useLanguage()
44
45
  const [{ optimizeImage }] = useUtils()
@@ -56,7 +57,10 @@ export const BusinessSummary = (props) => {
56
57
  }
57
58
 
58
59
  const handleOpenSite = () => {
59
- window.open(`https://${ordering.project}.tryordering.com/store/${businessState?.business?.slug}`, '_blank')
60
+ const url = siteState?.site?.domain && siteState?.site?.ssl_process_status === 'ended'
61
+ ? `https://${siteState?.site?.domain}/store/${businessState?.business?.slug}`
62
+ : `https://${ordering.project}.tryordering.com/store/${businessState?.business?.slug}`
63
+ window.open(url, '_blank')
60
64
  }
61
65
 
62
66
  const itemsExcluded = !!spoonityConfig ? ['publishing', 'personalization'] : ['publishing', 'spoonity_key', 'personalization']
@@ -129,16 +129,15 @@ const CustomersListingUI = (props) => {
129
129
  <VerifiedStatusFilterContainer>
130
130
  <Button
131
131
  color={(orderFilterValue === '' || orderFilterValue === null) ? 'primary' : 'secundaryDark'}
132
- onClick={() => handleChangeOrderFilterValue('')}
132
+ onClick={() => handleChangeOrderFilterValue(null)}
133
133
  >
134
134
  {t('ALL', 'All')}
135
- {(orderFilterValue === '' || orderFilterValue === null) && <CloseIcon />}
136
135
  </Button>
137
136
  {orderList.map((item, i) => (
138
137
  <Button
139
138
  key={i}
140
139
  color={orderFilterValue === item.value ? 'primary' : 'secundaryDark'}
141
- onClick={() => handleChangeOrderFilterValue(item.value)}
140
+ onClick={() => handleChangeOrderFilterValue(prev => prev === item.value ? null : item.value)}
142
141
  >
143
142
  {item.name}
144
143
  {orderFilterValue === item.value && <CloseIcon />}
@@ -3,7 +3,7 @@ import FaCcMastercard from '@meronex/icons/fa/FaCcMastercard'
3
3
  import FaCcVisa from '@meronex/icons/fa/FaCcVisa'
4
4
  import FaCreditCard from '@meronex/icons/fa/FaCreditCard'
5
5
  import moment from 'moment'
6
- import { useLanguage } from 'ordering-components-admin-external'
6
+ import { useLanguage, CODES } from 'ordering-components-admin-external'
7
7
 
8
8
  export const optimizeImage = (url, params, fallback) => {
9
9
  if (!url && fallback) return fallback
@@ -194,6 +194,11 @@ export const getSeconds = (seconds) => {
194
194
  return Math.floor(remain - Math.floor(remain / 60) * 60)
195
195
  }
196
196
 
197
+ export const findExitingCode = (countryCode) => {
198
+ const code = CODES.find(code => code.countryCode === (countryCode || '').toUpperCase())
199
+ return code?.countryCode
200
+ }
201
+
197
202
  /**
198
203
  * Function to check if a number is decimal or not
199
204
  * @param {*} value number to check if decimal or not
@@ -384,6 +389,59 @@ export const reviewCommentList = (type) => {
384
389
  return reviews[type]
385
390
  }
386
391
 
392
+ export const getOrderStatus = (status) => {
393
+ const orderStatus = [
394
+ { key: 0, value: 'Pending Order', slug: 'PENDING_ORDER', percentage: 10 },
395
+ { key: 1, value: 'Completed by admin', slug: 'COMPLETED_BY_ADMIN', percentage: 100 },
396
+ { key: 2, value: 'Reject by admin', slug: 'REJECT_BY_ADMIN', percentage: 0 },
397
+ { key: 3, value: 'Driver arrived by business', slug: 'DRIVER_IN_BUSINESS', percentage: 60 },
398
+ { key: 4, value: 'Preparation Completed', slug: 'PREPARATION_COMPLETED', percentage: 20 },
399
+ { key: 5, value: 'Reject by business', slug: 'REJECT_BY_BUSINESS', percentage: 0 },
400
+ { key: 6, value: 'Reject by driver', slug: 'REJECT_BY_DRIVER', percentage: 0 },
401
+ { key: 7, value: 'Accepted by business', slug: 'ACCEPTED_BY_BUSINESS', percentage: 15 },
402
+ { key: 8, value: 'Accepted by driver', slug: 'ACCEPTED_BY_DRIVER', percentage: 40 },
403
+ { key: 9, value: 'Pick up completed by driver', slug: 'PICK_UP_COMPLETED_BY_DRIVER', percentage: 70 },
404
+ { key: 10, value: 'Pick up Failed by driver', slug: 'PICK_UP_FAILED_BY_DRIVER', percentage: 0 },
405
+ { key: 11, value: 'Delivery completed by driver', slug: 'DELIVERY_COMPLETED_BY_DRIVER', percentage: 100 },
406
+ { key: 12, value: 'Delivery Failed by driver', slug: 'DELIVERY_FAILED_BY_DRIVER', percentage: 0 },
407
+ { key: 13, value: 'Preorder', slug: 'PREORDER', percentage: 0 },
408
+ { key: 14, value: 'Order not ready', slug: 'ORDER_NOT_READY', percentage: 15 },
409
+ { key: 15, value: 'Pickup completed by customer', slug: 'PICKUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
410
+ { key: 16, value: 'Canceled by customer', slug: 'CANCELED_BY_CUSTOMER', percentage: 0 },
411
+ { key: 17, value: 'Not picked by customer', slug: 'NOT_PICKED_BY_CUSTOMER', percentage: 0 },
412
+ { key: 18, value: 'Driver almost arrived to business', slug: 'DRIVER_ALMOST_ARRIVED_TO_BUSINESS', percentage: 50 },
413
+ { key: 19, value: 'Driver almost arrived to customer', slug: 'DRIVER_ALMOST_ARRIVED_TO_CUSTOMER', percentage: 90 },
414
+ { key: 20, value: 'Customer almost arrived to business', slug: 'CUSTOMER_ALMOST_ARRIVED_TO_BUSINESS', percentage: 90 },
415
+ { key: 21, value: 'Customer arrived to business', slug: 'CUSTOMER_ARRIVED_TO_BUSINESS', percentage: 90 },
416
+ { key: 22, value: 'Looking for driver', slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 30 },
417
+ { key: 23, value: 'Driver on way', slug: 'ORDER_DRIVER_ON_WAY', percentage: 80 }
418
+ ]
419
+
420
+ const objectStatus = orderStatus.find((o) => o.key === status)
421
+ return objectStatus && objectStatus
422
+ }
423
+
424
+ export const getOrderStatuPickUp = (status) => {
425
+ const orderStatus = [
426
+ { key: 0, value: 'Pending Order', slug: 'PENDING_ORDER', percentage: 10 },
427
+ { key: 1, value: 'Completed by admin', slug: 'COMPLETED_BY_ADMIN', percentage: 100 },
428
+ { key: 2, value: 'Reject by admin', slug: 'REJECT_BY_ADMIN', percentage: 0 },
429
+ { key: 4, value: 'Preparation Completed', slug: 'PREPARATION_COMPLETED', percentage: 50 },
430
+ { key: 5, value: 'Reject by business', slug: 'REJECT_BY_BUSINESS', percentage: 0 },
431
+ { key: 7, value: 'Accepted by business', slug: 'ACCEPTED_BY_BUSINESS', percentage: 30 },
432
+ { key: 13, value: 'Preorder', slug: 'PREORDER', percentage: 0 },
433
+ { key: 14, value: 'Order not ready', slug: 'ORDER_NOT_READY', percentage: 30 },
434
+ { key: 15, value: 'Pickup completed by customer', slug: 'PICKUP_COMPLETED_BY_CUSTOMER', percentage: 100 },
435
+ { key: 16, value: 'Canceled by customer', slug: 'CANCELED_BY_CUSTOMER', percentage: 0 },
436
+ { key: 17, value: 'Not picked by customer', slug: 'NOT_PICKED_BY_CUSTOMER', percentage: 0 },
437
+ { key: 20, value: 'Customer almost arrived to business', slug: 'CUSTOMER_ALMOST_ARRIVED_TO_BUSINESS', percentage: 70 },
438
+ { key: 21, value: 'Customer arrived to business', slug: 'CUSTOMER_ARRIVED_TO_BUSINESS', percentage: 90 },
439
+ ]
440
+
441
+ const objectStatus = orderStatus.find((o) => o.key === status)
442
+ return objectStatus && objectStatus
443
+ }
444
+
387
445
  /**
388
446
  * function to manage order reject comment list
389
447
  * @param {string} param0 type of orders to return
package/template/app.js CHANGED
@@ -5,9 +5,18 @@ import {
5
5
  Route,
6
6
  Link,
7
7
  Redirect,
8
- useLocation
8
+ useLocation,
9
+ useHistory
9
10
  } from 'react-router-dom'
10
- import { useSession, useOrder, useLanguage, useConfig, GoogleTagManager, CannyIdentification } from 'ordering-components-admin-external'
11
+ import {
12
+ useSession,
13
+ useOrder,
14
+ useLanguage,
15
+ useConfig,
16
+ GoogleTagManager,
17
+ CannyIdentification,
18
+ useEvent
19
+ } from 'ordering-components-admin-external'
11
20
  import { NotNetworkConnectivity } from '../src/components/NotNetworkConnectivity'
12
21
  import { useOnlineStatus } from '../src/hooks/useOnlineStatus'
13
22
  import { useWindowSize } from '../src/hooks/useWindowSize'
@@ -77,10 +86,15 @@ import { OrderingWidgets } from './pages/OrderingWidgets'
77
86
  import { BusinessDevicesList } from './pages/BusinessDevicesList'
78
87
 
79
88
  export const App = () => {
89
+ const history = useHistory()
90
+ const [events] = useEvent()
80
91
  const [{ auth, loading, user }] = useSession()
81
92
  const [orderStatus] = useOrder()
82
- const [{ configs }] = useConfig()
93
+ const [{ configs, loading: configLoading }] = useConfig()
83
94
  const [loaded, setLoaded] = useState(false)
95
+ const [oneSignalState, setOneSignalState] = useState({
96
+ notification_app: settings.notification_app
97
+ })
84
98
  const [, t] = useLanguage()
85
99
  const onlineStatus = useOnlineStatus()
86
100
  const { height } = useWindowSize()
@@ -115,6 +129,64 @@ export const App = () => {
115
129
  }
116
130
  }, [height])
117
131
 
132
+ const oneSignalSetup = () => {
133
+ if (!configs?.onesignal_dashboardweb_id?.value) {
134
+ setOneSignalState({
135
+ notification_app: settings.notification_app
136
+ })
137
+ return
138
+ }
139
+ const OneSignal = window.OneSignal || []
140
+ const initConfig = {
141
+ appId: configs?.onesignal_dashboardweb_id?.value,
142
+ // allowLocalhostAsSecureOrigin: true,
143
+ notificationClickHandlerAction: 'navigate'
144
+ }
145
+
146
+ OneSignal.push(function () {
147
+ OneSignal.SERVICE_WORKER_PARAM = { scope: '/push/onesignal/' }
148
+ OneSignal.SERVICE_WORKER_PATH = 'push/onesignal/OneSignalSDKWorker.js'
149
+ OneSignal.SERVICE_WORKER_UPDATER_PATH = 'push/onesignal/OneSignalSDKWorker.js'
150
+ OneSignal.init(initConfig)
151
+
152
+ const onNotificationClicked = function (data) {
153
+ if (data?.data?.order_uuid) {
154
+ history.push(`/orders?id=${data?.data?.order_uuid}`)
155
+ }
156
+ }
157
+ const handler = function (data) {
158
+ onNotificationClicked(data)
159
+ OneSignal.addListenerForNotificationOpened(handler)
160
+ }
161
+ OneSignal.addListenerForNotificationOpened(handler)
162
+
163
+ OneSignal.on('subscriptionChange', function (isSubscribed) {
164
+ if (isSubscribed) {
165
+ OneSignal.getUserId((userId) => {
166
+ const data = {
167
+ ...oneSignalState,
168
+ notification_token: userId
169
+ }
170
+ setOneSignalState(data)
171
+ })
172
+ }
173
+ })
174
+
175
+ OneSignal.getUserId((userId) => {
176
+ const data = {
177
+ ...oneSignalState,
178
+ notification_token: userId
179
+ }
180
+ setOneSignalState(data)
181
+ })
182
+ })
183
+ }
184
+
185
+ useEffect(() => {
186
+ if (configLoading) return
187
+ oneSignalSetup()
188
+ }, [configLoading, events])
189
+
118
190
  return (
119
191
  <>
120
192
  <ListenPageChanges />
@@ -160,6 +232,7 @@ export const App = () => {
160
232
  <Login
161
233
  useLoginByEmail
162
234
  elementLinkToForgotPassword={<Link to='/password/forgot'>{t('RESET_PASSWORD', 'Reset password')}</Link>}
235
+ notificationState={oneSignalState}
163
236
  />
164
237
  )
165
238
  : (
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "app_id": "ordering-admin-react",
3
+ "notification_app": "dashboardweb",
3
4
  "app_name": "Ordering Admin",
4
5
  "billing_url": "https://billing-dashboard.tryordering.com",
5
6
  "api": {