1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b15d9c8f-1367-5376-ba10-2a51d88bc182")}catch(e){}}(); 3import{b as pt}from"./chunk-CMDITZCC.js";import"./chunk-PM5NBQCT.js";import"./chunk-MOH2JIRZ.js";import"./chunk-6LZTNHZG.js";import{f as lt}from"./chunk-IBQINMNN.js";import"./chunk-DEOYQW5X.js";import"./chunk-VBECAMYD.js";import"./chunk-UJHWNU66.js";import"./chunk-7FGZYUOP.js";import"./chunk-REGUBPJP.js";import"./chunk-O4OU7BC6.js";import"./chunk-3HONOFK6.js";import"./chunk-DH2ZU6RQ.js";import{M as st,O as ct}from"./chunk-KNSIGNOK.js";import{b as it,d as nt,e as at,f as rt,g as ot}from"./chunk-ID3W3YPU.js";import"./chunk-6SWHDXJJ.js";import{a as tt}from"./chunk-5JCESSFR.js";import"./chunk-KSF2LBXZ.js";import"./chunk-D7BFYR25.js";import"./chunk-J2GJ37JZ.js";import"./chunk-WLPT2RGL.js";import"./chunk-4CT7EIE2.js";import"./chunk-YHQ4J2TP.js";import{a as Ue}from"./chunk-5DTZYNJ7.js";import"./chunk-4UBVUVZO.js";import"./chunk-JJ2R3NBY.js";import"./chunk-SX3JKZZP.js";import"./chunk-2LGNKOFA.js";import"./chunk-AJTRQODG.js";import{a as N}from"./chunk-4PU5GHL4.js";import"./chunk-XQQPF4MT.js";import{b as De}from"./chunk-OENQVIRX.js";import"./chunk-X3IRFLJE.js";import"./chunk-ELZVHH2N.js";import{d as Ze,e as He,f as Ye}from"./chunk-7OA2D6VQ.js";import"./chunk-KI2UKCM2.js";import"./chunk-CTSCKRPX.js";import"./chunk-7NKSOS4M.js";import"./chunk-PUSRRJ4Q.js";import{e as w,f as I}from"./chunk-KHRBWIFQ.js";import"./chunk-F5IUR55I.js";import"./chunk-H5UJQB5P.js";import{a as Je}from"./chunk-PT67MGIX.js";import{a as $e,b as qe}from"./chunk-2WAOZ7DA.js";import"./chunk-HPETVQKG.js";import"./chunk-JURKDGMK.js";import"./chunk-MHXQR6BK.js";import"./chunk-YQAWBM4T.js";import"./chunk-QYZLX3XM.js";import"./chunk-QEOFONTS.js";import"./chunk-PPHF365C.js";import{a as Pe}from"./chunk-KYHOJCX3.js";import{a as Te,h as Ve}from"./chunk-66Q2E2ST.js";import"./chunk-YJTE4MJR.js";import{a as Ee}from"./chunk-AEIP3TLL.js";import"./chunk-ZPX3AUZT.js";import"./chunk-CNYDJGVT.js";import{a as Ie,b as Be}from"./chunk-SLLFNZLI.js";import{a as we,b as xe}from"./chunk-D7OHJC7E.js";import"./chunk-3PBK2RW7.js";import"./chunk-P25LDO2K.js";import"./chunk-64JMG7EM.js";import{a as be}from"./chunk-RGURE52V.js";import{f as Ce,n as Se}from"./chunk-NKLXREWT.js";import"./chunk-UHCISBON.js";import{a as y}from"./chunk-7Q7NK2UB.js";import{a as ye}from"./chunk-SVKNFV3A.js";import{d as Me}from"./chunk-NFAON7LG.js";import{a as Fe}from"./chunk-7T6PSJ5D.js";import"./chunk-EMUSLL3F.js";import"./chunk-6YMLPQDC.js";import"./chunk-EAGKMVCI.js";import{f as Xe,g as et}from"./chunk-ZHV2HMTH.js";import{b as Le,d as B,g as Re,h as je,m as ze,p as Oe,q as Ge,x as We,y as Qe,z as Ke}from"./chunk-GARSUL2O.js";import"./chunk-GNTIOVHP.js";import{i as ke,j as Ne,k as Ae}from"./chunk-W5R3IIT4.js";import"./chunk-J7RGHYR3.js";import"./chunk-6UG6W7Q2.js";import"./chunk-RB2JZRJH.js";import{j as he,n as ve,o as ge,v as fe}from"./chunk-DJM52XL6.js";import{$b as z,Bb as re,Bc as k,Dc as Q,F,Gc as p,Hb as R,Hc as b,I as ee,Ic as E,Jc as me,K as te,M as ie,Tb as S,Ub as oe,Uc as ue,Vb as h,X as ne,Xb as v,Yb as le,Zb as se,Zc as K,_b as j,ac as u,bc as a,cb as P,cc as o,cd as $,dc as _,dd as q,f as J,gd as _e,hc as ce,ib as r,ic as pe,ja as f,jc as de,kc as C,ld as D,m as U,n as L,pa as d,pc as g,qa as m,ra as x,rc as s,s as X,sa as M,va as ae,vc as O,wc as G,xc as W,za as T}from"./chunk-UMKIUVES.js";import{g as Y}from"./chunk-TXY5D64Z.js";var dt=["fileInput"],mt=["emojiMenuTrigger"],ut=n=>({filled:n}),_t=n=>({"background-image":n});function ht(n,c){if(n&1){let e=C();a(0,"button",30),g("click",function(){d(e);let i=s();return m(i.prevStep())}),x(),a(1,"svg",13),_(2,"path",14),o(),p(3," Previous "),o()}}function vt(n,c){if(n&1&&_(0,"span",33),n&2){let e=c.$index,t=s(2);u("ngClass",K(1,ut,e<t.currentStepIndex+1))}}function gt(n,c){if(n&1&&(a(0,"p",31),p(1),o(),a(2,"div",32),j(3,vt,1,3,"span",33,se),o()),n&2){let e=s();r(),me(" Step ",e.currentStepIndex+1,"/",e.steps.length," "),r(2),z(e.steps)}}function ft(n,c){n&1&&(a(0,"div",24),_(1,"app-listpreloader",34)(2,"app-listpreloader",35),o()),n&2&&(r(),u("preloaderType","type5"),r(),u("preloaderType","type10"))}function Ct(n,c){n&1&&de(0)}function St(n,c){if(n&1){let e=C();a(0,"div",26),S(function(){d(e);let i=s();return m(i.fadeInClass)}),a(1,"div",36)(2,"h1",37),p(3),o(),a(4,"p",38),p(5),o()(),a(6,"app-pricing-table",39),g("planPriceSelected",function(i){d(e);let l=s();return m(l.onPlanPriceSelected(i))}),o(),a(7,"div",40),R(8,Ct,1,0,"ng-container",41),o()()}if(n&2){let e=s(),t=k(30);r(3),b(e.getCurrentStepTitle()),r(2),b(e.getCurrentStepDescription()),r(),u("context","register-page")("showInfo",!1)("disabledPlanTypes",e.disabledPlanTypes()),r(2),u("ngTemplateOutlet",t)}}function bt(n,c){if(n&1){let e=C();a(0,"div",47),S(function(){d(e);let i=s(2);return m(i.fadeInClass)}),a(1,"button",59),g("click",function(i){return d(e),m(i.preventDefault())}),_(2,"app-spinner-preloader",60),o()()}n&2&&(r(2),u("color","blue")("size","size_s"))}function wt(n,c){if(n&1){let e=C();a(0,"div",47),S(function(){d(e);let i=s(3);return m(i.fadeInClass)}),a(1,"button",61),g("click",function(i){return d(e),m(i.preventDefault())}),x(),a(2,"svg",62),_(3,"path",63),o()()()}}function xt(n,c){if(n&1){let e=C();a(0,"div",47),S(function(){d(e);let i=s(3);return m(i.fadeInClass)}),a(1,"button",64),g("click",function(i){return d(e),m(i.preventDefault())}),x(),a(2,"svg",65),_(3,"path",66),o()()()}if(n&2){let e,t=s(3);r(),u("matTooltip",ue("'",(e=t.brandspaceForm.get("username"))==null?null:e.value,"' isn't available. This only affects the URL; you can rename your Brandspace anytime."))}}function Tt(n,c){if(n&1&&(ce(0),h(1,wt,4,0,"div",47),h(2,xt,4,2,"div",47),pe()),n&2){let e,t,i=s(2);r(),v((e=i.brandspaceForm.get("username"))!=null&&e.value&&i.brandspaceUsernameIsValid()===!0?1:-1),r(),v((t=i.brandspaceForm.get("username"))!=null&&t.value&&i.brandspaceUsernameIsValid()===!1?2:-1)}}function Et(n,c){if(n&1&&_(0,"div",54),n&2){let e=s(2);u("ngStyle",K(1,_t,"url("+e.imageSrc()+")"))}}function yt(n,c){if(n&1){let e=C();a(0,"div",26),S(function(){d(e);let i=s();return m(i.fadeInClass)}),a(1,"div",36)(2,"h1",37),p(3),o(),a(4,"p",38),p(5),o()(),a(6,"form",42),g("ngSubmit",function(){d(e);let i=s();return m(i.onBrandspaceSubmit())}),a(7,"div",43)(8,"div",44)(9,"div",45),_(10,"input",46),a(11,"div"),h(12,bt,3,2,"div",47),o(),h(13,Tt,3,2,"ng-container"),o(),a(14,"div",48)(15,"b",49),p(16,".brault.app"),o()()(),a(17,"div",50)(18,"p",51),p(19,"Upload logo (optional)"),o(),a(20,"div",52),p(21," Maximum file size: 2MB. "),_(22,"br"),p(23,"Valid formats: .png, .jpg, .jpeg. "),o(),a(24,"div",53),h(25,Et,1,3,"div",54),a(26,"button",55),g("
3click",function(i){d(e);let l=k(30);return i.preventDefault(),m(l.click())}),a(27,"span"),p(28,"Upload logo"),o()(),a(29,"input",56,2),g("change",function(i){d(e);let l=s();return m(l.onFileSelected(i))}),o()()(),a(31,"div",57)(32,"button",58),p(33),o()()()()()}if(n&2){let e,t=s();r(3),b(t.getCurrentStepTitle()),r(2),b(t.getCurrentStepDescription()),r(),u("formGroup",t.brandspaceForm),r(6),v(t.checkLoading()||t.isTyping()?12:-1),r(),v(!t.checkLoading()&&!t.isTyping()?13:-1),r(12),v(t.imageSrc()?25:-1),r(7),u("disabled",!((e=t.brandspaceForm.get("username"))!=null&&e.value)||(((e=t.brandspaceForm.get("username"))==null||e.value==null?null:e.value.length)??0)===0||t.brandspaceUsernameIsValid()!==!0||t.checkLoading()||t.isTyping()),r(),E(" ",t.getNextButtonText()," ")}}function It(n,c){if(n&1){let e=C();a(0,"div",26),S(function(){d(e);let i=s();return m(i.fadeInClass)}),a(1,"div",36)(2,"h1",37),p(3),o(),a(4,"p",38),p(5),o()(),a(6,"form",42),g("ngSubmit",function(){d(e);let i=s();return m(i.onWorkspaceSubmit())}),a(7,"div",43)(8,"div",67)(9,"div",68)(10,"b",69),p(11,"Create your first Library"),o()(),a(12,"div",70),_(13,"input",71),o()(),a(14,"div",57)(15,"button",58)(16,"div",72),oe(function(){d(e);let i=s();return m(i.fadeInOutLeaveClass)}),S(function(){d(e);let i=s();return m(i.fadeInOutEnterClass)}),p(17),o()()()()()()}if(n&2){let e=s();r(3),b(e.getCurrentStepTitle()),r(2),b(e.getCurrentStepDescription()),r(),u("formGroup",e.workspaceForm),r(9),u("disabled",e.workspaceForm.invali
3d),r(2),E(" ",e.getNextButtonText()," ")}}function Bt(n,c){if(n&1){let e=C();a(0,"mat-chip-row",86),g("removed",function(){let i=d(e).$implicit,l=s(2);return m(l.removeInvitedUserEmail(i))}),p(1),a(2,"button",87),x(),a(3,"svg",13),_(4,"path",66),o()()()}if(n&2){let e=c.$implicit;r(),E(" ",e," ")}}function Vt(n,c){if(n&1&&(a(0,"div",81),p(1),o()),n&2){let e=s(2);r(),E(" ",e.getEmailValidationError()," ")}}function Pt(n,c){if(n&1){let e=C();a(0,"div",26),S(function(){d(e);let i=s();return m(i.fadeInClass)}),a(1,"div",36)(2,"h1",37),p(3),o(),a(4,"p",38),p(5),o()(),a(6,"form",42),g("ngSubmit",function(){d(e);let i=s();return m(i.onInvitationSubmit())}),a(7,"div",73)(8,"div",74)(9,"label",75),p(10,"Team users' emails"),o(),a(11,"div",76)(12,"div",77)(13,"mat-form-field",78)(14,"mat-chip-grid",79,3),j(16,Bt,5,1,"mat-chip-row",null,le),a(18,"input",80),g("matChipInputTokenEnd",function(i){d(e);let l=s();return m(l.addInvitedUserEmail(i))}),o()()(),h(19,Vt,2,1,"div",81),o()()(),a(20,"div",50)(21,"div",82)(22,"div",83)(23,"button",84),g("click",function(i){d(e);let l=s();return i.preventDefault(),l.onInvitationSubmit(),m(i.stopPropagation())}),a(24,"div",72),S(function(){d(e);let i=s();return m(i.fadeInClass)}),p(25," Send invitations "),o()()(),a(26,"div",83)(27,"a",85),g("click",function(i){d(e);let l=s();return i.preventDefault(),l.onSkipInvitations(),m(i.stopPropagation())}),a(28,"div",72),S(function(){d(e);let i=s();return m(i.fadeInClass)}),p(29," I'll do this later "),o()()()()()()()()}if(n&2){let e=k(15),t=s();r(3),b(t.getCurrentStepTitle()),r(2),b(t.getCurrentStepDescription()),r(),u("formGroup",t.invitationEmailsForm),r(7),Q("mat-form-field-invalid",t.hasEmailValidationErrors()),r(3),z(t.invitedUsersEmails),r(2),u("matChipInputFor",e)("matChipInputSeparatorKeyCodes",t.separatorKeysCodes)("matChipInputAddOnBlur",!0),r(),v(t.hasEmailValidationErrors()?19:-1),r(4),u("disabled",t.invitedUsersEmails.length===0||t.hasEmailValidationErrors())}}function kt(n,c){if(n&1&&(a(0,"div",91)(1,"div",115),p(2," Promotion: "),a(3,"span",116),p(4),o()()()),n&2){let e,t=s(2);r(4),b(((e=t.promotionCodeForm.get("promotionCode"))==null?null:e.value)??"")}}function Nt(n,c){if(n&1&&_(0,"img",95),n&2){let e=s(2);u("src",e.imageSrc(),P)}}function At(n,c){n&1&&_(0,"app-listpreloader",96),n&2&&u("preloaderType","type4")}function Ft(n,c){n&1&&_(0,"app-listpreloader",96),n&2&&u("preloaderType","type5")}function Mt(n,c){if(n&1&&(a(0,"span",100),p(1),o()),n&2){let e,t=s(2);r(),E("",(e=t.brandspaceForm.get("username"))==null?null:e.value,".brault.app")}}function Dt(n,c){if(n&1&&_(0,"img",111),n&2){let e=s(2);u("src",e.imageSrc(),P)}}function Ut(n,c){n&1&&_(0,"app-listpreloader",96),n&2&&u("preloaderType","type3")}function Lt(n,c){if(n&1&&(a(0,"div",114)(1,"div",117,4)(3,"button",118)(4,"span",119),p(5),o()()(),a(6,"a",120)(7,"div",121),p(8),o()()()),n&2){let e,t,i=s(2),l=k(32);r(),u("matMenuTriggerFor",l),r(4),E(" ",((e=i.workspaceForm.get("emoji"))==null?null:e.value)||"\u{1F9D1}\u200D\u{1F4BB}"," "),r(3),E(" ",(t=i.workspaceForm.get("name"))==null?null:t.value," ")}}function Rt(n,c){n&1&&_(0,"app-listpreloader",96),n&2&&u("preloaderType","type5")}function jt(n,c){if(n&1){let e=C();a(0,"div",27)(1,"div",88)(2,"div",89),S(function(){d(e);let i=s();return m(i.fadeInDelay1Class)}),a(3,"div",90),h(4,kt,5,1,"div",91),a(5,"div",92)(6,"div",93)(7,"div",94),h(8,Nt,1,1,"img",95)(9,At,1,1,"app-listpreloader",96),o(),a(10,"div",20)(11,"div",97)(12,"div",98)(13,"div",99),h(14,Ft,1,1,"app-listpreloader",96)(15,Mt,2,1,"span",100),o()()()(),a(16,"div",101)(17,"div",102)(18,"button",103),x(),a(19,"svg",104),_(20,"path",105),o()(),M(),a(21,"button",106),x(),a(22,"svg",65),_(23,"path",107)(24,"path",108),o()()()()(),M(),a(25,"div",109)(26,"div",20)(27,"div",110),h(28,Dt,1,1,"img",111)(29,Ut,1,1,"app-listpreloader",96),o()()(),a(30,"div",112)(31,"div",20)(32,"div",68)(33,"p",113),p(34,"Libraries"),o(),h(35,Lt,9,3,"div",114)(36,Rt,1,1,"app-listpreloader",96),o()()()()()()()()}if(n&2){let e,t,i,l=s();r(4),v((e=l.promotionCodeForm.get("promotionCode"))!=null&&e.value?4:-1),r(4),v(l.imageSrc()?8:9),r(6),v((t=l.brandspaceForm.get("username"))!=null&&t.value?15:14),r(14),v(l.imageSrc()?28:29),r(7),v((i=l.workspaceForm.get("name"))!=null&&i.value?35:36)}}function zt(n,c){if(n&1){let e=C();a(0,"button",127),g("click",function(){d(e);let i=s(2);return m(i.onClearPromotionCode())}),_(1,"img",128),$(2,"cacheBuster"),o()}if(n&2){let e=s(2);r(),u("src",q(2,1,"/../../assets/icons/"+e.themeService.currentTheme(
3)+"/black/icon_close.svg"),P)}}function Ot(n,c){if(n&1){let e=C();a(0,"form",42),g("ngSubmit",function(){d(e);let i=s();return m(i.onValidatePromotionCode())}),a(1,"label",122),p(2,"If you have a promo code, enter it here"),o(),_(3,"br"),a(4,"div",123),_(5,"input",124),a(6,"button",125),p(7," Validate "),o(),h(8,zt,3,3,"button",126),o()()}if(n&2){let e,t,i=s();u("formGroup",i.promotionCodeForm),r(5),Q("valid",(e=i.promotionCodeForm.get("promotionCode"))==null?null:e.valid),r(),u("disabled",i.validatingPromotionCode()),r(2),v((t=i.promotionCodeForm.get("promotionCode"))!=null&&t.value?8:-1)}}function Gt(n){let c=n.value;if(!c||!Array.isArray(c)||c.length===0)return null;let e=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,t=c.filter(i=>!e.test(i));return t.length>0?{invalidEmails:{message:`Invalid email addresses: ${t.join(", ")}`,invalidEmails:t}}:null}var Wt=["free","lite","pro","growth"],Ui=(()=>{class n{fadeInClass=N.fadeIn;fadeInDelay1Class=N.fadeInDelay1;fadeInOutEnterClass=N.fadeInOutEnter;fadeInOutLeaveClass=N.fadeInOutLeave;formBuilder=f(We);authService=f(Ve);themeService=f(Ee);platformService=f(be);snackBarService=f(Me);dialogService=f(st);urlService=f(Ue);userService=f(Pe);brandspaceService=f(Be);planService=f(Ie);stripeDataService=f(ye);seoService=f(Te);route=f(Ce);domainService=f(xe);
3persistentParamsService=f(we);destroyRef=f(ae);user=D(()=>this.authService.authUser());alreadyHasFreeBrandspace=!0;planType;billingInterval=I.year;BillingInterval=I;promotionCodeForm=this.formBuilder.group({promotionCode:["",B.required]});brandspaceForm=this.formBuilder.group({username:["",[B.required,B.maxLength(256),B.pattern(/^[a-z0-9]+$/)]],logo:[null]});workspaceForm=this.formBuilder.group({name:["",B.required],emoji:["\u{1F9D1}\u200D\u{1F4BB}"]});invitationEmailsForm=this.formBuilder.group({emails:[[],[Gt]]});steps=[];currentStepValue=0;currentStepIndex=0;STEP_PLAN_SELECTION=0;STEP_BRANDSPACE=1;STEP_WORKSPACE=2;STEP_PLAN_INVITATIONS=3;stripePlansMonthlyBilling=[];stripePlansYearlyBilling=[];rewardfulReferralId;brandspaceUsernameIsValid=T(null);checkLoading=T(!1);fileInput;emojiMenuTrigger;imageSrc=T(null);usernameSubject=new J;isTyping=T(!1);invitedUsersEmails=[];separatorKeysCodes=[13,188];preparingTexts=["Preparing your brandspace... \u2728","Just a moment... \u23F3","Setting things in motion... \u2699\uFE0F","Getting things ready... \u{1F50D}","Final touches... \u{1F3AF}"];loadingDialogRef;constructor(){if(this.themeService.clearBrandAccent(),this.platformService.isBrowser()){let e=this.urlService.getQueryParam(this.route,"coupon");e&&(this.promotionCodeForm.patchValue({promotionCode:e}),this.onValidatePromotionCode())}}ngOnInit(){return Y(this,null,function*(){if(this.platformService.isBrowser()){if(this.persistentParam
3sService.initializeFromUrl(),yield this.checkIfUserAlreadyHasFreeBrandspace(),yield this.listPlanWithPrices(),this.initializeSteps(),this.currentStepValue=this.steps[0],this.platformService.isBrowser()){let e=this.urlService.getQueryParam(this.route,"planType"),t=this.urlService.getQueryParam(this.route,"billingInterval");Object.values(w).includes(e)&&Object.values(I).includes(t)&&(this.planType=e,this.billingInterval=t,this.nextStep())}this.usernameSubject.pipe(ee(500),ie(),ne(e=>{if(!e||e.trim()==="")return this.isTyping.set(!1),this.checkLoading.set(!1),this.brandspaceUsernameIsValid.set(null),U(null);let t=this.formatBrandspaceUsername(e);return this.isTyping.set(!1),this.checkLoading.set(!0),this.brandspaceUsernameIsValid.set(null),this.checkBrandspaceAvailability(t).pipe(F(i=>(this.isTyping.set(!1),this.checkLoading.set(!1),this.brandspaceUsernameIsValid.set(null),this.snackBarService.showErrorMessageInSnackBar(i),U(null))))}),y(this.destroyRef)).subscribe({next:e=>{this.isTyping.set(!1),this.checkLoading.set(!1),e!==null&&this.brandspaceUsernameIsValid.set(e)}}),this.brandspaceForm.get("username")?.valueChanges.pipe(y(this.destroyRef)).subscribe(e=>{let t=e?this.formatBrandspaceUsername(e):"";if(e&&t!==e&&this.brandspaceForm.patchValue({username:t},{emitEvent:!1}),!t||t.trim()===""){this.isTyping.set(!1),this.checkLoading.set(!1),this.brandspaceUsernameIsValid.set(null),this.usernameSubject.next("");return}this.isTyping.set(!0),this.brandspaceUsernameIsValid.set(null),this.usernameSubject.next(t)}),this.seoService.initializeSeoService()}})}ngOnDestroy(){this.loadingDialogRef&&this.loadingDialogRef.close()}initializeSteps(){this.steps=[this.STEP_PLAN_SELECTION,this.STEP_BRANDSPACE,this.STEP_WORKSPACE],this.planType&&(this.planType===w.lite||this.planType===w.pro||this.planType===w.growth)&&this.steps.push(this.STEP_PLAN_INVITATIONS)}isInvitationsStepAvailable(){return this.planType!==void 0&&(this.planType===w.lite||this.planType===w.pro||this.planType===w.growth)}isCurrentStepValid(){switch(this.currentStepValue){case this.STEP_PLAN_SELECTION:return this.planType!==void 0&&this.billingInterval!==void 0;case this.STEP_BRANDSPACE:return this.brandspaceForm.valid&&this.brandspaceUsernameIsValid()===!0;case this.STEP_WORKSPACE:return this.workspaceForm.valid;case this.STEP_PLAN_INVITATIONS:return!0;default:return!1}}getCurrentStepTitle(){switch(this.currentStepValue){case this.STEP_PLAN_SELECTION:return"Select a subscription";case this.STEP_BRANDSPACE:return"Set up your Brandspace";case this.STEP_WORKSPACE:return"Create your first Library";case this.STEP_PLAN_INVITATIONS:return"Add team users";default:return""}}getCurrentStepDescription(){switch(this.currentStepValue){case this.STEP_PLAN_SELECTION:return"Choose the plan that best fits your needs";case this.STEP_BRANDSPACE:return"Choose your name and upload a logo to represent your brand identity.";case this.STEP_WORKSPACE:return"You can store any type of asset: your brand files, the latest photoshoot, the most recent campaign...";case this.STEP_PLAN_INVITATIONS:return"Add your team users. They will receive an email with instructions on how to join.";default:return""}}getCurrentStepProgress(){return this.steps.length===0?0:(this.currentStepIndex+1)/this.steps.length*100}canGoBack(){return this.currentStepIndex>0}getNextButtonText(){return this.steps.length===this.currentStepIndex+1?"Create brandspace":"Next"}hasEmailValidationErrors(){let e=this.invitationEmailsForm.get("emails");return!!(e?.errors&&e.touched)}getEmailValidationError(){let e=this.invitationEmailsForm.get("emails");
3return e?.errors?.invalidEmails?e.errors.invalidEmails.message:""}checkIfUserAlreadyHasFreeBrandspace(){this.userService.isFreeBrandspaceAvailable().pipe(y(this.destroyRef),F(e=>(this.snackBarService.showErrorMessageInSnackBar(e),L(()=>e)))).subscribe({next:({data:e})=>{e&&(this.alreadyHasFreeBrandspace=e)}})}listPlanWithPrices(){this.planService.listPlanWithPrices().pipe(y(this.destroyRef)).subscribe({next:({data:e})=>{if(!e||!Array.isArray(e)||e.length===0)return;let t=e.filter(i=>i.plan!==null&&i.plan.type!==w.custom);this.stripePlansMonthlyBilling=t.filter(i=>i.interval===I.month).filter(i=>i.plan!==null),this.stripePlansYearlyBilling=t.filter(i=>i.interval===I.year).filter(i=>i.plan!==null)}})}onBack(){this.domainService.redirectToMainDomain("/")}prevStep(){this.currentStepIndex!==0&&(this.currentStepIndex--,this.currentStepValue=this.steps[this.currentStepIndex])}nextStep(){if(!this.isCurrentStepValid()){this.showStepValidationError();return}this.steps.length===this.currentStepIndex+1?this.onApproveTerms():(this.currentStepIndex++,this.currentStepValue=this.steps[this.currentStepIndex],this.currentStepValue===this.STEP_PLAN_INVITATIONS&&!this.isInvitationsStepAvailable()&&this.nextStep())}showStepValidationError(){switch(this.currentStepValue){case this.STEP_PLAN_SELECTION:this.snackBarService.showErrorMessageInSnackBar("Please select a plan to continue");break;case this.STEP_BRANDSPACE:this.brandspaceForm.get("username")?.value?this.brandspaceUsernameIsValid()!==!0&&this.snackBarService.showErrorMessageInSnackBar("Please wait for username validation or choose a different name"):this.snackBarService.showErrorMessageInSnackBar("Please enter a brandspace name");break;case this.STEP_WORKSPACE:this.snackBarService.showErrorMessageInSnackBar("Please enter a library name");break}}changeBillingInterval(e){this.billingInterval=e}onPlanPriceSelected(e){this.planType=e.planType,this.billingInterval=e.billingInterval,this.initializeSteps(),this.nextStep()}applicablePlanTypes=T(null);promotionDiscountLabel=T("");disabledPlanTypes=D(()=>{let e=this.applicablePlanTypes();return e===null?[]:Wt.filter(t=>!e.includes(t))});applicablePlanLabel=D(()=>(this.applicablePlanTypes()??[]).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(", "));validatingPromotionCode=T(!1);onValidatePromotionCode(){let e=this.promotionCodeForm.value.promotionCode?.trim();if(!e){this.snackBarService.show("Please enter a promotion code","error");return}this.validatingPromotionCode.set(!0),this.brandspaceService.describePromotionCode(e).pipe(y(this.destroyRef)).subscribe({next:({data:t})=>{if(this.validatingPromotionCode.set(!1),!t?.valid){this.clearPromotionRestrictions(),this.snackBarService.show("That promotion code is not valid.","error");return}if(this.applicablePlanTypes.set(t.applicablePlanTypes),this.promotionDiscountLabel.set(t.discountLabel),this.planType&&!t.applicablePlanTypes.includes(this.planType)){let i=this.planType;this.planType=void 0,this.snackBarService.show(`${t.discountLabel} applied. ${this.titleCase(i)} is not covered by this code \u2014 choose another plan.`,"warning",void 0,!1,6e3);return}this.snackBarService.show(`${t.discountLabel} applied.`,"success",void 0,!1,5e3)},error:()=>{this.validatingPromotionCode.set(!1),this.clearPromotionRestrictions(),this.snackBarService.show("We could not check that promotion code. Please try again.","error")}})}onClearPromotionCode(){this.promotionCodeForm.patchValue({promotionCode:""}),this.clearPromotionRestrictions()}isPlanTypeDisabled(e){let t=this.applicablePlanTypes();return t!==null&&!t.includes(e)}clearPromotionRestrictions(){this.applicablePlanTypes.set(null),this.promotionDiscountLabel.set("")}titleCase(e){return e.charAt(0).toUpperCase()+e.slice(1)}isOriginPricingPage(){return this.urlService.getQueryParam(this.route,"planType")!==null&&this.urlService.getQueryParam(this.route,"billingInterval")!==null}formatBrandspaceUsername(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}checkBrandspaceAvailability(e){return this.brandspaceService.usernameCheck({username:e}).pipe(te(1),X(({data:t})=>t??!1))}onBrandspaceSubmit(){let e=this.brandspaceForm.value.username??"",t=this.formatBrandspaceUsername(e);e!==t&&this.brandspaceForm.patchValue({username:t}),this.brandspaceForm.valid&&this.brandspaceUsernameIsValid()===!0?this.nextStep():this.showStepValidationError()}onFileButtonClick(){this.fileInput.nativeElement.click()}onFileSelected(e){let t=e.target.files?.[0];if(t&&(t.type==="image/jpeg"||t.type==="image/png")){if(t.size>2097152){this.snackBarService.show("The file is too large. Maximum 2MB","error");return}if(!["image/png","image/jpg","image/jpeg","video/mp4","video/mov"].includes(t.type)){this.snackBarService.show("Acceptable formats: .png, .jpg, .jpeg","error");return}this.brandspaceForm.patchValue({logo:t}),this.brandspaceForm.get("logo")?.updateValueAndValidity();let l=new FileReader;l.onload=V=>{this.imageSrc.set(V.target?.result)}
3,l.readAsDataURL(t)}else this.snackBarService.show("Acceptable formats: .png, .jpg, .jpeg","error")}onWorkspaceSubmit(){this.workspaceForm.valid?this.nextStep():this.showStepValidationError()}addInvitedUserEmail(e){let{input:t}=e,i=(e.value||"").trim(),l=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,V=i.match(l);if(V){let A=[...this.invitedUsersEmails],Z=!1;V.forEach(H=>{A.indexOf(H)===-1&&(A.push(H),Z=!0)}),Z&&(this.invitedUsersEmails=A,this.invitationEmailsForm.patchValue({emails:A}),this.invitationEmailsForm.get("emails")?.updateValueAndValidity())}else i.length>0&&this.snackBarService.show("Email address is not valid, please check it again","error");t&&(t.value="")}removeInvitedUserEmail(e){let t=this.invitedUsersEmails.indexOf(e);t>=0&&(this.invitedUsersEmails.splice(t,1),this.invitationEmailsForm.patchValue({emails:this.invitedUsersEmails}),this.invitationEmailsForm.get("emails")?.updateValueAndValidity())}onInvitationSubmit(){if(this.invitationEmailsForm.valid)this.nextStep();else{let e=this.invitationEmailsForm.get("emails")?.errors;
3e?.invalidEmails&&this.snackBarService.show(e.invalidEmails.message,"error")}}onSkipInvitations(){this.invitedUsersEmails=[],this.invitationEmailsForm.patchValue({emails:[]}),this.invitationEmailsForm.get("emails")?.updateValueAndValidity(),this.nextStep()}addEmoji(e){let t=e.emoji.native;this.workspaceForm.patchValue({emoji:t}),this.emojiMenuTrigger&&this.emojiMenuTrigger.closeMenu()}onApproveTerms(){this.dialogService.openDialog("dialog-approve-terms",{title:"Accept terms of use",message:"",confirmButton:"I have read and accept the terms of use",confirmAction:()=>{this.executeCreateBrandspace()}})}executeCreateBrandspace(){if(!this.validateRequiredData()){this.snackBarService.show("Required data is missing","error");return}this.loadingDialogRef=this.dialogService.openDialog("dialog-loading",{texts:this.preparingTexts,interval:1500,showAnimatedLogo:!0});let e=this.createBrandspaceDto(),t=this.brandspaceForm.value.logo??null;this.brandspaceService.createBrandspace(e,t).pipe(y(this.destroyRef),F(i=>(this.closeLoadingDialog(),this.snackBarService.showErrorMessageInSnackBar(i),L(()=>i)))).subscribe({next:i=>{let l=i.data?.returnUrl;l?(this.closeLoadingDialog(),l.startsWith("http://")||l.startsWith("https://")?window.location.href=l:this.urlService.navigateTo([l])):(this.closeLoadingDialog(),this.snackBarService.show("No redirect URL received from server","error"))},error:i=>{this.snackBarService.showErrorMessageInSnackBar(i)}})}validateRequiredData(){return!!(this.brandspaceForm.value.username&&this.planType&&this.billingInterval&&this.workspaceForm.value.name)}createBrandspaceDto(){let e=this.promotionCodeForm.value.promotionCode===""?void 0:this.promotionCodeForm.value.promotionCode;return{username:this.brandspaceForm.value.username??"",planType:this.planType,billingInterval:this.billingInterval,workspaceName:this.workspaceForm.value.name??"First library",language:navigator.language,workspaceEmoji:this.workspaceForm.value.emoji??void 0,invitedUsersEmails:this.isInvitationsStepAvailable()&&this.invitedUsersEmails.length>0?this.invitedUsersEmails:void 0,promotionCode:e??void 0,referralId:this.rewardfulReferralId??void 0}}closeLoadingDialog(){this.loadingDialogRef&&(this.loadingDialogRef.close(),this.loadingDialogRef=void 0)}onLogout(){this.authService.logout()}checkURLparams(){let e=this.getNormalizedQueryParams(),t=[];return e.forEach((i,l)=>{t.push(`${l}=${i}`)}),t.length>0?t.join("&"):""}decodeQuotedPrintable(e){if(!e)return"";let t=e.replace(/=\r\n/g,"").replace(/=\n/g,"").replace(/=\r/g,"");return t=t.replace(/=([0-9A-Fa-f]{2})/g,(i,l)=>{try{return String.fromCharCode(parseInt(l,16))}catch{return i}}),t}normalizeSearch(e){let t=e.startsWith("?")?e.substring(1):e;return t?(t=t.replace(/&/g,"&"),t=this.decodeQuotedPrintable(t),t):""}getNormalizedQueryParams(){try{let e=this.normalizeSearch(window.location.search);return new URLSearchParams(e)}catch{return new URLSearchParams(window.location.search)}}static \u0275fac=function(t){return new(t||n)};static \u0275cmp=re({type:n,selectors:[["app-new-brandspace"]],viewQuery:function(t,i){if(t&1&&(O(dt,5),O(mt,5)),t&2){let l;G(l=W())&&(i.fileInput=l.first),G(l=W())&&(i.emojiMenuTrigger=l.first)}},decls:34,vars:14,consts:[["promotionCodeFormTpl",""],["emojiMenu","matMenu"],["fileInput",""],["chipList",""],["emojiMenuTrigger","matMenuTrigger"],["id","nav_main",1,"login-register-nav"],[1,"wrapper","desktop"],[1,"container","row","wrapper1","verticalalign"],[1,"col-md-auto","col-logo","d-flex","gap05","verticalalign","space-between"],[1,"wrap","flex-1"],[1,"d-flex","gap05","verticalalign"],[1,"logo",3,"src"],["mat-button","","color","primary",1,"UI_tools_btn_transparent","mat-button","icon_left",3,"click"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true",1,"icon","size_m","not_filled"],["stroke-linecap","round","stroke-linejoin","round","d","M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"],[1,"col-md-auto","col_navItems"],[3,"context"],[1,"register-layout"],[1,"container","full","register_form","m-container-full"],[1,"row","marg_01"],[1,"col"],[1,"wrapper","container","v3","relative"],[1,"padd-t-3","padd-m-t-4"],["mat-button","","color","primary",1,"UI_tools_btn_transparent","icon_left"],[1,"d-flex","gap05","d-column"],[1,"padd-t-2","padd-b-2"],[1,"plans_in_register"],[1,"col-4","desktop"],[1,"UI_tools_mat_menu_v1","full_width_mat_menu"],[3,"ubication","addEmoji","hideImageTab"],["mat-button","","color","primary",1,"UI_tools_btn_transparent","icon_left",3,"click"],[1,"padd-t-0","size_1"],[1,"steps-pills"],[1,"step-pill",3,"ngClass"],[1,"w-20","d-flex",3,"preloaderType"],[1,"w-30","d-flex",3,"preloaderType"],[1,"title_section","padd-b-2"],[1,"size_6","padd-b-1","size_m_055"],[1,"size_5","m-w-1","marg-0"],[3,"planPriceSelected","context","showInfo","disabledPlanTypes"],[1,"padd-t-15","padd-b-3"],[4,"ngTemplateOutlet"],[3,"ngSubmit","formGroup"],[1,"wrapper","m-w-0"],[1,"d-flex","verticalalign","gap05","inlinemob"],[1,"flex-1","input","w_absolute_icon"],["type","text","id","username","formControlName","username","autocomplete","new-password","placeholder","Enter your brandspace name",1,"workspace-edit-input","big","w-100"],[1,"icon"],[1,"flex"],[1,"size_5","fw-600"],[1,"padd-t-2"],[1,"size_45","fw-500"],[1,"legal","p","size_2","grey"],[1,"inline-flex"],[1,"image-background-workspace","in_workspace_creation","marg-r-1",3,"ngStyle"],["mat-stroked-button","","color","primary",3,"click"],["type","file","id","logo","name","logo","accept","image/*",2,"display","none",3,"change"],[1,"row","padd-t-2"],["type","submit","mat-flat-button","","color","primary",1,"w-100","full-size",3,"disabled"],["mat-icon-button","",1,"UI_tools_icon_single_button","hover_disabled","disabled",3,"click"],[3,"color","size"],["mat-icon-button","","matTooltip","Congratulations! The Brandspace name is available.",1,"UI_tools_icon_single_button","hover_disabled",3,"click"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2.5","aria-hidden","true",1,"icon","size_l","not_filled","success"],["stroke-linecap","round","stroke-linejoin","round","d","m4.5 12.75 6 6 9-13.5"],["mat-icon-button","",1,"UI_tools_icon_single_button","hover_disabled",3,"click","matTooltip"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true",1,"icon","icon","size_m","not_filled"],["stroke-linecap","round","stroke-linejoin","round","d","M6 18 18 6M6 6l12 12"],[1,"d-flex","verticalalign","m-column"],[1,"col-md-auto"],[1,"size_5","marg-r-05","bold"],[1,"col","input","w_absolute_icon","padd-m-t-05"],["type","text","id","name","formControlName","name","autocomplete","new-password","placeholder","\u{1F3A8} Brand assets, \u{1F4F8} Shooting, \u{1F4E2} Campaign...",1,"workspace-edit-input","big","w-100"],[1,"txt"],[1,"m-w-0"],[1,"input"],["for","invitation_emails"],[1,"search_module","invitation_emails"],[1,""],["appearance","fill",1,"example-chip-list","w-100","relative","default_focus_visible"],["aria-label","Emails"],["id","invitation_emails","placeholder","Email of users","type","text",3,"matChipInputTokenEnd","matChipInputFor","matChipInputSeparatorKeyCodes","matChipInputAddOnBlur"],[1,"error-message","size_2","red","padd-t-05"],[1,"d-flex","verticalalign","gap1","m-center","gap_m_25"],[1,"flex-1"],["mat-flat-button","","color","primary",1,"w-100","full-size",3,"click","disabled"],[1,"pointer","link","default","black",3,"click"],[3,"removed"],["matChipRemove",""],[1,"col_side","container","v3"],[1,"side_register","relative"],[1,"wrapper","wrapper1","swhich_brandspace"],[1,"isPromotionCodeAvailable","padd-b-1"],[1,"wrapper","wrapper2","padd-b-10","padd-t-025"],[1,"brandspace_item","d-flex","verticalalign","w-100","auto"],[1,"col-md-auto","logo_thumbnail"],[3,"src"],[3,"preloaderType"],[1,"padd-l-05"],[1,"col-md-auto","size_3","brandspace_name"],[1,"wrapper","t_e"],[1,"t_e"],[1,"col-md-auto","right","end"],[1,"options","d-flex","gap025"],["mat-icon-button","","disabled","",1,"UI_tools_icon_single_button","small","hover_alt","dropdown"],["xmlns","http://www.w3.org/2000/svg","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true",1,"icon","img_d_d_rotate","icon","size_m","not_filled"],["stroke-linecap","round","stroke-linejoin","round","d","m19.5 8.25-7.5 7.5-7.5-7.5"],["mat-icon-button","","disabled","",1,"UI_tools_icon_single_button","small","hover_alt"],["stroke-linecap","round","stroke-linejoin","round","d","M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.
3074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"],["stroke-linecap","round","stroke-linejoin","round","d","M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"],[1,"d-flex","verticalalign","padd-t-1","padd-b-1"],[1,"col-md-auto","logo"],[1,"w-100",3,"src"],[1,"row","container","padd-t-1","padd-b-3"],[1,"size_2","grey2"],[1,"workspace_box"],[1,"tag","promotioncode","center","d-flex","gap025","verticalalign"],[1,"tag_txt"],[1,"emoji_container",3,"matMenuTriggerFor"],["mat-button","","color","primary",1,"UI_tools_btn_transparent","icon_left","emoji_btn"],[1,"logo_emoj"],["disabled",""],[1,"name_workspace","t_e"],["for","promotionCode",1,"single"],[1,"d-flex","gap05"],["type","text","id","promotionCode","formControlName","promotionCode","placeholder","Enter your promo code"],["mat-stroked-button","","color","primary","type","submit",3,"disabled"],["type","button","mat-icon-button","","matTooltip","Clear promo code",1,"UI_tools_icon_single_button","size_1"],["type","button","mat-icon-button","","matTooltip","Clear promo code",1,"UI_tools_icon_single_button","size_1",3,"click"],[1,"icon","size_1",3,"src"]],template:function(t,i){if(t&1){let l=C();a(0,"nav",5)(1,"div",6)(2,"div",7)(3,"div",8)(4,"div",9)(5,"div",10),_(6,"img",11),$(7,"cacheBuster"),a(8,"button",12),g("click",function(){return d(l),m(i.onBack())}),x(),a(9,"svg",13),_(10,"path",14),o(),p(11," Back to Brault App "),o()()(),M(),a(12,"div",15),_(13,"app-topbar",16),o()()()()(),a(14,"div",17)(15,"div",18)(16,"div",19)(17,"div",20)(18,"div",21)(19,"div",22),h(20,ht,4,0,"button",23),h(21,gt,5,2)(22,ft,3,2,"div",24),o(),a(23,"div",25),h(24,St,9,6,"div",26),h(25,yt,34,8,"div",26),h(26,It,18,5,"div",26),h(27,Pt,30,10,"div",26),o()()(),h(28,jt,37,5,"div",27),o(),R(29,Ot,9,5,"ng-template",null,0,_e),a(31,"mat-menu",28,1),_(33,"app-dialog-emoji",29),o()()()}t&2&&(r(6),u("src",q(7,12,"../../assets/img/logo_icon.png"),P),r(7),u("context","inactive-brandspace"),r(7),v(i.canGoBack()?20:-1),r(),v(i.steps.length>0?21:22),r(3),v(i.currentStepValue===i.STEP_PLAN_SELECTION?24:-1),r(),v(i.currentStepValue===i.STEP_BRANDSPACE?25:-1),r(),v(i.currentStepValue===i.STEP_WORKSPACE?26:-1),r(),v(i.currentStepValue===i.STEP_PLAN_INVITATIONS&&i.isInvitationsStepAvailable()?27:-1),r(),v(i.currentStepValue>0?28:-1),r(5),u("ubication","inMatMenu")("addEmoji",i.addEmoji.bind(i))("hideImageTab",!0))},dependencies:[fe,he,ge,ve,Se,Ke,ze,Le,Re,je,Oe,Ge,Ae,Ne,ke,qe,$e,Qe,ot,at,rt,it,nt,et,Xe,De,Ye,Ze,He,lt,Fe,Je,pt,ct,tt],styles:[".logo_emoj[_ngcontent-%COMP%]{font-size:var(--font_size045)!important}"]})}return n})();export{Ui as NewBrandspaceComponent}; 4 5//# debugId=b15d9c8f-1367-5376-ba10-2a51d88bc182
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.