@botonic/plugin-flow-builder 0.37.0 → 0.37.1-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.
@@ -3,7 +3,7 @@ export declare abstract class ContentFieldsBase {
3
3
  readonly id: string;
4
4
  constructor(id: string);
5
5
  static getTextByLocale(locale: string, text: HtTextLocale[]): string;
6
- static getImageByLocale(locale: string, image: HtMediaFileLocale[]): string;
6
+ static getAssetByLocale(locale: string, asset: HtMediaFileLocale[]): string;
7
7
  static getVideoByLocale(locale: string, video: HtVideoLocale[]): string;
8
8
  static getQueueByLocale(locale: string, queues: HtQueueLocale[]): HtQueueLocale | undefined;
9
9
  }
@@ -10,9 +10,9 @@ class ContentFieldsBase {
10
10
  const result = text.find(t => t.locale === locale);
11
11
  return (_a = result === null || result === void 0 ? void 0 : result.message) !== null && _a !== void 0 ? _a : '';
12
12
  }
13
- static getImageByLocale(locale, image) {
13
+ static getAssetByLocale(locale, asset) {
14
14
  var _a;
15
- const result = image.find(i => i.locale === locale);
15
+ const result = asset.find(i => i.locale === locale);
16
16
  return (_a = result === null || result === void 0 ? void 0 : result.file) !== null && _a !== void 0 ? _a : '';
17
17
  }
18
18
  static getVideoByLocale(locale, video) {
@@ -17,7 +17,7 @@ class FlowElement extends content_fields_base_1.ContentFieldsBase {
17
17
  const newElement = new FlowElement(component.id);
18
18
  newElement.title = this.getTextByLocale(locale, component.title);
19
19
  newElement.subtitle = this.getTextByLocale(locale, component.subtitle);
20
- newElement.image = this.getImageByLocale(locale, component.image);
20
+ newElement.image = this.getAssetByLocale(locale, component.image);
21
21
  newElement.button = flow_button_1.FlowButton.fromHubtypeCMS(component.button, locale, cmsApi);
22
22
  return newElement;
23
23
  }
@@ -13,7 +13,7 @@ class FlowImage extends content_fields_base_1.ContentFieldsBase {
13
13
  static fromHubtypeCMS(component, locale) {
14
14
  const newImage = new FlowImage(component.id);
15
15
  newImage.code = component.code;
16
- newImage.src = this.getImageByLocale(locale, component.content.image);
16
+ newImage.src = this.getAssetByLocale(locale, component.content.image);
17
17
  return newImage;
18
18
  }
19
19
  toBotonic(id) {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react';
2
3
  import { FlowBuilderApi } from '../api';
3
4
  import { ContentFieldsBase } from './content-fields-base';
4
5
  import { HtWhatsappCTAUrlButtonNode } from './hubtype-fields';
@@ -6,9 +7,14 @@ export declare class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
6
7
  code: string;
7
8
  text: string;
8
9
  header?: string;
10
+ headerType?: WhatsappCTAUrlHeaderType;
11
+ headerImage?: string;
12
+ headerVideo?: string;
13
+ headerDocument?: string;
9
14
  footer?: string;
10
15
  displayText: string;
11
16
  url: string;
12
17
  static fromHubtypeCMS(component: HtWhatsappCTAUrlButtonNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappCtaUrlButtonNode;
18
+ private static setHeader;
13
19
  toBotonic(id: string): JSX.Element;
14
20
  }
@@ -17,7 +17,7 @@ class FlowWhatsappCtaUrlButtonNode extends content_fields_base_1.ContentFieldsBa
17
17
  const whatsappCtaUrlButton = new FlowWhatsappCtaUrlButtonNode(component.id);
18
18
  whatsappCtaUrlButton.code = component.code;
19
19
  whatsappCtaUrlButton.text = this.getTextByLocale(locale, component.content.text);
20
- whatsappCtaUrlButton.header = this.getTextByLocale(locale, component.content.header);
20
+ FlowWhatsappCtaUrlButtonNode.setHeader(whatsappCtaUrlButton, component, locale);
21
21
  whatsappCtaUrlButton.footer = this.getTextByLocale(locale, component.content.footer);
22
22
  const button = flow_button_1.FlowButton.fromHubtypeCMS(component.content.button, locale, cmsApi);
23
23
  whatsappCtaUrlButton.displayText = button.text;
@@ -28,8 +28,46 @@ class FlowWhatsappCtaUrlButtonNode extends content_fields_base_1.ContentFieldsBa
28
28
  }
29
29
  return whatsappCtaUrlButton;
30
30
  }
31
+ static setHeader(whatsappCtaUrlButton, component, locale) {
32
+ // If header is set, set header_type to text, this is need to be compatible with the old version of the component
33
+ if (component.content.header.length > 0) {
34
+ component.content.header_type = react_1.WhatsappCTAUrlHeaderType.Text;
35
+ }
36
+ whatsappCtaUrlButton.headerType = component.content
37
+ .header_type;
38
+ if (component.content.header_type === react_1.WhatsappCTAUrlHeaderType.Text) {
39
+ whatsappCtaUrlButton.header = this.getTextByLocale(locale, component.content.header);
40
+ }
41
+ if (component.content.header_type === react_1.WhatsappCTAUrlHeaderType.Image &&
42
+ component.content.header_image) {
43
+ whatsappCtaUrlButton.headerImage = this.getAssetByLocale(locale, component.content.header_image);
44
+ }
45
+ if (component.content.header_type === react_1.WhatsappCTAUrlHeaderType.Video &&
46
+ component.content.header_video) {
47
+ whatsappCtaUrlButton.headerVideo = this.getAssetByLocale(locale, component.content.header_video);
48
+ }
49
+ if (component.content.header_type === react_1.WhatsappCTAUrlHeaderType.Document &&
50
+ component.content.header_document) {
51
+ whatsappCtaUrlButton.headerDocument = this.getAssetByLocale(locale, component.content.header_document);
52
+ }
53
+ }
31
54
  toBotonic(id) {
32
- return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, header: this.header, footer: this.footer, displayText: this.displayText, url: this.url }, id));
55
+ if (this.headerType === react_1.WhatsappCTAUrlHeaderType.Image &&
56
+ this.headerImage) {
57
+ return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerImage: this.headerImage, footer: this.footer, displayText: this.displayText, url: this.url }, id));
58
+ }
59
+ if (this.headerType === react_1.WhatsappCTAUrlHeaderType.Video &&
60
+ this.headerVideo) {
61
+ return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerVideo: this.headerVideo, footer: this.footer, displayText: this.displayText, url: this.url }, id));
62
+ }
63
+ if (this.headerType === react_1.WhatsappCTAUrlHeaderType.Document &&
64
+ this.headerDocument) {
65
+ return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerDocument: this.headerDocument, footer: this.footer, displayText: this.displayText, url: this.url }, id));
66
+ }
67
+ if (this.headerType === react_1.WhatsappCTAUrlHeaderType.Text && this.header) {
68
+ return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, header: this.header, headerType: this.headerType, footer: this.footer, displayText: this.displayText, url: this.url }, id));
69
+ }
70
+ return ((0, jsx_runtime_1.jsx)(react_1.WhatsappCTAUrlButton, { body: this.text, footer: this.footer, displayText: this.displayText, url: this.url }, id));
33
71
  }
