ordering-ui-react-native 0.15.59 → 0.15.60-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 (207) 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/BusinessInformation/index.tsx +14 -0
  6. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +23 -2
  9. package/src/components/DriverTips/index.tsx +11 -6
  10. package/src/components/LanguageSelector/index.tsx +7 -2
  11. package/src/components/LoginForm/index.tsx +120 -30
  12. package/src/components/LoginForm/styles.tsx +6 -0
  13. package/src/components/OrderDetails/index.tsx +7 -21
  14. package/src/components/PaymentOptions/index.tsx +67 -50
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewDriver/index.tsx +1 -1
  17. package/src/components/ReviewOrder/index.tsx +2 -1
  18. package/src/components/ReviewProducts/index.tsx +11 -0
  19. package/src/components/SignupForm/index.tsx +145 -61
  20. package/src/components/SingleProductCard/index.tsx +16 -4
  21. package/src/components/SingleProductReview/index.tsx +1 -1
  22. package/src/components/StripeMethodForm/index.tsx +1 -2
  23. package/src/components/UpsellingProducts/index.tsx +1 -1
  24. package/src/components/UserProfileForm/index.tsx +63 -6
  25. package/src/components/UserProfileForm/styles.tsx +8 -0
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OModal.tsx +1 -1
  28. package/src/hooks/useCountdownTimer.tsx +26 -0
  29. package/src/navigators/CheckoutNavigator.tsx +6 -0
  30. package/src/navigators/HomeNavigator.tsx +12 -0
  31. package/src/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/MultiCheckout.tsx +31 -0
  33. package/src/pages/MultiOrdersDetails.tsx +27 -0
  34. package/src/pages/OrderDetails.tsx +1 -1
  35. package/src/pages/ReviewDriver.tsx +2 -2
  36. package/src/pages/ReviewOrder.tsx +2 -2
  37. package/src/pages/Sessions.tsx +22 -0
  38. package/src/theme.json +0 -1
  39. package/src/types/index.tsx +18 -11
  40. package/src/utils/index.tsx +68 -1
  41. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  42. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  43. package/themes/business/src/components/Chat/index.tsx +42 -90
  44. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  45. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  46. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  47. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  48. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  49. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  50. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  51. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  52. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  53. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  54. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  55. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  57. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  58. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  59. package/themes/business/src/components/shared/OModal.tsx +1 -1
  60. package/themes/business/src/types/index.tsx +6 -1
  61. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  63. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  65. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  66. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  67. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  68. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  69. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  70. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  71. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  72. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  73. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  74. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  75. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  76. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  77. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  78. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  79. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  80. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  81. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  82. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  83. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  84. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  85. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  86. package/themes/kiosk/src/types/index.d.ts +1 -0
  87. package/themes/original/index.tsx +30 -8
  88. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  89. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  90. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  91. package/themes/original/src/components/AddressList/index.tsx +30 -18
  92. package/themes/original/src/components/AppleLogin/index.tsx +9 -13
  93. package/themes/original/src/components/BusinessBasicInformation/index.tsx +137 -46
  94. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  95. package/themes/original/src/components/BusinessController/index.tsx +29 -11
  96. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  97. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  98. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  99. package/themes/original/src/components/BusinessListingSearch/index.tsx +205 -61
  100. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  101. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  102. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  103. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  104. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
  105. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  106. package/themes/original/src/components/BusinessProductsListing/index.tsx +301 -170
  107. package/themes/original/src/components/BusinessProductsListing/styles.tsx +27 -0
  108. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  109. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  110. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  111. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +557 -0
  112. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -0
  113. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +519 -0
  114. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Original/styles.tsx} +11 -3
  115. package/themes/original/src/components/BusinessesListing/index.tsx +97 -457
  116. package/themes/original/src/components/Cart/index.tsx +61 -42
  117. package/themes/original/src/components/Checkout/index.tsx +88 -38
  118. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  119. package/themes/original/src/components/Favorite/index.tsx +92 -0
  120. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  121. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  122. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  123. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  124. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  125. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  126. package/themes/original/src/components/Help/index.tsx +21 -4
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  128. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  129. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  130. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  131. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  132. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  133. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  134. package/themes/original/src/components/Messages/index.tsx +1 -1
  135. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  136. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  137. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  138. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  139. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  141. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  142. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  143. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  144. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  145. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  146. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  147. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  148. package/themes/original/src/components/NavBar/index.tsx +4 -4
  149. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  150. package/themes/original/src/components/OrderDetails/index.tsx +151 -65
  151. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  152. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  157. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  158. package/themes/original/src/components/OrdersOption/index.tsx +130 -38
  159. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  160. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  162. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  163. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  164. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  165. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  166. package/themes/original/src/components/ProductForm/index.tsx +70 -62
  167. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  168. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  169. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  170. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  171. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  173. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  174. package/themes/original/src/components/Promotions/index.tsx +151 -133
  175. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  176. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  177. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  178. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  179. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  180. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  181. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  182. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  183. package/themes/original/src/components/Sessions/index.tsx +160 -0
  184. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  185. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  186. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  187. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  188. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  189. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  190. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  191. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  192. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  193. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  194. package/themes/original/src/components/UserProfile/index.tsx +52 -5
  195. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  196. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  197. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  198. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  199. package/themes/original/src/components/Wallets/index.tsx +76 -9
  200. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  201. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  202. package/themes/original/src/components/shared/OModal.tsx +4 -2
  203. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  204. package/themes/original/src/types/index.tsx +186 -35
  205. package/themes/original/src/utils/index.tsx +96 -2
  206. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  207. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -89,6 +89,8 @@ const PaymentOptionsUI = (props: any) => {
89
89
  return theme.images.general.stripes
90
90
  case 'stripe_redirect':
91
91
  return theme.images.general.stripesb
92
+ case 'apple_pay':
93
+ return theme.images.general.applePayMark
92
94
  default:
93
95
  return theme.images.general.creditCard
94
96
  }
