@genesislcap/pbc-notify-ui 14.454.2 → 14.455.1

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 (23) hide show
  1. package/dist/dts/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.d.ts.map +1 -1
  2. package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts +2 -0
  3. package/dist/dts/components/foundation-inbox/inbox-base/inbox-base.d.ts.map +1 -1
  4. package/dist/dts/components/foundation-inbox/inbox.styles.d.ts.map +1 -1
  5. package/dist/dts/components/foundation-inbox/inbox.template.d.ts.map +1 -1
  6. package/dist/dts/services/inbox.service.d.ts +17 -1
  7. package/dist/dts/services/inbox.service.d.ts.map +1 -1
  8. package/dist/dts/utils/updateArray.d.ts +8 -1
  9. package/dist/dts/utils/updateArray.d.ts.map +1 -1
  10. package/dist/esm/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.js +8 -1
  11. package/dist/esm/components/foundation-inbox/inbox-base/inbox-base.js +12 -3
  12. package/dist/esm/components/foundation-inbox/inbox.styles.js +6 -0
  13. package/dist/esm/components/foundation-inbox/inbox.template.js +7 -0
  14. package/dist/esm/services/inbox.service.js +34 -7
  15. package/dist/esm/utils/updateArray.js +14 -2
  16. package/dist/pbc-notify-ui.d.ts +14 -1
  17. package/package.json +22 -22
  18. package/src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.ts +10 -0
  19. package/src/components/foundation-inbox/inbox-base/inbox-base.ts +9 -2
  20. package/src/components/foundation-inbox/inbox.styles.ts +6 -0
  21. package/src/components/foundation-inbox/inbox.template.ts +10 -0
  22. package/src/services/inbox.service.ts +65 -7
  23. package/src/utils/updateArray.ts +17 -2
