ordering-ui-react-native 0.15.46 → 0.15.48-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 (192) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +16 -8
  5. package/src/components/BusinessTypeFilter/index.tsx +3 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -2
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +120 -30
  11. package/src/components/LoginForm/styles.tsx +6 -0
  12. package/src/components/OrderDetails/index.tsx +9 -23
  13. package/src/components/PaymentOptions/index.tsx +1 -1
  14. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  15. package/src/components/SignupForm/index.tsx +145 -61
  16. package/src/components/SingleProductCard/index.tsx +16 -4
  17. package/src/components/StripeMethodForm/index.tsx +1 -2
  18. package/src/components/UpsellingProducts/index.tsx +1 -1
  19. package/src/components/UserProfileForm/index.tsx +63 -6
  20. package/src/components/UserProfileForm/styles.tsx +8 -0
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/components/shared/OModal.tsx +1 -1
  23. package/src/hooks/useCountdownTimer.tsx +26 -0
  24. package/src/navigators/CheckoutNavigator.tsx +6 -0
  25. package/src/navigators/HomeNavigator.tsx +12 -0
  26. package/src/pages/BusinessesListing.tsx +1 -1
  27. package/src/pages/MultiCheckout.tsx +31 -0
  28. package/src/pages/MultiOrdersDetails.tsx +27 -0
  29. package/src/pages/Sessions.tsx +22 -0
  30. package/src/theme.json +0 -1
  31. package/src/types/index.tsx +18 -11
  32. package/src/utils/index.tsx +68 -1
  33. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  34. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  35. package/themes/business/src/components/Chat/index.tsx +42 -90
  36. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  37. package/themes/business/src/components/Home/index.tsx +128 -55
  38. package/themes/business/src/components/Home/styles.tsx +8 -1
  39. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  40. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  41. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  42. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  43. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  44. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
  46. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  47. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  48. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  49. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  50. package/themes/business/src/components/PreviousOrders/index.tsx +7 -5
  51. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  52. package/themes/business/src/components/shared/OModal.tsx +1 -1
  53. package/themes/business/src/types/index.tsx +5 -1
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  58. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  59. package/themes/kiosk/src/components/Cart/index.tsx +99 -26
  60. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  61. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  62. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  63. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  64. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  65. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  66. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  67. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  68. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  69. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  72. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  73. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  74. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +8 -9
  76. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  77. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  78. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  79. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +3 -0
  82. package/themes/original/index.tsx +169 -4
  83. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  84. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  85. package/themes/original/src/components/AddressForm/index.tsx +1 -1
  86. package/themes/original/src/components/AddressList/index.tsx +30 -18
  87. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  88. package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
  89. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  90. package/themes/original/src/components/BusinessController/index.tsx +48 -11
  91. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  92. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  93. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  94. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  95. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  96. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  97. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  98. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  100. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  101. package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
  102. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
  103. package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
  104. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  105. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  106. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  107. package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
  108. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  109. package/themes/original/src/components/Cart/index.tsx +60 -41
  110. package/themes/original/src/components/Checkout/index.tsx +48 -32
  111. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  112. package/themes/original/src/components/Favorite/index.tsx +91 -0
  113. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  115. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  116. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  117. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  118. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  119. package/themes/original/src/components/Help/index.tsx +21 -4
  120. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  121. package/themes/original/src/components/Home/index.tsx +1 -1
  122. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  124. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  125. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  126. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  127. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  128. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  129. package/themes/original/src/components/Messages/index.tsx +1 -1
  130. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  131. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  134. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  139. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  140. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  141. package/themes/original/src/components/OrderDetails/index.tsx +64 -42
  142. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  143. package/themes/original/src/components/OrderProgress/index.tsx +1 -1
  144. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  145. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  146. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  147. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  148. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  149. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  151. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  152. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  153. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  154. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  155. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  156. package/themes/original/src/components/PaymentOptions/index.tsx +16 -14
  157. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  158. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  159. package/themes/original/src/components/ProductForm/index.tsx +74 -66
  160. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  161. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  162. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  163. package/themes/original/src/components/Promotions/index.tsx +250 -0
  164. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  165. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  166. package/themes/original/src/components/Sessions/index.tsx +160 -0
  167. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  168. package/themes/original/src/components/SignupForm/index.tsx +333 -128
  169. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  170. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  171. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  172. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  173. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  174. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  175. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  176. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  177. package/themes/original/src/components/UserProfile/index.tsx +59 -5
  178. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  179. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  180. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  181. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  182. package/themes/original/src/components/Wallets/index.tsx +76 -9
  183. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  184. package/themes/original/src/components/shared/HeaderTitle.tsx +2 -1
  185. package/themes/original/src/components/shared/OModal.tsx +4 -2
  186. package/themes/original/src/config/constants.tsx +6 -6
  187. package/themes/original/src/types/index.tsx +144 -9
  188. package/themes/original/src/utils/index.tsx +19 -2
  189. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  190. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  191. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  192. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -5,147 +5,146 @@ import WebView from 'react-native-webview';
