@gem-sdk/core 12.0.0-dev.82 → 12.0.0-dev.84
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/ai-generator/AIContentGenerator.js +1 -1
- package/dist/cjs/components/ai-generator/components/PickProduct.js +1 -1
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +1 -1
- package/dist/cjs/components/toolbar/SectionErrorBanner.js +1 -1
- package/dist/esm/components/ai-generator/AIContentGenerator.js +1 -1
- package/dist/esm/components/ai-generator/components/PickProduct.js +1 -1
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +1 -1
- package/dist/esm/components/toolbar/SectionErrorBanner.js +1 -1
- package/package.json +2 -2
|
@@ -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),
|
|
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")
|
|
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
|
|
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");const SECTION_SIZE_GUIDE_URL="https://www.google.com/",SectionErrorBanner=({errorSectionInfo:e,onDismiss:i})=>e.isDismissed?null:jsxRuntime.jsx("div",{"data-toolbar-error-banner":!0,className:"gp-flex gp-items-center gp-px-2 gp-top-0 gp-w-full gp-
|
|
2
|
+
"use strict";var jsxRuntime=require("react/jsx-runtime");const SECTION_SIZE_GUIDE_URL="https://www.google.com/",SectionErrorBanner=({errorSectionInfo:e,onDismiss:i})=>e.isDismissed?null:jsxRuntime.jsx("div",{"data-toolbar-error-banner":!0,className:"gp-flex gp-items-center gp-px-2 gp-top-0 gp-w-full gp-absolute gp-bg-[#FEE4E3] gp-border-t gp-border-t-[#C3362B] gp-text-xs gp-text-[#C3362B] gp-leading-5",children:jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-gap-1.5 gp-w-full gp-h-10",children:[jsxRuntime.jsxs("svg",{className:"gp-flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44772 14.5 9 14.0523 9 13.5C9 12.9477 9.44772 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"#C3362B"}),jsxRuntime.jsx("path",{d:"M10.75 6.25001C10.75 5.8358 10.4142 5.50001 10 5.5C9.5858 5.49999 9.25001 5.83578 9.25 6.24999L9.24994 10.75C9.24993 11.1642 9.58572 11.5 9.99993 11.5C10.4141 11.5 10.7499 11.1642 10.7499 10.75L10.75 6.25001Z",fill:"#C3362B"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 17C13.866 17 17 13.866 17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 13.866 6.13401 17 10 17ZM10 15.5C13.0376 15.5 15.5 13.0376 15.5 10C15.5 6.96243 13.0376 4.5 10 4.5C6.96243 4.5 4.5 6.96243 4.5 10C4.5 13.0376 6.96243 15.5 10 15.5Z",fill:"#C3362B"})]}),jsxRuntime.jsxs("div",{className:"gp-w-full",children:["LIQUID_SYNTAX_ERROR"===e.type&&"This section contains a syntax error in the code. Please review and fix it, then try verifying again.","SECTION_SIZE_EXCEED_256KB"===e.type&&jsxRuntime.jsxs("div",{children:["This section is over Shopify's 256KB limit. Please follow ",jsxRuntime.jsx("a",{target:"_blank",href:SECTION_SIZE_GUIDE_URL,className:"gp-underline gp-cursor-pointer",onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(SECTION_SIZE_GUIDE_URL,"_blank")},rel:"noreferrer",children:"our guide"})," ","to optimize, then try verifying again."]}),"MISSING_SECTION_IN_THEME"===e.type&&"This section was deleted from your live theme. Please delete it from this page, or restore all sections by Force publish."]}),jsxRuntime.jsx("button",{className:"gp-p-1.5 gp-flex-shrink-0",onClick:i,type:"button",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M11.1755 12.0243C11.4099 12.2586 11.7898 12.2586 12.0241 12.0243C12.2584 11.79 12.2584 11.4101 12.0241 11.1758L8.84833 8.00005L12.0241 4.82431C12.2584 4.59 12.2584 4.2101 12.0241 3.97579C11.7898 3.74147 11.4099 3.74147 11.1755 3.97579L7.9998 7.15152L4.82407 3.97578C4.58975 3.74147 4.20986 3.74147 3.97554 3.97578C3.74123 4.2101 3.74123 4.59 3.97554 4.82431L7.15128 8.00005L3.97554 11.1758C3.74123 11.4101 3.74123 11.79 3.97554 12.0243C4.20986 12.2586 4.58975 12.2586 4.82407 12.0243L7.9998 8.84858L11.1755 12.0243Z",fill:"#212121"})})})]})});exports.SectionErrorBanner=SectionErrorBanner;
|
|
@@ -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=({...
|
|
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
|
|
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
|
|
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,jsxs as i}from"react/jsx-runtime";let SECTION_SIZE_GUIDE_URL="https://www.google.com/",SectionErrorBanner=({errorSectionInfo:t,onDismiss:l})=>t.isDismissed?null:e("div",{"data-toolbar-error-banner":!0,className:"gp-flex gp-items-center gp-px-2 gp-top-0 gp-w-full gp-
|
|
2
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";let SECTION_SIZE_GUIDE_URL="https://www.google.com/",SectionErrorBanner=({errorSectionInfo:t,onDismiss:l})=>t.isDismissed?null:e("div",{"data-toolbar-error-banner":!0,className:"gp-flex gp-items-center gp-px-2 gp-top-0 gp-w-full gp-absolute gp-bg-[#FEE4E3] gp-border-t gp-border-t-[#C3362B] gp-text-xs gp-text-[#C3362B] gp-leading-5",children:i("div",{className:"gp-flex gp-items-center gp-gap-1.5 gp-w-full gp-h-10",children:[i("svg",{className:"gp-flex-shrink-0",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44772 14.5 9 14.0523 9 13.5C9 12.9477 9.44772 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"#C3362B"}),e("path",{d:"M10.75 6.25001C10.75 5.8358 10.4142 5.50001 10 5.5C9.5858 5.49999 9.25001 5.83578 9.25 6.24999L9.24994 10.75C9.24993 11.1642 9.58572 11.5 9.99993 11.5C10.4141 11.5 10.7499 11.1642 10.7499 10.75L10.75 6.25001Z",fill:"#C3362B"}),e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 17C13.866 17 17 13.866 17 10C17 6.13401 13.866 3 10 3C6.13401 3 3 6.13401 3 10C3 13.866 6.13401 17 10 17ZM10 15.5C13.0376 15.5 15.5 13.0376 15.5 10C15.5 6.96243 13.0376 4.5 10 4.5C6.96243 4.5 4.5 6.96243 4.5 10C4.5 13.0376 6.96243 15.5 10 15.5Z",fill:"#C3362B"})]}),i("div",{className:"gp-w-full",children:["LIQUID_SYNTAX_ERROR"===t.type&&"This section contains a syntax error in the code. Please review and fix it, then try verifying again.","SECTION_SIZE_EXCEED_256KB"===t.type&&i("div",{children:["This section is over Shopify's 256KB limit. Please follow ",e("a",{target:"_blank",href:SECTION_SIZE_GUIDE_URL,className:"gp-underline gp-cursor-pointer",onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(SECTION_SIZE_GUIDE_URL,"_blank")},rel:"noreferrer",children:"our guide"})," ","to optimize, then try verifying again."]}),"MISSING_SECTION_IN_THEME"===t.type&&"This section was deleted from your live theme. Please delete it from this page, or restore all sections by Force publish."]}),e("button",{className:"gp-p-1.5 gp-flex-shrink-0",onClick:l,type:"button",children:e("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e("path",{d:"M11.1755 12.0243C11.4099 12.2586 11.7898 12.2586 12.0241 12.0243C12.2584 11.79 12.2584 11.4101 12.0241 11.1758L8.84833 8.00005L12.0241 4.82431C12.2584 4.59 12.2584 4.2101 12.0241 3.97579C11.7898 3.74147 11.4099 3.74147 11.1755 3.97579L7.9998 7.15152L4.82407 3.97578C4.58975 3.74147 4.20986 3.74147 3.97554 3.97578C3.74123 4.2101 3.74123 4.59 3.97554 4.82431L7.15128 8.00005L3.97554 11.1758C3.74123 11.4101 3.74123 11.79 3.97554 12.0243C4.20986 12.2586 4.58975 12.2586 4.82407 12.0243L7.9998 8.84858L11.1755 12.0243Z",fill:"#212121"})})})]})});export{SectionErrorBanner};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "12.0.0-dev.
|
|
3
|
+
"version": "12.0.0-dev.84",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@gem-sdk/adapter-shopify": "12.0.0-dev.53",
|
|
32
|
-
"@gem-sdk/styles": "12.0.0-dev.
|
|
32
|
+
"@gem-sdk/styles": "12.0.0-dev.84",
|
|
33
33
|
"@types/classnames": "2.3.4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|