ordering-ui-react-native 0.12.35 → 0.12.39

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 (54) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressForm/index.tsx +5 -5
  3. package/src/components/FacebookLogin/index.tsx +2 -2
  4. package/src/components/LoginForm/index.tsx +1 -1
  5. package/src/components/PaymentOptions/index.tsx +5 -5
  6. package/src/components/SignupForm/index.tsx +2 -2
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -8
  8. package/themes/business/src/components/LoginForm/index.tsx +1 -1
  9. package/themes/business/src/components/OrderDetails/Business.tsx +2 -4
  10. package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -108
  11. package/themes/business/src/components/SearchBar/index.tsx +1 -1
  12. package/themes/business/src/components/SignupForm/index.tsx +2 -2
  13. package/themes/business/src/types/index.tsx +3 -3
  14. package/themes/doordash/src/components/AddressForm/index.tsx +5 -5
  15. package/themes/doordash/src/components/FacebookLogin/index.tsx +2 -2
  16. package/themes/doordash/src/components/LoginForm/index.tsx +1 -1
  17. package/themes/doordash/src/components/PaymentOptions/index.tsx +5 -5
  18. package/themes/doordash/src/components/SignupForm/index.tsx +2 -2
  19. package/themes/franchises/src/components/AddressForm/index.tsx +5 -5
  20. package/themes/franchises/src/components/FacebookLogin/index.tsx +2 -2
  21. package/themes/franchises/src/components/LoginForm/index.tsx +1 -1
  22. package/themes/franchises/src/components/PaymentOptions/index.tsx +3 -3
  23. package/themes/franchises/src/components/SignupForm/index.tsx +2 -2
  24. package/themes/instacart/src/components/AddressForm/index.tsx +5 -5
  25. package/themes/instacart/src/components/FacebookLogin/index.tsx +2 -2
  26. package/themes/instacart/src/components/LoginForm/index.tsx +1 -1
  27. package/themes/instacart/src/components/PaymentOptions/index.tsx +4 -4
  28. package/themes/instacart/src/components/SignupForm/index.tsx +2 -2
  29. package/themes/original/src/components/AddressForm/index.tsx +5 -5
  30. package/themes/original/src/components/FacebookLogin/index.tsx +2 -2
  31. package/themes/original/src/components/LoginForm/index.tsx +1 -1
  32. package/themes/original/src/components/PaymentOptions/index.tsx +5 -5
  33. package/themes/original/src/components/SignupForm/index.tsx +2 -2
  34. package/themes/single-business/src/components/AddressForm/index.tsx +5 -5
  35. package/themes/single-business/src/components/AppleLogin/index.tsx +2 -2
  36. package/themes/single-business/src/components/FacebookLogin/index.tsx +2 -2
  37. package/themes/single-business/src/components/GoogleLogin/index.tsx +2 -2
  38. package/themes/single-business/src/components/LanguageSelector/index.tsx +87 -70
  39. package/themes/single-business/src/components/LoginForm/index.tsx +1 -1
  40. package/themes/single-business/src/components/OrderDetails/index.tsx +14 -14
  41. package/themes/single-business/src/components/PaymentOptions/index.tsx +4 -4
  42. package/themes/single-business/src/components/ProductForm/index.tsx +682 -656
  43. package/themes/single-business/src/components/ProductForm/styles.tsx +1 -1
  44. package/themes/single-business/src/components/SignupForm/index.tsx +2 -2
  45. package/themes/single-business/src/components/UserProfile/index.tsx +2 -2
  46. package/themes/single-business/src/components/shared/OInput.tsx +1 -0
  47. package/themes/single-business/src/components/shared/OLink.tsx +80 -0
  48. package/themes/single-business/src/components/shared/index.tsx +2 -0
  49. package/themes/single-business/src/types/index.tsx +1 -0
  50. package/themes/uber-eats/src/components/AddressForm/index.tsx +5 -5
  51. package/themes/uber-eats/src/components/FacebookLogin/index.tsx +2 -2
  52. package/themes/uber-eats/src/components/LoginForm/index.tsx +1 -1
  53. package/themes/uber-eats/src/components/PaymentOptions/index.tsx +5 -5
  54. package/themes/uber-eats/src/components/SignupForm/index.tsx +2 -2
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { Platform, StyleSheet, View } from 'react-native'
5
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
5
6
 
