@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.
@@ -1,9 +1,14 @@
1
1
 
2
2
  declare class Form {
3
3
  type: string
4
+ instanceId: string
5
+ activityInstanceId: string
4
6
  toJSON(): any;
5
7
  getField(fieldId: string): any;
6
8
  updateField(args: object): any;
9
+ getValidationErrors(): any;
10
+ getFormConfiguration(): any;
11
+ getFieldState(): any;
7
12
  getTable(tableId: string): Table;
8
13
  }
9
14
  declare class Table {
@@ -87,6 +92,121 @@ declare class Client {
87
92
  * document.querySelector("#avatar").src = dataUrl;
88
93
  */
89
94
  getImageUrl(imageValue: Record<string, unknown>): any;
95
+ /**
96
+ * Open the platform's file picker, upload the selected file(s), and resolve
97
+ * with their metadata.
98
+ *
99
+ * Custom components (iframes) cannot access the platform's authenticated upload
100
+ * endpoints directly. This method opens the file picker in the parent window
101
+ * (which has the required session), runs the full select → upload flow, and
102
+ * resolves once all uploads settle with an array of the uploaded files'
103
+ * metadata (each including `key`, `name`, `size`, `photos`, etc. — the same
104
+ * shape consumed by `getImageUrl`).
105
+ *
106
+ * Always resolves with an array — a single-element array for single-file
107
+ * pickers (e.g. `maxCount: 1` for `Image`), one entry per uploaded file for
108
+ * multi-file pickers (e.g. `Attachment`). Resolves with `[]` if the user closes
109
+ * the picker without completing any upload.
110
+ *
111
+ * @param options - File picker configuration (e.g. `fileExtensions`, `maxSize`,
112
+ * `maxCount`, `imageProps`).
113
+ * @returns A promise that resolves with an array of uploaded file metadata
114
+ * objects (empty if the picker was closed without uploading anything).
115
+ *
116
+ * @example
117
+ * const files = await kf.client.openFilePicker({ fileExtensions: ["JPG", "PNG"] });
118
+ * if (files.length) onChange(files[0]); // single-file consumer (Image)
119
+ *
120
+ * @example
121
+ * const files = await kf.client.openFilePicker({ maxCount: 10 });
122
+ * if (files.length) onChange([...existing, ...files]); // multi-file consumer (Attachment)
123
+ */
124
+ openFilePicker(options: FilePickerOptions): any;
125
+ /**
126
+ * Open the platform's barcode/QR scanner and resolve with the decoded text.
127
+ *
128
+ * The scanner UI (camera stream + decoding) runs in the parent window, which
129
+ * owns the camera permission — the iframe itself never accesses the camera.
130
+ * Camera-permission prompts and denials are handled inside the scanner UI;
131
+ * they are not surfaced as errors here.
132
+ *
133
+ * Resolves with `null` if the user closes the scanner without a successful
134
+ * scan (including the scanner's own inactivity timeout).
135
+ *
136
+ * Note: currently supported in web custom app UIs; the mobile (PWA) custom
137
+ * UI does not host the scanner portal yet.
138
+ *
139
+ * @param options - Scanner configuration (e.g. `localFileScan` to allow
140
+ * decoding from an uploaded image instead of the camera).
141
+ * @returns A promise that resolves with the decoded string, or `null` if the
142
+ * scanner was closed without scanning.
143
+ *
144
+ * @example
145
+ * const code = await kf.client.openScanner({ localFileScan: true });
146
+ * if (code) onChange(code);
147
+ */
148
+ openScanner(options?: ScannerOptions): any;
149
+ /**
150
+ * Open the platform's native Geolocation map picker (search, current-location
151
+ * detection, marker drag, reverse-geocoding) in a modal over the custom
152
+ * form/component. Runs in the parent window, which owns the Google Maps API
153
+ * key — the iframe itself never needs one.
154
+ *
155
+ * Resolves with `null` if the user closes the picker without selecting a
156
+ * location.
157
+ *
158
+ * @param value - Optional current geolocation value to pre-select on the map.
159
+ * @returns A promise that resolves with the picked location object, or
160
+ * `null` if the picker was closed without a selection.
161
+ *
162
+ * @example
163
+ * const location = await kf.client.pickLocation();
164
+ * if (location) onChange(location);
165
+ */
166
+ pickLocation(value?: GeolocationValue): any;
167
+ /**
168
+ * Upload a File object to Kissflow's S3 storage and resolve with its metadata.
169
+ *
170
+ * Use this when you have a File/Blob already in memory (e.g. a canvas drawing
171
+ * converted to a PNG blob) and need to upload it without opening a file picker UI.
172
+ * The platform runs the upload in the parent window (which has the required session)
173
+ * and resolves with the uploaded file's `{ key, name, ... }` metadata — the same
174
+ * shape returned by `openFilePicker`.
175
+ *
176
+ * Resolves with `null` if the upload fails.
177
+ *
178
+ * @param file - The File or Blob to upload.
179
+ * @param fileName - Optional file name override (defaults to `file.name`).
180
+ * @returns A promise that resolves with the uploaded file metadata, or `null` on failure.
181
+ *
182
+ * @example
183
+ * const blob = await new Promise<Blob>(res => canvas.toBlob(res, 'image/png'));
184
+ * const file = new File([blob], 'signature.png', { type: 'image/png' });
185
+ * const result = await kf.client.uploadFile(file);
186
+ * if (result) onChange(result);
187
+ */
188
+ uploadFile(file: UploadableFile, fileName?: string): any;
189
+ /**
190
+ * Open the platform's file preview (lightbox) for one or more files.
191
+ *
192
+ * `files` always accepts an array — pass a single-element array for fields like
193
+ * `Image`, or the full list for multi-file fields like `Attachment`. The host's
194
+ * preview UI natively renders next/prev navigation across the array; the SDK
195
+ * just passes the file list through, no extra navigation surface is needed here.
196
+ *
197
+ * @param args - Preview configuration.
198
+ * @param args.files - Array of file metadata objects to preview.
199
+ * @param args.indexOfFile - Index of the file to open the preview on (default: 0).
200
+ * @returns A promise that resolves once the user closes the preview.
201
+ *
202
+ * @example
203
+ * await kf.client.openFilePreview({ files: [imageFieldValue] });
204
+ * await kf.client.openFilePreview({ files: attachmentFieldValue, indexOfFile: 2 });
205
+ */
206
+ openFilePreview(args: {
207
+ files: Record<string, unknown>[];
208
+ indexOfFile?: number;
209
+ }): any;
90
210
  }
91
211
  declare class Formatter {
92
212
  toDate(date: string): any;
@@ -180,6 +300,25 @@ declare type ProcessItem = {
180
300
  _activity_instance_id: string;
181
301
  };
182
302
 
303
+ // ============================================
304
+ // Form Field Value Types
305
+ // ============================================
306
+
307
+ // The value shape a Geolocation field is stored/read as across the platform
308
+ // (native forms and custom forms alike) — Latitude/Longitude are stringified
309
+ // on save, matching the native Geolocation field's saved representation.
310
+ declare type GeolocationValue = {
311
+ Address?: string;
312
+ Latitude: string;
313
+ Longitude: string;
314
+ City?: string;
315
+ State?: string;
316
+ Country?: string;
317
+ ZipCode?: string;
318
+ Area?: string;
319
+ PlaceId?: string;
320
+ };
321
+
183
322
  // ============================================
184
323
  // Process Types
185
324
  // ============================================
@@ -213,6 +352,7 @@ declare type ProcessQueryResponse = QueryResponse;
213
352
 
214
353
  declare type ProcessGetItemOptions = {
215
354
  instanceId: string;
355
+ activityInstanceId: string;
216
356
  };
217
357
 
218
358
  declare type ProcessCreateItemOptions = {
@@ -229,6 +369,15 @@ declare type ProcessDeleteItemOptions = {
229
369
  instanceId: string;
230
370
  };
231
371
 
372
+ declare type ProcessGetAdminItemOptions = {
373
+ instanceId: string;
374
+ };
375
+
376
+ declare type ProcessUpdateAdminItemOptions = {
377
+ instanceId: string;
378
+ data: object;
379
+ };
380
+
232
381
  declare type ProcessSubmitItemOptions = {
233
382
  instanceId: string;
234
383
  activityInstanceId: string;
@@ -279,6 +428,36 @@ declare type ProcessDiscardItemOptions = {
279
428
  instanceId: string;
280
429
  };
281
430
 
431
+ declare type ProcessFieldOptions = {
432
+ instanceId: string;
433
+ activityInstanceId: string;
434
+ fieldId: string;
435
+ /** Skip the server-side model lookup by supplying the field's type directly. */
436
+ fieldType?: string;
437
+ tableId?: string;
438
+ tableRowId?: string;
439
+ };
440
+
441
+ declare type ProcessAttachmentFile = {
442
+ id: string;
443
+ name: string;
444
+ key: string;
445
+ size?: number;
446
+ fileExtension?: string;
447
+ };
448
+
449
+ declare type ProcessParseAttachmentOptions = {
450
+ instanceId: string; // form.instanceId (process record id)
451
+ activityInstanceId: string;
452
+ fieldId: string;
453
+ file: ProcessAttachmentFile;
454
+ };
455
+
456
+ declare type ProcessAttachmentParseResult = {
457
+ appliedFields: string[]; // field IDs auto-filled into the form store
458
+ suggestedBy: string; // name of the parsed file
459
+ };
460
+
282
461
  declare type FetchOptions = {
283
462
  method?: string;
284
463
  body?: string | object;
@@ -327,6 +506,15 @@ declare type DataformSubmitItemOptions = {
327
506
  viewId?: string;
328
507
  };
329
508
 
509
+ declare type DataformFieldOptions = {
510
+ instanceId: string;
511
+ fieldId: string;
512
+ /** Skip the server-side model lookup by supplying the field's type directly. */
513
+ fieldType?: string;
514
+ tableId?: string;
515
+ tableRowId?: string;
516
+ };
517
+
330
518
  // ============================================
331
519
  // Board Types
332
520
  // ============================================
@@ -363,3 +551,12 @@ declare type BoardSubmitItemOptions = {
363
551
  declare type BoardDiscardItemOptions = {
364
552
  instanceId: string;
365
553
  };
554
+
555
+ declare type BoardFieldOptions = {
556
+ instanceId: string;
557
+ fieldId: string;
558
+ /** Skip the server-side model lookup by supplying the field's type directly. */
559
+ fieldType?: string;
560
+ tableId?: string;
561
+ tableRowId?: string;
562
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.44",
3
+ "version": "1.0.49",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -17,6 +17,9 @@
17
17
  "import": "./dist/kf.lowcodeworkersdk.es.js"
18
18
  }
19
19
  },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
20
23
  "repository": {
21
24
  "type": "git",
22
25
  "url": "git+https://github.com/kissflow/lcnc-sdk-js.git"