@elliemae/pui-scripting-object 1.13.0 → 1.15.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 (37) hide show
  1. package/dist/cjs/{events.js → event.js} +2 -2
  2. package/dist/cjs/index.js +12 -1
  3. package/dist/cjs/objects/transactionv2.js +13 -0
  4. package/dist/cjs/remotingScriptingObject.js +16 -0
  5. package/dist/cjs/{script.js → scriptingObject.js} +2 -2
  6. package/dist/cjs/{scriptingObjectTypes.js → scriptingObjectList.js} +2 -2
  7. package/dist/esm/{events.js → event.js} +0 -0
  8. package/dist/esm/index.js +8 -1
  9. package/dist/esm/objects/transactionv2.js +9 -0
  10. package/dist/esm/{script.js → remotingScriptingObject.js} +0 -0
  11. package/dist/esm/{scriptingObjectTypes.js → scriptingObject.js} +0 -0
  12. package/dist/esm/scriptingObjectList.js +0 -0
  13. package/dist/types/event.d.ts +43 -0
  14. package/dist/types/index.d.ts +3 -3
  15. package/dist/types/objects/application.d.ts +33 -13
  16. package/dist/types/objects/auth.d.ts +3 -2
  17. package/dist/types/objects/form.d.ts +34 -17
  18. package/dist/types/objects/global.d.ts +20 -13
  19. package/dist/types/objects/http.d.ts +2 -1
  20. package/dist/types/objects/loan.d.ts +129 -55
  21. package/dist/types/objects/memStorage.d.ts +4 -3
  22. package/dist/types/objects/module.d.ts +20 -13
  23. package/dist/types/objects/route.d.ts +3 -2
  24. package/dist/types/objects/service.d.ts +2 -1
  25. package/dist/types/objects/session.d.ts +2 -1
  26. package/dist/types/objects/shared.d.ts +0 -8
  27. package/dist/types/objects/transaction.d.ts +2 -1
  28. package/dist/types/objects/transactionTemplate.d.ts +3 -2
  29. package/dist/types/objects/transactionv2.d.ts +32 -26
  30. package/dist/types/objects/userAccessRights.d.ts +4 -4
  31. package/dist/types/objects/view.d.ts +33 -13
  32. package/dist/types/remotingScriptingObject.d.ts +21 -0
  33. package/dist/types/scriptingObject.d.ts +15 -0
  34. package/dist/types/{scriptingObjectTypes.d.ts → scriptingObjectList.d.ts} +4 -3
  35. package/package.json +2 -2
  36. package/dist/types/events.d.ts +0 -7
  37. 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");
@@ -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))
@@ -13,4 +17,13 @@ var __copyProps = (to, from, except, desc) => {
13
17
  };
14
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
19
  var transactionv2_exports = {};
20
+ __export(transactionv2_exports, {
21
+ CompleteReason: () => CompleteReason
22
+ });
16
23
  module.exports = __toCommonJS(transactionv2_exports);
