1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[230],{26622:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/commercial-license/history",function(){return r(86542)}])},99606:function(e,t,r){"use strict";r.d(t,{z:function(){return a}});var n=r(85893);r(67294);let a=e=>{let{href:t,variant:r="primary",children:a,className:s="",onClick:c,disabled:i=!1,type:o="button"}=e,m="".concat("px-6 py-3 rounded-lg font-medium transition-colors duration-200 inline-block text-center"," ").concat({primary:"bg-theme-secondary text-white hover:bg-theme-secondary-dark",secondary:"bg-theme-text-primary text-theme-surface hover:bg-theme-text-secondary",outline:"border-2 border-theme-text-primary text-theme-text-primary hover:bg-theme-text-primary hover:text-theme-surface",ghost:"bg-transparent border-2 border-theme-secondary text-theme-text-inverse hover:bg-theme-secondary/20 backdrop-blur-sm"}[r]," ").concat(i?"opacity-50 cursor-not-allowed":""," ").concat(s);return t?(0,n.jsx)("a",{href:t,className:m,children:a}):(0,n.jsx)("button",{type:o,className:m,onClick:c,disabled:i,children:a})}},7376:function(e,t,r){"use strict";r.d(t,{H:function(){return i}});var n=r(85893),a=r(9008),s=r.n(a),c=r(34155);function i(e){let{title:t,description:r,canonical:a,ogImage:i="/og-image.jpg",ogType:o="website",twitterCard:m="summary_large_image",keywords:l,noindex:d=!1}
1=e,x=c.env.NEXT_PUBLIC_BASE_PATH||"",h="https://duneweaver.com",u=a?"".concat(h).concat(a):h,p=i.startsWith("http")?i:"".concat(h).concat(x).concat(i);return(0,n.jsxs)(s(),{children:[(0,n.jsx)("title",{children:t}),(0,n.jsx)("meta",{name:"description",content:r}),(0,n.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),l&&(0,n.jsx)("meta",{name:"keywords",content:l}),d&&(0,n.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,n.jsx)("link",{rel:"canonical",href:u}),(0,n.jsx)("meta",{property:"og:type",content:o}),(0,n.jsx)("meta",{property:"og:title",content:t}),(0,n.jsx)("meta",{property:"og:description",content:r}),(0,n.jsx)("meta",{property:"og:url",content:u}),(0,n.jsx)("meta",{property:"og:image",content:p}),(0,n.jsx)("meta",{property:"og:site_name",content:"Dune Weaver"}),(0,n.jsx)("meta",{name:"twitter:card",content:m}),(0,n.jsx)("meta",{name:"twitter:title",content:t}),(0,n.jsx)("meta",{name:"twitter:description",content:r}),(0,n.jsx)("meta",{name:"twitter:image",content:p}),(0,n.jsx)("meta",{name:"author",content:"Dune Weaver"}),(0,n.jsx)("meta",{name:"theme-color",content:"#d97706"})]})}},30455:function(e,t,r){"use strict";r.d(t,{$:function(){return a}});var n=r(85893);r(67294);let a=e=>{let{id:t,className:r="",children:a,background:s="white",hero:c=!1}=e;return(0,n.jsx)("section",{id:t,className:"".concat(c?"pt-0 pb-12 md:pt-8 md:pb-24":"py-12 md:py-24"," ").concat({white:"bg-theme-background",gray:"bg-theme-background-alt",sand:"bg-theme-background-sand"}[s]," ").concat(r),children:(0,n.jsx)("div",{className:"container mx-auto px-4 md:px-6 max-w-7xl",children:a})})}},46238:function(e,t,r){"use strict";r.d(t,{Qj:function(){return n},Zm:function(){return s},rT:function(){return c},sA:function(){return a}});let n={"dwp-commercial":{key:"dwp-commercial",tableName:"Dune Weaver Pro",productCode:"DWP",defaultPriceUsdCents:7500},"dwmp-commercial":{key:"dwmp-commercial",tableName:"Dune Weaver Mini Pro",productCode:"DWMP",defaultPriceUsdCents:3500},"dwg-commercial":{key:"dwg-commercial",tableName:"Dune Weaver Gold",productCode:"DWG",defaultPriceUsdCents:5500}},a=Object.keys(n),s=["cad","usd","eur"],c=3},86542:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return y}});var n=r(85893),a=r(67294),s=r(41664),c=r.n(s),i=r(11163),o=r(25346),m=r(82210),l=r(30455),d=r(7376),x=r(99606),h=r(95770),u=r(10246),p=r(42706),j=r(46238);function g(e,t){return(0,p.p)(e/100,t)}function y(){let e=(0,i.useRouter)(),{user:t,loading:r}=(0,h.a)(),[s,p]=(0,a.useState)({status:"loading"}),[y,b]=(0,a.useState)(null),[f,v]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(r)return;if(!t){p({status:"unauthenticated"});return}let e=!1;return(async()=>{try{if(!(null===u.I8||void 0===u.I8?void 0:u.I8.currentUser)){p({status:"unauthenticated"});return}let t=await u.I8.currentUser.getIdToken(),r=await fetch("/api/commercial-license/me",{headers:{Authorization:"Bearer ".concat(t)}});if(e)return;if(404===r.status){p({status:"not-enlisted"});return}if(!r.ok){let e=await r.json().catch(()=>({}));p({status:"error",message:e.error||"Could not load history (".concat(r.status,").")});return}let[n,a]=await Promise.all([fetch("/api/commercial-license/agreements",{headers:{Authorization:"Bearer ".concat(t)}}),fetch("/api/commercial-license/purchases",{headers:{Authorization:"Bearer ".concat(t)}})]);if(e)return;let s=n.ok&&(await n.json()).agreements||[],c=a.ok&&(await a.json()).purchases||[];p({status:"ready",agreements:s,purchases:c})}catch(t){if(e)return;p({status:"error",message:t instanceof Error?t.message:"Could not load history."})}})(),()=>{e=!0}},[t,r]);let N=async e=>{b(e),v(null);try{if(!(null===u.I8||void 0===u.I8?void 0:u.I8.currentUser))throw Error("Not signed in");let t=await u.I8.currentUser.getIdToken(),r=await fetch("/api/commercial-license/agreement.pdf?agreementNumber=".concat(encodeURIComponent(e)),{headers:{Authorization:"Bearer ".concat(t)}});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||"Failed to download PDF")}let n=await r.blob(),a=URL.createObjectURL(n),s=document.createElement("a");s.href=a,s.download="dune-weaver-commercial-license-".concat(e,".pdf"),document.body.appendChild(s),s.click(),s.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}catch(e){v(e instanceof Error?e.message:"Download failed")}finally{b(null)}},w=(0,n.jsx)(d.H,{title:"Commercial License History â Dune Weaver",description:"Past agreements and purchase invoices for the Dune Weaver Commercial License.",canonical:"/commercial-license/history",noindex:!0});if(r||"loading"===s.status)return(0,n.jsxs)(n.Fragment,{children:[w,(0,n.jsx)(o.h,{}),(0,n.jsx)("main",{className:"min-h-screen pt-16",children:(0,n.jsx)(l.$,{background:"sand",hero:!0,children:(0,n.jsx)("div",{className:"max-w-2xl mx-auto text-center py-12",children:(0,n.jsx)("p",{className:"text-theme-text-secondary",children:"Loadingâ¦"})})})}),(0,n.jsx)(m.$,{})]});if("unauthenticated"===s.status)return(0,n.jsxs)(n.Fragment,{children:[w,(0,n.jsx)(o.h,{}),(0,n.jsx)("main",{className:"min-h-screen pt-16",children:(0,n.jsx)(l.$,{background:"sand",hero:!0,children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto bg-theme-surface rounded-xl p-6 md:p-8 shadow-md border border-theme-border-light text-center",children:[(0,n.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-theme-text-primary mb-4",children:"Sign in to view history"}),(0,n.jsx)("p",{className:"text-theme-text-secondary mb-6 leading-relaxed",children:"Your past agreements and invoices are tied to your Dune Weaver account."}),(0,n.jsx)(x.z,{onClick:()=>e.push("/auth/signin?redirect=".concat(encodeURIComponent("/commercial-license/history"))),children:"Sign in"})]})})}),(0,n.jsx)(m.$,{})]});if("not-enlisted"===s.status)return(0,n.jsxs)(n.Fragment,{children:[w,(0,n.jsx)(o.h,{}),(0,n.jsx)("main",{className:"min-h-screen pt-16",children:(0,n.jsx)(l.$,{background:"sand",hero:!0,children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto bg-theme-surface rounded-xl p-6 md:p-8 shadow-md border border-theme-border-light text-center",children:[(0,n.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-theme-text-primary mb-4",children:"By invitation only"}),(0,n.jsx)("p",{className:"text-theme-text-secondary mb-6 leading-relaxed",children:"The Dune Weaver Commercial License program is currently invite-only. Thereâs nothing to display in your history."}),(0,n.jsx)(x.z,{href:"mailto:[email protected]?subject=Commercial%20License%20Request",children:"Email Tuan"})]})})}),(0,n.jsx)(m.$,{})]});if("error"===s.status)return(0,n.jsxs)(n.Fragment,{children:[w,(0,n.jsx)(o.h,{}),(0,n.jsx)("main",{className:"min-h-screen pt-16",children:(0,n.jsx)(l.$,{background:"sand",hero:!0,children:(0,n.jsxs)("div",{className:"max-w-2xl mx-auto bg-theme-surface rounded-xl p-6 md:p-8 shadow-md border border-theme-border-light text-center",children:[(0,n.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-theme-text-primary mb-4",children:"Something went wrong"}),(0,n.jsx)("p",{className:"text-theme-text-secondary leading-relaxed",children:s.message})]})})}),(0,n.jsx)(m.$,{})]});let{agreements:k,purchases:C}=s;return(0,n.jsxs)(n.Fragment,{children:[w,(0,n.jsx)(o.h,{}),(0,n.jsxs)("main",{className:"min-h-screen pt-16",children:[(0,n.jsx)(l.$,{background:"sand",hero:!0,children:(0,n.jsxs)("div",{className:"max-w-4xl mx-auto",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-3",children:[(0,n.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-theme-text-primary",children:"Commercial License History"}),(0,n.jsx)(c(),{href:"/commercial-license",className:"text-sm text-theme-secondary hover:text-theme-secondary-dark underline",children:"â Back to purchase"})]}),(0,n.jsx)("p",{className:"text-theme-text-secondary leading-relaxed",children:"All your signed agreements and paid commercial license invoices in one place. Download for your records."})]})}),(0,n.jsx)(l.$,{background:"white",children:(0,n.jsxs)("div",{className:"max-w-4xl mx-auto
1space-y-8",children:[(0,n.jsxs)("div",{className:"bg-theme-surface rounded-xl p-6 md:p-8 shadow-md border border-theme-border-light",children:[(0,n.jsxs)("h2",{className:"text-xl md:text-2xl font-bold text-theme-text-primary mb-1",children:["Agreements (",k.length,")"]}),(0,n.jsx)("p",{className:"text-sm text-theme-text-secondary mb-4",children:"Your active and past Commercial License agreements."}),0===k.length?(0,n.jsx)("p",{className:"text-sm text-theme-text-tertiary",children:"No agreements on file yet."}):(0,n.jsx)("ul",{className:"divide-y divide-theme-border-light",children:k.map(e=>(0,n.jsxs)("li",{className:"py-3 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm",children:[(0,n.jsx)("span",{className:"font-mono font-semibold text-theme-text-primary",children:e.agreementNumber}),(0,n.jsxs)("span",{className:"text-theme-text-secondary",children:[" ","â signed ",new Date(e.signedAt).toLocaleDateString(),", valid through"," ",new Date(e.expiresAt).toLocaleDateString()]})]}),(0,n.jsxs)("p",{className:"text-xs text-theme-text-tertiary mt-0.5",children:[e.expired?(0,n.jsx)("span",{children:"Expired"}):(0,n.jsx)("span",{className:"text-green-700",children:"Active"}),e.companyName&&(0,n.jsxs)(n.Fragment,{children:[" \xb7 ",e.companyName]})]})]}),(0,n.jsx)("button",{type:"button",onClick:()=>N(e.agreementNumber),disabled:y===e.agreementNumber,className:"text-sm text-theme-secondary hover:text-theme-secondary-dark underline disabled:opacity-50",children:y===e.agreementNumber?"Preparingâ¦":"Download PDF"})]},e.agreementNumber))}),f&&(0,n.jsx)("p",{className:"text-sm text-red-600 mt-3",children:f})]}),(0,n.jsxs)("div",{className:"bg-theme-surface rounded-xl p-6 md:p-8 shadow-md border border-theme-border-light",children:[(0,n.jsxs)("h2",{className:"text-xl md:text-2xl font-bold text-theme-text-primary mb-1",children:["Paid invoices (",C.length,")"]}),(0,n.jsx)("p",{className:"text-sm text-theme-text-secondary mb-4",children:"Stripe-generated invoices for every commercial license youâve purchased."}),0===C.length?(0,n.jsx)("p",{className:"text-sm text-theme-text-tertiary",children:"No purchases yet."}):(0,n.jsx)("ul",{className:"divide-y divide-theme-border-light",children:C.map(e=>{let t=e.items.map(e=>{let t=j.Qj[e.key],r=(null==t?void 0:t.productCode)||e.key;return"".concat(e.quantity,"\xd7 ").concat(r)}).join(", "),r=new Date(e.paidAt||e.createdAt).toLocaleDateString(),a="paid"===e.status&&null!=e.paidAmount&&e.paidCurrency?g(Math.round(100*e.paidAmount),e.paidCurrency.toLowerCase()):g(Math.round(100*e.totalAmountUsd),"usd");return(0,n.jsxs)("li",{className:"py-3 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm",children:[(0,n.jsx)("span",{className:"font-medium text-theme-text-primary",children:r}),(0,n.jsxs)("span",{className:"text-theme-text-secondary",children:[" \xb7 ",t]})]}),(0,n.jsxs)("p",{className:"text-xs text-theme-text-tertiary mt-0.5",children:[a,e.stripeInvoiceNumber&&(0,n.jsxs)(n.Fragment,{children:[" ","\xb7 Invoice"," ",(0,n.jsx)("span",{className:"font-mono",children:e.stripeInvoiceNumber})]}),e.agreementNumber&&(0,n.jsxs)(n.Fragment,{children:[" ","\xb7 Agreement"," ",(0,n.jsx)("span",{className:"font-mono",children:e.agreementNumber})]})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-3 text-sm",children:[e.invoicePdfUrl&&(0,n.jsx)("a",{href:e.invoicePdfUrl,target:"_blank",rel:"noopener noreferrer",className:"text-theme-secondary hover:text-theme-secondary-dark underline",children:"Download invoice"}),e.hostedInvoiceUrl&&(0,n.jsx)("a",{href:e.hostedInvoiceUrl,target:"_blank",rel:"noopener noreferrer",className:"text-theme-secondary hover:text-theme-secondary-dark underline",children:"View invoice"}),!e.invoicePdfUrl&&!e.hostedInvoiceUrl&&(0,n.jsx)("span",{className:"text-theme-text-tertiary text-xs",children:"Invoice not available"})]})]},e.id)})})]})]})})]}),(0,n.jsx)(m.$,{})]})}},11163:function(e,t,r){e.exports=r(43079)}},function(e){e.O(0,[959,5346,2210,2888,9774,179],function(){return e(e.s=26622)}),_N_E=e.O()}]);
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.