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

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
@@ -1,7 +1,6 @@
1
- declare module "constants" {
1
+ declare module "core/constants" {
2
2
  export const LISTENER_CMDS: {
3
3
  API: string;
4
- PARAMS: string;
5
4
  GET_CONTEXT: string;
6
5
  RETURN: string;
7
6
  GET_FORM_FIELD: string;
@@ -33,30 +32,44 @@ declare module "constants" {
33
32
  GET_POPUP_PARAMS: string;
34
33
  GET_ALL_POPUP_PARAMS: string;
35
34
  CLOSE_POPUP: string;
36
- GET_COMPONENT: string;
35
+ COMPONENT_GET: string;
37
36
  COMPONENT_REFRESH: string;
38
37
  COMPONENT_SHOW: string;
39
38
  COMPONENT_HIDE: string;
40
- INITIALIZE_CUST_COMP: string;
39
+ COMPONENT_ADD_EVENT_LISTENER: string;
40
+ CC_INITIALIZE: string;
41
+ CC_WATCH_PARAMS: 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;
51
+ CC_ON_PARAMS_CHANGE: string;
47
52
  };
48
53
  export const DEFAULTS: {
49
54
  POPUP_ID: string;
50
55
  };
51
56
  }
52
- declare module "base" {
53
- export class BaseSDK {
57
+ declare module "core/index" {
58
+ export function generateId(prefix?: string): string;
59
+ export const globalInstances: {};
60
+ export class EventBase {
54
61
  #private;
55
- constructor(props: any);
62
+ constructor();
63
+ _addEventListener(eventName: string, callBack: Function): void;
64
+ _removeEventListener(eventName: string, callBack?: any): void;
65
+ _dispatchEvent(eventName: string, eventParams: object): boolean;
66
+ _dispatchMessageEvents(req: any, resp: any): void;
67
+ }
68
+ export class BaseSDK extends EventBase {
56
69
  _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;
70
+ _postMessage(command: string, args: any, callBack?: any): void;
59
71
  }
72
+ export * from "core/constants";
60
73
  }
61
74
  declare module "types/external" {
62
75
  export type userObject = {
@@ -69,29 +82,34 @@ declare module "types/external" {
69
82
  export type accountObject = {
70
83
  _id: string;
71
84
  };
85
+ export type environmentObject = {
86
+ isMobile: boolean;
87
+ };
72
88
  }
73
89
  declare module "types/internal" {
74
- import { userObject, accountObject } from "types/external";
90
+ import { userObject, accountObject, environmentObject } from "types/external";
75
91
  export interface SDKContext {
76
92
  formInstanceId: string;
77
93
  tableId: string;
78
94
  tableRowId: string;
79
95
  componentId: string;
80
- manifestMethods?: manifestMethodsType[];
96
+ componentMethods?: componentMethodsType[];
81
97
  appId: string;
82
98
  pageId: string;
83
99
  popupId: string;
84
100
  user: userObject;
85
101
  account: accountObject;
102
+ csrfToken: string;
103
+ envDetails: environmentObject;
86
104
  }
87
- export interface manifestMethodsType {
105
+ export interface componentMethodsType {
88
106
  name: string;
89
107
  returnType?: string;
90
108
  parameters?: string[];
91
109
  }
92
110
  export interface ComponentProps {
93
111
  componentId: string;
94
- manifestMethods?: manifestMethodsType[];
112
+ componentMethods?: componentMethodsType[];
95
113
  }
96
114
  export interface AppContext {
97
115
  appId: string;
@@ -104,26 +122,29 @@ declare module "types/internal" {
104
122
  popupId?: string;
105
123
  }
106
124
  }
107
- declare module "component" {
108
- import { BaseSDK } from "base";
125
+ declare module "app/component" {
126
+ import { BaseSDK } from "core/index";
109
127
  import { ComponentProps } from "types/internal";
110
128
  export class Component extends BaseSDK {
129
+ #private;
111
130
  _id: string;
112
131
  type: string;
113
132
  constructor(props: ComponentProps);
133
+ onMount(callback: Function): void;
114
134
  refresh(): any;
115
135
  show(): any;
116
136
  hide(): any;
117
137
  }
118
138
  export class CustomComponent extends BaseSDK {
119
139
  type: string;
120
- constructor();
121
- watchParams(func: (data: any) => any): void;
140
+ _id: string;
141
+ constructor(id: any);
142
+ watchParams(callBack: (data: any) => any): void;
122
143
  }
123
144
  }
124
- declare module "popup" {
125
- import { Component } from "component";
126
- import { BaseSDK } from "base";
145
+ declare module "app/popup" {
146
+ import { BaseSDK } from "core/index";
147
+ import { Component } from "app/component";
127
148
  import { PopupContext } from "types/internal";
128
149
  export class Popup extends BaseSDK {
129
150
  _id: string;
@@ -135,10 +156,10 @@ declare module "popup" {
135
156
  getComponent(componentId: string): Component;
136
157
  }
137
158
  }
138
- declare module "page" {
139
- import { Component } from "component";
140
- import { BaseSDK } from "base";
141
- import { Popup } from "popup";
159
+ declare module "app/page" {
160
+ import { BaseSDK } from "core/index";
161
+ import { Component } from "app/component";
162
+ import { Popup } from "app/popup";
142
163
  import { PageContext } from "types/internal";
143
164
  export class Page extends BaseSDK {
144
165
  _id: string;
@@ -153,21 +174,24 @@ declare module "page" {
153
174
  getComponent(componentId: string): Component;
154
175
  }
155
176
  }
156
- declare module "app" {
157
- import { BaseSDK } from "base";
158
- import { Page } from "page";
177
+ declare module "app/index" {
178
+ import { BaseSDK } from "core/index";
179
+ import { Page } from "app/page";
159
180
  import { AppContext } from "types/internal";
160
181
  export class Application extends BaseSDK {
161
182
  page: Page;
162
183
  _id: string;
163
184
  constructor(props: AppContext);
164
185
  getVariable(key: string): any;
165
- setVariable(key: string | object, value: any): any;
186
+ setVariable(key: string | object, value?: any): any;
166
187
  openPage(pageId: string, pageParams: object): any;
167
188
  }
189
+ export * from "app/component";
190
+ export { Page };
191
+ export * from "app/popup";
168
192
  }
169
- declare module "client" {
170
- import { BaseSDK } from "base";
193
+ declare module "utils/client" {
194
+ import { BaseSDK } from "core/index";
171
195
  export class Client extends BaseSDK {
172
196
  showInfo(message: string): any;
173
197
  showConfirm(args: {
@@ -179,8 +203,44 @@ declare module "client" {
179
203
  redirect(url: string): any;
180
204
  }
181
205
  }
182
- declare module "form" {
183
- import { BaseSDK } from "base";
206
+ declare module "utils/formatter" {
207
+ import { BaseSDK } from "core/index";
208
+ export class Formatter extends BaseSDK {
209
+ toDate(date: string): any;
210
+ toDateTime(date: string): any;
211
+ toNumber(value: string): any;
212
+ toCurrency(value: string, currencyCode: string): any;
213
+ toBoolean(value: string): any;
214
+ }
215
+ }
216
+ declare module "utils/index" {
217
+ export * from "utils/client";
218
+ export * from "utils/formatter";
219
+ }
220
+ declare module "index" {
221
+ import { BaseSDK } from "core/index";
222
+ import { Application, Page, CustomComponent } from "app/index";
223
+ import { Client, Formatter } from "utils/index";
224
+ import { userObject, accountObject, environmentObject } from "types/external";
225
+ class CustomComponentSDK extends BaseSDK {
226
+ app: Application;
227
+ page: Page;
228
+ user: userObject;
229
+ account: accountObject;
230
+ context: CustomComponent;
231
+ client: Client;
232
+ formatter: Formatter;
233
+ env: environmentObject;
234
+ constructor();
235
+ api(url: string, args?: {}): string | object;
236
+ initialize(): any;
237
+ initialise(): any;
238
+ }
239
+ const _default: CustomComponentSDK;
240
+ export default _default;
241
+ }
242
+ declare module "form/index" {
243
+ import { BaseSDK } from "core/index";
184
244
  export class Form extends BaseSDK {
185
245
  private instanceId;
186
246
  type: string;
@@ -212,36 +272,21 @@ declare module "form" {
212
272
  updateField(args: object): any;
213
273
  }
214
274
  }
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
- }
224
- }
225
- declare module "index" {
226
- import { BaseSDK } from "base";
227
- import { Client } from "client";
228
- import { Formatter } from "formatter";
229
- import { Application } from "app";
230
- import { Page } from "page";
231
- import { CustomComponent } from "component";
232
- import { userObject, accountObject } from "types/external";
233
- class CustomComponentSDK extends BaseSDK {
234
- app: Application;
235
- page: Page;
236
- user: userObject;
237
- account: accountObject;
238
- context: CustomComponent;
239
- client: Client;
240
- formatter: Formatter;
275
+ declare module "window/NDEFReader" {
276
+ import { BaseSDK } from "core/index";
277
+ export class NDEFReader extends BaseSDK {
278
+ id: string;
241
279
  constructor();
242
- api(url: string, args?: {}): string | object;
243
- initialise(): any;
280
+ scan(): Promise<unknown>;
281
+ write(data: any): Promise<unknown>;
282
+ addEventListener(eventName: string, cb: Function): void;
283
+ makeReadOnly(): Promise<unknown>;
284
+ abortScan(): Promise<unknown>;
244
285
  }
245
- const _default: CustomComponentSDK;
246
- export default _default;
286
+ }
287
+ declare module "window/index" {
288
+ import { NDEFReader } from "window/NDEFReader";
289
+ export const window: {
290
+ NDEFReader: typeof NDEFReader;
291
+ };
247
292
  }