ordering-ui-admin-external 1.23.5 → 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 (96) hide show
  1. package/_bundles/{ordering-ui-admin.a1255b2c1a2d4b87080d.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/OrderingWebsite/SelectBusiness.js +59 -0
  18. package/_modules/components/MyProducts/OrderingWebsite/SelectFranchise.js +59 -0
  19. package/_modules/components/MyProducts/OrderingWebsite/index.js +21 -29
  20. package/_modules/components/MyProducts/OrderingWebsite/styles.js +1 -1
  21. package/_modules/components/MyProducts/UploadAudio/index.js +170 -0
  22. package/_modules/components/MyProducts/UploadAudio/styles.js +30 -0
  23. package/_modules/components/MyProducts/index.js +8 -1
  24. package/_modules/components/Orders/DeliveriesLocation/index.js +1 -0
  25. package/_modules/components/Orders/OrderBill/index.js +4 -3
  26. package/_modules/components/Orders/OrderContactInformation/index.js +14 -12
  27. package/_modules/components/Orders/OrderDetails/index.js +6 -131
  28. package/_modules/components/Orders/OrdersTable/index.js +2 -2
  29. package/_modules/components/Settings/NotificationSetting/index.js +1 -1
  30. package/_modules/components/Settings/SettingsList/index.js +1 -1
  31. package/_modules/components/Settings/SettingsList/styles.js +2 -2
  32. package/_modules/components/SidebarMenu/index.js +22 -22
  33. package/_modules/components/Stores/BusinessDetails/index.js +2 -1
  34. package/_modules/components/Stores/BusinessDeviceDetail/index.js +66 -16
  35. package/_modules/components/Stores/BusinessDeviceDetail/styles.js +7 -5
  36. package/_modules/components/Stores/BusinessSalesChannel/index.js +13 -4
  37. package/_modules/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
  38. package/_modules/components/Stores/BusinessSalesFacebook/index.js +2 -2
  39. package/_modules/components/Stores/BusinessSalesGoogle/index.js +2 -2
  40. package/_modules/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +3 -2
  41. package/_modules/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
  42. package/_modules/components/Stores/BusinessSalesInstagram/index.js +3 -5
  43. package/_modules/components/Users/CustomersListing/index.js +5 -3
  44. package/_modules/utils/index.js +203 -2
  45. package/index-template.js +1 -1
  46. package/index.html +1 -0
  47. package/package.json +2 -2
  48. package/public/push/onesignal/OneSignalSDKUpdaterWorker.js +1 -0
  49. package/public/push/onesignal/OneSignalSDKWorker.js +1 -0
  50. package/src/components/CartRecovery/RecoveryActionAdd/index.js +355 -0
  51. package/src/components/CartRecovery/RecoveryGeneral/index.js +23 -4
  52. package/src/components/Delivery/DriversCompaniesList/styles.js +1 -1
  53. package/src/components/Delivery/DriversCompaniesListing/index.js +29 -12
  54. package/src/components/Delivery/DriversCompaniesListing/styles.js +1 -1
  55. package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/index.js +120 -0
  56. package/src/components/Delivery/DriversCompanyAddForm/GeneralForm/styles.js +32 -0
  57. package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/index.js +29 -0
  58. package/src/components/Delivery/DriversCompanyAddForm/ScheduleForm/styles.js +11 -0
  59. package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/index.js +69 -0
  60. package/src/components/Delivery/DriversCompanyAddForm/WebhooksForm/styles.js +24 -0
  61. package/src/components/Delivery/DriversCompanyAddForm/index.js +121 -0
  62. package/src/components/Delivery/DriversCompanyAddForm/styles.js +39 -0
  63. package/src/components/MyProducts/AdvancedSettings/index.js +35 -36
  64. package/src/components/MyProducts/AdvancedSettings/styles.js +3 -11
  65. package/src/components/MyProducts/OrderingWebsite/SelectBusiness.js +47 -0
  66. package/src/components/MyProducts/OrderingWebsite/SelectFranchise.js +47 -0
  67. package/src/components/MyProducts/OrderingWebsite/index.js +20 -30
  68. package/src/components/MyProducts/OrderingWebsite/styles.js +0 -4
  69. package/src/components/MyProducts/UploadAudio/index.js +168 -0
  70. package/src/components/MyProducts/UploadAudio/styles.js +120 -0
  71. package/src/components/MyProducts/index.js +3 -1
  72. package/src/components/Orders/DeliveriesLocation/index.js +1 -0
  73. package/src/components/Orders/OrderBill/index.js +9 -6
  74. package/src/components/Orders/OrderContactInformation/index.js +5 -1
  75. package/src/components/Orders/OrderDetails/index.js +7 -35
  76. package/src/components/Orders/OrdersTable/index.js +3 -1
  77. package/src/components/Settings/NotificationSetting/index.js +2 -0
  78. package/src/components/Settings/SettingsList/index.js +53 -53
  79. package/src/components/Settings/SettingsList/styles.js +2 -1
  80. package/src/components/Settings/SettingsSelectUI/index.js +1 -1
  81. package/src/components/SidebarMenu/index.js +1 -0
  82. package/src/components/Stores/BusinessDetails/index.js +1 -0
  83. package/src/components/Stores/BusinessDeviceDetail/index.js +46 -7
  84. package/src/components/Stores/BusinessDeviceDetail/styles.js +11 -0
  85. package/src/components/Stores/BusinessSalesChannel/index.js +12 -6
  86. package/src/components/Stores/BusinessSalesFacebook/FacebookProfile.js +2 -2
  87. package/src/components/Stores/BusinessSalesFacebook/index.js +3 -3
  88. package/src/components/Stores/BusinessSalesGoogle/index.js +3 -3
  89. package/src/components/Stores/BusinessSalesInstagram/AdvancedInstagram.js +2 -2
  90. package/src/components/Stores/BusinessSalesInstagram/GeneralInstagram.js +2 -2
  91. package/src/components/Stores/BusinessSalesInstagram/index.js +3 -3
  92. package/src/components/Users/CustomersListing/index.js +2 -3
  93. package/src/utils/index.js +53 -0
  94. package/template/app.js +76 -3
  95. package/template/config.json +1 -0
  96. /package/_bundles/{ordering-ui-admin.a1255b2c1a2d4b87080d.js.LICENSE.txt → ordering-ui-admin.0c354f3e7da49f56465b.js.LICENSE.txt} +0 -0
@@ -3,21 +3,19 @@ import { useLanguage } from 'ordering-components-admin-external'
3
3
  import { SettingComponent } from './SettingComponent'
4
4
  import { Button, Input } from '../../../styles'
5
5
  import { ImageBox } from './ImageBox'
6
- import { Alert } from '../../Shared'
6
+ import { Alert, Modal } from '../../Shared'
7
7
  import { OrderType } from './OrderType'
8
8
  import { FontStyleGroup } from './FontStyleGroup'
9
9
 
10
10
  import {
11
11
  Container,
12
12
  BoxLayout,
13
- HomePageWrapper,
14
- ShadowWrapper,
15
13
  HeadingWrapper,
16
14
  ImageGroup,
17
15
  FormControl,
18
16
  ButtonWrapper
19
17
  } from './styles'
20
- import { ButtonShadow } from './ButtonShadow'
18
+ import { UploadAudio } from '../UploadAudio'
21
19
 
22
20
  export const AdvancedSettings = (props) => {
23
21
  const {
@@ -33,9 +31,7 @@ export const AdvancedSettings = (props) => {
33
31
  const [alertState, setAlertState] = useState({ open: false, content: [] })
34
32
  const themeValuesRef = useRef({})
35
33
 
36
- const homepageViewList = [
37
- { key: 'homepage_header', name: t('HOMEPAGE_HEADER', 'Homepage Header'), type: 'hidden', path: 'homepage_view.components.homepage_header.hidden' }
38
- ]
34
+ const [isOpenSound, setIsOpenSound] = useState(false)
39
35
 
40
36
  const headerList = [
41
37
  { name: t('BACKGROUND_COLOR', 'Background color'), type: 'color', path: 'header.components.style.backgroundColor' },
@@ -46,12 +42,9 @@ export const AdvancedSettings = (props) => {
46
42
  const businessListing = [
47
43
  { name: '', type: 'hidden', path: 'business_listing_view.hidden' },
48
44
  { name: t('BUSINESS_LISTING_IMAGE', 'Business listing image'), type: 'image', path: 'business_listing_view.components.business_hero.components.image' },
49
- { name: t('PREVIOUS_ORDERS_BLOCK', 'Previous orders block'), type: 'hidden', path: 'business_listing_view.components.previous_orders_block.hidden' },
50
45
  { name: t('HIGHEST_RATED_BUSINESS_BLOCK', 'Highest rated business block'), type: 'hidden', path: 'business_listing_view.components.highest_rated_business_block.hidden' },
51
46
  { name: t('CATEGORIES_BLOCK', 'Categories block'), type: 'hidden', path: 'business_listing_view.components.categories.hidden' },
52
47
  { 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
- { name: t('SEARCH_BOX', 'Search box'), type: 'hidden', path: 'business_listing_view.components.search.hidden' },
54
- { name: t('FILTER_ICON', 'Filter icon'), type: 'hidden', path: 'business_listing_view.components.filter.hidden' },
55
48
  { name: t('CITIES_DROPDOWN', 'Cities dropdown'), type: 'hidden', path: 'business_listing_view.components.cities.hidden' }
56
49
  ]
57
50
 
@@ -65,20 +58,17 @@ export const AdvancedSettings = (props) => {
65
58
  { name: t('FAVORITE_BUTTON', 'Favorite button'), type: 'hidden', path: 'business_listing_view.components.business.components.favorite.hidden' },
66
59
  { name: t('OFFER_BADGE', 'Offer badge'), type: 'hidden', path: 'business_listing_view.components.business.components.offer.hidden' },
67
60
  { name: t('OFFER_BADGE_POSITION', 'Offer badge position'), type: 'position', path: 'business_listing_view.components.business.components.offer.position' },
68
- { name: t('CATEGORIES', 'Categories'), type: 'hidden', path: 'business_listing_view.components.business.components.categories.hidden' },
69
61
  { name: t('FEATURED_BADGE', 'Featured badge'), type: 'hidden', path: 'business_listing_view.components.business.components.featured_badge.hidden' }
70
62
  ]
71
63
 
72
64
  const businessPageList = [
73
65
  { name: t('DEFAULT_BACKGROUND_COLOR', 'Default Background color'), type: 'color', path: 'business_view.components.style.backgroundColor' },
74
66
  { name: t('PRODUCTS_FROM_PREVIOUS_ORDERS_BLOCK', 'Products from previous orders block'), type: 'hidden', path: 'business_view.components.products_ordered.hidden' },
75
- { name: t('NEAR_BUSINESS_BLOCK', 'Near business block'), type: 'hidden', path: 'business_view.components.near_business.hidden' },
76
- { name: t('ORDER_VIEW_BUTTON', 'Order view button'), type: 'hidden', path: 'business_view.components.order_view_button.hidden' }
67
+ { name: t('NEAR_BUSINESS_BLOCK', 'Near business block'), type: 'hidden', path: 'business_view.components.near_business.hidden' }
77
68
  ]
78
69
 
79
70
  const businessInfoList = [
80
71
  { name: t('DESCRIPTION', 'Description'), type: 'hidden', path: 'business_view.components.information.components.description.hidden' },
81
- { name: t('ABOUT', 'About'), type: 'hidden', path: 'business_view.components.information.components.about.hidden' },
82
72
  { name: t('VIDEOS', 'Videos'), type: 'hidden', path: 'business_view.components.information.components.videos.hidden' },
83
73
  { name: t('MENU_LIST_DELIVERY_TIME', 'Delivery time'), type: 'hidden', path: 'business_view.components.information.components.delivery_time.hidden' },
84
74
  { name: t('PICKUP_TIME', 'Pickup time'), type: 'hidden', path: 'business_view.components.information.components.pickup_time.hidden' },
@@ -206,7 +196,7 @@ export const AdvancedSettings = (props) => {
206
196
  return (
207
197
  <>
208
198
  <Container>
209
- {isApp ? (
199
+ {isApp && (
210
200
  <BoxLayout>
211
201
  <h1>{t('CUSTOMER_APP_ADVANCED_SETTINGS', 'Customer App Advanced Settings')}</h1>
212
202
  <h2>{t('HOMEPAGE', 'Homepage')}</h2>
@@ -219,21 +209,11 @@ export const AdvancedSettings = (props) => {
219
209
  handleChangePhoto={handleUpdateThemeValue}
220
210
  />
221
211
  </BoxLayout>
222
- ) : (
223
- <BoxLayout>
224
- <h1>{t('WEBSITE_ADVANCED_SETTINGS', 'Website Advanced Settings')}</h1>
225
- <HomePageWrapper>
226
- <h2>{t('HOMEPAGE', 'Homepage')}</h2>
227
- <SettingComponent
228
- settingList={homepageViewList}
229
- handleUpdateThemeValue={handleUpdateThemeValue}
230
- advancedValues={themeValuesRef?.current}
231
- themeId={themesList?.themes?.[0]?.id}
232
- />
233
- </HomePageWrapper>
234
- </BoxLayout>
235
212
  )}
236
213
  <BoxLayout>
214
+ {!isApp && (
215
+ <h1>{t('WEBSITE_ADVANCED_SETTINGS', 'Website Advanced Settings')}</h1>
216
+ )}
237
217
  <h2>{t('BUTTONS', 'Buttons')}</h2>
238
218
  <SettingComponent
239
219
  settingList={buttonList}
@@ -242,14 +222,15 @@ export const AdvancedSettings = (props) => {
242
222
  themeStructure={themeStructure}
243
223
  themeId={themesList?.themes?.[0]?.id}
244
224
  />
245
- <h3>{t('SHAPE', 'Shape')}</h3>
246
- <ShadowWrapper>
247
- <ButtonShadow
248
- initialValues={themeValuesRef?.current?.general?.components?.buttons?.shadow?.components}
249
- handleUpdateThemeValue={handleUpdateThemeValue}
250
- path='general.components.buttons.shadow.components'
251
- />
252
- </ShadowWrapper>
225
+ <Button
226
+ color='primary'
227
+ outline
228
+ borderRadius='8px'
229
+ onClick={() => setIsOpenSound(true)}
230
+ className='custom'
231
+ >
232
+ {t('CUSTOM_SOUNDS', 'Custom sounds')}
233
+ </Button>
253
234
  </BoxLayout>
254
235
  <BoxLayout>
255
236
  <h2>{t('TIPOGRAPHY', 'Tipography')}</h2>
@@ -399,6 +380,8 @@ export const AdvancedSettings = (props) => {
399
380
  themeStructure={themeStructure}
400
381
  themeId={themesList?.themes?.[0]?.id}
401
382
  />
383
+ </BoxLayout>
384
+ <BoxLayout>
402
385
  <h3>{t('CONFIRMATION_PAGE', 'Confirmation page')}</h3>
403
386
  <h3>{t('ORDER_BLOCK', 'Order block')}</h3>
404
387
  <SettingComponent
@@ -408,6 +391,8 @@ export const AdvancedSettings = (props) => {
408
391
  themeStructure={themeStructure}
409
392
  themeId={themesList?.themes?.[0]?.id}
410
393
  />
394
+ </BoxLayout>
395
+ <BoxLayout>
411
396
  <h3>{t('POPUP_ADDRESS', 'Popup: Address')}</h3>
412
397
  <SettingComponent
413
398
  settingList={popupAddressList}
@@ -416,6 +401,8 @@ export const AdvancedSettings = (props) => {
416
401
  themeStructure={themeStructure}
417
402
  themeId={themesList?.themes?.[0]?.id}
418
403
  />
404
+ </BoxLayout>
405
+ <BoxLayout>
419
406
  <h3>{t('MY_ACCOUNT_PAGE', 'My account page')}</h3>
420
407
  <SettingComponent
421
408
  settingList={myAccountList}
@@ -424,6 +411,8 @@ export const AdvancedSettings = (props) => {
424
411
  themeStructure={themeStructure}
425
412
  themeId={themesList?.themes?.[0]?.id}
426
413
  />
414
+ </BoxLayout>
415
+ <BoxLayout>
427
416
  <h3>{t('MY_ORDERS', 'My orders')}</h3>
428
417
  <h3>{t('ACTIVE_ORDERS_BLOCK', 'Active Orders Block')}</h3>
429
418
  <SettingComponent
@@ -519,6 +508,16 @@ export const AdvancedSettings = (props) => {
519
508
  </Button>
520
509
  </ButtonWrapper>
521
510
  </Container>
511
+ <Modal
512
+ width='769px'
513
+ padding='25px'
514
+ open={isOpenSound}
515
+ onClose={() => setIsOpenSound(false)}
516
+ >
517
+ <UploadAudio
518
+ onClose={() => setIsOpenSound(false)}
519
+ />
520
+ </Modal>
522
521
  <Alert
523
522
  title={t('ORDERING', 'Ordering')}
524
523
  content={alertState.content}
@@ -27,10 +27,11 @@ export const BoxLayout = styled.div`
27
27
  margin-top: 0px;
28
28
  margin-bottom: 20px;
29
29
  }
30
+ button.custom {
31
+ height: 44px;
32
+ }
30
33
  `
31
34
 
32
- export const HomePageWrapper = styled.div``
33
-
34
35
  export const FormControlWithCheck = styled.div`
35
36
  > p {
36
37
  font-weight: 400;
@@ -69,15 +70,6 @@ export const HideCheckWrapper = styled.div`
69
70
  `}
70
71
  `
71
72
 
72
- export const ShadowWrapper = styled.div`
73
- display: flex;
74
- flex-direction: column;
75
-
76
- @media (min-width: 576px) {
77
- flex-direction: row;
78
- }
79
- `
80
-
81
73
  export const InnerShadowWrapper = styled.div``
82
74
 
83
75
  export const DropShadowWrapper = styled.div`
@@ -0,0 +1,47 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useLanguage, useUtils } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { DefaultSelect as Select } from '../../../styles'
5
+ import { SelectWrapper, Option } from './styles'
6
+
7
+ export const SelectBusiness = (props) => {
8
+ const {
9
+ businessesList,
10
+ defaultValue,
11
+ onChange
12
+ } = props
13
+
14
+ const theme = useTheme()
15
+ const [, t] = useLanguage()
16
+ const [{ optimizeImage }] = useUtils()
17
+ const [businessOptions, setBusinessOptions] = useState([])
18
+
19
+ useEffect(() => {
20
+ if (businessesList?.loading || !businessesList?.businesses) return
21
+ const _businessOptions = []
22
+ businessesList.businesses.map(business => {
23
+ _businessOptions.push({
24
+ value: business?.slug,
25
+ content: (
26
+ <Option>
27
+ <img src={optimizeImage(business?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} alt='' />
28
+ <span>{business?.name}</span>
29
+ </Option>
30
+ )
31
+ })
32
+ })
33
+ setBusinessOptions(_businessOptions)
34
+ }, [businessesList])
35
+
36
+ return (
37
+ <SelectWrapper>
38
+ <Select
39
+ placeholder={<Option>{t('SELECT_BUSINESS', 'Select business')}</Option>}
40
+ defaultValue={defaultValue}
41
+ options={businessOptions}
42
+ onChange={onChange}
43
+ optionInnerMaxHeight='300px'
44
+ />
45
+ </SelectWrapper>
46
+ )
47
+ }
@@ -0,0 +1,47 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useLanguage, useUtils } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { DefaultSelect as Select } from '../../../styles'
5
+ import { SelectWrapper, Option } from './styles'
6
+
7
+ export const SelectFranchise = (props) => {
8
+ const {
9
+ franchisesList,
10
+ defaultValue,
11
+ onChange
12
+ } = props
13
+
14
+ const theme = useTheme()
15
+ const [, t] = useLanguage()
16
+ const [{ optimizeImage }] = useUtils()
17
+ const [options, setOptions] = useState([])
18
+
19
+ useEffect(() => {
20
+ if (franchisesList?.loading || !franchisesList?.franchises) return
21
+ const _options = []
22
+ franchisesList.franchises.map(franchise => {
23
+ _options.push({
24
+ value: franchise?.id,
25
+ content: (
26
+ <Option>
27
+ <img src={optimizeImage(franchise?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} alt='' />
28
+ <span>{franchise?.name}</span>
29
+ </Option>
30
+ )
31
+ })
32
+ })
33
+ setOptions(_options)
34
+ }, [franchisesList])
35
+
36
+ return (
37
+ <SelectWrapper>
38
+ <Select
39
+ placeholder={<Option>{t('SELECT_FRANCHISE', 'Select a franchise')}</Option>}
40
+ defaultValue={defaultValue}
41
+ options={options}
42
+ onChange={onChange}
43
+ optionInnerMaxHeight='300px'
44
+ />
45
+ </SelectWrapper>
46
+ )
47
+ }
@@ -21,6 +21,8 @@ import Skeleton from 'react-loading-skeleton'
21
21
  import { AdvancedSettings } from '../AdvancedSettings'
22
22
  import { CustomDomain } from '../CustomDomain'
23
23
  import { bytesConverter } from '../../../utils'
24
+ import { SelectBusiness } from './SelectBusiness'
25
+ import { SelectFranchise } from './SelectFranchise'
24
26
  import {
25
27
  Container,
26
28
  HeaderTitleContainer,
@@ -48,7 +50,6 @@ import {
48
50
  HeaderInfoWrapper,
49
51
  InfoContent,
50
52
  RadioItem,
51
- SlugWrapper,
52
53
  CustomeDomainDesc,
53
54
  TitleWrapper,
54
55
  CustomDomainInfo,
@@ -65,7 +66,9 @@ const OrderingWebsiteUI = (props) => {
65
66
  setAdvancedValues,
66
67
  themesList,
67
68
  site,
68
- setSite
69
+ setSite,
70
+ businessesList,
71
+ franchisesList
69
72
  } = props
70
73
 
71
74
  const [, t] = useLanguage()
@@ -86,8 +89,8 @@ const OrderingWebsiteUI = (props) => {
86
89
  const [isCustomDomain, setIsCustomDomain] = useState(false)
87
90
 
88
91
  const settingsList = [
89
- { key: 'basic', name: t('BASIC_SETTINGS', 'Basic Settings') },
90
- { key: 'advanced', name: t('ADVANCED_SETTINGS', 'Advanced Settings') }
92
+ { key: 'basic', name: t('BASIC_SETTINGS', 'Basic Settings') }
93
+ // { key: 'advanced', name: t('ADVANCED_SETTINGS', 'Advanced Settings') }
91
94
  ]
92
95
 
93
96
  const handleClickImage = (type) => {
@@ -337,7 +340,8 @@ const OrderingWebsiteUI = (props) => {
337
340
  {site?.domain && (
338
341
  <>
339
342
  {site?.ssl_status === 'issued' && (
340
- <CustomeDomainDesc>{t('CUSTOM_DOMAIN_STATUS_ISSUED', 'Your domain is now added , please verify the custom domain link above.')}</CustomeDomainDesc>)}
343
+ <CustomeDomainDesc>{t('CUSTOM_DOMAIN_STATUS_ISSUED', 'Your domain is now added , please verify the custom domain link above.')}</CustomeDomainDesc>
344
+ )}
341
345
  {site?.ssl_status === 'pre-issued' && (
342
346
  <CustomeDomainDesc>{t('CUSTOM_DOMAIN_STATUS_PRE_ISSUED', 'Process almost finish, please wait')}</CustomeDomainDesc>
343
347
  )}
@@ -384,18 +388,11 @@ const OrderingWebsiteUI = (props) => {
384
388
  <span>{t('REPORT_HEADER_FRANCHISES', 'Franchise')}</span>
385
389
  </RadioItem>
386
390
  {themeValues?.website_theme?.components?.type === 'franchise' && (
387
- <SlugWrapper>
388
- <label>{t('FRANCHISE_SLUG', 'Franchise slug')}</label>
389
- <Input
390
- name='name'
391
- placeholder={t('SLUG', 'Slug')}
392
- value={themeValues?.website_theme?.components?.franchise_slug || ''}
393
- onChange={e => handleChangeValue(e.target.value, 'website_theme', 'franchise_slug')}
394
- onKeyPress={e => {
395
- if (e.which === 32) { e.preventDefault() }
396
- }}
397
- />
398
- </SlugWrapper>
391
+ <SelectFranchise
392
+ defaultValue={themeValues?.website_theme?.components?.franchise_slug}
393
+ franchisesList={franchisesList}
394
+ onChange={value => handleChangeValue(value, 'website_theme', 'franchise_slug')}
395
+ />
399
396
  )}
400
397
 
401
398
  <RadioItem
@@ -405,18 +402,11 @@ const OrderingWebsiteUI = (props) => {
405
402
  <span>{t('SINGLE_STORE', 'Single Store')}</span>
406
403
  </RadioItem>
407
404
  {themeValues?.website_theme?.components?.type === 'single_store' && (
408
- <SlugWrapper>
409
- <label>{t('BUSINESS_SLUG', 'Business slug')}</label>
410
- <Input
411
- name='name'
412
- placeholder={t('SLUG', 'Slug')}
413
- value={themeValues?.website_theme?.components?.business_slug || ''}
414
- onChange={e => handleChangeValue(e.target.value, 'website_theme', 'business_slug')}
415
- onKeyPress={e => {
416
- if (e.which === 32) { e.preventDefault() }
417
- }}
418
- />
419
- </SlugWrapper>
405
+ <SelectBusiness
406
+ defaultValue={themeValues?.website_theme?.components?.business_slug}
407
+ businessesList={businessesList}
408
+ onChange={value => handleChangeValue(value, 'website_theme', 'business_slug')}
409
+ />
420
410
  )}
421
411
  </>
422
412
  )}
@@ -684,4 +674,4 @@ export const OrderingWebsite = (props) => {
684
674
  appId: 'website'
685
675
  }
686
676
  return <OrderingWebsiteController {...orderingWebsiteProps} />
687
- }
677
+ }
@@ -441,10 +441,6 @@ export const InfoContent = styled.div`
441
441
  right: initial;
442
442
  `}
443
443
 
444
- span {
445
- display: block;
446
- }
447
-
448
444
  > a {
449
445
  color: ${props => props.theme.colors.primary};
450
446
  margin: 0 5px;
@@ -0,0 +1,168 @@
1
+ import React, { useState, useRef, useEffect } from 'react'
2
+ import { useLanguage, ExamineClick, DragAndDrop, UploadAudio as UploadAudioController } from 'ordering-components-admin-external'
3
+ import { CloudUploadFill, FileMusicFill } from 'react-bootstrap-icons'
4
+ import { Button, Input } from '../../../styles'
5
+ import { bytesConverter } from '../../../utils'
6
+ import { Alert } from '../../Shared'
7
+ import {
8
+ Container,
9
+ FileUploadBox,
10
+ UploadIconBox,
11
+ Or,
12
+ FormControl,
13
+ ButtonGroup,
14
+ PdfIconBox
15
+ } from './styles'
16
+ import Skeleton from 'react-loading-skeleton'
17
+
18
+ const UploadAudioUI = (props) => {
19
+ const { onClose, formState, changeFormState, handleUploadAudio } = props
20
+
21
+ const [, t] = useLanguage()
22
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
23
+
24
+ const fileRef = useRef(null)
25
+
26
+ const closeAlert = () => {
27
+ setAlertState({
28
+ open: false,
29
+ content: []
30
+ })
31
+ }
32
+
33
+ const handleFiles = (files) => {
34
+ if (files.length === 1) {
35
+ const type = files[0].type
36
+ if (type?.split('/')[0] !== 'audio' && type !== 'audio/mpeg' && type !== 'audio/ogg') {
37
+ setAlertState({
38
+ open: true,
39
+ content: [t('ERROR_ONLY_AUDIO', 'Only audio files can be accepted')]
40
+ })
41
+ return
42
+ }
43
+
44
+ if (bytesConverter(files[0]?.size) > 512) {
45
+ setAlertState({
46
+ open: true,
47
+ content: [t('FILE_MAXIMUM_SIZE', 'The maximum file size is 500 kilobytes')]
48
+ })
49
+ return
50
+ }
51
+ const reader = new window.FileReader()
52
+ reader.readAsDataURL(files[0])
53
+ reader.onload = () => {
54
+ changeFormState({ file: reader.result, type: type === 'application/pdf' ? 'pdf' : 'image' })
55
+ }
56
+ reader.onerror = error => console.log(error)
57
+ }
58
+ }
59
+
60
+ const handleSendRequest = () => {
61
+ if (formState?.changes?.file || formState?.changes?.url) {
62
+ handleUploadAudio()
63
+ return
64
+ }
65
+ if (!formState?.changes?.file) {
66
+ setAlertState({
67
+ open: true,
68
+ content: t('AUDIO_FILE_IS_REQUIRED', 'Audio file is required!')
69
+ })
70
+ return
71
+ }
72
+ if (!formState?.changes?.url) {
73
+ setAlertState({
74
+ open: true,
75
+ content: t('URL_IS_REQUIRED', 'URL is required')
76
+ })
77
+ }
78
+ }
79
+
80
+ useEffect(() => {
81
+ if (formState?.error) {
82
+ setAlertState({
83
+ open: true,
84
+ content: formState.error
85
+ })
86
+ }
87
+ }, [formState?.error])
88
+
89
+ return (
90
+ <>
91
+ <Container>
92
+ <h2>{t('UPLOAD_YOUR_CUSTOM_SOUNDS', 'Upload your custom sounds')}</h2>
93
+ <p>{t('UPLOAD_CUSTOM_SOUNDS_DESC', 'Click to upload your custom sounds or share your custom sounds link')}</p>
94
+ <FileUploadBox onClick={() => fileRef.current.click()}>
95
+ {formState?.loading ? (
96
+ <Skeleton height={150} />
97
+ ) : (
98
+ <ExamineClick
99
+ onFiles={files => handleFiles(files)}
100
+ childRef={(e) => { fileRef.current = e }}
101
+ accept='.mp3, .aac, .ogg'
102
+ >
103
+ <DragAndDrop
104
+ onDrop={dataTransfer => handleFiles(dataTransfer.files)}
105
+ accept='.mp3, .aac, .ogg'
106
+ >
107
+ {formState?.changes?.file && (
108
+ <PdfIconBox><FileMusicFill /></PdfIconBox>
109
+ )}
110
+ <UploadIconBox>
111
+ <div>
112
+ <CloudUploadFill />
113
+ <p>{t('DRAG_AND_DROP', 'Drag and drop')}</p>
114
+ </div>
115
+ </UploadIconBox>
116
+ </DragAndDrop>
117
+ </ExamineClick>
118
+ )}
119
+ </FileUploadBox>
120
+ <Or>{t('OR', 'Or')}</Or>
121
+ <FormControl>
122
+ <label>{t('SHARE_CUSTOM_SOUNDS_LINK', 'Share your custom sounds link')}</label>
123
+ {formState?.loading ? (
124
+ <Skeleton height={44} />
125
+ ) : (
126
+ <Input
127
+ placeholder={t('URL', 'URL')}
128
+ defaultValue={formState?.changes?.url}
129
+ onChange={(e) => changeFormState({ url: e.target.value })}
130
+ />
131
+ )}
132
+ </FormControl>
133
+ <ButtonGroup>
134
+ <Button
135
+ color='primary'
136
+ outline
137
+ onClick={onClose}
138
+ >
139
+ {t('CANCEL', 'Cancel')}
140
+ </Button>
141
+ <Button
142
+ color='primary'
143
+ onClick={() => handleSendRequest()}
144
+ >
145
+ {t('UPLOAD', 'Upload')}
146
+ </Button>
147
+ </ButtonGroup>
148
+ </Container>
149
+ <Alert
150
+ title={t('ORDERING', 'Ordering')}
151
+ content={alertState.content}
152
+ acceptText={t('ACCEPT', 'Accept')}
153
+ open={alertState.open}
154
+ onClose={() => closeAlert()}
155
+ onAccept={() => closeAlert()}
156
+ closeOnBackdrop={false}
157
+ />
158
+ </>
159
+ )
160
+ }
161
+
162
+ export const UploadAudio = (props) => {
163
+ const uploadAudioProps = {
164
+ ...props,
165
+ UIComponent: UploadAudioUI
166
+ }
167
+ return <UploadAudioController {...uploadAudioProps} />
168
+ }