@flamingo-stack/openframe-frontend-core 0.0.809 → 0.0.810
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.
- package/dist/{chunk-ZAXGW4KT.cjs → chunk-2C63MX75.cjs} +13 -13
- package/dist/{chunk-KS5V55HN.cjs → chunk-3FBXQSSC.cjs} +7 -7
- package/dist/{chunk-OAJ3AL4V.cjs → chunk-B6DIM5JG.cjs} +4 -4
- package/dist/{chunk-KITOT3DS.cjs → chunk-CLMUD56S.cjs} +10 -10
- package/dist/{chunk-DDFT6VQ3.cjs → chunk-CZWQCYKV.cjs} +3 -3
- package/dist/{chunk-AZJYMTBS.cjs → chunk-EKDLVUEA.cjs} +2 -2
- package/dist/{chunk-KCB72H7A.cjs → chunk-ETI7OMPU.cjs} +39 -39
- package/dist/{chunk-Q3C6UJJ7.cjs → chunk-F26COFTW.cjs} +57 -57
- package/dist/{chunk-RZNRKWG5.cjs → chunk-FCFYZIOY.cjs} +9 -9
- package/dist/{chunk-3B76QFXV.cjs → chunk-GG36TCKP.cjs} +4 -4
- package/dist/{chunk-BT53NHR7.cjs → chunk-J4QORJMC.cjs} +25 -25
- package/dist/{chunk-WDL3GFH2.cjs → chunk-MAQFG62O.cjs} +19 -19
- package/dist/{chunk-UVLTUSH3.cjs → chunk-MSAXZRXZ.cjs} +131 -131
- package/dist/{chunk-KHKPLOU4.cjs → chunk-QDB2JO55.cjs} +144 -36
- package/dist/{chunk-OFGYPMTE.cjs → chunk-R2ABQG2T.cjs} +39 -39
- package/dist/{chunk-VKAFZCFV.cjs → chunk-RKNCNL6K.cjs} +13 -13
- package/dist/{chunk-5UTJARDM.cjs → chunk-RPBOWCME.cjs} +2 -2
- package/dist/{chunk-WV44WJKR.cjs → chunk-TOTR2WMH.cjs} +3 -3
- package/dist/{chunk-VUKN6KEE.cjs → chunk-X2JSCOOR.cjs} +52 -52
- package/dist/{chunk-LUICXMHC.cjs → chunk-ZXBRPQND.cjs} +6 -6
- package/dist/{cloud-tenants-DJAA23GR.cjs → cloud-tenants-QTASS5KP.cjs} +6 -6
- package/dist/components/case-studies/index.cjs +18 -18
- package/dist/components/chat/hooks/use-jetstream-dialog-subscription.js +1 -1
- package/dist/components/chat/hooks/use-nats-dialog-subscription.js +1 -1
- package/dist/components/chat/index.cjs +4 -4
- package/dist/components/chat/types/api.types.d.ts +8 -4
- package/dist/components/chat/types/api.types.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +7 -7
- package/dist/components/docs/index.cjs +10 -10
- package/dist/components/embeds/index.cjs +7 -7
- package/dist/components/faq/index.cjs +8 -8
- package/dist/components/features/index.cjs +6 -6
- package/dist/components/help-center-pages/index.cjs +74 -74
- package/dist/components/index.cjs +41 -41
- package/dist/components/meeting-scheduler/index.cjs +36 -36
- package/dist/components/navigation/index.cjs +9 -9
- package/dist/components/onboarding-guides/index.cjs +8 -8
- package/dist/components/product-demo/index.cjs +15 -15
- package/dist/components/tickets/index.cjs +11 -11
- package/dist/components/ui/index.cjs +6 -6
- package/dist/{devices-AIDQW4HB.cjs → devices-KPMQI57Y.cjs} +7 -7
- package/dist/{embeddable-chat-XT6GMSBX.cjs → embeddable-chat-LB7NDFVQ.cjs} +60 -60
- package/dist/hooks/index.cjs +3 -3
- package/dist/index.cjs +10 -10
- package/dist/{knowledge-JWCFM3GO.cjs → knowledge-JWGBY3ZJ.cjs} +7 -7
- package/dist/{logs-ZNIXPJXA.cjs → logs-QENTXKWY.cjs} +14 -14
- package/dist/nats/index.cjs +2 -2
- package/dist/nats/nats-provider.d.ts +9 -3
- package/dist/nats/nats-provider.d.ts.map +1 -1
- package/dist/nats/nats-provider.js +7 -3
- package/dist/nats/shared-connection.d.ts +44 -1
- package/dist/nats/shared-connection.d.ts.map +1 -1
- package/dist/nats/shared-connection.js +126 -22
- package/dist/{policies-Z4NGPLA2.cjs → policies-2HXFZ2EL.cjs} +10 -10
- package/dist/{scripts-G4Y5SPOW.cjs → scripts-TMXULK6L.cjs} +11 -11
- package/dist/{software-update-VAOKDA76.cjs → software-update-H2LAEWDN.cjs} +9 -9
- package/package.json +1 -1
- package/src/components/chat/hooks/use-jetstream-dialog-subscription.ts +1 -1
- package/src/components/chat/hooks/use-nats-dialog-subscription.ts +1 -1
- package/src/components/chat/types/api.types.ts +8 -4
- package/src/nats/nats-provider.tsx +15 -4
- package/src/nats/shared-connection.ts +199 -25
|
@@ -8,22 +8,22 @@ var _chunkLHV2R6QUcjs = require('./chunk-LHV2R6QU.cjs');
|
|
|
8
8
|
var _chunkFDZOE5TLcjs = require('./chunk-FDZOE5TL.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkMSAXZRXZcjs = require('./chunk-MSAXZRXZ.cjs');
|
|
12
12
|
require('./chunk-FLW2VL5W.cjs');
|
|
13
13
|
require('./chunk-NG3RKTQU.cjs');
|
|
14
14
|
require('./chunk-FRS2VO22.cjs');
|
|
15
15
|
require('./chunk-HQQE74RO.cjs');
|
|
16
16
|
require('./chunk-DEY6XXGO.cjs');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-EKDLVUEA.cjs');
|
|
18
18
|
require('./chunk-VXAKQRV7.cjs');
|
|
19
19
|
require('./chunk-24I6RFVU.cjs');
|
|
20
20
|
require('./chunk-7Z536SPR.cjs');
|
|
21
21
|
require('./chunk-MZ4KBSH7.cjs');
|
|
22
22
|
require('./chunk-YR74H7Z3.cjs');
|
|
23
|
-
require('./chunk-
|
|
23
|
+
require('./chunk-J4QORJMC.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunk3FBXQSSCcjs = require('./chunk-3FBXQSSC.cjs');
|
|
27
27
|
require('./chunk-JLKGLPDC.cjs');
|
|
28
28
|
require('./chunk-ZD6SZLO2.cjs');
|
|
29
29
|
require('./chunk-KVJKKVB3.cjs');
|
|
@@ -1859,7 +1859,7 @@ require('./chunk-4WIJI4AK.cjs');
|
|
|
1859
1859
|
require('./chunk-AHBTZ7DN.cjs');
|
|
1860
1860
|
require('./chunk-7JWFMAQB.cjs');
|
|
1861
1861
|
require('./chunk-V45KLJQP.cjs');
|
|
1862
|
-
require('./chunk-
|
|
1862
|
+
require('./chunk-QDB2JO55.cjs');
|
|
1863
1863
|
|
|
1864
1864
|
// src/components/product-demo/screens/knowledge.tsx
|
|
1865
1865
|
var _react = require('react');
|
|
@@ -1905,10 +1905,10 @@ function KnowledgeScreen(_props) {
|
|
|
1905
1905
|
const cast = _chunkLHV2R6QUcjs.useProductDemoCast.call(void 0, );
|
|
1906
1906
|
const fixture = _react.useMemo.call(void 0, () => buildKnowledgeFixture(cast), [cast]);
|
|
1907
1907
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full bg-ods-bg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1908
|
-
|
|
1908
|
+
_chunkMSAXZRXZcjs.KnowledgeBaseArticleView,
|
|
1909
1909
|
{
|
|
1910
1910
|
...fixture.article,
|
|
1911
|
-
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1911
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk3FBXQSSCcjs.SimpleMarkdownRenderer, { content: fixture.content, textSize: "compact" })
|
|
1912
1912
|
}
|
|
1913
1913
|
) });
|
|
1914
1914
|
}
|
|
@@ -16,13 +16,13 @@ var _chunkFDZOE5TLcjs = require('./chunk-FDZOE5TL.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkMSAXZRXZcjs = require('./chunk-MSAXZRXZ.cjs');
|
|
20
20
|
require('./chunk-FLW2VL5W.cjs');
|
|
21
21
|
require('./chunk-NG3RKTQU.cjs');
|
|
22
22
|
require('./chunk-FRS2VO22.cjs');
|
|
23
23
|
require('./chunk-HQQE74RO.cjs');
|
|
24
24
|
require('./chunk-DEY6XXGO.cjs');
|
|
25
|
-
require('./chunk-
|
|
25
|
+
require('./chunk-EKDLVUEA.cjs');
|
|
26
26
|
require('./chunk-VXAKQRV7.cjs');
|
|
27
27
|
require('./chunk-24I6RFVU.cjs');
|
|
28
28
|
require('./chunk-7Z536SPR.cjs');
|
|
@@ -30,8 +30,8 @@ require('./chunk-MZ4KBSH7.cjs');
|
|
|
30
30
|
require('./chunk-YR74H7Z3.cjs');
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
34
|
-
require('./chunk-
|
|
33
|
+
var _chunkJ4QORJMCcjs = require('./chunk-J4QORJMC.cjs');
|
|
34
|
+
require('./chunk-3FBXQSSC.cjs');
|
|
35
35
|
require('./chunk-JLKGLPDC.cjs');
|
|
36
36
|
require('./chunk-ZD6SZLO2.cjs');
|
|
37
37
|
require('./chunk-KVJKKVB3.cjs');
|
|
@@ -1869,7 +1869,7 @@ require('./chunk-4WIJI4AK.cjs');
|
|
|
1869
1869
|
var _chunkAHBTZ7DNcjs = require('./chunk-AHBTZ7DN.cjs');
|
|
1870
1870
|
require('./chunk-7JWFMAQB.cjs');
|
|
1871
1871
|
require('./chunk-V45KLJQP.cjs');
|
|
1872
|
-
require('./chunk-
|
|
1872
|
+
require('./chunk-QDB2JO55.cjs');
|
|
1873
1873
|
|
|
1874
1874
|
// src/components/product-demo/screens/logs.tsx
|
|
1875
1875
|
var _react = require('react');
|
|
@@ -1886,7 +1886,7 @@ function entry(logId, minutesAgo, severity, toolType, device2, summary) {
|
|
|
1886
1886
|
id: logId,
|
|
1887
1887
|
logId,
|
|
1888
1888
|
timestamp: displayTime(_chunkFDZOE5TLcjs.demoMinutesAgo.call(void 0, minutesAgo)),
|
|
1889
|
-
status: { label: severity, variant:
|
|
1889
|
+
status: { label: severity, variant: _chunkMSAXZRXZcjs.logSeverityVariant.call(void 0, severity) },
|
|
1890
1890
|
source: { name: toolType, toolType },
|
|
1891
1891
|
device: device2,
|
|
1892
1892
|
description: { title: summary }
|
|
@@ -1958,13 +1958,13 @@ var NO_FILTERS = {};
|
|
|
1958
1958
|
var ACTION_COLUMNS = ["copy", "quickView", "open"];
|
|
1959
1959
|
var BESIDE_DRAWER_HIDDEN = [...ACTION_COLUMNS, "tool", "source"];
|
|
1960
1960
|
var logHref = () => "#";
|
|
1961
|
-
var copyAction = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1961
|
+
var copyAction = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMSAXZRXZcjs.LogCopyIconButton, {});
|
|
1962
1962
|
function LogsScreen({ compact = false }) {
|
|
1963
1963
|
const [dock, setDock] = _react.useState.call(void 0, null);
|
|
1964
1964
|
const selected = LOGS_FIXTURE_SELECTED;
|
|
1965
1965
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full bg-ods-bg", children: [
|
|
1966
1966
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "min-w-0 flex-1 overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1967
|
-
|
|
1967
|
+
_chunkMSAXZRXZcjs.LogsPageView,
|
|
1968
1968
|
{
|
|
1969
1969
|
showHeader: false,
|
|
1970
1970
|
className: "p-[var(--spacing-system-l)]",
|
|
@@ -1972,7 +1972,7 @@ function LogsScreen({ compact = false }) {
|
|
|
1972
1972
|
onSearchChange: noop,
|
|
1973
1973
|
onOpenFilters: noop,
|
|
1974
1974
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1975
|
-
|
|
1975
|
+
_chunkMSAXZRXZcjs.LogsTableView,
|
|
1976
1976
|
{
|
|
1977
1977
|
logs: LOGS_FIXTURE_ENTRIES,
|
|
1978
1978
|
facets: LOGS_FIXTURE_FACETS,
|
|
@@ -1986,8 +1986,8 @@ function LogsScreen({ compact = false }) {
|
|
|
1986
1986
|
)
|
|
1987
1987
|
}
|
|
1988
1988
|
) }),
|
|
1989
|
-
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: setDock, className: "relative w-[calc(400px+var(--spacing-system-m))] shrink-0", children: dock && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1990
|
-
|
|
1989
|
+
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: setDock, className: "relative w-[calc(400px+var(--spacing-system-m))] shrink-0", children: dock && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMSAXZRXZcjs.AppLayoutDrawerContainerContext.Provider, { value: dock, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1990
|
+
_chunkMSAXZRXZcjs.LogDrawer,
|
|
1991
1991
|
{
|
|
1992
1992
|
docked: true,
|
|
1993
1993
|
isOpen: true,
|
|
@@ -1999,12 +1999,12 @@ function LogsScreen({ compact = false }) {
|
|
|
1999
1999
|
{ label: "Log ID", value: selected.logId },
|
|
2000
2000
|
{
|
|
2001
2001
|
label: "Source",
|
|
2002
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2002
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMSAXZRXZcjs.ToolBadge, { toolType: _chunkJ4QORJMCcjs.normalizeToolTypeWithFallback.call(void 0, selected.source.toolType) })
|
|
2003
2003
|
},
|
|
2004
|
-
{ label: "Device", value:
|
|
2004
|
+
{ label: "Device", value: _chunkMSAXZRXZcjs.logSourceLabels.call(void 0, selected.device).deviceName }
|
|
2005
2005
|
],
|
|
2006
2006
|
deviceCard: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2007
|
-
|
|
2007
|
+
_chunkMSAXZRXZcjs.DeviceCard,
|
|
2008
2008
|
{
|
|
2009
2009
|
...LOGS_FIXTURE_DEVICE,
|
|
2010
2010
|
actions: {
|
package/dist/nats/index.cjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkQDB2JO55cjs = require('../chunk-QDB2JO55.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -26,4 +26,4 @@ var _chunkKHKPLOU4cjs = require('../chunk-KHKPLOU4.cjs');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
exports.NATS_DEFAULTS =
|
|
29
|
+
exports.NATS_DEFAULTS = _chunkQDB2JO55cjs.NATS_DEFAULTS; exports.NatsProvider = _chunkQDB2JO55cjs.NatsProvider; exports.acquireClient = _chunkQDB2JO55cjs.acquireClient; exports.createNatsClient = _chunkQDB2JO55cjs.createNatsClient; exports.getSharedConnection = _chunkQDB2JO55cjs.getSharedConnection; exports.getSharedConnectionFor = _chunkQDB2JO55cjs.getSharedConnectionFor; exports.releaseClient = _chunkQDB2JO55cjs.releaseClient; exports.startConnectionLifecycle = _chunkQDB2JO55cjs.startConnectionLifecycle; exports.useNats = _chunkQDB2JO55cjs.useNats; exports.useNatsJsonSubscription = _chunkQDB2JO55cjs.useNatsJsonSubscription; exports.useNatsSubscription = _chunkQDB2JO55cjs.useNatsSubscription; exports.useOptionalNats = _chunkQDB2JO55cjs.useOptionalNats;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { NatsClient, NatsStatus } from './nats';
|
|
3
|
-
import { type AcquireClientOptions, type NatsReconnectionBackoff } from './shared-connection';
|
|
3
|
+
import { type AcquireClientOptions, type NatsBeforeReconnect, type NatsReconnectionBackoff } from './shared-connection';
|
|
4
4
|
export interface NatsProviderProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
/** Return the current NATS WebSocket URL (or null when not yet available, e.g. unauthenticated). */
|
|
7
7
|
getWsUrl: () => string | null;
|
|
8
|
-
/** Called before each reconnect attempt. */
|
|
9
|
-
onBeforeReconnect?:
|
|
8
|
+
/** Called before each reconnect attempt. May return a verdict; see `NatsReconnectVerdict`. */
|
|
9
|
+
onBeforeReconnect?: NatsBeforeReconnect;
|
|
10
10
|
clientConfig?: AcquireClientOptions;
|
|
11
11
|
reconnectionBackoff?: NatsReconnectionBackoff;
|
|
12
12
|
/**
|
|
@@ -20,6 +20,12 @@ export interface NatsContextValue {
|
|
|
20
20
|
status: NatsStatus;
|
|
21
21
|
isReady: boolean;
|
|
22
22
|
reconnectionCount: number;
|
|
23
|
+
/**
|
|
24
|
+
* A `terminal` verdict stopped reconnecting; `status` stays `disconnected`. Reset when this
|
|
25
|
+
* provider re-acquires (`urlRevision` changes); the connection itself stays terminal while
|
|
26
|
+
* another consumer still holds it.
|
|
27
|
+
*/
|
|
28
|
+
terminal: boolean;
|
|
23
29
|
}
|
|
24
30
|
export declare function NatsProvider({ children, getWsUrl, onBeforeReconnect, clientConfig, reconnectionBackoff, urlRevision, }: NatsProviderProps): import("react").JSX.Element;
|
|
25
31
|
export declare function useNats(): NatsContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nats-provider.d.ts","sourceRoot":"","sources":["../../src/nats/nats-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAmE,MAAM,OAAO,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,oGAAoG;IACpG,QAAQ,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"nats-provider.d.ts","sourceRoot":"","sources":["../../src/nats/nats-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAmE,MAAM,OAAO,CAAC;AACxG,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,oGAAoG;IACpG,QAAQ,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC9B,8FAA8F;IAC9F,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;IAC9C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAID,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,WAAW,GACZ,EAAE,iBAAiB,+BA+FnB;AAED,wBAAgB,OAAO,IAAI,gBAAgB,CAI1C;AAED,wBAAgB,eAAe,IAAI,gBAAgB,GAAG,IAAI,CAEzD"}
|
|
@@ -18,6 +18,7 @@ function NatsProvider({
|
|
|
18
18
|
const [client, setClient] = useState(null);
|
|
19
19
|
const [status, setStatus] = useState("closed");
|
|
20
20
|
const [reconnectionCount, setReconnectionCount] = useState(0);
|
|
21
|
+
const [terminal, setTerminal] = useState(false);
|
|
21
22
|
const getWsUrlRef = useRef(getWsUrl);
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
getWsUrlRef.current = getWsUrl;
|
|
@@ -58,9 +59,10 @@ function NatsProvider({
|
|
|
58
59
|
const lifecycle = startConnectionLifecycle({
|
|
59
60
|
conn,
|
|
60
61
|
wsUrl,
|
|
61
|
-
onBeforeReconnect: () => onBeforeReconnectRef.current?.(),
|
|
62
|
+
onBeforeReconnect: (ctx) => onBeforeReconnectRef.current?.(ctx),
|
|
62
63
|
backoff: reconnectionBackoffRef.current,
|
|
63
64
|
getFreshUrl: () => getWsUrlRef.current(),
|
|
65
|
+
onTerminal: () => setTerminal(true),
|
|
64
66
|
onStatusChange: (newStatus) => {
|
|
65
67
|
if (newStatus === "error") return;
|
|
66
68
|
setStatus(newStatus);
|
|
@@ -80,6 +82,7 @@ function NatsProvider({
|
|
|
80
82
|
}
|
|
81
83
|
setClient(null);
|
|
82
84
|
setStatus("closed");
|
|
85
|
+
setTerminal(false);
|
|
83
86
|
};
|
|
84
87
|
}, [urlRevision]);
|
|
85
88
|
const value = useMemo(
|
|
@@ -87,9 +90,10 @@ function NatsProvider({
|
|
|
87
90
|
client,
|
|
88
91
|
status,
|
|
89
92
|
isReady: status === "connected" && client !== null,
|
|
90
|
-
reconnectionCount
|
|
93
|
+
reconnectionCount,
|
|
94
|
+
terminal
|
|
91
95
|
}),
|
|
92
|
-
[client, status, reconnectionCount]
|
|
96
|
+
[client, status, reconnectionCount, terminal]
|
|
93
97
|
);
|
|
94
98
|
return /* @__PURE__ */ jsx(NatsContext.Provider, { value, children });
|
|
95
99
|
}
|
|
@@ -7,7 +7,26 @@ export declare const NATS_DEFAULTS: {
|
|
|
7
7
|
readonly RETRY_INITIAL_DELAY_MS: 1000;
|
|
8
8
|
readonly RETRY_MAX_DELAY_MS: 30000;
|
|
9
9
|
readonly RETRY_MULTIPLIER: 2;
|
|
10
|
+
/** Failed dials in a row after which the lifecycle stops dialling for a while. */
|
|
11
|
+
readonly PAUSE_AFTER_FAILURES: 5;
|
|
12
|
+
/** Length of a pause, plus up to 20% jitter so clients paused by one outage do not wake together. */
|
|
13
|
+
readonly PAUSE_MS: 300000;
|
|
14
|
+
/** A pause ignores visibility/online resume triggers for this long, so toggling tabs is not a retry button. */
|
|
15
|
+
readonly PAUSE_MIN_RESUME_MS: 30000;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* What `onBeforeReconnect` can decide about the connection, not just this attempt.
|
|
19
|
+
* - `continue` (or returning nothing): dial.
|
|
20
|
+
* - `pause`: no dials for `PAUSE_MS` plus jitter; ends early (not within `PAUSE_MIN_RESUME_MS`) on the tab
|
|
21
|
+
* becoming visible or the browser coming back online.
|
|
22
|
+
* - `terminal`: the connection can never come back (e.g. the tenant is gone). No lifecycle dials it again until a fresh acquire.
|
|
23
|
+
*/
|
|
24
|
+
export type NatsReconnectVerdict = 'continue' | 'pause' | 'terminal';
|
|
25
|
+
export interface NatsReconnectContext {
|
|
26
|
+
/** Dials that failed since the connection was last up. */
|
|
27
|
+
consecutiveFailures: number;
|
|
28
|
+
}
|
|
29
|
+
export type NatsBeforeReconnect = (ctx: NatsReconnectContext) => Promise<NatsReconnectVerdict | void> | NatsReconnectVerdict | void;
|
|
11
30
|
export interface NatsReconnectionBackoff {
|
|
12
31
|
/** Number of fast retries before exponential phase kicks in. Default: 0. */
|
|
13
32
|
fastRetries?: number;
|
|
@@ -41,6 +60,24 @@ export interface SharedConnection {
|
|
|
41
60
|
* found in; see {@link handOffRetry}.
|
|
42
61
|
*/
|
|
43
62
|
retrySchedulers: Set<() => void>;
|
|
63
|
+
/**
|
|
64
|
+
* Failed dials since the connection was last up. Lives here, not in a
|
|
65
|
+
* lifecycle, so a successor that takes over the loop (or a consumer that
|
|
66
|
+
* mounts) continues the same backoff instead of restarting at the fast tier.
|
|
67
|
+
*/
|
|
68
|
+
failedDials: number;
|
|
69
|
+
/** The rejection last counted into `failedDials`; see `countFailedDial`. */
|
|
70
|
+
lastDialError: unknown;
|
|
71
|
+
/** Set by a `terminal` verdict. Cleared only by a fresh acquire (see {@link acquireClient}). */
|
|
72
|
+
terminal: boolean;
|
|
73
|
+
/** Set while dialling is suspended; `until` is a `Date.now()` timestamp. */
|
|
74
|
+
pause: {
|
|
75
|
+
until: number;
|
|
76
|
+
startedAt: number;
|
|
77
|
+
dispose: () => void;
|
|
78
|
+
} | null;
|
|
79
|
+
/** One entry per lifecycle with an `onTerminal`; run when the connection turns terminal. */
|
|
80
|
+
terminalListeners: Set<() => void>;
|
|
44
81
|
}
|
|
45
82
|
export interface AcquireClientOptions {
|
|
46
83
|
name?: string;
|
|
@@ -66,11 +103,17 @@ export declare function getSharedConnectionFor(url: string | null | undefined):
|
|
|
66
103
|
export interface ConnectionLifecycleOptions {
|
|
67
104
|
conn: SharedConnection;
|
|
68
105
|
wsUrl: string;
|
|
69
|
-
onBeforeReconnect?:
|
|
106
|
+
onBeforeReconnect?: NatsBeforeReconnect;
|
|
70
107
|
backoff?: NatsReconnectionBackoff;
|
|
71
108
|
getFreshUrl: () => string | null;
|
|
72
109
|
/** Called on every status change (after closed-guard). */
|
|
73
110
|
onStatusChange?: (status: NatsStatus, evt: NatsStatusEvent) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Called once when the connection is (or already was, on attach) terminal.
|
|
113
|
+
* The status stays `disconnected`, so this is what tells that apart from an
|
|
114
|
+
* outage that is still being retried.
|
|
115
|
+
*/
|
|
116
|
+
onTerminal?: () => void;
|
|
74
117
|
/**
|
|
75
118
|
* Decide which statuses should trigger a retry attempt. Defaults to closed +
|
|
76
119
|
* disconnected. Override to skip 'error' (JetStream protocol errors that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-connection.d.ts","sourceRoot":"","sources":["../../src/nats/shared-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAElG,eAAO,MAAM,aAAa;;;;;;;;
|
|
1
|
+
{"version":3,"file":"shared-connection.d.ts","sourceRoot":"","sources":["../../src/nats/shared-connection.ts"],"names":[],"mappings":"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"}
|
|
@@ -7,7 +7,13 @@ const NATS_DEFAULTS = {
|
|
|
7
7
|
MAX_PING_OUT: 3,
|
|
8
8
|
RETRY_INITIAL_DELAY_MS: 1e3,
|
|
9
9
|
RETRY_MAX_DELAY_MS: 3e4,
|
|
10
|
-
RETRY_MULTIPLIER: 2
|
|
10
|
+
RETRY_MULTIPLIER: 2,
|
|
11
|
+
/** Failed dials in a row after which the lifecycle stops dialling for a while. */
|
|
12
|
+
PAUSE_AFTER_FAILURES: 5,
|
|
13
|
+
/** Length of a pause, plus up to 20% jitter so clients paused by one outage do not wake together. */
|
|
14
|
+
PAUSE_MS: 3e5,
|
|
15
|
+
/** A pause ignores visibility/online resume triggers for this long, so toggling tabs is not a retry button. */
|
|
16
|
+
PAUSE_MIN_RESUME_MS: 3e4
|
|
11
17
|
};
|
|
12
18
|
const connections = /* @__PURE__ */ new Map();
|
|
13
19
|
function getSharedConnection() {
|
|
@@ -42,9 +48,19 @@ function acquireClient(url, opts) {
|
|
|
42
48
|
closeTimer: null,
|
|
43
49
|
retryTimer: null,
|
|
44
50
|
retryOwner: null,
|
|
45
|
-
retrySchedulers: /* @__PURE__ */ new Set()
|
|
51
|
+
retrySchedulers: /* @__PURE__ */ new Set(),
|
|
52
|
+
failedDials: 0,
|
|
53
|
+
lastDialError: void 0,
|
|
54
|
+
terminal: false,
|
|
55
|
+
pause: null,
|
|
56
|
+
terminalListeners: /* @__PURE__ */ new Set()
|
|
46
57
|
};
|
|
47
58
|
connections.set(url, conn);
|
|
59
|
+
} else if (conn.refCount === 0) {
|
|
60
|
+
conn.failedDials = 0;
|
|
61
|
+
conn.terminal = false;
|
|
62
|
+
conn.pause?.dispose();
|
|
63
|
+
conn.pause = null;
|
|
48
64
|
}
|
|
49
65
|
conn.refCount += 1;
|
|
50
66
|
if (conn.closeTimer) {
|
|
@@ -69,6 +85,8 @@ function releaseClient(url, opts) {
|
|
|
69
85
|
clearTimeout(conn.retryTimer);
|
|
70
86
|
conn.retryTimer = null;
|
|
71
87
|
}
|
|
88
|
+
conn.pause?.dispose();
|
|
89
|
+
conn.pause = null;
|
|
72
90
|
void conn.client.close().catch(() => {
|
|
73
91
|
});
|
|
74
92
|
}, delay);
|
|
@@ -87,18 +105,78 @@ function handOffRetry(conn) {
|
|
|
87
105
|
function startConnectionLifecycle(options) {
|
|
88
106
|
const { conn, wsUrl } = options;
|
|
89
107
|
let closed = false;
|
|
90
|
-
|
|
108
|
+
function endPause() {
|
|
109
|
+
conn.pause?.dispose();
|
|
110
|
+
conn.pause = null;
|
|
111
|
+
}
|
|
112
|
+
function startPause() {
|
|
113
|
+
if (conn.pause) return;
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
const until = now + NATS_DEFAULTS.PAUSE_MS * (1 + Math.random() * 0.2);
|
|
116
|
+
const resume = () => {
|
|
117
|
+
if (!conn.pause) return;
|
|
118
|
+
if (Date.now() - conn.pause.startedAt < NATS_DEFAULTS.PAUSE_MIN_RESUME_MS) return;
|
|
119
|
+
endPause();
|
|
120
|
+
if (conn.terminal || conn.client.isConnected()) return;
|
|
121
|
+
if (conn.retryTimer) {
|
|
122
|
+
clearTimeout(conn.retryTimer);
|
|
123
|
+
conn.retryTimer = null;
|
|
124
|
+
}
|
|
125
|
+
if (conn.retryOwner) conn.retryOwner();
|
|
126
|
+
else handOffRetry(conn);
|
|
127
|
+
};
|
|
128
|
+
const onVisibility = () => {
|
|
129
|
+
if (document.visibilityState === "visible") resume();
|
|
130
|
+
};
|
|
131
|
+
const hasDom = typeof document !== "undefined" && typeof window !== "undefined";
|
|
132
|
+
if (hasDom) {
|
|
133
|
+
document.addEventListener("visibilitychange", onVisibility);
|
|
134
|
+
window.addEventListener("online", resume);
|
|
135
|
+
}
|
|
136
|
+
conn.failedDials = Math.min(conn.failedDials, NATS_DEFAULTS.PAUSE_AFTER_FAILURES - 1);
|
|
137
|
+
conn.pause = {
|
|
138
|
+
until,
|
|
139
|
+
startedAt: now,
|
|
140
|
+
dispose: () => {
|
|
141
|
+
if (!hasDom) return;
|
|
142
|
+
document.removeEventListener("visibilitychange", onVisibility);
|
|
143
|
+
window.removeEventListener("online", resume);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function markHealthy() {
|
|
148
|
+
endPause();
|
|
149
|
+
conn.failedDials = 0;
|
|
150
|
+
}
|
|
151
|
+
function countFailedDial(err) {
|
|
152
|
+
if (err === conn.lastDialError) return;
|
|
153
|
+
conn.lastDialError = err;
|
|
154
|
+
conn.failedDials++;
|
|
155
|
+
}
|
|
156
|
+
function markTerminal() {
|
|
157
|
+
endPause();
|
|
158
|
+
if (conn.retryTimer) clearTimeout(conn.retryTimer);
|
|
159
|
+
conn.terminal = true;
|
|
160
|
+
conn.retryOwner = null;
|
|
161
|
+
conn.retryTimer = null;
|
|
162
|
+
for (const listener of conn.terminalListeners) listener();
|
|
163
|
+
}
|
|
91
164
|
function emitSynthetic(status) {
|
|
92
165
|
if (closed) return;
|
|
93
166
|
options.onStatusChange?.(status, { status });
|
|
94
167
|
if (status === "connected") {
|
|
95
|
-
|
|
168
|
+
markHealthy();
|
|
96
169
|
}
|
|
97
170
|
}
|
|
171
|
+
const notifyTerminal = () => {
|
|
172
|
+
if (!closed) options.onTerminal?.();
|
|
173
|
+
};
|
|
174
|
+
conn.terminalListeners.add(notifyTerminal);
|
|
98
175
|
conn.retrySchedulers.add(scheduleRetry);
|
|
99
176
|
if (!conn.retryOwner) conn.retryOwner = scheduleRetry;
|
|
100
177
|
function scheduleRetry() {
|
|
101
178
|
if (closed) return;
|
|
179
|
+
if (conn.terminal) return;
|
|
102
180
|
if (getSharedConnectionFor(wsUrl) !== conn) return;
|
|
103
181
|
if (options.getFreshUrl() !== wsUrl) return;
|
|
104
182
|
if (!conn.retryOwner) conn.retryOwner = scheduleRetry;
|
|
@@ -110,23 +188,34 @@ function startConnectionLifecycle(options) {
|
|
|
110
188
|
const baseDelay = cfg.initialDelayMs ?? NATS_DEFAULTS.RETRY_INITIAL_DELAY_MS;
|
|
111
189
|
const maxDelay = cfg.maxDelayMs ?? NATS_DEFAULTS.RETRY_MAX_DELAY_MS;
|
|
112
190
|
const multiplier = cfg.multiplier ?? NATS_DEFAULTS.RETRY_MULTIPLIER;
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
191
|
+
const attempt = conn.failedDials;
|
|
192
|
+
const delay = attempt < fastRetries ? fastDelay : Math.min(baseDelay * multiplier ** (attempt - fastRetries), maxDelay);
|
|
193
|
+
const wait = Math.max(delay * (0.5 + Math.random() * 0.5), conn.pause ? conn.pause.until - Date.now() : 0);
|
|
116
194
|
const runRetry = async () => {
|
|
117
195
|
conn.retryTimer = null;
|
|
118
196
|
if (closed) return;
|
|
197
|
+
if (conn.terminal) return;
|
|
119
198
|
if (getSharedConnectionFor(wsUrl) !== conn) return;
|
|
120
199
|
if (conn.client.isConnected()) {
|
|
121
|
-
|
|
200
|
+
markHealthy();
|
|
122
201
|
return;
|
|
123
202
|
}
|
|
203
|
+
if (conn.pause && conn.pause.until <= Date.now()) endPause();
|
|
204
|
+
let verdict = void 0;
|
|
124
205
|
try {
|
|
125
|
-
await options.onBeforeReconnect?.();
|
|
206
|
+
verdict = await options.onBeforeReconnect?.({ consecutiveFailures: conn.failedDials });
|
|
126
207
|
} catch {
|
|
127
208
|
}
|
|
128
209
|
if (closed) return;
|
|
129
210
|
if (getSharedConnectionFor(wsUrl) !== conn) return;
|
|
211
|
+
if (conn.terminal) return;
|
|
212
|
+
if (verdict === "terminal") {
|
|
213
|
+
markTerminal();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (verdict === "pause" || conn.failedDials >= NATS_DEFAULTS.PAUSE_AFTER_FAILURES) {
|
|
217
|
+
startPause();
|
|
218
|
+
}
|
|
130
219
|
const freshUrl = options.getFreshUrl();
|
|
131
220
|
if (freshUrl !== wsUrl) {
|
|
132
221
|
if (conn.retryOwner === scheduleRetry) {
|
|
@@ -139,13 +228,18 @@ function startConnectionLifecycle(options) {
|
|
|
139
228
|
}
|
|
140
229
|
return;
|
|
141
230
|
}
|
|
231
|
+
if (conn.pause) {
|
|
232
|
+
scheduleRetry();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
142
235
|
try {
|
|
143
236
|
await conn.client.connect();
|
|
144
237
|
if (!closed && getSharedConnectionFor(wsUrl) === conn) {
|
|
145
|
-
|
|
238
|
+
markHealthy();
|
|
146
239
|
}
|
|
147
|
-
} catch {
|
|
240
|
+
} catch (err) {
|
|
148
241
|
if (!closed && getSharedConnectionFor(wsUrl) === conn) {
|
|
242
|
+
countFailedDial(err);
|
|
149
243
|
scheduleRetry();
|
|
150
244
|
}
|
|
151
245
|
}
|
|
@@ -154,14 +248,14 @@ function startConnectionLifecycle(options) {
|
|
|
154
248
|
runRetry().catch((err) => {
|
|
155
249
|
console.warn("[nats] retry attempt threw:", err);
|
|
156
250
|
});
|
|
157
|
-
},
|
|
251
|
+
}, wait);
|
|
158
252
|
}
|
|
159
253
|
const shouldRetryOn = options.shouldRetryOn ?? defaultShouldRetryOn;
|
|
160
254
|
const unsubStatus = conn.client.onStatus((evt) => {
|
|
161
255
|
if (closed) return;
|
|
162
256
|
options.onStatusChange?.(evt.status, evt);
|
|
163
257
|
if (evt.status === "connected") {
|
|
164
|
-
|
|
258
|
+
markHealthy();
|
|
165
259
|
}
|
|
166
260
|
if (shouldRetryOn(evt.status)) {
|
|
167
261
|
scheduleRetry();
|
|
@@ -170,20 +264,30 @@ function startConnectionLifecycle(options) {
|
|
|
170
264
|
if (conn.client.isConnected()) {
|
|
171
265
|
emitSynthetic("connected");
|
|
172
266
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
267
|
+
if (conn.terminal) {
|
|
268
|
+
emitSynthetic("disconnected");
|
|
269
|
+
options.onTerminal?.();
|
|
270
|
+
} else if (!conn.client.isConnected() && (conn.failedDials > 0 || conn.pause || conn.retryTimer)) {
|
|
271
|
+
emitSynthetic("disconnected");
|
|
272
|
+
scheduleRetry();
|
|
273
|
+
} else {
|
|
274
|
+
void (async () => {
|
|
275
|
+
try {
|
|
276
|
+
await conn.client.connect();
|
|
277
|
+
} catch (err) {
|
|
278
|
+
if (closed) return;
|
|
279
|
+
countFailedDial(err);
|
|
280
|
+
emitSynthetic("disconnected");
|
|
281
|
+
scheduleRetry();
|
|
282
|
+
}
|
|
283
|
+
})();
|
|
284
|
+
}
|
|
182
285
|
return {
|
|
183
286
|
stop() {
|
|
184
287
|
closed = true;
|
|
185
288
|
unsubStatus();
|
|
186
289
|
conn.retrySchedulers.delete(scheduleRetry);
|
|
290
|
+
conn.terminalListeners.delete(notifyTerminal);
|
|
187
291
|
if (conn.retryOwner !== scheduleRetry) {
|
|
188
292
|
return;
|
|
189
293
|
}
|
|
@@ -10,20 +10,20 @@ var _chunkFDZOE5TLcjs = require('./chunk-FDZOE5TL.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkMSAXZRXZcjs = require('./chunk-MSAXZRXZ.cjs');
|
|
14
14
|
require('./chunk-FLW2VL5W.cjs');
|
|
15
15
|
require('./chunk-NG3RKTQU.cjs');
|
|
16
16
|
require('./chunk-FRS2VO22.cjs');
|
|
17
17
|
require('./chunk-HQQE74RO.cjs');
|
|
18
18
|
require('./chunk-DEY6XXGO.cjs');
|
|
19
|
-
require('./chunk-
|
|
19
|
+
require('./chunk-EKDLVUEA.cjs');
|
|
20
20
|
require('./chunk-VXAKQRV7.cjs');
|
|
21
21
|
require('./chunk-24I6RFVU.cjs');
|
|
22
22
|
require('./chunk-7Z536SPR.cjs');
|
|
23
23
|
require('./chunk-MZ4KBSH7.cjs');
|
|
24
24
|
require('./chunk-YR74H7Z3.cjs');
|
|
25
|
-
require('./chunk-
|
|
26
|
-
require('./chunk-
|
|
25
|
+
require('./chunk-J4QORJMC.cjs');
|
|
26
|
+
require('./chunk-3FBXQSSC.cjs');
|
|
27
27
|
require('./chunk-JLKGLPDC.cjs');
|
|
28
28
|
require('./chunk-ZD6SZLO2.cjs');
|
|
29
29
|
require('./chunk-KVJKKVB3.cjs');
|
|
@@ -1859,7 +1859,7 @@ require('./chunk-4WIJI4AK.cjs');
|
|
|
1859
1859
|
require('./chunk-AHBTZ7DN.cjs');
|
|
1860
1860
|
require('./chunk-7JWFMAQB.cjs');
|
|
1861
1861
|
require('./chunk-V45KLJQP.cjs');
|
|
1862
|
-
require('./chunk-
|
|
1862
|
+
require('./chunk-QDB2JO55.cjs');
|
|
1863
1863
|
|
|
1864
1864
|
// src/components/product-demo/fixtures/policies.ts
|
|
1865
1865
|
var noop = () => {
|
|
@@ -1891,14 +1891,14 @@ var POLICIES = [
|
|
|
1891
1891
|
policy("policy-local-admins", "No local admins", "No everyday account is a local administrator.", false, 0)
|
|
1892
1892
|
];
|
|
1893
1893
|
var POLICIES_FIXTURE = {
|
|
1894
|
-
summary:
|
|
1894
|
+
summary: _chunkMSAXZRXZcjs.computePolicySummary.call(void 0, POLICIES),
|
|
1895
1895
|
rows: POLICIES.map((item) => ({
|
|
1896
1896
|
id: item.id,
|
|
1897
1897
|
name: item.name,
|
|
1898
1898
|
description: item.description,
|
|
1899
1899
|
critical: item.critical,
|
|
1900
1900
|
severityLabel: item.critical ? "Critical" : "Low",
|
|
1901
|
-
status:
|
|
1901
|
+
status: _chunkMSAXZRXZcjs.getPolicyTableStatus.call(void 0, item),
|
|
1902
1902
|
actions: [
|
|
1903
1903
|
{ label: "Policy Details", onClick: noop },
|
|
1904
1904
|
{ label: "Delete Policy", onClick: noop }
|
|
@@ -1912,16 +1912,16 @@ var POLICIES_FIXTURE = {
|
|
|
1912
1912
|
var _jsxruntime = require('react/jsx-runtime');
|
|
1913
1913
|
function PoliciesScreen({ compact = false }) {
|
|
1914
1914
|
const table = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1915
|
-
|
|
1915
|
+
_chunkMSAXZRXZcjs.PoliciesTable,
|
|
1916
1916
|
{
|
|
1917
1917
|
rows: POLICIES_FIXTURE.rows,
|
|
1918
1918
|
rowAsLink: true,
|
|
1919
|
-
rightSlot: compact ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1919
|
+
rightSlot: compact ? void 0 : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMSAXZRXZcjs.DataTable.RowCount, {}),
|
|
1920
1920
|
emptyMessage: "No policies found."
|
|
1921
1921
|
}
|
|
1922
1922
|
);
|
|
1923
1923
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-[var(--spacing-system-l)] bg-ods-bg p-[var(--spacing-system-l)]", children: [
|
|
1924
|
-
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1924
|
+
!compact && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMSAXZRXZcjs.PolicySummaryCards, { summary: POLICIES_FIXTURE.summary, now: POLICIES_FIXTURE.now }),
|
|
1925
1925
|
table
|
|
1926
1926
|
] });
|
|
1927
1927
|
}
|