1import{a as te}from"./chunk-7IL5ICFA.js";import{a as ee}from"./chunk-JMVUUNJZ.js";import{a as Q,b as X}from"./chunk-I64KL7UV.js";import{a as K}from"./chunk-ZGVQJ6DH.js";import{a as O,m as Z}from"./chunk-PSH5TAI2.js";import"./chunk-W3NUKB7B.js";import"./chunk-KJJHSOFJ.js";import"./chunk-USN3IUD3.js";import"./chunk-AZUCPPFK.js";import"./chunk-SGQORKKV.js";import"./chunk-ZBQW7NJG.js";import"./chunk-C6O6I5LW.js";import"./chunk-O2P25Q5F.js";import{d as q,ja as J}from"./chunk-TPCL2XMH.js";import"./chunk-WRBQWUEI.js";import{k as W}from"./chunk-KSTBAVB4.js";import{$b as B,Ab as i,Bb as o,Bd as G,Cb as m,D as S,Ec as N,H as y,Lb as V,Ma as E,N as w,Na as v,Nb as U,P as k,Pb as s,Ra as r,Z as h,_c as $,ac as a,cc as f,da as P,ea as T,eb as C,oc as F,pa as g,qa as A,sb as p,sc as x,sd as z,tb as I,tc as H,ub as u,uc as L,ud as j,v as b,vd as Y,wb as R,xb as M,yb as D,zb as l}from"./chunk-P2OBJROK.js";import"./chunk-IZQOVDKO.js";import"./chunk-6IZLXKZM.js";function oe(e,d){if(e&1&&m(0,"nbm-perk",1),e&2){let t=d.$implicit,n=s();l("perkType",n.convertPerkType(t.perkType))("typeSlug","secondary")}}var ie=(()=>{class e{constructor(){this.voucher=N(void 0)}convertPerkType(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase().substring(1)}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=C({type:e,selectors:[["nbm-included-in-affiliate-package"]],inputs:{voucher:[1,"voucher"]},decls:3,vars:1,consts:[[3,"title"],[1,"g-col-12",3,"perkType","typeSlug"]],template:function(n,c){n&1&&(i(0,"nbm-whats-included-wrapper",0),M(1,oe,1,2,"nbm-perk",1,R),o()),n&2&&(l("title",c.voucher().perks.length>0?"Included in your NB Dashboard access":""),r(),D(c.voucher().perks))},dependencies:[Q,X],encapsulation:2})}}return e})();var ae=()=>["h-35-max justify-content-center d-grid border-bottom border-5 border-0 border bg-secondary border-warning"];function re(e,d){if(e&1&&(i(0,"div",11),m(1,"span",13),i(2,"h3",14),a(3,"Success"),o(),i(4,"h4"),a(5,"Your voucher has been redeemed"),o(),i(6,"p",15),a(7),o(),i(8,"p")(9,"a",16),a(10,"Go to NB Medical Dashboard"),o()()()),e&2){let t=s(3);r(7),f(" You will be automatically redirected to the dashboard in ",t.countdownSeconds()," seconds "),r(2),l("href",t.dashboardUrl,v)}}function de(e,d){e&1&&(i(0,"div",19)(1,"p"),a(2,"There was an error redeeming your voucher."),o(),i(3,"p"),a(4,"Please contact your administrator."),o()())}function ce(e,d){e&1&&(i(0,"div",20)(1,"div",22)(2,"span",23),a(3,"Loading..."),o()(),i(4,"h4",24),a(5,"Redeeming your voucher..."),o(),i(6,"p",25),a(7,"Please wait while we process your voucher redemption."),o()())}function se(e,d){if(e&1){let t=V();i(0,"button",26),U("click",function(){P(t);let c=s(3),_=s();return T(_.redeemVoucher(c))}),a(1,"Redeem Voucher"),o()}}function le(e,d){e&1&&(i(0,"div",27),m(1,"span",28),i(2,"p"),a(3," This voucher has already been redeemed. If you think this is an error, please contact your administrator. "),o()())}function me(e,d){if(e&1&&(i(0,"p")(1,"a",16),a(2,"Go to NB Medical Dashboard"),o()()),e&2){let t=s(5);r(),l("href",t.dashboardUrl,v)}}function pe(e,d){if(e&1&&(p(0,le,4,0,"div",27),p(1,me,3,1,"p")),e&2){let t=s(4);u(t.redeeming()?-1:0),r(),u(t.redeeming()?-1:1)}}function ue(e,d){if(e&1&&(i(0,"div",12)(1,"h2",17),a(2,"Redeem your voucher"),o(),i(3,"div",18),p(4,de,5,0,"div",19),p(5,ce,8,0,"div",20),p(6,se,2,0,"button",21)(7,pe,2,2),o()()),e&2){let t=s(2),n=s();r(4),u(n.showFailure()?4:-1),r(),u(n.redeeming()?5:-1),r(),u(!n.redeeming()&&!t.redeemed?6:7)}}function fe(e,d){if(e&1&&p(0,re,11,2,"div",11)(1,ue,8,3,"div",12),e&2){let t=s(2);u(t.showSuccess()?0:1)}}function he(e,d){if(e&1&&(i(0,"h4",29),a(1,"How to get access"),o(),i(2,"p"),a(3),o(),i(4,"p"),a(5),o(),i(6,"div",12)(7,"h2",17),a(8,"Register to redeem your voucher."),o(),i(9,"div",30)(10,"button",31),a(11,"Access"),o()()(),i(12,"h5",32),m(13,"span",33),a(14,"You must be registered and logged in to get access "),o()),e&2){let t=s();r(3),f("It is easy to gain access to the ",t.name," package."),r(2),f(" Simply click on the 'Access' button below to log in or register and we will add the ",t.name," package to your account . ")}}function ge(e,d){if(e&1&&(i(0,"nbm-site-page",0)(1,"nbm-jumbotron",1)(2,"div",2)(3,"div")(4,"h1"),a(5),o(),i(6,"p",3),m(7,"span",4),a(8),o()()()(),i(9,"div",5)(10,"div",6)(11,"div",7),m(12,"div",8),x(13,"safe"),m(14,"nbm-included-in-affiliate-package",9),o(),i(15,"div",10),p(16,fe,2,1),x(17,"async"),I(18,he,15,2),o()()()()),e&2){let t,n=d,c=s();l("noticeHidden",!0)("fullWidth",!0)("hideHeader",!0),r(),l("additionalClasses",F(16,ae)),r(2),B("text-white ps-3 mb-3 border border-5 position-relative border-0 border-start border-warning"),r(2),f(" ",n.name," "),r(3),f(" This package is available for all members of the ",n.name," "),r(4),l("innerHTML",L(13,11,n.packageDescription,"html"),E),r(2),l("voucher",n),r(2),u((t=H(17,14,c.user$))?16:18,t)}}function _e(e,d){e&1&&m(0,"nbm-loading")}var Ne=(()=>{class e{constructor(){this.appState=h(j),this.route=h(W),this.affiliateService=h(te),this.toast=h(q),this.user$=this.appState.user$,this.showSuccess=g(!1),this.show
1Failure=g(!1),this.countdownSeconds=g(5),this.redeeming=g(!1),this.voucher=z(this.route.params.pipe(w(t=>this.affiliateService.getAffiliateVouchersById(t.voucherId)))),A(()=>{let t=this.voucher();if(!t)return;let n=this.appState.user$.value;n&&!t.redeemed&&!G.canImpersonate(n)&&this.redeemVoucher(t)})}ngOnDestroy(){this.countdownSub&&this.countdownSub.unsubscribe()}get dashboardUrl(){return Y.dashboardUrl}redeemVoucher(t){this.redeeming()||(this.redeeming.set(!0),this.affiliateService.redeemVoucher(t.voucherId).subscribe(n=>{n===!0?(this.showSuccess.set(!0),this.toast.showSuccessMessage("Voucher redeemed successfully!"),this.countdownSeconds.set(5),this.countdownSub=b(1e3).pipe(S(this.countdownSeconds()),k(c=>{this.countdownSeconds.set(5-(c+1))}),y(()=>{window.location.href=this.dashboardUrl,this.redeeming.set(!1)})).subscribe()):(this.showFailure.set(!0),this.showSuccess.set(!1),this.toast.showErrorMessage("Voucher could not be redeemed."),this.redeeming.set(!1))}))}getRedirectUrl(t){let n=window.location.pathname,c=new URL(n,window.location.origin);return c.searchParams.set("VoucherId",t),c.toString()}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=C({type:e,selectors:[["nbm-affiliates-register-page"]],decls:2,vars:1,consts:[[3,"noticeHidden","fullWidth","hideHeader"],["backgroundImage","/assets/img/teamwork.webp",3,"additionalClasses"],[1,"px-lg-5","px-3"],[1,"lead","align-items-center","d-flex"],[1,"icon-exclamation-circle","icon-2x","me-3"],[1,"container","offset-container","main-content"],[1,"equal-grid","position-relative","shadow"],[1,"p-lg-5","pt-lg-0","p-2","bg-white"],[1,"text-start","my-5",3,"innerHTML"],[3,"voucher"],[1,"bg-white","px-5","border-start","border-warning"],[1,"p-5","text-center"],[1,"card","my-5"],[1,"icon-check","icon-5x","text-success","me-3"],[1,"mb-4","text-success","text-uppercase"],[1,"my-3"],[3,"href"],[1,"card-header","text-center"],[1,"card-body","text-center","py-4"],[1,"alert","alert-danger","pb-0"],[1,"text-center"],[1,"btn","btn-lg","btn-primary"],["role","status",1,"spinner-border","text-primary","mb-3"],[1,"visually-hidden"],[1,"text-primary"],[1,"text-muted"],[1,"btn","btn-lg","btn-primary",3,"click"],[1,"alert","alert-warning"],[1,"icon-exclamation-circle","icon-3x","me-3"],[1,"mt-4"],[1,"card-body","text-center"],["nbmLoginClick","",1,"btn","btn-lg","btn-primary"],[1,"mt-5","text-center"],[1,"icon-exclamation-circle","icon","me-3"]],template:function(n,c){if(n&1&&p(0,ge,19,17,"nbm-site-page",0)(1,_e,1,0,"nbm-loading"),n&2){let _;u((_=c.voucher())?0:1,_)}},dependencies:[Z,K,J,ee,ie,O,$],encapsulation:2})}}return e})();export{Ne as AffiliatesRegisterPageComponent};
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.