@elliemae/pui-app-bridge 2.21.4 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/cjs/appBridge.js +43 -61
  2. package/dist/cjs/index.html +1 -1
  3. package/dist/cjs/index.js +5 -1
  4. package/dist/cjs/loaders/script.js +162 -10
  5. package/dist/cjs/loaders/style.js +98 -9
  6. package/dist/esm/appBridge.js +43 -61
  7. package/dist/esm/index.html +1 -1
  8. package/dist/esm/index.js +5 -1
  9. package/dist/esm/loaders/script.js +162 -10
  10. package/dist/esm/loaders/style.js +98 -9
  11. package/dist/public/creditService/latest/creditService.checksum.js +1 -1
  12. package/dist/public/creditService/latest/creditService.checksum.js.br +0 -0
  13. package/dist/public/creditService/latest/creditService.checksum.js.gz +0 -0
  14. package/dist/public/creditService/latest/creditService.checksum.js.map +1 -1
  15. package/dist/public/frame.html +1 -1
  16. package/dist/public/index.html +1 -1
  17. package/dist/public/init.js +1 -1
  18. package/dist/public/init.js.br +0 -0
  19. package/dist/public/init.js.gz +0 -0
  20. package/dist/public/init.js.map +1 -1
  21. package/dist/public/js/emuiAppBridge.77676d32f64ebb779bb5.js +51 -0
  22. package/dist/public/js/emuiAppBridge.77676d32f64ebb779bb5.js.br +0 -0
  23. package/dist/public/js/emuiAppBridge.77676d32f64ebb779bb5.js.gz +0 -0
  24. package/dist/public/js/emuiAppBridge.77676d32f64ebb779bb5.js.map +1 -0
  25. package/dist/public/latest/app.config.json +6 -6
  26. package/dist/public/loanValidation/latest/loanValidation.checksum.js +1 -1
  27. package/dist/public/loanValidation/latest/loanValidation.checksum.js.br +0 -0
  28. package/dist/public/loanValidation/latest/loanValidation.checksum.js.gz +0 -0
  29. package/dist/public/loanValidation/latest/loanValidation.checksum.js.map +1 -1
  30. package/dist/public/pricingService/latest/pricingService.checksum.js +2 -2
  31. package/dist/public/pricingService/latest/pricingService.checksum.js.br +0 -0
  32. package/dist/public/pricingService/latest/pricingService.checksum.js.gz +0 -0
  33. package/dist/public/pricingService/latest/pricingService.checksum.js.map +1 -1
  34. package/dist/public/utils.js +1 -1
  35. package/dist/public/utils.js.br +0 -0
  36. package/dist/public/utils.js.gz +0 -0
  37. package/dist/public/utils.js.map +1 -1
  38. package/dist/types/lib/index.d.ts +2 -0
  39. package/dist/types/lib/loaders/script.d.ts +99 -5
  40. package/dist/types/lib/loaders/style.d.ts +77 -4
  41. package/dist/types/lib/tests/loaders/script.test.d.ts +1 -0
  42. package/dist/types/tsconfig.tsbuildinfo +1 -1
  43. package/dist/umd/creditService/latest/creditService.checksum.js +1 -1
  44. package/dist/umd/creditService/latest/creditService.checksum.js.br +0 -0
  45. package/dist/umd/creditService/latest/creditService.checksum.js.gz +0 -0
  46. package/dist/umd/creditService/latest/creditService.checksum.js.map +1 -1
  47. package/dist/umd/index.html +1 -1
  48. package/dist/umd/index.js +17 -17
  49. package/dist/umd/index.js.br +0 -0
  50. package/dist/umd/index.js.gz +0 -0
  51. package/dist/umd/index.js.map +1 -1
  52. package/dist/umd/init.js +1 -1
  53. package/dist/umd/init.js.br +0 -0
  54. package/dist/umd/init.js.gz +0 -0
  55. package/dist/umd/init.js.map +1 -1
  56. package/dist/umd/latest/app.config.json +6 -6
  57. package/dist/umd/loanValidation/latest/loanValidation.checksum.js +1 -1
  58. package/dist/umd/loanValidation/latest/loanValidation.checksum.js.br +0 -0
  59. package/dist/umd/loanValidation/latest/loanValidation.checksum.js.gz +0 -0
  60. package/dist/umd/loanValidation/latest/loanValidation.checksum.js.map +1 -1
  61. package/dist/umd/pricingService/latest/pricingService.checksum.js +2 -2
  62. package/dist/umd/pricingService/latest/pricingService.checksum.js.br +0 -0
  63. package/dist/umd/pricingService/latest/pricingService.checksum.js.gz +0 -0
  64. package/dist/umd/pricingService/latest/pricingService.checksum.js.map +1 -1
  65. package/dist/umd/utils.js +1 -1
  66. package/dist/umd/utils.js.br +0 -0
  67. package/dist/umd/utils.js.gz +0 -0
  68. package/dist/umd/utils.js.map +1 -1
  69. package/package.json +5 -5
  70. package/dist/public/js/emuiAppBridge.4c0a4243086e44e29d0b.js +0 -51
  71. package/dist/public/js/emuiAppBridge.4c0a4243086e44e29d0b.js.br +0 -0
  72. package/dist/public/js/emuiAppBridge.4c0a4243086e44e29d0b.js.gz +0 -0
  73. package/dist/public/js/emuiAppBridge.4c0a4243086e44e29d0b.js.map +0 -1
