@kissflow/lowcode-client-sdk 1.0.21 → 1.0.24-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/kfsdk.umd.js CHANGED
@@ -1 +1 @@
1
- var h=(E,t,A)=>{if(!t.has(E))throw TypeError("Cannot "+A)};var o=(E,t,A)=>(h(E,t,"read from private field"),A?A.call(E):t.get(E)),p=(E,t,A)=>{if(t.has(E))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(E):t.set(E,A)},l=(E,t,A,R)=>(h(E,t,"write to private field"),R?R.call(E,A):t.set(E,A),A);var g=(E,t,A)=>(h(E,t,"access private method"),A);(function(E,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(t):(E=typeof globalThis!="undefined"?globalThis:E||self,E.kf=t())})(this,function(){var i,M,L;"use strict";let E=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const t={API:"API",GET_CONTEXT:"GET_CONTEXT",RETURN:"RETURN",GET_FORM_FIELD:"GET_FORM_FIELD",UPDATE_FORM:"UPDATE_FORM",GET_TABLE:"GET_TABLE",GET_TABLE_ROW:"GET_TABLE_ROW",ADD_TABLE_ROW:"ADD_TABLE_ROW",ADD_TABLE_ROWS:"ADD_TABLE_ROWS",DELETE_TABLE_ROW:"DELETE_TABLE_ROW",TO_JSON:"TO_JSON",GET_TABLE_ROWS:"GET_TABLE_ROWS",MESSAGE:"MESSAGE",CONFIRM:"CONFIRM",ALERT:"ALERT",REDIRECT:"REDIRECT",OPEN_PAGE:"OPEN_PAGE",FORMAT_DATE:"FORMAT_DATE",FORMAT_DATE_TIME:"FORMAT_DATE_TIME",FORMAT_NUMBER:"FORMAT_NUMBER",FORMAT_CURRENCY:"FORMAT_CURRENCY",FORMAT_BOOLEAN:"FORMAT_BOOLEAN",GET_APP_VARIABLE:"GET_APP_VARIABLE",SET_APP_VARIABLE:"SET_APP_VARIABLE",GET_PAGE_VARIABLE:"GET_PAGE_VARIABLE",SET_PAGE_VARIABLE:"SET_PAGE_VARIABLE",GET_PAGE_PARAMS:"GET_PAGE_PARAMS",GET_ALL_PAGE_PARAMS:"GET_ALL_PAGE_PARAMS",PAGE_ON_CLOSE:"PAGE_ON_CLOSE",OPEN_POPUP:"OPEN_POPUP",GET_POPUP_PARAMS:"GET_POPUP_PARAMS",GET_ALL_POPUP_PARAMS:"GET_ALL_POPUP_PARAMS",CLOSE_POPUP:"CLOSE_POPUP",COMPONENT_GET:"COMPONENT_GET",COMPONENT_REFRESH:"COMPONENT_REFRESH",COMPONENT_SHOW:"COMPONENT_SHOW",COMPONENT_HIDE:"COMPONENT_HIDE",COMPONENT_ADD_EVENT_LISTENER:"COMPONENT_ADD_EVENT_LISTENER",CC_INITIALIZE:"CC_INITIALIZE",CC_WATCH_PARAMS:"CC_WATCH_PARAMS",WINDOW_NDEF_READER_NEW:"WINDOW_NDEF_READER_NEW",WINDOW_NDEF_READER_SCAN:"WINDOW_NDEF_READER_SCAN",WINDOW_NDEF_READER_WRITE:"WINDOW_NDEF_READER_WRITE",WINDOW_NDEF_READER_ADD_EVENT_LISTENER:"WINDOW_NDEF_READER_ADD_EVENT_LISTENER",WINDOW_NDEF_READER_MAKE_READONLY:"WINDOW_NDEF_READER_MAKE_READONLY",WINDOW_NDEF_READER_ABORT_SCAN:"WINDOW_NDEF_READER_ABORT_SCAN",DECISION_TABLE_EXECUTE:"DECISION_TABLE_EXECUTE"},A={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},R={POPUP_ID:"ACTIVE_POP_UP"};function u(n="lcncsdk"){return`${n}-${E()}`}const P={};function C(n){globalThis.parent&&globalThis.parent!==globalThis?globalThis.parent.postMessage(n,"*"):globalThis.postMessage(n)}function d(n){if(n.origin!==globalThis.location.origin){const e=n.data;if(e!=null&&e.isEvent){const{target:r,eventParams:a,eventName:c,eventConfig:N={}}=e;let T=P[r];T._dispatchEvent(c,a),N.once&&T._removeEventListener(c);return}let{_req:s,resp:_}=e;s!=null&&s._id&&P[s._id]._dispatchMessageEvents(s,_)}}globalThis.addEventListener("message",d);class S{constructor(){p(this,i,void 0);l(this,i,{})}_addEventListener(e,s){var _;o(this,i)[e]=((_=o(this,i))==null?void 0:_[e])||[],o(this,i)[e].push(s)}_removeEventListener(e,s){if(s){let _=o(this,i)[e].findIndex(s);_>-1&&o(this,i)[e].splice(_,1);return}Reflect.deleteProperty(o(this,i),e)}_dispatchEvent(e,s){return Array.isArray(o(this,i)[e])?(o(this,i)[e].forEach(_=>_(s)),!0):!1}_dispatchMessageEvents(e,s){let _=e._id;Array.isArray(o(this,i)[_])&&(o(this,i)[_].forEach(r=>{try{s&&Object.keys(s).length===1&&e.command!==t.API?r(Object.values(s)[0]):r(s)}catch(a){console.error("Message callback error: ",a)}}),this._removeEventListener(_))}}i=new WeakMap;class O extends S{_postMessageAsync(e,s,_,r){return new Promise((a,c)=>{const N=u(e.toLowerCase());C({_id:N,command:e,...s}),P[N]=this,this._addEventListener(N,async T=>{T!=null&&T.errorMessage?c(T):(_&&r&&(T=await r(T)),a(T))})})}_postMessage(e,s,_){const r=u(e.toLowerCase());C({_id:r,command:e,...s}),_&&this._addEventListener(s.eventName,_)}}class D extends O{constructor(s){super();p(this,M);this._id=s.componentId,this.type="Component",P[this._id]=this,g(this,M,L).call(this,s.componentMethods)}onMount(s){this._postMessage(t.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:A.COMPONENT_ON_MOUNT,eventConfig:{once:!0}},s)}refresh(){return this._postMessageAsync(t.COMPONENT_REFRESH,{id:this._id})}show(){return this._postMessageAsync(t.COMPONENT_SHOW,{id:this._id})}hide(){return this._postMessageAsync(t.COMPONENT_HIDE,{id:this._id})}}M=new WeakSet,L=function(s){s==null||s.forEach(_=>{this[_.name]=(...r)=>{if(_.type==="method")return this._postMessageAsync(`COMPONENT_${_.name}`,{id:this._id,parameters:r});_.type==="event"&&this._postMessage(t.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:_.name,eventConfig:r[1]},r[0])}})};class G extends O{constructor(e){super(),this._id=e,this.type="CustomComponent",P[this._id]=this}watchParams(e){this._postMessage(t.CC_WATCH_PARAMS,{id:this._id,eventName:A.CC_ON_PARAMS_CHANGE,eventConfig:{once:!1}},e)}}class f extends O{constructor(e){super(),this.type="Popup",this._id=e.popupId||R.POPUP_ID}getParameter(e){return this._postMessageAsync(t.GET_POPUP_PARAMS,{key:e,popupId:this._id})}getAllParameters(){return this._postMessageAsync(t.GET_ALL_POPUP_PARAMS,{popupId:this._id})}close(){return this._postMessageAsync(t.CLOSE_POPUP,{})}getComponent(e){return this._postMessageAsync(t.COMPONENT_GET,{componentId:e},!0,s=>new D(s))}}class I extends O{constructor(e){super(),this.type="Page",this.popup=new f({}),this._id=e.pageId}getParameter(e){return this._postMessageAsync(t.GET_PAGE_PARAMS,{key:e})}getAllParameters(){return this._postMessageAsync(t.GET_ALL_PAGE_PARAMS,{pageId:this._id})}getVariable(e){return this._postMessageAsync(t.GET_PAGE_VARIABLE,{key:e})}setVariable(e,s){return this._postMessageAsync(t.SET_PAGE_VARIABLE,{key:e,value:s})}openPopup(e,s){return this._postMessageAsync(t.OPEN_POPUP,{popupId:e,popupParams:s})}getComponent(e){return this._postMessageAsync(t.COMPONENT_GET,{componentId:e},!0,s=>new D(s))}}class W extends O{constructor(e){super(),this.flowId=e}evaluate(e){return this._postMessageAsync(t.DECISION_TABLE_EXECUTE,{flowId:this.flowId,payload:e})}}class y extends O{constructor(e){super(),this._id=e.appId,this.page=new I(e)}getVariable(e){return this._postMessageAsync(t.GET_APP_VARIABLE,{key:e})}setVariable(e,s){return this._postMessageAsync(t.SET_APP_VARIABLE,{key:e,value:s})}openPage(e,s){return this._postMessageAsync(t.OPEN_PAGE,{pageId:e,pageParams:s})}getDecisionTable(e){return new W(e)}}class F extends O{showInfo(e){return super._postMessageAsync(t.MESSAGE,{message:e})}showConfirm(e){return super._postMessageAsync(t.CONFIRM,{data:{title:e.title,content:e.content,okText:e.okText||"Ok",cancelText:e.cancelText||"Cancel"}})}redirect(e){return super._postMessageAsync(t.REDIRECT,{url:e})}}class m extends O{toDate(e){return this._postMessageAsync(t.FORMAT_DATE,{date:e})}toDateTime(e){return this._postMessageAsync(t.FORMAT_DATE_TIME,{date:e})}toNumber(e){return this._postMessageAsync(t.FORMAT_NUMBER,{value:e})}toCurrency(e,s){return this._postMessageAsync(t.FORMAT_CURRENCY,{value:e,currencyCode:s})}toBoolean(e){return this._postMessageAsync(t.FORMAT_BOOLEAN,{value:e})}}class B extends O{constructor(){super()}api(e,s={}){return this._postMessageAsync(t.API,{url:e,args:s})}initialize(){return this._postMessageAsync(t.CC_INITIALIZE,{},!0,e=>(this.app=new y(e),this.page=new I(e),this.context=new G(e.componentId),this.client=new F,this.formatter=new m,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var U=new B;return U});
1
+ var S=(i,s,E)=>{if(!s.has(i))throw TypeError("Cannot "+E)};var a=(i,s,E)=>(S(i,s,"read from private field"),E?E.call(i):s.get(i)),N=(i,s,E)=>{if(s.has(i))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(i):s.set(i,E)},D=(i,s,E,M)=>(S(i,s,"write to private field"),M?M.call(i,E):s.set(i,E),E);var m=(i,s,E)=>(S(i,s,"access private method"),E);(function(i,s){typeof exports=="object"&&typeof module!="undefined"?module.exports=s():typeof define=="function"&&define.amd?define(s):(i=typeof globalThis!="undefined"?globalThis:i||self,i.kf=s())})(this,function(){var o,R,l,d,w;"use strict";let i=(r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");const s={API:"API",GET_CONTEXT:"GET_CONTEXT",RETURN:"RETURN",GET_FORM_FIELD:"GET_FORM_FIELD",UPDATE_FORM:"UPDATE_FORM",GET_TABLE:"GET_TABLE",GET_TABLE_ROW:"GET_TABLE_ROW",ADD_TABLE_ROW:"ADD_TABLE_ROW",ADD_TABLE_ROWS:"ADD_TABLE_ROWS",DELETE_TABLE_ROW:"DELETE_TABLE_ROW",TO_JSON:"TO_JSON",GET_TABLE_ROWS:"GET_TABLE_ROWS",MESSAGE:"MESSAGE",CONFIRM:"CONFIRM",ALERT:"ALERT",REDIRECT:"REDIRECT",OPEN_PAGE:"OPEN_PAGE",FORMAT_DATE:"FORMAT_DATE",FORMAT_DATE_TIME:"FORMAT_DATE_TIME",FORMAT_NUMBER:"FORMAT_NUMBER",FORMAT_CURRENCY:"FORMAT_CURRENCY",FORMAT_BOOLEAN:"FORMAT_BOOLEAN",GET_APP_VARIABLE:"GET_APP_VARIABLE",SET_APP_VARIABLE:"SET_APP_VARIABLE",GET_PAGE_VARIABLE:"GET_PAGE_VARIABLE",SET_PAGE_VARIABLE:"SET_PAGE_VARIABLE",GET_PAGE_PARAMS:"GET_PAGE_PARAMS",GET_ALL_PAGE_PARAMS:"GET_ALL_PAGE_PARAMS",PAGE_ON_CLOSE:"PAGE_ON_CLOSE",OPEN_POPUP:"OPEN_POPUP",GET_POPUP_PARAMS:"GET_POPUP_PARAMS",GET_ALL_POPUP_PARAMS:"GET_ALL_POPUP_PARAMS",CLOSE_POPUP:"CLOSE_POPUP",COMPONENT_GET:"COMPONENT_GET",COMPONENT_REFRESH:"COMPONENT_REFRESH",COMPONENT_SHOW:"COMPONENT_SHOW",COMPONENT_HIDE:"COMPONENT_HIDE",COMPONENT_ADD_EVENT_LISTENER:"COMPONENT_ADD_EVENT_LISTENER",CC_INITIALIZE:"CC_INITIALIZE",CC_WATCH_PARAMS:"CC_WATCH_PARAMS",WINDOW_NDEF_READER_NEW:"WINDOW_NDEF_READER_NEW",WINDOW_NDEF_READER_SCAN:"WINDOW_NDEF_READER_SCAN",WINDOW_NDEF_READER_WRITE:"WINDOW_NDEF_READER_WRITE",WINDOW_NDEF_READER_ADD_EVENT_LISTENER:"WINDOW_NDEF_READER_ADD_EVENT_LISTENER",WINDOW_NDEF_READER_MAKE_READONLY:"WINDOW_NDEF_READER_MAKE_READONLY",WINDOW_NDEF_READER_ABORT_SCAN:"WINDOW_NDEF_READER_ABORT_SCAN",DECISION_TABLE_EXECUTE:"DECISION_TABLE_EXECUTE",DATAFORM_IMPORT_CSV:"DATAFORM_IMPORT_CSV"},E={COMPONENT_ON_MOUNT:"componentOnMount",CC_ON_PARAMS_CHANGE:"onCustomComponentParamsChange"},M={POPUP_ID:"ACTIVE_POP_UP"};function g(r="lcncsdk"){return`${r}-${i()}`}const P={};function L(r,e){if(e&&Object.keys(e).length===1&&r.command!==s.API){let t=Object.values(e)[0];return t==="undefined"?void 0:t}else return e}function C(r){globalThis.parent&&globalThis.parent!==globalThis?globalThis.parent.postMessage(r,"*"):globalThis.postMessage(r)}function F(r){if(r.origin!==globalThis.location.origin){const e=r.data;if(e!=null&&e.isEvent){const{target:_,eventParams:A,eventName:c,eventConfig:O={}}=e;let h=P[_];h._dispatchEvent(c,A),O.once&&h._removeEventListener(c);return}let{_req:t,resp:n}=e;t!=null&&t._id&&P[t._id]._dispatchMessageEvents(t,n)}}globalThis.addEventListener("message",F);class W{constructor(){N(this,o,void 0);D(this,o,{})}_addEventListener(e,t){var n;a(this,o)[e]=((n=a(this,o))==null?void 0:n[e])||[],a(this,o)[e].push(t)}_removeEventListener(e,t){if(t){let n=a(this,o)[e].findIndex(t);n>-1&&a(this,o)[e].splice(n,1);return}Reflect.deleteProperty(a(this,o),e)}_dispatchEvent(e,t){return Array.isArray(a(this,o)[e])?(a(this,o)[e].forEach(n=>n(t)),!0):!1}_dispatchMessageEvents(e,t){let n=e._id;Array.isArray(a(this,o)[n])&&(a(this,o)[n].forEach(_=>{try{let A=L(e,t);_(A)}catch(A){console.error("Message callback error: ",A)}}),this._removeEventListener(n))}}o=new WeakMap;class T extends W{_postMessageAsync(e,t,n,_){return new Promise((A,c)=>{const O=g(e.toLowerCase());C({_id:O,command:e,...t}),P[O]=this,this._addEventListener(O,async h=>{h!=null&&h.errorMessage?c(h):(n&&_&&(h=await _(h)),A(h))})})}_postMessage(e,t,n){const _=g(e.toLowerCase());C({_id:_,command:e,...t}),n&&this._addEventListener(t.eventName,n)}_postMessageSync(e,t){let n=0,A={_id:g(e.toLowerCase()),command:e,...t},c=new B;c.reset(),c.store(0,n),c.encodeData(1,A),C(c.sab),c.wait(0,n,1e4);let O=c.decodeData(),{_req:h,resp:X}=O,p=L(h,X);if(p!=null&&p.isError)throw new Error(`Error: ${JSON.stringify(p,null,2)}`);return p}}let I;class B{constructor(){N(this,R,void 0);N(this,l,void 0);D(this,R,new TextEncoder),D(this,l,new TextDecoder),I=I||new SharedArrayBuffer(1024*1024),this.sab=I,this.int32Array=new Int32Array(this.sab)}load(e=0){return Atomics.load(this.int32Array,e)}store(e=0,t){return Atomics.store(this.int32Array,e,t)}reset(){return this.int32Array.fill(0)}notify(e=0,t=1){return Atomics.notify(this.int32Array,e,t)}wait(e,t,n){return Atomics.wait(this.int32Array,e,t,n)}encodeData(e=0,t){const n=(c,O)=>O===void 0?"undefined":O;let _=JSON.stringify(t,n),A=a(this,R).encode(_);return this.int32Array.set(A,e),this.int32Array}decodeData(){let e=new Uint8Array(this.int32Array),t=a(this,l).decode(e).replaceAll(/\x00/g,"");return JSON.parse(t)}}R=new WeakMap,l=new WeakMap;class V extends T{showInfo(e){return super._postMessageAsync(s.MESSAGE,{message:e})}showConfirm(e){return super._postMessageAsync(s.CONFIRM,{data:{title:e.title,content:e.content,okText:e.okText||"Ok",cancelText:e.cancelText||"Cancel"}})}redirect(e){return super._postMessageAsync(s.REDIRECT,{url:e})}}class U extends T{toDate(e){return this._postMessageAsync(s.FORMAT_DATE,{date:e})}toDateTime(e){return this._postMessageAsync(s.FORMAT_DATE_TIME,{date:e})}toNumber(e){return this._postMessageAsync(s.FORMAT_NUMBER,{value:e})}toCurrency(e,t){return this._postMessageAsync(s.FORMAT_CURRENCY,{value:e,currencyCode:t})}toBoolean(e){return this._postMessageAsync(s.FORMAT_BOOLEAN,{value:e})}}const f=r=>r!==null&&typeof r=="object";class u{constructor(e,t={},n=[]){return this.parent=e,this.path=n,new Proxy(t,this)}get(e,t){let n=this.parent.get(t,this.path);return f(n)?new u(this.parent,n,[...this.path,t]):n}set(e,t,n,_){let A=this.parent.set(t,n,this.path);return f(A)?new u(this.parent,A,[...this.path,t]):A}}class y extends T{constructor(t){super();N(this,d);this._id=t.componentId,this.type="Component",P[this._id]=this,m(this,d,w).call(this,t.componentMethods)}onMount(t){this._postMessage(s.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:E.COMPONENT_ON_MOUNT,eventConfig:{once:!0}},t)}refresh(){return this._postMessageAsync(s.COMPONENT_REFRESH,{id:this._id})}show(){return this._postMessageAsync(s.COMPONENT_SHOW,{id:this._id})}hide(){return this._postMessageAsync(s.COMPONENT_HIDE,{id:this._id})}}d=new WeakSet,w=function(t){t==null||t.forEach(n=>{this[n.name]=(..._)=>{if(n.type==="method")return this._postMessageAsync(`COMPONENT_${n.name}`,{id:this._id,parameters:_});n.type==="event"&&this._postMessage(s.COMPONENT_ADD_EVENT_LISTENER,{id:this._id,eventName:n.name,eventConfig:_[1]},_[0])}})};class v extends T{constructor(e){super(),this._id=e,this.type="CustomComponent",P[this._id]=this}watchParams(e){this._postMessage(s.CC_WATCH_PARAMS,{id:this._id,eventName:E.CC_ON_PARAMS_CHANGE,eventConfig:{once:!1}},e)}}class x extends T{constructor(e){super(),this.type="Popup",this._id=e.popupId||M.POPUP_ID}getParameter(e){return this._postMessageAsync(s.GET_POPUP_PARAMS,{key:e,popupId:this._id})}getAllParameters(){return this._postMessageAsync(s.GET_ALL_POPUP_PARAMS,{popupId:this._id})}close(){return this._postMessageAsync(s.CLOSE_POPUP,{})}getComponent(e){return this._postMessageAsync(s.COMPONENT_GET,{componentId:e},!0,t=>new y(t))}}class G extends T{constructor(e){super(),this.type="Page",this.popup=new x({}),this._id=e.pageId,this.variable=new b}getParameter(e){return this._postMessageAsync(s.GET_PAGE_PARAMS,{key:e})}getAllParameters(){return this._postMessageAsync(s.GET_ALL_PAGE_PARAMS,{pageId:this._id})}getVariable(e){return this._postMessageAsync(s.GET_PAGE_VARIABLE,{key:e})}setVariable(e,t){return this._postMessageAsync(s.SET_PAGE_VARIABLE,{key:e,value:t})}openPopup(e,t){return this._postMessageAsync(s.OPEN_POPUP,{popupId:e,popupParams:t})}getComponent(e){return this._postMessageAsync(s.COMPONENT_GET,{componentId:e},!0,t=>new y(t))}}class b extends T{constructor(){return super(),new u(this)}get(e,t){let n={key:e,path:t};return this._postMessageSync(s.GET_PAGE_VARIABLE,n)}set(e,t,n){let _={key:e,value:t,path:n};return this._postMessageSync(s.SET_PAGE_VARIABLE,_)}}class H extends T{constructor(e){super(),this.flowId=e}evaluate(e){return this._postMessageAsync(s.DECISION_TABLE_EXECUTE,{flowId:this.flowId,payload:e})}}class j extends T{constructor(e){super(),this._id=e}importCSV(e){return this._postMessageAsync(s.DATAFORM_IMPORT_CSV,{flowId:this._id,defaultValues:e})}}class K extends T{constructor(e){super(),this._id=e.appId,this.page=new G(e),this.variable=new Y}getVariable(e){return this._postMessageAsync(s.GET_APP_VARIABLE,{key:e})}setVariable(e,t){return this._postMessageAsync(s.SET_APP_VARIABLE,{key:e,value:t})}openPage(e,t){return this._postMessageAsync(s.OPEN_PAGE,{pageId:e,pageParams:t})}getDecisionTable(e){return new H(e)}getDataform(e){return new j(e)}}class Y extends T{constructor(){return super(),new u(this)}get(e,t){let n={key:e,path:t};return this._postMessageSync(s.GET_APP_VARIABLE,n)}set(e,t,n){let _={key:e,value:t,path:n};return this._postMessageSync(s.SET_APP_VARIABLE,_)}}class k extends T{constructor(){super()}api(e,t={}){return this._postMessageAsync(s.API,{url:e,args:t})}initialize(){return globalThis.parent&&globalThis.parent===globalThis?Promise.reject("SDK can be initialized only inside the Kissflow platform."):this._postMessageAsync(s.CC_INITIALIZE,{},!0,e=>(this.app=new K(e),this.page=new G(e),this.context=new v(e.componentId),this.client=new V,this.formatter=new U,this.user=e.user,this.account=e.account,this.env=e.envDetails,this))}initialise(){return this.initialize()}}var J=new k;return J});
package/dist/lowcode.d.ts CHANGED
@@ -47,6 +47,7 @@ declare module "core/constants" {
47
47
  WINDOW_NDEF_READER_MAKE_READONLY: string;
48
48
  WINDOW_NDEF_READER_ABORT_SCAN: string;
49
49
  DECISION_TABLE_EXECUTE: string;
50
+ DATAFORM_IMPORT_CSV: string;
50
51
  };
51
52
  export const EVENT_TYPES: {
52
53
  COMPONENT_ON_MOUNT: string;
@@ -70,6 +71,7 @@ declare module "core/index" {
70
71
  export class BaseSDK extends EventBase {
71
72
  _postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
72
73
  _postMessage(command: string, args: any, callBack?: any): void;
74
+ _postMessageSync(command: string, args: any): any;
73
75
  }
74
76
  export * from "core/constants";
75
77
  }
@@ -134,6 +136,16 @@ declare module "utils/formatter" {
134
136
  declare module "utils/index" {
135
137
  export * from "utils/client";
136
138
  export * from "utils/formatter";
139
+ export const isObject: (value: any) => boolean;
140
+ }
141
+ declare module "core/proxy" {
142
+ export class CreateProxy {
143
+ path: string[];
144
+ parent: object;
145
+ constructor(parent: object, target?: {}, path?: any[]);
146
+ get(target: object, property: string): any;
147
+ set(target: object, property: string, value: any, reciever: any): any;
148
+ }
137
149
  }
138
150
  declare module "types/external" {
139
151
  export type userObject = {
@@ -228,14 +240,20 @@ declare module "app/page" {
228
240
  _id: string;
229
241
  popup: Popup;
230
242
  type: string;
243
+ variable: PageVariable;
231
244
  constructor(props: PageContext);
232
245
  getParameter(key: string): any;
233
246
  getAllParameters(): any;
234
247
  getVariable(key: string): any;
235
- setVariable(key: string, value: any): any;
248
+ setVariable(key: string | object, value: any): any;
236
249
  openPopup(popupId: string, popupParams: object): any;
237
250
  getComponent(componentId: string): Component;
238
251
  }
252
+ class PageVariable extends BaseSDK {
253
+ constructor();
254
+ get(key: any, path: any): any;
255
+ set(key: any, value: any, path: any): any;
256
+ }
239
257
  }
240
258
  declare module "app/decisiontable" {
241
259
  import { BaseSDK } from "core/index";
@@ -245,19 +263,35 @@ declare module "app/decisiontable" {
245
263
  evaluate(payload?: object): any;
246
264
  }
247
265
  }
266
+ declare module "app/dataform" {
267
+ import { BaseSDK } from "core/index";
268
+ export class Dataform extends BaseSDK {
269
+ private _id;
270
+ constructor(flowId: string);
271
+ importCSV(defaultValues: object): any;
272
+ }
273
+ }
248
274
  declare module "app/index" {
249
275
  import { BaseSDK } from "core/index";
250
276
  import { Page } from "app/page";
251
277
  import { AppContext } from "types/internal";
252
278
  import { DecisionTable } from "app/decisiontable";
279
+ import { Dataform } from "app/dataform";
253
280
  export class Application extends BaseSDK {
254
281
  page: Page;
282
+ variable: AppVariable;
255
283
  _id: string;
256
284
  constructor(props: AppContext);
257
285
  getVariable(key: string): any;
258
286
  setVariable(key: string | object, value?: any): any;
259
287
  openPage(pageId: string, pageParams: object): any;
260
288
  getDecisionTable(flowId: string): DecisionTable;
289
+ getDataform(flowId: string): Dataform;
290
+ }
291
+ class AppVariable extends BaseSDK {
292
+ constructor();
293
+ get(key: any, path: any): any;
294
+ set(key: any, value: any, path: any): any;
261
295
  }
262
296
  export * from "app/component";
263
297
  export { Page };
@@ -59,23 +59,29 @@ declare class Page {
59
59
  _id: string
60
60
  popup: Popup
61
61
  type: string
62
+ variable: PageVariable
62
63
  getParameter(key: string): any;
63
64
  getAllParameters(): any;
64
65
  getVariable(key: string): any;
65
- setVariable(key: string, value: any): any;
66
+ setVariable(key: string | object, value: any): any;
66
67
  openPopup(popupId: string, popupParams: object): any;
67
68
  getComponent(componentId: string): Component;
68
69
  }
69
70
  declare class DecisionTable {
70
71
  evaluate(payload?: object): any;
71
72
  }
73
+ declare class Dataform {
74
+ importCSV(defaultValues: object): any;
75
+ }
72
76
  declare class Application {
73
77
  page: Page
78
+ variable: AppVariable
74
79
  _id: string
75
80
  getVariable(key: string): any;
76
81
  setVariable(key: string | object, value?: any): any;
77
82
  openPage(pageId: string, pageParams: object): any;
78
83
  getDecisionTable(flowId: string): DecisionTable;
84
+ getDataform(flowId: string): Dataform;
79
85
  }
80
86
  declare class kf {
81
87
  static context: Component
package/dist/nocode.d.ts CHANGED
@@ -47,6 +47,7 @@ declare module "core/constants" {
47
47
  WINDOW_NDEF_READER_MAKE_READONLY: string;
48
48
  WINDOW_NDEF_READER_ABORT_SCAN: string;
49
49
  DECISION_TABLE_EXECUTE: string;
50
+ DATAFORM_IMPORT_CSV: string;
50
51
  };
51
52
  export const EVENT_TYPES: {
52
53
  COMPONENT_ON_MOUNT: string;
@@ -70,6 +71,7 @@ declare module "core/index" {
70
71
  export class BaseSDK extends EventBase {
71
72
  _postMessageAsync(command: string, args: any, hasCallBack?: boolean, callBack?: (data: any) => {}): object | string | any;
72
73
  _postMessage(command: string, args: any, callBack?: any): void;
74
+ _postMessageSync(command: string, args: any): any;
73
75
  }
74
76
  export * from "core/constants";
75
77
  }
@@ -134,6 +136,7 @@ declare module "utils/formatter" {
134
136
  declare module "utils/index" {
135
137
  export * from "utils/client";
136
138
  export * from "utils/formatter";
139
+ export const isObject: (value: any) => boolean;
137
140
  }
138
141
  declare module "window/NDEFReader" {
139
142
  import { BaseSDK } from "core/index";
@@ -245,6 +248,14 @@ declare module "app/component" {
245
248
  watchParams(callBack: (data: any) => any): void;
246
249
  }
247
250
  }
251
+ declare module "app/dataform" {
252
+ import { BaseSDK } from "core/index";
253
+ export class Dataform extends BaseSDK {
254
+ private _id;
255
+ constructor(flowId: string);
256
+ importCSV(defaultValues: object): any;
257
+ }
258
+ }
248
259
  declare module "app/decisiontable" {
249
260
  import { BaseSDK } from "core/index";
250
261
  export class DecisionTable extends BaseSDK {
@@ -253,6 +264,15 @@ declare module "app/decisiontable" {
253
264
  evaluate(payload?: object): any;
254
265
  }
255
266
  }
267
+ declare module "core/proxy" {
268
+ export class CreateProxy {
269
+ path: string[];
270
+ parent: object;
271
+ constructor(parent: object, target?: {}, path?: any[]);
272
+ get(target: object, property: string): any;
273
+ set(target: object, property: string, value: any, reciever: any): any;
274
+ }
275
+ }
256
276
  declare module "app/popup" {
257
277
  import { BaseSDK } from "core/index";
258
278
  import { Component } from "app/component";
@@ -276,28 +296,42 @@ declare module "app/page" {
276
296
  _id: string;
277
297
  popup: Popup;
278
298
  type: string;
299
+ variable: PageVariable;
279
300
  constructor(props: PageContext);
280
301
  getParameter(key: string): any;
281
302
  getAllParameters(): any;
282
303
  getVariable(key: string): any;
283
- setVariable(key: string, value: any): any;
304
+ setVariable(key: string | object, value: any): any;
284
305
  openPopup(popupId: string, popupParams: object): any;
285
306
  getComponent(componentId: string): Component;
286
307
  }
308
+ class PageVariable extends BaseSDK {
309
+ constructor();
310
+ get(key: any, path: any): any;
311
+ set(key: any, value: any, path: any): any;
312
+ }
287
313
  }
288
314
  declare module "app/index" {
289
315
  import { BaseSDK } from "core/index";
290
316
  import { Page } from "app/page";
291
317
  import { AppContext } from "types/internal";
292
318
  import { DecisionTable } from "app/decisiontable";
319
+ import { Dataform } from "app/dataform";
293
320
  export class Application extends BaseSDK {
294
321
  page: Page;
322
+ variable: AppVariable;
295
323
  _id: string;
296
324
  constructor(props: AppContext);
297
325
  getVariable(key: string): any;
298
326
  setVariable(key: string | object, value?: any): any;
299
327
  openPage(pageId: string, pageParams: object): any;
300
328
  getDecisionTable(flowId: string): DecisionTable;
329
+ getDataform(flowId: string): Dataform;
330
+ }
331
+ class AppVariable extends BaseSDK {
332
+ constructor();
333
+ get(key: any, path: any): any;
334
+ set(key: any, value: any, path: any): any;
301
335
  }
302
336
  export * from "app/component";
303
337
  export { Page };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kissflow/lowcode-client-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.24-beta.1",
4
4
  "description": "JavaScript SDK for developing over the Kissflow lowcode platform",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -40,6 +40,7 @@
40
40
  "start": "vite serve",
41
41
  "customBuild": "node custom.build.mjs",
42
42
  "build": "pnpm run customBuild",
43
- "serve": "http-server -p 8080"
43
+ "serve": "http-server -p 8080",
44
+ "publish-canary": "pnpm publish --tag canary"
44
45
  }
45
46
  }