34
72
  }
35
73
  exports.FlowWhatsappCtaUrlButtonNode = FlowWhatsappCtaUrlButtonNode;
@@ -1 +1 @@
1
- {"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqD;AAIrD,+DAAyD;AACzD,+CAA0C;AAG1C,MAAa,4BAA6B,SAAQ,uCAAiB;IAAnE;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QAGT,gBAAW,GAAG,EAAE,CAAA;QAChB,QAAG,GAAW,EAAE,CAAA;IA+CzB,CAAC;IA7CC,MAAM,CAAC,cAAc,CACnB,SAAqC,EACrC,MAAc,EACd,MAAsB;QAEtB,MAAM,oBAAoB,GAAG,IAAI,4BAA4B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC3E,oBAAoB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC1C,oBAAoB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC9C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAChD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,MAAM,CACzB,CAAA;QACD,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAChD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,MAAM,CACzB,CAAA;QACD,MAAM,MAAM,GAAG,wBAAU,CAAC,cAAc,CACtC,SAAS,CAAC,OAAO,CAAC,MAAM,EACxB,MAAM,EACN,MAAM,CACP,CAAA;QACD,oBAAoB,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAA;QAC9C,MAAM,KAAK,GAAG,wBAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACnE,IAAI,KAAK,EAAE;YACT,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAY,KAAK,CAAC,CAAA;YACpD,oBAAoB,CAAC,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAA;SAC/C;QACD,OAAO,oBAAoB,CAAA;IAC7B,CAAC;IAED,SAAS,CAAC,EAAU;QAClB,OAAO,CACL,uBAAC,4BAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IALR,EAAE,CAMP,CACH,CAAA;IACH,CAAC;CACF;AArDD,oEAqDC"}
1
+ {"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAA+E;AAI/E,+DAAyD;AACzD,+CAA0C;AAG1C,MAAa,4BAA6B,SAAQ,uCAAiB;IAAnE;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QAOT,gBAAW,GAAG,EAAE,CAAA;QAChB,QAAG,GAAW,EAAE,CAAA;IAmKzB,CAAC;IAjKC,MAAM,CAAC,cAAc,CACnB,SAAqC,EACrC,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M,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IAJR,EAAE,CAKP,CACH,CAAA;IACH,CAAC;CACF;AA7KD,oEA6KC"}
@@ -1,11 +1,16 @@
1
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react';
1
2
  import { HtButton } from './button';
