ordering-ui-react-native 0.21.71 → 0.21.72

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.21.71",
3
+ "version": "0.21.72",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -170,12 +170,12 @@ const CheckoutUI = (props: any) => {
170
170
  const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
171
171
  const [showTitle, setShowTitle] = useState(false)
172
172
  const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
173
+ const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
173
174
  const containerRef = useRef<any>()
174
175
  const cardsMethods = ['credomatic']
175
176
  const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
176
177
  const placeSpotTypes = [3, 4, 5]
177
178
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
178
- const isGiftCardCart = !cart?.business_id
179
179
  const businessConfigs = businessDetails?.business?.configs ?? []
180
180
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
181
181
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -359,11 +359,21 @@ const CheckoutUI = (props: any) => {
359
359
  if (cart?.products?.length === 0) {
360
360
  if (cart?.business_id !== null) {
361
361
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
362
- } else {
362
+ } else if (isGiftCardCart) {
363
363
  onNavigationRedirect('Wallets')
364
364
  }
365
365
  }
366
- }, [cart?.products])
366
+ }, [cart?.products?.length])
367
+
368
+ useEffect(() => {
369
+ if (cart?.products?.length > 0) {
370
+ if (cart?.uuid && cart?.business_id === null) {
371
+ setIsGiftCardCart(true)
372
+ } else {
373
+ setIsGiftCardCart(false)
374
+ }
375
+ }
376
+ }, [cart?.uuid, cart?.products?.length])
367
377
 
368
378
  useEffect(() => {
369
379
  onFailPaypal()