5
5
  import { ActivityIndicator } from 'react-native-paper';
6
6
 
7
7
  import {
8
- ToastType,
9
- useToast,
10
- useApi,
11
- useLanguage,
12
- useConfig
8
+ ToastType,
9
+ useToast,
10
+ useApi,
11
+ useLanguage,
12
+ useConfig
13
13
  } from 'ordering-components/native';
14
14
 
15
15
  import { OText } from '../shared';
16
16
 
17
17
  interface PaymentOptionsWebViewParams {
18
- onNavigationRedirect?: Function,
19
- uri?: any,
20
- user?: any,
21
- token?: any,
22
- cart?: any,
23
- currency?: any,
24
- webviewPaymethod?: any,
25
- setShowGateway?: any,
26
- setOpenOrderCreating?: any,
27
- locationId?: any
18
+ onNavigationRedirect?: Function,
19
+ uri?: any,
20
+ user?: any,
21
+ token?: any,
22
+ cart?: any,
23
+ currency?: any,
24
+ webviewPaymethod?: any,
25
+ setShowGateway?: any,
26
+ setOpenOrderCreating?: any,
27
+ locationId?: any
28
28
  }
29
29
  export const PaymentOptionsWebView = (props: PaymentOptionsWebViewParams) => {
30
- const {
31
- onNavigationRedirect,
32
- uri,
33
- user,
34
- token,
35
- cart,
36
- currency,
37
- webviewPaymethod,
38
- setShowGateway,
39
- setOpenOrderCreating,
40
- locationId
41
- } = props
30
+ const {
31
+ onNavigationRedirect,
32
+ uri,
33
+ user,
34
+ token,
35
+ cart,
36
+ currency,
37
+ webviewPaymethod,
38
+ setShowGateway,
39
+ setOpenOrderCreating,
40
+ locationId
41
+ } = props
42
42
 
43
- const webviewRef = useRef<any>(null)
44
- const [, { showToast }] = useToast();
45
- const [ordering] = useApi()
46
- const [{ configs }] = useConfig();
47
- const [, t] = useLanguage();
43
+ const webviewRef = useRef<any>(null)
44
+ const [, { showToast }] = useToast();
45
+ const [ordering] = useApi()
46
+ const [{ configs }] = useConfig();
47
+ const [, t] = useLanguage();
48
48
 
49
+
50
+ const [progClr, setProgClr] = useState('#424242');
51
+ const [prog, setProg] = useState(true);
49
52
 
50
- const [progClr, setProgClr] = useState('#424242');
51
- const [prog, setProg] = useState(true);
52
-
53
- const handleCloseWebview = () => {
53
+ const handleCloseWebview = () => {
54
54
  setProg(true);
55
55
  setShowGateway({ open: false, closedByUser: true })
56
56
  }
57
57
 
58
- const onMessage = (e: any) => {
59
- if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
60
- let payment = JSON.parse(e.nativeEvent.data);
58
+ const onMessage = (e: any) => {
59
+ if (e?.nativeEvent?.data && e?.nativeEvent?.data !== 'undefined') {
60
+ let payment = JSON.parse(e.nativeEvent.data);
61
61
 
62
- if (payment === 'api error') {
63
- setShowGateway({ closedByUser: true, open: false })
64
- setProg(true);
65
- }
62
+ if (payment === 'api error') {
63
+ setShowGateway({ closedByUser: true, open: false })
64
+ setProg(true);
65
+ }
66
66
 
67
- if (payment) {
68
- if (payment.error) {
69
- showToast(ToastType.Error, payment.result)
70
- setOpenOrderCreating && setOpenOrderCreating(false)
71
- } else if (payment?.result?.order?.uuid) {
72
- showToast(ToastType.Success, t('ORDER_PLACED_SUCCESSfULLY', 'The order was placed successfully'))
73
- onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: payment?.result?.order?.uuid, isFromCheckout: true })
67
+ if (payment) {
68
+ if (payment.error) {
69
+ showToast(ToastType.Error, payment.result)
70
+ setOpenOrderCreating && setOpenOrderCreating(false)
71
+ } else if (payment?.result?.order?.uuid) {
72
+ showToast(ToastType.Success, t('ORDER_PLACED_SUCCESSfULLY', 'The order was placed successfully'))
73
+ onNavigationRedirect && onNavigationRedirect('OrderDetails', { orderId: payment?.result?.order?.uuid, isFromCheckout: true})
74
+ }
75
+ setProg(true);
76
+ setShowGateway({ closedByUser: false, open: false })
77
+ }
74
78
  }
75
- setProg(true);
76
- setShowGateway({ closedByUser: false, open: false })
77
- }
78
- }
79
- }
79
+ }
80
80
 
