@botonic/plugin-flow-builder 0.21.0-alpha.5 → 0.21.0-alpha.6

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.
Files changed (138) hide show
  1. package/lib/cjs/action.d.ts +3 -4
  2. package/lib/cjs/action.js +15 -10
  3. package/lib/cjs/action.js.map +1 -1
  4. package/lib/cjs/content-fields/content-fields-base.d.ts +7 -0
  5. package/lib/cjs/content-fields/{content-base.js → content-fields-base.js} +7 -2
  6. package/lib/cjs/content-fields/content-fields-base.js.map +1 -0
  7. package/lib/cjs/content-fields/{button.d.ts → flow-button.d.ts} +3 -3
  8. package/lib/cjs/content-fields/{button.js → flow-button.js} +5 -5
  9. package/lib/cjs/content-fields/flow-button.js.map +1 -0
  10. package/lib/cjs/content-fields/flow-carousel.d.ts +10 -0
  11. package/lib/cjs/content-fields/{carousel.js → flow-carousel.js} +10 -10
  12. package/lib/cjs/content-fields/flow-carousel.js.map +1 -0
  13. package/lib/cjs/content-fields/flow-element.d.ts +11 -0
  14. package/lib/cjs/content-fields/{element.js → flow-element.js} +6 -7
  15. package/lib/cjs/content-fields/flow-element.js.map +1 -0
  16. package/lib/cjs/content-fields/flow-image.d.ts +9 -0
  17. package/lib/cjs/content-fields/{image.js → flow-image.js} +4 -5
  18. package/lib/cjs/content-fields/flow-image.js.map +1 -0
  19. package/lib/cjs/content-fields/flow-text.d.ts +12 -0
  20. package/lib/cjs/content-fields/{text.js → flow-text.js} +8 -8
  21. package/lib/cjs/content-fields/flow-text.js.map +1 -0
  22. package/lib/cjs/content-fields/index.d.ts +7 -0
  23. package/lib/cjs/content-fields/index.js +16 -0
  24. package/lib/cjs/content-fields/index.js.map +1 -0
  25. package/lib/cjs/content-fields/types.d.ts +4 -0
  26. package/lib/cjs/content-fields/types.js +3 -0
  27. package/lib/cjs/content-fields/types.js.map +1 -0
  28. package/lib/cjs/flow-builder-models.d.ts +174 -0
  29. package/lib/cjs/flow-builder-models.js +22 -0
  30. package/lib/cjs/flow-builder-models.js.map +1 -0
  31. package/lib/cjs/functions/conditional-queue-status.d.ts +2 -2
  32. package/lib/cjs/functions/conditional-queue-status.js +15 -2
  33. package/lib/cjs/functions/conditional-queue-status.js.map +1 -1
  34. package/lib/cjs/functions/index.d.ts +1 -1
  35. package/lib/cjs/functions/index.js +3 -1
  36. package/lib/cjs/functions/index.js.map +1 -1
  37. package/lib/cjs/handoff.d.ts +1 -1
  38. package/lib/cjs/handoff.js +11 -15
  39. package/lib/cjs/handoff.js.map +1 -1
  40. package/lib/cjs/index.d.ts +15 -13
  41. package/lib/cjs/index.js +33 -26
  42. package/lib/cjs/index.js.map +1 -1
  43. package/lib/cjs/utils.d.ts +1 -2
  44. package/lib/cjs/utils.js +6 -6
  45. package/lib/cjs/utils.js.map +1 -1
  46. package/lib/esm/action.d.ts +3 -4
  47. package/lib/esm/action.js +14 -10
  48. package/lib/esm/action.js.map +1 -1
  49. package/lib/esm/content-fields/content-fields-base.d.ts +7 -0
  50. package/lib/esm/content-fields/content-fields-base.js +16 -0
  51. package/lib/esm/content-fields/content-fields-base.js.map +1 -0
  52. package/lib/esm/content-fields/{button.d.ts → flow-button.d.ts} +3 -3
  53. package/lib/esm/content-fields/{button.js → flow-button.js} +4 -4
  54. package/lib/esm/content-fields/flow-button.js.map +1 -0
  55. package/lib/esm/content-fields/flow-carousel.d.ts +10 -0
  56. package/lib/esm/content-fields/{carousel.js → flow-carousel.js} +9 -9
  57. package/lib/esm/content-fields/flow-carousel.js.map +1 -0
  58. package/lib/esm/content-fields/flow-element.d.ts +11 -0
  59. package/lib/esm/content-fields/{element.js → flow-element.js} +4 -5
  60. package/lib/esm/content-fields/flow-element.js.map +1 -0
  61. package/lib/esm/content-fields/flow-image.d.ts +9 -0
  62. package/lib/esm/content-fields/{image.js → flow-image.js} +3 -4
  63. package/lib/esm/content-fields/flow-image.js.map +1 -0
  64. package/lib/esm/content-fields/flow-text.d.ts +12 -0
  65. package/lib/esm/content-fields/{text.js → flow-text.js} +4 -4
  66. package/lib/esm/content-fields/flow-text.js.map +1 -0
  67. package/lib/esm/content-fields/index.d.ts +7 -0
  68. package/lib/esm/content-fields/index.js +7 -0
  69. package/lib/esm/content-fields/index.js.map +1 -0
  70. package/lib/esm/content-fields/types.d.ts +4 -0
  71. package/lib/esm/content-fields/types.js +2 -0
  72. package/lib/esm/content-fields/types.js.map +1 -0
  73. package/lib/esm/flow-builder-models.d.ts +174 -0
  74. package/lib/esm/flow-builder-models.js +19 -0
  75. package/lib/esm/flow-builder-models.js.map +1 -0
  76. package/lib/esm/functions/conditional-queue-status.d.ts +2 -2
  77. package/lib/esm/functions/conditional-queue-status.js +15 -2
  78. package/lib/esm/functions/conditional-queue-status.js.map +1 -1
  79. package/lib/esm/functions/index.d.ts +1 -1
  80. package/lib/esm/functions/index.js +3 -1
  81. package/lib/esm/functions/index.js.map +1 -1
  82. package/lib/esm/handoff.d.ts +1 -1
  83. package/lib/esm/handoff.js +12 -16
  84. package/lib/esm/handoff.js.map +1 -1
  85. package/lib/esm/index.d.ts +15 -13
  86. package/lib/esm/index.js +28 -23
  87. package/lib/esm/index.js.map +1 -1
  88. package/lib/esm/utils.d.ts +1 -2
  89. package/lib/esm/utils.js +4 -4
  90. package/lib/esm/utils.js.map +1 -1
  91. package/package.json +1 -1
  92. package/src/action.tsx +17 -16
  93. package/src/content-fields/content-fields-base.ts +15 -0
  94. package/src/content-fields/{button.tsx → flow-button.tsx} +5 -5
  95. package/src/content-fields/flow-carousel.tsx +39 -0
  96. package/src/content-fields/{element.tsx → flow-element.tsx} +8 -6
  97. package/src/content-fields/{image.tsx → flow-image.tsx} +5 -6
  98. package/src/content-fields/{text.tsx → flow-text.tsx} +5 -5
  99. package/src/content-fields/index.ts +7 -0
  100. package/src/content-fields/types.ts +5 -0
  101. package/src/flow-builder-models.ts +220 -0
  102. package/src/functions/conditional-queue-status.ts +24 -2
  103. package/src/functions/index.ts +3 -1
  104. package/src/handoff.ts +18 -17
  105. package/src/index.ts +65 -60
  106. package/src/utils.ts +10 -5
  107. package/lib/cjs/content-fields/button.js.map +0 -1
  108. package/lib/cjs/content-fields/carousel.d.ts +0 -10
  109. package/lib/cjs/content-fields/carousel.js.map +0 -1
  110. package/lib/cjs/content-fields/content-base.d.ts +0 -10
  111. package/lib/cjs/content-fields/content-base.js.map +0 -1
  112. package/lib/cjs/content-fields/element.d.ts +0 -11
  113. package/lib/cjs/content-fields/element.js.map +0 -1
  114. package/lib/cjs/content-fields/image.d.ts +0 -9
  115. package/lib/cjs/content-fields/image.js.map +0 -1
  116. package/lib/cjs/content-fields/text.d.ts +0 -12
  117. package/lib/cjs/content-fields/text.js.map +0 -1
  118. package/lib/cjs/hubtype-models.d.ts +0 -160
  119. package/lib/cjs/hubtype-models.js +0 -50
  120. package/lib/cjs/hubtype-models.js.map +0 -1
  121. package/lib/esm/content-fields/button.js.map +0 -1
  122. package/lib/esm/content-fields/carousel.d.ts +0 -10
  123. package/lib/esm/content-fields/carousel.js.map +0 -1
  124. package/lib/esm/content-fields/content-base.d.ts +0 -10
  125. package/lib/esm/content-fields/content-base.js +0 -11
  126. package/lib/esm/content-fields/content-base.js.map +0 -1
  127. package/lib/esm/content-fields/element.d.ts +0 -11
  128. package/lib/esm/content-fields/element.js.map +0 -1
  129. package/lib/esm/content-fields/image.d.ts +0 -9
  130. package/lib/esm/content-fields/image.js.map +0 -1
  131. package/lib/esm/content-fields/text.d.ts +0 -12
  132. package/lib/esm/content-fields/text.js.map +0 -1
  133. package/lib/esm/hubtype-models.d.ts +0 -160
  134. package/lib/esm/hubtype-models.js +0 -47
  135. package/lib/esm/hubtype-models.js.map +0 -1
  136. package/src/content-fields/carousel.tsx +0 -39
  137. package/src/content-fields/content-base.ts +0 -15
  138. package/src/hubtype-models.ts +0 -200
