@botonic/plugin-flow-builder 0.41.1-alpha.4 → 0.42.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.d.ts +1 -0
- package/lib/cjs/action/index.js +9 -3
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/api.js +1 -10
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/content-fields/content-fields-base.d.ts +5 -1
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-ai-agent.d.ts +2 -2
- package/lib/cjs/content-fields/flow-ai-agent.js +23 -7
- package/lib/cjs/content-fields/flow-ai-agent.js.map +1 -1
- package/lib/cjs/content-fields/flow-bot-action.d.ts +2 -1
- package/lib/cjs/content-fields/flow-bot-action.js +21 -1
- package/lib/cjs/content-fields/flow-bot-action.js.map +1 -1
- package/lib/cjs/content-fields/flow-button.d.ts +2 -1
- package/lib/cjs/content-fields/flow-button.js +7 -0
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +2 -4
- package/lib/cjs/content-fields/flow-carousel.js +8 -50
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
- package/lib/cjs/content-fields/flow-channel-conditional.d.ts +14 -0
- package/lib/cjs/content-fields/flow-channel-conditional.js +56 -0
- package/lib/cjs/content-fields/flow-channel-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-country-conditional.d.ts +13 -0
- package/lib/cjs/content-fields/flow-country-conditional.js +58 -0
- package/lib/cjs/content-fields/flow-country-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-custom-conditional.d.ts +15 -0
- package/lib/cjs/content-fields/flow-custom-conditional.js +78 -0
- package/lib/cjs/content-fields/flow-custom-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-element.d.ts +2 -0
- package/lib/cjs/content-fields/flow-element.js +8 -1
- package/lib/cjs/content-fields/flow-element.js.map +1 -1
- package/lib/cjs/content-fields/flow-go-to-flow.d.ts +13 -0
- package/lib/cjs/content-fields/flow-go-to-flow.js +48 -0
- package/lib/cjs/content-fields/flow-go-to-flow.js.map +1 -0
- package/lib/cjs/content-fields/flow-handoff.d.ts +1 -1
- package/lib/cjs/content-fields/flow-handoff.js +7 -0
- package/lib/cjs/content-fields/flow-handoff.js.map +1 -1
- package/lib/cjs/content-fields/flow-image.d.ts +2 -1
- package/lib/cjs/content-fields/flow-image.js +8 -1
- package/lib/cjs/content-fields/flow-image.js.map +1 -1
- package/lib/cjs/content-fields/flow-knowledge-base.d.ts +1 -1
- package/lib/cjs/content-fields/flow-knowledge-base.js +10 -1
- package/lib/cjs/content-fields/flow-knowledge-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-queue-status-conditional.d.ts +30 -0
- package/lib/cjs/content-fields/flow-queue-status-conditional.js +100 -0
- package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +1 -0
- package/lib/cjs/content-fields/flow-rating.d.ts +1 -1
- package/lib/cjs/content-fields/flow-rating.js +8 -1
- package/lib/cjs/content-fields/flow-rating.js.map +1 -1
- package/lib/cjs/content-fields/flow-text.d.ts +1 -3
- package/lib/cjs/content-fields/flow-text.js +7 -16
- package/lib/cjs/content-fields/flow-text.js.map +1 -1
- package/lib/cjs/content-fields/flow-video.d.ts +2 -1
- package/lib/cjs/content-fields/flow-video.js +8 -1
- package/lib/cjs/content-fields/flow-video.js.map +1 -1
- package/lib/cjs/content-fields/flow-webview.d.ts +2 -1
- package/lib/cjs/content-fields/flow-webview.js +8 -1
- package/lib/cjs/content-fields/flow-webview.js.map +1 -1
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +1 -1
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +8 -1
- package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/go-to-flow.d.ts +4 -3
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +3 -3
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +1 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +2 -2
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +25 -0
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +7 -2
- package/lib/cjs/content-fields/index.js +11 -1
- package/lib/cjs/content-fields/index.js.map +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +2 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +7 -0
- 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.d.ts +2 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +7 -0
- 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 +1 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +8 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/cjs/flow-factory.d.ts +12 -0
- package/lib/cjs/flow-factory.js +65 -0
- package/lib/cjs/flow-factory.js.map +1 -0
- package/lib/cjs/functions/index.d.ts +11 -10
- package/lib/cjs/functions/index.js +49 -12
- package/lib/cjs/functions/index.js.map +1 -1
- package/lib/cjs/index.d.ts +0 -3
- package/lib/cjs/index.js +13 -66
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/services/hubtype-queues-api.d.ts +14 -0
- package/lib/cjs/services/hubtype-queues-api.js +28 -0
- package/lib/cjs/services/hubtype-queues-api.js.map +1 -0
- package/lib/cjs/tracking.d.ts +3 -0
- package/lib/cjs/tracking.js +29 -15
- package/lib/cjs/tracking.js.map +1 -1
- package/lib/esm/action/index.d.ts +1 -0
- package/lib/esm/action/index.js +9 -3
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/api.js +2 -11
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/content-fields/content-fields-base.d.ts +5 -1
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/flow-ai-agent.d.ts +2 -2
- package/lib/esm/content-fields/flow-ai-agent.js +24 -8
- package/lib/esm/content-fields/flow-ai-agent.js.map +1 -1
- package/lib/esm/content-fields/flow-bot-action.d.ts +2 -1
- package/lib/esm/content-fields/flow-bot-action.js +22 -2
- package/lib/esm/content-fields/flow-bot-action.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +2 -1
- package/lib/esm/content-fields/flow-button.js +7 -0
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +2 -4
- package/lib/esm/content-fields/flow-carousel.js +9 -51
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-channel-conditional.d.ts +14 -0
- package/lib/esm/content-fields/flow-channel-conditional.js +52 -0
- package/lib/esm/content-fields/flow-channel-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-country-conditional.d.ts +13 -0
- package/lib/esm/content-fields/flow-country-conditional.js +54 -0
- package/lib/esm/content-fields/flow-country-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-custom-conditional.d.ts +15 -0
- package/lib/esm/content-fields/flow-custom-conditional.js +74 -0
- package/lib/esm/content-fields/flow-custom-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-element.d.ts +2 -0
- package/lib/esm/content-fields/flow-element.js +8 -1
- package/lib/esm/content-fields/flow-element.js.map +1 -1
- package/lib/esm/content-fields/flow-go-to-flow.d.ts +13 -0
- package/lib/esm/content-fields/flow-go-to-flow.js +44 -0
- package/lib/esm/content-fields/flow-go-to-flow.js.map +1 -0
- package/lib/esm/content-fields/flow-handoff.d.ts +1 -1
- package/lib/esm/content-fields/flow-handoff.js +7 -0
- package/lib/esm/content-fields/flow-handoff.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +2 -1
- package/lib/esm/content-fields/flow-image.js +8 -1
- package/lib/esm/content-fields/flow-image.js.map +1 -1
- package/lib/esm/content-fields/flow-knowledge-base.d.ts +1 -1
- package/lib/esm/content-fields/flow-knowledge-base.js +10 -1
- package/lib/esm/content-fields/flow-knowledge-base.js.map +1 -1
- package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +30 -0
- package/lib/esm/content-fields/flow-queue-status-conditional.js +96 -0
- package/lib/esm/content-fields/flow-queue-status-conditional.js.map +1 -0
- package/lib/esm/content-fields/flow-rating.d.ts +1 -1
- package/lib/esm/content-fields/flow-rating.js +8 -1
- package/lib/esm/content-fields/flow-rating.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +1 -3
- package/lib/esm/content-fields/flow-text.js +9 -18
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/flow-video.d.ts +2 -1
- package/lib/esm/content-fields/flow-video.js +8 -1
- package/lib/esm/content-fields/flow-video.js.map +1 -1
- package/lib/esm/content-fields/flow-webview.d.ts +2 -1
- package/lib/esm/content-fields/flow-webview.js +8 -1
- package/lib/esm/content-fields/flow-webview.js.map +1 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +1 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +8 -1
- package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +4 -3
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +3 -3
- package/lib/esm/content-fields/hubtype-fields/node-types.js +1 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +2 -2
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.d.ts +25 -0
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +7 -2
- package/lib/esm/content-fields/index.js +6 -1
- package/lib/esm/content-fields/index.js.map +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +2 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +7 -0
- 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.d.ts +2 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +7 -0
- 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 +1 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +8 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/esm/flow-factory.d.ts +12 -0
- package/lib/esm/flow-factory.js +61 -0
- package/lib/esm/flow-factory.js.map +1 -0
- package/lib/esm/functions/index.d.ts +11 -10
- package/lib/esm/functions/index.js +46 -11
- package/lib/esm/functions/index.js.map +1 -1
- package/lib/esm/index.d.ts +0 -3
- package/lib/esm/index.js +14 -67
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/services/hubtype-queues-api.d.ts +14 -0
- package/lib/esm/services/hubtype-queues-api.js +24 -0
- package/lib/esm/services/hubtype-queues-api.js.map +1 -0
- package/lib/esm/tracking.d.ts +3 -0
- package/lib/esm/tracking.js +27 -14
- package/lib/esm/tracking.js.map +1 -1
- package/package.json +2 -2
- package/src/action/index.tsx +11 -3
- package/src/api.ts +3 -11
- package/src/content-fields/content-fields-base.ts +8 -0
- package/src/content-fields/flow-ai-agent.tsx +41 -8
- package/src/content-fields/flow-bot-action.tsx +23 -2
- package/src/content-fields/flow-button.tsx +6 -1
- package/src/content-fields/flow-carousel.tsx +7 -109
- package/src/content-fields/flow-channel-conditional.tsx +66 -0
- package/src/content-fields/flow-country-conditional.tsx +68 -0
- package/src/content-fields/flow-custom-conditional.tsx +99 -0
- package/src/content-fields/flow-element.tsx +7 -2
- package/src/content-fields/flow-go-to-flow.tsx +52 -0
- package/src/content-fields/flow-handoff.tsx +7 -1
- package/src/content-fields/flow-image.tsx +8 -2
- package/src/content-fields/flow-knowledge-base.tsx +9 -1
- package/src/content-fields/flow-queue-status-conditional.tsx +131 -0
- package/src/content-fields/flow-rating.tsx +6 -1
- package/src/content-fields/flow-text.tsx +6 -32
- package/src/content-fields/flow-video.tsx +8 -2
- package/src/content-fields/flow-webview.tsx +9 -1
- package/src/content-fields/flow-whatsapp-cta-url-button.tsx +7 -1
- package/src/content-fields/hubtype-fields/channel-conditional.ts +11 -0
- package/src/content-fields/hubtype-fields/country-conditional.ts +11 -0
- package/src/content-fields/hubtype-fields/custom-conditional.ts +12 -0
- package/src/content-fields/hubtype-fields/go-to-flow.ts +4 -3
- package/src/content-fields/hubtype-fields/node-types.ts +1 -1
- package/src/content-fields/hubtype-fields/nodes.ts +10 -1
- package/src/content-fields/hubtype-fields/queue-status-conditional.ts +53 -0
- package/src/content-fields/index.ts +15 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx +7 -1
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx +6 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx +7 -1
- package/src/flow-factory.ts +126 -0
- package/src/functions/index.ts +77 -11
- package/src/index.ts +24 -120
- package/src/{functions/conditional-queue-status.ts → services/hubtype-queues-api.ts} +7 -41
- package/src/tracking.ts +35 -12
- package/lib/cjs/functions/conditional-bot-variable.d.ts +0 -8
- package/lib/cjs/functions/conditional-bot-variable.js +0 -11
- package/lib/cjs/functions/conditional-bot-variable.js.map +0 -1
- package/lib/cjs/functions/conditional-country.d.ts +0 -7
- package/lib/cjs/functions/conditional-country.js +0 -9
- package/lib/cjs/functions/conditional-country.js.map +0 -1
- package/lib/cjs/functions/conditional-provider.d.ts +0 -7
- package/lib/cjs/functions/conditional-provider.js +0 -9
- package/lib/cjs/functions/conditional-provider.js.map +0 -1
- package/lib/cjs/functions/conditional-queue-status.d.ts +0 -29
- package/lib/cjs/functions/conditional-queue-status.js +0 -51
- package/lib/cjs/functions/conditional-queue-status.js.map +0 -1
- package/lib/esm/functions/conditional-bot-variable.d.ts +0 -8
- package/lib/esm/functions/conditional-bot-variable.js +0 -7
- package/lib/esm/functions/conditional-bot-variable.js.map +0 -1
- package/lib/esm/functions/conditional-country.d.ts +0 -7
- package/lib/esm/functions/conditional-country.js +0 -5
- package/lib/esm/functions/conditional-country.js.map +0 -1
- package/lib/esm/functions/conditional-provider.d.ts +0 -7
- package/lib/esm/functions/conditional-provider.js +0 -5
- package/lib/esm/functions/conditional-provider.js.map +0 -1
- package/lib/esm/functions/conditional-queue-status.d.ts +0 -29
- package/lib/esm/functions/conditional-queue-status.js +0 -45
- package/lib/esm/functions/conditional-queue-status.js.map +0 -1
- package/src/functions/conditional-bot-variable.ts +0 -18
- package/src/functions/conditional-country.ts +0 -14
- package/src/functions/conditional-provider.ts +0 -14
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowWhatsappButtonListSection = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const content_fields_base_1 = require("../content-fields-base");
|
|
5
6
|
const flow_whatsapp_button_list_row_1 = require("./flow-whatsapp-button-list-row");
|
|
6
7
|
class FlowWhatsappButtonListSection extends content_fields_base_1.ContentFieldsBase {
|
|
@@ -15,6 +16,12 @@ class FlowWhatsappButtonListSection extends content_fields_base_1.ContentFieldsB
|
|
|
15
16
|
newButton.rows = component.rows.map(row => flow_whatsapp_button_list_row_1.FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi));
|
|
16
17
|
return newButton;
|
|
17
18
|
}
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
trackFlow(_request) {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
// Not apply for this content, because it is a child of the FlowWhatsappButtonList content
|
|
23
|
+
});
|
|
24
|
+
}
|
|
18
25
|
toBotonic(sectionIndex) {
|
|
19
26
|
const rows = this.rows.reduce((acc, row, rowIndex) => {
|
|
20
27
|
const botonicRow = row.toBotonic(rowIndex, sectionIndex);
|
package/lib/cjs/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":"
|
|
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":";;;;AAOA,gEAA0D;AAE1D,mFAA2E;AAE3E,MAAa,6BAA8B,SAAQ,uCAAiB;IAApE;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,SAAI,GAAgC,EAAE,CAAA;IAgC/C,CAAC;IA9BC,MAAM,CAAC,cAAc,CACnB,SAAsC,EACtC,MAAc,EACd,MAAsB;QAEtB,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,EAAE,MAAM,CAAC,CAC9D,CAAA;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,6DAA6D;IACvD,SAAS,CAAC,QAAuB;;YACrC,0FAA0F;QAC5F,CAAC;KAAA;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;AAlCD,sEAkCC"}
|
|
@@ -5,10 +5,10 @@ import { ContentFieldsBase } from '../content-fields-base';
|
|
|
5
5
|
import { HtWhatsappButtonListNode } from '../hubtype-fields';
|
|
6
6
|
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section';
|
|
7
7
|
export declare class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
8
|
-
code: string;
|
|
9
8
|
text: string;
|
|
10
9
|
listButtonText: string;
|
|
11
10
|
sections: FlowWhatsappButtonListSection[];
|
|
12
11
|
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonList;
|
|
12
|
+
trackFlow(request: ActionRequest): Promise<void>;
|
|
13
13
|
toBotonic(id: string, request: ActionRequest): JSX.Element;
|
|
14
14
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FlowWhatsappButtonList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const core_1 = require("@botonic/core");
|
|
6
7
|
const react_1 = require("@botonic/react");
|
|
8
|
+
const tracking_1 = require("../../tracking");
|
|
7
9
|
const content_fields_base_1 = require("../content-fields-base");
|
|
8
10
|
const flow_whatsapp_button_list_section_1 = require("./flow-whatsapp-button-list-section");
|
|
9
11
|
class FlowWhatsappButtonList extends content_fields_base_1.ContentFieldsBase {
|
|
10
12
|
constructor() {
|
|
11
13
|
super(...arguments);
|
|
12
|
-
this.code = '';
|
|
13
14
|
this.text = '';
|
|
14
15
|
this.listButtonText = '';
|
|
15
16
|
this.sections = [];
|
|
@@ -20,8 +21,14 @@ class FlowWhatsappButtonList extends content_fields_base_1.ContentFieldsBase {
|
|
|
20
21
|
newWhatsappButtonList.text = this.getTextByLocale(locale, component.content.text);
|
|
21
22
|
newWhatsappButtonList.listButtonText = this.getTextByLocale(locale, component.content.button_text);
|
|
22
23
|
newWhatsappButtonList.sections = component.content.sections.map(section => flow_whatsapp_button_list_section_1.FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi));
|
|
24
|
+
newWhatsappButtonList.followUp = component.follow_up;
|
|
23
25
|
return newWhatsappButtonList;
|
|
24
26
|
}
|
|
27
|
+
trackFlow(request) {
|
|
28
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
yield (0, tracking_1.trackOneContent)(request, this);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
25
32
|
toBotonic(id, request) {
|
|
26
33
|
if (!(0, core_1.isWhatsapp)(request.session)) {
|
|
27
34
|
const rows = this.sections.flatMap(section => section.rows);
|
|
@@ -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":"
|
|
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,wCAA0C;AAC1C,0CAAgF;AAIhF,6CAAgD;AAChD,gEAA0D;AAE1D,2FAAmF;AAEnF,MAAa,sBAAuB,SAAQ,uCAAiB;IAA7D;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,mBAAc,GAAG,EAAE,CAAA;QACnB,aAAQ,G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AE,CAEV,CACV,CAAC,CAAA;YAEF,OAAO,CACL,wBAAC,YAAI,eACF,IAAI,CAAC,IAAI,EACT,OAAO,IACH,CACR,CAAA;SACF;QAED,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;AA5DD,wDA4DC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
import { FlowBuilderApi } from './api';
|
|
3
|
+
import { FlowContent } from './content-fields';
|
|
4
|
+
import { HtNodeComponent } from './content-fields/hubtype-fields';
|
|
5
|
+
export declare class FlowFactory {
|
|
6
|
+
currentRequest: ActionRequest;
|
|
7
|
+
cmsApi: FlowBuilderApi;
|
|
8
|
+
locale: string;
|
|
9
|
+
constructor(request: ActionRequest, cmsApi: FlowBuilderApi, locale: string);
|
|
10
|
+
getFlowContent(hubtypeContent: HtNodeComponent): Promise<FlowContent | undefined>;
|
|
11
|
+
private resolveFlowFunctionContent;
|
|
12
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FlowFactory = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const content_fields_1 = require("./content-fields");
|
|
6
|
+
const hubtype_fields_1 = require("./content-fields/hubtype-fields");
|
|
7
|
+
class FlowFactory {
|
|
8
|
+
constructor(request, cmsApi, locale) {
|
|
9
|
+
this.currentRequest = request;
|
|
10
|
+
this.cmsApi = cmsApi;
|
|
11
|
+
this.locale = locale;
|
|
12
|
+
}
|
|
13
|
+
getFlowContent(hubtypeContent) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
switch (hubtypeContent.type) {
|
|
16
|
+
case hubtype_fields_1.HtNodeWithContentType.TEXT:
|
|
17
|
+
return content_fields_1.FlowText.fromHubtypeCMS(hubtypeContent, this.locale, this.cmsApi);
|
|
18
|
+
case hubtype_fields_1.HtNodeWithContentType.IMAGE:
|
|
19
|
+
return content_fields_1.FlowImage.fromHubtypeCMS(hubtypeContent, this.locale);
|
|
20
|
+
case hubtype_fields_1.HtNodeWithContentType.CAROUSEL:
|
|
21
|
+
return content_fields_1.FlowCarousel.fromHubtypeCMS(hubtypeContent, this.locale, this.cmsApi);
|
|
22
|
+
case hubtype_fields_1.HtNodeWithContentType.VIDEO:
|
|
23
|
+
return content_fields_1.FlowVideo.fromHubtypeCMS(hubtypeContent, this.locale);
|
|
24
|
+
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
25
|
+
return content_fields_1.FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, this.locale, this.cmsApi);
|
|
26
|
+
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON:
|
|
27
|
+
return content_fields_1.FlowWhatsappCtaUrlButtonNode.fromHubtypeCMS(hubtypeContent, this.locale, this.cmsApi);
|
|
28
|
+
case hubtype_fields_1.HtNodeWithContentType.HANDOFF:
|
|
29
|
+
return content_fields_1.FlowHandoff.fromHubtypeCMS(hubtypeContent, this.locale, this.cmsApi);
|
|
30
|
+
case hubtype_fields_1.HtNodeWithContentType.KNOWLEDGE_BASE:
|
|
31
|
+
return content_fields_1.FlowKnowledgeBase.fromHubtypeCMS(hubtypeContent);
|
|
32
|
+
case hubtype_fields_1.HtNodeWithContentType.AI_AGENT:
|
|
33
|
+
return content_fields_1.FlowAiAgent.fromHubtypeCMS(hubtypeContent);
|
|
34
|
+
case hubtype_fields_1.HtNodeWithContentType.RATING:
|
|
35
|
+
return content_fields_1.FlowRating.fromHubtypeCMS(hubtypeContent, this.locale);
|
|
36
|
+
case hubtype_fields_1.HtNodeWithContentType.BOT_ACTION:
|
|
37
|
+
return content_fields_1.FlowBotAction.fromHubtypeCMS(hubtypeContent, this.cmsApi);
|
|
38
|
+
case hubtype_fields_1.HtNodeWithContentType.FUNCTION:
|
|
39
|
+
return this.resolveFlowFunctionContent(hubtypeContent);
|
|
40
|
+
case hubtype_fields_1.HtNodeWithContentType.GO_TO_FLOW:
|
|
41
|
+
return content_fields_1.FlowGoToFlow.fromHubtypeCMS(hubtypeContent, this.cmsApi);
|
|
42
|
+
default:
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
resolveFlowFunctionContent(hubtypeContent) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
switch (hubtypeContent.content.action) {
|
|
50
|
+
case 'check-country':
|
|
51
|
+
return content_fields_1.FlowCountryConditional.fromHubtypeCMS(hubtypeContent, this.currentRequest);
|
|
52
|
+
case 'get-channel-type':
|
|
53
|
+
return content_fields_1.FlowChannelConditional.fromHubtypeCMS(hubtypeContent, this.currentRequest);
|
|
54
|
+
case 'check-queue-status':
|
|
55
|
+
return content_fields_1.FlowQueueStatusConditional.fromHubtypeCMS(hubtypeContent, this.locale);
|
|
56
|
+
case 'check-bot-variable':
|
|
57
|
+
return content_fields_1.FlowCustomConditional.fromHubtypeCMS(hubtypeContent, this.currentRequest);
|
|
58
|
+
default:
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.FlowFactory = FlowFactory;
|
|
65
|
+
//# sourceMappingURL=flow-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-factory.js","sourceRoot":"","sources":["../../src/flow-factory.ts"],"names":[],"mappings":";;;;AAGA,qDAkByB;AAC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+1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
import { HtFunctionArgument, HtFunctionArguments, HtFunctionNode } from '../content-fields/hubtype-fields';
|
|
3
|
+
export declare const DEFAULT_FUNCTION_NAMES: string[];
|
|
4
|
+
export declare class CustomFunction {
|
|
5
|
+
functions: Record<any, any>;
|
|
6
|
+
currentRequest: ActionRequest;
|
|
7
|
+
locale: string;
|
|
8
|
+
constructor(functions: Record<any, any>, currentRequest: ActionRequest, locale: string);
|
|
9
|
+
call(functionNode: HtFunctionNode): Promise<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function getArgumentsByLocale(args: HtFunctionArguments[], locale: string): HtFunctionArgument[];
|
|
@@ -1,15 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
exports.getArgumentsByLocale = exports.CustomFunction = exports.DEFAULT_FUNCTION_NAMES = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
exports.DEFAULT_FUNCTION_NAMES = [
|
|
6
|
+
'check-queue-status',
|
|
7
|
+
'get-channel-type',
|
|
8
|
+
'check-country',
|
|
9
|
+
'check-bot-variable',
|
|
10
|
+
];
|
|
11
|
+
class CustomFunction {
|
|
12
|
+
constructor(functions, currentRequest, locale) {
|
|
13
|
+
this.functions = functions;
|
|
14
|
+
this.currentRequest = currentRequest;
|
|
15
|
+
this.locale = locale;
|
|
16
|
+
}
|
|
17
|
+
call(functionNode) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const functionNodeId = functionNode.id;
|
|
20
|
+
const functionArguments = getArgumentsByLocale(functionNode.content.arguments, this.locale);
|
|
21
|
+
const nameValues = functionArguments.map(arg => {
|
|
22
|
+
return { [arg.name]: arg.value };
|
|
23
|
+
});
|
|
24
|
+
const args = Object.assign({
|
|
25
|
+
request: this.currentRequest,
|
|
26
|
+
results: functionNode.content.result_mapping.map(r => r.result),
|
|
27
|
+
}, ...nameValues);
|
|
28
|
+
const functionResult = yield this.functions[functionNode.content.action](args);
|
|
29
|
+
// TODO define result_mapping per locale??
|
|
30
|
+
const result = functionNode.content.result_mapping.find(r => r.result === functionResult);
|
|
31
|
+
if (!(result === null || result === void 0 ? void 0 : result.target)) {
|
|
32
|
+
throw new Error(`No result found for result_mapping for node with id: ${functionNodeId}`);
|
|
33
|
+
}
|
|
34
|
+
return result.target.id;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.CustomFunction = CustomFunction;
|
|
39
|
+
function getArgumentsByLocale(args, locale) {
|
|
40
|
+
let resultArguments = [];
|
|
41
|
+
for (const arg of args) {
|
|
42
|
+
if ('locale' in arg && arg.locale === locale) {
|
|
43
|
+
resultArguments = [...resultArguments, ...arg.values];
|
|
44
|
+
}
|
|
45
|
+
if ('type' in arg) {
|
|
46
|
+
resultArguments = [...resultArguments, arg];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return resultArguments;
|
|
50
|
+
}
|
|
51
|
+
exports.getArgumentsByLocale = getArgumentsByLocale;
|
|
15
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":";;;;AAQa,QAAA,sBAAsB,GAAG;IACpC,oBAA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DAAwD,cAAc,EAAE,CACzE,CAAA;aACF;YACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;QACzB,CAAC;KAAA;CACF;AA7CD,wCA6CC;AAED,SAAgB,oBAAoB,CAClC,IAA2B,EAC3B,MAAc;IAEd,IAAI,eAAe,GAAyB,EAAE,CAAA;IAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,IAAI,QAAQ,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;YAC5C,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;SACtD;QACD,IAAI,MAAM,IAAI,GAAG,EAAE;YACjB,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,CAAA;SAC5C;KACF;IAED,OAAO,eAAe,CAAA;AACxB,CAAC;AAfD,oDAeC"}
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -31,9 +31,6 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
31
31
|
private getContentsById;
|
|
32
32
|
getStartContents(): Promise<FlowContent[]>;
|
|
33
33
|
getContentsByNode(node: HtNodeWithContent, prevContents?: FlowContent[]): Promise<FlowContent[]>;
|
|
34
|
-
private getFlowContent;
|
|
35
|
-
private callFunction;
|
|
36
|
-
private getArgumentsByLocale;
|
|
37
34
|
getPayloadParams<T extends PayloadParamsBase>(payload: string): T;
|
|
38
35
|
getFlowName(flowId: string): string;
|
|
39
36
|
getRatingSubmittedInfo(payload: string): RatingSubmittedInfo;
|
package/lib/cjs/index.js
CHANGED
|
@@ -6,8 +6,8 @@ const core_1 = require("@botonic/core");
|
|
|
6
6
|
const uuid_1 = require("uuid");
|
|
7
7
|
const api_1 = require("./api");
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
|
-
const content_fields_1 = require("./content-fields");
|
|
10
9
|
const hubtype_fields_1 = require("./content-fields/hubtype-fields");
|
|
10
|
+
const flow_factory_1 = require("./flow-factory");
|
|
11
11
|
const functions_1 = require("./functions");
|
|
12
12
|
const types_1 = require("./types");
|
|
13
13
|
const user_input_1 = require("./user-input");
|
|
@@ -25,7 +25,7 @@ class BotonicPluginFlowBuilder {
|
|
|
25
25
|
this.getAiAgentResponse = options.getAiAgentResponse;
|
|
26
26
|
this.smartIntentsConfig = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.smartIntentsConfig), { useLatest: this.jsonVersion === types_1.FlowBuilderJSONVersion.LATEST });
|
|
27
27
|
const customFunctions = options.customFunctions || {};
|
|
28
|
-
this.functions =
|
|
28
|
+
this.functions = customFunctions;
|
|
29
29
|
this.inShadowing = {
|
|
30
30
|
allowKeywords: ((_a = options.inShadowing) === null || _a === void 0 ? void 0 : _a.allowKeywords) || false,
|
|
31
31
|
allowSmartIntents: ((_b = options.inShadowing) === null || _b === void 0 ? void 0 : _b.allowSmartIntents) || false,
|
|
@@ -116,11 +116,14 @@ class BotonicPluginFlowBuilder {
|
|
|
116
116
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
117
117
|
const contents = prevContents || [];
|
|
118
118
|
const resolvedLocale = this.cmsApi.getResolvedLocale();
|
|
119
|
-
if (node.type === hubtype_fields_1.HtNodeWithContentType.FUNCTION
|
|
120
|
-
|
|
119
|
+
if (node.type === hubtype_fields_1.HtNodeWithContentType.FUNCTION &&
|
|
120
|
+
!functions_1.DEFAULT_FUNCTION_NAMES.includes(node.content.action)) {
|
|
121
|
+
const customFunctionResolver = new functions_1.CustomFunction(this.functions, this.currentRequest, resolvedLocale);
|
|
122
|
+
const targetId = yield customFunctionResolver.call(node);
|
|
121
123
|
return this.getContentsById(targetId, contents);
|
|
122
124
|
}
|
|
123
|
-
const
|
|
125
|
+
const flowFactory = new flow_factory_1.FlowFactory(this.currentRequest, this.cmsApi, resolvedLocale);
|
|
126
|
+
const content = yield flowFactory.getFlowContent(node);
|
|
124
127
|
if (content) {
|
|
125
128
|
contents.push(content);
|
|
126
129
|
}
|
|
@@ -129,72 +132,16 @@ class BotonicPluginFlowBuilder {
|
|
|
129
132
|
return contents;
|
|
130
133
|
}
|
|
131
134
|
// TODO: prevent infinite recursive calls
|
|
132
|
-
if (
|
|
135
|
+
if (content && content.followUp) {
|
|
136
|
+
return this.getContentsById(content.followUp.id, contents);
|
|
137
|
+
}
|
|
138
|
+
else if (node.follow_up) {
|
|
139
|
+
console.log('FOLLOWUP FROM NODE-------> OLD SYSTEM');
|
|
133
140
|
return this.getContentsById(node.follow_up.id, contents);
|
|
134
141
|
}
|
|
135
142
|
return contents;
|
|
136
143
|
});
|
|
137
144
|
}
|
|
138
|
-
getFlowContent(hubtypeContent, locale) {
|
|
139
|
-
switch (hubtypeContent.type) {
|
|
140
|
-
case hubtype_fields_1.HtNodeWithContentType.TEXT:
|
|
141
|
-
return content_fields_1.FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
142
|
-
case hubtype_fields_1.HtNodeWithContentType.IMAGE:
|
|
143
|
-
return content_fields_1.FlowImage.fromHubtypeCMS(hubtypeContent, locale);
|
|
144
|
-
case hubtype_fields_1.HtNodeWithContentType.CAROUSEL:
|
|
145
|
-
return content_fields_1.FlowCarousel.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
146
|
-
case hubtype_fields_1.HtNodeWithContentType.VIDEO:
|
|
147
|
-
return content_fields_1.FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
148
|
-
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
149
|
-
return content_fields_1.FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
150
|
-
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON:
|
|
151
|
-
return content_fields_1.FlowWhatsappCtaUrlButtonNode.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
152
|
-
case hubtype_fields_1.HtNodeWithContentType.HANDOFF:
|
|
153
|
-
return content_fields_1.FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
154
|
-
case hubtype_fields_1.HtNodeWithContentType.KNOWLEDGE_BASE:
|
|
155
|
-
return content_fields_1.FlowKnowledgeBase.fromHubtypeCMS(hubtypeContent);
|
|
156
|
-
case hubtype_fields_1.HtNodeWithContentType.AI_AGENT:
|
|
157
|
-
return content_fields_1.FlowAiAgent.fromHubtypeCMS(hubtypeContent);
|
|
158
|
-
case hubtype_fields_1.HtNodeWithContentType.RATING:
|
|
159
|
-
return content_fields_1.FlowRating.fromHubtypeCMS(hubtypeContent, locale);
|
|
160
|
-
case hubtype_fields_1.HtNodeWithContentType.BOT_ACTION:
|
|
161
|
-
return content_fields_1.FlowBotAction.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
162
|
-
default:
|
|
163
|
-
return undefined;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
callFunction(functionNode, locale) {
|
|
167
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
const functionNodeId = functionNode.id;
|
|
169
|
-
const functionArguments = this.getArgumentsByLocale(functionNode.content.arguments, locale);
|
|
170
|
-
const nameValues = functionArguments.map(arg => {
|
|
171
|
-
return { [arg.name]: arg.value };
|
|
172
|
-
});
|
|
173
|
-
const args = Object.assign({
|
|
174
|
-
request: this.currentRequest,
|
|
175
|
-
results: functionNode.content.result_mapping.map(r => r.result),
|
|
176
|
-
}, ...nameValues);
|
|
177
|
-
const functionResult = yield this.functions[functionNode.content.action](args);
|
|
178
|
-
// TODO define result_mapping per locale??
|
|
179
|
-
const result = functionNode.content.result_mapping.find(r => r.result === functionResult);
|
|
180
|
-
if (!(result === null || result === void 0 ? void 0 : result.target)) {
|
|
181
|
-
throw new Error(`No result found for result_mapping for node with id: ${functionNodeId}`);
|
|
182
|
-
}
|
|
183
|
-
return result.target.id;
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
getArgumentsByLocale(args, locale) {
|
|
187
|
-
let resultArguments = [];
|
|
188
|
-
for (const arg of args) {
|
|
189
|
-
if ('locale' in arg && arg.locale === locale) {
|
|
190
|
-
resultArguments = [...resultArguments, ...arg.values];
|
|
191
|
-
}
|
|
192
|
-
if ('type' in arg) {
|
|
193
|
-
resultArguments = [...resultArguments, arg];
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return resultArguments;
|
|
197
|
-
}
|
|
198
145
|
getPayloadParams(payload) {
|
|
199
146
|
const payloadParams = JSON.parse(payload.split(constants_1.SEPARATOR)[1] || '{}');
|
|
200
147
|
return payloadParams;
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,wCAOsB;AAEtB,+BAAmC;AAEnC,+BAAsC;AACtC,2CAKoB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,wCAOsB;AAEtB,+BAAmC;AAEnC,+BAAsC;AACtC,2CAKoB;AAEpB,oEAKwC;AACxC,iDAA4C;AAC5C,2CAAoE;AACpE,mCAUgB;AAChB,6CAAiD;AAEjD,mCAAiE;AAEjE,2EAA2E;AAE3E,MAAqB,wBAAwB;IAkB3C,YAAY,OAA8D;;QACxE,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,qCAAyB,CAAA;QACzD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,8BAAsB,CAAC,MAAM,CAAA;QACvE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,IAAA,6BAAqB,EAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACnE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACpC,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBA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,KAAK,CACvB,CAAA;QAED,uCACK,YAAY,KACf,eAAe;YACf,cAAc,IACf;IACH,CAAC;CACF;AAvND,2CAuNC;AAED,mDAAwB;AACxB,yCAAkD;AAAzC,iHAAA,oBAAoB,OAAA;AAC7B,2DAAgC;AAEhC,uCAA6C;AAApC,4GAAA,gBAAgB,OAAA;AACzB,iCAMgB;AAHd,+GAAA,sBAAsB,OAAA;AAIxB,oDAAyB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AvailabilityData {
|
|
2
|
+
available: boolean;
|
|
3
|
+
waiting_cases: number;
|
|
4
|
+
availability_threshold_waiting_cases: number;
|
|
5
|
+
open: boolean;
|
|
6
|
+
name: string;
|
|
7
|
+
available_agents: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class HubtypeQueuesApi {
|
|
10
|
+
queueId: string;
|
|
11
|
+
checkAvailableAgents: boolean;
|
|
12
|
+
constructor(queueId: string, checkAvailableAgents?: boolean);
|
|
13
|
+
getAvailability(): Promise<AvailabilityData>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HubtypeQueuesApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
7
|
+
class HubtypeQueuesApi {
|
|
8
|
+
constructor(queueId, checkAvailableAgents) {
|
|
9
|
+
this.queueId = queueId;
|
|
10
|
+
this.checkAvailableAgents = checkAvailableAgents || false;
|
|
11
|
+
}
|
|
12
|
+
getAvailability() {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const response = yield axios_1.default.get(`${HUBTYPE_API_URL}/external/v1/queues/${this.queueId}/availability/`,
|
|
15
|
+
// TODO: Make it configurable in the future
|
|
16
|
+
{
|
|
17
|
+
params: {
|
|
18
|
+
check_queue_schedule: true,
|
|
19
|
+
check_waiting_cases: false,
|
|
20
|
+
check_available_agents: this.checkAvailableAgents,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return response.data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.HubtypeQueuesApi = HubtypeQueuesApi;
|
|
28
|
+
//# sourceMappingURL=hubtype-queues-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubtype-queues-api.js","sourceRoot":"","sources":["../../../src/services/hubtype-queues-api.ts"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAEzB,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,yBAAyB,CAAA;AAUhF,MAAa,gBAAgB;IAI3B,YAAY,OAAe,EAAE,oBAA8B;QACzD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,IAAI,KAAK,CAAA;IAC3D,CAAC;IAEK,eAAe;;YACnB,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAC9B,GAAG,eAAe,uBAAuB,IAAI,CAAC,OAAO,gBAAgB;YACrE,2CAA2C;YAC3C;gBACE,MAAM,EAAE;oBACN,oBAAoB,EAAE,IAAI;oBAC1B,mBAAmB,EAAE,KAAK;oBAC1B,sBAAsB,EAAE,IAAI,CAAC,oBAAoB;iBAClD;aACF,CACF,CAAA;YACD,OAAO,QAAQ,CAAC,IAAI,CAAA;QACtB,CAAC;KAAA;CACF;AAvBD,4CAuBC"}
|
package/lib/cjs/tracking.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { EventAction } from '@botonic/core';
|
|
2
2
|
import { ActionRequest } from '@botonic/react';
|
|
3
|
+
import { FlowBuilderApi } from './api';
|
|
3
4
|
import { FlowContent } from './content-fields';
|
|
4
5
|
export declare function trackEvent(request: ActionRequest, eventAction: EventAction, args?: Record<string, any>): Promise<void>;
|
|
5
6
|
export declare function trackFlowContent(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
7
|
+
export declare function trackOneContent(request: ActionRequest, content: FlowContent, cmsApi?: FlowBuilderApi): Promise<void>;
|
|
6
8
|
type CommonFlowContentEventArgs = {
|
|
9
|
+
flowThreadId: string;
|
|
7
10
|
flowId: string;
|
|
8
11
|
flowName: string;
|
|
9
12
|
flowNodeId: string;
|
package/lib/cjs/tracking.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommonFlowContentEventArgsForContentId = exports.trackFlowContent = exports.trackEvent = void 0;
|
|
3
|
+
exports.getCommonFlowContentEventArgsForContentId = exports.trackOneContent = exports.trackFlowContent = exports.trackEvent = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const core_1 = require("@botonic/core");
|
|
6
6
|
const uuid_1 = require("uuid");
|
|
@@ -21,22 +21,34 @@ function trackFlowContent(request, contents) {
|
|
|
21
21
|
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
22
22
|
const cmsApi = flowBuilderPlugin.cmsApi;
|
|
23
23
|
for (const content of contents) {
|
|
24
|
-
|
|
25
|
-
if (nodeContent.type !== hubtype_fields_1.HtNodeWithContentType.KNOWLEDGE_BASE &&
|
|
26
|
-
nodeContent.type !== hubtype_fields_1.HtNodeWithContentType.AI_AGENT) {
|
|
27
|
-
const event = getContentEventArgs(request, nodeContent);
|
|
28
|
-
const { action } = event, eventArgs = tslib_1.__rest(event, ["action"]);
|
|
29
|
-
yield trackEvent(request, action, eventArgs);
|
|
30
|
-
}
|
|
24
|
+
yield trackOneContent(request, content, cmsApi);
|
|
31
25
|
}
|
|
32
26
|
});
|
|
33
27
|
}
|
|
34
28
|
exports.trackFlowContent = trackFlowContent;
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
function trackOneContent(request, content, cmsApi) {
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (!cmsApi) {
|
|
32
|
+
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
33
|
+
cmsApi = flowBuilderPlugin.cmsApi;
|
|
34
|
+
}
|
|
35
|
+
const nodeContent = cmsApi.getNodeById(content.id);
|
|
36
|
+
if (nodeContent.type !== hubtype_fields_1.HtNodeWithContentType.KNOWLEDGE_BASE &&
|
|
37
|
+
nodeContent.type !== hubtype_fields_1.HtNodeWithContentType.AI_AGENT) {
|
|
38
|
+
const event = getContentEventArgs(request, nodeContent);
|
|
39
|
+
const { action } = event, eventArgs = tslib_1.__rest(event, ["action"]);
|
|
40
|
+
yield trackEvent(request, action, eventArgs);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
exports.trackOneContent = trackOneContent;
|
|
45
|
+
function setSessionFlowThreadId(request, flowThreadId) {
|
|
39
46
|
request.session.flow_thread_id = flowThreadId;
|
|
47
|
+
}
|
|
48
|
+
function getContentEventArgs(request, nodeContent) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgs(request, nodeContent);
|
|
51
|
+
setSessionFlowThreadId(request, flowThreadId);
|
|
40
52
|
return {
|
|
41
53
|
action: core_1.EventAction.FlowNode,
|
|
42
54
|
flowId,
|
|
@@ -44,18 +56,20 @@ function getContentEventArgs(request, nodeContent) {
|
|
|
44
56
|
flowNodeId,
|
|
45
57
|
flowNodeContentId,
|
|
46
58
|
flowThreadId,
|
|
47
|
-
flowNodeIsMeaningful: (
|
|
59
|
+
flowNodeIsMeaningful: (_a = nodeContent.is_meaningful) !== null && _a !== void 0 ? _a : false,
|
|
48
60
|
};
|
|
49
61
|
}
|
|
50
62
|
function getCommonFlowContentEventArgs(request, nodeContent) {
|
|
51
|
-
var _a;
|
|
63
|
+
var _a, _b;
|
|
52
64
|
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
53
65
|
const flowName = flowBuilderPlugin.getFlowName(nodeContent.flow_id);
|
|
66
|
+
const flowThreadId = (_a = request.session.flow_thread_id) !== null && _a !== void 0 ? _a : (0, uuid_1.v7)();
|
|
54
67
|
return {
|
|
68
|
+
flowThreadId,
|
|
55
69
|
flowId: nodeContent.flow_id,
|
|
56
70
|
flowName,
|
|
57
71
|
flowNodeId: nodeContent.id,
|
|
58
|
-
flowNodeContentId: (
|
|
72
|
+
flowNodeContentId: (_b = nodeContent.code) !== null && _b !== void 0 ? _b : '',
|
|
59
73
|
};
|
|
60
74
|
}
|
|
61
75
|
function getCommonFlowContentEventArgsForContentId(request, contentId) {
|
package/lib/cjs/tracking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";;;;AAAA,wCAAsD;AAEtD,+BAAmC;
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";;;;AAAA,wCAAsD;AAEtD,+BAAmC;AAInC,oEAGwC;AACxC,uCAAgD;AAEhD,SAAsB,UAAU,CAC9B,OAAsB,EACtB,WAAwB,EACxB,IAA0B;;QAE1B,MAAM,iBAAiB,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/D,IAAI,iBAAiB,CAAC,UAAU,EAAE;YAChC,MAAM,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;SAC/D;QACD,OAAM;IACR,CAAC;CAAA;AAVD,gCAUC;AAED,SAAsB,gBAAgB,CACpC,OAAsB,EACtB,QAAuB;;QAEvB,MAAM,iBAAiB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BAAsB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;IAE7C,OAAO;QACL,MAAM,EAAE,kBAAW,CAAC,QAAQ;QAC5B,MAAM;QACN,QAAQ;QACR,UAAU;QACV,iBAAiB;QACjB,YAAY;QACZ,oBAAoB,EAAE,MAAA,WAAW,CAAC,aAAa,mCAAI,KAAK;KACzD,CAAA;AACH,CAAC;AAUD,SAAS,6BAA6B,CACpC,OAAsB,EACtB,WAA8B;;IAE9B,MAAM,iBAAiB,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IACnE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,OAAO,CAAC,cAAc,mCAAI,IAAA,SAAM,GAAE,CAAA;IAE/D,OAAO;QACL,YAAY;QACZ,MAAM,EAAE,WAAW,CAAC,OAAO;QAC3B,QAAQ;QACR,UAAU,EAAE,WAAW,CAAC,EAAE;QAC1B,iBAAiB,EAAE,MAAA,WAAW,CAAC,IAAI,mCAAI,EAAE;KAC1C,CAAA;AACH,CAAC;AAED,SAAgB,yCAAyC,CACvD,OAAsB,EACtB,SAAiB;IAEjB,MAAM,iBAAiB,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/D,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAA;IACvC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAoB,SAAS,CAAC,CAAA;IAEpE,OAAO,6BAA6B,CAAC,OAAO,EAAE,WAAW,CAAC,CAAA;AAC5D,CAAC;AATD,8FASC"}
|
|
@@ -12,6 +12,7 @@ export declare class FlowBuilderAction extends React.Component<FlowBuilderAction
|
|
|
12
12
|
context: React.ContextType<typeof RequestContext>;
|
|
13
13
|
static executeConversationStart(request: ActionRequest): Promise<FlowBuilderActionProps>;
|
|
14
14
|
static botonicInit(request: ActionRequest, contentID?: string): Promise<FlowBuilderActionProps>;
|
|
15
|
+
static trackAllContents(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
15
16
|
static doHandoffAndBotActions(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
16
17
|
render(): JSX.Element | JSX.Element[];
|
|
17
18
|
}
|