81
- return (
81
+ return (
82
82
  <View style={{ zIndex: 9999, height: '100%', width: '100%', position: 'absolute', backgroundColor: 'white' }}>
83
- <Icon
84
- name="x"
85
- size={35}
86
- style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
87
- onPress={handleCloseWebview}
88
- />
89
- <OText
90
- style={{
91
- textAlign: 'center',
92
- fontSize: 16,
93
- fontWeight: 'bold',
94
- color: '#00457C',
95
- marginBottom: 5,
96
- marginTop: 10
97
- }}>
98
- {webviewPaymethod?.gateway === 'paypal' ? (t('PAYPAL_GATEWAY', 'PayPal GateWay')) : (t('SQUARE_PAYMENT', 'Square payment'))}
99
- </OText>
100
- <View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
101
- <ActivityIndicator size={24} color={progClr} />
102
- </View>
103
- <WebView
104
- source={{ uri: uri }}
105
- onMessage={onMessage}
106
- ref={webviewRef}
107
- javaScriptEnabled={true}
108
- javaScriptEnabledAndroid={true}
109
- cacheEnabled={false}
110
- cacheMode='LOAD_NO_CACHE'
111
- style={{ flex: 1 }}
112
- onShouldStartLoadWithRequest={() => true}
113
- onLoadStart={() => {
114
- setProg(true);
115
- setProgClr('#424242');
116
- }}
117
- onLoadProgress={() => {
118
- setProg(true);
119
- setProgClr('#00457C');
120
- }}
121
- onLoad={() => {
122
- setProg(true);
123
- setProgClr('#00457C');
124
- }}
125
- onLoadEnd={(e) => {
126
- const messageParams = locationId ? { locationId, clientId: webviewPaymethod?.credentials?.application_id } : {}
127
- const message = {
128
- action: 'init',
129
- data: {
130
- urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
131
- urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
132
- payData: {
133
- paymethod_id: webviewPaymethod?.id,
134
- amount: cart?.balance ?? cart?.total,
135
- delivery_zone_id: cart?.delivery_zone_id,
136
- user_id: user?.id,
137
- user_name: user?.name
138
- },
139
- currency: configs?.stripe_currency?.value || currency,
140
- userToken: token,
141
- clientId: webviewPaymethod?.credentials?.client_id,
142
- ...messageParams
143
- }
144
- }
145
- setProg(false);
146
- webviewRef?.current?.postMessage?.(JSON.stringify(message))
147
- }}
148
- />
83
+ <Icon
84
+ name="x"
85
+ size={35}
86
+ style={{ backgroundColor: 'white', paddingTop: 30, paddingLeft: 10 }}
87
+ onPress={handleCloseWebview}
88
+ />
89
+ <OText
90
+ style={{
91
+ textAlign: 'center',
92
+ fontSize: 16,
93
+ fontWeight: 'bold',
94
+ color: '#00457C',
95
+ marginBottom: 5,
96
+ marginTop: 10
97
+ }}>
98
+ {webviewPaymethod?.gateway === 'paypal' ? (t('PAYPAL_GATEWAY', 'PayPal GateWay')) : (t('SQUARE_PAYMENT', 'Square payment'))}
99
+ </OText>
100
+ <View style={{ padding: 20, opacity: prog ? 1 : 0, backgroundColor: 'white' }}>
101
+ <ActivityIndicator size={24} color={progClr} />
102
+ </View>
103
+ <WebView
104
+ source={{ uri: uri }}
105
+ onMessage={onMessage}
106
+ ref={webviewRef}
107
+ javaScriptEnabled={true}
108
+ javaScriptEnabledAndroid={true}
109
+ cacheEnabled={false}
110
+ cacheMode='LOAD_NO_CACHE'
111
+ style={{ flex: 1 }}
112
+ onShouldStartLoadWithRequest={() => true}
113
+ onLoadStart={() => {
114
+ setProg(true);
115
+ setProgClr('#424242');
116
+ }}
117
+ onLoadProgress={() => {
118
+ setProg(true);
119
+ setProgClr('#00457C');
120
+ }}
121
+ onLoad={() => {
122
+ setProg(true);
123
+ setProgClr('#00457C');
124
+ }}
125
+ onLoadEnd={(e) => {
126
+ const messageParams = locationId ? { locationId } : {}
127
+ const message = {
128
+ action: 'init',
129
+ data: {
130
+ urlPlace: `${ordering.root}/carts/${cart?.uuid}/place`,
131
+ urlConfirm: `${ordering.root}/carts/${cart?.uuid}/confirm`,
132
+ payData: {
133
+ paymethod_id: webviewPaymethod?.id,
134
+ amount: cart?.balance ?? cart?.total,
135
+ delivery_zone_id: cart?.delivery_zone_id,
136
+ user_id: user?.id,
137
+ user_name: user?.name
138
+ },
139
+ currency: configs?.stripe_currency?.value || currency,
140
+ userToken: token,
141
+ clientId: webviewPaymethod?.credentials?.client_id,
142
+ ...messageParams
143
+ }
144
+ }
145
+ setProg(false);
146
+ webviewRef?.current?.postMessage?.(JSON.stringify(message))
147
+ }}
148
+ />
149
149
  </View>
150
- )
151
- }
150
+ )}
@@ -3,6 +3,7 @@ import { View, Pressable, StyleSheet, Keyboard, Linking, Platform, TouchableOpac
3
3
  import { useForm, Controller } from 'react-hook-form';
4
4
  import Spinner from 'react-native-loading-spinner-overlay';
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import Recaptcha from 'react-native-recaptcha-that-works'
6
7
 
7
8
  import { PhoneInputNumber } from '../PhoneInputNumber'
8
9
  import { FacebookLogin } from '../FacebookLogin'
@@ -23,7 +24,7 @@ import {
23
24
  SocialButtons
24
25
  } from './styles'
25
26
 
26
- import { LoginWith as SignupWith, OTab, OTabs } from '../LoginForm/styles'
27
+ import { LoginWith as SignupWith, OTab, OTabs, RecaptchaButton } from '../LoginForm/styles'
27
28
 
28
29
  import { _removeStoreData } from '../../providers/StoreUtil';
29
30
  import NavBar from '../NavBar'
@@ -58,7 +59,9 @@ const SignupFormUI = (props: SignupParams) => {
58
59
  setCheckPhoneCodeState,
59
60
  handleSendVerifyCode,
60
61
  handleCheckPhoneCode,
61
- notificationState
62
+ notificationState,
63
+ enableReCaptcha,
64
+ handleReCaptcha
62
65
  } = props
63
66
 
64
67
  const theme = useTheme()
@@ -107,6 +110,9 @@ const SignupFormUI = (props: SignupParams) => {
107
110
  }
108
111
  });
