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 trunk → 1.6.5 View file →
@@ -1 +1 @@
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.6";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.6";import{C as B,a as I,b as O,_ as je}from"./chunks/CardBody.js?ver=1.6.6";import{L as te,_ as De}from"./chunks/NotFound.js?ver=1.6.6";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.6";import{_ as le,P as Ke}from"./chunks/Empty.js?ver=1.6.6";import{_ as R}from"./chunks/DynamicIcon.js?ver=1.6.6";import{T as Pe,B as H,_ as Ve,c as Ye}from"./chunks/Badge.js?ver=1.6.6";import{b as Y,S as xe,i as We,a as Ge}from"./chunks/common.js?ver=1.6.6";import{a as Xe,cp as Qe,b as he}from"./chunks/index.js?ver=1.6.6";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.6";import{_ as W}from"./chunks/_plugin-vue_export-helper.js?ver=1.6.6";import{d as Q}from"./chunks/dayjs.min.js?ver=1.6.6";import{M as lt}from"./chunks/Model.js?ver=1.6.6";import{R as Ae}from"./chunks/Rest.js?ver=1.6.6";import{I as me}from"./chunks/IconButton.js?ver=1.6.6";import{_ as Z}from"./chunks/UserCan.js?ver=1.6.6";import"./chunks/Utils.js?ver=1.6.6";import{S as nt}from"./chunks/Str.js?ver=1.6.6";import{A as se}from"./chunks/Arr.js?ver=1.6.6";import{f as Ue,r as Me}from"./chunks/CurrencyFormatter.js?ver=1.6.6";import"./chunks/vue-router.js?ver=1.6.6";import"./chunks/Asset.js?ver=1.6.6";import"./chunks/Url.js?ver=1.6.6";import"./chunks/index4.js?ver=1.6.6";import"./chunks/preload-helper.js?ver=1.6.6";import"./chunks/timezone.js?ver=1.6.6";import"./chunks/Notify.js?ver=1.6.6";import"./chunks/index3.js?ver=1.6.6";import"./chunks/TransitionAccordion.js?ver=1.6.6";import"./chunks/weekOfYear.js?ver=1.6.6";import"./chunks/Animation.js?ver=1.6.6";import"./chunks/AddressComponent2.js?ver=1.6.6";import"./chunks/productService.js?ver=1.6.6";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});
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});