24
+ var CompleteReason = /* @__PURE__ */ ((CompleteReason2) => {
25
+ CompleteReason2["CLOSE"] = "close";
26
+ CompleteReason2["CANCEL"] = "cancel";
27
+ CompleteReason2["ERROR"] = "error";
28
+ return CompleteReason2;
29
+ })(CompleteReason || {});
@@ -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
+ };
@@ -0,0 +1,9 @@
1
+ var CompleteReason = /* @__PURE__ */ ((CompleteReason2) => {
2
+ CompleteReason2["CLOSE"] = "close";
3
+ CompleteReason2["CANCEL"] = "cancel";
4
+ CompleteReason2["ERROR"] = "error";
5
+ return CompleteReason2;
6
+ })(CompleteReason || {});
7
+ export {
8
+ CompleteReason
9
+ };
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 {
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: Record<string, unknown>;
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<IScriptingObject, Record<string, unknown>, Record<string, unknown>, unknown>) => 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,5 @@
1
+ import { IEvent, Listener } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
1
3
  export declare enum LogLevel {
2
4
  TRACE = "TRACE",
3
5
  DEBUG = "DEBUG",
@@ -84,10 +86,34 @@ export declare type PrintOptions = {
84
86
  */
85
87
  blob: Blob;
86
88
  };
89
+ /**
90
+ * event fired when the user logs in
91
+ */
92
+ export interface ApplicationLoginEvent extends IEvent {
93
+ readonly name: 'Login';
94
+ readonly objectId: 'Application';
95
+ readonly requiresFeedback: false;
96
+ }
97
+ /**
98
+ * event fired when an action is completed. actions are executed through the performAction method
99
+ */
100
+ export interface ApplicationActionCompletedEvent extends IEvent {
101
+ readonly name: 'ActionCompleted';
102
+ readonly objectId: 'Application';
103
+ readonly requiresFeedback: false;
104
+ }
87
105
  /**
88
106
  * Allows access to application-level UI elements, behaviors and events
89
107
  */
90
- export interface IApplication {
108
+ export interface IApplication extends IScriptingObject {
109
+ /**
110
+ * notifies user login
111
+ */
112
+ readonly Login: ApplicationLoginEvent;
113
+ /**
114
+ * notifies action completion
115
+ */
116
+ readonly ActionCompleted: ApplicationActionCompletedEvent;
91
117
  /**
92
118
  * Gets descriptor for the Application
93
119
  *
@@ -195,20 +221,14 @@ export interface IApplication {
195
221
  *
196
222
  * @param userId unique identifier of the user
197
223
  */
198
- export declare type AppLoginListener = (userId: string) => void;
224
+ export declare type ApplicationLoginListener = Listener<IApplication, {
225
+ userId: string;
226
+ }, Record<string, unknown>, void>;
199
227
  /**
200
228
  * event handler that handles action completed event
201
229
  *
202
230
  * @param name action name
203
231
  */
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
- };
232
+ export declare type ApplicationActionCompletedListener = Listener<IApplication, {
233
+ name: string;
234
+ }, Record<string, unknown>, void>;
@@ -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,37 @@
1
+ import { IEvent, Listener } 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 FormLoadEvent extends IEvent {
11
+ readonly name: 'Load';
12
+ readonly objectId: 'Form';
13
+ readonly requiresFeedback: false;
14
+ }
15
+ /**
16
+ * event to notify form unload operation
17
+ */
18
+ export interface FormUnLoadEvent extends IEvent {
19
+ readonly name: 'UnLoad';
20
+ readonly objectId: 'Form';
21
+ readonly requiresFeedback: false;
22
+ }
5
23
  /**
6
24
  * Methods to get information about the custom form
7
25
  */
8
- export interface IForm {
26
+ export interface IForm extends IScriptingObject {
27
+ /**
28
+ * event fired when the form is loaded
29
+ */
30
+ readonly Load: FormLoadEvent;
31
+ /**
32
+ * event fired when the form is unloaded
33
+ */
34
+ readonly UnLoad: FormUnLoadEvent;
9
35
  /**
10
36
  * get metadata of the form
11
37
  *
@@ -18,30 +44,21 @@ export interface IForm {
18
44
  * @param id form id
19
45
  * @returns form input control object
20
46
  */
21
- getControl(id: string): Promise<any>;
47
+ getControl(id: string): Promise<unknown>;
22
48
  }
23
49
  /**
24
50
  * event handler for form load event
25
51
  *
26
52
  * @param id unique id of the form that is loaded
27
53
  */
28
- export declare type FormLoadListener = (id: string) => void;
54
+ export declare type FormLoadListener = Listener<IForm, {
55
+ id: string;
56
+ }, Record<string, unknown>, void>;
29
57
  /**
30
58
  * event handler for form unload event
31
59
  *
32
60
  * @param id unique id of the form that is unloaded
33
61
  */
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
- };
62
+ export declare type FormUnLoadListener = Listener<IForm, {
63
+ id: string;
64
+ }, Record<string, unknown>, void>;
@@ -1,3 +1,13 @@
1
+ import { IEvent, Listener } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * event to notify change in global state
5
+ */
6
+ export interface GlobalChangeEvent extends IEvent {
7
+ readonly name: 'Change';
8
+ readonly objectId: 'Global';
9
+ readonly requiresFeedback: false;
10
+ }
1
11
  /**
2
12
  * The Global object allows for data to be shared between custom forms/tools/plugins within a user's session.
3
13
  * Unlike the Session scripting object, where data is isolated to be visible/accessible only by the form/plugin that writes the variables,
@@ -14,34 +24,31 @@
14
24
  * This will ensure that no guest can consume more than 250 KB of sessionStorage
15
25
  *
16
26
  */
17
- export interface IGlobal {
27
+ export interface IGlobal extends IScriptingObject {
28
+ /**
29
+ * event fired when the global state changes
30
+ */
31
+ readonly Change: GlobalChangeEvent;
18
32
  /**
19
33
  * set a value in the global store
20
34
  *
21
35
  * @param key unique key to identify the value
22
36
  * @param value value to be stored
23
37
  */
24
- set(key: string, value: any): Promise<void>;
38
+ set(key: string, value: unknown): Promise<void>;
25
39
  /**
26
40
  * get a value from the global store
27
41
  *
28
42
  * @param key unique key to identify the value
29
43
  * @returns value stored in the global store
30
44
  */
31
- get(key: string): Promise<any>;
45
+ get(key: string): Promise<unknown>;
32
46
  }
33
47
  /**
34
48
  * event handler for global state change event
35
49
  *
36
50
  * @param key name of the key for which the value changed
37
51
  */
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
- };
52
+ export declare type GlobalChangeListener = Listener<IGlobal, {
53
+ key: string;
54
+ }, Record<string, unknown>, void>;
@@ -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, Listener } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
1
3
  /**
2
4
  * option name and its value
3
5
  */
@@ -14,17 +16,125 @@ 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 LoanPreCommitEvent extends IEvent {
30
+ readonly name: 'PreCommit';
31
+ readonly objectId: 'Loan';
32
+ readonly requiresFeedback: true;
33
+ }
34
+ /**
35
+ * event to notify loan committed operation
36
+ */
37
+ export interface LoanCommittedEvent extends IEvent {
38
+ readonly name: 'Committed';
39
+ readonly objectId: 'Loan';
40
+ readonly requiresFeedback: false;
41
+ }
42
+ /**
43
+ * event to notify loan change operation
44
+ */
45
+ export interface LoanChangeEvent extends IEvent {
46
+ readonly name: 'Chanage';
47
+ readonly objectId: 'Loan';
48
+ readonly requiresFeedback: false;
49
+ }
50
+ /**
51
+ * event to notify loan sync operation
52
+ */
53
+ export interface LoanSyncEvent extends IEvent {
54
+ readonly name: 'Sync';
55
+ readonly objectId: 'Loan';
56
+ readonly requiresFeedback: false;
57
+ }
58
+ /**
59
+ * event to notify loan open operation
60
+ */
61
+ export interface LoanOpenEvent extends IEvent {
62
+ readonly name: 'Open';
63
+ readonly objectId: 'Loan';
64
+ readonly requiresFeedback: false;
65
+ }
66
+ /**
67
+ * event to notify loan close operation
68
+ */
69
+ export interface LoanCloseEvent extends IEvent {
70
+ readonly name: 'Close';
71
+ readonly objectId: 'Loan';
72
+ readonly requiresFeedback: false;
73
+ }
74
+ /**
75
+ * event to notify loan milestone completed operation
76
+ */
77
+ export interface LoanMilestoneCompletedEvent extends IEvent {
78
+ readonly name: 'MilestoneCompleted';
79
+ readonly objectId: 'Loan';
80
+ readonly requiresFeedback: false;
81
+ }
82
+ /**
83
+ * event to notify loan pre milestone complete operation
84
+ */
85
+ export interface LoanPreMilestoneCompleteEvent extends IEvent {
86
+ readonly name: 'PreMilestoneComplete';
87
+ readonly objectId: 'Loan';
88
+ readonly requiresFeedback: true;
89
+ }
90
+ /**
91
+ * event to notify loan application selected operation
92
+ */
93
+ export interface LoanApplicationSelectedEvent extends IEvent {
94
+ readonly name: 'ApplicationSelected';
95
+ readonly objectId: 'Loan';
96
+ readonly requiresFeedback: false;
97
+ }
24
98
  /**
25
99
  * Methods for interacting with an open loan in the application
26
100
  */
27
- export interface ILoan {
101
+ export interface ILoan extends IScriptingObject {
102
+ /**
103
+ * event fired when the loan is ready to commit
104
+ */
105
+ readonly PreCommit: LoanPreCommitEvent;
106
+ /**
107
+ * event fired when the loan is committed
108
+ */
109
+ readonly Committed: LoanCommittedEvent;
110
+ /**
111
+ * event fired when the loan is changed
112
+ */
113
+ readonly Change: LoanChangeEvent;
114
+ /**
115
+ * event fired when the loan is synced
116
+ */
117
+ readonly Sync: LoanSyncEvent;
118
+ /**
119
+ * event fired when the loan is opened
120
+ */
121
+ readonly Open: LoanOpenEvent;
122
+ /**
123
+ * event fired when the loan is closed
124
+ */
125
+ readonly Close: LoanCloseEvent;
126
+ /**
127
+ * event fired when the loan milestone is completed
128
+ */
129
+ readonly MilestoneCompleted: LoanMilestoneCompletedEvent;
130
+ /**
131
+ * event fired when the loan is ready to complete milestone
132
+ */
133
+ readonly PreMilestoneComplete: LoanPreMilestoneCompleteEvent;
134
+ /**
135
+ * event fired when the loan application is selected
136
+ */
137
+ readonly ApplicationSelected: LoanApplicationSelectedEvent;
28
138
  /**
29
139
  * Get complete Loan object
30
140
  *
@@ -149,88 +259,52 @@ export interface ILoan {
149
259
  * @param cause cause of precommit event
150
260
  * @returns true if precommit is allowed, false otherwise
151
261
  */
152
- export declare type LoanPreCommitListener = (cause: string) => boolean;
262
+ export declare type LoanPreCommitListener = Listener<ILoan, {
263
+ cause: string;
264
+ }, Record<string, unknown>, boolean>;
153
265
  /**
154
266
  * event handler for loan commited event
155
267
  *
156
268
  * @param cause cause of commit event
157
269
  */
158
- export declare type LoanCommittedListener = (cause: string) => void;
270
+ export declare type LoanCommittedListener = Listener<ILoan, {
271
+ cause: string;
272
+ }, Record<string, unknown>, void>;
159
273
  /**
160
274
  * event handler for loan data change event
161
275
  */
162
- export declare type LoanChangeListener = () => void;
276
+ export declare type LoanChangeListener = Listener<ILoan, Record<string, never>, Record<string, unknown>, void>;
163
277
  /**
164
278
  * event handler for loan sync event
165
279
  */
166
- export declare type LoanSyncListener = () => void;
280
+ export declare type LoanSyncListener = Listener<ILoan, Record<string, never>, Record<string, unknown>, void>;
167
281
  /**
168
282
  * event handler for loan open event
169
283
  */
170
- export declare type LoanOpenListener = () => void;
284
+ export declare type LoanOpenListener = Listener<ILoan, Record<string, never>, Record<string, unknown>, void>;
171
285
  /**
172
286
  * event handler for loan close event
173
287
  *
174
288
  * @returns true if loan close is allowed, false otherwise
175
289
  */
176
- export declare type LoanCloseListener = () => boolean;
290
+ export declare type LoanCloseListener = Listener<ILoan, Record<string, never>, Record<string, unknown>, void>;
177
291
  /**
178
292
  * event handler for loan milestone completed event
179
293
  *
180
294
  * @param name milestone name
181
295
  */
182
- export declare type LoanMilestoneCompletedListener = (name: string) => void;
296
+ export declare type LoanMilestoneCompletedListener = Listener<ILoan, {
297
+ name: string;
298
+ }, Record<string, unknown>, void>;
183
299
  /**
184
300
  * event handler for loan pre milestone complete event
185
301
  *
186
302
  * @returns true if milestone complete is allowed, false otherwise
187
303
  */
188
- export declare type LoanPreMilestoneCompleteListener = (name: string) => boolean;
304
+ export declare type LoanPreMilestoneCompleteListener = Listener<ILoan, {
305
+ name: string;
306
+ }, Record<string, unknown>, boolean>;
189
307
  /**
190
308
  * event handler for loan application selected event
191
309
  */
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
- };
310
+ export declare type LoanApplicationSelectedListener = Listener<ILoan, Record<string, never>, Record<string, unknown>, void>;
@@ -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,25 @@
1
+ import { IEvent, Listener } from '../event.js';
2
+ import { IScriptingObject } from '../scriptingObject.js';
3
+ /**
4
+ * Module unloading event
5
+ */
6
+ export interface ModuleUnloadingEvent extends IEvent {
7
+ readonly name: 'Unloading';
8
+ readonly objectId: 'Module';
9
+ readonly requiresFeedback: true;
10
+ }
1
11
  /**
2
12
  * Exposes MicroApp module specific methods
13
+ * This is an abstract interface and needs to be extended by the module
14
+ * users should avoid creating Scripting object with name 'Module'
3
15
  */
4
- export interface IModule {
16
+ export interface IModule extends IScriptingObject {
17
+ /**
18
+ * event fired when the module is unloading
19
+ *
20
+ * @returns true if the module can be unloaded, false otherwise
21
+ */
22
+ readonly Unloading: ModuleUnloadingEvent;
5
23
  /**
6
24
  * get microapp module-specific capabilities or settings defined by the host application. Helps to define the style and/or behavior of the module
7
25
  *
@@ -27,15 +45,4 @@ export interface IModule {
27
45
  * @param id unique id of the app that is being unloaded
28
46
  * @returns true if the module can be unloaded, false otherwise
29
47
  */
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
- };
48
+ export declare type ModuleUnLoadingListener = Listener<IModule, Record<string, never>, Record<string, unknown>, boolean>;
@@ -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
  *
@@ -25,14 +25,6 @@ export declare type OriginDetails = {
25
25
  * via the REST API's /partner/v2/origins/:id endpoint
26
26
  */
27
27
  id: string;
28
- /**
29
- * Unique identifier for the transaction in whose context the
30
- * partner integrations user-interface is being launched.
31
- * This is only available in the situation where your integration
32
- * is being launched in the context of an existing transaction,
33
- * and can be used to decide the appropriate view to display to users
34
- */
35
- transactionId?: string;
36
28
  /**
37
29
  * The user type in whose context your integration is being launched
38
30
  */
@@ -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,4 +1,22 @@
1
+ import { IScriptingObject } from '../scriptingObject.js';
1
2
  import { OriginDetails, TransactionDetails, TransactionEvent, ResourceDetails, ResourceOptions } from './shared.js';
3
+ /**
4
+ * reason for completing the user interaction with the transaction
5
+ */
6
+ export declare enum CompleteReason {
7
+ /**
8
+ * user completed interaction with the transaction
9
+ */
10
+ CLOSE = "close",
11
+ /**
12
+ * user cancelled the interaction with transaction
13
+ */
14
+ CANCEL = "cancel",
15
+ /**
16
+ * interaction with the transaction errored out
17
+ */
18
+ ERROR = "error"
19
+ }
2
20
  /**
3
21
  * Provides your applications lender/borrower-facing view with the necessary handles to model your application's
4
22
  * transactional interaction with the EPC platform.
@@ -7,7 +25,7 @@ import { OriginDetails, TransactionDetails, TransactionEvent, ResourceDetails, R
7
25
  * update an existing transaction,
8
26
  * create events/messages for a transaction, and more.
9
27
  */
10
- export interface ITransactionV2 {
28
+ export interface ITransactionV2 extends IScriptingObject {
11
29
  /**
12
30
  * create new transaction
13
31
  *
@@ -43,21 +61,18 @@ export interface ITransactionV2 {
43
61
  */
44
62
  get(id: string): Promise<TransactionDetails>;
45
63
  /**
46
- * Get transaction's origination and context
64
+ * Get origination and context
47
65
  *
48
- * @param id - unique identifier for the transaction
49
- * @returns transaction origination information
50
- * @throws TransactinNotFound error for invalid transaction id
66
+ * @returns service setup origination information
67
+ * @throws OriginNotFound error when origin is not found
51
68
  */
52
- getOrigin(id: string): Promise<OriginDetails>;
69
+ getOrigin(): Promise<OriginDetails>;
53
70
  /**
54
- * refresh transaction origination context, if current one expires.
71
+ * refresh origination context, if current one expires.
55
72
  *
56
- * @param id - unique identifier for the transaction
57
- * @returns transaction origination information
58
- * @throws TransactionNotFound error for invalid transaction id
73
+ * @returns origination information
59
74
  */
60
- refreshOrigin(id: string): Promise<OriginDetails>;
75
+ refreshOrigin(): Promise<OriginDetails>;
61
76
  /**
62
77
  * update existing transaction.
63
78
  *
@@ -67,20 +82,11 @@ export interface ITransactionV2 {
67
82
  */
68
83
  update(id: string, options: TransactionDetails): Promise<void>;
69
84
  /**
70
- * clean up
71
- */
72
- close(id: string): Promise<void>;
73
- /**
74
- * cancel the
75
- * This signals a cancelation outcome to the host application -
76
- * how this is handled by the host upon user navigation can vary across applications
77
- */
78
- cancel(id: string): Promise<void>;
79
- /**
80
- * Navigate your users back to where they left off in the host Encompass application,
81
- * after their has been an error (application error or workflow error) on your integrations user-interface.
82
- * This signals an error outcome to the host Encompass application -
83
- * how this is handled by the host upon user navigation can vary across applications
85
+ * notify host on completion of user interaction with the transaction
86
+ * so that host can perform any necessary post user interaction processing / cleanup.
87
+ *
88
+ * @param id - unique identifier for the transaction
89
+ * @param reason reason for completing the transaction user interaction
84
90
  */
85
- error(): Promise<void>;
91
+ completeUserInteraction(id: string, reason: CompleteReason): Promise<void>;
86
92
  }
@@ -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, Listener } from '../event.js';
3
+ import { IScriptingObject } from '../scriptingObject.js';
2
4
  /**
3
5
  * window viewport size
4
6
  */
@@ -6,10 +8,34 @@ export declare type ViewportSize = {
6
8
  width: number;
7
9
  height: number;
8
10
  };
11
+ /**
12
+ * event to notify window viewport resize operation
13
+ */
14
+ export interface ViewResizeEvent extends IEvent {
15
+ readonly name: 'Resize';
16
+ readonly objectId: 'View';
17
+ readonly requiresFeedback: false;
18
+ }
19
+ /**
20
+ * event to notify window viewport breakpoint change
21
+ */
22
+ export interface ViewBreakpointChangeEvent extends IEvent {
23
+ readonly name: 'BreakpointChange';
24
+ readonly objectId: 'View';
25
+ readonly requiresFeedback: false;
26
+ }
9
27
  /**
10
28
  * Methods view, modify parent's window attributes
11
29
  */
12
- export interface IView {
30
+ export interface IView extends IScriptingObject {
31
+ /**
32
+ * event fired when the window is resized
33
+ */
34
+ readonly Resize: ViewResizeEvent;
35
+ /**
36
+ * event fired when the window breakpoint changes
37
+ */
38
+ readonly BreakpointChange: ViewBreakpointChangeEvent;
13
39
  /**
14
40
  * Get the current breakpoint of the parent window
15
41
  */
@@ -24,20 +50,14 @@ export interface IView {
24
50
  *
25
51
  * @param entries details about the resize event
26
52
  */
27
- export declare type ResizeEventListener = (entries: ResizeObserverEntry) => void;
53
+ export declare type ResizeEventListener = Listener<IView, {
54
+ entires: ResizeObserverEntry;
55
+ }, Record<string, unknown>, void>;
28
56
  /**
29
57
  * parent window breakpoint change event handler
30
58
  *
31
59
  * @param breakpoint current breakpoint of the parent window
32
60
  */
33
- export declare type BreakpointChangeEventListener = (breakpoint: BreakPoint) => void;
34
- export declare type ViewEvents = {
35
- /**
36
- * eent is fired when the parent window is resized
37
- */
38
- 'view.resize': ResizeEventListener;
39
- /**
40
- * event is fired when the parent window's breakpoint changes
41
- */
42
- 'view.breakpointChange': BreakpointChangeEventListener;
43
- };
61
+ export declare type BreakpointChangeEventListener = Listener<IView, {
62
+ breakpoint: BreakPoint;
63
+ }, Record<string, unknown>, void>;
@@ -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.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "Typescript defintions for Scripting Objects",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/cjs/index.js",
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.5.0",
70
- "@elliemae/pui-cli": "~7.12.2",
70
+ "@elliemae/pui-cli": "~7.14.1",
71
71
  "@elliemae/pui-doc-gen": "~1.3.0",
72
72
  "@elliemae/pui-theme": "~2.6.0",
73
73
  "@types/styled-components": "~5.1.26",
@@ -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
- }