ordering-ui-admin-external 1.25.1 → 1.26.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 (159) hide show
  1. package/_bundles/main.css +1829 -1829
  2. package/_bundles/{ordering-ui-admin.bb3d2f1a6bc2f5d19b6c.js → ordering-ui-admin.45097ebbca4f4a7d30b7.js} +2 -2
  3. package/_modules/components/BusinessIntelligence/AnalyticsCalendar/index.js +8 -1
  4. package/_modules/components/Delivery/DriversCompanyAddForm/styles.js +1 -1
  5. package/_modules/components/Delivery/DriversGroupAddForm/AdvancedLogisticsForm/index.js +68 -0
  6. package/_modules/components/Delivery/DriversGroupAddForm/AdvancedLogisticsForm/styles.js +42 -0
  7. package/_modules/components/Delivery/DriversGroupAddForm/BusinessesForm/index.js +89 -0
  8. package/_modules/components/Delivery/DriversGroupAddForm/BusinessesForm/styles.js +47 -0
  9. package/_modules/components/Delivery/DriversGroupAddForm/GeneralForm/index.js +106 -0
  10. package/_modules/components/Delivery/DriversGroupAddForm/GeneralForm/styles.js +16 -0
  11. package/_modules/components/Delivery/DriversGroupAddForm/PaymethodsForm/index.js +87 -0
  12. package/_modules/components/Delivery/DriversGroupAddForm/PaymethodsForm/styles.js +33 -0
  13. package/_modules/components/Delivery/DriversGroupAddForm/index.js +132 -0
  14. package/_modules/components/Delivery/DriversGroupAddForm/styles.js +18 -0
  15. package/_modules/components/Delivery/DriversGroupCompanies/styles.js +1 -1
  16. package/_modules/components/Delivery/DriversGroupDrivers/styles.js +1 -1
  17. package/_modules/components/Delivery/DriversGroupOrders/index.js +5 -5
  18. package/_modules/components/Delivery/DriversGroupsList/styles.js +1 -1
  19. package/_modules/components/Delivery/DriversGroupsListing/index.js +28 -7
  20. package/_modules/components/Delivery/DriversGroupsListing/styles.js +2 -2
  21. package/_modules/components/Delivery/UserAddForm/index.js +39 -6
  22. package/_modules/components/Delivery/UserAddForm/styles.js +28 -21
  23. package/_modules/components/Delivery/UserDetails/index.js +2 -2
  24. package/_modules/components/Home/HomePage/index.js +71 -3
  25. package/_modules/components/Home/HomePage/styles.js +27 -5
  26. package/_modules/components/Login/LoginForm/index.js +0 -5
  27. package/_modules/components/MyProducts/AdvancedLayouts/LayoutStyleGroup.js +46 -0
  28. package/_modules/components/MyProducts/AdvancedLayouts/index.js +213 -0
  29. package/_modules/components/MyProducts/AdvancedLayouts/styles.js +146 -0
  30. package/_modules/components/MyProducts/AdvancedSettings/index.js +12 -0
  31. package/_modules/components/MyProducts/CustomDomain/index.js +6 -4
  32. package/_modules/components/MyProducts/CustomDomain/styles.js +27 -9
  33. package/_modules/components/MyProducts/OrderingWebsite/index.js +94 -17
  34. package/_modules/components/MyProducts/OrderingWebsite/styles.js +20 -11
  35. package/_modules/components/Orders/AllInOne/DriversManager/index.js +128 -0
  36. package/_modules/components/Orders/AllInOne/DriversManager/styles.js +27 -0
  37. package/_modules/components/Orders/AllInOne/index.js +337 -0
  38. package/_modules/components/Orders/AllInOne/styles.js +67 -0
  39. package/_modules/components/Orders/CompanySelector/index.js +259 -0
  40. package/_modules/components/Orders/CompanySelector/styles.js +86 -0
  41. package/_modules/components/Orders/DriversBusyStatusFilter/styles.js +6 -3
  42. package/_modules/components/Orders/DriversList/index.js +3 -2
  43. package/_modules/components/Orders/DriversList/styles.js +2 -2
  44. package/_modules/components/Orders/DriversManager/index.js +2 -1
  45. package/_modules/components/Orders/DriversOnlineOfflineFilter/styles.js +5 -2
  46. package/_modules/components/Orders/OrderBill/RefundToWallet.js +1 -1
  47. package/_modules/components/Orders/OrderBill/index.js +17 -18
  48. package/_modules/components/Orders/OrderContactInformation/index.js +14 -3
  49. package/_modules/components/Orders/OrderDetails/index.js +1 -1
  50. package/_modules/components/Orders/OrderStatusSubFilter/styles.js +1 -1
  51. package/_modules/components/Orders/OrderToPrint/index.js +2 -1
  52. package/_modules/components/Orders/OrderToPrintTicket/index.js +4 -2
  53. package/_modules/components/Orders/OrdersContentHeader/index.js +2 -1
  54. package/_modules/components/Orders/OrdersListing/index.js +3 -1
  55. package/_modules/components/Orders/OrdersManager/index.js +5 -1
  56. package/_modules/components/Orders/OrdersTable/index.js +11 -10
  57. package/_modules/components/Orders/ProductItemAccordion/index.js +5 -9
  58. package/_modules/components/Orders/WebsocketStatus/index.js +119 -0
  59. package/_modules/components/Orders/WebsocketStatus/styles.js +65 -0
  60. package/_modules/components/Orders/index.js +7 -0
  61. package/_modules/components/Settings/IntegrationListing/Analytics.js +130 -0
  62. package/_modules/components/Settings/IntegrationListing/PaymentGateway.js +130 -0
  63. package/_modules/components/Settings/IntegrationListing/index.js +174 -31
  64. package/_modules/components/Settings/IntegrationListing/styles.js +42 -11
  65. package/_modules/components/Settings/NotificationSetting/index.js +25 -4
  66. package/_modules/components/Settings/NotificationSetting/styles.js +5 -3
  67. package/_modules/components/Settings/SettingsSelectUI/index.js +3 -2
  68. package/_modules/components/Shared/RangeCalendar/index.js +9 -1
  69. package/_modules/components/Shared/SearchBar/index.js +11 -6
  70. package/_modules/components/Shared/SearchBar/styles.js +9 -15
  71. package/_modules/components/SidebarMenu/index.js +19 -10
  72. package/_modules/components/Users/UserDetails/index.js +2 -2
  73. package/_modules/config/currency.js +1017 -0
  74. package/_modules/index.js +6 -0
  75. package/_modules/utils/index.js +26 -3
  76. package/index-template.js +10 -0
  77. package/package.json +3 -2
  78. package/src/components/BusinessIntelligence/AnalyticsCalendar/index.js +7 -1
  79. package/src/components/Delivery/DriversCompanyAddForm/styles.js +0 -1
  80. package/src/components/Delivery/DriversGroupAddForm/AdvancedLogisticsForm/index.js +113 -0
  81. package/src/components/Delivery/DriversGroupAddForm/AdvancedLogisticsForm/styles.js +72 -0
  82. package/src/components/Delivery/DriversGroupAddForm/BusinessesForm/index.js +87 -0
  83. package/src/components/Delivery/DriversGroupAddForm/BusinessesForm/styles.js +87 -0
  84. package/src/components/Delivery/DriversGroupAddForm/GeneralForm/index.js +104 -0
  85. package/src/components/Delivery/DriversGroupAddForm/GeneralForm/styles.js +31 -0
  86. package/src/components/Delivery/DriversGroupAddForm/PaymethodsForm/index.js +82 -0
  87. package/src/components/Delivery/DriversGroupAddForm/PaymethodsForm/styles.js +46 -0
  88. package/src/components/Delivery/DriversGroupAddForm/index.js +130 -0
  89. package/src/components/Delivery/DriversGroupAddForm/styles.js +38 -0
  90. package/src/components/Delivery/DriversGroupCompanies/styles.js +1 -0
  91. package/src/components/Delivery/DriversGroupDrivers/styles.js +1 -0
  92. package/src/components/Delivery/DriversGroupOrders/index.js +2 -2
  93. package/src/components/Delivery/DriversGroupsList/styles.js +1 -1
  94. package/src/components/Delivery/DriversGroupsListing/index.js +35 -13
  95. package/src/components/Delivery/DriversGroupsListing/styles.js +1 -1
  96. package/src/components/Delivery/UserAddForm/index.js +34 -2
  97. package/src/components/Delivery/UserAddForm/styles.js +25 -0
  98. package/src/components/Delivery/UserDetails/index.js +1 -1
  99. package/src/components/Home/HomePage/index.js +215 -142
  100. package/src/components/Home/HomePage/styles.js +105 -1
  101. package/src/components/Login/LoginForm/index.js +0 -7
  102. package/src/components/MyProducts/AdvancedLayouts/LayoutStyleGroup.js +37 -0
  103. package/src/components/MyProducts/AdvancedLayouts/index.js +240 -0
  104. package/src/components/MyProducts/AdvancedLayouts/styles.js +388 -0
  105. package/src/components/MyProducts/AdvancedSettings/index.js +5 -2
  106. package/src/components/MyProducts/CustomDomain/index.js +35 -16
  107. package/src/components/MyProducts/CustomDomain/styles.js +73 -1
  108. package/src/components/MyProducts/OrderingWebsite/index.js +147 -79
  109. package/src/components/MyProducts/OrderingWebsite/styles.js +38 -0
  110. package/src/components/Orders/AllInOne/DriversManager/index.js +137 -0
  111. package/src/components/Orders/AllInOne/DriversManager/styles.js +51 -0
  112. package/src/components/Orders/AllInOne/index.js +339 -0
  113. package/src/components/Orders/AllInOne/styles.js +144 -0
  114. package/src/components/Orders/CompanySelector/index.js +250 -0
  115. package/src/components/Orders/CompanySelector/styles.js +142 -0
  116. package/src/components/Orders/DriversBusyStatusFilter/styles.js +7 -1
  117. package/src/components/Orders/DriversList/index.js +7 -4
  118. package/src/components/Orders/DriversList/styles.js +2 -1
  119. package/src/components/Orders/DriversManager/index.js +2 -0
  120. package/src/components/Orders/DriversOnlineOfflineFilter/styles.js +8 -1
  121. package/src/components/Orders/OrderBill/RefundToWallet.js +12 -10
  122. package/src/components/Orders/OrderBill/index.js +18 -18
  123. package/src/components/Orders/OrderContactInformation/index.js +20 -1
  124. package/src/components/Orders/OrderDetails/index.js +8 -8
  125. package/src/components/Orders/OrderStatusSubFilter/styles.js +1 -1
  126. package/src/components/Orders/OrderToPrint/index.js +2 -1
  127. package/src/components/Orders/OrderToPrintTicket/index.js +160 -173
  128. package/src/components/Orders/OrdersContentHeader/index.js +2 -0
  129. package/src/components/Orders/OrdersListing/index.js +2 -0
  130. package/src/components/Orders/OrdersManager/index.js +2 -2
  131. package/src/components/Orders/OrdersTable/index.js +39 -25
  132. package/src/components/Orders/ProductItemAccordion/index.js +3 -3
  133. package/src/components/Orders/WebsocketStatus/index.js +138 -0
  134. package/src/components/Orders/WebsocketStatus/styles.js +171 -0
  135. package/src/components/Orders/index.js +2 -0
  136. package/src/components/Settings/IntegrationListing/Analytics.js +127 -0
  137. package/src/components/Settings/IntegrationListing/PaymentGateway.js +126 -0
  138. package/src/components/Settings/IntegrationListing/index.js +189 -96
  139. package/src/components/Settings/IntegrationListing/styles.js +90 -1
  140. package/src/components/Settings/NotificationSetting/index.js +73 -10
  141. package/src/components/Settings/NotificationSetting/styles.js +19 -0
  142. package/src/components/Settings/SettingsSelectUI/index.js +12 -9
  143. package/src/components/Shared/RangeCalendar/index.js +7 -1
  144. package/src/components/Shared/SearchBar/index.js +14 -5
  145. package/src/components/Shared/SearchBar/styles.js +19 -32
  146. package/src/components/SidebarMenu/index.js +15 -8
  147. package/src/components/Users/UserDetails/index.js +1 -1
  148. package/src/config/currency.js +1010 -0
  149. package/src/index.js +2 -0
  150. package/src/utils/index.js +21 -0
  151. package/template/app.js +4 -0
  152. package/template/assets/images/preview/franchise.png +0 -0
  153. package/template/assets/images/preview/marketplace.png +0 -0
  154. package/template/assets/images/preview/single-store.png +0 -0
  155. package/template/components/AutologinParams/index.js +1 -3
  156. package/template/components/ListenPageChanges/index.js +1 -0
  157. package/template/helmetdata.json +7 -0
  158. package/template/pages/AllInOne/index.js +23 -0
  159. /package/_bundles/{ordering-ui-admin.bb3d2f1a6bc2f5d19b6c.js.LICENSE.txt → ordering-ui-admin.45097ebbca4f4a7d30b7.js.LICENSE.txt} +0 -0
