ordering-ui-admin-external 1.14.2 → 1.15.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 (137) hide show
  1. package/_bundles/{ordering-ui-admin.ffcf30d2b952270f0af3.js → ordering-ui-admin.e2a58dcc95d6a983dfc0.js} +2 -2
  2. package/_modules/components/Settings/IntegrationListing/index.js +0 -8
  3. package/package.json +2 -2
  4. package/src/components/BusinessIntelligence/BusinessReviewDetails/index.js +4 -4
  5. package/src/components/BusinessIntelligence/BusinessReviewList/index.js +29 -6
  6. package/src/components/BusinessIntelligence/InvoiceBusinessManager/index.js +17 -1
  7. package/src/components/BusinessIntelligence/InvoiceDriverManager/index.js +17 -1
  8. package/src/components/BusinessIntelligence/InvoiceManager/index.js +16 -2
  9. package/src/components/BusinessIntelligence/InvoiceOrdertype/styles.js +1 -0
  10. package/src/components/BusinessIntelligence/ProductReviewDetails/index.js +4 -4
  11. package/src/components/BusinessIntelligence/Reports/index.js +16 -2
  12. package/src/components/BusinessIntelligence/ReviewProductsListing/index.js +34 -6
  13. package/src/components/BusinessIntelligence/ReviewsListing/index.js +31 -5
  14. package/src/components/BusinessIntelligence/UserReviewDetails/index.js +4 -4
  15. package/src/components/BusinessIntelligence/UsersReviewList/index.js +32 -11
  16. package/src/components/CartRecovery/RecoveryActionDetail/index.js +19 -1
  17. package/src/components/CartRecovery/RecoveryActionListing/index.js +21 -3
  18. package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
  19. package/src/components/Delivery/DriversCompaniesListing/index.js +27 -9
  20. package/src/components/Delivery/DriversCompanyDetailsForm/index.js +37 -8
  21. package/src/components/Delivery/DriversGroupDetails/index.js +36 -4
  22. package/src/components/Delivery/DriversGroupLogistics/index.js +18 -2
  23. package/src/components/Delivery/DriversGroupsListing/index.js +20 -6
  24. package/src/components/Delivery/UserDetails/index.js +26 -1
  25. package/src/components/Loyalty/GiftCardDetail/styles.js +192 -0
  26. package/src/components/Loyalty/GiftCards/index.js +22 -2
  27. package/src/components/Loyalty/PointsWalletBusinessList/index.js +24 -1
  28. package/src/components/Loyalty/PointsWalletLevels/index.js +21 -1
  29. package/src/components/Loyalty/RewardsPrograms/index.js +30 -3
  30. package/src/components/Loyalty/Wallet/index.js +22 -1
  31. package/src/components/Marketing/AdBannersListing/index.js +25 -8
  32. package/src/components/Marketing/BannerImageDetails/index.js +2 -1
  33. package/src/components/Marketing/CampaignDetail/index.js +22 -1
  34. package/src/components/Marketing/CampaignEmail/styles.js +3 -0
  35. package/src/components/Marketing/CampaignListing/index.js +18 -1
  36. package/src/components/Marketing/CampaignNotification/styles.js +3 -0
  37. package/src/components/Marketing/CampaignSMS/styles.js +3 -0
  38. package/src/components/Marketing/EnterprisePromotionGeneralDetails/index.js +2 -1
  39. package/src/components/Marketing/EnterprisePromotionListing/index.js +19 -1
  40. package/src/components/Marketing/PageBanner/index.js +26 -3
  41. package/src/components/Messages/MessagesListing/index.js +17 -0
  42. package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +64 -0
  43. package/src/components/MyProducts/AdvancedSettings/OrderType.js +40 -0
  44. package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +104 -0
  45. package/src/components/MyProducts/AdvancedSettings/index.js +541 -0
  46. package/src/components/MyProducts/AdvancedSettings/styles.js +388 -0
  47. package/src/components/MyProducts/AppLayout/index.js +19 -2
  48. package/src/components/MyProducts/AppLayout/styles.js +65 -0
  49. package/src/components/MyProducts/CallCenterApp/index.js +1 -1
  50. package/src/components/MyProducts/CustomerApp/index.js +2 -2
  51. package/src/components/MyProducts/DriverApp/index.js +2 -2
  52. package/src/components/MyProducts/KioskApp/index.js +1 -1
  53. package/src/components/MyProducts/OrderingWebsite/index.js +309 -255
  54. package/src/components/MyProducts/OrderingWebsite/styles.js +99 -2
  55. package/src/components/MyProducts/PosApp/index.js +1 -1
  56. package/src/components/MyProducts/StoreApp/index.js +2 -2
  57. package/src/components/OrderingProducts/OrderingProductDetails/index.js +24 -2
  58. package/src/components/OrderingProducts/OrderingProductsListing/index.js +17 -1
  59. package/src/components/Orders/DeliveriesManager/index.js +0 -1
  60. package/src/components/Orders/Messages/index.js +31 -11
  61. package/src/components/Orders/OrderDetails/index.js +34 -20
  62. package/src/components/Orders/OrderDetailsHeader/index.js +2 -3
  63. package/src/components/Orders/OrdersContentHeader/index.js +1 -1
  64. package/src/components/Orders/OrdersFilterGroup/index.js +111 -13
  65. package/src/components/Orders/OrdersFilterGroup/styles.js +26 -0
  66. package/src/components/Orders/OrdersManager/index.js +0 -1
  67. package/src/components/Settings/CountriesList/index.js +26 -6
  68. package/src/components/Settings/Deliverect/index.js +26 -2
  69. package/src/components/Settings/DoordashConnect/index.js +26 -2
  70. package/src/components/Settings/DropdownOptionList/index.js +27 -6
  71. package/src/components/Settings/IntegrationListing/index.js +5 -5
  72. package/src/components/Settings/ItsaCheckmate/index.js +26 -2
  73. package/src/components/Settings/LalamoveConnect/index.js +26 -2
  74. package/src/components/Settings/PickerExpress/index.js +26 -2
  75. package/src/components/Settings/PlaceListing/index.js +38 -6
  76. package/src/components/Settings/Settings/index.js +79 -37
  77. package/src/components/Settings/SettingsDetail/index.js +15 -1
  78. package/src/components/Settings/SitesAuthSettings/index.js +18 -1
  79. package/src/components/SidebarMenu/index.js +0 -2
  80. package/src/components/Stores/BusinessAdd/BusinessDetails/index.js +1 -10
  81. package/src/components/Stores/BusinessAdd/BusinessDetails/styles.js +4 -0
  82. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +120 -109
  83. package/src/components/Stores/BusinessAdd/DeliveryZone/styles.js +22 -1
  84. package/src/components/Stores/BusinessAdd/PaymentMethods/index.js +8 -2
  85. package/src/components/Stores/BusinessAdd/PaymentMethods/styles.js +4 -0
  86. package/src/components/Stores/BusinessAdd/ReceiveOrders/index.js +11 -6
  87. package/src/components/Stores/BusinessAdd/ReceiveOrders/styles.js +4 -0
  88. package/src/components/Stores/BusinessAdd/index.js +47 -16
  89. package/src/components/Stores/BusinessAdd/styles.js +27 -1
  90. package/src/components/Stores/BusinessAddStore/index.js +1 -1
  91. package/src/components/Stores/BusinessBrandListing/index.js +37 -4
  92. package/src/components/Stores/BusinessDeliveryPickupMore/index.js +22 -1
  93. package/src/components/Stores/BusinessDeliveryZoneDetails/index.js +25 -2
  94. package/src/components/Stores/BusinessDeliveryZoneList/index.js +30 -3
  95. package/src/components/Stores/BusinessDetail/index.js +20 -1
  96. package/src/components/Stores/BusinessDetails/index.js +18 -1
  97. package/src/components/Stores/BusinessFrontLayout/index.js +13 -1
  98. package/src/components/Stores/BusinessFrontLayout/styles.js +11 -0
  99. package/src/components/Stores/BusinessMenu/index.js +56 -11
  100. package/src/components/Stores/BusinessMenuOptions/index.js +28 -3
  101. package/src/components/Stores/BusinessOrderingChannels/index.js +19 -2
  102. package/src/components/Stores/BusinessPaymentMethods/index.js +24 -2
  103. package/src/components/Stores/BusinessPlaceGroupList/index.js +193 -0
  104. package/src/components/Stores/BusinessPlaceGroupList/styles.js +143 -0
  105. package/src/components/Stores/BusinessProductsCategoyDetails/index.js +21 -1
  106. package/src/components/Stores/BusinessProductsListing/index.js +49 -8
  107. package/src/components/Stores/BusinessPromotionGeneralForm/index.js +2 -2
  108. package/src/components/Stores/BusinessSharedMenuProducts/index.js +29 -3
  109. package/src/components/Stores/BusinessSync/index.js +18 -2
  110. package/src/components/Stores/BusinessTypes/index.js +26 -4
  111. package/src/components/Stores/BusinessWalletsList/index.js +23 -1
  112. package/src/components/Stores/BusinessesListing/index.js +11 -2
  113. package/src/components/Stores/ImportersButton/index.js +24 -3
  114. package/src/components/Stores/PaymentOption/index.js +29 -8
  115. package/src/components/Stores/PaymentOptionMethods/index.js +25 -3
  116. package/src/components/Stores/PaymentOptionPaypal/index.js +25 -3
  117. package/src/components/Stores/PaymentOptionSquare/index.js +25 -3
  118. package/src/components/Stores/PaymentOptionStripeDirect/index.js +25 -3
  119. package/src/components/Stores/PaymethodOptionPaypalExpress/index.js +25 -3
  120. package/src/components/Stores/PaymethodOptionStripeConnect/index.js +25 -3
  121. package/src/components/Stores/PaymethodOptionStripeRedirect/index.js +25 -3
  122. package/src/components/Stores/ProductDetails/index.js +19 -1
  123. package/src/components/Stores/ProductExtras/index.js +23 -2
  124. package/src/components/Stores/ProductIngredient/index.js +23 -2
  125. package/src/components/Stores/ProductMainDetails/index.js +20 -2
  126. package/src/components/Stores/ProductTagsList/index.js +28 -3
  127. package/src/components/Users/CustomerCashWallet/index.js +25 -3
  128. package/src/components/Users/CustomerDetails/index.js +20 -1
  129. package/src/components/Users/CustomerPointsWallet/index.js +25 -3
  130. package/src/components/Users/CustomersListing/index.js +9 -4
  131. package/src/components/Users/ProfessionalDetail/index.js +27 -1
  132. package/src/components/Users/ProfessionalListing/index.js +9 -4
  133. package/src/components/Users/UserActiveStateFilter/index.js +16 -3
  134. package/src/components/Users/UserDetails/index.js +27 -1
  135. package/src/components/Users/UsersListing/index.js +9 -4
  136. package/template/pages/BusinessProductsList/index.js +1 -1
  137. /package/_bundles/{ordering-ui-admin.ffcf30d2b952270f0af3.js.LICENSE.txt → ordering-ui-admin.e2a58dcc95d6a983dfc0.js.LICENSE.txt} +0 -0
