ordering-ui-react-native 0.16.11 → 0.16.12-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 (213) hide show
  1. package/package.json +8 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +22 -0
  9. package/src/components/BusinessProductsList/index.tsx +7 -7
  10. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  11. package/src/components/BusinessesListing/index.tsx +1 -1
  12. package/src/components/Checkout/index.tsx +2 -1
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +118 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/Messages/index.tsx +2 -2
  17. package/src/components/NotificationSetting/index.tsx +85 -0
  18. package/src/components/OrderDetails/index.tsx +7 -21
  19. package/src/components/OrdersOption/index.tsx +54 -56
  20. package/src/components/PaymentOptions/index.tsx +335 -365
  21. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  22. package/src/components/ReviewDriver/index.tsx +1 -1
  23. package/src/components/ReviewOrder/index.tsx +2 -1
  24. package/src/components/ReviewProducts/index.tsx +11 -0
  25. package/src/components/SignupForm/index.tsx +143 -61
  26. package/src/components/SingleProductReview/index.tsx +8 -5
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +16 -0
  94. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  95. package/themes/original/src/components/AddressList/index.tsx +1 -1
  96. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  97. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  98. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  99. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  100. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  101. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  102. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  103. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  104. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  105. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  106. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  107. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  108. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  109. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  110. package/themes/original/src/components/BusinessProductsList/index.tsx +61 -72
  111. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  112. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -181
  113. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  114. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  115. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  116. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  117. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  118. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  119. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  121. package/themes/original/src/components/BusinessesListing/index.tsx +100 -484
  122. package/themes/original/src/components/Cart/index.tsx +81 -36
  123. package/themes/original/src/components/Cart/styles.tsx +4 -0
  124. package/themes/original/src/components/CartContent/index.tsx +22 -16
  125. package/themes/original/src/components/Checkout/index.tsx +106 -66
  126. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  127. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  128. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  129. package/themes/original/src/components/Favorite/index.tsx +1 -0
  130. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  131. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  132. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  133. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  134. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  135. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  136. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  138. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  139. package/themes/original/src/components/Messages/index.tsx +17 -17
  140. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  141. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  142. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  143. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  144. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  145. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  146. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  148. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  149. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  150. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  151. package/themes/original/src/components/NavBar/index.tsx +11 -5
  152. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  153. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  155. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  156. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  157. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  158. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  159. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  160. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  161. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  162. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  163. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  164. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  165. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  166. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  167. package/themes/original/src/components/OrdersOption/index.tsx +126 -37
  168. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  169. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  170. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  171. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  172. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  173. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  174. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  175. package/themes/original/src/components/ProductItemAccordion/index.tsx +40 -27
  176. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  177. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  178. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  179. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  180. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  181. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  182. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  183. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  184. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  185. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  186. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  187. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  188. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  189. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  190. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  191. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  192. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  193. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  194. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  195. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  196. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  197. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  198. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  199. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  200. package/themes/original/src/components/UserProfile/index.tsx +8 -1
  201. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  202. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  203. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  204. package/themes/original/src/components/Wallets/index.tsx +174 -162
  205. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  206. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  207. package/themes/original/src/components/shared/OButton.tsx +10 -3
  208. package/themes/original/src/components/shared/OInput.tsx +3 -2
  209. package/themes/original/src/components/shared/OModal.tsx +3 -1
  210. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  211. package/themes/original/src/types/index.tsx +160 -47
  212. package/themes/original/src/utils/index.tsx +77 -0
  213. 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') {
62
+ if (payment === 'api error' || payment === 'Cancelled by user') {
63
63
  setShowGateway({ closedByUser: true, open: false })
64
64
  setProg(true);
65
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
+ )}
@@ -218,7 +218,7 @@ const ReviewDriverUI = (props: ReviewDriverParams) => {
218
218
  <RatingBarContainer>
219
219
  <LinearGradient
220
220
  start={{ x: 0.0, y: 0.0 }}
221
- end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0, y: 0 }}
221
+ end={{ x: qualificationList[dirverReviews?.qualification - 1]?.percent || 0.0001, y: 0 }}
222
222
  locations={[.9999, .9999]}
