@genesislcap/pbc-notify-ui 14.310.0 → 14.310.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.
@@ -1,10 +1,22 @@
1
+ import { Connect } from '@genesislcap/foundation-comms';
1
2
  import { GenesisElement } from '@genesislcap/web-core';
2
3
  import { FoundationInboxService } from '../../../../services/inbox.service';
3
4
  export declare class FoundationInboxCounter extends GenesisElement {
4
5
  value: number;
6
+ connect: Connect;
5
7
  inboxService: FoundationInboxService;
6
- private subscriptionHandler;
8
+ private connectionSub;
7
9
  connectedCallback(): Promise<void>;
8
10
  disconnectedCallback(): void;
11
+ /**
12
+ * Subscribes to alerts from the inbox service
13
+ * @private
14
+ */
15
+ private subscribeToAlerts;
16
+ /**
17
+ * Handles subscription updates from the inbox service
18
+ * @private
19
+ */
20
+ private subscriptionHandler;
9
21
  }
10
22
  //# sourceMappingURL=foundation-inbox-counter.d.ts.map
@@ -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,EAAiB,cAAc,EAAc,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAK5E,qBAKa,sBAAuB,SAAQ,cAAc;IAC5C,KAAK,EAAE,MAAM,CAAK;IACN,YAAY,EAAE,sBAAsB,CAAC;IAC7D,OAAO,CAAC,mBAAmB,CAAgB;IAErC,iBAAiB;IAYvB,oBAAoB;CAIrB"}
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;AAGlF,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,4 +1,4 @@
1
- import { Auth } from '@genesislcap/foundation-comms';
1
+ import { Auth, Connect } from '@genesislcap/foundation-comms';
2
2
  import { Expression } from '@genesislcap/foundation-criteria';
3
3
  import type { Tabs } from '@genesislcap/foundation-ui';
4
4
  import { GenesisElement } from '@genesislcap/web-core';
@@ -9,9 +9,10 @@ import { TemplateService } from '../../../services/template.service';
9
9
  import { Alert, InboxTab, NotificationRuleTemplateReply, Rule, RuleTemplate } from '../inbox.types';
10
10
  export declare class FoundationInboxBase extends GenesisElement {
11
11
  auth: Auth;
12
+ connect: Connect;
12
13
  alertService: AlertService;
13
14
  inboxService: FoundationInboxService;
14
- private alertSubscription;
15
+ private connectionSub;
15
16
  private alerts;
16
17
  alertsFilter: Alert[];
17
18
  ruleService: RuleService;
@@ -35,6 +36,9 @@ export declare class FoundationInboxBase extends GenesisElement {
35
36
  tabs: Tabs;
36
37
  connectedCallback(): Promise<void>;
37
38
  disconnectedCallback(): void;
39
+ alertSubscription: ({ store }: {
40
+ store: any;
41
+ }) => void;
38
42
  inboxTabChanged(inboxTab: InboxTab): Promise<void>;
39
43
  alertsChanged: () => Alert[];
40
44
  rulesChanged: () => Rule[];
@@ -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,MAAM,+BAA+B,CAAC;AACrD,OAA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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,4 +1,5 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
+ import { Connect } from '@genesislcap/foundation-comms';
2
3
  import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
4
  import { FoundationInboxService } from '../../../../services/inbox.service';
4
5
  import { AlertStatus } from '../../inbox.types';
@@ -8,6 +9,13 @@ let FoundationInboxCounter = class FoundationInboxCounter extends GenesisElement
8
9
  constructor() {
9
10
  super(...arguments);
10
11
  this.value = 0;
12
+ /**
13
+ * Handles subscription updates from the inbox service
14
+ * @private
15
+ */
16
+ this.subscriptionHandler = ({ store }) => {
17
+ this.value = ((store === null || store === void 0 ? void 0 : store.items) || []).length;
18
+ };
11
19
  }
12
20
  connectedCallback() {
13
21
  const _super = Object.create(null, {
@@ -15,20 +23,36 @@ let FoundationInboxCounter = class FoundationInboxCounter extends GenesisElement
15
23
  });
16
24
  return __awaiter(this, void 0, void 0, function* () {
17
25
  _super.connectedCallback.call(this);
18
- this.subscriptionHandler = ({ store }) => {
19
- this.value = ((store === null || store === void 0 ? void 0 : store.items) || []).length;
20
- };
21
- this.inboxService.subscribe(this.subscriptionHandler, false, `ALERT_STATUS=='${AlertStatus.NEW}'`);
26
+ this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => __awaiter(this, void 0, void 0, function* () {
27
+ if (isConnected) {
28
+ yield this.subscribeToAlerts();
29
+ }
30
+ }));
22
31
  });
23
32
  }
24
33
  disconnectedCallback() {
25
34
  super.disconnectedCallback();
26
35
  this.inboxService.unsubscribe(this.subscriptionHandler);
36
+ this.connectionSub.unsubscribe();
37
+ delete this.connectionSub;
38
+ }
39
+ /**
40
+ * Subscribes to alerts from the inbox service
41
+ * @private
42
+ */
43
+ subscribeToAlerts() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ this.inboxService.unsubscribe(this.subscriptionHandler);
46
+ this.inboxService.subscribe(this.subscriptionHandler, false, `ALERT_STATUS=='${AlertStatus.NEW}'`);
47
+ });
27
48
  }
