import{s as M}from"./storeApi-CtxU5E9I.js";import{_ as Ee}from"./TitleBreadcrumb.vue_vue_type_style_index_0_lang-Dt8P-UC1.js";import{_ as Te}from"./warn-C4Q7ewaQ.js";import{U as O,o as m,H as _,F as T,a as t,bV as Y,w as l,d as v,bf as U,b_ as ee,ap as B,bo as x,bW as z,bY as F,b as a,bX as te,c2 as oe,G as $,c4 as ye,e as L,aY as y,aW as E,f as _e,a$ as X,c as q,c6 as W,V as we,bU as ce,c3 as Z,z as Q,dA as Ce,dB as xe,bI as ue,aI as Me,b1 as G,aB as A,cm as Pe,cl as je,aw as We,c5 as Be,bT as ze,de as Ge,cs as Oe,ct as K,cu as Ye}from"./index-B-HPLxwu.js";import{c as pe,b as le,_ as fe,a as he,d as me}from"./wix-logo-BwfBNK_5.js";import{_ as H}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{_ as Fe}from"./wenhao-C-cdfRm0.js";import{e as de}from"./shopTypeEnum-DV5Qg6VA.js";import{u as He}from"./index-abZJGxgk.js";const Ke="/assets/shop-BXZKNfLY.png",Ze="/assets/woo-DcdpDhMG.png",Je="data:image/svg+xml,%3csvg%20width='101'%20height='100'%20viewBox='0%200%20101%20100'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Wix%20logo%202'%3e%3cg%20id='Group'%3e%3cpath%20id='Vector'%20d='M46.7113%2037.4906C45.3238%2038.6377%2044.9766%2040.6119%2044.9766%2040.6119L40.493%2057.7916L36.8099%2043.7328C36.463%2042.2392%2035.769%2040.3984%2034.7281%2039.1179C33.4471%2037.4906%2030.7782%2037.3839%2030.4579%2037.3839C30.2177%2037.3839%2027.5755%2037.4906%2026.1877%2039.1179C25.1468%2040.3984%2024.4529%2042.2392%2024.1059%2043.7328L20.6364%2057.7916L16.1527%2040.6119C16.1527%2040.6119%2015.8057%2038.7711%2014.4179%2037.4906C12.2294%2035.5165%209%2035.9968%209%2035.9968L17.5405%2068.1421C17.5405%2068.1421%2020.3161%2068.3823%2021.7039%2067.6888C23.5455%2066.755%2024.4796%2066.0882%2025.5205%2061.6863C26.5613%2057.7649%2029.337%2046.3474%2029.5505%2045.5469C29.6572%2045.2001%2029.8974%2044.1598%2030.5914%2044.1598C31.2853%2044.1598%2031.5255%2045.0936%2031.6322%2045.5469C31.8724%2046.3474%2034.6214%2057.7649%2035.6623%2061.6863C36.8099%2066.0615%2037.6106%2066.755%2039.4788%2067.6888C40.8666%2068.3823%2043.6421%2068.1421%2043.6421%2068.1421L52.1296%2035.9968C52.1296%2035.9968%2048.8998%2035.5432%2046.7113%2037.4906Z'%20fill='black'/%3e%3cpath%20id='Vector_2'%20d='M59.9486%2041.168C59.9486%2041.168%2059.3611%2041.968%2058.2138%2042.6616C57.4129%2043.1153%2056.7193%2043.3556%2055.9183%2043.8088C54.5308%2044.5024%2054.1836%2045.1959%2054.1836%2046.2367V46.5834V48.3173V48.664V68.0313C54.1836%2068.0313%2056.3721%2068.2716%2057.7601%2067.578C59.6014%2066.6443%2059.9486%2065.7372%2059.9486%2061.8158V42.4485V41.168Z'%20fill='black'/%3e%3cpath%20id='Vector_3'%20d='M56.5084%2036.551C54.9069%2037.3513%2054.2129%2038.8452%2054.2129%2042.9C54.2129%2042.9%2055.0134%2042.0999%2056.2949%2041.6194C57.2287%2041.2726%2057.8959%2040.8194%2058.3764%2040.4724C59.7644%2039.4321%2059.9779%2038.1783%2059.9779%2035.9908C59.9511%2035.9908%2057.7626%2035.8574%2056.5084%2036.551Z'%20fill='%23FBBD71'/%3e%3cpath%20id='Vector_4'%20d='M81.1649%2052.1295L92.0005%2036.0966C92.0005%2036.0966%2087.5169%2035.2963%2085.1947%2037.3771C83.7002%2038.6575%2082.2057%2041.0583%2082.2057%2041.0583L78.2824%2046.8205C78.0422%2047.1673%2077.8287%2047.4075%2077.4815%2047.4075C77.1347%2047.4075%2076.7879%2047.0608%2076.6809%2046.8205L72.7577%2041.0583C72.7577%2041.0583%2071.1562%2038.7643%2069.7687%2037.3771C67.4732%2035.2963%2062.9629%2036.0966%2062.9629%2036.0966L73.4517%2052.1027L62.7227%2068.1084C62.7227%2068.1084%2067.4464%2068.6954%2069.7687%2066.6148C71.2632%2065.3343%2072.6512%2063.1467%2072.6512%2063.1467L76.5744%2057.3845C76.8147%2057.0377%2077.0282%2056.7979%2077.3749%2056.7979C77.7217%2056.7979%2078.0689%2057.1447%2078.1754%2057.3845L82.0987%2063.1467C82.0987%2063.1467%2083.5937%2065.3343%2084.9812%2066.6148C87.2767%2068.6954%2091.8939%2068.1084%2091.8939%2068.1084L81.1649%2052.1295Z'%20fill='black'/%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Xe={class:"d-flex align-center"},qe={class:"text-center mt-4"},Qe=["src"],et=["src"],tt=["src"],ot=["src"],lt=["src"],st={class:"text-center mt-4"},at={class:"mt-3 text-center"},nt={class:"btns mt-5"},it=O({__name:"ConnectShopDialog",emits:["reflash"],setup(j,{expose:N,emit:D}){let n=y(!1);const p=y(!1),d=y(""),s=y({}),o=E({color:"",msg:"",isShow:!1});function C(w){s.value=w,n.value=!0}const u=()=>{d.value="",n.value=!1};function I(){p.value=!0;const w=M();s.value.type==1&&s.value.shopId?w.shopifyUrlGet({shopifyDomainName:d.value,shopId:s.value.shopId}).then(e=>{e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{}):s.value.type==1&&!s.value.shopId&&w.shopifyUrlGet({shopifyDomainName:d.value}).then(e=>{e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e),o.isShow=!0,o.color="error",o.msg=e.msg}),s.value.type==3&&s.value.shopId&&w.woocommerceUrlGet({url:d.value,shopId:s.value.shopId}).then(e=>{e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e)}),s.value.type==3&&!s.value.shopId&&w.woocommerceUrlGet({url:d.value}).then(e=>{console.log("success",e),e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e)}),s.value.type==6&&s.value.shopId&&w.woocommerceUrlGet({url:d.value,shopId:s.value.shopId}).then(e=>{e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e)}),s.value.type==6&&!s.value.shopId&&w.woocommerceUrlGet({url:d.value}).then(e=>{console.log("success",e),e.code==200?(p.value=!1,window.open(e.data.redirectUrl)):(p.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e)})}return N({openDialog:C,closeDialog:u}),(w,e)=>(m(),_(T,null,[t(Y,{modelValue:o.isShow,"onUpdate:modelValue":e[0]||(e[0]=r=>o.isShow=r),color:o.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[v(U(o.msg),1)]),_:1},8,["modelValue","color"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":e[2]||(e[2]=r=>B(n)?n.value=r:n=r),"max-width":575},{default:l(()=>[t(z,null,{default:l(()=>[t(F,{style:{padding:"24px"}},{default:l(()=>[a("h3",Xe,[e[3]||(e[3]=v("Let's Connect your Store! ",-1)),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:u},null,8,["src"])]),a("div",qe,[s.value.type==1||!s.value.type?(m(),_("img",{key:0,src:x(Ke),style:{width:"87px",height:"87px"}},null,8,Qe)):$("",!0),s.value.type==2?(m(),_("img",{key:1,src:x(pe),style:{width:"87px",height:"87px"}},null,8,et)):$("",!0),s.value.type==3?(m(),_("img",{key:2,src:x(Ze),style:{width:"87px",height:"87px"}},null,8,tt)):$("",!0),s.value.type==6?(m(),_("img",{key:3,src:x(Je),style:{width:"87px",height:"87px"}},null,8,ot)):$("",!0),s.value.type==5?(m(),_("img",{key:4,src:x(le),style:{width:"87px",height:"87px"}},null,8,lt)):$("",!0)]),a("h4",st,"Connect "+U(s.value.type==1?"Shopify":s.value.type==3?"WooCommerce":s.value.type==6?"Wix":""),1),a("p",at,"Add your "+U(s.value.type==1?"Shopify":s.value.type==3?"WooCommerce":s.value.type==6?"Wix":"")+" store URL to connect with JetPrint ",1),t(ye,{class:"mt-3",modelValue:d.value,"onUpdate:modelValue":e[1]||(e[1]=r=>d.value=r),label:s.value.type==1?"e.g.my-shop.myshopify.com":"https://www.examplestore.com",density:"comfortable",variant:"outlined",color:"primary","hide-details":"auto"},null,8,["modelValue","label"]),a("div",nt,[t(L,{color:"lightprimary",onClick:u},{default:l(()=>[...e[4]||(e[4]=[v("Cancel",-1)])]),_:1}),t(L,{class:"ml-4",color:"btnBlue",loading:p.value,disabled:p.value,onClick:I},{default:l(()=>[...e[5]||(e[5]=[v("Connect",-1)])]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),be=H(it,[["__scopeId","data-v-0c077d15"]]),rt={class:"d-flex align-center ga-4"},dt=["src"],ut={class:"text-h3 font-weight-medium"},ct={key:0,class:"position-relative",style:{"margin-left":"-10px",top:"2px"}},pt={style:{"min-height":"150px"}},ft=O({__name:"ConnectStore",setup(j){let N=E([{name:"Shopify",type:1,icon:fe,desc:["Allow to push products to stores","Allow your consumers to upload text and images","No limitations"]},{name:"Woocommerce",type:3,icon:he,desc:["Allow to push products to stores","No personalization features","No product limitations"]},{name:"Etsy",type:5,icon:le,desc:["Allow to push products to stores","Allow to push personalization features","Products can only be pushed attaching with 10 pictures and 13 tags"]},{name:"Wix",type:6,icon:me,desc:["Allow to push products to stores","No personalization features","No product limitations"]}]);const D=y(null);let n=y(!1),p=y(!1);function d(s){if(s.type==1)window.open("https://apps.shopify.com/jetprint-fulfillment");else if(s.type==3)D.value&&D.value.openDialog(s);else if(s.type==6){p.value=!0;var o={};o.shopId=s.shopId||"";let C=window.location.href.split("?")[0];C=="https://dashboard.jetprintapp.com/app/integrations"?C="https://dashboard.jetprintapp.com/app":C=="https://jetprintapp.com/app/integrations"?C="https://jetprintapp.com/app":C="https://dashboard.jetprintapp.com",o.callbackUrl=C+"/etsy/installs",M().shopWwixConnect(o).then(I=>{p.value=!1,window.open(I.data)})}else{n.value=!0;var o={};o.shopId=s.shopId||"";let u=window.location.href.split("?")[0];u=="https://dashboard.jetprintapp.com/app/integrations"?u="https://dashboard.jetprintapp.com/app":u=="https://jetprintapp.com/app/integrations"?u="https://jetprintapp.com/app":u="https://dashboard.jetprintapp.com",o.callbackUrl=u+"/etsy/installs",M().getEtsyConnectUrl(o).then(w=>{n.value=!1,window.open(w.data)})}}return(s,o)=>(m(),_(T,null,[t(_e,null,{default:l(()=>[(m(!0),_(T,null,X(x(N),(C,u)=>(m(),q(we,{cols:"12",lg:"3",md:"3",sm:"3",key:u},{default:l(()=>[t(z,{variant:"outlined",class:"bg-gray100"},{default:l(()=>[t(F,{style:{padding:"24px"}},{default:l(()=>[a("div",rt,[a("img",{src:C.icon,style:{width:"48px",height:"48px"},alt:""},null,8,dt),a("span",ut,U(C.name),1),u==2?(m(),_("div",ct,[t(W,{"max-width":"334px",activator:"parent",location:"top"},{default:l(()=>[...o[0]||(o[0]=[v("The term 'Etsy' is a trademark of Etsy, Inc. This application uses the Etsy API but is not endorsed or certified by Etsy, Inc.",-1)])]),_:1}),o[1]||(o[1]=a("img",{src:Te,style:{width:"18px",height:"18px"},alt:""},null,-1))])):$("",!0)]),a("ul",pt,[(m(!0),_(T,null,X(C.desc,(I,w)=>(m(),_("li",{style:{"font-size":"14px"},class:"mt-3",key:u},U(I),1))),128))]),t(L,{class:"mt-3 font-weight-medium connent-btn",block:"",variant:"outlined",height:"44",loading:u==2&&x(n),color:"primary",onClick:I=>d(C)},{default:l(()=>[...o[2]||(o[2]=[v("Connect",-1)])]),_:1},8,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1}),t(be,{ref_key:"refConnectShopDialog",ref:D},null,512)],64))}}),ht=H(ft,[["__scopeId","data-v-8b989f7a"]]),mt={class:"d-flex align-center"},vt={class:"btns"},gt=O({__name:"ResetNameDialog",emits:["reflash"],setup(j,{expose:N,emit:D}){let n=y(!1);const p=y(""),d=E({}),s=y(!1),o=ce(),C=Q(()=>(console.log("computed...",o.merchantInfoMutations.currentShop),o.merchantInfoMutations.currentShop)),u=D;let I=y(!1);const w=S=>{console.log("openDialog...",S),p.value=S.name,d.value=S,n.value=!0},e=()=>{n.value=!1};function r(){console.log(C.value),I.value=!0;const S=M(),c={shopId:d.value.shopId,shopName:p.value};S.setShopName(c).then(g=>{o.SET_MERCHANT_INFO_MUTATIONS(),I.value=!1,s.value=!0,e(),u("reflash")})}return N({openDialog:w,closeDialog:e}),(S,c)=>(m(),_(T,null,[t(Y,{modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=g=>s.value=g),color:"success",timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[...c[4]||(c[4]=[v("Successfully",-1)])]),_:1},8,["modelValue"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":c[3]||(c[3]=g=>B(n)?n.value=g:n=g),"max-width":575},{default:l(()=>[t(z,null,{default:l(()=>[t(F,{style:{padding:"24px"}},{default:l(()=>[a("h3",mt,[c[5]||(c[5]=v("Store Setup ",-1)),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:c[1]||(c[1]=g=>B(n)?n.value=!1:n=!1)},null,8,["src"])]),t(Z,{class:"mt-6"}),t(ye,{modelValue:p.value,"onUpdate:modelValue":c[2]||(c[2]=g=>p.value=g),label:"Store Name",class:"mt-4 mb-6","hide-details":"auto",variant:"outlined",color:"primary"},null,8,["modelValue"]),a("div",vt,[t(L,{class:"",color:"lightprimary",onClick:e},{default:l(()=>[...c[6]||(c[6]=[v("Cancel",-1)])]),_:1}),t(L,{class:"ml-4",color:"btnBlue",loading:x(I),onClick:r},{default:l(()=>[...c[7]||(c[7]=[v("Confirm",-1)])]),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),yt=H(gt,[["__scopeId","data-v-d7c45310"]]),_t={class:"d-flex align-center"},wt={key:0,class:"d-flex pa-3 ps-0"},Ct={class:""},xt={class:""},bt={class:"font-weight-medium",style:{"font-size":"16px"}},It={class:"text-medium-emphasis text-subtitle-2"},St={class:"ml-auto"},kt={key:0,src:fe,style:{width:"48px",height:"48px"},alt:""},Vt={key:1,src:pe,style:{width:"48px",height:"48px"},alt:""},$t={key:2,src:he,style:{width:"48px",height:"48px"},alt:""},Dt={key:3,src:le,style:{width:"48px",height:"48px"},alt:""},Ut={key:4,src:me,style:{width:"48px",height:"48px"},alt:""},Nt={class:"btns"},Lt=O({__name:"CopyProductDialog",emits:["reflash"],setup(j,{expose:N,emit:D}){let n=y(!1);const p=E([]),d=y(""),s=y(!1),o=E({color:"success",msg:"Your products are being duplicated in the background. You can continue using your account.",isShow:!1});let C=y(""),u=y("");const I=M();function w(){s.value=!0;const S={formStoreId:u.value,toStoreId:d.value};I.productAllBatch(S).then(c=>{s.value=!1,o.isShow=!0,r()})}function e(S,c,g){n.value=!0,C.value=S,u.value=c,p.value=g}const r=()=>{n.value=!1};return N({openDialog:e,closeDialog:r}),(S,c)=>(m(),_(T,null,[t(Y,{modelValue:o.isShow,"onUpdate:modelValue":c[0]||(c[0]=g=>o.isShow=g),color:o.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[v(U(o.msg),1)]),_:1},8,["modelValue","color"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":c[3]||(c[3]=g=>B(n)?n.value=g:n=g),"max-width":575},{default:l(()=>[t(z,null,{default:l(()=>[t(F,{style:{"padding-top":"24px"}},{default:l(()=>[a("h3",_t,[v("Copy "+U(x(C))+" products to … ",1),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:c[1]||(c[1]=g=>B(n)?n.value=!1:n=!1)},null,8,["src"])]),t(Z,{class:"mt-4 mb-5"}),c[6]||(c[6]=a("div",{class:"d-flex warn-con"},[a("div",{class:"warn pr-3 pt-1"},[a("img",{src:Fe,alt:""})]),a("div",{class:"desc",style:{"line-height":"20px"}}," Due to sales channel limitations some sales channel specific product details like product description text formating and tags might be lost in copy process. ")],-1)),t(Z,{class:"mt-5"}),t(Ce,{class:"scroll",modelValue:d.value,"onUpdate:modelValue":c[2]||(c[2]=g=>d.value=g)},{default:l(()=>[(m(!0),_(T,null,X(p.value,(g,se)=>(m(),_("div",{key:se},[x(u)!=g.shopId?(m(),_("div",wt,[a("div",Ct,[t(xe,{color:"secondary",value:g.shopId,disabled:x(u)==g.shopId},null,8,["value","disabled"])]),a("div",xt,[a("p",bt,U(g.name),1),a("p",It,U(g.url?g.url:"No Sales Channel"),1)]),a("div",St,[g.type==1?(m(),_("img",kt)):$("",!0),g.type==2||g.type==4?(m(),_("img",Vt)):$("",!0),g.type==3?(m(),_("img",$t)):$("",!0),g.type==5?(m(),_("img",Dt)):$("",!0),g.type==6?(m(),_("img",Ut)):$("",!0)])])):$("",!0),t(Z)]))),128))]),_:1},8,["modelValue"]),a("div",Nt,[t(L,{class:"mt-4",color:"lightprimary",onClick:r},{default:l(()=>[...c[4]||(c[4]=[v("Cancel",-1)])]),_:1}),t(L,{class:"mt-4 ml-4",color:"btnBlue",loading:s.value,disabled:s.value,onClick:w},{default:l(()=>[...c[5]||(c[5]=[v("Confirm",-1)])]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Rt=H(Lt,[["__scopeId","data-v-20b2e741"]]),At={class:"d-flex align-center"},Et={class:"btns"},Tt=O({__name:"DisconnectDialog",emits:["reflash"],setup(j,{expose:N,emit:D}){let n=y(!1);const p=y(!1),d=y(!1),s=y(""),o=D;function C(w){s.value=w,n.value=!0}const u=()=>{n.value=!1};function I(){d.value=!0,M().disconnect({shopId:s.value}).then(e=>{d.value=!1,u(),o("reflash",s.value)})}return N({openDialog:C,closeDialog:u}),(w,e)=>(m(),_(T,null,[t(Y,{modelValue:p.value,"onUpdate:modelValue":e[0]||(e[0]=r=>p.value=r),color:"success",timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[...e[3]||(e[3]=[v("Successfully",-1)])]),_:1},8,["modelValue"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":e[2]||(e[2]=r=>B(n)?n.value=r:n=r),"max-width":575},{default:l(()=>[t(z,null,{default:l(()=>[t(F,{style:{"padding-top":"24px"}},{default:l(()=>[a("h3",At,[e[4]||(e[4]=v("Disconnect Your Store? ",-1)),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:e[1]||(e[1]=r=>B(n)?n.value=!1:n=!1)},null,8,["src"])]),t(Z,{class:"mt-4"}),e[7]||(e[7]=a("p",{class:"mt-4",style:{"line-height":"20px"}},"JetPrint account won't receive incoming orders for published products in your store. You won't be able to update products in your store from your JetPrint account. ",-1)),a("div",Et,[t(L,{class:"mt-4",color:"lightprimary",onClick:u},{default:l(()=>[...e[5]||(e[5]=[v("Cancel",-1)])]),_:1}),t(L,{class:"mt-4 ml-4",color:"btnBlue",loading:d.value,disabled:d.value,onClick:I},{default:l(()=>[...e[6]||(e[6]=[v("Confirm",-1)])]),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Mt=H(Tt,[["__scopeId","data-v-dd55ad18"]]),Pt={class:"",style:{position:"absolute",opacity:"0"}},jt={class:"d-flex align-center"},Wt={class:"ml-4 font-weight-medium",style:{color:"#252525"}},Bt={style:{width:"50%"},class:"text-medium-emphasis"},zt={class:"font-weight-medium",style:{color:"#252525"}},Gt={style:{width:"50%"},class:"text-medium-emphasis"},Ot={class:"font-weight-medium",style:{color:"#252525"}},Yt={class:"tooltip-hover"},Ft={class:"mt-2 clien-desc d-flex align-center"},Ht={style:{width:"240px","white-space":"normal"}},Kt=["onClick"],Zt={class:"mt-2 clien-desc d-flex align-center"},Jt={style:{width:"240px","white-space":"normal","line-height":"1.3"}},Xt=["onClick"],qt={__name:"StoreList",props:{type:String},setup(j){const N=j,{toClipboard:D}=He(),n=ce(),p=y(null),d=y([]),s=y([]),o=M();let C=E({});const u=E({color:"",msg:"",isShow:!1}),I=E({color:"",msg:"",isShow:!1}),w=E({title:"",message:""});let e=y(!1);const r=Q(()=>(p.value=n.merchantInfoMutations.currentShop.shopId,n.merchantInfoMutations.currentShop));ue(()=>N.type,(f,i)=>{let b=[];s.value.length>0&&(s.value.forEach((V,k)=>{f!=""?V.type==f&&b.push(V):b.push(V)}),d.value=b),console.log(`message prop changed from ${i} to ${f}`)});const S=Q(()=>(console.log("computed...",n.merchantInfoMutations),n.merchantInfoMutations.login));function c(){if(S.value){const f={};f.type=N.type,o.shopList(f).then(i=>{d.value=i.data.records,s.value=i.data.records,g()})}}async function g(){const f=d.value.filter(k=>!k.oapiEnable),b=(await Promise.allSettled(f.map(k=>o.oapiRefresh({shopId:k.shopId}).then(()=>o.oapiSet({shopId:k.shopId,oapiEnable:!0}))))).filter(k=>k.status==="rejected");b.length>0&&console.warn(`${b.length} 个请求失败`,b);const V={};V.type=N.type,o.shopList(V).then(k=>{d.value=k.data.records,s.value=k.data.records})}Me(()=>{c()});function se(f){c(),Ie(f)}function Ie(f){d.value.forEach(i=>{if(f==i.shopId){const b={name:i.name,shopId:i.shopId,shopType:i.type};n.SET_MERCHANT_SHOP(b)}})}let ae=y(null);function Se(f,i){ae.value&&ae.value.openDialog(f,i,d.value)}let ne=y(null);function ke(f){ne.value&&ne.value.openDialog(f)}const ie=y(null),Ve=f=>{ie.value&&ie.value.openDialog(f)},J=y(null);function $e(f){J.value&&(C.value=f,w.title="Remove Store from JetPrint?",w.message="When clicked the Confirm button, this store will be closed after 1 second.",J.value.openDialog())}function De(){console.log("hanldeItem...",C.value.shopId),o.removeStore({shopId:C.value.shopId}).then(f=>{J.value.closeDialog(),I.isShow=!0,I.msg="Remove Store Success",I.color="success",n.SET_MERCHANT_INFO_MUTATIONS(),c()})}function Ue(f){if(f.indexOf("http")===0)window.open(f);else{const i="https://"+f;window.open(i)}}const ve=y(null);function Ne(f){e.value=!0;const i=M();if(f.type==de.WIX.value){var b={};b.shopId=f.shopId||"";let V=window.location.href.split("?")[0];V=="https://dashboard.jetprintapp.com/app/integrations"?V="https://dashboard.jetprintapp.com/app":V="https://dashboard.jetprintapp.com",b.callbackUrl=V+"/etsy/installs",i.shopWwixConnect(b).then(k=>{e.value=!1,window.open(k.data)}),e.value=!1}else if(f.type==de.SHOPIFY.value)console.log("aaaaa..."),i.shopifyUrlGet({shopifyDomainName:f.url,shopId:f.shopId}).then(V=>{V.code==200?window.open(V.data.redirectUrl):(u.isShow=!0,u.color="error",u.msg=V.msg)}).catch(V=>{}),e.value=!1;else if(f.type==de.ETSY.value){var b={};b.shopId=f.shopId||"";let k=window.location.href.split("?")[0];k=="https://dashboard.jetprintapp.com/app/integrations"?k="https://dashboard.jetprintapp.com/app":k=="https://jetprintapp.com/app/integrations"?k="https://jetprintapp.com/app":k="https://dashboard.jetprintapp.com",b.callbackUrl=k+"/etsy/installs",i.getEtsyConnectUrl(b).then(re=>{e.value=!1,window.open(re.data)})}else ve.value.openDialog(f),e.value=!1}let P=y("");P.value=window.innerWidth,window.addEventListener("resize",function(f){P.value=window.innerWidth}),p.value=r.value.shopId,ue(()=>p.value,f=>{o.shopChange({shopId:f}).then(i=>{d.value.forEach(b=>{if(b.shopId==f){let V={name:b.name,shopId:b.shopId,shopType:b.type};n.SET_MERCHANT_SHOP(V)}})})});async function ge(f){await D(f),u.isShow=!0,u.msg="Copied successfully.",u.color="success"}return(f,i)=>{const b=G("PencilMinusIcon"),V=G("KeyIcon"),k=G("CopyIcon"),re=G("UnlinkIcon"),Le=G("TrashIcon"),Re=G("BuildingStoreIcon");return m(),_(T,null,[a("div",Pt,U(r.value),1),t(Y,{modelValue:u.isShow,"onUpdate:modelValue":i[0]||(i[0]=h=>u.isShow=h),color:u.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[v(U(u.msg),1)]),_:1},8,["modelValue","color"]),t(Ce,{modelValue:p.value,"onUpdate:modelValue":i[2]||(i[2]=h=>p.value=h)},{default:l(()=>[(m(!0),_(T,null,X(d.value,(h,Ae)=>(m(),_("div",{class:"text-grey-lighten-3 d-flex flex-wrap align-center store-list",style:{"border-bottom":"1px solid #E3E8EF","padding-top":"24px","padding-bottom":"24px"},key:Ae},[a("div",{style:A((x(P)<=375,"width: 50px"))},[t(xe,{color:"secondary",rounded:"","hide-details":"",value:h.shopId,modelValue:p.value,"onUpdate:modelValue":i[1]||(i[1]=R=>p.value=R)},null,8,["value","modelValue"])],4),a("div",{style:A(x(P)<=775?"width: 80%":"width: 35%")},[a("div",jt,[h.type==1?(m(),_("img",{key:0,src:fe,style:A([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):$("",!0),h.type==2||h.type==4?(m(),_("img",{key:1,src:pe,style:A([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):$("",!0),h.type==3?(m(),_("img",{key:2,src:he,style:A([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):$("",!0),h.type==5?(m(),_("img",{key:3,src:le,style:A([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):$("",!0),h.type==6?(m(),_("img",{key:4,src:me,style:A([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):$("",!0),a("span",Wt,U(h.name),1),t(L,{icon:"",color:"#252525",variant:"text",onClick:R=>Ve(h)},{default:l(()=>[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[3]||(i[3]=[v("Store Name",-1)])]),_:1}),t(b,{size:"20","stroke-width":"1.25"})]),_:1},8,["onClick"])])],4),a("div",{class:"d-flex",style:A(x(P)<=775?"width: 100%;margin-top: 20px":"width: 30%")},[a("div",Bt,[i[4]||(i[4]=v("Orders: ",-1)),a("span",zt,U(h.orderNum),1)]),a("div",Gt,[i[5]||(i[5]=v("Products: ",-1)),a("span",Ot,U(h.productNum),1)])],4),a("div",{style:A(x(P)<=375?"width: 100%;":"width: 10%")},[!h.isConnect&&h.type!=4?(m(),q(L,{key:0,color:"primary",loading:x(e),rounded:"",onClick:R=>Ne(h),style:A(x(P)<=375?"margin-top: 20px":"")},{default:l(()=>[...i[6]||(i[6]=[v(" Connect ",-1)])]),_:1},8,["loading","onClick","style"])):$("",!0)],4),a("div",{class:"d-flex",style:A(x(P)<900?"width: 100%;margin-top: 20px;":"width: 20%")},[h.oapiEnable?(m(),q(Pe,{key:0,"close-on-content-click":!0,location:"top"},{activator:l(({props:R})=>[a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[7]||(i[7]=[v("API Key",-1)])]),_:1}),t(L,We({icon:"",color:"#252525",variant:"text"},{ref_for:!0},R),{default:l(()=>[t(V,{size:"20","stroke-width":"1.25"})]),_:1},16)])]),default:l(()=>[t(je,{rounded:"md",elevation:"12"},{default:l(()=>[a("div",Yt,[i[8]||(i[8]=a("div",{class:"clien-title"},"Client ID",-1)),a("div",Ft,[a("div",Ht,U(h.clientId),1)]),a("div",{class:"text-secondary mt-2",style:{"font-size":"16px"},onClick:R=>ge(h.clientId)},"Copy",8,Kt),i[9]||(i[9]=a("hr",{style:{"border-color":"rgba(208, 208, 208, 0.36)"},class:"mt-4"},null,-1)),i[10]||(i[10]=a("div",{class:"clien-title mt-4"},"API Key",-1)),a("div",Zt,[a("div",Jt,U(h.clientSecret),1)]),a("div",{class:"text-secondary mt-2",style:{"font-size":"16px"},onClick:R=>ge(h.clientSecret)},"Copy",8,Xt)])]),_:2},1024)]),_:2},1024)):$("",!0),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[11]||(i[11]=[v("Copy Poducts",-1)])]),_:1}),t(L,{icon:"",color:"#252525",variant:"text",disabled:d.value.length<=1||h.productNum===0,onClick:R=>Se(h.productNum,h.shopId)},{default:l(()=>[t(k,{size:"20","stroke-width":"1.25"})]),_:1},8,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[12]||(i[12]=[v("Disconnect",-1)])]),_:1}),t(L,{icon:"",color:"#252525",variant:"text",disabled:!h.isConnect||h.type==2,onClick:R=>ke(h.shopId)},{default:l(()=>[t(re,{size:"20","stroke-width":"1.25"})]),_:1},8,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[13]||(i[13]=[v("Remove Store",-1)])]),_:1}),t(L,{icon:"",color:"#252525",variant:"text",disabled:h.type==2,onClick:R=>$e(h)},{default:l(()=>[t(Le,{size:"20","stroke-width":"1.25"})]),_:1},8,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>[...i[14]||(i[14]=[v("Visit Store",-1)])]),_:1}),t(L,{icon:"",color:"#252525",variant:"text",disabled:!h.url,onClick:R=>Ue(h.url)},{default:l(()=>[t(Re,{size:"20","stroke-width":"1.25"})]),_:1},8,["disabled","onClick"])])],4)]))),128))]),_:1},8,["modelValue"]),t(yt,{ref_key:"refResetName",ref:ie,onReflash:c},null,512),t(Rt,{ref_key:"refCopyProduct",ref:ae,onReflash:c},null,512),t(Mt,{ref_key:"refDisconnect",ref:ne,onReflash:se},null,512),t(Be,{ref_key:"refDelProduct",ref:J,title:w.title,message:w.message,onReflash:De},null,8,["title","message"]),t(be,{ref_key:"refConnectShopDialog",ref:ve,onReflash:c},null,512)],64)}}},Qt=H(qt,[["__scopeId","data-v-9ed2cf12"]]),eo={class:"pa-5"},co=O({__name:"Index",setup(j){const N=ce(),D=y("tab-profile"),n=E([{title:"Integrations",disabled:!0,href:"#"}]),p=y(1),d=E({color:"",msg:"",isShow:!1});ue(()=>D.value,(e,r)=>{e=="tab-myStore"&&(p.value=""),e=="tab-myStore"&&(p.value=""),e=="tab-myStore"&&(p.value=""),e=="tab-myStore"&&(p.value="")});const s=Q(()=>(console.log("computed...",N.merchantInfoMutations),N.merchantInfoMutations.login));function o(e){var r=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),S=window.location.search.substr(1).match(r);return S!=null?unescape(S[2]):null}const C=M();var u=o("code"),I=o("state"),w=o("error");return console.log("code...",u),console.log("state...",I),console.log("error...",w),u&&u!=null&&(ze().query,C.submitEtsyConnect({code:u,state:I}).then(r=>{r.code==200?(d.color="success",d.msg="connect etsy shop success!",d.isShow=!0):(d.color="error",d.msg=r.msg,d.isShow=!0)})),(e,r)=>(m(),_(T,null,[t(Y,{modelValue:d.isShow,"onUpdate:modelValue":r[0]||(r[0]=S=>d.isShow=S),color:d.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[v(U(d.msg),1)]),_:1},8,["modelValue","color"]),t(Ee,{title:"Integrations",breadcrumbs:n},null,8,["breadcrumbs"]),t(z,{variant:"flat",class:"px-4 py-3"},{default:l(()=>[t(Ge,{class:"text-subtitle-6 font-weight-medium pb-5"},{default:l(()=>[...r[3]||(r[3]=[v("Let's connect your store!",-1)])]),_:1}),t(F,null,{default:l(()=>[t(ht,{class:"mt-3"})]),_:1})]),_:1}),s.value?(m(),q(z,{key:0,variant:"flat",class:"px-4 py-3 mt-4"},{default:l(()=>[t(_e,null,{default:l(()=>[t(we,{cols:"12"},{default:l(()=>[t(Oe,{modelValue:D.value,"onUpdate:modelValue":r[1]||(r[1]=S=>D.value=S),"selected-class":"integrationsactivedTab"},{default:l(()=>[t(K,{value:""},{default:l(()=>[...r[4]||(r[4]=[v("My Store",-1)])]),_:1}),t(K,{value:"1"},{default:l(()=>[...r[5]||(r[5]=[v("Shopify",-1)])]),_:1}),t(K,{value:"3"},{default:l(()=>[...r[6]||(r[6]=[v("Woocommerce",-1)])]),_:1}),t(K,{value:"5"},{default:l(()=>[...r[7]||(r[7]=[v("Etsy",-1)])]),_:1}),t(K,{value:"6"},{default:l(()=>[...r[8]||(r[8]=[v("Wix",-1)])]),_:1})]),_:1},8,["modelValue"]),a("div",eo,[t(Ye,{modelValue:D.value,"onUpdate:modelValue":r[2]||(r[2]=S=>D.value=S)},{default:l(()=>[t(Qt,{type:D.value},null,8,["type"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})):$("",!0)],64))}});export{co as default};