@@ -1 +1 @@
1
- {"version":3,"file":"foundation-inbox-counter.d.ts","sourceRoot":"","sources":["../../../../../../src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAK5E,qBAKa,sBAAuB,SAAQ,cAAc;IAC5C,KAAK,EAAE,MAAM,CAAK;IACrB,OAAO,EAAE,OAAO,CAAC;IACF,YAAY,EAAE,sBAAsB,CAAC;IAC7D,OAAO,CAAC,aAAa,CAAe;IAE9B,iBAAiB;IAUvB,oBAAoB;IAOpB;;;OAGG;YACW,iBAAiB;IAU/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAEzB;CACH"}
1
+ {"version":3,"file":"foundation-inbox-counter.d.ts","sourceRoot":"","sources":["../../../../../../src/components/foundation-inbox/components/foundation-inbox-counter/foundation-inbox-counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAElF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAW5E,qBAKa,sBAAuB,SAAQ,cAAc;IAC5C,KAAK,EAAE,MAAM,CAAK;IACrB,OAAO,EAAE,OAAO,CAAC;IACF,YAAY,EAAE,sBAAsB,CAAC;IAC7D,OAAO,CAAC,aAAa,CAAe;IAE9B,iBAAiB;IAUvB,oBAAoB;IAOpB;;;OAGG;YACW,iBAAiB;IAc/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB,CAEzB;CACH"}
@@ -15,6 +15,7 @@ export declare class FoundationInboxBase extends GenesisElement {
15
15
  private connectionSub;
16
16
  private alerts;
17
17
  alertsFilter: Alert[];
18
+ moreAlerts: boolean;
18
19
  ruleService: RuleService;
19
20
  rules: Rule[];
20
21
  rulesFilter: Rule[];
@@ -43,6 +44,7 @@ export declare class FoundationInboxBase extends GenesisElement {
43
44
  severityTypeChanged(): void;
44
45
  inboxTabChanged(inboxTab: InboxTab): Promise<void>;
45
46
  alertsChanged: () => Alert[];
47
+ loadMoreAlerts(): void;
46
48
  rulesChanged: () => Rule[];
47
49
  templatesChanged: () => RuleTemplate[];
48
50
  debouncedFilterSearchAlertLog: any;
@@ -1 +1 @@
1
- {"version":3,"file":"inbox-base.d.ts","sourceRoot":"","sources":["../../../../../src/components/foundation-inbox/inbox-base/inbox-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAEL,UAAU,EAKX,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,EACL,KAAK,EACL,QAAQ,EACR,6BAA6B,EAC7B,IAAI,EAEJ,YAAY,EACb,MAAM,gBAAgB,CAAC;AAgBxB,qBAAa,mBAAoB,SAAQ,cAAc;IAC/C,IAAI,EAAE,IAAI,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IAEZ,YAAY,EAAE,YAAY,CAAC;IACjB,YAAY,EAAE,sBAAsB,CAAC;IAC7D,OAAO,CAAC,aAAa,CAAe;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,YAAY,EAAE,KAAK,EAAE,CAAM;IAE1B,WAAW,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,WAAW,EAAE,IAAI,EAAE,CAAM;IAEpB,eAAe,EAAE,eAAe,CAAC;IACtC,SAAS,EAAE,YAAY,EAAE,CAAM;IAC/B,eAAe,EAAE,YAAY,EAAE,CAAM;IAErC,cAAc,EAAE,MAAM,CAAQ;IAC9B,gBAAgB,EAAE,MAAM,CAAQ;IAChC,eAAe,EAAE,MAAM,CAAQ;IAE/B,eAAe,EAAE,MAAM,CAAQ;IAC/B,mBAAmB,EAAE,6BAA6B,CAAQ;IAC1D,WAAW,EAAE,QAAQ,CAAuB;IAE5C,mBAAmB,EAAE,MAAM,CAAQ;IACnC,iBAAiB,EAAE,MAAM,CAAQ;IAEjC,wBAAwB,EAAE,UAAU,CAAC;IACrC,OAAO,EAAE,OAAO,CAAS;IACzB,aAAa,EAAE,MAAM,CAAS;IAC9B,oBAAoB,EAAE,OAAO,CAAS;IAEtC,YAAY,QAAM;IAEvB,IAAI,EAAE,IAAI,CAAC;IAEZ,iBAAiB;IAqBvB,oBAAoB;IAMpB,iBAAiB,GAAI;;KAAS,UAG5B;IAEF,mBAAmB;IAKb,eAAe,CAAC,QAAQ,EAAE,QAAQ;IA+BxC,aAAa,gBAA2C;IAExD,YAAY,eAAyC;IAErD,gBAAgB,uBAAiD;IAEjE,6BAA6B,MAAsD;IAEnF,oBAAoB;IAgEpB,oBAAoB;IAKpB,qBAAqB;IAWrB,WAAW;IAaX,YAAY,CAAC,OAAO,EAAE,MAAM;IAI5B,gBAAgB,CAAC,QAAQ,KAAA;IASzB,gBAAgB;IA4BhB,SAAS;IAEH,cAAc,CAAC,WAAW,EAAE,IAAI;IAgBhC,WAAW,CAAC,WAAW,EAAE,IAAI;IAO7B,wBAAwB,CAAC,YAAY,EAAE,GAAG;IAYhD,6BAA6B,CAAC,IAAI,CAAC,EAAE,MAAM;CAG5C"}
1
+ {"version":3,"file":"inbox-base.d.ts","sourceRoot":"","sources":["../../../../../src/components/foundation-inbox/inbox-base/inbox-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAEL,UAAU,EAKX,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAKnE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAGrE,OAAO,EACL,KAAK,EACL,QAAQ,EACR,6BAA6B,EAC7B,IAAI,EAEJ,YAAY,EACb,MAAM,gBAAgB,CAAC;AAgBxB,qBAAa,mBAAoB,SAAQ,cAAc;IAC/C,IAAI,EAAE,IAAI,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IAEZ,YAAY,EAAE,YAAY,CAAC;IACjB,YAAY,EAAE,sBAAsB,CAAC;IAC7D,OAAO,CAAC,aAAa,CAAe;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,YAAY,EAAE,KAAK,EAAE,CAAM;IAC3B,UAAU,EAAE,OAAO,CAAS;IAE3B,WAAW,EAAE,WAAW,CAAC;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAM;IACnB,WAAW,EAAE,IAAI,EAAE,CAAM;IAEpB,eAAe,EAAE,eAAe,CAAC;IACtC,SAAS,EAAE,YAAY,EAAE,CAAM;IAC/B,eAAe,EAAE,YAAY,EAAE,CAAM;IAErC,cAAc,EAAE,MAAM,CAAQ;IAC9B,gBAAgB,EAAE,MAAM,CAAQ;IAChC,eAAe,EAAE,MAAM,CAAQ;IAE/B,eAAe,EAAE,MAAM,CAAQ;IAC/B,mBAAmB,EAAE,6BAA6B,CAAQ;IAC1D,WAAW,EAAE,QAAQ,CAAuB;IAE5C,mBAAmB,EAAE,MAAM,CAAQ;IACnC,iBAAiB,EAAE,MAAM,CAAQ;IAEjC,wBAAwB,EAAE,UAAU,CAAC;IACrC,OAAO,EAAE,OAAO,CAAS;IACzB,aAAa,EAAE,MAAM,CAAS;IAC9B,oBAAoB,EAAE,OAAO,CAAS;IAEtC,YAAY,QAAM;IAEvB,IAAI,EAAE,IAAI,CAAC;IAEZ,iBAAiB;IAsBvB,oBAAoB;IAMpB,iBAAiB,GAAI;;KAAS,UAI5B;IAEF,mBAAmB;IAKb,eAAe,CAAC,QAAQ,EAAE,QAAQ;IA+BxC,aAAa,gBAA2C;IAExD,cAAc;IAId,YAAY,eAAyC;IAErD,gBAAgB,uBAAiD;IAEjE,6BAA6B,MAAsD;IAEnF,oBAAoB;IAgEpB,oBAAoB;IAKpB,qBAAqB;IAWrB,WAAW;IAaX,YAAY,CAAC,OAAO,EAAE,MAAM;IAI5B,gBAAgB,CAAC,QAAQ,KAAA;IASzB,gBAAgB;IA4BhB,SAAS;IAEH,cAAc,CAAC,WAAW,EAAE,IAAI;IAgBhC,WAAW,CAAC,WAAW,EAAE,IAAI;IAO7B,wBAAwB,CAAC,YAAY,EAAE,GAAG;IAYhD,6BAA6B,CAAC,IAAI,CAAC,EAAE,MAAM;CAG5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"inbox.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation-inbox/inbox.styles.ts"],"names":[],"mappings":"AA4JA,eAAO,MAAM,WAAW,iDA+BvB,CAAC;AAEF,eAAO,MAAM,yBAAyB,iDAwErC,CAAC;AAEF,eAAO,MAAM,aAAa,iDAYzB,CAAC;AAEF,eAAO,MAAM,SAAS,iDAYrB,CAAC;AAEF,eAAO,MAAM,eAAe,iDAmF3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,iDAyBjC,CAAC"}
1
+ {"version":3,"file":"inbox.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation-inbox/inbox.styles.ts"],"names":[],"mappings":"AA4JA,eAAO,MAAM,WAAW,iDA+BvB,CAAC;AAEF,eAAO,MAAM,yBAAyB,iDA8ErC,CAAC;AAEF,eAAO,MAAM,aAAa,iDAYzB,CAAC;AAEF,eAAO,MAAM,SAAS,iDAYrB,CAAC;AAEF,eAAO,MAAM,eAAe,iDAmF3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,iDAyBjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"inbox.template.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation-inbox/inbox.template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAyL/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,sEAoJnC,CAAC"}
1
+ {"version":3,"file":"inbox.template.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation-inbox/inbox.template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAmM/C;;GAEG;AACH,eAAO,MAAM,uBAAuB,sEAoJnC,CAAC"}
@@ -1,6 +1,12 @@
1
1
  import { SocketSubscription } from '@genesislcap/foundation-comms';
2
+ /**
3
+ * Number of alert rows fetched per data server batch. The first batch is loaded
4
+ * on subscribe; subsequent batches are fetched via {@link FoundationInboxService.getMoreRows}.
5
+ */
6
+ export declare const INBOX_PAGE_SIZE = 20;
2
7
  export interface FoundationInboxServiceStore {
3
8
  items: Array<any>;
9
+ moreRows: boolean;
4
10
  }
5
11
  export type SubscribeCallback = ({ store }: {
6
12
  store: FoundationInboxServiceStore;
@@ -10,8 +16,18 @@ export type Subscription = {
10
16
  socketSubscription: SocketSubscription;
11
17
  };
12
18
  export interface FoundationInboxService {
13
- subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string): void;
19
+ /**
20
+ * Subscribes to the alerts stream.
21
+ * @param maxRows - when provided, limits the initial batch (enabling
22
+ * {@link FoundationInboxService.getMoreRows} pagination). Omit to stream the
23
+ * full result set, e.g. for an unread counter that needs the total.
24
+ * @param fields - comma-separated list of fields to return. Omit for all
25
+ * fields; pass a minimal set (e.g. just the id) when only the row count
26
+ * matters, to keep the payload small.
27
+ */
28
+ subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string, maxRows?: number, fields?: string): void;
14
29
  unsubscribe(callback: SubscribeCallback): void;
30
+ getMoreRows(): void;
15
31
  }
16
32
  export declare const FoundationInboxService: import("@microsoft/fast-foundation").InterfaceSymbol<FoundationInboxService>;
17
33
  //# sourceMappingURL=inbox.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inbox.service.d.ts","sourceRoot":"","sources":["../../../src/services/inbox.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAIpG,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,2BAA2B,CAAA;CAAE,KAAK,GAAG,CAAC;AAE3F,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtF,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAChD;AAgED,eAAO,MAAM,sBAAsB,8EAElC,CAAC"}
1
+ {"version":3,"file":"inbox.service.d.ts","sourceRoot":"","sources":["../../../src/services/inbox.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAIpG;;;GAGG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,2BAA2B,CAAA;CAAE,KAAK,GAAG,CAAC;AAE3F,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,SAAS,CACP,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,IAAI,CAAC;IACR,WAAW,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/C,WAAW,IAAI,IAAI,CAAC;CACrB;AAmGD,eAAO,MAAM,sBAAsB,8EAElC,CAAC"}
@@ -1,2 +1,9 @@
1
- export declare const updateArray: (newData: Array<any>, oldData: Array<any>) => Array<any>;
1
+ /**
2
+ * Merges streamed data server rows into the existing list.
3
+ *
4
+ * New INSERT rows are prepended by default so real-time alerts surface at the
5
+ * top. When {@link append} is set (e.g. for `getMoreRows` pagination batches),
6
+ * rows are appended instead so they continue the existing order at the bottom.
7
+ */
8
+ export declare const updateArray: (newData: Array<any>, oldData: Array<any>, append?: boolean) => Array<any>;
2
9
  //# sourceMappingURL=updateArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateArray.d.ts","sourceRoot":"","sources":["../../../src/utils/updateArray.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,SAAS,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,KAAG,KAAK,CAAC,GAAG,CAgC/E,CAAC"}
1
+ {"version":3,"file":"updateArray.d.ts","sourceRoot":"","sources":["../../../src/utils/updateArray.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,KAAK,CAAC,GAAG,CAAC,EACnB,SAAS,KAAK,CAAC,GAAG,CAAC,EACnB,gBAAc,KACb,KAAK,CAAC,GAAG,CAoCX,CAAC"}
@@ -5,6 +5,11 @@ import { FoundationInboxService } from '../../../../services/inbox.service';
5
5
  import { AlertStatus } from '../../inbox.types';
6
6
  import { FoundationInboxCounterStyles } from './foundation-inbox-counter.styles';
7
7
  import { FoundationInboxCounterTemplate } from './foundation-inbox-counter.template';
8
+ /**
9
+ * The counter renders "99+" once the count exceeds 99, so there is no need to
10
+ * stream more than 100 rows just to know the total to display.
11
+ */
12
+ const COUNTER_MAX_ROWS = 100;
8
13
  let FoundationInboxCounter = class FoundationInboxCounter extends GenesisElement {
9
14
  constructor() {
10
15
  super(...arguments);
@@ -43,7 +48,9 @@ let FoundationInboxCounter = class FoundationInboxCounter extends GenesisElement
43
48
  subscribeToAlerts() {
44
49
  return __awaiter(this, void 0, void 0, function* () {
45
50
  this.inboxService.unsubscribe(this.subscriptionHandler);
46
- this.inboxService.subscribe(this.subscriptionHandler, false, `ALERT_STATUS=='${AlertStatus.NEW}'`);
51
+ // Only the row count matters here: cap rows at the display ceiling and
52
+ // request just the id to keep the payload small.
53
+ this.inboxService.subscribe(this.subscriptionHandler, false, `ALERT_STATUS=='${AlertStatus.NEW}'`, COUNTER_MAX_ROWS, 'ALERT_ID');
47
54
  });
48
55
  }
49
56
  };
@@ -7,7 +7,7 @@ import dayjs from 'dayjs';
7
7
  import utc from 'dayjs/plugin/utc';
8
8
  import debounce from 'lodash.debounce';
9
9
  import { AlertService } from '../../../services/alert.service';
10
- import { FoundationInboxService } from '../../../services/inbox.service';
10
+ import { FoundationInboxService, INBOX_PAGE_SIZE } from '../../../services/inbox.service';
11
11
  import { RuleService } from '../../../services/rule.service';
12
12
  import { TemplateService } from '../../../services/template.service';
13
13
  import { logger } from '../../../utils';
@@ -28,6 +28,7 @@ export class FoundationInboxBase extends GenesisElement {
28
28
  super(...arguments);
29
29
  this.alerts = [];
30
30
  this.alertsFilter = [];
31
+ this.moreAlerts = false;
31
32
  this.rules = [];
32
33
  this.rulesFilter = [];
33
34
  this.templates = [];
@@ -45,7 +46,9 @@ export class FoundationInboxBase extends GenesisElement {
45
46
  this.showLoadingIndicator = false;
46
47
  this.severityType = [];
47
48
  this.alertSubscription = ({ store }) => {
49
+ var _a;
48
50
  this.alerts = (store === null || store === void 0 ? void 0 : store.items) || [];
51
+ this.moreAlerts = (_a = store === null || store === void 0 ? void 0 : store.moreRows) !== null && _a !== void 0 ? _a : false;
49
52
  this.showLoadingIndicator = false;
50
53
  };
51
54
  // #endregion
@@ -65,7 +68,7 @@ export class FoundationInboxBase extends GenesisElement {
65
68
  this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => {
66
69
  if (isConnected) {
67
70
  this.inboxService.unsubscribe(this.alertSubscription);
68
- this.inboxService.subscribe(this.alertSubscription, false, criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build());
71
+ this.inboxService.subscribe(this.alertSubscription, false, criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build(), INBOX_PAGE_SIZE);
69
72
  }
70
73
  });
71
74
  this.rules = yield this.ruleService.getRules();
@@ -106,6 +109,9 @@ export class FoundationInboxBase extends GenesisElement {
106
109
  }
107
110
  });
108
111
  }
112
+ loadMoreAlerts() {
113
+ this.inboxService.getMoreRows();
114
+ }
109
115
  filterSearchAlertLog() {
110
116
  this.showLoadingIndicator = true;
111
117
  const filterCriteria = criteriaBuilder();
@@ -136,7 +142,7 @@ export class FoundationInboxBase extends GenesisElement {
136
142
  // Refresh the data subscription
137
143
  this.inboxService.unsubscribe(this.alertSubscription);
138
144
  const criteria = filterCriteria.build();
139
- this.inboxService.subscribe(this.alertSubscription, this.reverse, criteria);
145
+ this.inboxService.subscribe(this.alertSubscription, this.reverse, criteria, INBOX_PAGE_SIZE);
140
146
  }
141
147
  sortDirectionChanged() {
142
148
  this.reverse = this.sortDirection === 'Asc';
@@ -251,6 +257,9 @@ __decorate([
251
257
  __decorate([
252
258
  observable
253
259
  ], FoundationInboxBase.prototype, "alertsFilter", void 0);
260
+ __decorate([
261
+ observable
262
+ ], FoundationInboxBase.prototype, "moreAlerts", void 0);
254
263
  __decorate([
255
264
  RuleService
256
265
  ], FoundationInboxBase.prototype, "ruleService", void 0);
@@ -247,6 +247,12 @@ export const alertsNewAndAlertsHistory = css `
247
247
  color: var(--neutral-stroke-rest);
248
248
  }
249
249
 
250
+ .load-more-container {
251
+ display: flex;
252
+ justify-content: center;
253
+ padding: calc(var(--design-unit) * 2px);
254
+ }
255
+
250
256
  .loading-indicator {
251
257
  border: calc(var(--stroke-width) * 1px) solid var(--neutral-fill-input-rest);
252
258
  background: var(--neutral-layer-3);
@@ -159,6 +159,13 @@ const alertsTab = (tab) => html `
159
159
  ${when((x) => x.alertsFilter.length === 0 && !x.showLoadingIndicator, html `
160
160
  <div class="no-row-container">No Alerts To Show</div>
161
161
  `)}
162
+ ${when((x) => x.moreAlerts && !x.showLoadingIndicator, html `
163
+ <div class="load-more-container">
164
+ <rapid-button class="load-more" @click=${(x) => x.loadMoreAlerts()}>
165
+ Load More
166
+ </rapid-button>
167
+ </div>
168
+ `)}
162
169
  ${when((x) => x.showLoadingIndicator, html `
163
170
  <div class="no-row-container">
164
171
  <div class="loading-indicator">Loading...</div>
@@ -2,31 +2,56 @@ import { __decorate } from "tslib";
2
2
  import { Auth, Connect } from '@genesislcap/foundation-comms';
3
3
  import { DI } from '@genesislcap/web-core';
4
4
  import { logger, updateArray } from '../utils';
5
+ /**
6
+ * Number of alert rows fetched per data server batch. The first batch is loaded
7
+ * on subscribe; subsequent batches are fetched via {@link FoundationInboxService.getMoreRows}.
8
+ */
9
+ export const INBOX_PAGE_SIZE = 20;
5
10
  class FoundationInboxServiceImpl {
6
11
  constructor() {
7
12
  this.subscriptions = [];
13
+ this.sourceRef = null;
14
+ this.fetchingMore = false;
8
15
  this.store = {
9
16
  items: [],
17
+ moreRows: false,
10
18
  };
11
19
  }
12
- getStream(reverse, criteriaMatch) {
20
+ getStream(reverse, criteriaMatch, maxRows, fields) {
13
21
  return this.connect.stream('ALL_NOTIFY_ALERT_RECORDS', (result) => {
22
+ var _a;
14
23
  if (result.ERROR) {
15
24
  logger.error(result.ERROR);
16
25
  return;
17
26
  }
18
- this.store.items = updateArray(result === null || result === void 0 ? void 0 : result.ROW, this.store.items);
27
+ if (result.SOURCE_REF) {
28
+ this.sourceRef = result.SOURCE_REF;
29
+ }
30
+ this.store.moreRows = Boolean(result.MORE_ROWS);
31
+ // getMoreRows batches continue the existing order, so append them
32
+ // rather than prepending like real-time inserts.
33
+ const append = this.fetchingMore;
34
+ this.store.items = updateArray(result === null || result === void 0 ? void 0 : result.ROW, this.store.items, append);
35
+ if (append && ((_a = result === null || result === void 0 ? void 0 : result.ROW) === null || _a === void 0 ? void 0 : _a.length)) {
36
+ this.fetchingMore = false;
37
+ }
19
38
  this.subscriptions.forEach((subscription) => {
20
39
  subscription.callback({ store: this.store });
21
40
  });
22
- }, (response) => logger.error(response), Object.assign({ REVERSE: reverse }, (criteriaMatch != '' && { CRITERIA_MATCH: criteriaMatch })));
41
+ }, (response) => logger.error(response), Object.assign(Object.assign(Object.assign({ REVERSE: reverse }, (maxRows != null && { MAX_ROWS: maxRows })), (fields && { FIELDS: fields })), (criteriaMatch != '' && { CRITERIA_MATCH: criteriaMatch })));
42
+ }
43
+ getMoreRows() {
44
+ if (this.sourceRef) {
45
+ this.fetchingMore = true;
46
+ this.connect.getMoreRows(this.sourceRef);
47
+ }
23
48
  }
24
- subscribe(callback, reverse, criteriaMatch) {
49
+ subscribe(callback, reverse, criteriaMatch, maxRows, fields) {
25
50
  if (this.stream) {
26
51
  callback({ store: this.store });
27
52
  return;
28
53
  }
29
- this.stream = this.getStream(reverse, criteriaMatch);
54
+ this.stream = this.getStream(reverse, criteriaMatch, maxRows, fields);
30
55
  const socketSubscription = this.stream.subscribe();
31
56
  this.subscriptions.push({ callback, socketSubscription });
32
57
  }
@@ -36,11 +61,13 @@ class FoundationInboxServiceImpl {
36
61
  const found = this.subscriptions.splice(index, 1);
37
62
  found.forEach((subscription) => {
38
63
  subscription.socketSubscription.unsubscribe();
39
- subscription.callback({ store: { items: [] } });
64
+ subscription.callback({ store: { items: [], moreRows: false } });
40
65
  });
41
66
  }
42
67
  this.stream = undefined;
43
- this.store = { items: [] };
68
+ this.sourceRef = null;
69
+ this.fetchingMore = false;
70
+ this.store = { items: [], moreRows: false };
44
71
  }
45
72
  }
46
73
  __decorate([
@@ -1,4 +1,11 @@
1
- export const updateArray = (newData, oldData) => {
1
+ /**
2
+ * Merges streamed data server rows into the existing list.
3
+ *
4
+ * New INSERT rows are prepended by default so real-time alerts surface at the
5
+ * top. When {@link append} is set (e.g. for `getMoreRows` pagination batches),
6
+ * rows are appended instead so they continue the existing order at the bottom.
7
+ */
8
+ export const updateArray = (newData, oldData, append = false) => {
2
9
  if (newData && oldData && oldData.length > 0) {
3
10
  newData.forEach((row) => {
4
11
  const eventData = row;
@@ -7,7 +14,12 @@ export const updateArray = (newData, oldData) => {
7
14
  const type = eventData.DETAILS.OPERATION;
8
15
  if (type === 'INSERT') {
9
16
  if (!oldData.find((x) => { var _a; return ((_a = x.DETAILS) === null || _a === void 0 ? void 0 : _a.ROW_REF) === ref; })) {
10
- oldData.unshift(eventData);
17
+ if (append) {
18
+ oldData.push(eventData);
19
+ }
20
+ else {
21
+ oldData.unshift(eventData);
22
+ }
11
23
  }
12
24
  }
13
25
  if (type === 'DELETE') {
@@ -52,6 +52,7 @@ declare class FoundationInboxBase extends GenesisElement {
52
52
  private connectionSub;
53
53
  private alerts;
54
54
  alertsFilter: Alert[];
55
+ moreAlerts: boolean;
55
56
  ruleService: RuleService;
56
57
  rules: Rule_2[];
57
58
  rulesFilter: Rule_2[];
@@ -80,6 +81,7 @@ declare class FoundationInboxBase extends GenesisElement {
80
81
  severityTypeChanged(): void;
81
82
  inboxTabChanged(inboxTab: InboxTab): Promise<void>;
82
83
  alertsChanged: () => Alert[];
84
+ loadMoreAlerts(): void;
83
85
  rulesChanged: () => Rule_2[];
84
86
  templatesChanged: () => RuleTemplate[];
85
87
  debouncedFilterSearchAlertLog: any;
@@ -128,14 +130,25 @@ export declare class FoundationInboxFlyout extends FoundationInboxBase {
128
130
  }
129
131
 
130
132
  declare interface FoundationInboxService {
131
- subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string): void;
133
+ /**
134
+ * Subscribes to the alerts stream.
135
+ * @param maxRows - when provided, limits the initial batch (enabling
136
+ * {@link FoundationInboxService.getMoreRows} pagination). Omit to stream the
137
+ * full result set, e.g. for an unread counter that needs the total.
138
+ * @param fields - comma-separated list of fields to return. Omit for all
139
+ * fields; pass a minimal set (e.g. just the id) when only the row count
140
+ * matters, to keep the payload small.
141
+ */
142
+ subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string, maxRows?: number, fields?: string): void;
132
143
  unsubscribe(callback: SubscribeCallback): void;
144
+ getMoreRows(): void;
133
145
  }
134
146
 
135
147
  declare const FoundationInboxService: InterfaceSymbol<FoundationInboxService>;
136
148
 
137
149
  declare interface FoundationInboxServiceStore {
138
150
  items: Array<any>;
151
+ moreRows: boolean;
139
152
  }
140
153
 
141
154
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/pbc-notify-ui",
3
3
  "description": "Genesis PBC Notify UI",
4
- "version": "14.454.2",
4
+ "version": "14.455.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "workspaces": [
7
7
  "client"
@@ -83,34 +83,34 @@
83
83
  "@commitlint/format": "^19.0.3",
84
84
  "@genesiscommunitysuccess/cep-fast-plugin": "5.0.3",
85
85
  "@genesiscommunitysuccess/custom-elements-lsp": "5.0.3",
86
- "@genesislcap/design-system-configurator": "14.454.2",
87
- "@genesislcap/eslint-config": "14.454.2",
88
- "@genesislcap/eslint-stylelint-builder": "14.454.2",
89
- "@genesislcap/foundation-testing": "14.454.2",
90
- "@genesislcap/genx": "14.454.2",
91
- "@genesislcap/prettier-config": "14.454.2",
92
- "@genesislcap/stylelint-config": "14.454.2",
93
- "@genesislcap/vite-builder": "14.454.2",
94
- "@genesislcap/webpack-builder": "14.454.2",
86
+ "@genesislcap/design-system-configurator": "14.455.1",
87
+ "@genesislcap/eslint-config": "14.455.1",
88
+ "@genesislcap/eslint-stylelint-builder": "14.455.1",
89
+ "@genesislcap/foundation-testing": "14.455.1",
90
+ "@genesislcap/genx": "14.455.1",
91
+ "@genesislcap/prettier-config": "14.455.1",
92
+ "@genesislcap/stylelint-config": "14.455.1",
93
+ "@genesislcap/vite-builder": "14.455.1",
94
+ "@genesislcap/webpack-builder": "14.455.1",
95
95
  "dayjs": "^1.11.7"
96
96
  },
97
97
  "dependencies": {
98
- "@genesislcap/foundation-comms": "14.454.2",
99
- "@genesislcap/foundation-criteria": "14.454.2",
100
- "@genesislcap/foundation-entity-management": "14.454.2",
101
- "@genesislcap/foundation-forms": "14.454.2",
102
- "@genesislcap/foundation-layout": "14.454.2",
103
- "@genesislcap/foundation-logger": "14.454.2",
104
- "@genesislcap/foundation-notifications": "14.454.2",
105
- "@genesislcap/foundation-utils": "14.454.2",
106
- "@genesislcap/rapid-design-system": "14.454.2",
107
- "@genesislcap/rapid-grid-pro": "14.454.2",
108
- "@genesislcap/web-core": "14.454.2",
98
+ "@genesislcap/foundation-comms": "14.455.1",
99
+ "@genesislcap/foundation-criteria": "14.455.1",
100
+ "@genesislcap/foundation-entity-management": "14.455.1",
101
+ "@genesislcap/foundation-forms": "14.455.1",
102
+ "@genesislcap/foundation-layout": "14.455.1",
103
+ "@genesislcap/foundation-logger": "14.455.1",
104
+ "@genesislcap/foundation-notifications": "14.455.1",
105
+ "@genesislcap/foundation-utils": "14.455.1",
106
+ "@genesislcap/rapid-design-system": "14.455.1",
107
+ "@genesislcap/rapid-grid-pro": "14.455.1",
108
+ "@genesislcap/web-core": "14.455.1",
109
109
  "lodash.debounce": "^4.0.8",
110
110
  "rxjs": "^7.5.4"
111
111
  },
112
112
  "publishConfig": {
113
113
  "access": "public"
114
114
  },
115
- "gitHead": "a1a8b8d443bbee39202b5ab98aa6daebcb425e19"
115
+ "gitHead": "241f307737ad1b5c690bb4c947e61b2697159196"
116
116
  }
@@ -6,6 +6,12 @@ import { AlertStatus } from '../../inbox.types';
6
6
  import { FoundationInboxCounterStyles } from './foundation-inbox-counter.styles';
7
7
  import { FoundationInboxCounterTemplate } from './foundation-inbox-counter.template';
8
8
 
9
+ /**
10
+ * The counter renders "99+" once the count exceeds 99, so there is no need to
11
+ * stream more than 100 rows just to know the total to display.
12
+ */
13
+ const COUNTER_MAX_ROWS = 100;
14
+
9
15
  @customElement({
10
16
  name: 'foundation-inbox-counter',
11
17
  template: FoundationInboxCounterTemplate,
@@ -41,10 +47,14 @@ export class FoundationInboxCounter extends GenesisElement {
41
47
  private async subscribeToAlerts(): Promise<void> {
42
48
  this.inboxService.unsubscribe(this.subscriptionHandler);
43
49
 
50
+ // Only the row count matters here: cap rows at the display ceiling and
51
+ // request just the id to keep the payload small.
44
52
  this.inboxService.subscribe(
45
53
  this.subscriptionHandler,
46
54
  false,
47
55
  `ALERT_STATUS=='${AlertStatus.NEW}'`,
56
+ COUNTER_MAX_ROWS,
57
+ 'ALERT_ID',
48
58
  );
49
59
  }
50
60
 
@@ -15,7 +15,7 @@ import utc from 'dayjs/plugin/utc';
15
15
  import debounce from 'lodash.debounce';
16
16
  import { Subscription } from 'rxjs';
17
17
  import { AlertService } from '../../../services/alert.service';
18
- import { FoundationInboxService } from '../../../services/inbox.service';
18
+ import { FoundationInboxService, INBOX_PAGE_SIZE } from '../../../services/inbox.service';
19
19
  import { RuleService } from '../../../services/rule.service';
20
20
  import { TemplateService } from '../../../services/template.service';
21
21
  import { logger } from '../../../utils';
@@ -52,6 +52,7 @@ export class FoundationInboxBase extends GenesisElement {
52
52
  private connectionSub: Subscription;
53
53
  @observable private alerts: Alert[] = [];
54
54
  @observable alertsFilter: Alert[] = [];
55
+ @observable moreAlerts: boolean = false;
55
56
 
56
57
  @RuleService ruleService: RuleService;
57
58
  @observable rules: Rule[] = [];
@@ -94,6 +95,7 @@ export class FoundationInboxBase extends GenesisElement {
94
95
  this.alertSubscription,
95
96
  false,
96
97
  criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build(),
98
+ INBOX_PAGE_SIZE,
97
99
  );
98
100
  }
99
101
  });
@@ -110,6 +112,7 @@ export class FoundationInboxBase extends GenesisElement {
110
112
 
111
113
  alertSubscription = ({ store }) => {
112
114
  this.alerts = store?.items || [];
115
+ this.moreAlerts = store?.moreRows ?? false;
113
116
  this.showLoadingIndicator = false;
114
117
  };
115
118
 
@@ -151,6 +154,10 @@ export class FoundationInboxBase extends GenesisElement {
151
154
  // #region Changed Events
152
155
  alertsChanged = () => (this.alertsFilter = this.alerts);
153
156
 
157
+ loadMoreAlerts() {
158
+ this.inboxService.getMoreRows();
159
+ }
160
+
154
161
  rulesChanged = () => (this.rulesFilter = this.rules);
155
162
 
156
163
  templatesChanged = () => (this.templatesFilter = this.templates);
@@ -218,7 +225,7 @@ export class FoundationInboxBase extends GenesisElement {
218
225
  // Refresh the data subscription
219
226
  this.inboxService.unsubscribe(this.alertSubscription);
220
227
  const criteria = filterCriteria.build();
221
- this.inboxService.subscribe(this.alertSubscription, this.reverse, criteria);
228
+ this.inboxService.subscribe(this.alertSubscription, this.reverse, criteria, INBOX_PAGE_SIZE);
222
229
  }
223
230
 
224
231
  sortDirectionChanged() {
@@ -251,6 +251,12 @@ export const alertsNewAndAlertsHistory = css`
251
251
  color: var(--neutral-stroke-rest);
252
252
  }
253
253
 
254
+ .load-more-container {
255
+ display: flex;
256
+ justify-content: center;
257
+ padding: calc(var(--design-unit) * 2px);
258
+ }
259
+
254
260
  .loading-indicator {
255
261
  border: calc(var(--stroke-width) * 1px) solid var(--neutral-fill-input-rest);
256
262
  background: var(--neutral-layer-3);
@@ -173,6 +173,16 @@ const alertsTab = (tab: InboxTab) => html<FoundationInbox>`
173
173
  <div class="no-row-container">No Alerts To Show</div>
174
174
  `,
175
175
  )}
176
+ ${when(
177
+ (x) => x.moreAlerts && !x.showLoadingIndicator,
178
+ html`
179
+ <div class="load-more-container">
180
+ <rapid-button class="load-more" @click=${(x) => x.loadMoreAlerts()}>
181
+ Load More
182
+ </rapid-button>
183
+ </div>
184
+ `,
185
+ )}
176
186
  ${when(
177
187
  (x) => x.showLoadingIndicator,
178
188
  html`
@@ -2,8 +2,15 @@ import { Auth, Connect, SocketObservable, SocketSubscription } from '@genesislca
2
2
  import { DI } from '@genesislcap/web-core';
3
3
  import { logger, updateArray } from '../utils';
4
4
 
5
+ /**
6
+ * Number of alert rows fetched per data server batch. The first batch is loaded
7
+ * on subscribe; subsequent batches are fetched via {@link FoundationInboxService.getMoreRows}.
8
+ */
9
+ export const INBOX_PAGE_SIZE = 20;
10
+
5
11
  export interface FoundationInboxServiceStore {
6
12
  items: Array<any>;
13
+ moreRows: boolean;
7
14
  }
8
15
 
9
16
  export type SubscribeCallback = ({ store }: { store: FoundationInboxServiceStore }) => any;
@@ -14,8 +21,24 @@ export type Subscription = {
14
21
  };
15
22
 
16
23
  export interface FoundationInboxService {
17
- subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string): void;
24
+ /**
25
+ * Subscribes to the alerts stream.
26
+ * @param maxRows - when provided, limits the initial batch (enabling
27
+ * {@link FoundationInboxService.getMoreRows} pagination). Omit to stream the
28
+ * full result set, e.g. for an unread counter that needs the total.
29
+ * @param fields - comma-separated list of fields to return. Omit for all
30
+ * fields; pass a minimal set (e.g. just the id) when only the row count
31
+ * matters, to keep the payload small.
32
+ */
33
+ subscribe(
34
+ callback: SubscribeCallback,
35
+ reverse: boolean,
36
+ criteriaMatch: string,
37
+ maxRows?: number,
38
+ fields?: string,
39
+ ): void;
18
40
  unsubscribe(callback: SubscribeCallback): void;
41
+ getMoreRows(): void;
19
42
  }
20
43
 
21
44
  class FoundationInboxServiceImpl implements FoundationInboxService {
@@ -23,11 +46,19 @@ class FoundationInboxServiceImpl implements FoundationInboxService {
23
46
  @Auth private auth: Auth;
24
47
  private stream: SocketObservable<any> | null;
25
48
  private subscriptions: Subscription[] = [];
49
+ private sourceRef: string | null = null;
50
+ private fetchingMore = false;
26
51
  public store: FoundationInboxServiceStore = {
27
52
  items: [],
53
+ moreRows: false,
28
54
  };
29
55
 
30
- private getStream(reverse: boolean, criteriaMatch: string): SocketObservable<any> {
56
+ private getStream(
57
+ reverse: boolean,
58
+ criteriaMatch: string,
59
+ maxRows?: number,
60
+ fields?: string,
61
+ ): SocketObservable<any> {
31
62
  return this.connect.stream(
32
63
  'ALL_NOTIFY_ALERT_RECORDS',
33
64
  (result) => {
@@ -36,7 +67,17 @@ class FoundationInboxServiceImpl implements FoundationInboxService {
36
67
  return;
37
68
  }
38
69
 
39
- this.store.items = updateArray(result?.ROW, this.store.items);
70
+ if (result.SOURCE_REF) {
71
+ this.sourceRef = result.SOURCE_REF;
72
+ }
73
+ this.store.moreRows = Boolean(result.MORE_ROWS);
74
+ // getMoreRows batches continue the existing order, so append them
75
+ // rather than prepending like real-time inserts.
76
+ const append = this.fetchingMore;
77
+ this.store.items = updateArray(result?.ROW, this.store.items, append);
78
+ if (append && result?.ROW?.length) {
79
+ this.fetchingMore = false;
80
+ }
40
81
 
41
82
  this.subscriptions.forEach((subscription) => {
42
83
  subscription.callback({ store: this.store });
@@ -45,18 +86,33 @@ class FoundationInboxServiceImpl implements FoundationInboxService {
45
86
  (response) => logger.error(response),
46
87
  {
47
88
  REVERSE: reverse,
89
+ ...(maxRows != null && { MAX_ROWS: maxRows }),
90
+ ...(fields && { FIELDS: fields }),
48
91
  ...(criteriaMatch != '' && { CRITERIA_MATCH: criteriaMatch }),
49
92
  },
50
93
  ) as SocketObservable<any>;
51
94
  }
52
95
 
53
- public subscribe(callback: SubscribeCallback, reverse: boolean, criteriaMatch: string): void {
96
+ public getMoreRows(): void {
97
+ if (this.sourceRef) {
98
+ this.fetchingMore = true;
99
+ this.connect.getMoreRows(this.sourceRef);
100
+ }
101
+ }
102
+
103
+ public subscribe(
104
+ callback: SubscribeCallback,
105
+ reverse: boolean,
106
+ criteriaMatch: string,
107
+ maxRows?: number,
108
+ fields?: string,
109
+ ): void {
54
110
  if (this.stream) {
55
111
  callback({ store: this.store });
56
112
  return;
57
113
  }
58
114
 
59
- this.stream = this.getStream(reverse, criteriaMatch);
115
+ this.stream = this.getStream(reverse, criteriaMatch, maxRows, fields);
60
116
  const socketSubscription = this.stream.subscribe();
61
117
 
62
118
  this.subscriptions.push({ callback, socketSubscription });
@@ -71,12 +127,14 @@ class FoundationInboxServiceImpl implements FoundationInboxService {
71
127
  const found = this.subscriptions.splice(index, 1);
72
128
  found.forEach((subscription) => {
73
129
  subscription.socketSubscription.unsubscribe();
74
- subscription.callback({ store: { items: [] } });
130
+ subscription.callback({ store: { items: [], moreRows: false } });
75
131
  });
76
132
  }
77
133
 
78
134
  this.stream = undefined;
79
- this.store = { items: [] };
135
+ this.sourceRef = null;
136
+ this.fetchingMore = false;
137
+ this.store = { items: [], moreRows: false };
80
138
  }
81
139
  }
82
140
 
@@ -1,4 +1,15 @@
1
- export const updateArray = (newData: Array<any>, oldData: Array<any>): Array<any> => {
1
+ /**
2
+ * Merges streamed data server rows into the existing list.
3
+ *
4
+ * New INSERT rows are prepended by default so real-time alerts surface at the
5
+ * top. When {@link append} is set (e.g. for `getMoreRows` pagination batches),
6
+ * rows are appended instead so they continue the existing order at the bottom.
7
+ */
8
+ export const updateArray = (
9
+ newData: Array<any>,
10
+ oldData: Array<any>,
11
+ append = false,
12
+ ): Array<any> => {
2
13
  if (newData && oldData && oldData.length > 0) {
3
14
  newData.forEach((row) => {
4
15
  const eventData = row;
@@ -9,7 +20,11 @@ export const updateArray = (newData: Array<any>, oldData: Array<any>): Array<any
9
20
 
10
21
  if (type === 'INSERT') {
11
22
  if (!oldData.find((x) => x.DETAILS?.ROW_REF === ref)) {
12
- oldData.unshift(eventData);
23
+ if (append) {
24
+ oldData.push(eventData);
25
+ } else {
26
+ oldData.unshift(eventData);
27
+ }
13
28
  }
14
29
  }
15
30