@flipdish/portal-library 5.5.0 → 5.6.0
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.
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";exports.routeToPortalUrlFromMFE=t=>{if("undefined"!=typeof window&&window.history?.pushState)try{const o=new URL(t,window.location.href);if(!(o.origin===window.location.origin))return void window.location.assign(o.toString());window.history.pushState({},"",o.toString());const i=window.history.state;window.dispatchEvent(new PopStateEvent("popstate",{state:i}))}catch{window.location.assign(t)}};
|
|
2
|
+
//# sourceMappingURL=routingUtilities.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routingUtilities.cjs.js","sources":["../../src/utilities/routingUtilities.ts"],"sourcesContent":[" interface HistoryState {\n // state is typed as any in the window object\n [key: string]: unknown;\n }\n\n /**\n * Route to a Portal URL from an MFE without full reload when same‑origin.\n * - Same‑origin: pushState + dispatch a matching popstate event.\n * - Cross‑origin: hard‑navigate via window.location.assign (browser restriction).\n * - No‑op in SSR/non‑browser environments.\n */\n export const routeToPortalUrlFromMFE = (portalUrl: string): void => {\n if (typeof window === 'undefined' || !window.history?.pushState) return;\n try {\n const target = new URL(portalUrl, window.location.href);\n const sameOrigin = target.origin === window.location.origin;\n if (!sameOrigin) {\n window.location.assign(target.toString());\n return;\n }\n window.history.pushState({}, '', target.toString());\n const state = window.history.state as HistoryState;\n window.dispatchEvent(new PopStateEvent('popstate', { state }));\n } catch {\n // Fallback if URL parsing fails\n window.location.assign(portalUrl);\n }\n};"],"names":["portalUrl","window","history","pushState","target","URL","location","href","origin","assign","toString","state","dispatchEvent","PopStateEvent"],"mappings":"6CAW0CA,IACtC,GAAsB,oBAAXC,QAA2BA,OAAOC,SAASC,UACtD,IACA,MAAMC,EAAS,IAAIC,IAAIL,EAAWC,OAAOK,SAASC,MAElD,KADmBH,EAAOI,SAAWP,OAAOK,SAASE,QAGnD,YADAP,OAAOK,SAASG,OAAOL,EAAOM,YAGhCT,OAAOC,QAAQC,UAAU,CAAA,EAAI,GAAIC,EAAOM,YACxC,MAAMC,EAAQV,OAAOC,QAAQS,MAC7BV,OAAOW,cAAc,IAAIC,cAAc,WAAY,CAAEF,UACvD,CAAE,MAEAV,OAAOK,SAASG,OAAOT,EACzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route to a Portal URL from an MFE without full reload when same‑origin.
|
|
3
|
+
* - Same‑origin: pushState + dispatch a matching popstate event.
|
|
4
|
+
* - Cross‑origin: hard‑navigate via window.location.assign (browser restriction).
|
|
5
|
+
* - No‑op in SSR/non‑browser environments.
|
|
6
|
+
*/
|
|
7
|
+
declare const routeToPortalUrlFromMFE: (portalUrl: string) => void;
|
|
8
|
+
|
|
9
|
+
export { routeToPortalUrlFromMFE };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const t=t=>{if("undefined"!=typeof window&&window.history?.pushState)try{const o=new URL(t,window.location.href);if(!(o.origin===window.location.origin))return void window.location.assign(o.toString());window.history.pushState({},"",o.toString());const i=window.history.state;window.dispatchEvent(new PopStateEvent("popstate",{state:i}))}catch{window.location.assign(t)}};export{t as routeToPortalUrlFromMFE};
|
|
2
|
+
//# sourceMappingURL=routingUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routingUtilities.js","sources":["../../src/utilities/routingUtilities.ts"],"sourcesContent":[" interface HistoryState {\n // state is typed as any in the window object\n [key: string]: unknown;\n }\n\n /**\n * Route to a Portal URL from an MFE without full reload when same‑origin.\n * - Same‑origin: pushState + dispatch a matching popstate event.\n * - Cross‑origin: hard‑navigate via window.location.assign (browser restriction).\n * - No‑op in SSR/non‑browser environments.\n */\n export const routeToPortalUrlFromMFE = (portalUrl: string): void => {\n if (typeof window === 'undefined' || !window.history?.pushState) return;\n try {\n const target = new URL(portalUrl, window.location.href);\n const sameOrigin = target.origin === window.location.origin;\n if (!sameOrigin) {\n window.location.assign(target.toString());\n return;\n }\n window.history.pushState({}, '', target.toString());\n const state = window.history.state as HistoryState;\n window.dispatchEvent(new PopStateEvent('popstate', { state }));\n } catch {\n // Fallback if URL parsing fails\n window.location.assign(portalUrl);\n }\n};"],"names":["routeToPortalUrlFromMFE","portalUrl","window","history","pushState","target","URL","location","href","origin","assign","toString","state","dispatchEvent","PopStateEvent"],"mappings":"AAWS,MAAMA,EAA2BC,IACtC,GAAsB,oBAAXC,QAA2BA,OAAOC,SAASC,UACtD,IACA,MAAMC,EAAS,IAAIC,IAAIL,EAAWC,OAAOK,SAASC,MAElD,KADmBH,EAAOI,SAAWP,OAAOK,SAASE,QAGnD,YADAP,OAAOK,SAASG,OAAOL,EAAOM,YAGhCT,OAAOC,QAAQC,UAAU,CAAA,EAAI,GAAIC,EAAOM,YACxC,MAAMC,EAAQV,OAAOC,QAAQS,MAC7BV,OAAOW,cAAc,IAAIC,cAAc,WAAY,CAAEF,UACvD,CAAE,MAEAV,OAAOK,SAASG,OAAOT,EACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flipdish/portal-library",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"eslint-plugin-prettier": "^5.1.3",
|
|
102
102
|
"eslint-plugin-react": "^7.37.4",
|
|
103
103
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
104
|
-
"eslint-plugin-react-refresh": "0.4.
|
|
104
|
+
"eslint-plugin-react-refresh": "0.4.22",
|
|
105
105
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
106
106
|
"eslint-plugin-storybook": "^0.12.0",
|
|
107
107
|
"eslint-plugin-testing-library": "^7.1.1",
|