ordering-ui-admin-external 1.43.30 → 1.43.32

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 (39) hide show
  1. package/_bundles/{ordering-ui-admin.2175191dd9617085f573.js → ordering-ui-admin.395af03194f63ca488ce.js} +2 -2
  2. package/_modules/components/Delivery/DriverGroupSelectorHeader/index.js +14 -13
  3. package/_modules/components/Delivery/DriversGroupLogs/index.js +2 -75
  4. package/_modules/components/Delivery/DriversTimeDisplay/UserList.js +10 -18
  5. package/_modules/components/Delivery/DriversTimeDisplay/index.js +63 -16
  6. package/_modules/components/Delivery/DriversTimeDisplay/styles.js +7 -6
  7. package/_modules/components/Orders/DriverMultiSelector/index.js +46 -17
  8. package/_modules/components/Stores/BusinessDetails/index.js +4 -1
  9. package/_modules/components/Stores/BusinessLogs/index.js +185 -0
  10. package/_modules/components/Stores/BusinessLogs/styles.js +73 -0
  11. package/_modules/components/Stores/BusinessSummary/index.js +8 -7
  12. package/_modules/components/Stores/index.js +7 -0
  13. package/_modules/components/Users/UserFormDetails/index.js +48 -13
  14. package/_modules/components/Users/UserFormDetails/styles.js +8 -2
  15. package/_modules/index.js +6 -0
  16. package/_modules/styles/MultiSelect/index.js +56 -10
  17. package/_modules/styles/MultiSelect/styles.js +16 -5
  18. package/_modules/styles/Selects/index.js +62 -51
  19. package/_modules/utils/index.js +107 -30
  20. package/package.json +2 -2
  21. package/src/components/Delivery/DriverGroupSelectorHeader/index.js +21 -21
  22. package/src/components/Delivery/DriversGroupLogs/index.js +1 -32
  23. package/src/components/Delivery/DriversTimeDisplay/UserList.js +35 -41
  24. package/src/components/Delivery/DriversTimeDisplay/index.js +89 -34
  25. package/src/components/Delivery/DriversTimeDisplay/styles.js +22 -4
  26. package/src/components/Orders/DriverMultiSelector/index.js +46 -10
  27. package/src/components/Stores/BusinessDetails/index.js +6 -0
  28. package/src/components/Stores/BusinessLogs/index.js +304 -0
  29. package/src/components/Stores/BusinessLogs/styles.js +224 -0
  30. package/src/components/Stores/BusinessSummary/index.js +7 -5
  31. package/src/components/Stores/index.js +2 -0
  32. package/src/components/Users/UserFormDetails/index.js +32 -2
  33. package/src/components/Users/UserFormDetails/styles.js +26 -0
  34. package/src/index.js +2 -0
  35. package/src/styles/MultiSelect/index.js +104 -33
  36. package/src/styles/MultiSelect/styles.js +16 -1
  37. package/src/styles/Selects/index.js +14 -10
  38. package/src/utils/index.js +62 -29
  39. /package/_bundles/{ordering-ui-admin.2175191dd9617085f573.js.LICENSE.txt → ordering-ui-admin.395af03194f63ca488ce.js.LICENSE.txt} +0 -0
