@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/lowcode.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;
@@ -121,18 +143,27 @@ declare module "core/index" {
121
143
  declare module "form/index" {
122
144
  import { BaseSDK } from "core/index";
123
145
  export class Form extends BaseSDK {
124
- private instanceId;
146
+ private storeId;
147
+ private flowId;
125
148
  type: string;
126
- constructor(instanceId: string);
149
+ instanceId: string;
150
+ activityInstanceId?: string;
151
+ constructor(storeId: string, flowId: string, instanceId: string, activityInstanceId?: string);
127
152
  toJSON(): any;
128
153
  getField(fieldId: string): any;
129
154
  updateField(args: object): any;
155
+ getValidationErrors(): any;
156
+ getFormConfiguration(): any;
157
+ getFieldState(): any;
130
158
  getTable(tableId: string): Table;
131
159
  }
132
160
  class Table extends BaseSDK {
133
- private tableId;
161
+ private storeId;
162
+ private flowId;
134
163
  private instanceId;
135
- constructor(instanceId: string, tableId: string);
164
+ private tableId;
165
+ private activityInstanceId?;
166
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, activityInstanceId?: string);
136
167
  toJSON(): any;
137
168
  getSelectedRows(): any;
138
169
  getRows(): TableForm[];
@@ -143,132 +174,20 @@ declare module "form/index" {
143
174
  deleteRows(rows: string[]): any;
144
175
  }
145
176
  export class TableForm extends BaseSDK {
177
+ private storeId;
178
+ private flowId;
146
179
  private instanceId;
147
180
  private tableId;
148
181
  private rowId;
182
+ private activityInstanceId?;
149
183
  type: string;
150
- constructor(instanceId: string, tableId: string, rowId: string);
184
+ constructor(storeId: string, flowId: string, instanceId: string, tableId: string, rowId: string, activityInstanceId?: string);
151
185
  getParent(): Form;
152
186
  toJSON(): any;
153
187
  getField(fieldId: string): any;
154
188
  updateField(args: object): any;
155
189
  }
156
190
  }
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 "core/proxy" {
264
- export class CreateProxy {
265
- path: string[];
266
- parent: object;
267
- constructor(parent: object, target?: {}, path?: any[]);
268
- get(target: object, property: string): any;
269
- set(target: object, property: string, value: any, reciever: any): any;
270
- }
271
- }
272
191
  declare module "types/external" {
273
192
  export type QueryResponse = {
274
193
  items: any[];
@@ -326,6 +245,17 @@ declare module "types/external" {
326
245
  _id: string;
327
246
  _activity_instance_id: string;
328
247
  };
248
+ export type GeolocationValue = {
249
+ Address?: string;
250
+ Latitude: string;
251
+ Longitude: string;
252
+ City?: string;
253
+ State?: string;
254
+ Country?: string;
255
+ ZipCode?: string;
256
+ Area?: string;
257
+ PlaceId?: string;
258
+ };
329
259
  export type ProcessMyItemsOptions = BaseQueryOptions & {
330
260
  status?: "draft" | "inprogress" | "completed" | "withdrawn" | "rejected" | "all";
331
261
  payload?: ProcessPayloadOptions;
@@ -344,6 +274,7 @@ declare module "types/external" {
344
274
  export type ProcessQueryResponse = QueryResponse;
345
275
  export type ProcessGetItemOptions = {
346
276
  instanceId: string;
277
+ activityInstanceId: string;
347
278
  };
348
279
  export type ProcessCreateItemOptions = {
349
280
  data?: object;
@@ -356,6 +287,13 @@ declare module "types/external" {
356
287
  export type ProcessDeleteItemOptions = {
357
288
  instanceId: string;
358
289
  };
290
+ export type ProcessGetAdminItemOptions = {
291
+ instanceId: string;
292
+ };
293
+ export type ProcessUpdateAdminItemOptions = {
294
+ instanceId: string;
295
+ data: object;
296
+ };
359
297
  export type ProcessSubmitItemOptions = {
360
298
  instanceId: string;
361
299
  activityInstanceId: string;
@@ -398,6 +336,32 @@ declare module "types/external" {
398
336
  export type ProcessDiscardItemOptions = {
399
337
  instanceId: string;
400
338
  };
339
+ export type ProcessFieldOptions = {
340
+ instanceId: string;
341
+ activityInstanceId: string;
342
+ fieldId: string;
343
+ /** Skip the server-side model lookup by supplying the field's type directly. */
344
+ fieldType?: string;
345
+ tableId?: string;
346
+ tableRowId?: string;
347
+ };
348
+ export type ProcessAttachmentFile = {
349
+ id: string;
350
+ name: string;
351
+ key: string;
352
+ size?: number;
353
+ fileExtension?: string;
354
+ };
355
+ export type ProcessParseAttachmentOptions = {
356
+ instanceId: string;
357
+ activityInstanceId: string;
358
+ fieldId: string;
359
+ file: ProcessAttachmentFile;
360
+ };
361
+ export type ProcessAttachmentParseResult = {
362
+ appliedFields: string[];
363
+ suggestedBy: string;
364
+ };
401
365
  export type FetchOptions = {
402
366
  method?: string;
403
367
  body?: string | object;
@@ -433,6 +397,14 @@ declare module "types/external" {
433
397
  data?: object;
434
398
  viewId?: string;
435
399
  };
400
+ export type DataformFieldOptions = {
401
+ instanceId: string;
402
+ fieldId: string;
403
+ /** Skip the server-side model lookup by supplying the field's type directly. */
404
+ fieldType?: string;
405
+ tableId?: string;
406
+ tableRowId?: string;
407
+ };
436
408
  export type BoardGetItemsOptions = BaseQueryOptions & {
437
409
  viewId?: string;
438
410
  payload?: PayloadOptions;
@@ -458,11 +430,20 @@ declare module "types/external" {
458
430
  export type BoardDiscardItemOptions = {
459
431
  instanceId: string;
460
432
  };
433
+ export type BoardFieldOptions = {
434
+ instanceId: string;
435
+ fieldId: string;
436
+ /** Skip the server-side model lookup by supplying the field's type directly. */
437
+ fieldType?: string;
438
+ tableId?: string;
439
+ tableRowId?: string;
440
+ };
461
441
  }
462
442
  declare module "types/internal" {
463
443
  import { userObject, accountObject, environmentObject } from "types/external";
464
444
  export interface SDKContext {
465
445
  formInstanceId: string;
446
+ flowId: string;
466
447
  tableId: string;
467
448
  tableRowId: string;
468
449
  componentId: string;
@@ -490,10 +471,262 @@ declare module "types/internal" {
490
471
  }
491
472
  export interface PageContext {
492
473
  pageId: string;
474
+ initialRoute?: string;
493
475
  }
494
476
  export interface PopupContext {
495
477
  popupId?: string;
496
478
  }
479
+ export interface FilePickerOptions {
480
+ fileExtensions?: string[];
481
+ maxSize?: number;
482
+ maxCount?: number;
483
+ imageProps?: {
484
+ sizes?: Array<[number, number]>;
485
+ crop?: boolean;
486
+ };
487
+ }
488
+ export interface ScannerOptions {
489
+ /** Allow decoding from an uploaded image instead of the camera. */
490
+ localFileScan?: boolean;
491
+ }
492
+ /** Minimal shape of a browser File/Blob object, avoids requiring the DOM lib. */
493
+ export interface UploadableFile {
494
+ name: string;
495
+ size?: number;
496
+ type?: string;
497
+ }
498
+ }
499
+ declare module "utils/client" {
500
+ import { BaseSDK } from "core/index";
501
+ import { GeolocationValue } from "types/external";
502
+ import { FilePickerOptions, ScannerOptions, UploadableFile } from "types/internal";
503
+ export class Client extends BaseSDK {
504
+ /**
505
+ * Display an info message toast in the platform.
506
+ *
507
+ * @param message - The message to display. Accepts a string or object (serialized to JSON).
508
+ * @returns A promise that resolves when the message is shown.
509
+ *
510
+ * @example
511
+ * await kf.client.showInfo("Record saved successfully");
512
+ */
513
+ showInfo(message: string | object): any;
514
+ /**
515
+ * Display a confirmation dialog and wait for the user's response.
516
+ *
517
+ * @param args - Dialog configuration.
518
+ * @param args.title - Dialog title.
519
+ * @param args.content - Body text of the dialog.
520
+ * @param args.okText - Label for the confirm button (default: "Ok").
521
+ * @param args.cancelText - Label for the cancel button (default: "Cancel").
522
+ * @returns A promise that resolves with `{ action: "OK" }` or `{ action: "CANCEL" }`.
523
+ *
524
+ * @example
525
+ * const { action } = await kf.client.showConfirm({
526
+ * title: "Delete record?",
527
+ * content: "This cannot be undone.",
528
+ * okText: "Delete",
529
+ * cancelText: "Cancel",
530
+ * });
531
+ * if (action === "OK") { ... }
532
+ */
533
+ showConfirm(args: {
534
+ title: string;
535
+ content: string;
536
+ okText: string;
537
+ cancelText: string;
538
+ }): any;
539
+ /**
540
+ * Navigate the platform to the given URL.
541
+ *
542
+ * @param url - The URL to navigate to.
543
+ *
544
+ * @example
545
+ * kf.client.redirect("https://example.com");
546
+ */
547
+ redirect(url: string): any;
548
+ /**
549
+ * Resolve a Kissflow image field value to a base64 data URL.
550
+ *
551
+ * Custom components (iframes) cannot load Kissflow-hosted images directly due to
552
+ * CORS restrictions and 302 redirects to signed S3 URLs. This method fetches the
553
+ * image in the parent window (which has the required session cookies) and returns
554
+ * a self-contained `data:image/...;base64,...` URL that can be used as `<img src>`
555
+ * without any CORS issues.
556
+ *
557
+ * @param imageValue - The image field value must contain a `key` property and
558
+ * optionally a `photos` array. Uses `photos[1]` (preview resolution) when available,
559
+ * falls back to `key`.
560
+ * @returns A promise that resolves with the base64 data URL string.
561
+ *
562
+ * @example
563
+ * const dataUrl = await kf.client.getImageUrl(imageFieldValue);
564
+ * document.querySelector("#avatar").src = dataUrl;
565
+ */
566
+ getImageUrl(imageValue: Record<string, unknown>): any;
567
+ /**
568
+ * Open the platform's file picker, upload the selected file(s), and resolve
569
+ * with their metadata.
570
+ *
571
+ * Custom components (iframes) cannot access the platform's authenticated upload
572
+ * endpoints directly. This method opens the file picker in the parent window
573
+ * (which has the required session), runs the full select → upload flow, and
574
+ * resolves once all uploads settle with an array of the uploaded files'
575
+ * metadata (each including `key`, `name`, `size`, `photos`, etc. — the same
576
+ * shape consumed by `getImageUrl`).
577
+ *
578
+ * Always resolves with an array — a single-element array for single-file
579
+ * pickers (e.g. `maxCount: 1` for `Image`), one entry per uploaded file for
580
+ * multi-file pickers (e.g. `Attachment`). Resolves with `[]` if the user closes
581
+ * the picker without completing any upload.
582
+ *
583
+ * @param options - File picker configuration (e.g. `fileExtensions`, `maxSize`,
584
+ * `maxCount`, `imageProps`).
585
+ * @returns A promise that resolves with an array of uploaded file metadata
586
+ * objects (empty if the picker was closed without uploading anything).
587
+ *
588
+ * @example
589
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["JPG", "PNG"] });
590
+ * if (files.length) onChange(files[0]); // single-file consumer (Image)
591
+ *
592
+ * @example
593
+ * const files = await kf.client.openFilePicker({ maxCount: 10 });
594
+ * if (files.length) onChange([...existing, ...files]); // multi-file consumer (Attachment)
595
+ */
596
+ openFilePicker(options: FilePickerOptions): any;
597
+ /**
598
+ * Open the platform's barcode/QR scanner and resolve with the decoded text.
599
+ *
600
+ * The scanner UI (camera stream + decoding) runs in the parent window, which
601
+ * owns the camera permission — the iframe itself never accesses the camera.
602
+ * Camera-permission prompts and denials are handled inside the scanner UI;
603
+ * they are not surfaced as errors here.
604
+ *
605
+ * Resolves with `null` if the user closes the scanner without a successful
606
+ * scan (including the scanner's own inactivity timeout).
607
+ *
608
+ * Note: currently supported in web custom app UIs; the mobile (PWA) custom
609
+ * UI does not host the scanner portal yet.
610
+ *
611
+ * @param options - Scanner configuration (e.g. `localFileScan` to allow
612
+ * decoding from an uploaded image instead of the camera).
613
+ * @returns A promise that resolves with the decoded string, or `null` if the
614
+ * scanner was closed without scanning.
615
+ *
616
+ * @example
617
+ * const code = await kf.client.openScanner({ localFileScan: true });
618
+ * if (code) onChange(code);
619
+ */
620
+ openScanner(options?: ScannerOptions): any;
621
+ /**
622
+ * Open the platform's native Geolocation map picker (search, current-location
623
+ * detection, marker drag, reverse-geocoding) in a modal over the custom
624
+ * form/component. Runs in the parent window, which owns the Google Maps API
625
+ * key — the iframe itself never needs one.
626
+ *
627
+ * Resolves with `null` if the user closes the picker without selecting a
628
+ * location.
629
+ *
630
+ * @param value - Optional current geolocation value to pre-select on the map.
631
+ * @returns A promise that resolves with the picked location object, or
632
+ * `null` if the picker was closed without a selection.
633
+ *
634
+ * @example
635
+ * const location = await kf.client.pickLocation();
636
+ * if (location) onChange(location);
637
+ */
638
+ pickLocation(value?: GeolocationValue): any;
639
+ /**
640
+ * Upload a File object to Kissflow's S3 storage and resolve with its metadata.
641
+ *
642
+ * Use this when you have a File/Blob already in memory (e.g. a canvas drawing
643
+ * converted to a PNG blob) and need to upload it without opening a file picker UI.
644
+ * The platform runs the upload in the parent window (which has the required session)
645
+ * and resolves with the uploaded file's `{ key, name, ... }` metadata — the same
646
+ * shape returned by `openFilePicker`.
647
+ *
648
+ * Resolves with `null` if the upload fails.
649
+ *
650
+ * @param file - The File or Blob to upload.
651
+ * @param fileName - Optional file name override (defaults to `file.name`).
652
+ * @returns A promise that resolves with the uploaded file metadata, or `null` on failure.
653
+ *
654
+ * @example
655
+ * const blob = await new Promise<Blob>(res => canvas.toBlob(res, 'image/png'));
656
+ * const file = new File([blob], 'signature.png', { type: 'image/png' });
657
+ * const result = await kf.client.uploadFile(file);
658
+ * if (result) onChange(result);
659
+ */
660
+ uploadFile(file: UploadableFile, fileName?: string): any;
661
+ /**
662
+ * Open the platform's file preview (lightbox) for one or more files.
663
+ *
664
+ * `files` always accepts an array — pass a single-element array for fields like
665
+ * `Image`, or the full list for multi-file fields like `Attachment`. The host's
666
+ * preview UI natively renders next/prev navigation across the array; the SDK
667
+ * just passes the file list through, no extra navigation surface is needed here.
668
+ *
669
+ * @param args - Preview configuration.
670
+ * @param args.files - Array of file metadata objects to preview.
671
+ * @param args.indexOfFile - Index of the file to open the preview on (default: 0).
672
+ * @returns A promise that resolves once the user closes the preview.
673
+ *
674
+ * @example
675
+ * await kf.client.openFilePreview({ files: [imageFieldValue] });
676
+ * await kf.client.openFilePreview({ files: attachmentFieldValue, indexOfFile: 2 });
677
+ */
678
+ openFilePreview(args: {
679
+ files: Record<string, unknown>[];
680
+ indexOfFile?: number;
681
+ }): any;
682
+ }
683
+ }
684
+ declare module "utils/formatter" {
685
+ import { BaseSDK } from "core/index";
686
+ export class Formatter extends BaseSDK {
687
+ toDate(date: string): any;
688
+ toDateTime(date: string): any;
689
+ toNumber(value: string): any;
690
+ toCurrency(value: string, currencyCode: string): any;
691
+ toBoolean(value: string): any;
692
+ }
693
+ }
694
+ declare module "utils/validation" {
695
+ /**
696
+ * Validation utilities for SDK methods
697
+ */
698
+ /**
699
+ * Throws error if value is falsy
700
+ */
701
+ export function requireField(value: any, fieldName: string): void;
702
+ /**
703
+ * Returns a rejected promise if value is falsy, null otherwise
704
+ * Use for async validation in SDK methods
705
+ */
706
+ export function requireFieldAsync(value: any, fieldName: string): Promise<never> | null;
707
+ /**
708
+ * Returns a rejected promise if any of the values are falsy
709
+ * Use for validating multiple required fields
710
+ */
711
+ export function requireFieldsAsync(fields: Array<{
712
+ value: any;
713
+ name: string;
714
+ }>): Promise<never> | null;
715
+ }
716
+ declare module "utils/index" {
717
+ export * from "utils/client";
718
+ export * from "utils/formatter";
719
+ export * from "utils/validation";
720
+ export const isObject: (value: any) => boolean;
721
+ }
722
+ declare module "core/proxy" {
723
+ export class CreateProxy {
724
+ path: string[];
725
+ parent: object;
726
+ constructor(parent: object, target?: {}, path?: any[]);
727
+ get(target: object, property: string): any;
728
+ set(target: object, property: string, value: any, reciever: any): any;
729
+ }
497
730
  }
498
731
  declare module "app/component" {
499
732
  import { BaseSDK } from "core/index";
@@ -515,6 +748,14 @@ declare module "app/component" {
515
748
  _id: string;
516
749
  constructor(id: any);
517
750
  watchParams(callBack: (data: any) => any): void;
751
+ /**
752
+ * Subscribe to route changes pushed by the Kissflow host
753
+ * (parent back/forward or deep-link). Used by the App UI framework
754
+ * to keep the in-iframe router in sync with the parent URL.
755
+ */
756
+ watchRoute(callBack: (data: {
757
+ route: string;
758
+ }) => any): void;
518
759
  }
519
760
  }
520
761
  declare module "app/popup" {
@@ -540,6 +781,7 @@ declare module "app/page" {
540
781
  _id: string;
541
782
  popup: Popup;
542
783
  type: string;
784
+ _route: string;
543
785
  constructor(props: PageContext, isCustomComponent?: boolean);
544
786
  getParameter(key: string): any;
545
787
  getAllParameters(): any;
@@ -547,6 +789,13 @@ declare module "app/page" {
547
789
  setVariable(key: string | object, value?: any): any;
548
790
  openPopup(popupId: string, popupParams?: object): any;
549
791
  getComponent(componentId: string): Component;
792
+ /**
793
+ * Notify the Kissflow host that the custom UI navigated to `path`,
794
+ * so the parent browser URL mirrors the route. Used by the App UI framework.
795
+ */
796
+ setRoute(path: string): void;
797
+ /** Returns the initial deep-link route the page was opened with. */
798
+ getRoute(): string;
550
799
  }
551
800
  }
552
801
  declare module "app/decisiontable" {
@@ -559,7 +808,8 @@ declare module "app/decisiontable" {
559
808
  }
560
809
  declare module "dataform/index" {
561
810
  import { BaseSDK } from "core/index";
562
- 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";
563
813
  export class Dataform extends BaseSDK {
564
814
  private _id;
565
815
  constructor(flowId: string);
@@ -628,11 +878,36 @@ declare module "dataform/index" {
628
878
  getFields(options?: {
629
879
  viewId?: string;
630
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>;
631
905
  }
632
906
  }
633
907
  declare module "board/index" {
634
908
  import { BaseSDK } from "core/index";
635
- 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";
636
911
  export class Board extends BaseSDK {
637
912
  private _id;
638
913
  constructor(flowId: string);
@@ -712,11 +987,47 @@ declare module "board/index" {
712
987
  getFields(options?: {
713
988
  viewId?: string;
714
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>;
715
1025
  }
716
1026
  }
717
1027
  declare module "process/index" {
718
1028
  import { BaseSDK } from "core/index";
719
- 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";
720
1031
  export class Process extends BaseSDK {
721
1032
  private _id;
722
1033
  constructor(flowId: string);
@@ -768,7 +1079,7 @@ declare module "process/index" {
768
1079
  getAdminItems(options?: ProcessAdminOptions): Promise<ProcessQueryResponse>;
769
1080
  /**
770
1081
  * Get a single process instance by ID
771
- * @param options - instanceId (required)
1082
+ * @param options - instanceId, activityInstanceId (both required)
772
1083
  * @returns Promise containing the instance data
773
1084
  */
774
1085
  getItem(options: ProcessGetItemOptions): Promise<ProcessItem>;
@@ -806,6 +1117,26 @@ declare module "process/index" {
806
1117
  * await process.deleteItem({ instanceId: "item_123" });
807
1118
  */
808
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>;
809
1140
  /**
810
1141
  * Open the form UI for a process instance
811
1142
  * @param item - Process item with _id and _activity_instance_id
@@ -904,12 +1235,47 @@ declare module "process/index" {
904
1235
  getProgress(options: {
905
1236
  instanceId: string;
906
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>;
907
1272
  }
908
1273
  }
909
1274
  declare module "app/index" {
910
1275
  import { BaseSDK } from "core/index";
911
1276
  import { Page } from "app/page";
912
1277
  import { AppContext } from "types/internal";
1278
+ import { rolesObject } from "types/external";
913
1279
  import { DecisionTable } from "app/decisiontable";
914
1280
  import { Dataform } from "dataform/index";
915
1281
  import { Board } from "board/index";
@@ -925,6 +1291,43 @@ declare module "app/index" {
925
1291
  getDataform(flowId: string): Dataform;
926
1292
  getBoard(flowId: string): Board;
927
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>;
928
1331
  }
929
1332
  export * from "app/component";
930
1333
  export { Page };