@elliemae/pui-scripting-object 1.8.0 → 1.10.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 (67) hide show
  1. package/dist/cjs/events.js +16 -0
  2. package/dist/cjs/index.js +17 -15
  3. package/dist/cjs/{analytics.js → objects/analytics.js} +0 -0
  4. package/dist/cjs/{application.js → objects/application.js} +0 -0
  5. package/dist/cjs/{auth.js → objects/auth.js} +0 -0
  6. package/dist/cjs/{form.js → objects/form.js} +0 -0
  7. package/dist/cjs/{global.js → objects/global.js} +0 -0
  8. package/dist/cjs/{http.js → objects/http.js} +0 -0
  9. package/dist/cjs/{loan.js → objects/loan.js} +0 -0
  10. package/dist/cjs/{loanv2.js → objects/loanv2.js} +0 -0
  11. package/dist/cjs/objects/memStorage.js +16 -0
  12. package/dist/cjs/{module.js → objects/module.js} +0 -0
  13. package/dist/cjs/{route.js → objects/route.js} +0 -0
  14. package/dist/cjs/objects/service.js +20 -0
  15. package/dist/cjs/{session.js → objects/session.js} +0 -0
  16. package/dist/cjs/{transaction.js → objects/transaction.js} +12 -0
  17. package/dist/cjs/objects/transactionTemplate.js +16 -0
  18. package/dist/cjs/{userAccessRights.js → objects/userAccessRights.js} +0 -0
  19. package/dist/cjs/{view.js → objects/view.js} +0 -0
  20. package/dist/esm/{analytics.js → events.js} +0 -0
  21. package/dist/esm/index.js +17 -15
  22. package/dist/esm/{form.js → objects/analytics.js} +0 -0
  23. package/dist/esm/{application.js → objects/application.js} +0 -0
  24. package/dist/esm/{auth.js → objects/auth.js} +0 -0
  25. package/dist/esm/{global.js → objects/form.js} +0 -0
  26. package/dist/esm/{http.js → objects/global.js} +0 -0
  27. package/dist/esm/{route.js → objects/http.js} +0 -0
  28. package/dist/esm/{loan.js → objects/loan.js} +0 -0
  29. package/dist/esm/{loanv2.js → objects/loanv2.js} +0 -0
  30. package/dist/esm/{session.js → objects/memStorage.js} +0 -0
  31. package/dist/esm/{module.js → objects/module.js} +0 -0
  32. package/dist/esm/{transaction.js → objects/route.js} +0 -0
  33. package/dist/esm/objects/service.js +4 -0
  34. package/dist/esm/{transactiontemplate.js → objects/session.js} +0 -0
  35. package/dist/esm/objects/transaction.js +8 -0
  36. package/dist/esm/{userAccessRights.js → objects/transactionTemplate.js} +0 -0
  37. package/dist/esm/{view.js → objects/userAccessRights.js} +0 -0
  38. package/dist/esm/objects/view.js +0 -0
  39. package/dist/types/events.d.ts +7 -0
  40. package/dist/types/index.d.ts +18 -15
  41. package/dist/types/{analytics.d.ts → objects/analytics.d.ts} +6 -0
  42. package/dist/types/{application.d.ts → objects/application.d.ts} +92 -2
  43. package/dist/types/objects/auth.d.ts +105 -0
  44. package/dist/types/objects/form.d.ts +47 -0
  45. package/dist/types/objects/global.d.ts +47 -0
  46. package/dist/types/objects/http.d.ts +52 -0
  47. package/dist/types/{loan.d.ts → objects/loan.d.ts} +75 -11
  48. package/dist/types/{loanv2.d.ts → objects/loanv2.d.ts} +33 -0
  49. package/dist/types/objects/memStorage.d.ts +26 -0
  50. package/dist/types/objects/module.d.ts +55 -0
  51. package/dist/types/{route.d.ts → objects/route.d.ts} +1 -1
  52. package/dist/types/objects/service.d.ts +58 -0
  53. package/dist/types/{session.d.ts → objects/session.d.ts} +1 -1
  54. package/dist/types/objects/transaction.d.ts +295 -0
  55. package/dist/types/objects/transactionTemplate.d.ts +76 -0
  56. package/dist/types/{userAccessRights.d.ts → objects/userAccessRights.d.ts} +3 -0
  57. package/dist/types/{view.d.ts → objects/view.d.ts} +20 -18
  58. package/dist/types/scriptingObjectTypes.d.ts +22 -12
  59. package/package.json +2 -2
  60. package/dist/cjs/transactiontemplate.js +0 -16
  61. package/dist/types/auth.d.ts +0 -43
  62. package/dist/types/form.d.ts +0 -10
  63. package/dist/types/global.d.ts +0 -5
  64. package/dist/types/http.d.ts +0 -7
  65. package/dist/types/module.d.ts +0 -16
  66. package/dist/types/transaction.d.ts +0 -53
  67. package/dist/types/transactiontemplate.d.ts +0 -12
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Provides methods to make call-outs to to external systems via HTTPS.
3
+ * By exposing this object from the host, it ensures that the call will bear the "Origin" header of the host application.
4
+ * 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
+ export interface IHttp {
7
+ /**
8
+ * get http request
9
+ *
10
+ * @param url url to make the call to
11
+ * @param headersOrAccessToken http headers object or access token to be used for the call
12
+ * @returns http response object
13
+ * @throws error if the http call fails with non 2xx status code
14
+ */
15
+ get(url: string, headersOrAccessToken?: HeadersInit | string): Promise<Response>;
16
+ /**
17
+ * post http request
18
+ *
19
+ * @param url url to make the call to
20
+ * @param headersOrAccessToken http headers object or access token to be used for the call
21
+ * @returns http response object
22
+ * @throws error if the http call fails with non 2xx status code
23
+ */
24
+ post(url: string, content: string | Record<string, string>, headersOrAccessToken?: HeadersInit | string): Promise<Response>;
25
+ /**
26
+ * patch http request
27
+ *
28
+ * @param url url to make the call to
29
+ * @param headersOrAccessToken http headers object or access token to be used for the call
30
+ * @returns http response object
31
+ * @throws error if the http call fails with non 2xx status code
32
+ */
33
+ patch(url: string, content: string | Record<string, string>, headersOrAccessToken?: HeadersInit | string): Promise<Response>;
34
+ /**
35
+ * put http request
36
+ *
37
+ * @param url url to make the call to
38
+ * @param headersOrAccessToken http headers object or access token to be used for the call
39
+ * @returns http response object
40
+ * @throws error if the http call fails with non 2xx status code
41
+ */
42
+ put(url: string, content: string | Record<string, string>, headersOrAccessToken?: HeadersInit | string): Promise<Response>;
43
+ /**
44
+ * delete http request
45
+ *
46
+ * @param url url to make the call to
47
+ * @param headersOrAccessToken http headers object or access token to be used for the call
48
+ * @returns http response object
49
+ * @throws error if the http call fails with non 2xx status code
50
+ */
51
+ delete(url: string, headersOrAccessToken?: HeadersInit | string): Promise<Response>;
52
+ }
@@ -11,6 +11,9 @@ export declare type FieldOptions = {
11
11
  */
12
12
  value: string;
13
13
  };
