@acorex/modules 18.1.3 → 18.1.5

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 (111) hide show
  1. package/backend/lib/data/api/comment.mock.service.d.ts +62 -0
  2. package/backend/lib/data/api/notification.mock.service.d.ts +34 -0
  3. package/backend/lib/data/index.d.ts +1 -0
  4. package/esm2022/application-management/lib/application-management.service.mjs +3 -3
  5. package/esm2022/application-management/lib/module-designer/module-designer.component.mjs +1 -1
  6. package/esm2022/auth/lib/account/profile/profile-slot.component.mjs +3 -3
  7. package/esm2022/backend/lib/backend.module.mjs +11 -1
  8. package/esm2022/backend/lib/data/api/comment.mock.service.mjs +142 -0
  9. package/esm2022/backend/lib/data/api/notification.mock.service.mjs +71 -0
  10. package/esm2022/backend/lib/data/index.mjs +2 -1
  11. package/esm2022/form-management/lib/form-management.module.mjs +5 -4
  12. package/esm2022/language-management/acorex-modules-language-management.mjs +5 -0
  13. package/esm2022/language-management/index.mjs +2 -0
  14. package/esm2022/language-management/lib/entities/language.entity.mjs +242 -0
  15. package/esm2022/language-management/lib/language-management.module.mjs +39 -0
  16. package/esm2022/language-management/lib/notification-management.service.mjs +23 -0
  17. package/esm2022/notification-management/acorex-modules-notification-management.mjs +5 -0
  18. package/esm2022/notification-management/index.mjs +7 -0
  19. package/esm2022/notification-management/lib/admin-notification-slot/admin-notification-item/admin-notification-item.component.mjs +47 -0
  20. package/esm2022/notification-management/lib/admin-notification-slot/admin-notification-panel/admin-notification-panel.component.mjs +131 -0
  21. package/esm2022/notification-management/lib/admin-notification-slot/admin-notification-slot/admin-notification-slot.component.mjs +36 -0
  22. package/esm2022/notification-management/lib/entities/notification-channel.entity.mjs +345 -0
  23. package/esm2022/notification-management/lib/entities/notification-template.entity.mjs +298 -0
  24. package/esm2022/notification-management/lib/entities/notification.entity.mjs +207 -0
  25. package/esm2022/notification-management/lib/notification-management-mock-data.mjs +55 -0
  26. package/esm2022/notification-management/lib/notification-management.module.mjs +66 -0
  27. package/esm2022/notification-management/lib/notification-management.service.mjs +39 -0
  28. package/esm2022/notification-management/lib/notification-management.type.mjs +2 -0
  29. package/esm2022/notification-management/lib/notification.service.mjs +3 -0
  30. package/esm2022/template-management/acorex-modules-template-management.mjs +5 -0
  31. package/esm2022/template-management/index.mjs +4 -0
  32. package/esm2022/template-management/lib/entities/global-template.entity.mjs +298 -0
  33. package/esm2022/template-management/lib/entities/template-variable.entity.mjs +304 -0
  34. package/esm2022/template-management/lib/template-management-mock-data.mjs +11 -0
  35. package/esm2022/template-management/lib/template-management.module.mjs +45 -0
  36. package/esm2022/template-management/lib/template-management.service.mjs +24 -0
  37. package/fesm2022/{acorex-modules-application-management-module-designer.component-C-lY0Apl.mjs → acorex-modules-application-management-module-designer.component-CFLXuP2G.mjs} +2 -2
  38. package/fesm2022/{acorex-modules-application-management-module-designer.component-C-lY0Apl.mjs.map → acorex-modules-application-management-module-designer.component-CFLXuP2G.mjs.map} +1 -1
  39. package/fesm2022/acorex-modules-application-management.mjs +3 -3
  40. package/fesm2022/acorex-modules-application-management.mjs.map +1 -1
  41. package/fesm2022/{acorex-modules-auth-acorex-modules-auth-4OzzidjS.mjs → acorex-modules-auth-acorex-modules-auth-iGiPFEeb.mjs} +10 -10
  42. package/fesm2022/acorex-modules-auth-acorex-modules-auth-iGiPFEeb.mjs.map +1 -0
  43. package/fesm2022/{acorex-modules-auth-app-chooser.component-CHTEeWgx.mjs → acorex-modules-auth-app-chooser.component-BB3SIzCP.mjs} +2 -2
  44. package/fesm2022/{acorex-modules-auth-app-chooser.component-CHTEeWgx.mjs.map → acorex-modules-auth-app-chooser.component-BB3SIzCP.mjs.map} +1 -1
  45. package/fesm2022/acorex-modules-auth-blank.layout-Bq822Iz4.mjs.map +1 -1
  46. package/fesm2022/{acorex-modules-auth-login.module-DMit4yw0.mjs → acorex-modules-auth-login.module-ChEv9c5I.mjs} +4 -4
  47. package/fesm2022/acorex-modules-auth-login.module-ChEv9c5I.mjs.map +1 -0
  48. package/fesm2022/{acorex-modules-auth-master.layout-BCYIjTB0.mjs → acorex-modules-auth-master.layout-CZv3BD5c.mjs} +2 -2
  49. package/fesm2022/{acorex-modules-auth-master.layout-BCYIjTB0.mjs.map → acorex-modules-auth-master.layout-CZv3BD5c.mjs.map} +1 -1
  50. package/fesm2022/{acorex-modules-auth-password.component-WA-CA0Ln.mjs → acorex-modules-auth-password.component-CPWiBXdG.mjs} +2 -2
  51. package/fesm2022/{acorex-modules-auth-password.component-WA-CA0Ln.mjs.map → acorex-modules-auth-password.component-CPWiBXdG.mjs.map} +1 -1
  52. package/fesm2022/{acorex-modules-auth-password.component-D16ms36y.mjs → acorex-modules-auth-password.component-CxZ1weks.mjs} +2 -2
  53. package/fesm2022/{acorex-modules-auth-password.component-D16ms36y.mjs.map → acorex-modules-auth-password.component-CxZ1weks.mjs.map} +1 -1
  54. package/fesm2022/{acorex-modules-auth-routes-C3ye31RS.mjs → acorex-modules-auth-routes-C7r2Jm6s.mjs} +2 -2
  55. package/fesm2022/{acorex-modules-auth-routes-C3ye31RS.mjs.map → acorex-modules-auth-routes-C7r2Jm6s.mjs.map} +1 -1
  56. package/fesm2022/acorex-modules-auth-tenant-chooser.component-CHr5_kh7.mjs.map +1 -1
  57. package/fesm2022/acorex-modules-auth-two-factor-code.component-B_7l39pX.mjs.map +1 -1
  58. package/fesm2022/{acorex-modules-auth-two-factor.module-CkZCBo0B.mjs → acorex-modules-auth-two-factor.module-BgkJYe7T.mjs} +2 -2
  59. package/fesm2022/acorex-modules-auth-two-factor.module-BgkJYe7T.mjs.map +1 -0
  60. package/fesm2022/acorex-modules-auth.mjs +1 -1
  61. package/fesm2022/acorex-modules-backend.mjs +218 -2
  62. package/fesm2022/acorex-modules-backend.mjs.map +1 -1
  63. package/fesm2022/acorex-modules-form-management-designer.page-SoPH2V7i.mjs.map +1 -1
  64. package/fesm2022/acorex-modules-form-management.mjs +4 -3
  65. package/fesm2022/acorex-modules-form-management.mjs.map +1 -1
  66. package/fesm2022/acorex-modules-language-management-language.entity-CwD5FHGc.mjs +266 -0
  67. package/fesm2022/acorex-modules-language-management-language.entity-CwD5FHGc.mjs.map +1 -0
  68. package/fesm2022/acorex-modules-language-management.mjs +46 -0
  69. package/fesm2022/acorex-modules-language-management.mjs.map +1 -0
  70. package/fesm2022/acorex-modules-notification-management.mjs +1203 -0
  71. package/fesm2022/acorex-modules-notification-management.mjs.map +1 -0
  72. package/fesm2022/acorex-modules-template-management.mjs +690 -0
  73. package/fesm2022/acorex-modules-template-management.mjs.map +1 -0
  74. package/form-management/lib/form-management.module.d.ts +2 -1
  75. package/language-management/README.md +3 -0
  76. package/language-management/index.d.ts +1 -0
  77. package/language-management/lib/entities/language.entity.d.ts +3 -0
  78. package/language-management/lib/language-management.module.d.ts +12 -0
  79. package/language-management/lib/notification-management.service.d.ts +9 -0
  80. package/notification-management/README.md +3 -0
  81. package/notification-management/index.d.ts +6 -0
  82. package/notification-management/lib/admin-notification-slot/admin-notification-item/admin-notification-item.component.d.ts +14 -0
  83. package/notification-management/lib/admin-notification-slot/admin-notification-panel/admin-notification-panel.component.d.ts +30 -0
  84. package/notification-management/lib/admin-notification-slot/admin-notification-slot/admin-notification-slot.component.d.ts +7 -0
  85. package/notification-management/lib/entities/notification-channel.entity.d.ts +3 -0
  86. package/notification-management/lib/entities/notification-template.entity.d.ts +3 -0
  87. package/notification-management/lib/entities/notification.entity.d.ts +3 -0
  88. package/notification-management/lib/notification-management-mock-data.d.ts +41 -0
  89. package/notification-management/lib/notification-management.module.d.ts +13 -0
  90. package/notification-management/lib/notification-management.service.d.ts +15 -0
  91. package/notification-management/lib/notification-management.type.d.ts +42 -0
  92. package/notification-management/lib/notification.service.d.ts +7 -0
  93. package/package.json +23 -11
  94. package/template-management/README.md +3 -0
  95. package/template-management/index.d.ts +3 -0
  96. package/template-management/lib/entities/global-template.entity.d.ts +3 -0
  97. package/template-management/lib/entities/template-variable.entity.d.ts +3 -0
  98. package/template-management/lib/template-management-mock-data.d.ts +7 -0
  99. package/template-management/lib/template-management.module.d.ts +12 -0
  100. package/template-management/lib/template-management.service.d.ts +9 -0
  101. package/esm2022/notification/acorex-modules-notification.mjs +0 -5
  102. package/esm2022/notification/index.mjs +0 -4
  103. package/esm2022/notification/lib/notification.module.mjs +0 -16
  104. package/fesm2022/acorex-modules-auth-acorex-modules-auth-4OzzidjS.mjs.map +0 -1
  105. package/fesm2022/acorex-modules-auth-login.module-DMit4yw0.mjs.map +0 -1
  106. package/fesm2022/acorex-modules-auth-two-factor.module-CkZCBo0B.mjs.map +0 -1
  107. package/fesm2022/acorex-modules-notification.mjs +0 -26
  108. package/fesm2022/acorex-modules-notification.mjs.map +0 -1
  109. package/notification/README.md +0 -4
  110. package/notification/index.d.ts +0 -1
  111. package/notification/lib/notification.module.d.ts +0 -6
