@kissflow/lowcode-client-sdk 1.0.44 → 1.0.49

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/index.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,6 +52,8 @@ 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;
@@ -59,6 +71,8 @@ declare module "core/constants" {
59
71
  DATAFORM_DELETE_ITEM: string;
60
72
  DATAFORM_DISCARD_ITEM: string;
61
73
  DATAFORM_SUBMIT_ITEM: string;
74
+ DATAFORM_INIT_FORM: string;
75
+ DATAFORM_GET_FIELD_OPTIONS: string;
62
76
  PROCESS_OPEN_FORM: string;
63
77
  PROCESS_GET_FIELDS: string;
64
78
  PROCESS_GET_MYTASK_FIELDS: string;
@@ -72,6 +86,8 @@ declare module "core/constants" {
72
86
  PROCESS_UPDATE_ITEM: string;
73
87
  PROCESS_GET_ITEM: string;
74
88
  PROCESS_DELETE_ITEM: string;
89
+ PROCESS_GET_ADMIN_ITEM: string;
90
+ PROCESS_UPDATE_ADMIN_ITEM: string;
75
91
  PROCESS_SUBMIT_ITEM: string;
76
92
  PROCESS_REJECT_ITEM: string;
77
93
  PROCESS_WITHDRAW_ITEM: string;
@@ -81,6 +97,9 @@ declare module "core/constants" {
81
97
  PROCESS_RESTART_ITEM: string;
82
98
  PROCESS_DISCARD_ITEM: string;
83
99
  PROCESS_GET_PROGRESS: string;
100
+ PROCESS_INIT_FORM: string;
101
+ PROCESS_GET_FIELD_OPTIONS: string;
102
+ PROCESS_PARSE_ATTACHMENT: string;
84
103
  BOARD_IMPORT_CSV: string;
85
104
  BOARD_OPEN_FORM: string;
86
105
  BOARD_GET_FIELDS: string;
@@ -91,10 +110,13 @@ declare module "core/constants" {
91
110
  BOARD_DELETE_ITEM: string;
92
111
  BOARD_SUBMIT_ITEM: string;
93
112
  BOARD_DISCARD_ITEM: string;
113
+ BOARD_INIT_FORM: string;
114
+ BOARD_GET_FIELD_OPTIONS: string;
94
115
  };
95
116
  export const EVENT_TYPES: {
96
117
  COMPONENT_ON_MOUNT: string;
97
118
  CC_ON_PARAMS_CHANGE: string;
119
+ CC_ON_ROUTE_CHANGE: string;
98
120
  };
99
121
  export const DEFAULTS: {
100
122
  POPUP_ID: string;
@@ -118,121 +140,6 @@ declare module "core/index" {
118
140
  }
119
141
  export * from "core/constants";
120
142
  }
121
- declare module "utils/client" {
122
- import { BaseSDK } from "core/index";
123
- export class Client extends BaseSDK {
124
- /**
125
- * Display an info message toast in the platform.
126
- *
127
- * @param message - The message to display. Accepts a string or object (serialized to JSON).
128
- * @returns A promise that resolves when the message is shown.
129
- *
130
- * @example
131
- * await kf.client.showInfo("Record saved successfully");
132
- */
133
- showInfo(message: string | object): any;
134
- /**
135
- * Display a confirmation dialog and wait for the user's response.
136
- *
137
- * @param args - Dialog configuration.
138
- * @param args.title - Dialog title.
139
- * @param args.content - Body text of the dialog.
140
- * @param args.okText - Label for the confirm button (default: "Ok").
141
- * @param args.cancelText - Label for the cancel button (default: "Cancel").
142
- * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
143
- *
144
- * @example
145
- * const { action } = await kf.client.showConfirm({
146
- * title: "Delete record?",
147
- * content: "This cannot be undone.",
148
- * okText: "Delete",
149
- * cancelText: "Cancel",
150
- * });
151
- * if (action === "OK") { ... }
152
- */
153
- showConfirm(args: {
154
- title: string;
155
- content: string;
156
- okText: string;
157
- cancelText: string;
158
- }): any;
159
- /**
160
- * Navigate the platform to the given URL.
161
- *
162
- * @param url - The URL to navigate to.
163
- *
164
- * @example
165
- * kf.client.redirect("https://example.com");
166
- */
167
- redirect(url: string): any;
168
- /**
169
- * Resolve a Kissflow image field value to a base64 data URL.
170
- *
171
- * Custom components (iframes) cannot load Kissflow-hosted images directly due to
172
- * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
173
- * image in the parent window (which has the required session cookies) and returns
174
- * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
175
- * without any CORS issues.
176
- *
177
- * @param imageValue - The image field value must contain a `key` property and
178
- * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
179
- * falls back to `key`.
180
- * @returns A promise that resolves with the base64 data URL string.
181
- *
182
- * @example
183
- * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
184
- * document.querySelector("#avatar").src = dataUrl;
185
- */
186
- getImageUrl(imageValue: Record<string, unknown>): any;
187
- }
188
- }
189
- declare module "utils/formatter" {
190
- import { BaseSDK } from "core/index";
191
- export class Formatter extends BaseSDK {
192
- toDate(date: string): any;
193
- toDateTime(date: string): any;
194
- toNumber(value: string): any;
195
- toCurrency(value: string, currencyCode: string): any;
196
- toBoolean(value: string): any;
197
- }
198
- }
199
- declare module "utils/validation" {
200
- /**
201
- * Validation utilities for SDK methods
202
- */
203
- /**
204
- * Throws error if value is falsy
205
- */
206
- export function requireField(value: any, fieldName: string): void;
207
- /**
208
- * Returns a rejected promise if value is falsy, null otherwise
209
- * Use for async validation in SDK methods
210
- */
211
- export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
212
- /**
213
- * Returns a rejected promise if any of the values are falsy
214
- * Use for validating multiple required fields
215
- */
216
- export function requireFieldsAsync(fields: Array<{
217
- value: any;
218
- name: string;
219
- }>): Promise<never> | null;
220
- }
221
- declare module "utils/index" {
222
- export * from "utils/client";
223
- export * from "utils/formatter";
224
- export * from "utils/validation";
225
- export const isObject: (value: any) => boolean;
226
- }
227
- declare module "core/proxy" {
228
- export class CreateProxy {
229
- path: string[];
230
- parent: object;
231
- constructor(parent: object, target?: {}, path?: any[]);
232
- get(target: object, property: string): any;
233
- set(target: object, property: string, value: any, reciever: any): any;
234
- }
235
- }
236
143
  declare module "types/external" {
237
144
  export type QueryResponse = {
238
145
  items: any[];
@@ -290,6 +197,17 @@ declare module "types/external" {
290
197
  _id: string;
291
198
  _activity_instance_id: string;
292
199
  };
200
+ export type GeolocationValue = {
201
+ Address?: string;
202
+ Latitude: string;
203
+ Longitude: string;
204
+ City?: string;
205
+ State?: string;
206
+ Country?: string;
207
+ ZipCode?: string;
208
+ Area?: string;
209
+ PlaceId?: string;
210
+ };
293
211
  export type ProcessMyItemsOptions = BaseQueryOptions & {
294
212
  status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
295
213
  payload?: ProcessPayloadOptions;
@@ -308,6 +226,7 @@ declare module "types/external" {
308
226
  export type ProcessQueryResponse = QueryResponse;
309
227
  export type ProcessGetItemOptions = {
310
228
  instanceId: string;
229
+ activityInstanceId: string;
311
230
  };
312
231
  export type ProcessCreateItemOptions = {
313
232
  data?: object;
@@ -320,6 +239,13 @@ declare module "types/external" {
320
239
  export type ProcessDeleteItemOptions = {
321
240
  instanceId: string;
322
241
  };
242
+ export type ProcessGetAdminItemOptions = {
243
+ instanceId: string;
244
+ };
245
+ export type ProcessUpdateAdminItemOptions = {
246
+ instanceId: string;
247
+ data: object;
248
+ };
323
249
  export type ProcessSubmitItemOptions = {
324
250
  instanceId: string;
325
251
  activityInstanceId: string;
@@ -362,6 +288,32 @@ declare module "types/external" {
362
288
  export type ProcessDiscardItemOptions = {
363
289
  instanceId: string;
364
290
  };
291
+ export type ProcessFieldOptions = {
292
+ instanceId: string;
293
+ activityInstanceId: string;
294
+ fieldId: string;
295
+ /** Skip the server-side model lookup by supplying the field's type directly. */
296
+ fieldType?: string;
297
+ tableId?: string;
298
+ tableRowId?: string;
299
+ };
300
+ export type ProcessAttachmentFile = {
301
+ id: string;
302
+ name: string;
303
+ key: string;
304
+ size?: number;
305
+ fileExtension?: string;
306
+ };
307
+ export type ProcessParseAttachmentOptions = {
308
+ instanceId: string;
309
+ activityInstanceId: string;
310
+ fieldId: string;
311
+ file: ProcessAttachmentFile;
312
+ };
313
+ export type ProcessAttachmentParseResult = {
314
+ appliedFields: string[];
315
+ suggestedBy: string;
316
+ };
365
317
  export type FetchOptions = {
366
318
  method?: string;
367
319
  body?: string | object;
@@ -397,6 +349,14 @@ declare module "types/external" {
397
349
  data?: object;
398
350
  viewId?: string;
399
351
  };
352
+ export type DataformFieldOptions = {
353
+ instanceId: string;
354
+ fieldId: string;
355
+ /** Skip the server-side model lookup by supplying the field's type directly. */
356
+ fieldType?: string;
357
+ tableId?: string;
358
+ tableRowId?: string;
359
+ };
400
360
  export type BoardGetItemsOptions = BaseQueryOptions & {
401
361
  viewId?: string;
402
362
  payload?: PayloadOptions;
@@ -422,11 +382,20 @@ declare module "types/external" {
422
382
  export type BoardDiscardItemOptions = {
423
383
  instanceId: string;
424
384
  };
385
+ export type BoardFieldOptions = {
386
+ instanceId: string;
387
+ fieldId: string;
388
+ /** Skip the server-side model lookup by supplying the field's type directly. */
389
+ fieldType?: string;
390
+ tableId?: string;
391
+ tableRowId?: string;
392
+ };
425
393
  }
426
394
  declare module "types/internal" {
427
395
  import { userObject, accountObject, environmentObject } from "types/external";
428
396
  export interface SDKContext {
429
397
  formInstanceId: string;
398
+ flowId: string;
430
399
  tableId: string;
431
400
  tableRowId: string;
432
401
  componentId: string;
@@ -454,10 +423,262 @@ declare module "types/internal" {
454
423
  }
455
424
  export interface PageContext {
456
425
  pageId: string;
426
+ initialRoute?: string;
457
427
  }
458
428
  export interface PopupContext {
459
429
  popupId?: string;
460
430
  }
431
+ export interface FilePickerOptions {
432
+ fileExtensions?: string[];
433
+ maxSize?: number;
434
+ maxCount?: number;
435
+ imageProps?: {
436
+ sizes?: Array<[number, number]>;
437
+ crop?: boolean;
438
+ };
439
+ }
440
+ export interface ScannerOptions {
441
+ /** Allow decoding from an uploaded image instead of the camera. */
442
+ localFileScan?: boolean;
443
+ }
444
+ /** Minimal shape of a browser File/Blob object, avoids requiring the DOM lib. */
445
+ export interface UploadableFile {
446
+ name: string;
447
+ size?: number;
448
+ type?: string;
449
+ }
450
+ }
451
+ declare module "utils/client" {
452
+ import { BaseSDK } from "core/index";
453
+ import { GeolocationValue } from "types/external";
454
+ import { FilePickerOptions, ScannerOptions, UploadableFile } from "types/internal";
455
+ export class Client extends BaseSDK {
456
+ /**
457
+ * Display an info message toast in the platform.
458
+ *
459
+ * @param message - The message to display. Accepts a string or object (serialized to JSON).
460
+ * @returns A promise that resolves when the message is shown.
461
+ *
462
+ * @example
463
+ * await kf.client.showInfo("Record saved successfully");
464
+ */
465
+ showInfo(message: string | object): any;
466
+ /**
467
+ * Display a confirmation dialog and wait for the user's response.
468
+ *
469
+ * @param args - Dialog configuration.
470
+ * @param args.title - Dialog title.
471
+ * @param args.content - Body text of the dialog.
472
+ * @param args.okText - Label for the confirm button (default: "Ok").
473
+ * @param args.cancelText - Label for the cancel button (default: "Cancel").
474
+ * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
475
+ *
476
+ * @example
477
+ * const { action } = await kf.client.showConfirm({
478
+ * title: "Delete record?",
479
+ * content: "This cannot be undone.",
480
+ * okText: "Delete",
481
+ * cancelText: "Cancel",
482
+ * });
483
+ * if (action === "OK") { ... }
484
+ */
485
+ showConfirm(args: {
486
+ title: string;
487
+ content: string;
488
+ okText: string;
489
+ cancelText: string;
490
+ }): any;
491
+ /**
492
+ * Navigate the platform to the given URL.
493
+ *
494
+ * @param url - The URL to navigate to.
495
+ *
496
+ * @example
497
+ * kf.client.redirect("https://example.com");
498
+ */
499
+ redirect(url: string): any;
500
+ /**
501
+ * Resolve a Kissflow image field value to a base64 data URL.
502
+ *
503
+ * Custom components (iframes) cannot load Kissflow-hosted images directly due to
504
+ * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
505
+ * image in the parent window (which has the required session cookies) and returns
506
+ * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
507
+ * without any CORS issues.
508
+ *
509
+ * @param imageValue - The image field value must contain a `key` property and
510
+ * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
511
+ * falls back to `key`.
512
+ * @returns A promise that resolves with the base64 data URL string.
513
+ *
514
+ * @example
515
+ * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
516
+ * document.querySelector("#avatar").src = dataUrl;
517
+ */
518
+ getImageUrl(imageValue: Record<string, unknown>): any;
519
+ /**
520
+ * Open the platform's file picker, upload the selected file(s), and resolve
521
+ * with their metadata.
522
+ *
523
+ * Custom components (iframes) cannot access the platform's authenticated upload
524
+ * endpoints directly. This method opens the file picker in the parent window
525
+ * (which has the required session), runs the full select → upload flow, and
526
+ * resolves once all uploads settle with an array of the uploaded files'
527
+ * metadata (each including `key`, `name`, `size`, `photos`, etc. — the same
528
+ * shape consumed by `getImageUrl`).
529
+ *
530
+ * Always resolves with an array — a single-element array for single-file
531
+ * pickers (e.g. `maxCount: 1` for `Image`), one entry per uploaded file for
532
+ * multi-file pickers (e.g. `Attachment`). Resolves with `[]` if the user closes
533
+ * the picker without completing any upload.
534
+ *
535
+ * @param options - File picker configuration (e.g. `fileExtensions`, `maxSize`,
536
+ * `maxCount`, `imageProps`).
537
+ * @returns A promise that resolves with an array of uploaded file metadata
538
+ * objects (empty if the picker was closed without uploading anything).
539
+ *
540
+ * @example
541
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["JPG", "PNG"] });
542
+ * if (files.length) onChange(files[0]); // single-file consumer (Image)
543
+ *
544
+ * @example
545
+ * const files = await kf.client.openFilePicker({ maxCount: 10 });
546
+ * if (files.length) onChange([...existing, ...files]); // multi-file consumer (Attachment)
547
+ */
548
+ openFilePicker(options: FilePickerOptions): any;
549
+ /**
550
+ * Open the platform's barcode/QR scanner and resolve with the decoded text.
551
+ *
552
+ * The scanner UI (camera stream + decoding) runs in the parent window, which
553
+ * owns the camera permission — the iframe itself never accesses the camera.
554
+ * Camera-permission prompts and denials are handled inside the scanner UI;
555
+ * they are not surfaced as errors here.
556
+ *
557
+ * Resolves with `null` if the user closes the scanner without a successful
558
+ * scan (including the scanner's own inactivity timeout).
559
+ *
560
+ * Note: currently supported in web custom app UIs; the mobile (PWA) custom
561
+ * UI does not host the scanner portal yet.
562
+ *
563
+ * @param options - Scanner configuration (e.g. `localFileScan` to allow
564
+ * decoding from an uploaded image instead of the camera).
565
+ * @returns A promise that resolves with the decoded string, or `null` if the
566
+ * scanner was closed without scanning.
567
+ *
568
+ * @example
569
+ * const code = await kf.client.openScanner({ localFileScan: true });
570
+ * if (code) onChange(code);
571
+ */
572
+ openScanner(options?: ScannerOptions): any;
573
+ /**
574
+ * Open the platform's native Geolocation map picker (search, current-location
575
+ * detection, marker drag, reverse-geocoding) in a modal over the custom
576
+ * form/component. Runs in the parent window, which owns the Google Maps API
577
+ * key — the iframe itself never needs one.
578
+ *
579
+ * Resolves with `null` if the user closes the picker without selecting a
580
+ * location.
581
+ *
582
+ * @param value - Optional current geolocation value to pre-select on the map.
583
+ * @returns A promise that resolves with the picked location object, or
584
+ * `null` if the picker was closed without a selection.
585
+ *
586
+ * @example
587
+ * const location = await kf.client.pickLocation();
588
+ * if (location) onChange(location);
589
+ */
590
+ pickLocation(value?: GeolocationValue): any;
591
+ /**
592
+ * Upload a File object to Kissflow's S3 storage and resolve with its metadata.
593
+ *
594
+ * Use this when you have a File/Blob already in memory (e.g. a canvas drawing
595
+ * converted to a PNG blob) and need to upload it without opening a file picker UI.
596
+ * The platform runs the upload in the parent window (which has the required session)
597
+ * and resolves with the uploaded file's `{ key, name, ... }` metadata — the same
598
+ * shape returned by `openFilePicker`.
599
+ *
600
+ * Resolves with `null` if the upload fails.
601
+ *
602
+ * @param file - The File or Blob to upload.
603
+ * @param fileName - Optional file name override (defaults to `file.name`).
604
+ * @returns A promise that resolves with the uploaded file metadata, or `null` on failure.
605
+ *
606
+ * @example
607
+ * const blob = await new Promise<Blob>(res => canvas.toBlob(res, 'image/png'));
608
+ * const file = new File([blob], 'signature.png', { type: 'image/png' });
609
+ * const result = await kf.client.uploadFile(file);
610
+ * if (result) onChange(result);
611
+ */
612
+ uploadFile(file: UploadableFile, fileName?: string): any;
613
+ /**
614
+ * Open the platform's file preview (lightbox) for one or more files.
615
+ *
616
+ * `files` always accepts an array — pass a single-element array for fields like
617
+ * `Image`, or the full list for multi-file fields like `Attachment`. The host's
618
+ * preview UI natively renders next/prev navigation across the array; the SDK
619
+ * just passes the file list through, no extra navigation surface is needed here.
620
+ *
621
+ * @param args - Preview configuration.
622
+ * @param args.files - Array of file metadata objects to preview.
623
+ * @param args.indexOfFile - Index of the file to open the preview on (default: 0).
624
+ * @returns A promise that resolves once the user closes the preview.
625
+ *
626
+ * @example
627
+ * await kf.client.openFilePreview({ files: [imageFieldValue] });
628
+ * await kf.client.openFilePreview({ files: attachmentFieldValue, indexOfFile: 2 });
629
+ */
630
+ openFilePreview(args: {
631
+ files: Record<string, unknown>[];
632
+ indexOfFile?: number;
633
+ }): any;
634
+ }
635
+ }
636
+ declare module "utils/formatter" {
637
+ import { BaseSDK } from "core/index";
638
+ export class Formatter extends BaseSDK {
639
+ toDate(date: string): any;
640
+ toDateTime(date: string): any;
641
+ toNumber(value: string): any;
642
+ toCurrency(value: string, currencyCode: string): any;
643
+ toBoolean(value: string): any;
644
+ }
645
+ }
646
+ declare module "utils/validation" {
647
+ /**
648
+ * Validation utilities for SDK methods
649
+ */
650
+ /**
651
+ * Throws error if value is falsy
652
+ */
653
+ export function requireField(value: any, fieldName: string): void;
654
+ /**
655
+ * Returns a rejected promise if value is falsy, null otherwise
656
+ * Use for async validation in SDK methods
657
+ */
658
+ export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
659
+ /**
660
+ * Returns a rejected promise if any of the values are falsy
661
+ * Use for validating multiple required fields
662
+ */
663
+ export function requireFieldsAsync(fields: Array<{
664
+ value: any;
665
+ name: string;
666
+ }>): Promise<never> | null;
667
+ }
668
+ declare module "utils/index" {
669
+ export * from "utils/client";
670
+ export * from "utils/formatter";
671
+ export * from "utils/validation";
672
+ export const isObject: (value: any) => boolean;
673
+ }
674
+ declare module "core/proxy" {
675
+ export class CreateProxy {
676
+ path: string[];
677
+ parent: object;
678
+ constructor(parent: object, target?: {}, path?: any[]);
679
+ get(target: object, property: string): any;
680
+ set(target: object, property: string, value: any, reciever: any): any;
681
+ }
461
682
  }
462
683
  declare module "app/component" {
463
684
  import { BaseSDK } from "core/index";
@@ -479,6 +700,14 @@ declare module "app/component" {
479
700
  _id: string;
480
701
  constructor(id: any);
481
702
  watchParams(callBack: (data: any) => any): void;
703
+ /**
704
+ * Subscribe to route changes pushed by the Kissflow host
705
+ * (parent back/forward or deep-link). Used by the App UI framework
706
+ * to keep the in-iframe router in sync with the parent URL.
707
+ */
708
+ watchRoute(callBack: (data: {
709
+ route: string;
710
+ }) => any): void;
482
711
  }
483
712
  }
484
713
  declare module "app/popup" {
@@ -504,6 +733,7 @@ declare module "app/page" {
504
733
  _id: string;
505
734
  popup: Popup;
506
735
  type: string;
736
+ _route: string;
507
737
  constructor(props: PageContext, isCustomComponent?: boolean);
508
738
  getParameter(key: string): any;
509
739
  getAllParameters(): any;
@@ -511,6 +741,13 @@ declare module "app/page" {
511
741
  setVariable(key: string | object, value?: any): any;
512
742
  openPopup(popupId: string, popupParams?: object): any;
513
743
  getComponent(componentId: string): Component;
744
+ /**
745
+ * Notify the Kissflow host that the custom UI navigated to `path`,
746
+ * so the parent browser URL mirrors the route. Used by the App UI framework.
747
+ */
748
+ setRoute(path: string): void;
749
+ /** Returns the initial deep-link route the page was opened with. */
750
+ getRoute(): string;
514
751
  }
515
752
  }
516
753
  declare module "app/decisiontable" {
@@ -521,9 +758,58 @@ declare module "app/decisiontable" {
521
758
  evaluate(payload?: object): any;
522
759
  }
523
760
  }
761
+ declare module "form/index" {
762
+ import { BaseSDK } from "core/index";
763
+ export class Form extends BaseSDK {
764
+ private storeId;
765
+ private flowId;
766
+ type: string;
767
+ instanceId: string;
768
+ activityInstanceId?: string;
769
+ constructor(storeId: string, flowId: string, instanceId: string, activityInstanceId?: string);
770
+ toJSON(): any;
771
+ getField(fieldId: string): any;
772
+ updateField(args: object): any;
773
+ getValidationErrors(): any;
774
+ getFormConfiguration(): any;
775
+ getFieldState(): any;
776
+ getTable(tableId: string): Table;
777
+ }
778
+ class Table extends BaseSDK {
779
+ private storeId;
780
+ private flowId;
781
+ private instanceId;
782
+ private tableId;
783
+ private activityInstanceId?;
784
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string);
785
+ toJSON(): any;
786
+ getSelectedRows(): any;
787
+ getRows(): TableForm[];
788
+ getRow(rowId: string): TableForm;
789
+ addRow(rowObject: object): any;
790
+ addRows(rows: object[]): any;
791
+ deleteRow(rowId: string): any;
792
+ deleteRows(rows: string[]): any;
793
+ }
794
+ export class TableForm extends BaseSDK {
795
+ private storeId;
796
+ private flowId;
797
+ private instanceId;
798
+ private tableId;
799
+ private rowId;
800
+ private activityInstanceId?;
801
+ type: string;
802
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
803
+ getParent(): Form;
804
+ toJSON(): any;
805
+ getField(fieldId: string): any;
806
+ updateField(args: object): any;
807
+ }
808
+ }
524
809
  declare module "dataform/index" {
525
810
  import { BaseSDK } from "core/index";
526
- import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions } from "types/external";
811
+ import { Form } from "form/index";
812
+ import { DataformItem, DataformQueryOptions, DataformQueryResponse, DataformCreateItemOptions, DataformUpdateItemOptions, DataformGetItemOptions, DataformDeleteItemOptions, DataformDiscardItemOptions, DataformSubmitItemOptions, DataformFieldOptions } from "types/external";
527
813
  export class Dataform extends BaseSDK {
528
814
  private _id;
529
815
  constructor(flowId: string);
@@ -592,11 +878,36 @@ declare module "dataform/index" {
592
878
  getFields(options?: {
593
879
  viewId?: string;
594
880
  }): Promise<any>;
881
+ /**
882
+ * Initialize a form with all necessary data (schema, item data, form store)
883
+ * This is the recommended way to create a custom form for dataform records
884
+ * It automatically handles fetching schema, item data, and initializing the form store
885
+ *
886
+ * @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
887
+ * @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
888
+ * @returns Promise with Form instance ready to use
889
+ *
890
+ * @example
891
+ * // Load existing record
892
+ * const dataform = kf.app.getDataform("EmpMaster");
893
+ * const form = await dataform.initForm("emp_123");
894
+ * const data = await form.toJSON();
895
+ *
896
+ * // Load existing record scoped to a view
897
+ * const form = await dataform.initForm("emp_123", "EmpMaster_View");
898
+ *
899
+ * // Create new record
900
+ * const form = await dataform.initForm();
901
+ * await form.updateField({ firstName: "John" });
902
+ */
903
+ initForm(instanceId?: string, viewId?: string): Promise<Form>;
904
+ getFieldOptions(options?: DataformFieldOptions): Promise<DataformQueryResponse>;
595
905
  }
596
906
  }
597
907
  declare module "board/index" {
598
908
  import { BaseSDK } from "core/index";
599
- import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions } from "types/external";
909
+ import { Form } from "form/index";
910
+ import { BoardItem, BoardGetItemOptions, BoardGetItemsOptions, BoardQueryResponse, BoardCreateItemOptions, BoardUpdateItemOptions, BoardDeleteItemOptions, BoardSubmitItemOptions, BoardDiscardItemOptions, BoardFieldOptions } from "types/external";
600
911
  export class Board extends BaseSDK {
601
912
  private _id;
602
913
  constructor(flowId: string);
@@ -676,11 +987,47 @@ declare module "board/index" {
676
987
  getFields(options?: {
677
988
  viewId?: string;
678
989
  }): Promise<any>;
990
+ /**
991
+ * Initialize a form for a board item with all necessary setup
992
+ * Fetches schema, item data, creates and initializes the form store
993
+ *
994
+ * @param instanceId - Optional instance ID. If omitted, creates a new board item
995
+ * @param viewId - Optional view ID to scope the form's schema/permissions to a specific view
996
+ * @returns Promise with Form instance ready to use
997
+ *
998
+ * @example
999
+ * // Create new board item
1000
+ * const board = kf.app.getBoard("Inventory");
1001
+ * const form = await board.initForm();
1002
+ * await form.updateField({ Name: "New Item" });
1003
+ *
1004
+ * // Edit existing board item
1005
+ * const form = await board.initForm("item_123");
1006
+ * const data = await form.toJSON();
1007
+ *
1008
+ * // Edit existing board item scoped to a view
1009
+ * const form = await board.initForm("item_123", "Inventory_View");
1010
+ */
1011
+ initForm(instanceId?: string, viewId?: string): Promise<Form>;
1012
+ /**
1013
+ * Get field options for dropdown/lookup fields
1014
+ * @param options - Field options (instanceId, fieldId)
1015
+ * @returns Promise containing the field options
1016
+ *
1017
+ * @example
1018
+ * const board = kf.app.getBoard("Inventory");
1019
+ * const options = await board.getFieldOptions({
1020
+ * instanceId: "item_123",
1021
+ * fieldId: "Category"
1022
+ * });
1023
+ */
1024
+ getFieldOptions(options: BoardFieldOptions): Promise<any>;
679
1025
  }
680
1026
  }
681
1027
  declare module "process/index" {
682
1028
  import { BaseSDK } from "core/index";
683
- import { ProcessItem, ProcessGetItemOptions, ProcessMyItemsOptions, ProcessMyTasksOptions, ProcessParticipatedOptions, ProcessAdminOptions, ProcessQueryResponse, ProcessCreateItemOptions, ProcessUpdateItemOptions, ProcessDeleteItemOptions, ProcessSubmitItemOptions, ProcessRejectItemOptions, ProcessWithdrawItemOptions, ProcessSendbackItemOptions, ProcessReassignItemOptions, ProcessGetReassigneesOptions, ProcessRestartItemOptions, ProcessDiscardItemOptions } from "types/external";
1029
+ import { Form } from "form/index";
1030
+ 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";
684
1031
  export class Process extends BaseSDK {
685
1032
  private _id;
686
1033
  constructor(flowId: string);
@@ -732,7 +1079,7 @@ declare module "process/index" {
732
1079
  getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
733
1080
  /**
734
1081
  * Get a single process instance by ID
735
- * @param options - instanceId (required)
1082
+ * @param options - instanceId, activityInstanceId (both required)
736
1083
  * @returns Promise containing the instance data
737
1084
  */
738
1085
  getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
@@ -770,6 +1117,26 @@ declare module "process/index" {
770
1117
  * await process.deleteItem({ instanceId: "item_123" });
771
1118
  */
772
1119
  deleteItem(options: ProcessDeleteItemOptions): Promise<void>;
1120
+ /**
1121
+ * Get a single process instance as admin (requires admin access)
1122
+ * @param options - instanceId (required)
1123
+ * @returns Promise containing the instance data
1124
+ *
1125
+ * @example
1126
+ * const process = kf.app.getProcess("LeaveRequest");
1127
+ * const item = await process.getAdminItem({ instanceId: "item_123" });
1128
+ */
1129
+ getAdminItem(options: ProcessGetAdminItemOptions): Promise<ProcessItem>;
1130
+ /**
1131
+ * Update a process instance as admin (requires admin access)
1132
+ * @param options - instanceId, data (required)
1133
+ * @returns Promise containing the updated item
1134
+ *
1135
+ * @example
1136
+ * const process = kf.app.getProcess("LeaveRequest");
1137
+ * await process.updateAdminItem({ instanceId: "item_123", data: { LeaveType: "Sick" } });
1138
+ */
1139
+ updateAdminItem(options: ProcessUpdateAdminItemOptions): Promise<ProcessItem>;
773
1140
  /**
774
1141
  * Open the form UI for a process instance
775
1142
  * @param item - Process item with _id and _activity_instance_id
@@ -868,12 +1235,47 @@ declare module "process/index" {
868
1235
  getProgress(options: {
869
1236
  instanceId: string;
870
1237
  }): Promise<any>;
1238
+ /**
1239
+ * Initialize a form with all necessary data (schema, item data, form store)
1240
+ * This is the recommended way to create a custom form for dataform records
1241
+ * It automatically handles fetching schema, item data, and initializing the form store
1242
+ *
1243
+ * @param instanceId - Optional instance ID of the dataform record. If omitted, creates a new record
1244
+ * @returns Promise with Form instance ready to use
1245
+ *
1246
+ * @example
1247
+ * // Load existing record
1248
+ * const dataform = kf.app.getDataform("EmpMaster");
1249
+ * const form = await dataform.initForm("emp_123");
1250
+ * const data = await form.toJSON();
1251
+ *
1252
+ * // Create new record
1253
+ * const form = await dataform.initForm();
1254
+ * await form.updateField({ firstName: "John" });
1255
+ */
1256
+ initForm(instanceId?: string, activityInstanceId?: string): Promise<Form>;
1257
+ getFieldOptions(options?: ProcessFieldOptions): Promise<ProcessQueryResponse>;
1258
+ /**
1259
+ * Trigger AI document parsing on an uploaded file for a Smart Attachment field.
1260
+ * Matches native platform behavior: matching empty fields are auto-filled directly
1261
+ * into the form store (respecting field permissions) — no separate apply step needed.
1262
+ * Call `form.toJSON()` afterward to read the updated values.
1263
+ *
1264
+ * @example
1265
+ * const form = await process.initForm();
1266
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["pdf"], maxCount: 1 });
1267
+ * await form.updateField({ [fieldId]: files });
1268
+ * await process.parseAttachment({ instanceId: form.instanceId, fieldId, file: files[0] });
1269
+ * const updated = await form.toJSON(); // other fields now auto-filled
1270
+ */
1271
+ parseAttachment(options: ProcessParseAttachmentOptions): Promise<ProcessAttachmentParseResult>;
871
1272
  }
872
1273
  }
873
1274
  declare module "app/index" {
874
1275
  import { BaseSDK } from "core/index";
875
1276
  import { Page } from "app/page";
876
1277
  import { AppContext } from "types/internal";
1278
+ import { rolesObject } from "types/external";
877
1279
  import { DecisionTable } from "app/decisiontable";
878
1280
  import { Dataform } from "dataform/index";
879
1281
  import { Board } from "board/index";
@@ -889,6 +1291,43 @@ declare module "app/index" {
889
1291
  getDataform(flowId: string): Dataform;
890
1292
  getBoard(flowId: string): Board;
891
1293
  getProcess(flowId: string): Process;
1294
+ /**
1295
+ * List the app's roles and which of them the current user is a member of.
1296
+ *
1297
+ * Only available in a Development account - use this to build a role
1298
+ * picker UI inside the component, then pass the chosen role to
1299
+ * {@link switchRole}.
1300
+ *
1301
+ * @returns A promise that resolves with `{ roles, currentRoles }` - the
1302
+ * full list of app roles and the subset the current user belongs to.
1303
+ *
1304
+ * @example
1305
+ * const { roles, currentRoles } = await kf.app.getRoles();
1306
+ */
1307
+ getRoles(): Promise<{
1308
+ roles: rolesObject[];
1309
+ currentRoles: rolesObject[];
1310
+ }>;
1311
+ /**
1312
+ * Switch the current user's active role in a Development account.
1313
+ *
1314
+ * This performs a real role change - it removes the user from their
1315
+ * current role(s) and adds them to the target role. The platform's app
1316
+ * shell (top nav, other widgets) picks up the new role on its own; no
1317
+ * page reload happens. Only available in a Development account.
1318
+ *
1319
+ * @param args - Either `roleId` or `roleName` identifying the target role
1320
+ * (use the values returned by {@link getRoles}).
1321
+ * @returns A promise that resolves with the switched-to role.
1322
+ *
1323
+ * @example
1324
+ * const { roles } = await kf.app.getRoles();
1325
+ * await kf.app.switchRole({ roleId: roles[1]._id });
1326
+ */
1327
+ switchRole(args: {
1328
+ roleId?: string;
1329
+ roleName?: string;
1330
+ }): Promise<rolesObject>;
892
1331
  }
893
1332
  export * from "app/component";
894
1333
  export { Page };
@@ -916,42 +1355,6 @@ declare module "index" {
916
1355
  const _default: CustomComponentSDK;
917
1356
  export default _default;
918
1357
  }
919
- declare module "form/index" {
920
- import { BaseSDK } from "core/index";
921
- export class Form extends BaseSDK {
922
- private instanceId;
923
- type: string;
924
- constructor(instanceId: string);
925
- toJSON(): any;
926
- getField(fieldId: string): any;
927
- updateField(args: object): any;
928
- getTable(tableId: string): Table;
929
- }
930
- class Table extends BaseSDK {
931
- private tableId;
932
- private instanceId;
933
- constructor(instanceId: string, tableId: string);
934
- toJSON(): any;
935
- getSelectedRows(): any;
936
- getRows(): TableForm[];
937
- getRow(rowId: string): TableForm;
938
- addRow(rowObject: object): any;
939
- addRows(rows: object[]): any;
940
- deleteRow(rowId: string): any;
941
- deleteRows(rows: string[]): any;
942
- }
943
- export class TableForm extends BaseSDK {
944
- private instanceId;
945
- private tableId;
946
- private rowId;
947
- type: string;
948
- constructor(instanceId: string, tableId: string, rowId: string);
949
- getParent(): Form;
950
- toJSON(): any;
951
- getField(fieldId: string): any;
952
- updateField(args: object): any;
953
- }
954
- }
955
1358
  declare module "window/NDEFReader" {
956
1359
  import { BaseSDK } from "core/index";
957
1360
  export class NDEFReader extends BaseSDK {