@kissflow/lowcode-client-sdk 1.0.43 → 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/kfsdk.es.js CHANGED
@@ -40,6 +40,9 @@ const LISTENER_CMDS = {
40
40
  RETURN: "RETURN",
41
41
  GET_FORM_FIELD: "GET_FORM_FIELD",
42
42
  UPDATE_FORM: "UPDATE_FORM",
43
+ GET_FORM_VALIDATION_ERRORS: "GET_FORM_VALIDATION_ERRORS",
44
+ GET_FORM_CONFIGURATION: "GET_FORM_CONFIGURATION",
45
+ GET_FORM_FIELD_STATE: "GET_FORM_FIELD_STATE",
43
46
  GET_TABLE: "GET_TABLE",
44
47
  GET_TABLE_ROW: "GET_TABLE_ROW",
45
48
  ADD_TABLE_ROW: "ADD_TABLE_ROW",
@@ -54,6 +57,13 @@ const LISTENER_CMDS = {
54
57
  REDIRECT: "REDIRECT",
55
58
  OPEN_PAGE: "OPEN_PAGE",
56
59
  GET_IMAGE_URL: "GET_IMAGE_URL",
60
+ FILEPICKER_OPEN: "FILEPICKER_OPEN",
61
+ FILEPREVIEW_OPEN: "FILEPREVIEW_OPEN",
62
+ FILE_UPLOAD: "FILE_UPLOAD",
63
+ SCANNER_OPEN: "SCANNER_OPEN",
64
+ GEOLOCATION_OPEN: "GEOLOCATION_OPEN",
65
+ GET_ROLES: "GET_ROLES",
66
+ SWITCH_ROLE: "SWITCH_ROLE",
57
67
  FORMAT_DATE: "FORMAT_DATE",
58
68
  FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
59
69
  FORMAT_NUMBER: "FORMAT_NUMBER",
@@ -77,6 +87,8 @@ const LISTENER_CMDS = {
77
87
  COMPONENT_ADD_EVENT_LISTENER: "COMPONENT_ADD_EVENT_LISTENER",
78
88
  CC_INITIALIZE: "CC_INITIALIZE",
79
89
  CC_WATCH_PARAMS: "CC_WATCH_PARAMS",
90
+ CC_SET_ROUTE: "CC_SET_ROUTE",
91
+ CC_WATCH_ROUTE: "CC_WATCH_ROUTE",
80
92
  WINDOW_NDEF_READER_NEW: "WINDOW_NDEF_READER_NEW",
81
93
  WINDOW_NDEF_READER_SCAN: "WINDOW_NDEF_READER_SCAN",
82
94
  WINDOW_NDEF_READER_WRITE: "WINDOW_NDEF_READER_WRITE",
@@ -94,6 +106,8 @@ const LISTENER_CMDS = {
94
106
  DATAFORM_DELETE_ITEM: "DATAFORM_DELETE_ITEM",
95
107
  DATAFORM_DISCARD_ITEM: "DATAFORM_DISCARD_ITEM",
96
108
  DATAFORM_SUBMIT_ITEM: "DATAFORM_SUBMIT_ITEM",
109
+ DATAFORM_INIT_FORM: "DATAFORM_INIT_FORM",
110
+ DATAFORM_GET_FIELD_OPTIONS: "DATAFORM_GET_FIELD_OPTIONS",
97
111
  PROCESS_OPEN_FORM: "PROCESS_OPEN_FORM",
98
112
  PROCESS_GET_FIELDS: "PROCESS_GET_FIELDS",
99
113
  PROCESS_GET_MYTASK_FIELDS: "PROCESS_GET_MYTASK_FIELDS",
@@ -107,6 +121,8 @@ const LISTENER_CMDS = {
107
121
  PROCESS_UPDATE_ITEM: "PROCESS_UPDATE_ITEM",
108
122
  PROCESS_GET_ITEM: "PROCESS_GET_ITEM",
109
123
  PROCESS_DELETE_ITEM: "PROCESS_DELETE_ITEM",
124
+ PROCESS_GET_ADMIN_ITEM: "PROCESS_GET_ADMIN_ITEM",
125
+ PROCESS_UPDATE_ADMIN_ITEM: "PROCESS_UPDATE_ADMIN_ITEM",
110
126
  PROCESS_SUBMIT_ITEM: "PROCESS_SUBMIT_ITEM",
111
127
  PROCESS_REJECT_ITEM: "PROCESS_REJECT_ITEM",
112
128
  PROCESS_WITHDRAW_ITEM: "PROCESS_WITHDRAW_ITEM",
@@ -116,6 +132,9 @@ const LISTENER_CMDS = {
116
132
  PROCESS_RESTART_ITEM: "PROCESS_RESTART_ITEM",
117
133
  PROCESS_DISCARD_ITEM: "PROCESS_DISCARD_ITEM",
118
134
  PROCESS_GET_PROGRESS: "PROCESS_GET_PROGRESS",
135
+ PROCESS_INIT_FORM: "PROCESS_INIT_FORM",
136
+ PROCESS_GET_FIELD_OPTIONS: "PROCESS_GET_FIELD_OPTIONS",
137
+ PROCESS_PARSE_ATTACHMENT: "PROCESS_PARSE_ATTACHMENT",
119
138
  BOARD_IMPORT_CSV: "BOARD_IMPORT_CSV",
120
139
  BOARD_OPEN_FORM: "BOARD_OPEN_FORM",
121
140
  BOARD_GET_FIELDS: "BOARD_GET_FIELDS",
@@ -125,11 +144,14 @@ const LISTENER_CMDS = {
125
144
  BOARD_GET_ITEM: "BOARD_GET_ITEM",
126
145
  BOARD_DELETE_ITEM: "BOARD_DELETE_ITEM",
127
146
  BOARD_SUBMIT_ITEM: "BOARD_SUBMIT_ITEM",
128
- BOARD_DISCARD_ITEM: "BOARD_DISCARD_ITEM"
147
+ BOARD_DISCARD_ITEM: "BOARD_DISCARD_ITEM",
148
+ BOARD_INIT_FORM: "BOARD_INIT_FORM",
149
+ BOARD_GET_FIELD_OPTIONS: "BOARD_GET_FIELD_OPTIONS"
129
150
  };
130
151
  const EVENT_TYPES = {
131
152
  COMPONENT_ON_MOUNT: "componentOnMount",
132
- CC_ON_PARAMS_CHANGE: "onCustomComponentParamsChange"
153
+ CC_ON_PARAMS_CHANGE: "onCustomComponentParamsChange",
154
+ CC_ON_ROUTE_CHANGE: "onCustomComponentRouteChange"
133
155
  };
134
156
  const DEFAULTS = {
135
157
  POPUP_ID: "ACTIVE_POP_UP"
@@ -321,7 +343,37 @@ class Client extends BaseSDK {
321
343
  return super._postMessageAsync(LISTENER_CMDS.REDIRECT, { url });
322
344
  }
323
345
  getImageUrl(imageValue) {
324
- return this._postMessageAsync(LISTENER_CMDS.GET_IMAGE_URL, { imageValue });
346
+ return this._postMessageAsync(LISTENER_CMDS.GET_IMAGE_URL, {
347
+ imageValue
348
+ });
349
+ }
350
+ openFilePicker(options) {
351
+ return this._postMessageAsync(LISTENER_CMDS.FILEPICKER_OPEN, {
352
+ options
353
+ });
354
+ }
355
+ openScanner(options = {}) {
356
+ return this._postMessageAsync(LISTENER_CMDS.SCANNER_OPEN, {
357
+ options
358
+ });
359
+ }
360
+ pickLocation(value) {
361
+ return this._postMessageAsync(LISTENER_CMDS.GEOLOCATION_OPEN, {
362
+ value
363
+ });
364
+ }
365
+ uploadFile(file, fileName) {
366
+ return this._postMessageAsync(LISTENER_CMDS.FILE_UPLOAD, {
367
+ file,
368
+ fileName: fileName != null ? fileName : file.name
369
+ });
370
+ }
371
+ openFilePreview(args) {
372
+ var _a;
373
+ return this._postMessageAsync(LISTENER_CMDS.FILEPREVIEW_OPEN, {
374
+ files: args.files,
375
+ indexOfFile: (_a = args.indexOfFile) != null ? _a : 0
376
+ });
325
377
  }
326
378
  }
327
379
  class Formatter extends BaseSDK {
@@ -448,6 +500,19 @@ class CustomComponent extends BaseSDK {
448
500
  callBack
449
501
  );
450
502
  }
503
+ watchRoute(callBack) {
504
+ this._postMessage(
505
+ LISTENER_CMDS.CC_WATCH_ROUTE,
506
+ {
507
+ id: this._id,
508
+ eventName: EVENT_TYPES.CC_ON_ROUTE_CHANGE,
509
+ eventConfig: {
510
+ once: false
511
+ }
512
+ },
513
+ callBack
514
+ );
515
+ }
451
516
  }
452
517
  class Popup extends BaseSDK {
453
518
  constructor(props) {
@@ -482,10 +547,12 @@ class Popup extends BaseSDK {
482
547
  }
483
548
  class Page extends BaseSDK {
484
549
  constructor(props, isCustomComponent = false) {
550
+ var _a;
485
551
  super();
486
552
  this.type = "Page";
487
553
  this.popup = new Popup({});
488
554
  this._id = props.pageId;
555
+ this._route = (_a = props.initialRoute) != null ? _a : "";
489
556
  }
490
557
  getParameter(key) {
491
558
  return this._postMessageAsync(LISTENER_CMDS.GET_PAGE_PARAMS, {
@@ -522,6 +589,13 @@ class Page extends BaseSDK {
522
589
  (data) => new Component(data)
523
590
  );
524
591
  }
592
+ setRoute(path) {
593
+ this._route = path;
594
+ return this._postMessage(LISTENER_CMDS.CC_SET_ROUTE, { route: path });
595
+ }
596
+ getRoute() {
597
+ return this._route;
598
+ }
525
599
  }
526
600
  class DecisionTable extends BaseSDK {
527
601
  constructor(flowId) {
@@ -535,6 +609,201 @@ class DecisionTable extends BaseSDK {
535
609
  });
536
610
  }
537
611
  }
612
+ class Form extends BaseSDK {
613
+ constructor(storeId, flowId, instanceId, activityInstanceId) {
614
+ super();
615
+ this.type = "Form";
616
+ this.storeId = storeId;
617
+ this.flowId = flowId;
618
+ this.instanceId = instanceId;
619
+ this.activityInstanceId = activityInstanceId;
620
+ }
621
+ toJSON() {
622
+ return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
623
+ storeId: this.storeId,
624
+ instanceId: this.instanceId
625
+ });
626
+ }
627
+ getField(fieldId) {
628
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD, {
629
+ storeId: this.storeId,
630
+ instanceId: this.instanceId,
631
+ fieldId
632
+ });
633
+ }
634
+ updateField(args) {
635
+ return this._postMessageAsync(LISTENER_CMDS.UPDATE_FORM, {
636
+ storeId: this.storeId,
637
+ instanceId: this.instanceId,
638
+ data: args
639
+ });
640
+ }
641
+ getValidationErrors() {
642
+ return this._postMessageAsync(
643
+ LISTENER_CMDS.GET_FORM_VALIDATION_ERRORS,
644
+ {
645
+ storeId: this.storeId,
646
+ instanceId: this.instanceId
647
+ }
648
+ );
649
+ }
650
+ getFormConfiguration() {
651
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_CONFIGURATION, {
652
+ storeId: this.storeId,
653
+ instanceId: this.instanceId
654
+ });
655
+ }
656
+ getFieldState() {
657
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD_STATE, {
658
+ storeId: this.storeId,
659
+ instanceId: this.instanceId
660
+ });
661
+ }
662
+ getTable(tableId) {
663
+ return new Table(
664
+ this.storeId,
665
+ this.flowId,
666
+ this.instanceId,
667
+ tableId,
668
+ this.activityInstanceId
669
+ );
670
+ }
671
+ }
672
+ class Table extends BaseSDK {
673
+ constructor(storeId, flowId, instanceId, tableId, activityInstanceId) {
674
+ super();
675
+ this.tableId = tableId;
676
+ this.storeId = storeId;
677
+ this.flowId = flowId;
678
+ this.instanceId = instanceId;
679
+ this.activityInstanceId = activityInstanceId;
680
+ }
681
+ toJSON() {
682
+ return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
683
+ storeId: this.storeId,
684
+ instanceId: this.instanceId,
685
+ tableId: this.tableId
686
+ });
687
+ }
688
+ getSelectedRows() {
689
+ return this._postMessageAsync(LISTENER_CMDS.GET_SELECTED_TABLE_ROWS, {
690
+ storeId: this.storeId,
691
+ instanceId: this.instanceId,
692
+ tableId: this.tableId
693
+ });
694
+ }
695
+ getRows() {
696
+ return this._postMessageAsync(
697
+ LISTENER_CMDS.GET_TABLE_ROWS,
698
+ {
699
+ storeId: this.storeId,
700
+ instanceId: this.instanceId,
701
+ tableId: this.tableId
702
+ },
703
+ true,
704
+ (data) => {
705
+ return data.map(
706
+ (row) => new TableForm(
707
+ this.storeId,
708
+ this.flowId,
709
+ this.instanceId,
710
+ this.tableId,
711
+ row.id,
712
+ this.activityInstanceId
713
+ )
714
+ );
715
+ }
716
+ );
717
+ }
718
+ getRow(rowId) {
719
+ return new TableForm(
720
+ this.storeId,
721
+ this.flowId,
722
+ this.instanceId,
723
+ this.tableId,
724
+ rowId,
725
+ this.activityInstanceId
726
+ );
727
+ }
728
+ addRow(rowObject) {
729
+ return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROW, {
730
+ storeId: this.storeId,
731
+ instanceId: this.instanceId,
732
+ tableId: this.tableId,
733
+ rowObject
734
+ });
735
+ }
736
+ addRows(rows) {
737
+ return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROWS, {
738
+ storeId: this.storeId,
739
+ instanceId: this.instanceId,
740
+ tableId: this.tableId,
741
+ rows
742
+ });
743
+ }
744
+ deleteRow(rowId) {
745
+ return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
746
+ storeId: this.storeId,
747
+ instanceId: this.instanceId,
748
+ tableId: this.tableId,
749
+ rows: [rowId]
750
+ });
751
+ }
752
+ deleteRows(rows) {
753
+ return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
754
+ storeId: this.storeId,
755
+ instanceId: this.instanceId,
756
+ tableId: this.tableId,
757
+ rows
758
+ });
759
+ }
760
+ }
761
+ class TableForm extends BaseSDK {
762
+ constructor(storeId, flowId, instanceId, tableId, rowId, activityInstanceId) {
763
+ super();
764
+ this.storeId = storeId;
765
+ this.flowId = flowId;
766
+ this.instanceId = instanceId;
767
+ this.type = "TabelForm";
768
+ this.tableId = tableId;
769
+ this.rowId = rowId;
770
+ this.activityInstanceId = activityInstanceId;
771
+ }
772
+ getParent() {
773
+ return new Form(
774
+ this.storeId,
775
+ this.flowId,
776
+ this.instanceId,
777
+ this.activityInstanceId
778
+ );
779
+ }
780
+ toJSON() {
781
+ return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
782
+ storeId: this.storeId,
783
+ instanceId: this.instanceId,
784
+ tableId: this.tableId,
785
+ rowId: this.rowId
786
+ });
787
+ }
788
+ getField(fieldId) {
789
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD, {
790
+ storeId: this.storeId,
791
+ instanceId: this.instanceId,
792
+ tableId: this.tableId,
793
+ rowId: this.rowId,
794
+ fieldId
795
+ });
796
+ }
797
+ updateField(args) {
798
+ return this._postMessageAsync(LISTENER_CMDS.UPDATE_FORM, {
799
+ storeId: this.storeId,
800
+ instanceId: this.instanceId,
801
+ tableId: this.tableId,
802
+ rowId: this.rowId,
803
+ data: args
804
+ });
805
+ }
806
+ }
538
807
  class Dataform extends BaseSDK {
539
808
  constructor(flowId) {
540
809
  super();
@@ -591,7 +860,7 @@ class Dataform extends BaseSDK {
591
860
  return this._postMessageAsync(LISTENER_CMDS.DATAFORM_OPEN_FORM, {
592
861
  flowId: this._id,
593
862
  itemId: item._id,
594
- fullscreen: item.fullscreen || false
863
+ viewId: item._view_id || ""
595
864
  });
596
865
  }
597
866
  deleteItem(options) {
@@ -627,6 +896,32 @@ class Dataform extends BaseSDK {
627
896
  viewId: (options == null ? void 0 : options.viewId) || ""
628
897
  });
629
898
  }
899
+ initForm(instanceId, viewId) {
900
+ return this._postMessageAsync(LISTENER_CMDS.DATAFORM_INIT_FORM, {
901
+ flowId: this._id,
902
+ instanceId: instanceId || "",
903
+ viewId: viewId || ""
904
+ }).then((response) => {
905
+ return new Form(
906
+ response.storeId || instanceId || "",
907
+ this._id,
908
+ response.itemId || instanceId
909
+ );
910
+ });
911
+ }
912
+ getFieldOptions(options) {
913
+ return this._postMessageAsync(
914
+ LISTENER_CMDS.DATAFORM_GET_FIELD_OPTIONS,
915
+ {
916
+ flowId: this._id,
917
+ instanceId: (options == null ? void 0 : options.instanceId) || "",
918
+ fieldId: (options == null ? void 0 : options.fieldId) || "",
919
+ fieldType: options == null ? void 0 : options.fieldType,
920
+ tableId: options == null ? void 0 : options.tableId,
921
+ tableRowId: options == null ? void 0 : options.tableRowId
922
+ }
923
+ );
924
+ }
630
925
  }
