@elliemae/pui-app-bridge 2.28.4 → 2.28.6
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/cjs/frame.js +70 -27
- package/dist/cjs/loaders/manifest.js +2 -5
- package/dist/cjs/utils.js +28 -1
- package/dist/esm/frame.js +70 -27
- package/dist/esm/loaders/manifest.js +3 -6
- package/dist/esm/utils.js +28 -1
- package/dist/public/e2e-host.html +1 -1
- package/dist/public/e2e-index.html +1 -1
- package/dist/public/frame.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiAppBridge.57ee9e3892a5a9c5af74.js +17 -0
- package/dist/public/js/emuiAppBridge.57ee9e3892a5a9c5af74.js.br +0 -0
- package/dist/public/js/emuiAppBridge.57ee9e3892a5a9c5af74.js.gz +0 -0
- package/dist/public/js/emuiAppBridge.57ee9e3892a5a9c5af74.js.map +1 -0
- package/dist/types/lib/frame.d.ts +5 -0
- package/dist/types/lib/tests/resolveSameOriginFrameSrc.test.d.ts +1 -0
- package/dist/types/lib/typings/host.d.ts +4 -4
- package/dist/types/lib/utils.d.ts +38 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +7 -7
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js +0 -17
- package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.br +0 -0
- package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.gz +0 -0
- package/dist/public/js/emuiAppBridge.abc796d0a5604f92857c.js.map +0 -1
|
@@ -34,6 +34,11 @@ export type FrameOptions = {
|
|
|
34
34
|
* @example "microphone 'self' https://example.com; geolocation 'none'"
|
|
35
35
|
*/
|
|
36
36
|
permissionPolicy?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional signal to abort iframe creation (e.g. when the host unmounts
|
|
39
|
+
* before the iframe finishes loading).
|
|
40
|
+
*/
|
|
41
|
+
signal?: AbortSignal;
|
|
37
42
|
};
|
|
38
43
|
export declare const FRAME_APP_CONTAINER_ID_PREFIX = "pui-app-container-";
|
|
39
44
|
export declare const Frame: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -57,8 +57,8 @@ export type OpenAppParams = {
|
|
|
57
57
|
};
|
|
58
58
|
/**
|
|
59
59
|
* Interface to connect and communicate with parent host
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
60
|
+
* @template AppObjects type of the scripting objects that the application supports
|
|
61
|
+
* @template AppEvents type of the events that the application supports
|
|
62
62
|
*/
|
|
63
63
|
export interface IMicroFEHost<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> {
|
|
64
64
|
/**
|
|
@@ -78,13 +78,13 @@ export interface IMicroFEHost<AppObjects extends ScriptingObjects = Partial<Scri
|
|
|
78
78
|
setAppWindowSize(appSize: AppWindowSize): void;
|
|
79
79
|
/**
|
|
80
80
|
* add listener to the scripting object event
|
|
81
|
-
* @param
|
|
81
|
+
* @param params parameters to add event listener
|
|
82
82
|
* @returns subscription id
|
|
83
83
|
*/
|
|
84
84
|
subscribe: <EventId extends Extract<keyof AppEvents, string>>(params: SubscribeParam<EventId, AppEvents[EventId]>) => string;
|
|
85
85
|
/**
|
|
86
86
|
* removes listener from the scripting object event
|
|
87
|
-
* @param
|
|
87
|
+
* @param params parameters to remove event listener
|
|
88
88
|
*/
|
|
89
89
|
unsubscribe: <EventId extends Extract<keyof AppEvents, string>>(params: UnsubscribeParam<EventId>) => void;
|
|
90
90
|
}
|
|
@@ -2,5 +2,43 @@ export declare const removeDoubleSlash: (url: string) => string;
|
|
|
2
2
|
export declare const getAbsoluteUrl: (url: string) => string;
|
|
3
3
|
export declare const appendTrailingSlash: (url: string) => string;
|
|
4
4
|
export declare const appendPath: (base: string, path: string) => string;
|
|
5
|
+
export declare const resolveManifestBaseUrl: (hostUrl: string, manifestPath: string) => string;
|
|
6
|
+
export declare const resolveManifestUrl: (hostUrl: string, manifestPath: string) => string;
|
|
5
7
|
export declare const isJSDOM: () => boolean;
|
|
6
8
|
export declare const escapeRegExp: (str: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Rewrites a child iframe `src` so it is same-origin with the document that
|
|
11
|
+
* creates it.
|
|
12
|
+
*
|
|
13
|
+
* App Bridge must read and mutate the child iframe's `contentDocument` after
|
|
14
|
+
* load (inject `<base href>`, etc.). Browsers only expose `contentDocument`
|
|
15
|
+
* when the iframe URL shares the creator's origin.
|
|
16
|
+
*
|
|
17
|
+
* Consider a three-level stack — **grandparent → parent → child** (e.g.
|
|
18
|
+
* encw → prospects → incomplete-apps):
|
|
19
|
+
*
|
|
20
|
+
* - **Grandparent** hosts the parent inside its iframe (e.g. encw at
|
|
21
|
+
* `http://localhost:3000`).
|
|
22
|
+
* - **Parent** is a guest of the grandparent but acts as a **host** when it
|
|
23
|
+
* opens the child. Its JavaScript runs in the grandparent's iframe document
|
|
24
|
+
* (e.g. `http://localhost:3000/latest/frame.html`), not on the parent's
|
|
25
|
+
* dev-server origin (e.g. `http://localhost:4004`).
|
|
26
|
+
* - **Child** is loaded by the parent via App Bridge. The bundled default
|
|
27
|
+
* `frame.html` URL is built from the parent's build and often points at the
|
|
28
|
+
* parent's or child's dev-server origin (e.g. `:4004` or `:8080`).
|
|
29
|
+
*
|
|
30
|
+
* If the parent creates the child's iframe with that cross-origin `frame.html`
|
|
31
|
+
* URL while its own code executes on `:3000`, the browser treats the child
|
|
32
|
+
* shell as cross-origin. `Frame.create` cannot access `contentDocument` and
|
|
33
|
+
* times out after 10s.
|
|
34
|
+
*
|
|
35
|
+
* When origins differ, this helper rewrites the src to
|
|
36
|
+
* `{window.location.origin}/{version}/frame.html` — the **parent document's**
|
|
37
|
+
* origin (which, when nested, is the grandparent's iframe origin). The child's
|
|
38
|
+
* JS bundles are still fetched from the correct guest URL via `<base href>`.
|
|
39
|
+
* @param frameSrc - Raw iframe src from bundled `frame.html` or caller
|
|
40
|
+
* `frameOptions.src`.
|
|
41
|
+
* @returns The original src when already same-origin; otherwise a same-origin
|
|
42
|
+
* `frame.html` URL. On parse failure, returns `frameSrc` unchanged.
|
|
43
|
+
*/
|
|
44
|
+
export declare const resolveSameOriginFrameSrc: (frameSrc: string) => string;
|