ordering-ui-react-native 0.21.31-testing → 0.21.32-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 (215) hide show
  1. package/package.json +7 -6
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +4 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +9 -2
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +23 -14
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  21. package/themes/business/src/components/Home/index.tsx +5 -1
  22. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  23. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  24. package/themes/business/src/components/MapView/index.tsx +16 -9
  25. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  26. package/themes/business/src/components/NewOrderNotification/index.tsx +163 -115
  27. package/themes/business/src/components/OrderDetails/Business.tsx +50 -2
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +23 -11
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +61 -54
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +52 -20
  31. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +6 -1
  33. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  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 +125 -130
  37. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +36 -38
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +18 -13
  40. package/themes/business/src/components/PreviousOrders/index.tsx +80 -66
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  42. package/themes/business/src/components/PrinterSettings/index.tsx +279 -0
  43. package/themes/business/src/components/PrinterSettings/styles.tsx +17 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  46. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  47. package/themes/business/src/components/Sessions/index.tsx +187 -0
  48. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  49. package/themes/business/src/components/StoresList/index.tsx +5 -3
  50. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  51. package/themes/business/src/components/UserProfileForm/index.tsx +107 -53
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OInput.tsx +2 -0
  55. package/themes/business/src/hooks/useLocation.tsx +5 -4
  56. package/themes/business/src/types/index.tsx +15 -2
  57. package/themes/business/src/utils/index.tsx +5 -0
  58. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  59. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  60. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  61. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  62. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -4
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +9 -4
  68. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  69. package/themes/original/src/components/AddressForm/index.tsx +27 -12
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +18 -4
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  78. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  79. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  82. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  85. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -3
  87. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  89. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  90. package/themes/original/src/components/BusinessProductsListing/index.tsx +35 -19
  91. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  92. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +24 -404
  99. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  101. package/themes/original/src/components/Cart/index.tsx +32 -9
  102. package/themes/original/src/components/CartContent/index.tsx +96 -58
  103. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  104. package/themes/original/src/components/Checkout/index.tsx +160 -63
  105. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  106. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  107. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  108. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  109. package/themes/original/src/components/Favorite/index.tsx +9 -9
  110. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  111. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  112. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  113. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  114. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  115. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  116. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  117. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  118. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +67 -4
  120. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  121. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  122. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  123. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  124. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  125. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  126. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  127. package/themes/original/src/components/GoogleMap/index.tsx +6 -5
  128. package/themes/original/src/components/Help/index.tsx +7 -0
  129. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  130. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  131. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  132. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  133. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  134. package/themes/original/src/components/Home/index.tsx +2 -1
  135. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  136. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  137. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  138. package/themes/original/src/components/LoginForm/index.tsx +8 -3
  139. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  140. package/themes/original/src/components/Messages/index.tsx +9 -7
  141. package/themes/original/src/components/Messages/styles.tsx +1 -1
  142. package/themes/original/src/components/MomentOption/index.tsx +19 -4
  143. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  144. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +1 -0
  145. package/themes/original/src/components/MultiCheckout/index.tsx +208 -21
  146. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  147. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  148. package/themes/original/src/components/MyOrders/index.tsx +28 -28
  149. package/themes/original/src/components/NavBar/index.tsx +5 -1
  150. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  151. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  152. package/themes/original/src/components/Notifications/index.tsx +9 -8
  153. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  154. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  155. package/themes/original/src/components/OrderDetails/index.tsx +709 -665
  156. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  157. package/themes/original/src/components/OrderProgress/index.tsx +24 -4
  158. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  159. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  160. package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
  161. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  162. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  163. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  164. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  166. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  167. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  168. package/themes/original/src/components/PaymentOptions/index.tsx +51 -6
  169. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  170. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  171. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  172. package/themes/original/src/components/ProductForm/index.tsx +67 -155
  173. package/themes/original/src/components/ProductItemAccordion/index.tsx +54 -44
  174. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  175. package/themes/original/src/components/ProductOptionSubOption/index.tsx +105 -91
  176. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  177. package/themes/original/src/components/Promotions/index.tsx +13 -11
  178. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  179. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  180. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  181. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  182. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  183. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  184. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  185. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  186. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  187. package/themes/original/src/components/Sessions/index.tsx +5 -0
  188. package/themes/original/src/components/SignupForm/index.tsx +66 -59
  189. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  190. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  191. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  192. package/themes/original/src/components/StripeCardsList/index.tsx +17 -36
  193. package/themes/original/src/components/StripeElementsForm/index.tsx +74 -59
  194. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  195. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  196. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  197. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  198. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  199. package/themes/original/src/components/UserFormDetails/index.tsx +123 -75
  200. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  201. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  202. package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
  203. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  204. package/themes/original/src/components/Wallets/index.tsx +8 -4
  205. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  206. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  207. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  208. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  209. package/themes/original/src/components/shared/OButton.tsx +5 -5
  210. package/themes/original/src/components/shared/OInput.tsx +1 -4
  211. package/themes/original/src/components/shared/OModal.tsx +12 -14
  212. package/themes/original/src/layouts/Container.tsx +5 -3
  213. package/themes/original/src/types/index.tsx +1 -0
  214. package/themes/original/src/utils/index.tsx +12 -1
  215. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,196 @@
