@elliemae/pui-app-sdk 5.40.4 → 5.40.5

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.
Files changed (49) hide show
  1. package/demo/{8201.6a8c0542.iframe.bundle.js → 1080.92f6b67a.iframe.bundle.js} +317 -317
  2. package/demo/1080.92f6b67a.iframe.bundle.js.br +0 -0
  3. package/demo/1080.92f6b67a.iframe.bundle.js.gz +0 -0
  4. package/demo/docs/{8201.6a8c0542.iframe.bundle.js → 1080.92f6b67a.iframe.bundle.js} +317 -317
  5. package/demo/docs/1080.92f6b67a.iframe.bundle.js.br +0 -0
  6. package/demo/docs/1080.92f6b67a.iframe.bundle.js.gz +0 -0
  7. package/demo/docs/iframe.html +1 -1
  8. package/demo/docs/index.html +1 -1
  9. package/demo/docs/{main.4b26e7c4efd9fa564d80.manager.bundle.js → main.cfd2e2085f77fe383f8d.manager.bundle.js} +1 -1
  10. package/demo/docs/main.cfd2e2085f77fe383f8d.manager.bundle.js.br +0 -0
  11. package/demo/docs/{main.4b26e7c4efd9fa564d80.manager.bundle.js.gz → main.cfd2e2085f77fe383f8d.manager.bundle.js.gz} +0 -0
  12. package/demo/docs/{main.15fc50b1.iframe.bundle.js → main.f92b110f.iframe.bundle.js} +2 -2
  13. package/demo/docs/main.f92b110f.iframe.bundle.js.br +0 -0
  14. package/demo/docs/main.f92b110f.iframe.bundle.js.gz +0 -0
  15. package/demo/docs/project.json +1 -1
  16. package/demo/iframe.html +1 -1
  17. package/demo/index.html +1 -1
  18. package/demo/{main.4b26e7c4efd9fa564d80.manager.bundle.js → main.cfd2e2085f77fe383f8d.manager.bundle.js} +1 -1
  19. package/demo/main.cfd2e2085f77fe383f8d.manager.bundle.js.br +0 -0
  20. package/demo/{main.4b26e7c4efd9fa564d80.manager.bundle.js.gz → main.cfd2e2085f77fe383f8d.manager.bundle.js.gz} +0 -0
  21. package/demo/{main.15fc50b1.iframe.bundle.js → main.f92b110f.iframe.bundle.js} +2 -2
  22. package/demo/main.f92b110f.iframe.bundle.js.br +0 -0
  23. package/demo/main.f92b110f.iframe.bundle.js.gz +0 -0
  24. package/demo/project.json +1 -1
  25. package/dist/cjs/utils/micro-frontend/guest-host-context.js +47 -0
  26. package/dist/cjs/utils/micro-frontend/module-so.js +5 -1
  27. package/dist/cjs/utils/micro-frontend/tests/guest-test-utils.js +27 -0
  28. package/dist/cjs/view/guest-microapp.js +16 -4
  29. package/dist/esm/utils/micro-frontend/guest-host-context.js +27 -0
  30. package/dist/esm/utils/micro-frontend/module-so.js +5 -1
  31. package/dist/esm/utils/micro-frontend/tests/guest-test-utils.js +7 -0
  32. package/dist/esm/view/guest-microapp.js +19 -4
  33. package/dist/types/lib/utils/micro-frontend/guest-host-context.d.ts +40 -0
  34. package/dist/types/lib/utils/micro-frontend/module-so.d.ts +3 -1
  35. package/dist/types/lib/utils/micro-frontend/tests/guest-host-context.test.d.ts +1 -0
  36. package/dist/types/lib/utils/micro-frontend/tests/guest-test-utils.d.ts +2 -0
  37. package/dist/types/lib/view/guest-microapp.d.ts +4 -0
  38. package/dist/types/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +6 -6
  40. package/demo/8201.6a8c0542.iframe.bundle.js.br +0 -0
  41. package/demo/8201.6a8c0542.iframe.bundle.js.gz +0 -0
  42. package/demo/docs/8201.6a8c0542.iframe.bundle.js.br +0 -0
  43. package/demo/docs/8201.6a8c0542.iframe.bundle.js.gz +0 -0
  44. package/demo/docs/main.15fc50b1.iframe.bundle.js.br +0 -0
  45. package/demo/docs/main.15fc50b1.iframe.bundle.js.gz +0 -0
  46. package/demo/docs/main.4b26e7c4efd9fa564d80.manager.bundle.js.br +0 -0
  47. package/demo/main.15fc50b1.iframe.bundle.js.br +0 -0
  48. package/demo/main.15fc50b1.iframe.bundle.js.gz +0 -0
  49. package/demo/main.4b26e7c4efd9fa564d80.manager.bundle.js.br +0 -0
@@ -13,6 +13,10 @@ import {
13
13
  getLogger,
14
14
  getMicroFrontEndAppConfig
15
15
  } from "../utils/micro-frontend/index.js";
