1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BlfwnloC.js","./Cpj98o6Y.js","./B9w3zTSJ.js","./DVpoESVk.js","./CmB3FgNx.js","./entry.CNm0TPlk.css"])))=>i.map(i=>d[i]); 2import{aQ as dt,E as O,G as R,_ as P,j as vt,z as at,x as wt,H as kt,Y as St,p as It,s as Ct,o as r,U as m,V as n,m as s,K as k,k as I,$ as Dt,X as _,ae as T,a3 as v,a4 as W,ac as Et,a5 as Pt,f as U,r as D,a9 as $t,c as At,W as it,v as Lt}from"./CmB3FgNx.js";import{_ as Nt}from"./mfRygQUJ.js";import{_ as Tt}from"./B2gYtxax.js";import{_ as Ut}from"./BTsrY6hS.js";import{U as Ot,C as Rt}from"./BKYCkjDp.js";import{u as zt}from"./CS_3Z4qf.js";import{f as Bt}from"./BYr6M-Xn.js";import{f as E,i as Ft}from"./DyexbcUr.js";import{u as Mt}from"./V0UaidaI.js";import"./DlAUqK2U.js";import"./BcBRrp0N.js";const ot="We couldn't cancel your subscription right now.",rt="We couldn't reactivate your subscription right now.";function jt(){const b=dt();async function x(o){if(!o)throw new Error("Missing subscription ID.");const a=O(),c=await R(a.POST("/v1/Paddle/cancel-authorize",{body:{subscriptionId:o}})).catch(d=>{throw console.warn("[cancel-authorize] request failed",d),new Error(ot)});if(c.status!==Rt.SubscriptionCancelled)throw console.warn("[cancel-authorize] non-success status",c.status,c.statusText),new Error(ot);await b.fetchSubscriptionData(!0)}async function y(o){if(!o)throw new Error("Missing subscription ID.");const a=O(),c=await R(a.POST("/v1/Paddle/undo-cancel-authorize",{body:{subscriptionId:o}})).catch(d=>{throw console.warn("[undo-cancel-authorize] request failed",d),new Error(rt)});if(c.status!==Ot.SubscriptionCancellationUndone)throw console.warn("[undo-cancel-authorize] non-success status",c.status,c.statusText),new Error(rt);await b.fetchSubscriptionData(!0)}return{cancelSubscription:x,reactivateSubscription:y}}const lt=Object.freeze({USD:"$",EUR:"â¬",GBP:"£",ARS:"$",AUD:"A$",BRL:"R$",CAD:"CA$",CHF:"CHF",CNY:"Â¥",COP:"$",CZK:"KÄ",DKK:"kr",HKD:"HK$",HUF:"Ft",ILS:"âª",INR:"â¹",JPY:"Â¥",KRW:"â©",MXN:"$",NOK:"kr",NZD:"NZ$",PLN:"zÅ",SEK:"kr",SGD:"S$",THB:"฿",TRY:"âº",TWD:"NT$",ZAR:"R"});function Vt(b){const x=b.customer??{},y=b.address??{};return{billing_address:{name:[x.first,x.last].filter(Boolean).join(" "),address1:y.addressLine1??"",city:y.city??"",province:y.region??y.regionCode??"",zip:y.postalCode??"",country:y.country??""},email:x.email??"",line_items:(b.items??[]).map(o=>{const a=o.quantity??1,c=o.subtotal??0;return{name:o.display??o.product??"",quantity:a,price:a?Math.round(c/a*100)/100:c}}),total_line_items_price:b.subtotal??0,total_discounts:b.discount??0,total_price:b.total??0}}async function Kt(b){const x=await P(()=>import("./BlfwnloC.js").then(a=>a.p),__vite__mapDeps([0,1]),import.meta.url),y=await P(()=>import("./B9w3zTSJ.js").then(a=>a.v),__vite__mapDeps([2,1]),import.meta.url),o=x.default??x;o.vfs=y.default??y,o.createPdf(b).open()}function ct(b){return new Date(b).toLocaleDateString("en-US")}function Yt(){const b=O();async function x(o){const a=await R(b.GET("/v1/Account/Order/{id}",{params:{path:{id:o}}}));if(!a)throw new Error("No order data found");if(a.sourceName==="FastSpring"&&a.orderData&&!a.orderData.billing_address){const l=a.orderData;(l.items?.length||l.customer)&&(a.orderData=Vt(l))}if(!a.orderData?.billing_address){await y(a);return}const c=lt[a.currency]??"$",d=l=>`${c}${(Number(l)||0).toFixed(2)}`,f=a.orderData,h=f.billing_address,S=[h.city,[h.province,h.zip].filter(Boolean).join(" ")].filter(l=>l&&l.trim()).join(", "),$=[h.name,h.address1,S,h.country,f.email].filter(l=>l&&l.trim()),z={content:[{columns:[{text:"RECEIPT",width:"65%",alignment:"left",fontSize:14,bold:!0},{text:"Pro Sound Effects",width:"35%",alignment:"right",fontSize:12,bold:!0,color:"#1D97FF"}],margin:[0,0,0,10]},{canvas:[{type:"line",x1:0,y1:0,x2:515,y2:0,color:"#000200"}],margin:[0,0,0,15]},{columns:[{width:"65%",stack:[{text:"To:",bold:!0,margin:[0,0,0,5]},...$.map((l,B)=>({text:l,margin:[0,0,0,B===$.length-1?0:5]}))]},{stack:[{text:"From:",bold:!0,margin:[0,0,0,5]},{text:"Pro Sound Effects",margin:[0,0,0,5]},{text:"240 Kent Avenue",margin:[0,0,0,5]},{text:"Brooklyn, NY 11249"}]}],columnGap:20,margin:[0,0,0,20]},{text:[{text:"Order Number:",bold:!0},` ${a.sourceId}`],margin:[0,0,0,5]},{text:[{text:"Date:",bold:!0},` ${ct(a.orderedOn)}`],margin:[0,0,0,10]},{canvas:[{type:"line",x1:0,y1:0,x2:515,y2:0,lineWidth:1,color:"#000200"}]},{table:{widths:["*","18%","18%","18%"],body:[[{text:"Description",bold:!0,style:"tableItem"},{text:"Quantity",bold:!0,style:"tableItem"},{text:"Unit Price",bold:!0,style:"tableItem"},{text:`Amount ${a.currency}`,bold:!0,style:"tableItem"}
2],...f.line_items.map(l=>[{text:l.name,style:"tableItem"},{text:l.quantity.toString(),style:"tableItem"},{text:d(l.price),style:"tableItem"},{text:d(l.quantity*Number(l.price)),style:"tableItem"}])]},layout:"lightHorizontalLines"},{canvas:[{type:"line",x1:0,y1:0,x2:515,y2:0,lineWidth:1,color:"#000200"}]},{columns:[{width:"*",text:""},{width:"27%",table:{body:[[{text:"Subtotal",style:"tableItem"},{text:d(f.total_line_items_price),style:"tableItem"}],[{text:"Discount"},{text:`${Number(f.total_discounts)>0?"-":""}${d(f.total_discounts)}`}],[{text:`Total ${a.currency}`,bold:!0,style:"tableItem"},{text:d(f.total_price),bold:!0,style:"tableItem"}]]},layout:"noBorders"}]}],styles:{tableItem:{margin:[0,15,0,15]}}};await Kt(z)}async function y(o){const a=lt[o.currency]??"$",c={content:[{columns:[{text:"RECEIPT",width:"65%",alignment:"left",fontSize:14,bold:!0},{text:"Pro Sound Effects",width:"35%",alignment:"right",fontSize:12,bold:!0,color:"#1D97FF"}],margin:[0,0,0,10]},{canvas:[{type:"line",x1:0,y1:0,x2:515,y2:0,color:"#000200"}],margin:[0,0,0,15]},{text:[{text:"Order Number:",bold:!0},` ${o.sourceId}`],margin:[0,0,0,5]},{text:[{text:"Date:",bold:!0},` ${ct(o.orderedOn)}`],margin:[0,0,0,5]},{text:[{text:"Status:",bold:!0},` ${o.status??"paid"}`],margin:[0,0,0,15]},{canvas:[{type:"line",x1:0,y1:0,x2:515,y2:0,lineWidth:1,color:"#000200"}],margin:[0,0,0,15]},{columns:[{width:"*",text:""},{width:"30%",table:{body:[[{text:`Total ${o.currency}`,bold:!0,style:"tableItem"},{text:`${a}${o.total}`,bold:!0,style:"tableItem"}]]},layout:"noBorders"}]},{text:"Pro Sound Effects · 240 Kent Avenue · Brooklyn, NY 11249",margin:[0,30,0,0],fontSize:9,color:"#888888"}],styles:{tableItem:{margin:[0,15,0,15]}}},d=await P(()=>import("./BlfwnloC.js").then(S=>S.p),__vite__mapDeps([0,1]),import.meta.url),f=await P(()=>import("./B9w3zTSJ.js").then(S=>S.v),__vite__mapDeps([2,1]),import.meta.url),h=d.default??d;h.vfs=f.default??f,h.createPdf(c).open()}return{generateInvoice:x}}const Wt={class:"flex flex-col gap-8"},Ht={key:0},Gt={class:"flex items-center justify-center rounded-xl border border-system-neutral-grey-40 bg-section-secondary-strength-1 p-12"},qt={key:1},Zt={key:2},Qt={class:"flex flex-col gap-6 rounded-lg bg-system-base-off-white p-6 sm:flex-row sm:items-start sm:justify-end"},Xt={class:"flex min-w-0 flex-1 items-start gap-6"},Jt={key:1,class:"flex size-[50px] shrink-0 items-center justify-center rounded-full bg-white shadow-md"},te={class:"flex min-w-0 flex-1 flex-col items-start"},ee={class:"flex flex-wrap items-center gap-3"},ne={class:"heading-6 text-text-dark-blue-10"},se={class:"mt-3 flex flex-col gap-3"},ae={key:0,class:"flex gap-5"},ie={class:"body-2 shrink-0 text-text-dark-blue-10 sm:w-32"},oe={class:"body-2-m text-text-dark-blue-10"},re={key:1,class:"flex gap-5"},le={class:"body-2-m text-text-dark-blue-10"},ce={key:2,class:"flex gap-5"},de={class:"body-2-m text-text-dark-blue-10"},ue={class:"mt-8 flex flex-wrap items-center gap-x-8 gap-y-3.5"},pe={key:0,class:"flex items-center justify-center py-12"},me={class:"hidden grid-cols-[1fr_120px_100px_200px] items-center gap-4 py-4 md:grid"},be={class:"body-2 truncate text-text-dark-blue-10"},ye={class:"body-2 text-text-grey-10"},xe={class:"body-2 text-text-dark-blue-10"},fe={class:"text-right"},ge=["disabled","onClick"],_e={class:"flex flex-col gap-6 px-3 py-4 md:hidden"},he=["aria-expanded","onClick"],ve={class:"body-1-s text-text-dark-blue-10"},we={class:"flex items-center justify-between"},ke={class:"body-2-m text-text-dark-blue-10"},Se={class:"flex items-center justify-between"},Ie={class:"body-2-m text-text-dark-blue-10"},Ce=["disabled","onClick"],De={key:0,class:"mt-6 flex justify-center"},Ee={key:2,class:"rounded-xl border border-system-neutral-grey-40 bg-section-secondary-strength-1 p-8 text-center"},H=10,Fe=vt({__name:"billing",async setup(b){let x,y;Mt("Billing & Orders");const o=O(),a=zt(),c=dt(),{currentSubscription:d,hasManagementUrls:f,isSubscriptionCancelled:h}=at(c),S=wt(),{subscription:$,lapsedSubscription:z,isActiveSubscriber:l}=at(S),B={month:"Monthly",year:"Yearly"},ut=e=>e==="year"?"year":"month",F=e=>e?B[e]??e:null,M=(e,t)=>typeof e=="number"?`${Bt(e,{isCents:!1})} / ${ut(t)}`:null,j={active:{statusLabel:"Active",statusClass:"bg-feedback-success-strength-2",dateLabel:"Renewal date:"},canceled:{statusLabel:"Canceled",statusClass:"bg-feedback-error-strength-2",dateLabel:"Expiration date:"},expired:{statusLabel:"Expired",statusClass:"bg-feedback-error-strength-2",dateLabel:"Expiration date:"},expiring:{statusLabel:"Active",statusClass:"bg-feedback-success-strength-2",dateLabel:"Expiration date:"}};function G(e,t){return c.data?.transactionData?.find(p=>p.sku===e&&p.interval===t)}const u=U(()=>{const e=d.value;if(e){const g=h.value?"canceled":"active";return{status:g,...j[g],name:e.name,artworkUrl:e.artworkUrl,dateText:E(g==="canceled"?e.scheduledChange?.effective_at:e.nextBilledAt),billingPeriod:F(e.interval),price:M(e.price,e.interval)}}const t=$.value;if(t&&l.value&&Ft(t.expiration)){const g=G(t.sku,t.billingInterval);return{status:"expiring",...j.expiring,name:t.name||"Your subscription",artworkUrl:g?.artworkUrl,dateText:E(t.expiration),billingPeriod:F(t.billingInterval),price:M(g?.price,t.billingInterval)}}const p=z.value;if(!p)return null;const N=G(p.sku,p.billingInterval);return{status:"expired",...j.expired,name:p.name||"Your subscription",artworkUrl:N?.artworkUrl,dateText:E(p.expiration),billingPeriod:F(p.billingInterval),price:M(N?.price,p.billingInterval)}}),V=D(!1),q=D(!1);kt(async()=>
2{if(!f.value){V.value=!0;try{const e=await c.fetchSubscriptionData(!0);q.value=e?!1:!await c.fetchSubscriptionData(!1)}finally{V.value=!1}}});const K=D(1),{data:pt,status:Z}=([x,y]=St(()=>At("account-billing-orders",()=>R(o.GET("/v1/Account/Billing-And-Orders",{})).catch(()=>[]),{server:!1,default:()=>[]})),x=await x,y(),x),A=U(()=>pt.value??[]),Q=U(()=>Math.max(1,Math.ceil(A.value.length/H))),mt=U(()=>{const e=(K.value-1)*H;return A.value.slice(e,e+H)});function X(e){const t=e.total?.trim();if(!t)return"â";const p=Number(t.replace(/,/g,""));if(Number.isNaN(p))return t;try{return new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency||"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(p)}catch{return`${p.toFixed(2)} ${e.currency??""}`.trim()}}const L=D(new Set);let J=!1;It(A,e=>{if(J||!e.length)return;const t=e[0]?.id;t&&(L.value=new Set([t])),J=!0},{immediate:!0});function bt(e){if(!e)return;const t=new Set(L.value);t.has(e)?t.delete(e):t.add(e),L.value=t}function Y(e){return e?L.value.has(e):!1}const w=D(null),{generateInvoice:yt}=Yt();async function tt(e){if(e.id){w.value=e.id;try{if(e.sourceName==="Shopify"||e.sourceName==="FastSpring"){await yt(e.id);return}if(e.invoiceUrl){window.open(e.invoiceUrl,"_blank");return}const{url:t}=await $fetch(`/api/paddle/invoices/${e.id}`);window.open(t,"_blank")}catch(t){console.error("[Billing] Failed to fetch invoice:",t),a.error("Could not download the invoice. Please try again.")}finally{w.value=null}}}const et=Ct(),{cancelSubscription:xt,reactivateSubscription:ft}=jt(),nt=Lt(()=>P(()=>import("./DVpoESVk.js"),__vite__mapDeps([3,4,5]),import.meta.url));function gt(){const e=d.value?.id;e&&et.open(nt,{title:"Are you sure you want to cancel your current Subscription?",onConfirm:()=>xt(e)})}function _t(){const e=d.value?.id;e&&et.open(nt,{title:"Resubscribe Subscription",body:"Clicking confirm will reactivate your subscription and resume billing immediately.",onConfirm:()=>ft(e)})}return(e,t)=>{const p=Nt,N=Tt,g=Dt,C=$t,ht=Ut;return r(),m("div",Wt,[t[13]||(t[13]=n("div",null,[n("h1",{class:"heading-4 mb-3 text-text-dark-blue-10"},"Billing & Orders"),n("p",{class:"body-2 text-text-grey-10"}," View your current subscription, billing history, and invoices. ")],-1)),s(V)?(r(),m("section",Ht,[t[1]||(t[1]=n("h2",{class:"heading-5 mb-4 text-text-dark-blue-10"},"Current Subscription",-1)),n("div",Gt,[k(p)])])):s(q)?(r(),m("section",qt,[...t[2]||(t[2]=[n("h2",{class:"heading-5 mb-4 text-text-dark-blue-10"},"Current Subscription",-1),n("div",{class:"rounded-xl border border-system-neutral-grey-40 bg-section-secondary-strength-1 p-8 text-center"},[n("p",{class:"body-1-s text-text-dark-blue-10"}
2,"We couldn't load your subscription"),n("p",{class:"body-2 mt-2 text-text-grey-10"}," Refresh the page. If it keeps happening, get in touch and we'll sort it out. ")],-1)])])):s(u)?(r(),m("section",Zt,[t[5]||(t[5]=n("h2",{class:"heading-5 mb-4 text-text-dark-blue-10"},"Current Subscription",-1)),n("div",Qt,[n("div",Xt,[s(u).artworkUrl?(r(),I(N,{key:0,src:s(u).artworkUrl,alt:s(u).name,width:"50",height:"50",class:"size-[50px] shrink-0 rounded-lg object-cover"},null,8,["src","alt"])):(r(),m("span",Jt,[k(g,{name:"ui:ticket",class:"size-7 text-action-primary-btn-default"})])),n("div",te,[n("div",ee,[n("h3",ne,_(s(u).name),1),n("span",{class:T(["rounded-full px-3 py-1 text-xs leading-4 text-section-base-invert",s(u).statusClass])},_(s(u).statusLabel),3)]),n("dl",se,[s(u).dateText?(r(),m("div",ae,[n("dt",ie,_(s(u).dateLabel),1),n("dd",oe,_(s(u).dateText),1)])):v("",!0),s(u).billingPeriod?(r(),m("div",re,[t[3]||(t[3]=n("dt",{class:"body-2 shrink-0 text-text-dark-blue-10 sm:w-32"},"Billing Period:",-1)),n("dd",le,_(s(u).billingPeriod),1)])):v("",!0),s(u).price?(r(),m("div",ce,[t[4]||(t[4]=n("dt",{class:"body-2 shrink-0 text-text-dark-blue-10 sm:w-32"},"Price:",-1)),n("dd",de,_(s(u).price),1)])):v("",!0)]),n("div",ue,[s(u).status==="canceled"?(r(),I(C,{key:0,label:"Resubscribe",size:"sm",onClick:_t})):s(u).status==="active"?(r(),I(C,{key:1,label:"Change Plans",size:"sm",to:"/pricing"})):(r(),I(C,{key:2,label:"Resubscribe",size:"sm",to:"/pricing"})),s(d)?.managementUrls?.update_payment_method?(r(),I(C,{key:3,label:"Update Payment Method",variant:"tertiary",size:"sm",class:"-ml-4",href:s(d).managementUrls.update_payment_method,target:"_blank"},null,8,["href"])):v("",!0)])])]),s(u).status==="active"?(r(),I(C,{key:0,label:"Cancel Subscription",variant:"tertiary",size:"sm",class:"shrink-0",onClick:gt})):v("",!0)])])):v("",!0),n("section",null,[t[12]||(t[12]=n("h2",{class:"heading-5 mb-4 text-text-dark-blue-10"},"Order History",-1)),s(Z)==="pending"||s(Z)==="idle"?(r(),m("div",pe,[k(p)])):s(A).length?(r(),m(W,{key:1},[t[10]||(t[10]=Et('<div class="hidden grid-cols-[1fr_120px_100px_200px] gap-4 border-b border-system-neutral-grey-40 pb-3 md:grid"><span class="body-2 font-semibold text-text-grey-10">Order</span><span class="body-2 font-semibold text-text-grey-10">Date</span><span class="body-2 font-semibold text-text-grey-10">Total</span><span class="body-2 text-right font-semibold text-text-grey-10">Invoice</span></div>',1)),(r(!0),m(W,null,Pt(s(mt),i=>(r(),m("div",{key:i.id??"",class:"border-b border-system-neutral-grey-40"},[n("div",me,[n("span",be,_(i.invoiceNumber||i.id),1),n("span",ye,_(s(E)(i.orderedOn)),1),n("span",xe,_(X(i)),1),n("div",fe,[i.id?(r(),m("button",{key:0,type:"button",class:"body-2 inline-flex items-center gap-3 whitespace-nowrap font-semibold text-action-primary-blue-10 transition-colors hover:text-action-primary-blue-20 disabled:opacity-60",disabled:s(w)===i.id,onClick:st=>tt(i)},[t[6]||(t[6]=it(" Download Invoice ",-1)),k(g,{name:s(w)===i.id?"lucide:loader-2":"ui:download-invoice",class:T(["size-6 shrink-0",{"animate-spin":s(w)===i.id}]),"aria-hidden":""},null,8,["name","class"])],8,ge)):v("",!0)])]),n("div",_e,[n("button",{type:"button",class:"flex w-full items-center justify-between","aria-expanded":Y(i.id),onClick:st=>bt(i.id)},[n("span",ve,_(i.invoiceNumber||i.id),1),k(g,{name:"lucide:chevron-down",class:T(["size-6 shrink-0 text-action-primary-blue-10 transition-transform duration-200",{"rotate-180":Y(i.id)}]),"aria-hidden":""},null,8,["class"])],8,he),Y(i.id)?(r(),m(W,{key:0},[n("div",we,[t[7]||(t[7]=n("span",{class:"body-2 text-text-grey-10"},"Date",-1)),n("span",ke,_(s(E)(i.orderedOn)),1)]),n("div",Se,[t[8]||(t[8]=n("span",{class:"body-2 text-text-grey-10"},"Total",-1)),n("span",Ie,_(X(i)),1)]),i.id?(r(),m("button",{key:0,type:"button",class:"body-2 inline-flex w-full items-center justify-center gap-2 rounded-lg border border-action-primary-blue-10 py-2 font-semibold text-action-primary-blue-10 transition-colors hover:border-action-primary-blue-20 hover:text-action-primary-blue-20 disabled:opacity-60",disabled:s(w)===i.id,onClick:st=>tt(i)},[t[9]||(t[9]=it(" Download Invoice ",-1)),k(g,{name:s(w)===i.id?"lucide:loader-2":"ui:download-invoice",class:T(["size-6 shrink-0",{"animate-spin":s(w)===i.id}]),"aria-hidden":""},null,8,["name","class"])],8,Ce)):v("",!0)],64)):v("",!0)])]))),128)),s(Q)>1?(r(),m("div",De,[k(ht,{page:s(K),"total-pages":s(Q),"onUpdate:page":t[0]||(t[0]=i=>K.value=i)},null,8,["page","total-pages"])])):v("",!0)],64)):(r(),m("div",Ee,[k(g,{name:"lucide:receipt",class:"mx-auto mb-3 size-10 text-gray-300"}),t[11]||(t[11]=n("p",{class:"body-1-s text-text-grey-10"},"No orders yet",-1))]))])])}}});
2export{Fe as default}; 3//# sourceMappingURL=CDGPli0_.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.