ordering-ui-admin-external 1.15.1 → 1.16.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 (80) hide show
  1. package/_bundles/{ordering-ui-admin.7c0f4e22698e5dbd9b25.js → ordering-ui-admin.8e64a367ec831986000e.js} +2 -2
  2. package/_modules/components/Delivery/DeliveryUsersListing/index.js +11 -5
  3. package/_modules/components/Delivery/DriversGroupBusinesses/index.js +4 -2
  4. package/_modules/components/Delivery/DriversGroupBusinesses/styles.js +17 -14
  5. package/_modules/components/Delivery/DriversGroupDeliveryDetails/index.js +5 -2
  6. package/_modules/components/Delivery/DriversGroupDeliveryDetails/styles.js +9 -4
  7. package/_modules/components/Delivery/DriversGroupDetails/index.js +6 -3
  8. package/_modules/components/Delivery/DriversGroupGeneralForm/index.js +3 -1
  9. package/_modules/components/Delivery/DriversGroupGeneralForm/styles.js +8 -5
  10. package/_modules/components/Delivery/DriversGroupLogistics/index.js +5 -2
  11. package/_modules/components/Delivery/DriversGroupLogistics/styles.js +16 -13
  12. package/_modules/components/Delivery/DriversGroupLogs/index.js +8 -4
  13. package/_modules/components/Delivery/DriversGroupLogs/styles.js +19 -16
  14. package/_modules/components/Delivery/DriversGroupPaymethods/index.js +5 -2
  15. package/_modules/components/Delivery/DriversGroupPaymethods/styles.js +14 -11
  16. package/_modules/components/Delivery/DriversGroupsList/index.js +5 -2
  17. package/_modules/components/Delivery/DriversGroupsList/styles.js +5 -2
  18. package/_modules/components/Delivery/DriversGroupsListing/index.js +9 -5
  19. package/_modules/components/Delivery/UserAddForm/index.js +29 -3
  20. package/_modules/components/Delivery/UserAddForm/styles.js +21 -3
  21. package/_modules/components/Delivery/UserDetails/index.js +9 -4
  22. package/_modules/components/Delivery/UsersList/index.js +6 -3
  23. package/_modules/components/Delivery/UsersList/styles.js +10 -7
  24. package/_modules/components/Delivery/UsersListingHeader/index.js +8 -4
  25. package/_modules/components/MyProducts/OrderingWidgets/index.js +77 -0
  26. package/_modules/components/MyProducts/OrderingWidgets/styles.js +29 -0
  27. package/_modules/components/MyProducts/index.js +8 -1
  28. package/_modules/components/Orders/GiftCardsListing/index.js +144 -0
  29. package/_modules/components/Orders/GiftCardsListing/styles.js +57 -0
  30. package/_modules/components/Orders/OrderBill/index.js +5 -3
  31. package/_modules/components/Orders/OrderDetails/index.js +11 -11
  32. package/_modules/components/Orders/index.js +7 -0
  33. package/_modules/components/SidebarMenu/index.js +5 -0
  34. package/_modules/components/Stores/PaymentOption/index.js +4 -4
  35. package/_modules/components/Users/UsersDeleteButton/index.js +3 -2
  36. package/_modules/components/Users/UsersExportCSV/index.js +3 -2
  37. package/_modules/index.js +12 -0
  38. package/package.json +2 -2
  39. package/src/components/Delivery/DeliveryUsersListing/index.js +7 -2
  40. package/src/components/Delivery/DriversGroupBusinesses/index.js +3 -1
  41. package/src/components/Delivery/DriversGroupBusinesses/styles.js +4 -0
  42. package/src/components/Delivery/DriversGroupDeliveryDetails/index.js +5 -2
  43. package/src/components/Delivery/DriversGroupDeliveryDetails/styles.js +5 -1
  44. package/src/components/Delivery/DriversGroupDetails/index.js +4 -1
  45. package/src/components/Delivery/DriversGroupGeneralForm/index.js +2 -1
  46. package/src/components/Delivery/DriversGroupGeneralForm/styles.js +4 -0
  47. package/src/components/Delivery/DriversGroupLogistics/index.js +5 -2
  48. package/src/components/Delivery/DriversGroupLogistics/styles.js +4 -0
  49. package/src/components/Delivery/DriversGroupLogs/index.js +6 -3
  50. package/src/components/Delivery/DriversGroupLogs/styles.js +4 -0
  51. package/src/components/Delivery/DriversGroupPaymethods/index.js +5 -2
  52. package/src/components/Delivery/DriversGroupPaymethods/styles.js +4 -0
  53. package/src/components/Delivery/DriversGroupsList/index.js +4 -1
  54. package/src/components/Delivery/DriversGroupsList/styles.js +6 -0
  55. package/src/components/Delivery/DriversGroupsListing/index.js +6 -2
  56. package/src/components/Delivery/UserAddForm/index.js +42 -3
  57. package/src/components/Delivery/UserAddForm/styles.js +34 -0
  58. package/src/components/Delivery/UserDetails/index.js +6 -4
  59. package/src/components/Delivery/UsersList/index.js +8 -3
  60. package/src/components/Delivery/UsersList/styles.js +5 -0
  61. package/src/components/Delivery/UsersListingHeader/index.js +5 -1
  62. package/src/components/MyProducts/OrderingWidgets/index.js +118 -0
  63. package/src/components/MyProducts/OrderingWidgets/styles.js +84 -0
  64. package/src/components/MyProducts/index.js +3 -1
  65. package/src/components/Orders/GiftCardsListing/index.js +178 -0
  66. package/src/components/Orders/GiftCardsListing/styles.js +116 -0
  67. package/src/components/Orders/OrderBill/index.js +5 -1
  68. package/src/components/Orders/OrderDetails/index.js +11 -11
  69. package/src/components/Orders/index.js +2 -0
  70. package/src/components/SidebarMenu/index.js +6 -0
  71. package/src/components/Stores/PaymentOption/index.js +1 -1
  72. package/src/components/Users/UsersDeleteButton/index.js +3 -2
  73. package/src/components/Users/UsersExportCSV/index.js +3 -2
  74. package/src/index.js +5 -1
  75. package/template/app.js +8 -1
  76. package/template/components/ListenPageChanges/index.js +2 -0
  77. package/template/helmetdata.json +7 -0
  78. package/template/pages/GiftCardsList/index.js +12 -0
  79. package/template/pages/OrderingWidgets/index.js +12 -0
  80. /package/_bundles/{ordering-ui-admin.7c0f4e22698e5dbd9b25.js.LICENSE.txt → ordering-ui-admin.8e64a367ec831986000e.js.LICENSE.txt} +0 -0
