@trackunit/iris-app-runtime-core 1.15.33 → 1.16.2

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/index.cjs.js CHANGED
@@ -524,14 +524,27 @@ const RestRuntime = {
524
524
  },
525
525
  };
526
526
 
527
+ /**
528
+ * Resolves the router base path from the page's `<base>` element and the
529
+ * iris app `module` global.
530
+ *
531
+ * `module` is read off `globalThis` rather than bare `global`, since
532
+ * iris-app/Cypress/browser bundles do not have the Node `global` symbol unless
533
+ * something polyfills `window.global = window`.
534
+ */
535
+ const getRouterBasePath = () => {
536
+ const baseHref = document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>";
537
+ const moduleName = Reflect.get(globalThis, "module");
538
+ const moduleSegment = typeof moduleName === "string" ? moduleName : String(moduleName);
539
+ return `${baseHref}${moduleSegment}`;
540
+ };
541
+
527
542
  /**
528
543
  * Router Runtime API accessor.
529
544
  * This API is used to get the base path of the router.
530
545
  */
531
546
  const RouterRuntime = {
532
- getBasePath: () => {
533
- return `${document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>"}${global.module}`;
534
- },
547
+ getBasePath: getRouterBasePath,
535
548
  };
536
549
 
537
550
  const SiteRuntime = {
package/index.esm.js CHANGED
@@ -522,14 +522,27 @@ const RestRuntime = {
522
522
  },
523
523
  };
524
524
 
525
+ /**
526
+ * Resolves the router base path from the page's `<base>` element and the
527
+ * iris app `module` global.
528
+ *
529
+ * `module` is read off `globalThis` rather than bare `global`, since
530
+ * iris-app/Cypress/browser bundles do not have the Node `global` symbol unless
531
+ * something polyfills `window.global = window`.
532
+ */
533
+ const getRouterBasePath = () => {
534
+ const baseHref = document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>";
535
+ const moduleName = Reflect.get(globalThis, "module");
536
+ const moduleSegment = typeof moduleName === "string" ? moduleName : String(moduleName);
537
+ return `${baseHref}${moduleSegment}`;
538
+ };
539
+
525
540
  /**
526
541
  * Router Runtime API accessor.
527
542
  * This API is used to get the base path of the router.
528
543
  */
529
544
  const RouterRuntime = {
530
- getBasePath: () => {
531
- return `${document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>"}${global.module}`;
532
- },
545
+ getBasePath: getRouterBasePath,
533
546
  };
534
547
 
535
548
  const SiteRuntime = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "1.15.33",
3
+ "version": "1.16.2",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "penpal": "^6.2.2",
11
- "@trackunit/iris-app-runtime-core-api": "1.14.33"
11
+ "@trackunit/iris-app-runtime-core-api": "1.15.1"
12
12
  },
13
13
  "module": "./index.esm.js",
14
14
  "main": "./index.cjs.js",
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves the router base path from the page's `<base>` element and the
3
+ * iris app `module` global.
4
+ *
5
+ * `module` is read off `globalThis` rather than bare `global`, since
6
+ * iris-app/Cypress/browser bundles do not have the Node `global` symbol unless
7
+ * something polyfills `window.global = window`.
8
+ */
9
+ export declare const getRouterBasePath: () => string;