631
926
  class Board extends BaseSDK {
632
927
  constructor(flowId) {
@@ -646,8 +941,7 @@ class Board extends BaseSDK {
646
941
  return this._postMessageAsync(LISTENER_CMDS.BOARD_OPEN_FORM, {
647
942
  flowId: this._id,
648
943
  itemId: item._id,
649
- viewId: item._view_id,
650
- fullscreen: item.fullscreen || false
944
+ viewId: item._view_id
651
945
  });
652
946
  }
653
947
  getItems(options) {
@@ -718,6 +1012,35 @@ class Board extends BaseSDK {
718
1012
  viewId: (options == null ? void 0 : options.viewId) || ""
719
1013
  });
720
1014
  }
1015
+ initForm(instanceId, viewId) {
1016
+ return this._postMessageAsync(LISTENER_CMDS.BOARD_INIT_FORM, {
1017
+ flowId: this._id,
1018
+ instanceId: instanceId || "",
1019
+ viewId: viewId || ""
1020
+ }).then((response) => {
1021
+ return new Form(
1022
+ response.storeId || instanceId || "",
1023
+ this._id,
1024
+ response.itemId || instanceId
1025
+ );
1026
+ });
1027
+ }
1028
+ getFieldOptions(options) {
1029
+ const error = requireFieldsAsync([
1030
+ { value: options.instanceId, name: "instanceId" },
1031
+ { value: options.fieldId, name: "fieldId" }
1032
+ ]);
1033
+ if (error)
1034
+ return error;
1035
+ return this._postMessageAsync(LISTENER_CMDS.BOARD_GET_FIELD_OPTIONS, {
1036
+ flowId: this._id,
1037
+ instanceId: options.instanceId,
1038
+ fieldId: options.fieldId,
1039
+ fieldType: options.fieldType,
1040
+ tableId: options == null ? void 0 : options.tableId,
1041
+ tableRowId: options == null ? void 0 : options.tableRowId
1042
+ });
1043
+ }
721
1044
  }
