ordering-ui-external 10.3.4 → 10.4.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 (37) hide show
  1. package/_bundles/{7.ordering-ui.e4b344da6e70bac839ce.js → 7.ordering-ui.62d46eec3c210c5257aa.js} +1 -1
  2. package/_bundles/{ordering-ui.e4b344da6e70bac839ce.js → ordering-ui.62d46eec3c210c5257aa.js} +2 -2
  3. package/_modules/themes/five/index.js +7 -0
  4. package/_modules/themes/five/src/components/BusinessPreorder/styles.js +2 -2
  5. package/_modules/themes/five/src/components/BusinessProductsList/index.js +35 -13
  6. package/_modules/themes/five/src/components/BusinessProductsList/styles.js +7 -3
  7. package/_modules/themes/five/src/components/Cart/index.js +2 -2
  8. package/_modules/themes/five/src/components/GiftCard/SendGiftCard/index.js +2 -2
  9. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
  10. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  11. package/_modules/themes/five/src/components/WebsocketStatus/index.js +123 -0
  12. package/_modules/themes/five/src/components/WebsocketStatus/styles.js +69 -0
  13. package/_modules/themes/five/src/styles/Buttons/index.js +118 -89
  14. package/package.json +2 -2
  15. package/src/themes/five/index.js +2 -1
  16. package/src/themes/five/src/components/BusinessPreorder/styles.js +4 -4
  17. package/src/themes/five/src/components/BusinessProductsList/index.js +36 -3
  18. package/src/themes/five/src/components/BusinessProductsList/styles.js +20 -0
  19. package/src/themes/five/src/components/Cart/index.js +2 -2
  20. package/src/themes/five/src/components/GiftCard/SendGiftCard/index.js +2 -2
  21. package/src/themes/five/src/components/RenderProductsLayout/index.js +1 -0
  22. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +2 -2
  23. package/src/themes/five/src/components/WebsocketStatus/index.js +142 -0
  24. package/src/themes/five/src/components/WebsocketStatus/styles.js +184 -0
  25. package/src/themes/five/src/styles/Buttons/index.js +67 -0
  26. package/template/pages/BusinessProductsList/index.js +2 -1
  27. package/template/theme.json +2 -1
  28. /package/_bundles/{0.ordering-ui.e4b344da6e70bac839ce.js → 0.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  29. /package/_bundles/{1.ordering-ui.e4b344da6e70bac839ce.js → 1.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  30. /package/_bundles/{2.ordering-ui.e4b344da6e70bac839ce.js → 2.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  31. /package/_bundles/{4.ordering-ui.e4b344da6e70bac839ce.js → 4.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  32. /package/_bundles/{5.ordering-ui.e4b344da6e70bac839ce.js → 5.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  33. /package/_bundles/{6.ordering-ui.e4b344da6e70bac839ce.js → 6.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  34. /package/_bundles/{7.ordering-ui.e4b344da6e70bac839ce.js.LICENSE.txt → 7.ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt} +0 -0
  35. /package/_bundles/{8.ordering-ui.e4b344da6e70bac839ce.js → 8.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  36. /package/_bundles/{9.ordering-ui.e4b344da6e70bac839ce.js → 9.ordering-ui.62d46eec3c210c5257aa.js} +0 -0
  37. /package/_bundles/{ordering-ui.e4b344da6e70bac839ce.js.LICENSE.txt → ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt} +0 -0
@@ -0,0 +1,142 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, useUtils, WebsocketStatus as WebsocketStatusController } from 'ordering-components-external'
3
+ import { InfoCircle } from 'react-bootstrap-icons'
4
+ import { Alert } from '../../../src/components/Confirm'
5
+ import { Modal } from '../Modal'
6
+ import { IconButton, Button } from '../../styles/Buttons'
7
+ import {
8
+ Contatiner,
9
+ StatusContainer,
10
+ WebsocketStatusDot,
11
+ InfoWrapper,
12
+ InfoContent,
13
+ DetailContainer,
14
+ StatusItemWrapper,
15
+ ButtonsContainer,
16
+ ButtonWrapper
17
+ } from './styles'
18
+ import { useWindowSize } from '../../../../../hooks/useWindowSize'
19
+
20
+ const SocketStatusUI = (props) => {
21
+ const {
22
+ socketStatus,
23
+ reconnectAttemptCount,
24
+ connectedDate
25
+ } = props
26
+
27
+ const [, t] = useLanguage()
28
+ const [{ parseDate }] = useUtils()
29
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
30
+ const [openModal, setOpenModal] = useState(false)
31
+ const windowSize = useWindowSize()
32
+
33
+ const closeAlert = () => {
34
+ setAlertState({
35
+ open: false,
36
+ content: []
37
+ })
38
+ window.location.reload()
39
+ }
40
+
41
+ useEffect(() => {
42
+ if (reconnectAttemptCount > 3) {
43
+ setAlertState({
44
+ open: true,
45
+ 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.')
46
+ })
47
+ }
48
+ }, [reconnectAttemptCount])
49
+
50
+ return (
51
+ <Contatiner>
52
+ <InfoWrapper>
53
+ <IconButton
54
+ color='primary'
55
+ >
56
+ <InfoCircle />
57
+ </IconButton>
58
+ <InfoContent>
59
+ {t('WEBSOCKET_STATUS_APP_INFO', 'Verify the server connection by date and time using the Connection status button. Press update to refresh your app and update the status as well. Need help? Contact our Customer support team here:')}
60
+ <a href='https://www.ordering.co/contact-ordering' target='_blank' rel='noopener noreferrer'>{t('CUSTOMER_SUPPORT', 'Customer support')}</a>
61
+ </InfoContent>
62
+ </InfoWrapper>
63
+ <ButtonWrapper>
64
+ <Button
65
+ borderRadius='8px'
66
+ color='secundary'
67
+ onClick={() => setOpenModal(true)}
68
+ >
69
+ <StatusContainer>
70
+ <span>{t('CONNECTION_STATUS', 'Connection status')}</span>
71
+ <WebsocketStatusDot
72
+ status={socketStatus}
73
+ />
74
+ </StatusContainer>
75
+ </Button>
76
+ </ButtonWrapper>
77
+ <Modal
78
+ open={openModal}
79
+ onClose={() => setOpenModal(false)}
80
+ width='500px'
81
+ title={t('CONNECTION_STATUS', 'Connection status')}
82
+ >
83
+ <DetailContainer>
84
+ <p>{t('LAST_UPDATE', 'Last update')}: {parseDate(connectedDate)}</p>
85
+ <StatusItemWrapper>
86
+ <div>
87
+ <WebsocketStatusDot status={1} />
88
+ <span>{t('OK', 'Ok')}</span>
89
+ </div>
90
+ <p>{t('WEBSOCKET_OK', 'The websocket works normally.')}</p>
91
+ </StatusItemWrapper>
92
+ <StatusItemWrapper>
93
+ <div>
94
+ <WebsocketStatusDot status={0} />
95
+ <span>{t('CONNECTING', 'Connecting')}</span>
96
+ </div>
97
+ <p>{t('WEBSOCKET_CONNECTING', 'The websocket is connecting.')}</p>
98
+ </StatusItemWrapper>
99
+ <StatusItemWrapper>
100
+ <div>
101
+ <WebsocketStatusDot status={2} />
102
+ <span>{t('DISCONNECTED', 'Disconnected')}</span>
103
+ </div>
104
+ <p>{t('WEBSOCKET_DISCONNECTED', 'The server is slow, please reload.')}</p>
105
+ </StatusItemWrapper>
106
+ <ButtonsContainer>
107
+ <Button
108
+ color='secundary'
109
+ onClick={() => setOpenModal(false)}
110
+ >
111
+ {t('CLOSE', 'Close')}
112
+ </Button>
113
+ <Button
114
+ color='primary'
115
+ onClick={() => window.location.reload()}
116
+ >
117
+ {t('UPDATE', 'Update')}
118
+ </Button>
119
+ </ButtonsContainer>
120
+ </DetailContainer>
121
+ </Modal>
122
+
123
+ <Alert
124
+ title={t('ERROR', 'Error')}
125
+ content={alertState.content}
126
+ acceptText={t('ACCEPT', 'Accept')}
127
+ open={alertState.open}
128
+ onClose={() => closeAlert()}
129
+ onAccept={() => closeAlert()}
130
+ closeOnBackdrop={false}
131
+ />
132
+ </Contatiner>
133
+ )
134
+ }
135
+
136
+ export const WebsocketStatus = (props) => {
137
+ const socketProps = {
138
+ ...props,
139
+ UIComponent: SocketStatusUI
140
+ }
141
+ return <WebsocketStatusController {...socketProps} />
142
+ }
@@ -0,0 +1,184 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const Contatiner = styled.div`
4
+ display: flex;
5
+ align-items: center;
6
+ font-size: 14px;
7
+ > button {
8
+ height: 41px;
9
+ }
10
+ justify-content: flex-end;
11
+ margin-right: 10px;
12
+ margin-bottom: 10px;
13
+ `
14
+
15
+ export const StatusContainer = styled.div`
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ font-size: 14px;
20
+ > span:first-child {
21
+ ${props => props.theme?.rtl ? css`
22
+ margin-left: 6px;
23
+ ` : css`
24
+ margin-right: 6px;
25
+ `}
26
+ }
27
+ `
28
+
29
+ export const WebsocketStatusDot = styled.span`
30
+ width: 8px;
31
+ height: 8px;
32
+ border-radius: 50%;
33
+ display: inline-block;
34
+
35
+ ${({ status }) => status === 0 && css`
36
+ background-color: #FF9922;
37
+ `}
38
+ ${({ status }) => status === 1 && css`
39
+ background-color: #00D27A;
40
+ `}
41
+ ${({ status }) => status === 2 && css`
42
+ background-color: #E63757;
43
+ `}
44
+ `
45
+ export const DateWrapper = styled.div`
46
+ font-size: 12px;
47
+ text-align: center;
48
+ `
49
+ export const InfoWrapper = styled.div`
50
+ position: relative;
51
+ ${props => props.theme?.rtl ? css`
52
+ margin-left: 4px;
53
+ ` : css`
54
+ margin-right: 4px;
55
+ `}
56
+
57
+ > button {
58
+ height: 25px;
59
+ svg {
60
+ width: 16px;
61
+ height: 16px;
62
+ }
63
+ }
64
+ &:hover > div {
65
+ visibility: visible;
66
+ opacity: 1;
67
+ }
68
+ `
69
+
70
+ export const InfoContent = styled.div`
71
+ position: absolute;
72
+ bottom: 100%;
73
+ z-index: 999;
74
+ background: ${props => props.theme.colors.backgroundInfo};
75
+ border: 1px solid ${props => props.theme.colors.primary};
76
+ box-sizing: border-box;
77
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
78
+ border-radius: 7.6px;
79
+ padding: 8px 12px;
80
+ font-size: 12px;
81
+ line-height: 18px;
82
+ min-width: 150px;
83
+ transition: all 0.3s linear;
84
+ visibility: hidden;
85
+ opacity: 0;
86
+ /* display: none; */
87
+ color: ${props => props.theme?.colors?.darkTextColor};
88
+ left: -100px;
89
+ ${props => props.theme.rtl && css`
90
+ right: -100px;
91
+ left: initial;
92
+ `}
93
+
94
+ a {
95
+ color: ${props => props.theme.colors.primary};
96
+ transition: all 0.3s linear;
97
+ cursor: pointer;
98
+ margin-left: 5px;
99
+ ${props => props.theme.rtl && css`
100
+ margin-left: 0px;
101
+ margin-right: 5px;
102
+ `}
103
+ &:hover {
104
+ text-decoration: underline;
105
+ }
106
+ }
107
+
108
+ @media (min-width: 576px) {
109
+ min-width: 350px;
110
+ padding: 12px 15px;
111
+ left: -200px;
112
+ ${props => props.theme.rtl && css`
113
+ right: -200px;
114
+ left: initial;
115
+ `}
116
+ }
117
+
118
+ @media (min-width: 993px) {
119
+ min-width: 535px;
120
+ left: -330px;
121
+ ${props => props.theme.rtl && css`
122
+ right: -330px;
123
+ left: initial;
124
+ `}
125
+ }
126
+
127
+ `
128
+ export const DetailContainer = styled.div`
129
+ margin-top: 10px;
130
+ h2 {
131
+ font-weight: 700;
132
+ font-size: 20px;
133
+ line-height: 30px;
134
+ }
135
+
136
+ > p {
137
+ font-size: 14px;
138
+ }
139
+ `
140
+ export const StatusItemWrapper = styled.div`
141
+ > div {
142
+ display: flex;
143
+ align-items: center;
144
+
145
+ > span:first-child {
146
+ margin: 0 16px;
147
+ }
148
+ }
149
+ p {
150
+ font-weight: 400;
151
+ font-size: 12px;
152
+ line-height: 18px;
153
+ color: ${props => props.theme.colors.lightGray};
154
+
155
+ ${props => props.theme?.rtl ? css`
156
+ margin-right: 40px;
157
+ ` : css`
158
+ margin-left: 40px;
159
+ `}
160
+ }
161
+ `
162
+ export const ButtonsContainer = styled.div`
163
+ display: flex;
164
+ align-items: center;
165
+ margin-top: 40px;
166
+
167
+ > button {
168
+ border-radius: 8px;
169
+ height: 40px;
170
+ &:last-child {
171
+ margin: 0 10px;
172
+ }
173
+ }
174
+ `
175
+
176
+ export const ButtonWrapper = styled.div`
177
+ button{
178
+ height: 41px;
179
+ width: 175px;
180
+ width: 175px;
181
+ width: 175px;
182
+ }
183
+
184
+ `
@@ -1,6 +1,70 @@
1
1
  import styled, { css } from 'styled-components'
2
2
  import { darken } from 'polished'
3
3
 
4
+ export const IconButton = styled.button`
5
+ background-color: transparent;
6
+ border: none;
7
+ border-radius: 6px;
8
+ height: 32px;
9
+ padding: 0 5px;
10
+ display: flex;
11
+ align-items: center;
12
+ justify-content: center;
13
+ transition: all .2s ease-in;
14
+ &:disabled {
15
+ opacity: 0.5;
16
+ cursor: not-allowed;
17
+ }
18
+ > svg {
19
+ width: 20px;
20
+ height: 20px;
21
+ color: #B1BCCC;
22
+ }
23
+
24
+ &:hover {
25
+ background-color: #1507260a;
26
+
27
+ > svg {
28
+ color: #151b26;
29
+ }
30
+ }
31
+
32
+ &:active {
33
+ background-color: #1507261a;
34
+ }
35
+
36
+ ${({ color }) => color === 'black' && css`
37
+ > svg {
38
+ color: ${props => props.theme.colors.headingColor};
39
+ }
40
+ &:hover {
41
+ background-color: ${props => props.theme.colors.secundary};
42
+ }
43
+ &:active {
44
+ background-color: ${props => props.theme.colors.secundaryDarkContrast};
45
+ }
46
+
47
+ ${({ active }) => active && css`
48
+ background-color: ${props => props.theme.colors.secundaryDarkContrast};
49
+ `}
50
+ `}
51
+
52
+ ${({ color }) => color === 'primary' && css`
53
+ > svg {
54
+ color: ${props => props.theme.colors.primary};
55
+ }
56
+ &:hover {
57
+ background-color: #1507260a;
58
+ > svg {
59
+ color: ${props => props.theme.colors.primary};
60
+ }
61
+ }
62
+ `}
63
+ ${({ isDisabled }) => isDisabled && css`
64
+ pointer-events: none;
65
+ `}
66
+ `
67
+
4
68
  export const Button = styled.button`
5
69
  background: #CCC;
6
70
  color: #FFF;
@@ -21,6 +85,9 @@ export const Button = styled.button`
21
85
  opacity: 0.5;
22
86
  cursor: not-allowed;
23
87
  }
88
+ ${({ width }) => width && css`
89
+ width: ${width};
90
+ `}
24
91
  ${({ bgtransparent }) => bgtransparent && css`
25
92
  background: transparent !important;
26
93
  &:hover {
@@ -136,7 +136,8 @@ export const BusinessProductsList = (props) => {
136
136
  'whatsapp_number',
137
137
  'snapchat_profile',
138
138
  'previously_products',
139
- 'configs'
139
+ 'configs',
140
+ 'previously_products'
140
141
  ],
141
142
  handleSearchRedirect: () => {
142
143
  events.emit('go_to_page', { page: 'search' })
@@ -42,7 +42,8 @@
42
42
  "success500": "#00D27A",
43
43
  "secondaryDark": "#414954",
44
44
  "black": "#000000",
45
- "white": "#FFFFFF"
45
+ "white": "#FFFFFF",
46
+ "backgroundInfo": "#F5F9FF"
46
47
  },
47
48
  "defaultLanguages": {
48
49
  "QUESTION_CLEAR_CUSTOMER": "Are you sure that you want to clear the customer?",