@genesislcap/foundation-notifications 14.52.2 → 14.53.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 (35) hide show
  1. package/dist/dts/notification-builder.d.ts.map +1 -1
  2. package/dist/dts/toast/toast-builder.d.ts +17 -1
  3. package/dist/dts/toast/toast-builder.d.ts.map +1 -1
  4. package/dist/dts/toast/toast-launcher.d.ts.map +1 -1
  5. package/dist/dts/types.d.ts +40 -0
  6. package/dist/dts/types.d.ts.map +1 -1
  7. package/dist/esm/toast/toast-builder.js +26 -0
  8. package/dist/esm/toast/toast-launcher.js +29 -6
  9. package/dist/foundation-notifications.api.json +652 -11
  10. package/dist/foundation-notifications.d.ts +59 -0
  11. package/docs/api/foundation-notifications.md +3 -0
  12. package/docs/api/foundation-notifications.notificationdatarow.alert_id.md +11 -0
  13. package/docs/api/foundation-notifications.notificationdatarow.created_at.md +11 -0
  14. package/docs/api/foundation-notifications.notificationdatarow.details.md +14 -0
  15. package/docs/api/foundation-notifications.notificationdatarow.expiry.md +11 -0
  16. package/docs/api/foundation-notifications.notificationdatarow.header.md +11 -0
  17. package/docs/api/foundation-notifications.notificationdatarow.md +28 -0
  18. package/docs/api/foundation-notifications.notificationdatarow.message.md +11 -0
  19. package/docs/api/foundation-notifications.notificationdatarow.notify_severity.md +11 -0
  20. package/docs/api/foundation-notifications.notificationdatarow.sender.md +11 -0
  21. package/docs/api/foundation-notifications.notificationdatarow.user_name.md +11 -0
  22. package/docs/api/foundation-notifications.notificationseverity.md +13 -0
  23. package/docs/api/foundation-notifications.toast.buttons.md +11 -0
  24. package/docs/api/foundation-notifications.toast.details.md +11 -0
  25. package/docs/api/foundation-notifications.toast.md +2 -0
  26. package/docs/api/foundation-notifications.toastbuilder.md +2 -0
  27. package/docs/api/foundation-notifications.toastbuilder.withbuttons.md +25 -0
  28. package/docs/api/foundation-notifications.toastbuilder.withdetails.md +25 -0
  29. package/docs/api/foundation-notifications.toastbutton.action.md +25 -0
  30. package/docs/api/foundation-notifications.toastbutton.appearance.md +11 -0
  31. package/docs/api/foundation-notifications.toastbutton.condition.md +24 -0
  32. package/docs/api/foundation-notifications.toastbutton.md +28 -0
  33. package/docs/api/foundation-notifications.toastbutton.placeholder.md +11 -0
  34. package/docs/api-report.md +51 -0
  35. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"notification-builder.d.ts","sourceRoot":"","sources":["../../src/notification-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjF;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB;IAKpD;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB;IAKlD;;;;OAIG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,mBAAmB;IAK5D;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB;IAKrD;;;;;OAKG;IACI,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB;IAKnD;;;;;OAKG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;IAKtD;;;;;OAKG;IACI,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,mBAAmB;IAK5D;;;;;O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OAIG;IACI,KAAK,IAAI,qBAAqB;CA+CtC;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,mBAAgD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Toast, ToastPosition, NotificationType } from '../types';
1
+ import { Toast, ToastPosition, NotificationType, NotificationDataRow, ToastButton } from '../types';
2
2
  /**
3
3
  * @public
4
4
  */
@@ -7,6 +7,8 @@ export declare class ToastBuilder {
7
7
  private autoClose;
8
8
  private closeTimeout;
9
9
  private type;
10
+ private details;
11
+ private buttons;
10
12
  /**
11
13
  * Add position to toast
12
14
  * @public
@@ -35,6 +37,20 @@ export declare class ToastBuilder {
35
37
  * @returns
36
38
  */
37
39
  withType(type: NotificationType): ToastBuilder;
40
+ /**
41
+ * Add details data to notifications
42
+ * @public
43
+ * @param details - NotificationDataRow
44
+ * @returns
45
+ */
46
+ withDetails(details: NotificationDataRow): ToastBuilder;
47
+ /**
48
+ * Add buttons to notifications
49
+ * @public
50
+ * @param buttons - ToastButton[]
51
+ * @returns
52
+ */
53
+ withButtons(buttons: ToastButton[]): ToastBuilder;
38
54
  /**
39
55
  * Build notification
40
56
  * @returns Toast
@@ -1 +1 @@
1
- {"version":3,"file":"toast-builder.d.ts","sourceRoot":"","sources":["../../../src/toast/toast-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAElE;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,IAAI,CAAmB;IAE/B;;;;;OAKG;IACI,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAK1D;;;;;OAKG;IACI,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY;IAKtD;;;;;OAKG;IACI,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY;IAK3D;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY;IAKrD;;;OAGG;IACI,KAAK,IAAI,KAAK;CAgBtB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,YAAkC,CAAC"}
1
+ {"version":3,"file":"toast-builder.d.ts","sourceRoot":"","sources":["../../../src/toast/toast-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpG;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;;OAKG;IACI,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAK1D;;;;;OAKG;IACI,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,YAAY;IAKtD;;;;;OAKG;IACI,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,YAAY;IAK3D;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY;IAKrD;;;;;OAKG;IACI,WAAW,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY;IAK9D;;;;;OAKG;IACI,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,YAAY;IAKxD;;;OAGG;IACI,KAAK,IAAI,KAAK;CAuBtB;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,YAAkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast-launcher.d.ts","sourceRoot":"","sources":["../../../src/toast/toast-launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;KAMK;AACL,eAAO,MAAM,SAAS,0BAA2B,qBAAqB,WAAW,MAAM,KAAG,IAqDzF,CAAC"}
1
+ {"version":3,"file":"toast-launcher.d.ts","sourceRoot":"","sources":["../../../src/toast/toast-launcher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;;KAMK;AACL,eAAO,MAAM,SAAS,0BAA2B,qBAAqB,WAAW,MAAM,KAAG,IAmFzF,CAAC"}
@@ -16,6 +16,44 @@ export type NotificationType = 'error' | 'warning' | 'success';
16
16
  * type for notification position
17
17
  */
18
18
  export type ToastPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
19
+ /**
20
+ * type for notification severity
21
+ * @public
22
+ */
23
+ export type NotificationSeverity = 'Information' | 'Warning' | 'Serious' | 'Critical';
24
+ /**
25
+ * Interface for notify data
26
+ * @public
27
+ */
28
+ export interface NotificationDataRow {
29
+ ALERT_ID: string;
30
+ CREATED_AT: number;
31
+ DETAILS: {
32
+ OPERATION: string;
33
+ ROW_REF: string;
34
+ };
35
+ HEADER: string;
36
+ MESSAGE: string;
37
+ NOTIFY_SEVERITY: NotificationSeverity;
38
+ EXPIRY?: null;
39
+ SENDER?: null;
40
+ USER_NAME: string;
41
+ }
42
+ /**
43
+ * Interface for ToastButton
44
+ * @public
45
+ */
46
+ export interface ToastButton {
47
+ action({ details, element }: {
48
+ details: NotificationDataRow;
49
+ element: HTMLElement;
50
+ }): void;
51
+ condition({ details }?: {
52
+ details: NotificationDataRow;
53
+ }): boolean;
54
+ placeholder?: string;
55
+ appearance?: string;
56
+ }
19
57
  /**
20
58
  * Interface for Toast configuration
21
59
  * @public
@@ -25,6 +63,8 @@ export interface Toast {
25
63
  readonly type?: NotificationType;
26
64
  readonly autoClose?: boolean;
27
65
  readonly closeTimeout?: number;
66
+ readonly details?: NotificationDataRow;
67
+ readonly buttons?: ToastButton[];
28
68
  }
29
69
  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KAAK,CAAC,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;QACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;QAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAAE,YAAY,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAExF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC"}
@@ -42,6 +42,26 @@ export class ToastBuilder {
42
42
  this.type = type;
43
43
  return this;
44
44
  }
45
+ /**
46
+ * Add details data to notifications
47
+ * @public
48
+ * @param details - NotificationDataRow
49
+ * @returns
50
+ */
51
+ withDetails(details) {
52
+ this.details = details;
53
+ return this;
54
+ }
55
+ /**
56
+ * Add buttons to notifications
57
+ * @public
58
+ * @param buttons - ToastButton[]
59
+ * @returns
60
+ */
61
+ withButtons(buttons) {
62
+ this.buttons = buttons;
63
+ return this;
64
+ }
45
65
  /**
46
66
  * Build notification
47
67
  * @returns Toast
@@ -60,6 +80,12 @@ export class ToastBuilder {
60
80
  if (this.type) {
61
81
  toast = Object.assign({ type: this.type }, toast);
62
82
  }
83
+ if (this.details) {
84
+ toast = Object.assign({ details: this.details }, toast);
85
+ }
86
+ if (this.buttons) {
87
+ toast = Object.assign({ buttons: this.buttons }, toast);
88
+ }
63
89
  return toast;
64
90
  }
65
91
  }
@@ -7,7 +7,7 @@ import { getNotificationContainer } from '../notification-util';
7
7
  * @returns
8
8
  * */
9
9
  export const showToast = (notificationStructure, tagName) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
11
11
  const tagPrefix = tagName.split('-')[0];
12
12
  const container = getNotificationContainer('notify-container', tagName);
13
13
  if (container) {
@@ -40,15 +40,38 @@ export const showToast = (notificationStructure, tagName) => {
40
40
  const toastDate = document.createElement('div');
41
41
  toastDate.setAttribute('slot', 'date');
42
42
  toastDate.textContent = new Date().toLocaleTimeString();
43
- toastNotify.setAttribute('notify', ((_d = (_c = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _c === void 0 ? void 0 : _c.toast) === null || _d === void 0 ? void 0 : _d.type) || '');
44
- ((_f = (_e = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _e === void 0 ? void 0 : _e.toast) === null || _f === void 0 ? void 0 : _f.autoClose)
45
- ? toastNotify.setAttribute('auto-close', `${(_h = (_g = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _g === void 0 ? void 0 : _g.toast) === null || _h === void 0 ? void 0 : _h.autoClose}`)
43
+ let toastBottom;
44
+ if (((_d = (_c = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _c === void 0 ? void 0 : _c.toast) === null || _d === void 0 ? void 0 : _d.buttons) &&
45
+ ((_g = (_f = (_e = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _e === void 0 ? void 0 : _e.toast) === null || _f === void 0 ? void 0 : _f.buttons) === null || _g === void 0 ? void 0 : _g.length)) {
46
+ toastBottom = document.createElement('div');
47
+ toastBottom.setAttribute('slot', 'bottom');
48
+ notificationStructure.config.toast.buttons.forEach((button) => {
49
+ const buttonElement = document.createElement(`${tagPrefix}-button`);
50
+ buttonElement.textContent = button.placeholder || 'example placeholder';
51
+ buttonElement.addEventListener('click', () => {
52
+ const { details } = notificationStructure.config.toast;
53
+ if (button.action) {
54
+ return button.action({ details, element: buttonElement });
55
+ }
56
+ });
57
+ if (button.appearance) {
58
+ buttonElement.setAttribute('appearance', button.appearance);
59
+ }
60
+ toastBottom.appendChild(buttonElement);
61
+ });
62
+ }
63
+ toastNotify.setAttribute('notify', ((_j = (_h = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _h === void 0 ? void 0 : _h.toast) === null || _j === void 0 ? void 0 : _j.type) || '');
64
+ ((_l = (_k = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _k === void 0 ? void 0 : _k.toast) === null || _l === void 0 ? void 0 : _l.autoClose)
65
+ ? toastNotify.setAttribute('auto-close', `${(_o = (_m = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _m === void 0 ? void 0 : _m.toast) === null || _o === void 0 ? void 0 : _o.autoClose}`)
46
66
  : '';
47
- ((_k = (_j = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _j === void 0 ? void 0 : _j.toast) === null || _k === void 0 ? void 0 : _k.closeTimeout)
48
- ? toastNotify.setAttribute('close-timeout', `${(_m = (_l = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _l === void 0 ? void 0 : _l.toast) === null || _m === void 0 ? void 0 : _m.closeTimeout}`)
67
+ ((_q = (_p = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _p === void 0 ? void 0 : _p.toast) === null || _q === void 0 ? void 0 : _q.closeTimeout)
68
+ ? toastNotify.setAttribute('close-timeout', `${(_s = (_r = notificationStructure === null || notificationStructure === void 0 ? void 0 : notificationStructure.config) === null || _r === void 0 ? void 0 : _r.toast) === null || _s === void 0 ? void 0 : _s.closeTimeout}`)
49
69
  : '';
50
70
  toastNotify.appendChild(toastTitle);
51
71
  toastNotify.appendChild(toastDetails);
52
72
  toastNotify.appendChild(toastDate);
73
+ if (toastBottom) {
74
+ toastNotify.appendChild(toastBottom);
75
+ }
53
76
  container.appendChild(toastNotify);
54
77
  };