1
+ import React, { useCallback } from 'react'
2
+ import { StyleSheet, View, TouchableOpacity } from 'react-native'
3
+ import { useTheme } from 'styled-components/native';
4
+ import { OIcon, OText } from '../shared';
5
+ import { NotFoundSource } from '../NotFoundSource';
6
+ import ToggleSwitch from 'toggle-switch-react-native';
7
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
8
+ import { SearchBar } from '../SearchBar';
9
+ import { IOScrollView } from 'react-native-intersection-observer';
10
+ import {
11
+ useLanguage,
12
+ useUtils,
13
+ ToastType,
14
+ useToast,
15
+ } from 'ordering-components/native'
16
+
17
+ const PIXELS_TO_SCROLL = 2000
18
+
19
+ export const ProductList = (props: any) => {
20
+ const { productsList, onClose, updateProduct, searchValue, handleChangeSearch, getCategoryProducts } = props
21
+
22
+ const { loading, products, error } = productsList
23
+
24
+ const theme = useTheme()
25
+ const [{ optimizeImage }] = useUtils();
26
+ const [, { showToast }] = useToast()
27
+ const [, t] = useLanguage()
28
+
29
+ const styles = StyleSheet.create({
30
+ container: {
31
+ flex: 1,
32
+ marginBottom: 0
33
+ },
34
+ header: {
35
+ flexDirection: 'row',
36
+ justifyContent: 'space-between',
37
+ marginBottom: 10,
38
+ },
39
+ btnBackArrow: {
40
+ borderWidth: 0,
41
+ width: 32,
42
+ height: 32,
43
+ tintColor: theme.colors.textGray,
44
+ backgroundColor: theme.colors.clear,
45
+ borderColor: theme.colors.clear,
46
+ shadowColor: theme.colors.clear,
47
+ paddingLeft: 0,
48
+ paddingRight: 0
49
+ },
50
+ sectionTitle: {
51
+ fontStyle: 'normal',
52
+ fontWeight: '600',
53
+ fontSize: 20,
54
+ color: theme.colors.textGray,
55
+ },
56
+ logo: {
57
+ padding: 2,
58
+ borderRadius: 18,
59
+ shadowColor: '#000',
60
+ shadowOffset: {
61
+ width: 0,
62
+ height: 1.5,
63
+ },
64
+ shadowOpacity: 0.21,
65
+ shadowRadius: 3,
66
+ elevation: 7,
67
+ },
68
+ icon: {
69
+ borderRadius: 7.6,
70
+ width: 35,
71
+ height: 35,
72
+ marginRight: 5
73
+ },
74
+ borderStyle: {
75
+ borderColor: theme.colors.red,
76
+ borderWidth: 0,
77
+ borderRadius: 10,
78
+ },
79
+ });
80
+
81
+ const handleSwitch = (enabled: boolean, categoryId: any, productId: any) => {
82
+ updateProduct && updateProduct(categoryId, productId, { enabled })
83
+ };
84
+
85
+ const handleScroll = ({ nativeEvent }: any) => {
86
+ const y = nativeEvent.contentOffset.y;
87
+ const height = nativeEvent.contentSize.height;
88
+ const hasMore = !(
89
+ productsList.pagination.totalPages === productsList.pagination.currentPage
90
+ );
91
+
92
+ if (y + PIXELS_TO_SCROLL > height && !productsList.loading && hasMore && productsList?.products?.length > 0) {
93
+ getCategoryProducts(false)
94
+ showToast(ToastType.Info, t('LOADING_MORE_PRODUCTS', 'Loading more products'))
95
+ }
96
+ };
97
+
98
+ return (
99
+ <View style={{ flex: 1, paddingHorizontal: 20, paddingVertical: 20 }}>
100
+ <View style={styles.header}>
101
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
102
+ <TouchableOpacity
103
+ onPress={onClose}
104
+ style={styles.btnBackArrow}
105
+ >
106
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
107
+ </TouchableOpacity>
108
+ <OText style={styles.sectionTitle}>{t('PRODUCTS', 'Products')}</OText>
109
+ </View>
110
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
111
+ <SearchBar
112
+ borderStyle={styles.borderStyle}
113
+ onSearch={handleChangeSearch}
114
+ searchValue={searchValue}
115
+ lazyLoad
116
+ isCancelXButtonShow={!!searchValue}
117
+ onCancel={() => handleChangeSearch('')}
118
+ placeholder={t('SEARCH', 'Search')}
119
+ containerStyle={{ width: 180 }}
120
+ />
121
+ </View>
122
+ </View>
123
+ <IOScrollView
124
+ style={styles.container}
125
+ onScroll={handleScroll}
126
+ scrollEventThrottle={16}
127
+ bounces={false}
128
+ >
129
+ {!loading && products?.length === 0 && (
130
+ <NotFoundSource
131
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
132
+ image={theme.images.general.notFound}
133
+ conditioned={false}
134
+ />
135
+ )}
136
+ {!loading && products?.length > 0 && (
137
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
138
+ {products.map((product: any, i: number) => (
139
+ <View
140
+ key={i}
141
+ style={{
142
+ flexDirection: 'row',
143
+ justifyContent: 'space-between',
144
+ borderBottomColor: theme.colors.borderTops,
145
+ borderBottomWidth: 1,
146
+ paddingVertical: 15
147
+ }}
148
+ >
149
+ <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', marginRight: 36 }}>
150
+ <OIcon
151
+ url={optimizeImage(product?.images, 'h_300,c_limit')}
152
+ src={!product?.images && theme?.images?.dummies?.businessLogo}
153
+ style={styles.icon}
154
+ />
155
+ <OText numberOfLines={2} size={12} ellipsizeMode='tail'>{product?.name}</OText>
156
+ </View>
157
+ <ToggleSwitch
158
+ isOn={product?.enabled}
159
+ onColor={theme.colors.primary}
160
+ offColor={theme.colors.offColor}
161
+ size="small"
162
+ onToggle={(value: boolean) => handleSwitch(value, product?.category_id, product.id)}
163
+ disabled={loading}
164
+ animationSpeed={200}
165
+ />
166
+ </View>
167
+ ))}
168
+ </View>
169
+ )}
170
+ {loading && (
171
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
172
+ {[...Array(6)].map((item, i) => (
173
+ <Placeholder key={i} Animation={Fade}>
174
+ <View
175
+ style={{
176
+ flex: 1,
177
+ flexDirection: 'row',
178
+ justifyContent: 'space-between',
179
+ alignItems: 'center',
180
+ marginBottom: 10,
181
+ borderBottomColor: theme.colors.borderTops,
182
+ borderBottomWidth: 1,
183
+ paddingVertical: 10
184
+ }}
185
+ >
186
+ <PlaceholderLine width={50} />
187
+ <PlaceholderLine width={20} />
188
+ </View>
189
+ </Placeholder>
190
+ ))}
191
+ </View>
192
+ )}
193
+ </IOScrollView>
194
+ </View>
195
+ )
196
+ }
@@ -0,0 +1,196 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { View, StyleSheet, ScrollView, Dimensions, TouchableOpacity } from 'react-native';
3
+ import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
4
+ import { useTheme } from 'styled-components/native';
5
+ import { SearchBar } from '../SearchBar';
6
+ import {
7
+ ToastType,
8
+ useToast,
9
+ useLanguage,
10
+ StoreProductList
11
+ } from 'ordering-components/native';
12
+ import { NotFoundSource } from '../NotFoundSource';
13
+ import { OText, OIcon } from '../shared';
14
+ import { IterateCategories } from './IterateCategories';
15
+ import { ProductList } from './ProductList'
16
+
17
+ const BusinessProductListUI = (props: any) => {
18
+ const {
19
+ navigation,
20
+ businessState,
21
+ productsList,
22
+ updateStoreCategory,
23
+ updateStoreProduct,
24
+ productSearch,
25
+ categorySearch,
26
+ handleChangeCategory,
27
+ handleChangeProductSearch,
28
+ handleChangeCategorySearch,
29
+ getCategoryProducts,
30
+ categories
31
+ } = props;
32
+
33
+ const { loading, error, business } = businessState;
34
+
35
+ const [, t] = useLanguage();
36
+ const [, { showToast }] = useToast();
37
+ const theme = useTheme();
38
+
39
+ const [showModal, setShowModal] = useState(false)
40
+
41
+ const handleOpenProducts = (category: any) => {
42
+ handleChangeCategory(category)
43
+ setShowModal(true)
44
+ }
45
+
46
+ useEffect(() => {
47
+ if (error) {
48
+ showToast(
49
+ ToastType.Error,
50
+ error || error[0] || t('NETWORK_ERROR', 'Network Error'),
51
+ );
52
+ }
53
+ }, [loading]);
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ paddingBottom: 20,
58
+ marginBottom: 0,
59
+ flex: 1,
60
+ },
61
+ header: {
62
+ flexDirection: 'row',
63
+ justifyContent: 'space-between',
64
+ marginBottom: 10,
65
+ },
66
+ sectionTitle: {
67
+ fontStyle: 'normal',
68
+ fontWeight: '600',
69
+ fontSize: 20,
70
+ color: theme.colors.textGray,
71
+ },
72
+ borderStyle: {
73
+ borderColor: theme.colors.red,
74
+ borderWidth: 0,
75
+ borderRadius: 10,
76
+ },
77
+ btnBackArrow: {
78
+ borderWidth: 0,
79
+ width: 32,
80
+ height: 32,
81
+ tintColor: theme.colors.textGray,
82
+ backgroundColor: theme.colors.clear,
83
+ borderColor: theme.colors.clear,
84
+ shadowColor: theme.colors.clear,
85
+ paddingLeft: 0,
86
+ paddingRight: 0
87
+ },
88
+ });
89
+
90
+ return (
91
+ <>
92
+ <View style={styles.header}>
93
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
94
+ <TouchableOpacity
95
+ onPress={() => navigation?.canGoBack() && navigation.goBack()}
96
+ style={styles.btnBackArrow}
97
+ >
98
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textGray} />
99
+ </TouchableOpacity>
100
+ <OText style={styles.sectionTitle}>{t('CATEGORIES', 'Categories')}</OText>
101
+ </View>
102
+ <View style={{ flexDirection: 'row', justifyContent: 'flex-end' }}>
103
+ <SearchBar
104
+ borderStyle={styles.borderStyle}
105
+ onSearch={handleChangeCategorySearch}
106
+ searchValue={categorySearch}
107
+ lazyLoad
108
+ isCancelXButtonShow={!!categorySearch}
109
+ onCancel={() => handleChangeCategorySearch('')}
110
+ placeholder={t('SEARCH', 'Search')}
111
+ containerStyle={{ width: 180 }}
112
+ />
113
+ </View>
114
+ </View>
115
+ <ScrollView
116
+ showsVerticalScrollIndicator={false}
117
+ style={styles.container}>
118
+ {!loading && business?.categories?.length === 0 && (
119
+ <NotFoundSource
120
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
121
+ image={theme.images.general.notFound}
122
+ conditioned={false}
123
+ />
124
+ )}
125
+ {!error && !loading && categories?.length > 0 && (
126
+ <View
127
+ style={{
128
+ borderTopColor: theme.colors.borderTops,
129
+ borderTopWidth: 1
130
+ }}
131
+ >
132
+ <IterateCategories
133
+ list={categories}
134
+ handlerClickCategory={handleOpenProducts}
135
+ updateCategory={updateStoreCategory}
136
+ />
137
+ </View>
138
+ )}
139
+ {loading && (
140
+ <View style={{ borderTopColor: theme.colors.borderTops, borderTopWidth: 1 }}>
141
+ {[...Array(6)].map((item, i) => (
142
+ <Placeholder key={i} Animation={Fade}>
143
+ <View
144
+ style={{
145
+ flex: 1,
146
+ flexDirection: 'row',
147
+ justifyContent: 'space-between',
148
+ alignItems: 'center',
149
+ marginBottom: 10,
150
+ borderBottomColor: theme.colors.borderTops,
151
+ borderBottomWidth: 1,
152
+ paddingVertical: 10
153
+ }}
154
+ >
155
+ <PlaceholderLine width={50} />
156
+ <PlaceholderLine width={20} />
157
+ </View>
158
+ </Placeholder>
159
+ ))}
160
+ </View>
161
+ )}
162
+ </ScrollView>
163
+ {showModal && (
164
+ <View
165
+ style={{
166
+ flex: 1,
167
+ position: 'absolute',
168
+ top: 0,
169
+ width: Dimensions.get('window').width,
170
+ height: Dimensions.get('window').height,
171
+ backgroundColor: theme.colors.backgroundLight,
172
+ left: 0
173
+ }}
174
+ >
175
+ <ProductList
176
+ productsList={productsList}
177
+ updateProduct={updateStoreProduct}
178
+ searchValue={productSearch}
179
+ handleChangeSearch={handleChangeProductSearch}
180
+ getCategoryProducts={getCategoryProducts}
181
+ onClose={() => setShowModal(false)}
182
+ />
183
+ </View>
184
+ )}
185
+ </>
186
+ );
187
+ };
188
+
189
+ export const BusinessProductList = (props: any) => {
190
+ const businessProductListProps = {
191
+ ...props,
192
+ UIComponent: BusinessProductListUI,
193
+ };
194
+
195
+ return <StoreProductList {...businessProductListProps} />;
196
+ };
@@ -0,0 +1,10 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const CategoryTab = styled.View`
4
+ flex-direction: row;
5
+ justify-content: space-between;
6
+ padding-vertical: 10px;
7
+ border-bottom-color: ${(props: any) => props.theme.colors.borderTops};
8
+ border-bottom-width: 1px;
9
+ margin-left: ${(props: any) => props.isSpace ? '10px' : '0px'};
10
+ `
@@ -386,21 +386,30 @@ const ChatUI = (props: MessagesParams) => {
386
386
  style={{ ...styles.firstMessageText, textAlign: 'center' }}
387
387
  >
388
388
  {
389
- message.change?.attribute !== 'driver_id'
390
- ?
391
- `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
392
- ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
393
- : `${message.change?.attribute !== 'logistic_status'
394
- ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
395
- : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
396
- ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
397
- : getLogisticTag(message.change.new)}`
398
- }`
399
- : message.change.new
389
+ message.change?.attribute === 'driver_group_id'
390
+ ? message.change.old
391
+ ? t('ORDER_ATTRIBUTE_CHANGED_FROM_TO')
392
+ .replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
393
+ .replace('_from_', message.change.old)
394
+ .replace('_to_', message.change.new)
395
+ : t('ORDER_ATTRIBUTE_CHANGED_TO')
396
+ .replace('_attribute_', t(message.change?.attribute.toUpperCase()).toLowerCase())
397
+ .replace('_to_', message.change.new)
398
+ : message.change?.attribute !== 'driver_id'
400
399
  ?
401
- `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
402
- :
403
- `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
400
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${filterSpecialStatus.includes(message.change.attribute)
401
+ ? `${message.change.old === null ? '0' : message.change.old} ${t('TO', 'to')} ${message.change.new} ${t('MINUTES', 'Minutes')}`
402
+ : `${message.change?.attribute !== 'logistic_status'
403
+ ? message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])
404
+ : message.change.old !== null && getLogisticTag(message.change.old)} ${t('TO', 'to')} ${message.change?.attribute !== 'logistic_status'
405
+ ? t(ORDER_STATUS[parseInt(message.change.new, 10)])
406
+ : getLogisticTag(message.change.new)}`
407
+ }`
408
+ : message.change.new
409
+ ?
410
+ `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
411
+ :
412
+ `${t('DRIVER_UNASSIGNED', 'Driver unassigned')}`
404
413
  }
405
414
  </OText>
406
415
  <OText size={10} color={'#aaa'} style={{ alignSelf: 'flex-start' }}>
@@ -30,7 +30,6 @@ export const DriverMap = (props: GoogleMapsParams) => {
30
30
  isBusinessMarker,
31
31
  isToFollow,
32
32
  handleViewActionOrder,
33
- updateDriverPosition,
34
33
  driverUpdateLocation,
35
34
  setDriverUpdateLocation,
36
35
  } = props;
@@ -59,6 +58,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
59
58
  key?: string | null;
60
59
  }>({ open: false, content: [], key: null });