@@ -97,7 +99,7 @@ const PaymentOptionsUI = (props: any) => {
97
99
  const handlePaymentMethodClick = (paymethod: any) => {
98
100
  const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal', 'square'].includes(paymethod?.gateway)
99
101
  handlePaymethodClick(paymethod, isPopupMethod)
100
- if (webViewPaymentGateway.includes(paymethod?.gateway)) {
102
+ if (webViewPaymentGateway.includes(paymethod?.gateway)) {
101
103
  handlePaymentMethodClickCustom(paymethod)
102
104
  }
103
105
  setCardData(paymethodData)
@@ -130,33 +132,48 @@ const PaymentOptionsUI = (props: any) => {
130
132
 
131
133
  const renderPaymethods = ({ item }: any) => {
132
134
  return (
133
- <TouchableOpacity
134
- onPress={() => handlePaymentMethodClick(item)}
135
- >
136
- <PMItem
137
- key={item.id}
138
- isDisabled={isDisabled}
139
- isActive={paymethodSelected?.id === item.id}
140
- >
141
- <OIcon
142
- src={getPayIcon(item.gateway)}
143
- width={40}
144
- height={40}
145
- color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
146
- />
147
- <OText
148
- size={12}
149
- style={{ margin: 0 }}
150
- color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
135
+ <>
136
+ {item?.gateway === 'apple_pay' ? (
137
+ <TouchableOpacity
138
+ onPress={() => handlePaymentMethodClick(item)}
151
139
  >
152
- {t(item.gateway.toUpperCase(), item.name)}
153
- </OText>
154
- </PMItem>
155
- </TouchableOpacity>
140
+ <OIcon
141
+ src={getPayIcon(item.gateway)}
142
+ width={120}
143
+ height={100}
144
+ style={{ marginRight: 10 }}
145
+ />
146
+ </TouchableOpacity>
147
+ ) : (
148
+ <TouchableOpacity
149
+ onPress={() => handlePaymentMethodClick(item)}
150
+ >
151
+ <PMItem
152
+ key={item.id}
153
+ isDisabled={isDisabled}
154
+ isActive={paymethodSelected?.id === item.id}
155
+ >
156
+ <OIcon
157
+ src={getPayIcon(item.gateway)}
158
+ width={40}
159
+ height={40}
160
+ color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
161
+ />
162
+ <OText
163
+ size={12}
164
+ style={{ margin: 0 }}
165
+ color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
166
+ >
167
+ {t(item.gateway.toUpperCase(), item.name)}
168
+ </OText>
169
+ </PMItem>
170
+ </TouchableOpacity>
171
+ )}
172
+ </>
156
173
  )
157
174
  }
158
175
 
159
- const excludeGateway: any = ['stripe_connect', 'stripe_redirect']; //exclude connect & redirect
176
+ const excludeGateway: any = ['stripe_connect', 'stripe_redirect', 'apple_pay']; //exclude connect & redirect & apple pay
160
177
 
161
178
  return (
162
179
  <PMContainer>
@@ -213,31 +230,31 @@ const PaymentOptionsUI = (props: any) => {
213
230
  {stripeOptions.includes(paymethodSelected?.gateway) &&
214
231
  (paymethodData?.brand || paymethodData?.card?.brand) &&
215
232
  (paymethodData?.last4 || paymethodData?.card?.last4) &&
216
- (
217
- <PMCardSelected>
218
- <PMCardItemContent>
219
- <View style={styles.viewStyle}>
220
- <MaterialCommunityIcons
221
- name='radiobox-marked'
222
- size={24}
223
- color={theme.colors.primary}
224
- />
225
- </View>
226
- <View style={styles.viewStyle}>
227
- <OText>
228
- {getIconCard((paymethodData?.brand || paymethodData?.card?.brand), 26)}
229
- </OText>
230
- </View>
231
- <View style={styles.viewStyle}>
232
- <OText
233
- size={20}
234
- >
235
- XXXX-XXXX-XXXX-{(paymethodData?.last4 || paymethodData?.card?.last4)}
236
- </OText>
237
- </View>
238
- </PMCardItemContent>
239
- </PMCardSelected>
240
- )}
233
+ (
234
+ <PMCardSelected>
235
+ <PMCardItemContent>
236
+ <View style={styles.viewStyle}>
237
+ <MaterialCommunityIcons
238
+ name='radiobox-marked'
239
+ size={24}
240
+ color={theme.colors.primary}
241
+ />
242
+ </View>
243
+ <View style={styles.viewStyle}>
244
+ <OText>
245
+ {getIconCard((paymethodData?.brand || paymethodData?.card?.brand), 26)}
246
+ </OText>
247
+ </View>
248
+ <View style={styles.viewStyle}>
249
+ <OText
250
+ size={20}
251
+ >
252
+ XXXX-XXXX-XXXX-{(paymethodData?.last4 || paymethodData?.card?.last4)}
253
+ </OText>
254
+ </View>
255
+ </PMCardItemContent>
256
+ </PMCardSelected>
257
+ )}
241
258
 
242
259
  {/* Stripe */}
243
260
  {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
@@ -317,7 +334,7 @@ const PaymentOptionsUI = (props: any) => {
317
334
  bgColor={theme.colors.primary}
318
335
  borderColor={theme.colors.primary}
319
336
  style={styles.btnAddStyle}
320
- textStyle={{color: 'white'}}
337
+ textStyle={{ color: 'white' }}
321
338
  imgRightSrc={null}
322
339
  onClick={() => setAddCardOpen({ ...addCardOpen, stripeConnect: true })}
323
340
  />
@@ -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>