ordering-ui-react-native 0.16.81 → 0.16.83

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.81",
3
+ "version": "0.16.83",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -364,6 +364,7 @@ export const OrderContentComponent = (props: OrderContent) => {
364
364
  <ProductItemAccordion
365
365
  key={product?.id || i}
366
366
  product={product}
367
+ currency={order?.currency}
367
368
  />
368
369
  ))}
369
370
  </OrderProducts>
@@ -28,6 +28,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
28
28
  getProductMax,
29
29
  onDeleteProduct,
30
30
  onEditProduct,
31
+ currency
31
32
  } = props;
32
33
 
33
34
  const [, t] = useLanguage();
@@ -147,7 +148,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
147
148
  }}>
148
149
  <View style={{ flexDirection: 'row' }}>
149
150
  <OText size={12} color={theme.colors.textGray}>
150
- {parsePrice(getProductPrice(product))}
151
+ {parsePrice(getProductPrice(product), { currency })}
151
152
  </OText>
152
153
 
153
154
  {(
@@ -268,7 +269,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
268
269
  suboption.position,
269
270
  )
270
271
  : '',
271
- price: parsePrice(suboption.price),
272
+ price: parsePrice(suboption.price, { currency }),
272
273
  })}
273
274
  </OText>
274
275
  </ProductSubOption>
@@ -393,6 +393,7 @@ export interface ProductItemAccordionParams {
393
393
  offsetDisabled?: any;
394
394
  isFromCheckout?: any;
395
395
  isClickableEvent?: any;
396
+ currency?: any;
396
397
  }