@@ -5,23 +5,77 @@ class ScriptLoader {
5
5
  constructor(logger) {
6
6
  this.#logger = logger;
7
7
  }
8
- add = ({
9
- name,
10
- hostUrl,
8
+ /**
9
+ * Creates a modulepreload link element for performance optimization.
10
+ * @param href.href
11
+ * @param href - The URL of the script to preload
12
+ * @param href.isESMModule
13
+ * @param href.documentEle
14
+ * @remarks
15
+ * Modulepreload hints allow the browser to fetch and cache the module script
16
+ * earlier in the page load lifecycle, improving performance.
17
+ * The crossorigin attribute is set to 'anonymous' to match the script loading behavior
18
+ * and prevent CORS issues with cross-origin resources.
19
+ * @private
20
+ */
21
+ #preLoadScript = ({
22
+ href,
23
+ isESMModule = true,
24
+ documentEle
25
+ }) => {
26
+ const link = documentEle.createElement("link");
27
+ link.rel = isESMModule ? "modulepreload" : "preload";
28
+ link.href = href;
29
+ link.crossOrigin = "anonymous";
30
+ if (!isESMModule) {
31
+ link.as = "script";
32
+ }
33
+ documentEle.head.appendChild(link);
34
+ };
35
+ /**
36
+ * Dynamically adds a script element to the document.
37
+ * @param options - Configuration options for the script
38
+ * @param options.name - The name of the application or script
39
+ * @param options.hostUrl - The base URL where the script is hosted
40
+ * @param options.documentEle - The document object where the script should be added
41
+ * @param options.fileName - The filename of the script to load
42
+ * @param options.index - An index used to generate a unique script ID
43
+ * @param options.isESMModule - Whether the script should be loaded as an ES module (default: true)
44
+ * @param options.id
45
+ * @param options.href
46
+ * @returns A promise that resolves with the script element's ID when the script loads successfully
47
+ * @throws Will reject with an error if the script fails to load
48
+ * @example
49
+ * ```typescript
50
+ * await scriptLoader.add({
51
+ * name: 'myApp',
52
+ * hostUrl: 'https://cdn.example.com',
53
+ * documentEle: document,
54
+ * fileName: 'main.js',
55
+ * index: 0,
56
+ * isESMModule: true
57
+ * });
58
+ * ```
59
+ */
60
+ #loadScript = ({
61
+ id,
62
+ href,
11
63
  documentEle,
12
- fileName,
13
- index,
14
- isJsModule = true
64
+ isESMModule = true
15
65
  }) => new Promise((resolve, reject) => {
16
- const url = new URL(fileName, hostUrl);
17
66
  const ele = documentEle.createElement("script");
18
- ele.id = `${APP_SCRIPT_ID_PREFIX}${name.toLowerCase()}-${index}`;
19
- ele.src = removeDoubleSlash(url.href);
67
+ ele.id = id;
68
+ ele.src = removeDoubleSlash(href);
69
+ ele.crossOrigin = "anonymous";
20
70
  ele.nonce = "__CSP_NONCE__";
21
- if (!isJSDOM() && isJsModule) ele.type = "module";
71
+ if (!isJSDOM() && isESMModule) ele.type = "module";
22
72
  else ele.async = false;
23
73
  ele.onload = resolve.bind(null, ele.id);
24
74
  ele.onerror = (err) => {
75
+ this.#logger.error({
76
+ message: `Error loading script ${ele.src}`,
77
+ exception: new Error(err)
78
+ });
25
79
  reject(
26
80
  new Error(`Unable to load script ${ele.src}`, {
27
81
  cause: new Error(err)
@@ -30,6 +84,78 @@ class ScriptLoader {
30
84
  };
31
85
  documentEle.head.appendChild(ele);
32
86
  });
87
+ /**
88
+ * Loads multiple script assets sequentially, with CDN scripts loaded before non-CDN scripts.
89
+ * @param assets - Array of script URLs (either full HTTP/HTTPS URLs or relative paths)
90
+ * @param options - Configuration options for loading the scripts
91
+ * @param options.name - The name of the application (used for generating script IDs)
92
+ * @param options.hostUrl - The base URL for resolving relative script paths
93
+ * @param options.documentEle - The document object where scripts should be added
94
+ * @param options.isESMModule - Whether scripts should be loaded as ES modules (default: true)
95
+ * @returns A promise that resolves with an array of script element IDs when all scripts are loaded
96
+ * @remarks
97
+ * This method:
98
+ * - Partitions assets into CDN (HTTP/HTTPS) and non-CDN (relative) arrays in a single pass
99
+ * - Creates modulepreload links for all assets for performance optimization
100
+ * - Loads CDN scripts sequentially first (they may set global variables needed by non-CDN scripts)
101
+ * - Then loads non-CDN scripts sequentially
102
+ * - Sequential execution ensures proper dependency resolution and initialization order
103
+ * @example
104
+ * ```typescript
105
+ * const scriptIds = await scriptLoader.load(
106
+ * ['https://cdn.example.com/lib.js', 'app.js', 'config.js'],
107
+ * {
108
+ * name: 'myApp',
109
+ * hostUrl: 'https://example.com',
110
+ * documentEle: document,
111
+ * isESMModule: true
112
+ * }
113
+ * );
114
+ * ```
115
+ */
116
+ load = async (assets, options) => {
117
+ const { documentEle, isESMModule } = options;
118
+ const httpPattern = /^https?:\/\//i;
119
+ const { cdnAssets, nonCdnAssets } = assets.reduce(
120
+ (acc, fileName, index) => {
121
+ const id = `${APP_SCRIPT_ID_PREFIX}${options.name.toLowerCase()}-${index}`;
122
+ if (httpPattern.test(fileName)) {
123
+ acc.cdnAssets.push({ id, href: fileName });
124
+ this.#preLoadScript({ href: fileName, documentEle, isESMModule });
125
+ } else {
126
+ const url = new URL(fileName, options.hostUrl);
127
+ acc.nonCdnAssets.push({ id, href: url.href });
128
+ this.#preLoadScript({ href: url.href, documentEle, isESMModule });
129
+ }
130
+ return acc;
131
+ },
132
+ {
133
+ cdnAssets: [],
134
+ nonCdnAssets: []
135
+ }
136
+ );
137
+ for (const { href, id } of [...cdnAssets, ...nonCdnAssets]) {
138
+ await this.#loadScript({
139
+ id,
140
+ href,
141
+ documentEle,
142
+ isESMModule
143
+ });
144
+ }
145
+ return [...cdnAssets, ...nonCdnAssets].map((asset) => asset.id);
146
+ };
147
+ /**
148
+ * Removes a script element from the document by its ID.
149
+ * @param elementId - The ID of the script element to remove (default: '')
150
+ * @param documentEle - The document object from which to remove the script (default: document)
151
+ * @returns A promise that resolves when the script element has been removed
152
+ * @remarks
153
+ * If the element with the specified ID is not found, a warning is logged but the promise still resolves.
154
+ * @example
155
+ * ```typescript
156
+ * await scriptLoader.remove('ice-script-myapp-0', document);
157
+ * ```
158
+ */
33
159
  remove = (elementId = "", documentEle = document) => new Promise((resolve) => {
34
160
  const ele = documentEle.getElementById(elementId);
35
161
  if (!ele) {
@@ -39,6 +165,19 @@ class ScriptLoader {
39
165
  ele.remove();
40
166
  resolve();
41
167
  });
168
+ /**
169
+ * Removes all script elements from the document that match a specific host URL pattern.
170
+ * @param hostUrl - The host URL pattern to match against script sources
171
+ * @param documentEle - The document object from which to remove scripts
172
+ * @remarks
173
+ * This method iterates through all script elements in reverse order and removes any script
174
+ * whose `src` attribute matches the provided host URL pattern (case-insensitive).
175
+ * This is useful for cleaning up dynamically imported scripts from a specific host.
176
+ * @example
177
+ * ```typescript
178
+ * scriptLoader.removeDynamicImportedScripts('https://cdn.example.com', document);
179
+ * ```
180
+ */
42
181
  removeDynamicImportedScripts = (hostUrl, documentEle) => {
43
182
  const hostPattern = new RegExp(hostUrl, "i");
44
183
  const scriptElements = documentEle.getElementsByTagName("script");
@@ -48,6 +187,19 @@ class ScriptLoader {
48
187
  if (hostPattern.test(src)) scriptEle.remove();
49
188
  }
50
189
  };
190
+ /**
191
+ * Removes all prefetch link elements from the document that match a specific host URL pattern.
192
+ * @param hostUrl - The host URL pattern to match against link hrefs
193
+ * @param documentEle - The document object from which to remove prefetch links
194
+ * @remarks
195
+ * This method queries all elements with `rel="prefetch"` and removes any link whose `href`
196
+ * attribute matches the provided host URL pattern (case-insensitive). This is useful for
197
+ * cleaning up resource hints that are no longer needed.
198
+ * @example
199
+ * ```typescript
200
+ * scriptLoader.removePrefetchLinks('https://cdn.example.com', document);
201
+ * ```
202
+ */
51
203
  removePrefetchLinks = (hostUrl, documentEle) => {
52
204
  const hostPattern = new RegExp(hostUrl, "i");
53
205
  const prefetchElements = documentEle.querySelectorAll('[rel="prefetch"]');
@@ -5,21 +5,45 @@ class StyleLoader {
5
5
  constructor(logger) {
6
6
  this.#logger = logger;
7
7
  }
8
- add = ({
9
- name,
10
- hostUrl,
11
- documentEle,
12
- fileName,
13
- index
8
+ /**
9
+ * Dynamically adds a stylesheet link element to the document.
10
+ * @param options - Configuration options for the stylesheet
11
+ * @param options.name - The name of the application or stylesheet
12
+ * @param options.hostUrl - The base URL where the stylesheet is hosted
13
+ * @param options.documentEle - The document object where the stylesheet should be added
14
+ * @param options.fileName - The filename of the stylesheet to load
15
+ * @param options.index - An index used to generate a unique stylesheet ID
16
+ * @param options.id
17
+ * @param options.href
18
+ * @returns A promise that resolves with the link element's ID when the stylesheet loads successfully
19
+ * @throws Will reject with an error if the stylesheet fails to load
20
+ * @example
21
+ * ```typescript
22
+ * await styleLoader.add({
23
+ * name: 'myApp',
24
+ * hostUrl: 'https://cdn.example.com',
25
+ * documentEle: document,
26
+ * fileName: 'main.css',
27
+ * index: 0
28
+ * });
29
+ * ```
30
+ */
31
+ #loadStyle = ({
32
+ id,
33
+ href,
34
+ documentEle
14
35
  }) => new Promise((resolve, reject) => {
15
36
  const ele = documentEle.createElement("link");
16
- ele.id = `${APP_STYLE_ID_PREFIX}${name.toLowerCase()}-${index}`;
37
+ ele.id = id;
17
38
  ele.nonce = "__CSP_NONCE__";
18
39
  ele.rel = "stylesheet";
19
- const url = new URL(fileName, hostUrl);
20
- ele.href = removeDoubleSlash(url.href);
40
+ ele.href = removeDoubleSlash(href);
21
41
  ele.onload = resolve.bind(null, ele.id);
22
42
  ele.onerror = (err) => {
43
+ this.#logger.error({
44
+ message: `Error loading stylesheet ${ele.href}`,
45
+ exception: new Error(err)
46
+ });
23
47
  reject(
24
48
  new Error(`Unable to load stylesheet ${ele.href}`, {
25
49
  cause: new Error(err)
@@ -28,6 +52,57 @@ class StyleLoader {
28
52
  };
29
53
  documentEle.head.appendChild(ele);
30
54
  });
55
+ /**
56
+ * Loads multiple stylesheet assets in parallel.
57
+ * @param assets - Array of stylesheet filenames (relative paths)
58
+ * @param options - Configuration options for loading the stylesheets
59
+ * @param options.name - The name of the application (used for generating stylesheet IDs)
60
+ * @param options.hostUrl - The base URL for resolving stylesheet paths
61
+ * @param options.documentEle - The document object where stylesheets should be added
62
+ * @returns A promise that resolves with an array of stylesheet element IDs when all stylesheets are loaded
63
+ * @remarks
64
+ * This method loads all stylesheets in parallel using Promise.all for optimal performance.
65
+ * Each stylesheet is assigned a unique ID based on the application name and its index.
66
+ * Unlike scripts, stylesheets don't typically have execution order dependencies.
67
+ * @example
68
+ * ```typescript
69
+ * const styleIds = await styleLoader.load(
70
+ * ['main.css', 'theme.css', 'components.css'],
71
+ * {
72
+ * name: 'myApp',
73
+ * hostUrl: 'https://example.com',
74
+ * documentEle: document
75
+ * }
76
+ * );
77
+ * ```
78
+ */
79
+ load = async (assets, options) => {
80
+ const elementIds = [];
81
+ const loadPromises = assets.map((fileName, index) => {
82
+ const url = new URL(fileName, options.hostUrl);
83
+ const id = `${APP_STYLE_ID_PREFIX}${options.name.toLowerCase()}-${index}`;
84
+ elementIds.push(id);
85
+ return this.#loadStyle({
86
+ id,
87
+ href: url.href,
88
+ documentEle: options.documentEle
89
+ });
90
+ });
91
+ await Promise.all(loadPromises);
92
+ return elementIds;
93
+ };
94
+ /**
95
+ * Removes a stylesheet link element from the document by its ID.
96
+ * @param elementId - The ID of the stylesheet element to remove (default: '')
97
+ * @param documentEle - The document object from which to remove the stylesheet (default: document)
98
+ * @returns A promise that resolves when the stylesheet element has been removed
99
+ * @remarks
100
+ * If the element with the specified ID is not found, a warning is logged but the promise still resolves.
101
+ * @example
102
+ * ```typescript
103
+ * await styleLoader.remove('ice-style-myapp-0', document);
104
+ * ```
105
+ */
31
106
  remove = (elementId = "", documentEle = document) => new Promise((resolve) => {
32
107
  const ele = documentEle.getElementById(elementId);
33
108
  if (!ele) {
@@ -37,6 +112,20 @@ class StyleLoader {
37
112
  ele.remove();
38
113
  resolve();
39
114
  });
115
+ /**
116
+ * Removes all stylesheet link elements from the document that match a specific host URL pattern.
117
+ * @param hostUrl - The host URL pattern to match against stylesheet hrefs
118
+ * @param documentEle - The document object from which to remove stylesheets
119
+ * @remarks
120
+ * This method queries all elements with `rel="stylesheet"` and removes any link whose `href`
121
+ * attribute matches the provided host URL pattern (case-insensitive). This is useful for
122
+ * cleaning up dynamically imported stylesheets from a specific host.
123
+ * The iteration happens in reverse order to safely remove elements while iterating.
124
+ * @example
125
+ * ```typescript
126
+ * styleLoader.removeDynamicImportedStyles('https://cdn.example.com', document);
127
+ * ```
128
+ */
40
129
  removeDynamicImportedStyles = (hostUrl, documentEle) => {
41
130
  const hostPattern = new RegExp(hostUrl, "i");
42
131
  const prefetchElements = documentEle.querySelectorAll('[rel="stylesheet"]');
@@ -1,3 +1,3 @@
1
- (function(){let e=null;const n=window.parent;n.emui=n.emui||{};const s=async t=>e?await e.getObject(t):null;n.emui.creditservice={init:async t=>(e=t.host,Promise.resolve()),mount:async t=>{const o=await s("Loan"),{ssn:i}=await o.getLoanDetails();return setTimeout(async()=>{const r=i==="123456789"?800:600;await o.setCreditScore(r)},1e3),Promise.resolve()},unmount:async t=>Promise.resolve()}})();
1
+ import{registerApp as r,getWindow as a}from"../../utils.js";const i="creditservice";let t=null;const u=a(i);window.emui=window.emui||{uuid:crypto.randomUUID()},window.emui.app={uuid:window.emui.uuid,init:async o=>(t=o.host,Promise.resolve()),mount:async o=>{const e=await t.getObject("Loan"),{ssn:n}=await e.getLoanDetails();return setTimeout(async()=>{const s=n==="123456789"?800:600;await e.setCreditScore(s)},1e3),Promise.resolve()},unmount:async o=>Promise.resolve()},r({browserWindow:u,appId:i,app:window.emui.app});
2
2
 
3
3
  //# sourceMappingURL=creditService.checksum.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://ice/creditService/latest/creditService.checksum.js"],"sourcesContent":["(function () {\n let host = null;\n const parentWindow = window.parent;\n parentWindow.emui = parentWindow.emui || {};\n\n const getLoanObject = async (objectId) => {\n if (host) {\n return await host.getObject(objectId);\n }\n return null;\n };\n\n parentWindow.emui.creditservice = {\n init: async (options) => {\n host = options.host;\n return Promise.resolve();\n },\n mount: async (options) => {\n const loanObj = await getLoanObject('Loan');\n const { ssn } = await loanObj.getLoanDetails();\n setTimeout(async () => {\n const score = ssn === '123456789' ? 800 : 600;\n await loanObj.setCreditScore(score);\n }, 1000);\n return Promise.resolve();\n },\n unmount: async (options) => Promise.resolve(),\n };\n})();\n"],"mappings":"CAAC,UAAY,CACX,IAAIA,EAAO,KACX,MAAMC,EAAe,OAAO,OAC5BA,EAAa,KAAOA,EAAa,MAAQ,CAAC,EAE1C,MAAMC,EAAgB,MAAOC,GACvBH,EACK,MAAMA,EAAK,UAAUG,CAAQ,EAE/B,KAGTF,EAAa,KAAK,cAAgB,CAChC,KAAM,MAAOG,IACXJ,EAAOI,EAAQ,KACR,QAAQ,QAAQ,GAEzB,MAAO,MAAOA,GAAY,CACxB,MAAMC,EAAU,MAAMH,EAAc,MAAM,EACpC,CAAE,IAAAI,CAAI,EAAI,MAAMD,EAAQ,eAAe,EAC7C,kBAAW,SAAY,CACrB,MAAME,EAAQD,IAAQ,YAAc,IAAM,IAC1C,MAAMD,EAAQ,eAAeE,CAAK,CACpC,EAAG,GAAI,EACA,QAAQ,QAAQ,CACzB,EACA,QAAS,MAAOH,GAAY,QAAQ,QAAQ,CAC9C,CACF,GAAG","names":["host","parentWindow","getLoanObject","objectId","options","loanObj","ssn","score"],"sourceRoot":"","file":"creditService/latest/creditService.checksum.js"}
1
+ {"version":3,"sources":["webpack://ice/creditService/latest/creditService.checksum.js"],"sourcesContent":["import { registerApp, getWindow } from '../../utils.js';\nconst appId = 'creditservice';\n// eslint-disable-next-line no-unused-vars\nlet host = null;\nconst browserWindow = getWindow(appId);\nwindow.emui = window.emui || { uuid: crypto.randomUUID() };\n\nwindow.emui.app = {\n uuid: window.emui.uuid,\n init: async (options) => {\n host = options.host;\n return Promise.resolve();\n },\n mount: async (options) => {\n const loanObj = await host.getObject('Loan');\n const { ssn } = await loanObj.getLoanDetails();\n setTimeout(async () => {\n const score = ssn === '123456789' ? 800 : 600;\n await loanObj.setCreditScore(score);\n }, 1000);\n return Promise.resolve();\n },\n unmount: async (options) => Promise.resolve(),\n};\n\nregisterApp({ browserWindow, appId, app: window.emui.app });\n"],"mappings":"AAAA,OAAS,eAAAA,EAAa,aAAAC,MAAiB,iBACvC,MAAMC,EAAQ,gBAEd,IAAIC,EAAO,KACX,MAAMC,EAAgBH,EAAUC,CAAK,EACrC,OAAO,KAAO,OAAO,MAAQ,CAAE,KAAM,OAAO,WAAW,CAAE,EAEzD,OAAO,KAAK,IAAM,CAChB,KAAM,OAAO,KAAK,KAClB,KAAM,MAAOG,IACXF,EAAOE,EAAQ,KACR,QAAQ,QAAQ,GAEzB,MAAO,MAAOA,GAAY,CACxB,MAAMC,EAAU,MAAMH,EAAK,UAAU,MAAM,EACrC,CAAE,IAAAI,CAAI,EAAI,MAAMD,EAAQ,eAAe,EAC7C,kBAAW,SAAY,CACrB,MAAME,EAAQD,IAAQ,YAAc,IAAM,IAC1C,MAAMD,EAAQ,eAAeE,CAAK,CACpC,EAAG,GAAI,EACA,QAAQ,QAAQ,CACzB,EACA,QAAS,MAAOH,GAAY,QAAQ,QAAQ,CAC9C,EAEAL,EAAY,CAAE,cAAAI,EAAe,MAAAF,EAAO,IAAK,OAAO,KAAK,GAAI,CAAC","names":["registerApp","getWindow","appId","host","browserWindow","options","loanObj","ssn","score"],"sourceRoot":"","file":"creditService/latest/creditService.checksum.js"}
@@ -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 nonce="__CSP_NONCE__">!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 nonce="__CSP_NONCE__">.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.4c0a4243086e44e29d0b.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><script nonce="__CSP_NONCE__">!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 nonce="__CSP_NONCE__">.full-width{width:100%}.full-height{height:100%}</style><script defer="defer" src="js/emuiAppBridge.77676d32f64ebb779bb5.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.qa1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiAppBridge.4c0a4243086e44e29d0b.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>
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.77676d32f64ebb779bb5.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>
@@ -1,3 +1,3 @@
1
- import{Loan as a}from"./loan-object.js";import{getAppBridge as c}from"./utils.js";let e=null,n=null;const s=async()=>{document.getElementById("getCreditScore").addEventListener("click",async()=>{await e.openApp({id:"creditservice",frameOptions:{containerId:"aside-container",title:"Credit Service Corp"}})})},o=async()=>{await e.openApp({id:"pricingservice",frameOptions:{containerId:"aside-container",title:"Pricing Service Corp"}})},r=async()=>{await e.openApp({id:"loanvalidation",frameOptions:{containerId:"aside-container",title:"Loan Validation Service Corp"}})},d=()=>{n=new a,e.addScriptingObject(n)},l=async()=>{const t=n.getLoanDetails();(await e.dispatchEvent({event:n.onPreSave,eventParams:t})).some(i=>i===!1)?document.getElementById("errorFeedback").classList.remove("hidden"):document.getElementById("successFeedback").classList.remove("hidden")},p=async()=>{e=await c(),d(),o(),s(),r();const t=document.getElementById("saveLoan");t&&t.addEventListener("click",l)};window.addEventListener("DOMContentLoaded",p);
1
+ import{Loan as a}from"./loan-object.js";import{getAppBridge as c}from"./utils.js";let e=null,n=null;const o=async()=>{document.getElementById("getCreditScore").addEventListener("click",async()=>{await e.openApp({id:"creditservice",frameOptions:{containerId:"aside-container",title:"Credit Service Corp"}})})},s=async()=>{await e.openApp({id:"pricingservice",frameOptions:{containerId:"aside-container",title:"Pricing Service Corp"}})},r=async()=>{await e.openApp({id:"loanvalidation",frameOptions:{containerId:"aside-container",title:"Loan Validation Service Corp"}})},d=()=>{n=new a,e.addScriptingObject(n)},l=async()=>{const t=n.getLoanDetails();(await e.dispatchEvent({event:n.onPreSave,eventParams:t,eventOptions:{timeout:5e3}})).some(i=>i===!1)?document.getElementById("errorFeedback").classList.remove("hidden"):document.getElementById("successFeedback").classList.remove("hidden")},p=async()=>{e=await c(),d(),s(),o(),r();const t=document.getElementById("saveLoan");t&&t.addEventListener("click",l)};window.addEventListener("DOMContentLoaded",p);
2
2
 
3
3
  //# sourceMappingURL=init.js.map
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack://ice/init.js"],"sourcesContent":["import { Loan } from './loan-object.js';\nimport { getAppBridge } from './utils.js';\n\nlet appBridge = null;\nlet loanObj = null;\n\nconst setupCreditService = async () => {\n document\n .getElementById('getCreditScore')\n .addEventListener('click', async () => {\n await appBridge.openApp({\n id: 'creditservice',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Credit Service Corp',\n },\n });\n });\n};\n\nconst setupPricingService = async () => {\n await appBridge.openApp({\n id: 'pricingservice',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Pricing Service Corp',\n },\n });\n};\n\nconst setupLoanValidationService = async () => {\n await appBridge.openApp({\n id: 'loanvalidation',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Loan Validation Service Corp',\n },\n });\n};\n\nconst setupLoanObject = () => {\n loanObj = new Loan();\n appBridge.addScriptingObject(loanObj);\n};\n\nconst saveLoan = async () => {\n const loanDetails = loanObj.getLoanDetails();\n const results = await appBridge.dispatchEvent({\n event: loanObj.onPreSave,\n eventParams: loanDetails,\n });\n if (results.some((result) => result === false)) {\n const errorFeedback = document.getElementById('errorFeedback');\n errorFeedback.classList.remove('hidden');\n } else {\n const successFeedback = document.getElementById('successFeedback');\n successFeedback.classList.remove('hidden');\n }\n};\n\nconst init = async () => {\n appBridge = await getAppBridge();\n setupLoanObject();\n setupPricingService();\n setupCreditService();\n setupLoanValidationService();\n const saveLoanButton = document.getElementById('saveLoan');\n if (saveLoanButton) saveLoanButton.addEventListener('click', saveLoan);\n};\n\nwindow.addEventListener('DOMContentLoaded', init);\n"],"mappings":"AAAA,OAAS,QAAAA,MAAY,mBACrB,OAAS,gBAAAC,MAAoB,aAE7B,IAAIC,EAAY,KACZC,EAAU,KAEd,MAAMC,EAAqB,SAAY,CACrC,SACG,eAAe,gBAAgB,EAC/B,iBAAiB,QAAS,SAAY,CACrC,MAAMF,EAAU,QAAQ,CACtB,GAAI,gBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,qBACT,CACF,CAAC,CACH,CAAC,CACL,EAEMG,EAAsB,SAAY,CACtC,MAAMH,EAAU,QAAQ,CACtB,GAAI,iBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,sBACT,CACF,CAAC,CACH,EAEMI,EAA6B,SAAY,CAC7C,MAAMJ,EAAU,QAAQ,CACtB,GAAI,iBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,8BACT,CACF,CAAC,CACH,EAEMK,EAAkB,IAAM,CAC5BJ,EAAU,IAAIH,EACdE,EAAU,mBAAmBC,CAAO,CACtC,EAEMK,EAAW,SAAY,CAC3B,MAAMC,EAAcN,EAAQ,eAAe,GAC3B,MAAMD,EAAU,cAAc,CAC5C,MAAOC,EAAQ,UACf,YAAaM,CACf,CAAC,GACW,KAAMC,GAAWA,IAAW,EAAK,EACrB,SAAS,eAAe,eAAe,EAC/C,UAAU,OAAO,QAAQ,EAEf,SAAS,eAAe,iBAAiB,EACjD,UAAU,OAAO,QAAQ,CAE7C,EAEMC,EAAO,SAAY,CACvBT,EAAY,MAAMD,EAAa,EAC/BM,EAAgB,EAChBF,EAAoB,EACpBD,EAAmB,EACnBE,EAA2B,EAC3B,MAAMM,EAAiB,SAAS,eAAe,UAAU,EACrDA,GAAgBA,EAAe,iBAAiB,QAASJ,CAAQ,CACvE,EAEA,OAAO,iBAAiB,mBAAoBG,CAAI","names":["Loan","getAppBridge","appBridge","loanObj","setupCreditService","setupPricingService","setupLoanValidationService","setupLoanObject","saveLoan","loanDetails","result","init","saveLoanButton"],"sourceRoot":"","file":"init.js"}
1
+ {"version":3,"sources":["webpack://ice/init.js"],"sourcesContent":["import { Loan } from './loan-object.js';\nimport { getAppBridge } from './utils.js';\n\nlet appBridge = null;\nlet loanObj = null;\n\nconst setupCreditService = async () => {\n document\n .getElementById('getCreditScore')\n .addEventListener('click', async () => {\n await appBridge.openApp({\n id: 'creditservice',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Credit Service Corp',\n },\n });\n });\n};\n\nconst setupPricingService = async () => {\n await appBridge.openApp({\n id: 'pricingservice',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Pricing Service Corp',\n },\n });\n};\n\nconst setupLoanValidationService = async () => {\n await appBridge.openApp({\n id: 'loanvalidation',\n frameOptions: {\n containerId: 'aside-container',\n title: 'Loan Validation Service Corp',\n },\n });\n};\n\nconst setupLoanObject = () => {\n loanObj = new Loan();\n appBridge.addScriptingObject(loanObj);\n};\n\nconst saveLoan = async () => {\n const loanDetails = loanObj.getLoanDetails();\n const results = await appBridge.dispatchEvent({\n event: loanObj.onPreSave,\n eventParams: loanDetails,\n eventOptions: { timeout : 5000 },\n });\n if (results.some((result) => result === false)) {\n const errorFeedback = document.getElementById('errorFeedback');\n errorFeedback.classList.remove('hidden');\n } else {\n const successFeedback = document.getElementById('successFeedback');\n successFeedback.classList.remove('hidden');\n }\n};\n\nconst init = async () => {\n appBridge = await getAppBridge();\n setupLoanObject();\n setupPricingService();\n setupCreditService();\n setupLoanValidationService();\n const saveLoanButton = document.getElementById('saveLoan');\n if (saveLoanButton) saveLoanButton.addEventListener('click', saveLoan);\n};\n\nwindow.addEventListener('DOMContentLoaded', init);\n"],"mappings":"AAAA,OAAS,QAAAA,MAAY,mBACrB,OAAS,gBAAAC,MAAoB,aAE7B,IAAIC,EAAY,KACZC,EAAU,KAEd,MAAMC,EAAqB,SAAY,CACrC,SACG,eAAe,gBAAgB,EAC/B,iBAAiB,QAAS,SAAY,CACrC,MAAMF,EAAU,QAAQ,CACtB,GAAI,gBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,qBACT,CACF,CAAC,CACH,CAAC,CACL,EAEMG,EAAsB,SAAY,CACtC,MAAMH,EAAU,QAAQ,CACtB,GAAI,iBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,sBACT,CACF,CAAC,CACH,EAEMI,EAA6B,SAAY,CAC7C,MAAMJ,EAAU,QAAQ,CACtB,GAAI,iBACJ,aAAc,CACZ,YAAa,kBACb,MAAO,8BACT,CACF,CAAC,CACH,EAEMK,EAAkB,IAAM,CAC5BJ,EAAU,IAAIH,EACdE,EAAU,mBAAmBC,CAAO,CACtC,EAEMK,EAAW,SAAY,CAC3B,MAAMC,EAAcN,EAAQ,eAAe,GAC3B,MAAMD,EAAU,cAAc,CAC5C,MAAOC,EAAQ,UACf,YAAaM,EACb,aAAc,CAAE,QAAU,GAAK,CACjC,CAAC,GACW,KAAMC,GAAWA,IAAW,EAAK,EACrB,SAAS,eAAe,eAAe,EAC/C,UAAU,OAAO,QAAQ,EAEf,SAAS,eAAe,iBAAiB,EACjD,UAAU,OAAO,QAAQ,CAE7C,EAEMC,EAAO,SAAY,CACvBT,EAAY,MAAMD,EAAa,EAC/BM,EAAgB,EAChBF,EAAoB,EACpBD,EAAmB,EACnBE,EAA2B,EAC3B,MAAMM,EAAiB,SAAS,eAAe,UAAU,EACrDA,GAAgBA,EAAe,iBAAiB,QAASJ,CAAQ,CACvE,EAEA,OAAO,iBAAiB,mBAAoBG,CAAI","names":["Loan","getAppBridge","appBridge","loanObj","setupCreditService","setupPricingService","setupLoanValidationService","setupLoanObject","saveLoan","loanDetails","result","init","saveLoanButton"],"sourceRoot":"","file":"init.js"}