@gem-sdk/core 2.0.0-dev.842 → 2.0.0-dev.849
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.
- package/dist/cjs/components/Render.js +1 -1
- package/dist/cjs/contexts/BuilderContext.js +1 -1
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +11 -4
- package/dist/cjs/helpers/make-style.js +1 -1
- package/dist/cjs/hooks/shop/use-product-query.js +1 -1
- package/dist/esm/components/Render.js +1 -1
- package/dist/esm/contexts/BuilderContext.js +1 -1
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +11 -4
- package/dist/esm/helpers/make-style.js +1 -1
- package/dist/esm/hooks/shop/use-product-query.js +1 -1
- package/dist/types/index.d.ts +15 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),reactErrorBoundary=require("react-error-boundary"),BuilderComponent=require("../contexts/BuilderComponent.js"),BuilderContext=require("../contexts/BuilderContext.js"),ComponentWrapper=require("./ComponentWrapper.js"),RenderSection=require("./RenderSection.js");const Render=({uid:e,...r})=>{let t=BuilderContext.useBuilderStore(r=>r.getItem(e)),n=BuilderComponent.useBuilderComponent(t?.tag),s=BuilderContext.useBuilderStore(e=>e.getIsPostPurchase()),i=react.useMemo(()=>s?"POST_PURCHASE":void 0,[s]);return t?t?.type==="section"?jsxRuntime.jsx(RenderSection.default,{sectionId:t.uid}):jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary,{fallbackRender:({error:e,resetErrorBoundary:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{"aria-label":"Error message",children:e.message}),jsxRuntime.jsx("button",{type:"button",onClick:r,children:"Try again"})]}),children:jsxRuntime.jsx(ComponentWrapper.default,{...t,pageType:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),reactErrorBoundary=require("react-error-boundary"),BuilderComponent=require("../contexts/BuilderComponent.js"),BuilderContext=require("../contexts/BuilderContext.js"),ComponentWrapper=require("./ComponentWrapper.js"),RenderSection=require("./RenderSection.js");const Render=({uid:e,...r})=>{let t=BuilderContext.useBuilderStore(r=>r.getItem(e)),n=BuilderComponent.useBuilderComponent(t?.tag),s=BuilderContext.useBuilderStore(e=>e.getIsPostPurchase()),i=BuilderContext.useBuilderStore(e=>e.getIsPreview()),u=react.useMemo(()=>s?"POST_PURCHASE":void 0,[s]);return t?t?.type==="section"?jsxRuntime.jsx(RenderSection.default,{sectionId:t.uid}):jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary,{fallbackRender:({error:e,resetErrorBoundary:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{"aria-label":"Error message",children:e.message}),jsxRuntime.jsx("button",{type:"button",onClick:r,children:"Try again"})]}),children:jsxRuntime.jsx(ComponentWrapper.default,{...t,pageType:u,children:t?.childrens?.length?jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,...r,children:t.childrens.map(e=>jsxRuntime.jsx(RenderMemo,{uid:e},e))}):jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,...r})})},t.uid):null},RenderMemo=react.memo(Render);RenderMemo.displayName="RenderMemo",exports.default=RenderMemo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand");const BuilderContext=react.createContext(null),createBuilderProvider=(e,r)=>zustand.createStore((
|
|
1
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand");const BuilderContext=react.createContext(null),createBuilderProvider=(e,r,t)=>zustand.createStore((u,i)=>({state:e,isPostPurchase:r,isPreview:t,getItem:e=>i().state[e],getIsPostPurchase:()=>i().isPostPurchase,getIsPreview:()=>i().isPreview})),BuilderProvider=({children:e,state:r,isPostPurchase:t,isPreview:u,lazy:i,priority:s,...d})=>{let o=i?react.Suspense:react.Fragment,a=createBuilderProvider(r,t,u);return jsxRuntime.jsx(o,{children:jsxRuntime.jsx(BuilderContext.Provider,{...d,value:a,children:e})})},useBuilderStore=(e,r)=>{let t=react.useContext(BuilderContext);if(!t)throw Error("useBuilderStore must be used within a BuilderProvider");return zustand.useStore(t,e,r)};exports.BuilderProvider=BuilderProvider,exports.useBuilderStore=useBuilderStore;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";const ThemePageDocument=`
|
|
2
|
-
query ThemePage($themePageId: ID
|
|
2
|
+
query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
|
|
3
3
|
themePage(id: $themePageId) {
|
|
4
4
|
id
|
|
5
5
|
name
|
|
@@ -12,10 +12,17 @@
|
|
|
12
12
|
id
|
|
13
13
|
deletedAt
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
theme {
|
|
16
16
|
id
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
themeStyles(first: $first, where: $where) {
|
|
18
|
+
edges {
|
|
19
|
+
node {
|
|
20
|
+
data
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var getResonsiveValue=require("./get-resonsive-value.js");const removeNullUndefined=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),makeStyle=e=>removeNullUndefined(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},makeStyleResponsive=(e,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),makeStyleResponsiveByScreen=(e,t,o)=>({[`--${e}`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"desktop")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"desktop"),[`--${e}-tablet`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"tablet")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"tablet"),[`--${e}-mobile`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"mobile")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"mobile")}),makeWidth=(e,t)=>{let o=(e,t,o)=>{let s=getResonsiveValue.getResponsiveValueByScreen(t,e),l=o?.[e]===void 0?o?.desktop:o?.[e];return l?"100%":!1===l?s??s:s||"auto"};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),makeHeight=(e,t)=>{let o=(e,t,o)=>{let s=t?.[e],l=o?.[e];return l?"auto":!1===l?s??s:s};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},makeAspectRatio=(e,t,o)=>{let s={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,l);"none"!==a&&(s={...s,[l]:"custom"!==a?a:`${getResonsiveValue.getResponsiveValueByScreen(t,"desktop")}/${getResonsiveValue.getResponsiveValueByScreen(o,"desktop")}`})}),s},makeLineClamp=(e,t)=>{let o=(e,t,o)=>{let s=t
|
|
1
|
+
"use strict";var getResonsiveValue=require("./get-resonsive-value.js");const removeNullUndefined=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),makeStyle=e=>removeNullUndefined(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},makeStyleResponsive=(e,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),makeStyleResponsiveByScreen=(e,t,o)=>({[`--${e}`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"desktop")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"desktop"),[`--${e}-tablet`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"tablet")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"tablet"),[`--${e}-mobile`]:o?`${getResonsiveValue.getResponsiveValueByScreen(t,"mobile")}${o}`:getResonsiveValue.getResponsiveValueByScreen(t,"mobile")}),makeWidth=(e,t)=>{let o=(e,t,o)=>{let s=getResonsiveValue.getResponsiveValueByScreen(t,e),l=o?.[e]===void 0?o?.desktop:o?.[e];return l?"100%":!1===l?s??s:s||"auto"};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),makeHeight=(e,t)=>{let o=(e,t,o)=>{let s=t?.[e],l=o?.[e];return l?"auto":!1===l?s??s:s};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},makeAspectRatio=(e,t,o)=>{let s={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,l);"none"!==a&&(s={...s,[l]:"custom"!==a?a:`${getResonsiveValue.getResponsiveValueByScreen(t,"desktop")}/${getResonsiveValue.getResponsiveValueByScreen(o,"desktop")}`})}),s},makeLineClamp=(e,t)=>{let o=(e,t,o)=>{let s=getResonsiveValue.getResponsiveValueByScreen(t,e),l=getResonsiveValue.getResponsiveValueByScreen(o,e);return l||void 0===l?s:"unset"};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}};exports.makeAspectRatio=makeAspectRatio,exports.makeGlobalSizeHeightResponsive=makeGlobalSizeHeightResponsive,exports.makeGlobalSizeWidthResponsive=makeGlobalSizeWidthResponsive,exports.makeHeight=makeHeight,exports.makeLineClamp=makeLineClamp,exports.makeStyle=makeStyle,exports.makeStyleKey=makeStyleKey,exports.makeStyleResponsive=makeStyleResponsive,exports.makeStyleResponsiveByScreen=makeStyleResponsiveByScreen,exports.makeStyleResponsiveState=makeStyleResponsiveState,exports.makeStyleState=makeStyleState,exports.makeWidth=makeWidth,exports.removeNullUndefined=removeNullUndefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var useSWR=require("swr"),getProduct=require("../../helpers/queries/get-product.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js");const useProductQuery=(e,r)=>{let
|
|
1
|
+
"use strict";var useSWR=require("swr"),getProduct=require("../../helpers/queries/get-product.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js");const useProductQuery=(e,r,u)=>{let s=useFetchHandle.useFetchHandle(),t=shop.useIsSampleProduct(),o=shop.useIsStorefrontProduct();return useSWR(e?query.generateProductQueryKey({id:e,isSample:t,isStorefront:o}):null,async([,e])=>getProduct.getProduct(u||s,e),r)};exports.useProductQuery=useProductQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{memo as n,useMemo as o}from"react";import{ErrorBoundary as i}from"react-error-boundary";import{useBuilderComponent as s}from"../contexts/BuilderComponent.js";import{useBuilderStore as d}from"../contexts/BuilderContext.js";import l from"./ComponentWrapper.js";import a from"./RenderSection.js";let Render=({uid:n,...m})=>{let p=d(e=>e.getItem(n)),c=s(p?.tag),u=d(e=>e.getIsPostPurchase()),g=o(()=>u?"POST_PURCHASE":void 0,[u]);return p?p?.type==="section"?e(a,{sectionId:p.uid}):e(i,{fallbackRender:({error:n,resetErrorBoundary:o})=>r(t,{children:[e("span",{"aria-label":"Error message",children:n.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(l,{...p,pageType:
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{memo as n,useMemo as o}from"react";import{ErrorBoundary as i}from"react-error-boundary";import{useBuilderComponent as s}from"../contexts/BuilderComponent.js";import{useBuilderStore as d}from"../contexts/BuilderContext.js";import l from"./ComponentWrapper.js";import a from"./RenderSection.js";let Render=({uid:n,...m})=>{let p=d(e=>e.getItem(n)),c=s(p?.tag),u=d(e=>e.getIsPostPurchase()),g=d(e=>e.getIsPreview()),h=o(()=>u?"POST_PURCHASE":void 0,[u]);return p?p?.type==="section"?e(a,{sectionId:p.uid}):e(i,{fallbackRender:({error:n,resetErrorBoundary:o})=>r(t,{children:[e("span",{"aria-label":"Error message",children:n.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(l,{...p,pageType:h,children:p?.childrens?.length?e(c,{builderProps:{uid:n,builderData:p,isPreview:g},styles:p.styles,setting:p.settings,...m,children:p.childrens.map(r=>e(RenderMemo,{uid:r},r))}):e(c,{builderProps:{uid:n,builderData:p,isPreview:g},styles:p.styles,setting:p.settings,...m})})},p.uid):null},RenderMemo=n(Render);RenderMemo.displayName="RenderMemo";export{RenderMemo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useContext as r,createContext as t,Suspense as i,Fragment as u}from"react";import{useStore as o,createStore as d}from"zustand";let BuilderContext=t(null),createBuilderProvider=(e,r)=>d((
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useContext as r,createContext as t,Suspense as i,Fragment as u}from"react";import{useStore as o,createStore as d}from"zustand";let BuilderContext=t(null),createBuilderProvider=(e,r,t)=>d((i,u)=>({state:e,isPostPurchase:r,isPreview:t,getItem:e=>u().state[e],getIsPostPurchase:()=>u().isPostPurchase,getIsPreview:()=>u().isPreview})),BuilderProvider=({children:r,state:t,isPostPurchase:o,isPreview:d,lazy:s,priority:l,...P})=>{let a=s?i:u,n=createBuilderProvider(t,o,d);return e(a,{children:e(BuilderContext.Provider,{...P,value:n,children:r})})},useBuilderStore=(e,t)=>{let i=r(BuilderContext);if(!i)throw Error("useBuilderStore must be used within a BuilderProvider");return o(i,e,t)};export{BuilderProvider,useBuilderStore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let ThemePageDocument=`
|
|
2
|
-
query ThemePage($themePageId: ID
|
|
2
|
+
query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {
|
|
3
3
|
themePage(id: $themePageId) {
|
|
4
4
|
id
|
|
5
5
|
name
|
|
@@ -12,10 +12,17 @@ let ThemePageDocument=`
|
|
|
12
12
|
id
|
|
13
13
|
deletedAt
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
theme {
|
|
16
16
|
id
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
themeStyles(first: $first, where: $where) {
|
|
18
|
+
edges {
|
|
19
|
+
node {
|
|
20
|
+
data
|
|
21
|
+
id
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";let removeNullUndefined=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),makeStyle=e=>removeNullUndefined(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},makeStyleResponsive=(e,t,l)=>({[`--${e}`]:l?`${t?.desktop}${l}`:t?.desktop,[`--${e}-tablet`]:l?`${t?.tablet}${l}`:t?.tablet,[`--${e}-mobile`]:l?`${t?.mobile}${l}`:t?.mobile}),makeStyleResponsiveByScreen=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),makeWidth=(t,l)=>{let o=(t,l,o)=>{let a=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?a??a:a||"auto"};return{desktop:o("desktop",t,l),tablet:o("tablet",t,l),mobile:o("mobile",t,l)}},makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),makeHeight=(e,t)=>{let l=(e,t,l)=>{let o=t?.[e],a=l?.[e];return a?"auto":!1===a?o??o:o};return{desktop:l("desktop",e,t),tablet:l("tablet",e,t),mobile:l("mobile",e,t)}},makeAspectRatio=(t,l,o)=>{let a={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let m=e(t,i);"none"!==m&&(a={...a,[i]:"custom"!==m?m:`${e(l,"desktop")}/${e(o,"desktop")}`})}),a},makeLineClamp=(
|
|
1
|
+
import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";let removeNullUndefined=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),makeStyle=e=>removeNullUndefined(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},makeStyleResponsive=(e,t,l)=>({[`--${e}`]:l?`${t?.desktop}${l}`:t?.desktop,[`--${e}-tablet`]:l?`${t?.tablet}${l}`:t?.tablet,[`--${e}-mobile`]:l?`${t?.mobile}${l}`:t?.mobile}),makeStyleResponsiveByScreen=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),makeWidth=(t,l)=>{let o=(t,l,o)=>{let a=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?a??a:a||"auto"};return{desktop:o("desktop",t,l),tablet:o("tablet",t,l),mobile:o("mobile",t,l)}},makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),makeHeight=(e,t)=>{let l=(e,t,l)=>{let o=t?.[e],a=l?.[e];return a?"auto":!1===a?o??o:o};return{desktop:l("desktop",e,t),tablet:l("tablet",e,t),mobile:l("mobile",e,t)}},makeAspectRatio=(t,l,o)=>{let a={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let m=e(t,i);"none"!==m&&(a={...a,[i]:"custom"!==m?m:`${e(l,"desktop")}/${e(o,"desktop")}`})}),a},makeLineClamp=(t,l)=>{let o=(t,l,o)=>{let a=e(l,t),i=e(o,t);return i||void 0===i?a:"unset"};return{desktop:o("desktop",t,l),tablet:o("tablet",t,l),mobile:o("mobile",t,l)}};export{makeAspectRatio,makeGlobalSizeHeightResponsive,makeGlobalSizeWidthResponsive,makeHeight,makeLineClamp,makeStyle,makeStyleKey,makeStyleResponsive,makeStyleResponsiveByScreen,makeStyleResponsiveState,makeStyleState,makeWidth,removeNullUndefined};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"swr";import{getProduct as e}from"../../helpers/queries/get-product.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as s}from"../useFetchHandle.js";import{generateProductQueryKey as u}from"../../helpers/query.js";let useProductQuery=(m,p)=>{let
|
|
1
|
+
import r from"swr";import{getProduct as e}from"../../helpers/queries/get-product.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as s}from"../useFetchHandle.js";import{generateProductQueryKey as u}from"../../helpers/query.js";let useProductQuery=(m,p,i)=>{let l=s(),c=o(),d=t();return r(m?u({id:m,isSample:c,isStorefront:d}):null,async([,r])=>e(i||l,r),p)};export{useProductQuery};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6590,6 +6590,7 @@ type BaseProps<Setting = unknown, Style = unknown, Advanced = AdvancedType> = {
|
|
|
6590
6590
|
/** Unique id of component */
|
|
6591
6591
|
uid?: string;
|
|
6592
6592
|
builderData?: BlockEntity;
|
|
6593
|
+
isPreview?: boolean;
|
|
6593
6594
|
};
|
|
6594
6595
|
styles?: Style;
|
|
6595
6596
|
setting?: Setting;
|
|
@@ -27258,8 +27259,10 @@ type BuilderContextProps = {
|
|
|
27258
27259
|
getItem: (id: string) => BuilderEntity | undefined;
|
|
27259
27260
|
isPostPurchase?: boolean;
|
|
27260
27261
|
getIsPostPurchase: () => boolean | undefined;
|
|
27262
|
+
isPreview?: boolean;
|
|
27263
|
+
getIsPreview: () => boolean | undefined;
|
|
27261
27264
|
};
|
|
27262
|
-
type BuilderProviderProps = Pick<BuilderContextProps, 'state' | 'isPostPurchase'> & {
|
|
27265
|
+
type BuilderProviderProps = Pick<BuilderContextProps, 'state' | 'isPostPurchase' | 'isPreview'> & {
|
|
27263
27266
|
children: React.ReactNode;
|
|
27264
27267
|
lazy?: boolean;
|
|
27265
27268
|
priority?: boolean;
|
|
@@ -27812,14 +27815,22 @@ declare const LibraryTemplateDocument = "\n query LibraryTemplate($libraryTem
|
|
|
27812
27815
|
|
|
27813
27816
|
type ThemePageQueryVariables = Exact<{
|
|
27814
27817
|
themePageId: Scalars['ID'];
|
|
27818
|
+
first?: InputMaybe<Scalars['Int']>;
|
|
27819
|
+
where?: InputMaybe<ThemeStyleWhereInput>;
|
|
27815
27820
|
}>;
|
|
27816
27821
|
type ThemePageQueryResponse = {
|
|
27817
27822
|
themePage?: Maybe<Pick<ThemePage, 'id' | 'name' | 'handle' | 'isMobile' | 'sectionPosition'> & {
|
|
27818
27823
|
pageSections?: Maybe<Array<Maybe<Pick<PageSection, 'cid' | 'component' | 'id' | 'deletedAt'>>>>;
|
|
27819
|
-
|
|
27824
|
+
theme?: Maybe<Pick<Theme, 'id'> & {
|
|
27825
|
+
themeStyles?: Maybe<{
|
|
27826
|
+
edges?: Maybe<Array<Maybe<{
|
|
27827
|
+
node?: Maybe<Pick<ThemeStyle, 'data' | 'id' | 'name'>>;
|
|
27828
|
+
}>>>;
|
|
27829
|
+
}>;
|
|
27830
|
+
}>;
|
|
27820
27831
|
}>;
|
|
27821
27832
|
};
|
|
27822
|
-
declare const ThemePageDocument = "\n query ThemePage($themePageId: ID
|
|
27833
|
+
declare const ThemePageDocument = "\n query ThemePage($themePageId: ID!, $first: Int, $where: ThemeStyleWhereInput) {\n themePage(id: $themePageId) {\n id\n name\n handle\n isMobile\n sectionPosition\n pageSections {\n cid\n component\n id\n deletedAt\n }\n theme {\n id\n themeStyles(first: $first, where: $where) {\n edges {\n node {\n data\n id\n name\n }\n }\n }\n }\n }\n}\n ";
|
|
27823
27834
|
|
|
27824
27835
|
type SaleFunnelDiscountsQueryVariables = Exact<{
|
|
27825
27836
|
where?: InputMaybe<SaleFunnelDiscountWhereInput>;
|
|
@@ -35749,7 +35760,7 @@ declare const useCollectionsQuery: (variable: CollectionsQueryVariables, options
|
|
|
35749
35760
|
orderBy?: InputMaybe$1<CollectionOrder$1>;
|
|
35750
35761
|
}>]) => swr__internal.FetcherResponse<CollectionsQueryResponse>>> | undefined>;
|
|
35751
35762
|
|
|
35752
|
-
declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment
|
|
35763
|
+
declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>, customFetcher?: FetchFunc) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", FetchProductParams]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
|
|
35753
35764
|
|
|
35754
35765
|
declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>, params?: {
|
|
35755
35766
|
defaultSelectedProductCount?: number;
|