@botonic/plugin-flow-builder 0.21.0-alpha.0 → 0.21.0-alpha.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.
- package/lib/{action.d.ts → cjs/action.d.ts} +0 -0
- package/lib/cjs/action.js +46 -0
- package/lib/cjs/action.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/button.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/button.js +2 -4
- package/lib/cjs/content-fields/button.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/carousel.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/carousel.js +2 -5
- package/lib/cjs/content-fields/carousel.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/content-base.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/content-base.js +0 -0
- package/lib/cjs/content-fields/content-base.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/element.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/element.js +0 -0
- package/lib/cjs/content-fields/element.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/image.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/image.js +2 -4
- package/lib/cjs/content-fields/image.js.map +1 -0
- package/lib/{content-fields → cjs/content-fields}/text.d.ts +0 -0
- package/lib/{content-fields → cjs/content-fields}/text.js +2 -4
- package/lib/cjs/content-fields/text.js.map +1 -0
- package/lib/{functions → cjs/functions}/conditional-provider.d.ts +0 -0
- package/lib/{functions → cjs/functions}/conditional-provider.js +0 -0
- package/lib/cjs/functions/conditional-provider.js.map +1 -0
- package/lib/{functions → cjs/functions}/conditional-queue-status.d.ts +0 -0
- package/lib/cjs/functions/conditional-queue-status.js +12 -0
- package/lib/cjs/functions/conditional-queue-status.js.map +1 -0
- package/lib/{functions → cjs/functions}/index.d.ts +0 -0
- package/lib/{functions → cjs/functions}/index.js +0 -0
- package/lib/cjs/functions/index.js.map +1 -0
- package/lib/{handoff.d.ts → cjs/handoff.d.ts} +0 -0
- package/lib/cjs/handoff.js +28 -0
- package/lib/cjs/handoff.js.map +1 -0
- package/lib/{hubtype-models.d.ts → cjs/hubtype-models.d.ts} +0 -0
- package/lib/{hubtype-models.js → cjs/hubtype-models.js} +0 -0
- package/lib/cjs/hubtype-models.js.map +1 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +142 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{utils.d.ts → cjs/utils.d.ts} +0 -0
- package/lib/{utils.js → cjs/utils.js} +0 -0
- package/lib/cjs/utils.js.map +1 -0
- package/lib/esm/action.d.ts +15 -0
- package/lib/esm/action.js +41 -0
- package/lib/esm/action.js.map +1 -0
- package/lib/esm/content-fields/button.d.ts +10 -0
- package/lib/esm/content-fields/button.js +26 -0
- package/lib/esm/content-fields/button.js.map +1 -0
- package/lib/esm/content-fields/carousel.d.ts +10 -0
- package/lib/esm/content-fields/carousel.js +29 -0
- package/lib/esm/content-fields/carousel.js.map +1 -0
- package/lib/esm/content-fields/content-base.d.ts +10 -0
- package/lib/esm/content-fields/content-base.js +11 -0
- package/lib/esm/content-fields/content-base.js.map +1 -0
- package/lib/esm/content-fields/element.d.ts +11 -0
- package/lib/esm/content-fields/element.js +21 -0
- package/lib/esm/content-fields/element.js.map +1 -0
- package/lib/esm/content-fields/image.d.ts +9 -0
- package/lib/esm/content-fields/image.js +21 -0
- package/lib/esm/content-fields/image.js.map +1 -0
- package/lib/esm/content-fields/text.d.ts +12 -0
- package/lib/esm/content-fields/text.js +28 -0
- package/lib/esm/content-fields/text.js.map +1 -0
- package/lib/esm/functions/conditional-provider.d.ts +4 -0
- package/lib/esm/functions/conditional-provider.js +7 -0
- package/lib/esm/functions/conditional-provider.js.map +1 -0
- package/lib/esm/functions/conditional-queue-status.d.ts +3 -0
- package/lib/esm/functions/conditional-queue-status.js +7 -0
- package/lib/esm/functions/conditional-queue-status.js.map +1 -0
- package/lib/esm/functions/index.d.ts +6 -0
- package/lib/esm/functions/index.js +7 -0
- package/lib/esm/functions/index.js.map +1 -0
- package/lib/esm/handoff.d.ts +2 -0
- package/lib/esm/handoff.js +24 -0
- package/lib/esm/handoff.js.map +1 -0
- package/lib/esm/hubtype-models.d.ts +152 -0
- package/lib/esm/hubtype-models.js +47 -0
- package/lib/esm/hubtype-models.js.map +1 -0
- package/lib/esm/index.d.ts +30 -0
- package/lib/esm/index.js +138 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +6 -0
- package/lib/esm/utils.js.map +1 -0
- package/package.json +5 -5
- package/src/action.tsx +1 -4
- package/src/content-fields/carousel.tsx +9 -12
- package/src/index.ts +1 -1
- package/lib/action.js +0 -62
- package/lib/action.js.map +0 -1
- package/lib/content-fields/button.js.map +0 -1
- package/lib/content-fields/carousel.js.map +0 -1
- package/lib/content-fields/content-base.js.map +0 -1
- package/lib/content-fields/element.js.map +0 -1
- package/lib/content-fields/image.js.map +0 -1
- package/lib/content-fields/text.js.map +0 -1
- package/lib/functions/conditional-provider.js.map +0 -1
- package/lib/functions/conditional-queue-status.js +0 -25
- package/lib/functions/conditional-queue-status.js.map +0 -1
- package/lib/functions/index.js.map +0 -1
- package/lib/handoff.js +0 -39
- package/lib/handoff.js.map +0 -1
- package/lib/hubtype-models.js.map +0 -1
- package/lib/index.js +0 -171
- package/lib/index.js.map +0 -1
- package/lib/utils.js.map +0 -1
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.START = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("@botonic/react");
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const handoff_1 = require("./handoff");
|
|
8
|
+
// TODO: remove this from here and use the new "start" attribute in the flow
|
|
9
|
+
exports.START = '08c7df06-0c7c-4f06-b8c1-4157582efeb2';
|
|
10
|
+
class FlowBuilderAction extends react_2.default.Component {
|
|
11
|
+
static async botonicInit(request) {
|
|
12
|
+
const flowBuilderPlugin = request.plugins.hubtypeFlowBuilder;
|
|
13
|
+
let payload = request.input.payload ? request.input.payload : exports.START;
|
|
14
|
+
if (!request.input.payload) {
|
|
15
|
+
const intentPayload = await flowBuilderPlugin.getPayloadByInput(request.input, 'es-ES');
|
|
16
|
+
if (intentPayload) {
|
|
17
|
+
payload = intentPayload;
|
|
18
|
+
}
|
|
19
|
+
const keywordPayload = await flowBuilderPlugin.getPayloadByKeyword(request.input, 'es-ES');
|
|
20
|
+
if (keywordPayload) {
|
|
21
|
+
payload = keywordPayload;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// We use only Spanish because they are the backend examples
|
|
25
|
+
const content = await flowBuilderPlugin.getContents(payload, 'es-ES');
|
|
26
|
+
if (content.length == 0) {
|
|
27
|
+
const handoffMsg = await handoff_1.doHandoff(request);
|
|
28
|
+
return { handoffMsg };
|
|
29
|
+
}
|
|
30
|
+
return { content };
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const { content: contents, handoffMsg } = this.props;
|
|
35
|
+
if (handoffMsg) {
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
return react_2.default.createElement(react_1.Text, null, handoffMsg);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return contents.map((content, index) => content.toBotonic(index));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = FlowBuilderAction;
|
|
45
|
+
FlowBuilderAction.contextType = react_1.RequestContext;
|
|
46
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action.tsx"],"names":[],"mappings":";;;;AAAA,0CAAoE;AACpE,0DAAyB;AAGzB,uCAAqC;AAGrC,4EA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AAO,QAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;SACnE;IACH,CAAC;;AA1CH,oCA2CC;AA1CQ,6BAAW,GAAG,sBAAc,CAAA"}
|
|
File without changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.FlowButton = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const react_1 = require("@botonic/react");
|
|
8
|
-
const react_2 = __importDefault(require("react"));
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
7
|
const hubtype_models_1 = require("../hubtype-models");
|
|
10
8
|
const content_base_1 = require("./content-base");
|
|
11
9
|
class FlowButton extends content_base_1.ContentFieldsBase {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/content-fields/button.tsx"],"names":[],"mappings":";;;;AAAA,0CAA8C;AAC9C,0DAAyB;AAEzB,sDAAyD;AACzD,iDAAkD;AAElD,MAAa,UAAW,SAAQ,gCAAiB;IAAjD;;QACS,SAAI,GAAG,EAAE,CAAA;IA0BlB,CAAC;IAtBC,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,MAAc;;QACvD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC9C,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QACnE,SAAS,CAAC,OAAO,GAAG,MAAA,SAAS,CAAC,MAAM,0CAAE,EAAE,CAAA;QACxC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,WAAwB;QAClD,IAAI,WAAW,IAAI,4BAAW,CAAC,WAAW,EAAE;YAC1C,OAAO,CACL,8BAAC,aAAK,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACrC,IAAI,CAAC,IAAI,CACJ,CACT,CAAA;SACF;QACD,OAAO;QACL,aAAa;QACb,8BAAC,cAAM,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACtC,IAAI,CAAC,IAAI,CACH,CACV,CAAA;IACH,CAAC;CACF;AA3BD,gCA2BC"}
|
|
File without changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.FlowCarousel = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const react_1 = require("@botonic/react");
|
|
8
|
-
const react_2 = __importDefault(require("react"));
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
7
|
const content_base_1 = require("./content-base");
|
|
10
8
|
const element_1 = require("./element");
|
|
11
9
|
class FlowCarousel extends content_base_1.ContentFieldsBase {
|
|
@@ -23,7 +21,6 @@ class FlowCarousel extends content_base_1.ContentFieldsBase {
|
|
|
23
21
|
toBotonic(index) {
|
|
24
22
|
return (react_2.default.createElement(react_1.Carousel, { key: index }, this.elements.map((e, eIndex) => {
|
|
25
23
|
var _a, _b;
|
|
26
|
-
console.log('TO BOTONIC BOTONIC PACKAGES', { e });
|
|
27
24
|
return (react_2.default.createElement(react_1.Element, { key: eIndex },
|
|
28
25
|
react_2.default.createElement(react_1.Pic, { src: e.image }),
|
|
29
26
|
react_2.default.createElement(react_1.Title, { style: '' }, e.title),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CACX,CAAA;SAAA,CAAC,CACO,CACZ,CAAA;IACH,CAAC;CACF;AA/BD,oCA+BC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-base.js","sourceRoot":"","sources":["../../../src/content-fields/content-base.ts"],"names":[],"mappings":";;;AAKA,MAAsB,iBAAiB;IACrC,YAA6B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;IAE3C,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,IAAoB;;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAA;QACjD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAA;IAC9B,CAAC;CACF;AAPD,8CAOC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/content-fields/element.tsx"],"names":[],"mappings":";;;AACA,oCAA2C;AAC3C,qCAAqC;AACrC,iDAAkD;AAElD,MAAa,WAAY,SAAQ,gCAAiB;IAAlD;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,aAAQ,GAAG,EAAE,CAAA;QAEb,UAAK,GAAG,EAAE,CAAA;QACV,WAAM,GAAG,KAAK,CAAA;IAavB,CAAC;IAXC,MAAM,CAAC,cAAc,CAAC,SAAoB,EAAE,MAAc;QACxD,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAChD,UAAU,CAAC,KAAK,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QACvE,UAAU,CAAC,QAAQ,GAAG,WAAW,CAAC,eAAe,CAC/C,MAAM,EACN,SAAS,CAAC,QAAQ,CACnB,CAAA;QACD,UAAU,CAAC,KAAK,GAAG,wBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QAC5D,UAAU,CAAC,OAAO,GAAG,mBAAU,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACxE,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAlBD,kCAkBC"}
|
|
File without changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.FlowImage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const react_1 = require("@botonic/react");
|
|
8
|
-
const react_2 = __importDefault(require("react"));
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
7
|
const utils_1 = require("../utils");
|
|
10
8
|
const content_base_1 = require("./content-base");
|
|
11
9
|
class FlowImage extends content_base_1.ContentFieldsBase {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/content-fields/image.tsx"],"names":[],"mappings":";;;;AAAA,0CAAsC;AACtC,0DAAyB;AAGzB,oCAA2C;AAC3C,iDAAkD;AAElD,MAAa,SAAU,SAAQ,gCAAiB;IAAhD;;QACS,QAAG,GAAG,EAAE,CAAA;QACR,SAAI,GAAG,EAAE,CAAA;IAYlB,CAAC;IAVC,MAAM,CAAC,cAAc,CAAC,SAAsB,EAAE,MAAc;QAC1D,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC5C,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC9B,QAAQ,CAAC,GAAG,GAAG,wBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAChE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,8BAAC,aAAK,IAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,GAAI,CAAA;IAC7C,CAAC;CACF;AAdD,8BAcC"}
|
|
File without changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.FlowText = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
7
5
|
const react_1 = require("@botonic/react");
|
|
8
|
-
const react_2 = __importDefault(require("react"));
|
|
6
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
|
9
7
|
const hubtype_models_1 = require("../hubtype-models");
|
|
10
8
|
const button_1 = require("./button");
|
|
11
9
|
const content_base_1 = require("./content-base");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/content-fields/text.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqC;AACrC,0DAAyB;AAEzB,sDAA2D;AAC3D,qCAAqC;AACrC,iDAAkD;AAElD,MAAa,QAAS,SAAQ,gCAAiB;IAA/C;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QACT,YAAO,GAAiB,EAAE,CAAA;QAC1B,gBAAW,GAAG,4BAAW,CAAC,MAAM,CAAA;IAuBzC,CAAC;IArBC,MAAM,CAAC,cAAc,CAAC,SAAqB,EAAE,MAAc;QACzD,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC1C,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC7B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,IAAI,4BAAW,CAAC,MAAM,CAAA;QAC3E,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACvE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CACvD,mBAAU,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAC1C,CAAA;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,CACL,8BAAC,YAAI,IAAC,GAAG,EAAE,KAAK;YACb,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAClC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAC7C,CACI,CACR,CAAA;IACH,CAAC;CACF;AA3BD,4BA2BC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-provider.js","sourceRoot":"","sources":["../../../src/functions/conditional-provider.ts"],"names":[],"mappings":";;;AAAA,SAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAA;IACtC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAA;IAC/C,OAAO,SAAS,CAAA;AAClB,CAAC;AAJD,kDAIC"}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conditionalQueueStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
async function conditionalQueueStatus({ queueId }) {
|
|
7
|
+
const response = await axios_1.default.get(`https://api.hubtype.com/v1/queues/${queueId}/availability/`);
|
|
8
|
+
const isAvailable = response.data.available;
|
|
9
|
+
return isAvailable ? 'open' : 'closed';
|
|
10
|
+
}
|
|
11
|
+
exports.conditionalQueueStatus = conditionalQueueStatus;
|
|
12
|
+
//# sourceMappingURL=conditional-queue-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../src/functions/conditional-queue-status.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAElB,KAAK,UAAU,sBAAsB,CAAC,EAAE,OAAO,EAAE;IACtD,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,qCAAqC,OAAO,gBAAgB,CAC7D,CAAA;IACD,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAA;IAC3C,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;AACxC,CAAC;AAND,wDAMC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,yEAAmE;AAEtD,QAAA,iBAAiB,GAAG;IAC/B,0BAA0B,EAAE,iDAAsB;IAClD,sBAAsB,EAAE,0CAAmB;CAC5C,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.doHandoff = void 0;
|
|
4
|
+
const core_1 = require("@botonic/core");
|
|
5
|
+
// TODO: Remove all "getOpenQueues" logic and open/closed messages.
|
|
6
|
+
// This function should just do a basic handoff
|
|
7
|
+
// TODO: add missing options: withNote, withAgent
|
|
8
|
+
async function doHandoff(request) {
|
|
9
|
+
var _a;
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
const flowBuilderPlugin = request.plugins.hubtypeFlowBuilder;
|
|
12
|
+
const handoffContent = await flowBuilderPlugin.getHandoffContent();
|
|
13
|
+
console.log(handoffContent);
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
let openQueues = await core_1.getOpenQueues(request.session);
|
|
16
|
+
const queueName = 'Test';
|
|
17
|
+
if (openQueues.queues.indexOf(queueName) !== -1) {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const handOffBuilder = new core_1.HandOffBuilder(request.session);
|
|
20
|
+
handOffBuilder.withQueue('Test');
|
|
21
|
+
handOffBuilder.withOnFinishPayload((_a = handoffContent.target) === null || _a === void 0 ? void 0 : _a.id);
|
|
22
|
+
await handOffBuilder.handOff();
|
|
23
|
+
return handoffContent.content.message[0].message;
|
|
24
|
+
}
|
|
25
|
+
return handoffContent.content.failMessage[0].message;
|
|
26
|
+
}
|
|
27
|
+
exports.doHandoff = doHandoff;
|
|
28
|
+
//# sourceMappingURL=handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../src/handoff.ts"],"names":[],"mappings":";;;AAAA,wCAA6D;AAG7D,mEAAmE;AACnE,+CAA+C;AAC/C,iDAAiD;AAE1C,KAAK,UAAU,SAAS,CAAC,OAAsB;;IACpD,aAAa;IACb,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAyB,CAAA;IACnE,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,EAAE,CAAA;IAClE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAC3B,aAAa;IACb,IAAI,UAAU,GAAG,MAAM,oBAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,SAAS,GAAG,MAAM,CAAA;IACxB,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;QAC/C,aAAa;QACb,MAAM,cAAc,GAAG,IAAI,qBAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC1D,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QAChC,cAAc,CAAC,mBAAmB,CAAC,MAAA,cAAc,CAAC,MAAM,0CAAE,EAAG,CAAC,CAAA;QAC9D,MAAM,cAAc,CAAC,OAAO,EAAE,CAAA;QAE9B,OAAO,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;KACjD;IAED,OAAO,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AACtD,CAAC;AAnBD,8BAmBC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubtype-models.js","sourceRoot":"","sources":["../../src/hubtype-models.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;AAC7B,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAED,IAAY,kBAQX;AARD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,qCAAe,CAAA;IACf,mCAAa,CAAA;IACb,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EARW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAQ7B;AAED,iCAAiC;AACjC,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,oCAAW,CAAA;AACb,CAAC,EALW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAKhC;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;AACrB,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;AACjB,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAED,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,sCAAmB,CAAA;AACrB,CAAC,EAFW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAE1B;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,wCAAoB,CAAA;AACtB,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB;AAEY,QAAA,eAAe,mCACvB,kBAAkB,GAClB,gBAAgB,EACpB"}
|
|
File without changes
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
5
|
+
const carousel_1 = require("./content-fields/carousel");
|
|
6
|
+
const image_1 = require("./content-fields/image");
|
|
7
|
+
const text_1 = require("./content-fields/text");
|
|
8
|
+
const functions_1 = require("./functions");
|
|
9
|
+
const hubtype_models_1 = require("./hubtype-models");
|
|
10
|
+
class BotonicPluginFlowBuilder {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.flowUrl = options.flowUrl;
|
|
14
|
+
this.flow = options.flow || this.readFlowContent();
|
|
15
|
+
const customFunctions = options.customFunctions || {};
|
|
16
|
+
this.functions = Object.assign(Object.assign({}, functions_1.DEFAULT_FUNCTIONS), customFunctions);
|
|
17
|
+
}
|
|
18
|
+
async readFlowContent() {
|
|
19
|
+
const response = await axios_1.default.get(this.flowUrl);
|
|
20
|
+
const data = await response.data;
|
|
21
|
+
//@ts-ignore
|
|
22
|
+
return Promise.resolve(data);
|
|
23
|
+
}
|
|
24
|
+
async pre(request) {
|
|
25
|
+
this.currentRequest = request;
|
|
26
|
+
}
|
|
27
|
+
async post(_request) { }
|
|
28
|
+
async getContent(id) {
|
|
29
|
+
const flow = await this.flow;
|
|
30
|
+
const content = flow.nodes.find((c) => c.id === id);
|
|
31
|
+
if (!content)
|
|
32
|
+
throw Error(`text with id: '${id}' not found`);
|
|
33
|
+
return content;
|
|
34
|
+
}
|
|
35
|
+
async getHandoffContent() {
|
|
36
|
+
const flow = await this.flow;
|
|
37
|
+
const content = flow.nodes.find((c) => c.type === 'handoff');
|
|
38
|
+
if (!content)
|
|
39
|
+
throw Error(`Handoff node not found`);
|
|
40
|
+
return content;
|
|
41
|
+
}
|
|
42
|
+
getFlowContent(hubtypeContent, locale) {
|
|
43
|
+
switch (hubtypeContent.type) {
|
|
44
|
+
case hubtype_models_1.MessageContentType.TEXT:
|
|
45
|
+
return text_1.FlowText.fromHubtypeCMS(hubtypeContent, locale);
|
|
46
|
+
case hubtype_models_1.MessageContentType.IMAGE:
|
|
47
|
+
return image_1.FlowImage.fromHubtypeCMS(hubtypeContent, locale);
|
|
48
|
+
case hubtype_models_1.MessageContentType.CAROUSEL:
|
|
49
|
+
return carousel_1.FlowCarousel.fromHubtypeCMS(hubtypeContent, locale);
|
|
50
|
+
default:
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async getContents(id, locale, prevContents) {
|
|
55
|
+
const contents = prevContents || [];
|
|
56
|
+
const hubtypeContent = await this.getContent(id);
|
|
57
|
+
const content = await this.getFlowContent(hubtypeContent, locale);
|
|
58
|
+
if (hubtypeContent.type === hubtype_models_1.MessageContentType.FUNCTION) {
|
|
59
|
+
const targetId = await this.callFunction(hubtypeContent, locale);
|
|
60
|
+
return this.getContents(targetId, locale, contents);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (content)
|
|
64
|
+
contents.push(content);
|
|
65
|
+
// TODO: prevent infinite recursive calls
|
|
66
|
+
if (hubtypeContent.follow_up)
|
|
67
|
+
return this.getContents(hubtypeContent.follow_up.id, locale, contents);
|
|
68
|
+
}
|
|
69
|
+
// execute function
|
|
70
|
+
// return this.getContents(function result_mapping target, locale, contents)
|
|
71
|
+
return contents;
|
|
72
|
+
}
|
|
73
|
+
async getPayloadByInput(input, locale) {
|
|
74
|
+
var _a;
|
|
75
|
+
try {
|
|
76
|
+
const flow = await this.flow;
|
|
77
|
+
const intents = flow.nodes.filter(node => node.type == hubtype_models_1.MessageContentType.INTENT);
|
|
78
|
+
if (input.intent) {
|
|
79
|
+
const matchedIntents = intents.filter(node =>
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
this.hasIntent(node, input.intent, locale));
|
|
82
|
+
if (matchedIntents.length > 0) {
|
|
83
|
+
return (_a = matchedIntents[0].target) === null || _a === void 0 ? void 0 : _a.id;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('Error getting payload by input: ', error);
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
hasIntent(node, intent, locale) {
|
|
93
|
+
const result = node.content.intents.find(i => i.locale === locale && i.values.includes(intent));
|
|
94
|
+
return Boolean(result);
|
|
95
|
+
}
|
|
96
|
+
async getPayloadByKeyword(input, locale) {
|
|
97
|
+
var _a;
|
|
98
|
+
try {
|
|
99
|
+
const flow = await this.flow;
|
|
100
|
+
const keywordNodes = flow.nodes.filter(node => node.type == hubtype_models_1.MessageContentType.KEYWORD);
|
|
101
|
+
const matchedKeywordNodes = keywordNodes.filter(node =>
|
|
102
|
+
//@ts-ignore
|
|
103
|
+
this.matchKeywords(node, input.data, locale));
|
|
104
|
+
if (matchedKeywordNodes.length > 0) {
|
|
105
|
+
return (_a = matchedKeywordNodes[0].target) === null || _a === void 0 ? void 0 : _a.id;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error('Error getting payload by input: ', error);
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
matchKeywords(node, input, locale) {
|
|
114
|
+
const result = node.content.keywords.find(i => i.locale === locale && this.containsAnyKeywords(input, i.values));
|
|
115
|
+
return Boolean(result);
|
|
116
|
+
}
|
|
117
|
+
containsAnyKeywords(input, keywords) {
|
|
118
|
+
for (let i = 0; i < keywords.length; i++) {
|
|
119
|
+
if (input.includes(keywords[i])) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
async callFunction(functionNode, locale) {
|
|
126
|
+
// Check if target is missing or missing arguments
|
|
127
|
+
// TODO: get arguments by locale
|
|
128
|
+
const nameValues = functionNode.content.arguments
|
|
129
|
+
.find(arg => arg.locale === locale)
|
|
130
|
+
.values.map(value => ({ [value.name]: value.value }));
|
|
131
|
+
const args = Object.assign({
|
|
132
|
+
session: this.currentRequest.session,
|
|
133
|
+
results: [functionNode.content.result_mapping.map(r => r.result)],
|
|
134
|
+
}, ...nameValues);
|
|
135
|
+
const functionResult = await this.functions[functionNode.content.action](args);
|
|
136
|
+
// TODO define result_mapping per locale??
|
|
137
|
+
const result = functionNode.content.result_mapping.find(r => r.result === functionResult);
|
|
138
|
+
return result.target.id;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.default = BotonicPluginFlowBuilder;
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["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IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC/B,OAAO,IAAI,CAAA;aACZ;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,YAA4B,EAC5B,MAAc;QAEd,kDAAkD;QAClD,gCAAgC;QAChC,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS;aAC9C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC;aAClC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QACvD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CACxB;YACE,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO;YACpC,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SAClE,EACD,GAAG,UAAU,CACd,CAAA;QACD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CACtE,IAAI,CACL,CAAA;QACD,0CAA0C;QAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CACrD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CACjC,CAAA;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;IACzB,CAAC;CACF;AAnLD,2CAmLC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAAC,MAAc,EAAE,KAA0B;;IACzE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAA;IAClD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,EAAE,CAAA;AAC3B,CAAC;AAHD,4CAGC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FlowContent } from './content-fields/content-base';
|
|
4
|
+
import { HtHandoffNode } from './hubtype-models';
|
|
5
|
+
export declare const START = "08c7df06-0c7c-4f06-b8c1-4157582efeb2";
|
|
6
|
+
declare type FlowBuilderActionProps = {
|
|
7
|
+
content?: FlowContent[];
|
|
8
|
+
handoffMsg?: HtHandoffNode;
|
|
9
|
+
};
|
|
10
|
+
export default class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
11
|
+
static contextType: React.Context<import("@botonic/react").RequestContextInterface>;
|
|
12
|
+
static botonicInit(request: ActionRequest): Promise<any>;
|
|
13
|
+
render(): JSX.Element | JSX.Element[];
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { RequestContext, Text } from '@botonic/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { doHandoff } from './handoff';
|
|
4
|
+
// TODO: remove this from here and use the new "start" attribute in the flow
|
|
5
|
+
export const START = '08c7df06-0c7c-4f06-b8c1-4157582efeb2';
|
|
6
|
+
export default class FlowBuilderAction extends React.Component {
|
|
7
|
+
static async botonicInit(request) {
|
|
8
|
+
const flowBuilderPlugin = request.plugins.hubtypeFlowBuilder;
|
|
9
|
+
let payload = request.input.payload ? request.input.payload : START;
|
|
10
|
+
if (!request.input.payload) {
|
|
11
|
+
const intentPayload = await flowBuilderPlugin.getPayloadByInput(request.input, 'es-ES');
|
|
12
|
+
if (intentPayload) {
|
|
13
|
+
payload = intentPayload;
|
|
14
|
+
}
|
|
15
|
+
const keywordPayload = await flowBuilderPlugin.getPayloadByKeyword(request.input, 'es-ES');
|
|
16
|
+
if (keywordPayload) {
|
|
17
|
+
payload = keywordPayload;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// We use only Spanish because they are the backend examples
|
|
21
|
+
const content = await flowBuilderPlugin.getContents(payload, 'es-ES');
|
|
22
|
+
if (content.length == 0) {
|
|
23
|
+
const handoffMsg = await doHandoff(request);
|
|
24
|
+
return { handoffMsg };
|
|
25
|
+
}
|
|
26
|
+
return { content };
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
const { content: contents, handoffMsg } = this.props;
|
|
31
|
+
if (handoffMsg) {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
return React.createElement(Text, null, handoffMsg);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return contents.map((content, index) => content.toBotonic(index));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
FlowBuilderAction.contextType = RequestContext;
|
|
41
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAGrC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,KAAK,GAAG,sCAAsC,CAAA;AAO3D,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAiC;IAGpF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAsB;QAC7C,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,C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@@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ButtonStyle, HtButton } from '../hubtype-models';
|
|
3
|
+
import { ContentFieldsBase } from './content-base';
|
|
4
|
+
export declare class FlowButton extends ContentFieldsBase {
|
|
5
|
+
text: string;
|
|
6
|
+
url?: string;
|
|
7
|
+
payload?: string;
|
|
8
|
+
static fromHubtypeCMS(component: HtButton, locale: string): FlowButton;
|
|
9
|
+
renderButton(index: number, buttonStyle: ButtonStyle): JSX.Element;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Button, Reply } from '@botonic/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ButtonStyle } from '../hubtype-models';
|
|
4
|
+
import { ContentFieldsBase } from './content-base';
|
|
5
|
+
export class FlowButton extends ContentFieldsBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.text = '';
|
|
9
|
+
}
|
|
10
|
+
static fromHubtypeCMS(component, locale) {
|
|
11
|
+
var _a;
|
|
12
|
+
const newButton = new FlowButton(component.id);
|
|
13
|
+
newButton.text = FlowButton.getTextByLocale(locale, component.text);
|
|
14
|
+
newButton.payload = (_a = component.target) === null || _a === void 0 ? void 0 : _a.id;
|
|
15
|
+
return newButton;
|
|
16
|
+
}
|
|
17
|
+
renderButton(index, buttonStyle) {
|
|
18
|
+
if (buttonStyle == ButtonStyle.QUICK_REPLY) {
|
|
19
|
+
return (React.createElement(Reply, { payload: this.payload, key: index }, this.text));
|
|
20
|
+
}
|
|
21
|
+
return (
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
React.createElement(Button, { payload: this.payload, key: index }, this.text));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/content-fields/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,EAAY,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAAjD;;QACS,SAAI,GAAG,EAAE,CAAA;IA0BlB,CAAC;IAtBC,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,MAAc;;QACvD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC9C,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QACnE,SAAS,CAAC,OAAO,GAAG,MAAA,SAAS,CAAC,MAAM,0CAAE,EAAE,CAAA;QACxC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,WAAwB;QAClD,IAAI,WAAW,IAAI,WAAW,CAAC,WAAW,EAAE;YAC1C,OAAO,CACL,oBAAC,KAAK,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACrC,IAAI,CAAC,IAAI,CACJ,CACT,CAAA;SACF;QACD,OAAO;QACL,aAAa;QACb,oBAAC,MAAM,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACtC,IAAI,CAAC,IAAI,CACH,CACV,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HtCarouselNode } from '../hubtype-models';
|
|
3
|
+
import { ContentFieldsBase } from './content-base';
|
|
4
|
+
import { FlowElement } from './element';
|
|
5
|
+
export declare class FlowCarousel extends ContentFieldsBase {
|
|
6
|
+
code: string;
|
|
7
|
+
elements: FlowElement[];
|
|
8
|
+
static fromHubtypeCMS(component: HtCarouselNode, locale: string): FlowCarousel;
|
|
9
|
+
toBotonic(index: number): JSX.Element;
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Button, Carousel, Element, Pic, Subtitle, Title } from '@botonic/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ContentFieldsBase } from './content-base';
|
|
4
|
+
import { FlowElement } from './element';
|
|
5
|
+
export class FlowCarousel extends ContentFieldsBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.code = '';
|
|
9
|
+
this.elements = [];
|
|
10
|
+
}
|
|
11
|
+
static fromHubtypeCMS(component, locale) {
|
|
12
|
+
const newCarousel = new FlowCarousel(component.id);
|
|
13
|
+
newCarousel.code = component.code;
|
|
14
|
+
newCarousel.elements = component.content.elements.map(ele => FlowElement.fromHubtypeCMS(ele, locale));
|
|
15
|
+
return newCarousel;
|
|
16
|
+
}
|
|
17
|
+
toBotonic(index) {
|
|
18
|
+
return (React.createElement(Carousel, { key: index }, this.elements.map((e, eIndex) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (React.createElement(Element, { key: eIndex },
|
|
21
|
+
React.createElement(Pic, { src: e.image }),
|
|
22
|
+
React.createElement(Title, { style: '' }, e.title),
|
|
23
|
+
React.createElement(Subtitle, { style: '' }, e.subtitle),
|
|
24
|
+
React.createElement(Button, { payload: (_a = e.buttons) === null || _a === void 0 ? void 0 : _a.payload }, (_b = e.buttons) === null || _b === void 0 ? void 0 : _b.text),
|
|
25
|
+
","));
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=carousel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/content-fields/carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,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D,CACX,CAAA;SAAA,CAAC,CACO,CACZ,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HtTextLocale } from '../hubtype-models';
|
|
2
|
+
import { FlowCarousel } from './carousel';
|
|
3
|
+
import { FlowImage } from './image';
|
|
4
|
+
import { FlowText } from './text';
|
|
5
|
+
export declare abstract class ContentFieldsBase {
|
|
6
|
+
private readonly id;
|
|
7
|
+
constructor(id: string);
|
|
8
|
+
static getTextByLocale(locale: string, text: HtTextLocale[]): string;
|
|
9
|
+
}
|
|
10
|
+
export declare type FlowContent = FlowText | FlowImage | FlowCarousel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class ContentFieldsBase {
|
|
2
|
+
constructor(id) {
|
|
3
|
+
this.id = id;
|
|
4
|
+
}
|
|
5
|
+
static getTextByLocale(locale, text) {
|
|
6
|
+
var _a;
|
|
7
|
+
const result = text.find(t => t.locale == locale);
|
|
8
|
+
return (_a = result === null || result === void 0 ? void 0 : result.message) !== null && _a !== void 0 ? _a : '';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=content-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-base.js","sourceRoot":"","sources":["../../../src/content-fields/content-base.ts"],"names":[],"mappings":"AAKA,MAAM,OAAgB,iBAAiB;IACrC,YAA6B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;IAE3C,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,IAAoB;;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAA;QACjD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAA;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HtElement } from '../hubtype-models';
|
|
2
|
+
import { FlowButton } from './button';
|
|
3
|
+
import { ContentFieldsBase } from './content-base';
|
|
4
|
+
export declare class FlowElement extends ContentFieldsBase {
|
|
5
|
+
title: string;
|
|
6
|
+
subtitle: string;
|
|
7
|
+
buttons: FlowButton | undefined;
|
|
8
|
+
image: string;
|
|
9
|
+
hidden: boolean;
|
|
10
|
+
static fromHubtypeCMS(component: HtElement, locale: string): FlowElement;
|
|
11
|
+
}
|