109
112
 
113
+ const [recaptchaConfig, setRecaptchaConfig] = useState<any>({})
114
+ const [recaptchaVerified, setRecaptchaVerified] = useState(false)
115
+
110
116
  const nameRef = useRef<any>(null)
111
117
  const lastnameRef = useRef<any>(null)
112
118
  const middleNameRef = useRef<any>(null)
@@ -114,6 +120,9 @@ const SignupFormUI = (props: SignupParams) => {
114
120
  const emailRef = useRef<any>(null)
115
121
  const phoneRef = useRef<any>(null)
116
122
  const passwordRef = useRef<any>(null)
123
+ const recaptchaRef = useRef<any>({});
124
+
125
+ const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
117
126
 
118
127
  const anySocialButtonActivated = ((configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') && configs?.facebook_id?.value) ||
119
128
  (configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) ||
@@ -194,35 +203,6 @@ const SignupFormUI = (props: SignupParams) => {
194
203
  setPasswordSee(false);
195
204
  }
196
205
 
197
- const onSubmit = (values: any) => {
198
- Keyboard.dismiss()
199
- if (phoneInputData.error) {
200
- showToast(ToastType.Error, phoneInputData.error);
201
- return
202
- }
203
- if (
204
- !phoneInputData.phone.country_phone_code &&
205
- !phoneInputData.phone.cellphone &&
206
- validationFields?.fields?.checkout?.cellphone?.enabled &&
207
- validationFields?.fields?.checkout?.cellphone?.required
208
- ) {
209
- showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
210
- return
211
- }
212
- if (signupTab === 'email' || !useSignupByCellphone) {
213
- handleButtonSignupClick && handleButtonSignupClick({
214
- ...values,
215
- ...phoneInputData.phone
216
- })
217
- if (!formState.loading && formState.result.result && !formState.result.error) {
218
- handleSuccessSignup && handleSuccessSignup(formState.result.result)
219
- }
220
- return
221
- }
222
- setFormValues(values)
223
- handleVerifyCodeClick(values)
224
- }
225
-
226
206
  const handleVerifyCodeClick = (values: any) => {
227
207
  const formData = values || formValues
228
208
  handleSendVerifyCode && handleSendVerifyCode({
@@ -263,6 +243,68 @@ const SignupFormUI = (props: SignupParams) => {
263
243
  }
264
244
  }
265
245
 
246
+ const handleOpenRecaptcha = () => {
247
+ setRecaptchaVerified(false)
248
+
249
+ if (recaptchaVerified) {
250
+ handleReCaptcha && handleReCaptcha('')
251
+ return
252
+ }
253
+
254
+ if (!recaptchaConfig?.siteKey) {
255
+ showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
256
+ return
257
+ }
258
+ if (!recaptchaConfig?.baseUrl) {
259
+ showToast(ToastType.Error, t('NO_RECAPTCHA_BASE_URL', 'The config doesn\'t have recaptcha base url'));
260
+ return
261
+ }
262
+ recaptchaRef.current.open()
263
+ }
264
+
265
+ const onRecaptchaVerify = (token: any) => {
266
+ setRecaptchaVerified(true)
267
+ handleReCaptcha && handleReCaptcha(token)
268
+ }
269
+
270
+ const onSubmit = (values: any) => {
271
+ Keyboard.dismiss()
272
+ if (phoneInputData.error) {
273
+ showToast(ToastType.Error, phoneInputData.error);
274
+ return
275
+ }
276
+ if (
277
+ !phoneInputData.phone.country_phone_code &&
278
+ !phoneInputData.phone.cellphone &&
279
+ validationFields?.fields?.checkout?.cellphone?.enabled &&
280
+ validationFields?.fields?.checkout?.cellphone?.required
281
+ ) {
282
+ showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
283
+ return
284
+ }
285
+ if (signupTab === 'email' || !useSignupByCellphone) {
286
+ handleButtonSignupClick && handleButtonSignupClick({
287
+ ...values,
288
+ ...phoneInputData.phone
289
+ })
290
+ if (!formState.loading && formState.result.result && !formState.result.error) {
291
+ handleSuccessSignup && handleSuccessSignup(formState.result.result)
292
+ }
293
+ return
294
+ }
295
+ setFormValues(values)
296
+ handleVerifyCodeClick(values)
297
+ }
298
+
299
+ useEffect(() => {
300
+ if (configs && Object.keys(configs).length > 0 && enableReCaptcha) {
301
+ setRecaptchaConfig({
302
+ siteKey: configs?.security_recaptcha_site_key?.value || null,
303
+ baseUrl: configs?.security_recaptcha_base_url?.value || null
304
+ })
305
+ }
306
+ }, [configs, enableReCaptcha])
307
+
266
308
  useEffect(() => {
267
309
  if (!formState.loading && formState.result?.error) {
268
310
  formState.result?.result && showToast(
@@ -490,6 +532,47 @@ const SignupFormUI = (props: SignupParams) => {
490
532
  </View>
491
533
  )}
492
534
 
535
+ {enableReCaptcha && (
536
+ <>
537
+ <TouchableOpacity
538
+ onPress={handleOpenRecaptcha}
539
+ style={{ marginHorizontal: 4, marginBottom: 10 }}
540
+ >
541
+ <RecaptchaButton>
542
+ {recaptchaVerified ? (
543
+ <MaterialCommunityIcons
544
+ name="checkbox-marked"
545
+ size={23}
546
+ color={theme.colors.primary}
547
+ />
548
+ ) : (
549
+ <MaterialCommunityIcons
550
+ name="checkbox-blank-outline"
551
+ size={23}
552
+ color={theme.colors.disabled}
553
+ />
554
+ )}
555
+ <OText size={14} mLeft={8}>{t('VERIFY_ReCAPTCHA', 'Verify reCAPTCHA')}</OText>
556
+ </RecaptchaButton>
557
+ </TouchableOpacity>
558
+ <Recaptcha
559
+ ref={recaptchaRef}
560
+ siteKey={recaptchaConfig?.siteKey}
561
+ baseUrl={recaptchaConfig?.baseUrl}
562
+ onVerify={onRecaptchaVerify}
563
+ onExpire={() => setRecaptchaVerified(false)}
564
+ footerComponent={<OButton
565
+ onClick={() => recaptchaRef.current.close()}
566
+ style={{ borderRadius: 0 }}
567
+ text={t('CLOSE', 'Close')}
568
+ bgColor={theme.colors.primary}
569
+ borderColor={theme.colors.primary}
570
+ textStyle={{ color: 'white' }}
571
+ imgRightSrc={null}
572
+ />}
573
+ />
574
+ </>
575
+ )}
493
576
  {signupTab === 'cellphone' && useSignupByEmail && useSignupByCellphone ? (
494
577
  <OButton
495
578
  onClick={handleSubmit(onSubmit)}
@@ -529,40 +612,40 @@ const SignupFormUI = (props: SignupParams) => {
529
612
  }
530
613
 
531
614
  {configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
532
- <ButtonsSection>
533
- <OText size={18} mBottom={10} color={theme.colors.disabled}>
534
- {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
535
- </OText>
536
- <SocialButtons>
537
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
538
- configs?.facebook_id?.value && (
539
- <FacebookLogin
540
- notificationState={notificationState}
541
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
542
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
543
- handleSuccessFacebookLogin={handleSuccessFacebook}
544
- />
545
- )}
546
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
547
- <GoogleLogin
548
- notificationState={notificationState}
549
- webClientId={configs?.google_login_client_id?.value}
550
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
551
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
552
- handleSuccessGoogleLogin={handleSuccessFacebook}
553
- />
554
- )}
555
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
556
- <AppleLogin
615
+ <ButtonsSection>
616
+ <OText size={18} mBottom={10} color={theme.colors.disabled}>
617
+ {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
618
+ </OText>
619
+ <SocialButtons>
620
+ {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
621
+ configs?.facebook_id?.value && (
622
+ <FacebookLogin
557
623
  notificationState={notificationState}
558
624
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
559
625
  handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
560
- handleSuccessApple={handleSuccessApple}
626
+ handleSuccessFacebookLogin={handleSuccessFacebook}
561
627
  />
562
628
  )}
563
- </SocialButtons>
564
- </ButtonsSection>
565
- )}
629
+ {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
630
+ <GoogleLogin
631
+ notificationState={notificationState}
632
+ webClientId={configs?.google_login_client_id?.value}
633
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
634
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
635
+ handleSuccessGoogleLogin={handleSuccessFacebook}
636
+ />
637
+ )}
638
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
639
+ <AppleLogin
640
+ notificationState={notificationState}
641
+ handleErrors={(err: any) => showToast(ToastType.Error, err)}
642
+ handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
643
+ handleSuccessApple={handleSuccessApple}
644
+ />
645
+ )}
646
+ </SocialButtons>
647
+ </ButtonsSection>
648
+ )}
566
649
  </FormSide>
567
650
  <OModal
568
651
  open={isModalVisible}
@@ -579,13 +662,14 @@ const SignupFormUI = (props: SignupParams) => {
579
662
  />
580
663
  </OModal>
581
664
  <Spinner visible={formState.loading || isLoadingSocialButton} />
582
- </View >
665
+ </View>
583
666
  );
584
667
  };
585
668
 
586
669
  export const SignupForm = (props: any) => {
587
670
  const signupProps = {
588
671
  ...props,
672
+ isRecaptchaEnable: true,
589
673
  UIComponent: SignupFormUI,
590
674
  };
591
675
  return <SignUpController {...signupProps} />;
@@ -10,6 +10,7 @@ import {
10
10
  import { StyleSheet } from 'react-native'
11
11
  import { OText, OIcon } from '../shared'
12
12
  import { useTheme } from 'styled-components/native'
13
+ import FastImage from 'react-native-fast-image'
13
14
 
14
15
  export const SingleProductCard = (props: SingleProductCardParams) => {
15
16
  const {
@@ -77,10 +78,21 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
77
78
  activeOpacity={1}
78
79
  onPress={() => onProductClick?.(product)}
79
80
  >
80
- <OIcon
81
- url={optimizeImage(product?.images, 'h_200,c_limit')}
82
- style={styles.productStyle}
83
- />
81
+ {product?.images ? (
82
+ <FastImage
83
+ style={styles.productStyle}
84
+ source={{
85
+ uri: optimizeImage(product?.images, 'h_250,c_limit'),
86
+ priority: FastImage.priority.normal,
87
+ }}
88
+ resizeMode={FastImage.resizeMode.cover}
89
+ />
90
+ ) : (
91
+ <OIcon
92
+ src={theme?.images?.dummies?.product}
93
+ style={styles.productStyle}
94
+ />
95
+ )}
84
96
  <CardInfo>
85
97
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
86
98
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
@@ -102,7 +102,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
102
102
  shippingMethods: [
103
103
  {
104
104
  amount: cart?.balance?.toString() ?? cart?.total?.toString?.(),
105
- identifier: 'DPS',
105
+ identifier: 'standard',
106
106
  label: 'Courier',
107
107
  detail: 'Delivery',
108
108
  type: 'final',
@@ -125,7 +125,6 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
125
125
  last4: paymentMethod.Card.last4
126
126
  }
127
127
  })
128
- onCancel()
129
128
  }
130
129
  }
131
130
 
@@ -37,7 +37,7 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
37
37
  imageStyle: {
38
38
  width: 120,
39
39
  height: 90,
40
- resizeMode: 'cover',
40
+ resizeMode: 'contain',
41
41
  borderRadius: 10
42
42
  },
43
43
  closeUpsellingButton: {