From e6519c301f0874ace3dbb6d1edcf02e850511f7c Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Tue, 9 Jun 2026 22:19:56 +0200 Subject: [PATCH] fix(catalog): honor skip purchase confirmation setting Wire both classic and modern catalog purchase widgets to the shared catalogSkipPurchaseConfirmation setting used by User Settings. When enabled, the primary buy/rent button now calls the purchase flow directly instead of first switching to the CONFIRM state. Existing validation, gift purchases, club checks, limited sold-out handling, and Builders Club placement flows remain unchanged. --- .../views/page/widgets/CatalogPurchaseWidgetView.tsx | 9 ++++----- .../views/page/widgets/CatalogPurchaseWidgetView.tsx | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/catalog-modern/views/page/widgets/CatalogPurchaseWidgetView.tsx b/src/components/catalog-modern/views/page/widgets/CatalogPurchaseWidgetView.tsx index e04cac0..473f469 100644 --- a/src/components/catalog-modern/views/page/widgets/CatalogPurchaseWidgetView.tsx +++ b/src/components/catalog-modern/views/page/widgets/CatalogPurchaseWidgetView.tsx @@ -1,9 +1,9 @@ import { CreateLinkEvent, PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { BuilderFurniPlaceableStatus, CatalogPurchaseState, CatalogType, DispatchUiEvent, GetClubMemberLevel, LocalStorageKeys, LocalizeText, NotificationBubbleType, Offer, ProductTypeEnum, SendMessageComposer } from '../../../../../api'; +import { BuilderFurniPlaceableStatus, CatalogPurchaseState, CatalogType, DispatchUiEvent, GetClubMemberLevel, LocalizeText, NotificationBubbleType, Offer, ProductTypeEnum, SendMessageComposer } from '../../../../../api'; import { Button, LayoutLoadingSpinnerView, Text } from '../../../../../common'; import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogPurchasedEvent } from '../../../../../events'; -import { useCatalogActions, useCatalogData, useCatalogUiState, useLocalStorage, useNotification, usePurse, useUiEvent } from '../../../../../hooks'; +import { useCatalogActions, useCatalogData, useCatalogSkipPurchaseConfirmation, useCatalogUiState, useNotification, usePurse, useUiEvent } from '../../../../../hooks'; interface CatalogPurchaseWidgetViewProps { @@ -17,9 +17,8 @@ export const CatalogPurchaseWidgetView: FC = pro { const { noGiftOption = false, purchaseCallback = null } = props; const [ builderPlaceableRefreshTick, setBuilderPlaceableRefreshTick ] = useState(0); - const [ purchaseWillBeGift, setPurchaseWillBeGift ] = useState(false); const [ purchaseState, setPurchaseState ] = useState(CatalogPurchaseState.NONE); - const [ catalogSkipPurchaseConfirmation, setCatalogSkipPurchaseConfirmation ] = useLocalStorage(LocalStorageKeys.CATALOG_SKIP_PURCHASE_CONFIRMATION, false); + const [ catalogSkipPurchaseConfirmation ] = useCatalogSkipPurchaseConfirmation(); const { currentOffer = null, currentPage = null } = useCatalogData(); const { currentType = CatalogType.NORMAL, purchaseOptions = null, setPurchaseOptions = null, setCatalogPlaceMultipleObjects = null } = useCatalogUiState(); const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null, getNodesByOfferId = null } = useCatalogActions(); @@ -240,7 +239,7 @@ export const CatalogPurchaseWidgetView: FC = pro return ; case CatalogPurchaseState.NONE: default: - return ; + return ; } }; diff --git a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx index fb45da8..3dd2111 100644 --- a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx @@ -1,9 +1,9 @@ import { CreateLinkEvent, PurchaseFromCatalogComposer } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useMemo, useState } from 'react'; -import { BuilderFurniPlaceableStatus, CatalogPurchaseState, CatalogType, DispatchUiEvent, GetClubMemberLevel, LocalStorageKeys, LocalizeText, NotificationBubbleType, Offer, ProductTypeEnum, SendMessageComposer } from '../../../../../api'; +import { BuilderFurniPlaceableStatus, CatalogPurchaseState, CatalogType, DispatchUiEvent, GetClubMemberLevel, LocalizeText, NotificationBubbleType, Offer, ProductTypeEnum, SendMessageComposer } from '../../../../../api'; import { Button, LayoutLoadingSpinnerView, Text } from '../../../../../common'; import { CatalogEvent, CatalogInitGiftEvent, CatalogPurchaseFailureEvent, CatalogPurchaseNotAllowedEvent, CatalogPurchaseSoldOutEvent, CatalogPurchasedEvent } from '../../../../../events'; -import { useCatalogActions, useCatalogData, useCatalogUiState, useLocalStorage, useNotification, usePurse, useUiEvent } from '../../../../../hooks'; +import { useCatalogActions, useCatalogData, useCatalogSkipPurchaseConfirmation, useCatalogUiState, useNotification, usePurse, useUiEvent } from '../../../../../hooks'; interface CatalogPurchaseWidgetViewProps { @@ -17,9 +17,8 @@ export const CatalogPurchaseWidgetView: FC = pro { const { noGiftOption = false, purchaseCallback = null } = props; const [ builderPlaceableRefreshTick, setBuilderPlaceableRefreshTick ] = useState(0); - const [ purchaseWillBeGift, setPurchaseWillBeGift ] = useState(false); const [ purchaseState, setPurchaseState ] = useState(CatalogPurchaseState.NONE); - const [ catalogSkipPurchaseConfirmation, setCatalogSkipPurchaseConfirmation ] = useLocalStorage(LocalStorageKeys.CATALOG_SKIP_PURCHASE_CONFIRMATION, false); + const [ catalogSkipPurchaseConfirmation ] = useCatalogSkipPurchaseConfirmation(); const { currentOffer = null, currentPage = null } = useCatalogData(); const { currentType = CatalogType.NORMAL, purchaseOptions = null, setPurchaseOptions = null, setCatalogPlaceMultipleObjects = null } = useCatalogUiState(); const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null, getNodesByOfferId = null } = useCatalogActions(); @@ -242,7 +241,7 @@ export const CatalogPurchaseWidgetView: FC = pro return ; case CatalogPurchaseState.NONE: default: - return ; + return ; } };