ordering-ui-react-native 0.17.66 → 0.17.68

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/package.json +1 -1
  2. package/src/components/shared/OToast.tsx +2 -2
  3. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +31 -27
  4. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +3 -3
  5. package/themes/business/src/components/OrdersOption/index.tsx +14 -58
  6. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
  7. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  8. package/themes/business/src/components/PreviousOrders/index.tsx +332 -242
  9. package/themes/business/src/components/PreviousOrders/styles.tsx +30 -2
  10. package/themes/business/src/components/ReviewCustomer/index.tsx +12 -2
  11. package/themes/business/src/components/shared/OLink.tsx +24 -12
  12. package/themes/business/src/components/shared/OText.tsx +3 -2
  13. package/themes/business/src/types/index.tsx +6 -1
  14. package/themes/original/index.tsx +2 -0
  15. package/themes/original/src/components/BusinessController/index.tsx +16 -2
  16. package/themes/original/src/components/BusinessController/styles.tsx +13 -1
  17. package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
  18. package/themes/original/src/components/BusinessProductsListing/index.tsx +1 -0
  19. package/themes/original/src/components/Cart/index.tsx +31 -2
  20. package/themes/original/src/components/FloatingButton/index.tsx +13 -11
  21. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -6
  22. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  23. package/themes/original/src/components/Messages/index.tsx +15 -0
  24. package/themes/original/src/components/MultiCart/index.tsx +63 -0
  25. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +6 -7
  26. package/themes/original/src/components/MultiCheckout/index.tsx +4 -2
  27. package/themes/original/src/components/MultiOrdersDetails/index.tsx +14 -0
  28. package/themes/original/src/components/OrdersOption/index.tsx +32 -2
  29. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  30. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  31. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  32. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  33. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  34. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  35. package/themes/original/src/components/SingleOrderCard/index.tsx +54 -19
  36. package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -1
  37. package/themes/original/src/types/index.tsx +2 -0
@@ -11,7 +11,8 @@ import {
11
11
  ActionContainer,
12
12
  SkipButton,
13
13
  RatingBarContainer,
14
- RatingTextContainer
14
+ RatingTextContainer,
15
+ MultiLogosContainer
15
16
  } from './styles'
16
17
  import { OButton, OIcon, OInput, OText } from '../shared'
17
18
  import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
@@ -215,14 +216,30 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
215
216
  titleWrapStyle={{ paddingHorizontal: 0 }}
216
217
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
217
218
  />
218
- <BusinessLogo>
219
- <View style={styles.logoWrapper}>
220
- <OIcon
221
- url={order?.logo}
222
- width={80}
223
- height={80}
224
- />
225
- </View>
219
+ <BusinessLogo isMulti={order?.business?.length > 1}>
220
+ {typeof order?.logo === 'string' || !order?.logo ? (
221
+ <View style={styles.logoWrapper}>
222
+ <OIcon
223
+ url={order?.logo}
224
+ width={80}
225
+ height={80}
226
+ />
227
+ </View>
228
+ ) : (
229
+ <MultiLogosContainer>
230
+ {order?.logo?.map((logo : string, i : number) => (
231
+ <React.Fragment key={logo}>
232
+ <View style={styles.logoWrapper}>
233
+ <OIcon
234
+ url={logo}
235
+ width={80}
236
+ height={80}
237
+ />
238
+ </View>
239
+ </React.Fragment>
240
+ ))}
241
+ </MultiLogosContainer>
242
+ )}
226
243
  </BusinessLogo>
