ordering-ui-react-native 0.14.83 → 0.14.85-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 (149) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +34 -2
  3. package/src/assets/images/no-network.png +0 -0
  4. package/src/components/BusinessTypeFilter/index.tsx +9 -2
  5. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Cart/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +0 -1
  9. package/src/components/Home/index.tsx +3 -5
  10. package/src/components/LanguageSelector/index.tsx +65 -97
  11. package/src/components/LanguageSelector/styles.tsx +4 -17
  12. package/src/components/Messages/index.tsx +38 -30
  13. package/src/components/MomentOption/index.tsx +3 -1
  14. package/src/components/OrderDetails/index.tsx +29 -6
  15. package/src/components/OrdersOption/index.tsx +4 -2
  16. package/src/components/PaymentOptions/index.tsx +7 -16
  17. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  18. package/src/components/ProductForm/index.tsx +1 -1
  19. package/src/components/ProductForm/styles.tsx +1 -0
  20. package/src/components/StripeElementsForm/index.tsx +27 -48
  21. package/src/components/UserProfileForm/index.tsx +35 -1
  22. package/src/components/VerifyPhone/styles.tsx +1 -2
  23. package/src/config.json +0 -2
  24. package/src/pages/Checkout.tsx +1 -1
  25. package/src/providers/AlertProvider.tsx +4 -1
  26. package/src/theme.json +2 -1
  27. package/src/types/index.tsx +2 -9
  28. package/src/utils/index.tsx +196 -1
  29. package/themes/business/index.tsx +4 -0
  30. package/themes/business/src/components/Chat/index.tsx +32 -31
  31. package/themes/business/src/components/NetworkError/index.tsx +61 -0
  32. package/themes/business/src/components/NetworkError/styles.tsx +11 -0
  33. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  35. package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
  36. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  37. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  38. package/themes/business/src/components/OrdersOption/index.tsx +354 -54
  39. package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
  40. package/themes/business/src/components/PreviousMessages/index.tsx +12 -0
  41. package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
  42. package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
  44. package/themes/business/src/types/index.tsx +4 -0
  45. package/themes/business/src/utils/index.tsx +12 -0
  46. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  47. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  48. package/themes/doordash/src/components/OrderDetails/index.tsx +3 -1
  49. package/themes/doordash/src/components/OrdersOption/index.tsx +4 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/instacart/src/components/OrderDetails/index.tsx +3 -1
  52. package/themes/instacart/src/components/OrdersOption/index.tsx +4 -2
  53. package/themes/kiosk/index.tsx +2 -0
  54. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  55. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  57. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  58. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  59. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  60. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  61. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  62. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  63. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  64. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  65. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  66. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  67. package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
  68. package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  71. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  73. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  74. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  75. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  76. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  77. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  78. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  79. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  80. package/themes/kiosk/src/types/index.d.ts +4 -0
  81. package/themes/original/index.tsx +26 -6
  82. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  83. package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
  84. package/themes/original/src/components/BusinessController/index.tsx +2 -2
  85. package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +3 -2
  87. package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
  88. package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
  90. package/themes/original/src/components/BusinessesListing/index.tsx +20 -11
  91. package/themes/original/src/components/Cart/index.tsx +43 -10
  92. package/themes/original/src/components/Checkout/index.tsx +54 -17
  93. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  94. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  95. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  96. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
  98. package/themes/original/src/components/LastOrder/index.tsx +3 -1
  99. package/themes/original/src/components/LoginForm/index.tsx +83 -68
  100. package/themes/original/src/components/MessageListing/index.tsx +4 -2
  101. package/themes/original/src/components/Messages/index.tsx +19 -21
  102. package/themes/original/src/components/MomentOption/index.tsx +127 -152
  103. package/themes/original/src/components/MomentOption/styles.tsx +42 -18
  104. package/themes/original/src/components/NetworkError/index.tsx +61 -0
  105. package/themes/original/src/components/NetworkError/styles.tsx +11 -0
  106. package/themes/original/src/components/OrderDetails/index.tsx +106 -113
  107. package/themes/original/src/components/OrderProgress/index.tsx +6 -5
  108. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  109. package/themes/original/src/components/OrdersOption/index.tsx +20 -42
  110. package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
  111. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
  112. package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
  113. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  114. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  115. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  116. package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
  117. package/themes/original/src/components/ProductForm/index.tsx +35 -20
  118. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  119. package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
  120. package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
  121. package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
  122. package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
  123. package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
  124. package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
  125. package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
  126. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  127. package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
  128. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
  129. package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
  130. package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
  131. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  132. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  133. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  134. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  135. package/themes/original/src/components/UserProfile/index.tsx +13 -6
  136. package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
  137. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  138. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  139. package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
  140. package/themes/original/src/types/index.tsx +47 -10
  141. package/themes/single-business/src/components/LastOrder/index.tsx +3 -1
  142. package/themes/single-business/src/components/OrderDetails/index.tsx +15 -0
  143. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  144. package/themes/single-business/src/components/OrdersOption/index.tsx +4 -2
  145. package/themes/single-business/src/utils/index.tsx +7 -1
  146. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  147. package/themes/uber-eats/src/components/OrderDetails/index.tsx +3 -1
  148. package/themes/uber-eats/src/components/OrdersOption/index.tsx +4 -2
  149. package/src/components/StripeMethodForm/index.tsx +0 -163
