@vendure/admin-ui-plugin 2.0.0-next.21 → 2.0.0-next.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/lib/admin-ui/165.6aeb6ecf722558ee.js.map +1 -1
  2. package/lib/admin-ui/{239.e2e63f2ccd517604.js → 239.bc59928cd01c7e91.js} +2 -2
  3. package/lib/admin-ui/{239.e2e63f2ccd517604.js.map → 239.bc59928cd01c7e91.js.map} +1 -1
  4. package/lib/admin-ui/26.6407e52b6e31b210.js +2 -0
  5. package/lib/admin-ui/26.6407e52b6e31b210.js.map +1 -0
  6. package/lib/admin-ui/{316.265d65a6a9d1b4c0.js → 316.d7ad74308299e698.js} +2 -2
  7. package/lib/admin-ui/{316.265d65a6a9d1b4c0.js.map → 316.d7ad74308299e698.js.map} +1 -1
  8. package/lib/admin-ui/{356.975f7f2d201afda5.js → 356.35ca041b6f7a6cc0.js} +2 -2
  9. package/lib/admin-ui/{356.975f7f2d201afda5.js.map → 356.35ca041b6f7a6cc0.js.map} +1 -1
  10. package/lib/admin-ui/430.827b68efffc7eada.js +65 -0
  11. package/lib/admin-ui/430.827b68efffc7eada.js.map +1 -0
  12. package/lib/admin-ui/496.e4c426e8cc0f3034.js +12 -0
  13. package/lib/admin-ui/496.e4c426e8cc0f3034.js.map +1 -0
  14. package/lib/admin-ui/625.ce0752367b2918a3.js +2 -0
  15. package/lib/admin-ui/625.ce0752367b2918a3.js.map +1 -0
  16. package/lib/admin-ui/654.d4c38af0c765576f.js +2 -0
  17. package/lib/admin-ui/654.d4c38af0c765576f.js.map +1 -0
  18. package/lib/admin-ui/i18n-messages/de.json +3 -1
  19. package/lib/admin-ui/i18n-messages/en.json +3 -1
  20. package/lib/admin-ui/index.html +1 -1
  21. package/lib/admin-ui/main.75464c18bab13b01.js +2954 -0
  22. package/lib/admin-ui/main.75464c18bab13b01.js.map +1 -0
  23. package/lib/admin-ui/runtime.2d88c9597f145c74.js +2 -0
  24. package/lib/admin-ui/{runtime.28bd5da02a9b1f7b.js.map → runtime.2d88c9597f145c74.js.map} +1 -1
  25. package/lib/admin-ui/styles/_variables.scss +1 -0
  26. package/lib/src/plugin.js +2 -1
  27. package/lib/src/plugin.js.map +1 -1
  28. package/package.json +4 -4
  29. package/lib/admin-ui/26.5cc3bfffe8943e16.js +0 -2
  30. package/lib/admin-ui/26.5cc3bfffe8943e16.js.map +0 -1
  31. package/lib/admin-ui/407.a3fde1da25c0935c.js +0 -12
  32. package/lib/admin-ui/407.a3fde1da25c0935c.js.map +0 -1
  33. package/lib/admin-ui/451.a7fd4069c4f4c687.js +0 -65
  34. package/lib/admin-ui/451.a7fd4069c4f4c687.js.map +0 -1
  35. package/lib/admin-ui/600.17470a2c90aa79d8.js +0 -2
  36. package/lib/admin-ui/600.17470a2c90aa79d8.js.map +0 -1
  37. package/lib/admin-ui/625.3c0c5821b952b58e.js +0 -2
  38. package/lib/admin-ui/625.3c0c5821b952b58e.js.map +0 -1
  39. package/lib/admin-ui/main.65109179713dd228.js +0 -2944
  40. package/lib/admin-ui/main.65109179713dd228.js.map +0 -1
  41. package/lib/admin-ui/runtime.28bd5da02a9b1f7b.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[625],{2625:(L,h,i)=>{i.r(h),i.d(h,{LoginComponent:()=>c,LoginGuard:()=>p,LoginModule:()=>s,loginRoutes:()=>u});var a=i(9950),n=i(3184),d=i(9720),f=i(8784),C=i(6362),g=i(587),w=i(7890),l=i(2748),M=i(7514);function _(o,t){if(1&o&&(n.TgZ(0,"p",22),n._uU(1),n.qZA()),2&o){const e=n.oxw();n.xp6(1),n.hij("Photo by ",e.imageCreator," on Unsplash")}}function x(o,t){if(1&o&&(n.TgZ(0,"p",23),n._uU(1),n.qZA()),2&o){const e=n.oxw();n.xp6(1),n.Oqu(e.imageLocation)}}function O(o,t){if(1&o&&n._UZ(0,"img",24),2&o){const e=n.oxw();n.Q6J("src",e.imageUrl,n.LSH)("alt",e.imageUrl)}}function P(o,t){1&o&&(n.TgZ(0,"span"),n._uU(1,"-"),n.qZA())}function v(o,t){if(1&o&&(n.TgZ(0,"span"),n._uU(1),n.YNc(2,P,2,0,"span",20),n.qZA()),2&o){const e=n.oxw();n.xp6(1),n.hij("",e.brand," "),n.xp6(1),n.Q6J("ngIf",!e.hideVendureBranding||!e.hideVersion)}}function b(o,t){1&o&&(n.TgZ(0,"span"),n._uU(1,"vendure"),n.qZA())}function y(o,t){if(1&o&&(n.TgZ(0,"span"),n._uU(1),n.qZA()),2&o){const e=n.oxw();n.xp6(1),n.hij("v",e.version,"")}}class c{constructor(t,e,r){this.authService=t,this.router=e,this.httpClient=r,this.username="",this.password="",this.rememberMe=!1,this.version=a.s5M,this.brand=(0,a.hq7)().brand,this.hideVendureBranding=(0,a.hq7)().hideVendureBranding,this.hideVersion=(0,a.hq7)().hideVersion,this.customImageUrl=(0,a.hq7)().loginImage,this.imageUrl="",this.imageLocation="",this.imageCreator="",this.customImageUrl?this.imageUrl=this.customImageUrl:this.loadImage()}logIn(){this.errorMessage=void 0,this.authService.logIn(this.username,this.password,this.rememberMe).subscribe(t=>{switch(t.__typename){case"CurrentUser":const e=this.getRedirectRoute();this.router.navigateByUrl(e||"/");break;case"InvalidCredentialsError":case"NativeAuthStrategyError":this.errorMessage=t.message}})}loadImage(){this.httpClient.get("https://login-image.vendure.io").toPromise().then(t=>{this.updateImage(t)})}updateImage(t){const e=t.user,r=t.location;this.imageUrl=t.urls.regular,this.imageCreator=e.name,this.imageLocation=r.name}getRedirectRoute(){let t;const e=new RegExp(`${a.ONw}=(.*)`);try{const r=window.location.search.match(e);r&&1<r.length&&(t=atob(decodeURIComponent(r[1])))}catch(r){}return t}}c.\u0275fac=function(t){return new(t||c)(n.Y36(a.e80),n.Y36(d.F0),n.Y36(f.eN))},c.\u0275cmp=n.Xpm({type:c,selectors:[["vdr-login"]],decls:38,vars:33,consts:[[1,"login-wrapper"],[1,"login-wrapper-inner"],[1,"login-wrapper-image"],[1,"login-wrapper-image-content"],[1,"login-wrapper-image-title"],[1,"login-wrapper-image-copyright"],["class","creator",4,"ngIf"],["class","location",4,"ngIf"],[3,"src","alt",4,"ngIf"],[1,"login-wrapper-form"],[1,"login-title"],[1,"login-form"],[1,"login-group"],["type","text","name","username","id","login_username",1,"username",3,"ngModel","placeholder","ngModelChange"],["name","password","type","password","id","login_password",1,"password",3,"ngModel","placeholder","ngModelChange"],[1,"login-error",3,"clrAlertType","clrAlertClosable"],[1,"alert-text"],["type","checkbox","clrCheckbox","","id","rememberme","name","rememberme",3,"ngModel","ngModelChange"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[1,"version"],[4,"ngIf"],["src","assets/logo-300px.png",1,"login-wrapper-logo"],[1,"creator"],[1,"location"],[3,"src","alt"]],template:function(t,e){1&t&&(n.TgZ(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4),n._uU(5),n.ALo(6,"translate"),n.qZA(),n.TgZ(7,"div",5),n.YNc(8,_,2,1,"p",6),n.YNc(9,x,2,1,"p",7),n.qZA()(),n.YNc(10,O,1,2,"img",8),n.qZA(),n.TgZ(11,"div",9)(12,"p",10),n._uU(13),n.ALo(14,"translate"),n.qZA(),n.TgZ(15,"form",11)(16,"div",12)(17,"input",13),n.NdJ("ngModelChange",function(m){return e.username=m}),n.ALo(18,"translate"),n.qZA(),n.TgZ(19,"input",14),n.NdJ("ngModelChange",function(m){return e.password=m}),n.ALo(20,"translate"),n.qZA(),n.TgZ(21,"clr-alert",15)(22,"clr-alert-item")(23,"span",16),n._uU(24),n.qZA()()(),n.TgZ(25,"clr-checkbox-wrapper")(26,"input",17),n.NdJ("ngModelChange",function(m){return e.rememberMe=m}),n.qZA(),n.TgZ(27,"label"),n._uU(28),n.ALo(29,"translate"),n.qZA()(),n.TgZ(30,"button",18),n.NdJ("click",function(){return e.logIn()}),n._uU(31),n.ALo(32,"translate"),n.qZA()(),n.TgZ(33,"div",19),n.YNc(34,v,3,2,"span",20),n.YNc(35,b,2,0,"span",20),n.YNc(36,y,2,1,"span",20),n.qZA()()(),n._UZ(37,"img",21),n.qZA()()),2&t&&(n.xp6(5),n.hij(" ",n.lcZ(6,21,"common.login-image-title")," "),n.xp6(3),n.Q6J("ngIf",e.imageCreator),n.xp6(1),n.Q6J("ngIf",e.imageLocation),n.xp6(1),n.Q6J("ngIf",e.imageUrl),n.xp6(3),n.hij(" ",n.lcZ(14,23,"common.login-title")," "),n.xp6(4),n.Q6J("ngModel",e.username)("placeholder",n.lcZ(18,25,"common.username")),n.xp6(2),n.Q6J("ngModel",e.password)("placeholder",n.lcZ(20,27,"common.password")),n.xp6(2),n.ekj("visible",e.errorMessage),n.Q6J("clrAlertType","danger")("clrAlertClosable",!1),n.xp6(3),n.hij(" ",e.errorMessage," "),n.xp6(2),n.Q6J("ngModel",e.rememberMe),n.xp6(2),n.Oqu(n.lcZ(29,29,"common.remember-me")),n.xp6(2),n.Q6J("disabled",!e.username||!e.password),n.xp6(1),n.hij(" ",n.lcZ(32,31,"common.login")," "),n.xp6(3),n.Q6J("ngIf",e.brand),n.xp6(1),n.Q6J("ngIf",!e.hideVendureBranding),n.xp6(1),n.Q6J("ngIf",!e.hideVersion))},directives:[C.O5,g._Y,g.JL,g.F,w.y,g.Fj,g.JJ,g.On,l.TIm,l.CyW,l.I9z,l.PEh,g.Wl,l.KKC,l.MgK],pipes:[M.X$],styles:[".login-wrapper[_ngcontent-%COMP%]{background:#f0f2f5;background-image:none;height:100vh;display:flex;align-items:center;justify-content:center;padding:20px}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%]{background:#fff;width:1120px;height:590px;display:flex;justify-content:flex-start;align-items:stretch;position:relative;border-radius:3px;overflow:hidden}@media (max-width: 992px){.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%]{flex-direction:column;height:auto;width:100%}}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%]{height:100%;flex-grow:1;position:relative}@media (max-width: 992px){.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%]{height:300px}}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{display:block;width:100%;height:100%;object-fit:cover;object-position:center;position:relative;z-index:1}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] .login-wrapper-image-content[_ngcontent-%COMP%]{width:100%;height:100%;position:absolute;left:0;bottom:0;z-index:10;background:#020024;background:linear-gradient(180deg,rgba(2,0,36,0) 0%,rgba(0,0,0,.75) 100%);display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;padding:30px}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] .login-wrapper-image-content[_ngcontent-%COMP%] .login-wrapper-image-title[_ngcontent-%COMP%]{font-size:1.6rem;font-weight:700;color:#fff;margin-bottom:20px}@media (max-width: 992px){.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] .login-wrapper-image-content[_ngcontent-%COMP%] .login-wrapper-image-title[_ngcontent-%COMP%]{font-size:1.2rem}}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] .login-wrapper-image-content[_ngcontent-%COMP%] .login-wrapper-image-copyright[_ngcontent-%COMP%]{opacity:.8}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-image[_ngcontent-%COMP%] .login-wrapper-image-content[_ngcontent-%COMP%] .login-wrapper-image-copyright[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{font-size:.6rem;color:#fff;margin:0!important}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%]{height:100%;width:400px;padding:40px;display:flex;flex-direction:column;align-items:stretch;justify-content:center;box-shadow:0 20px 25px #0000001a;overflow:hidden;border-radius:5px;flex-shrink:0}@media (max-width: 992px){.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%]{height:auto;width:100%;padding:20px}}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%] .login-title[_ngcontent-%COMP%]{font-weight:700;font-size:1.2rem;margin-bottom:20px;color:#afafaf}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%] .login-group[_ngcontent-%COMP%] input.username[_ngcontent-%COMP%], .login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%] .login-group[_ngcontent-%COMP%] input.password[_ngcontent-%COMP%]{display:block;width:100%;margin-bottom:15px;padding:12px 16px!important;background:#fff;font-size:14px;line-height:22px;color:#52667a;outline:none;-webkit-appearance:none}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-form[_ngcontent-%COMP%] .login-group[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{width:100%!important;margin-top:20px!important}.login-wrapper[_ngcontent-%COMP%] .login-wrapper-inner[_ngcontent-%COMP%] .login-wrapper-logo[_ngcontent-%COMP%]{width:60px;height:auto;position:absolute;right:20px;top:20px}.version[_ngcontent-%COMP%]{flex:1;flex-grow:1;display:flex;align-items:flex-end;justify-content:center;color:var(--color-grey-300)}.version[_ngcontent-%COMP%] span[_ngcontent-%COMP%] + span[_ngcontent-%COMP%]{margin-left:5px}.login-error[_ngcontent-%COMP%]{max-height:0;overflow:hidden}.login-error.visible[_ngcontent-%COMP%]{max-height:46px;transition:max-height .2s;animation:shake .82s cubic-bezier(.36,.07,.19,.97) both;animation-delay:.2s;transform:translate(0);-webkit-backface-visibility:hidden;backface-visibility:hidden;perspective:1000px}@keyframes shake{10%,90%{transform:translate(-1px)}20%,80%{transform:translate(2px)}30%,50%,70%{transform:translate(-4px)}40%,60%{transform:translate(4px)}}"]});var Z=i(635);class p{constructor(t,e){this.router=t,this.authService=e}canActivate(t){return this.authService.checkAuthenticatedStatus().pipe((0,Z.U)(e=>(e&&this.router.navigate(["/"]),!e)))}}p.\u0275fac=function(t){return new(t||p)(n.LFG(d.F0),n.LFG(a.e80))},p.\u0275prov=n.Yz7({token:p,factory:p.\u0275fac,providedIn:"root"});const u=[{path:"",component:c,pathMatch:"full",canActivate:[p]}];class s{}s.\u0275fac=function(t){return new(t||s)},s.\u0275mod=n.oAB({type:s}),s.\u0275inj=n.cJS({imports:[[a.m81,d.Bz.forChild(u)]]})}}]);