722
1045
  class Process extends BaseSDK {
723
1046
  constructor(flowId) {
@@ -735,24 +1058,30 @@ class Process extends BaseSDK {
735
1058
  });
736
1059
  }
737
1060
  getMyTasksItems(options) {
738
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_MY_TASKS_ITEMS, {
739
- flowId: this._id,
740
- activityId: (options == null ? void 0 : options.activityId) || "",
741
- searchValue: (options == null ? void 0 : options.searchValue) || "",
742
- pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
743
- pageSize: (options == null ? void 0 : options.pageSize) || 50,
744
- payload: (options == null ? void 0 : options.payload) || {}
745
- });
1061
+ return this._postMessageAsync(
1062
+ LISTENER_CMDS.PROCESS_GET_MY_TASKS_ITEMS,
1063
+ {
1064
+ flowId: this._id,
1065
+ activityId: (options == null ? void 0 : options.activityId) || "",
1066
+ searchValue: (options == null ? void 0 : options.searchValue) || "",
1067
+ pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
1068
+ pageSize: (options == null ? void 0 : options.pageSize) || 50,
1069
+ payload: (options == null ? void 0 : options.payload) || {}
1070
+ }
1071
+ );
746
1072
  }
747
1073
  getParticipatedItems(options) {
748
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_PARTICIPATED_ITEMS, {
749
- flowId: this._id,
750
- activityId: (options == null ? void 0 : options.activityId) || "",
751
- searchValue: (options == null ? void 0 : options.searchValue) || "",
752
- pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
753
- pageSize: (options == null ? void 0 : options.pageSize) || 50,
754
- payload: (options == null ? void 0 : options.payload) || {}
755
- });
1074
+ return this._postMessageAsync(
1075
+ LISTENER_CMDS.PROCESS_GET_PARTICIPATED_ITEMS,
1076
+ {
1077
+ flowId: this._id,
1078
+ activityId: (options == null ? void 0 : options.activityId) || "",
1079
+ searchValue: (options == null ? void 0 : options.searchValue) || "",
1080
+ pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
1081
+ pageSize: (options == null ? void 0 : options.pageSize) || 50,
1082
+ payload: (options == null ? void 0 : options.payload) || {}
1083
+ }
1084
+ );
756
1085
  }