6
7
  import RNPickerSelect from 'react-native-picker-select'
7
8
  import { Container } from './styles'
@@ -10,83 +11,99 @@ import { OIcon } from '../shared'
10
11
 
11
12
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
12
13
 
13
- const [orderState] = useOrder()
14
+ const [orderState] = useOrder()
14
15
 
15
- const theme = useTheme();
16
+ const theme = useTheme();
16
17
 
17
- const _pickerStyle = StyleSheet.create({
18
- inputAndroid: {
19
- color: theme.colors.white,
20
- borderWidth: 1,
21
- borderColor: theme.colors.clear,
22
- paddingHorizontal: 10,
23
- paddingEnd: 24,
24
- height: 40,
25
- backgroundColor: theme.colors.clear,
26
- },
27
- inputIOS: {
28
- color: theme.colors.white,
29
- paddingEnd: 24,
30
- height: 40,
31
- borderWidth: 1,
32
- borderColor: theme.colors.clear,
33
- backgroundColor: theme.colors.clear
34
- },
35
- icon: {
36
- width: 10,
37
- marginTop: 9,
38
- marginEnd: 10
39
- },
40
- placeholder: {
41
- color: theme.colors.secundaryContrast
42
- }
43
- })
18
+ const _pickerStyle = StyleSheet.create({
19
+ inputAndroid: {
20
+ color: theme.colors.white,
21
+ borderWidth: 1,
22
+ borderColor: theme.colors.clear,
23
+ paddingHorizontal: 10,
24
+ paddingEnd: 24,
25
+ height: 40,
26
+ backgroundColor: theme.colors.clear,
27
+ },
28
+ inputIOS: {
29
+ color: theme.colors.white,
30
+ paddingEnd: 24,
31
+ height: 40,
32
+ borderWidth: 1,
33
+ borderColor: theme.colors.clear,
34
+ backgroundColor: theme.colors.clear
35
+ },
36
+ icon: {
37
+ width: 10,
38
+ marginTop: 9,
39
+ marginEnd: 10
40
+ },
41
+ placeholder: {
42
+ color: theme.colors.secundaryContrast
43
+ }
44
+ })
44
45
 
45
- const {
46
- languagesState,
47
- currentLanguage,
48
- handleChangeLanguage,
49
- iconColor,
50
- pickerStyle
51
- } = props
46
+ const {
47
+ languagesState,
48
+ currentLanguage,
49
+ handleChangeLanguage,
50
+ iconColor,
51
+ pickerStyle
52
+ } = props
52
53
 
53
- const _languages = languagesState?.languages?.map((language: any) => {
54
- return {
55
- value: language?.code,
56
- label: language?.name,
57
- inputLabel: language?.name
58
- }
59
- })
60
- _languages && _languages.sort((a: any, b: any) =>
61
- (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
62
- )
54
+ const _languages = languagesState?.languages?.map((language: any) => {
55
+ return {
56
+ value: language?.code,
57
+ label: language?.name,
58
+ inputLabel: language?.name
59
+ }
60
+ })
61
+ _languages && _languages.sort((a: any, b: any) =>
62
+ (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
63
+ )
63
64
 
64
- return (
65
- <Container>
66
- {languagesState?.languages && (
67
- <>
68
- {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
69
- <RNPickerSelect
70
- onValueChange={handleChangeLanguage}
71
- items={_languages || []}
72
- value={currentLanguage}
73
- style={pickerStyle ? pickerStyle : _pickerStyle}
74
- useNativeAndroidPickerStyle={false}
75
- placeholder={{}}
76
- Icon={() => <View style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} /></View>}
77
- disabled={orderState.loading}
78
- />
79
- </>
80
- )}
81
- </Container>
82
- )
65
+ return (
66
+ languagesState?.loading && props.allowLoading ? (
67
+ <Container>
68
+ <Placeholder style={{ width: 100, paddingTop: 10 }} Animation={Fade}>
69
+ <PlaceholderLine height={20} style={{ paddingBottom: 0, marginBottom: 0 }} />
70
+ </Placeholder>
71
+ </Container>
72
+ ) : (
73
+ <Container>
74
+ {languagesState?.languages ? (
75
+ <>
76
+ {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
77
+ <RNPickerSelect
78
+ onValueChange={handleChangeLanguage}
79
+ items={_languages || []}
80
+ value={currentLanguage}
81
+ style={pickerStyle ? pickerStyle : _pickerStyle}
82
+ useNativeAndroidPickerStyle={false}
83
+ placeholder={{}}
84
+ Icon={() => (
85
+ <View
86
+ style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}
87
+ >
88
+ <OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} />
89
+ </View>
90
+ )}
91
+ disabled={orderState.loading}
92
+ />
93
+ </>
94
+ ) : (
95
+ <View style={{ height: 40 }} />
96
+ )}
97
+ </Container>
98
+ )
99
+ )
83
100
  }