2
+ //# sourceMappingURL=625.ce0752367b2918a3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"mappings":"6TAQoBA,gBAAwCA,SAAwCA,8BAAxCA,oFACxCA,gBAA0CA,SAAmBA,8BAAnBA,yDAGlDA,uCAAsBA,8BAAgB,yCAmDEA,gBAAmDA,aAACA,kCAApFA,gBAAoBA,SAAYA,yBAA2DA,8BAAvEA,+BAAmBA,qFACvCA,gBAAmCA,mBAAOA,kCAC1CA,gBAA2BA,SAAcA,8BAAdA,kCCvDxC,QAcHC,YAAoBC,EAAkCC,EAAwBC,GAA1DC,mBAAkCA,cAAwBA,kBAb9EA,cAAW,GACXA,cAAW,GACXA,iBAAa,EACbA,aAAUC,MAEVD,YAAQ,WAAeE,MACvBF,0BAAsB,WAAeG,oBACrCH,kBAAc,WAAeI,YAC7BJ,uBAAiBC,SAAeI,WAChCL,cAAW,GACXA,mBAAgB,GAChBA,kBAAe,GAGXA,KAASM,eACLN,KAAKO,SAAWP,KAAKM,eAErBN,KAAKQ,YAIbC,QACIT,KAAKU,kBAAe,EACpBV,KAAKW,YAAYF,MAAMT,KAAKY,SAAUZ,KAAKa,SAAUb,KAAKc,YAAYC,UAAUlB,IAC5E,OAAQA,EAAOmB,gBACN,cACD,MAAMlB,EAAWE,KAAKiB,mBACtBjB,KAAKkB,OAAOC,cAAcrB,GAAsB,KAChD,UACC,8BACA,0BACDE,KAAKU,aAAeb,EAAOuB,WAM3CZ,YACIR,KAAKqB,WACAC,IAAI,kCACJC,YACAC,KAAK3B,IACFG,KAAKyB,YAAY5B,KAI7B4B,YAAY5B,GACR,MAAMC,EAAaD,EAAY6B,KACzB3B,EAAiBF,EAAY8B,SAEnC3B,KAAKO,SAAYV,EAAY+B,KAAKC,QAClC7B,KAAK8B,aAAehC,EAAKiC,KACzB/B,KAAKgC,cAAgBjC,EAASgC,KAO1Bd,mBACJ,IAAIpB,EACJ,MAAMC,EAAK,IAAImC,OAAO,GAAGhC,cACzB,IACI,MAAMF,EAAkBmC,OAAOP,SAASQ,OAAOC,MAAMtC,GACjDC,GAAmB,EAAIA,EAAgBsC,SACvCxC,EAAayC,KAAKC,mBAAmBxC,EAAgB,YAEpDA,IAGT,OAAOF,yCAvEF2C,GAAc7C,+DAAd6C,EAAcC,2+BDV3B9C,iBAA2B,UAA3BA,CAA2B,UAA3BA,CAA2B,UAA3BA,CAA2B,WAKPA,8BACJA,QACAA,iBACIA,qBACAA,qBACJA,UAEJA,wBACJA,QACAA,kBAAgC,WAExBA,gCACJA,QACAA,oBAAyB,YAAzBA,CAAyB,eAObA,8EALJA,QAQAA,qBAKIA,8EALJA,QAQAA,yBAAoH,oBAApHA,CAAoH,cAGxGA,UACJA,YAGRA,iCAAsB,eAMdA,0DALJA,QAOAA,kBAAOA,gCAAsCA,UAEjDA,sBAGIA,gCAASG,YAGTH,gCACJA,UAEJA,mBACIA,0BACAA,0BACAA,0BACJA,YAGRA,mBACJA,iBAjEgBA,+DAGIA,sCACAA,uCAGNA,kCAIFA,0DASQA,qCAAsB,8CAQtBA,qCAAsB,8CAGuCA,yCAAtDA,+BAAyB,uBAGxBA,uCAUJA,uCAEGA,kDAMPA,oDAEAA,oDAIGA,+BACAA,8CACAA,igKErDpB,QACHC,YAAoBC,EAAwBC,GAAxBE,cAAwBA,mBAE5C0C,YAAY7C,GACR,OAAOG,KAAKW,YAAYgC,2BAA2BC,QAC/CC,KAAI/C,IACIA,GACAE,KAAKkB,OAAO4B,SAAS,CAAC,OAElBhD,4CATXiD,GAAUpD,qDAAVoD,EAAUC,QAAVD,EAAU,qBAFP,SCLT,MAAME,EAAsB,CAC/B,CACIC,KAAM,GACNC,UAAWX,EACXY,UAAW,OACXV,YAAa,CAACK,KCEf,+CAAMM,4DAJA,CAACpD,MAAcqD,cAAsBL","names":["n","constructor","t","e","r","this","a","brand","hideVendureBranding","hideVersion","loginImage","customImageUrl","imageUrl","loadImage","logIn","errorMessage","authService","username","password","rememberMe","subscribe","__typename","getRedirectRoute","router","navigateByUrl","message","httpClient","get","toPromise","then","updateImage","user","location","urls","regular","imageCreator","name","imageLocation","RegExp","window","search","match","length","atob","decodeURIComponent","c","selectors","canActivate","checkAuthenticatedStatus","pipe","Z","navigate","p","factory","u","path","component","pathMatch","s","d"],"sources":["./src/lib/login/src/components/login/login.component.html","./src/lib/login/src/components/login/login.component.ts","./src/lib/login/src/providers/login.guard.ts","./src/lib/login/src/login.routes.ts","./src/lib/login/src/login.module.ts"],"sourcesContent":["<div class=\"login-wrapper\">\r\n <div class=\"login-wrapper-inner\">\r\n <div class=\"login-wrapper-image\">\r\n <div class=\"login-wrapper-image-content\">\r\n <div class=\"login-wrapper-image-title\">\r\n {{ 'common.login-image-title' | translate }}\r\n </div>\r\n <div class=\"login-wrapper-image-copyright\">\r\n <p *ngIf=\"imageCreator\" class=\"creator\">Photo by {{ imageCreator }} on Unsplash</p>\r\n <p *ngIf=\"imageLocation\" class=\"location\">{{ imageLocation }}</p>\r\n </div>\r\n </div>\r\n <img *ngIf=\"imageUrl\" [src]=\"imageUrl\" [alt]=\"imageUrl\">\r\n </div>\r\n <div class=\"login-wrapper-form\">\r\n <p class=\"login-title\">\r\n {{ 'common.login-title' | translate }}\r\n </p>\r\n <form class=\"login-form\">\r\n <div class=\"login-group\">\r\n <input\r\n class=\"username\"\r\n type=\"text\"\r\n name=\"username\"\r\n id=\"login_username\"\r\n [(ngModel)]=\"username\"\r\n [placeholder]=\"'common.username' | translate\"\r\n />\r\n <input\r\n class=\"password\"\r\n name=\"password\"\r\n type=\"password\"\r\n id=\"login_password\"\r\n [(ngModel)]=\"password\"\r\n [placeholder]=\"'common.password' | translate\"\r\n />\r\n <clr-alert [clrAlertType]=\"'danger'\" [clrAlertClosable]=\"false\" [class.visible]=\"errorMessage\" class=\"login-error\">\r\n <clr-alert-item>\r\n <span class=\"alert-text\">\r\n {{ errorMessage }}\r\n </span>\r\n </clr-alert-item>\r\n </clr-alert>\r\n <clr-checkbox-wrapper>\r\n <input\r\n type=\"checkbox\"\r\n clrCheckbox\r\n id=\"rememberme\"\r\n name=\"rememberme\"\r\n [(ngModel)]=\"rememberMe\"\r\n />\r\n <label>{{ 'common.remember-me' | translate }}</label>\r\n </clr-checkbox-wrapper>\r\n <button\r\n type=\"submit\"\r\n class=\"btn btn-primary\"\r\n (click)=\"logIn()\"\r\n [disabled]=\"!username || !password\"\r\n >\r\n {{ 'common.login' | translate }}\r\n </button>\r\n </div>\r\n <div class=\"version\">\r\n <span *ngIf=\"brand\">{{ brand }} <span *ngIf=\"!hideVendureBranding || !hideVersion\">-</span></span>\r\n <span *ngIf=\"!hideVendureBranding\">vendure</span>\r\n <span *ngIf=\"!hideVersion\">v{{ version }}</span>\r\n </div>\r\n </form>\r\n </div>\r\n <img class=\"login-wrapper-logo\" src=\"assets/logo-300px.png\" />\r\n </div>\r\n</div>\r\n","import { HttpClient, HttpParams } from '@angular/common/http';\r\nimport { Component } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { ADMIN_UI_VERSION, AuthService, AUTH_REDIRECT_PARAM, getAppConfig } from '@vendure/admin-ui/core';\r\n\r\n@Component({\r\n selector: 'vdr-login',\r\n templateUrl: './login.component.html',\r\n styleUrls: ['./login.component.scss'],\r\n})\r\nexport class LoginComponent {\r\n username = '';\r\n password = '';\r\n rememberMe = false;\r\n version = ADMIN_UI_VERSION;\r\n errorMessage: string | undefined;\r\n brand = getAppConfig().brand;\r\n hideVendureBranding = getAppConfig().hideVendureBranding;\r\n hideVersion = getAppConfig().hideVersion;\r\n customImageUrl = getAppConfig().loginImage;\r\n imageUrl = '';\r\n imageLocation = '';\r\n imageCreator = '';\r\n\r\n constructor(private authService: AuthService, private router: Router, private httpClient: HttpClient) {\r\n if (this.customImageUrl) {\r\n this.imageUrl = this.customImageUrl;\r\n } else {\r\n this.loadImage();\r\n }\r\n }\r\n\r\n logIn(): void {\r\n this.errorMessage = undefined;\r\n this.authService.logIn(this.username, this.password, this.rememberMe).subscribe(result => {\r\n switch (result.__typename) {\r\n case 'CurrentUser':\r\n const redirect = this.getRedirectRoute();\r\n this.router.navigateByUrl(redirect ? redirect : '/');\r\n break;\r\n case 'InvalidCredentialsError':\r\n case 'NativeAuthStrategyError':\r\n this.errorMessage = result.message;\r\n break;\r\n }\r\n });\r\n }\r\n\r\n loadImage() {\r\n this.httpClient\r\n .get('https://login-image.vendure.io')\r\n .toPromise()\r\n .then(res => {\r\n this.updateImage(res);\r\n });\r\n }\r\n\r\n updateImage(res) {\r\n const user: any = (res as any).user;\r\n const location: any = (res as any).location;\r\n\r\n this.imageUrl = (res as any).urls.regular;\r\n this.imageCreator = user.name;\r\n this.imageLocation = location.name;\r\n }\r\n\r\n /**\r\n * Attempts to read a redirect param from the current url and parse it into a\r\n * route from which the user was redirected after a 401 error.\r\n */\r\n private getRedirectRoute(): string | undefined {\r\n let redirectTo: string | undefined;\r\n const re = new RegExp(`${AUTH_REDIRECT_PARAM}=(.*)`);\r\n try {\r\n const redirectToParam = window.location.search.match(re);\r\n if (redirectToParam && 1 < redirectToParam.length) {\r\n redirectTo = atob(decodeURIComponent(redirectToParam[1]));\r\n }\r\n } catch (e: any) {\r\n // ignore\r\n }\r\n return redirectTo;\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { ActivatedRouteSnapshot, CanActivate, Router } from '@angular/router';\r\nimport { AuthService } from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\n/**\r\n * This guard prevents loggen-in users from navigating to the login screen.\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class LoginGuard implements CanActivate {\r\n constructor(private router: Router, private authService: AuthService) {}\r\n\r\n canActivate(route: ActivatedRouteSnapshot): Observable<boolean> {\r\n return this.authService.checkAuthenticatedStatus().pipe(\r\n map(authenticated => {\r\n if (authenticated) {\r\n this.router.navigate(['/']);\r\n }\r\n return !authenticated;\r\n }),\r\n );\r\n }\r\n}\r\n","import { Routes } from '@angular/router';\r\n\r\nimport { LoginComponent } from './components/login/login.component';\r\nimport { LoginGuard } from './providers/login.guard';\r\n\r\nexport const loginRoutes: Routes = [\r\n {\r\n path: '',\r\n component: LoginComponent,\r\n pathMatch: 'full',\r\n canActivate: [LoginGuard],\r\n },\r\n];\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule } from '@angular/router';\r\nimport { SharedModule } from '@vendure/admin-ui/core';\r\n\r\nimport { LoginComponent } from './components/login/login.component';\r\nimport { loginRoutes } from './login.routes';\r\n\r\n@NgModule({\r\n imports: [SharedModule, RouterModule.forChild(loginRoutes)],\r\n exports: [],\r\n declarations: [LoginComponent],\r\n})\r\nexport class LoginModule {}\r\n"],"sourceRoot":"webpack:///","file":"625.ce0752367b2918a3.js"}
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[654],{5654:(So,le,i)=>{i.r(le),i.d(le,{AddCustomerToGroupDialogComponent:()=>S,AddressCardComponent:()=>I,AddressDetailDialogComponent:()=>L,CustomerDetailComponent:()=>P,CustomerGroupDetailDialogComponent:()=>T,CustomerGroupListComponent:()=>w,CustomerGroupMemberListComponent:()=>A,CustomerHistoryComponent:()=>O,CustomerHistoryEntryHostComponent:()=>F,CustomerListComponent:()=>M,CustomerModule:()=>G,CustomerResolver:()=>D,CustomerStatusLabelComponent:()=>Z,SelectCustomerGroupDialogComponent:()=>J,customerBreadcrumb:()=>ye,customerRoutes:()=>ve});var E=i(6317),g=i(2673),p=i(635),e=i(3184),d=i(9950),q=i(309),l=i(587),K=i(253),z=i(6562),k=i(4874),ee=i(8977),te=i(1989),oe=i(9337),se=i(8951),C=i(9720),N=i(7890),$=i(365),ne=i(901),re=i(8899),v=i(7514),_=i(6362),U=i(7388);const be=function(s){return["/customer","customers",s]};function Ae(s,o){if(1&s&&(e.TgZ(0,"td",3),e._uU(1),e.qZA(),e.TgZ(2,"td",3),e._uU(3),e.qZA(),e.TgZ(4,"td",4),e._UZ(5,"vdr-table-row-action",5),e.ALo(6,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("label",e.lcZ(6,6,"common.edit"))("linkTo",e.VKq(8,be,t.id))}}class A{constructor(o,t){this.router=o,this.dataService=t,this.selectedMemberIds=[],this.selectionChange=new e.vpe,this.fetchParamsChange=new e.vpe,this.filterTermControl=new l.NI(""),this.refresh$=new E.X(!0),this.destroy$=new K.x,this.isMemberSelected=n=>-1<this.selectedMemberIds.indexOf(n.id)}ngOnInit(){this.membersCurrentPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPage")),(0,p.U)(t=>t?+t:1),(0,k.O)(1),(0,ee.x)()),this.membersItemsPerPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPerPage")),(0,p.U)(t=>t?+t:10),(0,k.O)(10),(0,ee.x)());const o=this.filterTermControl.valueChanges.pipe((0,te.b)(250),(0,oe.b)(()=>this.setContentsPageNumber(1)),(0,k.O)(""));(0,z.a)(this.membersCurrentPage$,this.membersItemsPerPage$,o,this.refresh$).pipe((0,se.R)(this.destroy$)).subscribe(([t,n,r])=>{const a=n,c=(t-1)*n;this.fetchParamsChange.emit({filterTerm:r,skip:c,take:a})})}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete()}setContentsPageNumber(o){this.setParam("membersPage",o)}setContentsItemsPerPage(o){this.setParam("membersPerPage",o)}refresh(){this.refresh$.next(!0)}setParam(o,t){this.router.navigate(["./",Object.assign(Object.assign({},this.route.snapshot.params),{[o]:t})],{relativeTo:this.route,queryParamsHandling:"merge"})}areAllSelected(){return!!this.members&&this.selectedMemberIds.length===this.members.length}toggleSelectAll(){this.areAllSelected()?this.selectionChange.emit([]):this.selectionChange.emit(this.members.map(o=>o.id))}toggleSelectMember({item:o}){this.selectedMemberIds.includes(o.id)?this.selectionChange.emit(this.selectedMemberIds.filter(t=>t!==o.id)):this.selectionChange.emit([...this.selectedMemberIds,o.id])}}A.\u0275fac=function(o){return new(o||A)(e.Y36(C.F0),e.Y36(d.DoR))},A.\u0275cmp=e.Xpm({type:A,selectors:[["vdr-customer-group-member-list"]],inputs:{members:"members",totalItems:"totalItems",route:"route",selectedMemberIds:"selectedMemberIds"},outputs:{selectionChange:"selectionChange",fetchParamsChange:"fetchParamsChange"},decls:14,vars:24,consts:[["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[3,"items","itemsPerPage","totalItems","currentPage","allSelected","isRowSelectedFn","pageChange","itemsPerPageChange","rowSelectChange","allSelectChange"],[3,"expand"],[1,"left","align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"]],template:function(o,t){1&o&&(e._UZ(0,"input",0),e.ALo(1,"translate"),e.TgZ(2,"vdr-data-table",1),e.NdJ("pageChange",function(r){return t.setContentsPageNumber(r)})("itemsPerPageChange",function(r){return t.setContentsItemsPerPage(r)})("rowSelectChange",function(r){return t.toggleSelectMember(r)})("allSelectChange",function(){return t.toggleSelectAll()}),e.ALo(3,"async"),e.ALo(4,"async"),e.ALo(5,"hasPermission"),e.TgZ(6,"vdr-dt-column",2),e._uU(7),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"vdr-dt-column",2),e._uU(10),e.ALo(11,"translate"),e.qZA(),e._UZ(12,"vdr-dt-column"),e.YNc(13,Ae,7,10,"ng-template"),e.qZA()),2&o&&(e.Q6J("formControl",t.filterTermControl)("placeholder",e.lcZ(1,12,"customer.search-customers-by-email")),e.xp6(2),e.Q6J("items",t.members)("itemsPerPage",e.lcZ(3,14,t.membersItemsPerPage$))("totalItems",t.totalItems)("currentPage",e.lcZ(4,16,t.membersCurrentPage$))("allSelected",t.areAllSelected())("isRowSelectedFn",e.lcZ(5,18,"UpdateCustomerGroup")&&t.isMemberSelected),e.xp6(4),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(8,20,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(11,22,"customer.email-address")))},directives:[N.y,l.Fj,l.JJ,l.oH,$.Q,ne.E,re.v],pipes:[v.X$,_.Ov,U.j],styles:[""],changeDetection:0});var Y=i(8318);const Ze=function(s){return{groupName:s}};function Te(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw();e.hij(" ",e.xi3(1,1,"customer.add-customers-to-group-with-name",e.VKq(4,Ze,t.group.name)),"\n")}}const De=function(s){return{count:s}};function Ne(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",3),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customers-to-group-with-count",e.VKq(8,De,t.selectedCustomerIds.length))," ")}}class S{constructor(o){this.dataService=o,this.selectedCustomerIds=[],this.fetchGroupMembers$=new E.X({skip:0,take:10,filterTerm:""})}ngOnInit(){const o=this.fetchGroupMembers$.pipe((0,g.w)(({skip:t,take:n,filterTerm:r})=>this.dataService.customer.getCustomerList(n,t,r).mapStream(a=>a.customers)));this.customers$=o.pipe((0,p.U)(t=>t.items)),this.customersTotal$=o.pipe((0,p.U)(t=>t.totalItems))}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedCustomerIds)}}S.\u0275fac=function(o){return new(o||S)(e.Y36(d.DoR))},S.\u0275cmp=e.Xpm({type:S,selectors:[["vdr-add-customer-to-group-dialog"]],decls:5,vars:8,consts:[["vdrDialogTitle",""],[3,"members","totalItems","route","selectedMemberIds","fetchParamsChange","selectionChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Te,2,6,"ng-template",0),e.TgZ(1,"vdr-customer-group-member-list",1),e.NdJ("fetchParamsChange",function(r){return t.fetchGroupMembers$.next(r)})("selectionChange",function(r){return t.selectedCustomerIds=r}),e.ALo(2,"async"),e.ALo(3,"async"),e.qZA(),e.YNc(4,Ne,6,10,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("members",e.lcZ(2,4,t.customers$))("totalItems",e.lcZ(3,6,t.customersTotal$))("route",t.route)("selectedMemberIds",t.selectedCustomerIds))},directives:[q.q,A,Y.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var H=i(116),de=i(9295),Ue=i(1480);function Se(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij("",t,",")}}function Le(s,o){if(1&s&&(e.TgZ(0,"span"),e._uU(1),e.qZA()),2&s){const t=o.ngIf;e.xp6(1),e.hij(" ",t,"")}}function Ie(s,o){if(1&s&&(e.YNc(0,Se,2,1,"span",3),e.YNc(1,Le,2,1,"span",3)),2&s){const t=e.oxw();let n,r;e.Q6J("ngIf",null==(n=t.addressForm.get("streetLine1"))?null:n.value),e.xp6(1),e.Q6J("ngIf",null==(r=t.addressForm.get("countryCode"))?null:r.value)}}function Je(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.addressForm.valid||!t.addressForm.touched),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.update")," ")}}class L{constructor(o){this.changeDetector=o,this.availableCountries=[]}ngOnInit(){this.addressForm.valueChanges.subscribe(()=>this.changeDetector.markForCheck())}cancel(){this.resolveWith()}save(){this.resolveWith(this.addressForm)}}L.\u0275fac=function(o){return new(o||L)(e.Y36(e.sBO))},L.\u0275cmp=e.Xpm({type:L,selectors:[["vdr-address-detail-dialog"]],decls:3,vars:3,consts:[["vdrDialogTitle",""],[3,"formGroup","availableCountries","customFields"],["vdrDialogButtons",""],[4,"ngIf"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Ie,2,2,"ng-template",0),e._UZ(1,"vdr-address-form",1),e.YNc(2,Je,6,7,"ng-template",2)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.addressForm)("availableCountries",t.availableCountries)("customFields",t.customFields))},directives:[q.q,_.O5,Ue.C,l.JL,l.sg,Y.n],pipes:[v.X$],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});var Q=i(4447),b=i(2748),Fe=i(9667),ie=i(3146),j=i(735),R=i(1519),B=i(8854),V=i(5111);function Oe(s,o){if(1&s&&(e.TgZ(0,"span",13),e._uU(1),e.qZA()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.hij("",t.streetLine1,",")}}function Pe(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",15),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-shipping-address")," "))}function we(s,o){1&s&&(e.TgZ(0,"vdr-chip",14),e._UZ(1,"clr-icon",16),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.default-billing-address")," "))}function Me(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",17),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).editAddress()}),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown")(5,"button",18),e._uU(6),e.ALo(7,"translate"),e._UZ(8,"clr-icon",19),e.qZA(),e.TgZ(9,"vdr-dropdown-menu")(10,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultShippingAddress()}),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).setAsDefaultBillingAddress()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",21),e.TgZ(17,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).delete()}),e._UZ(18,"clr-icon",23),e._uU(19),e.ALo(20,"translate"),e.qZA()()(),e.BQk()}if(2&s){const t=e.oxw(2);e.xp6(2),e.hij(" ",e.lcZ(3,7,"common.edit")," "),e.xp6(4),e.hij(" ",e.lcZ(7,9,"common.more")," "),e.xp6(4),e.Q6J("disabled",t.isDefaultShipping),e.xp6(1),e.hij(" ",e.lcZ(12,11,"customer.set-as-default-shipping-address")," "),e.xp6(2),e.Q6J("disabled",t.isDefaultBilling),e.xp6(1),e.hij(" ",e.lcZ(15,13,"customer.set-as-default-billing-address")," "),e.xp6(5),e.hij(" ",e.lcZ(20,15,"common.delete")," ")}}function Ge(s,o){if(1&s&&(e.TgZ(0,"div",1)(1,"div",2)(2,"div",3),e.YNc(3,Oe,2,1,"span",4),e._uU(4),e.qZA(),e.TgZ(5,"div",5),e.YNc(6,Pe,4,3,"vdr-chip",6),e.YNc(7,we,4,3,"vdr-chip",6),e.qZA()(),e.TgZ(8,"div",7)(9,"div",8),e._UZ(10,"vdr-formatted-address",9),e.qZA()(),e.TgZ(11,"div",10),e._UZ(12,"vdr-entity-info",11),e.YNc(13,Me,21,17,"ng-container",12),e.qZA()()),2&s){const t=o.ngIf,n=e.oxw();e.xp6(3),e.Q6J("ngIf",t.streetLine1),e.xp6(1),e.hij(" ",t.countryCode," "),e.xp6(2),e.Q6J("ngIf",n.isDefaultShipping),e.xp6(1),e.Q6J("ngIf",n.isDefaultBilling),e.xp6(3),e.Q6J("address",t),e.xp6(2),e.Q6J("entity",t),e.xp6(1),e.Q6J("ngIf",n.editable)}}class I{constructor(o,t){this.modalService=o,this.changeDetector=t,this.availableCountries=[],this.editable=!0,this.setAsDefaultShipping=new e.vpe,this.setAsDefaultBilling=new e.vpe,this.deleteAddress=new e.vpe,this.dataDependenciesPopulated=new E.X(!1)}ngOnInit(){this.addressForm.get("streetLine1").value||this.dataDependenciesPopulated.pipe((0,H.h)(t=>t),(0,de.q)(1)).subscribe(()=>{this.editAddress()})}ngOnChanges(o){null!=this.customFields&&null!=this.availableCountries&&this.dataDependenciesPopulated.next(!0)}getCountryName(o){if(!this.availableCountries)return"";const t=this.availableCountries.find(n=>n.code===o);return t?t.name:""}setAsDefaultBillingAddress(){this.setAsDefaultBilling.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}setAsDefaultShippingAddress(){this.setAsDefaultShipping.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}delete(){this.deleteAddress.emit(this.addressForm.value.id),this.addressForm.markAsDirty()}editAddress(){this.modalService.fromComponent(L,{locals:{addressForm:this.addressForm,customFields:this.customFields,availableCountries:this.availableCountries},size:"md",closable:!0}).subscribe(()=>{this.changeDetector.markForCheck()})}}I.\u0275fac=function(o){return new(o||I)(e.Y36(d.Z7U),e.Y36(e.sBO))},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-address-card"]],inputs:{addressForm:"addressForm",customFields:"customFields",availableCountries:"availableCountries",isDefaultBilling:"isDefaultBilling",isDefaultShipping:"isDefaultShipping",editable:"editable"},outputs:{setAsDefaultShipping:"setAsDefaultShipping",setAsDefaultBilling:"setAsDefaultBilling",deleteAddress:"deleteAddress"},features:[e.TTD],decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"address-title"],["class","street-line",4,"ngIf"],[1,"default-controls"],["class","is-default p8",4,"ngIf"],[1,"card-block"],[1,"card-text"],[3,"address"],[1,"card-footer"],[3,"entity"],[4,"ngIf"],[1,"street-line"],[1,"is-default","p8"],["shape","truck"],["shape","credit-card"],[1,"btn","btn-sm","btn-link",3,"click"],["type","button","vdrDropdownTrigger","",1,"btn","btn-sm","btn-link"],["shape","caret down"],["vdrDropdownItem","",1,"button",3,"disabled","click"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"delete-button",3,"click"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&e.YNc(0,Ge,14,7,"div",0),2&o&&e.Q6J("ngIf",t.addressForm.value)},directives:[_.O5,Q.Y,b.qvL,Fe.b,ie.V,j.J,R.U,B.N,V.H],pipes:[v.X$],styles:["[_nghost-%COMP%]{display:block;max-width:360px}clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}.defaul-controls[_ngcontent-%COMP%]{display:flex}.is-default[_ngcontent-%COMP%]{margin:0;color:var(--color-success-500)}"],changeDetection:0});var Ee=i(4929),m=i(8270),Qe=i(234),qe=i(1640),me=i(7400),y=i(591),ke=i(9196),$e=i(1944);const{isArray:Ye}=Array;var je=i(1308),ue=i(420);function Re(...s){const o=(0,ue.yG)(s),t=(0,ue._6)(s,1/0);return s=function He(s){return 1===s.length&&Ye(s[0])?s[0]:s}(s),(0,$e.e)((n,r)=>{(0,je.J)(t)((0,me.D)([n,...s],o)).subscribe(r)})}var Be=i(9525),Ve=i(3853),ae=i(8660);function Xe(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.add-customer-to-group"),"\n")}function We(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"span",5),e.NdJ("click",function(){const r=e.CHM(t),a=r.item;return r.clear(a)}),e._uU(1," \xd7 "),e.qZA(),e.TgZ(2,"vdr-chip",6),e._uU(3),e.qZA()}if(2&s){const t=o.item;e.xp6(2),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Ke(s,o){if(1&s&&(e.TgZ(0,"vdr-chip",6),e._uU(1),e.qZA()),2&s){const t=o.item;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}const ze=function(s){return{count:s}};function et(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().add()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.selectedGroupIds.length),e.xp6(1),e.hij(" ",e.xi3(5,5,"customer.add-customer-to-groups-with-count",e.VKq(8,ze,t.selectedGroupIds.length))," ")}}class J{constructor(o){this.dataService=o,this.selectedGroupIds=[]}ngOnInit(){this.groups$=this.dataService.customer.getCustomerGroupList().mapStream(o=>o.customerGroups.items)}cancel(){this.resolveWith()}add(){this.resolveWith(this.selectedGroupIds)}}J.\u0275fac=function(o){return new(o||J)(e.Y36(d.DoR))},J.\u0275cmp=e.Xpm({type:J,selectors:[["vdr-select-customer-group-dialog"]],decls:6,vars:8,consts:[["vdrDialogTitle",""],["appendTo","body","bindValue","id",3,"items","addTag","multiple","ngModel","clearable","searchable","ngModelChange"],["ng-label-tmp",""],["ng-option-tmp",""],["vdrDialogButtons",""],["aria-hidden","true",1,"ng-value-icon","left",3,"click"],[3,"colorFrom"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,Xe,2,3,"ng-template",0),e.TgZ(1,"ng-select",1),e.NdJ("ngModelChange",function(r){return t.selectedGroupIds=r}),e.ALo(2,"async"),e.YNc(3,We,4,2,"ng-template",2),e.YNc(4,Ke,2,2,"ng-template",3),e.qZA(),e.YNc(5,et,6,10,"ng-template",4)),2&o&&(e.xp6(1),e.Q6J("items",e.lcZ(2,6,t.groups$))("addTag",!1)("multiple",!0)("ngModel",t.selectedGroupIds)("clearable",!0)("searchable",!1))},directives:[q.q,ae.w9,l.JJ,l.On,ae.mR,Q.Y,ae.ir,Y.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var x=i(7346);function tt(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",1),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.verified")," "))}function ot(s,o){1&s&&(e.ynx(0),e._UZ(1,"clr-icon",2),e._uU(2),e.ALo(3,"translate"),e.BQk()),2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.registered")," "))}function st(s,o){if(1&s&&(e.TgZ(0,"vdr-chip"),e.YNc(1,tt,4,3,"ng-container",0),e.YNc(2,ot,4,3,"ng-container",0),e.qZA()),2&s){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.verified),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.verified))}}function nt(s,o){1&s&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.guest")))}class Z{}Z.\u0275fac=function(o){return new(o||Z)},Z.\u0275cmp=e.Xpm({type:Z,selectors:[["vdr-customer-status-label"]],inputs:{customer:"customer"},decls:2,vars:2,consts:[[4,"ngIf"],["shape","check-circle",1,"verified-user-icon"],["shape","check-circle",1,"registered-user-icon"]],template:function(o,t){1&o&&(e.YNc(0,st,3,2,"vdr-chip",0),e.YNc(1,nt,3,3,"vdr-chip",0)),2&o&&(e.Q6J("ngIf",null==t.customer.user?null:t.customer.user.id),e.xp6(1),e.Q6J("ngIf",!(null!=t.customer.user&&t.customer.user.id)))},directives:[_.O5,Q.Y,b.qvL],pipes:[v.X$],styles:[".registered-user-icon[_ngcontent-%COMP%]{color:var(--color-grey-300)}.verified-user-icon[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});var ce=i(8276),X=i(9416),pe=i(4652),_e=i(837),rt=i(2505),ge=i(2355);const it=["portal"];class F{constructor(o,t){this.componentFactoryResolver=o,this.historyEntryComponentService=t,this.expandClick=new e.vpe}ngOnInit(){const o=this.historyEntryComponentService.getComponent(this.entry.type),t=this.componentFactoryResolver.resolveComponentFactory(o),n=this.portalRef.createComponent(t);n.instance.entry=this.entry,n.instance.customer=this.customer,this.instance=n.instance,this.componentRef=n}ngOnDestroy(){var o;null===(o=this.componentRef)||void 0===o||o.destroy()}}F.\u0275fac=function(o){return new(o||F)(e.Y36(e._Vd),e.Y36(d.GwB))},F.\u0275cmp=e.Xpm({type:F,selectors:[["vdr-customer-history-entry-host"]],viewQuery:function(o,t){if(1&o&&e.Gf(it,7,e.s_b),2&o){let n;e.iGM(n=e.CRH())&&(t.portalRef=n.first)}},inputs:{entry:"entry",customer:"customer",expanded:"expanded"},outputs:{expandClick:"expandClick"},exportAs:["historyEntry"],decls:3,vars:6,consts:[[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],["portal",""]],template:function(o,t){1&o&&(e.TgZ(0,"vdr-timeline-entry",0),e.NdJ("expandClick",function(){return t.expandClick.emit()}),e._UZ(1,"div",null,1),e.qZA()),2&o&&e.Q6J("displayType",t.instance.getDisplayType(t.entry))("iconShape",t.instance.getIconShape&&t.instance.getIconShape(t.entry))("createdAt",t.entry.createdAt)("name",t.instance.getName&&t.instance.getName(t.entry))("featured",t.instance.isFeatured(t.entry))("collapsed",!t.expanded&&!t.instance.isFeatured(t.entry))},directives:[ge._],encapsulation:2});var at=i(4664),ct=i(2702),lt=i(7368);function dt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",4)(1,"div",5)(2,"textarea",6),e.NdJ("ngModelChange",function(r){e.CHM(t);return e.oxw().note=r}),e.qZA(),e.TgZ(3,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().addNoteToCustomer()}),e._uU(4),e.ALo(5,"translate"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(5,3,"order.add-note")," ")}}function mt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-customer-history-entry-host",10),e.NdJ("expandClick",function(){e.CHM(t);const r=e.oxw(2);return r.expanded=!r.expanded}),e.qZA()}if(2&s){const t=e.oxw().$implicit,n=e.oxw();e.Q6J("customer",n.customer)("entry",t)("expanded",n.expanded)}}function ut(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}const he=function(s){return{strategy:s}};function pt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(3).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,he,t.data.strategy))," ")}}function _t(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",15),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ut,3,3,"ng-container",16),e.YNc(5,pt,2,6,"ng-template",null,17,e.W1O),e.BQk()),2&s){const t=e.MAs(6),n=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-registered")," "),e.xp6(2),e.Q6J("ngIf","native"===n.data.strategy)("ngIfElse",t)}}function gt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-using-native-auth-strategy")," "))}function ht(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(3).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,he,t.data.strategy))," ")}}function ft(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",15),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,gt,3,3,"ng-container",16),e.YNc(5,ht,2,6,"ng-template",null,17,e.W1O),e.BQk()),2&s){const t=e.MAs(6),n=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-verified")," "),e.xp6(2),e.Q6J("ngIf","native"===n.data.strategy)("ngIfElse",t)}}function Ct(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",18),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail"),e._UZ(5,"vdr-object-tree",19),e.qZA()(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.history-customer-detail-updated")," "),e.xp6(3),e.Q6J("value",t.data.input)}}const fe=function(s){return{groupName:s}};function vt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-added-to-group",e.VKq(4,fe,t.data.groupName))," ")}}function yt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-removed-from-group",e.VKq(4,fe,t.data.groupName))," ")}}function xt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",18)(4,"div",20),e._uU(5),e.qZA()(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-created")," "),e.xp6(4),e.Oqu(t.data.address)}}function bt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",18)(4,"div",20),e._uU(5),e.qZA(),e.TgZ(6,"vdr-history-entry-detail"),e._UZ(7,"vdr-object-tree",19),e.qZA()(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"customer.history-customer-address-updated")," "),e.xp6(4),e.Oqu(t.data.address),e.xp6(2),e.Q6J("value",t.data.input)}}function At(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",20),e._uU(4),e.qZA(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-deleted")," "),e.xp6(3),e.Oqu(t.data.address)}}function Zt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-updated")," "))}function Tt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-requested")," "))}function Dt(s,o){1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"customer.history-customer-password-reset-verified")," "))}function Nt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",18),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",21),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",21),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-requested")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function Ut(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",18),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",21),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",21),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,5,"customer.history-customer-email-update-verified")," "),e.xp6(3),e.Q6J("label",e.lcZ(6,7,"customer.old-email-address")),e.xp6(2),e.Oqu(t.data.oldEmailAddress),e.xp6(1),e.Q6J("label",e.lcZ(9,9,"customer.new-email-address")),e.xp6(2),e.Oqu(t.data.newEmailAddress)}}function St(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",18)(2,"div",22),e._uU(3),e.qZA(),e._UZ(4,"div",23),e.TgZ(5,"vdr-dropdown")(6,"button",24),e._UZ(7,"clr-icon",25),e.qZA(),e.TgZ(8,"vdr-dropdown-menu",26)(9,"button",27),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2).$implicit;return e.oxw().updateNote.emit(r)}),e.ALo(10,"hasPermission"),e._UZ(11,"clr-icon",28),e._uU(12),e.ALo(13,"translate"),e.qZA(),e._UZ(14,"div",29),e.TgZ(15,"button",27),e.NdJ("click",function(){e.CHM(t);const r=e.oxw(2).$implicit;return e.oxw().deleteNote.emit(r)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",30),e._uU(18),e.ALo(19,"translate"),e.qZA()()()(),e.BQk()}if(2&s){const t=e.oxw(2).$implicit;e.xp6(3),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(10,5,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(13,7,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(16,9,"UpdateCustomer")),e.xp6(3),e.hij(" ",e.lcZ(19,11,"common.delete")," ")}}function Lt(s,o){if(1&s&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-object-tree",19),e.qZA()),2&s){const t=e.oxw(3).$implicit;e.xp6(1),e.Q6J("value",t.data)}}function It(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",15),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Lt,2,1,"vdr-history-entry-detail",31),e.BQk()),2&s){const t=e.oxw(2).$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,2,t.type)," "),e.xp6(2),e.Q6J("ngIf",t.data)}}function Jt(s,o){if(1&s&&(e.TgZ(0,"vdr-timeline-entry",11),e.ynx(1,12),e.YNc(2,_t,7,5,"ng-container",13),e.YNc(3,ft,7,5,"ng-container",13),e.YNc(4,Ct,6,4,"ng-container",13),e.YNc(5,vt,3,6,"ng-container",13),e.YNc(6,yt,3,6,"ng-container",13),e.YNc(7,xt,6,4,"ng-container",13),e.YNc(8,bt,8,5,"ng-container",13),e.YNc(9,At,5,4,"ng-container",13),e.YNc(10,Zt,3,3,"ng-container",13),e.YNc(11,Tt,3,3,"ng-container",13),e.YNc(12,Dt,3,3,"ng-container",13),e.YNc(13,Nt,11,11,"ng-container",13),e.YNc(14,Ut,11,11,"ng-container",13),e.YNc(15,St,20,13,"ng-container",13),e.YNc(16,It,5,4,"ng-container",14),e.BQk(),e.qZA()),2&s){const t=e.oxw().$implicit,n=e.oxw();e.Q6J("displayType",n.getDisplayType(t))("iconShape",n.getTimelineIcon(t))("createdAt",t.createdAt)("name",n.getName(t))("featured",n.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_REGISTERED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_DETAIL_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_ADDED_TO_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_REMOVED_FROM_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_ADDRESS_CREATED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_ADDRESS_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_ADDRESS_DELETED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_PASSWORD_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_PASSWORD_RESET_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_PASSWORD_RESET_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_EMAIL_UPDATE_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_EMAIL_UPDATE_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",n.type.CUSTOMER_NOTE)}}function Ft(s,o){if(1&s&&(e.ynx(0),e.YNc(1,mt,1,3,"vdr-customer-history-entry-host",8),e.YNc(2,Jt,17,20,"ng-template",null,9,e.W1O),e.BQk()),2&s){const t=o.$implicit,n=e.MAs(3),r=e.oxw();e.xp6(1),e.Q6J("ngIf",r.hasCustomComponent(t.type))("ngIfElse",n)}}class O{constructor(o){this.historyEntryComponentService=o,this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.expanded=!1,this.type=d.iYD}hasCustomComponent(o){return!!this.historyEntryComponentService.getComponent(o)}getDisplayType(o){switch(o.type){case d.iYD.CUSTOMER_VERIFIED:case d.iYD.CUSTOMER_EMAIL_UPDATE_VERIFIED:case d.iYD.CUSTOMER_PASSWORD_RESET_VERIFIED:return"success";case d.iYD.CUSTOMER_REGISTERED:return"muted";case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"error";default:return"default"}}getTimelineIcon(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:return"user";case d.iYD.CUSTOMER_VERIFIED:return["assign-user","is-solid"];case d.iYD.CUSTOMER_NOTE:return"note";case d.iYD.CUSTOMER_ADDED_TO_GROUP:case d.iYD.CUSTOMER_REMOVED_FROM_GROUP:return"users"}}isFeatured(o){switch(o.type){case d.iYD.CUSTOMER_REGISTERED:case d.iYD.CUSTOMER_VERIFIED:return!0;default:return!1}}getName(o){const{administrator:t}=o;return t?`${t.firstName} ${t.lastName}`:`${this.customer.firstName} ${this.customer.lastName}`}addNoteToCustomer(){this.addNote.emit({note:this.note}),this.note=""}}O.\u0275fac=function(o){return new(o||O)(e.Y36(d.GwB))},O.\u0275cmp=e.Xpm({type:O,selectors:[["vdr-customer-history"]],inputs:{customer:"customer",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:7,vars:6,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",4,"vdrIfPermissions"],[4,"ngFor","ngForOf"],[3,"isLast"],["iconShape","note","displayType","muted"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[3,"customer","entry","expanded","expandClick",4,"ngIf","ngIfElse"],["defaultComponents",""],[3,"customer","entry","expanded","expandClick"],[3,"displayType","iconShape","createdAt","name","featured"],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],[1,"title"],[4,"ngIf","ngIfElse"],["namedStrategy",""],[1,"flex"],[3,"value"],[1,"address-string"],[3,"label"],[1,"note-text"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[4,"ngIf"]],template:function(o,t){1&o&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0),e.YNc(4,dt,6,5,"vdr-timeline-entry",1),e.YNc(5,Ft,4,2,"ng-container",2),e._UZ(6,"vdr-timeline-entry",3),e.qZA()),2&o&&(e.xp6(1),e.Oqu(e.lcZ(2,4,"customer.customer-history")),e.xp6(3),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0))},directives:[X.H,ge._,N.y,l.Fj,l.JJ,l.On,_.sg,_.O5,F,_.RF,_.n9,at.C,ct._,lt.W,j.J,R.U,b.qvL,B.N,V.H,_.ED],pipes:[v.X$,U.j],styles:[".entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-text-100);white-space:pre-wrap}.address-string[_ngcontent-%COMP%]{font-size:smaller;color:var(--color-text-200)}"],changeDetection:0});var Ot=i(2651),Pt=i(6826),wt=i(4187);function Mt(s,o){if(1&s&&(e.TgZ(0,"div",23),e.ALo(1,"localeDate"),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"timeAgo"),e.qZA()),2&s){const t=o.ngIf;e.Q6J("title",e.xi3(1,3,t,"medium")),e.xp6(2),e.AsE(" ",e.lcZ(3,6,"customer.last-login"),": ",e.lcZ(4,8,t)," ")}}function Gt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&s){const t=e.oxw();e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.create")," ")}}function Et(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",24),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).save()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&s){const t=e.oxw(2);e.Q6J("disabled",!(t.addressDefaultsUpdated||t.detailForm.valid&&t.detailForm.dirty)),e.xp6(1),e.hij(" ",e.lcZ(2,2,"common.update")," ")}}function Qt(s,o){1&s&&e.YNc(0,Et,3,4,"button",25),2&s&&e.Q6J("vdrIfPermissions","UpdateCustomer")}function qt(s,o){1&s&&(e.TgZ(0,"vdr-form-field",26),e.ALo(1,"translate"),e._UZ(2,"input",27),e.qZA()),2&s&&e.Q6J("label",e.lcZ(1,1,"customer.password"))}const kt=function(){return["customer","customFields"]};function $t(s,o){if(1&s&&(e.TgZ(0,"section",28)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",29),e.qZA()),2&s){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,3,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.detailForm.get(e.DdM(5,kt)))}}function Yt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-chip",36),e.NdJ("iconClick",function(){const a=e.CHM(t).$implicit;return e.oxw(3).removeFromGroup(a)}),e._uU(1),e.qZA()}if(2&s){const t=o.$implicit;e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name)}}function Ht(s,o){if(1&s&&(e.ynx(0),e.YNc(1,Yt,2,2,"vdr-chip",35),e.BQk()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t)}}function jt(s,o){1&s&&(e._uU(0),e.ALo(1,"translate")),2&s&&e.hij(" ",e.lcZ(1,1,"customer.not-a-member-of-any-groups")," ")}function Rt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",37),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addToGroup()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.add-customer-to-group")," "))}function Bt(s,o){if(1&s&&(e.TgZ(0,"div",30)(1,"label",31),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,Ht,2,1,"ng-container",32),e.YNc(5,jt,2,3,"ng-template",null,33,e.W1O),e.TgZ(7,"div"),e.YNc(8,Rt,4,3,"button",34),e.qZA()()),2&s){const t=o.ngIf,n=e.MAs(6);e.xp6(2),e.Oqu(e.lcZ(3,4,"customer.customer-groups")),e.xp6(2),e.Q6J("ngIf",t.length)("ngIfElse",n),e.xp6(4),e.Q6J("vdrIfPermissions","UpdateCustomerGroup")}}const Vt=function(){return["UpdateCustomer"]};function Xt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-address-card",45),e.NdJ("setAsDefaultBilling",function(r){return e.CHM(t),e.oxw(2).setDefaultBillingAddressId(r)})("setAsDefaultShipping",function(r){return e.CHM(t),e.oxw(2).setDefaultShippingAddressId(r)})("deleteAddress",function(r){return e.CHM(t),e.oxw(2).toggleDeleteAddress(r)}),e.ALo(1,"async"),e.ALo(2,"hasPermission"),e.qZA()}if(2&s){const t=o.$implicit,n=e.oxw(2);e.ekj("to-delete",n.addressesToDeleteIds.has(t.value.id)),e.Q6J("availableCountries",e.lcZ(1,8,n.availableCountries$))("isDefaultBilling",n.defaultBillingAddressId===t.value.id)("isDefaultShipping",n.defaultShippingAddressId===t.value.id)("addressForm",t)("customFields",n.addressCustomFields)("editable",e.lcZ(2,10,e.DdM(12,Vt))&&!n.addressesToDeleteIds.has(t.value.id))}}function Wt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",46),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).addAddress()}),e._UZ(1,"clr-icon",38),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-address")," "))}const Kt=function(s){return["/orders/",s]};function zt(s,o){if(1&s&&(e.TgZ(0,"td",47),e._uU(1),e.qZA(),e.TgZ(2,"td",47),e._uU(3),e.qZA(),e.TgZ(4,"td",47),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.TgZ(7,"td",47),e._uU(8),e.ALo(9,"localeDate"),e.qZA(),e.TgZ(10,"td",48),e._UZ(11,"vdr-table-row-action",49),e.ALo(12,"translate"),e.qZA()),2&s){const t=o.item;e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Oqu(t.state),e.xp6(2),e.Oqu(e.xi3(6,6,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.xi3(9,9,t.updatedAt,"medium")),e.xp6(3),e.Q6J("label",e.lcZ(12,12,"common.open"))("linkTo",e.VKq(14,Kt,t.id))}}function eo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",40)(2,"h3"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.YNc(5,Xt,3,13,"vdr-address-card",41),e.YNc(6,Wt,4,3,"button",42),e.qZA(),e.TgZ(7,"div",43)(8,"h3"),e._uU(9),e.ALo(10,"translate"),e.qZA(),e.TgZ(11,"vdr-data-table",44),e.NdJ("itemsPerPageChange",function(r){return e.CHM(t),e.oxw().setOrderItemsPerPage(r)})("pageChange",function(r){return e.CHM(t),e.oxw().setOrderCurrentPage(r)}),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"translate"),e.TgZ(15,"vdr-dt-column"),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e.TgZ(21,"vdr-dt-column"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e.TgZ(24,"vdr-dt-column"),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"vdr-dt-column"),e.YNc(28,zt,13,16,"ng-template"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,13,"customer.addresses")),e.xp6(2),e.Q6J("ngForOf",t.getAddressFormControls()),e.xp6(1),e.Q6J("vdrIfPermissions","UpdateCustomer"),e.xp6(3),e.Oqu(e.lcZ(10,15,"customer.orders")),e.xp6(2),e.Q6J("items",e.lcZ(12,17,t.orders$))("itemsPerPage",t.ordersPerPage)("totalItems",e.lcZ(13,19,t.ordersCount$))("currentPage",t.currentOrdersPage)("emptyStateLabel",e.lcZ(14,21,"customer.no-orders-placed")),e.xp6(5),e.Oqu(e.lcZ(17,23,"common.code")),e.xp6(3),e.Oqu(e.lcZ(20,25,"order.state")),e.xp6(3),e.Oqu(e.lcZ(23,27,"order.total")),e.xp6(3),e.Oqu(e.lcZ(26,29,"common.updated-at"))}}function to(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"div",39)(1,"div",50)(2,"vdr-customer-history",51),e.NdJ("addNote",function(r){return e.CHM(t),e.oxw().addNoteToCustomer(r)})("updateNote",function(r){return e.CHM(t),e.oxw().updateNote(r)})("deleteNote",function(r){return e.CHM(t),e.oxw().deleteNote(r)}),e.ALo(3,"async"),e.ALo(4,"async"),e.qZA()()()}if(2&s){const t=e.oxw();e.xp6(2),e.Q6J("customer",e.lcZ(3,2,t.entity$))("history",e.lcZ(4,4,t.history$))}}class P extends d.UT_{constructor(o,t,n,r,a,c,u,h){super(o,t,n,c),this.changeDetector=r,this.formBuilder=a,this.dataService=c,this.modalService=u,this.notificationService=h,this.fetchHistory=new K.x,this.addressesToDeleteIds=new Set,this.addressDefaultsUpdated=!1,this.ordersPerPage=10,this.currentOrdersPage=1,this.orderListUpdates$=new K.x,this.customFields=this.getCustomFieldConfig("Customer"),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.detailForm=this.formBuilder.group({customer:this.formBuilder.group({title:"",firstName:["",l.kI.required],lastName:["",l.kI.required],phoneNumber:"",emailAddress:["",[l.kI.required,l.kI.email]],password:"",customFields:this.formBuilder.group(this.customFields.reduce((f,W)=>Object.assign(Object.assign({},f),{[W.name]:""}),{}))}),addresses:new l.Oe([])})}ngOnInit(){this.init(),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(t=>t.countries.items).pipe((0,ke.d)(1));const o=this.entity$.pipe(Re(this.orderListUpdates$));this.orders$=o.pipe((0,p.U)(t=>t.orders.items)),this.ordersCount$=this.entity$.pipe((0,p.U)(t=>t.orders.totalItems)),this.history$=this.fetchHistory.pipe((0,k.O)(null),(0,g.w)(()=>this.dataService.customer.getCustomerHistory(this.id,{sort:{createdAt:d.Asd.DESC}}).mapStream(t=>{var n;return null===(n=t.customer)||void 0===n?void 0:n.history.items})))}ngOnDestroy(){this.destroy(),this.orderListUpdates$.complete()}getAddressFormControls(){return this.detailForm.get(["addresses"]).controls}setDefaultBillingAddressId(o){this.defaultBillingAddressId=o,this.addressDefaultsUpdated=!0}setDefaultShippingAddressId(o){this.defaultShippingAddressId=o,this.addressDefaultsUpdated=!0}toggleDeleteAddress(o){this.addressesToDeleteIds.has(o)?this.addressesToDeleteIds.delete(o):this.addressesToDeleteIds.add(o)}addAddress(){const o=this.detailForm.get("addresses"),t=this.formBuilder.group({fullName:"",company:"",streetLine1:["",l.kI.required],streetLine2:"",city:"",province:"",postalCode:"",countryCode:["",l.kI.required],phoneNumber:"",defaultShippingAddress:!1,defaultBillingAddress:!1});if(this.addressCustomFields.length){const n=this.formBuilder.group({});for(const r of this.addressCustomFields)n.addControl(r.name,new l.NI(""));t.addControl("customFields",n)}o.push(t)}setOrderItemsPerPage(o){this.ordersPerPage=+o,this.fetchOrdersList()}setOrderCurrentPage(o){this.currentOrdersPage=+o,this.fetchOrdersList()}create(){var o;const t=this.detailForm.get("customer");if(!t)return;const n=t.value,r=null===(o=t.get("customFields"))||void 0===o?void 0:o.value,a={title:n.title,emailAddress:n.emailAddress,firstName:n.firstName,lastName:n.lastName,phoneNumber:n.phoneNumber,customFields:r};this.dataService.customer.createCustomer(a,n.password).subscribe(({createCustomer:c})=>{switch(c.__typename){case"Customer":this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Customer"}),c.emailAddress&&!n.password&&this.notificationService.notify({message:(0,m.J)("customer.email-verification-sent"),translationVars:{emailAddress:n.emailAddress},type:"info",duration:1e4}),this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.router.navigate(["../",c.id],{relativeTo:this.route});break;case"EmailAddressConflictError":this.notificationService.error(c.message)}})}save(){this.entity$.pipe((0,de.q)(1),(0,Be.z)(({id:o})=>{var t;const n=[],r=this.detailForm.get("customer");if(r&&r.dirty){const c=r.value,u=null===(t=r.get("customFields"))||void 0===t?void 0:t.value,h={id:o,title:c.title,emailAddress:c.emailAddress,firstName:c.firstName,lastName:c.lastName,phoneNumber:c.phoneNumber,customFields:u};n.push(this.dataService.customer.updateCustomer(h).pipe((0,p.U)(f=>f.updateCustomer)))}const a=this.detailForm.get("addresses");if(a&&a.dirty||this.addressDefaultsUpdated)for(const c of a.controls)if(c.dirty||this.addressDefaultsUpdated){const u=c.value,h={fullName:u.fullName,company:u.company,streetLine1:u.streetLine1,streetLine2:u.streetLine2,city:u.city,province:u.province,postalCode:u.postalCode,countryCode:u.countryCode,phoneNumber:u.phoneNumber,defaultShippingAddress:this.defaultShippingAddressId===u.id,defaultBillingAddress:this.defaultBillingAddressId===u.id,customFields:u.customFields};u.id?this.addressesToDeleteIds.has(u.id)?n.push(this.dataService.customer.deleteCustomerAddress(u.id).pipe((0,p.U)(f=>f.deleteCustomerAddress))):n.push(this.dataService.customer.updateCustomerAddress(Object.assign(Object.assign({},h),{id:u.id})).pipe((0,p.U)(f=>f.updateCustomerAddress))):n.push(this.dataService.customer.createCustomerAddress(o,h).pipe((0,p.U)(f=>f.createCustomerAddress)))}return(0,qe.D)(n)})).subscribe(o=>{let t=!1;for(const n of o)switch(n.__typename){case"Customer":case"Address":case"Success":t||(this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Customer"}),t=!0,this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.fetchHistory.next(),this.dataService.customer.getCustomer(this.id).single$.subscribe());break;case"EmailAddressConflictError":this.notificationService.error(n.message)}},o=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"Customer"})})}addToGroup(){this.modalService.fromComponent(J,{size:"md"}).pipe((0,g.w)(o=>o?(0,me.D)(o):y.E),(0,Ve.b)(o=>this.dataService.customer.addCustomersToGroup(o,[this.id]))).subscribe({next:o=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:1,groupName:o.addCustomersToGroup.name})},complete:()=>{this.dataService.customer.getCustomer(this.id,{take:0}).single$.subscribe(),this.fetchHistory.next()}})}removeFromGroup(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-remove-customer-from-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.removeCustomersFromGroup(o.id,[this.id]):y.E),(0,g.w)(()=>this.dataService.customer.getCustomer(this.id,{take:0}).single$)).subscribe(t=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:1,groupName:o.name}),this.fetchHistory.next()})}addNoteToCustomer({note:o}){this.dataService.customer.addNoteToCustomer(this.id,o).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(o){this.modalService.fromComponent(d.UlA,{closable:!0,locals:{displayPrivacyControls:!1,note:o.data.note}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerNote({noteId:o.id,note:t.note}):y.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(o){return this.modalService.dialog({title:(0,m.J)("common.confirm-delete-note"),body:o.data.note,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerNote(o.id):y.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Note"})})}setFormValues(o){var t;const n=this.detailForm.get("customer");if(n&&n.patchValue({title:o.title,firstName:o.firstName,lastName:o.lastName,phoneNumber:o.phoneNumber,emailAddress:o.emailAddress}),o.addresses){const r=new l.Oe([]);for(const a of o.addresses){const c=a,{customFields:u}=c,h=(0,Ee._T)(c,["customFields"]),f=this.formBuilder.group(Object.assign(Object.assign({},h),{countryCode:a.country.code}));if(r.push(f),a.defaultShippingAddress&&(this.defaultShippingAddressId=a.id),a.defaultBillingAddress&&(this.defaultBillingAddressId=a.id),this.addressCustomFields.length){const W=this.formBuilder.group({});for(const Do of this.addressCustomFields){const xe=Do.name,No=null===(t=a.customFields)||void 0===t?void 0:t[xe],Uo=new l.NI(No);W.addControl(xe,Uo)}f.addControl("customFields",W)}}this.detailForm.setControl("addresses",r)}this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get(["customer","customFields"]),o),this.changeDetector.markForCheck()}fetchOrdersList(){this.dataService.customer.getCustomer(this.id,{take:this.ordersPerPage,skip:(this.currentOrdersPage-1)*this.ordersPerPage,sort:{orderPlacedAt:d.Asd.DESC}}).single$.pipe((0,p.U)(o=>o.customer),(0,H.h)(Qe.notNullOrUndefined)).subscribe(o=>this.orderListUpdates$.next(o))}}function oo(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function so(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function no(s,o){if(1&s&&(e.YNc(0,oo,3,3,"span",6),e.YNc(1,so,3,3,"span",6)),2&s){const t=e.oxw();e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}function ro(s,o){if(1&s&&(e.TgZ(0,"section",7)(1,"label"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._UZ(4,"vdr-tabbed-custom-fields",8),e.qZA()),2&s){const t=e.oxw();e.xp6(2),e.Oqu(e.lcZ(3,3,"common.custom-fields")),e.xp6(2),e.Q6J("customFields",t.customFields)("customFieldsFormGroup",t.form.get("customFields"))}}function io(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.update-customer-group")))}function ao(s,o){1&s&&(e.TgZ(0,"span"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&s&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"customer.create-customer-group")))}function co(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().save()}),e.YNc(4,io,3,3,"span",6),e.YNc(5,ao,3,3,"span",6),e.qZA()}if(2&s){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.form.valid),e.xp6(1),e.Q6J("ngIf",t.group.id),e.xp6(1),e.Q6J("ngIf",!t.group.id)}}P.\u0275fac=function(o){return new(o||P)(e.Y36(C.gz),e.Y36(C.F0),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(l.qu),e.Y36(d.DoR),e.Y36(d.Z7U),e.Y36(d.gqp))},P.\u0275cmp=e.Xpm({type:P,selectors:[["vdr-customer-detail"]],features:[e.qOj],decls:46,vars:59,consts:[[1,"flex","clr-align-items-center"],[3,"entity"],[3,"customer"],["class","last-login",3,"title",4,"ngIf"],["locationId","customer-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","title",3,"label","readOnlyToggle"],["id","title","type","text","formControlName","title"],["for","firstName",3,"label","readOnlyToggle"],["id","firstName","type","text","formControlName","firstName"],["for","lastName",3,"label","readOnlyToggle"],["id","lastName","type","text","formControlName","lastName"],["for","emailAddress",3,"label","readOnlyToggle"],["id","emailAddress","type","text","formControlName","emailAddress"],["for","phoneNumber",3,"label","readOnlyToggle"],["id","phoneNumber","type","text","formControlName","phoneNumber"],["for","password",3,"label",4,"ngIf"],["formGroupName","customFields",4,"ngIf"],["locationId","customer-detail",3,"entity$","detailForm"],["class","groups",4,"ngIf"],["class","clr-row",4,"ngIf"],[1,"last-login",3,"title"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["for","password",3,"label"],["id","password","type","password","formControlName","password"],["formGroupName","customFields"],["entityName","Customer",3,"customFields","customFieldsFormGroup"],[1,"groups"],[1,"clr-control-label"],[4,"ngIf","ngIfElse"],["noGroups",""],["class","btn btn-sm btn-secondary",3,"click",4,"vdrIfPermissions"],["icon","times",3,"colorFrom","iconClick",4,"ngFor","ngForOf"],["icon","times",3,"colorFrom","iconClick"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","plus"],[1,"clr-row"],[1,"clr-col-md-4"],[3,"to-delete","availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress",4,"ngFor","ngForOf"],["class","btn btn-secondary",3,"click",4,"vdrIfPermissions"],[1,"clr-col-md-8"],[3,"items","itemsPerPage","totalItems","currentPage","emptyStateLabel","itemsPerPageChange","pageChange"],[3,"availableCountries","isDefaultBilling","isDefaultShipping","addressForm","customFields","editable","setAsDefaultBilling","setAsDefaultShipping","deleteAddress"],[1,"btn","btn-secondary",3,"click"],[1,"left"],[1,"right"],["iconShape","shopping-cart",3,"label","linkTo"],[1,"clr-col-md-6"],[3,"customer","history","addNote","updateNote","deleteNote"]],template:function(o,t){if(1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e._UZ(3,"vdr-entity-info",1),e.ALo(4,"async"),e._UZ(5,"vdr-customer-status-label",2),e.ALo(6,"async"),e.YNc(7,Mt,5,10,"div",3),e.ALo(8,"async"),e.qZA()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",4),e.YNc(11,Gt,3,4,"button",5),e.ALo(12,"async"),e.YNc(13,Qt,1,1,"ng-template",null,6,e.W1O),e.qZA()(),e.TgZ(15,"form",7)(16,"vdr-form-field",8),e.ALo(17,"translate"),e.ALo(18,"async"),e._UZ(19,"input",9),e.qZA(),e.TgZ(20,"vdr-form-field",10),e.ALo(21,"translate"),e.ALo(22,"async"),e._UZ(23,"input",11),e.qZA(),e.TgZ(24,"vdr-form-field",12),e.ALo(25,"translate"),e.ALo(26,"async"),e._UZ(27,"input",13),e.qZA(),e.TgZ(28,"vdr-form-field",14),e.ALo(29,"translate"),e.ALo(30,"async"),e._UZ(31,"input",15),e.qZA(),e.TgZ(32,"vdr-form-field",16),e.ALo(33,"translate"),e.ALo(34,"async"),e._UZ(35,"input",17),e.qZA(),e.YNc(36,qt,3,3,"vdr-form-field",18),e.ALo(37,"async"),e.YNc(38,$t,5,6,"section",19),e._UZ(39,"vdr-custom-detail-component-host",20),e.qZA(),e.YNc(40,Bt,9,6,"div",21),e.ALo(41,"async"),e.YNc(42,eo,29,31,"div",22),e.ALo(43,"async"),e.YNc(44,to,5,6,"div",22),e.ALo(45,"async")),2&o){const n=e.MAs(14);let r,a;e.xp6(3),e.Q6J("entity",e.lcZ(4,23,t.entity$)),e.xp6(2),e.Q6J("customer",e.lcZ(6,25,t.entity$)),e.xp6(2),e.Q6J("ngIf",null==(r=e.lcZ(8,27,t.entity$))||null==r.user?null:r.user.lastLogin),e.xp6(4),e.Q6J("ngIf",e.lcZ(12,29,t.isNew$))("ngIfElse",n),e.xp6(4),e.Q6J("formGroup",t.detailForm.get("customer")),e.xp6(1),e.Q6J("label",e.lcZ(17,31,"customer.title"))("readOnlyToggle",!e.lcZ(18,33,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(21,35,"customer.first-name"))("readOnlyToggle",!e.lcZ(22,37,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(25,39,"customer.last-name"))("readOnlyToggle",!e.lcZ(26,41,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(29,43,"customer.email-address"))("readOnlyToggle",!e.lcZ(30,45,t.isNew$)),e.xp6(4),e.Q6J("label",e.lcZ(33,47,"customer.phone-number"))("readOnlyToggle",!e.lcZ(34,49,t.isNew$)),e.xp6(4),e.Q6J("ngIf",e.lcZ(37,51,t.isNew$)),e.xp6(2),e.Q6J("ngIf",t.customFields.length),e.xp6(1),e.Q6J("entity$",t.entity$)("detailForm",t.detailForm),e.xp6(1),e.Q6J("ngIf",null==(a=e.lcZ(41,53,t.entity$))?null:a.groups),e.xp6(2),e.Q6J("ngIf",!e.lcZ(43,55,t.isNew$)),e.xp6(2),e.Q6J("ngIf",!e.lcZ(45,57,t.isNew$))}},directives:[x.Kk,x.BN,ie.V,Z,_.O5,x.mz,ce.W,X.H,l._Y,l.JL,l.sg,pe.h,N.y,l.Fj,l.JJ,l.u,l.x0,b.MgK,_e.y,rt.C,_.sg,Q.Y,b.qvL,I,$.Q,ne.E,re.v,O],pipes:[_.Ov,Ot.H,v.X$,Pt.e,U.j,wt.k],styles:[".last-login[_ngcontent-%COMP%]{margin-left:6px;color:var(--color-grey-500)}.to-delete[_ngcontent-%COMP%]{opacity:.5}"],changeDetection:0});const lo=function(){return["CreateCustomerGroup","UpdateCustomerGroup"]};class T{constructor(o,t){this.serverConfigService=o,this.formBuilder=t,this.customFields=this.serverConfigService.getCustomFieldsFor("CustomerGroup")}ngOnInit(){var o;if(this.form=this.formBuilder.group({name:[this.group.name,l.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,n)=>Object.assign(Object.assign({},t),{[n.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const n of this.customFields){const r=n.name,a=null===(o=this.group.customFields)||void 0===o?void 0:o[r],c=t.get(r);c&&c.patchValue(a)}}}cancel(){this.resolveWith()}save(){this.resolveWith(this.form.value)}}T.\u0275fac=function(o){return new(o||T)(e.Y36(d.iHG),e.Y36(l.qu))},T.\u0275cmp=e.Xpm({type:T,selectors:[["vdr-customer-group-detail-dialog"]],decls:8,vars:9,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["formGroupName","customFields",4,"ngIf"],["vdrDialogButtons",""],[4,"ngIf"],["formGroupName","customFields"],["entityName","CustomerGroup",3,"customFields","customFieldsFormGroup"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(o,t){1&o&&(e.YNc(0,no,2,2,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"input",3),e.ALo(5,"hasPermission"),e.qZA(),e.YNc(6,ro,5,5,"section",4),e.qZA(),e.YNc(7,co,6,6,"ng-template",5)),2&o&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,4,"common.name")),e.xp6(2),e.Q6J("readonly",!e.lcZ(5,6,e.DdM(8,lo))),e.xp6(2),e.Q6J("ngIf",t.customFields.length))},directives:[q.q,_.O5,l._Y,l.JL,l.sg,pe.h,N.y,l.Fj,l.JJ,l.u,l.x0,b.MgK,_e.y,Y.n],pipes:[v.X$,U.j],styles:[""],changeDetection:0});var Ce=i(745),mo=i(73),uo=i(5181);function po(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&s&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"customer.create-new-customer-group")," "))}const _o=function(s){return{contents:s}},go=function(s){return["./",s]};function ho(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",11),e._UZ(1,"vdr-entity-info",12),e.qZA(),e.TgZ(2,"td",11)(3,"vdr-chip",13),e._uU(4),e.qZA()(),e.TgZ(5,"td",11)(6,"a",14),e._UZ(7,"clr-icon",15),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"td",16)(11,"button",17),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().update(a)}),e._UZ(12,"clr-icon",18),e._uU(13),e.ALo(14,"translate"),e.qZA()(),e.TgZ(15,"td",19)(16,"vdr-dropdown")(17,"button",20),e._uU(18),e.ALo(19,"translate"),e._UZ(20,"clr-icon",21),e.qZA(),e.TgZ(21,"vdr-dropdown-menu",22)(22,"button",23),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().delete(a.id)}),e.ALo(23,"hasPermission"),e._UZ(24,"clr-icon",24),e._uU(25),e.ALo(26,"translate"),e.qZA()()()()}if(2&s){const t=o.item,n=e.oxw();e.ekj("active",t.id===n.activeGroupId),e.xp6(1),e.Q6J("entity",t),e.xp6(1),e.ekj("active",t.id===n.activeGroupId),e.xp6(1),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name),e.xp6(1),e.ekj("active",t.id===n.activeGroupId),e.xp6(1),e.Q6J("routerLink",e.VKq(31,go,e.VKq(29,_o,t.id))),e.xp6(2),e.hij(" ",e.lcZ(9,19,"customer.view-group-members")," "),e.xp6(2),e.ekj("active",t.id===n.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(14,21,"common.edit")," "),e.xp6(2),e.ekj("active",t.id===n.activeGroupId),e.xp6(3),e.hij(" ",e.lcZ(19,23,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(23,25,"DeleteCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(26,27,"common.delete")," ")}}function fo(s,o){1&s&&e._UZ(0,"vdr-empty-placeholder")}const Co=function(s){return{count:s}},vo=function(s){return{groupName:s}};function yo(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",25)(2,"div",26),e._uU(3),e.ALo(4,"async"),e.qZA(),e._UZ(5,"div",27),e.TgZ(6,"button",28),e.NdJ("click",function(){return e.CHM(t),e.oxw().closeMembers()}),e._UZ(7,"clr-icon",29),e.qZA()(),e.TgZ(8,"div",30)(9,"vdr-dropdown")(10,"button",31),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",21),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",22)(15,"button",32),e.NdJ("click",function(){const a=e.CHM(t).ngIf,c=e.oxw();return c.removeFromGroup(a,c.selectedCustomerIds)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",24),e._uU(18),e.ALo(19,"translate"),e.qZA()()(),e.TgZ(20,"button",33),e.NdJ("click",function(){const a=e.CHM(t).ngIf;return e.oxw().addToGroup(a)}),e._uU(21),e.ALo(22,"translate"),e.qZA()(),e.TgZ(23,"vdr-customer-group-member-list",34),e.NdJ("selectionChange",function(r){e.CHM(t);return e.oxw().selectedCustomerIds=r})("fetchParamsChange",function(r){return e.CHM(t),e.oxw().fetchGroupMembers$.next(r)}),e.ALo(24,"async"),e.ALo(25,"async"),e.qZA(),e.BQk()}if(2&s){const t=o.ngIf,n=e.oxw();e.xp6(3),e.AsE("",t.name," (",e.lcZ(4,11,n.membersTotal$),")"),e.xp6(7),e.Q6J("disabled",0===n.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.xi3(12,13,"common.with-selected",e.VKq(27,Co,n.selectedCustomerIds.length))," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,16,"UpdateCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(19,18,"customer.remove-from-group")," "),e.xp6(3),e.hij(" ",e.xi3(22,20,"customer.add-customers-to-group",e.VKq(29,vo,t.name))," "),e.xp6(2),e.Q6J("members",e.lcZ(24,23,n.members$))("route",n.route)("totalItems",e.lcZ(25,25,n.membersTotal$))("selectedMemberIds",n.selectedCustomerIds)}}class w extends d.t7C{constructor(o,t,n,r,a){super(a,r),this.dataService=o,this.notificationService=t,this.modalService=n,this.route=r,this.router=a,this.searchTerm=new l.NI(""),this.selectedCustomerIds=[],this.fetchGroupMembers$=new E.X({skip:0,take:0,filterTerm:""}),this.refreshActiveGroupMembers$=new E.X(void 0),super.setQueryFn((...c)=>this.dataService.customer.getCustomerGroupList(...c).refetchOnChannelChange(),c=>c.customerGroups,(c,u)=>({options:{skip:c,take:u,filter:{name:{contains:this.searchTerm.value}}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,H.h)(n=>2<n.length||0===n.length),(0,te.b)(250),(0,se.R)(this.destroy$)).subscribe(()=>this.refresh());const o=this.route.paramMap.pipe((0,p.U)(n=>n.get("contents")),(0,ee.x)(),(0,oe.b)(()=>this.selectedCustomerIds=[]));this.listIsEmpty$=this.items$.pipe((0,p.U)(n=>0===n.length)),this.activeGroup$=(0,z.a)(this.items$,o).pipe((0,p.U)(([n,r])=>{if(r)return n.find(a=>a.id===r)}),(0,oe.b)(n=>this.activeGroupId=null==n?void 0:n.id));const t=(0,z.a)(this.activeGroup$,this.fetchGroupMembers$,this.refreshActiveGroupMembers$).pipe((0,g.w)(([n,{skip:r,take:a,filterTerm:c}])=>n?this.dataService.customer.getCustomerGroupWithCustomers(n.id,{skip:r,take:a,filter:{emailAddress:{contains:c}}}).mapStream(u=>{var h;return null===(h=u.customerGroup)||void 0===h?void 0:h.customers}):(0,Ce.of)(void 0)));this.members$=t.pipe((0,p.U)(n=>{var r;return null!==(r=null==n?void 0:n.items)&&void 0!==r?r:[]})),this.membersTotal$=t.pipe((0,p.U)(n=>{var r;return null!==(r=null==n?void 0:n.totalItems)&&void 0!==r?r:0}))}create(){this.modalService.fromComponent(T,{locals:{group:{name:""}}}).pipe((0,g.w)(o=>o?this.dataService.customer.createCustomerGroup(Object.assign(Object.assign({},o),{customerIds:[]})):y.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"CustomerGroup"})},o=>{this.notificationService.error((0,m.J)("common.notify-create-error"),{entity:"CustomerGroup"})})}delete(o){this.modalService.dialog({title:(0,m.J)("customer.confirm-delete-customer-group"),buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomerGroup(o):y.E),(0,g.w)(t=>t.deleteCustomerGroup.result===d.PcR.DELETED?this.dataService.customer.getCustomerGroupList().mapSingle(()=>({errorMessage:!1})):(0,Ce.of)({errorMessage:t.deleteCustomerGroup.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):(this.refresh(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"CustomerGroup"}))},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"CustomerGroup"})})}update(o){this.modalService.fromComponent(T,{locals:{group:o}}).pipe((0,g.w)(t=>t?this.dataService.customer.updateCustomerGroup(Object.assign({id:o.id},t)):y.E)).subscribe(()=>{this.refresh(),this.notificationService.success((0,m.J)("common.notify-update-success"),{entity:"CustomerGroup"})},t=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"CustomerGroup"})})}closeMembers(){const o=Object.assign({},this.route.snapshot.params);delete o.contents,this.router.navigate(["./",o],{relativeTo:this.route,queryParamsHandling:"preserve"})}addToGroup(o){this.modalService.fromComponent(S,{locals:{group:o,route:this.route},size:"md",verticalAlign:"top"}).pipe((0,g.w)(t=>t?this.dataService.customer.addCustomersToGroup(o.id,t).pipe((0,mo.h)(t)):y.E)).subscribe({next:t=>{this.notificationService.success((0,m.J)("customer.add-customers-to-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}removeFromGroup(o,t){this.dataService.customer.removeCustomersFromGroup(o.id,t).subscribe({complete:()=>{this.notificationService.success((0,m.J)("customer.remove-customers-from-group-success"),{customerCount:t.length,groupName:o.name}),this.refreshActiveGroupMembers$.next(),this.selectedCustomerIds=[]}})}}w.\u0275fac=function(o){return new(o||w)(e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(C.gz),e.Y36(C.F0))},w.\u0275cmp=e.Xpm({type:w,selectors:[["vdr-customer-group-list"]],features:[e.qOj],decls:22,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-group-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"group-wrapper"],[1,"group-list"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],["emptyPlaceholder",""],[1,"group-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"right","align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],[1,"align-middle"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","trash",1,"is-danger"],[1,"flex"],[1,"header-title-row"],[1,"flex-spacer"],["type","button",1,"close-button",3,"click"],["shape","close"],[1,"controls"],["type","button","vdrDropdownTrigger","",1,"btn","btn-secondary","btn-sm",3,"disabled"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],[1,"btn","btn-secondary","btn-sm",3,"click"],[3,"members","route","totalItems","selectedMemberIds","selectionChange","fetchParamsChange"]],template:function(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,po,4,3,"button",2),e.qZA()(),e.TgZ(7,"div",3)(8,"div",4)(9,"vdr-data-table",5),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(10,"async"),e.ALo(11,"async"),e.ALo(12,"async"),e.ALo(13,"async"),e.ALo(14,"async"),e.YNc(15,ho,27,33,"ng-template"),e.qZA()(),e.YNc(16,fo,1,0,"ng-template",null,6,e.W1O),e.TgZ(18,"div",7),e.ALo(19,"async"),e.YNc(20,yo,26,31,"ng-container",8),e.ALo(21,"async"),e.qZA()()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-by-group-name")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomerGroup"),e.xp6(3),e.ekj("expanded",e.lcZ(10,14,t.activeGroup$)),e.Q6J("items",e.lcZ(11,16,t.items$))("itemsPerPage",e.lcZ(12,18,t.itemsPerPage$))("totalItems",e.lcZ(13,20,t.totalItems$))("currentPage",e.lcZ(14,22,t.currentPage$)),e.xp6(9),e.ekj("expanded",e.lcZ(19,24,t.activeGroup$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(21,26,t.activeGroup$)))},directives:[x.Kk,x.BN,N.y,l.Fj,l.JJ,l.oH,x.mz,ce.W,X.H,b.qvL,$.Q,ie.V,Q.Y,C.yS,j.J,R.U,B.N,V.H,uo.j,_.O5,A],pipes:[v.X$,_.Ov,U.j],styles:[".group-wrapper[_ngcontent-%COMP%]{display:flex;height:calc(100% - 50px)}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%]{flex:1;overflow:auto;margin-top:0}.group-wrapper[_ngcontent-%COMP%] .group-list[_ngcontent-%COMP%] .active[_ngcontent-%COMP%]{background-color:var(--clr-global-selection-color)}.group-wrapper[_ngcontent-%COMP%] .group-list.expanded[_ngcontent-%COMP%]{width:calc(100% - 40vw)}vdr-data-table[_ngcontent-%COMP%] table{margin-top:0}.group-members[_ngcontent-%COMP%]{height:100%;width:0;opacity:0;visibility:hidden;overflow:auto;transition:width .3s,opacity .2s .3s,visibility 0s .3s}.group-members.expanded[_ngcontent-%COMP%]{width:40vw;visibility:visible;opacity:1;padding-left:12px}.group-members[_ngcontent-%COMP%] .close-button[_ngcontent-%COMP%]{margin:0;background:none;border:none;cursor:pointer}.group-members[_ngcontent-%COMP%] table.table{margin-top:0}.group-members[_ngcontent-%COMP%] table.table th{top:0}.group-members[_ngcontent-%COMP%] .controls[_ngcontent-%COMP%]{display:flex;justify-content:space-between}vdr-empty-placeholder[_ngcontent-%COMP%]{flex:1}"],changeDetection:0});var xo=i(8165);const bo=function(){return["./create"]};function Ao(s,o){1&s&&(e.TgZ(0,"a",5),e._UZ(1,"clr-icon",6),e._uU(2),e.ALo(3,"translate"),e.qZA()),2&s&&(e.Q6J("routerLink",e.DdM(4,bo)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.create-new-customer")," "))}const Zo=function(s){return["./",s]};function To(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"td",7),e._uU(1),e.qZA(),e.TgZ(2,"td",7),e._uU(3),e.qZA(),e.TgZ(4,"td",7),e._UZ(5,"vdr-customer-status-label",8),e.qZA(),e.TgZ(6,"td",9),e._UZ(7,"vdr-table-row-action",10),e.ALo(8,"translate"),e.qZA(),e.TgZ(9,"td")(10,"vdr-dropdown")(11,"button",11),e._uU(12),e.ALo(13,"translate"),e._UZ(14,"clr-icon",12),e.qZA(),e.TgZ(15,"vdr-dropdown-menu",13)(16,"button",14),e.NdJ("click",function(){const a=e.CHM(t).item;return e.oxw().deleteCustomer(a)}),e.ALo(17,"hasPermission"),e._UZ(18,"clr-icon",15),e._uU(19),e.ALo(20,"translate"),e.qZA()()()()}if(2&s){const t=o.item;e.xp6(1),e.lnq(" ",t.title," ",t.firstName," ",t.lastName," "),e.xp6(2),e.Oqu(t.emailAddress),e.xp6(2),e.Q6J("customer",t),e.xp6(2),e.Q6J("label",e.lcZ(8,10,"common.edit"))("linkTo",e.VKq(18,Zo,t.id)),e.xp6(5),e.hij(" ",e.lcZ(13,12,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(17,14,"DeleteCustomer")),e.xp6(3),e.hij(" ",e.lcZ(20,16,"common.delete")," ")}}class M extends d.t7C{constructor(o,t,n,r,a){super(t,n),this.dataService=o,this.modalService=r,this.notificationService=a,this.searchTerm=new l.NI(""),super.setQueryFn((...c)=>this.dataService.customer.getCustomerList(...c).refetchOnChannelChange(),c=>c.customers,(c,u)=>({options:{skip:c,take:u,filter:{emailAddress:{contains:this.searchTerm.value},lastName:{contains:this.searchTerm.value},postalCode:{contains:this.searchTerm.value}},filterOperator:d.FnJ.OR,sort:{createdAt:xo.As.DESC}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,H.h)(o=>2<o.length||0===o.length),(0,te.b)(250),(0,se.R)(this.destroy$)).subscribe(()=>this.refresh())}deleteCustomer(o){return this.modalService.dialog({title:(0,m.J)("catalog.confirm-delete-customer"),body:`${o.firstName} ${o.lastName}`,buttons:[{type:"secondary",label:(0,m.J)("common.cancel")},{type:"danger",label:(0,m.J)("common.delete"),returnValue:!0}]}).pipe((0,g.w)(t=>t?this.dataService.customer.deleteCustomer(o.id):y.E)).subscribe(()=>{this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Customer"}),this.refresh()},t=>{this.notificationService.error((0,m.J)("common.notify-delete-error"),{entity:"Customer"})})}}M.\u0275fac=function(o){return new(o||M)(e.Y36(d.DoR),e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.Z7U),e.Y36(d.gqp))},M.\u0275cmp=e.Xpm({type:M,selectors:[["vdr-customer-list"]],features:[e.qOj],decls:24,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input",3,"formControl","placeholder"],["locationId","customer-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[3,"expand"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[3,"customer"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(o,t){1&o&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left"),e._UZ(2,"input",0),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-ab-right"),e._UZ(5,"vdr-action-bar-items",1),e.YNc(6,Ao,4,5,"a",2),e.qZA()(),e.TgZ(7,"vdr-data-table",3),e.NdJ("pageChange",function(r){return t.setPageNumber(r)})("itemsPerPageChange",function(r){return t.setItemsPerPage(r)}),e.ALo(8,"async"),e.ALo(9,"async"),e.ALo(10,"async"),e.ALo(11,"async"),e.TgZ(12,"vdr-dt-column",4),e._uU(13),e.ALo(14,"translate"),e.qZA(),e.TgZ(15,"vdr-dt-column",4),e._uU(16),e.ALo(17,"translate"),e.qZA(),e.TgZ(18,"vdr-dt-column"),e._uU(19),e.ALo(20,"translate"),e.qZA(),e._UZ(21,"vdr-dt-column")(22,"vdr-dt-column"),e.YNc(23,To,21,20,"ng-template"),e.qZA()),2&o&&(e.xp6(2),e.Q6J("formControl",t.searchTerm)("placeholder",e.lcZ(3,12,"customer.search-customers-by-email-last-name-postal-code")),e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomer"),e.xp6(1),e.Q6J("items",e.lcZ(8,14,t.items$))("itemsPerPage",e.lcZ(9,16,t.itemsPerPage$))("totalItems",e.lcZ(10,18,t.totalItems$))("currentPage",e.lcZ(11,20,t.currentPage$)),e.xp6(5),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(14,22,"customer.name")),e.xp6(2),e.Q6J("expand",!0),e.xp6(1),e.Oqu(e.lcZ(17,24,"customer.email-address")),e.xp6(3),e.Oqu(e.lcZ(20,26,"customer.customer-type")))},directives:[x.Kk,x.BN,N.y,l.Fj,l.JJ,l.oH,x.mz,ce.W,X.H,C.yS,b.qvL,$.Q,ne.E,Z,re.v,j.J,R.U,B.N,V.H],pipes:[v.X$,_.Ov,U.j],styles:[".search-input[_ngcontent-%COMP%]{margin-top:6px;min-width:300px}"]});class D extends d.p_9{constructor(o,t){super(o,{__typename:"Customer",id:"",createdAt:"",updatedAt:"",title:"",firstName:"",lastName:"",emailAddress:"",phoneNumber:null,addresses:null,user:null},n=>t.customer.getCustomer(n,{take:10,sort:{orderPlacedAt:d.Asd.DESC}}).mapStream(r=>r.customer))}}D.\u0275fac=function(o){return new(o||D)(e.LFG(C.F0),e.LFG(d.DoR))},D.\u0275prov=e.Yz7({token:D,factory:D.\u0275fac,providedIn:"root"});const ve=[{path:"customers",component:M,pathMatch:"",data:{breadcrumb:(0,m.J)("breadcrumb.customers")}},{path:"customers/:id",component:P,resolve:(0,d.Po4)(D),canDeactivate:[d.TSp],data:{breadcrumb:ye}},{path:"groups",component:w,data:{breadcrumb:(0,m.J)("breadcrumb.customer-groups")}}];function ye(s,o){return(0,d.YWC)({entity:s.entity,id:o.id,breadcrumbKey:"breadcrumb.customers",getName:t=>`${t.firstName} ${t.lastName}`,route:"customers"})}class G{}G.\u0275fac=function(o){return new(o||G)},G.\u0275mod=e.oAB({type:G}),G.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(ve)]]})}}]);
2
+ //# sourceMappingURL=654.d4c38af0c765576f.js.map