ordering-ui-react-native 0.22.15 → 0.22.17

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.22.15",
3
+ "version": "0.22.17",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -23,8 +23,7 @@ export const AnalyticsSegment = (props: any) => {
23
23
  segmentClient.track('Product List Viewed', {
24
24
  business_id: category?.business_id,
25
25
  category_id: category?.id,
26
- category: category?.name,
27
- products: category?.products
26
+ category: category?.name
28
27
  })
29
28
  }
30
29
 
@@ -62,11 +61,12 @@ export const AnalyticsSegment = (props: any) => {
62
61
  })
63
62
  }
64
63
 
65
- const handleProductAdded = (product: any) => {
64
+ const handleProductAdded = (product: any, result: any) => {
66
65
  segmentClient.track('Product Added', {
67
- id: product.id,
66
+ cart_id: result.uuid,
67
+ product_id: product.id,
68
68
  name: product.name,
69
- category: product.category_id,
69
+ category: product.category_id || product?.categoryId,
70
70
  price: product.price,
71
71
  quantity: product.quantity
72
72
  })
@@ -101,7 +101,7 @@ export const AnalyticsSegment = (props: any) => {
101
101
 
102
102
  const handleOrderPlaced = (order: any) => {
103
103
  segmentClient.track('Order Placed', {
104
- id: order.id,
104
+ order_id: order.id,
105
105
  affiliation: order.business?.name,
106
106
  revenue: order.total,
107
107
  tax: order.tax_total,
@@ -232,7 +232,7 @@ export const BusinessControllerUI = React.memo((props: BusinessControllerParams)
232
232
  </View>
233
233
  )}
234
234
  {!hideBusinessOffer && (
235
- getBusinessOffer((business?.offers)) &&
235
+ !!getBusinessOffer((business?.offers)) &&
236
236
  <OfferBox
237
237
  isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
238
238
  isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
@@ -244,7 +244,7 @@ export const BusinessControllerUI = React.memo((props: BusinessControllerParams)
244
244
  numberOfLines={2}
245
245
  ellipsizeMode='tail'
246
246
  lineHeight={13}
247
- >{t('DISCOUNT', 'Discount')}{' '}{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
247
+ >{t('DISCOUNT', 'Discount')}{' '}{getBusinessOffer((business?.offers))}</OText>
248
248
  </OfferBox>
249
249
  )}
250
250
  <BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
@@ -381,6 +381,14 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
381
381
  setViewedCategory(_viewedCategory)
382
382
  events.emit('product_list_viewed', _viewedCategory)
383
383
  }
384
+ } else {
385
+ if (business.categories) {
386
+ const categoryAll: any = {}
387
+ categoryAll.business_id = business.id
388
+ categoryAll.id = null
389
+ categoryAll.name = 'All'
390
+ events.emit('product_list_viewed', categoryAll)
391
+ }
384
392
  }
385
393
  }, [business?.lazy_load_products_recommended, selectedCategoryId, categorySelected?.id, viewedCategory])
386
394