@@ -23,7 +23,8 @@ export const DriversGroupLogistics = (props) => {
23
23
  changesState,
24
24
  handleChangesState,
25
25
  handleParentSidebarMove,
26
- handleUpdateDriversGroup
26
+ handleUpdateDriversGroup,
27
+ actionDisabled
27
28
  } = props
28
29
 
29
30
  const history = useHistory()
@@ -74,7 +75,9 @@ export const DriversGroupLogistics = (props) => {
74
75
  }, [])
75
76
 
76
77
  return (
77
- <LogisticsContainer>
78
+ <LogisticsContainer
79
+ disabled={actionDisabled}
80
+ >
78
81
  <OrderStatusWrapper
79
82
  onClick={() => handleChangesState({ orders_group_start_in_status: 7 })}
80
83
  >
@@ -3,6 +3,10 @@ import styled, { css } from 'styled-components'
3
3
  export const LogisticsContainer = styled.div`
4
4
  padding: 20px 0;
5
5
  min-height: calc(100% - 120px);
6
+ ${({ disabled }) => disabled && css`
7
+ opacity: 0.7;
8
+ pointer-events: none;
9
+ `}
6
10
 
7
11
  > button {
8
12
  position: sticky;
@@ -18,7 +18,8 @@ const DriversGroupLogsUI = (props) => {
18
18
  const {
19
19
  logsList,
20
20
  paginationProps,
21
- getDriversGroupLogs
21
+ getDriversGroupLogs,
22
+ actionDisabled
22
23
  } = props
23
24
 
24
25
  const [, t] = useLanguage()
@@ -72,7 +73,9 @@ const DriversGroupLogsUI = (props) => {
72
73
 
73
74
  return (
74
75
  <>
75
- <DriversGroupLogsContainer>
76
+ <DriversGroupLogsContainer
77
+ disabled={actionDisabled}
78
+ >
76
79
  <TableWrapper>
77
80
  {(logsList.loading || logsList.logs.length > 0) ? (
78
81
  <Table>
@@ -117,7 +120,7 @@ const DriversGroupLogsUI = (props) => {
117
120
  </tbody>
118
121
  ))
119
122
  ) : (
120
- logsList.logs.map(log => (
123
+ !logsList.error && logsList.logs?.map(log => (
121
124
  <tbody key={log.id}>
122
125
  <tr>
123
126
  <td>
@@ -2,6 +2,10 @@ import styled, { css } from 'styled-components'
2
2
 
3
3
  export const DriversGroupLogsContainer = styled.div`
4
4
  height: calc(100% - 180px);
5
+ ${({ disabled }) => disabled && css`
6
+ opacity: 0.7;
7
+ pointer-events: none;
8
+ `}
5
9
  `
6
10
 
7
11
  export const TableWrapper = styled.div`
@@ -21,7 +21,8 @@ export const DriversGroupPaymethods = (props) => {
21
21
  handleUpdateDriversGroup,
22
22
  handleAddDriversGroup,
23
23
  handleSelectPaymethod,
24
- handleSelectAllPaymethod
24
+ handleSelectAllPaymethod,
25
+ actionDisabled
25
26
  } = props
26
27
  const [, t] = useLanguage()
27
28
  const [searchValue, setSearchValue] = useState(null)
@@ -39,7 +40,9 @@ export const DriversGroupPaymethods = (props) => {
39
40
 
40
41
  return (
41
42
  <>
42
- <Container>
43
+ <Container
44
+ disabled={actionDisabled}
45
+ >
43
46
  <SearchBarWrapper>
44
47
  <SearchBar
45
48
  placeholder={t('SEARCH', 'Search')}
@@ -2,6 +2,10 @@ import styled, { css } from 'styled-components'
2
2
 
3
3
  export const Container = styled.div`
4
4
  height: calc(100% - 160px);
5
+ ${({ disabled }) => disabled && css`
6
+ opacity: 0.7;
7
+ pointer-events: none;
8
+ `}
5
9
  > button {
6
10
  position: sticky;
7
11
  top: 100%;
@@ -34,7 +34,8 @@ export const DriversGroupsList = (props) => {
34
34
  selectedGroupList,
35
35
  isFromStore,
36
36
  handleSelectGroup,
37
- handleAllSelectGroup
37
+ handleAllSelectGroup,
38
+ actionDisabled
38
39
  } = props
39
40
 
40
41
  const [, t] = useLanguage()
@@ -218,6 +219,7 @@ export const DriversGroupsList = (props) => {
218
219
  <EnableWrapper className='group-enabled'>
219
220
  <span>{t('ENABLE', 'Enable')}</span>
220
221
  <Switch
222
+ disabled={actionDisabled}
221
223
  defaultChecked={group?.enabled}
222
224
  onChange={enabled => handleUpdateDriversGroup?.(group.id, { enabled: enabled })}
223
225
  />
@@ -235,6 +237,7 @@ export const DriversGroupsList = (props) => {
235
237
  {!isFromStore && (
236
238
  <AddNewGroupButton
237
239
  onClick={() => handleOpenDetails(null)}
240
+ disabled={actionDisabled}
238
241
  >
239
242
  {t('ADD_NEW_DRIVER_GROUP', 'Add new driver group')}
240
243
  </AddNewGroupButton>
@@ -222,4 +222,10 @@ export const AddNewGroupButton = styled.div`
222
222
  cursor: pointer;
223
223
  font-size: 12px;
224
224
  color: ${props => props.theme.colors.primary};
225
+
226
+ ${({ disabled }) => disabled && css`
227
+ opacity: 0.5;
228
+ cursor: not-allowed;
229
+ pointer-events: none;
230
+ `}
225
231
  `
@@ -33,7 +33,8 @@ const DriversGroupsListingUI = (props) => {
33
33
  actionState,
34
34
  handleUpdateDriversGroup,
35
35
  handleDeleteDriversGroup,
36
- driversCompanyList
36
+ driversCompanyList,
37
+ actionDisabled
37
38
  } = props
38
39
 
39
40
  const history = useHistory()
@@ -170,13 +171,14 @@ const DriversGroupsListingUI = (props) => {
170
171
  color='lightPrimary'
171
172
  data-tour='tour_add_group'
172
173
  onClick={() => handleOpenDetails(null)}
174
+ disabled={actionDisabled}
173
175
  >
174
176
  {t('ADD_DRIVER_GROUP', 'Add driver group')}
175
177
  </Button>
176
178
  <Button
177
179
  borderRadius='8px'
178
180
  color='secundary'
179
- disabled={selectedGroupList.length === 0}
181
+ disabled={selectedGroupList.length === 0 || actionDisabled}
180
182
  onClick={() => onClickSelectedGroupsDelete()}
181
183
  >
182
184
  {t('DELETE', 'Delete')}
@@ -199,6 +201,7 @@ const DriversGroupsListingUI = (props) => {
199
201
  selectedGroupList={selectedGroupList}
200
202
  handleSelectGroup={handleSelectGroup}
201
203
  handleAllSelectGroup={handleAllSelectGroup}
204
+ actionDisabled={actionDisabled}
202
205
  />
203
206
  </DriversGroupsListingContainer>
204
207
  {openDetails && (
@@ -232,6 +235,7 @@ const DriversGroupsListingUI = (props) => {
232
235
  }}
233
236
  isTourOpen={isTourOpen}
234
237
  handleNextTour={handleNextTour}
238
+ actionDisabled={actionDisabled}
235
239
  />
236
240
  </SideBar>
237
241
  )}
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react'
2
2
  import { useForm } from 'react-hook-form'
3
3
  import {
4
4
  useLanguage,
5
+ useSession,
5
6
  useEvent,
6
7
  DragAndDrop,
7
8
  ExamineClick,
@@ -14,6 +15,8 @@ import parsePhoneNumber from 'libphonenumber-js'
14
15
  import Skeleton from 'react-loading-skeleton'
15
16
  import BiImage from '@meronex/icons/bi/BiImage'
16
17
  import { useWindowSize } from '../../../hooks/useWindowSize'
18
+ import MdCheckBoxOutlineBlank from '@meronex/icons/md/MdCheckBoxOutlineBlank'
19
+ import MdCheckBox from '@meronex/icons/md/MdCheckBox'
17
20
 
18
21
  import {
19
22
  FormContainer,
@@ -25,7 +28,10 @@ import {
25
28
  FormInput,
26
29
  ActionsForm,
27
30
  SkeletonForm,
28
- MainInformationContainer
31
+ MainInformationContainer,
32
+ DriverGroupListContainer,
33
+ DriverGroupItem,
34
+ CheckboxWrapper
29
35
  } from './styles'
30
36
 
31
37
  const UserAddFormUI = (props) => {
@@ -42,13 +48,16 @@ const UserAddFormUI = (props) => {
42
48
  isDriversPage,
43
49
  isDriversManagersPage,
44
50
  handleChangeSwtich,
45
-
46
- isTourOpen
51
+ isTourOpen,
52
+ driversGroupsState,
53
+ selectedDriverGroupIds,
54
+ handleDriverGroupClick
47
55
  } = props
48
56
  const formMethods = useForm()
49
57
  const [, t] = useLanguage()
50
58
  const [events] = useEvent()
51
59
  const { width } = useWindowSize()
60
+ const [session] = useSession()
52
61
 
53
62
  const [isValidPhoneNumber, setIsValidPhoneNumber] = useState(null)
54
63
  const [userPhoneNumber, setUserPhoneNumber] = useState(null)
@@ -349,6 +358,36 @@ const UserAddFormUI = (props) => {
349
358
  props.afterMidComponents?.map((MidComponent, i) => (
350
359
  <MidComponent key={i} {...props} />))
351
360
  }
361
+ {isDriversPage && session?.user?.level === 5 && (
362
+ <DriverGroupListContainer>
363
+ {driversGroupsState.loading ? (
364
+ [...Array(10).keys()].map(i => (
365
+ <DriverGroupItem key={i}>
366
+ <Skeleton width={20} height={20} />
367
+ <Skeleton width={100} />
368
+ </DriverGroupItem>
369
+ ))
370
+ ) : (
371
+ driversGroupsState.groups.map(group => (
372
+ <DriverGroupItem
373
+ key={group.id}
374
+ onClick={() => handleDriverGroupClick(group.id)}
375
+ >
376
+ <CheckboxWrapper
377
+ active={selectedDriverGroupIds.includes(group.id)}
378
+ >
379
+ {selectedDriverGroupIds.includes(group.id) ? (
380
+ <MdCheckBox />
381
+ ) : (
382
+ <MdCheckBoxOutlineBlank />
383
+ )}
384
+ </CheckboxWrapper>
385
+ <span>{group?.name}</span>
386
+ </DriverGroupItem>
387
+ ))
388
+ )}
389
+ </DriverGroupListContainer>
390
+ )}
352
391
  <ActionsForm>
353
392
  <Button
354
393
  color='primary'
@@ -188,3 +188,37 @@ export const SkeletonForm = styled.div`
188
188
  export const MainInformationContainer = styled.div`
189
189
  flex: 1;
190
190
  `
191
+
192
+ export const DriverGroupListContainer = styled.div`
193
+ margin: 15px 0;
194
+ `
195
+
196
+ export const DriverGroupItem = styled.div`
197
+ display: flex;
198
+ align-items: center;
199
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
200
+ padding: 12px 0;
201
+ cursor: pointer;
202
+
203
+ > span {
204
+ font-size: 14px;
205
+ ${props => props.theme?.rtl ? css`
206
+ margin-right: 15px;
207
+ ` : css`
208
+ margin-left: 15px;
209
+ `}
210
+ }
211
+ `
212
+
213
+ export const CheckboxWrapper = styled.div`
214
+ svg {
215
+ font-size: 20px;
216
+ color: ${props => props.theme.colors.lightGray};
217
+ }
218
+
219
+ ${({ active }) => active && css`
220
+ svg {
221
+ color: ${props => props.theme.colors.primary};
222
+ }
223
+ `}
224
+ `
@@ -36,7 +36,8 @@ export const UserDetailsUI = (props) => {
36
36
  handleChangeActiveUser,
37
37
  scheduleState,
38
38
  handleScheduleState,
39
- handleScheduleUpdateUser
39
+ handleScheduleUpdateUser,
40
+ actionDisabled
40
41
  } = props
41
42
 
42
43
  const history = useHistory()
@@ -98,6 +99,7 @@ export const UserDetailsUI = (props) => {
98
99
  <>
99
100
  {handleChangeActiveUser && (
100
101
  <Switch
102
+ disabled={actionDisabled}
101
103
  defaultChecked={userState?.user?.enabled || false}
102
104
  onChange={enabled => handleChangeActiveUser({ id: userState?.user?.id, enabled: enabled })}
103
105
  />
@@ -121,13 +123,13 @@ export const UserDetailsUI = (props) => {
121
123
  title={<ThreeDots />}
122
124
  id={theme?.rtl ? 'dropdown-menu-align-left' : 'dropdown-menu-align-right'}
123
125
  >
124
- <Dropdown.Item onClick={() => setIsCustomField(true)}>
126
+ <Dropdown.Item onClick={() => setIsCustomField(true)} disabled={actionDisabled}>
125
127
  {t('CUSTOM_FIELDS', 'Custom fields')}
126
128
  </Dropdown.Item>
127
- <Dropdown.Item onClick={() => setIsPersonalization(true)}>
129
+ <Dropdown.Item onClick={() => setIsPersonalization(true)} disabled={actionDisabled}>
128
130
  {t('PERSONALIZATION', 'Personalization')}
129
131
  </Dropdown.Item>
130
- <Dropdown.Item onClick={() => handleDeleteUser(userState.user?.id)}>
132
+ <Dropdown.Item onClick={() => handleDeleteUser(userState.user?.id)} disabled={actionDisabled}>
131
133
  {t('DELETE', 'Delete')}
132
134
  </Dropdown.Item>
133
135
  </DropdownButton>
@@ -41,7 +41,8 @@ export const UsersList = (props) => {
41
41
  handleOpenUserDetails,
42
42
  handleOpenUserAddForm,
43
43
  isDriversPage,
44
- isDriversManagersPage
44
+ isDriversManagersPage,
45
+ actionDisabled
45
46
  } = props
46
47
 
47
48
  const [, t] = useLanguage()
@@ -123,7 +124,7 @@ export const UsersList = (props) => {
123
124
  <th>{t('USER', 'User')}</th>
124
125
  <th>{t('DETAILS', 'Details')}</th>
125
126
  <th />
126
- <th colspan={2}>{t('ACTION', 'Action')}</th>
127
+ <th colSpan={2}>{t('ACTION', 'Action')}</th>
127
128
  </tr>
128
129
  </thead>
129
130
  {usersList.loading ? (
@@ -238,6 +239,7 @@ export const UsersList = (props) => {
238
239
  <UserEnableWrapper className='user_enable_control'>
239
240
  <span>{t('ENABLE', 'Enable')}</span>
240
241
  <Switch
242
+ disabled={actionDisabled}
241
243
  notAsync={user.level === 0}
242
244
  defaultChecked={user?.enabled}
243
245
  onChange={enabled => handleEnable(user, enabled)}
@@ -251,7 +253,10 @@ export const UsersList = (props) => {
251
253
  </UsersTable>
252
254
  </UserTableWrapper>
253
255
  <UsersBottomContainer>
254
- <AddNewUserButton onClick={() => handleOpenUserAddForm()}>
256
+ <AddNewUserButton
257
+ onClick={() => handleOpenUserAddForm()}
258
+ disabled={actionDisabled}
259
+ >
255
260
  {
256
261
  isDriversPage
257
262
  ? t('ADD_NEW_DRIVER', 'Add new driver')
@@ -214,6 +214,11 @@ export const AddNewUserButton = styled.div`
214
214
  color: ${props => props.theme.colors.primary};
215
215
  width: fit-content;
216
216
  font-size: 14px;
217
+
218
+ ${({ disabled }) => disabled && css`
219
+ opacity: 0.5;
220
+ pointer-events: none;
221
+ `}
217
222
  `
218
223
 
219
224
  export const UsersBottomContainer = styled.div`
@@ -29,7 +29,8 @@ export const UsersListingHeader = (props) => {
29
29
  isDriversPage,
30
30
  isDriversManagersPage,
31
31
 
32
- handleOpenTour
32
+ handleOpenTour,
33
+ actionDisabled
33
34
  } = props
34
35
 
35
36
  const [, t] = useLanguage()
@@ -72,6 +73,7 @@ export const UsersListingHeader = (props) => {
72
73
  color='lightPrimary'
73
74
  onClick={() => handleOpenUserAddForm()}
74
75
  data-tour='tour_add'
76
+ disabled={actionDisabled}
75
77
  >
76
78
  {
77
79
  isDriversPage
@@ -86,11 +88,13 @@ export const UsersListingHeader = (props) => {
86
88
  disabledActiveStateCondition={disabledActiveStateCondition}
87
89
  userTypesSelected={userTypesSelected}
88
90
  selectedUserActiveState={selectedUserActiveState}
91
+ disabled={actionDisabled}
89
92
  />
90
93
  <UsersDeleteButton
91
94
  selectedUsers={selectedUsers}
92
95
  deleteUsersActionState={deleteUsersActionState}
93
96
  handleDeleteSeveralUsers={handleDeleteSeveralUsers}
97
+ disabled={actionDisabled}
94
98
  />
95
99
  <SearchBar
96
100
  lazyLoad
@@ -0,0 +1,118 @@
1
+ import React from 'react'
2
+ import { useLanguage, useApi } from 'ordering-components-admin-external'
3
+ import { useTheme } from 'styled-components'
4
+ import { useInfoShare } from '../../../contexts/InfoShareContext'
5
+ import { IconButton, Input, TextArea } from '../../../styles'
6
+ import { List as MenuIcon } from 'react-bootstrap-icons'
7
+ import {
8
+ Container,
9
+ HeaderTitleContainer,
10
+ Content,
11
+ PopupContainer,
12
+ FormGroup,
13
+ InlineContainer
14
+ } from './styles'
15
+
16
+ export const OrderingWidgets = () => {
17
+ const [, t] = useLanguage()
18
+ const theme = useTheme()
19
+ const [ordering] = useApi()
20
+ const [{ isCollapse }, { handleMenuCollapse }] = useInfoShare()
21
+
22
+ const url = `https://${ordering.project}.tryordering.com`
23
+ const color = theme.colors.primary
24
+ const widgetPopup = '<script type="text/javascript">window.onload=function(){function e(e,t){return!0===e||!1===e?e:t}function t(){return!!(navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i))}"undefined"==typeof orderingSettings&&(orderingSettings={});var i=orderingSettings,o=e(i.openOnMobile,!1),n=e(i.openOnDesktop,!1),s=!1,l=document.createElement("div");l.id="ordering_bot",l.style.height=0,l.style.width=0,l.style.position="fixed",l.style.right="20%",l.style.left="20%",l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px",l.style.overflow="hidden",l.style.zIndex=99999,l.style.maxheight=window.innerHeight+"px",l.style["-webkit-transition"]="height 0.5s, width 0.5s",l.style["-moz-transition"]="height 0.5s, width 0.5s",l.style["-ms-transition"]="height 0.5s, width 0.5s",l.style["-o-transition"]="height 0.5s, width 0.5s",l.style.transition="height 0.5s, width 0.5s",l.style["-webkit-overflow-scrolling"]="touch",l.style["overflow-y"]="scroll",l.style.boxShadow="0 0 20px 0 #999";var r={insideIframe:!1};document.addEventListener("scroll",function(e){r.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var d=document.createElement("div");d.style.height="40px",d.style.background="#ccc",d.style.width="100%",d.style.position="absolute";var a=document.createElement("div");a.style.height="40px",a.style.width="40px",a.style.float="right",a.style.fontSize="28px",a.style.lineHeight="25px",a.style.padding="5px",a.style.textAlign="center",a.style.boxSizing="border-box",a.style.color="#666",a.style.borderLeft="1px solid #bbb",a.style.cursor="pointer",a.innerHTML="&times;",d.appendChild(a);var h=document.createElement("iframe");function y(){s?(l.style.height="auto",l.style.width="auto",window.innerWidth<=480?(l.style.right=0,l.style.left=0,l.style.top=0,l.style.bottom=0,l.style.borderRadius=0):(window.innerWidth>480&&window.innerWidth<600?(l.style.left="10%",l.style.right="10%"):(l.style.left="20%",l.style.right="20%"),l.style.top="7%",l.style.bottom="7%",l.style.borderRadius="5px")):(l.style.height="0px",l.style.width="0px")}h.id="ordering_iframe",h.src="' + url + '",h.style.border=0,h.style.height="100%",h.style.width="100%",h.style.maxWidth="none",h.style.paddingTop="40px",h.style.boxSizing="border-box",h.style["-webkit-overflow-scrolling"]="touch",l.appendChild(d),l.appendChild(h),document.getElementsByTagName("body")[0].appendChild(l),window.toggleOrderingWidget=function(){(s=!s)?(t()&&(r.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),r.insideIframe=!0,r.scrollX=window.scrollX,r.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")):(t()&&(r.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),r.insideIframe=!1,t()||(document.body.style.overflow="auto")),y()},y(),window.onresize=y,(t()&&o&&!(navigator.userAgent.match(/iPad/i)||(navigator.userAgent.match(/iPhone/i)||void 0))||!t()&&n)&&toggleOrderingWidget(),a.addEventListener("click",toggleOrderingWidget)};</script>'
25
+ const widgetBot = '<script type="text/javascript">window.onload=function(){function e(e,t){return e===!0||e===!1||void 0!=e||null!=e?e:t}function t(){return navigator.userAgent.match(/Android/i)||navigator.userAgent.match(/webOS/i)||navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPod/i)||navigator.userAgent.match(/BlackBerry/i)||navigator.userAgent.match(/Windows Phone/i)?!0:!1}function n(){return navigator.userAgent.match(/iPad/i)?"iPad":navigator.userAgent.match(/iPhone/i)?"iPhone":void 0}function i(){h=!h,h?(t()&&(w.insideIframe=!0,document.body.style.overflow="hidden",document.body.style.height=window.innerHeight-150+"px"),g.innerHTML=p.outerHTML):(t()&&(w.insideIframe=!1,document.body.style.overflow="auto",document.body.style.height="auto"),g.innerHTML=c.outerHTML),o(m)}function o(e){e.style.height=s(),e.style.width=r(),window.innerWidth<=480&&(e.style.top=0,e.style.left=0,e.style.right=0,e.style.bottom=0)}function s(){if(h){if(window.innerWidth<=480)return"100%";var e=window.innerHeight-70-10-20;return (e>570&&y.type=="chat")?"570px":e+"px"}return"0px"}function r(){return h?window.innerWidth<=480?"100%":"chat"==y.type?"370px":window.innerWidth-40+"px":"0px"}function l(){console.log("onresize"),window.innerWidth<=480?(m.style.position="fixed",m.style.bottom=0,m.style.right=0,m.style.borderRadius=0,f.style.display="block"):(m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",f.style.display="none"),m.style.height=s(),m.style.width=r()}var d="' + url + '";"undefined"==typeof orderingSettings&&(orderingSettings={});var a=orderingSettings,y={openOnMobile:e(a.openOnMobile,!1),openOnDesktop:e(a.openOnDesktop,!1),type:e(a.type,"chat")},h=!1,g=document.createElement("div"),c=document.createElement("img");c.src="https://orderingweb.ordering.co/templates/web/img/icon.png",c.style.width="30px",c.style.marginTop="9px",c.style.maxWidth="none";var p=document.createElement("div");p.innerHTML="&times;",p.style.display="block",p.style.color="#fff",p.style.font="Arial",p.style.fontSize="30px",p.style.margin="0 5px",p.style.borderRadius="50px",p.style.width="40px",p.style.height="40px",p.style.lineHeight="47px",p.style.fontWeight="400",g.style.position="fixed",g.style.bottom="20px",g.style.right="20px",g.style.width="50px",g.style.height="50px",g.style.background="' + color + '",g.style.borderRadius="50px",g.style.textAlign="center",g.style.cursor="pointer",g.style.outline="none",g.style.border=0,g.style.zIndex=99999,g.appendChild(c);var m=document.createElement("div");m.id="ordering_bot",m.style.height=0,m.style.width=0,m.style.position="fixed",m.style.bottom="80px",m.style.right="20px",m.style.borderRadius="10px",m.style.overflow="hidden",m.style.zIndex=99999,m.style.maxheight=window.innerHeight+"px",m.style["-webkit-transition"]="height 0.5s, width 0.5s",m.style["-moz-transition"]="height 0.5s, width 0.5s",m.style["-ms-transition"]="height 0.5s, width 0.5s",m.style["-o-transition"]="height 0.5s, width 0.5s",m.style.transition="height 0.5s, width 0.5s";var u=document.createElement("iframe");u.id="ordering_bot_iframe",u.src=d,u.setAttribute("allow", "geolocation"),u.style.border=0,u.style.height="125%",u.style.width="125%",u.style.maxWidth="none",u.style["-ms-zoom"]="0.8",u.style["-moz-transform"]="scale(0.8)",u.style["-moz-transform-origin"]="0 0",u.style["-o-transform"]="scale(0.8)",u.style["-o-transform-origin"]="0 0",u.style["-webkit-transform"]="scale(0.8)",u.style["-webkit-transform-origin"]="0 0";var w={insideIframe:!1};m.addEventListener("mouseenter",function(){w.insideIframe=!0,w.scrollX=window.scrollX,w.scrollY=window.scrollY,t()||(document.body.style.overflow="hidden")}),m.addEventListener("mouseleave",function(){w.insideIframe=!1,t()||(document.body.style.overflow="auto")}),document.addEventListener("scroll",function(e){w.insideIframe&&(e.preventDefault(),window.scrollTo(0,0))});var f=document.createElement("div");f.style.position="absolute",f.style.width="35px",f.style.height="35px",f.style.bottom="45px",f.style.left="50%",f.style.lineHeight="36px",f.style.background="transparent",f.style.borderColor="transparent";var x=document.createElement("div");x.innerHTML="&times;",x.style.position="relative",x.style.left="-50%",x.style.zIndex="999",x.style.width="40px",x.style.height="40px",x.style.background="rgba(0,0,0,0.2)",x.style.textAlign="center",x.style.border=0,x.style.borderRadius="35px",x.style.color="#fff",x.style.fontSize="30px",x.style.outline="none",x.style.cursor="pointer",f.appendChild(x),m.appendChild(f),m.appendChild(u),document.getElementsByTagName("body")[0].appendChild(g),document.getElementsByTagName("body")[0].appendChild(m),window.toggleOrderingWidget=i,g.onclick=i,f.onclick=i,l(),window.onresize=l,(t()&&y.openOnMobile&&!n()||!t()&&y.openOnDesktop)&&i(),setInterval(function(){n()&&window.innerHeight<m.clientHeight&&(u.style.height=.7*window.innerHeight+"px"),n()&&window.innerHeight==m.clientHeight&&(m.style.bottom=0,u.style.height="125%")},2e3)};</script>'
26
+ const widgetInline = '<script type="text/javascript">var orderingInlineSettings = {baseUrl: "/"};</script><script type="text/javascript">window.onload=function(){var i={baseUrl:orderingInlineSettings&&orderingInlineSettings.baseUrl?orderingInlineSettings.baseUrl:"/inline/"},l=location.href.split(i.baseUrl)[0],e=location.href.split(i.baseUrl)[1],a="' + url + '",r=document.createElement("iframe");r.id="ordering_iframe",r.src=(a+"/"+e).replace(/([^:]\\/)\\/+/g,"$1"),r.style.border=0,r.style.height="100%",r.style.width="100%",r.style.maxWidth="none",r.allow="geolocation";var d=document.getElementById("ordering_iframe_inline");d.appendChild(r),r.addEventListener("load",function(){t(),setInterval(function(){var e=JSON.stringify({event:"body",data:{}});r.contentWindow.postMessage(e,a)},100)});function t(){var e=document.documentElement,t=window.innerwidth||e.clientWidth,n=window.innerHeight||e.clientHeight,o=(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),i=(window.pageYOffset||e.scrollTop)-(e.clientTop||0),l=JSON.stringify({event:"scroll",data:{top:i,left:o,width:t,height:n,offsetTop:s(r).top}});r.contentWindow.postMessage(l,a)}function s(e){for(var t=0,n=0;t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent;);return{top:t,left:n}}window.addEventListener("message",function(e){var t=e.data;if("body"==t.event)d.style.height=t.data.height+"px";else if("scroll"==t.event)t.data.enable?document.getElementsByTagName("body")[0].style.overflowY="auto":document.getElementsByTagName("body")[0].style.overflowY="hidden";else if("url"==t.event){var n=document.createElement("a");n.href=t.data;var o=((l?l+"/":"")+i.baseUrl+"/"+n.pathname).replace(/([^:]\\/)\\/+/g,"$1");window.history.pushState("","",o),"http://localhost/"!=t.data&&window.scrollTo(0,s(r).top)}},!1),window.onscroll=function(e){t()}};</script><div style="height: 1000px;" id="ordering_iframe_inline"></div>'
27
+
28
+ return (
29
+ <Container>
30
+ <HeaderTitleContainer>
31
+ {isCollapse && (
32
+ <IconButton
33
+ color='black'
34
+ onClick={() => handleMenuCollapse(false)}
35
+ >
36
+ <MenuIcon />
37
+ </IconButton>
38
+ )}
39
+ <h1>{t('ORDERING_WIDGETS', 'Ordering Widgets')}</h1>
40
+ </HeaderTitleContainer>
41
+ <Content>
42
+ <PopupContainer>
43
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('POPUP', 'Popup')}</h2>
44
+ <h3>{t('BUTTON_WITH_MODAL_STYLE', 'Button with modal style')}</h3>
45
+ <FormGroup>
46
+ <label>1* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
47
+ <Input
48
+ placeholder={t('CODE', 'Code')}
49
+ defaultValue={`<button onclick="toggleOrderingWidget()">${t('Online_Ordering', 'Online Ordering')}</button>`}
50
+ disabled
51
+ />
52
+ </FormGroup>
53
+ <FormGroup>
54
+ <label>2* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
55
+ <Input
56
+ placeholder={t('CODE', 'Code')}
57
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
58
+ disabled
59
+ />
60
+ </FormGroup>
61
+ <FormGroup>
62
+ <label>3* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
63
+ <TextArea
64
+ placeholder={t('CODE', 'Code')}
65
+ value={widgetPopup}
66
+ disabled
67
+ />
68
+ </FormGroup>
69
+ <h3>{t('CHAT_STYLE_INTEGRATION', 'Chat style integration')}</h3>
70
+ <FormGroup>
71
+ <label>1* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
72
+ <Input
73
+ placeholder={t('CODE', 'Code')}
74
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
75
+ disabled
76
+ />
77
+ </FormGroup>
78
+ <FormGroup>
79
+ <label>2* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')}</label>
80
+ <TextArea
81
+ placeholder={t('CODE', 'Code')}
82
+ value={widgetBot}
83
+ disabled
84
+ />
85
+ </FormGroup>
86
+ </PopupContainer>
87
+ <InlineContainer>
88
+ <h2>{t('INTEGRATION_WEBSITE', 'Integration on your website')}: {t('INLINE', 'Inline')}</h2>
89
+ <FormGroup>
90
+ <label>1* {t('INSERT_ON_END_BODY', 'Insert at the end of the body tag')} ({t('IF_USED_PAYPALEXPRESS', 'Use only if Paypal Express is used')})</label>
91
+ <Input
92
+ placeholder={t('CODE', 'Code')}
93
+ defaultValue='<script src="https://www.paypalobjects.com/api/checkout.js"></script>'
94
+ disabled
95
+ />
96
+ </FormGroup>
97
+ <FormGroup>
98
+ <label>2* {t('INSERT_ON_DIV_DISPLAY', 'Insert in the div where you want to display it.')}</label>
99
+ <TextArea
100
+ placeholder={t('CODE', 'Code')}
101
+ defaultValue={widgetInline}
102
+ disabled
103
+ />
104
+ </FormGroup>
105
+ <FormGroup>
106
+ <label>3* .htaccess</label>
107
+ <TextArea
108
+ placeholder={t('CODE', 'Code')}
109
+ defaultValue='RewriteEngine On
110
+ RewriteRule ^inline/(.+)$ /inline/ [NC,L] #where inline is the folder'
111
+ disabled
112
+ />
113
+ </FormGroup>
114
+ </InlineContainer>
115
+ </Content>
116
+ </Container>
117
+ )
118
+ }
@@ -0,0 +1,84 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Container = styled.div`
4
+ flex: 1;
5
+ padding: 25px 20px;
6
+ box-sizing: border-box;
7
+ transition: all 0.5s;
8
+ max-height: 100vh;
9
+ overflow: auto;
10
+ `
11
+
12
+ export const HeaderTitleContainer = styled.div`
13
+ display: flex;
14
+ align-items: center;
15
+ margin-bottom: 35px;
16
+
17
+ > h1 {
18
+ font-weight: 700;
19
+ font-size: 20px;
20
+ color: ${props => props.theme.colors.headingColor};
21
+ margin: 0px;
22
+ line-height: 32px;
23
+ }
24
+
25
+ > button {
26
+ ${props => props.theme?.rtl ? css`
27
+ margin-left: 8px;
28
+ margin-right: -8px;
29
+ ` : css`
30
+ margin-right: 8px;
31
+ margin-left: -8px;
32
+ `}
33
+
34
+ svg {
35
+ width: 25px;
36
+ height: 25px;
37
+ }
38
+ }
39
+ `
40
+
41
+ export const Content = styled.div``
42
+
43
+ export const FormGroup = styled.div`
44
+ margin-bottom: 30px;
45
+ label {
46
+ display: block;
47
+ font-weight: 400;
48
+ font-size: 14px;
49
+ line-height: 24px;
50
+ margin-bottom: 11px;
51
+ }
52
+ input, textarea {
53
+ width: 100%;
54
+ }
55
+ textarea {
56
+ height: 200px;
57
+ }
58
+ `
59
+
60
+ export const PopupContainer = styled.div`
61
+ h2 {
62
+ font-weight: 600;
63
+ font-size: 16px;
64
+ line-height: 24px;
65
+ margin-top: 0px;
66
+ margin-bottom: 20px;
67
+ }
68
+ h3 {
69
+ font-weight: 600;
70
+ font-size: 14px;
71
+ line-height: 21px;
72
+ margin-bottom: 25px;
73
+ }
74
+ `
75
+
76
+ export const InlineContainer = styled.div`
77
+ h2 {
78
+ font-weight: 600;
79
+ font-size: 16px;
80
+ line-height: 24px;
81
+ margin-top: 0px;
82
+ margin-bottom: 20px;
83
+ }
84
+ `
@@ -6,6 +6,7 @@ import { PosApp } from './PosApp'
6
6
  import { CallCenterApp } from './CallCenterApp'
7
7
  import { KioskApp } from './KioskApp'
8
8
  import { CustomProject } from './CustomProject'
9
+ import { OrderingWidgets } from './OrderingWidgets'
9
10
 
10
11
  export {
11
12
  OrderingWebsite,
@@ -15,5 +16,6 @@ export {
15
16
  PosApp,
16
17
  CallCenterApp,
17
18
  KioskApp,
18
- CustomProject
19
+ CustomProject,
20
+ OrderingWidgets
19
21
  }