@elliemae/pui-app-bridge 2.26.0-alpha.0 → 2.26.0-alpha.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.
@@ -681,6 +681,10 @@ class CAppBridge {
681
681
  if (iframeWindow) {
682
682
  iframeWindow.emui = iframeWindow.emui ?? {};
683
683
  iframeWindow.emui.__host = microFEHost;
684
+ iframeWindow.emui.getHost = () => (
685
+ // eslint-disable-next-line no-underscore-dangle
686
+ iframeWindow.emui?.__host ?? null
687
+ );
684
688
  }
685
689
  const preconnect = frameDoc.createElement("link");
686
690
  preconnect.rel = "preconnect";
@@ -656,6 +656,10 @@ class CAppBridge {
656
656
  if (iframeWindow) {
657
657
  iframeWindow.emui = iframeWindow.emui ?? {};
658
658
  iframeWindow.emui.__host = microFEHost;
659
+ iframeWindow.emui.getHost = () => (
660
+ // eslint-disable-next-line no-underscore-dangle
661
+ iframeWindow.emui?.__host ?? null
662
+ );
659
663
  }
660
664
  const preconnect = frameDoc.createElement("link");
661
665
  preconnect.rel = "preconnect";
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.dc4dbeb6feea171656da.js"></script></head><body class="bg-gray-50"><header class="bg-indigo-600 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">AppBridge E2E — Comprehensive Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">&larr; Back to dashboard</a></header><main class="mx-auto max-w-7xl px-4 py-4"><div class="bg-blue-50 border border-blue-200 rounded-md p-3 mb-4"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 list-decimal ml-4 space-y-1"><li>Wait for <strong>"E2E Host ready"</strong> in the Event Log.</li><li>Use buttons in each section to test AppBridge features.</li><li>Check Event Log and result panels for expected output.</li><li>Work through the Verification Checklist at the bottom.</li></ol></div><div class="grid grid-cols-3 gap-4"><div class="col-span-2 space-y-4"><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Loading</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-open-app" id="btnOpenApp" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (pricingservice)</button> <button data-testid="btn-open-credit" id="btnOpenCredit" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (creditservice)</button> <button data-testid="btn-open-validation" id="btnOpenValidation" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (loanvalidation)</button> <button data-testid="btn-open-with-metadata" id="btnOpenWithMetadata" class="rounded bg-purple-600 px-3 py-1 text-xs text-white hover:bg-purple-700">Open App with Metadata</button> <button data-testid="btn-open-e2e-guest" id="btnOpenE2EGuest" class="rounded bg-teal-600 px-3 py-1 text-xs text-white hover:bg-teal-700">Open E2E Test Guest</button> <button data-testid="btn-open-nested-chain" id="btnOpenNestedChain" class="rounded bg-orange-600 px-3 py-1 text-xs text-white hover:bg-orange-700">Open Nested Chain (A→B→C)</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> App loads into the container below. Log shows "openApp" succeeded. The E2E Test Guest provides interactive buttons to test guest→host communication. The Nested Chain (A→B→C) opens an intermediate that clones Loan and re-exposes it to a grandchild — use C's buttons to verify callChain propagation on Host A.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Scripting Object Management</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-add-so" id="btnAddSO" class="rounded bg-green-600 px-3 py-1 text-xs text-white hover:bg-green-700">Add "Inventory" Object</button> <button data-testid="btn-remove-so" id="btnRemoveSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove "Inventory" Object</button> <button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove All Objects</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> Add succeeds. Remove succeeds. Guest apps can/cannot call removed objects.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Event Dispatching</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-dispatch-presave" id="btnDispatchPreSave" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onPreSave (all apps)</button> <button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanAmountChanged</button> <button data-testid="btn-dispatch-term" id="btnDispatchTerm" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanTermChanged</button></div><div data-testid="dispatch-result" id="dispatchResult" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[40px]">Dispatch results appear here...</div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">callContext (from last scripting object invocation)</h2><div class="grid grid-cols-2 gap-2"><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.guest</h3><pre data-testid="call-context-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E — Comprehensive Host Test</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.2cb0198671d2a7602aaa.js"></script></head><body class="bg-gray-50"><header class="bg-indigo-600 text-white px-4 py-3 flex items-center justify-between"><h1 class="text-lg font-semibold">AppBridge E2E — Comprehensive Host Test</h1><a href="./e2e-index.html" class="text-indigo-200 hover:text-white text-sm">&larr; Back to dashboard</a></header><main class="mx-auto max-w-7xl px-4 py-4"><div class="bg-blue-50 border border-blue-200 rounded-md p-3 mb-4"><h2 class="text-sm font-bold text-blue-900 mb-1">How to Use This Page</h2><ol class="text-xs text-blue-800 list-decimal ml-4 space-y-1"><li>Wait for <strong>"E2E Host ready"</strong> in the Event Log.</li><li>Use buttons in each section to test AppBridge features.</li><li>Check Event Log and result panels for expected output.</li><li>Work through the Verification Checklist at the bottom.</li></ol></div><div class="grid grid-cols-3 gap-4"><div class="col-span-2 space-y-4"><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Loading</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-open-app" id="btnOpenApp" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (pricingservice)</button> <button data-testid="btn-open-credit" id="btnOpenCredit" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (creditservice)</button> <button data-testid="btn-open-validation" id="btnOpenValidation" class="rounded bg-indigo-600 px-3 py-1 text-xs text-white hover:bg-indigo-700">Open App (loanvalidation)</button> <button data-testid="btn-open-with-metadata" id="btnOpenWithMetadata" class="rounded bg-purple-600 px-3 py-1 text-xs text-white hover:bg-purple-700">Open App with Metadata</button> <button data-testid="btn-open-e2e-guest" id="btnOpenE2EGuest" class="rounded bg-teal-600 px-3 py-1 text-xs text-white hover:bg-teal-700">Open E2E Test Guest</button> <button data-testid="btn-open-nested-chain" id="btnOpenNestedChain" class="rounded bg-orange-600 px-3 py-1 text-xs text-white hover:bg-orange-700">Open Nested Chain (A→B→C)</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> App loads into the container below. Log shows "openApp" succeeded. The E2E Test Guest provides interactive buttons to test guest→host communication. The Nested Chain (A→B→C) opens an intermediate that clones Loan and re-exposes it to a grandchild — use C's buttons to verify callChain propagation on Host A.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Scripting Object Management</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-add-so" id="btnAddSO" class="rounded bg-green-600 px-3 py-1 text-xs text-white hover:bg-green-700">Add "Inventory" Object</button> <button data-testid="btn-remove-so" id="btnRemoveSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove "Inventory" Object</button> <button data-testid="btn-remove-all-so" id="btnRemoveAllSO" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Remove All Objects</button></div><p class="text-xs text-gray-400 mt-1"><strong>Expected:</strong> Add succeeds. Remove succeeds. Guest apps can/cannot call removed objects.</p></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">Event Dispatching</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-dispatch-presave" id="btnDispatchPreSave" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onPreSave (all apps)</button> <button data-testid="btn-dispatch-amount" id="btnDispatchAmount" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanAmountChanged</button> <button data-testid="btn-dispatch-term" id="btnDispatchTerm" class="rounded bg-yellow-600 px-3 py-1 text-xs text-white hover:bg-yellow-700">Dispatch onLoanTermChanged</button></div><div data-testid="dispatch-result" id="dispatchResult" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[40px]">Dispatch results appear here...</div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">callContext (from last scripting object invocation)</h2><div class="grid grid-cols-2 gap-2"><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.guest</h3><pre data-testid="call-context-guest" id="callContextGuest" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
2
2
  Waiting for invocation...</pre></div><div><h3 class="text-xs font-medium text-gray-500 mb-1">callContext.callChain</h3><pre data-testid="call-context-chain" id="callContextChain" class="text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
3
3
  Waiting for invocation...</pre></div></div></div><div class="bg-white rounded-lg shadow p-4"><h2 class="text-sm font-semibold text-gray-700 mb-2">App Lifecycle</h2><div class="flex flex-wrap gap-2"><button data-testid="btn-close-app" id="btnCloseApp" class="rounded bg-red-600 px-3 py-1 text-xs text-white hover:bg-red-700">Close First App</button> <button data-testid="btn-close-all" id="btnCloseAll" class="rounded bg-red-800 px-3 py-1 text-xs text-white hover:bg-red-900">Close All Apps</button> <button data-testid="btn-list-apps" id="btnListApps" class="rounded bg-gray-600 px-3 py-1 text-xs text-white hover:bg-gray-700">List Apps</button></div><pre data-testid="app-list" id="appList" class="mt-2 text-xs bg-gray-100 rounded p-2 min-h-[30px] whitespace-pre-wrap">
4
4
  (no apps)</pre></div></div><div class="space-y-4"><div class="bg-white rounded-lg shadow p-3"><h2 class="text-sm font-semibold text-gray-700 mb-2">Guest App Container</h2><div data-testid="app-container" id="appContainer" class="border-2 border-dashed border-indigo-300 rounded-lg" style="height:700px;overflow:auto"></div></div><div class="bg-white rounded-lg shadow p-3"><div class="flex justify-between items-center mb-2"><h2 class="text-sm font-semibold text-gray-700">Event Log</h2><button data-testid="btn-clear-log" id="btnClearLog" class="rounded bg-gray-200 px-2 py-0.5 text-xs text-gray-600 hover:bg-gray-300">Clear</button></div><div data-testid="event-log" id="eventLog" class="text-xs bg-gray-100 rounded p-2 min-h-[200px] max-h-[400px] overflow-y-auto"></div></div></div></div><div class="bg-gray-100 border border-gray-300 rounded-md p-3 mt-4"><h2 class="text-sm font-bold text-gray-800 mb-2">Verification Checklist</h2><div class="grid grid-cols-2 gap-2 text-xs"><label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-01:</strong> openApp loads pricingservice into container, log shows mounted</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-02:</strong> openApp loads creditservice into container</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-03:</strong> openApp loads loanvalidation into container</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-APP-04:</strong> openApp with metadata — metadata stored for callChain</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-01:</strong> Loan object registered on init (guest apps can call getLoanDetails)</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-02:</strong> Add Inventory object succeeds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-03:</strong> Remove Inventory object succeeds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-04:</strong> removeAllScriptingObjects clears everything</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-05:</strong> callContext.guest populated when guest invokes scripting object method</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-SO-06:</strong> Loan.getLoanDetails returns expected loan data</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-01:</strong> Dispatch onPreSave reaches all subscribed apps, results returned</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-02:</strong> Dispatch onLoanAmountChanged reaches subscribed apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-EVT-03:</strong> Dispatch onLoanTermChanged reaches subscribed apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-01:</strong> closeApp removes first app from list</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-02:</strong> List Apps shows all active apps with instanceIds</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-03:</strong> closeAllApps removes all apps</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-LIFE-04:</strong> No console errors during any operation</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-META-01:</strong> openApp with metadata — callContext.callChain contains metadata when guest invokes cloned object</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-01:</strong> Guest getObject("Loan") returns proxy with expected methods (getLoanDetails, setCreditScore)</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-02:</strong> Guest Loan.getLoanDetails() returns loan data, host callContext.guest shows e2etestguest</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-03:</strong> Guest Loan.setCreditScore(800) returns {updated: true}, host callContext updates</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-04:</strong> Guest getObject("Inventory") returns proxy after host adds it; null before</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-05:</strong> Guest Inventory.getItems() returns item array</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-06:</strong> Guest getObject("NonExistent") returns null</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-07:</strong> Guest subscribes to onPreSave — receives event when host dispatches</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-08:</strong> Guest subscribes to onLoanAmountChanged — receives event when host dispatches</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-GUEST-09:</strong> Guest unsubscribe all — no more events received after unsubscribe</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-01:</strong> Open Nested Chain — Intermediate B loads, shows "CAppBridge B initialized"</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-02:</strong> Grandchild C (E2E Test Guest) appears inside Intermediate B</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-03:</strong> In C: getObject("Loan") → Loan.getLoanDetails() → Host A shows callContext.guest = e2eintermediateguest, callChain = [{id: "e2etestguest", metadata: {role: "grandchild", ...}}]</span></label> <label class="flex items-start gap-2"><input type="checkbox" class="mt-0.5"/> <span><strong>TC-CHAIN-04:</strong> In C: Loan.setCreditScore(800) → Host A callChain includes e2etestguest with metadata from B</span></label></div></div></main><script src="./e2e-host.js" type="module"></script></body></html>
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiAppBridge.dc4dbeb6feea171656da.js"></script></head><body class="bg-gray-50"><header class="bg-gray-900 text-white px-6 py-4"><h1 class="text-xl font-bold">AppBridge End-to-End Test Suite</h1><p class="text-sm text-gray-400 mt-1">Comprehensive blackbox tests for AppBridge (in-process micro-frontend framework). Each page includes test steps, expected values, and a verification checklist.</p></header><main class="mx-auto max-w-5xl px-6 py-6"><section class="mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4"><h2 class="text-sm font-semibold text-yellow-800 mb-2">Setup Instructions</h2><ol class="text-xs text-yellow-700 list-decimal ml-4 space-y-1"><li>Install dependencies: <code class="bg-yellow-100 px-1 rounded">pnpm install</code></li><li>Start AppBridge dev server: <code class="bg-yellow-100 px-1 rounded">cd libs/app-bridge && pnpm start</code> (default port 3000)</li><li>Open <code class="bg-yellow-100 px-1 rounded">http://localhost:3000/e2e-index.html</code> in the browser</li><li>Each test page has <code class="bg-yellow-100 px-1 rounded">data-testid</code> attributes for Playwright/Cypress selectors</li></ol></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">1. Core AppBridge Host Tests</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./e2e-host.html" data-testid="link-e2e-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Comprehensive E2E Host</h3><p class="text-xs text-gray-500 mt-1">All host scenarios: openApp, closeApp, scripting objects, events, lifecycle, metadata, callContext.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Apps open and mount into containers. Scripting objects can be added/removed/invoked with correct callContext. Events reach subscribed apps. closeApp/closeAllApps cleans up properly.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-APP-01..04 &bull; TC-SO-01..06 &bull; TC-EVT-01..03 &bull; TC-LIFE-01..04 &bull; TC-META-01</div></a><a href="./index.html" data-testid="link-main-demo" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Main Demo App</h3><p class="text-xs text-gray-500 mt-1">Original Loan Application demo with credit, pricing, and loan validation micro-apps.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Loan form data flows to guest apps. Events (onLoanAmountChanged, etc.) update guest UIs. Credit score updates from guest. Save dispatches onPreSave with feedback.</p></a></div></section></main></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>AppBridge E2E Test Suite</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script defer="defer" src="js/emuiAppBridge.2cb0198671d2a7602aaa.js"></script></head><body class="bg-gray-50"><header class="bg-gray-900 text-white px-6 py-4"><h1 class="text-xl font-bold">AppBridge End-to-End Test Suite</h1><p class="text-sm text-gray-400 mt-1">Comprehensive blackbox tests for AppBridge (in-process micro-frontend framework). Each page includes test steps, expected values, and a verification checklist.</p></header><main class="mx-auto max-w-5xl px-6 py-6"><section class="mb-6 bg-yellow-50 border border-yellow-200 rounded-lg p-4"><h2 class="text-sm font-semibold text-yellow-800 mb-2">Setup Instructions</h2><ol class="text-xs text-yellow-700 list-decimal ml-4 space-y-1"><li>Install dependencies: <code class="bg-yellow-100 px-1 rounded">pnpm install</code></li><li>Start AppBridge dev server: <code class="bg-yellow-100 px-1 rounded">cd libs/app-bridge && pnpm start</code> (default port 3000)</li><li>Open <code class="bg-yellow-100 px-1 rounded">http://localhost:3000/e2e-index.html</code> in the browser</li><li>Each test page has <code class="bg-yellow-100 px-1 rounded">data-testid</code> attributes for Playwright/Cypress selectors</li></ol></section><section class="mb-6"><h2 class="text-lg font-semibold text-gray-800 border-b pb-1 mb-3">1. Core AppBridge Host Tests</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-3"><a href="./e2e-host.html" data-testid="link-e2e-host" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Comprehensive E2E Host</h3><p class="text-xs text-gray-500 mt-1">All host scenarios: openApp, closeApp, scripting objects, events, lifecycle, metadata, callContext.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Apps open and mount into containers. Scripting objects can be added/removed/invoked with correct callContext. Events reach subscribed apps. closeApp/closeAllApps cleans up properly.</p><div class="mt-2 text-xs text-gray-400"><strong>Test Cases:</strong> TC-APP-01..04 &bull; TC-SO-01..06 &bull; TC-EVT-01..03 &bull; TC-LIFE-01..04 &bull; TC-META-01</div></a><a href="./index.html" data-testid="link-main-demo" class="block bg-white rounded-lg shadow p-4 hover:shadow-md transition"><h3 class="font-medium text-indigo-700">Main Demo App</h3><p class="text-xs text-gray-500 mt-1">Original Loan Application demo with credit, pricing, and loan validation micro-apps.</p><p class="text-xs text-gray-400 mt-2"><strong>What to verify:</strong> Loan form data flows to guest apps. Events (onLoanAmountChanged, etc.) update guest UIs. Credit score updates from guest. Save dispatches onPreSave with feedback.</p></a></div></section></main></body></html>
@@ -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><style nonce="__CSP_NONCE__">.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.dc4dbeb6feea171656da.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>
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><style nonce="__CSP_NONCE__">.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.2cb0198671d2a7602aaa.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>
@@ -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://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.dc4dbeb6feea171656da.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center justify-between"><div class="px-2">ICE Mortgage Product</div><nav class="flex gap-3 px-2 text-sm"><a href="./e2e-index.html" class="text-indigo-800 hover:text-indigo-950 font-medium">E2E Test Suite</a> <a href="./e2e-host.html" class="text-indigo-800 hover:text-indigo-950 font-medium">E2E Host</a></nav></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>
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://cdn.mortgagetech.q1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.2cb0198671d2a7602aaa.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center justify-between"><div class="px-2">ICE Mortgage Product</div><nav class="flex gap-3 px-2 text-sm"><a href="./e2e-index.html" class="text-indigo-800 hover:text-indigo-950 font-medium">E2E Test Suite</a> <a href="./e2e-host.html" class="text-indigo-800 hover:text-indigo-950 font-medium">E2E Host</a></nav></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>
@@ -12,6 +12,6 @@
12
12
  @media (max-width: ${r[n]}) {
13
13
  ${mt(s,...c)};
14
14
  }
15
- `,t),{}),bn=r=>({space:{...r.spaces,xxxs:r.spaces[1],xxs:r.spaces[2],xxs2:r.spaces[3],xs:r.spaces[4],s:r.spaces[5],m:r.spaces[6],l:r.spaces[7],xl:r.spaces[8],xxl:r.spaces[9]},fontSizes:{...r.fontSizes,title:{500:r.fontSizes[3],600:r.fontSizes[4],700:r.fontSizes[5],800:r.fontSizes[6],900:r.fontSizes[7]},subTitle:{300:r.fontSizes[1],400:r.fontSizes[2]},label:{200:r.fontSizes[0],300:r.fontSizes[1],400:r.fontSizes[2]},value:{300:r.fontSizes[1],400:r.fontSizes[2],500:r.fontSizes[3],600:r.fontSizes[4]},hyperlink:{200:r.fontSizes[0],300:r.fontSizes[1],400:r.fontSizes[2]},microText:{200:r.fontSizes[0]}},fontWeights:{...r.fontWeights,thin:r.fontWeights[0],light:r.fontWeights[1],regular:r.fontWeights[3],semibold:r.fontWeights[5],bold:r.fontWeights[8]},lineHeights:{...r.lineHeights,r:r.lineHeights[0],m:r.lineHeights[1],l:r.lineHeights[2],xl:r.lineHeights[3]},letterSpacings:{normal:r.letterSpacings[0],tracked:r.letterSpacings[1],tight:r.letterSpacings[2],mega:r.letterSpacings[3]},fonts:{...r.fonts,default:r.fonts[0]},colors:{neutral:{"000":r.colors.neutral[0],"050":r.colors.neutral[1],"080":r.colors.neutral[2],100:r.colors.neutral[3],200:r.colors.neutral[4],300:r.colors.neutral[5],400:r.colors.neutral[6],500:r.colors.neutral[7],600:r.colors.neutral[8],700:r.colors.neutral[9],800:r.colors.neutral[10]},brand:{100:r.colors.brand[0],200:r.colors.brand[1],250:r.colors.brand[8],300:r.colors.brand[2],400:r.colors.brand[3],500:r.colors.brand[4],600:r.colors.brand[5],700:r.colors.brand[6],800:r.colors.brand[7]},success:{300:r.colors.success[0],400:r.colors.success[1],600:r.colors.success[2],900:r.colors.success[3],950:r.colors.success[4]},warning:{400:r.colors.warning[0],500:r.colors.warning[1],600:r.colors.warning[1],900:r.colors.warning[2],950:r.colors.warning[3]},danger:{200:r.colors.danger[0],400:r.colors.danger[1],600:r.colors.danger[2],900:r.colors.danger[3],950:r.colors.danger[4]}},shadows:{xs:r.shadows[0],s:r.shadows[1],m:r.shadows[2],l:r.shadows[3],xl:r.shadows[4]},breakpoints:{...r.breakpoints,xsmall:r.breakpoints[3],small:r.breakpoints[0],medium:r.breakpoints[1],large:r.breakpoints[2]},media:yn({xsmall:r.breakpoints[3],small:r.breakpoints[0],medium:r.breakpoints[1],large:r.breakpoints[2]}),zIndex:{dialog:r.zIndex[0],popper:r.zIndex[1],tooltip:r.zIndex[2],backdrop:r.zIndex[3],loader:r.zIndex[4]},states:{_:r.states[0],motionSafe:r.states[1],motionReduce:r.states[2],first:r.states[3],last:r.states[4],odd:r.states[5],even:r.states[6],visited:r.states[7],checked:r.states[8],focusWithin:r.states[9],hover:r.states[10],focus:r.states[11],focusVisible:r.states[12],active:r.states[13],disabled:r.states[14],placeholder:r.states[15]}}),wn=((r=_())=>()=>bn(r))(),ts=()=>{try{return window.parent.document,window.parent}catch{return window}},lr=()=>({width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}),Mr=r=>Number(r.replace("px","")),$r=()=>{const{width:r}=lr(),{breakpoints:t}=wn();return r<=Mr(t.small)?"small":r<=Mr(t.medium)?"medium":"large"},xn="microFrontendApps",Sn=()=>!0,An=r=>Sn()?!0:String(r).toLowerCase()===z.PRODUCTION.toLowerCase(),En=r=>r?new URL(r).pathname:"",Cn=r=>{const t=document.createElement("a");return t.href=r,t.href},On=(r,t)=>{const n=t.match(/^(?:\d+\.\d+)*/g);return r.replace(/{SYSTEM_VERSION}/,n&&n[0]||x)},Fr=r=>!r||!r.length?!1:r.every(t=>typeof t=="string"),Tn=(r,t)=>{const{mode:n=z.PRODUCTION}=t;if(String(n).toLowerCase()!==z.PRODUCTION.toLowerCase()&&String(n).toLowerCase()!==z.DEVELOPMENT.toLowerCase())throw new Error(`invalid mode '${String(n)}' for ${r}`);const{production:s,development:c,microappManager:h=ie.APPSDK}=t;if(String(h).toLowerCase()===ie.APPSDK.toLowerCase()){if(String(n).toLowerCase()===z.PRODUCTION.toLowerCase()){if(!s)throw new Error(`microFrontendApps.${r} is missing production section in app.config.json`);if(!Fr(s.files))throw new Error("invalid value for production.files")}if(String(n).toLowerCase()===z.DEVELOPMENT.toLowerCase()){if(!c)throw new Error(`microFrontendApps.${r} is missing development section in app.config.json`);if(!Fr(c.files))throw new Error("invalid value for development.files")}}},Pn=({id:r,config:t,version:n="latest"})=>{const{mode:s=z.PRODUCTION,production:c,development:h,...m}=t,b=An(s)?c:h,S=v()({id:r},{name:r,mode:z.PRODUCTION,manifestPath:"./{SYSTEM_VERSION}/",securityContext:o.USER,isJsModule:!0},m,{mode:s},b);return S.hostUrl=F(Cn(S.hostUrl||"")),S.homeRoute=F(S.homeRoute)||En(S.hostUrl),S.manifestPath=F(On(S.manifestPath,n)),S};class In{#e=[];init=({version:t,appConfig:n})=>{const s=n.get(xn);s&&(this.#e=Object.keys(s).map(c=>(Tn(c,s[c]),Pn({id:c,config:s[c],version:t}))))};getConfigById=t=>this.#e.find(n=>n.id===t)}const jn="ice-script-";class Lr{#e;constructor(t){this.#e=t}#t=({href:t,isESMModule:n=!0,documentEle:s})=>{const c=s.createElement("link");c.rel=n?"modulepreload":"preload",c.href=t,c.crossOrigin="anonymous",n||(c.as="script"),s.head.appendChild(c)};#r=({id:t,href:n,documentEle:s,isESMModule:c=!0})=>new Promise((h,m)=>{const b=s.createElement("script");b.id=t,b.src=O(n),b.crossOrigin="anonymous",b.nonce="__CSP_NONCE__",!L()&&c?b.type="module":b.async=!1,b.onload=h.bind(null,b.id),b.onerror=S=>{this.#e.error({message:`Error loading script ${b.src}`,exception:new Error(S)}),m(new Error(`Unable to load script ${b.src}`,{cause:new Error(S)}))},s.head.appendChild(b)});load=async(t,n)=>{const{documentEle:s,isESMModule:c}=n,h=/^https?:\/\//i,{cdnAssets:m,nonCdnAssets:b}=t.reduce((E,T,I)=>{const k=`${jn}${n.name.toLowerCase()}-${I}`;if(h.test(T))E.cdnAssets.push({id:k,href:T}),this.#t({href:T,documentEle:s,isESMModule:c});else{const K=new URL(T,n.hostUrl);E.nonCdnAssets.push({id:k,href:K.href}),this.#t({href:K.href,documentEle:s,isESMModule:c})}return E},{cdnAssets:[],nonCdnAssets:[]}),S=[...m,...b];return await Promise.all(S.map(({id:E,href:T})=>this.#r({id:E,href:T,documentEle:s,isESMModule:c}))),S.map(E=>E.id)};remove=(t="",n=document)=>new Promise(s=>{const c=n.getElementById(t);if(!c){this.#e.warn(`script with id ${t} not found`),s();return}c.remove(),s()});removeDynamicImportedScripts=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.getElementsByTagName("script");for(let h=c.length-1;h>=0;h-=1){const m=c[h],{src:b}=m;s.test(b)&&m.remove()}};removePrefetchLinks=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.querySelectorAll('[rel="prefetch"]');for(let h=c.length-1;h>=0;h-=1){const m=c[h],{href:b}=m;s.test(b)&&m.remove()}}}const Rn="ice-style-";class Dr{#e;constructor(t){this.#e=t}#t=({id:t,href:n,documentEle:s})=>new Promise((c,h)=>{const m=s.createElement("link");m.id=t,m.nonce="__CSP_NONCE__",m.rel="stylesheet",m.href=O(n),m.onload=c.bind(null,m.id),m.onerror=b=>{this.#e.error({message:`Error loading stylesheet ${m.href}`,exception:new Error(b)}),h(new Error(`Unable to load stylesheet ${m.href}`,{cause:new Error(b)}))},s.head.appendChild(m)});load=async(t,n)=>{const s=[],c=t.map((h,m)=>{const b=new URL(h,n.hostUrl),S=`${Rn}${n.name.toLowerCase()}-${m}`;return s.push(S),this.#t({id:S,href:b.href,documentEle:n.documentEle})});return await Promise.all(c),s};remove=(t="",n=document)=>new Promise(s=>{const c=n.getElementById(t);if(!c){this.#e.warn(`style with id ${t} not found`),s();return}c.remove(),s()});removeDynamicImportedStyles=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.querySelectorAll('[rel="stylesheet"]');for(let h=c.length-1;h>=0;h-=1){const m=c[h],{href:b}=m;s.test(b)&&m.remove()}}}const Mn=r=>r.replace(/\/\d+\.\d+/,"/latest"),$n=r=>{let t;try{t=new URL(r)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"},ur=new Map,Dt={get:async({hostUrl:r,manifestPath:t})=>{const n=new URL(`${t}manifest.json`,r),s=O(n.href),c=ur.get(s);if(c)return c;const h=async m=>{const b=await fetch(m);if(!b.ok)throw new Error(`unable to get manifest ${m}`);if(!(b.headers?.get?.("content-type")??"").includes("application/json"))throw new Error(`manifest ${m} is not a valid json`);const E=await b.json();return ur.set(m,E),E};try{return await h(s)}catch(m){const b=Mn(t);if(t!==b){const S=O(new URL(`${b}manifest.json`,r).href);return await h(S)}throw m}},getFullFileNameofAssets:(r,t=[])=>t.reduce((n,s)=>{const c=r[s];if(c)n.push(c);else if($n(s))n.push(s);else throw new Error(`unable to locate ${s} in manifest`);return n},[]),clearCache:()=>ur.clear()};class Nr{#e;#t;#r;#o;#n;constructor(t){this.#t=t.guest,this.#e=t.containerId,this.#r=t?.version||x,this.#o=t.soManager,this.#n=t.eventManager}get version(){return this.#r}getObject=t=>{try{const n=this.#o.getObject(t,this.#t);if(!n)return Promise.resolve(null);const s=new Gt(n.id,n.objectType);return Object.keys(n).forEach(c=>{const h=n[c];h instanceof ae?Object.defineProperty(s,c,{value:new ae({name:c,objectId:n.id}),enumerable:!0}):re(h,c)&&Object.defineProperty(s,c,{value:(...m)=>{const b=s[c]?.callContext?.callChain;return Object.defineProperty(h,"callContext",{value:{guest:this.#t,...b?.length?{callChain:b}:{}},configurable:!0,enumerable:!0,writable:!0}),n[c](...m)},enumerable:!0})}),Promise.resolve(s)}catch(n){return Promise.reject(n)}};setAppWindowSize=t=>{if(!this.#e)return;const{size:n}=t,s=document.getElementById(this.#e);s&&(s.style.height=`${n.height}px`,s.style.width=`${n.width}px`)};subscribe=t=>this.#n.subscribe(t);unsubscribe=t=>{this.#n.unsubscribe(t)}}class Fn{constructor(){window.emui||(window.emui={}),window.emui.registerApp=this.#e}#e=({appId:t,app:n})=>{if(!t)throw new Error("appId is required");if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error(`Invalid appId: ${t}`);if(!n?.uuid)throw new Error("application uuid is required");if(window.emui[t]=window.emui[t]||[],Array.isArray(window.emui[t])){const s=window.emui[t].findIndex(c=>c.uuid===n.uuid);s>-1?window.emui[t][s]=n:window.emui[t].push(n)}else{let s=window.emui[t];s?.uuid===n.uuid?(s={...s,...n},window.emui[t]=[s]):typeof s.init>"u"?window.emui[t]=[{...s,...n}]:window.emui[t]=[window.emui[t],n]}};get=({id:t,instanceId:n})=>{const s=window.emui?.[t];return Array.isArray(s)?s.find(h=>h.uuid===n)??null:s?.uuid===n?s:null};add=({id:t,instanceId:n,documentEle:s})=>{if(!n)throw new Error(`instanceId (uuid) is required to register application ${t}`);const c={uuid:n,init:null,mount:null,unmount:null},h=window.emui[t];h?Array.isArray(h)?h.push(c):window.emui[t]=[h,c]:window.emui[t]=[c],s.defaultView&&(s.defaultView.emui=s.defaultView.emui??{},s.defaultView.emui.uuid=n)};delete=({id:t,instanceId:n})=>{if(Array.isArray(window.emui[t])){const s=window.emui[t].findIndex(c=>c.uuid===n);s>-1&&window.emui[t].splice(s,1),window.emui[t].length===0&&delete window.emui[t]}else delete window.emui[t]}}const Ln=12e4,kr=["click","scroll","keypress","touchstart"],Dn=/\.css$/,Ur=r=>Dn.test(r);class Nn{#e;#t;#r;#o;#n;#i=new In;#s;#l;#a=new Map;#u=new Map;#c=new Fn;#p=!0;constructor(t){const{logger:n}=t;if(!n)throw new Error("logger is required");this.#e=t.logger,this.#t=t.version,this.#p=t.extendSession??!0,this.#n=new R({version:t.version,baseUrl:t.appConfigBaseUrl}),this.#r=new Lr(n),this.#o=new Dr(n),this.#s=new Vt,this.#l=new Ht(this.#e)}#g(t){return typeof t=="function"}#m=t=>t instanceof A||typeof t?.subscribe=="function";#v=(t,n)=>`Application ${t} with instance id ${n} is not found. Most probably the appId property of app.config.json is not set to ${t}`;#y=(t,n=document)=>{const{elementIds:s}=this.#a.get(t)||{};s&&s.forEach(c=>{const h=n.getElementById(c);h&&h.remove()})};#b=({id:t,instanceId:n,documentEle:s,elementIds:c,microFEHost:h})=>{const m=this.#c.get({id:t,instanceId:n});if(!m)throw new Error(this.#v(t,n));this.#a.set(n,{id:t,instanceId:n,elementIds:c,guest:{guestWindow:s?.defaultView,...m},microFEHost:h})};#w=async({id:t,instanceId:n,containerId:s,hostUrl:c,manifestPath:h,homeRoute:m,initialRoute:b,history:S,theme:E,microFEHost:T})=>{const I=this.#c.get({id:t,instanceId:n});if(!I)throw new Error(`Application ${t} with instance id ${n} is not found. Most probably the appId property of app.config.json is not set to ${t}`);if(!I.init||typeof I.init!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose init method`);const k=T??new Nr({guest:{id:t},version:this.#t,containerId:s,logger:this.#e,soManager:this.#s,eventManager:this.#l});return I.init({host:k,hostUrl:c,manifestPath:h,homeRoute:m,initialRoute:b,prevState:null,history:S,theme:E,hostBreakpoint:$r(),hostViewportSize:lr(),logger:this.#e})};#x=async t=>{try{const{id:n,instanceId:s,files:c,name:h,hostUrl:m,documentEle:b,isJsModule:S}=t;this.#e.debug(`Application ${n} with instance id ${s} is loading...`);let E=c;const T=t.manifest??await Dt.get(t);E=Dt.getFullFileNameofAssets(T,c);const I=E.filter(D=>Ur(D)),k=E.filter(D=>!Ur(D)),K={name:h,hostUrl:m,documentEle:b,isESMModule:S},[V,X]=await Promise.all([this.#o.load(I,K),this.#r.load(k,K)]);this.#b({id:n,instanceId:s,documentEle:b,elementIds:[...V,...X],microFEHost:t.microFEHost}),t.selfInitialize||await this.#w(t),this.#e.audit(`Application ${n} with instance id ${s} loaded`)}catch(n){const s=`Application load failed. Unable to load one or more resources for ${t.id} with instance id ${t.instanceId}. ${n.message}`;throw this.#e.error({message:s,appId:t.id,exception:n}),new Error(s)}};#d=({id:t,instanceId:n,hostUrl:s,documentEle:c})=>{this.#e.debug(`Application ${t} with instance id ${n} unloading...`),this.#c.get({id:t,instanceId:n})&&(this.#y(n,c),this.#r.removeDynamicImportedScripts(s,c),this.#r.removePrefetchLinks(s,c),this.#o.removeDynamicImportedStyles(s,c),this.#c.delete({id:t,instanceId:n}),this.#e.audit(`Application ${t} with instance id ${n} unloaded`))};#f=async({id:t,instanceId:n})=>{const s=this.#c.get({id:t,instanceId:n});if(!s?.mount||typeof s?.mount!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose mount method`);return s.mount({containerId:`${ft}${t}`,hostBreakpoint:$r(),hostViewportSize:lr()})};#h=({id:t,instanceId:n})=>{const s=this.#c.get({id:t,instanceId:n});if(!s?.unmount)return null;if(typeof s.unmount!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose unmount method`);return s.unmount({containerId:`${ft}${t}`})};#S=({id:t,instanceId:n})=>{if(this.#p)try{const s=this.#s.getObject(nt.Application);if(!s){this.#e.warn({message:`Application scripting object not available for ${t} to manage session`});return}const c=this.#a.get(n);if(!c)return;c.keepAlive=W()(async()=>{try{await s.keepSessionAlive()}catch(m){this.#e.error(`Error keeping session alive. ${m.message}`)}},Ln);const h=Re.get(n);kr.forEach(m=>{h?.contentDocument?.addEventListener(m,c.keepAlive)})}catch(s){this.#e.warn({message:`Application scripting object not available for ${t} to manage session`,exception:s})}};#A=(t,n)=>{const h=this.#s.getObject(nt.Module,{id:t})?._setUnloadHandler;typeof h=="function"&&h(()=>this.closeApp(n))};#E=async t=>{const n=this.#s.getObject(nt.Module,{id:t});if(!n)return!0;try{const s=await this.#l.dispatchEvent(n,{event:{id:"module.unloading",name:"unloading"},eventParams:{moduleId:t},eventOptions:{timeout:1e3}});if(Array.isArray(s)&&s.some(c=>c===!1))return this.#e.info(`Unload denied by guest ${t} via module.unloading event`),!1}catch(s){this.#e.warn({message:`Error dispatching module.unloading event for ${t}`,exception:s})}return!0};#C=t=>{if(!this.#p||!t)return;const{keepAlive:n,instanceId:s}=t;if(n){const h=Re.get(s)?.contentDocument;h&&kr.forEach(m=>{h.removeEventListener(m,n)}),t.keepAlive?.cancel()}};addScriptingObject=(t,n)=>{if(Ot(t)){const s=this.cloneScriptingObject(t);this.#s.addScriptingObject(s,n)}else this.#s.addScriptingObject(t,n)};cloneScriptingObject=t=>{if(!t)throw new Error("proxy is required");const n=new fe(t.id,t.objectType);let s=[];return Object.keys(t).forEach(c=>{const h=t[c];if(this.#m(h)){const m=new ae({name:h.name||c,objectId:n.id});Object.defineProperty(n,c,{value:m,enumerable:!0});const b=({eventParams:E,eventOptions:T})=>this.dispatchEvent({event:m,eventParams:E,eventOptions:T}),S=h.subscribe(b);s.push(()=>{h.unsubscribe(S)})}else if(this.#g(h)&&(Object.defineProperty(n,c,{value:async(...m)=>{const b=n[c]?.callContext;if(b?.guest){const E=b.callChain??[],T=b.guest.id,I=this.#u.get(T),k={id:T};I&&(k.metadata=I),Object.defineProperty(h,"callContext",{value:{callChain:[...E,k]},configurable:!0,enumerable:!0,writable:!0})}const S=await h(...m);return Ot(S)?this.cloneScriptingObject(S):S},enumerable:!0}),c==="dispose")){const m=n.dispose;Object.defineProperty(n,c,{value:()=>(n._dispose(),m.apply(n)),enumerable:!0})}}),n._dispose=()=>{s.forEach(c=>{c?.()}),s=[]},n};closeAllApps=async()=>{await Promise.all([...this.#a.keys()].map(this.closeApp))};closeApp=async t=>{if(!t)throw new Error("instanceId is required");const n=this.#a.get(t);if(!n){this.#e.warn(`Application with instance id ${t} is not found`);return}const{id:s}=n;if(!await this.#E(s))return;const c=this.#i.getConfigById(s);if(!c){this.#e.warn(`Configuration for application ${s} is not found`),this.#a.delete(t),Re.remove(t);return}const{hostUrl:h}=c;try{this.#C(n),await this.#h({id:s,instanceId:t})}finally{const m=Re.get(t);m?.contentDocument&&this.#d({id:s,instanceId:t,hostUrl:h,documentEle:m.contentDocument}),this.#a.delete(t),this.#u.delete(s),Re.remove(t)}};dispatchEvent=async t=>{const{event:{id:n,name:s},eventOptions:c={}}=t,{guestId:h}=c;if(!n)throw new Error("Event Id is required");const m=n.split(".")?.[0],b=h?this.#s.getObject(m,{id:h}):this.#s.getObject(m);return b?this.#l.dispatchEvent(b,t):(this.#e.warn(`Attempt to dispatch event ${s} on unknown object ${m}`),Promise.resolve())};getApp=t=>this.#a.get(t)?.guest;getApps=()=>[...this.#a.values()].map(t=>t.guest);init=async t=>{t?this.#n.setPreloadedConfig(t):await this.#n.load(),this.#i.init({version:this.#t,appConfig:this.#n}),this.#O()};#O=()=>{const t=this.#n.get("microFrontendApps")??{},n=new Set;Object.keys(t).forEach(s=>{const c=this.#i.getConfigById(s);if(c?.hostUrl)try{n.add(new URL(c.hostUrl).origin)}catch{}}),n.forEach(s=>{const c=document.createElement("link");c.rel="preconnect",c.href=s,c.crossOrigin="anonymous",document.head.appendChild(c)})};mountApp=async t=>{if(!t)throw new Error("instanceId is required");const{id:n}=this.#a.get(t)||{};if(!n)throw new Error(`Application with instance id ${t} is not found`);const s=this.#i.getConfigById(n);if(!s)throw new Error(`Application with id ${n} is not found`);await this.#f({...s,instanceId:t})};#T=(t,n,s)=>{const c=new Nr({guest:{id:s.id},version:this.#t,containerId:s.containerId,logger:this.#e,soManager:this.#s,eventManager:this.#l}),h=t.defaultView;h&&(h.emui=h.emui??{},h.emui.__host=c);const m=t.createElement("link");return m.rel="preconnect",m.href=n.hostUrl,m.crossOrigin="anonymous",t.head.appendChild(m),c};openApp=async t=>{const{id:n,frameOptions:s,history:c,theme:h,homeRoute:m,initialRoute:b,metadata:S,selfInitialize:E}=t,T=Et();S&&this.#u.set(n,S);const I=this.#i.getConfigById(n);if(!I)throw new Error(`Application ${n} is not found in app config`);const k=Dt.get(I);k.catch(()=>{});const K=await Re.create({id:n,instanceId:T,manifestPath:I.manifestPath,hostUrl:I.hostUrl,options:{title:I.name,...s}});if(!K?.contentDocument)throw new Error("unable to create iframe for the microapp");try{this.#c.add({id:n,instanceId:T,documentEle:K.contentDocument});const V=this.#T(K.contentDocument,I,{id:n,containerId:s?.containerId}),X=await k;return await this.#x({instanceId:T,history:c,theme:h,documentEle:K.contentDocument,containerId:s?.containerId,...I,homeRoute:m??I.homeRoute,initialRoute:b,microFEHost:V,selfInitialize:E,manifest:X}),E||await this.#f({instanceId:T,...I}),this.#S({id:n,instanceId:T}),this.#A(n,T),T}catch(V){throw this.#d({id:n,instanceId:T,hostUrl:I.hostUrl,documentEle:K.contentDocument}),Re.remove(T),V}};removeAllEventSubscriptions=()=>{this.#l.unsubscribeAll()};removeAllScriptingObjects=t=>{this.#s.removeAllScriptingObjects(t)};removeScriptingObject=(t,n)=>{this.#s.removeScriptingObject(t,n)};warmUp=t=>{const n=this.#i.getConfigById(t);n&&Dt.get(n).catch(()=>{})};unmountApp=async t=>{if(!t)throw new Error("instanceId is required");const{id:n}=this.#a.get(t)||{};if(!n)throw new Error(`Application with instance id ${t} is not found`);const s=this.#i.getConfigById(n);if(!s)throw new Error(`Application with id ${n} is not found`);await this.#h({...s,instanceId:t})}}})(),kt})());
15
+ `,t),{}),bn=r=>({space:{...r.spaces,xxxs:r.spaces[1],xxs:r.spaces[2],xxs2:r.spaces[3],xs:r.spaces[4],s:r.spaces[5],m:r.spaces[6],l:r.spaces[7],xl:r.spaces[8],xxl:r.spaces[9]},fontSizes:{...r.fontSizes,title:{500:r.fontSizes[3],600:r.fontSizes[4],700:r.fontSizes[5],800:r.fontSizes[6],900:r.fontSizes[7]},subTitle:{300:r.fontSizes[1],400:r.fontSizes[2]},label:{200:r.fontSizes[0],300:r.fontSizes[1],400:r.fontSizes[2]},value:{300:r.fontSizes[1],400:r.fontSizes[2],500:r.fontSizes[3],600:r.fontSizes[4]},hyperlink:{200:r.fontSizes[0],300:r.fontSizes[1],400:r.fontSizes[2]},microText:{200:r.fontSizes[0]}},fontWeights:{...r.fontWeights,thin:r.fontWeights[0],light:r.fontWeights[1],regular:r.fontWeights[3],semibold:r.fontWeights[5],bold:r.fontWeights[8]},lineHeights:{...r.lineHeights,r:r.lineHeights[0],m:r.lineHeights[1],l:r.lineHeights[2],xl:r.lineHeights[3]},letterSpacings:{normal:r.letterSpacings[0],tracked:r.letterSpacings[1],tight:r.letterSpacings[2],mega:r.letterSpacings[3]},fonts:{...r.fonts,default:r.fonts[0]},colors:{neutral:{"000":r.colors.neutral[0],"050":r.colors.neutral[1],"080":r.colors.neutral[2],100:r.colors.neutral[3],200:r.colors.neutral[4],300:r.colors.neutral[5],400:r.colors.neutral[6],500:r.colors.neutral[7],600:r.colors.neutral[8],700:r.colors.neutral[9],800:r.colors.neutral[10]},brand:{100:r.colors.brand[0],200:r.colors.brand[1],250:r.colors.brand[8],300:r.colors.brand[2],400:r.colors.brand[3],500:r.colors.brand[4],600:r.colors.brand[5],700:r.colors.brand[6],800:r.colors.brand[7]},success:{300:r.colors.success[0],400:r.colors.success[1],600:r.colors.success[2],900:r.colors.success[3],950:r.colors.success[4]},warning:{400:r.colors.warning[0],500:r.colors.warning[1],600:r.colors.warning[1],900:r.colors.warning[2],950:r.colors.warning[3]},danger:{200:r.colors.danger[0],400:r.colors.danger[1],600:r.colors.danger[2],900:r.colors.danger[3],950:r.colors.danger[4]}},shadows:{xs:r.shadows[0],s:r.shadows[1],m:r.shadows[2],l:r.shadows[3],xl:r.shadows[4]},breakpoints:{...r.breakpoints,xsmall:r.breakpoints[3],small:r.breakpoints[0],medium:r.breakpoints[1],large:r.breakpoints[2]},media:yn({xsmall:r.breakpoints[3],small:r.breakpoints[0],medium:r.breakpoints[1],large:r.breakpoints[2]}),zIndex:{dialog:r.zIndex[0],popper:r.zIndex[1],tooltip:r.zIndex[2],backdrop:r.zIndex[3],loader:r.zIndex[4]},states:{_:r.states[0],motionSafe:r.states[1],motionReduce:r.states[2],first:r.states[3],last:r.states[4],odd:r.states[5],even:r.states[6],visited:r.states[7],checked:r.states[8],focusWithin:r.states[9],hover:r.states[10],focus:r.states[11],focusVisible:r.states[12],active:r.states[13],disabled:r.states[14],placeholder:r.states[15]}}),wn=((r=_())=>()=>bn(r))(),ts=()=>{try{return window.parent.document,window.parent}catch{return window}},lr=()=>({width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}),Mr=r=>Number(r.replace("px","")),$r=()=>{const{width:r}=lr(),{breakpoints:t}=wn();return r<=Mr(t.small)?"small":r<=Mr(t.medium)?"medium":"large"},xn="microFrontendApps",Sn=()=>!0,An=r=>Sn()?!0:String(r).toLowerCase()===z.PRODUCTION.toLowerCase(),En=r=>r?new URL(r).pathname:"",Cn=r=>{const t=document.createElement("a");return t.href=r,t.href},On=(r,t)=>{const n=t.match(/^(?:\d+\.\d+)*/g);return r.replace(/{SYSTEM_VERSION}/,n&&n[0]||x)},Fr=r=>!r||!r.length?!1:r.every(t=>typeof t=="string"),Tn=(r,t)=>{const{mode:n=z.PRODUCTION}=t;if(String(n).toLowerCase()!==z.PRODUCTION.toLowerCase()&&String(n).toLowerCase()!==z.DEVELOPMENT.toLowerCase())throw new Error(`invalid mode '${String(n)}' for ${r}`);const{production:s,development:c,microappManager:h=ie.APPSDK}=t;if(String(h).toLowerCase()===ie.APPSDK.toLowerCase()){if(String(n).toLowerCase()===z.PRODUCTION.toLowerCase()){if(!s)throw new Error(`microFrontendApps.${r} is missing production section in app.config.json`);if(!Fr(s.files))throw new Error("invalid value for production.files")}if(String(n).toLowerCase()===z.DEVELOPMENT.toLowerCase()){if(!c)throw new Error(`microFrontendApps.${r} is missing development section in app.config.json`);if(!Fr(c.files))throw new Error("invalid value for development.files")}}},Pn=({id:r,config:t,version:n="latest"})=>{const{mode:s=z.PRODUCTION,production:c,development:h,...m}=t,b=An(s)?c:h,S=v()({id:r},{name:r,mode:z.PRODUCTION,manifestPath:"./{SYSTEM_VERSION}/",securityContext:o.USER,isJsModule:!0},m,{mode:s},b);return S.hostUrl=F(Cn(S.hostUrl||"")),S.homeRoute=F(S.homeRoute)||En(S.hostUrl),S.manifestPath=F(On(S.manifestPath,n)),S};class In{#e=[];init=({version:t,appConfig:n})=>{const s=n.get(xn);s&&(this.#e=Object.keys(s).map(c=>(Tn(c,s[c]),Pn({id:c,config:s[c],version:t}))))};getConfigById=t=>this.#e.find(n=>n.id===t)}const jn="ice-script-";class Lr{#e;constructor(t){this.#e=t}#t=({href:t,isESMModule:n=!0,documentEle:s})=>{const c=s.createElement("link");c.rel=n?"modulepreload":"preload",c.href=t,c.crossOrigin="anonymous",n||(c.as="script"),s.head.appendChild(c)};#r=({id:t,href:n,documentEle:s,isESMModule:c=!0})=>new Promise((h,m)=>{const b=s.createElement("script");b.id=t,b.src=O(n),b.crossOrigin="anonymous",b.nonce="__CSP_NONCE__",!L()&&c?b.type="module":b.async=!1,b.onload=h.bind(null,b.id),b.onerror=S=>{this.#e.error({message:`Error loading script ${b.src}`,exception:new Error(S)}),m(new Error(`Unable to load script ${b.src}`,{cause:new Error(S)}))},s.head.appendChild(b)});load=async(t,n)=>{const{documentEle:s,isESMModule:c}=n,h=/^https?:\/\//i,{cdnAssets:m,nonCdnAssets:b}=t.reduce((E,T,I)=>{const k=`${jn}${n.name.toLowerCase()}-${I}`;if(h.test(T))E.cdnAssets.push({id:k,href:T}),this.#t({href:T,documentEle:s,isESMModule:c});else{const K=new URL(T,n.hostUrl);E.nonCdnAssets.push({id:k,href:K.href}),this.#t({href:K.href,documentEle:s,isESMModule:c})}return E},{cdnAssets:[],nonCdnAssets:[]}),S=[...m,...b];return await Promise.all(S.map(({id:E,href:T})=>this.#r({id:E,href:T,documentEle:s,isESMModule:c}))),S.map(E=>E.id)};remove=(t="",n=document)=>new Promise(s=>{const c=n.getElementById(t);if(!c){this.#e.warn(`script with id ${t} not found`),s();return}c.remove(),s()});removeDynamicImportedScripts=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.getElementsByTagName("script");for(let h=c.length-1;h>=0;h-=1){const m=c[h],{src:b}=m;s.test(b)&&m.remove()}};removePrefetchLinks=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.querySelectorAll('[rel="prefetch"]');for(let h=c.length-1;h>=0;h-=1){const m=c[h],{href:b}=m;s.test(b)&&m.remove()}}}const Rn="ice-style-";class Dr{#e;constructor(t){this.#e=t}#t=({id:t,href:n,documentEle:s})=>new Promise((c,h)=>{const m=s.createElement("link");m.id=t,m.nonce="__CSP_NONCE__",m.rel="stylesheet",m.href=O(n),m.onload=c.bind(null,m.id),m.onerror=b=>{this.#e.error({message:`Error loading stylesheet ${m.href}`,exception:new Error(b)}),h(new Error(`Unable to load stylesheet ${m.href}`,{cause:new Error(b)}))},s.head.appendChild(m)});load=async(t,n)=>{const s=[],c=t.map((h,m)=>{const b=new URL(h,n.hostUrl),S=`${Rn}${n.name.toLowerCase()}-${m}`;return s.push(S),this.#t({id:S,href:b.href,documentEle:n.documentEle})});return await Promise.all(c),s};remove=(t="",n=document)=>new Promise(s=>{const c=n.getElementById(t);if(!c){this.#e.warn(`style with id ${t} not found`),s();return}c.remove(),s()});removeDynamicImportedStyles=(t,n)=>{const s=new RegExp(B(t),"i"),c=n.querySelectorAll('[rel="stylesheet"]');for(let h=c.length-1;h>=0;h-=1){const m=c[h],{href:b}=m;s.test(b)&&m.remove()}}}const Mn=r=>r.replace(/\/\d+\.\d+/,"/latest"),$n=r=>{let t;try{t=new URL(r)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"},ur=new Map,Dt={get:async({hostUrl:r,manifestPath:t})=>{const n=new URL(`${t}manifest.json`,r),s=O(n.href),c=ur.get(s);if(c)return c;const h=async m=>{const b=await fetch(m);if(!b.ok)throw new Error(`unable to get manifest ${m}`);if(!(b.headers?.get?.("content-type")??"").includes("application/json"))throw new Error(`manifest ${m} is not a valid json`);const E=await b.json();return ur.set(m,E),E};try{return await h(s)}catch(m){const b=Mn(t);if(t!==b){const S=O(new URL(`${b}manifest.json`,r).href);return await h(S)}throw m}},getFullFileNameofAssets:(r,t=[])=>t.reduce((n,s)=>{const c=r[s];if(c)n.push(c);else if($n(s))n.push(s);else throw new Error(`unable to locate ${s} in manifest`);return n},[]),clearCache:()=>ur.clear()};class Nr{#e;#t;#r;#o;#n;constructor(t){this.#t=t.guest,this.#e=t.containerId,this.#r=t?.version||x,this.#o=t.soManager,this.#n=t.eventManager}get version(){return this.#r}getObject=t=>{try{const n=this.#o.getObject(t,this.#t);if(!n)return Promise.resolve(null);const s=new Gt(n.id,n.objectType);return Object.keys(n).forEach(c=>{const h=n[c];h instanceof ae?Object.defineProperty(s,c,{value:new ae({name:c,objectId:n.id}),enumerable:!0}):re(h,c)&&Object.defineProperty(s,c,{value:(...m)=>{const b=s[c]?.callContext?.callChain;return Object.defineProperty(h,"callContext",{value:{guest:this.#t,...b?.length?{callChain:b}:{}},configurable:!0,enumerable:!0,writable:!0}),n[c](...m)},enumerable:!0})}),Promise.resolve(s)}catch(n){return Promise.reject(n)}};setAppWindowSize=t=>{if(!this.#e)return;const{size:n}=t,s=document.getElementById(this.#e);s&&(s.style.height=`${n.height}px`,s.style.width=`${n.width}px`)};subscribe=t=>this.#n.subscribe(t);unsubscribe=t=>{this.#n.unsubscribe(t)}}class Fn{constructor(){window.emui||(window.emui={}),window.emui.registerApp=this.#e}#e=({appId:t,app:n})=>{if(!t)throw new Error("appId is required");if(t==="__proto__"||t==="constructor"||t==="prototype")throw new Error(`Invalid appId: ${t}`);if(!n?.uuid)throw new Error("application uuid is required");if(window.emui[t]=window.emui[t]||[],Array.isArray(window.emui[t])){const s=window.emui[t].findIndex(c=>c.uuid===n.uuid);s>-1?window.emui[t][s]=n:window.emui[t].push(n)}else{let s=window.emui[t];s?.uuid===n.uuid?(s={...s,...n},window.emui[t]=[s]):typeof s.init>"u"?window.emui[t]=[{...s,...n}]:window.emui[t]=[window.emui[t],n]}};get=({id:t,instanceId:n})=>{const s=window.emui?.[t];return Array.isArray(s)?s.find(h=>h.uuid===n)??null:s?.uuid===n?s:null};add=({id:t,instanceId:n,documentEle:s})=>{if(!n)throw new Error(`instanceId (uuid) is required to register application ${t}`);const c={uuid:n,init:null,mount:null,unmount:null},h=window.emui[t];h?Array.isArray(h)?h.push(c):window.emui[t]=[h,c]:window.emui[t]=[c],s.defaultView&&(s.defaultView.emui=s.defaultView.emui??{},s.defaultView.emui.uuid=n)};delete=({id:t,instanceId:n})=>{if(Array.isArray(window.emui[t])){const s=window.emui[t].findIndex(c=>c.uuid===n);s>-1&&window.emui[t].splice(s,1),window.emui[t].length===0&&delete window.emui[t]}else delete window.emui[t]}}const Ln=12e4,kr=["click","scroll","keypress","touchstart"],Dn=/\.css$/,Ur=r=>Dn.test(r);class Nn{#e;#t;#r;#o;#n;#i=new In;#s;#l;#a=new Map;#u=new Map;#c=new Fn;#p=!0;constructor(t){const{logger:n}=t;if(!n)throw new Error("logger is required");this.#e=t.logger,this.#t=t.version,this.#p=t.extendSession??!0,this.#n=new R({version:t.version,baseUrl:t.appConfigBaseUrl}),this.#r=new Lr(n),this.#o=new Dr(n),this.#s=new Vt,this.#l=new Ht(this.#e)}#g(t){return typeof t=="function"}#m=t=>t instanceof A||typeof t?.subscribe=="function";#v=(t,n)=>`Application ${t} with instance id ${n} is not found. Most probably the appId property of app.config.json is not set to ${t}`;#y=(t,n=document)=>{const{elementIds:s}=this.#a.get(t)||{};s&&s.forEach(c=>{const h=n.getElementById(c);h&&h.remove()})};#b=({id:t,instanceId:n,documentEle:s,elementIds:c,microFEHost:h})=>{const m=this.#c.get({id:t,instanceId:n});if(!m)throw new Error(this.#v(t,n));this.#a.set(n,{id:t,instanceId:n,elementIds:c,guest:{guestWindow:s?.defaultView,...m},microFEHost:h})};#w=async({id:t,instanceId:n,containerId:s,hostUrl:c,manifestPath:h,homeRoute:m,initialRoute:b,history:S,theme:E,microFEHost:T})=>{const I=this.#c.get({id:t,instanceId:n});if(!I)throw new Error(`Application ${t} with instance id ${n} is not found. Most probably the appId property of app.config.json is not set to ${t}`);if(!I.init||typeof I.init!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose init method`);const k=T??new Nr({guest:{id:t},version:this.#t,containerId:s,logger:this.#e,soManager:this.#s,eventManager:this.#l});return I.init({host:k,hostUrl:c,manifestPath:h,homeRoute:m,initialRoute:b,prevState:null,history:S,theme:E,hostBreakpoint:$r(),hostViewportSize:lr(),logger:this.#e})};#x=async t=>{try{const{id:n,instanceId:s,files:c,name:h,hostUrl:m,documentEle:b,isJsModule:S}=t;this.#e.debug(`Application ${n} with instance id ${s} is loading...`);let E=c;const T=t.manifest??await Dt.get(t);E=Dt.getFullFileNameofAssets(T,c);const I=E.filter(D=>Ur(D)),k=E.filter(D=>!Ur(D)),K={name:h,hostUrl:m,documentEle:b,isESMModule:S},[V,X]=await Promise.all([this.#o.load(I,K),this.#r.load(k,K)]);this.#b({id:n,instanceId:s,documentEle:b,elementIds:[...V,...X],microFEHost:t.microFEHost}),t.selfInitialize||await this.#w(t),this.#e.audit(`Application ${n} with instance id ${s} loaded`)}catch(n){const s=`Application load failed. Unable to load one or more resources for ${t.id} with instance id ${t.instanceId}. ${n.message}`;throw this.#e.error({message:s,appId:t.id,exception:n}),new Error(s)}};#d=({id:t,instanceId:n,hostUrl:s,documentEle:c})=>{this.#e.debug(`Application ${t} with instance id ${n} unloading...`),this.#c.get({id:t,instanceId:n})&&(this.#y(n,c),this.#r.removeDynamicImportedScripts(s,c),this.#r.removePrefetchLinks(s,c),this.#o.removeDynamicImportedStyles(s,c),this.#c.delete({id:t,instanceId:n}),this.#e.audit(`Application ${t} with instance id ${n} unloaded`))};#f=async({id:t,instanceId:n})=>{const s=this.#c.get({id:t,instanceId:n});if(!s?.mount||typeof s?.mount!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose mount method`);return s.mount({containerId:`${ft}${t}`,hostBreakpoint:$r(),hostViewportSize:lr()})};#h=({id:t,instanceId:n})=>{const s=this.#c.get({id:t,instanceId:n});if(!s?.unmount)return null;if(typeof s.unmount!="function")throw new Error(`Application ${t} with instance id ${n} doesn't expose unmount method`);return s.unmount({containerId:`${ft}${t}`})};#S=({id:t,instanceId:n})=>{if(this.#p)try{const s=this.#s.getObject(nt.Application);if(!s){this.#e.warn({message:`Application scripting object not available for ${t} to manage session`});return}const c=this.#a.get(n);if(!c)return;c.keepAlive=W()(async()=>{try{await s.keepSessionAlive()}catch(m){this.#e.error(`Error keeping session alive. ${m.message}`)}},Ln);const h=Re.get(n);kr.forEach(m=>{h?.contentDocument?.addEventListener(m,c.keepAlive)})}catch(s){this.#e.warn({message:`Application scripting object not available for ${t} to manage session`,exception:s})}};#A=(t,n)=>{const h=this.#s.getObject(nt.Module,{id:t})?._setUnloadHandler;typeof h=="function"&&h(()=>this.closeApp(n))};#E=async t=>{const n=this.#s.getObject(nt.Module,{id:t});if(!n)return!0;try{const s=await this.#l.dispatchEvent(n,{event:{id:"module.unloading",name:"unloading"},eventParams:{moduleId:t},eventOptions:{timeout:1e3}});if(Array.isArray(s)&&s.some(c=>c===!1))return this.#e.info(`Unload denied by guest ${t} via module.unloading event`),!1}catch(s){this.#e.warn({message:`Error dispatching module.unloading event for ${t}`,exception:s})}return!0};#C=t=>{if(!this.#p||!t)return;const{keepAlive:n,instanceId:s}=t;if(n){const h=Re.get(s)?.contentDocument;h&&kr.forEach(m=>{h.removeEventListener(m,n)}),t.keepAlive?.cancel()}};addScriptingObject=(t,n)=>{if(Ot(t)){const s=this.cloneScriptingObject(t);this.#s.addScriptingObject(s,n)}else this.#s.addScriptingObject(t,n)};cloneScriptingObject=t=>{if(!t)throw new Error("proxy is required");const n=new fe(t.id,t.objectType);let s=[];return Object.keys(t).forEach(c=>{const h=t[c];if(this.#m(h)){const m=new ae({name:h.name||c,objectId:n.id});Object.defineProperty(n,c,{value:m,enumerable:!0});const b=({eventParams:E,eventOptions:T})=>this.dispatchEvent({event:m,eventParams:E,eventOptions:T}),S=h.subscribe(b);s.push(()=>{h.unsubscribe(S)})}else if(this.#g(h)&&(Object.defineProperty(n,c,{value:async(...m)=>{const b=n[c]?.callContext;if(b?.guest){const E=b.callChain??[],T=b.guest.id,I=this.#u.get(T),k={id:T};I&&(k.metadata=I),Object.defineProperty(h,"callContext",{value:{callChain:[...E,k]},configurable:!0,enumerable:!0,writable:!0})}const S=await h(...m);return Ot(S)?this.cloneScriptingObject(S):S},enumerable:!0}),c==="dispose")){const m=n.dispose;Object.defineProperty(n,c,{value:()=>(n._dispose(),m.apply(n)),enumerable:!0})}}),n._dispose=()=>{s.forEach(c=>{c?.()}),s=[]},n};closeAllApps=async()=>{await Promise.all([...this.#a.keys()].map(this.closeApp))};closeApp=async t=>{if(!t)throw new Error("instanceId is required");const n=this.#a.get(t);if(!n){this.#e.warn(`Application with instance id ${t} is not found`);return}const{id:s}=n;if(!await this.#E(s))return;const c=this.#i.getConfigById(s);if(!c){this.#e.warn(`Configuration for application ${s} is not found`),this.#a.delete(t),Re.remove(t);return}const{hostUrl:h}=c;try{this.#C(n),await this.#h({id:s,instanceId:t})}finally{const m=Re.get(t);m?.contentDocument&&this.#d({id:s,instanceId:t,hostUrl:h,documentEle:m.contentDocument}),this.#a.delete(t),this.#u.delete(s),Re.remove(t)}};dispatchEvent=async t=>{const{event:{id:n,name:s},eventOptions:c={}}=t,{guestId:h}=c;if(!n)throw new Error("Event Id is required");const m=n.split(".")?.[0],b=h?this.#s.getObject(m,{id:h}):this.#s.getObject(m);return b?this.#l.dispatchEvent(b,t):(this.#e.warn(`Attempt to dispatch event ${s} on unknown object ${m}`),Promise.resolve())};getApp=t=>this.#a.get(t)?.guest;getApps=()=>[...this.#a.values()].map(t=>t.guest);init=async t=>{t?this.#n.setPreloadedConfig(t):await this.#n.load(),this.#i.init({version:this.#t,appConfig:this.#n}),this.#O()};#O=()=>{const t=this.#n.get("microFrontendApps")??{},n=new Set;Object.keys(t).forEach(s=>{const c=this.#i.getConfigById(s);if(c?.hostUrl)try{n.add(new URL(c.hostUrl).origin)}catch{}}),n.forEach(s=>{const c=document.createElement("link");c.rel="preconnect",c.href=s,c.crossOrigin="anonymous",document.head.appendChild(c)})};mountApp=async t=>{if(!t)throw new Error("instanceId is required");const{id:n}=this.#a.get(t)||{};if(!n)throw new Error(`Application with instance id ${t} is not found`);const s=this.#i.getConfigById(n);if(!s)throw new Error(`Application with id ${n} is not found`);await this.#f({...s,instanceId:t})};#T=(t,n,s)=>{const c=new Nr({guest:{id:s.id},version:this.#t,containerId:s.containerId,logger:this.#e,soManager:this.#s,eventManager:this.#l}),h=t.defaultView;h&&(h.emui=h.emui??{},h.emui.__host=c,h.emui.getHost=()=>h.emui?.__host??null);const m=t.createElement("link");return m.rel="preconnect",m.href=n.hostUrl,m.crossOrigin="anonymous",t.head.appendChild(m),c};openApp=async t=>{const{id:n,frameOptions:s,history:c,theme:h,homeRoute:m,initialRoute:b,metadata:S,selfInitialize:E}=t,T=Et();S&&this.#u.set(n,S);const I=this.#i.getConfigById(n);if(!I)throw new Error(`Application ${n} is not found in app config`);const k=Dt.get(I);k.catch(()=>{});const K=await Re.create({id:n,instanceId:T,manifestPath:I.manifestPath,hostUrl:I.hostUrl,options:{title:I.name,...s}});if(!K?.contentDocument)throw new Error("unable to create iframe for the microapp");try{this.#c.add({id:n,instanceId:T,documentEle:K.contentDocument});const V=this.#T(K.contentDocument,I,{id:n,containerId:s?.containerId}),X=await k;return await this.#x({instanceId:T,history:c,theme:h,documentEle:K.contentDocument,containerId:s?.containerId,...I,homeRoute:m??I.homeRoute,initialRoute:b,microFEHost:V,selfInitialize:E,manifest:X}),E||await this.#f({instanceId:T,...I}),this.#S({id:n,instanceId:T}),this.#A(n,T),T}catch(V){throw this.#d({id:n,instanceId:T,hostUrl:I.hostUrl,documentEle:K.contentDocument}),Re.remove(T),V}};removeAllEventSubscriptions=()=>{this.#l.unsubscribeAll()};removeAllScriptingObjects=t=>{this.#s.removeAllScriptingObjects(t)};removeScriptingObject=(t,n)=>{this.#s.removeScriptingObject(t,n)};warmUp=t=>{const n=this.#i.getConfigById(t);n&&Dt.get(n).catch(()=>{})};unmountApp=async t=>{if(!t)throw new Error("instanceId is required");const{id:n}=this.#a.get(t)||{};if(!n)throw new Error(`Application with instance id ${t} is not found`);const s=this.#i.getConfigById(n);if(!s)throw new Error(`Application with id ${n} is not found`);await this.#h({...s,instanceId:t})}}})(),kt})());
16
16
 
17
- //# sourceMappingURL=emuiAppBridge.dc4dbeb6feea171656da.js.map
17
+ //# sourceMappingURL=emuiAppBridge.2cb0198671d2a7602aaa.js.map