61
60
  const distanceUnit = configState?.configs?.distance_unit?.value
61
+ const isHideRejectButtons = configState?.configs?.reject_orders_enabled && configState?.configs?.reject_orders_enabled?.value !== '1'
62
62
 
63
63
  const {
64
64
  hasLocation,
@@ -69,11 +69,20 @@ export const DriverMap = (props: GoogleMapsParams) => {
69
69
  stopFollowUserLocation,
70
70
  } = useLocation();
71
71
 
72
- const origin = {
73
- latitude: initialPosition.latitude,
74
- longitude: initialPosition.longitude,
72
+ const destination = {
73
+ latitude: typeof location?.lat === 'string' ? parseFloat(location?.lat) || 0 : location?.lat || 0,
74
+ longitude: typeof location?.lng === 'string' ? parseFloat(location?.lng) || 0 : location?.lng || 0
75
75
  };
76
- const destination = { latitude: location.lat, longitude: location.lng };
76
+
77
+ const parsedInitialPosition = {
78
+ latitude: typeof initialPosition.latitude === 'string' ? parseFloat(initialPosition.latitude) || 0 : initialPosition.latitude || 0,
79
+ longitude: typeof initialPosition.longitude === 'string' ? parseFloat(initialPosition.longitude) || 0 : initialPosition.longitude || 0,
80
+ }
81
+
82
+ const parsedUserLocation = {
83
+ latitude: typeof userLocation?.latitude === 'string' ? parseFloat(userLocation?.latitude) || 0 : userLocation?.latitude || 0,
84
+ longitude: typeof userLocation?.longitude === 'string' ? parseFloat(userLocation?.longitude) || 0 : userLocation?.longitude || 0
85
+ }
77
86
 
78
87
  useEffect(() => {
79
88
  if (isToFollow) {
@@ -161,7 +170,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
161
170
  if (driverUpdateLocation.error) return;
162
171
 
163
172
  calculateDistance(
164
- { lat: userLocation.latitude, lng: userLocation.longitude },
173
+ { lat: parsedUserLocation.latitude, lng: parsedUserLocation.longitude },
165
174
  destination,
166
175
  );
167
176
  // geocodePosition(userLocation);
@@ -169,13 +178,13 @@ export const DriverMap = (props: GoogleMapsParams) => {
169
178
  if (!following.current) return;
170
179
  fitCoordinates();
171
180
 
172
- const { latitude, longitude } = userLocation;
181
+ const { latitude, longitude } = parsedUserLocation;
173
182
 
174
183
  mapRef.current?.animateCamera({
175
184
  center: { latitude, longitude },
176
185
  });
177
186
 
178
- }, [userLocation]);
187
+ }, [parsedUserLocation]);
179
188
 
180
189
  const handleArrowBack: any = () => {
181
190
  setDriverUpdateLocation?.({
@@ -241,8 +250,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
241
250
  [
242
251
  { latitude: location.lat, longitude: location.lng },
243
252
  {
244
- latitude: initialPosition.latitude,
245
- longitude: initialPosition.longitude,
253
+ latitude: parsedInitialPosition.latitude,
254
+ longitude: parsedInitialPosition.longitude,
246
255
  },
247
256
  ],
248
257
  {
@@ -255,7 +264,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
255
264
 
256
265
  useEffect(() => {
257
266
  const interval = setInterval(() => {
258
- if (initialPosition.latitude !== 0 && autoFit.current) {
267
+ if (parsedInitialPosition.latitude !== 0 && autoFit.current) {
259
268
  if (mapRef.current) {
260
269
  fitCoordinates();
261
270
  autoFit.current = false;
@@ -263,7 +272,7 @@ export const DriverMap = (props: GoogleMapsParams) => {
263
272
  }
264
273
  }, 1000);
265
274
  return () => clearInterval(interval);
266
- }, [initialPosition]);
275
+ }, [parsedInitialPosition]);
267
276
 
268
277
  const fitCoordinatesZoom = () => {
269
278
  following.current = false;
@@ -346,8 +355,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
346
355
  ref={mapRef}
347
356
  provider={PROVIDER_GOOGLE}
348
357
  initialRegion={{
349
- latitude: initialPosition.latitude,
350
- longitude: initialPosition.longitude,
358
+ latitude: parsedInitialPosition.latitude,
359
+ longitude: parsedInitialPosition.longitude,
351
360
  latitudeDelta: 0.001,
352
361
  longitudeDelta: 0.001 * ASPECT_RATIO,
353
362
  }}
@@ -369,8 +378,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
369
378
  <>
370
379
  <Marker
371
380
  coordinate={{
372
- latitude: location.lat,
373
- longitude: location.lng,
381
+ latitude: typeof destination?.latitude !== 'object' ? destination?.latitude : 0,
382
+ longitude: typeof destination?.longitude !== 'object' ? destination?.latitude : 0
374
383
  }}
375
384
  title={location.title}>
376
385
  <Icon
@@ -381,13 +390,16 @@ export const DriverMap = (props: GoogleMapsParams) => {
381
390
  <View style={styles.view}>
382
391
  <OIcon
383
392
  style={styles.image}
384
- url={location.icon}
393
+ src={typeof location.icon === 'number' ? location.icon : { uri: location.icon }}
385
394
  width={25}
386
395
  height={25}
387
396
  />
388
397
  </View>
389
398
  </Marker>
390
- <Marker coordinate={userLocation}>
399
+ <Marker coordinate={{
400
+ latitude: typeof parsedUserLocation?.latitude !== 'object' ? parsedUserLocation?.latitude : 0,
401
+ longitude: typeof parsedUserLocation?.longitude !== 'object' ? parsedUserLocation?.latitude : 0
402
+ }}>
391
403
  <View style={styles.driverIcon}>
392
404
  <OIcon
393
405
  style={styles.image}
@@ -401,8 +413,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
401
413
  ) : (
402
414
  <Marker
403
415
  coordinate={{
404
- latitude: userLocation.latitude,
405
- longitude: userLocation.longitude,
416
+ latitude: typeof parsedUserLocation?.latitude !== 'object' ? parsedUserLocation?.latitude : 0,
417
+ longitude: typeof parsedUserLocation?.longitude !== 'object' ? parsedUserLocation?.latitude : 0
406
418
  }}
407
419
  title={markerTitle || t('YOUR_LOCATION', 'Your Location')}
408
420
  />
@@ -516,8 +528,8 @@ export const DriverMap = (props: GoogleMapsParams) => {
516
528
  options={{
517
529
  latitude: destination.latitude,
518
530
  longitude: destination.longitude,
519
- sourceLatitude: userLocation.latitude,
520
- sourceLongitude: userLocation.longitude,
531
+ sourceLatitude: parsedUserLocation.latitude,
532
+ sourceLongitude: parsedUserLocation.longitude,
521
533
  naverCallerName: 'com.deliveryapp',
522
534
  dialogTitle: t('SHOW_IN_OTHER_MAPS', 'Show in other maps'),
523
535
  dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
@@ -539,8 +551,9 @@ export const DriverMap = (props: GoogleMapsParams) => {
539
551
  secondButton={true}
540
552
  firstColorCustom={theme.colors.red}
541
553
  secondColorCustom={theme.colors.green}
542
- widthButton={'45%'}
554
+ widthButton={isHideRejectButtons ? '100%' : '45%'}
543
555
  isPadding
556
+ isHideRejectButtons={isHideRejectButtons}
544
557
  />
545
558
  )}
546
559