@botonic/plugin-flow-builder 0.25.0-alpha.9 → 0.25.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/index.js +5 -3
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/action/knowledge-bases.js +4 -2
- package/lib/cjs/action/knowledge-bases.js.map +1 -1
- package/lib/cjs/api.d.ts +6 -2
- package/lib/cjs/api.js +35 -7
- package/lib/cjs/api.js.map +1 -1
- package/lib/cjs/constants.d.ts +3 -1
- package/lib/cjs/constants.js +4 -2
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/content-fields/flow-handoff.js +1 -1
- package/lib/cjs/content-fields/flow-handoff.js.map +1 -1
- package/lib/cjs/content-fields/flow-text.d.ts +4 -2
- package/lib/cjs/content-fields/flow-text.js +17 -10
- package/lib/cjs/content-fields/flow-text.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/common.d.ts +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.d.ts +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +11 -0
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +3 -0
- package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +1 -0
- 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 +2 -3
- 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 +2 -2
- 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 +2 -1
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +2 -2
- package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/cjs/functions/conditional-bot-variable.d.ts +8 -0
- package/lib/cjs/functions/conditional-bot-variable.js +11 -0
- package/lib/cjs/functions/conditional-bot-variable.js.map +1 -0
- package/lib/cjs/functions/conditional-country.d.ts +7 -0
- package/lib/cjs/functions/conditional-country.js +9 -0
- package/lib/cjs/functions/conditional-country.js.map +1 -0
- package/lib/cjs/functions/conditional-provider.js +1 -3
- package/lib/cjs/functions/conditional-provider.js.map +1 -1
- package/lib/cjs/functions/index.d.ts +4 -0
- package/lib/cjs/functions/index.js +4 -0
- package/lib/cjs/functions/index.js.map +1 -1
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +8 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/{action/tracking.js → tracking.js} +1 -1
- package/lib/cjs/tracking.js.map +1 -0
- package/lib/cjs/types.d.ts +1 -1
- package/lib/cjs/user-input/index.d.ts +4 -0
- package/lib/cjs/{action/user-input.js → user-input/index.js} +8 -4
- package/lib/cjs/user-input/index.js.map +1 -0
- package/lib/cjs/{action → user-input}/intent.js +1 -1
- package/lib/cjs/user-input/intent.js.map +1 -0
- package/lib/cjs/{action → user-input}/keyword.js +1 -1
- package/lib/cjs/user-input/keyword.js.map +1 -0
- package/lib/cjs/user-input/smart-intent.d.ts +4 -0
- package/lib/cjs/user-input/smart-intent.js +40 -0
- package/lib/cjs/user-input/smart-intent.js.map +1 -0
- package/lib/cjs/utils.d.ts +2 -0
- package/lib/cjs/utils.js +18 -1
- package/lib/cjs/utils.js.map +1 -1
- package/lib/esm/action/index.js +5 -3
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/action/knowledge-bases.js +4 -2
- package/lib/esm/action/knowledge-bases.js.map +1 -1
- package/lib/esm/api.d.ts +6 -2
- package/lib/esm/api.js +36 -8
- package/lib/esm/api.js.map +1 -1
- package/lib/esm/constants.d.ts +3 -1
- package/lib/esm/constants.js +3 -1
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/content-fields/flow-handoff.js +1 -1
- package/lib/esm/content-fields/flow-handoff.js.map +1 -1
- package/lib/esm/content-fields/flow-text.d.ts +4 -2
- package/lib/esm/content-fields/flow-text.js +18 -11
- package/lib/esm/content-fields/flow-text.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/common.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js +1 -0
- package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
- package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +2 -1
- package/lib/esm/content-fields/hubtype-fields/smart-intent.d.ts +11 -0
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js +2 -0
- package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +1 -0
- 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 +2 -3
- 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 +2 -2
- 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 +2 -1
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +2 -2
- package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
- package/lib/esm/functions/conditional-bot-variable.d.ts +8 -0
- package/lib/esm/functions/conditional-bot-variable.js +7 -0
- package/lib/esm/functions/conditional-bot-variable.js.map +1 -0
- package/lib/esm/functions/conditional-country.d.ts +7 -0
- package/lib/esm/functions/conditional-country.js +5 -0
- package/lib/esm/functions/conditional-country.js.map +1 -0
- package/lib/esm/functions/conditional-provider.js +1 -3
- package/lib/esm/functions/conditional-provider.js.map +1 -1
- package/lib/esm/functions/index.d.ts +4 -0
- package/lib/esm/functions/index.js +4 -0
- package/lib/esm/functions/index.js.map +1 -1
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +8 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/{action/tracking.js → tracking.js} +1 -1
- package/lib/esm/tracking.js.map +1 -0
- package/lib/esm/types.d.ts +1 -1
- package/lib/esm/user-input/index.d.ts +4 -0
- package/lib/esm/{action/user-input.js → user-input/index.js} +8 -4
- package/lib/esm/user-input/index.js.map +1 -0
- package/lib/esm/{action → user-input}/intent.js +1 -1
- package/lib/esm/user-input/intent.js.map +1 -0
- package/lib/esm/{action → user-input}/keyword.js +1 -1
- package/lib/esm/user-input/keyword.js.map +1 -0
- package/lib/esm/user-input/smart-intent.d.ts +4 -0
- package/lib/esm/user-input/smart-intent.js +36 -0
- package/lib/esm/user-input/smart-intent.js.map +1 -0
- package/lib/esm/utils.d.ts +2 -0
- package/lib/esm/utils.js +16 -0
- package/lib/esm/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/action/index.tsx +5 -3
- package/src/action/knowledge-bases.ts +4 -3
- package/src/api.ts +51 -8
- package/src/constants.ts +3 -1
- package/src/content-fields/flow-handoff.tsx +1 -1
- package/src/content-fields/flow-text.tsx +23 -17
- package/src/content-fields/hubtype-fields/common.ts +1 -0
- package/src/content-fields/hubtype-fields/index.ts +1 -0
- package/src/content-fields/hubtype-fields/node-types.ts +1 -0
- package/src/content-fields/hubtype-fields/nodes.ts +2 -0
- package/src/content-fields/hubtype-fields/smart-intent.ts +12 -0
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx +4 -2
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx +4 -2
- package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx +4 -2
- package/src/functions/conditional-bot-variable.ts +18 -0
- package/src/functions/conditional-country.ts +14 -0
- package/src/functions/conditional-provider.ts +1 -2
- package/src/functions/index.ts +4 -0
- package/src/index.ts +15 -6
- package/src/{action/tracking.ts → tracking.ts} +1 -1
- package/src/types.ts +1 -1
- package/src/{action/user-input.ts → user-input/index.ts} +13 -5
- package/src/{action → user-input}/intent.ts +1 -1
- package/src/{action → user-input}/keyword.ts +1 -1
- package/src/user-input/smart-intent.ts +42 -0
- package/src/utils.ts +26 -0
- package/lib/cjs/action/intent.js.map +0 -1
- package/lib/cjs/action/keyword.js.map +0 -1
- package/lib/cjs/action/tracking.js.map +0 -1
- package/lib/cjs/action/user-input.d.ts +0 -4
- package/lib/cjs/action/user-input.js.map +0 -1
- package/lib/esm/action/intent.js.map +0 -1
- package/lib/esm/action/keyword.js.map +0 -1
- package/lib/esm/action/tracking.js.map +0 -1
- package/lib/esm/action/user-input.d.ts +0 -4
- package/lib/esm/action/user-input.js.map +0 -1
- /package/lib/cjs/{action/tracking.d.ts → tracking.d.ts} +0 -0
- /package/lib/cjs/{action → user-input}/intent.d.ts +0 -0
- /package/lib/cjs/{action → user-input}/keyword.d.ts +0 -0
- /package/lib/esm/{action/tracking.d.ts → tracking.d.ts} +0 -0
- /package/lib/esm/{action → user-input}/intent.d.ts +0 -0
- /package/lib/esm/{action → user-input}/keyword.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-handoff.js","sourceRoot":"","sources":["../../../src/content-fields/flow-handoff.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAiB,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"flow-handoff.js","sourceRoot":"","sources":["../../../src/content-fields/flow-handoff.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAiB,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAG/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAGzD,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAMhD,MAAM,CAAC,cAAc,CACnB,UAAyB,EACzB,MAAc,EACd,MAAsB;QAEtB,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;QACjD,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAA;QACjC,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC1E,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAClD,UAAU,EACV,MAAM,EACN,MAAM,CACP,CAAA;QACD,UAAU,CAAC,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,eAAe,CAAA;QAEjE,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAC/B,UAAyB,EACzB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KAAK,CAAC,EAAE,CAAC,CAAA;gBACvC,MAAM,cAAc,CAAC,OAAO,EAAE,CAAA;aAC/B;QACH,CAAC;KAAA;IAED,SAAS;QACP,OAAO,KAAC,eAAe,IAAC,eAAe,EAAE,IAAI,GAAI,CAAA;IACnD,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
1
2
|
import { FlowBuilderApi } from '../api';
|
|
2
3
|
import { ContentFieldsBase } from './content-fields-base';
|
|
3
4
|
import { FlowButton } from './flow-button';
|
|
@@ -8,6 +9,7 @@ export declare class FlowText extends ContentFieldsBase {
|
|
|
8
9
|
buttons: FlowButton[];
|
|
9
10
|
buttonStyle: HtButtonStyle;
|
|
10
11
|
static fromHubtypeCMS(cmsText: HtTextNode, locale: string, cmsApi: FlowBuilderApi): FlowText;
|
|
11
|
-
static replaceVariables(text: string,
|
|
12
|
-
|
|
12
|
+
static replaceVariables(text: string, request: ActionRequest): string;
|
|
13
|
+
private static isValidType;
|
|
14
|
+
toBotonic(id: string, request: ActionRequest): JSX.Element;
|
|
13
15
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from '@botonic/react';
|
|
3
|
-
import {
|
|
3
|
+
import { ACCESS_TOKEN_VARIABLE_KEY, VARIABLE_PATTERN } from '../constants';
|
|
4
|
+
import { getValueFromKeyPath } from '../utils';
|
|
4
5
|
import { ContentFieldsBase } from './content-fields-base';
|
|
5
6
|
import { FlowButton } from './flow-button';
|
|
6
7
|
import { HtButtonStyle } from './hubtype-fields';
|
|
@@ -16,25 +17,31 @@ export class FlowText extends ContentFieldsBase {
|
|
|
16
17
|
const newText = new FlowText(cmsText.id);
|
|
17
18
|
newText.code = cmsText.code;
|
|
18
19
|
newText.buttonStyle = cmsText.content.buttons_style || HtButtonStyle.BUTTON;
|
|
19
|
-
newText.text = this.
|
|
20
|
+
newText.text = this.getTextByLocale(locale, cmsText.content.text);
|
|
20
21
|
newText.buttons = cmsText.content.buttons.map(button => FlowButton.fromHubtypeCMS(button, locale, cmsApi));
|
|
21
22
|
return newText;
|
|
22
23
|
}
|
|
23
|
-
static replaceVariables(text,
|
|
24
|
-
const matches = text.match(
|
|
24
|
+
static replaceVariables(text, request) {
|
|
25
|
+
const matches = text.match(VARIABLE_PATTERN);
|
|
25
26
|
let replacedText = text;
|
|
26
|
-
if (matches &&
|
|
27
|
+
if (matches && request) {
|
|
27
28
|
matches.forEach(match => {
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const keyPath = match.slice(1, -1);
|
|
30
|
+
const botVariable = keyPath.endsWith(ACCESS_TOKEN_VARIABLE_KEY)
|
|
31
|
+
? match
|
|
32
|
+
: getValueFromKeyPath(request, keyPath);
|
|
33
|
+
replacedText = replacedText.replace(match, this.isValidType(botVariable) ? botVariable : match);
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
return replacedText;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
static isValidType(botVariable) {
|
|
39
|
+
const validTypes = ['boolean', 'string', 'number'];
|
|
40
|
+
return validTypes.includes(typeof botVariable);
|
|
41
|
+
}
|
|
42
|
+
toBotonic(id, request) {
|
|
43
|
+
const replacedText = FlowText.replaceVariables(this.text, request);
|
|
44
|
+
return (_jsxs(Text, { children: [replacedText, this.buttons.map((button, buttonIndex) => button.renderButton(buttonIndex, this.buttonStyle))] }, id));
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
//# 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,
|
|
1
|
+
{"version":3,"file":"flow-text.js","sourceRoot":"","sources":["../../../src/content-fields/flow-text.tsx"],"names":[],"mappings":";AAAA,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[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,wBAAwB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,wBAAwB,CAAA"}
|
|
@@ -6,6 +6,7 @@ export var HtNodeWithContentType;
|
|
|
6
6
|
HtNodeWithContentType["TEXT"] = "text";
|
|
7
7
|
HtNodeWithContentType["KEYWORD"] = "keyword";
|
|
8
8
|
HtNodeWithContentType["INTENT"] = "intent";
|
|
9
|
+
HtNodeWithContentType["SMART_INTENT"] = "smart-intent";
|
|
9
10
|
HtNodeWithContentType["FUNCTION"] = "function";
|
|
10
11
|
HtNodeWithContentType["FALLBACK"] = "fallback";
|
|
11
12
|
HtNodeWithContentType["VIDEO"] = "video";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"node-types.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/node-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,qBAYX;AAZD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;IACf,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,sDAA6B,CAAA;IAC7B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sEAA6C,CAAA;AAC/C,CAAC,EAZW,qBAAqB,KAArB,qBAAqB,QAYhC;AAED,MAAM,CAAN,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,uCAAW,CAAA;IACX,+CAAmB,CAAA;IACnB,qDAAyB,CAAA;IACzB,qDAAyB,CAAA;AAC3B,CAAC,EALW,wBAAwB,KAAxB,wBAAwB,QAKnC;AAED,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,4CAA2B,CAAA;AAC7B,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
|
|
@@ -8,10 +8,11 @@ import { HtImageNode } from './image';
|
|
|
8
8
|
import { HtIntentNode } from './intent';
|
|
9
9
|
import { HtKeywordNode } from './keyword';
|
|
10
10
|
import { HtPayloadNode } from './payload';
|
|
11
|
+
import { HtSmartIntentNode } from './smart-intent';
|
|
11
12
|
import { HtTextNode } from './text';
|
|
12
13
|
import { HtUrlNode } from './url';
|
|
13
14
|
import { HtVideoNode } from './video';
|
|
14
15
|
import { HtWhatsappButtonListNode } from './whatsapp-button-list';
|
|
15
|
-
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtIntentNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode;
|
|
16
|
+
export type HtNodeWithContent = HtTextNode | HtImageNode | HtVideoNode | HtCarouselNode | HtHandoffNode | HtKeywordNode | HtIntentNode | HtFunctionNode | HtFallbackNode | HtWhatsappButtonListNode | HtSmartIntentNode;
|
|
16
17
|
export type HtNodeWithoutContent = HtUrlNode | HtPayloadNode | HtGoToFlow | HtBotActionNode;
|
|
17
18
|
export type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HtBaseNode } from './common';
|
|
2
|
+
import { HtNodeWithContentType } from './node-types';
|
|
3
|
+
interface SmartIntent {
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HtSmartIntentNode extends HtBaseNode {
|
|
8
|
+
type: HtNodeWithContentType.SMART_INTENT;
|
|
9
|
+
content: SmartIntent;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-intent.js","sourceRoot":"","sources":["../../../../src/content-fields/hubtype-fields/smart-intent.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { WhatsappButtonListRowProps } from '@botonic/react';
|
|
2
|
+
import { FlowBuilderApi } from '../../api';
|
|
2
3
|
import { ContentFieldsBase } from '../content-fields-base';
|
|
3
4
|
import { HtWhatsappButtonListRow } from '../hubtype-fields';
|
|
4
5
|
export declare class FlowWhatsappButtonListRow extends ContentFieldsBase {
|
|
5
6
|
title: string;
|
|
6
7
|
description: string;
|
|
7
8
|
targetId?: string;
|
|
8
|
-
static fromHubtypeCMS(component: HtWhatsappButtonListRow, locale: string): FlowWhatsappButtonListRow;
|
|
9
|
+
static fromHubtypeCMS(component: HtWhatsappButtonListRow, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonListRow;
|
|
9
10
|
toBotonic(rowIndex: number, sectionIndex: number): WhatsappButtonListRowProps | undefined;
|
|
10
11
|
private getRowId;
|
|
11
12
|
}
|
|
@@ -6,12 +6,11 @@ export class FlowWhatsappButtonListRow extends ContentFieldsBase {
|
|
|
6
6
|
this.title = '';
|
|
7
7
|
this.description = '';
|
|
8
8
|
}
|
|
9
|
-
static fromHubtypeCMS(component, locale) {
|
|
10
|
-
var _a;
|
|
9
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
11
10
|
const newRow = new FlowWhatsappButtonListRow(component.id);
|
|
12
11
|
newRow.title = this.getTextByLocale(locale, component.text);
|
|
13
12
|
newRow.description = this.getTextByLocale(locale, component.description);
|
|
14
|
-
newRow.targetId = (
|
|
13
|
+
newRow.targetId = cmsApi.getPayload(component.target);
|
|
15
14
|
return newRow;
|
|
16
15
|
}
|
|
17
16
|
toBotonic(rowIndex, sectionIndex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list-row.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-button-list-row.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAG1D,MAAM,OAAO,yBAA0B,SAAQ,iBAAiB;IAAhE;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,gBAAW,GAAG,EAAE,CAAA;IAiCzB,CAAC;IA9BC,MAAM,CAAC,cAAc,CACnB,SAAkC,EAClC,MAAc,EACd,MAAsB;QAEtB,MAAM,MAAM,GAAG,IAAI,yBAAyB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC1D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QAC3D,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;QACxE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACrD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,SAAS,CACP,QAAgB,EAChB,YAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,KAAK,iBAAiB,CAAC,CAAA;YAC9D,OAAO,SAAS,CAAA;SACjB;QACD,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;YACzC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAA;IACH,CAAC;IAEO,QAAQ,CAAC,QAAgB,EAAE,YAAoB;QACrD,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAG,qBAAqB,GAAG,YAAY,IAAI,QAAQ,EAAE,CAAA;IAC9E,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { WhatsappButtonListSectionProps } from '@botonic/react';
|
|
2
|
+
import { FlowBuilderApi } from '../../api';
|
|
2
3
|
import { HtWhatsappButtonListSection } from '../hubtype-fields';
|
|
3
4
|
import { ContentFieldsBase } from './../content-fields-base';
|
|
4
5
|
import { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row';
|
|
5
6
|
export declare class FlowWhatsappButtonListSection extends ContentFieldsBase {
|
|
6
7
|
title: string;
|
|
7
8
|
rows: FlowWhatsappButtonListRow[];
|
|
8
|
-
static fromHubtypeCMS(component: HtWhatsappButtonListSection, locale: string): FlowWhatsappButtonListSection;
|
|
9
|
+
static fromHubtypeCMS(component: HtWhatsappButtonListSection, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonListSection;
|
|
9
10
|
toBotonic(sectionIndex: number): WhatsappButtonListSectionProps;
|
|
10
11
|
}
|
|
@@ -6,10 +6,10 @@ export class FlowWhatsappButtonListSection extends ContentFieldsBase {
|
|
|
6
6
|
this.title = '';
|
|
7
7
|
this.rows = [];
|
|
8
8
|
}
|
|
9
|
-
static fromHubtypeCMS(component, locale) {
|
|
9
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
10
10
|
const newButton = new FlowWhatsappButtonListSection(component.id);
|
|
11
11
|
newButton.title = this.getTextByLocale(locale, component.title);
|
|
12
|
-
newButton.rows = component.rows.map(row => FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale));
|
|
12
|
+
newButton.rows = component.rows.map(row => FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi));
|
|
13
13
|
return newButton;
|
|
14
14
|
}
|
|
15
15
|
toBotonic(sectionIndex) {
|
package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list-section.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx"],"names":[],"mappings":"
|
|
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,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAE3E,MAAM,OAAO,6BAA8B,SAAQ,iBAAiB;IAApE;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,SAAI,GAAgC,EAAE,CAAA;IA2B/C,CAAC;IAzBC,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,yBAAyB,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAC9D,CAAA;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,YAAoB;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAC3B,CAAC,GAAiC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE;YACnD,MAAM,UAAU,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;YACxD,IAAI,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACpC,OAAO,GAAG,CAAA;QACZ,CAAC,EACD,EAAE,CACH,CAAA;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAA;IACpC,CAAC;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlowBuilderApi } from '../../api';
|
|
1
2
|
import { HtWhatsappButtonListNode } from '../hubtype-fields';
|
|
2
3
|
import { ContentFieldsBase } from './../content-fields-base';
|
|
3
4
|
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section';
|
|
@@ -6,6 +7,6 @@ export declare class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
6
7
|
text: string;
|
|
7
8
|
listButtonText: string;
|
|
8
9
|
sections: FlowWhatsappButtonListSection[];
|
|
9
|
-
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string): FlowWhatsappButtonList;
|
|
10
|
+
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonList;
|
|
10
11
|
toBotonic(id: string): JSX.Element;
|
|
11
12
|
}
|
|
@@ -10,12 +10,12 @@ export class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
10
10
|
this.listButtonText = '';
|
|
11
11
|
this.sections = [];
|
|
12
12
|
}
|
|
13
|
-
static fromHubtypeCMS(component, locale) {
|
|
13
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
14
14
|
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id);
|
|
15
15
|
newWhatsappButtonList.code = component.code;
|
|
16
16
|
newWhatsappButtonList.text = this.getTextByLocale(locale, component.content.text);
|
|
17
17
|
newWhatsappButtonList.listButtonText = this.getTextByLocale(locale, component.content.button_text);
|
|
18
|
-
newWhatsappButtonList.sections = component.content.sections.map(section => FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale));
|
|
18
|
+
newWhatsappButtonList.sections = component.content.sections.map(section => FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi));
|
|
19
19
|
return newWhatsappButtonList;
|
|
20
20
|
}
|
|
21
21
|
toBotonic(id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-whatsapp-button-list.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;
|
|
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,OAAO,EAAE,kB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,IALI,EAAE,CAMa,CACvB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
interface ConditionalCountryArgs {
|
|
3
|
+
request: ActionRequest;
|
|
4
|
+
results: string[];
|
|
5
|
+
keyPath: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function conditionalBotVariable({ request, results, keyPath, }: ConditionalCountryArgs): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getValueFromKeyPath } from '../utils';
|
|
2
|
+
export function conditionalBotVariable({ request, results, keyPath, }) {
|
|
3
|
+
var _a;
|
|
4
|
+
const botVariable = getValueFromKeyPath(request, keyPath);
|
|
5
|
+
return (_a = results.find(result => result === botVariable)) !== null && _a !== void 0 ? _a : 'default';
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=conditional-bot-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-bot-variable.js","sourceRoot":"","sources":["../../../src/functions/conditional-bot-variable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAQ9C,MAAM,UAAU,sBAAsB,CAAC,EACrC,OAAO,EACP,OAAO,EACP,OAAO,GACgB;;IACvB,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACzD,OAAO,MAAA,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,WAAW,CAAC,mCAAI,SAAS,CAAA;AACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional-country.js","sourceRoot":"","sources":["../../../src/functions/conditional-country.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,kBAAkB,CAAC,EACjC,OAAO,EACP,OAAO,GACgB;IACvB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAA;IACvD,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,SAAS,CAAA;AAChE,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export function conditionalProvider({ request, results, }) {
|
|
2
2
|
const provider = request.session.user.provider;
|
|
3
|
-
|
|
4
|
-
return provider;
|
|
5
|
-
return 'default';
|
|
3
|
+
return results.find(result => result === provider) || 'default';
|
|
6
4
|
}
|
|
7
5
|
//# sourceMappingURL=conditional-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditional-provider.js","sourceRoot":"","sources":["../../../src/functions/conditional-provider.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACiB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAA;IAC9C,
|
|
1
|
+
{"version":3,"file":"conditional-provider.js","sourceRoot":"","sources":["../../../src/functions/conditional-provider.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,GACiB;IACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAA;IAC9C,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,QAAQ,CAAC,IAAI,SAAS,CAAA;AACjE,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { conditionalBotVariable } from './conditional-bot-variable';
|
|
2
|
+
import { conditionalCountry } from './conditional-country';
|
|
1
3
|
import { conditionalProvider } from './conditional-provider';
|
|
2
4
|
import { conditionalQueueStatus } from './conditional-queue-status';
|
|
3
5
|
export declare const DEFAULT_FUNCTIONS: {
|
|
4
6
|
'check-queue-status': typeof conditionalQueueStatus;
|
|
5
7
|
'get-channel-type': typeof conditionalProvider;
|
|
8
|
+
'check-country': typeof conditionalCountry;
|
|
9
|
+
'check-bot-variable': typeof conditionalBotVariable;
|
|
6
10
|
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { conditionalBotVariable } from './conditional-bot-variable';
|
|
2
|
+
import { conditionalCountry } from './conditional-country';
|
|
1
3
|
import { conditionalProvider } from './conditional-provider';
|
|
2
4
|
import { conditionalQueueStatus } from './conditional-queue-status';
|
|
3
5
|
export const DEFAULT_FUNCTIONS = {
|
|
4
6
|
// TODO: Rename api action name
|
|
5
7
|
'check-queue-status': conditionalQueueStatus,
|
|
6
8
|
'get-channel-type': conditionalProvider,
|
|
9
|
+
'check-country': conditionalCountry,
|
|
10
|
+
'check-bot-variable': conditionalBotVariable,
|
|
7
11
|
};
|
|
8
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,+BAA+B;IAC/B,oBAAoB,EAAE,sBAAsB;IAC5C,kBAAkB,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,+BAA+B;IAC/B,oBAAoB,EAAE,sBAAsB;IAC5C,kBAAkB,EAAE,mBAAmB;IACvC,eAAe,EAAE,kBAAkB;IACnC,oBAAoB,EAAE,sBAAsB;CAC7C,CAAA"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
17
17
|
getKnowledgeBaseResponse?: (request: ActionRequest) => Promise<KnowledgeBaseResponse>;
|
|
18
18
|
constructor(options: BotonicPluginFlowBuilderOptions);
|
|
19
19
|
pre(request: PluginPreRequest): Promise<void>;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
getContentsByContentID(contentID: string, locale: string, prevContents?: FlowContent[]): Promise<FlowContent[]>;
|
|
21
|
+
getUUIDByContentID(contentID: string): string;
|
|
22
|
+
private getContentsById;
|
|
22
23
|
getStartContents(locale: string): Promise<FlowContent[]>;
|
|
23
24
|
getContentsByNode(node: HtNodeWithContent, locale: string, prevContents?: FlowContent[]): Promise<FlowContent[]>;
|
|
24
25
|
private getFlowContent;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { getNodeByUserInput } from './action/user-input';
|
|
3
2
|
import { FlowBuilderApi } from './api';
|
|
4
3
|
import { SEPARATOR, SOURCE_INFO_SEPARATOR } from './constants';
|
|
5
4
|
import { FlowCarousel, FlowHandoff, FlowImage, FlowText, FlowVideo, FlowWhatsappButtonList, } from './content-fields';
|
|
6
5
|
import { HtNodeWithContentType, } from './content-fields/hubtype-fields';
|
|
7
6
|
import { DEFAULT_FUNCTIONS } from './functions';
|
|
7
|
+
import { getNodeByUserInput } from './user-input';
|
|
8
8
|
import { resolveGetAccessToken } from './utils';
|
|
9
9
|
export default class BotonicPluginFlowBuilder {
|
|
10
10
|
constructor(options) {
|
|
@@ -42,12 +42,16 @@ export default class BotonicPluginFlowBuilder {
|
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
getContentsByContentID(contentID, locale, prevContents) {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
const node = this.cmsApi.
|
|
47
|
+
const node = this.cmsApi.getNodeByContentID(contentID);
|
|
48
48
|
return yield this.getContentsByNode(node, locale, prevContents);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
getUUIDByContentID(contentID) {
|
|
52
|
+
const node = this.cmsApi.getNodeByContentID(contentID);
|
|
53
|
+
return node.id;
|
|
54
|
+
}
|
|
51
55
|
getContentsById(id, locale, prevContents) {
|
|
52
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
57
|
const node = this.cmsApi.getNodeById(id);
|
|
@@ -90,7 +94,7 @@ export default class BotonicPluginFlowBuilder {
|
|
|
90
94
|
case HtNodeWithContentType.VIDEO:
|
|
91
95
|
return FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
92
96
|
case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
93
|
-
return FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale);
|
|
97
|
+
return FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
94
98
|
case HtNodeWithContentType.HANDOFF:
|
|
95
99
|
return FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
96
100
|
default:
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EACL,YAAY,EAEZ,WAAW,EACX,SAAS,EACT,QAAQ,E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import { __awaiter } from "tslib";
|
|
2
|
-
import { getFlowBuilderPlugin } from '
|
|
2
|
+
import { getFlowBuilderPlugin } from './helpers';
|
|
3
3
|
export function trackEvent(request, eventName, args) {
|
|
4
4
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5
5
|
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,MAAM,UAAgB,UAAU,CAC9B,OAAsB,EACtB,SAAoB,EACpB,IAA0B;;QAE1B,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/D,IAAI,iBAAiB,CAAC,UAAU,EAAE;YAChC,MAAM,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;SAC7D;QACD,OAAM;IACR,CAAC;CAAA;AAED,MAAM,CAAN,IAAY,SAeX;AAfD,WAAY,SAAS;IACnB,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,4CAA+B,CAAA;IAC/B,qCAAwB,CAAA;IACxB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,wCAA2B,CAAA;IAC3B,yDAA4C,CAAA;IAC5C,oDAAuC,CAAA;IACvC,kCAAqB,CAAA;IACrB,6CAAgC,CAAA;IAChC,+CAAkC,CAAA;IAClC,yCAA4B,CAAA;AAC9B,CAAC,EAfW,SAAS,KAAT,SAAS,QAepB"}
|
package/lib/esm/types.d.ts
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
3
|
+
import { HtIntentNode, HtKeywordNode, HtSmartIntentNode } from '../content-fields/hubtype-fields';
|
|
4
|
+
export declare function getNodeByUserInput(cmsApi: FlowBuilderApi, locale: string, request: ActionRequest): Promise<HtSmartIntentNode | HtIntentNode | HtKeywordNode | undefined>;
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { getIntentNodeByInput } from './intent';
|
|
3
3
|
import { getKeywordNodeByInput } from './keyword';
|
|
4
|
+
import { getSmartIntentNodeByInput } from './smart-intent';
|
|
4
5
|
export function getNodeByUserInput(cmsApi, locale, request) {
|
|
5
6
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6
7
|
if (request.input.data) {
|
|
7
|
-
const intentNode = yield getIntentNodeByInput(cmsApi, locale, request);
|
|
8
|
-
if (intentNode)
|
|
9
|
-
return intentNode;
|
|
10
8
|
const keywordNode = yield getKeywordNodeByInput(cmsApi, locale, request, request.input.data);
|
|
11
9
|
if (keywordNode)
|
|
12
10
|
return keywordNode;
|
|
11
|
+
const smartIntentNode = yield getSmartIntentNodeByInput(cmsApi, request);
|
|
12
|
+
if (smartIntentNode)
|
|
13
|
+
return smartIntentNode;
|
|
14
|
+
const intentNode = yield getIntentNodeByInput(cmsApi, locale, request);
|
|
15
|
+
if (intentNode)
|
|
16
|
+
return intentNode;
|
|
13
17
|
}
|
|
14
18
|
return undefined;
|
|
15
19
|
});
|
|
16
20
|
}
|
|
17
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/user-input/index.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAE1D,MAAM,UAAgB,kBAAkB,CACtC,MAAsB,EACtB,MAAc,EACd,OAAsB;;QAEtB,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE;YACtB,MAAM,WAAW,GAAG,MAAM,qBAAqB,CAC7C,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,CAAC,KAAK,CAAC,IAAI,CACnB,CAAA;YACD,IAAI,WAAW;gBAAE,OAAO,WAAW,CAAA;YAEnC,MAAM,eAAe,GAAG,MAAM,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;YACxE,IAAI,eAAe;gBAAE,OAAO,eAAe,CAAA;YAE3C,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;YACtE,IAAI,UAAU;gBAAE,OAAO,UAAU,CAAA;SAClC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { EventName, trackEvent } from '
|
|
2
|
+
import { EventName, trackEvent } from '../tracking';
|
|
3
3
|
export function getIntentNodeByInput(cmsApi, locale, request) {
|
|
4
4
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5
5
|
const intentNode = cmsApi.getIntentNode(request.input, locale);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../src/user-input/intent.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,UAAgB,oBAAoB,CACxC,MAAsB,EACtB,MAAc,EACd,OAAsB;;QAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAC9D,MAAM,SAAS,GAAG;YAChB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAgB;YACtC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAoB;YAC9C,qBAAqB,EAAE,IAAI;SAC5B,CAAA;QACD,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,UAAU,EAAE;YAClE,IAAI,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE;gBAC9C,MAAM,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;gBAC1D,OAAO,UAAU,CAAA;aAClB;YAED,SAAS,CAAC,qBAAqB,GAAG,KAAK,CAAA;YACvC,MAAM,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CAAA;SAC3D;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;CAAA;AAED,SAAS,aAAa,CACpB,UAAwB,EACxB,OAAsB,EACtB,MAAsB;IAEtB,OAAO,CACL,OAAO,CAAC,KAAK,CAAC,UAAU;QACxB,MAAM,CAAC,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CACvE,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
-
import { EventName, trackEvent } from '
|
|
2
|
+
import { EventName, trackEvent } from '../tracking';
|
|
3
3
|
export function getKeywordNodeByInput(cmsApi, locale, request, userInput) {
|
|
4
4
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5
5
|
const keywordNode = cmsApi.getNodeByKeyword(userInput, locale);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../src/user-input/keyword.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,UAAgB,qBAAqB,CACzC,MAAsB,EACtB,MAAc,EACd,OAAsB,EACtB,SAAiB;;QAEjB,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAC9D,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,SAAS,CAAA;SACjB;QACD,MAAM,SAAS,GAAG;YAChB,qBAAqB,EAAE,IAAI;SAC5B,CAAA;QACD,MAAM,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;QAChE,OAAO,WAAW,CAAA;IACpB,CAAC;CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ActionRequest } from '@botonic/react';
|
|
2
|
+
import { FlowBuilderApi } from '../api';
|
|
3
|
+
import { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent';
|
|
4
|
+
export declare function getSmartIntentNodeByInput(cmsApi: FlowBuilderApi, request: ActionRequest): Promise<HtSmartIntentNode | undefined>;
|