@@ -0,0 +1,304 @@
1
+ import React, { useEffect } from 'react'
2
+ import { useLanguage, useUtils, useConfig, BusinessLogs as BusinessLogsController } from 'ordering-components-admin-external'
3
+ import Skeleton from 'react-loading-skeleton'
4
+ import { Modal, Pagination } from '../../Shared'
5
+ import { getAttributeName } from '../../../utils'
6
+ import {
7
+ BusinessLogsContainer,
8
+ TableWrapper,
9
+ Table,
10
+ UserInfoContainer,
11
+ DateTimeWrapper,
12
+ NoData,
13
+ WrapperPagination,
14
+ DataListTable,
15
+ EventTypeContainer,
16
+ SeeChanges,
17
+ SchedulesWrapper,
18
+ Schedules,
19
+ ScheduleDay,
20
+ ScheduleLapses,
21
+ ScheduleTitle
22
+ } from './styles'
23
+ import moment from 'moment'
24
+
25
+ export const BusinessLogsUI = (props) => {
26
+ const {
27
+ logsList,
28
+ paginationProps,
29
+ getBusinessLogs,
30
+ actionDisabled
31
+ } = props
32
+
33
+ const [, t] = useLanguage()
34
+ const [{ parseDate }] = useUtils()
35
+ const [open, setOpen] = React.useState(false)
36
+ const [schedules, setSchedules] = React.useState({
37
+ newSchedule: [],
38
+ oldSchedule: []
39
+ })
40
+ const [{ configs }] = useConfig()
41
+ const formatTime = configs?.general_hour_format?.value
42
+
43
+ const handleChangePage = (page) => {
44
+ getBusinessLogs(page, 10)
45
+ }
46
+
47
+ const handleChangePageSize = (pageSize) => {
48
+ const expectedPage = Math.ceil(paginationProps.from / pageSize)
49
+ getBusinessLogs(expectedPage, pageSize)
50
+ }
51
+
52
+ const getValidLogData = (data) => {
53
+ return typeof data === 'object'
54
+ ? Object.values(data)
55
+ : typeof data === 'string' ? JSON.parse(data) : data
56
+ }
57
+
58
+ const handleSchedules = (_schedules) => {
59
+ setSchedules({
60
+ newSchedule: typeof _schedules?.new === 'string' ? JSON.parse(_schedules?.new) : _schedules?.new,
61
+ oldSchedule: typeof _schedules?.old === 'string' ? JSON.parse(_schedules?.old) : _schedules?.old
62
+ })
63
+ }
64
+
65
+ const scheduleModalData = (_schedules) => {
66
+ setOpen(true)
67
+ handleSchedules(_schedules)
68
+ }
69
+
70
+ useEffect(() => {
71
+ if (logsList.loading || logsList.logs.length > 0 || paginationProps.totalPages <= 1 || logsList.error) return
72
+ if (paginationProps.currentPage !== paginationProps.totalPages) {
73
+ handleChangePage(paginationProps.currentPage)
74
+ } else {
75
+ handleChangePage(paginationProps.currentPage - 1)
76
+ }
77
+ }, [logsList.logs, paginationProps])
78
+
79
+ const daysOptions = [
80
+ t('DAY7', 'Sunday'),
81
+ t('DAY1', 'Monday'),
82
+ t('DAY2', 'Tuesday'),
83
+ t('DAY3', 'Wednesday'),
84
+ t('DAY4', 'Thursday'),
85
+ t('DAY5', 'Friday'),
86
+ t('DAY6', 'Saturday')
87
+ ]
88
+
89
+ const checkTime = (val) => (val < 10 ? `0${val}` : val)
90
+ const timeFormated = (time) => {
91
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
92
+ }
93
+
94
+ const getSchedule = (_schedules) => {
95
+ return ((!_schedules?.length && _schedules?.length < 1) ? <p>{t('NONE', 'None')}</p> : _schedules?.map((schedule, i) => {
96
+ return (
97
+ <ScheduleDay key={i}>
98
+ <span>{daysOptions[i]}</span>
99
+ <ScheduleLapses>
100
+ {schedule?.enabled && schedule?.lapses?.map((item, i) => {
101
+ return <p key={i}>{`${timeFormated(item?.open)} - ${timeFormated(item?.close)}`}</p>
102
+ })}
103
+ {!schedule?.enabled && (
104
+ <p>{t('UNAVAILABLE', 'Unavailable')}</p>
105
+ )}
106
+ </ScheduleLapses>
107
+ </ScheduleDay>
108
+ )
109
+ })
110
+ )
111
+ }
112
+
113
+ return (
114
+ <>
115
+ <BusinessLogsContainer
116
+ disabled={actionDisabled}
117
+ >
118
+ <h1>{t('LOGS', 'Logs')}</h1>
119
+ <TableWrapper>
120
+ {(logsList.loading || logsList.logs.length > 0) ? (
121
+ <Table>
122
+ <thead>
123
+ <tr>
124
+ <th>{t('CONTROL_PANEL_USERS', 'Users')}</th>
125
+ <th>{t('EVENTS_TYPE', 'Events type')}</th>
126
+ <th>{t('DETAILS', 'Details')}</th>
127
+ <th>{t('NEW', 'New')}</th>
128
+ <th>{t('OLD', 'Old')}</th>
129
+ <th>{t('EXPORT_DATE', 'Date')}</th>
130
+ <th>{t('USER_AGENT', 'User agent')}</th>
131
+ </tr>
132
+ </thead>
133
+ {logsList.loading ? (
134
+ [...Array(10).keys()].map(i => (
135
+ <tbody key={i}>
136
+ <tr>
137
+ <td>
138
+ <UserInfoContainer>
139
+ <p><Skeleton width={100} /></p>
140
+ <p><Skeleton width={120} /></p>
141
+ </UserInfoContainer>
142
+ </td>
143
+ <td>
144
+ <DataListTable>
145
+ <tbody>
146
+ <tr>
147
+ <td><Skeleton width={100} /></td>
148
+ <td><Skeleton width={20} /></td>
149
+ <td><Skeleton width={20} /></td>
150
+ </tr>
151
+ </tbody>
152
+ </DataListTable>
153
+ </td>
154
+ <td>
155
+ <DateTimeWrapper>
156
+ <Skeleton />
157
+ </DateTimeWrapper>
158
+ </td>
159
+ <td>
160
+ <Skeleton />
161
+ </td>
162
+ </tr>
163
+ </tbody>
164
+ ))
165
+ ) : (
166
+ !logsList.error && logsList.logs?.map(log => (
167
+ <tbody key={log.id}>
168
+ <tr>
169
+ <td>
170
+ <UserInfoContainer>
171
+ <p>{log?.author?.name || log?.user?.name} {log?.author?.lastname || log?.user?.lastname}</p>
172
+ <p>{log?.author?.email || log?.user?.email}</p>
173
+ </UserInfoContainer>
174
+ </td>
175
+ <td>
176
+ <EventTypeContainer>
177
+ <p>{t((log?.event || '').toUpperCase())}</p>
178
+ </EventTypeContainer>
179
+ </td>
180
+ <td>
181
+ <DataListTable>
182
+ {log?.data && getValidLogData(log?.data).filter(item => item.attribute !== 'schedule_ranges').map((item, i) => (
183
+ <tbody key={i}>
184
+ <tr>
185
+ <td>{getAttributeName(item?.attribute)}</td>
186
+ </tr>
187
+ </tbody>
188
+ ))}
189
+ </DataListTable>
190
+ </td>
191
+ <td>
192
+ <DataListTable>
193
+ {log?.data && getValidLogData(log?.data).filter(item => item.attribute !== 'schedule_ranges').map((item, i) => (
194
+ <tbody key={i}>
195
+ <tr>
196
+ {(item.attribute !== 'schedule')
197
+ ? (
198
+ <td>
199
+ {
200
+ (typeof item?.new !== 'undefined' && item?.new !== null)
201
+ ? `${item?.new}`
202
+ : item?.added?.length > 0 ? item?.added?.toString() : t('NONE', 'None')
203
+ }
204
+ </td>
205
+ )
206
+ : (
207
+ <td>
208
+ <SeeChanges onClick={() => scheduleModalData(item, 'new')}>{t('SEE_CHANGES', 'See changes')}</SeeChanges>
209
+ </td>
210
+ )}
211
+ </tr>
212
+ </tbody>
213
+ ))}
214
+ </DataListTable>
215
+ </td>
216
+ <td>
217
+ <DataListTable>
218
+ {log?.data && getValidLogData(log?.data).filter(item => item.attribute !== 'schedule_ranges').map((item, i) => (
219
+ <tbody key={i}>
220
+ <tr>
221
+ {item.attribute !== 'schedule'
222
+ ? (
223
+ <td>
224
+ {
225
+ (typeof item?.old !== 'undefined' && item?.old !== null)
226
+ ? `${item?.old}`
227
+ : item?.removed?.length > 0 ? item?.removed?.toString() : t('NONE', 'None')
228
+ }
229
+ </td>
230
+ )
231
+ : (
232
+ <td>
233
+ <SeeChanges onClick={() => scheduleModalData(item, 'old')}>{t('SEE_CHANGES', 'See changes')}</SeeChanges>
234
+ </td>
235
+ )}
236
+ </tr>
237
+ </tbody>
238
+ ))}
239
+ </DataListTable>
240
+ </td>
241
+ <td>
242
+ <DateTimeWrapper>
243
+ {parseDate(log.created_at, { utc: false })}
244
+ </DateTimeWrapper>
245
+ </td>
246
+ <td>
247
+ {log?.user_agent}
248
+ </td>
249
+ </tr>
250
+ </tbody>
251
+ ))
252
+ )}
253
+ </Table>
254
+ ) : (
255
+ <NoData>{t('NO_DATA', 'No Data')}</NoData>
256
+ )}
257
+ </TableWrapper>
258
+ {logsList?.logs.length > 0 && (
259
+ <WrapperPagination>
260
+ <Pagination
261
+ isHidePagecontrol
262
+ currentPage={paginationProps.currentPage}
263
+ totalPages={paginationProps.totalPages}
264
+ handleChangePage={handleChangePage}
265
+ handleChangePageSize={handleChangePageSize}
266
+ />
267
+ </WrapperPagination>
268
+ )}
269
+ </BusinessLogsContainer>
270
+ <Modal
271
+ width='40%'
272
+ height='60vh'
273
+ style={{ overflowY: 'auto' }}
274
+ padding='30px'
275
+ title={t('SCHEDULE_CHANGES', 'Schedule changes')}
276
+ open={open}
277
+ onClose={() => setOpen(false)}
278
+ >
279
+ <SchedulesWrapper border={!!schedules?.oldSchedule}>
280
+ {schedules?.newSchedule && (
281
+ <Schedules>
282
+ <ScheduleTitle>{t('NEW', 'New')}</ScheduleTitle>
283
+ {getSchedule(schedules?.newSchedule)}
284
+ </Schedules>
285
+ )}
286
+ {schedules?.oldSchedule && (
287
+ <Schedules>
288
+ <ScheduleTitle>{t('OLD', 'Old')}</ScheduleTitle>
289
+ {getSchedule(schedules?.oldSchedule)}
290
+ </Schedules>
291
+ )}
292
+ </SchedulesWrapper>
293
+ </Modal>
294
+ </>
295
+ )
296
+ }
297
+
298
+ export const BusinessLogs = (props) => {
299
+ const businessLogsProps = {
300
+ ...props,
301
+ UIComponent: BusinessLogsUI
302
+ }
303
+ return <BusinessLogsController {...businessLogsProps} />
304
+ }
@@ -0,0 +1,224 @@
1
+ import styled, { css } from 'styled-components'
2
+
3
+ export const BusinessLogsContainer = styled.div`
4
+ height: calc(100% - 100px);
5
+ padding: 20px;
6
+
7
+ h1 {
8
+ font-size: 20px;
9
+ font-weight: 700;
10
+ margin-top: 5px;
11
+ }
12
+
13
+ ${({ disabled }) => disabled && css`
14
+ opacity: 0.7;
15
+ pointer-events: none;
16
+ `}
17
+ `
18
+
19
+ export const TableWrapper = styled.div`
20
+ overflow: auto;
21
+ height: 100%;
22
+ `
23
+
24
+ export const SeeChanges = styled.span`
25
+ color: ${props => props.theme.colors.primary};
26
+ cursor: pointer;
27
+ &:hover {
28
+ text-decoration: underline;
29
+ }
30
+ `
31
+
32
+ export const Table = styled.table`
33
+ width: 100%;
34
+ min-width: 1000px;
35
+ color: ${props => props.theme.colors?.headingColor};
36
+
37
+ thead {
38
+ tr {
39
+ border-bottom: solid 1px ${props => props.theme.colors.disabled};
40
+ th {
41
+ padding: 13px 0;
42
+ font-size: 12px;
43
+ &:first-child {
44
+ width: 10%;
45
+ ${props => props.theme?.rtl ? css`
46
+ padding-left: 15px;
47
+ ` : css`
48
+ padding-right: 15px;
49
+ `}
50
+ box-sizing: border-box;
51
+ }
52
+ &:nth-child(3) {
53
+ width: 35%;
54
+ padding-left: 15px;
55
+ padding-right: 15px;
56
+ box-sizing: border-box;
57
+ }
58
+ &:nth-child(4) {
59
+ ${props => props.theme?.rtl ? css`
60
+ padding-right: 15px;
61
+ ` : css`
62
+ padding-left: 15px;
63
+ `}
64
+ box-sizing: border-box;
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ > tbody {
71
+ border-bottom: 1px solid ${props => props.theme.colors.borderColor};
72
+ td {
73
+ padding: 13px 0;
74
+ font-size: 12px;
75
+ &:first-child {
76
+ width: 10%;
77
+ ${props => props.theme?.rtl ? css`
78
+ padding-left: 15px;
79
+ ` : css`
80
+ padding-right: 15px;
81
+ `}
82
+ box-sizing: border-box;
83
+ }
84
+ &:nth-child(3) {
85
+ width: 35%;
86
+ }
87
+ &:nth-child(4) {
88
+ ${props => props.theme?.rtl ? css`
89
+ padding-right: 15px;
90
+ ` : css`
91
+ padding-left: 15px;
92
+ `}
93
+ box-sizing: border-box;
94
+ }
95
+ }
96
+ }
97
+ `
98
+
99
+ export const UserInfoContainer = styled.div`
100
+ p {
101
+ color: ${props => props.theme.colors.lightGray};
102
+ margin: 0px;
103
+ font-size: 12px;
104
+ &:first-child {
105
+ color: ${props => props.theme.colors.headingColor};
106
+ font-weight: 500;
107
+ }
108
+ }
109
+ `
110
+
111
+ export const DateTimeWrapper = styled.div`
112
+ white-space: nowrap;
113
+ font-size: 12px;
114
+ min-height: 36px;
115
+ display: flex;
116
+ align-items: center;
117
+
118
+ ${props => props.theme?.rtl ? css`
119
+ padding-left: 15px;
120
+ margin-left: 15px;
121
+ border-left: 1px solid ${props => props.theme.colors.borderColor};
122
+ ` : css`
123
+ padding-right: 15px;
124
+ margin-right: 15px;
125
+ border-right: 1px solid ${props => props.theme.colors.borderColor};
126
+ `}
127
+ `
128
+
129
+ export const NoData = styled.div`
130
+ font-size: 16px;
131
+ `
132
+ export const WrapperPagination = styled.div`
133
+ display: flex;
134
+ align-items: center;
135
+ padding: 20px 0;
136
+ `
137
+
138
+ export const DataListTable = styled.table`
139
+ width: 100%;
140
+ border-right: 1px solid ${props => props.theme.colors.borderColor};
141
+
142
+ tbody {
143
+ border-bottom: none;
144
+ td {
145
+ box-sizing: border-box;
146
+ &:first-child {
147
+ width: 50% !important;
148
+ padding-left: 15px;
149
+ padding-right: 15px;
150
+ box-sizing: border-box;
151
+ }
152
+ &:not(:first-child) {
153
+ width: initial !important;
154
+ }
155
+ white-space: nowrap;
156
+ padding-top: 10px;
157
+ padding-bottom: 10px;
158
+ ${props => props.theme?.rtl ? css`
159
+ padding-left: 15px;
160
+ ` : css`
161
+ padding-right: 15px;
162
+ `}
163
+ }
164
+ }
165
+ `
166
+
167
+ export const EventTypeContainer = styled.div`
168
+ white-space: nowrap;
169
+ font-size: 12px;
170
+ min-height: 36px;
171
+ display: flex;
172
+ align-items: center;
173
+ padding-right: 15px;
174
+ padding-left: 15px;
175
+ margin-left: 15px;
176
+ margin-right: 10px;
177
+ border-right: 1px solid ${props => props.theme.colors.borderColor};
178
+ border-left: 1px solid ${props => props.theme.colors.borderColor};
179
+ p{
180
+ margin-bottom: 0px;
181
+ }
182
+ `
183
+
184
+ export const SchedulesWrapper = styled.div`
185
+ display: flex;
186
+ flex-direction: row;
187
+ gap: 30px;
188
+ justify-content: center;
189
+
190
+ ${props => props?.border && css`
191
+ div:first-child {
192
+ border-right: 1px solid #E9ECEF;
193
+ padding-right: 30px;
194
+ `
195
+ }
196
+ `
197
+
198
+ export const Schedules = styled.div`
199
+ display: flex;
200
+ flex-direction: column;
201
+ gap: 20px;
202
+ `
203
+
204
+ export const ScheduleDay = styled.div`
205
+ display: flex;
206
+ align-items: center;
207
+ gap: 10px;
208
+ justify-content: space-between;
209
+ `
210
+
211
+ export const ScheduleLapses = styled.div`
212
+ display: flex;
213
+ flex-direction: column;
214
+ border-left: 1px solid #E9ECEF;
215
+ padding-left: 10px;
216
+
217
+ p {
218
+ margin: 0px;
219
+ }
220
+ `
221
+
222
+ export const ScheduleTitle = styled.h2`
223
+ text-align: center;
224
+ `
@@ -74,7 +74,7 @@ export const BusinessSummary = (props) => {
74
74
  window.open(storeUrl, '_blank')
75
75
  }
76
76
 
77
- const itemsExcluded = !!spoonityConfig ? ['publishing', 'personalization'] : ['publishing', 'spoonity_key', 'personalization']
77
+ const itemsExcluded = spoonityConfig ? ['publishing', 'personalization', 'logs'] : ['publishing', 'spoonity_key', 'personalization', 'logs']
78
78
 
79
79
  const businessConfigs = [
80
80
  {
@@ -141,13 +141,15 @@ export const BusinessSummary = (props) => {
141
141
  key: 'webhooks',
142
142
  value: t('WEBHOOKS', 'Webhooks')
143
143
  },
144
- // {
145
- // key: 'places',
146
- // value: t('PLACES', 'Places')
147
- // },
148
144
  {
145
+ key: 'places',
146
+ value: t('PLACES', 'Places')
147
+ }, {
149
148
  key: 'spoonity_key',
150
149
  value: t('SPOONITY_KEY', 'Sponity key')
150
+ }, {
151
+ key: 'logs',
152
+ value: t('LOGS', 'Logs')
151
153
  }
152
154
  ]
153
155
 
@@ -17,6 +17,7 @@ import { BusinessImages } from './BusinessImages'
17
17
  import { BusinessInformation } from './BusinessInformation'
18
18
  import { BusinessInfoSettingList } from './BusinessInfoSettingList'
19
19
  import { BusinessLocation } from './BusinessLocation'
20
+ import { BusinessLogs } from './BusinessLogs'
20
21
  import { BusinessMenu } from './BusinessMenu'
21
22
  import { BusinessNotifications } from './BusinessNotifications'
22
23
  import { BusinessOrderingChannels } from './BusinessOrderingChannels'
@@ -135,6 +136,7 @@ export {
135
136
  BusinessInformation,
136
137
  BusinessInfoSettingList,
137
138
  BusinessLocation,
139
+ BusinessLogs,
138
140
  BusinessMenu,
139
141
  BusinessNotifications,
140
142
  BusinessOrderingChannels,
@@ -6,10 +6,11 @@ import parsePhoneNumber from 'libphonenumber-js'
6
6
  import { formatPhoneNumber } from 'react-phone-number-input'
7
7
  import { Alert, InputPhoneNumber, RangeCalendar } from '../../Shared'
8
8
  import { sortInputFields } from '../../../utils'
9
- import { Switch, Input, Button } from '../../../styles'
9
+ import { Switch, Input, Button, DefaultSelect } from '../../../styles'
10
10
  import { Eye, EyeSlash } from 'react-bootstrap-icons'
11
11
  import { UserTypeSelector } from '../UserTypeSelector'
12
12
  import { OccupationSelector } from '../OccupationSelector'
13
+ import { timezones } from '../../../config/constants'
13
14
 
14
15
  import {
15
16
  FormInput,
@@ -19,7 +20,8 @@ import {
19
20
  WrapperPassword,
20
21
  TogglePassword,
21
22
  CalendarWrapper,
22
- WrapperUserTypeSelector
23
+ WrapperUserTypeSelector,
24
+ InputWrapper
23
25
  } from './styles'
24
26
 
25
27
  export const UserFormDetailsUI = (props) => {
@@ -49,6 +51,8 @@ export const UserFormDetailsUI = (props) => {
49
51
  const [isValidPhoneNumber, setIsValidPhoneNumber] = useState(null)
50
52
  const [userPhoneNumber, setUserPhoneNumber] = useState(null)
51
53
  const [alertState, setAlertState] = useState({ open: false, content: [] })
54
+ const [timezonesOptions, setTimezonesOptions] = useState([])
55
+ const [timezoneSearchValue, setTimezoneSearchValue] = useState('')
52
56
  const [, { setUserCustomer }] = useCustomer()
53
57
  const emailInput = useRef(null)
54
58
 
@@ -219,6 +223,18 @@ export const UserFormDetailsUI = (props) => {
219
223
  })
220
224
  }, [formMethods])
221
225
 
226
+ useEffect(() => {
227
+ const _timezonesOptions = timezones
228
+ .filter(timezone => timezone.toLocaleLowerCase().includes(timezoneSearchValue.toLocaleLowerCase()))
229
+ .map(timezone => {
230
+ return {
231
+ value: timezone,
232
+ content: timezone
233
+ }
234
+ })
235
+ setTimezonesOptions(_timezonesOptions)
236
+ }, [timezoneSearchValue])
237
+
222
238
  return (
223
239
  <>
224
240
  <FormInput onSubmit={formMethods.handleSubmit(onSubmit)} isCheckout={isCheckout}>
@@ -269,6 +285,20 @@ export const UserFormDetailsUI = (props) => {
269
285
  </React.Fragment>
270
286
  )
271
287
  )}
288
+ <InputWrapper isTimezone>
289
+ <DefaultSelect
290
+ placeholder={t('SELECT_TIMEZONE', 'Select a timezone')}
291
+ defaultValue={formState?.changes?.timezone ?? user?.timezone ?? ''}
292
+ options={timezonesOptions}
293
+ onChange={val => handleChangeSwtich('timezone', val)}
294
+ optionInnerMaxHeight='300px'
295
+ isShowSearchBar
296
+ searchBarIsCustomLayout
297
+ searchBarIsNotLazyLoad
298
+ searchValue={timezoneSearchValue}
299
+ handleChangeSearch={setTimezoneSearchValue}
300
+ />
301
+ </InputWrapper>
272
302
  {isProfessional && occupations?.length > 0 && (
273
303
  <OccupationSelector
274
304
  occupationId={user?.occupation_id}
@@ -171,3 +171,29 @@ export const WrapperUserTypeSelector = styled.div`
171
171
  color: ${props => props.theme.colors.secundaryContrast};
172
172
  }
173
173
  `
174
+ export const InputWrapper = styled.div`
175
+ display: flex;
176
+ flex-direction: column;
177
+ width: 100%;
178
+ margin-bottom: 20px;
179
+
180
+ .select {
181
+ padding-top: 4px;
182
+ padding-bottom: 4px;
183
+ border: none;
184
+ background-color: ${props => props.theme.colors.secundary};
185
+ font-size: 14px;
186
+
187
+ ${({ isTimezone }) => isTimezone && css`
188
+ > div:first-child {
189
+ > div {
190
+ overflow: hidden;
191
+ }
192
+ }
193
+ .list-wrapper {
194
+ font-size: 12px;
195
+ max-height: 220px;
196
+ }
197
+ `}
198
+ }
199
+ `
package/src/index.js CHANGED
@@ -245,6 +245,7 @@ import {
245
245
  BusinessOwners,
246
246
  BusinessTypes,
247
247
  BusinessLocation,
248
+ BusinessLogs,
248
249
  BusinessImages,
249
250
  BusinessVideos,
250
251
  SeoOptions,
@@ -674,6 +675,7 @@ export {
674
675
  BusinessOwners,
675
676
  BusinessTypes,
676
677
  BusinessLocation,
678
+ BusinessLogs,
677
679
  BusinessImages,
678
680
  BusinessVideos,
679
681
  SeoOptions,