ordering-ui-react-native 0.23.95 → 0.23.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.23.95",
3
+ "version": "0.23.97",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -35,9 +35,7 @@ import { MessageListing } from './src/components/MessageListing';
35
35
  import { Messages } from './src/components/Messages';
36
36
  import { MyOrders } from './src/components/MyOrders';
37
37
  import { Help } from './src/components/Help';
38
- import { HelpAccountAndPayment } from './src/components/HelpAccountAndPayment';
39
- import { HelpGuide } from './src/components/HelpGuide';
40
- import { HelpOrder } from './src/components/HelpOrder';
38
+ import { HelpOptions } from './src/components/HelpOptions';
41
39
  import { NetworkError } from './src/components/NetworkError';
42
40
  import { NotFoundSource } from './src/components/NotFoundSource';
43
41
  import { OrderTypeSelector } from './src/components/OrderTypeSelector';
@@ -113,49 +111,49 @@ import { orderTypeList, getTraduction, verifyDecimals, getOrderStatus, getOrderS
113
111
  import Alert from './src/providers/AlertProvider'
114
112
 
115
113
  import {
116
- LoginParams,
117
- ProfileParams,
118
- AddressListParams,
119
- AddressFormParams,
120
- SignupParams,
121
- PhoneInputParams,
122
- LanguageSelectorParams,
123
- BusinessesListingParams,
124
- HighestRatedBusinessesParams,
125
- BusinessTypeFilterParams,
126
- BusinessControllerParams,
127
- BusinessProductsListingParams,
128
- BusinessBasicInformationParams,
129
- BusinessProductsCategoriesParams,
130
- BusinessProductsListParams,
131
- SingleProductCardParams,
132
- BusinessInformationParams,
133
- BusinessReviewsParams,
134
- SearchBarParams,
135
- NotFoundSourceParams,
136
- OrdersOptionParams,
137
- ActiveOrdersParams,
138
- PreviousOrdersParams,
139
- OrderDetailsParams,
140
- ReviewDriverParams
114
+ LoginParams,
115
+ ProfileParams,
116
+ AddressListParams,
117
+ AddressFormParams,
118
+ SignupParams,
119
+ PhoneInputParams,
120
+ LanguageSelectorParams,
121
+ BusinessesListingParams,
122
+ HighestRatedBusinessesParams,
123
+ BusinessTypeFilterParams,
124
+ BusinessControllerParams,
125
+ BusinessProductsListingParams,
126
+ BusinessBasicInformationParams,
127
+ BusinessProductsCategoriesParams,
128
+ BusinessProductsListParams,
129
+ SingleProductCardParams,
130
+ BusinessInformationParams,
131
+ BusinessReviewsParams,
132
+ SearchBarParams,
133
+ NotFoundSourceParams,
134
+ OrdersOptionParams,
135
+ ActiveOrdersParams,
136
+ PreviousOrdersParams,
137
+ OrderDetailsParams,
138
+ ReviewDriverParams
141
139
  } from './src/types';
142
140
 
143
141
  import { Toast } from './src/components/shared/OToast';
144
142
  import {
145
- OText,
146
- OButton,
147
- OInput,
148
- ODropDown,
149
- OIcon,
150
- OIconText,
151
- OIconButton,
152
- OTextarea,
153
- OToggle,
154
- OKeyButton,
155
- OAlert,
156
- OModal,
157
- OBottomPopup,
158
- HeaderTitle
143
+ OText,
144
+ OButton,
145
+ OInput,
146
+ ODropDown,
147
+ OIcon,
148
+ OIconText,
149
+ OIconButton,
150
+ OTextarea,
151
+ OToggle,
152
+ OKeyButton,
153
+ OAlert,
154
+ OModal,
155
+ OBottomPopup,
156
+ HeaderTitle
159
157
  } from './src/components/shared';
160
158
 
161
159
  import { Container } from './src/layouts/Container';
@@ -163,198 +161,196 @@ import { SafeAreaContainer } from './src/layouts/SafeAreaContainer';
163
161
  import { FloatingBottomContainer } from './src/layouts/FloatingBottomContainer';
164
162
 
165
163
  import {
166
- _retrieveStoreData,
167
- _setStoreData,
168
- _removeStoreData,
169
- _clearStoreData
164
+ _retrieveStoreData,
165
+ _setStoreData,
166
+ _removeStoreData,
167
+ _clearStoreData
170
168
  } from './src/providers/StoreUtil';
171
169
 
172
170
  export {
173
- AddressForm,
174
- AddressDetails,
175
- AnalyticsSegment,
176
- Home as HomeView,
177
- SignupForm,
178
- LoginForm,
179
- ActiveOrders,
180
- AddressList,
181
- AppleLogin,
182
- BusinessesListing,
183
- BusinessProductsListing,
184
- CartContent,
185
- BusinessCart,
186
- Checkout,
187
- Favorite,
188
- FavoriteList,
171
+ AddressForm,
172
+ AddressDetails,
173
+ AnalyticsSegment,
174
+ Home as HomeView,
175
+ SignupForm,
176
+ LoginForm,
177
+ ActiveOrders,
178
+ AddressList,
179
+ AppleLogin,
180
+ BusinessesListing,
181
+ BusinessProductsListing,
182
+ CartContent,
183
+ BusinessCart,
184
+ Checkout,
185
+ Favorite,
186
+ FavoriteList,
189
187
  GPSButton,
190
- ForgotPasswordForm,
191
- MomentOption,
192
- OrdersOption,
193
- OrderDetails,
194
- OrderProgress,
195
- BusinessPreorder,
196
- NotificationsList,
197
- UserProfileForm,
198
- ReviewOrder,
199
- ReviewProducts,
200
- ReviewDriver,
201
- BusinessMenuList,
202
- UserProfile,
203
- MessageListing,
204
- Messages,
205
- Help,
206
- HelpAccountAndPayment,
207
- HelpGuide,
208
- HelpOrder,
209
- MultiCheckout,
210
- MultiOrdersDetails,
211
- NetworkError,
212
- NotFoundSource,
213
- OrderTypeSelector,
214
- Wallets,
215
- PaymentOptionWallet,
216
- ProductForm,
217
- UpsellingProducts,
218
- UserVerification,
219
- BusinessListingSearch,
220
- BusinessBasicInformation,
221
- BusinessProductsCategories,
222
- BusinessProductsList,
223
- FloatingButton,
224
- SearchBar,
225
- LastOrders,
226
- BusinessTypeFilter,
227
- BusinessController,
228
- BusinessFeaturedController,
229
- HighestRatedBusinesses,
230
- PaymentOptions,
231
- DriverTips,
232
- UserDetails,
233
- OrderSummary,
234
- OrderItAgain,
235
- CartStoresListing,
236
- PaymentOptionsWebView,
237
- GoogleMap,
238
- SingleProductCard,
239
- SingleOrderCard,
240
- UpsellingRedirect,
241
- ProductItemAccordion,
242
- ScheduleAccordion,
243
- BusinessItemAccordion,
244
- CouponControl,
245
- TaxInformation,
246
- PlaceSpot,
247
- ProfessionalFilter,
248
- ServiceForm,
249
- ProfessionalProfile,
250
- MomentSelector,
251
- Cart,
252
- LanguageSelector,
253
- PhoneInputNumber,
254
- FacebookLogin,
255
- VerifyPhone,
256
- GoogleLogin,
257
- PreviousOrders,
258
- PaymentOptionCash,
259
- StripeElementsForm,
260
- StripeCardsList,
261
- ProductIngredient,
262
- ProductOption,
263
- ProductOptionSubOption,
188
+ ForgotPasswordForm,
189
+ MomentOption,
190
+ OrdersOption,
191
+ OrderDetails,
192
+ OrderProgress,
193
+ BusinessPreorder,
194
+ NotificationsList,
195
+ UserProfileForm,
196
+ ReviewOrder,
197
+ ReviewProducts,
198
+ ReviewDriver,
199
+ BusinessMenuList,
200
+ UserProfile,
201
+ MessageListing,
202
+ Messages,
203
+ Help,
204
+ HelpOptions,
205
+ MultiCheckout,
206
+ MultiOrdersDetails,
207
+ NetworkError,
208
+ NotFoundSource,
209
+ OrderTypeSelector,
210
+ Wallets,
211
+ PaymentOptionWallet,
212
+ ProductForm,
213
+ UpsellingProducts,
214
+ UserVerification,
215
+ BusinessListingSearch,
216
+ BusinessBasicInformation,
217
+ BusinessProductsCategories,
218
+ BusinessProductsList,
219
+ FloatingButton,
220
+ SearchBar,
221
+ LastOrders,
222
+ BusinessTypeFilter,
223
+ BusinessController,
224
+ BusinessFeaturedController,
225
+ HighestRatedBusinesses,
226
+ PaymentOptions,
227
+ DriverTips,
228
+ UserDetails,
229
+ OrderSummary,
230
+ OrderItAgain,
231
+ CartStoresListing,
232
+ PaymentOptionsWebView,
233
+ GoogleMap,
234
+ SingleProductCard,
235
+ SingleOrderCard,
236
+ UpsellingRedirect,
237
+ ProductItemAccordion,
238
+ ScheduleAccordion,
239
+ BusinessItemAccordion,
240
+ CouponControl,
241
+ TaxInformation,
242
+ PlaceSpot,
243
+ ProfessionalFilter,
244
+ ServiceForm,
245
+ ProfessionalProfile,
246
+ MomentSelector,
247
+ Cart,
248
+ LanguageSelector,
249
+ PhoneInputNumber,
250
+ FacebookLogin,
251
+ VerifyPhone,
252
+ GoogleLogin,
253
+ PreviousOrders,
254
+ PaymentOptionCash,
255
+ StripeElementsForm,
256
+ StripeCardsList,
257
+ ProductIngredient,
258
+ ProductOption,
259
+ ProductOptionSubOption,
264
260
  SendGiftCard,
265
- Sessions,
266
- SingleProductReview,
267
- LogoutButton,
268
- UserFormDetailsUI,
269
- WalletTransactionItem,
270
- Promotions,
271
- PageBanner,
272
- MyOrders,
273
- MultiCart,
274
- WebsocketStatus,
275
- ORDER_TYPES,
276
- USER_TYPE,
261
+ Sessions,
262
+ SingleProductReview,
263
+ LogoutButton,
264
+ UserFormDetailsUI,
265
+ WalletTransactionItem,
266
+ Promotions,
267
+ PageBanner,
268
+ MyOrders,
269
+ MultiCart,
270
+ WebsocketStatus,
271
+ ORDER_TYPES,
272
+ USER_TYPE,
277
273
 
278
- OSBill,
279
- OSTable,
280
- OSCoupon,
281
- OSTotal,
282
- OSRow,
274
+ OSBill,
275
+ OSTable,
276
+ OSCoupon,
277
+ OSTotal,
278
+ OSRow,
283
279
 
284
- FormInput,
285
- FormSide,
286
- ButtonsWrapper,
287
- LoginWith,
288
- OTab,
289
- OTabs,
280
+ FormInput,
281
+ FormSide,
282
+ ButtonsWrapper,
283
+ LoginWith,
284
+ OTab,
285
+ OTabs,
290
286
 
291
- OSItem,
292
- OSItemContent,
293
- OSItemActions,
287
+ OSItem,
288
+ OSItemContent,
289
+ OSItemActions,
294
290
 
295
- Alert,
291
+ Alert,
296
292
 
297
- //Types
298
- LoginParams,
299
- ProfileParams,
300
- AddressListParams,
301
- AddressFormParams,
302
- SignupParams,
303
- PhoneInputParams,
304
- LanguageSelectorParams,
305
- BusinessesListingParams,
306
- HighestRatedBusinessesParams,
307
- BusinessTypeFilterParams,
308
- BusinessControllerParams,
309
- BusinessProductsListingParams,
310
- BusinessBasicInformationParams,
311
- BusinessProductsCategoriesParams,
312
- BusinessProductsListParams,
313
- SingleProductCardParams,
314
- BusinessInformationParams,
315
- BusinessReviewsParams,
316
- SearchBarParams,
317
- NotFoundSourceParams,
318
- OrdersOptionParams,
319
- ActiveOrdersParams,
320
- PreviousOrdersParams,
321
- OrderDetailsParams,
322
- ReviewDriverParams,
293
+ //Types
294
+ LoginParams,
295
+ ProfileParams,
296
+ AddressListParams,
297
+ AddressFormParams,
298
+ SignupParams,
299
+ PhoneInputParams,
300
+ LanguageSelectorParams,
301
+ BusinessesListingParams,
302
+ HighestRatedBusinessesParams,
303
+ BusinessTypeFilterParams,
304
+ BusinessControllerParams,
305
+ BusinessProductsListingParams,
306
+ BusinessBasicInformationParams,
307
+ BusinessProductsCategoriesParams,
308
+ BusinessProductsListParams,
309
+ SingleProductCardParams,
310
+ BusinessInformationParams,
311
+ BusinessReviewsParams,
312
+ SearchBarParams,
313
+ NotFoundSourceParams,
314
+ OrdersOptionParams,
315
+ ActiveOrdersParams,
316
+ PreviousOrdersParams,
317
+ OrderDetailsParams,
318
+ ReviewDriverParams,
323
319
 
324
- // OComponents
325
- Toast,
326
- OText,
327
- OButton,
328
- OInput,
329
- ODropDown,
330
- OIcon,
331
- OIconText,
332
- OIconButton,
333
- OTextarea,
334
- OToggle,
335
- OKeyButton,
336
- OAlert,
337
- OModal,
338
- OBottomPopup,
339
- HeaderTitle,
320
+ // OComponents
321
+ Toast,
322
+ OText,
323
+ OButton,
324
+ OInput,
325
+ ODropDown,
326
+ OIcon,
327
+ OIconText,
328
+ OIconButton,
329
+ OTextarea,
330
+ OToggle,
331
+ OKeyButton,
332
+ OAlert,
333
+ OModal,
334
+ OBottomPopup,
335
+ HeaderTitle,
340
336
 
341
- // layout
342
- Container,
343
- SafeAreaContainer,
344
- FloatingBottomContainer,
345
- NavBar,
337
+ // layout
338
+ Container,
339
+ SafeAreaContainer,
340
+ FloatingBottomContainer,
341
+ NavBar,
346
342
 
347
- // utils
348
- _retrieveStoreData,
349
- _setStoreData,
350
- _removeStoreData,
351
- _clearStoreData,
352
- orderTypeList,
343
+ // utils
344
+ _retrieveStoreData,
345
+ _setStoreData,
346
+ _removeStoreData,
347
+ _clearStoreData,
348
+ orderTypeList,
353
349
  getTraduction,
354
350
  verifyDecimals,
355
351
  getOrderStatus,
356
352
  getOrderStatuPickUp,
357
353
 
358
- // Date Picker
359
- DatePickerUI
354
+ // Date Picker
355
+ DatePickerUI
360
356
  }
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState } from 'react'
1
+ import React, { useEffect, useMemo, useState, useCallback } from 'react'
2
2
  import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
