@kissflow/lowcode-client-sdk 1.0.44 → 1.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nocode.d.ts CHANGED
@@ -5,6 +5,9 @@ declare module "core/constants" {
5
5
  RETURN: string;
6
6
  GET_FORM_FIELD: string;
7
7
  UPDATE_FORM: string;
8
+ GET_FORM_VALIDATION_ERRORS: string;
9
+ GET_FORM_CONFIGURATION: string;
10
+ GET_FORM_FIELD_STATE: string;
8
11
  GET_TABLE: string;
9
12
  GET_TABLE_ROW: string;
10
13
  ADD_TABLE_ROW: string;
@@ -19,6 +22,13 @@ declare module "core/constants" {
19
22
  REDIRECT: string;
20
23
  OPEN_PAGE: string;
21
24
  GET_IMAGE_URL: string;
25
+ FILEPICKER_OPEN: string;
26
+ FILEPREVIEW_OPEN: string;
27
+ FILE_UPLOAD: string;
28
+ SCANNER_OPEN: string;
29
+ GEOLOCATION_OPEN: string;
30
+ GET_ROLES: string;
31
+ SWITCH_ROLE: string;
22
32
  FORMAT_DATE: string;
23
33
  FORMAT_DATE_TIME: string;
24
34
  FORMAT_NUMBER: string;
@@ -42,12 +52,19 @@ declare module "core/constants" {
42
52
  COMPONENT_ADD_EVENT_LISTENER: string;
43
53
  CC_INITIALIZE: string;
44
54
  CC_WATCH_PARAMS: string;
55
+ CC_SET_ROUTE: string;
56
+ CC_WATCH_ROUTE: string;
45
57
  WINDOW_NDEF_READER_NEW: string;
46
58
  WINDOW_NDEF_READER_SCAN: string;
47
59
  WINDOW_NDEF_READER_WRITE: string;
48
60
  WINDOW_NDEF_READER_ADD_EVENT_LISTENER: string;
49
61
  WINDOW_NDEF_READER_MAKE_READONLY: string;
50
62
  WINDOW_NDEF_READER_ABORT_SCAN: string;
63
+ CUSTOM_AGENT_GET_CONTRACT: string;
64
+ CUSTOM_AGENT_EXECUTE: string;
65
+ CUSTOM_AGENT_GET_EXECUTION: string;
66
+ CUSTOM_AGENT_WATCH_EXECUTION: string;
67
+ CUSTOM_AGENT_STOP_WATCH: string;
51
68
  DECISION_TABLE_EXECUTE: string;
52
69
  DATAFORM_IMPORT_CSV: string;
53
70
  DATAFORM_OPEN_FORM: string;
@@ -59,6 +76,8 @@ declare module "core/constants" {
59
76
  DATAFORM_DELETE_ITEM: string;
60
77
  DATAFORM_DISCARD_ITEM: string;
61
78
  DATAFORM_SUBMIT_ITEM: string;
79
+ DATAFORM_INIT_FORM: string;
80
+ DATAFORM_GET_FIELD_OPTIONS: string;
62
81
  PROCESS_OPEN_FORM: string;
63
82
  PROCESS_GET_FIELDS: string;
64
83
  PROCESS_GET_MYTASK_FIELDS: string;
@@ -72,6 +91,8 @@ declare module "core/constants" {
72
91
  PROCESS_UPDATE_ITEM: string;
73
92
  PROCESS_GET_ITEM: string;
74
93
  PROCESS_DELETE_ITEM: string;
94
+ PROCESS_GET_ADMIN_ITEM: string;
95
+ PROCESS_UPDATE_ADMIN_ITEM: string;
75
96
  PROCESS_SUBMIT_ITEM: string;
76
97
  PROCESS_REJECT_ITEM: string;
77
98
  PROCESS_WITHDRAW_ITEM: string;
@@ -81,6 +102,9 @@ declare module "core/constants" {
81
102
  PROCESS_RESTART_ITEM: string;
82
103
  PROCESS_DISCARD_ITEM: string;
83
104
  PROCESS_GET_PROGRESS: string;
105
+ PROCESS_INIT_FORM: string;
106
+ PROCESS_GET_FIELD_OPTIONS: string;
107
+ PROCESS_PARSE_ATTACHMENT: string;
84
108
  BOARD_IMPORT_CSV: string;
85
109
  BOARD_OPEN_FORM: string;
86
110
  BOARD_GET_FIELDS: string;
@@ -91,10 +115,14 @@ declare module "core/constants" {
91
115
  BOARD_DELETE_ITEM: string;
92
116
  BOARD_SUBMIT_ITEM: string;
93
117
  BOARD_DISCARD_ITEM: string;
118
+ BOARD_INIT_FORM: string;
119
+ BOARD_GET_FIELD_OPTIONS: string;
94
120
  };
95
121
  export const EVENT_TYPES: {
96
122
  COMPONENT_ON_MOUNT: string;
97
123
  CC_ON_PARAMS_CHANGE: string;
124
+ CC_ON_ROUTE_CHANGE: string;
125
+ CUSTOM_AGENT_EXECUTION_COMPLETE: string;
98
126
  };
99
127
  export const DEFAULTS: {
100
128
  POPUP_ID: string;
@@ -113,6 +141,21 @@ declare module "core/index" {
113
141
  }
114
142
  export class BaseSDK extends EventBase {
115
143
  _postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
144
+ /**
145
+ * Like _postMessageAsync, but settles with `timeoutError` when the host does not reply within
146
+ * `timeoutMs` (a host that does not know the command fails loudly instead of hanging), with
147
+ * `sendError` when the message cannot be posted, and can be cancelled. Every path releases the
148
+ * timer and the reply registration; a reply that arrives afterwards finds no entry and is ignored.
149
+ * `cancel()` leaves the promise unsettled: the caller that cancels has stopped waiting for it.
150
+ */
151
+ _postMessageBounded(command: string, args: object, options: {
152
+ timeoutMs: number;
153
+ timeoutError: object;
154
+ sendError: object;
155
+ }): {
156
+ promise: Promise<any>;
157
+ cancel: () => void;
158
+ };
116
159
  _postMessage(command: string, args: any, callBack?: any): void;
117
160
  _postMessageSync(command: string, args: any): any;
118
161
  }
@@ -121,18 +164,27 @@ declare module "core/index" {
121
164
  declare module "form/index" {
122
165
  import { BaseSDK } from "core/index";
123
166
  export class Form extends BaseSDK {
124
- private instanceId;
167
+ private storeId;
168
+ private flowId;
125
169
  type: string;
126
- constructor(instanceId: string);
170
+ instanceId: string;
171
+ activityInstanceId?: string;
172
+ constructor(storeId: string, flowId: string, instanceId: string, activityInstanceId?: string);
127
173
  toJSON(): any;
128
174
  getField(fieldId: string): any;
129
175
  updateField(args: object): any;
176
+ getValidationErrors(): any;
177
+ getFormConfiguration(): any;
178
+ getFieldState(): any;
130
179
  getTable(tableId: string): Table;
131
180
  }
132
181
  class Table extends BaseSDK {
133
- private tableId;
182
+ private storeId;
183
+ private flowId;
134
184
  private instanceId;
135
- constructor(instanceId: string, tableId: string);
185
+ private tableId;
186
+ private activityInstanceId?;
187
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string);
136
188
  toJSON(): any;
137
189
  getSelectedRows(): any;
138
190
  getRows(): TableForm[];
@@ -143,141 +195,20 @@ declare module "form/index" {
143
195
  deleteRows(rows: string[]): any;
144
196
  }
145
197
  export class TableForm extends BaseSDK {
198
+ private storeId;
199
+ private flowId;
146
200
  private instanceId;
147
201
  private tableId;
148
202
  private rowId;
203
+ private activityInstanceId?;
149
204
  type: string;
150
- constructor(instanceId: string, tableId: string, rowId: string);
205
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
151
206
  getParent(): Form;
152
207
  toJSON(): any;
153
208
  getField(fieldId: string): any;
154
209
  updateField(args: object): any;
155
210
  }
156
211
  }
157
- declare module "utils/client" {
158
- import { BaseSDK } from "core/index";
159
- export class Client extends BaseSDK {
160
- /**
161
- * Display an info message toast in the platform.
162
- *
163
- * @param message - The message to display. Accepts a string or object (serialized to JSON).
164
- * @returns A promise that resolves when the message is shown.
165
- *
166
- * @example
167
- * await kf.client.showInfo("Record saved successfully");
168
- */
169
- showInfo(message: string | object): any;
170
- /**
171
- * Display a confirmation dialog and wait for the user's response.
172
- *
173
- * @param args - Dialog configuration.
174
- * @param args.title - Dialog title.
175
- * @param args.content - Body text of the dialog.
176
- * @param args.okText - Label for the confirm button (default: "Ok").
177
- * @param args.cancelText - Label for the cancel button (default: "Cancel").
178
- * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
179
- *
180
- * @example
181
- * const { action } = await kf.client.showConfirm({
182
- * title: "Delete record?",
183
- * content: "This cannot be undone.",
184
- * okText: "Delete",
185
- * cancelText: "Cancel",
186
- * });
187
- * if (action === "OK") { ... }
188
- */
189
- showConfirm(args: {
190
- title: string;
191
- content: string;
192
- okText: string;
193
- cancelText: string;
194
- }): any;
195
- /**
196
- * Navigate the platform to the given URL.
197
- *
198
- * @param url - The URL to navigate to.
199
- *
200
- * @example
201
- * kf.client.redirect("https://example.com");
202
- */
203
- redirect(url: string): any;
204
- /**
205
- * Resolve a Kissflow image field value to a base64 data URL.
206
- *
207
- * Custom components (iframes) cannot load Kissflow-hosted images directly due to
208
- * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
209
- * image in the parent window (which has the required session cookies) and returns
210
- * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
211
- * without any CORS issues.
212
- *
213
- * @param imageValue - The image field value must contain a `key` property and
214
- * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
215
- * falls back to `key`.
216
- * @returns A promise that resolves with the base64 data URL string.
217
- *
218
- * @example
219
- * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
220
- * document.querySelector("#avatar").src = dataUrl;
221
- */
222
- getImageUrl(imageValue: Record<string, unknown>): any;
223
- }
224
- }
225
- declare module "utils/formatter" {
226
- import { BaseSDK } from "core/index";
227
- export class Formatter extends BaseSDK {
228
- toDate(date: string): any;
229
- toDateTime(date: string): any;
230
- toNumber(value: string): any;
231
- toCurrency(value: string, currencyCode: string): any;
232
- toBoolean(value: string): any;
233
- }
234
- }
235
- declare module "utils/validation" {
236
- /**
237
- * Validation utilities for SDK methods
238
- */
239
- /**
240
- * Throws error if value is falsy
241
- */
242
- export function requireField(value: any, fieldName: string): void;
243
- /**
244
- * Returns a rejected promise if value is falsy, null otherwise
245
- * Use for async validation in SDK methods
246
- */
247
- export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
248
- /**
249
- * Returns a rejected promise if any of the values are falsy
250
- * Use for validating multiple required fields
251
- */
252
- export function requireFieldsAsync(fields: Array<{
253
- value: any;
254
- name: string;
255
- }>): Promise<never> | null;
256
- }
257
- declare module "utils/index" {
258
- export * from "utils/client";
259
- export * from "utils/formatter";
260
- export * from "utils/validation";
261
- export const isObject: (value: any) => boolean;
262
- }
263
- declare module "window/NDEFReader" {
264
- import { BaseSDK } from "core/index";
265
- export class NDEFReader extends BaseSDK {
266
- id: string;
267
- constructor();
268
- scan(): Promise<unknown>;
269
- write(data: any): Promise<unknown>;
270
- addEventListener(eventName: string, cb: Function): void;
271
- makeReadOnly(): Promise<unknown>;
272
- abortScan(): Promise<unknown>;
273
- }
274
- }
275
- declare module "window/index" {
276
- import { NDEFReader } from "window/NDEFReader";
277
- export const window: {
278
- NDEFReader: typeof NDEFReader;
279
- };
280
- }
281
212
  declare module "types/external" {
282
213
  export type QueryResponse = {
283
214
  items: any[];
@@ -335,6 +266,17 @@ declare module "types/external" {
335
266
  _id: string;
336
267
  _activity_instance_id: string;
337
268
  };
269
+ export type GeolocationValue = {
270
+ Address?: string;
271
+ Latitude: string;
272
+ Longitude: string;
273
+ City?: string;
274
+ State?: string;
275
+ Country?: string;
276
+ ZipCode?: string;
277
+ Area?: string;
278
+ PlaceId?: string;
279
+ };
338
280
  export type ProcessMyItemsOptions = BaseQueryOptions & {
339
281
  status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
340
282
  payload?: ProcessPayloadOptions;
@@ -353,6 +295,7 @@ declare module "types/external" {
353
295
  export type ProcessQueryResponse = QueryResponse;
354
296
  export type ProcessGetItemOptions = {
355
297
  instanceId: string;
298
+ activityInstanceId: string;
356
299
  };
357
300
  export type ProcessCreateItemOptions = {
358
301
  data?: object;
@@ -365,6 +308,13 @@ declare module "types/external" {
365
308
  export type ProcessDeleteItemOptions = {
366
309
  instanceId: string;
367
310
  };
311
+ export type ProcessGetAdminItemOptions = {
312
+ instanceId: string;
313
+ };
314
+ export type ProcessUpdateAdminItemOptions = {
315
+ instanceId: string;
316
+ data: object;
317
+ };
368
318
  export type ProcessSubmitItemOptions = {
369
319
  instanceId: string;
370
320
  activityInstanceId: string;
@@ -407,6 +357,32 @@ declare module "types/external" {
407
357
  export type ProcessDiscardItemOptions = {
408
358
  instanceId: string;
409
359
  };
360
+ export type ProcessFieldOptions = {
361
+ instanceId: string;
362
+ activityInstanceId: string;
363
+ fieldId: string;
364
+ /** Skip the server-side model lookup by supplying the field's type directly. */
365
+ fieldType?: string;
366
+ tableId?: string;
367
+ tableRowId?: string;
368
+ };
369
+ export type ProcessAttachmentFile = {
370
+ id: string;
371
+ name: string;
372
+ key: string;
373
+ size?: number;
374
+ fileExtension?: string;
375
+ };
376
+ export type ProcessParseAttachmentOptions = {
377
+ instanceId: string;
378
+ activityInstanceId: string;
379
+ fieldId: string;
380
+ file: ProcessAttachmentFile;
381
+ };
382
+ export type ProcessAttachmentParseResult = {
383
+ appliedFields: string[];
384
+ suggestedBy: string;
385
+ };
410
386
  export type FetchOptions = {
411
387
  method?: string;
412
388
  body?: string | object;
@@ -442,6 +418,14 @@ declare module "types/external" {
442
418
  data?: object;
443
419
  viewId?: string;
444
420
  };
421
+ export type DataformFieldOptions = {
422
+ instanceId: string;
423
+ fieldId: string;
424
+ /** Skip the server-side model lookup by supplying the field's type directly. */
425
+ fieldType?: string;
426
+ tableId?: string;
427
+ tableRowId?: string;
428
+ };
445
429
  export type BoardGetItemsOptions = BaseQueryOptions & {
446
430
  viewId?: string;
447
431
  payload?: PayloadOptions;
@@ -467,11 +451,117 @@ declare module "types/external" {
467
451
  export type BoardDiscardItemOptions = {
468
452
  instanceId: string;
469
453
  };
454
+ export type BoardFieldOptions = {
455
+ instanceId: string;
456
+ fieldId: string;
457
+ /** Skip the server-side model lookup by supplying the field's type directly. */
458
+ fieldType?: string;
459
+ tableId?: string;
460
+ tableRowId?: string;
461
+ };
462
+ export type AgentInputDataType = "Text" | "Number" | "Boolean" | "Attachment";
463
+ export type AgentOutputDataType = "string" | "number" | "boolean";
464
+ export type AgentInputField = {
465
+ Key: string;
466
+ Name: string;
467
+ DataType: AgentInputDataType;
468
+ Required: boolean;
469
+ Description?: string;
470
+ };
471
+ export type AgentOutputField = {
472
+ Key: string;
473
+ Name: string;
474
+ DataType: AgentOutputDataType;
475
+ Description?: string;
476
+ };
477
+ /**
478
+ * A file for an `Attachment` input: exactly one of `Key` (a Kissflow attachment) or `Url` (https).
479
+ * A file from `openFilePicker` or `uploadFile` has lowercase keys: pass
480
+ * `{ Key: file.key, FileName: file.name, Size: file.size }`.
481
+ */
482
+ export type AgentAttachmentValue = {
483
+ Key: string;
484
+ Url?: never;
485
+ FileName: string;
486
+ Size?: number;
487
+ ContentType?: string;
488
+ } | {
489
+ Url: string;
490
+ Key?: never;
491
+ FileName: string;
492
+ Size?: number;
493
+ ContentType?: string;
494
+ };
495
+ export type AgentInputValue = string | number | boolean | AgentAttachmentValue;
496
+ /** The Agent's published invocation contract. */
497
+ export type AgentContract = {
498
+ AgentId: string;
499
+ Definition: {
500
+ Name: string;
501
+ Description?: string;
502
+ Icon?: Record<string, unknown>;
503
+ Inputs: AgentInputField[];
504
+ Outputs: AgentOutputField[];
505
+ MaxOutputItems: number;
506
+ };
507
+ Readiness: {
508
+ Ready: boolean;
509
+ Issues: Array<{
510
+ Code: string;
511
+ Path: string;
512
+ Message: string;
513
+ }>;
514
+ };
515
+ };
516
+ export type AgentExecuteOptions = {
517
+ /** Values keyed by input `Key`, as declared in the contract. */
518
+ inputData: Record<string, AgentInputValue>;
519
+ };
520
+ /** More statuses may be added; treat any status other than `Completed` or `Failed` as still in progress. */
521
+ export type AgentExecutionStatus = "Queued" | "NotStarted" | "Running" | "Completed" | "Failed" | (string & {});
522
+ /** What `execute` resolves with once the run is accepted, before it has finished. */
523
+ export type AgentExecutionAccepted = {
524
+ ExecutionId: string;
525
+ Status: AgentExecutionStatus;
526
+ };
527
+ export type AgentExecution = {
528
+ ExecutionId: string;
529
+ Status: AgentExecutionStatus;
530
+ Stage?: string;
531
+ /** Present on `Completed`: one row per item, keyed by output `Key`. */
532
+ Output?: {
533
+ items: Array<Record<string, string | number | boolean>>;
534
+ };
535
+ /** Present on `Failed`. */
536
+ Error?: {
537
+ Code: string;
538
+ Retryable: boolean;
539
+ Details?: unknown;
540
+ };
541
+ Warnings?: Array<Record<string, unknown>>;
542
+ CreatedAt?: string;
543
+ StartedAt?: string;
544
+ CompletedAt?: string;
545
+ };
546
+ /**
547
+ * How an Agent call fails: `error` is the message text and `errorCode` either the platform code
548
+ * (`KISSFLOW_ERROR_…`) or an `AGENT_…` code, including `AGENT_HOST_TIMEOUT`, `AGENT_REQUEST_NOT_SENT`,
549
+ * `AGENT_EXECUTE_OUTCOME_UNKNOWN` (a run may have started), `AGENT_EXECUTE_NOT_SENT` (no run started),
550
+ * `AGENT_HOST_UNSUPPORTED`, `AGENT_WATCH_INVALID_EVENT`, `AGENT_OBSERVATION_STOPPED`, and from the host
551
+ * `AGENT_READ_TIMEOUT` and `AGENT_OFFLINE`. The list may grow; fall back to `error` for an unknown code.
552
+ * There is no `message`: read `error` for the text.
553
+ */
554
+ export type AgentError = {
555
+ isError: true;
556
+ error?: string;
557
+ errorCode?: string;
558
+ };
470
559
  }
471
560
  declare module "types/internal" {
472
561
  import { userObject, accountObject, environmentObject } from "types/external";
473
562
  export interface SDKContext {
474
563
  formInstanceId: string;
564
+ flowId: string;
475
565
  tableId: string;
476
566
  tableRowId: string;
477
567
  componentId: string;
@@ -499,10 +589,271 @@ declare module "types/internal" {
499
589
  }
500
590
  export interface PageContext {
501
591
  pageId: string;
592
+ initialRoute?: string;
502
593
  }
503
594
  export interface PopupContext {
504
595
  popupId?: string;
505
596
  }
597
+ export interface FilePickerOptions {
598
+ fileExtensions?: string[];
599
+ maxSize?: number;
600
+ maxCount?: number;
601
+ imageProps?: {
602
+ sizes?: Array<[number, number]>;
603
+ crop?: boolean;
604
+ };
605
+ }
606
+ export interface ScannerOptions {
607
+ /** Allow decoding from an uploaded image instead of the camera. */
608
+ localFileScan?: boolean;
609
+ }
610
+ /** Minimal shape of a browser File/Blob object, avoids requiring the DOM lib. */
611
+ export interface UploadableFile {
612
+ name: string;
613
+ size?: number;
614
+ type?: string;
615
+ }
616
+ }
617
+ declare module "utils/client" {
618
+ import { BaseSDK } from "core/index";
619
+ import { GeolocationValue } from "types/external";
620
+ import { FilePickerOptions, ScannerOptions, UploadableFile } from "types/internal";
621
+ export class Client extends BaseSDK {
622
+ /**
623
+ * Display an info message toast in the platform.
624
+ *
625
+ * @param message - The message to display. Accepts a string or object (serialized to JSON).
626
+ * @returns A promise that resolves when the message is shown.
627
+ *
628
+ * @example
629
+ * await kf.client.showInfo("Record saved successfully");
630
+ */
631
+ showInfo(message: string | object): any;
632
+ /**
633
+ * Display a confirmation dialog and wait for the user's response.
634
+ *
635
+ * @param args - Dialog configuration.
636
+ * @param args.title - Dialog title.
637
+ * @param args.content - Body text of the dialog.
638
+ * @param args.okText - Label for the confirm button (default: "Ok").
639
+ * @param args.cancelText - Label for the cancel button (default: "Cancel").
640
+ * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
641
+ *
642
+ * @example
643
+ * const { action } = await kf.client.showConfirm({
644
+ * title: "Delete record?",
645
+ * content: "This cannot be undone.",
646
+ * okText: "Delete",
647
+ * cancelText: "Cancel",
648
+ * });
649
+ * if (action === "OK") { ... }
650
+ */
651
+ showConfirm(args: {
652
+ title: string;
653
+ content: string;
654
+ okText: string;
655
+ cancelText: string;
656
+ }): any;
657
+ /**
658
+ * Navigate the platform to the given URL.
659
+ *
660
+ * @param url - The URL to navigate to.
661
+ *
662
+ * @example
663
+ * kf.client.redirect("https://example.com");
664
+ */
665
+ redirect(url: string): any;
666
+ /**
667
+ * Resolve a Kissflow image field value to a base64 data URL.
668
+ *
669
+ * Custom components (iframes) cannot load Kissflow-hosted images directly due to
670
+ * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
671
+ * image in the parent window (which has the required session cookies) and returns
672
+ * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
673
+ * without any CORS issues.
674
+ *
675
+ * @param imageValue - The image field value must contain a `key` property and
676
+ * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
677
+ * falls back to `key`.
678
+ * @returns A promise that resolves with the base64 data URL string.
679
+ *
680
+ * @example
681
+ * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
682
+ * document.querySelector("#avatar").src = dataUrl;
683
+ */
684
+ getImageUrl(imageValue: Record<string, unknown>): any;
685
+ /**
686
+ * Open the platform's file picker, upload the selected file(s), and resolve
687
+ * with their metadata.
688
+ *
689
+ * Custom components (iframes) cannot access the platform's authenticated upload
690
+ * endpoints directly. This method opens the file picker in the parent window
691
+ * (which has the required session), runs the full select → upload flow, and
692
+ * resolves once all uploads settle with an array of the uploaded files'
693
+ * metadata (each including `key`, `name`, `size`, `photos`, etc. — the same
694
+ * shape consumed by `getImageUrl`).
695
+ *
696
+ * Always resolves with an array — a single-element array for single-file
697
+ * pickers (e.g. `maxCount: 1` for `Image`), one entry per uploaded file for
698
+ * multi-file pickers (e.g. `Attachment`). Resolves with `[]` if the user closes
699
+ * the picker without completing any upload.
700
+ *
701
+ * @param options - File picker configuration (e.g. `fileExtensions`, `maxSize`,
702
+ * `maxCount`, `imageProps`).
703
+ * @returns A promise that resolves with an array of uploaded file metadata
704
+ * objects (empty if the picker was closed without uploading anything).
705
+ *
706
+ * @example
707
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["JPG", "PNG"] });
708
+ * if (files.length) onChange(files[0]); // single-file consumer (Image)
709
+ *
710
+ * @example
711
+ * const files = await kf.client.openFilePicker({ maxCount: 10 });
712
+ * if (files.length) onChange([...existing, ...files]); // multi-file consumer (Attachment)
713
+ */
714
+ openFilePicker(options: FilePickerOptions): any;
715
+ /**
716
+ * Open the platform's barcode/QR scanner and resolve with the decoded text.
717
+ *
718
+ * The scanner UI (camera stream + decoding) runs in the parent window, which
719
+ * owns the camera permission — the iframe itself never accesses the camera.
720
+ * Camera-permission prompts and denials are handled inside the scanner UI;
721
+ * they are not surfaced as errors here.
722
+ *
723
+ * Resolves with `null` if the user closes the scanner without a successful
724
+ * scan (including the scanner's own inactivity timeout).
725
+ *
726
+ * Note: currently supported in web custom app UIs; the mobile (PWA) custom
727
+ * UI does not host the scanner portal yet.
728
+ *
729
+ * @param options - Scanner configuration (e.g. `localFileScan` to allow
730
+ * decoding from an uploaded image instead of the camera).
731
+ * @returns A promise that resolves with the decoded string, or `null` if the
732
+ * scanner was closed without scanning.
733
+ *
734
+ * @example
735
+ * const code = await kf.client.openScanner({ localFileScan: true });
736
+ * if (code) onChange(code);
737
+ */
738
+ openScanner(options?: ScannerOptions): any;
739
+ /**
740
+ * Open the platform's native Geolocation map picker (search, current-location
741
+ * detection, marker drag, reverse-geocoding) in a modal over the custom
742
+ * form/component. Runs in the parent window, which owns the Google Maps API
743
+ * key — the iframe itself never needs one.
744
+ *
745
+ * Resolves with `null` if the user closes the picker without selecting a
746
+ * location.
747
+ *
748
+ * @param value - Optional current geolocation value to pre-select on the map.
749
+ * @returns A promise that resolves with the picked location object, or
750
+ * `null` if the picker was closed without a selection.
751
+ *
752
+ * @example
753
+ * const location = await kf.client.pickLocation();
754
+ * if (location) onChange(location);
755
+ */
756
+ pickLocation(value?: GeolocationValue): any;
757
+ /**
758
+ * Upload a File object to Kissflow's S3 storage and resolve with its metadata.
759
+ *
760
+ * Use this when you have a File/Blob already in memory (e.g. a canvas drawing
761
+ * converted to a PNG blob) and need to upload it without opening a file picker UI.
762
+ * The platform runs the upload in the parent window (which has the required session)
763
+ * and resolves with the uploaded file's `{ key, name, ... }` metadata — the same
764
+ * shape returned by `openFilePicker`.
765
+ *
766
+ * Resolves with `null` if the upload fails.
767
+ *
768
+ * @param file - The File or Blob to upload.
769
+ * @param fileName - Optional file name override (defaults to `file.name`).
770
+ * @returns A promise that resolves with the uploaded file metadata, or `null` on failure.
771
+ *
772
+ * @example
773
+ * const blob = await new Promise<Blob>(res => canvas.toBlob(res, 'image/png'));
774
+ * const file = new File([blob], 'signature.png', { type: 'image/png' });
775
+ * const result = await kf.client.uploadFile(file);
776
+ * if (result) onChange(result);
777
+ */
778
+ uploadFile(file: UploadableFile, fileName?: string): any;
779
+ /**
780
+ * Open the platform's file preview (lightbox) for one or more files.
781
+ *
782
+ * `files` always accepts an array — pass a single-element array for fields like
783
+ * `Image`, or the full list for multi-file fields like `Attachment`. The host's
784
+ * preview UI natively renders next/prev navigation across the array; the SDK
785
+ * just passes the file list through, no extra navigation surface is needed here.
786
+ *
787
+ * @param args - Preview configuration.
788
+ * @param args.files - Array of file metadata objects to preview.
789
+ * @param args.indexOfFile - Index of the file to open the preview on (default: 0).
790
+ * @returns A promise that resolves once the user closes the preview.
791
+ *
792
+ * @example
793
+ * await kf.client.openFilePreview({ files: [imageFieldValue] });
794
+ * await kf.client.openFilePreview({ files: attachmentFieldValue, indexOfFile: 2 });
795
+ */
796
+ openFilePreview(args: {
797
+ files: Record<string, unknown>[];
798
+ indexOfFile?: number;
799
+ }): any;
800
+ }
801
+ }
802
+ declare module "utils/formatter" {
803
+ import { BaseSDK } from "core/index";
804
+ export class Formatter extends BaseSDK {
805
+ toDate(date: string): any;
806
+ toDateTime(date: string): any;
807
+ toNumber(value: string): any;
808
+ toCurrency(value: string, currencyCode: string): any;
809
+ toBoolean(value: string): any;
810
+ }
811
+ }
812
+ declare module "utils/validation" {
813
+ /**
814
+ * Validation utilities for SDK methods
815
+ */
816
+ /**
817
+ * Throws error if value is falsy
818
+ */
819
+ export function requireField(value: any, fieldName: string): void;
820
+ /**
821
+ * Returns a rejected promise if value is falsy, null otherwise
822
+ * Use for async validation in SDK methods
823
+ */
824
+ export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
825
+ /**
826
+ * Returns a rejected promise if any of the values are falsy
827
+ * Use for validating multiple required fields
828
+ */
829
+ export function requireFieldsAsync(fields: Array<{
830
+ value: any;
831
+ name: string;
832
+ }>): Promise<never> | null;
833
+ }
834
+ declare module "utils/index" {
835
+ export * from "utils/client";
836
+ export * from "utils/formatter";
837
+ export * from "utils/validation";
838
+ export const isObject: (value: any) => boolean;
839
+ }
840
+ declare module "window/NDEFReader" {
841
+ import { BaseSDK } from "core/index";
842
+ export class NDEFReader extends BaseSDK {
843
+ id: string;
844
+ constructor();
845
+ scan(): Promise<unknown>;
846
+ write(data: any): Promise<unknown>;
847
+ addEventListener(eventName: string, cb: Function): void;
848
+ makeReadOnly(): Promise<unknown>;
849
+ abortScan(): Promise<unknown>;
850
+ }
851
+ }
852
+ declare module "window/index" {
853
+ import { NDEFReader } from "window/NDEFReader";
854
+ export const window: {
855
+ NDEFReader: typeof NDEFReader;
856
+ };
506
857
  }
507
858
  declare module "nocode" {
508
859
  import { BaseSDK } from "core/index";
@@ -525,6 +876,67 @@ declare module "nocode" {
525
876
  function initSDK(config: SDKContext): NocodeSDK;
526
877
  export { window, initSDK as default };
527
878
  }
879
+ declare module "app/agent" {
880
+ import { BaseSDK } from "core/index";
881
+ import { AgentContract, AgentError, AgentExecuteOptions, AgentExecution, AgentExecutionAccepted } from "types/external";
882
+ /**
883
+ * A published Custom Agent of the current app.
884
+ *
885
+ * Get one with `kf.app.getAgent(agentId)`. Calls run as the signed-in user, against the Agent's
886
+ * published (Live) definition.
887
+ */
888
+ export class Agent extends BaseSDK {
889
+ private agentId;
890
+ private _id;
891
+ private activeWatches;
892
+ constructor(agentId: string);
893
+ /**
894
+ * Read the Agent's published contract: its inputs, outputs and readiness.
895
+ *
896
+ * @example
897
+ * const { Definition } = await kf.app.getAgent("AgXXXXXXXXXX").getContract();
898
+ */
899
+ getContract(): Promise<AgentContract>;
900
+ /**
901
+ * Start a run. Resolves once the run is accepted (`ExecutionId`, `Status`), not when it finishes;
902
+ * use {@link onExecutionComplete} or {@link getExecution} for the result.
903
+ *
904
+ * Never retried: if the call fails with `AGENT_EXECUTE_OUTCOME_UNKNOWN`, a run may still have
905
+ * started, and app code cannot list runs to find it: tell the user the request may still be in
906
+ * progress instead of starting another. `AGENT_EXECUTE_NOT_SENT` means it was not sent (for
907
+ * example, the user is offline).
908
+ *
909
+ * @example
910
+ * const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks", amount: 54000 } });
911
+ */
912
+ execute(options: AgentExecuteOptions): Promise<AgentExecutionAccepted>;
913
+ /**
914
+ * Read a run's current state, with its `Output` once `Completed` or its `Error` once `Failed`.
915
+ * Callers who are not the App's authors can read only their own runs.
916
+ */
917
+ getExecution(executionId: string): Promise<AgentExecution>;
918
+ /**
919
+ * Be told once when a run finishes. `onComplete` gets the run on `Completed` or `Failed` (read
920
+ * `Status`: a failed run is a result, not an error). `onWatchError` gets what stopped the
921
+ * observation instead: an unsupported host, an access or network failure, or the observation limit
922
+ * (`AGENT_OBSERVATION_STOPPED`, after about six minutes; the run may still finish, so read it later
923
+ * with {@link getExecution}). At most one of the two is called, at most once.
924
+ *
925
+ * Neither is called if the script that registered them stops first: form, field, gallery and
926
+ * table scripts stop after one minute, and they and page event scripts stop when the next script
927
+ * starts on the same form, component or page. In those scripts, keep the `ExecutionId` and read
928
+ * it later with {@link getExecution}.
929
+ *
930
+ * Returns a function that stops observing. It never cancels the run.
931
+ *
932
+ * @example
933
+ * const stop = agent.onExecutionComplete(ExecutionId, (run) => show(run), (err) => warn(err));
934
+ * // later, e.g. on unmount
935
+ * stop();
936
+ */
937
+ onExecutionComplete(executionId: string, onComplete: (execution: AgentExecution) => void, onWatchError?: (error: AgentError) => void): () => void;
938
+ }
939
+ }
528
940
  declare module "app/component" {
529
941
  import { BaseSDK } from "core/index";
530
942
  import { ComponentProps } from "types/internal";
@@ -545,6 +957,14 @@ declare module "app/component" {
545
957
  _id: string;
546
958
  constructor(id: any);
547
959
  watchParams(callBack: (data: any) => any): void;
960
+ /**
961
+ * Subscribe to route changes pushed by the Kissflow host
962
+ * (parent back/forward or deep-link). Used by the App UI framework
963
+ * to keep the in-iframe router in sync with the parent URL.
964
+ */
965
+ watchRoute(callBack: (data: {
966
+ route: string;
967
+ }) => any): void;
548
968
  }
549
969
  }
550
970
  declare module "app/decisiontable" {
@@ -587,6 +1007,7 @@ declare module "app/page" {
587
1007
  _id: string;
588
1008
  popup: Popup;
589
1009
  type: string;
1010
+ _route: string;
590
1011
  constructor(props: PageContext, isCustomComponent?: boolean);
591
1012
  getParameter(key: string): any;
592
1013
  getAllParameters(): any;
@@ -594,11 +1015,19 @@ declare module "app/page" {
594
1015
  setVariable(key: string | object, value?: any): any;
595
1016
  openPopup(popupId: string, popupParams?: object): any;
596
1017
  getComponent(componentId: string): Component;
1018
+ /**
1019
+ * Notify the Kissflow host that the custom UI navigated to `path`,
1020
+ * so the parent browser URL mirrors the route. Used by the App UI framework.
1021
+ */
1022
+ setRoute(path: string): void;
1023
+ /** Returns the initial deep-link route the page was opened with. */
1024
+ getRoute(): string;
597
1025
  }
598
1026
  }
599
1027
  declare module "dataform/index" {
600
1028
  import { BaseSDK } from "core/index";
601
- import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
1029
+ import { Form } from "form/index";
1030
+ import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions, DataformFieldOptions } from "types/external";
602
1031
  export class Dataform extends BaseSDK {
603
1032
  private _id;
604
1033
  constructor(flowId: string);
@@ -667,11 +1096,36 @@ declare module "dataform/index" {
667
1096
  getFields(options?: {
668
1097
  viewId?: string;
669
1098
  }): Promise<any>;
1099
+ /**
1100
+ * Initialize a form with all necessary data (schema, item data, form store)
1101
+ * This is the recommended way to create a custom form for dataform records
1102
+ * It automatically handles fetching schema, item data, and initializing the form store
1103
+ *
1104
+ * @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
1105
+ * @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
1106
+ * @returns Promise with Form instance ready to use
1107
+ *
1108
+ * @example
1109
+ * // Load existing record
1110
+ * const dataform = kf.app.getDataform("EmpMaster");
1111
+ * const form = await dataform.initForm("emp_123");
1112
+ * const data = await form.toJSON();
1113
+ *
1114
+ * // Load existing record scoped to a view
1115
+ * const form = await dataform.initForm("emp_123", "EmpMaster_View");
1116
+ *
1117
+ * // Create new record
1118
+ * const form = await dataform.initForm();
1119
+ * await form.updateField({ firstName: "John" });
1120
+ */
1121
+ initForm(instanceId?: string, viewId?: string): Promise<Form>;
1122
+ getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
670
1123
  }
671
1124
  }
672
1125
  declare module "board/index" {
673
1126
  import { BaseSDK } from "core/index";
674
- import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
1127
+ import { Form } from "form/index";
1128
+ import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions, BoardFieldOptions } from "types/external";
675
1129
  export class Board extends BaseSDK {
676
1130
  private _id;
677
1131
  constructor(flowId: string);
@@ -751,11 +1205,47 @@ declare module "board/index" {
751
1205
  getFields(options?: {
752
1206
  viewId?: string;
753
1207
  }): Promise<any>;
1208
+ /**
1209
+ * Initialize a form for a board item with all necessary setup
1210
+ * Fetches schema, item data, creates and initializes the form store
1211
+ *
1212
+ * @param instanceId - Optional instance ID. If omitted, creates a new board item
1213
+ * @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
1214
+ * @returns Promise with Form instance ready to use
1215
+ *
1216
+ * @example
1217
+ * // Create new board item
1218
+ * const board = kf.app.getBoard("Inventory");
1219
+ * const form = await board.initForm();
1220
+ * await form.updateField({ Name: "New Item" });
1221
+ *
1222
+ * // Edit existing board item
1223
+ * const form = await board.initForm("item_123");
1224
+ * const data = await form.toJSON();
1225
+ *
1226
+ * // Edit existing board item scoped to a view
1227
+ * const form = await board.initForm("item_123", "Inventory_View");
1228
+ */
1229
+ initForm(instanceId?: string, viewId?: string): Promise<Form>;
1230
+ /**
1231
+ * Get field options for dropdown/lookup fields
1232
+ * @param options - Field options (instanceId, fieldId)
1233
+ * @returns Promise containing the field options
1234
+ *
1235
+ * @example
1236
+ * const board = kf.app.getBoard("Inventory");
1237
+ * const options = await board.getFieldOptions({
1238
+ * instanceId: "item_123",
1239
+ * fieldId: "Category"
1240
+ * });
1241
+ */
1242
+ getFieldOptions(options: BoardFieldOptions): Promise<any>;
754
1243
  }
755
1244
  }
756
1245
  declare module "process/index" {
757
1246
  import { BaseSDK } from "core/index";
758
- import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
1247
+ import { Form } from "form/index";
1248
+ import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessGetAdminItemOptions, ProcessUpdateAdminItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions, ProcessFieldOptions, ProcessParseAttachmentOptions, ProcessAttachmentParseResult } from "types/external";
759
1249
  export class Process extends BaseSDK {
760
1250
  private _id;
761
1251
  constructor(flowId: string);
@@ -807,7 +1297,7 @@ declare module "process/index" {
807
1297
  getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
808
1298
  /**
809
1299
  * Get a single process instance by ID
810
- * @param options - instanceId (required)
1300
+ * @param options - instanceId, activityInstanceId (both required)
811
1301
  * @returns Promise containing the instance data
812
1302
  */
813
1303
  getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
@@ -845,6 +1335,26 @@ declare module "process/index" {
845
1335
  * await process.deleteItem({ instanceId: "item_123" });
846
1336
  */
847
1337
  deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
1338
+ /**
1339
+ * Get a single process instance as admin (requires admin access)
1340
+ * @param options - instanceId (required)
1341
+ * @returns Promise containing the instance data
1342
+ *
1343
+ * @example
1344
+ * const process = kf.app.getProcess("LeaveRequest");
1345
+ * const item = await process.getAdminItem({ instanceId: "item_123" });
1346
+ */
1347
+ getAdminItem(options: ProcessGetAdminItemOptions): Promise<ProcessItem>;
1348
+ /**
1349
+ * Update a process instance as admin (requires admin access)
1350
+ * @param options - instanceId, data (required)
1351
+ * @returns Promise containing the updated item
1352
+ *
1353
+ * @example
1354
+ * const process = kf.app.getProcess("LeaveRequest");
1355
+ * await process.updateAdminItem({ instanceId: "item_123", data: { LeaveType: "Sick" } });
1356
+ */
1357
+ updateAdminItem(options: ProcessUpdateAdminItemOptions): Promise<ProcessItem>;
848
1358
  /**
849
1359
  * Open the form UI for a process instance
850
1360
  * @param item - Process item with _id and _activity_instance_id
@@ -943,13 +1453,49 @@ declare module "process/index" {
943
1453
  getProgress(options: {
944
1454
  instanceId: string;
945
1455
  }): Promise<any>;
1456
+ /**
1457
+ * Initialize a form with all necessary data (schema, item data, form store)
1458
+ * This is the recommended way to create a custom form for dataform records
1459
+ * It automatically handles fetching schema, item data, and initializing the form store
1460
+ *
1461
+ * @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
1462
+ * @returns Promise with Form instance ready to use
1463
+ *
1464
+ * @example
1465
+ * // Load existing record
1466
+ * const dataform = kf.app.getDataform("EmpMaster");
1467
+ * const form = await dataform.initForm("emp_123");
1468
+ * const data = await form.toJSON();
1469
+ *
1470
+ * // Create new record
1471
+ * const form = await dataform.initForm();
1472
+ * await form.updateField({ firstName: "John" });
1473
+ */
1474
+ initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
1475
+ getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
1476
+ /**
1477
+ * Trigger AI document parsing on an uploaded file for a Smart Attachment field.
1478
+ * Matches native platform behavior: matching empty fields are auto-filled directly
1479
+ * into the form store (respecting field permissions) — no separate apply step needed.
1480
+ * Call `form.toJSON()` afterward to read the updated values.
1481
+ *
1482
+ * @example
1483
+ * const form = await process.initForm();
1484
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["pdf"], maxCount: 1 });
1485
+ * await form.updateField({ [fieldId]: files });
1486
+ * await process.parseAttachment({ instanceId: form.instanceId, fieldId, file: files[0] });
1487
+ * const updated = await form.toJSON(); // other fields now auto-filled
1488
+ */
1489
+ parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
946
1490
  }
947
1491
  }
948
1492
  declare module "app/index" {
949
1493
  import { BaseSDK } from "core/index";
950
1494
  import { Page } from "app/page";
951
1495
  import { AppContext } from "types/internal";
1496
+ import { rolesObject } from "types/external";
952
1497
  import { DecisionTable } from "app/decisiontable";
1498
+ import { Agent } from "app/agent";
953
1499
  import { Dataform } from "dataform/index";
954
1500
  import { Board } from "board/index";
955
1501
  import { Process } from "process/index";
@@ -961,11 +1507,58 @@ declare module "app/index" {
961
1507
  setVariable(key: string | object, value?: any): any;
962
1508
  openPage(pageId: string, pageParams?: object): any;
963
1509
  getDecisionTable(flowId: string): DecisionTable;
1510
+ /**
1511
+ * Get a published Custom Agent of this app by its id. The handle sends no request until you call one
1512
+ * of its methods; see {@link Agent}.
1513
+ *
1514
+ * @example
1515
+ * const agent = kf.app.getAgent("AgXXXXXXXXXX");
1516
+ * const { ExecutionId } = await agent.execute({ inputData: { request: "Two desks" } });
1517
+ */
1518
+ getAgent(agentId: string): Agent;
964
1519
  getDataform(flowId: string): Dataform;
965
1520
  getBoard(flowId: string): Board;
966
1521
  getProcess(flowId: string): Process;
1522
+ /**
1523
+ * List the app's roles and which of them the current user is a member of.
1524
+ *
1525
+ * Only available in a Development account - use this to build a role
1526
+ * picker UI inside the component, then pass the chosen role to
1527
+ * {@link switchRole}.
1528
+ *
1529
+ * @returns A promise that resolves with `{ roles, currentRoles }` - the
1530
+ * full list of app roles and the subset the current user belongs to.
1531
+ *
1532
+ * @example
1533
+ * const { roles, currentRoles } = await kf.app.getRoles();
1534
+ */
1535
+ getRoles(): Promise<{
1536
+ roles: rolesObject[];
1537
+ currentRoles: rolesObject[];
1538
+ }>;
1539
+ /**
1540
+ * Switch the current user's active role in a Development account.
1541
+ *
1542
+ * This performs a real role change - it removes the user from their
1543
+ * current role(s) and adds them to the target role. The platform's app
1544
+ * shell (top nav, other widgets) picks up the new role on its own; no
1545
+ * page reload happens. Only available in a Development account.
1546
+ *
1547
+ * @param args - Either `roleId` or `roleName` identifying the target role
1548
+ * (use the values returned by {@link getRoles}).
1549
+ * @returns A promise that resolves with the switched-to role.
1550
+ *
1551
+ * @example
1552
+ * const { roles } = await kf.app.getRoles();
1553
+ * await kf.app.switchRole({ roleId: roles[1]._id });
1554
+ */
1555
+ switchRole(args: {
1556
+ roleId?: string;
1557
+ roleName?: string;
1558
+ }): Promise<rolesObject>;
967
1559
  }
968
1560
  export * from "app/component";
1561
+ export { Agent };
969
1562
  export { Page };
970
1563
  export * from "app/popup";
971
1564
  }