ordering-ui-react-native 0.15.97 → 0.15.98-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 (231) hide show
  1. package/package.json +8 -3
  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/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +21 -16
  14. package/src/components/LoginForm/index.tsx +120 -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 +145 -61
  26. package/src/components/SingleProductReview/index.tsx +1 -1
  27. package/src/components/StripeElementsForm/index.tsx +25 -16
  28. package/src/components/StripeMethodForm/index.tsx +22 -24
  29. package/src/components/UpsellingProducts/index.tsx +1 -1
  30. package/src/components/UserProfileForm/index.tsx +63 -6
  31. package/src/components/UserProfileForm/styles.tsx +8 -0
  32. package/src/components/VerifyPhone/styles.tsx +1 -2
  33. package/src/components/shared/OBottomPopup.tsx +6 -2
  34. package/src/components/shared/OModal.tsx +1 -1
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +6 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/theme.json +0 -1
  45. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  46. package/src/types/index.tsx +15 -9
  47. package/src/utils/index.tsx +1 -2
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +1 -1
  50. package/themes/business/src/components/Chat/index.tsx +14 -6
  51. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  52. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  53. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  54. package/themes/business/src/components/LoginForm/index.tsx +110 -74
  55. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  56. package/themes/business/src/components/MapView/index.tsx +1 -1
  57. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  58. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  59. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  60. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +25 -18
  61. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  62. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  63. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  64. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  65. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  66. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  67. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  68. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  69. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  70. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  71. package/themes/business/src/components/PreviousMessages/index.tsx +1 -0
  72. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  73. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  74. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  75. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  76. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  77. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  78. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  79. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  80. package/themes/business/src/components/shared/OModal.tsx +41 -38
  81. package/themes/business/src/types/index.tsx +14 -9
  82. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  83. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  84. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  85. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  86. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  87. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  88. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  89. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +70 -31
  90. package/themes/kiosk/src/components/Checkout/index.tsx +18 -3
  91. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  92. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  93. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  94. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  95. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  96. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  97. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  98. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  99. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  100. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  101. package/themes/kiosk/src/components/ProductForm/index.tsx +6 -7
  102. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  103. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  104. package/themes/kiosk/src/types/index.d.ts +3 -0
  105. package/themes/original/index.tsx +22 -0
  106. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  107. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  108. package/themes/original/src/components/AddressForm/index.tsx +137 -134
  109. package/themes/original/src/components/AddressList/index.tsx +2 -2
  110. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  111. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  112. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  113. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  114. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  115. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -8
  116. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  117. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  118. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  119. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  120. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  121. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  122. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  123. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  124. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  125. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  126. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  127. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  128. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  129. package/themes/original/src/components/BusinessProductsListing/index.tsx +296 -178
  130. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  131. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  132. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  133. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  134. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  135. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  136. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  137. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  138. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  139. package/themes/original/src/components/Cart/index.tsx +82 -37
  140. package/themes/original/src/components/Cart/styles.tsx +4 -0
  141. package/themes/original/src/components/CartContent/index.tsx +22 -16
  142. package/themes/original/src/components/Checkout/index.tsx +107 -67
  143. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  144. package/themes/original/src/components/DriverTips/index.tsx +11 -6
  145. package/themes/original/src/components/Favorite/index.tsx +92 -0
  146. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  147. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  148. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  149. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  150. package/themes/original/src/components/GoogleMap/index.tsx +21 -12
  151. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  152. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  153. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  154. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  155. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  156. package/themes/original/src/components/LoginForm/index.tsx +86 -43
  157. package/themes/original/src/components/Messages/index.tsx +17 -17
  158. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  159. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  160. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  161. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  162. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  163. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  164. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  165. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  166. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  167. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  168. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  169. package/themes/original/src/components/NavBar/index.tsx +11 -5
  170. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  171. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  172. package/themes/original/src/components/OrderDetails/index.tsx +138 -58
  173. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  174. package/themes/original/src/components/OrderItAgain/index.tsx +73 -0
  175. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  176. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  177. package/themes/original/src/components/OrderSummary/index.tsx +2 -35
  178. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  179. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  180. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +140 -0
  181. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  182. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  183. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  184. package/themes/original/src/components/OrdersOption/index.tsx +140 -46
  185. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  186. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -23
  187. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  188. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  189. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  190. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  191. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  192. package/themes/original/src/components/ProductForm/index.tsx +694 -647
  193. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  194. package/themes/original/src/components/ProductItemAccordion/index.tsx +38 -25
  195. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  196. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  197. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  198. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  199. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  200. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  201. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  202. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  203. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  204. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  205. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  206. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  207. package/themes/original/src/components/SignupForm/index.tsx +307 -159
  208. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  209. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  210. package/themes/original/src/components/SingleProductCard/index.tsx +204 -95
  211. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  212. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  213. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  214. package/themes/original/src/components/UpsellingProducts/index.tsx +7 -3
  215. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  216. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  217. package/themes/original/src/components/UserProfile/index.tsx +4 -0
  218. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  219. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  220. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  221. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  222. package/themes/original/src/components/Wallets/index.tsx +176 -162
  223. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  224. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  225. package/themes/original/src/components/shared/OButton.tsx +10 -3
  226. package/themes/original/src/components/shared/OInput.tsx +3 -2
  227. package/themes/original/src/components/shared/OModal.tsx +4 -2
  228. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  229. package/themes/original/src/types/index.tsx +200 -47
  230. package/themes/original/src/utils/index.tsx +77 -0
  231. 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,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} />;
@@ -69,7 +69,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
69
69
  }
70
70
 
71
71
  useEffect(() => {
72
- if (comments?.length === 0 && !extraComment && formState.changes?.length === 0 && qualification === 5) return
72
+ if (comments?.length === 0 && !extraComment) return
73
73
  let _comments = ''
74
74
  if (comments.length > 0) {
75
75
  comments.map(comment => (_comments += comment.content + '. '))