@botonic/plugin-flow-builder 0.24.3-alpha.2 → 0.24.4-alpha.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 +1 -2
- package/lib/cjs/action/index.js.map +1 -1
- package/lib/cjs/api.d.ts +1 -1
- package/lib/cjs/api.js +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 +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/index.js +17 -19
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/action/index.js +1 -2
- package/lib/esm/action/index.js.map +1 -1
- package/lib/esm/api.d.ts +1 -1
- package/lib/esm/api.js +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 +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/index.js +17 -19
- package/lib/esm/index.js.map +1 -1
- package/package.json +2 -2
- package/src/action/index.tsx +1 -2
- package/src/api.ts +1 -1
- 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/index.ts +24 -19
package/lib/cjs/action/index.js
CHANGED
|
@@ -12,9 +12,8 @@ class FlowBuilderAction extends react_2.default.Component {
|
|
|
12
12
|
static async botonicInit(request) {
|
|
13
13
|
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
14
14
|
const locale = flowBuilderPlugin.getLocale(request.session);
|
|
15
|
-
const localeResolved = flowBuilderPlugin.cmsApi.getLocaleResolved(locale);
|
|
16
15
|
const targetNode = await getTargetNode(flowBuilderPlugin.cmsApi, request);
|
|
17
|
-
const contents = await flowBuilderPlugin.getContentsByNode(targetNode,
|
|
16
|
+
const contents = await flowBuilderPlugin.getContentsByNode(targetNode, locale);
|
|
18
17
|
const handoffContent = contents.find(content => content instanceof content_fields_1.FlowHandoff);
|
|
19
18
|
if (handoffContent)
|
|
20
19
|
await handoffContent.doHandoff(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":";;;;AAAA,0CAA4E;AAC5E,0DAAyB;AAGzB,sDAA4D;AAE5D,wCAAiD;AACjD,uDAA+D;AAC/D,yCAAkD;AAMlD,MAAa,iBAAkB,SAAQ,eAAK,CAAC,SAAiC;IAG5E,MAAM,CAA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CAAC,UAAU,0CAAE,qBAAqB,MAAK,SAAS,EAAE;QACxE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,mCAC1B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,KAClC,qBAAqB,EAAE,IAAI,GAC5B,CAAA;KACF;IAED,MAAM,iBAAiB,GAAG,MAAM,IAAA,6CAA2B,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC5E,IAAI,iBAAiB,EAAE;QACrB,OAAO,iBAAiB,CAAA;KACzB;IAED,MAAM,qBAAqB,GACzB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAA;IACzD,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAA;IAClE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,CAAA;IAE9E,MAAM,IAAA,qBAAU,EAAC,OAAO,EAAE,oBAAS,CAAC,QAAQ,CAAC,CAAA;IAC7C,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
package/lib/cjs/api.d.ts
CHANGED
package/lib/cjs/api.js
CHANGED
|
@@ -132,7 +132,7 @@ class FlowBuilderApi {
|
|
|
132
132
|
const payloadJson = JSON.stringify(Object.assign(Object.assign({}, customParams), { followUpId: (_a = botActionNode.follow_up) === null || _a === void 0 ? void 0 : _a.id }));
|
|
133
133
|
return `${payloadNode.content.payload}${constants_1.SEPARATOR}${payloadJson}`;
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
getResolvedLocale(locale) {
|
|
136
136
|
if (this.flow.locales.find(flowLocale => flowLocale === locale)) {
|
|
137
137
|
return locale;
|
|
138
138
|
}
|
|
@@ -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
|
}
|
|
@@ -9,12 +9,11 @@ class FlowWhatsappButtonListRow extends content_fields_base_1.ContentFieldsBase
|
|
|
9
9
|
this.title = '';
|
|
10
10
|
this.description = '';
|
|
11
11
|
}
|
|
12
|
-
static fromHubtypeCMS(component, locale) {
|
|
13
|
-
var _a;
|
|
12
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
14
13
|
const newRow = new FlowWhatsappButtonListRow(component.id);
|
|
15
14
|
newRow.title = this.getTextByLocale(locale, component.text);
|
|
16
15
|
newRow.description = this.getTextByLocale(locale, component.description);
|
|
17
|
-
newRow.targetId = (
|
|
16
|
+
newRow.targetId = cmsApi.getPayload(component.target);
|
|
18
17
|
return newRow;
|
|
19
18
|
}
|
|
20
19
|
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,+CAAuD;AACvD,gEAA0D;AAG1D,MAAa,yBAA0B,SAAQ,uCAAiB;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,iCAAqB,GAAG,YAAY,IAAI,QAAQ,EAAE,CAAA;IAC9E,CAAC;CACF;AAnCD,8DAmCC"}
|
|
@@ -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
|
}
|
|
@@ -9,10 +9,10 @@ class FlowWhatsappButtonListSection extends content_fields_base_1.ContentFieldsB
|
|
|
9
9
|
this.title = '';
|
|
10
10
|
this.rows = [];
|
|
11
11
|
}
|
|
12
|
-
static fromHubtypeCMS(component, locale) {
|
|
12
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
13
13
|
const newButton = new FlowWhatsappButtonListSection(component.id);
|
|
14
14
|
newButton.title = this.getTextByLocale(locale, component.title);
|
|
15
|
-
newButton.rows = component.rows.map(row => flow_whatsapp_button_list_row_1.FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale));
|
|
15
|
+
newButton.rows = component.rows.map(row => flow_whatsapp_button_list_row_1.FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi));
|
|
16
16
|
return newButton;
|
|
17
17
|
}
|
|
18
18
|
toBotonic(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,kEAA4D;AAC5D,mFAA2E;AAE3E,MAAa,6BAA8B,SAAQ,uCAAiB;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,yDAAyB,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;AA7BD,sEA6BC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FlowBuilderApi } from '../../api';
|
|
2
3
|
import { HtWhatsappButtonListNode } from '../hubtype-fields';
|
|
3
4
|
import { ContentFieldsBase } from './../content-fields-base';
|
|
4
5
|
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section';
|
|
@@ -7,6 +8,6 @@ export declare class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
7
8
|
text: string;
|
|
8
9
|
listButtonText: string;
|
|
9
10
|
sections: FlowWhatsappButtonListSection[];
|
|
10
|
-
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string): FlowWhatsappButtonList;
|
|
11
|
+
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonList;
|
|
11
12
|
toBotonic(id: string): JSX.Element;
|
|
12
13
|
}
|
|
@@ -14,12 +14,12 @@ class FlowWhatsappButtonList extends content_fields_base_1.ContentFieldsBase {
|
|
|
14
14
|
this.listButtonText = '';
|
|
15
15
|
this.sections = [];
|
|
16
16
|
}
|
|
17
|
-
static fromHubtypeCMS(component, locale) {
|
|
17
|
+
static fromHubtypeCMS(component, locale, cmsApi) {
|
|
18
18
|
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id);
|
|
19
19
|
newWhatsappButtonList.code = component.code;
|
|
20
20
|
newWhatsappButtonList.text = this.getTextByLocale(locale, component.content.text);
|
|
21
21
|
newWhatsappButtonList.listButtonText = this.getTextByLocale(locale, component.content.button_text);
|
|
22
|
-
newWhatsappButtonList.sections = component.content.sections.map(section => flow_whatsapp_button_list_section_1.FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale));
|
|
22
|
+
newWhatsappButtonList.sections = component.content.sections.map(section => flow_whatsapp_button_list_section_1.FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi));
|
|
23
23
|
return newWhatsappButtonList;
|
|
24
24
|
}
|
|
25
25
|
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,0CAAmD;AACnD,0DAAyB;
|
|
1
|
+
{"version":3,"file":"flow-whatsapp-button-list.js","sourceRoot":"","sources":["../../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"names":[],"mappings":";;;;AAAA,0CAAmD;AACnD,0DAAyB;AAIzB,kEAA4D;AAC5D,2FAAmF;AAEnF,MAAa,sBAAuB,SAAQ,uCAAiB;IAA7D;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QACT,mBAAc,GAAG,EAAE,CAAA;QACnB,aAAQ,GAAoC,EAAE,CAAA;IAmCvD,CAAC;IAjCC,MAAM,CAAC,cAAc,CACnB,SAAmC,EACnC,MAAc,EACd,MAAsB;QAEtB,MAAM,qBAAqB,GAAG,IAAI,sBAAsB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACtE,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC3C,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC/C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,qBAAqB,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CACzD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,WAAW,CAC9B,CAAA;QACD,qBAAqB,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACxE,iEAA6B,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACtE,CAAA;QACD,OAAO,qBAAqB,CAAA;IAC9B,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,8BAAC,0BAAkB,IACjB,GAAG,EAAE,EAAE,EACP,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,GACmB,CACvB,CAAA;IACH,CAAC;CACF;AAvCD,wDAuCC"}
|
package/lib/cjs/index.js
CHANGED
|
@@ -34,8 +34,8 @@ class BotonicPluginFlowBuilder {
|
|
|
34
34
|
!request.session.is_first_interaction;
|
|
35
35
|
if (checkUserTextInput) {
|
|
36
36
|
const locale = this.getLocale(request.session);
|
|
37
|
-
const
|
|
38
|
-
const nodeByUserInput = await (0, user_input_1.getNodeByUserInput)(this.cmsApi,
|
|
37
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale);
|
|
38
|
+
const nodeByUserInput = await (0, user_input_1.getNodeByUserInput)(this.cmsApi, resolvedLocale, request);
|
|
39
39
|
request.input.payload = this.cmsApi.getPayload(nodeByUserInput === null || nodeByUserInput === void 0 ? void 0 : nodeByUserInput.target);
|
|
40
40
|
}
|
|
41
41
|
if (request.input.payload) {
|
|
@@ -44,37 +44,35 @@ class BotonicPluginFlowBuilder {
|
|
|
44
44
|
}
|
|
45
45
|
async getContentsByCode(code, locale, prevContents) {
|
|
46
46
|
const node = this.cmsApi.getNodeByCode(code);
|
|
47
|
-
|
|
48
|
-
return await this.getContentsByNode(node, localeResolved, prevContents);
|
|
47
|
+
return await this.getContentsByNode(node, locale, prevContents);
|
|
49
48
|
}
|
|
50
49
|
async getContentsById(id, locale, prevContents) {
|
|
51
50
|
const node = this.cmsApi.getNodeById(id);
|
|
52
|
-
|
|
53
|
-
return await this.getContentsByNode(node, localeResolved, prevContents);
|
|
51
|
+
return await this.getContentsByNode(node, locale, prevContents);
|
|
54
52
|
}
|
|
55
53
|
async getStartContents(locale) {
|
|
56
54
|
const startNode = this.cmsApi.getStartNode();
|
|
57
|
-
|
|
58
|
-
return await this.getContentsByNode(startNode, localeResolved);
|
|
55
|
+
return await this.getContentsByNode(startNode, locale);
|
|
59
56
|
}
|
|
60
57
|
async getContentsByNode(node, locale, prevContents) {
|
|
61
58
|
const contents = prevContents || [];
|
|
62
|
-
const
|
|
63
|
-
const content = this.getFlowContent(node, localeResolved);
|
|
59
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale);
|
|
64
60
|
if (node.type === hubtype_fields_1.HtNodeWithContentType.FUNCTION) {
|
|
65
|
-
const targetId = await this.callFunction(node,
|
|
66
|
-
return this.getContentsById(targetId,
|
|
61
|
+
const targetId = await this.callFunction(node, resolvedLocale);
|
|
62
|
+
return this.getContentsById(targetId, resolvedLocale, contents);
|
|
67
63
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const content = this.getFlowContent(node, resolvedLocale);
|
|
65
|
+
if (content) {
|
|
66
|
+
contents.push(content);
|
|
67
|
+
}
|
|
68
|
+
// TODO: prevent infinite recursive calls
|
|
69
|
+
if (node.follow_up) {
|
|
70
|
+
return this.getContentsById(node.follow_up.id, resolvedLocale, contents);
|
|
74
71
|
}
|
|
75
72
|
return contents;
|
|
76
73
|
}
|
|
77
74
|
getFlowContent(hubtypeContent, locale) {
|
|
75
|
+
const cmsOptions = { hubtypeContent, locale, cmsApi: this.cmsApi };
|
|
78
76
|
switch (hubtypeContent.type) {
|
|
79
77
|
case hubtype_fields_1.HtNodeWithContentType.TEXT:
|
|
80
78
|
return content_fields_1.FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
@@ -85,7 +83,7 @@ class BotonicPluginFlowBuilder {
|
|
|
85
83
|
case hubtype_fields_1.HtNodeWithContentType.VIDEO:
|
|
86
84
|
return content_fields_1.FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
87
85
|
case hubtype_fields_1.HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
88
|
-
return content_fields_1.FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale);
|
|
86
|
+
return content_fields_1.FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
89
87
|
case hubtype_fields_1.HtNodeWithContentType.HANDOFF:
|
|
90
88
|
return content_fields_1.FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
91
89
|
default:
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAGA,oDAAwD;AACxD,+BAAsC;AACtC,2CAA8D;AAC9D,qDAQyB;AACzB,oEAQwC;AACxC,2CAA+C;AAM/C,mCAA+C;AAE/C,MAAqB,wBAAwB;IAiB3C,YAAqB,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;QAC3D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;QAClC,IAAI,CAAC,cAAc,GAAG,IAAA,6BAAqB,EAAC,OAAO,CAAC,CAAA;QACpD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAA;QACpC,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAA;QAChE,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAA;QACrD,IAAI,CAAC,SAAS,mCAAQ,6BAAiB,GAAK,eAAe,CAAE,CAAA;IAC/D,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,OAAyB;;QACjC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,oBAAc,CAAC,MAAM,CAAC;YACxC,GAAG,EAAE,IAAI,CAAC,OAAO;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC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A,EAAE;YACnB,MAAM,IAAI,KAAK,CACb,wDAAwD,cAAc,EAAE,CACzE,CAAA;SACF;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;IACzB,CAAC;IAEO,oBAAoB,CAC1B,IAA2B,EAC3B,MAAc;QAEd,IAAI,eAAe,GAAyB,EAAE,CAAA;QAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,QAAQ,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC5C,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;aACtD;YACD,IAAI,MAAM,IAAI,GAAG,EAAE;gBACjB,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,CAAA;aAC5C;SACF;QAED,OAAO,eAAe,CAAA;IACxB,CAAC;IAED,gBAAgB,CAA8B,OAAe;QAC3D,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;QACrE,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AAhMD,2CAgMC;AAED,mDAAwB;AACxB,2DAAgC"}
|
package/lib/esm/action/index.js
CHANGED
|
@@ -8,9 +8,8 @@ export class FlowBuilderAction extends React.Component {
|
|
|
8
8
|
static async botonicInit(request) {
|
|
9
9
|
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins);
|
|
10
10
|
const locale = flowBuilderPlugin.getLocale(request.session);
|
|
11
|
-
const localeResolved = flowBuilderPlugin.cmsApi.getLocaleResolved(locale);
|
|
12
11
|
const targetNode = await getTargetNode(flowBuilderPlugin.cmsApi, request);
|
|
13
|
-
const contents = await flowBuilderPlugin.getContentsByNode(targetNode,
|
|
12
|
+
const contents = await flowBuilderPlugin.getContentsByNode(targetNode, locale);
|
|
14
13
|
const handoffContent = contents.find(content => content instanceof FlowHandoff);
|
|
15
14
|
if (handoffContent)
|
|
16
15
|
await handoffContent.doHandoff(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAMlD,MAAM,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAiC;IAG5E,MAAM,CAAC,KAAK,CAAC,WAAW,CACtB,OAAsB;QAEtB,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/D,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/action/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAe,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAMlD,MAAM,OAAO,iBAAkB,SAAQ,KAAK,CAAC,SAAiC;IAG5E,MAAM,CAAC,KAAK,CAAC,WAAW,C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OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,GAAG,CAAC,qBAAqB,CAAA;IAE9E,MAAM,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAA;IAC7C,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
package/lib/esm/api.d.ts
CHANGED
package/lib/esm/api.js
CHANGED
|
@@ -128,7 +128,7 @@ export class FlowBuilderApi {
|
|
|
128
128
|
const payloadJson = JSON.stringify(Object.assign(Object.assign({}, customParams), { followUpId: (_a = botActionNode.follow_up) === null || _a === void 0 ? void 0 : _a.id }));
|
|
129
129
|
return `${payloadNode.content.payload}${SEPARATOR}${payloadJson}`;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
getResolvedLocale(locale) {
|
|
132
132
|
if (this.flow.locales.find(flowLocale => flowLocale === locale)) {
|
|
133
133
|
return locale;
|
|
134
134
|
}
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FlowBuilderApi } from '../../api';
|
|
2
3
|
import { HtWhatsappButtonListNode } from '../hubtype-fields';
|
|
3
4
|
import { ContentFieldsBase } from './../content-fields-base';
|
|
4
5
|
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section';
|
|
@@ -7,6 +8,6 @@ export declare class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
7
8
|
text: string;
|
|
8
9
|
listButtonText: string;
|
|
9
10
|
sections: FlowWhatsappButtonListSection[];
|
|
10
|
-
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string): FlowWhatsappButtonList;
|
|
11
|
+
static fromHubtypeCMS(component: HtWhatsappButtonListNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappButtonList;
|
|
11
12
|
toBotonic(id: string): JSX.Element;
|
|
12
13
|
}
|
|
@@ -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;AACnD,OAAO,KAAK,MAAM,OAAO,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,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAA;AAEnF,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAA7D;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QACT,mBAAc,GAAG,EAAE,CAAA;QACnB,aAAQ,GAAoC,EAAE,CAAA;IAmCvD,CAAC;IAjCC,MAAM,CAAC,cAAc,CACnB,SAAmC,EACnC,MAAc,EACd,MAAsB;QAEtB,MAAM,qBAAqB,GAAG,IAAI,sBAAsB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACtE,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC3C,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC/C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,qBAAqB,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CACzD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,WAAW,CAC9B,CAAA;QACD,qBAAqB,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CACxE,6BAA6B,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACtE,CAAA;QACD,OAAO,qBAAqB,CAAA;IAC9B,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,oBAAC,kBAAkB,IACjB,GAAG,EAAE,EAAE,EACP,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,GACmB,CACvB,CAAA;IACH,CAAC;CACF"}
|
package/lib/esm/index.js
CHANGED
|
@@ -31,8 +31,8 @@ export default class BotonicPluginFlowBuilder {
|
|
|
31
31
|
!request.session.is_first_interaction;
|
|
32
32
|
if (checkUserTextInput) {
|
|
33
33
|
const locale = this.getLocale(request.session);
|
|
34
|
-
const
|
|
35
|
-
const nodeByUserInput = await getNodeByUserInput(this.cmsApi,
|
|
34
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale);
|
|
35
|
+
const nodeByUserInput = await getNodeByUserInput(this.cmsApi, resolvedLocale, request);
|
|
36
36
|
request.input.payload = this.cmsApi.getPayload(nodeByUserInput === null || nodeByUserInput === void 0 ? void 0 : nodeByUserInput.target);
|
|
37
37
|
}
|
|
38
38
|
if (request.input.payload) {
|
|
@@ -41,37 +41,35 @@ export default class BotonicPluginFlowBuilder {
|
|
|
41
41
|
}
|
|
42
42
|
async getContentsByCode(code, locale, prevContents) {
|
|
43
43
|
const node = this.cmsApi.getNodeByCode(code);
|
|
44
|
-
|
|
45
|
-
return await this.getContentsByNode(node, localeResolved, prevContents);
|
|
44
|
+
return await this.getContentsByNode(node, locale, prevContents);
|
|
46
45
|
}
|
|
47
46
|
async getContentsById(id, locale, prevContents) {
|
|
48
47
|
const node = this.cmsApi.getNodeById(id);
|
|
49
|
-
|
|
50
|
-
return await this.getContentsByNode(node, localeResolved, prevContents);
|
|
48
|
+
return await this.getContentsByNode(node, locale, prevContents);
|
|
51
49
|
}
|
|
52
50
|
async getStartContents(locale) {
|
|
53
51
|
const startNode = this.cmsApi.getStartNode();
|
|
54
|
-
|
|
55
|
-
return await this.getContentsByNode(startNode, localeResolved);
|
|
52
|
+
return await this.getContentsByNode(startNode, locale);
|
|
56
53
|
}
|
|
57
54
|
async getContentsByNode(node, locale, prevContents) {
|
|
58
55
|
const contents = prevContents || [];
|
|
59
|
-
const
|
|
60
|
-
const content = this.getFlowContent(node, localeResolved);
|
|
56
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale);
|
|
61
57
|
if (node.type === HtNodeWithContentType.FUNCTION) {
|
|
62
|
-
const targetId = await this.callFunction(node,
|
|
63
|
-
return this.getContentsById(targetId,
|
|
58
|
+
const targetId = await this.callFunction(node, resolvedLocale);
|
|
59
|
+
return this.getContentsById(targetId, resolvedLocale, contents);
|
|
64
60
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
const content = this.getFlowContent(node, resolvedLocale);
|
|
62
|
+
if (content) {
|
|
63
|
+
contents.push(content);
|
|
64
|
+
}
|
|
65
|
+
// TODO: prevent infinite recursive calls
|
|
66
|
+
if (node.follow_up) {
|
|
67
|
+
return this.getContentsById(node.follow_up.id, resolvedLocale, contents);
|
|
71
68
|
}
|
|
72
69
|
return contents;
|
|
73
70
|
}
|
|
74
71
|
getFlowContent(hubtypeContent, locale) {
|
|
72
|
+
const cmsOptions = { hubtypeContent, locale, cmsApi: this.cmsApi };
|
|
75
73
|
switch (hubtypeContent.type) {
|
|
76
74
|
case HtNodeWithContentType.TEXT:
|
|
77
75
|
return FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
@@ -82,7 +80,7 @@ export default class BotonicPluginFlowBuilder {
|
|
|
82
80
|
case HtNodeWithContentType.VIDEO:
|
|
83
81
|
return FlowVideo.fromHubtypeCMS(hubtypeContent, locale);
|
|
84
82
|
case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
85
|
-
return FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale);
|
|
83
|
+
return FlowWhatsappButtonList.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
86
84
|
case HtNodeWithContentType.HANDOFF:
|
|
87
85
|
return FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi);
|
|
88
86
|
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,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,aAAa,CA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,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CACrD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,cAAc,CACjC,CAAA;QACD,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA,EAAE;YACnB,MAAM,IAAI,KAAK,CACb,wDAAwD,cAAc,EAAE,CACzE,CAAA;SACF;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAA;IACzB,CAAC;IAEO,oBAAoB,CAC1B,IAA2B,EAC3B,MAAc;QAEd,IAAI,eAAe,GAAyB,EAAE,CAAA;QAC9C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,QAAQ,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC5C,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;aACtD;YACD,IAAI,MAAM,IAAI,GAAG,EAAE;gBACjB,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,CAAA;aAC5C;SACF;QAED,OAAO,eAAe,CAAA;IACxB,CAAC;IAED,gBAAgB,CAA8B,OAAe;QAC3D,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAA;QACrE,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AAED,cAAc,UAAU,CAAA;AACxB,cAAc,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.4-alpha.0",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@babel/runtime": "^7.23.8",
|
|
53
|
-
"@botonic/react": "0.24.
|
|
53
|
+
"@botonic/react": "0.24.4",
|
|
54
54
|
"axios": "^1.6.5"
|
|
55
55
|
}
|
|
56
56
|
}
|
package/src/action/index.tsx
CHANGED
|
@@ -20,13 +20,12 @@ export class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
|
|
|
20
20
|
): Promise<FlowBuilderActionProps> {
|
|
21
21
|
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
22
22
|
const locale = flowBuilderPlugin.getLocale(request.session)
|
|
23
|
-
const localeResolved = flowBuilderPlugin.cmsApi.getLocaleResolved(locale)
|
|
24
23
|
|
|
25
24
|
const targetNode = await getTargetNode(flowBuilderPlugin.cmsApi, request)
|
|
26
25
|
|
|
27
26
|
const contents = await flowBuilderPlugin.getContentsByNode(
|
|
28
27
|
targetNode,
|
|
29
|
-
|
|
28
|
+
locale
|
|
30
29
|
)
|
|
31
30
|
|
|
32
31
|
const handoffContent = contents.find(
|
package/src/api.ts
CHANGED
|
@@ -204,7 +204,7 @@ export class FlowBuilderApi {
|
|
|
204
204
|
return `${payloadNode.content.payload}${SEPARATOR}${payloadJson}`
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
getResolvedLocale(locale: string): string {
|
|
208
208
|
if (this.flow.locales.find(flowLocale => flowLocale === locale)) {
|
|
209
209
|
return locale
|
|
210
210
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WhatsappButtonListRowProps } from '@botonic/react'
|
|
2
2
|
|
|
3
|
+
import { FlowBuilderApi } from '../../api'
|
|
3
4
|
import { SOURCE_INFO_SEPARATOR } from '../../constants'
|
|
4
5
|
import { ContentFieldsBase } from '../content-fields-base'
|
|
5
6
|
import { HtWhatsappButtonListRow } from '../hubtype-fields'
|
|
@@ -11,12 +12,13 @@ export class FlowWhatsappButtonListRow extends ContentFieldsBase {
|
|
|
11
12
|
|
|
12
13
|
static fromHubtypeCMS(
|
|
13
14
|
component: HtWhatsappButtonListRow,
|
|
14
|
-
locale: string
|
|
15
|
+
locale: string,
|
|
16
|
+
cmsApi: FlowBuilderApi
|
|
15
17
|
): FlowWhatsappButtonListRow {
|
|
16
18
|
const newRow = new FlowWhatsappButtonListRow(component.id)
|
|
17
19
|
newRow.title = this.getTextByLocale(locale, component.text)
|
|
18
20
|
newRow.description = this.getTextByLocale(locale, component.description)
|
|
19
|
-
newRow.targetId = component.target
|
|
21
|
+
newRow.targetId = cmsApi.getPayload(component.target)
|
|
20
22
|
return newRow
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
WhatsappButtonListSectionProps,
|
|
4
4
|
} from '@botonic/react'
|
|
5
5
|
|
|
6
|
+
import { FlowBuilderApi } from '../../api'
|
|
6
7
|
import { HtWhatsappButtonListSection } from '../hubtype-fields'
|
|
7
8
|
import { ContentFieldsBase } from './../content-fields-base'
|
|
8
9
|
import { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'
|
|
@@ -13,12 +14,13 @@ export class FlowWhatsappButtonListSection extends ContentFieldsBase {
|
|
|
13
14
|
|
|
14
15
|
static fromHubtypeCMS(
|
|
15
16
|
component: HtWhatsappButtonListSection,
|
|
16
|
-
locale: string
|
|
17
|
+
locale: string,
|
|
18
|
+
cmsApi: FlowBuilderApi
|
|
17
19
|
): FlowWhatsappButtonListSection {
|
|
18
20
|
const newButton = new FlowWhatsappButtonListSection(component.id)
|
|
19
21
|
newButton.title = this.getTextByLocale(locale, component.title)
|
|
20
22
|
newButton.rows = component.rows.map(row =>
|
|
21
|
-
FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale)
|
|
23
|
+
FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi)
|
|
22
24
|
)
|
|
23
25
|
return newButton
|
|
24
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WhatsappButtonList } from '@botonic/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
+
import { FlowBuilderApi } from '../../api'
|
|
4
5
|
import { HtWhatsappButtonListNode } from '../hubtype-fields'
|
|
5
6
|
import { ContentFieldsBase } from './../content-fields-base'
|
|
6
7
|
import { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'
|
|
@@ -13,7 +14,8 @@ export class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
13
14
|
|
|
14
15
|
static fromHubtypeCMS(
|
|
15
16
|
component: HtWhatsappButtonListNode,
|
|
16
|
-
locale: string
|
|
17
|
+
locale: string,
|
|
18
|
+
cmsApi: FlowBuilderApi
|
|
17
19
|
): FlowWhatsappButtonList {
|
|
18
20
|
const newWhatsappButtonList = new FlowWhatsappButtonList(component.id)
|
|
19
21
|
newWhatsappButtonList.code = component.code
|
|
@@ -26,7 +28,7 @@ export class FlowWhatsappButtonList extends ContentFieldsBase {
|
|
|
26
28
|
component.content.button_text
|
|
27
29
|
)
|
|
28
30
|
newWhatsappButtonList.sections = component.content.sections.map(section =>
|
|
29
|
-
FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale)
|
|
31
|
+
FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi)
|
|
30
32
|
)
|
|
31
33
|
return newWhatsappButtonList
|
|
32
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -74,10 +74,10 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
74
74
|
|
|
75
75
|
if (checkUserTextInput) {
|
|
76
76
|
const locale = this.getLocale(request.session)
|
|
77
|
-
const
|
|
77
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale)
|
|
78
78
|
const nodeByUserInput = await getNodeByUserInput(
|
|
79
79
|
this.cmsApi,
|
|
80
|
-
|
|
80
|
+
resolvedLocale,
|
|
81
81
|
request as unknown as ActionRequest
|
|
82
82
|
)
|
|
83
83
|
request.input.payload = this.cmsApi.getPayload(nodeByUserInput?.target)
|
|
@@ -96,8 +96,7 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
96
96
|
prevContents?: FlowContent[]
|
|
97
97
|
): Promise<FlowContent[]> {
|
|
98
98
|
const node = this.cmsApi.getNodeByCode(code) as HtNodeWithContent
|
|
99
|
-
|
|
100
|
-
return await this.getContentsByNode(node, localeResolved, prevContents)
|
|
99
|
+
return await this.getContentsByNode(node, locale, prevContents)
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
async getContentsById(
|
|
@@ -106,14 +105,12 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
106
105
|
prevContents?: FlowContent[]
|
|
107
106
|
): Promise<FlowContent[]> {
|
|
108
107
|
const node = this.cmsApi.getNodeById(id) as HtNodeWithContent
|
|
109
|
-
|
|
110
|
-
return await this.getContentsByNode(node, localeResolved, prevContents)
|
|
108
|
+
return await this.getContentsByNode(node, locale, prevContents)
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
async getStartContents(locale: string): Promise<FlowContent[]> {
|
|
114
112
|
const startNode = this.cmsApi.getStartNode()
|
|
115
|
-
|
|
116
|
-
return await this.getContentsByNode(startNode, localeResolved)
|
|
113
|
+
return await this.getContentsByNode(startNode, locale)
|
|
117
114
|
}
|
|
118
115
|
|
|
119
116
|
async getContentsByNode(
|
|
@@ -122,18 +119,21 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
122
119
|
prevContents?: FlowContent[]
|
|
123
120
|
): Promise<FlowContent[]> {
|
|
124
121
|
const contents = prevContents || []
|
|
125
|
-
const
|
|
126
|
-
const content = this.getFlowContent(node, localeResolved)
|
|
122
|
+
const resolvedLocale = this.cmsApi.getResolvedLocale(locale)
|
|
127
123
|
|
|
128
124
|
if (node.type === HtNodeWithContentType.FUNCTION) {
|
|
129
|
-
const targetId = await this.callFunction(node,
|
|
130
|
-
return this.getContentsById(targetId,
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
const targetId = await this.callFunction(node, resolvedLocale)
|
|
126
|
+
return this.getContentsById(targetId, resolvedLocale, contents)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const content = this.getFlowContent(node, resolvedLocale)
|
|
130
|
+
if (content) {
|
|
131
|
+
contents.push(content)
|
|
132
|
+
}
|
|
133
|
+
// TODO: prevent infinite recursive calls
|
|
134
|
+
|
|
135
|
+
if (node.follow_up) {
|
|
136
|
+
return this.getContentsById(node.follow_up.id, resolvedLocale, contents)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
return contents
|
|
@@ -143,6 +143,7 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
143
143
|
hubtypeContent: HtNodeComponent,
|
|
144
144
|
locale: string
|
|
145
145
|
): FlowContent | undefined {
|
|
146
|
+
const cmsOptions = { hubtypeContent, locale, cmsApi: this.cmsApi }
|
|
146
147
|
switch (hubtypeContent.type) {
|
|
147
148
|
case HtNodeWithContentType.TEXT:
|
|
148
149
|
return FlowText.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi)
|
|
@@ -153,7 +154,11 @@ export default class BotonicPluginFlowBuilder implements Plugin {
|
|
|
153
154
|
case HtNodeWithContentType.VIDEO:
|
|
154
155
|
return FlowVideo.fromHubtypeCMS(hubtypeContent, locale)
|
|
155
156
|
case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:
|
|
156
|
-
return FlowWhatsappButtonList.fromHubtypeCMS(
|
|
157
|
+
return FlowWhatsappButtonList.fromHubtypeCMS(
|
|
158
|
+
hubtypeContent,
|
|
159
|
+
locale,
|
|
160
|
+
this.cmsApi
|
|
161
|
+
)
|
|
157
162
|
case HtNodeWithContentType.HANDOFF:
|
|
158
163
|
return FlowHandoff.fromHubtypeCMS(hubtypeContent, locale, this.cmsApi)
|
|
159
164
|
default:
|