ordering-ui-react-native 0.17.98 → 0.17.99-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 (224) hide show
  1. package/package.json +9 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +7 -2
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -15
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  35. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  36. package/themes/business/src/components/OrdersOption/index.tsx +60 -47
  37. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  38. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  39. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  40. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  41. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  42. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  43. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  46. package/themes/business/src/components/StoresList/index.tsx +3 -4
  47. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  48. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  49. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  50. package/themes/business/src/components/shared/OModal.tsx +16 -9
  51. package/themes/business/src/types/index.tsx +24 -10
  52. package/themes/business/src/utils/index.tsx +29 -2
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  57. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  58. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  61. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  62. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  63. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  64. package/themes/original/index.tsx +7 -3
  65. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  66. package/themes/original/src/components/AddressForm/index.tsx +33 -15
  67. package/themes/original/src/components/AddressList/index.tsx +5 -8
  68. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  69. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  70. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  71. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  72. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  73. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  74. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  75. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  76. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  77. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  78. package/themes/original/src/components/BusinessItemAccordion/index.tsx +21 -23
  79. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  81. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +105 -22
  83. package/themes/original/src/components/BusinessPreorder/styles.tsx +14 -0
  84. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  87. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +137 -32
  89. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  90. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  93. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  94. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  95. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  96. package/themes/original/src/components/Cart/index.tsx +49 -47
  97. package/themes/original/src/components/CartContent/index.tsx +99 -38
  98. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  99. package/themes/original/src/components/Checkout/index.tsx +323 -42
  100. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  101. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  102. package/themes/original/src/components/DatePicker/index.tsx +17 -0
  103. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  104. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  105. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  106. package/themes/original/src/components/Favorite/index.tsx +1 -5
  107. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  108. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  109. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  110. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  111. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  112. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  113. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  114. package/themes/original/src/components/Home/index.tsx +13 -4
  115. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  116. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  117. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  118. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  119. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  120. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  121. package/themes/original/src/components/Messages/index.tsx +15 -4
  122. package/themes/original/src/components/MomentOption/index.tsx +44 -39
  123. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  124. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  125. package/themes/original/src/components/MultiCheckout/index.tsx +346 -68
  126. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  127. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  128. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  129. package/themes/original/src/components/NavBar/index.tsx +20 -13
  130. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  131. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  132. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  133. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  134. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  135. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  136. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  137. package/themes/original/src/components/OrderSummary/index.tsx +62 -57
  138. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  139. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  140. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  141. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  142. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  143. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  144. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  145. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  146. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  147. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  148. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  149. package/themes/original/src/components/ProductForm/ActionButton.tsx +120 -0
  150. package/themes/original/src/components/ProductForm/index.tsx +65 -34
  151. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  152. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  153. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  154. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  155. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  156. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  157. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  158. package/themes/original/src/components/Promotions/index.tsx +2 -2
  159. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  160. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  161. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  162. package/themes/original/src/components/ServiceForm/index.tsx +40 -20
  163. package/themes/original/src/components/SignupForm/index.tsx +27 -16
  164. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  165. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  166. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  167. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  168. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  169. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  170. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  171. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  172. package/themes/original/src/components/UpsellingProducts/index.tsx +3 -8
  173. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  174. package/themes/original/src/components/UserFormDetails/index.tsx +84 -19
  175. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  176. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  177. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  178. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  179. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  180. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  181. package/themes/original/src/components/Wallets/index.tsx +51 -61
  182. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  183. package/themes/original/src/components/shared/OButton.tsx +3 -3
  184. package/themes/original/src/components/shared/OInput.tsx +4 -5
  185. package/themes/original/src/components/shared/OModal.tsx +3 -3
  186. package/themes/original/src/types/index.tsx +30 -7
  187. package/themes/original/src/utils/index.tsx +180 -13
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  189. package/src/navigators/BottomNavigator.tsx +0 -117
  190. package/src/navigators/CheckoutNavigator.tsx +0 -66
  191. package/src/navigators/HomeNavigator.tsx +0 -202
  192. package/src/navigators/NavigationRef.tsx +0 -7
  193. package/src/navigators/RootNavigator.tsx +0 -269
  194. package/src/pages/Account.tsx +0 -34
  195. package/src/pages/AddressForm.tsx +0 -62
  196. package/src/pages/AddressList.tsx +0 -24
  197. package/src/pages/BusinessProductsList.tsx +0 -81
  198. package/src/pages/BusinessesListing.tsx +0 -43
  199. package/src/pages/CartList.tsx +0 -49
  200. package/src/pages/Checkout.tsx +0 -101
  201. package/src/pages/ForgotPassword.tsx +0 -24
  202. package/src/pages/Help.tsx +0 -23
  203. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  204. package/src/pages/HelpGuide.tsx +0 -23
  205. package/src/pages/HelpOrder.tsx +0 -23
  206. package/src/pages/Home.tsx +0 -36
  207. package/src/pages/IntroductoryTutorial.tsx +0 -170
  208. package/src/pages/Login.tsx +0 -47
  209. package/src/pages/MomentOption.tsx +0 -30
  210. package/src/pages/MultiCheckout.tsx +0 -31
  211. package/src/pages/MultiOrdersDetails.tsx +0 -27
  212. package/src/pages/MyOrders.tsx +0 -40
  213. package/src/pages/NetworkError.tsx +0 -24
  214. package/src/pages/NotFound.tsx +0 -22
  215. package/src/pages/OrderDetails.tsx +0 -25
  216. package/src/pages/ProductDetails.tsx +0 -55
  217. package/src/pages/Profile.tsx +0 -36
  218. package/src/pages/ReviewDriver.tsx +0 -30
  219. package/src/pages/ReviewOrder.tsx +0 -32
  220. package/src/pages/ReviewProducts.tsx +0 -30
  221. package/src/pages/Sessions.tsx +0 -22
  222. package/src/pages/Signup.tsx +0 -53
  223. package/src/pages/SpinnerLoader.tsx +0 -10
  224. package/src/pages/Splash.tsx +0 -21