84
101
 
85
102
  export const LanguageSelector = (props: LanguageSelectorParams) => {
86
- const LanguageProps = {
87
- ...props,
88
- UIComponent: LanguageSelectorUI
89
- }
103
+ const LanguageProps = {
104
+ ...props,
105
+ UIComponent: LanguageSelectorUI
106
+ }
90
107
 
91
- return <LanguageSelectorController {...LanguageProps} />
108
+ return <LanguageSelectorController {...LanguageProps} />
92
109
  }
@@ -381,7 +381,7 @@ const LoginFormUI = (props: LoginParams) => {
381
381
  handleData={(val: any) => setPhoneInputData(val)}
382
382
  textInputProps={{
383
383
  returnKeyType: 'next',
384
- onSubmitEditing: () => inputRef.current.focus(),
384
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
385
385
  }}
386
386
  />
387
387
  </View>
@@ -36,7 +36,7 @@ import {
36
36
  OrderDriver,
37
37
  Map,
38
38
  } from './styles';
39
- import { OButton, OIcon, OModal, OText } from '../shared';
39
+ import { OButton, OIcon, OModal, OText, OLink } from '../shared';
40
40
  import { ProductItemAccordion } from '../ProductItemAccordion';
41
41
  import { TouchableOpacity } from 'react-native-gesture-handler';
42
42
  import { OrderDetailsParams } from '../../types';
@@ -487,19 +487,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
487
487
  {order?.business?.name}
488
488
  </OText>
489
489
  <Icons>
490
- <TouchableOpacity
491
- onPress={() =>
492
- props.navigation.navigate('Business', {
493
- store: businessData?.slug,
494
- })
495
- }
496
- style={{ paddingEnd: 5 }}>
497
- <OIcon
498
- src={theme.images.general.phone}
499
- width={16}
500
- color={theme.colors.disabled}
501
- />
502
- </TouchableOpacity>
490
+ {(!!order?.business?.cellphone || !!order?.business?.phone) && (
491
+ <View style={{ paddingEnd: 5 }}>
492
+ <OLink
493
+ url={`tel:${order?.business?.cellphone ?? order?.business?.phone}`}
494
+ >
495
+ <OIcon
496
+ src={theme.images.general.phone}
497
+ width={16}
498
+ color={theme.colors.disabled}
499
+ />
500
+ </OLink>
501
+ </View>
502
+ )}
503
503
  <TouchableOpacity
504
504
  style={{ paddingStart: 5 }}
505
505
  onPress={() => handleOpenMessagesForBusiness()}>
@@ -240,7 +240,7 @@ const PaymentOptionsUI = (props: any) => {
240
240
  )}
241
241
 
242
242
  {/* Stripe */}
243
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
243
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
244
244
  <View>
245
245
  <OButton
246
246
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -290,7 +290,7 @@ const PaymentOptionsUI = (props: any) => {
290
290
  <OModal
291
291
  entireModal
292
292
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
293
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
293
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
294
294
  onClose={() => handlePaymethodClick(null)}
295
295
  >
296
296
  <KeyboardAvoidingView
@@ -308,7 +308,7 @@ const PaymentOptionsUI = (props: any) => {
308
308
  </OModal>
309
309
 
310
310
  {/* Stripe Connect */}
311
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
311
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
312
312
  <View>
313
313
  <OButton
314
314
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -374,7 +374,7 @@ const PaymentOptionsUI = (props: any) => {
374
374
  {/* Paypal */}
375
375
  {/* <Modal
376
376
  className='modal-info'
377
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
377
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
378
378
  onClose={() => handlePaymethodClick(null)}
379
379
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
380
380
  >