@haex-space/vault-sdk 2.2.7 → 2.3.1
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/cli/index.js +5 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +5 -5
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +23 -8
- package/dist/index.d.ts +23 -8
- package/dist/index.js +53 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -45
- package/dist/index.mjs.map +1 -1
- package/dist/node.js +5 -5
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +5 -5
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +36 -31
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +36 -31
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.js +44 -36
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +44 -36
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +24 -16
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +24 -16
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.js +44 -36
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +44 -36
- package/dist/svelte.mjs.map +1 -1
- package/dist/vite.d.mts +6 -6
- package/dist/vite.d.ts +6 -6
- package/dist/vite.js +39 -34
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +39 -34
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +44 -36
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +44 -36
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -10,7 +10,7 @@ function installLocalStoragePolyfill() {
|
|
|
10
10
|
if (typeof window === "undefined") {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
console.log("[
|
|
13
|
+
console.log("[HaexSpace] Storage Polyfill loading immediately");
|
|
14
14
|
let localStorageWorks = false;
|
|
15
15
|
try {
|
|
16
16
|
const testKey = "__ls_test__";
|
|
@@ -18,7 +18,7 @@ function installLocalStoragePolyfill() {
|
|
|
18
18
|
localStorage.removeItem(testKey);
|
|
19
19
|
localStorageWorks = true;
|
|
20
20
|
} catch (e) {
|
|
21
|
-
console.warn("[
|
|
21
|
+
console.warn("[HaexSpace] localStorage blocked \u2013 using in-memory fallback");
|
|
22
22
|
}
|
|
23
23
|
if (!localStorageWorks) {
|
|
24
24
|
const lsStorage = /* @__PURE__ */ new Map();
|
|
@@ -51,7 +51,7 @@ function installLocalStoragePolyfill() {
|
|
|
51
51
|
} catch (e) {
|
|
52
52
|
window.localStorage = localStoragePoly;
|
|
53
53
|
}
|
|
54
|
-
console.log("[
|
|
54
|
+
console.log("[HaexSpace] localStorage replaced with in-memory polyfill");
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
function installSessionStoragePolyfill() {
|
|
@@ -96,7 +96,7 @@ function installSessionStoragePolyfill() {
|
|
|
96
96
|
key: () => null
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
console.log("[
|
|
99
|
+
console.log("[HaexSpace] sessionStorage polyfill installed");
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
// src/polyfills/cookies.ts
|
|
@@ -109,7 +109,7 @@ function installCookiePolyfill() {
|
|
|
109
109
|
document.cookie = "__cookie_test__=1";
|
|
110
110
|
cookiesWork = document.cookie.indexOf("__cookie_test__") !== -1;
|
|
111
111
|
} catch (e) {
|
|
112
|
-
console.warn("[
|
|
112
|
+
console.warn("[HaexSpace] Cookies blocked \u2013 using in-memory fallback");
|
|
113
113
|
}
|
|
114
114
|
if (!cookiesWork) {
|
|
115
115
|
const cookieStore = /* @__PURE__ */ new Map();
|
|
@@ -155,7 +155,7 @@ function installCookiePolyfill() {
|
|
|
155
155
|
},
|
|
156
156
|
configurable: true
|
|
157
157
|
});
|
|
158
|
-
console.log("[
|
|
158
|
+
console.log("[HaexSpace] Cookie polyfill installed");
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
@@ -165,16 +165,16 @@ function installHistoryPolyfill() {
|
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
const install = () => {
|
|
168
|
-
console.log("[
|
|
168
|
+
console.log("[HaexSpace] History Patch loading");
|
|
169
169
|
const originalPushState = history.pushState;
|
|
170
170
|
const originalReplaceState = history.replaceState;
|
|
171
171
|
let skipNextPush = false;
|
|
172
172
|
let skipNextReplace = false;
|
|
173
173
|
history.pushState = function(state, title, url) {
|
|
174
|
-
console.log("[
|
|
174
|
+
console.log("[HaexSpace] pushState called:", url, "skip:", skipNextPush);
|
|
175
175
|
if (skipNextPush) {
|
|
176
176
|
skipNextPush = false;
|
|
177
|
-
console.log("[
|
|
177
|
+
console.log("[HaexSpace] pushState skipped");
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
try {
|
|
@@ -184,7 +184,7 @@ function installHistoryPolyfill() {
|
|
|
184
184
|
const urlString = url.toString();
|
|
185
185
|
let hashUrl = urlString.replace(/^\/#/, "");
|
|
186
186
|
hashUrl = hashUrl.startsWith("#") ? hashUrl : "#" + hashUrl;
|
|
187
|
-
console.log("[
|
|
187
|
+
console.log("[HaexSpace] SecurityError - setting hash to:", hashUrl);
|
|
188
188
|
skipNextPush = true;
|
|
189
189
|
window.location.hash = hashUrl.replace(/^#/, "");
|
|
190
190
|
return;
|
|
@@ -193,10 +193,10 @@ function installHistoryPolyfill() {
|
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
195
|
history.replaceState = function(state, title, url) {
|
|
196
|
-
console.log("[
|
|
196
|
+
console.log("[HaexSpace] replaceState called:", url, "skip:", skipNextReplace);
|
|
197
197
|
if (skipNextReplace) {
|
|
198
198
|
skipNextReplace = false;
|
|
199
|
-
console.log("[
|
|
199
|
+
console.log("[HaexSpace] replaceState skipped");
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
try {
|
|
@@ -206,7 +206,7 @@ function installHistoryPolyfill() {
|
|
|
206
206
|
const urlString = url.toString();
|
|
207
207
|
let hashUrl = urlString.replace(/^\/#/, "");
|
|
208
208
|
hashUrl = hashUrl.startsWith("#") ? hashUrl : "#" + hashUrl;
|
|
209
|
-
console.log("[
|
|
209
|
+
console.log("[HaexSpace] SecurityError - setting hash to:", hashUrl);
|
|
210
210
|
skipNextReplace = true;
|
|
211
211
|
window.location.hash = hashUrl.replace(/^#/, "");
|
|
212
212
|
return;
|
|
@@ -214,7 +214,7 @@ function installHistoryPolyfill() {
|
|
|
214
214
|
throw e;
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
-
console.log("[
|
|
217
|
+
console.log("[HaexSpace] History API patched");
|
|
218
218
|
};
|
|
219
219
|
if (document.readyState === "loading") {
|
|
220
220
|
document.addEventListener("DOMContentLoaded", install, { once: true });
|
|
@@ -223,22 +223,30 @@ function installHistoryPolyfill() {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
// src/messages.ts
|
|
227
|
+
var HAEXSPACE_MESSAGE_TYPES = {
|
|
228
|
+
/** Debug message for development/troubleshooting */
|
|
229
|
+
DEBUG: "haexspace:debug",
|
|
230
|
+
/** Console forwarding from extension iframe */
|
|
231
|
+
CONSOLE_FORWARD: "console.forward"
|
|
232
|
+
};
|
|
233
|
+
|
|
226
234
|
// src/polyfills/debug.ts
|
|
227
235
|
function installDebugDiagnostics() {
|
|
228
236
|
if (typeof window === "undefined") {
|
|
229
237
|
return;
|
|
230
238
|
}
|
|
231
239
|
const hasParent = window.parent && window.parent !== window;
|
|
232
|
-
console.log("[
|
|
240
|
+
console.log("[HaexSpace] hasParent:", hasParent);
|
|
233
241
|
if (hasParent) {
|
|
234
|
-
console.log("[
|
|
242
|
+
console.log("[HaexSpace] Attempting to send debug message to parent...");
|
|
235
243
|
window.parent.postMessage({
|
|
236
|
-
type:
|
|
244
|
+
type: HAEXSPACE_MESSAGE_TYPES.DEBUG,
|
|
237
245
|
data: `[Polyfills] window.parent test: exists=${!!window.parent}, different=${hasParent}, selfIsTop=${window.self === window.top}`
|
|
238
246
|
}, "*");
|
|
239
|
-
console.log("[
|
|
247
|
+
console.log("[HaexSpace] Debug message sent!");
|
|
240
248
|
} else {
|
|
241
|
-
console.log("[
|
|
249
|
+
console.log("[HaexSpace] No parent window or parent === window");
|
|
242
250
|
}
|
|
243
251
|
}
|
|
244
252
|
|
|
@@ -273,7 +281,7 @@ function interceptConsole(level) {
|
|
|
273
281
|
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
274
282
|
window.parent.postMessage(
|
|
275
283
|
{
|
|
276
|
-
type:
|
|
284
|
+
type: HAEXSPACE_MESSAGE_TYPES.CONSOLE_FORWARD,
|
|
277
285
|
data: {
|
|
278
286
|
timestamp,
|
|
279
287
|
level,
|
|
@@ -284,7 +292,7 @@ function interceptConsole(level) {
|
|
|
284
292
|
"*"
|
|
285
293
|
);
|
|
286
294
|
} catch (error) {
|
|
287
|
-
originalConsole.error("[
|
|
295
|
+
originalConsole.error("[HaexSpace] Failed to forward console message:", error);
|
|
288
296
|
}
|
|
289
297
|
}
|
|
290
298
|
};
|
|
@@ -297,7 +305,7 @@ function installConsoleForwarding(debug = false) {
|
|
|
297
305
|
return;
|
|
298
306
|
}
|
|
299
307
|
if (!debug) {
|
|
300
|
-
console.log("[
|
|
308
|
+
console.log("[HaexSpace] Console forwarding disabled (not in debug mode)");
|
|
301
309
|
return;
|
|
302
310
|
}
|
|
303
311
|
interceptConsole("log");
|
|
@@ -305,7 +313,7 @@ function installConsoleForwarding(debug = false) {
|
|
|
305
313
|
interceptConsole("warn");
|
|
306
314
|
interceptConsole("error");
|
|
307
315
|
interceptConsole("debug");
|
|
308
|
-
console.log("[
|
|
316
|
+
console.log("[HaexSpace] Console forwarding installed");
|
|
309
317
|
}
|
|
310
318
|
|
|
311
319
|
// src/polyfills/index.ts
|
|
@@ -317,7 +325,7 @@ function installPolyfills() {
|
|
|
317
325
|
installSessionStoragePolyfill();
|
|
318
326
|
installCookiePolyfill();
|
|
319
327
|
installHistoryPolyfill();
|
|
320
|
-
console.log("[
|
|
328
|
+
console.log("[HaexSpace] All polyfills loaded successfully");
|
|
321
329
|
installDebugDiagnostics();
|
|
322
330
|
}
|
|
323
331
|
if (typeof window !== "undefined") {
|
|
@@ -819,13 +827,13 @@ var HaexVaultClient = class {
|
|
|
819
827
|
async runSetupAsync() {
|
|
820
828
|
if (!this.setupHook) return;
|
|
821
829
|
try {
|
|
822
|
-
this.log("[
|
|
830
|
+
this.log("[HaexSpace] Running setup hook...");
|
|
823
831
|
await this.setupHook();
|
|
824
832
|
this._setupCompleted = true;
|
|
825
|
-
this.log("[
|
|
833
|
+
this.log("[HaexSpace] Setup completed successfully");
|
|
826
834
|
this.notifySubscribers();
|
|
827
835
|
} catch (error) {
|
|
828
|
-
this.log("[
|
|
836
|
+
this.log("[HaexSpace] Setup failed:", error);
|
|
829
837
|
throw error;
|
|
830
838
|
}
|
|
831
839
|
}
|
|
@@ -1154,26 +1162,26 @@ var HaexVaultClient = class {
|
|
|
1154
1162
|
this.log("Application context:", this._context);
|
|
1155
1163
|
this.notifySubscribers();
|
|
1156
1164
|
const { listen } = window.__TAURI__.event;
|
|
1157
|
-
console.log("[
|
|
1165
|
+
console.log("[HaexSpace SDK] Setting up Tauri event listener for:", HAEXTENSION_EVENTS.CONTEXT_CHANGED);
|
|
1158
1166
|
try {
|
|
1159
1167
|
await listen(HAEXTENSION_EVENTS.CONTEXT_CHANGED, (event) => {
|
|
1160
|
-
console.log("[
|
|
1168
|
+
console.log("[HaexSpace SDK] Received Tauri event:", HAEXTENSION_EVENTS.CONTEXT_CHANGED, event);
|
|
1161
1169
|
this.log("Received context change event:", event);
|
|
1162
1170
|
if (event.payload?.context) {
|
|
1163
1171
|
this._context = event.payload.context;
|
|
1164
|
-
console.log("[
|
|
1172
|
+
console.log("[HaexSpace SDK] Updated context to:", this._context);
|
|
1165
1173
|
this.handleEvent({
|
|
1166
1174
|
type: HAEXTENSION_EVENTS.CONTEXT_CHANGED,
|
|
1167
1175
|
data: { context: this._context },
|
|
1168
1176
|
timestamp: Date.now()
|
|
1169
1177
|
});
|
|
1170
1178
|
} else {
|
|
1171
|
-
console.warn("[
|
|
1179
|
+
console.warn("[HaexSpace SDK] Event received but no context in payload:", event);
|
|
1172
1180
|
}
|
|
1173
1181
|
});
|
|
1174
|
-
console.log("[
|
|
1182
|
+
console.log("[HaexSpace SDK] Context change listener registered successfully");
|
|
1175
1183
|
} catch (error) {
|
|
1176
|
-
console.error("[
|
|
1184
|
+
console.error("[HaexSpace SDK] Failed to setup context change listener:", error);
|
|
1177
1185
|
this.log("Failed to setup context change listener:", error);
|
|
1178
1186
|
}
|
|
1179
1187
|
this.resolveReady();
|
|
@@ -1190,7 +1198,7 @@ var HaexVaultClient = class {
|
|
|
1190
1198
|
window.addEventListener("message", this.messageHandler);
|
|
1191
1199
|
this.isNativeWindow = false;
|
|
1192
1200
|
this.initialized = true;
|
|
1193
|
-
this.log("
|
|
1201
|
+
this.log("HaexSpace SDK initialized in iframe mode");
|
|
1194
1202
|
try {
|
|
1195
1203
|
if (this.config.manifest) {
|
|
1196
1204
|
this._extensionInfo = {
|
|
@@ -1209,7 +1217,7 @@ window.parent === window: ${window.parent === window}
|
|
|
1209
1217
|
window.self === window.top: ${window.self === window.top}`;
|
|
1210
1218
|
try {
|
|
1211
1219
|
window.parent.postMessage({
|
|
1212
|
-
type:
|
|
1220
|
+
type: HAEXSPACE_MESSAGE_TYPES.DEBUG,
|
|
1213
1221
|
data: debugInfo
|
|
1214
1222
|
}, "*");
|
|
1215
1223
|
} catch (e) {
|
|
@@ -1358,7 +1366,7 @@ postMessage error: ${e}`);
|
|
|
1358
1366
|
}
|
|
1359
1367
|
log(...args) {
|
|
1360
1368
|
if (this.config.debug) {
|
|
1361
|
-
console.log("[
|
|
1369
|
+
console.log("[HaexSpace SDK]", ...args);
|
|
1362
1370
|
}
|
|
1363
1371
|
}
|
|
1364
1372
|
};
|