@elliemae/pui-app-bridge 2.28.5 → 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.
@@ -6,3 +6,39 @@ export declare const resolveManifestBaseUrl: (hostUrl: string, manifestPath: str
6
6
  export declare const resolveManifestUrl: (hostUrl: string, manifestPath: string) => string;
7
7
  export declare const isJSDOM: () => boolean;
8
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;