@gem-sdk/core 12.0.0-dev.81 → 12.0.0-dev.83

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 jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js"),CloseIcon=require("./icons/CloseIcon.js"),ShowMoreIcon=require("./icons/ShowMoreIcon.js"),WarningIcon=require("./icons/WarningIcon.js"),UpgradeIcon=require("./icons/UpgradeIcon.js"),PickProduct=require("./components/PickProduct.js"),ToneAndVoice=require("./components/ToneAndVoice.js"),classNames=require("classnames"),useListenEventGenerate=require("./hooks/useListenEventGenerate.js"),useGettingGenerateRequest=require("./hooks/useGettingGenerateRequest.js"),useFlipPopup=require("./hooks/useFlipPopup.js"),useCheckingProductInside=require("./hooks/useCheckingProductInside.js");require("zustand");var I18nContext=require("../../contexts/I18nContext.js");require("react-transition-group");var ShopContext=require("../../contexts/ShopContext.js"),dayjs=require("dayjs");require("@gem-sdk/core"),require("swr"),require("../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("swr/infinite"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("../../hooks/useStickyStore.js"),require("../../types/builder.js"),require("../../types/custom.js"),require("../../types/animations.js");const AIContentGenerator=({...e})=>{let[t,s]=react.useState(!1),[n,r]=react.useState(!1),i=react.useRef(null),o=react.useRef(null),u=react.useRef(null),a=react.useRef(null),p=dayjs().add(1,"month").startOf("month").format("DD MMM"),{t:g}=I18nContext.useI18nStore(),{popupPositionX:c,popupPositionY:l,isValidating:d,bodyMaxHeight:x}=useFlipPopup.useFlipPopup(t,{genTool:i,genPopup:o,genPopupHeader:u,genButtonWrapper:a}),{isGenerating:m,onGenerate:j,onOpenProductElementSettings:h,goToPricing:f}=useListenEventGenerate.useListenEventGenerate({uid:e.uid,tag:String(e.tag)}),{getRequestBody:I,prompt:R,changeProductName:b,changePrompt:v,changeTone:q}=useGettingGenerateRequest.useGettingGenerateRequest(),{productElement:C,checkSectionHasProduct:w}=useCheckingProductInside.useCheckingProductInside(i),N=ShopContext.useShopStore(e=>e.generateContentLimitation),k=()=>{s(!t)},A=()=>{s(!1)},y=e=>{v(e.target.value)},G=react.useCallback(t=>{let s=t.detail;if(s?.componentUid!==e.uid){A();return}w()},[e.uid,w]),S=()=>{r(!n)},P=()=>{let e=I();j(e),A()},E=()=>{h(C.uid??"")};return react.useEffect(()=>{m||A()},[m]),react.useEffect(()=>{if(C.productId){r(!1);return}r(!0)},[C]),react.useEffect(()=>(window.addEventListener("editor:active-component",G),()=>{window.removeEventListener("editor:active-component",G)}),[G]),jsxRuntime.jsxs("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:i,children:[jsxRuntime.jsx("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:jsxRuntime.jsxs("button",{className:classNames({"gp-toolbar-ai-active":t},"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium"),onClick:k,children:[jsxRuntime.jsx(AIIcon.AIIcon,{}),g("AI Content")]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!t,"gp-right-0":"Section"===e.tag||"right"===c,"gp-left-0":"left"===c&&"Section"!==e.tag,"gp-top-8":"top"===l,"gp-bottom-8":"bottom"===l,"!gp-visible":!d},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:o,children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:u,children:[jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),jsxRuntime.jsx("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:A,children:jsxRuntime.jsx(CloseIcon.CloseIcon,{})})]}),jsxRuntime.jsx("div",{className:classNames({"gp-overflow-auto":null!==x},"gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl"),style:{maxHeight:null!==x?`${x}px`:"auto"},children:N?.isAllow?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),jsxRuntime.jsx("div",{className:"gp-mb-4 gp-flex",children:jsxRuntime.jsx("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: generate feature benefits",rows:4,value:R,onChange:y})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!n},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[jsxRuntime.jsx(ToneAndVoice.ToneAndVoice,{changeToneAndVoice:q}),jsxRuntime.jsx(PickProduct.PickProduct,{changeProductName:b,openProductSetting:E,productId:C.productId})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:S,children:["Show more",jsxRuntime.jsx("span",{className:classNames({"gp-rotate-180":n}),children:jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon,{})})]})})]}):jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[jsxRuntime.jsx("div",{className:"gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",children:jsxRuntime.jsx(WarningIcon.WarningIcon,{})}),jsxRuntime.jsxs("p",{className:"gp-text-xs gp-whitespace-normal",children:["You've reached ",N?.maxGenerateCount,"/",N?.maxGenerateCount," rewrites of your AI generative this month.",jsxRuntime.jsx("br",{}),"Resets on ",p,"."]})]})}),jsxRuntime.jsx("div",{className:"gp-p-4",ref:a,children:N?.isAllow?jsxRuntime.jsx("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:P,children:m?"Generating...":"Generate"}):jsxRuntime.jsxs("button",{className:"gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:f,children:[jsxRuntime.jsx(UpgradeIcon.UpgradeIcon,{}),N?.nextQuota?`Upgrade to generate ${N?.nextQuota} rewrites`:"You have reached limit this month"]})})]})]})};exports.AIContentGenerator=AIContentGenerator;
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js"),CloseIcon=require("./icons/CloseIcon.js"),ShowMoreIcon=require("./icons/ShowMoreIcon.js"),WarningIcon=require("./icons/WarningIcon.js"),UpgradeIcon=require("./icons/UpgradeIcon.js"),PickProduct=require("./components/PickProduct.js"),ToneAndVoice=require("./components/ToneAndVoice.js"),classNames=require("classnames"),useListenEventGenerate=require("./hooks/useListenEventGenerate.js"),useGettingGenerateRequest=require("./hooks/useGettingGenerateRequest.js"),useFlipPopup=require("./hooks/useFlipPopup.js"),useCheckingProductInside=require("./hooks/useCheckingProductInside.js");require("zustand");var I18nContext=require("../../contexts/I18nContext.js");require("react-transition-group");var ShopContext=require("../../contexts/ShopContext.js"),dayjs=require("dayjs");require("@gem-sdk/core"),require("swr"),require("../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("swr/infinite"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("../../hooks/useStickyStore.js"),require("../../types/builder.js"),require("../../types/custom.js"),require("../../types/animations.js");const AIContentGenerator=({...e})=>{let[t,s]=react.useState(!1),[n,r]=react.useState(!1),i=react.useRef(null),o=react.useRef(null),a=react.useRef(null),u=react.useRef(null),p=dayjs().add(1,"month").startOf("month").format("DD MMM"),{t:g}=I18nContext.useI18nStore(),{popupPositionX:c,popupPositionY:l,isValidating:d,bodyMaxHeight:x}=useFlipPopup.useFlipPopup(t,{genTool:i,genPopup:o,genPopupHeader:a,genButtonWrapper:u}),{isGenerating:m,onGenerate:j,onOpenProductElementSettings:h,goToPricing:f}=useListenEventGenerate.useListenEventGenerate({uid:e.uid,tag:String(e.tag)}),{getRequestBody:I,prompt:R,changeProductName:b,changePrompt:v,changeTone:q}=useGettingGenerateRequest.useGettingGenerateRequest(),{productElement:C,checkSectionHasProduct:w}=useCheckingProductInside.useCheckingProductInside(i),N=ShopContext.useShopStore(e=>e.generateContentLimitation),k=()=>{s(!t)},A=()=>{s(!1)},y=e=>{v(e.target.value)},G=react.useCallback(t=>{let s=t.detail;if(s?.componentUid!==e.uid){A();return}w()},[e.uid,w]),S=()=>{r(!n)},P=()=>{let e=I();j(e),A()},E=()=>{h(C.uid??"")};return react.useEffect(()=>{m||A()},[m]),react.useEffect(()=>{if(C.productId){r(!1);return}r(!0)},[C]),react.useEffect(()=>(window.addEventListener("editor:active-component",G),()=>{window.removeEventListener("editor:active-component",G)}),[G]),jsxRuntime.jsxs("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:i,children:[jsxRuntime.jsx("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:jsxRuntime.jsxs("button",{className:classNames({"gp-toolbar-ai-active":t},"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium"),onClick:k,children:[jsxRuntime.jsx(AIIcon.AIIcon,{}),g("AI Content")]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!t,"gp-right-0":"Section"===e.tag||"right"===c,"gp-left-0":"left"===c&&"Section"!==e.tag,"gp-top-8":"top"===l,"gp-bottom-8":"bottom"===l,"!gp-visible":!d},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:o,children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:a,children:[jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-sm",children:g("Write with GemAI")}),jsxRuntime.jsx("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:A,children:jsxRuntime.jsx(CloseIcon.CloseIcon,{})})]}),jsxRuntime.jsx("div",{className:classNames({"gp-overflow-auto":null!==x},"gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl"),style:{maxHeight:null!==x?`${x}px`:"auto"},children:N?.isAllow?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:g("What would you like to describe here?")})}),jsxRuntime.jsx("div",{className:"gp-mb-4 gp-flex",children:jsxRuntime.jsx("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:g("e.g: generate feature benefits"),rows:4,value:R,onChange:y})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!n},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[jsxRuntime.jsx(ToneAndVoice.ToneAndVoice,{changeToneAndVoice:q}),jsxRuntime.jsx(PickProduct.PickProduct,{changeProductName:b,openProductSetting:E,productId:C.productId})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:S,children:[g("Show more"),jsxRuntime.jsx("span",{className:classNames({"gp-rotate-180":n}),children:jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon,{})})]})})]}):jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[jsxRuntime.jsx("div",{className:"gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",children:jsxRuntime.jsx(WarningIcon.WarningIcon,{})}),jsxRuntime.jsxs("p",{className:"gp-text-xs gp-whitespace-normal",children:[g("You've reached {maxGenerateCount}/{maxGenerateCount} rewrites of your AI generative this month.",{maxGenerateCount:N?.maxGenerateCount}),jsxRuntime.jsx("br",{}),g("Resets on {nextMonth}.",{nextMonth:p})]})]})}),jsxRuntime.jsx("div",{className:"gp-p-4",ref:u,children:N?.isAllow?jsxRuntime.jsx("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:P,children:g(m?"Generating...":"Generate")}):jsxRuntime.jsxs("button",{className:"gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:f,children:[jsxRuntime.jsx(UpgradeIcon.UpgradeIcon,{}),N?.nextQuota?g("Upgrade to generate {nextQuota} rewrites",{nextQuota:N?.nextQuota}):g("You have reached limit this month")]})})]})]})};exports.AIContentGenerator=AIContentGenerator;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),SearchIcon=require("../icons/SearchIcon.js"),useProductsQuery=require("../../../hooks/shop/use-products-query.js"),classNames=require("classnames");require("zustand"),require("react-transition-group"),require("swr"),require("dayjs"),require("@gem-sdk/core"),require("../../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var useProductQuery=require("../../../hooks/shop/use-product-query.js");require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("../../../hooks/useStickyStore.js"),require("../../../types/builder.js"),require("../../../types/custom.js"),require("../../../types/animations.js");const PickProduct=e=>{let[s,t]=react.useState(e.productId?void 0:{first:8}),{data:r,isLoading:a,isValidating:u,size:i,setSize:c}=useProductsQuery.useListProductQuery(s,{revalidateFirstPage:!1}),{data:n}=useProductQuery.useProductQuery(e.productId),[p,l]=react.useState(),[o,g]=react.useState(!1),d=react.useRef(null),m=react.useRef(null),x=()=>{e.productId||g(!o)},j=e=>{l(e),g(!1)},h=e=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{let s=e.target.value??"";if(s){t({first:8,where:{titleContainsFold:s}});return}t({first:8})},200)},f=()=>{e.openProductSetting()},b=e=>{let s=e.target;s.scrollHeight-s.scrollTop===s.clientHeight&&(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{c(i+1)},50))},R=react.useMemo(()=>r?.reduce((e,s)=>[...e,...s.products?.edges??[]],[])??[],[r]);react.useEffect(()=>{if(R.length&&!p&&!e.productId){let e=R[0]?.node;e&&l({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[R,p,e.productId]),react.useEffect(()=>{p&&p.name&&e.changeProductName(p.name)},[p,e]),react.useEffect(()=>{n&&l({id:n.id,name:n.title,image:n.featuredImage?.src})},[n]);let q="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[!a||p?jsxRuntime.jsxs("button",{className:classNames({"gp-cursor-default":e.productId},"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs"),onClick:x,children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:p?.image||q,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px]",children:p?.name})]}):jsxRuntime.jsx("div",{children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})}),e.productId&&jsxRuntime.jsx("div",{className:"gp-mt-2 gp-text-xs",children:jsxRuntime.jsxs("p",{children:["You can manage it in"," ",jsxRuntime.jsx("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:f,children:"Product element"})]})}),o&&jsxRuntime.jsxs("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[jsxRuntime.jsx(SearchIcon.SearchIcon,{}),jsxRuntime.jsx("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:"Search product...",onChange:h})]}),jsxRuntime.jsxs("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:b,children:[R?.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{j({id:e.node?.id,name:e.node?.title,image:e.node?.featuredImage?.src})},children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:e.node?.featuredImage?.src||q,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:e.node?.title})]},e.node?.id)),a||u&&jsxRuntime.jsx("div",{className:"gp-p-2",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})})]})]})]})]})};exports.PickProduct=PickProduct;
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),SearchIcon=require("../icons/SearchIcon.js"),useProductsQuery=require("../../../hooks/shop/use-products-query.js"),classNames=require("classnames");require("zustand");var I18nContext=require("../../../contexts/I18nContext.js");require("react-transition-group"),require("swr"),require("dayjs"),require("@gem-sdk/core"),require("../../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var useProductQuery=require("../../../hooks/shop/use-product-query.js");require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("../../../hooks/useStickyStore.js"),require("../../../types/builder.js"),require("../../../types/custom.js"),require("../../../types/animations.js");const PickProduct=e=>{let{t}=I18nContext.useI18nStore(),[s,r]=react.useState(e.productId?void 0:{first:8}),{data:a,isLoading:u,isValidating:i,size:c,setSize:n}=useProductsQuery.useListProductQuery(s,{revalidateFirstPage:!1}),{data:p}=useProductQuery.useProductQuery(e.productId),[o,l]=react.useState(),[g,d]=react.useState(!1),m=react.useRef(null),x=react.useRef(null),j=()=>{e.productId||d(!g)},h=e=>{l(e),d(!1)},f=e=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{let t=e.target.value??"";if(t){r({first:8,where:{titleContainsFold:t}});return}r({first:8})},200)},b=()=>{e.openProductSetting()},R=e=>{let t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&(x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{n(c+1)},50))},q=react.useMemo(()=>a?.reduce((e,t)=>[...e,...t.products?.edges??[]],[])??[],[a]);react.useEffect(()=>{if(q.length&&!o&&!e.productId){let e=q[0]?.node;e&&l({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[q,o,e.productId]),react.useEffect(()=>{o&&o.name&&e.changeProductName(o.name)},[o,e]),react.useEffect(()=>{p&&l({id:p.id,name:p.title,image:p.featuredImage?.src})},[p]);let v="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:t("Product")}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[!u||o?jsxRuntime.jsxs("button",{className:classNames({"gp-cursor-default":e.productId},"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs"),onClick:j,children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:o?.image||v,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px]",children:o?.name})]}):jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("span",{className:"gp-text-xs",children:[t("Getting products"),"..."]})}),e.productId&&jsxRuntime.jsx("div",{className:"gp-mt-2 gp-text-xs",children:jsxRuntime.jsxs("p",{children:[t("You can manage it in")," ",jsxRuntime.jsx("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:b,children:t("Product element")})]})}),g&&jsxRuntime.jsxs("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[jsxRuntime.jsx(SearchIcon.SearchIcon,{}),jsxRuntime.jsx("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:t("Search product")+"...",onChange:f})]}),jsxRuntime.jsxs("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:R,children:[q?.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{h({id:e.node?.id,name:e.node?.title,image:e.node?.featuredImage?.src})},children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:e.node?.featuredImage?.src||v,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:e.node?.title})]},e.node?.id)),u||i&&jsxRuntime.jsx("div",{className:"gp-p-2",children:jsxRuntime.jsxs("span",{className:"gp-text-xs",children:[t("Getting products"),"..."]})})]})]})]})]})};exports.PickProduct=PickProduct;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),DropdownIcon=require("../icons/DropdownIcon.js"),classNames=require("classnames");const ToneAndVoice=e=>{let s=["Persuasive","Friendly","Professional","Casual"],[n,i]=react.useState(s[0]),[p,t]=react.useState(!1),c=()=>{t(!p)},l=e=>{i(e),t(!1)};return react.useEffect(()=>{n&&e.changeToneAndVoice(n)},[n,e]),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:"Tone and Voice"}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:c,children:[n,jsxRuntime.jsx(DropdownIcon.DropdownIcon,{})]}),p?jsxRuntime.jsx("div",{className:"gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",onClick:()=>l(e),children:[jsxRuntime.jsx("div",{className:classNames({"gp-invisible":n!==e}),children:jsxRuntime.jsx(DropdownIcon.TickIcon,{})}),jsxRuntime.jsx("span",{className:"gp-text-xs",children:e})]},e))}):null]})]})})};exports.ToneAndVoice=ToneAndVoice;
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),DropdownIcon=require("../icons/DropdownIcon.js"),classNames=require("classnames");require("zustand");var I18nContext=require("../../../contexts/I18nContext.js");require("react-transition-group"),require("swr"),require("swr/infinite"),require("dayjs"),require("@gem-sdk/core"),require("../../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("../../../hooks/useStickyStore.js"),require("../../../types/builder.js"),require("../../../types/custom.js"),require("../../../types/animations.js");const ToneAndVoice=e=>{let{t:s}=I18nContext.useI18nStore(),r=[{label:s("Persuasive"),value:"Persuasive"},{label:s("Friendly"),value:"Friendly"},{label:s("Professional"),value:"Professional"},{label:s("Casual"),value:"Casual"}],[n,i]=react.useState(r[0]),[a,t]=react.useState(!1),l=()=>{t(!a)},u=e=>{i(e),t(!1)};return react.useEffect(()=>{n&&e.changeToneAndVoice(n.value)},[n,e]),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:s("Tone and Voice")}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:l,children:[n?.label,jsxRuntime.jsx(DropdownIcon.DropdownIcon,{})]}),a?jsxRuntime.jsx("div",{className:"gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:r.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",onClick:()=>u(e),children:[jsxRuntime.jsx("div",{className:classNames({"gp-invisible":n?.value!==e.value}),children:jsxRuntime.jsx(DropdownIcon.TickIcon,{})}),jsxRuntime.jsx("span",{className:"gp-text-xs",children:e.label})]},e.value))}):null]})]})})};exports.ToneAndVoice=ToneAndVoice;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand");const PageContext=react.createContext(null),createPageStoreProvider=e=>zustand.createStore(t=>({...e,setAssignedProductIds:e=>{t({assignedProductIds:e})},setIsApplyAllProducts:e=>{t({isApplyAllProducts:e})},setDynamicProduct:e=>{t({dynamicProduct:e})},setDynamicCollection:e=>{t({dynamicCollection:e})},setPostPurchaseProductOffers:e=>{t({productOffers:e})},setDynamicDiscountOffer:e=>{t({dynamicDiscountOffer:e})},setSalePageProductId:e=>{t({salePageProductId:e})},setPublicStoreFrontData:e=>{t({publicStoreFrontData:e})},setInteractionIsSelectOnPage:e=>{t(t=>({interactionData:{...t.interactionData,isSelectOnPage:e}}))},setInteractionItem:e=>{t(t=>({interactionData:{...t.interactionData,item:e,isSelectOnPage:t.interactionData?.isSelectOnPage||!1}}))},setInteractionSelectType:e=>{t(t=>({interactionData:{...t.interactionData,selectType:e}}))},setInteractionSettingType:e=>{t(t=>({interactionData:{...t.interactionData,settingType:e}}))},setSidebarMode:e=>{t(()=>({sidebarMode:e}))},setSellingPlanMeta:e=>{t({sellingPlanMeta:e})},setBuyerConsentChecked:e=>{t({buyerConsentChecked:e})}})),PageProvider=({children:e,dynamicProduct:t,dynamicCollection:a,productOffers:r,dynamicDiscountOffer:n,publicStoreFrontData:i,assignedProductIds:o,isApplyAllProducts:s,sellingPlanMeta:c,buyerConsentChecked:u,...P})=>{let d=react.useMemo(()=>createPageStoreProvider({dynamicProduct:t,dynamicCollection:a,productOffers:r,assignedProductIds:o,isApplyAllProducts:s,dynamicDiscountOffer:n,publicStoreFrontData:i,interactionData:{selectType:"ELEMENT"},sellingPlanMeta:c,buyerConsentChecked:u}),[t,a,r,n,i,o,s,c,u]);return jsxRuntime.jsx(PageContext.Provider,{...P,value:d,children:e})},usePageStore=(e,t)=>{let a=react.useContext(PageContext);if(!a)throw Error("usePageStore must be used within a PageProvider");return zustand.useStore(a,e,t)};exports.PageProvider=PageProvider,exports.usePageStore=usePageStore;
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),zustand=require("zustand");const PageContext=react.createContext(null),createPageStoreProvider=e=>zustand.createStore(t=>({...e,setAssignedProductIds:e=>{t({assignedProductIds:e})},setIsApplyAllProducts:e=>{t({isApplyAllProducts:e})},setDynamicProduct:e=>{t({dynamicProduct:e})},setDynamicCollection:e=>{t({dynamicCollection:e})},setPostPurchaseProductOffers:e=>{t({productOffers:e})},setDynamicDiscountOffer:e=>{t({dynamicDiscountOffer:e})},setSalePageProductId:e=>{t({salePageProductId:e})},setPublicStoreFrontData:e=>{t({publicStoreFrontData:e})},setInteractionIsSelectOnPage:e=>{t(t=>({interactionData:{...t.interactionData,isSelectOnPage:e}}))},setInteractionItem:e=>{t(t=>({interactionData:{...t.interactionData,item:e,isSelectOnPage:t.interactionData?.isSelectOnPage||!1}}))},setInteractionSelectType:e=>{t(t=>({interactionData:{...t.interactionData,selectType:e}}))},setInteractionSettingType:e=>{t(t=>({interactionData:{...t.interactionData,settingType:e}}))},setSidebarMode:e=>{t(()=>({sidebarMode:e}))},setSellingPlanMeta:e=>{t({sellingPlanMeta:e})},setBuyerConsentChecked:e=>{t({buyerConsentChecked:e})},setSubscriptionVisible:({isShow:e,productID:r})=>{t(t=>({subscriptionVisible:{...t.subscriptionVisible??{},[r]:e}}))}})),PageProvider=({children:e,dynamicProduct:t,dynamicCollection:r,productOffers:a,dynamicDiscountOffer:i,publicStoreFrontData:n,assignedProductIds:s,isApplyAllProducts:o,sellingPlanMeta:c,buyerConsentChecked:u,...P})=>{let d=react.useMemo(()=>createPageStoreProvider({dynamicProduct:t,dynamicCollection:r,productOffers:a,assignedProductIds:s,isApplyAllProducts:o,dynamicDiscountOffer:i,publicStoreFrontData:n,interactionData:{selectType:"ELEMENT"},sellingPlanMeta:c,buyerConsentChecked:u}),[t,r,a,i,n,s,o,c,u]);return jsxRuntime.jsx(PageContext.Provider,{...P,value:d,children:e})},usePageStore=(e,t)=>{let r=react.useContext(PageContext);if(!r)throw Error("usePageStore must be used within a PageProvider");return zustand.useStore(r,e,t)};exports.PageProvider=PageProvider,exports.usePageStore=usePageStore;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as p,useRef as r,useCallback as n,useEffect as i}from"react";import{AIIcon as g}from"./icons/AIIcon.js";import{CloseIcon as s}from"./icons/CloseIcon.js";import{ShowMoreIcon as a}from"./icons/ShowMoreIcon.js";import{WarningIcon as l}from"./icons/WarningIcon.js";import{UpgradeIcon as m}from"./icons/UpgradeIcon.js";import{PickProduct as c}from"./components/PickProduct.js";import{ToneAndVoice as d}from"./components/ToneAndVoice.js";import u from"classnames";import{useListenEventGenerate as h}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as f}from"./hooks/useGettingGenerateRequest.js";import{useFlipPopup as x}from"./hooks/useFlipPopup.js";import{useCheckingProductInside as b}from"./hooks/useCheckingProductInside.js";import"zustand";import{useI18nStore as v}from"../../contexts/I18nContext.js";import"react-transition-group";import{useShopStore as w}from"../../contexts/ShopContext.js";import j from"dayjs";import"@gem-sdk/core";import"swr";import"../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"../../hooks/useStickyStore.js";import"../../types/builder.js";import"../../types/custom.js";import"../../types/animations.js";let AIContentGenerator=({...N})=>{let[C,y]=p(!1),[k,I]=p(!1),A=r(null),G=r(null),S=r(null),B=r(null),F=j().add(1,"month").startOf("month").format("DD MMM"),{t:P}=v(),{popupPositionX:D,popupPositionY:E,isValidating:M,bodyMaxHeight:L}=x(C,{genTool:A,genPopup:G,genPopupHeader:S,genButtonWrapper:B}),{isGenerating:U,onGenerate:z,onOpenProductElementSettings:V,goToPricing:W}=h({uid:N.uid,tag:String(N.tag)}),{getRequestBody:H,prompt:Q,changeProductName:R,changePrompt:T,changeTone:Y}=f(),{productElement:$,checkSectionHasProduct:q}=b(A),O=w(e=>e.generateContentLimitation),J=()=>{y(!C)},K=()=>{y(!1)},X=e=>{T(e.target.value)},Z=n(e=>{let t=e.detail;if(t?.componentUid!==N.uid){K();return}q()},[N.uid,q]),_=()=>{I(!k)},ee=()=>{let e=H();z(e),K()},et=()=>{V($.uid??"")};return i(()=>{U||K()},[U]),i(()=>{if($.productId){I(!1);return}I(!0)},[$]),i(()=>(window.addEventListener("editor:active-component",Z),()=>{window.removeEventListener("editor:active-component",Z)}),[Z]),e("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:A,children:[t("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:e("button",{className:u({"gp-toolbar-ai-active":C},"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium"),onClick:J,children:[t(g,{}),P("AI Content")]})}),e("div",{className:u({"gp-hidden":!C,"gp-right-0":"Section"===N.tag||"right"===D,"gp-left-0":"left"===D&&"Section"!==N.tag,"gp-top-8":"top"===E,"gp-bottom-8":"bottom"===E,"!gp-visible":!M},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:G,children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:S,children:[t("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),t("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:K,children:t(s,{})})]}),t("div",{className:u({"gp-overflow-auto":null!==L},"gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl"),style:{maxHeight:null!==L?`${L}px`:"auto"},children:O?.isAllow?e(o,{children:[t("div",{className:"gp-mb-4",children:t("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),t("div",{className:"gp-mb-4 gp-flex",children:t("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: generate feature benefits",rows:4,value:Q,onChange:X})}),e("div",{className:u({"gp-hidden":!k},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[t(d,{changeToneAndVoice:Y}),t(c,{changeProductName:R,openProductSetting:et,productId:$.productId})]}),t("div",{children:e("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:_,children:["Show more",t("span",{className:u({"gp-rotate-180":k}),children:t(a,{})})]})})]}):e("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[t("div",{className:"gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",children:t(l,{})}),e("p",{className:"gp-text-xs gp-whitespace-normal",children:["You've reached ",O?.maxGenerateCount,"/",O?.maxGenerateCount," rewrites of your AI generative this month.",t("br",{}),"Resets on ",F,"."]})]})}),t("div",{className:"gp-p-4",ref:B,children:O?.isAllow?t("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:ee,children:U?"Generating...":"Generate"}):e("button",{className:"gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:W,children:[t(m,{}),O?.nextQuota?`Upgrade to generate ${O?.nextQuota} rewrites`:"You have reached limit this month"]})})]})]})};export{AIContentGenerator};
2
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as p,useRef as r,useCallback as n,useEffect as i}from"react";import{AIIcon as g}from"./icons/AIIcon.js";import{CloseIcon as s}from"./icons/CloseIcon.js";import{ShowMoreIcon as a}from"./icons/ShowMoreIcon.js";import{WarningIcon as l}from"./icons/WarningIcon.js";import{UpgradeIcon as m}from"./icons/UpgradeIcon.js";import{PickProduct as c}from"./components/PickProduct.js";import{ToneAndVoice as d}from"./components/ToneAndVoice.js";import u from"classnames";import{useListenEventGenerate as h}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as f}from"./hooks/useGettingGenerateRequest.js";import{useFlipPopup as x}from"./hooks/useFlipPopup.js";import{useCheckingProductInside as b}from"./hooks/useCheckingProductInside.js";import"zustand";import{useI18nStore as v}from"../../contexts/I18nContext.js";import"react-transition-group";import{useShopStore as w}from"../../contexts/ShopContext.js";import j from"dayjs";import"@gem-sdk/core";import"swr";import"../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"../../hooks/useStickyStore.js";import"../../types/builder.js";import"../../types/custom.js";import"../../types/animations.js";let AIContentGenerator=({...C})=>{let[N,y]=p(!1),[k,I]=p(!1),A=r(null),G=r(null),S=r(null),B=r(null),F=j().add(1,"month").startOf("month").format("DD MMM"),{t:M}=v(),{popupPositionX:P,popupPositionY:D,isValidating:E,bodyMaxHeight:L}=x(N,{genTool:A,genPopup:G,genPopupHeader:S,genButtonWrapper:B}),{isGenerating:Q,onGenerate:U,onOpenProductElementSettings:z,goToPricing:V}=h({uid:C.uid,tag:String(C.tag)}),{getRequestBody:W,prompt:H,changeProductName:R,changePrompt:T,changeTone:Y}=f(),{productElement:q,checkSectionHasProduct:O}=b(A),$=w(e=>e.generateContentLimitation),J=()=>{y(!N)},K=()=>{y(!1)},X=e=>{T(e.target.value)},Z=n(e=>{let t=e.detail;if(t?.componentUid!==C.uid){K();return}O()},[C.uid,O]),_=()=>{I(!k)},ee=()=>{let e=W();U(e),K()},et=()=>{z(q.uid??"")};return i(()=>{Q||K()},[Q]),i(()=>{if(q.productId){I(!1);return}I(!0)},[q]),i(()=>(window.addEventListener("editor:active-component",Z),()=>{window.removeEventListener("editor:active-component",Z)}),[Z]),e("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:A,children:[t("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:e("button",{className:u({"gp-toolbar-ai-active":N},"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium"),onClick:J,children:[t(g,{}),M("AI Content")]})}),e("div",{className:u({"gp-hidden":!N,"gp-right-0":"Section"===C.tag||"right"===P,"gp-left-0":"left"===P&&"Section"!==C.tag,"gp-top-8":"top"===D,"gp-bottom-8":"bottom"===D,"!gp-visible":!E},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:G,children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:S,children:[t("span",{className:"gp-font-medium gp-text-sm",children:M("Write with GemAI")}),t("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:K,children:t(s,{})})]}),t("div",{className:u({"gp-overflow-auto":null!==L},"gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl"),style:{maxHeight:null!==L?`${L}px`:"auto"},children:$?.isAllow?e(o,{children:[t("div",{className:"gp-mb-4",children:t("span",{className:"gp-text-xs",children:M("What would you like to describe here?")})}),t("div",{className:"gp-mb-4 gp-flex",children:t("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:M("e.g: generate feature benefits"),rows:4,value:H,onChange:X})}),e("div",{className:u({"gp-hidden":!k},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[t(d,{changeToneAndVoice:Y}),t(c,{changeProductName:R,openProductSetting:et,productId:q.productId})]}),t("div",{children:e("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:_,children:[M("Show more"),t("span",{className:u({"gp-rotate-180":k}),children:t(a,{})})]})})]}):e("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[t("div",{className:"gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",children:t(l,{})}),e("p",{className:"gp-text-xs gp-whitespace-normal",children:[M("You've reached {maxGenerateCount}/{maxGenerateCount} rewrites of your AI generative this month.",{maxGenerateCount:$?.maxGenerateCount}),t("br",{}),M("Resets on {nextMonth}.",{nextMonth:F})]})]})}),t("div",{className:"gp-p-4",ref:B,children:$?.isAllow?t("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:ee,children:M(Q?"Generating...":"Generate")}):e("button",{className:"gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:V,children:[t(m,{}),$?.nextQuota?M("Upgrade to generate {nextQuota} rewrites",{nextQuota:$?.nextQuota}):M("You have reached limit this month")]})})]})]})};export{AIContentGenerator};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useRef as p,useMemo as a,useEffect as o}from"react";import{SearchIcon as s}from"../icons/SearchIcon.js";import{useListProductQuery as i}from"../../../hooks/shop/use-products-query.js";import l from"classnames";import"zustand";import"react-transition-group";import"swr";import"dayjs";import"@gem-sdk/core";import"../../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductQuery as c}from"../../../hooks/shop/use-product-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"../../../hooks/useStickyStore.js";import"../../../types/builder.js";import"../../../types/custom.js";import"../../../types/animations.js";let PickProduct=g=>{let[d,n]=r(g.productId?void 0:{first:8}),{data:m,isLoading:u,isValidating:h,size:f,setSize:x}=i(d,{revalidateFirstPage:!1}),{data:b}=c(g.productId),[N,v]=r(),[I,k]=r(!1),w=p(null),j=p(null),y=()=>{g.productId||k(!I)},P=e=>{v(e),k(!1)},S=e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{let t=e.target.value??"";if(t){n({first:8,where:{titleContainsFold:t}});return}n({first:8})},200)},C=()=>{g.openProductSetting()},z=e=>{let t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&(j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{x(f+1)},50))},T=a(()=>m?.reduce((e,t)=>[...e,...t.products?.edges??[]],[])??[],[m]);o(()=>{if(T.length&&!N&&!g.productId){let e=T[0]?.node;e&&v({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[T,N,g.productId]),o(()=>{N&&N.name&&g.changeProductName(N.name)},[N,g]),o(()=>{b&&v({id:b.id,name:b.title,image:b.featuredImage?.src})},[b]);let F="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return e("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[t("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),e("div",{className:"gp-relative",children:[!u||N?e("button",{className:l({"gp-cursor-default":g.productId},"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs"),onClick:y,children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:N?.image||F,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px]",children:N?.name})]}):t("div",{children:t("span",{className:"gp-text-xs",children:"Getting products..."})}),g.productId&&t("div",{className:"gp-mt-2 gp-text-xs",children:e("p",{children:["You can manage it in"," ",t("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:C,children:"Product element"})]})}),I&&e("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:[e("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[t(s,{}),t("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:"Search product...",onChange:S})]}),e("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:z,children:[T?.map(r=>e("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{P({id:r.node?.id,name:r.node?.title,image:r.node?.featuredImage?.src})},children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:r.node?.featuredImage?.src||F,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:r.node?.title})]},r.node?.id)),u||h&&t("div",{className:"gp-p-2",children:t("span",{className:"gp-text-xs",children:"Getting products..."})})]})]})]})]})};export{PickProduct};
2
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useRef as p,useMemo as o,useEffect as a}from"react";import{SearchIcon as s}from"../icons/SearchIcon.js";import{useListProductQuery as i}from"../../../hooks/shop/use-products-query.js";import c from"classnames";import"zustand";import{useI18nStore as l}from"../../../contexts/I18nContext.js";import"react-transition-group";import"swr";import"dayjs";import"@gem-sdk/core";import"../../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductQuery as g}from"../../../hooks/shop/use-product-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"../../../hooks/useStickyStore.js";import"../../../types/builder.js";import"../../../types/custom.js";import"../../../types/animations.js";let PickProduct=n=>{let{t:d}=l(),[m,u]=r(n.productId?void 0:{first:8}),{data:h,isLoading:f,isValidating:x,size:b,setSize:N}=i(m,{revalidateFirstPage:!1}),{data:v}=g(n.productId),[I,j]=r(),[k,w]=r(!1),y=p(null),P=p(null),C=()=>{n.productId||w(!k)},S=e=>{j(e),w(!1)},z=e=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{let t=e.target.value??"";if(t){u({first:8,where:{titleContainsFold:t}});return}u({first:8})},200)},T=()=>{n.openProductSetting()},F=e=>{let t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{N(b+1)},50))},B=o(()=>h?.reduce((e,t)=>[...e,...t.products?.edges??[]],[])??[],[h]);a(()=>{if(B.length&&!I&&!n.productId){let e=B[0]?.node;e&&j({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[B,I,n.productId]),a(()=>{I&&I.name&&n.changeProductName(I.name)},[I,n]),a(()=>{v&&j({id:v.id,name:v.title,image:v.featuredImage?.src})},[v]);let _="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return e("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[t("p",{className:"gp-py-2 gp-text-xs",children:d("Product")}),e("div",{className:"gp-relative",children:[!f||I?e("button",{className:c({"gp-cursor-default":n.productId},"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs"),onClick:C,children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:I?.image||_,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px]",children:I?.name})]}):t("div",{children:e("span",{className:"gp-text-xs",children:[d("Getting products"),"..."]})}),n.productId&&t("div",{className:"gp-mt-2 gp-text-xs",children:e("p",{children:[d("You can manage it in")," ",t("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:T,children:d("Product element")})]})}),k&&e("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:[e("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[t(s,{}),t("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:d("Search product")+"...",onChange:z})]}),e("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:F,children:[B?.map(r=>e("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{S({id:r.node?.id,name:r.node?.title,image:r.node?.featuredImage?.src})},children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:r.node?.featuredImage?.src||_,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:r.node?.title})]},r.node?.id)),f||x&&t("div",{className:"gp-p-2",children:e("span",{className:"gp-text-xs",children:[d("Getting products"),"..."]})})]})]})]})]})};export{PickProduct};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e,jsxs as p}from"react/jsx-runtime";import{useState as l,useEffect as g}from"react";import{DropdownIcon as n,TickIcon as i}from"../icons/DropdownIcon.js";import o from"classnames";let ToneAndVoice=r=>{let s=["Persuasive","Friendly","Professional","Casual"],[c,a]=l(s[0]),[t,d]=l(!1),m=()=>{d(!t)},f=e=>{a(e),d(!1)};return g(()=>{c&&r.changeToneAndVoice(c)},[c,r]),e("div",{children:p("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[e("p",{className:"gp-py-2 gp-text-xs",children:"Tone and Voice"}),p("div",{className:"gp-relative",children:[p("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:m,children:[c,e(n,{})]}),t?e("div",{className:"gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s.map(l=>p("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",onClick:()=>f(l),children:[e("div",{className:o({"gp-invisible":c!==l}),children:e(i,{})}),e("span",{className:"gp-text-xs",children:l})]},l))}):null]})]})})};export{ToneAndVoice};
2
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useState as p,useEffect as o}from"react";import{DropdownIcon as r,TickIcon as s}from"../icons/DropdownIcon.js";import t from"classnames";import"zustand";import{useI18nStore as i}from"../../../contexts/I18nContext.js";import"react-transition-group";import"swr";import"swr/infinite";import"dayjs";import"@gem-sdk/core";import"../../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"../../../hooks/useStickyStore.js";import"../../../types/builder.js";import"../../../types/custom.js";import"../../../types/animations.js";let ToneAndVoice=a=>{let{t:n}=i(),g=[{label:n("Persuasive"),value:"Persuasive"},{label:n("Friendly"),value:"Friendly"},{label:n("Professional"),value:"Professional"},{label:n("Casual"),value:"Casual"}],[m,c]=p(g[0]),[d,u]=p(!1),v=()=>{u(!d)},f=e=>{c(e),u(!1)};return o(()=>{m&&a.changeToneAndVoice(m.value)},[m,a]),e("div",{children:l("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[e("p",{className:"gp-py-2 gp-text-xs",children:n("Tone and Voice")}),l("div",{className:"gp-relative",children:[l("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:v,children:[m?.label,e(r,{})]}),d?e("div",{className:"gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:g.map(p=>l("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",onClick:()=>f(p),children:[e("div",{className:t({"gp-invisible":m?.value!==p.value}),children:e(s,{})}),e("span",{className:"gp-text-xs",children:p.label})]},p.value))}):null]})]})})};export{ToneAndVoice};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as a,createContext as r}from"react";import{useStore as n,createStore as o}from"zustand";let PageContext=r(null),createPageStoreProvider=e=>o(t=>({...e,setAssignedProductIds:e=>{t({assignedProductIds:e})},setIsApplyAllProducts:e=>{t({isApplyAllProducts:e})},setDynamicProduct:e=>{t({dynamicProduct:e})},setDynamicCollection:e=>{t({dynamicCollection:e})},setPostPurchaseProductOffers:e=>{t({productOffers:e})},setDynamicDiscountOffer:e=>{t({dynamicDiscountOffer:e})},setSalePageProductId:e=>{t({salePageProductId:e})},setPublicStoreFrontData:e=>{t({publicStoreFrontData:e})},setInteractionIsSelectOnPage:e=>{t(t=>({interactionData:{...t.interactionData,isSelectOnPage:e}}))},setInteractionItem:e=>{t(t=>({interactionData:{...t.interactionData,item:e,isSelectOnPage:t.interactionData?.isSelectOnPage||!1}}))},setInteractionSelectType:e=>{t(t=>({interactionData:{...t.interactionData,selectType:e}}))},setInteractionSettingType:e=>{t(t=>({interactionData:{...t.interactionData,settingType:e}}))},setSidebarMode:e=>{t(()=>({sidebarMode:e}))},setSellingPlanMeta:e=>{t({sellingPlanMeta:e})},setBuyerConsentChecked:e=>{t({buyerConsentChecked:e})}})),PageProvider=({children:a,dynamicProduct:r,dynamicCollection:n,productOffers:o,dynamicDiscountOffer:i,publicStoreFrontData:c,assignedProductIds:s,isApplyAllProducts:P,sellingPlanMeta:d,buyerConsentChecked:l,...u})=>{let g=t(()=>createPageStoreProvider({dynamicProduct:r,dynamicCollection:n,productOffers:o,assignedProductIds:s,isApplyAllProducts:P,dynamicDiscountOffer:i,publicStoreFrontData:c,interactionData:{selectType:"ELEMENT"},sellingPlanMeta:d,buyerConsentChecked:l}),[r,n,o,i,c,s,P,d,l]);return e(PageContext.Provider,{...u,value:g,children:a})},usePageStore=(e,t)=>{let r=a(PageContext);if(!r)throw Error("usePageStore must be used within a PageProvider");return n(r,e,t)};export{PageProvider,usePageStore};
2
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as a,createContext as r}from"react";import{useStore as i,createStore as n}from"zustand";let PageContext=r(null),createPageStoreProvider=e=>n(t=>({...e,setAssignedProductIds:e=>{t({assignedProductIds:e})},setIsApplyAllProducts:e=>{t({isApplyAllProducts:e})},setDynamicProduct:e=>{t({dynamicProduct:e})},setDynamicCollection:e=>{t({dynamicCollection:e})},setPostPurchaseProductOffers:e=>{t({productOffers:e})},setDynamicDiscountOffer:e=>{t({dynamicDiscountOffer:e})},setSalePageProductId:e=>{t({salePageProductId:e})},setPublicStoreFrontData:e=>{t({publicStoreFrontData:e})},setInteractionIsSelectOnPage:e=>{t(t=>({interactionData:{...t.interactionData,isSelectOnPage:e}}))},setInteractionItem:e=>{t(t=>({interactionData:{...t.interactionData,item:e,isSelectOnPage:t.interactionData?.isSelectOnPage||!1}}))},setInteractionSelectType:e=>{t(t=>({interactionData:{...t.interactionData,selectType:e}}))},setInteractionSettingType:e=>{t(t=>({interactionData:{...t.interactionData,settingType:e}}))},setSidebarMode:e=>{t(()=>({sidebarMode:e}))},setSellingPlanMeta:e=>{t({sellingPlanMeta:e})},setBuyerConsentChecked:e=>{t({buyerConsentChecked:e})},setSubscriptionVisible:({isShow:e,productID:a})=>{t(t=>({subscriptionVisible:{...t.subscriptionVisible??{},[a]:e}}))}})),PageProvider=({children:a,dynamicProduct:r,dynamicCollection:i,productOffers:n,dynamicDiscountOffer:o,publicStoreFrontData:s,assignedProductIds:c,isApplyAllProducts:P,sellingPlanMeta:l,buyerConsentChecked:d,...u})=>{let g=t(()=>createPageStoreProvider({dynamicProduct:r,dynamicCollection:i,productOffers:n,assignedProductIds:c,isApplyAllProducts:P,dynamicDiscountOffer:o,publicStoreFrontData:s,interactionData:{selectType:"ELEMENT"},sellingPlanMeta:l,buyerConsentChecked:d}),[r,i,n,o,s,c,P,l,d]);return e(PageContext.Provider,{...u,value:g,children:a})},usePageStore=(e,t)=>{let r=a(PageContext);if(!r)throw Error("usePageStore must be used within a PageProvider");return i(r,e,t)};export{PageProvider,usePageStore};
@@ -43184,6 +43184,7 @@ type PageContextProps = {
43184
43184
  sidebarMode?: string;
43185
43185
  sellingPlanMeta?: any;
43186
43186
  buyerConsentChecked?: Record<string, boolean>;
43187
+ subscriptionVisible?: Record<string, boolean>;
43187
43188
  setDynamicProduct: (data: DynamicProduct) => void;
43188
43189
  setAssignedProductIds: (assignedIds: string[]) => void;
43189
43190
  setIsApplyAllProducts: (isApplyAllProducts: boolean) => void;
@@ -43199,6 +43200,10 @@ type PageContextProps = {
43199
43200
  setSidebarMode: (mode: string) => void;
43200
43201
  setSellingPlanMeta: (value: any) => void;
43201
43202
  setBuyerConsentChecked: (value: Record<string, boolean>) => void;
43203
+ setSubscriptionVisible: (params: {
43204
+ productID: string;
43205
+ isShow: boolean;
43206
+ }) => void;
43202
43207
  };
43203
43208
  type PageProviderProps = Pick<PageContextProps, 'dynamicProduct' | 'dynamicCollection' | 'productOffers' | 'dynamicDiscountOffer' | 'assignedProductIds' | 'isApplyAllProducts' | 'sellingPlanMeta' | 'buyerConsentChecked'> & {
43204
43209
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "12.0.0-dev.81",
3
+ "version": "12.0.0-dev.83",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",