ordering-ui-admin-external 1.17.0 → 1.18.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 (69) hide show
  1. package/_bundles/{ordering-ui-admin.6c1919d6b0356a2f522f.js → ordering-ui-admin.d6ceaa81e226693746d5.js} +2 -2
  2. package/_modules/components/Delivery/DeliveryUsersListing/index.js +4 -2
  3. package/_modules/components/Delivery/DriversGroupLogistics/index.js +1 -1
  4. package/_modules/components/Delivery/DriversGroupLogs/index.js +1 -0
  5. package/_modules/components/Delivery/UsersList/index.js +47 -51
  6. package/_modules/components/Delivery/UsersList/styles.js +6 -4
  7. package/_modules/components/MyProducts/AdvancedSettings/ButtonShadow.js +98 -0
  8. package/_modules/components/MyProducts/AdvancedSettings/FontStyleGroup.js +28 -7
  9. package/_modules/components/MyProducts/AdvancedSettings/HideCheckBox.js +47 -0
  10. package/_modules/components/MyProducts/AdvancedSettings/ImageBox.js +12 -3
  11. package/_modules/components/MyProducts/AdvancedSettings/SettingComponent.js +15 -15
  12. package/_modules/components/MyProducts/AdvancedSettings/index.js +102 -117
  13. package/_modules/components/MyProducts/AppResources/index.js +132 -0
  14. package/_modules/components/Orders/Messages/index.js +9 -5
  15. package/_modules/components/Orders/OrderBill/index.js +1 -1
  16. package/_modules/components/Orders/OrderNotification/index.js +4 -2
  17. package/_modules/components/Orders/OrdersManager/index.js +3 -1
  18. package/_modules/components/Stores/BusinessAdd/DeliveryZone/index.js +1 -1
  19. package/_modules/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  20. package/_modules/components/Stores/BusinessDetails/index.js +27 -8
  21. package/_modules/components/Stores/BusinessPlace/index.js +127 -0
  22. package/_modules/components/Stores/BusinessPlace/styles.js +55 -0
  23. package/_modules/components/Stores/BusinessPlaceGroup/index.js +258 -0
  24. package/_modules/components/Stores/BusinessPlaceGroup/styles.js +102 -0
  25. package/_modules/components/Stores/BusinessPreorderDetails/index.js +13 -1
  26. package/_modules/components/Stores/BusinessProductList/index.js +3 -3
  27. package/_modules/components/Stores/BusinessProductsListing/index.js +2 -1
  28. package/_modules/components/Stores/BusinessSummary/index.js +12 -3
  29. package/_modules/components/Stores/ProductStep/index.js +15 -3
  30. package/_modules/components/Stores/SpoonityApiKey/index.js +97 -0
  31. package/_modules/components/Stores/SpoonityApiKey/styles.js +47 -0
  32. package/_modules/components/Stores/UploadMenuGuide/index.js +8 -0
  33. package/_modules/components/Users/CustomerPointsWallet/index.js +126 -9
  34. package/_modules/components/Users/CustomerPointsWallet/styles.js +8 -4
  35. package/package.json +2 -2
  36. package/src/components/Delivery/DeliveryUsersListing/index.js +3 -1
  37. package/src/components/Delivery/DriversGroupLogistics/index.js +1 -1
  38. package/src/components/Delivery/DriversGroupLogs/index.js +2 -0
  39. package/src/components/Delivery/UsersList/index.js +79 -61
  40. package/src/components/Delivery/UsersList/styles.js +4 -12
  41. package/src/components/MyProducts/AdvancedSettings/ButtonShadow.js +102 -0
  42. package/src/components/MyProducts/AdvancedSettings/FontStyleGroup.js +23 -5
  43. package/src/components/MyProducts/AdvancedSettings/HideCheckBox.js +33 -0
  44. package/src/components/MyProducts/AdvancedSettings/ImageBox.js +10 -3
  45. package/src/components/MyProducts/AdvancedSettings/SettingComponent.js +10 -15
  46. package/src/components/MyProducts/AdvancedSettings/index.js +119 -149
  47. package/src/components/MyProducts/AppResources/index.js +167 -0
  48. package/src/components/Orders/Messages/index.js +38 -0
  49. package/src/components/Orders/OrderBill/index.js +1 -1
  50. package/src/components/Orders/OrderNotification/index.js +6 -2
  51. package/src/components/Orders/OrdersManager/index.js +1 -1
  52. package/src/components/Stores/BusinessAdd/DeliveryZone/index.js +1 -1
  53. package/src/components/Stores/BusinessDeliveryZoneInformation/index.js +1 -1
  54. package/src/components/Stores/BusinessDetails/index.js +24 -1
  55. package/src/components/Stores/BusinessPlace/index.js +137 -0
  56. package/src/components/Stores/BusinessPlace/styles.js +132 -0
  57. package/src/components/Stores/BusinessPlaceGroup/index.js +272 -0
  58. package/src/components/Stores/BusinessPlaceGroup/styles.js +248 -0
  59. package/src/components/Stores/BusinessPreorderDetails/index.js +2 -2
  60. package/src/components/Stores/BusinessProductList/index.js +9 -1
  61. package/src/components/Stores/BusinessProductsListing/index.js +1 -0
  62. package/src/components/Stores/BusinessSummary/index.js +16 -5
  63. package/src/components/Stores/ProductStep/index.js +19 -2
  64. package/src/components/Stores/SpoonityApiKey/index.js +87 -0
  65. package/src/components/Stores/SpoonityApiKey/styles.js +68 -0
  66. package/src/components/Stores/UploadMenuGuide/index.js +10 -1
  67. package/src/components/Users/CustomerPointsWallet/index.js +130 -2
  68. package/src/components/Users/CustomerPointsWallet/styles.js +40 -1
  69. /package/_bundles/{ordering-ui-admin.6c1919d6b0356a2f522f.js.LICENSE.txt → ordering-ui-admin.d6ceaa81e226693746d5.js.LICENSE.txt} +0 -0
