@gem-sdk/core 2.0.0-dev.1207 → 2.0.0-dev.1210
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var useSWR=require("swr"),getCollection=require("../../helpers/queries/get-collection.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js");const useCollectionQuery=(e,r)=>{let
|
|
2
|
+
"use strict";var useSWR=require("swr"),getCollection=require("../../helpers/queries/get-collection.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js"),PageContext=require("../../contexts/PageContext.js"),createStoreFrontFetcher=require("../../helpers/create-store-front-fetcher.js"),react=require("react");const useCollectionQuery=(e,r)=>{let t=useFetchHandle.useFetchHandle(),o=PageContext.usePageStore(e=>e.publicStoreFrontData),s=react.useMemo(()=>createStoreFrontFetcher.hasPublicStoreFrontData(o)?createStoreFrontFetcher.createStoreFrontFetcher(o):t,[o]),u=shop.useIsSampleProduct(),c=shop.useIsStorefrontProduct();return useSWR(e?query.generateCollectionQueryKey({...e,isSample:u,isStorefront:c}):null,([,e])=>getCollection.getCollection(s,e),r)};exports.useCollectionQuery=useCollectionQuery;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e from"swr";import{getCollection as r}from"../../helpers/queries/get-collection.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as
|
|
2
|
+
import e from"swr";import{getCollection as r}from"../../helpers/queries/get-collection.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as s}from"../useFetchHandle.js";import{generateCollectionQueryKey as m}from"../../helpers/query.js";import{usePageStore as l}from"../../contexts/PageContext.js";import{hasPublicStoreFrontData as p,createStoreFrontFetcher as i}from"../../helpers/create-store-front-fetcher.js";import{useMemo as c}from"react";let useCollectionQuery=(f,n)=>{let u=s(),a=l(e=>e.publicStoreFrontData),h=c(()=>p(a)?i(a):u,[a]),j=o(),x=t();return e(f?m({...f,isSample:j,isStorefront:x}):null,([,e])=>r(h,e),n)};export{useCollectionQuery};
|