@powerhousedao/connect 6.2.3-dev.9 → 6.2.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/{AddDriveModal-xAw48kdl.js → AddDriveModal-DhNfP94R.js} +5 -5
- package/dist/{AddDriveModal-xAw48kdl.js.map → AddDriveModal-DhNfP94R.js.map} +1 -1
- package/dist/{ClearStorageModal-C1BXHTq3.js → ClearStorageModal-DyU-FIgY.js} +5 -5
- package/dist/{ClearStorageModal-C1BXHTq3.js.map → ClearStorageModal-DyU-FIgY.js.map} +1 -1
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js → ConfirmDocumentUpgradeModal-DcOZy20m.js} +8 -7
- package/dist/{ConfirmDocumentUpgradeModal-FUOhZsk7.js.map → ConfirmDocumentUpgradeModal-DcOZy20m.js.map} +1 -1
- package/dist/{CookiesPolicyModal-BpyPPyxS.js → CookiesPolicyModal-BLw4pnhn.js} +4 -4
- package/dist/{CookiesPolicyModal-BpyPPyxS.js.map → CookiesPolicyModal-BLw4pnhn.js.map} +1 -1
- package/dist/{CreateDocumentModal-C45W8J0V.js → CreateDocumentModal-Bmv0V-kY.js} +6 -5
- package/dist/{CreateDocumentModal-C45W8J0V.js.map → CreateDocumentModal-Bmv0V-kY.js.map} +1 -1
- package/dist/{DebugSettingsModal-ClqHzcxM.js → DebugSettingsModal-CwUN9gIr.js} +7 -7
- package/dist/{DebugSettingsModal-ClqHzcxM.js.map → DebugSettingsModal-CwUN9gIr.js.map} +1 -1
- package/dist/{DeleteDriveModal-Dug84t1j.js → DeleteDriveModal-CjGnG0ht.js} +5 -5
- package/dist/{DeleteDriveModal-Dug84t1j.js.map → DeleteDriveModal-CjGnG0ht.js.map} +1 -1
- package/dist/{DeleteItemModal-mMzy3V8o.js → DeleteItemModal-BbY_4_xT.js} +5 -5
- package/dist/{DeleteItemModal-mMzy3V8o.js.map → DeleteItemModal-BbY_4_xT.js.map} +1 -1
- package/dist/{DisclaimerModal-DvpD5dPM.js → DisclaimerModal-DuglmEwL.js} +4 -4
- package/dist/{DisclaimerModal-DvpD5dPM.js.map → DisclaimerModal-DuglmEwL.js.map} +1 -1
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js → DocumentVersionUnsupportedModal-C4fy7fZ6.js} +4 -4
- package/dist/{DocumentVersionUnsupportedModal-C3Q0V75l.js.map → DocumentVersionUnsupportedModal-C4fy7fZ6.js.map} +1 -1
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js → DownloadDocumentWithErrorsModal-BsPQ5qgy.js} +6 -5
- package/dist/{DownloadDocumentWithErrorsModal-IKl0ljQb.js.map → DownloadDocumentWithErrorsModal-BsPQ5qgy.js.map} +1 -1
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js → DriveAuthRequiredModal-CtsB0kwH.js} +5 -5
- package/dist/{DriveAuthRequiredModal-DVK7ZQzO.js.map → DriveAuthRequiredModal-CtsB0kwH.js.map} +1 -1
- package/dist/{DriveSettingsModal-C6-mRQiv.js → DriveSettingsModal-d1L0eYof.js} +4 -4
- package/dist/{DriveSettingsModal-C6-mRQiv.js.map → DriveSettingsModal-d1L0eYof.js.map} +1 -1
- package/dist/{InspectorModal-7FQBTEzt.js → InspectorModal-Cd8kbCV8.js} +61 -21
- package/dist/InspectorModal-Cd8kbCV8.js.map +1 -0
- package/dist/{LoginModal-CybbOm3N.js → LoginModal-CI0ogC2-.js} +5 -5
- package/dist/{LoginModal-CybbOm3N.js.map → LoginModal-CI0ogC2-.js.map} +1 -1
- package/dist/{MissingPackageModal-nBnExqO0.js → MissingPackageModal-HFUPQMML.js} +5 -5
- package/dist/{MissingPackageModal-nBnExqO0.js.map → MissingPackageModal-HFUPQMML.js.map} +1 -1
- package/dist/{OpenFileDocumentsModal-DGaYJpXW.js → OpenFileDocumentsModal-BQsaBP4x.js} +8 -7
- package/dist/{OpenFileDocumentsModal-DGaYJpXW.js.map → OpenFileDocumentsModal-BQsaBP4x.js.map} +1 -1
- package/dist/{SettingsModal-CPv3_jmp.js → SettingsModal-CgjW-M2a.js} +17 -15
- package/dist/{SettingsModal-CPv3_jmp.js.map → SettingsModal-CgjW-M2a.js.map} +1 -1
- package/dist/{UpgradeDriveModal-_8t9slxQ.js → UpgradeDriveModal-CXX6D5Au.js} +4 -4
- package/dist/{UpgradeDriveModal-_8t9slxQ.js.map → UpgradeDriveModal-CXX6D5Au.js.map} +1 -1
- package/dist/app-loader-D2bV-77j.js +4 -0
- package/dist/{app-loader-DyGcBhGV.js → app-loader-l5wtQh5z.js} +1160 -1121
- package/dist/app-loader-l5wtQh5z.js.map +1 -0
- package/dist/app-skeleton--Me5zlSz.js +112 -0
- package/dist/app-skeleton--Me5zlSz.js.map +1 -0
- package/dist/app-skeleton-CBN4tenZ.js +4 -0
- package/dist/boot-DPNEOI2A.js +210 -0
- package/dist/boot-DPNEOI2A.js.map +1 -0
- package/dist/buffer-DNTcuap_.js +66 -0
- package/dist/buffer-DNTcuap_.js.map +1 -0
- package/dist/{build-info-D9_h0032.js → build-info-BV8UtyA4.js} +5 -5
- package/dist/{build-info-D9_h0032.js.map → build-info-BV8UtyA4.js.map} +1 -1
- package/dist/components-BH57lxCU.js +5 -0
- package/dist/{connect.config-DaHDEUrw.js → connect.config-CaXMoB42.js} +24 -12
- package/dist/connect.config-CaXMoB42.js.map +1 -0
- package/dist/{connection-state-3w4liC1X.js → connection-state-Eqc2izmt.js} +6 -6
- package/dist/{connection-state-3w4liC1X.js.map → connection-state-Eqc2izmt.js.map} +1 -1
- package/dist/{cookie-banner-BH6bIq24.js → cookie-banner-BxXvPdIY.js} +6 -6
- package/dist/{cookie-banner-BH6bIq24.js.map → cookie-banner-BxXvPdIY.js.map} +1 -1
- package/dist/{i18n-CWO0vYVd.js → i18n-CTgT1HG-.js} +3 -3
- package/dist/{i18n-CWO0vYVd.js.map → i18n-CTgT1HG-.js.map} +1 -1
- package/dist/{load-Cu7S9GPc.js → load-ftpCX1HI.js} +13 -11
- package/dist/{load-Cu7S9GPc.js.map → load-ftpCX1HI.js.map} +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +8 -8
- package/dist/main.js.map +1 -1
- package/dist/package-manager-BbzIV9aN.js +485 -0
- package/dist/package-manager-BbzIV9aN.js.map +1 -0
- package/dist/{pglite-major-B39aOEiE.js → pglite-major-p4_YefAE.js} +23 -5
- package/dist/pglite-major-p4_YefAE.js.map +1 -0
- package/dist/{pglite-migrate-core-Boxqqx-c.js → pglite-migrate-core-BcXcImng.js} +8 -6
- package/dist/{pglite-migrate-core-Boxqqx-c.js.map → pglite-migrate-core-BcXcImng.js.map} +1 -1
- package/dist/{pglite-seed-BqAUvNFw.js → pglite-seed-Cl2d-iyl.js} +4 -4
- package/dist/{pglite-seed-BqAUvNFw.js.map → pglite-seed-Cl2d-iyl.js.map} +1 -1
- package/dist/pglite.worker.d.ts +2 -1
- package/dist/pglite.worker.js +4 -3
- package/dist/pglite.worker.js.map +1 -1
- package/dist/pglite.worker.legacy.d.ts +2 -1
- package/dist/pglite.worker.legacy.js +4 -3
- package/dist/pglite.worker.legacy.js.map +1 -1
- package/dist/{preferences-store-_5Cw4_YV.js → preferences-store-DZUIAkHE.js} +6 -25
- package/dist/preferences-store-DZUIAkHE.js.map +1 -0
- package/dist/{pwa-manifest-link-DIgOSo2Q.js → pwa-manifest-link-DQRJpF0r.js} +3 -3
- package/dist/{pwa-manifest-link-DIgOSo2Q.js.map → pwa-manifest-link-DQRJpF0r.js.map} +1 -1
- package/dist/{reactor-yC8BveHb.js → reactor-CItc8KaF.js} +68 -437
- package/dist/reactor-CItc8KaF.js.map +1 -0
- package/dist/reactor.worker.d.ts +2 -1
- package/dist/reactor.worker.js +76 -21
- package/dist/reactor.worker.js.map +1 -1
- package/dist/{registerServiceWorker-BSzbNfvz.js → registerServiceWorker-smkROQhm.js} +5 -5
- package/dist/{registerServiceWorker-BSzbNfvz.js.map → registerServiceWorker-smkROQhm.js.map} +1 -1
- package/dist/renown-trust-DRgHpxlZ.js +34 -0
- package/dist/renown-trust-DRgHpxlZ.js.map +1 -0
- package/dist/{runtime-config-DL3QjcfM.js → runtime-config-DtJIUgYw.js} +3 -3
- package/dist/{runtime-config-DL3QjcfM.js.map → runtime-config-DtJIUgYw.js.map} +1 -1
- package/dist/{sentry-QXKgQmr2.js → sentry-jfDyrxdX.js} +3 -3
- package/dist/{sentry-QXKgQmr2.js.map → sentry-jfDyrxdX.js.map} +1 -1
- package/dist/start-connect.d.ts +4 -5
- package/dist/start-connect.d.ts.map +1 -1
- package/dist/start-connect.js +6 -8
- package/dist/start-connect.js.map +1 -1
- package/dist/style.css +2907 -1
- package/dist/{toast-BXIGd4Eb.js → toast-C6WW-_O-.js} +3 -3
- package/dist/{toast-BXIGd4Eb.js.map → toast-C6WW-_O-.js.map} +1 -1
- package/dist/{use-renown-login-Cf3va6u_.js → use-renown-login-BzOSQETV.js} +3 -3
- package/dist/{use-renown-login-Cf3va6u_.js.map → use-renown-login-BzOSQETV.js.map} +1 -1
- package/dist/useIsEmbedded-BWJ0qb7w.js +26 -0
- package/dist/useIsEmbedded-BWJ0qb7w.js.map +1 -0
- package/dist/{useRegistryPackages-BnUcL_nZ.js → useRegistryPackages-DuoU75ap.js} +73 -10
- package/dist/useRegistryPackages-DuoU75ap.js.map +1 -0
- package/package.json +19 -19
- package/style.css +7 -5
- package/dist/InspectorModal-7FQBTEzt.js.map +0 -1
- package/dist/app-loader-C4pFYc82.js +0 -4
- package/dist/app-loader-DyGcBhGV.js.map +0 -1
- package/dist/components-MEmS6hgr.js +0 -4
- package/dist/connect.config-DaHDEUrw.js.map +0 -1
- package/dist/pglite-major-B39aOEiE.js.map +0 -1
- package/dist/preferences-store-_5Cw4_YV.js.map +0 -1
- package/dist/reactor-yC8BveHb.js.map +0 -1
- package/dist/useRegistryPackages-BnUcL_nZ.js.map +0 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="827a79b9-8bfd-5e25-b77b-0bafcc0849fe")}catch(e){}}();
|
|
3
|
+
import { r as loadRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
|
|
4
|
+
import { r as track } from "./buffer-DNTcuap_.js";
|
|
5
|
+
import { createRoot } from "react-dom/client";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/utils/performance-observer.ts
|
|
8
|
+
/**
|
|
9
|
+
* Startup performance measurement.
|
|
10
|
+
*
|
|
11
|
+
* Captures First Contentful Paint (FCP) and Largest Contentful Paint (LCP) via
|
|
12
|
+
* the Performance API and reports each to the OpenPanel analytics buffer (a
|
|
13
|
+
* consent-gated, never-throwing queue). Call {@link initPerformanceObserver}
|
|
14
|
+
* at the very top of the entry module, before the runtime config is fetched,
|
|
15
|
+
* so FCP is caught even if the browser has already painted — a
|
|
16
|
+
* `PerformanceObserver` with `buffered: true` replays entries that fired
|
|
17
|
+
* before `observe()` was called.
|
|
18
|
+
*
|
|
19
|
+
* This module is intentionally dependency-light (only the OpenPanel event
|
|
20
|
+
* buffer, which has no runtime imports of its own) so it is safe to load
|
|
21
|
+
* before the runtime config is fetched. Every API access is guarded: nothing
|
|
22
|
+
* here may throw into the application.
|
|
23
|
+
*/
|
|
24
|
+
function navigationType() {
|
|
25
|
+
try {
|
|
26
|
+
return performance.getEntriesByType("navigation")[0]?.type;
|
|
27
|
+
} catch {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Mirror the metric on `window.ph.performance` for devtools inspection. Only
|
|
33
|
+
* writes to an already-existing `window.ph` (owned by the entry module) —
|
|
34
|
+
* never creates or replaces it, so it can't clobber the app's global state.
|
|
35
|
+
*/
|
|
36
|
+
function storeOnWindow(name, value) {
|
|
37
|
+
try {
|
|
38
|
+
const ph = window.ph;
|
|
39
|
+
if (!ph) return;
|
|
40
|
+
ph.performance = ph.performance ?? {};
|
|
41
|
+
ph.performance[name] = value;
|
|
42
|
+
} catch {}
|
|
43
|
+
}
|
|
44
|
+
function report(name, ms) {
|
|
45
|
+
const value = Math.round(ms);
|
|
46
|
+
const props = { ms: value };
|
|
47
|
+
const navType = navigationType();
|
|
48
|
+
if (navType) props.navigation = navType;
|
|
49
|
+
storeOnWindow(name, value);
|
|
50
|
+
if (!import.meta.env.PROD) try {
|
|
51
|
+
console.info(`[connect:performance] ${name}: ${value}ms`, props);
|
|
52
|
+
} catch {}
|
|
53
|
+
try {
|
|
54
|
+
track(`performance.${name}`, props);
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Starts the observers. Returns a disposer that detaches all of them. The app
|
|
59
|
+
* never needs it — the observers live as long as the page does — but it keeps
|
|
60
|
+
* the module testable and leaves no listener behind.
|
|
61
|
+
*/
|
|
62
|
+
function initPerformanceObserver() {
|
|
63
|
+
if (typeof window === "undefined" || typeof PerformanceObserver === "undefined") return () => void 0;
|
|
64
|
+
const teardown = [];
|
|
65
|
+
/** Registers a listener and queues its removal on dispose. */
|
|
66
|
+
const listen = (target, type, handler, once = true) => {
|
|
67
|
+
target.addEventListener(type, handler, { once });
|
|
68
|
+
teardown.push(() => target.removeEventListener(type, handler));
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
const fcpObserver = new PerformanceObserver((list) => {
|
|
72
|
+
for (const entry of list.getEntries()) if (entry.name === "first-contentful-paint") {
|
|
73
|
+
fcpObserver.disconnect();
|
|
74
|
+
report("first_contentful_paint", entry.startTime);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
fcpObserver.observe({
|
|
78
|
+
type: "paint",
|
|
79
|
+
buffered: true
|
|
80
|
+
});
|
|
81
|
+
teardown.push(() => fcpObserver.disconnect());
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.warn("[connect:performance] FCP observer failed:", err);
|
|
84
|
+
}
|
|
85
|
+
let lcpMs = 0;
|
|
86
|
+
let lcpReported = false;
|
|
87
|
+
let lcpObserver;
|
|
88
|
+
/** Latches the newest candidate of a batch. The last entry is the newest. */
|
|
89
|
+
const latch = (entries) => {
|
|
90
|
+
if (entries.length > 0) lcpMs = entries[entries.length - 1].startTime;
|
|
91
|
+
};
|
|
92
|
+
const reportLcp = () => {
|
|
93
|
+
if (lcpReported) return;
|
|
94
|
+
lcpReported = true;
|
|
95
|
+
try {
|
|
96
|
+
latch(lcpObserver?.takeRecords() ?? []);
|
|
97
|
+
} catch {}
|
|
98
|
+
lcpObserver?.disconnect();
|
|
99
|
+
if (lcpMs > 0) report("largest_contentful_paint", lcpMs);
|
|
100
|
+
};
|
|
101
|
+
try {
|
|
102
|
+
lcpObserver = new PerformanceObserver((list) => {
|
|
103
|
+
latch(list.getEntries());
|
|
104
|
+
});
|
|
105
|
+
lcpObserver.observe({
|
|
106
|
+
type: "largest-contentful-paint",
|
|
107
|
+
buffered: true
|
|
108
|
+
});
|
|
109
|
+
teardown.push(() => lcpObserver?.disconnect());
|
|
110
|
+
listen(window, "pagehide", reportLcp);
|
|
111
|
+
listen(window, "pointerdown", reportLcp);
|
|
112
|
+
listen(window, "keydown", reportLcp);
|
|
113
|
+
listen(document, "visibilitychange", () => {
|
|
114
|
+
if (document.visibilityState === "hidden") reportLcp();
|
|
115
|
+
}, false);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.warn("[connect:performance] LCP observer failed:", err);
|
|
118
|
+
}
|
|
119
|
+
return () => {
|
|
120
|
+
for (const detach of teardown) try {
|
|
121
|
+
detach();
|
|
122
|
+
} catch {}
|
|
123
|
+
teardown.length = 0;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/boot.tsx
|
|
128
|
+
const defaultDeps = {
|
|
129
|
+
loadConfig: () => loadRuntimeConfig(),
|
|
130
|
+
importSkeleton: () => import("./app-skeleton-CBN4tenZ.js"),
|
|
131
|
+
createRoot: () => createRoot(document.getElementById("root")),
|
|
132
|
+
initObserver: initPerformanceObserver
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Shown when startup cannot proceed. Deliberately built from plain elements:
|
|
136
|
+
* this renders precisely when the runtime config is unavailable, so it must
|
|
137
|
+
* not depend on anything that reads it.
|
|
138
|
+
*/
|
|
139
|
+
function BootError({ error }) {
|
|
140
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
141
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
142
|
+
role: "alert",
|
|
143
|
+
className: "flex h-screen flex-col items-center justify-center gap-3 bg-background p-6 text-center",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ jsx("h1", {
|
|
146
|
+
className: "text-lg font-semibold text-foreground",
|
|
147
|
+
children: "Connect could not start"
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsx("p", {
|
|
150
|
+
className: "max-w-prose text-sm text-foreground",
|
|
151
|
+
children: "Its runtime configuration could not be loaded. This is usually temporary — reloading often resolves it."
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx("pre", {
|
|
154
|
+
className: "max-w-prose overflow-x-auto rounded-sm bg-card px-3 py-2 text-left text-xs text-foreground",
|
|
155
|
+
children: message
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ jsx("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
className: "rounded-sm bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm",
|
|
160
|
+
onClick: () => {
|
|
161
|
+
window.location.reload();
|
|
162
|
+
},
|
|
163
|
+
children: "Reload"
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Paints the skeleton, then waits for the runtime config.
|
|
170
|
+
*
|
|
171
|
+
* Returns the root to render the app into, or `null` when startup failed — in
|
|
172
|
+
* which case the error state is already painted and the caller must not import
|
|
173
|
+
* the config-dependent app. It resolves rather than rejecting on failure: both
|
|
174
|
+
* entry points await this at their module's top level, where a rejection would
|
|
175
|
+
* surface only as an unhandled rejection behind a skeleton that never goes
|
|
176
|
+
* away.
|
|
177
|
+
*/
|
|
178
|
+
async function bootConnect(overrides = {}) {
|
|
179
|
+
const { loadConfig, importSkeleton, createRoot: makeRoot, initObserver } = {
|
|
180
|
+
...defaultDeps,
|
|
181
|
+
...overrides
|
|
182
|
+
};
|
|
183
|
+
if (!window.ph) window.ph = {};
|
|
184
|
+
initObserver();
|
|
185
|
+
const config = loadConfig().then(() => ({ ok: true }), (error) => ({
|
|
186
|
+
ok: false,
|
|
187
|
+
error
|
|
188
|
+
}));
|
|
189
|
+
const root = makeRoot();
|
|
190
|
+
try {
|
|
191
|
+
const { default: AppSkeleton } = await importSkeleton();
|
|
192
|
+
root.render(/* @__PURE__ */ jsx(AppSkeleton, {}));
|
|
193
|
+
} catch (error) {
|
|
194
|
+
console.error("[connect:boot] the app skeleton failed to load:", error);
|
|
195
|
+
root.render(/* @__PURE__ */ jsx(BootError, { error }));
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const result = await config;
|
|
199
|
+
if (!result.ok) {
|
|
200
|
+
console.error("[connect:boot] the runtime config failed to load:", result.error);
|
|
201
|
+
root.render(/* @__PURE__ */ jsx(BootError, { error: result.error }));
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return root;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
export { bootConnect as t };
|
|
208
|
+
|
|
209
|
+
//# sourceMappingURL=boot-DPNEOI2A.js.map
|
|
210
|
+
//# debugId=827a79b9-8bfd-5e25-b77b-0bafcc0849fe
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-DPNEOI2A.js","sources":["../src/utils/performance-observer.ts","../src/boot.tsx"],"sourcesContent":["import { track } from \"../services/openpanel/buffer.js\";\nimport type { PHGlobal } from \"@powerhousedao/reactor-browser\";\n\n/**\n * Startup performance measurement.\n *\n * Captures First Contentful Paint (FCP) and Largest Contentful Paint (LCP) via\n * the Performance API and reports each to the OpenPanel analytics buffer (a\n * consent-gated, never-throwing queue). Call {@link initPerformanceObserver}\n * at the very top of the entry module, before the runtime config is fetched,\n * so FCP is caught even if the browser has already painted — a\n * `PerformanceObserver` with `buffered: true` replays entries that fired\n * before `observe()` was called.\n *\n * This module is intentionally dependency-light (only the OpenPanel event\n * buffer, which has no runtime imports of its own) so it is safe to load\n * before the runtime config is fetched. Every API access is guarded: nothing\n * here may throw into the application.\n */\n\nfunction navigationType(): string | undefined {\n try {\n const entry = performance.getEntriesByType(\"navigation\")[0] as\n | PerformanceNavigationTiming\n | undefined;\n return entry?.type; // \"navigate\" | \"reload\" | \"back_forward\" | \"prerender\"\n } catch {\n return undefined;\n }\n}\n\n// window.ph is the app's global bag (PHGlobal). This module owns a\n// `performance` sub-object it writes into; `PhWithPerformance` is a named\n// stand-in for that write so it type-checks without touching the shared\n// PHGlobal definition.\ntype PhWithPerformance = PHGlobal & { performance?: Record<string, number> };\n\n/**\n * Mirror the metric on `window.ph.performance` for devtools inspection. Only\n * writes to an already-existing `window.ph` (owned by the entry module) —\n * never creates or replaces it, so it can't clobber the app's global state.\n */\nfunction storeOnWindow(name: string, value: number): void {\n try {\n const ph = window.ph as PhWithPerformance | undefined;\n if (!ph) return;\n ph.performance = ph.performance ?? {};\n ph.performance[name] = value;\n } catch {\n // devtools mirror is best-effort only\n }\n}\n\nfunction report(name: string, ms: number): void {\n const value = Math.round(ms);\n const props: Record<string, unknown> = { ms: value };\n const navType = navigationType();\n if (navType) props.navigation = navType;\n\n storeOnWindow(name, value);\n\n // The console summary is a developer aid. In a production build it is noise\n // in every user's console and in every support screenshot, so it is gated\n // out of the bundle there.\n if (!import.meta.env.PROD) {\n try {\n console.info(`[connect:performance] ${name}: ${value}ms`, props);\n } catch {\n // console is best-effort only\n }\n }\n\n try {\n track(`performance.${name}`, props);\n } catch {\n // analytics must never throw into the app\n }\n}\n\n/**\n * Starts the observers. Returns a disposer that detaches all of them. The app\n * never needs it — the observers live as long as the page does — but it keeps\n * the module testable and leaves no listener behind.\n */\nexport function initPerformanceObserver(): () => void {\n if (\n typeof window === \"undefined\" ||\n typeof PerformanceObserver === \"undefined\"\n ) {\n return () => undefined;\n }\n\n const teardown: Array<() => void> = [];\n\n /** Registers a listener and queues its removal on dispose. */\n const listen = (\n target: EventTarget,\n type: string,\n handler: () => void,\n once = true,\n ): void => {\n target.addEventListener(type, handler, { once });\n teardown.push(() => target.removeEventListener(type, handler));\n };\n\n // FCP — from the \"paint\" buffer. It fires once, so stop observing after it.\n try {\n const fcpObserver = new PerformanceObserver((list) => {\n for (const entry of list.getEntries()) {\n if (entry.name === \"first-contentful-paint\") {\n fcpObserver.disconnect();\n report(\"first_contentful_paint\", entry.startTime);\n }\n }\n });\n fcpObserver.observe({ type: \"paint\", buffered: true });\n teardown.push(() => fcpObserver.disconnect());\n } catch (err) {\n console.warn(\"[connect:performance] FCP observer failed:\", err);\n }\n\n // LCP — the final value only settles on an interaction or page hide, so latch\n // the latest candidate and report on the first terminal signal.\n let lcpMs = 0;\n let lcpReported = false;\n let lcpObserver: PerformanceObserver | undefined;\n\n /** Latches the newest candidate of a batch. The last entry is the newest. */\n const latch = (entries: ArrayLike<{ startTime: number }>): void => {\n if (entries.length > 0) {\n lcpMs = entries[entries.length - 1].startTime;\n }\n };\n\n const reportLcp = (): void => {\n // Several terminal signals can fire in one session (a click, then the page\n // hiding, then pagehide). The metric is sent for the first one only: every\n // repeat would be a double-count downstream.\n if (lcpReported) return;\n lcpReported = true;\n\n // A PerformanceObserver delivers entries in a task of its own, so a\n // terminal signal early in the page's life arrives while the newest\n // candidate is still buffered. Drain it before disconnecting — otherwise\n // an early click costs the session its LCP entirely.\n try {\n latch(lcpObserver?.takeRecords() ?? []);\n } catch {\n // draining is best-effort; report whatever was already delivered\n }\n\n lcpObserver?.disconnect();\n if (lcpMs > 0) report(\"largest_contentful_paint\", lcpMs);\n };\n\n try {\n lcpObserver = new PerformanceObserver((list) => {\n latch(list.getEntries());\n });\n lcpObserver.observe({ type: \"largest-contentful-paint\", buffered: true });\n teardown.push(() => lcpObserver?.disconnect());\n\n listen(window, \"pagehide\", reportLcp);\n listen(window, \"pointerdown\", reportLcp);\n listen(window, \"keydown\", reportLcp);\n // Not `once`: a page that loads in a background tab, or that the user tabs\n // away from and back, fires visibilitychange more than once, and only the\n // transition to \"hidden\" is terminal. A one-shot listener would be spent\n // on an earlier \"visible\" event and never see the hide.\n listen(\n document,\n \"visibilitychange\",\n () => {\n if (document.visibilityState === \"hidden\") reportLcp();\n },\n false,\n );\n } catch (err) {\n console.warn(\"[connect:performance] LCP observer failed:\", err);\n }\n\n return () => {\n for (const detach of teardown) {\n try {\n detach();\n } catch {\n // teardown is best-effort only\n }\n }\n teardown.length = 0;\n };\n}\n","import type { ComponentType, PropsWithChildren, ReactNode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport { loadRuntimeConfig } from \"./runtime-config.js\";\nimport { initPerformanceObserver } from \"./utils/performance-observer.js\";\n\n/**\n * The two-phase startup shared by both entry points.\n *\n * Phase 1 paints the config-independent skeleton, so first contentful paint\n * does not wait on the `powerhouse.config.json` round-trip. Phase 2 awaits the\n * config and hands the caller back the root to render the config-dependent app\n * into — every module that reads the runtime config at module-evaluation\n * throws if the cache isn't warm, so the app graph may only be imported after\n * this resolves.\n *\n * Kept dependency-light on purpose: it loads before the config is fetched, so\n * nothing in its import graph may read the config.\n */\n\n/** All the bootstrap needs of a React root — and all a test has to stand in for. */\ntype RenderTarget = { render: (node: ReactNode) => void };\n\nexport type BootDeps = {\n loadConfig: () => Promise<unknown>;\n importSkeleton: () => Promise<{ default: ComponentType<PropsWithChildren> }>;\n createRoot: () => RenderTarget;\n initObserver: () => () => void;\n};\n\nconst defaultDeps: BootDeps = {\n loadConfig: () => loadRuntimeConfig(),\n importSkeleton: () => import(\"./components/app-skeleton.js\"),\n createRoot: () => createRoot(document.getElementById(\"root\")!),\n initObserver: initPerformanceObserver,\n};\n\n/**\n * Shown when startup cannot proceed. Deliberately built from plain elements:\n * this renders precisely when the runtime config is unavailable, so it must\n * not depend on anything that reads it.\n */\nfunction BootError({ error }: { error: unknown }): ReactNode {\n const message = error instanceof Error ? error.message : String(error);\n return (\n <div\n role=\"alert\"\n className=\"flex h-screen flex-col items-center justify-center gap-3 bg-background p-6 text-center\"\n >\n <h1 className=\"text-lg font-semibold text-foreground\">\n Connect could not start\n </h1>\n <p className=\"max-w-prose text-sm text-foreground\">\n Its runtime configuration could not be loaded. This is usually temporary\n — reloading often resolves it.\n </p>\n <pre className=\"max-w-prose overflow-x-auto rounded-sm bg-card px-3 py-2 text-left text-xs text-foreground\">\n {message}\n </pre>\n <button\n type=\"button\"\n className=\"rounded-sm bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm\"\n onClick={() => {\n window.location.reload();\n }}\n >\n Reload\n </button>\n </div>\n );\n}\n\n/**\n * Paints the skeleton, then waits for the runtime config.\n *\n * Returns the root to render the app into, or `null` when startup failed — in\n * which case the error state is already painted and the caller must not import\n * the config-dependent app. It resolves rather than rejecting on failure: both\n * entry points await this at their module's top level, where a rejection would\n * surface only as an unhandled rejection behind a skeleton that never goes\n * away.\n */\nexport async function bootConnect(\n overrides: Partial<BootDeps> = {},\n): Promise<RenderTarget | null> {\n const {\n loadConfig,\n importSkeleton,\n createRoot: makeRoot,\n initObserver,\n } = { ...defaultDeps, ...overrides };\n\n if (!window.ph) {\n window.ph = {};\n }\n\n // Before anything else: the observers use `buffered: true`, so they catch\n // the browser's paint even when setup runs a tick after it fired.\n initObserver();\n\n // Started here and awaited at the bottom. The config fetch and the skeleton\n // chunk are independent round-trips, so they overlap; awaiting the chunk\n // first would put the config fetch — and with it everything the app needs —\n // behind it, which measured ~180ms of extra time-to-usable on a 150ms-RTT\n // connection. Mapping the rejection to a value here also means a config\n // failure is handled from the start, never an unhandled rejection.\n const config = loadConfig().then(\n () => ({ ok: true }) as const,\n (error: unknown) => ({ ok: false, error }) as const,\n );\n\n const root = makeRoot();\n\n try {\n const { default: AppSkeleton } = await importSkeleton();\n root.render(<AppSkeleton />);\n } catch (error) {\n console.error(\"[connect:boot] the app skeleton failed to load:\", error);\n root.render(<BootError error={error} />);\n return null;\n }\n\n const result = await config;\n if (!result.ok) {\n console.error(\n \"[connect:boot] the runtime config failed to load:\",\n result.error,\n );\n root.render(<BootError error={result.error} />);\n return null;\n }\n\n return root;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,iBAAqC;CAC5C,IAAI;EAIF,OAHc,YAAY,iBAAiB,YAAY,CAAC,CAAC,EAG7C,EAAE;CAChB,QAAQ;EACN;CACF;AACF;;;;;;AAaA,SAAS,cAAc,MAAc,OAAqB;CACxD,IAAI;EACF,MAAM,KAAK,OAAO;EAClB,IAAI,CAAC,IAAI;EACT,GAAG,cAAc,GAAG,eAAe,CAAC;EACpC,GAAG,YAAY,QAAQ;CACzB,QAAQ,CAER;AACF;AAEA,SAAS,OAAO,MAAc,IAAkB;CAC9C,MAAM,QAAQ,KAAK,MAAM,EAAE;CAC3B,MAAM,QAAiC,EAAE,IAAI,MAAM;CACnD,MAAM,UAAU,eAAe;CAC/B,IAAI,SAAS,MAAM,aAAa;CAEhC,cAAc,MAAM,KAAK;CAKzB,IAAI,CAAC,YAAY,IAAI,MACnB,IAAI;EACF,QAAQ,KAAK,yBAAyB,KAAK,IAAI,MAAM,KAAK,KAAK;CACjE,QAAQ,CAER;CAGF,IAAI;EACF,MAAM,eAAe,QAAQ,KAAK;CACpC,QAAQ,CAER;AACF;;;;;;AAOA,SAAgB,0BAAsC;CACpD,IACE,OAAO,WAAW,eAClB,OAAO,wBAAwB,aAE/B,aAAa,KAAA;CAGf,MAAM,WAA8B,CAAC;;CAGrC,MAAM,UACJ,QACA,MACA,SACA,OAAO,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,OAAO,IAAI;EACd,QAAQ,MACN,qDACA,OAAO,KACT;EACA,KAAK,OAAO,oBAAC,WAAD,EAAW,OAAO,OAAO,MAAQ,CAAA,CAAC;EAC9C,OAAO;CACT;CAEA,OAAO;AACT","debug_id":"827a79b9-8bfd-5e25-b77b-0bafcc0849fe"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//#region src/services/openpanel/buffer.ts
|
|
2
|
+
/**
|
|
3
|
+
* Hard cap on pre-init events held in memory. When full, the oldest entry is
|
|
4
|
+
* evicted (drop-oldest) so the most-recent events survive. Bounded, so an
|
|
5
|
+
* uninitialised client never leaks; `resetOpenPanelClient()` discards it
|
|
6
|
+
* entirely so pre-consent events are never replayed.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9c8bd7e7-a8db-5591-82b8-692c7f9f94e7")}catch(e){}}();
|
|
10
|
+
const BUFFER_CAP = 200;
|
|
11
|
+
const buffer = [];
|
|
12
|
+
let activeClient;
|
|
13
|
+
let errorHandler;
|
|
14
|
+
function defaultOnError(err) {
|
|
15
|
+
console.warn("[useOpenPanelAnalytics] track failed:", err);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Forward a single event to the active client, swallowing any throw.
|
|
19
|
+
*
|
|
20
|
+
* The outer try/catch handles synchronous throws from `client.track`; the
|
|
21
|
+
* inner `.catch()` handles rejected promises. Both are needed because
|
|
22
|
+
* `Promise.resolve(x).catch()` cannot catch a throw from evaluating `x`.
|
|
23
|
+
*/
|
|
24
|
+
function forward(client, name, props) {
|
|
25
|
+
try {
|
|
26
|
+
Promise.resolve(client.track(name, props)).catch((err) => (errorHandler ?? defaultOnError)(err));
|
|
27
|
+
} catch (err) {
|
|
28
|
+
(errorHandler ?? defaultOnError)(err);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Drain the pre-init buffer in FIFO order through `client.track`, then forward
|
|
33
|
+
* subsequent events directly. Called once from `getOpenPanelClient()`.
|
|
34
|
+
*/
|
|
35
|
+
function drainOpenPanelBuffer(client, onError) {
|
|
36
|
+
activeClient = client;
|
|
37
|
+
errorHandler = onError;
|
|
38
|
+
const pending = buffer.splice(0, buffer.length);
|
|
39
|
+
for (const [name, props] of pending) forward(client, name, props);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Clear the buffer and reset the active client. Buffered pre-consent events
|
|
43
|
+
* are discarded so they are not replayed if the user later re-accepts.
|
|
44
|
+
*/
|
|
45
|
+
function clearOpenPanelBuffer() {
|
|
46
|
+
buffer.length = 0;
|
|
47
|
+
activeClient = void 0;
|
|
48
|
+
errorHandler = void 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Track an analytics event. Sync, never throws. Forwards immediately when the
|
|
52
|
+
* client is initialised, otherwise buffers (FIFO, cap 200, drop-oldest).
|
|
53
|
+
*/
|
|
54
|
+
function track(name, props) {
|
|
55
|
+
if (activeClient) {
|
|
56
|
+
forward(activeClient, name, props);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (buffer.length >= BUFFER_CAP) buffer.shift();
|
|
60
|
+
buffer.push([name, props]);
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { drainOpenPanelBuffer as n, track as r, clearOpenPanelBuffer as t };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=buffer-DNTcuap_.js.map
|
|
66
|
+
//# debugId=9c8bd7e7-a8db-5591-82b8-692c7f9f94e7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-DNTcuap_.js","sources":["../src/services/openpanel/buffer.ts"],"sourcesContent":["import type { OpenPanelTracker } from \"./processor.js\";\n\n/**\n * Hard cap on pre-init events held in memory. When full, the oldest entry is\n * evicted (drop-oldest) so the most-recent events survive. Bounded, so an\n * uninitialised client never leaks; `resetOpenPanelClient()` discards it\n * entirely so pre-consent events are never replayed.\n */\nconst BUFFER_CAP = 200;\n\ntype BufferEntry = [name: string, props: Record<string, unknown> | undefined];\n\nconst buffer: BufferEntry[] = [];\nlet activeClient: OpenPanelTracker | undefined;\nlet errorHandler: ((err: unknown) => void) | undefined;\n\nfunction defaultOnError(err: unknown): void {\n console.warn(\"[useOpenPanelAnalytics] track failed:\", err);\n}\n\n/**\n * Forward a single event to the active client, swallowing any throw.\n *\n * The outer try/catch handles synchronous throws from `client.track`; the\n * inner `.catch()` handles rejected promises. Both are needed because\n * `Promise.resolve(x).catch()` cannot catch a throw from evaluating `x`.\n */\nfunction forward(\n client: OpenPanelTracker,\n name: string,\n props: Record<string, unknown> | undefined,\n): void {\n try {\n Promise.resolve(client.track(name, props)).catch((err) =>\n (errorHandler ?? defaultOnError)(err),\n );\n } catch (err) {\n (errorHandler ?? defaultOnError)(err);\n }\n}\n\n/**\n * Drain the pre-init buffer in FIFO order through `client.track`, then forward\n * subsequent events directly. Called once from `getOpenPanelClient()`.\n */\nexport function drainOpenPanelBuffer(\n client: OpenPanelTracker,\n onError?: (err: unknown) => void,\n): void {\n activeClient = client;\n errorHandler = onError;\n\n // Splice atomically so any track() during the drain is forwarded directly\n // (activeClient is set) rather than re-buffered.\n const pending = buffer.splice(0, buffer.length);\n for (const [name, props] of pending) {\n forward(client, name, props);\n }\n}\n\n/**\n * Clear the buffer and reset the active client. Buffered pre-consent events\n * are discarded so they are not replayed if the user later re-accepts.\n */\nexport function clearOpenPanelBuffer(): void {\n buffer.length = 0;\n activeClient = undefined;\n errorHandler = undefined;\n}\n\n/**\n * Track an analytics event. Sync, never throws. Forwards immediately when the\n * client is initialised, otherwise buffers (FIFO, cap 200, drop-oldest).\n */\nexport function track(name: string, props?: Record<string, unknown>): void {\n if (activeClient) {\n forward(activeClient, name, props);\n return;\n }\n\n if (buffer.length >= BUFFER_CAP) {\n buffer.shift();\n }\n buffer.push([name, props]);\n}\n"],"names":[],"mappings":";;;;;;;;;AAQA,MAAM,aAAa;AAInB,MAAM,SAAwB,CAAC;AAC/B,IAAI;AACJ,IAAI;AAEJ,SAAS,eAAe,KAAoB;CAC1C,QAAQ,KAAK,yCAAyC,GAAG;AAC3D;;;;;;;;AASA,SAAS,QACP,QACA,MACA,OACM;CACN,IAAI;EACF,QAAQ,QAAQ,OAAO,MAAM,MAAM,KAAK,CAAC,CAAC,CAAC,OAAO,SAC/C,gBAAgB,eAAA,CAAgB,GAAG,CACtC;CACF,SAAS,KAAK;EACZ,CAAC,gBAAgB,eAAA,CAAgB,GAAG;CACtC;AACF;;;;;AAMA,SAAgB,qBACd,QACA,SACM;CACN,eAAe;CACf,eAAe;CAIf,MAAM,UAAU,OAAO,OAAO,GAAG,OAAO,MAAM;CAC9C,KAAK,MAAM,CAAC,MAAM,UAAU,SAC1B,QAAQ,QAAQ,MAAM,KAAK;AAE/B;;;;;AAMA,SAAgB,uBAA6B;CAC3C,OAAO,SAAS;CAChB,eAAe,KAAA;CACf,eAAe,KAAA;AACjB;;;;;AAMA,SAAgB,MAAM,MAAc,OAAuC;CACzE,IAAI,cAAc;EAChB,QAAQ,cAAc,MAAM,KAAK;EACjC;CACF;CAEA,IAAI,OAAO,UAAU,YACnB,OAAO,MAAM;CAEf,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAC3B","debug_id":"9c8bd7e7-a8db-5591-82b8-692c7f9f94e7"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e4637ab0-7347-557c-b9ff-b6e22c0ac364")}catch(e){}}();
|
|
3
3
|
import { buildTreeUrl, shortGitSha } from "@powerhousedao/shared";
|
|
4
4
|
//#region src/utils/build-info.ts
|
|
5
5
|
function getVersion() {
|
|
6
|
-
return "6.2.3
|
|
6
|
+
return "6.2.3";
|
|
7
7
|
}
|
|
8
8
|
function getGitSha() {
|
|
9
|
-
return "
|
|
9
|
+
return "e640baf983cf66d0c2fff3b623b02433fe6747b4";
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Build identity baked in at build time (define PH_CONNECT_BUILD_HASH —
|
|
@@ -24,5 +24,5 @@ function getGitUrl() {
|
|
|
24
24
|
//#endregion
|
|
25
25
|
export { shortGitSha as a, getVersion as i, getGitSha as n, getGitUrl as r, getBuildHash as t };
|
|
26
26
|
|
|
27
|
-
//# sourceMappingURL=build-info-
|
|
28
|
-
//# debugId=
|
|
27
|
+
//# sourceMappingURL=build-info-BV8UtyA4.js.map
|
|
28
|
+
//# debugId=e4637ab0-7347-557c-b9ff-b6e22c0ac364
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info-
|
|
1
|
+
{"version":3,"file":"build-info-BV8UtyA4.js","sources":["../src/utils/build-info.ts"],"sourcesContent":["import { buildTreeUrl, shortGitSha } from \"@powerhousedao/shared\";\nimport { packageJson } from \"./package-json.js\";\n\nexport { shortGitSha };\n\ndeclare const CONNECT_VERSION: string | undefined;\ndeclare const CONNECT_GIT_SHA: string | undefined;\ndeclare const PH_CONNECT_BUILD_HASH: string | undefined;\n\nexport function getVersion(): string {\n if (typeof CONNECT_VERSION !== \"undefined\") return CONNECT_VERSION;\n return (\n process.env.WORKSPACE_VERSION ??\n process.env.npm_package_version ??\n packageJson.version\n );\n}\n\nexport function getGitSha(): string {\n if (typeof CONNECT_GIT_SHA !== \"undefined\") return CONNECT_GIT_SHA;\n return process.env.WORKSPACE_GIT_SHA ?? \"unknown\";\n}\n\n/**\n * Build identity baked in at build time (define PH_CONNECT_BUILD_HASH —\n * see builder-tools' connectBuildHashPlugin). Identical builds of the same\n * inputs produce the same hash; any change to the deployed content (Connect\n * version, project config, package list, build options) changes it.\n */\nexport function getBuildHash(): string {\n if (typeof PH_CONNECT_BUILD_HASH !== \"undefined\")\n return PH_CONNECT_BUILD_HASH;\n return \"unknown\";\n}\n\nexport function getGitUrl(): string | null {\n return buildTreeUrl(getGitSha());\n}\n"],"names":[],"mappings":";;;;AASA,SAAgB,aAAqB;CACS,OAAA;AAM9C;AAEA,SAAgB,YAAoB;CACU,OAAA;AAE9C;;;;;;;AAQA,SAAgB,eAAuB;CACrC,IAAI,OAAO,0BAA0B,aACnC,OAAO;CACT,OAAO;AACT;AAEA,SAAgB,YAA2B;CACzC,OAAO,aAAa,UAAU,CAAC;AACjC","debug_id":"e4637ab0-7347-557c-b9ff-b6e22c0ac364"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { t as AppSkeleton } from "./app-skeleton--Me5zlSz.js";
|
|
2
|
+
import { _ as EditorLoader, a as Root, b as Analytics, c as DriveIcon, g as AppContainer, i as Router, l as DotsLoader, n as Sidebar, o as Footer, r as SearchBar, s as DocumentEditor, t as AppLoader, u as App, v as DocumentEditorContainer, y as OpenPanel } from "./app-loader-l5wtQh5z.js";
|
|
3
|
+
export { Analytics, App, AppContainer, AppLoader, AppSkeleton, DocumentEditor, DocumentEditorContainer, DotsLoader, DriveIcon, EditorLoader, Footer, OpenPanel, Root, Router, SearchBar, Sidebar };
|
|
4
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6dd74711-4760-5603-947c-27cad41e800d")}catch(e){}}();
|
|
5
|
+
//# debugId=6dd74711-4760-5603-947c-27cad41e800d
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { n as getRuntimeConfig } from "./runtime-config-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="393ad854-91a3-56dd-a42b-613d747ff54e")}catch(e){}}();
|
|
3
|
+
import { n as getRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
|
|
4
4
|
import { loadRuntimeEnv, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
5
5
|
import { setLogLevel } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { logger } from "document-model";
|
|
7
|
+
//#region src/utils/openpanel-config.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resolve Connect's OpenPanel settings. The runtime config
|
|
10
|
+
* (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;
|
|
11
|
+
* the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that
|
|
12
|
+
* bake it keep working. An empty clientId leaves OpenPanel disabled.
|
|
13
|
+
*/
|
|
14
|
+
function resolveOpenPanelConfig(runtime, env) {
|
|
15
|
+
return {
|
|
16
|
+
clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || "",
|
|
17
|
+
apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || void 0,
|
|
18
|
+
trackUiEvents: runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,
|
|
19
|
+
trackOperations: runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
7
23
|
//#region src/connect.config.ts
|
|
8
24
|
const env = loadRuntimeEnv({ processEnv: import.meta.env });
|
|
9
25
|
const runtime = getRuntimeConfig().connect;
|
|
@@ -28,7 +44,7 @@ function getBuiltInDefaults() {
|
|
|
28
44
|
requiresHardRefresh: true,
|
|
29
45
|
warnOutdatedApp: true,
|
|
30
46
|
studioMode,
|
|
31
|
-
versionCheckInterval:
|
|
47
|
+
versionCheckInterval: 36e5,
|
|
32
48
|
cliVersion: env.PH_CONNECT_CLI_VERSION,
|
|
33
49
|
fileUploadOperationsChunkSize: 50,
|
|
34
50
|
gaTrackingId: void 0,
|
|
@@ -106,8 +122,9 @@ const PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(/\//g
|
|
|
106
122
|
const connectConfig = {
|
|
107
123
|
appVersion: env.PH_CONNECT_VERSION,
|
|
108
124
|
studioMode: runtime.app?.studioMode ?? false,
|
|
125
|
+
workflowsEnabled: runtime.app?.workflowsEnabled ?? false,
|
|
109
126
|
warnOutdatedApp: phGlobalConfig.warnOutdatedApp,
|
|
110
|
-
appVersionCheckInterval:
|
|
127
|
+
appVersionCheckInterval: 36e5,
|
|
111
128
|
routerBasename: PH_CONNECT_BASE_PATH,
|
|
112
129
|
offline: runtime.app?.offline ?? true,
|
|
113
130
|
aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,
|
|
@@ -128,12 +145,7 @@ const connectConfig = {
|
|
|
128
145
|
enabled: true,
|
|
129
146
|
externalProcessorsEnabled: true
|
|
130
147
|
},
|
|
131
|
-
openPanel:
|
|
132
|
-
clientId: env.PH_CONNECT_OPENPANEL_CLIENT_ID ?? "",
|
|
133
|
-
apiUrl: env.PH_CONNECT_OPENPANEL_API_URL,
|
|
134
|
-
trackUiEvents: env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,
|
|
135
|
-
trackOperations: env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS
|
|
136
|
-
},
|
|
148
|
+
openPanel: resolveOpenPanelConfig(runtime.openPanel, env),
|
|
137
149
|
renown: {
|
|
138
150
|
url: runtime.renown?.url,
|
|
139
151
|
networkId: runtime.renown?.networkId,
|
|
@@ -178,5 +190,5 @@ const connectConfig = {
|
|
|
178
190
|
//#endregion
|
|
179
191
|
export { defaultPHDocumentEditorConfig as a, defaultPHAppConfig as i, buildPHGlobalConfig as n, phGlobalConfig as o, connectConfig as r, PH_CONNECT_BASE_PATH as t };
|
|
180
192
|
|
|
181
|
-
//# sourceMappingURL=connect.config-
|
|
182
|
-
//# debugId=
|
|
193
|
+
//# sourceMappingURL=connect.config-CaXMoB42.js.map
|
|
194
|
+
//# debugId=393ad854-91a3-56dd-a42b-613d747ff54e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.config-CaXMoB42.js","sources":["../src/utils/openpanel-config.ts","../src/connect.config.ts"],"sourcesContent":["import type { PHConnectOpenPanel } from \"@powerhousedao/shared/clis\";\n\n/** The build-time (Vite env) OpenPanel settings, as parsed by loadRuntimeEnv. */\nexport type OpenPanelBuildEnv = {\n PH_CONNECT_OPENPANEL_CLIENT_ID?: string;\n PH_CONNECT_OPENPANEL_API_URL?: string;\n PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS: boolean;\n PH_CONNECT_OPENPANEL_TRACK_OPERATIONS: boolean;\n};\n\nexport type ResolvedOpenPanelConfig = {\n clientId: string;\n apiUrl: string | undefined;\n trackUiEvents: boolean;\n trackOperations: boolean;\n};\n\n/**\n * Resolve Connect's OpenPanel settings. The runtime config\n * (`connect.openPanel`, settable per deploy via PH_CONNECT_CONFIG_JSON) wins;\n * the build-time PH_CONNECT_OPENPANEL_* env is the fallback so builds that\n * bake it keep working. An empty clientId leaves OpenPanel disabled.\n */\nexport function resolveOpenPanelConfig(\n runtime: PHConnectOpenPanel | undefined,\n env: OpenPanelBuildEnv,\n): ResolvedOpenPanelConfig {\n return {\n clientId: runtime?.clientId || env.PH_CONNECT_OPENPANEL_CLIENT_ID || \"\",\n apiUrl: runtime?.apiUrl || env.PH_CONNECT_OPENPANEL_API_URL || undefined,\n trackUiEvents:\n runtime?.trackUiEvents ?? env.PH_CONNECT_OPENPANEL_TRACK_UI_EVENTS,\n trackOperations:\n runtime?.trackOperations ?? env.PH_CONNECT_OPENPANEL_TRACK_OPERATIONS,\n };\n}\n","import {\n setLogLevel,\n type PHAppConfig,\n type PHDocumentEditorConfig,\n type PHGlobalConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n loadRuntimeEnv,\n normalizeBasePath,\n} from \"@powerhousedao/shared/connect\";\nimport { logger } from \"document-model\";\nimport { getRuntimeConfig } from \"./runtime-config.js\";\nimport { resolveOpenPanelConfig } from \"./utils/openpanel-config.js\";\n\n// Env vars are reserved for version stamps and analytics processor toggles.\n// Everything in the Connect runtime schema (PHConnectRuntimeConfig) is read\n// from `runtime` below. The Sentry release tag is stamped at build time via\n// Vite's `define` so it always matches the sourcemap upload tag CI used.\nexport const env = loadRuntimeEnv({\n processEnv: import.meta.env,\n});\n\ndeclare const PH_CONNECT_SENTRY_RELEASE: string;\n\n// Runtime fields come from the JSON, not env. start-connect.tsx's top-level\n// await guarantees the loader cache is warm by the time this module\n// evaluates, so getRuntimeConfig() resolves synchronously. The cache merges\n// DEFAULT_CONNECT_CONFIG into whatever the file declared, so every leaf\n// under `runtime.*` is guaranteed defined.\nconst runtime = getRuntimeConfig().connect;\n\nfunction getRouterBasenameFromBasePath(basePath: string) {\n return basePath.endsWith(\"/\") ? basePath : basePath + \"/\";\n}\n\n// Runtime deploy base. In dynamic-base builds the plugin rewrites\n// import.meta.env.BASE_URL to (globalThis.__PH_DYNAMIC_BASE__||\"/\"), the same\n// base assets resolve against; it takes precedence so router basename and\n// path stripping match the served subpath. A baked runtime base path\n// (runtime.app.basePath) only applies to concrete-base builds, where the\n// dynamic global is unset.\nfunction getDeployBasePath() {\n if (\n typeof globalThis !== \"undefined\" &&\n (globalThis as { __PH_DYNAMIC_BASE__?: string }).__PH_DYNAMIC_BASE__\n ) {\n return import.meta.env.BASE_URL;\n }\n return runtime.app?.basePath || import.meta.env.BASE_URL;\n}\n\n// Hardcoded literal defaults for `PHGlobalConfig` fields whose env-var\n// source was removed. The fields stay on the type so wired-but-dead SW /\n// hook consumers keep typechecking; values mirror the previous Zod\n// defaults.\nfunction getBuiltInDefaults(): Omit<\n PHGlobalConfig,\n \"basePath\" | \"routerBasename\"\n> {\n const studioMode = runtime.app?.studioMode ?? false;\n // Drive containers, DocumentModel, and vetra builder-spec types are authored\n // via their own drives — never creatable from a generic drive.\n const disabledEditors = [\n \"powerhouse/document-drive\",\n \"powerhouse/reactor-drive\",\n \"powerhouse/document-model\",\n \"powerhouse/app\",\n \"powerhouse/document-editor\",\n \"powerhouse/processor\",\n \"powerhouse/subgraph\",\n \"powerhouse/package\",\n ];\n return {\n allowList: undefined,\n allowedDocumentTypes: [],\n isDragAndDropEnabled: true,\n isEditorDebugModeEnabled: false,\n isEditorReadModeEnabled: false,\n isExternalControlsEnabled: false,\n version: env.PH_CONNECT_VERSION,\n logLevel: runtime.app?.logLevel,\n requiresHardRefresh: true,\n warnOutdatedApp: true,\n studioMode,\n versionCheckInterval: 60 * 60 * 1000,\n cliVersion: env.PH_CONNECT_CLI_VERSION,\n fileUploadOperationsChunkSize: 50,\n gaTrackingId: undefined,\n defaultDrivesUrl: runtime.drives?.defaultDrives?.find(\n (drive) => \"url\" in drive,\n )?.url,\n drivesPreserveStrategy: runtime.drives?.preserveStrategy,\n enabledEditors: undefined,\n disabledEditors,\n\n /* Processors */\n isExternalProcessorsEnabled: true,\n // Analytics off by default; flip to true (or wire a runtime-config field)\n // when we want analytics enabled out of the box.\n isAnalyticsEnabled: false,\n isAnalyticsExternalProcessorsEnabled:\n env.PH_CONNECT_EXTERNAL_ANALYTICS_PROCESSORS_ENABLED,\n analyticsDatabaseName: undefined,\n isRelationalProcessorsEnabled: true,\n isExternalRelationalProcessorsEnabled: true,\n\n renownUrl: runtime.renown?.url,\n renownNetworkId: runtime.renown?.networkId,\n renownChainId: runtime.renown?.chainId,\n switchboardUrl: runtime.renown?.switchboardUrl,\n renownAdapters: runtime.renown?.adapters,\n sentryRelease: PH_CONNECT_SENTRY_RELEASE,\n sentryDsn: runtime.sentry?.dsn ?? undefined,\n sentryEnv: runtime.sentry?.env,\n isDiffAnalyticsEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n isDriveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n isPublicDrivesEnabled: runtime.drives?.sections?.remote?.enabled,\n isCloudDrivesEnabled: runtime.drives?.sections?.remote?.enabled ?? true,\n isLocalDrivesEnabled: runtime.drives?.sections?.local?.enabled,\n isSentryTracingEnabled: runtime.sentry?.tracing,\n isDocumentModelSelectionSettingsEnabled: false,\n isAddDriveEnabled: runtime.drives?.allowAddDrive,\n isAddPublicDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd,\n isDeletePublicDrivesEnabled: runtime.drives?.sections?.remote?.allowDelete,\n isAddCloudDrivesEnabled: runtime.drives?.sections?.remote?.allowAdd ?? true,\n isDeleteCloudDrivesEnabled:\n runtime.drives?.sections?.remote?.allowDelete ?? true,\n isAddLocalDrivesEnabled: runtime.drives?.sections?.local?.allowAdd,\n isDeleteLocalDrivesEnabled: runtime.drives?.sections?.local?.allowDelete,\n isAnalyticsDatabaseWorkerEnabled: false,\n isExternalPackagesEnabled: runtime.packages?.externalEnabled,\n };\n}\n\nexport function buildPHGlobalConfig(\n basePath: string,\n routerBasename: string,\n connectFromConfig: PHConnectRuntimeConfig,\n): PHGlobalConfig {\n const defaults = getBuiltInDefaults();\n const fileOverrides: Partial<PHGlobalConfig> = {};\n\n if (connectFromConfig.drives?.allowAddDrive !== undefined) {\n fileOverrides.isAddDriveEnabled = connectFromConfig.drives.allowAddDrive;\n }\n\n return {\n basePath,\n routerBasename,\n ...defaults,\n ...fileOverrides,\n };\n}\n\nfunction getPHGlobalConfigFromRuntime(): PHGlobalConfig {\n // Deploy base wins via getDeployBasePath: the dynamic-base global when set,\n // else runtime.app.basePath (DEFAULT_CONNECT_CONFIG guarantees it defined),\n // with a \"/\" fallback as a defensive guard for typecheck.\n const basePath = getDeployBasePath() ?? \"/\";\n const routerBasename = getRouterBasenameFromBasePath(basePath);\n return buildPHGlobalConfig(basePath, routerBasename, runtime);\n}\n\nexport const phGlobalConfig = getPHGlobalConfigFromRuntime();\n\nexport const defaultPHDocumentEditorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: phGlobalConfig.isExternalControlsEnabled,\n};\n\nexport const defaultPHAppConfig: PHAppConfig = {\n allowedDocumentTypes: phGlobalConfig.allowedDocumentTypes,\n isDragAndDropEnabled: phGlobalConfig.isDragAndDropEnabled,\n};\n\n// Set log level from the runtime config (DEFAULT_CONNECT_CONFIG provides a\n// fallback, so this is always defined).\nconst RESOLVED_LOG_LEVEL = runtime.app?.logLevel;\nif (RESOLVED_LOG_LEVEL) {\n setLogLevel(RESOLVED_LOG_LEVEL);\n}\nlogger.debug(\"Setting log level to @level.\", RESOLVED_LOG_LEVEL);\n\n// Normalize the base path to ensure it starts and ends with a forward slash.\nexport const PH_CONNECT_BASE_PATH = normalizeBasePath(\n getDeployBasePath() ?? \"/\",\n);\n\n// Analytics database name — derived deterministically from the base path so\n// instances on different prefixes of one origin do not share an analytics DB.\n// Root resolves to \":analytics\".\nconst PH_CONNECT_ANALYTICS_DATABASE_NAME = `${PH_CONNECT_BASE_PATH.replace(\n /\\//g,\n \"\",\n)}:analytics`;\n\n// The CLOUD section was collapsed into the unified `remote` section. PUBLIC\n// keeps its existing string identifier in the legacy\n// connectConfig.drives.sections map to avoid rippling through downstream UI\n// components — both PUBLIC and the\n// soon-to-be-removed CLOUD readers point at runtime.drives.sections.remote.\nexport const connectConfig = {\n appVersion: env.PH_CONNECT_VERSION,\n studioMode: runtime.app?.studioMode ?? false,\n // Boot-time constant, so it is read straight off the runtime config rather\n // than through the PHGlobalConfig event machinery. Off unless turned on.\n workflowsEnabled: runtime.app?.workflowsEnabled ?? false,\n warnOutdatedApp: phGlobalConfig.warnOutdatedApp,\n appVersionCheckInterval: 60 * 60 * 1000,\n routerBasename: PH_CONNECT_BASE_PATH,\n offline: runtime.app?.offline ?? true,\n aiAssistantEnabled: runtime.ai?.assistantEnabled ?? false,\n externalPackagesEnabled: runtime.packages?.externalEnabled,\n processors: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n analytics: {\n enabled: true,\n databaseName: PH_CONNECT_ANALYTICS_DATABASE_NAME,\n useWorker: false,\n driveAnalyticsEnabled: env.PH_CONNECT_DRIVE_ANALYTICS_ENABLED,\n diffProcessorEnabled: env.PH_CONNECT_DIFF_ANALYTICS_ENABLED,\n externalProcessorsEnabled: true,\n },\n relational: {\n enabled: true,\n externalProcessorsEnabled: true,\n },\n // Runtime `connect.openPanel` wins; the build-time PH_CONNECT_OPENPANEL_*\n // env is the fallback. An empty clientId (the default) keeps it disabled.\n // `trackUiEvents` is intentionally dormant — no call sites gate on it yet.\n openPanel: resolveOpenPanelConfig(runtime.openPanel, env),\n renown: {\n url: runtime.renown?.url,\n networkId: runtime.renown?.networkId,\n chainId: runtime.renown?.chainId,\n namespace: runtime.renown?.namespace,\n switchboardUrl: runtime.renown?.switchboardUrl,\n adapters: runtime.renown?.adapters,\n },\n sentry: {\n release: PH_CONNECT_SENTRY_RELEASE,\n // `dsn: null` (default) means Sentry is disabled — useInitSentry bails.\n dsn: runtime.sentry?.dsn ?? null,\n env: runtime.sentry?.env,\n tracing: runtime.sentry?.tracing ?? false,\n },\n content: {\n showSearchBar: false,\n showDocumentModelSelectionSetting: false,\n },\n drives: {\n addDriveEnabled: runtime.drives?.allowAddDrive,\n preserveStrategy: runtime.drives?.preserveStrategy,\n // The legacy `SharingType` enum still includes a \"CLOUD\" variant.\n // Connect collapsed CLOUD into the unified remote section, so both CLOUD\n // and PUBLIC map to the same `runtime.drives.sections.remote` object —\n // the alias keeps `sections[sharingType]` lookups type-safe for every\n // SharingType value.\n sections: (() => {\n const remote = {\n enabled: runtime.drives?.sections?.remote?.enabled,\n allowAdd: runtime.drives?.sections?.remote?.allowAdd,\n allowDelete: runtime.drives?.sections?.remote?.allowDelete,\n };\n return {\n LOCAL: {\n enabled: runtime.drives?.sections?.local?.enabled,\n allowAdd: runtime.drives?.sections?.local?.allowAdd,\n allowDelete: runtime.drives?.sections?.local?.allowDelete,\n },\n PUBLIC: remote,\n CLOUD: remote,\n };\n })(),\n },\n gaTrackingId: undefined,\n phCliVersion: env.PH_CONNECT_CLI_VERSION,\n} as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuBA,SAAgB,uBACd,SACA,KACyB;CACzB,OAAO;EACL,UAAU,SAAS,YAAY,IAAI,kCAAkC;EACrE,QAAQ,SAAS,UAAU,IAAI,gCAAgC,KAAA;EAC/D,eACE,SAAS,iBAAiB,IAAI;EAChC,iBACE,SAAS,mBAAmB,IAAI;CACpC;AACF;;;AChBA,MAAa,MAAM,eAAe,EAChC,YAAY,YAAY,IAC1B,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,CAAC;AAEnC,SAAS,8BAA8B,UAAkB;CACvD,OAAO,SAAS,SAAS,GAAG,IAAI,WAAW,WAAW;AACxD;AAQA,SAAS,oBAAoB;CAC3B,IACE,OAAO,eAAe,eACrB,WAAgD,qBAEjD,OAAO,YAAY,IAAI;CAEzB,OAAO,QAAQ,KAAK,YAAY,YAAY,IAAI;AAClD;AAMA,SAAS,qBAGP;CACA,MAAM,aAAa,QAAQ,KAAK,cAAc;CAa9C,OAAO;EACL,WAAW,KAAA;EACX,sBAAsB,CAAC;EACvB,sBAAsB;EACtB,0BAA0B;EAC1B,yBAAyB;EACzB,2BAA2B;EAC3B,SAAS,IAAI;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WAAW,QAAQ,QAAQ;EAC3B,gBAAgB,QAAQ,QAAQ;EAChC,UAAU,QAAQ,QAAQ;CAC5B;CACA,QAAQ;EACN,SAAS;EAET,KAAK,QAAQ,QAAQ,OAAO;EAC5B,KAAK,QAAQ,QAAQ;EACrB,SAAS,QAAQ,QAAQ,WAAW;CACtC;CACA,SAAS;EACP,eAAe;EACf,mCAAmC;CACrC;CACA,QAAQ;EACN,iBAAiB,QAAQ,QAAQ;EACjC,kBAAkB,QAAQ,QAAQ;EAMlC,iBAAiB;GACf,MAAM,SAAS;IACb,SAAS,QAAQ,QAAQ,UAAU,QAAQ;IAC3C,UAAU,QAAQ,QAAQ,UAAU,QAAQ;IAC5C,aAAa,QAAQ,QAAQ,UAAU,QAAQ;GACjD;GACA,OAAO;IACL,OAAO;KACL,SAAS,QAAQ,QAAQ,UAAU,OAAO;KAC1C,UAAU,QAAQ,QAAQ,UAAU,OAAO;KAC3C,aAAa,QAAQ,QAAQ,UAAU,OAAO;IAChD;IACA,QAAQ;IACR,OAAO;GACT;EACF,EAAA,CAAG;CACL;CACA,cAAc,KAAA;CACd,cAAc,IAAI;AACpB","debug_id":"393ad854-91a3-56dd-a42b-613d747ff54e"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { n as getRuntimeConfig } from "./runtime-config-
|
|
4
|
-
import { n as isMigratableMajor, t as coerceMajor, u as readPgVersionFile } from "./pglite-major-
|
|
5
|
-
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b00fd9bd-6ddd-571e-9f85-f37bdef2f520")}catch(e){}}();
|
|
3
|
+
import { n as getRuntimeConfig } from "./runtime-config-DtJIUgYw.js";
|
|
4
|
+
import { n as isMigratableMajor, t as coerceMajor, u as readPgVersionFile } from "./pglite-major-p4_YefAE.js";
|
|
5
|
+
import { t as PH_CONNECT_BASE_PATH } from "./connect.config-CaXMoB42.js";
|
|
6
6
|
import { ROOT_STORAGE_NAMESPACE, getStorageNamespace } from "@powerhousedao/shared/connect";
|
|
7
7
|
import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME, hashNamespace } from "@powerhousedao/shared/processors";
|
|
8
8
|
//#region src/utils/reactor-namespace.ts
|
|
@@ -122,5 +122,5 @@ function subscribeWorkerConnection(listener) {
|
|
|
122
122
|
//#endregion
|
|
123
123
|
export { detectReactorPgMajor as a, getCachedReactorPgMajor as c, subscribeReactorPgMajor as d, PRIMARY_IDB_NAMES as f, RELATIONAL_PGLITE_NAME as h, detectMigrationMajor as i, invalidateReactorPgMajorCache as l, REACTOR_PGLITE_NAME as m, setWorkerConnectionStatus as n, detectRelationalPgMajor as o, REACTOR_INSTANCE_NAMESPACE as p, subscribeWorkerConnection as r, getCachedMigrationMajor as s, getWorkerConnectionStatus as t, subscribeMigrationMajor as u };
|
|
124
124
|
|
|
125
|
-
//# sourceMappingURL=connection-state-
|
|
126
|
-
//# debugId=
|
|
125
|
+
//# sourceMappingURL=connection-state-Eqc2izmt.js.map
|
|
126
|
+
//# debugId=b00fd9bd-6ddd-571e-9f85-f37bdef2f520
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-state-
|
|
1
|
+
{"version":3,"file":"connection-state-Eqc2izmt.js","sources":["../src/utils/reactor-namespace.ts","../src/utils/storage-namespace.ts","../src/utils/pglite-runtime.ts","../src/connection-state.ts"],"sourcesContent":["import { getStorageNamespace } from \"@powerhousedao/shared/connect\";\nimport { hashNamespace } from \"@powerhousedao/shared/processors\";\n\nexport type ReactorNamespaceInput = {\n basePath: string;\n explicit?: string;\n endpoint?: string;\n};\n\nexport function resolveReactorNamespace(input: ReactorNamespaceInput): string {\n const explicit = input.explicit?.trim();\n if (explicit) {\n return explicit;\n }\n const base = getStorageNamespace(input.basePath);\n const endpoint = input.endpoint?.trim();\n if (endpoint) {\n return `${base}--${hashNamespace(endpoint, 8)}`;\n }\n return base;\n}\n","import { DEFAULT_RELATIONAL_PROCESSOR_DB_NAME } from \"@powerhousedao/shared/processors\";\nimport { ROOT_STORAGE_NAMESPACE } from \"@powerhousedao/shared/connect\";\nimport { PH_CONNECT_BASE_PATH } from \"../connect.config.js\";\nimport { getRuntimeConfig } from \"../runtime-config.js\";\nimport { resolveReactorNamespace } from \"./reactor-namespace.js\";\n\nexport const REACTOR_INSTANCE_NAMESPACE = resolveReactorNamespace({\n basePath: PH_CONNECT_BASE_PATH,\n explicit: getRuntimeConfig().connect.instance?.namespace ?? undefined,\n});\n\nexport const REACTOR_PGLITE_NAME = REACTOR_INSTANCE_NAMESPACE;\n\nexport const RELATIONAL_PGLITE_NAME =\n REACTOR_INSTANCE_NAMESPACE === ROOT_STORAGE_NAMESPACE\n ? DEFAULT_RELATIONAL_PROCESSOR_DB_NAME\n : `${REACTOR_INSTANCE_NAMESPACE}-${DEFAULT_RELATIONAL_PROCESSOR_DB_NAME}`;\n\n// Here, not pglite-idb.ts, so those IDB helpers stay free of runtime-config\n// and remain importable by the reactor SharedWorker.\nexport const REACTOR_IDB_NAME = `/pglite/${REACTOR_PGLITE_NAME}`;\nexport const RELATIONAL_IDB_NAME = `/pglite/${RELATIONAL_PGLITE_NAME}`;\nexport const PRIMARY_IDB_NAMES = [\n REACTOR_IDB_NAME,\n RELATIONAL_IDB_NAME,\n] as const;\n","import { readPgVersionFile } from \"./pglite-idb.js\";\nimport {\n coerceMajor,\n isMigratableMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\nimport { REACTOR_IDB_NAME, RELATIONAL_IDB_NAME } from \"./storage-namespace.js\";\n\nexport {\n CURRENT_PG_MAJOR,\n SUPPORTED_PG_MAJORS,\n coerceMajor,\n resolvePgMajorForRuntime,\n loadPGliteModule,\n loadPgDump,\n type SupportedPgMajor,\n type DetectedMajor,\n} from \"./pglite-major.js\";\n\nlet cachedReactorMajor: DetectedMajor | undefined;\nlet inflight: Promise<DetectedMajor> | undefined;\nconst majorListeners = new Set<() => void>();\n\nlet cachedMigrationMajor: DetectedMajor | undefined;\nlet migrationInflight: Promise<DetectedMajor> | undefined;\nconst migrationListeners = new Set<() => void>();\n\nfunction notifyMajorChanged() {\n for (const l of majorListeners) l();\n}\n\nfunction notifyMigrationChanged() {\n for (const l of migrationListeners) l();\n}\n\nexport function subscribeReactorPgMajor(cb: () => void): () => void {\n majorListeners.add(cb);\n return () => {\n majorListeners.delete(cb);\n };\n}\n\nexport async function detectReactorPgMajor(): Promise<DetectedMajor> {\n if (cachedReactorMajor !== undefined) return cachedReactorMajor;\n if (inflight) return inflight;\n\n inflight = (async () => {\n const major = coerceMajor(await readPgVersionFile(REACTOR_IDB_NAME));\n cachedReactorMajor = major;\n notifyMajorChanged();\n return major;\n })();\n try {\n return await inflight;\n } finally {\n inflight = undefined;\n }\n}\n\nexport function getCachedReactorPgMajor(): DetectedMajor | undefined {\n return cachedReactorMajor;\n}\n\nexport function invalidateReactorPgMajorCache(): void {\n cachedReactorMajor = undefined;\n cachedMigrationMajor = undefined;\n notifyMajorChanged();\n notifyMigrationChanged();\n}\n\nexport async function detectRelationalPgMajor(): Promise<DetectedMajor> {\n return coerceMajor(await readPgVersionFile(RELATIONAL_IDB_NAME));\n}\n\nexport function subscribeMigrationMajor(cb: () => void): () => void {\n migrationListeners.add(cb);\n return () => {\n migrationListeners.delete(cb);\n };\n}\n\nexport function getCachedMigrationMajor(): DetectedMajor | undefined {\n return cachedMigrationMajor;\n}\n\n/**\n * Legacy major the migration banner should prompt for: the first primary store\n * (reactor or relational) on a supported, non-current major. Spans both stores\n * to match migrateAllIfNeeded.\n */\nexport async function detectMigrationMajor(): Promise<DetectedMajor> {\n if (cachedMigrationMajor !== undefined) return cachedMigrationMajor;\n if (migrationInflight) return migrationInflight;\n\n migrationInflight = (async () => {\n const majors = await Promise.all([\n readPgVersionFile(REACTOR_IDB_NAME),\n readPgVersionFile(RELATIONAL_IDB_NAME),\n ]);\n const legacy = majors.find(isMigratableMajor) ?? null;\n cachedMigrationMajor = legacy;\n notifyMigrationChanged();\n return legacy;\n })();\n try {\n return await migrationInflight;\n } finally {\n migrationInflight = undefined;\n }\n}\n","export type WorkerConnectionStatus = \"connected\" | \"lost\";\n\nlet status: WorkerConnectionStatus = \"connected\";\nconst listeners = new Set<() => void>();\n\nexport function getWorkerConnectionStatus(): WorkerConnectionStatus {\n return status;\n}\n\nexport function setWorkerConnectionStatus(next: WorkerConnectionStatus): void {\n if (status === next) {\n return;\n }\n status = next;\n for (const listener of [...listeners]) {\n listener();\n }\n}\n\nexport function subscribeWorkerConnection(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n"],"names":[],"mappings":";;;;;;;;AASA,SAAgB,wBAAwB,OAAsC;CAC5E,MAAM,WAAW,MAAM,UAAU,KAAK;CACtC,IAAI,UACF,OAAO;CAET,MAAM,OAAO,oBAAoB,MAAM,QAAQ;CAC/C,MAAM,WAAW,MAAM,UAAU,KAAK;CACtC,IAAI,UACF,OAAO,GAAG,KAAK,IAAI,cAAc,UAAU,CAAC;CAE9C,OAAO;AACT;;;ACdA,MAAa,6BAA6B,wBAAwB;CAChE,UAAU;CACV,UAAU,iBAAiB,CAAC,CAAC,QAAQ,UAAU,aAAa,KAAA;AAC9D,CAAC;AAED,MAAa,sBAAsB;AAEnC,MAAa,yBACX,+BAA+B,yBAC3B,uCACA,GAAG,2BAA2B,GAAG;AAIvC,MAAa,mBAAmB,WAAW;AAC3C,MAAa,sBAAsB,WAAW;AAC9C,MAAa,oBAAoB,CAC/B,kBACA,mBACF;;;AC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uBAAuB;EACvB,uBAAuB;EACvB,OAAO;CACT,EAAA,CAAG;CACH,IAAI;EACF,OAAO,MAAM;CACf,UAAU;EACR,oBAAoB,KAAA;CACtB;AACF;;;AC3GA,IAAI,SAAiC;AACrC,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAgB,4BAAoD;CAClE,OAAO;AACT;AAEA,SAAgB,0BAA0B,MAAoC;CAC5E,IAAI,WAAW,MACb;CAEF,SAAS;CACT,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAClC,SAAS;AAEb;AAEA,SAAgB,0BAA0B,UAAkC;CAC1E,UAAU,IAAI,QAAQ;CACtB,aAAa;EACX,UAAU,OAAO,QAAQ;CAC3B;AACF","debug_id":"b00fd9bd-6ddd-571e-9f85-f37bdef2f520"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { t as i18n } from "./i18n-
|
|
4
|
-
import { n as
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="34f550d6-36a8-59f2-9684-10eb8b12195d")}catch(e){}}();
|
|
3
|
+
import { t as i18n } from "./i18n-CTgT1HG-.js";
|
|
4
|
+
import { n as useAcceptedCookies, r as useCookieBanner } from "./preferences-store-DZUIAkHE.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Trans, useTranslation } from "react-i18next";
|
|
7
|
-
import { showPHModal } from "@powerhousedao/reactor-browser";
|
|
8
7
|
import { CookieBanner as CookieBanner$1 } from "@powerhousedao/design-system/connect";
|
|
8
|
+
import { showPHModal } from "@powerhousedao/reactor-browser";
|
|
9
9
|
//#region src/components/cookie-banner.tsx
|
|
10
10
|
const isCookieAccepted = (cookies, id) => {
|
|
11
11
|
return cookies.some((cookie) => cookie.id === id && cookie.value);
|
|
@@ -66,5 +66,5 @@ const CookieBanner = () => {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
export { CookieBanner };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=cookie-banner-
|
|
70
|
-
//# debugId=
|
|
69
|
+
//# sourceMappingURL=cookie-banner-BxXvPdIY.js.map
|
|
70
|
+
//# debugId=34f550d6-36a8-59f2-9684-10eb8b12195d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-banner-
|
|
1
|
+
{"version":3,"file":"cookie-banner-BxXvPdIY.js","sources":["../src/components/cookie-banner.tsx"],"sourcesContent":["import {\n useAcceptedCookies,\n useCookieBanner,\n} from \"../hooks/preferences-store.js\";\nimport type { CookieInput } from \"@powerhousedao/design-system/connect\";\nimport { CookieBanner as PHCookieBanner } from \"@powerhousedao/design-system/connect\";\nimport { showPHModal } from \"@powerhousedao/reactor-browser\";\nimport { Trans, useTranslation } from \"react-i18next\";\nimport { i18n } from \"@powerhousedao/connect/i18n\";\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some((cookie) => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: \"analytics-cookie\",\n label: t(\"cookieBanner.cookies.analytics\"),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, \"analytics-cookie\")) {\n setAcceptedCookies((acceptedCookies) => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-10000 backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-primary opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-background px-10 pt-10 pb-16 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px]\"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t(\"cookieBanner.accept\")}\n rejectLabel={t(\"cookieBanner.reject\")}\n >\n <p className=\"font-semibold text-muted-foreground\">\n <Trans\n key={\"cookieBanner.message\"}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() => showPHModal({ type: \"cookiesPolicy\" })}\n key={\"cookieBanner.message-link\"}\n className=\"cursor-pointer text-foreground hover:underline\"\n />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["PHCookieBanner"],"mappings":";;;;;;;;;AAUA,MAAM,oBAAoB,SAAwB,OAAe;CAC/D,OAAO,QAAQ,MAAM,WAAW,OAAO,OAAO,MAAM,OAAO,KAAK;AAClE;AAEA,MAAa,qBAAqB;CAChC,MAAM,EAAE,MAAM,eAAe,KAAA,GAAW;EACtC,aAAa;EACb;CACF,CAAC;CACD,MAAM,CAAC,YAAY,iBAAiB,gBAAgB;CACpD,MAAM,GAAG,sBAAsB,mBAAmB;CAElD,MAAM,eAA8B,CAClC;EACE,IAAI;EACJ,OAAO,EAAE,gCAAgC;EACzC,OAAO;CACT,CACF;CAEA,MAAM,gBAAgB,YAA2B;EAC/C,cAAc,KAAK;EAEnB,IAAI,iBAAiB,SAAS,kBAAkB,GAC9C,oBAAoB,qBAAqB;GACvC,GAAG;GACH,WAAW;EACb,EAAE;CAEN;CAEA,MAAM,qBAAqB;EACzB,cAAc,KAAK;EACnB,0BAA0B;GACxB,WAAW;GACX,YAAY;GACZ,WAAW;EACb,EAAE;CACJ;CAEA,IAAI,CAAC,YACH,OAAO;CAGT,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,OAAD,EAAK,WAAU,yCAA0C,CAAA,GACzD,oBAAC,OAAD;GAAK,WAAU;GACb,UAAA,oBAACA,gBAAD;IACE,WAAU;IACV,SAAS;IACT,UAAU;IACV,UAAU;IACV,aAAa,EAAE,qBAAqB;IACpC,aAAa,EAAE,qBAAqB;IAEpC,UAAA,oBAAC,KAAD;KAAG,WAAU;KACX,UAAA,oBAAC,OAAD;MAEE,SAAQ;MACR,YAAY,EACV,GACE,oBAAC,KAAD;OACE,eAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;OAEpD,WAAU;MACX,GAFM,2BAEN,EAEL;KACD,GAXM,sBAWN;IACA,CAAA;GACW,CAAA;EACb,CAAA,CACF;;AAET","debug_id":"34f550d6-36a8-59f2-9684-10eb8b12195d"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4d070ae3-4906-5048-bf06-89b62df555a5")}catch(e){}}();
|
|
3
3
|
import i18n from "i18next";
|
|
4
4
|
import { initReactI18next } from "react-i18next";
|
|
5
5
|
i18n.use(initReactI18next).init({
|
|
@@ -140,5 +140,5 @@ i18n.use(initReactI18next).init({
|
|
|
140
140
|
//#endregion
|
|
141
141
|
export { i18n as t };
|
|
142
142
|
|
|
143
|
-
//# sourceMappingURL=i18n-
|
|
144
|
-
//# debugId=
|
|
143
|
+
//# sourceMappingURL=i18n-CTgT1HG-.js.map
|
|
144
|
+
//# debugId=4d070ae3-4906-5048-bf06-89b62df555a5
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n-
|
|
1
|
+
{"version":3,"file":"i18n-CTgT1HG-.js","sources":["../src/i18n/locales/en.json","../src/i18n/index.ts"],"sourcesContent":["","import type { Resource } from \"i18next\";\nimport i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport translationEN from \"./locales/en.json\" with { type: \"json\" };\n\nconst resources: Resource = {\n en: {\n code: \"en\",\n name: \"English\",\n translation: translationEN,\n },\n};\n\ni18n\n .use(initReactI18next)\n .init({\n resources,\n fallbackLng: \"en\",\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport { i18n };\nexport default i18n;\n"],"names":["translationEN"],"mappings":";;;;ACcA,KACG,IAAI,gBAAgB,CAAC,CACrB,KAAK;CACJ,aAVF,IAAI;EACF,MAAM;EACN,MAAM;EACN,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAAA;CACf,EAME;CACA,aAAa;CACb,OAAO;CACP,eAAe,EACb,aAAa,MACf;AACF,CAAC,CAAC,CACD,OAAO,MAAe;CACrB,QAAQ,MAAM,CAAC;AACjB,CAAC","debug_id":"4d070ae3-4906-5048-bf06-89b62df555a5"}
|