PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 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 All 50 releases
← All changes | assets/Start7.js +1 -1 1.3.23 → 1.7.0 View file →
@@ -1 +1 @@
1 -import{h as r,O as n,e as s,o as i,a,a2 as p}from"./chunks/vue.esm-bundler.js?ver=1.3.23";import{u as m}from"./chunks/useElementPlusComponents.js?ver=1.3.23";import{u as c}from"./chunks/useElementor.js?ver=1.3.23";import{S as u}from"./chunks/ServerSidePreview.js?ver=1.3.23";import{t as l}from"./chunks/Translator.js?ver=1.3.23";import"./chunks/index.js?ver=1.3.23";import"./chunks/index2.js?ver=1.3.23";import"./chunks/index4.js?ver=1.3.23";import"./chunks/dayjs.min.js?ver=1.3.23";import"./chunks/index3.js?ver=1.3.23";import"./chunks/Arr.js?ver=1.3.23";import"./chunks/ServerSidePreview.vue_vue_type_style_index_0_scoped_e73ce754_lang.js?ver=1.3.23";import"./chunks/_plugin-vue_export-helper.js?ver=1.3.23";import"./chunks/add-query-args.js?ver=1.3.23";const f={class:"fct-customer-profile-block-editor"},d={__name:"App",props:{settings:{type:String,default:""}},setup(t){const o=r(JSON.parse(t.settings));return n(()=>{c()}),(g,h)=>(i(),s("div",f,[a(u,{block:"fluent-cart/customer-profile",attributes:o.value},null,8,["attributes"])]))}},_=t=>{const e=t.dataset.settings,o=p(d,{settings:e});m(o),o.mixin({methods:{$t:l}}).mount(t)};jQuery(document).ready(function(){elementor.hooks.addAction("panel/open_editor/widget/fluent_cart_customer_profile",function(t,e,o){e.get("settings")})});jQuery(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/fluent_cart_customer_profile.default",function(t){const e=jQuery(t[0]).find("[data-fluent-cart-customer-profile-app]")[0];_(e)})});
1 +var Rt=Object.defineProperty;var Bt=(e,s,r)=>s in e?Rt(e,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[s]=r;var ye=(e,s,r)=>Bt(e,typeof s!="symbol"?s+"":s,r);import{y as _,j as l,v as n,z as xt,F as T,l as p,G as c,E as y,B as o,q as V,A as a,C as E,k as S,x as m,a3 as G,t as K,u as M,N as ee,O as Z,V as Ft,T as Nt,f as N,w as fe,e as Ct,K as Ut,g as he,a4 as Ot,a5 as Ht,L as qt,M as zt,a6 as jt,a7 as Yt,m as Kt,U as Wt,n as Zt}from"./chunks/vue.esm-bundler.js?ver=1.7.0";import{d as le}from"./chunks/dayjs.min.js?ver=1.7.0";import{u as Gt,t as Jt}from"./chunks/timezone.js?ver=1.7.0";import{a as Qt,w as Xt}from"./chunks/weekOfYear.js?ver=1.7.0";import{_ as F}from"./chunks/DynamicIcon.js?ver=1.7.0";import{S as oe}from"./chunks/Str.js?ver=1.7.0";import{_ as L}from"./chunks/_plugin-vue_export-helper.js?ver=1.7.0";import{B as Tt}from"./chunks/BundleProducts.js?ver=1.7.0";import{c as ke,S as es,d as ts}from"./chunks/common.js?ver=1.7.0";import{I as xe}from"./chunks/IconButton.js?ver=1.7.0";import{E as ae,a as de,C as St,Q as ss,b as Me,c as $e,d as De,e as Ee}from"./chunks/index.js?ver=1.7.0";import{a as as,c as rs,b as is}from"./chunks/vue-router.js?ver=1.7.0";import"./chunks/Translator.js?ver=1.7.0";import ns from"./chunks/ArrowDown.js?ver=1.7.0";import os from"./chunks/ArrowUp.js?ver=1.7.0";import{_ as Le,a as W,b as ls}from"./chunks/AddressComponent.js?ver=1.7.0";import{R as O}from"./chunks/Rest.js?ver=1.7.0";import{_ as ds}from"./chunks/Animation.js?ver=1.7.0";import{n as B}from"./chunks/Notify.js?ver=1.7.0";import{p as cs,v as us,i as ms}from"./chunks/DynamicTemplateParser.js?ver=1.7.0";import{E as Pt,a as Ie}from"./chunks/index3.js?ver=1.7.0";import{E as Ve,a as Re,b as Be,c as Fe,d as Ne,e as Ue,f as Oe,g as He,h as qe,i as ze,j as je,k as Ye,l as Ke,m as We,n as Ze,o as Ge,p as Je,q as Qe,r as Xe,s as et,t as tt,u as st,v as at,w as rt,x as it,y as nt,B as ot,C as lt,D as dt,F as ct,G as ut,H as mt,I as ht,J as _t,K as pt,L as ft,N as bt,O as yt,P as gt,Q as vt,R as wt,S as kt}from"./chunks/index2.js?ver=1.7.0";import"./chunks/preload-helper.js?ver=1.7.0";import"./chunks/Arr.js?ver=1.7.0";import"./chunks/Utils.js?ver=1.7.0";import"./chunks/CurrencyFormatter.js?ver=1.7.0";import"./chunks/TransitionAccordion.js?ver=1.7.0";import"./chunks/index4.js?ver=1.7.0";le.extend(Gt);le.extend(Jt);le.extend(Qt);le.extend(Xt);function b(e){var t,i;e=((i=(t=window.fluentcart_customer_profile_vars)==null?void 0:t.trans)==null?void 0:i[e])||e;const s=Array.prototype.slice.call(arguments,1);if(s.length===0)return e;const r=/%(\d*\$?)s|%d/g;let h=0;return e=e.replace(r,(d,u)=>{if(u){const v=parseInt(u,10)-1;return v<s.length?s[v]:d}else return h<s.length?s[h++]:d}),e}function _e(e,s,r,h=null){let t=parseInt(r.toString().replace(/,/g,""),10);return t>1?b(s,r):b(t===0?h??e:e,r)}function Y(e){const s=window.fluentcart_customer_profile_vars.datei18;e=e.toString();const h=(s.numericSystem||"0_1_2_3_4_5_6_7_8_9").split("_");return e.split("").map(i=>h[i]||i).join("")}const ge={date:"MMM DD, YYYY",date_short:"MMM DD",time:"h:mm A",date_time:"MMM DD, YYYY h:mm A",month_year:"MMM YYYY",month_long:"MMMM"},hs=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_s=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ps=["January","February","March","April","May","June","July","August","September","October","November","December"],fs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function bs(e="date_short"){var r;if(!Object.prototype.hasOwnProperty.call(ge,e))return e;const s=((r=window.fluentcart_customer_profile_vars)==null?void 0:r.datei18)||{};return s.formats_source!=="wordpress"?ge[e]:(s.formats||{})[e]||ge[e]}function me(e,s){const r=Object.values(e||{});return s.map((h,t)=>r[t]||h)}const ys=/^[+-]\d{2}:\d{2}$/;function At(e){var h,t;const s=le.utc(e),r=((t=(h=window.fluentcart_customer_profile_vars)==null?void 0:h.datei18)==null?void 0:t.timezone)||{};if(r.source!=="wordpress"||!r.site)return s.local();try{return ys.test(r.site)?s.utcOffset(r.site):s.tz(r.site)}catch{return s.local()}}function gs(){return At(new Date().toISOString())}function vs(e){var r;return(((r=window.fluentcart_customer_profile_vars)==null?void 0:r.datei18)||{}).formats_source==="wordpress"?"date":e.year()===gs().year()?"date_short":"date"}function j(e,s="date_short"){var i;const r=At(e);s==="date_short"&&(s=vs(r));const h=((i=window.fluentcart_customer_profile_vars)==null?void 0:i.datei18)||{},t=r.locale({name:"fluent_date_time",weekdays:me(h.weekdays,hs),weekdaysShort:me(h.weekdaysShort,_s),months:me(h.months,ps),monthsShort:me(h.monthsShort,fs),meridiem:(d,u,v)=>{const w=h.am||"AM",k=h.pm||"PM",f=d<12?w:k;return v?f.toLowerCase():f}}).format(bs(s));return ws(t)}const ws=function(e,s){return e&&(window.fluentcart_customer_profile_vars.datei18,e=e.toString(),e.split("").map(h=>h!==" "?Y(h):h).join(""))},ks={completed:"Completed",paid:"Paid",active:"Active",publish:"Published",draft:"Draft",shipped:"Shipped",success:"Success",licensed:"Licensed",succeeded:"Succeeded",failed:"Failed",error:"Error",canceled:"Canceled",expired:"Expired",partially_paid:"Partially Paid",intended:"Intended",scheduled:"Scheduled","on-hold":"On Hold",pending:"Pending",unpaid:"Unpaid",warning:"Warning",processing:"Processing",future:"Future",inactive:"Inactive",dispute:"Dispute",disabled:"Disabled",beta:"Beta",subscription:"Subscription",renewal:"Renewal",payment:"Payment",unshipped:"Unshipped",trialing:"Trialing"};function J(e){const s=ks[e];return s?b(s):oe.headline(e)}const xs={name:"Badge",components:{DynamicIcon:F},props:{status:String,text:{type:String,default:null,required:!1},hideIcon:{type:Boolean,default:!1},size:String,highContrast:{type:Boolean,default:!1},type:String,icon:String},computed:{Str(){return Str},computedStatus(){return this.status||this.type},badgeType(){switch(this.computedStatus){case"completed":case"paid":case"active":case"publish":case"shipped":case"success":case"licensed":case"succeeded":return"fct-success";case"failed":case"error":case"canceled":case"expired":return"fct-danger";case"partially_paid":case"intended":return"fct-blue";case"scheduled":case"on-hold":case"pending":case"unpaid":case"warning":case"processing":case"future":return"fct-warning";case"inactive":return"fct-warning";case"dispute":return"fct-warning";default:return this.computedStatus?`fct-${this.computedStatus}`:"fct-info"}},badgeSize(){return this.size?`fct-${this.size}`:""},HighContrast(){return this.highContrast?"fct-is-high-contrast":""}},methods:{getStatusText(){return J(this.computedStatus)}}},Cs={key:0};function Ts(e,s,r,h,t,i){const d=_("DynamicIcon");return n(),l("span",{class:V(`fct-badge ${i.badgeType} ${i.badgeSize} ${i.HighContrast}`)},[i.computedStatus||r.text?(n(),l(T,{key:0},[r.icon?(n(),l("span",Cs,[c(d,{name:r.icon},null,8,["name"])])):p("",!0),r.text?(n(),l(T,{key:1},[y(o(r.text),1)],64)):(n(),l(T,{key:2},[y(o(i.getStatusText()),1)],64))],64)):xt(e.$slots,"default",{key:1})],2)}const U=L(xs,[["render",Ts]]),Ss={class:"fct-customer-dashboard-table"},Ps={class:"order-content-only-mobile",role:"list"},As=["aria-label"],Ms={class:"item-header"},$s={class:"sr-only"},Ds={class:"block truncate max-w-[100px]"},Es={class:"text-[var(--fct-customer-dashboard-faint-text-color,#9D9FAC)] text-sm"},Ls={class:"item-body"},Is={class:"fct-customer-orders-items fct-customer-orders-items-2"},Vs={key:0},Rs={key:0,class:"text-[var(--fct-customer-dashboard-note-text-color,#758195)] text-sm"},Bs={key:0,class:"fct-customer-orders-items-sub-title !max-w-full"},Fs={class:"fct-popover-content"},Ns={class:"fct-product-orders-items"},Us={class:"variation-title"},Os={key:0},Hs=["aria-label"],qs={class:"item-footer"},zs={class:"item-footer-content"},js=["innerHTML"],Ys={key:1,class:"text-center p-5",role:"note"},Ks={class:"invoice-id-date"},Ws={class:"block truncate max-w-[100px]"},Zs={class:"text"},Gs={class:"inline-flex items-center gap-2"},Js={key:0,class:"fct-customer-orders-items-sub-title leading-[1]"},Qs={class:"fct-popover-content"},Xs={class:"fct-product-orders-items"},ea={class:"variation-title"},ta={key:0},sa=["aria-label"],aa=["innerHTML"],Mt={__name:"OrderTable",props:{orders:{type:Array,required:!0},showTableHeader:{type:Boolean,default:!1},itemsColumnWidth:{type:Number,default:300},showInvoiceButton:{type:Boolean,default:!0}},setup(e){const s=d=>{const u=d.order_items.find(w=>w.payment_type==="subscription"),v=d.order_items.some(w=>w.payment_type==="adjustment");return d.order_items.filter(w=>!(w.payment_type==="signup_fee"||w.payment_type==="fee"||(w.payment_type==="adjustment"&&u&&(w.product.detail.featured_media=r(u)),v&&w.payment_type==="subscription")))},r=d=>{var u,v;return d.variants&&d.variants.media?(v=(u=d==null?void 0:d.variants)==null?void 0:u.media)==null?void 0:v.meta_value[0].url:d.variants&&!d.variants.media&&d.product.detail&&d.product.detail.featured_media&&d.product.detail.featured_media!==null&&typeof d.product.detail.featured_media=="object"?d.product.detail.featured_media.url:h},h=fluentcart_customer_profile_vars.placeholder_image,t=d=>d?"router-link":"span",i=d=>d?{to:{name:"view_order",params:{order_id:d}}}:{};return(d,u)=>{const v=_("el-popover"),w=_("el-table-column"),k=_("el-table");return n(),l("div",Ss,[a("div",Ps,[e.orders.length>0?(n(!0),l(T,{key:0},E(e.orders,f=>(n(),l("div",{class:"order-content-only-mobile-item",key:f.id,role:"listitem","aria-label":d.$t("Order summary for order number %s",f.invoice_no)},[a("div",Ms,[a("h3",$s,o(d.$t("Order Number")),1),(n(),S(K(t(f.uuid)),G({ref_for:!0},i(f.uuid),{class:"link text-sm","aria-label":d.$t("View order")+" #"+f.invoice_no}),{default:m(()=>[a("span",Ds,"#"+o(f.invoice_no),1)]),_:2},1040,["aria-label"])),a("span",Es,o(M(j)(f.created_at,"date")),1)]),a("div",Ls,[a("div",Is,[s(f).length===1?(n(),l("div",Vs,[(n(),S(K(t(f.uuid)),G({ref_for:!0},i(f.uuid),{class:"fct-customer-orders-items-title"}),{default:m(()=>{var x,g,P,$,D,I;return[y(o((x=s(f)[0])==null?void 0:x.post_title)+" ",1),(g=s(f)[0])!=null&&g.title&&((P=s(f)[0])==null?void 0:P.title)!==(($=s(f)[0])==null?void 0:$.post_title)?(n(),l("span",Rs," – "+o(((D=s(f)[0])==null?void 0:D.variation_display_title)||((I=s(f)[0])==null?void 0:I.title)),1)):p("",!0)]}),_:2},1040)),f.renewals_count>0?(n(),l("span",Bs,o(M(_e)("%s Renewal","%s Renewals",f.renewals_count)),1)):p("",!0)])):(n(),S(K(t(f.uuid)),G({key:1,ref_for:!0},i(f.uuid),{"aria-label":d.$t("View order")+" #"+f.invoice_no}),{default:m(()=>[y(o(M(b)("%s items",s(f).length)),1)]),_:2},1040,["aria-label"])),s(f).length>1?(n(),S(v,{key:2,placement:"top",width:360,trigger:"click"},{reference:m(()=>[a("div",{class:"fct-action-link-btn","aria-expanded":!1,"aria-label":d.$t("Show items for order %s",[f.invoice_no]),role:"button"},[c(F,{name:"ChevronDown"})],8,Hs)]),default:m(()=>[a("div",Fs,[a("div",Ns,[(n(!0),l(T,null,E(s(f),x=>(n(),l("p",{key:x.id},[(n(),S(K(t(f.uuid)),G({ref_for:!0},i(f.uuid),{class:"title"}),{default:m(()=>[y(o(x.post_title),1)]),_:2},1040)),a("span",Us,[a("b",null,o(M(Y)(x.quantity)),1),y(" x "+o(x.variation_display_title||x.title),1)])]))),128)),s(f).length===0?(n(),l("p",Os,o(M(b)("No products found!")),1)):p("",!0)])])]),_:2},1024)):p("",!0)])]),a("div",qs,[a("div",zs,[c(U,{type:f.status,size:"small"},{default:m(()=>[y(o(f.status),1)]),_:2},1032,["type"]),a("span",{innerHTML:d.formatNumber(f.total_amount,!0,!1,f.currency)},null,8,js)])])],8,As))),128)):(n(),l("div",Ys,o(M(b)("Your purchases will be shown here!")),1))]),c(k,{class:"order-content-only-desktop","empty-text":d.$t("Your purchases will be shown here!"),data:e.orders,"show-header":e.showTableHeader,role:"table","aria-label":d.$t("Customer order history")},{default:m(()=>[c(w,{label:"#",width:120},{default:m(f=>[a("div",Ks,[(n(),S(K(t(f.row.uuid)),G(i(f.row.uuid),{class:"link text-sm"}),{default:m(()=>[a("span",Ws,"#"+o(f.row.invoice_no),1)]),_:2},1040)),a("span",Zs,o(M(j)(f.row.created_at,"date")),1)])]),_:1}),c(w,{width:e.itemsColumnWidth,label:M(b)("Items"),"aria-label":d.$t("Order items")},{default:m(f=>{var x,g,P,$,D;return[a("div",{class:V(["fct-customer-orders-items",s(f.row).length===1?"grid":""])},[s(f.row).length===1?(n(),l(T,{key:0},[(n(),S(K(t(f.row.uuid)),G(i(f.row.uuid),{class:"fct-customer-orders-items-title","aria-label":d.$t("View single item for this order")}),{default:m(()=>{var I;return[y(o((I=s(f.row)[0])==null?void 0:I.post_title),1)]}),_:2},1040,["aria-label"])),a("div",Gs,[(x=s(f.row)[0])!=null&&x.title&&((g=s(f.row)[0])==null?void 0:g.title)!==((P=s(f.row)[0])==null?void 0:P.post_title)?(n(),l("span",Js," – "+o((($=s(f.row)[0])==null?void 0:$.variation_display_title)||((D=s(f.row)[0])==null?void 0:D.title)),1)):p("",!0),f.row.renewals_count>0?(n(),S(U,{key:1,size:"small",class:"fct-renewal-badge"},{default:m(()=>[c(F,{name:"Refresh"}),y(" "+o(M(_e)("%s Renewal","%s Renewals",M(Y)(f.row.renewals_count))),1)]),_:2},1024)):p("",!0)])],64)):(n(),S(K(t(f.row.uuid)),G({key:1},i(f.row.uuid),{"aria-label":M(b)("%s items in this order")+s(f.row).length}),{default:m(()=>[y(o(M(b)("%s items",s(f.row).length)),1)]),_:2},1040,["aria-label"])),s(f.row).length>1?(n(),S(v,{key:2,placement:"top",width:360,trigger:"click"},{reference:m(()=>[a("div",{class:"fct-action-link-btn",role:"button","aria-expanded":!1,"aria-label":d.$t("Show all items for this order")},[c(F,{name:"ChevronDown"})],8,sa)]),default:m(()=>[a("div",Qs,[a("div",Xs,[(n(!0),l(T,null,E(s(f.row),I=>(n(),l("p",{key:I.id},[(n(),S(K(t(f.row.uuid)),G({ref_for:!0},i(f.row.uuid),{class:"title","aria-label":d.$t("View item details:")+I.post_title}),{default:m(()=>[y(o(I.post_title),1)]),_:2},1040,["aria-label"])),a("span",ea,[a("b",null,o(M(Y)(I.quantity)),1),y(" x "+o(I.variation_display_title||I.title),1)])]))),128)),s(f.row).length===0?(n(),l("p",ta,o(M(b)("No products found!")),1)):p("",!0)])])]),_:2},1024)):p("",!0)],2),f.row.order_items?(n(!0),l(T,{key:0},E(f.row.order_items,I=>(n(),S(Tt,{key:I.id,product:I},null,8,["product"]))),128)):p("",!0)]}),_:1},8,["width","label","aria-label"]),c(w,{label:M(b)("Status"),width:"120","aria-label":d.$t("Order status")},{default:m(f=>[c(U,{type:f.row.status,size:"small"},{default:m(()=>[y(o(M(J)(f.row.status)),1)]),_:2},1032,["type"])]),_:1},8,["label","aria-label"]),c(w,{label:M(b)("Amount"),width:"90","aria-label":d.$t("Total amount")},{default:m(f=>[a("span",{class:"text",innerHTML:d.formatNumber(f.row.total_amount,!0,!1,f.row.currency)},null,8,aa)]),_:1},8,["label","aria-label"])]),_:1},8,["empty-text","data","show-header","aria-label"])])}}},ra={name:"OrderTableLoader",props:{rowsRange:{type:Array,default:[1,2]}}},ia={class:"fct-customer-dashboard-table"};function na(e,s,r,h,t,i){const d=_("el-skeleton-item"),u=_("el-skeleton"),v=_("el-table-column"),w=_("el-table");return n(),l("div",ia,[c(w,{data:r.rowsRange,"show-header":!1},{default:m(()=>[c(v,{label:"#",width:150},{default:m(()=>[c(u,{animated:"",class:"py-3"},{template:m(()=>[c(d,{varient:"p",class:"w-3/5"})]),_:1})]),_:1}),c(v,{width:300,label:e.$t("Items")},{default:m(()=>[c(u,{animated:""},{template:m(()=>[c(d,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),c(v,{label:e.$t("Status"),width:"120"},{default:m(()=>[c(u,{animated:""},{template:m(()=>[c(d,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"]),c(v,{label:e.$t("Amount"),width:"90"},{default:m(()=>[c(u,{animated:""},{template:m(()=>[c(d,{varient:"p",class:"w-3/5"})]),_:1})]),_:1},8,["label"])]),_:1},8,["data"])])}const re=L(ra,[["render",na]]),oa={name:"Dashboard",components:{OrderTable:Mt,OrderTableLoader:re},data(){return{recentPurchasesTitleId:"recent-purchases-title",dashboardData:{orders:[],subscriptions:[],licenses:[]},sectionParts:{},loading:!1}},mounted(){this.fetchDashboardData()},methods:{formatOrderItems:ke,fetchDashboardData(){this.loading=!0,this.$get("customer-profile").then(e=>{this.dashboardData=e.dashboard_data,this.dashboardData.orders.forEach(s=>{s.order_items=this.formatOrderItems(s.order_items)}),e.section_parts&&(this.sectionParts=e.section_parts)}).finally(()=>{this.loading=!1})}}},la=["aria-labelledby","aria-busy"],da={class:"fct-customer-dashboard-header"},ca=["id"],ua={class:"actions"},ma={key:0,"aria-live":"polite"},ha=["innerHTML"],_a=["innerHTML"];function pa(e,s,r,h,t,i){const d=_("router-link"),u=_("OrderTableLoader"),v=_("OrderTable");return n(),l("div",{class:"fct-customer-dashboard fct-customer-dashboard-layout-width",role:"region","aria-labelledby":t.recentPurchasesTitleId,"aria-busy":t.loading},[a("div",null,[a("div",da,[a("h4",{id:t.recentPurchasesTitleId,class:"fct-customer-dashboard-title"},o(e.$t("Your Recent Purchases")),9,ca),a("div",ua,[t.dashboardData.orders.length?(n(),S(d,{key:0,class:"is-link",to:{name:"purchase-history"},"aria-label":e.$t("View all purchases")},{default:m(()=>[y(o(e.$t("View all")),1)]),_:1},8,["aria-label"])):p("",!0)])]),t.loading?(n(),l("div",ma,[c(u,{"rows-range":[1,2]})])):p("",!0),t.sectionParts.before_orders_table?(n(),l("div",{key:1,innerHTML:t.sectionParts.before_orders_table},null,8,ha)):(n(),l(T,{key:2},[t.loading?p("",!0):(n(),S(v,{key:0,orders:t.dashboardData.orders},null,8,["orders"]))],64)),t.sectionParts.after_orders_table?(n(),l("div",{key:3,innerHTML:t.sectionParts.after_orders_table},null,8,_a)):p("",!0)])],8,la)}const fa=L(oa,[["render",pa]]),ba={name:"EmptyState",props:["title","text"],data(){var e,s;return{shop_url:(s=(e=window.fluentcart_customer_profile_vars)==null?void 0:e.shop)==null?void 0:s.shop_url}}},ya={class:"fct-customer-dashboard-empty-state",role:"status","aria-live":"polite","aria-atomic":"true"},ga={class:"fct-customer-dashboard-empty-state-inner"},va={class:"fct-empty-icon-box","aria-hidden":"true"};function wa(e,s,r,h,t,i){const d=_("el-button");return n(),l("div",ya,[a("div",ga,[a("div",va,[xt(e.$slots,"icon")]),a("h4",null,o(r.title),1),a("p",null,o(r.text),1),c(d,{tag:"a",href:t.shop_url,rel:"noopener noreferrer","aria-label":e.$t("Back to Shopping Now")},{default:m(()=>[y(o(e.$t("Back to Shopping Now")),1)]),_:1},8,["href","aria-label"])])])}const ce=L(ba,[["render",wa]]),ka={props:{table:{type:Object,required:!1},pagerSizes:{type:Boolean,default:!0},pagination:{required:!0,type:Object},extra_sizes:{required:!1,type:Array,default(){return[]}},hide_on_single:{required:!1,type:Boolean,default(){return!0}},background:{type:Boolean,default:!0},layout:{type:String,default:"prev, pager, next, slot"},pager_count:{type:Number,default:5}},data(){return{currentPage:1,pickerObserver:null}},computed:{page_sizes(){const e=[];this.pagination.per_page<10&&e.push(this.pagination.per_page);const s=[10,20,50,80,100,120,150];return[...e,...s,...this.extra_sizes]},totalPage(){const e=this.pagination.per_page,s=this.pagination.total;return isNaN(s)||s<=0?0:Math.ceil(s/e)}},watch:{pagination:{immediate:!0,handler(e,s){setTimeout(()=>{this.translatePickerElements()},400)}}},mounted(){this.translatePickerElements()},methods:{translateNumber:Y,translate:b,changePage(e){var r;let s=this.getCurrentPageCount(e,this.pagination.per_page);this.currentPage=e,this.pagination.current_page=e,this.$emit("currentPageChanged",{page:e,currentPageCount:s}),this.$emit("fetch"),(r=this.table)==null||r.handlePageChange(),setTimeout(()=>{this.translatePickerElements()},300)},changeSize(e){var s;this.currentPage=1,this.pagination.current_page=1,this.$emit("onPerPageChanged",e),this.$emit("fetch"),(s=this.table)==null||s.handlePerPageChange()},getCurrentPageCount(e,s){return(e<this.pagination.last_page?s:this.pagination.total%s)||s},translatePickerElements(){const e=document.querySelector(".el-pagination.is-background");if(!e)return;e.querySelectorAll("li.number").forEach(h=>{const t=h.textContent.trim();if(t&&/\d/.test(t)&&!h.dataset.translated){const i=Y(t);h.style.setProperty("--translated-number",`"${i}"`),h.dataset.translated="1"}})}}},xa={class:"pagination-wrap"},Ca={key:0,class:"pager-wrap"},Ta={class:"text"},Sa={class:"el-pagination"},Pa={class:"text"};function Aa(e,s,r,h,t,i){const d=_("el-option"),u=_("el-select"),v=_("el-pagination");return n(),l("div",xa,[r.pagerSizes?(n(),l("div",Ca,[a("span",Ta,o(i.translate("Page %1$s of %2$s",i.translateNumber(t.currentPage),i.translateNumber(i.totalPage))),1),a("div",Sa,[c(u,{onChange:i.changeSize,modelValue:r.pagination.per_page,"onUpdate:modelValue":s[0]||(s[0]=w=>r.pagination.per_page=w),placeholder:i.translate("Select")},{default:m(()=>[(n(!0),l(T,null,E(i.page_sizes,w=>(n(),S(d,{key:w,label:i.translate("%s / page",i.translateNumber(w)),value:w},null,8,["label","value"]))),128))]),_:1},8,["onChange","modelValue","placeholder"])]),a("span",Pa,o(i.translate("Total %s",i.translateNumber(r.pagination.total))),1)])):p("",!0),c(v,{ref:"paginationRef","hide-on-single-page":r.hide_on_single,background:r.background,"current-page":r.pagination.current_page,layout:r.layout,onCurrentChange:i.changePage,"page-sizes":i.page_sizes,total:r.pagination.total,"page-count":r.pagination.last_page,"pager-count":r.pager_count,"page-size":r.pagination.per_page,"onUpdate:pageSize":s[1]||(s[1]=w=>r.pagination.per_page=w)},{default:m(w=>[y(o(w),1)]),_:1},8,["hide-on-single-page","background","current-page","layout","onCurrentChange","page-sizes","total","page-count","pager-count","page-size"])])}const ue=L(ka,[["render",Aa]]),Ma={name:"PurchaseHistory",components:{OrderTable:Mt,Pagination:ue,IconButton:xe,DynamicIcon:F,OrderTableLoader:re,EmptyState:ce},data(){return{purchaseHistoryTitleId:"purchase-history-title",search:"",showSearch:!1,orders:[],paginate:{current_page:1,per_page:10,total:0},loading:!0,app_loaded:!1}},mounted(){this.fetchOrders()},methods:{formatOrderItems:ke,fetchOrders(){this.loading=!0,this.$get("customer-profile/orders",{per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.search}).then(e=>{this.orders=e.orders.data,this.paginate.total=e.orders.total,this.orders.forEach(s=>{s.order_items=this.formatOrderItems(s.order_items)})}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1,this.app_loaded=!0})}}},$a=["aria-labelledby","aria-busy"],Da={class:"fct-customer-purchase-history-inner"},Ea={class:"fct-customer-dashboard-header"},La=["id"],Ia={class:"actions"},Va={class:"fct-collapsible-search-wrap"},Ra={for:"purchase-search-input",class:"sr-only"},Ba={id:"search-help",class:"sr-only"},Fa={key:0,"aria-live":"polite"},Na={key:1,"aria-live":"polite"};function Ua(e,s,r,h,t,i){const d=_("el-input"),u=_("DynamicIcon"),v=_("IconButton"),w=_("OrderTableLoader"),k=_("OrderTable"),f=_("EmptyState"),x=_("Pagination"),g=ee("loading");return n(),l("div",{class:"fct-customer-purchase-history",role:"region","aria-labelledby":t.purchaseHistoryTitleId,"aria-busy":t.loading},[a("div",Da,[a("div",null,[a("div",Ea,[a("h4",{id:t.purchaseHistoryTitleId,class:"fct-customer-dashboard-title"},o(e.$t("Purchase History")),9,La),a("div",Ia,[a("div",Va,[a("label",Ra,o(e.$t("Search orders")),1),c(Nt,{name:"fade-slide"},{default:m(()=>[t.showSearch?(n(),S(d,{key:0,id:"purchase-search-input",modelValue:t.search,"onUpdate:modelValue":s[0]||(s[0]=P=>t.search=P),onKeyup:Ft(i.fetchOrders,["enter"]),onClear:i.fetchOrders,placeholder:e.$t("Search and hit enter..."),clearable:"",size:"small","aria-describedby":"search-help"},null,8,["modelValue","onKeyup","onClear","placeholder"])):p("",!0)]),_:1}),a("small",Ba,o(e.$t("Press Enter to search")),1),c(v,{tag:"button",size:"small",onClick:s[1]||(s[1]=P=>t.showSearch=!t.showSearch),"aria-expanded":t.showSearch,"aria-label":t.showSearch?e.$t("Close search"):e.$t("Open search"),"aria-controls":"purchase-search-input"},{default:m(()=>[t.showSearch?(n(),S(u,{key:0,name:"Cross","aria-hidden":"true"})):(n(),S(u,{key:1,name:"Search","aria-hidden":"true"}))]),_:1},8,["aria-expanded","aria-label"])])])]),t.loading&&!t.app_loaded?(n(),l("div",Fa,[c(w,{rowsRange:[1,2,3,4,5]})])):t.app_loaded?Z((n(),l("div",Na,[t.orders.length>0?(n(),S(k,{key:0,orders:t.orders,showTableHeader:!0},null,8,["orders"])):(n(),S(f,{key:1,title:e.$t("No purchases yet"),text:e.$t("Your purchases will be shown here!")},{icon:m(()=>s[2]||(s[2]=[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none","aria-hidden":"true"},[a("path",{opacity:"0.4",d:"M35 28.6021C35 30.9063 31.7573 32.2761 25.2718 35.0158C22.6663 36.1163 21.3637 36.6666 20 36.6666C18.6363 36.6666 17.3337 36.1163 14.7282 35.0158C8.24273 32.2761 5 30.9063 5 28.6021V11.6666L20 18.9246L35 11.6666V28.6021Z",fill:"#758195"}),a("path",{d:"M20 36.6666C18.6363 36.6666 17.3337 36.1163 14.7282 35.0158C8.24273 32.2761 5 30.9063 5 28.6021C5 27.957 5 16.7741 5 11.6666M20 36.6666C21.3637 36.6666 22.6663 36.1163 25.2718 35.0158C31.7573 32.2761 35 30.9063 35 28.6021V11.6666M20 36.6666V18.9246",stroke:"#758195","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M13.8765 16.1523L9.00787 13.7965C6.33595 12.5035 5 11.8571 5 10.8334C5 9.80966 6.33595 9.16321 9.00787 7.87029L13.8765 5.51441C16.8813 4.06039 18.3838 3.33337 20 3.33337C21.6162 3.33337 23.1187 4.06037 26.1235 5.51441L30.9922 7.87029C33.664 9.16321 35 9.80966 35 10.8334C35 11.8571 33.664 12.5035 30.9922 13.7965L26.1235 16.1523C23.1187 17.6064 21.6162 18.3334 20 18.3334C18.3838 18.3334 16.8813 17.6064 13.8765 16.1523Z",stroke:"#758195","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M10 20L13.3333 21.6667",stroke:"#758195","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M28.3327 6.66663L11.666 15",stroke:"#758195","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1)])),_:1},8,["title","text"]))])),[[g,t.loading]]):p("",!0)]),t.paginate&&t.paginate.total!==0?(n(),S(x,{key:0,hide_on_single:!0,pagination:t.paginate,onFetch:i.fetchOrders},null,8,["pagination","onFetch"])):p("",!0)])],8,$a)}const Oa=L(Ma,[["render",Ua]]);class Ha{static copyModern(s){return navigator.clipboard.writeText(s)}static copyLegacy(s){const r=document.createElement("textarea");r.value=s,r.setAttribute("readonly",""),r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r),r.select();try{return document.execCommand("copy"),r.remove(),Promise.resolve()}catch{return r.remove(),Promise.reject(new Error(b("Failed to copy text")))}}static async copy(s,r={}){const t={...{showNotification:!0,duration:2e3},...r};t.successMessage=t.successMessage||b("Copied to clipboard"),t.errorMessage=t.errorMessage||b("Failed to copy text");try{return navigator.clipboard&&window.isSecureContext?await this.copyModern(s):await this.copyLegacy(s),t.showNotification&&ae({type:"success",title:b("Success"),message:t.successMessage,duration:t.duration,offset:30}),!0}catch{return t.showNotification&&de.alert(s,b("Please copy this text: "),{confirmButtonText:b("Close")}),!1}}static copyElement(s,r={}){if(!s)throw new Error(b("Element not provided"));const h=s.textContent||s.value||"";return this.copy(h,r)}}const qa={class:"fct-copy-wrap"},za={key:0,class:"fct-copy-basic"},ja={key:1,class:"fct-copy-basic-wrap"},Ya={class:"fct-copy-basic"},Ka={key:2,class:"fct-copy-advanced flex"},Wa=["value","placeholder"],Za=["disabled"],Ga={__name:"CopyToClipboard",props:{showMode:{type:String,default:""},tooltipText:{type:String,default:b("Copy")},text:String,placeholder:String,buttonText:{type:String,default:b("Copy")},tooltipContent:{type:String,default:""},placement:{type:String,default:"top-end"}},setup(e){const s=e,r=N(s.text),h=N(null),t=i=>{i.preventDefault(),Ha.copy(r.value)};return fe(()=>s.text,i=>{r.value=i},{deep:!0}),(i,d)=>{const u=_("el-button"),v=_("el-tooltip");return n(),l("div",qa,[e.showMode==="basic_copy_btn"?(n(),l("div",za,[a("span",{ref_key:"copyTooltip",ref:h,class:"copy-tooltip"},o(e.tooltipText),513),a("button",{class:"fct-copy-btn",onClick:t},d[0]||(d[0]=[a("svg",{viewBox:"0 0 20 20","aria-hidden":"true",width:"20",height:"20"},[a("path",{"fill-rule":"evenodd",d:"M6.515 4.75a2 2 0 0 1 1.985-1.75h3a2 2 0 0 1 1.985 1.75h.265a2.25 2.25 0 0 1 2.25 2.25v7.75a2.25 2.25 0 0 1-2.25 2.25h-7.5a2.25 2.25 0 0 1-2.25-2.25v-7.75a2.25 2.25 0 0 1 2.25-2.25h.265Zm1.985-.25h3a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5Zm-1.987 1.73.002.02h-.265a.75.75 0 0 0-.75.75v7.75c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75v-7.75a.75.75 0 0 0-.75-.75h-.265a2 2 0 0 1-1.985 1.75h-3a2 2 0 0 1-1.987-1.77Z"})],-1)]))])):e.showMode==="icon_with_text"?(n(),l("div",ja,[a("div",Ya,[a("span",{ref_key:"copyTooltip",ref:h,class:"copy-tooltip"},o(e.tooltipText),513),c(u,{class:"fct-copy-text-btn",text:"",onClick:t},{default:m(()=>[c(F,{name:"Copy"}),y(" "+o(e.buttonText),1)]),_:1})]),e.tooltipContent?(n(),S(v,{key:0,"popper-class":"fct-tooltip",content:e.tooltipContent,placement:e.placement,"show-after":400,"hide-after":0},{default:m(()=>[a("span",null,[c(F,{name:"InformationFill",class:"w-4.5 h-4.5"})])]),_:1},8,["content","placement"])):p("",!0)])):(n(),l("div",Ka,[a("input",{type:"text",class:"w-full",readonly:"",value:r.value,placeholder:e.placeholder},null,8,Wa),a("span",{ref_key:"copyTooltip",ref:h,hidden:"",class:"copy-tooltip"},o(i.$t("Copied!")),513),a("button",{class:"fct-copy-btn flex",onClick:t,disabled:!r.value},[c(F,{name:"Copy"}),y(" "+o(i.$t("Copy")),1)],8,Za)]))])}}},Ja={name:"LicenseKey",components:{CopyToClipboard:Ga},props:{license_key:String,show_mode:{type:String,default:"icon_with_text"},tooltip_text:{type:String,default:""}},methods:{translate:b}},Qa=["aria-label"],Xa={class:"license-key"},er={class:"block",id:"license-key-value"};function tr(e,s,r,h,t,i){const d=_("CopyToClipboard");return n(),l("div",{class:"fct-license-key-wrap",role:"group","aria-label":i.translate("License Key")},[a("div",Xa,[a("span",er,o(r.license_key),1)]),c(d,{text:r.license_key,showMode:r.show_mode,tooltipText:r.tooltip_text||i.translate("Copy License Key"),"button-text":i.translate("Copy"),"aria-label":i.translate("Copy license key to clipboard"),"aria-describedby":"license-key-value"},null,8,["text","showMode","tooltipText","button-text","aria-label"])],8,Qa)}const we=L(Ja,[["render",tr]]),sr={class:"fct-customer-dashboard-table"},ar={class:"license-only-mobile"},rr={class:"item-header"},ir={key:0,class:"fct-expiration-info"},nr={key:0,class:"text-meta"},or={key:1,class:"text-meta"},lr=["onClick","aria-label"],dr={class:"fct-customer-orders-items-title"},cr={class:"item-body"},ur={class:"fct-customer-payment-meta-info"},mr={class:"item-footer"},hr={class:"fct-customer-orders-items-meta-wrap"},_r={key:1,class:"text-meta"},pr={key:1,role:"alert",class:"text-center p-5"},fr=["onClick","aria-label"],br={class:"fct-customer-orders-items-title"},yr={class:"fct-customer-orders-items-meta-wrap"},gr={key:0,class:"text-meta"},vr={key:1,class:"fct-btn-group pt-1"},wr={class:"fct-customer-payment-meta-info"},kr={key:0,class:"text-meta"},xr={key:1,class:"text-meta"},Ce={__name:"LicenseTable",props:{licenses:{type:Array,required:!0},showTableHeader:{type:Boolean,default:!1},itemsColumnWidth:{type:Number,default:300},is_simple:{type:Boolean,default:!1}},setup(e){const s=as();return(r,h)=>{const t=_("el-button"),i=_("el-table-column"),d=_("el-table");return n(),l("div",sr,[a("div",ar,[e.licenses.length>0?(n(!0),l(T,{key:0},E(e.licenses,u=>(n(),l("div",{class:"license-only-mobile-item",key:u.id},[a("div",rr,[(u==null?void 0:u.status)!=="disabled"&&!e.is_simple?(n(),l("div",ir,[u.expiration_date?(n(),l("div",nr,[(u==null?void 0:u.status)==="expired"?(n(),l(T,{key:0},[y(o(M(b)("Expired at: %s",M(j)(u.expiration_date,"date"))),1)],64)):(n(),l(T,{key:1},[y(o(M(b)("Expires on: %s",M(j)(u.expiration_date,"date"))),1)],64))])):(n(),l("div",or,o(M(b)("Never Expires")),1))])):p("",!0),a("div",{class:"fct-customer-orders-items fct-customer-license-orders-items cursor-pointer",onClick:v=>M(s).push({name:"manage_license",params:{license_key:u.license_key}}),"aria-label":r.$t("View details for license: %s",u.title)},[a("div",dr,o(u.title),1)],8,lr)]),a("div",cr,[a("div",ur,[c(we,{license_key:u==null?void 0:u.license_key,show_mode:"basic_copy_btn",tooltip_text:M(b)("Copy Key")},null,8,["license_key","tooltip_text"])])]),a("div",mr,[a("div",hr,[c(U,{type:u.status,"hide-icon":!0,"aria-label":r.$t("License status: %s",u.status)},{default:m(()=>[y(o(M(J)(u.status)),1)]),_:2},1032,["type","aria-label"]),u.renewal_url?(n(),S(t,{key:0,link:"",tag:"a",href:u.renewal_url,target:"_blank",rel:"noopener noreferrer","aria-label":r.$t("Renew license: %s",u.title)},{default:m(()=>[y(o(M(b)("Renew License")),1)]),_:2},1032,["href","aria-label"])):p("",!0),u.status!=="expired"?(n(),l("div",_r,o(u.subtitle),1)):p("",!0)])])]))),128)):(n(),l("div",pr,o(M(b)("No Licenses found")),1))]),c(d,{class:"license-only-desktop",data:e.licenses,"show-header":e.showTableHeader,role:"grid","aria-label":r.$t("Licenses table")},{default:m(()=>[c(i,{label:M(b)("Items"),width:e.itemsColumnWidth},{default:m(u=>[a("div",{class:"fct-customer-orders-items fct-customer-license-orders-items cursor-pointer",onClick:v=>M(s).push({name:"manage_license",params:{license_key:u.row.license_key}}),"aria-label":r.$t("View details for license: %s",u.row.title)},[a("div",br,o(u.row.title),1),a("div",yr,[u.row.status!=="expired"?(n(),l("div",gr,o(u.row.subtitle),1)):p("",!0),c(U,{type:u.row.status,"hide-icon":!0,"aria-label":r.$t("License status: %s",u.row.status)},{default:m(()=>[y(o(M(J)(u.row.status)),1)]),_:2},1032,["type","aria-label"]),u.row.renewal_url?(n(),l("div",vr,[c(t,{link:"",tag:"a",href:u.row.renewal_url,target:"_blank",rel:"noopener noreferrer","aria-label":r.$t("Renew license: %s",u.row.title)},{default:m(()=>[y(o(M(b)("Renew License")),1)]),_:2},1032,["href","aria-label"])])):p("",!0)])],8,fr)]),_:1},8,["label","width"]),c(i,{width:400,label:M(b)("License Info"),align:"right","class-name":"license-info-column"},{default:m(u=>{var v;return[a("div",wr,[u.row.status!=="disabled"&&!e.is_simple?(n(),l(T,{key:0},[u.row.expiration_date?(n(),l("div",kr,[u.row.status==="expired"?(n(),l(T,{key:0},[y(o(M(b)("Expired at: %s",M(j)(u.row.expiration_date,"date"))),1)],64)):(n(),l(T,{key:1},[y(o(M(b)("Expires on: %s",M(j)(u.row.expiration_date,"date"))),1)],64))])):(n(),l("div",xr,o(M(b)("Never Expires")),1))],64)):p("",!0),c(we,{license_key:(v=u.row)==null?void 0:v.license_key,show_mode:"basic_copy_btn",tooltip_text:M(b)("Copy Key")},null,8,["license_key","tooltip_text"])])]}),_:1},8,["label"])]),_:1},8,["data","show-header","aria-label"])])}}},Cr={name:"Licenses",components:{LicenseTable:Ce,Pagination:ue,OrderTableLoader:re,EmptyState:ce},data(){return{licensesTitleId:"licenses-title",licenses:[],loading:!1,skeletonRowCount:10,paginate:{current_page:1,total:0,per_page:10},search:"",appLoaded:!1}},mounted(){this.fetchLicenses()},methods:{fetchLicenses(){this.loading=!0,this.paginate.per_page,this.paginate.current_page,this.$get("customer-profile/licenses",{per_page:this.paginate.per_page,page:this.paginate.current_page,search:this.search}).then(e=>{this.licenses=e.licenses.data,this.paginate.total=e.licenses.total}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1,this.appLoaded=!0})}}},Tr=["aria-labelledby","aria-busy"],Sr={class:"fct-customer-dashboard-license-inner"},Pr={class:"fct-customer-dashboard-header"},Ar=["id"],Mr={key:0,"aria-live":"polite"};function $r(e,s,r,h,t,i){const d=_("OrderTableLoader"),u=_("LicenseTable"),v=_("EmptyState"),w=_("Pagination"),k=ee("loading");return n(),l("div",{class:"fct-customer-dashboard-license",role:"region","aria-labelledby":t.licensesTitleId,"aria-busy":t.loading},[a("div",Sr,[a("div",null,[a("div",Pr,[a("h4",{id:t.licensesTitleId,class:"fct-customer-dashboard-title"},o(e.$t("Licenses")),9,Ar)]),t.loading&&!t.appLoaded?(n(),l("div",Mr,[c(d,{"rows-range":[1,2,3,4]})])):t.appLoaded&&t.paginate.total?Z((n(),S(u,{key:1,licenses:t.licenses,showTableHeader:!0},null,8,["licenses"])),[[k,t.loading]]):(n(),S(v,{key:2,title:e.$t("No licenses yet"),text:e.$t("Looks like no licenses yet. Purchase something to view data.")},{icon:m(()=>s[0]||(s[0]=[a("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none"},[a("path",{opacity:"0.4",d:"M20.928 2.08337C23.9908 2.08334 26.4168 2.08332 28.3157 2.33861C30.2697 2.60131 31.8512 3.15484 33.0985 4.40211C34.3458 5.64939 34.8993 7.23097 35.162 9.18501C35.4173 11.0837 35.4172 13.5097 35.4172 16.5726V23.4274C35.4172 26.4902 35.4173 28.9164 35.162 30.815C34.8993 32.769 34.3458 34.3507 33.0985 35.598C31.8512 36.8452 30.2697 37.3987 28.3157 37.6615C26.4168 37.9167 23.9908 37.9167 20.928 37.9167H19.0733C16.0105 37.9167 13.5843 37.9167 11.6856 37.6615C9.7315 37.3987 8.14992 36.8452 6.90264 35.5979C5.65537 34.3507 5.10185 32.769 4.83915 30.815C4.58389 28.9164 4.58394 26.4902 4.58399 23.4274L4.58405 16.5726C4.58405 13.5096 4.58405 11.0836 4.83934 9.18494C5.10207 7.23091 5.6556 5.64934 6.90287 4.40209C8.15014 3.15482 9.7317 2.60131 11.6857 2.33859C13.5844 2.08332 16.0104 2.08334 19.0733 2.08337H20.928Z",fill:"#758195"}),a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.666 11.6667C11.666 10.7462 12.4122 10 13.3327 10H26.666C27.5865 10 28.3327 10.7462 28.3327 11.6667C28.3327 12.5871 27.5865 13.3333 26.666 13.3333H13.3327C12.4122 13.3333 11.666 12.5871 11.666 11.6667ZM11.666 20C11.666 19.0795 12.4122 18.3333 13.3327 18.3333H26.666C27.5865 18.3333 28.3327 19.0795 28.3327 20C28.3327 20.9205 27.5865 21.6667 26.666 21.6667H13.3327C12.4122 21.6667 11.666 20.9205 11.666 20ZM11.666 28.3333C11.666 27.4128 12.4122 26.6667 13.3327 26.6667H19.9993C20.9198 26.6667 21.666 27.4128 21.666 28.3333C21.666 29.2538 20.9198 30 19.9993 30H13.3327C12.4122 30 11.666 29.2538 11.666 28.3333Z",fill:"#758195"})],-1)])),_:1},8,["title","text"]))]),t.paginate&&t.paginate.total!==0?(n(),S(w,{key:0,hide_on_single:!0,pagination:t.paginate,onFetch:i.fetchLicenses},null,8,["pagination","onFetch"])):p("",!0)])],8,Tr)}const Dr=L(Cr,[["render",$r]]),Er={components:{DynamicIcon:F},props:{downloads:{type:Array,default:()=>[]},showTableHeader:{type:Boolean,default:!0}},methods:{translate:b,readableFileSize(e){return es.readableFileSizeFromBytes(e)}}},Lr={class:"fct-customer-dashboard-table"},Ir={class:"fct-customer-downloads-file-info"},Vr=["aria-label"],Rr=["aria-label"],Br=["href","aria-label"];function Fr(e,s,r,h,t,i){const d=_("el-table-column"),u=_("DynamicIcon"),v=_("el-table");return n(),l("div",Lr,[c(v,{data:Object.values(r.downloads),"show-header":r.showTableHeader,role:"grid","aria-label":e.$t("Downloads table")},{default:m(()=>[c(d,{label:e.$t("File Name")},{default:m(w=>{var k,f,x,g;return[a("div",Ir,[a("div",{class:"filename",role:"status","aria-label":`${i.translate("File name: %s",((k=w.row)==null?void 0:k.title)||"N/A")}`},o(((f=w.row)==null?void 0:f.title)||"N/A"),9,Vr),w.row.file_size?(n(),l("div",{key:0,class:"text",role:"status","aria-label":`${i.translate("File size: %s",i.readableFileSize((x=w.row)==null?void 0:x.file_size))}`},o(i.readableFileSize((g=w.row)==null?void 0:g.file_size)),9,Rr)):p("",!0)])]}),_:1},8,["label"]),c(d,{align:"right"},{default:m(w=>{var k;return[a("a",{target:"_blank",class:"el-button el-button--info is-plain el-button--x-small",href:w.row.download_url,"aria-label":`Download ${((k=w.row)==null?void 0:k.title)||"file"}`,rel:"noopener noreferrer"},[c(u,{name:"Download","aria-hidden":"true",role:"presentation"}),y(" "+o(e.$t("Download")),1)],8,Br)]}),_:1})]),_:1},8,["data","show-header","aria-label"])])}const $t=L(Er,[["render",Fr]]),Nr={components:{OrderTableLoader:re,Pagination:ue,DownloadsTable:$t,EmptyState:ce},props:{isLimited:{type:Boolean,default:!1},per_page:{type:Number,default:10}},data(){return{downloadsTitleId:"downloads-title",downloads:[],loading:!1,appLoaded:!1,paginate:{current_page:1,per_page:this.per_page,total:0}}},mounted(){this.fetchFiles()},methods:{fetchFiles(){this.loading=!0,this.$get("customer-profile/downloads",{per_page:this.paginate.per_page,page:this.paginate.current_page}).then(e=>{var s,r;this.downloads=(s=e.downloads)==null?void 0:s.data,this.paginate.total=(r=e.downloads)==null?void 0:r.total}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1,this.appLoaded=!0})}}},Ur=["aria-labelledby","aria-busy"],Or={class:"fct-customer-dashboard-header"},Hr=["id"],qr={key:0,class:"actions"},zr={key:0,"aria-live":"polite"},jr={key:1,class:"fct-customer-dashboard-downloads-table","aria-live":"polite"};function Yr(e,s,r,h,t,i){var x;const d=_("router-link"),u=_("OrderTableLoader"),v=_("DownloadsTable"),w=_("EmptyState"),k=_("Pagination"),f=ee("loading");return n(),l("div",{class:"fct-customer-dashboard-download",role:"region","aria-labelledby":t.downloadsTitleId,"aria-busy":t.loading||!t.appLoaded},[a("div",Or,[a("h4",{id:t.downloadsTitleId,class:"fct-customer-dashboard-title"},o(e.$t("Downloads")),9,Hr),r.isLimited?(n(),l("div",qr,[c(d,{class:"is-link",to:{name:"downloads"},"aria-label":e.$t("View all downloads")},{default:m(()=>[y(o(e.$t("View all")),1)]),_:1},8,["aria-label"])])):p("",!0)]),t.appLoaded?t.appLoaded?Z((n(),l("div",jr,[((x=t.downloads)==null?void 0:x.length)>0?(n(),S(v,{key:0,downloads:t.downloads},null,8,["downloads"])):(n(),S(w,{key:1,title:e.$t("No downloads yet"),text:e.$t("Your valid downloads will be shown here.")},{icon:m(()=>s[0]||(s[0]=[a("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none"},[a("path",{opacity:"0.4",d:"M18.3328 5.41667C18.3328 4.49618 19.079 3.75 19.9995 3.75C20.92 3.75 21.6661 4.49618 21.6661 5.41667V22.998C22.0163 22.6323 22.378 22.2345 22.734 21.8245C23.4321 21.0203 24.0816 20.2106 24.5585 19.5996C24.796 19.2953 24.9885 19.0418 25.1216 18.8656C25.1881 18.7775 25.2401 18.7083 25.2746 18.6621C25.2916 18.6393 25.3036 18.6213 25.312 18.61C25.316 18.6046 25.3198 18.6013 25.3218 18.5986L25.3235 18.5953C25.8693 17.8541 26.913 17.6963 27.6541 18.2421C28.395 18.788 28.5541 19.8301 28.009 20.5713H28.0073V20.5745C28.0065 20.5756 28.0038 20.576 28.0025 20.5778C27.9996 20.5816 27.9961 20.5873 27.9911 20.5941C27.9808 20.608 27.9663 20.6285 27.9471 20.6543C27.9088 20.7058 27.8523 20.7798 27.7811 20.874C27.639 21.0623 27.4353 21.3301 27.1855 21.6503C26.6868 22.2893 25.9988 23.1465 25.2501 24.0088C24.5085 24.863 23.6738 25.76 22.8853 26.4566C22.4931 26.8031 22.0738 27.1363 21.6515 27.391C21.2748 27.618 20.6833 27.9166 19.9995 27.9166C19.3158 27.9166 18.7241 27.618 18.3475 27.391C17.9253 27.1363 17.506 26.8031 17.1138 26.4566C16.3253 25.76 15.4905 24.863 14.7489 24.0088C14.0002 23.1465 13.3122 22.2893 12.8137 21.6503C12.5637 21.3301 12.3601 21.0623 12.2179 20.874C12.1468 20.7798 12.0903 20.7058 12.0519 20.6543C12.0327 20.6285 12.0183 20.608 12.008 20.5941C12.0029 20.5871 11.9978 20.5816 11.995 20.5778C11.9939 20.5763 11.9924 20.5755 11.9917 20.5745V20.5713C11.4464 19.8301 11.6039 18.7863 12.3449 18.2406C13.086 17.6953 14.1299 17.8545 14.6756 18.5953L14.6773 18.5986C14.6792 18.6013 14.6831 18.6046 14.687 18.61C14.6954 18.6213 14.7074 18.6393 14.7245 18.6621C14.7589 18.7083 14.8109 18.7775 14.8775 18.8656C15.0106 19.0418 15.2031 19.2953 15.4406 19.5996C15.9174 20.2106 16.5669 21.0203 17.2651 21.8245C17.621 22.2345 17.9828 22.6323 18.3328 22.998V5.41667Z",fill:"black"}),a("path",{d:"M3.75 23.75V20.415L3.7614 19.987C3.98537 15.5864 7.6225 12.086 12.0785 12.0834H12.0833C13.0036 12.0834 13.7496 12.8299 13.75 13.75C13.75 14.6705 13.0038 15.4167 12.0833 15.4167H12.0801C9.32045 15.4185 7.08403 17.657 7.08333 20.4167V23.75C7.08333 25.7243 7.08512 27.1007 7.17612 28.1707C7.26538 29.2198 7.43154 29.8213 7.67417 30.2752C8.14029 31.1468 8.85484 31.8615 9.72657 32.3275C10.1803 32.5698 10.7808 32.7363 11.8294 32.8255C12.8993 32.9165 14.2758 32.9167 16.25 32.9167H23.75C25.7242 32.9167 27.1007 32.9148 28.1705 32.824C29.2195 32.7347 29.8197 32.5683 30.2734 32.3258C31.1455 31.8597 31.8597 31.1455 32.3259 30.2735C32.5684 29.8198 32.7347 29.2195 32.8239 28.1707C32.9149 27.1008 32.9167 25.7242 32.9167 23.75V20.4167C32.9167 17.6553 30.678 15.4167 27.9167 15.4167C26.9962 15.4167 26.25 14.6705 26.25 13.75C26.25 12.8296 26.9962 12.0834 27.9167 12.0834C32.519 12.0834 36.25 15.8143 36.25 20.4167V23.75C36.25 25.6665 36.2515 27.2083 36.1459 28.4522C36.0384 29.7167 35.8099 30.8252 35.2654 31.8442C34.4885 33.2973 33.2989 34.4883 31.8457 35.2653C30.8267 35.81 29.7167 36.0383 28.4522 36.1458C27.8305 36.1987 27.1344 36.2242 26.3542 36.237L23.75 36.25H16.25C14.3335 36.25 12.7917 36.2517 11.5479 36.1458C10.2831 36.0383 9.17335 35.8117 8.1543 35.267C6.70118 34.4902 5.51155 33.2988 4.7347 31.8457C4.19002 30.8268 3.96177 29.7183 3.85417 28.4538C3.74833 27.2097 3.75 25.6672 3.75 23.75Z",fill:"black"})],-1)])),_:1},8,["title","text"]))])),[[f,t.loading]]):p("",!0):(n(),l("div",zr,[c(u,{"rows-range":[1,2,3,4]})])),t.paginate.total>0?(n(),S(k,{key:2,hide_on_single:!0,pagination:t.paginate,onFetch:i.fetchFiles},null,8,["pagination","onFetch"])):p("",!0)],8,Ur)}const Kr=L(Nr,[["render",Yr]]),Wr={components:{Badge:U,DynamicIcon:F,IconButton:xe},props:["license_key"],data(){return{loading:!1,activations:[],activatedSitesModal:!1}},methods:{showActivatedSitesModal(){this.activatedSitesModal=!0,this.fetchActivatedSites()},fetchActivatedSites(){this.loading=!0,this.$get(`customer-profile/licenses/${this.license_key}/activations`).then(e=>{this.activations=e.activations}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},deactivate(e){this.$post(`customer-profile/licenses/${this.license_key}/deactivate_site`,{site_url:e.site_url}).then(s=>{this.$notify.success(s.message),this.activations=this.activations.filter(r=>r.site_url!==e.site_url)}).catch(s=>{this.handleError(s)})}}},Zr={id:"activated-sites-title",class:"sr-only"},Gr={id:"activated-sites-description",class:"sr-only"},Jr=["aria-label"],Qr=["id"],Xr={id:"delete-confirm-title",class:"sr-only"},ei={role:"alert"};function ti(e,s,r,h,t,i){const d=_("el-button"),u=_("Badge"),v=_("el-table-column"),w=_("DynamicIcon"),k=_("IconButton"),f=_("el-popconfirm"),x=_("el-table"),g=_("el-dialog"),P=ee("loading");return n(),l(T,null,[c(d,{text:"",class:"underline-link-button",onClick:i.showActivatedSitesModal,"aria-label":e.$t("View list of activated sites")},{default:m(()=>[y(o(e.$t("View List")),1)]),_:1},8,["onClick","aria-label"]),c(g,{modelValue:t.activatedSitesModal,"onUpdate:modelValue":s[0]||(s[0]=$=>t.activatedSitesModal=$),"append-to-body":!0,title:e.$t("License Activations"),"modal-class":"fct-activated-sites-modal",role:"dialog","aria-labelledby":"activated-sites-title","aria-describedby":"activated-sites-description"},{default:m(()=>{var $;return[a("h2",Zr,o(e.$t("License Activations")),1),a("p",Gr,o(e.$t("List of sites where the license is activated")),1),Z((n(),l("div",{class:V(["fct-table-style-two fct-activated-sites-table",(($=t.activations)==null?void 0:$.length)>10?"scrollable":""]),"aria-live":"polite",id:"activated-sites-description"},[c(x,{data:t.activations,stripe:"",role:"grid","aria-label":e.$t("Table of activated sites")},{empty:m(()=>[a("span",ei,o(e.$t("No activations found for this license")),1)]),default:m(()=>[c(v,{label:e.$t("Site"),"min-width":270},{default:m(D=>[a("span",null,o(D.row.site_url),1),D.row.is_local!="0"?(n(),l("span",{key:0,style:{"margin-left":"10px"},role:"status","aria-label":e.$t("local")},[c(u,{status:"warning",size:"small","hide-icon":!0,text:e.$t("local")},null,8,["text"])],8,Jr)):p("",!0)]),_:1},8,["label"]),c(v,{label:e.$t("Status"),width:100},{default:m(D=>[c(u,{status:D.row.status,size:"small","hide-icon":!0,"aria-label":`${e.$t("Status")}: ${e.$t(D.row.status)}`},null,8,["status","aria-label"])]),_:1},8,["label"]),c(v,{width:60},{default:m(D=>[a("span",null,[c(f,{width:235,"confirm-button-text":e.$t("Confirm"),"cancel-button-text":e.$t("No, Thanks"),"icon-color":"red",title:e.$t("Are you sure to disconnect?"),onConfirm:I=>i.deactivate(D.row),"aria-labelledby":"delete-confirm-title"},{reference:m(()=>[c(k,{tag:"a",size:"x-small",hover:"danger","aria-label":e.$t("Delete activation for site"),"aria-describedby":`site-${D.$index}`},{default:m(()=>[c(w,{name:"TrashIcon"})]),_:2},1032,["aria-label","aria-describedby"])]),_:2},1032,["confirm-button-text","cancel-button-text","title","onConfirm"]),a("span",{id:`site-${D.$index}`,class:"sr-only"},o(D.row.site_url),9,Qr),a("span",Xr,o(e.$t("Are you sure to disconnect the site"))+" "+o(D.row.site_url)+"? ",1)])]),_:1})]),_:1},8,["data","aria-label"])],2)),[[P,t.loading]])]}),_:1},8,["modelValue","title"])],64)}const si=L(Wr,[["render",ti]]),ai={name:"UpgradePlan",components:{DynamicIcon:F},props:{variation_id:{type:[String,Number],required:!0},order_hash:{type:String,required:!0},buttonText:{type:String,default:"Upgrade"},buttonType:{type:String,default:"default"}},data(){return{upgradePlanModal:!1,selectedUpgradePath:"",upgradePaths:[],loading:!1}},computed:{currencySign(){return this.appVars.shop.currency_sign}},methods:{translate:b,showUpgradePlanModal(){this.fetchPaths(),this.upgradePlanModal=!0},fetchPaths(){this.loading=!0,this.$get(`customer-profile/orders/${this.order_hash}/upgrade-paths`,{variation_id:this.variation_id}).then(e=>{this.upgradePaths=e.upgradePaths}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},closeUpgradePlanModal(){this.upgradePlanModal=!1}}},ri={class:"fct-upgrade-plan"},ii={id:"upgrade-dialog-title",class:"sr-only"},ni={key:0,class:"fct-upgrade-variation-table pb-10"},oi={class:"upgrade-title"},li={class:"plan-price"},di={class:"plan-price"},ci={class:"upgrade-cost"},ui={class:"upgrade-title"},mi=["innerHTML"],hi={class:"upgrade-action"},_i={key:1,role:"status","aria-live":"polite"},pi={key:2,role:"alert","aria-live":"assertive"};function fi(e,s,r,h,t,i){const d=_("el-button"),u=_("el-table-column"),v=_("el-table"),w=_("el-skeleton"),k=_("el-dialog");return n(),l("div",ri,[c(d,{type:r.buttonType,size:"small",onClick:i.showUpgradePlanModal,"aria-label":r.buttonText},{default:m(()=>[y(o(r.buttonText),1)]),_:1},8,["type","onClick","aria-label"]),c(k,{modelValue:t.upgradePlanModal,"onUpdate:modelValue":s[0]||(s[0]=f=>t.upgradePlanModal=f),"append-to-body":!0,title:e.$t("Upgrade Options"),class:"fct-upgrade-plan-dialog fluent-cart-customer-profile-app",role:"dialog","aria-modal":"true","aria-labelledby":"upgrade-dialog-title"},{default:m(()=>[a("h2",ii,o(e.$t("Upgrade Options")),1),t.upgradePaths.length>0?(n(),l("div",ni,[c(v,{data:t.upgradePaths,"aria-label":i.translate("Upgrade options table")},{default:m(()=>[c(u,{label:i.translate("Package"),width:290,"aria-label":i.translate("Package")},{default:m(f=>[a("div",oi,o(f.row.title),1)]),_:1},8,["label","aria-label"]),c(u,{label:i.translate("Price"),width:100,"aria-label":i.translate("Price")},{default:m(f=>[a("div",li,[a("div",di,o(e.formatNumber(f.row.original_price,!0,!1,f.row.currency)),1)])]),_:1},8,["label","aria-label"]),c(u,{label:i.translate("Amount to pay"),width:200,"aria-label":i.translate("Amount to pay")},{default:m(f=>[a("div",ci,[a("div",ui,[a("span",{innerHTML:f.row.payment_summary},null,8,mi)])])]),_:1},8,["label","aria-label"]),c(u,{label:i.translate("Action"),width:110,"aria-label":i.translate("Action")},{default:m(f=>[a("div",hi,[c(d,{class:"el-button--x-small",tag:"a",href:f.row.upgrade_url,target:"_blank",rel:"noopener noreferrer","aria-label":e.$t("Upgrade to")+" "+f.row.title},{default:m(()=>[y(o(e.$t("Upgrade")),1)]),_:2},1032,["href","aria-label"])])]),_:1},8,["label","aria-label"])]),_:1},8,["data","aria-label"])])):t.loading?(n(),l("div",_i,[c(w,{animated:!0,rows:2})])):(n(),l("div",pi,o(i.translate("No upgrade found for this purchase")),1))]),_:1},8,["modelValue","title"])])}const Te=L(ai,[["render",fi]]),bi={name:"LicenseDetails",components:{UpgradePlan:Te,Badge:U,LicenseKey:we,ActivatedSites:si},props:{license_key:{type:String,required:!0}},data(){return{licenseDetailsTitleId:"license-details-title",license:null,loading:!1,sectionParts:{}}},mounted(){this.fetchLicense()},methods:{dateTimeI18:j,fetchLicense(){this.loading=!0,this.$get("customer-profile/licenses/"+this.license_key).then(e=>{this.license=e.license,e.section_parts&&(this.sectionParts=e.section_parts)}).catch(e=>{this.$notify.error(e)}).finally(()=>{this.loading=!1})}}},yi=["aria-labelledby","aria-busy"],gi={class:"fct-customer-dashboard-single-subscription"},vi=["aria-label"],wi=["aria-labelledby"],ki={key:0,class:"fct-renew-box mb-4"},xi={class:"text-center p-4"},Ci={key:0,class:"p-0 m-0 mb-3"},Ti={key:1,class:"p-0 m-0 mb-3"},Si=["href","aria-label"],Pi=["innerHTML"],Ai={class:"fct-single-order-box"},Mi={class:"fct-single-order-header"},$i=["id"],Di={class:"fct-single-order-body"},Ei={class:"fct-single-order-box-inner"},Li={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Ii={class:"left-content"},Vi={class:"fct-product-info-card"},Ri={class:"fct-product-info-card-inner"},Bi={class:"product-info-content"},Fi={class:"title truncate-none"},Ni={class:"variation-title"},Ui={class:"right-content"},Oi={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Hi={class:"left-content"},qi={class:"title"},zi={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},ji={class:"left-content"},Yi={class:"title"},Ki={class:"flex items-center gap-2"},Wi={key:0,class:"text"},Zi={key:1,class:"text"},Gi={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Ji={class:"left-content"},Qi={class:"title"},Xi={class:"text"},en=["innerHTML"],tn={class:"fct-single-order-footer mt-3"},sn={class:"flex items-center gap-3"},an=["innerHTML"],rn=["innerHTML"],nn={key:1,class:"fct-customer-dashboard-loader","aria-live":"polite"},on={key:2,class:"fct-customer-dashboard-no-data",role:"alert"};function ln(e,s,r,h,t,i){var $,D,I,A,R,q;const d=_("el-breadcrumb-item"),u=_("el-breadcrumb"),v=_("el-alert"),w=_("Badge"),k=_("LicenseKey"),f=_("ActivatedSites"),x=_("UpgradePlan"),g=_("router-link"),P=_("el-skeleton");return n(),l("div",{class:"fct-customer-dashboard-manage-license-wrap fct-customer-dashboard-layout-width",role:"main","aria-labelledby":t.licenseDetailsTitleId,"aria-busy":t.loading},[a("div",gi,[a("div",{class:"fct-customer-dashboard-breadcrumb mb-8",role:"navigation","aria-label":e.$t("Breadcrumb")},[c(u,null,{default:m(()=>[c(d,{class:"cursor-pointer",to:{path:"/licenses"}},{default:m(()=>[y(o(e.$t("Licenses")),1)]),_:1}),c(d,null,{default:m(()=>[y(o(r.license_key),1)]),_:1})]),_:1})],8,vi),t.license?(n(),l("div",{key:0,"aria-labelledby":t.licenseDetailsTitleId},[t.license.renewal_url?(n(),l("div",ki,[c(v,{type:t.license.status==="expired"?"error":"warning",closable:!1,role:"alert","aria-live":"assertive"},{default:m(()=>[a("div",xi,[t.license.status==="expired"?(n(),l("p",Ci,o(e.$t("Your license has been expired at %s. Please renew the license for getting updates and support.",i.dateTimeI18(t.license.expiration_date))),1)):(n(),l("p",Ti,o(e.$t("Your license is active until %1$s. Reactivate the subscription to keep getting updates and support after that date.",i.dateTimeI18(t.license.expiration_date))),1)),a("a",{href:t.license.renewal_url,class:"el-button el-button--primary","aria-label":t.license.status==="expired"?e.$t("Renew License"):e.$t("Reactivate Subscription Plan")},o(t.license.status==="expired"?e.$t("Renew License"):e.$t("Reactivate Subscription Plan")),9,Si)])]),_:1},8,["type"])])):p("",!0),t.sectionParts.before_summary?(n(),l("div",{key:1,innerHTML:t.sectionParts.before_summary},null,8,Pi)):p("",!0),a("article",Ai,[a("header",Mi,[a("h1",{id:t.licenseDetailsTitleId,class:"title"},o(e.$t("License Details")),9,$i)]),a("div",Di,[a("div",Ei,[a("div",Li,[a("div",Ii,[a("div",Vi,[a("div",Ri,[a("div",Bi,[a("div",Fi,o(t.license.title),1),a("div",Ni,o(t.license.subtitle),1)])])])]),a("div",Ui,[c(w,{status:t.license.status},null,8,["status"])])]),a("div",Oi,[a("div",Hi,[a("div",qi,o(e.$t("License Key")),1),c(k,{license_key:r.license_key},null,8,["license_key"])])]),a("div",zi,[a("div",ji,[a("div",Yi,o(e.$t("Activations")),1),a("div",Ki,[!(($=t.license)!=null&&$.limit)||Number((D=t.license)==null?void 0:D.limit)===0?(n(),l("span",Wi,o(e.$t("%s / Unlimited",(I=t.license)==null?void 0:I.activation_count)),1)):(n(),l("span",Zi,o(e.$t("%1$s / %2$s",(A=t.license)==null?void 0:A.activation_count,(R=t.license)==null?void 0:R.limit)),1)),t.license.license_key?(n(),S(f,{key:2,license_key:(q=t.license)==null?void 0:q.license_key},null,8,["license_key"])):p("",!0)])]),s[0]||(s[0]=a("div",{class:"right-content"},null,-1))]),a("div",Gi,[a("div",Ji,[a("div",Qi,o(e.$t("Expiration Date")),1),a("div",Xi,o(t.license.expiration_date?i.dateTimeI18(t.license.expiration_date):e.$t("Never Expires")),1)])]),t.sectionParts.end_of_details?(n(),l("div",{key:0,innerHTML:t.sectionParts.end_of_details},null,8,en)):p("",!0)])]),a("footer",tn,[a("div",sn,[t.license.has_upgrades?(n(),S(x,{key:0,"button-type":"primary","button-text":e.$t("Upgrade Plan"),variation_id:t.license.variation_id,order_hash:t.license.order.uuid,"aria-label":e.$t("Upgrade Plan")},null,8,["button-text","variation_id","order_hash","aria-label"])):p("",!0),c(g,{class:"underline-link-button",to:{name:"view_order",params:{order_id:t.license.order.uuid}},"aria-label":e.$t("View Order")},{default:m(()=>[y(o(e.$t("View Order")),1)]),_:1},8,["to","aria-label"]),t.sectionParts.additional_actions?(n(),l("span",{key:1,innerHTML:t.sectionParts.additional_actions},null,8,an)):p("",!0)])])]),t.sectionParts.after_summary?(n(),l("div",{key:2,innerHTML:t.sectionParts.after_summary},null,8,rn)):p("",!0)],8,wi)):t.loading?(n(),l("div",nn,[c(P,{rows:5,animated:""})])):(n(),l("div",on,[a("p",null,o(e.$t("License could not be loaded. Please try again.")),1)]))])],8,yi)}const dn=L(bi,[["render",ln]]),cn={name:"PaymentInfo",props:{data:Object}},un={"aria-labelledby":"payment-info-heading",role:"region"},mn={id:"payment-info-heading",class:"sr-only"},hn=["innerHTML"];function _n(e,s,r,h,t,i){var d,u;return n(),l("div",un,[a("h2",mn,o(e.$t("Payment details")),1),(d=r.data)!=null&&d.payment_info?(n(),l("div",{key:0,class:"fct-customer-payment-info",innerHTML:(u=r.data)==null?void 0:u.payment_info},null,8,hn)):p("",!0)])}const pn=L(cn,[["render",_n]]),fn=["aria-label"],bn=["src","alt"],yn=["src","alt"],gn=["aria-label"],vn=["aria-label"],wn={__name:"CardInfo",props:{data:Object,showPaymentInfo:Boolean},setup(e){const s=Ct(()=>window.fluentcart_customer_profile_vars.assets_path);return(r,h)=>{var t,i,d,u,v,w,k,f,x,g,P,$,D,I,A,R,q,te,Q;return e.data?(n(),l("div",{key:0,class:"fct-card-info",role:"status","aria-label":r.$t("Payment method information")},[((t=e.data)==null?void 0:t.current_payment_method)==="paypal"||((i=e.data)==null?void 0:i.payment_method)==="paypal"?(n(),l("img",{key:0,src:`${s.value}images/payment-methods/paypal-icon.svg`,alt:r.$t("PayPal logo"),role:"presentation"},null,8,bn)):(v=(u=(d=e.data)==null?void 0:d.billing_info)==null?void 0:u.details)!=null&&v.last_4||(w=e.data)!=null&&w.card_last_4?(n(),l(T,{key:1},[a("img",{src:`${s.value}images/credit-card/card.svg`,alt:r.$t("Credit card icon"),role:"presentation","aria-hidden":"true"},null,8,yn),a("div",{class:"text","aria-label":r.$t("Credit card number")+" "+(((x=(f=(k=e.data)==null?void 0:k.billing_info)==null?void 0:f.details)==null?void 0:x.last_4)||((g=e.data)==null?void 0:g.card_last_4))}," **** "+o(((D=($=(P=e.data)==null?void 0:P.billing_info)==null?void 0:$.details)==null?void 0:D.last_4)||((I=e.data)==null?void 0:I.card_last_4)),9,gn)],64)):((A=e.data)==null?void 0:A.current_payment_method)=="offline_payment"?(n(),l("div",{key:2,class:"text",role:"status","aria-label":`${M(oe).headline((R=e.data)==null?void 0:R.current_payment_method)||M(oe).headline((q=e.data)==null?void 0:q.payment_method)} payment method`},o(M(oe).headline((te=e.data)==null?void 0:te.current_payment_method)||M(oe).headline((Q=e.data)==null?void 0:Q.payment_method)),9,vn)):p("",!0)],8,fn)):p("",!0)}}},kn={name:"SubscriptionTable",components:{PaymentInfo:pn,CardInfo:wn,Badge:U},props:{subscriptions:{type:Array,required:!0},hideHeader:{type:Boolean,default:!1}},methods:{dateTimeI18:j,translate:b,subscriptionStatus(e){return e!=null&&e.overridden_status?e==null?void 0:e.overridden_status:e==null?void 0:e.status},getStatusText:J}},xn={class:"fct-customer-dashboard-table"},Cn={class:"subscription-only-mobile"},Tn={class:"item-header"},Sn={key:0,class:"text","aria-live":"polite"},Pn={class:"item-body"},An=["onClick","aria-label"],Mn={class:"fct-customer-orders-items-title"},$n={class:"item-footer"},Dn={class:"item-footer-content"},En={key:1,class:"text-center p-5",role:"alert","aria-live":"polite"},Ln=["onClick","aria-label"],In={class:"fct-customer-orders-items-title"},Vn={class:"fct-customer-orders-items-meta-wrap"},Rn={key:0,class:"text-meta","aria-live":"polite"},Bn={class:"fct-customer-payment-meta-info"};function Fn(e,s,r,h,t,i){const d=_("CardInfo"),u=_("Badge"),v=_("PaymentInfo"),w=_("el-table-column"),k=_("el-table");return n(),l("div",xn,[a("div",Cn,[r.subscriptions.length>0?(n(!0),l(T,{key:0},E(r.subscriptions,f=>(n(),l("div",{class:"subscription-only-mobile-item",key:f.id},[a("div",Tn,[c(d,{data:f,"show-payment-info":e.showPaymentInfo},null,8,["data","show-payment-info"]),f.status=="active"||f.status=="trialing"?(n(),l("div",Sn,o(e.$t("Auto renews on %s",i.dateTimeI18(f.next_billing_date))),1)):p("",!0)]),a("div",Pn,[a("div",{class:"fct-customer-orders-items fct-customer-sub-orders-items cursor-pointer",onClick:x=>e.$router.push({name:"view_subscription",params:{subscription_uuid:f.uuid}}),"aria-label":e.$t("View subscription details for")+" "+f.item_name},[a("div",Mn,o(f.item_name),1)],8,An)]),a("div",$n,[a("div",Dn,[c(u,{status:i.subscriptionStatus(f),"hide-icon":!0,size:"small"},null,8,["status"]),c(v,{data:f},null,8,["data"])])])]))),128)):(n(),l("div",En,o(i.translate("No subscription plans found!")),1))]),c(k,{class:"subscription-only-desktop",data:r.subscriptions,"show-header":!r.hideHeader,role:"table"},{default:m(()=>[c(w,{"min-width":200,label:e.$t("Item")},{default:m(f=>{var x;return[a("div",{class:"fct-customer-orders-items fct-customer-sub-orders-items cursor-pointer",onClick:g=>e.$router.push({name:"view_subscription",params:{subscription_uuid:f.row.uuid}}),"aria-label":e.$t("View subscription details for")+" "+f.row.item_name},[a("div",In,o(f.row.item_name),1),a("div",Vn,[c(u,{"hide-icon":!0,type:(x=f.row)==null?void 0:x.overridden_status,size:"small","aria-hidden":"true"},{default:m(()=>{var g;return[y(o(i.getStatusText((g=f.row)==null?void 0:g.overridden_status)),1)]}),_:2},1032,["type"]),f.row.status=="active"||f.row.status=="trialing"?(n(),l("div",Rn,o(e.$t("Auto renews on %s",i.dateTimeI18(f.row.next_billing_date,"date"))),1)):p("",!0)])],8,Ln)]}),_:1},8,["label"]),c(w,{"min-width":"200",label:e.$t("Plan"),align:"right"},{default:m(f=>[a("div",Bn,[c(v,{data:f.row},null,8,["data"]),c(d,{data:f.row},null,8,["data"])])]),_:1},8,["label"])]),_:1},8,["data","show-header"])])}const Dt=L(kn,[["render",Fn]]),Nn={name:"SubscriptionPlans",components:{OrderTableLoader:re,Badge:U,Pagination:ue,SubscriptionTable:Dt,EmptyState:ce},props:{showLimit:{type:Number,default:10},showViewAllLink:{type:Boolean,default:!1}},data(){return{loading:!1,appLoaded:!1,subscriptions:[],canceling_subscription:!1,paginate:{current_page:1,per_page:10,total:0}}},mounted(){this.fetchSubscriptions()},methods:{subscriptionStatus(e){return e!=null&&e.overridden_status?e==null?void 0:e.overridden_status:e==null?void 0:e.status},modifySubscriptionResponse(e){return e.map(s=>{var r,h;return{...s,card_last_4:(h=(r=s==null?void 0:s.billingInfo)==null?void 0:r.card)==null?void 0:h.last_4}})},fetchSubscriptions(){this.loading=!0,this.$get("customer-profile/subscriptions",{per_page:this.paginate.per_page,page:this.paginate.current_page}).then(e=>{this.subscriptions=e.subscriptions.data,this.paginate.total=e.subscriptions.total}).finally(()=>{this.appLoaded=!0,this.loading=!1})},cancelSubscription(e,s,r){ElMessageBox.confirm(b("It will permanently cancel the active subscription from your payment provider. Are you sure to do that?"),b("Warning"),{type:"warning",cancelButtonText:b("No, keep this!"),confirmButtonText:b("Yes cancel this subscription!")}).then(()=>{this.canceling_subscription=!0,this.$put(`orders/${r}/subscriptions/${e}/cancel`,{data:{vendor_charge_id:s}}).then(()=>{this.canceling_subscription=!1,this.fetchSubscriptions()}).catch(h=>{this.canceling_subscription=!1})})}}},Un={class:"fct-customer-dashboard-subscriptions",role:"main","aria-labelledby":"subscriptions-title"},On={class:"fct-customer-dashboard-subscriptions-inner"},Hn={class:"fct-customer-dashboard-header"},qn={id:"subscriptions-title",class:"fct-customer-dashboard-title"},zn={key:1,class:"fct-customer-dashboard-loading","aria-live":"polite","aria-busy":"true"};function jn(e,s,r,h,t,i){const d=_("SubscriptionTable"),u=_("OrderTableLoader"),v=_("EmptyState"),w=_("Pagination");return n(),l("div",Un,[a("div",On,[a("header",Hn,[a("h4",qn,o(e.$t("Subscription Plans")),1)]),t.subscriptions.length?(n(),S(d,{key:0,subscriptions:t.subscriptions,"aria-label":e.$t("Subscription plans table")},null,8,["subscriptions","aria-label"])):t.loading?(n(),l("div",zn,[c(u,{"rows-range":[1,2,3,4,5]})])):(n(),S(v,{key:2,title:e.$t("No subscriptions yet"),text:e.$t("Once you subscribe to a plan, it will appear here."),role:"status"},{icon:m(()=>s[0]||(s[0]=[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"40",height:"40",viewBox:"0 0 40 40",fill:"none","aria-hidden":"true"},[a("path",{d:"M33.5429 11.9789C34.291 11.4426 35.3322 11.6143 35.8685 12.3624C37.4175 14.5232 38.3297 17.1585 38.3297 20.0001C38.3297 27.4066 32.172 33.3335 24.6727 33.3335H14.349V35C14.3491 35.419 14.1921 35.8383 13.8769 36.1623C13.235 36.8221 12.1798 36.8365 11.5201 36.1946L9.84873 34.5685C9.53043 34.259 9.11337 33.8536 8.86883 33.5373C8.65405 33.2595 8.03432 32.3905 8.48888 31.3226C8.93338 30.2785 9.96332 30.1015 10.3062 30.0543C10.7031 29.9996 11.2015 29.9998 11.6536 30.0001H11.7377H24.6727C30.4177 30.0001 34.9963 25.4803 34.9963 20.0001C34.9963 17.8841 34.3197 15.9231 33.1593 14.3045C32.623 13.5564 32.7949 12.5152 33.5429 11.9789Z",fill:"black"}),a("path",{opacity:"0.4",d:"M6.45682 28.0212C5.7087 28.5575 4.66751 28.3857 4.13121 27.6377C2.58217 25.4768 1.66992 22.8415 1.66992 20C1.66992 12.5934 7.82769 6.66658 15.327 6.66658H25.6507V5.00005C25.6507 4.58106 25.8075 4.16166 26.1228 3.83765C26.7647 3.17793 27.8198 3.16348 28.4797 3.8054L30.151 5.43163C30.4692 5.741 30.8863 6.1464 31.1308 6.46268C31.3457 6.74053 31.9653 7.60961 31.5108 8.67741C31.0663 9.72158 30.0363 9.89861 29.6935 9.94578C29.2965 10.0004 28.7982 10.0002 28.3462 9.99995L28.262 9.99991H15.327C9.58204 9.99991 5.00326 14.5198 5.00326 20C5.00326 22.1158 5.67996 24.0768 6.84032 25.6955C7.37662 26.4437 7.20492 27.4848 6.45682 28.0212Z",fill:"black"})],-1)])),_:1},8,["title","text"])),t.paginate.total?(n(),S(w,{key:3,hide_on_single:!0,pagination:t.paginate,onFetch:i.fetchSubscriptions,"aria-label":e.$t("Subscription pagination")},null,8,["pagination","onFetch","aria-label"])):p("",!0)])])}const Yn=L(Nn,[["render",jn]]),Kn=["id"],Wn=["for"],Zn=["id","type","aria-describedby","aria-required"],Gn=["src","id"],Et={__name:"InputField",props:{id:String,label:String,type:{type:String,default:"text"},imageUrl:{type:String,default:""},modelValue:{type:[String,Number],default:null}},emits:["update:modelValue","change","input"],setup(e,{emit:s}){const r=Ut().ctx,h=N(!1);N();const t=e,i=s,d=N(t.modelValue),u=f=>{h.value=f},v=f=>{r.$refs.input.value?h.value=!0:h.value=f},w=()=>{i("update:modelValue",d.value),i("change",d.value)},k=()=>{i("update:modelValue",d.value),i("input",d.value)};return fe(()=>t.modelValue,f=>{d.value=f}),he(()=>{h.value=!!d.value}),he(()=>{h.value=!!d.value}),(f,x)=>(n(),l("div",{class:V(["form-input-group",{"is-focused":h.value}]),id:e.id,role:"group"},[e.label?(n(),l("label",{key:0,for:e.id},o(e.label),9,Wn)):p("",!0),Z(a("input",{id:e.id,type:e.type,ref:"input","onUpdate:modelValue":x[0]||(x[0]=g=>d.value=g),onFocus:x[1]||(x[1]=g=>u(!0)),onBlur:x[2]||(x[2]=g=>v(!1)),onChange:w,onInput:k,"aria-describedby":e.imageUrl?`${e.id}-icon`:null,"aria-required":f.required||!1},null,40,Zn),[[Ot,d.value]]),e.imageUrl?(n(),l("img",{key:1,src:e.imageUrl,alt:"",id:`${e.id}-icon`,"aria-hidden":"true"},null,8,Gn)):p("",!0)],10,Kn))}},Jn=["id"],Qn={disabled:"",value:""},Xn=["value"],eo={__name:"SelectField",props:{id:String,options:{type:Array,required:!0,default:()=>[]},modelValue:{type:[String,Number],default:null},placeholder:{type:String,default:"Please select an option"}},emits:["update:modelValue"],setup(e,{emit:s}){const r=e,h=s,t=N(r.modelValue);fe(()=>r.modelValue,d=>{t.value=d});const i=()=>{h("update:modelValue",t.value)};return(d,u)=>(n(),l("div",{class:"form-input-group",id:e.id},[Z(a("select",{"onUpdate:modelValue":u[0]||(u[0]=v=>t.value=v),onChange:i},[a("option",Qn,o(e.placeholder),1),(n(!0),l(T,null,E(e.options,(v,w)=>(n(),l("option",{key:w,value:v.value},o(v.label),9,Xn))),128))],544),[[Ht,t.value]])],8,Jn))}},to=()=>new Promise((e,s)=>{if(window.Stripe)e(window.Stripe);else{const r=document.createElement("script");r.src="https://js.stripe.com/v3/",r.async=!0,document.head.appendChild(r),r.onload=()=>{e(window.Stripe)},r.onerror=()=>{s(new Error("Failed to load Stripe script"))}}}),so={components:{InputField:Et,SelectField:eo,ArrowDown:ns,ArrowUp:os},props:{subscription:{type:Object,required:!0},updateMethod:{type:Boolean,required:!0,default:!0}},data(){var e;return{currentPaymentMethod:"",cardNumber:null,cardExpiry:null,cardCvc:null,selectedAddress:"",updating:!1,switching:!1,reactivating:!1,invalidCard:!1,elementStates:{cardNumber:!1,cardExpiry:!1,cardCvc:!1},elementStyle:{base:{fontSize:"16px",color:"#32325d","::placeholder":{color:"#aab7c4"}},invalid:{color:"#fa755a"}},editing:!0,stripe:null,stripePubKey:(e=window.fluentcart_customer_profile_vars)==null?void 0:e.stripe_pub_key,loading:!1,errorMessage:"",successMessage:"",remainingAttempts:0,showRateLimitNote:!1}},computed:{getBillingAddresses(){return this.subscription.billing_addresses||[{}]}},mounted(){var s,r;this.$nextTick(()=>{this.loadAndMountStripeElements()}),this.invalidCard=!0,this.currentPaymentMethod=(s=this.subscription)==null?void 0:s.current_payment_method;const e=(r=this.getBillingAddresses)==null?void 0:r.find(h=>h.is_primary);e&&(this.selectedAddress=e.id),this.fetchRemainingAttempts()},methods:{translate:b,handleElementChange(e){this.elementStates[e.elementType]=e.complete,this.invalidCard=!(this.elementStates.cardNumber&&this.elementStates.cardExpiry&&this.elementStates.cardCvc)},async loadAndMountStripeElements(){this.loading=!0;let e=null;try{e=await to()}catch(r){this.handleError((r==null?void 0:r.message)||b("Error in loading stripe")),this.loading=!1}this.stripe=e(this.stripePubKey);const s=this.stripe.elements();this.cardNumber=s.create("cardNumber",{style:this.elementStyle,showIcon:!0}),this.cardNumber.mount("#card-number"),this.cardExpiry=s.create("cardExpiry",{style:this.elementStyle}),this.cardExpiry.mount("#card-expiry"),this.cardCvc=s.create("cardCvc",{style:this.elementStyle}),this.cardCvc.mount("#card-cvc"),this.loading=!1,this.cardNumber.on("change",this.handleElementChange),this.cardExpiry.on("change",this.handleElementChange),this.cardCvc.on("change",this.handleElementChange)},processNewPaymentMethod(){this.save()},async save(){this.updating=!0;const e=await this.createPaymentMethod();e&&this.currentPaymentMethod=="stripe"?this.updatePaymentMethodInStripe(e,"verify"):e&&this.currentPaymentMethod!="stripe"?this.switchPaymentMethod(e,"verify"):this.updating=!1},async switchPaymentMethod(e,s="verify",r=""){var h;this.switching=!0,this.errorMessage="";try{const t=await this.$post("customer-profile/subscriptions/"+((h=this.subscription)==null?void 0:h.uuid)+"/switch-payment-method",{data:{newPaymentMethod:"stripe",currentPaymentMethod:this.currentPaymentMethod,vendorPaymentMethod:e,verification_status:s,customer_id:r},_fluentCart_rest_nonce:window.fluentCartRestVars.rest.nonce});if((t==null?void 0:t.status)==="requires_action"){const{setupIntent:i,error:d}=await this.stripe.confirmCardSetup(t==null?void 0:t.client_secret,{payment_method:e.id});if(d){this.errorMessage=d.message||b("Card verification failed"),this.switching=!1;return}i.status==="succeeded"?await this.switchPaymentMethod(e,"verified",t==null?void 0:t.customer_id):(this.errorMessage=b("Card verification failed"),this.switching=!1)}else(t==null?void 0:t.status)==="failed"?(this.resetData(),this.errorMessage=(t==null?void 0:t.message)||b("Card verification failed"),this.switching=!1,this.handleError(this.errorMessage)):(t==null?void 0:t.status)==="success"?(this.resetData(),this.handleSuccess(b("Payment method updated Successfully!")),this.successMessage=b("Payment method updated Successfully!"),this.closeUpdatePaymentModal(),this.$emit("fetchSubscription")):(this.resetData(),this.errorMessage=(t==null?void 0:t.message)||b("Something went wrong"),this.handleError((error==null?void 0:error.message)||b("Error in switching payment method")))}catch(t){this.resetData(),this.errorMessage=(t==null?void 0:t.message)||b("Something went wrong"),this.handleError((t==null?void 0:t.message)||b("Error in switching payment method")),this.switching=!1}finally{this.switching=!1}},async createPaymentMethod(){const e=this.getBillingAddresses.find(s=>s.id==this.selectedAddress);try{const{paymentMethod:s,error:r}=await this.stripe.createPaymentMethod({type:"card",card:this.cardNumber,billing_details:{name:e.name,email:e.email,phone:e.phone,address:{country:e.country,line1:e.address_1,line2:e.address_2,city:e.city,state:e.state,postal_code:e.postcode}}});return r?(this.successMessage="",this.errorMessage=(r==null?void 0:r.message)||b("Error in creating payment method"),this.handleError(this.errorMessage),null):s}catch(s){this.successMessage="",this.errorMessage=(s==null?void 0:s.message)||b("Error in creating payment method"),this.handleError(this.errorMessage)}},async updatePaymentMethodInStripe(e,s="verify"){this.updating=!0,this.errorMessage="";try{const r=await this.$post(`customer-profile/subscriptions/${this.subscription.uuid}/update-payment-method`,{data:{newPaymentMethod:e,method:"stripe",vendor_subscription_id:this.subscription.vendor_subscription_id,verification_status:s},_fluentCart_rest_nonce:window.fluentCartRestVars.rest.nonce});if((r==null?void 0:r.status)==="requires_action"){const{setupIntent:h,error:t}=await this.stripe.confirmCardSetup(r==null?void 0:r.client_secret,{payment_method:e.id});if(t){this.errorMessage=t.message||b("Card verification failed"),this.updating=!1;return}h.status==="succeeded"?await this.updatePaymentMethodInStripe(e,"verified"):(this.errorMessage=b("Card verification failed"),this.updating=!1)}else(r==null?void 0:r.status)==="failed"?(this.errorMessage=(r==null?void 0:r.message)||b("Card verification failed"),this.resetData(),this.handleError(this.errorMessage)):(r==null?void 0:r.status)==="success"?(this.handleSuccess(b("Payment method updated Successfully!")),this.resetData(),this.closeUpdatePaymentModal(),this.$emit("fetchSubscription")):(this.errorMessage=(r==null?void 0:r.message)||b("Something went wrong"),this.resetData(),this.handleError((error==null?void 0:error.message)||b("Error in updating payment method")))}catch(r){this.errorMessage=(r==null?void 0:r.message)||b("Something went wrong"),this.handleError((r==null?void 0:r.message)||b("Error in updating payment method")),this.updating=!1}},resetData(){this.cardNumber.clear(),this.cardExpiry.clear(),this.cardCvc.clear(),this.updating=!1,this.switching=!1,this.reactivating=!1,this.editing=!1,this.errorMessage=""},closeUpdatePaymentModal(){this.resetData(),this.$emit("close")},async fetchRemainingAttempts(){if(this.currentPaymentMethod==="stripe")try{const e=await this.$get(`customer-profile/subscriptions/${this.subscription.uuid}/setup-intent-attempts`);(e==null?void 0:e.remaining)!==void 0&&(e==null?void 0:e.remaining)!==null&&(this.remainingAttempts=e.remaining,this.showRateLimitNote=e.remaining<=0)}catch{}}}},ao={role:"form","aria-labelledby":"stripe-payment-heading"},ro={id:"stripe-payment-heading",class:"sr-only"},io={class:"stripe-card-form"},no={class:"fct-form-group"},oo={class:"fct-form-row fct-col-2"},lo={class:"fct-form-group"},co={for:"card-expiry"},uo={class:"fct-form-group"},mo={for:"card-cvc"},ho={key:0,class:"rate-limit-notice rate-limit-notice-warning",role:"note"},_o={class:"rate-limit-text"},po={class:"fct-update-payment-form-item"},fo={class:"form-heading"},bo={class:"form-input-container"},yo={for:"billing-select",class:"sr-only"},go={id:"billing-help",class:"sr-only"},vo={key:1},wo={class:"text-red-500"},ko={key:1,class:"error-message",role:"alert","aria-live":"assertive"},xo={key:2,class:"success-message",role:"alert","aria-live":"assertive"},Co={class:"dialog-footer"};function To(e,s,r,h,t,i){const d=_("el-option"),u=_("el-select"),v=_("el-button"),w=ee("loading");return n(),l("div",ao,[a("h2",ro,o(i.translate("Stripe Payment Method")),1),Z((n(),l("div",io,[a("div",no,[a("label",null,o(i.translate("Card Number")),1),s[2]||(s[2]=a("div",{id:"card-number",class:"stripe-element","aria-describedby":"card-errors"},null,-1))]),a("div",oo,[a("div",lo,[a("label",co,o(i.translate("MM/YY")),1),s[3]||(s[3]=a("div",{id:"card-expiry",class:"stripe-element","aria-describedby":"card-errors"},null,-1))]),a("div",uo,[a("label",mo,o(i.translate("CVC")),1),s[4]||(s[4]=a("div",{id:"card-cvc",class:"stripe-element","aria-describedby":"card-errors"},null,-1))])]),s[5]||(s[5]=a("div",{id:"card-errors",class:"sr-only",role:"alert","aria-live":"assertive"},null,-1))])),[[w,t.loading]]),t.showRateLimitNote?(n(),l("div",ho,[a("p",_o,o(i.translate("You have reached your 24 hours limit for updating card. Please try again tomorrow.")),1)])):p("",!0),a("div",po,[a("h3",fo,o(i.translate("Billing Address")),1),a("div",bo,[i.getBillingAddresses.length?(n(),l(T,{key:0},[a("label",yo,o(i.translate("Select billing address")),1),c(u,{id:"billing-select",modelValue:t.selectedAddress,"onUpdate:modelValue":s[0]||(s[0]=k=>t.selectedAddress=k),placeholder:i.translate("Select"),"aria-describedby":"billing-help"},{default:m(()=>[(n(!0),l(T,null,E(i.getBillingAddresses,k=>(n(),S(d,{key:k.id,label:e.getAddress(k.formatted_address),value:k.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"]),a("small",go,o(i.translate("Choose an existing billing address or add a new one in profile settings.")),1)],64)):(n(),l("span",vo,[a("span",wo,o(i.translate("No billing address found,")),1),y(" "+o(i.translate("please add a new address from"))+" ",1),a("span",{class:"cursor-pointer text-[var(--fct-customer-dashboard-primary-text-color,#2F3448)] underline font-medium",onClick:s[1]||(s[1]=k=>e.$router.push({name:"profile"})),role:"link",tabindex:"0"},o(i.translate("here")),1)]))])]),t.errorMessage?(n(),l("div",ko,o(t.errorMessage),1)):p("",!0),t.successMessage?(n(),l("div",xo,o(t.successMessage),1)):p("",!0),a("div",Co,[c(v,{size:"small",onClick:i.closeUpdatePaymentModal,"aria-label":i.translate("Cancel")},{default:m(()=>[y(o(i.translate("Cancel")),1)]),_:1},8,["onClick","aria-label"]),c(v,{size:"small",type:"primary",onClick:i.processNewPaymentMethod,loading:t.updating||t.switching,disabled:t.updating||t.switching||t.invalidCard,"aria-disabled":t.updating||t.switching||t.invalidCard,"aria-label":r.updateMethod?i.translate("Update"):i.translate("Reactivate")},{default:m(()=>[y(o(r.updateMethod?i.translate("Update"):i.translate("Reactivate")),1)]),_:1},8,["onClick","loading","disabled","aria-disabled","aria-label"])])])}const So=L(so,[["render",To],["__scopeId","data-v-b3bb87d1"]]),Po=()=>new Promise((e,s)=>{var r;if(window.paypal)e(window.paypal);else{const h=document.createElement("script");h.src=`https://www.paypal.com/sdk/js?client-id=${(r=window.fluentcart_customer_profile_vars)==null?void 0:r.paypal_client_id}&vault=true&intent=subscription`,h.async=!0,h.setAttribute("data-partner-attribution-id","FLUENTCART_SP_PPCP"),document.head.appendChild(h),h.onload=()=>{e(window.paypal)},h.onerror=()=>{s(new Error("Failed to load PayPal script"))}}}),Ao={name:"Paypal",props:{subscription:{type:Object,required:!0},updateMethod:{type:Boolean,required:!0,default:!0}},emits:["close","fetchSubscription"],data(){var e;return{updatePaymentUrl:"",paypalClientId:(e=window.fluentcart_customer_profile_vars)==null?void 0:e.paypal_client_id,selectedAddress:"",loading:!1,planId:null,switching:!1,reactivating:!1,reason:"",errorMessage:"",successMessage:""}},computed:{getBillingAddresses(){return this.subscription.billing_addresses}},mounted(){var s;this.$nextTick(()=>{this.loadPaypal()});const e=(s=this.getBillingAddresses)==null?void 0:s.find(r=>r.is_primary);e&&(this.selectedAddress=e.id),this.updateMethod&&(this.reason="update_payment_method")},methods:{translate:b,closeUpdatePaymentModal(){this.$emit("close")},async loadPaypal(){this.loading=!0;let e=null;try{e=await Po()}catch(s){this.handleError((s==null?void 0:s.message)||"Error in loading paypal"),this.loading=!1}this.paypal=e,await this.loadPaypalButtons(),this.loading=!1},async getPlanId(){return this.updateMethod?await this.getPlanIdForUpdate():""},async getPlanIdForUpdate(){try{const e=await this.$post("customer-profile/subscriptions/"+this.subscription.uuid+"/get-or-create-plan",{data:{method:"paypal",reason:this.reason},_fluentCart_rest_nonce:window.fluentCartRestVars.rest.nonce});return(!e||!e.plan||!e.plan.id)&&(this.errorMessage=b("Invalid plan ID response!"),this.handleError(this.errorMessage)),e}catch(e){throw this.errorMessage=(e==null?void 0:e.message)||"Error in getPlanId",this.handleError(this.errorMessage),e}},async confirmNewPaypalSubscriptionSwitch(e,s){this.loading=!0,this.$post("customer-profile/subscriptions/"+this.subscription.uuid+"/confirm-subscription-switch",{data:{newVendorSubscriptionId:e,vendorOrderId:s,method:"paypal"},_fluentCart_rest_nonce:window.fluentCartRestVars.rest.nonce}).then(r=>{(r==null?void 0:r.status)==="success"?(this.handleSuccess(b("PayPal subscription updated successfully")),this.loading=!1,this.$emit("close"),this.$emit("fetchSubscription")):(r!=null&&r.message&&(this.errorMessage=r==null?void 0:r.message),this.loading=!1,this.handleError(this.errorMessage))}).catch(r=>{this.errorMessage=(r==null?void 0:r.message)||b("Error in confirming new paypal subscription"),this.handleError(this.errorMessage),this.loading=!1,this.$emit("close")})},async loadPaypalButtons(){const e=this.$refs.paypalButtonContainer;let s=null,r=null,h=null;e.innerHTML="";let t=this;try{await window.paypal.Buttons({style:{shape:"pill",layout:"vertical",label:"paypal",size:"responsive",disableMaxWidth:!0},createSubscription:async function(d,u){return u.subscription.create({plan_id:s,custom_id:t.subscription.uuid})},onApprove:function(d,u){d.subscriptionID&&(r=d.subscriptionID,h=d.orderID,t.confirmNewPaypalSubscriptionSwitch(r,h))},onClick:async function(d,u){try{const v=await t.getPlanId();if(!v||!v.plan||!v.plan.id)return u.reject();s=v.plan.id}catch{return u.reject()}},onError:d=>{var u,v;(u=this.paymentLoader)==null||u.changeLoaderStatus("error"),(v=this.paymentLoader)==null||v.hideLoader(),alert("PayPal error: "+d.toString())}}).render(e)}catch{}finally{this.loading=!1}}}},Mo={role:"region","aria-labelledby":"paypal-section-heading"},$o={id:"paypal-section-heading",class:"sr-only"},Do=["aria-label"],Eo={key:0,class:"error-message",role:"alert","aria-live":"assertive"},Lo={key:1,class:"success-message",role:"status","aria-live":"polite"},Io={class:"dialog-footer"};function Vo(e,s,r,h,t,i){const d=_("el-button"),u=ee("loading");return n(),l("div",Mo,[a("h2",$o,o(i.translate("PayPal Payment")),1),a("div",null,[Z(a("div",{id:"paypal-button-container",ref:"paypalButtonContainer","aria-live":"polite","aria-label":i.translate("PayPal payment button")},null,8,Do),[[u,t.loading]])]),t.errorMessage?(n(),l("div",Eo,o(t.errorMessage),1)):p("",!0),t.successMessage?(n(),l("div",Lo,o(t.successMessage),1)):p("",!0),a("div",Io,[c(d,{size:"small",onClick:i.closeUpdatePaymentModal,"aria-label":i.translate("Cancel")},{default:m(()=>[y(o(i.translate("Cancel")),1)]),_:1},8,["onClick","aria-label"])])])}const Ro=L(Ao,[["render",Vo],["__scopeId","data-v-a32ea48d"]]),Bo={name:"UpdatePaymentInfos",components:{InputField:Et,Stripe:So,Paypal:Ro},props:{subscription:{type:Object,required:!0},updateMethod:{type:Boolean,required:!0,default:!0},buttonText:{type:String,default:"Update Payment Method"}},data(){return{updatePaymentModal:!1,selectedPaymentMethod:this.subscription.current_payment_method,selectedAddress:"",stripePubKey:window.fluentcart_customer_profile_vars.stripe_pub_key,stripe:null,cardNumber:null,cardExpiry:null,cardCvc:null,loading:!1,error:"",updating:!1,invalidInput:!1}},computed:{getAllPaymentMethods(){var e;return((e=window.fluentcart_customer_profile_vars)==null?void 0:e.payment_methods)||[]},filteredPaymentMethods(){return this.subscription.can_switch_payment_method===!0?(this.getAllPaymentMethods||[]).filter(e=>{var s,r;return((r=(s=this.subscription)==null?void 0:s.switchable_payment_methods)==null?void 0:r.includes(e.slug))||e.slug===this.subscription.current_payment_method}):(this.getAllPaymentMethods||[]).filter(e=>e.slug===this.subscription.current_payment_method)}},mounted(){},methods:{translate:b,showUpdatePaymentModal(){this.updatePaymentModal=!0},closeUpdatePaymentModal(){this.updatePaymentModal=!1},openCardUpdateUrl(){window.open(this.subscription.card_update_url,"_blank")},fetchSubscription(){this.$emit("fetch")}}},Fo={id:"update-payment-title",class:"sr-only"},No={class:"fct-update-payment-method"},Uo={class:"fct-update-payment-method-header"},Oo={id:"payment-methods-label",class:"sr-only"},Ho=["src","alt","title"],qo={id:"update-payment-description",class:"sr-only"},zo={class:"fct-update-payment-method-body"},jo={class:"fct-update-payment-method-form"},Yo={key:0,class:"fct-update-payment-method-stripe"},Ko={key:1,class:"fct-update-payment-method-paypal"},Wo={key:2,class:"fct-update-payment-method-redirect"};function Zo(e,s,r,h,t,i){const d=_("el-button"),u=_("el-radio"),v=_("el-radio-group"),w=_("Stripe"),k=_("Paypal"),f=_("el-dialog");return n(),l("div",null,[r.updateMethod?(n(),S(d,{key:0,onClick:i.showUpdatePaymentModal,text:"",class:"underline-link-button","aria-label":r.buttonText},{default:m(()=>[y(o(r.buttonText),1)]),_:1},8,["onClick","aria-label"])):(n(),S(d,{key:1,onClick:i.showUpdatePaymentModal,text:"",class:"underline-link-button","aria-label":i.translate("Reactivate")},{default:m(()=>[y(o(i.translate("Reactivate")),1)]),_:1},8,["onClick","aria-label"])),c(f,{modelValue:t.updatePaymentModal,"onUpdate:modelValue":s[1]||(s[1]=x=>t.updatePaymentModal=x),title:i.translate("Update Payment"),role:"dialog","aria-modal":"true","aria-labelledby":"update-payment-title","aria-describedby":"update-payment-description"},{default:m(()=>[a("h2",Fo,o(i.translate("Update Payment")),1),a("div",No,[a("div",Uo,[a("label",Oo,o(i.translate("Select payment method")),1),c(v,{class:"fct-update-payment-method-radio",modelValue:t.selectedPaymentMethod,"onUpdate:modelValue":s[0]||(s[0]=x=>t.selectedPaymentMethod=x),role:"radiogroup","aria-labelledby":"payment-methods-label"},{default:m(()=>[(n(!0),l(T,null,E(i.filteredPaymentMethods,(x,g)=>(n(),S(u,{value:x.slug,key:x.slug,border:"","aria-label":`${x.title} payment method`},{default:m(()=>[a("img",{src:x.logo,alt:`${x.title} logo`,class:V(x.slug),title:x.title},null,10,Ho),y(" "+o(x.title),1)]),_:2},1032,["value","aria-label"]))),128))]),_:1},8,["modelValue"])]),a("div",qo,o(i.translate("Update your payment method to continue with the subscription.")),1),a("div",zo,[a("div",jo,[t.selectedPaymentMethod=="stripe"?(n(),l("div",Yo,[c(w,{subscription:r.subscription,onClose:i.closeUpdatePaymentModal,onFetchSubscription:i.fetchSubscription,updateMethod:r.updateMethod},null,8,["subscription","onClose","onFetchSubscription","updateMethod"])])):p("",!0),t.selectedPaymentMethod=="paypal"?(n(),l("div",Ko,[c(k,{subscription:r.subscription,onClose:i.closeUpdatePaymentModal,onFetchSubscription:i.fetchSubscription,updateMethod:r.updateMethod},null,8,["subscription","onClose","onFetchSubscription","updateMethod"])])):p("",!0),r.subscription.card_update_url&&!["stripe","paypal"].includes(t.selectedPaymentMethod)?(n(),l("div",Wo,[a("p",null,o(i.translate("You will be redirected to complete the update.")),1),c(d,{type:"primary",onClick:i.openCardUpdateUrl},{default:m(()=>[y(o(i.translate("Continue")),1)]),_:1},8,["onClick"])])):p("",!0)])])])]),_:1},8,["modelValue","title"])])}const Go=L(Bo,[["render",Zo]]),Jo={name:"EarlyInstallmentPayment",props:{subscription:{type:Object,required:!0}},data(){return{showModal:!1,loading:!1}},computed:{totalAmount(){return this.subscription.recurring_amount*this.subscription.remaining_installments}},methods:{proceedToCheckout(){this.loading=!0,this.$post(`customer-profile/subscriptions/${this.subscription.uuid}/initiate-early-payment`).then(e=>{window.location.href=e.checkout_url}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})}}},Qo={class:"fct-early-installment-payment"},Xo={class:"fct-early-payment-content"},el={class:"fct-installment-progress mb-4"},tl={class:"flex justify-between items-center mb-2"},sl={class:"text-sm text-[var(--fct-customer-dashboard-text-color,#565865)]"},al={class:"text-sm font-medium"},rl={class:"fct-installment-summary p-3 rounded",style:{background:"var(--fct-customer-dashboard-surface-light, #f5f7fa)"}},il={class:"flex justify-between items-center mb-2"},nl={class:"text-sm text-[var(--fct-customer-dashboard-text-color,#565865)]"},ol={class:"text-sm font-medium"},ll={class:"flex justify-between items-center mb-2"},dl={class:"text-sm text-[var(--fct-customer-dashboard-text-color,#565865)]"},cl={class:"text-sm"},ul={class:"flex justify-between items-center pt-2",style:{"border-top":"1px solid var(--fct-border-color, #e4e7ed)"}},ml={class:"text-sm font-semibold"},hl={class:"text-base font-semibold"};function _l(e,s,r,h,t,i){const d=_("el-button"),u=_("el-progress"),v=_("el-dialog");return n(),l("div",Qo,[c(d,{type:"primary",onClick:s[0]||(s[0]=w=>t.showModal=!0),"aria-label":e.$t("Pay Remaining Installments")},{default:m(()=>[y(o(e.$t("Pay Remaining Installments")),1)]),_:1},8,["aria-label"]),c(v,{modelValue:t.showModal,"onUpdate:modelValue":s[2]||(s[2]=w=>t.showModal=w),"append-to-body":!0,title:e.$t("Complete Installment Payment"),class:"fct-early-payment-dialog fluent-cart-customer-profile-app",role:"dialog","aria-modal":"true"},{footer:m(()=>[c(d,{onClick:s[1]||(s[1]=w=>t.showModal=!1)},{default:m(()=>[y(o(e.$t("Cancel")),1)]),_:1}),c(d,{type:"primary",loading:t.loading,onClick:i.proceedToCheckout},{default:m(()=>[y(o(e.$t("Proceed to Payment")),1)]),_:1},8,["loading","onClick"])]),default:m(()=>[a("div",Xo,[a("div",el,[a("div",tl,[a("span",sl,o(e.$t("Installment Progress")),1),a("span",al,o(r.subscription.bill_count)+" / "+o(r.subscription.bill_times),1)]),c(u,{percentage:Math.round(r.subscription.bill_count/r.subscription.bill_times*100),"show-text":!1,"stroke-width":8},null,8,["percentage"])]),a("div",rl,[a("div",il,[a("span",nl,o(e.$t("Remaining installments")),1),a("span",ol,o(r.subscription.remaining_installments),1)]),a("div",ll,[a("span",dl,o(e.$t("Per installment")),1),a("span",cl,o(e.formatNumber(r.subscription.recurring_amount,!0,!1,r.subscription.currency)),1)]),a("div",ul,[a("span",ml,o(e.$t("Total to pay now")),1),a("span",hl,o(e.formatNumber(i.totalAmount,!0,!1,r.subscription.currency)),1)])])])]),_:1},8,["modelValue","title"])])}const pl=L(Jo,[["render",_l]]),fl={name:"TransactionPaymentMethod",props:{transaction:{type:Object,required:!0}},computed:{assetUrl(){return this.appVars.assets_path}}},bl={class:"fct-transaction-payment-method",role:"status"},yl={key:0,class:"flex gap-2 items-center"},gl=["src","alt"],vl=["aria-label"],wl=["aria-label"],kl=["src","alt"],xl={key:0,class:"text"},Cl=["aria-label"],Tl={key:2,class:"text text-capitalize","aria-label":"Payment method: {{ transaction.payment_method }}"};function Sl(e,s,r,h,t,i){return n(),l("div",bl,[r.transaction.payment_method==="paypal"?(n(),l("div",yl,[a("img",{src:`${i.assetUrl}images/payment-methods/paypal-icon.svg`,alt:e.$t("PayPal logo"),class:"w-[22px]"},null,8,gl),a("span",{class:"text-[var(--fct-customer-dashboard-hint-text-color,#808B9C)] text-sm","aria-label":e.$t("Transaction ID:")+r.transaction.vendor_charge_id||""},o(r.transaction.vendor_charge_id||""),9,vl)])):r.transaction.card_last_4?(n(),l("div",{key:1,class:"flex gap-2 items-center",role:"img","aria-label":e.$t("Credit card payment method")},[a("img",{src:`${i.assetUrl}images/credit-card/card.svg`,alt:e.$t("Credit Card logo")},null,8,kl),r.transaction.card_brand?(n(),l("span",xl,o(r.transaction.card_brand),1)):p("",!0),a("span",{class:"text","aria-label":e.$t("Credit card ending in")+" "+r.transaction.card_last_4}," **** "+o(r.transaction.card_last_4),9,Cl)],8,wl)):(n(),l("span",Tl,o(r.transaction.payment_method),1))])}const Pl=L(fl,[["render",Sl]]),Al={class:"fct-global-address-component"},Ml={class:"fct-global-address-component-row"},$l={class:"city"},Dl={class:"postcode"},Lt={__name:"AddressComponent",props:qt({use_additional_address_fields:{type:Boolean,required:!1,default:!1},validationErrors:{type:Object,default:()=>({})}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const s=zt(e,"modelValue"),r=N([]),h=()=>{O.get("address-info/countries").then(g=>{r.value=g.data}).catch(g=>{}).finally(()=>{})},t=N({}),i=N(!1),d=N(!0),u=N(!0),v=N(b("Zip Code")),w=N(b("State")),k=g=>{if(s.state="",i.value=!0,!g){i.value=!1;return}if(t.value[g]){x(t.value[g]),i.value=!1;return}O.get("address-info/get-country-info",{country_code:g}).then(P=>{t.value[g]=P,x(P)}).catch(P=>{}).finally(()=>{i.value=!1})},f=N([]),x=g=>{var P,$,D,I,A,R;f.value=(g==null?void 0:g.states)||[],u.value=(($=(P=g==null?void 0:g.address_locale)==null?void 0:P.state)==null?void 0:$.hidden)!==!0,d.value=f.value.length>1,v.value=((I=(D=g==null?void 0:g.address_locale)==null?void 0:D.postcode)==null?void 0:I.label)||b("Zip Code"),w.value=((R=(A=g==null?void 0:g.address_locale)==null?void 0:A.state)==null?void 0:R.label)||b("State")};return fe(()=>s.value.country,(g,P)=>{k(g)}),he(()=>{h(),setTimeout(()=>{s.value.country&&k(s.value.country)},400)}),(g,P)=>(n(),l("div",Al,[c(Le,{class:V(e.validationErrors.hasOwnProperty("country")?"is-error":""),required:"",options:r.value,modelValue:s.value.country,"onUpdate:modelValue":P[0]||(P[0]=$=>s.value.country=$),filterable:"",onOnChange:P[1]||(P[1]=$=>{s.value.state="",k($)}),clearable:!0,label:M(b)("Select Country")},null,8,["class","options","modelValue","label"]),c(ds,{visible:!i.value&&u.value,accordion:"",class:"address_locale"},{default:m(()=>[d.value?(n(),S(Le,{key:0,filterable:"",modelValue:s.value.state,"onUpdate:modelValue":P[2]||(P[2]=$=>s.value.state=$),options:f.value,label:M(b)(w.value),clearable:!0},null,8,["modelValue","options","label"])):(n(),S(W,{key:1,modelValue:s.value.state,"onUpdate:modelValue":P[3]||(P[3]=$=>s.value.state=$),label:M(b)(w.value)},null,8,["modelValue","label"]))]),_:1},8,["visible"]),e.use_additional_address_fields?(n(),l(T,{key:0},[c(W,{modelValue:s.value.address_1,"onUpdate:modelValue":P[4]||(P[4]=$=>s.value.address_1=$),class:V(e.validationErrors.hasOwnProperty("address_1")?"is-error":""),label:M(b)("Street address")},null,8,["modelValue","class","label"]),c(W,{modelValue:s.value.address_2,"onUpdate:modelValue":P[5]||(P[5]=$=>s.value.address_2=$),label:M(b)("Apt, suite, unit")},null,8,["modelValue","label"])],64)):p("",!0),a("div",Ml,[a("div",$l,[c(W,{modelValue:s.value.city,"onUpdate:modelValue":P[6]||(P[6]=$=>s.value.city=$),class:V(e.validationErrors.hasOwnProperty("city")?"is-error":""),label:M(b)("City/Town")},null,8,["modelValue","class","label"])]),a("div",Dl,[c(W,{class:V(e.validationErrors.hasOwnProperty("postcode")?"is-error":""),required:"",modelValue:s.value.postcode,"onUpdate:modelValue":P[7]||(P[7]=$=>s.value.postcode=$),label:M(b)(v.value)},null,8,["class","modelValue","label"])])])]))}},El={name:"TransactionsTable",components:{AddressComponent:Lt,MaterialInput:W,Badge:U,DynamicIcon:F,TransactionPaymentMethod:Pl},props:{transactions:{type:Array,default:()=>[]},showTableHeader:{type:Boolean,default:!0}},data(){return{isEditingBillingAddressModal:!1,validationErrors:{},billingAddressData:{name:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",vat_tax_id:""},formFields:[{key:"name",label:b("Name/Business Name"),required:!0}],selectedTransaction:null,updatingAddress:!1,address_id:null}},methods:{translate:b,dateTimeI18:j,handleTransactionCommand(e,s){if(e==="view_receipt"){window.open(s.receipt_view_url,"_blank","noopener,noreferrer");return}e==="edit_billing_address"&&(this.selectedTransaction=s,this.isEditingBillingAddressModal=!0)},fetchBillingAddress(){this.$get(`customer-profile/orders/${this.selectedTransaction.uuid}/billing-address`).then(e=>{this.billingAddressData=e.data,this.billingAddressData.address_1=e.data.address_1,this.billingAddressData.address_2=e.data.address_2,this.billingAddressData.city=e.data.city,this.billingAddressData.state=e.data.state,this.billingAddressData.postcode=e.data.postcode,this.billingAddressData.country=e.data.country,this.billingAddressData.name=e.data.name,this.billingAddressData.vat_tax_id=e.data.vat_tax_id,this.address_id=e.data.address_id}).catch(e=>{e.message&&this.handleError(e)}).finally(()=>{})},updateBillingAddress(){this.updatingAddress=!0,this.$put(`customer-profile/orders/${this.selectedTransaction.uuid}/billing-address`,{name:this.billingAddressData.name,address_1:this.billingAddressData.address_1,address_2:this.billingAddressData.address_2,city:this.billingAddressData.city,state:this.billingAddressData.state,postcode:this.billingAddressData.postcode,country:this.billingAddressData.country,vat_tax_id:this.billingAddressData.vat_tax_id,transaction_uuid:this.selectedTransaction.uuid,address_id:this.address_id}).then(e=>{this.handleSuccess(e.message),this.isEditingBillingAddressModal=!1,this.$emit("billing-address-updated",e.formatted_address)}).catch(e=>{this.handleError(e),this.validationErrors=e}).finally(()=>{this.updatingAddress=!1})},handleCloseModal(){this.isEditingBillingAddressModal=!1,this.selectedTransaction=null},getStatusText:J}},Ll=["aria-label"],Il=["datetime"],Vl=["innerHTML","aria-label"],Rl={class:"flex items-center gap-2 justify-between"},Bl=["href","aria-label"],Fl=["href","aria-label"],Nl=["aria-label"],Ul={class:"fct-customer-dashboard-add-address-form-wrap"},Ol={class:"fct-compact-form"},Hl={class:"dialog-footer"};function ql(e,s,r,h,t,i){const d=_("el-table-column"),u=_("Badge"),v=_("TransactionPaymentMethod"),w=_("DynamicIcon"),k=_("el-dropdown-item"),f=_("el-dropdown-menu"),x=_("el-dropdown"),g=_("el-table"),P=_("MaterialInput"),$=_("AddressComponent"),D=_("el-button"),I=_("el-dialog");return n(),l("div",null,[c(g,{data:r.transactions,"aria-label":e.$t("Transactions Table")},{default:m(()=>[c(d,{label:"#",width:150},{default:m(A=>[a("span",{class:"text truncate","aria-label":e.$t("Invoice Number")+" "+A.row.invoice_no},"#"+o(A.row.invoice_no),9,Ll)]),_:1}),c(d,{label:e.$t("Date"),width:120},{default:m(A=>[a("time",{class:"text truncate",datetime:A.row.created_at},o(i.dateTimeI18(A.row.created_at,"date")),9,Il)]),_:1},8,["label"]),c(d,{label:e.$t("Amount"),width:"90"},{default:m(A=>[a("span",{class:"text",innerHTML:e.formatNumber(A.row.total,!0,!1,A.row.currency),"aria-label":e.$t("Amount")},null,8,Vl)]),_:1},8,["label"]),c(d,{label:e.$t("Status"),width:110},{default:m(A=>[c(u,{type:A.row.status,size:"small","aria-label":e.$t("Status")+": "+A.row.status},{default:m(()=>[y(o(i.getStatusText(A.row.status)),1)]),_:2},1032,["type","aria-label"])]),_:1},8,["label"]),c(d,{label:e.$t("Type"),width:100},{default:m(A=>[c(u,{type:A.row.order_type,size:"small","aria-label":e.$t("Order Type")+": "+A.row.order_type},{default:m(()=>[y(o(i.getStatusText(A.row.order_type)),1)]),_:2},1032,["type","aria-label"])]),_:1},8,["label"]),c(d,{label:e.$t("Payment Method"),"min-width":160},{default:m(A=>[c(v,{transaction:A.row},null,8,["transaction"])]),_:1},8,["label"]),c(d,{width:135},{default:m(A=>[a("div",Rl,[A.row.show_pay_now?(n(),l("a",{key:0,href:A.row.custom_checkout_url,target:"_blank",rel:"noopener noreferrer",class:"underline-link-button","aria-label":e.$t("Pay Now for Invoice")+" "+A.row.invoice_no},[c(w,{name:"CreditCard",class:"w-4 h-4","aria-hidden":"true"}),y(" "+o(e.$t("Pay Now")),1)],8,Bl)):(n(),l("a",{key:1,href:A.row.receipt_download_url,target:"_blank",class:"underline-link-button","aria-label":e.$t("Download Receipt for Invoice")+" "+A.row.invoice_no,rel:"noopener noreferrer"},[c(w,{name:"Download","aria-hidden":"true"}),y(" "+o(e.$t("Receipt")),1)],8,Fl)),c(x,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:R=>i.handleTransactionCommand(R,A.row),"aria-label":e.$t("More Actions")},{dropdown:m(()=>[c(f,null,{default:m(()=>[A.row.receipt_view_url?(n(),S(k,{key:0,command:"view_receipt"},{default:m(()=>[y(o(i.translate("View Receipt")),1)]),_:1})):p("",!0),c(k,{command:"edit_billing_address"},{default:m(()=>[y(o(i.translate("Edit Billing Address")),1)]),_:1})]),_:2},1024)]),default:m(()=>[a("span",{class:"more-btn w-4 h-4 flex items-center justify-center cursor-pointer","aria-haspopup":"true","aria-label":e.$t("More Actions")},[c(w,{name:"More",class:"w-1","aria-hidden":"true"})],8,Nl)]),_:2},1032,["onCommand","aria-label"])])]),_:1})]),_:1},8,["data","aria-label"]),c(I,{modelValue:t.isEditingBillingAddressModal,"onUpdate:modelValue":s[2]||(s[2]=A=>t.isEditingBillingAddressModal=A),title:i.translate("Edit Billing Address"),"append-to-body":!0,"modal-class":"fct-transaction-billing-address-modal",onOpen:i.fetchBillingAddress,class:"fluent-cart-customer-profile-app fct-customer-root-container","aria-modal":"true",role:"dialog"},{footer:m(()=>[a("div",Hl,[c(D,{type:"info",soft:"",onClick:i.handleCloseModal},{default:m(()=>[y(o(i.translate("Cancel")),1)]),_:1},8,["onClick"]),c(D,{type:"primary",loading:t.updatingAddress,onClick:i.updateBillingAddress},{default:m(()=>[y(o(i.translate("Update Address")),1)]),_:1},8,["loading","onClick"])])]),default:m(()=>[a("div",Ul,[a("div",Ol,[(n(!0),l(T,null,E(t.formFields,(A,R)=>(n(),S(P,{key:R,required:A.required,label:A.label,modelValue:t.billingAddressData[A.key],"onUpdate:modelValue":q=>t.billingAddressData[A.key]=q,class:V(t.validationErrors[A.key]?"is-error":"")},null,8,["required","label","modelValue","onUpdate:modelValue","class"]))),128)),c($,{use_additional_address_fields:"",modelValue:t.billingAddressData,"onUpdate:modelValue":s[0]||(s[0]=A=>t.billingAddressData=A),validationErrors:t.validationErrors},null,8,["modelValue","validationErrors"]),c(P,{label:i.translate("Vat Tax ID"),modelValue:t.billingAddressData.vat_tax_id,"onUpdate:modelValue":s[1]||(s[1]=A=>t.billingAddressData.vat_tax_id=A),class:V(t.validationErrors.vat_tax_id?"is-error":"")},null,8,["label","modelValue","class"])])])]),_:1},8,["modelValue","title","onOpen"])])}const It=L(El,[["render",ql]]),zl={name:"SingleSubscription",components:{TransactionsTable:It,IconButton:xe,UpdatePaymentInfos:Go,UpgradePlan:Te,EarlyInstallmentPayment:pl,DynamicIcon:F,Badge:U,LicenseTable:Ce},props:{subscription_uuid:String},data(){return{subscription:null,loading:!0,cancelling:!1,pausing:!1,resuming:!1,sectionParts:{}}},computed:{isCancelable(){var e,s;return!(((e=this.subscription)==null?void 0:e.bill_times)>1||((s=this.subscription)==null?void 0:s.status)==="canceled")},canMakeEarlyPayment(){const e=this.subscription;return e&&e.can_early_pay&&e.remaining_installments>0},hasSubscriptionActions(){var e,s;return this.isCancelable||((e=this.subscription)==null?void 0:e.can_pause)||((s=this.subscription)==null?void 0:s.can_resume)},ArrowRight(){return St},visibleTransactions(){var e;return(((e=this.subscription)==null?void 0:e.transactions)||[]).filter(s=>!(s.order_type==="renewal"&&Number(s.total)===0))}},mounted(){this.fetchSubscription()},methods:{dateTimeI18:j,fetchSubscription(){this.loading=!0,this.$get(`customer-profile/subscriptions/${this.subscription_uuid}`).then(e=>{this.subscription=e.subscription,e.section_parts&&(this.sectionParts=e.section_parts)}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1})},pluralizeTranslate:_e,cancelSubscription(){this.cancelling=!0,this.$post(`customer-profile/subscriptions/${this.subscription.uuid}/cancel-auto-renew`,{method:this.subscription.current_payment_method}).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.handleError(e)}).finally(()=>{var e;this.cancelling=!1,(e=this.$refs.popoverRef)==null||e.hide(),this.fetchSubscription()})},pauseSubscription(){this.pausing=!0,this.$post(`customer-profile/subscriptions/${this.subscription.uuid}/pause`).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.handleError(e)}).finally(()=>{var e;this.pausing=!1,(e=this.$refs.pausePopoverRef)==null||e.hide(),this.fetchSubscription()})},resumeSubscription(){this.resuming=!0,this.$post(`customer-profile/subscriptions/${this.subscription.uuid}/resume`).then(e=>{this.$notify.success(e.message)}).catch(e=>{this.handleError(e)}).finally(()=>{var e;this.resuming=!1,(e=this.$refs.resumePopoverRef)==null||e.hide(),this.fetchSubscription()})},subscriptionStatus(){var e,s,r;return(e=this.subscription)!=null&&e.overridden_status?(s=this.subscription)==null?void 0:s.overridden_status:(r=this.subscription)==null?void 0:r.status},getStatusText:J}},jl={class:"fct-customer-dashboard-single-subcription-wrap fct-customer-dashboard-layout-width",role:"main","aria-labelledby":"subscription-overview-title"},Yl={class:"fct-customer-dashboard-single-subscription"},Kl={class:"fct-customer-dashboard-breadcrumb mb-8"},Wl={key:0,class:"fct-renew-box mb-4"},Zl={class:"text-center p-4"},Gl={class:"p-0 m-0 mb-3"},Jl=["href","aria-label"],Ql={class:"p-0 m-0 mb-3"},Xl=["href","aria-label"],ed={class:"fct-single-order-box mb-11 lg:mb-6",role:"region","aria-labelledby":"subscription-details-title"},td={class:"fct-single-order-header"},sd={id:"subscription-details-title",class:"title"},ad={class:"fct-single-order-body"},rd={class:"fct-single-order-box-inner"},id={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},nd={class:"left-content"},od={class:"fct-product-info-card"},ld={class:"fct-product-info-card-inner"},dd={class:"product-info-content"},cd={class:"title truncate-none"},ud={class:"variation-title"},md={class:"right-content !w-auto"},hd={id:"pause-popover-title",class:"sr-only"},_d={class:"flex justify-end gap-2"},pd=["aria-label"],fd={id:"resume-popover-title",class:"sr-only"},bd={class:"flex justify-end gap-2"},yd=["aria-label"],gd={id:"cancel-popover-title",class:"sr-only"},vd={class:"flex justify-end gap-2"},wd=["aria-label"],kd={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},xd={class:"left-content"},Cd={class:"title"},Td=["aria-label","innerHTML"],Sd={key:0,class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Pd={class:"left-content"},Ad={class:"title"},Md=["aria-label"],$d={key:1,class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Dd={class:"left-content"},Ed={class:"title"},Ld=["aria-label"],Id={class:"fct-customer-dashboard-content-table-item border-0 pb-0"},Vd={class:"left-content"},Rd={class:"title"},Bd=["aria-label"],Fd=["aria-label"],Nd={key:1},Ud={key:0,class:"text",role:"status"},Od={key:1,class:"text text-red-600",role:"alert"},Hd={class:"fct-single-order-footer mt-3"},qd={class:"flex items-center gap-3"},zd=["href","aria-label"],jd={key:1,class:"text"},Yd=["innerHTML"],Kd={key:2,class:"fct-single-order-box",role:"region","aria-labelledby":"licenses-title"},Wd={class:"fct-single-order-header"},Zd={id:"licenses-title",class:"title"},Gd={key:3,class:"fct-single-order-box",role:"region","aria-labelledby":"transactions-title"},Jd={class:"fct-single-order-header"},Qd={id:"transactions-title",class:"title"},Xd={class:"fct-customer-dashboard-table"},ec={key:1,"aria-live":"polite"};function tc(e,s,r,h,t,i){var se,C,X,ie;const d=_("el-breadcrumb-item"),u=_("el-breadcrumb"),v=_("el-alert"),w=_("Badge"),k=_("DynamicIcon"),f=_("IconButton"),x=_("el-button"),g=_("el-popover"),P=_("el-dropdown-item"),$=_("el-dropdown-menu"),D=_("el-dropdown"),I=_("UpgradePlan"),A=_("EarlyInstallmentPayment"),R=_("UpdatePaymentInfos"),q=_("router-link"),te=_("LicenseTable"),Q=_("TransactionsTable"),be=_("el-skeleton");return n(),l("div",jl,[a("div",Yl,[a("div",Kl,[c(u,{"separator-icon":i.ArrowRight,role:"navigation","aria-label":e.$t("Breadcrumb")},{default:m(()=>[c(d,{class:"cursor-pointer",to:{path:"/subscriptions"}},{default:m(()=>[y(o(e.$t("Subscription Plans")),1)]),_:1}),c(d,{"aria-current":"page"},{default:m(()=>[y(o(e.$t("Overview")),1)]),_:1})]),_:1},8,["separator-icon","aria-label"])]),t.subscription?(n(),l(T,{key:0},[t.subscription.reactivate_url?(n(),l("div",Wl,[c(v,{type:"error",closable:!1,role:"alert"},{default:m(()=>[a("div",Zl,[t.subscription.status==="expired"?(n(),l(T,{key:0},[a("p",Gl,o(e.$t("Your subscription has expired at %s. Please renew to keep things running smoothly.",i.dateTimeI18(t.subscription.expire_at))),1),a("a",{href:t.subscription.reactivate_url,class:"el-button el-button--primary","aria-label":e.$t("Renew Subscription Plan")},o(e.$t("Renew Subscription Plan")),9,Jl)],64)):(n(),l(T,{key:1},[a("p",Ql,o(e.$t("Your subscription status is now: %s. Please reactivate to keep things running smoothly.",i.getStatusText(t.subscription.status))),1),a("a",{href:t.subscription.reactivate_url,class:"el-button el-button--primary","aria-label":e.$t("Reactivate Subscription Plan")},o(e.$t("Reactivate Subscription Plan")),9,Xl)],64))])]),_:1})])):p("",!0),a("article",ed,[a("header",td,[a("h1",sd,o(e.$t("Subscription Plan Details")),1)]),a("div",ad,[a("div",rd,[a("div",id,[a("div",nd,[a("div",od,[a("div",ld,[a("div",dd,[a("div",cd,[y(o(t.subscription.title)+" ",1),c(w,{status:i.subscriptionStatus(),size:"small"},null,8,["status"])]),a("div",ud,o(t.subscription.subtitle),1)])])])]),a("div",md,[i.hasSubscriptionActions?(n(),S(D,{key:0,trigger:"click","hide-on-click":!1,"popper-class":"fct-dropdown",role:"menu","aria-haspopup":"true","aria-expanded":"false"},{dropdown:m(()=>[c($,{role:"menu"},{default:m(()=>[t.subscription.can_pause?(n(),S(P,{key:0,role:"menuitem"},{default:m(()=>[c(g,{"popper-class":"fluent-cart-customer-profile-app",trigger:"click",placement:"bottom",width:260,ref:"pausePopoverRef",role:"dialog","aria-modal":"true","aria-labelledby":"pause-popover-title"},{reference:m(()=>[a("span",{"aria-label":e.$t("Pause Subscription")},o(e.$t("Pause Subscription")),9,pd)]),default:m(()=>[a("h3",hd,o(e.$t("Pause Subscription")),1),a("div",null,o(e.$t("Pause your subscription? You can resume it anytime.")),1),a("div",_d,[c(x,{class:"el-button--x-small",text:"",onClick:s[0]||(s[0]=H=>e.$refs.pausePopoverRef.hide()),"aria-label":e.$t("Cancel")},{default:m(()=>[y(o(e.$t("Cancel")),1)]),_:1},8,["aria-label"]),c(x,{class:"el-button--x-small",type:"primary",loading:t.pausing,onClick:i.pauseSubscription,"aria-label":e.$t("Pause")},{default:m(()=>[y(o(e.$t("Pause")),1)]),_:1},8,["loading","onClick","aria-label"])])]),_:1},512)]),_:1})):p("",!0),t.subscription.can_resume?(n(),S(P,{key:1,role:"menuitem"},{default:m(()=>[c(g,{"popper-class":"fluent-cart-customer-profile-app",trigger:"click",placement:"bottom",width:260,ref:"resumePopoverRef",role:"dialog","aria-modal":"true","aria-labelledby":"resume-popover-title"},{reference:m(()=>[a("span",{"aria-label":e.$t("Resume Subscription")},o(e.$t("Resume Subscription")),9,yd)]),default:m(()=>[a("h3",fd,o(e.$t("Resume Subscription")),1),a("div",null,o(e.$t("Resume your subscription to continue service.")),1),a("div",bd,[c(x,{class:"el-button--x-small",text:"",onClick:s[1]||(s[1]=H=>e.$refs.resumePopoverRef.hide()),"aria-label":e.$t("Cancel")},{default:m(()=>[y(o(e.$t("Cancel")),1)]),_:1},8,["aria-label"]),c(x,{class:"el-button--x-small",type:"primary",loading:t.resuming,onClick:i.resumeSubscription,"aria-label":e.$t("Resume")},{default:m(()=>[y(o(e.$t("Resume")),1)]),_:1},8,["loading","onClick","aria-label"])])]),_:1},512)]),_:1})):p("",!0),i.isCancelable?(n(),S(P,{key:2,role:"menuitem"},{default:m(()=>[c(g,{"popper-class":"fluent-cart-customer-profile-app",trigger:"click",placement:"bottom",width:260,ref:"popoverRef",role:"dialog","aria-modal":"true","aria-labelledby":"cancel-popover-title"},{reference:m(()=>[a("span",{"aria-label":e.$t("Cancel Subscription")},o(e.$t("Cancel Subscription")),9,wd)]),default:m(()=>[a("h3",gd,o(e.$t("Cancel Subscription")),1),a("div",null,o(e.$t("Confirm cancellation? Your access stays active until current billing cycle ends.")),1),a("div",vd,[c(x,{class:"el-button--x-small",text:"",onClick:s[2]||(s[2]=H=>e.$refs.popoverRef.hide()),"aria-label":e.$t("Cancel")},{default:m(()=>[y(o(e.$t("Cancel")),1)]),_:1},8,["aria-label"]),c(x,{class:"el-button--x-small",type:"primary",loading:t.cancelling,onClick:i.cancelSubscription,"aria-label":e.$t("Yes, Proceed")},{default:m(()=>[y(o(e.$t("Yes, Proceed")),1)]),_:1},8,["loading","onClick","aria-label"])])]),_:1},512)]),_:1})):p("",!0)]),_:1})]),default:m(()=>[c(f,{tag:"button",size:"x-small",class:"simple-icon-btn","aria-label":e.$t("Subscription options")},{default:m(()=>[c(k,{name:"More",class:"w-[5px]","aria-hidden":"true"})]),_:1},8,["aria-label"])]),_:1})):p("",!0)])]),a("div",kd,[a("div",xd,[a("div",Cd,o(e.$t("Billing Terms")),1),a("span",{class:"text","aria-label":e.$t("Billing Terms"),innerHTML:t.subscription.payment_info},null,8,Td)])]),t.subscription.bill_times>0?(n(),l("div",Sd,[a("div",Pd,[a("div",Ad,o(e.$t("Installment Progress")),1),a("span",{class:"text","aria-label":e.$t("Installment Progress")},o(e.$t("%s of %s paid",t.subscription.bill_count,t.subscription.bill_times))+" ("+o(e.$t("%s remaining",t.subscription.remaining_installments))+") ",9,Md)])])):p("",!0),t.subscription.status=="active"||t.subscription.status=="trialing"?(n(),l("div",$d,[a("div",Dd,[a("div",Ed,o(e.$t("Next Charge")),1),a("span",{class:"text","aria-label":e.$t("Next Charge")},o(i.dateTimeI18(t.subscription.next_billing_date)),9,Ld)])])):p("",!0),a("div",Id,[a("div",Vd,[a("div",Rd,o(e.$t("Payment Method")),1),a("span",{class:"text","aria-label":e.$t("Payment Method")},[(se=t.subscription.billing_info.details)!=null&&se.last_4?(n(),l("span",{key:0,"aria-label":e.$t("Credit Card ending in")+" "+((C=t.subscription.billing_info.details)==null?void 0:C.last_4)}," **** "+o((X=t.subscription.billing_info.details)==null?void 0:X.last_4),9,Fd)):(n(),l("span",Nd,o(t.subscription.current_payment_method),1))],8,Bd),t.subscription.is_auto_charged?(n(),l("span",Ud,o(e.$t("Charged automatically on each renewal date.")),1)):p("",!0),t.subscription.auto_charge_error?(n(),l("span",Od,o(e.$t("We couldn't charge this payment method: %1$s Please update it or pay the open renewal below.",t.subscription.auto_charge_error)),1)):p("",!0)])])])]),a("footer",Hd,[a("div",qd,[(ie=t.subscription)!=null&&ie.can_upgrade?(n(),S(I,{key:0,"button-type":"primary","button-text":e.$t("Upgrade Plan"),variation_id:t.subscription.variation_id,order_hash:t.subscription.order.uuid},null,8,["button-text","variation_id","order_hash"])):p("",!0),i.canMakeEarlyPayment?(n(),S(A,{key:1,subscription:t.subscription},null,8,["subscription"])):p("",!0),t.subscription.can_update_payment_method?(n(),S(R,{key:2,subscription:t.subscription,buttonText:e.$t("Update Payment Method"),onFetch:i.fetchSubscription,updateMethod:!0},null,8,["subscription","buttonText","onFetch"])):p("",!0),c(q,{class:"underline-link-button",to:{name:"view_order",params:{order_id:t.subscription.order.uuid}},"aria-label":e.$t("View Order")},{default:m(()=>[y(o(e.$t("View Order")),1)]),_:1},8,["to","aria-label"]),(n(!0),l(T,null,E(t.subscription.custom_actions||[],H=>(n(),l(T,{key:H.key},[H.url?(n(),l("a",{key:0,class:"underline-link-button",href:H.url,"aria-label":H.label},o(H.label),9,zd)):(n(),l("span",jd,o(H.label),1))],64))),128))])])]),t.sectionParts.end_of_subscription?(n(),l("div",{key:1,innerHTML:t.sectionParts.end_of_subscription,class:"mb-3"},null,8,Yd)):p("",!0),t.subscription.licenses&&t.subscription.licenses.length?(n(),l("article",Kd,[a("header",Wd,[a("h2",Zd,o(i.pluralizeTranslate("Connected License","Connected Licenses",t.subscription.licenses.length)),1)]),c(te,{is_simple:!0,licenses:t.subscription.licenses,showTableHeader:!1},null,8,["licenses"])])):p("",!0),i.visibleTransactions.length?(n(),l("article",Gd,[a("header",Jd,[a("h2",Qd,o(e.$t("Related Transactions")),1)]),a("div",Xd,[c(Q,{transactions:i.visibleTransactions,"show-table-header":!0},null,8,["transactions"])])])):p("",!0)],64)):t.loading?(n(),l("div",ec,[c(be,{rows:5,animated:!0})])):p("",!0)])])}const sc=L(zl,[["render",tc]]),ac={class:"fct-purchase-history-route-wrap"},rc=Object.assign({name:"PurchaseHistoryRoute"},{__name:"PurchaseHistoryRoute",setup(e){return(s,r)=>{const h=_("router-view");return n(),l("div",ac,[c(h)])}}}),ic={name:"AccountDetails.vue",components:{MaterialInput:W},props:["profileDetails"],data(){return{accountDetailsDescId:"account-details-desc"}},methods:{translate:b}},nc={class:"fct-form-container",role:"region","aria-labelledby":"account-details-heading"},oc={class:"form-left"},lc={id:"account-details-heading",class:"form-heading"},dc=["id"],cc={class:"form-right"},uc={class:"sr-only"},mc={class:"fct-compact-form",id:"account-details"};function hc(e,s,r,h,t,i){const d=_("MaterialInput");return n(),l("div",nc,[a("div",oc,[a("h3",lc,o(i.translate("Account Details")),1),a("p",{id:t.accountDetailsDescId,class:"form-desc"},o(i.translate("Manage and update your personal information.")),9,dc)]),a("div",cc,[a("span",uc,o(i.translate("Account Details")),1),a("div",mc,[c(d,{"aria-describedby":t.accountDetailsDescId,label:i.translate("First Name"),modelValue:r.profileDetails.first_name,"onUpdate:modelValue":s[0]||(s[0]=u=>r.profileDetails.first_name=u)},null,8,["aria-describedby","label","modelValue"]),c(d,{"aria-describedby":t.accountDetailsDescId,label:i.translate("Last Name"),modelValue:r.profileDetails.last_name,"onUpdate:modelValue":s[1]||(s[1]=u=>r.profileDetails.last_name=u)},null,8,["aria-describedby","label","modelValue"]),c(d,{"aria-describedby":t.accountDetailsDescId,label:i.translate("Email"),disabled:"",modelValue:r.profileDetails.email,"onUpdate:modelValue":s[2]||(s[2]=u=>r.profileDetails.email=u)},null,8,["aria-describedby","label","modelValue"])])])])}const _c=L(ic,[["render",hc]]),pc={name:"AddressModal",components:{DynamicIcon:F,AddressComponent:Lt,MaterialInput:W},props:["modalAction","newAddressData","showModal","profileDetails","isEditAddress"],emits:["fetch"],data(){return{addressModalTitleId:"address-modal-title",validationErrors:{},addAddressLoading:!1,addNewAddressModalVisible:!1,localIsEditAddress:!1,localAddressData:{label:"",name:"",email:"",company_name:"",vat_number:"",legal_registration_id:"",phone:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},formRules:{name:[b("Name is required.")],email:[b("Email is required.")],country:[b("Country is required.")],postcode:[b("Postcode is required.")]},formFields:[{key:"label",label:b("Address label e.g Home, Office"),required:!1},{key:"name",label:b("Name"),required:!0},{key:"email",label:b("Email"),required:!0},{key:"company_name",label:b("Company Name"),required:!1},{key:"vat_number",label:b("VAT/GST/Tax Number"),required:!1},{key:"legal_registration_id",label:b("Legal Registration ID"),required:!1},{key:"phone",label:b("Phone"),required:!1}]}},computed:{profileVars(){return window.fluentcart_customer_profile_vars||{}},normalizedFormFields(){return this.formFields.filter(e=>{var s,r,h;return e.key==="company_name"?this.modalAction==="billing"&&((s=this.profileVars)==null?void 0:s.is_company_name_enabled):e.key==="vat_number"?this.modalAction==="billing"&&((r=this.profileVars)==null?void 0:r.is_vat_number_enabled):e.key==="legal_registration_id"?this.modalAction==="billing"&&((h=this.profileVars)==null?void 0:h.is_legal_registration_id_enabled):!0}).map(e=>{var r,h,t;const s={...e};return e.key==="company_name"&&(s.required=!!((r=this.profileVars)!=null&&r.is_company_name_required)),e.key==="vat_number"&&(s.required=!!((h=this.profileVars)!=null&&h.is_vat_number_required)),e.key==="legal_registration_id"&&(s.required=!!((t=this.profileVars)!=null&&t.is_legal_registration_id_required)),s})},primaryFormFields(){return this.normalizedFormFields.filter(e=>!["company_name","vat_number","legal_registration_id"].includes(e.key))},businessDetailFields(){return this.normalizedFormFields.filter(e=>["company_name","vat_number","legal_registration_id"].includes(e.key))},shouldShowBusinessDetailsSection(){return this.businessDetailFields.length>0}},watch:{showModal(){this.addNewAddressModalVisible=this.showModal},newAddressData:{handler(e){e&&this.isEditAddress&&(this.localAddressData={...e})},deep:!0,immediate:!0},isEditAddress:{handler(e){e||this.resetFormDataAndValidation()},immediate:!0}},methods:{translate:b,validateForm(){var r,h,t,i,d,u;const e={},s={...this.formRules};return this.modalAction==="billing"&&((r=this.profileVars)!=null&&r.is_company_name_enabled)&&((h=this.profileVars)!=null&&h.is_company_name_required)&&(s.company_name=[b("Company Name is required.")]),this.modalAction==="billing"&&((t=this.profileVars)!=null&&t.is_vat_number_enabled)&&((i=this.profileVars)!=null&&i.is_vat_number_required)&&(s.vat_number=[b("VAT/GST/Tax Number is required.")]),this.modalAction==="billing"&&((d=this.profileVars)!=null&&d.is_legal_registration_id_enabled)&&((u=this.profileVars)!=null&&u.is_legal_registration_id_required)&&(s.legal_registration_id=[b("Legal Registration ID is required.")]),Object.keys(s).forEach(v=>{(!this.localAddressData[v]||this.localAddressData[v].trim()==="")&&(e[v]={required:s[v][0]})}),this.validationErrors=e,Object.keys(e).length===0},addAddress(){if(this.validateForm()){this.addAddressLoading=!0;let e={type:this.modalAction,customer_id:this.profileDetails.id},s={...this.localAddressData,...e};this.$post("customer-profile/create-address",{type:s.type,label:s.label,name:s.name,phone:s.phone,email:s.email,country:s.country,state:s.state,address_1:s.address_1,address_2:s.address_2,city:s.city,postcode:s.postcode,company_name:s.company_name,vat_number:s.vat_number,legal_registration_id:s.legal_registration_id}).then(r=>{B.success(r),this.closeModal(),this.addAddressLoading=!1,this.resetFormDataAndValidation(),this.$emit("fetch")}).catch(r=>{r.status_code=="422"?B.validationErrors(r):B.error(r==null?void 0:r.data),this.validationErrors=r==null?void 0:r.data}).finally(()=>{this.addAddressLoading=!1})}else B.error(b("Please fill in all the required fields."))},editAddress(){if(this.validateForm()){this.addAddressLoading=!0;let e={...this.localAddressData};this.$post("customer-profile/edit-address",{id:e.id,label:e.label,name:e.name,phone:e.phone,email:e.email,country:e.country,state:e.state,address_1:e.address_1,address_2:e.address_2,city:e.city,postcode:e.postcode,type:e.type,company_name:e.company_name,vat_number:e.vat_number,legal_registration_id:e.legal_registration_id}).then(s=>{B.success(s),this.closeModal(),this.addAddressLoading=!1,this.resetFormDataAndValidation(),this.$emit("fetch")}).catch(s=>{B.error(s)}).finally(()=>{this.addAddressLoading=!1})}else B.error(b("Please fill in all the required fields."))},openModal(){this.addNewAddressModalVisible=!0},closeModal(){this.addNewAddressModalVisible=!1},getModalTitle(){return this.localIsEditAddress?b("Edit address"):this.modalAction==="billing"?b("Add new billing address"):this.modalAction==="shipping"?b("Add new shipping address"):b("Add new address")},handleAddNewAddressModal(e,s=null){e==="edit"&&s?(this.localAddressData={...s},this.localIsEditAddress=!0):(this.resetFormDataAndValidation(),this.localIsEditAddress=!1),this.addNewAddressModalVisible=!0},resetFormDataAndValidation(){Object.keys(this.localAddressData).forEach(e=>{this.localAddressData[e]=""}),this.validationErrors={}}}},fc={class:"fct-customer-dashboard-add-address-form-wrap"},bc=["id"],yc={class:"fct-compact-form"},gc={key:0,class:"fct-customer-address-business-details"},vc={class:"fct-customer-address-business-details-title"},wc={id:"addressFormDescId",class:"sr-only"},kc={key:0,class:"form-error-wrap",role:"alert","aria-live":"assertive","aria-atomic":"true"},xc={class:"dialog-footer"};function Cc(e,s,r,h,t,i){const d=_("el-button"),u=_("MaterialInput"),v=_("AddressComponent"),w=_("el-dialog");return n(),l(T,null,[c(d,{size:"small",onClick:s[0]||(s[0]=k=>i.handleAddNewAddressModal()),"aria-label":i.translate("Add New Address"),"aria-haspopup":"dialog"},{default:m(()=>[y(o(i.translate("Add New Address")),1)]),_:1},8,["aria-label"]),c(w,{modelValue:t.addNewAddressModalVisible,"onUpdate:modelValue":s[3]||(s[3]=k=>t.addNewAddressModalVisible=k),"append-to-body":!0,title:i.getModalTitle(),onClosed:i.resetFormDataAndValidation,class:"fluent-cart-customer-profile-app fct-customer-root-container",role:"dialog","aria-modal":"true","aria-labelledby":t.addressModalTitleId,"aria-describedby":e.addressFormDescId,tabindex:"-1"},{footer:m(()=>[a("div",xc,[c(d,{type:"info",soft:"",onClick:s[2]||(s[2]=k=>t.addNewAddressModalVisible=!1),"aria-label":i.translate("Cancel")},{default:m(()=>[y(o(i.translate("Cancel")),1)]),_:1},8,["aria-label"]),t.localIsEditAddress?(n(),S(d,{key:0,type:"primary",loading:t.addAddressLoading,onClick:i.editAddress,"aria-label":i.translate("Update Address")},{default:m(()=>[y(o(i.translate("Update Address")),1)]),_:1},8,["loading","onClick","aria-label"])):(n(),S(d,{key:1,type:"primary",loading:t.addAddressLoading,onClick:i.addAddress,"aria-label":i.translate("Add Address")},{default:m(()=>[y(o(i.translate("Add Address")),1)]),_:1},8,["loading","onClick","aria-label"]))])]),default:m(()=>[a("div",fc,[a("h2",{id:t.addressModalTitleId,class:"sr-only"},o(i.getModalTitle()),9,bc),a("form",yc,[(n(!0),l(T,null,E(i.primaryFormFields,(k,f)=>(n(),S(u,{key:f,required:k.required,label:k.label,modelValue:t.localAddressData[k.key],"onUpdate:modelValue":x=>t.localAddressData[k.key]=x,class:V(t.validationErrors[k.key]?"is-error":""),"aria-invalid":!!t.validationErrors[k.key],"aria-describedby":t.validationErrors[k.key]?`${k.key}-error`:null},null,8,["required","label","modelValue","onUpdate:modelValue","class","aria-invalid","aria-describedby"]))),128)),c(v,{use_additional_address_fields:"",modelValue:t.localAddressData,"onUpdate:modelValue":s[1]||(s[1]=k=>t.localAddressData=k),validationErrors:t.validationErrors},null,8,["modelValue","validationErrors"]),i.shouldShowBusinessDetailsSection?(n(),l("div",gc,[a("h3",vc,o(i.translate("Business Details")),1),(n(!0),l(T,null,E(i.businessDetailFields,(k,f)=>(n(),S(u,{key:`business-${f}`,required:k.required,label:k.label,modelValue:t.localAddressData[k.key],"onUpdate:modelValue":x=>t.localAddressData[k.key]=x,class:V(t.validationErrors[k.key]?"is-error":""),"aria-invalid":!!t.validationErrors[k.key],"aria-describedby":t.validationErrors[k.key]?`${k.key}-error`:null},null,8,["required","label","modelValue","onUpdate:modelValue","class","aria-invalid","aria-describedby"]))),128))])):p("",!0)]),a("div",wc,o(i.translate("Form to add or edit address. Required fields are marked with an asterisk.")),1),Object.keys(t.validationErrors).length?(n(),l("div",kc,[(n(!0),l(T,null,E(t.validationErrors,k=>(n(),l("p",null,o(k.required||k.email||k.max),1))),256))])):p("",!0)])]),_:1},8,["modelValue","title","onClosed","aria-labelledby","aria-describedby"])],64)}const Tc=L(pc,[["render",Cc]]),Sc={name:"AddressSection",components:{DynamicIcon:F,Badge:U,AddressModal:Tc},props:{profileDetails:Object,addressType:String,title:String,description:String},emits:["fetch","setAddressPrimary","deleteAddress"],data(){return{addressSectionTitleId:`address-section-title-${this.addressType}`,isEditAddress:!1,newAddressData:{label:"",name:"",email:"",phone:"",company_name:"",vat_number:"",legal_registration_id:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""}}},computed:{addresses(){return this.profileDetails[`${this.addressType}_address`]||[]},sortedAddresses(){return this.addresses.sort((e,s)=>s.is_primary-e.is_primary)}},methods:{translate:b,handleAddressCommand(e){const{action:s,data:r}=e;s==="edit"?(this.isEditAddress=!0,this.newAddressData={...r},this.$refs.modalRef.handleAddNewAddressModal("edit",r)):s==="default"?this.$emit("setAddressPrimary",r):s==="remove"&&de.confirm(b("Are you sure you want to delete this address?"),b("Warning"),{customClass:"fluent-cart-customer-profile-app",confirmButtonText:b("Yes, Delete!"),cancelButtonText:b("Cancel"),cancelButtonClass:"el-button--small",confirmButtonClass:"el-button--small",type:"warning"}).then(()=>{this.$emit("deleteAddress",r)}).catch(()=>{})}}},Pc=["aria-labelledby"],Ac={class:"form-left"},Mc=["id"],$c={class:"form-desc"},Dc={class:"form-right"},Ec=["aria-label"],Lc={key:0,class:"title"},Ic={class:"text"},Vc={class:"fct-address-action"},Rc=["aria-label"],Bc={key:1,class:"text-sm text-[var(--fct-customer-dashboard-text-color,#565865)]",role:"status","aria-live":"polite"};function Fc(e,s,r,h,t,i){const d=_("AddressModal"),u=_("Badge"),v=_("DynamicIcon"),w=_("el-dropdown-item"),k=_("el-dropdown-menu"),f=_("el-dropdown");return n(),l("div",{class:"fct-form-container",role:"region","aria-labelledby":t.addressSectionTitleId},[a("div",Ac,[a("h3",{id:t.addressSectionTitleId,class:"form-heading"},o(r.title),9,Mc),a("p",$c,o(r.description),1),c(d,{ref:"modalRef",modalAction:r.addressType,onFetch:s[0]||(s[0]=x=>e.$emit("fetch")),isEditAddress:t.isEditAddress,newAddressData:t.newAddressData,profileDetails:r.profileDetails},null,8,["modalAction","isEditAddress","newAddressData","profileDetails"])]),a("div",Dc,[i.addresses.length?(n(),l("ul",{key:0,class:"fct-customer-address-list",role:"list","aria-label":`${r.addressType} addresses`},[(n(!0),l(T,null,E(i.sortedAddresses,x=>(n(),l("li",{class:V(`fct-customer-address-block ${x.is_primary==="1"?"default-address":""}`),key:x.id,role:"listitem"},[x.label?(n(),l("div",Lc,[y(o(x.label)+" ",1),x.is_primary==="1"?(n(),S(u,{key:0,"hide-icon":!0,highContrast:"",size:"small","aria-label":i.translate("Default")},{default:m(()=>[y(o(i.translate("Default")),1)]),_:1},8,["aria-label"])):p("",!0)])):p("",!0),a("p",Ic,o(e.getAddress(x.formatted_address,"")),1),a("div",Vc,[c(f,{trigger:"click",class:"fct-more-option-wrap","popper-class":"fct-dropdown",onCommand:i.handleAddressCommand},{dropdown:m(()=>[c(k,{role:"menu"},{default:m(()=>[c(w,{command:{action:"edit",data:x},role:"menuitem"},{default:m(()=>[y(o(i.translate("Edit")),1)]),_:2},1032,["command"]),x.is_primary!=="1"?(n(),l(T,{key:0},[c(w,{command:{action:"default",data:x},role:"menuitem"},{default:m(()=>[y(o(i.translate("Set as default")),1)]),_:2},1032,["command"]),c(w,{command:{action:"remove",data:x},class:"item-destructive",role:"menuitem"},{default:m(()=>[y(o(i.translate("Delete")),1)]),_:2},1032,["command"])],64)):p("",!0)]),_:2},1024)]),default:m(()=>[a("button",{class:"more-btn","aria-label":i.translate("Address options"),"aria-haspopup":"true","aria-expanded":"false"},[c(v,{name:"More","aria-hidden":"true"})],8,Rc)]),_:2},1032,["onCommand"])])],2))),128))],8,Ec)):(n(),l("div",Bc,o(i.translate("No %1$s address found, please add a new address.",r.addressType)),1))])],8,Pc)}const Vt=L(Sc,[["render",Fc]]),Nc={name:"BillingAddress",components:{AddressSection:Vt},props:["profileDetails"],emits:["fetch","setAddressPrimary","deleteAddress"]};function Uc(e,s,r,h,t,i){const d=_("AddressSection");return n(),S(d,{profileDetails:r.profileDetails,addressType:"billing",title:e.$t("Billing Address"),description:e.$t("Provide or update the address where your billing statements and invoices will be sent."),onFetch:s[0]||(s[0]=u=>e.$emit("fetch")),onSetAddressPrimary:s[1]||(s[1]=u=>e.$emit("setAddressPrimary",u)),onDeleteAddress:s[2]||(s[2]=u=>e.$emit("deleteAddress",u))},null,8,["profileDetails","title","description"])}const Oc=L(Nc,[["render",Uc]]),Hc={name:"ShippingAddress",components:{AddressSection:Vt},props:["profileDetails"],emits:["fetch","setAddressPrimary","deleteAddress"]};function qc(e,s,r,h,t,i){const d=_("AddressSection");return n(),S(d,{profileDetails:r.profileDetails,addressType:"shipping",title:e.$t("Shipping Address"),description:e.$t("Provide or update the address where your orders will be delivered."),onFetch:s[0]||(s[0]=u=>e.$emit("fetch")),onSetAddressPrimary:s[1]||(s[1]=u=>e.$emit("setAddressPrimary",u)),onDeleteAddress:s[2]||(s[2]=u=>e.$emit("deleteAddress",u))},null,8,["profileDetails","title","description"])}const zc=L(Hc,[["render",qc]]);class jc{constructor(){ye(this,"duration",2500);ye(this,"offset",30)}success(s,r=null){this.notify(s,r||b("Success"),"success")}error(s,r=null,h=null){this.notify(s,r||b("Error"),"error",h??3500)}info(s,r=null){this.notify(s,r||b("Information"),"info")}notify(s,r,h="success",t=null){ae({type:h,title:r,offset:this.offset,message:this.parseMessage(s),duration:t??this.duration})}parseMessage(s){return s?typeof s=="string"?s:s.message?s.message:s.data&&s.data.message?s.data.message:b("Something went wrong!"):b("Something went wrong!")}}const Yc=new jc,Kc={key:1,class:"fct-portal-section fct-portal-section--error",role:"status"},Wc={class:"fct-portal-section-error-text"},Zc=Object.assign({name:"PortalTemplateLoader"},{__name:"PortalTemplateLoader",props:{section:{type:Object,required:!0},data:{type:Object,default:()=>({})}},setup(e){const s=e,r=jt(Yt),h=Object.freeze({get:(...u)=>O.get(...u),post:(...u)=>O.post(...u),put:(...u)=>O.put(...u),delete:(...u)=>O.delete(...u),patch:(...u)=>O.patch(...u),getNonce:()=>O.getNonce()}),t={Vue:r,Rest:h,Notify:Yc,translate:b,Badge:U,ElMessage:Pt,ElMessageBox:de},i=()=>{var v;const u=(v=window.fluent_cart_customer_portal)==null?void 0:v.services;return u?{...u,...t}:t},d=Ct(()=>cs(s.section.component,i()));return(u,v)=>d.value.component?(n(),S(K(d.value.component),{key:0,payload:e.section.payload,data:e.data},null,8,["payload","data"])):(n(),l("div",Kc,[a("p",Wc,o(M(b)("This section could not be loaded.")),1)]))}}),Gc=Object.assign({name:"PortalSections"},{__name:"PortalSections",props:{filter:{type:String,required:!0},data:{type:Object,default:()=>({})}},setup(e){const s=e,r=N([]);return he(()=>{O.get("customer-profile/sections",{filter:s.filter}).then(h=>{const t=h&&h.sections;r.value=Array.isArray(t)?t:[]}).catch(()=>{r.value=[]})}),(h,t)=>(n(!0),l(T,null,E(r.value,i=>(n(),l(T,{key:i.key},[i.type==="vue-template"&&i.component?(n(),S(Zc,{key:0,section:i,data:e.data},null,8,["section","data"])):p("",!0)],64))),128))}}),Jc={name:"UserProfile",components:{DynamicIcon:F,Badge:U,MaterialInput:W,AddressComponent:ls,AccountDetails:_c,BillingAddress:Oc,ShippingAddress:zc,PortalSections:Gc},data(){return{validationErrors:{},isProfileChanged:!1,originalProfileDetails:{},loading:!1,addAddressLoading:!1,profileDetails:null,billingAddress:null,shippingAddress:null,addNewAddressModalVisible:!1,isEditAddress:!1,modalAction:"billing",newEmail:"",emailConfirmationData:{},emailChangeTokenExpiry:""}},watch:{"profileDetails.first_name":{handler(e,s){this.checkProfileChanges()}},"profileDetails.last_name":{handler(e,s){this.checkProfileChanges()}}},mounted(){this.fetch()},methods:{translate:b,updateCustomerProfile(){this.loading=!0,this.$post("customer-profile/update",{first_name:this.profileDetails.first_name,last_name:this.profileDetails.last_name,email:this.profileDetails.email}).then(e=>{this.isProfileChanged=!1,B.success(e.message),this.fetch()}).catch(e=>{B.error(e)}).finally(()=>{this.loading=!1})},setAddressPrimary(e){let s=e;s.customer_id,this.$post("customer-profile/make-primary-address",{addressId:s.id,type:s.type}).then(r=>{B.success(r),this.fetch()}).catch(r=>{B.success(r)})},deleteAddress(e){let s=e;s.customer_id,this.$post("customer-profile/delete-address",{addressId:s.id}).then(r=>{B.success(r),this.fetch()}).catch(r=>{B.error(r)})},fetch(){this.loading=!0,this.$get("customer-profile/profile").then(e=>{var s,r;this.originalProfileDetails=JSON.parse(JSON.stringify(e.data)),this.profileDetails=e==null?void 0:e.data,this.newEmail=(s=e==null?void 0:e.data)==null?void 0:s.new_email,this.emailChangeTokenExpiry=(r=e==null?void 0:e.data)==null?void 0:r.email_change_token_expiry,this.isProfileChanged=!1}).finally(()=>{this.loading=!1})},editAddress(){if(this.validateForm()){this.addAddressLoading=!0;let e={...this.newAddressData};this.$post("customer-profile/edit-address",{id:e.id,label:e.label,name:e.name,phone:e.phone,email:e.email,country:e.country,state:e.state,address_1:e.address_1,address_2:e.address_2,city:e.city,postcode:e.postcode,type:e.type}).then(s=>{B.success(s),this.fetch(),this.addAddressLoading=!1}).catch(s=>{B.error(s)}).finally(()=>{this.addNewAddressModalVisible=!1,this.resetFormDataAndValidation()})}else B.error(b("Please fill in all the required fields."))},checkProfileChanges(){if(this.profileDetails&&this.originalProfileDetails&&Object.keys(this.originalProfileDetails).length>0){const e=this.profileDetails.first_name!==this.originalProfileDetails.first_name,s=this.profileDetails.last_name!==this.originalProfileDetails.last_name;this.isProfileChanged=e||s}}}},Qc={key:0,"aria-live":"polite","aria-hidden":"true",class:"border border-solid border-[color:var(--fct-customer-dashboard-border-color,#D6DAE1)] rounded fct-customer-dashboard-layout-width"},Xc={class:"fct-form-container"},eu={class:"form-left"},tu={class:"form-right"},su={class:"fct-form-container"},au={class:"form-left"},ru={class:"form-right"},iu={class:"fct-form-container"},nu={class:"form-left"},ou={class:"form-right"},lu={key:1,class:"fct-customer-dashboard-user-profile fct-customer-dashboard-layout-width","aria-live":"polite"},du={class:"fct-form-footer text-right"};function cu(e,s,r,h,t,i){const d=_("el-skeleton-item"),u=_("el-skeleton"),v=_("AccountDetails"),w=_("BillingAddress"),k=_("ShippingAddress"),f=_("el-button"),x=_("PortalSections");return n(),l(T,null,[t.loading?(n(),l("div",Qc,[c(u,{class:"px-5 py-5",loading:t.loading,rows:2,animated:""},{template:m(()=>[a("div",Xc,[a("div",eu,[c(d,{variant:"p",class:"w-[200px] mr-5"}),c(d,{variant:"p",class:"w-[240px] mr-5"})]),a("div",tu,[c(d,{variant:"p",class:"w-[200px]"}),c(d,{variant:"p",class:"w-[300px]"})])]),a("div",su,[a("div",au,[c(d,{variant:"p",class:"w-[200px] mr-5"}),c(d,{variant:"p",class:"w-[240px] mr-5"})]),a("div",ru,[c(d,{variant:"p",class:"w-[200px]"}),c(d,{variant:"p",class:"w-[300px]"})])]),a("div",iu,[a("div",nu,[c(d,{variant:"p",class:"w-[200px] mr-5"}),c(d,{variant:"p",class:"w-[240px] mr-5"})]),a("div",ou,[c(d,{variant:"p",class:"w-[200px]"}),c(d,{variant:"p",class:"w-[300px]"})])])]),_:1},8,["loading"])])):p("",!0),t.profileDetails&&!t.loading?(n(),l("div",lu,[c(v,{profileDetails:t.profileDetails},null,8,["profileDetails"]),t.profileDetails.not_a_customer?p("",!0):(n(),l(T,{key:0},[c(w,{profileDetails:t.profileDetails,onFetch:i.fetch,onSetAddressPrimary:i.setAddressPrimary,onDeleteAddress:i.deleteAddress},null,8,["profileDetails","onFetch","onSetAddressPrimary","onDeleteAddress"]),c(k,{profileDetails:t.profileDetails,onFetch:i.fetch,onSetAddressPrimary:i.setAddressPrimary,onDeleteAddress:i.deleteAddress},null,8,["profileDetails","onFetch","onSetAddressPrimary","onDeleteAddress"]),a("footer",du,[c(f,{type:"primary",size:"small",onClick:i.updateCustomerProfile,loading:t.loading,"aria-label":i.translate("Save Profile")},{default:m(()=>[y(o(i.translate("Save Profile")),1)]),_:1},8,["onClick","loading","aria-label"])]),c(x,{filter:"profile_sections",data:{profileDetails:t.profileDetails}},null,8,["data"])],64))])):p("",!0)],64)}const uu=L(Jc,[["render",cu]]),mu={name:"MyReviews",components:{EmptyState:ce,Pagination:ue},data(){return{myReviewsTitleId:"my-reviews-title",placeholderImage:window.fluentcart_customer_profile_vars.placeholder_image,activeTab:"to-review",pendingProducts:[],openingPostId:null,reviewFormController:null,submittedPostIds:[],pendingLoading:!0,pendingLoaded:!1,pendingFetchRunning:!1,historyCountKnown:!1,historyRequestId:0,reviews:[],paginate:{current_page:1,per_page:10,total:0},loading:!1,historyLoaded:!1,expandedReviewIds:[]}},computed:{contentPreviewLength(){return 260},pendingTabLabel(){return this.pendingLoaded?this.$t("To Be Reviewed (%1$s)",this.pendingProducts.length):this.$t("To Be Reviewed")},historyTabLabel(){return!this.historyLoaded&&!this.historyCountKnown?this.$t("History"):this.$t("History (%1$s)",this.paginate.total)}},beforeUnmount(){document.removeEventListener("fct-review-submitted",this.onReviewSubmitted),document.removeEventListener("fct-review-overlay-closed",this.onReviewOverlayClosed),this.releaseReviewForm()},mounted(){document.addEventListener("fct-review-submitted",this.onReviewSubmitted),document.addEventListener("fct-review-overlay-closed",this.onReviewOverlayClosed),this.fetchPendingProducts()},methods:{reviewPhotos(e){return Array.isArray(e==null?void 0:e.media)?e.media.filter(s=>s&&s.url):[]},visibleContent(e){const s=String((e==null?void 0:e.content)||"");if(!this.isTruncated(e)||this.isExpanded(e))return s;const r=s.slice(0,this.contentPreviewLength),h=r.lastIndexOf(" ");return(h>0?r.slice(0,h):r).trimEnd()+"…"},isTruncated(e){return String((e==null?void 0:e.content)||"").length>this.contentPreviewLength},isExpanded(e){return this.expandedReviewIds.includes(e.id)},toggleExpanded(e){if(this.isExpanded(e)){this.expandedReviewIds=this.expandedReviewIds.filter(s=>s!==e.id);return}this.expandedReviewIds.push(e.id)},photoUrls(e){return this.reviewPhotos(e).filter(s=>s.type!=="video").map(s=>s.url)},openReviewForm(e){if(this.openingPostId!==null)return;this.openingPostId=e.post_id;const s={post_id:e.post_id};e.item_id&&(s.item_id=e.item_id),this.$get("customer-profile/reviews/submission-form",s).then(r=>{const h=this.$refs.formHolder;if(!h)return;this.releaseReviewForm(),h.innerHTML=r.html||"";const t=h.querySelector("[data-fluent-cart-review-form]");if(!t)return;const i={container:t,open:!0};document.dispatchEvent(new CustomEvent("fct-review-form-mount",{detail:i})),this.reviewFormController=i.controller?Kt(i.controller):null}).catch(r=>{this.handleError(r)}).finally(()=>{this.openingPostId=null})},onReviewSubmitted(e){const s=Number(e.detail&&e.detail.postId);if(s){if(this.reviewFormController){this.submittedPostIds.push(s);return}this.settleSubmission(s)}},settleSubmission(e){const s=this.pendingProducts.length;this.pendingProducts=this.pendingProducts.filter(r=>Number(r.post_id)!==e),this.pendingProducts.length!==s&&(this.paginate.total+=1,this.historyCountKnown=!0),this.historyLoaded=!1,this.historyRequestId+=1,this.activeTab==="history"&&this.fetchReviews()},onReviewOverlayClosed(){if(this.releaseReviewForm(),!this.submittedPostIds.length)return;this.submittedPostIds.splice(0).forEach(s=>this.settleSubmission(s)),this.$nextTick(()=>{const s=this.$el.querySelector(".fct-order-item-review-btn")||this.$el.querySelector(".el-tabs__item.is-active")||this.$el.querySelector(".el-tabs__item");s&&typeof s.focus=="function"&&s.focus()})},releaseReviewForm(){this.reviewFormController&&(this.reviewFormController.destroy(),this.reviewFormController=null),this.$refs.formHolder&&(this.$refs.formHolder.innerHTML="")},onTabChange(e){e==="history"&&!this.historyLoaded&&this.fetchReviews(),e==="to-review"&&!this.pendingLoaded&&this.fetchPendingProducts()},fetchPendingProducts(){this.pendingFetchRunning||(this.pendingFetchRunning=!0,this.pendingLoading=!0,this.$get("customer-profile/reviews",{type:"pending"}).then(e=>{this.pendingProducts=e.products||[],this.pendingLoaded=!0,!this.historyLoaded&&typeof e.history_total=="number"&&(this.paginate.total=e.history_total,this.historyCountKnown=!0),!this.pendingProducts.length&&this.activeTab==="to-review"&&(this.activeTab="history",this.onTabChange("history"))}).catch(e=>{this.handleError(e)}).finally(()=>{this.pendingLoading=!1,this.pendingFetchRunning=!1}))},fetchReviews(){const e=++this.historyRequestId,s=this.paginate.current_page;this.loading=!0,this.$get("customer-profile/reviews",{per_page:this.paginate.per_page,page:s}).then(r=>{e===this.historyRequestId&&(this.reviews=r.reviews.data||[],this.expandedReviewIds=[],this.paginate.total=r.reviews.total,this.paginate.current_page=s,this.historyLoaded=!0)}).catch(r=>{e===this.historyRequestId&&this.handleError(r)}).finally(()=>{e===this.historyRequestId&&(this.loading=!1)})}}},hu=["aria-labelledby","aria-busy"],_u={ref:"formHolder",class:"fct-my-reviews-form-holder"},pu={class:"fct-customer-dashboard-header"},fu=["id"],bu={key:0,"aria-live":"polite"},yu={key:1,"aria-live":"polite"},gu={key:0,class:"fct-my-reviews-list"},vu={class:"fct-product-info-card"},wu={class:"fct-product-info-card-inner"},ku={class:"fct-media"},xu=["href"],Cu=["src"],Tu={class:"product-info-content"},Su={class:"title"},Pu=["href"],Au={key:0,class:"variation-title"},Mu={key:1,class:"variation-title"},$u={class:"fct-my-reviews-item-action"},Du=["disabled","aria-busy","aria-label","onClick"],Eu={key:0,"aria-live":"polite"},Lu={key:1,"aria-live":"polite"},Iu={key:0,class:"fct-my-reviews-list"},Vu={class:"fct-my-reviews-head"},Ru=["href"],Bu=["src"],Fu={class:"fct-my-reviews-head-text"},Nu={class:"fct-my-reviews-title-line"},Uu=["href"],Ou={key:0,class:"fct-my-reviews-item-label"},Hu={class:"fct-my-reviews-head-meta"},qu=["aria-label"],zu={class:"fct-my-reviews-reviewed-on"},ju={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},Yu={key:1,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},Ku=["disabled","aria-busy","aria-label","onClick"],Wu={key:0,class:"fct-my-reviews-review-title"},Zu={key:1,class:"fct-my-reviews-review-text"},Gu=["aria-expanded","onClick"],Ju={class:"fct-my-reviews-photo-count"},Qu={class:"fct-my-reviews-media"},Xu=["src"],em=["src"];function tm(e,s,r,h,t,i){const d=_("el-skeleton"),u=_("EmptyState"),v=_("el-tab-pane"),w=_("el-image"),k=_("Pagination"),f=_("el-tabs"),x=ee("loading");return n(),l("div",{class:"fct-customer-my-reviews fct-customer-dashboard-layout-width",role:"region","aria-labelledby":t.myReviewsTitleId,"aria-busy":t.activeTab==="history"?t.loading:t.pendingLoading},[a("div",_u,null,512),a("div",pu,[a("h4",{id:t.myReviewsTitleId,class:"fct-customer-dashboard-title"},o(e.$t("My Reviews")),9,fu)]),c(f,{modelValue:t.activeTab,"onUpdate:modelValue":s[0]||(s[0]=g=>t.activeTab=g),onTabChange:i.onTabChange},{default:m(()=>[c(v,{name:"to-review",label:i.pendingTabLabel},{default:m(()=>[t.pendingLoading?(n(),l("div",bu,[c(d,{rows:3,animated:""})])):(n(),l("div",yu,[t.pendingProducts.length?(n(),l("ul",gu,[(n(!0),l(T,null,E(t.pendingProducts,g=>(n(),l("li",{key:g.post_id,class:"fct-my-reviews-item"},[a("div",vu,[a("div",wu,[a("div",ku,[a("a",{href:g.url,"aria-hidden":"true",tabindex:"-1"},[a("img",{src:g.thumbnail||t.placeholderImage,alt:"",loading:"lazy"},null,8,Cu)],8,xu)]),a("div",Tu,[a("div",Su,[a("a",{href:g.url},o(g.title),9,Pu)]),g.variation_title?(n(),l("div",Au,o(g.variation_title),1)):p("",!0),g.last_purchased_at?(n(),l("div",Mu,o(e.$t("Purchased on %1$s",e.formatDate(g.last_purchased_at))),1)):p("",!0)]),a("div",$u,[a("button",{type:"button",class:"fct-order-item-review-btn",disabled:t.openingPostId!==null,"aria-busy":t.openingPostId===g.post_id?"true":void 0,"aria-label":e.$t("Write a review for")+" "+g.title,onClick:P=>i.openReviewForm(g)},[y(o(e.$t("Write a Review"))+" ",1),s[1]||(s[1]=a("span",{"aria-hidden":"true"},"✍︎",-1))],8,Du)])])])]))),128))])):t.pendingLoaded?(n(),S(u,{key:1,title:e.$t("Nothing to review"),text:e.$t("Products you purchase will wait here for your review!")},null,8,["title","text"])):p("",!0)]))]),_:1},8,["label"]),c(v,{name:"history",label:i.historyTabLabel},{default:m(()=>[t.loading&&!t.historyLoaded?(n(),l("div",Eu,[c(d,{rows:3,animated:""})])):Z((n(),l("div",Lu,[t.reviews.length?(n(),l("ul",Iu,[(n(!0),l(T,null,E(t.reviews,g=>(n(),l("li",{key:g.id,class:"fct-my-reviews-item"},[a("div",Vu,[a("a",{class:"fct-my-reviews-thumb",href:g.product_url,"aria-hidden":"true",tabindex:"-1"},[a("img",{src:g.product_thumbnail||t.placeholderImage,alt:"",loading:"lazy"},null,8,Bu)],8,Ru),a("div",Fu,[a("div",Nu,[a("a",{class:"fct-my-reviews-product",href:g.product_url},o(g.product_title),9,Uu),g.item_label?(n(),l("span",Ou,o(g.item_label),1)):p("",!0)]),a("div",Hu,[a("span",{class:"fct-my-reviews-stars",role:"img","aria-label":e.$t("Rated %1$s out of 5",g.rating)},[(n(),l(T,null,E(5,P=>a("svg",{key:P,class:V(["fct-my-reviews-star",{"is-filled":P<=g.rating}]),width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"},s[2]||(s[2]=[a("path",{d:"M12 2.25l2.955 6.377 6.98.638-5.268 4.62 1.558 6.865L12 17.155 5.775 20.75l1.558-6.865-5.268-4.62 6.98-.638L12 2.25z"},null,-1)]),2)),64))],8,qu),a("span",zu,o(e.$t("Reviewed %1$s",e.formatDate(g.created_at))),1),a("span",{class:V(["fct-my-reviews-status",g.status==="approved"?"is-approved":"is-pending"])},[g.status==="approved"?(n(),l("svg",ju,s[3]||(s[3]=[a("path",{d:"M20 6 9 17l-5-5"},null,-1)]))):(n(),l("svg",Yu,s[4]||(s[4]=[a("circle",{cx:"12",cy:"12",r:"9"},null,-1),a("path",{d:"M12 7v5l3 2"},null,-1)]))),y(" "+o(g.status==="approved"?e.$t("Approved"):e.$t("Pending")),1)],2)])]),g.can_edit?(n(),l("button",{key:0,type:"button",class:"fct-order-item-review-btn fct-my-reviews-edit",disabled:t.openingPostId!==null,"aria-busy":t.openingPostId===g.post_id?"true":void 0,"aria-label":e.$t("Edit your review of")+" "+g.product_title,onClick:P=>i.openReviewForm({post_id:g.post_id,item_id:g.item_id})},[s[5]||(s[5]=a("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",width:"15",height:"15","aria-hidden":"true",focusable:"false"},[a("path",{d:"M12 20h9"}),a("path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z"})],-1)),y(" "+o(e.$t("Edit your review")),1)],8,Ku)):p("",!0)]),g.title?(n(),l("strong",Wu,o(g.title),1)):p("",!0),g.content?(n(),l("p",Zu,o(i.visibleContent(g)),1)):p("",!0),i.isTruncated(g)?(n(),l("button",{key:2,type:"button",class:"fct-my-reviews-readmore","aria-expanded":i.isExpanded(g)?"true":"false",onClick:P=>i.toggleExpanded(g)},o(i.isExpanded(g)?e.$t("Show less"):e.$t("Read more")),9,Gu)):p("",!0),i.reviewPhotos(g).length?(n(),l(T,{key:3},[a("span",Ju,o(e.$t("%1$s photos attached",i.reviewPhotos(g).length)),1),a("ul",Qu,[(n(!0),l(T,null,E(i.reviewPhotos(g),P=>(n(),l("li",{key:P.id||P.url},[P.type==="video"?(n(),l("video",{key:0,class:"fct-my-reviews-media-thumb",src:P.url,controls:"",preload:"metadata"},null,8,Xu)):(n(),S(w,{key:1,class:"fct-my-reviews-media-thumb",src:P.url,alt:"",fit:"cover",loading:"lazy","preview-src-list":i.photoUrls(g),"initial-index":i.photoUrls(g).indexOf(P.url),"preview-teleported":"","hide-on-click-modal":"",infinite:!1,"z-index":3e3},{error:m(()=>[a("img",{class:"fct-my-reviews-media-fallback",src:t.placeholderImage,alt:"",loading:"lazy"},null,8,em)]),_:2},1032,["src","preview-src-list","initial-index"]))]))),128))])],64)):p("",!0)]))),128))])):t.historyLoaded?(n(),S(u,{key:1,title:e.$t("No reviews yet"),text:e.$t("Reviews you write will be shown here!")},null,8,["title","text"])):p("",!0)])),[[x,t.loading]]),t.paginate&&t.paginate.total!==0?(n(),S(k,{key:2,hide_on_single:!0,pagination:t.paginate,onFetch:i.fetchReviews},null,8,["pagination","onFetch"])):p("",!0)]),_:1},8,["label"])]),_:1},8,["modelValue","onTabChange"])],8,hu)}const sm=L(mu,[["render",tm]]),am={name:"CustomerTaxBreakdownBox",props:{order:{type:Object,required:!0}},computed:{customerTaxRateLines(){if(!this.order||this.order.is_reverse_charge_tax_order)return[];const e=this.order.tax_summary||{};return this.order.display_tax_lines||e.taxRateLines||[]},customerTaxShouldShowBreakdown(){const e=this.order&&this.order.tax_summary;if(!e)return!1;if(this.customerTaxRateLines.length||(e.shippingTaxLines||[]).length)return!0;let s=0;return this.customerTaxRateLines.length?s+=this.customerTaxRateLines.length:(e.inclusiveTax>0&&s++,e.exclusiveTax>0&&s++),s+=(e.feeTaxLines||[]).filter(function(r){return r.tax_amount>0}).length,e.shippingTax>0&&s++,s>=2?!0:s===0?!1:!(e.payableTax>0||e.inclusiveTax>0||e.inclusiveFeeTax>0)}},methods:{formatOrderAmount(e,s=!0,r=!1){var h=this.formatNumber(e,s,r,this.order&&this.order.currency);if(!h)return h;var t=Number(e||0);if(!Number.isFinite(t)||t%100!==0)return h;var i=window.fluentcart_customer_profile_vars.shop||{},d=i.decimal_separator==="comma"?",":".",u=d+Y("00");return h.replace(u,"")}}},rm={class:"fct-customer-tax-box"},im={class:"tr fct-customer-tax-breakdown-heading"},nm={class:"tr fct-customer-tax-breakdown-col-headers"},om={class:"fct-customer-tax-breakdown-col-rate"},lm={class:"fct-customer-tax-breakdown-col-base"},dm={class:"fct-customer-tax-breakdown-col-tax"},cm={class:"fct-customer-tax-breakdown-col-rate"},um={class:"fct-customer-tax-breakdown-col-base"},mm={class:"fct-customer-tax-breakdown-col-tax"},hm={key:0,class:"tr fct-customer-tax-row--divider"},_m={key:0},pm={key:1},fm={class:"tr fct-customer-tax-row--divider"},bm={key:0,class:"tr fct-customer-tax-row--muted"},ym={key:1,class:"tr fct-customer-tax-row--divider"},gm={key:1,class:"tr fct-customer-tax-row--muted"},vm={key:2,class:"tr"},wm={key:5,class:"tr"},km={key:6,class:"tr fct-customer-tax-row--muted"},xm={key:2,class:"tr"},Cm={class:"fct-tax-amount fct-tax-amount--reversed"},Tm={key:3,class:"tr"},Sm={key:4,class:"tr fct-customer-tax-row--divider"};function Pm(e,s,r,h,t,i){return n(),l("div",rm,[r.order.tax_summary&&r.order.tax_summary.foldedRateLines&&r.order.tax_summary.foldedRateLines.length?(n(),l(T,{key:0},[a("div",im,[a("span",null,o(e.$t("Tax breakdown by rate")),1)]),a("div",nm,[a("span",om,o(e.$t("Rate")),1),a("span",lm,o(e.$t("Taxable base")),1),a("span",dm,o(e.$t("Tax")),1)]),(n(!0),l(T,null,E(r.order.tax_summary.foldedRateLines,(d,u)=>(n(),l("div",{key:"folded-rate-"+u,class:V(["tr","fct-customer-tax-breakdown-row",d.inclusive?"fct-customer-tax-row--muted":""])},[a("span",cm,o(d.label),1),a("span",um,o(i.formatOrderAmount(d.base)),1),a("span",mm,o(i.formatOrderAmount(d.tax)),1)],2))),128)),r.order.is_reverse_charge_tax_order?(n(),l("div",hm,[y(o(e.$t("VAT reversed"))+" ",1),r.order.tax_summary.reversedTaxTotal>0?(n(),l("span",_m,o(i.formatOrderAmount(r.order.tax_summary.reversedTaxTotal)),1)):(n(),l("span",pm,o(e.$t("Charge reversed")),1))])):(n(),l(T,{key:1},[a("div",fm,[y(o(e.$t("Total tax"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.totalOrderTax)),1)]),r.order.tax_summary.includedInPrices>0?(n(),l("div",bm,[y(o(e.$t("of which included in prices"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.includedInPrices)),1)])):p("",!0),r.order.tax_summary.payableTax>0&&r.order.tax_summary.includedInPrices>0?(n(),l("div",ym,[y(o(e.$t("Payable now (added)"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.payableTax)),1)])):p("",!0)],64))],64)):r.order.is_reverse_charge_tax_order?p("",!0):(n(),l(T,{key:1},[i.customerTaxRateLines.length&&i.customerTaxShouldShowBreakdown?(n(!0),l(T,{key:0},E(i.customerTaxRateLines,d=>(n(),l("div",{key:"tax-rate-line-"+d.rate_id+"-"+d.label,class:V(["tr",d.inclusive?"fct-customer-tax-row--muted":""])},[y(o(d.label)+" ",1),a("span",null,o(i.formatOrderAmount(d.order_tax)),1)],2))),128)):p("",!0),!i.customerTaxRateLines.length&&r.order.tax_summary.inclusiveTax>0&&i.customerTaxShouldShowBreakdown?(n(),l("div",gm,[y(o(e.$t("Included in item prices"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.inclusiveTax)),1)])):p("",!0),!i.customerTaxRateLines.length&&r.order.tax_summary.exclusiveTax>0&&i.customerTaxShouldShowBreakdown?(n(),l("div",vm,[y(o(e.$t("Added on products"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.exclusiveTax)),1)])):p("",!0),r.order.tax_summary.feeTaxLines&&r.order.tax_summary.feeTaxLines.length&&i.customerTaxShouldShowBreakdown?(n(!0),l(T,{key:3},E(r.order.tax_summary.feeTaxLines,(d,u)=>(n(),l(T,{key:u},[d.tax_amount>0?(n(),l("div",{key:0,class:V(["tr",d.inclusive?"fct-customer-tax-row--muted":""])},[y(o(d.inclusive?e.$t("Included in %1$s",d.label):e.$t("Added on %1$s",d.label))+" ",1),a("span",null,o(i.formatOrderAmount(d.tax_amount)),1)],2)):p("",!0)],64))),128)):p("",!0),r.order.tax_summary.shippingTax>0&&i.customerTaxShouldShowBreakdown?(n(),l(T,{key:4},[r.order.tax_summary.shippingTaxLines&&r.order.tax_summary.shippingTaxLines.length?(n(!0),l(T,{key:0},E(r.order.tax_summary.shippingTaxLines,d=>(n(),l("div",{key:d.label,class:V(["tr",r.order.tax_summary.isShippingInclusive?"fct-customer-tax-row--muted":""])},[y(o(d.label)+" ",1),a("span",null,o(i.formatOrderAmount(d.shipping_tax)),1)],2))),128)):(n(),l("div",{key:1,class:V(["tr",r.order.tax_summary.isShippingInclusive?"fct-customer-tax-row--muted":""])},[y(o(r.order.tax_summary.isShippingInclusive?e.$t("Included in shipping prices"):e.$t("Added on shipping"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.shippingTax)),1)],2))],64)):p("",!0),r.order.tax_summary.payableTax>0?(n(),l("div",wm,[y(o(e.$t("Total payable tax"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.payableTax)),1)])):p("",!0),r.order.tax_summary.inclusiveTax>0||r.order.tax_summary.inclusiveFeeTax>0?(n(),l("div",km,[y(o(e.$t("Total tax in this order"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.totalOrderTax)),1)])):p("",!0)],64)),r.order.is_reverse_charge_tax_order&&r.order.tax_summary.showRcShippingRow&&r.order.tax_summary.reversedShippingTax>0&&!(r.order.tax_summary.foldedRateLines&&r.order.tax_summary.foldedRateLines.length)?(n(),l("div",xm,[y(o(e.$t("Added on shipping"))+" ",1),a("span",Cm,o(i.formatOrderAmount(r.order.tax_summary.reversedShippingTax)),1)])):p("",!0),r.order.is_reverse_charge_tax_order&&r.order.tax_summary.reversedTaxTotal>0&&!(r.order.tax_summary.foldedRateLines&&r.order.tax_summary.foldedRateLines.length)?(n(),l("div",Tm,[y(o(e.$t("Tax reversed"))+" ",1),a("span",null,o(i.formatOrderAmount(r.order.tax_summary.reversedTaxTotal)),1)])):p("",!0),r.order.is_reverse_charge_tax_order&&!(r.order.tax_summary.foldedRateLines&&r.order.tax_summary.foldedRateLines.length)&&!(r.order.tax_summary.reversedTaxTotal>0)&&!(r.order.tax_summary.showRcShippingRow&&r.order.tax_summary.reversedShippingTax>0)?(n(),l("div",Sm,[y(o(e.$t("VAT reversed"))+" ",1),a("span",null,o(e.$t("Charge reversed")),1)])):p("",!0)])}const Am=L(am,[["render",Pm]]),Mm={name:"SingleOrderDetails",components:{OrderTableLoader:re,TransactionsTable:It,LicenseTable:Ce,SubscriptionTable:Dt,Badge:U,DownloadsTable:$t,BundleProducts:Tt,InfoFilled:ss,CustomerTaxBreakdownBox:Am,UpgradePlan:Te},props:{order_id:{type:[String,Number],required:!0}},data(){return{orderTitleId:"order-title",order:null,loading:!0,placeholderImage:window.fluentcart_customer_profile_vars.placeholder_image,sectionParts:{}}},computed:{ArrowRight(){return St},productItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>!["fee","signup_fee"].includes(e.payment_type))},feeItems(){return!this.order||!this.order.order_items?[]:this.order.order_items.filter(e=>e.payment_type==="fee")},visibleTransactions(){var e;return(((e=this.order)==null?void 0:e.transactions)||[]).filter(s=>!(s.order_type==="renewal"&&Number(s.total)===0))},customerTaxRateLines(){if(!this.order||this.order.is_reverse_charge_tax_order)return[];const e=this.order.tax_summary||{};return this.order.display_tax_lines||e.taxRateLines||[]},customerTaxShouldShowBreakdown(){const e=this.order&&this.order.tax_summary;if(!e)return!1;if(this.customerTaxRateLines.length||(e.shippingTaxLines||[]).length)return!0;let s=0;return this.customerTaxRateLines.length?s+=this.customerTaxRateLines.length:(e.inclusiveTax>0&&s++,e.exclusiveTax>0&&s++),s+=(e.feeTaxLines||[]).filter(function(r){return r.tax_amount>0}).length,e.shippingTax>0&&s++,s>=2?!0:s===0?!1:!(e.payableTax>0||e.inclusiveTax>0||e.inclusiveFeeTax>0)}},watch:{order_id(){this.fetchOrder()}},mounted(){this.fetchOrder()},methods:{formatOrderItems:ke,orderBillingAddressUpdated(e){this.order.billing_address_text=e},getImage(e){return e.variant_image?e.variant_image:e.image?e.image:this.placeholderImage},fetchOrder(){this.$get("customer-profile/orders/"+this.order_id).then(e=>{this.order=e.order,this.order.order_items=this.formatOrderItems(e.order.order_items),e.section_parts&&(this.sectionParts=e.section_parts)}).catch(e=>{var s,r,h;if((s=e==null?void 0:e.data)!=null&&s.parent_order&&((h=(r=e==null?void 0:e.data)==null?void 0:r.parent_order)!=null&&h.uuid)){this.$router.push({name:"view_order",params:{order_id:e.data.parent_order.uuid}});return}this.handleError(e)}).finally(()=>{this.loading=!1})},pluralizeTranslate:_e,getStatusText:J,translateNumber:Y,getItemTaxRates(e){var s=e.line_meta&&e.line_meta.tax_config?e.line_meta.tax_config.rates:null;return Array.isArray(s)?s.filter(r=>r.tax_amount>0):[]},getSubscriptionSetupFeeTaxRates(e){if(!this.order||!this.order.order_items)return[];var s=this.order.order_items.find(h=>h.payment_type==="signup_fee"&&h.object_id===e.variation_id);if(!s)return[];var r=s.line_meta&&s.line_meta.tax_config&&Array.isArray(s.line_meta.tax_config.rates)?s.line_meta.tax_config.rates:s.line_meta&&Array.isArray(s.line_meta.rates)?s.line_meta.rates:null;return Array.isArray(r)?r.filter(function(h){return h.tax_amount>0}):[]},isSubscriptionSetupFeeInclusive(e){if(!this.order||!this.order.order_items)return!1;var s=this.order.order_items.find(h=>h.payment_type==="signup_fee"&&h.object_id===e.variation_id);if(!s||!s.line_meta)return!1;var r=s.line_meta.tax_config&&typeof s.line_meta.tax_config=="object"?s.line_meta.tax_config:s.line_meta;return!!r.inclusive},shouldShowUnitPriceRoundingTooltip(e){var s=parseInt(e.quantity||1),r=parseInt(e.unit_price||0),h=parseInt(e.line_total||0);if(s<2||r<=0||h<=0)return!1;var t=Math.abs(r*s-h);return t>0&&t<=s},formatOrderAmount(e,s=!0,r=!1){var h=this.formatNumber(e,s,r,this.order&&this.order.currency);if(!h)return h;var t=Number(e||0);if(!Number.isFinite(t)||t%100!==0)return h;var i=window.fluentcart_customer_profile_vars.shop||{},d=i.decimal_separator==="comma"?",":".",u=d+Y("00");return h.replace(u,"")},formatTaxRateBadge(e){var s=parseFloat(e.rate_percent||0).toFixed(3).replace(/\.?0+$/,"");return(e.label||b("Tax"))+" ("+s+"%)"}}},$m=["aria-labelledby","aria-busy"],Dm=["aria-label"],Em=["id"],Lm={key:0},Im={class:"fct-single-order-box",role:"region","aria-labelledby":"order-summary-title"},Vm=["innerHTML"],Rm={class:"fct-single-order-body"},Bm={class:"fct-customer-dashboard-order-items","aria-labelledby":"order-summary-title"},Fm={class:"fct-order-summary-wrap"},Nm={class:"fct-order-summary-header"},Um={id:"order-summary-title",class:"fct-order-summary-header-title"},Om=["aria-label"],Hm={class:"fct-order-summary-body"},qm={class:"fct-order-summary-items",role:"list"},zm={class:"fct-order-item-row"},jm={class:"fct-product-info-card"},Ym={class:"fct-product-info-card-inner"},Km={class:"fct-media"},Wm=["href","aria-label"],Zm=["src","alt"],Gm={class:"product-info-content"},Jm={class:"title"},Qm=["href","aria-label"],Xm={key:0,class:"text-[var(--fct-customer-dashboard-caption-text-color,#8E99AA)]"},eh={key:0,class:"variation-title"},th={key:1,class:"fct-unit-price-breakdown"},sh=["aria-label"],ah={key:0,class:"flex justify-end items-center gap-1"},rh={class:"text-xs font-normal leading-tight opacity-60 line-through"},ih={key:0,class:"fct-order-item-tax-rates"},nh={class:"fct-tax-badge"},oh={key:1,class:"product-subscription-info flex flex-col gap-1 mt-1 pl-[52px]"},lh=["aria-label"],dh={key:2,class:"fct-order-item-tax-rates"},ch={class:"fct-tax-badge"},uh={key:1,class:"fct-order-item-tax-rate is-exclusive"},mh={class:"fct-tax-badge"},hh={key:0,class:"fct-order-summary-order-calculation"},_h={key:0,class:"tr"},ph={key:1,class:"tr"},fh={key:0,class:"fct-shipping-method-name"},bh={key:3,class:"tr"},yh={class:"fct-tax-amount fct-tax-amount--reversed"},gh={key:4,class:"tr fct-customer-tax-simple-line"},vh={style:{display:"flex","align-items":"center",gap:"6px"}},wh={href:"javascript:void(0)",class:"fct-customer-tax-see-details"},kh={key:6,class:"tr"},xh={key:0},Ch={key:1},Th={key:1,class:"tr fct-customer-tax-row--muted"},Sh={key:2,class:"tr"},Ph={key:5,class:"tr"},Ah={key:6,class:"tr fct-customer-tax-row--muted"},Mh={key:8,class:"tr"},$h={key:9,class:"tr"},Dh={key:10,class:"tr"},Eh={key:11,class:"tr"},Lh={key:12,class:"tr fct-customer-tax-row--muted fct-customer-tax-row--indented"},Ih={key:13,class:"tr fct-customer-tax-row--muted fct-customer-tax-row--indented"},Vh={class:"fct-order-summary-footer"},Rh={class:"fct-order-summary-footer-inner"},Bh=["aria-level"],Fh=["innerHTML"],Nh={key:1,class:"fct-single-order-box",role:"region","aria-labelledby":"subscription-title"},Uh={class:"fct-single-order-header"},Oh={id:"subscription-title",class:"title"},Hh=["innerHTML"],qh={key:2,class:"fct-single-order-box",role:"region","aria-labelledby":"downloads-title"},zh={class:"fct-single-order-header"},jh={id:"downloads-title",class:"title"},Yh=["innerHTML"],Kh={key:3,class:"fct-single-order-box",role:"region","aria-labelledby":"licenses-title"},Wh={class:"fct-single-order-header"},Zh={id:"licenses-title",class:"title"},Gh=["innerHTML"],Jh={key:4,class:"fct-single-order-box",role:"region","aria-labelledby":"transactions-title"},Qh=["innerHTML"],Xh={class:"fct-single-order-header"},e_={id:"transactions-title",class:"title"},t_={class:"fct-customer-dashboard-table"},s_=["innerHTML"],a_={key:5,class:"fct-single-order-box pb-5 lg:pb-0",role:"region","aria-labelledby":"addresses-title"},r_={id:"addresses-title",class:"sr-only"},i_={class:"fct-customer-dashboard-address mb-5 lg:mb-0","aria-labelledby":"billing-title"},n_={id:"billing-title",class:"title"},o_=["innerHTML"],l_={class:"fct-customer-dashboard-address","aria-labelledby":"shipping-title"},d_={id:"shipping-title",class:"title"},c_=["innerHTML"],u_=["innerHTML"],m_={key:1,"aria-live":"polite"};function h_(e,s,r,h,t,i){const d=_("el-breadcrumb-item"),u=_("el-breadcrumb"),v=_("el-button"),w=_("el-alert"),k=_("Badge"),f=_("InfoFilled"),x=_("el-icon"),g=_("el-tooltip"),P=_("BundleProducts"),$=_("UpgradePlan"),D=_("CustomerTaxBreakdownBox"),I=_("el-popover"),A=_("SubscriptionTable"),R=_("DownloadsTable"),q=_("LicenseTable"),te=_("TransactionsTable"),Q=_("el-col"),be=_("el-row"),se=_("OrderTableLoader");return n(),l("div",{class:"fct-customer-dashboard-single-order-wrap",role:"main","aria-labelledby":t.orderTitleId,"aria-busy":t.loading},[a("div",{class:"fct-customer-dashboard-breadcrumb mb-4",role:"navigation","aria-label":e.$t("Breadcrumb navigation")},[c(u,{"separator-icon":i.ArrowRight},{default:m(()=>[c(d,{to:{name:"purchase-history"}},{default:m(()=>[y(o(e.$t("Purchase History")),1)]),_:1}),c(d,{"aria-current":"page"},{default:m(()=>{var C;return[y("#"+o((C=t.order)==null?void 0:C.invoice_no),1)]}),_:1})]),_:1},8,["separator-icon"])],8,Dm),t.order?(n(),l(T,{key:0},[a("h1",{id:t.orderTitleId,class:"sr-only"},[y(o(e.$t("Order Details"))+" ",1),t.order.invoice_no?(n(),l("span",Lm,"#"+o(t.order.invoice_no),1)):p("",!0)],8,Em),t.order.custom_payment_link&&t.order.total_amount-t.order.total_paid-t.order.total_refund>0?(n(),S(w,{key:0,class:"mb-4",title:e.$t("This order has some due amount. Please complete the payment."),type:"error","show-icon":!0,closable:!1},{default:m(()=>[c(v,{class:"el-button--x-small",tag:"a",href:t.order.custom_payment_link,target:"_blank",rel:"noopener noreferrer"},{default:m(()=>[y(o(e.$t("Pay Now")),1)]),_:1},8,["href"])]),_:1},8,["title"])):p("",!0),a("article",Im,[t.sectionParts.before_summary?(n(),l("div",{key:0,innerHTML:t.sectionParts.before_summary},null,8,Vm)):p("",!0),a("div",Rm,[a("section",Bm,[a("div",Fm,[a("header",Nm,[a("h2",Um,o(e.$t("Summary")),1),t.order?(n(),l("div",{key:0,"aria-label":e.$t("Order status information"),class:"fct-order-status-badges gap-1 flex"},[c(k,{type:t.order.payment_status},{default:m(()=>[y(o(i.getStatusText(t.order.payment_status)),1)]),_:1},8,["type"]),t.order.fulfillment_type=="physical"?(n(),l(T,{key:0},[c(k,{type:t.order.status},{default:m(()=>[y(o(i.getStatusText(t.order.status)),1)]),_:1},8,["type"]),c(k,{type:t.order.shipping_status},{default:m(()=>[y(o(i.getStatusText(t.order.shipping_status)),1)]),_:1},8,["type"])],64)):p("",!0),t.order.is_b2b_order?(n(),S(k,{key:1,type:"blue",text:e.$t("B2B")},null,8,["text"])):p("",!0)],8,Om)):p("",!0)]),a("div",Hm,[a("ul",qm,[(n(!0),l(T,null,E(i.productItems,(C,X)=>{var ie,H,Se;return n(),l("li",{key:X,class:"fct-order-summary-item gap-0",role:"listitem"},[a("div",zm,[a("div",jm,[a("div",Ym,[a("div",Km,[a("a",{target:"_blank",href:C.url,rel:"noopener noreferrer","aria-label":e.$t("View product")+" "+C.title},[a("img",{src:i.getImage(C),alt:e.$t("Product image for")+" "+C.title,loading:"lazy"},null,8,Zm)],8,Wm)]),a("div",Gm,[a("div",Jm,[a("a",{target:"_blank",href:C.url,rel:"noopener noreferrer","aria-label":e.$t("View product")+" "+C.title},[C.quantity>1?(n(),l("span",Xm,o(i.translateNumber(C.quantity))+" x",1)):p("",!0),y(" "+o(C.post_title),1)],8,Qm)]),(C.variation_display_title||C.title)&&C.title!==C.post_title?(n(),l("div",eh,o(C.variation_display_title||C.title),1)):p("",!0),i.shouldShowUnitPriceRoundingTooltip(C)?(n(),l("div",th,[a("span",null,o(i.formatOrderAmount(C.unit_price))+" × "+o(i.translateNumber(C.quantity)),1),c(g,{effect:"dark",content:e.$t("Unit price is rounded for display. The line total is calculated at full precision."),placement:"top","popper-class":"fct-tooltip"},{default:m(()=>[c(x,{class:"fct-unit-price-rounding-icon"},{default:m(()=>[c(f)]),_:1})]),_:1},8,["content"])])):p("",!0),(ie=C==null?void 0:C.bundle_items)!=null&&ie.length?(n(),S(P,{key:2,class:"!mt-2.5",product:C},null,8,["product"])):p("",!0),C.has_upgrade_paths?(n(),S($,{key:3,class:"mt-2","button-type":"primary","button-text":e.$t("Upgrade Plan"),variation_id:C.variation_id,order_hash:t.order.uuid},null,8,["button-text","variation_id","order_hash"])):p("",!0)])])]),a("div",{class:"fct-order-total text-right","aria-label":e.$t("Subtotal for this item")},[C.coupon_discount>0?(n(),l("div",ah,[a("span",rh,o(i.formatOrderAmount(C.subtotal)),1),a("span",null,o(i.formatOrderAmount(C.line_total)),1)])):(n(),l(T,{key:1},[y(o(i.formatOrderAmount(C.line_total)),1)],64))],8,sh)]),i.getItemTaxRates(C).length&&((H=t.order.tax_summary)==null?void 0:H.displayMode)!=="simplified"?(n(),l("div",ih,[(n(!0),l(T,null,E(i.getItemTaxRates(C),(z,ne)=>{var Pe,Ae;return n(),l("div",{key:"tax-rate-"+ne,class:V(["fct-order-item-tax-rate",C.line_meta&&C.line_meta.tax_config&&C.line_meta.tax_config.inclusive?"is-inclusive":"is-exclusive"])},[a("span",nh,o(i.formatTaxRateBadge(z)),1),a("span",{class:V(["fct-tax-amount",{"fct-tax-amount--reversed":t.order.is_reverse_charge_tax_order&&(!((Ae=(Pe=C.line_meta)==null?void 0:Pe.tax_config)!=null&&Ae.inclusive)||t.order.reverse_charge_price_mode==="dynamic")}])},[C.line_meta&&C.line_meta.tax_config&&C.line_meta.tax_config.inclusive?(n(),l(T,{key:0},[y(o(e.$t("incl.")),1)],64)):p("",!0),y(o(i.formatOrderAmount(z.tax_amount)),1)],2)],2)}),128))])):p("",!0),C.meta_lines&&C.meta_lines.length>0?(n(),l("div",oh,[(n(!0),l(T,null,E(C.meta_lines,(z,ne)=>(n(),l("span",{key:"meta-line-"+X+"-"+ne,class:"leading-none text-xs flex justify-between","aria-label":z.label+": "+z.value},[a("span",null,o(z.label)+" : ",1),a("span",null,o(z.value),1)],8,lh))),128))])):p("",!0),(i.getSubscriptionSetupFeeTaxRates(C).length||C.other_info&&C.other_info.signup_fee_tax>0)&&((Se=t.order.tax_summary)==null?void 0:Se.displayMode)!=="simplified"?(n(),l("div",dh,[i.getSubscriptionSetupFeeTaxRates(C).length?(n(!0),l(T,{key:0},E(i.getSubscriptionSetupFeeTaxRates(C),(z,ne)=>(n(),l("div",{key:"setup-tax-rate-"+ne,class:V(["fct-order-item-tax-rate",i.isSubscriptionSetupFeeInclusive(C)?"is-inclusive":"is-exclusive"])},[a("span",ch,o(e.$t("Setup fee"))+": "+o(i.formatTaxRateBadge(z)),1),a("span",{class:V(["fct-tax-amount",{"fct-tax-amount--reversed":t.order.is_reverse_charge_tax_order&&(!i.isSubscriptionSetupFeeInclusive(C)||t.order.reverse_charge_price_mode==="dynamic")}])},[i.isSubscriptionSetupFeeInclusive(C)?(n(),l(T,{key:0},[y(o(e.$t("incl.")),1)],64)):p("",!0),y(o(i.formatOrderAmount(z.tax_amount)),1)],2)],2))),128)):C.other_info&&C.other_info.signup_fee_tax>0?(n(),l("div",uh,[a("span",mh,o(e.$t("Setup fee tax")),1),a("span",{class:V(["fct-tax-amount",{"fct-tax-amount--reversed":t.order.is_reverse_charge_tax_order&&(!i.isSubscriptionSetupFeeInclusive(C)||t.order.reverse_charge_price_mode==="dynamic")}])},o(i.formatOrderAmount(C.other_info.signup_fee_tax)),3)])):p("",!0)])):p("",!0)])}),128))]),t.order.manual_discount_total+t.order.coupon_discount_total>0||t.order.shipping_total>0||t.order.fee_total>0||t.order.tax_total>0||t.order.is_reverse_charge_tax_order||t.order.tax_summary&&t.order.tax_summary.shouldRender?(n(),l("div",hh,[t.order.manual_discount_total+t.order.coupon_discount_total||t.order.subtotal>0?(n(),l("div",_h,[y(o(e.$t("Subtotal"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.subtotal)),1)])):p("",!0),t.order.shipping_total>0?(n(),l("div",ph,[a("span",null,[y(o(e.$t("Shipping"))+" ",1),t.order.shipping_method_title?(n(),l("span",fh,o(t.order.shipping_method_title),1)):p("",!0)]),a("span",null,o(i.formatOrderAmount(t.order.shipping_total-(t.order.tax_summary&&t.order.tax_summary.rcShippingAdjustment?t.order.tax_summary.rcShippingAdjustment:0))),1)])):p("",!0),t.order.fee_total>0?(n(!0),l(T,{key:2},E(i.feeItems,C=>(n(),l("div",{key:"fee-"+C.id,class:"tr"},[y(o(C.title)+" ",1),a("span",null,o(i.formatOrderAmount(C.subtotal)),1)]))),128)):p("",!0),t.order.is_reverse_charge_tax_order&&t.order.tax_summary&&t.order.tax_summary.showRcShippingRow&&t.order.tax_summary.reversedShippingTax>0&&!(t.order.tax_summary.foldedRateLines&&t.order.tax_summary.foldedRateLines.length)&&t.order.tax_summary.displayMode!=="simplified"?(n(),l("div",bh,[y(o(e.$t("Added on shipping"))+" ",1),a("span",yh,o(i.formatOrderAmount(t.order.tax_summary.reversedShippingTax)),1)])):p("",!0),t.order.tax_summary&&t.order.tax_summary.displayMode==="simplified"&&t.order.tax_summary.simpleLine?(n(),l("div",gh,[a("span",vh,[a("span",null,o(t.order.tax_summary.simpleLine.label),1),t.order.tax_summary.simpleLine.hasDetails?(n(),S(I,{key:0,placement:"bottom-start",width:420,trigger:"click",teleported:!0,"popper-style":{padding:"0",maxWidth:"92vw"}},{reference:m(()=>[a("a",wh,o(e.$t("See details"))+" ▾",1)]),default:m(()=>[c(D,{order:t.order},null,8,["order"])]),_:1})):p("",!0)]),a("span",null,o(t.order.tax_summary.simpleLine.value),1)])):t.order.tax_summary&&t.order.tax_summary.foldedRateLines&&t.order.tax_summary.foldedRateLines.length?(n(),S(D,{key:5,order:t.order},null,8,["order"])):t.order.is_reverse_charge_tax_order?(n(),l("div",kh,[y(o(e.$t("Tax"))+" ",1),t.order.tax_summary&&t.order.tax_summary.reversedTaxTotal>0?(n(),l("span",xh,o(e.$t("Tax reversed: %1$s",i.formatOrderAmount(t.order.tax_summary.reversedTaxTotal))),1)):(n(),l("span",Ch,o(e.$t("Charge reversed")),1))])):t.order.tax_summary&&t.order.tax_summary.shouldRender?(n(),l(T,{key:7},[i.customerTaxRateLines.length&&i.customerTaxShouldShowBreakdown?(n(!0),l(T,{key:0},E(i.customerTaxRateLines,C=>(n(),l("div",{key:"tax-rate-line-"+C.rate_id+"-"+C.label,class:V(["tr",C.inclusive?"fct-customer-tax-row--muted":""])},[y(o(C.label)+" ",1),a("span",null,o(i.formatOrderAmount(C.order_tax)),1)],2))),128)):p("",!0),!i.customerTaxRateLines.length&&t.order.tax_summary.inclusiveTax>0&&i.customerTaxShouldShowBreakdown?(n(),l("div",Th,[y(o(e.$t("Included in item prices"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_summary.inclusiveTax)),1)])):p("",!0),!i.customerTaxRateLines.length&&t.order.tax_summary.exclusiveTax>0&&i.customerTaxShouldShowBreakdown?(n(),l("div",Sh,[y(o(e.$t("Added on products"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_summary.exclusiveTax)),1)])):p("",!0),t.order.tax_summary.feeTaxLines&&t.order.tax_summary.feeTaxLines.length&&i.customerTaxShouldShowBreakdown?(n(!0),l(T,{key:3},E(t.order.tax_summary.feeTaxLines,(C,X)=>(n(),l(T,{key:X},[C.tax_amount>0?(n(),l("div",{key:0,class:V(["tr",C.inclusive?"fct-customer-tax-row--muted":""])},[y(o(C.inclusive?e.$t("Included in %1$s",C.label):e.$t("Added on %1$s",C.label))+" ",1),a("span",null,o(i.formatOrderAmount(C.tax_amount)),1)],2)):p("",!0)],64))),128)):p("",!0),t.order.tax_summary.shippingTax>0&&i.customerTaxShouldShowBreakdown?(n(),l(T,{key:4},[t.order.tax_summary.shippingTaxLines&&t.order.tax_summary.shippingTaxLines.length?(n(!0),l(T,{key:0},E(t.order.tax_summary.shippingTaxLines,C=>(n(),l("div",{key:C.label,class:V(["tr",t.order.tax_summary.isShippingInclusive?"fct-customer-tax-row--muted":""])},[y(o(C.label)+" ",1),a("span",null,o(i.formatOrderAmount(C.shipping_tax)),1)],2))),128)):(n(),l("div",{key:1,class:V(["tr",t.order.tax_summary.isShippingInclusive?"fct-customer-tax-row--muted":""])},[y(o(t.order.tax_summary.isShippingInclusive?e.$t("Included in shipping prices"):e.$t("Added on shipping"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_summary.shippingTax)),1)],2))],64)):p("",!0),t.order.tax_summary.payableTax>0?(n(),l("div",Ph,[y(o(e.$t("Total payable tax"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_summary.payableTax)),1)])):p("",!0),t.order.tax_summary.inclusiveTax>0||t.order.tax_summary.inclusiveFeeTax>0?(n(),l("div",Ah,[y(o(e.$t("Total tax in this order"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_summary.totalOrderTax)),1)])):p("",!0)],64)):t.order.tax_total>0?(n(),l("div",Mh,[y(o(e.$t("Tax"))+" "+o(parseInt(t.order.tax_behavior)==2?e.$t("(Included)"):e.$t("(Excluded)"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.tax_total)),1)])):p("",!0),t.order.shipping_tax>0&&!(t.order.tax_summary&&t.order.tax_summary.shouldRender)?(n(),l("div",$h,[y(o(e.$t("Shipping Tax"))+" "+o(t.order.tax_behavior==2?e.$t("(Included)"):e.$t("(Excluded)"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.shipping_tax)),1)])):p("",!0),t.order.coupon_discount_total>0?(n(),l("div",Dh,[y(o(e.$t("Coupon Discount"))+" ",1),a("span",null,"-"+o(i.formatOrderAmount(t.order.coupon_discount_total)),1)])):p("",!0),t.order.manual_discount_total>0?(n(),l("div",Eh,[y(o(t.order.prorate_credit>0&&t.order.manual_discount_total-t.order.prorate_credit<=0?e.$t("Prorate Credit"):e.$t("Discount"))+" ",1),a("span",null,"-"+o(i.formatOrderAmount(t.order.manual_discount_total)),1)])):p("",!0),t.order.prorate_credit>0&&t.order.manual_discount_total-t.order.prorate_credit>0?(n(),l("div",Lh,[y(o(e.$t("Upgrade Discount"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.manual_discount_total-t.order.prorate_credit)),1)])):p("",!0),t.order.prorate_credit>0&&t.order.manual_discount_total-t.order.prorate_credit>0?(n(),l("div",Ih,[y(o(e.$t("Prorate Credit"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.prorate_credit)),1)])):p("",!0)])):p("",!0)]),a("footer",Vh,[a("div",Rh,[a("div",{class:"tr","aria-level":e.$t("Total amount for the order")},[y(o(e.$t("Total"))+" ",1),a("span",null,o(i.formatOrderAmount(t.order.total_amount-(t.order.tax_summary&&t.order.tax_summary.rcTotalAdjustment?t.order.tax_summary.rcTotalAdjustment:0))),1)],8,Bh)])])])])]),t.sectionParts.after_summary?(n(),l("div",{key:1,innerHTML:t.sectionParts.after_summary},null,8,Fh)):p("",!0)]),t.order.subscriptions&&t.order.subscriptions.length&&t.order.payment_status!=="pending"?(n(),l("article",Nh,[a("header",Uh,[a("h2",Oh,o(e.$t("Subscription Plan")),1)]),c(A,{hideHeader:!0,subscriptions:t.order.subscriptions},null,8,["subscriptions"]),t.sectionParts.after_subscriptions?(n(),l("div",{key:0,innerHTML:t.sectionParts.after_subscriptions},null,8,Hh)):p("",!0)])):p("",!0),t.order.downloads&&Object.entries(t.order.downloads).length&&t.order.payment_status!=="pending"?(n(),l("article",qh,[a("header",zh,[a("h2",jh,o(i.pluralizeTranslate("Download","Downloads",Object.entries(t.order.downloads).length)),1)]),c(R,{"show-table-header":!1,downloads:t.order.downloads},null,8,["downloads"]),t.sectionParts.after_downloads?(n(),l("div",{key:0,innerHTML:t.sectionParts.after_downloads},null,8,Yh)):p("",!0)])):p("",!0),t.order.licenses&&t.order.licenses.length?(n(),l("article",Kh,[a("header",Wh,[a("h2",Zh,o(i.pluralizeTranslate("License","Licenses",t.order.licenses.length)),1)]),c(q,{licenses:t.order.licenses,is_simple:!0,showTableHeader:!1},null,8,["licenses"]),t.sectionParts.after_licenses?(n(),l("div",{key:0,innerHTML:t.sectionParts.after_licenses},null,8,Gh)):p("",!0)])):p("",!0),i.visibleTransactions.length?(n(),l("article",Jh,[t.sectionParts.before_transactions?(n(),l("div",{key:0,innerHTML:t.sectionParts.before_transactions},null,8,Qh)):p("",!0),a("header",Xh,[a("h2",e_,o(e.$t("Related Transactions")),1)]),a("div",t_,[c(te,{transactions:i.visibleTransactions,"show-table-header":!0,onBillingAddressUpdated:i.orderBillingAddressUpdated},null,8,["transactions","onBillingAddressUpdated"])]),t.sectionParts.after_transactions?(n(),l("div",{key:1,innerHTML:t.sectionParts.after_transactions},null,8,s_)):p("",!0)])):p("",!0),t.order.billing_address_text||t.order.shipping_address_text?(n(),l("article",a_,[a("h2",r_,o(e.$t("Order addresses")),1),c(be,{gutter:30},{default:m(()=>[c(Q,{md:12,sm:24},{default:m(()=>[a("section",i_,[a("h3",n_,o(e.$t("Billing Address")),1),a("div",{class:"text",innerHTML:t.order.billing_address_text},null,8,o_)])]),_:1}),t.order.fulfillment_type=="physical"?(n(),S(Q,{key:0,md:12,sm:24},{default:m(()=>[a("section",l_,[a("h3",d_,o(e.$t("Shipping Address")),1),a("div",{class:"text",innerHTML:t.order.shipping_address_text},null,8,c_)])]),_:1})):p("",!0)]),_:1})])):p("",!0),t.sectionParts.end_of_order?(n(),l("div",{key:6,innerHTML:t.sectionParts.end_of_order},null,8,u_)):p("",!0)],64)):t.loading?(n(),l("div",m_,[c(se,{class:"mb-4","rows-range":[1,2,3]}),c(se,{class:"mb-4","rows-range":[1,2]}),c(se,{"rows-range":[1,2,3]})])):p("",!0)],8,$m)}const __=L(Mm,[["render",h_]]),p_={class:"fct-customer-app"},f_=Object.assign({name:"CustomerDashboardApp"},{__name:"App",setup(e){return(s,r)=>{const h=_("router-view");return n(),l("div",p_,[c(h)])}}});function b_(e){e.component(ae.name,ae),e.component(Ve.name,Ve),e.component(Re.name,Re),e.component(Be.name,Be),e.component(Me.name,Me),e.component(Fe.name,Fe),e.component($e.name,$e),e.component(Ne.name,Ne),e.component(De.name,De),e.component(Ue.name,Ue),e.component(Oe.name,Oe),e.component(He.name,He),e.component(qe.name,qe),e.component(ze.name,ze),e.component(je.name,je),e.component(Ye.name,Ye),e.component(Ke.name,Ke),e.component(We.name,We),e.component(Ze.name,Ze),e.component(Ge.name,Ge),e.component(Ie.name,Ie),e.component(Je.name,Je),e.component(Qe.name,Qe),e.component(Xe.name,Xe),e.component(et.name,et),e.component(tt.name,tt),e.component(st.name,st),e.component(at.name,at),e.component(rt.name,rt),e.component(it.name,it),e.component(nt.name,nt),e.component(ot.name,ot),e.component(lt.name,lt),e.component(dt.name,dt),e.component(ct.name,ct),e.component(ut.name,ut),e.component(mt.name,mt),e.component(ht.name,ht),e.component(_t.name,_t),e.component(pt.name,pt),e.component(ft.name,ft),e.component(bt.name,bt),e.component(yt.name,yt),e.component(gt.name,gt),e.component(vt.name,vt),e.component(wt.name,wt),e.component(Ee.name,Ee),e.component(kt.name,kt),e.config.globalProperties.$notify=ae,e.config.globalProperties.$confirm=de.confirm,e.config.globalProperties.$message=Pt}const y_=[{path:"/",name:"dashboard",component:fa,meta:{active_menu:"dashboard",title:b("Dashboard")}},{path:"/purchase-history",name:"purchase-history",component:Oa,meta:{active_menu:"purchase-history",title:b("Purchase History")}},{path:"/order",component:rc,children:[{name:"view_order",path:":order_id",component:__,props:!0,meta:{active_menu:"purchase-history",title:b("View Order")}}]},{path:"/subscriptions",name:"subscriptions",component:Yn,meta:{active_menu:"subscriptions",title:b("Subscriptions")}},{name:"view_subscription",path:"/subscription/:subscription_uuid",component:sc,props:!0,meta:{active_menu:"subscriptions",title:b("View Subscription")}},{path:"/downloads",name:"downloads",component:Kr,meta:{active_menu:"downloads",title:b("Downloads")}},{path:"/licenses",name:"licenses",component:Dr,meta:{active_menu:"licenses",title:b("Licenses")}},{name:"manage_license",path:"/licenses/:license_key/view",component:dn,props:!0,meta:{active_menu:"licenses",title:b("Manage License")}},{name:"reviews",path:"/reviews",component:sm,meta:{active_menu:"reviews",title:b("My Reviews")},beforeEnter:()=>{var e;return(e=window.fluentcart_customer_profile_vars)!=null&&e.reviews_enabled?!0:{path:"/"}}},{name:"profile",path:"/profile",component:uu,meta:{active_menu:"profile",title:b("Profile")}}],pe=rs({routes:y_,history:is(window.fluentcart_customer_profile_vars.app_slug)});pe.afterEach(e=>{var r;const s=(r=e.meta)==null?void 0:r.active_menu;if(document.querySelectorAll(".fct-customer-navs li").forEach(h=>{h.classList.remove("active_customer_menu")}),s){const h=document.querySelector(".fct-customer-nav-item-"+s);h&&h.classList.add("active_customer_menu")}});const ve=document.querySelectorAll("[data-fluent-cart-customer-profile-app]");if(ve&&ve.length>0){const e=ve[0],s=Wt({});b_(s),s.config.globalProperties.$notify=ae,s.config.globalProperties.$confirm=de.confirm,s.config.globalProperties.appVars=window.fluentcart_customer_profile_vars,s.directive("loading",us),s.mixin({methods:{$get:O.get,$post:O.post,$put:O.put,$del:O.delete,formatNumber(t,i=!0,d=!1,u=null){if(!t&&d)return"";const v=window.fluentcart_customer_profile_vars.shop,w=window.fluentcart_customer_profile_vars.currency_signs||{},k=u?String(u).toUpperCase():"",f=k&&w[k]?w[k]:v.currency_sign||"",x=v.currency_position;let g=window.fluentcart_customer_profile_vars.wp_locale.replace("_","-");const P=v.decimal_separator||null;P?g=P==="comma"?"de-DE":"en-US":g="en-US";let $=new Intl.NumberFormat(g,{minimumFractionDigits:2,maximumFractionDigits:2}).format(t?t/100:0);return $=Y($),i?x==="before"?`${f}${$}`:`${$}${f}`:$},$t:b,handleError(t){let i="";typeof t=="string"?i=t:t&&t.message?i=t.message:t&&t.data&&t.data.message&&(i=t.data.message),i||(i="Something is wrong!"),this.$notify({type:"error",title:b("Error"),offset:30,message:i,dangerouslyUseHTMLString:!0,duration:1e3})},handleSuccess(t){let i="Success";typeof t=="string"?i=t:t&&t.message?i=t.message:i=convertToText(t),i||(i="Success!"),this.$notify({type:"success",title:b("Success"),offset:30,message:i,dangerouslyUseHTMLString:!0,duration:1e3})},registerCopyAction(){Zt(()=>{document.querySelectorAll(".copyable-content").forEach(d=>{d.addEventListener("click",function(){const u=this.textContent;navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(u).then(()=>{}).catch(v=>{i(u)}):i(u)})});function i(d){let u=document.createElement("input");u.value=d,document.body.appendChild(u),u.select(),u.setSelectionRange(0,99999);try{document.execCommand("copy")}catch{}document.body.removeChild(u)}})},getAddress(t,i="billing",d=!1){if(!t)return"";let u=[];return!d&&t.name&&u.push(t.name),t.company_name&&u.push(t.company_name),t.address_1&&u.push(t.address_1),t.address_2&&u.push(t.address_2),t.city&&u.push(t.city),t.state&&u.push(t.state),t.postcode&&u.push(t.postcode),t.country&&u.push(t.country),t.phone&&u.push(t.phone),u.join(", ")||"No "+i+" address provided"},readableFileSize(t){if(!t&&t!==0)return"";const i=["Bytes","KB","MB","GB","TB"],d=Math.floor(Math.log2(t)/10);return`${+(t/1024**d).toFixed(2)} ${i[d]}`},formatDate:ts}});const r=window.fluentcart_customer_profile_vars.el_strings,h=window.fluentcart_customer_profile_vars.datei18;r.el.datepicker.weeks=Object.values(h.weekdaysShort),r.el.datepicker.months=Object.values(h.monthsShort),s.use(ms,{locale:r}),s.use(pe).component("app",f_).mount(e)}document.addEventListener("DOMContentLoaded",()=>{let e=window.fluentcart_customer_profile_vars.app_url;document.querySelectorAll("a.fct_route").forEach(s=>{s.addEventListener("click",r=>{const h=s.getAttribute("href");if(!h)return;const t=h.replace(e,"");try{if(pe.resolve(t).matched.length>0)return r.preventDefault(),pe.push(t),!0}catch{}})})});