@kissflow/lowcode-client-sdk 1.0.6 → 1.0.8-beta.2

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 +0,0 @@
1
- {"version":3,"file":"kflowcode.sdk.module.js","mappings":";;;;;;;;AAAa;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA,wCAAwC;AACxC,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,mBAAmB;;;;;;;;;;;AC/CN;AACb;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,+DAA+D,iBAAiB;AAC5G;AACA,oCAAoC,MAAM,+BAA+B,YAAY;AACrF,mCAAmC,MAAM,mCAAmC,YAAY;AACxF,gCAAgC;AAChC;AACA,KAAK;AACL;AACA;AACA,cAAc,6BAA6B,0BAA0B,cAAc,qBAAqB;AACxG,iBAAiB,oDAAoD,qEAAqE,cAAc;AACxJ,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC,mCAAmC,SAAS;AAC5C,mCAAmC,WAAW,UAAU;AACxD,0CAA0C,cAAc;AACxD;AACA,8GAA8G,OAAO;AACrH,iFAAiF,iBAAiB;AAClG,yDAAyD,gBAAgB,QAAQ;AACjF,+CAA+C,gBAAgB,gBAAgB;AAC/E;AACA,kCAAkC;AAClC;AACA;AACA,UAAU,YAAY,aAAa,SAAS,UAAU;AACtD,oCAAoC,SAAS;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe;AACf,kBAAkB,mBAAO,CAAC,uCAAa;AACvC,aAAa,oHAAwB;AACrC;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,4BAA4B;AAC/D,4HAA4H;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa,IAAI;AACjB,SAAS;AACT;AACA;AACA,+BAA+B;AAC/B;AACA,+BAA+B,4BAA4B;AAC3D,sHAAsH,oBAAoB;AAC1I;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,eAAe;AACf;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;;;;;;;;;;ACzKa;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,cAAc;AACd,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,kGAAkG,kBAAkB;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mGAAmG,UAAU;AAC7G;AACA;AACA,CAAC;AACD,cAAc;;;;;;;;;;;AC3CD;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,iBAAiB;;;;;;;;;;;AC5CJ;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB,GAAG,qBAAqB;AAC3C,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;;;;;;;;;;AC/Ca;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB,GAAG,YAAY;AAChC,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,YAAY;AACZ;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,kFAAkF,uBAAuB;AACzG;AACA;AACA,6CAA6C,gEAAgE;AAC7G,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,iBAAiB;;;;;;;;;;;AC7HJ;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,iBAAiB;;;;;;;;;;;ACrDJ;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,eAAe,mBAAO,CAAC,iCAAU;AACjC,kBAAkB,mBAAO,CAAC,uCAAa;AACvC,YAAY,mBAAO,CAAC,2BAAO;AAC3B;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C,sDAAsD;AACtD,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,uEAAuE,sBAAsB;AAC7F;AACA;AACA;AACA;AACA;AACA,+EAA+E;AAC/E;AACA;AACA,CAAC;AACD;AACA,6BAA6B;AAC7B;AACA;AACA,kBAAe;;;;;;;;;;;ACzDF;AACb;AACA;AACA;AACA,eAAe,gBAAgB,sCAAsC,kBAAkB;AACvF,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA,CAAC;AACD,8CAA6C,EAAE,aAAa,EAAC;AAC7D,YAAY;AACZ,kBAAkB,mBAAO,CAAC,uCAAa;AACvC,aAAa,mBAAO,CAAC,6BAAQ;AAC7B,kBAAkB,mBAAO,CAAC,uCAAa;AACvC;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,+EAA+E;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,YAAY;;;;;;;;;;;;;;;;;;;;AC9DyC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA,GAAG;AACiE;;;;;;;;;;;;;;;ACjCpE;AACA;AACsB;;;;;;;SCFtB;SACA;;SAEA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;SACA;;SAEA;SACA;;SAEA;SACA;SACA;;;;;UCtBA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;UCAA;UACA;UACA;UACA,uDAAuD,iBAAiB;UACxE;UACA,gDAAgD,aAAa;UAC7D;;;;;;;;;;;ACNa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB,mBAAO,CAAC,2CAAe;AAC3C,IAAI,IAAuC;AAC3C;AACA;AACA,kBAAe","sources":["webpack://@kissflow/lowcode-client-sdk/./src/app.ts","webpack://@kissflow/lowcode-client-sdk/./src/base.ts","webpack://@kissflow/lowcode-client-sdk/./src/client.ts","webpack://@kissflow/lowcode-client-sdk/./src/component.ts","webpack://@kissflow/lowcode-client-sdk/./src/constants.ts","webpack://@kissflow/lowcode-client-sdk/./src/form.ts","webpack://@kissflow/lowcode-client-sdk/./src/formatter.ts","webpack://@kissflow/lowcode-client-sdk/./src/lowcode.sdk.ts","webpack://@kissflow/lowcode-client-sdk/./src/page.ts","webpack://@kissflow/lowcode-client-sdk/./node_modules/.pnpm/nanoid@3.3.3/node_modules/nanoid/index.browser.js","webpack://@kissflow/lowcode-client-sdk/./node_modules/.pnpm/nanoid@3.3.3/node_modules/nanoid/url-alphabet/index.js","webpack://@kissflow/lowcode-client-sdk/webpack/bootstrap","webpack://@kissflow/lowcode-client-sdk/webpack/runtime/define property getters","webpack://@kissflow/lowcode-client-sdk/webpack/runtime/hasOwnProperty shorthand","webpack://@kissflow/lowcode-client-sdk/webpack/runtime/make namespace object","webpack://@kissflow/lowcode-client-sdk/./src/index.ts"],"sourcesContent":["\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Application = void 0;\nvar base_1 = require(\"./base\");\nvar page_1 = require(\"./page\");\nvar constants_1 = require(\"./constants\");\nvar Application = /** @class */ (function (_super) {\n __extends(Application, _super);\n function Application(props) {\n var _this = _super.call(this, {}) || this;\n _this.page = new page_1.Page({});\n return _this;\n }\n Application.prototype.getVariable = function (key) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_APP_VARIABLE, {\n key: key\n });\n };\n Application.prototype.setVariable = function (key, value) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_APP_VARIABLE, {\n key: key,\n value: value\n });\n };\n Application.prototype.openPage = function (pageId, pageParams) {\n return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.OPEN_PAGE, {\n pageId: pageId,\n pageParams: pageParams\n });\n };\n return Application;\n}(base_1.BaseSDK));\nexports.Application = Application;\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar _BaseSDK_instances, _BaseSDK_listeners, _BaseSDK_eventListeners, _BaseSDK_addListener, _BaseSDK_appendEventListeners, _BaseSDK_checkEvents, _BaseSDK_onMessage;\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BaseSDK = void 0;\nvar constants_1 = require(\"./constants\");\nvar nanoid = require(\"nanoid\").nanoid;\nfunction generateId(prefix) {\n if (prefix === void 0) { prefix = \"lcncsdk\"; }\n return \"\".concat(prefix, \"-\").concat(nanoid());\n}\nfunction postMessage(args) {\n console.log(\"SDK : @postMessage \", args);\n if (self.parent && self.parent !== self) {\n self.parent.postMessage(args, \"*\");\n }\n else {\n self.postMessage(args);\n }\n}\nvar BaseSDK = /** @class */ (function () {\n function BaseSDK(props) {\n _BaseSDK_instances.add(this);\n _BaseSDK_listeners.set(this, void 0);\n _BaseSDK_eventListeners.set(this, void 0);\n console.log(\"SDK : Initializing \", props);\n __classPrivateFieldSet(this, _BaseSDK_listeners, {}, \"f\");\n __classPrivateFieldSet(this, _BaseSDK_eventListeners, {}, \"f\");\n self.addEventListener(\"message\", __classPrivateFieldGet(this, _BaseSDK_instances, \"m\", _BaseSDK_onMessage).bind(this), false);\n }\n BaseSDK.prototype._postMessageAsync = function (command, args, hasCallBack, callBack) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var _id = generateId(command.toLowerCase());\n postMessage(__assign({ _id: _id, command: command }, args));\n __classPrivateFieldGet(_this, _BaseSDK_instances, \"m\", _BaseSDK_addListener).call(_this, _id, function (data) { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!data.errorMessage) return [3 /*break*/, 1];\n reject(data);\n return [3 /*break*/, 4];\n case 1:\n if (!(hasCallBack && callBack)) return [3 /*break*/, 3];\n return [4 /*yield*/, callBack(data)];\n case 2:\n data = _a.sent();\n _a.label = 3;\n case 3:\n resolve(data);\n _a.label = 4;\n case 4: return [2 /*return*/];\n }\n });\n }); });\n });\n };\n BaseSDK.prototype._postMessage = function (command, func, args) {\n if (args === void 0) { args = {}; }\n var _id = generateId(command.toLowerCase());\n postMessage(__assign({ _id: _id, command: command }, args));\n __classPrivateFieldGet(this, _BaseSDK_instances, \"m\", _BaseSDK_addListener).call(this, _id, function (data) { return func(data); });\n };\n BaseSDK.prototype._registerEventListener = function (_id, eventType, callback) {\n __classPrivateFieldGet(this, _BaseSDK_instances, \"m\", _BaseSDK_appendEventListeners).call(this, _id, eventType, callback);\n };\n return BaseSDK;\n}());\nexports.BaseSDK = BaseSDK;\n_BaseSDK_listeners = new WeakMap(), _BaseSDK_eventListeners = new WeakMap(), _BaseSDK_instances = new WeakSet(), _BaseSDK_addListener = function _BaseSDK_addListener(_id, callback) {\n __classPrivateFieldGet(this, _BaseSDK_listeners, \"f\")[_id] = __classPrivateFieldGet(this, _BaseSDK_listeners, \"f\")[_id] || [];\n __classPrivateFieldGet(this, _BaseSDK_listeners, \"f\")[_id].push(callback);\n}, _BaseSDK_appendEventListeners = function _BaseSDK_appendEventListeners(_id, eventType, callback) {\n if (!__classPrivateFieldGet(this, _BaseSDK_eventListeners, \"f\")[_id]) {\n __classPrivateFieldGet(this, _BaseSDK_eventListeners, \"f\")[_id] = {};\n }\n __classPrivateFieldGet(this, _BaseSDK_eventListeners, \"f\")[_id][eventType] = callback;\n}, _BaseSDK_checkEvents = function _BaseSDK_checkEvents(data) {\n var _id = data._id, eventType = data.eventType, eventParams = data.eventParams;\n if (!_id || !eventType)\n return;\n var eventListener = __classPrivateFieldGet(this, _BaseSDK_eventListeners, \"f\")[_id] || {};\n if (eventListener[eventType]) {\n eventListener[eventType](eventParams || {});\n }\n}, _BaseSDK_onMessage = function _BaseSDK_onMessage(event) {\n if (event.origin !== self.location.origin) {\n console.log(\"SDK : @onMessage \", event);\n var data_1 = event.data;\n if (data_1.isEvent) {\n return __classPrivateFieldGet(this, _BaseSDK_instances, \"m\", _BaseSDK_checkEvents).call(this, data_1);\n }\n var _req_1 = (data_1 === null || data_1 === void 0 ? void 0 : data_1._req) || {};\n var listeners = __classPrivateFieldGet(this, _BaseSDK_listeners, \"f\")[_req_1 === null || _req_1 === void 0 ? void 0 : _req_1._id] || [];\n if (listeners) {\n listeners.forEach(function (listener) {\n try {\n if (data_1.resp &&\n Object.keys(data_1.resp).length === 1 &&\n _req_1.command !== constants_1.LISTENER_CMDS.API) {\n listener(Object.values(data_1.resp)[0]);\n }\n else {\n listener(data_1.resp);\n }\n }\n catch (err) {\n console.error(\"Message callback error: \", err);\n }\n });\n }\n }\n};\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Client = void 0;\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar Client = /** @class */ (function (_super) {\n __extends(Client, _super);\n function Client() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Client.prototype.showInfo = function (message) {\n return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.MESSAGE, { message: message });\n };\n Client.prototype.showConfirm = function (args) {\n return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.CONFIRM, {\n data: {\n title: args.title,\n content: args.content,\n okText: args.okText || \"Ok\",\n cancelText: args.cancelText || \"Cancel\"\n }\n });\n };\n Client.prototype.redirect = function (url) {\n return _super.prototype._postMessageAsync.call(this, constants_1.LISTENER_CMDS.REDIRECT, { url: url });\n };\n return Client;\n}(base_1.BaseSDK));\nexports.Client = Client;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Component = void 0;\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar Component = /** @class */ (function (_super) {\n __extends(Component, _super);\n function Component(id) {\n var _this = _super.call(this, {}) || this;\n _this.id = id;\n return _this;\n }\n Component.prototype.refresh = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_REFRESH, {\n id: this.id\n });\n };\n Component.prototype.show = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_SHOW, {\n id: this.id\n });\n };\n Component.prototype.hide = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.COMPONENT_HIDE, {\n id: this.id\n });\n };\n return Component;\n}(base_1.BaseSDK));\nexports.Component = Component;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EVENT_TYPES = exports.LISTENER_CMDS = void 0;\nexports.LISTENER_CMDS = {\n API: \"API\",\n PARAMS: \"PARAMS\",\n GET_CONTEXT: \"GET_CONTEXT\",\n RETURN: \"RETURN\",\n //Forms SDK Functions\n GET_FORM_FIELD: \"GET_FORM_FIELD\",\n UPDATE_FORM: \"UPDATE_FORM\",\n GET_TABLE: \"GET_TABLE\",\n GET_TABLE_ROW: \"GET_TABLE_ROW\",\n ADD_TABLE_ROW: \"ADD_TABLE_ROW\",\n DELETE_TABLE_ROW: \"DELETE_TABLE_ROW\",\n TO_JSON: \"TO_JSON\",\n GET_TABLE_ROWS: \"GET_TABLE_ROWS\",\n //Client SDK functions\n MESSAGE: \"MESSAGE\",\n CONFIRM: \"CONFIRM\",\n ALERT: \"ALERT\",\n REDIRECT: \"REDIRECT\",\n OPEN_PAGE: \"OPEN_PAGE\",\n //Formatter SDK Functions\n FORMAT_DATE: \"FORMAT_DATE\",\n FORMAT_DATE_TIME: \"FORMAT_DATE_TIME\",\n FORMAT_NUMBER: \"FORMAT_NUMBER\",\n FORMAT_CURRENCY: \"FORMAT_CURRENCY\",\n FORMAT_BOOLEAN: \"FORMAT_BOOLEAN\",\n //Application SDK functions\n GET_APP_VARIABLE: \"GET_APP_VARIABLE\",\n SET_APP_VARIABLE: \"SET_APP_VARIABLE\",\n //Application page sdk functions\n GET_PAGE_VARIABLE: \"GET_PAGE_VARIABLE\",\n SET_PAGE_VARIABLE: \"SET_PAGE_VARIABLE\",\n GET_PAGE_PARAMS: \"GET_PAGE_PARAMS\",\n OPEN_POPUP_PAGE: \"OPEN_POPUP_PAGE\",\n PAGE_ON_CLOSE: \"PAGE_ON_CLOSE\",\n CLOSE_POPUP: \"CLOSE_POPUP\",\n COMPONENT_REFRESH: \"COMPONENT_REFRESH\",\n COMPONENT_SHOW: \"COMPONENT_SHOW\",\n COMPONENT_HIDE: \"COMPONENT_HIDE\"\n};\nexports.EVENT_TYPES = {\n ON_CLOSE: \"onClose\",\n ON_CHANGE: \"onChange\",\n ON_LOAD: \"onLoad\",\n};\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TableForm = exports.Form = void 0;\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar Form = /** @class */ (function (_super) {\n __extends(Form, _super);\n function Form(instanceId) {\n var _this = _super.call(this, {}) || this;\n _this.instanceId = instanceId;\n return _this;\n }\n Form.prototype.toJSON = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {\n instanceId: this.instanceId\n });\n };\n Form.prototype.getField = function (fieldId) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {\n instanceId: this.instanceId,\n fieldId: fieldId\n });\n };\n Form.prototype.updateField = function (args) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {\n data: args\n });\n };\n Form.prototype.getTable = function (tableId) {\n return new Table(this.instanceId, tableId);\n };\n return Form;\n}(base_1.BaseSDK));\nexports.Form = Form;\nvar Table = /** @class */ (function (_super) {\n __extends(Table, _super);\n function Table(instanceId, tableId) {\n var _this = _super.call(this, {}) || this;\n _this.tableId = tableId;\n _this.instanceId = instanceId;\n return _this;\n }\n // list of obj of rows\n Table.prototype.toJSON = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {\n tableId: this.tableId\n });\n };\n Table.prototype.getRows = function () {\n var _this = this;\n // list of TableForm class\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_TABLE_ROWS, { tableId: this.tableId }, true, // has callBack\n function (data) {\n console.log(data);\n return data.map(function (row) { return new TableForm(_this.instanceId, _this.tableId, row.id); });\n });\n };\n Table.prototype.getRow = function (rowId) {\n return new TableForm(this.instanceId, this.tableId, rowId);\n };\n Table.prototype.addRow = function (rowObject) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.ADD_TABLE_ROW, {\n tableId: this.tableId,\n rowObject: rowObject\n });\n };\n Table.prototype.deleteRow = function (rowId) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.DELETE_TABLE_ROW, {\n tableId: this.tableId,\n rowId: rowId\n });\n };\n return Table;\n}(base_1.BaseSDK));\nvar TableForm = /** @class */ (function (_super) {\n __extends(TableForm, _super);\n function TableForm(instanceId, tableId, rowId) {\n var _this = _super.call(this, {}) || this;\n _this.instanceId = instanceId;\n _this.tableId = tableId;\n _this.rowId = rowId;\n return _this;\n }\n TableForm.prototype.getParent = function () {\n return new Form(this.instanceId);\n };\n TableForm.prototype.toJSON = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.TO_JSON, {\n tableId: this.tableId,\n rowId: this.rowId\n });\n };\n TableForm.prototype.getField = function (fieldId) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_FORM_FIELD, {\n instanceId: this.instanceId,\n tableId: this.tableId,\n rowId: this.rowId,\n fieldId: fieldId\n });\n };\n TableForm.prototype.updateField = function (args) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.UPDATE_FORM, {\n instanceId: this.instanceId,\n tableId: this.tableId,\n rowId: this.rowId,\n data: args\n });\n };\n return TableForm;\n}(base_1.BaseSDK));\nexports.TableForm = TableForm;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Formatter = void 0;\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar Formatter = /** @class */ (function (_super) {\n __extends(Formatter, _super);\n function Formatter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Formatter.prototype.toDate = function (date) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE, {\n date: date,\n });\n };\n Formatter.prototype.toDateTime = function (date) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_DATE_TIME, {\n date: date,\n });\n };\n Formatter.prototype.toNumber = function (value) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_NUMBER, {\n value: value,\n });\n };\n Formatter.prototype.toCurrency = function (value, currencyCode) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_CURRENCY, {\n value: value,\n currencyCode: currencyCode,\n });\n };\n Formatter.prototype.toBoolean = function (value) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.FORMAT_BOOLEAN, {\n value: value\n });\n };\n return Formatter;\n}(base_1.BaseSDK));\nexports.Formatter = Formatter;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar form_1 = require(\"./form\");\nvar form_2 = require(\"./form\");\nvar client_1 = require(\"./client\");\nvar formatter_1 = require(\"./formatter\");\nvar app_1 = require(\"./app\");\nvar LowcodeSDK = /** @class */ (function (_super) {\n __extends(LowcodeSDK, _super);\n function LowcodeSDK(props) {\n var _this = _super.call(this, {}) || this;\n if (props.tableId && props.rowId) {\n _this.currentForm = new form_2.TableForm(props.instanceId, props.tableId, props.rowId);\n }\n else if (props.instanceId) {\n _this.currentForm = new form_1.Form(props.instanceId);\n }\n _this.client = new client_1.Client({});\n _this.formatter = new formatter_1.Formatter({});\n _this.app = new app_1.Application({});\n _this.user = props.user;\n _this.account = props.account;\n return _this;\n }\n LowcodeSDK.prototype.api = function (url, args) {\n if (args === void 0) { args = {}; }\n return this._postMessageAsync(constants_1.LISTENER_CMDS.API, { url: url, args: args });\n };\n LowcodeSDK.prototype.watchParams = function (func) {\n this._postMessage(constants_1.LISTENER_CMDS.PARAMS, func);\n };\n LowcodeSDK.prototype.getContext = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_CONTEXT, {});\n };\n return LowcodeSDK;\n}(base_1.BaseSDK));\nfunction initSDK(config) {\n if (config === void 0) { config = {}; }\n return new LowcodeSDK(config);\n}\nexports.default = initSDK;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Page = void 0;\nvar component_1 = require(\"./component\");\nvar base_1 = require(\"./base\");\nvar constants_1 = require(\"./constants\");\nvar Page = /** @class */ (function (_super) {\n __extends(Page, _super);\n function Page(pageId) {\n var _this = _super.call(this, {}) || this;\n _this._id = pageId;\n return _this;\n }\n Page.prototype.getParameter = function (key) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_PARAMS, {\n key: key\n });\n };\n Page.prototype.getVariable = function (key) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_VARIABLE, {\n key: key\n });\n };\n Page.prototype.setVariable = function (key, value) {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_PAGE_VARIABLE, {\n key: key,\n value: value\n });\n };\n Page.prototype.openPopup = function (popupId, popupParams) {\n //TODO: add popup class\n return this._postMessageAsync(constants_1.LISTENER_CMDS.OPEN_POPUP_PAGE, {\n popupId: popupId,\n popupParams: popupParams\n });\n };\n Page.prototype.closePopup = function () {\n return this._postMessageAsync(constants_1.LISTENER_CMDS.CLOSE_POPUP, {});\n };\n Page.prototype.getComponent = function (componentId) {\n return new component_1.Component(componentId);\n };\n Page.prototype.onClose = function (callback) {\n this._registerEventListener(this._id, constants_1.EVENT_TYPES.ON_CLOSE, callback);\n };\n return Page;\n}(base_1.BaseSDK));\nexports.Page = Page;\n","import { urlAlphabet } from './url-alphabet/index.js'\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\nexport { nanoid, customAlphabet, customRandom, urlAlphabet, random }\n","let urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\nexport { urlAlphabet }\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar lowcode_sdk_1 = require(\"./lowcode.sdk\");\nif (typeof _BUILD !== \"undefined\" && _BUILD) {\n self.KF = lowcode_sdk_1.default;\n}\nexports.default = lowcode_sdk_1.default;\n"],"names":[],"sourceRoot":""}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- exports.__esModule = true;
18
- var base_1 = require("./base");
19
- var constants_1 = require("./constants");
20
- var form_1 = require("./form");
21
- var form_2 = require("./form");
22
- var client_1 = require("./client");
23
- var formatter_1 = require("./formatter");
24
- var app_1 = require("./app");
25
- var LowcodeSDK = /** @class */ (function (_super) {
26
- __extends(LowcodeSDK, _super);
27
- function LowcodeSDK(props) {
28
- var _this = _super.call(this, {}) || this;
29
- if (props.tableId && props.rowId) {
30
- _this.currentForm = new form_2.TableForm(props.instanceId, props.tableId, props.rowId);
31
- }
32
- else if (props.instanceId) {
33
- _this.currentForm = new form_1.Form(props.instanceId);
34
- }
35
- _this.client = new client_1.Client({});
36
- _this.formatter = new formatter_1.Formatter({});
37
- _this.app = new app_1.Application({});
38
- _this.user = props.user;
39
- _this.account = props.account;
40
- return _this;
41
- }
42
- LowcodeSDK.prototype.api = function (url, args) {
43
- if (args === void 0) { args = {}; }
44
- return this._postMessageAsync(constants_1.LISTENER_CMDS.API, { url: url, args: args });
45
- };
46
- LowcodeSDK.prototype.watchParams = function (func) {
47
- this._postMessage(constants_1.LISTENER_CMDS.PARAMS, func);
48
- };
49
- LowcodeSDK.prototype.getContext = function () {
50
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_CONTEXT, {});
51
- };
52
- return LowcodeSDK;
53
- }(base_1.BaseSDK));
54
- function initSDK(config) {
55
- if (config === void 0) { config = {}; }
56
- return new LowcodeSDK(config);
57
- }
58
- exports["default"] = initSDK;
package/dist/page.js DELETED
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- exports.__esModule = true;
18
- exports.Page = void 0;
19
- var component_1 = require("./component");
20
- var base_1 = require("./base");
21
- var constants_1 = require("./constants");
22
- var Page = /** @class */ (function (_super) {
23
- __extends(Page, _super);
24
- function Page(pageId) {
25
- var _this = _super.call(this, {}) || this;
26
- _this._id = pageId;
27
- return _this;
28
- }
29
- Page.prototype.getParameter = function (key) {
30
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_PARAMS, {
31
- key: key
32
- });
33
- };
34
- Page.prototype.getVariable = function (key) {
35
- return this._postMessageAsync(constants_1.LISTENER_CMDS.GET_PAGE_VARIABLE, {
36
- key: key
37
- });
38
- };
39
- Page.prototype.setVariable = function (key, value) {
40
- return this._postMessageAsync(constants_1.LISTENER_CMDS.SET_PAGE_VARIABLE, {
41
- key: key,
42
- value: value
43
- });
44
- };
45
- Page.prototype.openPopup = function (popupId, popupParams) {
46
- //TODO: add popup class
47
- return this._postMessageAsync(constants_1.LISTENER_CMDS.OPEN_POPUP_PAGE, {
48
- popupId: popupId,
49
- popupParams: popupParams
50
- });
51
- };
52
- Page.prototype.closePopup = function () {
53
- return this._postMessageAsync(constants_1.LISTENER_CMDS.CLOSE_POPUP, {});
54
- };
55
- Page.prototype.getComponent = function (componentId) {
56
- return new component_1.Component(componentId);
57
- };
58
- Page.prototype.onClose = function (callback) {
59
- this._registerEventListener(this._id, constants_1.EVENT_TYPES.ON_CLOSE, callback);
60
- };
61
- return Page;
62
- }(base_1.BaseSDK));
63
- exports.Page = Page;
package/dist/sdk.types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- exports.__esModule = true;
package/id DELETED
@@ -1,55 +0,0 @@
1
- {
2
- "_id": "Account001",
3
- "Name": "OS",
4
- "UserDetails": {
5
- "_id": "User001",
6
- "Name": "Vivek",
7
- "AppConfig": {
8
- "Env": "AltairUSP001",
9
- "ProfileBasePath": "https://s3.amazonaws.com/altair-sss-pro-p001",
10
- "UploadHost": "https://attachment.kissflow.com"
11
- },
12
- "ProfilePicture": {
13
- "large": {
14
- "fileExtension": "jpeg",
15
- "height": 150,
16
- "key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/150x150.jpeg",
17
- "name": "150x150.jpeg",
18
- "size": 7939,
19
- "width": 150
20
- },
21
- "medium": {
22
- "fileExtension": "jpeg",
23
- "height": 130,
24
- "key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/130x130.jpeg",
25
- "name": "130x130.jpeg",
26
- "size": 6433,
27
- "width": 130
28
- },
29
- "original": {
30
- "fileExtension": "jpg",
31
- "height": 2611,
32
- "key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/Vivek-Engg.jpg",
33
- "name": "Vivek-Engg.jpg",
34
- "size": 1797398,
35
- "width": 2611
36
- },
37
- "preview": {
38
- "fileExtension": "jpeg",
39
- "height": 600,
40
- "key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/600x600.jpeg",
41
- "name": "600x600.jpeg",
42
- "size": 86345,
43
- "width": 600
44
- },
45
- "small": {
46
- "fileExtension": "jpeg",
47
- "height": 70,
48
- "key": "AcFlqmVfTZ1X/UsEEpZPxSsvJ/photos/70x70.jpeg",
49
- "name": "70x70.jpeg",
50
- "size": 2691,
51
- "width": 70
52
- }
53
- }
54
- }
55
- }
package/index.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Kissflow LCNC SDK</title>
7
- </head>
8
- <body>
9
- <h1 id="title">Kissflow SDK Check</h1>
10
- <iframe id="component1" src="http://localhost:8080" width="500px" height="500px">
11
- <p>Your browser does not support iframes.</p>
12
- </iframe>
13
-
14
- <iframe id="component2" src="http://localhost:3000" width="500px" height="500px">
15
- <p>Your browser does not support iframes.</p>
16
- </iframe>
17
- </body>
18
- <script type="module">
19
- import MockAPI from './test/mock/api.js';
20
- import LCNCHandler from './test/lcnc-handler.js';
21
- LCNCHandler();
22
- </script>
23
- </html>
package/src/app.ts DELETED
@@ -1,31 +0,0 @@
1
- import { BaseSDK } from "./base";
2
- import { Page } from "./page";
3
- import { LISTENER_CMDS } from "./constants";
4
-
5
- export class Application extends BaseSDK {
6
- page: Page;
7
-
8
- constructor(props: any) {
9
- super({});
10
- this.page = new Page({});
11
- }
12
- getVariable(key: string) {
13
- return this._postMessageAsync(LISTENER_CMDS.GET_APP_VARIABLE, {
14
- key
15
- });
16
- }
17
-
18
- setVariable(key: string | object, value: any) {
19
- return this._postMessageAsync(LISTENER_CMDS.SET_APP_VARIABLE, {
20
- key,
21
- value
22
- });
23
- }
24
-
25
- openPage(pageId: string, pageParams: object) {
26
- return super._postMessageAsync(LISTENER_CMDS.OPEN_PAGE, {
27
- pageId,
28
- pageParams
29
- });
30
- }
31
- }
package/src/base.ts DELETED
@@ -1,108 +0,0 @@
1
- import { LISTENER_CMDS } from "./constants";
2
- const { nanoid } = require("nanoid");
3
-
4
- function generateId(prefix = "lcncsdk") {
5
- return `${prefix}-${nanoid()}`;
6
- }
7
-
8
- function postMessage(args: any) {
9
- console.log("SDK : @postMessage ", args);
10
- if (self.parent && self.parent !== self) {
11
- self.parent.postMessage(args, "*");
12
- } else {
13
- self.postMessage(args);
14
- }
15
- }
16
-
17
- export class BaseSDK {
18
- #listeners: any;
19
- #eventListeners: object;
20
- constructor(props: any) {
21
- console.log("SDK : Initializing ", props);
22
- this.#listeners = {};
23
- this.#eventListeners = {};
24
- self.addEventListener("message", this.#onMessage.bind(this), false);
25
- }
26
-
27
- #addListener(_id: string, callback: any) {
28
- this.#listeners[_id] = this.#listeners[_id] || [];
29
- this.#listeners[_id].push(callback);
30
- }
31
-
32
- #appendEventListeners(_id: string, eventType: string, callback: any) {
33
- if (!this.#eventListeners[_id]) {
34
- this.#eventListeners[_id] = {};
35
- }
36
- this.#eventListeners[_id][eventType] = callback;
37
- }
38
-
39
- _postMessageAsync(
40
- command: string,
41
- args: any,
42
- hasCallBack?: boolean,
43
- callBack?: (data: any) => {}
44
- ): object | string | any {
45
- return new Promise((resolve, reject) => {
46
- const _id = generateId(command.toLowerCase());
47
- postMessage({ _id, command, ...args });
48
- this.#addListener(_id, async (data: any) => {
49
- if (data.errorMessage) {
50
- reject(data);
51
- } else {
52
- if (hasCallBack && callBack) {
53
- data = await callBack(data);
54
- }
55
- resolve(data);
56
- }
57
- });
58
- });
59
- }
60
-
61
- _postMessage(command: string, func: (data: any) => {}, args = {}) {
62
- const _id = generateId(command.toLowerCase());
63
- postMessage({ _id, command, ...args });
64
- this.#addListener(_id, (data: any) => func(data));
65
- }
66
-
67
- _registerEventListener(_id: string, eventType: string, callback: any) {
68
- this.#appendEventListeners(_id, eventType, callback);
69
- }
70
-
71
- #checkEvents(data: any) {
72
- const { _id, eventType, eventParams } = data;
73
- if (!_id || !eventType) return;
74
- const eventListener = this.#eventListeners[_id] || {};
75
- if (eventListener[eventType]) {
76
- eventListener[eventType](eventParams || {});
77
- }
78
- }
79
-
80
- #onMessage(event: any) {
81
- if (event.origin !== self.location.origin) {
82
- console.log("SDK : @onMessage ", event);
83
- const data = event.data;
84
- if (data.isEvent) {
85
- return this.#checkEvents(data);
86
- }
87
- const _req = data?._req || {};
88
- let listeners = this.#listeners[_req?._id] || [];
89
- if (listeners) {
90
- listeners.forEach((listener: any) => {
91
- try {
92
- if (
93
- data.resp &&
94
- Object.keys(data.resp).length === 1 &&
95
- _req.command !== LISTENER_CMDS.API
96
- ) {
97
- listener(Object.values(data.resp)[0]);
98
- } else {
99
- listener(data.resp);
100
- }
101
- } catch (err) {
102
- console.error("Message callback error: ", err);
103
- }
104
- });
105
- }
106
- }
107
- }
108
- }
package/src/client.ts DELETED
@@ -1,28 +0,0 @@
1
- import { BaseSDK } from "./base";
2
- import { LISTENER_CMDS } from "./constants";
3
-
4
- export class Client extends BaseSDK {
5
- showInfo(message: string) {
6
- return super._postMessageAsync(LISTENER_CMDS.MESSAGE, { message });
7
- }
8
-
9
- showConfirm(args: {
10
- title: string;
11
- content: string;
12
- okText: string;
13
- cancelText: string;
14
- }) {
15
- return super._postMessageAsync(LISTENER_CMDS.CONFIRM, {
16
- data: {
17
- title: args.title,
18
- content: args.content,
19
- okText: args.okText || "Ok",
20
- cancelText: args.cancelText || "Cancel"
21
- }
22
- });
23
- }
24
-
25
- redirect(url: string) {
26
- return super._postMessageAsync(LISTENER_CMDS.REDIRECT, { url });
27
- }
28
- }
package/src/component.ts DELETED
@@ -1,25 +0,0 @@
1
- import { BaseSDK } from "./base";
2
- import { LISTENER_CMDS } from "./constants";
3
-
4
- export class Component extends BaseSDK {
5
- id: string;
6
- constructor(id: string) {
7
- super({});
8
- this.id = id;
9
- }
10
- refresh() {
11
- return this._postMessageAsync(LISTENER_CMDS.COMPONENT_REFRESH, {
12
- id: this.id
13
- });
14
- }
15
- show() {
16
- return this._postMessageAsync(LISTENER_CMDS.COMPONENT_SHOW, {
17
- id: this.id
18
- });
19
- }
20
- hide() {
21
- return this._postMessageAsync(LISTENER_CMDS.COMPONENT_HIDE, {
22
- id: this.id
23
- });
24
- }
25
- }
package/src/constants.ts DELETED
@@ -1,53 +0,0 @@
1
- export const LISTENER_CMDS = {
2
- API: "API",
3
- PARAMS: "PARAMS",
4
- GET_CONTEXT: "GET_CONTEXT",
5
- RETURN: "RETURN",
6
-
7
- //Forms SDK Functions
8
- GET_FORM_FIELD: "GET_FORM_FIELD",
9
- UPDATE_FORM: "UPDATE_FORM",
10
- GET_TABLE: "GET_TABLE",
11
- GET_TABLE_ROW: "GET_TABLE_ROW",
12
- ADD_TABLE_ROW: "ADD_TABLE_ROW",
13
- DELETE_TABLE_ROW: "DELETE_TABLE_ROW",
14
- TO_JSON: "TO_JSON",
15
- GET_TABLE_ROWS: "GET_TABLE_ROWS",
16
-
17
- //Client SDK functions
18
- MESSAGE: "MESSAGE",
19
- CONFIRM: "CONFIRM",
20
- ALERT: "ALERT",
21
- REDIRECT: "REDIRECT",
22
- OPEN_PAGE: "OPEN_PAGE",
23
-
24
- //Formatter SDK Functions
25
- FORMAT_DATE: "FORMAT_DATE",
26
- FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
27
- FORMAT_NUMBER: "FORMAT_NUMBER",
28
- FORMAT_CURRENCY: "FORMAT_CURRENCY",
29
- FORMAT_BOOLEAN: "FORMAT_BOOLEAN",
30
-
31
- //Application SDK functions
32
- GET_APP_VARIABLE: "GET_APP_VARIABLE",
33
- SET_APP_VARIABLE: "SET_APP_VARIABLE",
34
-
35
- //Application page sdk functions
36
- GET_PAGE_VARIABLE: "GET_PAGE_VARIABLE",
37
- SET_PAGE_VARIABLE: "SET_PAGE_VARIABLE",
38
- GET_PAGE_PARAMS: "GET_PAGE_PARAMS",
39
- OPEN_POPUP_PAGE: "OPEN_POPUP_PAGE",
40
- PAGE_ON_CLOSE: "PAGE_ON_CLOSE",
41
- CLOSE_POPUP: "CLOSE_POPUP",
42
-
43
- COMPONENT_REFRESH: "COMPONENT_REFRESH",
44
- COMPONENT_SHOW: "COMPONENT_SHOW",
45
- COMPONENT_HIDE: "COMPONENT_HIDE"
46
- };
47
-
48
-
49
- export const EVENT_TYPES = {
50
- ON_CLOSE: "onClose",
51
- ON_CHANGE: "onChange",
52
- ON_LOAD: "onLoad",
53
- }