ordering-ui-react-native 0.12.53 → 0.12.57

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 (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/Cart/index.tsx +50 -16
  3. package/src/components/OrderDetails/index.tsx +8 -0
  4. package/src/components/OrderSummary/index.tsx +38 -3
  5. package/src/layouts/Container.tsx +1 -1
  6. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +11 -9
  7. package/themes/business/src/components/OrderDetails/styles.tsx +1 -0
  8. package/themes/business/src/layouts/Container.tsx +3 -1
  9. package/themes/doordash/src/components/Cart/index.tsx +36 -2
  10. package/themes/doordash/src/components/OrderDetails/index.tsx +8 -0
  11. package/themes/doordash/src/components/OrderSummary/index.tsx +36 -3
  12. package/themes/doordash/src/layouts/Container.tsx +1 -1
  13. package/themes/franchises/src/components/Cart/index.tsx +257 -223
  14. package/themes/franchises/src/components/OrderDetails/index.tsx +723 -715
  15. package/themes/franchises/src/components/OrderSummary/index.tsx +188 -154
  16. package/themes/franchises/src/layouts/Container.tsx +1 -1
  17. package/themes/instacart/src/components/Cart/index.tsx +37 -3
  18. package/themes/instacart/src/components/OrderDetails/index.tsx +8 -0
  19. package/themes/instacart/src/components/OrderSummary/index.tsx +37 -4
  20. package/themes/instacart/src/layouts/Container.tsx +1 -1
  21. package/themes/kiosk/src/layouts/Container.tsx +2 -1
  22. package/themes/original/src/components/Cart/index.tsx +268 -234
  23. package/themes/original/src/components/OrderDetails/index.tsx +723 -715
  24. package/themes/original/src/components/OrderSummary/index.tsx +37 -3
  25. package/themes/original/src/layouts/Container.tsx +1 -1
  26. package/themes/single-business/src/components/Cart/index.tsx +1 -1
  27. package/themes/single-business/src/components/PhoneInputNumber/index.tsx +103 -112
  28. package/themes/single-business/src/components/UserDetails/index.tsx +107 -111
  29. package/themes/single-business/src/components/UserDetails/styles.tsx +3 -8
  30. package/themes/single-business/src/components/UserFormDetails/index.tsx +279 -326
  31. package/themes/single-business/src/components/UserFormDetails/styles.tsx +7 -5
  32. package/themes/single-business/src/layouts/Container.tsx +1 -1
  33. package/themes/uber-eats/src/components/Cart/index.tsx +37 -3
  34. package/themes/uber-eats/src/components/OrderDetails/index.tsx +8 -0
  35. package/themes/uber-eats/src/components/OrderSummary/index.tsx +40 -6
  36. package/themes/uber-eats/src/layouts/Container.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.53",
3
+ "version": "0.12.57",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -16,14 +16,14 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OModal, OText, OInput } from '../shared';
20
20
  import { ProductForm } from '../ProductForm';
21
21
  import { UpsellingProducts } from '../UpsellingProducts';
22
22
  import { verifyDecimals } from '../../utils';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import AntIcon from 'react-native-vector-icons/AntDesign'
25
25
  import { TaxInformation } from '../TaxInformation';
26
- import { TouchableOpacity } from 'react-native';
26
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
27
27
 
28
28
  const CartUI = (props: any) => {
29
29
  const {
@@ -35,6 +35,8 @@ const CartUI = (props: any) => {
35
35
  removeProduct,
36
36
  handleCartOpen,
37
37
  setIsCartsLoading,
38
+ handleChangeComment,
39
+ commentState
38
40
  } = props
39
41
 
40
42
  const theme = useTheme()
@@ -180,19 +182,19 @@ const CartUI = (props: any) => {
180
182
  ))
181
183
  }
182
184
  {
183
- cart?.fees?.length > 0 && cart?.fees?.filter((fee : any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
184
- <OSTable key={fee?.id}>
185
- <OSRow>
186
- <OText numberOfLines={1}>
187
- {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
188
- ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
189
- </OText>
190
- <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
191
- <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
192
- </TouchableOpacity>
193
- </OSRow>
194
- <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
195
- </OSTable>
185
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any) => (
186
+ <OSTable key={fee?.id}>
187
+ <OSRow>
188
+ <OText numberOfLines={1}>
189
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
190
+ ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
191
+ </OText>
192
+ <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee })} >
193
+ <AntIcon name='exclamationcircleo' size={18} color={theme.colors.primary} />
194
+ </TouchableOpacity>
195
+ </OSRow>
196
+ <OText>{parsePrice(fee?.summary?.fixed + fee?.summary?.percentage || 0)}</OText>
197
+ </OSTable>
196
198
  ))
