@gem-sdk/components 2.0.0-dev.848 → 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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),react=require("react"),Row=require("../../grid/components/Row.js"),dynamic=require("next/dynamic");const ProductNotFound=dynamic(()=>Promise.resolve().then(function(){return require("./ProductNotFound.js")}),{loading:Loading.default}),Product=({children:e,setting:r,styles:t,style:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),react=require("react"),Row=require("../../grid/components/Row.js"),dynamic=require("next/dynamic"),index=require("../../post-purchase/product/helpers/index.js");const ProductNotFound=dynamic(()=>Promise.resolve().then(function(){return require("./ProductNotFound.js")}),{loading:Loading.default}),Product=({children:e,setting:r,styles:t,style:o,builderAttrs:i})=>{let{productSetting:d,quantity:u,readOnly:n,isAuto:s,isSyncProduct:c,...a}=r??{},{...l}=t??{},m=core.usePageType(),x=core.usePageStore(e=>e.dynamicProduct),j=d?.productStatus=="dynamic"?x??{}:{};return"PRODUCT"===m&&s?jsxRuntime.jsx(jsxRuntime.Fragment,{children:core.isEmptyChildren(e)?jsxRuntime.jsx(ChildrenDroppable.default,{}):e}):jsxRuntime.jsx(LocalProduct,{builderAttrs:i,rowSetting:a,rowStyles:l,style:o,productSetting:{...d,...j},quantity:u,readOnly:n,isSyncProduct:c,children:e})},LocalProduct=({children:e,productSetting:r,quantity:t,readOnly:o,rowSetting:i,style:d,rowStyles:u,builderAttrs:n,isSyncProduct:s})=>{let c=r?.productId??"latest",a=r?.initialVariantId,l=core.usePageStore(e=>e.publicStoreFrontData),m=react.useMemo(()=>index.hasPublicStoreFrontData(l)?index.createStoreFrontFetcher(l):void 0,[l]),{data:x,isLoading:j,error:p}=core.useProductQuery(c,void 0,m),[P,h]=react.useState(!0),g=core.useEditorMode();return!p&&(x||j)||"edit"!==g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:j?jsxRuntime.jsx(Loading.default,{}):p?jsxRuntime.jsxs("div",{children:["Error: ",p?.message]}):x?jsxRuntime.jsx(core.ProductProvider,{product:x,initialVariantId:a,quantity:t,readOnly:o,isSyncProduct:s,children:jsxRuntime.jsx(Row.default,{builderAttrs:n,style:d,setting:i,styles:u,..."edit"===g?{"data-product-id":x?.baseID?.replace("gid://shopify/Product/","")}:{},children:core.isEmptyChildren(e)?jsxRuntime.jsx(ChildrenDroppable.default,{}):e})},`uid-${x.id}-${a??""}`):null}):P?jsxRuntime.jsx(ProductNotFound,{builderAttrs:n,productSrc:"PickProduct",onClose:()=>h(!1),children:e}):null};exports.default=Product;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as r,jsxs as o}from"react/jsx-runtime";import{usePageType as d,usePageStore as e,isEmptyChildren as i,useProductQuery as c,useEditorMode as n,ProductProvider as l}from"@gem-sdk/core";import u from"../../grid/components/ChildrenDroppable.js";import s from"../../common/components/Loading.js";import{useState as
|
|
1
|
+
import{jsx as t,Fragment as r,jsxs as o}from"react/jsx-runtime";import{usePageType as d,usePageStore as e,isEmptyChildren as i,useProductQuery as c,useEditorMode as n,ProductProvider as l}from"@gem-sdk/core";import u from"../../grid/components/ChildrenDroppable.js";import s from"../../common/components/Loading.js";import{useMemo as a,useState as m}from"react";import p from"../../grid/components/Row.js";import P from"next/dynamic";import{hasPublicStoreFrontData as h,createStoreFrontFetcher as y}from"../../post-purchase/product/helpers/index.js";let ProductNotFound=P(()=>import("./ProductNotFound.js"),{loading:s}),Product=({children:o,setting:c,styles:n,style:l,builderAttrs:s})=>{let{productSetting:a,quantity:m,readOnly:p,isAuto:P,isSyncProduct:h,...y}=c??{},{...f}=n??{},g=d(),S=e(t=>t.dynamicProduct),b=a?.productStatus=="dynamic"?S??{}:{};return"PRODUCT"===g&&P?t(r,{children:i(o)?t(u,{}):o}):t(LocalProduct,{builderAttrs:s,rowSetting:y,rowStyles:f,style:l,productSetting:{...a,...b},quantity:m,readOnly:p,isSyncProduct:h,children:o})},LocalProduct=({children:d,productSetting:P,quantity:f,readOnly:g,rowSetting:S,style:b,rowStyles:j,builderAttrs:x,isSyncProduct:D})=>{let F=P?.productId??"latest",v=P?.initialVariantId,w=e(t=>t.publicStoreFrontData),A=a(()=>h(w)?y(w):void 0,[w]),{data:C,isLoading:I,error:L}=c(F,void 0,A),[N,k]=m(!0),O=n();return!L&&(C||I)||"edit"!==O?t(r,{children:I?t(s,{}):L?o("div",{children:["Error: ",L?.message]}):C?t(l,{product:C,initialVariantId:v,quantity:f,readOnly:g,isSyncProduct:D,children:t(p,{builderAttrs:x,style:b,setting:S,styles:j,..."edit"===O?{"data-product-id":C?.baseID?.replace("gid://shopify/Product/","")}:{},children:i(d)?t(u,{}):d})},`uid-${C.id}-${v??""}`):null}):N?t(ProductNotFound,{builderAttrs:x,productSrc:"PickProduct",onClose:()=>k(!1),children:d}):null};export{Product as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.849",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"format": "prettier --write \"./src/**/*.{ts,tsx}\""
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
24
|
+
"@gem-sdk/core": "2.0.0-dev.849",
|
|
25
25
|
"@gem-sdk/styles": "1.14.0-dev.831",
|
|
26
26
|
"@types/react-transition-group": "^4.4.5"
|
|
27
27
|
},
|