@@ -1,110 +1,144 @@
1
1
  import React from 'react';
2
- import { TextStyle, ViewStyle, Platform } from 'react-native';
2
+ import { TextStyle, ImageBackground, StyleSheet } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
+ import FastImage from 'react-native-fast-image'
4
5
 
5
- import styled from 'styled-components/native';
6
- import OImage from './OImage';
6
+ import styled, { css } from 'styled-components/native';
7
7
  import OText from './OText';
8
8
 
9
9
  const CardContainer = styled.TouchableOpacity`
10
- width: 21%;
11
- margin: 10px 20px;
12
- overflow: hidden;
10
+ position: relative;
11
+ flex-direction: column;
12
+ border-radius: 10px;
13
+ position: relative;
14
+ margin: 0 30px 30px 0;
15
+ align-self: flex-start;
13
16
  `
14
17
 
15
- const CardBody = styled.View`
16
- padding: 4%;
18
+ const WrapPrice = styled.View`
19
+ display: flex;
20
+ flex-direction: row;
21
+ align-items: center;
22
+ margin-top: 10px;
17
23
  `
18
24
 
19
- const CardBadge = styled.Text`
20
- padding: 2% 4%;
21
- position: absolute;
22
- background-color: ${(props: any) => props.theme.theme.colors.primary};
23
- z-index: 100;
24
- border-radius: 5px;
25
- color: #fff;
26
- font-weight: bold;
27
- margin: 10px 0;
25
+ const WrapImage = styled.View`
26
+ width: 100%;
27
+ height: 120px;
28
+ `
29
+
30
+ const WrapContent = styled.View`
31
+ display: flex;
32
+ flex-direction: column;
33
+ ${(props: any) => props.isCentered && css`
34
+ align-items: center;
35
+ `}
28
36
  `
29
37
 