227
244
  {order?.review ? (
228
245
  <View style={styles.reviewedStyle}>
@@ -42,3 +42,10 @@ export const RatingTextContainer = styled.View`
42
42
  justify-content: space-between;
43
43
  margin-top: 10px;
44
44
  `
45
+
46
+ export const MultiLogosContainer = styled.View`
47
+ display: flex;
48
+ justify-content: space-around;
49
+ flex-direction: row;
50
+ width: 100%;
51
+ `
@@ -8,7 +8,8 @@ import {
8
8
  FormReviews,
9
9
  ActionContainer,
10
10
  RatingStarContainer,
11
- PlacedDate
11
+ PlacedDate,
12
+ MultiLogosContainer
12
13
  } from './styles'
13
14
  import { OButton, OIcon, OText } from '../shared'
14
15
  import { StyleSheet, View, I18nManager } from 'react-native';
@@ -79,13 +80,30 @@ export const ReviewTrigger = (props: any) => {
79
80
  <>
80
81
  <ReviewOrderContainer>
81
82
  <BusinessLogo>
82
- <View style={styles.logoWrapper}>
83
- <OIcon
84
- url={order?.logo}
85
- width={80}
86
- height={80}
87
- />
88
- </View>
83
+ {typeof order?.logo === 'string' || !order?.logo ? (
84
+ <View style={styles.logoWrapper}>
85
+ <OIcon
86
+ url={order?.logo}
87
+ width={80}
88
+ height={80}
89
+ />
90
+ </View>
91
+ ) : (
92
+ <MultiLogosContainer>
93
+ {order?.logo?.map((logo : string, i : number) => (
94
+ <React.Fragment key={logo}>
95
+ <View style={styles.logoWrapper}>
96
+ <OIcon
97
+ url={logo}
98
+ width={80}
99
+ height={80}
100
+ />
101
+ </View>
102
+ </React.Fragment>
103
+ ))}
104
+ </MultiLogosContainer>
105
+
106
+ )}
89
107
  </BusinessLogo>
90
108
  {!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
91
109
  <View style={{ flex: 1, justifyContent: 'flex-end' }}>
@@ -115,4 +133,4 @@ export const ReviewTrigger = (props: any) => {
115
133
  </FloatingBottomContainer>
116
134
  </>
117
135
  )
118
- }
136
+ }
@@ -31,4 +31,11 @@ export const RatingStarContainer = styled.View`
31
31
  `
32
32
  export const PlacedDate = styled.View`
33
33
  margin-top: 30px;
34
- `
34
+ `
35
+
36
+ export const MultiLogosContainer = styled.View`
37
+ display: flex;
38
+ justify-content: space-around;
39
+ flex-direction: row;
40
+ width: 100%;
41
+ `
@@ -0,0 +1,68 @@
1
+ import React, { useState } from 'react'
2
+ import { Platform, View } from 'react-native'
3
+ import { useLanguage } from 'ordering-components/native';
4
+ import { useTheme } from 'styled-components/native';
5
+
6
+ import {
7
+ Accordion,
8
+ AccordionSection,
9
+ DropdownWrapper,
10
+ } from './styles'
11
+ import { OIcon, OText } from '../shared';
12
+
13
+ export const ScheduleAccordion = (props: any) => {
14
+
15
+ const {
16
+ scheduleFormatted,
17
+ schedule,
18
+ weekIndex
19
+ } = props
20
+
21
+ const [isActive, setActiveState] = useState(false)
22
+ const [, t] = useLanguage()
23
+ const theme = useTheme();
24
+
25
+ const daysOfWeek = [
26
+ t('DAY7', 'Sunday'),
27
+ t('DAY1', 'Monday'),
28
+ t('DAY2', 'Tuesday'),
29
+ t('DAY3', 'Wednesday'),
30
+ t('DAY4', 'Thursday'),
31
+ t('DAY5', 'Friday'),
32
+ t('DAY6', 'Saturday'),
33
+ ];
34
+
35
+ return (
36
+ <AccordionSection>
37
+ <Accordion
38
+ onPress={() => setActiveState(!isActive)}
39
+ activeOpacity={1}
40
+ >
41
+ <DropdownWrapper>
42
+ <OText
43
+ mBottom={16}
44
+ mRight={8}
45
+ lineHeight={21}
46
+ size={14}
47
+ weight={Platform.OS === 'android' ? 'bold' : '600'}
48
+ >{daysOfWeek[weekIndex]}</OText>
49
+ <OIcon src={theme.images.general.arrow_down} color={theme.colors.textNormal} width={8} />
50
+ </DropdownWrapper>
51
+ <View style={{ display: isActive ? 'flex' : 'none', paddingStart: 20 }}>
52
+ {schedule?.lapses?.map((lapse: any) => (
53
+ schedule?.enabled ?
54
+ <OText mBottom={16}>
55
+ {scheduleFormatted(lapse.open) +
56
+ ' - ' +
57
+ scheduleFormatted(lapse.close)}
58
+ </OText>
59
+ :
60
+ <OText color={theme.colors.red} mBottom={16}>
61
+ {t('CLOSED', 'Closed')}
62
+ </OText>
63
+ ))}
64
+ </View>
65
+ </Accordion>
66
+ </AccordionSection>
67
+ )
68
+ }
@@ -0,0 +1,14 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const AccordionSection = styled.View`
4
+ background: #FFF;
5
+ `
6
+
7
+ export const Accordion = styled.TouchableOpacity`
8
+ flex-direction: column;
9
+ justify-content: space-between;
10
+ `
11
+
12
+ export const DropdownWrapper = styled.View`
13
+ flex-direction: row;
14
+ `
@@ -19,7 +19,8 @@ import {
19
19
  ButtonWrapper,
20
20
  ContentFooter,
21
21
  UnreadMessageCounter,
22
- Price
22
+ Price,
23
+ MultiLogosContainer
23
24
  } from './styles';
24
25
  import { LottieAnimation } from '../LottieAnimation';
25
26
  import { CardAnimation } from '../shared/CardAnimation';
@@ -61,6 +62,11 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
61
62
  width: 64,
62
63
  height: 64
63
64
  },
65
+ minilogo: {
66
+ borderRadius: 8,
67
+ width: 40,
68
+ height: 40
69
+ },
64
70
  logoWrapper: {
65
71
  overflow: 'hidden',
66
72
  backgroundColor: 'white',
@@ -141,11 +147,12 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
141
147
  order: {
142
148
  id: order?.id,
143
149
  business_id: order?.business_id,
144
- logo: order?.business?.logo,
150
+ logo: order?.business?.length > 1 ? order?.business?.map?.((business : any) => business?.logo): order?.business?.logo,
145
151
  driver: order?.driver,
146
152
  products: order?.products,
147
153
  review: order?.review,
148
- user_review: order?.user_review
154
+ user_review: order?.user_review,
155
+ business: order?.business
149
156
  },
150
157
  });
151
158
  return
@@ -158,13 +165,16 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
158
165
  onNavigationRedirect('OrderDetails', { orderId: order?.uuid });
159
166
  };
160
167
 
161
- const handleClickViewOrder = (uuid: string) => {
168
+ const handleClickViewOrder = (order: any) => {
162
169
  if (isMessageView) {
163
170
  handleClickOrder(order?.uuid)
164
171
  return
165
172
  }
166
- onNavigationRedirect &&
167
- onNavigationRedirect('OrderDetails', { orderId: uuid });
173
+ if (order?.cart_group_id){
174
+ onNavigationRedirect?.('MultiOrdersDetails', { orderId: order?.cart_group_id });
175
+ } else {
176
+ onNavigationRedirect?.('OrderDetails', { orderId: order?.uuid });
177
+ }
168
178
  };
169
179
 
170
180
  const handleChangeFavorite = () => {
@@ -180,24 +190,49 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
180
190
  return (
181
191
  <>
182
192
  <CardAnimation
183
- onClick={() => handleClickViewOrder(order?.uuid)}
193
+ onClick={() => handleClickViewOrder(order)}
184
194
  style={[styles.container]}
185
195
  >
186
196
  <InnerContainer>
187
197
  {(!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
188
- <Logo style={styles.logoWrapper}>
189
- <OIcon
190
- url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
191
- src={optimizeImage(!order.business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
192
- style={styles.logo}
193
- />
194
- </Logo>
198
+ <>
199
+ {order?.business?.length > 1 ? (
200
+ <MultiLogosContainer>
201
+ {order?.business?.map((business: any, i: number) => (
202
+ <View key={business?.id}>
203
+ {i > 1 ? (
204
+ <>
205
+ {console.log(order?.business?.length - 2)}
206
+ <OText mRight={3}> + {order?.business?.length - 2}</OText>
207
+ </>
208
+ ) : (
209
+ <Logo style={styles.logoWrapper} isMulti>
210
+ <OIcon
211
+ url={optimizeImage(business?.logo, 'h_300,c_limit')}
212
+ src={optimizeImage(!business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
213
+ style={styles.minilogo}
214
+ />
215
+ </Logo>
216
+ )}
217
+ </View>
218
+ ))}
219
+ </MultiLogosContainer>
220
+ ) : (
221
+ <Logo style={styles.logoWrapper}>
222
+ <OIcon
223
+ url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
224
+ src={optimizeImage(!order.business?.logo && theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
225
+ style={styles.logo}
226
+ />
227
+ </Logo>
228
+ )}
229
+ </>
195
230
  )}
196
231
  <CardInfoWrapper>
197
232
  <ContentHeader>
198
233
  <View style={{ flex: 1 }}>
199
234
  <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
200
- {order.business?.name}
235
+ {order?.business?.length > 1 ? `${t('GROUP_ORDER', 'Group Order')} ${t('No', 'No')}. ${order?.cart_group_id}` : order.business?.name}
201
236
  </OText>
202
237
  </View>
203
238
  {!!!pastOrders && (
@@ -253,7 +288,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
253
288
  <ContentFooter>
254
289
  <View style={{ flex: 1 }}>
255
290
  <View style={styles.infoText}>
256
- {!!!pastOrders && (
291
+ {(!!!pastOrders || order?.business?.length > 1) && (
257
292
  <>
258
293
  <OText
259
294
  size={10}
@@ -263,7 +298,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
263
298
  lineHeight={15}
264
299
  numberOfLines={1}
265
300
  >
266
- {t('ORDER_NO', 'Order No') + '.'}
301
+ {order?.business?.length > 1 ? order?.business?.length : (t('ORDER_NO', 'Order No') + '.')}
267
302
  </OText>
268
303
  <OText
269
304
  size={10}
@@ -272,7 +307,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
272
307
  lineHeight={15}
273
308
  numberOfLines={1}
274
309
  >
275
- {order.id + ` \u2022 `}
310
+ {order?.business?.length > 1 ? t('ORDERS', 'orders') + ' \u2022 ' : order.id + ` \u2022 `}
276
311
  </OText>
277
312
  </>
278
313
  )}
@@ -297,7 +332,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
297
332
  {getOrderStatus(order.status)?.value}
298
333
  </OText>
299
334
  </View>
300
- {!isMessageView && (
335
+ {!isMessageView && !order?.business?.length && (
301
336
  <LottieAnimation
302
337
  type='favorite'
303
338
  onClick={handleChangeFavorite}
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const InnerContainer = styled.View`
4
4
  flex-direction: row;
@@ -8,6 +8,9 @@ export const InnerContainer = styled.View`
8
8
  export const Logo = styled.View`
9
9
  border-radius: 7.6px;
10
10
  margin-right: 12px;
11
+ ${({ isMulti } : any) => isMulti && css`
12
+ margin-right: 5px;
13
+ `}
11
14
  `
12
15
 
13
16
  export const CardInfoWrapper = styled.View`
@@ -45,3 +48,9 @@ export const Price = styled.View`
45
48
  margin-left: 10px;
46
49
  width: 30%;
47
50
  `
51
+
52
+ export const MultiLogosContainer = styled.View`
53
+ display: flex;
54
+ align-items: center;
55
+ flex-direction: row;
56
+ `
@@ -222,6 +222,7 @@ export interface BusinessControllerParams {
222
222
  handleUpdateBusinessList?: any;
223
223
  enableIntersection?: boolean;
224
224
  isCustomLayout?: boolean;
225
+ getBusinessOffer?: any;
225
226
  handleCustomUpdate?: (businessId: number, changes: any) => {};
226
227
  }
227
228
  export interface BusinessProductsListingParams {
@@ -529,6 +530,7 @@ export interface FloatingButtonParams {
529
530
  handleClick?: any;
530
531
  handleEmpty?: any;
531
532
  iosBottom?: number
533
+ hideButton?: boolean
532
534
  }
533
535
  export interface MomentOptionParams {
534
536
  navigation: any;