757
1086
  getAdminItems(options) {
758
1087
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ADMIN_ITEMS, {
@@ -764,12 +1093,16 @@ class Process extends BaseSDK {
764
1093
  });
765
1094
  }
766
1095
  getItem(options) {
767
- const error = requireFieldAsync(options.instanceId, "instanceId");
1096
+ const error = requireFieldsAsync([
1097
+ { value: options.instanceId, name: "instanceId" },
1098
+ { value: options.activityInstanceId, name: "activityInstanceId" }
1099
+ ]);
768
1100
  if (error)
769
1101
  return error;
770
1102
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ITEM, {
771
1103
  flowId: this._id,
772
- instanceId: options.instanceId
1104
+ instanceId: options.instanceId,
1105
+ activityInstanceId: options.activityInstanceId
773
1106
  });
774
1107
  }
775
1108
  createItem(options) {
@@ -801,18 +1134,42 @@ class Process extends BaseSDK {
801
1134
  instanceId: options.instanceId
802
1135
  });
803
1136
  }
1137
+ getAdminItem(options) {
1138
+ const error = requireFieldAsync(options.instanceId, "instanceId");
1139
+ if (error)
1140
+ return error;
1141
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ADMIN_ITEM, {
1142
+ flowId: this._id,
1143
+ instanceId: options.instanceId
1144
+ });
1145
+ }
1146
+ updateAdminItem(options) {
1147
+ const error = requireFieldsAsync([
1148
+ { value: options.instanceId, name: "instanceId" },
1149
+ { value: options.data, name: "data" }
1150
+ ]);
1151
+ if (error)
1152
+ return error;
1153
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_UPDATE_ADMIN_ITEM, {
1154
+ flowId: this._id,
1155
+ instanceId: options.instanceId,
1156
+ data: options.data
1157
+ });
1158
+ }
804
1159
  openForm(item) {
805
1160
  const error = requireFieldsAsync([
806
1161
  { value: item._id, name: "Instance Id (_id)" },
807
- { value: item._activity_instance_id, name: "Activity Instance Id (_activity_instance_id)" }
1162
+ {
1163
+ value: item._activity_instance_id,
1164
+ name: "Activity Instance Id (_activity_instance_id)"
1165
+ }
808
1166
  ]);
809
1167
  if (error)
810
1168
  return error;
811
1169
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_OPEN_FORM, {
812
1170
  flowId: this._id,
813
1171
  instanceId: item._id,
814
- activityInstanceId: item._activity_instance_id,
815
- fullscreen: item.fullscreen || false
1172
+ activityInstanceId: item._activity_instance_id
816
1173
  });
