ordering-ui-react-native 0.21.51 → 0.21.52-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 (167) hide show
  1. package/package.json +8 -8
  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/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  11. package/themes/business/src/components/BusinessProductList/ProductList.tsx +72 -27
  12. package/themes/business/src/components/BusinessProductList/index.tsx +57 -25
  13. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  14. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  15. package/themes/business/src/components/Home/index.tsx +5 -1
  16. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  17. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  18. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  19. package/themes/business/src/components/MapView/index.tsx +30 -15
  20. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  21. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  22. package/themes/business/src/components/OrderDetails/Delivery.tsx +42 -23
  23. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  24. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +36 -22
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  26. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  27. package/themes/business/src/components/OrdersOption/index.tsx +263 -135
  28. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  29. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  30. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  31. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  32. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  33. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  34. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  35. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  36. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  37. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  38. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  39. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  40. package/themes/business/src/components/Sessions/index.tsx +187 -0
  41. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  42. package/themes/business/src/components/StoresList/index.tsx +5 -3
  43. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  44. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  45. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  46. package/themes/business/src/components/shared/OInput.tsx +2 -0
  47. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  48. package/themes/business/src/hooks/useLocation.tsx +5 -4
  49. package/themes/business/src/types/index.tsx +23 -5
  50. package/themes/business/src/utils/index.tsx +5 -0
  51. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  53. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  59. package/themes/original/index.tsx +6 -2
  60. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  61. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  62. package/themes/original/src/components/AddressList/index.tsx +8 -7
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  66. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  67. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  68. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  69. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
  70. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
  71. package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
  72. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
  73. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  74. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  75. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  76. package/themes/original/src/components/BusinessProductsListing/index.tsx +25 -13
  77. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  78. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  79. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  80. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  81. package/themes/original/src/components/Cart/index.tsx +19 -7
  82. package/themes/original/src/components/CartContent/index.tsx +58 -44
  83. package/themes/original/src/components/Checkout/index.tsx +106 -64
  84. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  85. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  86. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  87. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  88. package/themes/original/src/components/Favorite/index.tsx +1 -5
  89. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  90. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  91. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  92. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  93. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  94. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  95. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  96. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
  97. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  98. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  99. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  100. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  101. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  102. package/themes/original/src/components/Help/index.tsx +2 -0
  103. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  104. package/themes/original/src/components/Home/index.tsx +2 -10
  105. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
  106. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  107. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  108. package/themes/original/src/components/Messages/index.tsx +8 -7
  109. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  110. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  111. package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
  112. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  113. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  114. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  115. package/themes/original/src/components/NavBar/index.tsx +4 -2
  116. package/themes/original/src/components/NetworkError/index.tsx +2 -8
  117. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  118. package/themes/original/src/components/Notifications/index.tsx +2 -4
  119. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  120. package/themes/original/src/components/OrderDetails/index.tsx +5 -7
  121. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  122. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  123. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  124. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  125. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  126. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  127. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  128. package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
  129. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  130. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  131. package/themes/original/src/components/ProductForm/ActionButton.tsx +19 -19
  132. package/themes/original/src/components/ProductForm/index.tsx +123 -112
  133. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  134. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  135. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  136. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  137. package/themes/original/src/components/Promotions/index.tsx +6 -9
  138. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  139. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  140. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  141. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  142. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  143. package/themes/original/src/components/Sessions/index.tsx +3 -3
  144. package/themes/original/src/components/SignupForm/index.tsx +65 -67
  145. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  146. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  147. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  148. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  149. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  150. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  151. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  152. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  153. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +3 -5
  154. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  155. package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
  156. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  157. package/themes/original/src/components/UserProfile/index.tsx +2 -1
  158. package/themes/original/src/components/Wallets/index.tsx +7 -4
  159. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  160. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  161. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  162. package/themes/original/src/components/shared/OButton.tsx +8 -7
  163. package/themes/original/src/components/shared/OInput.tsx +1 -4
  164. package/themes/original/src/layouts/Container.tsx +4 -2
  165. package/themes/original/src/types/index.tsx +6 -1
  166. package/themes/original/src/utils/index.tsx +12 -1
  167. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.51",
