@botonic/plugin-flow-builder 0.24.2 → 0.25.0-alpha.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/lib/cjs/action/index.js +8 -5
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/action/knowledge-bases.js +1 -1
- package/lib/cjs/action/knowledge-bases.js.map +1 -1
- package/lib/cjs/api.js +8 -4
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/content-fields/content-fields-base.js +4 -6
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-button.d.ts +0 -1
- package/lib/cjs/content-fields/flow-button.js +8 -12
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +0 -1
- package/lib/cjs/content-fields/flow-carousel.js +4 -8
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
- package/lib/cjs/content-fields/flow-element.d.ts +0 -1
- package/lib/cjs/content-fields/flow-element.js +7 -15
- package/lib/cjs/content-fields/flow-element.js.map +1 -1
- package/lib/cjs/content-fields/flow-handoff.d.ts +0 -1
- package/lib/cjs/content-fields/flow-handoff.js +8 -6
- package/lib/cjs/content-fields/flow-handoff.js.map +1 -1
- package/lib/cjs/content-fields/flow-image.d.ts +0 -1
- package/lib/cjs/content-fields/flow-image.js +4 -8
- package/lib/cjs/content-fields/flow-image.js.map +1 -1
- package/lib/cjs/content-fields/flow-text.d.ts +0 -1
- package/lib/cjs/content-fields/flow-text.js +7 -14
- package/lib/cjs/content-fields/flow-text.js.map +1 -1
- package/lib/cjs/content-fields/flow-video.d.ts +0 -1
- package/lib/cjs/content-fields/flow-video.js +4 -8
- package/lib/cjs/content-fields/flow-video.js.map +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +4 -7
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +2 -5
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +6 -10
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/cjs/index.js +17 -8
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/action/index.js +28 -19
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/action/intent.js +8 -4
- package/lib/esm/action/intent.js.map +1 -1
- package/lib/esm/action/keyword.js +7 -3
- package/lib/esm/action/keyword.js.map +1 -1
- package/lib/esm/action/knowledge-bases.js +14 -10
- package/lib/esm/action/knowledge-bases.js.map +1 -1
- package/lib/esm/action/tracking.js +9 -5
- package/lib/esm/action/tracking.js.map +1 -1
- package/lib/esm/action/user-input.js +9 -5
- package/lib/esm/action/user-input.js.map +1 -1
- package/lib/esm/api.js +25 -16
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/constants.js +6 -3
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/content-fields/content-fields-base.js +9 -7
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +0 -1
- package/lib/esm/content-fields/flow-button.js +19 -18
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +0 -1
- package/lib/esm/content-fields/flow-carousel.js +13 -12
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-element.d.ts +0 -1
- package/lib/esm/content-fields/flow-element.js +16 -19
- package/lib/esm/content-fields/flow-element.js.map +1 -1
- package/lib/esm/content-fields/flow-handoff.d.ts +0 -1
- package/lib/esm/content-fields/flow-handoff.js +21 -14
- package/lib/esm/content-fields/flow-handoff.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +0 -1
- package/lib/esm/content-fields/flow-image.js +11 -10
- package/lib/esm/content-fields/flow-image.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +0 -1
- package/lib/esm/content-fields/flow-text.js +20 -22
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/flow-video.d.ts +0 -1
- package/lib/esm/content-fields/flow-video.js +11 -10
- package/lib/esm/content-fields/flow-video.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/bot-action.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/button.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/carousel.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/common.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/fallback.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/function.js +5 -2
- package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/handoff.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/image.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/index.js +21 -18
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/intent.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/keyword.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js +9 -6
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/payload.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/text.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/url.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/video.js +2 -1
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +2 -1
- package/lib/esm/content-fields/index.js +21 -10
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +12 -11
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +10 -9
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +15 -14
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/esm/functions/conditional-provider.js +5 -1
- package/lib/esm/functions/conditional-provider.js.map +1 -1
- package/lib/esm/functions/conditional-queue-status.js +10 -4
- package/lib/esm/functions/conditional-queue-status.js.map +1 -1
- package/lib/esm/functions/index.js +8 -5
- package/lib/esm/functions/index.js.map +1 -1
- package/lib/esm/helpers.js +5 -1
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/index.js +48 -35
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.js +5 -2
- package/lib/esm/types.js.map +1 -1
- package/lib/esm/utils.js +8 -4
- package/lib/esm/utils.js.map +1 -1
- package/package.json +6 -12
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./bot-action"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./button"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./carousel"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./common"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./fallback"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./function"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./go-to-flow"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./handoff"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./image"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./intent"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./keyword"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./node-types"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./nodes"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./payload"), exports);
|
|
18
|
+
tslib_1.__exportStar(require("./text"), exports);
|
|
19
|
+
tslib_1.__exportStar(require("./url"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./video"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./whatsapp-button-list"), exports);
|
|
19
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"names":[],"mappings":";;;AAAA,uDAA4B;AAC5B,mDAAwB;AACxB,qDAA0B;AAC1B,mDAAwB;AACxB,qDAA0B;AAC1B,qDAA0B;AAC1B,uDAA4B;AAC5B,oDAAyB;AACzB,kDAAuB;AACvB,mDAAwB;AACxB,oDAAyB;AACzB,uDAA4B;AAC5B,kDAAuB;AACvB,oDAAyB;AACzB,iDAAsB;AACtB,gDAAqB;AACrB,kDAAuB;AACvB,iEAAsC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HtButtonStyle = exports.HtNodeWithoutContentType = exports.HtNodeWithContentType = void 0;
|
|
4
|
+
var HtNodeWithContentType;
|
|
2
5
|
(function (HtNodeWithContentType) {
|
|
3
6
|
HtNodeWithContentType["CAROUSEL"] = "carousel";
|
|
4
7
|
HtNodeWithContentType["HANDOFF"] = "handoff";
|
|
@@ -10,17 +13,17 @@ export var HtNodeWithContentType;
|
|
|
10
13
|
HtNodeWithContentType["FALLBACK"] = "fallback";
|
|
11
14
|
HtNodeWithContentType["VIDEO"] = "video";
|
|
12
15
|
HtNodeWithContentType["WHATSAPP_BUTTON_LIST"] = "whatsapp-button-list";
|
|
13
|
-
})(HtNodeWithContentType || (HtNodeWithContentType = {}));
|
|
14
|
-
|
|
16
|
+
})(HtNodeWithContentType = exports.HtNodeWithContentType || (exports.HtNodeWithContentType = {}));
|
|
17
|
+
var HtNodeWithoutContentType;
|
|
15
18
|
(function (HtNodeWithoutContentType) {
|
|
16
19
|
HtNodeWithoutContentType["URL"] = "url";
|
|
17
20
|
HtNodeWithoutContentType["PAYLOAD"] = "payload";
|
|
18
21
|
HtNodeWithoutContentType["GO_TO_FLOW"] = "go-to-flow";
|
|
19
22
|
HtNodeWithoutContentType["BOT_ACTION"] = "bot-action";
|
|
20
|
-
})(HtNodeWithoutContentType || (HtNodeWithoutContentType = {}));
|
|
21
|
-
|
|
23
|
+
})(HtNodeWithoutContentType = exports.HtNodeWithoutContentType || (exports.HtNodeWithoutContentType = {}));
|
|
24
|
+
var HtButtonStyle;
|
|
22
25
|
(function (HtButtonStyle) {
|
|
23
26
|
HtButtonStyle["BUTTON"] = "button";
|
|
24
27
|
HtButtonStyle["QUICK_REPLY"] = "quick-reply";
|
|
25
|
-
})(HtButtonStyle || (HtButtonStyle = {}));
|
|
28
|
+
})(HtButtonStyle = exports.HtButtonStyle || (exports.HtButtonStyle = {}));
|
|
26
29
|
//# sourceMappingURL=node-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAWX;AAXD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sEAA6C,CAAA;AAC/C,CAAC,EAXW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAWhC;AAED,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,+CAAmB,CAAA;IACnB,qDAAyB,CAAA;IACzB,qDAAyB,CAAA;AAC3B,CAAC,EALW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAKnC;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowHandoff = exports.FlowWhatsappButtonList = exports.FlowVideo = exports.FlowText = exports.FlowImage = exports.FlowCarousel = exports.FlowElement = exports.FlowButton = exports.ContentFieldsBase = void 0;
|
|
4
|
+
const flow_carousel_1 = require("./flow-carousel");
|
|
5
|
+
Object.defineProperty(exports, "FlowCarousel", { enumerable: true, get: function () { return flow_carousel_1.FlowCarousel; } });
|
|
6
|
+
const flow_image_1 = require("./flow-image");
|
|
7
|
+
Object.defineProperty(exports, "FlowImage", { enumerable: true, get: function () { return flow_image_1.FlowImage; } });
|
|
8
|
+
const flow_text_1 = require("./flow-text");
|
|
9
|
+
Object.defineProperty(exports, "FlowText", { enumerable: true, get: function () { return flow_text_1.FlowText; } });
|
|
10
|
+
const flow_video_1 = require("./flow-video");
|
|
11
|
+
Object.defineProperty(exports, "FlowVideo", { enumerable: true, get: function () { return flow_video_1.FlowVideo; } });
|
|
12
|
+
const flow_whatsapp_button_list_1 = require("./whatsapp-button-list/flow-whatsapp-button-list");
|
|
13
|
+
Object.defineProperty(exports, "FlowWhatsappButtonList", { enumerable: true, get: function () { return flow_whatsapp_button_list_1.FlowWhatsappButtonList; } });
|
|
14
|
+
var content_fields_base_1 = require("./content-fields-base");
|
|
15
|
+
Object.defineProperty(exports, "ContentFieldsBase", { enumerable: true, get: function () { return content_fields_base_1.ContentFieldsBase; } });
|
|
16
|
+
var flow_button_1 = require("./flow-button");
|
|
17
|
+
Object.defineProperty(exports, "FlowButton", { enumerable: true, get: function () { return flow_button_1.FlowButton; } });
|
|
18
|
+
var flow_element_1 = require("./flow-element");
|
|
19
|
+
Object.defineProperty(exports, "FlowElement", { enumerable: true, get: function () { return flow_element_1.FlowElement; } });
|
|
20
|
+
var flow_handoff_1 = require("./flow-handoff");
|
|
21
|
+
Object.defineProperty(exports, "FlowHandoff", { enumerable: true, get: function () { return flow_handoff_1.FlowHandoff; } });
|
|
11
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAUrC,6FAVA,4BAAY,OAUA;AARrB,6CAAwC;AAQjB,0FARd,sBAAS,OAQc;AAPhC,2CAAsC;AAOJ,yFAPzB,oBAAQ,OAOyB;AAN1C,6CAAwC;AAMI,0FANnC,sBAAS,OAMmC;AALrD,gGAAyF;AAKlC,uGAL9C,kDAAsB,OAK8C;AAH7E,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AAEpB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowWhatsappButtonListRow = void 0;
|
|
4
|
+
const constants_1 = require("../../constants");
|
|
5
|
+
const content_fields_base_1 = require("../content-fields-base");
|
|
6
|
+
class FlowWhatsappButtonListRow extends content_fields_base_1.ContentFieldsBase {
|
|
7
|
+
title = '';
|
|
8
|
+
description = '';
|
|
9
|
+
targetId;
|
|
9
10
|
static fromHubtypeCMS(component, locale) {
|
|
10
|
-
var _a;
|
|
11
11
|
const newRow = new FlowWhatsappButtonListRow(component.id);
|
|
12
12
|
newRow.title = this.getTextByLocale(locale, component.text);
|
|
13
13
|
newRow.description = this.getTextByLocale(locale, component.description);
|
|
14
|
-
newRow.targetId =
|
|
14
|
+
newRow.targetId = component.target?.id;
|
|
15
15
|
return newRow;
|
|
16
16
|
}
|
|
17
17
|
toBotonic(rowIndex, sectionIndex) {
|
|
@@ -26,7 +26,8 @@ export class FlowWhatsappButtonListRow extends ContentFieldsBase {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
getRowId(rowIndex, sectionIndex) {
|
|
29
|
-
return `${this.targetId}${SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`;
|
|
29
|
+
return `${this.targetId}${constants_1.SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
exports.FlowWhatsappButtonListRow = FlowWhatsappButtonListRow;
|
|
32
33
|
//# sourceMappingURL=flow-whatsapp-button-list-row.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list-row.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-button-list-row.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"names":[],"mappings":";;;AAEA,+CAAuD;AACvD,gEAA0D;AAG1D,MAAa,yBAA0B,SAAQ,uCAAiB;IACvD,KAAK,GAAG,EAAE,CAAA;IACV,WAAW,GAAG,EAAE,CAAA;IAChB,QAAQ,CAAS;IAExB,MAAM,CAAC,cAAc,CACnB,SAAkC,EAClC,MAAc;QAEd,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC1D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QAC3D,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;QACxE,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,CAAA;QACtC,OAAO,MAAM,CAAA;IACf,CAAC;IAED,SAAS,CACP,QAAgB,EAChB,YAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,KAAK,iBAAiB,CAAC,CAAA;YAC9D,OAAO,SAAS,CAAA;SACjB;QACD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;YACzC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAA;IACH,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,YAAoB;QACrD,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,iCAAqB,GAAG,YAAY,IAAI,QAAQ,EAAE,CAAA;IAC9E,CAAC;CACF;AAlCD,8DAkCC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowWhatsappButtonListSection = void 0;
|
|
4
|
+
const content_fields_base_1 = require("./../content-fields-base");
|
|
5
|
+
const flow_whatsapp_button_list_row_1 = require("./flow-whatsapp-button-list-row");
|
|
6
|
+
class FlowWhatsappButtonListSection extends content_fields_base_1.ContentFieldsBase {
|
|
7
|
+
title = '';
|
|
8
|
+
rows = [];
|
|
9
9
|
static fromHubtypeCMS(component, locale) {
|
|
10
10
|
const newButton = new FlowWhatsappButtonListSection(component.id);
|
|
11
11
|
newButton.title = this.getTextByLocale(locale, component.title);
|
|
12
|
-
newButton.rows = component.rows.map(row => FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale));
|
|
12
|
+
newButton.rows = component.rows.map(row => flow_whatsapp_button_list_row_1.FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale));
|
|
13
13
|
return newButton;
|
|
14
14
|
}
|
|
15
15
|
toBotonic(sectionIndex) {
|
|
@@ -22,4 +22,5 @@ export class FlowWhatsappButtonListSection extends ContentFieldsBase {
|
|
|
22
22
|
return { title: this.title, rows };
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
exports.FlowWhatsappButtonListSection = FlowWhatsappButtonListSection;
|
|
25
26
|
//# sourceMappingURL=flow-whatsapp-button-list-section.js.map
|
package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list-section.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx"],"names":[],"mappings":"AAMA,
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-button-list-section.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx"],"names":[],"mappings":";;;AAMA,kEAA4D;AAC5D,mFAA2E;AAE3E,MAAa,6BAA8B,SAAQ,uCAAiB;IAC3D,KAAK,GAAG,EAAE,CAAA;IACV,IAAI,GAAgC,EAAE,CAAA;IAE7C,MAAM,CAAC,cAAc,CACnB,SAAsC,EACtC,MAAc;QAEd,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACjE,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QAC/D,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CACxC,yDAAyB,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CACtD,CAAA;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,YAAoB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAC3B,CAAC,GAAiC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;YACnD,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;YACxD,IAAI,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACpC,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,EAAE,CACH,CAAA;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;CACF;AA5BD,sEA4BC"}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowWhatsappButtonList = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@botonic/react");
|
|
6
|
+
const content_fields_base_1 = require("./../content-fields-base");
|
|
7
|
+
const flow_whatsapp_button_list_section_1 = require("./flow-whatsapp-button-list-section");
|
|
8
|
+
class FlowWhatsappButtonList extends content_fields_base_1.ContentFieldsBase {
|
|
9
|
+
code = '';
|
|
10
|
+
text = '';
|
|
11
|
+
listButtonText = '';
|
|
12
|
+
sections = [];
|
|
13
13
|
static fromHubtypeCMS(component, locale) {
|
|
14
14
|
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id);
|
|
15
15
|
newWhatsappButtonList.code = component.code;
|
|
16
16
|
newWhatsappButtonList.text = this.getTextByLocale(locale, component.content.text);
|
|
17
17
|
newWhatsappButtonList.listButtonText = this.getTextByLocale(locale, component.content.button_text);
|
|
18
|
-
newWhatsappButtonList.sections = component.content.sections.map(section => FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale));
|
|
18
|
+
newWhatsappButtonList.sections = component.content.sections.map(section => flow_whatsapp_button_list_section_1.FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale));
|
|
19
19
|
return newWhatsappButtonList;
|
|
20
20
|
}
|
|
21
21
|
toBotonic(id) {
|
|
22
|
-
return (
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(react_1.WhatsappButtonList, { body: this.text, button: this.listButtonText, sections: this.sections.map((section, sectionIndex) => section.toBotonic(sectionIndex)) }, id));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
exports.FlowWhatsappButtonList = FlowWhatsappButtonList;
|
|
25
26
|
//# sourceMappingURL=flow-whatsapp-button-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-button-list.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"names":[],"mappings":";;;;AAAA,0CAAmD;AAInD,kEAA4D;AAC5D,2FAAmF;AAEnF,MAAa,sBAAuB,SAAQ,uCAAiB;IACpD,IAAI,GAAG,EAAE,CAAA;IACT,IAAI,GAAG,EAAE,CAAA;IACT,cAAc,GAAG,EAAE,CAAA;IACnB,QAAQ,GAAoC,EAAE,CAAA;IAErD,MAAM,CAAC,cAAc,CACnB,SAAmC,EACnC,MAAc;QAEd,MAAM,qBAAqB,GAAG,IAAI,sBAAsB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACtE,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC3C,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC/C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,qBAAqB,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CACzD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,WAAW,CAC9B,CAAA;QACD,qBAAqB,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACxE,iEAA6B,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAC9D,CAAA;QACD,OAAO,qBAAqB,CAAA;IAC9B,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,uBAAC,0BAAkB,IAEjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,cAAc,EAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,CACpD,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAChC,IALI,EAAE,CAMa,CACvB,CAAA;IACH,CAAC;CACF;AAtCD,wDAsCC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.conditionalProvider = void 0;
|
|
4
|
+
function conditionalProvider({ request, results, }) {
|
|
2
5
|
const provider = request.session.user.provider;
|
|
3
6
|
if (results.includes(provider))
|
|
4
7
|
return provider;
|
|
5
8
|
return 'default';
|
|
6
9
|
}
|
|
10
|
+
exports.conditionalProvider = conditionalProvider;
|
|
7
11
|
//# sourceMappingURL=conditional-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-provider.js","sourceRoot":"","sources":["../../../src/functions/conditional-provider.ts"],"names":[],"mappings":"AAOA,
|
|
1
|
+
{"version":3,"file":"conditional-provider.js","sourceRoot":"","sources":["../../../src/functions/conditional-provider.ts"],"names":[],"mappings":";;;AAOA,SAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACiB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAA;IAC9C,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAA;IAC/C,OAAO,SAAS,CAAA;AAClB,CAAC;AAPD,kDAOC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getQueueAvailability = exports.conditionalQueueStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
2
6
|
const HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
3
|
-
|
|
7
|
+
async function conditionalQueueStatus({ queue_id, }) {
|
|
4
8
|
const data = await getQueueAvailability(queue_id);
|
|
5
9
|
const isAvailable = data.available;
|
|
6
10
|
return isAvailable ? 'open' : 'closed';
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
exports.conditionalQueueStatus = conditionalQueueStatus;
|
|
13
|
+
async function getQueueAvailability(queueId) {
|
|
14
|
+
const response = await axios_1.default.get(`${HUBTYPE_API_URL}/public/v1/queues/${queueId}/availability/`,
|
|
10
15
|
// TODO: Make it configurable in the future
|
|
11
16
|
{
|
|
12
17
|
params: {
|
|
@@ -17,4 +22,5 @@ export async function getQueueAvailability(queueId) {
|
|
|
17
22
|
});
|
|
18
23
|
return response.data;
|
|
19
24
|
}
|
|
25
|
+
exports.getQueueAvailability = getQueueAvailability;
|
|
20
26
|
//# sourceMappingURL=conditional-queue-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../src/functions/conditional-queue-status.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"conditional-queue-status.js","sourceRoot":"","sources":["../../../src/functions/conditional-queue-status.ts"],"names":[],"mappings":";;;;AACA,0DAAyB;AAEzB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAQzE,KAAK,UAAU,sBAAsB,CAAC,EAC3C,QAAQ,GACmB;IAC3B,MAAM,IAAI,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IACjD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAA;IAClC,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAA;AACxC,CAAC;AAND,wDAMC;AAWM,KAAK,UAAU,oBAAoB,CACxC,OAAe;IAEf,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,GAAG,eAAe,qBAAqB,OAAO,gBAAgB;IAC9D,2CAA2C;IAC3C;QACE,MAAM,EAAE;YACN,oBAAoB,EAAE,IAAI;YAC1B,mBAAmB,EAAE,KAAK;YAC1B,sBAAsB,EAAE,KAAK;SAC9B;KACF,CACF,CAAA;IACD,OAAO,QAAQ,CAAC,IAAI,CAAA;AACtB,CAAC;AAfD,oDAeC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_FUNCTIONS = void 0;
|
|
4
|
+
const conditional_provider_1 = require("./conditional-provider");
|
|
5
|
+
const conditional_queue_status_1 = require("./conditional-queue-status");
|
|
6
|
+
exports.DEFAULT_FUNCTIONS = {
|
|
4
7
|
// TODO: Rename api action name
|
|
5
|
-
'check-queue-status': conditionalQueueStatus,
|
|
6
|
-
'get-channel-type': conditionalProvider,
|
|
8
|
+
'check-queue-status': conditional_queue_status_1.conditionalQueueStatus,
|
|
9
|
+
'get-channel-type': conditional_provider_1.conditionalProvider,
|
|
7
10
|
};
|
|
8
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,yEAAmE;AAEtD,QAAA,iBAAiB,GAAG;IAC/B,+BAA+B;IAC/B,oBAAoB,EAAE,iDAAsB;IAC5C,kBAAkB,EAAE,0CAAmB;CACxC,CAAA"}
|
package/lib/esm/helpers.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFlowBuilderPlugin = void 0;
|
|
1
4
|
const FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder';
|
|
2
|
-
|
|
5
|
+
function getFlowBuilderPlugin(plugins) {
|
|
3
6
|
const flowBuilderPlugin = Object.values(plugins).find(
|
|
4
7
|
// @ts-ignore
|
|
5
8
|
plugin => plugin.name.includes(FLOW_BUILDER_PLUGIN_NAME));
|
|
@@ -7,4 +10,5 @@ export function getFlowBuilderPlugin(plugins) {
|
|
|
7
10
|
throw new Error(`You must include '@botonic/plugin-flow-builder' in your plugins file.`);
|
|
8
11
|
return flowBuilderPlugin;
|
|
9
12
|
}
|
|
13
|
+
exports.getFlowBuilderPlugin = getFlowBuilderPlugin;
|
|
10
14
|
//# sourceMappingURL=helpers.js.map
|
package/lib/esm/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAIA,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAE3D,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;AAIA,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAE3D,SAAgB,oBAAoB,CAAC,OAEpC;IACC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI;IACnD,aAAa;IACb,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAC7B,CAAA;IAC7B,IAAI,CAAC,iBAAiB;QACpB,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAA;IACH,OAAO,iBAAiB,CAAA;AAC1B,CAAC;AAZD,oDAYC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const user_input_1 = require("./action/user-input");
|
|
5
|
+
const api_1 = require("./api");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const content_fields_1 = require("./content-fields");
|
|
8
|
+
const hubtype_fields_1 = require("./content-fields/hubtype-fields");
|
|
9
|
+
const functions_1 = require("./functions");
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
class BotonicPluginFlowBuilder {
|
|
12
|
+
options;
|
|
13
|
+
cmsApi;
|
|
14
|
+
flowUrl;
|
|
15
|
+
flow;
|
|
16
|
+
functions;
|
|
17
|
+
currentRequest;
|
|
18
|
+
getAccessToken;
|
|
19
|
+
getLocale;
|
|
20
|
+
trackEvent;
|
|
21
|
+
getKnowledgeBaseResponse;
|
|
9
22
|
constructor(options) {
|
|
10
23
|
this.options = options;
|
|
11
24
|
this.flowUrl = options.flowUrl;
|
|
12
25
|
this.flow = options.flow;
|
|
13
26
|
this.getLocale = options.getLocale;
|
|
14
|
-
this.getAccessToken = resolveGetAccessToken(options);
|
|
27
|
+
this.getAccessToken = (0, utils_1.resolveGetAccessToken)(options);
|
|
15
28
|
this.trackEvent = options.trackEvent;
|
|
16
29
|
this.getKnowledgeBaseResponse = options.getKnowledgeBaseResponse;
|
|
17
30
|
const customFunctions = options.customFunctions || {};
|
|
18
|
-
this.functions =
|
|
31
|
+
this.functions = { ...functions_1.DEFAULT_FUNCTIONS, ...customFunctions };
|
|
19
32
|
}
|
|
20
33
|
async pre(request) {
|
|
21
|
-
var _a;
|
|
22
34
|
this.currentRequest = request;
|
|
23
|
-
this.cmsApi = await FlowBuilderApi.create({
|
|
35
|
+
this.cmsApi = await api_1.FlowBuilderApi.create({
|
|
24
36
|
url: this.flowUrl,
|
|
25
37
|
flow: this.flow,
|
|
26
38
|
accessToken: this.getAccessToken(request.session),
|
|
@@ -30,11 +42,11 @@ export default class BotonicPluginFlowBuilder {
|
|
|
30
42
|
!request.input.payload &&
|
|
31
43
|
!request.session.is_first_interaction;
|
|
32
44
|
if (checkUserTextInput) {
|
|
33
|
-
const nodeByUserInput = await getNodeByUserInput(this.cmsApi, this.getLocale(request.session), request);
|
|
34
|
-
request.input.payload = this.cmsApi.getPayload(nodeByUserInput
|
|
45
|
+
const nodeByUserInput = await (0, user_input_1.getNodeByUserInput)(this.cmsApi, this.getLocale(request.session), request);
|
|
46
|
+
request.input.payload = this.cmsApi.getPayload(nodeByUserInput?.target);
|
|
35
47
|
}
|
|
36
48
|
if (request.input.payload) {
|
|
37
|
-
request.input.payload =
|
|
49
|
+
request.input.payload = request.input.payload?.split(constants_1.SOURCE_INFO_SEPARATOR)[0];
|
|
38
50
|
}
|
|
39
51
|
}
|
|
40
52
|
async getContentsByCode(code, locale, prevContents) {
|
|
@@ -52,7 +64,7 @@ export default class BotonicPluginFlowBuilder {
|
|
|
52
64
|
async getContentsByNode(node, locale, prevContents) {
|
|
53
65
|
const contents = prevContents || [];
|
|
54
66
|
const content = this.getFlowContent(node, locale);
|
|
55
|
-
if (node.type === HtNodeWithContentType.FUNCTION) {
|
|
67
|
+
if (node.type === hubtype_fields_1.HtNodeWithContentType.FUNCTION) {
|
|
56
68
|
const targetId = await this.callFunction(node, locale);
|
|
57
69
|
return this.getContentsById(targetId, locale, contents);
|
|
58
70
|
}
|
|
@@ -67,27 +79,27 @@ export default class BotonicPluginFlowBuilder {
|
|
|
67
79
|
}
|
|
68
80
|
getFlowContent(hubtypeContent, locale) {
|
|
69
81
|
switch (hubtypeContent.type) {
|
|
70
|
-
case HtNodeWithContentType.TEXT:
|
|
71
|
-
return FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
72
|
-
case HtNodeWithContentType.IMAGE:
|
|
73
|
-
return FlowImage.fromHubtypeCMS(hubtypeContent, locale);
|
|
74
|
-
case HtNodeWithContentType.CAROUSEL:
|
|
75
|
-
return FlowCarousel.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
76
|
-
case HtNodeWithContentType.VIDEO:
|
|
77
|
-
return FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
78
|
-
case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
79
|
-
return FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale);
|
|
80
|
-
case HtNodeWithContentType.HANDOFF:
|
|
81
|
-
return FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
82
|
+
case hubtype_fields_1.HtNodeWithContentType.TEXT:
|
|
83
|
+
return content_fields_1.FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
84
|
+
case hubtype_fields_1.HtNodeWithContentType.IMAGE:
|
|
85
|
+
return content_fields_1.FlowImage.fromHubtypeCMS(hubtypeContent, locale);
|
|
86
|
+
case hubtype_fields_1.HtNodeWithContentType.CAROUSEL:
|
|
87
|
+
return content_fields_1.FlowCarousel.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
88
|
+
case hubtype_fields_1.HtNodeWithContentType.VIDEO:
|
|
89
|
+
return content_fields_1.FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
90
|
+
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
91
|
+
return content_fields_1.FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale);
|
|
92
|
+
case hubtype_fields_1.HtNodeWithContentType.HANDOFF:
|
|
93
|
+
return content_fields_1.FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
82
94
|
default:
|
|
83
95
|
return undefined;
|
|
84
96
|
}
|
|
85
97
|
}
|
|
86
98
|
async callFunction(functionNode, locale) {
|
|
87
|
-
var _a;
|
|
88
99
|
const functionNodeId = functionNode.id;
|
|
89
|
-
const nameValues =
|
|
90
|
-
.find(arg => arg.locale === locale)
|
|
100
|
+
const nameValues = functionNode.content.arguments
|
|
101
|
+
.find(arg => arg.locale === locale)
|
|
102
|
+
?.values.map(value => ({ [value.name]: value.value })) || [];
|
|
91
103
|
const args = Object.assign({
|
|
92
104
|
request: this.currentRequest,
|
|
93
105
|
results: functionNode.content.result_mapping.map(r => r.result),
|
|
@@ -95,16 +107,17 @@ export default class BotonicPluginFlowBuilder {
|
|
|
95
107
|
const functionResult = await this.functions[functionNode.content.action](args);
|
|
96
108
|
// TODO define result_mapping per locale??
|
|
97
109
|
const result = functionNode.content.result_mapping.find(r => r.result === functionResult);
|
|
98
|
-
if (!
|
|
110
|
+
if (!result?.target) {
|
|
99
111
|
throw new Error(`No result found for result_mapping for node with id: ${functionNodeId}`);
|
|
100
112
|
}
|
|
101
113
|
return result.target.id;
|
|
102
114
|
}
|
|
103
115
|
getPayloadParams(payload) {
|
|
104
|
-
const payloadParams = JSON.parse(payload.split(SEPARATOR)[1] || '{}');
|
|
116
|
+
const payloadParams = JSON.parse(payload.split(constants_1.SEPARATOR)[1] || '{}');
|
|
105
117
|
return payloadParams;
|
|
106
118
|
}
|
|
107
119
|
}
|
|
108
|
-
|
|
109
|
-
|
|
120
|
+
exports.default = BotonicPluginFlowBuilder;
|
|
121
|
+
tslib_1.__exportStar(require("./action"), exports);
|
|
122
|
+
tslib_1.__exportStar(require("./content-fields"), exports);
|
|
110
123
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index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