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