PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | assets/license.js +1 -1 1.3.21 → 1.6.5 View file →
@@ -1 +1 @@
1 -var $e=Object.defineProperty;var Ee=(a,t,s)=>t in a?$e(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s;var ke=(a,t,s)=>Ee(a,typeof t!="symbol"?t+"":t,s);import{r as u,e as h,o,a as e,b as w,w as n,u as m,c as $,d as l,t as c,F as A,g as z,n as ie,f as x,h as O,l as ee,v as oe,j as me,i as ce,x as G,G as Le,k as Pe,q as j,a0 as Ve,m as Te}from"./chunks/vue.esm-bundler.js?ver=1.3.21";import{C as R,c as B,d as N,T as Ae,_ as Ue,a as Me,f as Ie}from"./chunks/CardBody.js?ver=1.3.21";import{L as ne,_ as Oe}from"./chunks/NotFound.js?ver=1.3.21";import{_ as Be,m as Ce,a as Ne,d as Fe,T as q,i as De}from"./chunks/dateShortCuts.js?ver=1.3.21";import{_ as pe,P as Re}from"./chunks/Empty.js?ver=1.3.21";import{_ as H}from"./chunks/DynamicIcon.js?ver=1.3.21";import{t as p,A as re}from"./chunks/Translator.js?ver=1.3.21";import{I as de,S as Se}from"./chunks/IconButton.js?ver=1.3.21";import{a as ze,cq as He,b as je}from"./chunks/index.js?ver=1.3.21";import{_ as le,P as qe,L as Ye,O as se,e as Ke,d as We}from"./chunks/OrderCustomerInformation.js?ver=1.3.21";import{_ as W}from"./chunks/_plugin-vue_export-helper.js?ver=1.3.21";import{d as X}from"./chunks/dayjs.min.js?ver=1.3.21";import{M as Ge}from"./chunks/Model.js?ver=1.3.21";import{R as xe}from"./chunks/Rest.js?ver=1.3.21";import{B as K}from"./chunks/Badge.js?ver=1.3.21";import{b as Q,i as Xe}from"./chunks/common.js?ver=1.3.21";import{_ as ue,C as Ze}from"./chunks/CopyToClipboard.js?ver=1.3.21";import{S as Je}from"./chunks/Str.js?ver=1.3.21";import{A as _e}from"./chunks/Arr.js?ver=1.3.21";import"./chunks/vue-router.js?ver=1.3.21";import"./chunks/Url.js?ver=1.3.21";import"./chunks/timezone.js?ver=1.3.21";import"./chunks/Notify.js?ver=1.3.21";import"./chunks/index3.js?ver=1.3.21";import"./chunks/Utils.js?ver=1.3.21";import"./chunks/Asset.js?ver=1.3.21";import"./chunks/index4.js?ver=1.3.21";import"./chunks/productService.js?ver=1.3.21";import"./chunks/Animation.js?ver=1.3.21";const Qe={class:"fct-license-settings fct-layout-width"},et={key:1,class:"fct-license-settings-body"},tt={class:"fct-licensed-product-table hide-on-mobile"},nt={class:"fct-media-with-content"},at={class:"media"},lt=["src","alt"],st={class:"title"},it=["innerHTML"],ot=["innerHTML"],rt={class:"fct-product-pricing-table-item"},ct={class:"fct-licensed-product-table-mobile"},dt={class:"fct-licensed-product-table-mobile-col"},ut={class:"root-title"},_t={class:"fct-media-with-content"},mt={class:"media"},pt=["src","alt"],ht={class:"title"},ft=["innerHTML"],gt=["innerHTML"],vt={class:"fct-licensed-product-table-mobile-col"},bt={class:"root-title"},yt={class:"fct-product-pricing-table-item"},wt={key:0},kt={class:"custom-wp-editor-wrapper relative"},Lt={class:"absolute mb-0 font-bold"},Ct={key:2,class:"fct-bundle-license-info",style:{padding:"40px 20px"}},St={class:"flex items-center justify-center mb-4"},Dt={style:{"max-width":"600px",margin:"0 auto",color:"#606266","line-height":"1.6","text-align":"left"}},xt={class:"text-sm font-medium mb-3 text-system-dark dark:text-gray-50"},$t={style:{"font-size":"14px"}},Et={key:0,class:"setting-save-action"},Pt={name:"LicenseSettings",props:["product_id"],data(){return{settings:null,saving:!1,loading:!1,product:{},globalUpdateFile:{},selectedFile:null,fetchSettings:!1,isBundleProduct:!1}},methods:{translate:p,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,s;this.settings=a.settings,this.isBundleProduct=a.is_bundle_product||!1,this.selectedFile=(t=a.settings.global_update_file)!=null&&t.id?parseInt((s=a.settings.global_update_file)==null?void 0:s.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)}},Vt=Object.assign(Pt,{setup(a){return(t,s)=>{const k=u("el-switch"),r=u("el-skeleton"),i=u("el-table-column"),S=u("el-input"),L=u("el-table"),b=u("el-form-item"),D=u("el-col"),E=u("el-option"),y=u("el-select"),T=u("el-row"),g=u("el-form"),I=u("el-button");return o(),h("div",Qe,[e(N,null,{default:n(()=>[e(R,{border_bottom:"",title:m(p)("License Settings")},{action:n(()=>[t.settings?(o(),$(k,{key:0,modelValue:t.settings.enabled,"onUpdate:modelValue":s[0]||(s[0]=f=>t.settings.enabled=f),"active-value":"yes","inactive-value":"no","active-text":m(p)("Enable Licensing for this product"),disabled:t.isBundleProduct},null,8,["modelValue","active-text","disabled"])):w("",!0)]),_:1},8,["title"]),e(B,null,{default:n(()=>[t.fetchSettings?(o(),$(r,{key:0,rows:6,animated:!0})):w("",!0),t.settings&&!t.fetchSettings?(o(),h("div",et,[t.settings.enabled==="yes"?(o(),$(g,{key:0,"label-position":"top",modelValue:t.settings,"onUpdate:modelValue":s[11]||(s[11]=f=>t.settings=f)},{default:n(()=>[e(b,null,{default:n(()=>[l("div",tt,[e(L,{ref:"elTable","row-key":f=>f.rowId,data:t.settings.variations},{default:n(()=>[e(i,{label:m(p)("Variant"),width:300},{default:n(f=>[l("div",nt,[l("div",at,[l("img",{src:t.imageUrl(f.row.media),alt:t.imageAlt(f.row.media)},null,8,lt)]),l("div",null,[l("div",st,c(f.row.title),1),f.row.subscription_info?(o(),h("div",{key:0,class:"text",innerHTML:f.row.subscription_info},null,8,it)):w("",!0),f.row.setup_fee_info?(o(),h("div",{key:1,class:"text",innerHTML:f.row.setup_fee_info},null,8,ot)):w("",!0)])])]),_:1},8,["label"]),e(i,{width:140},{header:n(()=>[e(ne,{title:m(p)("Activation Limit"),content:m(p)("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:n(f=>[l("div",rt,[e(S,{type:"number",min:1,placeholder:m(p)("Use 0 or empty for no limit"),modelValue:f.row.activation_limit,"onUpdate:modelValue":U=>f.row.activation_limit=U},null,8,["placeholder","modelValue","onUpdate:modelValue"])])]),_:1})]),_:1},8,["row-key","data"])]),l("div",ct,[(o(!0),h(A,null,z(t.settings.variations,f=>(o(),h("div",{class:"fct-licensed-product-table-mobile-row",key:f.rowId},[l("div",dt,[l("div",ut,c(m(p)("Variant")),1),l("div",_t,[l("div",mt,[l("img",{src:t.imageUrl(f.media),alt:t.imageAlt(f.media)},null,8,pt)]),l("div",null,[l("div",ht,c(f.title),1),f.subscription_info?(o(),h("div",{key:0,class:"text",innerHTML:f.subscription_info},null,8,ft)):w("",!0),f.setup_fee_info?(o(),h("div",{key:1,class:"text",innerHTML:f.setup_fee_info},null,8,gt)):w("",!0)])])]),l("div",vt,[l("div",bt,[e(ne,{title:m(p)("Activation Limit"),content:m(p)("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",yt,[e(S,{type:"number",min:1,placeholder:m(p)("Use 0 or empty for no limit"),modelValue:f.activation_limit,"onUpdate:modelValue":U=>f.activation_limit=U},null,8,["placeholder","modelValue","onUpdate:modelValue"])])])]))),128))])]),_:1}),e(T,{gutter:20},{default:n(()=>[e(D,{lg:8},{default:n(()=>[e(b,null,{label:n(()=>[e(ne,{title:m(p)("Version Number"),content:m(p)("Enter the current version number of your product.")},null,8,["title","content"])]),default:n(()=>[e(S,{placeholder:m(p)("Your Product Version"),modelValue:t.settings.version,"onUpdate:modelValue":s[1]||(s[1]=f=>t.settings.version=f)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),e(D,{lg:8},{default:n(()=>[e(b,null,{label:n(()=>[e(ne,{title:m(p)("License Key Prefix (Optional)"),content:m(p)("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:n(()=>[e(S,{placeholder:m(p)("Your License Key Prefix"),modelValue:t.settings.prefix,"onUpdate:modelValue":s[2]||(s[2]=f=>t.settings.prefix=f)},null,8,["placeholder","modelValue"])]),_:1})]),_:1}),t.fetchSettings?w("",!0):(o(),$(D,{key:0,lg:8},{default:n(()=>[e(b,null,{label:n(()=>[e(ne,{title:m(p)("Update File"),content:m(p)("Update File (Choose the source file to get automatic updates)")},null,8,["title","content"])]),default:n(()=>{var f,U;return[((U=(f=t.product)==null?void 0:f.downloadable_files)==null?void 0:U.length)===0?(o(),h("span",wt,c(m(p)("No downloadable files found")),1)):(o(),$(y,{key:1,modelValue:t.settings.global_update_file,"onUpdate:modelValue":s[3]||(s[3]=_=>t.settings.global_update_file=_),placeholder:m(p)("Update File")},{default:n(()=>[(o(!0),h(A,null,z(t.product.downloadable_files,_=>(o(),$(E,{key:_.id,label:_.title,value:_.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]))]}),_:1})]),_:1}))]),_:1}),e(b,null,{default:n(()=>[l("div",kt,[l("label",Lt,c(m(p)("Changelog Description")),1),e(Be,{modelValue:t.settings.changelog,onUpdate:s[4]||(s[4]=f=>{t.settings.changelog=f})},null,8,["modelValue"])])]),_:1}),l("div",{class:ie("is-wp-product-wrap "+(t.settings.wp.is_wp==="yes"?"pb-0":""))},[l("div",{class:ie(t.settings.wp.is_wp==="yes"?"pb-4":"")},[e(k,{modelValue:t.settings.wp.is_wp,"onUpdate:modelValue":s[5]||(s[5]=f=>t.settings.wp.is_wp=f),"active-value":"yes","inactive-value":"no","active-text":m(p)("Is WP Plugin?")},null,8,["modelValue","active-text"])],2),t.settings.wp.is_wp==="yes"?(o(),h(A,{key:0},[e(b,{label:m(p)("Changelog Page URL")},{default:n(()=>[e(S,{placeholder:m(p)("Your Product Changelog Page URL"),modelValue:t.settings.wp.readme_url,"onUpdate:modelValue":s[6]||(s[6]=f=>t.settings.wp.readme_url=f)},null,8,["placeholder","modelValue"])]),_:1},8,["label"]),e(T,{gutter:20},{default:n(()=>[e(D,{md:12},{default:n(()=>[e(b,{label:m(p)("Banner URL")},{default:n(()=>[e(S,{placeholder:m(p)("Plugin Banner URL"),modelValue:t.settings.wp.banner_url,"onUpdate:modelValue":s[7]||(s[7]=f=>t.settings.wp.banner_url=f)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(D,{md:12},{default:n(()=>[e(b,{label:m(p)("Icon URL")},{default:n(()=>[e(S,{placeholder:m(p)("Plugin Icon URL"),modelValue:t.settings.wp.icon_url,"onUpdate:modelValue":s[8]||(s[8]=f=>t.settings.wp.icon_url=f)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(D,{md:12,xs:24},{default:n(()=>[e(b,{label:m(p)("Required PHP Version (optional)")},{default:n(()=>[e(S,{placeholder:m(p)("Required PHP Version"),modelValue:t.settings.wp.required_php,"onUpdate:modelValue":s[9]||(s[9]=f=>t.settings.wp.required_php=f)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1}),e(D,{md:12,xs:24},{default:n(()=>[e(b,{label:m(p)("Required WP Version (optional)")},{default:n(()=>[e(S,{placeholder:m(p)("Required WP Version"),modelValue:t.settings.wp.required_wp,"onUpdate:modelValue":s[10]||(s[10]=f=>t.settings.wp.required_wp=f)},null,8,["placeholder","modelValue"])]),_:1},8,["label"])]),_:1})]),_:1})],64)):w("",!0)],2)]),_:1},8,["modelValue"])):w("",!0),t.settings.enabled!=="yes"&&!t.isBundleProduct?(o(),$(pe,{key:1,icon:"Empty/WebPage",text:m(p)("License for this product has not been enabled")},null,8,["text"])):w("",!0),t.isBundleProduct?(o(),h("div",Ct,[l("div",St,[e(H,{name:"Empty/WebPage",class:"w-[100px]"})]),l("div",Dt,[l("p",xt,c(m(p)("License Settings Not Available for Bundle Products")),1),l("p",$t,c(m(p)("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)])])):w("",!0)])):w("",!0)]),_:1})]),_:1}),t.settings&&!t.isBundleProduct?(o(),h("div",Et,[e(I,{onClick:s[12]||(s[12]=f=>t.updateSettings()),loading:t.saving,disabled:t.saving,type:"primary"},{default:n(()=>[x(c(m(p)(" Update Settings")),1)]),_:1},8,["loading","disabled"])])):w("",!0)])}}});class Tt extends Ae{setupInitialData(){super.setupInitialData(),this.data.sorting.sortBy="order_id"}getTabs(){return{all:p("All"),active:p("Active"),inactive:p("Inactive"),expired:p("Expired"),disabled:p("Disabled")}}getToggleableColumns(){return[{label:p("Order ID"),value:"order_id"},{label:p("Product"),value:"product"},{label:p("Customer"),value:"customer"},{label:p("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 p("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 At(a){return Tt.init(a)}class Ut extends Ge{constructor(){super(...arguments);ke(this,"data",{summaryData:[],lineChartData:[],pieChartData:[],isBusy:!1})}get controllerKey(){return"LicenseReportController"}beforeInit(){}makeRequest(s,k,r,i){this.data.isBusy=!0,typeof k!="object"&&(k={});const S=xe.get(`reports/${s}`,k);return this.resolvePromiseResponse(S,r,i),S}resolvePromiseResponse(s,k=null,r=null){s.then(i=>{r==null||k==null||(this.data[r]=i[k])}).catch(i=>{console.log(i,"error")}).finally(()=>{this.data.isBusy=!1})}getLicenseLineChart(s={}){return this.makeRequest("license-chart",s,"lineChartData","lineChartData")}getLicensePieChart(s={}){return this.makeRequest("license-pie-chart",s,"pieChartData","pieChartData")}getSummary(s={}){return this.makeRequest("license-summary",s,"summaryData","summaryData")}}const F=Ut.init(),Mt={class:"fct-license-statistics-wrap"},It={class:"fct-btn-group sm"},Ot={class:"chart-action-wrap"},Bt={class:"chart-change-wrap"},Nt={class:"chart-change"},Ft={class:"text"},Rt={class:"chart-change"},zt={class:"text"},Ht={__name:"LicenseStatistics",props:{reportFilter:{type:Object}},setup(a){const t=a,s=O(null),k=O("daily"),r=O("line"),i=O([X().startOf("month"),X()]),S=[{value:"daily",label:"Daily"},{value:"monthly",label:"Monthly"},{value:"yearly",label:"Yearly"}],L=ee(()=>[{title:"Total License",key:"total_license",color:"#2ecc71"}].map(({title:_,key:d,color:C},v)=>g(_,r.value,v%2,F.data.lineChartData.map(M=>M.license_count),C))),b=ee(()=>F.data.lineChartData.map(_=>{if(k.value==="daily"){const[d,C,v]=_.date.split("-");return`${Ce[parseInt(C)-1]} ${v}, ${d}`}else{if(k.value==="monthly")return`${Ce[parseInt(_.month)-1]} ${_.year}`;if(k.value==="yearly")return`${_.year}`}}));let D=null;const E=()=>{s.value&&D===null&&(D=De(s.value),y())},y=()=>{const _={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"axis",backgroundColor:q.isDark()?"#38485a":"#ffffff",borderColor:q.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1,textStyle:{color:q.isDark()?"#ffffff":"#565865"}},xAxis:{type:"category",data:b.value,axisLabel:{color:q.isDark()?"#ffffff":"#565865",fontSize:12}},yAxis:[{type:"value",axisLabel:{color:q.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!0,lineStyle:{color:q.isDark()?"#38485a":"#D6DAE1"}}},{type:"value",position:"right",axisLabel:{color:q.isDark()?"#ffffff":"#565865",fontSize:12},splitLine:{show:!1}}],dataZoom:[],series:L.value};D.setOption(_,{notMerge:!0,replaceMerge:["series"]})},T=()=>{const _={startDate:i.value[0].toISOString(),endDate:i.value[1].toISOString()};F.getLicenseLineChart({params:{..._,groupKey:k.value}})},g=(_,d,C,v,M)=>({name:_,type:d,yAxisIndex:C,data:v,smooth:!0,color:M,lineStyle:{width:3}}),I=()=>{T()},f=()=>{T()},U=_=>{r.value!==_&&(r.value=_,y())};return oe([()=>F.chartData,r],()=>{G(y)},{deep:!0}),oe(()=>F.data.lineChartData,()=>{G(()=>{y()})},{deep:!0}),me(()=>{window.removeEventListener("onFluentCartThemeChange",y,!1)}),ce(()=>{window.addEventListener("onFluentCartThemeChange",y),T(),G(E)}),(_,d)=>{const C=u("el-option"),v=u("el-select"),M=u("el-date-picker");return o(),h("div",Mt,[e(N,{id:"chartContainer"},{default:n(()=>[e(R,{title:_.$t("License Chart"),title_size:"small",border_bottom:""},{action:n(()=>[l("div",It,[e(Ne,{activeType:r.value,types:{line:"LineChart",bar:"BarChart"},onChange:U},null,8,["activeType"]),e(v,{class:"w-[100px] el-select--x-small",modelValue:k.value,"onUpdate:modelValue":d[0]||(d[0]=V=>k.value=V),onChange:f},{default:n(()=>[(o(),h(A,null,z(S,V=>e(C,{key:V.value,label:_.$t(V.label),value:V.value},null,8,["label","value"])),64))]),_:1},8,["modelValue"]),e(M,{class:"w-[220px] el-range-editor--x-small hide-close-icon",modelValue:i.value,"onUpdate:modelValue":d[1]||(d[1]=V=>i.value=V),type:"daterange","range-separator":"-","start-placeholder":_.$t("Start date"),"end-placeholder":_.$t("End date"),"unlink-panels":"",clearable:!1,shortcuts:m(Fe),onChange:I},null,8,["modelValue","start-placeholder","end-placeholder","shortcuts"])])]),_:1},8,["title"]),e(B,null,{default:n(()=>[l("div",{class:"fct-license-statistics-chart",ref_key:"chartRef",ref:s},null,512),l("div",Ot,[l("div",Bt,[l("div",Nt,[d[2]||(d[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",Ft,c(_.$t("Data")),1)]),l("div",Rt,[l("span",zt,c(_.$t("Timeline")),1),d[3]||(d[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})])}}},jt={class:"fct-usage-statistics-chart-wrap"},qt={class:"fct-usage-statistics-info flex items-center justify-between"},Yt={class:"text-lg font-semibold text-system-dark dark:text-gray-50"},Kt={class:"text-xs font-medium text-system-mid dark:text-gray-300"},Wt={class:"fct-custom-legend",style:{width:"100%"}},Gt={style:{margin:"0 0 15px 0","font-size":"14px","font-weight":"600"}},Xt={class:"legend-items"},Zt=["onClick","onMouseenter","onMouseleave"],Jt={style:{flex:"1","min-width":"0"}},Qt={style:{display:"flex","justify-content":"space-between","align-items":"center"}},en=["title"],tn={class:"legend-item-percentage"},nn={class:"legend-item-count"},an={class:"fct-custom-legend-controls"},ln={class:"fct-action-link-btn"},sn={class:"fct-chart-container",style:{display:"flex","align-items":"flex-start"}},on={__name:"UsageStatistics",props:{reportFilter:{type:Object},activatedSites:String|Number},setup(a){const t=a,s=q.colors;s.blue;const k=O(null),r=O("daily"),i=O("pie"),S=O([X().startOf("month"),X()]),L=O({}),b=ee(()=>F.data.pieChartData?F.data.pieChartData.map((C,v)=>({name:C.post_title,value:C.activation_count,percentage:C.percentage,color:D(v),visible:L.value[C.post_title]!==!1})):[]),D=C=>{const v=["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc","#ffb347"];return v[C%v.length]},E=ee(()=>F.data.pieChartData.filter(C=>L.value[C.post_title]!==!1).map((C,v)=>({value:C.activation_count,name:C.post_title,itemStyle:{color:D(F.data.pieChartData.findIndex(M=>M.post_title===C.post_title))}})));let y=null;const T=()=>{k.value&&y===null&&(y=De(k.value),g())},g=()=>{if(!y)return;const C={title:{text:t.chartTitle??"",left:"center"},legend:{show:!1},tooltip:{trigger:"item",formatter:"{b}: {c} ({d}%)",borderRadius:8,backgroundColor:q.isDark()?"#38485a":"#ffffff",textStyle:{color:q.isDark()?s.gray[25]:s.system.mid},borderColor:q.isDark()?"#4a5a6b":"#c0c4ca",borderWidth:1},series:[{type:"pie",radius:"55%",center:["50%","50%"],data:E.value,label:{show:!0,color:q.isDark()?s.gray[25]:s.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)"}}}]};y.setOption(C,{notMerge:!0,replaceMerge:["series"]})},I=C=>{L.value[C.name]=!C.visible,G(()=>{g()})},f=(C,v)=>{y&&(v?y.dispatchAction({type:"highlight",name:C.name}):y.dispatchAction({type:"downplay",name:C.name}))},U=()=>{const C={startDate:S.value[0].toISOString(),endDate:S.value[1].toISOString()};F.getLicensePieChart({params:{...C,groupKey:r.value}})},_=()=>{F.data.pieChartData&&F.data.pieChartData.forEach(C=>{C.post_title in L.value||(L.value[C.post_title]=!0)})};oe([()=>F.chartData,i],()=>{G(g)},{deep:!0}),oe(()=>F.data.pieChartData,()=>{_(),G(()=>{g()})},{deep:!0});const d=C=>{g()};return ce(()=>{window.addEventListener("onFluentCartThemeChange",d),U(),G(T)}),me(()=>{window.removeEventListener("onFluentCartThemeChange",d)}),(C,v)=>{const M=u("el-popover");return o(),h("div",jt,[l("div",qt,[l("div",Yt,[x(c(a.activatedSites)+" ",1),l("div",Kt,c(C.$t("Total Activated Sites")),1)]),e(M,{placement:"bottom-start",width:226,trigger:"click","popper-class":"fct-license-statistics-popover"},{reference:n(()=>[l("div",ln,[e(de,null,{default:n(()=>[e(H,{name:"More"})]),_:1})])]),default:n(()=>[l("div",Wt,[l("h4",Gt,c(C.$t("License Distribution")),1),l("div",Xt,[(o(!0),h(A,null,z(b.value,V=>(o(),h("div",{key:V.name,class:ie(["legend-item",{"legend-item-hidden":!V.visible}]),onClick:Z=>I(V),onMouseenter:Z=>f(V,!0),onMouseleave:Z=>f(V,!1),style:Le({opacity:V.visible?1:.5})},[l("div",{class:"legend-color",style:Le({backgroundColor:V.color})},null,4),l("div",Jt,[l("div",Qt,[l("span",{class:"legend-item-name",title:V.name},c(V.name),9,en),l("span",tn,c(V.percentage)+"% ",1)]),l("div",nn,c(m(p)("%s licenses",V.value.toLocaleString())),1)])],46,Zt))),128))]),l("div",an,[l("button",{onClick:v[0]||(v[0]=()=>{Object.keys(L.value).forEach(V=>L.value[V]=!0),G(g)})},c(C.$t("Show All")),1),l("button",{onClick:v[1]||(v[1]=()=>{Object.keys(L.value).forEach(V=>L.value[V]=!1),G(g)})},c(C.$t("Hide All")),1)])])]),_:1})]),l("div",sn,[l("div",{class:"fct-usage-statistics-chart",ref_key:"chartRef",ref:k,style:{flex:"1",height:"350px"}},null,512)])])}}},rn=W(on,[["__scopeId","data-v-2fd9c692"]]),cn={},dn={class:"p-4 bg-gray-25 rounded dark:bg-primary-500"},un={class:"flex items-center gap-2 mb-3"},_n={class:"right flex flex-col flex-1 gap-2"};function mn(a,t){const s=u("el-skeleton-item"),k=u("el-skeleton");return o(),h(A,null,z(4,r=>e(k,{animated:"",key:r},{template:n(()=>[l("div",dn,[l("div",un,[e(s,{variant:"p",class:"rounded w-10 h-10 block"}),l("div",_n,[e(s,{variant:"p",class:"rounded w-4/5 block"}),e(s,{variant:"p",class:"rounded w-1/2 block"})])]),l("div",null,[e(s,{variant:"p",class:"rounded w-2/3 block"})])])]),_:2},1024)),64)}const pn=W(cn,[["render",mn]]),hn={name:"LicensesStatsCard",props:{licenseOverview:{type:Object,required:!0},loading:{type:Boolean}},components:{DynamicIcon:H,LicenseStatLoader:pn},methods:{translate:p}},fn={class:"licenses-stats-card-head"},gn={class:"licenses-icon"},vn={class:"licenses-stats-card-head-content"},bn={class:"title"},yn={class:"value"},wn={class:"text"};function kn(a,t,s,k,r,i){const S=u("LicenseStatLoader"),L=u("DynamicIcon");return s.loading?(o(),$(S,{key:0})):(o(!0),h(A,{key:1},z(s.licenseOverview,(b,D)=>(o(),h("div",{class:ie(`licenses-stats-card ${D}`),key:D},[l("div",fn,[l("div",gn,[e(L,{name:b.icon},null,8,["name"])]),l("div",vn,[l("div",bn,c(i.translate(b.title)),1),l("div",yn,c(b.value),1)])]),l("div",wn,c(i.translate(b.text)),1)],2))),128))}const Ln=W(hn,[["render",kn]]),Cn={name:"LicenseStats",props:{licenses:{type:Array,required:!0}},components:{DynamicIcon:H,CardBody:B,CardHeader:R,CardContainer:N,LicenseStatistics:Ht,UsageStatistics:rn,LicensesStatsCard:Ln},data(){return{loading:!1,licenseSummary:{}}},methods:{translate:p,fetchSummary(){this.loading=!0,this.$get("reports/license-summary",{params:{start_date:X().startOf("month").format("YYYY-MM-DD"),end_date:X().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()}},Sn={class:"fct-license-stats-wrap"},Dn={class:"licenses-stats-row"},xn={class:"fct-usage-statistics-wrap"};function $n(a,t,s,k,r,i){const S=u("CardHeader"),L=u("LicensesStatsCard"),b=u("CardBody"),D=u("CardContainer"),E=u("LicenseStatistics"),y=u("el-col"),T=u("el-skeleton"),g=u("UsageStatistics"),I=u("el-row");return o(),h("div",Sn,[e(D,null,{default:n(()=>[e(S,{title:i.translate("Overall License Stats"),border_bottom:"",title_size:"small"},null,8,["title"]),e(b,null,{default:n(()=>[l("div",Dn,[e(L,{licenseOverview:i.licenseOverview,loading:r.loading},null,8,["licenseOverview","loading"])])]),_:1})]),_:1}),e(I,{gutter:30},{default:n(()=>[e(y,{md:24,lg:16},{default:n(()=>[e(E)]),_:1}),e(y,{md:24,lg:8},{default:n(()=>[e(D,null,{default:n(()=>[e(S,{title:i.translate("Usage Statistics"),border_bottom:"",title_size:"small"},null,8,["title"]),e(b,null,{default:n(()=>[l("div",xn,[r.loading?(o(),$(T,{key:0,animated:"",rows:4})):(o(),$(g,{key:1,activatedSites:i.totalActivatedSites},null,8,["activatedSites"]))])]),_:1})]),_:1})]),_:1})]),_:1})])}const En=W(Cn,[["render",$n]]),Pn={class:"table-cell"},Vn={class:"w-full flex flex-col items-start justify-start gap-1"},Tn={class:"table-cell"},An={class:"w-full flex flex-col items-start justify-start gap-1"},Un={class:"table-cell"},Mn={class:"table-cell"},In={class:"table-cell"},On={__name:"LicensesLoader",props:{nextPageCount:{type:Number,default:0},licenseTable:{type:Object,default:()=>({})}},setup(a){const t=a,s=r=>t.licenseTable.columns.includes(r),k=Array.from({length:t.nextPageCount},(r,i)=>i+1);return(r,i)=>{const S=u("el-table-column"),L=u("el-skeleton-item"),b=u("el-table"),D=u("el-skeleton");return o(),$(D,{animated:""},{template:n(()=>[e(b,{data:m(k),class:"w-full compact-table responsive"},{empty:n(()=>i[0]||(i[0]=[])),default:n(()=>[w("",!0),e(S,{label:r.$t("License Key"),width:220},{default:n(()=>[l("div",Pn,[l("div",Vn,[e(L,{varient:"p",class:"w-1/5"}),e(L,{varient:"p",class:"w-3/5"})])])]),_:1},8,["label"]),s("product")!==-1?(o(),$(S,{key:1,width:200,label:r.$t("Product")},{default:n(()=>[l("div",Tn,[l("div",An,[e(L,{varient:"p",class:"w-1/5"}),e(L,{varient:"p",class:"w-2/5"})])])]),_:1},8,["label"])):w("",!0),s("order_id")!==-1?(o(),$(S,{key:2,width:80,label:r.$t("Order ID")},{default:n(()=>[l("div",Un,[e(L,{varient:"p",class:"w-3/5"})])]),_:1},8,["label"])):w("",!0),s("customer")!==-1?(o(),$(S,{key:3,width:100,label:r.$t("Customer")},{default:n(()=>[l("div",Mn,[e(L,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])):w("",!0),e(S,{width:"100",label:r.$t("Activations")},{default:n(()=>[l("div",In,[e(L,{varient:"p",class:"w-4/5"})])]),_:1},8,["label"])]),_:1},8,["data"])]),_:1})}}},Bn={},Nn={class:"px-4 py-3"},Fn={class:"grid grid-cols-3 gap-5 mt-5"};function Rn(a,t){const s=u("el-skeleton-item"),k=u("el-skeleton");return o(),$(k,{animated:""},{template:n(()=>[l("div",Nn,[(o(),h(A,null,z(2,r=>l("div",{key:r,class:"flex items-center justify-between mb-3"},[e(s,{varient:"p",class:"w-1/2"}),e(s,{varient:"p",class:"w-[100px]"})])),64)),l("div",Fn,[(o(),h(A,null,z(3,r=>l("div",{key:r},[e(s,{varient:"p",class:"w-1/2"}),e(s,{varient:"p",class:"w-[100px]"})])),64))])])]),_:1})}const zn=W(Bn,[["render",Rn]]),Hn={name:"LicenseTableMobile",components:{ProductInfo:qe,UserCan:le,RouteCell:Ue,DynamicIcon:H,IconButton:de,CopyToClipboard:ue,Empty:pe,Badge:K},props:{licenses:{type:Array,required:!0},columns:{type:Array,default(){return["product","order_id","customer","date"]}},emptyText:{type:String,default:p("No Licenses found based on your filter")}},computed:{Clipboard(){return Ze},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:p,formatDate:Q}},jn={class:"fct-table-mobile-wrap fct-licenses-table-mobile"},qn=["onClick"],Yn={class:"fct-table-status-col"},Kn={key:0,class:"fct-table-date-col"},Wn={key:0},Gn={key:1},Xn={class:"fct-table-mobile-body"},Zn=["onClick"],Jn={class:"fct-license-key-wrap has-bg"},Qn={class:"fct-license-key"},ea={class:"fct-license-key-inner pr-2"},ta={class:"fct-table-mobile-footer"},na={class:"fct-table-mobile-footer-row"},aa={key:0,class:"fct-table-id-col"},la={class:"title"},sa={key:1,class:"fct-table-customer-col"},ia={class:"title"},oa={class:"fct-table-activations-col"},ra={class:"title"},ca={key:0,class:"py-6 text-center"};function da(a,t,s,k,r,i){const S=u("Badge"),L=u("ProductInfo"),b=u("router-link"),D=u("DynamicIcon"),E=u("el-tooltip"),y=u("Empty"),T=u("UserCan");return o(),$(T,{permission:"licenses/view"},{default:n(()=>[l("div",jn,[(o(!0),h(A,null,z(i.formattedLicense,(g,I)=>(o(),h("div",{key:g.id,class:"fct-table-mobile-row"},[l("div",{class:"fct-table-mobile-header",onClick:f=>a.$router.push({name:"view_license",params:{license_id:g==null?void 0:g.id}})},[l("div",Yn,[(o(),$(S,{status:g.status,key:g.id},null,8,["status"]))]),s.columns.indexOf("date")!==-1?(o(),h("div",Kn,[l("span",null,c(i.formatDate(g.created_at)),1),t[0]||(t[0]=l("span",{class:"px-1"},"-",-1)),g.expiration_date?(o(),h("span",Wn,c(i.formatDate(g.expiration_date)),1)):(o(),h("span",Gn,c(i.translate("Lifetime")),1))])):w("",!0)],8,qn),l("div",Xn,[s.columns.indexOf("product")!==-1?(o(),h("div",{key:0,class:"fct-table-product-col",onClick:f=>a.$router.push({name:"view_license",params:{license_id:g==null?void 0:g.id}})},[e(L,{product:g.product,hideProductId:!0,hideViewIcon:!0,hideImage:!0},null,8,["product"])],8,Zn)):w("",!0),l("div",Jn,[l("div",Qn,[l("div",ea,[e(b,{class:"link",to:{name:"view_license",params:{license_id:g==null?void 0:g.id}}},{default:n(()=>[x(c(g.license_key),1)]),_:2},1032,["to"])]),e(E,{content:g.license_key,placement:"top","popper-class":"fct-tooltip"},{default:n(()=>[e(D,{class:"cursor-pointer p-1 w-6 h-6",name:"Copy",onClick:()=>{i.Clipboard.copy(g.license_key,{successMessage:i.translate("License Key copied to clipboard"),errorMessage:i.translate("Failed to copy License Key")})}},null,8,["onClick"])]),_:2},1032,["content"])])])]),l("div",ta,[l("div",na,[s.columns.indexOf("order_id")!==-1?(o(),h("div",aa,[l("div",la,c(i.translate("Order ID")),1),e(b,{class:"value",to:{name:"view_order",params:{order_id:g.order_id}}},{default:n(()=>[x(" #"+c(g.order_id),1)]),_:2},1032,["to"])])):w("",!0),s.columns.indexOf("customer")!==-1?(o(),h("div",sa,[l("div",ia,c(i.translate("Customer")),1),e(b,{class:"value",to:{name:"view_customer",params:{customer_id:g.customer_id}}},{default:n(()=>{var f;return[x(c(((f=g==null?void 0:g.customer)==null?void 0:f.full_name)||i.translate("No Name")),1)]}),_:2},1032,["to"])])):w("",!0),l("div",oa,[l("div",ra,c(i.translate("Activations")),1),e(b,{class:"value",to:{name:"view_license",params:{license_id:g==null?void 0:g.id}}},{default:n(()=>[x(c(g.activation_count)+" "+c("/")+" "+c(g.limit===0?"Unlimited":g.limit),1)]),_:2},1032,["to"])])])])]))),128)),i.formattedLicense.length===0?(o(),h("div",ca,[e(y,{icon:"Empty/ListView","has-dark":"",text:s.emptyText},null,8,["text"])])):w("",!0)])]),_:1})}const ua=W(Hn,[["render",da]]),_a={class:"fct-all-license-page fct-layout-width"},ma={class:"fct-all-license-wrap"},pa={key:1},ha={__name:"Licenses",setup(a){const t=At(),s=O(!1),k=O(!1),r=()=>{k.value=window.innerWidth<768},i=L=>{L==="show_license_stats"&&(Se.set("show_license_stats",!s.value),s.value=!s.value)},S=()=>{const L=Se.get("show_license_stats");L&&(s.value=L)};return ce(()=>{S(),r(),window.addEventListener("resize",r)}),me(()=>{window.removeEventListener("resize",r)}),(L,b)=>{const D=u("el-icon"),E=u("el-button"),y=u("el-dropdown-item"),T=u("el-dropdown-menu"),g=u("el-dropdown");return o(),h("div",_a,[e(Re,{title:m(p)("Licenses")},{action:n(()=>[e(le,{permission:"reports/view"},{default:n(()=>[e(g,{trigger:"click","popper-class":"fct-dropdown",onCommand:i,placement:"bottom-end"},{dropdown:n(()=>[e(T,null,{default:n(()=>[e(y,{command:"show_license_stats"},{default:n(()=>[s.value?(o(),h(A,{key:1},[e(H,{name:"EyeOff"}),x(" "+c(m(p)("Hide License Stats")),1)],64)):(o(),h(A,{key:0},[e(H,{name:"Eye"}),x(" "+c(m(p)("Show License Stats")),1)],64))]),_:1})]),_:1})]),default:n(()=>[e(E,null,{default:n(()=>[x(c(m(p)("More actions"))+" ",1),e(D,null,{default:n(()=>[e(m(ze))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["title"]),e(le,{permission:"reports/view"},{default:n(()=>[s.value?(o(),$(En,{key:0,licenses:m(t).getTableData()},null,8,["licenses"])):w("",!0)]),_:1}),e(le,{permission:"licenses/view"},{default:n(()=>[l("div",ma,[e(Me,{table:m(t),classicTabStyle:!0,"has-mobile-slot":!0},{mobile:n(()=>[m(t).isLoading()?(o(),$(zn,{key:0})):w("",!0),m(t).isLoading()?w("",!0):(o(),$(ua,{key:1,licenses:m(t).getTableData(),columns:m(t).data.columns},null,8,["licenses","columns"]))]),default:n(()=>[m(t).isLoading()?(o(),$(On,{key:0,licenseTable:m(t),"next-page-count":m(t).nextPageCount},null,8,["licenseTable","next-page-count"])):(o(),h("div",pa,[e(Ye,{licenses:m(t).getTableData(),columns:m(t).data.columns},null,8,["licenses","columns"])]))]),_:1},8,["table"])])]),_:1})])}}},fa={class:"el-form--label-top fct-plan-changer-content-wrap"},ga={key:0},va=["innerHTML"],ba={key:1},ya=["innerHTML"],wa={key:1,class:"fct-btn-group"},ka={__name:"PlanChanger",props:{variations:{},product_id:"",variation_id:"",license:null,order:null,upgrade_path_base:""},setup(a){const t=a,s=O(!1),k=()=>{s.value=!0},r=Pe().ctx,i=O(""),S=O([]);let L=O(null);const b=ee(()=>{var _,d;return re.get("shop.currency_sign")?re.get("shop.currency_sign"):(d=(_=window.fluentcart_customer_profile_vars)==null?void 0:_.shop)!=null&&d.currency_sign?window.fluentcart_customer_profile_vars.shop.currency_sign:""}),D=ee(()=>{var _;return(_=t.order)==null?void 0:_.order_items.find(d=>d.payment_type==="subscription"||d.payment_type==="adjustment"||d.payment_type==="onetime")}),E=function(_){let d="";const C=_==null?void 0:_.payment_type,v=_==null?void 0:_.other_info;if((v==null?void 0:v.payment_type)==="subscription"&&C!=="adjustment"){(v==null?void 0:v.manage_setup_fee)==="yes"&&(d+=v.signup_fee_name+" : "+b.value+parseFloat(v.signup_fee/100)+", ");const M=Number(v==null?void 0:v.times)?(v==null?void 0:v.times)+" times":", Until Cancel";return d+=(_==null?void 0:_.formatted_total)+" Subscriptions "+v.repeat_interval+" "+M,d}else if((v==null?void 0:v.payment_type)==="subscription"&&C==="adjustment"){(v==null?void 0:v.manage_setup_fee)==="yes"&&(d+=v.signup_fee_name+" :"+parseFloat(v.signup_fee/100)+", ");const M=Number(v==null?void 0:v.times)?(v==null?void 0:v.times)+" times":", Until Cancel";return d+=(_==null?void 0:_.formatted_total)+" Subscriptions "+v.repeat_interval+" "+M,d}else if((v==null?void 0:v.payment_type)==="onetime")return d+=(_==null?void 0:_.formatted_total)+" One Time Payment";return _==null?void 0:_.other_info.billing_summary};let y=O("");const T=_=>{L=t.variations.find(d=>d.id.toString()===_),y.value=E(L)},g=_=>{var C,v;return((C=_==null?void 0:_.other_info)==null?void 0:C.payment_type)==="subscription"?(_==null?void 0:_.variation_title)+" - "+Je.capitalize((v=_==null?void 0:_.other_info)==null?void 0:v.repeat_interval):(_==null?void 0:_.variation_title)+" - One Time Payment"},I=()=>{r.$get(`products/${t.product_id}/upgrade-paths`,{variation_id:t.variation_id}).then(_=>{_.data.forEach((d,C)=>{d.object_id===t.variation_id&&d.value.to_variants.forEach((v,M)=>{S.value.push({id:v,variation_title:g(t.variations.find(V=>V.id.toString()===v)),payment_type:d.payment_type,is_prorate:d.value.is_prorate,discount_amount:d.value.discount_amount})})})})},f=_=>{let d=_.discount_amount;return d>0?_.variation_title+" - "+(_.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")+" ( "+d+b.value+" discount )":_.variation_title+" - "+(_.is_prorate.toString()==="1"?"( Prorated )":"(Full Charge Applies)")};ce(()=>{I()});const U=()=>{if(i.value){const _=new URL(t.upgrade_path_base);return _.searchParams.append("order_hash",t.order.uuid),_.searchParams.append("mode","upgrade_plan"),_.searchParams.append("variation_id",i.value),_.href}return!1};return(_,d)=>{const C=u("el-button"),v=u("el-option"),M=u("el-select"),V=u("el-form-item"),Z=u("el-dialog");return S.value.length>0&&D.value?(o(),h(A,{key:0},[e(C,{class:"el-button--x-small",onClick:k,type:"primary"},{default:n(()=>[x(c(_.$t("Change Plan")),1)]),_:1}),e(Z,{modelValue:s.value,"onUpdate:modelValue":d[1]||(d[1]=Y=>s.value=Y),title:_.$t("Change Plan"),"append-to-body":!0},{default:n(()=>[l("div",fa,[S.value.length>0?(o(),$(V,{key:0,label:_.$t("Change Plan to")},{default:n(()=>[e(M,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=Y=>i.value=Y),onChange:T,clearable:""},{default:n(()=>[(o(!0),h(A,null,z(S.value,Y=>(o(),$(v,{key:Y.id,label:f(Y),value:Y.id.toString()},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])):w("",!0),e(V,{label:_.$t("New Plan")},{default:n(()=>[m(y)?(o(),h("span",ga,[l("span",{innerHTML:m(y),class:"fct-plan-changer-text"},null,8,va)])):(o(),h("span",ba,"---"))]),_:1},8,["label"]),e(V,{label:_.$t("Current Plan")},{default:n(()=>[l("span",{innerHTML:E(D.value),class:"fct-plan-changer-text"},null,8,ya)]),_:1},8,["label"]),U()?(o(),h("div",wa,[e(C,{type:"primary",tag:"a",href:U(),target:"_blank",rel:"noopener noreferrer",size:"small"},{default:n(()=>[x(c(_.$t(" Upgrade to New Plan")),1)]),_:1},8,["href"]),e(ue,{showMode:"basic_copy_btn",text:U()},null,8,["text"])])):w("",!0)])]),_:1},8,["modelValue","title"])],64)):w("",!0)}}},La={name:"UpgradePlan",components:{CopyToClipboard:ue,DynamicIcon:H},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 re.get("shop.currency_sign")?re.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:p,showUpgradePlanModal(){xe.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}}},Ca={class:"fct-upgrade-plan"},Sa={key:0,class:"fct-upgrade-variation-table"},Da={class:"upgrade-title"},xa={class:"plan-price"},$a={class:"plan-price"},Ea={class:"upgrade-cost"},Pa={class:"upgrade-title"},Va=["innerHTML"],Ta={key:0,class:"upgrade-text"},Aa={class:"upgrade-action"},Ua={key:1};function Ma(a,t,s,k,r,i){const S=u("el-button"),L=u("el-table-column"),b=u("el-table"),D=u("el-dialog");return o(),h("div",Ca,[s.has_upgrades?(o(),$(S,{key:0,size:"small",onClick:i.showUpgradePlanModal},{default:n(()=>[x(c(a.$t("Upgrade")),1)]),_:1},8,["onClick"])):w("",!0),e(D,{modelValue:r.upgradePlanModal,"onUpdate:modelValue":t[0]||(t[0]=E=>r.upgradePlanModal=E),"append-to-body":s.appendToBody,title:a.$t("Upgrade"),class:"fct-upgrade-plan-dialog fluent-cart-customer-profile-app"},{default:n(()=>[r.upgradePaths.length>0?(o(),h("div",Sa,[e(b,{data:r.upgradePaths,style:{width:"100%"}},{default:n(()=>[e(L,{label:a.$t("Package"),width:290},{default:n(E=>[l("div",Da,c(E.row.title),1)]),_:1},8,["label"]),e(L,{label:a.$t("Price"),width:100},{default:n(E=>[l("div",xa,[l("div",$a,c(a.formatNumber(E.row.price,s.order.currency)),1)])]),_:1},8,["label"]),e(L,{label:a.$t("Amount to pay")},{default:n(E=>[l("div",Ea,[l("div",Pa,[l("span",{innerHTML:E.row.payment_summary},null,8,Va),E.row.prorate_credit?(o(),h("div",Ta)):w("",!0)])])]),_:1},8,["label"]),e(L,{label:a.$t("Action"),width:110},{default:n(E=>[l("div",Aa,[e(S,{class:"el-button--x-small",tag:"a",href:E.row.upgrade_url,target:"_blank"},{default:n(()=>[x(c(a.$t("Upgrade")),1)]),_:2},1032,["href"])])]),_:1},8,["label"])]),_:1},8,["data"])])):(o(),h("div",Ua,c(a.$t("No upgrade plan found")),1))]),_:1},8,["modelValue","append-to-body","title"])])}const Ia=W(La,[["render",Ma]]),Oa={name:"LicenseInformation",components:{Badge:K,CopyToClipboard:ue,DynamicIcon:H,IconButton:de,PlanChanger:ka,UpgradePlan:Ia},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:p,formatDate:Q,translateNumber:p,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=X(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",s=>{s.key==="Enter"&&this.handleDateChange()})}},Ba={class:"fct-license-info-content"},Na={class:"flex items-center gap-2"},Fa={class:"fct-input-with-action-wrap"},Ra={class:"fct-input-with-action"},za={class:"fct-license-product"},Ha={class:"text-xs"},ja={class:"fct-license-inline-action-wrap"},qa={key:1,class:"text"},Ya={key:2,class:"separator"},Ka={class:"inline-action-button"},Wa={class:"text"},Ga={class:"fct-license-inline-action-wrap"},Xa={key:0,class:"inline-action-input-group mr-2"},Za={key:0,class:"fct-license-activation-limit-actions"},Ja={key:1,class:"text"},Qa={key:2,class:"separator"},el={class:"inline-action-button"},tl={class:"text"},nl={class:"fct-license-info-form-show-on-mobile"},al={class:"fct-license-info-mobile-header"},ll={class:"fct-license-info-mobile-body"},sl={class:"fct-license-product"},il={class:"text-xs text-system-mid dark:text-gray-300"},ol={class:"fct-input-with-action-wrap"},rl={class:"fct-input-with-action"},cl={class:"fct-input-with-action-icon"},dl={class:"fct-license-info-mobile-footer"},ul={class:"fct-license-info-mobile-footer-item"},_l={class:"title"},ml={class:"fct-license-inline-action-wrap"},pl={key:1,class:"text"},hl={key:2,class:"separator"},fl={class:"inline-action-button"},gl={class:"text"},vl={class:"fct-license-info-mobile-footer-item"},bl={class:"title"},yl={class:"fct-license-inline-action-wrap"},wl={key:0,class:"inline-action-input-group mr-2"},kl={key:0,class:"fct-license-activation-limit-actions"},Ll={key:1,class:"text"},Cl={key:2,class:"separator"},Sl={class:"inline-action-button"},Dl={class:"text"};function xl(a,t,s,k,r,i){var M,V,Z,Y,he,fe,ge,ve;const S=u("CopyToClipboard"),L=u("el-input"),b=u("DynamicIcon"),D=u("el-button"),E=u("el-popconfirm"),y=u("el-form-item"),T=u("el-col"),g=u("router-link"),I=u("UpgradePlan"),f=u("el-date-picker"),U=u("el-input-number"),_=u("IconButton"),d=u("el-row"),C=u("el-form"),v=u("Badge");return o(),h("div",Ba,[e(C,{class:"fct-license-info-form-hide-on-mobile",model:s.license,"label-position":"top"},{default:n(()=>[e(d,null,{default:n(()=>[e(T,{lg:24},{default:n(()=>[e(y,{label:""},{label:n(()=>[l("div",Na,[x(c(i.translate("License Key"))+" ",1),e(S,{text:s.license.license_key,showMode:"basic_copy_btn",tooltipText:i.translate("Copy License")},null,8,["text","tooltipText"])])]),default:n(()=>[l("div",Fa,[e(L,{modelValue:s.license.license_key,"onUpdate:modelValue":t[0]||(t[0]=P=>s.license.license_key=P),disabled:""},null,8,["modelValue"]),l("div",Ra,[e(E,{width:"250","confirm-button-text":i.translate("Confirm"),"cancel-button-text":i.translate("No, Thanks"),title:i.translate("Are you sure to regenerate?"),onConfirm:i.regenerateLicenseKey},{reference:n(()=>[e(D,{class:"el-button--x-small",plain:""},{default:n(()=>[e(b,{name:"Reload"}),x(" "+c(i.translate("Regenerate")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),_:1})]),_:1}),e(T,{lg:24},{default:n(()=>[s.product!=null?(o(),$(y,{key:0,label:i.translate("Product Name")},{default:n(()=>{var P;return[l("div",za,[e(g,{class:"link",to:{name:"product_edit",params:{product_id:s.product.ID}}},{default:n(()=>{var J;return[x(c(s.product.post_title)+" ",1),l("span",Ha," – "+c((J=r.variations.find(ae=>ae.id==s.license.variation_id))==null?void 0:J.variation_title),1)]}),_:1},8,["to"]),((P=r.variations)==null?void 0:P.length)>0?(o(),$(I,{key:0,variation_id:r.variation_id,product_id:s.product.ID,order:s.order,props_variations:r.variations,endpoint_path:"products",has_upgrades:s.license.has_upgrades&&!["expired","disabled"].includes(s.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):w("",!0)])]}),_:1},8,["label"])):w("",!0)]),_:1}),e(T,{lg:12},{default:n(()=>[e(y,{label:i.translate("Purchase Date")},{default:n(()=>{var P;return[l("span",null,c(i.formatDate((P=s.license)==null?void 0:P.created_at)),1)]}),_:1},8,["label"])]),_:1}),e(T,{lg:12},{default:n(()=>[e(y,{label:i.translate("Expirations date")},{default:n(()=>{var P,J,ae,be,ye,we;return[l("div",ja,[r.isExpirationDateEnable?(o(),$(f,{key:0,modelValue:r.selectedDate,"onUpdate:modelValue":t[1]||(t[1]=te=>r.selectedDate=te),placeholder:i.formatDate((P=s.license)==null?void 0:P.expiration_date)?i.formatDate((J=s.license)==null?void 0:J.expiration_date):i.translate("Lifetime"),"default-value":(ae=s.license)==null?void 0:ae.expiration_date,type:"date",ref:"calendar",onChange:i.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(o(),h("span",qa,c((be=s.license)!=null&&be.expiration_date?i.formatDate((ye=s.license)==null?void 0:ye.expiration_date):"Lifetime"),1)),r.isExpirationDateEnable?w("",!0):(o(),h("span",Ya)),l("div",Ka,[l("a",{href:"#",onClick:t[2]||(t[2]=j((...te)=>i.handleToggleExpirationDate&&i.handleToggleExpirationDate(...te),["prevent"]))},c(r.isExpirationDateEnable?i.translate("Cancel"):i.translate("Edit")),1),!r.isExpirationDateEnable&&((we=s.license)!=null&&we.expiration_date)?(o(),h(A,{key:0},[l("span",Wa,c(i.translate("or")),1),l("a",{href:"#",onClick:t[3]||(t[3]=j((...te)=>i.handleLifetimeLicense&&i.handleLifetimeLicense(...te),["prevent"]))},c(i.translate("Mark as lifetime")),1)],64)):w("",!0)])])]}),_:1},8,["label"])]),_:1}),e(T,{lg:12},{default:n(()=>[e(y,{label:i.translate("Activation Limit")},{default:n(()=>[l("div",Ga,[r.isActivationLimitEnable?(o(),h("div",Xa,[e(U,{modelValue:r.limit,"onUpdate:modelValue":t[4]||(t[4]=P=>r.limit=P),min:0,"controls-position":"right",onChange:i.handleLimitChange,onKeyup:i.handleLimitChange},{"decrease-icon":n(()=>[e(b,{class:"w-3",name:"ChevronDown"})]),"increase-icon":n(()=>[e(b,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),r.isConfirmationIconEnable?(o(),h("div",Za,[e(_,{tag:"button",onClick:j(i.updateLimit,["prevent"])},{default:n(()=>[e(b,{name:"Check"})]),_:1},8,["onClick"]),e(_,{tag:"button",onClick:j(i.resetLimit,["prevent"])},{default:n(()=>[e(b,{name:"Cross"})]),_:1},8,["onClick"])])):w("",!0)])):w("",!0),r.isActivationLimitEnable?w("",!0):(o(),h("span",Ja,c(i.translateNumber(s.license.activation_count))+" / "+c(r.limit!=0?r.limit:i.translate("Unlimited")),1)),r.isActivationLimitEnable?w("",!0):(o(),h("span",Qa)),l("div",el,[l("a",{href:"#",onClick:t[5]||(t[5]=j((...P)=>i.handleToggleActivationLimit&&i.handleToggleActivationLimit(...P),["prevent"]))},c(r.isActivationLimitEnable?i.translate("Cancel"):i.translate("Edit")),1),!r.isActivationLimitEnable&&r.limit!=0?(o(),h(A,{key:0},[l("span",tl,c(i.translate("or")),1),l("a",{href:"#",onClick:t[6]||(t[6]=j((...P)=>i.handleActivationLimit&&i.handleActivationLimit(...P),["prevent"]))},c(i.translate("Mark as unlimited")),1)],64)):w("",!0)])])]),_:1},8,["label"])]),_:1})]),_:1})]),_:1},8,["model"]),l("div",nl,[l("div",al,[e(v,{status:s.license.status,size:"small"},null,8,["status"]),l("span",null,c(i.translate("Purchase Date"))+": "+c(i.formatDate((M=s.license)==null?void 0:M.created_at)),1)]),l("div",ll,[l("div",sl,[e(g,{class:"link",to:{name:"product_edit",params:{product_id:s.product.ID}}},{default:n(()=>{var P;return[x(c(s.product.post_title)+" ",1),l("span",il," – "+c((P=r.variations.find(J=>J.id==s.license.variation_id))==null?void 0:P.variation_title),1)]}),_:1},8,["to"]),((V=r.variations)==null?void 0:V.length)>0?(o(),$(I,{key:0,variation_id:r.variation_id,product_id:s.product.ID,order:s.order,props_variations:r.variations,endpoint_path:"products",has_upgrades:s.license.has_upgrades&&!["expired","disabled"].includes(s.license.status),is_admin:!0},null,8,["variation_id","product_id","order","props_variations","has_upgrades"])):w("",!0)]),l("div",ol,[e(L,{modelValue:s.license.license_key,"onUpdate:modelValue":t[7]||(t[7]=P=>s.license.license_key=P),readonly:""},null,8,["modelValue"]),l("div",rl,[e(E,{width:"250","confirm-button-text":i.translate("Confirm"),"cancel-button-text":i.translate("No, Thanks"),title:i.translate("Are you sure to regenerate?"),onConfirm:i.regenerateLicenseKey},{reference:n(()=>[l("div",cl,[e(b,{name:"Reload"})])]),_:1},8,["confirm-button-text","cancel-button-text","title","onConfirm"])])])]),l("div",dl,[l("div",ul,[l("div",_l,c(i.translate("Expirations date")),1),l("div",ml,[r.isExpirationDateEnable?(o(),$(f,{key:0,modelValue:r.selectedDate,"onUpdate:modelValue":t[8]||(t[8]=P=>r.selectedDate=P),placeholder:i.formatDate((Z=s.license)==null?void 0:Z.expiration_date)?i.formatDate((Y=s.license)==null?void 0:Y.expiration_date):i.translate("Lifetime"),"default-value":(he=s.license)==null?void 0:he.expiration_date,type:"date",ref:"calendar",onChange:i.handleDateChange,class:"el-input--x-small mr-2"},null,8,["modelValue","placeholder","default-value","onChange"])):(o(),h("span",pl,c((fe=s.license)!=null&&fe.expiration_date?i.formatDate((ge=s.license)==null?void 0:ge.expiration_date):"Lifetime"),1)),r.isExpirationDateEnable?w("",!0):(o(),h("span",hl)),l("div",fl,[l("a",{href:"#",onClick:t[9]||(t[9]=j((...P)=>i.handleToggleExpirationDate&&i.handleToggleExpirationDate(...P),["prevent"]))},c(r.isExpirationDateEnable?i.translate("Cancel"):i.translate("Edit")),1),!r.isExpirationDateEnable&&((ve=s.license)!=null&&ve.expiration_date)?(o(),h(A,{key:0},[l("span",gl,c(i.translate("or")),1),l("a",{href:"#",onClick:t[10]||(t[10]=j((...P)=>i.handleLifetimeLicense&&i.handleLifetimeLicense(...P),["prevent"]))},c(i.translate("Mark as lifetime")),1)],64)):w("",!0)])])]),l("div",vl,[l("div",bl,c(i.translate("Activation Limit")),1),l("div",yl,[r.isActivationLimitEnable?(o(),h("div",wl,[e(U,{modelValue:r.limit,"onUpdate:modelValue":t[11]||(t[11]=P=>r.limit=P),min:0,"controls-position":"right",onChange:i.handleLimitChange,onKeyup:i.handleLimitChange},{"decrease-icon":n(()=>[e(b,{class:"w-3",name:"ChevronDown"})]),"increase-icon":n(()=>[e(b,{class:"w-3",name:"ChevronUp"})]),_:1},8,["modelValue","onChange","onKeyup"]),r.isConfirmationIconEnable?(o(),h("div",kl,[e(_,{tag:"button",onClick:j(i.updateLimit,["prevent"])},{default:n(()=>[e(b,{name:"Check"})]),_:1},8,["onClick"]),e(_,{tag:"button",onClick:j(i.resetLimit,["prevent"])},{default:n(()=>[e(b,{name:"Cross"})]),_:1},8,["onClick"])])):w("",!0)])):w("",!0),r.isActivationLimitEnable?w("",!0):(o(),h("span",Ll,c(i.translateNumber(s.license.activation_count))+" / "+c(r.limit!=0?r.limit:i.translate("Unlimited")),1)),r.isActivationLimitEnable?w("",!0):(o(),h("span",Cl)),l("div",Sl,[l("a",{href:"#",onClick:t[12]||(t[12]=j((...P)=>i.handleToggleActivationLimit&&i.handleToggleActivationLimit(...P),["prevent"]))},c(r.isActivationLimitEnable?i.translate("Cancel"):i.translate("Edit")),1),!r.isActivationLimitEnable&&r.limit!=0?(o(),h(A,{key:0},[l("span",Dl,c(i.translate("or")),1),l("a",{href:"#",onClick:t[13]||(t[13]=j((...P)=>i.handleActivationLimit&&i.handleActivationLimit(...P),["prevent"]))},c(i.translate("Mark as unlimited")),1)],64)):w("",!0)])])])])])])}const $l=W(Oa,[["render",xl]]),El={name:"ActivatedSiteInformation",props:["activatedSites","modelValue","activationLimit","activationCount"],computed:{Link(){return He}},components:{IconButton:de,DynamicIcon:H,Badge:K,Empty:pe},methods:{formatDate:Q,updateModelValue(a){this.$emit("update:modelValue",a)},activateSite(){this.$emit("siteActivated")},deactivateSite(a){this.$emit("siteDeactivated",a)}}},Pl={class:"fct-activated-site-url-container grid gap-5"},Vl={key:0,class:"-mx-6 -mb-6 fct-license-site-url-table-wrap"};function Tl(a,t,s,k,r,i){const S=u("Badge"),L=u("el-table-column"),b=u("DynamicIcon"),D=u("IconButton"),E=u("el-popconfirm"),y=u("el-table"),T=u("Empty");return o(),h("div",Pl,[s.activatedSites.length>0?(o(),h("div",Vl,[e(y,{data:s.activatedSites,class:"w-full"},{default:n(()=>[e(L,{label:a.$t("Site URL"),width:"360"},{default:n(g=>[l("span",null,c(g.row.site_url),1),g.row.is_local&&g.row.is_local!="0"?(o(),$(S,{key:0,status:"warning",size:"small","hide-icon":!0,text:a.$t("local"),style:{"margin-left":"10px"}},null,8,["text"])):w("",!0)]),_:1},8,["label"]),e(L,{label:a.$t("Status"),width:"100"},{default:n(g=>[e(S,{status:g.row.status,size:"small"},null,8,["status"])]),_:1},8,["label"]),e(L,{label:a.$t("Activated at"),width:"140"},{default:n(g=>[l("span",null,c(i.formatDate(g.row.created_at)),1)]),_:1},8,["label"]),e(L,{width:"100"},{default:n(g=>[l("span",null,[e(E,{width:"200","confirm-button-text":a.$t("Confirm"),"cancel-button-text":a.$t("No, Thanks"),title:a.$t("Are you sure?"),onConfirm:I=>i.deactivateSite(g.row.id)},{reference:n(()=>[e(D,{tag:"a",size:"x-small",class:"ml-auto",hover:"danger"},{default:n(()=>[e(b,{name:"TrashIcon"})]),_:1})]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"])])]),_:1})]),_:1},8,["data"])])):(o(),$(T,{key:1,icon:"Empty/ListView","has-dark":!0,text:a.$t("No activated sites found")},null,8,["text"]))])}const Al=W(El,[["render",Tl]]),Ul={class:"fct-single-customer-loader-wrap fct-layout-width"},Ml={class:"single-page-header fct-page-loader-header flex items-start justify-between"},Il={class:"single-page-body"},Ol={class:"fct-single-order"},Bl={class:"fct-single-order-main"},Nl={class:"grid gap-5 grid-cols-[repeat(auto-fit,minmax(200px,1fr))]"},Fl={class:"fct-single-order-aside"},Rl={class:"fct-admin-sidebar"},zl={__name:"SingleLicenseLoader",setup(a){return(t,s)=>{const k=u("el-skeleton-item"),r=u("el-skeleton");return o(),h("div",Ul,[l("div",Ml,[e(r,{animated:"",class:"flex items-start gap-2"},{template:n(()=>[(o(),h(A,null,z(3,i=>e(k,{key:i,class:"max-w-[100px]"})),64))]),_:1})]),l("div",Il,[l("div",Ol,[l("div",Bl,[e(N,{class:"overflow-hidden"},{default:n(()=>[e(R,{border_bottom:"",title_size:"small",title:t.$t("Manage License Details")},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:!0,class:"mb-5"},{template:n(()=>[e(k,{variant:"p",class:"w-full"}),e(k,{variant:"p",style:{width:"50%"}})]),_:1}),l("div",Nl,[(o(),h(A,null,z(6,i=>e(r,{key:i,animated:!0},{template:n(()=>[l("div",null,[e(k,{variant:"p",class:"w-full"}),e(k,{variant:"p",style:{width:"50%"}})])]),_:2},1024)),64))])]),_:1})]),_:1}),e(N,{class:"overflow-hidden"},{default:n(()=>[e(R,{border_bottom:"",title_size:"small",title:t.$t("Related Orders")},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:!0,class:"mb-5",rows:2})]),_:1})]),_:1}),e(N,{class:"overflow-hidden"},{default:n(()=>[e(R,{border_bottom:"",title_size:"small",title:t.$t("Activated Sites")},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:!0,class:"mb-5",rows:3})]),_:1})]),_:1})]),l("div",Fl,[l("div",Rl,[e(N,null,{default:n(()=>[e(R,{title:t.$t("Customer Information"),border_bottom:"",title_size:"small"},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:"",rows:6})]),_:1})]),_:1}),e(N,null,{default:n(()=>[e(R,{title:t.$t("Actions"),border_bottom:"",title_size:"small"},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:""},{template:n(()=>[e(k,{variant:"p",class:"w-1/2"})]),_:1})]),_:1})]),_:1}),e(N,null,{default:n(()=>[e(R,{title:t.$t("Labels"),border_bottom:"",title_size:"small"},null,8,["title"]),e(B,null,{default:n(()=>[e(r,{animated:"",rows:1})]),_:1})]),_:1})])])])])])}}},Hl={key:2,class:"fct-view-license-wrap fct-layout-width"},jl={class:"single-page-header"},ql={class:"flex items-center gap-3 flex-wrap whitespace-pre-wrap",style:{"overflow-wrap":"anywhere"}},Yl={class:"license-breadcrumb-only-mobile"},Kl={class:"single-page-body"},Wl={class:"fct-view-license-content-wrap"},Gl={class:"more-btn"},Xl={class:"fct-related-license-content"},Zl={class:"fct-license-related-orders-show-on-mobile fct-table-mobile-wrap"},Jl={class:"fct-table-mobile-header"},Ql={class:"fct-table-date-col"},es={class:"fct-table-price-col"},ts={class:"fct-table-mobile-footer"},ns={class:"fct-table-mobile-footer-row"},as={class:"title"},ls={class:"fct-table-status-col flex items-center gap-1"},ss={class:"title"},is={class:"value capitalize"},os={class:"fct-related-license-content"},rs={class:"value-column-with-space",style:{"max-height":"500px","overflow-y":"auto"}},cs=["innerHTML"],ds={class:"fct-admin-sidebar"},us={class:"fct-admin-sidebar-item"},_s={class:"fct-lists"},ms={class:"!mb-0"},ps={name:"ViewLicense",components:{OrderUpDownIndicator:se},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(){Xe(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 s=t.error??"An error occurred while activating the site";this.handleError(s)}}).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,s;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=(s=this.license.customer)==null?void 0:s.id,this.product=a.product,this.selectedLabels=a.selected_labels,this.prevOrders=a.prev_orders,this.activatedSites=this.activations.map(k=>{var r,i;return{id:k.id,site_url:(r=k.site)==null?void 0:r.site_url,created_at:(i=k.site)==null?void 0:i.created_at,status:k.status,is_local:k.is_local}}).sort((k,r)=>r.id-k.id)}).catch(a=>{a&&((a==null?void 0:a.code)==="fluent_cart_entity_not_found"?(this.notFound.show=!0,this.notFound.buttonText=_e.get(a,"data.buttonText"),this.notFound.message=_e.get(a,"data.message"),this.notFound.route=_e.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?p("order"):p("orders")):p("No orders")},handleMenuClick(a){this.activeMenu=a},discard(){return window.location.reload()}},mounted(){this.fetchLicense()}},hs=Object.assign(ps,{setup(a){return(t,s)=>{var _;const k=u("el-breadcrumb-item"),r=u("el-breadcrumb"),i=u("router-link"),S=u("el-dropdown-item"),L=u("el-dropdown-menu"),b=u("el-dropdown"),D=u("el-table-column"),E=u("el-table"),y=u("el-timeline-item"),T=u("el-timeline"),g=u("el-col"),I=u("el-button"),f=u("el-popconfirm"),U=u("el-row");return o(),h("div",null,[t.loading?(o(),$(zl,{key:0})):w("",!0),t.notFound.show?(o(),$(Oe,{key:1,"button-text":t.notFound.buttonText,message:t.notFound.message,route:t.notFound.route},null,8,["button-text","message","route"])):w("",!0),t.notFound.show===!1?(o(),h("div",Hl,[t.loading?w("",!0):(o(),h(A,{key:0},[t.license?(o(),h(A,{key:0},[l("div",jl,[e(r,{class:"hide-license-breadcrumb-on-mobile","separator-icon":m(je)},{default:n(()=>[e(k,{to:{name:"licenses"}},{default:n(()=>[x(c(m(p)("Licenses")),1)]),_:1}),e(k,null,{default:n(()=>{var d;return[l("div",ql,[x(c((d=t.license)==null?void 0:d.license_key)+" ",1),e(K,{status:t.license.status,size:"small"},null,8,["status"])])]}),_:1})]),_:1},8,["separator-icon"]),l("ul",Yl,[l("li",null,[e(i,{to:{name:"licenses"}},{default:n(()=>[e(H,{name:"ArrowLeft",class:"cursor-pointer"})]),_:1})]),l("li",null,c((_=t.license)==null?void 0:_.license_key),1)])]),l("div",Kl,[e(U,{gutter:30},{default:n(()=>[e(g,{lg:17},{default:n(()=>[l("div",Wl,[e(N,null,{default:n(()=>[e(R,{border_bottom:"",title_size:"small",title:m(p)("License Details")},{action:n(()=>[e(b,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:t.handleLicenseCommand,placement:"bottom-end"},{dropdown:n(()=>[e(L,null,{default:n(()=>[e(S,{command:"delete_license",class:"item-destructive"},{default:n(()=>[e(H,{name:"Delete"}),x(" "+c(m(p)("Delete License")),1)]),_:1})]),_:1})]),default:n(()=>[l("span",Gl,[e(H,{name:"More"})])]),_:1},8,["onCommand"])]),_:1},8,["title"]),e(B,null,{default:n(()=>[e($l,{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(N,{class:"overflow-hidden"},{default:n(()=>[e(R,{title:m(p)("Related Orders"),title_size:"small"},null,8,["title"]),e(B,{class:"px-0 pb-0"},{default:n(()=>[l("div",Xl,[e(E,{data:t.orders,class:"w-full fct-license-related-orders-hide-on-mobile"},{default:n(()=>[e(D,{width:120,label:m(p)("ID")},{default:n(d=>[e(i,{class:"link",to:{name:"view_order",params:{order_id:d.row.id}}},{default:n(()=>[x(" #"+c(m(p)(d.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(D,{width:120,label:m(p)("Amount")},{default:n(d=>[l("span",null,c(t.formatNumber(d.row.total_paid)),1)]),_:1},8,["label"]),e(D,{width:150,label:m(p)("Date"),prop:"created_at"},{default:n(d=>[l("span",null,c(m(Q)(d.row.created_at)),1)]),_:1},8,["label"]),e(D,{label:m(p)("Payment Method")},{default:n(d=>[x(c(d.row.payment_method),1)]),_:1},8,["label"]),e(D,{label:m(p)("Status")},{default:n(d=>[e(K,{type:d.row.payment_status},{default:n(()=>[x(c(d.row.payment_status),1)]),_:2},1032,["type"]),e(K,{style:{"margin-left":"5px","margin-right":"5px"},type:d.row.type},{default:n(()=>[x(c(d.row.type),1)]),_:2},1032,["type"]),e(se,{order:d.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"]),l("div",Zl,[(o(!0),h(A,null,z(t.orders,(d,C)=>(o(),h("div",{key:C,class:"fct-table-mobile-row"},[l("div",Jl,[l("div",Ql,[x(c(m(Q)(d.created_at))+" ",1),s[4]||(s[4]=l("div",{class:"bullet"},"•",-1)),e(i,{class:"link",to:{name:"view_order",params:{order_id:d.id}}},{default:n(()=>[x(" #"+c(d.id),1)]),_:2},1032,["to"])]),l("div",es,c(t.formatNumber(d.total_paid)),1)]),l("div",ts,[l("div",ns,[l("div",null,[l("div",as,c(m(p)("Status")),1),l("div",ls,[e(K,{type:d.payment_status},{default:n(()=>[x(c(d.payment_status),1)]),_:2},1032,["type"]),e(K,{type:d.type},{default:n(()=>[x(c(d.type),1)]),_:2},1032,["type"]),e(se,{order:d},null,8,["order"])])]),l("div",null,[l("div",ss,c(m(p)("Payment Method")),1),l("div",is,c(d.payment_method),1)])])])]))),128))])])]),_:1})]),_:1}),t.prevOrders&&t.prevOrders.length?(o(),$(N,{key:0,class:"overflow-hidden"},{default:n(()=>[e(R,{title:m(p)("Previous Orders"),title_size:"small"},null,8,["title"]),e(B,{class:"px-0 pb-0"},{default:n(()=>[l("div",os,[e(E,{data:t.prevOrders,class:"w-full"},{default:n(()=>[e(D,{width:120,label:m(p)("ID")},{default:n(d=>[e(i,{class:"link",to:{name:"view_order",params:{order_id:d.row.id}}},{default:n(()=>[x(" #"+c(m(p)(d.row.id)),1)]),_:2},1032,["to"])]),_:1},8,["label"]),e(D,{width:120,label:m(p)("Amount")},{default:n(d=>[l("span",null,c(t.formatNumber(d.row.total_paid)),1)]),_:1},8,["label"]),e(D,{width:150,label:m(p)("Date"),prop:"created_at"},{default:n(d=>[l("span",null,c(m(Q)(d.row.created_at)),1)]),_:1},8,["label"]),e(D,{label:m(p)("Status")},{default:n(d=>[e(K,{type:d.row.payment_status},{default:n(()=>[x(c(d.row.payment_status),1)]),_:2},1032,["type"]),e(K,{style:{"margin-left":"5px","margin-right":"5px"},type:d.row.type},{default:n(()=>[x(c(d.row.type),1)]),_:2},1032,["type"]),e(se,{order:d.row},null,8,["order"])]),_:1},8,["label"])]),_:1},8,["data"])])]),_:1})]),_:1})):w("",!0),e(N,{class:"overflow-hidden"},{default:n(()=>[e(R,{title:m(p)("Activated Sites"),title_size:"small",border_bottom:""},null,8,["title"]),e(B,null,{default:n(()=>[e(Al,{modelValue:t.site_url,"onUpdate:modelValue":s[0]||(s[0]=d=>t.site_url=d),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?(o(),$(N,{key:1},{default:n(()=>[e(B,null,{default:n(()=>[l("div",rs,[e(T,{style:{"padding-left":"2px"}},{default:n(()=>[(o(!0),h(A,null,z(t.logs,d=>{var C;return o(),$(y,{key:d,timestamp:m(X)((C=t.license)==null?void 0:C.updated_at).format("MMMM DD, YYYY"),placement:"top",color:"blue"},{default:n(()=>[l("div",{innerHTML:d.meta_value},null,8,cs)]),_:2},1032,["timestamp"])}),128))]),_:1})])]),_:1})]),_:1})):w("",!0)])]),_:1}),e(g,{lg:7},{default:n(()=>[l("div",ds,[e(Ke,{order:t.order,shouldEnableEditing:!0,onOnAddressSelected:s[1]||(s[1]=d=>{d.type==="shipping"?t.order.shipping_address_id=d.id:t.order.billing_address_id=d.id})},null,8,["order"]),e(N,null,{default:n(()=>[e(R,{title:m(p)("Actions"),title_size:"small",border_bottom:""},null,8,["title"]),e(B,null,{default:n(()=>[l("div",us,[l("ul",_s,[l("li",ms,[t.license.status!=="disabled"?(o(),$(f,{key:0,width:"210","confirm-button-text":m(p)("Confirm"),"cancel-button-text":m(p)("No, Thanks"),title:m(p)("Are you sure?"),onConfirm:s[2]||(s[2]=d=>t.updateLicenseStatus("disabled"))},{reference:n(()=>[e(I,{text:"",class:"!text-red-500 !mt-0"},{default:n(()=>[x(c(m(p)("Disable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):w("",!0),t.license.status==="disabled"?(o(),$(f,{key:1,width:"210","confirm-button-text":m(p)("Confirm"),"cancel-button-text":m(p)("No, Thanks"),title:m(p)("Are you sure?"),onConfirm:s[3]||(s[3]=d=>t.updateLicenseStatus("active"))},{reference:n(()=>[e(I,{text:"",class:"!text-primary-500 !mt-0"},{default:n(()=>[x(c(m(p)("Enable")),1)]),_:1})]),_:1},8,["confirm-button-text","cancel-button-text","title"])):w("",!0)])])])]),_:1})]),_:1}),t.loading?w("",!0):(o(),$(We,{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)):w("",!0)],64))])):w("",!0)])}}}),fs={class:"heading-wrap"},gs={class:"title"},vs={key:0,class:"heading-action"},bs={__name:"Heading",props:{title:String},setup(a){const t=Ve();return(s,k)=>(o(),h("div",fs,[l("h2",gs,c(a.title),1),m(t).actions?(o(),h("div",vs,[Te(s.$slots,"actions")])):w("",!0)]))}},ys={name:"AllLicenses",components:{Pagination:Ie,Heading:bs},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()}},ws={class:"all_licenses"},ks={class:"bg-white dark:bg-dark-700"},Ls={key:0},Cs={key:1},Ss={class:"py-2.5 px-7.5 dark:bg-gray-800"},Ds={class:"flex justify-between"},xs={class:"flex items-center gap-2"};function $s(a,t,s,k,r,i){const S=u("Heading"),L=u("router-link"),b=u("el-table-column"),D=u("el-table"),E=u("pagination");return o(),h("div",ws,[e(S,{title:"All Licenses"}),l("div",ks,[e(D,{stripe:"",data:r.licenses},{default:n(()=>[e(b,{label:"ID",width:100},{default:n(y=>[e(L,{to:{name:"view_license",params:{license_id:y.row.id}}},{default:n(()=>[x(" #"+c(y.row.id),1)]),_:2},1032,["to"])]),_:1}),e(b,{width:290,label:"License Key"},{default:n(y=>[e(L,{to:{name:"view_license",params:{license_id:y.row.id}}},{default:n(()=>[x(c(y.row.license_key),1)]),_:2},1032,["to"])]),_:1}),e(b,{width:100,label:"Status"},{default:n(y=>[l("span",null,c(y.row.status),1)]),_:1}),e(b,{"min-width":300,label:"Product"},{default:n(y=>[x(c(i.getProductName(y.row.product_details)),1)]),_:1}),e(b,{"min-width":120,label:"Customer"},{default:n(y=>[e(L,{to:{name:"view_customer",params:{customer_id:y.row.customer_id}}},{default:n(()=>{var T;return[x(c(((T=y.row)==null?void 0:T.customer.full_name)||"No Customer Found"),1)]}),_:2},1032,["to"])]),_:1}),e(b,{width:120,label:"Activations"},{default:n(y=>[x(c(y.row.activation_count)+" / "+c(y.row.limit||"Unlimited"),1)]),_:1}),e(b,{width:160,label:"Expires"},{default:n(y=>[y.row.expiration_date?(o(),h("span",Ls,c(y.row.expiration_date),1)):(o(),h("span",Cs,"Lifetime"))]),_:1}),e(b,{width:160,label:"Purchased"},{default:n(y=>[e(L,{to:{name:"view_order",params:{order_id:y.row.order_id}}},{default:n(()=>[x(c(y.row.created_at),1)]),_:2},1032,["to"])]),_:1})]),_:1},8,["data"]),l("div",Ss,[l("div",Ds,[l("div",xs,[e(E,{"pager-only":!0,hide_on_single:!1,pagination:r.paginate,onFetch:i.fetch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])]),e(E,{hide_on_single:!1,pagination:r.paginate,onFetch:i.fetch,onCurrentPageChanged:i.onCurrentPageChanged,onOnPerPageChanged:i.onPerPageChanged},null,8,["pagination","onFetch","onCurrentPageChanged","onOnPerPageChanged"])])])])])}const Es=W(ys,[["render",$s]]);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:Vt,meta:{active_menu:"products",title:"License Settings",permission:"store/sensitive"}}),a.license_route={name:"licenses",path:"/licenses",component:ha,meta:{active_menu:"licenses",title:"Licenses",permission:"store/sensitive"}},a.view_license={name:"view_license",path:"/licenses/:license_id/view",component:hs,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:Es,props:!0,meta:{active_menu:"licenses",title:"View License",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});