@acorex/modules 20.1.0 → 20.2.0-next.0

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 (42) hide show
  1. package/auth/index.d.ts +4 -57
  2. package/conversation/index.d.ts +69 -9
  3. package/dashboard-management/index.d.ts +2 -0
  4. package/fesm2022/{acorex-modules-auth-acorex-modules-auth-5TIjp5UG.mjs → acorex-modules-auth-acorex-modules-auth-y6rICHrT.mjs} +84 -201
  5. package/fesm2022/acorex-modules-auth-acorex-modules-auth-y6rICHrT.mjs.map +1 -0
  6. package/fesm2022/{acorex-modules-auth-app-chooser.component-B0w1Xzx7.mjs → acorex-modules-auth-app-chooser.component-Cpy0VN6n.mjs} +4 -4
  7. package/fesm2022/{acorex-modules-auth-app-chooser.component-B0w1Xzx7.mjs.map → acorex-modules-auth-app-chooser.component-Cpy0VN6n.mjs.map} +1 -1
  8. package/fesm2022/{acorex-modules-auth-login.module-B8sVVZHV.mjs → acorex-modules-auth-login.module-ZEX4NMuJ.mjs} +4 -4
  9. package/fesm2022/{acorex-modules-auth-login.module-B8sVVZHV.mjs.map → acorex-modules-auth-login.module-ZEX4NMuJ.mjs.map} +1 -1
  10. package/fesm2022/{acorex-modules-auth-master.layout-CMKxj1Qo.mjs → acorex-modules-auth-master.layout-D-lIn4Pl.mjs} +2 -2
  11. package/fesm2022/{acorex-modules-auth-master.layout-CMKxj1Qo.mjs.map → acorex-modules-auth-master.layout-D-lIn4Pl.mjs.map} +1 -1
  12. package/fesm2022/{acorex-modules-auth-password.component-DH0qKunk.mjs → acorex-modules-auth-password.component-CafZfqKe.mjs} +7 -7
  13. package/fesm2022/{acorex-modules-auth-password.component-DH0qKunk.mjs.map → acorex-modules-auth-password.component-CafZfqKe.mjs.map} +1 -1
  14. package/fesm2022/acorex-modules-auth-password.component-DLCb0_6e.mjs +134 -0
  15. package/fesm2022/acorex-modules-auth-password.component-DLCb0_6e.mjs.map +1 -0
  16. package/fesm2022/{acorex-modules-auth-routes-Q9zaIiBS.mjs → acorex-modules-auth-routes-D9-qfC3V.mjs} +2 -2
  17. package/fesm2022/{acorex-modules-auth-routes-Q9zaIiBS.mjs.map → acorex-modules-auth-routes-D9-qfC3V.mjs.map} +1 -1
  18. package/fesm2022/{acorex-modules-auth-tenant-chooser.component-wp7OOLsH.mjs → acorex-modules-auth-tenant-chooser.component-B1aE-TOD.mjs} +10 -13
  19. package/fesm2022/acorex-modules-auth-tenant-chooser.component-B1aE-TOD.mjs.map +1 -0
  20. package/fesm2022/{acorex-modules-auth-two-factor-code.component-DSWd06bn.mjs → acorex-modules-auth-two-factor-code.component-BglerlU-.mjs} +6 -6
  21. package/fesm2022/{acorex-modules-auth-two-factor-code.component-DSWd06bn.mjs.map → acorex-modules-auth-two-factor-code.component-BglerlU-.mjs.map} +1 -1
  22. package/fesm2022/{acorex-modules-auth-two-factor.module-oRixkeAn.mjs → acorex-modules-auth-two-factor.module-D3N2XyOH.mjs} +3 -3
  23. package/fesm2022/{acorex-modules-auth-two-factor.module-oRixkeAn.mjs.map → acorex-modules-auth-two-factor.module-D3N2XyOH.mjs.map} +1 -1
  24. package/fesm2022/acorex-modules-auth.mjs +1 -1
  25. package/fesm2022/acorex-modules-conversation.mjs +487 -57
  26. package/fesm2022/acorex-modules-conversation.mjs.map +1 -1
  27. package/fesm2022/acorex-modules-notification-management.mjs +109 -3
  28. package/fesm2022/acorex-modules-notification-management.mjs.map +1 -1
  29. package/fesm2022/acorex-modules-security-management.mjs +301 -837
  30. package/fesm2022/acorex-modules-security-management.mjs.map +1 -1
  31. package/notification-management/index.d.ts +125 -29
  32. package/package.json +5 -5
  33. package/report-management/index.d.ts +2 -0
  34. package/security-management/index.d.ts +4 -13
  35. package/fesm2022/acorex-modules-auth-acorex-modules-auth-5TIjp5UG.mjs.map +0 -1
  36. package/fesm2022/acorex-modules-auth-oauth-callback.component-C95YLpI_.mjs +0 -101
  37. package/fesm2022/acorex-modules-auth-oauth-callback.component-C95YLpI_.mjs.map +0 -1
  38. package/fesm2022/acorex-modules-auth-password.component-Du0EBIiw.mjs +0 -239
  39. package/fesm2022/acorex-modules-auth-password.component-Du0EBIiw.mjs.map +0 -1
  40. package/fesm2022/acorex-modules-auth-tenant-chooser.component-wp7OOLsH.mjs.map +0 -1
  41. package/fesm2022/acorex-modules-auth-user-sessions.component-8wwWI0cQ.mjs +0 -135
  42. package/fesm2022/acorex-modules-auth-user-sessions.component-8wwWI0cQ.mjs.map +0 -1