3
3
  import { ScrollView, StyleSheet, Dimensions, FlatList } from 'react-native'
4
4
  import { useTheme } from 'styled-components/native'
@@ -16,7 +16,6 @@ import {
16
16
  import FastImage from 'react-native-fast-image'
17
17
  import { convertHoursToMinutes } from '../../utils'
18
18
  import { BusinessSearchParams } from '../../types'
19
- import { useIsFocused } from '@react-navigation/native';
20
19
 
21
20
  import { BusinessSearchHeader } from './BusinessSearchHeader'
22
21
  import { BusinessSearchFooter } from './BusinessSearchFooter'
@@ -49,8 +48,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
49
48
 
50
49
  const [openFilters, setOpenFilters] = useState(false)
51
50
 
52
- const isFocused = useIsFocused();
53
-
54
51
  const styles = StyleSheet.create({
55
52
  productsContainer: {
56
53
  marginTop: 20
@@ -130,17 +127,16 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
130
127
  })
131
128
  }
132
129
 
133
- const handleScroll = ({ nativeEvent }: any) => {
130
+ const handleScroll = useCallback(({ nativeEvent }: any) => {
134
131
  const y = nativeEvent.contentOffset.y;
135
132
  const height = nativeEvent.contentSize.height;
136
133
  const hasMore = !(
137
134
  paginationProps.totalPages === paginationProps.currentPage
138
135
  );
139
-
140
- if (y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
136
+ if (height > 1000 && y + PIXELS_TO_SCROLL > height && !businessesSearchList.loading && hasMore && businessesSearchList?.businesses?.length > 0) {
141
137
  handleSearchbusinessAndProducts();
142
138
  }
143
- };
139
+ }, [businessesSearchList.loading, businessesSearchList?.businesses?.length]);
144
140
 
145
141
  const onChangeTermValue = (query: any) => {
146
142
  handleChangeTermValue(query)
@@ -159,11 +155,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
159
155
  handleSearchbusinessAndProducts(true)
160
156
  }, [])
161
157
 
162
-
163
- useEffect(() => {
164
- handleChangeTermValue('')
165
- }, [isFocused])
166
-
167
158
  const businessFiltered = useMemo(() => {
168
159
  return businessesSearchList.businesses?.filter((business: any) => business?.categories?.length > 0)
169
160
  }, [businessesSearchList.businesses])
@@ -0,0 +1,76 @@
1
+ import React, { useState, useEffect } from 'react'
2
+ import PropTypes from 'prop-types'
3
+ import { useApi } from 'ordering-components/native'
4
+
5
+ /**
6
+ * Component to manage login behavior without UI component
7
+ */
8
+ export const CmsContent = (props: any) => {
9
+ const { UIComponent } = props
10
+
11
+ /**
12
+ * Array to save the body of the page
13
+ */
14
+ const [ordering] = useApi()
15
+ const [cmsState, setCmsState] = useState({ items: [], pages: [], loading: true, error: null })
16
+
17
+ /**
18
+ * Method used to get the page by slug
19
+ */
20
+ const getPages = async () => {
21
+ setCmsState({ ...cmsState, loading: true })
22
+ try {
23
+ const propsToFetch = ['name', 'enabled']
24
+ let pages: any = []
25
+ const { content: { error, result } } = await ordering.pages().select(propsToFetch).get()
26
+ if (!error) {
27
+ const promises = result.map((item: any) => getPage(item.id));
28
+ pages = await Promise.all(promises)
29
+ }
30
+ setCmsState({
31
+ ...cmsState,
32
+ loading: false,
33
+ error: error ? typeof result === 'string' ? result : result[0] : null,
34
+ items: error ? [] : result.filter((i: any) => i.enabled).map((item: any) => ({ id: item.id, name: item.name })),
35
+ pages
36
+ })
37
+ } catch (err: any) {
38
+ setCmsState({
39
+ ...cmsState,
40
+ loading: false,
41
+ error: err?.message ?? err
42
+ })
43
+ }
44
+ }
45
+
46
+ const getPage = async (id: number) => {
47
+ try {
48
+ const { content: { error, result } } = await ordering.pages(id).get()
49
+ return error ? null : { id, body: result?.body }
50
+ } catch {
51
+ return null
52
+ }
53
+ }
54
+
55
+ useEffect(() => {
56
+ getPages()
57
+ }, [])
58
+
59
+ return (
60
+ <>
61
+ {UIComponent && (
62
+ <UIComponent
63
+ {...props}
64
+ cmsState={cmsState}
65
+ />
66
+ )}
67
+ </>
68
+ )
69
+ }
70
+
71
+ CmsContent.propTypes = {
72
+ /**
73
+ * UI Component, this must be containt all graphic elements and use parent props
74
+ */
75
+ UIComponent: PropTypes.elementType
76
+ }