@bcrumbs.net/inbox 0.0.73 → 0.0.74

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bcrumbs.net/inbox",
3
3
  "description": "Inbox widget for Bread Crumbs portals",
4
- "version": "0.0.73",
4
+ "version": "0.0.74",
5
5
  "keyword": [
6
6
  "bcrumbs",
7
7
  "bc-ui",
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ /** Non-blocking notice that a newer build is deployed, with a reload onto it. */
3
+ declare const NewVersionBanner: FC;
4
+ export default NewVersionBanner;
@@ -0,0 +1,13 @@
1
+ type NewerBuild = {
2
+ /** Commit of a deployed build newer than the running one; null while the running build is current. */
3
+ newerSha: string | null;
4
+ /** Hides the notice until the next check finds the newer build again. */
5
+ dismiss: () => void;
6
+ };
7
+ /**
8
+ * Watches for a deploy newer than the running build. It checks when the tab
9
+ * becomes visible or regains focus, which is when a long-open tab comes back
10
+ * into use; the checker throttles both events to one request per interval.
11
+ */
12
+ export declare function useNewerBuild(): NewerBuild;
13
+ export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Hashed chunks from earlier deploys stay on static hosting, so a tab left open
3
+ * across a deploy keeps running its old build, and fixes never reach it until
4
+ * the user reloads by hand. Every deploy serves /version.json with the commit
5
+ * it was built from (tools/scripts/generate-build-info.js writes it together
6
+ * with build-info.json), so comparing that commit with the one this bundle was
7
+ * built from tells the tab it is out of date.
8
+ */
9
+ export declare const VERSION_CHECK_INTERVAL_MS: number;
10
+ /** Commit this bundle was built from. */
11
+ export declare const RUNNING_BUILD_SHA: string;
12
+ /** Commit of the deployed build, or null when version.json cannot be read. */
13
+ export declare function fetchDeployedSha(): Promise<string | null>;
14
+ type VersionCheckerOptions = {
15
+ runningSha: string;
16
+ fetchSha?: () => Promise<string | null>;
17
+ intervalMs?: number;
18
+ now?: () => number;
19
+ };
20
+ /**
21
+ * Returns a check that reads the deployed commit at most once per interval and
22
+ * resolves to it when it differs from the running build, otherwise to null.
23
+ * The interval starts at creation: a page that just loaded runs the latest build.
24
+ */
25
+ export declare function createVersionChecker({ runningSha, fetchSha, intervalMs, now, }: VersionCheckerOptions): () => Promise<string | null>;
26
+ /** Reloads onto the deployed build. index.html is served no-cache, so the reload pulls the new entry. */
27
+ export declare function reloadToDeployedBuild(deployedSha: string): void;
28
+ export {};
@@ -1238,6 +1238,12 @@ export declare const convertLanguageJsonToObject: (json: any, objToConvertTo?: C
1238
1238
  installApp: string;
1239
1239
  addAppToHomeScreen: string;
1240
1240
  };
1241
+ appVersion: {
1242
+ newVersionTitle: string;
1243
+ newVersionDescription: string;
1244
+ reload: string;
1245
+ later: string;
1246
+ };
1241
1247
  offline: {
1242
1248
  title: string;
1243
1249
  message: string;