817
1174
  }
818
1175
  submitItem(options) {
@@ -941,17 +1298,23 @@ class Process extends BaseSDK {
941
1298
  });
942
1299
  }
943
1300
  getParticipatedFields(options) {
944
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_PARTICIPATED_FIELDS, {
945
- flowId: this._id,
946
- activityId: options.activityId,
947
- isParticipated: true
948
- });
1301
+ return this._postMessageAsync(
1302
+ LISTENER_CMDS.PROCESS_GET_PARTICIPATED_FIELDS,
1303
+ {
1304
+ flowId: this._id,
1305
+ activityId: options.activityId,
1306
+ isParticipated: true
1307
+ }
1308
+ );
949
1309
  }
950
1310
  getMyItemsFields(options) {
951
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_MY_ITEMS_FIELDS, {
952
- flowId: this._id,
953
- status: options.status
954
- });
1311
+ return this._postMessageAsync(
1312
+ LISTENER_CMDS.PROCESS_GET_MY_ITEMS_FIELDS,
1313
+ {
1314
+ flowId: this._id,
1315
+ status: options.status
1316
+ }
1317
+ );
955
1318
  }
956
1319
  getProgress(options) {
957
1320
  const error = requireFieldAsync(options.instanceId, "instanceId");
@@ -962,6 +1325,48 @@ class Process extends BaseSDK {
962
1325
  instanceId: options.instanceId
963
1326
  });