@@ -821,6 +821,9 @@ class AXMNotificationEntityServiceImpl extends AXMNotificationEntityService {
821
821
  markAsRead(payload) {
822
822
  throw new Error('Method not implemented.');
823
823
  }
824
+ markAllAsRead() {
825
+ throw new Error('Method not implemented.');
826
+ }
824
827
  create(payload) {
825
828
  throw new Error('Method not implemented.');
826
829
  }
@@ -1445,6 +1448,85 @@ class AXMNotificationManagmentModuleMenuProvider {
1445
1448
  }
1446
1449
  }
1447
1450
 
1451
+ //#region ---- Core Imports ----
1452
+ /**
1453
+ * Service to display OS-level notifications using the browser's Notification API.
1454
+ */
1455
+ class AXMOsNotificationService {
1456
+ constructor() {
1457
+ this.isSupported = signal(false, ...(ngDevMode ? [{ debugName: "isSupported" }] : []));
1458
+ this.permission = signal(false, ...(ngDevMode ? [{ debugName: "permission" }] : []));
1459
+ this.isSupported.set('Notification' in window);
1460
+ }
1461
+ /**
1462
+ * Requests permission from the user to display desktop notifications.
1463
+ * @returns A promise that resolves to true if permission is granted, false otherwise.
1464
+ */
1465
+ async requestPermission() {
1466
+ if (!this.isSupported()) {
1467
+ console.warn('This browser does not support desktop notifications.');
1468
+ return false;
1469
+ }
1470
+ switch (Notification.permission) {
1471
+ case 'granted':
1472
+ this.permission.set(true);
1473
+ return true;
1474
+ case 'default':
1475
+ const permission = await Notification.requestPermission();
1476
+ this.permission.set(permission === 'granted');
1477
+ return this.permission();
1478
+ default:
1479
+ this.permission.set(false);
1480
+ return false;
1481
+ }
1482
+ }
1483
+ /**
1484
+ * Shows a desktop notification.
1485
+ * This method should be called after ensuring permission has been granted via requestPermission().
1486
+ *
1487
+ * @param title The title of the notification.
1488
+ * @param options Optional notification options including an onClick handler and window focusing.
1489
+ * @returns The Notification object if displayed, otherwise null.
1490
+ */
1491
+ show(title, options) {
1492
+ if (!this.isSupported()) {
1493
+ console.warn('This browser does not support desktop notifications.');
1494
+ return null;
1495
+ }
1496
+ if (!this.permission()) {
1497
+ console.warn(`Notification permission is ${Notification.permission}. Call requestPermission() first.`);
1498
+ return null;
1499
+ }
1500
+ const notification = new Notification(title, options);
1501
+ if (options?.onClick) {
1502
+ notification.onclick = () => {
1503
+ if (options.activeWindow) {
1504
+ window.focus();
1505
+ }
1506
+ options.onClick();
1507
+ };
1508
+ }
1509
+ return notification;
1510
+ }
1511
+ /**
1512
+ * Dismisses all active notifications or a specific one.
1513
+ * @param notification Optional. Pass a specific notification to close it; otherwise closes all.
1514
+ */
1515
+ dismiss(notification) {
1516
+ if (notification) {
1517
+ notification.close();
1518
+ }
1519
+ }
1520
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXMOsNotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1521
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXMOsNotificationService, providedIn: 'root' }); }
1522
+ }
1523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXMOsNotificationService, decorators: [{
1524
+ type: Injectable,
1525
+ args: [{
1526
+ providedIn: 'root',
1527
+ }]
1528
+ }], ctorParameters: () => [] });
1529
+
1448
1530
  /**
1449
1531
  * Signal store that provides a reactive interface for notification-related operations
1450
1532
  * Acts as a layer between notification components and the entity service
@@ -1453,6 +1535,7 @@ class AXMNotificationConnectorService {
1453
1535
  // Effects
1454
1536
  constructor() {
1455
1537
  this.notificationService = inject(AXMNotificationEntityService);
1538
+ this.osNotificationService = inject(AXMOsNotificationService);
1456
1539
  // State signals
1457
1540
  this.isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
1458
1541
  this.error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : []));
@@ -1526,13 +1609,36 @@ class AXMNotificationConnectorService {
1526
1609
  this.isLoading.set(false);
1527
1610
  }
1528
1611
  }
1612
+ async markAllAsRead() {
1613
+ try {
1614
+ this.isLoading.set(true);
1615
+ this.error.set(null);
1616
+ await this.notificationService.markAllAsRead();
1617
+ this.notifications.update((notifications) => notifications.map((notification) => ({ ...notification, readAt: new Date() })));
1618
+ }
1619
+ catch (err) {
1620
+ this.error.set(err instanceof Error ? err.message : 'Failed to mark all notifications as read');
1621
+ }
1622
+ finally {
1623
+ this.isLoading.set(false);
1624
+ }
1625
+ }
1529
1626
  /**
1530
1627
  * Create a new notification
1531
1628
  */