28
49
  };
29
50
  __decorate([
30
51
  observable
31
52
  ], FoundationInboxCounter.prototype, "value", void 0);
53
+ __decorate([
54
+ Connect
55
+ ], FoundationInboxCounter.prototype, "connect", void 0);
32
56
  __decorate([
33
57
  FoundationInboxService
34
58
  ], FoundationInboxCounter.prototype, "inboxService", void 0);
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { Auth } from '@genesislcap/foundation-comms';
2
+ import { Auth, Connect } from '@genesislcap/foundation-comms';
3
3
  import { CriteriaBuilder, ExpressionBuilder, Join, Serialisers, } from '@genesislcap/foundation-criteria';
4
4
  import { showNotificationDialog } from '@genesislcap/foundation-notifications';
5
5
  import { GenesisElement, observable } from '@genesislcap/web-core';
@@ -43,6 +43,10 @@ export class FoundationInboxBase extends GenesisElement {
43
43
  this.reverse = false;
44
44
  this.showLoadingIndicator = false;
45
45
  this.severityType = [];
46
+ this.alertSubscription = ({ store }) => {
47
+ this.alerts = (store === null || store === void 0 ? void 0 : store.items) || [];
48
+ this.showLoadingIndicator = false;
49
+ };
46
50
  // #endregion
47
51
  // #region Changed Events
48
52
  this.alertsChanged = () => (this.alertsFilter = this.alerts);
@@ -57,11 +61,12 @@ export class FoundationInboxBase extends GenesisElement {
57
61
  return __awaiter(this, void 0, void 0, function* () {
58
62
  _super.connectedCallback.call(this);
59
63
  this.criteriaMatchAlertStatus = expressionBuilder('ALERT_STATUS', 'NEW', Serialisers.equals);
60
- this.alertSubscription = ({ store }) => {
61
- this.alerts = (store === null || store === void 0 ? void 0 : store.items) || [];
62
- this.showLoadingIndicator = false;
63
- };
64
- this.inboxService.subscribe(this.alertSubscription, false, criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build());
64
+ this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => {
65
+ if (isConnected) {
66
+ this.inboxService.unsubscribe(this.alertSubscription);
67
+ this.inboxService.subscribe(this.alertSubscription, false, criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build());
68
+ }
69
+ });
65
70
  this.rules = yield this.ruleService.getRules();
66
71
  this.templates = yield this.templateService.getRuleTemplates();
67
72
  });
@@ -69,6 +74,7 @@ export class FoundationInboxBase extends GenesisElement {
69
74
  disconnectedCallback() {
70
75
  super.disconnectedCallback();
71
76
  this.inboxService.unsubscribe(this.alertSubscription);
77
+ this.connectionSub.unsubscribe();
72
78
  }
73
79
  // #region Tabs
74
80
  inboxTabChanged(inboxTab) {
@@ -224,6 +230,9 @@ export class FoundationInboxBase extends GenesisElement {
224
230
  __decorate([
225
231
  Auth
226
232
  ], FoundationInboxBase.prototype, "auth", void 0);
233
+ __decorate([
234
+ Connect
235
+ ], FoundationInboxBase.prototype, "connect", void 0);
227
236
  __decorate([
228
237
  AlertService
229
238
  ], FoundationInboxBase.prototype, "alertService", void 0);
@@ -296,6 +296,37 @@
296
296
  "name": "FoundationInboxCounter",
297
297
  "preserveMemberOrder": false,
298
298
  "members": [
299
+ {
300
+ "kind": "Property",
301
+ "canonicalReference": "@genesislcap/pbc-notify-ui!FoundationInboxCounter#connect:member",
302
+ "docComment": "",
303
+ "excerptTokens": [
304
+ {
305
+ "kind": "Content",
306
+ "text": "connect: "
307
+ },
308
+ {
309
+ "kind": "Reference",
310
+ "text": "Connect",
311
+ "canonicalReference": "@genesislcap/foundation-comms!Connect:interface"
312
+ },
313
+ {
314
+ "kind": "Content",
315
+ "text": ";"
316
+ }
317
+ ],
318
+ "isReadonly": false,
319
+ "isOptional": false,
320
+ "releaseTag": "Public",
321
+ "name": "connect",
322
+ "propertyTypeTokenRange": {
323
+ "startIndex": 1,
324
+ "endIndex": 2
325
+ },
326
+ "isStatic": false,
327
+ "isProtected": false,
328
+ "isAbstract": false
329
+ },
299
330
  {
300
331
  "kind": "Method",
301
332
  "canonicalReference": "@genesislcap/pbc-notify-ui!FoundationInboxCounter#connectedCallback:member(1)",
@@ -1,4 +1,5 @@
1
1
  import { Auth } from '@genesislcap/foundation-comms';
2
+ import { Connect } from '@genesislcap/foundation-comms';
2
3
  import { Expression } from '@genesislcap/foundation-criteria';
3
4
  import type { Flyout } from '@genesislcap/rapid-design-system';
4
5
  import { GenesisElement } from '@genesislcap/web-core';
@@ -45,9 +46,10 @@ export declare class FoundationInbox extends FoundationInboxBase {
45
46
 
46
47
  declare class FoundationInboxBase extends GenesisElement {
47
48
  auth: Auth;
49
+ connect: Connect;
48
50
  alertService: AlertService;
49
51
  inboxService: FoundationInboxService;
50
- private alertSubscription;
52
+ private connectionSub;
51
53
  private alerts;
52
54
  alertsFilter: Alert[];
53
55
  ruleService: RuleService;
@@ -71,6 +73,9 @@ declare class FoundationInboxBase extends GenesisElement {
71
73
  tabs: Tabs;
72
74
  connectedCallback(): Promise<void>;
73
75
  disconnectedCallback(): void;
76
+ alertSubscription: ({ store }: {
77
+ store: any;
78
+ }) => void;
74
79
  inboxTabChanged(inboxTab: InboxTab): Promise<void>;
75
80
  alertsChanged: () => Alert[];
76
81
  rulesChanged: () => Rule_2[];
@@ -92,10 +97,21 @@ declare class FoundationInboxBase extends GenesisElement {
92
97
 
93
98
  export declare class FoundationInboxCounter extends GenesisElement {
94
99
  value: number;
100
+ connect: Connect;
95
101
  inboxService: FoundationInboxService;
96
- private subscriptionHandler;
102
+ private connectionSub;
97
103
  connectedCallback(): Promise<void>;
98
104
  disconnectedCallback(): void;
105
+ /**
106
+ * Subscribes to alerts from the inbox service
107
+ * @private
108
+ */
109
+ private subscribeToAlerts;
110
+ /**
111
+ * Handles subscription updates from the inbox service
112
+ * @private
113
+ */
114
+ private subscriptionHandler;
99
115
  }
100
116
 
101
117
  export declare class FoundationInboxFlyout extends FoundationInboxBase {
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/pbc-notify-ui](./pbc-notify-ui.md) &gt; [FoundationInboxCounter](./pbc-notify-ui.foundationinboxcounter.md) &gt; [connect](./pbc-notify-ui.foundationinboxcounter.connect.md)
4
+
5
+ ## FoundationInboxCounter.connect property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ connect: Connect;
11
+ ```
@@ -36,6 +36,23 @@ Description
36
36
  </th></tr></thead>
37
37
  <tbody><tr><td>
38
38
 
39
+ [connect](./pbc-notify-ui.foundationinboxcounter.connect.md)
40
+
41
+
42
+ </td><td>
43
+
44
+
45
+ </td><td>
46
+
47
+ Connect
48
+
49
+
50
+ </td><td>
51
+
52
+
53
+ </td></tr>
54
+ <tr><td>
55
+
39
56
  [inboxService](./pbc-notify-ui.foundationinboxcounter.inboxservice.md)
40
57
 
41
58
 
@@ -5,6 +5,7 @@
5
5
  ```ts
6
6
 
7
7
  import { Auth } from '@genesislcap/foundation-comms';
8
+ import { Connect } from '@genesislcap/foundation-comms';
8
9
  import { Expression } from '@genesislcap/foundation-criteria';
9
10
  import type { Flyout } from '@genesislcap/rapid-design-system';
10
11
  import { GenesisElement } from '@genesislcap/web-core';
@@ -25,6 +26,8 @@ export class FoundationInbox extends FoundationInboxBase {
25
26
 
26
27
  // @public (undocumented)
27
28
  export class FoundationInboxCounter extends GenesisElement {
29
+ // (undocumented)
30
+ connect: Connect;
28
31
  // (undocumented)
29
32
  connectedCallback(): Promise<void>;
30
33
  // (undocumented)
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.310.0",
4
+ "version": "14.310.1",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "workspaces": [
7
7
  "client"
@@ -88,33 +88,34 @@
88
88
  "@commitlint/format": "^19.0.3",
89
89
  "@genesiscommunitysuccess/cep-fast-plugin": "5.0.3",
90
90
  "@genesiscommunitysuccess/custom-elements-lsp": "5.0.3",
91
- "@genesislcap/design-system-configurator": "14.310.0",
92
- "@genesislcap/eslint-config": "14.310.0",
93
- "@genesislcap/eslint-stylelint-builder": "14.310.0",
94
- "@genesislcap/foundation-testing": "14.310.0",
95
- "@genesislcap/genx": "14.310.0",
96
- "@genesislcap/prettier-config": "14.310.0",
97
- "@genesislcap/stylelint-config": "14.310.0",
98
- "@genesislcap/vite-builder": "14.310.0",
99
- "@genesislcap/webpack-builder": "14.310.0",
91
+ "@genesislcap/design-system-configurator": "14.310.1",
92
+ "@genesislcap/eslint-config": "14.310.1",
93
+ "@genesislcap/eslint-stylelint-builder": "14.310.1",
94
+ "@genesislcap/foundation-testing": "14.310.1",
95
+ "@genesislcap/genx": "14.310.1",
96
+ "@genesislcap/prettier-config": "14.310.1",
97
+ "@genesislcap/stylelint-config": "14.310.1",
98
+ "@genesislcap/vite-builder": "14.310.1",
99
+ "@genesislcap/webpack-builder": "14.310.1",
100
100
  "dayjs": "^1.11.7"
101
101
  },
102
102
  "dependencies": {
103
- "@genesislcap/foundation-comms": "14.310.0",
104
- "@genesislcap/foundation-criteria": "14.310.0",
105
- "@genesislcap/foundation-entity-management": "14.310.0",
106
- "@genesislcap/foundation-forms": "14.310.0",
107
- "@genesislcap/foundation-layout": "14.310.0",
108
- "@genesislcap/foundation-logger": "14.310.0",
109
- "@genesislcap/foundation-notifications": "14.310.0",
110
- "@genesislcap/foundation-utils": "14.310.0",
111
- "@genesislcap/rapid-design-system": "14.310.0",
112
- "@genesislcap/rapid-grid-pro": "14.310.0",
113
- "@genesislcap/web-core": "14.310.0",
114
- "lodash.debounce": "^4.0.8"
103
+ "@genesislcap/foundation-comms": "14.310.1",
104
+ "@genesislcap/foundation-criteria": "14.310.1",
105
+ "@genesislcap/foundation-entity-management": "14.310.1",
106
+ "@genesislcap/foundation-forms": "14.310.1",
107
+ "@genesislcap/foundation-layout": "14.310.1",
108
+ "@genesislcap/foundation-logger": "14.310.1",
109
+ "@genesislcap/foundation-notifications": "14.310.1",
110
+ "@genesislcap/foundation-utils": "14.310.1",
111
+ "@genesislcap/rapid-design-system": "14.310.1",
112
+ "@genesislcap/rapid-grid-pro": "14.310.1",
113
+ "@genesislcap/web-core": "14.310.1",
114
+ "lodash.debounce": "^4.0.8",
115
+ "rxjs": "^7.8.2"
115
116
  },
116
117
  "publishConfig": {
117
118
  "access": "public"
118
119
  },
119
- "gitHead": "3a67b9c5ee9c251945d5fe8121cb797d6aec37f3"
120
+ "gitHead": "961d1c76db14707ed77ef9e064f112145f8996ca"
120
121
  }
@@ -1,4 +1,7 @@
1
+ import { Connect } from '@genesislcap/foundation-comms';
1
2
  import { customElement, GenesisElement, observable } from '@genesislcap/web-core';
3
+ import { Subscription } from 'rxjs';
4
+
2
5
  import { FoundationInboxService } from '../../../../services/inbox.service';
3
6
  import { AlertStatus } from '../../inbox.types';
4
7
  import { FoundationInboxCounterStyles } from './foundation-inbox-counter.styles';
@@ -11,14 +14,34 @@ import { FoundationInboxCounterTemplate } from './foundation-inbox-counter.templ
11
14
  })
12
15
  export class FoundationInboxCounter extends GenesisElement {
13
16
  @observable value: number = 0;
17
+ @Connect connect: Connect;
14
18
  @FoundationInboxService inboxService: FoundationInboxService;
15
- private subscriptionHandler: (any) => void;
19
+ private connectionSub: Subscription;
16
20
 
17
21
  async connectedCallback() {
18
22
  super.connectedCallback();
19
- this.subscriptionHandler = ({ store }) => {
20
- this.value = (store?.items || []).length;
21
- };
23
+
24
+ this.connectionSub = this.connect.isConnected$.subscribe(async (isConnected) => {
25
+ if (isConnected) {
26
+ await this.subscribeToAlerts();
27
+ }
28
+ });
29
+ }
30
+
31
+ disconnectedCallback() {
32
+ super.disconnectedCallback();
33
+ this.inboxService.unsubscribe(this.subscriptionHandler);
34
+ this.connectionSub.unsubscribe();
35
+ delete this.connectionSub;
36
+ }
37
+
38
+ /**
39
+ * Subscribes to alerts from the inbox service
40
+ * @private
41
+ */
42
+ private async subscribeToAlerts(): Promise<void> {
43
+ this.inboxService.unsubscribe(this.subscriptionHandler);
44
+
22
45
  this.inboxService.subscribe(
23
46
  this.subscriptionHandler,
24
47
  false,
@@ -26,8 +49,11 @@ export class FoundationInboxCounter extends GenesisElement {
26
49
  );
27
50
  }
28
51
 
29
- disconnectedCallback() {
30
- super.disconnectedCallback();
31
- this.inboxService.unsubscribe(this.subscriptionHandler);
32
- }
52
+ /**
53
+ * Handles subscription updates from the inbox service
54
+ * @private
55
+ */
56
+ private subscriptionHandler = ({ store }: { store: { items: any[] } }) => {
57
+ this.value = (store?.items || []).length;
58
+ };
33
59
  }
@@ -1,4 +1,4 @@
1
- import { Auth } from '@genesislcap/foundation-comms';
1
+ import { Auth, Connect } from '@genesislcap/foundation-comms';
2
2
  import {
3
3
  CriteriaBuilder,
4
4
  Expression,
@@ -13,8 +13,9 @@ import { GenesisElement, observable } from '@genesislcap/web-core';
13
13
  import dayjs from 'dayjs';
14
14
  import utc from 'dayjs/plugin/utc';
15
15
  import debounce from 'lodash.debounce';
16
+ import { Subscription } from 'rxjs';
16
17
  import { AlertService } from '../../../services/alert.service';
17
- import { FoundationInboxService, SubscribeCallback } from '../../../services/inbox.service';
18
+ import { FoundationInboxService } from '../../../services/inbox.service';
18
19
  import { RuleService } from '../../../services/rule.service';
19
20
  import { TemplateService } from '../../../services/template.service';
20
21
  import { logger } from '../../../utils';
@@ -44,12 +45,11 @@ const DEBOUNCE_TIME = 500;
44
45
 
45
46
  export class FoundationInboxBase extends GenesisElement {
46
47
  @Auth auth: Auth;
48
+ @Connect connect: Connect;
47
49
 
48
50
  @AlertService alertService: AlertService;
49
51
  @FoundationInboxService inboxService: FoundationInboxService;
50
-
51
- private alertSubscription: SubscribeCallback;
52
-
52
+ private connectionSub: Subscription;
53
53
  @observable private alerts: Alert[] = [];
54
54
  @observable alertsFilter: Alert[] = [];
55
55
 
@@ -85,16 +85,17 @@ export class FoundationInboxBase extends GenesisElement {
85
85
 
86
86
  this.criteriaMatchAlertStatus = expressionBuilder('ALERT_STATUS', 'NEW', Serialisers.equals);
87
87
 
88
- this.alertSubscription = ({ store }) => {
89
- this.alerts = store?.items || [];
90
- this.showLoadingIndicator = false;
91
- };
88
+ this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => {
89
+ if (isConnected) {
90
+ this.inboxService.unsubscribe(this.alertSubscription);
92
91
 
93
- this.inboxService.subscribe(
94
- this.alertSubscription,
95
- false,
96
- criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build(),
97
- );
92
+ this.inboxService.subscribe(
93
+ this.alertSubscription,
94
+ false,
95
+ criteriaBuilder().withExpression(this.criteriaMatchAlertStatus).build(),
96
+ );
97
+ }
98
+ });
98
99
 
99
100
  this.rules = await this.ruleService.getRules();
100
101
  this.templates = await this.templateService.getRuleTemplates();
@@ -103,8 +104,14 @@ export class FoundationInboxBase extends GenesisElement {
103
104
  disconnectedCallback() {
104
105
  super.disconnectedCallback();
105
106
  this.inboxService.unsubscribe(this.alertSubscription);
107
+ this.connectionSub.unsubscribe();
106
108
  }
107
109
 
110
+ alertSubscription = ({ store }) => {
111
+ this.alerts = store?.items || [];
112
+ this.showLoadingIndicator = false;
113
+ };
114
+
108
115
  // #region Tabs
109
116
  async inboxTabChanged(inboxTab: InboxTab) {
110
117
  this.selectedTab = inboxTab;
@@ -5,6 +5,7 @@
5
5
  ```ts
6
6
 
7
7
  import { Auth } from '@genesislcap/foundation-comms';
8
+ import { Connect } from '@genesislcap/foundation-comms';
8
9
  import { Expression } from '@genesislcap/foundation-criteria';
9
10
  import type { Flyout } from '@genesislcap/rapid-design-system';
10
11
  import { GenesisElement } from '@genesislcap/web-core';
@@ -25,6 +26,8 @@ export class FoundationInbox extends FoundationInboxBase {
25
26
 
26
27
  // @public (undocumented)
27
28
  export class FoundationInboxCounter extends GenesisElement {
29
+ // (undocumented)
30
+ connect: Connect;
28
31
  // (undocumented)
29
32
  connectedCallback(): Promise<void>;
30
33
  // (undocumented)