397
398
  export interface ReviewOrderParams {
398
399
  order?: { orderId: number; businessId: number; logo: string };
@@ -103,7 +103,10 @@ export const BusinessBasicInformation = (
103
103
  height: 12,
104
104
  width: 12,
105
105
  margin: 0,
106
- padding: 0
106
+ padding: 0,
107
+ display: 'flex',
108
+ justifyContent: 'center',
109
+ alignItems: 'center'
107
110
  },
108
111
  headerChewStyle: {
109
112
  paddingHorizontal: 30,
@@ -221,7 +224,8 @@ export const BusinessBasicInformation = (
221
224
  <View style={styles.tiktokIcon}>
222
225
  <OIcon
223
226
  src={theme.images.general.tiktok}
224
- style={{ width: '100%', height: '100%' }}
227
+ style={{ width: 10, height: 12 }}
228
+ cover
225
229
  />
226
230
  </View>
227
231
  </Pressable>
@@ -329,10 +329,10 @@ const CheckoutUI = (props: any) => {
329
329
  !businessDetails?.error &&
330
330
  (
331
331
  <Placeholder Animation={Fade}>
332
- <PlaceholderLine height={20} width={70} />
333
- <PlaceholderLine height={10} width={60} />
334
- <PlaceholderLine height={10} width={60} />
335
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
332
+ <PlaceholderLine height={20} />
333
+ <PlaceholderLine height={12} />
334
+ <PlaceholderLine height={12} />
335
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
336
336
  </Placeholder>
337
337
  )}
338
338
  {
@@ -378,10 +378,10 @@ const CheckoutUI = (props: any) => {
378
378
  <ChUserDetails>
379
379
  {cartState.loading ? (
380
380
  <Placeholder Animation={Fade}>
381
- <PlaceholderLine height={20} width={70} />
382
- <PlaceholderLine height={10} width={60} />
383
- <PlaceholderLine height={10} width={60} />
384
- <PlaceholderLine height={10} width={80} style={{ marginBottom: 20 }} />
381
+ <PlaceholderLine height={20} />
382
+ <PlaceholderLine height={12} />
383
+ <PlaceholderLine height={12} />
384
+ <PlaceholderLine height={12} style={{ marginBottom: 20 }} />
385
385
  </Placeholder>
386
386
  ) : (
387
387
  <UserDetails
@@ -405,8 +405,8 @@ const CheckoutUI = (props: any) => {
405
405
  {cartState.loading || deliveryOptionSelected === undefined ? (
406
406
  <View style={{ height: 110 }}>
407
407
  <Placeholder Animation={Fade}>
408
- <PlaceholderLine height={20} width={70} />
409
- <PlaceholderLine height={40} width={100} />
408
+ <PlaceholderLine height={20} />
409
+ <PlaceholderLine height={40} />
410
410
  </Placeholder>
411
411
  </View>
412
412
  ) : (
@@ -818,16 +818,23 @@ export const Checkout = (props: any) => {
818
818
 
819
819
  const getOrder = async (cartId: any) => {
820
820
  try {
821
- setCartState({ ...cartState, loading: true })
822
- const url = `${ordering.root}/carts/${cartId}`
823
- const response = await fetch(url, {
824
- method: 'GET',
825
- headers: {
826
- 'Content-Type': 'application/json',
827
- Authorization: `Bearer ${token}`
828
- }
829
- })
830
- const { result } = await response.json();
821
+ let result: any = {}
822
+ const cart = orderState?.carts.find((cart: any) => cart.uuid === cartId)
823
+ if (cart) {
824
+ result = { ...cart }
825
+ } else {
826
+ setCartState({ ...cartState, loading: true })
827
+ const url = `${ordering.root}/carts/${cartId}`
828
+ const response = await fetch(url, {
829
+ method: 'GET',
830
+ headers: {
831
+ 'Content-Type': 'application/json',
832
+ Authorization: `Bearer ${token}`
833
+ }
834
+ })
835
+ const content = await response.json();
836
+ result = content.result
837
+ }
831
838
 
832
839
  let publicKey = null
833
840
  try {
@@ -141,7 +141,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
141
141
 
142
142
  useFocusEffect(
143
143
  React.useCallback(() => {
144
- loadOrders(false, false, false, true)
144
+ if (!businessesSearchList) {
145
+ loadOrders(false, false, false, true)
146
+ }
145
147
  }, [navigation])
146
148
  )
147
149
 
@@ -102,6 +102,10 @@ const PlaceSpotUI = (props: PlaceSpotParams) => {
102
102
  showToast(ToastType.Error, t('VALIDATION_ERROR_INTEGER', 'The _attribute_ must be an integer.').replace('_attribute_', placeholderText))
103
103
  return
104
104
  }
105
+ if (Number(spotNumber) < 0) {
106
+ showToast(ToastType.Error, t('VALIDATION_MUST_BIGGER_ZERO', '_attribute_ must be bigger than zero').replace('_attribute_', placeholderText))
107
+ return
108
+ }
105
109
  const isVehicle = Object.values(vehicle).every(e => e)
106
110
  const bodyToSend: any = {}
107
111
  spotNumber && (bodyToSend.spot_number = spotNumber)
@@ -981,15 +981,15 @@ export const ProductOptionsUI = (props: any) => {
981
981
  <OText size={16} lineHeight={24} weight={'600'}>
982
982
  {productCart.total ? parsePrice(productCart?.total) : ''}
983
983
  </OText>
984
- {product?.minimum_per_order && productCart?.quantity < product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
985
- {product?.maximum_per_order && productCart?.quantity > product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
984
+ {product?.minimum_per_order && productCart?.quantity <= product?.minimum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MINIMUM_TO_ORDER', 'Min. _number_ ').replace('_number_', product?.minimum_per_order)}</OText>}
985
+ {product?.maximum_per_order && productCart?.quantity >= product?.maximum_per_order && <OText size={12} color={theme.colors?.red}>{t('MOBILE_MAXIMUM_TO_ORDER', 'Max. _number_'.replace('_number_', product?.maximum_per_order))}</OText>}
986
986
  </View>
987
987
  {productCart && !isSoldOut && maxProductQuantity > 0 && (
988
988
  <>
989
989
  <View style={styles.quantityControl}>
990
990
  <TouchableOpacity
991
991
  onPress={decrement}
992
- disabled={productCart.quantity === 1 || isSoldOut}>
992
+ disabled={productCart.quantity === 1 || !productCart.quantity || isSoldOut || (productCart?.quantity <= product?.minimum_per_order)}>
993
993
  <OIcon
994
994
  src={theme.images.general.minus}
995
995
  width={16}
@@ -1095,7 +1095,7 @@ export const ProductOptionsUI = (props: any) => {
1095
1095
  export const ProductForm = (props: any) => {
1096
1096
  const productOptionsProps = {
1097
1097
  ...props,
1098
- productCart: { quantity: props?.product?.maximum_per_order || 1 },
1098
+ productCart: { quantity: props?.product?.maximum_per_order || props?.product?.minimum_per_order || 1 },
1099
1099
  UIComponent: ProductOptionsUI,
1100
1100
  };
1101
1101