@elliemae/ssf-host 2.0.0-next.29
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/app.config.json +20 -0
- package/dist/cjs/guest.js +196 -0
- package/dist/cjs/host.js +930 -0
- package/dist/cjs/ihost.js +16 -0
- package/dist/cjs/index.html +183 -0
- package/dist/cjs/index.js +33 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/tests/guest.html +14 -0
- package/dist/cjs/tests/logger.js +31 -0
- package/dist/cjs/tests/scriptingObjects/appEvents.js +16 -0
- package/dist/cjs/tests/scriptingObjects/appObjects.js +16 -0
- package/dist/cjs/tests/scriptingObjects/appraisalServiceModule.js +127 -0
- package/dist/cjs/tests/scriptingObjects/constant.js +38 -0
- package/dist/cjs/tests/scriptingObjects/floodServiceModule.js +49 -0
- package/dist/cjs/tests/server.js +29 -0
- package/dist/cjs/tests/serverHandlers.js +50 -0
- package/dist/cjs/tests/utils.js +76 -0
- package/dist/cjs/types.js +46 -0
- package/dist/cjs/utils.js +57 -0
- package/dist/esm/app.config.json +20 -0
- package/dist/esm/guest.js +177 -0
- package/dist/esm/host.js +919 -0
- package/dist/esm/ihost.js +0 -0
- package/dist/esm/index.html +183 -0
- package/dist/esm/index.js +13 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/tests/guest.html +14 -0
- package/dist/esm/tests/logger.js +15 -0
- package/dist/esm/tests/scriptingObjects/appEvents.js +0 -0
- package/dist/esm/tests/scriptingObjects/appObjects.js +0 -0
- package/dist/esm/tests/scriptingObjects/appraisalServiceModule.js +112 -0
- package/dist/esm/tests/scriptingObjects/constant.js +18 -0
- package/dist/esm/tests/scriptingObjects/floodServiceModule.js +29 -0
- package/dist/esm/tests/server.js +9 -0
- package/dist/esm/tests/serverHandlers.js +20 -0
- package/dist/esm/tests/utils.js +56 -0
- package/dist/esm/types.js +26 -0
- package/dist/esm/utils.js +37 -0
- package/dist/public/app.config.json +20 -0
- package/dist/public/autoFill.js +3 -0
- package/dist/public/autoFill.js.br +0 -0
- package/dist/public/autoFill.js.gz +0 -0
- package/dist/public/autoFill.js.map +1 -0
- package/dist/public/index.html +1 -0
- package/dist/public/init.js +3 -0
- package/dist/public/init.js.br +0 -0
- package/dist/public/init.js.gz +0 -0
- package/dist/public/init.js.map +1 -0
- package/dist/public/js/emuiSsfHost.c8f735724b6fe44f4dd6.js +3 -0
- package/dist/public/js/emuiSsfHost.c8f735724b6fe44f4dd6.js.br +0 -0
- package/dist/public/js/emuiSsfHost.c8f735724b6fe44f4dd6.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.c8f735724b6fe44f4dd6.js.map +1 -0
- package/dist/public/loan-object.js +3 -0
- package/dist/public/loan-object.js.br +1 -0
- package/dist/public/loan-object.js.gz +0 -0
- package/dist/public/loan-object.js.map +1 -0
- package/dist/public/utils.js +3 -0
- package/dist/public/utils.js.br +0 -0
- package/dist/public/utils.js.gz +0 -0
- package/dist/public/utils.js.map +1 -0
- package/dist/types/guest.d.ts +140 -0
- package/dist/types/host.d.ts +107 -0
- package/dist/types/ihost.d.ts +138 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/tests/event.test.d.ts +1 -0
- package/dist/types/tests/guest.test.d.ts +1 -0
- package/dist/types/tests/guestAsHost.test.d.ts +1 -0
- package/dist/types/tests/host.test.d.ts +1 -0
- package/dist/types/tests/logger.d.ts +3 -0
- package/dist/types/tests/scriptingObject.test.d.ts +1 -0
- package/dist/types/tests/scriptingObjects/appEvents.d.ts +3 -0
- package/dist/types/tests/scriptingObjects/appObjects.d.ts +7 -0
- package/dist/types/tests/scriptingObjects/appraisalServiceModule.d.ts +46 -0
- package/dist/types/tests/scriptingObjects/constant.d.ts +8 -0
- package/dist/types/tests/scriptingObjects/floodServiceModule.d.ts +17 -0
- package/dist/types/tests/server.d.ts +1 -0
- package/dist/types/tests/serverHandlers.d.ts +1 -0
- package/dist/types/tests/utils.d.ts +28 -0
- package/dist/types/types.d.ts +145 -0
- package/dist/types/utils.d.ts +8 -0
- package/dist/umd/app.config.json +20 -0
- package/dist/umd/autoFill.js +3 -0
- package/dist/umd/autoFill.js.br +0 -0
- package/dist/umd/autoFill.js.gz +0 -0
- package/dist/umd/autoFill.js.map +1 -0
- package/dist/umd/index.html +1 -0
- package/dist/umd/index.js +3 -0
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -0
- package/dist/umd/init.js +3 -0
- package/dist/umd/init.js.br +0 -0
- package/dist/umd/init.js.gz +0 -0
- package/dist/umd/init.js.map +1 -0
- package/dist/umd/loan-object.js +3 -0
- package/dist/umd/loan-object.js.br +1 -0
- package/dist/umd/loan-object.js.gz +0 -0
- package/dist/umd/loan-object.js.map +1 -0
- package/dist/umd/utils.js +3 -0
- package/dist/umd/utils.js.br +0 -0
- package/dist/umd/utils.js.gz +0 -0
- package/dist/umd/utils.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { IScriptingObjectProxy, ScriptingObjectTypes, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import type { ISSFGuest, EventListeners } from '@elliemae/ssf-common';
|
|
3
|
+
import { Logger, LogLevels } from '@elliemae/pui-diagnostics';
|
|
4
|
+
import { GuestOptions, ValueOf, EventOptions, ScriptingObjects, EventDetail } from './types.js';
|
|
5
|
+
import { Guest } from './guest.js';
|
|
6
|
+
/**
|
|
7
|
+
* options for the SSF Host
|
|
8
|
+
*/
|
|
9
|
+
export type HostOption = {
|
|
10
|
+
/**
|
|
11
|
+
* callback to process guest application ready event
|
|
12
|
+
*/
|
|
13
|
+
readyStateCallback?: (guest: Guest) => void;
|
|
14
|
+
/**
|
|
15
|
+
* instance of pui-diagnostics logger
|
|
16
|
+
*/
|
|
17
|
+
logger: Logger;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* parameters for rendering a guest
|
|
21
|
+
*
|
|
22
|
+
* @typeParam Params - type of the params object
|
|
23
|
+
*/
|
|
24
|
+
export type LoadGuestParam<Params> = {
|
|
25
|
+
/**
|
|
26
|
+
* url of the guest application
|
|
27
|
+
*/
|
|
28
|
+
url: string;
|
|
29
|
+
/**
|
|
30
|
+
* dom element to render the guest application into
|
|
31
|
+
*/
|
|
32
|
+
targetElement: HTMLElement;
|
|
33
|
+
/**
|
|
34
|
+
* page title for the guest application
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* additional parameters for the guest application
|
|
39
|
+
* these will be passed to the guest application as url search parameters
|
|
40
|
+
*/
|
|
41
|
+
params?: Params;
|
|
42
|
+
/**
|
|
43
|
+
* {@link GuestOptions} options for the guest application
|
|
44
|
+
*/
|
|
45
|
+
options?: GuestOptions;
|
|
46
|
+
};
|
|
47
|
+
export type LoadGuestsParam<Params> = Omit<LoadGuestParam<Params>, 'params'> & {
|
|
48
|
+
paramsList?: Array<Params>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* interface for the SSF Host
|
|
52
|
+
*
|
|
53
|
+
* @typeParam AppObjects - type of the scripting objects
|
|
54
|
+
* @typeParam AppEvents - type of the events
|
|
55
|
+
*/
|
|
56
|
+
export interface ISSFHost<AppObjects extends ScriptingObjects = ScriptingObjectTypes, AppEvents extends EventListeners = Events> {
|
|
57
|
+
/**
|
|
58
|
+
* unique id of the host application
|
|
59
|
+
*/
|
|
60
|
+
hostId: string;
|
|
61
|
+
/**
|
|
62
|
+
* adds scripting object to host
|
|
63
|
+
*
|
|
64
|
+
* @param so scripting object
|
|
65
|
+
* @throws Error if the scripting object is invalid
|
|
66
|
+
*/
|
|
67
|
+
addScriptingObject: <SO extends ValueOf<AppObjects>>(so: SO) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Clone parent host's scripting object for exposing to grand children
|
|
70
|
+
*
|
|
71
|
+
* @param proxy - reference to the scripting object obtained through getObject method
|
|
72
|
+
* @param guest - reference to the ssf guest
|
|
73
|
+
* @returns cloned version of the scripting object
|
|
74
|
+
*/
|
|
75
|
+
cloneScriptingObject: <ObjectId extends Extract<keyof AppObjects, string>>(proxy: IScriptingObjectProxy, guest: ISSFGuest<AppEvents>) => AppObjects[ObjectId];
|
|
76
|
+
/**
|
|
77
|
+
* dispose the resources used by the host application
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
close: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* dispatch event to guest application(s)
|
|
83
|
+
*
|
|
84
|
+
* @param {EventDetail} details details of the event to be dispatched
|
|
85
|
+
* @returns promise that resolves to an array with result from each guest application
|
|
86
|
+
*/
|
|
87
|
+
dispatchEvent: <EventId extends Extract<keyof AppEvents, string>, Params extends Parameters<AppEvents[EventId]>[0]['eventParams'], Options extends EventOptions>(details: EventDetail<EventId, Params, Options>) => Promise<any[]>;
|
|
88
|
+
/**
|
|
89
|
+
* get reference to all guest applications
|
|
90
|
+
*
|
|
91
|
+
* @returns list of guest application references
|
|
92
|
+
*/
|
|
93
|
+
getGuests: () => Array<Guest>;
|
|
94
|
+
/**
|
|
95
|
+
* get the scripting object by id
|
|
96
|
+
*
|
|
97
|
+
* @param objectId - id of the scripting object
|
|
98
|
+
* @returns scripting object
|
|
99
|
+
*/
|
|
100
|
+
getScriptingObject: <Id extends Extract<keyof AppObjects, string>>(objectId: Id) => AppObjects[Id] | null;
|
|
101
|
+
/**
|
|
102
|
+
* loads guest application inside sandboxed iframe
|
|
103
|
+
*
|
|
104
|
+
* @param {LoadGuestParam} param - parameters for rendering the guest application
|
|
105
|
+
* @returns reference to the guest object
|
|
106
|
+
*/
|
|
107
|
+
loadGuest: <Params extends Record<string, string | number | boolean>>(param: LoadGuestParam<Params>) => Guest;
|
|
108
|
+
/**
|
|
109
|
+
* loads guest application inside sandboxed iframe with different params
|
|
110
|
+
*
|
|
111
|
+
* @param {LoadGuestsParam} param - parameters for rendering the guest application
|
|
112
|
+
*/
|
|
113
|
+
loadGuests: <Params extends Record<string, string | number | boolean>>(param: LoadGuestsParam<Params>) => void;
|
|
114
|
+
/**
|
|
115
|
+
* removes all scripting objects from host
|
|
116
|
+
*
|
|
117
|
+
*/
|
|
118
|
+
removeAllScriptingObjects: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* removes scripting object from host
|
|
121
|
+
*
|
|
122
|
+
* @param objectId id of the scripting object
|
|
123
|
+
*/
|
|
124
|
+
removeScriptingObject: <Id extends Extract<keyof AppObjects, string>>(objectId: Id) => void;
|
|
125
|
+
/**
|
|
126
|
+
* set the log level for the host application
|
|
127
|
+
*
|
|
128
|
+
* @param level - log level
|
|
129
|
+
*/
|
|
130
|
+
setLogLevel: (level: LogLevels) => void;
|
|
131
|
+
/**
|
|
132
|
+
* unloads guest application from host
|
|
133
|
+
*
|
|
134
|
+
* @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application
|
|
135
|
+
* @throws Error if guestId or Window reference is invalid
|
|
136
|
+
*/
|
|
137
|
+
unloadGuest: (guestIdOrWindowOrEle: string | Window | HTMLIFrameElement) => void;
|
|
138
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Event, ScriptingObject } from '@elliemae/ssf-common';
|
|
2
|
+
export type { GuestOptions, AttachParam, EventDetail } from './types.js';
|
|
3
|
+
export type { HostOption, LoadGuestParam, LoadGuestsParam } from './ihost.js';
|
|
4
|
+
export { Guest } from './guest.js';
|
|
5
|
+
export { IFrameSandboxValues } from './types.js';
|
|
6
|
+
export { SSFHost } from './host.js';
|
|
7
|
+
export type { IScriptingObjectProxy } from '@elliemae/pui-scripting-object';
|
|
8
|
+
export { OpenMode } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { AppraisalService } from './appraisalServiceModule.js';
|
|
3
|
+
import { FloodService } from './floodServiceModule.js';
|
|
4
|
+
export type AppObjects = {
|
|
5
|
+
AppraisalService: AppraisalService;
|
|
6
|
+
FloodService: FloodService;
|
|
7
|
+
} & ScriptingObjectTypes;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IModule, Listener, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { ScriptingObject, Event } from '@elliemae/ssf-common';
|
|
3
|
+
export declare const APPRAISAL_SERVICE_OBJECT = "AppraisalService";
|
|
4
|
+
export type LoanInfo = {
|
|
5
|
+
loanId: string;
|
|
6
|
+
};
|
|
7
|
+
export type AppraisalServiceEvents = {
|
|
8
|
+
'appraisalservice.onprecommit': Listener<AppraisalService, LoanInfo, Record<string, unknown>, boolean>;
|
|
9
|
+
'appraisalservice.onsaved': Listener<AppraisalService, LoanInfo, Record<string, unknown>, void>;
|
|
10
|
+
};
|
|
11
|
+
export declare class AppraisalService extends ScriptingObject implements IModule {
|
|
12
|
+
#private;
|
|
13
|
+
Unloading: Event<Events>;
|
|
14
|
+
onPreCommit: Event<AppraisalServiceEvents>;
|
|
15
|
+
onSaved: Event<AppraisalServiceEvents>;
|
|
16
|
+
constructor({ loanId, creditScore, }: {
|
|
17
|
+
loanId: string;
|
|
18
|
+
creditScore: number;
|
|
19
|
+
});
|
|
20
|
+
getCapabilities: () => Promise<{
|
|
21
|
+
isAdmin: boolean;
|
|
22
|
+
los: string;
|
|
23
|
+
}>;
|
|
24
|
+
getParameters: () => Promise<{
|
|
25
|
+
loanId: string;
|
|
26
|
+
creditScore: number;
|
|
27
|
+
}>;
|
|
28
|
+
getLoanDetails: () => Promise<{
|
|
29
|
+
loanId: string;
|
|
30
|
+
creditScore: number;
|
|
31
|
+
}>;
|
|
32
|
+
setCreditScore: (creditScore: number) => Promise<void>;
|
|
33
|
+
saveLoan: () => Promise<void>;
|
|
34
|
+
commit: () => Promise<unknown>;
|
|
35
|
+
delete: () => never;
|
|
36
|
+
unload: () => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare const appraisalServiceObject: {
|
|
39
|
+
object: {
|
|
40
|
+
events: string[];
|
|
41
|
+
functions: string[];
|
|
42
|
+
objectId: string;
|
|
43
|
+
objectType: string;
|
|
44
|
+
};
|
|
45
|
+
type: string;
|
|
46
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PRE_COMMIT_EVENT_NAME = "onPreCommit";
|
|
2
|
+
export declare const SAVED_EVENT_NAME = "onSaved";
|
|
3
|
+
export declare const UNLOADING_EVENT_NAME = "Unloading";
|
|
4
|
+
export declare const REMOTING = "elli:remoting";
|
|
5
|
+
export declare const REMOTING_RESPONSE = "elli:remoting:response";
|
|
6
|
+
export declare const REMOTING_EXCEPTION = "elli:remoting:exception";
|
|
7
|
+
export declare const EVENT_OBJECT = "object:event";
|
|
8
|
+
export declare const ABOUT_BLANK = "about:blank";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IModule, Events } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { ScriptingObject, Event } from '@elliemae/ssf-common';
|
|
3
|
+
export declare const FLOOD_SERVICE_OBJECT = "FloodService";
|
|
4
|
+
export declare class FloodService extends ScriptingObject implements IModule {
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
readonly Unloading: Event<Events>;
|
|
8
|
+
constructor();
|
|
9
|
+
getBorrowerDetails: () => Promise<{
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string;
|
|
12
|
+
}>;
|
|
13
|
+
getCapabilities: () => Promise<{}>;
|
|
14
|
+
getParameters: () => Promise<{}>;
|
|
15
|
+
unload: () => Promise<void>;
|
|
16
|
+
_dispose: () => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initServer: () => import("msw/lib/SetupServerApi-39df862c").S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const serverHandlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SSFHost, Guest } from '../index.js';
|
|
2
|
+
import { AppObjects } from './scriptingObjects/appObjects.js';
|
|
3
|
+
import { AppEvents } from './scriptingObjects/appEvents.js';
|
|
4
|
+
export declare const createHost: (name?: string) => {
|
|
5
|
+
host: SSFHost<AppObjects, AppEvents>;
|
|
6
|
+
guestReady: Promise<Guest>;
|
|
7
|
+
guestName: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const postMessage: ({ srcWindow, targetWindow, message, }: {
|
|
10
|
+
srcWindow: Window;
|
|
11
|
+
targetWindow: Window;
|
|
12
|
+
message: Record<string, unknown>;
|
|
13
|
+
}) => void;
|
|
14
|
+
export declare const initGuest: (guestId: string) => Window;
|
|
15
|
+
export declare const releaseJSThread: () => Promise<unknown>;
|
|
16
|
+
export type Data = {
|
|
17
|
+
data: {
|
|
18
|
+
type: string;
|
|
19
|
+
requestId: string;
|
|
20
|
+
body: {
|
|
21
|
+
objectId?: string;
|
|
22
|
+
object: {
|
|
23
|
+
objectId: string;
|
|
24
|
+
};
|
|
25
|
+
eventName: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { IScriptingObject, RemotingScriptingObject } from '@elliemae/pui-scripting-object';
|
|
2
|
+
export declare enum OpenMode {
|
|
3
|
+
/**
|
|
4
|
+
* open as a popup window
|
|
5
|
+
*/
|
|
6
|
+
Popup = "popup",
|
|
7
|
+
/**
|
|
8
|
+
* open as an embedded iframe
|
|
9
|
+
*/
|
|
10
|
+
Embed = "embed"
|
|
11
|
+
}
|
|
12
|
+
export type ValueOf<T> = T[keyof T];
|
|
13
|
+
/**
|
|
14
|
+
* allowed sandbox values for the guest application
|
|
15
|
+
*/
|
|
16
|
+
export declare enum IFrameSandboxValues {
|
|
17
|
+
AllowDownloadsWithoutUserActivation = "allow-downloads-without-user-activation",
|
|
18
|
+
AllowDownloads = "allow-downloads",
|
|
19
|
+
AllowForms = "allow-forms",
|
|
20
|
+
AllowModals = "allow-modals",
|
|
21
|
+
AllowOrientationLock = "allow-orientation-lock",
|
|
22
|
+
AllowPointerLock = "allow-pointer-lock",
|
|
23
|
+
AllowPopups = "allow-popups",
|
|
24
|
+
AllowPopupsToEscapeSandbox = "allow-popups-to-escape-sandbox",
|
|
25
|
+
AllowPresentation = "allow-presentation",
|
|
26
|
+
AllowSameOrigin = "allow-same-origin",
|
|
27
|
+
AllowScripts = "allow-scripts",
|
|
28
|
+
AllowStorageAccessByUserActivation = "allow-storage-access-by-user-activation",
|
|
29
|
+
AllowTopNavigation = "allow-top-navigation",
|
|
30
|
+
AllowTopNavigationByUserActivation = "allow-top-navigation-by-user-activation"
|
|
31
|
+
}
|
|
32
|
+
export type GenericFunction = (...args: unknown[]) => unknown;
|
|
33
|
+
export type EventObject = {
|
|
34
|
+
object: RemotingScriptingObject;
|
|
35
|
+
eventName: string;
|
|
36
|
+
eventParams: Record<string, unknown>;
|
|
37
|
+
eventHandler: string | null;
|
|
38
|
+
eventOptions: {
|
|
39
|
+
allowsFeedback: boolean;
|
|
40
|
+
timeout?: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type EventDetails = Record<string, unknown>;
|
|
44
|
+
/**
|
|
45
|
+
* features for the popup window
|
|
46
|
+
*/
|
|
47
|
+
export type WindowFeatures = {
|
|
48
|
+
/**
|
|
49
|
+
* width of the popup window
|
|
50
|
+
*/
|
|
51
|
+
width?: number;
|
|
52
|
+
/**
|
|
53
|
+
* height of the popup window
|
|
54
|
+
*/
|
|
55
|
+
height?: number;
|
|
56
|
+
/**
|
|
57
|
+
* top position of the popup window
|
|
58
|
+
*/
|
|
59
|
+
top?: number;
|
|
60
|
+
/**
|
|
61
|
+
* left position of the popup window
|
|
62
|
+
*/
|
|
63
|
+
left?: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* configuration options for rendering a guest application
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
export type GuestOptions = {
|
|
70
|
+
/**
|
|
71
|
+
* mode of opening the guest application, popup or embed
|
|
72
|
+
*/
|
|
73
|
+
openMode?: OpenMode;
|
|
74
|
+
/**
|
|
75
|
+
* flag to disable sandboxing for iframe
|
|
76
|
+
*/
|
|
77
|
+
disableSandbox?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* sandbox values for iframe
|
|
80
|
+
*/
|
|
81
|
+
sandboxValues?: Array<IFrameSandboxValues>;
|
|
82
|
+
/**
|
|
83
|
+
* resize the iframe to fit the content inside
|
|
84
|
+
*/
|
|
85
|
+
fitToContent?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* features for the popup window
|
|
88
|
+
*/
|
|
89
|
+
windowFeatures?: WindowFeatures;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* event properties
|
|
93
|
+
*/
|
|
94
|
+
export type EventOptions = Partial<{
|
|
95
|
+
window: Window;
|
|
96
|
+
timeout: number;
|
|
97
|
+
eventHandler: string;
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* collection of scripting objects
|
|
102
|
+
*/
|
|
103
|
+
export type ScriptingObjects = Record<string, IScriptingObject>;
|
|
104
|
+
/**
|
|
105
|
+
* parameters for attaching a guest
|
|
106
|
+
*/
|
|
107
|
+
export type AttachParam = {
|
|
108
|
+
/**
|
|
109
|
+
* unique id of the guest application
|
|
110
|
+
*/
|
|
111
|
+
guestId: string;
|
|
112
|
+
/**
|
|
113
|
+
* url of the guest application
|
|
114
|
+
*/
|
|
115
|
+
url: string;
|
|
116
|
+
/**
|
|
117
|
+
* page title for the guest application
|
|
118
|
+
*/
|
|
119
|
+
title: string;
|
|
120
|
+
/**
|
|
121
|
+
* dom element to attach the guest application to
|
|
122
|
+
*/
|
|
123
|
+
domElement?: HTMLIFrameElement;
|
|
124
|
+
/**
|
|
125
|
+
* window object of the guest application
|
|
126
|
+
*/
|
|
127
|
+
window: Window;
|
|
128
|
+
/**
|
|
129
|
+
* open mode of the guest application
|
|
130
|
+
*/
|
|
131
|
+
openMode: OpenMode;
|
|
132
|
+
/**
|
|
133
|
+
* additional parameters for the guest application
|
|
134
|
+
*/
|
|
135
|
+
params?: Record<string, any>;
|
|
136
|
+
};
|
|
137
|
+
export type EventDetail<EventId, Params, Options> = {
|
|
138
|
+
event: {
|
|
139
|
+
id: EventId;
|
|
140
|
+
name: string;
|
|
141
|
+
scriptingObject: IScriptingObject;
|
|
142
|
+
};
|
|
143
|
+
eventParams: Params;
|
|
144
|
+
eventOptions?: Options;
|
|
145
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IScriptingObjectProxy, ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
|
|
2
|
+
import { GenericFunction, ValueOf } from './types.js';
|
|
3
|
+
export declare const getOrigin: (url: string) => string;
|
|
4
|
+
export declare const flatten: (source: any[], target?: any[]) => any[];
|
|
5
|
+
export declare const isScriptingObject: (value: any) => value is ValueOf<ScriptingObjectTypes>;
|
|
6
|
+
export declare function isFunction(value: any): value is GenericFunction;
|
|
7
|
+
export declare const isProxy: (value: any) => value is IScriptingObjectProxy;
|
|
8
|
+
export declare const getObjectId: (elementOrId: HTMLElement | string) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"appId": "ssf-host",
|
|
3
|
+
"activeEnv": "localhost",
|
|
4
|
+
"options": {
|
|
5
|
+
"guestUrl": "http://localhost:4001"
|
|
6
|
+
},
|
|
7
|
+
"env": {
|
|
8
|
+
"localhost": {
|
|
9
|
+
"options": {
|
|
10
|
+
"guestUrl": "http://localhost:4001"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dev2": {},
|
|
14
|
+
"qa2": {},
|
|
15
|
+
"qa3": {},
|
|
16
|
+
"int": {},
|
|
17
|
+
"stage": {},
|
|
18
|
+
"prod": {}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{faker as e}from"https://cdn.skypack.dev/@faker-js/faker";export const getBorrowerDetails=()=>{const s=e.name.firstName(),t=e.name.lastName(),r=e.internet.email(),a=e.phone.phoneNumber(),o=e.address.streetAddress(),n=e.address.city(),d=e.address.state(),c=e.address.zipCode();return{firstName:s,lastName:t,email:r,phone:a,address:o,city:n,state:d,zip:c}};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=autoFill.js.map
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["webpack://ice/autoFill.js"],"sourcesContent":["import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';\n\nexport const getBorrowerDetails = () => {\n const firstName = faker.name.firstName();\n const lastName = faker.name.lastName();\n const email = faker.internet.email();\n const phone = faker.phone.phoneNumber();\n const address = faker.address.streetAddress();\n const city = faker.address.city();\n const state = faker.address.state();\n const zip = faker.address.zipCode();\n return {\n firstName,\n lastName,\n email,\n phone,\n address,\n city,\n state,\n zip,\n };\n};"],"mappings":"AAAA,OAAS,SAAAA,MAAa,0CAEf,aAAM,mBAAqB,IAAM,CACtC,MAAMC,EAAYD,EAAM,KAAK,UAAU,EACjCE,EAAWF,EAAM,KAAK,SAAS,EAC/BG,EAAQH,EAAM,SAAS,MAAM,EAC7BI,EAAQJ,EAAM,MAAM,YAAY,EAChCK,EAAUL,EAAM,QAAQ,cAAc,EACtCM,EAAON,EAAM,QAAQ,KAAK,EAC1BO,EAAQP,EAAM,QAAQ,MAAM,EAC5BQ,EAAMR,EAAM,QAAQ,QAAQ,EAClC,MAAO,CACL,UAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,IAAAC,CACF,CACF","names":["faker","firstName","lastName","email","phone","address","city","state","zip"],"sourceRoot":"","file":"autoFill.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="index.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(D,G){typeof exports=="object"&&typeof module=="object"?module.exports=G():typeof define=="function"&&define.amd?define([],G):typeof exports=="object"?exports.ice=G():D.ice=G()})(globalThis,()=>(()=>{"use strict";var P={};P.d=(e,i)=>{for(var o in i)P.o(i,o)&&!P.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})},P.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),P.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var D={};P.r(D),P.d(D,{Event:()=>G,Guest:()=>Ue,IFrameSandboxValues:()=>A,OpenMode:()=>S,SSFHost:()=>gt,ScriptingObject:()=>Ce});class G{scriptingObject;name;objectId;requiresFeedback;id;constructor(i){const{name:o,requiresFeedback:t=!1,so:s}=i;if(!o)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=o,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=t}}const Xe=e=>e instanceof G,ft=(e,i)=>`${e.toLowerCase()}.${i.toLowerCase()}`;var Ye=Object.defineProperty,Ke=(e,i,o)=>i in e?Ye(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,ce=(e,i,o)=>(Ke(e,typeof i!="symbol"?i+"":i,o),o),Ge=(e,i,o)=>{if(!i.has(e))throw TypeError("Cannot "+o)},F=(e,i,o)=>(Ge(e,i,"read from private field"),o?o.call(e):i.get(e)),Ae=(e,i,o)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,o)},Te=(e,i,o,t)=>(Ge(e,i,"write to private field"),t?t.call(e,o):i.set(e,o),o),B,x;const Qe="function",Ze=(e,i)=>typeof e===Qe&&!!i&&!i.startsWith("_");class Ce{constructor(i,o){Ae(this,B,void 0),Ae(this,x,"Object"),ce(this,"_toJSON",()=>{const t=[],s=[];return Object.keys(this).forEach(r=>{const c=this[r];Xe(c)?s.push(r):Ze(c,r)&&t.push(r)}),{objectId:F(this,B),objectType:F(this,x),functions:t,events:s}}),ce(this,"_dispose",()=>{}),ce(this,"dispose",()=>{}),Te(this,B,i),Te(this,x,o||F(this,x))}get id(){return F(this,B)}get objectType(){return F(this,x)}}B=new WeakMap,x=new WeakMap;var O=(e=>(e.GuestReady="guest:ready",e.GuestClose="guest:close",e.GuestReadyComplete="guest:readyComplete",e.GuestResize="guest:resize",e.GuestFocus="guest:focus",e.HandShake="handshake",e.HandShakeAck="handshake:ack",e.ObjectInvoke="object:invoke",e.ObjectGet="object:get",e.ObjectEvent="object:event",e.HostConfig="host:config",e))(O||{}),S=(e=>(e.Popup="popup",e.Embed="embed",e))(S||{}),A=(e=>(e.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",e.AllowDownloads="allow-downloads",e.AllowForms="allow-forms",e.AllowModals="allow-modals",e.AllowOrientationLock="allow-orientation-lock",e.AllowPointerLock="allow-pointer-lock",e.AllowPopups="allow-popups",e.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",e.AllowPresentation="allow-presentation",e.AllowSameOrigin="allow-same-origin",e.AllowScripts="allow-scripts",e.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",e.AllowTopNavigation="allow-top-navigation",e.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",e))(A||{});const Ve=e=>{if(e==="about:blank")return"*";const{origin:i}=new URL(e);return i==="null"||!i?e:i},qe=(e,i=[])=>{const o=i||[];return e&&e.forEach?e.forEach(t=>{qe(t,o)}):typeof e<"u"&&o.push(e),o},vt=e=>typeof e?._toJSON=="function";function Re(e){return typeof e=="function"}const et=e=>e?.constructor?.name==="Proxy",mt=e=>e?.id??e;var tt=Object.defineProperty,it=(e,i,o)=>i in e?tt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,_=(e,i,o)=>(it(e,typeof i!="symbol"?i+"":i,o),o),xe=(e,i,o)=>{if(!i.has(e))throw TypeError("Cannot "+o)},U=(e,i,o)=>(xe(e,i,"read from private field"),o?o.call(e):i.get(e)),st=(e,i,o)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,o)},nt=(e,i,o,t)=>(xe(e,i,"write to private field"),t?t.call(e,o):i.set(e,o),o),W;class Ue{constructor(i){_(this,"id"),_(this,"title"),_(this,"url"),_(this,"params"),_(this,"domElement"),_(this,"window"),_(this,"openMode"),_(this,"origin"),_(this,"initialized",!1),_(this,"ready",!1),_(this,"capabilities"),st(this,W,void 0),_(this,"dispose",()=>{U(this,W).removeSender({origin:this.origin,window:this.window}),this.openMode===S.Popup?this.window.close():this.domElement?.remove?.()}),_(this,"getInfo",()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url})),_(this,"init",()=>{if(U(this,W).addSender({origin:this.origin,window:this.window}),this.openMode===S.Popup){const p=setInterval(()=>{U(this,W).send({targetWin:this.window,targetOrigin:this.origin,messageType:O.HandShake,messageBody:{}})},1e3);U(this,W).listen({messageType:O.HandShakeAck,callback:()=>{clearInterval(p)}})}}),_(this,"dispatchEvent",(p,v)=>U(this,W).invoke({targetWin:this.window,targetOrigin:this.origin,messageType:O.ObjectEvent,messageBody:p,responseTimeoutMs:v})),_(this,"send",p=>{U(this,W).send({targetWin:this.window,targetOrigin:this.origin,...p})});const{guestId:o,domElement:t=null,title:s,url:r,window:c,params:a={},openMode:d=S.Embed,remoting:g}=i;this.id=o,this.title=s,this.url=r,this.origin=Ve(r),this.params=a,this.domElement=t,this.window=c,this.openMode=d,this.capabilities={},nt(this,W,g)}}W=new WeakMap;const Le={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let Q;const ot=new Uint8Array(16);function rt(){if(!Q&&(Q=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Q))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Q(ot)}const b=[];for(let e=0;e<256;++e)b.push((e+256).toString(16).slice(1));function ze(e,i=0){return(b[e[i+0]]+b[e[i+1]]+b[e[i+2]]+b[e[i+3]]+"-"+b[e[i+4]]+b[e[i+5]]+"-"+b[e[i+6]]+b[e[i+7]]+"-"+b[e[i+8]]+b[e[i+9]]+"-"+b[e[i+10]]+b[e[i+11]]+b[e[i+12]]+b[e[i+13]]+b[e[i+14]]+b[e[i+15]]).toLowerCase()}function yt(e,i=0){const o=ze(e,i);if(!validate(o))throw TypeError("Stringified UUID is invalid");return o}const _t=null;function at(e,i,o){if(Le.randomUUID&&!i&&!e)return Le.randomUUID();e=e||{};const t=e.random||(e.rng||rt)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,i){o=o||0;for(let s=0;s<16;++s)i[o+s]=t[s];return i}return ze(t)}const Ne=at;var ct=Object.defineProperty,lt=(e,i,o)=>i in e?ct(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,j=(e,i,o)=>(lt(e,typeof i!="symbol"?i+"":i,o),o),De=(e,i,o)=>{if(!i.has(e))throw TypeError("Cannot "+o)},l=(e,i,o)=>(De(e,i,"read from private field"),o?o.call(e):i.get(e)),k=(e,i,o)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,o)},Z=(e,i,o,t)=>(De(e,i,"write to private field"),t?t.call(e,o):i.set(e,o),o),H,w,J,T,C,L,le,de,he,V,ue,pe,ge,X;const Fe="elli:remoting",Be="elli:remoting:response",He="elli:remoting:exception",Y=({messageType:e,messageBody:i,onewayMsg:o=!1})=>({requestId:o?null:Ne(),source:Fe,type:e,body:i}),Et=e=>{const{targetWin:i,targetOrigin:o,messageType:t,messageBody:s}=e,r=Y({messageType:t,messageBody:s});i.postMessage(r,o)};class dt{constructor(i,o){if(k(this,H,void 0),k(this,w,void 0),k(this,J,new Map),k(this,T,new Map),k(this,C,null),k(this,L,new Map),k(this,le,()=>{const t=Date.now(),s=[];l(this,T).forEach((r,c)=>{const{requestId:a,cancelTime:d}=r;l(this,w).debug(`Checking response timeout for requestId: ${a}) @ ${d??""}`),r.cancelTime&&r.cancelTime<t&&(l(this,w).debug(`Detected response timeout for requestId: ${a}...`),s.push(c),r.resolve(),l(this,w).debug(`Aborted waiting for response to requestid: ${a})`))}),s.forEach(r=>{l(this,w).debug(`removing invocations with requestId ${r} from cache since response time has expired`),l(this,T).delete(r)}),l(this,T).size===0&&(l(this,w).debug("stopping response monitor"),l(this,he).call(this))}),k(this,de,()=>{l(this,C)===null&&(l(this,w).debug("Staring response timeout evaluator"),Z(this,C,window.setInterval(l(this,le),200)))}),k(this,he,()=>{l(this,C)!==null&&(window.clearInterval(l(this,C)),Z(this,C,null),l(this,w).debug("Stopped response timeout evaluator"))}),k(this,V,t=>{const s=l(this,T).get(t);return l(this,w).debug(`serving requestId: ${t}`),l(this,T).delete(t),s}),k(this,ue,t=>{const{requestId:s}=t;l(this,w).debug(`Response received for invocation requestId: ${s}`);const r=l(this,V).call(this,s);return r?(r.resolve(t.body),!0):(l(this,w).warn(`Received response to stale/invalid request with requestId: ${s}`),!1)}),k(this,pe,t=>{l(this,w).debug(`Exception received for invocation (requestId = ${t.requestId})`);const s=l(this,V).call(this,t.requestId);return s?(s.reject(new Error(t.body)),!0):(l(this,w).warn(`Received exception for stale/invalid request (requestId = ${t.requestId})`),!1)}),k(this,ge,({sourceWin:t,sourceOrigin:s,message:r})=>{l(this,w).debug(`Received message of type "${r.type}"`);const c=l(this,J).get(r.type);return c?(c.forEach(a=>{l(this,w).debug(`Invoking message handler ${a.name}`),a({sourceWin:t,sourceOrigin:s,requestId:r.requestId,type:r.type,body:r.body})}),!0):!1}),k(this,X,t=>{if(l(this,w).debug(`Remoting: Received message ${JSON.stringify(t.data)}`),l(this,L).size===0||!t.source)return!1;const s=l(this,L).get(t.source);return!s||t?.data?.source!==Fe?!1:(t.data.type===Be?l(this,ue).call(this,t.data):t.data.type===He?l(this,pe).call(this,t.data):l(this,ge).call(this,{sourceWin:t.source,sourceOrigin:s,message:t.data}),!0)}),j(this,"addSender",t=>{const{origin:s,window:r}=t;if(!s)throw new Error("origin is required");if(!r)throw new Error("window is required");l(this,L).set(r,s)}),j(this,"initialize",t=>{t.removeEventListener("message",l(this,X)),t.addEventListener("message",l(this,X)),l(this,w).debug(`initialized remoting id: ${l(this,H)}`)}),j(this,"close",()=>{window.removeEventListener("message",l(this,X)),l(this,w).debug(`closed remoting id: ${l(this,H)}`)}),j(this,"invoke",t=>{const{targetWin:s,targetOrigin:r,messageType:c,messageBody:a,responseTimeoutMs:d}=t;return new Promise((g,p)=>{const v=Y({messageType:c,messageBody:a});l(this,T).set(v.requestId,{requestId:v.requestId,resolve:g,reject:p,cancelTime:d?Date.now()+Number.parseInt(d,10):null}),s.postMessage(v,r);const{requestId:E}=v;l(this,w).debug(`Posted invocation message of type ${c} requestId: ${E||""}`),d&&(l(this,w).debug(`starting response monitor for requestId: ${E||""} for ${d} ms`),l(this,de).call(this))})}),j(this,"listen",t=>{const{messageType:s,callback:r}=t,c=l(this,J).get(s)||[];c.push(r),l(this,J).set(s,c)}),j(this,"send",t=>{const{targetWin:s,targetOrigin:r,messageType:c,messageBody:a}=t,d=Y({messageType:c,messageBody:a,onewayMsg:!0});s.postMessage(d,r),l(this,w).debug(`Posted one-way message of type "${c}"`)}),j(this,"removeSender",t=>{const{window:s}=t;s&&l(this,L).delete(s)}),j(this,"respond",t=>{const{targetWin:s,targetOrigin:r,requestId:c,response:a}=t,d=Y({messageType:Be,messageBody:a});d.requestId=c,s.postMessage(d,r),l(this,w).debug(`Response sent to caller for invocation requestId: ${c}`)}),j(this,"raiseException",t=>{const{targetWin:s,targetOrigin:r,requestId:c,ex:a}=t,d=Y({messageType:He,messageBody:a});d.requestId=c,s.postMessage(d,r),l(this,w).debug(`Exception sent to caller for invocation. requestId: ${c}`)}),!i)throw new Error("logger is required");if(!o)throw new Error("correlationId is required");Z(this,H,o),Z(this,w,i)}}H=new WeakMap,w=new WeakMap,J=new WeakMap,T=new WeakMap,C=new WeakMap,L=new WeakMap,le=new WeakMap,de=new WeakMap,he=new WeakMap,V=new WeakMap,ue=new WeakMap,pe=new WeakMap,ge=new WeakMap,X=new WeakMap;var ht=Object.defineProperty,ut=(e,i,o)=>i in e?ht(e,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[i]=o,M=(e,i,o)=>(ut(e,typeof i!="symbol"?i+"":i,o),o),Je=(e,i,o)=>{if(!i.has(e))throw TypeError("Cannot "+o)},n=(e,i,o)=>(Je(e,i,"read from private field"),o?o.call(e):i.get(e)),u=(e,i,o)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,o)},z=(e,i,o,t)=>(Je(e,i,"write to private field"),t?t.call(e,o):i.set(e,o),o),f,N,h,K,I,q,ee,te,ie,R,we,fe,se,ve,ne,me,oe,be,ye,_e,Ee,ke,Oe,Me,Ie,re,Se,$e,We,je;const pt=[A.AllowScripts,A.AllowPopups,A.AllowModals,A.AllowForms,A.AllowDownloads,A.AllowSameOrigin].join(" ");class gt{constructor(i,o){if(M(this,"hostId"),u(this,f,void 0),u(this,N,void 0),u(this,h,void 0),u(this,K,1),u(this,I,new Map),u(this,q,new Map),u(this,ee,null),u(this,te,null),u(this,ie,()=>{for(const t of n(this,I).values())t.openMode===S.Popup&&this.unloadGuest(t.id)}),u(this,R,t=>{for(const s of n(this,I).values())if(s.window===t)return s;return null}),u(this,we,t=>{for(const s of n(this,I).values())if(s.url===t)return s;return null}),u(this,fe,t=>typeof t?._toJSON=="function"),u(this,se,t=>n(this,fe).call(this,t)?(this.addScriptingObject(t),{type:"object",object:t._toJSON()}):{type:"value",value:t}),u(this,ve,t=>typeof t=="string"?t:t instanceof Error?t.message:"An unexpected error occurred in the host application"),u(this,ne,t=>{t.ready&&n(this,f).send({targetWin:t.window,targetOrigin:t.origin,messageType:O.HostConfig,messageBody:{logLevel:n(this,h).getLogLevel(),...t.getInfo()}})}),u(this,me,({guest:t,obj:s,functionName:r,functionParams:c})=>{const a=s[r];return Re(a)?(n(this,h).debug(`Invoking host implementation of ${s.id}.${String(r)}()`),new Promise(d=>{Object.prototype.hasOwnProperty.call(a,"callContext")||Object.defineProperty(a,"callContext",{value:{guest:t},enumerable:!0}),d(a(...c))})):(n(this,h).warn(`Attempt to call invalid function on object type ${s.objectType}: ${String(r)}`),Promise.reject(new Error(`Method '${r}' not found in Scripting Object '${s.id}'`)))}),u(this,oe,({sourceWin:t,sourceOrigin:s,requestId:r})=>{var c;const a=n(this,R).call(this,t);if(!a){n(this,h).warn(`Received ready event for unknown guest. requestId: ${r}`);return}if(!a.initialized){n(this,h).warn("Guest must be initialized before it is marked as ready"),n(this,f).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Guest must be initialized before it is marked as ready"});return}a.ready||(a.ready=!0,n(this,ne).call(this,a),(c=n(this,ee))==null||c.call(this,a),n(this,h).audit({message:"Guest is ready",...a.getInfo()}))}),u(this,be,({sourceWin:t,sourceOrigin:s,requestId:r,body:c})=>{const a=n(this,R).call(this,t);if(!a){n(this,h).warn(`Received ready event for unknown guest. requestid = ${r}`);return}a.initialized||(a.initialized=!0,a.capabilities=c||{},n(this,h).audit({message:"Guest is initialized",...a.getInfo()})),(!c||!c.onReady)&&n(this,oe).call(this,{sourceWin:t,sourceOrigin:s,requestId:r,type:"",body:null})}),u(this,ye,({sourceWin:t})=>{t?.window&&this.unloadGuest(t)}),u(this,_e,({sourceWin:t,sourceOrigin:s,requestId:r,body:c})=>{const{objectId:a}=c;n(this,h).debug(`Processing getObject request for object ${a}. requestId = ${r}`);const d=n(this,R).call(this,t);if(!d)return n(this,h).warn("Rejected object request from unknown guest window"),n(this,f).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Specified window is not a known guest"}),!1;const g=this.getScriptingObject(a);return g?(n(this,f).respond({targetWin:t,targetOrigin:s,requestId:r,response:n(this,se).call(this,g)}),n(this,h).audit({message:"Scripting Object returned",requestId:r,scriptingObject:a,...d.getInfo()}),!0):(n(this,h).warn(`unknown or unauthorized object ${a} from guest ${d.id}`),n(this,f).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:`The requested object (${a}) is not available`}),!1)}),u(this,Ee,({sourceWin:t,requestId:s,body:r})=>{const c=n(this,R).call(this,t);if(!c){n(this,h).warn(`Received resize event from unknown guest. requestid = ${s}`);return}c.domElement&&(c.domElement.style.height=`${r.height}px`),n(this,h).debug(`Guest ${c.id} resized to ${r.width}x${r.height}`)}),u(this,ke,({sourceWin:t,sourceOrigin:s,requestId:r,body:c})=>{const{objectId:a}=c,d=n(this,R).call(this,t);if(!d)return n(this,h).warn("Rejected method invocation request from unknown guest window"),n(this,f).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Specified window is not a known guest"}),!1;n(this,h).debug(`Function ${a}.${String(c.functionName)}() called from guest "${d.id}" (requestId = ${r})`);const g=this.getScriptingObject(a);return g?(n(this,me).call(this,{guest:d,obj:g,functionName:c.functionName,functionParams:c.functionParams}).then(p=>{n(this,f).respond({targetWin:t,targetOrigin:s,requestId:r,response:n(this,se).call(this,p)}),n(this,h).audit({message:"Value returned for Scripting Object method call",requestId:r,scriptingObject:a,scriptingMethod:c.functionName,...d.getInfo()})}).catch(p=>{n(this,f).raiseException({targetWin:t,targetOrigin:d.origin,requestId:r,ex:n(this,ve).call(this,p)}),n(this,h).audit({message:"Exception thrown for Scripting Object method call",requestId:r,scriptingObject:a,scriptingMethod:c.functionName,...d.getInfo()})}),!0):(n(this,h).warn(`Invocation of unknown or unauthorized object ${a} from guest ${d.id}`),n(this,f).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:`The requested object (${a}) is not available`}),!1)}),u(this,Oe,()=>{n(this,f).listen({messageType:O.GuestResize,callback:n(this,Ee)})}),u(this,Me,()=>{n(this,f).listen({messageType:O.GuestReady,callback:n(this,be)}),n(this,f).listen({messageType:O.GuestReadyComplete,callback:n(this,oe)}),n(this,f).listen({messageType:O.GuestClose,callback:n(this,ye)}),n(this,f).listen({messageType:O.ObjectGet,callback:n(this,_e)}),n(this,f).listen({messageType:O.ObjectInvoke,callback:n(this,ke)}),window.addEventListener("visibilitychange",n(this,ie))}),u(this,Ie,t=>t?.constructor?.name==="ProxyEvent"),u(this,re,t=>{const s=new Ue({...t,remoting:n(this,f)});return s.init(),n(this,I).set(t.guestId,s),s}),u(this,Se,()=>{z(this,te,setInterval(()=>{const t=[];n(this,I).forEach(s=>{s.openMode===S.Popup&&s.window.closed&&t.push(s)}),t.forEach(s=>{this.unloadGuest(s.id)})},1e3))}),u(this,$e,t=>{const{url:s,title:r,windowFeatures:c={},params:a,guestId:d}=t,{width:g=800,height:p=600,top:v=100,left:E=100}=c;let y=n(this,we).call(this,s);if(y)y.window.closed||y.send({messageType:O.GuestFocus,messageBody:{}});else{const $=[{key:"width",value:g},{key:"height",value:p},{key:"top",value:v},{key:"left",value:E}].reduce((Pe,ae,wt)=>(wt>0&&ae.value&&(Pe+=","),ae.value?`${Pe}${ae.key}=${ae.value}`:Pe),""),m=window.open(s,r,`popup, ${$}`);if(!m)throw new Error("Failed to open guest application in popup window");m.opener=null,y=n(this,re).call(this,{guestId:d,window:m,title:r,url:s,params:a,openMode:S.Popup})}return y}),u(this,We,t=>{const{url:s,title:r,targetElement:c,params:a,guestId:d,options:g={}}=t,p=c.ownerDocument??document,{fitToContent:v=!1,disableSandbox:E=!1,sandboxValues:y=[]}=g;if(!r)throw new Error("title is required");v&&n(this,Oe).call(this);const $=p.createElement("iframe");$.setAttribute("id",d),$.addEventListener("load",()=>{n(this,h).debug(`frame loaded for guest with id '${d}'`)}),$.setAttribute("style","min-width: 100%; height: 100%; border: 0px;"),E||$.setAttribute("sandbox",`${pt} ${y.join(" ")}`),$.setAttribute("title",r),$.setAttribute("src",s),c.appendChild($);const m=p.getElementById(d);return n(this,re).call(this,{guestId:d,domElement:m,window:m.contentWindow,title:r,url:s,params:a,openMode:S.Embed})}),u(this,je,(t,s)=>{let r="";return Object.keys(s).forEach(c=>{r+=`${(r.length?"&":"")+encodeURIComponent(c)}=${encodeURIComponent(s[c])}`}),t+(r?(t.indexOf("?")>=0?"&":"?")+r:"")}),M(this,"addScriptingObject",t=>{if(!t?.id||!t?._toJSON)throw new Error("Object is not derived from ScriptingObject");if(t.id.toLowerCase()==="module")throw new Error("Do not publish the module object. Create a concrete object derived from it.");n(this,q).set(t.id,t)}),M(this,"cloneScriptingObject",(t,s)=>{if(!t)throw new Error("proxy is required");if(!s)throw new Error("guest is required");const r=new Ce(t.id,t.objectType);let c=[];return Object.keys(t).forEach(a=>{const d=t[a];if(n(this,Ie).call(this,d)){const g=new G({name:d.name,requiresFeedback:!1,so:r});Object.defineProperty(r,a,{value:g,enumerable:!0});const p=({eventParams:E,eventOptions:y})=>this.dispatchEvent({event:g,eventParams:E,eventOptions:y}),v=s.subscribe({eventId:d.id,callback:p});c.push(()=>{s.unsubscribe({eventId:d.id,token:v})})}else if(Re(d)&&(Object.defineProperty(r,a,{value:async(...g)=>{const p=await d(...g);return et(p)?this.cloneScriptingObject(p,s):p},enumerable:!0}),a==="dispose")){const g=r.dispose;Object.defineProperty(r,a,{value:()=>(r._dispose(),g.apply(r)),enumerable:!0})}}),r._dispose=()=>{c.forEach(a=>{a?.()}),c=[]},r}),M(this,"close",()=>{clearInterval(n(this,te)),n(this,f).close(),window.removeEventListener("visibilitychange",n(this,ie)),n(this,h).debug(`host is closed. hostId: ${this.hostId}, correlationId: ${n(this,N)}`)}),M(this,"dispatchEvent",async t=>{const{event:{id:s,name:r,scriptingObject:c},eventParams:a,eventOptions:d={}}=t,{eventHandler:g=null,timeout:p=null,window:v=null}=d,E={object:c._toJSON(),eventName:r,eventParams:a,eventHandler:g,eventOptions:{allowsFeedback:!1}};p&&!Number.isNaN(p)&&(E.eventOptions={allowsFeedback:!0,timeout:Number(p)});const y=[];return n(this,I).forEach(m=>{(!v||v===m.window)&&(p&&m?.capabilities?.eventFeedback?(y.push(m.dispatchEvent(E,p)),n(this,h).audit({message:"Event dispatched and awaiting feedback",scriptingEventId:s,...m.getInfo()})):(m.send({messageType:O.ObjectEvent,messageBody:E}),n(this,h).audit({message:"Event dispatched",scriptingEventId:s,...m.getInfo()})))}),await Promise.all(y).then(m=>(n(this,h).audit({message:"Event feedback received",scriptingEventId:s}),qe(m))).catch(m=>{throw n(this,h).error({message:"Error processing event",eventId:s,exception:m}),m})}),M(this,"getGuests",()=>{const t=[];return n(this,I).forEach(s=>{t.push(s)}),t}),M(this,"getScriptingObject",t=>n(this,q).has(t)?n(this,q).get(t):null),M(this,"loadGuest",t=>{const{url:s,targetElement:r,title:c,params:a={},options:d={}}=t,{openMode:g=S.Embed,windowFeatures:p={}}=d,v=`guest-${this.hostId}-sandbox-${n(this,K)}`;z(this,K,n(this,K)+1);const E=n(this,je).call(this,s,a);let y=null;if(g===S.Popup)y=n(this,$e).call(this,{guestId:v,url:E,title:c,params:a,windowFeatures:p});else if(g===S.Embed)y=n(this,We).call(this,{guestId:v,url:E,title:c,targetElement:r,params:a,options:d});else throw new Error(`Invalid openMode: ${g}`);return n(this,h).audit({message:"Guest loaded",...y.getInfo()}),y}),M(this,"loadGuests",t=>{const{url:s,targetElement:r,title:c,paramsList:a=[],options:d={}}=t;a.forEach(g=>{this.loadGuest({url:s,title:c,targetElement:r,params:g,options:d})},this)}),M(this,"removeAllScriptingObjects",()=>{Array.from(n(this,q).keys()).forEach(s=>{this.removeScriptingObject(s)})}),M(this,"removeScriptingObject",t=>{const s=this.getScriptingObject(t);s&&(s._dispose&&typeof s._dispose=="function"&&s._dispose(),n(this,q).delete(t))}),M(this,"setLogLevel",t=>{n(this,h).setLogLevel(t),n(this,I).forEach(n(this,ne)),n(this,h).debug("Dispatched config events to all guests")}),M(this,"unloadGuest",t=>{let s=typeof t=="string"?n(this,I).get(t):null;if(!s&&(s=Array.from(n(this,I).values()).find(r=>r.window===t||r.domElement===t),!s))throw new Error("Invalid guestId or guestWindow reference");s.dispose(),n(this,I).delete(s.id),n(this,h).audit({message:"Guest is removed from host",...s.getInfo()})}),this.hostId=i,!o?.logger)throw new Error("Logger is required");if(z(this,h,o.logger),z(this,N,Ne()),z(this,f,new dt(n(this,h),n(this,N))),o?.readyStateCallback&&typeof o?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");z(this,ee,o?.readyStateCallback||null),n(this,f).initialize(window),n(this,Me).call(this),n(this,Se).call(this),n(this,h).debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${n(this,N)}`)}}return f=new WeakMap,N=new WeakMap,h=new WeakMap,K=new WeakMap,I=new WeakMap,q=new WeakMap,ee=new WeakMap,te=new WeakMap,ie=new WeakMap,R=new WeakMap,we=new WeakMap,fe=new WeakMap,se=new WeakMap,ve=new WeakMap,ne=new WeakMap,me=new WeakMap,oe=new WeakMap,be=new WeakMap,ye=new WeakMap,_e=new WeakMap,Ee=new WeakMap,ke=new WeakMap,Oe=new WeakMap,Me=new WeakMap,Ie=new WeakMap,re=new WeakMap,Se=new WeakMap,$e=new WeakMap,We=new WeakMap,je=new WeakMap,D})());
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
Binary file
|
|
Binary file
|