mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
🆙 Fix Buy when search
This commit is contained in:
@@ -49,6 +49,7 @@ export const CatalogSearchView: FC<{}> = () =>
|
|||||||
|
|
||||||
const name = normalizeSearchText(furniture.name || '');
|
const name = normalizeSearchText(furniture.name || '');
|
||||||
const matchesSearch = name.includes(search);
|
const matchesSearch = name.includes(search);
|
||||||
|
const isBuyable = (furniture.purchaseOfferId > -1) || (furniture.rentOfferId > -1);
|
||||||
|
|
||||||
if((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1))
|
if((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1))
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,7 @@ export const CatalogSearchView: FC<{}> = () =>
|
|||||||
if(matchesSearch) foundFurniLines.push(furniture.furniLine);
|
if(matchesSearch) foundFurniLines.push(furniture.furniLine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(matchesSearch)
|
else if(matchesSearch && isBuyable)
|
||||||
{
|
{
|
||||||
foundFurniture.push(furniture);
|
foundFurniture.push(furniture);
|
||||||
|
|
||||||
@@ -68,6 +69,10 @@ export const CatalogSearchView: FC<{}> = () =>
|
|||||||
|
|
||||||
if(foundFurniture.length === 250) break;
|
if(foundFurniture.length === 250) break;
|
||||||
}
|
}
|
||||||
|
else if(matchesSearch && furniture.furniLine && furniture.furniLine.length && (foundFurniLines.indexOf(furniture.furniLine) < 0))
|
||||||
|
{
|
||||||
|
foundFurniLines.push(furniture.furniLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const offers: IPurchasableOffer[] = [];
|
const offers: IPurchasableOffer[] = [];
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
|
|||||||
const [ catalogSkipPurchaseConfirmation, setCatalogSkipPurchaseConfirmation ] = useLocalStorage(LocalStorageKeys.CATALOG_SKIP_PURCHASE_CONFIRMATION, false);
|
const [ catalogSkipPurchaseConfirmation, setCatalogSkipPurchaseConfirmation ] = useLocalStorage(LocalStorageKeys.CATALOG_SKIP_PURCHASE_CONFIRMATION, false);
|
||||||
const { currentOffer = null, currentPage = null } = useCatalogData();
|
const { currentOffer = null, currentPage = null } = useCatalogData();
|
||||||
const { currentType = CatalogType.NORMAL, purchaseOptions = null, setPurchaseOptions = null, setCatalogPlaceMultipleObjects = null } = useCatalogUiState();
|
const { currentType = CatalogType.NORMAL, purchaseOptions = null, setPurchaseOptions = null, setCatalogPlaceMultipleObjects = null } = useCatalogUiState();
|
||||||
const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null } = useCatalogActions();
|
const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null, getNodesByOfferId = null } = useCatalogActions();
|
||||||
const { getCurrencyAmount = null } = usePurse();
|
const { getCurrencyAmount = null } = usePurse();
|
||||||
const { showSingleBubble = null } = useNotification();
|
const { showSingleBubble = null } = useNotification();
|
||||||
|
|
||||||
@@ -105,12 +105,11 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
|
|||||||
|
|
||||||
let pageId = currentOffer.page.pageId;
|
let pageId = currentOffer.page.pageId;
|
||||||
|
|
||||||
// if(pageId === -1)
|
if(pageId === -1 && getNodesByOfferId)
|
||||||
// {
|
{
|
||||||
// const nodes = getNodesByOfferId(currentOffer.offerId);
|
const nodes = getNodesByOfferId(currentOffer.offerId);
|
||||||
|
if(nodes && nodes.length) pageId = nodes[0].pageId;
|
||||||
// if(nodes) pageId = nodes[0].pageId;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
SendMessageComposer(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, purchaseOptions.extraData, purchaseOptions.quantity));
|
SendMessageComposer(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, purchaseOptions.extraData, purchaseOptions.quantity));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ declare global
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SCRIPT_SRC = 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit';
|
|
||||||
|
|
||||||
export interface TurnstileWidgetProps
|
export interface TurnstileWidgetProps
|
||||||
{
|
{
|
||||||
siteKey: string;
|
siteKey: string;
|
||||||
@@ -98,19 +96,5 @@ export const TurnstileWidget: FC<TurnstileWidgetProps> = props =>
|
|||||||
|
|
||||||
if(!siteKey) return null;
|
if(!siteKey) return null;
|
||||||
|
|
||||||
return (
|
return <div ref={ containerRef } className="turnstile-slot" />;
|
||||||
<>
|
|
||||||
<script
|
|
||||||
async
|
|
||||||
defer
|
|
||||||
src={ SCRIPT_SRC }
|
|
||||||
onLoad={ () => setScriptReady(true) }
|
|
||||||
onError={ () =>
|
|
||||||
{
|
|
||||||
console.error('[Turnstile] script load failed');
|
|
||||||
onError?.();
|
|
||||||
} } />
|
|
||||||
<div ref={ containerRef } className="turnstile-slot" />
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ const useCatalogStore = () =>
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return { isVisible, setIsVisible, isBusy, pageId, previousPageId, currentType, rootNode, offersToNodes, currentPage, setCurrentPage, currentOffer, setCurrentOffer, activeNodes, searchResult, setSearchResult, frontPageItems, roomPreviewer, navigationHidden, setNavigationHidden, purchaseOptions, setPurchaseOptions, catalogLocalizationVersion, getNodeById, getNodeByName, activateNode, openPageById, openPageByName, openPageByOfferId, requestOfferToMover, openCatalogByType, toggleCatalogByType, furniCount, furniLimit, maxFurniLimit, secondsLeft, secondsLeftWithGrace, updateTime, catalogPlaceMultipleObjects, setCatalogPlaceMultipleObjects, getBuilderFurniPlaceableStatus, selectCatalogOffer };
|
return { isVisible, setIsVisible, isBusy, pageId, previousPageId, currentType, rootNode, offersToNodes, currentPage, setCurrentPage, currentOffer, setCurrentOffer, activeNodes, searchResult, setSearchResult, frontPageItems, roomPreviewer, navigationHidden, setNavigationHidden, purchaseOptions, setPurchaseOptions, catalogLocalizationVersion, getNodeById, getNodeByName, getNodesByOfferId, activateNode, openPageById, openPageByName, openPageByOfferId, requestOfferToMover, openCatalogByType, toggleCatalogByType, furniCount, furniLimit, maxFurniLimit, secondsLeft, secondsLeftWithGrace, updateTime, catalogPlaceMultipleObjects, setCatalogPlaceMultipleObjects, getBuilderFurniPlaceableStatus, selectCatalogOffer };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1039,7 +1039,7 @@ export const useCatalogActions = () =>
|
|||||||
activateNode,
|
activateNode,
|
||||||
openPageById, openPageByName, openPageByOfferId,
|
openPageById, openPageByName, openPageByOfferId,
|
||||||
requestOfferToMover, selectCatalogOffer,
|
requestOfferToMover, selectCatalogOffer,
|
||||||
getNodeById, getNodeByName,
|
getNodeById, getNodeByName, getNodesByOfferId,
|
||||||
getBuilderFurniPlaceableStatus
|
getBuilderFurniPlaceableStatus
|
||||||
} = useBetween(useCatalogStore);
|
} = useBetween(useCatalogStore);
|
||||||
|
|
||||||
@@ -1048,7 +1048,7 @@ export const useCatalogActions = () =>
|
|||||||
activateNode,
|
activateNode,
|
||||||
openPageById, openPageByName, openPageByOfferId,
|
openPageById, openPageByName, openPageByOfferId,
|
||||||
requestOfferToMover, selectCatalogOffer,
|
requestOfferToMover, selectCatalogOffer,
|
||||||
getNodeById, getNodeByName,
|
getNodeById, getNodeByName, getNodesByOfferId,
|
||||||
getBuilderFurniPlaceableStatus
|
getBuilderFurniPlaceableStatus
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user