import{s as M}from"./storeApi-DTYh_w0_.js";import{_ as Ee}from"./TitleBreadcrumb.vue_vue_type_style_index_0_lang-CE43rtuq.js";import{_ as Te}from"./warn-C4Q7ewaQ.js";import{U as O,aW as m,aU as R,H as _,o as v,F as T,a as t,bV as H,w as l,d as g,bd as D,b_ as ee,bm as x,ap as z,bW as B,bY as F,b as a,bX as te,c1 as oe,G as k,c3 as ye,e as N,f as _e,aZ as X,c as Q,c6 as W,V as we,bU as ce,z as J,c2 as K,du as Ce,dv as xe,bG as ue,aH as Me,a$ as G,aA as E,ci as Pe,ch as je,aw as We,c4 as ze,bT as Be,d7 as Ge,co as Oe,cp as Z,cq as He}from"./index-Dr-kWU_5.js";import{c as pe,b as le,_ as fe,a as he,d as me}from"./wix-logo-BwfBNK_5.js";import{_ as Y}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 Ye}from"./index-zT1ehxF-.js";const Ze="/assets/shop-BXZKNfLY.png",Ke="/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",qe={class:"d-flex align-center"},Xe={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:U,emit:$}){let n=m(!1);m(!1);const c=m(!1),d=m(""),s=m({}),o=R({color:"",msg:"",isShow:!1});function C(w){s.value=w,n.value=!0}const p=()=>{d.value="",n.value=!1};function S(){c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.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?(c.value=!1,window.open(e.data.redirectUrl)):(c.value=!1,o.isShow=!0,o.color="error",o.msg=e.msg)}).catch(e=>{console.log("cath...",e)})}return U({openDialog:C,closeDialog:p}),(w,e)=>(v(),_(T,null,[t(H,{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(()=>[g(D(o.msg),1)]),_:1},8,["modelValue","color"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":e[2]||(e[2]=r=>z(n)?n.value=r:n=r),"max-width":575},{default:l(()=>[t(B,null,{default:l(()=>[t(F,{style:{padding:"24px"}},{default:l(()=>[a("h3",qe,[e[3]||(e[3]=g("Let's Connect your Store! ")),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:p},null,8,["src"])]),a("div",Xe,[s.value.type==1||!s.value.type?(v(),_("img",{key:0,src:x(Ze),style:{width:"87px",height:"87px"}},null,8,Qe)):k("",!0),s.value.type==2?(v(),_("img",{key:1,src:x(pe),style:{width:"87px",height:"87px"}},null,8,et)):k("",!0),s.value.type==3?(v(),_("img",{key:2,src:x(Ke),style:{width:"87px",height:"87px"}},null,8,tt)):k("",!0),s.value.type==6?(v(),_("img",{key:3,src:x(Je),style:{width:"87px",height:"87px"}},null,8,ot)):k("",!0),s.value.type==5?(v(),_("img",{key:4,src:x(le),style:{width:"87px",height:"87px"}},null,8,lt)):k("",!0)]),a("h4",st,"Connect "+D(s.value.type==1?"Shopify":s.value.type==3?"WooCommerce":s.value.type==6?"Wix":""),1),a("p",at,"Add your "+D(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(N,{color:"lightprimary",onClick:p},{default:l(()=>e[4]||(e[4]=[g("Cancel")])),_:1}),t(N,{class:"ml-4",color:"btnBlue",loading:c.value,disabled:c.value,onClick:S},{default:l(()=>e[5]||(e[5]=[g("Connect")])),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),be=Y(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 U=R([{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 $=m(null);let n=m(!1),c=m(!1);function d(s){if(s.type==1)window.open("https://apps.shopify.com/jetprint-fulfillment");else if(s.type==3)$.value&&$.value.openDialog(s);else if(s.type==6){c.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(S=>{c.value=!1,window.open(S.data)})}else{n.value=!0;var o={};o.shopId=s.shopId||"";let p=window.location.href.split("?")[0];p=="https://dashboard.jetprintapp.com/app/integrations"?p="https://dashboard.jetprintapp.com/app":p=="https://jetprintapp.com/app/integrations"?p="https://jetprintapp.com/app":p="https://dashboard.jetprintapp.com",o.callbackUrl=p+"/etsy/installs",M().getEtsyConnectUrl(o).then(w=>{n.value=!1,window.open(w.data)})}}return(s,o)=>(v(),_(T,null,[t(_e,null,{default:l(()=>[(v(!0),_(T,null,X(x(U),(C,p)=>(v(),Q(we,{cols:"12",lg:"3",md:"3",sm:"3",key:p},{default:l(()=>[t(B,{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,D(C.name),1),p==2?(v(),_("div",ct,[t(W,{"max-width":"334px",activator:"parent",location:"top"},{default:l(()=>o[0]||(o[0]=[g("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}),o[1]||(o[1]=a("img",{src:Te,style:{width:"18px",height:"18px"},alt:""},null,-1))])):k("",!0)]),a("ul",pt,[(v(!0),_(T,null,X(C.desc,(S,w)=>(v(),_("li",{style:{"font-size":"14px"},class:"mt-3",key:p},D(S),1))),128))]),t(N,{class:"mt-3 font-weight-medium connent-btn",block:"",variant:"outlined",height:"44",loading:p==2&&x(n),color:"primary",onClick:S=>d(C)},{default:l(()=>o[2]||(o[2]=[g("Connect")])),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))]),_:1}),t(be,{ref_key:"refConnectShopDialog",ref:$},null,512)],64))}}),ht=Y(ft,[["__scopeId","data-v-8b989f7a"]]),mt={class:"d-flex align-center"},vt={class:"btns"},gt=O({__name:"ResetNameDialog",emits:["reflash"],setup(j,{expose:U,emit:$}){let n=m(!1);const c=m(""),d=R({}),s=m(!1),o=ce(),C=J(()=>(console.log("computed...",o.merchantInfoMutations.currentShop),o.merchantInfoMutations.currentShop));J(()=>(console.log("computed...",o.merchantInfoMutations.currentShop),o.merchantInfoMutations.allShops));const p=$;let S=m(!1);const w=I=>{console.log("openDialog...",I),c.value=I.name,d.value=I,n.value=!0},e=()=>{n.value=!1};function r(){console.log(C.value),S.value=!0;const I=M(),u={shopId:d.value.shopId,shopName:c.value};I.setShopName(u).then(y=>{o.SET_MERCHANT_INFO_MUTATIONS(),S.value=!1,s.value=!0,e(),p("reflash")})}return U({openDialog:w,closeDialog:e}),(I,u)=>(v(),_(T,null,[t(H,{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=y=>s.value=y),color:"success",timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>u[4]||(u[4]=[g("Successfully")])),_:1},8,["modelValue"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":u[3]||(u[3]=y=>z(n)?n.value=y:n=y),"max-width":575},{default:l(()=>[t(B,null,{default:l(()=>[t(F,{style:{padding:"24px"}},{default:l(()=>[a("h3",mt,[u[5]||(u[5]=g("Store Setup ")),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:u[1]||(u[1]=y=>z(n)?n.value=!1:n=!1)},null,8,["src"])]),t(K,{class:"mt-6"}),t(ye,{modelValue:c.value,"onUpdate:modelValue":u[2]||(u[2]=y=>c.value=y),label:"Store Name",class:"mt-4 mb-6","hide-details":"auto",variant:"outlined",color:"primary"},null,8,["modelValue"]),a("div",vt,[t(N,{class:"",color:"lightprimary",onClick:e},{default:l(()=>u[6]||(u[6]=[g("Cancel")])),_:1}),t(N,{class:"ml-4",color:"btnBlue",loading:x(S),onClick:r},{default:l(()=>u[7]||(u[7]=[g("Confirm")])),_:1},8,["loading"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),yt=Y(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"}},St={class:"text-medium-emphasis text-subtitle-2"},It={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:U,emit:$}){let n=m(!1);m(""),R({});const c=R([]);m(!1);const d=m(""),s=m(!1),o=R({color:"success",msg:"Your products are being duplicated in the background. You can continue using your account.",isShow:!1});let C=m(""),p=m("");const S=M();function w(){s.value=!0;const I={formStoreId:p.value,toStoreId:d.value};S.productAllBatch(I).then(u=>{s.value=!1,o.isShow=!0,r()})}function e(I,u,y){n.value=!0,C.value=I,p.value=u,c.value=y}const r=()=>{n.value=!1};return U({openDialog:e,closeDialog:r}),(I,u)=>(v(),_(T,null,[t(H,{modelValue:o.isShow,"onUpdate:modelValue":u[0]||(u[0]=y=>o.isShow=y),color:o.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[g(D(o.msg),1)]),_:1},8,["modelValue","color"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":u[3]||(u[3]=y=>z(n)?n.value=y:n=y),"max-width":575},{default:l(()=>[t(B,null,{default:l(()=>[t(F,{style:{"padding-top":"24px"}},{default:l(()=>[a("h3",_t,[g("Copy "+D(x(C))+" products to … ",1),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:u[1]||(u[1]=y=>z(n)?n.value=!1:n=!1)},null,8,["src"])]),t(K,{class:"mt-4 mb-5"}),u[6]||(u[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(K,{class:"mt-5"}),t(Ce,{class:"scroll",modelValue:d.value,"onUpdate:modelValue":u[2]||(u[2]=y=>d.value=y)},{default:l(()=>[(v(!0),_(T,null,X(c.value,(y,se)=>(v(),_("div",{key:se},[x(p)!=y.shopId?(v(),_("div",wt,[a("div",Ct,[t(xe,{color:"secondary",value:y.shopId,disabled:x(p)==y.shopId},null,8,["value","disabled"])]),a("div",xt,[a("p",bt,D(y.name),1),a("p",St,D(y.url?y.url:"No Sales Channel"),1)]),a("div",It,[y.type==1?(v(),_("img",kt)):k("",!0),y.type==2||y.type==4?(v(),_("img",Vt)):k("",!0),y.type==3?(v(),_("img",$t)):k("",!0),y.type==5?(v(),_("img",Dt)):k("",!0),y.type==6?(v(),_("img",Ut)):k("",!0)])])):k("",!0),t(K)]))),128))]),_:1},8,["modelValue"]),a("div",Nt,[t(N,{class:"mt-4",color:"lightprimary",onClick:r},{default:l(()=>u[4]||(u[4]=[g("Cancel")])),_:1}),t(N,{class:"mt-4 ml-4",color:"btnBlue",loading:s.value,disabled:s.value,onClick:w},{default:l(()=>u[5]||(u[5]=[g("Confirm")])),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Rt=Y(Lt,[["__scopeId","data-v-20b2e741"]]),At={class:"d-flex align-center"},Et={class:"btns"},Tt=O({__name:"DisconnectDialog",emits:["reflash"],setup(j,{expose:U,emit:$}){let n=m(!1);const c=m(!1),d=m(!1),s=m(""),o=$;function C(w){s.value=w,n.value=!0}const p=()=>{n.value=!1};function S(){d.value=!0,M().disconnect({shopId:s.value}).then(e=>{d.value=!1,p(),o("reflash",s.value)})}return U({openDialog:C,closeDialog:p}),(w,e)=>(v(),_(T,null,[t(H,{modelValue:c.value,"onUpdate:modelValue":e[0]||(e[0]=r=>c.value=r),color:"success",timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>e[3]||(e[3]=[g("Successfully")])),_:1},8,["modelValue"]),t(ee,{modelValue:x(n),"onUpdate:modelValue":e[2]||(e[2]=r=>z(n)?n.value=r:n=r),"max-width":575},{default:l(()=>[t(B,null,{default:l(()=>[t(F,{style:{"padding-top":"24px"}},{default:l(()=>[a("h3",At,[e[4]||(e[4]=g("Disconnect Your Store? ")),t(te,{src:x(oe),width:32,height:32,class:"close",onClick:e[1]||(e[1]=r=>z(n)?n.value=!1:n=!1)},null,8,["src"])]),t(K,{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(N,{class:"mt-4",color:"lightprimary",onClick:p},{default:l(()=>e[5]||(e[5]=[g("Cancel")])),_:1}),t(N,{class:"mt-4 ml-4",color:"btnBlue",loading:d.value,disabled:d.value,onClick:S},{default:l(()=>e[6]||(e[6]=[g("Confirm")])),_:1},8,["loading","disabled"])])]),_:1})]),_:1})]),_:1},8,["modelValue"])],64))}}),Mt=Y(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"}},zt={style:{width:"50%"},class:"text-medium-emphasis"},Bt={class:"font-weight-medium",style:{color:"#252525"}},Gt={style:{width:"50%"},class:"text-medium-emphasis"},Ot={class:"font-weight-medium",style:{color:"#252525"}},Ht={class:"tooltip-hover"},Ft={class:"mt-2 clien-desc d-flex align-center"},Yt={style:{width:"350px","white-space":"normal"}},Zt=["onClick"],Kt={class:"mt-2 clien-desc d-flex align-center"},Jt={style:{width:"350px","white-space":"normal","line-height":"1.3"}},qt=["onClick"],Xt={__name:"StoreList",props:{type:String},setup(j){const U=j,{toClipboard:$}=Ye(),n=ce(),c=m(null),d=m([]),s=m([]),o=M();let C=R({});const p=R({color:"",msg:"",isShow:!1}),S=R({color:"",msg:"",isShow:!1}),w=R({title:"",message:""});let e=m(!1);const r=J(()=>(c.value=n.merchantInfoMutations.currentShop.shopId,n.merchantInfoMutations.currentShop));ue(()=>U.type,(f,i)=>{let b=[];s.value.length>0&&(s.value.forEach((L,V)=>{f!=""?L.type==f&&b.push(L):b.push(L)}),d.value=b),console.log(`message prop changed from ${i} to ${f}`)});const I=J(()=>(console.log("computed...",n.merchantInfoMutations),n.merchantInfoMutations.login));function u(){if(I.value){const f={};f.type=U.type,o.shopList(f).then(i=>{d.value=i.data.records,s.value=i.data.records,y()})}}async function y(){const f=d.value.filter(V=>!V.oapiEnable),b=(await Promise.allSettled(f.map(V=>o.oapiRefresh({shopId:V.shopId}).then(()=>o.oapiSet({shopId:V.shopId,oapiEnable:!0}))))).filter(V=>V.status==="rejected");b.length>0&&console.warn(`${b.length} 个请求失败`,b);const L={};L.type=U.type,o.shopList(L).then(V=>{d.value=V.data.records,s.value=V.data.records})}Me(()=>{u()});function se(f){u(),Se(f)}function Se(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=m(null);function Ie(f,i){ae.value&&ae.value.openDialog(f,i,d.value)}let ne=m(null);function ke(f){ne.value&&ne.value.openDialog(f)}const ie=m(null),Ve=f=>{ie.value&&ie.value.openDialog(f)},q=m(null);function $e(f){q.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.",q.value.openDialog())}function De(){console.log("hanldeItem...",C.value.shopId),o.removeStore({shopId:C.value.shopId}).then(f=>{q.value.closeDialog(),S.isShow=!0,S.msg="Remove Store Success",S.color="success",n.SET_MERCHANT_INFO_MUTATIONS(),u()})}function Ue(f){if(f.indexOf("http")===0)window.open(f);else{const i="https://"+f;window.open(i)}}const ve=m(null);function Ne(f){e.value=!0;const i=M();if(f.type==de.WIX.value){var b={};b.shopId=f.shopId||"";let L=window.location.href.split("?")[0];L=="https://dashboard.jetprintapp.com/app/integrations"?L="https://dashboard.jetprintapp.com/app":L="https://dashboard.jetprintapp.com",b.callbackUrl=L+"/etsy/installs",i.shopWwixConnect(b).then(V=>{e.value=!1,window.open(V.data)}),e.value=!1}else if(f.type==de.SHOPIFY.value)window.open("https://apps.shopify.com/jetprint-fulfillment"),e.value=!1;else if(f.type==de.ETSY.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.getEtsyConnectUrl(b).then(re=>{e.value=!1,window.open(re.data)})}else ve.value.openDialog(f),e.value=!1}let P=m("");P.value=window.innerWidth,window.addEventListener("resize",function(f){P.value=window.innerWidth}),c.value=r.value.shopId,ue(()=>c.value,f=>{o.shopChange({shopId:f}).then(i=>{d.value.forEach(b=>{if(b.shopId==f){let L={name:b.name,shopId:b.shopId,shopType:b.type};n.SET_MERCHANT_SHOP(L)}})})});async function ge(f){await $(f),p.isShow=!0,p.msg="Copied successfully.",p.color="success"}return(f,i)=>{const b=G("PencilMinusIcon"),L=G("KeyIcon"),V=G("CopyIcon"),re=G("UnlinkIcon"),Le=G("TrashIcon"),Re=G("BuildingStoreIcon");return v(),_(T,null,[a("div",Pt,D(r.value),1),t(H,{modelValue:p.isShow,"onUpdate:modelValue":i[0]||(i[0]=h=>p.isShow=h),color:p.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[g(D(p.msg),1)]),_:1},8,["modelValue","color"]),t(Ce,{modelValue:c.value,"onUpdate:modelValue":i[2]||(i[2]=h=>c.value=h)},{default:l(()=>[(v(!0),_(T,null,X(d.value,(h,Ae)=>(v(),_("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:E((x(P)<=375,"width: 50px"))},[t(xe,{color:"secondary",rounded:"","hide-details":"",value:h.shopId,modelValue:c.value,"onUpdate:modelValue":i[1]||(i[1]=A=>c.value=A)},null,8,["value","modelValue"])],4),a("div",{style:E(x(P)<=775?"width: 80%":"width: 35%")},[a("div",jt,[h.type==1?(v(),_("img",{key:0,src:fe,style:E([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):k("",!0),h.type==2||h.type==4?(v(),_("img",{key:1,src:pe,style:E([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):k("",!0),h.type==3?(v(),_("img",{key:2,src:he,style:E([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):k("",!0),h.type==5?(v(),_("img",{key:3,src:le,style:E([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):k("",!0),h.type==6?(v(),_("img",{key:4,src:me,style:E([{opacity:h.isConnect?1:.3},{width:"46px",height:"46px"}])},null,4)):k("",!0),a("span",Wt,D(h.name),1),t(N,{icon:"",color:"#252525",variant:"text",onClick:A=>Ve(h)},{default:l(()=>[t(W,{activator:"parent",location:"top"},{default:l(()=>i[3]||(i[3]=[g("Store Name")])),_:1}),t(b,{size:"20","stroke-width":"1.25"})]),_:2},1032,["onClick"])])],4),a("div",{class:"d-flex",style:E(x(P)<=775?"width: 100%;margin-top: 20px":"width: 30%")},[a("div",zt,[i[4]||(i[4]=g("Orders: ")),a("span",Bt,D(h.orderNum),1)]),a("div",Gt,[i[5]||(i[5]=g("Products: ")),a("span",Ot,D(h.productNum),1)])],4),a("div",{style:E(x(P)<=375?"width: 100%;":"width: 10%")},[!h.isConnect&&h.type!=4?(v(),Q(N,{key:0,color:"primary",loading:x(e),rounded:"",onClick:A=>Ne(h),style:E(x(P)<=375?"margin-top: 20px":"")},{default:l(()=>i[6]||(i[6]=[g(" Connect ")])),_:2},1032,["loading","onClick","style"])):k("",!0)],4),a("div",{class:"d-flex",style:E(x(P)<900?"width: 100%;margin-top: 20px;":"width: 20%")},[h.oapiEnable?(v(),Q(Pe,{key:0,"close-on-content-click":!0,location:"top"},{activator:l(({props:A})=>[a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>i[7]||(i[7]=[g("API Key")])),_:1}),t(N,We({icon:"",color:"#252525",variant:"text",ref_for:!0},A),{default:l(()=>[t(L,{size:"20","stroke-width":"1.25"})]),_:2},1040)])]),default:l(()=>[t(je,{rounded:"md",elevation:"12"},{default:l(()=>[a("div",Ht,[i[8]||(i[8]=a("div",{class:"clien-title"},"Client ID",-1)),a("div",Ft,[a("div",Yt,D(h.clientId),1),a("span",{class:"ml-auto text-secondary",style:{"font-size":"16px"},onClick:A=>ge(h.clientId)},"Copy",8,Zt)]),i[9]||(i[9]=a("div",{class:"clien-title mt-6"},"API Key",-1)),a("div",Kt,[a("div",Jt,D(h.clientSecret),1),a("span",{class:"ml-auto text-secondary",style:{"font-size":"16px"},onClick:A=>ge(h.clientSecret)},"Copy",8,qt)])])]),_:2},1024)]),_:2},1024)):k("",!0),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>i[10]||(i[10]=[g("Copy Poducts")])),_:1}),t(N,{icon:"",color:"#252525",variant:"text",disabled:d.value.length<=1||h.productNum===0,onClick:A=>Ie(h.productNum,h.shopId)},{default:l(()=>[t(V,{size:"20","stroke-width":"1.25"})]),_:2},1032,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>i[11]||(i[11]=[g("Disconnect")])),_:1}),t(N,{icon:"",color:"#252525",variant:"text",disabled:!h.isConnect||h.type==2,onClick:A=>ke(h.shopId)},{default:l(()=>[t(re,{size:"20","stroke-width":"1.25"})]),_:2},1032,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>i[12]||(i[12]=[g("Remove Store")])),_:1}),t(N,{icon:"",color:"#252525",variant:"text",disabled:h.type==2,onClick:A=>$e(h)},{default:l(()=>[t(Le,{size:"20","stroke-width":"1.25"})]),_:2},1032,["disabled","onClick"])]),a("div",null,[t(W,{activator:"parent",location:"top"},{default:l(()=>i[13]||(i[13]=[g("Visit Store")])),_:1}),t(N,{icon:"",color:"#252525",variant:"text",disabled:!h.url,onClick:A=>Ue(h.url)},{default:l(()=>[t(Re,{size:"20","stroke-width":"1.25"})]),_:2},1032,["disabled","onClick"])])],4)]))),128))]),_:1},8,["modelValue"]),t(yt,{ref_key:"refResetName",ref:ie,onReflash:u},null,512),t(Rt,{ref_key:"refCopyProduct",ref:ae,onReflash:u},null,512),t(Mt,{ref_key:"refDisconnect",ref:ne,onReflash:se},null,512),t(ze,{ref_key:"refDelProduct",ref:q,title:w.title,message:w.message,onReflash:De},null,8,["title","message"]),t(be,{ref_key:"refConnectShopDialog",ref:ve,onReflash:u},null,512)],64)}}},Qt=Y(Xt,[["__scopeId","data-v-76e8cf47"]]),eo={class:"pa-5"},co=O({__name:"Index",setup(j){const U=ce(),$=m("tab-profile"),n=R([{title:"Integrations",disabled:!0,href:"#"}]),c=m(1),d=R({color:"",msg:"",isShow:!1});ue(()=>$.value,(e,r)=>{e=="tab-myStore"&&(c.value=""),e=="tab-myStore"&&(c.value=""),e=="tab-myStore"&&(c.value=""),e=="tab-myStore"&&(c.value="")});const s=J(()=>(console.log("computed...",U.merchantInfoMutations),U.merchantInfoMutations.login));function o(e){var r=new RegExp("(^|&)"+e+"=([^&]*)(&|$)","i"),I=window.location.search.substr(1).match(r);return I!=null?unescape(I[2]):null}const C=M();var p=o("code"),S=o("state"),w=o("error");return console.log("code...",p),console.log("state...",S),console.log("error...",w),p&&p!=null&&(Be().query,C.submitEtsyConnect({code:p,state:S}).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)=>(v(),_(T,null,[t(H,{modelValue:d.isShow,"onUpdate:modelValue":r[0]||(r[0]=I=>d.isShow=I),color:d.color,timeout:3e3,variant:"flat",rounded:"md",location:"top"},{default:l(()=>[g(D(d.msg),1)]),_:1},8,["modelValue","color"]),t(Ee,{title:"Integrations",breadcrumbs:n},null,8,["breadcrumbs"]),t(B,{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]=[g("Let's connect your store!")])),_:1}),t(F,null,{default:l(()=>[t(ht,{class:"mt-3"})]),_:1})]),_:1}),s.value?(v(),Q(B,{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:$.value,"onUpdate:modelValue":r[1]||(r[1]=I=>$.value=I),"selected-class":"integrationsactivedTab"},{default:l(()=>[t(Z,{value:""},{default:l(()=>r[4]||(r[4]=[g("My Store")])),_:1}),t(Z,{value:"1"},{default:l(()=>r[5]||(r[5]=[g("Shopify")])),_:1}),t(Z,{value:"3"},{default:l(()=>r[6]||(r[6]=[g("Woocommerce")])),_:1}),t(Z,{value:"5"},{default:l(()=>r[7]||(r[7]=[g("Etsy")])),_:1}),t(Z,{value:"6"},{default:l(()=>r[8]||(r[8]=[g("Wix")])),_:1})]),_:1},8,["modelValue"]),a("div",eo,[t(He,{modelValue:$.value,"onUpdate:modelValue":r[2]||(r[2]=I=>$.value=I)},{default:l(()=>[t(Qt,{type:$.value},null,8,["type"])]),_:1},8,["modelValue"])])]),_:1})]),_:1})]),_:1})):k("",!0)],64))}});export{co as default};