@@ -548,6 +548,25 @@ export const MessagesUI = (props) => {
548
548
  <React.Fragment key={message.id}>
549
549
  {history && tabActive === 'order_history' && (
550
550
  <>
551
+ {message.type === 0 && (
552
+ <MessageConsole key={message.id}>
553
+ <BubbleConsole>
554
+ <p>
555
+ {t('ORDER_PLACED_FOR', 'Order placed for')} {' '}
556
+ <strong>{parseDate(order.created_at)}</strong> {' '}
557
+ {t('VIA', 'Via')}{' '}
558
+ <strong>
559
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
560
+ </strong>{' '}
561
+ </p>
562
+ <div><strong>{t('APP_ID', 'App ID')}: </strong>{message?.app_id}</div>
563
+ <div><strong>{t('AUTHOR', 'Author')}: </strong>{message?.author?.name} {message?.author?.lastname}</div>
564
+ <div><strong>{t('USER_AGENT', 'User agent')}: </strong>{message?.user_agent}</div>
565
+ <div><strong>{t('IP', 'IP')}: </strong>{message?.ip}</div>
566
+ <TimeofSent>{getTimeAgo(message?.created_at)}</TimeofSent>
567
+ </BubbleConsole>
568
+ </MessageConsole>
569
+ )}
551
570
  {message.type === 1 && (
552
571
  <MessageConsole key={message.id} style={{ display: `${tabActive === 'order_history' ? 'inline-flex' : 'none'}` }}>
553
572
  {message.change?.attribute !== 'driver_id' ? (
@@ -612,6 +631,25 @@ export const MessagesUI = (props) => {
612
631
  )}
613
632
  {isChat && (
614
633
  <>
634
+ {message.type === 0 && (
635
+ <MessageConsole key={message.id}>
636
+ <BubbleConsole>
637
+ <p>
638
+ {t('ORDER_PLACED_FOR', 'Order placed for')} {' '}
639
+ <strong>{parseDate(order.created_at)}</strong> {' '}
640
+ {t('VIA', 'Via')}{' '}
641
+ <strong>
642
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
643
+ </strong>{' '}
644
+ </p>
645
+ <div><strong>{t('APP_ID', 'App ID')}: </strong>{message?.app_id}</div>
646
+ <div><strong>{t('AUTHOR', 'Author')}: </strong>{message?.author?.name} {message?.author?.lastname}</div>
647
+ <div><strong>{t('USER_AGENT', 'User agent')}: </strong>{message?.user_agent}</div>
648
+ <div><strong>{t('IP', 'IP')}: </strong>{message?.ip}</div>
649
+ <TimeofSent>{getTimeAgo(message?.created_at)}</TimeofSent>
650
+ </BubbleConsole>
651
+ </MessageConsole>
652
+ )}
615
653
  {message.type === 1 && message.change?.attribute !== 'comment' && (
616
654
  <MessageConsole key={message.id}>
617
655
  {message.change?.attribute !== 'driver_id' ? (
@@ -186,7 +186,7 @@ export const OrderBill = (props) => {
186
186
  </tr>
187
187
  ))
188
188
  }
189
- {order?.summary?.delivery_price > 0 && (
189
+ {typeof order?.summary?.delivery_price === 'number' && (
190
190
  <tr>
191
191
  <td>{t('DELIVERY_FEE', 'Delivery Fee')}</td>
192
192
  <td>{parsePrice(order?.summary?.delivery_price, { currency: order?.currency })}</td>
@@ -18,7 +18,10 @@ import {
18
18
  toast.configure()
19
19
 
20
20
  const OrderNotificationUI = (props) => {
21
- const { isOnlyDelivery } = props
21
+ const {
22
+ isOnlyDelivery,
23
+ customerId
24
+ } = props
22
25
 
23
26
  const [configState] = useConfig()
24
27
  const [, t] = useLanguage()
@@ -29,6 +32,7 @@ const OrderNotificationUI = (props) => {
29
32
  const [registerOrderIds, setRegisterOrderIds] = useState([])
30
33
 
31
34
  const handleNotification = (order) => {
35
+ if (customerId && order?.customer_id !== customerId) return
32
36
  if (isOnlyDelivery && order?.delivery_type !== 1) return
33
37
  const _registerOrderIds = [...registerOrderIds]
34
38
  if (!_registerOrderIds.includes(order.id)) {
@@ -101,7 +105,7 @@ const OrderNotificationUI = (props) => {
101
105
  return () => {
102
106
  events.off('order_added', handleNotification)
103
107
  }
104
- }, [configState, registerOrderIds])
108
+ }, [configState, registerOrderIds, customerId])
105
109
 
106
110
  return (
107
111
  <>
@@ -259,7 +259,7 @@ const OrdersManagerUI = (props) => {
259
259
  />
260
260
  )}
261
261
 
262
- <OrderNotification />
262
+ <OrderNotification customerId={props.customerId} />
263
263
 
264
264
  {totalSelectedOrder > 0 && (
265
265
  <WrapperIndicator>
@@ -182,7 +182,7 @@ export const DeliveryZone = (props) => {
182
182
  maxLength={2}
183
183
  value={zoneState?.data?.distance ?? ''}
184
184
  onInput={(e) => {
185
- e.target.value = e.target.value.match('^[1-9]{1,2}$')
185
+ e.target.value = e.target.value.match(`^[${e.target.value === '0' ? '1' : '0'}-9]{1,2}$`)
186
186
  }}
187
187
  onChange={e => handleChangeZoneState(e, false, configState?.configs?.distance_unit?.value)}
188
188
  />
@@ -217,7 +217,7 @@ export const BusinessDeliveryZoneInformation = (props) => {
217
217
  maxLength={2}
218
218
  value={formState.changes?.data?.distance ?? zone?.data?.distance ?? ''}
219
219
  onInput={(e) => {
220
- e.target.value = e.target.value.match('^[1-9]{1,2}$')
220
+ e.target.value = e.target.value.match(`^[${e.target.value === '0' ? '1' : '0'}-9]{1,2}$`)
221
221
  }}
222
222
  onChange={e => handleChangeInput(e, configState?.configs?.distance_unit?.value)}
223
223
  ref={register({
@@ -18,6 +18,8 @@ import { BusinessNotifications } from '../BusinessNotifications'
18
18
  import { BusinessOrderingChannels } from '../BusinessOrderingChannels'
19
19
  import { BusinessFrontLayout } from '../BusinessFrontLayout'
20
20
  // import { BusinessPublishing } from '../BusinessPublishing'
21
+ import { BusinessPlaceGroupList } from '../BusinessPlaceGroupList'
22
+ import { SpoonityApiKey } from '../SpoonityApiKey'
21
23
 
22
24
  import { MoreSidebarLayout, Personalization, Alert } from '../../Shared'
23
25
 
@@ -46,7 +48,9 @@ export const BusinessDetailsUI = (props) => {
46
48
  handleDuplicateBusiness,
47
49
  handleDeleteBusiness,
48
50
  actionStatus,
49
- handleUpdatePreorderConfigs
51
+ handleUpdatePreorderConfigs,
52
+ handleUpdateSpoonityKey,
53
+ spoonityKeyState
50
54
  } = props
51
55
 
52
56
  const history = useHistory()
@@ -58,6 +62,7 @@ export const BusinessDetailsUI = (props) => {
58
62
  const [extraOpen, setExtraOpen] = useState(false)
59
63
  const [isExtendExtraOpen, setIsExtendExtraOpen] = useState(false)
60
64
  const [alertState, setAlertState] = useState({ open: false, content: [] })
65
+ const spoonityConfig = businessState?.business?.configs?.find(config => config.key === 'spoonity_integration_api_key')
61
66
 
62
67
  const isAdmin = user?.level === 0
63
68
 
@@ -178,6 +183,7 @@ export const BusinessDetailsUI = (props) => {
178
183
  handleDuplicateBusiness={handleDuplicateBusiness}
179
184
  handleDeleteBusiness={handleDeleteBusiness}
180
185
  extraOpen={extraOpen}
186
+ spoonityConfig={spoonityConfig}
181
187
  />
182
188
  )}
183
189
  {extraOpen && (
@@ -320,6 +326,23 @@ export const BusinessDetailsUI = (props) => {
320
326
  handleSuccessUpdate={handleUpdateBusinessState}
321
327
  />
322
328
  )}
329
+ {selectedItem === 'places' && (
330
+ <BusinessPlaceGroupList
331
+ business={businessState?.business}
332
+ handleSuccessUpdate={handleUpdateBusinessState}
333
+ setIsExtendExtraOpen={setIsExtendExtraOpen}
334
+ />
335
+ )}
336
+ {selectedItem === 'spoonity_key' && (
337
+ <SpoonityApiKey
338
+ business={businessState?.business}
339
+ handleSuccessUpdate={handleUpdateBusinessState}
340
+ handleUpdateBusinessClick={handleUpdateBusinessClick}
341
+ spoonityConfig={spoonityConfig}
342
+ handleUpdateSpoonityKey={handleUpdateSpoonityKey}
343
+ spoonityKeyState={spoonityKeyState}
344
+ />
345
+ )}
323
346
  </MoreSidebarLayout>
324
347
  )}
325
348
 
@@ -0,0 +1,137 @@
1
+ import React, { useState, useEffect, useRef } from 'react'
2
+ import { useLanguage, BusinessPlace as BusinessPlaceController } from 'ordering-components-admin-external'
3
+ import { DropdownButton, Dropdown } from 'react-bootstrap'
4
+ import { XLg, ThreeDots } from 'react-bootstrap-icons'
5
+ import { useTheme } from 'styled-components'
6
+ import { Button, IconButton, Input } from '../../../styles'
7
+ import { useForm } from 'react-hook-form'
8
+ import { Alert } from '../../Shared'
9
+
10
+ import {
11
+ Container,
12
+ Header,
13
+ ActionBlock,
14
+ ActionSelectorWrapper,
15
+ Content,
16
+ ButtonWrapper,
17
+ HideSubmitBtn
18
+ } from './styles'
19
+
20
+ export const BusinessPlaceUI = (props) => {
21
+ const {
22
+ onClose,
23
+ place,
24
+ formState,
25
+ handleChangeInput,
26
+ handleAddPlace,
27
+ handleUpdatePlace,
28
+ handleDeletePlace
29
+ } = props
30
+
31
+ const theme = useTheme()
32
+ const [, t] = useLanguage()
33
+ const formMethods = useForm()
34
+
35
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
36
+
37
+ const buttonRef = useRef(null)
38
+
39
+ const closeAlert = () => {
40
+ setAlertState({
41
+ open: false,
42
+ content: []
43
+ })
44
+ }
45
+
46
+ const onSubmit = () => {
47
+ if (place) handleUpdatePlace()
48
+ else handleAddPlace()
49
+ }
50
+
51
+ useEffect(() => {
52
+ if (Object.keys(formMethods.errors).length > 0) {
53
+ setAlertState({
54
+ open: true,
55
+ content: Object.values(formMethods.errors).map(error => error.message)
56
+ })
57
+ }
58
+ }, [formMethods.errors])
59
+
60
+ return (
61
+ <>
62
+ <Container>
63
+ <Header>
64
+ <h1>{place ? place?.name : t('NEW_OPTION', 'New option')}</h1>
65
+ <ActionBlock>
66
+ {place && (
67
+ <ActionSelectorWrapper>
68
+ <DropdownButton
69
+ className='product_actions'
70
+ menuAlign={theme?.rtl ? 'left' : 'right'}
71
+ title={<ThreeDots />}
72
+ id={theme?.rtl ? 'dropdown-menu-align-left' : 'dropdown-menu-align-right'}
73
+ >
74
+ <Dropdown.Item
75
+ onClick={() => handleDeletePlace()}
76
+ >
77
+ {t('DELETE', 'Delete')}
78
+ </Dropdown.Item>
79
+ </DropdownButton>
80
+ </ActionSelectorWrapper>
81
+ )}
82
+ <IconButton
83
+ color='black'
84
+ onClick={() => onClose()}
85
+ >
86
+ <XLg />
87
+ </IconButton>
88
+ </ActionBlock>
89
+ </Header>
90
+ <Content onSubmit={formMethods.handleSubmit(onSubmit)}>
91
+ <label>{t('NAME', 'Name')}</label>
92
+ <Input
93
+ placeholder={t('NAME', 'Name')}
94
+ name='name'
95
+ autoComplete='off'
96
+ onChange={handleChangeInput}
97
+ value={formState?.changes?.name ?? place?.name ?? ''}
98
+ ref={formMethods.register({
99
+ required: t(
100
+ 'VALIDATION_ERROR_REQUIRED',
101
+ 'Name is required'
102
+ ).replace('_attribute_', t('NAME', 'Name'))
103
+ })}
104
+ />
105
+ <HideSubmitBtn type='submit' ref={buttonRef} />
106
+ </Content>
107
+ <ButtonWrapper>
108
+ <Button
109
+ color='primary'
110
+ borderRadius='8px'
111
+ disabled={Object.keys(formState?.changes).length === 0}
112
+ onClick={() => buttonRef.current.click()}
113
+ >
114
+ {place ? t('SAVE', 'Save') : t('ADD', 'Add')}
115
+ </Button>
116
+ </ButtonWrapper>
117
+ </Container>
118
+ <Alert
119
+ title={t('PLACES', 'Places')}
120
+ content={alertState.content}
121
+ acceptText={t('ACCEPT', 'Accept')}
122
+ open={alertState.open}
123
+ onClose={() => closeAlert()}
124
+ onAccept={() => closeAlert()}
125
+ closeOnBackdrop={false}
126
+ />
127
+ </>
128
+ )
129
+ }
130
+
131
+ export const BusinessPlace = (props) => {
132
+ const businessPlaceProps = {
133
+ ...props,
134
+ UIComponent: BusinessPlaceUI
135
+ }
136
+ return <BusinessPlaceController {...businessPlaceProps} />
137
+ }
@@ -0,0 +1,132 @@
1
+ import styled, { css } from 'styled-components'
2
+ import { darken } from 'polished'
3
+
4
+ export const Container = styled.div`
5
+ transition: 0.3s;
6
+ height: 100%;
7
+
8
+ > button {
9
+ height: 42px;
10
+ width: 100%;
11
+ margin-top: 20px;
12
+ }
13
+ `
14
+
15
+ export const Header = styled.div`
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ position: relative;
20
+ h1 {
21
+ font-size: 20px;
22
+ font-weight: 700;
23
+ margin: 5px 0;
24
+ color: ${props => props.theme.colors.headingColor};
25
+ ${props => props.theme?.rtl ? css`
26
+ margin-left: 80px;
27
+ ` : css`
28
+ margin-right: 80px;
29
+ `}
30
+ }
31
+ `
32
+
33
+ export const ActionBlock = styled.div`
34
+ background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
35
+ position: absolute;
36
+ z-index: 1000;
37
+ display: flex;
38
+ align-items: center;
39
+ > button {
40
+ display: none;
41
+ }
42
+ ${props => props.theme?.rtl ? css`
43
+ left: 0px;
44
+ ` : css`
45
+ right: 0px;
46
+ `}
47
+ @media (min-width: 1000px) {
48
+ > button {
49
+ display: block;
50
+ ${props => props.theme?.rtl ? css`
51
+ margin-right: 10px;
52
+ ` : css`
53
+ margin-left: 10px;
54
+ `}
55
+ }
56
+ }
57
+ `
58
+
59
+ export const ActionSelectorWrapper = styled.div`
60
+ button {
61
+ display: flex;
62
+ background: transparent !important;
63
+ border: none;
64
+ padding: 5px;
65
+ border-radius: 8px;
66
+ &:active,
67
+ &:focus {
68
+ border-color: unset !important;
69
+ box-shadow: none !important;
70
+ }
71
+ svg {
72
+ color: ${props => props.theme.colors.headingColor};
73
+ font-size: 20px;
74
+ }
75
+ &:after {
76
+ display: none;
77
+ }
78
+ &:hover {
79
+ background: ${props => darken(0.04, props.theme.colors.secundary)} !important;
80
+ }
81
+ &:active {
82
+ background: ${props => darken(0.1, props.theme.colors.secundaryDarkContrast)} !important;
83
+ }
84
+ }
85
+ .show {
86
+ >div {
87
+ border: 1px solid ${props => props.theme.colors.borderColor};
88
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
89
+ }
90
+ }
91
+ > div {
92
+ > div {
93
+ border-radius: 8px;
94
+ .dropdown-item {
95
+ font-size: 12px;
96
+ color: ${props => props.theme.colors.headingColor};
97
+ padding: 7px 20px;
98
+ &:active {
99
+ background: ${props => darken(0.1, props.theme.colors.secundary)} !important;
100
+ }
101
+ }
102
+ .dropdown-item:last-child {
103
+ color: ${props => props.theme.colors.danger};
104
+ }
105
+ }
106
+ }
107
+ `
108
+
109
+ export const Content = styled.form`
110
+ margin-top: 30px;
111
+ label {
112
+ font-weight: 400;
113
+ font-size: 14px;
114
+ margin-bottom: 10px;
115
+ }
116
+ input {
117
+ height: 44px;
118
+ width: 100%;
119
+ }
120
+ `
121
+
122
+ export const ButtonWrapper = styled.div`
123
+ position: sticky;
124
+ top: 100%;
125
+ button {
126
+ height: 44px;
127
+ }
128
+ `
129
+
130
+ export const HideSubmitBtn = styled.button`
131
+ display: none;
132
+ `