@unisim/sdk 0.183.2 → 0.183.3
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/tuneThisApp.d.ts.map +1 -1
- package/dist/tuneThisApp.js +24 -1
- package/dist/tuneThisApp.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuneThisApp.d.ts","sourceRoot":"","sources":["../src/tuneThisApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tuneThisApp.d.ts","sourceRoot":"","sources":["../src/tuneThisApp.ts"],"names":[],"mappings":"AAqCA,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,8BAA8B,CAAA;AAUnE,oFAAoF;AACpF,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,IAAI,OAAO,CAG9C;AAED,iEAAiE;AACjE,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
|
package/dist/tuneThisApp.js
CHANGED
|
@@ -25,11 +25,19 @@
|
|
|
25
25
|
// vanished on the redirect home. Dev bundles it once, so it only showed live.
|
|
26
26
|
// One property on `window` is the same for every copy.
|
|
27
27
|
//
|
|
28
|
+
// ⚠️ …and in this tab's sessionStorage, for a request that has to outlive a
|
|
29
|
+
// FULL RELOAD (0.183.3). Live Ergo turned /settings → home into a reload:
|
|
30
|
+
// Cloudflare (next-on-pages) answers the in-app request for its home route
|
|
31
|
+
// with plain HTML, so Next falls back to loading the page afresh, and
|
|
32
|
+
// `window` with it. sessionStorage is per tab and is cleared with the
|
|
33
|
+
// request, so it cannot leak into another tab or a later visit.
|
|
34
|
+
//
|
|
28
35
|
// No React in here, so a route component can import it without dragging in
|
|
29
36
|
// anything (see colorSchemeKeys.ts for why that matters to the test harnesses).
|
|
30
37
|
/** The window event <UserProfile /> listens for. */
|
|
31
38
|
export const OPEN_TUNE_THIS_APP_EVENT = 'unisim:open-tune-this-app';
|
|
32
39
|
const FLAG = '__unisimTuneThisAppRequested';
|
|
40
|
+
const SESSION_KEY = 'unisim:open-tune-this-app';
|
|
33
41
|
// Before a window exists (SSR) a request cannot be shown anyway; a module-local
|
|
34
42
|
// holder keeps the calls safe there.
|
|
35
43
|
const local = {};
|
|
@@ -37,15 +45,30 @@ const holder = () => (typeof window !== 'undefined' ? window : local);
|
|
|
37
45
|
/** Opens this app's "Tune this app" dialog, now or as soon as the navbar mounts. */
|
|
38
46
|
export function openTuneThisApp() {
|
|
39
47
|
holder()[FLAG] = true;
|
|
48
|
+
try {
|
|
49
|
+
window.sessionStorage.setItem(SESSION_KEY, '1');
|
|
50
|
+
}
|
|
51
|
+
catch { /* no window, or storage blocked: the window flag still holds */ }
|
|
40
52
|
if (typeof window !== 'undefined')
|
|
41
53
|
window.dispatchEvent(new CustomEvent(OPEN_TUNE_THIS_APP_EVENT));
|
|
42
54
|
}
|
|
43
55
|
/** @internal Whether a request is waiting for the dialog to open. */
|
|
44
56
|
export function tuneThisAppRequested() {
|
|
45
|
-
|
|
57
|
+
if (holder()[FLAG] === true)
|
|
58
|
+
return true;
|
|
59
|
+
try {
|
|
60
|
+
return window.sessionStorage.getItem(SESSION_KEY) === '1';
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
46
65
|
}
|
|
47
66
|
/** @internal The dialog was closed: the request is done with. */
|
|
48
67
|
export function clearTuneThisAppRequest() {
|
|
49
68
|
holder()[FLAG] = false;
|
|
69
|
+
try {
|
|
70
|
+
window.sessionStorage.removeItem(SESSION_KEY);
|
|
71
|
+
}
|
|
72
|
+
catch { /* see openTuneThisApp */ }
|
|
50
73
|
}
|
|
51
74
|
//# sourceMappingURL=tuneThisApp.js.map
|
package/dist/tuneThisApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuneThisApp.js","sourceRoot":"","sources":["../src/tuneThisApp.ts"],"names":[],"mappings":"AAAA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