@kissflow/lowcode-client-sdk 1.0.9 → 1.0.12-beta

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
@@ -1,4 +1,4 @@
1
- declare module "constants" {
1
+ declare module "core/constants" {
2
2
  export const LISTENER_CMDS: {
3
3
  API: string;
4
4
  PARAMS: string;
@@ -33,30 +33,102 @@ declare module "constants" {
33
33
  GET_POPUP_PARAMS: string;
34
34
  GET_ALL_POPUP_PARAMS: string;
35
35
  CLOSE_POPUP: string;
36
- GET_COMPONENT: string;
36
+ COMPONENT_GET: string;
37
37
  COMPONENT_REFRESH: string;
38
38
  COMPONENT_SHOW: string;
39
39
  COMPONENT_HIDE: string;
40
+ COMPONENT_ADD_EVENT_LISTENER: string;
40
41
  INITIALIZE_CUST_COMP: string;
42
+ WINDOW_NDEF_READER_NEW: string;
43
+ WINDOW_NDEF_READER_SCAN: string;
44
+ WINDOW_NDEF_READER_WRITE: string;
45
+ WINDOW_NDEF_READER_ADD_EVENT_LISTENER: string;
46
+ WINDOW_NDEF_READER_MAKE_READONLY: string;
47
+ WINDOW_NDEF_READER_ABORT_SCAN: string;
41
48
  };
42
49
  export const EVENT_TYPES: {
43
- ON_CLOSE: string;
44
- POPUP_ON_CLOSE: string;
45
- ON_CHANGE: string;
46
- ON_LOAD: string;
50
+ COMPONENT_ON_MOUNT: string;
47
51
  };
48
52
  export const DEFAULTS: {
49
53
  POPUP_ID: string;
50
54
  };
51
55
  }
52
- declare module "base" {
53
- export class BaseSDK {
56
+ declare module "core/index" {
57
+ export function generateId(prefix?: string): string;
58
+ export const globalInstances: {};
59
+ export class EventBase {
54
60
  #private;
55
- constructor(props: any);
61
+ constructor();
62
+ _addEventListener(eventName: string, callBack: Function): void;
63
+ _removeEventListener(eventName: string, callBack?: any): void;
64
+ _dispatchEvent(eventName: string, eventParams: object): boolean;
65
+ _dispatchMessageEvents(req: any, resp: any): void;
66
+ }
67
+ export class BaseSDK extends EventBase {
56
68
  _postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
57
- _postMessage(command: string, func: (data: any) => {}, args?: {}): void;
58
- _registerEventListener(_id: string, eventType: string, callback: any): void;
69
+ _postMessage(command: string, args: any, callBack?: any): void;
70
+ }
71
+ export * from "core/constants";
72
+ }
73
+ declare module "form/index" {
74
+ import { BaseSDK } from "core/index";
75
+ export class Form extends BaseSDK {
76
+ private instanceId;
77
+ type: string;
78
+ constructor(instanceId: string);
79
+ toJSON(): any;
80
+ getField(fieldId: string): any;
81
+ updateField(args: object): any;
82
+ getTable(tableId: string): Table;
59
83
  }
84
+ class Table extends BaseSDK {
85
+ private tableId;
86
+ private instanceId;
87
+ constructor(instanceId: string, tableId: string);
88
+ toJSON(): any;
89
+ getRows(): TableForm[];
90
+ getRow(rowId: string): TableForm;
91
+ addRow(rowObject: object): any;
92
+ deleteRow(rowId: string): any;
93
+ }
94
+ export class TableForm extends BaseSDK {
95
+ private instanceId;
96
+ private tableId;
97
+ private rowId;
98
+ type: string;
99
+ constructor(instanceId: string, tableId: string, rowId: string);
100
+ getParent(): Form;
101
+ toJSON(): any;
102
+ getField(fieldId: string): any;
103
+ updateField(args: object): any;
104
+ }
105
+ }
106
+ declare module "utils/client" {
107
+ import { BaseSDK } from "core/index";
108
+ export class Client extends BaseSDK {
109
+ showInfo(message: string): any;
110
+ showConfirm(args: {
111
+ title: string;
112
+ content: string;
113
+ okText: string;
114
+ cancelText: string;
115
+ }): any;
116
+ redirect(url: string): any;
117
+ }
118
+ }
119
+ declare module "utils/formatter" {
120
+ import { BaseSDK } from "core/index";
121
+ export class Formatter extends BaseSDK {
122
+ toDate(date: string): any;
123
+ toDateTime(date: string): any;
124
+ toNumber(value: string): any;
125
+ toCurrency(value: string, currencyCode: string): any;
126
+ toBoolean(value: string): any;
127
+ }
128
+ }
129
+ declare module "utils/index" {
130
+ export * from "utils/client";
131
+ export * from "utils/formatter";
60
132
  }
61
133
  declare module "types/external" {
62
134
  export type userObject = {
@@ -69,29 +141,34 @@ declare module "types/external" {
69
141
  export type accountObject = {
70
142
  _id: string;
71
143
  };
144
+ export type environmentObject = {
145
+ isMobile: boolean;
146
+ };
72
147
  }
73
148
  declare module "types/internal" {
74
- import { userObject, accountObject } from "types/external";
149
+ import { userObject, accountObject, environmentObject } from "types/external";
75
150
  export interface SDKContext {
76
151
  formInstanceId: string;
77
152
  tableId: string;
78
153
  tableRowId: string;
79
154
  componentId: string;
80
- manifestMethods?: manifestMethodsType[];
155
+ componentMethods?: componentMethodsType[];
81
156
  appId: string;
82
157
  pageId: string;
83
158
  popupId: string;
84
159
  user: userObject;
85
160
  account: accountObject;
161
+ csrfToken: string;
162
+ envDetails: environmentObject;
86
163
  }
87
- export interface manifestMethodsType {
164
+ export interface componentMethodsType {
88
165
  name: string;
89
166
  returnType?: string;
90
167
  parameters?: string[];
91
168
  }
92
169
  export interface ComponentProps {
93
170
  componentId: string;
94
- manifestMethods?: manifestMethodsType[];
171
+ componentMethods?: componentMethodsType[];
95
172
  }
96
173
  export interface AppContext {
97
174
  appId: string;
@@ -104,13 +181,15 @@ declare module "types/internal" {
104
181
  popupId?: string;
105
182
  }
106
183
  }
107
- declare module "component" {
108
- import { BaseSDK } from "base";
184
+ declare module "app/component" {
185
+ import { BaseSDK } from "core/index";
109
186
  import { ComponentProps } from "types/internal";
110
187
  export class Component extends BaseSDK {
188
+ #private;
111
189
  _id: string;
112
190
  type: string;
113
191
  constructor(props: ComponentProps);
192
+ onMount(callback: Function): void;
114
193
  refresh(): any;
115
194
  show(): any;
116
195
  hide(): any;
@@ -121,9 +200,9 @@ declare module "component" {
121
200
  watchParams(func: (data: any) => any): void;
122
201
  }
123
202
  }
124
- declare module "popup" {
125
- import { Component } from "component";
126
- import { BaseSDK } from "base";
203
+ declare module "app/popup" {
204
+ import { BaseSDK } from "core/index";
205
+ import { Component } from "app/component";
127
206
  import { PopupContext } from "types/internal";
128
207
  export class Popup extends BaseSDK {
129
208
  _id: string;
@@ -135,10 +214,10 @@ declare module "popup" {
135
214
  getComponent(componentId: string): Component;
136
215
  }
137
216
  }
138
- declare module "page" {
139
- import { Component } from "component";
140
- import { BaseSDK } from "base";
141
- import { Popup } from "popup";
217
+ declare module "app/page" {
218
+ import { BaseSDK } from "core/index";
219
+ import { Component } from "app/component";
220
+ import { Popup } from "app/popup";
142
221
  import { PageContext } from "types/internal";
143
222
  export class Page extends BaseSDK {
144
223
  _id: string;
@@ -153,97 +232,62 @@ declare module "page" {
153
232
  getComponent(componentId: string): Component;
154
233
  }
155
234
  }
156
- declare module "app" {
157
- import { BaseSDK } from "base";
158
- import { Page } from "page";
235
+ declare module "app/index" {
236
+ import { BaseSDK } from "core/index";
237
+ import { Page } from "app/page";
159
238
  import { AppContext } from "types/internal";
160
239
  export class Application extends BaseSDK {
161
240
  page: Page;
162
241
  _id: string;
163
242
  constructor(props: AppContext);
164
243
  getVariable(key: string): any;
165
- setVariable(key: string | object, value: any): any;
244
+ setVariable(key: string | object, value?: any): any;
166
245
  openPage(pageId: string, pageParams: object): any;
167
246
  }
247
+ export * from "app/component";
248
+ export { Page };
249
+ export * from "app/popup";
168
250
  }
169
- declare module "client" {
170
- import { BaseSDK } from "base";
171
- export class Client extends BaseSDK {
172
- showInfo(message: string): any;
173
- showConfirm(args: {
174
- title: string;
175
- content: string;
176
- okText: string;
177
- cancelText: string;
178
- }): any;
179
- redirect(url: string): any;
180
- }
181
- }
182
- declare module "form" {
183
- import { BaseSDK } from "base";
184
- export class Form extends BaseSDK {
185
- private instanceId;
186
- type: string;
187
- constructor(instanceId: string);
188
- toJSON(): any;
189
- getField(fieldId: string): any;
190
- updateField(args: object): any;
191
- getTable(tableId: string): Table;
192
- }
193
- class Table extends BaseSDK {
194
- private tableId;
195
- private instanceId;
196
- constructor(instanceId: string, tableId: string);
197
- toJSON(): any;
198
- getRows(): TableForm[];
199
- getRow(rowId: string): TableForm;
200
- addRow(rowObject: object): any;
201
- deleteRow(rowId: string): any;
202
- }
203
- export class TableForm extends BaseSDK {
204
- private instanceId;
205
- private tableId;
206
- private rowId;
207
- type: string;
208
- constructor(instanceId: string, tableId: string, rowId: string);
209
- getParent(): Form;
210
- toJSON(): any;
211
- getField(fieldId: string): any;
212
- updateField(args: object): any;
251
+ declare module "window/NDEFReader" {
252
+ import { BaseSDK } from "core/index";
253
+ export class NDEFReader extends BaseSDK {
254
+ id: string;
255
+ constructor();
256
+ scan(): Promise<unknown>;
257
+ write(data: any): Promise<unknown>;
258
+ addEventListener(eventName: string, cb: Function): void;
259
+ makeReadOnly(): Promise<unknown>;
260
+ abortScan(): Promise<unknown>;
213
261
  }
214
262
  }
215
- declare module "formatter" {
216
- import { BaseSDK } from "base";
217
- export class Formatter extends BaseSDK {
218
- toDate(date: string): any;
219
- toDateTime(date: string): any;
220
- toNumber(value: string): any;
221
- toCurrency(value: string, currencyCode: string): any;
222
- toBoolean(value: string): any;
223
- }
263
+ declare module "window/index" {
264
+ import { NDEFReader } from "window/NDEFReader";
265
+ export const window: {
266
+ NDEFReader: typeof NDEFReader;
267
+ };
224
268
  }
225
269
  declare module "lowcode" {
226
- import { BaseSDK } from "base";
227
- import { Form } from "form";
228
- import { TableForm } from "form";
229
- import { Client } from "client";
230
- import { Formatter } from "formatter";
231
- import { Application } from "app";
232
- import { Page } from "page";
233
- import { Component } from "component";
234
- import { Popup } from "popup";
270
+ import { BaseSDK } from "core/index";
271
+ import { Form, TableForm } from "form/index";
272
+ import { Client, Formatter } from "utils/index";
273
+ import { Application, Page, Component, Popup } from "app/index";
274
+ import { window } from "window/index";
235
275
  import { SDKContext } from "types/internal";
236
- import { userObject, accountObject } from "types/external";
276
+ import { userObject, accountObject, environmentObject } from "types/external";
237
277
  class LowcodeSDK extends BaseSDK {
278
+ #private;
238
279
  context: Component | Form | TableForm | Page | Popup;
239
280
  client: Client;
240
281
  formatter: Formatter;
241
282
  app: Application;
242
283
  user: userObject;
284
+ env: environmentObject;
243
285
  account: accountObject;
244
286
  constructor(props: SDKContext);
245
- api(url: string, args?: {}): string | object;
287
+ api(url: string, args?: {
288
+ headers: object;
289
+ }): Promise<any>;
246
290
  }
247
291
  function initSDK(config: SDKContext): LowcodeSDK;
248
- export default initSDK;
292
+ export { window, initSDK as default };
249
293
  }
package/package.json CHANGED
@@ -1,54 +1,53 @@
1
1
  {
2
- "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.9",
4
- "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
- "types": "dist/index.d.ts",
6
- "files": [
7
- "dist/"
8
- ],
9
- "main": "./dist/kfsdk.umd.js",
10
- "module": "./dist/kfsdk.es.js",
11
- "exports": {
12
- ".": {
13
- "import": "./dist/kfsdk.es.js",
14
- "require": "./dist/kfsdk.umd.js"
15
- },
16
- "./lowcode": {
17
- "import": "./dist/kfworkersdk.es.js"
18
- }
19
- },
20
- "scripts": {
21
- "start": "vite serve",
22
- "customBuild": "node custom.build.mjs",
23
- "build": "pnpm run customBuild",
24
- "prepare": "pnpm run customBuild",
25
- "serve": "http-server -p 8080"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
30
- },
31
- "keywords": [],
32
- "author": "Vivek Madurai<vivek@kissflow.com>",
33
- "license": "MIT",
34
- "bugs": {
35
- "url": "https://github.com/kissflow/lcnc-sdk-js/issues"
36
- },
37
- "homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
38
- "devDependencies": {
39
- "html-webpack-plugin": "^5.3.1",
40
- "http-server": "^0.12.3",
41
- "ts-loader": "^9.2.5",
42
- "typescript": "^4.3.5",
43
- "vite": "^2.9.8",
44
- "webpack": "^5.52.1",
45
- "webpack-cli": "^4.8.0",
46
- "webpack-dev-server": "^3.11.2"
47
- },
48
- "dependencies": {
49
- "@lingui/cli": "^3.13.3",
50
- "@lingui/react": "^2",
51
- "nanoid": "^3.1.30",
52
- "ts-file-parser": "0.0.21"
53
- }
54
- }
2
+ "name": "@kissflow/lowcode-client-sdk",
3
+ "version": "1.0.12-beta",
4
+ "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist/"
8
+ ],
9
+ "main": "./dist/kfsdk.umd.js",
10
+ "module": "./dist/kfsdk.es.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/kfsdk.es.js",
14
+ "require": "./dist/kfsdk.umd.js"
15
+ },
16
+ "./lowcode": {
17
+ "import": "./dist/kfworkersdk.es.js"
18
+ }
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/kissflow/lcnc-sdk-js.git"
23
+ },
24
+ "keywords": [],
25
+ "author": "Vivek Madurai<vivek@kissflow.com>",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/kissflow/lcnc-sdk-js/issues"
29
+ },
30
+ "homepage": "https://github.com/kissflow/lcnc-sdk-js#readme",
31
+ "devDependencies": {
32
+ "html-webpack-plugin": "^5.3.1",
33
+ "http-server": "^0.12.3",
34
+ "ts-loader": "^9.2.5",
35
+ "typescript": "^4.3.5",
36
+ "vite": "^2.9.8",
37
+ "webpack": "^5.52.1",
38
+ "webpack-cli": "^4.8.0",
39
+ "webpack-dev-server": "^3.11.2"
40
+ },
41
+ "dependencies": {
42
+ "@lingui/cli": "^3.13.3",
43
+ "@lingui/react": "^2",
44
+ "nanoid": "^3.1.30",
45
+ "ts-file-parser": "0.0.21"
46
+ },
47
+ "scripts": {
48
+ "start": "vite serve",
49
+ "customBuild": "node custom.build.mjs",
50
+ "build": "pnpm run customBuild",
51
+ "serve": "http-server -p 8080"
52
+ }
53
+ }