197
199
  }
198
200
  {orderState?.options?.type === 1 && cart?.delivery_price > 0 && (
@@ -235,6 +237,38 @@ const CartUI = (props: any) => {
235
237
  </OText>
236
238
  </OSTable>
237
239
  </OSTotal>
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
238
272
  </OSBill>
239
273
  )}
240
274
  {cart?.valid_products && (
@@ -294,7 +328,7 @@ const CartUI = (props: any) => {
294
328
  onClose={() => setOpenTaxModal({ open: false, data: null })}
295
329
  entireModal
296
330
  >
297
- <TaxInformation data={openTaxModal.data} products={cart.products} />
331
+ <TaxInformation data={openTaxModal.data} products={cart?.products} />
298
332
  </OModal>
299
333
  </CContainer>
300
334
  )
@@ -527,6 +527,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
527
527
  </OText>
528
528
  </Table>
529
529
  </Total>
530
+ {order?.comment && (
531
+ <Table>
532
+ <OText style={{flex: 1}}>{t('COMMENT', 'Comment')}</OText>
533
+ <OText style={{maxWidth: '70%'}}>
534
+ {order?.comment}
535
+ </OText>
536
+ </Table>
537
+ )}
530
538
  {
531
539
  (
532
540
  parseInt(order?.status) === 1 ||
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,12 +19,13 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { ProductForm } from '../ProductForm';
24
24
  import { verifyDecimals } from '../../utils';
25
25
  import { useTheme } from 'styled-components/native';
26
26
  import { TaxInformation } from '../TaxInformation';
27
27
  import AntIcon from 'react-native-vector-icons/AntDesign'
28
+
28
29
  const OrderSummaryUI = (props: any) => {
29
30
  const {
30
31
  cart,
@@ -33,7 +34,9 @@ const OrderSummaryUI = (props: any) => {
33
34
  offsetDisabled,
34
35
  removeProduct,
35
36
  isCartPending,
36
- isFromCheckout
37
+ isFromCheckout,
38
+ commentState,
39
+ handleChangeComment
37
40
  } = props;
38
41
 
39
42
  const theme = useTheme();
@@ -186,6 +189,38 @@ const OrderSummaryUI = (props: any) => {
186
189
  </OSTable>
187
190
  </View>
188
191
  )}
192
+ {cart?.status !== 2 && (
193
+ <OSTable>
194
+ <View style={{ width: '100%', marginTop: 20 }}>
195
+ <OText>{t('COMMENTS', 'Comments')}</OText>
196
+ <View style={{ flex: 1, width: '100%' }}>
197
+ <OInput
198
+ value={cart?.comment}
199
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
200
+ onChange={(value: string) => handleChangeComment(value)}
201
+ style={{
202
+ alignItems: 'flex-start',
203
+ width: '100%',
204
+ height: 100,
205
+ borderColor: theme.colors.textSecondary,
206
+ paddingRight: 50,
207
+ marginTop: 10
208
+ }}
209
+ multiline
210
+ />
211
+ {commentState?.loading && (
212
+ <View style={{ position: 'absolute', right: 20 }}>
213
+ <ActivityIndicator
214
+ size='large'
215
+ style={{ height: 100 }}
216
+ color={theme.colors.primary}
217
+ />
218
+ </View>
219
+ )}
220
+ </View>
221
+ </View>
222
+ </OSTable>
223
+ )}
189
224
  </OSBill>
190
225
  )}
191
226
  <OModal
@@ -19,7 +19,7 @@ const SafeAreaStyled = styled.SafeAreaView`
19
19
  export const Container = (props: any) => {
20
20
  return (
21
21
  <SafeAreaStyled>
22
- <ContainerStyled nopadding={props.nopadding} keyboardShouldPersistTaps='handled'>
22
+ <ContainerStyled ref={props?.forwardRef} nopadding={props.nopadding} keyboardShouldPersistTaps='handled'>
23
23
  {props.children}
24
24
  </ContainerStyled>
25
25
  </SafeAreaStyled>
@@ -40,7 +40,6 @@ export const OrderContentComponent = (props: OrderContent) => {
40
40
  const [{ parsePrice, parseNumber }] = useUtils();
41
41
  const [{ configs }] = useConfig();
42
42
  const [openReviewModal, setOpenReviewModal] = useState(false)
43
- const [isCustomerReviewed, setIsCustomerReviewed] = useState(false)
44
43
 
45
44
  const pastOrderStatuses = [1, 2, 5, 6, 10, 11, 12, 16, 17]
46
45
 
@@ -65,11 +64,6 @@ export const OrderContentComponent = (props: OrderContent) => {
65
64
  }
66
65
  })
67
66
 
68
- const handleSuccessReviewed = () => {
69
- setOpenReviewModal(false)
70
- setIsCustomerReviewed(true)
71
- }
72
-
73
67
  return (
74
68
  <OrderContent isOrderGroup={isOrderGroup} lastOrder={lastOrder}>
75
69
  {isOrderGroup && (
@@ -265,7 +259,7 @@ export const OrderContentComponent = (props: OrderContent) => {
265
259
  {order?.customer?.zipcode}
266
260
  </OText>
267
261
  )}
268
- {/* {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
262
+ {!order?.user_review && pastOrderStatuses.includes(order?.status) && (
269
263
  <OButton
270
264
  style={styles.btnReview}
271
265
  textStyle={{ color: theme.colors.white }}
@@ -273,7 +267,7 @@ export const OrderContentComponent = (props: OrderContent) => {
273
267
  imgRightSrc={false}
274
268
  onClick={() => setOpenReviewModal(true)}
275
269
  />
276
- )} */}
270
+ )}
277
271
  </OrderCustomer>
278
272
 
279
273
  <OrderProducts>
@@ -434,6 +428,14 @@ export const OrderContentComponent = (props: OrderContent) => {
434
428
  {parsePrice(order?.summary?.total ?? 0)}
435
429
  </OText>
436
430
  </Table>
431
+ {order?.comment && (
432
+ <Table>
433
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
434
+ <OText style={{ maxWidth: '70%' }}>
435
+ {order?.comment}
436
+ </OText>
437
+ </Table>
438
+ )}
437
439
  </Total>
438
440
  </OrderBill >
439
441
  <OModal
@@ -445,7 +447,7 @@ export const OrderContentComponent = (props: OrderContent) => {
445
447
  <ReviewCustomer
446
448
  order={order}
447
449
  closeModal={() => setOpenReviewModal(false)}
448
- onClose={() => handleSuccessReviewed()}
450
+ onClose={() => setOpenReviewModal(false)}
449
451
  />
450
452
  </OModal>
451
453
  </OrderContent>
@@ -68,6 +68,7 @@ export const Table = styled.View`
68
68
 
69
69
  export const OrderBill = styled.View`
70
70
  padding-vertical: 20px;
71
+ padding-bottom: 30px;
71
72
  flex: 1;
72
73
  `;
73
74
 
@@ -46,7 +46,9 @@ export const Container = (props: any) => {
46
46
  <ContainerStyled
47
47
  contentContainerStyle={props.style}
48
48
  keyboardShouldPersistTaps="handled"
49
- orientation={orientation}>
49
+ orientation={orientation}
50
+ ref={props?.forwardRef}
51
+ >
50
52
  {props.children}
51
53
  </ContainerStyled>
52
54
  </SafeAreaStyled>
@@ -16,12 +16,12 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
16
16
  import { BusinessItemAccordion } from '../BusinessItemAccordion';
17
17
  import { CouponControl } from '../CouponControl';
18
18
 
19
- import { OButton, OModal, OText } from '../shared';
19
+ import { OButton, OInput, OModal, OText } from '../shared';
20
20
  import { useTheme } from 'styled-components/native';
21
21
  import { ProductForm } from '../ProductForm';
22
22
  import { UpsellingProducts } from '../UpsellingProducts';
23
23
  import { verifyDecimals } from '../../utils';
24
- import { Platform } from 'react-native';
24
+ import { ActivityIndicator, Platform, View } from 'react-native';
25
25
  import { TaxInformation } from '../TaxInformation';
26
26
  import { TouchableOpacity } from 'react-native';
27
27
  import AntIcon from 'react-native-vector-icons/AntDesign'
@@ -36,6 +36,8 @@ const CartUI = (props: any) => {
36
36
  removeProduct,
37
37
  handleCartOpen,
38
38
  setIsCartsLoading,
39
+ handleChangeComment,
40
+ commentState
39
41
  // isFromCart
40
42
  } = props
41
43
  const theme = useTheme();
@@ -222,6 +224,38 @@ const CartUI = (props: any) => {
222
224
  </OText>
223
225
  </OSTable>
224
226
  </OSTotal>
227
+ {cart?.status !== 2 && (
228
+ <OSTable>
229
+ <View style={{ width: '100%', marginTop: 20 }}>
230
+ <OText>{t('COMMENTS', 'Comments')}</OText>
231
+ <View style={{ flex: 1, width: '100%' }}>
232
+ <OInput
233
+ value={cart?.comment}
234
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
235
+ onChange={(value: string) => handleChangeComment(value)}
236
+ style={{
237
+ alignItems: 'flex-start',
238
+ width: '100%',
239
+ height: 100,
240
+ borderColor: theme.colors.textSecondary,
241
+ paddingRight: 50,
242
+ marginTop: 10
243
+ }}
244
+ multiline
245
+ />
246
+ {commentState?.loading && (
247
+ <View style={{ position: 'absolute', right: 20 }}>
248
+ <ActivityIndicator
249
+ size='large'
250
+ color={theme.colors.primary}
251
+ style={{ height: 100 }}
252
+ />
253
+ </View>
254
+ )}
255
+ </View>
256
+ </View>
257
+ </OSTable>
258
+ )}
225
259
  </OSBill>
226
260
  )}
227
261
  {cart?.valid_products && (
@@ -445,6 +445,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
445
445
  <OText size={12} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{parsePrice(order?.summary?.total || order?.total)}</OText>
446
446
  </Table>
447
447
  </Total>
448
+ {order?.comment && (
449
+ <Table>
450
+ <OText style={{ flex: 1 }}>{t('COMMENT', 'Comment')}</OText>
451
+ <OText style={{ maxWidth: '70%' }}>
452
+ {order?.comment}
453
+ </OText>
454
+ </Table>
455
+ )}
448
456
  </OrderBill>
449
457
  </OrderContent>
450
458
  </>
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { TextStyle, TouchableOpacity, View } from 'react-native'
2
+ import { ActivityIndicator, TextStyle, TouchableOpacity, View } from 'react-native'
3
3
  import {
4
4
  Cart,
5
5
  useOrder,
@@ -19,7 +19,7 @@ import {
19
19
 
20
20
  import { ProductItemAccordion } from '../ProductItemAccordion';
21
21
  import { CouponControl } from '../CouponControl';
22
- import { OModal, OText } from '../shared';
22
+ import { OInput, OModal, OText } from '../shared';
23
23
  import { useTheme } from 'styled-components/native';
24
24
  import { ProductForm } from '../ProductForm';
25
25
  import { verifyDecimals } from '../../utils';
@@ -40,6 +40,8 @@ const OrderSummaryUI = (props: any) => {
40
40
  title,
41
41
  paddingH,
42
42
  isMini,
43
+ commentState,
44
+ handleChangeComment
43
45
  } = props;
44
46
 
45
47
  const theme = useTheme();
@@ -235,7 +237,38 @@ const OrderSummaryUI = (props: any) => {
235
237
  )}
236
238
  </View>
237
239
  ) : null}
238
-
240
+ {cart?.status !== 2 && (
241
+ <OSTable>
242
+ <View style={{ width: '100%', marginTop: 20 }}>
243
+ <OText>{t('COMMENTS', 'Comments')}</OText>
244
+ <View style={{ flex: 1, width: '100%' }}>
245
+ <OInput
246
+ value={cart?.comment}
247
+ placeholder={t('SPECIAL_COMMENTS', 'Special Comments')}
248
+ onChange={(value: string) => handleChangeComment(value)}
249
+ style={{
250
+ alignItems: 'flex-start',
251
+ width: '100%',
252
+ height: 100,
253
+ borderColor: theme.colors.textSecondary,
254
+ paddingRight: 50,
255
+ marginTop: 10
256
+ }}
257
+ multiline
258
+ />
259
+ {commentState?.loading && (
260
+ <View style={{ position: 'absolute', right: 20 }}>
261
+ <ActivityIndicator
262
+ size='large'
263
+ style={{ height: 100 }}
264
+ color={theme.colors.primary}
265
+ />
266
+ </View>
267
+ )}
268
+ </View>
269
+ </View>
270
+ </OSTable>
271
+ )}
239
272
  </OSBill>
240
273
  )}
241
274
  <OModal
@@ -18,7 +18,7 @@ const SafeAreaStyled = styled.SafeAreaView`
18
18
  export const Container = (props: any) => {
19
19
  return (
20
20
  <SafeAreaStyled>
21
- <ContainerStyled style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
21
+ <ContainerStyled ref={props?.forwardRef} style={props?.style} {...props} keyboardShouldPersistTaps='handled'>
22
22
  {props.children}
23
23
  </ContainerStyled>
24
24
  </SafeAreaStyled>