30
38
  const OCard = (props: Props): React.ReactElement => {
31
39
  const theme = useTheme()
32
40
 
41
+ const styles = StyleSheet.create({
42
+ textStyle: {
43
+ marginTop: 10
44
+ },
45
+ image: {
46
+ width: '100%',
47
+ height: '100%',
48
+ borderBottomLeftRadius: 0,
49
+ borderBottomRightRadius: 0,
50
+ }
51
+ })
52
+
33
53
  return (
34
54
  <CardContainer
35
- style={{...props.style}}
36
- onPress={props?.onPress}
37
- disabled={!props?.onPress}
38
- activeOpacity={1}
39
- >
40
- {props?.badgeText && (
41
- <CardBadge>
42
- {props?.badgeText}
43
- </CardBadge>
44
- )}
45
- <OImage
46
- source={props.image}
47
- height={120}
48
- resizeMode="cover"
49
- borderRadius={16}
50
- />
51
- <CardBody>
52
- <OText
53
- mLeft={0}
54
- size={18}
55
- numberOfLines={2}
56
- mBottom={8}
57
- style={{...props?.titleStyle}}
58
- >
59
- {props.title}
60
- </OText>
61
-
62
- {props?.description && (
63
- <OText
64
- color={theme.colors.mediumGray}
65
- numberOfLines={3}
66
- mBottom={8}
67
- style={{...props?.descriptionStyle}}
68
- >
69
- {props.description}
70
- </OText>
55
+ activeOpacity={1}
56
+ style={props.style}
57
+ onPress={props?.onPress}
58
+ disabled={!props?.onPress}
59
+ >
60
+ <WrapImage>
61
+ {props.isUri ? (
62
+ <FastImage
63
+ style={[styles.image, props.style]}
64
+ source={{
65
+ uri: props.image?.uri,
66
+ priority: FastImage.priority.normal,
67
+ // cache:FastImage.cacheControl.web
68
+ }}
69
+ resizeMode={FastImage.resizeMode.cover}
70
+ />
71
+ ) : (
72
+ <ImageBackground
73
+ style={[styles.image, props.style]}
74
+ source={props.image}
75
+ imageStyle={{
76
+ borderBottomLeftRadius: 0,
77
+ borderBottomRightRadius: 0,
78
+ borderRadius: 10
79
+ }}
80
+ resizeMode='cover'
81
+ />
71
82
  )}
72
-
73
- {props?.price && (
74
- <OText>
75
- <OText
76
- color={theme.colors.primary}
77
- weight="bold"
78
- >
79
- {props.price}
80
- </OText>
81
-
82
- <OText
83
- color={theme.colors.mediumGray}
84
- size={12}
85
- style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}
86
- >
87
- {props?.prevPrice ? ` ${props?.prevPrice} ` : ''}
88
- </OText>
89
- </OText>
90
- )}
91
-
92
- </CardBody>
93
- </CardContainer>
94
- );
83
+ </WrapImage>
84
+ <WrapContent isCentered={props.isCentered}>
85
+ <OText
86
+ size={18}
87
+ numberOfLines={1}
88
+ ellipsizeMode='tail'
89
+ style={styles.textStyle}
90
+ >
91
+ {props.title}
92
+ </OText>
93
+ {!!props?.description && (
94
+ <OText
95
+ color={theme.colors.mediumGray}
96
+ size={18}
97
+ numberOfLines={3}
98
+ ellipsizeMode='tail'
99
+ style={styles.textStyle}
100
+ >
101
+ {props?.description}
102
+ </OText>
103
+ )}
104
+ <WrapPrice>
105
+ <OText
106
+ size={18}
107
+ >
108
+ {props.price}
109
+ </OText>
110
+ {props?.prevPrice && (
111
+ <OText
112
+ size={18}
113
+ color={theme.colors.mediumGray}
114
+ style={{
115
+ textDecorationLine: 'line-through',
116
+ textDecorationStyle: 'solid',
117
+ marginLeft: 20,
118
+ }}
119
+ >
120
+ {props?.prevPrice}
121
+ </OText>
122
+ )}
123
+ </WrapPrice>
124
+ </WrapContent>
125
+ </CardContainer>
126
+ )
95
127
  }
96
128
 
97
129
  interface Props {
98
130
  badgeText?: string;
131
+ isUri?: boolean;
99
132
  onPress?(): void;
100
- image: string | { uri: string };
133
+ image: any;
134
+ isCentered?: any;
101
135
  title: string;
102
136
  titleStyle?: TextStyle;
103
137
  description?: string;
104
138
  descriptionStyle?: TextStyle;
105
139
  price?: string;
106
140
  prevPrice?: string;
107
- style?: ViewStyle;
141
+ style?: any;
108
142
  }
109
143
 
110
144
  export default OCard;
@@ -473,3 +473,7 @@ export interface Cart {
473
473
  total: number;
474
474
  clearInactivityTimeout: any;
475
475
  }
476
+
477
+ export interface NoNetworkParams {
478
+ image?: any;
479
+ }
@@ -1,16 +1,21 @@
1
1
  import { AddressForm } from './src/components/AddressForm';
2
2
  import { AddressDetails } from './src/components/AddressDetails';
3
+ import { AnalyticsSegment } from './src/components/AnalyticsSegment';
3
4
  import { Home } from './src/components/Home';
4
5
  import { LoginForm } from './src/components/LoginForm';
5
6
  import { SignupForm } from './src/components/SignupForm';
6
7
  import { ActiveOrders } from './src/components/ActiveOrders';
7
8
  import { AddressList } from './src/components/AddressList';
8
9
  import { AppleLogin } from './src/components/AppleLogin';
10
+ import { BusinessBasicInformation } from './src/components/BusinessBasicInformation';
11
+ import { BusinessProductsCategories } from './src/components/BusinessProductsCategories';
12
+ import { BusinessProductsList } from './src/components/BusinessProductsList';
9
13
  import { BusinessesListing } from './src/components/BusinessesListing';