@@ -1,12 +1,11 @@
1
1
  import { ActionRequest } from '@botonic/react';
2
2
  import React from 'react';
3
- import { FlowContent } from './content-fields/content-base';
4
- import { HtHandoffNode } from './hubtype-models';
3
+ import { FlowContent } from './content-fields';
5
4
  declare type FlowBuilderActionProps = {
6
5
  content?: FlowContent[];
7
- handoffMsg?: HtHandoffNode;
6
+ isHandoff?: boolean;
8
7
  };
9
- export default class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
8
+ export declare class FlowBuilderAction extends React.Component<FlowBuilderActionProps> {
10
9
  static contextType: React.Context<import("@botonic/react").RequestContextInterface>;
11
10
  static botonicInit(request: ActionRequest): Promise<any>;
12
11
  render(): JSX.Element | JSX.Element[];
package/lib/cjs/action.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowBuilderAction = void 0;
3
4
  const tslib_1 = require("tslib");
4
5
  const react_1 = require("@botonic/react");
5
6
  const react_2 = tslib_1.__importDefault(require("react"));
6
7
  const handoff_1 = require("./handoff");
7
8
  class FlowBuilderAction extends react_2.default.Component {
8
9
  static async botonicInit(request) {
9
- console.log(request);
10
10
  const flowBuilderPlugin = request.plugins
11
- .flowBuilder;
11
+ .hubtypeFlowBuilder;
12
12
  const locale = flowBuilderPlugin.getLocale(request.session);
13
13
  let payload = request.input.payload
14
14
  ? request.input.payload
@@ -25,24 +25,29 @@ class FlowBuilderAction extends react_2.default.Component {
25
25
  }
26
26
  // We use only Spanish because they are the backend examples
27
27
  const content = await flowBuilderPlugin.getContents(payload, locale);
28
- if (content.length == 0) {
29
- const handoffMsg = await handoff_1.doHandoff(request);
30
- return { handoffMsg };
28
+ if (content.length === 0) {
29
+ const handoffParams = {
30
+ queue: 'Test',
31
+ agentEmail: 'test@gmail.com',
32
+ note: 'This is a note that will be attached to the case as a reminder',
33
+ };
34
+ await handoff_1.doHandoff(request, handoffParams.queue, handoffParams.note);
35
+ const isHandoff = true;
36
+ return { isHandoff };
31
37
  }
32
38
  return { content };
33
39
  }
34
40
  render() {
35
41
  // @ts-ignore
36
- const { content: contents, handoffMsg } = this.props;
37
- if (handoffMsg) {
38
- // @ts-ignore
39
- return react_2.default.createElement(react_1.Text, null, handoffMsg);
42
+ const { content: contents, isHandoff } = this.props;
43
+ if (isHandoff) {
44
+ return react_2.default.createElement(react_1.Text, null, "You are being transferred to an agent!");
40
45
  }
41
46
  else {
42
47
  return contents.map((content, index) => content.toBotonic(index));
43
48
  }
44
49
  }
45
50
  }
46
- exports.default = FlowBuilderAction;
51
+ exports.FlowBuilderAction = FlowBuilderAction;
47
52
  FlowBuilderAction.contextType = react_1.RequestContext;
48
53
  //# sourceMappingURL=action.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action.tsx"],"names":[],"mappings":";;;AAAA,0CAAoE;AACpE,0DAAyB;AAGzB,uCAAqC;AASrC,MAAqB,iBAAkB,SAAQ,eAAK,CAAC,SAAiC;IAGpF,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAsB;QAC7C,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACpB,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO;aACtC,WAAuC,CAAA;QAE1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAE3D,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO;YACjC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO;YACvB,CAAC,CAAC,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAA;QAExC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE;YAC1B,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,CAC7D,OAAO,CAAC,KAAK,EACb,MAAM,CACP,CAAA;YACD,IAAI,aAAa,EAAE;gBACjB,OAAO,GAAG,aAAa,CAAA;aACxB;YACD,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,mBAAmB,CAChE,OAAO,CAAC,KAAK,EACb,MAAM,CACP,CAAA;YACD,IAAI,cAAc,EAAE;gBAClB,OAAO,GAAG,cAAc,CAAA;aACzB;SACF;QACD,4DAA4D;QAC5D,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE;YACvB,MAAM,UAAU,GAAG,MAAM,mBAAS,CAAC,OAAO,CAAC,CAAA;YAC3C,OAAO,EAAE,UAAU,EAAE,CAAA;SACtB;QACD,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC;IAED,MAAM;QACJ,aAAa;QACb,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QACpD,IAAI,UAAU,EAAE;YACd,aAAa;YACb,OAAO,8BAAC,YAAI,QAAE,UAAU,CAAQ,CAAA;SACjC;aAAM;YACL,OAAO,QAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;SACnE;IACH,CAAC;;AAjDH,oCAkDC;AAjDQ,6BAAW,GAAG,sBAAc,CAAA"}
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/action.tsx"],"names":[],"mappings":";;;;AAAA,0CAAoE;AACpE,0DAAyB;AAGzB,uCAAqC;AAQrC,MAAa,iBAAkB,SAAQ,eAAK,CAAC,SAAiC;IAG5E,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAsB;QAC7C,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO;aACtC,kBAA8C,CAAA;QACjD,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC3D,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO;YACjC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO;YACvB,CAAC,CAAC,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAA;QAExC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE;YAC1B,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,CAC7D,OAAO,CAAC,KAAK,EACb,MAAM,CACP,CAAA;YACD,IAAI,aAAa,EAAE;gBACjB,OAAO,GAAG,aAAa,CAAA;aACxB;YACD,MAAM,cAAc,GAAG,MAAM,iBAAiB,CAAC,mBAAmB,CAChE,OAAO,CAAC,KAAK,EACb,MAAM,CACP,CAAA;YACD,IAAI,cAAc,EAAE;gBAClB,OAAO,GAAG,cAAc,CAAA;aACzB;SACF;QACD,4DAA4D;QAC5D,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,MAAM,aAAa,GAAG;gBACpB,KAAK,EAAE,MAAM;gBACb,UAAU,EAAE,gBAAgB;gBAC5B,IAAI,EAAE,gEAAgE;aACvE,CAAA;YACD,MAAM,mBAAS,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;YACjE,MAAM,SAAS,GAAG,IAAI,CAAA;YACtB,OAAO,EAAE,SAAS,EAAE,CAAA;SACrB;QACD,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC;IAED,MAAM;QACJ,aAAa;QACb,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QACnD,IAAI,SAAS,EAAE;YACb,OAAO,8BAAC,YAAI,iDAA8C,CAAA;SAC3D;aAAM;YACL,OAAO,QAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;SACnE;IACH,CAAC;;AAnDH,8CAoDC;AAnDQ,6BAAW,GAAG,sBAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { MediaFileLocale, TextLocale } from '../flow-builder-models';
2
+ export declare abstract class ContentFieldsBase {
3
+ private readonly id;
4
+ constructor(id: string);
5
+ static getTextByLocale(locale: string, text: TextLocale[]): string;
6
+ static getImageByLocale(locale: string, image: MediaFileLocale[]): string;
7
+ }
@@ -7,9 +7,14 @@ class ContentFieldsBase {
7
7
  }
8
8
  static getTextByLocale(locale, text) {
9
9
  var _a;
10
- const result = text.find(t => t.locale == locale);
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) {
14
+ var _a;
15
+ const result = image.find(t => t.locale === locale);
16
+ return (_a = result === null || result === void 0 ? void 0 : result.file) !== null && _a !== void 0 ? _a : '';
17
+ }
13
18
  }
14
19
  exports.ContentFieldsBase = ContentFieldsBase;
15
- //# sourceMappingURL=content-base.js.map
20
+ //# sourceMappingURL=content-fields-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields-base.js","sourceRoot":"","sources":["../../../src/content-fields/content-fields-base.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IACrC,YAA6B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;IAE3C,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,IAAkB;;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;QAClD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAA;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,MAAc,EAAE,KAAwB;;QAC9D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAA;QACnD,OAAO,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,mCAAI,EAAE,CAAA;IAC3B,CAAC;CACF;AAZD,8CAYC"}
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { ButtonStyle, HtButton } from '../hubtype-models';
3
- import { ContentFieldsBase } from './content-base';
2
+ import { Button as FbButton, ButtonStyle } from '../flow-builder-models';
3
+ import { ContentFieldsBase } from './content-fields-base';
4
4
  export declare class FlowButton extends ContentFieldsBase {
5
5
  text: string;
6
6
  url?: string;
7
7
  payload?: string;
8
- static fromHubtypeCMS(component: HtButton, locale: string): FlowButton;
8
+ static fromHubtypeCMS(component: FbButton, locale: string): FlowButton;
9
9
  renderButton(index: number, buttonStyle: ButtonStyle): JSX.Element;
10
10
  }
@@ -4,9 +4,9 @@ exports.FlowButton = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("@botonic/react");
6
6
  const react_2 = tslib_1.__importDefault(require("react"));
7
- const hubtype_models_1 = require("../hubtype-models");
8
- const content_base_1 = require("./content-base");
9
- class FlowButton extends content_base_1.ContentFieldsBase {
7
+ const flow_builder_models_1 = require("../flow-builder-models");
8
+ const content_fields_base_1 = require("./content-fields-base");
9
+ class FlowButton extends content_fields_base_1.ContentFieldsBase {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.text = '';
@@ -19,7 +19,7 @@ class FlowButton extends content_base_1.ContentFieldsBase {
19
19
  return newButton;
20
20
  }
21
21
  renderButton(index, buttonStyle) {
22
- if (buttonStyle == hubtype_models_1.ButtonStyle.QUICK_REPLY) {
22
+ if (buttonStyle === flow_builder_models_1.ButtonStyle.QUICK_REPLY) {
23
23
  return (react_2.default.createElement(react_1.Reply, { payload: this.payload, key: index }, this.text));
24
24
  }
25
25
  return (
@@ -28,4 +28,4 @@ class FlowButton extends content_base_1.ContentFieldsBase {
28
28
  }
29
29
  }
30
30
  exports.FlowButton = FlowButton;
31
- //# sourceMappingURL=button.js.map
31
+ //# sourceMappingURL=flow-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-button.js","sourceRoot":"","sources":["../../../src/content-fields/flow-button.tsx"],"names":[],"mappings":";;;;AAAA,0CAA8C;AAC9C,0DAAyB;AAEzB,gEAAwE;AACxE,+DAAyD;AAEzD,MAAa,UAAW,SAAQ,uCAAiB;IAAjD;;QACS,SAAI,GAAG,EAAE,CAAA;IA0BlB,CAAC;IAtBC,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,MAAc;;QACvD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC9C,SAAS,CAAC,IAAI,GAAG,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QACnE,SAAS,CAAC,OAAO,GAAG,MAAA,SAAS,CAAC,MAAM,0CAAE,EAAE,CAAA;QACxC,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,YAAY,CAAC,KAAa,EAAE,WAAwB;QAClD,IAAI,WAAW,KAAK,iCAAW,CAAC,WAAW,EAAE;YAC3C,OAAO,CACL,8BAAC,aAAK,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACrC,IAAI,CAAC,IAAI,CACJ,CACT,CAAA;SACF;QACD,OAAO;QACL,aAAa;QACb,8BAAC,cAAM,IAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,IACtC,IAAI,CAAC,IAAI,CACH,CACV,CAAA;IACH,CAAC;CACF;AA3BD,gCA2BC"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { CarouselNode } from '../flow-builder-models';
3
+ import { ContentFieldsBase } from './content-fields-base';
4
+ import { FlowElement } from './flow-element';
5
+ export declare class FlowCarousel extends ContentFieldsBase {
6
+ code: string;
7
+ elements: FlowElement[];
8
+ static fromHubtypeCMS(component: CarouselNode, locale: string): FlowCarousel;
9
+ toBotonic(index: number): JSX.Element;
10
+ }
@@ -4,9 +4,9 @@ exports.FlowCarousel = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("@botonic/react");
6
6
  const react_2 = tslib_1.__importDefault(require("react"));
7
- const content_base_1 = require("./content-base");
8
- const element_1 = require("./element");
9
- class FlowCarousel extends content_base_1.ContentFieldsBase {
7
+ const content_fields_base_1 = require("./content-fields-base");
8
+ const flow_element_1 = require("./flow-element");
9
+ class FlowCarousel extends content_fields_base_1.ContentFieldsBase {
10
10
  constructor() {
11
11
  super(...arguments);
12
12
  this.code = '';
@@ -15,20 +15,20 @@ class FlowCarousel extends content_base_1.ContentFieldsBase {
15
15
  static fromHubtypeCMS(component, locale) {
16
16
  const newCarousel = new FlowCarousel(component.id);
17
17
  newCarousel.code = component.code;
18
- newCarousel.elements = component.content.elements.map(ele => element_1.FlowElement.fromHubtypeCMS(ele, locale));
18
+ newCarousel.elements = component.content.elements.map(element => flow_element_1.FlowElement.fromHubtypeCMS(element, locale));
19
19
  return newCarousel;
20
20
  }
21
21
  toBotonic(index) {
22
- return (react_2.default.createElement(react_1.Carousel, { key: index }, this.elements.map((e, eIndex) => {
22
+ return (react_2.default.createElement(react_1.Carousel, { key: index }, this.elements.map((element, eIndex) => {
23
23
  var _a, _b;
24
24
  return (react_2.default.createElement(react_1.Element, { key: eIndex },
25
- react_2.default.createElement(react_1.Pic, { src: e.image }),
26
- react_2.default.createElement(react_1.Title, { style: '' }, e.title),
27
- react_2.default.createElement(react_1.Subtitle, { style: '' }, e.subtitle),
28
- react_2.default.createElement(react_1.Button, { payload: (_a = e.buttons) === null || _a === void 0 ? void 0 : _a.payload }, (_b = e.buttons) === null || _b === void 0 ? void 0 : _b.text),
25
+ react_2.default.createElement(react_1.Pic, { src: element.image }),
26
+ react_2.default.createElement(react_1.Title, { style: '' }, element.title),
27
+ react_2.default.createElement(react_1.Subtitle, { style: '' }, element.subtitle),
28
+ react_2.default.createElement(react_1.Button, { payload: (_a = element.buttons) === null || _a === void 0 ? void 0 : _a.payload }, (_b = element.buttons) === null || _b === void 0 ? void 0 : _b.text),
29
29
  ","));
30
30
  })));
31
31
  }
32
32
  }
33
33
  exports.FlowCarousel = FlowCarousel;
34
- //# sourceMappingURL=carousel.js.map
34
+ //# sourceMappingURL=flow-carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-carousel.js","sourceRoot":"","sources":["../../../src/content-fields/flow-carousel.tsx"],"names":[],"mappings":";;;;AAAA,0CAAgF;AAChF,0DAAyB;AAGzB,+DAAyD;AACzD,iDAA4C;AAE5C,MAAa,YAAa,SAAQ,uCAAiB;IAAnD;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,aAAQ,GAAkB,EAAE,CAAA;IA6BrC,CAAC;IA3BC,MAAM,CAAC,cAAc,CAAC,SAAuB,EAAE,MAAc;QAC3D,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAClD,WAAW,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QACjC,WAAW,CAAC,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAC9D,0BAAW,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAC5C,CAAA;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,CACL,8BAAC,gBAAQ,IAAC,GAAG,EAAE,KAAK,IACjB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;;YAAC,OAAA,CACtC,8BAAC,eAAO,IAAC,GAAG,EAAE,MAAM;gBAClB,8BAAC,WAAG,IAAC,GAAG,EAAE,OAAO,CAAC,KAAK,GAAI;gBAC3B,8BAAC,aAAK,IAAC,KAAK,EAAC,EAAE,IAAE,OAAO,CAAC,KAAK,CAAS;gBACvC,8BAAC,gBAAQ,IAAC,KAAK,EAAC,EAAE,IAAE,OAAO,CAAC,QAAQ,CAAY;gBAEhD,8BAAC,cAAM,IAAC,OAAO,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAE,OAAO,IACtC,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CACf;oBAED,CACX,CAAA;SAAA,CAAC,CACO,CACZ,CAAA;IACH,CAAC;CACF;AA/BD,oCA+BC"}
@@ -0,0 +1,11 @@
1
+ import { CarouselElementNode } from '../flow-builder-models';
2
+ import { ContentFieldsBase } from './content-fields-base';
3
+ import { FlowButton } from './flow-button';
4
+ export declare class FlowElement extends ContentFieldsBase {
5
+ title: string;
6
+ subtitle: string;
7
+ buttons: FlowButton | undefined;
8
+ image: string;
9
+ hidden: boolean;
10
+ static fromHubtypeCMS(component: CarouselElementNode, locale: string): FlowElement;
11
+ }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowElement = void 0;
4
- const utils_1 = require("../utils");
5
- const button_1 = require("./button");
6
- const content_base_1 = require("./content-base");
7
- class FlowElement extends content_base_1.ContentFieldsBase {
4
+ const content_fields_base_1 = require("./content-fields-base");
5
+ const flow_button_1 = require("./flow-button");
6
+ class FlowElement extends content_fields_base_1.ContentFieldsBase {
8
7
  constructor() {
9
8
  super(...arguments);
10
9
  this.title = '';
@@ -16,10 +15,10 @@ class FlowElement extends content_base_1.ContentFieldsBase {
16
15
  const newElement = new FlowElement(component.id);
17
16
  newElement.title = FlowElement.getTextByLocale(locale, component.title);
18
17
  newElement.subtitle = FlowElement.getTextByLocale(locale, component.subtitle);
19
- newElement.image = utils_1.getImageByLocale(locale, component.image);
20
- newElement.buttons = button_1.FlowButton.fromHubtypeCMS(component.button, locale);
18
+ newElement.image = FlowElement.getImageByLocale(locale, component.image);
19
+ newElement.buttons = flow_button_1.FlowButton.fromHubtypeCMS(component.button, locale);
21
20
  return newElement;
22
21
  }
23
22
  }
24
23
  exports.FlowElement = FlowElement;
25
- //# sourceMappingURL=element.js.map
24
+ //# sourceMappingURL=flow-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-element.js","sourceRoot":"","sources":["../../../src/content-fields/flow-element.tsx"],"names":[],"mappings":";;;AACA,+DAAyD;AACzD,+CAA0C;AAE1C,MAAa,WAAY,SAAQ,uCAAiB;IAAlD;;QACS,UAAK,GAAG,EAAE,CAAA;QACV,aAAQ,GAAG,EAAE,CAAA;QAEb,UAAK,GAAG,EAAE,CAAA;QACV,WAAM,GAAG,KAAK,CAAA;IAgBvB,CAAC;IAdC,MAAM,CAAC,cAAc,CACnB,SAA8B,EAC9B,MAAc;QAEd,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAChD,UAAU,CAAC,KAAK,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QACvE,UAAU,CAAC,QAAQ,GAAG,WAAW,CAAC,eAAe,CAC/C,MAAM,EACN,SAAS,CAAC,QAAQ,CACnB,CAAA;QACD,UAAU,CAAC,KAAK,GAAG,WAAW,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;QACxE,UAAU,CAAC,OAAO,GAAG,wBAAU,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACxE,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AArBD,kCAqBC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ImageNode } from '../flow-builder-models';
3
+ import { ContentFieldsBase } from './content-fields-base';
4
+ export declare class FlowImage extends ContentFieldsBase {
5
+ src: string;
6
+ code: string;
7
+ static fromHubtypeCMS(component: ImageNode, locale: string): FlowImage;
8
+ toBotonic(index: number): JSX.Element;
9
+ }
@@ -4,9 +4,8 @@ exports.FlowImage = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("@botonic/react");
6
6
  const react_2 = tslib_1.__importDefault(require("react"));
7
- const utils_1 = require("../utils");
8
- const content_base_1 = require("./content-base");
9
- class FlowImage extends content_base_1.ContentFieldsBase {
7
+ const content_fields_base_1 = require("./content-fields-base");
8
+ class FlowImage extends content_fields_base_1.ContentFieldsBase {
10
9
  constructor() {
11
10
  super(...arguments);
12
11
  this.src = '';
@@ -15,7 +14,7 @@ class FlowImage extends content_base_1.ContentFieldsBase {
15
14
  static fromHubtypeCMS(component, locale) {
16
15
  const newImage = new FlowImage(component.id);
17
16
  newImage.code = component.code;
18
- newImage.src = utils_1.getImageByLocale(locale, component.content.image);
17
+ newImage.src = this.getImageByLocale(locale, component.content.image);
19
18
  return newImage;
20
19
  }
21
20
  toBotonic(index) {
@@ -23,4 +22,4 @@ class FlowImage extends content_base_1.ContentFieldsBase {
23
22
  }
24
23
  }
25
24
  exports.FlowImage = FlowImage;
26
- //# sourceMappingURL=image.js.map
25
+ //# sourceMappingURL=flow-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-image.js","sourceRoot":"","sources":["../../../src/content-fields/flow-image.tsx"],"names":[],"mappings":";;;;AAAA,0CAAsC;AACtC,0DAAyB;AAGzB,+DAAyD;AAEzD,MAAa,SAAU,SAAQ,uCAAiB;IAAhD;;QACS,QAAG,GAAG,EAAE,CAAA;QACR,SAAI,GAAG,EAAE,CAAA;IAYlB,CAAC;IAVC,MAAM,CAAC,cAAc,CAAC,SAAoB,EAAE,MAAc;QACxD,MAAM,QAAQ,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC5C,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC9B,QAAQ,CAAC,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,8BAAC,aAAK,IAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,GAAI,CAAA;IAC7C,CAAC;CACF;AAdD,8BAcC"}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { ButtonStyle, TextNode } from '../flow-builder-models';
3
+ import { ContentFieldsBase } from './content-fields-base';
4
+ import { FlowButton } from './flow-button';
5
+ export declare class FlowText extends ContentFieldsBase {
6
+ text: string;
7
+ code: string;
8
+ buttons: FlowButton[];
9
+ buttonStyle: ButtonStyle;
10
+ static fromHubtypeCMS(component: TextNode, locale: string): FlowText;
11
+ toBotonic(index: number): JSX.Element;
12
+ }
@@ -4,23 +4,23 @@ exports.FlowText = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = require("@botonic/react");
6
6
  const react_2 = tslib_1.__importDefault(require("react"));
7
- const hubtype_models_1 = require("../hubtype-models");
8
- const button_1 = require("./button");
9
- const content_base_1 = require("./content-base");
10
- class FlowText extends content_base_1.ContentFieldsBase {
7
+ const flow_builder_models_1 = require("../flow-builder-models");
8
+ const content_fields_base_1 = require("./content-fields-base");
9
+ const flow_button_1 = require("./flow-button");
10
+ class FlowText extends content_fields_base_1.ContentFieldsBase {
11
11
  constructor() {
12
12
  super(...arguments);
13
13
  this.text = '';
14
14
  this.code = '';
15
15
  this.buttons = [];
16
- this.buttonStyle = hubtype_models_1.ButtonStyle.BUTTON;
16
+ this.buttonStyle = flow_builder_models_1.ButtonStyle.BUTTON;
17
17
  }
18
18
  static fromHubtypeCMS(component, locale) {
19
19
  const newText = new FlowText(component.id);
20
20
  newText.code = component.code;
21
- newText.buttonStyle = component.content.buttons_style || hubtype_models_1.ButtonStyle.BUTTON;
21
+ newText.buttonStyle = component.content.buttons_style || flow_builder_models_1.ButtonStyle.BUTTON;
22
22
  newText.text = FlowText.getTextByLocale(locale, component.content.text);
23
- newText.buttons = component.content.buttons.map(button => button_1.FlowButton.fromHubtypeCMS(button, locale));
23
+ newText.buttons = component.content.buttons.map(button => flow_button_1.FlowButton.fromHubtypeCMS(button, locale));
24
24
  return newText;
25
25
  }
26
26
  toBotonic(index) {
@@ -30,4 +30,4 @@ class FlowText extends content_base_1.ContentFieldsBase {
30
30
  }
31
31
  }
32
32
  exports.FlowText = FlowText;
33
- //# sourceMappingURL=text.js.map
33
+ //# sourceMappingURL=flow-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-text.js","sourceRoot":"","sources":["../../../src/content-fields/flow-text.tsx"],"names":[],"mappings":";;;;AAAA,0CAAqC;AACrC,0DAAyB;AAEzB,gEAA8D;AAC9D,+DAAyD;AACzD,+CAA0C;AAE1C,MAAa,QAAS,SAAQ,uCAAiB;IAA/C;;QACS,SAAI,GAAG,EAAE,CAAA;QACT,SAAI,GAAG,EAAE,CAAA;QACT,YAAO,GAAiB,EAAE,CAAA;QAC1B,gBAAW,GAAG,iCAAW,CAAC,MAAM,CAAA;IAuBzC,CAAC;IArBC,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,MAAc;QACvD,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAC1C,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;QAC7B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,OAAO,CAAC,aAAa,IAAI,iCAAW,CAAC,MAAM,CAAA;QAC3E,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACvE,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CACvD,wBAAU,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAC1C,CAAA;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,SAAS,CAAC,KAAa;QACrB,OAAO,CACL,8BAAC,YAAI,IAAC,GAAG,EAAE,KAAK;YACb,IAAI,CAAC,IAAI;YACT,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAClC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAC7C,CACI,CACR,CAAA;IACH,CAAC;CACF;AA3BD,4BA2BC"}
@@ -0,0 +1,7 @@
1
+ export { ContentFieldsBase } from './content-fields-base';
2
+ export { FlowButton } from './flow-button';
3
+ export { FlowCarousel } from './flow-carousel';
4
+ export { FlowElement } from './flow-element';
5
+ export { FlowImage } from './flow-image';
6
+ export { FlowText } from './flow-text';
7
+ export type { FlowContent } from './types';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FlowText = exports.FlowImage = exports.FlowElement = exports.FlowCarousel = exports.FlowButton = exports.ContentFieldsBase = void 0;
4
+ var content_fields_base_1 = require("./content-fields-base");
5
+ Object.defineProperty(exports, "ContentFieldsBase", { enumerable: true, get: function () { return content_fields_base_1.ContentFieldsBase; } });
6
+ var flow_button_1 = require("./flow-button");
7
+ Object.defineProperty(exports, "FlowButton", { enumerable: true, get: function () { return flow_button_1.FlowButton; } });
8
+ var flow_carousel_1 = require("./flow-carousel");
9
+ Object.defineProperty(exports, "FlowCarousel", { enumerable: true, get: function () { return flow_carousel_1.FlowCarousel; } });
10
+ var flow_element_1 = require("./flow-element");
11
+ Object.defineProperty(exports, "FlowElement", { enumerable: true, get: function () { return flow_element_1.FlowElement; } });
12
+ var flow_image_1 = require("./flow-image");
13
+ Object.defineProperty(exports, "FlowImage", { enumerable: true, get: function () { return flow_image_1.FlowImage; } });
14
+ var flow_text_1 = require("./flow-text");
15
+ Object.defineProperty(exports, "FlowText", { enumerable: true, get: function () { return flow_text_1.FlowText; } });
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-fields/index.ts"],"names":[],"mappings":";;;AAAA,6DAAyD;AAAhD,wHAAA,iBAAiB,OAAA;AAC1B,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AACnB,iDAA8C;AAArC,6GAAA,YAAY,OAAA;AACrB,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,2CAAwC;AAA/B,uGAAA,SAAS,OAAA;AAClB,yCAAsC;AAA7B,qGAAA,QAAQ,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { FlowCarousel } from './flow-carousel';
2
+ import { FlowImage } from './flow-image';
3
+ import { FlowText } from './flow-text';
4
+ export declare type FlowContent = FlowText | FlowImage | FlowCarousel;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/content-fields/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,174 @@
1
+ export interface FlowBuilderData {
2
+ version: string;
3
+ name: string;
4
+ locales: string[];
5
+ start_node_id?: string;
6
+ ai_model_id?: string;
7
+ nodes: NodeComponent[];
8
+ }
9
+ export declare enum NodeType {
10
+ TEXT = "text",
11
+ IMAGE = "image",
12
+ CAROUSEL = "carousel",
13
+ HANDOFF = "handoff",
14
+ KEYWORD = "keyword",
15
+ INTENT = "intent",
16
+ START_UP = "start-up",
17
+ URL = "url",
18
+ PAYLOAD = "payload",
19
+ FUNCTION = "function"
20
+ }
21
+ export interface BaseNode {
22
+ id: string;
23
+ type: NodeType;
24
+ }
25
+ export interface Meta {
26
+ x: number;
27
+ y: number;
28
+ }
29
+ export interface Node extends BaseNode {
30
+ code: string;
31
+ meta: Meta;
32
+ follow_up?: NodeLink;
33
+ target?: NodeLink;
34
+ }
35
+ export interface NodeLink {
36
+ id: string;
37
+ type: NodeType;
38
+ }
39
+ export interface TextLocale {
40
+ message: string;
41
+ locale: string;
42
+ }
43
+ export declare enum ButtonStyle {
44
+ BUTTON = "button",
45
+ QUICK_REPLY = "quick-reply"
46
+ }
47
+ export interface UrlLocale {
48
+ id: string;
49
+ locale: string;
50
+ }
51
+ export interface PayloadLocale {
52
+ id: string;
53
+ locale: string;
54
+ }
55
+ export interface Button {
56
+ id: string;
57
+ text: TextLocale[];
58
+ target?: NodeLink;
59
+ hidden: string;
60
+ url?: UrlLocale;
61
+ payload?: PayloadLocale;
62
+ }
63
+ export interface TextNodeContent {
64
+ text: TextLocale[];
65
+ buttons_style?: ButtonStyle;
66
+ buttons: Button[];
67
+ }
68
+ export interface TextNode extends Node {
69
+ type: NodeType.TEXT;
70
+ content: TextNodeContent;
71
+ }
72
+ export interface MediaFileLocale {
73
+ id: string;
74
+ file: string;
75
+ locale: string;
76
+ }
77
+ export interface ImageNodeContent {
78
+ image: MediaFileLocale[];
79
+ }
80
+ export interface ImageNode extends Node {
81
+ type: NodeType.IMAGE;
82
+ content: ImageNodeContent;
83
+ }
84
+ export interface CarouselElementNode {
85
+ id: string;
86
+ title: TextLocale[];
87
+ subtitle: TextLocale[];
88
+ image: MediaFileLocale[];
89
+ button: Button;
90
+ }
91
+ export interface CarouselNodeContent {
92
+ elements: CarouselElementNode[];
93
+ }
94
+ export interface CarouselNode extends Node {
95
+ type: NodeType.CAROUSEL;
96
+ content: CarouselNodeContent;
97
+ }
98
+ export interface QueueLocale {
99
+ id: string;
100
+ name: string;
101
+ locale: string;
102
+ }
103
+ export interface HandoffNodeContent {
104
+ message: TextLocale[];
105
+ fail_message: TextLocale[];
106
+ queue: QueueLocale[];
107
+ }
108
+ export interface HandoffNode extends Node {
109
+ type: NodeType.HANDOFF;
110
+ content: HandoffNodeContent;
111
+ }
112
+ export interface InputLocale {
113
+ values: string[];
114
+ locale: string;
115
+ }
116
+ export interface KeywordNodeContent {
117
+ title: TextLocale[];
118
+ keywords: InputLocale[];
119
+ }
120
+ export interface KeywordNode extends Node {
121
+ type: NodeType.KEYWORD;
122
+ content: KeywordNodeContent;
123
+ }
124
+ export interface IntentNodeContent {
125
+ title: TextLocale[];
126
+ intents: InputLocale[];
127
+ confidence: number;
128
+ }
129
+ export interface IntentNode extends Node {
130
+ type: NodeType.INTENT;
131
+ content: IntentNodeContent;
132
+ }
133
+ export interface StartNode extends BaseNode {
134
+ type: NodeType.START_UP;
135
+ target: NodeLink;
136
+ }
137
+ export interface UrlNodeContent {
138
+ url: string;
139
+ }
140
+ export interface UrlNode extends BaseNode {
141
+ type: NodeType.URL;
142
+ content: UrlNodeContent;
143
+ }
144
+ export interface PayloadNodeContent {
145
+ payload: string;
146
+ }
147
+ export interface PayloadNode extends BaseNode {
148
+ type: NodeType.PAYLOAD;
149
+ content: PayloadNodeContent;
150
+ }
151
+ export declare type ArgumentType = number | string | Record<any, any>;
152
+ export interface FunctionNodeArgument {
153
+ type: ArgumentType;
154
+ name: string;
155
+ value: string;
156
+ }
157
+ export interface FunctionNodeArgumentLocale {
158
+ locale: string;
159
+ values: FunctionNodeArgument[];
160
+ }
161
+ export interface FunctionNodeResult {
162
+ result: string;
163
+ target: NodeLink;
164
+ }
165
+ export interface FunctionNodeContent {
166
+ action: string;
167
+ arguments: FunctionNodeArgumentLocale[];
168
+ result_mapping: FunctionNodeResult[];
169
+ }
170
+ export interface FunctionNode extends Node {
171
+ type: NodeType.FUNCTION;
172
+ content: FunctionNodeContent;
173
+ }
174
+ export declare type NodeComponent = TextNode | ImageNode | CarouselNode | HandoffNode | KeywordNode | IntentNode | UrlNode | StartNode | PayloadNode | FunctionNode;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonStyle = exports.NodeType = void 0;
4
+ var NodeType;
5
+ (function (NodeType) {
6
+ NodeType["TEXT"] = "text";
7
+ NodeType["IMAGE"] = "image";
8
+ NodeType["CAROUSEL"] = "carousel";
9
+ NodeType["HANDOFF"] = "handoff";
10
+ NodeType["KEYWORD"] = "keyword";
11
+ NodeType["INTENT"] = "intent";
12
+ NodeType["START_UP"] = "start-up";
13
+ NodeType["URL"] = "url";
14
+ NodeType["PAYLOAD"] = "payload";
15
+ NodeType["FUNCTION"] = "function";
16
+ })(NodeType = exports.NodeType || (exports.NodeType = {}));
17
+ var ButtonStyle;
18
+ (function (ButtonStyle) {
19
+ ButtonStyle["BUTTON"] = "button";
20
+ ButtonStyle["QUICK_REPLY"] = "quick-reply";
21
+ })(ButtonStyle = exports.ButtonStyle || (exports.ButtonStyle = {}));
22
+ //# sourceMappingURL=flow-builder-models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-builder-models.js","sourceRoot":"","sources":["../../src/flow-builder-models.ts"],"names":[],"mappings":";;;AASA,IAAY,QAWX;AAXD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,iCAAqB,CAAA;IACrB,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,uBAAW,CAAA;IACX,+BAAmB,CAAA;IACnB,iCAAqB,CAAA;AACvB,CAAC,EAXW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAWnB;AA6BD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;AAC7B,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB"}
@@ -1,3 +1,3 @@
1
- export declare function conditionalQueueStatus({ queue_id }: {
2
- queue_id: any;
1
+ export declare function conditionalQueueStatus({ queue_id, }: {
2
+ queue_id: string;
3
3
  }): Promise<string>;