@elliemae/pui-scripting-object 1.50.2 → 1.51.1

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.
@@ -22,7 +22,8 @@ __export(application_exports, {
22
22
  ModalSize: () => ModalSize,
23
23
  ModalType: () => ModalType,
24
24
  OpenMode: () => OpenMode,
25
- OpenType: () => OpenType
25
+ OpenType: () => OpenType,
26
+ ToastType: () => ToastType
26
27
  });
27
28
  module.exports = __toCommonJS(application_exports);
28
29
  var OpenType = /* @__PURE__ */ ((OpenType2) => {
@@ -57,3 +58,10 @@ var ModalType = /* @__PURE__ */ ((ModalType2) => {
57
58
  ModalType2["INFO"] = "INFO";
58
59
  return ModalType2;
59
60
  })(ModalType || {});
61
+ var ToastType = /* @__PURE__ */ ((ToastType2) => {
62
+ ToastType2["SUCCESS"] = "success";
63
+ ToastType2["ERROR"] = "error";
64
+ ToastType2["WARNING"] = "warning";
65
+ ToastType2["INFO"] = "info";
66
+ return ToastType2;
67
+ })(ToastType || {});
@@ -30,10 +30,18 @@ var ModalType = /* @__PURE__ */ ((ModalType2) => {
30
30
  ModalType2["INFO"] = "INFO";
31
31
  return ModalType2;
32
32
  })(ModalType || {});
33
+ var ToastType = /* @__PURE__ */ ((ToastType2) => {
34
+ ToastType2["SUCCESS"] = "success";
35
+ ToastType2["ERROR"] = "error";
36
+ ToastType2["WARNING"] = "warning";
37
+ ToastType2["INFO"] = "info";
38
+ return ToastType2;
39
+ })(ToastType || {});
33
40
  export {
34
41
  FormType,
35
42
  ModalSize,
36
43
  ModalType,
37
44
  OpenMode,
38
- OpenType
45
+ OpenType,
46
+ ToastType
39
47
  };
@@ -133,24 +133,23 @@ export declare enum ModalSize {
133
133
  EXTRA_LARGE = "xl"
134
134
  }
135
135
  /**
136
- * additional options for warning / success / error / info modal
136
+ * content for warning / success / error / info modal types
137
137
  */
138
- export type ModalData = {
138
+ export type ModalContent = {
139
139
  /**
140
- * title of the dialog
140
+ * title of the modal
141
141
  */
142
142
  title: string;
143
143
  /**
144
- * message to be displayed in the body of the dialog
144
+ * message to be displayed in the body of the modal
145
145
  */
146
146
  body: string;
147
147
  /**
148
148
  * list of actions that are avilable to user for providing feedback.
149
149
  *
150
- * these actions are displayed as buttons in the dialog
151
- *
152
- * default action is 'ok'
153
- * @example ['retry', 'cancel']
150
+ * these actions are displayed as buttons in the modal
151
+ * @example ['ok', 'cancel']
152
+ * @default ['ok']
154
153
  */
155
154
  actions?: string[];
156
155
  /**
@@ -168,6 +167,7 @@ export type ModalData = {
168
167
  };
169
168
  /**
170
169
  * type of the form
170
+ * @enum
171
171
  */
172
172
  export declare enum FormType {
173
173
  /**
@@ -181,6 +181,7 @@ export declare enum FormType {
181
181
  }
182
182
  /**
183
183
  * type of the modal
184
+ * @enum
184
185
  */
185
186
  export declare enum ModalType {
186
187
  /**
@@ -223,33 +224,78 @@ export type ModalOptions = {
223
224
  /**
224
225
  * target item
225
226
  *
226
- * optional for warning / success / error / info modal
227
+ * optional for warning / success / error / info modal type
227
228
  */
228
229
  target?: string;
229
230
  /**
230
231
  * name of the form or tool
231
232
  *
232
- * optional for warning / success / error / info modal
233
+ * optional for warning / success / error / info modal type
233
234
  */
234
- name: string;
235
+ name?: string;
235
236
  /**
237
+ * {@link ModalType}
238
+ *
236
239
  * type of the modal
237
240
  */
238
241
  type: ModalType;
239
242
  /**
243
+ * {@link ModalSize}
244
+ *
240
245
  * size of the modal
241
246
  * @default ModalSize.EXTRA_LARGE
242
247
  */
243
248
  size?: ModalSize;
244
249
  /**
250
+ * {@link FormType}
251
+ *
245
252
  * form type
246
253
  */
247
254
  formType?: FormType;
248
255
  /**
249
- * additional data to display warning / success / error / info modal
256
+ * {@link ModalContent}
250
257
  *
258
+ * content to display in warning / success / error / info modal types
251
259
  */
252
- data?: ModalData;
260
+ data?: ModalContent;
261
+ };
262
+ /**
263
+ * toast message type
264
+ * @enum
265
+ */
266
+ export declare enum ToastType {
267
+ /**
268
+ * success message
269
+ */
270
+ SUCCESS = "success",
271
+ /**
272
+ * error message
273
+ */
274
+ ERROR = "error",
275
+ /**
276
+ * warning message
277
+ */
278
+ WARNING = "warning",
279
+ /**
280
+ * info message
281
+ */
282
+ INFO = "info"
283
+ }
284
+ /**
285
+ * options for toast message
286
+ */
287
+ export type ToastOptions = {
288
+ /**
289
+ * title of the toast message
290
+ */
291
+ message: string;
292
+ /**
293
+ * {@link ToastType}
294
+ *
295
+ * type of the toast message
296
+ * @default ToastType.INFO
297
+ */
298
+ type: ToastType;
253
299
  };
254
300
  /**
255
301
  * capabilities exposed by the application
@@ -264,6 +310,9 @@ export type Capabilities = {
264
310
  */
265
311
  supportedFeatures: Array<string>;
266
312
  };
313
+ /**
314
+ * navigation type
315
+ */
267
316
  export type Route = {
268
317
  /**
269
318
  * url of the route
@@ -513,7 +562,23 @@ export interface IApplication extends IScriptingObject {
513
562
  /**
514
563
  * open a modal
515
564
  * @param options modal properties
516
- * @returns user selected modal action as string
565
+ * @returns action selected by the user
566
+ * @example
567
+ * ```typescript
568
+ * const result = await application.openModal({
569
+ * type: ModalType.WARNING,
570
+ * data: {
571
+ * title: 'Warning',
572
+ * body: 'This operation is final and cannot be reversed. Do you want to proceed?',
573
+ * actions: ['Ok', 'Cancel']
574
+ * }
575
+ * });
576
+ * if (result === 'Ok') {
577
+ * // user clicked Ok
578
+ * } else {
579
+ * // user clicked Cancel
580
+ * }
581
+ * ```
517
582
  */
518
583
  openModal(options: ModalOptions): Promise<string>;
519
584
  /**
@@ -527,6 +592,18 @@ export interface IApplication extends IScriptingObject {
527
592
  * @param options Print options
528
593
  */
529
594
  print(options: PrintOptions): Promise<void>;
595
+ /**
596
+ * show toast message
597
+ * @param options toast options
598
+ * @example
599
+ * ```typescript
600
+ * await application.showToast({
601
+ * message: 'Hello World',
602
+ * type: ToastType.INFO
603
+ * });
604
+ * ```
605
+ */
606
+ showToast(options: ToastOptions): Promise<void>;
530
607
  /**
531
608
  * get supportability of an action
532
609
  * @param name action name