10
14
  import { BusinessProductsListing } from './src/components/BusinessProductsListing';
11
15
  import { CartContent } from './src/components/CartContent';
12
16
  import { BusinessCart } from './src/components/BusinessCart';
13
17
  import { Checkout } from './src/components/Checkout';
18
+ import { FloatingButton } from './src/components/FloatingButton';
14
19
  import { ForgotPasswordForm } from './src/components/ForgotPasswordForm';
15
20
  import { MomentOption } from './src/components/MomentOption';
16
21
  import { OrdersOption } from './src/components/OrdersOption';
@@ -20,14 +25,19 @@ import { BusinessPreorder } from './src/components/BusinessPreorder';
20
25
  import { BusinessMenuList } from './src/components/BusinessMenuList';
21
26
  import { UserProfileForm } from './src/components/UserProfileForm';
22
27
  import { ReviewOrder } from './src/components/ReviewOrder';
28
+ import { ReviewProducts } from './src/components/ReviewProducts';
29
+ import { ReviewDriver } from './src/components/ReviewDriver';
23
30
  import { UserProfile } from './src/components/UserProfile';
24
31
  import { MessageListing } from './src/components/MessageListing';
32
+ import { Messages } from './src/components/Messages';
25
33
  import { Help } from './src/components/Help';
26
34
  import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
27
35
  import { HelpGuide } from './src/components/HelpGuide';
28
36
  import { HelpOrder } from './src/components/HelpOrder';
37
+ import { NetworkError } from './src/components/NetworkError';
29
38
  import { NotFoundSource } from './src/components/NotFoundSource';
30
39
  import { OrderTypeSelector } from './src/components/OrderTypeSelector';
40
+ import { SearchBar } from './src/components/SearchBar';
31
41
  import { Wallets } from './src/components/Wallets';
32
42
  import { PaymentOptionWallet } from './src/components/PaymentOptionWallet';
33
43
  import { ProductForm } from './src/components/ProductForm';
