@elliemae/ssf-host 2.25.4 → 2.25.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.
@@ -1,7 +1,7 @@
1
1
  import type { IScriptingObjectProxy, ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
2
2
  import type { EventListeners, AddScriptingObjectParams, GetObjectParams, DispatchEventParam, EventOptions } from '@elliemae/microfe-common';
3
3
  import { LogLevels } from '@elliemae/pui-diagnostics';
4
- import { IFrameSandboxValues, ValueOf, ScriptingObjects, UnloadOptions } from './types.js';
4
+ import { IFrameSandboxValues, ValueOf, ScriptingObjects } from './types.js';
5
5
  import { ISSFHost, HostOption, LoadGuestParam, LoadGuestsParam, GuestCloseParam } from './ihost.js';
6
6
  import { Guest } from './guest.js';
7
7
  export declare const SANDBOX_DEFAULT: IFrameSandboxValues[];
@@ -85,106 +85,10 @@ export declare class SSFHost<AppObjects extends ScriptingObjects = ScriptingObje
85
85
  */
86
86
  setLogLevel: (level: LogLevels) => void;
87
87
  /**
88
- * Unloads guest application from host with optional enhanced cleanup.
89
- *
90
- * **Basic Mode (no options):**
91
- * - Standard guest disposal
92
- * - Removes from tracking maps
93
- *
94
- * **Enhanced Mode (with options):**
95
- * - `purgeOnDestroy: true` - Uses comprehensive cleanup via `unloadGuestWithFullCleanup`
96
- * - Calls guest cleanup function (React unmount, Redux teardown)
97
- * - Closes contentWindow context
98
- * - Navigates iframe to about:blank
99
- * - Removes iframe from DOM (deferred)
100
- * - Clears all window.emui and window.elli.script references
101
- * - Disconnects FieldMutation observers
102
- * - Removes from SSF tracking
103
- *
104
- * - `windowRefsToClear` - Array of paths to window refs to clear recursively
105
- * - Example: ["window.IMT.focusFormTitle", "window.emui.customApp"]
106
- * - Each path is parsed and set to null
107
- *
108
- * - `appId` - Optional appId for targeted window.emui[appId] cleanup
109
- *
110
- * - `cleanupFunctionName` - Name of cleanup function on window.emui (default: 'unmount')
111
- * @param {string | Window | HTMLIFrameElement} guestIdOrWindowOrEle - Unique id, window object, or iframe element
112
- * @param {object} options - Optional cleanup configuration
113
- * @param {boolean} options.purgeOnDestroy - When true, use comprehensive cleanup sequence
114
- * @param {string[]} options.windowRefsToClear - Array of window ref paths to clear
115
- * @param {string} options.appId - Optional appId for targeted cleanup
116
- * @param {string} options.cleanupFunctionName - Guest cleanup function name (default: 'unmount')
117
- * @example
118
- * // Basic cleanup
119
- * host.unloadGuest('my-guest-id');
120
- * @example
121
- * // Enhanced cleanup with purge
122
- * host.unloadGuest('my-guest-id', {
123
- * purgeOnDestroy: true,
124
- * windowRefsToClear: ["window.IMT.focusFormTitle"],
125
- * cleanupFunctionName: 'appCleanup'
126
- * });
127
- * @example
128
- * // Enhanced cleanup with appId
129
- * host.unloadGuest('my-guest-id', {
130
- * purgeOnDestroy: true,
131
- * appId: 'workflowtasks',
132
- * cleanupFunctionName: 'cleanup'
133
- * });
134
- */
135
- unloadGuest: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement, options?: UnloadOptions) => void;
136
- /**
137
- * Unloads guest application with comprehensive memory leak prevention.
138
- *
139
- * This method implements industry best practices for iframe and popup cleanup to prevent
140
- * memory leaks, particularly detached window retention and webpack bundle accumulation.
141
- *
142
- * **Enhanced Cleanup Sequence for Embedded Iframes:**
143
- * 1. Call guest cleanup function (React unmount, Redux teardown, etc.)
144
- * 2. Close contentWindow context explicitly
145
- * 3. Navigate iframe to about:blank (Chrome GC recommendation)
146
- * 4. Small delay, then remove iframe from DOM
147
- * 5. Remove from SSF tracking maps
148
- * 6. Null all internal references
149
- *
150
- * **Enhanced Cleanup Sequence for Popup Windows:**
151
- * 1. Call guest cleanup function (React unmount, Redux teardown, etc.)
152
- * 2. Null all window.emui and window.elli.script references
153
- * 3. Clear Google Tag Manager data layer
154
- * 4. Close popup window explicitly
155
- * 5. Dispose guest (cleanup event listeners)
156
- * 6. Remove from SSF tracking maps
157
- *
158
- * **Memory Leak Prevention:**
159
- * - Breaks all closures from contentWindow/popup to parent
160
- * - Signals V8 to GC webpack bundle backing store strings
161
- * - Removes iframe from browser back/forward cache
162
- * - Clears all SSF remoting message handlers
163
- * - Nulls all window.emui and window.elli.script properties
164
- *
165
- * **Important:** This method does NOT clean up window.emui[appId] registry.
166
- * When using selfInitialize=true pattern, the guest application handles
167
- * its own emui registry cleanup internally.
168
- *
169
- * **Synchronous Design:** This method is intentionally synchronous to work
170
- * with React useEffect cleanup functions. Cleanup steps use setTimeout
171
- * for deferred operations rather than async/await.
172
- * @param {string | Window | HTMLIFrameElement} guestIdOrWindowOrEle - unique id of the guest application or window object or dom element
173
- * @param {string} cleanupFunctionName - name of cleanup function on window.emui (default: 'unmount')
174
- * @example
175
- * // Standard usage with app cleanup
176
- * host.unloadGuestWithFullCleanup('my-guest-id', 'appCleanup');
177
- * @example
178
- * // Usage with custom cleanup function
179
- * host.unloadGuestWithFullCleanup('my-guest-id', 'customUnmount');
180
- * @example
181
- * // Usage when guest uses default unmount
182
- * host.unloadGuestWithFullCleanup('my-guest-id');
183
- */
184
- unloadGuestWithFullCleanup: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement, cleanupFunctionName?: string) => void;
185
- /**
186
- * monitors guest window close action and executes the callback from host.
187
- * @param param - Guest close parameters including id and callback
88
+ * unloads guest application from host
89
+ * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application
90
+ * @throws Error if guestId or Window reference is invalid
188
91
  */
