@powerhousedao/connect 6.1.0-dev.0 → 6.1.0-dev.10
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-ZK9-BWMB.js → AddDriveModal-Cg2qcYp6.js} +9 -5
- package/dist/AddDriveModal-Cg2qcYp6.js.map +1 -0
- package/dist/{ClearStorageModal-BLr3sRfl.js → ClearStorageModal-Dx_kY08P.js} +4 -4
- package/dist/{ClearStorageModal-BLr3sRfl.js.map → ClearStorageModal-Dx_kY08P.js.map} +1 -1
- package/dist/{CreateDocumentModal-BhJh4nWt.js → CreateDocumentModal-7vgZ8nbM.js} +6 -4
- package/dist/{CreateDocumentModal-BhJh4nWt.js.map → CreateDocumentModal-7vgZ8nbM.js.map} +1 -1
- package/dist/{DebugSettingsModal-nkZL0AFY.js → DebugSettingsModal-DqdUaGGX.js} +6 -6
- package/dist/{DebugSettingsModal-nkZL0AFY.js.map → DebugSettingsModal-DqdUaGGX.js.map} +1 -1
- package/dist/{DeleteDriveModal-CbuIdjKY.js → DeleteDriveModal-ABue_rOY.js} +6 -4
- package/dist/{DeleteDriveModal-CbuIdjKY.js.map → DeleteDriveModal-ABue_rOY.js.map} +1 -1
- package/dist/{DeleteItemModal-9ErYlauT.js → DeleteItemModal-B6aHnYPD.js} +6 -4
- package/dist/{DeleteItemModal-9ErYlauT.js.map → DeleteItemModal-B6aHnYPD.js.map} +1 -1
- package/dist/{DownloadDocumentWithErrorsModal-KZGWQ4J7.js → DownloadDocumentWithErrorsModal-5NDf6rH4.js} +13 -11
- package/dist/{DownloadDocumentWithErrorsModal-KZGWQ4J7.js.map → DownloadDocumentWithErrorsModal-5NDf6rH4.js.map} +1 -1
- package/dist/{DriveSettingsModal-DEk05PS7.js → DriveSettingsModal-CNtCO4-y.js} +12 -6
- package/dist/{DriveSettingsModal-DEk05PS7.js.map → DriveSettingsModal-CNtCO4-y.js.map} +1 -1
- package/dist/{InspectorModal-DrBnrYZl.js → InspectorModal-Cm2GxgwK.js} +15 -14
- package/dist/InspectorModal-Cm2GxgwK.js.map +1 -0
- package/dist/{SettingsModal-Do3GTReR.js → SettingsModal-C51Yknme.js} +10 -11
- package/dist/SettingsModal-C51Yknme.js.map +1 -0
- package/dist/{build-info-HpD0_mze.js → build-info-Be_DASHP.js} +4 -4
- package/dist/{build-info-HpD0_mze.js.map → build-info-Be_DASHP.js.map} +1 -1
- package/dist/{connect.config-Cuh0hj_Q.js → connect.config-B2xP5Iez.js} +9 -3
- package/dist/{connect.config-Cuh0hj_Q.js.map → connect.config-B2xP5Iez.js.map} +1 -1
- package/dist/{i18n-4rfcgnb9.js → i18n-BuVT7wFQ.js} +4 -4
- package/dist/{i18n-4rfcgnb9.js.map → i18n-BuVT7wFQ.js.map} +1 -1
- package/dist/{load-BoBY3jk8.js → load-CqLMocU3.js} +7 -7
- package/dist/{load-BoBY3jk8.js.map → load-CqLMocU3.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{package-BYMjy1FR.js → package-DSatNpsZ.js} +15 -9
- package/dist/package-DSatNpsZ.js.map +1 -0
- package/dist/pglite.worker.js +7 -6
- package/dist/pglite.worker.js.map +1 -1
- package/dist/pglite.worker.legacy.js +7 -6
- package/dist/pglite.worker.legacy.js.map +1 -1
- package/dist/{reactor-CppbYt7w.js → reactor-BqTMQT3A.js} +20 -10
- package/dist/reactor-BqTMQT3A.js.map +1 -0
- package/dist/{registerServiceWorker-CMRF2LWE.js → registerServiceWorker-BkUnxLqB.js} +13 -11
- package/dist/{registerServiceWorker-CMRF2LWE.js.map → registerServiceWorker-BkUnxLqB.js.map} +1 -1
- package/dist/{sidebar-dOJMIiCv.js → sidebar-CcFfEje1.js} +412 -29
- package/dist/sidebar-CcFfEje1.js.map +1 -0
- package/dist/start-connect.js +1 -1
- package/dist/style.css +29 -0
- package/package.json +18 -12
- package/dist/AddDriveModal-ZK9-BWMB.js.map +0 -1
- package/dist/InspectorModal-DrBnrYZl.js.map +0 -1
- package/dist/SettingsModal-Do3GTReR.js.map +0 -1
- package/dist/package-BYMjy1FR.js.map +0 -1
- package/dist/reactor-CppbYt7w.js.map +0 -1
- package/dist/sidebar-dOJMIiCv.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
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 defaultPHAppConfig, r as defaultPHDocumentEditorConfig, t as connectConfig } 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]="6ec4a79b-2e2b-5100-8963-c51430120a7f")}catch(e){}}();
|
|
3
|
+
import { n as defaultPHAppConfig, r as defaultPHDocumentEditorConfig, t as connectConfig } from "./connect.config-B2xP5Iez.js";
|
|
4
4
|
import { n as toast, t as ToastContainer } from "./toast-DnODOv28.js";
|
|
5
|
-
import { t as i18n } from "./i18n-
|
|
5
|
+
import { t as i18n } from "./i18n-BuVT7wFQ.js";
|
|
6
6
|
import { c as subscribeReactorPgMajor, d as createFileDataStore, f as idbError, l as IDB_STORE_NAME, m as readPgVersionFile, p as openIdb, r as getCachedReactorPgMajor, u as PRIMARY_IDB_NAMES } from "./pglite-runtime-Btp8ZXVH.js";
|
|
7
|
-
import { t as serviceWorkerManager } from "./registerServiceWorker-
|
|
8
|
-
import { driveCollectionId, getRevisionFromDate, logout, openRenown, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDrives, useEditorModuleById, useFallbackEditorModule, useNodeParentFolderById, usePHModal, usePackageDiscoveryService, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId,
|
|
7
|
+
import { t as serviceWorkerManager } from "./registerServiceWorker-BkUnxLqB.js";
|
|
8
|
+
import { driveCollectionId, getRevisionFromDate, logout, openRenown, setPHAppConfig, setPHDocumentEditorConfig, setRevisionHistoryVisible, setSelectedDrive, setSelectedNode, showPHModal, useAppModuleById, useDefaultAppModule, useDocumentById, useDocumentModelModuleById, useDocumentOperations, useDrives, useEditorModuleById, useFallbackEditorModule, useNodeParentFolderById, usePHModal, usePackageDiscoveryService, useReactorClientModule, useRevisionHistoryVisible, useSelectedDocument, useSelectedDocumentId, useSelectedDriveSafe, useSelectedFolder, useSelectedTimelineItem, useSyncList, useUser, useVetraPackageManager, useVetraPackages } from "@powerhousedao/reactor-browser";
|
|
9
9
|
import { childLogger } from "document-model";
|
|
10
10
|
import React, { StrictMode, Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
11
|
+
import { z } from "zod";
|
|
11
12
|
import { Trans, useTranslation } from "react-i18next";
|
|
12
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
14
|
import { Outlet, RouterProvider, createBrowserRouter, createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-dom";
|
|
@@ -54,10 +55,250 @@ function subscribe$1(fn) {
|
|
|
54
55
|
const useAcceptedCookies = () => {
|
|
55
56
|
return [useSyncExternalStore(subscribe$1, getCookies, getCookies), setCookies];
|
|
56
57
|
};
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/services/openpanel/buffer.ts
|
|
60
|
+
const buffer = [];
|
|
61
|
+
let errorHandler;
|
|
62
|
+
function defaultOnError(err) {
|
|
63
|
+
console.warn("[useOpenPanel] track failed:", err);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Forward a single event to the active client, swallowing any throw.
|
|
67
|
+
*
|
|
68
|
+
* The outer try/catch handles synchronous throws from `client.track`; the
|
|
69
|
+
* inner `.catch()` handles rejected promises. Both are needed because
|
|
70
|
+
* `Promise.resolve(x).catch()` cannot catch a throw from evaluating `x`.
|
|
71
|
+
*/
|
|
72
|
+
function forward(client, name, props) {
|
|
73
|
+
try {
|
|
74
|
+
Promise.resolve(client.track(name, props)).catch((err) => (errorHandler ?? defaultOnError)(err));
|
|
75
|
+
} catch (err) {
|
|
76
|
+
(errorHandler ?? defaultOnError)(err);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Drain the pre-init buffer in FIFO order through `client.track`, then forward
|
|
81
|
+
* subsequent events directly. Called once from `getOpenPanelClient()`.
|
|
82
|
+
*/
|
|
83
|
+
function drainOpenPanelBuffer(client, onError) {
|
|
84
|
+
errorHandler = onError;
|
|
85
|
+
const pending = buffer.splice(0, buffer.length);
|
|
86
|
+
for (const [name, props] of pending) forward(client, name, props);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Clear the buffer and reset the active client. Buffered pre-consent events
|
|
90
|
+
* are discarded so they are not replayed if the user later re-accepts.
|
|
91
|
+
*/
|
|
92
|
+
function clearOpenPanelBuffer() {
|
|
93
|
+
buffer.length = 0;
|
|
94
|
+
errorHandler = void 0;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/services/openpanel/client.ts
|
|
98
|
+
let client;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the cached `OpenPanel` singleton, building it on first call.
|
|
101
|
+
*
|
|
102
|
+
* When `config.clientId` is empty it returns `undefined` without importing
|
|
103
|
+
* `@openpanel/web`, so the bundler can tree-shake the SDK out of production.
|
|
104
|
+
*/
|
|
105
|
+
async function getOpenPanelClient(config) {
|
|
106
|
+
if (!config.clientId) return;
|
|
107
|
+
if (client) return client;
|
|
108
|
+
const { OpenPanel: OpenPanelClass } = await import("@openpanel/web");
|
|
109
|
+
client = new OpenPanelClass({
|
|
110
|
+
clientId: config.clientId,
|
|
111
|
+
...config.apiUrl ? { apiUrl: config.apiUrl } : {}
|
|
112
|
+
});
|
|
113
|
+
drainOpenPanelBuffer(client);
|
|
114
|
+
return client;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Clears the cached singleton and the pre-init buffer. Call on consent
|
|
118
|
+
* revocation or during tests; buffered events are discarded, not replayed.
|
|
119
|
+
*/
|
|
120
|
+
function resetOpenPanelClient() {
|
|
121
|
+
client = void 0;
|
|
122
|
+
clearOpenPanelBuffer();
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/services/openpanel/events.json
|
|
126
|
+
var events_default = [
|
|
127
|
+
{
|
|
128
|
+
"documentType": "powerhouse/document-drive",
|
|
129
|
+
"actionTypes": [
|
|
130
|
+
"ADD_FOLDER",
|
|
131
|
+
"DELETE_NODE",
|
|
132
|
+
"ADD_FILE",
|
|
133
|
+
"UPDATE_FILE",
|
|
134
|
+
"COPY_NODE",
|
|
135
|
+
"MOVE_NODE",
|
|
136
|
+
"SET_DRIVE_NAME",
|
|
137
|
+
"SET_DRIVE_ICON"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"documentType": "powerhouse/document-model",
|
|
142
|
+
"actionTypes": [
|
|
143
|
+
"SET_MODEL_NAME",
|
|
144
|
+
"SET_MODEL_ID",
|
|
145
|
+
"ADD_MODULE",
|
|
146
|
+
"DELETE_MODULE",
|
|
147
|
+
"ADD_OPERATION",
|
|
148
|
+
"DELETE_OPERATION"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"documentType": "powerhouse/reactor-drive",
|
|
153
|
+
"actionTypes": [
|
|
154
|
+
"ADD_FOLDER",
|
|
155
|
+
"REMOVE_FOLDER",
|
|
156
|
+
"UPDATE_FOLDER"
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/services/openpanel/events.ts
|
|
162
|
+
const EventMappingSchema = z.object({
|
|
163
|
+
documentType: z.string().min(1),
|
|
164
|
+
actionTypes: z.array(z.string().min(1)).min(1),
|
|
165
|
+
alias: z.string().optional()
|
|
166
|
+
}).strict();
|
|
167
|
+
const EventMappingsSchema = z.array(EventMappingSchema).readonly();
|
|
168
|
+
/**
|
|
169
|
+
* Parses and validates the event mapping table, returning the validated array
|
|
170
|
+
* and an O(1) lookup map. Accepts a `raw` override for tests. Throws on zod
|
|
171
|
+
* failures and on duplicate `(documentType, actionType)` pairs.
|
|
172
|
+
*/
|
|
173
|
+
function loadEvents(raw = events_default) {
|
|
174
|
+
const result = EventMappingsSchema.safeParse(raw);
|
|
175
|
+
if (!result.success) throw new Error(`Invalid OpenPanel events.json: ${result.error.message}`);
|
|
176
|
+
const mappings = result.data;
|
|
177
|
+
const lookupMap = /* @__PURE__ */ new Map();
|
|
178
|
+
for (const mapping of mappings) {
|
|
179
|
+
let inner = lookupMap.get(mapping.documentType);
|
|
180
|
+
if (!inner) {
|
|
181
|
+
inner = /* @__PURE__ */ new Map();
|
|
182
|
+
lookupMap.set(mapping.documentType, inner);
|
|
183
|
+
}
|
|
184
|
+
for (const actionType of mapping.actionTypes) {
|
|
185
|
+
if (inner.has(actionType)) throw new Error(`Duplicate OpenPanel event mapping for ${mapping.documentType}/${actionType}`);
|
|
186
|
+
inner.set(actionType, mapping);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
mappings,
|
|
191
|
+
lookupMap
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const { mappings: defaultMappings, lookupMap: defaultLookupMap } = loadEvents();
|
|
195
|
+
/** Validated mapping array from the bundled events.json. */
|
|
196
|
+
const eventMappings = defaultMappings;
|
|
197
|
+
/** O(1) lookup map: documentType → actionType → mapping. */
|
|
198
|
+
const eventLookupMap = defaultLookupMap;
|
|
199
|
+
/**
|
|
200
|
+
* Normalizes a document type into a safe event-name segment: lowercased, `/`
|
|
201
|
+
* replaced with `.`, and any character outside `[a-z0-9._-]` stripped.
|
|
202
|
+
* e.g. `powerhouse/document-drive` → `powerhouse.document-drive`.
|
|
203
|
+
*/
|
|
204
|
+
function normalize(documentType) {
|
|
205
|
+
return documentType.toLowerCase().replace(/\//g, ".").replace(/[^a-z0-9._-]/g, "");
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Derives the OpenPanel event name: `mapping.alias` when present, otherwise
|
|
209
|
+
* `${normalize(documentType)}.${actionType.toLowerCase()}`.
|
|
210
|
+
*/
|
|
211
|
+
function deriveEventName(mapping, op) {
|
|
212
|
+
if (mapping.alias) return mapping.alias;
|
|
213
|
+
return `${normalize(op.context.documentType)}.${op.operation.action.type.toLowerCase()}`;
|
|
214
|
+
}
|
|
215
|
+
/** Builds the default properties attached to every OpenPanel event. */
|
|
216
|
+
function buildDefaultProperties(op) {
|
|
217
|
+
return {
|
|
218
|
+
documentType: op.context.documentType,
|
|
219
|
+
actionType: op.operation.action.type,
|
|
220
|
+
documentId: op.context.documentId,
|
|
221
|
+
scope: op.context.scope,
|
|
222
|
+
branch: op.context.branch,
|
|
223
|
+
app: "connect"
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/services/openpanel/processor.ts
|
|
228
|
+
/**
|
|
229
|
+
* Read-only reactor `IProcessor` that translates matching document operations
|
|
230
|
+
* into OpenPanel analytics events. Operations whose `(documentType, actionType)`
|
|
231
|
+
* pair is absent from the lookup map are skipped; per-operation errors are
|
|
232
|
+
* routed to `onError` and never thrown back to the manager.
|
|
233
|
+
*/
|
|
234
|
+
var OpenPanelProcessor = class {
|
|
235
|
+
constructor(client, lookupMap, onError = (err) => console.warn("[OpenPanelProcessor] Error tracking event:", err)) {
|
|
236
|
+
this.client = client;
|
|
237
|
+
this.lookupMap = lookupMap;
|
|
238
|
+
this.onError = onError;
|
|
239
|
+
}
|
|
240
|
+
async onOperations(operations) {
|
|
241
|
+
for (const op of operations) {
|
|
242
|
+
const inner = this.lookupMap.get(op.context.documentType);
|
|
243
|
+
if (!inner) continue;
|
|
244
|
+
const mapping = inner.get(op.operation.action.type);
|
|
245
|
+
if (!mapping) continue;
|
|
246
|
+
const name = deriveEventName(mapping, op);
|
|
247
|
+
const payload = buildDefaultProperties(op);
|
|
248
|
+
try {
|
|
249
|
+
await this.client.track(name, payload);
|
|
250
|
+
} catch (err) {
|
|
251
|
+
this.onError(err, op);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
onDisconnect() {
|
|
256
|
+
this.client.flush?.();
|
|
257
|
+
return Promise.resolve();
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/services/openpanel/factory.ts
|
|
262
|
+
/**
|
|
263
|
+
* Returns a `ProcessorFactory` that, for each drive, creates a single
|
|
264
|
+
* `OpenPanelProcessor` record whose `filter.documentType` is the union of all
|
|
265
|
+
* document types present in the event mapping table.
|
|
266
|
+
*/
|
|
267
|
+
function createOpenPanelProcessorFactory(config) {
|
|
268
|
+
return function openPanelProcessorFactory(_driveHeader) {
|
|
269
|
+
const documentType = Array.from(config.events.lookupMap.keys());
|
|
270
|
+
return [{
|
|
271
|
+
processor: new OpenPanelProcessor(config.client, config.events.lookupMap, config.onError),
|
|
272
|
+
filter: { documentType },
|
|
273
|
+
startFrom: config.startFrom ?? "current"
|
|
274
|
+
}];
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/hooks/useIsEmbedded.ts
|
|
279
|
+
/**
|
|
280
|
+
* Detects whether Connect is being rendered inside another app (e.g. inside
|
|
281
|
+
* an iframe in the vetra-cli drive editor). When `?embed=1` is present in the
|
|
282
|
+
* URL, chrome that doesn't make sense in the embedded context — the cookie
|
|
283
|
+
* banner, the outer sidebar — is suppressed.
|
|
284
|
+
*/
|
|
285
|
+
function getIsEmbedded() {
|
|
286
|
+
if (typeof window === "undefined") return false;
|
|
287
|
+
try {
|
|
288
|
+
const value = new URLSearchParams(window.location.search).get("embed");
|
|
289
|
+
return value !== null && value !== "0" && value !== "false";
|
|
290
|
+
} catch {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function useIsEmbedded() {
|
|
295
|
+
return getIsEmbedded();
|
|
296
|
+
}
|
|
57
297
|
const COOKIE_BANNER_KEY_STORAGE = `${connectConfig.routerBasename}:display-cookie-banner`;
|
|
58
298
|
const listeners$2 = /* @__PURE__ */ new Set();
|
|
59
299
|
let bannerShown = getInitial();
|
|
60
300
|
function getInitial() {
|
|
301
|
+
if (getIsEmbedded()) return false;
|
|
61
302
|
try {
|
|
62
303
|
return localStorage.getItem(COOKIE_BANNER_KEY_STORAGE) !== "false";
|
|
63
304
|
} catch (error) {
|
|
@@ -208,6 +449,144 @@ const Analytics = () => {
|
|
|
208
449
|
return null;
|
|
209
450
|
};
|
|
210
451
|
//#endregion
|
|
452
|
+
//#region src/components/openpanel-traits.ts
|
|
453
|
+
/**
|
|
454
|
+
* Builds the OpenPanel identity traits from a renown User.
|
|
455
|
+
*
|
|
456
|
+
* Rules:
|
|
457
|
+
* - `credential` (contains a JWT) is **never** forwarded.
|
|
458
|
+
* - `did` / `profileId` is sent as the top-level `profileId` key in the
|
|
459
|
+
* `client.identify()` call — it is **not** duplicated inside traits.
|
|
460
|
+
* - Optional fields (`ens`, `profile`) are only included when their value is
|
|
461
|
+
* non-nullish (guards against `null` from `RenownProfile` fields as well
|
|
462
|
+
* as plain `undefined`).
|
|
463
|
+
*
|
|
464
|
+
* Mirror the Sentry pattern in `store/user.ts`: destructure off `credential`
|
|
465
|
+
* first, then assemble the trait payload from the remainder.
|
|
466
|
+
*/
|
|
467
|
+
function buildTraits(user) {
|
|
468
|
+
const { credential: _credential, ...rest } = user;
|
|
469
|
+
const traits = {
|
|
470
|
+
address: rest.address,
|
|
471
|
+
networkId: rest.networkId,
|
|
472
|
+
chainId: rest.chainId
|
|
473
|
+
};
|
|
474
|
+
if (rest.ens?.name != null) traits.ensName = rest.ens.name;
|
|
475
|
+
if (rest.ens?.avatarUrl != null) traits.ensAvatar = rest.ens.avatarUrl;
|
|
476
|
+
if (rest.profile?.username != null) traits.username = rest.profile.username;
|
|
477
|
+
if (rest.profile?.userImage != null) traits.userImage = rest.profile.userImage;
|
|
478
|
+
if (rest.profile?.documentId != null) traits.profileDocumentId = rest.profile.documentId;
|
|
479
|
+
if (rest.profile?.createdAt != null) traits.profileCreatedAt = rest.profile.createdAt;
|
|
480
|
+
return traits;
|
|
481
|
+
}
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/components/openpanel.tsx
|
|
484
|
+
/**
|
|
485
|
+
* `OpenPanel` is a `null`-rendering component that manages the full lifecycle
|
|
486
|
+
* of the OpenPanel analytics subsystem.
|
|
487
|
+
*
|
|
488
|
+
* Gates:
|
|
489
|
+
* - `useAcceptedCookies().analytics === true` — the existing analytics cookie.
|
|
490
|
+
* - `connectConfig.openPanel.clientId` non-empty — no client ID → no-op.
|
|
491
|
+
*
|
|
492
|
+
* Behaviour when both gates pass:
|
|
493
|
+
* 1. Lazy-imports `@openpanel/web` and builds the singleton via
|
|
494
|
+
* `getOpenPanelClient(connectConfig.openPanel)`.
|
|
495
|
+
* 2. Exposes the client on `window.openPanel` for the card-6 `useOpenPanel()`
|
|
496
|
+
* hook to consume.
|
|
497
|
+
* 3. If `connectConfig.openPanel.trackOperations`, registers the processor
|
|
498
|
+
* factory against `processorManager` so document operations are forwarded.
|
|
499
|
+
* 4. Calls `client.identify()` when the renown user transitions from
|
|
500
|
+
* `undefined` → defined (login).
|
|
501
|
+
* 5. Calls `client.clear()` when the user transitions from defined →
|
|
502
|
+
* `undefined` (logout).
|
|
503
|
+
*
|
|
504
|
+
* Teardown (unmount **or** consent revocation):
|
|
505
|
+
* - `unregisterFactory("openpanel")` to remove the processor.
|
|
506
|
+
* - `resetOpenPanelClient()` to clear the singleton.
|
|
507
|
+
* - `window.openPanel` is cleared.
|
|
508
|
+
*
|
|
509
|
+
* Mirrors the Sentry pattern in `store/user.ts` for login/logout detection.
|
|
510
|
+
* Analytics failures are caught and forwarded to `console.warn` — they must
|
|
511
|
+
* never throw into the application.
|
|
512
|
+
*
|
|
513
|
+
* Mounted next to `<Analytics />` in `app.tsx`.
|
|
514
|
+
*/
|
|
515
|
+
function OpenPanel() {
|
|
516
|
+
const [{ analytics }] = useAcceptedCookies();
|
|
517
|
+
const user = useUser();
|
|
518
|
+
const reactorClientModule = useReactorClientModule();
|
|
519
|
+
const [client, setClient] = useState();
|
|
520
|
+
/**
|
|
521
|
+
* Tracks the previous `user` value so we can detect the two transitions:
|
|
522
|
+
* undefined → defined (login)
|
|
523
|
+
* defined → undefined (logout)
|
|
524
|
+
*/
|
|
525
|
+
const prevUserRef = useRef(void 0);
|
|
526
|
+
const enabled = analytics && !!connectConfig.openPanel.clientId;
|
|
527
|
+
const processorManager = reactorClientModule?.reactorModule?.processorManager;
|
|
528
|
+
useEffect(() => {
|
|
529
|
+
if (!enabled) return;
|
|
530
|
+
let cancelled = false;
|
|
531
|
+
(async () => {
|
|
532
|
+
let builtClient;
|
|
533
|
+
try {
|
|
534
|
+
builtClient = await getOpenPanelClient(connectConfig.openPanel);
|
|
535
|
+
} catch (err) {
|
|
536
|
+
console.warn("[OpenPanel] Failed to build client:", err);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (cancelled || !builtClient) return;
|
|
540
|
+
setClient(builtClient);
|
|
541
|
+
window.openPanel = builtClient;
|
|
542
|
+
if (connectConfig.openPanel.trackOperations && processorManager) try {
|
|
543
|
+
await processorManager.registerFactory("openpanel", createOpenPanelProcessorFactory({
|
|
544
|
+
client: builtClient,
|
|
545
|
+
events: {
|
|
546
|
+
mappings: eventMappings,
|
|
547
|
+
lookupMap: eventLookupMap
|
|
548
|
+
},
|
|
549
|
+
startFrom: "current"
|
|
550
|
+
}));
|
|
551
|
+
if (cancelled) await processorManager.unregisterFactory("openpanel").catch((err) => console.warn("[OpenPanel] Failed to unregister factory after cancellation:", err));
|
|
552
|
+
} catch (err) {
|
|
553
|
+
console.warn("[OpenPanel] Failed to register processor factory:", err);
|
|
554
|
+
}
|
|
555
|
+
})();
|
|
556
|
+
return () => {
|
|
557
|
+
cancelled = true;
|
|
558
|
+
prevUserRef.current = void 0;
|
|
559
|
+
if (connectConfig.openPanel.trackOperations && processorManager) processorManager.unregisterFactory("openpanel").catch((err) => console.warn("[OpenPanel] Failed to unregister processor factory:", err));
|
|
560
|
+
resetOpenPanelClient();
|
|
561
|
+
window.openPanel = void 0;
|
|
562
|
+
setClient(void 0);
|
|
563
|
+
};
|
|
564
|
+
}, [enabled, processorManager]);
|
|
565
|
+
useEffect(() => {
|
|
566
|
+
if (!enabled || !client) return;
|
|
567
|
+
const prev = prevUserRef.current;
|
|
568
|
+
prevUserRef.current = user;
|
|
569
|
+
if (!prev && user) try {
|
|
570
|
+
client.identify({
|
|
571
|
+
profileId: user.did,
|
|
572
|
+
properties: buildTraits(user)
|
|
573
|
+
});
|
|
574
|
+
} catch (err) {
|
|
575
|
+
console.warn("[OpenPanel] Failed to identify user:", err);
|
|
576
|
+
}
|
|
577
|
+
else if (prev && !user) try {
|
|
578
|
+
client.clear();
|
|
579
|
+
} catch (err) {
|
|
580
|
+
console.warn("[OpenPanel] Failed to clear user:", err);
|
|
581
|
+
}
|
|
582
|
+
}, [
|
|
583
|
+
client,
|
|
584
|
+
user,
|
|
585
|
+
enabled
|
|
586
|
+
]);
|
|
587
|
+
return null;
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
211
590
|
//#region src/components/document-editor-container.tsx
|
|
212
591
|
function DocumentEditorContainer() {
|
|
213
592
|
const [selectedDocument] = useSelectedDocument();
|
|
@@ -217,7 +596,7 @@ function DocumentEditorContainer() {
|
|
|
217
596
|
}, []);
|
|
218
597
|
useCallback(() => {
|
|
219
598
|
setSelectedNode(parentFolder);
|
|
220
|
-
}, [parentFolder
|
|
599
|
+
}, [parentFolder]);
|
|
221
600
|
return /* @__PURE__ */ jsx("div", {
|
|
222
601
|
id: "document-editor-container",
|
|
223
602
|
className: "flex-1",
|
|
@@ -385,10 +764,11 @@ function ErrorBoundary$1(props) {
|
|
|
385
764
|
//#endregion
|
|
386
765
|
//#region src/components/app-container.tsx
|
|
387
766
|
function AppContainer() {
|
|
388
|
-
const [selectedDrive] =
|
|
767
|
+
const [selectedDrive] = useSelectedDriveSafe();
|
|
389
768
|
const selectedDocumentId = useSelectedDocumentId();
|
|
390
|
-
const app = useAppModuleById(selectedDrive
|
|
769
|
+
const app = useAppModuleById(selectedDrive?.header.meta?.preferredEditor);
|
|
391
770
|
const defaultApp = useDefaultAppModule();
|
|
771
|
+
if (!selectedDrive) return /* @__PURE__ */ jsx(EditorLoader, {});
|
|
392
772
|
const AppComponent = app?.Component ?? defaultApp?.Component ?? GenericDriveExplorer.Component;
|
|
393
773
|
if (!AppComponent) throw new Error("No app component found");
|
|
394
774
|
return /* @__PURE__ */ jsx(ErrorBoundary$1, {
|
|
@@ -757,7 +1137,7 @@ const AppSkeleton = (props) => {
|
|
|
757
1137
|
return /* @__PURE__ */ jsxs("div", {
|
|
758
1138
|
className: "flex h-screen overflow-hidden",
|
|
759
1139
|
children: [
|
|
760
|
-
/* @__PURE__ */ jsx(ConnectSidebar, {
|
|
1140
|
+
!(!isSSR && getIsEmbedded()) && /* @__PURE__ */ jsx(ConnectSidebar, {
|
|
761
1141
|
className: "animate-pulse",
|
|
762
1142
|
onLogin: void 0,
|
|
763
1143
|
onDisconnect: void 0,
|
|
@@ -867,17 +1247,17 @@ const MigrationBanner = () => {
|
|
|
867
1247
|
};
|
|
868
1248
|
//#endregion
|
|
869
1249
|
//#region src/components/modal/modals-container.tsx
|
|
870
|
-
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-
|
|
871
|
-
const ClearStorageModal = lazy(() => import("./ClearStorageModal-
|
|
1250
|
+
const AddDriveModal$1 = lazy(() => import("./AddDriveModal-Cg2qcYp6.js").then((m) => ({ default: m.AddDriveModal })));
|
|
1251
|
+
const ClearStorageModal = lazy(() => import("./ClearStorageModal-Dx_kY08P.js").then((m) => ({ default: m.ClearStorageModal })));
|
|
872
1252
|
const CookiesPolicyModal = lazy(() => import("./CookiesPolicyModal-DiXQV82b.js").then((m) => ({ default: m.CookiesPolicyModal })));
|
|
873
|
-
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-
|
|
874
|
-
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-
|
|
875
|
-
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-
|
|
876
|
-
const DeleteItemModal = lazy(() => import("./DeleteItemModal-
|
|
1253
|
+
const CreateDocumentModal$1 = lazy(() => import("./CreateDocumentModal-7vgZ8nbM.js").then((m) => ({ default: m.CreateDocumentModal })));
|
|
1254
|
+
const DebugSettingsModal = lazy(() => import("./DebugSettingsModal-DqdUaGGX.js").then((m) => ({ default: m.DebugSettingsModal })));
|
|
1255
|
+
const DeleteDriveModal = lazy(() => import("./DeleteDriveModal-ABue_rOY.js").then((m) => ({ default: m.DeleteDriveModal })));
|
|
1256
|
+
const DeleteItemModal = lazy(() => import("./DeleteItemModal-B6aHnYPD.js").then((m) => ({ default: m.DeleteItemModal })));
|
|
877
1257
|
const DisclaimerModal = lazy(() => import("./DisclaimerModal-CfDeiBz8.js").then((m) => ({ default: m.DisclaimerModal })));
|
|
878
|
-
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-
|
|
879
|
-
const DownloadDocumentWithErrorsModal = lazy(() => import("./DownloadDocumentWithErrorsModal-
|
|
880
|
-
const SettingsModal$1 = lazy(() => import("./SettingsModal-
|
|
1258
|
+
const DriveSettingsModal$1 = lazy(() => import("./DriveSettingsModal-CNtCO4-y.js").then((m) => ({ default: m.DriveSettingsModal })));
|
|
1259
|
+
const DownloadDocumentWithErrorsModal = lazy(() => import("./DownloadDocumentWithErrorsModal-5NDf6rH4.js").then((m) => ({ default: m.DownloadDocumentWithErrorsModal })));
|
|
1260
|
+
const SettingsModal$1 = lazy(() => import("./SettingsModal-C51Yknme.js").then((m) => ({ default: m.SettingsModal })));
|
|
881
1261
|
const UpgradeDriveModal = lazy(() => import("./UpgradeDriveModal-BwI5E5k3.js").then((m) => ({ default: m.UpgradeDriveModal })));
|
|
882
1262
|
const modalComponents = {
|
|
883
1263
|
addDrive: AddDriveModal$1,
|
|
@@ -890,13 +1270,13 @@ const modalComponents = {
|
|
|
890
1270
|
disclaimer: DisclaimerModal,
|
|
891
1271
|
driveSettings: DriveSettingsModal$1,
|
|
892
1272
|
downloadDocumentWithErrors: DownloadDocumentWithErrorsModal,
|
|
893
|
-
inspector: lazy(() => import("./InspectorModal-
|
|
1273
|
+
inspector: lazy(() => import("./InspectorModal-Cm2GxgwK.js").then((m) => ({ default: m.InspectorModal }))),
|
|
894
1274
|
settings: SettingsModal$1,
|
|
895
1275
|
upgradeDrive: UpgradeDriveModal,
|
|
896
1276
|
missingPackage: lazy(() => import("./MissingPackageModal-CUdcDjSO.js").then((m) => ({ default: m.ConnectMissingPackageModal })))
|
|
897
1277
|
};
|
|
898
|
-
const ModalsContainer = lazy(
|
|
899
|
-
return { default: () => {
|
|
1278
|
+
const ModalsContainer = lazy(() => {
|
|
1279
|
+
return Promise.resolve({ default: () => {
|
|
900
1280
|
const phModal = usePHModal();
|
|
901
1281
|
if (!phModal?.type) return null;
|
|
902
1282
|
const ModalComponent = modalComponents[phModal.type];
|
|
@@ -908,12 +1288,12 @@ const ModalsContainer = lazy(async () => {
|
|
|
908
1288
|
children: /* @__PURE__ */ jsx(ModalComponent, {})
|
|
909
1289
|
})
|
|
910
1290
|
}) : null;
|
|
911
|
-
} };
|
|
1291
|
+
} });
|
|
912
1292
|
});
|
|
913
1293
|
//#endregion
|
|
914
1294
|
//#region src/components/app-loader.tsx
|
|
915
1295
|
const AppLoader = (props) => {
|
|
916
|
-
const Load = lazy(() => import("./load-
|
|
1296
|
+
const Load = lazy(() => import("./load-CqLMocU3.js").then((m) => m.loadComponent(props.localPackage)));
|
|
917
1297
|
return /* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsxs(ErrorBoundary$1, {
|
|
918
1298
|
fallbackRender: (props) => /* @__PURE__ */ jsx(AppSkeleton, { children: /* @__PURE__ */ jsx(DetailedFallback, { ...props }) }),
|
|
919
1299
|
resetKeys: [props.localPackage],
|
|
@@ -1091,7 +1471,7 @@ const App = () => {
|
|
|
1091
1471
|
useEffect(() => {
|
|
1092
1472
|
const handlePreloadError = (event) => {
|
|
1093
1473
|
const payload = event.payload;
|
|
1094
|
-
const failedUrl = (payload instanceof Error ? payload.message :
|
|
1474
|
+
const failedUrl = (payload instanceof Error ? payload.message : typeof payload === "string" ? payload : "").match(/https?:\/\/[^\s"']+/)?.[0];
|
|
1095
1475
|
if (failedUrl && !failedUrl.startsWith(window.location.origin)) {
|
|
1096
1476
|
console.debug(`[Connect] Skipping reload — vite:preloadError for off-origin URL: ${failedUrl}`);
|
|
1097
1477
|
return;
|
|
@@ -1113,7 +1493,8 @@ const App = () => {
|
|
|
1113
1493
|
/* @__PURE__ */ jsx(MissingModelBanner, {}),
|
|
1114
1494
|
/* @__PURE__ */ jsx(Router, {}),
|
|
1115
1495
|
/* @__PURE__ */ jsx(PackageInstallPrompt, {}),
|
|
1116
|
-
/* @__PURE__ */ jsx(Analytics, {})
|
|
1496
|
+
/* @__PURE__ */ jsx(Analytics, {}),
|
|
1497
|
+
/* @__PURE__ */ jsx(OpenPanel, {})
|
|
1117
1498
|
] });
|
|
1118
1499
|
};
|
|
1119
1500
|
//#endregion
|
|
@@ -1352,7 +1733,7 @@ function Root() {
|
|
|
1352
1733
|
tabIndex: 0,
|
|
1353
1734
|
children: /* @__PURE__ */ jsxs(Suspense, {
|
|
1354
1735
|
name: "Root",
|
|
1355
|
-
children: [/* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx("div", {
|
|
1736
|
+
children: [!useIsEmbedded() && /* @__PURE__ */ jsx(Sidebar, {}), /* @__PURE__ */ jsx("div", {
|
|
1356
1737
|
className: "relative flex-1 overflow-auto",
|
|
1357
1738
|
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
1358
1739
|
})]
|
|
@@ -1452,7 +1833,9 @@ function Sidebar() {
|
|
|
1452
1833
|
onClickSettings,
|
|
1453
1834
|
address: user?.address,
|
|
1454
1835
|
onLogin: openRenown,
|
|
1455
|
-
onDisconnect:
|
|
1836
|
+
onDisconnect: () => {
|
|
1837
|
+
logout();
|
|
1838
|
+
},
|
|
1456
1839
|
ensName: ensName || ensInfo.data?.ens,
|
|
1457
1840
|
avatarUrl: avatarUrl || ensInfo.data?.avatar_small || ensInfo.data?.avatar_url || void 0,
|
|
1458
1841
|
etherscanUrl,
|
|
@@ -1474,5 +1857,5 @@ function Sidebar() {
|
|
|
1474
1857
|
//#endregion
|
|
1475
1858
|
export { AppLoader as t };
|
|
1476
1859
|
|
|
1477
|
-
//# sourceMappingURL=sidebar-
|
|
1478
|
-
//# debugId=
|
|
1860
|
+
//# sourceMappingURL=sidebar-CcFfEje1.js.map
|
|
1861
|
+
//# debugId=6ec4a79b-2e2b-5100-8963-c51430120a7f
|