1import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{t}from"./index-L3TmWtRi.js";import{a as m,A as R,F as L,b as E}from"./SetupGuide-DTy0rhhy.js";import{k as A,m as N}from"./components-BO0NEjVs.js";import{a as T,b as D}from"./units-C5cB52bu.js";import{C as F}from"./ClientOnly-Bhz3wYv3.js";import"./billingStatus-Bj0rS2-e.js";const M="/api/engagement";function W(){var s;return typeof window>"u"?null:((s=window==null?void 0:window.shopify)==null?void 0:s.reviews)??null}function q({show:s}){var k,p,y;const i=A(),[d,c]=t.useState("ask"),[a,h]=t.useState(""),[S,x]=t.useState(!1),n=t.useCallback(r=>{i.submit(r,{method:"post",action:M})},[i]),f=t.useCallback(async()=>{var g;x(!0);let r=!1,w="error";try{const l=await((g=W())==null?void 0:g.request());l&&(r=!!l.success,w=l.success?null:l.code??null)}catch(l){console.error("[engagement] reviews.request failed:",l)}n({intent:"reviewOutcome",success:String(r),code:w??""}),x(!1),c(r?"hidden":"fallback")},[n]),b=t.useCallback(()=>{n({intent:"reviewDismiss"}),c("hidden")},[n]),j=t.useCallback(()=>{a.trim()&&n({intent:"feedback",message:a})},[a,n]),u=i.state!=="idle",v=((k=i.data)==null?void 0:k.ok)===!1;return!s||d==="hidden"?null:d==="feedback"&&((p=i.data)==null?void 0:p.ok)===!0&&!u?e.jsx(C,{children:e.jsxs("s-grid",{gridTemplateColumns:"1fr auto",gap:"base",alignItems:"center",children:[e.jsx("s-paragraph",{children:"Thanks â that's landed with us. We read every one of these."}),e.jsx("s-button",{variant:"tertiary",onClick:()=>c("hidden"),children:"Close"})]})}):d==="fallback"?e.jsx(C,{children:e.jsxs("s-grid",{gridTemplateColumns:"1fr auto",gap:"base",alignItems:"center",children:[e.jsxs("s-stack",{gap:"small-500",children:[e.jsx("s-paragraph",{children:"Thanks! Reviews can't be left from here right now."}),e.jsxs("s-link",{href:R,target:"_blank",children:["Review ",m," on the App Store"]})]}),e.jsx("s-button",{variant:"tertiary",onClick:()=>c("hidden"),children:"Close"})]})}):d==="feedback"?e.jsx(C,{children:e.jsxs("s-stack",{gap:"small",children:[e.jsxs("s-heading",{children:["What would make ",m," better for you?"]}),e.jsx("s-text-area",{label:`What would make ${m} better?`,labelAccessibilityVisibility:"exclusive",value:a,onInput:r=>h(r.currentTarget.value),rows:3,autocomplete:"off",maxLength:4e3,placeholder:"A missing feature, something confusing, anything at allâ¦",error:v?(y=i.data)==null?void 0:y.error:void 0}),e.jsxs("s-stack",{direction:"inline",gap:"small-200",alignItems:"center",children:[e.jsx("s-button",{variant:"primary",loading:u,disabled:!a.trim(),onClick:j,children:"Send to our team"}),e.jsx("s-button",{variant:"tertiary",onClick:b,children:"Not now"})]}),e.jsxs("s-text",{color:"subdued",children:["Goes straight to ",L,". We'll reply to your store email."]})]})}):e.jsx(C,{children:e.jsxs("s-grid",{gridTemplateColumns:"@container (inline-size > 600px) 1fr auto, 1fr",gap:"base",alignItems:"center",children:[e.jsxs("s-stack",{gap:"small-500",children:[e.jsxs("s-heading",{children:["Enjoying ",m,"?"]}),e.jsx("s-text",{color:"subdued",children:"A review takes a moment and genuinely helps a small team like ours."})]}),e.jsxs("s-stack",{direction:"inline",gap:"small-200",alignItems:"center",children:[e.jsx("s-button",{variant:"primary",loading:S,onClick:f,children:"Yes, it's great"}),e.jsx("s-button",{onClick:()=>c("feedback"),children:"Not really"}),e.jsx("s-button",{variant:"tertiary",onClick:b,children:"Not now"})]})]})})}function C({children:s}){return e.jsx("s-section",{accessibilityLabel:`Feedback on ${m}`,children:e.jsx("s-query-container",{children:s})})}function H(){const{showReviewPrompt:s,shop:i,designCount:d,templateCount:c,previewToken:a,setup:h,addBlockDeepLink:S,enableCartGuardDeepLink:x,shopDefaults:n,isDevStore:f,needsRealSub:b}=N(),j=A(),u=n.defaultUnit,[v,k]=t.useState("rectangle"),[p,y]=t.useState(u),[r,w]=t.useState(T(D(n.widthInches,u))),[g,l]=t.useState(T(D(n.heightInches,u))),I=()=>{const o=new URLSearchParams({w:r,h:g,unit:p,shape:v,label:"Preview",bleed:String(n.bleedInches),safety:String(n.safetyInches),shop:a.shop,exp:String(a.exp),token:a.token});window.open(`/studio?${o.toString()}`,"_blank","noopener")};return e.jsx("s-page",{heading:"Design Studio",children:e.jsxs("s-stack",{gap:"base",children:[e.jsx(q,{show:s}),e.jsx(_,{isDevStore:f,needsRealSub:b}),e.jsx(E,{setup:h,addBlockDeepLink:S,enableCartGuardDeepLink:x,onMakeDesign:I}),!h.visible&&!h.allDone&&e.jsx("s-stack",{direction:"inline",justifyContent:"end",children:e.jsx("s-button",{variant:"tertiary",loading:j.state!=="idle",onClick:()=>j.submit({intent:"restore-setup"},{method:"post"}),children:"Show setup guide"})}),e.jsx("s-section",{heading:"Welcome to Design Studio",children:e.jsxs("s-stack",{gap:"base",children:[e.jsx("s-paragraph",{color:"subdued",children:"Let your customers personalise your products right on the storefront â they design, you get a print-ready file with every order."}),e.jsxs("s-stack",{direction:"inline",gap:"base",alignItems:"center",children:[f&&e.jsx("s-badge",{tone:"info",children:"Development store"}),e.jsxs("s-text",{children:["Shop: ",i]})]})]})}),e.jsx("s-section",{heading:"Preview the studio",children:e.jsxs("s-stack",{gap:"base",children:[e.jsx("s-paragraph",{color:"subdued",children:"Opens the design editor in a new tab so you can try it without installing the storefront block."}),e.jsx(F,{children:e.jsx("s-query-container",{children:e.jsxs("s-grid",{gridTemplateColumns:"@container (inline-size > 600px) 1fr 1fr 1fr 1fr, 1fr 1fr",gap:"base",children:[e.jsxs("s-select",{label:"Shape",value:v,onCh
1ange:o=>k(o.currentTarget.value),children:[e.jsx("s-option",{value:"rectangle",children:"Rectangle"}),e.jsx("s-option",{value:"rounded",children:"Rounded"}),e.jsx("s-option",{value:"circle",children:"Circle"}),e.jsx("s-option",{value:"oval",children:"Oval"})]}),e.jsx("s-number-field",{label:"Width",step:.1,value:r,onInput:o=>w(o.currentTarget.value),autocomplete:"off"}),e.jsx("s-number-field",{label:"Height",step:.1,value:g,onInput:o=>l(o.currentTarget.value),autocomplete:"off"}),e.jsxs("s-select",{label:"Unit",value:p,onChange:o=>y(o.currentTarget.value),children:[e.jsx("s-option",{value:"in",children:"in"}),e.jsx("s-option",{value:"cm",children:"cm"}),e.jsx("s-option",{value:"mm",children:"mm"})]})]})})}),e.jsx("s-stack",{direction:"inline",children:e.jsx("s-button",{variant:"primary",onClick:I,children:"Open studio preview"})})]})}),e.jsx("s-section",{padding:"base",accessibilityLabel:"At a glance",children:e.jsx("s-query-container",{children:e.jsxs("s-grid",{gridTemplateColumns:"@container (inline-size <= 400px) 1fr, 1fr auto 1fr",gap:"base",children:[e.jsx(P,{heading:"Templates",value:c,href:"/app/templates",action:"Manage templates"}),e.jsx("s-divider",{direction:"block"}),e.jsx(P,{heading:"Customer designs",value:d,href:"/app/designs",action:"View designs"})]})})})]})})}function _({isDevStore:s,needsRealSub:i}){return i?e.jsxs("s-banner",{tone:"warning",heading:"Your store is now live â reactivate your plan",children:[e.jsx("s-paragraph",{children:"Your current subscription was created while this was a development store, so it's a free test subscription. Please re-select a plan to keep Design Studio running."}),e.jsx("s-button",{slot:"secondary-actions",href:"/app/billing",children:"Choose a plan"})]}):s?e.jsxs("s-banner",{tone:"info",heading:"Design Studio is free on development stores",children:[e.jsx("s-paragraph",{children:"While your store is a development store, every plan is free â Shopify creates the subscription as a test charge. Pick any plan and try everything before you launch."}),e.jsx("s-button",{slot:"secondary-actions",href:"/app/billing",children:"See plans"})]}):null}function P(s){return e.jsxs("s-grid",{gap:"small-300",children:[e.jsx("s-heading",{children:s.heading}),e.jsx("s-heading",{fontSize:"large-300",accessibilityRole:"presentation",children:s.value.toLocaleString()}),e.jsx("s-link",{href:s.href,children:s.action})]})}export{H as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.