964
1327
  }
1328
+ initForm(instanceId, activityInstanceId) {
1329
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_INIT_FORM, {
1330
+ flowId: this._id,
1331
+ instanceId: instanceId || "",
1332
+ activityInstanceId: activityInstanceId || ""
1333
+ }).then((response) => {
1334
+ return new Form(
1335
+ response.storeId || instanceId || "",
1336
+ this._id,
1337
+ response.itemId || instanceId,
1338
+ response.activityInstanceId || activityInstanceId
1339
+ );
1340
+ });
1341
+ }
1342
+ getFieldOptions(options) {
1343
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_FIELD_OPTIONS, {
1344
+ flowId: this._id,
1345
+ instanceId: (options == null ? void 0 : options.instanceId) || "",
1346
+ activityInstanceId: (options == null ? void 0 : options.activityInstanceId) || "",
1347
+ fieldId: (options == null ? void 0 : options.fieldId) || "",
1348
+ fieldType: options == null ? void 0 : options.fieldType,
1349
+ tableId: options == null ? void 0 : options.tableId,
1350
+ tableRowId: options == null ? void 0 : options.tableRowId
1351
+ });
1352
+ }
1353
+ parseAttachment(options) {
1354
+ const error = requireFieldsAsync([
1355
+ { value: options.instanceId, name: "instanceId" },
1356
+ { value: options.activityInstanceId, name: "activityInstanceId" },
1357
+ { value: options.fieldId, name: "fieldId" },
1358
+ { value: options.file, name: "file" }
1359
+ ]);
1360
+ if (error)
1361
+ return error;
1362
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_PARSE_ATTACHMENT, {
1363
+ flowId: this._id,
1364
+ instanceId: options.instanceId,
1365
+ activityInstanceId: options.activityInstanceId,
1366
+ fieldId: options.fieldId,
1367
+ file: options.file
1368
+ });
1369
+ }
965
1370
  }
966
1371
  class Application extends BaseSDK {
967
1372
  constructor(props, isCustomComponent = false) {
@@ -998,6 +1403,15 @@ class Application extends BaseSDK {
998
1403
  getProcess(flowId) {
999
1404
  return new Process(flowId);
1000
1405
  }
1406
+ getRoles() {
1407
+ return this._postMessageAsync(LISTENER_CMDS.GET_ROLES, {});
1408
+ }
1409
+ switchRole(args) {
1410
+ return this._postMessageAsync(LISTENER_CMDS.SWITCH_ROLE, {
1411
+ roleId: args.roleId,
1412
+ roleName: args.roleName
1413
+ });
1414
+ }
1001
1415
  }
1002
1416
  class CustomComponentSDK extends BaseSDK {
1003
1417
  constructor() {