ordering-ui-react-native 0.16.58-release → 0.16.59-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.
package/package.json
CHANGED
|
@@ -96,10 +96,15 @@ const NewOrderNotificationUI = (props: any) => {
|
|
|
96
96
|
events.on('message_added_notification', (o: any) => handleEventNotification(1, o))
|
|
97
97
|
events.on('order_added_notification', (o: any) => handleEventNotification(2, o))
|
|
98
98
|
events.on('order_updated_notification', (o: any) => handleEventNotification(3, o))
|
|
99
|
+
events.on('request_register_notification', (o: any) => handleEventNotification(2, o))
|
|
100
|
+
events.on('request_update_notification', (o: any) => handleEventNotification(3, o))
|
|
101
|
+
|
|
99
102
|
return () => {
|
|
100
103
|
events.off('message_added_notification', (o: any) => handleEventNotification(1, o))
|
|
101
104
|
events.off('order_added_notification', (o: any) => handleEventNotification(2, o))
|
|
102
105
|
events.off('order_updated_notification', (o: any) => handleEventNotification(3, o))
|
|
106
|
+
events.off('request_register_notification', (o: any) => handleEventNotification(2, o))
|
|
107
|
+
events.off('request_update_notification', (o: any) => handleEventNotification(3, o))
|
|
103
108
|
}
|
|
104
109
|
}, [])
|
|
105
110
|
|
|
@@ -191,7 +191,8 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
191
191
|
|
|
192
192
|
const isInteger = (val: any) => Number.isInteger(Number(val)) && !!val
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
|
|
195
|
+
const onProductClick = (business: any, categoryId: any, productId: any, product: any) => {
|
|
195
196
|
if (!isInteger(business?.id) ||
|
|
196
197
|
!isInteger(categoryId) ||
|
|
197
198
|
!isInteger(productId) ||
|
|
@@ -199,17 +200,20 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
199
200
|
showToast(ToastType.error, t('NOT_AVAILABLE', 'Not Available'))
|
|
200
201
|
return
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
+
const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
|
|
204
|
+
const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === productId ? Cproduct?.quantity : 0) }, 0) || 0
|
|
203
205
|
navigation.navigate('ProductDetails', {
|
|
204
206
|
isRedirect: 'business',
|
|
205
207
|
businessId: business?.id,
|
|
206
208
|
categoryId: categoryId,
|
|
207
209
|
productId: productId,
|
|
210
|
+
product: product,
|
|
208
211
|
business: {
|
|
209
212
|
store: business.slug,
|
|
210
213
|
header: business.header,
|
|
211
214
|
logo: business.logo,
|
|
212
|
-
}
|
|
215
|
+
},
|
|
216
|
+
productAddedToCartLength
|
|
213
217
|
})
|
|
214
218
|
}
|
|
215
219
|
|
|
@@ -293,7 +297,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
293
297
|
/>
|
|
294
298
|
</View>
|
|
295
299
|
))}
|
|
296
|
-
{console.log(screenWidth)}
|
|
297
300
|
{!businessesSearchList.loading && paginationProps?.totalPages && paginationProps?.currentPage < paginationProps?.totalPages && (
|
|
298
301
|
<LoadMoreBusinessContainer>
|
|
299
302
|
<OButton
|
|
@@ -361,7 +364,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
|
|
|
361
364
|
product={product}
|
|
362
365
|
enableIntersection={false}
|
|
363
366
|
businessId={business?.id}
|
|
364
|
-
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id)}
|
|
367
|
+
onProductClick={(product: any) => onProductClick(business, category?.id, product?.id, product)}
|
|
365
368
|
productAddedToCartLength={0}
|
|
366
369
|
handleUpdateProducts={(productId: number, changes: any) => handleUpdateProducts(productId, category?.id, business?.id, changes)}
|
|
367
370
|
style={{ width: screenWidth - 80, maxWidth: screenWidth - 80, marginRight: 20 }}
|
|
@@ -213,7 +213,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
213
213
|
showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
|
|
214
214
|
return
|
|
215
215
|
}
|
|
216
|
-
const isErrors = Object.values(errors)
|
|
216
|
+
const isErrors = Object.values(errors)?.length > 0;
|
|
217
217
|
if (!isErrors) {
|
|
218
218
|
handleSave && handleSave();
|
|
219
219
|
return;
|
|
@@ -232,7 +232,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
const handleChangeMainIndex = (index: number) => {
|
|
235
|
-
if (index < 0 || index > gallery
|
|
235
|
+
if (index < 0 || index > gallery?.length - 1) {
|
|
236
236
|
setThumbsSwiper(0)
|
|
237
237
|
return
|
|
238
238
|
}
|
|
@@ -275,7 +275,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
const scrollDown = (id: any) => {
|
|
278
|
-
const isErrors = Object.values(errors)
|
|
278
|
+
const isErrors = Object.values(errors)?.length > 0
|
|
279
279
|
if (!isErrors) {
|
|
280
280
|
return
|
|
281
281
|
}
|
|
@@ -299,7 +299,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
299
299
|
const saveErrors =
|
|
300
300
|
orderState.loading ||
|
|
301
301
|
maxProductQuantity === 0 ||
|
|
302
|
-
Object.keys(errors)
|
|
302
|
+
Object.keys(errors)?.length > 0;
|
|
303
303
|
|
|
304
304
|
|
|
305
305
|
const ExtraOptions = ({ eID, options }: any) => (
|
|
@@ -366,14 +366,14 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
366
366
|
? product.images
|
|
367
367
|
: theme?.images?.dummies?.product)
|
|
368
368
|
|
|
369
|
-
if (product?.gallery && product?.gallery
|
|
369
|
+
if (product?.gallery && product?.gallery?.length > 0) {
|
|
370
370
|
for (const img of product?.gallery) {
|
|
371
371
|
if (img?.file) {
|
|
372
372
|
imageList.push(img?.file)
|
|
373
373
|
}
|
|
374
374
|
if (img?.video) {
|
|
375
375
|
const keys = img?.video.split('/')
|
|
376
|
-
let _videoId = keys[keys
|
|
376
|
+
let _videoId = keys[keys?.length - 1]
|
|
377
377
|
|
|
378
378
|
if (_videoId.includes('watch')) {
|
|
379
379
|
const __url = _videoId.split('=')[1]
|
|
@@ -388,7 +388,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
388
388
|
} else if (_videoId.search(/\?/i) >= 0) {
|
|
389
389
|
_videoId = _videoId.split('?')[0]
|
|
390
390
|
}
|
|
391
|
-
if ((_videoId
|
|
391
|
+
if ((_videoId?.length === 11)) {
|
|
392
392
|
videoList.push(_videoId)
|
|
393
393
|
}
|
|
394
394
|
}
|
|
@@ -539,7 +539,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
539
539
|
</View>
|
|
540
540
|
}
|
|
541
541
|
>
|
|
542
|
-
{gallery && gallery
|
|
542
|
+
{gallery && gallery?.length > 0 && gallery.map((img, i) => (
|
|
543
543
|
<View
|
|
544
544
|
style={styles.slide1}
|
|
545
545
|
key={i}
|
|
@@ -574,7 +574,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
574
574
|
paddingVertical: 15
|
|
575
575
|
}}
|
|
576
576
|
>
|
|
577
|
-
{gallery
|
|
577
|
+
{gallery?.length > 0 && gallery.map((img, index) => (
|
|
578
578
|
<TouchableOpacity
|
|
579
579
|
key={index}
|
|
580
580
|
onPress={() => handleClickThumb(index)}
|
|
@@ -729,7 +729,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
729
729
|
backgroundColor: theme.colors.backgroundPage,
|
|
730
730
|
}}
|
|
731
731
|
>
|
|
732
|
-
{product?.ingredients
|
|
732
|
+
{product?.ingredients?.length > 0 && (
|
|
733
733
|
<TouchableOpacity
|
|
734
734
|
key={`eopt_key_01`}
|
|
735
735
|
onPress={() => {
|
|
@@ -754,7 +754,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
754
754
|
</OText>
|
|
755
755
|
</TouchableOpacity>
|
|
756
756
|
)}
|
|
757
|
-
{product?.extras
|
|
757
|
+
{product?.extras?.map((extra: any) =>
|
|
758
758
|
<ExtraOptions key={extra.id} options={extra.options} />
|
|
759
759
|
)}
|
|
760
760
|
</ExtraOptionWrap>
|
|
@@ -805,7 +805,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
805
805
|
}}
|
|
806
806
|
>
|
|
807
807
|
<>
|
|
808
|
-
{product?.ingredients
|
|
808
|
+
{product?.ingredients?.length > 0 && (
|
|
809
809
|
<View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
|
|
810
810
|
<SectionTitle>
|
|
811
811
|
<OText size={16}>
|
|
@@ -827,8 +827,8 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
827
827
|
</WrapperIngredients>
|
|
828
828
|
</View>
|
|
829
829
|
)}
|
|
830
|
-
{product?.extras
|
|
831
|
-
extra.options
|
|
830
|
+
{product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
|
|
831
|
+
extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
|
|
832
832
|
const currentState =
|
|
833
833
|
productCart.options[`id:${option.id}`] || {};
|
|
834
834
|
return (
|
|
@@ -844,7 +844,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
844
844
|
backgroundColor: isError(option.id),
|
|
845
845
|
borderRadius: 7.6
|
|
846
846
|
}}>
|
|
847
|
-
{option
|
|
847
|
+
{option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
|
|
848
848
|
(suboption: any) => {
|
|
849
849
|
const currentState =
|
|
850
850
|
productCart.options[
|
|
@@ -909,7 +909,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
909
909
|
)}
|
|
910
910
|
</ProductEditions>
|
|
911
911
|
)}
|
|
912
|
-
{!!error && error
|
|
912
|
+
{!!error && error?.length > 0 && (
|
|
913
913
|
<NotFoundSource content={error[0]?.message || error[0]} />
|
|
914
914
|
)}
|
|
915
915
|
</ScrollView>
|