ordering-ui-react-native 0.16.96 → 0.16.97-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.
- package/package.json +5 -5
- package/src/DeliveryApp.tsx +43 -1
- package/src/components/ActiveOrders/styles.tsx +8 -14
- package/src/components/BusinessInformation/index.tsx +11 -4
- package/src/components/BusinessInformation/styles.tsx +2 -2
- package/src/components/BusinessProductsList/index.tsx +1 -1
- package/src/components/BusinessesListing/index.tsx +1 -1
- package/src/components/OrderCreating/index.tsx +1 -21
- package/src/components/OrdersOption/index.tsx +54 -56
- package/src/components/PaymentOptionsWebView/index.tsx +119 -120
- package/src/components/SingleProductReview/index.tsx +7 -4
- package/src/components/VerifyPhone/styles.tsx +1 -2
- package/src/components/shared/OToast.tsx +4 -4
- package/src/utils/index.tsx +7 -1
- package/themes/business/index.tsx +2 -0
- package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
- package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
- package/themes/business/src/components/BusinessController/index.tsx +2 -3
- package/themes/business/src/components/Chat/index.tsx +146 -135
- package/themes/business/src/components/DriverMap/index.tsx +22 -9
- package/themes/business/src/components/GoogleMap/index.tsx +58 -57
- package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
- package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/business/src/components/LoginForm/index.tsx +239 -80
- package/themes/business/src/components/LoginForm/styles.tsx +10 -0
- package/themes/business/src/components/MapView/index.tsx +18 -7
- package/themes/business/src/components/NewOrderNotification/index.tsx +33 -43
- package/themes/business/src/components/OrderDetails/Delivery.tsx +4 -3
- package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +96 -50
- package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +59 -62
- package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
- package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
- package/themes/business/src/components/OrderMessage/index.tsx +18 -17
- package/themes/business/src/components/OrdersOption/index.tsx +33 -75
- package/themes/business/src/components/OrdersOptionBusiness/index.tsx +1 -1
- package/themes/business/src/components/PreviousMessages/index.tsx +16 -18
- package/themes/business/src/components/PreviousOrders/OrderItem.tsx +250 -0
- package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
- package/themes/business/src/components/PreviousOrders/index.tsx +447 -247
- package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
- package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
- package/themes/business/src/components/ReviewCustomer/index.tsx +42 -25
- package/themes/business/src/components/StoresList/index.tsx +2 -2
- package/themes/business/src/components/shared/OLink.tsx +33 -13
- package/themes/business/src/components/shared/OModal.tsx +16 -9
- package/themes/business/src/components/shared/OText.tsx +8 -2
- package/themes/business/src/types/index.tsx +33 -2
- package/themes/business/src/utils/index.tsx +53 -0
- package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
- package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
- package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -1
- package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
- package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
- package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
- package/themes/kiosk/src/components/LoginForm/index.tsx +473 -151
- package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
- package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
- package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
- package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
- package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +3 -2
- package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
- package/themes/kiosk/src/components/ProductForm/index.tsx +1 -14
- package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
- package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
- package/themes/kiosk/src/layouts/Container.tsx +7 -1
- package/themes/kiosk/src/types/index.d.ts +13 -0
- package/themes/kiosk/src/utils/index.tsx +15 -0
- package/themes/original/index.tsx +8 -0
- package/themes/original/src/components/AddressDetails/index.tsx +29 -11
- package/themes/original/src/components/AddressForm/index.tsx +152 -117
- package/themes/original/src/components/AddressList/index.tsx +26 -21
- package/themes/original/src/components/AddressList/styles.tsx +4 -2
- package/themes/original/src/components/AnalyticsSegment/index.tsx +164 -8
- package/themes/original/src/components/AppleLogin/index.tsx +4 -4
- package/themes/original/src/components/BusinessBasicInformation/index.tsx +125 -82
- package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -4
- package/themes/original/src/components/BusinessController/index.tsx +145 -68
- package/themes/original/src/components/BusinessController/styles.tsx +22 -9
- package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
- package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
- package/themes/original/src/components/BusinessInformation/index.tsx +10 -31
- package/themes/original/src/components/BusinessItemAccordion/index.tsx +24 -23
- package/themes/original/src/components/BusinessListingSearch/index.tsx +52 -24
- package/themes/original/src/components/BusinessPreorder/index.tsx +96 -15
- package/themes/original/src/components/BusinessProductsList/index.tsx +20 -11
- package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
- package/themes/original/src/components/BusinessProductsListing/index.tsx +617 -490
- package/themes/original/src/components/BusinessProductsListing/styles.tsx +7 -13
- package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
- package/themes/original/src/components/BusinessTypeFilter/index.tsx +3 -3
- package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +98 -78
- package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -9
- package/themes/original/src/components/BusinessesListing/index.tsx +5 -3
- package/themes/original/src/components/Cart/index.tsx +87 -43
- package/themes/original/src/components/CartContent/index.tsx +77 -15
- package/themes/original/src/components/CartContent/styles.tsx +11 -1
- package/themes/original/src/components/Checkout/index.tsx +294 -175
- package/themes/original/src/components/Checkout/styles.tsx +4 -2
- package/themes/original/src/components/CitiesControl/index.tsx +89 -0
- package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
- package/themes/original/src/components/CouponControl/index.tsx +10 -3
- package/themes/original/src/components/DriverTips/index.tsx +52 -37
- package/themes/original/src/components/DriverTips/styles.tsx +2 -1
- package/themes/original/src/components/Favorite/index.tsx +7 -4
- package/themes/original/src/components/Favorite/styles.tsx +1 -1
- package/themes/original/src/components/FavoriteList/index.tsx +70 -80
- package/themes/original/src/components/FloatingButton/index.tsx +1 -2
- package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
- package/themes/original/src/components/GPSButton/styles.ts +3 -3
- package/themes/original/src/components/GoogleMap/index.tsx +10 -1
- package/themes/original/src/components/Help/index.tsx +8 -8
- package/themes/original/src/components/HelpAccountAndPayment/index.tsx +11 -22
- package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +6 -0
- package/themes/original/src/components/HelpGuide/index.tsx +12 -16
- package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
- package/themes/original/src/components/HelpOrder/index.tsx +12 -25
- package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
- package/themes/original/src/components/Home/index.tsx +13 -4
- package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
- package/themes/original/src/components/LastOrder/index.tsx +1 -34
- package/themes/original/src/components/LoginForm/Otp/index.tsx +89 -73
- package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
- package/themes/original/src/components/LoginForm/index.tsx +43 -19
- package/themes/original/src/components/LottieAnimation/index.tsx +78 -0
- package/themes/original/src/components/MessageListing/index.tsx +16 -42
- package/themes/original/src/components/Messages/index.tsx +32 -10
- package/themes/original/src/components/MomentOption/index.tsx +195 -88
- package/themes/original/src/components/MultiCart/index.tsx +50 -0
- package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +117 -96
- package/themes/original/src/components/MultiCheckout/index.tsx +247 -83
- package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
- package/themes/original/src/components/MultiOrdersDetails/index.tsx +67 -20
- package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
- package/themes/original/src/components/MyOrders/index.tsx +66 -17
- package/themes/original/src/components/NavBar/index.tsx +6 -11
- package/themes/original/src/components/NotFoundSource/index.tsx +1 -1
- package/themes/original/src/components/Notifications/index.tsx +144 -0
- package/themes/original/src/components/Notifications/styles.tsx +20 -0
- package/themes/original/src/components/OrderDetails/OrderEta.tsx +59 -0
- package/themes/original/src/components/OrderDetails/index.tsx +110 -221
- package/themes/original/src/components/OrderDetails/styles.tsx +10 -1
- package/themes/original/src/components/OrderItAgain/index.tsx +47 -43
- package/themes/original/src/components/OrderProgress/index.tsx +74 -112
- package/themes/original/src/components/OrderProgress/styles.tsx +5 -0
- package/themes/original/src/components/OrderSummary/index.tsx +66 -29
- package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -3
- package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +28 -19
- package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +3 -0
- package/themes/original/src/components/OrdersOption/index.tsx +76 -83
- package/themes/original/src/components/PageBanner/index.tsx +171 -0
- package/themes/original/src/components/PageBanner/styles.tsx +11 -0
- package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
- package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
- package/themes/original/src/components/PaymentOptions/index.tsx +2 -2
- package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
- package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
- package/themes/original/src/components/PreviousOrders/index.tsx +3 -2
- package/themes/original/src/components/ProductForm/index.tsx +240 -261
- package/themes/original/src/components/ProductForm/styles.tsx +4 -7
- package/themes/original/src/components/ProductItemAccordion/index.tsx +199 -128
- package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -10
- package/themes/original/src/components/ProductOptionSubOption/styles.tsx +1 -2
- package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
- package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -49
- package/themes/original/src/components/ProfessionalProfile/index.tsx +54 -14
- package/themes/original/src/components/Promotions/index.tsx +234 -220
- package/themes/original/src/components/Promotions/styles.tsx +10 -3
- package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
- package/themes/original/src/components/ReviewOrder/index.tsx +43 -11
- package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
- package/themes/original/src/components/ReviewProducts/index.tsx +8 -5
- package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
- package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
- package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
- package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
- package/themes/original/src/components/ServiceForm/index.tsx +377 -270
- package/themes/original/src/components/Sessions/index.tsx +11 -8
- package/themes/original/src/components/Sessions/styles.tsx +5 -0
- package/themes/original/src/components/SignupForm/index.tsx +79 -66
- package/themes/original/src/components/SingleOrderCard/index.tsx +126 -57
- package/themes/original/src/components/SingleOrderCard/styles.tsx +10 -8
- package/themes/original/src/components/SingleProductCard/index.tsx +111 -49
- package/themes/original/src/components/SingleProductCard/styles.tsx +27 -13
- package/themes/original/src/components/SingleProductReview/index.tsx +38 -5
- package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
- package/themes/original/src/components/StripeCardsList/index.tsx +1 -1
- package/themes/original/src/components/StripeElementsForm/index.tsx +4 -1
- package/themes/original/src/components/UpsellingProducts/index.tsx +238 -218
- package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
- package/themes/original/src/components/UserDetails/index.tsx +8 -4
- package/themes/original/src/components/UserFormDetails/index.tsx +53 -54
- package/themes/original/src/components/UserProfile/index.tsx +58 -35
- package/themes/original/src/components/UserProfile/styles.ts +17 -0
- package/themes/original/src/components/UserProfileForm/index.tsx +21 -28
- package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
- package/themes/original/src/components/Wallets/index.tsx +20 -19
- package/themes/original/src/components/Wallets/styles.tsx +2 -0
- package/themes/original/src/components/shared/CardAnimation.tsx +47 -0
- package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
- package/themes/original/src/components/shared/OBottomPopup.tsx +1 -1
- package/themes/original/src/components/shared/OButton.tsx +6 -2
- package/themes/original/src/components/shared/OIcon.tsx +8 -1
- package/themes/original/src/components/shared/OInput.tsx +10 -1
- package/themes/original/src/components/shared/OModal.tsx +3 -3
- package/themes/original/src/layouts/Container.tsx +13 -9
- package/themes/original/src/types/index.tsx +45 -7
- package/themes/original/src/utils/index.tsx +359 -58
- package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { createClient, AnalyticsProvider } from '@segment/analytics-react-native';
|
|
3
|
-
import { useEvent, useConfig } from 'ordering-components/native';
|
|
3
|
+
import { useEvent, useConfig, useLanguage } from 'ordering-components/native';
|
|
4
4
|
|
|
5
5
|
export const AnalyticsSegment = (props: any) => {
|
|
6
6
|
const { children } = props
|
|
7
7
|
|
|
8
8
|
const [events] = useEvent()
|
|
9
9
|
const [configState] = useConfig()
|
|
10
|
+
const [, t] = useLanguage()
|
|
10
11
|
const [segmentClient, setSegmentClient] = useState<any>({})
|
|
11
12
|
|
|
13
|
+
const handleProductsSearched = (query: any) => {
|
|
14
|
+
segmentClient.track('Products Searched', {
|
|
15
|
+
query: query
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const handleProductListViewed = (category: any) => {
|
|
20
|
+
segmentClient.track('Product List Viewed', {
|
|
21
|
+
business_id: category?.business_id,
|
|
22
|
+
category_id: category?.id,
|
|
23
|
+
category: category?.name,
|
|
24
|
+
products: category?.products
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const handlePromotionViewed = (promotion: any) => {
|
|
29
|
+
segmentClient.track('Promotion Viewed', {
|
|
30
|
+
promotion_id: (promotion?.id || '').toString(),
|
|
31
|
+
name: promotion.name,
|
|
32
|
+
position: promotion.position
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const handlePromotionClicked = (promotion: any) => {
|
|
37
|
+
segmentClient.track('Promotion Clicked', {
|
|
38
|
+
promotion_id: (promotion?.id || '').toString(),
|
|
39
|
+
name: promotion.name,
|
|
40
|
+
position: promotion.position
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
12
44
|
const handleClickProduct = (product: any) => {
|
|
13
45
|
segmentClient.track('Product Clicked', {
|
|
14
46
|
id: product.id,
|
|
@@ -18,6 +50,15 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
18
50
|
})
|
|
19
51
|
}
|
|
20
52
|
|
|
53
|
+
const handleProductViewed = (product: any) => {
|
|
54
|
+
segmentClient.track('Product Viewed', {
|
|
55
|
+
id: product.id,
|
|
56
|
+
name: product.name,
|
|
57
|
+
category: product.category_id,
|
|
58
|
+
price: product.price
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
21
62
|
const handleProductAdded = (product: any) => {
|
|
22
63
|
segmentClient.track('Product Added', {
|
|
23
64
|
id: product.id,
|
|
@@ -38,6 +79,23 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
38
79
|
})
|
|
39
80
|
}
|
|
40
81
|
|
|
82
|
+
const handleCartViewed = (cart: any) => {
|
|
83
|
+
segmentClient.track('Cart Viewed', {
|
|
84
|
+
id: cart.uuid,
|
|
85
|
+
products: cart?.products
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const handleCheckoutStarted = (cart: any) => {
|
|
90
|
+
segmentClient.track('Checkout Started', {
|
|
91
|
+
cart_id: cart?.uuid,
|
|
92
|
+
affiliation: cart?.business?.name,
|
|
93
|
+
revenue: cart?.total,
|
|
94
|
+
tax: cart?.tax_total,
|
|
95
|
+
shipping: cart?.delivery_zone_price
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
41
99
|
const handleOrderPlaced = (order: any) => {
|
|
42
100
|
segmentClient.track('Order Placed', {
|
|
43
101
|
id: order.id,
|
|
@@ -65,6 +123,35 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
65
123
|
tax: order.tax_total,
|
|
66
124
|
shipping: order.delivery_zone_price
|
|
67
125
|
})
|
|
126
|
+
|
|
127
|
+
if (order?.history?.length) {
|
|
128
|
+
const lasthistory = order.history[order.history.length - 1]
|
|
129
|
+
if (lasthistory?.data) {
|
|
130
|
+
lasthistory.data.forEach(item => {
|
|
131
|
+
if (item.attribute === 'status') {
|
|
132
|
+
if (item.new === 15) {
|
|
133
|
+
segmentClient.track('Order Completed', {
|
|
134
|
+
id: order.id,
|
|
135
|
+
affiliation: order.business?.name,
|
|
136
|
+
revenue: order.total,
|
|
137
|
+
tax: order.tax_total,
|
|
138
|
+
shipping: order.delivery_zone_price
|
|
139
|
+
})
|
|
140
|
+
}
|
|
141
|
+
const orderCancelled = [2, 5, 6, 10, 12, 16, 17]
|
|
142
|
+
if (orderCancelled.includes(item.new)) {
|
|
143
|
+
segmentClient.track('Order Cancelled', {
|
|
144
|
+
id: order.id,
|
|
145
|
+
affiliation: order.business?.name,
|
|
146
|
+
revenue: order.total,
|
|
147
|
+
tax: order.tax_total,
|
|
148
|
+
shipping: order.delivery_zone_price
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
}
|
|
68
155
|
}
|
|
69
156
|
|
|
70
157
|
const handleAddOrder = (order: any) => {
|
|
@@ -77,6 +164,51 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
77
164
|
})
|
|
78
165
|
}
|
|
79
166
|
|
|
167
|
+
const handleCouponEntered = (cart: any) => {
|
|
168
|
+
segmentClient.track('Coupon Entered', {
|
|
169
|
+
cart_id: cart.uuid,
|
|
170
|
+
coupon: cart.coupon
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const handleCouponApplied = (cart: any) => {
|
|
175
|
+
const coupon: any = cart?.offers?.find(offer => offer.type === 2)
|
|
176
|
+
if (coupon) {
|
|
177
|
+
segmentClient.track('Coupon Applied', {
|
|
178
|
+
cart_id: cart.uuid,
|
|
179
|
+
coupon_id: coupon.id,
|
|
180
|
+
coupon_name: coupon?.name,
|
|
181
|
+
discount: coupon?.summary?.discount
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const handleCouponDenied = (coupon: any) => {
|
|
187
|
+
segmentClient.track('Coupon Denied', {
|
|
188
|
+
business_id: coupon.business_id,
|
|
189
|
+
coupon: coupon.coupon,
|
|
190
|
+
user_id: coupon.user.id,
|
|
191
|
+
reason: typeof coupon.reason === 'string' ? t(coupon.reason) : t(coupon.reason[0])
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const handleCouponRemoved = (coupon: any) => {
|
|
196
|
+
segmentClient.track('Coupon Removed', {
|
|
197
|
+
business_id: coupon.business_id,
|
|
198
|
+
coupon_id: coupon.offer_id,
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const handleProductReviewed = (products: any) => {
|
|
203
|
+
products.forEach((product: any) => {
|
|
204
|
+
segmentClient.track('Product Reviewed', {
|
|
205
|
+
product_id: product.product_id,
|
|
206
|
+
review_body: product.comment,
|
|
207
|
+
rating: product.qualification
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
80
212
|
const handleLogin = (data: any) => {
|
|
81
213
|
segmentClient.identify(data.id, {
|
|
82
214
|
email: data.email,
|
|
@@ -86,23 +218,47 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
86
218
|
|
|
87
219
|
useEffect(() => {
|
|
88
220
|
if (segmentClient?.config?.writeKey) {
|
|
221
|
+
events.on('products_searched', handleProductsSearched)
|
|
222
|
+
events.on('product_list_viewed', handleProductListViewed)
|
|
223
|
+
events.on('promotion_viewed', handlePromotionViewed)
|
|
224
|
+
events.on('promotion_clicked', handlePromotionClicked)
|
|
89
225
|
events.on('product_clicked', handleClickProduct)
|
|
90
|
-
events.on('
|
|
226
|
+
events.on('product_viewed', handleProductViewed)
|
|
91
227
|
events.on('product_added', handleProductAdded)
|
|
92
|
-
events.on('
|
|
228
|
+
events.on('cart_product_removed', handleProductRemoved)
|
|
229
|
+
events.on('cart_viewed', handleCartViewed)
|
|
230
|
+
events.on('checkout_started', handleCheckoutStarted)
|
|
93
231
|
events.on('order_updated', handleUpdateOrder)
|
|
232
|
+
events.on('coupon_entered', handleCouponEntered)
|
|
233
|
+
events.on('offer_applied', handleCouponApplied)
|
|
234
|
+
events.on('offer_denied', handleCouponDenied)
|
|
235
|
+
events.on('offer_removed', handleCouponRemoved)
|
|
236
|
+
events.on('product_reviewed', handleProductReviewed)
|
|
237
|
+
events.on('userLogin', handleLogin)
|
|
238
|
+
events.on('order_placed', handleOrderPlaced)
|
|
94
239
|
events.on('order_added', handleAddOrder)
|
|
95
|
-
events.on('cart_product_removed', handleProductRemoved)
|
|
96
240
|
}
|
|
97
241
|
return () => {
|
|
98
242
|
if (segmentClient?.config?.writeKey) {
|
|
243
|
+
events.off('products_searched', handleProductsSearched)
|
|
244
|
+
events.off('product_list_viewed', handleProductListViewed)
|
|
245
|
+
events.off('promotion_viewed', handlePromotionViewed)
|
|
246
|
+
events.off('promotion_clicked', handlePromotionClicked)
|
|
99
247
|
events.off('product_clicked', handleClickProduct)
|
|
100
|
-
events.off('
|
|
248
|
+
events.off('product_viewed', handleProductViewed)
|
|
101
249
|
events.off('product_added', handleProductAdded)
|
|
102
|
-
events.off('
|
|
250
|
+
events.off('cart_product_removed', handleProductRemoved)
|
|
251
|
+
events.off('cart_viewed', handleCartViewed)
|
|
252
|
+
events.off('checkout_started', handleCheckoutStarted)
|
|
103
253
|
events.off('order_updated', handleUpdateOrder)
|
|
254
|
+
events.off('coupon_entered', handleCouponEntered)
|
|
255
|
+
events.off('offer_applied', handleCouponApplied)
|
|
256
|
+
events.off('offer_denied', handleCouponDenied)
|
|
257
|
+
events.off('offer_removed', handleCouponRemoved)
|
|
258
|
+
events.off('product_reviewed', handleProductReviewed)
|
|
259
|
+
events.off('userLogin', handleLogin)
|
|
260
|
+
events.off('order_placed', handleOrderPlaced)
|
|
104
261
|
events.off('order_added', handleAddOrder)
|
|
105
|
-
events.off('cart_product_removed', handleProductRemoved)
|
|
106
262
|
}
|
|
107
263
|
}
|
|
108
264
|
}, [segmentClient])
|
|
@@ -110,7 +266,7 @@ export const AnalyticsSegment = (props: any) => {
|
|
|
110
266
|
useEffect(() => {
|
|
111
267
|
if (configState?.configs?.segment_track_id?.value) {
|
|
112
268
|
const _segmentClient: any = createClient({
|
|
113
|
-
writeKey: configState?.configs?.segment_track_id?.value
|
|
269
|
+
writeKey: configState?.configs?.segment_track_id?.value,
|
|
114
270
|
});
|
|
115
271
|
setSegmentClient(_segmentClient)
|
|
116
272
|
}
|
|
@@ -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
|
|
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
|
|
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
|
|
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 =>
|
|
@@ -5,7 +5,7 @@ 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';
|
|
@@ -46,8 +46,16 @@ export const BusinessBasicInformation = (
|
|
|
46
46
|
const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
|
|
47
47
|
const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
|
|
48
48
|
const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
|
|
49
|
-
const isChewLayout = theme?.
|
|
50
|
-
const
|
|
49
|
+
const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
|
|
50
|
+
const hideLogo = theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
|
|
51
|
+
const hideDeliveryFee = theme?.business_view?.components?.header?.components?.business?.components?.fee?.hidden
|
|
52
|
+
const hideTime = theme?.business_view?.components?.header?.components?.business?.components?.time?.hidden
|
|
53
|
+
const hideReviews = theme?.business_view?.components?.header?.components?.business?.components?.reviews?.hidden
|
|
54
|
+
const hideReviewsPopup = theme?.business_view?.components?.header?.components?.reviews?.hidden
|
|
55
|
+
const hideDistance = theme?.business_view?.components?.header?.components?.business?.components?.distance?.hidden
|
|
56
|
+
const hideInfoIcon = theme?.business_view?.components?.header?.components?.business?.components?.business_info?.hidden
|
|
57
|
+
const hideCity = theme?.business_view?.components?.header?.components?.business?.components?.city?.hidden
|
|
58
|
+
const hideHeader = theme?.business_view?.components?.header?.hidden
|
|
51
59
|
|
|
52
60
|
const styles = StyleSheet.create({
|
|
53
61
|
businesInfoheaderStyle: {
|
|
@@ -57,12 +65,12 @@ export const BusinessBasicInformation = (
|
|
|
57
65
|
height: isChewLayout ? 170 : 260,
|
|
58
66
|
},
|
|
59
67
|
logoStyle: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
width: 72,
|
|
69
|
+
height: 72,
|
|
70
|
+
borderRadius: 7.6,
|
|
71
|
+
justifyContent: 'flex-start',
|
|
72
|
+
alignItems: 'flex-start'
|
|
73
|
+
},
|
|
66
74
|
businessInfo: {
|
|
67
75
|
paddingHorizontal: 40,
|
|
68
76
|
paddingTop: isChewLayout ? 0 : 56,
|
|
@@ -249,9 +257,13 @@ export const BusinessBasicInformation = (
|
|
|
249
257
|
iconTitle='snapchat'
|
|
250
258
|
/>
|
|
251
259
|
)}
|
|
252
|
-
{isChewLayout && (
|
|
260
|
+
{isChewLayout && !hideInfoIcon && (
|
|
253
261
|
<TouchableOpacity onPress={() => handleClickBusinessInformation()}>
|
|
254
|
-
<OText
|
|
262
|
+
<OText
|
|
263
|
+
color={theme.colors.primary}
|
|
264
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
265
|
+
size={12}
|
|
266
|
+
>
|
|
255
267
|
{t('SEE_MORE_DESCRIPTION', 'See more')}
|
|
256
268
|
</OText>
|
|
257
269
|
</TouchableOpacity>
|
|
@@ -263,53 +275,63 @@ export const BusinessBasicInformation = (
|
|
|
263
275
|
}
|
|
264
276
|
|
|
265
277
|
return (
|
|
266
|
-
<BusinessContainer isChewLayout={isChewLayout &&
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
{business?.city?.name}
|
|
278
|
+
<BusinessContainer isChewLayout={isChewLayout && hideLogo}>
|
|
279
|
+
{!hideHeader && (
|
|
280
|
+
<BusinessHeader
|
|
281
|
+
isChewLayout={isChewLayout}
|
|
282
|
+
style={
|
|
283
|
+
isBusinessInfoShow
|
|
284
|
+
? styles.businesInfoheaderStyle
|
|
285
|
+
: { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
|
|
286
|
+
}
|
|
287
|
+
{...(!loading && {
|
|
288
|
+
source: (header || businessState?.business?.header) ? {
|
|
289
|
+
uri: optimizeImage(businessState?.business?.header, 'h_250,c_limit') || header
|
|
290
|
+
} : theme?.images?.dummies?.businessHeader
|
|
291
|
+
})}
|
|
292
|
+
imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
|
|
293
|
+
>
|
|
294
|
+
{!isBusinessInfoShow && !hideInfoIcon && !isChewLayout && (
|
|
295
|
+
<WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
|
|
296
|
+
<OIcon src={theme.images.general.info} width={24} />
|
|
297
|
+
</WrapBusinessInfo>
|
|
298
|
+
)}
|
|
299
|
+
{isChewLayout && !loading && (
|
|
300
|
+
<View style={styles.headerChewStyle}>
|
|
301
|
+
<OText size={24} weight={'600'} mBottom={-5}>
|
|
302
|
+
{business?.name}
|
|
292
303
|
</OText>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
304
|
+
{business?.city?.name && !hideCity && (
|
|
305
|
+
<OText>
|
|
306
|
+
{business?.city?.name}
|
|
307
|
+
</OText>
|
|
308
|
+
)}
|
|
309
|
+
<View style={styles.socialIconsChewContainer}>
|
|
310
|
+
<SocialIcons />
|
|
311
|
+
</View>
|
|
296
312
|
</View>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
313
|
+
)}
|
|
314
|
+
</BusinessHeader>
|
|
315
|
+
)}
|
|
300
316
|
<BusinessInfo style={styles.businessInfo}>
|
|
301
|
-
{
|
|
317
|
+
{!hideLogo && (
|
|
302
318
|
<BusinessLogo isChewLayout={isChewLayout}>
|
|
303
319
|
{!isBusinessInfoShow && (
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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
|
+
/>
|
|
313
335
|
)}
|
|
314
336
|
</BusinessLogo>
|
|
315
337
|
)}
|
|
@@ -329,13 +351,15 @@ export const BusinessBasicInformation = (
|
|
|
329
351
|
{business?.ribbon?.enabled && (
|
|
330
352
|
<RibbonBox
|
|
331
353
|
bgColor={business?.ribbon?.color}
|
|
354
|
+
colorText={lightenDarkenColor(business?.ribbon?.color)}
|
|
355
|
+
borderRibbon={lightenDarkenColor(business?.ribbon?.color)}
|
|
332
356
|
isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
|
|
333
357
|
isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
|
|
334
358
|
>
|
|
335
359
|
<OText
|
|
336
360
|
size={10}
|
|
337
361
|
weight={'400'}
|
|
338
|
-
color={theme.colors.white}
|
|
362
|
+
color={lightenDarkenColor(business?.ribbon?.color) ? theme.colors.black : theme.colors.white}
|
|
339
363
|
numberOfLines={2}
|
|
340
364
|
ellipsizeMode='tail'
|
|
341
365
|
lineHeight={13}
|
|
@@ -372,34 +396,43 @@ export const BusinessBasicInformation = (
|
|
|
372
396
|
</Placeholder>
|
|
373
397
|
)}
|
|
374
398
|
<View style={styles.bullet}>
|
|
375
|
-
|
|
376
|
-
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
377
|
-
</OText>
|
|
378
|
-
{orderState?.options?.type === 1 ? (
|
|
399
|
+
{!hideDeliveryFee && (
|
|
379
400
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
380
|
-
{
|
|
401
|
+
{`${t('DELIVERY_FEE', 'Delivery fee')} ${business && parsePrice(business?.delivery_price || 0)} \u2022 `}
|
|
381
402
|
</OText>
|
|
382
|
-
)
|
|
403
|
+
)}
|
|
404
|
+
{!hideTime && (
|
|
405
|
+
<>
|
|
406
|
+
{orderState?.options?.type === 1 ? (
|
|
407
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
408
|
+
{convertHoursToMinutes(business?.delivery_time) + ` \u2022 `}
|
|
409
|
+
</OText>
|
|
410
|
+
) : (
|
|
411
|
+
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
412
|
+
{convertHoursToMinutes(business?.pickup_time) + ` \u2022 `}
|
|
413
|
+
</OText>
|
|
414
|
+
)}
|
|
415
|
+
</>
|
|
416
|
+
)}
|
|
417
|
+
{!hideDistance && (
|
|
383
418
|
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
384
|
-
{
|
|
419
|
+
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
385
420
|
</OText>
|
|
386
421
|
)}
|
|
387
|
-
<OText color={theme.colors.textSecondary} size={12} style={styles.metadata}>
|
|
388
|
-
{parseDistance(business?.distance || 0) + ` \u2022 `}
|
|
389
|
-
</OText>
|
|
390
|
-
</View>
|
|
391
|
-
|
|
392
|
-
<View style={styles.reviewStyle}>
|
|
393
|
-
<OIcon
|
|
394
|
-
src={theme.images.general.star}
|
|
395
|
-
width={14}
|
|
396
|
-
color={theme.colors.textSecondary}
|
|
397
|
-
style={{ marginTop: -2, marginEnd: 2 }}
|
|
398
|
-
/>
|
|
399
|
-
<OText size={12} color={theme.colors.textSecondary}>
|
|
400
|
-
{business?.reviews?.total}
|
|
401
|
-
</OText>
|
|
402
422
|
</View>
|
|
423
|
+
{!hideReviews && (
|
|
424
|
+
<View style={styles.reviewStyle}>
|
|
425
|
+
<OIcon
|
|
426
|
+
src={theme.images.general.star}
|
|
427
|
+
width={14}
|
|
428
|
+
color={theme.colors.textSecondary}
|
|
429
|
+
style={{ marginTop: -2, marginEnd: 2 }}
|
|
430
|
+
/>
|
|
431
|
+
<OText size={12} color={theme.colors.textSecondary}>
|
|
432
|
+
{business?.reviews?.total}
|
|
433
|
+
</OText>
|
|
434
|
+
</View>
|
|
435
|
+
)}
|
|
403
436
|
</BusinessInfoItem>
|
|
404
437
|
</View>
|
|
405
438
|
<WrapReviews>
|
|
@@ -408,18 +441,28 @@ export const BusinessBasicInformation = (
|
|
|
408
441
|
{isPreOrder && (!business?.professionals || business?.professionals?.length === 0) && (
|
|
409
442
|
<>
|
|
410
443
|
<TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
|
|
411
|
-
<OText
|
|
444
|
+
<OText
|
|
445
|
+
color={theme.colors.primary}
|
|
446
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
447
|
+
size={12}
|
|
448
|
+
>
|
|
412
449
|
{t('PREORDER', 'Preorder')}
|
|
413
450
|
</OText>
|
|
414
451
|
</TouchableOpacity>
|
|
415
452
|
<OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
|
|
416
453
|
</>
|
|
417
454
|
)}
|
|
418
|
-
|
|
419
|
-
<
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
455
|
+
{!hideReviewsPopup && (
|
|
456
|
+
<TouchableOpacity onPress={() => handleClickBusinessReviews()}>
|
|
457
|
+
<OText
|
|
458
|
+
color={theme.colors.primary}
|
|
459
|
+
style={{ textDecorationColor: theme.colors.primary, textDecorationLine: 'underline' }}
|
|
460
|
+
size={12}
|
|
461
|
+
>
|
|
462
|
+
{t('REVIEWS', 'Reviews')}
|
|
463
|
+
</OText>
|
|
464
|
+
</TouchableOpacity>
|
|
465
|
+
)}
|
|
423
466
|
</>
|
|
424
467
|
)}
|
|
425
468
|
</WrapReviews>
|
|
@@ -44,13 +44,10 @@ export const WrapBusinessInfo = styled.TouchableOpacity`
|
|
|
44
44
|
|
|
45
45
|
export const TitleWrapper = styled.View`
|
|
46
46
|
width: 100%;
|
|
47
|
-
flex-direction:
|
|
48
|
-
align-items: center;
|
|
49
|
-
justify-content: space-between;
|
|
47
|
+
flex-direction: column;
|
|
50
48
|
`
|
|
51
49
|
|
|
52
50
|
export const RibbonBox = styled.View`
|
|
53
|
-
margin-left: 5px;
|
|
54
51
|
background-color: ${(props: any) => props.theme.colors.primary};
|
|
55
52
|
padding: 2px 8px;
|
|
56
53
|
max-width: 180px;
|
|
@@ -67,6 +64,14 @@ export const RibbonBox = styled.View`
|
|
|
67
64
|
${(props: any) => props.isCapsule && css`
|
|
68
65
|
border-radius: 50px;
|
|
69
66
|
`}
|
|
67
|
+
|
|
68
|
+
${(props: any) => props.colorText && css`
|
|
69
|
+
color: ${props.colorText ? 'black' : 'white'};
|
|
70
|
+
`}
|
|
71
|
+
|
|
72
|
+
${(props: any) => props.borderRibbon && css`
|
|
73
|
+
border: 1px solid ${props.borderRibbon ? 'black' : 'white'};
|
|
74
|
+
`}
|
|
70
75
|
`
|
|
71
76
|
|
|
72
77
|
export const SocialListWrapper = styled.ScrollView`
|