@elliemae/pui-scripting-object 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/{events.js → event.js} +2 -2
  2. package/dist/cjs/index.js +12 -1
  3. package/dist/cjs/remotingScriptingObject.js +16 -0
  4. package/dist/cjs/{script.js → scriptingObject.js} +2 -2
  5. package/dist/cjs/{scriptingObjectTypes.js → scriptingObjectList.js} +2 -2
  6. package/dist/esm/{events.js → event.js} +0 -0
  7. package/dist/esm/index.js +8 -1
  8. package/dist/esm/{script.js → remotingScriptingObject.js} +0 -0
  9. package/dist/esm/{scriptingObjectTypes.js → scriptingObject.js} +0 -0
  10. package/dist/esm/scriptingObjectList.js +0 -0
  11. package/dist/types/event.d.ts +43 -0
  12. package/dist/types/index.d.ts +3 -3
  13. package/dist/types/objects/application.d.ts +76 -26
  14. package/dist/types/objects/auth.d.ts +3 -2
  15. package/dist/types/objects/form.d.ts +50 -27
  16. package/dist/types/objects/global.d.ts +28 -18
  17. package/dist/types/objects/http.d.ts +2 -1
  18. package/dist/types/objects/loan.d.ts +201 -93
  19. package/dist/types/objects/memStorage.d.ts +4 -3
  20. package/dist/types/objects/module.d.ts +28 -19
  21. package/dist/types/objects/route.d.ts +3 -2
  22. package/dist/types/objects/service.d.ts +2 -1
  23. package/dist/types/objects/session.d.ts +2 -1
  24. package/dist/types/objects/transaction.d.ts +2 -1
  25. package/dist/types/objects/transactionTemplate.d.ts +3 -2
  26. package/dist/types/objects/transactionv2.d.ts +2 -1
  27. package/dist/types/objects/userAccessRights.d.ts +4 -4
  28. package/dist/types/objects/view.d.ts +46 -20
  29. package/dist/types/remotingScriptingObject.d.ts +21 -0
  30. package/dist/types/scriptingObject.d.ts +15 -0
  31. package/dist/types/{scriptingObjectTypes.d.ts → scriptingObjectList.d.ts} +4 -3
  32. package/package.json +1 -1
  33. package/dist/types/events.d.ts +0 -7
  34. package/dist/types/script.d.ts +0 -28
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var events_exports = {};
16
- module.exports = __toCommonJS(events_exports);
15
+ var event_exports = {};
16
+ module.exports = __toCommonJS(event_exports);
package/dist/cjs/index.js CHANGED
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -14,8 +18,13 @@ var __copyProps = (to, from, except, desc) => {
14
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
20
  var lib_exports = {};
21
+ __export(lib_exports, {
22
+ IEvent: () => import_event.IEvent,
23
+ IScriptingObject: () => import_scriptingObject.IScriptingObject,
24
+ IScriptingObjectProxy: () => import_scriptingObject.IScriptingObjectProxy,
25
+ Listener: () => import_event.Listener
26
+ });
17
27
  module.exports = __toCommonJS(lib_exports);
18
- __reExport(lib_exports, require("./script.js"), module.exports);
19
28
  __reExport(lib_exports, require("./objects/analytics.js"), module.exports);
20
29
  __reExport(lib_exports, require("./objects/application.js"), module.exports);
21
30
  __reExport(lib_exports, require("./objects/auth.js"), module.exports);
@@ -35,3 +44,5 @@ __reExport(lib_exports, require("./objects/transactionTemplate.js"), module.expo
35
44
  __reExport(lib_exports, require("./objects/userAccessRights.js"), module.exports);
36
45
  __reExport(lib_exports, require("./objects/view.js"), module.exports);
37
46
  __reExport(lib_exports, require("./objects/shared.js"), module.exports);
47
+ var import_event = require("./event.js");
48
+ var import_scriptingObject = require("./scriptingObject.js");
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var remotingScriptingObject_exports = {};
16
+ module.exports = __toCommonJS(remotingScriptingObject_exports);
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var script_exports = {};
16
- module.exports = __toCommonJS(script_exports);
15
+ var scriptingObject_exports = {};
16
+ module.exports = __toCommonJS(scriptingObject_exports);
@@ -12,5 +12,5 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var scriptingObjectTypes_exports = {};
16
- module.exports = __toCommonJS(scriptingObjectTypes_exports);
15
+ var scriptingObjectList_exports = {};
16
+ module.exports = __toCommonJS(scriptingObjectList_exports);
File without changes
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./script.js";
2
1
  export * from "./objects/analytics.js";
3
2
  export * from "./objects/application.js";
4
3
  export * from "./objects/auth.js";
@@ -18,3 +17,11 @@ export * from "./objects/transactionTemplate.js";
18
17
  export * from "./objects/userAccessRights.js";
19
18
  export * from "./objects/view.js";
20
19
  export * from "./objects/shared.js";
20
+ import { IEvent, Listener } from "./event.js";
21
+ import { IScriptingObjectProxy, IScriptingObject } from "./scriptingObject.js";
22
+ export {
23
+ IEvent,
24
+ IScriptingObject,
25
+ IScriptingObjectProxy,
26
+ Listener
27
+ };
File without changes
@@ -0,0 +1,43 @@
1
+ import { IScriptingObjectProxy, IScriptingObject } from './scriptingObject.js';
2
+ /**
3
+ * callback for event
4
+ */
5
+ export declare type Listener<SO extends IScriptingObjectProxy, Params extends Record<string, unknown>, Options extends Record<string, unknown>, ReturnType> = ({ obj, eventName, eventParams, eventOptions, }: {
6
+ obj: SO;
7
+ eventName: string;
8
+ eventParams: Params;
9
+ eventOptions: Options;
10
+ }) => ReturnType;
11
+ /**
12
+ * base class for events
13
+ */
14
+ export interface IEvent<SO extends IScriptingObjectProxy, Params extends Record<string, unknown>, Options extends Record<string, unknown>, ReturnType> {
15
+ /**
16
+ * name of the event
17
+ */
18
+ readonly name: string;
19
+ /**
20
+ * id of the scripting object from where the event was triggered
21
+ */
22
+ readonly objectId: string;
23
+ /**
24
+ * event requiers a response from its listeners
25
+ */
26
+ readonly requiresFeedback: boolean;
27
+ /**
28
+ * parameters associated with the event
29
+ */
30
+ readonly params: Params;
31
+ /**
32
+ * scripting object from where the event was triggered
33
+ */
34
+ readonly scriptingObject: IScriptingObject;
35
+ /**
36
+ * subscribe to the event
37
+ */
38
+ subscribe: (callback: Listener<SO, Params, Options, ReturnType>) => string;
39
+ /**
40
+ * unsubscribe from the event
41
+ */
42
+ unsubscribe: (subscriptionId: string) => void;
43
+ }
@@ -1,4 +1,3 @@
1
- export * from './script.js';
2
1
  export * from './objects/analytics.js';
3
2
  export * from './objects/application.js';
4
3
  export * from './objects/auth.js';
@@ -18,5 +17,6 @@ export * from './objects/transactionTemplate.js';
18
17
  export * from './objects/userAccessRights.js';
19
18
  export * from './objects/view.js';
20
19
  export * from './objects/shared.js';
21
- export type { ScriptingObjectEvents } from './events.js';
22
- export type { ScriptingObjectTypes } from './scriptingObjectTypes.js';
20
+ export { IEvent, Listener } from './event.js';
21
+ export { IScriptingObjectProxy, IScriptingObject } from './scriptingObject.js';
22
+ export type { ScriptingObjects } from './scriptingObjectList.js';
@@ -1,3 +1,8 @@
1
+ import { IEvent } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * Log levels
5
+ */
1
6
  export declare enum LogLevel {
2
7
  TRACE = "TRACE",
3
8
  DEBUG = "DEBUG",
@@ -7,18 +12,39 @@ export declare enum LogLevel {
7
12
  ERROR = "ERROR",
8
13
  FATAL = "FATAL"
9
14
  }
15
+ /**
16
+ * metadata about the application
17
+ */
10
18
  export declare type AppInfo = {
11
19
  id: string;
12
20
  name: string;
13
21
  };
22
+ /**
23
+ * Application extension type
24
+ */
14
25
  export declare enum ApplicationExtensionType {
15
26
  TOOL = "TOOL",
16
27
  MENU = "MENU"
17
28
  }
29
+ /**
30
+ * metadata about the application extension
31
+ */
18
32
  export declare type ApplicationExtension = {
33
+ /**
34
+ * type of application extension
35
+ */
19
36
  type: ApplicationExtensionType;
37
+ /**
38
+ * display text of the application extension
39
+ */
20
40
  text: string;
41
+ /**
42
+ * url where the application extension is hosted
43
+ */
21
44
  url: string;
45
+ /**
46
+ * custom options for the application extension
47
+ */
22
48
  options?: Record<string, string>;
23
49
  };
24
50
  /**
@@ -36,9 +62,6 @@ export declare enum NavigationType {
36
62
  * navigation options
37
63
  */
38
64
  export declare type NavigationOptions = {
39
- /**
40
- *
41
- */
42
65
  target: string;
43
66
  type: NavigationType;
44
67
  context?: Record<string, string>;
@@ -47,6 +70,9 @@ export declare type OpenOptions = {
47
70
  target: string;
48
71
  type?: string;
49
72
  };
73
+ /**
74
+ * size of the modal
75
+ */
50
76
  export declare enum ModalSize {
51
77
  SMALL = "sm",
52
78
  MEDIUM = "md",
@@ -84,10 +110,56 @@ export declare type PrintOptions = {
84
110
  */
85
111
  blob: Blob;
86
112
  };
113
+ /**
114
+ * event fired when the user logs in
115
+ */
116
+ export interface IApplicationLoginEvent extends IEvent<IApplication, {
117
+ userId: string;
118
+ }, Record<string, unknown>, void> {
119
+ /**
120
+ * event name
121
+ */
122
+ readonly name: 'Login';
123
+ /**
124
+ * scripting object from where the event is fired
125
+ */
126
+ readonly objectId: 'Application';
127
+ /**
128
+ * event does not require feedback from listeners
129
+ */
130
+ readonly requiresFeedback: false;
131
+ }
132
+ /**
133
+ * event fired when an action is completed. actions are executed through the performAction method
134
+ */
135
+ export interface IApplicationActionCompletedEvent extends IEvent<IApplication, {
136
+ name: string;
137
+ }, Record<string, unknown>, void> {
138
+ /**
139
+ * event name
140
+ */
141
+ readonly name: 'ActionCompleted';
142
+ /**
143
+ * scripting object from where the event is fired
144
+ */
145
+ readonly objectId: 'Application';
146
+ /**
147
+ * event does not require feedback from listeners
148
+ */
149
+ readonly requiresFeedback: false;
150
+ }
87
151
  /**
88
152
  * Allows access to application-level UI elements, behaviors and events
89
153
  */
90
- export interface IApplication {
154
+ export interface IApplication extends IScriptingObject {
155
+ /**
156
+ * notifies user login
157
+ */
158
+ readonly Login: IApplicationLoginEvent;
159
+ /**
160
+ * notifies action completion
161
+ */
162
+ readonly ActionCompleted: IApplicationActionCompletedEvent;
91
163
  /**
92
164
  * Gets descriptor for the Application
93
165
  *
@@ -190,25 +262,3 @@ export interface IApplication {
190
262
  */
191
263
  log(message: string, logLevel: LogLevel): Promise<void>;
192
264
  }
193
- /**
194
- * event handler that handles user login event
195
- *
196
- * @param userId unique identifier of the user
197
- */
198
- export declare type AppLoginListener = (userId: string) => void;
199
- /**
200
- * event handler that handles action completed event
201
- *
202
- * @param name action name
203
- */
204
- export declare type AppActionCompletedListener = (name: string) => void;
205
- export declare type ApplicationEvents = {
206
- /**
207
- * event fired when the user logs in
208
- */
209
- 'application.login': AppLoginListener;
210
- /**
211
- * event fired when an action is completed. actions are executed through the performAction method
212
- */
213
- 'application.actionCompleted': AppActionCompletedListener;
214
- };
@@ -1,4 +1,5 @@
1
- import { UserAccessRights } from './userAccessRights';
1
+ import { IScriptingObject } from '../scriptingObject.js';
2
+ import { UserAccessRights } from './userAccessRights.js';
2
3
  export declare type Personas = {
3
4
  entityId: string;
4
5
  entityType: string;
@@ -70,7 +71,7 @@ export declare type TokenInfo = {
70
71
  /**
71
72
  * Methods to get information about the user and access token
72
73
  */
73
- export interface IAuth {
74
+ export interface IAuth extends IScriptingObject {
74
75
  /**
75
76
  * Deprecated: use getAccessToken method instead
76
77
  *
@@ -1,11 +1,59 @@
1
+ import { IEvent } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
1
3
  export declare type FormDescriptor = {
2
4
  id: string;
3
5
  name: string;
4
6
  };
7
+ /**
8
+ * event to notify form load operation
9
+ */
10
+ export interface IFormLoadEvent extends IEvent<IForm, {
11
+ id: string;
12
+ }, Record<string, unknown>, void> {
13
+ /**
14
+ * event name
15
+ */
16
+ readonly name: 'Load';
17
+ /**
18
+ * scripting object from where the event is fired
19
+ */
20
+ readonly objectId: 'Form';
21
+ /**
22
+ * event does not require feedback from listeners
23
+ */
24
+ readonly requiresFeedback: false;
25
+ }
26
+ /**
27
+ * event to notify form unload operation
28
+ */
29
+ export interface IFormUnLoadEvent extends IEvent<IForm, {
30
+ id: string;
31
+ }, Record<string, unknown>, void> {
32
+ /**
33
+ * event name
34
+ */
35
+ readonly name: 'UnLoad';
36
+ /**
37
+ * scripting object from where the event is fired
38
+ */
39
+ readonly objectId: 'Form';
40
+ /**
41
+ * event does not require feedback from listeners
42
+ */
43
+ readonly requiresFeedback: false;
44
+ }
5
45
  /**
6
46
  * Methods to get information about the custom form
7
47
  */
8
- export interface IForm {
48
+ export interface IForm extends IScriptingObject {
49
+ /**
50
+ * event fired when the form is loaded
51
+ */
52
+ readonly Load: IFormLoadEvent;
53
+ /**
54
+ * event fired when the form is unloaded
55
+ */
56
+ readonly UnLoad: IFormUnLoadEvent;
9
57
  /**
10
58
  * get metadata of the form
11
59
  *
@@ -18,30 +66,5 @@ export interface IForm {
18
66
  * @param id form id
19
67
  * @returns form input control object
20
68
  */
21
- getControl(id: string): Promise<any>;
69
+ getControl(id: string): Promise<unknown>;
22
70
  }
23
- /**
24
- * event handler for form load event
25
- *
26
- * @param id unique id of the form that is loaded
27
- */
28
- export declare type FormLoadListener = (id: string) => void;
29
- /**
30
- * event handler for form unload event
31
- *
32
- * @param id unique id of the form that is unloaded
33
- */
34
- export declare type FormUnloadListener = (id: string) => void;
35
- /**
36
- * events that notifies the form's lifecycle
37
- */
38
- export declare type FormEvents = {
39
- /**
40
- * form is loaded and ready for user interaction
41
- */
42
- 'form.load': FormLoadListener;
43
- /**
44
- * form is unloaded and no longer available for user interaction
45
- */
46
- 'form.unload': FormUnloadListener;
47
- };
@@ -1,3 +1,24 @@
1
+ import { IEvent } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * event to notify change in global state
5
+ */
6
+ export interface IGlobalChangeEvent extends IEvent<IGlobal, {
7
+ key: string;
8
+ }, Record<string, unknown>, void> {
9
+ /**
10
+ * event name
11
+ */
12
+ readonly name: 'Change';
13
+ /**
14
+ * scripting object from where the event is fired
15
+ */
16
+ readonly objectId: 'Global';
17
+ /**
18
+ * event does not require feedback from listeners
19
+ */
20
+ readonly requiresFeedback: false;
21
+ }
1
22
  /**
2
23
  * The Global object allows for data to be shared between custom forms/tools/plugins within a user's session.
3
24
  * Unlike the Session scripting object, where data is isolated to be visible/accessible only by the form/plugin that writes the variables,
@@ -14,34 +35,23 @@
14
35
  * This will ensure that no guest can consume more than 250 KB of sessionStorage
15
36
  *
16
37
  */
17
- export interface IGlobal {
38
+ export interface IGlobal extends IScriptingObject {
39
+ /**
40
+ * event fired when the global state changes
41
+ */
42
+ readonly Change: IGlobalChangeEvent;
18
43
  /**
19
44
  * set a value in the global store
20
45
  *
21
46
  * @param key unique key to identify the value
22
47
  * @param value value to be stored
23
48
  */
24
- set(key: string, value: any): Promise<void>;
49
+ set(key: string, value: unknown): Promise<void>;
25
50
  /**
26
51
  * get a value from the global store
27
52
  *
28
53
  * @param key unique key to identify the value
29
54
  * @returns value stored in the global store
30
55
  */
31
- get(key: string): Promise<any>;
56
+ get(key: string): Promise<unknown>;
32
57
  }
33
- /**
34
- * event handler for global state change event
35
- *
36
- * @param key name of the key for which the value changed
37
- */
38
- export declare type GlobalStateChangeListener = (key: string) => void;
39
- /**
40
- * events fired from Global scripting object
41
- */
42
- export declare type GlobalEvents = {
43
- /**
44
- * event fired when a value changes in the global store
45
- */
46
- 'global.change': GlobalStateChangeListener;
47
- };
@@ -1,9 +1,10 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  /**
2
3
  * Provides methods to make call-outs to to external systems via HTTPS.
3
4
  * By exposing this object from the host, it ensures that the call will bear the "Origin" header of the host application.
4
5
  * This is critical for situations where the guest's code is running in a strict-mode sandbox (where the "allowSameOrigin" flag is false).
5
6
  */
6
- export interface IHttp {
7
+ export interface IHttp extends IScriptingObject {
7
8
  /**
8
9
  * get http request
9
10
  *
@@ -1,3 +1,5 @@
1
+ import { IEvent } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
1
3
  /**
2
4
  * option name and its value
3
5
  */
@@ -14,17 +16,214 @@ export declare type FieldOptions = {
14
16
  /**
15
17
  * v3 loan object
16
18
  */
17
- export declare type LoanObject = Record<string, any>;
19
+ export declare type LoanObject = Record<string, unknown>;
18
20
  export declare enum LoanLevelActions {
19
21
  UPDATE_CORRESPONDENT_BALANCE = "updateCorrespondentBalance",
20
22
  UPDATE_CORRESPONDENT_FEES = "updateCorrespondentFees",
21
23
  COPY_ITEMIZATION_TO_STATE_DISCLOSURE = "copyItemizationToStateDisclosure",
22
24
  CALCULATE_EEM_MORTGAGE = "calculateEEMMortgage"
23
25
  }
26
+ /**
27
+ * event to notify loan precommit operation
28
+ */
29
+ export interface ILoanPreCommitEvent extends IEvent<ILoan, {
30
+ cause: string;
31
+ }, Record<string, unknown>, boolean> {
32
+ /**
33
+ * event name
34
+ */
35
+ readonly name: 'PreCommit';
36
+ /**
37
+ * scripting object from where the event is fired
38
+ */
39
+ readonly objectId: 'Loan';
40
+ /**
41
+ * event requires feedback from listeners
42
+ */
43
+ readonly requiresFeedback: true;
44
+ }
45
+ /**
46
+ * event to notify loan committed operation
47
+ */
48
+ export interface ILoanCommittedEvent extends IEvent<ILoan, {
49
+ cause: string;
50
+ }, Record<string, unknown>, void> {
51
+ /**
52
+ * event name
53
+ */
54
+ readonly name: 'Committed';
55
+ /**
56
+ * scripting object from where the event is fired
57
+ */
58
+ readonly objectId: 'Loan';
59
+ /**
60
+ * event does not require feedback from listeners
61
+ */
62
+ readonly requiresFeedback: false;
63
+ }
64
+ /**
65
+ * event to notify loan change operation
66
+ */
67
+ export interface ILoanChangeEvent extends IEvent<ILoan, Record<string, never>, Record<string, unknown>, void> {
68
+ /**
69
+ * event name
70
+ */
71
+ readonly name: 'Chanage';
72
+ /**
73
+ * scripting object from where the event is fired
74
+ */
75
+ readonly objectId: 'Loan';
76
+ /**
77
+ * event does not require feedback from listeners
78
+ */
79
+ readonly requiresFeedback: false;
80
+ }
81
+ /**
82
+ * event to notify loan sync operation
83
+ */
84
+ export interface ILoanSyncEvent extends IEvent<ILoan, Record<string, never>, Record<string, unknown>, void> {
85
+ /**
86
+ * event name
87
+ */
88
+ readonly name: 'Sync';
89
+ /**
90
+ * scripting object from where the event is fired
91
+ */
92
+ readonly objectId: 'Loan';
93
+ /**
94
+ * event does not require feedback from listeners
95
+ */
96
+ readonly requiresFeedback: false;
97
+ }
98
+ /**
99
+ * event to notify loan open operation
100
+ */
101
+ export interface ILoanOpenEvent extends IEvent<ILoan, Record<string, never>, Record<string, unknown>, void> {
102
+ /**
103
+ * event name
104
+ */
105
+ readonly name: 'Open';
106
+ /**
107
+ * scripting object from where the event is fired
108
+ */
109
+ readonly objectId: 'Loan';
110
+ /**
111
+ * event does not require feedback from listeners
112
+ */
113
+ readonly requiresFeedback: false;
114
+ }
115
+ /**
116
+ * event to notify loan close operation
117
+ */
118
+ export interface ILoanCloseEvent extends IEvent<ILoan, Record<string, never>, Record<string, unknown>, void> {
119
+ /**
120
+ * event name
121
+ */
122
+ readonly name: 'Close';
123
+ /**
124
+ * scripting object from where the event is fired
125
+ */
126
+ readonly objectId: 'Loan';
127
+ /**
128
+ * event does not require feedback from listeners
129
+ */
130
+ readonly requiresFeedback: false;
131
+ }
132
+ /**
133
+ * event to notify loan milestone completed operation
134
+ */
135
+ export interface ILoanMilestoneCompletedEvent extends IEvent<ILoan, {
136
+ name: string;
137
+ }, Record<string, unknown>, void> {
138
+ /**
139
+ * event name
140
+ */
141
+ readonly name: 'MilestoneCompleted';
142
+ /**
143
+ * scripting object from where the event is fired
144
+ */
145
+ readonly objectId: 'Loan';
146
+ /**
147
+ * event does not require feedback from listeners
148
+ */
149
+ readonly requiresFeedback: false;
150
+ }
151
+ /**
152
+ * event to notify loan pre milestone complete operation
153
+ */
154
+ export interface ILoanPreMilestoneCompleteEvent extends IEvent<ILoan, {
155
+ name: string;
156
+ }, Record<string, unknown>, boolean> {
157
+ /**
158
+ * event name
159
+ */
160
+ readonly name: 'PreMilestoneComplete';
161
+ /**
162
+ * scripting object from where the event is fired
163
+ */
164
+ readonly objectId: 'Loan';
165
+ /**
166
+ * event requires feedback from listeners
167
+ */
168
+ readonly requiresFeedback: true;
169
+ }
170
+ /**
171
+ * event to notify loan application selected operation
172
+ */
173
+ export interface ILoanApplicationSelectedEvent extends IEvent<ILoan, Record<string, never>, Record<string, unknown>, void> {
174
+ /**
175
+ * event name
176
+ */
177
+ readonly name: 'ApplicationSelected';
178
+ /**
179
+ * scripting object from where the event is fired
180
+ */
181
+ readonly objectId: 'Loan';
182
+ /**
183
+ * event does not require feedback from listeners
184
+ */
185
+ readonly requiresFeedback: false;
186
+ }
24
187
  /**
25
188
  * Methods for interacting with an open loan in the application
26
189
  */
27
- export interface ILoan {
190
+ export interface ILoan extends IScriptingObject {
191
+ /**
192
+ * event fired when the loan is ready to commit
193
+ */
194
+ readonly PreCommit: ILoanPreCommitEvent;
195
+ /**
196
+ * event fired when the loan is committed
197
+ */
198
+ readonly Committed: ILoanCommittedEvent;
199
+ /**
200
+ * event fired when the loan is changed
201
+ */
202
+ readonly Change: ILoanChangeEvent;
203
+ /**
204
+ * event fired when the loan is synced
205
+ */
206
+ readonly Sync: ILoanSyncEvent;
207
+ /**
208
+ * event fired when the loan is opened
209
+ */
210
+ readonly Open: ILoanOpenEvent;
211
+ /**
212
+ * event fired when the loan is closed
213
+ */
214
+ readonly Close: ILoanCloseEvent;
215
+ /**
216
+ * event fired when the loan milestone is completed
217
+ */
218
+ readonly MilestoneCompleted: ILoanMilestoneCompletedEvent;
219
+ /**
220
+ * event fired when the loan is ready to complete milestone
221
+ */
222
+ readonly PreMilestoneComplete: ILoanPreMilestoneCompleteEvent;
223
+ /**
224
+ * event fired when the loan application is selected
225
+ */
226
+ readonly ApplicationSelected: ILoanApplicationSelectedEvent;
28
227
  /**
29
228
  * Get complete Loan object
30
229
  *
@@ -143,94 +342,3 @@ export interface ILoan {
143
342
  getCollection(name: string): Promise<Record<string, string>>;
144
343
  getLockSnapshot(): Promise<Record<string, string>>;
145
344
  }
146
- /**
147
- * event handler for loan precommit event
148
- *
149
- * @param cause cause of precommit event
150
- * @returns true if precommit is allowed, false otherwise
151
- */
152
- export declare type LoanPreCommitListener = (cause: string) => boolean;
153
- /**
154
- * event handler for loan commited event
155
- *
156
- * @param cause cause of commit event
157
- */
158
- export declare type LoanCommittedListener = (cause: string) => void;
159
- /**
160
- * event handler for loan data change event
161
- */
162
- export declare type LoanChangeListener = () => void;
163
- /**
164
- * event handler for loan sync event
165
- */
166
- export declare type LoanSyncListener = () => void;
167
- /**
168
- * event handler for loan open event
169
- */
170
- export declare type LoanOpenListener = () => void;
171
- /**
172
- * event handler for loan close event
173
- *
174
- * @returns true if loan close is allowed, false otherwise
175
- */
176
- export declare type LoanCloseListener = () => boolean;
177
- /**
178
- * event handler for loan milestone completed event
179
- *
180
- * @param name milestone name
181
- */
182
- export declare type LoanMilestoneCompletedListener = (name: string) => void;
183
- /**
184
- * event handler for loan pre milestone complete event
185
- *
186
- * @returns true if milestone complete is allowed, false otherwise
187
- */
188
- export declare type LoanPreMilestoneCompleteListener = (name: string) => boolean;
189
- /**
190
- * event handler for loan application selected event
191
- */
192
- export declare type LoanApplicationSelectedListener = () => void;
193
- /**
194
- * events supported by Loan scripting object
195
- */
196
- export declare type LoanEvents = {
197
- /**
198
- * event is fired prior to saving any pending changes to the loan.
199
- * The guest can use this event to perform custom validation and,
200
- * via the feedback mechanism, prevent the loan from being saved
201
- */
202
- 'loan.precommit': LoanPreCommitListener;
203
- /**
204
- * event is fired after pending changes to the loan are committed
205
- */
206
- 'loan.committed': LoanCommittedListener;
207
- /**
208
- * event is fired for each change made by the user in the UI
209
- */
210
- 'loan.change': LoanChangeListener;
211
- /**
212
- * event is fired after the loan is sync'ed within any saved state made outside of the user's workspace.
213
- */
214
- 'loan.sync': LoanSyncListener;
215
- /**
216
- * event is fired after the loan is opened and ready for user interaction
217
- */
218
- 'loan.open': LoanOpenListener;
219
- /**
220
- * event is fired just prior to closing the loan in the UI
221
- */
222
- 'loan.close': LoanCloseListener;
223
- /**
224
- * event is fired after a milestone is completed by the user and committed to the server
225
- */
226
- 'loan.milestoneCompleted': LoanMilestoneCompletedListener;
227
- /**
228
- * event is fired when the user attempts to complete a milestone and allows for custom validation,
229
- * and cancellation, of the process
230
- */
231
- 'loan.premilestoneComplete': LoanPreMilestoneCompleteListener;
232
- /**
233
- * event is fired when a borrower pair changes
234
- */
235
- 'loan.applicationselected': LoanApplicationSelectedListener;
236
- };
@@ -1,3 +1,4 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  /**
2
3
  * get or set values in host application javascript memory
3
4
  * values stored in memory are not persisted across sessions
@@ -7,7 +8,7 @@
7
8
  * that means, two microapps can use same key to store different values. Thier values will not collide.
8
9
  *
9
10
  */
10
- export interface IMemStorage {
11
+ export interface IMemStorage extends IScriptingObject {
11
12
  /**
12
13
  * set a value in memory for given key
13
14
  *
@@ -15,12 +16,12 @@ export interface IMemStorage {
15
16
  * @param key unique key to store the value
16
17
  * @param value value to be stored. value should be JSON serializable
17
18
  */
18
- set(clientId: string, key: string, value: any): Promise<void>;
19
+ set(clientId: string, key: string, value: unknown): Promise<void>;
19
20
  /**
20
21
  * get a value from memory for given key and microapp id
21
22
  *
22
23
  * @param key unique key to retrieve the value
23
24
  * @returns value stored in memory
24
25
  */
25
- get(clientId: string, key: string): Promise<any>;
26
+ get(clientId: string, key: string): Promise<unknown>;
26
27
  }
@@ -1,7 +1,34 @@
1
+ import { IEvent } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * Module unloading event
5
+ */
6
+ export interface IModuleUnloadingEvent extends IEvent<IModule, Record<string, never>, Record<string, unknown>, boolean> {
7
+ /**
8
+ * event name
9
+ */
10
+ readonly name: 'Unloading';
11
+ /**
12
+ * scripting object from where the event was triggered
13
+ */
14
+ readonly objectId: 'Module';
15
+ /**
16
+ * response needed from event listeners
17
+ */
18
+ readonly requiresFeedback: true;
19
+ }
1
20
  /**
2
21
  * Exposes MicroApp module specific methods
22
+ * This is an abstract interface and needs to be extended by the module
23
+ * users should avoid creating Scripting object with name 'Module'
3
24
  */
4
- export interface IModule {
25
+ export interface IModule extends IScriptingObject {
26
+ /**
27
+ * event fired when the module is unloading
28
+ *
29
+ * @returns true if the module can be unloaded, false otherwise
30
+ */
31
+ readonly Unloading: IModuleUnloadingEvent;
5
32
  /**
6
33
  * get microapp module-specific capabilities or settings defined by the host application. Helps to define the style and/or behavior of the module
7
34
  *
@@ -21,21 +48,3 @@ export interface IModule {
21
48
  */
22
49
  unload(): Promise<void>;
23
50
  }
24
- /**
25
- * event handler that handles module unload event
26
- *
27
- * @param id unique id of the app that is being unloaded
28
- * @returns true if the module can be unloaded, false otherwise
29
- */
30
- export declare type ModuleUnLoadingListener = (appId: string) => boolean;
31
- /**
32
- * events that notifies the module's lifecycle
33
- */
34
- export declare type ModuleEvents = {
35
- /**
36
- * event fired when the module is unloading
37
- *
38
- * @returns true if the module can be unloaded, false otherwise
39
- */
40
- 'module.unloading': ModuleUnLoadingListener;
41
- };
@@ -1,7 +1,8 @@
1
1
  import { To } from 'history';
2
+ import { IScriptingObject } from '../scriptingObject.js';
2
3
  /**
3
4
  * Methods to view, modify & get notified about parent window url navigation
4
5
  */
5
- export interface IRoute {
6
- navigate(path: To, state?: any): Promise<void>;
6
+ export interface IRoute extends IScriptingObject {
7
+ navigate(path: To, state?: unknown): Promise<void>;
7
8
  }
@@ -1,3 +1,4 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  /**
2
3
  * type of service setup categories
3
4
  */
@@ -39,7 +40,7 @@ declare type OpenOptions = {
39
40
  /**
40
41
  * Methods for interacting with the Service orders
41
42
  */
42
- export interface IService {
43
+ export interface IService extends IScriptingObject {
43
44
  /**
44
45
  * Get the service setup for the current user and loan
45
46
  *
@@ -1,7 +1,8 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  /**
2
3
  * store and retrieves values in host application's session storage
3
4
  */
4
- export interface ISession {
5
+ export interface ISession extends IScriptingObject {
5
6
  /**
6
7
  * set a value in the session storage
7
8
  *
@@ -1,3 +1,4 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  import { ResourceDetails, TransactionDetails, TransactionEvent, OriginDetails, ResourceOptions } from './shared.js';
2
3
  /**
3
4
  * details about the transaction that is created / updated
@@ -16,7 +17,7 @@ export declare type TransactionInfo = {
16
17
  * update an existing transaction,
17
18
  * create events/messages for a transaction, and more.
18
19
  */
19
- export interface ITransaction {
20
+ export interface ITransaction extends IScriptingObject {
20
21
  /**
21
22
  * Provide the necessary information for your application's user-interface to:
22
23
  * Access transaction origination information and bootstrap its user interaction
@@ -1,3 +1,4 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  /**
2
3
  * Transaction request object
3
4
  */
@@ -14,7 +15,7 @@ export declare type TransactionRequest = {
14
15
  * This can be used to select from which bureaus to order a borrower's credit score for a Credit integration,
15
16
  * or how many days of income information to pull for a borrower in the case of a Verification of Income/Employment integration
16
17
  */
17
- options?: Record<string, any>;
18
+ options?: Record<string, unknown>;
18
19
  };
19
20
  /**
20
21
  * Transaction Template object
@@ -43,7 +44,7 @@ export declare type TransactionTemplateDetails = {
43
44
  * for enabling Lender administrators to create transaction request templates,
44
45
  * which they can associate with a 1-click/automated ordering business condition set.
45
46
  */
46
- export interface ITransactionTemplate {
47
+ export interface ITransactionTemplate extends IScriptingObject {
47
48
  /**
48
49
  * Discover if your administrator-facing view has been rendered in the context of an existing
49
50
  * transaction request template (in edit mode) or a new transaction request template (in create mode).
@@ -1,3 +1,4 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  import { OriginDetails, TransactionDetails, TransactionEvent, ResourceDetails, ResourceOptions } from './shared.js';
2
3
  /**
3
4
  * reason for completing the user interaction with the transaction
@@ -24,7 +25,7 @@ export declare enum CompleteReason {
24
25
  * update an existing transaction,
25
26
  * create events/messages for a transaction, and more.
26
27
  */
27
- export interface ITransactionV2 {
28
+ export interface ITransactionV2 extends IScriptingObject {
28
29
  /**
29
30
  * create new transaction
30
31
  *
@@ -249,7 +249,7 @@ export declare type Pipeline = {
249
249
  access: boolean;
250
250
  pipelineTasks: string[];
251
251
  pipelineViews: PipelineView[];
252
- nonAccessibleColumns: any[];
252
+ nonAccessibleColumns: unknown[];
253
253
  };
254
254
  export declare type PipelineView = {
255
255
  entityId: string;
@@ -344,9 +344,9 @@ export declare type ConditionType = {
344
344
  export declare type LoConnectTasks = {
345
345
  access: boolean;
346
346
  rights: string[];
347
- customForms: any[];
348
- customTools: any[];
349
- globalApplications: any[];
347
+ customForms: unknown[];
348
+ customTools: unknown[];
349
+ globalApplications: unknown[];
350
350
  standardWebForms: StandardWebForm[];
351
351
  };
352
352
  export declare type StandardWebForm = {
@@ -1,4 +1,6 @@
1
1
  import { BreakPoint } from '@elliemae/pui-theme';
2
+ import { IEvent } from '../event.js';
3
+ import { IScriptingObject } from '../scriptingObject.js';
2
4
  /**
3
5
  * window viewport size
4
6
  */
@@ -7,37 +9,61 @@ export declare type ViewportSize = {
7
9
  height: number;
8
10
  };
9
11
  /**
10
- * Methods view, modify parent's window attributes
12
+ * event to notify window viewport resize operation
11
13
  */
12
- export interface IView {
14
+ export interface IViewResizeEvent extends IEvent<IView, {
15
+ entries: ResizeObserverEntry;
16
+ }, Record<string, unknown>, void> {
13
17
  /**
14
- * Get the current breakpoint of the parent window
18
+ * event name
15
19
  */
16
- getBreakpoint(): Promise<BreakPoint>;
20
+ readonly name: 'Resize';
17
21
  /**
18
- * Get the current viewport size of the parent window
22
+ * scripting object from where the event is fired
19
23
  */
20
- getViewPortSize(): Promise<ViewportSize>;
24
+ readonly objectId: 'View';
25
+ /**
26
+ * event does not require feedback from listeners
27
+ */
28
+ readonly requiresFeedback: false;
21
29
  }
22
30
  /**
23
- * parent window resize event handler
24
- *
25
- * @param entries details about the resize event
31
+ * event to notify window viewport breakpoint change
26
32
  */
27
- export declare type ResizeEventListener = (entries: ResizeObserverEntry) => void;
33
+ export interface IViewBreakpointChangeEvent extends IEvent<IView, {
34
+ breakpoint: BreakPoint;
35
+ }, Record<string, unknown>, void> {
36
+ /**
37
+ * event name
38
+ */
39
+ readonly name: 'BreakpointChange';
40
+ /**
41
+ * scripting object from where the event is fired
42
+ */
43
+ readonly objectId: 'View';
44
+ /**
45
+ * event does not require feedback from listeners
46
+ */
47
+ readonly requiresFeedback: false;
48
+ }
28
49
  /**
29
- * parent window breakpoint change event handler
30
- *
31
- * @param breakpoint current breakpoint of the parent window
50
+ * Methods view, modify parent's window attributes
32
51
  */
33
- export declare type BreakpointChangeEventListener = (breakpoint: BreakPoint) => void;
34
- export declare type ViewEvents = {
52
+ export interface IView extends IScriptingObject {
35
53
  /**
36
- * eent is fired when the parent window is resized
54
+ * event fired when the window is resized
37
55
  */
38
- 'view.resize': ResizeEventListener;
56
+ readonly Resize: IViewResizeEvent;
39
57
  /**
40
- * event is fired when the parent window's breakpoint changes
58
+ * event fired when the window breakpoint changes
41
59
  */
42
- 'view.breakpointChange': BreakpointChangeEventListener;
43
- };
60
+ readonly BreakpointChange: IViewBreakpointChangeEvent;
61
+ /**
62
+ * Get the current breakpoint of the parent window
63
+ */
64
+ getBreakpoint(): Promise<BreakPoint>;
65
+ /**
66
+ * Get the current viewport size of the parent window
67
+ */
68
+ getViewPortSize(): Promise<ViewportSize>;
69
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * serialized scripting object
3
+ */
4
+ export declare type RemotingScriptingObject = {
5
+ /**
6
+ * id of the scripting object
7
+ */
8
+ readonly objectId: string;
9
+ /**
10
+ * type of the scripting object
11
+ */
12
+ readonly objectType: string;
13
+ /**
14
+ * array of public functions exposed from the scripting object
15
+ */
16
+ readonly functions: Array<string>;
17
+ /**
18
+ * array of public events exposed from the scripting object
19
+ */
20
+ readonly events: Array<string>;
21
+ };
@@ -0,0 +1,15 @@
1
+ import { RemotingScriptingObject } from './remotingScriptingObject.js';
2
+ /**
3
+ * base type for scripting object proxy
4
+ */
5
+ export interface IScriptingObjectProxy {
6
+ readonly id: string;
7
+ readonly objectType: string;
8
+ }
9
+ /**
10
+ * base type for scripting object
11
+ */
12
+ export interface IScriptingObject extends IScriptingObjectProxy {
13
+ _toJSON(): RemotingScriptingObject;
14
+ _dispose?(): void;
15
+ }
@@ -13,9 +13,11 @@ import { IAnalytics } from './objects/analytics.js';
13
13
  import { IMemStorage } from './objects/memStorage.js';
14
14
  import { IView } from './objects/view.js';
15
15
  import { IRoute } from './objects/route.js';
16
- import { IModule } from './objects/module.js';
17
16
  import { IService } from './objects/service.js';
18
- export declare type ScriptingObjectTypes = {
17
+ /**
18
+ * list of scripting object names and their types
19
+ */
20
+ export declare type ScriptingObjects = {
19
21
  Analytics: IAnalytics;
20
22
  Application: IApplication;
21
23
  Auth: IAuth;
@@ -25,7 +27,6 @@ export declare type ScriptingObjectTypes = {
25
27
  Loan: ILoan;
26
28
  LoanV2: ILoanV2;
27
29
  MemStorage: IMemStorage;
28
- Module: IModule;
29
30
  Route: IRoute;
30
31
  Service: IService;
31
32
  Session: ISession;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-scripting-object",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "Typescript defintions for Scripting Objects",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/cjs/index.js",
@@ -1,7 +0,0 @@
1
- import { FormEvents } from './objects/form.js';
2
- import { ApplicationEvents } from './objects/application.js';
3
- import { GlobalEvents } from './objects/global.js';
4
- import { ModuleEvents } from './objects/module.js';
5
- import { LoanEvents } from './objects/loan.js';
6
- import { ViewEvents } from './objects/view.js';
7
- export declare type ScriptingObjectEvents = FormEvents & ApplicationEvents & GlobalEvents & ModuleEvents & LoanEvents & ViewEvents;
@@ -1,28 +0,0 @@
1
- /**
2
- * Scripting object interface
3
- */
4
- export interface IScript {
5
- /**
6
- * get scripting object by name
7
- *
8
- * @param name scripting object name
9
- */
10
- getObject<T>(name: string): Promise<T>;
11
- /**
12
- * subscribe to an scripting object event
13
- *
14
- * @returns token to be used to unsubscribe
15
- * @param objName scripting object name
16
- * @param eventName event name
17
- * @param listener callback function to be called when the event is fired
18
- */
19
- subscribe(objName: string, eventName: string, listener: (ev: any) => any): string;
20
- /**
21
- * unsubscribe from an scripting object event
22
- *
23
- * @param objName scripting object name
24
- * @param eventName event name
25
- * @param token unique token returned by subscribe
26
- */
27
- unsubscribe(objName: string, eventName: string, token: string): void;
28
- }