@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.
- package/dist/docs/API_SUMMARY.md +1 -1
- package/dist/iframeResponder.js +30 -11
- package/docs/API_SUMMARY.md +1 -1
- package/package.json +1 -1
package/dist/docs/API_SUMMARY.md
CHANGED
package/dist/iframeResponder.js
CHANGED
|
@@ -216,20 +216,39 @@ export class IframeResponder {
|
|
|
216
216
|
// Ignore encoding errors
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
// Build URL
|
|
220
|
-
|
|
221
|
-
if
|
|
222
|
-
|
|
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
|
-
//
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
230
|
-
|
|
247
|
+
else {
|
|
248
|
+
// Path routing - params go in searchParams
|
|
249
|
+
params.forEach((value, key) => url.searchParams.set(key, value));
|
|
231
250
|
}
|
|
232
|
-
const finalUrl =
|
|
251
|
+
const finalUrl = url.toString();
|
|
233
252
|
console.log('[IframeResponder] Final iframe URL:', finalUrl);
|
|
234
253
|
return finalUrl;
|
|
235
254
|
}
|
package/docs/API_SUMMARY.md
CHANGED