14
+ /**
15
+ * v3 loan object
16
+ */
14
17
  export declare type LoanObject = Record<string, any>;
15
18
  export declare enum LoanLevelActions {
16
19
  UPDATE_CORRESPONDENT_BALANCE = "updateCorrespondentBalance",
@@ -19,11 +22,11 @@ export declare enum LoanLevelActions {
19
22
  CALCULATE_EEM_MORTGAGE = "calculateEEMMortgage"
20
23
  }
21
24
  /**
22
- * The Loan object provides methods for interacting with an open loan in the application's editor screen(s).
25
+ * Methods for interacting with an open loan in the application
23
26
  */
24
27
  export interface ILoan {
25
28
  /**
26
- * Get entire Loan object
29
+ * Get complete Loan object
27
30
  *
28
31
  * @returns v3 Loan Object
29
32
  *
@@ -46,6 +49,12 @@ export interface ILoan {
46
49
  * | all | ✔ | ✔ | ✔ | ✖️ |
47
50
  */
48
51
  commit(): Promise<void>;
52
+ /**
53
+ * get value of the given field id
54
+ *
55
+ * @param id field id
56
+ * @returns field value
57
+ */
49
58
  getField(id: string): Promise<string>;
50
59
  /**
51
60
  * get options for list of fields
@@ -135,38 +144,93 @@ export interface ILoan {
135
144
  getLockSnapshot(): Promise<Record<string, string>>;
136
145
  }
137
146
  /**
138
- * This event is fired prior to saving and pending changes to the loan. The guest can use this event to perform custom validation and, via the feedback mechanism, prevent the loan from being saved
147
+ * event handler for loan precommit event
148
+ *
149
+ * @param cause cause of precommit event
150
+ * @returns true if precommit is allowed, false otherwise
139
151
  */
140
152
  export declare type LoanPreCommitListener = (cause: string) => boolean;
141
153
  /**
142
- * This event is fired after pending changes to the loan are committed
154
+ * event handler for loan commited event
155
+ *
156
+ * @param cause cause of commit event
143
157
  */
144
158
  export declare type LoanCommittedListener = (cause: string) => void;
145
159
  /**
146
- * This event is fired for each change made by the user in the UI
160
+ * event handler for loan data change event
147
161
  */
148
162
  export declare type LoanChangeListener = () => void;
149
163
  /**
150
- * This event is fired after the loan is sync'ed within any saved state made outside of the user's workspace. This event should fire after any call to calculate() or merge(), assuming any changes are made to the loan
164
+ * event handler for loan sync event
151
165
  */
152
166
  export declare type LoanSyncListener = () => void;
153
167
  /**
154
- * Fired after the loan is opened and ready for user interaction
168
+ * event handler for loan open event
155
169
  */
156
170
  export declare type LoanOpenListener = () => void;
157
171
  /**
158
- * Fired just prior to closing the loan in the UI
172
+ * event handler for loan close event
173
+ *
174
+ * @returns true if loan close is allowed, false otherwise
159
175
  */
160
176
  export declare type LoanCloseListener = () => boolean;
161
177
  /**
162
- * This event is fired after a milestone is completed by the user and committed to the server
178
+ * event handler for loan milestone completed event
179
+ *
180
+ * @param name milestone name
163
181
  */
164
182
  export declare type LoanMilestoneCompletedListener = (name: string) => void;
165
183
  /**
166
- * This event is fired when the user attempts to complete a milestone and allows for custom validation, and cancellation, of the process
184
+ * event handler for loan pre milestone complete event
185
+ *
186
+ * @returns true if milestone complete is allowed, false otherwise
167
187
  */
168
188
  export declare type LoanPreMilestoneCompleteListener = (name: string) => boolean;
169
189
  /**
170
- * This event is fired when a borrower pair changes
190
+ * event handler for loan application selected event
171
191
  */
172
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,4 +1,7 @@
1
1
  import { ILoan, LoanObject } from './loan.js';
2
+ /**
3
+ * Types of field errors
4
+ */
2
5
  export declare enum FieldErrorType {
3
6
  /**
4
7
  * access related violations
@@ -23,20 +26,47 @@ export declare enum FieldErrorType {
23
26
  */
24
27
  CONFLICT = "conflict"
25
28
  }
29
+ /**
30
+ * Field error object
31
+ */
26
32
  export declare type FieldErrors = {
33
+ /**
34
+ * field id
35
+ */
27
36
  id: string;
37
+ /**
38
+ * field error type
39
+ */
28
40
  type: FieldErrorType;
41
+ /**
42
+ * error description
43
+ */
29
44
  description: string;
30
45
  };
46
+ /**
47
+ * Return type of setField method
48
+ */
31
49
  export declare type SetFieldResponse = {
32
50
  /**
33
51
  * List of fields not meeting data, access or required rule criteria
34
52
  */
35
53
  errors: FieldErrors[];
36
54
  };
55
+ /**
56
+ * Types of commit errors
57
+ */
37
58
  export declare enum CommitErrorStatus {
59
+ /**
60
+ * Commit failed due to fields
61
+ */
38
62
  FIELDERROR = "field_error",
63
+ /**
64
+ * Commit failed due to invalid lock or read only loan status
65
+ */
39
66
  LOCK_INVALID_OR_REMOVED = "lock_invalid_or_removed",
67
+ /**
68
+ * Commit failed due to invalid workspace state
69
+ */
40
70
  WORKSPACE_READ_ONLY = "workspace_read_only"
41
71
  }
42
72
  /**
@@ -54,6 +84,9 @@ export declare type CommitError = Error & {
54
84
  fieldErrors: FieldErrors[];
55
85
  };
56
86
  };
87
+ /**
88
+ * Map of field ids to their loan contract path
89
+ */
57
90
  export declare type FieldIDToContractPath = {
58
91
  fieldId: string;
59
92
  contractPath: string;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * get or set values in host application javascript memory
3
+ * values stored in memory are not persisted across sessions
4
+ *
5
+ * Host application implemeting this scripting object ensures,
6
+ * there are no collisions with keys from other microapp guest applications
7
+ * that means, two microapps can use same key to store different values. Thier values will not collide.
8
+ *
9
+ */
10
+ export interface IMemStorage {
11
+ /**
12
+ * set a value in memory for given key
13
+ *
14
+ * @param clientId unique identifier assigned to the microapp
15
+ * @param key unique key to store the value
16
+ * @param value value to be stored. value should be JSON serializable
17
+ */
18
+ set(clientId: string, key: string, value: any): Promise<void>;
19
+ /**
20
+ * get a value from memory for given key and microapp id
21
+ *
22
+ * @param key unique key to retrieve the value
23
+ * @returns value stored in memory
24
+ */
25
+ get(clientId: string, key: string): Promise<any>;
26
+ }
@@ -0,0 +1,55 @@
1
+ export declare enum LogLevel {
2
+ TRACE = "TRACE",
3
+ DEBUG = "DEBUG",
4
+ INFO = "INFO",
5
+ AUDIT = "AUDIT",
6
+ WARN = "WARN",
7
+ ERROR = "ERROR",
8
+ FATAL = "FATAL"
9
+ }
10
+ /**
11
+ * Methods to bootstraps feature modules
12
+ */
13
+ export interface IModule {
14
+ /**
15
+ * get module-specific JavaScript object that can be used to communicate additional capabilities to the module
16
+ *
17
+ * @returns key-value pairs of module-specific JavaScript objects
18
+ */
19
+ getCapabilities(): Promise<Record<string, string>>;
20
+ /**
21
+ * Get startup parameters for the module
22
+ *
23
+ * @returns startup parameters as key-value pairs
24
+ */
25
+ getParameters(): Promise<Record<string, string>>;
26
+ /**
27
+ * unload the module from the host application
28
+ */
29
+ unload(): Promise<void>;
30
+ /**
31
+ * log a message to host application's logs
32
+ *
33
+ * @param message message to log
34
+ * @param logLevel level of the log message
35
+ */
36
+ log(message: string, logLevel: LogLevel): Promise<void>;
37
+ }
38
+ /**
39
+ * event handler that handles module unload event
40
+ *
41
+ * @param id unique id of the module that is being unloaded
42
+ * @returns true if the module can be unloaded, false otherwise
43
+ */
44
+ export declare type ModuleUnLoadingListener = (id: string) => boolean;
45
+ /**
46
+ * events that notifies the module's lifecycle
47
+ */
48
+ export declare type ModuleEvents = {
49
+ /**
50
+ * event fired when the module is unloading
51
+ *
52
+ * @returns true if the module can be unloaded, false otherwise
53
+ */
54
+ 'module.unloading': ModuleUnLoadingListener;
55
+ };
@@ -1,6 +1,6 @@
1
1
  import { To } from 'history';
2
2
  /**
3
- * Methods and events to view, modify & get notified about parent window url navigation
3
+ * Methods to view, modify & get notified about parent window url navigation
4
4
  */
5
5
  export interface IRoute {
6
6
  navigate(path: To, state?: any): Promise<void>;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * type of service setup categories
3
+ */
4
+ declare enum ServiceSetupCategory {
5
+ APPRAISAL = "Appraisal"
6
+ }
7
+ /**
8
+ * details of a service setup
9
+ */
10
+ declare type ServiceSetup = {
11
+ /**
12
+ * service setup id
13
+ */
14
+ serviceSetupId: string;
15
+ /**
16
+ * unique provider id
17
+ */
18
+ providerId: string;
19
+ /**
20
+ * product listing name
21
+ */
22
+ productListingName: string;
23
+ /**
24
+ * service setup category
25
+ */
26
+ category: ServiceSetupCategory;
27
+ };
28
+ /**
29
+ * options to open the service order integration
30
+ */
31
+ declare type OpenOptions = {
32
+ /**
33
+ * context of the application that is opening the service order integration
34
+ */
35
+ target: string;
36
+ };
37
+ /**
38
+ * Methods for interacting with the Service orders
39
+ */
40
+ export interface IService {
41
+ /**
42
+ * Get the service setup for the current user and loan
43
+ *
44
+ * @param category - The category of the service setup
45
+ * @param providerId - The provider id of the service setup
46
+ * @returns list of service setups matching the input criteria. Empty list if no service setups are found
47
+ */
48
+ getEligibleServices: (category: ServiceSetupCategory, providerId?: string) => Promise<Array<ServiceSetup>>;
49
+ /**
50
+ * open service intergration to place an order
51
+ *
52
+ * @param serviceSetupId - id of the service setup
53
+ * @param options - options for opening the service integration
54
+ * @throws Error if the service setup is not found or user is not authorized to open the integration
55
+ */
56
+ open: (serviceSetupId: string, options: OpenOptions) => Promise<void>;
57
+ }
58
+ export {};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Methods and events to view, modify & get notified about parent window session storage
2
+ * store and retrieves values in host application's session storage
3
3
  */
4
4
  export interface ISession {
5
5
  /**