1532
- async create(payload) {
1629
+ async create(payload, options) {
1533
1630
  try {
1534
1631
  this.isLoading.set(true);
1535
1632
  this.error.set(null);
1633
+ //send os notification
1634
+ const isPermissionGranted = await this.osNotificationService.requestPermission();
1635
+ if (payload && isPermissionGranted) {
1636
+ this.osNotificationService.show(payload.title || 'Notification', {
1637
+ body: payload.body || 'No body',
1638
+ icon: payload.user.image || '',
1639
+ ...options,
1640
+ });
1641
+ }
1536
1642
  await this.notificationService.create(payload);
1537
1643
  // Refresh list after creating a notification
1538
1644
  await this.getList();
@@ -1777,7 +1883,7 @@ class AXMAdminNotificationPanelComponent {
1777
1883
  */
1778
1884
  async markAllAsRead() {
1779
1885
  try {
1780
- await this.notificationConnector.markAsRead({ id: [] });
1886
+ await this.notificationConnector.markAllAsRead();
1781
1887
  }
1782
1888
  catch (error) {
1783
1889
  console.error('Failed to mark all notifications as read:', error);
@@ -2965,5 +3071,5 @@ async function notificationLogEntityFactory(injector) {
2965
3071
  * Generated bundle index. Do not edit.
2966
3072
  */
2967
3073
 
2968
- export { AXMNotificationEntityService, AXMNotificationEntityServiceImpl, AXMNotificationManagementChannelEntityService, AXMNotificationManagementChannelEntityServiceImpl, AXMNotificationManagementModule, AXMNotificationManagementTemplateEntityModule, AXMNotificationManagementTemplateEntityService, AXMNotificationManagementTemplateEntityServiceImpl, AXMNotificationManagmentModuleMenuProvider, AXMSettingProvider, AXPMyNotificationDashboardWidget, AXPNotificationWidgetViewComponent, RootConfig, myNotificationEntityFactory, notificationChannelEntityFactory, notificationEntityFactory, notificationLogEntityFactory, notificationTemplateEntityFactory };
3074
+ export { AXMNotificationConnectorService, AXMNotificationEntityService, AXMNotificationEntityServiceImpl, AXMNotificationManagementChannelEntityService, AXMNotificationManagementChannelEntityServiceImpl, AXMNotificationManagementModule, AXMNotificationManagementTemplateEntityModule, AXMNotificationManagementTemplateEntityService, AXMNotificationManagementTemplateEntityServiceImpl, AXMNotificationManagmentModuleMenuProvider, AXMOsNotificationService, AXMSettingProvider, AXPMyNotificationDashboardWidget, AXPNotificationWidgetViewComponent, RootConfig, myNotificationEntityFactory, notificationChannelEntityFactory, notificationEntityFactory, notificationLogEntityFactory, notificationTemplateEntityFactory };
2969
3075
  //# sourceMappingURL=acorex-modules-notification-management.mjs.map