@gem-sdk/core 12.0.0-dev.144 → 12.0.0-dev.150

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 e=require("react"),t=require("swr"),o=require("../contexts/ShopContext.js");const r=()=>{let e=o.useShopStore(e=>e.provider),t=o.useShopStore(e=>e.storefrontToken),r=o.useShopStore(e=>e.storefrontUrl);return{provider:e,storefrontToken:t,storefrontUrl:r}};exports.useCheckoutUrl=function(e){let{storefrontToken:t}=r();if(e)return t?`${e}?access_token=${t}`:e},exports.useConnectedShopify=function(){let{storefrontToken:e}=r();return!!e},exports.useCurrency=()=>{let t=o.useShopStore(e=>e.currency),r=o.useShopStore(e=>e.changeCurrency);return e.useMemo(()=>({currency:t,changeCurrency:r}),[t,r])},exports.useEditorMode=()=>o.useShopStore(e=>e.mode),exports.useIsSampleProduct=function(){let{storefrontToken:e}=r(),t=o.useShopStore(e=>e.isStorefront);return t&&!e},exports.useIsStorefrontProduct=function(){return o.useShopStore(e=>e.isStorefront)},exports.useLocale=()=>{let t=o.useShopStore(e=>e.locale),r=o.useShopStore(e=>e.changeLocale);return e.useMemo(()=>({locale:t,changeLocale:r}),[t,r])},exports.useMatchMutate=()=>{let{cache:e,mutate:o}=t.useSWRConfig(),r=["query/products","query/collection"];return(t,s)=>{if(!(e instanceof Map))throw Error("matchMutate requires the cache provider to be a Map instance");let u=[];e.forEach((e,o)=>{t.test(o)&&u.push(o)});let n=u.map(t=>{let u=e.get(t),n=r.some(e=>t.includes(e));return n?o(t,void 0,s):o(t,u?.data,s)});return Promise.all(n)}},exports.useMobileOnly=()=>o.useShopStore(e=>e.mobileOnly),exports.useMoneyFormat=()=>{let t=o.useShopStore(e=>e.moneyFormat),r=o.useShopStore(e=>e.moneyWithCurrencyFormat);return e.useMemo(()=>({moneyFormat:t,moneyWithCurrencyFormat:r}),[t,r])},exports.usePageType=()=>{let t=o.useShopStore(e=>e.pageType);return e.useMemo(()=>t||"STATIC",[t])},exports.usePluginEnable=()=>o.useShopStore(e=>e.plugins),exports.useStoreFront=r,exports.useSwatches=()=>{let t=o.useShopStore(e=>e.swatches),r=o.useShopStore(e=>e.changeSwatches);return e.useMemo(()=>({swatches:t,changeSwatches:r}),[t,r])},exports.useTimezone=()=>{let t=o.useShopStore(e=>e.timezone);return e.useMemo(()=>({timezone:t}),[t])};
2
+ "use strict";var e=require("react"),t=require("swr"),r=require("../contexts/ShopContext.js");const o=()=>{let e=r.useShopStore(e=>e.provider),t=r.useShopStore(e=>e.storefrontToken),o=r.useShopStore(e=>e.storefrontUrl);return{provider:e,storefrontToken:t,storefrontUrl:o}};exports.useCheckoutUrl=function(e){let{storefrontToken:t}=o();if(e)return t?`${e}?access_token=${t}`:e},exports.useConnectedShopify=function(){let{storefrontToken:e}=o();return!!e},exports.useCurrency=()=>{let t=r.useShopStore(e=>e.currency),o=r.useShopStore(e=>e.changeCurrency);return e.useMemo(()=>({currency:t,changeCurrency:o}),[t,o])},exports.useEditorMode=()=>r.useShopStore(e=>e.mode),exports.useIsSampleProduct=function(){let{storefrontToken:e}=o(),t=r.useShopStore(e=>e.isStorefront);return t&&!e},exports.useIsStorefrontProduct=function(){return r.useShopStore(e=>e.isStorefront)},exports.useLocale=()=>{let t=r.useShopStore(e=>e.locale),o=r.useShopStore(e=>e.changeLocale);return e.useMemo(()=>({locale:t,changeLocale:o}),[t,o])},exports.useMatchMutate=()=>{let{cache:e,mutate:r}=t.useSWRConfig(),o=["query/products","query/collection","query/product"];return(t,s)=>{if(!(e instanceof Map))throw Error("matchMutate requires the cache provider to be a Map instance");let u=[];e.forEach((e,r)=>{t.test(r)&&u.push(r)});let n=u.map(t=>{let u=e.get(t),n=o.some(e=>t.includes(e));return n?r(t,void 0,s):r(t,u?.data,s)});return Promise.all(n)}},exports.useMobileOnly=()=>r.useShopStore(e=>e.mobileOnly),exports.useMoneyFormat=()=>{let t=r.useShopStore(e=>e.moneyFormat),o=r.useShopStore(e=>e.moneyWithCurrencyFormat);return e.useMemo(()=>({moneyFormat:t,moneyWithCurrencyFormat:o}),[t,o])},exports.usePageType=()=>{let t=r.useShopStore(e=>e.pageType);return e.useMemo(()=>t||"STATIC",[t])},exports.usePluginEnable=()=>r.useShopStore(e=>e.plugins),exports.useStoreFront=o,exports.useSwatches=()=>{let t=r.useShopStore(e=>e.swatches),o=r.useShopStore(e=>e.changeSwatches);return e.useMemo(()=>({swatches:t,changeSwatches:o}),[t,o])},exports.useTimezone=()=>{let t=r.useShopStore(e=>e.timezone);return e.useMemo(()=>({timezone:t}),[t])};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{useMemo as e}from"react";import{useSWRConfig as t}from"swr";import{useShopStore as r}from"../contexts/ShopContext.js";let o=()=>{let t=r(e=>e.locale),o=r(e=>e.changeLocale);return e(()=>({locale:t,changeLocale:o}),[t,o])},n=()=>{let t=r(e=>e.currency),o=r(e=>e.changeCurrency);return e(()=>({currency:t,changeCurrency:o}),[t,o])},u=()=>{let t=r(e=>e.timezone);return e(()=>({timezone:t}),[t])},s=()=>{let t=r(e=>e.moneyFormat),o=r(e=>e.moneyWithCurrencyFormat);return e(()=>({moneyFormat:t,moneyWithCurrencyFormat:o}),[t,o])},c=()=>{let t=r(e=>e.swatches),o=r(e=>e.changeSwatches);return e(()=>({swatches:t,changeSwatches:o}),[t,o])},l=()=>{let t=r(e=>e.pageType);return e(()=>t||"STATIC",[t])},a=()=>{let e=r(e=>e.provider),t=r(e=>e.storefrontToken),o=r(e=>e.storefrontUrl);return{provider:e,storefrontToken:t,storefrontUrl:o}},i=()=>r(e=>e.plugins),m=()=>r(e=>e.mode),p=()=>r(e=>e.mobileOnly),f=()=>{let{cache:e,mutate:r}=t(),o=["query/products","query/collection"];return(t,n)=>{if(!(e instanceof Map))throw Error("matchMutate requires the cache provider to be a Map instance");let u=[];e.forEach((e,r)=>{t.test(r)&&u.push(r)});let s=u.map(t=>{let u=e.get(t),s=o.some(e=>t.includes(e));return s?r(t,void 0,n):r(t,u?.data,n)});return Promise.all(s)}};function h(){let{storefrontToken:e}=a();return!!e}function y(){let{storefrontToken:e}=a(),t=r(e=>e.isStorefront);return t&&!e}function d(){return r(e=>e.isStorefront)}function S(e){let{storefrontToken:t}=a();if(e)return t?`${e}?access_token=${t}`:e}export{S as useCheckoutUrl,h as useConnectedShopify,n as useCurrency,m as useEditorMode,y as useIsSampleProduct,d as useIsStorefrontProduct,o as useLocale,f as useMatchMutate,p as useMobileOnly,s as useMoneyFormat,l as usePageType,i as usePluginEnable,a as useStoreFront,c as useSwatches,u as useTimezone};
2
+ import{useMemo as e}from"react";import{useSWRConfig as t}from"swr";import{useShopStore as r}from"../contexts/ShopContext.js";let o=()=>{let t=r(e=>e.locale),o=r(e=>e.changeLocale);return e(()=>({locale:t,changeLocale:o}),[t,o])},n=()=>{let t=r(e=>e.currency),o=r(e=>e.changeCurrency);return e(()=>({currency:t,changeCurrency:o}),[t,o])},u=()=>{let t=r(e=>e.timezone);return e(()=>({timezone:t}),[t])},s=()=>{let t=r(e=>e.moneyFormat),o=r(e=>e.moneyWithCurrencyFormat);return e(()=>({moneyFormat:t,moneyWithCurrencyFormat:o}),[t,o])},c=()=>{let t=r(e=>e.swatches),o=r(e=>e.changeSwatches);return e(()=>({swatches:t,changeSwatches:o}),[t,o])},l=()=>{let t=r(e=>e.pageType);return e(()=>t||"STATIC",[t])},a=()=>{let e=r(e=>e.provider),t=r(e=>e.storefrontToken),o=r(e=>e.storefrontUrl);return{provider:e,storefrontToken:t,storefrontUrl:o}},i=()=>r(e=>e.plugins),m=()=>r(e=>e.mode),p=()=>r(e=>e.mobileOnly),f=()=>{let{cache:e,mutate:r}=t(),o=["query/products","query/collection","query/product"];return(t,n)=>{if(!(e instanceof Map))throw Error("matchMutate requires the cache provider to be a Map instance");let u=[];e.forEach((e,r)=>{t.test(r)&&u.push(r)});let s=u.map(t=>{let u=e.get(t),s=o.some(e=>t.includes(e));return s?r(t,void 0,n):r(t,u?.data,n)});return Promise.all(s)}};function h(){let{storefrontToken:e}=a();return!!e}function y(){let{storefrontToken:e}=a(),t=r(e=>e.isStorefront);return t&&!e}function d(){return r(e=>e.isStorefront)}function S(e){let{storefrontToken:t}=a();if(e)return t?`${e}?access_token=${t}`:e}export{S as useCheckoutUrl,h as useConnectedShopify,n as useCurrency,m as useEditorMode,y as useIsSampleProduct,d as useIsStorefrontProduct,o as useLocale,f as useMatchMutate,p as useMobileOnly,s as useMoneyFormat,l as usePageType,i as usePluginEnable,a as useStoreFront,c as useSwatches,u as useTimezone};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "12.0.0-dev.144",
3
+ "version": "12.0.0-dev.150",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -28,8 +28,8 @@
28
28
  "type-check": "yarn tsc --noEmit"
29
29
  },
30
30
  "devDependencies": {
31
- "@gem-sdk/adapter-shopify": "12.0.0-dev.142",
32
- "@gem-sdk/styles": "12.0.0-dev.142",
31
+ "@gem-sdk/adapter-shopify": "12.0.0-dev.150",
32
+ "@gem-sdk/styles": "12.0.0-dev.150",
33
33
  "@types/classnames": "2.3.4"
34
34
  },
35
35
  "dependencies": {