@@ -11,6 +11,7 @@ import {
11
11
  } from 'ordering-components-admin-external'
12
12
  import { useTheme } from 'styled-components'
13
13
  import { ColumnAllowSettingPopover, Pagination } from '../../Shared'
14
+ import { getCurrenySymbol } from '../../../utils'
14
15
 
15
16
  import {
16
17
  OrdersContainer,
@@ -36,6 +37,7 @@ import {
36
37
 
37
38
  export const OrdersTable = (props) => {
38
39
  const {
40
+ hidePhoto,
39
41
  isSelectedOrders,
40
42
  orderList,
41
43
  pagination,
@@ -333,7 +335,7 @@ export const OrdersTable = (props) => {
333
335
  <tr>
334
336
  {allowColumns && (Object.keys(allowColumns).filter(col => allowColumns[col]?.visable && allowColumns[col]?.order !== 0).length === 0 ?
335
337
  (
336
- <th className='orderPrice' key={`noDragTh-${i}`}>
338
+ <th className='orderPrice'>
337
339
  <ColumnAllowSettingPopover
338
340
  allowColumns={allowColumns}
339
341
  optionsDefault={optionsDefault}
@@ -524,7 +526,9 @@ export const OrdersTable = (props) => {
524
526
  {allowColumns?.business?.visable && (
525
527
  <td className='businessInfo'>
526
528
  <BusinessInfo>
527
- <Skeleton width={45} height={45} />
529
+ {!hidePhoto && (
530
+ <Skeleton width={45} height={45} />
531
+ )}
528
532
  <div className='info'>
529
533
  <p className='bold'><Skeleton width={80} /></p>
530
534
  <p><Skeleton width={100} /></p>
@@ -535,7 +539,9 @@ export const OrdersTable = (props) => {
535
539
  {allowColumns?.customer?.visable && (
536
540
  <td className='customerInfo'>
537
541
  <CustomerInfo>
538
- <Skeleton width={45} height={45} />
542
+ {!hidePhoto && (
543
+ <Skeleton width={45} height={45} />
544
+ )}
539
545
  <div className='info'>
540
546
  <p className='bold'><Skeleton width={100} /></p>
541
547
  <p><Skeleton width={100} /></p>
@@ -546,7 +552,9 @@ export const OrdersTable = (props) => {
546
552
  {allowColumns?.driver?.visable && !isSelectedOrders && (
547
553
  <td className='driverInfo'>
548
554
  <DriversInfo className='d-flex align-items-center'>
549
- <Skeleton width={45} height={45} />
555
+ {!hidePhoto && (
556
+ <Skeleton width={45} height={45} />
557
+ )}
550
558
  <Skeleton width={100} style={{ margin: '10px' }} />
551
559
  </DriversInfo>
552
560
  </td>
@@ -708,9 +716,11 @@ export const OrdersTable = (props) => {
708
716
  return (
709
717
  <td className='businessInfo' key={`businessInfo${i}-${index}`}>
710
718
  <BusinessInfo>
711
- <WrapperImage>
712
- <img src={optimizeImage(order.business?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} loading='lazy' alt='' />
713
- </WrapperImage>
719
+ {!hidePhoto && (
720
+ <WrapperImage>
721
+ <img src={optimizeImage(order.business?.logo || theme.images?.dummies?.businessLogo, 'h_50,c_limit')} loading='lazy' alt='' />
722
+ </WrapperImage>
723
+ )}
714
724
  <div className='info'>
715
725
  <p className='bold'>{order?.business?.name}</p>
716
726
  <p>{order?.business?.city?.name}</p>
@@ -723,16 +733,18 @@ export const OrdersTable = (props) => {
723
733
  return (
724
734
  <td className='customerInfo' key={`customerInfo${i}-${index}`}>
725
735
  <CustomerInfo>
726
- <WrapperImage>
727
- {order?.customer?.photo ? (
728
- <img src={optimizeImage(order?.customer?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
729
- ) : (
730
- <FaUserAlt />
731
- )}
732
- <OrdersCountWrapper isNew={order?.customer?.orders_count === 0}>
733
- {order?.customer?.orders_count || t('NEW', 'New')}
734
- </OrdersCountWrapper>
735
- </WrapperImage>
736
+ {!hidePhoto && (
737
+ <WrapperImage>
738
+ {order?.customer?.photo ? (
739
+ <img src={optimizeImage(order?.customer?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
740
+ ) : (
741
+ <FaUserAlt />
742
+ )}
743
+ <OrdersCountWrapper isNew={order?.customer?.orders_count === 0}>
744
+ {order?.customer?.orders_count || t('NEW', 'New')}
745
+ </OrdersCountWrapper>
746
+ </WrapperImage>
747
+ )}
736
748
  <div className='info'>
737
749
  <p className='bold'>
738
750
  {(!order?.customer?.email && !order?.customer?.cellphone && !order?.customer?.name) ? t('GUEST_USER', 'Guest user') : order?.customer?.name}
@@ -748,13 +760,15 @@ export const OrdersTable = (props) => {
748
760
  <td key={`driver${i}-${index}`}>
749
761
  {order?.delivery_type === 1 && (
750
762
  <CustomerInfo>
751
- <WrapperImage>
752
- {order?.driver?.photo ? (
753
- <img src={optimizeImage(order?.driver?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
754
- ) : (
755
- <FaUserAlt />
756
- )}
757
- </WrapperImage>
763
+ {!hidePhoto && (
764
+ <WrapperImage>
765
+ {order?.driver?.photo ? (
766
+ <img src={optimizeImage(order?.driver?.photo, 'h_50,c_limit')} loading='lazy' alt='' />
767
+ ) : (
768
+ <FaUserAlt />
769
+ )}
770
+ </WrapperImage>
771
+ )}
758
772
  <div className='info'>
759
773
  {order?.driver ? (
760
774
  <>
@@ -826,7 +840,7 @@ export const OrdersTable = (props) => {
826
840
  <td className='orderPrice' key={`total${i}-${index}`}>
827
841
  <div className='info'>
828
842
  {allowColumns?.total?.visable && (
829
- <p className='bold'>{parsePrice(order?.summary?.total, { currency: order?.currency })}</p>
843
+ <p className='bold'>{parsePrice(order?.summary?.total, { currency: getCurrenySymbol(order?.currency) })}</p>
830
844
  )}
831
845
  {!(order?.status === 1 || order?.status === 11 || order?.status === 2 || order?.status === 5 || order?.status === 6 || order?.status === 10 || order.status === 12) && (
832
846
  <p>
@@ -95,7 +95,7 @@ export const ProductItemAccordion = (props) => {
95
95
  const getFormattedSubOptionName = ({ quantity, name, position, price }) => {
96
96
  if (name !== 'No') {
97
97
  const pos = position ? `(${position})` : ''
98
- return price > 0 ? `${name} ${pos} ${parsePrice(quantity * price, { currencyPosition: 'left' })}` : `${name} ${pos}`
98
+ return price > 0 ? `${name} ${pos} ${parsePrice(quantity * price, { currency: currency })}` : `${name} ${pos}`
99
99
  } else {
100
100
  return 'No'
101
101
  }
@@ -168,7 +168,7 @@ export const ProductItemAccordion = (props) => {
168
168
  <h3>{product.name}</h3>
169
169
  {windowSize.width <= 410 && (
170
170
  <span>
171
- <p>{parsePrice(getProductPrice(product), { currencyPosition: 'left', ...(currency && { currency }) })}</p>
171
+ <p>{parsePrice(getProductPrice(product), { currency: currency })}</p>
172
172
  {isCartProduct && (
173
173
  <div>
174
174
  {onEditProduct && (
@@ -194,7 +194,7 @@ export const ProductItemAccordion = (props) => {
194
194
  <ProductPriceSection>
195
195
  <ProductPrice>
196
196
  <span>
197
- {parsePrice(getProductPrice(product), { currencyPosition: 'left', ...(currency && { currency }) })}
197
+ {parsePrice(getProductPrice(product), { currency: currency })}
198
198
  </span>
199
199
  {(productInfo().ingredients?.length > 0 || productInfo().options?.length > 0 || product.comment) && (
200
200
  <p>
@@ -0,0 +1,138 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components-admin-external'
3
+ import { InfoCircle } from 'react-bootstrap-icons'
4
+ import { Alert, Modal } from '../../Shared'
5
+ import { Button, IconButton } from '../../../styles'
6
+
7
+ import {
8
+ Contatiner,
9
+ StatusContainer,
10
+ WebsocketStatusDot,
11
+ InfoWrapper,
12
+ InfoContent,
13
+ DetailContainer,
14
+ StatusItemWrapper,
15
+ ButtonsContainer
16
+ } from './styles'
17
+
18
+ const SocketStatusUI = (props) => {
19
+ const {
20
+ socketStatus,
21
+ reconnectAttemptCount,
22
+ connectedDate
23
+ } = props
24
+
25
+ const [, t] = useLanguage()
26
+ const [{ parseDate }] = useUtils()
27
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
28
+ const [openModal, setOpenModal] = useState(false)
29
+
30
+ const closeAlert = () => {
31
+ setAlertState({
32
+ open: false,
33
+ content: []
34
+ })
35
+ window.location.reload()
36
+ }
37
+
38
+ useEffect(() => {
39
+ if (reconnectAttemptCount > 3) {
40
+ setAlertState({
41
+ open: true,
42
+ content: t('WEBSOCKET_CONNECT_ERROR', 'There appears to be an error in establishing the WebSocket connection. Please try reloading the page to resolve the issue.')
43
+ })
44
+ }
45
+ }, [reconnectAttemptCount])
46
+
47
+ return (
48
+ <Contatiner>
49
+ <InfoWrapper>
50
+ <IconButton
51
+ color='primary'
52
+ >
53
+ <InfoCircle />
54
+ </IconButton>
55
+ <InfoContent>
56
+ {t('WEBSOCKET_STATUS_INFO', 'Verify the server connection by date and time using the Connection status button. Press update to refresh you dashboard and update the status as well. Need help? Contact our Customer support team here:')}
57
+ <a href='https://www.ordering.co/contact-ordering' target='_blank' rel='noopener noreferrer'>{t('CUSTOMER_SUPPORT', 'Customer support')}</a>
58
+ </InfoContent>
59
+ </InfoWrapper>
60
+ <Button
61
+ borderRadius='8px'
62
+ color='secundary'
63
+ onClick={() => setOpenModal(true)}
64
+ >
65
+ <StatusContainer>
66
+ <span>{t('CONNECTION_STATUS', 'Connection status')}</span>
67
+ <WebsocketStatusDot
68
+ status={socketStatus}
69
+ />
70
+ </StatusContainer>
71
+ </Button>
72
+
73
+ <Modal
74
+ open={openModal}
75
+ onClose={() => setOpenModal(false)}
76
+ width='500px'
77
+ >
78
+ <DetailContainer>
79
+ <h2>{t('CONNECTION_STATUS', 'Connection status')}</h2>
80
+ <p>{t('LAST_UPDATE', 'Last update')}: {parseDate(connectedDate)}</p>
81
+ <StatusItemWrapper>
82
+ <div>
83
+ <WebsocketStatusDot status={1} />
84
+ <span>{t('OK', 'Ok')}</span>
85
+ </div>
86
+ <p>{t('WEBSOCKET_OK', 'The websocket works normally.')}</p>
87
+ </StatusItemWrapper>
88
+ <StatusItemWrapper>
89
+ <div>
90
+ <WebsocketStatusDot status={0} />
91
+ <span>{t('CONNECTING', 'Connecting')}</span>
92
+ </div>
93
+ <p>{t('WEBSOCKET_CONNECTING', 'The websocket is connecting.')}</p>
94
+ </StatusItemWrapper>
95
+ <StatusItemWrapper>
96
+ <div>
97
+ <WebsocketStatusDot status={2} />
98
+ <span>{t('DISCONNECTED', 'Disconnected')}</span>
99
+ </div>
100
+ <p>{t('WEBSOCKET_DISCONNECTED', 'The server is slow, please reload.')}</p>
101
+ </StatusItemWrapper>
102
+ <ButtonsContainer>
103
+ <Button
104
+ color='secundary'
105
+ onClick={() => setOpenModal(false)}
106
+ >
107
+ {t('CLOSE', 'Close')}
108
+ </Button>
109
+ <Button
110
+ color='primary'
111
+ onClick={() => window.location.reload()}
112
+ >
113
+ {t('UPDATE', 'Update')}
114
+ </Button>
115
+ </ButtonsContainer>
116
+ </DetailContainer>
117
+ </Modal>
118
+
119
+ <Alert
120
+ title={t('ERROR', 'Error')}
121
+ content={alertState.content}
122
+ acceptText={t('ACCEPT', 'Accept')}
123
+ open={alertState.open}
124
+ onClose={() => closeAlert()}
125
+ onAccept={() => closeAlert()}
126
+ closeOnBackdrop={false}
127
+ />
128
+ </Contatiner>
129
+ )
130
+ }
131
+
132
+ export const WebsocketStatus = (props) => {
133
+ const socketProps = {
134
+ ...props,
135
+ UIComponent: SocketStatusUI
136
+ }
137
+ return <WebsocketStatusController {...socketProps} />
138
+ }
@@ -0,0 +1,171 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Contatiner = styled.div`
4
+ display: flex;
5
+ align-items: center;
6
+
7
+ > button {
8
+ height: 41px;
9
+ }
10
+
11
+ @media (min-width: 576px) {
12
+ ${props => props.theme?.rtl ? css`
13
+ margin-left: 10px;
14
+ ` : css`
15
+ margin-right: 10px;
16
+ `}
17
+ }
18
+ `
19
+
20
+ export const StatusContainer = styled.div`
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: space-between;
24
+
25
+ > span:first-child {
26
+ ${props => props.theme?.rtl ? css`
27
+ margin-left: 6px;
28
+ ` : css`
29
+ margin-right: 6px;
30
+ `}
31
+ }
32
+ `
33
+
34
+ export const WebsocketStatusDot = styled.span`
35
+ width: 8px;
36
+ height: 8px;
37
+ border-radius: 50%;
38
+ display: inline-block;
39
+
40
+ ${({ status }) => status === 0 && css`
41
+ background-color: #FF9922;
42
+ `}
43
+ ${({ status }) => status === 1 && css`
44
+ background-color: #00D27A;
45
+ `}
46
+ ${({ status }) => status === 2 && css`
47
+ background-color: #E63757;
48
+ `}
49
+ `
50
+ export const DateWrapper = styled.div`
51
+ font-size: 12px;
52
+ text-align: center;
53
+ `
54
+ export const InfoWrapper = styled.div`
55
+ position: relative;
56
+ ${props => props.theme?.rtl ? css`
57
+ margin-left: 4px;
58
+ ` : css`
59
+ margin-right: 4px;
60
+ `}
61
+
62
+ > button {
63
+ height: 25px;
64
+ svg {
65
+ width: 16px;
66
+ height: 16px;
67
+ }
68
+ }
69
+ &:hover > div {
70
+ visibility: visible;
71
+ opacity: 1;
72
+ }
73
+ `
74
+
75
+ export const InfoContent = styled.div`
76
+ position: absolute;
77
+ top: 100%;
78
+ z-index: 999;
79
+ background: ${props => props.theme.colors.backgroundInfo};
80
+ border: 1px solid ${props => props.theme.colors.primary};
81
+ box-sizing: border-box;
82
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
83
+ border-radius: 7.6px;
84
+ padding: 8px 12px;
85
+ font-size: 12px;
86
+ line-height: 18px;
87
+ min-width: 150px;
88
+ transition: all 0.3s linear;
89
+ visibility: hidden;
90
+ opacity: 0;
91
+ /* display: none; */
92
+ right: 0px;
93
+ ${props => props.theme.rtl && css`
94
+ left: 0px;
95
+ right: initial;
96
+ `}
97
+
98
+ a {
99
+ color: ${props => props.theme.colors.primary};
100
+ transition: all 0.3s linear;
101
+ cursor: pointer;
102
+ margin-left: 5px;
103
+ ${props => props.theme.rtl && css`
104
+ margin-left: 0px;
105
+ margin-right: 5px;
106
+ `}
107
+ &:hover {
108
+ text-decoration: underline;
109
+ }
110
+ }
111
+
112
+ @media (min-width: 576px) {
113
+ min-width: 350px;
114
+ padding: 12px 15px;
115
+ left: 0px;
116
+ ${props => props.theme.rtl && css`
117
+ right: 0px;
118
+ left: initial;
119
+ `}
120
+ }
121
+
122
+ @media (min-width: 993px) {
123
+ min-width: 535px;
124
+ }
125
+ `
126
+ export const DetailContainer = styled.div`
127
+ h2 {
128
+ font-weight: 700;
129
+ font-size: 20px;
130
+ line-height: 30px;
131
+ }
132
+
133
+ > p {
134
+ font-size: 14px;
135
+ }
136
+ `
137
+ export const StatusItemWrapper = styled.div`
138
+ > div {
139
+ display: flex;
140
+ align-items: center;
141
+
142
+ > span:first-child {
143
+ margin: 0 16px;
144
+ }
145
+ }
146
+ p {
147
+ font-weight: 400;
148
+ font-size: 12px;
149
+ line-height: 18px;
150
+ color: ${props => props.theme.colors.lightGray};
151
+
152
+ ${props => props.theme?.rtl ? css`
153
+ margin-right: 40px;
154
+ ` : css`
155
+ margin-left: 40px;
156
+ `}
157
+ }
158
+ `
159
+ export const ButtonsContainer = styled.div`
160
+ display: flex;
161
+ align-items: center;
162
+ margin-top: 40px;
163
+
164
+ > button {
165
+ border-radius: 8px;
166
+ height: 40px;
167
+ &:last-child {
168
+ margin: 0 10px;
169
+ }
170
+ }
171
+ `
@@ -1,3 +1,4 @@
1
+ import { AllInOne } from './AllInOne'
1
2
  import { Appointments } from './Appointments'
2
3
  import { DeliveriesManager } from './DeliveriesManager'
3
4
  import { DriversManager } from './DriversManager'
@@ -49,6 +50,7 @@ import { CountryFilter } from './CountryFilter'
49
50
  import { OrderToPrint } from './OrderToPrint'
50
51
 
51
52
  export {
53
+ AllInOne,
52
54
  Appointments,
53
55
  DeliveriesManager,
54
56
  DriversManager,
@@ -0,0 +1,127 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, useEvent, Settings as SettingsController } from 'ordering-components-admin-external'
3
+ import { GearFill } from 'react-bootstrap-icons'
4
+ import { SettingsDetail } from '../SettingsDetail'
5
+ import Skeleton from 'react-loading-skeleton'
6
+ import { useHistory, useLocation } from 'react-router-dom'
7
+ import {
8
+ CategorySection,
9
+ SettingList,
10
+ SettingItemContainer,
11
+ IconWrapper,
12
+ SettingItemContent
13
+ } from './styles'
14
+
15
+ const AnalyticsUI = (props) => {
16
+ const {
17
+ categoryList
18
+ } = props
19
+
20
+ const [, t] = useLanguage()
21
+ const [events] = useEvent()
22
+
23
+ const history = useHistory()
24
+ const query = new URLSearchParams(useLocation().search)
25
+
26
+ const allowOptions = ['facebook_pixel', 'segment', 'google']
27
+
28
+ const [selectedCategory, setSelectedCategory] = useState(null)
29
+ const [showDetail, setShowDetail] = useState(false)
30
+
31
+ const handleBackRedirect = () => {
32
+ setShowDetail(false)
33
+ setSelectedCategory(null)
34
+ history.replace(`${location.pathname}`)
35
+ }
36
+
37
+ const onBasicSettingsRedirect = ({ category }) => {
38
+ if (!category) {
39
+ return events.emit('go_to_page', { page: 'integrations', replace: true })
40
+ }
41
+ if (category) {
42
+ events.emit('go_to_page', {
43
+ page: 'integrations',
44
+ search: `?category=${category}`,
45
+ replace: true
46
+ })
47
+ }
48
+ }
49
+
50
+ const handleOpenSetting = (category, initialRender) => {
51
+ setSelectedCategory(category)
52
+ setShowDetail(true)
53
+ if (!initialRender) {
54
+ history.replace(`${location.pathname}?category=${category?.id}`)
55
+ }
56
+ }
57
+
58
+ useEffect(() => {
59
+ if (categoryList.loading) return
60
+ const categoryId = query.get('category')
61
+ if (categoryId) {
62
+ const categorySelected = categoryList?.categories.find(item => item?.id === parseInt(categoryId))
63
+ if (categorySelected) {
64
+ handleOpenSetting(categorySelected, true)
65
+ }
66
+ }
67
+ }, [categoryList.loading])
68
+
69
+ return (
70
+ <CategorySection>
71
+ <h2>{t('ANALYTICS', 'Analytics')}</h2>
72
+ {!categoryList?.loading && (
73
+ <SettingList>
74
+ {categoryList?.categories?.filter(item => allowOptions.includes(item.key)).map(setting => (
75
+ <SettingItemContainer
76
+ key={setting?.id}
77
+ onClick={() => handleOpenSetting(setting)}
78
+ >
79
+ <IconWrapper>
80
+ <GearFill />
81
+ </IconWrapper>
82
+ <SettingItemContent>
83
+ <h5>{setting?.name}</h5>
84
+ <p>{setting?.description}</p>
85
+ </SettingItemContent>
86
+ </SettingItemContainer>
87
+ ))}
88
+ </SettingList>
89
+ )}
90
+ {categoryList?.loading && (
91
+ <SettingList>
92
+ {[...Array(2).keys()].map(i => (
93
+ <SettingItemContainer
94
+ key={i}
95
+ >
96
+ <IconWrapper>
97
+ <Skeleton width={24} height={24} />
98
+ </IconWrapper>
99
+ <SettingItemContent>
100
+ <h5><Skeleton height={18} width={120} /></h5>
101
+ <p><Skeleton height={13} count={2} /></p>
102
+ </SettingItemContent>
103
+ </SettingItemContainer>
104
+ ))}
105
+ </SettingList>
106
+ )}
107
+ {showDetail && (
108
+ <SettingsDetail
109
+ {...props}
110
+ open={showDetail}
111
+ category={selectedCategory}
112
+ onClose={handleBackRedirect}
113
+ onBasicSettingsRedirect={onBasicSettingsRedirect}
114
+ />
115
+ )}
116
+ </CategorySection>
117
+ )
118
+ }
119
+
120
+ export const Analytics = (props) => {
121
+ const paymentGatewayProps = {
122
+ ...props,
123
+ UIComponent: AnalyticsUI,
124
+ settingsType: 'key_operation'
125
+ }
126
+ return <SettingsController {...paymentGatewayProps} />
127
+ }