@elliemae/pui-app-bridge 2.7.1 → 2.7.3
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/dist/public/frame.html +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/{emuiAppBridge.1edf277e9ad51029688c.js → emuiAppBridge.7eb553b783d990bdde1c.js} +1 -1
- package/dist/public/js/emuiAppBridge.7eb553b783d990bdde1c.js.br +0 -0
- package/dist/public/js/{emuiAppBridge.1edf277e9ad51029688c.js.gz → emuiAppBridge.7eb553b783d990bdde1c.js.gz} +0 -0
- package/dist/public/js/{emuiAppBridge.1edf277e9ad51029688c.js.map → emuiAppBridge.7eb553b783d990bdde1c.js.map} +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/public/js/emuiAppBridge.1edf277e9ad51029688c.js.br +0 -0
package/dist/public/frame.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="mobile-web-app-capable" content="yes"/><link rel="icon" href="/favicon.ico"/><title>Application</title><script>!function(e,t,n,a,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src="https://www.google-analytics.com/analytics.js",s.parentNode.insertBefore(o,s)}(window,document,"script",0,"ga")</script><style>.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="mobile-web-app-capable" content="yes"/><link rel="icon" href="/favicon.ico"/><title>Application</title><script>!function(e,t,n,a,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src="https://www.google-analytics.com/analytics.js",s.parentNode.insertBefore(o,s)}(window,document,"script",0,"ga")</script><style>.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.7eb553b783d990bdde1c.js"></script></head><body class="full-width full-height"><noscript>If you're seeing this message, that means <strong>JavaScript has been disabled on your browser</strong>, please <strong>enable JS</strong> to make this app work.</noscript><div id="pui-app-container-" class="full-width full-height"></div></body></html>
|
package/dist/public/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.7eb553b783d990bdde1c.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="creditScore" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Credit Score</label><div class="mt-1 sm:mt-0"><output id="creditScore" class="block w-full max-w-lg pl-2 pt-2 sm:max-w-xs sm:text-sm">NA</output></div><div class="mt-1 sm:mt-0"><button id="getCreditScore" type="button" class="inline-flex items-center rounded-full border border-transparent bg-indigo-600 p-1 text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3"/></svg></button></div></div></div></div></div><button id="saveLoan" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
|
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
}
|
|
23
23
|
`,n),{}),Xr=t=>({space:{...t.spaces,xxxs:t.spaces[1],xxs:t.spaces[2],xxs2:t.spaces[3],xs:t.spaces[4],s:t.spaces[5],m:t.spaces[6],l:t.spaces[7],xl:t.spaces[8],xxl:t.spaces[9]},fontSizes:{...t.fontSizes,title:{500:t.fontSizes[3],600:t.fontSizes[4],700:t.fontSizes[5],800:t.fontSizes[6],900:t.fontSizes[7]},subTitle:{300:t.fontSizes[1],400:t.fontSizes[2]},label:{200:t.fontSizes[0],300:t.fontSizes[1],400:t.fontSizes[2]},value:{300:t.fontSizes[1],400:t.fontSizes[2],500:t.fontSizes[3],600:t.fontSizes[4]},hyperlink:{200:t.fontSizes[0],300:t.fontSizes[1],400:t.fontSizes[2]},microText:{200:t.fontSizes[0]}},fontWeights:{...t.fontWeights,thin:t.fontWeights[0],light:t.fontWeights[1],regular:t.fontWeights[3],semibold:t.fontWeights[5],bold:t.fontWeights[8]},lineHeights:{...t.lineHeights,r:t.lineHeights[0],m:t.lineHeights[1],l:t.lineHeights[2],xl:t.lineHeights[3]},letterSpacings:{normal:t.letterSpacings[0],tracked:t.letterSpacings[1],tight:t.letterSpacings[2],mega:t.letterSpacings[3]},fonts:{...t.fonts,default:t.fonts[0]},colors:{neutral:{"000":t.colors.neutral[0],"050":t.colors.neutral[1],"080":t.colors.neutral[2],100:t.colors.neutral[3],200:t.colors.neutral[4],300:t.colors.neutral[5],400:t.colors.neutral[6],500:t.colors.neutral[7],600:t.colors.neutral[8],700:t.colors.neutral[9],800:t.colors.neutral[10]},brand:{100:t.colors.brand[0],200:t.colors.brand[1],300:t.colors.brand[2],400:t.colors.brand[3],500:t.colors.brand[4],600:t.colors.brand[5],700:t.colors.brand[6],800:t.colors.brand[7]},success:{300:t.colors.success[0],400:t.colors.success[1],600:t.colors.success[2],900:t.colors.success[3],950:t.colors.success[4]},warning:{400:t.colors.warning[0],500:t.colors.warning[1],600:t.colors.warning[1],900:t.colors.warning[2],950:t.colors.warning[3]},danger:{200:t.colors.danger[0],400:t.colors.danger[1],600:t.colors.danger[2],900:t.colors.danger[3],950:t.colors.danger[4]}},shadows:{xs:t.shadows[0],s:t.shadows[1],m:t.shadows[2],l:t.shadows[3],xl:t.shadows[4]},breakpoints:{...t.breakpoints,small:t.breakpoints[0],medium:t.breakpoints[1],large:t.breakpoints[2]},media:Yr({small:t.breakpoints[0],medium:t.breakpoints[1],large:t.breakpoints[2]}),zIndex:{dialog:t.zIndex[0],popper:t.zIndex[1],tooltip:t.zIndex[2],backdrop:t.zIndex[3],loader:t.zIndex[4]},states:{_:t.states[0],motionSafe:t.states[1],motionReduce:t.states[2],first:t.states[3],last:t.states[4],odd:t.states[5],even:t.states[6],visited:t.states[7],checked:t.states[8],focusWithin:t.states[9],hover:t.states[10],focus:t.states[11],focusVisible:t.states[12],active:t.states[13],disabled:t.states[14],placeholder:t.states[15]}}),Zr=((t=X())=>()=>Xr(t))(),Hn=()=>{try{return window.parent.document,window.parent}catch{return window}},tr=()=>({width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}),xr=t=>Number(t.replace("px","")),Sr=()=>{const{width:t}=tr(),{breakpoints:n}=Zr();return t<=xr(n.small)?"small":t<=xr(n.medium)?"medium":"large"};var Jr=q(5402),Qr=q.n(Jr),_r=q(5887),qr=q.n(_r),en=q(7579),tn=q.n(en),rn=q(4339),nn=q.n(rn),on=q(2495),Ar=q.n(on);const sn=JSON.parse('{"appId":"microfe","activeEnv":"localhost","googleTagManager":true,"sessionTimeoutWarnInterval":"7200000","sessionTimeoutInterval":"9000000","microFrontendApps":{"loanapp":{"name":"Loan","hostUrl":"./loan","development":{"files":["index.js"]},"production":{"files":["index.js"]}},"taskapp":{"name":"Task","hostUrl":"./task","mode":"development","development":{"files":["index.dev.js"]},"production":{"files":["index.js"]}},"travelhub":{"name":"TravelHub","hostUrl":"./travelhub","development":{"files":["app.js","landing.js","app.css","landing.css"]},"production":{"files":["app.js","landing.js","app.css","landing.css"]}},"flights":{"name":"Flights","hostUrl":"./flights","development":{"files":["app.js","app.css"]},"production":{"files":["app.js","app.css"]}},"hotels":{"name":"Hotels","hostUrl":"./hotels","development":{"files":["app.js","app.css"]},"production":{"files":["app.js","app.css"]}}},"serviceEndpoints":{"api":"","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"},"env":{"localhost":{"serviceEndpoints":{"api":"","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"dev":{"serviceEndpoints":{"api":"https://dev.api.puiservice.rd.elliemae.io","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"dev2":{"serviceEndpoints":{"api":"https://int.api.ellielabs.com","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"qa":{"serviceEndpoints":{"api":"https://dev.api.puiservice.rd.elliemae.io","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"qa2":{"serviceEndpoints":{"api":"https://int.api.ellielabs.com","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"qa3":{"serviceEndpoints":{"api":"https://int.api.ellielabs.com","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"int":{"serviceEndpoints":{"api":"https://int.api.ellielabs.com","idp":"https://int.idp.ellielabs.com","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg-osb1":{"serviceEndpoints":{"api":"https://encompass-peg-api.elliemae.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg-osb2":{"serviceEndpoints":{"api":"https://encompass-peg2-api.elliemae.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg":{"serviceEndpoints":{"api":"https://peg2-west.api.ellielabs.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg-oapi-west":{"serviceEndpoints":{"api":"https://peg2-west.api.ellielabs.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg-oapi-east":{"serviceEndpoints":{"api":"https://peg2-east.api.ellielabs.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg2-oapi-east":{"serviceEndpoints":{"api":"https://peg2-east.api.ellielabs.com","idp":"https://peg.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"peg3":{"serviceEndpoints":{"api":"https://pel1.api.ellielabs.com","idp":"https://peg3.idp.ellielabs.com/authorize","logger":"https://int.api.ellielabs.com/diagnostics/v2/logging"}},"stage":{"serviceEndpoints":{"api":"https://stg.api.elliemae.com","idp":"https://stg.idp.elliemae.com/authorize","logger":"https://api.ellielabs.com/diagnostics/v2/logging"}},"beta":{"serviceEndpoints":{"api":"https://concept.api.elliemae.com","idp":"https://concept.idp.elliemae.com/authorize","logger":"https://api.ellielabs.com/diagnostics/v2/logging"}},"demo":{"serviceEndpoints":{"api":"https://concept.api.elliemae.com","idp":"https://concept.idp.elliemae.com/authorize","logger":"https://api.ellielabs.com/diagnostics/v2/logging"}},"epc":{"serviceEndpoints":{"api":"https://concept.api.elliemae.com","idp":"https://concept.idp.elliemae.com/authorize","logger":"https://api.ellielabs.com/diagnostics/v2/logging"}},"prod":{"serviceEndpoints":{"api":"https://api.elliemae.com","idp":"https://idp.elliemae.com/authorize","logger":"https://api.ellielabs.com/diagnostics/v2/logging"}}}}'),St="latest",rr=t=>t.replace(/([^:]\/)\/+/g,"$1"),Vn=t=>{const n=document.createElement("a");return n.href=t,n.href},Ut=t=>t?.replace?.(/\/?$/,"/"),an=()=>window.navigator.userAgent.includes("jsdom");class cn{#e=sn;#t;#r;constructor(n){this.#t=n?.version||St,this.#r=Ut(n?.baseUrl||"")}#n=n=>{const{activeEnv:o}=n,f=n.env[o]||{};n.env&&delete n.env,this.#e=Ar()(n,f)};get=(n="",o=null)=>Qr()(qr()(this.#e,n,o));set=(n,o)=>tn()(this.#e,n,o);has=(n="")=>nn()(this.#e,n);load=async n=>{const o=this.#t.match(/^(?:\d+\.\d+)*/g),f=n??`${this.#r}${o&&o[0]||St}/app.config.json`,y=await fetch(f);if(y.ok)try{const x=await y.json();this.#n(x)}catch(x){if(!n&&this.#t!==St)await this.load(`${this.#r}latest/app.config.json`);else throw new Error("Failed to parse app config",{cause:x})}else{if(!n&&this.#t!==St){await this.load(`${this.#r}latest/app.config.json`);return}throw new Error("Failed to load app config")}}}const ln="microFrontendApps",un=()=>!0,pn=t=>un()?!0:t?t==="production":!0,fn=t=>t?new URL(t).pathname:"",dn=t=>{const n=document.createElement("a");return n.href=t,n.href},hn=(t,n)=>{const o=n.match(/^(?:\d+\.\d+)*/g);return t.replace(/{SYSTEM_VERSION}/,o&&o[0]||St)},Er=t=>!t||!t.length?!1:t.every(n=>typeof n=="string"),gn=(t,n)=>{const{mode:o="production"}=n;if(o!=="production"&&o!=="development")throw new Error(`invalid mode '${o}' for ${t}`);const{production:f,development:y}=n;if(o==="production"){if(!f)throw new Error(`microFrontendApps.${t} is missing production section in app.config.json`);if(!Er(f.files))throw new Error("invalid value for production.files")}if(o==="development"){if(!y)throw new Error(`microFrontendApps.${t} is missing development section in app.config.json`);if(!Er(y.files))throw new Error("invalid value for development.files")}},mn=({id:t,config:n,version:o="latest"})=>{const{mode:f="production"}=n,y=pn(f)?n.production:n.development;n.production&&delete n.production,n.development&&delete n.development;const x=Ar()({id:t},{name:t,mode:"production",manifestPath:"./{SYSTEM_VERSION}/",securityContext:u.USER},n,y);return x.hostUrl=Ut(dn(x.hostUrl||"")),x.homeRoute=Ut(x.homeRoute)||fn(x.hostUrl),x.manifestPath=Ut(hn(x.manifestPath,o)),x};class vn{#e=[];init=({version:n,appConfig:o})=>{const f=o.get(ln);if(!f)throw new Error("app.config.json is missing microFrontendApps section");this.#e=Object.keys(f).map(y=>(gn(y,f[y]),mn({id:y,config:f[y],version:n})))};getConfigById=n=>this.#e.find(o=>o.id===n)}const yn="ice-script-",bn=/(?:emuiDiagnostics|global|global-prod|emuiUserMonitoring)(?:..*)?.js/,wn=t=>!bn.test(t);class xn{#e;constructor(n){this.#e=n}add=({name:n,hostUrl:o,documentEle:f,fileName:y,index:x})=>new Promise((O,j)=>{const L=new URL(y,o),D=f.createElement("script");D.id=`${yn}${n.toLowerCase()}-${x}`,D.src=rr(L.href),D.onload=O.bind(null,D.id),D.onerror=W=>{j(new Error(`Unable to load script ${D.src}`,{cause:new Error(W)}))},D.async=!1,!an()&&wn(D.src)&&(D.defer=!0),f.head.appendChild(D)});remove=(n="",o=document)=>new Promise(f=>{const y=o.getElementById(n);y||(this.#e.warn(`script with id ${n} not found`),f()),y.remove(),f()});removeDynamicImportedScripts=(n,o)=>{const f=new RegExp(n,"i"),y=o.getElementsByTagName("script");for(let x=y.length-1;x>=0;x-=1){const O=y[x],{src:j}=O;f.test(j)&&O.remove()}};removePrefetchLinks=(n,o)=>{const f=new RegExp(n,"i"),y=o.querySelectorAll('[rel="prefetch"]');for(let x=y.length-1;x>=0;x-=1){const O=y[x],{href:j}=O;f.test(j)&&O.remove()}}}const Sn="ice-style-";class An{#e;constructor(n){this.#e=n}add=({name:n,hostUrl:o,documentEle:f,fileName:y,index:x})=>new Promise((O,j)=>{const L=f.createElement("link");L.id=`${Sn}${n.toLowerCase()}-${x}`,L.rel="stylesheet";const D=new URL(y,o);L.href=rr(D.href),L.onload=O.bind(null,L.id),L.onerror=W=>{j(new Error(`Unable to load stylesheet ${L.href}`,{cause:new Error(W)}))},f.head.appendChild(L)});remove=(n="",o=document)=>new Promise(f=>{const y=o.getElementById(n);y||(this.#e.warn(`style with id ${n} not found`),f()),y.remove(),f()});removeDynamicImportedStyles=(n,o)=>{const f=new RegExp(n,"i"),y=o.querySelectorAll('[rel="stylesheet"]');for(let x=y.length-1;x>=0;x-=1){const O=y[x],{href:j}=O;f.test(j)&&O.remove()}}}const Or=t=>t.replace(/\/\d+\.\d+/,"/latest"),En=t=>{let n;try{n=new URL(t)}catch{return!1}return n.protocol==="http:"||n.protocol==="https:"},Cr=async({hostUrl:t,manifestPath:n})=>{const o=new URL(`${n}manifest.json`,t),f=await fetch(rr(o.href));if(f.ok){const{headers:x}=f;if((x?.get?.("content-type")??"").includes("application/json"))return await f.json();throw new Error(`manifest ${o.href} is not a valid json`)}const y=Or(n);if(n!==y)return Cr({hostUrl:t,manifestPath:Or(n)});throw new Error(`unable to get manifest ${o.href}`)},Tr={get:Cr,getFullFileNameofAssets:(t,n=[])=>n.reduce((o,f)=>{const y=t[f];if(y)o.push(y);else if(En(f))o.push(f);else throw new Error(`unable to locate ${f} in manifest`);return o},[])};class On{#e;#t;#r;#n;#o;constructor(n){this.#t=n.guest,this.#e=n.logger,this.#r=n?.version||St,this.#n=n.soManager,this.#o=n.eventManager}addEventListener=n=>this.#o.subscribe(n);get version(){return this.#r}getObject=n=>Promise.resolve(this.#n.getObject(n,this.#t));removeEventListener=n=>{this.#o.unsubscribe(n)};setAppWindowSize=n=>{const{appId:o,size:f}=n,y=document.getElementById(`${re}${o}`);y&&(y.style.height=`${f.height}px`)};subscribe=(n,o)=>(0,v.subscribe)(n,o);unsubscribe=n=>{(0,v.unsubscribe)(n)}}const jr="pui-app-container-",Cn=/\.css$/,Tn=t=>Cn.test(t);class jn{#e;#t;#r;#n;#o;#s=new vn;#i;#c;#a=new Map;constructor(n){const{logger:o}=n;if(!o)throw new Error("logger is required");this.#e=n.logger,this.#t=n.version,this.#o=new cn({version:n.version,baseUrl:n.appConfigBaseUrl}),this.#r=new xn(o),this.#n=new An(o),this.#i=new S,this.#c=new P}#f=(n,o=document)=>{const{elementIds:f}=this.#a.get(n)||{};f&&f.forEach(y=>{const x=o.getElementById(y);x&&x.remove()})};#d=(n,o,f)=>{const y=window.emui?.[n]||{};this.#a.set(n,{elementIds:f,guest:{guestWindow:o?.defaultView,...y}})};#h=(n,o)=>{const{id:f,name:y,hostUrl:x,manifestPath:O,homeRoute:j,history:L,theme:D,documentEle:W}=n;return Promise.all(o).then(this.#d.bind(null,f,W)).then(this.#g.bind(null,{id:f,name:y,hostUrl:x,manifestPath:O,homeRoute:j,history:L,theme:D})).catch(Q=>{const ce=`Application load failed. Unable to load one or more resources for appId: ${n.id}. ${Q.message}`;throw this.#e.error({message:ce,appId:n.id,exception:Q}),new Error(ce)})};#g=async({id:n,name:o,hostUrl:f,manifestPath:y,homeRoute:x,history:O,theme:j})=>{const L=window.emui?.[n];if(!L)throw new Error(`Application ${o} with ${n} is not found. Most probably the appId property of app.config.json is not set to ${n}`);if(!L.init||typeof L.init!="function")throw new Error(`Application ${o} with id ${n} doesn't expose init method`);const D=new On({guest:{id:n},version:this.#t,logger:this.#e,soManager:this.#i,eventManager:this.#c});return L.init({host:D,hostUrl:f,manifestPath:y,homeRoute:x,prevState:null,history:O,theme:j,hostBreakpoint:Sr(),hostViewportSize:tr(),logger:this.#e})};#m=async n=>{const{id:o,files:f,name:y,hostUrl:x,documentEle:O}=n;this.#e.debug(`Application ${o} is loading...`);let j=f;const L=await Tr.get(n);j=Tr.getFullFileNameofAssets(L,f);let D=0;const W=j.map(Q=>{D+=1;const ce={name:y,hostUrl:x,documentEle:O,fileName:Q,index:D};return Tn(Q)?this.#n.add(ce):this.#r.add(ce)});await this.#h(n,W),this.#e.audit({message:"Application loaded",appId:o})};#l=({id:n,hostUrl:o,documentEle:f})=>{this.#e.debug(`Application ${n} unloading...`),window.emui?.[n]&&(this.#f(n,f),this.#r.removeDynamicImportedScripts(o,f),this.#r.removePrefetchLinks(o,f),this.#n.removeDynamicImportedStyles(o,f),window.emui?.[n]&&delete window.emui[n],this.#a.delete(n),this.#e.info({message:"Application unloaded",appId:n}))};#u=async({id:n,name:o})=>{const f=window.emui?.[n]||{};if(!f?.mount||typeof f?.mount!="function")throw new Error(`Application ${o} with id ${n} doesn't expose mount method`);return f.mount({containerId:`${jr}${n}`,hostBreakpoint:Sr(),hostViewportSize:tr()})};#p=({id:n,name:o})=>{const f=window.emui?.[n]||{};if(!f?.unmount)return null;if(typeof f.unmount!="function")throw new Error(`Application ${o} with id ${n} doesn't expose unmount method`);return f.unmount({containerId:`${jr}${n}`})};addScriptingObject=(n,o)=>{this.#i.addScriptingObject(n,o)};closeAllApps=async()=>{await Promise.all([...this.#a.keys()].map(this.closeApp))};closeApp=async n=>{if(!n)throw new Error("id is required");const o=this.#s.getConfigById(n);if(!o)throw new Error(`Application with id ${n} is not found`);const{name:f,hostUrl:y}=o;try{await this.#p({id:n,name:f})}finally{const x=we.get(n);if(!x?.contentDocument)throw new Error(`Iframe for application with id ${n} is not found`);this.#l({id:n,hostUrl:y,documentEle:x.contentDocument}),this.#i.removeAllScriptingObjects(n),we.remove(n)}};dispatchEvent=async n=>this.#c.dispatchEvent(n);getGuest=n=>this.#a.get(n)?.guest;getGuests=()=>[...this.#a.values()].map(n=>n.guest);init=async()=>{await this.#o.load(),this.#s.init({version:this.#t,appConfig:this.#o})};mountApp=async n=>{if(!n)throw new Error("id is required");const o=this.#s.getConfigById(n);if(!o)throw new Error(`Application with id ${n} is not found`);await this.#u(o)};openApp=async n=>{const{id:o,frameOptions:f,history:y,theme:x}=n,O=this.#s.getConfigById(o);if(!O)throw new Error(`Application with id ${o} is not found`);if(we.get(o))throw new Error(`Application with id ${o} is already open`);const j=await we.create(o,{title:O.name,...f});if(!j?.contentDocument)throw new Error("unable to create iframe for the microapp");try{return await this.#m({...O,history:y,theme:x,documentEle:j.contentDocument}),await this.#u(O),this.#a.get(o)?.guest}catch(L){throw this.#l({id:o,hostUrl:O.hostUrl,documentEle:j.contentDocument}),we.remove(o),L}};publish=(n,o)=>(0,v.publish)(n,o);removeAllEventListeners=()=>{this.#c.unsubscribeAll()};removeScriptingObject=n=>{this.#i.removeScriptingObject(n)};unmountApp=async n=>{if(!n)throw new Error("id is required");const o=this.#s.getConfigById(n);if(!o)throw new Error(`Application with id ${n} is not found`);await this.#p(o)}}})(),Gt})());
|
|
24
24
|
|
|
25
|
-
//# sourceMappingURL=emuiAppBridge.
|
|
25
|
+
//# sourceMappingURL=emuiAppBridge.7eb553b783d990bdde1c.js.map
|
|
Binary file
|