@@ -1,14 +1,49 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { createClient, AnalyticsProvider } from '@segment/analytics-react-native';
3
- import { useEvent, useConfig } from 'ordering-components/native';
2
+ import {
3
+ createClient,
4
+ AnalyticsProvider
5
+ } from '@segment/analytics-react-native';
6
+ import { useEvent, useConfig, useLanguage } from 'ordering-components/native';
4
7
 
5
8
  export const AnalyticsSegment = (props: any) => {
6
9
  const { children } = props
7
10
 
8
11
  const [events] = useEvent()
9
12
  const [configState] = useConfig()
13
+ const [, t] = useLanguage()
10
14
  const [segmentClient, setSegmentClient] = useState<any>({})
11
15
 
16
+ const handleProductsSearched = (query: any) => {
17
+ segmentClient.track('Products Searched', {
18
+ query: query
19
+ })
20
+ }
21
+
22
+ const handleProductListViewed = (category: any) => {
23
+ segmentClient.track('Product List Viewed', {
24
+ business_id: category?.business_id,
25
+ category_id: category?.id,
26
+ category: category?.name,
27
+ products: category?.products
28
+ })
29
+ }
30
+
31
+ const handlePromotionViewed = (promotion: any) => {
32
+ segmentClient.track('Promotion Viewed', {
33
+ promotion_id: (promotion?.id || '').toString(),
34
+ name: promotion.name,
35
+ position: promotion.position
36
+ })
37
+ }
38
+
39
+ const handlePromotionClicked = (promotion: any) => {
40
+ segmentClient.track('Promotion Clicked', {
41
+ promotion_id: (promotion?.id || '').toString(),
42
+ name: promotion.name,
43
+ position: promotion.position
44
+ })
45
+ }
46
+
12
47
  const handleClickProduct = (product: any) => {
13
48
  segmentClient.track('Product Clicked', {
14
49
  id: product.id,
@@ -18,6 +53,15 @@ export const AnalyticsSegment = (props: any) => {
18
53
  })
19
54
  }
20
55
 
56
+ const handleProductViewed = (product: any) => {
57
+ segmentClient.track('Product Viewed', {
58
+ id: product.id,
59
+ name: product.name,
60
+ category: product.category_id,
61
+ price: product.price
62
+ })
63
+ }
64
+
21
65
  const handleProductAdded = (product: any) => {
22
66
  segmentClient.track('Product Added', {
23
67
  id: product.id,
@@ -38,6 +82,23 @@ export const AnalyticsSegment = (props: any) => {
38
82
  })
39
83
  }
40
84
 
85
+ const handleCartViewed = (cart: any) => {
86
+ segmentClient.track('Cart Viewed', {
87
+ id: cart.uuid,
88
+ products: cart?.products
89
+ })
90
+ }
91
+
92
+ const handleCheckoutStarted = (cart: any) => {
93
+ segmentClient.track('Checkout Started', {
94
+ cart_id: cart?.uuid,
95
+ affiliation: cart?.business?.name,
96
+ revenue: cart?.total,
97
+ tax: cart?.tax_total,
98
+ shipping: cart?.delivery_zone_price
99
+ })
100
+ }
101
+
41
102
  const handleOrderPlaced = (order: any) => {
42
103
  segmentClient.track('Order Placed', {
43
104
  id: order.id,
@@ -65,6 +126,35 @@ export const AnalyticsSegment = (props: any) => {
65
126
  tax: order.tax_total,
66
127
  shipping: order.delivery_zone_price
67
128
  })
129
+
130
+ if (order?.history?.length) {
131
+ const lasthistory = order.history[order.history.length - 1]
132
+ if (lasthistory?.data) {
133
+ lasthistory.data.forEach(item => {
134
+ if (item.attribute === 'status') {
135
+ if (item.new === 15) {
136
+ segmentClient.track('Order Completed', {
137
+ id: order.id,
138
+ affiliation: order.business?.name,
139
+ revenue: order.total,
140
+ tax: order.tax_total,
141
+ shipping: order.delivery_zone_price
142
+ })
143
+ }
144
+ const orderCancelled = [2, 5, 6, 10, 12, 16, 17]
145
+ if (orderCancelled.includes(item.new)) {
146
+ segmentClient.track('Order Cancelled', {
147
+ id: order.id,
148
+ affiliation: order.business?.name,
149
+ revenue: order.total,
150
+ tax: order.tax_total,
151
+ shipping: order.delivery_zone_price
152
+ })
153
+ }
154
+ }
155
+ })
156
+ }
157
+ }
68
158
  }
69
159
 
70
160
  const handleAddOrder = (order: any) => {
@@ -77,6 +167,51 @@ export const AnalyticsSegment = (props: any) => {
77
167
  })
78
168
  }
79
169
 
170
+ const handleCouponEntered = (cart: any) => {
171
+ segmentClient.track('Coupon Entered', {
172
+ cart_id: cart.uuid,
173
+ coupon: cart.coupon
174
+ })
175
+ }
176
+
177
+ const handleCouponApplied = (cart: any) => {
178
+ const coupon: any = cart?.offers?.find(offer => offer.type === 2)
179
+ if (coupon) {
180
+ segmentClient.track('Coupon Applied', {
181
+ cart_id: cart.uuid,
182
+ coupon_id: coupon.id,
183
+ coupon_name: coupon?.name,
184
+ discount: coupon?.summary?.discount
185
+ })
186
+ }
187
+ }
188
+
189
+ const handleCouponDenied = (coupon: any) => {
190
+ segmentClient.track('Coupon Denied', {
191
+ business_id: coupon.business_id,
192
+ coupon: coupon.coupon,
193
+ user_id: coupon?.user_id,
194
+ reason: typeof coupon.reason === 'string' ? t(coupon.reason) : t(coupon.reason[0])
195
+ })
196
+ }
197
+
198
+ const handleCouponRemoved = (coupon: any) => {
199
+ segmentClient.track('Coupon Removed', {
200
+ business_id: coupon.business_id,
201
+ coupon_id: coupon.offer_id,
202
+ })
203
+ }
204
+
205
+ const handleProductReviewed = (products: any) => {
206
+ products.forEach((product: any) => {
207
+ segmentClient.track('Product Reviewed', {
208
+ product_id: product.product_id,
209
+ review_body: product.comment,
210
+ rating: product.qualification
211
+ })
212
+ })
213
+ }
214
+
80
215
  const handleLogin = (data: any) => {
81
216
  segmentClient.identify(data.id, {
82
217
  email: data.email,
@@ -84,25 +219,74 @@ export const AnalyticsSegment = (props: any) => {
84
219
  })
85
220
  }
86
221
 
222
+ const handleProductAddedToWishlist = (product: any) => {
223
+ segmentClient.track('Product Added to Wishlist', product)
224
+ }
225
+
226
+ const handleProductRemovedFromWishlist = (product: any) => {
227
+ segmentClient.track('Product Removed from Wishlist', product)
228
+ }
229
+
230
+ const handleWishlistProductAddedToCart = (product: any, result: any) => {
231
+ segmentClient.track('Wishlist Product Added to Cart', {
232
+ cart_id: result.uuid,
233
+ product_id: product.id,
234
+ name: product.name,
235
+ category: product.categoryId,
236
+ price: product.price,
237
+ quantity: product.quantity
238
+ })
239
+ }
240
+
87
241
  useEffect(() => {
88
242
  if (segmentClient?.config?.writeKey) {
243
+ events.on('products_searched', handleProductsSearched)
244
+ events.on('product_list_viewed', handleProductListViewed)
245
+ events.on('promotion_viewed', handlePromotionViewed)
246
+ events.on('promotion_clicked', handlePromotionClicked)
89
247
  events.on('product_clicked', handleClickProduct)
90
- events.on('userLogin', handleLogin)
248
+ events.on('product_viewed', handleProductViewed)
91
249
  events.on('product_added', handleProductAdded)
92
- events.on('order_placed', handleOrderPlaced)
250
+ events.on('cart_product_removed', handleProductRemoved)
251
+ events.on('cart_viewed', handleCartViewed)
252
+ events.on('checkout_started', handleCheckoutStarted)
93
253
  events.on('order_updated', handleUpdateOrder)
254
+ events.on('coupon_entered', handleCouponEntered)
255
+ events.on('offer_applied', handleCouponApplied)
256
+ events.on('offer_denied', handleCouponDenied)
257
+ events.on('offer_removed', handleCouponRemoved)
258
+ events.on('product_reviewed', handleProductReviewed)
259
+ events.on('userLogin', handleLogin)
260
+ events.on('order_placed', handleOrderPlaced)
94
261
  events.on('order_added', handleAddOrder)
95
- events.on('cart_product_removed', handleProductRemoved)
262
+ events.on('product_added_to_wishlist', handleProductAddedToWishlist)
263
+ events.on('product_removed_from_wishlist', handleProductRemovedFromWishlist)
264
+ events.on('wishlist_product_added_to_cart', handleWishlistProductAddedToCart)
96
265
  }
97
266
  return () => {
98
267
  if (segmentClient?.config?.writeKey) {
268
+ events.off('products_searched', handleProductsSearched)
269
+ events.off('product_list_viewed', handleProductListViewed)
270
+ events.off('promotion_viewed', handlePromotionViewed)
271
+ events.off('promotion_clicked', handlePromotionClicked)
99
272
  events.off('product_clicked', handleClickProduct)
100
- events.off('userLogin', handleLogin)
273
+ events.off('product_viewed', handleProductViewed)
101
274
  events.off('product_added', handleProductAdded)
102
- events.off('order_placed', handleOrderPlaced)
275
+ events.off('cart_product_removed', handleProductRemoved)
276
+ events.off('cart_viewed', handleCartViewed)
277
+ events.off('checkout_started', handleCheckoutStarted)
103
278
  events.off('order_updated', handleUpdateOrder)
279
+ events.off('coupon_entered', handleCouponEntered)
280
+ events.off('offer_applied', handleCouponApplied)
281
+ events.off('offer_denied', handleCouponDenied)
282
+ events.off('offer_removed', handleCouponRemoved)
283
+ events.off('product_reviewed', handleProductReviewed)
284
+ events.off('userLogin', handleLogin)
285
+ events.off('order_placed', handleOrderPlaced)
104
286
  events.off('order_added', handleAddOrder)
105
- events.off('cart_product_removed', handleProductRemoved)
287
+ events.off('product_added_to_wishlist', handleProductAddedToWishlist)
288
+ events.off('product_removed_from_wishlist', handleProductRemovedFromWishlist)
289
+ events.off('wishlist_product_added_to_cart', handleWishlistProductAddedToCart)
106
290
  }
107
291
  }
108
292
  }, [segmentClient])
@@ -110,7 +294,7 @@ export const AnalyticsSegment = (props: any) => {
110
294
  useEffect(() => {
111
295
  if (configState?.configs?.segment_track_id?.value) {
112
296
  const _segmentClient: any = createClient({
113
- writeKey: configState?.configs?.segment_track_id?.value
297
+ writeKey: configState?.configs?.segment_track_id?.value,
114
298
  });
115
299
  setSegmentClient(_segmentClient)
116
300
  }
@@ -122,6 +306,5 @@ export const AnalyticsSegment = (props: any) => {
122
306
  {children}
123
307
  </AnalyticsProvider>
124
308
  </>
125
-
126
309
  )
127
310
  }
@@ -21,7 +21,7 @@ export const AppleLogin = (props: any) => {
21
21
  const [{ configs }] = useConfig();
22
22
  const [credentialStateForUser, updateCredentialStateForUser] = useState<any>(-1);
23
23
 
24
- let user : any= null
24
+ let user: any = null
25
25
 
26
26
  const buttonText = auth
27
27
  ? t('CONTINUE_WITH_APPLE', 'Logout with Apple')
@@ -53,7 +53,7 @@ export const AppleLogin = (props: any) => {
53
53
  }
54
54
  }
55
55
 
56
- const fetchAndUpdateCredentialState = async (updateCredentialStateForUser : any) => {
56
+ const fetchAndUpdateCredentialState = async (updateCredentialStateForUser: any) => {
57
57
  if (user === null) {
58
58
  updateCredentialStateForUser('N/A');
59
59
  } else {
@@ -66,7 +66,7 @@ export const AppleLogin = (props: any) => {
66
66
  }
67
67
  }
68
68
 
69
- const onIOSButtonPress = async (updateCredentialStateForUser : any) => {
69
+ const onIOSButtonPress = async (updateCredentialStateForUser: any) => {
70
70
  try {
71
71
  const appleAuthRequestResponse = await appleAuth.performRequest({
72
72
  requestedOperation: appleAuth.Operation.LOGIN,
@@ -79,7 +79,7 @@ export const AppleLogin = (props: any) => {
79
79
  identityToken,
80
80
  authorizationCode
81
81
  } = appleAuthRequestResponse;
82
-
82
+
83
83
  user = newUser;
84
84
 
85
85
  fetchAndUpdateCredentialState(updateCredentialStateForUser).catch(error =>
@@ -1,6 +1,8 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
- export const Container = styled.View``
3
+ export const Container = styled.View`
4
+ margin-bottom: 20px;
5
+ `
4
6
 
5
7
  export const AppleButton = styled.TouchableOpacity`
6
8
  background-color: #FFFFFF;
@@ -1,11 +1,11 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { StyleSheet, View, TouchableOpacity, Linking, Pressable } from 'react-native';
2
+ import { StyleSheet, View, TouchableOpacity, Linking, Pressable, Image } from 'react-native';
3
3
  import FastImage from 'react-native-fast-image'
4
4
  import { useUtils, useOrder, useLanguage } from 'ordering-components/native';
5
5
  import { useTheme } from 'styled-components/native';
6
6
  import { OIcon, OText, OModal } from '../shared';
7
7
  import { BusinessBasicInformationParams } from '../../types';
8
- import { convertHoursToMinutes, shape } from '../../utils';
8
+ import { convertHoursToMinutes, lightenDarkenColor, shape } from '../../utils';
9
9
  import MaterialComIcon from 'react-native-vector-icons/MaterialCommunityIcons'
10
10
  import dayjs from 'dayjs';
11
11
  import timezone from 'dayjs/plugin/timezone';
@@ -21,7 +21,6 @@ import {
21
21
  BusinessInfo,
22
22
  BusinessInfoItem,
23
23
  WrapReviews,
24
- WrapBusinessInfo,
25
24
  TitleWrapper,
26
25
  RibbonBox,
27
26
  SocialListWrapper
@@ -46,6 +45,7 @@ export const BusinessBasicInformation = (
46
45
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
47
46
  const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
48
47
  const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
48
+ const [imageRealSize, setImageRealSize] = useState({ width: 16, height: 9, loading: true })
49
49
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
50
50
  const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
51
51
  const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
@@ -62,7 +62,7 @@ export const BusinessBasicInformation = (
62
62
  height: 150,
63
63
  },
64
64
  headerStyle: {
65
- height: isChewLayout ? 170 : 260,
65
+ aspectRatio: imageRealSize?.width / imageRealSize?.height
66
66
  },
67
67
  logoStyle: {
68
68
  width: 72,
@@ -101,11 +101,11 @@ export const BusinessBasicInformation = (
101
101
  borderRadius: 3,
102
102
  borderColor: theme.colors.border,
103
103
  borderWidth: isChewLayout ? 0 : 1,
104
- width: 20,
105
- height: 20,
104
+ width: 30,
105
+ height: 30,
106
106
  justifyContent: 'center',
107
107
  alignItems: 'center',
108
- marginRight: 5,
108
+ marginRight: 10,
109
109
  marginBottom: 7
110
110
  },
111
111
  tiktokIcon: {
@@ -146,7 +146,7 @@ export const BusinessBasicInformation = (
146
146
  }
147
147
 
148
148
  const getBusinessType = () => {
149
- if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
149
+ if (Object.keys(business || {}).length <= 0) return t('GENERAL', 'General');
150
150
  const _types: any = [];
151
151
  types.forEach(
152
152
  (type) =>
@@ -166,7 +166,7 @@ export const BusinessBasicInformation = (
166
166
  <MaterialComIcon
167
167
  name={iconTitle}
168
168
  color={isChewLayout ? theme.colors.black : theme.colors.textNormal}
169
- size={isChewLayout ? 18 : 14}
169
+ size={isChewLayout ? 25 : 22}
170
170
  />
171
171
  </TouchableOpacity>
172
172
  )
@@ -196,6 +196,20 @@ export const BusinessBasicInformation = (
196
196
  }
197
197
  }, [businessState?.business])
198
198
 
199
+ useEffect(() => {
200
+ const bannerImage = header || businessState?.business?.header
201
+ if (!bannerImage) {
202
+ setImageRealSize({ width: 16, height: 9, loading: false })
203
+ return
204
+ }
205
+ Image.getSize(bannerImage, (width: number, height: number) => {
206
+ setImageRealSize({ width: width, height: height, loading: false });
207
+ }, (error: any) => {
208
+ setImageRealSize({ ...imageRealSize, loading: false });
209
+ console.log(error);
210
+ });
211
+ }, [header, businessState?.business?.header])
212
+
199
213
  const SocialIcons = () => {
200
214
  return (
201
215
  <>
@@ -203,7 +217,7 @@ export const BusinessBasicInformation = (
203
217
  <Placeholder Animation={Fade}>
204
218
  <View style={{ flexDirection: 'row' }}>
205
219
  {[...Array(5).keys()].map(i => (
206
- <View style={styles.socialIcon} key={i}>
220
+ <View style={{ ...styles.socialIcon, borderWidth: 0 }} key={i}>
207
221
  <PlaceholderLine width={100} height={20} style={{ marginBottom: 0 }} />
208
222
  </View>
209
223
  ))}
@@ -284,18 +298,13 @@ export const BusinessBasicInformation = (
284
298
  ? styles.businesInfoheaderStyle
285
299
  : { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
286
300
  }
287
- {...(!loading && {
288
- source: (header || businessState?.business?.header) ? {
289
- uri: header || optimizeImage(businessState?.business?.header, 'h_250,c_limit')
301
+ {...(!loading && !imageRealSize?.loading && {
302
+ source: (header || businessState?.business?.header || typeof theme?.images?.dummies?.businessHeader === 'string') ? {
303
+ uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header || theme?.images?.dummies?.businessHeader
290
304
  } : theme?.images?.dummies?.businessHeader
291
305
  })}
292
306
  imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
293
307
  >
294
- {!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
295
- <WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
296
- <OIcon src={theme.images.general.info} width={24} />
297
- </WrapBusinessInfo>
298
- )}
299
308
  {isChewLayout && !loading && (
300
309
  <View style={styles.headerChewStyle}>
301
310
  <OText size={24} weight={'600'} mBottom={-5}>
@@ -317,21 +326,31 @@ export const BusinessBasicInformation = (
317
326
  {!hideLogo && (
318
327
  <BusinessLogo isChewLayout={isChewLayout}>
319
328
  {!isBusinessInfoShow && (
320
- logo || businessState?.business?.logo ?
321
- <FastImage
322
- style={styles.logoStyle}
323
- source={{
324
- uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit'),
325
- priority: FastImage.priority.high,
326
- cache: FastImage.cacheControl.web
327
- }}
328
- resizeMode={FastImage.resizeMode.contain}
329
- />
330
- :
331
- <OIcon
332
- src={theme?.images?.dummies?.businessLogo}
333
- style={styles.logoStyle}
334
- />
329
+ <>
330
+ {loading ? (
331
+ <View style={styles.logoStyle}>
332
+ <Placeholder Animation={Fade}>
333
+ <PlaceholderLine height={72} style={{ borderRadius: 8 }} />
334
+ </Placeholder>
335
+ </View>
336
+ ) : (
337
+ logo || businessState?.business?.logo || typeof theme.images.dummies.businessLogo === 'string' ?
338
+ <FastImage
339
+ style={styles.logoStyle}
340
+ source={{
341
+ uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit') || theme.images.dummies.businessLogo,
342
+ priority: FastImage.priority.high,
343
+ cache: FastImage.cacheControl.web
344
+ }}
345
+ resizeMode={FastImage.resizeMode.contain}
346
+ />
347
+ :
348
+ <OIcon
349
+ src={theme?.images?.dummies?.businessLogo}
350
+ style={styles.logoStyle}
351
+ />
352
+ )}
353
+ </>
335
354
  )}
336
355
  </BusinessLogo>
337
356
  )}
@@ -351,13 +370,15 @@ export const BusinessBasicInformation = (
351
370
  {business?.ribbon?.enabled && (
352
371
  <RibbonBox
353
372
  bgColor={business?.ribbon?.color}
373
+ colorText={lightenDarkenColor(business?.ribbon?.color)}
374
+ borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
354
375
  isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
355
376
  isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
356
377
  >
357
378
  <OText
358
379
  size={10}
359
380
  weight={'400'}
360
- color={theme.colors.white}
381
+ color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
361
382
  numberOfLines={2}
362
383
  ellipsizeMode='tail'
363
384
  lineHeight={13}
@@ -451,13 +472,28 @@ export const BusinessBasicInformation = (
451
472
  </>
452
473
  )}
453
474
  {!hideReviewsPopup && (
454
- <TouchableOpacity onPress={() => handleClickBusinessReviews()}>
475
+ <>
476
+ <TouchableOpacity onPress={() => handleClickBusinessReviews()}>
477
+ <OText
478
+ color={theme.colors.primary}
479
+ style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
480
+ size={12}
481
+ >
482
+ {t('REVIEWS', 'Reviews')}
483
+ </OText>
484
+ </TouchableOpacity>
485
+ <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
486
+ </>
487
+ )}
488
+
489
+ {!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
490
+ <TouchableOpacity onPress={() => handleClickBusinessInformation()}>
455
491
  <OText
456
492
  color={theme.colors.primary}
457
493
  style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
458
494
  size={12}
459
495
  >
460
- {t('REVIEWS', 'Reviews')}
496
+ {t('INFORMATION', 'Information')}
461
497
  </OText>
462
498
  </TouchableOpacity>
463
499
  )}
@@ -8,9 +8,6 @@ export const BusinessContainer = styled.View`
8
8
  export const BusinessHeader = styled.ImageBackground`
9
9
  width: 100%;
10
10
  position: relative;
11
- max-height: 258px;
12
- height: 258px;
13
- resize-mode: cover;
14
11
  `;
15
12
  export const BusinessLogo = styled.View`
16
13
  position: absolute;
@@ -36,25 +33,18 @@ export const WrapReviews = styled.View`
36
33
  align-items: center;
37
34
  justify-content: flex-start;
38
35
  `;
39
- export const WrapBusinessInfo = styled.TouchableOpacity`
40
- position: absolute;
41
- top: 16px;
42
- end: 39px;
43
- `;
44
36
 
45
37
  export const TitleWrapper = styled.View`
46
38
  width: 100%;
47
- flex-direction: row;
48
- align-items: center;
49
- justify-content: space-between;
39
+ flex-direction: column;
50
40
  `
51
41
 
52
42
  export const RibbonBox = styled.View`
53
- margin-left: 5px;
54
43
  background-color: ${(props: any) => props.theme.colors.primary};
55
44
  padding: 2px 8px;
56
45
  max-width: 180px;
57
46
  align-self: flex-start;
47
+ margin-bottom: 5px;
58
48
 
59
49
  ${(props: any) => props.bgColor && css`
60
50
  background-color: ${props.bgColor};
@@ -67,6 +57,14 @@ export const RibbonBox = styled.View`
67
57
  ${(props: any) => props.isCapsule && css`
68
58
  border-radius: 50px;
69
59
  `}
60
+
61
+ ${(props: any) => props.colorText && css`
62
+ color: ${props.colorText ? 'black' : 'white'};
63
+ `}
64
+
65
+ ${(props: any) => props.borderRibbon && css`
66
+ border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
67
+ `}
70
68
  `
71
69
 
72
70
  export const SocialListWrapper = styled.ScrollView`