@proveanything/smartlinks 1.3.12 → 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 +16 -14
- package/docs/API_SUMMARY.md +1 -1
- package/package.json +1 -1
package/dist/docs/API_SUMMARY.md
CHANGED
package/dist/iframeResponder.js
CHANGED
|
@@ -218,32 +218,34 @@ export class IframeResponder {
|
|
|
218
218
|
}
|
|
219
219
|
// Build URL - respect the URL format from server (hash routing or not)
|
|
220
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;
|
|
221
223
|
// If there's an initialPath, append it appropriately
|
|
222
224
|
if (this.options.initialPath) {
|
|
223
225
|
const path = this.options.initialPath;
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
//
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
url.hash = cleanHash + cleanPath;
|
|
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;
|
|
230
232
|
}
|
|
231
233
|
else {
|
|
232
|
-
//
|
|
233
|
-
const cleanPath = path.startsWith('/') ? path : '/' + path;
|
|
234
|
+
// Path routing - append to pathname
|
|
234
235
|
url.pathname = url.pathname.replace(/\/$/, '') + cleanPath;
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
|
-
// Add query params
|
|
238
|
-
if (
|
|
239
|
-
// Hash routing -
|
|
240
|
-
const hashParts = url.hash.split('?');
|
|
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];
|
|
241
243
|
const existingParams = hashParts[1] ? new URLSearchParams(hashParts[1]) : new URLSearchParams();
|
|
242
244
|
params.forEach((value, key) => existingParams.set(key, value));
|
|
243
|
-
url.hash =
|
|
245
|
+
url.hash = '#' + hashPath + '?' + existingParams.toString();
|
|
244
246
|
}
|
|
245
247
|
else {
|
|
246
|
-
//
|
|
248
|
+
// Path routing - params go in searchParams
|
|
247
249
|
params.forEach((value, key) => url.searchParams.set(key, value));
|
|
248
250
|
}
|
|
249
251
|
const finalUrl = url.toString();
|
package/docs/API_SUMMARY.md
CHANGED