@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 s=useFetchHandle.useFetchHandle(),u=shop.useIsSampleProduct(),t=shop.useIsStorefrontProduct();return useSWR(e?query.generateCollectionQueryKey({...e,isSample:u,isStorefront:t}):null,([,e])=>getCollection.getCollection(s,e),r)};exports.useCollectionQuery=useCollectionQuery;
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 l}from"../useFetchHandle.js";import{generateCollectionQueryKey as s}from"../../helpers/query.js";let useCollectionQuery=(m,i)=>{let p=l(),u=o(),n=t();return e(m?s({...m,isSample:u,isStorefront:n}):null,([,e])=>r(p,e),i)};export{useCollectionQuery};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "2.0.0-dev.1207",
3
+ "version": "2.0.0-dev.1210",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",