@bicharts/chart-host 0.6.22 → 0.6.23

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/index.mjs CHANGED
@@ -2400,6 +2400,14 @@ function armGenerateGuard(next, now) {
2400
2400
  return { ...next, startedAt: now, inFlight: true };
2401
2401
  }
2402
2402
 
2403
+ // src/lastChart.ts
2404
+ function canShowLastChart(cachedVersionPersisted, cachedCodePersisted) {
2405
+ return (cachedVersionPersisted ?? 0) > 0 && String(cachedCodePersisted ?? "").trim() !== "";
2406
+ }
2407
+ function shouldRestoreVersionAfterLicenseSave(currentVersionValue, cachedVersionPersisted, cachedCodePersisted) {
2408
+ return (currentVersionValue ?? 0) === 0 && canShowLastChart(cachedVersionPersisted, cachedCodePersisted);
2409
+ }
2410
+
2403
2411
  // src/clientIdentity.ts
2404
2412
  function stableFingerprintOptions() {
2405
2413
  return { exclude: ["fonts", "system.useragent", "system.browser.version"], logging: false };
@@ -2537,6 +2545,7 @@ export {
2537
2545
  buildRenderPayload,
2538
2546
  buildReviewWire,
2539
2547
  canConfirmLaunch,
2548
+ canShowLastChart,
2540
2549
  captureSvgSnapshot,
2541
2550
  cellSuppressesNormalize,
2542
2551
  censusColourSpread,
@@ -2652,6 +2661,7 @@ export {
2652
2661
  sessionViewStateProvider,
2653
2662
  shouldOpenChooserOnGenerate,
2654
2663
  shouldOpenInlineChooserOnGenerate,
2664
+ shouldRestoreVersionAfterLicenseSave,
2655
2665
  shouldReview,
2656
2666
  stableFingerprintOptions,
2657
2667
  stripEsmExports,
@@ -39,5 +39,6 @@ export { PENDING_RECOVERY_WINDOW_MS, PENDING_RECOVERY_POLL_MS, PENDING_RECOVERY_
39
39
  export { stripJsComments } from "./codeComments";
40
40
  export { reconcileChartPick, type ChartPickReconciliation } from "./chartPick";
41
41
  export { isDuplicateGenerate, armGenerateGuard, DUPLICATE_GENERATE_WINDOW_MS, type GenerateGuardKey, type GenerateGuardState, } from "./duplicateGenerateGuard";
42
+ export { canShowLastChart, shouldRestoreVersionAfterLicenseSave } from "./lastChart";
42
43
  export { stableFingerprintOptions, fingerprintComponentDigest, type ClientIdSource } from "./clientIdentity";
43
44
  export type { HostServices, MarkerStore, PreferenceSource, HostTheme, ThemeSource, ThumbnailConsent, SnapshotTarget, WireSigner, WireTransport, WireResponse, CredentialTriple, CredentialSource, ViewportSource, Clock, DiagnosticEntry, DiagnosticsSink, RendererId, } from "./host/services";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Should the "show last chart" way back be offered?
3
+ *
4
+ * @param cachedVersionPersisted the PERSISTED cached version (not live render state)
5
+ * @param cachedCodePersisted the PERSISTED cached code (not live render state)
6
+ *
7
+ * True when a positive version is cached and its code is not blank.
8
+ */
9
+ export declare function canShowLastChart(cachedVersionPersisted: number | null | undefined, cachedCodePersisted: string | null | undefined): boolean;
10
+ /**
11
+ * After a licence is saved, should the host restore the cached version on its own?
12
+ *
13
+ * Only when the current version is 0 (missing reads as 0) - the reader was parked on the landing
14
+ * state - and there is a last chart to go back to (`canShowLastChart`).
15
+ */
16
+ export declare function shouldRestoreVersionAfterLicenseSave(currentVersionValue: number | null | undefined, cachedVersionPersisted: number | null | undefined, cachedCodePersisted: string | null | undefined): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/chart-host",
3
- "version": "0.6.22",
3
+ "version": "0.6.23",
4
4
  "description": "Run a BIC-generated D3 chart in any web host: compiles the generated render() function, applies the shared option defaults, resolves mark clicks (through tooltip overlays), owns the selection affordance, and translates row indices between cross-filtered charts. The same contract the BIC Power BI visual implements, minus Power BI. React bindings at @bicharts/chart-host/react.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",