@elliemae/ssf-host 2.19.2 → 2.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/host.js +104 -0
- package/dist/cjs/package.json +4 -1
- package/dist/esm/host.js +104 -0
- package/dist/esm/package.json +4 -1
- package/dist/public/index.html +1 -1
- package/dist/public/js/emuiSsfHost.94ad16e13cca048a63fe.js +3 -0
- package/dist/public/js/emuiSsfHost.94ad16e13cca048a63fe.js.br +0 -0
- package/dist/public/js/emuiSsfHost.94ad16e13cca048a63fe.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.94ad16e13cca048a63fe.js.map +1 -0
- package/dist/public/v1-guest-v2-host.html +1 -1
- package/dist/public/v2-host-v1-guest.html +1 -1
- package/dist/types/lib/ihost.d.ts +42 -1
- package/dist/types/lib/index.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/package.json +25 -22
- package/dist/public/js/emuiSsfHost.65952531844a79299a21.js +0 -3
- package/dist/public/js/emuiSsfHost.65952531844a79299a21.js.br +0 -0
- package/dist/public/js/emuiSsfHost.65952531844a79299a21.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.65952531844a79299a21.js.map +0 -1
package/dist/cjs/host.js
CHANGED
|
@@ -76,6 +76,14 @@ class SSFHost {
|
|
|
76
76
|
*
|
|
77
77
|
*/
|
|
78
78
|
#popupGuestMonitor = null;
|
|
79
|
+
/**
|
|
80
|
+
* callback for guest event subscription
|
|
81
|
+
*/
|
|
82
|
+
#onGuestEventSubscribe = null;
|
|
83
|
+
/**
|
|
84
|
+
* callback for guest event unsubscription
|
|
85
|
+
*/
|
|
86
|
+
#onGuestEventUnsubscribe = null;
|
|
79
87
|
/**
|
|
80
88
|
* Create a new host
|
|
81
89
|
* @param hostId unique identifier for the host
|
|
@@ -92,6 +100,8 @@ class SSFHost {
|
|
|
92
100
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
93
101
|
throw new Error("readyStateCallback must be a function");
|
|
94
102
|
this.#readyStateCallback = option?.readyStateCallback || null;
|
|
103
|
+
this.#onGuestEventSubscribe = option?.onGuestEventSubscribe || null;
|
|
104
|
+
this.#onGuestEventUnsubscribe = option?.onGuestEventUnsubscribe || null;
|
|
95
105
|
this.#soManager = new import_microfe_common.ScriptingObjectManager();
|
|
96
106
|
this.#remoting.initialize(window);
|
|
97
107
|
this.#connect();
|
|
@@ -371,6 +381,92 @@ class SSFHost {
|
|
|
371
381
|
});
|
|
372
382
|
return true;
|
|
373
383
|
};
|
|
384
|
+
/**
|
|
385
|
+
* Handles a guest event subscription request.
|
|
386
|
+
*
|
|
387
|
+
* This method processes a request from a guest window to subscribe to a specific event.
|
|
388
|
+
* It verifies the guest window, logs the request, and invokes the subscription callback asynchronously.
|
|
389
|
+
* If the guest window is unknown, the request is rejected and a warning is logged.
|
|
390
|
+
* @param params - The parameters for the event subscription request.
|
|
391
|
+
* @param params.sourceWin - The window object from which the request originated.
|
|
392
|
+
* @param params.requestId - The unique identifier for the request.
|
|
393
|
+
* @param params.body - The body of the request containing event subscription details.
|
|
394
|
+
* @param params.body.eventId - The identifier of the event to subscribe to.
|
|
395
|
+
* @param params.body.criteria - Optional filter criteria for the event subscription.
|
|
396
|
+
* @param params.body.token - The authentication token for the request.
|
|
397
|
+
* @returns Returns `false` if the guest window is unknown; otherwise, no explicit return value.
|
|
398
|
+
*/
|
|
399
|
+
#handleGuestEventSubscribe = ({
|
|
400
|
+
sourceWin,
|
|
401
|
+
requestId,
|
|
402
|
+
body
|
|
403
|
+
}) => {
|
|
404
|
+
const { eventId, criteria, token } = body;
|
|
405
|
+
this.#logger.debug(
|
|
406
|
+
`Processing guest event subscribe request for event ${eventId}. requestId = ${requestId}`
|
|
407
|
+
);
|
|
408
|
+
const guest = this.#getGuestForWindow(sourceWin);
|
|
409
|
+
if (!guest) {
|
|
410
|
+
this.#logger.warn(
|
|
411
|
+
"Rejected event subscribe request from unknown guest window"
|
|
412
|
+
);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
setTimeout(() => {
|
|
416
|
+
try {
|
|
417
|
+
this.#onGuestEventSubscribe?.({
|
|
418
|
+
guestId: guest.id,
|
|
419
|
+
eventId,
|
|
420
|
+
criteria,
|
|
421
|
+
token
|
|
422
|
+
});
|
|
423
|
+
} catch (error) {
|
|
424
|
+
}
|
|
425
|
+
}, 0);
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Handles a guest event unsubscribe request.
|
|
429
|
+
*
|
|
430
|
+
* This method processes an unsubscribe request from a guest window for a specific event.
|
|
431
|
+
* It verifies the source window, retrieves the corresponding guest, and invokes the
|
|
432
|
+
* `#onGuestEventUnsubscribe` callback asynchronously. If the source window is not recognized,
|
|
433
|
+
* the request is rejected and a warning is logged.
|
|
434
|
+
* @param params - The parameters for the unsubscribe request, including:
|
|
435
|
+
* - `sourceWin`: The window from which the request originated.
|
|
436
|
+
* - `requestId`: The unique identifier for the request.
|
|
437
|
+
* - `body`: An object containing the `eventId` and `token` for the event to unsubscribe.
|
|
438
|
+
* @param params.sourceWin
|
|
439
|
+
* @param params.requestId
|
|
440
|
+
* @param params.body
|
|
441
|
+
* @returns `false` if the guest window is unknown; otherwise, no explicit return value.
|
|
442
|
+
*/
|
|
443
|
+
#handleGuestEventUnsubscribe = ({
|
|
444
|
+
sourceWin,
|
|
445
|
+
requestId,
|
|
446
|
+
body
|
|
447
|
+
}) => {
|
|
448
|
+
const { eventId, token } = body;
|
|
449
|
+
this.#logger.debug(
|
|
450
|
+
`Processing guest event unsubscribe request for event ${eventId}. requestId = ${requestId}`
|
|
451
|
+
);
|
|
452
|
+
const guest = this.#getGuestForWindow(sourceWin);
|
|
453
|
+
if (!guest) {
|
|
454
|
+
this.#logger.warn(
|
|
455
|
+
"Rejected event unsubscribe request from unknown guest window"
|
|
456
|
+
);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
setTimeout(() => {
|
|
460
|
+
try {
|
|
461
|
+
this.#onGuestEventUnsubscribe?.({
|
|
462
|
+
guestId: guest.id,
|
|
463
|
+
eventId,
|
|
464
|
+
token
|
|
465
|
+
});
|
|
466
|
+
} catch (error) {
|
|
467
|
+
}
|
|
468
|
+
}, 0);
|
|
469
|
+
};
|
|
374
470
|
// handles guest resize event
|
|
375
471
|
#handleGuestResize = ({
|
|
376
472
|
sourceWin,
|
|
@@ -509,6 +605,14 @@ class SSFHost {
|
|
|
509
605
|
messageType: import_microfe_common.MessageType.ObjectInvoke,
|
|
510
606
|
callback: this.#handleObjectInvoke
|
|
511
607
|
});
|
|
608
|
+
this.#remoting.listen({
|
|
609
|
+
messageType: import_microfe_common.MessageType.GuestEventSubscribe,
|
|
610
|
+
callback: this.#handleGuestEventSubscribe
|
|
611
|
+
});
|
|
612
|
+
this.#remoting.listen({
|
|
613
|
+
messageType: import_microfe_common.MessageType.GuestEventUnsubscribe,
|
|
614
|
+
callback: this.#handleGuestEventUnsubscribe
|
|
615
|
+
});
|
|
512
616
|
};
|
|
513
617
|
/**
|
|
514
618
|
* check if the value is a proxy event
|
package/dist/cjs/package.json
CHANGED
package/dist/esm/host.js
CHANGED
|
@@ -64,6 +64,14 @@ class SSFHost {
|
|
|
64
64
|
*
|
|
65
65
|
*/
|
|
66
66
|
#popupGuestMonitor = null;
|
|
67
|
+
/**
|
|
68
|
+
* callback for guest event subscription
|
|
69
|
+
*/
|
|
70
|
+
#onGuestEventSubscribe = null;
|
|
71
|
+
/**
|
|
72
|
+
* callback for guest event unsubscription
|
|
73
|
+
*/
|
|
74
|
+
#onGuestEventUnsubscribe = null;
|
|
67
75
|
/**
|
|
68
76
|
* Create a new host
|
|
69
77
|
* @param hostId unique identifier for the host
|
|
@@ -80,6 +88,8 @@ class SSFHost {
|
|
|
80
88
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
81
89
|
throw new Error("readyStateCallback must be a function");
|
|
82
90
|
this.#readyStateCallback = option?.readyStateCallback || null;
|
|
91
|
+
this.#onGuestEventSubscribe = option?.onGuestEventSubscribe || null;
|
|
92
|
+
this.#onGuestEventUnsubscribe = option?.onGuestEventUnsubscribe || null;
|
|
83
93
|
this.#soManager = new ScriptingObjectManager();
|
|
84
94
|
this.#remoting.initialize(window);
|
|
85
95
|
this.#connect();
|
|
@@ -359,6 +369,92 @@ class SSFHost {
|
|
|
359
369
|
});
|
|
360
370
|
return true;
|
|
361
371
|
};
|
|
372
|
+
/**
|
|
373
|
+
* Handles a guest event subscription request.
|
|
374
|
+
*
|
|
375
|
+
* This method processes a request from a guest window to subscribe to a specific event.
|
|
376
|
+
* It verifies the guest window, logs the request, and invokes the subscription callback asynchronously.
|
|
377
|
+
* If the guest window is unknown, the request is rejected and a warning is logged.
|
|
378
|
+
* @param params - The parameters for the event subscription request.
|
|
379
|
+
* @param params.sourceWin - The window object from which the request originated.
|
|
380
|
+
* @param params.requestId - The unique identifier for the request.
|
|
381
|
+
* @param params.body - The body of the request containing event subscription details.
|
|
382
|
+
* @param params.body.eventId - The identifier of the event to subscribe to.
|
|
383
|
+
* @param params.body.criteria - Optional filter criteria for the event subscription.
|
|
384
|
+
* @param params.body.token - The authentication token for the request.
|
|
385
|
+
* @returns Returns `false` if the guest window is unknown; otherwise, no explicit return value.
|
|
386
|
+
*/
|
|
387
|
+
#handleGuestEventSubscribe = ({
|
|
388
|
+
sourceWin,
|
|
389
|
+
requestId,
|
|
390
|
+
body
|
|
391
|
+
}) => {
|
|
392
|
+
const { eventId, criteria, token } = body;
|
|
393
|
+
this.#logger.debug(
|
|
394
|
+
`Processing guest event subscribe request for event ${eventId}. requestId = ${requestId}`
|
|
395
|
+
);
|
|
396
|
+
const guest = this.#getGuestForWindow(sourceWin);
|
|
397
|
+
if (!guest) {
|
|
398
|
+
this.#logger.warn(
|
|
399
|
+
"Rejected event subscribe request from unknown guest window"
|
|
400
|
+
);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
setTimeout(() => {
|
|
404
|
+
try {
|
|
405
|
+
this.#onGuestEventSubscribe?.({
|
|
406
|
+
guestId: guest.id,
|
|
407
|
+
eventId,
|
|
408
|
+
criteria,
|
|
409
|
+
token
|
|
410
|
+
});
|
|
411
|
+
} catch (error) {
|
|
412
|
+
}
|
|
413
|
+
}, 0);
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* Handles a guest event unsubscribe request.
|
|
417
|
+
*
|
|
418
|
+
* This method processes an unsubscribe request from a guest window for a specific event.
|
|
419
|
+
* It verifies the source window, retrieves the corresponding guest, and invokes the
|
|
420
|
+
* `#onGuestEventUnsubscribe` callback asynchronously. If the source window is not recognized,
|
|
421
|
+
* the request is rejected and a warning is logged.
|
|
422
|
+
* @param params - The parameters for the unsubscribe request, including:
|
|
423
|
+
* - `sourceWin`: The window from which the request originated.
|
|
424
|
+
* - `requestId`: The unique identifier for the request.
|
|
425
|
+
* - `body`: An object containing the `eventId` and `token` for the event to unsubscribe.
|
|
426
|
+
* @param params.sourceWin
|
|
427
|
+
* @param params.requestId
|
|
428
|
+
* @param params.body
|
|
429
|
+
* @returns `false` if the guest window is unknown; otherwise, no explicit return value.
|
|
430
|
+
*/
|
|
431
|
+
#handleGuestEventUnsubscribe = ({
|
|
432
|
+
sourceWin,
|
|
433
|
+
requestId,
|
|
434
|
+
body
|
|
435
|
+
}) => {
|
|
436
|
+
const { eventId, token } = body;
|
|
437
|
+
this.#logger.debug(
|
|
438
|
+
`Processing guest event unsubscribe request for event ${eventId}. requestId = ${requestId}`
|
|
439
|
+
);
|
|
440
|
+
const guest = this.#getGuestForWindow(sourceWin);
|
|
441
|
+
if (!guest) {
|
|
442
|
+
this.#logger.warn(
|
|
443
|
+
"Rejected event unsubscribe request from unknown guest window"
|
|
444
|
+
);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
setTimeout(() => {
|
|
448
|
+
try {
|
|
449
|
+
this.#onGuestEventUnsubscribe?.({
|
|
450
|
+
guestId: guest.id,
|
|
451
|
+
eventId,
|
|
452
|
+
token
|
|
453
|
+
});
|
|
454
|
+
} catch (error) {
|
|
455
|
+
}
|
|
456
|
+
}, 0);
|
|
457
|
+
};
|
|
362
458
|
// handles guest resize event
|
|
363
459
|
#handleGuestResize = ({
|
|
364
460
|
sourceWin,
|
|
@@ -497,6 +593,14 @@ class SSFHost {
|
|
|
497
593
|
messageType: MessageType.ObjectInvoke,
|
|
498
594
|
callback: this.#handleObjectInvoke
|
|
499
595
|
});
|
|
596
|
+
this.#remoting.listen({
|
|
597
|
+
messageType: MessageType.GuestEventSubscribe,
|
|
598
|
+
callback: this.#handleGuestEventSubscribe
|
|
599
|
+
});
|
|
600
|
+
this.#remoting.listen({
|
|
601
|
+
messageType: MessageType.GuestEventUnsubscribe,
|
|
602
|
+
callback: this.#handleGuestEventUnsubscribe
|
|
603
|
+
});
|
|
500
604
|
};
|
|
501
605
|
/**
|
|
502
606
|
* check if the value is a proxy event
|
package/dist/esm/package.json
CHANGED
package/dist/public/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://cdn.qa1.ice.com/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.
|
|
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/emuiSsfHost.94ad16e13cca048a63fe.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><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" 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 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" 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 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="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></div></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>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(S,E){typeof exports=="object"&&typeof module=="object"?module.exports=E():typeof define=="function"&&define.amd?define([],E):typeof exports=="object"?exports.ice=E():(S.ice=S.ice||{},S.ice.host=E())})(globalThis,()=>(()=>{"use strict";var v={};v.d=(n,e)=>{for(var t in e)v.o(e,t)&&!v.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},v.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),v.r=n=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var S={};v.r(S),v.d(S,{Event:()=>E,Guest:()=>q,IFrameSandboxValues:()=>y,OpenMode:()=>f,SSFHost:()=>ee,ScriptingObject:()=>A});class E{name;objectId;id;constructor(e){const{name:t,objectId:i}=e;if(!t)throw new Error("Event name is required");if(!i)throw new Error("Scripting object id is required");this.objectId=i,this.name=t,this.id=`${this.objectId}.${this.name}`.toLowerCase()}}class T{static[Symbol.hasInstance](e){return e.getType?.()==="ProxyEvent"}#e;objectId;name;id;getType(){return"ProxyEvent"}constructor(e){const{name:t,objectId:i,eventSrc:s}=e;this.objectId=i,this.name=t,this.#e=s,this.id=`${this.objectId}.${this.name}`.toLowerCase()}subscribe=e=>this.#e.subscribe({eventId:this.id,callback:e});unsubscribe=e=>{this.#e.unsubscribe({eventId:this.id,token:e})}}const B=n=>n instanceof E,te=(n,e)=>`${n.toLowerCase()}.${e.toLowerCase()}`,F="function",H=(n,e)=>typeof n===F&&!!e&&!e.startsWith("_");class A{#e;#i="Object";constructor(e,t){this.#e=e,this.#i=t||this.#i}get id(){return this.#e}get objectType(){return this.#i}_toJSON=()=>{const e=[],t=[];return Object.keys(this).forEach(i=>{const s=this[i];B(s)?t.push(i):H(s,i)&&e.push(i)}),{objectId:this.#e,objectType:this.#i,functions:e,events:t}};_dispose=()=>{};dispose=()=>{}}var h=(n=>(n.GuestClose="guest:close",n.GuestEventSubscribe="guest:eventSubscribe",n.GuestEventUnsubscribe="guest:eventUnsubscribe",n.GuestFocus="guest:focus",n.GuestReady="guest:ready",n.GuestReadyComplete="guest:readyComplete",n.GuestResize="guest:resize",n.HandShake="handshake",n.HandShakeAck="handshake:ack",n.HostClose="host:close",n.HostConfig="host:config",n.ListObjects="list:objects",n.ObjectEvent="object:event",n.ObjectGet="object:get",n.ObjectInvoke="object:invoke",n))(h||{}),f=(n=>(n.Popup="popup",n.Embed="embed",n))(f||{}),y=(n=>(n.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",n.AllowDownloads="allow-downloads",n.AllowForms="allow-forms",n.AllowModals="allow-modals",n.AllowOrientationLock="allow-orientation-lock",n.AllowPointerLock="allow-pointer-lock",n.AllowPopups="allow-popups",n.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",n.AllowPresentation="allow-presentation",n.AllowSameOrigin="allow-same-origin",n.AllowScripts="allow-scripts",n.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",n.AllowTopNavigation="allow-top-navigation",n.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",n))(y||{});const W=n=>{if(n==="about:blank")return"*";try{const{origin:e}=new URL(n);return e==="null"||!e?n:e}catch{const{origin:t}=new URL(n,document.baseURI);return t}},U=(n,e=[])=>{const t=e||[];return n&&n.forEach?n.forEach(i=>{U(i,t)}):typeof n<"u"&&t.push(n),t},ie=n=>typeof n?._toJSON=="function";function R(n){return typeof n=="function"}const se=n=>n?.id??n;class q{id;title;url;searchParams;domElement;window;openMode;origin;initialized=!1;ready=!1;capabilities;#e;#i;constructor(e){const{guestId:t,domElement:i=null,title:s,url:o,window:r,searchParams:c={},openMode:a=f.Embed,remoting:d,analyticsObj:l}=e;this.id=t,this.title=s,this.url=o,this.origin=W(o),this.searchParams=c,this.domElement=i,this.window=r,this.openMode=a,this.capabilities={},this.#i=l,this.#e=d}dispose=()=>{if(this.openMode===f.Popup&&!this.window.closed)try{this.window.document,this.window.close()}catch{this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:h.HostClose,messageBody:{}})}else this.domElement?.remove?.();this.#e.removeSender({origin:this.origin,window:this.window})};getInfo=()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url});handShake=()=>new Promise(e=>{let t=0;const i=5,s=setInterval(()=>{t>=i?(clearInterval(s),e(!1)):(this.#e.send({targetWin:this.window,targetOrigin:this.origin,messageType:h.HandShake,messageBody:{}}),t+=1)},1e3);this.#e.listen({messageType:h.HandShakeAck,callback:()=>{clearInterval(s),e(!0)}})});init=()=>{this.#e.addSender({origin:this.origin,window:this.window}),this.openMode===f.Popup&&this.handShake().catch(()=>{})};dispatchEvent=(e,t)=>(this.#i.startTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{}),this.#e.invoke({targetWin:this.window,targetOrigin:this.origin,messageType:h.ObjectEvent,messageBody:e,responseTimeoutMs:t}).finally(()=>{this.#i.endTiming(`ScriptingObject.Event.${e.object.objectId}.${e.eventName}`,{appId:this.id,appUrl:this.url}).catch(()=>{})}));send=e=>{this.#e.send({targetWin:this.window,targetOrigin:this.origin,...e})}}const L={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let P;const J=new Uint8Array(16);function Y(){if(!P&&(P=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!P))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return P(J)}const g=[];for(let n=0;n<256;++n)g.push((n+256).toString(16).slice(1));function _(n,e=0){return g[n[e+0]]+g[n[e+1]]+g[n[e+2]]+g[n[e+3]]+"-"+g[n[e+4]]+g[n[e+5]]+"-"+g[n[e+6]]+g[n[e+7]]+"-"+g[n[e+8]]+g[n[e+9]]+"-"+g[n[e+10]]+g[n[e+11]]+g[n[e+12]]+g[n[e+13]]+g[n[e+14]]+g[n[e+15]]}function oe(n,e=0){const t=_(n,e);if(!validate(t))throw TypeError("Stringified UUID is invalid");return t}const re=null;function X(n,e,t){if(L.randomUUID&&!e&&!n)return L.randomUUID();n=n||{};const i=n.random||(n.rng||Y)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let s=0;s<16;++s)e[t+s]=i[s];return e}return _(i)}const C=X,M="elli:remoting",x="elli:remoting:response",z="elli:remoting:exception",$=({messageType:n,messageBody:e,onewayMsg:t=!1})=>({requestId:t?null:C(),source:M,type:n,body:e}),ce=n=>{const{targetWin:e,targetOrigin:t,messageType:i,messageBody:s}=n,o=$({messageType:i,messageBody:s});e.postMessage(o,t)};class K{#e;#i;#t=new Map;#n=new Map;#s=null;#o=new Map;constructor(e,t){if(!e)throw new Error("logger is required");if(!t)throw new Error("correlationId is required");this.#e=t,this.#i=e}#r=()=>{const e=Date.now(),t=[];this.#n.forEach((i,s)=>{const{requestId:o,cancelTime:r}=i;this.#i.debug(`Checking response timeout for requestId: ${o}) @ ${r??""}`),i.cancelTime&&i.cancelTime<e&&(this.#i.debug(`Detected response timeout for requestId: ${o}...`),t.push(s),i.resolve(),this.#i.debug(`Aborted waiting for response to requestid: ${o})`))}),t.forEach(i=>{this.#i.debug(`removing invocations with requestId ${i} from cache since response time has expired`),this.#n.delete(i)}),this.#n.size===0&&(this.#i.debug("stopping response monitor"),this.#h())};#l=()=>{this.#s===null&&(this.#i.debug("Staring response timeout evaluator"),this.#s=window.setInterval(this.#r,200))};#h=()=>{this.#s!==null&&(window.clearInterval(this.#s),this.#s=null,this.#i.debug("Stopped response timeout evaluator"))};#d=e=>{const t=this.#n.get(e);return this.#i.debug(`serving requestId: ${e}`),this.#n.delete(e),t};#g=e=>{const{requestId:t}=e;this.#i.debug(`Response received for invocation requestId: ${t}`);const i=this.#d(t);return i?(i.resolve(e.body),!0):(this.#i.debug(`Received response to stale/invalid request with requestId: ${t}`),!1)};#f=e=>{this.#i.debug(`Exception received for invocation (requestId = ${e.requestId})`);const t=this.#d(e.requestId);return t?(t.reject(new Error(e.body)),!0):(this.#i.warn(`Received exception for stale/invalid request (requestId = ${e.requestId})`),!1)};#u=({sourceWin:e,sourceOrigin:t,message:i})=>{this.#i.debug(`Received message of type "${i.type}"`);const s=this.#t.get(i.type);return s?(s.forEach(o=>{this.#i.debug(`Invoking message handler ${o.name}`),o({sourceWin:e,sourceOrigin:t,requestId:i.requestId,type:i.type,body:i.body})}),!0):!1};#a=e=>{if(this.#i.debug(`Remoting: Received message ${JSON.stringify(e.data)}`),this.#o.size===0||!e.source)return!1;const t=this.#o.get(e.source);return!t||e?.data?.source!==M?!1:(e.data.type===x?this.#g(e.data):e.data.type===z?this.#f(e.data):this.#u({sourceWin:e.source,sourceOrigin:t,message:e.data}),!0)};addSender=e=>{const{origin:t,window:i}=e;if(!t)throw new Error("origin is required");if(!i)throw new Error("window is required");this.#o.set(i,t)};initialize=e=>{e.removeEventListener("message",this.#a),e.addEventListener("message",this.#a),this.#i.debug(`initialized remoting id: ${this.#e}`)};close=()=>{window.removeEventListener("message",this.#a),this.#i.debug(`closed remoting id: ${this.#e}`)};invoke=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o,responseTimeoutMs:r}=e;return new Promise((c,a)=>{const d=$({messageType:s,messageBody:o});this.#n.set(d.requestId,{requestId:d.requestId,resolve:c,reject:a,cancelTime:r?Date.now()+Number.parseInt(r,10):null}),t.postMessage(d,i);const{requestId:l}=d;this.#i.debug(`Posted invocation message of type ${s} requestId: ${l||""}`),r&&(this.#i.debug(`starting response monitor for requestId: ${l||""} for ${r} ms`),this.#l())})};listen=e=>{const{messageType:t,callback:i}=e,s=this.#t.get(t)||[];s.push(i),this.#t.set(t,s)};send=e=>{const{targetWin:t,targetOrigin:i,messageType:s,messageBody:o}=e,r=$({messageType:s,messageBody:o,onewayMsg:!0});t.postMessage(r,i),this.#i.debug(`Posted one-way message of type "${s}"`)};removeSender=e=>{const{window:t}=e;t&&this.#o.delete(t)};respond=e=>{const{targetWin:t,targetOrigin:i,requestId:s,response:o}=e,r=$({messageType:x,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#i.debug(`Response sent to caller for invocation requestId: ${s}`)};raiseException=e=>{const{targetWin:t,targetOrigin:i,requestId:s,ex:o}=e,r=$({messageType:z,messageBody:o});r.requestId=s,t.postMessage(r,i),this.#i.debug(`Exception sent to caller for invocation. requestId: ${s}`)}}const N="module";var Q=(n=>(n.USER="USER",n.PARTNER="PARTNER",n))(Q||{});class Z{#e=new Map;#i=new Map;#t=e=>{const{so:t,guestId:i}=e,s=t.id.toLowerCase(),o=this.#i.get(i);if(!o)this.#i.set(i,new Map([[s,e]]));else{if(o.has(s))throw new Error(`Scripting Object ${t.id} already exists for guest ${i}`);o.set(s,e)}};#n=({so:e})=>{e._dispose&&typeof e._dispose=="function"&&e._dispose()};#s=({objectId:e,guestId:t})=>{if(e===N&&!t)for(const[,s]of this.#i){const o=s.get(e);if(o)return o}const i=t?this.#i.get(t):null;return i?i.get(e)??null:null};#o=({objectId:e,guestId:t}={})=>{if(t){if(!e){const s=this.#i.get(t);s&&s.forEach(this.#n),this.#i.delete(t);return}const i=this.#i.get(t);if(i){const s=i.get(e);s&&this.#n(s),i.delete(e)}}else e&&this.#i.forEach(i=>{const s=i.get(e);s&&this.#n(s),i.delete(e)})};addScriptingObject=(e,t)=>{const{guestId:i}=t||{};if(!e?.id||!e?._toJSON)throw new Error("Object is not derived from ScriptingObject");const s=e.id.toLowerCase();if(s.trim().toLowerCase()===N&&!i)throw new Error("Guest id is required to add Module scripting object");if(i){this.#t({so:e,...t,guestId:i});return}if(this.#e.has(s))throw new Error(`Scripting Object ${e.id} already exists`);this.#e.set(s,{so:e,...t})};getObject=(e,t)=>{const i=e.trim().toLowerCase();let s=this.#s({objectId:i,guestId:t?.id});s=s??this.#e.get(i)??null;const{so:o}=s||{};return o||null};has=(e,t)=>this.getObject(e,t)!==null;listScriptingObjects=e=>{let t=Array.from(this.#e.keys());const i=this.#i.get(e);return t=i?t.concat(Array.from(i.keys())):t,Array.from(new Set(t))};removeScriptingObject=(e,t)=>{const i=e.toLowerCase();if(t)this.#o({objectId:i,guestId:t});else{this.#o({objectId:i});const s=this.#e.get(i);s&&this.#n(s),this.#e.delete(i)}};removeAllScriptingObjects=e=>{e?this.#o({guestId:e}):(this.#e.forEach(this.#n),this.#e.clear())}}class ae{__TYPE__="Proxy";id;objectType;constructor(e,t){this.id=e,this.objectType=t}}const D=n=>n?.constructor?.name==="Proxy"||n?.constructor?.name==="ScriptingObjectProxy"||n?.__TYPE__==="Proxy",V=[y.AllowScripts,y.AllowPopups,y.AllowModals,y.AllowForms,y.AllowDownloads,y.AllowSameOrigin].join(" ");class ee{hostId;#e;#i;#t;#n;#s=new Map;#o=new Map;#r;#l=null;#h=null;#d=null;#g=null;constructor(e,t){if(this.hostId=e,!t?.logger)throw new Error("Logger is required");if(!t?.analyticsObj)throw new Error("Analytics object is required");if(this.#t=t.logger,this.#n=t.analyticsObj,this.#i=C(),this.#e=new K(this.#t,this.#i),t?.readyStateCallback&&typeof t?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");this.#l=t?.readyStateCallback||null,this.#d=t?.onGuestEventSubscribe||null,this.#g=t?.onGuestEventUnsubscribe||null,this.#r=new Z,this.#e.initialize(window),this.#R(),window.addEventListener("beforeunload",this.#p),this.#L(),this.#t.debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${this.#i}`)}#f=(e,t)=>{const i={event:e,...t};this.#n.sendBAEvent(i).catch(()=>{})};#u=(e,t)=>{this.#n.startTiming(e,t).catch(()=>{})};#a=(e,t)=>{this.#n.endTiming(e,t).catch(()=>{})};#p=()=>{for(const e of this.#s.values())e.openMode===f.Popup&&this.unloadGuest(e.id)};#c=e=>Array.from(this.#s.values()).find(t=>t.window===e);#y=e=>{for(const t of this.#s.values())if(t.url===e)return t;return null};#j=e=>typeof e?._toJSON=="function";#w=(e,t)=>this.#j(e)?(this.#r.has(e?.id,t)||this.#r.addScriptingObject(e,t?{guestId:t?.id}:{}),{type:"object",object:e._toJSON()}):{type:"value",value:e};#x=e=>typeof e=="string"?e:e instanceof Error?e.message:"An unexpected error occurred in the host application";#m=e=>{e.ready&&this.#e.send({targetWin:e.window,targetOrigin:e.origin,messageType:h.HostConfig,messageBody:{logLevel:this.#t.getLogLevel(),...e.getInfo()}})};#O=({guest:e,obj:t,functionName:i,functionParams:s})=>{const o=t[i];return R(o)?(this.#t.debug(`Invoking host implementation of ${t.id}.${String(i)}()`),new Promise(r=>{Object.defineProperty(o,"callContext",{value:{guest:e},configurable:!0,enumerable:!0,writable:!0}),r(o(...s))})):(this.#t.warn(`Attempt to call invalid function on object type ${t.objectType}: ${String(i)}`),Promise.reject(new Error(`Method '${i}' not found in Scripting Object '${t.id}'`)))};#v=({sourceWin:e,sourceOrigin:t,requestId:i})=>{const s=this.#c(e);if(!s){this.#t.warn(`Received ready event for unknown guest. requestId: ${i}`);return}if(!s.initialized){this.#t.warn("Guest must be initialized before it is marked as ready"),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:"Guest must be initialized before it is marked as ready"});return}if(!s.ready){s.ready=!0;const o=s.getInfo();this.#a("SSF.Guest.Load",{appId:o.guestId,appUrl:o.guestUrl}),this.#m(s),this.#l?.(s),this.#t.audit({message:"Guest is ready",...o})}};#S=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const o=this.#c(e);if(!o){this.#t.warn(`Received ready event for unknown guest. requestid = ${i}`);return}o.initialized||(o.initialized=!0,o.capabilities=s||{},this.#t.audit({message:"Guest is initialized",...o.getInfo()})),(!s||!s.onReady)&&this.#v({sourceWin:e,sourceOrigin:t,requestId:i,type:"",body:null})};#I=async({sourceWin:e})=>{if(e?.window){const t=this.#b(e);t&&!await t.handShake()&&this.unloadGuest(e)}};#$=({sourceWin:e,sourceOrigin:t,requestId:i})=>{this.#t.debug(`Processing listObjects request. requestId = ${i}`);const s=this.#c(e);if(!s)return this.#t.warn("Rejected object request from unknown guest window"),!1;const o=this.#r.listScriptingObjects(s.id);return this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:o}),this.#t.audit({message:"name of scripting objects returned",requestId:i,objects:o,...s.getInfo()}),!0};#k=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s;this.#t.debug(`Processing getObject request for object ${o}. requestId = ${i}`);const r=this.#c(e);if(!r)return this.#t.warn("Rejected object request from unknown guest window"),!1;const c=this.getScriptingObject(o,{guest:r});return c?(this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#w(c,r)}),this.#t.audit({message:"Scripting Object returned",requestId:i,scriptingObject:o,...r.getInfo()}),!0):(this.#t.warn(`unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1)};#P=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,criteria:o,token:r}=i;this.#t.debug(`Processing guest event subscribe request for event ${s}. requestId = ${t}`);const c=this.#c(e);if(!c){this.#t.warn("Rejected event subscribe request from unknown guest window");return}setTimeout(()=>{try{this.#d?.({guestId:c.id,eventId:s,criteria:o,token:r})}catch{}},0)};#G=({sourceWin:e,requestId:t,body:i})=>{const{eventId:s,token:o}=i;this.#t.debug(`Processing guest event unsubscribe request for event ${s}. requestId = ${t}`);const r=this.#c(e);if(!r){this.#t.warn("Rejected event unsubscribe request from unknown guest window");return}setTimeout(()=>{try{this.#g?.({guestId:r.id,eventId:s,token:o})}catch{}},0)};#T=({sourceWin:e,requestId:t,body:i})=>{const s=this.#c(e);if(!s){this.#t.warn(`Received resize event from unknown guest. requestid = ${t}`);return}s.domElement&&(s.domElement.style.height=`${i.height}px`),this.#t.debug(`Guest ${s.id} resized to ${i.width}x${i.height}`)};#A=({sourceWin:e,sourceOrigin:t,requestId:i,body:s})=>{const{objectId:o}=s,r=this.#c(e);if(!r)return this.#t.warn("Rejected method invocation request from unknown guest window"),!1;this.#t.debug(`Function ${o}.${String(s.functionName)}() called from guest "${r.id}" (requestId = ${i})`);const c=this.getScriptingObject(o,{guest:r});if(!c)return this.#t.warn(`Invocation of unknown or unauthorized object ${o} from guest ${r.id}`),this.#e.raiseException({targetWin:e,targetOrigin:t,requestId:i,ex:`The requested object (${o}) is not available`}),!1;const a=r.getInfo();return this.#u(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl}),this.#O({guest:r,obj:c,functionName:s.functionName,functionParams:s.functionParams}).then(d=>{this.#e.respond({targetWin:e,targetOrigin:t,requestId:i,response:this.#w(d,r)}),this.#t.audit({message:"Value returned for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).catch(d=>{this.#e.raiseException({targetWin:e,targetOrigin:r.origin,requestId:i,ex:d}),this.#t.audit({message:"Exception thrown for Scripting Object method call",requestId:i,scriptingObject:o,scriptingMethod:s.functionName,...a})}).finally(()=>{this.#a(`ScriptingObject.API.${o}.${s.functionName}`,{appId:a.guestId,appUrl:a.guestUrl})}),!0};#U=()=>{this.#e.listen({messageType:h.GuestResize,callback:this.#T})};#R=()=>{this.#e.listen({messageType:h.GuestReady,callback:this.#S}),this.#e.listen({messageType:h.GuestReadyComplete,callback:this.#v}),this.#e.listen({messageType:h.GuestClose,callback:this.#I}),this.#e.listen({messageType:h.ListObjects,callback:this.#$}),this.#e.listen({messageType:h.ObjectGet,callback:this.#k}),this.#e.listen({messageType:h.ObjectInvoke,callback:this.#A}),this.#e.listen({messageType:h.GuestEventSubscribe,callback:this.#P}),this.#e.listen({messageType:h.GuestEventUnsubscribe,callback:this.#G})};#q=e=>e instanceof T||typeof e?.subscribe=="function";#E=e=>{const t=new q({...e,remoting:this.#e,analyticsObj:this.#n});return t.init(),this.#s.set(e.guestId,t),t};#b=e=>{let t=typeof e=="string"?this.#s.get(e):null;return t||(t=Array.from(this.#s.values()).find(i=>i.window===e||i.domElement===e)),t};#L=()=>{this.#h=setInterval(()=>{const e=[];this.#s.forEach(t=>{t.openMode===f.Popup&&t.window.closed&&e.push(t)}),e.forEach(t=>{const{id:i}=t;this.unloadGuest(i),this.#o.get(i)?.forEach(o=>{o({id:i}).catch(()=>{})})})},1e3)};#_=e=>{const{url:t,title:i,popupWindowFeatures:s={},searchParams:o,guestId:r,onLoad:c,onError:a}=e,{width:d=800,height:l=600,top:j=100,left:w=100}=s;let p=this.#y(t);if(p)p.window.closed||p.send({messageType:h.GuestFocus,messageBody:{}});else{const I=[{key:"width",value:d},{key:"height",value:l},{key:"top",value:j},{key:"left",value:w}].reduce((u,O,b)=>(b>0&&O.value&&(u+=","),O.value?`${u}${O.key}=${O.value}`:u),""),m=window.open(t,i,`popup, ${I}`);if(m)try{setTimeout(()=>{c?.(r)},0)}catch(u){this.#t.debug(`Error occurred in onLoad for guest with id '${r}': ${u.message}`)}else{try{setTimeout(()=>{a?.(r)},0)}catch(u){this.#t.debug(`Error occurred in onError for guest with id '${r}': ${u.message}`)}throw new Error("Failed to open guest application in popup window")}m.opener=null,p=this.#E({guestId:r,window:m,title:i,url:t,searchParams:o,openMode:f.Popup})}return p};#C=e=>{const{url:t,title:i,targetElement:s,searchParams:o,guestId:r,onLoad:c,onError:a,options:d={}}=e,l=s.ownerDocument??document,{fitToContent:j=!1,disableSandbox:w=!1,sandboxValues:p=[],style:I="",permissionPolicy:m=""}=d;if(!i)throw new Error("title is required");j&&this.#U();const u=l.createElement("iframe");u.setAttribute("id",r);const O=()=>{setTimeout(()=>{try{c?.(r)}catch(G){this.#t.debug(`Error occurred in onLoad for guest with id '${r}': ${G.message}`)}},0),this.#t.debug(`frame loaded for guest with id '${r}'`),u.removeEventListener("load",O)},b=()=>{setTimeout(()=>{try{a?.(r)}catch(G){this.#t.debug(`Error occurred in onError for guest with id '${r}': ${G.message}`)}},0),this.#t.error(`frame load failed for guest with id '${r}'`),u.removeEventListener("error",b)};u.addEventListener("load",O),u.addEventListener("error",b),u.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${I}`),w||u.setAttribute("sandbox",`${V} ${p.join(" ")}`),u.setAttribute("title",i),u.setAttribute("src",t),m&&u.setAttribute("allow",m),s.appendChild(u);const k=l.getElementById(r);return this.#E({guestId:r,domElement:k,window:k.contentWindow,title:i,url:t,searchParams:o,openMode:f.Embed})};#M=(e,t)=>{let i="";return Object.keys(t).forEach(s=>{i+=`${(i.length?"&":"")+encodeURIComponent(s)}=${encodeURIComponent(t[s])}`}),e+(i?(e.indexOf("?")>=0?"&":"?")+i:"")};addScriptingObject=(e,t)=>{if(D(e)){const i=this.cloneScriptingObject(e);this.#r.addScriptingObject(i,t)}else this.#r.addScriptingObject(e,t)};cloneScriptingObject=e=>{if(!e)throw new Error("proxy is required");const t=new A(e.id,e.objectType);let i=[];return Object.keys(e).forEach(s=>{const o=e[s];if(this.#q(o)){const r=new E({name:o.name||s,objectId:t.id});if(Object.defineProperty(t,s,{value:r,enumerable:!0}),o instanceof T){const c=({eventParams:d,eventOptions:l})=>this.dispatchEvent({event:r,eventParams:d,eventOptions:l}),a=o.subscribe(c);i.push(()=>{o.unsubscribe(a)})}else{const c=o.subscribe?.((a,d,l)=>this.dispatchEvent({event:r,eventParams:d,eventOptions:l}));i.push(()=>{o.unsubscribe?.(c)})}}else if(R(o)&&(Object.defineProperty(t,s,{value:async(...r)=>{const c=await o(...r);return D(c)?this.cloneScriptingObject(c):c},enumerable:!0}),s==="dispose")){const r=t.dispose;Object.defineProperty(t,s,{value:()=>(t._dispose(),r.apply(t)),enumerable:!0})}}),t._dispose=()=>{i.forEach(s=>{s?.()}),i=[]},t};close=()=>{clearInterval(this.#h),this.#p(),this.#e.close(),window.removeEventListener("beforeunload",this.#p),this.#t.debug(`host is closed. hostId: ${this.hostId}, correlationId: ${this.#i}`)};dispatchEvent=async e=>{const{event:{id:t,name:i},eventParams:s,eventOptions:o={}}=e,{eventHandler:r=null,timeout:c=null,window:a=null,guestId:d}=o,l=t.split(".")[0],j=d||a,w=j?this.#b(j):null,p=w?this.getScriptingObject(l,{guest:w}):this.getScriptingObject(l);if(!p)return this.#t.warn(`Attempt to dispatch event ${i} on unknown object ${l}`),Promise.resolve([]);const I={object:p._toJSON(),eventName:i,eventParams:s,eventHandler:r,eventOptions:{allowsFeedback:!1}};c&&!Number.isNaN(c)&&(I.eventOptions={allowsFeedback:!0,timeout:Number(c)});const m=[];let u=!1;return this.#s.forEach(b=>{const k=b.getInfo();(!a||a===b.window)&&(c&&b?.capabilities?.eventFeedback?(m.push(b.dispatchEvent(I,c)),u||(this.#u(`ScriptingObject.Event.${p.id}.${i}`,{appId:this.hostId,appUrl:window.location.href}),u=!0),this.#t.audit({message:"Event dispatched and awaiting feedback",scriptingEventId:t,...k})):(b.send({messageType:h.ObjectEvent,messageBody:I}),this.#t.audit({message:"Event dispatched",scriptingEventId:t,...k})))}),await Promise.all(m).then(b=>(this.#t.audit({message:"Event feedback received",scriptingEventId:t}),U(b))).catch(b=>{throw this.#t.error({message:"Error processing event",eventId:t,exception:b}),b}).finally(()=>{u&&this.#a(`ScriptingObject.Event.${p.id}.${i}`,{appId:this.hostId,appUrl:window.location.href})})};getGuests=()=>{const e=[];return this.#s.forEach(t=>{e.push(t)}),e};getScriptingObject=(e,t)=>this.#r.getObject(e,t?.guest);loadGuest=e=>{const{id:t,url:i,targetElement:s,title:o,searchParams:r={},onLoad:c,onError:a,options:d={}}=e;if(!t)throw new Error("id for guest application is required");const{openMode:l=f.Embed,popupWindowFeatures:j={}}=d,w=this.#M(i,r);let p=null;if(this.#u("SSF.Guest.Load",{appId:t,appUrl:w}),l===f.Popup)p=this.#_({guestId:t,url:w,title:o,searchParams:r,popupWindowFeatures:j,onLoad:c,onError:a});else if(l===f.Embed)p=this.#C({guestId:t,url:w,title:o,targetElement:s,searchParams:r,onLoad:c,onError:a,options:d});else throw new Error(`Invalid openMode: ${l}`);return this.#t.audit({message:"Guest loaded",...p.getInfo()}),p};loadGuests=e=>{const{id:t,url:i,targetElement:s,title:o,searchParamsList:r=[],options:c={}}=e;r.forEach((a,d)=>{this.loadGuest({id:`${t}-${d}`,url:i,title:o,targetElement:s,searchParams:a,options:c})},this)};removeAllScriptingObjects=e=>{this.#r.removeAllScriptingObjects(e)};removeScriptingObject=(e,t)=>{this.#r.removeScriptingObject(e,t)};setLogLevel=e=>{this.#t.setLogLevel(e),this.#s.forEach(this.#m),this.#t.debug("Dispatched config events to all guests")};unloadGuest=e=>{const t=this.#b(e);t&&(t.dispose(),this.#s.delete(t.id),this.#t.audit({message:"Guest is removed from host",...t.getInfo()}))};onGuestClose=e=>{const{id:t,guestCloseCallback:i}=e,s=this.#o.get(t)||[];s.push(i),this.#o.set(t,s)}}return S})());
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=emuiSsfHost.94ad16e13cca048a63fe.js.map
|
|
Binary file
|
|
Binary file
|