@haex-space/vault-sdk 2.3.0 → 2.3.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/nuxt.mjs CHANGED
@@ -5,7 +5,7 @@ import { readdirSync, readFileSync, writeFileSync, existsSync } from 'fs';
5
5
  // src/nuxt.ts
6
6
 
7
7
  // src/cors.ts
8
- var HAEXHUB_CORS_HEADERS = {
8
+ var HAEXSPACE_CORS_HEADERS = {
9
9
  "Access-Control-Allow-Origin": "*",
10
10
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
11
11
  "Access-Control-Allow-Headers": "*",
@@ -13,10 +13,10 @@ var HAEXHUB_CORS_HEADERS = {
13
13
  };
14
14
  function getCorsHeaders(origin) {
15
15
  return {
16
- "Access-Control-Allow-Origin": origin || HAEXHUB_CORS_HEADERS["Access-Control-Allow-Origin"],
17
- "Access-Control-Allow-Methods": HAEXHUB_CORS_HEADERS["Access-Control-Allow-Methods"],
18
- "Access-Control-Allow-Headers": HAEXHUB_CORS_HEADERS["Access-Control-Allow-Headers"],
19
- "Access-Control-Allow-Credentials": HAEXHUB_CORS_HEADERS["Access-Control-Allow-Credentials"]
16
+ "Access-Control-Allow-Origin": origin || HAEXSPACE_CORS_HEADERS["Access-Control-Allow-Origin"],
17
+ "Access-Control-Allow-Methods": HAEXSPACE_CORS_HEADERS["Access-Control-Allow-Methods"],
18
+ "Access-Control-Allow-Headers": HAEXSPACE_CORS_HEADERS["Access-Control-Allow-Headers"],
19
+ "Access-Control-Allow-Credentials": HAEXSPACE_CORS_HEADERS["Access-Control-Allow-Credentials"]
20
20
  };
21
21
  }
22
22
 
@@ -25,7 +25,7 @@ function installLocalStoragePolyfill() {
25
25
  if (typeof window === "undefined") {
26
26
  return;
27
27
  }
28
- console.log("[HaexHub] Storage Polyfill loading immediately");
28
+ console.log("[HaexSpace] Storage Polyfill loading immediately");
29
29
  let localStorageWorks = false;
30
30
  try {
31
31
  const testKey = "__ls_test__";
@@ -33,7 +33,7 @@ function installLocalStoragePolyfill() {
33
33
  localStorage.removeItem(testKey);
34
34
  localStorageWorks = true;
35
35
  } catch (e) {
36
- console.warn("[HaexHub] localStorage blocked \u2013 using in-memory fallback");
36
+ console.warn("[HaexSpace] localStorage blocked \u2013 using in-memory fallback");
37
37
  }
38
38
  if (!localStorageWorks) {
39
39
  const lsStorage = /* @__PURE__ */ new Map();
@@ -66,7 +66,7 @@ function installLocalStoragePolyfill() {
66
66
  } catch (e) {
67
67
  window.localStorage = localStoragePoly;
68
68
  }
69
- console.log("[HaexHub] localStorage replaced with in-memory polyfill");
69
+ console.log("[HaexSpace] localStorage replaced with in-memory polyfill");
70
70
  }
71
71
  }
72
72
  function installSessionStoragePolyfill() {
@@ -111,7 +111,7 @@ function installSessionStoragePolyfill() {
111
111
  key: () => null
112
112
  };
113
113
  }
114
- console.log("[HaexHub] sessionStorage polyfill installed");
114
+ console.log("[HaexSpace] sessionStorage polyfill installed");
115
115
  }
116
116
 
117
117
  // src/polyfills/cookies.ts
@@ -124,7 +124,7 @@ function installCookiePolyfill() {
124
124
  document.cookie = "__cookie_test__=1";
125
125
  cookiesWork = document.cookie.indexOf("__cookie_test__") !== -1;
126
126
  } catch (e) {
127
- console.warn("[HaexHub] Cookies blocked \u2013 using in-memory fallback");
127
+ console.warn("[HaexSpace] Cookies blocked \u2013 using in-memory fallback");
128
128
  }
129
129
  if (!cookiesWork) {
130
130
  const cookieStore = /* @__PURE__ */ new Map();
@@ -170,7 +170,7 @@ function installCookiePolyfill() {
170
170
  },
171
171
  configurable: true
172
172
  });
173
- console.log("[HaexHub] Cookie polyfill installed");
173
+ console.log("[HaexSpace] Cookie polyfill installed");
174
174
  }
175
175
  }
176
176
 
@@ -180,16 +180,16 @@ function installHistoryPolyfill() {
180
180
  return;
181
181
  }
