|
1
|
|
-var Ue=Object.defineProperty;var Me=(a,t,i)=>t in a?Ue(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i;var Le=(a,t,i)=>Me(a,typeof t!="symbol"?t+"":t,i);import{r as m,e as _,o as n,a as e,b as g,w as s,u as c,c as $,d as l,t as o,F as U,g as N,n as re,f as D,h as j,l as se,v as ce,j as pe,i as ue,x as X,G as Ce,k as Ie,q,a0 as Oe,m as Fe,z as Be}from"./chunks/vue.esm-bundler.js?ver=1.3.27";import{C as B,c as M,d as I,T as De,_ as Ne,a as Ee,f as Re}from"./chunks/CardBody.js?ver=1.3.27";import{L as ne,_ as Pe}from"./chunks/NotFound.js?ver=1.3.27";import{_ as je,m as $e,a as ze,d as He,T as Y,i as Ve}from"./chunks/dateShortCuts.js?ver=1.3.27";import{_ as le,P as qe}from"./chunks/Empty.js?ver=1.3.27";import{_ as R}from"./chunks/DynamicIcon.js?ver=1.3.27";import{t as d,A as de}from"./chunks/Translator.js?ver=1.3.27";import{I as _e,S as xe}from"./chunks/IconButton.js?ver=1.3.27";import{a as Ye,cq as Ke,b as he}from"./chunks/index.js?ver=1.3.27";import{_ as ee,P as We,L as Ge,O as oe,e as Xe,d as Ze}from"./chunks/OrderCustomerInformation.js?ver=1.3.27";import{_ as W}from"./chunks/_plugin-vue_export-helper.js?ver=1.3.27";import{d as Z}from"./chunks/dayjs.min.js?ver=1.3.27";import{M as Je}from"./chunks/Model.js?ver=1.3.27";import{R as Ae}from"./chunks/Rest.js?ver=1.3.27";import{B as H}from"./chunks/Badge.js?ver=1.3.27";import{b as K,i as Qe,a as et}from"./chunks/common.js?ver=1.3.27";import{_ as me,C as Te}from"./chunks/CopyToClipboard.js?ver=1.3.27";import{S as tt}from"./chunks/Str.js?ver=1.3.27";import{A as te}from"./chunks/Arr.js?ver=1.3.27";import"./chunks/vue-router.js?ver=1.3.27";import"./chunks/Url.js?ver=1.3.27";import"./chunks/timezone.js?ver=1.3.27";import"./chunks/Notify.js?ver=1.3.27";import"./chunks/index3.js?ver=1.3.27";import"./chunks/Utils.js?ver=1.3.27";import"./chunks/Asset.js?ver=1.3.27";import"./chunks/index4.js?ver=1.3.27";import"./chunks/productService.js?ver=1.3.27";import"./chunks/Animation.js?ver=1.3.27";const st={class:"fct-license-settings fct-layout-width"},lt={key:1,class:"fct-license-settings-body"},at={class:"fct-licensed-product-table hide-on-mobile"},nt={class:"fct-media-with-content"},it={class:"media"},ot=["src","alt"],rt={class:"title"},ct=["innerHTML"],dt=["innerHTML"],ut={class:"fct-product-pricing-table-item"},_t={class:"fct-licensed-product-table-mobile"},mt={class:"fct-licensed-product-table-mobile-col"},pt={class:"root-title"},ht={class:"fct-media-with-content"},ft={class:"media"},gt=["src","alt"],vt={class:"title"},bt=["innerHTML"],yt=["innerHTML"],wt={class:"fct-licensed-product-table-mobile-col"},kt={class:"root-title"},Lt={class:"fct-product-pricing-table-item"},Ct={key:0},$t={class:"custom-wp-editor-wrapper relative"},xt={class:"absolute mb-0 font-bold"},St={key:2,class:"fct-bundle-license-info",style:{padding:"40px 20px"}},Dt={class:"flex items-center justify-center mb-4"},Et={style:{"max-width":"600px",margin:"0 auto",color:"#606266","line-height":"1.6","text-align":"left"}},Pt={class:"text-sm font-medium mb-3 text-system-dark dark:text-gray-50"},Vt={style:{"font-size":"14px"}},At={key:0,class:"setting-save-action"},Tt={name:"LicenseSettings",props:["product_id"],data(){return{settings:null,saving:!1,loading:!1,product:{},globalUpdateFile:{},selectedFile:null,fetchSettings:!1,isBundleProduct:!1}},methods:{translate:d,fetchProduct(){this.loading=!0,this.$get("products/"+this.product_id+"/pricing",{}).then(a=>{this.product=a.product}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},getSettings(){this.fetchSettings=!0,this.$get(`licensing/products/${this.product_id}/settings`).then(a=>{var t,i;this.settings=a.settings,this.isBundleProduct=a.is_bundle_product||!1,this.selectedFile=(t=a.settings.global_update_file)!=null&&t.id?parseInt((i=a.settings.global_update_file)==null?void 0:i.id):""}).catch(a=>{this.handleError(a)}).finally(()=>{this.fetchSettings=!1})},updateSettings(){if(this.isBundleProduct){this.handleError({message:this.translate("License settings cannot be saved for bundle products. Licenses are generated according to bundle items' license settings.")});return}this.saving=!0,this.$post(`licensing/products/${this.product_id}/settings`,{settings:this.settings}).then(a=>{this.handleSuccess(a.message)}).catch(a=>{this.handleError(a)}).finally(()=>{this.saving=!1})},imageUrl(a){var t;return a&&((t=a.meta_value)==null?void 0:t.length)>0?a.meta_value[0].url:this.appVars.asset_url+"images/empty-image.svg"},imageAlt(a){var t;return a&&((t=a.meta_value)==null?void 0:t.length)>0?a.meta_value[0].title:"No Image"}},mounted(){this.getSettings(),this.fetchProduct();const a=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");a&&document.querySelector("#fluent_cart_plugin_app").prepend(a)}},Ut=Object.assign(Tt,{setup(a){return(t,i)=>{const w=m("el-switch"),u=m("el-skeleton"),r=m("el-table-column"),b=m("el-input"),v=m("el-table"),y=m("el-form-item"),S=m("el-col"),E=m("el-option"),C=m("el-select"),T=m("el-row"),p=m("el-form"),P=m("el-button");return n(),_("div",st,[e(I,null,{default:s(()=>[e(B,{border_bottom:"",title:c(d)("License Settings")},{action:s(()=>[t.settings?(n(),$(w,{key:0,modelValue:t.settings.enabled,"onUpdate:modelValue":i[0]||(i[0]=k=>t.settings.enabled=k),"active-value":"yes","inactive-value":"no","active-text":c(d)("Enable Licensing for this product"),disabled:t.isBundleProduct},null,8,["modelValue","active-text","disabled"])):g("",!0)]),_:1},8,["title"]),e(M,null,{default:s(()=>[t.fetchSettings?(n(),$(u,{key:0,rows:6,animated:!0})):g("",!0),t.settings&&!t.fetchSettings?(n(),_("div",lt,[t.settings.enabled==="yes"?(n(),$(p,{key:0,"label-position":"top",modelValue:t.settings,"onUpdate:modelValue":i[11]||(i[11]=k=>t.settings=k)},{default:s(()=>[e(y,null,{default:s(()=>[l("div",at,[e(v,{ref:"elTable","row-key":k=>k.rowId,data:t.settings.variations},{default:s(()=>[e(r,{label:c(d)("Variant"),width:300},{default:s(k=>[l("div",nt,[l("div",it,[l("img",{src:t.imageUrl(k.row.media),alt:t.imageAlt(k.row.media)},null,8,ot)]),l("div",null,[l("div",rt,o(k.row.title),1),k.row.subscription_info?(n(),_("div",{key:0,class:"text",innerHTML:k.row.subscription_info},null,8,ct)):g("",!0),k.row.setup_fee_info?(n(),_("div",{key:1,class:"text",innerHTML:k.row.setup_fee_info},null,8,dt)):g("",!0)])])]),_:1},8,["label"]),e(r,{width:140},{header:s(()=>[e(ne,{title:c(d)("Activation Limit"),content:c(d)("Activation limit controls how many sites/devices can use this license. License validity matches your subscription interval. For example, an annual subscription will generate a license valid for one year.")},null,8,["title","content"])]),default:s(k=>[l("div",ut,[e(b,{type:"number",min:1,placeholder:c(d)("Use 0 or empty for no limit"),modelValue:k.row.activation_limit,"onUpdate:modelValue":O=>k.row.activation_limit=O},null,8,["placeholder","modelValue","onUpdate:modelValue"])])]),_:1})]),_:1},8,["row-key","data"])]),l("div",_t,[(n(!0),_(U,null,N(t.settings.variations,k=>(n(),_("div",{class:"fct-licensed-product-table-mobile-row",key:k.rowId},[l("div",mt,[l("div",pt,o(c(d)("Variant")),1),l("div",ht,[l("div",ft,[l("img",{src:t.imageUrl(k.media),alt:t.imageAlt(k.media)},null,8,gt)]),l("div",null,[l("div",vt,o(k.title),1),k.subscription_info?(n(),_("div",{key:0,class:"text",innerHTML:k.subscription_info},null,8,bt)):g("",!0),k.setup_fee_info?(n(),_("div",{key:1,class:"text",innerHTML:k.setup_fee_info},null,8,yt)):g("",!0)])])]),l("div",wt,[l("div",kt,[e(ne,{title:c(d)("Activation Limit"),content:c(d)("Activation limit controls how many sites/devices can use this license. License validity matches your subscription interval. For example, an annual subscription will generate a license valid for one year.")},null,8,["title","content"])]),l("div",Lt,[e(b,{type:"number",min:1,placeholder:c(d)("Use 0 or empty for no limit"),modelValue:k.activation_limit,"onUpdate:modelValue":O=>k.activation_limit=O},null,8,["placeholder","modelValue","onUpdate:modelValue"])])])]))),128))])]),_:1}),e(T,{gutter:20},{default:s(()=>[e(S,{lg:8},{default:s(()=>[e(y,null,{label:s(()=>[e(ne,{title:c(d)("Version Number"),content:c(d)("Enter the current version number of your product.")},null,8,["title","content"])]),default:s(()=>[e(b,{placeholder:c(d)("Your Product Version"),modelValue:t.settings.version,"onUpdate:modelValue":i[1]||(i[1]=k=>t.settings.version=k)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),e(S,{lg:8},{default:s(()=>[e(y,null,{label:s(()=>[e(ne,{title:c(d)("License Key Prefix (Optional)"),content:c(d)("If you add any prefix here then it will will be used as the prefix of the generated license key")},null,8,["title","content"])]),default:s(()=>[e(b,{placeholder:c(d)("Your License Key Prefix"),modelValue:t.settings.prefix,"onUpdate:modelValue":i[2]||(i[2]=k=>t.settings.prefix=k)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),t.fetchSettings?g("",!0):(n(),$(S,{key:0,lg:8},{default:s(()=>[e(y,null,{label:s(()=>[e(ne,{title:c(d)("Update File"),content:c(d)("Update File (Choose the source file to get automatic updates)")},null,8,["title","content"])]),default:s(()=>{var k,O;return[((O=(k=t.product)==null?void 0:k.downloadable_files)==null?void 0:O.length)===0?(n(),_("span",Ct,o(c(d)("No downloadable files found")),1)):(n(),$(C,{key:1,modelValue:t.settings.global_update_file,"onUpdate:modelValue":i[3]||(i[3]=f=>t.settings.global_update_file=f),placeholder:c(d)("Update File")},{default:s(()=>[(n(!0),_(U,null,N(t.product.downloadable_files,f=>(n(),$(E,{key:f.id,label:f.title,value:f.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]))]}),_:1})]),_:1}))]),_:1}),e(y,null,{default:s(()=>[l("div",$t,[l("label",xt,o(c(d)("Changelog Description")),1),e(je,{modelValue:t.settings.changelog,onUpdate:i[4]||(i[4]=k=>{t.settings.changelog=k})},null,8,["modelValue"])])]),_:1}),l("div",{class:re("is-wp-product-wrap "+(t.settings.wp.is_wp==="yes"?"pb-0":""))},[l("div",{class:re(t.settings.wp.is_wp==="yes"?"pb-4":"")},[e(w,{modelValue:t.settings.wp.is_wp,"onUpdate:modelValue":i[5]||(i[5]=k=>t.settings.wp.is_wp=k),"active-value":"yes","inactive-value":"no","active-text":c(d)("Is WP Plugin?")},null,8,["modelValue","active-text"])],2),t.settings.wp.is_wp==="yes"?(n(),_(U,{key:0},[e(y,{label:c(d)("Changelog Page URL")},{default:s(()=>[e(b,{placeholder:c(d)("Your Product Changelog Page URL"),modelValue:t.settings.wp.readme_url,"onUpdate:modelValue":i[6]||(i[6]=k=>t.settings.wp.readme_url=k)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),e(T,{gutter:20},{default:s(()=>[e(S,{md:12},{default:s(()=>[e(y,{label:c(d)("Banner URL")},{default:s(()=>[e(b,{placeholder:c(d)("Plugin Banner URL"),modelValue:t.settings.wp.banner_url,"onUpdate:modelValue":i[7]||(i[7]=k=>t.settings.wp.banner_url=k)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12},{default:s(()=>[e(y,{label:c(d)("Icon URL")},{default:s(()=>[e(b,{placeholder:c(d)("Plugin Icon URL"),modelValue:t.settings.wp.icon_url,"onUpdate:modelValue":i[8]||(i[8]=k=>t.settings.wp.icon_url=k)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12,xs:24},{default:s(()=>[e(y,{label:c(d)("Required PHP Version (optional)")},{default:s(()=>[e(b,{placeholder:c(d)("Required PHP Version"),modelValue:t.settings.wp.required_php,"onUpdate:modelValue":i[9]||(i[9]=k=>t.settings.wp.required_php=k)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12,xs:24},{default:s(()=>[e(y,{label:c(d)("Required WP Version (optional)")},{default:s(()=>[e(b,{placeholder:c(d)("Required WP Version"),modelValue:t.settings.wp.required_wp,"onUpdate:modelValue":i[10]||(i[10]=k=>t.settings.wp.required_wp=k)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})],64)):g("",!0)],2)]),_:1},8,["modelValue"])):g("",!0),t.settings.enabled!=="yes"&&!t.isBundleProduct?(n(),$(le,{key:1,icon:"Empty/WebPage",text:c(d)("License for this product has not been enabled")},null,8,["text"])):g("",!0),t.isBundleProduct?(n(),_("div",St,[l("div",Dt,[e(R,{name:"Empty/WebPage",class:"w-[100px]"})]),l("div",Et,[l("p",Pt,o(c(d)("License Settings Not Available for Bundle Products")),1),l("p",Vt,o(c(d)("Licenses are managed by bundle items themselves. Only pricing follows the bundle product (e.g., yearly bundle pricing results in yearly licenses for child bundle items).")),1)])])):g("",!0)])):g("",!0)]),_:1})]),_:1}),t.settings&&!t.isBundleProduct?(n(),_("div",At,[e(P,{onClick:i[12]||(i[12]=k=>t.updateSettings()),loading:t.saving,disabled:t.saving,type:"primary"},{default:s(()=>[D(o(c(d)(" Update Settings")),1)]),_:1},8,["loading","disabled"])])):g("",!0)])}}});class Mt extends De{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="order_id"}getTabs(){return{all:d("All"),active:d("Active"),inactive:d("Inactive"),expired:d("Expired"),disabled:d("Disabled")}}getToggleableColumns(){return[{label:d("Order ID"),value:"order_id"},{label:d("Product"),value:"product"},{label:d("Customer"),value:"customer"},{label:d("Date"),value:"date"}]}getSortableColumns(){return[{label:"Order ID",value:"order_id"},{label:"Activation Count",value:"activation_count"},{label:"Expiration Date",value:"expiration_date"},{label:"Date",value:"created_at"},{label:"Status",value:"status"}]}getSearchHint(){return d("by license key, order id, customer name/email or connected sites.")}getFetchUrl(){return"licensing/licenses"}parseResponse(t){return t.licenses}getTableName(){return"licenses"}with(){return["customer","product:ID,post_title","productVariant:id,variation_title"]}}function It(a){return Mt.init(a)}class Ot extends Je{constructor(){super(...arguments);Le(this,"data",{summaryData:[],lineChartData:[],pieChartData:[],isBusy:!1})}get controllerKey(){return"LicenseReportController"}beforeInit(){}makeRequest(i,w,u,r){this.data.isBusy=!0,typeof w!="object"&&(w={});const b=Ae.get(`reports/${i}`,w);return this.resolvePromiseResponse(b,u,r),b}resolvePromiseResponse(i,w=null,u=null){i.then(r=>{u==null||w==null||(this.data[u]=r[w])}).catch(r=>{console.log(r,"error")}).finally(()=>{this.data.isBusy=!1})}getLicenseLineChart(i={}){return this.makeRequest("license-chart",i,"lineChartData","lineChartData")}getLicensePieChart(i={}){return this.makeRequest("license-pie-chart",i,"pieChartData","pieChartData")}getSummary(i={}){return this.makeRequest("license-summary",i,"summaryData","summaryData")}}const z=Ot.init(),Ft={class:"fct-license-statistics-wrap"},Bt={class:"fct-btn-group sm"},Nt={class:"chart-action-wrap"},Rt={class:"chart-change-wrap"},jt={class:"chart-change"},zt={class:"text"},Ht={class:"chart-change"},qt={class:"text"},Yt={__name:"LicenseStatistics",props:{reportFilter:{type:Object}},setup(a){const t=a,i=j(null),w=j("daily"),u=j("line"),r=j([Z().startOf("month"),Z()]),b=[{value:"daily",label:"Daily"},{value:"monthly",label:"Monthly"},{value:"yearly",label:"Yearly"}],v=se(()=>[{title:"Total License",key:"total_license",color:"#2ecc71"}].map(({title:f,key:h,color:x},L)=>p(f,u.value,L%2,z.data.lineChartData.map(F=>F.license_count),x))),y=se(()=>z.data.lineChartData.map(f=>{if(w.value==="daily"){const[h,x,L]=f.date.split("-");return`${$e[parseInt(x)-1]} ${L}, ${h}`}else{if(w.value==="monthly")return`${$e[parseInt(f.month)-1]} ${f.year}`;if(w.value==="yearly")return`${f.year}`}}));let S=null;const E=()=>{i.value&&S===null&&(S=Ve(i.value),C())},C=()=>{const f={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:Y.isDark()?"#38485a":"#ffffff",borderColor:Y.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:Y.isDark()?"#ffffff":"#565865"}},xAxis:{type:"category",data:y.value,axisLabel:{color:Y.isDark()?"#ffffff":"#565865",fontSize:12}},yAxis:[{type:"value",axisLabel:{color:Y.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:Y.isDark()?"#38485a":"#D6DAE1"}}},{type:"value",position:"right",axisLabel:{color:Y.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!1}}],dataZoom:[],series:v.value};S.setOption(f,{notMerge:!0,replaceMerge:["series"]})},T=()=>{const f={startDate:r.value[0].toISOString(),endDate:r.value[1].toISOString()};z.getLicenseLineChart({params:{...f,groupKey:w.value}})},p=(f,h,x,L,F)=>({name:f,type:h,yAxisIndex:x,data:L,smooth:!0,color:F,lineStyle:{width:3}}),P=()=>{T()},k=()=>{T()},O=f=>{u.value!==f&&(u.value=f,C())};return ce([()=>z.chartData,u],()=>{X(C)},{deep:!0}),ce(()=>z.data.lineChartData,()=>{X(()=>{C()})},{deep:!0}),pe(()=>{window.removeEventListener("onFluentCartThemeChange",C,!1)}),ue(()=>{window.addEventListener("onFluentCartThemeChange",C),T(),X(E)}),(f,h)=>{const x=m("el-option"),L=m("el-select"),F=m("el-date-picker");return n(),_("div",Ft,[e(I,{id:"chartContainer"},{default:s(()=>[e(B,{title:f.$t("License Chart"),title_size:"small",border_bottom:""},{action:s(()=>[l("div",Bt,[e(ze,{activeType:u.value,types:{line:"LineChart",bar:"BarChart"},onChange:O},null,8,["activeType"]),e(L,{class:"w-[100px] el-select--x-small",modelValue:w.value,"onUpdate:modelValue":h[0]||(h[0]=A=>w.value=A),onChange:k},{default:s(()=>[(n(),_(U,null,N(b,A=>e(x,{key:A.value,label:f.$t(A.label),value:A.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),e(F,{class:"w-[220px] el-range-editor--x-small hide-close-icon",modelValue:r.value,"onUpdate:modelValue":h[1]||(h[1]=A=>r.value=A),type:"daterange","range-separator":"-","start-placeholder":f.$t("Start date"),"end-placeholder":f.$t("End date"),"unlink-panels":"",clearable:!1,shortcuts:c(He),onChange:P},null,8,["modelValue","start-placeholder","end-placeholder","shortcuts"])])]),_:1},8,["title"]),e(M,null,{default:s(()=>[l("div",{class:"fct-license-statistics-chart",ref_key:"chartRef",ref:i},null,512),l("div",Nt,[l("div",Rt,[l("div",jt,[h[2]||(h[2]=l("svg",{width:"9",height:"11",viewBox:"0 0 9 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M4.6087 10.5L4.6087 1.46395",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M1.00004 4.05762L4.55764 0.500019L8.11523 4.05762",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),l("span",zt,o(f.$t("Data")),1)]),l("div",Ht,[l("span",qt,o(f.$t("Timeline")),1),h[3]||(h[3]=l("svg",{class:"rotate-90",width:"9",height:"11",viewBox:"0 0 9 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[l("path",{d:"M4.6087 10.5L4.6087 1.46395",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M1.00004 4.05762L4.55764 0.500019L8.11523 4.05762",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})],-1))])])])]),_:1})]),_:1})])}}},Kt={class:"fct-usage-statistics-chart-wrap"},Wt={class:"fct-usage-statistics-info flex items-center justify-between"},Gt={class:"text-lg font-semibold text-system-dark dark:text-gray-50"},Xt={class:"text-xs font-medium text-system-mid dark:text-gray-300"},Zt={class:"fct-custom-legend",style:{width:"100%"}},Jt={style:{margin:"0 0 15px 0","font-size":"14px","font-weight":"600"}},Qt={class:"legend-items"},es=["onClick","onMouseenter","onMouseleave"],ts={style:{flex:"1","min-width":"0"}},ss={style:{display:"flex","justify-content":"space-between","align-items":"center"}},ls=["title"],as={class:"legend-item-percentage"},ns={class:"legend-item-count"},is={class:"fct-custom-legend-controls"},os={class:"fct-action-link-btn"},rs={class:"fct-chart-container",style:{display:"flex","align-items":"flex-start"}},cs={__name:"UsageStatistics",props:{reportFilter:{type:Object},activatedSites:String|Number},setup(a){const t=a,i=Y.colors;i.blue;const w=j(null),u=j("daily"),r=j("pie"),b=j([Z().startOf("month"),Z()]),v=j({}),y=se(()=>z.data.pieChartData?z.data.pieChartData.map((x,L)=>({name:x.post_title,value:x.activation_count,percentage:x.percentage,color:S(L),visible:v.value[x.post_title]!==!1})):[]),S=x=>{const L=["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc","#ffb347"];return L[x%L.length]},E=se(()=>z.data.pieChartData.filter(x=>v.value[x.post_title]!==!1).map((x,L)=>({value:x.activation_count,name:x.post_title,itemStyle:{color:S(z.data.pieChartData.findIndex(F=>F.post_title===x.post_title))}})));let C=null;const T=()=>{w.value&&C===null&&(C=Ve(w.value),p())},p=()=>{if(!C)return;const x={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",borderRadius:8,backgroundColor:Y.isDark()?"#38485a":"#ffffff",textStyle:{color:Y.isDark()?i.gray[25]:i.system.mid},borderColor:Y.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"55%",center:["50%","50%"],data:E.value,label:{show:!0,color:Y.isDark()?i.gray[25]:i.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};C.setOption(x,{notMerge:!0,replaceMerge:["series"]})},P=x=>{v.value[x.name]=!x.visible,X(()=>{p()})},k=(x,L)=>{C&&(L?C.dispatchAction({type:"highlight",name:x.name}):C.dispatchAction({type:"downplay",name:x.name}))},O=()=>{const x={startDate:b.value[0].toISOString(),endDate:b.value[1].toISOString()};z.getLicensePieChart({params:{...x,groupKey:u.value}})},f=()=>{z.data.pieChartData&&z.data.pieChartData.forEach(x=>{x.post_title in v.value||(v.value[x.post_title]=!0)})};ce([()=>z.chartData,r],()=>{X(p)},{deep:!0}),ce(()=>z.data.pieChartData,()=>{f(),X(()=>{p()})},{deep:!0});const h=x=>{p()};return ue(()=>{window.addEventListener("onFluentCartThemeChange",h),O(),X(T)}),pe(()=>{window.removeEventListener("onFluentCartThemeChange",h)}),(x,L)=>{const F=m("el-popover");return n(),_("div",Kt,[l("div",Wt,[l("div",Gt,[D(o(a.activatedSites)+" ",1),l("div",Xt,o(x.$t("Total Activated Sites")),1)]),e(F,{placement:"bottom-start",width:226,trigger:"click","popper-class":"fct-license-statistics-popover"},{reference:s(()=>[l("div",os,[e(_e,null,{default:s(()=>[e(R,{name:"More"})]),_:1})])]),default:s(()=>[l("div",Zt,[l("h4",Jt,o(x.$t("License Distribution")),1),l("div",Qt,[(n(!0),_(U,null,N(y.value,A=>(n(),_("div",{key:A.name,class:re(["legend-item",{"legend-item-hidden":!A.visible}]),onClick:J=>P(A),onMouseenter:J=>k(A,!0),onMouseleave:J=>k(A,!1),style:Ce({opacity:A.visible?1:.5})},[l("div",{class:"legend-color",style:Ce({backgroundColor:A.color})},null,4),l("div",ts,[l("div",ss,[l("span",{class:"legend-item-name",title:A.name},o(A.name),9,ls),l("span",as,o(A.percentage)+"% ",1)]),l("div",ns,o(c(d)("%s licenses",A.value.toLocaleString())),1)])],46,es))),128))]),l("div",is,[l("button",{onClick:L[0]||(L[0]=()=>{Object.keys(v.value).forEach(A=>v.value[A]=!0),X(p)})},o(x.$t("Show All")),1),l("button",{onClick:L[1]||(L[1]=()=>{Object.keys(v.value).forEach(A=>v.value[A]=!1),X(p)})},o(x.$t("Hide All")),1)])])]),_:1})]),l("div",rs,[l("div",{class:"fct-usage-statistics-chart",ref_key:"chartRef",ref:w,style:{flex:"1",height:"350px"}},null,512)])])}}},ds=W(cs,[["__scopeId","data-v-2fd9c692"]]),us={},_s={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},ms={class:"flex items-center gap-2 mb-3"},ps={class:"right flex flex-col flex-1 gap-2"};function hs(a,t){const i=m("el-skeleton-item"),w=m("el-skeleton");return n(),_(U,null,N(4,u=>e(w,{animated:"",key:u},{template:s(()=>[l("div",_s,[l("div",ms,[e(i,{variant:"p",class:"rounded w-10 h-10 block"}),l("div",ps,[e(i,{variant:"p",class:"rounded w-4/5 block"}),e(i,{variant:"p",class:"rounded w-1/2 block"})])]),l("div",null,[e(i,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64)}const fs=W(us,[["render",hs]]),gs={name:"LicensesStatsCard",props:{licenseOverview:{type:Object,required:!0},loading:{type:Boolean}},components:{DynamicIcon:R,LicenseStatLoader:fs},methods:{translate:d}},vs={class:"licenses-stats-card-head"},bs={class:"licenses-icon"},ys={class:"licenses-stats-card-head-content"},ws={class:"title"},ks={class:"value"},Ls={class:"text"};function Cs(a,t,i,w,u,r){const b=m("LicenseStatLoader"),v=m("DynamicIcon");return i.loading?(n(),$(b,{key:0})):(n(!0),_(U,{key:1},N(i.licenseOverview,(y,S)=>(n(),_("div",{class:re(`licenses-stats-card ${S}`),key:S},[l("div",vs,[l("div",bs,[e(v,{name:y.icon},null,8,["name"])]),l("div",ys,[l("div",ws,o(r.translate(y.title)),1),l("div",ks,o(y.value),1)])]),l("div",Ls,o(r.translate(y.text)),1)],2))),128))}const $s=W(gs,[["render",Cs]]),xs={name:"LicenseStats",props:{licenses:{type:Array,required:!0}},components:{DynamicIcon:R,CardBody:M,CardHeader:B,CardContainer:I,LicenseStatistics:Yt,UsageStatistics:ds,LicensesStatsCard:$s},data(){return{loading:!1,licenseSummary:{}}},methods:{translate:d,fetchSummary(){this.loading=!0,this.$get("reports/license-summary",{params:{start_date:Z().startOf("month").format("YYYY-MM-DD"),end_date:Z().format("YYYY-MM-DD")}}).then(a=>{this.licenseSummary=a.summaryData}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})}},computed:{totalLicensedProducts(){var a;return((a=this.licenseSummary)==null?void 0:a.totalLicensedProducts)||0},totalActivatedSites(){var a;return((a=this.licenseSummary)==null?void 0:a.totalActivatedSites)||0},totalActiveLicense(){var a;return((a=this.licenseSummary)==null?void 0:a.totalActiveLicense)||this.licenses.filter(t=>t.status==="active").length},totalExpiredLicense(){var a;return((a=this.licenseSummary)==null?void 0:a.totalExpiredLicense)||this.licenses.filter(t=>t.status==="expired").length},totalInactiveLicense(){var a;return((a=this.licenseSummary)==null?void 0:a.totalInactiveLicense)||this.licenses.filter(t=>t.status==="inactive").length},licenseOverview(){return{"license-product":{title:"Licensed Product",value:this.totalLicensedProducts,text:`Active License ${this.totalActiveLicense}`,icon:"LicensedProduct"},"total-active":{title:"Total Active",value:this.totalActiveLicense,text:`New Active License ${this.totalActiveLicense}`,icon:"CheckCircle"},"total-expired":{title:"Total Expired",value:this.totalExpiredLicense,text:`New Expired License ${this.totalExpiredLicense}`,icon:"Warning"},"inactive-license":{title:"Inactive License",value:this.totalInactiveLicense,text:"Individual Sites",icon:"LicensedInactive"}}}},mounted(){this.fetchSummary()}},Ss={class:"fct-license-stats-wrap"},Ds={class:"licenses-stats-row"},Es={class:"fct-usage-statistics-wrap"};function Ps(a,t,i,w,u,r){const b=m("CardHeader"),v=m("LicensesStatsCard"),y=m("CardBody"),S=m("CardContainer"),E=m("LicenseStatistics"),C=m("el-col"),T=m("el-skeleton"),p=m("UsageStatistics"),P=m("el-row");return n(),_("div",Ss,[e(S,null,{default:s(()=>[e(b,{title:r.translate("Overall License Stats"),border_bottom:"",title_size:"small"},null,8,["title"]),e(y,null,{default:s(()=>[l("div",Ds,[e(v,{licenseOverview:r.licenseOverview,loading:u.loading},null,8,["licenseOverview","loading"])])]),_:1})]),_:1}),e(P,{gutter:30},{default:s(()=>[e(C,{md:24,lg:16},{default:s(()=>[e(E)]),_:1}),e(C,{md:24,lg:8},{default:s(()=>[e(S,null,{default:s(()=>[e(b,{title:r.translate("Usage Statistics"),border_bottom:"",title_size:"small"},null,8,["title"]),e(y,null,{default:s(()=>[l("div",Es,[u.loading?(n(),$(T,{key:0,animated:"",rows:4})):(n(),$(p,{key:1,activatedSites:r.totalActivatedSites},null,8,["activatedSites"]))])]),_:1})]),_:1})]),_:1})]),_:1})])}const Vs=W(xs,[["render",Ps]]),As={class:"table-cell"},Ts={class:"w-full flex flex-col items-start justify-start gap-1"},Us={class:"table-cell"},Ms={class:"w-full flex flex-col items-start justify-start gap-1"},Is={class:"table-cell"},Os={class:"table-cell"},Fs={class:"table-cell"},Bs={__name:"LicensesLoader",props:{nextPageCount:{type:Number,default:0},licenseTable:{type:Object,default:()=>({})}},setup(a){const t=a,i=u=>t.licenseTable.columns.includes(u),w=Array.from({length:t.nextPageCount},(u,r)=>r+1);return(u,r)=>{const b=m("el-table-column"),v=m("el-skeleton-item"),y=m("el-table"),S=m("el-skeleton");return n(),$(S,{animated:""},{template:s(()=>[e(y,{data:c(w),class:"w-full compact-table responsive"},{empty:s(()=>r[0]||(r[0]=[])),default:s(()=>[g("",!0),e(b,{label:u.$t("License Key"),width:220},{default:s(()=>[l("div",As,[l("div",Ts,[e(v,{varient:"p",class:"w-1/5"}),e(v,{varient:"p",class:"w-3/5"})])])]),_:1},8,["label"]),i("product")!==-1?(n(),$(b,{key:1,width:200,label:u.$t("Product")},{default:s(()=>[l("div",Us,[l("div",Ms,[e(v,{varient:"p",class:"w-1/5"}),e(v,{varient:"p",class:"w-2/5"})])])]),_:1},8,["label"])):g("",!0),i("order_id")!==-1?(n(),$(b,{key:2,width:80,label:u.$t("Order ID")},{default:s(()=>[l("div",Is,[e(v,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("customer")!==-1?(n(),$(b,{key:3,width:100,label:u.$t("Customer")},{default:s(()=>[l("div",Os,[e(v,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):g("",!0),e(b,{width:"100",label:u.$t("Activations")},{default:s(()=>[l("div",Fs,[e(v,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},Ns={},Rs={class:"px-4 py-3"},js={class:"grid grid-cols-3 gap-5 mt-5"};function zs(a,t){const i=m("el-skeleton-item"),w=m("el-skeleton");return n(),$(w,{animated:""},{template:s(()=>[l("div",Rs,[(n(),_(U,null,N(2,u=>l("div",{key:u,class:"flex items-center justify-between mb-3"},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64)),l("div",js,[(n(),_(U,null,N(3,u=>l("div",{key:u},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Hs=W(Ns,[["render",zs]]),qs={name:"LicenseTableMobile",components:{ProductInfo:We,UserCan:ee,RouteCell:Ne,DynamicIcon:R,IconButton:_e,CopyToClipboard:me,Empty:le,Badge:H},props:{licenses:{type:Array,required:!0},columns:{type:Array,default(){return["product","order_id","customer","date"]}},emptyText:{type:String,default:d("No Licenses found based on your filter")}},computed:{Clipboard(){return Te},formattedLicense(){return this.licenses.map(a=>{var t;return{...a,product:{...a.product,variation_title:((t=a.product_variant)==null?void 0:t.variation_title)||"n/a"}}})}},methods:{translate:d,formatDate:K}},Ys={class:"fct-table-mobile-wrap fct-licenses-table-mobile"},Ks=["onClick"],Ws={class:"fct-table-status-col"},Gs={key:0,class:"fct-table-date-col"},Xs={key:0},Zs={key:1},Js={class:"fct-table-mobile-body"},Qs=["onClick"],el={class:"fct-license-key-wrap has-bg"},tl={class:"fct-license-key"},sl={class:"fct-license-key-inner pr-2"},ll={class:"fct-table-mobile-footer"},al={class:"fct-table-mobile-footer-row"},nl={key:0,class:"fct-table-id-col"},il={class:"title"},ol={key:1,class:"fct-table-customer-col"},rl={class:"title"},cl={class:"fct-table-activations-col"},dl={class:"title"},ul={key:0,class:"py-6 text-center"};function _l(a,t,i,w,u,r){const b=m("Badge"),v=m("ProductInfo"),y=m("router-link"),S=m("DynamicIcon"),E=m("el-tooltip"),C=m("Empty"),T=m("UserCan");return n(),$(T,{permission:"licenses/view"},{default:s(()=>[l("div",Ys,[(n(!0),_(U,null,N(r.formattedLicense,(p,P)=>(n(),_("div",{key:p.id,class:"fct-table-mobile-row"},[l("div",{class:"fct-table-mobile-header",onClick:k=>a.$router.push({name:"view_license",params:{license_id:p==null?void 0:p.id}})},[l("div",Ws,[(n(),$(b,{status:p.status,key:p.id},null,8,["status"]))]),i.columns.indexOf("date")!==-1?(n(),_("div",Gs,[l("span",null,o(r.formatDate(p.created_at)),1),t[0]||(t[0]=l("span",{class:"px-1"},"-",-1)),p.expiration_date?(n(),_("span",Xs,o(r.formatDate(p.expiration_date)),1)):(n(),_("span",Zs,o(r.translate("Lifetime")),1))])):g("",!0)],8,Ks),l("div",Js,[i.columns.indexOf("product")!==-1?(n(),_("div",{key:0,class:"fct-table-product-col",onClick:k=>a.$router.push({name:"view_license",params:{license_id:p==null?void 0:p.id}})},[e(v,{product:p.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])],8,Qs)):g("",!0),l("div",el,[l("div",tl,[l("div",sl,[e(y,{class:"link",to:{name:"view_license",params:{license_id:p==null?void 0:p.id}}},{default:s(()=>[D(o(p.license_key),1)]),_:2},1032,["to"])]),e(E,{content:p.license_key,placement:"top","popper-class":"fct-tooltip"},{default:s(()=>[e(S,{class:"cursor-pointer p-1 w-6 h-6",name:"Copy",onClick:()=>{r.Clipboard.copy(p.license_key,{successMessage:r.translate("License Key copied to clipboard"),errorMessage:r.translate("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])])]),l("div",ll,[l("div",al,[i.columns.indexOf("order_id")!==-1?(n(),_("div",nl,[l("div",il,o(r.translate("Order ID")),1),e(y,{class:"value",to:{name:"view_order",params:{order_id:p.order_id}}},{default:s(()=>[D(" #"+o(p.order_id),1)]),_:2},1032,["to"])])):g("",!0),i.columns.indexOf("customer")!==-1?(n(),_("div",ol,[l("div",rl,o(r.translate("Customer")),1),e(y,{class:"value",to:{name:"view_customer",params:{customer_id:p.customer_id}}},{default:s(()=>{var k;return[D(o(((k=p==null?void 0:p.customer)==null?void 0:k.full_name)||r.translate("No Name")),1)]}),_:2},1032,["to"])])):g("",!0),l("div",cl,[l("div",dl,o(r.translate("Activations")),1),e(y,{class:"value",to:{name:"view_license",params:{license_id:p==null?void 0:p.id}}},{default:s(()=>[D(o(p.activation_count)+" "+o("/")+" "+o(p.limit===0?"Unlimited":p.limit),1)]),_:2},1032,["to"])])])])]))),128)),r.formattedLicense.length===0?(n(),_("div",ul,[e(C,{icon:"Empty/ListView","has-dark":"",text:i.emptyText},null,8,["text"])])):g("",!0)])]),_:1})}const ml=W(qs,[["render",_l]]),pl={class:"fct-all-license-page fct-layout-width"},hl={class:"fct-all-license-wrap"},fl={key:1},gl={__name:"Licenses",setup(a){const t=It(),i=j(!1),w=j(!1),u=()=>{w.value=window.innerWidth<768},r=v=>{v==="show_license_stats"&&(xe.set("show_license_stats",!i.value),i.value=!i.value)},b=()=>{const v=xe.get("show_license_stats");v&&(i.value=v)};return ue(()=>{b(),u(),window.addEventListener("resize",u)}),pe(()=>{window.removeEventListener("resize",u)}),(v,y)=>{const S=m("el-button"),E=m("router-link"),C=m("el-icon"),T=m("el-dropdown-item"),p=m("el-dropdown-menu"),P=m("el-dropdown");return n(),_("div",pl,[e(qe,{title:c(d)("Licenses")},{action:s(()=>[e(E,{to:{name:"activated_sites"}},{default:s(()=>[e(S,null,{default:s(()=>[e(R,{name:"Sites"}),D(" "+o(c(d)("Sites")),1)]),_:1})]),_:1}),e(ee,{permission:"reports/view"},{default:s(()=>[e(P,{trigger:"click","popper-class":"fct-dropdown",onCommand:r,placement:"bottom-end"},{dropdown:s(()=>[e(p,null,{default:s(()=>[e(T,{command:"show_license_stats"},{default:s(()=>[i.value?(n(),_(U,{key:1},[e(R,{name:"EyeOff"}),D(" "+o(c(d)("Hide License Stats")),1)],64)):(n(),_(U,{key:0},[e(R,{name:"Eye"}),D(" "+o(c(d)("Show License Stats")),1)],64))]),_:1})]),_:1})]),default:s(()=>[e(S,null,{default:s(()=>[D(o(c(d)("More actions"))+" ",1),e(C,null,{default:s(()=>[e(c(Ye))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["title"]),e(ee,{permission:"reports/view"},{default:s(()=>[i.value?(n(),$(Vs,{key:0,licenses:c(t).getTableData()},null,8,["licenses"])):g("",!0)]),_:1}),e(ee,{permission:"licenses/view"},{default:s(()=>[l("div",hl,[e(Ee,{table:c(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:s(()=>[c(t).isLoading()?(n(),$(Hs,{key:0})):g("",!0),c(t).isLoading()?g("",!0):(n(),$(ml,{key:1,licenses:c(t).getTableData(),columns:c(t).data.columns},null,8,["licenses","columns"]))]),default:s(()=>[c(t).isLoading()?(n(),$(Bs,{key:0,licenseTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["licenseTable","next-page-count"])):(n(),_("div",fl,[e(Ge,{licenses:c(t).getTableData(),columns:c(t).data.columns},null,8,["licenses","columns"])]))]),_:1},8,["table"])])]),_:1})])}}},vl={class:"el-form--label-top fct-plan-changer-content-wrap"},bl={key:0},yl=["innerHTML"],wl={key:1},kl=["innerHTML"],Ll={key:1,class:"fct-btn-group"},Cl={__name:"PlanChanger",props:{variations:{},product_id:"",variation_id:"",license:null,order:null,upgrade_path_base:""},setup(a){const t=a,i=j(!1),w=()=>{i.value=!0},u=Ie().ctx,r=j(""),b=j([]);let v=j(null);const y=se(()=>{var f,h;return de.get("shop.currency_sign")?de.get("shop.currency_sign"):(h=(f=window.fluentcart_customer_profile_vars)==null?void 0:f.shop)!=null&&h.currency_sign?window.fluentcart_customer_profile_vars.shop.currency_sign:""}),S=se(()=>{var f;return(f=t.order)==null?void 0:f.order_items.find(h=>h.payment_type==="subscription"||h.payment_type==="adjustment"||h.payment_type==="onetime")}),E=function(f){let h="";const x=f==null?void 0:f.payment_type,L=f==null?void 0:f.other_info;if((L==null?void 0:L.payment_type)==="subscription"&&x!=="adjustment"){(L==null?void 0:L.manage_setup_fee)==="yes"&&(h+=L.signup_fee_name+" : "+y.value+parseFloat(L.signup_fee/100)+", ");const F=Number(L==null?void 0:L.times)?(L==null?void 0:L.times)+" times":", Until Cancel";return h+=(f==null?void 0:f.formatted_total)+" Subscriptions "+L.repeat_interval+" "+F,h}else if((L==null?void 0:L.payment_type)==="subscription"&&x==="adjustment"){(L==null?void 0:L.manage_setup_fee)==="yes"&&(h+=L.signup_fee_name+" :"+parseFloat(L.signup_fee/100)+", ");const F=Number(L==null?void 0:L.times)?(L==null?void 0:L.times)+" times":", Until Cancel";return h+=(f==null?void 0:f.formatted_total)+" Subscriptions "+L.repeat_interval+" "+F,h}else if((L==null?void 0:L.payment_type)==="onetime")return h+=(f==null?void 0:f.formatted_total)+" One Time Payment";return f==null?void 0:f.other_info.billing_summary};let C=j("");const T=f=>{v=t.variations.find(h=>h.id.toString()===f),C.value=E(v)},p=f=>{var x,L;return((x=f==null?void 0:f.other_info)==null?void 0:x.payment_type)==="subscription"?(f==null?void 0:f.variation_title)+" - "+tt.capitalize((L=f==null?void 0:f.other_info)==null?void 0:L.repeat_interval):(f==null?void 0:f.variation_title)+" - One Time Payment"},P=()=>{u.$get(`products/${t.product_id}/upgrade-paths`,{variation_id:t.variation_id}).then(f=>{f.data.forEach((h,x)=>{h.object_id===t.variation_id&&h.value.to_variants.forEach((L,F)=>{b.value.push({id:L,variation_title:p(t.variations.find(A=>A.id.toString()===L)),payment_type:h.payment_type,is_prorate:h.value.is_prorate,discount_amount:h.value.discount_amount})})})})},k=f=>{let h=f.discount_amount;return h>0?f.variation_title+" - "+(f.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")+" ( "+h+y.value+" discount )":f.variation_title+" - "+(f.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")};ue(()=>{P()});const O=()=>{if(r.value){const f=new URL(t.upgrade_path_base);return f.searchParams.append("order_hash",t.order.uuid),f.searchParams.append("mode","upgrade_plan"),f.searchParams.append("variation_id",r.value),f.href}return!1};return(f,h)=>{const x=m("el-button"),L=m("el-option"),F=m("el-select"),A=m("el-form-item"),J=m("el-dialog");return b.value.length>0&&S.value?(n(),_(U,{key:0},[e(x,{class:"el-button--x-small",onClick:w,type:"primary"},{default:s(()=>[D(o(f.$t("Change Plan")),1)]),_:1}),e(J,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=G=>i.value=G),title:f.$t("Change Plan"),"append-to-body":!0},{default:s(()=>[l("div",vl,[b.value.length>0?(n(),$(A,{key:0,label:f.$t("Change Plan to")},{default:s(()=>[e(F,{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=G=>r.value=G),onChange:T,clearable:""},{default:s(()=>[(n(!0),_(U,null,N(b.value,G=>(n(),$(L,{key:G.id,label:k(G),value:G.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):g("",!0),e(A,{label:f.$t("New Plan")},{default:s(()=>[c(C)?(n(),_("span",bl,[l("span",{innerHTML:c(C),class:"fct-plan-changer-text"},null,8,yl)])):(n(),_("span",wl,"---"))]),_:1},8,["label"]),e(A,{label:f.$t("Current Plan")},{default:s(()=>[l("span",{innerHTML:E(S.value),class:"fct-plan-changer-text"},null,8,kl)]),_:1},8,["label"]),O()?(n(),_("div",Ll,[e(x,{type:"primary",tag:"a",href:O(),target:"_blank",rel:"noopener noreferrer",size:"small"},{default:s(()=>[D(o(f.$t(" Upgrade to New Plan")),1)]),_:1},8,["href"]),e(me,{showMode:"basic_copy_btn",text:O()},null,8,["text"])])):g("",!0)])]),_:1},8,["modelValue","title"])],64)):g("",!0)}}},$l={name:"UpgradePlan",components:{CopyToClipboard:me,DynamicIcon:R},props:{variation_id:{type:[String,Number],required:!0},is_admin:{type:Boolean,required:!1,default:!1},product_id:{type:[String,Number],required:!0},order:{type:Object,required:!0},has_upgrades:{type:Boolean,required:!0},props_variations:{type:[Array,Object],required:!0},endpoint_path:{type:String,default:"products"},appendToBody:{type:Boolean,default:!0}},data(){return{variations:this.props_variations,upgradePlanModal:!1,selectedUpgradePath:"",upgradePaths:[]}},computed:{currencySign(){var a,t;return de.get("shop.currency_sign")?de.get("shop.currency_sign"):(t=(a=window.fluentcart_customer_profile_vars)==null?void 0:a.shop)!=null&&t.currency_sign?window.fluentcart_customer_profile_vars.shop.currency_sign:""}},methods:{translate:d,showUpgradePlanModal(){Ae.get(`${this.endpoint_path}/variation/${this.variation_id}/upgrade-paths`,{params:{variation_id:this.variation_id,order_hash:this.order.uuid}}).then(a=>{this.upgradePaths=a.upgradePaths,this.upgradePlanModal=!0})},closeUpgradePlanModal(){this.upgradePlanModal=!1}}},xl={class:"fct-upgrade-plan"},Sl={key:0,class:"fct-upgrade-variation-table"},Dl={class:"upgrade-title"},El={class:"plan-price"},Pl={class:"plan-price"},Vl={class:"upgrade-cost"},Al={class:"upgrade-title"},Tl=["innerHTML"],Ul={key:0,class:"upgrade-text"},Ml={class:"upgrade-action"},Il={key:1};function Ol(a,t,i,w,u,r){const b=m("el-button"),v=m("el-table-column"),y=m("el-table"),S=m("el-dialog");return n(),_("div",xl,[i.has_upgrades?(n(),$(b,{key:0,size:"small",onClick:r.showUpgradePlanModal},{default:s(()=>[D(o(a.$t("Upgrade")),1)]),_:1},8,["onClick"])):g("",!0),e(S,{modelValue:u.upgradePlanModal,"onUpdate:modelValue":t[0]||(t[0]=E=>u.upgradePlanModal=E),"append-to-body":i.appendToBody,title:a.$t("Upgrade"),class:"fct-upgrade-plan-dialog fluent-cart-customer-profile-app"},{default:s(()=>[u.upgradePaths.length>0?(n(),_("div",Sl,[e(y,{data:u.upgradePaths,style:{width:"100%"}},{default:s(()=>[e(v,{label:a.$t("Package"),width:290},{default:s(E=>[l("div",Dl,o(E.row.title),1)]),_:1},8,["label"]),e(v,{label:a.$t("Price"),width:100},{default:s(E=>[l("div",El,[l("div",Pl,o(a.formatNumber(E.row.price,i.order.currency)),1)])]),_:1},8,["label"]),e(v,{label:a.$t("Amount to pay")},{default:s(E=>[l("div",Vl,[l("div",Al,[l("span",{innerHTML:E.row.payment_summary},null,8,Tl),E.row.prorate_credit?(n(),_("div",Ul)):g("",!0)])])]),_:1},8,["label"]),e(v,{label:a.$t("Action"),width:110},{default:s(E=>[l("div",Ml,[e(b,{class:"el-button--x-small",tag:"a",href:E.row.upgrade_url,target:"_blank"},{default:s(()=>[D(o(a.$t("Upgrade")),1)]),_:2},1032,["href"])])]),_:1},8,["label"])]),_:1},8,["data"])])):(n(),_("div",Il,o(a.$t("No upgrade plan found")),1))]),_:1},8,["modelValue","append-to-body","title"])])}const Fl=W($l,[["render",Ol]]),Bl={name:"LicenseInformation",components:{Badge:H,CopyToClipboard:me,DynamicIcon:R,IconButton:_e,PlanChanger:Cl,UpgradePlan:Fl},props:{license:"license",customerId:"customerId",license_id:"license_id",activations:"activations",product:null,order:null,upgrade_path_base:""},data(){return{isDateSelected:!1,isCalendarOpen:!1,selectedDate:null,loading:!1,isConfirmationIconEnable:!1,limit:this.license.limit,variations:[],variation_id:this.license.variation_id+"",licenseLifetime:!1,isExpirationDateEnable:!1,isActivationLimitEnable:!1}},watch:{product:{handler(){var a;(a=this.product)!=null&&a.variants&&(this.variations=this.product.variants)},deep:!0,immediate:!0}},methods:{translate:d,formatDate:K,translateNumber:d,handleToggleExpirationDate(){this.isExpirationDateEnable=!this.isExpirationDateEnable},handleToggleActivationLimit(){this.isActivationLimitEnable=!this.isActivationLimitEnable},handleLifetimeLicense(){this.$confirm(this.$t("Are you sure you want to mark license as lifetime?"),this.$t("Confirm!"),{cancelButtonText:this.$t("No,Thanks"),confirmButtonText:this.$t("Confirm"),type:"warning"}).then(()=>{this.markAsLifetime()}).catch(()=>{this.licenseLifetime=!1})},handleActivationLimit(){this.$confirm(this.$t("Are you sure you want to mark limit as unlimited?"),this.$t("Confirm!"),{cancelButtonText:this.$t("No,Thanks"),confirmButtonText:this.$t("Confirm"),type:"warning"}).then(()=>{this.markAsUnlimited()}).catch(()=>{})},handleDateChange(){this.newExpirationDate=Z(this.selectedDate).format("YYYY-MM-DD HH:mm:ss"),this.extendValidity()},handleLimitChange(){this.isConfirmationIconEnable=!0},markAsLifetime(){this.licenseLifetime=!0,this.newExpirationDate="lifetime",this.extendValidity()},markAsUnlimited(){this.activationLimitUnlimited=!0,this.limit="unlimited",this.updateLimit()},regenerateLicenseKey(){this.$post("licensing/licenses/"+this.license_id+"/regenerate-key").then(a=>{this.$emit("fetchLicense"),this.handleSuccess(a.message)}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},extendValidity(){this.$post("licensing/licenses/"+this.license_id+"/extend-validity",{expiration_date:this.newExpirationDate}).then(a=>{this.newExpirationDate=null,this.$emit("fetchLicense"),this.handleSuccess(a.message),this.selectedDate=null,this.licenseLifetime=!0}).catch(a=>{this.handleError(a),this.licenseLifetime=!1}).finally(()=>{this.loading=!1})},updateLimit(){this.$post("licensing/licenses/"+this.license_id+"/update_limit",{limit:this.limit}).then(a=>{this.$emit("fetchLicense"),this.handleSuccess(a.message),this.isConfirmationIconEnable=!1}).catch(a=>{this.handleError(a),this.isConfirmationIconEnable=!1}).finally(()=>{this.loading=!1})},resetLimit(){this.limit=this.license.limit,this.isConfirmationIconEnable=!1}},mounted(){var t;const a=(t=this.$refs.calendar)==null?void 0:t.$el.querySelector("input");a&&a.addEventListener("keydown",i=>{i.key==="Enter"&&this.handleDateChange()})}},Nl={class:"fct-license-info-content"},Rl={class:"flex items-center gap-2"},jl={class:"fct-input-with-action-wrap"},zl={class:"fct-input-with-action"},Hl={class:"fct-license-product"},ql={class:"text-xs"},Yl={class:"fct-license-inline-action-wrap"},Kl={key:1,class:"text"},Wl={key:2,class:"separator"},Gl={class:"inline-action-button"},Xl={class:"text"},Zl={class:"fct-license-inline-action-wrap"},Jl={key:0,class:"inline-action-input-group mr-2"},Ql={key:0,class:"fct-license-activation-limit-actions"},ea={key:1,class:"text"},ta={key:2,class:"separator"},sa={class:"inline-action-button"},la={class:"text"},aa={class:"fct-license-info-form-show-on-mobile"},na={class:"fct-license-info-mobile-header"},ia={class:"fct-license-info-mobile-body"},oa={key:0,class:"fct-license-product"},ra={class:"text-xs text-system-mid dark:text-gray-300"},ca={class:"fct-input-with-action-wrap"},da={class:"fct-input-with-action"},ua={class:"fct-input-with-action-icon"},_a={class:"fct-license-info-mobile-footer"},ma={class:"fct-license-info-mobile-footer-item"},pa={class:"title"},ha={class:"fct-license-inline-action-wrap"},fa={key:1,class:"text"},ga={key:2,class:"separator"},va={class:"inline-action-button"},ba={class:"text"},ya={class:"fct-license-info-mobile-footer-item"},wa={class:"title"},ka={class:"fct-license-inline-action-wrap"},La={key:0,class:"inline-action-input-group mr-2"},Ca={key:0,class:"fct-license-activation-limit-actions"},$a={key:1,class:"text"},xa={key:2,class:"separator"},Sa={class:"inline-action-button"},Da={class:"text"};function Ea(a,t,i,w,u,r){var F,A,J,G,fe,ge,ve,be;const b=m("CopyToClipboard"),v=m("el-input"),y=m("DynamicIcon"),S=m("el-button"),E=m("el-popconfirm"),C=m("el-form-item"),T=m("el-col"),p=m("router-link"),P=m("UpgradePlan"),k=m("el-date-picker"),O=m("el-input-number"),f=m("IconButton"),h=m("el-row"),x=m("el-form"),L=m("Badge");return n(),_("div",Nl,[e(x,{class:"fct-license-info-form-hide-on-mobile",model:i.license,"label-position":"top"},{default:s(()=>[e(h,null,{default:s(()=>[e(T,{lg:24},{default:s(()=>[e(C,{label:""},{label:s(()=>[l("div",Rl,[D(o(r.translate("License Key"))+" ",1),e(b,{text:i.license.license_key,showMode:"basic_copy_btn",tooltipText:r.translate("Copy License")},null,8,["text","tooltipText"])])]),default:s(()=>[l("div",jl,[e(v,{modelValue:i.license.license_key,"onUpdate:modelValue":t[0]||(t[0]=V=>i.license.license_key=V),disabled:""},null,8,["modelValue"]),l("div",zl,[e(E,{width:"250","confirm-button-text":r.translate("Confirm"),"cancel-button-text":r.translate("No, Thanks"),title:r.translate("Are you sure to regenerate?"),onConfirm:r.regenerateLicenseKey},{reference:s(()=>[e(S,{class:"el-button--x-small",plain:""},{default:s(()=>[e(y,{name:"Reload"}),D(" "+o(r.translate("Regenerate")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),_:1})]),_:1}),e(T,{lg:24},{default:s(()=>[i.product!=null?(n(),$(C,{key:0,label:r.translate("Product Name")},{default:s(()=>{var V;return[l("div",Hl,[e(p,{class:"link",to:{name:"product_edit",params:{product_id:i.product.ID}}},{default:s(()=>{var Q;return[D(o(i.product.post_title)+" ",1),l("span",ql," – "+o((Q=u.variations.find(ie=>ie.id==i.license.variation_id))==null?void 0:Q.variation_title),1)]}),_:1},8,["to"]),((V=u.variations)==null?void 0:V.length)>0?(n(),$(P,{key:0,variation_id:u.variation_id,product_id:i.product.ID,order:i.order,props_variations:u.variations,endpoint_path:"products",has_upgrades:i.license.has_upgrades&&!["expired","disabled"].includes(i.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):g("",!0)])]}),_:1},8,["label"])):g("",!0)]),_:1}),e(T,{lg:12},{default:s(()=>[e(C,{label:r.translate("Purchase Date")},{default:s(()=>{var V;return[l("span",null,o(r.formatDate((V=i.license)==null?void 0:V.created_at)),1)]}),_:1},8,["label"])]),_:1}),e(T,{lg:12},{default:s(()=>[e(C,{label:r.translate("Expirations date")},{default:s(()=>{var V,Q,ie,ye,we,ke;return[l("div",Yl,[u.isExpirationDateEnable?(n(),$(k,{key:0,modelValue:u.selectedDate,"onUpdate:modelValue":t[1]||(t[1]=ae=>u.selectedDate=ae),placeholder:r.formatDate((V=i.license)==null?void 0:V.expiration_date)?r.formatDate((Q=i.license)==null?void 0:Q.expiration_date):r.translate("Lifetime"),"default-value":(ie=i.license)==null?void 0:ie.expiration_date,type:"date",ref:"calendar",onChange:r.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(n(),_("span",Kl,o((ye=i.license)!=null&&ye.expiration_date?r.formatDate((we=i.license)==null?void 0:we.expiration_date):"Lifetime"),1)),u.isExpirationDateEnable?g("",!0):(n(),_("span",Wl)),l("div",Gl,[l("a",{href:"#",onClick:t[2]||(t[2]=q((...ae)=>r.handleToggleExpirationDate&&r.handleToggleExpirationDate(...ae),["prevent"]))},o(u.isExpirationDateEnable?r.translate("Cancel"):r.translate("Edit")),1),!u.isExpirationDateEnable&&((ke=i.license)!=null&&ke.expiration_date)?(n(),_(U,{key:0},[l("span",Xl,o(r.translate("or")),1),l("a",{href:"#",onClick:t[3]||(t[3]=q((...ae)=>r.handleLifetimeLicense&&r.handleLifetimeLicense(...ae),["prevent"]))},o(r.translate("Mark as lifetime")),1)],64)):g("",!0)])])]}),_:1},8,["label"])]),_:1}),e(T,{lg:12},{default:s(()=>[e(C,{label:r.translate("Activation Limit")},{default:s(()=>[l("div",Zl,[u.isActivationLimitEnable?(n(),_("div",Jl,[e(O,{modelValue:u.limit,"onUpdate:modelValue":t[4]||(t[4]=V=>u.limit=V),min:0,"controls-position":"right",onChange:r.handleLimitChange,onKeyup:r.handleLimitChange},{"decrease-icon":s(()=>[e(y,{class:"w-3",name:"ChevronDown"})]),"increase-icon":s(()=>[e(y,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),u.isConfirmationIconEnable?(n(),_("div",Ql,[e(f,{tag:"button",onClick:q(r.updateLimit,["prevent"])},{default:s(()=>[e(y,{name:"Check"})]),_:1},8,["onClick"]),e(f,{tag:"button",onClick:q(r.resetLimit,["prevent"])},{default:s(()=>[e(y,{name:"Cross"})]),_:1},8,["onClick"])])):g("",!0)])):g("",!0),u.isActivationLimitEnable?g("",!0):(n(),_("span",ea,o(r.translateNumber(i.license.activation_count))+" / "+o(u.limit!=0?u.limit:r.translate("Unlimited")),1)),u.isActivationLimitEnable?g("",!0):(n(),_("span",ta)),l("div",sa,[l("a",{href:"#",onClick:t[5]||(t[5]=q((...V)=>r.handleToggleActivationLimit&&r.handleToggleActivationLimit(...V),["prevent"]))},o(u.isActivationLimitEnable?r.translate("Cancel"):r.translate("Edit")),1),!u.isActivationLimitEnable&&u.limit!=0?(n(),_(U,{key:0},[l("span",la,o(r.translate("or")),1),l("a",{href:"#",onClick:t[6]||(t[6]=q((...V)=>r.handleActivationLimit&&r.handleActivationLimit(...V),["prevent"]))},o(r.translate("Mark as unlimited")),1)],64)):g("",!0)])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["model"]),l("div",aa,[l("div",na,[e(L,{status:i.license.status,size:"small"},null,8,["status"]),l("span",null,o(r.translate("Purchase Date"))+": "+o(r.formatDate((F=i.license)==null?void 0:F.created_at)),1)]),l("div",ia,[i.product!=null?(n(),_("div",oa,[e(p,{class:"link",to:{name:"product_edit",params:{product_id:i.product.ID}}},{default:s(()=>{var V;return[D(o(i.product.post_title)+" ",1),l("span",ra," – "+o((V=u.variations.find(Q=>Q.id==i.license.variation_id))==null?void 0:V.variation_title),1)]}),_:1},8,["to"]),((A=u.variations)==null?void 0:A.length)>0?(n(),$(P,{key:0,variation_id:u.variation_id,product_id:i.product.ID,order:i.order,props_variations:u.variations,endpoint_path:"products",has_upgrades:i.license.has_upgrades&&!["expired","disabled"].includes(i.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):g("",!0)])):g("",!0),l("div",ca,[e(v,{modelValue:i.license.license_key,"onUpdate:modelValue":t[7]||(t[7]=V=>i.license.license_key=V),readonly:""},null,8,["modelValue"]),l("div",da,[e(E,{width:"250","confirm-button-text":r.translate("Confirm"),"cancel-button-text":r.translate("No, Thanks"),title:r.translate("Are you sure to regenerate?"),onConfirm:r.regenerateLicenseKey},{reference:s(()=>[l("div",ua,[e(y,{name:"Reload"})])]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),l("div",_a,[l("div",ma,[l("div",pa,o(r.translate("Expirations date")),1),l("div",ha,[u.isExpirationDateEnable?(n(),$(k,{key:0,modelValue:u.selectedDate,"onUpdate:modelValue":t[8]||(t[8]=V=>u.selectedDate=V),placeholder:r.formatDate((J=i.license)==null?void 0:J.expiration_date)?r.formatDate((G=i.license)==null?void 0:G.expiration_date):r.translate("Lifetime"),"default-value":(fe=i.license)==null?void 0:fe.expiration_date,type:"date",ref:"calendar",onChange:r.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(n(),_("span",fa,o((ge=i.license)!=null&&ge.expiration_date?r.formatDate((ve=i.license)==null?void 0:ve.expiration_date):"Lifetime"),1)),u.isExpirationDateEnable?g("",!0):(n(),_("span",ga)),l("div",va,[l("a",{href:"#",onClick:t[9]||(t[9]=q((...V)=>r.handleToggleExpirationDate&&r.handleToggleExpirationDate(...V),["prevent"]))},o(u.isExpirationDateEnable?r.translate("Cancel"):r.translate("Edit")),1),!u.isExpirationDateEnable&&((be=i.license)!=null&&be.expiration_date)?(n(),_(U,{key:0},[l("span",ba,o(r.translate("or")),1),l("a",{href:"#",onClick:t[10]||(t[10]=q((...V)=>r.handleLifetimeLicense&&r.handleLifetimeLicense(...V),["prevent"]))},o(r.translate("Mark as lifetime")),1)],64)):g("",!0)])])]),l("div",ya,[l("div",wa,o(r.translate("Activation Limit")),1),l("div",ka,[u.isActivationLimitEnable?(n(),_("div",La,[e(O,{modelValue:u.limit,"onUpdate:modelValue":t[11]||(t[11]=V=>u.limit=V),min:0,"controls-position":"right",onChange:r.handleLimitChange,onKeyup:r.handleLimitChange},{"decrease-icon":s(()=>[e(y,{class:"w-3",name:"ChevronDown"})]),"increase-icon":s(()=>[e(y,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),u.isConfirmationIconEnable?(n(),_("div",Ca,[e(f,{tag:"button",onClick:q(r.updateLimit,["prevent"])},{default:s(()=>[e(y,{name:"Check"})]),_:1},8,["onClick"]),e(f,{tag:"button",onClick:q(r.resetLimit,["prevent"])},{default:s(()=>[e(y,{name:"Cross"})]),_:1},8,["onClick"])])):g("",!0)])):g("",!0),u.isActivationLimitEnable?g("",!0):(n(),_("span",$a,o(r.translateNumber(i.license.activation_count))+" / "+o(u.limit!=0?u.limit:r.translate("Unlimited")),1)),u.isActivationLimitEnable?g("",!0):(n(),_("span",xa)),l("div",Sa,[l("a",{href:"#",onClick:t[12]||(t[12]=q((...V)=>r.handleToggleActivationLimit&&r.handleToggleActivationLimit(...V),["prevent"]))},o(u.isActivationLimitEnable?r.translate("Cancel"):r.translate("Edit")),1),!u.isActivationLimitEnable&&u.limit!=0?(n(),_(U,{key:0},[l("span",Da,o(r.translate("or")),1),l("a",{href:"#",onClick:t[13]||(t[13]=q((...V)=>r.handleActivationLimit&&r.handleActivationLimit(...V),["prevent"]))},o(r.translate("Mark as unlimited")),1)],64)):g("",!0)])])])])])])}const Pa=W(Bl,[["render",Ea]]),Va={name:"ActivatedSiteInformation",props:["activatedSites","modelValue","activationLimit","activationCount"],computed:{Link(){return Ke}},components:{IconButton:_e,DynamicIcon:R,Badge:H,Empty:le},methods:{formatDate:K,updateModelValue(a){this.$emit("update:modelValue",a)},activateSite(){this.$emit("siteActivated")},deactivateSite(a){this.$emit("siteDeactivated",a)}}},Aa={class:"fct-activated-site-url-container grid gap-5"},Ta={key:0,class:"-mx-6 -mb-6 fct-license-site-url-table-wrap"},Ua={key:1};function Ma(a,t,i,w,u,r){const b=m("router-link"),v=m("Badge"),y=m("el-table-column"),S=m("DynamicIcon"),E=m("IconButton"),C=m("el-popconfirm"),T=m("el-table"),p=m("Empty");return n(),_("div",Aa,[i.activatedSites.length>0?(n(),_("div",Ta,[e(T,{data:i.activatedSites,class:"w-full"},{default:s(()=>[e(y,{label:a.$t("Site URL"),width:"360"},{default:s(P=>[P.row.site_id?(n(),$(b,{key:0,class:"link",to:{name:"view_site",params:{site_id:P.row.site_id}}},{default:s(()=>[D(o(P.row.site_url),1)]),_:2},1032,["to"])):(n(),_("span",Ua,o(P.row.site_url),1)),P.row.is_local&&P.row.is_local!="0"?(n(),$(v,{key:2,status:"warning",size:"small","hide-icon":!0,text:a.$t("local"),style:{"margin-left":"10px"}},null,8,["text"])):g("",!0)]),_:1},8,["label"]),e(y,{label:a.$t("Status"),width:"100"},{default:s(P=>[e(v,{status:P.row.status,size:"small"},null,8,["status"])]),_:1},8,["label"]),e(y,{label:a.$t("Activated at"),width:"140"},{default:s(P=>[l("span",null,o(r.formatDate(P.row.created_at)),1)]),_:1},8,["label"]),e(y,{width:"100"},{default:s(P=>[l("span",null,[e(C,{width:"200","confirm-button-text":a.$t("Confirm"),"cancel-button-text":a.$t("No, Thanks"),title:a.$t("Are you sure?"),onConfirm:k=>r.deactivateSite(P.row.id)},{reference:s(()=>[e(E,{tag:"a",size:"x-small",class:"ml-auto",hover:"danger"},{default:s(()=>[e(S,{name:"TrashIcon"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])])):(n(),$(p,{key:1,icon:"Empty/ListView","has-dark":!0,text:a.$t("No activated sites found")},null,8,["text"]))])}const Ia=W(Va,[["render",Ma]]),Oa={class:"fct-single-customer-loader-wrap fct-layout-width"},Fa={class:"single-page-header fct-page-loader-header flex items-start justify-between"},Ba={class:"single-page-body"},Na={class:"fct-single-order"},Ra={class:"fct-single-order-main"},ja={class:"grid gap-5 grid-cols-[repeat(auto-fit,minmax(200px,1fr))]"},za={class:"fct-single-order-aside"},Ha={class:"fct-admin-sidebar"},qa={__name:"SingleLicenseLoader",setup(a){return(t,i)=>{const w=m("el-skeleton-item"),u=m("el-skeleton");return n(),_("div",Oa,[l("div",Fa,[e(u,{animated:"",class:"flex items-start gap-2"},{template:s(()=>[(n(),_(U,null,N(3,r=>e(w,{key:r,class:"max-w-[100px]"})),64))]),_:1})]),l("div",Ba,[l("div",Na,[l("div",Ra,[e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Manage License Details")},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5"},{template:s(()=>[e(w,{variant:"p",class:"w-full"}),e(w,{variant:"p",style:{width:"50%"}})]),_:1}),l("div",ja,[(n(),_(U,null,N(6,r=>e(u,{key:r,animated:!0},{template:s(()=>[l("div",null,[e(w,{variant:"p",class:"w-full"}),e(w,{variant:"p",style:{width:"50%"}})])]),_:2},1024)),64))])]),_:1})]),_:1}),e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Related Orders")},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5",rows:2})]),_:1})]),_:1}),e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Activated Sites")},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5",rows:3})]),_:1})]),_:1})]),l("div",za,[l("div",Ha,[e(I,null,{default:s(()=>[e(B,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:"",rows:6})]),_:1})]),_:1}),e(I,null,{default:s(()=>[e(B,{title:t.$t("Actions"),border_bottom:"",title_size:"small"},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:""},{template:s(()=>[e(w,{variant:"p",class:"w-1/2"})]),_:1})]),_:1})]),_:1}),e(I,null,{default:s(()=>[e(B,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),e(M,null,{default:s(()=>[e(u,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},Ya={key:2,class:"fct-view-license-wrap fct-layout-width"},Ka={class:"single-page-header"},Wa={class:"flex items-center gap-3 flex-wrap whitespace-pre-wrap",style:{"overflow-wrap":"anywhere"}},Ga={class:"license-breadcrumb-only-mobile"},Xa={class:"single-page-body"},Za={class:"fct-view-license-content-wrap"},Ja={class:"more-btn"},Qa={class:"fct-related-license-content"},en={class:"fct-license-related-orders-show-on-mobile fct-table-mobile-wrap"},tn={class:"fct-table-mobile-header"},sn={class:"fct-table-date-col"},ln={class:"fct-table-price-col"},an={class:"fct-table-mobile-footer"},nn={class:"fct-table-mobile-footer-row"},on={class:"title"},rn={class:"fct-table-status-col flex items-center gap-1"},cn={class:"title"},dn={class:"value capitalize"},un={class:"fct-related-license-content"},_n={class:"value-column-with-space",style:{"max-height":"500px","overflow-y":"auto"}},mn=["innerHTML"],pn={class:"fct-admin-sidebar"},hn={class:"fct-admin-sidebar-item"},fn={class:"fct-lists"},gn={class:"!mb-0"},vn={name:"ViewLicense",components:{OrderUpDownIndicator:oe},props:["license_id"],data(){return{changes_made:0,isDateSelected:!1,isCalendarOpen:!1,activeTab:"license",activeMenu:"details",license:null,order:null,selectedDate:null,orders:[],prevOrders:[],activations:[],loading:!0,saving:!1,limit:null,site_url:null,upgrade_path_base:"",showConfirmationIcons:!1,customerId:null,activatedSites:[],logs:[],selectedLabels:[],renewalNoticeValue:"",renewalNoticeOptions:[{value:"option1",label:"Need to connect backend"},{value:"option2",label:"Need to connect backend"}],product:{},notFound:{show:!1,message:"",buttonText:"",route:""}}},watch:{license:{handler(){this.changes_made++},deep:!0,immediate:!0},product:{handler(){var a;(a=this.product)!=null&&a.variants&&(this.variations=this.product.variants)},deep:!0,immediate:!0},license_id:{handler(a,t){this.fetchLicense()}}},methods:{handleLicenseCommand(a){a==="delete_license"&&this.$confirm("Are you sure you want to delete this license?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteLicense()}).catch(()=>{})},deleteLicense(){this.$del(`licensing/licenses/${this.license_id}/delete`).then(a=>{this.handleSuccess(a.message),this.$router.push({name:"licenses"})}).catch(a=>{this.handleError(a)})},updateUrl(a,t){this.activatedSites[a]=t},activateSite(){Qe(this.site_url)?this.$post("licensing/licenses/"+this.license_id+"/activate_site",{url:this.site_url}).then(t=>{if(this.fetchLicense(),this.site_url=null,t.success)this.handleSuccess("Site activated successfully!");else{let i=t.error??"An error occurred while activating the site";this.handleError(i)}}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1}):this.handleError("Enter a valid site URL")},deactivateSite(a){this.$post("licensing/licenses/"+this.license_id+"/deactivate_site",{activation_id:a}).then(t=>{this.fetchLicense(),this.handleSuccess(t.message)}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})},fetchLicense(){this.loading=!0,this.notFound.show=!1,this.$get("licensing/licenses/"+this.license_id).then(a=>{var t,i;this.license=a.license,this.order=a.order,this.order.customer=(t=this.license)==null?void 0:t.customer,this.upgrade_path_base=a.upgrade_path_base,this.orders=a.orders,this.activations=a.activations,this.limit=this.license.limit,this.customerId=(i=this.license.customer)==null?void 0:i.id,this.product=a.product,this.selectedLabels=a.selected_labels,this.prevOrders=a.prev_orders,this.activatedSites=this.activations.map(w=>{var u,r;return{id:w.id,site_id:w.site_id,site_url:(u=w.site)==null?void 0:u.site_url,created_at:(r=w.site)==null?void 0:r.created_at,status:w.status,is_local:w.is_local}}).sort((w,u)=>u.id-w.id)}).catch(a=>{a&&((a==null?void 0:a.code)==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=te.get(a,"data.buttonText"),this.notFound.message=te.get(a,"data.message"),this.notFound.route=te.get(a,"data.route")):this.handleError(a))}).finally(()=>{this.loading=!1})},fetchLicenseMeta(){this.$get("licensing/licenses/meta/"+this.license_id).then(a=>{this.logs=a}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1})},updateLicenseStatus(a){this.$post("licensing/licenses/"+this.license_id+"/update_status",{status:a}).then(t=>{this.license&&(this.license.status=a),this.$emit("fetchLicense"),this.handleSuccess(t.message),this.fetchLicense()}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})},getCustomerTotalOrders(a){return a>0?a+" "+(a==1?d("order"):d("orders")):d("No orders")},handleMenuClick(a){this.activeMenu=a},discard(){return window.location.reload()}},mounted(){this.fetchLicense()}},bn=Object.assign(vn,{setup(a){return(t,i)=>{var f;const w=m("el-breadcrumb-item"),u=m("el-breadcrumb"),r=m("router-link"),b=m("el-dropdown-item"),v=m("el-dropdown-menu"),y=m("el-dropdown"),S=m("el-table-column"),E=m("el-table"),C=m("el-timeline-item"),T=m("el-timeline"),p=m("el-col"),P=m("el-button"),k=m("el-popconfirm"),O=m("el-row");return n(),_("div",null,[t.loading?(n(),$(qa,{key:0})):g("",!0),t.notFound.show?(n(),$(Pe,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):g("",!0),t.notFound.show===!1?(n(),_("div",Ya,[t.loading?g("",!0):(n(),_(U,{key:0},[t.license?(n(),_(U,{key:0},[l("div",Ka,[e(u,{class:"hide-license-breadcrumb-on-mobile","separator-icon":c(he)},{default:s(()=>[e(w,{to:{name:"licenses"}},{default:s(()=>[D(o(c(d)("Licenses")),1)]),_:1}),e(w,null,{default:s(()=>{var h;return[l("div",Wa,[D(o((h=t.license)==null?void 0:h.license_key)+" ",1),e(H,{status:t.license.status,size:"small"},null,8,["status"])])]}),_:1})]),_:1},8,["separator-icon"]),l("ul",Ga,[l("li",null,[e(r,{to:{name:"licenses"}},{default:s(()=>[e(R,{name:"ArrowLeft",class:"cursor-pointer"})]),_:1})]),l("li",null,o((f=t.license)==null?void 0:f.license_key),1)])]),l("div",Xa,[e(O,{gutter:30},{default:s(()=>[e(p,{lg:17},{default:s(()=>[l("div",Za,[e(I,null,{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:c(d)("License Details")},{action:s(()=>[e(y,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleLicenseCommand,placement:"bottom-end"},{dropdown:s(()=>[e(v,null,{default:s(()=>[e(b,{command:"delete_license",class:"item-destructive"},{default:s(()=>[e(R,{name:"Delete"}),D(" "+o(c(d)("Delete License")),1)]),_:1})]),_:1})]),default:s(()=>[l("span",Ja,[e(R,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),e(M,null,{default:s(()=>[e(Pa,{license:t.license,customerId:t.customerId,license_id:a.license_id,activations:t.activations,product:t.product,order:t.order,upgrade_path_base:t.upgrade_path_base,onFetchLicense:t.fetchLicense},null,8,["license","customerId","license_id","activations","product","order","upgrade_path_base","onFetchLicense"])]),_:1})]),_:1}),e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:c(d)("Related Orders"),title_size:"small"},null,8,["title"]),e(M,{class:"px-0 pb-0"},{default:s(()=>[l("div",Qa,[e(E,{data:t.orders,class:"w-full fct-license-related-orders-hide-on-mobile"},{default:s(()=>[e(S,{width:120,label:c(d)("ID")},{default:s(h=>[e(r,{class:"link",to:{name:"view_order",params:{order_id:h.row.id}}},{default:s(()=>[D(" #"+o(c(d)(h.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(S,{width:120,label:c(d)("Amount")},{default:s(h=>[l("span",null,o(t.formatNumber(h.row.total_paid)),1)]),_:1},8,["label"]),e(S,{width:150,label:c(d)("Date"),prop:"created_at"},{default:s(h=>[l("span",null,o(c(K)(h.row.created_at)),1)]),_:1},8,["label"]),e(S,{label:c(d)("Payment Method")},{default:s(h=>[D(o(h.row.payment_method),1)]),_:1},8,["label"]),e(S,{label:c(d)("Status")},{default:s(h=>[e(H,{type:h.row.payment_status},{default:s(()=>[D(o(h.row.payment_status),1)]),_:2},1032,["type"]),e(H,{style:{"margin-left":"5px","margin-right":"5px"},type:h.row.type},{default:s(()=>[D(o(h.row.type),1)]),_:2},1032,["type"]),e(oe,{order:h.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"]),l("div",en,[(n(!0),_(U,null,N(t.orders,(h,x)=>(n(),_("div",{key:x,class:"fct-table-mobile-row"},[l("div",tn,[l("div",sn,[D(o(c(K)(h.created_at))+" ",1),i[4]||(i[4]=l("div",{class:"bullet"},"•",-1)),e(r,{class:"link",to:{name:"view_order",params:{order_id:h.id}}},{default:s(()=>[D(" #"+o(h.id),1)]),_:2},1032,["to"])]),l("div",ln,o(t.formatNumber(h.total_paid)),1)]),l("div",an,[l("div",nn,[l("div",null,[l("div",on,o(c(d)("Status")),1),l("div",rn,[e(H,{type:h.payment_status},{default:s(()=>[D(o(h.payment_status),1)]),_:2},1032,["type"]),e(H,{type:h.type},{default:s(()=>[D(o(h.type),1)]),_:2},1032,["type"]),e(oe,{order:h},null,8,["order"])])]),l("div",null,[l("div",cn,o(c(d)("Payment Method")),1),l("div",dn,o(h.payment_method),1)])])])]))),128))])])]),_:1})]),_:1}),t.prevOrders&&t.prevOrders.length?(n(),$(I,{key:0,class:"overflow-hidden"},{default:s(()=>[e(B,{title:c(d)("Previous Orders"),title_size:"small"},null,8,["title"]),e(M,{class:"px-0 pb-0"},{default:s(()=>[l("div",un,[e(E,{data:t.prevOrders,class:"w-full"},{default:s(()=>[e(S,{width:120,label:c(d)("ID")},{default:s(h=>[e(r,{class:"link",to:{name:"view_order",params:{order_id:h.row.id}}},{default:s(()=>[D(" #"+o(c(d)(h.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(S,{width:120,label:c(d)("Amount")},{default:s(h=>[l("span",null,o(t.formatNumber(h.row.total_paid)),1)]),_:1},8,["label"]),e(S,{width:150,label:c(d)("Date"),prop:"created_at"},{default:s(h=>[l("span",null,o(c(K)(h.row.created_at)),1)]),_:1},8,["label"]),e(S,{label:c(d)("Status")},{default:s(h=>[e(H,{type:h.row.payment_status},{default:s(()=>[D(o(h.row.payment_status),1)]),_:2},1032,["type"]),e(H,{style:{"margin-left":"5px","margin-right":"5px"},type:h.row.type},{default:s(()=>[D(o(h.row.type),1)]),_:2},1032,["type"]),e(oe,{order:h.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1})):g("",!0),e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:c(d)("Activated Sites"),title_size:"small",border_bottom:""},null,8,["title"]),e(M,null,{default:s(()=>[e(Ia,{modelValue:t.site_url,"onUpdate:modelValue":i[0]||(i[0]=h=>t.site_url=h),onSiteActivated:t.activateSite,onSiteDeactivated:t.deactivateSite,activatedSites:t.activatedSites,activationLimit:t.limit,activationCount:t.activations.length},null,8,["modelValue","onSiteActivated","onSiteDeactivated","activatedSites","activationLimit","activationCount"])]),_:1})]),_:1}),t.logs.length>0?(n(),$(I,{key:1},{default:s(()=>[e(M,null,{default:s(()=>[l("div",_n,[e(T,{style:{"padding-left":"2px"}},{default:s(()=>[(n(!0),_(U,null,N(t.logs,h=>{var x;return n(),$(C,{key:h,timestamp:c(Z)((x=t.license)==null?void 0:x.updated_at).format("MMMM DD, YYYY"),placement:"top",color:"blue"},{default:s(()=>[l("div",{innerHTML:h.meta_value},null,8,mn)]),_:2},1032,["timestamp"])}),128))]),_:1})])]),_:1})]),_:1})):g("",!0)])]),_:1}),e(p,{lg:7},{default:s(()=>[l("div",pn,[e(Xe,{order:t.order,shouldEnableEditing:!0,onOnAddressSelected:i[1]||(i[1]=h=>{h.type==="shipping"?t.order.shipping_address_id=h.id:t.order.billing_address_id=h.id})},null,8,["order"]),e(I,null,{default:s(()=>[e(B,{title:c(d)("Actions"),title_size:"small",border_bottom:""},null,8,["title"]),e(M,null,{default:s(()=>[l("div",hn,[l("ul",fn,[l("li",gn,[t.license.status!=="disabled"?(n(),$(k,{key:0,width:"210","confirm-button-text":c(d)("Confirm"),"cancel-button-text":c(d)("No, Thanks"),title:c(d)("Are you sure?"),onConfirm:i[2]||(i[2]=h=>t.updateLicenseStatus("disabled"))},{reference:s(()=>[e(P,{text:"",class:"!text-red-500 !mt-0"},{default:s(()=>[D(o(c(d)("Disable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):g("",!0),t.license.status==="disabled"?(n(),$(k,{key:1,width:"210","confirm-button-text":c(d)("Confirm"),"cancel-button-text":c(d)("No, Thanks"),title:c(d)("Are you sure?"),onConfirm:i[3]||(i[3]=h=>t.updateLicenseStatus("active"))},{reference:s(()=>[e(P,{text:"",class:"!text-primary-500 !mt-0"},{default:s(()=>[D(o(c(d)("Enable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):g("",!0)])])])]),_:1})]),_:1}),t.loading?g("",!0):(n(),$(Ze,{key:0,"bind-to-id":t.license.id,"bind-to-type":"FluentCartPro\\App\\Modules\\Licensing\\Models\\License",selectedLabels:t.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]))])]),_:1})]),_:1})])],64)):g("",!0)],64))])):g("",!0)])}}}),yn={class:"heading-wrap"},wn={class:"title"},kn={key:0,class:"heading-action"},Ln={__name:"Heading",props:{title:String},setup(a){const t=Oe();return(i,w)=>(n(),_("div",yn,[l("h2",wn,o(a.title),1),c(t).actions?(n(),_("div",kn,[Fe(i.$slots,"actions")])):g("",!0)]))}},Cn={name:"AllLicenses",components:{Pagination:Re,Heading:Ln},data(){return{licenses:[],paginate:{per_page:10,current_page:1,total:0,last_page:1},loading:!1,is_loaded:!1,search:""}},methods:{fetch(){this.loading=!0,this.$get("licensing/licenses/customer/1",{page:this.paginate.current_page,per_page:this.paginate.per_page,search:this.search}).then(a=>{this.licenses=a.licenses.data,this.paginate.total=a.licenses.total,this.paginate.last_page=a.licenses.last_page}).catch(a=>{this.handleError(a)}).finally(()=>{this.loading=!1,this.is_loaded=!0})},getProductName(a){return a?(a==null?void 0:a.product.post_title)+" - "+a.variation_label:"n/a"},onCurrentPageChanged({page:a,currentPageCount:t}){this.paginate.current_page=a,this.fetch()},onPerPageChanged(a){this.paginate.per_page=a,this.fetch()}},mounted(){this.fetch()}},$n={class:"all_licenses"},xn={class:"bg-white dark:bg-dark-700"},Sn={key:0},Dn={key:1},En={class:"py-2.5 px-7.5 dark:bg-gray-800"},Pn={class:"flex justify-between"},Vn={class:"flex items-center gap-2"};function An(a,t,i,w,u,r){const b=m("Heading"),v=m("router-link"),y=m("el-table-column"),S=m("el-table"),E=m("pagination");return n(),_("div",$n,[e(b,{title:"All Licenses"}),l("div",xn,[e(S,{stripe:"",data:u.licenses},{default:s(()=>[e(y,{label:"ID",width:100},{default:s(C=>[e(v,{to:{name:"view_license",params:{license_id:C.row.id}}},{default:s(()=>[D(" #"+o(C.row.id),1)]),_:2},1032,["to"])]),_:1}),e(y,{width:290,label:"License Key"},{default:s(C=>[e(v,{to:{name:"view_license",params:{license_id:C.row.id}}},{default:s(()=>[D(o(C.row.license_key),1)]),_:2},1032,["to"])]),_:1}),e(y,{width:100,label:"Status"},{default:s(C=>[l("span",null,o(C.row.status),1)]),_:1}),e(y,{"min-width":300,label:"Product"},{default:s(C=>[D(o(r.getProductName(C.row.product_details)),1)]),_:1}),e(y,{"min-width":120,label:"Customer"},{default:s(C=>[e(v,{to:{name:"view_customer",params:{customer_id:C.row.customer_id}}},{default:s(()=>{var T;return[D(o(((T=C.row)==null?void 0:T.customer.full_name)||"No Customer Found"),1)]}),_:2},1032,["to"])]),_:1}),e(y,{width:120,label:"Activations"},{default:s(C=>[D(o(C.row.activation_count)+" / "+o(C.row.limit||"Unlimited"),1)]),_:1}),e(y,{width:160,label:"Expires"},{default:s(C=>[C.row.expiration_date?(n(),_("span",Sn,o(C.row.expiration_date),1)):(n(),_("span",Dn,"Lifetime"))]),_:1}),e(y,{width:160,label:"Purchased"},{default:s(C=>[e(v,{to:{name:"view_order",params:{order_id:C.row.order_id}}},{default:s(()=>[D(o(C.row.created_at),1)]),_:2},1032,["to"])]),_:1})]),_:1},8,["data"]),l("div",En,[l("div",Pn,[l("div",Vn,[e(E,{"pager-only":!0,hide_on_single:!1,pagination:u.paginate,onFetch:r.fetch,onCurrentPageChanged:r.onCurrentPageChanged,onOnPerPageChanged:r.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),e(E,{hide_on_single:!1,pagination:u.paginate,onFetch:r.fetch,onCurrentPageChanged:r.onCurrentPageChanged,onOnPerPageChanged:r.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])])])])])}const Tn=W(Cn,[["render",An]]);class Un extends De{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="id"}getTabs(){return{}}getToggleableColumns(){return[{label:d("Active Licenses"),value:"active_licenses"},{label:d("Products"),value:"products"},{label:d("Customer"),value:"customer"},{label:d("Last Activity"),value:"last_activity"},{label:d("Created At"),value:"created_at"}]}getSortableColumns(){return[{label:d("Site URL"),value:"site_url"},{label:d("Active Licenses"),value:"active_licenses_count"},{label:d("Created At"),value:"created_at"}]}getSearchHint(){return d("by site URL")}getFetchUrl(){return"licensing/sites"}parseResponse(t){return t.sites}getTableName(){return"license_sites"}with(){return[]}}function Mn(a){return Un.init(a)}const In={class:"fct_sites_table"},On={class:"table-cell"},Fn={key:0,class:"table-cell"},Bn={class:"fct-popover-box"},Nn={class:"fct-popover-content"},Rn={class:"fct-product-orders-items is-scroll"},jn={class:"title"},zn={key:0,class:"variation-title"},Hn={key:0,class:"block w-full truncate mr-4"},qn={key:1,class:"block w-full truncate mr-4"},Yn={class:"fct-popover-box-action-icon"},Kn={key:1,class:"table-cell"},Wn={class:"table-cell"},Gn={class:"table-cell"},Xn={key:0},Zn={key:1,class:"text-gray-300"},Jn={class:"table-cell"},Qn={key:0},ei={key:1,class:"text-gray-300"},ti={class:"table-cell"},Se={__name:"_SiteTable",props:{sites:{type:Array,required:!0},columns:{type:Array,default(){return["products","customer","active_licenses","last_activity","created_at"]}}},setup(a){return(t,i)=>{const w=m("router-link"),u=m("el-table-column"),r=m("el-popover"),b=m("el-table");return n(),$(ee,{permission:"licenses/view"},{default:s(()=>[l("div",In,[e(b,{data:a.sites,class:"w-full compact-table"},{empty:s(()=>[e(le,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No activated sites found")},null,8,["text"])]),default:s(()=>[e(u,{label:c(d)("Site URL"),"min-width":200},{default:s(v=>[e(w,{class:"link block hover:no-underline route-cell",to:{name:"view_site",params:{site_id:v.row.id}}},{default:s(()=>[l("div",On,[l("div",null,[l("span",null,o(v.row.site_url),1),v.row.is_local?(n(),$(H,{key:0,status:"warning",size:"small","hide-icon":!0,text:c(d)("local"),style:{"margin-left":"8px"}},null,8,["text"])):g("",!0)])])]),_:2},1032,["to"])]),_:1},8,["label"]),a.columns.indexOf("products")!==-1?(n(),$(u,{key:0,"min-width":180,label:c(d)("Products")},{default:s(v=>[v.row.products&&v.row.products.length?(n(),_("div",Fn,[l("div",Bn,[e(r,{placement:"bottom-start",width:300,trigger:"click"},{reference:s(()=>[l("div",{class:"fct-popover-box-action",tabindex:"0",role:"button",onKeydown:i[0]||(i[0]=Be(q(()=>{},["prevent"]),["enter","space"]))},[v.row.products.length===1?(n(),_("span",Hn,o(v.row.products[0].name),1)):(n(),_("span",qn,o(v.row.products.length)+" "+o(c(d)("products")),1)),l("div",Yn,[e(R,{name:"ChevronDown"})])],32)]),default:s(()=>[l("div",Nn,[l("div",Rn,[(n(!0),_(U,null,N(v.row.products,(y,S)=>(n(),_("p",{key:S},[l("span",jn,o(y.name),1),y.variation?(n(),_("span",zn,"– "+o(y.variation),1)):g("",!0)]))),128))])])]),_:2},1024)])])):(n(),_("div",Kn,i[1]||(i[1]=[l("span",{class:"text-gray-300"},"—",-1)])))]),_:1},8,["label"])):g("",!0),a.columns.indexOf("active_licenses")!==-1?(n(),$(u,{key:1,width:130,label:c(d)("Active Licenses")},{default:s(v=>[e(w,{class:"link block hover:no-underline route-cell",to:{name:"view_site",params:{site_id:v.row.id}}},{default:s(()=>[l("div",Wn,o(v.row.active_licenses_count),1)]),_:2},1032,["to"])]),_:1},8,["label"])):g("",!0),a.columns.indexOf("customer")!==-1?(n(),$(u,{key:2,width:150,label:c(d)("Customer")},{default:s(v=>[l("div",Gn,[v.row.customers&&v.row.customers.length?(n(),_("div",Xn,[l("span",null,o(v.row.customers.join(", ")),1)])):(n(),_("span",Zn,"—"))])]),_:1},8,["label"])):g("",!0),a.columns.indexOf("last_activity")!==-1?(n(),$(u,{key:3,width:130,label:c(d)("Last Activity")},{default:s(v=>[l("div",Jn,[v.row.last_activity?(n(),_("span",Qn,o(c(K)(v.row.last_activity)),1)):(n(),_("span",ei,"—"))])]),_:1},8,["label"])):g("",!0),a.columns.indexOf("created_at")!==-1?(n(),$(u,{key:4,width:130,label:c(d)("Created At")},{default:s(v=>[l("div",ti,o(c(K)(v.row.created_at)),1)]),_:1},8,["label"])):g("",!0)]),_:1},8,["data"])])]),_:1})}}},si={class:"table-cell"},li={class:"w-full flex flex-col items-start justify-start gap-1"},ai={class:"table-cell"},ni={class:"table-cell"},ii={class:"table-cell"},oi={class:"table-cell"},ri={class:"table-cell"},ci={__name:"SitesLoader",props:{nextPageCount:{type:Number,default:0},siteTable:{type:Object,default:()=>({})}},setup(a){const t=a,i=u=>{var b,v;return(((v=(b=t.siteTable)==null?void 0:b.data)==null?void 0:v.columns)||[]).indexOf(u)!==-1},w=Array.from({length:Math.max(t.nextPageCount,5)},(u,r)=>r+1);return(u,r)=>{const b=m("el-skeleton-item"),v=m("el-table-column"),y=m("el-table"),S=m("el-skeleton");return n(),$(S,{animated:""},{template:s(()=>[e(y,{data:c(w),class:"w-full compact-table responsive"},{empty:s(()=>r[0]||(r[0]=[])),default:s(()=>[e(v,{label:u.$t("Site URL"),"min-width":200},{default:s(()=>[l("div",si,[l("div",li,[e(b,{varient:"p",class:"w-2/5"}),e(b,{varient:"p",class:"w-3/5"})])])]),_:1},8,["label"]),i("products")?(n(),$(v,{key:0,"min-width":180,label:u.$t("Products")},{default:s(()=>[l("div",ai,[e(b,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("active_licenses")?(n(),$(v,{key:1,width:130,label:u.$t("Active Licenses")},{default:s(()=>[l("div",ni,[e(b,{varient:"p",class:"w-2/5"})])]),_:1},8,["label"])):g("",!0),i("customer")?(n(),$(v,{key:2,width:150,label:u.$t("Customer")},{default:s(()=>[l("div",ii,[e(b,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):g("",!0),i("last_activity")?(n(),$(v,{key:3,width:130,label:u.$t("Last Activity")},{default:s(()=>[l("div",oi,[e(b,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("created_at")?(n(),$(v,{key:4,width:130,label:u.$t("Created At")},{default:s(()=>[l("div",ri,[e(b,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0)]),_:1},8,["data"])]),_:1})}}},di={},ui={class:"px-4 py-3"},_i={class:"grid grid-cols-3 gap-5 mt-5"};function mi(a,t){const i=m("el-skeleton-item"),w=m("el-skeleton");return n(),$(w,{animated:""},{template:s(()=>[l("div",ui,[(n(),_(U,null,N(3,u=>l("div",{key:u,class:"flex items-center justify-between mb-3"},[e(i,{varient:"p",class:"w-3/5"}),e(i,{varient:"p",class:"w-[80px]"})])),64)),l("div",_i,[(n(),_(U,null,N(3,u=>l("div",{key:u},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const pi=W(di,[["render",mi]]),hi={class:"fct-all-sites-page fct-layout-width"},fi={class:"single-page-header"},gi={class:"fct-all-sites-wrap"},vi={key:1},bi={__name:"ActivatedSitesList",setup(a){const t=Mn();return(i,w)=>{const u=m("el-breadcrumb-item"),r=m("el-breadcrumb");return n(),_("div",hi,[l("div",fi,[e(r,{"separator-icon":c(he)},{default:s(()=>[e(u,{to:{name:"licenses"}},{default:s(()=>[D(o(c(d)("Licenses")),1)]),_:1}),e(u,null,{default:s(()=>[D(o(c(d)("Sites")),1)]),_:1})]),_:1},8,["separator-icon"])]),e(ee,{permission:"licenses/view"},{default:s(()=>[l("div",gi,[e(Ee,{table:c(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:s(()=>[c(t).isLoading()?(n(),$(pi,{key:0})):g("",!0),c(t).isLoading()?g("",!0):(n(),$(Se,{key:1,sites:c(t).getTableData(),columns:c(t).data.columns},null,8,["sites","columns"]))]),default:s(()=>[c(t).isLoading()?(n(),$(ci,{key:0,siteTable:c(t),"next-page-count":c(t).nextPageCount},null,8,["siteTable","next-page-count"])):(n(),_("div",vi,[e(Se,{sites:c(t).getTableData(),columns:c(t).data.columns},null,8,["sites","columns"])]))]),_:1},8,["table"])])]),_:1})])}}},yi={key:1,class:"fct-view-site-wrap fct-layout-width"},wi={class:"single-page-header"},ki={class:"flex items-center gap-3 flex-wrap whitespace-pre-wrap",style:{"overflow-wrap":"anywhere"}},Li={class:"license-breadcrumb-only-mobile"},Ci={class:"single-page-body"},$i={class:"fct-view-site-content-wrap"},xi={class:"fct-related-license-content"},Si={key:1},Di={key:2,class:"text-gray-400 block text-xs"},Ei={class:"fct-license-key"},Pi={class:"fct-license-key-inner pr-2"},Vi={key:0},Ai={key:1},Ti={key:0},Ui={key:1},Mi={key:0},Ii={key:0,class:"block text-xs"},Oi={class:"text-gray-400 text-xs"},Fi={key:1,class:"text-gray-300"},Bi={class:"fct-related-license-content"},Ni={class:"fct-admin-sidebar"},Ri={class:"fct-site-details-list grid gap-4"},ji={class:"fct-site-detail-item"},zi={class:"text-gray-400 text-xs block mb-1"},Hi=["href"],qi={key:0,class:"fct-site-detail-item"},Yi={class:"text-gray-400 text-xs block mb-1"},Ki={key:1,class:"fct-site-detail-item"},Wi={class:"text-gray-400 text-xs block mb-1"},Gi={key:2,class:"fct-site-detail-item"},Xi={class:"text-gray-400 text-xs block mb-1"},Zi={key:3,class:"fct-site-detail-item"},Ji={class:"text-gray-400 text-xs block mb-1"},Qi={key:4,class:"fct-site-detail-item"},eo={class:"text-gray-400 text-xs block mb-1"},to={key:0},so={key:1},lo={class:"text-gray-400 text-xs block mb-1"},ao={class:"grid gap-3"},no={class:"flex justify-between"},io={class:"text-gray-400"},oo={class:"font-medium"},ro={class:"flex justify-between"},co={class:"text-gray-400"},uo={class:"font-medium"},_o={class:"flex justify-between"},mo={class:"text-gray-400"},po={class:"font-medium"},ho={class:"flex justify-between"},fo={class:"text-gray-400"},go={class:"font-medium"},vo={class:"grid gap-4"},bo=["src","alt"],yo={class:"text-gray-400 text-xs"},wo={key:1,class:"fct-error-state p-8 text-center"},ko={class:"mt-4 flex justify-center gap-3"},Lo={key:1,class:"fct-loading-wrap p-8 text-center"},Co={name:"ViewSite",props:["site_id"],data(){return{site:null,activations:[],customers:[],orders:[],loading:!0,notFound:{show:!1,message:"",buttonText:"",route:""}}},computed:{siteExternalUrl(){var a=this.site?this.site.site_url:"";return/^https?:\/\//.test(a)?a:"https://"+a},hasLocalActivation(){return this.activations.some(function(a){return a.is_local&&a.is_local!=="0"})},activeCount(){return this.activations.filter(function(a){return a.activation_status==="active"}).length},uniqueProductCount(){var a={};return this.activations.forEach(function(t){t.product_name&&(a[t.product_name]=!0)}),Object.keys(a).length},lastUpdateInfo(){var a=null;return this.activations.forEach(function(t){t.last_update_date&&(!a||t.last_update_date>a.last_update_date)&&(a=t)}),a&&a.last_update_date?{version:a.last_update_version||null,date:a.last_update_date}:null}},methods:{translate:d,formatDate:K,handleError:et,formatFullDate(a){return a?Z(a).format("MMM DD, YYYY"):""},formatMetaKey(a){return a.replace(/_/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})},fetchSite(){this.loading=!0,this.notFound.show=!1,this.$get("licensing/sites/"+this.site_id).then((function(a){this.site=a.site,this.activations=a.activations.data||a.activations,this.customers=a.customers||[],this.orders=a.orders||[]}).bind(this)).catch((function(a){a&&(a.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=te.get(a,"data.buttonText",d("Back to Sites")),this.notFound.message=te.get(a,"data.message",d("Site not found")),this.notFound.route=te.get(a,"data.route","/licenses/sites")):this.handleError(a))}).bind(this)).finally((function(){this.loading=!1}).bind(this))}},mounted(){this.fetchSite()}},$o=Object.assign(Co,{setup(a){return(t,i)=>{const w=m("el-breadcrumb-item"),u=m("el-breadcrumb"),r=m("router-link"),b=m("el-table-column"),v=m("el-tooltip"),y=m("el-table"),S=m("el-col"),E=m("el-row"),C=m("el-button"),T=m("el-skeleton");return n(),_("div",null,[t.notFound.show?(n(),$(Pe,{key:0,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):g("",!0),t.notFound.show===!1?(n(),_("div",yi,[t.loading?g("",!0):(n(),_(U,{key:0},[t.site?(n(),_(U,{key:0},[l("div",wi,[e(u,{class:"hide-license-breadcrumb-on-mobile","separator-icon":c(he)},{default:s(()=>[e(w,{to:{name:"licenses"}},{default:s(()=>[D(o(c(d)("Licenses")),1)]),_:1}),e(w,{to:{name:"activated_sites"}},{default:s(()=>[D(o(c(d)("Sites")),1)]),_:1}),e(w,null,{default:s(()=>[l("div",ki,o(t.site.site_url),1)]),_:1})]),_:1},8,["separator-icon"]),l("ul",Li,[l("li",null,[e(r,{to:{name:"activated_sites"}},{default:s(()=>[e(R,{name:"ArrowLeft",class:"cursor-pointer"})]),_:1})]),l("li",null,o(t.site.site_url),1)])]),l("div",Ci,[e(E,{gutter:30},{default:s(()=>[e(S,{lg:17},{default:s(()=>[l("div",$i,[e(I,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:c(d)("Activated Licenses"),title_size:"small"},null,8,["title"]),e(M,{class:"px-0 pb-0"},{default:s(()=>[l("div",xi,[e(y,{data:t.activations,class:"w-full"},{empty:s(()=>[e(le,{icon:"Empty/ListView","has-dark":!0,text:c(d)("No activations found")},null,8,["text"])]),default:s(()=>[e(b,{"min-width":160,label:c(d)("Product")},{default:s(p=>[l("div",null,[p.row.product_id?(n(),$(r,{key:0,class:"link",to:{name:"product_edit",params:{product_id:p.row.product_id}}},{default:s(()=>[D(o(p.row.product_name),1)]),_:2},1032,["to"])):(n(),_("span",Si,o(p.row.product_name),1)),p.row.variation_title?(n(),_("span",Di," – "+o(p.row.variation_title),1)):g("",!0)])]),_:1},8,["label"]),e(b,{width:110,label:c(d)("Status")},{default:s(p=>[e(H,{status:p.row.license_status,size:"small"},null,8,["status"])]),_:1},8,["label"]),e(b,{width:180,label:c(d)("License Key")},{default:s(p=>[l("span",Ei,[l("span",Pi,[e(r,{class:"link text-xs",to:{name:"view_license",params:{license_id:p.row.license_id}}},{default:s(()=>[D(o(p.row.license_key.substring(0,12))+"... ",1)]),_:2},1032,["to"])]),e(v,{content:p.row.license_key,placement:"top","popper-class":"fct-tooltip"},{default:s(()=>[e(R,{class:"cursor-pointer p-1 w-6 h-6 flex-none",name:"Copy",onClick:()=>{c(Te).copy(p.row.license_key,{successMessage:c(d)("License Key copied to clipboard"),errorMessage:c(d)("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])]),_:1},8,["label"]),e(b,{width:100,label:c(d)("Activations")},{default:s(p=>[p.row.activation_limit!==null?(n(),_("span",Vi,o(p.row.activation_count)+" / "+o(p.row.activation_limit==0?c(d)("Unlimited"):p.row.activation_limit),1)):(n(),_("span",Ai,"—"))]),_:1},8,["label"]),e(b,{width:130,label:c(d)("Expiration")},{default:s(p=>[p.row.expiration_date?(n(),_("span",Ti,o(c(K)(p.row.expiration_date)),1)):(n(),_("span",Ui,o(c(d)("Lifetime")),1))]),_:1},8,["label"]),e(b,{width:130,label:c(d)("Last Update")},{default:s(p=>[p.row.last_update_date?(n(),_("div",Mi,[p.row.last_update_version?(n(),_("span",Ii,o(p.row.last_update_version),1)):g("",!0),l("span",Oi,o(c(K)(p.row.last_update_date)),1)])):(n(),_("span",Fi,"—"))]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1}),t.orders.length?(n(),$(I,{key:0,class:"overflow-hidden"},{default:s(()=>[e(B,{title:c(d)("Related Orders"),title_size:"small"},null,8,["title"]),e(M,{class:"px-0 pb-0"},{default:s(()=>[l("div",Bi,[e(y,{data:t.orders,class:"w-full"},{default:s(()=>[e(b,{width:120,label:c(d)("ID")},{default:s(p=>[e(r,{class:"link",to:{name:"view_order",params:{order_id:p.row.id}}},{default:s(()=>[D(" #"+o(p.row.id),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(b,{width:120,label:c(d)("Amount")},{default:s(p=>[l("span",null,o(t.formatNumber(p.row.total_paid)),1)]),_:1},8,["label"]),e(b,{width:150,label:c(d)("Date")},{default:s(p=>[l("span",null,o(c(K)(p.row.created_at)),1)]),_:1},8,["label"]),e(b,{label:c(d)("Payment Method")},{default:s(p=>[D(o(p.row.payment_method),1)]),_:1},8,["label"]),e(b,{label:c(d)("Status")},{default:s(p=>[e(H,{status:p.row.payment_status,size:"small"},null,8,["status"])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1})):g("",!0)])]),_:1}),e(S,{lg:7},{default:s(()=>[l("div",Ni,[e(I,null,{default:s(()=>[e(B,{title:c(d)("Site Details"),title_size:"small",border_bottom:""},null,8,["title"]),e(M,null,{default:s(()=>[l("div",Ri,[l("div",ji,[l("span",zi,o(c(d)("Site URL")),1),l("a",{href:t.siteExternalUrl,target:"_blank",rel:"noopener noreferrer",class:"link font-medium inline-flex items-center gap-1.5",style:{outline:"none","box-shadow":"none"}},[D(o(t.site.site_url)+" ",1),e(R,{name:"External",class:"w-3.5 h-3.5 text-gray-400"})],8,Hi)]),t.hasLocalActivation?(n(),_("div",qi,[l("span",Yi,o(c(d)("Environment")),1),e(H,{status:"warning",size:"small","hide-icon":!0,text:c(d)("Local / Staging")},null,8,["text"])])):g("",!0),t.site.platform_version?(n(),_("div",Ki,[l("span",Wi,o(c(d)("Platform Version")),1),l("span",null,o(t.site.platform_version),1)])):g("",!0),t.site.server_version?(n(),_("div",Gi,[l("span",Xi,o(c(d)("Server Version")),1),l("span",null,o(t.site.server_version),1)])):g("",!0),t.site.created_at?(n(),_("div",Zi,[l("span",Ji,o(c(d)("Registered At")),1),l("span",null,o(t.formatFullDate(t.site.created_at)),1)])):g("",!0),t.lastUpdateInfo?(n(),_("div",Qi,[l("span",eo,o(c(d)("Last Update Check")),1),t.lastUpdateInfo.version?(n(),_("span",to,o(t.lastUpdateInfo.version)+" — "+o(t.formatFullDate(t.lastUpdateInfo.date)),1)):(n(),_("span",so,o(t.formatFullDate(t.lastUpdateInfo.date)),1))])):g("",!0),t.site.other&&Object.keys(t.site.other).length?(n(!0),_(U,{key:5},N(t.site.other,(p,P)=>(n(),_("div",{key:P,class:"fct-site-detail-item"},[l("span",lo,o(t.formatMetaKey(P)),1),l("span",null,o(p),1)]))),128)):g("",!0)])]),_:1})]),_:1}),e(I,null,{default:s(()=>[e(B,{title:c(d)("Summary"),title_size:"small",border_bottom:""},null,8,["title"]),e(M,null,{default:s(()=>[l("div",ao,[l("div",no,[l("span",io,o(c(d)("Total Activations")),1),l("span",oo,o(t.activations.length),1)]),l("div",ro,[l("span",co,o(c(d)("Active")),1),l("span",uo,o(t.activeCount),1)]),l("div",_o,[l("span",mo,o(c(d)("Products")),1),l("span",po,o(t.uniqueProductCount),1)]),l("div",ho,[l("span",fo,o(c(d)("Orders")),1),l("span",go,o(t.orders.length),1)])])]),_:1})]),_:1}),t.customers.length?(n(),$(I,{key:0},{default:s(()=>[e(B,{title:c(d)("Customers"),title_size:"small",border_bottom:""},null,8,["title"]),e(M,null,{default:s(()=>[l("div",vo,[(n(!0),_(U,null,N(t.customers,p=>(n(),_("div",{key:p.id,class:"flex items-center gap-3"},[e(r,{to:{name:"view_customer",params:{customer_id:p.id}}},{default:s(()=>[p.photo?(n(),_("img",{key:0,src:p.photo,alt:p.full_name,class:"w-10 h-10 rounded-full object-cover flex-shrink-0"},null,8,bo)):g("",!0)]),_:2},1032,["to"]),l("div",null,[e(r,{class:"link font-medium block",to:{name:"view_customer",params:{customer_id:p.id}}},{default:s(()=>[D(o(p.full_name),1)]),_:2},1032,["to"]),l("span",yo,o(p.email),1)])]))),128))])]),_:1})]),_:1})):g("",!0)])]),_:1})]),_:1})])],64)):g("",!0),!t.site&&!t.loading?(n(),_("div",wo,[e(le,{icon:"Empty/ListView","has-dark":!0,text:c(d)("Failed to load site details")},null,8,["text"]),l("div",ko,[e(C,{onClick:t.fetchSite},{default:s(()=>[D(o(c(d)("Retry")),1)]),_:1},8,["onClick"]),e(C,{onClick:i[0]||(i[0]=p=>t.$router.push({name:"activated_sites"}))},{default:s(()=>[D(o(c(d)("Back to Sites")),1)]),_:1})])])):g("",!0)],64)),t.loading?(n(),_("div",Lo,[e(T,{rows:8,animated:""})])):g("",!0)])):g("",!0)])}}});window.fluent_cart_admin.hooks.addFilter("fluent_cart_routes","fluent_all_licenses",function(a){return a.product_route.children.push({name:"license_settings",path:"license_settings",props:!0,component:Ut,meta:{active_menu:"products",title:"License Settings",permission:"store/sensitive"}}),a.license_route={name:"licenses",path:"/licenses",component:gl,meta:{active_menu:"licenses",title:"Licenses",permission:"store/sensitive"}},a.view_license={name:"view_license",path:"/licenses/:license_id/view",component:bn,props:!0,meta:{active_menu:"licenses",title:"View License",permission:"store/sensitive"}},a.view_customer_licenses={name:"view_customer_licenses",path:"/licenses/customer/:customer_id",component:Tn,props:!0,meta:{active_menu:"licenses",title:"View License",permission:"store/sensitive"}},a.activated_sites={name:"activated_sites",path:"/licenses/sites",component:bi,meta:{active_menu:"licenses",title:"Activated Sites",permission:"store/sensitive"}},a.view_site={name:"view_site",path:"/licenses/sites/:site_id/view",component:$o,props:!0,meta:{active_menu:"licenses",title:"View Site",permission:"store/sensitive"}},a}); |
|
1
|
+var Ie=Object.defineProperty;var Oe=(l,t,i)=>t in l?Ie(l,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):l[t]=i;var Le=(l,t,i)=>Oe(l,typeof t!="symbol"?t+"":t,i);import{t as d,A as re}from"./chunks/Translator.js?ver=1.6.5";import{r as m,e as _,o as n,a as e,b as g,w as s,u as o,c as $,d as a,t as r,F as U,g as N,n as ce,f as D,h as j,l as ae,v as de,j as pe,i as ue,x as X,G as Ce,k as Fe,q,a0 as Be,m as Re,z as Ne}from"./chunks/vue.esm-bundler.js?ver=1.6.5";import{C as B,a as I,b as O,_ as je}from"./chunks/CardBody.js?ver=1.6.5";import{L as te,_ as De}from"./chunks/NotFound.js?ver=1.6.5";import{_ as ze,m as $e,a as He,d as qe,T as K,i as Ee}from"./chunks/dateShortCuts.js?ver=1.6.5";import{_ as le,P as Ke}from"./chunks/Empty.js?ver=1.6.5";import{_ as R}from"./chunks/DynamicIcon.js?ver=1.6.5";import{T as Pe,B as H,_ as Ve,c as Ye}from"./chunks/Badge.js?ver=1.6.5";import{b as Y,S as xe,i as We,a as Ge}from"./chunks/common.js?ver=1.6.5";import{a as Xe,cp as Qe,b as he}from"./chunks/index.js?ver=1.6.5";import{b as _e,P as Ze,C as Te,u as Je,L as et,_ as tt,O as oe,f as st,e as at}from"./chunks/OrderCustomerInformation.js?ver=1.6.5";import{_ as W}from"./chunks/_plugin-vue_export-helper.js?ver=1.6.5";import{d as Q}from"./chunks/dayjs.min.js?ver=1.6.5";import{M as lt}from"./chunks/Model.js?ver=1.6.5";import{R as Ae}from"./chunks/Rest.js?ver=1.6.5";import{I as me}from"./chunks/IconButton.js?ver=1.6.5";import{_ as Z}from"./chunks/UserCan.js?ver=1.6.5";import"./chunks/Utils.js?ver=1.6.5";import{S as nt}from"./chunks/Str.js?ver=1.6.5";import{A as se}from"./chunks/Arr.js?ver=1.6.5";import{f as Ue,r as Me}from"./chunks/CurrencyFormatter.js?ver=1.6.5";import"./chunks/vue-router.js?ver=1.6.5";import"./chunks/Asset.js?ver=1.6.5";import"./chunks/Url.js?ver=1.6.5";import"./chunks/index4.js?ver=1.6.5";import"./chunks/preload-helper.js?ver=1.6.5";import"./chunks/timezone.js?ver=1.6.5";import"./chunks/Notify.js?ver=1.6.5";import"./chunks/index3.js?ver=1.6.5";import"./chunks/TransitionAccordion.js?ver=1.6.5";import"./chunks/weekOfYear.js?ver=1.6.5";import"./chunks/Animation.js?ver=1.6.5";import"./chunks/AddressComponent2.js?ver=1.6.5";import"./chunks/productService.js?ver=1.6.5";const it={class:"fct-license-settings fct-layout-width"},ot={key:1,class:"fct-license-settings-body"},rt={class:"fct-licensed-product-table hide-on-mobile"},ct={class:"fct-media-with-content"},dt={class:"media"},ut=["src","alt"],_t={class:"title"},mt=["innerHTML"],pt=["innerHTML"],ht={class:"fct-product-pricing-table-item"},ft={class:"fct-licensed-product-table-mobile"},gt={class:"fct-licensed-product-table-mobile-col"},vt={class:"root-title"},bt={class:"fct-media-with-content"},yt={class:"media"},wt=["src","alt"],kt={class:"title"},Lt=["innerHTML"],Ct=["innerHTML"],$t={class:"fct-licensed-product-table-mobile-col"},xt={class:"root-title"},St={class:"fct-product-pricing-table-item"},Dt={key:0},Et={class:"custom-wp-editor-wrapper relative"},Pt={class:"absolute mb-0 font-bold"},Vt={key:2,class:"fct-bundle-license-info",style:{padding:"40px 20px"}},Tt={class:"flex items-center justify-center mb-4"},At={style:{"max-width":"600px",margin:"0 auto",color:"#606266","line-height":"1.6","text-align":"left"}},Ut={class:"text-sm font-medium mb-3 text-system-dark dark:text-gray-50"},Mt={style:{"font-size":"14px"}},It={key:0,class:"setting-save-action"},Ot={name:"LicenseSettings",props:["product_id"],data(){return{settings:null,saving:!1,loading:!1,product:{},globalUpdateFile:{},selectedFile:null,fetchSettings:!1,isBundleProduct:!1,signedReleasesEnabled:!1}},methods:{translate:d,fetchProduct(){this.loading=!0,this.$get("products/"+this.product_id+"/pricing",{}).then(l=>{this.product=l.product}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1})},getSettings(){this.fetchSettings=!0,this.$get(`licensing/products/${this.product_id}/settings`).then(l=>{var i,k;const t=l.settings.global_update_file;t&&typeof t=="object"&&(l.settings.global_update_file=t.id?t.id.toString():""),this.settings=l.settings,this.isBundleProduct=l.is_bundle_product||!1,this.signedReleasesEnabled=l.signed_releases_enabled||!1,this.selectedFile=(i=l.settings.global_update_file)!=null&&i.id?parseInt((k=l.settings.global_update_file)==null?void 0:k.id):""}).catch(l=>{this.handleError(l)}).finally(()=>{this.fetchSettings=!1})},updateSettings(){if(this.isBundleProduct){this.handleError({message:this.translate("License settings cannot be saved for bundle products. Licenses are generated according to bundle items' license settings.")});return}this.saving=!0,this.$post(`licensing/products/${this.product_id}/settings`,{settings:this.settings}).then(l=>{this.handleSuccess(l.message)}).catch(l=>{this.handleError(l)}).finally(()=>{this.saving=!1})},imageUrl(l){var t;return l&&((t=l.meta_value)==null?void 0:t.length)>0?l.meta_value[0].url:this.appVars.asset_url+"images/empty-image.svg"},imageAlt(l){var t;return l&&((t=l.meta_value)==null?void 0:t.length)>0?l.meta_value[0].title:"No Image"}},mounted(){this.getSettings(),this.fetchProduct();const l=document.querySelector("#fct_admin_menu_holder .fct-admin-product-header");l&&document.querySelector("#fluent_cart_plugin_app").prepend(l)}},Ft=Object.assign(Ot,{setup(l){return(t,i)=>{const k=m("el-switch"),u=m("el-skeleton"),c=m("el-table-column"),y=m("el-input"),v=m("el-table"),b=m("el-form-item"),S=m("el-col"),V=m("el-option"),L=m("el-select"),P=m("el-row"),p=m("el-form"),E=m("el-button");return n(),_("div",it,[e(O,null,{default:s(()=>[e(B,{border_bottom:"",title:o(d)("License Settings")},{action:s(()=>[t.settings?(n(),$(k,{key:0,modelValue:t.settings.enabled,"onUpdate:modelValue":i[0]||(i[0]=w=>t.settings.enabled=w),"active-value":"yes","inactive-value":"no","active-text":o(d)("Enable Licensing for this product"),disabled:t.isBundleProduct},null,8,["modelValue","active-text","disabled"])):g("",!0)]),_:1},8,["title"]),e(I,null,{default:s(()=>[t.fetchSettings?(n(),$(u,{key:0,rows:6,animated:!0})):g("",!0),t.settings&&!t.fetchSettings?(n(),_("div",ot,[t.settings.enabled==="yes"?(n(),$(p,{key:0,"label-position":"top",modelValue:t.settings,"onUpdate:modelValue":i[13]||(i[13]=w=>t.settings=w)},{default:s(()=>[e(b,null,{default:s(()=>[a("div",rt,[e(v,{ref:"elTable","row-key":w=>w.rowId,data:t.settings.variations},{default:s(()=>[e(c,{label:o(d)("Variant"),width:300},{default:s(w=>[a("div",ct,[a("div",dt,[a("img",{src:t.imageUrl(w.row.media),alt:t.imageAlt(w.row.media)},null,8,ut)]),a("div",null,[a("div",_t,r(w.row.title),1),w.row.subscription_info?(n(),_("div",{key:0,class:"text",innerHTML:w.row.subscription_info},null,8,mt)):g("",!0),w.row.setup_fee_info?(n(),_("div",{key:1,class:"text",innerHTML:w.row.setup_fee_info},null,8,pt)):g("",!0)])])]),_:1},8,["label"]),e(c,{width:140},{header:s(()=>[e(te,{title:o(d)("Activation Limit"),content:o(d)("Activation limit controls how many sites/devices can use this license. License validity matches your subscription interval. For example, an annual subscription will generate a license valid for one year.")},null,8,["title","content"])]),default:s(w=>[a("div",ht,[e(y,{type:"number",min:1,placeholder:o(d)("Use 0 or empty for no limit"),modelValue:w.row.activation_limit,"onUpdate:modelValue":M=>w.row.activation_limit=M},null,8,["placeholder","modelValue","onUpdate:modelValue"])])]),_:1})]),_:1},8,["row-key","data"])]),a("div",ft,[(n(!0),_(U,null,N(t.settings.variations,w=>(n(),_("div",{class:"fct-licensed-product-table-mobile-row",key:w.rowId},[a("div",gt,[a("div",vt,r(o(d)("Variant")),1),a("div",bt,[a("div",yt,[a("img",{src:t.imageUrl(w.media),alt:t.imageAlt(w.media)},null,8,wt)]),a("div",null,[a("div",kt,r(w.title),1),w.subscription_info?(n(),_("div",{key:0,class:"text",innerHTML:w.subscription_info},null,8,Lt)):g("",!0),w.setup_fee_info?(n(),_("div",{key:1,class:"text",innerHTML:w.setup_fee_info},null,8,Ct)):g("",!0)])])]),a("div",$t,[a("div",xt,[e(te,{title:o(d)("Activation Limit"),content:o(d)("Activation limit controls how many sites/devices can use this license. License validity matches your subscription interval. For example, an annual subscription will generate a license valid for one year.")},null,8,["title","content"])]),a("div",St,[e(y,{type:"number",min:1,placeholder:o(d)("Use 0 or empty for no limit"),modelValue:w.activation_limit,"onUpdate:modelValue":M=>w.activation_limit=M},null,8,["placeholder","modelValue","onUpdate:modelValue"])])])]))),128))])]),_:1}),e(P,{gutter:20},{default:s(()=>[e(S,{lg:8},{default:s(()=>[e(b,null,{label:s(()=>[e(te,{title:o(d)("Version Number"),content:o(d)("Enter the current version number of your product.")},null,8,["title","content"])]),default:s(()=>[e(y,{placeholder:o(d)("Your Product Version"),modelValue:t.settings.version,"onUpdate:modelValue":i[1]||(i[1]=w=>t.settings.version=w)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),e(S,{lg:8},{default:s(()=>[e(b,null,{label:s(()=>[e(te,{title:o(d)("License Key Prefix (Optional)"),content:o(d)("If you add any prefix here then it will will be used as the prefix of the generated license key")},null,8,["title","content"])]),default:s(()=>[e(y,{placeholder:o(d)("Your License Key Prefix"),modelValue:t.settings.prefix,"onUpdate:modelValue":i[2]||(i[2]=w=>t.settings.prefix=w)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),t.fetchSettings?g("",!0):(n(),$(S,{key:0,lg:8},{default:s(()=>[e(b,null,{label:s(()=>[e(te,{title:o(d)("Update File"),content:o(d)("Update File (Choose the source file to get automatic updates)")},null,8,["title","content"])]),default:s(()=>{var w,M;return[((M=(w=t.product)==null?void 0:w.downloadable_files)==null?void 0:M.length)===0?(n(),_("span",Dt,r(o(d)("No downloadable files found")),1)):(n(),$(L,{key:1,modelValue:t.settings.global_update_file,"onUpdate:modelValue":i[3]||(i[3]=f=>t.settings.global_update_file=f),placeholder:o(d)("Update File")},{default:s(()=>[(n(!0),_(U,null,N(t.product.downloadable_files,f=>(n(),$(V,{key:f.id,label:f.title,value:f.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]))]}),_:1})]),_:1}))]),_:1}),t.signedReleasesEnabled?(n(),_(U,{key:0},[e(b,null,{label:s(()=>[e(te,{title:o(d)("Release Manifest"),content:o(d)("The signed manifest for this exact version, as base64. Paste it unchanged from your release signing step — it is stored and served byte for byte, and any edit here makes sites refuse the update.")},null,8,["title","content"])]),default:s(()=>[e(y,{type:"textarea",rows:3,spellcheck:"false",autocomplete:"off",placeholder:o(d)("Base64 manifest for this version"),modelValue:t.settings.manifest,"onUpdate:modelValue":i[4]||(i[4]=w=>t.settings.manifest=w)},null,8,["placeholder","modelValue"])]),_:1}),e(b,null,{label:s(()=>[e(te,{title:o(d)("Release Signature"),content:o(d)("The detached signature for the manifest above: 88 characters, on one line. Paste it unchanged — a wrapped or re-typed signature will not verify.")},null,8,["title","content"])]),default:s(()=>[e(y,{spellcheck:"false",autocomplete:"off",placeholder:o(d)("88-character signature for this version"),modelValue:t.settings.signature,"onUpdate:modelValue":i[5]||(i[5]=w=>t.settings.signature=w)},null,8,["placeholder","modelValue"])]),_:1})],64)):g("",!0),e(b,null,{default:s(()=>[a("div",Et,[a("label",Pt,r(o(d)("Changelog Description")),1),e(ze,{modelValue:t.settings.changelog,onUpdate:i[6]||(i[6]=w=>{t.settings.changelog=w})},null,8,["modelValue"])])]),_:1}),a("div",{class:ce("is-wp-product-wrap "+(t.settings.wp.is_wp==="yes"?"pb-0":""))},[a("div",{class:ce(t.settings.wp.is_wp==="yes"?"pb-4":"")},[e(k,{modelValue:t.settings.wp.is_wp,"onUpdate:modelValue":i[7]||(i[7]=w=>t.settings.wp.is_wp=w),"active-value":"yes","inactive-value":"no","active-text":o(d)("Is WP Plugin?")},null,8,["modelValue","active-text"])],2),t.settings.wp.is_wp==="yes"?(n(),_(U,{key:0},[e(b,{label:o(d)("Changelog Page URL")},{default:s(()=>[e(y,{placeholder:o(d)("Your Product Changelog Page URL"),modelValue:t.settings.wp.readme_url,"onUpdate:modelValue":i[8]||(i[8]=w=>t.settings.wp.readme_url=w)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),e(P,{gutter:20},{default:s(()=>[e(S,{md:12},{default:s(()=>[e(b,{label:o(d)("Banner URL")},{default:s(()=>[e(y,{placeholder:o(d)("Plugin Banner URL"),modelValue:t.settings.wp.banner_url,"onUpdate:modelValue":i[9]||(i[9]=w=>t.settings.wp.banner_url=w)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12},{default:s(()=>[e(b,{label:o(d)("Icon URL")},{default:s(()=>[e(y,{placeholder:o(d)("Plugin Icon URL"),modelValue:t.settings.wp.icon_url,"onUpdate:modelValue":i[10]||(i[10]=w=>t.settings.wp.icon_url=w)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12,xs:24},{default:s(()=>[e(b,{label:o(d)("Required PHP Version (optional)")},{default:s(()=>[e(y,{placeholder:o(d)("Required PHP Version"),modelValue:t.settings.wp.required_php,"onUpdate:modelValue":i[11]||(i[11]=w=>t.settings.wp.required_php=w)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(S,{md:12,xs:24},{default:s(()=>[e(b,{label:o(d)("Required WP Version (optional)")},{default:s(()=>[e(y,{placeholder:o(d)("Required WP Version"),modelValue:t.settings.wp.required_wp,"onUpdate:modelValue":i[12]||(i[12]=w=>t.settings.wp.required_wp=w)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})],64)):g("",!0)],2)]),_:1},8,["modelValue"])):g("",!0),t.settings.enabled!=="yes"&&!t.isBundleProduct?(n(),$(le,{key:1,icon:"Empty/WebPage",text:o(d)("License for this product has not been enabled")},null,8,["text"])):g("",!0),t.isBundleProduct?(n(),_("div",Vt,[a("div",Tt,[e(R,{name:"Empty/WebPage",class:"w-[100px]"})]),a("div",At,[a("p",Ut,r(o(d)("License Settings Not Available for Bundle Products")),1),a("p",Mt,r(o(d)("Licenses are managed by bundle items themselves. Only pricing follows the bundle product (e.g., yearly bundle pricing results in yearly licenses for child bundle items).")),1)])])):g("",!0)])):g("",!0)]),_:1})]),_:1}),t.settings&&!t.isBundleProduct?(n(),_("div",It,[e(E,{onClick:i[14]||(i[14]=w=>t.updateSettings()),loading:t.saving,disabled:t.saving,type:"primary"},{default:s(()=>[D(r(o(d)(" Update Settings")),1)]),_:1},8,["loading","disabled"])])):g("",!0)])}}});class Bt extends Pe{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="order_id"}getTabs(){return{all:d("All"),active:d("Active"),inactive:d("Inactive"),expired:d("Expired"),disabled:d("Disabled")}}getToggleableColumns(){return[{label:d("Order ID"),value:"order_id"},{label:d("Product"),value:"product"},{label:d("Customer"),value:"customer"},{label:d("Date"),value:"date"}]}getSearchHint(){return d("by license key, order id, customer name/email or connected sites.")}getFetchUrl(){return"licensing/licenses"}parseResponse(t){return t.licenses}getTableName(){return"licenses"}with(){return["admin_license_list"]}}function Rt(l){return Bt.init(l)}class Nt extends lt{constructor(){super(...arguments);Le(this,"data",{summaryData:[],lineChartData:[],pieChartData:[],isBusy:!1})}get controllerKey(){return"LicenseReportController"}beforeInit(){}makeRequest(i,k,u,c){this.data.isBusy=!0,typeof k!="object"&&(k={});const y=Ae.get(`reports/${i}`,k);return this.resolvePromiseResponse(y,u,c),y}resolvePromiseResponse(i,k=null,u=null){i.then(c=>{u==null||k==null||(this.data[u]=c[k])}).catch(c=>{}).finally(()=>{this.data.isBusy=!1})}getLicenseLineChart(i={}){return this.makeRequest("license-chart",i,"lineChartData","lineChartData")}getLicensePieChart(i={}){return this.makeRequest("license-pie-chart",i,"pieChartData","pieChartData")}getSummary(i={}){return this.makeRequest("license-summary",i,"summaryData","summaryData")}}const z=Nt.init(),jt={class:"fct-license-statistics-wrap"},zt={class:"fct-btn-group sm"},Ht={class:"chart-action-wrap"},qt={class:"chart-change-wrap"},Kt={class:"chart-change"},Yt={class:"text"},Wt={class:"chart-change"},Gt={class:"text"},Xt={__name:"LicenseStatistics",props:{reportFilter:{type:Object}},setup(l){const t=l,i=j(null),k=j("daily"),u=j("line"),c=j([Q().startOf("month"),Q()]),y=[{value:"daily",label:"Daily"},{value:"monthly",label:"Monthly"},{value:"yearly",label:"Yearly"}],v=ae(()=>[{title:"Total License",key:"total_license",color:"#2ecc71"}].map(({title:f,key:h,color:x},C)=>p(f,u.value,C%2,z.data.lineChartData.map(F=>F.license_count),x))),b=ae(()=>z.data.lineChartData.map(f=>{if(k.value==="daily"){const[h,x,C]=f.date.split("-");return`${$e[parseInt(x)-1]} ${C}, ${h}`}else{if(k.value==="monthly")return`${$e[parseInt(f.month)-1]} ${f.year}`;if(k.value==="yearly")return`${f.year}`}}));let S=null;const V=()=>{i.value&&S===null&&(S=Ee(i.value),L())},L=()=>{const f={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:K.isDark()?"#38485a":"#ffffff",borderColor:K.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:K.isDark()?"#ffffff":"#565865"}},xAxis:{type:"category",data:b.value,axisLabel:{color:K.isDark()?"#ffffff":"#565865",fontSize:12}},yAxis:[{type:"value",axisLabel:{color:K.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:K.isDark()?"#38485a":"#D6DAE1"}}},{type:"value",position:"right",axisLabel:{color:K.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!1}}],dataZoom:[],series:v.value};S.setOption(f,{notMerge:!0,replaceMerge:["series"]})},P=()=>{const f={startDate:c.value[0].toISOString(),endDate:c.value[1].toISOString()};z.getLicenseLineChart({params:{...f,groupKey:k.value}})},p=(f,h,x,C,F)=>({name:f,type:h,yAxisIndex:x,data:C,smooth:!0,color:F,lineStyle:{width:3}}),E=()=>{P()},w=()=>{P()},M=f=>{u.value!==f&&(u.value=f,L())};return de([()=>z.chartData,u],()=>{X(L)},{deep:!0}),de(()=>z.data.lineChartData,()=>{X(()=>{L()})},{deep:!0}),pe(()=>{window.removeEventListener("onFluentCartThemeChange",L,!1)}),ue(()=>{window.addEventListener("onFluentCartThemeChange",L),P(),X(V)}),(f,h)=>{const x=m("el-option"),C=m("el-select"),F=m("el-date-picker");return n(),_("div",jt,[e(O,{id:"chartContainer"},{default:s(()=>[e(B,{title:f.$t("License Chart"),title_size:"small",border_bottom:""},{action:s(()=>[a("div",zt,[e(He,{activeType:u.value,types:{line:"LineChart",bar:"BarChart"},onChange:M},null,8,["activeType"]),e(C,{class:"w-[100px] el-select--x-small",modelValue:k.value,"onUpdate:modelValue":h[0]||(h[0]=A=>k.value=A),onChange:w},{default:s(()=>[(n(),_(U,null,N(y,A=>e(x,{key:A.value,label:f.$t(A.label),value:A.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),e(F,{class:"w-[220px] el-range-editor--x-small hide-close-icon",modelValue:c.value,"onUpdate:modelValue":h[1]||(h[1]=A=>c.value=A),type:"daterange","range-separator":"-","start-placeholder":f.$t("Start date"),"end-placeholder":f.$t("End date"),"unlink-panels":"",clearable:!1,shortcuts:o(qe),onChange:E},null,8,["modelValue","start-placeholder","end-placeholder","shortcuts"])])]),_:1},8,["title"]),e(I,null,{default:s(()=>[a("div",{class:"fct-license-statistics-chart",ref_key:"chartRef",ref:i},null,512),a("div",Ht,[a("div",qt,[a("div",Kt,[h[2]||(h[2]=a("svg",{width:"9",height:"11",viewBox:"0 0 9 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4.6087 10.5L4.6087 1.46395",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M1.00004 4.05762L4.55764 0.500019L8.11523 4.05762",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})],-1)),a("span",Yt,r(f.$t("Data")),1)]),a("div",Wt,[a("span",Gt,r(f.$t("Timeline")),1),h[3]||(h[3]=a("svg",{class:"rotate-90",width:"9",height:"11",viewBox:"0 0 9 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M4.6087 10.5L4.6087 1.46395",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M1.00004 4.05762L4.55764 0.500019L8.11523 4.05762",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})],-1))])])])]),_:1})]),_:1})])}}},Qt={class:"fct-usage-statistics-chart-wrap"},Zt={class:"fct-usage-statistics-info flex items-center justify-between"},Jt={class:"text-lg font-semibold text-system-dark dark:text-gray-50"},es={class:"text-xs font-medium text-system-mid dark:text-gray-300"},ts={class:"fct-custom-legend",style:{width:"100%"}},ss={style:{margin:"0 0 15px 0","font-size":"14px","font-weight":"600"}},as={class:"legend-items"},ls=["onClick","onMouseenter","onMouseleave"],ns={style:{flex:"1","min-width":"0"}},is={style:{display:"flex","justify-content":"space-between","align-items":"center"}},os=["title"],rs={class:"legend-item-percentage"},cs={class:"legend-item-count"},ds={class:"fct-custom-legend-controls"},us={class:"fct-action-link-btn"},_s={class:"fct-chart-container",style:{display:"flex","align-items":"flex-start"}},ms={__name:"UsageStatistics",props:{reportFilter:{type:Object},activatedSites:String|Number},setup(l){const t=l,i=K.colors;i.blue;const k=j(null),u=j("daily"),c=j("pie"),y=j([Q().startOf("month"),Q()]),v=j({}),b=ae(()=>z.data.pieChartData?z.data.pieChartData.map((x,C)=>({name:x.post_title,value:x.activation_count,percentage:x.percentage,color:S(C),visible:v.value[x.post_title]!==!1})):[]),S=x=>{const C=["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc","#ffb347"];return C[x%C.length]},V=ae(()=>z.data.pieChartData.filter(x=>v.value[x.post_title]!==!1).map((x,C)=>({value:x.activation_count,name:x.post_title,itemStyle:{color:S(z.data.pieChartData.findIndex(F=>F.post_title===x.post_title))}})));let L=null;const P=()=>{k.value&&L===null&&(L=Ee(k.value),p())},p=()=>{if(!L)return;const x={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",borderRadius:8,backgroundColor:K.isDark()?"#38485a":"#ffffff",textStyle:{color:K.isDark()?i.gray[25]:i.system.mid},borderColor:K.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"55%",center:["50%","50%"],data:V.value,label:{show:!0,color:K.isDark()?i.gray[25]:i.system.dark},emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},itemStyle:{emphasis:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};L.setOption(x,{notMerge:!0,replaceMerge:["series"]})},E=x=>{v.value[x.name]=!x.visible,X(()=>{p()})},w=(x,C)=>{L&&(C?L.dispatchAction({type:"highlight",name:x.name}):L.dispatchAction({type:"downplay",name:x.name}))},M=()=>{const x={startDate:y.value[0].toISOString(),endDate:y.value[1].toISOString()};z.getLicensePieChart({params:{...x,groupKey:u.value}})},f=()=>{z.data.pieChartData&&z.data.pieChartData.forEach(x=>{x.post_title in v.value||(v.value[x.post_title]=!0)})};de([()=>z.chartData,c],()=>{X(p)},{deep:!0}),de(()=>z.data.pieChartData,()=>{f(),X(()=>{p()})},{deep:!0});const h=x=>{p()};return ue(()=>{window.addEventListener("onFluentCartThemeChange",h),M(),X(P)}),pe(()=>{window.removeEventListener("onFluentCartThemeChange",h)}),(x,C)=>{const F=m("el-popover");return n(),_("div",Qt,[a("div",Zt,[a("div",Jt,[D(r(l.activatedSites)+" ",1),a("div",es,r(x.$t("Total Activated Sites")),1)]),e(F,{placement:"bottom-start",width:226,trigger:"click","popper-class":"fct-license-statistics-popover"},{reference:s(()=>[a("div",us,[e(me,null,{default:s(()=>[e(R,{name:"More"})]),_:1})])]),default:s(()=>[a("div",ts,[a("h4",ss,r(x.$t("License Distribution")),1),a("div",as,[(n(!0),_(U,null,N(b.value,A=>(n(),_("div",{key:A.name,class:ce(["legend-item",{"legend-item-hidden":!A.visible}]),onClick:J=>E(A),onMouseenter:J=>w(A,!0),onMouseleave:J=>w(A,!1),style:Ce({opacity:A.visible?1:.5})},[a("div",{class:"legend-color",style:Ce({backgroundColor:A.color})},null,4),a("div",ns,[a("div",is,[a("span",{class:"legend-item-name",title:A.name},r(A.name),9,os),a("span",rs,r(A.percentage)+"% ",1)]),a("div",cs,r(o(d)("%s licenses",A.value.toLocaleString())),1)])],46,ls))),128))]),a("div",ds,[a("button",{onClick:C[0]||(C[0]=()=>{Object.keys(v.value).forEach(A=>v.value[A]=!0),X(p)})},r(x.$t("Show All")),1),a("button",{onClick:C[1]||(C[1]=()=>{Object.keys(v.value).forEach(A=>v.value[A]=!1),X(p)})},r(x.$t("Hide All")),1)])])]),_:1})]),a("div",_s,[a("div",{class:"fct-usage-statistics-chart",ref_key:"chartRef",ref:k,style:{flex:"1",height:"350px"}},null,512)])])}}},ps=W(ms,[["__scopeId","data-v-c78810a7"]]),hs={},fs={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},gs={class:"flex items-center gap-2 mb-3"},vs={class:"right flex flex-col flex-1 gap-2"};function bs(l,t){const i=m("el-skeleton-item"),k=m("el-skeleton");return n(),_(U,null,N(4,u=>e(k,{animated:"",key:u},{template:s(()=>[a("div",fs,[a("div",gs,[e(i,{variant:"p",class:"rounded w-10 h-10 block"}),a("div",vs,[e(i,{variant:"p",class:"rounded w-4/5 block"}),e(i,{variant:"p",class:"rounded w-1/2 block"})])]),a("div",null,[e(i,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64)}const ys=W(hs,[["render",bs]]),ws={name:"LicensesStatsCard",props:{licenseOverview:{type:Object,required:!0},loading:{type:Boolean}},components:{DynamicIcon:R,LicenseStatLoader:ys},methods:{translate:d}},ks={class:"licenses-stats-card-head"},Ls={class:"licenses-icon"},Cs={class:"licenses-stats-card-head-content"},$s={class:"title"},xs={class:"value"},Ss={class:"text"};function Ds(l,t,i,k,u,c){const y=m("LicenseStatLoader"),v=m("DynamicIcon");return i.loading?(n(),$(y,{key:0})):(n(!0),_(U,{key:1},N(i.licenseOverview,(b,S)=>(n(),_("div",{class:ce(`licenses-stats-card ${S}`),key:S},[a("div",ks,[a("div",Ls,[e(v,{name:b.icon},null,8,["name"])]),a("div",Cs,[a("div",$s,r(c.translate(b.title)),1),a("div",xs,r(b.value),1)])]),a("div",Ss,r(c.translate(b.text)),1)],2))),128))}const Es=W(ws,[["render",Ds]]),Ps={name:"LicenseStats",props:{licenses:{type:Array,required:!0}},components:{DynamicIcon:R,CardBody:I,CardHeader:B,CardContainer:O,LicenseStatistics:Xt,UsageStatistics:ps,LicensesStatsCard:Es},data(){return{loading:!1,licenseSummary:{}}},methods:{translate:d,fetchSummary(){this.loading=!0,this.$get("reports/license-summary",{params:{start_date:Q().startOf("month").format("YYYY-MM-DD"),end_date:Q().format("YYYY-MM-DD")}}).then(l=>{this.licenseSummary=l.summaryData}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1})}},computed:{totalLicensedProducts(){var l;return((l=this.licenseSummary)==null?void 0:l.totalLicensedProducts)||0},totalActivatedSites(){var l;return((l=this.licenseSummary)==null?void 0:l.totalActivatedSites)||0},totalActiveLicense(){var l;return((l=this.licenseSummary)==null?void 0:l.totalActiveLicense)||this.licenses.filter(t=>t.status==="active").length},totalExpiredLicense(){var l;return((l=this.licenseSummary)==null?void 0:l.totalExpiredLicense)||this.licenses.filter(t=>t.status==="expired").length},totalInactiveLicense(){var l;return((l=this.licenseSummary)==null?void 0:l.totalInactiveLicense)||this.licenses.filter(t=>t.status==="inactive").length},licenseOverview(){return{"license-product":{title:"Licensed Product",value:this.totalLicensedProducts,text:`Active License ${this.totalActiveLicense}`,icon:"LicensedProduct"},"total-active":{title:"Total Active",value:this.totalActiveLicense,text:`New Active License ${this.totalActiveLicense}`,icon:"CheckCircle"},"total-expired":{title:"Total Expired",value:this.totalExpiredLicense,text:`New Expired License ${this.totalExpiredLicense}`,icon:"Warning"},"inactive-license":{title:"Inactive License",value:this.totalInactiveLicense,text:"Individual Sites",icon:"LicensedInactive"}}}},mounted(){this.fetchSummary()}},Vs={class:"fct-license-stats-wrap"},Ts={class:"licenses-stats-row"},As={class:"fct-usage-statistics-wrap"};function Us(l,t,i,k,u,c){const y=m("CardHeader"),v=m("LicensesStatsCard"),b=m("CardBody"),S=m("CardContainer"),V=m("LicenseStatistics"),L=m("el-col"),P=m("el-skeleton"),p=m("UsageStatistics"),E=m("el-row");return n(),_("div",Vs,[e(S,null,{default:s(()=>[e(y,{title:c.translate("Overall License Stats"),border_bottom:"",title_size:"small"},null,8,["title"]),e(b,null,{default:s(()=>[a("div",Ts,[e(v,{licenseOverview:c.licenseOverview,loading:u.loading},null,8,["licenseOverview","loading"])])]),_:1})]),_:1}),e(E,{gutter:30},{default:s(()=>[e(L,{md:24,lg:16},{default:s(()=>[e(V)]),_:1}),e(L,{md:24,lg:8},{default:s(()=>[e(S,null,{default:s(()=>[e(y,{title:c.translate("Usage Statistics"),border_bottom:"",title_size:"small"},null,8,["title"]),e(b,null,{default:s(()=>[a("div",As,[u.loading?(n(),$(P,{key:0,animated:"",rows:4})):(n(),$(p,{key:1,activatedSites:c.totalActivatedSites},null,8,["activatedSites"]))])]),_:1})]),_:1})]),_:1})]),_:1})])}const Ms=W(Ps,[["render",Us]]),Is={class:"table-cell"},Os={class:"w-full flex flex-col items-start justify-start gap-1"},Fs={class:"table-cell"},Bs={class:"w-full flex flex-col items-start justify-start gap-1"},Rs={class:"table-cell"},Ns={class:"table-cell"},js={class:"table-cell"},zs={__name:"LicensesLoader",props:{nextPageCount:{type:Number,default:0},licenseTable:{type:Object,default:()=>({})}},setup(l){const t=l,i=u=>t.licenseTable.columns.includes(u),k=Array.from({length:t.nextPageCount},(u,c)=>c+1);return(u,c)=>{const y=m("el-table-column"),v=m("el-skeleton-item"),b=m("el-table"),S=m("el-skeleton");return n(),$(S,{animated:""},{template:s(()=>[e(b,{data:o(k),class:"w-full compact-table responsive"},{empty:s(()=>c[0]||(c[0]=[])),default:s(()=>[g("",!0),e(y,{label:u.$t("License Key"),width:220},{default:s(()=>[a("div",Is,[a("div",Os,[e(v,{varient:"p",class:"w-1/5"}),e(v,{varient:"p",class:"w-3/5"})])])]),_:1},8,["label"]),i("product")!==-1?(n(),$(y,{key:1,width:200,label:u.$t("Product")},{default:s(()=>[a("div",Fs,[a("div",Bs,[e(v,{varient:"p",class:"w-1/5"}),e(v,{varient:"p",class:"w-2/5"})])])]),_:1},8,["label"])):g("",!0),i("order_id")!==-1?(n(),$(y,{key:2,width:80,label:u.$t("Order ID")},{default:s(()=>[a("div",Rs,[e(v,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("customer")!==-1?(n(),$(y,{key:3,width:100,label:u.$t("Customer")},{default:s(()=>[a("div",Ns,[e(v,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):g("",!0),e(y,{width:"100",label:u.$t("Activations")},{default:s(()=>[a("div",js,[e(v,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},Hs={},qs={class:"px-4 py-3"},Ks={class:"grid grid-cols-3 gap-5 mt-5"};function Ys(l,t){const i=m("el-skeleton-item"),k=m("el-skeleton");return n(),$(k,{animated:""},{template:s(()=>[a("div",qs,[(n(),_(U,null,N(2,u=>a("div",{key:u,class:"flex items-center justify-between mb-3"},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64)),a("div",Ks,[(n(),_(U,null,N(3,u=>a("div",{key:u},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const Ws=W(Hs,[["render",Ys]]),Gs={name:"LicenseTableMobile",components:{ProductInfo:Ze,UserCan:Z,RouteCell:je,DynamicIcon:R,IconButton:me,CopyToClipboard:_e,Empty:le,Badge:H},props:{licenses:{type:Array,required:!0},columns:{type:Array,default(){return["product","order_id","customer","date"]}},emptyText:{type:String,default:d("No Licenses found based on your filter")}},computed:{Clipboard(){return Te},formattedLicense(){return this.licenses.map(l=>{var t;return{...l,product:{...l.product,variation_title:((t=l.product_variant)==null?void 0:t.variation_title)||"n/a"}}})}},methods:{translate:d,formatDate:Y}},Xs={class:"fct-table-mobile-wrap fct-licenses-table-mobile"},Qs=["onClick"],Zs={class:"fct-table-status-col"},Js={key:0,class:"fct-table-date-col"},ea={key:0},ta={key:1},sa={class:"fct-table-mobile-body"},aa=["onClick"],la={class:"fct-license-key-wrap has-bg"},na={class:"fct-license-key"},ia={class:"fct-license-key-inner pr-2"},oa={class:"fct-table-mobile-footer"},ra={class:"fct-table-mobile-footer-row"},ca={key:0,class:"fct-table-id-col"},da={class:"title"},ua={key:1,class:"fct-table-customer-col"},_a={class:"title"},ma={class:"fct-table-activations-col"},pa={class:"title"},ha={key:0,class:"py-6 text-center"};function fa(l,t,i,k,u,c){const y=m("Badge"),v=m("ProductInfo"),b=m("router-link"),S=m("DynamicIcon"),V=m("el-tooltip"),L=m("Empty"),P=m("UserCan");return n(),$(P,{permission:"licenses/view"},{default:s(()=>[a("div",Xs,[(n(!0),_(U,null,N(c.formattedLicense,(p,E)=>(n(),_("div",{key:p.id,class:"fct-table-mobile-row"},[a("div",{class:"fct-table-mobile-header",onClick:w=>l.$router.push({name:"view_license",params:{license_id:p==null?void 0:p.id}})},[a("div",Zs,[(n(),$(y,{status:p.status,key:p.id},null,8,["status"]))]),i.columns.indexOf("date")!==-1?(n(),_("div",Js,[a("span",null,r(c.formatDate(p.created_at)),1),t[0]||(t[0]=a("span",{class:"px-1"},"-",-1)),p.expiration_date?(n(),_("span",ea,r(c.formatDate(p.expiration_date)),1)):(n(),_("span",ta,r(c.translate("Lifetime")),1))])):g("",!0)],8,Qs),a("div",sa,[i.columns.indexOf("product")!==-1?(n(),_("div",{key:0,class:"fct-table-product-col",onClick:w=>l.$router.push({name:"view_license",params:{license_id:p==null?void 0:p.id}})},[e(v,{product:p.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])],8,aa)):g("",!0),a("div",la,[a("div",na,[a("div",ia,[e(b,{class:"link",to:{name:"view_license",params:{license_id:p==null?void 0:p.id}}},{default:s(()=>[D(r(p.license_key),1)]),_:2},1032,["to"])]),e(V,{content:p.license_key,placement:"top","popper-class":"fct-tooltip"},{default:s(()=>[e(S,{class:"cursor-pointer p-1 w-6 h-6",name:"Copy",onClick:()=>{c.Clipboard.copy(p.license_key,{successMessage:c.translate("License Key copied to clipboard"),errorMessage:c.translate("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])])]),a("div",oa,[a("div",ra,[i.columns.indexOf("order_id")!==-1?(n(),_("div",ca,[a("div",da,r(c.translate("Order ID")),1),e(b,{class:"value",to:{name:"view_order",params:{order_id:p.order_id}}},{default:s(()=>[D(" #"+r(p.order_id),1)]),_:2},1032,["to"])])):g("",!0),i.columns.indexOf("customer")!==-1?(n(),_("div",ua,[a("div",_a,r(c.translate("Customer")),1),e(b,{class:"value",to:{name:"view_customer",params:{customer_id:p.customer_id}}},{default:s(()=>{var w;return[D(r(((w=p==null?void 0:p.customer)==null?void 0:w.full_name)||c.translate("No Name")),1)]}),_:2},1032,["to"])])):g("",!0),a("div",ma,[a("div",pa,r(c.translate("Activations")),1),e(b,{class:"value",to:{name:"view_license",params:{license_id:p==null?void 0:p.id}}},{default:s(()=>[D(r(p.activation_count)+" "+r("/")+" "+r(p.limit===0?"Unlimited":p.limit),1)]),_:2},1032,["to"])])])])]))),128)),c.formattedLicense.length===0?(n(),_("div",ha,[e(L,{icon:"Empty/ListView","has-dark":"",text:i.emptyText},null,8,["text"])])):g("",!0)])]),_:1})}const ga=W(Gs,[["render",fa]]),va={class:"fct-all-license-page fct-layout-width"},ba={class:"fct-all-license-wrap"},ya={key:1},wa={__name:"Licenses",setup(l){const t=Rt(),i=j(!1),k=j(!1),u=j(!1),c=(L=!0)=>{const P=t.buildQueryParams();return L||(delete P.active_view,delete P.filter_type,delete P.search,delete P.advanced_filters),P},y=Je({entity:"licenses",buildParams:()=>c(),buildAllParams:()=>c(!1),filenamePrefix:"licenses-export"}),v=({scope:L,columns:P,modules:p,format:E})=>{const w=L==="current_page"?t.getTableData().map(M=>M.id).filter(Boolean):[];y.startExport({scope:L,ids:w,columns:P,modules:p,format:E})},b=()=>{k.value=window.innerWidth<768},S=L=>{L==="show_license_stats"&&(xe.set("show_license_stats",!i.value),i.value=!i.value)},V=()=>{const L=xe.get("show_license_stats");L&&(i.value=L)};return ue(()=>{V(),b(),window.addEventListener("resize",b)}),pe(()=>{window.removeEventListener("resize",b)}),(L,P)=>{const p=m("el-button"),E=m("router-link"),w=m("el-icon"),M=m("el-dropdown-item"),f=m("el-dropdown-menu"),h=m("el-dropdown");return n(),_("div",va,[e(Ke,{title:o(d)("Licenses")},{action:s(()=>[e(E,{to:{name:"activated_sites"}},{default:s(()=>[e(p,null,{default:s(()=>[e(R,{name:"Sites"}),D(" "+r(o(d)("Sites")),1)]),_:1})]),_:1}),e(Z,{permission:["reports/view","licenses/export"]},{default:s(()=>[e(h,{trigger:"click","popper-class":"fct-dropdown",onCommand:S,placement:"bottom-end"},{dropdown:s(()=>[e(f,null,{default:s(()=>[e(Z,{permission:"reports/view"},{default:s(()=>[e(M,{command:"show_license_stats"},{default:s(()=>[i.value?(n(),_(U,{key:1},[e(R,{name:"EyeOff"}),D(" "+r(o(d)("Hide License Stats")),1)],64)):(n(),_(U,{key:0},[e(R,{name:"Eye"}),D(" "+r(o(d)("Show License Stats")),1)],64))]),_:1})]),_:1}),e(Z,{permission:"licenses/export"},{default:s(()=>[e(M,{onClick:P[0]||(P[0]=x=>u.value=!0)},{default:s(()=>[e(R,{name:"Download"}),D(" "+r(o(d)("Export Licenses")),1)]),_:1})]),_:1})]),_:1})]),default:s(()=>[e(p,null,{default:s(()=>[D(r(o(d)("More actions"))+" ",1),e(w,null,{default:s(()=>[e(o(Xe))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["title"]),e(Z,{permission:"reports/view"},{default:s(()=>[i.value?(n(),$(Ms,{key:0,licenses:o(t).getTableData()},null,8,["licenses"])):g("",!0)]),_:1}),e(Z,{permission:"licenses/view"},{default:s(()=>[a("div",ba,[e(Ve,{table:o(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:s(()=>[o(t).isLoading()?(n(),$(Ws,{key:0})):g("",!0),o(t).isLoading()?g("",!0):(n(),$(ga,{key:1,licenses:o(t).getTableData(),columns:o(t).data.columns},null,8,["licenses","columns"]))]),default:s(()=>[o(t).isLoading()?(n(),$(zs,{key:0,licenseTable:o(t),"next-page-count":o(t).nextPageCount},null,8,["licenseTable","next-page-count"])):(n(),_("div",ya,[e(et,{licenses:o(t).getTableData(),columns:o(t).data.columns},null,8,["licenses","columns"])]))]),_:1},8,["table"])])]),_:1}),e(tt,{modelValue:u.value,"onUpdate:modelValue":P[1]||(P[1]=x=>u.value=x),title:o(d)("Export Licenses"),"current-page-count":o(t).getTableData().length,"total-count":o(t).data.paginate.total,"item-label-singular":o(d)("license"),"item-label-plural":o(d)("licenses"),"has-active-filter":!!o(t).isFiltering(),"export-state":o(y),onExport:v},null,8,["modelValue","title","current-page-count","total-count","item-label-singular","item-label-plural","has-active-filter","export-state"])])}}},ka={class:"el-form--label-top fct-plan-changer-content-wrap"},La={key:0},Ca=["innerHTML"],$a={key:1},xa=["innerHTML"],Sa={key:1,class:"fct-btn-group"},Da={__name:"PlanChanger",props:{variations:{},product_id:"",variation_id:"",license:null,order:null,upgrade_path_base:""},setup(l){const t=l,i=j(!1),k=()=>{i.value=!0},u=Fe().ctx,c=j(""),y=j([]);let v=j(null);const b=ae(()=>{var f,h;return re.get("shop.currency_sign")?re.get("shop.currency_sign"):(h=(f=window.fluentcart_customer_profile_vars)==null?void 0:f.shop)!=null&&h.currency_sign?window.fluentcart_customer_profile_vars.shop.currency_sign:""}),S=ae(()=>{var f;return(f=t.order)==null?void 0:f.order_items.find(h=>h.payment_type==="subscription"||h.payment_type==="adjustment"||h.payment_type==="onetime")}),V=function(f){let h="";const x=f==null?void 0:f.payment_type,C=f==null?void 0:f.other_info;if((C==null?void 0:C.payment_type)==="subscription"&&x!=="adjustment"){(C==null?void 0:C.manage_setup_fee)==="yes"&&(h+=C.signup_fee_name+" : "+b.value+parseFloat(C.signup_fee/100)+", ");const F=Number(C==null?void 0:C.times)?(C==null?void 0:C.times)+" times":", Until Cancel";return h+=(f==null?void 0:f.formatted_total)+" Subscriptions "+C.repeat_interval+" "+F,h}else if((C==null?void 0:C.payment_type)==="subscription"&&x==="adjustment"){(C==null?void 0:C.manage_setup_fee)==="yes"&&(h+=C.signup_fee_name+" :"+parseFloat(C.signup_fee/100)+", ");const F=Number(C==null?void 0:C.times)?(C==null?void 0:C.times)+" times":", Until Cancel";return h+=(f==null?void 0:f.formatted_total)+" Subscriptions "+C.repeat_interval+" "+F,h}else if((C==null?void 0:C.payment_type)==="onetime")return h+=(f==null?void 0:f.formatted_total)+" One Time Payment";return f==null?void 0:f.other_info.billing_summary};let L=j("");const P=f=>{v=t.variations.find(h=>h.id.toString()===f),L.value=V(v)},p=f=>{var x,C;return((x=f==null?void 0:f.other_info)==null?void 0:x.payment_type)==="subscription"?(f==null?void 0:f.variation_title)+" - "+nt.capitalize((C=f==null?void 0:f.other_info)==null?void 0:C.repeat_interval):(f==null?void 0:f.variation_title)+" - One Time Payment"},E=()=>{u.$get(`products/${t.product_id}/upgrade-paths`,{variation_id:t.variation_id}).then(f=>{f.data.forEach((h,x)=>{h.object_id===t.variation_id&&h.value.to_variants.forEach((C,F)=>{y.value.push({id:C,variation_title:p(t.variations.find(A=>A.id.toString()===C)),payment_type:h.payment_type,is_prorate:h.value.is_prorate,discount_amount:h.value.discount_amount})})})})},w=f=>{let h=f.discount_amount;return h>0?f.variation_title+" - "+(f.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")+" ( "+h+b.value+" discount )":f.variation_title+" - "+(f.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")};ue(()=>{E()});const M=()=>{if(c.value){const f=new URL(t.upgrade_path_base);return f.searchParams.append("order_hash",t.order.uuid),f.searchParams.append("mode","upgrade_plan"),f.searchParams.append("variation_id",c.value),f.href}return!1};return(f,h)=>{const x=m("el-button"),C=m("el-option"),F=m("el-select"),A=m("el-form-item"),J=m("el-dialog");return y.value.length>0&&S.value?(n(),_(U,{key:0},[e(x,{class:"el-button--x-small",onClick:k,type:"primary"},{default:s(()=>[D(r(f.$t("Change Plan")),1)]),_:1}),e(J,{modelValue:i.value,"onUpdate:modelValue":h[1]||(h[1]=G=>i.value=G),title:f.$t("Change Plan"),"append-to-body":!0},{default:s(()=>[a("div",ka,[y.value.length>0?(n(),$(A,{key:0,label:f.$t("Change Plan to")},{default:s(()=>[e(F,{modelValue:c.value,"onUpdate:modelValue":h[0]||(h[0]=G=>c.value=G),onChange:P,clearable:""},{default:s(()=>[(n(!0),_(U,null,N(y.value,G=>(n(),$(C,{key:G.id,label:w(G),value:G.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):g("",!0),e(A,{label:f.$t("New Plan")},{default:s(()=>[o(L)?(n(),_("span",La,[a("span",{innerHTML:o(L),class:"fct-plan-changer-text"},null,8,Ca)])):(n(),_("span",$a,"---"))]),_:1},8,["label"]),e(A,{label:f.$t("Current Plan")},{default:s(()=>[a("span",{innerHTML:V(S.value),class:"fct-plan-changer-text"},null,8,xa)]),_:1},8,["label"]),M()?(n(),_("div",Sa,[e(x,{type:"primary",tag:"a",href:M(),target:"_blank",rel:"noopener noreferrer",size:"small"},{default:s(()=>[D(r(f.$t(" Upgrade to New Plan")),1)]),_:1},8,["href"]),e(_e,{showMode:"basic_copy_btn",text:M()},null,8,["text"])])):g("",!0)])]),_:1},8,["modelValue","title"])],64)):g("",!0)}}},Ea={name:"UpgradePlan",components:{CopyToClipboard:_e,DynamicIcon:R},props:{variation_id:{type:[String,Number],required:!0},is_admin:{type:Boolean,required:!1,default:!1},product_id:{type:[String,Number],required:!0},order:{type:Object,required:!0},has_upgrades:{type:Boolean,required:!0},props_variations:{type:[Array,Object],required:!0},endpoint_path:{type:String,default:"products"},appendToBody:{type:Boolean,default:!0}},data(){return{variations:this.props_variations,upgradePlanModal:!1,selectedUpgradePath:"",upgradePaths:[]}},computed:{currencySign(){var l,t;return re.get("shop.currency_sign")?re.get("shop.currency_sign"):(t=(l=window.fluentcart_customer_profile_vars)==null?void 0:l.shop)!=null&&t.currency_sign?window.fluentcart_customer_profile_vars.shop.currency_sign:""}},methods:{translate:d,showUpgradePlanModal(){Ae.get(`${this.endpoint_path}/variation/${this.variation_id}/upgrade-paths`,{params:{variation_id:this.variation_id,order_hash:this.order.uuid}}).then(l=>{this.upgradePaths=l.upgradePaths,this.upgradePlanModal=!0})},closeUpgradePlanModal(){this.upgradePlanModal=!1}}},Pa={class:"fct-upgrade-plan"},Va={key:0,class:"fct-upgrade-variation-table"},Ta={class:"upgrade-title"},Aa={class:"plan-price"},Ua={class:"plan-price"},Ma={class:"upgrade-cost"},Ia={class:"upgrade-title"},Oa=["innerHTML"],Fa={key:0,class:"upgrade-text"},Ba={class:"upgrade-action"},Ra={key:1};function Na(l,t,i,k,u,c){const y=m("el-button"),v=m("el-table-column"),b=m("el-table"),S=m("el-dialog");return n(),_("div",Pa,[i.has_upgrades?(n(),$(y,{key:0,size:"small",onClick:c.showUpgradePlanModal},{default:s(()=>[D(r(l.$t("Upgrade")),1)]),_:1},8,["onClick"])):g("",!0),e(S,{modelValue:u.upgradePlanModal,"onUpdate:modelValue":t[0]||(t[0]=V=>u.upgradePlanModal=V),"append-to-body":i.appendToBody,title:l.$t("Upgrade"),class:"fct-upgrade-plan-dialog fluent-cart-customer-profile-app"},{default:s(()=>[u.upgradePaths.length>0?(n(),_("div",Va,[e(b,{data:u.upgradePaths,style:{width:"100%"}},{default:s(()=>[e(v,{label:l.$t("Package"),width:290},{default:s(V=>[a("div",Ta,r(V.row.title),1)]),_:1},8,["label"]),e(v,{label:l.$t("Price"),width:100},{default:s(V=>[a("div",Aa,[a("div",Ua,r(l.formatNumber(V.row.price,i.order.currency)),1)])]),_:1},8,["label"]),e(v,{label:l.$t("Amount to pay")},{default:s(V=>[a("div",Ma,[a("div",Ia,[a("span",{innerHTML:V.row.payment_summary},null,8,Oa),V.row.prorate_credit?(n(),_("div",Fa)):g("",!0)])])]),_:1},8,["label"]),e(v,{label:l.$t("Action"),width:110},{default:s(V=>[a("div",Ba,[e(y,{class:"el-button--x-small",tag:"a",href:V.row.upgrade_url,target:"_blank"},{default:s(()=>[D(r(l.$t("Upgrade")),1)]),_:2},1032,["href"])])]),_:1},8,["label"])]),_:1},8,["data"])])):(n(),_("div",Ra,r(l.$t("No upgrade plan found")),1))]),_:1},8,["modelValue","append-to-body","title"])])}const ja=W(Ea,[["render",Na]]),za={name:"LicenseInformation",components:{Badge:H,CopyToClipboard:_e,DynamicIcon:R,IconButton:me,PlanChanger:Da,UpgradePlan:ja},props:{license:"license",customerId:"customerId",license_id:"license_id",activations:"activations",product:null,order:null,upgrade_path_base:""},data(){return{isDateSelected:!1,isCalendarOpen:!1,selectedDate:null,loading:!1,isConfirmationIconEnable:!1,limit:this.license.limit,variations:[],variation_id:this.license.variation_id+"",licenseLifetime:!1,isExpirationDateEnable:!1,isActivationLimitEnable:!1}},watch:{product:{handler(){var l;(l=this.product)!=null&&l.variants&&(this.variations=this.product.variants)},deep:!0,immediate:!0}},methods:{translate:d,formatDate:Y,translateNumber:d,handleToggleExpirationDate(){this.isExpirationDateEnable=!this.isExpirationDateEnable},handleToggleActivationLimit(){this.isActivationLimitEnable=!this.isActivationLimitEnable},handleLifetimeLicense(){this.$confirm(this.$t("Are you sure you want to mark license as lifetime?"),this.$t("Confirm!"),{cancelButtonText:this.$t("No,Thanks"),confirmButtonText:this.$t("Confirm"),type:"warning"}).then(()=>{this.markAsLifetime()}).catch(()=>{this.licenseLifetime=!1})},handleActivationLimit(){this.$confirm(this.$t("Are you sure you want to mark limit as unlimited?"),this.$t("Confirm!"),{cancelButtonText:this.$t("No,Thanks"),confirmButtonText:this.$t("Confirm"),type:"warning"}).then(()=>{this.markAsUnlimited()}).catch(()=>{})},handleDateChange(){this.newExpirationDate=Q(this.selectedDate).format("YYYY-MM-DD HH:mm:ss"),this.extendValidity()},handleLimitChange(){this.isConfirmationIconEnable=!0},markAsLifetime(){this.licenseLifetime=!0,this.newExpirationDate="lifetime",this.extendValidity()},markAsUnlimited(){this.activationLimitUnlimited=!0,this.limit="unlimited",this.updateLimit()},regenerateLicenseKey(){this.$post("licensing/licenses/"+this.license_id+"/regenerate-key").then(l=>{this.$emit("fetchLicense"),this.handleSuccess(l.message)}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1})},extendValidity(){this.$post("licensing/licenses/"+this.license_id+"/extend-validity",{expiration_date:this.newExpirationDate}).then(l=>{this.newExpirationDate=null,this.$emit("fetchLicense"),this.handleSuccess(l.message),this.selectedDate=null,this.licenseLifetime=!0}).catch(l=>{this.handleError(l),this.licenseLifetime=!1}).finally(()=>{this.loading=!1})},updateLimit(){this.$post("licensing/licenses/"+this.license_id+"/update_limit",{limit:this.limit}).then(l=>{this.$emit("fetchLicense"),this.handleSuccess(l.message),this.isConfirmationIconEnable=!1}).catch(l=>{this.handleError(l),this.isConfirmationIconEnable=!1}).finally(()=>{this.loading=!1})},resetLimit(){this.limit=this.license.limit,this.isConfirmationIconEnable=!1}},mounted(){var t;const l=(t=this.$refs.calendar)==null?void 0:t.$el.querySelector("input");l&&l.addEventListener("keydown",i=>{i.key==="Enter"&&this.handleDateChange()})}},Ha={class:"fct-license-info-content"},qa={class:"flex items-center gap-2"},Ka={class:"fct-input-with-action-wrap"},Ya={class:"fct-input-with-action"},Wa={class:"fct-license-product"},Ga={class:"text-xs"},Xa={class:"fct-license-inline-action-wrap"},Qa={key:1,class:"text"},Za={key:2,class:"separator"},Ja={class:"inline-action-button"},el={class:"text"},tl={class:"fct-license-inline-action-wrap"},sl={key:0,class:"inline-action-input-group mr-2"},al={key:0,class:"fct-license-activation-limit-actions"},ll={key:1,class:"text"},nl={key:2,class:"separator"},il={class:"inline-action-button"},ol={class:"text"},rl={class:"fct-license-info-form-show-on-mobile"},cl={class:"fct-license-info-mobile-header"},dl={class:"fct-license-info-mobile-body"},ul={key:0,class:"fct-license-product"},_l={class:"text-xs text-system-mid dark:text-gray-300"},ml={class:"fct-input-with-action-wrap"},pl={class:"fct-input-with-action"},hl={class:"fct-input-with-action-icon"},fl={class:"fct-license-info-mobile-footer"},gl={class:"fct-license-info-mobile-footer-item"},vl={class:"title"},bl={class:"fct-license-inline-action-wrap"},yl={key:1,class:"text"},wl={key:2,class:"separator"},kl={class:"inline-action-button"},Ll={class:"text"},Cl={class:"fct-license-info-mobile-footer-item"},$l={class:"title"},xl={class:"fct-license-inline-action-wrap"},Sl={key:0,class:"inline-action-input-group mr-2"},Dl={key:0,class:"fct-license-activation-limit-actions"},El={key:1,class:"text"},Pl={key:2,class:"separator"},Vl={class:"inline-action-button"},Tl={class:"text"};function Al(l,t,i,k,u,c){var F,A,J,G,fe,ge,ve,be;const y=m("CopyToClipboard"),v=m("el-input"),b=m("DynamicIcon"),S=m("el-button"),V=m("el-popconfirm"),L=m("el-form-item"),P=m("el-col"),p=m("router-link"),E=m("UpgradePlan"),w=m("el-date-picker"),M=m("el-input-number"),f=m("IconButton"),h=m("el-row"),x=m("el-form"),C=m("Badge");return n(),_("div",Ha,[e(x,{class:"fct-license-info-form-hide-on-mobile",model:i.license,"label-position":"top"},{default:s(()=>[e(h,null,{default:s(()=>[e(P,{lg:24},{default:s(()=>[e(L,{label:""},{label:s(()=>[a("div",qa,[D(r(c.translate("License Key"))+" ",1),e(y,{text:i.license.license_key,showMode:"basic_copy_btn",tooltipText:c.translate("Copy License")},null,8,["text","tooltipText"])])]),default:s(()=>[a("div",Ka,[e(v,{modelValue:i.license.license_key,"onUpdate:modelValue":t[0]||(t[0]=T=>i.license.license_key=T),disabled:""},null,8,["modelValue"]),a("div",Ya,[e(V,{width:"250","confirm-button-text":c.translate("Confirm"),"cancel-button-text":c.translate("No, Thanks"),title:c.translate("Are you sure to regenerate?"),onConfirm:c.regenerateLicenseKey},{reference:s(()=>[e(S,{class:"el-button--x-small",plain:""},{default:s(()=>[e(b,{name:"Reload"}),D(" "+r(c.translate("Regenerate")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),_:1})]),_:1}),e(P,{lg:24},{default:s(()=>[i.product!=null?(n(),$(L,{key:0,label:c.translate("Product Name")},{default:s(()=>{var T;return[a("div",Wa,[e(p,{class:"link",to:{name:"product_edit",params:{product_id:i.product.ID}}},{default:s(()=>{var ee;return[D(r(i.product.post_title)+" ",1),a("span",Ga," – "+r((ee=u.variations.find(ie=>ie.id==i.license.variation_id))==null?void 0:ee.variation_title),1)]}),_:1},8,["to"]),((T=u.variations)==null?void 0:T.length)>0?(n(),$(E,{key:0,variation_id:u.variation_id,product_id:i.product.ID,order:i.order,props_variations:u.variations,endpoint_path:"products",has_upgrades:i.license.has_upgrades&&!["expired","disabled"].includes(i.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):g("",!0)])]}),_:1},8,["label"])):g("",!0)]),_:1}),e(P,{lg:12},{default:s(()=>[e(L,{label:c.translate("Purchase Date")},{default:s(()=>{var T;return[a("span",null,r(c.formatDate((T=i.license)==null?void 0:T.created_at)),1)]}),_:1},8,["label"])]),_:1}),e(P,{lg:12},{default:s(()=>[e(L,{label:c.translate("Expirations date")},{default:s(()=>{var T,ee,ie,ye,we,ke;return[a("div",Xa,[u.isExpirationDateEnable?(n(),$(w,{key:0,modelValue:u.selectedDate,"onUpdate:modelValue":t[1]||(t[1]=ne=>u.selectedDate=ne),placeholder:c.formatDate((T=i.license)==null?void 0:T.expiration_date)?c.formatDate((ee=i.license)==null?void 0:ee.expiration_date):c.translate("Lifetime"),"default-value":(ie=i.license)==null?void 0:ie.expiration_date,type:"date",ref:"calendar",onChange:c.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(n(),_("span",Qa,r((ye=i.license)!=null&&ye.expiration_date?c.formatDate((we=i.license)==null?void 0:we.expiration_date):"Lifetime"),1)),u.isExpirationDateEnable?g("",!0):(n(),_("span",Za)),a("div",Ja,[a("a",{href:"#",onClick:t[2]||(t[2]=q((...ne)=>c.handleToggleExpirationDate&&c.handleToggleExpirationDate(...ne),["prevent"]))},r(u.isExpirationDateEnable?c.translate("Cancel"):c.translate("Edit")),1),!u.isExpirationDateEnable&&((ke=i.license)!=null&&ke.expiration_date)?(n(),_(U,{key:0},[a("span",el,r(c.translate("or")),1),a("a",{href:"#",onClick:t[3]||(t[3]=q((...ne)=>c.handleLifetimeLicense&&c.handleLifetimeLicense(...ne),["prevent"]))},r(c.translate("Mark as lifetime")),1)],64)):g("",!0)])])]}),_:1},8,["label"])]),_:1}),e(P,{lg:12},{default:s(()=>[e(L,{label:c.translate("Activation Limit")},{default:s(()=>[a("div",tl,[u.isActivationLimitEnable?(n(),_("div",sl,[e(M,{modelValue:u.limit,"onUpdate:modelValue":t[4]||(t[4]=T=>u.limit=T),min:0,"controls-position":"right",onChange:c.handleLimitChange,onKeyup:c.handleLimitChange},{"decrease-icon":s(()=>[e(b,{class:"w-3",name:"ChevronDown"})]),"increase-icon":s(()=>[e(b,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),u.isConfirmationIconEnable?(n(),_("div",al,[e(f,{tag:"button",onClick:q(c.updateLimit,["prevent"])},{default:s(()=>[e(b,{name:"Check"})]),_:1},8,["onClick"]),e(f,{tag:"button",onClick:q(c.resetLimit,["prevent"])},{default:s(()=>[e(b,{name:"Cross"})]),_:1},8,["onClick"])])):g("",!0)])):g("",!0),u.isActivationLimitEnable?g("",!0):(n(),_("span",ll,r(c.translateNumber(i.license.activation_count))+" / "+r(u.limit!=0?u.limit:c.translate("Unlimited")),1)),u.isActivationLimitEnable?g("",!0):(n(),_("span",nl)),a("div",il,[a("a",{href:"#",onClick:t[5]||(t[5]=q((...T)=>c.handleToggleActivationLimit&&c.handleToggleActivationLimit(...T),["prevent"]))},r(u.isActivationLimitEnable?c.translate("Cancel"):c.translate("Edit")),1),!u.isActivationLimitEnable&&u.limit!=0?(n(),_(U,{key:0},[a("span",ol,r(c.translate("or")),1),a("a",{href:"#",onClick:t[6]||(t[6]=q((...T)=>c.handleActivationLimit&&c.handleActivationLimit(...T),["prevent"]))},r(c.translate("Mark as unlimited")),1)],64)):g("",!0)])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["model"]),a("div",rl,[a("div",cl,[e(C,{status:i.license.status,size:"small"},null,8,["status"]),a("span",null,r(c.translate("Purchase Date"))+": "+r(c.formatDate((F=i.license)==null?void 0:F.created_at)),1)]),a("div",dl,[i.product!=null?(n(),_("div",ul,[e(p,{class:"link",to:{name:"product_edit",params:{product_id:i.product.ID}}},{default:s(()=>{var T;return[D(r(i.product.post_title)+" ",1),a("span",_l," – "+r((T=u.variations.find(ee=>ee.id==i.license.variation_id))==null?void 0:T.variation_title),1)]}),_:1},8,["to"]),((A=u.variations)==null?void 0:A.length)>0?(n(),$(E,{key:0,variation_id:u.variation_id,product_id:i.product.ID,order:i.order,props_variations:u.variations,endpoint_path:"products",has_upgrades:i.license.has_upgrades&&!["expired","disabled"].includes(i.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):g("",!0)])):g("",!0),a("div",ml,[e(v,{modelValue:i.license.license_key,"onUpdate:modelValue":t[7]||(t[7]=T=>i.license.license_key=T),readonly:""},null,8,["modelValue"]),a("div",pl,[e(V,{width:"250","confirm-button-text":c.translate("Confirm"),"cancel-button-text":c.translate("No, Thanks"),title:c.translate("Are you sure to regenerate?"),onConfirm:c.regenerateLicenseKey},{reference:s(()=>[a("div",hl,[e(b,{name:"Reload"})])]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),a("div",fl,[a("div",gl,[a("div",vl,r(c.translate("Expirations date")),1),a("div",bl,[u.isExpirationDateEnable?(n(),$(w,{key:0,modelValue:u.selectedDate,"onUpdate:modelValue":t[8]||(t[8]=T=>u.selectedDate=T),placeholder:c.formatDate((J=i.license)==null?void 0:J.expiration_date)?c.formatDate((G=i.license)==null?void 0:G.expiration_date):c.translate("Lifetime"),"default-value":(fe=i.license)==null?void 0:fe.expiration_date,type:"date",ref:"calendar",onChange:c.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(n(),_("span",yl,r((ge=i.license)!=null&&ge.expiration_date?c.formatDate((ve=i.license)==null?void 0:ve.expiration_date):"Lifetime"),1)),u.isExpirationDateEnable?g("",!0):(n(),_("span",wl)),a("div",kl,[a("a",{href:"#",onClick:t[9]||(t[9]=q((...T)=>c.handleToggleExpirationDate&&c.handleToggleExpirationDate(...T),["prevent"]))},r(u.isExpirationDateEnable?c.translate("Cancel"):c.translate("Edit")),1),!u.isExpirationDateEnable&&((be=i.license)!=null&&be.expiration_date)?(n(),_(U,{key:0},[a("span",Ll,r(c.translate("or")),1),a("a",{href:"#",onClick:t[10]||(t[10]=q((...T)=>c.handleLifetimeLicense&&c.handleLifetimeLicense(...T),["prevent"]))},r(c.translate("Mark as lifetime")),1)],64)):g("",!0)])])]),a("div",Cl,[a("div",$l,r(c.translate("Activation Limit")),1),a("div",xl,[u.isActivationLimitEnable?(n(),_("div",Sl,[e(M,{modelValue:u.limit,"onUpdate:modelValue":t[11]||(t[11]=T=>u.limit=T),min:0,"controls-position":"right",onChange:c.handleLimitChange,onKeyup:c.handleLimitChange},{"decrease-icon":s(()=>[e(b,{class:"w-3",name:"ChevronDown"})]),"increase-icon":s(()=>[e(b,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),u.isConfirmationIconEnable?(n(),_("div",Dl,[e(f,{tag:"button",onClick:q(c.updateLimit,["prevent"])},{default:s(()=>[e(b,{name:"Check"})]),_:1},8,["onClick"]),e(f,{tag:"button",onClick:q(c.resetLimit,["prevent"])},{default:s(()=>[e(b,{name:"Cross"})]),_:1},8,["onClick"])])):g("",!0)])):g("",!0),u.isActivationLimitEnable?g("",!0):(n(),_("span",El,r(c.translateNumber(i.license.activation_count))+" / "+r(u.limit!=0?u.limit:c.translate("Unlimited")),1)),u.isActivationLimitEnable?g("",!0):(n(),_("span",Pl)),a("div",Vl,[a("a",{href:"#",onClick:t[12]||(t[12]=q((...T)=>c.handleToggleActivationLimit&&c.handleToggleActivationLimit(...T),["prevent"]))},r(u.isActivationLimitEnable?c.translate("Cancel"):c.translate("Edit")),1),!u.isActivationLimitEnable&&u.limit!=0?(n(),_(U,{key:0},[a("span",Tl,r(c.translate("or")),1),a("a",{href:"#",onClick:t[13]||(t[13]=q((...T)=>c.handleActivationLimit&&c.handleActivationLimit(...T),["prevent"]))},r(c.translate("Mark as unlimited")),1)],64)):g("",!0)])])])])])])}const Ul=W(za,[["render",Al]]),Ml={name:"ActivatedSiteInformation",props:["activatedSites","modelValue","activationLimit","activationCount"],computed:{Link(){return Qe}},components:{IconButton:me,DynamicIcon:R,Badge:H,Empty:le},methods:{formatDate:Y,updateModelValue(l){this.$emit("update:modelValue",l)},activateSite(){this.$emit("siteActivated")},deactivateSite(l){this.$emit("siteDeactivated",l)}}},Il={class:"fct-activated-site-url-container grid gap-5"},Ol={key:0,class:"-mx-6 -mb-6 fct-license-site-url-table-wrap"},Fl={key:1},Bl={key:0,class:"fct-license-site-last-update"},Rl={key:0,class:"version"},Nl={key:1,class:"date"},jl={key:1};function zl(l,t,i,k,u,c){const y=m("router-link"),v=m("Badge"),b=m("el-table-column"),S=m("DynamicIcon"),V=m("IconButton"),L=m("el-popconfirm"),P=m("el-table"),p=m("Empty");return n(),_("div",Il,[i.activatedSites.length>0?(n(),_("div",Ol,[e(P,{data:i.activatedSites,class:"w-full"},{default:s(()=>[e(b,{label:l.$t("Site URL"),width:"360"},{default:s(E=>[E.row.site_id?(n(),$(y,{key:0,class:"link",to:{name:"view_site",params:{site_id:E.row.site_id}}},{default:s(()=>[D(r(E.row.site_url),1)]),_:2},1032,["to"])):(n(),_("span",Fl,r(E.row.site_url),1)),E.row.is_local&&E.row.is_local!="0"?(n(),$(v,{key:2,status:"warning",size:"small","hide-icon":!0,text:l.$t("local"),style:{"margin-left":"10px"}},null,8,["text"])):g("",!0)]),_:1},8,["label"]),e(b,{label:l.$t("Status"),width:"100"},{default:s(E=>[e(v,{status:E.row.status,size:"small"},null,8,["status"])]),_:1},8,["label"]),e(b,{label:l.$t("Activated at"),width:"140"},{default:s(E=>[a("span",null,r(c.formatDate(E.row.created_at)),1)]),_:1},8,["label"]),e(b,{label:l.$t("Last Update"),width:"150"},{default:s(E=>[E.row.last_update_version||E.row.last_update_date?(n(),_("div",Bl,[E.row.last_update_version?(n(),_("span",Rl,r(E.row.last_update_version),1)):g("",!0),E.row.last_update_date?(n(),_("span",Nl,r(c.formatDate(E.row.last_update_date)),1)):g("",!0)])):(n(),_("span",jl,"—"))]),_:1},8,["label"]),e(b,{width:"100"},{default:s(E=>[a("span",null,[e(L,{width:"200","confirm-button-text":l.$t("Confirm"),"cancel-button-text":l.$t("No, Thanks"),title:l.$t("Are you sure?"),onConfirm:w=>c.deactivateSite(E.row.id)},{reference:s(()=>[e(V,{tag:"a",size:"x-small",class:"ml-auto",hover:"danger"},{default:s(()=>[e(S,{name:"TrashIcon"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])])):(n(),$(p,{key:1,icon:"Empty/ListView","has-dark":!0,text:l.$t("No activated sites found")},null,8,["text"]))])}const Hl=W(Ml,[["render",zl]]),ql={class:"fct-single-customer-loader-wrap fct-layout-width"},Kl={class:"single-page-header fct-page-loader-header flex items-start justify-between"},Yl={class:"single-page-body"},Wl={class:"fct-single-order"},Gl={class:"fct-single-order-main"},Xl={class:"grid gap-5 grid-cols-[repeat(auto-fit,minmax(200px,1fr))]"},Ql={class:"fct-single-order-aside"},Zl={class:"fct-admin-sidebar"},Jl={__name:"SingleLicenseLoader",setup(l){return(t,i)=>{const k=m("el-skeleton-item"),u=m("el-skeleton");return n(),_("div",ql,[a("div",Kl,[e(u,{animated:"",class:"flex items-start gap-2"},{template:s(()=>[(n(),_(U,null,N(3,c=>e(k,{key:c,class:"max-w-[100px]"})),64))]),_:1})]),a("div",Yl,[a("div",Wl,[a("div",Gl,[e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Manage License Details")},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5"},{template:s(()=>[e(k,{variant:"p",class:"w-full"}),e(k,{variant:"p",style:{width:"50%"}})]),_:1}),a("div",Xl,[(n(),_(U,null,N(6,c=>e(u,{key:c,animated:!0},{template:s(()=>[a("div",null,[e(k,{variant:"p",class:"w-full"}),e(k,{variant:"p",style:{width:"50%"}})])]),_:2},1024)),64))])]),_:1})]),_:1}),e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Related Orders")},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5",rows:2})]),_:1})]),_:1}),e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:t.$t("Activated Sites")},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:!0,class:"mb-5",rows:3})]),_:1})]),_:1})]),a("div",Ql,[a("div",Zl,[e(O,null,{default:s(()=>[e(B,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:"",rows:6})]),_:1})]),_:1}),e(O,null,{default:s(()=>[e(B,{title:t.$t("Actions"),border_bottom:"",title_size:"small"},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:""},{template:s(()=>[e(k,{variant:"p",class:"w-1/2"})]),_:1})]),_:1})]),_:1}),e(O,null,{default:s(()=>[e(B,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),e(I,null,{default:s(()=>[e(u,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},en={key:2,class:"fct-view-license-wrap fct-layout-width"},tn={class:"single-page-header"},sn={class:"flex items-center gap-3 flex-wrap whitespace-pre-wrap",style:{"overflow-wrap":"anywhere"}},an={class:"license-breadcrumb-only-mobile"},ln={class:"single-page-body"},nn={class:"fct-view-license-content-wrap"},on={class:"more-btn"},rn={class:"fct-related-license-content"},cn={class:"fct-license-related-orders-show-on-mobile fct-table-mobile-wrap"},dn={class:"fct-table-mobile-header"},un={class:"fct-table-date-col"},_n={class:"fct-table-price-col"},mn={class:"fct-table-mobile-footer"},pn={class:"fct-table-mobile-footer-row"},hn={class:"title"},fn={class:"fct-table-status-col flex items-center gap-1"},gn={class:"title"},vn={class:"value capitalize"},bn={class:"fct-related-license-content"},yn={class:"value-column-with-space",style:{"max-height":"500px","overflow-y":"auto"}},wn=["innerHTML"],kn={class:"fct-admin-sidebar"},Ln={class:"fct-admin-sidebar-item"},Cn={class:"fct-lists"},$n={class:"!mb-0"},xn={name:"ViewLicense",components:{OrderUpDownIndicator:oe},props:["license_id"],data(){return{changes_made:0,isDateSelected:!1,isCalendarOpen:!1,activeTab:"license",activeMenu:"details",license:null,order:null,selectedDate:null,orders:[],prevOrders:[],activations:[],loading:!0,saving:!1,limit:null,site_url:null,upgrade_path_base:"",showConfirmationIcons:!1,customerId:null,activatedSites:[],logs:[],selectedLabels:[],renewalNoticeValue:"",renewalNoticeOptions:[{value:"option1",label:"Need to connect backend"},{value:"option2",label:"Need to connect backend"}],product:{},notFound:{show:!1,message:"",buttonText:"",route:""}}},watch:{license:{handler(){this.changes_made++},deep:!0,immediate:!0},product:{handler(){var l;(l=this.product)!=null&&l.variants&&(this.variations=this.product.variants)},deep:!0,immediate:!0},license_id:{handler(l,t){this.fetchLicense()}}},methods:{handleLicenseCommand(l){l==="delete_license"&&this.$confirm("Are you sure you want to delete this license?","Confirm Delete!",{confirmButtonText:"Yes, Delete!",cancelButtonText:"Cancel",confirmButtonClass:"el-button--primary",cancelButtonClass:"el-button--info is-plain",type:"warning"}).then(()=>{this.deleteLicense()}).catch(()=>{})},deleteLicense(){this.$del(`licensing/licenses/${this.license_id}/delete`).then(l=>{this.handleSuccess(l.message),this.$router.push({name:"licenses"})}).catch(l=>{this.handleError(l)})},updateUrl(l,t){this.activatedSites[l]=t},activateSite(){We(this.site_url)?this.$post("licensing/licenses/"+this.license_id+"/activate_site",{url:this.site_url}).then(t=>{if(this.fetchLicense(),this.site_url=null,t.success)this.handleSuccess("Site activated successfully!");else{let i=t.error??"An error occurred while activating the site";this.handleError(i)}}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1}):this.handleError("Enter a valid site URL")},deactivateSite(l){this.$post("licensing/licenses/"+this.license_id+"/deactivate_site",{activation_id:l}).then(t=>{this.fetchLicense(),this.handleSuccess(t.message)}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})},fetchLicense(){this.loading=!0,this.notFound.show=!1,this.$get("licensing/licenses/"+this.license_id).then(l=>{var t,i;this.license=l.license,this.order=l.order,this.order.customer=(t=this.license)==null?void 0:t.customer,this.upgrade_path_base=l.upgrade_path_base,this.orders=l.orders,this.activations=l.activations,this.limit=this.license.limit,this.customerId=(i=this.license.customer)==null?void 0:i.id,this.product=l.product,this.selectedLabels=l.selected_labels,this.prevOrders=l.prev_orders,this.activatedSites=this.activations.map(k=>{var u,c;return{id:k.id,site_id:k.site_id,site_url:(u=k.site)==null?void 0:u.site_url,created_at:(c=k.site)==null?void 0:c.created_at,status:k.status,is_local:k.is_local,last_update_version:k.last_update_version,last_update_date:k.last_update_date}}).sort((k,u)=>u.id-k.id)}).catch(l=>{l&&((l==null?void 0:l.code)==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=se.get(l,"data.buttonText"),this.notFound.message=se.get(l,"data.message"),this.notFound.route=se.get(l,"data.route")):this.handleError(l))}).finally(()=>{this.loading=!1})},fetchLicenseMeta(){this.$get("licensing/licenses/meta/"+this.license_id).then(l=>{this.logs=l}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1})},updateLicenseStatus(l){this.$post("licensing/licenses/"+this.license_id+"/update_status",{status:l}).then(t=>{this.license&&(this.license.status=l),this.$emit("fetchLicense"),this.handleSuccess(t.message),this.fetchLicense()}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1})},getCustomerTotalOrders(l){return l>0?l+" "+(l==1?d("order"):d("orders")):d("No orders")},handleMenuClick(l){this.activeMenu=l},discard(){return window.location.reload()}},mounted(){this.fetchLicense()}},Sn=Object.assign(xn,{setup(l){return(t,i)=>{var f;const k=m("el-breadcrumb-item"),u=m("el-breadcrumb"),c=m("router-link"),y=m("el-dropdown-item"),v=m("el-dropdown-menu"),b=m("el-dropdown"),S=m("el-table-column"),V=m("el-table"),L=m("el-timeline-item"),P=m("el-timeline"),p=m("el-col"),E=m("el-button"),w=m("el-popconfirm"),M=m("el-row");return n(),_("div",null,[t.loading?(n(),$(Jl,{key:0})):g("",!0),t.notFound.show?(n(),$(De,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):g("",!0),t.notFound.show===!1?(n(),_("div",en,[t.loading?g("",!0):(n(),_(U,{key:0},[t.license?(n(),_(U,{key:0},[a("div",tn,[e(u,{class:"hide-license-breadcrumb-on-mobile","separator-icon":o(he)},{default:s(()=>[e(k,{to:{name:"licenses"}},{default:s(()=>[D(r(o(d)("Licenses")),1)]),_:1}),e(k,null,{default:s(()=>{var h;return[a("div",sn,[D(r((h=t.license)==null?void 0:h.license_key)+" ",1),e(H,{status:t.license.status,size:"small"},null,8,["status"])])]}),_:1})]),_:1},8,["separator-icon"]),a("ul",an,[a("li",null,[e(c,{to:{name:"licenses"}},{default:s(()=>[e(R,{name:"ArrowLeft",class:"cursor-pointer"})]),_:1})]),a("li",null,r((f=t.license)==null?void 0:f.license_key),1)])]),a("div",ln,[e(M,{gutter:30},{default:s(()=>[e(p,{lg:17},{default:s(()=>[a("div",nn,[e(O,null,{default:s(()=>[e(B,{border_bottom:"",title_size:"small",title:o(d)("License Details")},{action:s(()=>[e(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleLicenseCommand,placement:"bottom-end"},{dropdown:s(()=>[e(v,null,{default:s(()=>[e(y,{command:"delete_license",class:"item-destructive"},{default:s(()=>[e(R,{name:"Delete"}),D(" "+r(o(d)("Delete License")),1)]),_:1})]),_:1})]),default:s(()=>[a("span",on,[e(R,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),e(I,null,{default:s(()=>[e(Ul,{license:t.license,customerId:t.customerId,license_id:l.license_id,activations:t.activations,product:t.product,order:t.order,upgrade_path_base:t.upgrade_path_base,onFetchLicense:t.fetchLicense},null,8,["license","customerId","license_id","activations","product","order","upgrade_path_base","onFetchLicense"])]),_:1})]),_:1}),e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:o(d)("Related Orders"),title_size:"small"},null,8,["title"]),e(I,{class:"px-0 pb-0"},{default:s(()=>[a("div",rn,[e(V,{data:t.orders,class:"w-full fct-license-related-orders-hide-on-mobile"},{default:s(()=>[e(S,{width:120,label:o(d)("ID")},{default:s(h=>[e(c,{class:"link",to:{name:"view_order",params:{order_id:h.row.id}}},{default:s(()=>[D(" #"+r(o(d)(h.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(S,{width:120,label:o(d)("Amount")},{default:s(h=>[a("span",null,r(t.formatNumber(h.row.total_amount)),1)]),_:1},8,["label"]),e(S,{width:150,label:o(d)("Date"),prop:"created_at"},{default:s(h=>[a("span",null,r(o(Y)(h.row.created_at)),1)]),_:1},8,["label"]),e(S,{label:o(d)("Payment Method")},{default:s(h=>[D(r(h.row.payment_method),1)]),_:1},8,["label"]),e(S,{label:o(d)("Status")},{default:s(h=>[e(H,{type:h.row.payment_status},{default:s(()=>[D(r(h.row.payment_status),1)]),_:2},1032,["type"]),e(H,{style:{"margin-left":"5px","margin-right":"5px"},type:h.row.type},{default:s(()=>[D(r(h.row.type),1)]),_:2},1032,["type"]),e(oe,{order:h.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"]),a("div",cn,[(n(!0),_(U,null,N(t.orders,(h,x)=>(n(),_("div",{key:x,class:"fct-table-mobile-row"},[a("div",dn,[a("div",un,[D(r(o(Y)(h.created_at))+" ",1),i[4]||(i[4]=a("div",{class:"bullet"},"•",-1)),e(c,{class:"link",to:{name:"view_order",params:{order_id:h.id}}},{default:s(()=>[D(" #"+r(h.id),1)]),_:2},1032,["to"])]),a("div",_n,r(t.formatNumber(h.total_amount)),1)]),a("div",mn,[a("div",pn,[a("div",null,[a("div",hn,r(o(d)("Status")),1),a("div",fn,[e(H,{type:h.payment_status},{default:s(()=>[D(r(h.payment_status),1)]),_:2},1032,["type"]),e(H,{type:h.type},{default:s(()=>[D(r(h.type),1)]),_:2},1032,["type"]),e(oe,{order:h},null,8,["order"])])]),a("div",null,[a("div",gn,r(o(d)("Payment Method")),1),a("div",vn,r(h.payment_method),1)])])])]))),128))])])]),_:1})]),_:1}),t.prevOrders&&t.prevOrders.length?(n(),$(O,{key:0,class:"overflow-hidden"},{default:s(()=>[e(B,{title:o(d)("Previous Orders"),title_size:"small"},null,8,["title"]),e(I,{class:"px-0 pb-0"},{default:s(()=>[a("div",bn,[e(V,{data:t.prevOrders,class:"w-full"},{default:s(()=>[e(S,{width:120,label:o(d)("ID")},{default:s(h=>[e(c,{class:"link",to:{name:"view_order",params:{order_id:h.row.id}}},{default:s(()=>[D(" #"+r(o(d)(h.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(S,{width:120,label:o(d)("Amount")},{default:s(h=>[a("span",null,r(t.formatNumber(h.row.total_paid)),1)]),_:1},8,["label"]),e(S,{width:150,label:o(d)("Date"),prop:"created_at"},{default:s(h=>[a("span",null,r(o(Y)(h.row.created_at)),1)]),_:1},8,["label"]),e(S,{label:o(d)("Status")},{default:s(h=>[e(H,{type:h.row.payment_status},{default:s(()=>[D(r(h.row.payment_status),1)]),_:2},1032,["type"]),e(H,{style:{"margin-left":"5px","margin-right":"5px"},type:h.row.type},{default:s(()=>[D(r(h.row.type),1)]),_:2},1032,["type"]),e(oe,{order:h.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1})):g("",!0),e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:o(d)("Activated Sites"),title_size:"small",border_bottom:""},null,8,["title"]),e(I,null,{default:s(()=>[e(Hl,{modelValue:t.site_url,"onUpdate:modelValue":i[0]||(i[0]=h=>t.site_url=h),onSiteActivated:t.activateSite,onSiteDeactivated:t.deactivateSite,activatedSites:t.activatedSites,activationLimit:t.limit,activationCount:t.activations.length},null,8,["modelValue","onSiteActivated","onSiteDeactivated","activatedSites","activationLimit","activationCount"])]),_:1})]),_:1}),t.logs.length>0?(n(),$(O,{key:1},{default:s(()=>[e(I,null,{default:s(()=>[a("div",yn,[e(P,{style:{"padding-left":"2px"}},{default:s(()=>[(n(!0),_(U,null,N(t.logs,h=>{var x;return n(),$(L,{key:h,timestamp:o(Q)((x=t.license)==null?void 0:x.updated_at).locale(o(Ue)()).format(o(Me)("date")),placement:"top",color:"blue"},{default:s(()=>[a("div",{innerHTML:h.meta_value},null,8,wn)]),_:2},1032,["timestamp"])}),128))]),_:1})])]),_:1})]),_:1})):g("",!0)])]),_:1}),e(p,{lg:7},{default:s(()=>[a("div",kn,[e(st,{order:t.order,shouldEnableEditing:!0,onOnAddressSelected:i[1]||(i[1]=h=>{h.type==="shipping"?t.order.shipping_address_id=h.id:t.order.billing_address_id=h.id})},null,8,["order"]),e(O,null,{default:s(()=>[e(B,{title:o(d)("Actions"),title_size:"small",border_bottom:""},null,8,["title"]),e(I,null,{default:s(()=>[a("div",Ln,[a("ul",Cn,[a("li",$n,[t.license.status!=="disabled"?(n(),$(w,{key:0,width:"210","confirm-button-text":o(d)("Confirm"),"cancel-button-text":o(d)("No, Thanks"),title:o(d)("Are you sure?"),onConfirm:i[2]||(i[2]=h=>t.updateLicenseStatus("disabled"))},{reference:s(()=>[e(E,{text:"",class:"!text-red-500 !mt-0"},{default:s(()=>[D(r(o(d)("Disable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):g("",!0),t.license.status==="disabled"?(n(),$(w,{key:1,width:"210","confirm-button-text":o(d)("Confirm"),"cancel-button-text":o(d)("No, Thanks"),title:o(d)("Are you sure?"),onConfirm:i[3]||(i[3]=h=>t.updateLicenseStatus("active"))},{reference:s(()=>[e(E,{text:"",class:"!mt-0"},{default:s(()=>[D(r(o(d)("Enable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):g("",!0)])])])]),_:1})]),_:1}),t.loading?g("",!0):(n(),$(at,{key:0,"bind-to-id":t.license.id,"bind-to-type":"FluentCartPro\\App\\Modules\\Licensing\\Models\\License",selectedLabels:t.selectedLabels,shouldEnableEditing:!0,"onUpdate:updateLabel":()=>{}},null,8,["bind-to-id","selectedLabels"]))])]),_:1})]),_:1})])],64)):g("",!0)],64))])):g("",!0)])}}}),Dn={class:"heading-wrap"},En={class:"title"},Pn={key:0,class:"heading-action"},Vn={__name:"Heading",props:{title:String},setup(l){const t=Be();return(i,k)=>(n(),_("div",Dn,[a("h2",En,r(l.title),1),o(t).actions?(n(),_("div",Pn,[Re(i.$slots,"actions")])):g("",!0)]))}},Tn={name:"AllLicenses",components:{Pagination:Ye,Heading:Vn},data(){return{licenses:[],paginate:{per_page:10,current_page:1,total:0,last_page:1},loading:!1,is_loaded:!1,search:""}},methods:{fetch(){this.loading=!0,this.$get("licensing/licenses/customer/1",{page:this.paginate.current_page,per_page:this.paginate.per_page,search:this.search}).then(l=>{this.licenses=l.licenses.data,this.paginate.total=l.licenses.total,this.paginate.last_page=l.licenses.last_page}).catch(l=>{this.handleError(l)}).finally(()=>{this.loading=!1,this.is_loaded=!0})},getProductName(l){return l?(l==null?void 0:l.product.post_title)+" - "+l.variation_label:"n/a"},onCurrentPageChanged({page:l,currentPageCount:t}){this.paginate.current_page=l,this.fetch()},onPerPageChanged(l){this.paginate.per_page=l,this.fetch()}},mounted(){this.fetch()}},An={class:"all_licenses"},Un={class:"bg-white dark:bg-dark-700"},Mn={key:0},In={key:1},On={class:"py-2.5 px-7.5 dark:bg-gray-800"},Fn={class:"flex justify-between"},Bn={class:"flex items-center gap-2"};function Rn(l,t,i,k,u,c){const y=m("Heading"),v=m("router-link"),b=m("el-table-column"),S=m("el-table"),V=m("pagination");return n(),_("div",An,[e(y,{title:"All Licenses"}),a("div",Un,[e(S,{stripe:"",data:u.licenses},{default:s(()=>[e(b,{label:"ID",width:100},{default:s(L=>[e(v,{to:{name:"view_license",params:{license_id:L.row.id}}},{default:s(()=>[D(" #"+r(L.row.id),1)]),_:2},1032,["to"])]),_:1}),e(b,{width:290,label:"License Key"},{default:s(L=>[e(v,{to:{name:"view_license",params:{license_id:L.row.id}}},{default:s(()=>[D(r(L.row.license_key),1)]),_:2},1032,["to"])]),_:1}),e(b,{width:100,label:"Status"},{default:s(L=>[a("span",null,r(L.row.status),1)]),_:1}),e(b,{"min-width":300,label:"Product"},{default:s(L=>[D(r(c.getProductName(L.row.product_details)),1)]),_:1}),e(b,{"min-width":120,label:"Customer"},{default:s(L=>[e(v,{to:{name:"view_customer",params:{customer_id:L.row.customer_id}}},{default:s(()=>{var P;return[D(r(((P=L.row)==null?void 0:P.customer.full_name)||"No Customer Found"),1)]}),_:2},1032,["to"])]),_:1}),e(b,{width:120,label:"Activations"},{default:s(L=>[D(r(L.row.activation_count)+" / "+r(L.row.limit||"Unlimited"),1)]),_:1}),e(b,{width:160,label:"Expires"},{default:s(L=>[L.row.expiration_date?(n(),_("span",Mn,r(L.row.expiration_date),1)):(n(),_("span",In,"Lifetime"))]),_:1}),e(b,{width:160,label:"Purchased"},{default:s(L=>[e(v,{to:{name:"view_order",params:{order_id:L.row.order_id}}},{default:s(()=>[D(r(L.row.created_at),1)]),_:2},1032,["to"])]),_:1})]),_:1},8,["data"]),a("div",On,[a("div",Fn,[a("div",Bn,[e(V,{"pager-only":!0,hide_on_single:!1,pagination:u.paginate,onFetch:c.fetch,onCurrentPageChanged:c.onCurrentPageChanged,onOnPerPageChanged:c.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),e(V,{hide_on_single:!1,pagination:u.paginate,onFetch:c.fetch,onCurrentPageChanged:c.onCurrentPageChanged,onOnPerPageChanged:c.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])])])])])}const Nn=W(Tn,[["render",Rn]]);class jn extends Pe{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="id"}getTabs(){return{}}getToggleableColumns(){return[{label:d("Active Licenses"),value:"active_licenses"},{label:d("Products"),value:"products"},{label:d("Customer"),value:"customer"},{label:d("Last Activity"),value:"last_activity"},{label:d("Created At"),value:"created_at"}]}getSearchHint(){return d("by site URL")}getFetchUrl(){return"licensing/sites"}parseResponse(t){return t.sites}getTableName(){return"license_sites"}with(){return[]}}function zn(l){return jn.init(l)}const Hn={class:"fct_sites_table"},qn={class:"table-cell"},Kn={key:0,class:"table-cell"},Yn={class:"fct-popover-box"},Wn={class:"fct-popover-content"},Gn={class:"fct-product-orders-items is-scroll"},Xn={class:"title"},Qn={key:0,class:"variation-title"},Zn={key:0,class:"block w-full truncate mr-4"},Jn={key:1,class:"block w-full truncate mr-4"},ei={class:"fct-popover-box-action-icon"},ti={key:1,class:"table-cell"},si={class:"table-cell"},ai={class:"table-cell"},li={key:0},ni={key:1,class:"text-gray-300"},ii={class:"table-cell"},oi={key:0},ri={key:1,class:"text-gray-300"},ci={class:"table-cell"},Se={__name:"_SiteTable",props:{sites:{type:Array,required:!0},columns:{type:Array,default(){return["products","customer","active_licenses","last_activity","created_at"]}}},setup(l){return(t,i)=>{const k=m("router-link"),u=m("el-table-column"),c=m("el-popover"),y=m("el-table");return n(),$(Z,{permission:"licenses/view"},{default:s(()=>[a("div",Hn,[e(y,{data:l.sites,class:"w-full compact-table"},{empty:s(()=>[e(le,{icon:"Empty/ListView","has-dark":!0,text:o(d)("No activated sites found")},null,8,["text"])]),default:s(()=>[e(u,{label:o(d)("Site URL"),"min-width":200},{default:s(v=>[e(k,{class:"link block hover:no-underline route-cell",to:{name:"view_site",params:{site_id:v.row.id}}},{default:s(()=>[a("div",qn,[a("div",null,[a("span",null,r(v.row.site_url),1),v.row.is_local?(n(),$(H,{key:0,status:"warning",size:"small","hide-icon":!0,text:o(d)("local"),style:{"margin-left":"8px"}},null,8,["text"])):g("",!0)])])]),_:2},1032,["to"])]),_:1},8,["label"]),l.columns.indexOf("products")!==-1?(n(),$(u,{key:0,"min-width":180,label:o(d)("Products")},{default:s(v=>[v.row.products&&v.row.products.length?(n(),_("div",Kn,[a("div",Yn,[e(c,{placement:"bottom-start",width:300,trigger:"click"},{reference:s(()=>[a("div",{class:"fct-popover-box-action",tabindex:"0",role:"button",onKeydown:i[0]||(i[0]=Ne(q(()=>{},["prevent"]),["enter","space"]))},[v.row.products.length===1?(n(),_("span",Zn,r(v.row.products[0].name),1)):(n(),_("span",Jn,r(v.row.products.length)+" "+r(o(d)("products")),1)),a("div",ei,[e(R,{name:"ChevronDown"})])],32)]),default:s(()=>[a("div",Wn,[a("div",Gn,[(n(!0),_(U,null,N(v.row.products,(b,S)=>(n(),_("p",{key:S},[a("span",Xn,r(b.name),1),b.variation?(n(),_("span",Qn,"– "+r(b.variation),1)):g("",!0)]))),128))])])]),_:2},1024)])])):(n(),_("div",ti,i[1]||(i[1]=[a("span",{class:"text-gray-300"},"—",-1)])))]),_:1},8,["label"])):g("",!0),l.columns.indexOf("active_licenses")!==-1?(n(),$(u,{key:1,width:130,label:o(d)("Active Licenses")},{default:s(v=>[e(k,{class:"link block hover:no-underline route-cell",to:{name:"view_site",params:{site_id:v.row.id}}},{default:s(()=>[a("div",si,r(v.row.active_licenses_count),1)]),_:2},1032,["to"])]),_:1},8,["label"])):g("",!0),l.columns.indexOf("customer")!==-1?(n(),$(u,{key:2,width:150,label:o(d)("Customer")},{default:s(v=>[a("div",ai,[v.row.customers&&v.row.customers.length?(n(),_("div",li,[a("span",null,r(v.row.customers.join(", ")),1)])):(n(),_("span",ni,"—"))])]),_:1},8,["label"])):g("",!0),l.columns.indexOf("last_activity")!==-1?(n(),$(u,{key:3,width:130,label:o(d)("Last Activity")},{default:s(v=>[a("div",ii,[v.row.last_activity?(n(),_("span",oi,r(o(Y)(v.row.last_activity)),1)):(n(),_("span",ri,"—"))])]),_:1},8,["label"])):g("",!0),l.columns.indexOf("created_at")!==-1?(n(),$(u,{key:4,width:130,label:o(d)("Created At")},{default:s(v=>[a("div",ci,r(o(Y)(v.row.created_at)),1)]),_:1},8,["label"])):g("",!0)]),_:1},8,["data"])])]),_:1})}}},di={class:"table-cell"},ui={class:"w-full flex flex-col items-start justify-start gap-1"},_i={class:"table-cell"},mi={class:"table-cell"},pi={class:"table-cell"},hi={class:"table-cell"},fi={class:"table-cell"},gi={__name:"SitesLoader",props:{nextPageCount:{type:Number,default:0},siteTable:{type:Object,default:()=>({})}},setup(l){const t=l,i=u=>{var y,v;return(((v=(y=t.siteTable)==null?void 0:y.data)==null?void 0:v.columns)||[]).indexOf(u)!==-1},k=Array.from({length:Math.max(t.nextPageCount,5)},(u,c)=>c+1);return(u,c)=>{const y=m("el-skeleton-item"),v=m("el-table-column"),b=m("el-table"),S=m("el-skeleton");return n(),$(S,{animated:""},{template:s(()=>[e(b,{data:o(k),class:"w-full compact-table responsive"},{empty:s(()=>c[0]||(c[0]=[])),default:s(()=>[e(v,{label:u.$t("Site URL"),"min-width":200},{default:s(()=>[a("div",di,[a("div",ui,[e(y,{varient:"p",class:"w-2/5"}),e(y,{varient:"p",class:"w-3/5"})])])]),_:1},8,["label"]),i("products")?(n(),$(v,{key:0,"min-width":180,label:u.$t("Products")},{default:s(()=>[a("div",_i,[e(y,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("active_licenses")?(n(),$(v,{key:1,width:130,label:u.$t("Active Licenses")},{default:s(()=>[a("div",mi,[e(y,{varient:"p",class:"w-2/5"})])]),_:1},8,["label"])):g("",!0),i("customer")?(n(),$(v,{key:2,width:150,label:u.$t("Customer")},{default:s(()=>[a("div",pi,[e(y,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):g("",!0),i("last_activity")?(n(),$(v,{key:3,width:130,label:u.$t("Last Activity")},{default:s(()=>[a("div",hi,[e(y,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0),i("created_at")?(n(),$(v,{key:4,width:130,label:u.$t("Created At")},{default:s(()=>[a("div",fi,[e(y,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):g("",!0)]),_:1},8,["data"])]),_:1})}}},vi={},bi={class:"px-4 py-3"},yi={class:"grid grid-cols-3 gap-5 mt-5"};function wi(l,t){const i=m("el-skeleton-item"),k=m("el-skeleton");return n(),$(k,{animated:""},{template:s(()=>[a("div",bi,[(n(),_(U,null,N(3,u=>a("div",{key:u,class:"flex items-center justify-between mb-3"},[e(i,{varient:"p",class:"w-3/5"}),e(i,{varient:"p",class:"w-[80px]"})])),64)),a("div",yi,[(n(),_(U,null,N(3,u=>a("div",{key:u},[e(i,{varient:"p",class:"w-1/2"}),e(i,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const ki=W(vi,[["render",wi]]),Li={class:"fct-all-sites-page fct-layout-width"},Ci={class:"single-page-header"},$i={class:"fct-all-sites-wrap"},xi={key:1},Si={__name:"ActivatedSitesList",setup(l){const t=zn();return(i,k)=>{const u=m("el-breadcrumb-item"),c=m("el-breadcrumb");return n(),_("div",Li,[a("div",Ci,[e(c,{"separator-icon":o(he)},{default:s(()=>[e(u,{to:{name:"licenses"}},{default:s(()=>[D(r(o(d)("Licenses")),1)]),_:1}),e(u,null,{default:s(()=>[D(r(o(d)("Sites")),1)]),_:1})]),_:1},8,["separator-icon"])]),e(Z,{permission:"licenses/view"},{default:s(()=>[a("div",$i,[e(Ve,{table:o(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:s(()=>[o(t).isLoading()?(n(),$(ki,{key:0})):g("",!0),o(t).isLoading()?g("",!0):(n(),$(Se,{key:1,sites:o(t).getTableData(),columns:o(t).data.columns},null,8,["sites","columns"]))]),default:s(()=>[o(t).isLoading()?(n(),$(gi,{key:0,siteTable:o(t),"next-page-count":o(t).nextPageCount},null,8,["siteTable","next-page-count"])):(n(),_("div",xi,[e(Se,{sites:o(t).getTableData(),columns:o(t).data.columns},null,8,["sites","columns"])]))]),_:1},8,["table"])])]),_:1})])}}},Di={key:1,class:"fct-view-site-wrap fct-layout-width"},Ei={class:"single-page-header"},Pi={class:"flex items-center gap-3 flex-wrap whitespace-pre-wrap",style:{"overflow-wrap":"anywhere"}},Vi={class:"license-breadcrumb-only-mobile"},Ti={class:"single-page-body"},Ai={class:"fct-view-site-content-wrap"},Ui={class:"fct-related-license-content"},Mi={key:1},Ii={key:2,class:"text-gray-400 block text-xs"},Oi={class:"fct-license-key"},Fi={class:"fct-license-key-inner pr-2"},Bi={key:0},Ri={key:1},Ni={key:0},ji={key:1},zi={key:0},Hi={key:0,class:"block text-xs"},qi={class:"text-gray-400 text-xs"},Ki={key:1,class:"text-gray-300"},Yi={class:"fct-related-license-content"},Wi={class:"fct-admin-sidebar"},Gi={class:"fct-site-details-list grid gap-4"},Xi={class:"fct-site-detail-item"},Qi={class:"text-gray-400 text-xs block mb-1"},Zi=["href"],Ji={key:0,class:"fct-site-detail-item"},eo={class:"text-gray-400 text-xs block mb-1"},to={key:1,class:"fct-site-detail-item"},so={class:"text-gray-400 text-xs block mb-1"},ao={key:2,class:"fct-site-detail-item"},lo={class:"text-gray-400 text-xs block mb-1"},no={key:3,class:"fct-site-detail-item"},io={class:"text-gray-400 text-xs block mb-1"},oo={key:4,class:"fct-site-detail-item"},ro={class:"text-gray-400 text-xs block mb-1"},co={key:0},uo={key:1},_o={class:"text-gray-400 text-xs block mb-1"},mo={class:"grid gap-3"},po={class:"flex justify-between"},ho={class:"text-gray-400"},fo={class:"font-medium"},go={class:"flex justify-between"},vo={class:"text-gray-400"},bo={class:"font-medium"},yo={class:"flex justify-between"},wo={class:"text-gray-400"},ko={class:"font-medium"},Lo={class:"flex justify-between"},Co={class:"text-gray-400"},$o={class:"font-medium"},xo={class:"grid gap-4"},So=["src","alt"],Do={class:"text-gray-400 text-xs"},Eo={key:1,class:"fct-error-state p-8 text-center"},Po={class:"mt-4 flex justify-center gap-3"},Vo={key:1,class:"fct-loading-wrap p-8 text-center"},To={name:"ViewSite",props:["site_id"],data(){return{site:null,activations:[],customers:[],orders:[],loading:!0,notFound:{show:!1,message:"",buttonText:"",route:""}}},computed:{siteExternalUrl(){var l=this.site?this.site.site_url:"";return/^https?:\/\//.test(l)?l:"https://"+l},hasLocalActivation(){return this.activations.some(function(l){return l.is_local&&l.is_local!=="0"})},activeCount(){return this.activations.filter(function(l){return l.activation_status==="active"}).length},uniqueProductCount(){var l={};return this.activations.forEach(function(t){t.product_name&&(l[t.product_name]=!0)}),Object.keys(l).length},lastUpdateInfo(){var l=null;return this.activations.forEach(function(t){t.last_update_date&&(!l||t.last_update_date>l.last_update_date)&&(l=t)}),l&&l.last_update_date?{version:l.last_update_version||null,date:l.last_update_date}:null}},methods:{translate:d,formatDate:Y,handleError:Ge,formatFullDate(l){return l?Q(l).locale(Ue()).format(Me("date")):""},formatMetaKey(l){return l.replace(/_/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})},fetchSite(){this.loading=!0,this.notFound.show=!1,this.$get("licensing/sites/"+this.site_id).then((function(l){this.site=l.site,this.activations=l.activations.data||l.activations,this.customers=l.customers||[],this.orders=l.orders||[]}).bind(this)).catch((function(l){l&&(l.code==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=se.get(l,"data.buttonText",d("Back to Sites")),this.notFound.message=se.get(l,"data.message",d("Site not found")),this.notFound.route=se.get(l,"data.route","/licenses/sites")):this.handleError(l))}).bind(this)).finally((function(){this.loading=!1}).bind(this))}},mounted(){this.fetchSite()}},Ao=Object.assign(To,{setup(l){return(t,i)=>{const k=m("el-breadcrumb-item"),u=m("el-breadcrumb"),c=m("router-link"),y=m("el-table-column"),v=m("el-tooltip"),b=m("el-table"),S=m("el-col"),V=m("el-row"),L=m("el-button"),P=m("el-skeleton");return n(),_("div",null,[t.notFound.show?(n(),$(De,{key:0,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):g("",!0),t.notFound.show===!1?(n(),_("div",Di,[t.loading?g("",!0):(n(),_(U,{key:0},[t.site?(n(),_(U,{key:0},[a("div",Ei,[e(u,{class:"hide-license-breadcrumb-on-mobile","separator-icon":o(he)},{default:s(()=>[e(k,{to:{name:"licenses"}},{default:s(()=>[D(r(o(d)("Licenses")),1)]),_:1}),e(k,{to:{name:"activated_sites"}},{default:s(()=>[D(r(o(d)("Sites")),1)]),_:1}),e(k,null,{default:s(()=>[a("div",Pi,r(t.site.site_url),1)]),_:1})]),_:1},8,["separator-icon"]),a("ul",Vi,[a("li",null,[e(c,{to:{name:"activated_sites"}},{default:s(()=>[e(R,{name:"ArrowLeft",class:"cursor-pointer"})]),_:1})]),a("li",null,r(t.site.site_url),1)])]),a("div",Ti,[e(V,{gutter:30},{default:s(()=>[e(S,{lg:17},{default:s(()=>[a("div",Ai,[e(O,{class:"overflow-hidden"},{default:s(()=>[e(B,{title:o(d)("Activated Licenses"),title_size:"small"},null,8,["title"]),e(I,{class:"px-0 pb-0"},{default:s(()=>[a("div",Ui,[e(b,{data:t.activations,class:"w-full"},{empty:s(()=>[e(le,{icon:"Empty/ListView","has-dark":!0,text:o(d)("No activations found")},null,8,["text"])]),default:s(()=>[e(y,{"min-width":160,label:o(d)("Product")},{default:s(p=>[a("div",null,[p.row.product_id?(n(),$(c,{key:0,class:"link",to:{name:"product_edit",params:{product_id:p.row.product_id}}},{default:s(()=>[D(r(p.row.product_name),1)]),_:2},1032,["to"])):(n(),_("span",Mi,r(p.row.product_name),1)),p.row.variation_title?(n(),_("span",Ii," – "+r(p.row.variation_title),1)):g("",!0)])]),_:1},8,["label"]),e(y,{width:110,label:o(d)("Status")},{default:s(p=>[e(H,{status:p.row.license_status,size:"small"},null,8,["status"])]),_:1},8,["label"]),e(y,{width:180,label:o(d)("License Key")},{default:s(p=>[a("span",Oi,[a("span",Fi,[e(c,{class:"link text-xs",to:{name:"view_license",params:{license_id:p.row.license_id}}},{default:s(()=>[D(r(p.row.license_key.substring(0,12))+"... ",1)]),_:2},1032,["to"])]),e(v,{content:p.row.license_key,placement:"top","popper-class":"fct-tooltip"},{default:s(()=>[e(R,{class:"cursor-pointer p-1 w-6 h-6 flex-none",name:"Copy",onClick:()=>{o(Te).copy(p.row.license_key,{successMessage:o(d)("License Key copied to clipboard"),errorMessage:o(d)("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])]),_:1},8,["label"]),e(y,{width:100,label:o(d)("Activations")},{default:s(p=>[p.row.activation_limit!==null?(n(),_("span",Bi,r(p.row.activation_count)+" / "+r(p.row.activation_limit==0?o(d)("Unlimited"):p.row.activation_limit),1)):(n(),_("span",Ri,"—"))]),_:1},8,["label"]),e(y,{width:130,label:o(d)("Expiration")},{default:s(p=>[p.row.expiration_date?(n(),_("span",Ni,r(o(Y)(p.row.expiration_date)),1)):(n(),_("span",ji,r(o(d)("Lifetime")),1))]),_:1},8,["label"]),e(y,{width:130,label:o(d)("Last Update")},{default:s(p=>[p.row.last_update_date?(n(),_("div",zi,[p.row.last_update_version?(n(),_("span",Hi,r(p.row.last_update_version),1)):g("",!0),a("span",qi,r(o(Y)(p.row.last_update_date)),1)])):(n(),_("span",Ki,"—"))]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1}),t.orders.length?(n(),$(O,{key:0,class:"overflow-hidden"},{default:s(()=>[e(B,{title:o(d)("Related Orders"),title_size:"small"},null,8,["title"]),e(I,{class:"px-0 pb-0"},{default:s(()=>[a("div",Yi,[e(b,{data:t.orders,class:"w-full"},{default:s(()=>[e(y,{width:120,label:o(d)("ID")},{default:s(p=>[e(c,{class:"link",to:{name:"view_order",params:{order_id:p.row.id}}},{default:s(()=>[D(" #"+r(p.row.id),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(y,{width:120,label:o(d)("Amount")},{default:s(p=>[a("span",null,r(t.formatNumber(p.row.total_paid)),1)]),_:1},8,["label"]),e(y,{width:150,label:o(d)("Date")},{default:s(p=>[a("span",null,r(o(Y)(p.row.created_at)),1)]),_:1},8,["label"]),e(y,{label:o(d)("Payment Method")},{default:s(p=>[D(r(p.row.payment_method),1)]),_:1},8,["label"]),e(y,{label:o(d)("Status")},{default:s(p=>[e(H,{status:p.row.payment_status,size:"small"},null,8,["status"])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1})):g("",!0)])]),_:1}),e(S,{lg:7},{default:s(()=>[a("div",Wi,[e(O,null,{default:s(()=>[e(B,{title:o(d)("Site Details"),title_size:"small",border_bottom:""},null,8,["title"]),e(I,null,{default:s(()=>[a("div",Gi,[a("div",Xi,[a("span",Qi,r(o(d)("Site URL")),1),a("a",{href:t.siteExternalUrl,target:"_blank",rel:"noopener noreferrer",class:"link font-medium inline-flex items-center gap-1.5",style:{outline:"none","box-shadow":"none"}},[D(r(t.site.site_url)+" ",1),e(R,{name:"External",class:"w-3.5 h-3.5 text-gray-400"})],8,Zi)]),t.hasLocalActivation?(n(),_("div",Ji,[a("span",eo,r(o(d)("Environment")),1),e(H,{status:"warning",size:"small","hide-icon":!0,text:o(d)("Local / Staging")},null,8,["text"])])):g("",!0),t.site.platform_version?(n(),_("div",to,[a("span",so,r(o(d)("Platform Version")),1),a("span",null,r(t.site.platform_version),1)])):g("",!0),t.site.server_version?(n(),_("div",ao,[a("span",lo,r(o(d)("Server Version")),1),a("span",null,r(t.site.server_version),1)])):g("",!0),t.site.created_at?(n(),_("div",no,[a("span",io,r(o(d)("Registered At")),1),a("span",null,r(t.formatFullDate(t.site.created_at)),1)])):g("",!0),t.lastUpdateInfo?(n(),_("div",oo,[a("span",ro,r(o(d)("Last Update Check")),1),t.lastUpdateInfo.version?(n(),_("span",co,r(t.lastUpdateInfo.version)+" — "+r(t.formatFullDate(t.lastUpdateInfo.date)),1)):(n(),_("span",uo,r(t.formatFullDate(t.lastUpdateInfo.date)),1))])):g("",!0),t.site.other&&Object.keys(t.site.other).length?(n(!0),_(U,{key:5},N(t.site.other,(p,E)=>(n(),_("div",{key:E,class:"fct-site-detail-item"},[a("span",_o,r(t.formatMetaKey(E)),1),a("span",null,r(p),1)]))),128)):g("",!0)])]),_:1})]),_:1}),e(O,null,{default:s(()=>[e(B,{title:o(d)("Summary"),title_size:"small",border_bottom:""},null,8,["title"]),e(I,null,{default:s(()=>[a("div",mo,[a("div",po,[a("span",ho,r(o(d)("Total Activations")),1),a("span",fo,r(t.activations.length),1)]),a("div",go,[a("span",vo,r(o(d)("Active")),1),a("span",bo,r(t.activeCount),1)]),a("div",yo,[a("span",wo,r(o(d)("Products")),1),a("span",ko,r(t.uniqueProductCount),1)]),a("div",Lo,[a("span",Co,r(o(d)("Orders")),1),a("span",$o,r(t.orders.length),1)])])]),_:1})]),_:1}),t.customers.length?(n(),$(O,{key:0},{default:s(()=>[e(B,{title:o(d)("Customers"),title_size:"small",border_bottom:""},null,8,["title"]),e(I,null,{default:s(()=>[a("div",xo,[(n(!0),_(U,null,N(t.customers,p=>(n(),_("div",{key:p.id,class:"flex items-center gap-3"},[e(c,{to:{name:"view_customer",params:{customer_id:p.id}}},{default:s(()=>[p.photo?(n(),_("img",{key:0,src:p.photo,alt:p.full_name,class:"w-10 h-10 rounded-full object-cover flex-shrink-0"},null,8,So)):g("",!0)]),_:2},1032,["to"]),a("div",null,[e(c,{class:"link font-medium block",to:{name:"view_customer",params:{customer_id:p.id}}},{default:s(()=>[D(r(p.full_name),1)]),_:2},1032,["to"]),a("span",Do,r(p.email),1)])]))),128))])]),_:1})]),_:1})):g("",!0)])]),_:1})]),_:1})])],64)):g("",!0),!t.site&&!t.loading?(n(),_("div",Eo,[e(le,{icon:"Empty/ListView","has-dark":!0,text:o(d)("Failed to load site details")},null,8,["text"]),a("div",Po,[e(L,{onClick:t.fetchSite},{default:s(()=>[D(r(o(d)("Retry")),1)]),_:1},8,["onClick"]),e(L,{onClick:i[0]||(i[0]=p=>t.$router.push({name:"activated_sites"}))},{default:s(()=>[D(r(o(d)("Back to Sites")),1)]),_:1})])])):g("",!0)],64)),t.loading?(n(),_("div",Vo,[e(P,{rows:8,animated:""})])):g("",!0)])):g("",!0)])}}});window.fluent_cart_admin.hooks.addFilter("fluent_cart_routes","fluent_all_licenses",function(l){return l.product_route.children.push({name:"license_settings",path:"license_settings",props:!0,component:Ft,meta:{active_menu:"products",title:d("License Settings"),permission:"store/sensitive"}}),l.license_route={name:"licenses",path:"/licenses",component:wa,meta:{active_menu:"licenses",title:d("Licenses"),permission:"store/sensitive"}},l.view_license={name:"view_license",path:"/licenses/:license_id/view",component:Sn,props:!0,meta:{active_menu:"licenses",title:d("View License"),permission:"store/sensitive"}},l.view_customer_licenses={name:"view_customer_licenses",path:"/licenses/customer/:customer_id",component:Nn,props:!0,meta:{active_menu:"licenses",title:d("View License"),permission:"store/sensitive"}},l.activated_sites={name:"activated_sites",path:"/licenses/sites",component:Si,meta:{active_menu:"licenses",title:d("Activated Sites"),permission:"store/sensitive"}},l.view_site={name:"view_site",path:"/licenses/sites/:site_id/view",component:Ao,props:!0,meta:{active_menu:"licenses",title:d("View Site"),permission:"store/sensitive"}},l}); |