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