@botonic/plugin-flow-builder 0.22.0-alpha.2 → 0.22.0
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.js +14 -12
- package/lib/cjs/action.js.map +1 -1
- package/lib/cjs/api.d.ts +19 -0
- package/lib/cjs/api.js +108 -0
- package/lib/cjs/api.js.map +1 -0
- package/lib/cjs/content-fields/content-fields-base.d.ts +4 -4
- package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
- package/lib/cjs/content-fields/flow-button.d.ts +6 -3
- package/lib/cjs/content-fields/flow-button.js +28 -21
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/cjs/content-fields/flow-carousel.d.ts +3 -2
- package/lib/cjs/content-fields/flow-carousel.js +3 -10
- package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
- package/lib/cjs/content-fields/flow-element.d.ts +6 -3
- package/lib/cjs/content-fields/flow-element.js +16 -5
- package/lib/cjs/content-fields/flow-element.js.map +1 -1
- package/lib/cjs/content-fields/flow-image.d.ts +2 -2
- package/lib/cjs/content-fields/flow-image.js.map +1 -1
- package/lib/cjs/content-fields/flow-text.d.ts +4 -3
- package/lib/cjs/content-fields/flow-text.js +9 -9
- package/lib/cjs/content-fields/flow-text.js.map +1 -1
- package/lib/cjs/content-fields/flow-video.d.ts +2 -2
- package/lib/cjs/content-fields/flow-video.js +0 -1
- package/lib/cjs/content-fields/flow-video.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/button.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +16 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +55 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/function.d.ts +28 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js +10 -0
- package/lib/cjs/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/cjs/content-fields/{types.js → hubtype-fields/image.js} +1 -1
- package/lib/cjs/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +17 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +21 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.d.ts +10 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/intent.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +23 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +31 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +16 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/start.d.ts +7 -0
- package/lib/cjs/content-fields/hubtype-fields/start.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/start.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/cjs/content-fields/index.d.ts +7 -5
- package/lib/cjs/content-fields/index.js +11 -9
- 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 +10 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +32 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +10 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +29 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +12 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +33 -0
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/cjs/functions/conditional-queue-status.js +1 -3
- package/lib/cjs/functions/conditional-queue-status.js.map +1 -1
- package/lib/cjs/handoff.d.ts +2 -2
- package/lib/cjs/handoff.js +13 -7
- package/lib/cjs/handoff.js.map +1 -1
- package/lib/cjs/helpers.d.ts +2 -1
- package/lib/cjs/helpers.js +5 -13
- package/lib/cjs/helpers.js.map +1 -1
- package/lib/cjs/index.d.ts +8 -21
- package/lib/cjs/index.js +34 -150
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types.d.ts +6 -2
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/action.js +14 -12
- package/lib/esm/action.js.map +1 -1
- package/lib/esm/api.d.ts +19 -0
- package/lib/esm/api.js +103 -0
- package/lib/esm/api.js.map +1 -0
- package/lib/esm/content-fields/content-fields-base.d.ts +4 -4
- package/lib/esm/content-fields/content-fields-base.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +6 -3
- package/lib/esm/content-fields/flow-button.js +28 -21
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-carousel.d.ts +3 -2
- package/lib/esm/content-fields/flow-carousel.js +4 -11
- package/lib/esm/content-fields/flow-carousel.js.map +1 -1
- package/lib/esm/content-fields/flow-element.d.ts +6 -3
- package/lib/esm/content-fields/flow-element.js +15 -5
- package/lib/esm/content-fields/flow-element.js.map +1 -1
- package/lib/esm/content-fields/flow-image.d.ts +2 -2
- package/lib/esm/content-fields/flow-image.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +4 -3
- package/lib/esm/content-fields/flow-text.js +9 -9
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/flow-video.d.ts +2 -2
- package/lib/esm/content-fields/flow-video.js +0 -1
- package/lib/esm/content-fields/flow-video.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/button.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/button.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/button.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.d.ts +16 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/carousel.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +55 -0
- package/lib/esm/content-fields/hubtype-fields/common.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/common.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/fallback.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/function.d.ts +28 -0
- package/lib/esm/content-fields/hubtype-fields/function.js +7 -0
- package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/handoff.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/image.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/image.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/image.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +17 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +18 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/intent.d.ts +10 -0
- package/lib/esm/content-fields/hubtype-fields/intent.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/intent.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +9 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/keyword.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +23 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js +28 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +16 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/nodes.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/payload.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/payload.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/start.d.ts +7 -0
- package/lib/esm/content-fields/hubtype-fields/start.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/start.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/text.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/text.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/text.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/url.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/url.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/url.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/video.d.ts +8 -0
- package/lib/esm/content-fields/hubtype-fields/video.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/video.js.map +1 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.d.ts +21 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
- package/lib/esm/content-fields/index.d.ts +7 -5
- package/lib/esm/content-fields/index.js +6 -4
- 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 +10 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +28 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +10 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +25 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +12 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +28 -0
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
- package/lib/esm/functions/conditional-queue-status.js +1 -3
- package/lib/esm/functions/conditional-queue-status.js.map +1 -1
- package/lib/esm/handoff.d.ts +2 -2
- package/lib/esm/handoff.js +13 -7
- package/lib/esm/handoff.js.map +1 -1
- package/lib/esm/helpers.d.ts +2 -1
- package/lib/esm/helpers.js +3 -11
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/index.d.ts +8 -21
- package/lib/esm/index.js +36 -152
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types.d.ts +6 -2
- package/lib/esm/types.js.map +1 -1
- package/package.json +4 -5
- package/src/action.tsx +19 -12
- package/src/api.ts +162 -0
- package/src/content-fields/content-fields-base.ts +7 -7
- package/src/content-fields/flow-button.tsx +40 -19
- package/src/content-fields/flow-carousel.tsx +10 -18
- package/src/content-fields/flow-element.tsx +26 -9
- package/src/content-fields/flow-image.tsx +2 -2
- package/src/content-fields/flow-text.tsx +15 -12
- package/src/content-fields/flow-video.tsx +2 -3
- package/src/content-fields/hubtype-fields/button.ts +15 -0
- package/src/content-fields/hubtype-fields/carousel.ts +18 -0
- package/src/content-fields/hubtype-fields/common.ts +65 -0
- package/src/content-fields/hubtype-fields/fallback.ts +10 -0
- package/src/content-fields/hubtype-fields/function.ts +33 -0
- package/src/content-fields/hubtype-fields/handoff.ts +11 -0
- package/src/content-fields/hubtype-fields/image.ts +9 -0
- package/src/content-fields/hubtype-fields/index.ts +17 -0
- package/src/content-fields/hubtype-fields/intent.ts +11 -0
- package/src/content-fields/hubtype-fields/keyword.ts +10 -0
- package/src/content-fields/hubtype-fields/node-types.ts +26 -0
- package/src/content-fields/hubtype-fields/nodes.ts +32 -0
- package/src/content-fields/hubtype-fields/payload.ts +9 -0
- package/src/content-fields/hubtype-fields/start.ts +8 -0
- package/src/content-fields/hubtype-fields/text.ts +12 -0
- package/src/content-fields/hubtype-fields/url.ts +9 -0
- package/src/content-fields/hubtype-fields/video.ts +9 -0
- package/src/content-fields/hubtype-fields/whatsapp-button-list.ts +25 -0
- package/src/content-fields/index.ts +14 -5
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx +33 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx +35 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx +46 -0
- package/src/functions/conditional-queue-status.ts +1 -3
- package/src/handoff.ts +16 -10
- package/src/helpers.ts +8 -19
- package/src/index.ts +47 -196
- package/src/types.ts +8 -2
- package/lib/cjs/content-fields/types.d.ts +0 -5
- package/lib/cjs/content-fields/types.js.map +0 -1
- package/lib/cjs/flow-builder-models.d.ts +0 -197
- package/lib/cjs/flow-builder-models.js +0 -24
- package/lib/cjs/flow-builder-models.js.map +0 -1
- package/lib/esm/content-fields/types.d.ts +0 -5
- package/lib/esm/content-fields/types.js +0 -2
- package/lib/esm/content-fields/types.js.map +0 -1
- package/lib/esm/flow-builder-models.d.ts +0 -197
- package/lib/esm/flow-builder-models.js +0 -21
- package/lib/esm/flow-builder-models.js.map +0 -1
- package/src/content-fields/types.ts +0 -6
- package/src/flow-builder-models.ts +0 -249
package/lib/esm/api.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import axios from 'axios/index';
|
|
2
|
+
import { HtNodeStartType, HtNodeWithContentType, } from './content-fields/hubtype-fields';
|
|
3
|
+
export class FlowBuilderApi {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
this.url = options.url;
|
|
6
|
+
if (options.flow) {
|
|
7
|
+
this.flow = options.flow;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
async init(token) {
|
|
11
|
+
const { data } = await axios.get(this.url, {
|
|
12
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
13
|
+
});
|
|
14
|
+
this.flow = data;
|
|
15
|
+
}
|
|
16
|
+
getNode(id) {
|
|
17
|
+
const node = this.flow.nodes.find(node => node.id === id);
|
|
18
|
+
if (!node)
|
|
19
|
+
throw Error(`Node with id: '${id}' not found`);
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
22
|
+
getNodeByCode(code) {
|
|
23
|
+
const content = this.flow.nodes.find(node => 'code' in node ? node.code === code : false);
|
|
24
|
+
if (!content)
|
|
25
|
+
throw Error(`Node with code: '${code}' not found`);
|
|
26
|
+
return content;
|
|
27
|
+
}
|
|
28
|
+
getStartNode() {
|
|
29
|
+
const startUpNode = this.flow.nodes.find(node => node.type === HtNodeStartType.STARTUP);
|
|
30
|
+
if (!startUpNode)
|
|
31
|
+
throw new Error('Start-up id must be defined');
|
|
32
|
+
return this.getNode(startUpNode.target.id);
|
|
33
|
+
}
|
|
34
|
+
getFallbackNode(alternate) {
|
|
35
|
+
const fallbackNode = this.flow.nodes.find(node => node.type === HtNodeWithContentType.FALLBACK);
|
|
36
|
+
if (!fallbackNode) {
|
|
37
|
+
throw new Error('Fallback node must be defined');
|
|
38
|
+
}
|
|
39
|
+
const fallbackFirstMessage = fallbackNode.content.first_message;
|
|
40
|
+
if (!fallbackFirstMessage) {
|
|
41
|
+
throw new Error('Fallback 1st message must be defined');
|
|
42
|
+
}
|
|
43
|
+
const fallbackSecondMessage = fallbackNode.content.second_message;
|
|
44
|
+
if (!fallbackSecondMessage) {
|
|
45
|
+
return this.getNode(fallbackFirstMessage.id);
|
|
46
|
+
}
|
|
47
|
+
return alternate
|
|
48
|
+
? this.getNode(fallbackFirstMessage.id)
|
|
49
|
+
: this.getNode(fallbackSecondMessage.id);
|
|
50
|
+
}
|
|
51
|
+
getNodeByIntent(input, locale) {
|
|
52
|
+
try {
|
|
53
|
+
const intents = this.flow.nodes.filter(node => node.type === HtNodeWithContentType.INTENT);
|
|
54
|
+
const inputIntent = input.intent;
|
|
55
|
+
const inputConfidence = input.confidence;
|
|
56
|
+
if (inputIntent) {
|
|
57
|
+
const matchedIntentNode = intents.find(node => inputIntent &&
|
|
58
|
+
this.hasIntent(node, inputIntent, locale) &&
|
|
59
|
+
inputConfidence &&
|
|
60
|
+
this.hasMetConfidenceThreshold(node, inputConfidence));
|
|
61
|
+
return ((matchedIntentNode === null || matchedIntentNode === void 0 ? void 0 : matchedIntentNode.target) &&
|
|
62
|
+
this.getNode(matchedIntentNode === null || matchedIntentNode === void 0 ? void 0 : matchedIntentNode.target.id));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
console.error(`Error getting node by intent '${input.intent}': `, error);
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
hasIntent(node, intent, locale) {
|
|
71
|
+
return node.content.intents.some(i => i.locale === locale && i.values.includes(intent));
|
|
72
|
+
}
|
|
73
|
+
hasMetConfidenceThreshold(node, predictedConfidence) {
|
|
74
|
+
const nodeConfidence = node.content.confidence / 100;
|
|
75
|
+
return predictedConfidence >= nodeConfidence;
|
|
76
|
+
}
|
|
77
|
+
getNodeByKeyword(userInput, locale) {
|
|
78
|
+
try {
|
|
79
|
+
const keywordNodes = this.flow.nodes.filter(node => node.type == HtNodeWithContentType.KEYWORD);
|
|
80
|
+
const matchedKeywordNodes = keywordNodes.filter(node => this.matchKeywords(node, userInput, locale));
|
|
81
|
+
if (matchedKeywordNodes.length > 0 && matchedKeywordNodes[0].target) {
|
|
82
|
+
return this.getNode(matchedKeywordNodes[0].target.id);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error(`Error getting node by keyword '${userInput}': `, error);
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
matchKeywords(node, input, locale) {
|
|
91
|
+
const result = node.content.keywords.find(i => i.locale === locale && this.containsAnyKeywords(input, i.values));
|
|
92
|
+
return Boolean(result);
|
|
93
|
+
}
|
|
94
|
+
containsAnyKeywords(input, keywords) {
|
|
95
|
+
for (let i = 0; i < keywords.length; i++) {
|
|
96
|
+
if (input.includes(keywords[i])) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,aAAa,CAAA;AAE/B,OAAO,EAML,eAAe,EAEf,qBAAqB,GAEtB,MAAM,iCAAiC,CAAA;AAGxC,MAAM,OAAO,cAAc;IAIzB,YAAY,OAA8B;QACxC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;SACzB;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAa;QACtB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;YACzC,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;SAC9C,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,OAAO,CAA4B,EAAU;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QACzD,IAAI,CA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AAK,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CACtE,CAAA;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC;IAEO,mBAAmB,CAAC,KAAa,EAAE,QAAkB;QAC3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC/B,OAAO,IAAI,CAAA;aACZ;SACF;QACD,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtMediaFileLocale, HtTextLocale, HtVideoLocale } from './hubtype-fields';
|
|
2
2
|
export declare abstract class ContentFieldsBase {
|
|
3
3
|
readonly id: string;
|
|
4
4
|
constructor(id: string);
|
|
5
|
-
static getTextByLocale(locale: string, text:
|
|
6
|
-
static getImageByLocale(locale: string, image:
|
|
7
|
-
static getVideoByLocale(locale: string, video:
|
|
5
|
+
static getTextByLocale(locale: string, text: HtTextLocale[]): string;
|
|
6
|
+
static getImageByLocale(locale: string, image: HtMediaFileLocale[]): string;
|
|
7
|
+
static getVideoByLocale(locale: string, video: HtVideoLocale[]): string;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-fields-base.js","sourceRoot":"","sources":["../../../src/content-fields/content-fields-base.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,iBAAiB;IACrC,YAA4B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;IAE1C,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"content-fields-base.js","sourceRoot":"","sources":["../../../src/content-fields/content-fields-base.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,iBAAiB;IACrC,YAA4B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;IAE1C,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,IAAoB;;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;QAClD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,KAA0B;;QAChE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;QACnD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,EAAE,CAAA;IAC3B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,KAAsB;;QAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;QACnD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,EAAE,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
3
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
|
+
import { HtButton, HtButtonStyle } from './hubtype-fields';
|
|
4
5
|
export declare class FlowButton extends ContentFieldsBase {
|
|
5
6
|
text: string;
|
|
6
7
|
url?: string;
|
|
7
8
|
payload?: string;
|
|
8
|
-
static fromHubtypeCMS(
|
|
9
|
-
|
|
9
|
+
static fromHubtypeCMS(cmsButton: HtButton, locale: string, cmsApi: FlowBuilderApi): FlowButton;
|
|
10
|
+
static getPayloadId(cmsButton: any, locale: any): string | undefined;
|
|
11
|
+
static getUrlId(cmsButton: any, locale: any): string | undefined;
|
|
12
|
+
renderButton(buttonStyle?: HtButtonStyle): JSX.Element;
|
|
10
13
|
}
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { Button, Reply } from '@botonic/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ButtonStyle } from '../flow-builder-models';
|
|
4
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
|
+
import { HtButtonStyle, } from './hubtype-fields';
|
|
5
5
|
export class FlowButton extends ContentFieldsBase {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
this.text = '';
|
|
9
9
|
}
|
|
10
|
-
static fromHubtypeCMS(
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
newButton
|
|
14
|
-
newButton.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
static fromHubtypeCMS(cmsButton, locale, cmsApi) {
|
|
11
|
+
const payloadId = this.getPayloadId(cmsButton, locale);
|
|
12
|
+
const urlId = this.getUrlId(cmsButton, locale);
|
|
13
|
+
const newButton = new FlowButton(cmsButton.id);
|
|
14
|
+
newButton.text = this.getTextByLocale(locale, cmsButton.text);
|
|
15
|
+
if (cmsButton.target) {
|
|
16
|
+
newButton.payload = cmsButton.target.id;
|
|
17
|
+
}
|
|
18
|
+
if (cmsButton.payload && payloadId) {
|
|
19
|
+
const payloadNode = cmsApi.getNode(payloadId);
|
|
20
|
+
newButton.payload = payloadNode.content.payload;
|
|
21
|
+
}
|
|
22
|
+
if (cmsButton.url && urlId) {
|
|
23
|
+
const payloadNode = cmsApi.getNode(urlId);
|
|
24
|
+
newButton.url = payloadNode.content.url;
|
|
21
25
|
}
|
|
22
26
|
return newButton;
|
|
23
27
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
static getPayloadId(cmsButton, locale) {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = cmsButton.payload.find(payload => payload.locale === locale)) === null || _a === void 0 ? void 0 : _a.id;
|
|
31
|
+
}
|
|
32
|
+
static getUrlId(cmsButton, locale) {
|
|
33
|
+
var _a;
|
|
34
|
+
return (_a = cmsButton.url.find(url => url.locale === locale)) === null || _a === void 0 ? void 0 : _a.id;
|
|
35
|
+
}
|
|
36
|
+
renderButton(buttonStyle) {
|
|
37
|
+
if (buttonStyle === HtButtonStyle.QUICK_REPLY) {
|
|
38
|
+
return (React.createElement(Reply, { key: this.id, payload: this.payload }, this.text));
|
|
27
39
|
}
|
|
28
|
-
|
|
29
|
-
if (this.url)
|
|
30
|
-
props = { url: this.url };
|
|
31
|
-
return (
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
React.createElement(Button, Object.assign({ key: id, payload: this.payload }, props), this.text));
|
|
40
|
+
return (React.createElement(Button, { key: this.id, payload: this.payload, url: this.url }, this.text));
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
43
|
//# sourceMappingURL=flow-button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAEL,aAAa,GAGd,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,UAAW,SAAQ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AA,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,0CAAE,EAAE,CAAA;IAC7D,CAAC;IAED,YAAY,CAAC,WAA2B;QACtC,IAAI,WAAW,KAAK,aAAa,CAAC,WAAW,EAAE;YAC7C,OAAO,CACL,oBAAC,KAAK,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IACvC,IAAI,CAAC,IAAI,CACJ,CACT,CAAA;SACF;QACD,OAAO,CACL,oBAAC,MAAM,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,IACvD,IAAI,CAAC,IAAI,CACH,CACV,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
3
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
4
|
import { FlowElement } from './flow-element';
|
|
5
|
+
import { HtCarouselNode } from './hubtype-fields';
|
|
5
6
|
export declare class FlowCarousel extends ContentFieldsBase {
|
|
6
7
|
code: string;
|
|
7
8
|
elements: FlowElement[];
|
|
8
|
-
static fromHubtypeCMS(component:
|
|
9
|
+
static fromHubtypeCMS(component: HtCarouselNode, locale: string, cmsApi: FlowBuilderApi): FlowCarousel;
|
|
9
10
|
toBotonic(id: string): JSX.Element;
|
|
10
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Carousel } from '@botonic/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
4
|
import { FlowElement } from './flow-element';
|
|
@@ -8,21 +8,14 @@ export class FlowCarousel extends ContentFieldsBase {
|
|
|
8
8
|
this.code = '';
|
|
9
9
|
this.elements = [];
|
|
10
10
|
}
|
|
11
|
-
static fromHubtypeCMS(component, locale) {
|
|
11
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
12
12
|
const newCarousel = new FlowCarousel(component.id);
|
|
13
13
|
newCarousel.code = component.code;
|
|
14
|
-
newCarousel.elements = component.content.elements.map(element => FlowElement.fromHubtypeCMS(element, locale));
|
|
14
|
+
newCarousel.elements = component.content.elements.map(element => FlowElement.fromHubtypeCMS(element, locale, cmsApi));
|
|
15
15
|
return newCarousel;
|
|
16
16
|
}
|
|
17
17
|
toBotonic(id) {
|
|
18
|
-
return (React.createElement(Carousel, { key: id }, this.elements.map(element =>
|
|
19
|
-
var _a, _b, _c;
|
|
20
|
-
return (React.createElement(Element, { key: `${id}-${element.id}` },
|
|
21
|
-
React.createElement(Pic, { src: element.image }),
|
|
22
|
-
React.createElement(Title, { style: '' }, element.title),
|
|
23
|
-
React.createElement(Subtitle, { style: '' }, element.subtitle),
|
|
24
|
-
React.createElement(Button, { payload: (_a = element.buttons) === null || _a === void 0 ? void 0 : _a.payload, url: (_b = element.buttons) === null || _b === void 0 ? void 0 : _b.url }, (_c = element.buttons) === null || _c === void 0 ? void 0 : _c.text)));
|
|
25
|
-
})));
|
|
18
|
+
return (React.createElement(Carousel, { key: id }, this.elements.map(element => element.toBotonic(id))));
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
//# sourceMappingURL=flow-carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-carousel.js","sourceRoot":"","sources":["../../../src/content-fields/flow-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"flow-carousel.js","sourceRoot":"","sources":["../../../src/content-fields/flow-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAAnD;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,aAAQ,GAAkB,EAAE,CAAA;IAsBrC,CAAC;IApBC,MAAM,CAAC,cAAc,CACnB,SAAyB,EACzB,MAAc,EACd,MAAsB;QAEtB,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAClD,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QACjC,WAAW,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC9D,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACpD,CAAA;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,oBAAC,QAAQ,IAAC,GAAG,EAAE,EAAE,IACd,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAC3C,CACZ,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
2
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
3
4
|
import { FlowButton } from './flow-button';
|
|
5
|
+
import { HtCarouselElement } from './hubtype-fields';
|
|
4
6
|
export declare class FlowElement extends ContentFieldsBase {
|
|
5
7
|
title: string;
|
|
6
8
|
subtitle: string;
|
|
7
|
-
|
|
9
|
+
button: FlowButton | undefined;
|
|
8
10
|
image: string;
|
|
9
11
|
hidden: boolean;
|
|
10
|
-
static fromHubtypeCMS(component:
|
|
12
|
+
static fromHubtypeCMS(component: HtCarouselElement, locale: string, cmsApi: FlowBuilderApi): FlowElement;
|
|
13
|
+
toBotonic(parentId: string): JSX.Element;
|
|
11
14
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Element, Pic, Subtitle, Title } from '@botonic/react';
|
|
2
|
+
import React from 'react';
|
|
1
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
2
4
|
import { FlowButton } from './flow-button';
|
|
3
5
|
export class FlowElement extends ContentFieldsBase {
|
|
@@ -8,13 +10,21 @@ export class FlowElement extends ContentFieldsBase {
|
|
|
8
10
|
this.image = '';
|
|
9
11
|
this.hidden = false;
|
|
10
12
|
}
|
|
11
|
-
static fromHubtypeCMS(component, locale) {
|
|
13
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
12
14
|
const newElement = new FlowElement(component.id);
|
|
13
|
-
newElement.title =
|
|
14
|
-
newElement.subtitle =
|
|
15
|
-
newElement.image =
|
|
16
|
-
newElement.
|
|
15
|
+
newElement.title = this.getTextByLocale(locale, component.title);
|
|
16
|
+
newElement.subtitle = this.getTextByLocale(locale, component.subtitle);
|
|
17
|
+
newElement.image = this.getImageByLocale(locale, component.image);
|
|
18
|
+
newElement.button = FlowButton.fromHubtypeCMS(component.button, locale, cmsApi);
|
|
17
19
|
return newElement;
|
|
18
20
|
}
|
|
21
|
+
toBotonic(parentId) {
|
|
22
|
+
var _a;
|
|
23
|
+
return (React.createElement(Element, { key: `${parentId}-${this.id}` },
|
|
24
|
+
React.createElement(Pic, { src: this.image }),
|
|
25
|
+
React.createElement(Title, null, this.title),
|
|
26
|
+
React.createElement(Subtitle, null, this.subtitle), (_a = this.button) === null || _a === void 0 ? void 0 :
|
|
27
|
+
_a.renderButton()));
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
30
|
//# sourceMappingURL=flow-element.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-element.js","sourceRoot":"","sources":["../../../src/content-fields/flow-element.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flow-element.js","sourceRoot":"","sources":["../../../src/content-fields/flow-element.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAAlD;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,aAAQ,GAAG,EAAE,CAAA;QAEb,UAAK,GAAG,EAAE,CAAA;QACV,WAAM,GAAG,KAAK,CAAA;IA6BvB,CAAC;IA3BC,MAAM,CAAC,cAAc,CACnB,SAA4B,EAC5B,MAAc,EACd,MAAsB;QAEtB,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAChD,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QAChE,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;QACtE,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QACjE,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,cAAc,CAC3C,SAAS,CAAC,MAAM,EAChB,MAAM,EACN,MAAM,CACP,CAAA;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,SAAS,CAAC,QAAgB;;QACxB,OAAO,CACL,oBAAC,OAAO,IAAC,GAAG,EAAE,GAAG,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE;YACpC,oBAAC,GAAG,IAAC,GAAG,EAAE,IAAI,CAAC,KAAK,GAAI;YACxB,oBAAC,KAAK,QAAE,IAAI,CAAC,KAAK,CAAS;YAC3B,oBAAC,QAAQ,QAAE,IAAI,CAAC,QAAQ,CAAY,EACnC,MAAA,IAAI,CAAC,MAAM;eAAE,YAAY,EAAE,CACpB,CACX,CAAA;IACH,CAAC;CACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ImageNode } from '../flow-builder-models';
|
|
3
2
|
import { ContentFieldsBase } from './content-fields-base';
|
|
3
|
+
import { HtImageNode } from './hubtype-fields';
|
|
4
4
|
export declare class FlowImage extends ContentFieldsBase {
|
|
5
5
|
src: string;
|
|
6
6
|
code: string;
|
|
7
|
-
static fromHubtypeCMS(component:
|
|
7
|
+
static fromHubtypeCMS(component: HtImageNode, locale: string): FlowImage;
|
|
8
8
|
toBotonic(id: string): JSX.Element;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-image.js","sourceRoot":"","sources":["../../../src/content-fields/flow-image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-image.js","sourceRoot":"","sources":["../../../src/content-fields/flow-image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,MAAM,OAAO,SAAU,SAAQ,iBAAiB;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,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,oBAAC,KAAK,IAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI,CAAA;IAC1C,CAAC;CACF"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
3
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
4
|
import { FlowButton } from './flow-button';
|
|
5
|
+
import { HtButtonStyle, HtTextNode } from './hubtype-fields';
|
|
5
6
|
export declare class FlowText extends ContentFieldsBase {
|
|
6
7
|
text: string;
|
|
7
8
|
code: string;
|
|
8
9
|
buttons: FlowButton[];
|
|
9
|
-
buttonStyle:
|
|
10
|
-
static fromHubtypeCMS(
|
|
10
|
+
buttonStyle: HtButtonStyle;
|
|
11
|
+
static fromHubtypeCMS(cmsText: HtTextNode, locale: string, cmsApi: FlowBuilderApi): FlowText;
|
|
11
12
|
toBotonic(id: string): JSX.Element;
|
|
12
13
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { Text } from '@botonic/react';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ButtonStyle } from '../flow-builder-models';
|
|
4
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
5
4
|
import { FlowButton } from './flow-button';
|
|
5
|
+
import { HtButtonStyle } from './hubtype-fields';
|
|
6
6
|
export class FlowText extends ContentFieldsBase {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.text = '';
|
|
10
10
|
this.code = '';
|
|
11
11
|
this.buttons = [];
|
|
12
|
-
this.buttonStyle =
|
|
12
|
+
this.buttonStyle = HtButtonStyle.BUTTON;
|
|
13
13
|
}
|
|
14
|
-
static fromHubtypeCMS(
|
|
15
|
-
const newText = new FlowText(
|
|
16
|
-
newText.code =
|
|
17
|
-
newText.buttonStyle =
|
|
18
|
-
newText.text =
|
|
19
|
-
newText.buttons =
|
|
14
|
+
static fromHubtypeCMS(cmsText, locale, cmsApi) {
|
|
15
|
+
const newText = new FlowText(cmsText.id);
|
|
16
|
+
newText.code = cmsText.code;
|
|
17
|
+
newText.buttonStyle = cmsText.content.buttons_style || HtButtonStyle.BUTTON;
|
|
18
|
+
newText.text = this.getTextByLocale(locale, cmsText.content.text);
|
|
19
|
+
newText.buttons = cmsText.content.buttons.map(button => FlowButton.fromHubtypeCMS(button, locale, cmsApi));
|
|
20
20
|
return newText;
|
|
21
21
|
}
|
|
22
22
|
toBotonic(id) {
|
|
23
23
|
return (React.createElement(Text, { key: id },
|
|
24
24
|
this.text,
|
|
25
|
-
this.buttons.map(button => button.renderButton(
|
|
25
|
+
this.buttons.map(button => button.renderButton(this.buttonStyle))));
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=flow-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-text.js","sourceRoot":"","sources":["../../../src/content-fields/flow-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-text.js","sourceRoot":"","sources":["../../../src/content-fields/flow-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UA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import { ContentFieldsBase } from './content-fields-base';
|
|
3
|
+
import { HtVideoNode } from './hubtype-fields';
|
|
4
4
|
export declare class FlowVideo extends ContentFieldsBase {
|
|
5
5
|
src: string;
|
|
6
6
|
code: string;
|
|
7
|
-
static fromHubtypeCMS(component:
|
|
7
|
+
static fromHubtypeCMS(component: HtVideoNode, locale: string): FlowVideo;
|
|
8
8
|
toBotonic(id: string): JSX.Element;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-video.js","sourceRoot":"","sources":["../../../src/content-fields/flow-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"flow-video.js","sourceRoot":"","sources":["../../../src/content-fields/flow-video.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,MAAM,OAAO,SAAU,SAAQ,iBAAiB;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,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,oBAAC,KAAK,IAAC,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI,CAAA;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/button.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HtButton } from './button';
|
|
2
|
+
import { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common';
|
|
3
|
+
import { HtNodeWithContentType } from './node-types';
|
|
4
|
+
export interface HtCarouselElement {
|
|
5
|
+
id: string;
|
|
6
|
+
title: HtTextLocale[];
|
|
7
|
+
subtitle: HtTextLocale[];
|
|
8
|
+
image: HtMediaFileLocale[];
|
|
9
|
+
button: HtButton;
|
|
10
|
+
}
|
|
11
|
+
export interface HtCarouselNode extends HtBaseNode {
|
|
12
|
+
type: HtNodeWithContentType.CAROUSEL;
|
|
13
|
+
content: {
|
|
14
|
+
elements: HtCarouselElement[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/carousel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { HtNodeWithContentType, HtNodeWithoutContentType } from './node-types';
|
|
2
|
+
import { HtNodeComponent } from './nodes';
|
|
3
|
+
export interface HtFlowBuilderData {
|
|
4
|
+
version: string;
|
|
5
|
+
name: string;
|
|
6
|
+
locales: string[];
|
|
7
|
+
start_node_id?: string;
|
|
8
|
+
ai_model_id?: string;
|
|
9
|
+
nodes: HtNodeComponent[];
|
|
10
|
+
}
|
|
11
|
+
export interface HtNodeLink {
|
|
12
|
+
id: string;
|
|
13
|
+
type: HtNodeWithContentType | HtNodeWithoutContentType;
|
|
14
|
+
}
|
|
15
|
+
export interface HtBaseNode {
|
|
16
|
+
id: string;
|
|
17
|
+
code: string;
|
|
18
|
+
meta: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
follow_up?: HtNodeLink;
|
|
23
|
+
target?: HtNodeLink;
|
|
24
|
+
}
|
|
25
|
+
export interface HtTextLocale {
|
|
26
|
+
message: string;
|
|
27
|
+
locale: string;
|
|
28
|
+
}
|
|
29
|
+
export interface HtMediaFileLocale {
|
|
30
|
+
id: string;
|
|
31
|
+
file: string;
|
|
32
|
+
locale: string;
|
|
33
|
+
}
|
|
34
|
+
export interface HtVideoLocale {
|
|
35
|
+
url: string;
|
|
36
|
+
is_embedded: boolean;
|
|
37
|
+
locale: string;
|
|
38
|
+
}
|
|
39
|
+
export interface HtQueueLocale {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
locale: string;
|
|
43
|
+
}
|
|
44
|
+
export interface HtInputLocale {
|
|
45
|
+
values: string[];
|
|
46
|
+
locale: string;
|
|
47
|
+
}
|
|
48
|
+
export interface HtUrlLocale {
|
|
49
|
+
id: string;
|
|
50
|
+
locale: string;
|
|
51
|
+
}
|
|
52
|
+
export interface HtPayloadLocale {
|
|
53
|
+
id: string;
|
|
54
|
+
locale: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HtBaseNode, HtNodeLink } from './common';
|
|
2
|
+
import { HtNodeWithContentType } from './node-types';
|
|
3
|
+
export interface HtFallbackNode extends HtBaseNode {
|
|
4
|
+
type: HtNodeWithContentType.FALLBACK;
|
|
5
|
+
content: {
|
|
6
|
+
first_message?: HtNodeLink;
|
|
7
|
+
second_message?: HtNodeLink;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/fallback.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HtBaseNode, HtNodeLink } from './common';
|
|
2
|
+
import { HtNodeWithContentType } from './node-types';
|
|
3
|
+
export declare enum HtArgumentType {
|
|
4
|
+
NUMBER = "number",
|
|
5
|
+
STRING = "string",
|
|
6
|
+
JSON = "json"
|
|
7
|
+
}
|
|
8
|
+
export interface HtFunctionArgument {
|
|
9
|
+
type: HtArgumentType;
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface HtFunctionArgumentLocale {
|
|
14
|
+
locale: string;
|
|
15
|
+
values: HtFunctionArgument[];
|
|
16
|
+
}
|
|
17
|
+
export interface HtFunctionResult {
|
|
18
|
+
result: string;
|
|
19
|
+
target?: HtNodeLink;
|
|
20
|
+
}
|
|
21
|
+
export interface HtFunctionNode extends HtBaseNode {
|
|
22
|
+
type: HtNodeWithContentType.FUNCTION;
|
|
23
|
+
content: {
|
|
24
|
+
action: string;
|
|
25
|
+
arguments: HtFunctionArgumentLocale[];
|
|
26
|
+
result_mapping: HtFunctionResult[];
|
|
27
|
+
};
|
|
28
|
+
}
|