2
- import { HtBaseNode, HtTextLocale } from './common';
3
+ import { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common';
3
4
  import { HtNodeWithContentType } from './node-types';
4
5
  export interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {
5
6
  type: HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON;
6
7
  content: {
7
8
  text: HtTextLocale[];
8
9
  header: HtTextLocale[];
10
+ header_type?: WhatsappCTAUrlHeaderType;
11
+ header_image?: HtMediaFileLocale[];
12
+ header_video?: HtMediaFileLocale[];
13
+ header_document?: HtMediaFileLocale[];
9
14
  footer: HtTextLocale[];
10
15
  button: HtButton;
11
16
  };
@@ -3,7 +3,7 @@ export declare abstract class ContentFieldsBase {
3
3
  readonly id: string;
4
4
  constructor(id: string);
5
5
  static getTextByLocale(locale: string, text: HtTextLocale[]): string;
6
- static getImageByLocale(locale: string, image: HtMediaFileLocale[]): string;
6
+ static getAssetByLocale(locale: string, asset: HtMediaFileLocale[]): string;
7
7
  static getVideoByLocale(locale: string, video: HtVideoLocale[]): string;
8
8
  static getQueueByLocale(locale: string, queues: HtQueueLocale[]): HtQueueLocale | undefined;
9
9
  }
@@ -7,9 +7,9 @@ export class ContentFieldsBase {
7
7
  const result = text.find(t => t.locale === locale);
8
8
  return (_a = result === null || result === void 0 ? void 0 : result.message) !== null && _a !== void 0 ? _a : '';
9
9
  }
10
- static getImageByLocale(locale, image) {
10
+ static getAssetByLocale(locale, asset) {
11
11
  var _a;
12
- const result = image.find(i => i.locale === locale);
12
+ const result = asset.find(i => i.locale === locale);
13
13
  return (_a = result === null || result === void 0 ? void 0 : result.file) !== null && _a !== void 0 ? _a : '';
14
14
  }
15
15
  static getVideoByLocale(locale, video) {
@@ -14,7 +14,7 @@ export class FlowElement extends ContentFieldsBase {
14
14
  const newElement = new FlowElement(component.id);
15
15
  newElement.title = this.getTextByLocale(locale, component.title);
16
16
  newElement.subtitle = this.getTextByLocale(locale, component.subtitle);
17
- newElement.image = this.getImageByLocale(locale, component.image);
17
+ newElement.image = this.getAssetByLocale(locale, component.image);
18
18
  newElement.button = FlowButton.fromHubtypeCMS(component.button, locale, cmsApi);
19
19
  return newElement;
20
20
  }
@@ -10,7 +10,7 @@ export class FlowImage extends ContentFieldsBase {
10
10
  static fromHubtypeCMS(component, locale) {
11
11
  const newImage = new FlowImage(component.id);
12
12
  newImage.code = component.code;
13
- newImage.src = this.getImageByLocale(locale, component.content.image);
13
+ newImage.src = this.getAssetByLocale(locale, component.content.image);
14
14
  return newImage;
15
15
  }
16
16
  toBotonic(id) {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react';
2
3
  import { FlowBuilderApi } from '../api';
3
4
  import { ContentFieldsBase } from './content-fields-base';
4
5
  import { HtWhatsappCTAUrlButtonNode } from './hubtype-fields';
@@ -6,9 +7,14 @@ export declare class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
6
7
  code: string;
7
8
  text: string;
8
9
  header?: string;
10
+ headerType?: WhatsappCTAUrlHeaderType;
11
+ headerImage?: string;
12
+ headerVideo?: string;
13
+ headerDocument?: string;
9
14
  footer?: string;
10
15
  displayText: string;
11
16
  url: string;
12
17
  static fromHubtypeCMS(component: HtWhatsappCTAUrlButtonNode, locale: string, cmsApi: FlowBuilderApi): FlowWhatsappCtaUrlButtonNode;
18
+ private static setHeader;
13
19
  toBotonic(id: string): JSX.Element;
14
20
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { WhatsappCTAUrlButton } from '@botonic/react';
2
+ import { WhatsappCTAUrlButton, WhatsappCTAUrlHeaderType } from '@botonic/react';
3
3
  import { ContentFieldsBase } from './content-fields-base';
4
4
  import { FlowButton } from './flow-button';
5
5
  export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
@@ -14,7 +14,7 @@ export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
14
14
  const whatsappCtaUrlButton = new FlowWhatsappCtaUrlButtonNode(component.id);
15
15
  whatsappCtaUrlButton.code = component.code;
16
16
  whatsappCtaUrlButton.text = this.getTextByLocale(locale, component.content.text);
17
- whatsappCtaUrlButton.header = this.getTextByLocale(locale, component.content.header);
17
+ FlowWhatsappCtaUrlButtonNode.setHeader(whatsappCtaUrlButton, component, locale);
18
18
  whatsappCtaUrlButton.footer = this.getTextByLocale(locale, component.content.footer);
19
19
  const button = FlowButton.fromHubtypeCMS(component.content.button, locale, cmsApi);
20
20
  whatsappCtaUrlButton.displayText = button.text;
@@ -25,8 +25,46 @@ export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
25
25
  }
26
26
  return whatsappCtaUrlButton;
27
27
  }
28
+ static setHeader(whatsappCtaUrlButton, component, locale) {
29
+ // If header is set, set header_type to text, this is need to be compatible with the old version of the component
30
+ if (component.content.header.length > 0) {
31
+ component.content.header_type = WhatsappCTAUrlHeaderType.Text;
32
+ }
33
+ whatsappCtaUrlButton.headerType = component.content
34
+ .header_type;
35
+ if (component.content.header_type === WhatsappCTAUrlHeaderType.Text) {
36
+ whatsappCtaUrlButton.header = this.getTextByLocale(locale, component.content.header);
37
+ }
38
+ if (component.content.header_type === WhatsappCTAUrlHeaderType.Image &&
39
+ component.content.header_image) {
40
+ whatsappCtaUrlButton.headerImage = this.getAssetByLocale(locale, component.content.header_image);
41
+ }
42
+ if (component.content.header_type === WhatsappCTAUrlHeaderType.Video &&
43
+ component.content.header_video) {
44
+ whatsappCtaUrlButton.headerVideo = this.getAssetByLocale(locale, component.content.header_video);
45
+ }
46
+ if (component.content.header_type === WhatsappCTAUrlHeaderType.Document &&
47
+ component.content.header_document) {
48
+ whatsappCtaUrlButton.headerDocument = this.getAssetByLocale(locale, component.content.header_document);
49
+ }
50
+ }
28
51
  toBotonic(id) {
29
- return (_jsx(WhatsappCTAUrlButton, { body: this.text, header: this.header, footer: this.footer, displayText: this.displayText, url: this.url }, id));
52
+ if (this.headerType === WhatsappCTAUrlHeaderType.Image &&
53
+ this.headerImage) {
54
+ return (_jsx(WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerImage: this.headerImage, footer: this.footer, displayText: this.displayText, url: this.url }, id));
55
+ }
56
+ if (this.headerType === WhatsappCTAUrlHeaderType.Video &&
57
+ this.headerVideo) {
58
+ return (_jsx(WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerVideo: this.headerVideo, footer: this.footer, displayText: this.displayText, url: this.url }, id));
59
+ }
60
+ if (this.headerType === WhatsappCTAUrlHeaderType.Document &&
61
+ this.headerDocument) {
62
+ return (_jsx(WhatsappCTAUrlButton, { body: this.text, headerType: this.headerType, headerDocument: this.headerDocument, footer: this.footer, displayText: this.displayText, url: this.url }, id));
63
+ }
64
+ if (this.headerType === WhatsappCTAUrlHeaderType.Text && this.header) {
65
+ return (_jsx(WhatsappCTAUrlButton, { body: this.text, header: this.header, headerType: this.headerType, footer: this.footer, displayText: this.displayText, url: this.url }, id));
66
+ }
67
+ return (_jsx(WhatsappCTAUrlButton, { body: this.text, footer: this.footer, displayText: this.displayText, url: this.url }, id));
30
68
  }
31
69
  }
32
70
  //# sourceMappingURL=flow-whatsapp-cta-url-button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAIrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA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,oBAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IALR,EAAE,CAMP,CACH,CAAA;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"flow-whatsapp-cta-url-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAI/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,MAAM,OAAO,4BAA6B,SAAQ,iBAAiB;IAAnE;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QAOT,gBAAW,GAAG,EAAE,CAAA;QAChB,QAAG,GAAW,EAAE,CAAA;IAmKzB,CAAC;IAjKC,MAAM,CAAC,cAAc,CACnB,SAAqC,EACrC,MAAc,EACd,MAAsB;QAEtB,MAAM,oBAAoB,GAAG,IAAI,4BAA4B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC3E,oBAAoB,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC1C,oBAAoB,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAC9C,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,IAAI,CACvB,CAAA;QACD,4BAA4B,CAAC,SAAS,CACpC,oBAAoB,EACpB,SAAS,EACT,MAAM,CACP,CAAA;QACD,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAChD,MAAM,EACN,SAAS,CAAC,OAAO,CAAC,MAAM,CACzB,CAAA;QACD,MAAM,MAAM,GAAG,UAAU,CAAC,cAAc,CAC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AAC,oBAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IANR,EAAE,CAOP,CACH,CAAA;SACF;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,wBAAwB,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;YACpE,OAAO,CACL,KAAC,oBAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IANR,EAAE,CAOP,CACH,CAAA;SACF;QAED,OAAO,CACL,KAAC,oBAAoB,IAEnB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,IAJR,EAAE,CAKP,CACH,CAAA;IACH,CAAC;CACF"}
@@ -1,11 +1,16 @@
1
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react';
1
2
  import { HtButton } from './button';
2
- import { HtBaseNode, HtTextLocale } from './common';
3
+ import { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common';
3
4
  import { HtNodeWithContentType } from './node-types';
4
5
  export interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {
5
6
  type: HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON;
6
7
  content: {
7
8
  text: HtTextLocale[];
8
9
  header: HtTextLocale[];
10
+ header_type?: WhatsappCTAUrlHeaderType;
11
+ header_image?: HtMediaFileLocale[];
12
+ header_video?: HtMediaFileLocale[];
13
+ header_document?: HtMediaFileLocale[];
9
14
  footer: HtTextLocale[];
10
15
  button: HtButton;
11
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botonic/plugin-flow-builder",
3
- "version": "0.37.0",
3
+ "version": "0.37.1-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",
@@ -14,7 +14,7 @@
14
14
  "lint_core": "../../node_modules/.bin/eslint_d --cache --quiet 'src/**/*.ts*'"
15
15
  },
16
16
  "dependencies": {
17
- "@botonic/react": "^0.37.0",
17
+ "@botonic/react": "0.37.1-alpha.0",
18
18
  "axios": "^1.10.0",
19
19
  "uuid": "^10.0.0"
20
20
  },
@@ -13,8 +13,8 @@ export abstract class ContentFieldsBase {
13
13
  return result?.message ?? ''
14
14
  }
15
15
 
16
- static getImageByLocale(locale: string, image: HtMediaFileLocale[]): string {
17
- const result = image.find(i => i.locale === locale)
16
+ static getAssetByLocale(locale: string, asset: HtMediaFileLocale[]): string {
17
+ const result = asset.find(i => i.locale === locale)
18
18
  return result?.file ?? ''
19
19
  }
20
20
 
@@ -21,7 +21,7 @@ export class FlowElement extends ContentFieldsBase {
21
21
  const newElement = new FlowElement(component.id)
22
22
  newElement.title = this.getTextByLocale(locale, component.title)
23
23
  newElement.subtitle = this.getTextByLocale(locale, component.subtitle)
24
- newElement.image = this.getImageByLocale(locale, component.image)
24
+ newElement.image = this.getAssetByLocale(locale, component.image)
25
25
  newElement.button = FlowButton.fromHubtypeCMS(
26
26
  component.button,
27
27
  locale,
@@ -11,7 +11,7 @@ export class FlowImage extends ContentFieldsBase {
11
11
  static fromHubtypeCMS(component: HtImageNode, locale: string): FlowImage {
12
12
  const newImage = new FlowImage(component.id)
13
13
  newImage.code = component.code
14
- newImage.src = this.getImageByLocale(locale, component.content.image)
14
+ newImage.src = this.getAssetByLocale(locale, component.content.image)
15
15
  return newImage
16
16
  }
17
17
 
@@ -1,4 +1,4 @@
1
- import { WhatsappCTAUrlButton } from '@botonic/react'
1
+ import { WhatsappCTAUrlButton, WhatsappCTAUrlHeaderType } from '@botonic/react'
2
2
  import React from 'react'
3
3
 
4
4
  import { FlowBuilderApi } from '../api'
@@ -10,6 +10,10 @@ export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
10
10
  public code = ''
11
11
  public text = ''
12
12
  public header?: string
13
+ public headerType?: WhatsappCTAUrlHeaderType
14
+ public headerImage?: string
15
+ public headerVideo?: string
16
+ public headerDocument?: string
13
17
  public footer?: string
14
18
  public displayText = ''
15
19
  public url: string = ''
@@ -25,9 +29,10 @@ export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
25
29
  locale,
26
30
  component.content.text
27
31
  )
28
- whatsappCtaUrlButton.header = this.getTextByLocale(
29
- locale,
30
- component.content.header
32
+ FlowWhatsappCtaUrlButtonNode.setHeader(
33
+ whatsappCtaUrlButton,
34
+ component,
35
+ locale
31
36
  )
32
37
  whatsappCtaUrlButton.footer = this.getTextByLocale(
33
38
  locale,
@@ -47,12 +52,127 @@ export class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {
47
52
  return whatsappCtaUrlButton
48
53
  }
49
54
 
55
+ private static setHeader(
56
+ whatsappCtaUrlButton: FlowWhatsappCtaUrlButtonNode,
57
+ component: HtWhatsappCTAUrlButtonNode,
58
+ locale: string
59
+ ) {
60
+ // If header is set, set header_type to text, this is need to be compatible with the old version of the component
61
+ if (component.content.header.length > 0) {
62
+ component.content.header_type = WhatsappCTAUrlHeaderType.Text
63
+ }
64
+
65
+ whatsappCtaUrlButton.headerType = component.content
66
+ .header_type as WhatsappCTAUrlHeaderType
67
+
68
+ if (component.content.header_type === WhatsappCTAUrlHeaderType.Text) {
69
+ whatsappCtaUrlButton.header = this.getTextByLocale(
70
+ locale,
71
+ component.content.header
72
+ )
73
+ }
74
+
75
+ if (
76
+ component.content.header_type === WhatsappCTAUrlHeaderType.Image &&
77
+ component.content.header_image
78
+ ) {
79
+ whatsappCtaUrlButton.headerImage = this.getAssetByLocale(
80
+ locale,
81
+ component.content.header_image
82
+ )
83
+ }
84
+
85
+ if (
86
+ component.content.header_type === WhatsappCTAUrlHeaderType.Video &&
87
+ component.content.header_video
88
+ ) {
89
+ whatsappCtaUrlButton.headerVideo = this.getAssetByLocale(
90
+ locale,
91
+ component.content.header_video
92
+ )
93
+ }
94
+
95
+ if (
96
+ component.content.header_type === WhatsappCTAUrlHeaderType.Document &&
97
+ component.content.header_document
98
+ ) {
99
+ whatsappCtaUrlButton.headerDocument = this.getAssetByLocale(
100
+ locale,
101
+ component.content.header_document
102
+ )
103
+ }
104
+ }
105
+
50
106
  toBotonic(id: string): JSX.Element {
107
+ if (
108
+ this.headerType === WhatsappCTAUrlHeaderType.Image &&
109
+ this.headerImage
110
+ ) {
111
+ return (
112
+ <WhatsappCTAUrlButton
113
+ key={id}
114
+ body={this.text}
115
+ headerType={this.headerType}
116
+ headerImage={this.headerImage}
117
+ footer={this.footer}
118
+ displayText={this.displayText}
119
+ url={this.url}
120
+ />
121
+ )
122
+ }
123
+
124
+ if (
125
+ this.headerType === WhatsappCTAUrlHeaderType.Video &&
126
+ this.headerVideo
127
+ ) {
128
+ return (
129
+ <WhatsappCTAUrlButton
130
+ key={id}
131
+ body={this.text}
132
+ headerType={this.headerType}
133
+ headerVideo={this.headerVideo}
134
+ footer={this.footer}
135
+ displayText={this.displayText}
136
+ url={this.url}
137
+ />
138
+ )
139
+ }
140
+
141
+ if (
142
+ this.headerType === WhatsappCTAUrlHeaderType.Document &&
143
+ this.headerDocument
144
+ ) {
145
+ return (
146
+ <WhatsappCTAUrlButton
147
+ key={id}
148
+ body={this.text}
149
+ headerType={this.headerType}
150
+ headerDocument={this.headerDocument}
151
+ footer={this.footer}
152
+ displayText={this.displayText}
153
+ url={this.url}
154
+ />
155
+ )
156
+ }
157
+
158
+ if (this.headerType === WhatsappCTAUrlHeaderType.Text && this.header) {
159
+ return (
160
+ <WhatsappCTAUrlButton
161
+ key={id}
162
+ body={this.text}
163
+ header={this.header}
164
+ headerType={this.headerType}
165
+ footer={this.footer}
166
+ displayText={this.displayText}
167
+ url={this.url}
168
+ />
169
+ )
170
+ }
171
+
51
172
  return (
52
173
  <WhatsappCTAUrlButton
53
174
  key={id}
54
175
  body={this.text}
55
- header={this.header}
56
176
  footer={this.footer}
57
177
  displayText={this.displayText}
58
178
  url={this.url}
@@ -1,5 +1,7 @@
1
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react'
2
+
1
3
  import { HtButton } from './button'
2
- import { HtBaseNode, HtTextLocale } from './common'
4
+ import { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common'
3
5
  import { HtNodeWithContentType } from './node-types'
4
6
 
5
7
  export interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {
@@ -7,6 +9,10 @@ export interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {
7
9
  content: {
8
10
  text: HtTextLocale[]
9
11
  header: HtTextLocale[]
12
+ header_type?: WhatsappCTAUrlHeaderType
13
+ header_image?: HtMediaFileLocale[]
14
+ header_video?: HtMediaFileLocale[]
15
+ header_document?: HtMediaFileLocale[]
10
16
  footer: HtTextLocale[]
11
17
  button: HtButton
12
18
  }