1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[8670],{8670(e,s,a){a.r(s),a.d(s,{default:()=>b});var r=a(5043),l=a(3974),i=a(4980),t=a(6328),n=a(3390),c=a(1140),d=a(5949),o=a(2264),x=a(3340),h=a(4204),m=a(5440),u=a(2024),j=a(3639),f=a(764),p=a(8306),g=a(254),v=a(5621),N=a(579);const b=()=>{var e,s,a;const{user:b}=(0,l.As)(),y=(0,v.Zp)(),[w,A]=(0,r.useState)(null),[k,Z]=(0,r.useState)([]),[_,R]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!0),B="pro"===(null===b||void 0===b?void 0:b.subscription_tier)||"schools"===(null===b||void 0===b?void 0:b.subscription_tier);(0,r.useEffect)(()=>{B?W():S(!1)},[B]);const W=async()=>{try{const e=await i.A.get(`${l.nC}/affiliate/stats`);A(e.data),P()}catch(s){var e;404!==(null===(e=s.response)||void 0===e?void 0:e.status)&&t.oR.error("Could not load affiliate stats.")}finally{S(!1)}},P=async()=>{try{const e=await i.A.get(`${l.nC}/affiliate/conversions`);Z(e.data)}catch(e){}},T=e=>{if(!e)return"\u2014";return new Date(e).toLocaleDateString("en-AU")};return(0,N.jsxs)(h.A,{children:[(0,N.jsx)(m.A,{}),!B&&(0,N.jsx)("div",{className:"max-w-xl mx-auto mt-16",children:(0,N.jsxs)(c.Zp,{children:[(0,N.jsxs)(c.aR,{children:[(0,N.jsx)(c.ZB,{children:"Affiliate Programme"}),(0,N.jsx)(c.BT,{children:"The Affiliate Programme is available to Pro and Schools subscribers."})]}),(0,N.jsx)(c.Wu,{children:(0,N.jsx)(n.$,{onClick:()=>y("/subscription"),children:"View Plans"})})]})}),B&&(0,N.jsxs)("div",{className:"space-y-8 max-w-4xl mx-auto",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-orange-400 to-amber-500 flex items-center justify-center text-white",children:(0,N.jsx)(p.A,{className:"w-6 h-6"})}),(0,N.jsxs)("div",{className:"min-w-0",children:[(0,N.jsx)("h1",{className:"text-3xl font-bold",children:"Affiliate Programme"}),(0,N.jsxs)("p",{className:"text-muted-foreground mt-1",children:["Refer teachers and schools \u2014 earn free months. ",(0,N.jsxs)(v.N_,{to:"/mcm-affiliate-programme",className:"text-primary hover:underline inline-flex items-center gap-1",children:["How it works ",(0,N.jsx)(f.A,{className:"w-3 h-3"})]})]})]})]}),(0,N.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,N.jsxs)(c.Zp,{children:[(0,N.jsxs)(c.aR,{className:"flex flex-row items-center gap-3 pb-2",children:[(0,N.jsx)(p.A,{className:"w-5 h-5 text-primary"}),(0,N.jsx)(c.ZB,{className:"text-base",children:"Share your link"})]}),(0,N.jsx)(c.Wu,{className:"text-sm text-muted-foreground",children:"Copy your unique referral link and share it with colleagues."})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsxs)(c.aR,{className:"flex flex-row items-center gap-3 pb-2",children:[(0,N.jsx)(g.A,{className:"w-5 h-5 text-primary"}),(0,N.jsx)(c.ZB,{className:"text-base",children:"They subscribe"})]}),(0,N.jsx)(c.Wu,{className:"text-sm text-muted-foreground",children:"When a teacher subscribes to Pro using your link, you earn 1 month free."})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsxs)(c.aR,{className:"flex flex-row items-center gap-3 pb-2",children:[(0,N.jsx)(j.A,{className:"w-5 h-5 text-primary"}),(0,N.jsx)(c.ZB,{className:"text-base",children:"Refer a school"})]}),(0,N.jsx)(c.Wu,{className:"text-sm text-muted-foreground",children:"When a school signs up using your link, you earn 1 year free."})]})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsx)(c.aR,{children:(0,N.jsx)(c.ZB,{children:"Your Referral Link"})}),(0,N.jsx)(c.Wu,{className:"space-y-3",children:C?(0,N.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,N.jsx)(u.A,{className:"w-4 h-4 animate-spin"}),(0,N.jsx)("span",{children:"Loading\u2026"})]}):null!==w&&void 0!==w&&w.affiliate_link?(0,N.jsxs)("div",{className:"flex gap-2",children:[(0,N.jsx)(o.p,{readOnly:!0,value:w.affiliate_link,className:"font-mono text-sm"}),(0,N.jsx)(n.$,{onClick:()=>{null!==w&&void 0!==w&&w.affiliate_link&&(navigator.clipboard.writeText(w.affiliate_link),t.oR.success("Link copied to clipboard!"))},children:"Copy Link"})]}):(0,N.jsx)(n.$,{onClick:async()=>{R(!0);try{await i.A.post(`${l.nC}/affiliate/create-link`),await W(),t.oR.success("Affiliate link created!")}catch(a){var e,s;t.oR.error((null===(e=a.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.detail)||"Could not create affiliate link.")}finally{R(!1)}},disabled:_,children:_?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u.A,{className:"w-4 h-4 animate-spin mr-2"}),"Generating\u2026"]}):"Generate My Link"})})]}),(0,N.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,N.jsxs)(c.Zp,{children:[(0,N.jsx)(c.aR,{className:"pb-2",children:(0,N.jsx)(c.ZB,{className:"text-sm font-medium text-muted-foreground",children:"Pro Referrals"})}),(0,N.jsx)(c.Wu,{children:(0,N.jsx)("p",{className:"text-3xl font-bold",children:null!==(e=null===w||void 0===w?void 0:w.total_pro_referrals)&&void 0!==e?e:0})})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsx)(c.aR,{className:"pb-2",children:(0,N.jsx)(c.ZB,{className:"text-sm font-medium text-muted-foreground",children:"Schools Referrals"})}),(0,N.jsx)(c.Wu,{children:(0,N.jsx)("p",{className:"text-3xl font-bold",children:null!==(s=null===w||void 0===w?void 0:w.total_schools_referrals)&&void 0!==s?s:0})})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsx)(c.aR,{className:"pb-2",children:(0,N.jsx)(c.ZB,{className:"text-sm font-medium text-muted-foreground",children:"Total Credits Earned"})}),(0,N.jsx)(c.Wu,{children:(0,N.jsxs)("p",{className:"text-3xl font-bold",children:["$",(null!==(a=null===w||void 0===w?void 0:w.total_credits_earned_aud)&&void 0!==a?a:0).toFixed(2)," AUD"]}
1)})]})]}),(0,N.jsxs)(c.Zp,{children:[(0,N.jsx)(c.aR,{children:(0,N.jsx)(c.ZB,{children:"Conversion History"})}),(0,N.jsx)(c.Wu,{children:0===k.length?(0,N.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No referrals yet. Share your link to get started."}):(0,N.jsxs)(x.XI,{children:[(0,N.jsx)(x.A0,{children:(0,N.jsxs)(x.Hj,{children:[(0,N.jsx)(x.nd,{children:"Date"}),(0,N.jsx)(x.nd,{children:"Type"}),(0,N.jsx)(x.nd,{children:"Credit Applied"}),(0,N.jsx)(x.nd,{children:"Status"})]})}),(0,N.jsx)(x.BF,{children:k.map((e,s)=>{var a,r;return(0,N.jsxs)(x.Hj,{children:[(0,N.jsx)(x.nA,{children:T(e.converted_at)}),(0,N.jsx)(x.nA,{children:(r=e.subscription_type,"pro"===r?"Pro Subscription":"schools"===r?"Schools Licence":r)}),(0,N.jsxs)(x.nA,{children:["$",null===(a=e.credit_amount_aud)||void 0===a?void 0:a.toFixed(2)," AUD"]}),(0,N.jsx)(x.nA,{children:e.reward_applied?(0,N.jsx)(d.E,{className:"bg-primary/10 text-primary hover:bg-primary/10",children:"Credited"}):(0,N.jsx)(d.E,{variant:"secondary",children:"Pending"})})]},s)})})]})})]})]})]})}}}]); 2//# sourceMappingURL=8670.815def6d.chunk.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.