ordering-ui-admin-external 1.7.0 → 1.7.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.
@@ -0,0 +1,222 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import { useLanguage, ApiKeysList as ApiKeysListController } from 'ordering-components-admin-external'
3
+ import { Button, IconButton } from '../../../styles'
4
+ import { Alert, Confirm, DragScroll, Modal } from '../../Shared'
5
+ import BsArrowRight from '@meronex/icons/bs/BsArrowRight'
6
+ import { XLg } from 'react-bootstrap-icons'
7
+ import { useWindowSize } from '../../../hooks/useWindowSize'
8
+
9
+ import {
10
+ Header,
11
+ AllSetting,
12
+ Description,
13
+ CategoryExtraContent,
14
+ Container,
15
+ DescriptionHeader,
16
+ HeaderIcons,
17
+ LalaMoveConnectContainer,
18
+ SettingListConatiner,
19
+ Tab,
20
+ Paragraph,
21
+ PurchaseWrapper
22
+ } from './styles'
23
+
24
+ const LalaMoveConnectUI = (props) => {
25
+ const {
26
+ actionState,
27
+ onClose
28
+ } = props
29
+
30
+ const [, t] = useLanguage()
31
+ const { width } = useWindowSize()
32
+
33
+ const [alertState, setAlertState] = useState({ open: false, content: [] })
34
+ const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
35
+ const [settingsOpen, setSettingsOpen] = useState(false)
36
+
37
+ const toggleMainContent = () => {
38
+ if (width <= 500) {
39
+ document.getElementById('catDescription').style.width = '100vw'
40
+ } else {
41
+ if ((settingsOpen) && width >= 1000) {
42
+ document.getElementById('catDescription').style.width = '1000px'
43
+ } else {
44
+ document.getElementById('catDescription').style.width = '500px'
45
+ }
46
+ }
47
+ }
48
+
49
+ const handleGoToLink = (link) => {
50
+ window.open(link, '_blank')
51
+ }
52
+
53
+ useEffect(() => {
54
+ if (!actionState?.error) return
55
+ setAlertState({
56
+ open: true,
57
+ content: actionState?.error
58
+ })
59
+ }, [actionState?.error])
60
+
61
+ useEffect(() => {
62
+ if (width < 1000) return
63
+ if (settingsOpen) {
64
+ document.getElementById('catDescription').style.width = '1000px'
65
+ } else {
66
+ toggleMainContent()
67
+ }
68
+ }, [settingsOpen])
69
+
70
+ useEffect(() => {
71
+ toggleMainContent()
72
+ }, [width])
73
+
74
+ const LalaMoveConnectDescription = () => {
75
+ return (
76
+ <CategoryExtraContent>
77
+ <IconButton
78
+ color='black'
79
+ onClick={() => setSettingsOpen(false)}
80
+ >
81
+ <XLg />
82
+ </IconButton>
83
+ <div>
84
+ <Header>
85
+ <h1>{t('MORE_INFO', 'More Info')}</h1>
86
+ </Header>
87
+ <SettingListConatiner>
88
+ <DragScroll>
89
+ <Tab
90
+ active
91
+ >
92
+ {t('GENERAL', 'General')}
93
+ </Tab>
94
+ </DragScroll>
95
+ </SettingListConatiner>
96
+ <Paragraph>
97
+ <h2>{t('REQUIREMENTS', 'Requirements')}</h2>
98
+ <p>
99
+ {t('LALAMOVE_CONNECT_REQUIREMENTS',
100
+ 'For this integration to work you need: \n' +
101
+ '1.- LalaMove account. \n' +
102
+ '2.- The advanced logistics module must be active. \n' +
103
+ '3.- Package of Ordering.'
104
+ )}
105
+ </p>
106
+ </Paragraph>
107
+ <Paragraph>
108
+ <h2>{t('ARTICLE', 'Article')}</h2>
109
+ <p>
110
+ {t('LALAMOVE_CONNECT_ARTICLE', 'To connect with LalaMove, you’ll have to use plugins, put in your LalaMove credentials, connect your LalaMove account, and create a driver company inside this dashboard; follow the next article step by step and get this connected in less than 5 minutes.')}
111
+ </p>
112
+ <a onClick={() => handleGoToLink(t('LALAMOVE_CONNECT_ARTICLE_LINK', 'https://support.ordering.co/hc/en-us/articles/10673894748941'))}>
113
+ {t('VIEW_ARTICLE', 'View Article')}
114
+ </a>
115
+ </Paragraph>
116
+ <Paragraph>
117
+ <h2>{t('SUPPORT', 'Support')}</h2>
118
+ <p>
119
+ {t('LALAMOVE_CONNECT_SUPPORT', 'Are you having trouble connecting this?')}
120
+ </p>
121
+ <p>
122
+ <a onClick={() => handleGoToLink(t('LALAMOVE_CONNECT_SUPPORT_LINK', 'https://www.ordering.co/contact-ordering'))}>{t('CONTACT_US', 'Contact us')}</a>; <span>{t('WE_ARE_HAPPY_TO_HELP', 'we are happy to help.')}</span>
123
+ </p>
124
+ </Paragraph>
125
+ <Paragraph>
126
+ <h2>{t('PRICE_INSTALATION', 'Price and installation time.')}</h2>
127
+ <p>
128
+ <span className='bold'>{t('DOORDASH_CONNECT_PRICE', '$99 monthly')}</span> | {t('DOORDASH_CONNECT_INSTALLATION', 'less than 24 hrs to get it installed in your project.')}
129
+ </p>
130
+ </Paragraph>
131
+ <PurchaseWrapper>
132
+ <Button
133
+ outline
134
+ color='primary'
135
+ onClick={() => handleGoToLink(t('PURCHASE_INTEGRATION_LINK', 'https://www.ordering.co/ordering-sales'))}
136
+ >
137
+ {t('PURCHASE_INTEGRATION', 'Purchase Integration')}
138
+ </Button>
139
+ </PurchaseWrapper>
140
+ </div>
141
+ </CategoryExtraContent>
142
+ )
143
+ }
144
+
145
+ return (
146
+ <Container
147
+ id='catDescription'
148
+ >
149
+ <LalaMoveConnectContainer>
150
+ <DescriptionHeader>
151
+ <HeaderIcons>
152
+ <IconButton
153
+ color='black'
154
+ onClick={onClose}
155
+ >
156
+ <XLg />
157
+ </IconButton>
158
+ </HeaderIcons>
159
+ </DescriptionHeader>
160
+ <Header>
161
+ <h1>{t('CONNECT_WITH_LALAMOVE', 'Connect with Lalamove')}</h1>
162
+ <Button color='lightPrimary'>{t('NEW', 'New')}</Button>
163
+ </Header>
164
+ <Description>
165
+ {t('CONNECT_WITH_LALAMOVE_DESCRIPTION', 'If you have already worked with LalaMove or are running your business with LalaMove and Ordering simultaneously, this integration will help you connect both platforms and assign orders through them, making your job easy and automated.')}
166
+ </Description>
167
+ <AllSetting onClick={() => setSettingsOpen(true)}>
168
+ <span>{t('SETTINGS', 'All settings')}</span>
169
+ <BsArrowRight />
170
+ </AllSetting>
171
+ </LalaMoveConnectContainer>
172
+ {settingsOpen && (
173
+ <>
174
+ {width >= 1000 ? (
175
+ <LalaMoveConnectDescription />
176
+ ) : (
177
+ <>
178
+ <Modal
179
+ width='70%'
180
+ height='90vh'
181
+ open
182
+ padding='0px'
183
+ onClose={() => setSettingsOpen(false)}
184
+ hideCloseDefault
185
+ >
186
+ <LalaMoveConnectDescription />
187
+ </Modal>
188
+ </>
189
+ )}
190
+ </>
191
+ )}
192
+ <Alert
193
+ title={t('WEB_APPNAME', 'Ordering')}
194
+ content={alertState.content}
195
+ acceptText={t('ACCEPT', 'Accept')}
196
+ open={alertState.open}
197
+ onClose={() => setAlertState({ open: false, content: [] })}
198
+ onAccept={() => setAlertState({ open: false, content: [] })}
199
+ closeOnBackdrop={false}
200
+ />
201
+ <Confirm
202
+ title={t('WEB_APPNAME', 'Ordering')}
203
+ content={confirm.content}
204
+ acceptText={t('ACCEPT', 'Accept')}
205
+ open={confirm.open}
206
+ onClose={() => setConfirm({ ...confirm, open: false })}
207
+ onCancel={() => setConfirm({ ...confirm, open: false })}
208
+ onAccept={confirm.handleOnAccept}
209
+ closeOnBackdrop={false}
210
+ />
211
+ </Container>
212
+ )
213
+ }
214
+
215
+ export const LalaMoveConnect = (props) => {
216
+ const apiKeysProps = {
217
+ ...props,
218
+ UIComponent: LalaMoveConnectUI
219
+ }
220
+
221
+ return <ApiKeysListController {...apiKeysProps} />
222
+ }
@@ -0,0 +1,330 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const LalaMoveConnectContainer = styled.div`
4
+ padding: 26px 20px;
5
+ box-sizing: border-box;
6
+ width: 100%;
7
+ overflow-x: hidden;
8
+ position: relative;
9
+
10
+ @media (min-width: 768px) {
11
+ padding: 26px 40px;
12
+ }
13
+ `
14
+
15
+ export const Header = styled.div`
16
+ display: flex;
17
+ align-items: center;
18
+ margin-bottom: 30px;
19
+
20
+ ${props => props.theme?.rtl ? css`
21
+ margin-left: 35px;
22
+ ` : css`
23
+ margin-right: 35px;
24
+ `}
25
+
26
+ h1 {
27
+ font-size: 20px;
28
+ font-weight: 700;
29
+ margin: 0px;
30
+ text-transform: capitalize;
31
+ }
32
+
33
+ button {
34
+ line-height: 12px;
35
+ height: 16px;
36
+ font-size: 10px;
37
+ margin-left: 15px;
38
+ padding: 2px 8px;
39
+ border-radius: 50px;
40
+ ${props => props.theme.rtl && css`
41
+ margin-right: 15px;
42
+ margin-left: 0px;
43
+ `}
44
+ }
45
+ `
46
+
47
+ export const ApiKeysListTable = styled.table`
48
+ width: 100%;
49
+ margin-top: 25px;
50
+
51
+ thead {
52
+ border-bottom: 1px solid ${props => props.theme.colors.secundaryLight};
53
+ th {
54
+ padding: 10px 0;
55
+ &:last-child {
56
+ padding-left: 20px;
57
+ padding-right: 20px;
58
+ }
59
+ }
60
+ }
61
+ tr {
62
+ width: 100%;
63
+ th,
64
+ td {
65
+ font-size: 12px;
66
+ word-break: break-all;
67
+
68
+ &:last-child {
69
+ width: 100px;
70
+ > div {
71
+ padding-left: 20px;
72
+ padding-right: 20px;
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ tbody {
79
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
80
+ td {
81
+ padding-top: 9px;
82
+ padding-bottom: 9px;
83
+
84
+ &:last-child {
85
+ > div {
86
+ display: flex;
87
+ justify-content: flex-end;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ `
93
+
94
+ export const DropdownButtonWrapper = styled.div`
95
+ ${props => props?.theme?.rtl ? css`
96
+ border-right: 1px solid ${props => props.theme.colors.borderColor};
97
+ ` : css`
98
+ border-left: 1px solid ${props => props.theme.colors.borderColor};
99
+ `}
100
+ padding: 5px 20px;
101
+ button {
102
+ background: transparent !important;
103
+ border: none;
104
+ padding: 0px;
105
+ &:active,
106
+ &:focus {
107
+ border-color: unset !important;
108
+ box-shadow: none !important;
109
+ }
110
+ svg {
111
+ color: ${props => props.theme.colors.headingColor};
112
+ }
113
+
114
+ &:after {
115
+ display: none;
116
+ }
117
+ }
118
+
119
+ .show {
120
+ button {
121
+ background: ${props => props.theme.colors.secundary} !important;
122
+ border-color: unset !important;
123
+ box-shadow: none !important;
124
+ }
125
+ >div {
126
+ border: 1px solid ${props => props.theme.colors.borderColor};
127
+ box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.12);
128
+ }
129
+ }
130
+
131
+ > div {
132
+ > div {
133
+ border-radius: 8px;
134
+ .dropdown-item {
135
+ font-size: 12px;
136
+ color: ${props => props.theme.colors.headingColor};
137
+ }
138
+ .dropdown-item:last-child {
139
+ color: #E63757;
140
+ }
141
+ }
142
+ }
143
+ `
144
+ export const AddNewButton = styled.div`
145
+ cursor: pointer;
146
+ font-size: 12px;
147
+ color: ${props => props.theme.colors.lightGray};
148
+ margin: 20px 0;
149
+ width: fit-content;
150
+
151
+ &:hover {
152
+ color: ${props => props.theme.colors.primary};
153
+ }
154
+ `
155
+
156
+ export const AllSetting = styled.div`
157
+ user-select: none;
158
+ cursor: pointer;
159
+ margin-top: 36px;
160
+ cursor: pointer;
161
+ span {
162
+ font-weight: 600;
163
+ font-size: 14px;
164
+ color: ${props => props.theme.colors.primary};
165
+ }
166
+ svg {
167
+ color: ${props => props.theme.colors.primary};
168
+ margin-left: 5px;
169
+ transition: 0.2s linear;
170
+ ${props => props.theme.rtl && css`
171
+ margin-right: 5px;
172
+ margin-left: 0px;
173
+ `}
174
+ }
175
+ &:hover {
176
+ svg {
177
+ transform: translateX(3px);
178
+ }
179
+ }
180
+ `
181
+
182
+ export const Description = styled.p`
183
+ margin-top: 40px;
184
+ font-size: 14px;
185
+ margin-bottom: 0px;
186
+ text-align: justify;
187
+
188
+ @media (min-width: 768px) {
189
+ text-align: initial;
190
+ }
191
+ `
192
+
193
+ export const CategoryExtraContent = styled.div`
194
+ position: relative;
195
+ padding: 26px 26px 60px 26px;
196
+ box-sizing: border-box;
197
+ width: 100%;
198
+ overflow: auto;
199
+
200
+ ${props => props.theme?.rtl ? css`
201
+ border-right: 1px solid #E9ECEF;
202
+ ` : css`
203
+ border-left: 1px solid #E9ECEF;
204
+ `}
205
+
206
+ > button {
207
+ z-index: 100;
208
+ position: absolute;
209
+ top: 25px;
210
+ ${props => props.theme?.rtl ? css`
211
+ left: 20px;
212
+ ` : css`
213
+ right: 20px;
214
+ `}
215
+ }
216
+ `
217
+
218
+ export const Container = styled.div`
219
+ display: flex;
220
+ width: 0;
221
+ position: fixed;
222
+ box-shadow: -4px 0px 7px #ccc;
223
+
224
+ ${({ isDriverOrders }) => isDriverOrders && css`
225
+ position: absolute;
226
+ box-shadow: none;
227
+
228
+ ${props => props.theme?.rtl ? css`
229
+ border-right: 1px solid #CCC;
230
+ ` : css`
231
+ border-left: 1px solid #CCC;
232
+ `}
233
+ `}
234
+ background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
235
+ height: calc(var(--vh, 1vh) * 100);
236
+ top: 0px;
237
+ z-index: 1001;
238
+ overflow-x: hidden;
239
+ transition: 0.3s;
240
+
241
+ ${props => props.theme?.rtl ? css`
242
+ left: 0px;
243
+ ` : css`
244
+ right: 0px;
245
+ `}
246
+ @media print {
247
+ box-shadow: none;
248
+ }
249
+ `
250
+
251
+ export const DescriptionHeader = styled.div`
252
+ display: flex;
253
+ justify-content: flex-end;
254
+ align-items: center;
255
+ `
256
+
257
+ export const HeaderIcons = styled.div`
258
+ display: flex;
259
+ position: absolute;
260
+ top: 25px;
261
+ right: 20px;
262
+
263
+ > button:first-child {
264
+ ${props => props.theme?.rtl ? css`
265
+ margin-left: 8px;
266
+ ` : css`
267
+ margin-right: 8px;
268
+ `}
269
+ }
270
+ `
271
+
272
+ export const SettingListConatiner = styled.div`
273
+ width: 100%;
274
+ margin: 20px 0;
275
+ border-bottom: 1px solid #E9ECEF;
276
+ `
277
+
278
+ export const Tab = styled.div`
279
+ user-select: none;
280
+ padding: 10px 0px;
281
+ cursor: pointer;
282
+ color: ${props => props.theme.colors?.headingColor};
283
+ font-size: 14px;
284
+ white-space: nowrap;
285
+ ${props => props.theme?.rtl ? css`
286
+ margin-left: 30px;
287
+ ` : css`
288
+ margin-right: 30px;
289
+ `}
290
+
291
+ ${({ active }) => active && css`
292
+ border-bottom: 2px solid;
293
+ font-weight: 500;
294
+ `}
295
+
296
+ ${({ active }) => !active && css`
297
+ color: #909BA9;
298
+ `}
299
+ `
300
+
301
+ export const Paragraph = styled.div`
302
+ margin-top: 20px;
303
+ h2{
304
+ font-size: 16px;
305
+ }
306
+ p{
307
+ white-space: pre-line;
308
+ font-size: 12px;
309
+ margin: 0;
310
+ }
311
+ span {
312
+ font-size: 12px;
313
+ }
314
+ a {
315
+ text-decoration: underline !important;
316
+ cursor: pointer;
317
+ font-size: 12px;
318
+ color: ${props => props.theme.colors.primary} !important;
319
+ }
320
+ .bold {
321
+ font-weight: 600;
322
+ }
323
+ `
324
+
325
+ export const PurchaseWrapper = styled.div`
326
+ button {
327
+ border-radius: 5px;
328
+ }
329
+ margin-top: 15px;
330
+ `
@@ -7,6 +7,7 @@ import { SettingItemUI } from './SettingItemUI'
7
7
  import { AddressFieldsSetting } from './AddressFieldsSetting'
8
8
  import { CheckoutFieldsSetting } from './CheckoutFieldsSetting'
9
9
  import { LanguageSetting } from './LanguageSetting'
10
+ import { LalaMoveConnect } from './LalaMoveConnect'
10
11
  import { SettingsDetail } from './SettingsDetail'
11
12
  import { EmailSetting } from './EmailSetting'
12
13
  import { SettingsList } from './SettingsList'
@@ -39,6 +40,7 @@ export {
39
40
  AddressFieldsSetting,
40
41
  CheckoutFieldsSetting,
41
42
  LanguageSetting,
43
+ LalaMoveConnect,
42
44
  SettingsDetail,
43
45
  EmailSetting,
44
46
  SettingsList,