@gem-sdk/pages 18.0.0 → 19.0.0-dev.7
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";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./const.js"),n=require("@gem-sdk/core");exports.default=()=>{let[
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./const.js"),n=require("@gem-sdk/core");exports.default=()=>{let[r,d]=t.useState(!1),{t:p}=n.useI18nStore(),[s,l]=t.useState({width:0,name:"",activeId:null}),[a,g]=t.useState(!1),o=t.useCallback(e=>{l(t=>({...t,...e}))},[l]);t.useEffect(()=>{if(s)g(s.width>0&&s.width<=1024);else{let e=i.devices[0];e&&o({width:e.width,name:e.name,activeId:e.id}),g(!1)}},[s,o]);let c=e=>{let t=i.devices.find(t=>t.id===e);t&&(o({width:t.width,name:t.name,activeId:t.id}),u(t.id)),d(!r)},u=e=>{let t=new CustomEvent("editor:change-device",{bubbles:!0,detail:{id:e}});window.dispatchEvent(t)},w=t.useRef(null),m=e=>{w.current&&!w.current.contains(e.target)&&d(!1)},x=e=>{let t=i.devices.find(t=>t.width===e);if(t)return t.name;let n=p("Desktop");return e<=768?p("Mobile"):e<=1024?p("Tablet"):n},v=t.useCallback(e=>{let t=e.detail;t&&(document.body.toggleAttribute("data-editor-mobile",!!t.isEditorMobile),o({width:t.width,name:x(t.width),activeId:null}))},[o]);t.useEffect(()=>(window.addEventListener("mousedown",m),window.addEventListener("editor:resize-preview-screen",v),()=>{window.removeEventListener("mousedown",m),window.removeEventListener("editor:resize-preview-screen",v),document.body.removeAttribute("data-editor-mobile")}),[v]);let h=e=>e.id===s.activeId||s.name===e.name,f=()=>d(!r);return a?e.jsx(e.Fragment,{children:e.jsxs("div",{ref:w,className:`gp-switch-view gp-font-sans gp-flex gp-h-[40px] gp-absolute gp-top-[2px] gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-gap-2 gp-items-center gp-justify-center gp-cursor-pointer ${r?"gp-z-50":"gp-z-1"}`,children:[e.jsxs("div",{className:`gp-flex gp-gap-1 gp-py-1 gp-px-2 gp-transform -gp-translate-y-[2px] gp-border-[1px] gp-justify-between gp-items-center gp-min-w-[194px] gp-bg-[#F4F4F4] hover:gp-bg-[#E2E2E2] gp-rounded-md gp-leading-5 gp-text-xs gp-font-medium gp-text-[#212121] ${r?"gp-border-[#3C67FF]":"gp-border-transparent"}`,onClick:e=>{e.preventDefault(),f()},role:"presentation",children:[e.jsxs("span",{children:[s.name," (",s.width,"px)"]}),e.jsx("span",{children:e.jsx("svg",{width:"9",height:"5",viewBox:"0 0 9 5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.07564 0.775834C1.30995 0.541519 1.68985 0.541519 1.92417 0.775834L4.6999 3.55157L7.47564 0.775834C7.70995 0.541519 8.08985 0.541519 8.32417 0.775834C8.55848 1.01015 8.55848 1.39005 8.32417 1.62436L5.12417 4.82436C4.88985 5.05868 4.50995 5.05868 4.27564 4.82436L1.07564 1.62436C0.841324 1.39005 0.841324 1.01015 1.07564 0.775834Z",fill:"#212121"})})})]}),e.jsx("div",{className:`gp-absolute gp-top-9 gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-bg-[#212121] gp-rounded-xl gp-p-2 gp-text-[#F9F9F9] gp-w-[176px] gp-z-50 ${r?"":"gp-hidden"}`,children:i.devices.map(t=>e.jsx("div",{className:"gp-p-2 hover:gp-bg-[#3E3E3E] gp-rounded-md",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(t.id)},role:"presentation",children:e.jsxs("div",{className:'gp-flex gp-gap-2 gp-w-full gp-text-left gp-justify-space-between gp-cursor-pointer gp-leading-5 gp-text-xs gp-font-regular gp-text-[#212121]"',children:[e.jsx("span",{className:"gp-min-w-[16px]",children:h(t)&&e.jsx("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.6348 4.89265C12.792 5.07861 12.7878 5.37537 12.6255 5.55547L6.71176 12.118C6.55312 12.294 6.30118 12.294 6.14255 12.118L3.87448 9.60098C3.71219 9.42088 3.70805 9.12412 3.86523 8.93815C4.02241 8.75219 4.2814 8.74744 4.4437 8.92755L6.42716 11.1287L12.0563 4.88203C12.2186 4.70192 12.4776 4.70668 12.6348 4.89265Z",fill:"#00C853"})})}),e.jsx("span",{children:t.name})]})},t.id))})]})}):null};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("next-seo"),r=require("next/head"),a=require("next/router"),i=require("../libs/hooks/use-tracking-view.js"),n=require("../libs/parse-html.js"),l=require("../components/builder/Header.js"),o=require("../components/FooterForPostPurchase.js"),d=require("next/script"),c=require("react"),g=require("../libs/hooks/usePageViewedTracking.js");exports.StaticPageV2=({components:u,builderData:p,sectionData:m,seo:h,themeStyle:x,fontStyle:j,elementFontStyle:f,customCodeHeader:y,shopToken:_,pageHandle:v,customFonts:b,isPostPurchase:P,shopName:k,productOffers:q,publicStoreFrontData:S,dynamicDiscountOffer:T,isPreview:N,interaction:H,pageBackground:I,sellingPlanSetting:w,buyerConsentPreCheck:E,id:F,shopID:L,domainTrackingIlp:M})=>{let $=a.useRouter(),{t:A}=s.useI18n(),B=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets.gemcommerce.
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("next-seo"),r=require("next/head"),a=require("next/router"),i=require("../libs/hooks/use-tracking-view.js"),n=require("../libs/parse-html.js"),l=require("../components/builder/Header.js"),o=require("../components/FooterForPostPurchase.js"),d=require("next/script"),c=require("react"),g=require("../libs/hooks/usePageViewedTracking.js");exports.StaticPageV2=({components:u,builderData:p,sectionData:m,seo:h,themeStyle:x,fontStyle:j,elementFontStyle:f,customCodeHeader:y,shopToken:_,pageHandle:v,customFonts:b,isPostPurchase:P,shopName:k,productOffers:q,publicStoreFrontData:S,dynamicDiscountOffer:T,isPreview:N,interaction:H,pageBackground:I,sellingPlanSetting:w,buyerConsentPreCheck:E,id:F,shopID:L,domainTrackingIlp:M})=>{let $=a.useRouter(),{t:A}=s.useI18n(),B=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets-dev.gemcommerce.xyz";i.useTrackingView(_,v,$.isFallback),g.usePageViewedTracking({id:F,shopID:L,domain:M});let C="custom-code-header";if(c.useEffect(()=>{let e=document.querySelectorAll(`[class*="${C}-"]`),s=[];e.length>1&&e.forEach(e=>{let t=e.className;if(s.includes(t)){e.remove();return}s.push(t)})},[]),$.isFallback)return e.jsx("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:e.jsxs("div",{className:"gp-flex gp-gap-2",children:[e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e.jsx("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let O=(H?.value||[]).length>0;return e.jsxs(e.Fragment,{children:[e.jsx(t.NextSeo,{...h}),e.jsxs(r,{children:[n.parseHtml(C,y,!0),x&&e.jsx("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:x}},"global-style"),j&&e.jsx("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:j}},"google-fonts"),f&&f.map(s=>e.jsx("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:s}},s)),b&&e.jsx("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:b}},j),I?.isUsePageBackground&&I?.background&&e.jsx("style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: ${I.background};
|
|
4
4
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,Fragment as t,jsxs as
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useState as n,useCallback as p,useEffect as d,useRef as r}from"react";import{devices as l}from"./const.js";import{useI18nStore as g}from"@gem-sdk/core";let o=()=>{let[o,a]=n(!1),{t:s}=g(),[m,c]=n({width:0,name:"",activeId:null}),[w,h]=n(!1),u=p(e=>{c(t=>({...t,...e}))},[c]);d(()=>{if(m)h(m.width>0&&m.width<=1024);else{let e=l[0];e&&u({width:e.width,name:e.name,activeId:e.id}),h(!1)}},[m,u]);let v=e=>{let t=l.find(t=>t.id===e);t&&(u({width:t.width,name:t.name,activeId:t.id}),f(t.id)),a(!o)},f=e=>{let t=new CustomEvent("editor:change-device",{bubbles:!0,detail:{id:e}});window.dispatchEvent(t)},x=r(null),b=e=>{x.current&&!x.current.contains(e.target)&&a(!1)},C=e=>{let t=l.find(t=>t.width===e);if(t)return t.name;let i=s("Desktop");return e<=768?s("Mobile"):e<=1024?s("Tablet"):i},E=p(e=>{let t=e.detail;t&&(document.body.toggleAttribute("data-editor-mobile",!!t.isEditorMobile),u({width:t.width,name:C(t.width),activeId:null}))},[u]);d(()=>(window.addEventListener("mousedown",b),window.addEventListener("editor:resize-preview-screen",E),()=>{window.removeEventListener("mousedown",b),window.removeEventListener("editor:resize-preview-screen",E),document.body.removeAttribute("data-editor-mobile")}),[E]);let L=e=>e.id===m.activeId||m.name===e.name,F=()=>a(!o);return w?e(t,{children:i("div",{ref:x,className:`gp-switch-view gp-font-sans gp-flex gp-h-[40px] gp-absolute gp-top-[2px] gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-gap-2 gp-items-center gp-justify-center gp-cursor-pointer ${o?"gp-z-50":"gp-z-1"}`,children:[i("div",{className:`gp-flex gp-gap-1 gp-py-1 gp-px-2 gp-transform -gp-translate-y-[2px] gp-border-[1px] gp-justify-between gp-items-center gp-min-w-[194px] gp-bg-[#F4F4F4] hover:gp-bg-[#E2E2E2] gp-rounded-md gp-leading-5 gp-text-xs gp-font-medium gp-text-[#212121] ${o?"gp-border-[#3C67FF]":"gp-border-transparent"}`,onClick:e=>{e.preventDefault(),F()},role:"presentation",children:[i("span",{children:[m.name," (",m.width,"px)"]}),e("span",{children:e("svg",{width:"9",height:"5",viewBox:"0 0 9 5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.07564 0.775834C1.30995 0.541519 1.68985 0.541519 1.92417 0.775834L4.6999 3.55157L7.47564 0.775834C7.70995 0.541519 8.08985 0.541519 8.32417 0.775834C8.55848 1.01015 8.55848 1.39005 8.32417 1.62436L5.12417 4.82436C4.88985 5.05868 4.50995 5.05868 4.27564 4.82436L1.07564 1.62436C0.841324 1.39005 0.841324 1.01015 1.07564 0.775834Z",fill:"#212121"})})})]}),e("div",{className:`gp-absolute gp-top-9 gp-transform -gp-translate-x-1/2 gp-left-1/2 gp-bg-[#212121] gp-rounded-xl gp-p-2 gp-text-[#F9F9F9] gp-w-[176px] gp-z-50 ${o?"":"gp-hidden"}`,children:l.map(t=>e("div",{className:"gp-p-2 hover:gp-bg-[#3E3E3E] gp-rounded-md",onClick:e=>{e.preventDefault(),e.stopPropagation(),v(t.id)},role:"presentation",children:i("div",{className:'gp-flex gp-gap-2 gp-w-full gp-text-left gp-justify-space-between gp-cursor-pointer gp-leading-5 gp-text-xs gp-font-regular gp-text-[#212121]"',children:[e("span",{className:"gp-min-w-[16px]",children:L(t)&&e("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.6348 4.89265C12.792 5.07861 12.7878 5.37537 12.6255 5.55547L6.71176 12.118C6.55312 12.294 6.30118 12.294 6.14255 12.118L3.87448 9.60098C3.71219 9.42088 3.70805 9.12412 3.86523 8.93815C4.02241 8.75219 4.2814 8.74744 4.4437 8.92755L6.42716 11.1287L12.0563 4.88203C12.2186 4.70192 12.4776 4.70668 12.6348 4.89265Z",fill:"#00C853"})})}),e("span",{children:t.name})]})},t.id))})]})}):null};export{o as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import{useI18n as a,PageProvider as r,BuilderComponentProvider as n,I18nProvider as l,SectionProvider as o,BuilderProvider as i,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as s}from"react/jsx-runtime";import{useI18n as a,PageProvider as r,BuilderComponentProvider as n,I18nProvider as l,SectionProvider as o,BuilderProvider as i,Render as p}from"@gem-sdk/core";import{NextSeo as c}from"next-seo";import d from"next/head";import{useRouter as m}from"next/router";import{useTrackingView as g}from"../libs/hooks/use-tracking-view.js";import{parseHtml as u}from"../libs/parse-html.js";import h from"../components/builder/Header.js";import f from"../components/FooterForPostPurchase.js";import y from"next/script";import{useEffect as _}from"react";import{usePageViewedTracking as b}from"../libs/hooks/usePageViewedTracking.js";let v=({components:v,builderData:k,sectionData:S,seo:x,themeStyle:P,fontStyle:N,elementFontStyle:T,customCodeHeader:j,shopToken:H,pageHandle:I,customFonts:L,isPostPurchase:M,shopName:$,productOffers:w,publicStoreFrontData:E,dynamicDiscountOffer:F,isPreview:q,interaction:A,pageBackground:O,sellingPlanSetting:z,buyerConsentPreCheck:C,id:D,shopID:U,domainTrackingIlp:B})=>{let R=m(),{t:V}=a(),G=process.env.NEXT_GP_BASE_ASSET_URL||"https://assets-dev.gemcommerce.xyz";g(H,I,R.isFallback),b({id:D,shopID:U,domain:B});let J="custom-code-header";if(_(()=>{let e=document.querySelectorAll(`[class*="${J}-"]`),t=[];e.length>1&&e.forEach(e=>{let s=e.className;if(t.includes(s)){e.remove();return}t.push(s)})},[]),R.isFallback)return e("div",{className:"gp-flex gp-h-[100vh] gp-items-center gp-justify-center",children:t("div",{className:"gp-flex gp-gap-2",children:[e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_200ms_linear_alternate] gp-rounded-full gp-bg-slate-800"}),e("span",{className:"gp-aspect-square gp-h-2 gp-animate-[flashing_500ms_infinite_500ms_alternate] gp-rounded-full gp-bg-slate-800"})]})});let X=(A?.value||[]).length>0;return t(s,{children:[e(c,{...x}),t(d,{children:[u(J,j,!0),P&&e("style",{"data-id":"global-style",type:"text/css",dangerouslySetInnerHTML:{__html:P}},"global-style"),N&&e("style",{"data-id":"google-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:N}},"google-fonts"),T&&T.map(t=>e("style",{"data-id":"google-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:t}},t)),L&&e("style",{"data-id":"custom-element-fonts",type:"text/css",dangerouslySetInnerHTML:{__html:L}},N),O?.isUsePageBackground&&O?.background&&e("style",{children:`
|
|
2
2
|
body {
|
|
3
3
|
background: ${O.background};
|
|
4
4
|
}
|
|
5
|
-
`},`page_background_${O?.background}`)]}),e(r,{productOffers:w,publicStoreFrontData:E,dynamicDiscountOffer:F,sellingPlanMeta:
|
|
5
|
+
`},`page_background_${O?.background}`)]}),e(r,{productOffers:w,publicStoreFrontData:E,dynamicDiscountOffer:F,sellingPlanMeta:z,buyerConsentChecked:C,children:e(n,{components:v,children:e(l,{t:V,children:t("div",{className:`${M?"gp-bg-white post-purchase-page":""} `,role:"main",children:[M&&e(h,{pageType:"POST_PURCHASE"}),X&&e("div",{dangerouslySetInnerHTML:{__html:`<div id="gp-interaction" style="display: none;">${JSON.stringify(A?.value||[])}</div>`}}),e(o,{data:S,children:k?.map(s=>t(i,{state:s.data,lazy:s.lazy,priority:s.priority,isPostPurchase:M,isPreview:q,children:[e(p,{uid:s.uid}),X&&e(y,{defer:!0,src:`${G}/assets-v2/gp-flow-action-lip-v7-5.js`})]},s.uid))}),M&&e(f,{shopName:$||""})]})})})})]})};export{v as StaticPageV2};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/pages",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0-dev.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"next": "14.2.35"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@gem-sdk/core": "
|
|
31
|
-
"@gem-sdk/plugin-cookie-bar": "
|
|
32
|
-
"@gem-sdk/plugin-quick-view": "
|
|
33
|
-
"@gem-sdk/plugin-sticky-add-to-cart": "
|
|
30
|
+
"@gem-sdk/core": "19.0.0-dev.7",
|
|
31
|
+
"@gem-sdk/plugin-cookie-bar": "19.0.0-dev.0",
|
|
32
|
+
"@gem-sdk/plugin-quick-view": "19.0.0-dev.0",
|
|
33
|
+
"@gem-sdk/plugin-sticky-add-to-cart": "19.0.0-dev.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"next": "14.2.35"
|