92
+ unloadGuest: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => Promise<void>;
189
93
  onGuestClose: (param: GuestCloseParam) => void;
190
94
  }
@@ -235,21 +235,6 @@ export interface ISSFHost<AppObjects extends ScriptingObjects = ScriptingObjectT
235
235
  * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application
236
236
  * @throws Error if guestId or Window reference is invalid
237
237
  */
238
- unloadGuest: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => void;
239
- /**
240
- * Unloads guest application with comprehensive memory leak prevention.
241
- *
242
- * This method implements industry best practices for iframe cleanup to prevent
243
- * memory leaks, particularly detached window retention and webpack bundle accumulation.
244
- *
245
- * **Enhanced for selfInitialize=true pattern:** Does not clean window.emui[appId]
246
- * registry as the guest handles its own cleanup internally.
247
- *
248
- * **Synchronous by design:** Works with React useEffect cleanup functions.
249
- * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element
250
- * @param cleanupFunctionName name of cleanup function on window.emui (default: 'unmount')
251
- * @throws Error if guestId or Window reference is invalid
252
- */
253
- unloadGuestWithFullCleanup: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement, cleanupFunctionName?: string) => void;
238
+ unloadGuest: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => void | Promise<void>;
254
239
  onGuestClose: (param: GuestCloseParam) => void;
255
240
  }
@@ -13,6 +13,15 @@ export declare const postMessage: ({ srcWindow, targetWindow, message, }: {
13
13
  }) => void;
14
14
  export declare const initGuest: (guestId: string, capabilities?: Record<string, unknown>) => Window;
15
15
  export declare const releaseJSThread: () => Promise<unknown>;
16
+ type UnloadGuestHost = {
17
+ unloadGuest: (guestId: string | Window | HTMLIFrameElement) => Promise<void>;
18
+ };
19
+ /**
20
+ * Fire-and-forget guest unload for test cleanup (avoids floating-promise lint).
21
+ * @param host
22
+ * @param guestId
23
+ */
24
+ export declare const unloadGuestSilently: (host: UnloadGuestHost | null | undefined, guestId: string | Window | HTMLIFrameElement) => void;
16
25
  export type Data = {
17
26
  data: {
18
27
  type: string;
@@ -26,3 +35,4 @@ export type Data = {
26
35
  };
27
36
  };
28
37
  };
38
+ export {};