@@ -63,6 +73,7 @@ import {
63
73
  export {
64
74
  AddressForm,
65
75
  AddressDetails,
76
+ AnalyticsSegment,
66
77
  Home as HomeView,
67
78
  SignupForm,
68
79
  LoginForm,
@@ -72,7 +83,7 @@ export {
72
83
  BusinessesListing,
73
84
  BusinessProductsListing,
74
85
  CartContent,
75
- BusinessCart,
86
+ BusinessCart,
76
87
  Checkout,
77
88
  ForgotPasswordForm,
78
89
  MomentOption,
@@ -82,20 +93,29 @@ export {
82
93
  BusinessPreorder,
83
94
  UserProfileForm,
84
95
  ReviewOrder,
96
+ ReviewProducts,
97
+ ReviewDriver,
85
98
  BusinessMenuList,
86
99
  UserProfile,
87
100
  MessageListing,
101
+ Messages,
88
102
  Help,
89
103
  HelpAccountAndPayment,
90
104
  HelpGuide,
91
105
  HelpOrder,
106
+ NetworkError,
92
107
  NotFoundSource,
93
108
  OrderTypeSelector,
94
- Wallets,
95
- PaymentOptionWallet,
96
- ProductForm,
97
- UpsellingProducts,
98
- UserVerification,
109
+ Wallets,
110
+ PaymentOptionWallet,
111
+ ProductForm,
112
+ UpsellingProducts,
113
+ UserVerification,
114
+ BusinessBasicInformation,
115
+ BusinessProductsCategories,
116
+ BusinessProductsList,
117
+ FloatingButton,
118
+ SearchBar,
99
119
 
100
120
  // OComponents
101
121
  Toast,
@@ -0,0 +1,127 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { createClient, AnalyticsProvider } from '@segment/analytics-react-native';
3
+ import { useEvent, useConfig } from 'ordering-components/native';
4
+
5
+ export const AnalyticsSegment = (props: any) => {
6
+ const { children } = props
7
+
8
+ const [events] = useEvent()
9
+ const [configState] = useConfig()
10
+ const [segmentClient, setSegmentClient] = useState<any>({})
11
+
12
+ const handleClickProduct = (product: any) => {
13
+ segmentClient.track('Product Clicked', {
14
+ id: product.id,
15
+ name: product.name,
16
+ category: product.category_id,
17
+ price: product.price
18
+ })
19
+ }
20
+
21
+ const handleProductAdded = (product: any) => {
22
+ segmentClient.track('Product Added', {
23
+ id: product.id,
24
+ name: product.name,
25
+ category: product.category_id,
26
+ price: product.price,
27
+ quantity: product.quantity
28
+ })
29
+ }
30
+
31
+ const handleProductRemoved = (product: any) => {
32
+ segmentClient.track('Product Removed', {
33
+ id: product.id,
34
+ name: product.name,
35
+ category: product.category_id,
36
+ price: product.price,
37
+ quantity: product.quantity
38
+ })
39
+ }
40
+
41
+ const handleOrderPlaced = (order: any) => {
42
+ segmentClient.track('Order Placed', {
43
+ id: order.id,
44
+ affiliation: order.business?.name,
45
+ revenue: order.total,
46
+ tax: order.tax_total,
47
+ shipping: order.delivery_zone_price
48
+ })
49
+ segmentClient.track('Payment Info Entered', {
50
+ order: order.id,
51
+ business: order.business?.name,
52
+ business_id: order.business_id,
53
+ total: order.total,
54
+ tax: order.tax_total,
55
+ delivery: order.delivery_zone_price,
56
+ paymethod: order.paymethod
57
+ })
58
+ }
59
+
60
+ const handleUpdateOrder = (order: any) => {
61
+ segmentClient.track('Order Updated', {
62
+ id: order.id,
63
+ affiliation: order.business?.name,
64
+ revenue: order.total,
65
+ tax: order.tax_total,
66
+ shipping: order.delivery_zone_price
67
+ })
68
+ }
69
+
70
+ const handleAddOrder = (order: any) => {
71
+ segmentClient.track('Order Added', {
72
+ id: order.id,
73
+ affiliation: order.business?.name,
74
+ revenue: order.total,
75
+ tax: order.tax_total,
76
+ shipping: order.delivery_zone_price
77
+ })
78
+ }
79
+
80
+ const handleLogin = (data: any) => {
81
+ segmentClient.identify(data.id, {
82
+ email: data.email,
83
+ name: data.name
84
+ })
85
+ }
86
+
87
+ useEffect(() => {
88
+ if (segmentClient?.config?.writeKey) {
89
+ events.on('product_clicked', handleClickProduct)
90
+ events.on('userLogin', handleLogin)
91
+ events.on('product_added', handleProductAdded)
92
+ events.on('order_placed', handleOrderPlaced)
93
+ events.on('order_updated', handleUpdateOrder)
94
+ events.on('order_added', handleAddOrder)
95
+ events.on('cart_product_removed', handleProductRemoved)
96
+ }
97
+ return () => {
98
+ if (segmentClient?.config?.writeKey) {
99
+ events.off('product_clicked', handleClickProduct)
100
+ events.off('userLogin', handleLogin)
101
+ events.off('product_added', handleProductAdded)
102
+ events.off('order_placed', handleOrderPlaced)
103
+ events.off('order_updated', handleUpdateOrder)
104
+ events.off('order_added', handleAddOrder)
105
+ events.off('cart_product_removed', handleProductRemoved)
106
+ }
107
+ }
108
+ }, [segmentClient])
109
+
110
+ useEffect(() => {
111
+ if (configState?.configs?.segment_track_id?.value) {
112
+ const _segmentClient: any = createClient({
113
+ writeKey: configState?.configs?.segment_track_id?.value
114
+ });
115
+ setSegmentClient(_segmentClient)
116
+ }
117
+ }, [configState])
118
+
119
+ return (
120
+ <>
121
+ <AnalyticsProvider client={segmentClient}>
122
+ {children}
123
+ </AnalyticsProvider>
124
+ </>
125
+
126
+ )
127
+ }
@@ -29,7 +29,7 @@ const types = ['food', 'laundry', 'alcohol', 'groceries'];
29
29
  export const BusinessBasicInformation = (
30
30
  props: BusinessBasicInformationParams,
31
31
  ) => {
32
- const { navigation, businessState, isBusinessInfoShow, logo, header } = props;
32
+ const { navigation, businessState, isBusinessInfoShow, logo, header, isPreOrder } = props;
33
33
  const { business, loading } = businessState;
34
34
 
35
35
  const theme = useTheme();
@@ -181,12 +181,16 @@ export const BusinessBasicInformation = (
181
181
  <WrapReviews>
182
182
  {!isBusinessInfoShow && (
183
183
  <>
184
- <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
185
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
186
- {t('PRE_ORDER', 'Preorder')}
187
- </OText>
188
- </TouchableOpacity>
189
- <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
184
+ { isPreOrder && (
185
+ <>
186
+ <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
187
+ <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
188
+ {t('PRE_ORDER', 'Preorder')}
189
+ </OText>
190
+ </TouchableOpacity>
191
+ <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
192
+ </>
193
+ )}
190
194
  <TouchableOpacity onPress={() => setOpenBusinessReviews(true)}>
191
195
  <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
192
196
  {t('REVIEWS', 'Reviews')}
@@ -111,7 +111,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
111
111
  <FastImage
112
112
  style={{ height: 120 }}
113
113
  source={{
114
- uri: optimizeImage(business?.header, 'h_120,c_limit'),
114
+ uri: optimizeImage(business?.header, 'h_500,c_limit'),
115
115
  priority: FastImage.priority.normal,
116
116
  }}
117
117
  resizeMode={FastImage.resizeMode.cover}
@@ -140,7 +140,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
140
140
  <FastImage
141
141
  style={{ width: 56, height: 56 }}
142
142
  source={{
143
- uri: optimizeImage(business?.logo, 'h_60,c_limit'),
143
+ uri: optimizeImage(business?.logo, 'h_150,c_limit'),
144
144
  priority: FastImage.priority.normal,
145
145
  }}
146
146
  resizeMode={FastImage.resizeMode.cover}
@@ -7,6 +7,7 @@ import { useTheme } from 'styled-components/native'
7
7
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
8
8
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
9
9
  import SelectDropdown from 'react-native-select-dropdown'
10
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
11
 
11
12
  const windowHeight = Dimensions.get('window').height;
12
13
 
@@ -18,6 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
18
19
 
19
20
  const [, t] = useLanguage()
20
21
  const theme = useTheme()
22
+ const {top} = useSafeAreaInsets()
21
23
 
22
24
  const styles = StyleSheet.create({
23
25
  container: {
@@ -81,7 +83,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
81
83
  dropdownStyle={{
82
84
  borderRadius: 8,
83
85
  borderColor: theme.colors.lightGray,
84
- marginTop: Platform.OS === 'ios' ? 12 : -15,
86
+ marginTop: Platform.OS === 'ios' ? 12 : -top,
85
87
  maxHeight: 160
86
88
  }}
87
89
  rowStyle={{
@@ -123,4 +125,4 @@ export const BusinessMenuList = (props: any) => {
123
125
  };
124
126
 
125
127
  return <BusinessMenuListing {...businessMenuListProps} />;
126
- };
128
+ };
@@ -21,6 +21,7 @@ import {
21
21
  TimeContentWrapper,
22
22
  TimeItem
23
23
  } from './styles'
24
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
24
25
 
25
26
  const windowHeight = Dimensions.get('window').height;
26
27
 
@@ -50,7 +51,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
50
51
  const [selectDate, setSelectedDate] = useState<any>(null)
51
52
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
52
53
  const [isEnabled, setIsEnabled] = useState(false)
53
-
54
+ const {top} = useSafeAreaInsets()
54
55
  const styles = StyleSheet.create({
55
56
  container: {
56
57
  height: windowHeight,
@@ -333,7 +334,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
333
334
  dropdownStyle={{
334
335
  borderRadius: 8,
335
336
  borderColor: theme.colors.lightGray,
336
- marginTop: Platform.OS === 'ios' ? 12 : -15
337
+ marginTop: Platform.OS === 'ios' ? 12 : -top
337
338
  }}
338
339
  rowStyle={{
339
340
  borderBottomColor: theme.colors.backgroundGray100,
@@ -1,13 +1,14 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { ProductsList, useLanguage, useUtils, useConfig } from 'ordering-components/native';
3
3
  import { SingleProductCard } from '../SingleProductCard';
4
4
  import { NotFoundSource } from '../NotFoundSource';
5
5
  import { BusinessProductsListParams } from '../../types';
6
- import { OIcon, OText } from '../shared';
6
+ import { OButton, OIcon, OModal, OText } from '../shared';
7
7
  import { ProductsContainer, ErrorMessage, WrapperNotFound } from './styles';
8
8
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
9
9
  import { View } from 'react-native';
10
10
  import { StyleSheet } from 'react-native';
11
+ import { useTheme } from 'styled-components/native';
11
12
 
12
13
  const BusinessProductsListUI = (props: BusinessProductsListParams) => {
13
14
  const {
@@ -32,8 +33,9 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
32
33
  const [, t] = useLanguage();
33
34
  const [{ optimizeImage }] = useUtils()
34
35
  const [{ configs }] = useConfig()
36
+ const theme = useTheme()
35
37
  const isUseParentCategory = configs?.use_parent_category?.value === 'true' || configs?.use_parent_category?.value === '1'
36
-
38
+ const [openDescription, setOpenDescription] = useState<any>(null)
37
39
  const handleOnLayout = (event: any, categoryId: any) => {
38
40
  const _categoriesLayout = { ...categoriesLayout }
39
41
  const categoryKey = 'cat_' + categoryId
@@ -84,8 +86,11 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
84
86
 
85
87
  {!category?.id && categories.filter(category => category?.id !== null).map((category, i, _categories) => {
86
88
  const products = !isUseParentCategory
87
- ? categoryState?.products?.filter((product : any) => product?.category_id === category?.id) ?? []
88
- : categoryState?.products?.filter((product : any) => category?.children?.some((cat : any) => cat.category_id === product?.category_id)) ?? []
89
+ ? categoryState?.products?.filter((product: any) => product?.category_id === category?.id) ?? []
90
+ : categoryState?.products?.filter((product: any) => category?.children?.some((cat: any) => cat.category_id === product?.category_id)) ?? []
91
+
92
+ const shortCategoryDescription = category?.description?.length > 80 ? `${category?.description?.substring(0, 80)}...` : category?.description
93
+
89
94
  return (
90
95
  <React.Fragment key={'cat_' + category.id}>
91
96
  {products.length > 0 && (
@@ -96,7 +101,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
96
101
  >
97
102
  <View style={bpStyles.catIcon}>
98
103
  <OIcon
99
- url={optimizeImage(category.image, 'h_100,c_limit')}
104
+ url={optimizeImage(category.image, 'h_250,c_limit')}
100
105
  width={41}
101
106
  height={41}
102
107
  style={{ borderRadius: 7.6 }}
@@ -106,6 +111,28 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
106
111
  {category.name}
107
112
  </OText>
108
113
  </View>
114
+ {!!category?.description && (
115
+ <View style={{ position: 'relative' }}>
116
+ <OText size={12} weight={'500'} mBottom={5}>
117
+ {shortCategoryDescription}
118
+ {category?.description?.length > 80 && (
119
+ <OButton
120
+ style={{ height: 15, paddingRight: 0, paddingLeft: 0, borderWidth: 0 }}
121
+ text={t('SEE_MORE', 'See more')}
122
+ parentStyle={{ padding: 0 }}
123
+ onClick={() => setOpenDescription(category)}
124
+ bgColor='transparent'
125
+ textStyle={{
126
+ fontSize: 12,
127
+ borderBottomWidth: 1,
128
+ borderBottomColor: theme.colors.primary,
129
+ color: theme.colors.primary
130
+ }}
131
+ />
132
+ )}
133
+ </OText>
134
+ </View>
135
+ )}
109
136
  <>
110
137
  {products.sort((a: any, b: any) => a.rank - b.rank).map((product: any, i: any) => (
111
138
  <SingleProductCard
@@ -188,6 +215,23 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
188
215
  <OText>{e}</OText>
189
216
  </ErrorMessage>
190
217
  ))}
218
+ <OModal
219
+ open={!!openDescription}
220
+ title={openDescription?.name}
221
+ onClose={() => setOpenDescription(null)}
222
+ >
223
+ <View style={{ padding: 20 }}>
224
+ {!!openDescription?.image && (
225
+ <OIcon
226
+ url={optimizeImage(openDescription?.image, 'h_100,c_limit')}
227
+ width={240}
228
+ height={240}
229
+ style={{ borderRadius: 7.6 }}
230
+ />
231
+ )}
232
+ <OText>{openDescription?.description}</OText>
233
+ </View>
234
+ </OModal>
191
235
  </ProductsContainer>
192
236
  );
193
237
  };