16
+ import {
17
+ resolveGuestOpenHistory,
18
+ resolveNestedGuestFrameOptions
19
+ } from "../utils/micro-frontend/guest-host-context.js";
16
20
  const Div = styled.div`
17
21
  display: flex;
18
22
  width: 100%;
@@ -31,13 +35,22 @@ const useAppRenderer = (props) => {
31
35
  onUnloadComplete,
32
36
  containerId,
33
37
  ssfAppOptions,
34
- disableWaitMessage = false
38
+ disableWaitMessage = false,
39
+ frameOptions: userFrameOptions
35
40
  } = props;
36
41
  const dispatch = useDispatch();
37
42
  const stableSsfAppOptions = useMemo(
38
43
  () => ssfAppOptions ?? {},
39
44
  [ssfAppOptions]
40
45
  );
46
+ const guestHistory = useMemo(
47
+ () => resolveGuestOpenHistory(history),
48
+ [history]
49
+ );
50
+ const resolvedFrameOptions = useMemo(
51
+ () => resolveNestedGuestFrameOptions(userFrameOptions),
52
+ [userFrameOptions]
53
+ );
41
54
  const getConfig = useCallback(
42
55
  () => getMicroFrontEndAppConfig({
43
56
  id
@@ -113,11 +126,12 @@ const useAppRenderer = (props) => {
113
126
  id,
114
127
  selfInitialize: configSelfInitialize,
115
128
  frameOptions: {
129
+ ...resolvedFrameOptions,
116
130
  containerId,
117
131
  queryParams: buildLogRocketQueryParams(),
118
132
  signal: abortController.signal
119
133
  },
120
- history,
134
+ history: guestHistory,
121
135
  homeRoute,
122
136
  initialRoute
123
137
  });
@@ -185,7 +199,7 @@ const useAppRenderer = (props) => {
185
199
  }, [
186
200
  containerId,
187
201
  dispatch,
188
- history,
202
+ guestHistory,
189
203
  homeRoute,
190
204
  initialRoute,
191
205
  id,
@@ -193,7 +207,8 @@ const useAppRenderer = (props) => {
193
207
  onUnloadComplete,
194
208
  getConfig,
195
209
  stableSsfAppOptions,
196
- disableWaitMessage
210
+ disableWaitMessage,
211
+ resolvedFrameOptions
197
212
  ]);
198
213
  };
199
214
  const GuestMicroApp = memo(
@@ -0,0 +1,40 @@
1
+ import type { History } from 'history';
2
+ type NestedGuestFrameOptions = {
3
+ src?: string;
4
+ };
5
+ /**
6
+ * History object to use when **opening** a child guest via {@link GuestMicroApp}.
7
+ * {@link createGuestModule} applies the same resolution for module scripting
8
+ * objects automatically.
9
+ *
10
+ * This only affects what the **host** passes into app-bridge `openApp`. The
11
+ * **child guest** still decides its final router history during
12
+ * {@link CMicroAppGuest.initialize} from **its own** `app.config.json`
13
+ * `useParentHistory` flag:
14
+ *
15
+ * - `useParentHistory: true` (default) — uses the history received from the host
16
+ * - `useParentHistory: false` — uses independent `memoryHistory` inside the
17
+ * iframe and ignores the host-provided history
18
+ *
19
+ * When this host runs inside a parent iframe and shares parent history itself
20
+ * (`useParentHistory: true`, the default), the exported `browserHistory`
21
+ * singleton tracks the iframe shell URL (e.g. `/latest/frame.html`), not the
22
+ * shared grandparent route (e.g. `/prospects/incomplete-apps`). In that case
23
+ * the history bound during {@link CMicroAppGuest.initialize} is returned
24
+ * automatically so shared-history children receive the correct object.
25
+ *
26
+ * Hosts with `useParentHistory: false` are unchanged: callers keep passing
27
+ * `explicitHistory ?? browserHistory`, and guests that want their own URL space
28
+ * opt out via their own config.
29
+ * @param explicitHistory
30
+ */
31
+ export declare const resolveGuestOpenHistory: (explicitHistory?: History) => History;
32
+ /**
33
+ * Frame options for nested hosts whose bundled frame.html URL targets the
34
+ * guest dev-server origin while JS executes in the parent iframe document.
35
+ * App Bridge rewrites cross-origin frame shells; this supplies an explicit
36
+ * same-origin src when callers pass custom frameOptions.
37
+ * @param userFrameOptions
38
+ */
39
+ export declare const resolveNestedGuestFrameOptions: (userFrameOptions?: NestedGuestFrameOptions) => NestedGuestFrameOptions | undefined;
40
+ export {};
@@ -73,7 +73,9 @@ export type ModuleOverrides = {
73
73
  *
74
74
  * Internally calls {@link buildModuleParams} to merge the app config
75
75
  * values (hostUrl, manifestPath, homeRoute) with host-provided values
76
- * (theme, history, initialRoute).
76
+ * (theme, history, initialRoute). When nested under a parent iframe,
77
+ * {@link resolveGuestOpenHistory} is applied to `params.history` automatically
78
+ * (same behavior as {@link GuestMicroApp}).
77
79
  *
78
80
  * Register the returned object via {@link CMicroApp.addScriptingObject}
79
81
  * (not directly on the app bridge) so it is added to both the App Bridge
@@ -0,0 +1,2 @@
1
+ /** Clears the guest singleton between tests. */
2
+ export declare const resetCMicroAppGuestInstance: () => void;
@@ -37,6 +37,10 @@ export type GuestMicroAppParams = OpenAppParams & {
37
37
  * this component, and remove it on teardown. Host-provided `theme` and
38
38
  * `history` for self-initializing guests belong on that module SO — not on
39
39
  * {@link GuestMicroApp} / {@link OpenAppParams}.
40
+ *
41
+ * When this app is itself a nested guest (running inside a parent iframe),
42
+ * {@link GuestMicroApp} automatically forwards the shared grandparent history
43
+ * to child guests — callers do not need to pass `history` explicitly.
40
44
  * @param props - The props for the MicroApp component.
41
45
  */
42
46
  export declare const GuestMicroApp: import("react").NamedExoticComponent<Omit<GuestMicroAppParams, "containerId">>;