182
182
  const install = () => {
183
- console.log("[HaexHub] History Patch loading");
183
+ console.log("[HaexSpace] History Patch loading");
184
184
  const originalPushState = history.pushState;
185
185
  const originalReplaceState = history.replaceState;
186
186
  let skipNextPush = false;
187
187
  let skipNextReplace = false;
188
188
  history.pushState = function(state, title, url) {
189
- console.log("[HaexHub] pushState called:", url, "skip:", skipNextPush);
189
+ console.log("[HaexSpace] pushState called:", url, "skip:", skipNextPush);
190
190
  if (skipNextPush) {
191
191
  skipNextPush = false;
192
- console.log("[HaexHub] pushState skipped");
192
+ console.log("[HaexSpace] pushState skipped");
193
193
  return;
194
194
  }
195
195
  try {
@@ -199,7 +199,7 @@ function installHistoryPolyfill() {
199
199
  const urlString = url.toString();
200
200
  let hashUrl = urlString.replace(/^\/#/, "");
201
201
  hashUrl = hashUrl.startsWith("#") ? hashUrl : "#" + hashUrl;
202
- console.log("[HaexHub] SecurityError - setting hash to:", hashUrl);
202
+ console.log("[HaexSpace] SecurityError - setting hash to:", hashUrl);
203
203
  skipNextPush = true;
204
204
  window.location.hash = hashUrl.replace(/^#/, "");
205
205
  return;
@@ -208,10 +208,10 @@ function installHistoryPolyfill() {
208
208
  }
209
209
  };
210
210
  history.replaceState = function(state, title, url) {
211
- console.log("[HaexHub] replaceState called:", url, "skip:", skipNextReplace);
211
+ console.log("[HaexSpace] replaceState called:", url, "skip:", skipNextReplace);
212
212
  if (skipNextReplace) {
213
213
  skipNextReplace = false;
214
- console.log("[HaexHub] replaceState skipped");
214
+ console.log("[HaexSpace] replaceState skipped");
215
215
  return;
216
216
  }
217
217
  try {
@@ -221,7 +221,7 @@ function installHistoryPolyfill() {
221
221
  const urlString = url.toString();
222
222
  let hashUrl = urlString.replace(/^\/#/, "");
223
223
  hashUrl = hashUrl.startsWith("#") ? hashUrl : "#" + hashUrl;
224
- console.log("[HaexHub] SecurityError - setting hash to:", hashUrl);
224
+ console.log("[HaexSpace] SecurityError - setting hash to:", hashUrl);
225
225
  skipNextReplace = true;
226
226
  window.location.hash = hashUrl.replace(/^#/, "");
227
227
  return;
@@ -229,7 +229,7 @@ function installHistoryPolyfill() {
229
229
  throw e;
230
230
  }
231
231
  };
232
- console.log("[HaexHub] History API patched");
232
+ console.log("[HaexSpace] History API patched");
233
233
  };
234
234
  if (document.readyState === "loading") {
235
235
  document.addEventListener("DOMContentLoaded", install, { once: true });
@@ -267,7 +267,7 @@ function getPolyfillCode() {
267
267
  const iife = `(function() {
268
268
  'use strict';
269
269
 
270
- console.log('[HaexHub] Storage Polyfill loading immediately');
270
+ console.log('[HaexSpace] Storage Polyfill loading immediately');
271
271
 
272
272
  // localStorage Polyfill
273
273
  (${installLocalStoragePolyfill.toString()})();
@@ -283,7 +283,7 @@ function getPolyfillCode() {
283
283
 
284
284
  // Note: Base tag is injected at build-time by Vite plugin, not at runtime
285
285
 
286
- console.log('[HaexHub] All polyfills loaded successfully');
286
+ console.log('[HaexSpace] All polyfills loaded successfully');
287
287
 
288
288
  // Debug diagnostics for Android debugging
289
289
  (${installDebugDiagnostics.toString()})();
@@ -314,18 +314,18 @@ function readManifest(options) {
314
314
  const packageJsonPath = resolve(rootDir, "package.json");
315
315
  packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
316
316
  } catch (pkgError) {
317
- console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);
317
+ console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);
318
318
  }
319
319
  const name = parsed.name ?? packageJson.name;
320
320
  const version = parsed.version ?? packageJson.version;
321
321
  const author = parsed.author ?? packageJson.author ?? null;
322
322
  const homepage = parsed.homepage ?? packageJson.homepage ?? null;
323
323
  if (!name) {
324
- console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);
324
+ console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);
325
325
  return null;
326
326
  }
327
327
  if (!version) {
328
- console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);
328
+ console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);
329
329
  return null;
330
330
  }
331
331
  const manifest = {
@@ -348,11 +348,11 @@ function readManifest(options) {
348
348
  displayMode: parsed.displayMode ?? null,
349
349
  migrationsDir: parsed.migrationsDir ?? null
350
350
  };
351
- console.log(`\u2713 [@haexhub/sdk] Loaded ${resolvedManifestPath}`);
351
+ console.log(`\u2713 [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);
352
352
  return manifest;
353
353
  } catch (error) {
354
354
  console.warn(
355
- `[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`
355
+ `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`
356
356
  );
357
357
  return null;
358
358
  }
package/dist/nuxt.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cors.ts","../src/polyfills/localStorage.ts","../src/polyfills/cookies.ts","../src/polyfills/history.ts","../src/messages.ts","../src/polyfills/debug.ts","../src/polyfills/standalone.ts","../src/config.ts","../src/manifest.ts","../src/nuxt.ts"],"names":["resolvePath","readFileSync","resolve"],"mappings":";;;;;;;AASO,IAAM,oBAAA,GAAuB;AAAA,EAClC,6BAAA,EAA+B,GAAA;AAAA,EAC/B,8BAAA,EAAgC,wCAAA;AAAA,EAChC,8BAAA,EAAgC,GAAA;AAAA,EAChC,kCAAA,EAAoC;AACtC,CAAA;AAoBO,SAAS,eAAe,MAAA,EAAyC;AACtE,EAAA,OAAO;AAAA,IACL,6BAAA,EAA+B,MAAA,IAAU,oBAAA,CAAqB,6BAA6B,CAAA;AAAA,IAC3F,8BAAA,EAAgC,qBAAqB,8BAA8B,CAAA;AAAA,IACnF,8BAAA,EAAgC,qBAAqB,8BAA8B,CAAA;AAAA,IACnF,kCAAA,EAAoC,qBAAqB,kCAAkC;AAAA,GAC7F;AACF;;;AClCO,SAAS,2BAAA,GAAoC;AAClD,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA;AAAA,EACF;AAEA,EAAA,OAAA,CAAQ,IAAI,gDAAgD,CAAA;AAG5D,EAAA,IAAI,iBAAA,GAAoB,KAAA;AACxB,EAAA,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E,IAAI,CAAA;AAAA,WAC1E;AAAA,QACF;AAAA,MACF,SAAS,KAAA,EAAgB;AACvB,QAAA,OAAA,CAAQ,KAAA,CAAM,sDAAsD,KAAK,CAAA;AAAA,MAC3E;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AACF,CAAC","file":"nuxt.mjs","sourcesContent":["/**\n * CORS Configuration for HaexHub Extensions\n * Used by both Vite and Nuxt plugins to ensure consistent CORS headers\n */\n\n/**\n * Standard CORS headers for HaexHub dev servers\n * Allows extensions to be loaded in custom protocol iframes (haex-extension://)\n */\nexport const HAEXHUB_CORS_HEADERS = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n 'Access-Control-Allow-Credentials': 'true',\n} as const\n\n/**\n * Apply CORS headers to a Node.js response object\n * Used in Vite middleware\n */\nexport function applyCorsHeaders(\n res: { setHeader: (name: string, value: string) => void },\n origin?: string\n) {\n res.setHeader('Access-Control-Allow-Origin', origin || '*')\n res.setHeader('Access-Control-Allow-Methods', HAEXHUB_CORS_HEADERS['Access-Control-Allow-Methods'])\n res.setHeader('Access-Control-Allow-Headers', HAEXHUB_CORS_HEADERS['Access-Control-Allow-Headers'])\n res.setHeader('Access-Control-Allow-Credentials', HAEXHUB_CORS_HEADERS['Access-Control-Allow-Credentials'])\n}\n\n/**\n * Get CORS headers as a plain object\n * Used in Vite/Nuxt config\n */\nexport function getCorsHeaders(origin?: string): Record<string, string> {\n return {\n 'Access-Control-Allow-Origin': origin || HAEXHUB_CORS_HEADERS['Access-Control-Allow-Origin'],\n 'Access-Control-Allow-Methods': HAEXHUB_CORS_HEADERS['Access-Control-Allow-Methods'],\n 'Access-Control-Allow-Headers': HAEXHUB_CORS_HEADERS['Access-Control-Allow-Headers'],\n 'Access-Control-Allow-Credentials': HAEXHUB_CORS_HEADERS['Access-Control-Allow-Credentials'],\n }\n}\n","/**\n * localStorage Polyfill for HaexHub Extensions\n *\n * Provides an in-memory fallback when localStorage is blocked\n * due to custom protocol restrictions (haex-extension://)\n */\n\nexport function installLocalStoragePolyfill(): void {\n if (typeof window === 'undefined') {\n return; // Skip in Node.js environment\n }\n\n console.log('[HaexHub] Storage Polyfill loading immediately');\n\n // Test if localStorage is available\n let localStorageWorks = false;\n try {\n const testKey = '__ls_test__';\n localStorage.setItem(testKey, testKey);\n localStorage.removeItem(testKey);\n localStorageWorks = true;\n } catch (e) {\n console.warn('[HaexHub] localStorage blocked – using in-memory fallback');\n }\n\n // If blocked: Replace with In-Memory Storage\n if (!localStorageWorks) {\n const lsStorage = new Map<string, string>();\n\n const localStoragePoly: Storage = {\n getItem(key: string): string | null {\n return lsStorage.get(key) || null;\n },\n setItem(key: string, value: string): void {\n lsStorage.set(key, String(value));\n },\n removeItem(key: string): void {\n lsStorage.delete(key);\n },\n clear(): void {\n lsStorage.clear();\n },\n get length(): number {\n return lsStorage.size;\n },\n key(index: number): string | null {\n return Array.from(lsStorage.keys())[index] || null;\n }\n };\n\n try {\n Object.defineProperty(window, 'localStorage', {\n value: localStoragePoly,\n writable: true,\n configurable: true\n });\n } catch (e) {\n // Fallback: Direct assignment\n (window as any).localStorage = localStoragePoly;\n }\n\n console.log('[HaexHub] localStorage replaced with in-memory polyfill');\n }\n}\n\n/**\n * sessionStorage Polyfill for HaexHub Extensions\n *\n * Provides a no-op implementation as session state doesn't work\n * reliably in custom protocol contexts\n */\nexport function installSessionStoragePolyfill(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n const sessionStoragePoly: Storage = {\n getItem(): null {\n return null;\n },\n setItem(): void {},\n removeItem(): void {},\n clear(): void {},\n get length(): number {\n return 0;\n },\n key(): null {\n return null;\n }\n };\n\n Object.defineProperty(window, 'sessionStorage', {\n value: sessionStoragePoly,\n writable: true,\n configurable: true\n });\n } catch (e) {\n // Fallback: Direct assignment\n (window as any).sessionStorage = {\n getItem: () => null,\n setItem: () => {},\n removeItem: () => {},\n clear: () => {},\n get length() { return 0; },\n key: () => null\n };\n }\n\n console.log('[HaexHub] sessionStorage polyfill installed');\n}\n","/**\n * Cookie Polyfill for HaexHub Extensions\n *\n * Provides an in-memory cookie implementation when cookies are blocked\n * due to custom protocol restrictions (haex-extension://)\n */\n\nexport function installCookiePolyfill(): void {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return; // Skip in Node.js environment\n }\n\n // Test if cookies are available\n let cookiesWork = false;\n try {\n document.cookie = \"__cookie_test__=1\";\n cookiesWork = document.cookie.indexOf(\"__cookie_test__\") !== -1;\n } catch (e) {\n console.warn(\"[HaexHub] Cookies blocked – using in-memory fallback\");\n }\n\n if (!cookiesWork) {\n const cookieStore = new Map<string, string>();\n\n Object.defineProperty(document, \"cookie\", {\n get(): string {\n const cookies: string[] = [];\n cookieStore.forEach((value, key) => {\n cookies.push(`${key}=${value}`);\n });\n return cookies.join(\"; \");\n },\n set(cookieString: string): void {\n const parts = cookieString.split(\";\").map((p) => p.trim());\n const [keyValue] = parts;\n\n if (!keyValue) return;\n\n const [key, value] = keyValue.split(\"=\");\n if (!key) return;\n\n // Parse options\n const options: Record<string, string | boolean> = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n if (!part) continue;\n const parts_split = part.split(\"=\");\n const optKey = parts_split[0];\n const optValue = parts_split[1];\n if (optKey) {\n options[optKey.toLowerCase()] = optValue || true;\n }\n }\n\n // Check for deletion (expires in past)\n const expiresValue = options.expires;\n if (expiresValue && typeof expiresValue === \"string\") {\n const expiresDate = new Date(expiresValue);\n if (expiresDate < new Date()) {\n cookieStore.delete(key);\n return;\n }\n }\n\n // Check for max-age=0 deletion\n const maxAgeValue = options[\"max-age\"];\n if (typeof maxAgeValue === \"string\" && maxAgeValue === \"0\") {\n cookieStore.delete(key);\n return;\n }\n\n // Store cookie\n cookieStore.set(key, value || \"\");\n },\n configurable: true,\n });\n\n console.log(\"[HaexHub] Cookie polyfill installed\");\n }\n}\n","/**\n * History API Polyfill for HaexHub Extensions\n *\n * Works around SecurityError when using pushState/replaceState\n * in custom protocol contexts (haex-extension://)\n *\n * Falls back to hash-based routing when necessary\n */\n\nexport function installHistoryPolyfill(): void {\n if (typeof window === 'undefined' || typeof history === 'undefined') {\n return; // Skip in Node.js environment\n }\n\n // Install after DOM is ready to avoid race conditions\n const install = () => {\n console.log('[HaexHub] History Patch loading');\n\n const originalPushState = history.pushState;\n const originalReplaceState = history.replaceState;\n let skipNextPush = false;\n let skipNextReplace = false;\n\n // Patch pushState\n history.pushState = function(\n state: any,\n title: string,\n url?: string | URL | null\n ): void {\n console.log('[HaexHub] pushState called:', url, 'skip:', skipNextPush);\n\n if (skipNextPush) {\n skipNextPush = false;\n console.log('[HaexHub] pushState skipped');\n return;\n }\n\n try {\n return originalPushState.call(this, state, title, url);\n } catch (e) {\n if ((e as Error).name === 'SecurityError' && url) {\n // Remove duplicate /#/ prefix\n const urlString = url.toString();\n let hashUrl = urlString.replace(/^\\/#/, '');\n hashUrl = hashUrl.startsWith('#') ? hashUrl : '#' + hashUrl;\n console.log('[HaexHub] SecurityError - setting hash to:', hashUrl);\n skipNextPush = true;\n window.location.hash = hashUrl.replace(/^#/, '');\n return; // Silent fallback\n }\n throw e;\n }\n };\n\n // Patch replaceState\n history.replaceState = function(\n state: any,\n title: string,\n url?: string | URL | null\n ): void {\n console.log('[HaexHub] replaceState called:', url, 'skip:', skipNextReplace);\n\n if (skipNextReplace) {\n skipNextReplace = false;\n console.log('[HaexHub] replaceState skipped');\n return;\n }\n\n try {\n return originalReplaceState.call(this, state, title, url);\n } catch (e) {\n if ((e as Error).name === 'SecurityError' && url) {\n // Remove duplicate /#/ prefix\n const urlString = url.toString();\n let hashUrl = urlString.replace(/^\\/#/, '');\n hashUrl = hashUrl.startsWith('#') ? hashUrl : '#' + hashUrl;\n console.log('[HaexHub] SecurityError - setting hash to:', hashUrl);\n skipNextReplace = true;\n window.location.hash = hashUrl.replace(/^#/, '');\n return; // Silent fallback\n }\n throw e;\n }\n };\n\n console.log('[HaexHub] History API patched');\n };\n\n // Install after DOM is ready\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', install, { once: true });\n } else {\n // DOM already loaded, install immediately\n install();\n }\n}\n","/**\n * Central message type definitions for HaexSpace SDK\n *\n * Message Naming Schema: haexspace:{subject}\n *\n * These are used for internal communication between extensions and HaexSpace\n */\n\nexport const HAEXSPACE_MESSAGE_TYPES = {\n /** Debug message for development/troubleshooting */\n DEBUG: 'haexspace:debug',\n\n /** Console forwarding from extension iframe */\n CONSOLE_FORWARD: 'console.forward',\n} as const;\n\nexport type HaexspaceMessageType =\n (typeof HAEXSPACE_MESSAGE_TYPES)[keyof typeof HAEXSPACE_MESSAGE_TYPES];\n","import { HAEXSPACE_MESSAGE_TYPES } from '../messages';\n\n/**\n * Debug diagnostics for Android debugging\n * Tests window.parent availability and postMessage functionality\n */\nexport function installDebugDiagnostics(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n const hasParent = window.parent && window.parent !== window;\n console.log('[HaexSpace] hasParent:', hasParent);\n\n if (hasParent) {\n console.log('[HaexSpace] Attempting to send debug message to parent...');\n window.parent.postMessage({\n type: HAEXSPACE_MESSAGE_TYPES.DEBUG,\n data: `[Polyfills] window.parent test: exists=${!!window.parent}, different=${hasParent}, selfIsTop=${window.self === window.top}`\n }, '*');\n console.log('[HaexSpace] Debug message sent!');\n } else {\n console.log('[HaexSpace] No parent window or parent === window');\n }\n}\n","/**\n * Generates standalone polyfill code for HTML injection\n * This wraps the modular polyfills into an IIFE for immediate execution\n */\nimport {\n installLocalStoragePolyfill,\n installSessionStoragePolyfill,\n} from './localStorage'\nimport { installCookiePolyfill } from './cookies'\nimport { installHistoryPolyfill } from './history'\nimport { installDebugDiagnostics } from './debug'\n\n/**\n * Get the standalone polyfill code as a string\n * This is used by the Nuxt and Vite plugins to inject polyfills into HTML\n *\n * Note: Base tag is injected statically by the Vite plugin, not at runtime\n */\nexport function getPolyfillCode(): string {\n // Convert functions to string and wrap in IIFE\n const iife = `(function() {\n 'use strict';\n\n console.log('[HaexHub] Storage Polyfill loading immediately');\n\n // localStorage Polyfill\n (${installLocalStoragePolyfill.toString()})();\n\n // sessionStorage Polyfill\n (${installSessionStoragePolyfill.toString()})();\n\n // Cookie Polyfill\n (${installCookiePolyfill.toString()})();\n\n // History API Polyfill\n (${installHistoryPolyfill.toString()})();\n\n // Note: Base tag is injected at build-time by Vite plugin, not at runtime\n\n console.log('[HaexHub] All polyfills loaded successfully');\n\n // Debug diagnostics for Android debugging\n (${installDebugDiagnostics.toString()})();\n})();`\n\n return iife\n}\n","/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n const parsed: Partial<ExtensionManifest> = JSON.parse(manifestContent);\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch (pkgError) {\n console.warn(`[@haexhub/sdk] Warning: Could not read package.json`);\n }\n\n // Use manifest values with fallback to package.json\n const name = parsed.name ?? packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haexhub/sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haexhub/sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n signature: parsed.signature ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n };\n\n console.log(`✓ [@haexhub/sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch (error) {\n console.warn(\n `[@haexhub/sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/**\n * Nuxt Module for HaexVault SDK\n * Automatically injects polyfills into the built HTML files\n */\nimport { addPlugin, createResolver, defineNuxtModule } from \"@nuxt/kit\";\nimport { getCorsHeaders } from \"./cors\";\nimport { getPolyfillCode } from \"./polyfills/standalone\";\nimport { join, resolve as resolvePath } from \"node:path\";\nimport { readFileSync, writeFileSync, readdirSync } from \"node:fs\";\nimport type { Nuxt } from \"@nuxt/schema\";\nimport { readHaextensionConfig } from \"./config\";\nimport { readManifest } from \"./manifest\";\n\nexport interface ModuleOptions {\n injectPolyfills?: boolean;\n /**\n * Directory containing extension files (manifest.json, public.key, private.key)\n * Default: \"haextension\"\n */\n extensionDir?: string;\n /** Path to manifest.json (overrides extensionDir if specified) */\n manifestPath?: string;\n /** Path to public.key (overrides extensionDir if specified) */\n publicKeyPath?: string;\n /** Path to private.key (overrides extensionDir if specified) */\n privateKeyPath?: string;\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: \"@haex-space/vault-sdk\",\n configKey: \"haexVault\",\n compatibility: {\n nuxt: \"^3.0.0 || ^4.0.0\",\n },\n },\n\n defaults: {\n injectPolyfills: true,\n extensionDir: \"haextension\",\n },\n\n async setup(options: ModuleOptions, nuxt: Nuxt) {\n const { resolve } = createResolver(import.meta.url);\n\n // Add type declaration for $haexVault\n nuxt.hook('prepare:types', ({ references }) => {\n references.push({ path: resolve('./runtime/nuxt.types.d.ts') })\n })\n\n // Read haextension.config.json if available\n const config = readHaextensionConfig(nuxt.options.rootDir);\n\n // Use config values as defaults if not explicitly set in options\n const extensionDir = options.extensionDir || config?.dev?.haextension_dir || \"haextension\";\n\n // Read manifest.json using shared utility\n const manifest = readManifest({\n rootDir: nuxt.options.rootDir,\n manifestPath: options.manifestPath,\n extensionDir,\n });\n\n // Inject manifest into public runtime config\n nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};\n nuxt.options.runtimeConfig.public.haexVaultManifest = manifest;\n\n addPlugin({\n src: resolve(\"./runtime/nuxt.plugin.client.mjs\"),\n mode: \"client\",\n });\n // CRITICAL: Install polyfill hook BEFORE any other module\n // This ensures polyfills load before color-mode or any other script\n if (options.injectPolyfills && nuxt.options.dev) {\n nuxt.hook(\"nitro:config\", (nitroConfig: any) => {\n nitroConfig.hooks = nitroConfig.hooks || {};\n nitroConfig.hooks[\"render:html\"] =\n nitroConfig.hooks[\"render:html\"] || [];\n\n // Prepend (unshift) to run before ALL other hooks\n const polyfillCode = getPolyfillCode();\n const polyfillScript = `<script data-haexhub-polyfill>${polyfillCode}</script>`;\n\n nitroConfig.hooks[\"render:html\"].unshift((html: any) => {\n // Inject at the very beginning of <head>\n if (html.head && Array.isArray(html.head)) {\n html.head.unshift(polyfillScript);\n }\n });\n });\n console.log(\n \"✓ [@haex-space/vault-sdk] Dev mode: Priority polyfill injection configured\"\n );\n }\n\n // Configure Nuxt differently for dev vs production\n if (nuxt.options.dev) {\n // DEV MODE: Use absolute paths for dev server\n nuxt.options.app.baseURL = \"/\";\n nuxt.options.app.buildAssetsDir = \"/_nuxt/\";\n\n // Enable CORS for dev server using shared CORS configuration\n nuxt.options.vite = nuxt.options.vite || {};\n nuxt.options.vite.server = nuxt.options.vite.server || {};\n nuxt.options.vite.server.cors = true;\n nuxt.options.vite.server.headers = getCorsHeaders();\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Dev mode: Set app.baseURL to / (absolute paths for dev server)\"\n );\n console.log(\"✓ [@haex-space/vault-sdk] Dev mode: Enabled CORS headers\");\n } else {\n // PRODUCTION BUILD: Use relative paths\n nuxt.options.app.baseURL = \"./\";\n nuxt.options.app.buildAssetsDir = \"_nuxt/\"; // Remove leading slash\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Build mode: Set app.baseURL to relative path (./)\"\n );\n console.log(\n \"✓ [@haex-space/vault-sdk] Build mode: Set buildAssetsDir to relative path (_nuxt/)\"\n );\n }\n\n // Disable app manifest feature (generates /_nuxt/builds/meta/*.json)\n // This is not needed for extensions and causes 404 errors\n nuxt.options.experimental = nuxt.options.experimental || {};\n nuxt.options.experimental.appManifest = false;\n\n // Disable payload extraction for SPAs (extensions don't need SSR payload)\n // This prevents \"Cannot load payload\" errors for _payload.json files\n nuxt.options.experimental.payloadExtraction = false;\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Disabled appManifest (not needed for extensions)\"\n );\n console.log(\n \"✓ [@haex-space/vault-sdk] Disabled payloadExtraction (not needed for SPAs)\"\n );\n\n // Only inject polyfills if enabled and building for production\n if (!options.injectPolyfills || nuxt.options.dev) {\n return;\n }\n\n // Add hook to inject polyfills after HTML generation\n nuxt.hook(\"nitro:build:public-assets\", async () => {\n try {\n // Use Nuxt's configured output directory\n const nitroOutput = nuxt.options.nitro?.output || {};\n const outputDir = nitroOutput.dir || \".output\";\n const publicDir = nitroOutput.publicDir || \"public\";\n const distDir = resolvePath(nuxt.options.rootDir, outputDir, publicDir);\n\n // Get polyfill code from modular polyfills\n const polyfillCode = getPolyfillCode();\n const polyfillScript = `<script>${polyfillCode}</script>`;\n\n // Find all HTML files in the output directory\n const htmlFiles = readdirSync(distDir).filter((f: string) =>\n f.endsWith(\".html\")\n );\n\n for (const file of htmlFiles) {\n const filePath = join(distDir, file);\n let html = readFileSync(filePath, \"utf-8\");\n\n // Inject polyfill directly after <head>\n const headPos = html.indexOf(\"<head>\");\n if (headPos !== -1) {\n const insertPos = headPos + 6; // after <head>\n html =\n html.slice(0, insertPos) + polyfillScript + html.slice(insertPos);\n }\n\n // IMPORTANT: Convert all absolute asset paths to relative paths\n // Replace all occurrences of /_nuxt/ with _nuxt/ to make paths relative\n\n // Fix <link> and <script> tags\n html = html.replace(/\\b(href|src)=\"\\/_nuxt\\//g, '$1=\"_nuxt/');\n\n // Fix import maps - need to keep it absolute or use ./ prefix for module resolution\n html = html.replace(\n /\"imports\":\\{\"#entry\":\"\\/_nuxt\\//g,\n '\"imports\":{\"#entry\":\"./_nuxt/'\n );\n\n // Fix buildAssetsDir in runtime config\n html = html.replace(\n /buildAssetsDir:\"\\/_nuxt\\/\"/g,\n 'buildAssetsDir:\"./_nuxt/\"'\n );\n\n // Fix any remaining absolute /_nuxt/ references in JSON/JS\n html = html.replace(/\"\\/_nuxt\\//g, '\"./_nuxt/');\n\n writeFileSync(filePath, html);\n console.log(\n `✓ [@haex-space/vault-sdk] Polyfill and relative paths applied to ${file}`\n );\n }\n } catch (error: unknown) {\n console.error(\"[@haex-space/vault-sdk] Failed to inject polyfill:\", error);\n }\n });\n },\n});\n"]}
1
+ {"version":3,"sources":["../src/cors.ts","../src/polyfills/localStorage.ts","../src/polyfills/cookies.ts","../src/polyfills/history.ts","../src/messages.ts","../src/polyfills/debug.ts","../src/polyfills/standalone.ts","../src/config.ts","../src/manifest.ts","../src/nuxt.ts"],"names":["resolvePath","readFileSync","resolve"],"mappings":";;;;;;;AASO,IAAM,sBAAA,GAAyB;AAAA,EACpC,6BAAA,EAA+B,GAAA;AAAA,EAC/B,8BAAA,EAAgC,wCAAA;AAAA,EAChC,8BAAA,EAAgC,GAAA;AAAA,EAChC,kCAAA,EAAoC;AACtC,CAAA;AAoBO,SAAS,eAAe,MAAA,EAAyC;AACtE,EAAA,OAAO;AAAA,IACL,6BAAA,EAA+B,MAAA,IAAU,sBAAA,CAAuB,6BAA6B,CAAA;AAAA,IAC7F,8BAAA,EAAgC,uBAAuB,8BAA8B,CAAA;AAAA,IACrF,8BAAA,EAAgC,uBAAuB,8BAA8B,CAAA;AAAA,IACrF,kCAAA,EAAoC,uBAAuB,kCAAkC;AAAA,GAC/F;AACF;;;AClCO,SAAS,2BAAA,GAAoC;AAClD,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA;AAAA,EACF;AAEA,EAAA,OAAA,CAAQ,IAAI,kDAAkD,CAAA;AAG9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AAC5B,UAAA,OAAA,CAAQ,GAAA;AAAA,YACN,yEAAoE,IAAI,CAAA;AAAA,WAC1E;AAAA,QACF;AAAA,MACF,SAAS,KAAA,EAAgB;AACvB,QAAA,OAAA,CAAQ,KAAA,CAAM,sDAAsD,KAAK,CAAA;AAAA,MAC3E;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AACF,CAAC","file":"nuxt.mjs","sourcesContent":["/**\n * CORS Configuration for HaexSpace Extensions\n * Used by both Vite and Nuxt plugins to ensure consistent CORS headers\n */\n\n/**\n * Standard CORS headers for HaexSpace dev servers\n * Allows extensions to be loaded in custom protocol iframes (haex-extension://)\n */\nexport const HAEXSPACE_CORS_HEADERS = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',\n 'Access-Control-Allow-Headers': '*',\n 'Access-Control-Allow-Credentials': 'true',\n} as const\n\n/**\n * Apply CORS headers to a Node.js response object\n * Used in Vite middleware\n */\nexport function applyCorsHeaders(\n res: { setHeader: (name: string, value: string) => void },\n origin?: string\n) {\n res.setHeader('Access-Control-Allow-Origin', origin || '*')\n res.setHeader('Access-Control-Allow-Methods', HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Methods'])\n res.setHeader('Access-Control-Allow-Headers', HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Headers'])\n res.setHeader('Access-Control-Allow-Credentials', HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Credentials'])\n}\n\n/**\n * Get CORS headers as a plain object\n * Used in Vite/Nuxt config\n */\nexport function getCorsHeaders(origin?: string): Record<string, string> {\n return {\n 'Access-Control-Allow-Origin': origin || HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Origin'],\n 'Access-Control-Allow-Methods': HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Methods'],\n 'Access-Control-Allow-Headers': HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Headers'],\n 'Access-Control-Allow-Credentials': HAEXSPACE_CORS_HEADERS['Access-Control-Allow-Credentials'],\n }\n}\n","/**\n * localStorage Polyfill for HaexSpace Extensions\n *\n * Provides an in-memory fallback when localStorage is blocked\n * due to custom protocol restrictions (haex-extension://)\n */\n\nexport function installLocalStoragePolyfill(): void {\n if (typeof window === 'undefined') {\n return; // Skip in Node.js environment\n }\n\n console.log('[HaexSpace] Storage Polyfill loading immediately');\n\n // Test if localStorage is available\n let localStorageWorks = false;\n try {\n const testKey = '__ls_test__';\n localStorage.setItem(testKey, testKey);\n localStorage.removeItem(testKey);\n localStorageWorks = true;\n } catch (e) {\n console.warn('[HaexSpace] localStorage blocked – using in-memory fallback');\n }\n\n // If blocked: Replace with In-Memory Storage\n if (!localStorageWorks) {\n const lsStorage = new Map<string, string>();\n\n const localStoragePoly: Storage = {\n getItem(key: string): string | null {\n return lsStorage.get(key) || null;\n },\n setItem(key: string, value: string): void {\n lsStorage.set(key, String(value));\n },\n removeItem(key: string): void {\n lsStorage.delete(key);\n },\n clear(): void {\n lsStorage.clear();\n },\n get length(): number {\n return lsStorage.size;\n },\n key(index: number): string | null {\n return Array.from(lsStorage.keys())[index] || null;\n }\n };\n\n try {\n Object.defineProperty(window, 'localStorage', {\n value: localStoragePoly,\n writable: true,\n configurable: true\n });\n } catch (e) {\n // Fallback: Direct assignment\n (window as any).localStorage = localStoragePoly;\n }\n\n console.log('[HaexSpace] localStorage replaced with in-memory polyfill');\n }\n}\n\n/**\n * sessionStorage Polyfill for HaexSpace Extensions\n *\n * Provides a no-op implementation as session state doesn't work\n * reliably in custom protocol contexts\n */\nexport function installSessionStoragePolyfill(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n try {\n const sessionStoragePoly: Storage = {\n getItem(): null {\n return null;\n },\n setItem(): void {},\n removeItem(): void {},\n clear(): void {},\n get length(): number {\n return 0;\n },\n key(): null {\n return null;\n }\n };\n\n Object.defineProperty(window, 'sessionStorage', {\n value: sessionStoragePoly,\n writable: true,\n configurable: true\n });\n } catch (e) {\n // Fallback: Direct assignment\n (window as any).sessionStorage = {\n getItem: () => null,\n setItem: () => {},\n removeItem: () => {},\n clear: () => {},\n get length() { return 0; },\n key: () => null\n };\n }\n\n console.log('[HaexSpace] sessionStorage polyfill installed');\n}\n","/**\n * Cookie Polyfill for HaexSpace Extensions\n *\n * Provides an in-memory cookie implementation when cookies are blocked\n * due to custom protocol restrictions (haex-extension://)\n */\n\nexport function installCookiePolyfill(): void {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") {\n return; // Skip in Node.js environment\n }\n\n // Test if cookies are available\n let cookiesWork = false;\n try {\n document.cookie = \"__cookie_test__=1\";\n cookiesWork = document.cookie.indexOf(\"__cookie_test__\") !== -1;\n } catch (e) {\n console.warn(\"[HaexSpace] Cookies blocked – using in-memory fallback\");\n }\n\n if (!cookiesWork) {\n const cookieStore = new Map<string, string>();\n\n Object.defineProperty(document, \"cookie\", {\n get(): string {\n const cookies: string[] = [];\n cookieStore.forEach((value, key) => {\n cookies.push(`${key}=${value}`);\n });\n return cookies.join(\"; \");\n },\n set(cookieString: string): void {\n const parts = cookieString.split(\";\").map((p) => p.trim());\n const [keyValue] = parts;\n\n if (!keyValue) return;\n\n const [key, value] = keyValue.split(\"=\");\n if (!key) return;\n\n // Parse options\n const options: Record<string, string | boolean> = {};\n for (let i = 1; i < parts.length; i++) {\n const part = parts[i];\n if (!part) continue;\n const parts_split = part.split(\"=\");\n const optKey = parts_split[0];\n const optValue = parts_split[1];\n if (optKey) {\n options[optKey.toLowerCase()] = optValue || true;\n }\n }\n\n // Check for deletion (expires in past)\n const expiresValue = options.expires;\n if (expiresValue && typeof expiresValue === \"string\") {\n const expiresDate = new Date(expiresValue);\n if (expiresDate < new Date()) {\n cookieStore.delete(key);\n return;\n }\n }\n\n // Check for max-age=0 deletion\n const maxAgeValue = options[\"max-age\"];\n if (typeof maxAgeValue === \"string\" && maxAgeValue === \"0\") {\n cookieStore.delete(key);\n return;\n }\n\n // Store cookie\n cookieStore.set(key, value || \"\");\n },\n configurable: true,\n });\n\n console.log(\"[HaexSpace] Cookie polyfill installed\");\n }\n}\n","/**\n * History API Polyfill for HaexSpace Extensions\n *\n * Works around SecurityError when using pushState/replaceState\n * in custom protocol contexts (haex-extension://)\n *\n * Falls back to hash-based routing when necessary\n */\n\nexport function installHistoryPolyfill(): void {\n if (typeof window === 'undefined' || typeof history === 'undefined') {\n return; // Skip in Node.js environment\n }\n\n // Install after DOM is ready to avoid race conditions\n const install = () => {\n console.log('[HaexSpace] History Patch loading');\n\n const originalPushState = history.pushState;\n const originalReplaceState = history.replaceState;\n let skipNextPush = false;\n let skipNextReplace = false;\n\n // Patch pushState\n history.pushState = function(\n state: any,\n title: string,\n url?: string | URL | null\n ): void {\n console.log('[HaexSpace] pushState called:', url, 'skip:', skipNextPush);\n\n if (skipNextPush) {\n skipNextPush = false;\n console.log('[HaexSpace] pushState skipped');\n return;\n }\n\n try {\n return originalPushState.call(this, state, title, url);\n } catch (e) {\n if ((e as Error).name === 'SecurityError' && url) {\n // Remove duplicate /#/ prefix\n const urlString = url.toString();\n let hashUrl = urlString.replace(/^\\/#/, '');\n hashUrl = hashUrl.startsWith('#') ? hashUrl : '#' + hashUrl;\n console.log('[HaexSpace] SecurityError - setting hash to:', hashUrl);\n skipNextPush = true;\n window.location.hash = hashUrl.replace(/^#/, '');\n return; // Silent fallback\n }\n throw e;\n }\n };\n\n // Patch replaceState\n history.replaceState = function(\n state: any,\n title: string,\n url?: string | URL | null\n ): void {\n console.log('[HaexSpace] replaceState called:', url, 'skip:', skipNextReplace);\n\n if (skipNextReplace) {\n skipNextReplace = false;\n console.log('[HaexSpace] replaceState skipped');\n return;\n }\n\n try {\n return originalReplaceState.call(this, state, title, url);\n } catch (e) {\n if ((e as Error).name === 'SecurityError' && url) {\n // Remove duplicate /#/ prefix\n const urlString = url.toString();\n let hashUrl = urlString.replace(/^\\/#/, '');\n hashUrl = hashUrl.startsWith('#') ? hashUrl : '#' + hashUrl;\n console.log('[HaexSpace] SecurityError - setting hash to:', hashUrl);\n skipNextReplace = true;\n window.location.hash = hashUrl.replace(/^#/, '');\n return; // Silent fallback\n }\n throw e;\n }\n };\n\n console.log('[HaexSpace] History API patched');\n };\n\n // Install after DOM is ready\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', install, { once: true });\n } else {\n // DOM already loaded, install immediately\n install();\n }\n}\n","/**\n * Central message type definitions for HaexSpace SDK\n *\n * Message Naming Schema: haexspace:{subject}\n *\n * These are used for internal communication between extensions and HaexSpace\n */\n\nexport const HAEXSPACE_MESSAGE_TYPES = {\n /** Debug message for development/troubleshooting */\n DEBUG: 'haexspace:debug',\n\n /** Console forwarding from extension iframe */\n CONSOLE_FORWARD: 'console.forward',\n} as const;\n\nexport type HaexspaceMessageType =\n (typeof HAEXSPACE_MESSAGE_TYPES)[keyof typeof HAEXSPACE_MESSAGE_TYPES];\n","import { HAEXSPACE_MESSAGE_TYPES } from '../messages';\n\n/**\n * Debug diagnostics for Android debugging\n * Tests window.parent availability and postMessage functionality\n */\nexport function installDebugDiagnostics(): void {\n if (typeof window === 'undefined') {\n return;\n }\n\n const hasParent = window.parent && window.parent !== window;\n console.log('[HaexSpace] hasParent:', hasParent);\n\n if (hasParent) {\n console.log('[HaexSpace] Attempting to send debug message to parent...');\n window.parent.postMessage({\n type: HAEXSPACE_MESSAGE_TYPES.DEBUG,\n data: `[Polyfills] window.parent test: exists=${!!window.parent}, different=${hasParent}, selfIsTop=${window.self === window.top}`\n }, '*');\n console.log('[HaexSpace] Debug message sent!');\n } else {\n console.log('[HaexSpace] No parent window or parent === window');\n }\n}\n","/**\n * Generates standalone polyfill code for HTML injection\n * This wraps the modular polyfills into an IIFE for immediate execution\n */\nimport {\n installLocalStoragePolyfill,\n installSessionStoragePolyfill,\n} from './localStorage'\nimport { installCookiePolyfill } from './cookies'\nimport { installHistoryPolyfill } from './history'\nimport { installDebugDiagnostics } from './debug'\n\n/**\n * Get the standalone polyfill code as a string\n * This is used by the Nuxt and Vite plugins to inject polyfills into HTML\n *\n * Note: Base tag is injected statically by the Vite plugin, not at runtime\n */\nexport function getPolyfillCode(): string {\n // Convert functions to string and wrap in IIFE\n const iife = `(function() {\n 'use strict';\n\n console.log('[HaexSpace] Storage Polyfill loading immediately');\n\n // localStorage Polyfill\n (${installLocalStoragePolyfill.toString()})();\n\n // sessionStorage Polyfill\n (${installSessionStoragePolyfill.toString()})();\n\n // Cookie Polyfill\n (${installCookiePolyfill.toString()})();\n\n // History API Polyfill\n (${installHistoryPolyfill.toString()})();\n\n // Note: Base tag is injected at build-time by Vite plugin, not at runtime\n\n console.log('[HaexSpace] All polyfills loaded successfully');\n\n // Debug diagnostics for Android debugging\n (${installDebugDiagnostics.toString()})();\n})();`\n\n return iife\n}\n","/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n const parsed: Partial<ExtensionManifest> = JSON.parse(manifestContent);\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch (pkgError) {\n console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);\n }\n\n // Use manifest values with fallback to package.json\n const name = parsed.name ?? packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n signature: parsed.signature ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n };\n\n console.log(`✓ [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch (error) {\n console.warn(\n `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/**\n * Nuxt Module for HaexVault SDK\n * Automatically injects polyfills into the built HTML files\n */\nimport { addPlugin, createResolver, defineNuxtModule } from \"@nuxt/kit\";\nimport { getCorsHeaders } from \"./cors\";\nimport { getPolyfillCode } from \"./polyfills/standalone\";\nimport { join, resolve as resolvePath } from \"node:path\";\nimport { readFileSync, writeFileSync, readdirSync } from \"node:fs\";\nimport type { Nuxt } from \"@nuxt/schema\";\nimport { readHaextensionConfig } from \"./config\";\nimport { readManifest } from \"./manifest\";\n\nexport interface ModuleOptions {\n injectPolyfills?: boolean;\n /**\n * Directory containing extension files (manifest.json, public.key, private.key)\n * Default: \"haextension\"\n */\n extensionDir?: string;\n /** Path to manifest.json (overrides extensionDir if specified) */\n manifestPath?: string;\n /** Path to public.key (overrides extensionDir if specified) */\n publicKeyPath?: string;\n /** Path to private.key (overrides extensionDir if specified) */\n privateKeyPath?: string;\n}\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: {\n name: \"@haex-space/vault-sdk\",\n configKey: \"haexVault\",\n compatibility: {\n nuxt: \"^3.0.0 || ^4.0.0\",\n },\n },\n\n defaults: {\n injectPolyfills: true,\n extensionDir: \"haextension\",\n },\n\n async setup(options: ModuleOptions, nuxt: Nuxt) {\n const { resolve } = createResolver(import.meta.url);\n\n // Add type declaration for $haexVault\n nuxt.hook('prepare:types', ({ references }) => {\n references.push({ path: resolve('./runtime/nuxt.types.d.ts') })\n })\n\n // Read haextension.config.json if available\n const config = readHaextensionConfig(nuxt.options.rootDir);\n\n // Use config values as defaults if not explicitly set in options\n const extensionDir = options.extensionDir || config?.dev?.haextension_dir || \"haextension\";\n\n // Read manifest.json using shared utility\n const manifest = readManifest({\n rootDir: nuxt.options.rootDir,\n manifestPath: options.manifestPath,\n extensionDir,\n });\n\n // Inject manifest into public runtime config\n nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};\n nuxt.options.runtimeConfig.public.haexVaultManifest = manifest;\n\n addPlugin({\n src: resolve(\"./runtime/nuxt.plugin.client.mjs\"),\n mode: \"client\",\n });\n // CRITICAL: Install polyfill hook BEFORE any other module\n // This ensures polyfills load before color-mode or any other script\n if (options.injectPolyfills && nuxt.options.dev) {\n nuxt.hook(\"nitro:config\", (nitroConfig: any) => {\n nitroConfig.hooks = nitroConfig.hooks || {};\n nitroConfig.hooks[\"render:html\"] =\n nitroConfig.hooks[\"render:html\"] || [];\n\n // Prepend (unshift) to run before ALL other hooks\n const polyfillCode = getPolyfillCode();\n const polyfillScript = `<script data-haexhub-polyfill>${polyfillCode}</script>`;\n\n nitroConfig.hooks[\"render:html\"].unshift((html: any) => {\n // Inject at the very beginning of <head>\n if (html.head && Array.isArray(html.head)) {\n html.head.unshift(polyfillScript);\n }\n });\n });\n console.log(\n \"✓ [@haex-space/vault-sdk] Dev mode: Priority polyfill injection configured\"\n );\n }\n\n // Configure Nuxt differently for dev vs production\n if (nuxt.options.dev) {\n // DEV MODE: Use absolute paths for dev server\n nuxt.options.app.baseURL = \"/\";\n nuxt.options.app.buildAssetsDir = \"/_nuxt/\";\n\n // Enable CORS for dev server using shared CORS configuration\n nuxt.options.vite = nuxt.options.vite || {};\n nuxt.options.vite.server = nuxt.options.vite.server || {};\n nuxt.options.vite.server.cors = true;\n nuxt.options.vite.server.headers = getCorsHeaders();\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Dev mode: Set app.baseURL to / (absolute paths for dev server)\"\n );\n console.log(\"✓ [@haex-space/vault-sdk] Dev mode: Enabled CORS headers\");\n } else {\n // PRODUCTION BUILD: Use relative paths\n nuxt.options.app.baseURL = \"./\";\n nuxt.options.app.buildAssetsDir = \"_nuxt/\"; // Remove leading slash\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Build mode: Set app.baseURL to relative path (./)\"\n );\n console.log(\n \"✓ [@haex-space/vault-sdk] Build mode: Set buildAssetsDir to relative path (_nuxt/)\"\n );\n }\n\n // Disable app manifest feature (generates /_nuxt/builds/meta/*.json)\n // This is not needed for extensions and causes 404 errors\n nuxt.options.experimental = nuxt.options.experimental || {};\n nuxt.options.experimental.appManifest = false;\n\n // Disable payload extraction for SPAs (extensions don't need SSR payload)\n // This prevents \"Cannot load payload\" errors for _payload.json files\n nuxt.options.experimental.payloadExtraction = false;\n\n console.log(\n \"✓ [@haex-space/vault-sdk] Disabled appManifest (not needed for extensions)\"\n );\n console.log(\n \"✓ [@haex-space/vault-sdk] Disabled payloadExtraction (not needed for SPAs)\"\n );\n\n // Only inject polyfills if enabled and building for production\n if (!options.injectPolyfills || nuxt.options.dev) {\n return;\n }\n\n // Add hook to inject polyfills after HTML generation\n nuxt.hook(\"nitro:build:public-assets\", async () => {\n try {\n // Use Nuxt's configured output directory\n const nitroOutput = nuxt.options.nitro?.output || {};\n const outputDir = nitroOutput.dir || \".output\";\n const publicDir = nitroOutput.publicDir || \"public\";\n const distDir = resolvePath(nuxt.options.rootDir, outputDir, publicDir);\n\n // Get polyfill code from modular polyfills\n const polyfillCode = getPolyfillCode();\n const polyfillScript = `<script>${polyfillCode}</script>`;\n\n // Find all HTML files in the output directory\n const htmlFiles = readdirSync(distDir).filter((f: string) =>\n f.endsWith(\".html\")\n );\n\n for (const file of htmlFiles) {\n const filePath = join(distDir, file);\n let html = readFileSync(filePath, \"utf-8\");\n\n // Inject polyfill directly after <head>\n const headPos = html.indexOf(\"<head>\");\n if (headPos !== -1) {\n const insertPos = headPos + 6; // after <head>\n html =\n html.slice(0, insertPos) + polyfillScript + html.slice(insertPos);\n }\n\n // IMPORTANT: Convert all absolute asset paths to relative paths\n // Replace all occurrences of /_nuxt/ with _nuxt/ to make paths relative\n\n // Fix <link> and <script> tags\n html = html.replace(/\\b(href|src)=\"\\/_nuxt\\//g, '$1=\"_nuxt/');\n\n // Fix import maps - need to keep it absolute or use ./ prefix for module resolution\n html = html.replace(\n /\"imports\":\\{\"#entry\":\"\\/_nuxt\\//g,\n '\"imports\":{\"#entry\":\"./_nuxt/'\n );\n\n // Fix buildAssetsDir in runtime config\n html = html.replace(\n /buildAssetsDir:\"\\/_nuxt\\/\"/g,\n 'buildAssetsDir:\"./_nuxt/\"'\n );\n\n // Fix any remaining absolute /_nuxt/ references in JSON/JS\n html = html.replace(/\"\\/_nuxt\\//g, '\"./_nuxt/');\n\n writeFileSync(filePath, html);\n console.log(\n `✓ [@haex-space/vault-sdk] Polyfill and relative paths applied to ${file}`\n );\n }\n } catch (error: unknown) {\n console.error(\"[@haex-space/vault-sdk] Failed to inject polyfill:\", error);\n }\n });\n },\n});\n"]}
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("[HaexHub] Storage Polyfill loading immediately");
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("[HaexHub] localStorage blocked \u2013 using in-memory fallback");
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("[HaexHub] localStorage replaced with in-memory polyfill");
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("[HaexHub] sessionStorage polyfill installed");
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("[HaexHub] Cookies blocked \u2013 using in-memory fallback");
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("[HaexHub] Cookie polyfill installed");
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("[HaexHub] History Patch loading");
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("[HaexHub] pushState called:", url, "skip:", skipNextPush);
174
+ console.log("[HaexSpace] pushState called:", url, "skip:", skipNextPush);
175
175
  if (skipNextPush) {
176
176
  skipNextPush = false;
177
- console.log("[HaexHub] pushState skipped");
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("[HaexHub] SecurityError - setting hash to:", hashUrl);
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("[HaexHub] replaceState called:", url, "skip:", skipNextReplace);
196
+ console.log("[HaexSpace] replaceState called:", url, "skip:", skipNextReplace);
197
197
  if (skipNextReplace) {
198
198
  skipNextReplace = false;
199
- console.log("[HaexHub] replaceState skipped");
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("[HaexHub] SecurityError - setting hash to:", hashUrl);
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("[HaexHub] History API patched");
217
+ console.log("[HaexSpace] History API patched");
218
218
  };
219
219
  if (document.readyState === "loading") {
220
220
  document.addEventListener("DOMContentLoaded", install, { once: true });
@@ -292,7 +292,7 @@ function interceptConsole(level) {
292
292
  "*"
293
293
  );
294
294
  } catch (error) {
295
- originalConsole.error("[HaexHub] Failed to forward console message:", error);
295
+ originalConsole.error("[HaexSpace] Failed to forward console message:", error);
296
296
  }
297
297
  }
298
298
  };
@@ -305,7 +305,7 @@ function installConsoleForwarding(debug = false) {
305
305
  return;
306
306
  }
307
307
  if (!debug) {
308
- console.log("[HaexHub] Console forwarding disabled (not in debug mode)");
308
+ console.log("[HaexSpace] Console forwarding disabled (not in debug mode)");
309
309
  return;
310
310
  }
311
311
  interceptConsole("log");
@@ -313,7 +313,7 @@ function installConsoleForwarding(debug = false) {
313
313
  interceptConsole("warn");
314
314
  interceptConsole("error");
315
315
  interceptConsole("debug");
316
- console.log("[HaexHub] Console forwarding installed");
316
+ console.log("[HaexSpace] Console forwarding installed");
317
317
  }
318
318
 
319
319
  // src/polyfills/index.ts
@@ -325,7 +325,7 @@ function installPolyfills() {
325
325
  installSessionStoragePolyfill();
326
326
  installCookiePolyfill();
327
327
  installHistoryPolyfill();
328
- console.log("[HaexHub] All polyfills loaded successfully");
328
+ console.log("[HaexSpace] All polyfills loaded successfully");
329
329
  installDebugDiagnostics();
330
330
  }
331
331
  if (typeof window !== "undefined") {
@@ -827,13 +827,13 @@ var HaexVaultClient = class {
827
827
  async runSetupAsync() {
828
828
  if (!this.setupHook) return;
829
829
  try {
830
- this.log("[HaexHub] Running setup hook...");
830
+ this.log("[HaexSpace] Running setup hook...");
831
831
  await this.setupHook();
832
832
  this._setupCompleted = true;
833
- this.log("[HaexHub] Setup completed successfully");
833
+ this.log("[HaexSpace] Setup completed successfully");
834
834
  this.notifySubscribers();
835
835
  } catch (error) {
836
- this.log("[HaexHub] Setup failed:", error);
836
+ this.log("[HaexSpace] Setup failed:", error);
837
837
  throw error;
838
838
  }
839
839
  }
@@ -1162,26 +1162,26 @@ var HaexVaultClient = class {
1162
1162
  this.log("Application context:", this._context);
1163
1163
  this.notifySubscribers();
1164
1164
  const { listen } = window.__TAURI__.event;
1165
- console.log("[HaexHub SDK] Setting up Tauri event listener for:", HAEXTENSION_EVENTS.CONTEXT_CHANGED);
1165
+ console.log("[HaexSpace SDK] Setting up Tauri event listener for:", HAEXTENSION_EVENTS.CONTEXT_CHANGED);
1166
1166
  try {
1167
1167
  await listen(HAEXTENSION_EVENTS.CONTEXT_CHANGED, (event) => {
1168
- console.log("[HaexHub SDK] Received Tauri event:", HAEXTENSION_EVENTS.CONTEXT_CHANGED, event);
1168
+ console.log("[HaexSpace SDK] Received Tauri event:", HAEXTENSION_EVENTS.CONTEXT_CHANGED, event);
1169
1169
  this.log("Received context change event:", event);
1170
1170
  if (event.payload?.context) {
1171
1171
  this._context = event.payload.context;
1172
- console.log("[HaexHub SDK] Updated context to:", this._context);
1172
+ console.log("[HaexSpace SDK] Updated context to:", this._context);
1173
1173
  this.handleEvent({
1174
1174
  type: HAEXTENSION_EVENTS.CONTEXT_CHANGED,
1175
1175
  data: { context: this._context },
1176
1176
  timestamp: Date.now()
1177
1177
  });
1178
1178
  } else {
1179
- console.warn("[HaexHub SDK] Event received but no context in payload:", event);
1179
+ console.warn("[HaexSpace SDK] Event received but no context in payload:", event);
1180
1180
  }
1181
1181
  });
1182
- console.log("[HaexHub SDK] Context change listener registered successfully");
1182
+ console.log("[HaexSpace SDK] Context change listener registered successfully");
1183
1183
  } catch (error) {
1184
- console.error("[HaexHub SDK] Failed to setup context change listener:", error);
1184
+ console.error("[HaexSpace SDK] Failed to setup context change listener:", error);
1185
1185
  this.log("Failed to setup context change listener:", error);
1186
1186
  }
1187
1187
  this.resolveReady();
@@ -1198,7 +1198,7 @@ var HaexVaultClient = class {
1198
1198
  window.addEventListener("message", this.messageHandler);
1199
1199
  this.isNativeWindow = false;
1200
1200
  this.initialized = true;
1201
- this.log("HaexHub SDK initialized in iframe mode");
1201
+ this.log("HaexSpace SDK initialized in iframe mode");
1202
1202
  try {
1203
1203
  if (this.config.manifest) {
1204
1204
  this._extensionInfo = {
@@ -1366,7 +1366,7 @@ postMessage error: ${e}`);
1366
1366
  }
1367
1367
  log(...args) {
1368
1368
  if (this.config.debug) {
1369
- console.log("[HaexHub SDK]", ...args);
1369
+ console.log("[HaexSpace SDK]", ...args);
1370
1370
  }
1371
1371
  }
1372
1372
  };