@proveanything/smartlinks 1.3.11 → 1.3.13

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.13 | Generated: 2026-02-06T10:11:24.240Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -216,20 +216,39 @@ 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
+ // Determine if this is a hash-routed app by checking if URL has a hash
222
+ const isHashRouted = url.hash.length > 0;
223
+ // If there's an initialPath, append it appropriately
224
+ if (this.options.initialPath) {
225
+ const path = this.options.initialPath;
226
+ const cleanPath = path.startsWith('/') ? path : '/' + path;
227
+ if (isHashRouted) {
228
+ // Hash routing - append to hash
229
+ const currentHash = url.hash.slice(1); // Remove leading #
230
+ const cleanHash = currentHash.replace(/\/$/, '');
231
+ url.hash = '#' + cleanHash + cleanPath;
232
+ }
233
+ else {
234
+ // Path routing - append to pathname
235
+ url.pathname = url.pathname.replace(/\/$/, '') + cleanPath;
236
+ }
223
237
  }
224
- // Build hash path
225
- let hashPath = this.options.initialPath || '';
226
- if (hashPath && !hashPath.startsWith('/')) {
227
- hashPath = '/' + hashPath;
238
+ // Add query params
239
+ if (isHashRouted) {
240
+ // Hash routing - params go in the hash after ?
241
+ const hashParts = url.hash.slice(1).split('?'); // Remove # and split
242
+ const hashPath = hashParts[0];
243
+ const existingParams = hashParts[1] ? new URLSearchParams(hashParts[1]) : new URLSearchParams();
244
+ params.forEach((value, key) => existingParams.set(key, value));
245
+ url.hash = '#' + hashPath + '?' + existingParams.toString();
228
246
  }
229
- if (hashPath === '/') {
230
- hashPath = '';
247
+ else {
248
+ // Path routing - params go in searchParams
249
+ params.forEach((value, key) => url.searchParams.set(key, value));
231
250
  }
232
- const finalUrl = `${base}/#/${hashPath}?${params.toString()}`.replace('/#//', '/#/');
251
+ const finalUrl = url.toString();
233
252
  console.log('[IframeResponder] Final iframe URL:', finalUrl);
234
253
  return finalUrl;
235
254
  }
@@ -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.13 | Generated: 2026-02-06T10:11:24.240Z
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.13",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",