@proveanything/smartlinks 1.3.11 → 1.3.12

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.11 | Generated: 2026-02-05T21:31:10.698Z
3
+ Version: 1.3.12 | Generated: 2026-02-06T10:04:42.892Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -216,20 +216,37 @@ export class IframeResponder {
216
216
  // Ignore encoding errors
217
217
  }
218
218
  }
219
- // Build URL
220
- let base = this.appUrl.replace(/#\/?$/, '');
221
- if (base.endsWith('/')) {
222
- base = base.slice(0, -1);
219
+ // Build URL - respect the URL format from server (hash routing or not)
220
+ const url = new URL(this.appUrl);
221
+ // If there's an initialPath, append it appropriately
222
+ if (this.options.initialPath) {
223
+ const path = this.options.initialPath;
224
+ // If URL has hash, append to hash (for hash-routed apps)
225
+ if (url.hash) {
226
+ // Remove trailing slash from hash, add path
227
+ const cleanHash = url.hash.replace(/\/$/, '');
228
+ const cleanPath = path.startsWith('/') ? path : '/' + path;
229
+ url.hash = cleanHash + cleanPath;
230
+ }
231
+ else {
232
+ // No hash, append to pathname (for path-routed apps)
233
+ const cleanPath = path.startsWith('/') ? path : '/' + path;
234
+ url.pathname = url.pathname.replace(/\/$/, '') + cleanPath;
235
+ }
223
236
  }
224
- // Build hash path
225
- let hashPath = this.options.initialPath || '';
226
- if (hashPath && !hashPath.startsWith('/')) {
227
- hashPath = '/' + hashPath;
237
+ // Add query params (to hash if present, otherwise to search)
238
+ if (url.hash && url.hash.includes('#')) {
239
+ // Hash routing - add params after hash
240
+ const hashParts = url.hash.split('?');
241
+ const existingParams = hashParts[1] ? new URLSearchParams(hashParts[1]) : new URLSearchParams();
242
+ params.forEach((value, key) => existingParams.set(key, value));
243
+ url.hash = hashParts[0] + '?' + existingParams.toString();
228
244
  }
229
- if (hashPath === '/') {
230
- hashPath = '';
245
+ else {
246
+ // Regular routing - add params to search
247
+ params.forEach((value, key) => url.searchParams.set(key, value));
231
248
  }
232
- const finalUrl = `${base}/#/${hashPath}?${params.toString()}`.replace('/#//', '/#/');
249
+ const finalUrl = url.toString();
233
250
  console.log('[IframeResponder] Final iframe URL:', finalUrl);
234
251
  return finalUrl;
235
252
  }
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.3.11 | Generated: 2026-02-05T21:31:10.698Z
3
+ Version: 1.3.12 | Generated: 2026-02-06T10:04:42.892Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.3.11",
3
+ "version": "1.3.12",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",