3
+ "version": "0.21.52-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -52,13 +52,13 @@
52
52
  "@segment/analytics-react-native": "2.1.11",
53
53
  "@segment/sovran-react-native": "0.2.6",
54
54
  "@sentry/react-native": "^2.6.0",
55
- "@stripe/stripe-react-native": "^0.2.0",
55
+ "@stripe/stripe-react-native": "0.23.0",
56
56
  "@types/react-native-loading-spinner-overlay": "^0.5.2",
57
57
  "@types/react-native-snap-carousel": "^3.8.4",
58
58
  "@types/styled-components": "^5.1.3",
59
59
  "axios": "^0.21.0",
60
60
  "moment": "^2.29.1",
61
- "ordering-components": "github:Ordering-Inc/ordering-components#development",
61
+ "ordering-components": "github:Ordering-Inc/ordering-components#release",
62
62
  "patch-package": "^6.4.7",
63
63
  "postinstall-postinstall": "^2.1.0",
64
64
  "prop-types": "^15.7.2",
@@ -76,7 +76,7 @@
76
76
  "react-native-color-matrix-image-filters": "^5.2.10",
77
77
  "react-native-country-picker-modal": "^2.0.0",
78
78
  "react-native-credit-card-input": "^0.4.1",
79
- "react-native-date-picker": "^4.2.13",
79
+ "react-native-date-picker": "4.2.14",
80
80
  "react-native-device-info": "^8.7.1",
81
81
  "react-native-document-picker": "^5.2.0",
82
82
  "react-native-elements": "^3.0.0-alpha.1",
@@ -86,7 +86,7 @@
86
86
  "react-native-gesture-handler": "^1.8.0",
87
87
  "react-native-get-random-values": "1.8.0",
88
88
  "react-native-gifted-chat": "^0.16.3",
89
- "react-native-google-places-autocomplete": "^2.1.3",
89
+ "react-native-google-places-autocomplete": "2.1.3",
90
90
  "react-native-html-to-pdf": "^0.10.0",
91
91
  "react-native-image-picker": "^4.0.6",
92
92
  "react-native-intersection-observer": "^0.0.9",
@@ -116,7 +116,7 @@
116
116
  "react-native-tracking-transparency": "^0.1.1",
117
117
  "react-native-uuid": "^2.0.1",
118
118
  "react-native-vector-icons": "^7.1.0",
119
- "react-native-webview": "^11.22.7",
119
+ "react-native-webview": "^11.6.4",
120
120
  "react-native-youtube-iframe": "^2.2.2",
121
121
  "rn-placeholder": "^3.0.3",
122
122
  "styled-components": "^5.1.1",
@@ -128,8 +128,8 @@
128
128
  "@babel/core": "^7.11.6",
129
129
  "@babel/runtime": "^7.11.2",
130
130
  "@react-native-community/eslint-config": "^2.0.0",
131
- "@types/react": "^18.0.14",
132
- "@types/react-dom": "^18.0.5",
131
+ "@types/react": "^18.0.15",
132
+ "@types/react-dom": "^18.0.6",
133
133
  "@types/react-native": "^0.63.25",
134
134
  "@types/react-native-calendar-picker": "^7.0.2",
135
135
  "babel-jest": "^26.3.0",
@@ -7,7 +7,8 @@
7
7
  */
8
8
 
9
9
  import * as React from 'react';
10
- import { LogBox } from 'react-native';
10
+ import { LogBox, Platform } from 'react-native';
11
+ import * as Sentry from "@sentry/react-native";
11
12
  import { OrderingProvider } from 'ordering-components/native';
12
13
  import RNBootSplash from "react-native-bootsplash";
13
14
 
@@ -22,6 +23,47 @@ import theme from './theme.json';
22
23
  import AppContainer from './AppContainer';