223
223
  colors={[theme.colors.primary, theme.colors.lightGray]}
224
224
  style={styles.statusBar}
@@ -238,7 +238,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
238
238
  <RatingBarContainer>
239
239
  <LinearGradient
240
240
  start={{ x: 0.0, y: 0.0 }}
241
- end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
241
+ end={{ x: qualificationList[stars.quality - 1]?.percent || 0.0001, y: 0.0 }}
242
242
  locations={[.9999, .9999]}
243
243
  colors={[theme.colors.primary, theme.colors.lightGray]}
244
244
  style={styles.statusBar}
@@ -332,6 +332,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
332
332
  export const ReviewOrder = (props: ReviewOrderParams) => {
333
333
  const reviewOrderProps = {
334
334
  ...props,
335
+ defaultStar: 0,
335
336
  UIComponent: ReviewOrderUI
336
337
  }
337
338
  return <ReviewOrderController {...reviewOrderProps} />
@@ -61,6 +61,17 @@ const ReviewProductsUI = (props: ReviewProductParams) => {
61
61
  }
62
62
  }, [formState])
63
63
 
64
+ useEffect(() => {
65
+ const _changes = order?.products.map(product => {
66
+ return {
67
+ product_id: product?.product_id,
68
+ comment: '',
69
+ qualification: 5
70
+ }
71
+ })
72
+ handleChangeFormState(_changes)
73
+ }, [])
74
+
64
75
  return (
65
76
  <>
66
77
  <ReviewProductsContainer>
@@ -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,7 @@ 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>({});
117
124
 
118
125
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
119
126
 
@@ -196,35 +203,6 @@ const SignupFormUI = (props: SignupParams) => {
196
203
  setPasswordSee(false);
197
204
  }
198
205
 
199
- const onSubmit = (values: any) => {
200
- Keyboard.dismiss()
201
- if (phoneInputData.error) {
202
- showToast(ToastType.Error, phoneInputData.error);
203
- return
204
- }
205
- if (
206
- !phoneInputData.phone.country_phone_code &&
207
- !phoneInputData.phone.cellphone &&
208
- validationFields?.fields?.checkout?.cellphone?.enabled &&
209
- validationFields?.fields?.checkout?.cellphone?.required
210
- ) {
211
- showToast(ToastType.Error, t('VALIDATION_ERROR_MOBILE_PHONE_REQUIRED', 'The field Mobile phone is required.'))
212
- return
213
- }
214
- if (signupTab === 'email' || !useSignupByCellphone) {
215
- handleButtonSignupClick && handleButtonSignupClick({
216
- ...values,
217
- ...phoneInputData.phone
218
- })
219
- if (!formState.loading && formState.result.result && !formState.result.error) {
220
- handleSuccessSignup && handleSuccessSignup(formState.result.result)
221
- }
222
- return
223
- }
224
- setFormValues(values)
225
- handleVerifyCodeClick(values)
226
- }
227
-
228
206
  const handleVerifyCodeClick = (values: any) => {
229
207
  const formData = values || formValues
230
208
  handleSendVerifyCode && handleSendVerifyCode({
@@ -265,6 +243,68 @@ const SignupFormUI = (props: SignupParams) => {
265
243
  }
266
244
  }
267
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
+
268
308
  useEffect(() => {
269
309
  if (!formState.loading && formState.result?.error) {
270
310
  formState.result?.result && showToast(
@@ -492,6 +532,47 @@ const SignupFormUI = (props: SignupParams) => {
492
532
  </View>
493
533
  )}
494
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
+ )}
495
576
  {signupTab === 'cellphone' && useSignupByEmail && useSignupByCellphone ? (
496
577
  <OButton
497
578
  onClick={handleSubmit(onSubmit)}
@@ -531,40 +612,40 @@ const SignupFormUI = (props: SignupParams) => {
531
612
  }
532
613
 
533
614
  {configs && Object.keys(configs).length > 0 && anySocialButtonActivated && (
534
- <ButtonsSection>
535
- <OText size={18} mBottom={10} color={theme.colors.disabled}>
536
- {t('SELECT_AN_OPTION_TO_LOGIN', 'Select an option to login')}
537
- </OText>
538
- <SocialButtons>
539
- {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
540
- configs?.facebook_id?.value && (
541
- <FacebookLogin
542
- notificationState={notificationState}
543
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
544
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
545
- handleSuccessFacebookLogin={handleSuccessFacebook}
546
- />
547
- )}
548
- {(configs?.google_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && googleLoginEnabled && (
549
- <GoogleLogin
550
- notificationState={notificationState}
551
- webClientId={configs?.google_login_client_id?.value}
552
- handleErrors={(err: any) => showToast(ToastType.Error, err)}
553
- handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
554
- handleSuccessGoogleLogin={handleSuccessFacebook}
555
- />
556
- )}
557
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
558
- <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
559
623
  notificationState={notificationState}
560
624
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
561
625
  handleLoading={(val: boolean) => setIsLoadingSocialButton(val)}
562
- handleSuccessApple={handleSuccessApple}
626
+ handleSuccessFacebookLogin={handleSuccessFacebook}
563
627
  />
564
628
  )}
565
- </SocialButtons>
566
- </ButtonsSection>
567
- )}
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
+ )}
568
649
  </FormSide>
569
650
  <OModal
570
651
  open={isModalVisible}
@@ -581,13 +662,14 @@ const SignupFormUI = (props: SignupParams) => {
581
662
  />
582
663
  </OModal>
583
664
  <Spinner visible={formState.loading || isLoadingSocialButton} />
584
- </View >
665
+ </View>
585
666
  );
586
667
  };
587
668
 
588
669
  export const SignupForm = (props: any) => {
589
670
  const signupProps = {
590
671
  ...props,
672
+ isRecaptchaEnable: true,
591
673
  UIComponent: SignupFormUI,
592
674
  };
593
675
  return <SignUpController {...signupProps} />;
@@ -1,10 +1,11 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { useLanguage } from 'ordering-components/native'
3
- import { OText, OButton, OInput } from '../shared'
2
+ import { useLanguage, useUtils } from 'ordering-components/native'
3
+ import { OText, OButton, OInput, OIcon } from '../shared'
4
4
  import { StyleSheet, TouchableOpacity, View } from 'react-native'
5
5
  import AntDesignIcons from 'react-native-vector-icons/AntDesign'
6
6
  import { useTheme } from 'styled-components/native'
7
7
  import { SingleProductReviewParams } from '../../types'
8
+ import FastImage from 'react-native-fast-image'
8
9
 
9
10
  import {
10
11
  ProductContainer,
@@ -12,6 +13,7 @@ import {
12
13
  LikeHandsActionContainer,
13
14
  LikeHandsButton,
14
15
  CommentsButtonGroup,
16
+ LogoWrapper
15
17
  } from './styles'
16
18
 
17
19
  export const SingleProductReview = (props: SingleProductReviewParams) => {
@@ -23,6 +25,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
23
25
 
24
26
  const [, t] = useLanguage()
25
27
  const theme = useTheme()
28
+ const [{ optimizeImage }] = useUtils()
26
29
 
27
30
  const styles = StyleSheet.create({
28
31
  inputTextArea: {
@@ -37,7 +40,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
37
40
  flexDirection: 'row',
38
41
  justifyContent: 'center',
39
42
  marginVertical: 10,
40
- },
43
+ }
41
44
  })
42
45
 
43
46
  const [comments, setComments] = useState<Array<any>>([])
@@ -69,7 +72,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
69
72
  }
70
73
 
71
74
  useEffect(() => {
72
- if (comments?.length === 0 && !extraComment && formState.changes?.length === 0 && qualification === 5) return
75
+ if (comments?.length === 0 && !extraComment) return
73
76
  let _comments = ''
74
77
  if (comments.length > 0) {
75
78
  comments.map(comment => (_comments += comment.content + '. '))
@@ -129,7 +132,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
129
132
  style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
130
133
  imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
131
134
  imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
132
- onClick={() => handleChangeComment(commentItem) }
135
+ onClick={() => handleChangeComment(commentItem)}
133
136
  />
134
137
  ))}
135
138
  </CommentsButtonGroup>