@elliemae/pui-app-sdk 5.44.0 → 5.44.1
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/build/docs/404.html +1 -1
- package/build/docs/api/classes/Analytics/index.html +1 -1
- package/build/docs/api/classes/CMicroAppGuest/index.html +1 -1
- package/build/docs/api/classes/CMicroAppHost/index.html +1 -1
- package/build/docs/api/classes/ErrorBoundary/index.html +1 -1
- package/build/docs/api/classes/GuestModule/index.html +1 -1
- package/build/docs/api/functions/AppRoot/index.html +1 -1
- package/build/docs/api/functions/Autocomplete/index.html +1 -1
- package/build/docs/api/functions/CheckBox/index.html +1 -1
- package/build/docs/api/functions/ComboBox/index.html +1 -1
- package/build/docs/api/functions/ComboBoxV3/index.html +1 -1
- package/build/docs/api/functions/ConnectForm/index.html +1 -1
- package/build/docs/api/functions/DateInput/index.html +1 -1
- package/build/docs/api/functions/DatePicker/index.html +1 -1
- package/build/docs/api/functions/DateRangePicker/index.html +1 -1
- package/build/docs/api/functions/DateTimePicker/index.html +1 -1
- package/build/docs/api/functions/Form/index.html +1 -1
- package/build/docs/api/functions/FormItemLayout/index.html +1 -1
- package/build/docs/api/functions/FormLayoutBlockItem/index.html +1 -1
- package/build/docs/api/functions/FormSubmitButton/index.html +1 -1
- package/build/docs/api/functions/InputMask/index.html +1 -1
- package/build/docs/api/functions/InputText/index.html +1 -1
- package/build/docs/api/functions/LargeTextBox/index.html +1 -1
- package/build/docs/api/functions/MaskedInputText/index.html +1 -1
- package/build/docs/api/functions/Page/index.html +1 -1
- package/build/docs/api/functions/Radio/index.html +1 -1
- package/build/docs/api/functions/RadioGroup/index.html +1 -1
- package/build/docs/api/functions/RegisterService/index.html +1 -1
- package/build/docs/api/functions/RenderWithStateAddOns/index.html +1 -1
- package/build/docs/api/functions/RequireAuth/index.html +1 -1
- package/build/docs/api/functions/SessionTimeout/index.html +1 -1
- package/build/docs/api/functions/TextBox/index.html +1 -1
- package/build/docs/api/functions/Toggle/index.html +1 -1
- package/build/docs/api/functions/authSaga/index.html +1 -1
- package/build/docs/api/functions/authorize/index.html +1 -1
- package/build/docs/api/functions/buildModuleParams/index.html +1 -1
- package/build/docs/api/functions/cleanup/index.html +1 -1
- package/build/docs/api/functions/configureStore/index.html +1 -1
- package/build/docs/api/functions/createGuestModule/index.html +1 -1
- package/build/docs/api/functions/createManager/index.html +1 -1
- package/build/docs/api/functions/enableReactAppForHostIntegration/index.html +1 -1
- package/build/docs/api/functions/fetchHostAppData/index.html +1 -1
- package/build/docs/api/functions/fetchUserSettings/index.html +1 -1
- package/build/docs/api/functions/getApiActionCreator/index.html +1 -1
- package/build/docs/api/functions/getAppConfig/index.html +1 -1
- package/build/docs/api/functions/getAppConfigValue/index.html +1 -1
- package/build/docs/api/functions/getAuthHTTPClient/index.html +1 -1
- package/build/docs/api/functions/getAuthorizationHeader/index.html +1 -1
- package/build/docs/api/functions/getHTTPClient/index.html +1 -1
- package/build/docs/api/functions/getHostAppDataByKey/index.html +1 -1
- package/build/docs/api/functions/getLogger/index.html +1 -1
- package/build/docs/api/functions/getMicroFrontEndAppConfig/index.html +1 -1
- package/build/docs/api/functions/getNavigationLinks/index.html +1 -1
- package/build/docs/api/functions/getRedirectUrl/index.html +1 -1
- package/build/docs/api/functions/getSelectField/index.html +1 -1
- package/build/docs/api/functions/getStore/index.html +1 -1
- package/build/docs/api/functions/initServiceWorker/index.html +1 -1
- package/build/docs/api/functions/isCIBuild/index.html +1 -1
- package/build/docs/api/functions/isProd/index.html +1 -1
- package/build/docs/api/functions/isUserAuthorized/index.html +1 -1
- package/build/docs/api/functions/listenStorageEvents/index.html +1 -1
- package/build/docs/api/functions/loadAppConfig/index.html +1 -1
- package/build/docs/api/functions/loadable/index.html +1 -1
- package/build/docs/api/functions/login/index.html +1 -1
- package/build/docs/api/functions/notifyGuestUnloadComplete/index.html +1 -1
- package/build/docs/api/functions/onAuthorizationFailure/index.html +1 -1
- package/build/docs/api/functions/onGuestUnloadStart/index.html +1 -1
- package/build/docs/api/functions/redactPii/index.html +1 -1
- package/build/docs/api/functions/removeDoubleSlash/index.html +1 -1
- package/build/docs/api/functions/removeStorageEvents/index.html +1 -1
- package/build/docs/api/functions/render/index.html +1 -1
- package/build/docs/api/functions/renderHook/index.html +1 -1
- package/build/docs/api/functions/renderWithHostData/index.html +1 -1
- package/build/docs/api/functions/renderWithRedux/index.html +1 -1
- package/build/docs/api/functions/renderWithRouter/index.html +1 -1
- package/build/docs/api/functions/renderWithRouterRedux/index.html +1 -1
- package/build/docs/api/functions/sdkBaseQuery/index.html +1 -1
- package/build/docs/api/functions/sendBAEvent/index.html +1 -1
- package/build/docs/api/functions/sendMessageToHost/index.html +1 -1
- package/build/docs/api/functions/setAppConfig/index.html +1 -1
- package/build/docs/api/functions/setAppConfigValue/index.html +1 -1
- package/build/docs/api/functions/setHostAppData/index.html +1 -1
- package/build/docs/api/functions/setLoginParams/index.html +1 -1
- package/build/docs/api/functions/subscribeToResetSession/index.html +1 -1
- package/build/docs/api/functions/subscribeToSessionExpiry/index.html +1 -1
- package/build/docs/api/functions/subscribeToSessionExpiryWarning/index.html +1 -1
- package/build/docs/api/functions/trackActivity/index.html +1 -1
- package/build/docs/api/functions/useAppDispatch/index.html +1 -1
- package/build/docs/api/functions/useAppMiddleware/index.html +1 -1
- package/build/docs/api/functions/useInjectQuery/index.html +1 -1
- package/build/docs/api/functions/useInjectReducer/index.html +1 -1
- package/build/docs/api/functions/useInjectSaga/index.html +1 -1
- package/build/docs/api/functions/useInjectSideEffect/index.html +1 -1
- package/build/docs/api/functions/useMediaQueryList/index.html +1 -1
- package/build/docs/api/functions/useStateSelector/index.html +1 -1
- package/build/docs/api/functions/useStateSelectorShallow/index.html +1 -1
- package/build/docs/api/functions/waitFor/index.html +1 -1
- package/build/docs/api/functions/waitForElementToBeRemoved/index.html +1 -1
- package/build/docs/api/functions/withAppDecorator/index.html +1 -1
- package/build/docs/api/index.html +1 -1
- package/build/docs/api/interfaces/AppConfig/index.html +1 -1
- package/build/docs/api/interfaces/GuestProps/index.html +1 -1
- package/build/docs/api/interfaces/UseStateSelectorOptions/index.html +1 -1
- package/build/docs/api/type-aliases/AppDispatch/index.html +1 -1
- package/build/docs/api/type-aliases/AppStore/index.html +1 -1
- package/build/docs/api/type-aliases/Await/index.html +1 -1
- package/build/docs/api/type-aliases/EMUI/index.html +1 -1
- package/build/docs/api/type-aliases/HostOptions/index.html +1 -1
- package/build/docs/api/type-aliases/HostProvidedParams/index.html +1 -1
- package/build/docs/api/type-aliases/ModuleOverrides/index.html +1 -1
- package/build/docs/api/type-aliases/OnHostInitCallback/index.html +1 -1
- package/build/docs/api/type-aliases/OnInitCallback/index.html +1 -1
- package/build/docs/api/type-aliases/OnMountCallback/index.html +1 -1
- package/build/docs/api/type-aliases/OnUnMountCallback/index.html +1 -1
- package/build/docs/api/type-aliases/RootState/index.html +1 -1
- package/build/docs/api/type-aliases/SelectStateFieldFunction/index.html +1 -1
- package/build/docs/api/variables/ErrorToast/index.html +1 -1
- package/build/docs/api/variables/FormPropsContext/index.html +1 -1
- package/build/docs/api/variables/GuestMicroApp/index.html +1 -1
- package/build/docs/api/variables/MASK_PIPES/index.html +1 -1
- package/build/docs/api/variables/MASK_TYPES/index.html +1 -1
- package/build/docs/api/variables/MicroApp/index.html +1 -1
- package/build/docs/api/variables/MicroIFrameApp/index.html +1 -1
- package/build/docs/api/variables/NavigationPrompt/index.html +1 -1
- package/build/docs/api/variables/NavigationPromptActions/index.html +1 -1
- package/build/docs/api/variables/Themes/index.html +1 -1
- package/build/docs/api/variables/VisuallyHidden/index.html +1 -1
- package/build/docs/api/variables/WaitMessage/index.html +1 -1
- package/build/docs/api/variables/act/index.html +1 -1
- package/build/docs/api/variables/ariaLive/index.html +1 -1
- package/build/docs/api/variables/auth/index.html +1 -1
- package/build/docs/api/variables/authReducer/index.html +1 -1
- package/build/docs/api/variables/clearSideEffects/index.html +1 -1
- package/build/docs/api/variables/createSideEffect/index.html +1 -1
- package/build/docs/api/variables/decorators/index.html +1 -1
- package/build/docs/api/variables/endSession/index.html +1 -1
- package/build/docs/api/variables/error/index.html +1 -1
- package/build/docs/api/variables/errorMiddleware/index.html +1 -1
- package/build/docs/api/variables/fireEvent/index.html +1 -1
- package/build/docs/api/variables/globalConstants/index.html +1 -1
- package/build/docs/api/variables/history/index.html +1 -1
- package/build/docs/api/variables/httpClientProps/index.html +1 -1
- package/build/docs/api/variables/logout/index.html +1 -1
- package/build/docs/api/variables/memoryHistory/index.html +1 -1
- package/build/docs/api/variables/removeSideEffect/index.html +1 -1
- package/build/docs/api/variables/resetUserIdleTime/index.html +1 -1
- package/build/docs/api/variables/screen/index.html +1 -1
- package/build/docs/api/variables/startSideEffect/index.html +1 -1
- package/build/docs/api/variables/updateBAEventParameters/index.html +1 -1
- package/build/docs/api/variables/useAppSelector/index.html +1 -1
- package/build/docs/api/variables/waitMessageAction/index.html +1 -1
- package/build/docs/api/variables/within/index.html +1 -1
- package/build/docs/assets/js/{main.f6a3322e.js → main.1bc3906d.js} +2 -2
- package/build/docs/index.html +1 -1
- package/build/docs/usage-guide/index.html +1 -1
- package/demo/{docs/1896.1c742108.iframe.bundle.js → 1896.f079560a.iframe.bundle.js} +1 -1
- package/demo/1896.f079560a.iframe.bundle.js.br +0 -0
- package/demo/{docs/1896.1c742108.iframe.bundle.js.gz → 1896.f079560a.iframe.bundle.js.gz} +0 -0
- package/demo/{1896.1c742108.iframe.bundle.js → docs/1896.f079560a.iframe.bundle.js} +1 -1
- package/demo/docs/1896.f079560a.iframe.bundle.js.br +0 -0
- package/demo/{1896.1c742108.iframe.bundle.js.gz → docs/1896.f079560a.iframe.bundle.js.gz} +0 -0
- package/demo/docs/iframe.html +1 -1
- package/demo/docs/index.html +1 -1
- package/demo/docs/main.b01a6dc6.iframe.bundle.js +5 -0
- package/demo/docs/main.b01a6dc6.iframe.bundle.js.br +0 -0
- package/demo/docs/main.b01a6dc6.iframe.bundle.js.gz +0 -0
- package/demo/docs/{main.8e67bf2a43b910cc0a1f.manager.bundle.js → main.e50da2045dbe0d31db54.manager.bundle.js} +1 -1
- package/demo/docs/{main.8e67bf2a43b910cc0a1f.manager.bundle.js.br → main.e50da2045dbe0d31db54.manager.bundle.js.br} +0 -0
- package/demo/docs/{main.8e67bf2a43b910cc0a1f.manager.bundle.js.gz → main.e50da2045dbe0d31db54.manager.bundle.js.gz} +0 -0
- package/demo/docs/project.json +1 -1
- package/demo/iframe.html +1 -1
- package/demo/index.html +1 -1
- package/demo/main.b01a6dc6.iframe.bundle.js +5 -0
- package/demo/main.b01a6dc6.iframe.bundle.js.br +0 -0
- package/demo/main.b01a6dc6.iframe.bundle.js.gz +0 -0
- package/demo/{main.8e67bf2a43b910cc0a1f.manager.bundle.js → main.e50da2045dbe0d31db54.manager.bundle.js} +1 -1
- package/demo/{main.8e67bf2a43b910cc0a1f.manager.bundle.js.br → main.e50da2045dbe0d31db54.manager.bundle.js.br} +0 -0
- package/demo/{main.8e67bf2a43b910cc0a1f.manager.bundle.js.gz → main.e50da2045dbe0d31db54.manager.bundle.js.gz} +0 -0
- package/demo/project.json +1 -1
- package/dist/cjs/utils/micro-frontend/guest.js +39 -36
- package/dist/esm/utils/micro-frontend/guest.js +39 -36
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/demo/1896.1c742108.iframe.bundle.js.br +0 -0
- package/demo/docs/1896.1c742108.iframe.bundle.js.br +0 -0
- package/demo/docs/main.643b2148.iframe.bundle.js +0 -5
- package/demo/docs/main.643b2148.iframe.bundle.js.br +0 -0
- package/demo/docs/main.643b2148.iframe.bundle.js.gz +0 -0
- package/demo/main.643b2148.iframe.bundle.js +0 -5
- package/demo/main.643b2148.iframe.bundle.js.br +0 -0
- package/demo/main.643b2148.iframe.bundle.js.gz +0 -0
- /package/build/docs/assets/js/{main.f6a3322e.js.LICENSE.txt → main.1bc3906d.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.44.
|
|
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.1`},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()}]);
|
|
Binary file
|
|
Binary file
|
package/demo/project.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1784919464096,"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"}}}
|
|
@@ -49,6 +49,7 @@ var import_ssf_host2 = require("./ssf-host.js");
|
|
|
49
49
|
var import_webpack_public_path = require("./webpack-public-path.js");
|
|
50
50
|
const DEFAULT_CONTAINER_ID = "app-container";
|
|
51
51
|
const MODULE_SCRIPTING_OBJECT_TIMEOUT_MS = 2e3;
|
|
52
|
+
const SSF_CONNECT_TIMEOUT_MS = 1e3;
|
|
52
53
|
const isCrossDomain = () => {
|
|
53
54
|
try {
|
|
54
55
|
window.parent.document;
|
|
@@ -311,22 +312,31 @@ class CMicroAppGuest {
|
|
|
311
312
|
}
|
|
312
313
|
return value;
|
|
313
314
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
promise:
|
|
323
|
-
delay:
|
|
324
|
-
retValue:
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
|
|
315
|
+
#getLegacyParentHost() {
|
|
316
|
+
if (isCrossDomain()) return null;
|
|
317
|
+
return window.parent?.emui?.MicroAppHost ?? null;
|
|
318
|
+
}
|
|
319
|
+
async #tryConnectSSFGuest() {
|
|
320
|
+
const ssfGuest = new import_ssf_guest.SSFGuest({ appLogger: this.logger });
|
|
321
|
+
try {
|
|
322
|
+
const failed = await (0, import_helpers.abortPromise)({
|
|
323
|
+
promise: ssfGuest.connect(),
|
|
324
|
+
delay: SSF_CONNECT_TIMEOUT_MS,
|
|
325
|
+
retValue: true
|
|
326
|
+
});
|
|
327
|
+
if (!failed) {
|
|
328
|
+
this.#communicationMethod = "ssf" /* SSF */;
|
|
329
|
+
return ssfGuest;
|
|
330
|
+
}
|
|
331
|
+
} catch {
|
|
328
332
|
}
|
|
329
|
-
return
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
async findHost() {
|
|
336
|
+
const legacyHost = this.#getLegacyParentHost();
|
|
337
|
+
if (legacyHost) return legacyHost;
|
|
338
|
+
if (!this.#useV2Guest) return null;
|
|
339
|
+
return this.#tryConnectSSFGuest();
|
|
330
340
|
}
|
|
331
341
|
get uuid() {
|
|
332
342
|
return this.#uuid;
|
|
@@ -362,23 +372,10 @@ class CMicroAppGuest {
|
|
|
362
372
|
if (window.emui?.__host) {
|
|
363
373
|
return window.emui.__host;
|
|
364
374
|
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
if (this.#useV2Guest) {
|
|
370
|
-
const ssfGuest = new import_ssf_guest.SSFGuest({ appLogger: this.logger });
|
|
371
|
-
const failed = await (0, import_helpers.abortPromise)({
|
|
372
|
-
promise: ssfGuest.connect(),
|
|
373
|
-
delay: 1e3,
|
|
374
|
-
retValue: true
|
|
375
|
-
});
|
|
376
|
-
if (!failed) {
|
|
377
|
-
this.#communicationMethod = "ssf" /* SSF */;
|
|
378
|
-
return ssfGuest;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return null;
|
|
375
|
+
const legacyHost = this.#getLegacyParentHost();
|
|
376
|
+
if (legacyHost) return legacyHost;
|
|
377
|
+
if (!this.#useV2Guest) return null;
|
|
378
|
+
return this.#tryConnectSSFGuest();
|
|
382
379
|
}
|
|
383
380
|
#exposeGetHost() {
|
|
384
381
|
window.emui = window.emui || {};
|
|
@@ -457,10 +454,16 @@ class CMicroAppGuest {
|
|
|
457
454
|
*/
|
|
458
455
|
#bindModuleUnmountListener() {
|
|
459
456
|
if (this.#moduleUnmountSubToken || !this.props.host) return;
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
457
|
+
try {
|
|
458
|
+
this.#moduleUnmountSubToken = this.subscribe({
|
|
459
|
+
eventId: MODULE_UNMOUNT_EVENT_ID,
|
|
460
|
+
callback: this.#handleModuleUnmount
|
|
461
|
+
});
|
|
462
|
+
} catch {
|
|
463
|
+
this.logger.warn(
|
|
464
|
+
"Unable to subscribe to module.unmount from host \u2014 continuing without host teardown listener"
|
|
465
|
+
);
|
|
466
|
+
}
|
|
464
467
|
}
|
|
465
468
|
#unbindModuleUnmountListener() {
|
|
466
469
|
if (!this.#moduleUnmountSubToken) return;
|
|
@@ -16,6 +16,7 @@ import { getSSFHost, setSSFHost } from "./ssf-host.js";
|
|
|
16
16
|
import { syncWebpackPublicPathFromAssetPath } from "./webpack-public-path.js";
|
|
17
17
|
const DEFAULT_CONTAINER_ID = "app-container";
|
|
18
18
|
const MODULE_SCRIPTING_OBJECT_TIMEOUT_MS = 2e3;
|
|
19
|
+
const SSF_CONNECT_TIMEOUT_MS = 1e3;
|
|
19
20
|
const isCrossDomain = () => {
|
|
20
21
|
try {
|
|
21
22
|
window.parent.document;
|
|
@@ -278,22 +279,31 @@ class CMicroAppGuest {
|
|
|
278
279
|
}
|
|
279
280
|
return value;
|
|
280
281
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
promise:
|
|
290
|
-
delay:
|
|
291
|
-
retValue:
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
|
|
282
|
+
#getLegacyParentHost() {
|
|
283
|
+
if (isCrossDomain()) return null;
|
|
284
|
+
return window.parent?.emui?.MicroAppHost ?? null;
|
|
285
|
+
}
|
|
286
|
+
async #tryConnectSSFGuest() {
|
|
287
|
+
const ssfGuest = new SSFGuest({ appLogger: this.logger });
|
|
288
|
+
try {
|
|
289
|
+
const failed = await abortPromise({
|
|
290
|
+
promise: ssfGuest.connect(),
|
|
291
|
+
delay: SSF_CONNECT_TIMEOUT_MS,
|
|
292
|
+
retValue: true
|
|
293
|
+
});
|
|
294
|
+
if (!failed) {
|
|
295
|
+
this.#communicationMethod = "ssf" /* SSF */;
|
|
296
|
+
return ssfGuest;
|
|
297
|
+
}
|
|
298
|
+
} catch {
|
|
295
299
|
}
|
|
296
|
-
return
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
async findHost() {
|
|
303
|
+
const legacyHost = this.#getLegacyParentHost();
|
|
304
|
+
if (legacyHost) return legacyHost;
|
|
305
|
+
if (!this.#useV2Guest) return null;
|
|
306
|
+
return this.#tryConnectSSFGuest();
|
|
297
307
|
}
|
|
298
308
|
get uuid() {
|
|
299
309
|
return this.#uuid;
|
|
@@ -329,23 +339,10 @@ class CMicroAppGuest {
|
|
|
329
339
|
if (window.emui?.__host) {
|
|
330
340
|
return window.emui.__host;
|
|
331
341
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (this.#useV2Guest) {
|
|
337
|
-
const ssfGuest = new SSFGuest({ appLogger: this.logger });
|
|
338
|
-
const failed = await abortPromise({
|
|
339
|
-
promise: ssfGuest.connect(),
|
|
340
|
-
delay: 1e3,
|
|
341
|
-
retValue: true
|
|
342
|
-
});
|
|
343
|
-
if (!failed) {
|
|
344
|
-
this.#communicationMethod = "ssf" /* SSF */;
|
|
345
|
-
return ssfGuest;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return null;
|
|
342
|
+
const legacyHost = this.#getLegacyParentHost();
|
|
343
|
+
if (legacyHost) return legacyHost;
|
|
344
|
+
if (!this.#useV2Guest) return null;
|
|
345
|
+
return this.#tryConnectSSFGuest();
|
|
349
346
|
}
|
|
350
347
|
#exposeGetHost() {
|
|
351
348
|
window.emui = window.emui || {};
|
|
@@ -424,10 +421,16 @@ class CMicroAppGuest {
|
|
|
424
421
|
*/
|
|
425
422
|
#bindModuleUnmountListener() {
|
|
426
423
|
if (this.#moduleUnmountSubToken || !this.props.host) return;
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
424
|
+
try {
|
|
425
|
+
this.#moduleUnmountSubToken = this.subscribe({
|
|
426
|
+
eventId: MODULE_UNMOUNT_EVENT_ID,
|
|
427
|
+
callback: this.#handleModuleUnmount
|
|
428
|
+
});
|
|
429
|
+
} catch {
|
|
430
|
+
this.logger.warn(
|
|
431
|
+
"Unable to subscribe to module.unmount from host \u2014 continuing without host teardown listener"
|
|
432
|
+
);
|
|
433
|
+
}
|
|
431
434
|
}
|
|
432
435
|
#unbindModuleUnmountListener() {
|
|
433
436
|
if (!this.#moduleUnmountSubToken) return;
|