@elliemae/pui-app-sdk 5.43.0 → 5.44.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.
Files changed (198) hide show
  1. package/build/docs/404.html +1 -1
  2. package/build/docs/api/classes/Analytics/index.html +1 -1
  3. package/build/docs/api/classes/CMicroAppGuest/index.html +1 -1
  4. package/build/docs/api/classes/CMicroAppHost/index.html +1 -1
  5. package/build/docs/api/classes/ErrorBoundary/index.html +1 -1
  6. package/build/docs/api/classes/GuestModule/index.html +1 -1
  7. package/build/docs/api/functions/AppRoot/index.html +1 -1
  8. package/build/docs/api/functions/Autocomplete/index.html +1 -1
  9. package/build/docs/api/functions/CheckBox/index.html +1 -1
  10. package/build/docs/api/functions/ComboBox/index.html +1 -1
  11. package/build/docs/api/functions/ComboBoxV3/index.html +1 -1
  12. package/build/docs/api/functions/ConnectForm/index.html +1 -1
  13. package/build/docs/api/functions/DateInput/index.html +1 -1
  14. package/build/docs/api/functions/DatePicker/index.html +1 -1
  15. package/build/docs/api/functions/DateRangePicker/index.html +1 -1
  16. package/build/docs/api/functions/DateTimePicker/index.html +1 -1
  17. package/build/docs/api/functions/Form/index.html +1 -1
  18. package/build/docs/api/functions/FormItemLayout/index.html +1 -1
  19. package/build/docs/api/functions/FormLayoutBlockItem/index.html +1 -1
  20. package/build/docs/api/functions/FormSubmitButton/index.html +1 -1
  21. package/build/docs/api/functions/InputMask/index.html +1 -1
  22. package/build/docs/api/functions/InputText/index.html +1 -1
  23. package/build/docs/api/functions/LargeTextBox/index.html +1 -1
  24. package/build/docs/api/functions/MaskedInputText/index.html +1 -1
  25. package/build/docs/api/functions/Page/index.html +1 -1
  26. package/build/docs/api/functions/Radio/index.html +1 -1
  27. package/build/docs/api/functions/RadioGroup/index.html +1 -1
  28. package/build/docs/api/functions/RegisterService/index.html +1 -1
  29. package/build/docs/api/functions/RenderWithStateAddOns/index.html +1 -1
  30. package/build/docs/api/functions/RequireAuth/index.html +1 -1
  31. package/build/docs/api/functions/SessionTimeout/index.html +1 -1
  32. package/build/docs/api/functions/TextBox/index.html +1 -1
  33. package/build/docs/api/functions/Toggle/index.html +1 -1
  34. package/build/docs/api/functions/authSaga/index.html +1 -1
  35. package/build/docs/api/functions/authorize/index.html +1 -1
  36. package/build/docs/api/functions/buildModuleParams/index.html +1 -1
  37. package/build/docs/api/functions/cleanup/index.html +1 -1
  38. package/build/docs/api/functions/configureStore/index.html +1 -1
  39. package/build/docs/api/functions/createGuestModule/index.html +1 -1
  40. package/build/docs/api/functions/createManager/index.html +1 -1
  41. package/build/docs/api/functions/enableReactAppForHostIntegration/index.html +1 -1
  42. package/build/docs/api/functions/fetchHostAppData/index.html +1 -1
  43. package/build/docs/api/functions/fetchUserSettings/index.html +1 -1
  44. package/build/docs/api/functions/getApiActionCreator/index.html +1 -1
  45. package/build/docs/api/functions/getAppConfig/index.html +1 -1
  46. package/build/docs/api/functions/getAppConfigValue/index.html +1 -1
  47. package/build/docs/api/functions/getAuthHTTPClient/index.html +1 -1
  48. package/build/docs/api/functions/getAuthorizationHeader/index.html +1 -1
  49. package/build/docs/api/functions/getHTTPClient/index.html +1 -1
  50. package/build/docs/api/functions/getHostAppDataByKey/index.html +1 -1
  51. package/build/docs/api/functions/getLogger/index.html +1 -1
  52. package/build/docs/api/functions/getMicroFrontEndAppConfig/index.html +1 -1
  53. package/build/docs/api/functions/getNavigationLinks/index.html +1 -1
  54. package/build/docs/api/functions/getRedirectUrl/index.html +1 -1
  55. package/build/docs/api/functions/getSelectField/index.html +1 -1
  56. package/build/docs/api/functions/getStore/index.html +1 -1
  57. package/build/docs/api/functions/initServiceWorker/index.html +1 -1
  58. package/build/docs/api/functions/isCIBuild/index.html +1 -1
  59. package/build/docs/api/functions/isProd/index.html +1 -1
  60. package/build/docs/api/functions/isUserAuthorized/index.html +1 -1
  61. package/build/docs/api/functions/listenStorageEvents/index.html +1 -1
  62. package/build/docs/api/functions/loadAppConfig/index.html +1 -1
  63. package/build/docs/api/functions/loadable/index.html +1 -1
  64. package/build/docs/api/functions/login/index.html +1 -1
  65. package/build/docs/api/functions/notifyGuestUnloadComplete/index.html +1 -1
  66. package/build/docs/api/functions/onAuthorizationFailure/index.html +1 -1
  67. package/build/docs/api/functions/onGuestUnloadStart/index.html +1 -1
  68. package/build/docs/api/functions/redactPii/index.html +1 -1
  69. package/build/docs/api/functions/removeDoubleSlash/index.html +1 -1
  70. package/build/docs/api/functions/removeStorageEvents/index.html +1 -1
  71. package/build/docs/api/functions/render/index.html +1 -1
  72. package/build/docs/api/functions/renderHook/index.html +1 -1
  73. package/build/docs/api/functions/renderWithHostData/index.html +1 -1
  74. package/build/docs/api/functions/renderWithRedux/index.html +1 -1
  75. package/build/docs/api/functions/renderWithRouter/index.html +1 -1
  76. package/build/docs/api/functions/renderWithRouterRedux/index.html +1 -1
  77. package/build/docs/api/functions/sdkBaseQuery/index.html +1 -1
  78. package/build/docs/api/functions/sendBAEvent/index.html +1 -1
  79. package/build/docs/api/functions/sendMessageToHost/index.html +1 -1
  80. package/build/docs/api/functions/setAppConfig/index.html +1 -1
  81. package/build/docs/api/functions/setAppConfigValue/index.html +1 -1
  82. package/build/docs/api/functions/setHostAppData/index.html +1 -1
  83. package/build/docs/api/functions/setLoginParams/index.html +1 -1
  84. package/build/docs/api/functions/subscribeToResetSession/index.html +1 -1
  85. package/build/docs/api/functions/subscribeToSessionExpiry/index.html +1 -1
  86. package/build/docs/api/functions/subscribeToSessionExpiryWarning/index.html +1 -1
  87. package/build/docs/api/functions/trackActivity/index.html +1 -1
  88. package/build/docs/api/functions/useAppDispatch/index.html +1 -1
  89. package/build/docs/api/functions/useAppMiddleware/index.html +1 -1
  90. package/build/docs/api/functions/useInjectQuery/index.html +1 -1
  91. package/build/docs/api/functions/useInjectReducer/index.html +1 -1
  92. package/build/docs/api/functions/useInjectSaga/index.html +1 -1
  93. package/build/docs/api/functions/useInjectSideEffect/index.html +1 -1
  94. package/build/docs/api/functions/useMediaQueryList/index.html +1 -1
  95. package/build/docs/api/functions/useStateSelector/index.html +1 -1
  96. package/build/docs/api/functions/useStateSelectorShallow/index.html +1 -1
  97. package/build/docs/api/functions/waitFor/index.html +1 -1
  98. package/build/docs/api/functions/waitForElementToBeRemoved/index.html +1 -1
  99. package/build/docs/api/functions/withAppDecorator/index.html +1 -1
  100. package/build/docs/api/index.html +1 -1
  101. package/build/docs/api/interfaces/AppConfig/index.html +1 -1
  102. package/build/docs/api/interfaces/GuestProps/index.html +1 -1
  103. package/build/docs/api/interfaces/UseStateSelectorOptions/index.html +1 -1
  104. package/build/docs/api/type-aliases/AppDispatch/index.html +1 -1
  105. package/build/docs/api/type-aliases/AppStore/index.html +1 -1
  106. package/build/docs/api/type-aliases/Await/index.html +1 -1
  107. package/build/docs/api/type-aliases/EMUI/index.html +1 -1
  108. package/build/docs/api/type-aliases/HostOptions/index.html +1 -1
  109. package/build/docs/api/type-aliases/HostProvidedParams/index.html +1 -1
  110. package/build/docs/api/type-aliases/ModuleOverrides/index.html +1 -1
  111. package/build/docs/api/type-aliases/OnHostInitCallback/index.html +1 -1
  112. package/build/docs/api/type-aliases/OnInitCallback/index.html +1 -1
  113. package/build/docs/api/type-aliases/OnMountCallback/index.html +1 -1
  114. package/build/docs/api/type-aliases/OnUnMountCallback/index.html +1 -1
  115. package/build/docs/api/type-aliases/RootState/index.html +1 -1
  116. package/build/docs/api/type-aliases/SelectStateFieldFunction/index.html +1 -1
  117. package/build/docs/api/variables/ErrorToast/index.html +1 -1
  118. package/build/docs/api/variables/FormPropsContext/index.html +1 -1
  119. package/build/docs/api/variables/GuestMicroApp/index.html +1 -1
  120. package/build/docs/api/variables/MASK_PIPES/index.html +1 -1
  121. package/build/docs/api/variables/MASK_TYPES/index.html +1 -1
  122. package/build/docs/api/variables/MicroApp/index.html +1 -1
  123. package/build/docs/api/variables/MicroIFrameApp/index.html +1 -1
  124. package/build/docs/api/variables/NavigationPrompt/index.html +1 -1
  125. package/build/docs/api/variables/NavigationPromptActions/index.html +1 -1
  126. package/build/docs/api/variables/Themes/index.html +1 -1
  127. package/build/docs/api/variables/VisuallyHidden/index.html +1 -1
  128. package/build/docs/api/variables/WaitMessage/index.html +1 -1
  129. package/build/docs/api/variables/act/index.html +1 -1
  130. package/build/docs/api/variables/ariaLive/index.html +1 -1
  131. package/build/docs/api/variables/auth/index.html +1 -1
  132. package/build/docs/api/variables/authReducer/index.html +1 -1
  133. package/build/docs/api/variables/clearSideEffects/index.html +1 -1
  134. package/build/docs/api/variables/createSideEffect/index.html +1 -1
  135. package/build/docs/api/variables/decorators/index.html +1 -1
  136. package/build/docs/api/variables/endSession/index.html +1 -1
  137. package/build/docs/api/variables/error/index.html +1 -1
  138. package/build/docs/api/variables/errorMiddleware/index.html +1 -1
  139. package/build/docs/api/variables/fireEvent/index.html +1 -1
  140. package/build/docs/api/variables/globalConstants/index.html +1 -1
  141. package/build/docs/api/variables/history/index.html +1 -1
  142. package/build/docs/api/variables/httpClientProps/index.html +1 -1
  143. package/build/docs/api/variables/logout/index.html +1 -1
  144. package/build/docs/api/variables/memoryHistory/index.html +1 -1
  145. package/build/docs/api/variables/removeSideEffect/index.html +1 -1
  146. package/build/docs/api/variables/resetUserIdleTime/index.html +1 -1
  147. package/build/docs/api/variables/screen/index.html +1 -1
  148. package/build/docs/api/variables/startSideEffect/index.html +1 -1
  149. package/build/docs/api/variables/updateBAEventParameters/index.html +1 -1
  150. package/build/docs/api/variables/useAppSelector/index.html +1 -1
  151. package/build/docs/api/variables/waitMessageAction/index.html +1 -1
  152. package/build/docs/api/variables/within/index.html +1 -1
  153. package/build/docs/assets/js/{main.4e072315.js → main.f6a3322e.js} +2 -2
  154. package/build/docs/index.html +1 -1
  155. package/build/docs/usage-guide/index.html +1 -1
  156. package/demo/{docs/1896.c36b36a3.iframe.bundle.js → 1896.1c742108.iframe.bundle.js} +1 -1
  157. package/demo/1896.1c742108.iframe.bundle.js.br +0 -0
  158. package/demo/{docs/1896.c36b36a3.iframe.bundle.js.gz → 1896.1c742108.iframe.bundle.js.gz} +0 -0
  159. package/demo/{1896.c36b36a3.iframe.bundle.js → docs/1896.1c742108.iframe.bundle.js} +1 -1
  160. package/demo/docs/1896.1c742108.iframe.bundle.js.br +0 -0
  161. package/demo/{1896.c36b36a3.iframe.bundle.js.gz → docs/1896.1c742108.iframe.bundle.js.gz} +0 -0
  162. package/demo/docs/iframe.html +1 -1
  163. package/demo/docs/index.html +1 -1
  164. package/demo/docs/main.643b2148.iframe.bundle.js +5 -0
  165. package/demo/docs/main.643b2148.iframe.bundle.js.br +0 -0
  166. package/demo/docs/main.643b2148.iframe.bundle.js.gz +0 -0
  167. package/demo/docs/{main.45c6548c9a377d9f942a.manager.bundle.js → main.8e67bf2a43b910cc0a1f.manager.bundle.js} +1 -1
  168. package/demo/docs/main.8e67bf2a43b910cc0a1f.manager.bundle.js.br +0 -0
  169. package/demo/docs/main.8e67bf2a43b910cc0a1f.manager.bundle.js.gz +0 -0
  170. package/demo/docs/project.json +1 -1
  171. package/demo/iframe.html +1 -1
  172. package/demo/index.html +1 -1
  173. package/demo/main.643b2148.iframe.bundle.js +5 -0
  174. package/demo/main.643b2148.iframe.bundle.js.br +0 -0
  175. package/demo/main.643b2148.iframe.bundle.js.gz +0 -0
  176. package/demo/{main.45c6548c9a377d9f942a.manager.bundle.js → main.8e67bf2a43b910cc0a1f.manager.bundle.js} +1 -1
  177. package/demo/main.8e67bf2a43b910cc0a1f.manager.bundle.js.br +0 -0
  178. package/demo/main.8e67bf2a43b910cc0a1f.manager.bundle.js.gz +0 -0
  179. package/demo/project.json +1 -1
  180. package/dist/cjs/utils/micro-frontend/guest.js +47 -20
  181. package/dist/cjs/utils/micro-frontend/tests/__snapshots__/guest.test.ts.snap +1 -12
  182. package/dist/esm/utils/micro-frontend/guest.js +47 -20
  183. package/dist/esm/utils/micro-frontend/tests/__snapshots__/guest.test.ts.snap +1 -12
  184. package/dist/types/tsconfig.tsbuildinfo +1 -1
  185. package/package.json +1 -1
  186. package/demo/1896.c36b36a3.iframe.bundle.js.br +0 -0
  187. package/demo/docs/1896.c36b36a3.iframe.bundle.js.br +0 -0
  188. package/demo/docs/main.45c6548c9a377d9f942a.manager.bundle.js.br +0 -0
  189. package/demo/docs/main.45c6548c9a377d9f942a.manager.bundle.js.gz +0 -0
  190. package/demo/docs/main.639b7a1f.iframe.bundle.js +0 -5
  191. package/demo/docs/main.639b7a1f.iframe.bundle.js.br +0 -0
  192. package/demo/docs/main.639b7a1f.iframe.bundle.js.gz +0 -0
  193. package/demo/main.45c6548c9a377d9f942a.manager.bundle.js.br +0 -0
  194. package/demo/main.45c6548c9a377d9f942a.manager.bundle.js.gz +0 -0
  195. package/demo/main.639b7a1f.iframe.bundle.js +0 -5
  196. package/demo/main.639b7a1f.iframe.bundle.js.br +0 -0
  197. package/demo/main.639b7a1f.iframe.bundle.js.gz +0 -0
  198. /package/build/docs/assets/js/{main.4e072315.js.LICENSE.txt → main.f6a3322e.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- (globalThis.webpackChunk_elliemae_pui_app_sdk=globalThis.webpackChunk_elliemae_pui_app_sdk||[]).push([[792],{11792(i,t,o){"use strict";var p=o(59443),m=o(96778),v=Object.defineProperty,l=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,f=(e,a,r)=>a in e?v(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,b=(e,a)=>{for(var r in a||(a={}))s.call(a,r)&&f(e,r,a[r]);if(l)for(var r of l(a))_.call(a,r)&&f(e,r,a[r]);return e},d=(e,a)=>{var r={};for(var n in e)s.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&l)for(var n of l(e))a.indexOf(n)<0&&_.call(e,n)&&(r[n]=e[n]);return r};const h=e=>{var a=e,{base:r="light",brandTitle:n="Platform UI Components"}=a,u=d(a,["base","brandTitle"]);return(0,m.vt)(b({base:r,brandTitle:`${n} v5.43.0`},u))};(e=>{p.MC.setConfig({panelPosition:"bottom",theme:h(e)})})({brandTitle:"Application SDK",brandUrl:"https://git.elliemae.io/platform-ui/pui-app-sdk.git"})},22179(){}},i=>{var t=p=>i(i.s=p);i.O(0,[659],()=>(t(54176),t(11792),t(68082),t(34023),t(72247),t(40652),t(41420),t(48510),t(75963),t(4547),t(15869),t(74157),t(28061),t(99789),t(40166),t(29923)));var o=i.O()}]);
1
+ (globalThis.webpackChunk_elliemae_pui_app_sdk=globalThis.webpackChunk_elliemae_pui_app_sdk||[]).push([[792],{11792(i,t,o){"use strict";var p=o(59443),m=o(96778),v=Object.defineProperty,l=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,f=(e,a,r)=>a in e?v(e,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[a]=r,b=(e,a)=>{for(var r in a||(a={}))s.call(a,r)&&f(e,r,a[r]);if(l)for(var r of l(a))_.call(a,r)&&f(e,r,a[r]);return e},d=(e,a)=>{var r={};for(var n in e)s.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&l)for(var n of l(e))a.indexOf(n)<0&&_.call(e,n)&&(r[n]=e[n]);return r};const h=e=>{var a=e,{base:r="light",brandTitle:n="Platform UI Components"}=a,u=d(a,["base","brandTitle"]);return(0,m.vt)(b({base:r,brandTitle:`${n} v5.44.0`},u))};(e=>{p.MC.setConfig({panelPosition:"bottom",theme:h(e)})})({brandTitle:"Application SDK",brandUrl:"https://git.elliemae.io/platform-ui/pui-app-sdk.git"})},22179(){}},i=>{var t=p=>i(i.s=p);i.O(0,[659],()=>(t(54176),t(11792),t(68082),t(34023),t(72247),t(40652),t(41420),t(48510),t(75963),t(4547),t(15869),t(74157),t(28061),t(99789),t(40166),t(29923)));var o=i.O()}]);
package/demo/project.json CHANGED
@@ -1 +1 @@
1
- {"generatedAt":1784844182384,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"pnpm","version":"8.15.9"},"typescriptOptions":{"check":false,"checkOptions":{},"reactDocgen":false,"reactDocgenTypescriptOptions":{"shouldExtractLiteralValuesFromEnum":true,"compilerOptions":{"allowSyntheticDefaultImports":false,"esModuleInterop":false}}},"features":{"fastRefresh":true,"storyStoreV7":true},"language":"javascript","storybookPackages":{},"framework":{"options":{"fastRefresh":true,"strictMode":true,"legacyRootApi":true}},"addons":{"@storybook/addon-docs":{"options":{"sourceLoaderOptions":{"injectStoryParameters":false}},"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"docs":false},"version":"6.5.16"},"@storybook/addon-storysource":{"version":"6.5.16"},"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-events":{"version":"6.2.9"},"@storybook/addon-interactions":{"version":"6.5.16"},"@storybook/addon-a11y":{"version":"6.5.16"},"storybook-addon-turbo-build":{"options":{"optimizationLevel":2,"esbuildMinifyOptions":{"target":"es2022"}},"version":"1.1.0"}}}
1
+ {"generatedAt":1784913674146,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"pnpm","version":"8.15.9"},"typescriptOptions":{"check":false,"checkOptions":{},"reactDocgen":false,"reactDocgenTypescriptOptions":{"shouldExtractLiteralValuesFromEnum":true,"compilerOptions":{"allowSyntheticDefaultImports":false,"esModuleInterop":false}}},"features":{"fastRefresh":true,"storyStoreV7":true},"language":"javascript","storybookPackages":{},"framework":{"options":{"fastRefresh":true,"strictMode":true,"legacyRootApi":true}},"addons":{"@storybook/addon-docs":{"options":{"sourceLoaderOptions":{"injectStoryParameters":false}},"version":"6.5.16"},"@storybook/addon-essentials":{"options":{"docs":false},"version":"6.5.16"},"@storybook/addon-storysource":{"version":"6.5.16"},"@storybook/addon-links":{"version":"6.5.16"},"@storybook/addon-events":{"version":"6.2.9"},"@storybook/addon-interactions":{"version":"6.5.16"},"@storybook/addon-a11y":{"version":"6.5.16"},"storybook-addon-turbo-build":{"options":{"optimizationLevel":2,"esbuildMinifyOptions":{"target":"es2022"}},"version":"1.1.0"}}}
@@ -224,11 +224,20 @@ class CMicroAppGuest {
224
224
  const browserWindow = (0, import_window.getWindow)();
225
225
  if (!browserWindow) return;
226
226
  browserWindow.emui = browserWindow.emui || {};
227
+ const performUnmount = this.unmount.bind(this);
227
228
  const app = {
228
229
  uuid: this.#uuid,
229
230
  init: this.init.bind(this),
230
231
  mount: this.mount.bind(this),
231
- unmount: this.unmount.bind(this),
232
+ unmount: (options) => {
233
+ if (options?.containerId) {
234
+ this.props.containerId = options.containerId;
235
+ }
236
+ if (this.props.host) {
237
+ return this.#internalTeardown().then(() => null);
238
+ }
239
+ return performUnmount(options);
240
+ },
232
241
  getRef: this.getRef.bind(this),
233
242
  navigate: this.navigate.bind(this)
234
243
  };
@@ -257,23 +266,36 @@ class CMicroAppGuest {
257
266
  window.emui.app = app;
258
267
  window.addEventListener("beforeunload", this.#boundOnWindowUnload);
259
268
  }
269
+ /**
270
+ * Removes legacy registerApp entries from the parent window and current window.
271
+ */
272
+ #removeLegacyGlobalRegistration() {
273
+ if (this.#selfInitialize) return;
274
+ const browserWindow = (0, import_window.getWindow)();
275
+ if (!browserWindow?.emui) return;
276
+ if (Array.isArray(browserWindow.emui[this.appId])) {
277
+ const existingApps = browserWindow.emui[this.appId];
278
+ const index = existingApps.findIndex((app) => app.uuid === this.#uuid);
279
+ if (index > -1) existingApps.splice(index, 1);
280
+ if (existingApps.length === 0) {
281
+ delete browserWindow.emui[this.appId];
282
+ }
283
+ } else {
284
+ delete browserWindow.emui[this.appId];
285
+ }
286
+ delete window.emui.app;
287
+ }
260
288
  /**
261
289
  * remove the microapp from the global variable from the parent window and current window
262
290
  */
263
291
  #onWindowUnload() {
292
+ if (this.props.host) {
293
+ this.#internalTeardown().catch(() => {
294
+ });
295
+ return;
296
+ }
264
297
  if (!this.#selfInitialize) {
265
- const browserWindow = (0, import_window.getWindow)();
266
- if (Array.isArray(browserWindow.emui[this.appId])) {
267
- const existingApps = browserWindow.emui[this.appId];
268
- const index = existingApps.findIndex((app) => app.uuid === this.#uuid);
269
- if (index > -1) existingApps.splice(index, 1);
270
- if (existingApps.length === 0) {
271
- delete browserWindow.emui[this.appId];
272
- }
273
- } else {
274
- delete browserWindow.emui[this.appId];
275
- }
276
- delete window.emui.app;
298
+ this.#removeLegacyGlobalRegistration();
277
299
  this.unmount({ containerId: this.props.containerId }).catch(() => {
278
300
  });
279
301
  return;
@@ -413,9 +435,13 @@ class CMicroAppGuest {
413
435
  */
414
436
  #internalTeardown() {
415
437
  if (!this.#hostTeardownPromise) {
416
- this.#hostTeardownPromise = this.unmount({
417
- containerId: this.props.containerId
418
- }).then(() => {
438
+ this.#hostTeardownPromise = Promise.resolve().then(() => {
439
+ this.#removeLegacyGlobalRegistration();
440
+ }).then(
441
+ () => this.unmount({
442
+ containerId: this.props.containerId
443
+ })
444
+ ).then(() => {
419
445
  this.#unbindModuleUnmountListener();
420
446
  }).catch((err) => {
421
447
  this.#hostTeardownPromise = null;
@@ -425,12 +451,12 @@ class CMicroAppGuest {
425
451
  return this.#hostTeardownPromise;
426
452
  }
427
453
  /**
428
- * Self-init guests subscribe to `module.unmount` so the host can signal
429
- * SDK teardown after the `module.unloading` veto phase.
454
+ * Hosted guests subscribe to `module.unmount` so the host can signal SDK
455
+ * teardown after the `module.unloading` veto phase (SSF always; App Bridge
456
+ * when selfInitialize is true).
430
457
  */
431
458
  #bindModuleUnmountListener() {
432
- if (!this.#selfInitialize || this.#moduleUnmountSubToken || !this.props.host)
433
- return;
459
+ if (this.#moduleUnmountSubToken || !this.props.host) return;
434
460
  this.#moduleUnmountSubToken = this.subscribe({
435
461
  eventId: MODULE_UNMOUNT_EVENT_ID,
436
462
  callback: this.#handleModuleUnmount
@@ -549,6 +575,7 @@ class CMicroAppGuest {
549
575
  return (0, import_app_bridge.getAppBridge)().then((appBridge) => {
550
576
  this.#appBridge = appBridge;
551
577
  if (this.onInit) this.onInit(this.props);
578
+ this.#bindModuleUnmountListener();
552
579
  });
553
580
  });
554
581
  }
@@ -21,18 +21,7 @@ exports[`CMicroAppGuest - Standalone calls onInit 1`] = `
21
21
  "push": [Function],
22
22
  "replace": [Function],
23
23
  },
24
- "host": SSFGuest {
25
- "addScript": [Function],
26
- "close": [Function],
27
- "connect": [Function],
28
- "getAuthToken": [Function],
29
- "getObject": [Function],
30
- "listObjects": [Function],
31
- "removeScript": [Function],
32
- "setLogLevel": [Function],
33
- "subscribe": [Function],
34
- "unsubscribe": [Function],
35
- },
24
+ "host": null,
36
25
  "hostUrl": null,
37
26
  "manifestPath": "./latest",
38
27
  "prevState": null,
@@ -191,11 +191,20 @@ class CMicroAppGuest {
191
191
  const browserWindow = getWindow();
192
192
  if (!browserWindow) return;
193
193
  browserWindow.emui = browserWindow.emui || {};
194
+ const performUnmount = this.unmount.bind(this);
194
195
  const app = {
195
196
  uuid: this.#uuid,
196
197
  init: this.init.bind(this),
197
198
  mount: this.mount.bind(this),
198
- unmount: this.unmount.bind(this),
199
+ unmount: (options) => {
200
+ if (options?.containerId) {
201
+ this.props.containerId = options.containerId;
202
+ }
203
+ if (this.props.host) {
204
+ return this.#internalTeardown().then(() => null);
205
+ }
206
+ return performUnmount(options);
207
+ },
199
208
  getRef: this.getRef.bind(this),
200
209
  navigate: this.navigate.bind(this)
201
210
  };
@@ -224,23 +233,36 @@ class CMicroAppGuest {
224
233
  window.emui.app = app;
225
234
  window.addEventListener("beforeunload", this.#boundOnWindowUnload);
226
235
  }
236
+ /**
237
+ * Removes legacy registerApp entries from the parent window and current window.
238
+ */
239
+ #removeLegacyGlobalRegistration() {
240
+ if (this.#selfInitialize) return;
241
+ const browserWindow = getWindow();
242
+ if (!browserWindow?.emui) return;
243
+ if (Array.isArray(browserWindow.emui[this.appId])) {
244
+ const existingApps = browserWindow.emui[this.appId];
245
+ const index = existingApps.findIndex((app) => app.uuid === this.#uuid);
246
+ if (index > -1) existingApps.splice(index, 1);
247
+ if (existingApps.length === 0) {
248
+ delete browserWindow.emui[this.appId];
249
+ }
250
+ } else {
251
+ delete browserWindow.emui[this.appId];
252
+ }
253
+ delete window.emui.app;
254
+ }
227
255
  /**
228
256
  * remove the microapp from the global variable from the parent window and current window
229
257
  */
230
258
  #onWindowUnload() {
259
+ if (this.props.host) {
260
+ this.#internalTeardown().catch(() => {
261
+ });
262
+ return;
263
+ }
231
264
  if (!this.#selfInitialize) {
232
- const browserWindow = getWindow();
233
- if (Array.isArray(browserWindow.emui[this.appId])) {
234
- const existingApps = browserWindow.emui[this.appId];
235
- const index = existingApps.findIndex((app) => app.uuid === this.#uuid);
236
- if (index > -1) existingApps.splice(index, 1);
237
- if (existingApps.length === 0) {
238
- delete browserWindow.emui[this.appId];
239
- }
240
- } else {
241
- delete browserWindow.emui[this.appId];
242
- }
243
- delete window.emui.app;
265
+ this.#removeLegacyGlobalRegistration();
244
266
  this.unmount({ containerId: this.props.containerId }).catch(() => {
245
267
  });
246
268
  return;
@@ -380,9 +402,13 @@ class CMicroAppGuest {
380
402
  */
381
403
  #internalTeardown() {
382
404
  if (!this.#hostTeardownPromise) {
383
- this.#hostTeardownPromise = this.unmount({
384
- containerId: this.props.containerId
385
- }).then(() => {
405
+ this.#hostTeardownPromise = Promise.resolve().then(() => {
406
+ this.#removeLegacyGlobalRegistration();
407
+ }).then(
408
+ () => this.unmount({
409
+ containerId: this.props.containerId
410
+ })
411
+ ).then(() => {
386
412
  this.#unbindModuleUnmountListener();
387
413
  }).catch((err) => {
388
414
  this.#hostTeardownPromise = null;
@@ -392,12 +418,12 @@ class CMicroAppGuest {
392
418
  return this.#hostTeardownPromise;
393
419
  }
394
420
  /**
395
- * Self-init guests subscribe to `module.unmount` so the host can signal
396
- * SDK teardown after the `module.unloading` veto phase.
421
+ * Hosted guests subscribe to `module.unmount` so the host can signal SDK
422
+ * teardown after the `module.unloading` veto phase (SSF always; App Bridge
423
+ * when selfInitialize is true).
397
424
  */
398
425
  #bindModuleUnmountListener() {
399
- if (!this.#selfInitialize || this.#moduleUnmountSubToken || !this.props.host)
400
- return;
426
+ if (this.#moduleUnmountSubToken || !this.props.host) return;
401
427
  this.#moduleUnmountSubToken = this.subscribe({
402
428
  eventId: MODULE_UNMOUNT_EVENT_ID,
403
429
  callback: this.#handleModuleUnmount
@@ -516,6 +542,7 @@ class CMicroAppGuest {
516
542
  return getAppBridge().then((appBridge) => {
517
543
  this.#appBridge = appBridge;
518
544
  if (this.onInit) this.onInit(this.props);
545
+ this.#bindModuleUnmountListener();
519
546
  });
520
547
  });
521
548
  }
@@ -21,18 +21,7 @@ exports[`CMicroAppGuest - Standalone calls onInit 1`] = `
21
21
  "push": [Function],
22
22
  "replace": [Function],
23
23
  },
24
- "host": SSFGuest {
25
- "addScript": [Function],
26
- "close": [Function],
27
- "connect": [Function],
28
- "getAuthToken": [Function],
29
- "getObject": [Function],
30
- "listObjects": [Function],
31
- "removeScript": [Function],
32
- "setLogLevel": [Function],
33
- "subscribe": [Function],
34
- "unsubscribe": [Function],
35
- },
24
+ "host": null,
36
25
  "hostUrl": null,
37
26
  "manifestPath": "./latest",
38
27
  "prevState": null,