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

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 (65) hide show
  1. package/lib/admin-ui/165.6aeb6ecf722558ee.js.map +1 -1
  2. package/lib/admin-ui/239.e2e63f2ccd517604.js +2 -0
  3. package/lib/admin-ui/239.e2e63f2ccd517604.js.map +1 -0
  4. package/lib/admin-ui/26.5cc3bfffe8943e16.js +2 -0
  5. package/lib/admin-ui/26.5cc3bfffe8943e16.js.map +1 -0
  6. package/lib/admin-ui/316.265d65a6a9d1b4c0.js +2 -0
  7. package/lib/admin-ui/{316.07f9c805e4c95dc8.js.map → 316.265d65a6a9d1b4c0.js.map} +1 -1
  8. package/lib/admin-ui/356.975f7f2d201afda5.js +2 -0
  9. package/lib/admin-ui/356.975f7f2d201afda5.js.map +1 -0
  10. package/lib/admin-ui/3rdpartylicenses.txt +23 -0
  11. package/lib/admin-ui/407.a3fde1da25c0935c.js +12 -0
  12. package/lib/admin-ui/407.a3fde1da25c0935c.js.map +1 -0
  13. package/lib/admin-ui/451.a7fd4069c4f4c687.js +65 -0
  14. package/lib/admin-ui/451.a7fd4069c4f4c687.js.map +1 -0
  15. package/lib/admin-ui/600.17470a2c90aa79d8.js +2 -0
  16. package/lib/admin-ui/600.17470a2c90aa79d8.js.map +1 -0
  17. package/lib/admin-ui/625.3c0c5821b952b58e.js +2 -0
  18. package/lib/admin-ui/{625.adebc6a7222bde82.js.map → 625.3c0c5821b952b58e.js.map} +1 -1
  19. package/lib/admin-ui/i18n-messages/cs.json +50 -3
  20. package/lib/admin-ui/i18n-messages/de.json +53 -3
  21. package/lib/admin-ui/i18n-messages/en.json +55 -8
  22. package/lib/admin-ui/i18n-messages/es.json +50 -3
  23. package/lib/admin-ui/i18n-messages/fr.json +50 -3
  24. package/lib/admin-ui/i18n-messages/it.json +50 -3
  25. package/lib/admin-ui/i18n-messages/pl.json +50 -3
  26. package/lib/admin-ui/i18n-messages/pt_BR.json +50 -3
  27. package/lib/admin-ui/i18n-messages/pt_PT.json +50 -3
  28. package/lib/admin-ui/i18n-messages/ru.json +50 -3
  29. package/lib/admin-ui/i18n-messages/uk.json +50 -3
  30. package/lib/admin-ui/i18n-messages/zh_Hans.json +50 -3
  31. package/lib/admin-ui/i18n-messages/zh_Hant.json +50 -3
  32. package/lib/admin-ui/index.html +2 -2
  33. package/lib/admin-ui/main.65109179713dd228.js +2944 -0
  34. package/lib/admin-ui/main.65109179713dd228.js.map +1 -0
  35. package/lib/admin-ui/runtime.28bd5da02a9b1f7b.js +2 -0
  36. package/lib/admin-ui/{runtime.1dd1cbaf09547dd2.js.map → runtime.28bd5da02a9b1f7b.js.map} +1 -1
  37. package/lib/admin-ui/styles/_variables.scss +4 -0
  38. package/lib/admin-ui/styles/global/_forms.scss +8 -7
  39. package/lib/admin-ui/styles/global/_overrides.scss +11 -1
  40. package/lib/admin-ui/styles/global/_sass-overrides.scss +3 -0
  41. package/lib/admin-ui/styles/global/_utilities.scss +14 -0
  42. package/lib/admin-ui/styles/styles.scss +1 -0
  43. package/lib/admin-ui/styles/theme/default.scss +13 -1
  44. package/lib/admin-ui/styles/ui-extension-theme.scss +1 -0
  45. package/lib/admin-ui/{styles.fb1aaa9a9baed129.css → styles.88d3f0120bfc894a.css} +2 -2
  46. package/lib/admin-ui/styles.88d3f0120bfc894a.css.map +1 -0
  47. package/package.json +4 -4
  48. package/lib/admin-ui/239.a68e402e10b798f1.js +0 -2
  49. package/lib/admin-ui/239.a68e402e10b798f1.js.map +0 -1
  50. package/lib/admin-ui/26.477d6446134d960e.js +0 -2
  51. package/lib/admin-ui/26.477d6446134d960e.js.map +0 -1
  52. package/lib/admin-ui/316.07f9c805e4c95dc8.js +0 -2
  53. package/lib/admin-ui/349.abe4847f7fe9b3da.js +0 -2
  54. package/lib/admin-ui/349.abe4847f7fe9b3da.js.map +0 -1
  55. package/lib/admin-ui/356.3a6951fe80b5a001.js +0 -2
  56. package/lib/admin-ui/356.3a6951fe80b5a001.js.map +0 -1
  57. package/lib/admin-ui/600.8f0165a8d1255cd0.js +0 -2
  58. package/lib/admin-ui/600.8f0165a8d1255cd0.js.map +0 -1
  59. package/lib/admin-ui/625.adebc6a7222bde82.js +0 -2
  60. package/lib/admin-ui/849.cc032ddf77c67cc3.js +0 -2
  61. package/lib/admin-ui/849.cc032ddf77c67cc3.js.map +0 -1
  62. package/lib/admin-ui/main.0b0d9a8ae6759254.js +0 -2740
  63. package/lib/admin-ui/main.0b0d9a8ae6759254.js.map +0 -1
  64. package/lib/admin-ui/runtime.1dd1cbaf09547dd2.js +0 -2
  65. package/lib/admin-ui/styles.fb1aaa9a9baed129.css.map +0 -1
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[356],{5356:(vt,D,a)=>{a.r(D),a.d(D,{DEFAULT_DASHBOARD_WIDGET_LAYOUT:()=>S,DEFAULT_WIDGETS:()=>k,DashboardComponent:()=>p,DashboardModule:()=>b,DashboardWidgetComponent:()=>g,LatestOrdersWidgetComponent:()=>m,LatestOrdersWidgetModule:()=>u,OrderSummaryWidgetComponent:()=>h,OrderSummaryWidgetModule:()=>f,TestWidgetComponent:()=>v,TestWidgetModule:()=>_,WelcomeWidgetComponent:()=>y,WelcomeWidgetModule:()=>C,dashboardRoutes:()=>A});var U=a(234),x=a(635),I=a(9337),t=a(3184),d=a(279),$=a(735),P=a(1519),O=a(2748),R=a(8854),s=a(6362),j=a(5111),w=a(6998),J=a(9416),q=a(4929),Z=a(7514);const N=["portal"];function Q(n,e){if(1&n&&(t.ynx(0),t._uU(1),t.ALo(2,"translate"),t.BQk()),2&n){const o=e.ngIf;t.xp6(1),t.Oqu(t.lcZ(2,1,o))}}function Y(n,e){}class g{constructor(e){this.componentFactoryResolver=e}ngAfterViewInit(){this.loadWidget()}loadWidget(){return(0,q.mG)(this,void 0,void 0,function*(){const e=this.widgetConfig.loadComponent(),o=e instanceof Promise?yield e:e;this.componentRef=this.portal.createComponent(this.componentFactoryResolver.resolveComponentFactory(o)),this.componentRef.changeDetectorRef.markForCheck()})}ngOnDestroy(){this.componentRef&&this.componentRef.destroy()}}function E(n,e){if(1&n){const o=t.EpF();t.TgZ(0,"button",7),t.NdJ("click",function(){const c=t.CHM(o).$implicit;return t.oxw().addWidget(c)}),t._uU(1),t.qZA()}if(2&n){const o=e.$implicit;t.xp6(1),t.hij(" ",o," ")}}g.\u0275fac=function(e){return new(e||g)(t.Y36(t._Vd))},g.\u0275cmp=t.Xpm({type:g,selectors:[["vdr-dashboard-widget"]],viewQuery:function(e,o){if(1&e&&t.Gf(N,5,t.s_b),2&e){let r;t.iGM(r=t.CRH())&&(o.portal=r.first)}},inputs:{widgetConfig:"widgetConfig"},ngContentSelectors:["*"],decls:9,vars:1,consts:[[1,"card"],[1,"card-header"],[1,"title"],[4,"ngIf"],[1,"controls"],[1,"card-block"],["portal",""]],template:function(e,o){1&e&&(t.F$t(),t.TgZ(0,"div",0)(1,"div",1)(2,"div",2),t.YNc(3,Q,3,3,"ng-container",3),t.qZA(),t.TgZ(4,"div",4),t.Hsn(5),t.qZA()(),t.TgZ(6,"div",5),t.YNc(7,Y,0,0,"ng-template",null,6,t.W1O),t.qZA()()),2&e&&(t.xp6(3),t.Q6J("ngIf",o.widgetConfig.title))},directives:[s.O5],pipes:[Z.X$],styles:["[_nghost-%COMP%]{display:block}.card[_ngcontent-%COMP%]{margin-top:0;min-height:200px}.card-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between}"],changeDetection:0});const H=function(n){return{width:n}};function V(n,e){if(1&n){const o=t.EpF();t.TgZ(0,"button",22),t.NdJ("click",function(){const c=t.CHM(o).$implicit,l=t.oxw(2).$implicit;return t.oxw(2).setWidgetWidth(l,c)}),t._uU(1),t.ALo(2,"translate"),t.qZA()}if(2&n){const o=e.$implicit,r=t.oxw(2).$implicit;t.Q6J("disabled",o===r.width),t.xp6(1),t.hij(" ",t.xi3(2,2,"dashboard.widget-width",t.VKq(5,H,o))," ")}}function z(n,e){if(1&n){const o=t.EpF();t.TgZ(0,"vdr-dashboard-widget",12)(1,"div",13)(2,"div",14),t._UZ(3,"clr-icon",15),t.qZA(),t.TgZ(4,"vdr-dropdown")(5,"button",16),t._UZ(6,"clr-icon",17),t.qZA(),t.TgZ(7,"vdr-dropdown-menu",3)(8,"h4",18),t._uU(9),t.ALo(10,"translate"),t.qZA(),t.YNc(11,V,3,7,"button",19),t._UZ(12,"div",20),t.TgZ(13,"button",7),t.NdJ("click",function(){t.CHM(o);const i=t.oxw().$implicit;return t.oxw(2).removeWidget(i)}),t._UZ(14,"clr-icon",21),t._uU(15),t.ALo(16,"translate"),t.qZA()()()()()}if(2&n){const o=t.oxw().$implicit,r=t.oxw(2);t.Q6J("widgetConfig",o.config),t.xp6(9),t.Oqu(t.lcZ(10,4,"dashboard.widget-resize")),t.xp6(2),t.Q6J("ngForOf",r.getSupportedWidths(o.config)),t.xp6(4),t.hij(" ",t.lcZ(16,6,"dashboard.remove-widget")," ")}}function X(n,e){if(1&n&&(t.TgZ(0,"div",10),t.YNc(1,z,17,8,"vdr-dashboard-widget",11),t.qZA()),2&n){const o=e.$implicit,r=t.oxw(2);t.Q6J("ngClass",r.getClassForWidth(o.width))("cdkDragData",o),t.xp6(1),t.Q6J("vdrIfPermissions",o.config.requiresPermissions||null)}}const G=function(n){return{index:n}};function K(n,e){if(1&n){const o=t.EpF();t.TgZ(0,"div",8),t.NdJ("cdkDropListDropped",function(i){return t.CHM(o),t.oxw().drop(i)}),t.YNc(1,X,2,3,"div",9),t.qZA()}if(2&n){const o=e.$implicit,r=e.index,i=t.oxw();t.Q6J("cdkDropListData",t.VKq(3,G,r)),t.xp6(1),t.Q6J("ngForOf",o)("ngForTrackBy",i.trackRowItem)}}class p{constructor(e,o,r,i){this.dashboardWidgetService=e,this.localStorageService=o,this.changedDetectorRef=r,this.dataService=i,this.deletionMarker="__delete__"}ngOnInit(){this.availableWidgetIds$=this.dataService.client.userStatus().stream$.pipe((0,x.U)(({userStatus:e})=>e.permissions),(0,x.U)(e=>this.dashboardWidgetService.getAvailableIds(e)),(0,I.b)(e=>this.widgetLayout=this.initLayout(e)))}getClassForWidth(e){switch(e){case 3:return"clr-col-12 clr-col-sm-6 clr-col-lg-3";case 4:return"clr-col-12 clr-col-sm-6 clr-col-lg-4";case 6:return"clr-col-12 clr-col-lg-6";case 8:return"clr-col-12 clr-col-lg-8";case 12:return"clr-col-12";default:(0,U.assertNever)(e)}}getSupportedWidths(e){return e.supportedWidths||[3,4,6,8,12]}setWidgetWidth(e,o){e.width=o,this.recalculateLayout()}trackRow(e,o){return o.map(i=>`${i.id}:${i.width}`).join("|")}trackRowItem(e,o){return o.config}addWidget(e){var o;const r=this.dashboardWidgetService.getWidgetById(e);if(r){const c={id:e,config:r,width:this.getSupportedWidths(r)[0]};let l;this.widgetLayout&&this.widgetLayout.length?l=this.widgetLayout[this.widgetLayout.length-1]:(l=[],null===(o=this.widgetLayout)||void 0===o||o.push(l)),l.push(c),this.recalculateLayout()}}removeWidget(e){e.id=this.deletionMarker,this.recalculateLayout()}drop(e){const{currentIndex:o,previousIndex:r,previousContainer:i,container:c}=e;if((r!==o||i.data.index!==c.data.index)&&this.widgetLayout){const l=this.widgetLayout[i.data.index],F=this.widgetLayout[c.data.index];l.splice(r,1),F.splice(o,0,e.item.data),this.recalculateLayout()}}initLayout(e){const o=this.localStorageService.get("dashboardWidgetLayout");let r;return o&&(r=o.filter(i=>e.includes(i.id))),this.dashboardWidgetService.getWidgetLayout(r)}recalculateLayout(){if(this.widgetLayout){const o=this.widgetLayout.reduce((r,i)=>[...r,...i],[]).filter(r=>r.id!==this.deletionMarker).map(r=>({id:r.id,width:r.width}));this.widgetLayout=this.dashboardWidgetService.getWidgetLayout(o),this.localStorageService.set("dashboardWidgetLayout",o),setTimeout(()=>this.changedDetectorRef.markForCheck())}}}p.\u0275fac=function(e){return new(e||p)(t.Y36(d.ayj),t.Y36(d.n2A),t.Y36(t.sBO),t.Y36(d.DoR))},p.\u0275cmp=t.Xpm({type:p,selectors:[["vdr-dashboard"]],decls:11,vars:8,consts:[[1,"widget-header"],["vdrDropdownTrigger","",1,"btn","btn-secondary","btn-sm"],["shape","plus"],["vdrPosition","bottom-right"],["class","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["cdkDropListGroup",""],["class","clr-row dashboard-row","cdkDropList","","cdkDropListOrientation","horizontal",3,"cdkDropListData","cdkDropListDropped",4,"ngFor","ngForOf","ngForTrackBy"],["vdrDropdownItem","",1,"button",3,"click"],["cdkDropList","","cdkDropListOrientation","horizontal",1,"clr-row","dashboard-row",3,"cdkDropListData","cdkDropListDropped"],["class","dashboard-item","cdkDrag","",3,"ngClass","cdkDragData",4,"ngFor","ngForOf","ngForTrackBy"],["cdkDrag","",1,"dashboard-item",3,"ngClass","cdkDragData"],[3,"widgetConfig",4,"vdrIfPermissions"],[3,"widgetConfig"],[1,"flex"],["cdkDragHandle","",1,"drag-handle"],["shape","drag-handle","size","24"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],[1,"dropdown-header"],["class","button","vdrDropdownItem","",3,"disabled","click",4,"ngFor","ngForOf"],["role","separator",1,"dropdown-divider"],["shape","trash",1,"is-danger"],["vdrDropdownItem","",1,"button",3,"disabled","click"]],template:function(e,o){1&e&&(t.TgZ(0,"div",0)(1,"vdr-dropdown")(2,"button",1),t._UZ(3,"clr-icon",2),t._uU(4),t.ALo(5,"translate"),t.qZA(),t.TgZ(6,"vdr-dropdown-menu",3),t.YNc(7,E,2,1,"button",4),t.ALo(8,"async"),t.qZA()()(),t.TgZ(9,"div",5),t.YNc(10,K,2,5,"div",6),t.qZA()),2&e&&(t.xp6(4),t.hij(" ",t.lcZ(5,4,"dashboard.add-widget")," "),t.xp6(3),t.Q6J("ngForOf",t.lcZ(8,6,o.availableWidgetIds$)),t.xp6(3),t.Q6J("ngForOf",o.widgetLayout)("ngForTrackBy",o.trackRow))},directives:[$.J,P.U,O.qvL,R.N,s.sg,j.H,w.Fd,O.q0d,w.Wj,w.Zt,s.mk,J.H,g,w.Bh],pipes:[Z.X$,s.Ov],styles:[".widget-header[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.placeholder[_ngcontent-%COMP%]{color:var(--color-grey-300);text-align:center}.placeholder[_ngcontent-%COMP%] .version[_ngcontent-%COMP%]{font-size:3em;margin:24px;line-height:1em}.placeholder[_ngcontent-%COMP%] .clr-i-outline{fill:var(--color-grey-200)}vdr-dashboard-widget[_ngcontent-%COMP%]{margin-bottom:24px}.cdk-drag-preview[_ngcontent-%COMP%]{box-sizing:border-box;border-radius:4px}.cdk-drag-placeholder[_ngcontent-%COMP%]{opacity:0}.cdk-drag-animating[_ngcontent-%COMP%]{transition:transform .25s cubic-bezier(0,0,.2,1)}.dashboard-row[_ngcontent-%COMP%]{padding:0;border-width:1;margin-bottom:6px;transition:padding .2s,margin .2s}.dashboard-row.cdk-drop-list-dragging[_ngcontent-%COMP%], .dashboard-row.cdk-drop-list-receiving[_ngcontent-%COMP%]{border:1px dashed var(--color-component-border-200);padding:6px}.dashboard-row.cdk-drop-list-dragging[_ngcontent-%COMP%] .dashboard-item[_ngcontent-%COMP%]:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}"],changeDetection:0});var tt=a(9720);const A=[{path:"",component:p,pathMatch:"full"}];var W=a(8270),et=a(365),ot=a(5886),nt=a(458),rt=a(8899),it=a(4187),T=a(6826);const at=function(n){return["/orders/",n]};function dt(n,e){if(1&n&&(t.TgZ(0,"td",1),t._uU(1),t._UZ(2,"vdr-order-state-label",2),t.qZA(),t.TgZ(3,"td",1),t._UZ(4,"vdr-customer-label",3),t.qZA(),t.TgZ(5,"td",1),t._uU(6),t.ALo(7,"localeCurrency"),t.qZA(),t.TgZ(8,"td",1),t._uU(9),t.ALo(10,"timeAgo"),t.qZA(),t.TgZ(11,"td",4),t._UZ(12,"vdr-table-row-action",5),t.ALo(13,"translate"),t.qZA()),2&n){const o=e.item;t.xp6(1),t.hij(" ",o.code," "),t.xp6(1),t.Q6J("state",o.state),t.xp6(2),t.Q6J("customer",o.customer),t.xp6(2),t.Oqu(t.xi3(7,7,o.total,o.currencyCode)),t.xp6(3),t.Oqu(t.lcZ(10,10,o.orderPlacedAt)),t.xp6(3),t.Q6J("label",t.lcZ(13,12,"common.open"))("linkTo",t.VKq(14,at,o.id))}}class m{constructor(e){this.dataService=e}ngOnInit(){this.latestOrders$=this.dataService.order.getOrders({take:10,filter:{active:{eq:!1},state:{notEq:"Cancelled"}},sort:{orderPlacedAt:d.Asd.DESC}}).refetchOnChannelChange().mapStream(e=>e.orders.items)}}m.\u0275fac=function(e){return new(e||m)(t.Y36(d.DoR))},m.\u0275cmp=t.Xpm({type:m,selectors:[["vdr-latest-orders-widget"]],decls:3,vars:3,consts:[[3,"items"],[1,"left","align-middle"],[3,"state"],[3,"customer"],[1,"right","align-middle"],["iconShape","shopping-cart",3,"label","linkTo"]],template:function(e,o){1&e&&(t.TgZ(0,"vdr-data-table",0),t.ALo(1,"async"),t.YNc(2,dt,14,16,"ng-template"),t.qZA()),2&e&&t.Q6J("items",t.lcZ(1,1,o.latestOrders$))},directives:[et.Q,ot.G,nt.d,rt.v],pipes:[s.Ov,it.k,T.e,Z.X$],styles:["vdr-data-table[_ngcontent-%COMP%] table{margin-top:0}"],changeDetection:0});class u{}u.\u0275fac=function(e){return new(e||u)},u.\u0275mod=t.oAB({type:u}),u.\u0275inj=t.cJS({imports:[[d.IR2,d.m81]]});var st=a(704),L=a.n(st),ct=a(6317),lt=a(8977),M=a(9196),gt=a(2673),pt=a(2651);function mt(n,e){if(1&n){const o=t.EpF();t.TgZ(0,"div",7)(1,"button",8),t.NdJ("click",function(){t.CHM(o);const i=t.oxw();return i.selection$.next({timeframe:"day",date:i.today})}),t._uU(2),t.ALo(3,"translate"),t.qZA(),t.TgZ(4,"button",8),t.NdJ("click",function(){t.CHM(o);const i=t.oxw();return i.selection$.next({timeframe:"day",date:i.yesterday})}),t._uU(5),t.ALo(6,"translate"),t.qZA(),t.TgZ(7,"button",8),t.NdJ("click",function(){return t.CHM(o),t.oxw().selection$.next({timeframe:"week"})}),t._uU(8),t.ALo(9,"translate"),t.qZA(),t.TgZ(10,"button",8),t.NdJ("click",function(){return t.CHM(o),t.oxw().selection$.next({timeframe:"month"})}),t._uU(11),t.ALo(12,"translate"),t.qZA()()}if(2&n){const o=e.ngIf,r=t.oxw();t.xp6(1),t.ekj("btn-primary",o.date===r.today),t.xp6(1),t.hij(" ",t.lcZ(3,12,"dashboard.today")," "),t.xp6(2),t.ekj("btn-primary",o.date===r.yesterday),t.xp6(1),t.hij(" ",t.lcZ(6,14,"dashboard.yesterday")," "),t.xp6(2),t.ekj("btn-primary","week"===o.timeframe),t.xp6(1),t.hij(" ",t.lcZ(9,16,"dashboard.thisWeek")," "),t.xp6(2),t.ekj("btn-primary","month"===o.timeframe),t.xp6(1),t.hij(" ",t.lcZ(12,18,"dashboard.thisMonth")," ")}}function ut(n,e){if(1&n&&(t.TgZ(0,"div",9),t._uU(1),t.ALo(2,"localeDate"),t.ALo(3,"localeDate"),t.qZA()),2&n){const o=e.ngIf;t.xp6(1),t.AsE(" ",t.lcZ(2,2,o.start)," - ",t.lcZ(3,4,o.end)," ")}}class h{constructor(e){this.dataService=e,this.today=new Date,this.yesterday=new Date((new Date).setDate(this.today.getDate()-1)),this.selection$=new ct.X({timeframe:"day",date:this.today})}ngOnInit(){this.dateRange$=this.selection$.pipe((0,lt.x)(),(0,x.U)(o=>({start:L()(o.date).startOf(o.timeframe).toDate(),end:L()(o.date).endOf(o.timeframe).toDate()})),(0,M.d)(1));const e=this.dateRange$.pipe((0,gt.w)(({start:o,end:r})=>this.dataService.order.getOrderSummary(o,r).refetchOnChannelChange().mapStream(i=>i.orders)),(0,M.d)(1));this.totalOrderCount$=e.pipe((0,x.U)(o=>o.totalItems)),this.totalOrderValue$=e.pipe((0,x.U)(o=>o.items.reduce((r,i)=>r+i.total,0)/100)),this.currencyCode$=this.dataService.settings.getActiveChannel().refetchOnChannelChange().mapStream(o=>o.activeChannel.currencyCode||void 0)}}h.\u0275fac=function(e){return new(e||h)(t.Y36(d.DoR))},h.\u0275cmp=t.Xpm({type:h,selectors:[["vdr-order-summary-widget"]],decls:22,vars:23,consts:[[1,"stats"],[1,"stat"],[1,"stat-figure"],[1,"stat-label"],[1,"footer"],["class","btn-group btn-outline-primary btn-sm",4,"ngIf"],["class","date-range p5",4,"ngIf"],[1,"btn-group","btn-outline-primary","btn-sm"],[1,"btn",3,"click"],[1,"date-range","p5"]],template:function(e,o){1&e&&(t.TgZ(0,"div",0)(1,"div",1)(2,"div",2),t._uU(3),t.ALo(4,"async"),t.qZA(),t.TgZ(5,"div",3),t._uU(6),t.ALo(7,"translate"),t.qZA()(),t.TgZ(8,"div",1)(9,"div",2),t._uU(10),t.ALo(11,"currency"),t.ALo(12,"async"),t.ALo(13,"async"),t.qZA(),t.TgZ(14,"div",3),t._uU(15),t.ALo(16,"translate"),t.qZA()()(),t.TgZ(17,"div",4),t.YNc(18,mt,13,20,"div",5),t.ALo(19,"async"),t.YNc(20,ut,4,6,"div",6),t.ALo(21,"async"),t.qZA()),2&e&&(t.xp6(3),t.Oqu(t.lcZ(4,6,o.totalOrderCount$)),t.xp6(3),t.Oqu(t.lcZ(7,8,"dashboard.total-orders")),t.xp6(4),t.hij(" ",t.xi3(11,10,t.lcZ(12,13,o.totalOrderValue$),t.lcZ(13,15,o.currencyCode$)||void 0)," "),t.xp6(5),t.Oqu(t.lcZ(16,17,"dashboard.total-order-value")),t.xp6(3),t.Q6J("ngIf",t.lcZ(19,19,o.selection$)),t.xp6(2),t.Q6J("ngIf",t.lcZ(21,21,o.dateRange$)))},directives:[s.O5],pipes:[s.Ov,Z.X$,s.H9,pt.H],styles:[".stats[_ngcontent-%COMP%]{display:flex;justify-content:space-evenly}.stat[_ngcontent-%COMP%]{text-align:center}.stat-figure[_ngcontent-%COMP%]{font-size:2rem;line-height:3rem}.stat-label[_ngcontent-%COMP%]{text-transform:uppercase}.date-range[_ngcontent-%COMP%]{margin-top:0}.footer[_ngcontent-%COMP%]{margin-top:24px;display:flex;flex-direction:column;justify-content:space-between}@media screen and (min-width: 768px){.footer[_ngcontent-%COMP%]{flex-direction:row}}"],changeDetection:0});class f{}f.\u0275fac=function(e){return new(e||f)},f.\u0275mod=t.oAB({type:f}),f.\u0275inj=t.cJS({imports:[[d.IR2]]});class v{}v.\u0275fac=function(e){return new(e||v)},v.\u0275cmp=t.Xpm({type:v,selectors:[["vdr-test-widget"]],decls:2,vars:0,template:function(e,o){1&e&&(t.TgZ(0,"p"),t._uU(1,"This is a test widget!"),t.qZA())},styles:[""],changeDetection:0});class _{}function ht(n,e){if(1&n&&(t.TgZ(0,"p",4),t._uU(1),t.qZA()),2&n){const o=t.oxw(2);t.xp6(1),t.AsE(" ",o.hideVendureBranding?"":"Vendure"," ",o.hideVersion?"":"Admin UI v"+o.version," ")}}function ft(n,e){if(1&n&&(t.TgZ(0,"div")(1,"h4",3),t._uU(2),t._UZ(3,"br"),t.TgZ(4,"small",4),t._uU(5),t.ALo(6,"timeAgo"),t.qZA()(),t.YNc(7,ht,2,2,"p",5),t.qZA()),2&n){const o=e.ngIf,r=t.oxw();t.xp6(2),t.AsE(" Welcome, ",o.firstName," ",o.lastName,""),t.xp6(3),t.hij("Last login: ",t.lcZ(6,4,o.user.lastLogin),""),t.xp6(2),t.Q6J("ngIf",!r.hideVendureBranding||!r.hideVersion)}}_.\u0275fac=function(e){return new(e||_)},_.\u0275mod=t.oAB({type:_}),_.\u0275inj=t.cJS({});class y{constructor(e){this.dataService=e,this.version=d.s5M,this.brand=(0,d.hq7)().brand,this.hideVendureBranding=(0,d.hq7)().hideVendureBranding,this.hideVersion=(0,d.hq7)().hideVersion}ngOnInit(){this.administrator$=this.dataService.administrator.getActiveAdministrator().mapStream(e=>e.activeAdministrator||null)}}y.\u0275fac=function(e){return new(e||y)(t.Y36(d.DoR))},y.\u0275cmp=t.Xpm({type:y,selectors:[["vdr-welcome-widget"]],decls:4,vars:3,consts:[[4,"ngIf"],[1,"placeholder"],["shape","line-chart","size","128"],[1,"h4"],[1,"p5"],["class","p5",4,"ngIf"]],template:function(e,o){1&e&&(t.YNc(0,ft,8,6,"div",0),t.ALo(1,"async"),t.TgZ(2,"div",1),t._UZ(3,"clr-icon",2),t.qZA()),2&e&&t.Q6J("ngIf",t.lcZ(1,1,o.administrator$))},directives:[s.O5,O.qvL],pipes:[s.Ov,T.e],styles:["[_nghost-%COMP%]{display:flex;justify-content:space-between}.placeholder[_ngcontent-%COMP%]{color:var(--color-grey-200)}"],changeDetection:0});class C{}C.\u0275fac=function(e){return new(e||C)},C.\u0275mod=t.oAB({type:C}),C.\u0275inj=t.cJS({imports:[[d.IR2]]});const S=[{id:"welcome",width:12},{id:"orderSummary",width:6},{id:"latestOrders",width:6}],k={welcome:{loadComponent:()=>y},orderSummary:{title:(0,W.J)("dashboard.orders-summary"),loadComponent:()=>h,requiresPermissions:[d.y3$.ReadOrder]},latestOrders:{title:(0,W.J)("dashboard.latest-orders"),loadComponent:()=>m,supportedWidths:[6,8,12],requiresPermissions:[d.y3$.ReadOrder]},testWidget:{title:"Test Widget",loadComponent:()=>v}};class b{constructor(e){Object.entries(k).map(([o,r])=>e.registerWidget(o,r)),0===e.getDefaultLayout().length&&e.setDefaultLayout(S)}}b.\u0275fac=function(e){return new(e||b)(t.LFG(d.ayj))},b.\u0275mod=t.oAB({type:b}),b.\u0275inj=t.cJS({imports:[[d.m81,tt.Bz.forChild(A)]]})}}]);
2
- //# sourceMappingURL=356.3a6951fe80b5a001.js.map
@@ -1 +0,0 @@
1
- {"version":3,"mappings":"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","names":["t","constructor","e","ngAfterViewInit","this","loadWidget","widgetConfig","loadComponent","o","Promise","componentRef","portal","createComponent","componentFactoryResolver","resolveComponentFactory","changeDetectorRef","markForCheck","ngOnDestroy","destroy","addWidget","g","selectors","oxw","setWidgetWidth","removeWidget","drop","r","i","ngOnInit","availableWidgetIds$","dataService","client","userStatus","stream$","pipe","x","permissions","dashboardWidgetService","getAvailableIds","I","widgetLayout","initLayout","getClassForWidth","U","getSupportedWidths","supportedWidths","width","recalculateLayout","trackRow","map","id","join","trackRowItem","config","getWidgetById","c","l","length","push","deletionMarker","currentIndex","previousIndex","previousContainer","container","data","index","F","splice","item","localStorageService","get","filter","includes","getWidgetLayout","reduce","set","setTimeout","changedDetectorRef","p","A","path","component","pathMatch","latestOrders$","order","getOrders","take","active","eq","state","notEq","sort","orderPlacedAt","d","refetchOnChannelChange","mapStream","orders","items","m","u","date","selection$","Date","setDate","today","getDate","ct","timeframe","dateRange$","lt","start","L","startOf","toDate","end","endOf","M","gt","getOrderSummary","totalOrderCount$","totalItems","totalOrderValue$","total","currencyCode$","settings","getActiveChannel","activeChannel","currencyCode","h","f","v","_","brand","hideVendureBranding","hideVersion","administrator$","administrator","getActiveAdministrator","activeAdministrator","y","C","S","k","welcome","orderSummary","title","W","requiresPermissions","latestOrders","testWidget","Object","entries","registerWidget","getDefaultLayout","setDefaultLayout","b","tt"],"sources":["./src/lib/dashboard/src/components/dashboard-widget/dashboard-widget.component.html","./src/lib/dashboard/src/components/dashboard-widget/dashboard-widget.component.ts","./src/lib/dashboard/src/components/dashboard/dashboard.component.html","./src/lib/dashboard/src/components/dashboard/dashboard.component.ts","./src/lib/dashboard/src/dashboard.routes.ts","./src/lib/dashboard/src/widgets/latest-orders-widget/latest-orders-widget.component.html","./src/lib/dashboard/src/widgets/latest-orders-widget/latest-orders-widget.component.ts","./src/lib/dashboard/src/widgets/order-summary-widget/order-summary-widget.component.html","./src/lib/dashboard/src/widgets/order-summary-widget/order-summary-widget.component.ts","./src/lib/dashboard/src/widgets/test-widget/test-widget.component.ts","./src/lib/dashboard/src/widgets/test-widget/test-widget.component.html","./src/lib/dashboard/src/widgets/welcome-widget/welcome-widget.component.html","./src/lib/dashboard/src/widgets/welcome-widget/welcome-widget.component.ts","./src/lib/dashboard/src/default-widgets.ts","./src/lib/dashboard/src/dashboard.module.ts"],"sourcesContent":["<div class=\"card\">\r\n <div class=\"card-header\">\r\n <div class=\"title\">\r\n <ng-container *ngIf=\"widgetConfig.title as title\">{{ title | translate }}</ng-container>\r\n </div>\r\n <div class=\"controls\">\r\n <ng-content></ng-content>\r\n </div>\r\n </div>\r\n <div class=\"card-block\">\r\n <ng-template #portal></ng-template>\r\n </div>\r\n</div>\r\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ComponentFactoryResolver,\n ComponentRef,\n Input,\n OnDestroy,\n OnInit,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport { DashboardWidgetConfig } from '@vendure/admin-ui/core';\n\n@Component({\n selector: 'vdr-dashboard-widget',\n templateUrl: './dashboard-widget.component.html',\n styleUrls: ['./dashboard-widget.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class DashboardWidgetComponent implements AfterViewInit, OnDestroy {\n @Input() widgetConfig: DashboardWidgetConfig;\n\n @ViewChild('portal', { read: ViewContainerRef })\n private portal: ViewContainerRef;\n\n private componentRef: ComponentRef<any>;\n\n constructor(private componentFactoryResolver: ComponentFactoryResolver) {}\n\n ngAfterViewInit(): void {\n this.loadWidget();\n }\n\n private async loadWidget() {\n const loadComponentResult = this.widgetConfig.loadComponent();\n const componentType =\n loadComponentResult instanceof Promise ? await loadComponentResult : loadComponentResult;\n this.componentRef = this.portal.createComponent(\n this.componentFactoryResolver.resolveComponentFactory(componentType),\n );\n this.componentRef.changeDetectorRef.markForCheck();\n }\n\n ngOnDestroy() {\n if (this.componentRef) {\n this.componentRef.destroy();\n }\n }\n}\n","<div class=\"widget-header\">\r\n <vdr-dropdown>\r\n <button class=\"btn btn-secondary btn-sm\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'dashboard.add-widget' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <button\r\n class=\"button\"\r\n vdrDropdownItem\r\n *ngFor=\"let id of availableWidgetIds$ | async\"\r\n (click)=\"addWidget(id)\"\r\n >\r\n {{ id }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n</div>\r\n<div cdkDropListGroup>\r\n <div\r\n class=\"clr-row dashboard-row\"\r\n *ngFor=\"let row of widgetLayout; index as rowIndex; trackBy: trackRow\"\r\n cdkDropList\r\n (cdkDropListDropped)=\"drop($event)\"\r\n cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListData]=\"{ index: rowIndex }\"\r\n >\r\n <div\r\n *ngFor=\"let widget of row; trackBy: trackRowItem\"\r\n class=\"dashboard-item\"\r\n [ngClass]=\"getClassForWidth(widget.width)\"\r\n cdkDrag\r\n [cdkDragData]=\"widget\"\r\n >\r\n <vdr-dashboard-widget\r\n *vdrIfPermissions=\"widget.config.requiresPermissions || null\"\r\n [widgetConfig]=\"widget.config\"\r\n >\r\n <div class=\"flex\">\r\n <div class=\"drag-handle\" cdkDragHandle>\r\n <clr-icon shape=\"drag-handle\" size=\"24\"></clr-icon>\r\n </div>\r\n <vdr-dropdown>\r\n <button class=\"icon-button\" vdrDropdownTrigger>\r\n <clr-icon shape=\"ellipsis-vertical\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <h4 class=\"dropdown-header\">{{ 'dashboard.widget-resize' | translate }}</h4>\r\n <button\r\n class=\"button\"\r\n vdrDropdownItem\r\n [disabled]=\"width === widget.width\"\r\n *ngFor=\"let width of getSupportedWidths(widget.config)\"\r\n (click)=\"setWidgetWidth(widget, width)\"\r\n >\r\n {{ 'dashboard.widget-width' | translate: { width: width } }}\r\n </button>\r\n <div class=\"dropdown-divider\" role=\"separator\"></div>\r\n <button class=\"button\" vdrDropdownItem (click)=\"removeWidget(widget)\">\r\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\r\n {{ 'dashboard.remove-widget' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </vdr-dashboard-widget>\r\n </div>\r\n </div>\r\n</div>\r\n","import { CdkDragDrop } from '@angular/cdk/drag-drop';\r\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';\r\nimport {\r\n DashboardWidgetConfig,\r\n DashboardWidgetService,\r\n DashboardWidgetWidth,\r\n DataService,\r\n LocalStorageService,\r\n WidgetLayout,\r\n WidgetLayoutDefinition,\r\n} from '@vendure/admin-ui/core';\r\nimport { assertNever } from '@vendure/common/lib/shared-utils';\r\nimport { Observable } from 'rxjs';\r\nimport { map, tap } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'vdr-dashboard',\r\n templateUrl: './dashboard.component.html',\r\n styleUrls: ['./dashboard.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class DashboardComponent implements OnInit {\r\n widgetLayout: WidgetLayout | undefined;\r\n availableWidgetIds$: Observable<string[]>;\r\n private readonly deletionMarker = '__delete__';\r\n\r\n constructor(\r\n private dashboardWidgetService: DashboardWidgetService,\r\n private localStorageService: LocalStorageService,\r\n private changedDetectorRef: ChangeDetectorRef,\r\n private dataService: DataService,\r\n ) {}\r\n\r\n ngOnInit() {\r\n this.availableWidgetIds$ = this.dataService.client.userStatus().stream$.pipe(\r\n map(({ userStatus }) => userStatus.permissions),\r\n map(permissions => this.dashboardWidgetService.getAvailableIds(permissions)),\r\n tap(ids => (this.widgetLayout = this.initLayout(ids))),\r\n );\r\n }\r\n\r\n getClassForWidth(width: DashboardWidgetWidth): string {\r\n switch (width) {\r\n case 3:\r\n return `clr-col-12 clr-col-sm-6 clr-col-lg-3`;\r\n case 4:\r\n return `clr-col-12 clr-col-sm-6 clr-col-lg-4`;\r\n case 6:\r\n return `clr-col-12 clr-col-lg-6`;\r\n case 8:\r\n return `clr-col-12 clr-col-lg-8`;\r\n case 12:\r\n return `clr-col-12`;\r\n default:\r\n assertNever(width);\r\n }\r\n }\r\n\r\n getSupportedWidths(config: DashboardWidgetConfig): DashboardWidgetWidth[] {\r\n return config.supportedWidths || [3, 4, 6, 8, 12];\r\n }\r\n\r\n setWidgetWidth(widget: WidgetLayout[number][number], width: DashboardWidgetWidth) {\r\n widget.width = width;\r\n this.recalculateLayout();\r\n }\r\n\r\n trackRow(index: number, row: WidgetLayout[number]) {\r\n const id = row.map(item => `${item.id}:${item.width}`).join('|');\r\n return id;\r\n }\r\n\r\n trackRowItem(index: number, item: WidgetLayout[number][number]) {\r\n return item.config;\r\n }\r\n\r\n addWidget(id: string) {\r\n const config = this.dashboardWidgetService.getWidgetById(id);\r\n if (config) {\r\n const width = this.getSupportedWidths(config)[0];\r\n const widget: WidgetLayout[number][number] = {\r\n id,\r\n config,\r\n width,\r\n };\r\n let targetRow: WidgetLayout[number];\r\n if (this.widgetLayout && this.widgetLayout.length) {\r\n targetRow = this.widgetLayout[this.widgetLayout.length - 1];\r\n } else {\r\n targetRow = [];\r\n this.widgetLayout?.push(targetRow);\r\n }\r\n targetRow.push(widget);\r\n this.recalculateLayout();\r\n }\r\n }\r\n\r\n removeWidget(widget: WidgetLayout[number][number]) {\r\n widget.id = this.deletionMarker;\r\n this.recalculateLayout();\r\n }\r\n\r\n drop(event: CdkDragDrop<{ index: number }>) {\r\n const { currentIndex, previousIndex, previousContainer, container } = event;\r\n if (previousIndex === currentIndex && previousContainer.data.index === container.data.index) {\r\n // Nothing changed\r\n return;\r\n }\r\n if (this.widgetLayout) {\r\n const previousLayoutRow = this.widgetLayout[previousContainer.data.index];\r\n const newLayoutRow = this.widgetLayout[container.data.index];\r\n\r\n previousLayoutRow.splice(previousIndex, 1);\r\n newLayoutRow.splice(currentIndex, 0, event.item.data);\r\n this.recalculateLayout();\r\n }\r\n }\r\n\r\n private initLayout(availableIds: string[]): WidgetLayout {\r\n const savedLayoutDef = this.localStorageService.get('dashboardWidgetLayout');\r\n let layoutDef: WidgetLayoutDefinition | undefined;\r\n if (savedLayoutDef) {\r\n // validate all the IDs from the saved layout are still available\r\n layoutDef = savedLayoutDef.filter(item => availableIds.includes(item.id));\r\n }\r\n return this.dashboardWidgetService.getWidgetLayout(layoutDef);\r\n }\r\n\r\n private recalculateLayout() {\r\n if (this.widgetLayout) {\r\n const flattened = this.widgetLayout\r\n .reduce((flat, row) => [...flat, ...row], [])\r\n .filter(item => item.id !== this.deletionMarker);\r\n const newLayoutDef: WidgetLayoutDefinition = flattened.map(item => ({\r\n id: item.id,\r\n width: item.width,\r\n }));\r\n this.widgetLayout = this.dashboardWidgetService.getWidgetLayout(newLayoutDef);\r\n this.localStorageService.set('dashboardWidgetLayout', newLayoutDef);\r\n setTimeout(() => this.changedDetectorRef.markForCheck());\r\n }\r\n }\r\n}\r\n","import { Routes } from '@angular/router';\r\n\r\nimport { DashboardComponent } from './components/dashboard/dashboard.component';\r\n\r\nexport const dashboardRoutes: Routes = [\r\n {\r\n path: '',\r\n component: DashboardComponent,\r\n pathMatch: 'full',\r\n },\r\n];\r\n","<vdr-data-table [items]=\"latestOrders$ | async\">\r\n <ng-template let-order=\"item\">\r\n <td class=\"left align-middle\">\r\n {{ order.code }}\r\n <vdr-order-state-label [state]=\"order.state\"></vdr-order-state-label>\r\n </td>\r\n <td class=\"left align-middle\">\r\n <vdr-customer-label [customer]=\"order.customer\"></vdr-customer-label>\r\n </td>\r\n <td class=\"left align-middle\">{{ order.total | localeCurrency: order.currencyCode }}</td>\r\n <td class=\"left align-middle\">{{ order.orderPlacedAt | timeAgo }}</td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"shopping-cart\"\r\n [label]=\"'common.open' | translate\"\r\n [linkTo]=\"['/orders/', order.id]\"\r\n ></vdr-table-row-action>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n","import { ChangeDetectionStrategy, Component, NgModule, OnInit } from '@angular/core';\r\nimport {\r\n CoreModule,\r\n DataService,\r\n GetOrderListQuery,\r\n ItemOf,\r\n SharedModule,\r\n SortOrder,\r\n} from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\n\r\n@Component({\r\n selector: 'vdr-latest-orders-widget',\r\n templateUrl: './latest-orders-widget.component.html',\r\n styleUrls: ['./latest-orders-widget.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class LatestOrdersWidgetComponent implements OnInit {\r\n latestOrders$: Observable<Array<ItemOf<GetOrderListQuery, 'orders'>>>;\r\n constructor(private dataService: DataService) {}\r\n\r\n ngOnInit(): void {\r\n this.latestOrders$ = this.dataService.order\r\n .getOrders({\r\n take: 10,\r\n filter: {\r\n active: { eq: false },\r\n state: { notEq: 'Cancelled' },\r\n },\r\n sort: {\r\n orderPlacedAt: SortOrder.DESC,\r\n },\r\n })\r\n .refetchOnChannelChange()\r\n .mapStream(data => data.orders.items);\r\n }\r\n}\r\n\r\n@NgModule({\r\n imports: [CoreModule, SharedModule],\r\n declarations: [LatestOrdersWidgetComponent],\r\n})\r\nexport class LatestOrdersWidgetModule {}\r\n","<div class=\"stats\">\r\n <div class=\"stat\">\r\n <div class=\"stat-figure\">{{ totalOrderCount$ | async }}</div>\r\n <div class=\"stat-label\">{{ 'dashboard.total-orders' | translate }}</div>\r\n </div>\r\n <div class=\"stat\">\r\n <div class=\"stat-figure\">\r\n {{ totalOrderValue$ | async | currency: (currencyCode$ | async) || undefined }}\r\n </div>\r\n <div class=\"stat-label\">{{ 'dashboard.total-order-value' | translate }}</div>\r\n </div>\r\n</div>\r\n<div class=\"footer\">\r\n <div class=\"btn-group btn-outline-primary btn-sm\" *ngIf=\"selection$ | async as selection\">\r\n <button class=\"btn\" [class.btn-primary]=\"selection.date === today\" (click)=\"selection$.next({timeframe: 'day', date: today})\">\r\n {{ 'dashboard.today' | translate }}\r\n </button>\r\n <button class=\"btn\" [class.btn-primary]=\"selection.date === yesterday\" (click)=\"selection$.next({timeframe: 'day', date: yesterday})\">\r\n {{ 'dashboard.yesterday' | translate }}\r\n </button>\r\n <button class=\"btn\" [class.btn-primary]=\"selection.timeframe === 'week'\" (click)=\"selection$.next({timeframe: 'week'})\">\r\n {{ 'dashboard.thisWeek' | translate }}\r\n </button>\r\n <button class=\"btn\" [class.btn-primary]=\"selection.timeframe === 'month'\" (click)=\"selection$.next({timeframe: 'month'})\">\r\n {{ 'dashboard.thisMonth' | translate }}\r\n </button>\r\n </div>\r\n\r\n <div class=\"date-range p5\" *ngIf=\"dateRange$ | async as range\">\r\n {{ range.start | localeDate }} - {{ range.end | localeDate }}\r\n </div>\r\n</div>\r\n","import { ChangeDetectionStrategy, Component, NgModule, OnInit } from '@angular/core';\r\nimport { CoreModule, DataService } from '@vendure/admin-ui/core';\r\nimport dayjs from 'dayjs';\r\nimport { BehaviorSubject, Observable } from 'rxjs';\r\nimport { distinctUntilChanged, map, shareReplay, switchMap } from 'rxjs/operators';\r\n\r\nexport type Timeframe = 'day' | 'week' | 'month';\r\n\r\n@Component({\r\n selector: 'vdr-order-summary-widget',\r\n templateUrl: './order-summary-widget.component.html',\r\n styleUrls: ['./order-summary-widget.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class OrderSummaryWidgetComponent implements OnInit {\r\n today = new Date();\r\n yesterday = new Date(new Date().setDate(this.today.getDate() - 1));\r\n totalOrderCount$: Observable<number>;\r\n totalOrderValue$: Observable<number>;\r\n currencyCode$: Observable<string | undefined>;\r\n selection$ = new BehaviorSubject<{ timeframe: Timeframe; date?: Date }>({\r\n timeframe: 'day',\r\n date: this.today,\r\n });\r\n dateRange$: Observable<{ start: Date; end: Date }>;\r\n\r\n constructor(private dataService: DataService) {}\r\n\r\n ngOnInit(): void {\r\n this.dateRange$ = this.selection$.pipe(\r\n distinctUntilChanged(),\r\n map(selection => {\r\n return {\r\n start: dayjs(selection.date).startOf(selection.timeframe).toDate(),\r\n end: dayjs(selection.date).endOf(selection.timeframe).toDate(),\r\n };\r\n }),\r\n shareReplay(1),\r\n );\r\n const orderSummary$ = this.dateRange$.pipe(\r\n switchMap(({ start, end }) => {\r\n return this.dataService.order\r\n .getOrderSummary(start, end)\r\n .refetchOnChannelChange()\r\n .mapStream(data => data.orders);\r\n }),\r\n shareReplay(1),\r\n );\r\n this.totalOrderCount$ = orderSummary$.pipe(map(res => res.totalItems));\r\n this.totalOrderValue$ = orderSummary$.pipe(\r\n map(res => res.items.reduce((total, order) => total + order.total, 0) / 100),\r\n );\r\n this.currencyCode$ = this.dataService.settings\r\n .getActiveChannel()\r\n .refetchOnChannelChange()\r\n .mapStream(data => data.activeChannel.currencyCode || undefined);\r\n }\r\n}\r\n\r\n@NgModule({\r\n imports: [CoreModule],\r\n declarations: [OrderSummaryWidgetComponent],\r\n})\r\nexport class OrderSummaryWidgetModule {}\r\n","import { ChangeDetectionStrategy, Component, NgModule } from '@angular/core';\n\n@Component({\n selector: 'vdr-test-widget',\n templateUrl: './test-widget.component.html',\n styleUrls: ['./test-widget.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TestWidgetComponent {}\n\n@NgModule({\n declarations: [TestWidgetComponent],\n})\nexport class TestWidgetModule {}\n","<p>This is a test widget!</p>\r\n","<div *ngIf=\"administrator$ | async as administrator\">\r\n <h4 class=\"h4\">\r\n Welcome, {{ administrator.firstName }} {{ administrator.lastName }}<br />\r\n <small class=\"p5\">Last login: {{ administrator.user.lastLogin | timeAgo }}</small>\r\n </h4>\r\n\r\n <p class=\"p5\" *ngIf=\"!hideVendureBranding || !hideVersion\">\r\n {{ hideVendureBranding ? '' : 'Vendure' }} {{ hideVersion ? '' : ('Admin UI v' + version) }}\r\n </p>\r\n</div>\r\n<div class=\"placeholder\">\r\n <clr-icon shape=\"line-chart\" size=\"128\"></clr-icon>\r\n</div>\r\n","import { ChangeDetectionStrategy, Component, NgModule, OnInit } from '@angular/core';\r\nimport {\r\n ADMIN_UI_VERSION,\r\n CoreModule,\r\n DataService,\r\n GetActiveAdministratorQuery,\r\n getAppConfig,\r\n} from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\n\r\n@Component({\r\n selector: 'vdr-welcome-widget',\r\n templateUrl: './welcome-widget.component.html',\r\n styleUrls: ['./welcome-widget.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class WelcomeWidgetComponent implements OnInit {\r\n version = ADMIN_UI_VERSION;\r\n administrator$: Observable<GetActiveAdministratorQuery['activeAdministrator']>;\r\n brand = getAppConfig().brand;\r\n hideVendureBranding = getAppConfig().hideVendureBranding;\r\n hideVersion = getAppConfig().hideVersion;\r\n\r\n constructor(private dataService: DataService) {}\r\n\r\n ngOnInit(): void {\r\n this.administrator$ = this.dataService.administrator\r\n .getActiveAdministrator()\r\n .mapStream(data => data.activeAdministrator || null);\r\n }\r\n}\r\n\r\n@NgModule({\r\n imports: [CoreModule],\r\n declarations: [WelcomeWidgetComponent],\r\n})\r\nexport class WelcomeWidgetModule {}\r\n","import { APP_INITIALIZER, FactoryProvider } from '@angular/core';\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\nimport {\n DashboardWidgetConfig,\n DashboardWidgetService,\n Permission,\n WidgetLayoutDefinition,\n} from '@vendure/admin-ui/core';\n\nimport { LatestOrdersWidgetComponent } from './widgets/latest-orders-widget/latest-orders-widget.component';\nimport { OrderSummaryWidgetComponent } from './widgets/order-summary-widget/order-summary-widget.component';\nimport { TestWidgetComponent } from './widgets/test-widget/test-widget.component';\nimport { WelcomeWidgetComponent } from './widgets/welcome-widget/welcome-widget.component';\n\nexport const DEFAULT_DASHBOARD_WIDGET_LAYOUT: WidgetLayoutDefinition = [\n { id: 'welcome', width: 12 },\n { id: 'orderSummary', width: 6 },\n { id: 'latestOrders', width: 6 },\n];\n\nexport const DEFAULT_WIDGETS: { [id: string]: DashboardWidgetConfig } = {\n welcome: {\n loadComponent: () => WelcomeWidgetComponent,\n },\n orderSummary: {\n title: _('dashboard.orders-summary'),\n loadComponent: () => OrderSummaryWidgetComponent,\n requiresPermissions: [Permission.ReadOrder],\n },\n latestOrders: {\n title: _('dashboard.latest-orders'),\n loadComponent: () => LatestOrdersWidgetComponent,\n supportedWidths: [6, 8, 12],\n requiresPermissions: [Permission.ReadOrder],\n },\n testWidget: {\n title: 'Test Widget',\n loadComponent: () => TestWidgetComponent,\n },\n};\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { DashboardWidgetService, SharedModule } from '@vendure/admin-ui/core';\n\nimport { DashboardWidgetComponent } from './components/dashboard-widget/dashboard-widget.component';\nimport { DashboardComponent } from './components/dashboard/dashboard.component';\nimport { dashboardRoutes } from './dashboard.routes';\nimport { DEFAULT_DASHBOARD_WIDGET_LAYOUT, DEFAULT_WIDGETS } from './default-widgets';\n\n@NgModule({\n imports: [SharedModule, RouterModule.forChild(dashboardRoutes)],\n declarations: [DashboardComponent, DashboardWidgetComponent],\n})\nexport class DashboardModule {\n constructor(dashboardWidgetService: DashboardWidgetService) {\n Object.entries(DEFAULT_WIDGETS).map(([id, config]) =>\n dashboardWidgetService.registerWidget(id, config),\n );\n if (dashboardWidgetService.getDefaultLayout().length === 0) {\n dashboardWidgetService.setDefaultLayout(DEFAULT_DASHBOARD_WIDGET_LAYOUT);\n }\n }\n}\n"],"sourceRoot":"webpack:///","file":"356.3a6951fe80b5a001.js"}
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[600],{4847:(Ao,ne,i)=>{i.r(ne),i.d(ne,{AddCustomerToGroupDialogComponent:()=>N,AddressCardComponent:()=>S,AddressDetailDialogComponent:()=>L,CustomerDetailComponent:()=>J,CustomerGroupDetailDialogComponent:()=>T,CustomerGroupListComponent:()=>I,CustomerGroupMemberListComponent:()=>A,CustomerHistoryComponent:()=>O,CustomerListComponent:()=>w,CustomerModule:()=>M,CustomerResolver:()=>D,CustomerStatusLabelComponent:()=>Z,SelectCustomerGroupDialogComponent:()=>F,customerBreadcrumb:()=>Ce,customerRoutes:()=>fe});var P=i(6317),g=i(2673),p=i(635),e=i(3184),d=i(279),Q=i(309),c=i(587),V=i(253),X=i(6562),q=i(4874),W=i(8977),ie=i(1989),ae=i(9337),ce=i(8951),C=i(9720),G=i(7890),K=i(365),z=i(901),ee=i(8899),v=i(7514),_=i(6362),U=i(7388);const xe=function(s){return["/customer","customers",s]};function be(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,xe,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 c.NI(""),this.refresh$=new P.X(!0),this.destroy$=new V.x,this.isMemberSelected=r=>-1<this.selectedMemberIds.indexOf(r.id)}ngOnInit(){this.membersCurrentPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPage")),(0,p.U)(t=>t?+t:1),(0,q.O)(1),(0,W.x)()),this.membersItemsPerPage$=this.route.paramMap.pipe((0,p.U)(t=>t.get("membersPerPage")),(0,p.U)(t=>t?+t:10),(0,q.O)(10),(0,W.x)());const o=this.filterTermControl.valueChanges.pipe((0,ie.b)(250),(0,ae.b)(()=>this.setContentsPageNumber(1)),(0,q.O)(""));(0,X.a)(this.membersCurrentPage$,this.membersItemsPerPage$,o,this.refresh$).pipe((0,ce.R)(this.destroy$)).subscribe(([t,r,n])=>{const a=r,l=(t-1)*r;this.fetchParamsChange.emit({filterTerm:n,skip:l,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(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(n){return t.setContentsPageNumber(n)})("itemsPerPageChange",function(n){return t.setContentsItemsPerPage(n)})("rowSelectChange",function(n){return t.toggleSelectMember(n)})("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,be,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:[G.y,c.Fj,c.JJ,c.oH,K.Q,z.E,ee.v],pipes:[v.X$,_.Ov,U.j],styles:[""],changeDetection:0});var $=i(8318);const ye=function(s){return{groupName:s}};function Ae(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,ye,t.group.name)),"\n")}}const Ze=function(s){return{count:s}};function Te(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,Ze,t.selectedCustomerIds.length))," ")}}class N{constructor(o){this.dataService=o,this.selectedCustomerIds=[],this.fetchGroupMembers$=new P.X({skip:0,take:10,filterTerm:""})}ngOnInit(){const o=this.fetchGroupMembers$.pipe((0,g.w)(({skip:t,take:r,filterTerm:n})=>this.dataService.customer.getCustomerList(r,t,n).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)}}N.\u0275fac=function(o){return new(o||N)(e.Y36(d.DoR))},N.\u0275cmp=e.Xpm({type:N,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,Ae,2,6,"ng-template",0),e.TgZ(1,"vdr-customer-group-member-list",1),e.NdJ("fetchParamsChange",function(n){return t.fetchGroupMembers$.next(n)})("selectionChange",function(n){return t.selectedCustomerIds=n}),e.ALo(2,"async"),e.ALo(3,"async"),e.qZA(),e.YNc(4,Te,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,$.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var te=i(116),le=i(9295),De=i(1480);function Ue(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 Ne(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.YNc(0,Ue,2,1,"span",3),e.YNc(1,Ne,2,1,"span",3)),2&s){const t=e.oxw();let r,n;e.Q6J("ngIf",null==(r=t.addressForm.get("streetLine1"))?null:r.value),e.xp6(1),e.Q6J("ngIf",null==(n=t.addressForm.get("countryCode"))?null:n.value)}}function Se(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,Le,2,2,"ng-template",0),e._UZ(1,"vdr-address-form",1),e.YNc(2,Se,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,De.C,c.JL,c.sg,$.n],pipes:[v.X$],styles:["clr-input-container[_ngcontent-%COMP%]{margin-bottom:12px}"],changeDetection:0});var E=i(4447),y=i(2748),Fe=i(9667),oe=i(3146),k=i(735),Y=i(1519),j=i(8854),H=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 Je(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 Ie(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 we(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 Me(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,Je,4,3,"vdr-chip",6),e.YNc(7,Ie,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,we,21,17,"ng-container",12),e.qZA()()),2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.Q6J("ngIf",t.streetLine1),e.xp6(1),e.hij(" ",t.countryCode," "),e.xp6(2),e.Q6J("ngIf",r.isDefaultShipping),e.xp6(1),e.Q6J("ngIf",r.isDefaultBilling),e.xp6(3),e.Q6J("address",t),e.xp6(2),e.Q6J("entity",t),e.xp6(1),e.Q6J("ngIf",r.editable)}}class S{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 P.X(!1)}ngOnInit(){this.addressForm.get("streetLine1").value||this.dataDependenciesPopulated.pipe((0,te.h)(t=>t),(0,le.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(r=>r.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()})}}S.\u0275fac=function(o){return new(o||S)(e.Y36(d.Z7U),e.Y36(e.sBO))},S.\u0275cmp=e.Xpm({type:S,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,Me,14,7,"div",0),2&o&&e.Q6J("ngIf",t.addressForm.value)},directives:[_.O5,E.Y,y.qvL,Fe.b,oe.V,k.J,Y.U,j.N,H.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 Pe=i(4929),m=i(8270),Ge=i(234),Ee=i(1640),de=i(7400),x=i(591),Qe=i(9196),qe=i(1944);const{isArray:$e}=Array;var Ye=i(1308),me=i(420);function je(...s){const o=(0,me.yG)(s),t=(0,me._6)(s,1/0);return s=function ke(s){return 1===s.length&&$e(s[0])?s[0]:s}(s),(0,qe.e)((r,n)=>{(0,Ye.J)(t)((0,de.D)([r,...s],o)).subscribe(n)})}var He=i(9525),Re=i(3853),se=i(8660);function Be(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 Ve(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"span",5),e.NdJ("click",function(){const n=e.CHM(t),a=n.item;return n.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 Xe(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 We=function(s){return{count:s}};function Ke(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,We,t.selectedGroupIds.length))," ")}}class F{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)}}F.\u0275fac=function(o){return new(o||F)(e.Y36(d.DoR))},F.\u0275cmp=e.Xpm({type:F,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,Be,2,3,"ng-template",0),e.TgZ(1,"ng-select",1),e.NdJ("ngModelChange",function(n){return t.selectedGroupIds=n}),e.ALo(2,"async"),e.YNc(3,Ve,4,2,"ng-template",2),e.YNc(4,Xe,2,2,"ng-template",3),e.qZA(),e.YNc(5,Ke,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,se.w9,c.JJ,c.On,se.mR,E.Y,se.ir,$.n],pipes:[v.X$,_.Ov],styles:[""],changeDetection:0});var b=i(7346);function ze(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 et(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 tt(s,o){if(1&s&&(e.TgZ(0,"vdr-chip"),e.YNc(1,ze,4,3,"ng-container",0),e.YNc(2,et,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 ot(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,tt,3,2,"vdr-chip",0),e.YNc(1,ot,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,E.Y,y.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 re=i(8276),R=i(9416),ue=i(4652),pe=i(837),st=i(2505),rt=i(2355),nt=i(4664),it=i(2702),at=i(7368);function ct(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(n){e.CHM(t);return e.oxw().note=n}),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 lt(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 _e=function(s){return{strategy:s}};function dt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function mt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,lt,3,3,"ng-container",12),e.YNc(5,dt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-registered")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}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")," "))}function pt(s,o){if(1&s&&(e._uU(0),e.ALo(1,"translate")),2&s){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"customer.history-using-external-auth-strategy",e.VKq(4,_e,t.data.strategy))," ")}}function _t(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,ut,3,3,"ng-container",12),e.YNc(5,pt,2,6,"ng-template",null,13,e.W1O),e.BQk()),2&s){const t=e.MAs(6),r=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.lcZ(3,3,"customer.history-customer-verified")," "),e.xp6(2),e.Q6J("ngIf","native"===r.data.strategy)("ngIfElse",t)}}function gt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail"),e._UZ(5,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$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 ge=function(s){return{groupName:s}};function ht(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-added-to-group",e.VKq(4,ge,t.data.groupName))," ")}}function ft(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"customer.history-customer-removed-from-group",e.VKq(4,ge,t.data.groupName))," ")}}function Ct(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-created")," "),e.xp6(4),e.Oqu(t.data.address)}}function vt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",14)(4,"div",16),e._uU(5),e.qZA(),e.TgZ(6,"vdr-history-entry-detail"),e._UZ(7,"vdr-object-tree",15),e.qZA()(),e.BQk()),2&s){const t=e.oxw().$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 xt(s,o){if(1&s&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"div",16),e._uU(4),e.qZA(),e.BQk()),2&s){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"customer.history-customer-address-deleted")," "),e.xp6(3),e.Oqu(t.data.address)}}function bt(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 yt(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 At(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 Zt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$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 Tt(s,o){if(1&s&&(e.ynx(0),e.TgZ(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.TgZ(4,"vdr-history-entry-detail")(5,"vdr-labeled-data",17),e.ALo(6,"translate"),e._uU(7),e.qZA(),e.TgZ(8,"vdr-labeled-data",17),e.ALo(9,"translate"),e._uU(10),e.qZA()()(),e.BQk()),2&s){const t=e.oxw().$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 Dt(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",14)(2,"div",18),e._uU(3),e.qZA(),e._UZ(4,"div",19),e.TgZ(5,"vdr-dropdown")(6,"button",20),e._UZ(7,"clr-icon",21),e.qZA(),e.TgZ(8,"vdr-dropdown-menu",22)(9,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().updateNote.emit(n)}),e.ALo(10,"hasPermission"),e._UZ(11,"clr-icon",24),e._uU(12),e.ALo(13,"translate"),e.qZA(),e._UZ(14,"div",25),e.TgZ(15,"button",23),e.NdJ("click",function(){e.CHM(t);const n=e.oxw().$implicit;return e.oxw().deleteNote.emit(n)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",26),e._uU(18),e.ALo(19,"translate"),e.qZA()()()(),e.BQk()}if(2&s){const t=e.oxw().$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 Ut(s,o){if(1&s&&(e.TgZ(0,"vdr-timeline-entry",8),e.ynx(1,9),e.YNc(2,mt,7,5,"ng-container",10),e.YNc(3,_t,7,5,"ng-container",10),e.YNc(4,gt,6,4,"ng-container",10),e.YNc(5,ht,3,6,"ng-container",10),e.YNc(6,ft,3,6,"ng-container",10),e.YNc(7,Ct,6,4,"ng-container",10),e.YNc(8,vt,8,5,"ng-container",10),e.YNc(9,xt,5,4,"ng-container",10),e.YNc(10,bt,3,3,"ng-container",10),e.YNc(11,yt,3,3,"ng-container",10),e.YNc(12,At,3,3,"ng-container",10),e.YNc(13,Zt,11,11,"ng-container",10),e.YNc(14,Tt,11,11,"ng-container",10),e.YNc(15,Dt,20,13,"ng-container",10),e.BQk(),e.qZA()),2&s){const t=o.$implicit,r=e.oxw();e.Q6J("displayType",r.getDisplayType(t))("iconShape",r.getTimelineIcon(t))("createdAt",t.createdAt)("name",r.getName(t))("featured",r.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REGISTERED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_DETAIL_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDED_TO_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_REMOVED_FROM_GROUP),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_CREATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_ADDRESS_DELETED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_UPDATED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_PASSWORD_RESET_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_REQUESTED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_EMAIL_UPDATE_VERIFIED),e.xp6(1),e.Q6J("ngSwitchCase",r.type.CUSTOMER_NOTE)}}class O{constructor(){this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.type=d.iYD}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)},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"],[3,"displayType","iconShape","createdAt","name","featured",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,"displayType","iconShape","createdAt","name","featured"],[3,"ngSwitch"],[4,"ngSwitchCase"],[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"]],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,ct,6,5,"vdr-timeline-entry",1),e.YNc(5,Ut,16,20,"vdr-timeline-entry",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:[R.H,rt._,G.y,c.Fj,c.JJ,c.On,_.sg,_.RF,_.n9,_.O5,nt.C,it._,at.W,k.J,Y.U,y.qvL,j.N,H.H],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 Nt=i(2651),Lt=i(6826),St=i(4187);function Ft(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 Ot(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 Jt(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 It(s,o){1&s&&e.YNc(0,Jt,3,4,"button",25),2&s&&e.Q6J("vdrIfPermissions","UpdateCustomer")}function wt(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 Mt=function(){return["customer","customFields"]};function Pt(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,Mt)))}}function Gt(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 Et(s,o){if(1&s&&(e.ynx(0),e.YNc(1,Gt,2,2,"vdr-chip",35),e.BQk()),2&s){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t)}}function Qt(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 qt(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 $t(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,Et,2,1,"ng-container",32),e.YNc(5,Qt,2,3,"ng-template",null,33,e.W1O),e.TgZ(7,"div"),e.YNc(8,qt,4,3,"button",34),e.qZA()()),2&s){const t=o.ngIf,r=e.MAs(6);e.xp6(2),e.Oqu(e.lcZ(3,4,"customer.customer-groups")),e.xp6(2),e.Q6J("ngIf",t.length)("ngIfElse",r),e.xp6(4),e.Q6J("vdrIfPermissions","UpdateCustomerGroup")}}const kt=function(){return["UpdateCustomer"]};function Yt(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"vdr-address-card",45),e.NdJ("setAsDefaultBilling",function(n){return e.CHM(t),e.oxw(2).setDefaultBillingAddressId(n)})("setAsDefaultShipping",function(n){return e.CHM(t),e.oxw(2).setDefaultShippingAddressId(n)})("deleteAddress",function(n){return e.CHM(t),e.oxw(2).toggleDeleteAddress(n)}),e.ALo(1,"async"),e.ALo(2,"hasPermission"),e.qZA()}if(2&s){const t=o.$implicit,r=e.oxw(2);e.ekj("to-delete",r.addressesToDeleteIds.has(t.value.id)),e.Q6J("availableCountries",e.lcZ(1,8,r.availableCountries$))("isDefaultBilling",r.defaultBillingAddressId===t.value.id)("isDefaultShipping",r.defaultShippingAddressId===t.value.id)("addressForm",t)("customFields",r.addressCustomFields)("editable",e.lcZ(2,10,e.DdM(12,kt))&&!r.addressesToDeleteIds.has(t.value.id))}}function jt(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 Ht=function(s){return["/orders/",s]};function Rt(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,Ht,t.id))}}function Bt(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,Yt,3,13,"vdr-address-card",41),e.YNc(6,jt,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(n){return e.CHM(t),e.oxw().setOrderItemsPerPage(n)})("pageChange",function(n){return e.CHM(t),e.oxw().setOrderCurrentPage(n)}),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,Rt,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 Vt(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(n){return e.CHM(t),e.oxw().addNoteToCustomer(n)})("updateNote",function(n){return e.CHM(t),e.oxw().updateNote(n)})("deleteNote",function(n){return e.CHM(t),e.oxw().deleteNote(n)}),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 J extends d.UT_{constructor(o,t,r,n,a,l,u,h){super(o,t,r,l),this.changeDetector=n,this.formBuilder=a,this.dataService=l,this.modalService=u,this.notificationService=h,this.fetchHistory=new V.x,this.addressesToDeleteIds=new Set,this.addressDefaultsUpdated=!1,this.ordersPerPage=10,this.currentOrdersPage=1,this.orderListUpdates$=new V.x,this.customFields=this.getCustomFieldConfig("Customer"),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.detailForm=this.formBuilder.group({customer:this.formBuilder.group({title:"",firstName:["",c.kI.required],lastName:["",c.kI.required],phoneNumber:"",emailAddress:["",[c.kI.required,c.kI.email]],password:"",customFields:this.formBuilder.group(this.customFields.reduce((f,B)=>Object.assign(Object.assign({},f),{[B.name]:""}),{}))}),addresses:new c.Oe([])})}ngOnInit(){this.init(),this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(t=>t.countries.items).pipe((0,Qe.d)(1));const o=this.entity$.pipe(je(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,q.O)(null),(0,g.w)(()=>this.dataService.customer.getCustomerHistory(this.id,{sort:{createdAt:d.Asd.DESC}}).mapStream(t=>{var r;return null===(r=t.customer)||void 0===r?void 0:r.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:["",c.kI.required],streetLine2:"",city:"",province:"",postalCode:"",countryCode:["",c.kI.required],phoneNumber:"",defaultShippingAddress:!1,defaultBillingAddress:!1});if(this.addressCustomFields.length){const r=this.formBuilder.group({});for(const n of this.addressCustomFields)r.addControl(n.name,new c.NI(""));t.addControl("customFields",r)}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 r=t.value,n=null===(o=t.get("customFields"))||void 0===o?void 0:o.value,a={title:r.title,emailAddress:r.emailAddress,firstName:r.firstName,lastName:r.lastName,phoneNumber:r.phoneNumber,customFields:n};this.dataService.customer.createCustomer(a,r.password).subscribe(({createCustomer:l})=>{switch(l.__typename){case"Customer":this.notificationService.success((0,m.J)("common.notify-create-success"),{entity:"Customer"}),l.emailAddress&&!r.password&&this.notificationService.notify({message:(0,m.J)("customer.email-verification-sent"),translationVars:{emailAddress:r.emailAddress},type:"info",duration:1e4}),this.detailForm.markAsPristine(),this.addressDefaultsUpdated=!1,this.changeDetector.markForCheck(),this.router.navigate(["../",l.id],{relativeTo:this.route});break;case"EmailAddressConflictError":this.notificationService.error(l.message)}})}save(){this.entity$.pipe((0,le.q)(1),(0,He.z)(({id:o})=>{var t;const r=[],n=this.detailForm.get("customer");if(n&&n.dirty){const l=n.value,u=null===(t=n.get("customFields"))||void 0===t?void 0:t.value,h={id:o,title:l.title,emailAddress:l.emailAddress,firstName:l.firstName,lastName:l.lastName,phoneNumber:l.phoneNumber,customFields:u};r.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 l of a.controls)if(l.dirty||this.addressDefaultsUpdated){const u=l.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)?r.push(this.dataService.customer.deleteCustomerAddress(u.id).pipe((0,p.U)(f=>f.deleteCustomerAddress))):r.push(this.dataService.customer.updateCustomerAddress(Object.assign(Object.assign({},h),{id:u.id})).pipe((0,p.U)(f=>f.updateCustomerAddress))):r.push(this.dataService.customer.createCustomerAddress(o,h).pipe((0,p.U)(f=>f.createCustomerAddress)))}return(0,Ee.D)(r)})).subscribe(o=>{let t=!1;for(const r of o)switch(r.__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(r.message)}},o=>{this.notificationService.error((0,m.J)("common.notify-update-error"),{entity:"Customer"})})}addToGroup(){this.modalService.fromComponent(F,{size:"md"}).pipe((0,g.w)(o=>o?(0,de.D)(o):x.E),(0,Re.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]):x.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}):x.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):x.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,m.J)("common.notify-delete-success"),{entity:"Note"})})}setFormValues(o){var t;const r=this.detailForm.get("customer");if(r&&r.patchValue({title:o.title,firstName:o.firstName,lastName:o.lastName,phoneNumber:o.phoneNumber,emailAddress:o.emailAddress}),o.addresses){const n=new c.Oe([]);for(const a of o.addresses){const l=a,{customFields:u}=l,h=(0,Pe._T)(l,["customFields"]),f=this.formBuilder.group(Object.assign(Object.assign({},h),{countryCode:a.country.code}));if(n.push(f),a.defaultShippingAddress&&(this.defaultShippingAddressId=a.id),a.defaultBillingAddress&&(this.defaultBillingAddressId=a.id),this.addressCustomFields.length){const B=this.formBuilder.group({});for(const xo of this.addressCustomFields){const ve=xo.name,bo=null===(t=a.customFields)||void 0===t?void 0:t[ve],yo=new c.NI(bo);B.addControl(ve,yo)}f.addControl("customFields",B)}}this.detailForm.setControl("addresses",n)}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}).single$.pipe((0,p.U)(o=>o.customer),(0,te.h)(Ge.notNullOrUndefined)).subscribe(o=>this.orderListUpdates$.next(o))}}function Xt(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 Wt(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 Kt(s,o){if(1&s&&(e.YNc(0,Xt,3,3,"span",6),e.YNc(1,Wt,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 zt(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 eo(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 to(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 oo(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,eo,3,3,"span",6),e.YNc(5,to,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)}}J.\u0275fac=function(o){return new(o||J)(e.Y36(C.gz),e.Y36(C.F0),e.Y36(d.iHG),e.Y36(e.sBO),e.Y36(c.qu),e.Y36(d.DoR),e.Y36(d.Z7U),e.Y36(d.gqp))},J.\u0275cmp=e.Xpm({type:J,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,Ft,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,Ot,3,4,"button",5),e.ALo(12,"async"),e.YNc(13,It,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,wt,3,3,"vdr-form-field",18),e.ALo(37,"async"),e.YNc(38,Pt,5,6,"section",19),e._UZ(39,"vdr-custom-detail-component-host",20),e.qZA(),e.YNc(40,$t,9,6,"div",21),e.ALo(41,"async"),e.YNc(42,Bt,29,31,"div",22),e.ALo(43,"async"),e.YNc(44,Vt,5,6,"div",22),e.ALo(45,"async")),2&o){const r=e.MAs(14);let n,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==(n=e.lcZ(8,27,t.entity$))||null==n.user?null:n.user.lastLogin),e.xp6(4),e.Q6J("ngIf",e.lcZ(12,29,t.isNew$))("ngIfElse",r),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:[b.Kk,b.BN,oe.V,Z,_.O5,b.mz,re.W,R.H,c._Y,c.JL,c.sg,ue.h,G.y,c.Fj,c.JJ,c.u,c.x0,y.MgK,pe.y,st.C,_.sg,E.Y,y.qvL,S,K.Q,z.E,ee.v,O],pipes:[_.Ov,Nt.H,v.X$,Lt.e,U.j,St.k],styles:[".last-login[_ngcontent-%COMP%]{margin-left:6px;color:var(--color-grey-500)}.to-delete[_ngcontent-%COMP%]{opacity:.5}"],changeDetection:0});const so=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,c.kI.required],customFields:this.formBuilder.group(this.customFields.reduce((t,r)=>Object.assign(Object.assign({},t),{[r.name]:""}),{}))}),this.customFields.length){const t=this.form.get("customFields");for(const r of this.customFields){const n=r.name,a=null===(o=this.group.customFields)||void 0===o?void 0:o[n],l=t.get(n);l&&l.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(c.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,Kt,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,zt,5,5,"section",4),e.qZA(),e.YNc(7,oo,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,so))),e.xp6(2),e.Q6J("ngIf",t.customFields.length))},directives:[Q.q,_.O5,c._Y,c.JL,c.sg,ue.h,G.y,c.Fj,c.JJ,c.u,c.x0,y.MgK,pe.y,$.n],pipes:[v.X$,U.j],styles:[""],changeDetection:0});var he=i(745),ro=i(73),no=i(5181);function io(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().create()}),e._UZ(1,"clr-icon",9),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 ao=function(s){return{contents:s}},co=function(s){return["./",s]};function lo(s,o){if(1&s){const t=e.EpF();e.TgZ(0,"tr"),e.ALo(1,"async"),e.TgZ(2,"td",12),e._UZ(3,"vdr-entity-info",13),e.qZA(),e.TgZ(4,"td",12)(5,"vdr-chip",14),e._uU(6),e.qZA()(),e.TgZ(7,"td",15)(8,"a",16),e._UZ(9,"clr-icon",17),e._uU(10),e.ALo(11,"translate"),e.qZA()(),e.TgZ(12,"td",18)(13,"button",19),e.NdJ("click",function(){const a=e.CHM(t).$implicit;return e.oxw(2).update(a)}),e._UZ(14,"clr-icon",20),e._uU(15),e.ALo(16,"translate"),e.qZA()(),e.TgZ(17,"td",18)(18,"vdr-dropdown")(19,"button",21),e._uU(20),e.ALo(21,"translate"),e._UZ(22,"clr-icon",22),e.qZA(),e.TgZ(23,"vdr-dropdown-menu",23)(24,"button",24),e.NdJ("click",function(){const a=e.CHM(t).$implicit;return e.oxw(2).delete(a.id)}),e.ALo(25,"hasPermission"),e._UZ(26,"clr-icon",25),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&s){const t=o.$implicit,r=e.oxw(2);let n;e.ekj("active",t.id===(null==(n=e.lcZ(1,11,r.activeGroup$))?null:n.id)),e.xp6(3),e.Q6J("entity",t),e.xp6(2),e.Q6J("colorFrom",t.id),e.xp6(1),e.Oqu(t.name),e.xp6(2),e.Q6J("routerLink",e.VKq(25,co,e.VKq(23,ao,t.id))),e.xp6(2),e.hij(" ",e.lcZ(11,13,"customer.view-group-members")," "),e.xp6(5),e.hij(" ",e.lcZ(16,15,"common.edit")," "),e.xp6(5),e.hij(" ",e.lcZ(21,17,"common.actions")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(25,19,"DeleteCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(28,21,"common.delete")," ")}}function mo(s,o){if(1&s&&(e.TgZ(0,"table",10),e.ALo(1,"async"),e.TgZ(2,"tbody"),e.YNc(3,lo,29,27,"tr",11),e.ALo(4,"async"),e.qZA()()),2&s){const t=e.oxw();e.ekj("expanded",e.lcZ(1,3,t.activeGroup$)),e.xp6(3),e.Q6J("ngForOf",e.lcZ(4,5,t.groups$))}}function uo(s,o){1&s&&e._UZ(0,"vdr-empty-placeholder")}const po=function(s){return{groupName:s}};function _o(s,o){if(1&s){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",26)(2,"div",27),e._uU(3),e.ALo(4,"async"),e.qZA(),e._UZ(5,"div",28),e.TgZ(6,"button",29),e.NdJ("click",function(){return e.CHM(t),e.oxw().closeMembers()}),e._UZ(7,"clr-icon",30),e.qZA()(),e.TgZ(8,"div",31)(9,"vdr-dropdown")(10,"button",32),e._uU(11),e.ALo(12,"translate"),e._UZ(13,"clr-icon",22),e.qZA(),e.TgZ(14,"vdr-dropdown-menu",23)(15,"button",33),e.NdJ("click",function(){const a=e.CHM(t).ngIf,l=e.oxw();return l.removeFromGroup(a,l.selectedCustomerIds)}),e.ALo(16,"hasPermission"),e._UZ(17,"clr-icon",25),e._uU(18),e.ALo(19,"translate"),e.qZA()()(),e.TgZ(20,"button",34),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",35),e.NdJ("selectionChange",function(n){e.CHM(t);return e.oxw().selectedCustomerIds=n})("fetchParamsChange",function(n){return e.CHM(t),e.oxw().fetchGroupMembers$.next(n)}),e.ALo(24,"async"),e.ALo(25,"async"),e.qZA(),e.BQk()}if(2&s){const t=o.ngIf,r=e.oxw();e.xp6(3),e.AsE("",t.name," (",e.lcZ(4,11,r.membersTotal$),")"),e.xp6(7),e.Q6J("disabled",0===r.selectedCustomerIds.length),e.xp6(1),e.hij(" ",e.lcZ(12,13,"common.with-selected")," "),e.xp6(4),e.Q6J("disabled",!e.lcZ(16,15,"UpdateCustomerGroup")),e.xp6(3),e.hij(" ",e.lcZ(19,17,"customer.remove-from-group")," "),e.xp6(3),e.hij(" ",e.xi3(22,19,"customer.add-customers-to-group",e.VKq(26,po,t.name))," "),e.xp6(2),e.Q6J("members",e.lcZ(24,22,r.members$))("route",r.route)("totalItems",e.lcZ(25,24,r.membersTotal$))("selectedMemberIds",r.selectedCustomerIds)}}class I{constructor(o,t,r,n,a){this.dataService=o,this.notificationService=t,this.modalService=r,this.route=n,this.router=a,this.selectedCustomerIds=[],this.fetchGroupMembers$=new P.X({skip:0,take:0,filterTerm:""}),this.refreshActiveGroupMembers$=new P.X(void 0)}ngOnInit(){this.groups$=this.dataService.customer.getCustomerGroupList().mapStream(r=>r.customerGroups.items);const o=this.route.paramMap.pipe((0,p.U)(r=>r.get("contents")),(0,W.x)(),(0,ae.b)(()=>this.selectedCustomerIds=[]));this.listIsEmpty$=this.groups$.pipe((0,p.U)(r=>0===r.length)),this.activeGroup$=(0,X.a)(this.groups$,o).pipe((0,p.U)(([r,n])=>{if(n)return r.find(a=>a.id===n)}));const t=(0,X.a)(this.activeGroup$,this.fetchGroupMembers$,this.refreshActiveGroupMembers$).pipe((0,g.w)(([r,{skip:n,take:a,filterTerm:l}])=>r?this.dataService.customer.getCustomerGroupWithCustomers(r.id,{skip:n,take:a,filter:{emailAddress:{contains:l}}}).mapStream(u=>{var h;return null===(h=u.customerGroup)||void 0===h?void 0:h.customers}):(0,he.of)(void 0)));this.members$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.items)&&void 0!==n?n:[]})),this.membersTotal$=t.pipe((0,p.U)(r=>{var n;return null!==(n=null==r?void 0:r.totalItems)&&void 0!==n?n: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:[]})):x.E),(0,g.w)(()=>this.dataService.customer.getCustomerGroupList().single$)).subscribe(()=>{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):x.E),(0,g.w)(t=>t.deleteCustomerGroup.result===d.PcR.DELETED?this.dataService.customer.getCustomerGroupList().mapSingle(()=>({errorMessage:!1})):(0,he.of)({errorMessage:t.deleteCustomerGroup.message}))).subscribe(t=>{"string"==typeof t.errorMessage?this.notificationService.error(t.errorMessage):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)):x.E)).subscribe(()=>{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(N,{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,ro.h)(t)):x.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=[]}})}}I.\u0275fac=function(o){return new(o||I)(e.Y36(d.DoR),e.Y36(d.gqp),e.Y36(d.Z7U),e.Y36(C.gz),e.Y36(C.F0))},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-customer-group-list"]],decls:15,vars:12,consts:[["locationId","customer-group-list"],["class","btn btn-primary",3,"click",4,"vdrIfPermissions"],[1,"group-wrapper"],[1,"group-list"],["class","table mt0",3,"expanded",4,"ngIf","ngIfElse"],["emptyPlaceholder",""],[1,"group-members"],[4,"ngIf"],[1,"btn","btn-primary",3,"click"],["shape","plus"],[1,"table","mt0"],[3,"active",4,"ngFor","ngForOf"],[1,"left","align-middle"],[3,"entity"],[3,"colorFrom"],[1,"text-right","align-middle"],["queryParamsHandling","preserve",1,"btn","btn-link","btn-sm",3,"routerLink"],["shape","view-list"],[1,"align-middle"],[1,"btn","btn-link","btn-sm",3,"click"],["shape","edit"],["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){if(1&o&&(e.TgZ(0,"vdr-action-bar"),e._UZ(1,"vdr-ab-left"),e.TgZ(2,"vdr-ab-right"),e._UZ(3,"vdr-action-bar-items",0),e.YNc(4,io,4,3,"button",1),e.qZA()(),e.TgZ(5,"div",2)(6,"div",3),e.YNc(7,mo,5,7,"table",4),e.ALo(8,"async"),e.qZA(),e.YNc(9,uo,1,0,"ng-template",null,5,e.W1O),e.TgZ(11,"div",6),e.ALo(12,"async"),e.YNc(13,_o,26,28,"ng-container",7),e.ALo(14,"async"),e.qZA()()),2&o){const r=e.MAs(10);e.xp6(4),e.Q6J("vdrIfPermissions","CreateCustomerGroup"),e.xp6(3),e.Q6J("ngIf",!e.lcZ(8,6,t.listIsEmpty$))("ngIfElse",r),e.xp6(4),e.ekj("expanded",e.lcZ(12,8,t.activeGroup$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(14,10,t.activeGroup$))}},directives:[b.Kk,b.BN,b.mz,re.W,R.H,y.qvL,_.O5,_.sg,oe.V,E.Y,C.yS,k.J,Y.U,j.N,H.H,no.j,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%] tr.active[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}.group-wrapper[_ngcontent-%COMP%] .group-list.expanded[_ngcontent-%COMP%]{width:calc(100% - 40vw)}.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 go=i(8165);const ho=function(){return["./create"]};function fo(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,ho)),e.xp6(2),e.hij(" ",e.lcZ(3,2,"customer.create-new-customer")," "))}const Co=function(s){return["./",s]};function vo(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,Co,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 w extends d.t7C{constructor(o,t,r,n,a){super(t,r),this.dataService=o,this.modalService=n,this.notificationService=a,this.searchTerm=new c.NI(""),super.setQueryFn((...l)=>this.dataService.customer.getCustomerList(...l).refetchOnChannelChange(),l=>l.customers,(l,u)=>({options:{skip:l,take:u,filter:{emailAddress:{contains:this.searchTerm.value},lastName:{contains:this.searchTerm.value},postalCode:{contains:this.searchTerm.value}},filterOperator:d.FnJ.OR,sort:{createdAt:go.As.DESC}}}))}ngOnInit(){super.ngOnInit(),this.searchTerm.valueChanges.pipe((0,te.h)(o=>2<o.length||0===o.length),(0,ie.b)(250),(0,ce.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):x.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"})})}}w.\u0275fac=function(o){return new(o||w)(e.Y36(d.DoR),e.Y36(C.F0),e.Y36(C.gz),e.Y36(d.Z7U),e.Y36(d.gqp))},w.\u0275cmp=e.Xpm({type:w,selectors:[["vdr-customer-list"]],features:[e.qOj],decls:24,vars:28,consts:[["type","text","name","emailSearchTerm",1,"search-input","ml3",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,fo,4,5,"a",2),e.qZA()(),e.TgZ(7,"vdr-data-table",3),e.NdJ("pageChange",function(n){return t.setPageNumber(n)})("itemsPerPageChange",function(n){return t.setItemsPerPage(n)}),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,vo,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:[b.Kk,b.BN,G.y,c.Fj,c.JJ,c.oH,b.mz,re.W,R.H,C.yS,y.qvL,K.Q,z.E,Z,ee.v,k.J,Y.U,j.N,H.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},r=>t.customer.getCustomer(r).mapStream(n=>n.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 fe=[{path:"customers",component:w,pathMatch:"",data:{breadcrumb:(0,m.J)("breadcrumb.customers")}},{path:"customers/:id",component:J,resolve:(0,d.Po4)(D),canDeactivate:[d.TSp],data:{breadcrumb:Ce}},{path:"groups",component:I,data:{breadcrumb:(0,m.J)("breadcrumb.customer-groups")}}];function Ce(s,o){return(0,d.YWC)({entity:s.entity,id:o.id,breadcrumbKey:"breadcrumb.customers",getName:t=>`${t.firstName} ${t.lastName}`,route:"customers"})}class M{}M.\u0275fac=function(o){return new(o||M)},M.\u0275mod=e.oAB({type:M}),M.\u0275inj=e.cJS({imports:[[d.m81,C.Bz.forChild(fe)]]})}}]);
2
- //# sourceMappingURL=600.8f0165a8d1255cd0.js.map