ordering-ui-react-native 0.15.22 → 0.15.23-release

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 (151) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/LanguageSelector/index.tsx +1 -0
  8. package/src/components/OrderDetails/index.tsx +2 -2
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/StripeElementsForm/index.tsx +27 -48
  12. package/src/components/UserProfileForm/index.tsx +63 -6
  13. package/src/components/UserProfileForm/styles.tsx +8 -0
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/config.json +0 -2
  16. package/src/navigators/HomeNavigator.tsx +6 -0
  17. package/src/pages/BusinessProductsList.tsx +1 -0
  18. package/src/pages/BusinessesListing.tsx +1 -1
  19. package/src/pages/Checkout.tsx +1 -1
  20. package/src/pages/Sessions.tsx +22 -0
  21. package/src/types/index.tsx +2 -9
  22. package/src/utils/index.tsx +68 -1
  23. package/themes/business/index.tsx +2 -0
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
  26. package/themes/business/src/components/Chat/index.tsx +38 -86
  27. package/themes/business/src/components/Home/index.tsx +128 -55
  28. package/themes/business/src/components/Home/styles.tsx +8 -1
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  30. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  31. package/themes/business/src/components/OrderDetails/Delivery.tsx +22 -13
  32. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  34. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  35. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  36. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  37. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  38. package/themes/business/src/components/OrdersOption/index.tsx +53 -49
  39. package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
  40. package/themes/business/src/types/index.tsx +2 -1
  41. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  42. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  43. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  45. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  46. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  47. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  48. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  49. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  50. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  51. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  52. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  53. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  55. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  56. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  60. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  61. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  64. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  66. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  67. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  68. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  69. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +178 -1
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  82. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  83. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  84. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  91. package/themes/original/src/components/BusinessesListing/index.tsx +48 -57
  92. package/themes/original/src/components/Cart/index.tsx +18 -14
  93. package/themes/original/src/components/CartContent/index.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +42 -27
  95. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  96. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  97. package/themes/original/src/components/Help/index.tsx +21 -4
  98. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  99. package/themes/original/src/components/Home/index.tsx +1 -1
  100. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  101. package/themes/original/src/components/LoginForm/index.tsx +73 -2
  102. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  103. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  104. package/themes/original/src/components/Messages/index.tsx +34 -25
  105. package/themes/original/src/components/Messages/styles.tsx +1 -3
  106. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  107. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  108. package/themes/original/src/components/OrderDetails/index.tsx +34 -27
  109. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  110. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  111. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  112. package/themes/original/src/components/OrderSummary/index.tsx +2 -2
  113. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  114. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  115. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  116. package/themes/original/src/components/PaymentOptionWallet/index.tsx +10 -4
  117. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  118. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  119. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  120. package/themes/original/src/components/ProductForm/index.tsx +40 -33
  121. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  122. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  123. package/themes/original/src/components/Promotions/index.tsx +250 -0
  124. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  125. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  126. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  127. package/themes/original/src/components/Sessions/index.tsx +160 -0
  128. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  129. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  130. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  131. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  132. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  133. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  134. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  135. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  136. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  137. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  138. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  139. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  140. package/themes/original/src/components/Wallets/index.tsx +75 -8
  141. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  142. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  143. package/themes/original/src/components/shared/index.tsx +2 -0
  144. package/themes/original/src/config/constants.tsx +6 -6
  145. package/themes/original/src/types/index.tsx +46 -4
  146. package/themes/original/src/utils/index.tsx +12 -2
  147. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  148. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  149. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  150. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  151. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -1,168 +0,0 @@