@@ -0,0 +1,1203 @@
1
+ import * as i1$2 from '@acorex/platform/common';
2
+ import { AXPComponentSlotModule, AXPDataGenerator, AXPEntityStorageService, AXPEntityDataProviderImpl, AXPEntityQueryType, AXPEntityCommandScope } from '@acorex/platform/common';
3
+ import { AXPEntityDefinitionRegistryService } from '@acorex/platform/layout/entity';
4
+ import * as i0 from '@angular/core';
5
+ import { input, output, inject, computed, Component, ChangeDetectionStrategy, signal, effect, Injector, NgModule, Optional, Inject, Injectable } from '@angular/core';
6
+ import * as i4$1 from '@acorex/components/badge';
7
+ import { AXBadgeModule } from '@acorex/components/badge';
8
+ import * as i1$1 from '@acorex/components/button';
9
+ import { AXButtonModule } from '@acorex/components/button';
10
+ import * as i3 from '@acorex/components/decorators';
11
+ import { AXDecoratorModule } from '@acorex/components/decorators';
12
+ import * as i4$2 from '@acorex/components/popover';
13
+ import { AXPopoverModule } from '@acorex/components/popover';
14
+ import * as i1 from '@angular/common';
15
+ import { CommonModule } from '@angular/common';
16
+ import * as i4 from '@acorex/components/avatar';
17
+ import { AXAvatarModule } from '@acorex/components/avatar';
18
+ import * as i5 from '@acorex/components/image';
19
+ import { AXImageModule } from '@acorex/components/image';
20
+ import * as i6 from '@acorex/core/format';
21
+ import { AXFormatModule } from '@acorex/core/format';
22
+ import { AXPSessionService } from '@acorex/platform/auth';
23
+ import { Router } from '@angular/router';
24
+ import * as i2 from '@acorex/components/tabs';
25
+ import { AXTabsModule } from '@acorex/components/tabs';
26
+ import { AXToastService } from '@acorex/components/toast';
27
+ import { applySortArray, applyFilterArray } from '@acorex/platform/core';
28
+ import { AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
29
+
30
+ class AXMAdminNotificationItemComponent {
31
+ constructor() {
32
+ this.data = input.required();
33
+ this.onPressNotificationItem = output();
34
+ this.router = inject(Router);
35
+ this.sessionStorage = inject(AXPSessionService);
36
+ this.differentTime = computed(() => Date.now() - this.data().createAt.getTime());
37
+ }
38
+ pressNotificationItem(id) {
39
+ this.onPressNotificationItem.emit(id);
40
+ //const [module, entity] = this.data().RelativeType?.split('.') as [string, string];
41
+ //const url = `${this.sessionStorage.application?.name}/m/${module}/e/${entity}/${this.data().RelativeId}`;
42
+ //console.log(url);
43
+ }
44
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
45
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXMAdminNotificationItemComponent, isStandalone: true, selector: "axp-master-notification-item", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { onPressNotificationItem: "onPressNotificationItem" }, ngImport: i0, template: "<div\n class=\"notification-item\"\n [id]=\"data().id\"\n (click)=\"pressNotificationItem(data().id)\"\n [class]=\"[data().template.prority, data().readAt ? 'read' : 'unread']\"\n>\n <ax-avatar look=\"rounded\" color=\"primary\">\n @if(data().user.image){\n <ax-image src=\"https://i.pravatar.cc/300\"></ax-image>\n }@else {\n <ax-icon>\n <i class=\"fa-solid fa-lock\"></i>\n </ax-icon>\n }\n </ax-avatar>\n <div>\n <div class=\"notification-item-title\">{{ data().title }}</div>\n <div class=\"notification-item-body\">{{ data().body }}</div>\n @if(true){\n <div>\n <div class=\"notification-file\">\n <ax-avatar color=\"primary\">\n <ax-icon>\n <i class=\"fa-solid fa-file-word ax-text-2xl\"></i>\n </ax-icon>\n </ax-avatar>\n <div>\n <div class=\"notification-file-name\">New project details.docx</div>\n <div class=\"notification-file-size\">250 KB</div>\n </div>\n <ax-button look=\"blank\">\n <ax-icon>\n <i class=\"fa-solid fa-download\"></i>\n </ax-icon>\n </ax-button>\n </div>\n </div>\n }\n <div class=\"notification-item-time\">{{ differentTime() | format : 'timeleft' | async }}</div>\n </div>\n @if(!data().template.isPinned){\n <div class=\"pin-notification\">\n <ax-icon>\n <i class=\"fa-solid fa-thumbtack\"></i>\n </ax-icon>\n </div>\n }\n</div>\n", styles: [".notification-item{position:relative;display:flex;cursor:pointer;gap:.75rem;overflow-x:hidden;padding:1rem}.notification-item.read{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.notification-item.unread{background:rgb(var(--ax-color-on-surface))}.notification-item:hover{background:rgba(var(--ax-color-primary-400),.1)}.notification-item.Notice:before,.notification-item.Danger:before,.notification-item.Warning:before{content:\"\";position:absolute;height:95%;width:.2rem;inset-inline-start:0;top:50%;transform:translateY(-50%)}.notification-item.Notice:before{background:rgb(var(--ax-color-success-500))}.notification-item.Danger:before{background:rgb(var(--ax-color-danger-500))}.notification-item.Warning:before{background:rgb(var(--ax-color-warning-500))}.notification-item ax-avatar ax-badge{position:absolute;bottom:0;inset-inline-end:.25rem;top:auto;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-color-surface),var(--tw-border-opacity))}.notification-item>div{display:flex;flex:1 1 0%;flex-direction:column}.notification-item>div .notification-item-title,.notification-item>div .notification-file-name{max-width:20rem;font-size:1rem;font-weight:600;line-height:1.5rem}.notification-item>div .notification-item-time,.notification-item>div .notification-file-size{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgba(var(--ax-color-neutral-400),var(--tw-text-opacity))}.notification-item>div .notification-item-body{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;max-width:20rem;font-size:.875rem;font-weight:400;line-height:1.5rem}.notification-item>ax-badge{position:absolute;top:1rem;inset-inline-end:1rem}.notification-item .notification-file{margin-top:.5rem;margin-bottom:.5rem;display:flex;gap:.5rem;border-radius:.5rem;border-width:1px;--tw-bg-opacity: 1;background-color:rgba(var(--ax-color-surface),var(--tw-bg-opacity));padding:.5rem}.notification-item .notification-file>div{flex:1 1 0%}.notification-item .pin-notification{position:absolute;top:0;right:0;--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding:1rem;--tw-text-opacity: 1;color:rgba(var(--ax-color-neutral-400),var(--tw-text-opacity))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "ngmodule", type: AXAvatarModule }, { kind: "component", type: i4.AXAvatarComponent, selector: "ax-avatar", inputs: ["color", "size", "look"], outputs: ["sizeChange"] }, { kind: "ngmodule", type: AXImageModule }, { kind: "component", type: i5.AXImageComponent, selector: "ax-image", inputs: ["overlayMode", "src", "alt", "priority", "lazy"], outputs: ["onLoad", "onError"] }, { kind: "ngmodule", type: AXBadgeModule }, { kind: "ngmodule", type: AXFormatModule }, { kind: "pipe", type: i6.AXFormatPipe, name: "format" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationItemComponent, decorators: [{
48
+ type: Component,
49
+ args: [{ selector: 'axp-master-notification-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
50
+ CommonModule,
51
+ AXButtonModule,
52
+ AXDecoratorModule,
53
+ AXAvatarModule,
54
+ AXImageModule,
55
+ AXBadgeModule,
56
+ AXFormatModule,
57
+ ], template: "<div\n class=\"notification-item\"\n [id]=\"data().id\"\n (click)=\"pressNotificationItem(data().id)\"\n [class]=\"[data().template.prority, data().readAt ? 'read' : 'unread']\"\n>\n <ax-avatar look=\"rounded\" color=\"primary\">\n @if(data().user.image){\n <ax-image src=\"https://i.pravatar.cc/300\"></ax-image>\n }@else {\n <ax-icon>\n <i class=\"fa-solid fa-lock\"></i>\n </ax-icon>\n }\n </ax-avatar>\n <div>\n <div class=\"notification-item-title\">{{ data().title }}</div>\n <div class=\"notification-item-body\">{{ data().body }}</div>\n @if(true){\n <div>\n <div class=\"notification-file\">\n <ax-avatar color=\"primary\">\n <ax-icon>\n <i class=\"fa-solid fa-file-word ax-text-2xl\"></i>\n </ax-icon>\n </ax-avatar>\n <div>\n <div class=\"notification-file-name\">New project details.docx</div>\n <div class=\"notification-file-size\">250 KB</div>\n </div>\n <ax-button look=\"blank\">\n <ax-icon>\n <i class=\"fa-solid fa-download\"></i>\n </ax-icon>\n </ax-button>\n </div>\n </div>\n }\n <div class=\"notification-item-time\">{{ differentTime() | format : 'timeleft' | async }}</div>\n </div>\n @if(!data().template.isPinned){\n <div class=\"pin-notification\">\n <ax-icon>\n <i class=\"fa-solid fa-thumbtack\"></i>\n </ax-icon>\n </div>\n }\n</div>\n", styles: [".notification-item{position:relative;display:flex;cursor:pointer;gap:.75rem;overflow-x:hidden;padding:1rem}.notification-item.read{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.notification-item.unread{background:rgb(var(--ax-color-on-surface))}.notification-item:hover{background:rgba(var(--ax-color-primary-400),.1)}.notification-item.Notice:before,.notification-item.Danger:before,.notification-item.Warning:before{content:\"\";position:absolute;height:95%;width:.2rem;inset-inline-start:0;top:50%;transform:translateY(-50%)}.notification-item.Notice:before{background:rgb(var(--ax-color-success-500))}.notification-item.Danger:before{background:rgb(var(--ax-color-danger-500))}.notification-item.Warning:before{background:rgb(var(--ax-color-warning-500))}.notification-item ax-avatar ax-badge{position:absolute;bottom:0;inset-inline-end:.25rem;top:auto;border-width:1px;--tw-border-opacity: 1;border-color:rgba(var(--ax-color-surface),var(--tw-border-opacity))}.notification-item>div{display:flex;flex:1 1 0%;flex-direction:column}.notification-item>div .notification-item-title,.notification-item>div .notification-file-name{max-width:20rem;font-size:1rem;font-weight:600;line-height:1.5rem}.notification-item>div .notification-item-time,.notification-item>div .notification-file-size{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgba(var(--ax-color-neutral-400),var(--tw-text-opacity))}.notification-item>div .notification-item-body{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;max-width:20rem;font-size:.875rem;font-weight:400;line-height:1.5rem}.notification-item>ax-badge{position:absolute;top:1rem;inset-inline-end:1rem}.notification-item .notification-file{margin-top:.5rem;margin-bottom:.5rem;display:flex;gap:.5rem;border-radius:.5rem;border-width:1px;--tw-bg-opacity: 1;background-color:rgba(var(--ax-color-surface),var(--tw-bg-opacity));padding:.5rem}.notification-item .notification-file>div{flex:1 1 0%}.notification-item .pin-notification{position:absolute;top:0;right:0;--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));padding:1rem;--tw-text-opacity: 1;color:rgba(var(--ax-color-neutral-400),var(--tw-text-opacity))}\n"] }]
58
+ }] });
59
+
60
+ class AXMNotificationService {
61
+ }
62
+
63
+ class AXMAdminNotificationPanelComponent {
64
+ constructor() {
65
+ this.onNewNotfication = output();
66
+ this.notificationService = inject(AXMNotificationService);
67
+ this.toastService = inject(AXToastService);
68
+ this.notifications = signal(undefined);
69
+ this.totalNotifications = signal(undefined);
70
+ this.tabItems = computed(() => this.getTabItems(this.notifications()), {
71
+ equal: (a, b) => JSON.stringify(a) === JSON.stringify(b),
72
+ });
73
+ this.activeTab = signal('All');
74
+ this.NewNotification = computed(() => this.getNewNotification(this.tabItems()));
75
+ this.NewNotificationEffect = effect(() => this.onNewNotfication.emit(this.NewNotification()));
76
+ this.onPressNotificationItem = (id) => {
77
+ this.notifications.update((old) => old?.map((item) => (item.id === id && !item.readAt ? { ...item, readAt: new Date() } : item)));
78
+ };
79
+ }
80
+ changeActiveTab(tab) {
81
+ this.activeTab.set(tab);
82
+ }
83
+ ngOnInit() {
84
+ this.loadNotification();
85
+ }
86
+ async loadNotification() {
87
+ try {
88
+ const response = await this.notificationService.getList();
89
+ this.totalNotifications.set(response.total);
90
+ const orderedResponse = response.items.sort((a, b) => {
91
+ if (a.template.isPinned === b.template.isPinned) {
92
+ return new Date(a.createAt).getTime() - new Date(b.createAt).getTime();
93
+ }
94
+ return a.template.isPinned ? 1 : -1;
95
+ });
96
+ this.notifications.set(orderedResponse);
97
+ }
98
+ catch (error) {
99
+ this.toastService.show({
100
+ content: typeof error === 'string' ? error : 'Failed to load notifications!',
101
+ color: 'danger',
102
+ location: 'bottom-center',
103
+ closeButton: true,
104
+ timeOut: 3000,
105
+ timeOutProgress: true,
106
+ });
107
+ }
108
+ }
109
+ getTabItems(notifications) {
110
+ if (!notifications) {
111
+ return [
112
+ {
113
+ text: 'All',
114
+ //active: true,
115
+ count: 0,
116
+ },
117
+ ];
118
+ }
119
+ const categoryCountMap = new Map();
120
+ notifications.forEach((notification) => {
121
+ const category = notification.template.category;
122
+ if (!categoryCountMap.has(category)) {
123
+ categoryCountMap.set(category, 0);
124
+ }
125
+ if (!notification.readAt) {
126
+ categoryCountMap.set(category, categoryCountMap.get(category) + 1);
127
+ }
128
+ });
129
+ const tabItems = Array.from(categoryCountMap.entries()).map(([category, count]) => ({
130
+ text: category,
131
+ count: count,
132
+ }));
133
+ const totalCount = Array.from(categoryCountMap.values()).reduce((a, b) => a + b, 0);
134
+ tabItems.unshift({
135
+ text: 'All',
136
+ count: totalCount,
137
+ });
138
+ return tabItems;
139
+ }
140
+ getNewNotification(data) {
141
+ const total = data.filter((tab) => tab.text !== 'All').reduce((sum, tab) => sum + tab.count, 0);
142
+ return total;
143
+ }
144
+ getNotificationItems(category) {
145
+ if (category === 'All') {
146
+ return this.notifications();
147
+ }
148
+ else {
149
+ return this.notifications()?.filter((item) => item.template.category === category);
150
+ }
151
+ }
152
+ //
153
+ markAllAsRead() {
154
+ this.notifications.update((notification) => notification?.map((item) => {
155
+ if (!item.readAt) {
156
+ return { ...item, readAt: new Date() };
157
+ }
158
+ return item;
159
+ }));
160
+ }
161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXMAdminNotificationPanelComponent, isStandalone: true, selector: "axm-admin-notification-panel", outputs: { onNewNotfication: "onNewNotfication" }, ngImport: i0, template: "<div class=\"ax-p-4 ax-flex ax-justify-between ax-items-center\">\n <span class=\"ax-text-xl\">Notifications</span>\n <ax-button color=\"default\" look=\"blank\">\n <ax-icon>\n <i class=\"fa-regular fa-gear fa-lg\"></i>\n </ax-icon>\n </ax-button>\n</div>\n<ax-tabs [content]=\"cons\" look=\"with-line\" location=\"bottom\">\n @for(tab of tabItems(); track tab.text){\n <ax-tab-item [text]=\"tab.text\" [active]=\"activeTab() === tab.text\" (activeChange)=\"changeActiveTab(tab.text)\">\n <ax-suffix>\n @if(tab.count){\n <ax-badge [color]=\"activeTab() === tab.text ? 'primary' : 'ghost'\" [text]=\"tab.count.toString()\"></ax-badge>\n }\n </ax-suffix>\n <ax-content>\n <div class=\"ax-max-h-[50vh] ax-overflow-y-auto\">\n @for(notif of getNotificationItems(tab.text); track notif.id){\n <axp-master-notification-item\n [data]=\"notif\"\n (onPressNotificationItem)=\"onPressNotificationItem($event)\"\n ></axp-master-notification-item>\n }\n </div>\n <div class=\"ax-flex ax-gap-4 ax-justify-between ax-p-4 ax-border-t ax-border-default\">\n <ax-button\n [disabled]=\"NewNotification() === 0\"\n color=\"ghost\"\n text=\"Mark all as read\"\n (onClick)=\"markAllAsRead()\"\n ></ax-button>\n <ax-button color=\"primary\" text=\"View all notifications\"></ax-button>\n </div>\n </ax-content>\n </ax-tab-item>\n }\n</ax-tabs>\n\n<ng-template [axTabContent] #cons=\"axTabContent\"></ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXTabsModule }, { kind: "component", type: i2.AXTabsComponent, selector: "ax-tabs", inputs: ["look", "location", "fitParent", "minWidth", "content"], outputs: ["onActiveTabChanged"] }, { kind: "component", type: i2.AXTabItemComponent, selector: "ax-tab-item", inputs: ["disabled", "text", "key", "headerTemplate", "active"], outputs: ["disabledChange", "onClick", "onBlur", "onFocus", "activeChange"] }, { kind: "directive", type: i2.AXTabContentDirective, selector: "[axTabContent]", inputs: ["axTabContent"], exportAs: ["axTabContent"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXBadgeModule }, { kind: "component", type: i4$1.AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "component", type: AXMAdminNotificationItemComponent, selector: "axp-master-notification-item", inputs: ["data"], outputs: ["onPressNotificationItem"] }, { kind: "ngmodule", type: AXFormatModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
163
+ }
164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationPanelComponent, decorators: [{
165
+ type: Component,
166
+ args: [{ selector: 'axm-admin-notification-panel', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
167
+ CommonModule,
168
+ AXButtonModule,
169
+ AXTabsModule,
170
+ AXDecoratorModule,
171
+ AXBadgeModule,
172
+ AXPopoverModule,
173
+ AXMAdminNotificationItemComponent,
174
+ AXFormatModule,
175
+ ], template: "<div class=\"ax-p-4 ax-flex ax-justify-between ax-items-center\">\n <span class=\"ax-text-xl\">Notifications</span>\n <ax-button color=\"default\" look=\"blank\">\n <ax-icon>\n <i class=\"fa-regular fa-gear fa-lg\"></i>\n </ax-icon>\n </ax-button>\n</div>\n<ax-tabs [content]=\"cons\" look=\"with-line\" location=\"bottom\">\n @for(tab of tabItems(); track tab.text){\n <ax-tab-item [text]=\"tab.text\" [active]=\"activeTab() === tab.text\" (activeChange)=\"changeActiveTab(tab.text)\">\n <ax-suffix>\n @if(tab.count){\n <ax-badge [color]=\"activeTab() === tab.text ? 'primary' : 'ghost'\" [text]=\"tab.count.toString()\"></ax-badge>\n }\n </ax-suffix>\n <ax-content>\n <div class=\"ax-max-h-[50vh] ax-overflow-y-auto\">\n @for(notif of getNotificationItems(tab.text); track notif.id){\n <axp-master-notification-item\n [data]=\"notif\"\n (onPressNotificationItem)=\"onPressNotificationItem($event)\"\n ></axp-master-notification-item>\n }\n </div>\n <div class=\"ax-flex ax-gap-4 ax-justify-between ax-p-4 ax-border-t ax-border-default\">\n <ax-button\n [disabled]=\"NewNotification() === 0\"\n color=\"ghost\"\n text=\"Mark all as read\"\n (onClick)=\"markAllAsRead()\"\n ></ax-button>\n <ax-button color=\"primary\" text=\"View all notifications\"></ax-button>\n </div>\n </ax-content>\n </ax-tab-item>\n }\n</ax-tabs>\n\n<ng-template [axTabContent] #cons=\"axTabContent\"></ng-template>\n" }]
176
+ }] });
177
+
178
+ class AXMAdminNotificationSlotComponent {
179
+ constructor() {
180
+ this.totalNewNotification = signal(0);
181
+ }
182
+ setTotalNewNotification(value) {
183
+ this.totalNewNotification.set(value);
184
+ }
185
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
186
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.0", type: AXMAdminNotificationSlotComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<ax-button color=\"secondary\" class=\"ax-relative\" look=\"blank\" #notification>\n <ax-icon>\n <i class=\"fa-regular fa-bell ax-text-slate-400 dark:ax-text-slate-200\"></i>\n </ax-icon>\n <ax-suffix class=\"ax-absolute ax-top-0 ax-left-1/2\">\n @if(totalNewNotification()){\n <ax-badge color=\"success\" [text]=\"totalNewNotification().toString()\"></ax-badge>\n }\n </ax-suffix>\n</ax-button>\n<ax-popover [target]=\"notification\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" [adaptivityEnabled]=\"true\">\n <div class=\"ax-bg-surface ax-border ax-border-default ax-rounded-md ax-shadow-md ax-w-full\">\n <axm-admin-notification-panel (onNewNotfication)=\"setTotalNewNotification($event)\"> </axm-admin-notification-panel>\n </div>\n</ax-popover>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i1$1.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type", "responsiveOn", "loadingText"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange", "responsiveOnChange", "loadingTextChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXBadgeModule }, { kind: "component", type: i4$1.AXBadgeComponent, selector: "ax-badge", inputs: ["color", "look", "text"] }, { kind: "ngmodule", type: AXPopoverModule }, { kind: "component", type: i4$2.AXPopoverComponent, selector: "ax-popover", inputs: ["offsetX", "offsetY", "target", "placement", "content", "openOn", "closeOn", "hasBackdrop", "openAfter", "closeAfter", "backdropClass", "adaptivityEnabled"], outputs: ["onOpened", "onClosed"] }, { kind: "component", type: AXMAdminNotificationPanelComponent, selector: "axm-admin-notification-panel", outputs: ["onNewNotfication"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
187
+ }
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMAdminNotificationSlotComponent, decorators: [{
189
+ type: Component,
190
+ args: [{ standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
191
+ CommonModule,
192
+ AXButtonModule,
193
+ AXDecoratorModule,
194
+ AXBadgeModule,
195
+ AXPopoverModule,
196
+ AXMAdminNotificationItemComponent,
197
+ AXMAdminNotificationPanelComponent,
198
+ ], template: "<ax-button color=\"secondary\" class=\"ax-relative\" look=\"blank\" #notification>\n <ax-icon>\n <i class=\"fa-regular fa-bell ax-text-slate-400 dark:ax-text-slate-200\"></i>\n </ax-icon>\n <ax-suffix class=\"ax-absolute ax-top-0 ax-left-1/2\">\n @if(totalNewNotification()){\n <ax-badge color=\"success\" [text]=\"totalNewNotification().toString()\"></ax-badge>\n }\n </ax-suffix>\n</ax-button>\n<ax-popover [target]=\"notification\" [openOn]=\"'toggle'\" [closeOn]=\"'clickOut'\" [adaptivityEnabled]=\"true\">\n <div class=\"ax-bg-surface ax-border ax-border-default ax-rounded-md ax-shadow-md ax-w-full\">\n <axm-admin-notification-panel (onNewNotfication)=\"setTotalNewNotification($event)\"> </axm-admin-notification-panel>\n </div>\n</ax-popover>\n" }]
199
+ }] });
200
+
201
+ class AXMNotificationManagementModule {
202
+ static forRoot() {
203
+ return {
204
+ ngModule: AXMNotificationManagementModule,
205
+ providers: [
206
+ {
207
+ provide: 'AXP_REGISTER_TEMPLATE_NoTIFICATION',
208
+ useFactory: async (entityRegistry, injector) => {
209
+ const notificationTemplateEntity = await (await Promise.resolve().then(function () { return notification_entity; })).notificationEntityFactory(injector);
210
+ entityRegistry.register(notificationTemplateEntity);
211
+ //
212
+ const notificationChannelEntity = await (await Promise.resolve().then(function () { return notificationChannel_entity; })).notificationChannelEntityFactory(injector);
213
+ entityRegistry.register(notificationChannelEntity);
214
+ //
215
+ const notificationEntity = await (await Promise.resolve().then(function () { return notification_entity; })).notificationEntityFactory(injector);
216
+ entityRegistry.register(notificationEntity);
217
+ },
218
+ deps: [AXPEntityDefinitionRegistryService, Injector], // Add any dependencies if needed
219
+ },
220
+ ],
221
+ };
222
+ }
223
+ /**
224
+ * @ignore
225
+ */
226
+ constructor(instances) { }
227
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMNotificationManagementModule, deps: [{ token: 'AXP_REGISTER_TEMPLATE_NoTIFICATION', optional: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
228
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.0", ngImport: i0, type: AXMNotificationManagementModule, imports: [i1$2.AXPComponentSlotModule] }); }
229
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMNotificationManagementModule, imports: [AXPComponentSlotModule.forChild({
230
+ 'header-end': [
231
+ {
232
+ name: 'notification',
233
+ component: AXMAdminNotificationSlotComponent
234
+ },
235
+ ],
236
+ })] }); }
237
+ }
238
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: AXMNotificationManagementModule, decorators: [{
239
+ type: NgModule,
240
+ args: [{
241
+ imports: [
242
+ AXPComponentSlotModule.forChild({
243
+ 'header-end': [
244
+ {
245
+ name: 'notification',
246
+ component: AXMAdminNotificationSlotComponent
247
+ },
248
+ ],
249
+ }),
250
+ ],
251
+ exports: [],
252
+ declarations: [],
253
+ }]
254
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
255
+ type: Optional
256
+ }, {
257
+ type: Inject,
258
+ args: ['AXP_REGISTER_TEMPLATE_NoTIFICATION']
259
+ }] }] });
260
+
261
+ const CHANNELS = ['InApp', 'Email', 'SMS'];
262
+ const TITLES = ['Buy Me!', 'Black Friday', 'New Message'];
263
+ const BODIES = ['Buy New Glass From Shop', 'New Offers For Black Friday!', 'Saeed Send New File Message'];
264
+ const CATEGORIES = ['Inbox', 'Archive', 'Role'];
265
+ const TYPES = ['File', 'Person', 'Notification'];
266
+ const PRORITIES = ['Warning', 'Danger', 'Notice'];
267
+ const NOTIFICATION_TEMPLATES = Array.from({ length: 5 }).map((_, i) => {
268
+ const name = AXPDataGenerator.string;
269
+ return {
270
+ id: AXPDataGenerator.uuid(),
271
+ name: name,
272
+ title: name,
273
+ description: AXPDataGenerator.string(200),
274
+ };
275
+ });
276
+ const NOTIFICATION_CHANNELS = Array.from({ length: 3 }).map((_, i) => {
277
+ return {
278
+ body: BODIES[i],
279
+ title: TITLES[i],
280
+ channel: CHANNELS[i],
281
+ inApp: {
282
+ category: AXPDataGenerator.pick(CATEGORIES),
283
+ level: AXPDataGenerator.pick(PRORITIES),
284
+ type: AXPDataGenerator.pick(TYPES),
285
+ },
286
+ };
287
+ });
288
+ const NOTIFICATIONS = Array.from({ length: 5 }).map((_, i) => {
289
+ return {
290
+ id: AXPDataGenerator.uuid(),
291
+ title: AXPDataGenerator.pick(TITLES),
292
+ body: AXPDataGenerator.pick(BODIES),
293
+ channel: AXPDataGenerator.pick(CHANNELS),
294
+ data: {},
295
+ RelativeType: 'demo.sample',
296
+ RelativeId: '535c8c8a-5e64-4079-929d-752394669b51',
297
+ user: {
298
+ id: AXPDataGenerator.uuid(),
299
+ name: AXPDataGenerator.firstName() + ' ' + AXPDataGenerator.lastName(),
300
+ image: 'https://i.pravatar.cc/300',
301
+ },
302
+ template: {
303
+ category: AXPDataGenerator.pick(CATEGORIES),
304
+ prority: AXPDataGenerator.pick(PRORITIES),
305
+ type: AXPDataGenerator.pick(TYPES),
306
+ icon: 'fa-image',
307
+ isPinned: AXPDataGenerator.boolean(),
308
+ },
309
+ readAt: AXPDataGenerator.pick([AXPDataGenerator.date(), null]),
310
+ createAt: AXPDataGenerator.date(),
311
+ entityName: 'notifications',
312
+ };
313
+ });
314
+
315
+ class NotificationManagementService {
316
+ constructor() {
317
+ this.storageService = inject(AXPEntityStorageService);
318
+ //
319
+ this._notificationTemplateDataProvider = new AXPEntityDataProviderImpl(this.storageService, 'notificationTemplates');
320
+ this._notificationTemplateDataProvider.initial(NOTIFICATION_TEMPLATES);
321
+ //
322
+ this._notificationChannelDataProvider = new AXPEntityDataProviderImpl(this.storageService, 'notificationChannels');
323
+ this._notificationChannelDataProvider.initial(NOTIFICATION_CHANNELS);
324
+ //
325
+ this._notificationDataProvider = new AXPEntityDataProviderImpl(this.storageService, 'notifications');
326
+ this._notificationDataProvider.initial(NOTIFICATIONS);
327
+ }
328
+ notificationTemplateList() {
329
+ return this._notificationTemplateDataProvider.getAll();
330
+ }
331
+ get notificationTemplateDataProvider() {
332
+ return this._notificationTemplateDataProvider;
333
+ }
334
+ get notificationChannelDataProvider() {
335
+ return this._notificationChannelDataProvider;
336
+ }
337
+ get notificationDataProvider() {
338
+ return this._notificationDataProvider;
339
+ }
340
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NotificationManagementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
341
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NotificationManagementService, providedIn: 'root' }); }
342
+ }
343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.0", ngImport: i0, type: NotificationManagementService, decorators: [{
344
+ type: Injectable,
345
+ args: [{
346
+ providedIn: 'root',
347
+ }]
348
+ }], ctorParameters: () => [] });
349
+
350
+ async function notificationChannelEntityFactory(injector) {
351
+ const dataService = injector.get(NotificationManagementService);
352
+ const entityDef = {
353
+ module: 'notification-management',
354
+ name: 'notificationChannel',
355
+ source: 'notification-management.notificationChannel',
356
+ title: 'Notification Channel',
357
+ formats: {
358
+ individual: 'Channel',
359
+ plural: 'Channels',
360
+ },
361
+ relatedEntities: [],
362
+ groups: [
363
+ {
364
+ id: 'notificationChannel',
365
+ title: 'Notification Channel',
366
+ },
367
+ ],
368
+ properties: [
369
+ {
370
+ name: 'title',
371
+ title: 'Title',
372
+ groupId: 'notificationChannel',
373
+ schema: {
374
+ dataType: 'string',
375
+ interface: {
376
+ type: AXPWidgetsCatalog.text,
377
+ },
378
+ },
379
+ validations: [
380
+ {
381
+ rule: 'required',
382
+ },
383
+ ],
384
+ },
385
+ {
386
+ name: 'template',
387
+ title: 'Template',
388
+ groupId: 'notificationChannel',
389
+ schema: {
390
+ dataType: 'string',
391
+ interface: {
392
+ type: AXPWidgetsCatalog.lookup,
393
+ options: {
394
+ entity: 'template-management.globalTemplate',
395
+ expose: { source: 'content', target: 'body' },
396
+ },
397
+ },
398
+ },
399
+ },
400
+ {
401
+ name: 'body',
402
+ title: 'Body',
403
+ groupId: 'notificationChannel',
404
+ schema: {
405
+ dataType: 'string',
406
+ interface: {
407
+ type: AXPWidgetsCatalog.largeText,
408
+ },
409
+ },
410
+ validations: [
411
+ {
412
+ rule: 'required',
413
+ },
414
+ ],
415
+ },
416
+ {
417
+ name: 'channel',
418
+ title: 'Channel',
419
+ groupId: 'notificationChannel',
420
+ schema: {
421
+ dataType: 'string',
422
+ interface: {
423
+ type: AXPWidgetsCatalog.select,
424
+ options: {
425
+ valueField: 'name',
426
+ textField: 'title',
427
+ dataSource: [
428
+ { title: 'SMS', name: 'sms' },
429
+ { title: 'Email', name: 'email' },
430
+ { title: 'In App', name: 'inApp' },
431
+ ],
432
+ direction: 'horizontal',
433
+ multiple: false,
434
+ },
435
+ },
436
+ },
437
+ validations: [
438
+ {
439
+ rule: 'required',
440
+ },
441
+ ],
442
+ },
443
+ {
444
+ name: 'title',
445
+ title: 'Title',
446
+ groupId: 'notificationChannel',
447
+ schema: {
448
+ dataType: 'string',
449
+ interface: {
450
+ type: AXPWidgetsCatalog.text,
451
+ },
452
+ },
453
+ validations: [
454
+ {
455
+ rule: 'required',
456
+ },
457
+ ],
458
+ },
459
+ ],
460
+ columns: [{ name: 'title' }, { name: 'body' }, { name: 'channel' }],
461
+ commands: {
462
+ create: {
463
+ execute: async (data) => {
464
+ const entity = Object.assign(data, { id: AXPDataGenerator.uuid() });
465
+ dataService.notificationChannelDataProvider.insertOne(entity);
466
+ return Promise.resolve(entity);
467
+ },
468
+ },
469
+ delete: {
470
+ execute: async (id) => {
471
+ await await dataService.notificationChannelDataProvider.deleteOne(id);
472
+ return Promise.resolve();
473
+ },
474
+ },
475
+ update: {
476
+ execute: async (data) => {
477
+ debugger;
478
+ return new Promise((resolve) => {
479
+ setTimeout(async () => {
480
+ await dataService.notificationChannelDataProvider.updateOne(data.id, data);
481
+ resolve(data);
482
+ }, 1000);
483
+ });
484
+ },
485
+ },
486
+ },
487
+ queries: {
488
+ byKey: {
489
+ execute: async (id) => {
490
+ return new Promise((resolve) => {
491
+ setTimeout(async () => {
492
+ const entity = await dataService.notificationChannelDataProvider.getOne(id);
493
+ resolve(entity);
494
+ }, 500);
495
+ });
496
+ },
497
+ type: AXPEntityQueryType.Single,
498
+ },
499
+ list: {
500
+ execute: async (e) => {
501
+ const list = await dataService.notificationChannelDataProvider.getAll();
502
+ const sortedItems = applySortArray(list, e.sort);
503
+ const filteredItems = applyFilterArray(sortedItems, e.filter ? [e.filter] : []);
504
+ return Promise.resolve({
505
+ total: filteredItems.length,
506
+ items: filteredItems.slice(e.skip, (e.skip ?? 0) + (e.take ?? 0)),
507
+ });
508
+ },
509
+ type: AXPEntityQueryType.List,
510
+ },
511
+ },
512
+ interfaces: {
513
+ master: {
514
+ create: {
515
+ sections: [
516
+ {
517
+ id: 'notificationChannel',
518
+ },
519
+ ],
520
+ properties: [
521
+ {
522
+ name: 'title',
523
+ layout: {
524
+ positions: {
525
+ lg: {
526
+ colSpan: 12,
527
+ },
528
+ },
529
+ },
530
+ },
531
+ {
532
+ name: 'body',
533
+ layout: {
534
+ positions: {
535
+ lg: {
536
+ colSpan: 12,
537
+ },
538
+ },
539
+ },
540
+ },
541
+ {
542
+ name: 'template',
543
+ layout: {
544
+ positions: {
545
+ lg: {
546
+ colSpan: 12,
547
+ },
548
+ },
549
+ },
550
+ },
551
+ {
552
+ name: 'channel',
553
+ layout: {
554
+ positions: {
555
+ lg: {
556
+ colSpan: 12,
557
+ },
558
+ },
559
+ },
560
+ },
561
+ ],
562
+ },
563
+ update: {
564
+ sections: [
565
+ {
566
+ id: 'notificationChannel',
567
+ },
568
+ ],
569
+ properties: [
570
+ {
571
+ name: 'title',
572
+ layout: {
573
+ positions: {
574
+ lg: {
575
+ colSpan: 12,
576
+ },
577
+ },
578
+ },
579
+ },
580
+ {
581
+ name: 'body',
582
+ layout: {
583
+ positions: {
584
+ lg: {
585
+ colSpan: 12,
586
+ },
587
+ },
588
+ },
589
+ },
590
+ {
591
+ name: 'channel',
592
+ layout: {
593
+ positions: {
594
+ lg: {
595
+ colSpan: 12,
596
+ },
597
+ },
598
+ },
599
+ },
600
+ ],
601
+ },
602
+ single: {
603
+ title: '{{title}}',
604
+ sections: [
605
+ {
606
+ id: 'notificationChannel',
607
+ },
608
+ ],
609
+ properties: [
610
+ {
611
+ name: 'title',
612
+ layout: {
613
+ positions: {
614
+ lg: {
615
+ colSpan: 6,
616
+ },
617
+ },
618
+ },
619
+ },
620
+ {
621
+ name: 'body',
622
+ layout: {
623
+ positions: {
624
+ lg: {
625
+ colSpan: 6,
626
+ },
627
+ },
628
+ },
629
+ },
630
+ {
631
+ name: 'channel',
632
+ layout: {
633
+ positions: {
634
+ lg: {
635
+ colSpan: 12,
636
+ },
637
+ },
638
+ },
639
+ },
640
+ ],
641
+ actions: [],
642
+ },
643
+ list: {
644
+ actions: [
645
+ {
646
+ title: 'Create New',
647
+ command: 'create-entity',
648
+ priority: 'primary',
649
+ type: 'create',
650
+ scope: AXPEntityCommandScope.TypeLevel,
651
+ },
652
+ {
653
+ title: 'Delete Items',
654
+ command: 'delete-entity',
655
+ priority: 'primary',
656
+ type: 'delete',
657
+ scope: AXPEntityCommandScope.Selected,
658
+ },
659
+ {
660
+ title: 'Details',
661
+ command: 'open-entity',
662
+ priority: 'primary',
663
+ type: 'view',
664
+ scope: AXPEntityCommandScope.Individual,
665
+ },
666
+ {
667
+ title: 'Delete',
668
+ command: 'delete-entity',
669
+ priority: 'primary',
670
+ type: 'delete',
671
+ scope: AXPEntityCommandScope.Individual,
672
+ },
673
+ ],
674
+ views: [
675
+ {
676
+ name: 'all',
677
+ title: 'All Items',
678
+ fixed: true,
679
+ columns: [],
680
+ conditions: [],
681
+ sorts: [],
682
+ },
683
+ ],
684
+ },
685
+ },
686
+ },
687
+ };
688
+ return entityDef;
689
+ }
690
+
691
+ var notificationChannel_entity = /*#__PURE__*/Object.freeze({
692
+ __proto__: null,
693
+ notificationChannelEntityFactory: notificationChannelEntityFactory
694
+ });
695
+
696
+ async function notificationTemplateEntityFactory(injector) {
697
+ const dataService = injector.get(NotificationManagementService);
698
+ const entityDef = {
699
+ module: 'notification-management',
700
+ name: 'notificationTemplate',
701
+ source: 'notification-management.notificationTemplate',
702
+ title: 'Templates',
703
+ formats: {
704
+ individual: 'NotificationTemplate',
705
+ plural: 'NotificationTemplates',
706
+ },
707
+ relatedEntities: [
708
+ {
709
+ entity: 'notification-management.notificationChannel',
710
+ columns: ['title', 'body', 'channel'],
711
+ conditions: [
712
+ {
713
+ name: 'notificationId',
714
+ operator: {
715
+ type: 'equal',
716
+ },
717
+ value: 'id',
718
+ },
719
+ ],
720
+ },
721
+ ],
722
+ groups: [
723
+ {
724
+ id: 'notification',
725
+ title: 'Notification',
726
+ },
727
+ ],
728
+ properties: [
729
+ {
730
+ name: 'name',
731
+ title: 'Name',
732
+ groupId: 'notification',
733
+ schema: {
734
+ dataType: 'string',
735
+ interface: {
736
+ type: AXPWidgetsCatalog.text,
737
+ },
738
+ },
739
+ },
740
+ {
741
+ name: 'title',
742
+ title: 'Title',
743
+ groupId: 'notification',
744
+ schema: {
745
+ dataType: 'string',
746
+ interface: {
747
+ type: AXPWidgetsCatalog.text,
748
+ },
749
+ },
750
+ },
751
+ {
752
+ name: 'description',
753
+ title: 'Description',
754
+ groupId: 'notification',
755
+ schema: {
756
+ dataType: 'string',
757
+ interface: {
758
+ type: AXPWidgetsCatalog.text,
759
+ },
760
+ },
761
+ },
762
+ ],
763
+ columns: [{ name: 'name' }, { name: 'title' }],
764
+ commands: {
765
+ create: {
766
+ execute: async (data) => {
767
+ const entity = Object.assign(data, { id: AXPDataGenerator.uuid() });
768
+ dataService.notificationTemplateDataProvider.insertOne(entity);
769
+ return Promise.resolve(entity);
770
+ },
771
+ },
772
+ delete: {
773
+ execute: async (id) => {
774
+ await await dataService.notificationTemplateDataProvider.deleteOne(id);
775
+ return Promise.resolve();
776
+ },
777
+ },
778
+ update: {
779
+ execute: async (data) => {
780
+ return new Promise((resolve) => {
781
+ setTimeout(async () => {
782
+ await dataService.notificationTemplateDataProvider.updateOne(data.id, data);
783
+ resolve(data);
784
+ }, 1000);
785
+ });
786
+ },
787
+ },
788
+ },
789
+ queries: {
790
+ byKey: {
791
+ execute: async (id) => {
792
+ return new Promise((resolve) => {
793
+ setTimeout(async () => {
794
+ const entity = await dataService.notificationTemplateDataProvider.getOne(id);
795
+ resolve(entity);
796
+ }, 500);
797
+ });
798
+ },
799
+ type: AXPEntityQueryType.Single,
800
+ },
801
+ list: {
802
+ execute: async (e) => {
803
+ const list = await dataService.notificationTemplateDataProvider.getAll();
804
+ const sortedItems = applySortArray(list, e.sort);
805
+ const filteredItems = applyFilterArray(sortedItems, e.filter ? [e.filter] : []);
806
+ return Promise.resolve({
807
+ total: filteredItems.length,
808
+ items: filteredItems.slice(e.skip, (e.skip ?? 0) + (e.take ?? 0)),
809
+ });
810
+ },
811
+ type: AXPEntityQueryType.List,
812
+ },
813
+ },
814
+ interfaces: {
815
+ master: {
816
+ create: {
817
+ sections: [
818
+ {
819
+ id: 'notification',
820
+ },
821
+ ],
822
+ properties: [
823
+ {
824
+ name: 'name',
825
+ layout: {
826
+ positions: {
827
+ lg: {
828
+ colSpan: 6,
829
+ },
830
+ },
831
+ },
832
+ },
833
+ {
834
+ name: 'title',
835
+ layout: {
836
+ positions: {
837
+ lg: {
838
+ colSpan: 6,
839
+ },
840
+ },
841
+ },
842
+ },
843
+ {
844
+ name: 'description',
845
+ layout: {
846
+ positions: {
847
+ lg: {
848
+ colSpan: 12,
849
+ },
850
+ },
851
+ },
852
+ },
853
+ ],
854
+ },
855
+ update: {
856
+ sections: [
857
+ {
858
+ id: 'notification',
859
+ },
860
+ ],
861
+ properties: [
862
+ {
863
+ name: 'name',
864
+ layout: {
865
+ positions: {
866
+ lg: {
867
+ colSpan: 6,
868
+ },
869
+ },
870
+ },
871
+ },
872
+ {
873
+ name: 'title',
874
+ layout: {
875
+ positions: {
876
+ lg: {
877
+ colSpan: 6,
878
+ },
879
+ },
880
+ },
881
+ },
882
+ {
883
+ name: 'description',
884
+ layout: {
885
+ positions: {
886
+ lg: {
887
+ colSpan: 12,
888
+ },
889
+ },
890
+ },
891
+ },
892
+ ],
893
+ },
894
+ single: {
895
+ title: '{{title}}',
896
+ sections: [
897
+ {
898
+ id: 'notification',
899
+ layout: {
900
+ positions: {
901
+ lg: {
902
+ colSpan: 12,
903
+ },
904
+ },
905
+ },
906
+ },
907
+ ],
908
+ properties: [
909
+ {
910
+ name: 'name',
911
+ layout: {
912
+ positions: {
913
+ lg: {
914
+ colSpan: 6,
915
+ },
916
+ },
917
+ },
918
+ },
919
+ {
920
+ name: 'title',
921
+ layout: {
922
+ positions: {
923
+ lg: {
924
+ colSpan: 6,
925
+ },
926
+ },
927
+ },
928
+ },
929
+ {
930
+ name: 'description',
931
+ layout: {
932
+ positions: {
933
+ lg: {
934
+ colSpan: 12,
935
+ },
936
+ },
937
+ },
938
+ },
939
+ ],
940
+ actions: [],
941
+ },
942
+ list: {
943
+ actions: [
944
+ {
945
+ title: 'Create New',
946
+ command: 'create-entity',
947
+ priority: 'primary',
948
+ type: 'create',
949
+ scope: AXPEntityCommandScope.TypeLevel,
950
+ },
951
+ {
952
+ title: 'Delete Items',
953
+ command: 'delete-entity',
954
+ priority: 'primary',
955
+ type: 'delete',
956
+ scope: AXPEntityCommandScope.Selected,
957
+ },
958
+ {
959
+ title: 'Details',
960
+ command: 'open-entity',
961
+ priority: 'primary',
962
+ type: 'view',
963
+ scope: AXPEntityCommandScope.Individual,
964
+ },
965
+ {
966
+ title: 'Delete',
967
+ command: 'delete-entity',
968
+ priority: 'primary',
969
+ type: 'delete',
970
+ scope: AXPEntityCommandScope.Individual,
971
+ },
972
+ ],
973
+ views: [
974
+ {
975
+ name: 'all',
976
+ title: 'All Items',
977
+ fixed: true,
978
+ columns: [],
979
+ conditions: [],
980
+ sorts: [],
981
+ },
982
+ ],
983
+ },
984
+ },
985
+ },
986
+ };
987
+ return entityDef;
988
+ }
989
+
990
+ async function notificationEntityFactory(injector) {
991
+ const dataService = injector.get(NotificationManagementService);
992
+ const entityDef = {
993
+ module: 'notification-management',
994
+ name: 'notification',
995
+ source: 'notification-management.notification',
996
+ title: 'Notification',
997
+ formats: {
998
+ individual: 'Notification',
999
+ plural: 'Notifications',
1000
+ },
1001
+ relatedEntities: [
1002
+ {
1003
+ entity: 'notification-management.notificationLog',
1004
+ columns: ['title', 'status'],
1005
+ },
1006
+ ],
1007
+ groups: [
1008
+ {
1009
+ id: 'notification',
1010
+ title: 'Notification',
1011
+ },
1012
+ ],
1013
+ properties: [
1014
+ {
1015
+ name: 'name',
1016
+ title: 'Name',
1017
+ groupId: 'notification',
1018
+ schema: {
1019
+ dataType: 'string',
1020
+ interface: {
1021
+ type: AXPWidgetsCatalog.text,
1022
+ },
1023
+ },
1024
+ },
1025
+ {
1026
+ name: 'title',
1027
+ title: 'Title',
1028
+ groupId: 'notification',
1029
+ schema: {
1030
+ dataType: 'string',
1031
+ interface: {
1032
+ type: AXPWidgetsCatalog.text,
1033
+ },
1034
+ },
1035
+ },
1036
+ {
1037
+ name: 'body',
1038
+ title: 'Body',
1039
+ groupId: 'notification',
1040
+ schema: {
1041
+ dataType: 'string',
1042
+ interface: {
1043
+ type: AXPWidgetsCatalog.richText,
1044
+ },
1045
+ },
1046
+ },
1047
+ {
1048
+ name: 'channel',
1049
+ title: 'Channel',
1050
+ groupId: 'notification',
1051
+ schema: {
1052
+ dataType: 'string',
1053
+ interface: {
1054
+ type: AXPWidgetsCatalog.text,
1055
+ },
1056
+ },
1057
+ },
1058
+ {
1059
+ name: 'user.name',
1060
+ title: 'User Name',
1061
+ groupId: 'notification',
1062
+ schema: {
1063
+ dataType: 'string',
1064
+ interface: {
1065
+ type: AXPWidgetsCatalog.text,
1066
+ },
1067
+ },
1068
+ },
1069
+ ],
1070
+ columns: [{ name: 'title' }, { name: 'body' }, { name: 'user.name' }, { name: 'channel' }],
1071
+ queries: {
1072
+ byKey: {
1073
+ execute: async (id) => {
1074
+ return new Promise((resolve) => {
1075
+ setTimeout(async () => {
1076
+ const entity = await dataService.notificationDataProvider.getOne(id);
1077
+ resolve(entity);
1078
+ }, 500);
1079
+ });
1080
+ },
1081
+ type: AXPEntityQueryType.Single,
1082
+ },
1083
+ list: {
1084
+ execute: async (e) => {
1085
+ const list = await dataService.notificationDataProvider.getAll();
1086
+ const sortedItems = applySortArray(list, e.sort);
1087
+ const filteredItems = applyFilterArray(sortedItems, e.filter ? [e.filter] : []);
1088
+ return Promise.resolve({
1089
+ total: filteredItems.length,
1090
+ items: filteredItems.slice(e.skip, (e.skip ?? 0) + (e.take ?? 0)),
1091
+ });
1092
+ },
1093
+ type: AXPEntityQueryType.List,
1094
+ },
1095
+ },
1096
+ interfaces: {
1097
+ master: {
1098
+ single: {
1099
+ title: '{{title}}',
1100
+ sections: [
1101
+ {
1102
+ id: 'notification',
1103
+ layout: {
1104
+ positions: {
1105
+ lg: {
1106
+ colSpan: 12,
1107
+ },
1108
+ },
1109
+ },
1110
+ },
1111
+ ],
1112
+ properties: [
1113
+ {
1114
+ name: 'name',
1115
+ layout: {
1116
+ positions: {
1117
+ lg: {
1118
+ colSpan: 6,
1119
+ },
1120
+ },
1121
+ },
1122
+ },
1123
+ {
1124
+ name: 'user.name',
1125
+ layout: {
1126
+ positions: {
1127
+ lg: {
1128
+ colSpan: 6,
1129
+ },
1130
+ },
1131
+ },
1132
+ },
1133
+ {
1134
+ name: 'title',
1135
+ layout: {
1136
+ positions: {
1137
+ lg: {
1138
+ colSpan: 12,
1139
+ },
1140
+ },
1141
+ },
1142
+ },
1143
+ {
1144
+ name: 'body',
1145
+ layout: {
1146
+ positions: {
1147
+ lg: {
1148
+ colSpan: 12,
1149
+ },
1150
+ },
1151
+ },
1152
+ },
1153
+ {
1154
+ name: 'channel',
1155
+ layout: {
1156
+ positions: {
1157
+ lg: {
1158
+ colSpan: 6,
1159
+ },
1160
+ },
1161
+ },
1162
+ },
1163
+ ],
1164
+ actions: [],
1165
+ },
1166
+ list: {
1167
+ actions: [
1168
+ {
1169
+ title: 'Details',
1170
+ command: 'open-entity',
1171
+ priority: 'primary',
1172
+ type: 'view',
1173
+ scope: AXPEntityCommandScope.Individual,
1174
+ },
1175
+ ],
1176
+ views: [
1177
+ {
1178
+ name: 'all',
1179
+ title: 'All Items',
1180
+ fixed: true,
1181
+ columns: [],
1182
+ conditions: [],
1183
+ sorts: [],
1184
+ },
1185
+ ],
1186
+ },
1187
+ },
1188
+ },
1189
+ };
1190
+ return entityDef;
1191
+ }
1192
+
1193
+ var notification_entity = /*#__PURE__*/Object.freeze({
1194
+ __proto__: null,
1195
+ notificationEntityFactory: notificationEntityFactory
1196
+ });
1197
+
1198
+ /**
1199
+ * Generated bundle index. Do not edit.
1200
+ */
1201
+
1202
+ export { AXMNotificationManagementModule, AXMNotificationService, notificationChannelEntityFactory, notificationEntityFactory, notificationTemplateEntityFactory };
1203
+ //# sourceMappingURL=acorex-modules-notification-management.mjs.map