ordering-ui-external 1.1.2 → 1.1.5

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 (24) hide show
  1. package/_bundles/{0.ordering-ui.61d857607dc95f3ab08c.js → 0.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  2. package/_bundles/{1.ordering-ui.61d857607dc95f3ab08c.js → 1.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  3. package/_bundles/{3.ordering-ui.61d857607dc95f3ab08c.js → 3.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  4. package/_bundles/{4.ordering-ui.61d857607dc95f3ab08c.js → 4.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  5. package/_bundles/{5.ordering-ui.61d857607dc95f3ab08c.js → 5.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  6. package/_bundles/{6.ordering-ui.61d857607dc95f3ab08c.js → 6.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  7. package/_bundles/{7.ordering-ui.61d857607dc95f3ab08c.js → 7.ordering-ui.ff2158785c5abf7d9a26.js} +1 -1
  8. package/_bundles/{7.ordering-ui.61d857607dc95f3ab08c.js.LICENSE.txt → 7.ordering-ui.ff2158785c5abf7d9a26.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.61d857607dc95f3ab08c.js → 8.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  10. package/_bundles/{9.ordering-ui.61d857607dc95f3ab08c.js → 9.ordering-ui.ff2158785c5abf7d9a26.js} +0 -0
  11. package/_bundles/ordering-ui.ff2158785c5abf7d9a26.js +2 -0
  12. package/_bundles/{ordering-ui.61d857607dc95f3ab08c.js.LICENSE.txt → ordering-ui.ff2158785c5abf7d9a26.js.LICENSE.txt} +3 -3
  13. package/_modules/index.js +8 -0
  14. package/_modules/themes/five/index.js +40 -0
  15. package/_modules/themes/five/src/components/OrderDetails/index.js +72 -27
  16. package/_modules/themes/five/src/components/ReviewProduct/styles.js +6 -6
  17. package/_modules/themes/six/index.js +8 -0
  18. package/package.json +1 -1
  19. package/src/index.js +2 -0
  20. package/src/themes/five/index.js +10 -0
  21. package/src/themes/five/src/components/OrderDetails/index.js +45 -28
  22. package/src/themes/five/src/components/ReviewProduct/styles.js +0 -14
  23. package/src/themes/six/index.js +2 -0
  24. package/_bundles/ordering-ui.61d857607dc95f3ab08c.js +0 -2
@@ -38,6 +38,7 @@ import {
38
38
  BusinessWrapper,
39
39
  BusinessInfo,
40
40
  OrderInfo,
41
+ OrderIdSec,
41
42
  StatusBar,
42
43
  OrderCustomer,
43
44
  PhotoBlock,
@@ -61,6 +62,7 @@ import {
61
62
  HeaderTitle,
62
63
  PlaceSpotSection,
63
64
  BtsOrderStatus,
65
+ OrderStatusAndLinkContainer,
64
66
  LinkWrapper,
65
67
  MapWrapper,
66
68
  BusinessExternalWrapper
@@ -108,7 +110,7 @@ const OrderDetailsUI = (props) => {
108
110
  const [isService, setIsService] = useState(false)
109
111
  const [isOrderHistory, setIsOrderHistory] = useState(false)
110
112
  const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
111
-
113
+ const [isShowBusinessLogo, setIsShowBusinessLogo] = useState(true)
112
114
  const { order, loading, businessData, error } = props.order
113
115
  const yourSpotString = order?.delivery_type === 3 ? t('TABLE_NUMBER', 'Table number') : t('SPOT_NUMBER', 'Spot number')
114
116
  const acceptedStatus = [1, 2, 5, 6, 10, 11, 12]
@@ -183,6 +185,26 @@ const OrderDetailsUI = (props) => {
183
185
  setUnreadAlert({ business, driver })
184
186
  }
185
187
 
188
+ const validateImage = (src) => {
189
+ return new Promise((resolve, reject) => {
190
+ if (!src || typeof src !== 'string') {
191
+ resolve(false)
192
+ }
193
+ try {
194
+ const image = new Image()
195
+ image.src = src
196
+ image.complete ? resolve(true) : resolve(false)
197
+ } catch (err) {
198
+ resolve(false)
199
+ }
200
+ })
201
+ }
202
+
203
+ const businessLogoUrlValidation = async () => {
204
+ const isValidImage = await validateImage(order?.business?.logo)
205
+ setIsShowBusinessLogo(isValidImage)
206
+ }
207
+
186
208
  const locations = [
187
209
  { ...order?.driver?.location, icon: order?.driver?.photo || theme.images?.dummies?.driverPhoto },
188
210
  { ...order?.business?.location, icon: order?.business?.logo || theme.images?.dummies?.businessLogo },
@@ -311,6 +333,7 @@ const OrderDetailsUI = (props) => {
311
333
  if (!order) return
312
334
  const _isService = order.products.some(product => product.type === 'service')
313
335
  setIsService(_isService)
336
+ businessLogoUrlValidation()
314
337
  }, [order])
315
338
 
316
339
  const OrderMapSection = (props) => {
@@ -384,7 +407,7 @@ const OrderDetailsUI = (props) => {
384
407
  <WrapperLeftContainer>
385
408
  <OrderInfo>
386
409
  <TitleContainer>
387
- <h1>{isService ? t('APPOINTMENT', 'Appointment') : t('ORDER', theme?.defaultLanguages?.ORDER || 'Order')} #{order?.id}</h1>
410
+ <OrderIdSec>{isService ? t('APPOINTMENT', 'Appointment') : t('ORDER', theme?.defaultLanguages?.ORDER || 'Order')} #{order?.id}</OrderIdSec>
388
411
  {parseInt(configs?.guest_uuid_access?.value, 10) && order?.hash_key && (
389
412
  <Content className='order-content'>
390
413
  <ShareOrder>
@@ -419,40 +442,34 @@ const OrderDetailsUI = (props) => {
419
442
  acceptedStatus.includes(parseInt(order?.status, 10)) ||
420
443
  !isOriginalLayout
421
444
  ) && (
422
- <ReOrder>
445
+ <ReOrder>
446
+ <Button
447
+ color='primary'
448
+ outline
449
+ onClick={() => handleStartNewOrder(order.id)}
450
+ disabled={reorderState?.loading}
451
+ >
452
+ {t('START_NEW_ORDER', 'Start new order')}
453
+ </Button>
454
+ {completedStatus.includes(parseInt(order?.status, 10)) && (
423
455
  <Button
424
456
  color='primary'
425
457
  outline
426
- onClick={() => handleStartNewOrder(order.id)}
458
+ onClick={() => handleClickReorder(order)}
427
459
  disabled={reorderState?.loading}
428
460
  >
429
- {t('START_NEW_ORDER', 'Start new order')}
461
+ {reorderState?.loading
462
+ ? t('LOADING', 'Loading...')
463
+ : t('REORDER', 'Reorder')}
430
464
  </Button>
431
- {completedStatus.includes(parseInt(order?.status, 10)) && (
432
- <Button
433
- color='primary'
434
- outline
435
- onClick={() => handleClickReorder(order)}
436
- disabled={reorderState?.loading}
437
- >
438
- {reorderState?.loading
439
- ? t('LOADING', 'Loading...')
440
- : t('REORDER', 'Reorder')}
441
- </Button>
442
- )}
443
- </ReOrder>
444
- )}
465
+ )}
466
+ </ReOrder>
467
+ )}
445
468
  </TitleContainer>
446
469
  {showDeliveryProgress && (
447
470
  <>
448
471
  <StatusBar percentage={getOrderStatus(order?.status)?.percentage} />
449
- <div
450
- style={{
451
- display: 'flex',
452
- flexDirection: 'row',
453
- justifyContent: 'space-between'
454
- }}
455
- >
472
+ <OrderStatusAndLinkContainer>
456
473
  <p className='order-status'>{getOrderStatus(order?.status)?.value}</p>
457
474
  <LinkWrapper>
458
475
  <ReviewOrderLink
@@ -472,7 +489,7 @@ const OrderDetailsUI = (props) => {
472
489
  <span onClick={handleOpenReview}>{t('REVIEW_ORDER', theme?.defaultLanguages?.REVIEW_ORDER || 'Review your Order')}</span>
473
490
  </ReviewOrderLink>
474
491
  </LinkWrapper>
475
- </div>
492
+ </OrderStatusAndLinkContainer>
476
493
  </>
477
494
  )}
478
495
  </OrderInfo>
@@ -482,7 +499,7 @@ const OrderDetailsUI = (props) => {
482
499
  w='calc(100% - 20px)'
483
500
  // borderBottom={showOrderActions}
484
501
  >
485
- <img src={order?.business?.logo} />
502
+ {isShowBusinessLogo && <img src={order?.business?.logo} />}
486
503
  <BusinessInfo>
487
504
  <h2>{order?.business?.name}</h2>
488
505
  <ActionsSection
@@ -9,18 +9,15 @@ export const ActionBlock = styled.div`
9
9
  justify-content: space-between;
10
10
  margin-top: 30px;
11
11
  width: 100%;
12
-
13
12
  span {
14
13
  cursor: pointer;
15
14
  font-weight: 600;
16
15
  font-size: 16px;
17
16
  user-select: none;
18
17
  }
19
-
20
18
  button {
21
19
  font-size: 14px;
22
20
  padding: 6px 20px;
23
-
24
21
  svg {
25
22
  color: white;
26
23
  font-size: 21px;
@@ -43,7 +40,6 @@ export const HandReviewWrapper = styled.div`
43
40
  display: flex;
44
41
  align-items: center;
45
42
  justify-content: space-between;
46
-
47
43
  p {
48
44
  font-size: 15px;
49
45
  color: ${props => props.theme?.colors.headingColor};
@@ -62,19 +58,16 @@ export const HandReviewContent = styled.div`
62
58
 
63
59
  export const HandIconWrapper = styled.span`
64
60
  margin-left: 15px;
65
-
66
61
  ${props => props.theme?.rtl && css`
67
62
  margin-right: 15px;
68
63
  margin-left: 0;
69
64
  `}
70
-
71
65
  svg {
72
66
  font-size: 24px;
73
67
  color: #B1BCCC;
74
68
  cursor: pointer;
75
69
  transition: all 0.3s linear;
76
70
  }
77
-
78
71
  ${({ active }) => active && css`
79
72
  svg {
80
73
  color: ${props => props.theme?.colors.primary};
@@ -93,7 +86,6 @@ export const AddCommentHideShow = styled.p`
93
86
  transition: all 0.3s linear;
94
87
  color: #909BA9;
95
88
  font-size: 13px;
96
-
97
89
  &:hover {
98
90
  color: ${props => props.theme?.colors.primary};
99
91
  }
@@ -105,14 +97,12 @@ export const AddCommentHideShow = styled.p`
105
97
 
106
98
  export const Comments = styled.div`
107
99
  margin-top: 50px;
108
-
109
100
  p {
110
101
  margin-top: 0;
111
102
  margin-bottom: 8px;
112
103
  font-size: 14px;
113
104
  color: #344050;
114
105
  }
115
-
116
106
  textarea {
117
107
  width: 100%;
118
108
  box-sizing: border-box;
@@ -134,22 +124,18 @@ export const ButtonCustomized = styled(Button)`
134
124
  background: #E9ECEF;
135
125
  border: 1px solid #E9ECEF;
136
126
  transition: all 0.3s linear;
137
-
138
127
  ${props => props.theme?.rtl && css`
139
128
  margin-left: 18px;
140
129
  margin-right: 0;
141
130
  `}
142
-
143
131
  svg {
144
132
  vertical-align: middle;
145
133
  margin-left: 5px;
146
-
147
134
  ${props => props.theme?.rtl && css`
148
135
  margin-right: 5px;
149
136
  margin-left: 0;
150
137
  `}
151
138
  }
152
-
153
139
  ${({ active }) => active && css`
154
140
  background: ${props => props.theme?.colors.primary};
155
141
  border: 1px solid ${props => props.theme?.colors.primary};
@@ -52,6 +52,7 @@ import { ProductIngredient } from './src/components/ProductIngredient'
52
52
  import { GoogleLoginButton } from './src/components/GoogleLogin'
53
53
  import { AppleLogin } from './src/components/AppleLogin'
54
54
  import { SmsLoginButton } from './src/components/SmsLogin'
55
+ import { SearchProducts } from './src/components/BusinessProductsListing/SearchProducts'
55
56
 
56
57
  import { Input as Inputs } from './src/styles/Inputs'
57
58
  import { Select } from './src/styles/Select'
@@ -115,6 +116,7 @@ export {
115
116
  GoogleLoginButton,
116
117
  AppleLogin,
117
118
  SmsLoginButton,
119
+ SearchProducts,
118
120
  // styles
119
121
  Inputs,
120
122
  Select,