1
- import React, { useState, useEffect } from 'react'
2
- import { useLanguage } from 'ordering-components/native'
3
- import { useGooglePay, ApplePayButton, useApplePay } from '@stripe/stripe-react-native'
4
- import { OButton } from '../shared';
5
- import { Platform, View } from 'react-native';
6
- import { StripeMethodFormParams } from '../../types';
7
- import Spinner from 'react-native-loading-spinner-overlay';
8
- import { android_app_id } from '../../config.json'
9
- export const StripeMethodForm = (props: StripeMethodFormParams) => {
10
- const {
11
- cart,
12
- handleSource,
13
- onCancel,
14
- setErrors,
15
- paymethod,
16
- devMode
17
- } = props
18
- const { initGooglePay, createGooglePayPaymentMethod, loading } = useGooglePay();
19
- const { presentApplePay, isApplePaySupported } = useApplePay();
20
- const [initialized, setInitialized] = useState(false);
21
- const [loadingGooglePayment, setLoadingGooglePayment] = useState(false)
22
- const [, t] = useLanguage()
23
-
24
- useEffect(() => {
25
- if (paymethod !== 'google_pay' || !initGooglePay) return
26
- if (Platform.OS === 'ios') {
27
- setErrors(t('GOOGLE_PAY_NOT_SUPPORTED', 'Google pay not supported'))
28
- return
29
- }
30
- const initialize = async () => {
31
- try {
32
- const { error } = await initGooglePay({
33
- testEnv: devMode,
34
- merchantName: android_app_id,
35
- countryCode: 'US',
36
- billingAddressConfig: {
37
- format: 'FULL',
38
- isPhoneNumberRequired: true,
39
- isRequired: false,
40
- },
41
- existingPaymentMethodRequired: false,
42
- isEmailRequired: true,
43
- });
44
-
45
- if (error) {
46
- setErrors(error.code + ' - ' + error.message);
47
- return;
48
- }
49
- setInitialized(true);
50
- } catch (err: any) {
51
- setErrors('Catch ' + err?.message)
52
- }
53
- }
54
- initialize();
55
- }, [initGooglePay]);
56
-
57
- useEffect(() => {
58
- if (paymethod !== 'apple_pay') return
59
- if (Platform.OS === 'android') {
60
- setErrors(t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported'))
61
- return
62
- }
63
- }, [])
64
-
65
- const createPaymentMethod = async () => {
66
- setLoadingGooglePayment(true)
67
- const { error, paymentMethod } = await createGooglePayPaymentMethod({
68
- amount: cart?.balance ?? cart?.total,
69
- currencyCode: 'USD',
70
- });
71
- if (error) {
72
- setErrors(error.code + ' - ' + error.message);
73
- setLoadingGooglePayment(false)
74
- return;
75
- } else if (paymentMethod) {
76
- handleSource({
77
- ...paymentMethod?.Card,
78
- id: paymentMethod.id,
79
- type: paymentMethod.type,
80
- source_id: paymentMethod?.id,
81
- card: {
82
- brand: paymentMethod.Card.brand,
83
- last4: paymentMethod.Card.last4
84
- }
85
- })
86
- onCancel()
87
- setLoadingGooglePayment(false)
88
- }
89
- };
90
-
91
- const pay = async () => {
92
- if (!isApplePaySupported) {
93
- setErrors(t('APPLE_PAY_NOT_SUPPORTED', 'Apple pay not supported'))
94
- return
95
- }
96
-
97
- const { error, paymentMethod } = await presentApplePay({
98
- cartItems: cart?.products?.map((product: any) => ({ label: product?.name, amount: product?.price?.toString?.() })),
99
- country: 'US',
100
- currency: 'USD',
101
- shippingMethods: [
102
- {
103
- amount: cart?.balance?.toString() ?? cart?.total?.toString?.(),
104
- identifier: 'DPS',
105
- label: 'Courier',
106
- detail: 'Delivery',
107
- type: 'final',
108
- },
109
- ],
110
-
111
- requiredShippingAddressFields: ['emailAddress', 'phoneNumber'],
112
- requiredBillingContactFields: ['phoneNumber', 'name'],
113
- });
114
- if (error) {
115
- setErrors(error.code + ' - ' + error.message);
116
- } else if (paymentMethod) {
117
- handleSource({
118
- ...paymentMethod?.Card,
119
- id: paymentMethod.id,
120
- type: paymentMethod.type,
121
- source_id: paymentMethod?.id,
122
- card: {
123
- brand: paymentMethod.Card.brand,
124
- last4: paymentMethod.Card.last4
125
- }
126
- })
127
- onCancel()
128
- }
129
- }
130
-
131
- return (
132
- <>
133
- {paymethod === 'google_pay' ? (
134
- <View>
135
- <OButton
136
- textStyle={{
137
- color: '#fff'
138
- }}
139
- imgRightSrc={null}
140
- onClick={createPaymentMethod}
141
- isDisabled={loading || !initialized}
142
- text={t('PAY_WITH_GOOGLE_PAY', 'Pay with Google Pay')}
143
- isLoading={loading || !initialized}
144
- style={{ marginTop: 20 }}
145
- />
146
- </View>
147
- ) : (
148
- <View>
149
- {isApplePaySupported && (
150
- <ApplePayButton
151
- onPress={pay}
152
- type="plain"
153
- buttonStyle="black"
154
- borderRadius={4}
155
- style={{
156
- width: '100%',
157
- height: 50,
158
- }}
159
- />
160
- )}
161
- </View>
162
- )}
163
- <Spinner
164
- visible={loadingGooglePayment}
165
- />
166
- </>
167
- )
168
- }