@botonic/plugin-flow-builder 0.35.1 → 0.35.2
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/content-fields/flow-button.d.ts +3 -0
- package/lib/cjs/content-fields/flow-button.js +1 -1
- package/lib/cjs/content-fields/flow-button.js.map +1 -1
- package/lib/esm/content-fields/flow-button.d.ts +3 -0
- package/lib/esm/content-fields/flow-button.js +2 -2
- package/lib/esm/content-fields/flow-button.js.map +1 -1
- package/package.json +1 -1
- package/src/content-fields/flow-button.tsx +6 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Webview } from '@botonic/react';
|
|
2
3
|
import { FlowBuilderApi } from '../api';
|
|
3
4
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
5
|
import { HtButton, HtButtonStyle } from './hubtype-fields';
|
|
@@ -6,6 +7,8 @@ export declare class FlowButton extends ContentFieldsBase {
|
|
|
6
7
|
text: string;
|
|
7
8
|
url?: string;
|
|
8
9
|
payload?: string;
|
|
10
|
+
target?: string;
|
|
11
|
+
webview?: Webview;
|
|
9
12
|
static fromHubtypeCMS(cmsButton: HtButton, locale: string, cmsApi: FlowBuilderApi): FlowButton;
|
|
10
13
|
static getUrlId(cmsButton: HtButton, locale: string): string | undefined;
|
|
11
14
|
renderButton(buttonIndex: number, buttonStyle?: HtButtonStyle): JSX.Element;
|
|
@@ -32,7 +32,7 @@ class FlowButton extends content_fields_base_1.ContentFieldsBase {
|
|
|
32
32
|
if (buttonStyle === hubtype_fields_1.HtButtonStyle.QUICK_REPLY) {
|
|
33
33
|
return ((0, jsx_runtime_1.jsx)(react_1.Reply, Object.assign({ payload: this.getButtonPayload(buttonIndex) }, { children: this.text }), this.id));
|
|
34
34
|
}
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)(react_1.Button, Object.assign({ url: this.url, payload: this.getButtonPayload(buttonIndex) }, { children: this.text }), this.id));
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(react_1.Button, Object.assign({ url: this.url, payload: this.getButtonPayload(buttonIndex), target: this.target, webview: this.webview }, { children: this.text }), this.id));
|
|
36
36
|
}
|
|
37
37
|
getButtonPayload(buttonIndex) {
|
|
38
38
|
return this.payload
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAAuD;AAIvD,4CAAoD;AACpD,+DAAyD;AACzD,qDAAqE;AAErE,MAAa,UAAW,SAAQ,uCAAiB;IAAjD;;QACS,SAAI,GAAG,EAAE,CAAA;IAyDlB,CAAC;IAnDC,MAAM,CAAC,cAAc,CACnB,SAAmB,EACnB,MAAc,EACd,MAAsB;QAEtB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAE9C,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC9C,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QAC7D,IAAI,SAAS,CAAC,MAAM,EAAE;YACpB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;SACxD;QAED,IAAI,SAAS,CAAC,GAAG,IAAI,KAAK,EAAE;YAC1B,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAY,KAAK,CAAC,CAAA;YACpD,SAAS,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAA;SACpC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,SAAmB,EAAE,MAAc;;QACjD,OAAO,MAAA,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,0CAAE,EAAE,CAAA;IAC7D,CAAC;IAED,YAAY,CAAC,WAAmB,EAAE,WAA2B;QAC3D,IAAI,WAAW,KAAK,8BAAa,CAAC,WAAW,EAAE;YAC7C,OAAO,CACL,uBAAC,aAAK,kBAAe,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,gBAC7D,IAAI,CAAC,IAAI,KADA,IAAI,CAAC,EAAE,CAEX,CACT,CAAA;SACF;QACD,OAAO,CACL,uBAAC,cAAM,kBAEL,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC3C,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,gBAEpB,IAAI,CAAC,IAAI,KANL,IAAI,CAAC,EAAE,CAOL,CACV,CAAA;IACH,CAAC;IAEO,gBAAgB,CAAC,WAAmB;QAC1C,OAAO,IAAI,CAAC,OAAO;YACjB,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,iCAAqB,GAAG,WAAW,EAAE;YACzD,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;CACF;AA1DD,gCA0DC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { Webview } from '@botonic/react';
|
|
2
3
|
import { FlowBuilderApi } from '../api';
|
|
3
4
|
import { ContentFieldsBase } from './content-fields-base';
|
|
4
5
|
import { HtButton, HtButtonStyle } from './hubtype-fields';
|
|
@@ -6,6 +7,8 @@ export declare class FlowButton extends ContentFieldsBase {
|
|
|
6
7
|
text: string;
|
|
7
8
|
url?: string;
|
|
8
9
|
payload?: string;
|
|
10
|
+
target?: string;
|
|
11
|
+
webview?: Webview;
|
|
9
12
|
static fromHubtypeCMS(cmsButton: HtButton, locale: string, cmsApi: FlowBuilderApi): FlowButton;
|
|
10
13
|
static getUrlId(cmsButton: HtButton, locale: string): string | undefined;
|
|
11
14
|
renderButton(buttonIndex: number, buttonStyle?: HtButtonStyle): JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button, Reply } from '@botonic/react';
|
|
3
3
|
import { SOURCE_INFO_SEPARATOR } from '../constants';
|
|
4
4
|
import { ContentFieldsBase } from './content-fields-base';
|
|
5
|
-
import { HtButtonStyle
|
|
5
|
+
import { HtButtonStyle } from './hubtype-fields';
|
|
6
6
|
export class FlowButton extends ContentFieldsBase {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
@@ -29,7 +29,7 @@ export class FlowButton extends ContentFieldsBase {
|
|
|
29
29
|
if (buttonStyle === HtButtonStyle.QUICK_REPLY) {
|
|
30
30
|
return (_jsx(Reply, Object.assign({ payload: this.getButtonPayload(buttonIndex) }, { children: this.text }), this.id));
|
|
31
31
|
}
|
|
32
|
-
return (_jsx(Button, Object.assign({ url: this.url, payload: this.getButtonPayload(buttonIndex) }, { children: this.text }), this.id));
|
|
32
|
+
return (_jsx(Button, Object.assign({ url: this.url, payload: this.getButtonPayload(buttonIndex), target: this.target, webview: this.webview }, { children: this.text }), this.id));
|
|
33
33
|
}
|
|
34
34
|
getButtonPayload(buttonIndex) {
|
|
35
35
|
return this.payload
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAW,MAAM,gBAAgB,CAAA;AAIvD,OAAO,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AI,CAAC,gBAAgB,CAAC,WAAW,CAAC,gBAC7D,IAAI,CAAC,IAAI,KADA,IAAI,CAAC,EAAE,CAEX,CACT,CAAA;SACF;QACD,OAAO,CACL,KAAC,MAAM,kBAEL,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAC3C,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,gBAEpB,IAAI,CAAC,IAAI,KANL,IAAI,CAAC,EAAE,CAOL,CACV,CAAA;IACH,CAAC;IAEO,gBAAgB,CAAC,WAAmB;QAC1C,OAAO,IAAI,CAAC,OAAO;YACjB,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,qBAAqB,GAAG,WAAW,EAAE;YACzD,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import { Button, Reply } from '@botonic/react'
|
|
1
|
+
import { Button, Reply, Webview } from '@botonic/react'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { FlowBuilderApi } from '../api'
|
|
5
5
|
import { SOURCE_INFO_SEPARATOR } from '../constants'
|
|
6
6
|
import { ContentFieldsBase } from './content-fields-base'
|
|
7
|
-
import {
|
|
8
|
-
HtButton,
|
|
9
|
-
HtButtonStyle,
|
|
10
|
-
HtPayloadNode,
|
|
11
|
-
HtUrlNode,
|
|
12
|
-
} from './hubtype-fields'
|
|
7
|
+
import { HtButton, HtButtonStyle, HtUrlNode } from './hubtype-fields'
|
|
13
8
|
|
|
14
9
|
export class FlowButton extends ContentFieldsBase {
|
|
15
10
|
public text = ''
|
|
16
11
|
public url?: string
|
|
17
12
|
public payload?: string
|
|
13
|
+
public target?: string
|
|
14
|
+
public webview?: Webview
|
|
18
15
|
|
|
19
16
|
static fromHubtypeCMS(
|
|
20
17
|
cmsButton: HtButton,
|
|
@@ -54,6 +51,8 @@ export class FlowButton extends ContentFieldsBase {
|
|
|
54
51
|
key={this.id}
|
|
55
52
|
url={this.url}
|
|
56
53
|
payload={this.getButtonPayload(buttonIndex)}
|
|
54
|
+
target={this.target}
|
|
55
|
+
webview={this.webview}
|
|
57
56
|
>
|
|
58
57
|
{this.text}
|
|
59
58
|
</Button>
|