23
24
  import { FacebookPixel } from './components/FacebookPixel';
24
25
 
26
+ Sentry.init({
27
+ environment: Platform.OS === 'ios' ? 'ios' : 'android',
28
+ dsn: 'https://e5e1115dc93b49109f4ab65f2098bef9@o460529.ingest.sentry.io/5722123',
29
+ release: 'ordering-ui-native@' + process.env.npm_package_version,
30
+ ignoreErrors: [
31
+ 'is not defined',
32
+ 'is not a function',
33
+ 'can\'t find variable',
34
+ 'objects are not valid',
35
+ 'element type is invalid',
36
+ 'requiring module',
37
+ 'has not been registered',
38
+ 'failed to connect to debugger!',
39
+ 'rendered more hooks than',
40
+ 'rendered fewer hooks than',
41
+ 'should have a queue',
42
+ 'the OS most likely terminated',
43
+ 'Connection timed out',
44
+ 'java.io.EOFException',
45
+ 'Abort',
46
+ 'Segfault',
47
+ 'Failed to allocate a',
48
+ 'Application Not Responding',
49
+ 'connection no longer valid',
50
+ 'IllegalInstruction',
51
+ 'React.Children.only expected to receive a single React element child.',
52
+ 'unrecognized selector sent to instance'
53
+ ],
54
+ tracesSampleRate: 0.2,
55
+ // Release health
56
+ enableAutoSessionTracking: true,
57
+ // Sessions close after app is 10 seconds in the background.
58
+ sessionTrackingIntervalMillis: 10000,
59
+
60
+ integrations: [
61
+ new Sentry.ReactNativeTracing({
62
+ routingInstrumentation: reactNavigationV5Instrumentation,
63
+ })
64
+ ]
65
+ });
66
+
25
67
  LogBox.ignoreLogs([
26
68
  'Sending \`onAnimatedValueUpdate` with no listeners registered.',
27
69
  'Non-serializable values were found in the navigation state.',
@@ -191,7 +191,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
191
191
  {isFarAway && (
192
192
  <FarAwayMessage style={styles.farAwayMsg}>
193
193
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
194
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
194
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
195
195
  </FarAwayMessage>
196
196
  )}
197
197
  </OrderControlContainer>
@@ -156,6 +156,7 @@ export const PaymentOptionsWebView = (props: PaymentOptionsWebViewParams) => {
156
156
  user_id: user?.id,
157
157
  user_name: user?.name
158
158
  },
159
+ xappx: ordering?.appId,
159
160
  currency: configs?.stripe_currency?.value || currency,
160
161
  userToken: token,
161
162
  clientId: webviewPaymethod?.credentials?.client_id,
@@ -3,7 +3,6 @@ import { useLanguage, useConfig, useOrder } from 'ordering-components/native'
3
3
  import { useGooglePay, useApplePay } from '@stripe/stripe-react-native'
4
4
  import { Platform } from 'react-native';
5
5
  import { StripeMethodFormParams } from '../../types';
6
- import { android_app_id } from '../../config.json'
7
6
 
8
7
  export const StripeMethodForm = (props: StripeMethodFormParams) => {
9
8
  const {
@@ -17,7 +16,9 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
17
16
  placeByMethodPay,
18
17
  methodPaySupported,
19
18
  setPlaceByMethodPay,
20
- cartTotal
19
+ cartTotal,
20
+ androidAppId,
21
+ businessNames
21
22
  } = props
22
23
  const { initGooglePay, createGooglePayPaymentMethod, loading } = useGooglePay();
23
24
  const { presentApplePay, isApplePaySupported } = useApplePay();
@@ -61,7 +62,7 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
61
62
  })
62
63
  const { error } = await initGooglePay({
63
64
  testEnv: devMode,
64
- merchantName: android_app_id,
65
+ merchantName: androidAppId,
65
66
  countryCode: 'US',
66
67
  billingAddressConfig: {
67
68
  format: 'FULL',
@@ -152,7 +153,8 @@ export const StripeMethodForm = (props: StripeMethodFormParams) => {
152
153
 
153
154
  const { error, paymentMethod } = await presentApplePay({
154
155
  cartItems: [{
155
- label: t('CART', 'Cart'),
156
+ label: businessNames ? `${businessNames.join(', ')} ${t('VIA_CHEW_APP', 'via Chew App')}`
157
+ : `${cart?.business?.name} ${t('VIA_CHEW_APP', 'via Chew App')}`,
156
158
  amount: cartTotal?.toString?.() ?? cart?.balance?.toString() ?? cart?.total?.toString?.(),
157
159
  paymentType: 'Immediate'
158
160
  }],
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 43px;
5
+ padding: 0 30px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,7 +20,6 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
- flex-wrap: wrap;
24
23
  `
25
24
 
26
25
  export const WrappCountdown = styled.View`
@@ -494,5 +494,7 @@ export interface StripeMethodFormParams {
494
494
  placeByMethodPay?: any
495
495
  methodPaySupported?: any,
496
496
  setPlaceByMethodPay?: any,
497
- cartTotal?: number
497
+ cartTotal?: number,
498
+ androidAppId?: string,
499
+ businessNames?: Array<string>
498
500
  }
@@ -29,6 +29,7 @@ import { OrderSummary } from './src/components/OrderSummary';
29
29
  import { PhoneInputNumber } from './src/components/PhoneInputNumber';
30
30
  import { PreviousMessages } from './src/components/PreviousMessages';
31
31
  import { PreviousOrders } from './src/components/PreviousOrders';
32
+ import { PrinterSettings } from './src/components/PrinterSettings';
32
33
  import { ProductItemAccordion } from './src/components/ProductItemAccordion';
33
34
  import { ReviewCustomer } from './src/components/ReviewCustomer'
34
35
  import { SearchBar } from './src/components/SearchBar';
@@ -43,6 +44,7 @@ import { NewOrderNotification } from './src/components/NewOrderNotification';
43
44
  import { DriverSchedule } from './src/components/DriverSchedule';
44
45
  import { ScheduleBlocked } from './src/components/ScheduleBlocked';
45
46
  import { OrderDetailsLogistic } from './src/components/OrderDetailsLogistic'
47
+ import { Sessions } from './src/components/Sessions';
46
48
  //OComponents
47
49
  import {
48
50
  OText,
@@ -102,10 +104,12 @@ export {
102
104
  PhoneInputNumber,
103
105
  PreviousMessages,
104
106
  PreviousOrders,
107
+ PrinterSettings,
105
108
  ProductItemAccordion,
106
109
  ReviewCustomer,
107
110
  SafeAreaContainerLayout,
108
111
  SearchBar,
112
+ Sessions,
109
113
  SignupForm,
110
114
  StoresList,
111
115
  UserFormDetailsUI,
@@ -31,6 +31,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
31
31
  notShowCustomerPhone,
32
32
  orderTitle,
33
33
  appTitle,
34
+ isLoadingOrder
34
35
  } = props;
35
36
 
36
37
  const [, t] = useLanguage();
@@ -277,7 +278,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
277
278
  }
278
279
 
279
280
  bodyToSend.id = orderId;
280
- handleUpdateOrder && handleUpdateOrder(bodyToSend.status, bodyToSend);
281
+ handleUpdateOrder?.(bodyToSend.status, bodyToSend);
281
282
  };
282
283
 
283
284
  useEffect(() => {
@@ -517,7 +518,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
517
518
  ...styles.bottomParent,
518
519
  marginBottom: Platform.OS === 'ios'
519
520
  ? 30 : (keyboardState.height === 0)
520
- ? isPage ? 0 : 30
521
+ ? isPage ? 0 : 40
521
522
  : keyboardState.height - (isPage ? 20 : -10)
522
523
  }}
523
524
  >
@@ -529,7 +530,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
529
530
  style={{ borderRadius: 7, height: 45 }}
530
531
  parentStyle={{ width: '100%' }}
531
532
  textStyle={{ color: '#FFF', fontSize: 18 }}
532
- isDisabled={showTextArea && !comments}
533
+ isDisabled={(showTextArea && !comments) || isLoadingOrder}
533
534
  onClick={() => handleAcceptOrReject()}
534
535
  />
535
536
  </View>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { StyleSheet, View, ActivityIndicator } from 'react-native';
2
+ import { StyleSheet, View, ActivityIndicator, TouchableOpacity } from 'react-native';
3
3
  import ToggleSwitch from 'toggle-switch-react-native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
@@ -14,7 +14,7 @@ import { OIcon, OText } from '../shared';
14
14
  import { BusinessControllerParams } from '../../types';
15
15
 
16
16
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
17
- const { businessState, updateBusiness, isUpdateStore, setIsUpdateStore } =
17
+ const { businessState, updateBusiness, isUpdateStore, setIsUpdateStore, navigation } =
18
18
  props;
19
19
 
20
20
  const { loading, business, error } = businessState;
@@ -93,21 +93,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
93
93
  <>
94
94
  {business && (
95
95
  <Card key={business?.id}>
96
- <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>
97
- <Logo style={styles.logo}>
98
- <OIcon
99
- url={optimizeImage(business?.logo, 'h_300,c_limit')}
100
- src={!business?.logo && theme?.images?.dummies?.businessLogo}
101
- style={styles.icon}
102
- />
103
- </Logo>
104
-
105
- <View
106
- style={{
107
- flex: 1,
108
- flexDirection: 'row',
109
- alignItems: 'flex-start',
110
- }}>
96
+ <View style={{ flexDirection: 'row', flex: 1 }}>
97
+ <TouchableOpacity
98
+ style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}
99
+ onPress={() => navigation && business?.slug && navigation.navigate('BusinessProductListing', { slug: business?.slug })}
100
+ >
101
+ <Logo style={styles.logo}>
102
+ <OIcon
103
+ url={optimizeImage(business?.logo, 'h_300,c_limit')}
104
+ src={!business?.logo && theme?.images?.dummies?.businessLogo}
105
+ style={styles.icon}
106
+ />
107
+ </Logo>
111
108
  <Information>
112
109
  <View style={styles.header}>
113
110
  <OText style={styles.title} numberOfLines={1}>
@@ -123,7 +120,12 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
123
120
  {business?.zipcode}
124
121
  </OText>
125
122
  </Information>
123
+ </TouchableOpacity>
126
124
 
125
+ <View
126
+ style={{
127
+ alignItems: 'flex-start',
128
+ }}>
127
129
  {loading && isUpdateStore ? (
128
130
  <ActivityIndicator size="small" color={theme.colors.primary} />
129
131
  ) : (
@@ -1,45 +1,56 @@
1
- import React from 'react'
2
- import { ScrollView, StyleSheet, View } from 'react-native'
1
+ import React, { useCallback } from 'react'
2
+ import { StyleSheet, View, TouchableOpacity } from 'react-native'
3
3
  import { useTheme } from 'styled-components/native';
4
- import { OIcon, OText, OIconButton } from '../shared';
4
+ import { OIcon, OText } from '../shared';
5
5
  import { NotFoundSource } from '../NotFoundSource';
6
6
  import ToggleSwitch from 'toggle-switch-react-native';
7
7
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
8
+ import { SearchBar } from '../SearchBar';
9
+ import { IOScrollView } from 'react-native-intersection-observer';
8
10
  import {
9
11
  useLanguage,
10
- useUtils
12
+ useUtils,
13
+ ToastType,
14
+ useToast,
11
15
  } from 'ordering-components/native'
12
16
 
17
+ const PIXELS_TO_SCROLL = 2000
18
+
13
19
  export const ProductList = (props: any) => {
14
- const { categoryState, onClose, updateProduct } = props
20
+ const { productsList, onClose, updateProduct, searchValue, handleChangeSearch, getCategoryProducts } = props
15
21
 
16
- const { loading, products, error } = categoryState
22
+ const { loading, products, error } = productsList
17
23
 
18
24
  const theme = useTheme()
19
25
  const [{ optimizeImage }] = useUtils();
26
+ const [, { showToast }] = useToast()
20
27
  const [, t] = useLanguage()
21
28
 
22
29
  const styles = StyleSheet.create({
23
30
  container: {
24
- paddingBottom: 20,
25
- marginBottom: 0,
26
31
  flex: 1,
32
+ marginBottom: 0
27
33
  },
28
34
  header: {
29
35
  flexDirection: 'row',
30
36
  justifyContent: 'space-between',
31
37
  marginBottom: 10,
32
38
  },
33
- arrowLeft: {
34
- maxWidth: 40,
35
- height: 25,
36
- justifyContent: 'flex-end',
37
- marginTop: 8
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
38
49
  },
39
50
  sectionTitle: {
40
51
  fontStyle: 'normal',
41
52
  fontWeight: '600',
42
- fontSize: 24,
53
+ fontSize: 20,
43
54
  color: theme.colors.textGray,
44
55
  },
45
56
  logo: {
@@ -60,27 +71,61 @@ export const ProductList = (props: any) => {
60
71
  height: 35,
61
72
  marginRight: 5
62
73
  },
74
+ borderStyle: {
75
+ borderColor: theme.colors.red,
76
+ borderWidth: 0,
77
+ borderRadius: 10,
78
+ },
63
79
  });
64
80
 
65
81
  const handleSwitch = (enabled: boolean, categoryId: any, productId: any) => {
66
82
  updateProduct && updateProduct(categoryId, productId, { enabled })
67
83
  };
68
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
+
69
98
  return (
70
99
  <View style={{ flex: 1, paddingHorizontal: 20, paddingVertical: 20 }}>
71
100
  <View style={styles.header}>
72
- <OIconButton
73
- icon={theme.images.general.arrow_left}
74
- borderColor={theme.colors.clear}
75
- iconStyle={{ width: 20, height: 20 }}
76
- style={styles.arrowLeft}
77
- onClick={onClose}
78
- />
79
- <OText style={styles.sectionTitle}>{t('PRODUCTS', 'Products')}</OText>
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>
80
122
  </View>
81
- <ScrollView
82
- showsVerticalScrollIndicator={false}
83
- style={styles.container}>
123
+ <IOScrollView
124
+ style={styles.container}
125
+ onScroll={handleScroll}
126
+ scrollEventThrottle={16}
127
+ bounces={false}
128
+ >
84
129
  {!loading && products?.length === 0 && (
85
130
  <NotFoundSource
86
131
  content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
@@ -98,7 +143,7 @@ export const ProductList = (props: any) => {
98
143
  justifyContent: 'space-between',
99
144
  borderBottomColor: theme.colors.borderTops,
100
145
  borderBottomWidth: 1,
101
- paddingVertical: 10
146
+ paddingVertical: 15
102
147
  }}
103
148
  >
104
149
  <View style={{ flex: 1, flexDirection: 'row', alignItems: 'center', marginRight: 36 }}>
@@ -145,7 +190,7 @@ export const ProductList = (props: any) => {
145
190
  ))}
146
191
  </View>
147
192
  )}
148
- </ScrollView>
193
+ </IOScrollView>
149
194
  </View>
150
195
  )
151
196
  }
@@ -1,15 +1,16 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { View, StyleSheet, ScrollView, Dimensions } from 'react-native';
2
+ import { View, StyleSheet, ScrollView, Dimensions, TouchableOpacity } from 'react-native';
3
3
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
4
4
  import { useTheme } from 'styled-components/native';
5
+ import { SearchBar } from '../SearchBar';
5
6
  import {
6
7
  ToastType,
7
8
  useToast,
8
9
  useLanguage,
9
- BusinessAndProductList,
10
+ StoreProductList
10
11
  } from 'ordering-components/native';
11
12
  import { NotFoundSource } from '../NotFoundSource';
12
- import { OText, OIconButton } from '../shared';
13
+ import { OText, OIcon } from '../shared';
13
14
  import { IterateCategories } from './IterateCategories';
14
15
  import { ProductList } from './ProductList'
15
16
 
@@ -17,10 +18,16 @@ const BusinessProductListUI = (props: any) => {
17
18
  const {
18
19
  navigation,
19
20
  businessState,
20
- handleChangeCategory,
21
- categoryState,
21
+ productsList,
22
22
  updateStoreCategory,
23
- updateStoreProduct
23
+ updateStoreProduct,
24
+ productSearch,
25
+ categorySearch,
26
+ handleChangeCategory,
27
+ handleChangeProductSearch,
28
+ handleChangeCategorySearch,
29
+ getCategoryProducts,
30
+ categories
24
31
  } = props;
25
32
 
26
33
  const { loading, error, business } = businessState;
@@ -59,28 +66,51 @@ const BusinessProductListUI = (props: any) => {
59
66
  sectionTitle: {
60
67
  fontStyle: 'normal',
61
68
  fontWeight: '600',
62
- fontSize: 24,
69
+ fontSize: 20,
63
70
  color: theme.colors.textGray,
64
71
  },
65
- arrowLeft: {
66
- maxWidth: 40,
67
- height: 25,
68
- justifyContent: 'flex-end',
69
- marginTop: 8
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
70
87
  },
71
88
  });
72
89
 
73
90
  return (
74
91
  <>
75
92
  <View style={styles.header}>
76
- <OIconButton
77
- icon={theme.images.general.arrow_left}
78
- borderColor={theme.colors.clear}
79
- iconStyle={{ width: 20, height: 20 }}
80
- style={styles.arrowLeft}
81
- onClick={() => navigation?.canGoBack() && navigation.goBack()}
82
- />
83
- <OText style={styles.sectionTitle}>{t('CATEGORIES', 'Categories')}</OText>
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>
84
114
  </View>
85
115
  <ScrollView
86
116
  showsVerticalScrollIndicator={false}
@@ -92,7 +122,7 @@ const BusinessProductListUI = (props: any) => {
92
122
  conditioned={false}
93
123
  />
94
124
  )}
95
- {!error && !loading && business?.categories?.length > 0 && (
125
+ {!error && !loading && categories?.length > 0 && (
96
126
  <View
97
127
  style={{
98
128
  borderTopColor: theme.colors.borderTops,
@@ -100,7 +130,7 @@ const BusinessProductListUI = (props: any) => {
100
130
  }}
101
131
  >
102
132
  <IterateCategories
103
- list={business?.categories}
133
+ list={categories}
104
134
  handlerClickCategory={handleOpenProducts}
105
135
  updateCategory={updateStoreCategory}
106
136
  />
@@ -143,8 +173,11 @@ const BusinessProductListUI = (props: any) => {
143
173
  }}
144
174
  >
145
175
  <ProductList
146
- categoryState={categoryState}
176
+ productsList={productsList}
147
177
  updateProduct={updateStoreProduct}
178
+ searchValue={productSearch}
179
+ handleChangeSearch={handleChangeProductSearch}
180
+ getCategoryProducts={getCategoryProducts}
148
181
  onClose={() => setShowModal(false)}
149
182
  />
150
183
  </View>
@@ -156,9 +189,8 @@ const BusinessProductListUI = (props: any) => {
156
189
  export const BusinessProductList = (props: any) => {
157
190
  const businessProductListProps = {
158
191
  ...props,
159
- isFetchAllProducts: true,
160
192
  UIComponent: BusinessProductListUI,
161
193
  };
162
194
 
163
- return <BusinessAndProductList {...businessProductListProps} />;
195
+ return <StoreProductList {...businessProductListProps} />;
164
196
  };