@@ -106,3 +106,6 @@ export const Description = styled.div`
106
106
  }
107
107
  }
108
108
  `
109
+ export const BottomSpace = styled.div`
110
+ height: 1px;
111
+ `
@@ -160,7 +160,8 @@ export const EnterprisePromotionGeneralDetails = (props) => {
160
160
  }, [isShowCalendar])
161
161
 
162
162
  useEffect(() => {
163
- if (Object.keys(promotionState?.promotion).length) {
163
+ if (promotionState.loading) return
164
+ if (promotionState?.promotion && Object.keys(promotionState?.promotion).length) {
164
165
  setDateRange([
165
166
  {
166
167
  startDate: new Date(promotionState?.promotion?.start),
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useConfig, useSession, useLanguage, EnterprisePromotionList as EnterprisePromontioListController } from 'ordering-components-admin-external'
3
4
  import { List as MenuIcon } from 'react-bootstrap-icons'
4
5
  import { useInfoShare } from '../../../contexts/InfoShareContext'
@@ -28,6 +29,8 @@ const EnterprisePromotionListingUI = (props) => {
28
29
  handleSuccessDeletePromotion
29
30
  } = props
30
31
 
32
+ const history = useHistory()
33
+ const query = new URLSearchParams(useLocation().search)
31
34
  const [, t] = useLanguage()
32
35
  const [{ configs }] = useConfig()
33
36
  const [{ user }] = useSession()
@@ -39,17 +42,23 @@ const EnterprisePromotionListingUI = (props) => {
39
42
  const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
40
43
  const [openDetails, setOpenDetails] = useState(false)
41
44
  const [selectedPromotion, setSelectedPromotion] = useState(null)
45
+ const [curPromotionId, setCurPromotionId] = useState(null)
42
46
  const [moveDistance, setMoveDistance] = useState(0)
43
47
 
44
48
  const handleOpenDetails = (promotion) => {
45
49
  setMoveDistance(0)
46
50
  setSelectedPromotion(promotion)
51
+ setCurPromotionId(promotion?.id)
47
52
  setOpenDetails(true)
53
+ if (promotion) {
54
+ history.replace(`${location.pathname}?id=${promotion?.id}`)
55
+ }
48
56
  }
49
57
 
50
58
  const handleCloseDetails = () => {
51
59
  setOpenDetails(false)
52
60
  setSelectedPromotion(null)
61
+ history.replace(`${location.pathname}`)
53
62
  }
54
63
 
55
64
  useEffect(() => {
@@ -69,6 +78,14 @@ const EnterprisePromotionListingUI = (props) => {
69
78
  }
70
79
  }, [configs])
71
80
 
81
+ useEffect(() => {
82
+ const id = query.get('id')
83
+ if (id) {
84
+ setCurPromotionId(Number(id))
85
+ setOpenDetails(true)
86
+ }
87
+ }, [])
88
+
72
89
  return (
73
90
  <>
74
91
  <PromotionsListingContainer>
@@ -88,7 +105,7 @@ const EnterprisePromotionListingUI = (props) => {
88
105
  <Button
89
106
  color='lightPrimary'
90
107
  borderRadius='8px'
91
- onClick={() => handleOpenDetails({})}
108
+ onClick={() => handleOpenDetails(null)}
92
109
  >
93
110
  {t('ADD_PROMOTION_ENTERPRISE', 'Add promotion enterprise')}
94
111
  </Button>
@@ -120,6 +137,7 @@ const EnterprisePromotionListingUI = (props) => {
120
137
  businessesList={businessesList}
121
138
  paymethodsState={paymethodsState}
122
139
  promotion={selectedPromotion}
140
+ promotionId={curPromotionId}
123
141
  promotionsList={promotionListState.promotions}
124
142
  handleSuccessUpdatePromotions={handleSuccessUpdatePromotions}
125
143
  handleSuccessAddPromotion={handleSuccessAddPromotion}
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, AdBannersList as AdBannersListController } from 'ordering-components-admin-external'
3
4
  import Skeleton from 'react-loading-skeleton'
4
5
  import { SideBar, Alert, SearchBar } from '../../Shared'
@@ -37,6 +38,9 @@ const PageBannersUI = (props) => {
37
38
  aspectRatio,
38
39
  isSearhShow
39
40
  } = props
41
+
42
+ const history = useHistory()
43
+ const query = new URLSearchParams(useLocation().search)
40
44
  const [, t] = useLanguage()
41
45
  const { width } = useWindowSize()
42
46
 
@@ -47,18 +51,24 @@ const PageBannersUI = (props) => {
47
51
  const [bannerMoveDistance, setBannerMoveDistance] = useState(0)
48
52
  const [isExpand, setIsExpand] = useState(false)
49
53
 
50
- const handleOpenBannerItemsDetail = (e, banner) => {
51
- const isInvalid = e.target.closest('.banner-enabled')
54
+ const handleOpenBannerItemsDetail = (e, banner, isInitialRender) => {
55
+ const isInvalid = e?.target?.closest('.banner-enabled')
52
56
  if (isInvalid) return
53
57
  setSelectedBanner(banner)
54
58
  setOpenItemsDetail(true)
55
59
  setMoveDistance(500)
60
+ if (banner && !isInitialRender) {
61
+ const position = query.get('position')
62
+ history.replace(`${location.pathname}?position=${position}&banner=${banner?.id}`)
63
+ }
56
64
  }
57
65
 
58
66
  const handleCloseDetail = () => {
59
67
  setMoveDistance(0)
60
68
  setOpenItemsDetail(false)
61
69
  setSelectedBanner(null)
70
+ const position = query.get('position')
71
+ history.replace(`${location.pathname}?position=${position}`)
62
72
  }
63
73
 
64
74
  const expandSidebar = () => {
@@ -78,13 +88,26 @@ const PageBannersUI = (props) => {
78
88
 
79
89
  useEffect(() => {
80
90
  setSearchValue('')
81
- handleCloseDetail()
91
+ setMoveDistance(0)
92
+ setOpenItemsDetail(false)
93
+ setSelectedBanner(null)
82
94
  }, [defaultPosition])
83
95
 
84
96
  useEffect(() => {
85
97
  if (openItemsDetail) setIsExpand(false)
86
98
  }, [openItemsDetail])
87
99
 
100
+ useEffect(() => {
101
+ if (bannersListState.loading) return
102
+ const bannerId = query.get('banner')
103
+ if (bannerId) {
104
+ const initBanner = bannersListState.banners.find(banner => banner.id === Number(bannerId))
105
+ if (initBanner) {
106
+ handleOpenBannerItemsDetail(null, initBanner, true)
107
+ }
108
+ }
109
+ }, [bannersListState.loading])
110
+
88
111
  return (
89
112
  <>
90
113
  <Container>
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react'
2
+ import { useHistory, useLocation } from 'react-router-dom'
2
3
  import { useLanguage, OrdersManage as OrdersManageController } from 'ordering-components-admin-external'
3
4
  import { OrdersContentHeader, OrdersDashboardList, OrderNotification, OrderDetails, Messages } from '../../Orders'
4
5
  import { Button } from '../../../styles/Buttons'
@@ -34,6 +35,9 @@ const MessagesListingUI = (props) => {
34
35
  handleChangeFilterValues
35
36
  } = props
36
37
 
38
+ const history = useHistory()
39
+ const query = new URLSearchParams(useLocation().search)
40
+
37
41
  const [, t] = useLanguage()
38
42
  const { width } = useWindowSize()
39
43
  const [selectedOption, setSelectedOption] = useState('orders')
@@ -44,11 +48,14 @@ const MessagesListingUI = (props) => {
44
48
  const [detailsOrder, setDetailsOrder] = useState(null)
45
49
  const [selectedOrder, setSelectedOrder] = useState(null)
46
50
  const [orderIdForUnreadCountUpdate, setOrderIdForUnreadCountUpdate] = useState(null)
51
+ const [filterModalOpen, setFilterModalOpen] = useState(false)
47
52
 
48
53
  const handleOpenOrderDetail = (order) => {
49
54
  setDetailsOrder(order)
50
55
  setOrderDetailId(order.id)
51
56
  setIsOpenOrderDetail(true)
57
+
58
+ history.replace(`${location.pathname}?id=${order.id}`)
52
59
  }
53
60
 
54
61
  const handleOrderCardClick = (order) => {
@@ -60,6 +67,14 @@ const MessagesListingUI = (props) => {
60
67
  document.body.style.overflow = isOpenOrderDetail ? 'hidden' : 'auto'
61
68
  }, [width, isOpenOrderDetail])
62
69
 
70
+ useEffect(() => {
71
+ const id = query.get('id')
72
+ if (id) {
73
+ setOrderDetailId(id)
74
+ setIsOpenOrderDetail(true)
75
+ }
76
+ }, [])
77
+
63
78
  return (
64
79
  <>
65
80
  <MessagesListingContainer id='deliveryDashboard'>
@@ -74,6 +89,8 @@ const MessagesListingUI = (props) => {
74
89
  filterValues={filterValues}
75
90
  handleChangeSearch={handleChangeSearch}
76
91
  handleChangeFilterValues={handleChangeFilterValues}
92
+ filterModalOpen={filterModalOpen}
93
+ setFilterModalOpen={setFilterModalOpen}
77
94
  />
78
95
  <MessagesContent>
79
96
  <OrdersContainer>
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { RecordCircleFill, Circle } from 'react-bootstrap-icons'
4
+ import { Select } from '../../../styles/Select/FirstSelect'
5
+ import {
6
+ FormControl,
7
+ Option,
8
+ SelectWrapper,
9
+ FontWeightListWrapper,
10
+ FontWeightItem
11
+ } from './styles'
12
+
13
+ export const FontStyleGroup = (props) => {
14
+ const { isBody, fonts, path, handleUpdateThemeValue } = props
15
+ const [, t] = useLanguage()
16
+
17
+ const fontFamilyList = [
18
+ { value: 'Poppins', content: <Option>{t('POPPINS', 'Poppins')}</Option> },
19
+ { value: 'Lobster', content: <Option>{t('LOBSTER', 'Lobster')}</Option> },
20
+ { value: 'Raleway', content: <Option>{t('RALEWAY', 'Raleway')}</Option> }
21
+ ]
22
+
23
+ const fontWeightList = [
24
+ { value: 100, name: '100 - Thin' },
25
+ { value: 200, name: '200 - Extra Light (Ultra Light)' },
26
+ { value: 300, name: '300 - Light' },
27
+ { value: 400, name: '400 - Normal' },
28
+ { value: 500, name: '500 - Medium' },
29
+ { value: 600, name: '600 - Semi Bold (Demi Bold)' },
30
+ { value: 700, name: '700 - Bold' },
31
+ { value: 800, name: '800 - Extra Bold (Ultra Bold)' },
32
+ { value: 900, name: '900 - Black (Heavy)' }
33
+ ]
34
+
35
+ return (
36
+ <>
37
+ <FormControl>
38
+ <label>{t('FONT', 'Font')}</label>
39
+ <SelectWrapper>
40
+ <Select
41
+ options={fontFamilyList}
42
+ className='select'
43
+ defaultValue={fonts?.name}
44
+ placeholder={t('SELECT_OPTION', 'Select an option')}
45
+ onChange={(value) => handleUpdateThemeValue(value, [path, 'name'].join('.'))}
46
+ />
47
+ </SelectWrapper>
48
+ </FormControl>
49
+ <FormControl>
50
+ <label>
51
+ {isBody ? t('FONT_SPECIAL_WEIGHTS', 'Font special weights') : t('FONT_PRIMARY_WEIGHTS', 'Font primary weights')}
52
+ </label>
53
+ <FontWeightListWrapper>
54
+ {fontWeightList.map(weight => (
55
+ <FontWeightItem key={weight.value} onClick={() => handleUpdateThemeValue([weight?.value], [path, 'weights'].join('.'))}>
56
+ {fonts?.weights?.includes(weight.value) ? <RecordCircleFill className='active' /> : <Circle />}
57
+ <span>{weight.name}</span>
58
+ </FontWeightItem>
59
+ ))}
60
+ </FontWeightListWrapper>
61
+ </FormControl>
62
+ </>
63
+ )
64
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { Input } from '../../../styles'
4
+ import {
5
+ FormControl
6
+ } from './styles'
7
+
8
+ export const OrderType = (props) => {
9
+ const { path, typeValues, handleUpdateThemeValue } = props
10
+ const [, t] = useLanguage()
11
+
12
+ return (
13
+ <>
14
+ <FormControl>
15
+ <label>{t('TITLE', 'Title')}</label>
16
+ <Input
17
+ placeholder={t('TITLE', 'Title')}
18
+ defaultValue={typeValues?.title || ''}
19
+ onChange={(e) => handleUpdateThemeValue(e.target.value, [path, 'title'].join('.'))}
20
+ />
21
+ </FormControl>
22
+ <FormControl>
23
+ <label>{t('DESCRIPTION', 'Description')}</label>
24
+ <Input
25
+ placeholder={t('DESCRIPTION', 'Description')}
26
+ defaultValue={typeValues?.description || ''}
27
+ onChange={(e) => handleUpdateThemeValue(e.target.value, [path, 'description'].join('.'))}
28
+ />
29
+ </FormControl>
30
+ <FormControl>
31
+ <label>{t('CALL_TO_ACTION', 'Call to action')}</label>
32
+ <Input
33
+ placeholder={t('CALL_TO_ACTION', 'Call to action')}
34
+ defaultValue={typeValues?.call_to_action || ''}
35
+ onChange={(e) => handleUpdateThemeValue(e.target.value, [path, 'call_to_action'].join('.'))}
36
+ />
37
+ </FormControl>
38
+ </>
39
+ )
40
+ }
@@ -0,0 +1,104 @@
1
+ import React from 'react'
2
+ import { useLanguage } from 'ordering-components-admin-external'
3
+ import { Select } from '../../../styles/Select/FirstSelect'
4
+ import { ImageBox } from './ImageBox'
5
+ import {
6
+ CheckSquareFill as CheckedIcon,
7
+ Square as UnCheckedIcon
8
+ } from 'react-bootstrap-icons'
9
+ import {
10
+ FormControl,
11
+ HideCheckWrapper,
12
+ SelectWrapper,
13
+ Option
14
+ } from './styles'
15
+ import { ColorPicker } from '../../Shared'
16
+ import { Input } from '../../../styles'
17
+
18
+ export const SettingComponent = (props) => {
19
+ const { settingList, handleUpdateThemeValue, advancedValues, themeStructure } = props
20
+
21
+ const [, t] = useLanguage()
22
+
23
+ const deepFind = (obj, path) => {
24
+ const paths = path.split('.')
25
+ let current = JSON.parse(JSON.stringify(obj))
26
+ let i
27
+
28
+ for (i = 0; i < paths.length; ++i) {
29
+ if (current[paths[i]] === undefined) {
30
+ return undefined
31
+ } else {
32
+ current = current[paths[i]]
33
+ }
34
+ }
35
+ return current
36
+ }
37
+
38
+ const getOptions = (path) => {
39
+ const options = deepFind(themeStructure, [path, 'options'].join('.'))
40
+ if (!options) return []
41
+ const updatedOptions = options.map(option => ({ value: option, content: <Option>{t(option.toString().toUpperCase(), option)}</Option> }))
42
+ return updatedOptions
43
+ }
44
+
45
+ return (
46
+ <>
47
+ {settingList.map((setting, i) => (
48
+ <React.Fragment key={i}>
49
+ {setting.type === 'hidden' && (
50
+ <FormControl>
51
+ <label>{setting.name}</label>
52
+ <HideCheckWrapper onClick={() => handleUpdateThemeValue(!deepFind(advancedValues, setting?.path), setting?.path)}>
53
+ {deepFind(advancedValues, setting?.path) ? <CheckedIcon className='active' /> : <UnCheckedIcon />}
54
+ <span>{t('HIDDEN', 'Hidden')}</span>
55
+ </HideCheckWrapper>
56
+ </FormControl>
57
+ )}
58
+ {setting.type === 'position' && (
59
+ <FormControl>
60
+ <label>{setting.name}</label>
61
+ <SelectWrapper>
62
+ <Select
63
+ options={getOptions(setting?.path)}
64
+ className='select'
65
+ defaultValue={deepFind(advancedValues, setting?.path)}
66
+ placeholder={t('SELECT_OPTION', 'Select an option')}
67
+ onChange={(value) => handleUpdateThemeValue(value, setting?.path)}
68
+ />
69
+ </SelectWrapper>
70
+ </FormControl>
71
+ )}
72
+ {setting.type === 'image' && (
73
+ <ImageBox
74
+ title={setting.name}
75
+ ratio='900 x 200 px'
76
+ photo={deepFind(advancedValues, setting?.path)}
77
+ path={setting?.path}
78
+ handleChangePhoto={handleUpdateThemeValue}
79
+ />
80
+ )}
81
+ {setting.type === 'color' && (
82
+ <FormControl>
83
+ <label>{setting.name}</label>
84
+ <ColorPicker
85
+ defaultColor={deepFind(advancedValues, setting?.path) || '#2C7BE5'}
86
+ onChangeColor={(color) => handleUpdateThemeValue(color, setting?.path)}
87
+ />
88
+ </FormControl>
89
+ )}
90
+ {setting.type === 'input' && (
91
+ <FormControl>
92
+ <label>{setting.name}</label>
93
+ <Input
94
+ defaultValue={deepFind(advancedValues, setting?.path)}
95
+ onChange={(e) => handleUpdateThemeValue(e.target.value, setting?.path)}
96
+ placeholder={setting.name}
97
+ />
98
+ </FormControl>
99
+ )}
100
+ </React.Fragment>
101
+ ))}
102
+ </>
103
+ )
104
+ }