ordering-ui-react-native 0.16.78 → 0.16.80

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.16.78",
3
+ "version": "0.16.80",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -125,6 +125,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
125
125
  const [currentProduct, setCurrentProduct] = useState(null)
126
126
 
127
127
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
128
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
129
+
128
130
  const currentCart: any = Object.values(orderState.carts).find((cart: any) => cart?.business?.slug === business?.slug) ?? {}
129
131
  const isOpenFiltProducts = isOpenSearchBar && !!searchValue
130
132
  const filtProductsHeight = Platform.OS === 'ios' ? 0 : 100
@@ -151,7 +153,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
151
153
  }
152
154
 
153
155
  const handleUpsellingPage = () => {
154
- if (isCheckoutMultiBusinessEnabled) {
156
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
155
157
  onRedirect('CheckoutNavigator', {
156
158
  screen: 'MultiCheckout'
157
159
  })
@@ -62,6 +62,7 @@ const CartUI = (props: any) => {
62
62
  const isCartPending = cart?.status === 2
63
63
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled
64
64
  const isCheckoutMultiBusinessEnabled: Boolean = configs?.checkout_multi_business_enabled?.value === '1'
65
+ const openCarts = (Object.values(orderState?.carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && !cart?.wallets) || null) || []
65
66
 
66
67
  const business: any = (orderState?.carts && Object.values(orderState.carts).find((_cart: any) => _cart?.uuid === props.cartuuid)) ?? {}
67
68
  const businessId = business?.business_id ?? null
@@ -103,7 +104,7 @@ const CartUI = (props: any) => {
103
104
  const handleUpsellingPage = () => {
104
105
  setOpenUpselling(false)
105
106
  setCanOpenUpselling(false)
106
- if (isCheckoutMultiBusinessEnabled) {
107
+ if (isCheckoutMultiBusinessEnabled && openCarts.length > 1) {
107
108
  props.onNavigationRedirect('CheckoutNavigator', {
108
109
  screen: 'MultiCheckout'
109
110
  })
@@ -79,6 +79,7 @@ const MultiCheckoutUI = (props: any) => {
79
79
  const isPreOrder = configs?.preorder_status_enabled?.value === '1'
80
80
  const maximumCarts = 5
81
81
  const isDisablePlaceOrderButton = !(paymethodSelected?.paymethod_id || paymethodSelected?.wallet_id) || openCarts.length > maximumCarts
82
+ const walletCarts = (Object.values(carts)?.filter((cart: any) => cart?.products && cart?.products?.length && cart?.status !== 2 && cart?.valid_schedule && cart?.valid_products && cart?.valid_address && cart?.valid_maximum && cart?.valid_minimum && cart?.wallets) || null) || []
82
83
 
83
84
  const [isUserDetailsEdit, setIsUserDetailsEdit] = useState(false);
84
85
  const [phoneUpdate, setPhoneUpdate] = useState(false);
@@ -253,6 +254,11 @@ const MultiCheckoutUI = (props: any) => {
253
254
  </OText>
254
255
  </CCNotCarts>
255
256
  )}
257
+ {walletCarts.length > 0 && (
258
+ <OText size={14} color={theme.colors.danger5} style={{ marginVertical: 20 }}>
259
+ {t('WARNING_PARTIAL_WALLET_CARTS', 'Important: One or more carts can`t be completed due a partial payment with cash/points wallet and requires to be paid individually')}
260
+ </OText>
261
+ )}
256
262
  {openCarts.length > 0 && (
257
263
  <ChCartsTotal>
258
264
  <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
@@ -1031,6 +1031,7 @@ export const ProductOptionsUI = (props: any) => {
1031
1031
  disabled={
1032
1032
  maxProductQuantity <= 0 ||
1033
1033
  productCart.quantity >= maxProductQuantity ||
1034
+ productCart.quantity >= product?.maximum_per_order ||
1034
1035
  isSoldOut
1035
1036
  }>
1036
1037
  <OIcon
@@ -1039,6 +1040,7 @@ export const ProductOptionsUI = (props: any) => {
1039
1040
  color={
1040
1041
  maxProductQuantity <= 0 ||
1041
1042
  productCart.quantity >= maxProductQuantity ||
1043
+ productCart.quantity >= product?.maximum_per_order ||
1042
1044
  isSoldOut
1043
1045
  ? theme.colors.backgroundGray
1044
1046
  : theme.colors.backgroundDark
@@ -1093,7 +1095,7 @@ export const ProductOptionsUI = (props: any) => {
1093
1095
  export const ProductForm = (props: any) => {
1094
1096
  const productOptionsProps = {
1095
1097
  ...props,
1096
- productCart: { quantity: props?.product?.minimum_per_order || 1 },
1098
+ productCart: { quantity: props?.product?.maximum_per_order || 1 },
1097
1099
  UIComponent: ProductOptionsUI,
1098
1100
  };
1099
1101