@botonic/react 0.31.0-alpha.5 → 0.31.0-alpha.7

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 (104) hide show
  1. package/lib/cjs/components/index-types.d.ts +4 -131
  2. package/lib/cjs/components/index.d.ts +7 -1
  3. package/lib/cjs/components/index.js +14 -1
  4. package/lib/cjs/components/index.js.map +1 -1
  5. package/lib/cjs/components/webchat-settings.d.ts +15 -2
  6. package/lib/cjs/components/webchat-settings.js.map +1 -1
  7. package/lib/cjs/components/whatsapp-catalog.d.ts +6 -0
  8. package/lib/cjs/components/whatsapp-catalog.js +25 -0
  9. package/lib/cjs/components/whatsapp-catalog.js.map +1 -0
  10. package/lib/cjs/components/whatsapp-media-carousel.d.ts +46 -0
  11. package/lib/cjs/components/whatsapp-media-carousel.js +40 -0
  12. package/lib/cjs/components/whatsapp-media-carousel.js.map +1 -0
  13. package/lib/cjs/components/whatsapp-product-carousel.d.ts +32 -0
  14. package/lib/cjs/components/whatsapp-product-carousel.js +34 -0
  15. package/lib/cjs/components/whatsapp-product-carousel.js.map +1 -0
  16. package/lib/cjs/components/whatsapp-product-list.d.ts +15 -0
  17. package/lib/cjs/components/whatsapp-product-list.js +26 -0
  18. package/lib/cjs/components/whatsapp-product-list.js.map +1 -0
  19. package/lib/cjs/components/whatsapp-product.d.ts +7 -0
  20. package/lib/cjs/components/whatsapp-product.js +25 -0
  21. package/lib/cjs/components/whatsapp-product.js.map +1 -0
  22. package/lib/cjs/index-types.d.ts +4 -3
  23. package/lib/cjs/index-types.js.map +1 -1
  24. package/lib/cjs/util/functional.d.ts +3 -0
  25. package/lib/cjs/util/functional.js +30 -0
  26. package/lib/cjs/util/functional.js.map +1 -0
  27. package/lib/cjs/util/webchat.d.ts +1 -1
  28. package/lib/cjs/util/webchat.js.map +1 -1
  29. package/lib/cjs/webchat/context/types.d.ts +2 -2
  30. package/lib/cjs/webchat/context/use-webchat.d.ts +2 -1
  31. package/lib/cjs/webchat/context/use-webchat.js +1 -0
  32. package/lib/cjs/webchat/context/use-webchat.js.map +1 -1
  33. package/lib/cjs/webchat/index-types.d.ts +0 -3
  34. package/lib/cjs/webchat/input-panel/textarea.d.ts +2 -2
  35. package/lib/cjs/webchat/input-panel/textarea.js.map +1 -1
  36. package/lib/cjs/webchat/theme/types.d.ts +167 -0
  37. package/lib/cjs/webchat/theme/types.js +3 -0
  38. package/lib/cjs/webchat/theme/types.js.map +1 -0
  39. package/lib/cjs/webchat/webchat.js +3 -5
  40. package/lib/cjs/webchat/webchat.js.map +1 -1
  41. package/lib/cjs/webchat-app.d.ts +3 -2
  42. package/lib/cjs/webchat-app.js.map +1 -1
  43. package/lib/esm/components/index-types.d.ts +4 -131
  44. package/lib/esm/components/index.d.ts +7 -1
  45. package/lib/esm/components/index.js +7 -1
  46. package/lib/esm/components/index.js.map +1 -1
  47. package/lib/esm/components/webchat-settings.d.ts +15 -2
  48. package/lib/esm/components/webchat-settings.js.map +1 -1
  49. package/lib/esm/components/whatsapp-catalog.d.ts +6 -0
  50. package/lib/esm/components/whatsapp-catalog.js +21 -0
  51. package/lib/esm/components/whatsapp-catalog.js.map +1 -0
  52. package/lib/esm/components/whatsapp-media-carousel.d.ts +46 -0
  53. package/lib/esm/components/whatsapp-media-carousel.js +36 -0
  54. package/lib/esm/components/whatsapp-media-carousel.js.map +1 -0
  55. package/lib/esm/components/whatsapp-product-carousel.d.ts +32 -0
  56. package/lib/esm/components/whatsapp-product-carousel.js +30 -0
  57. package/lib/esm/components/whatsapp-product-carousel.js.map +1 -0
  58. package/lib/esm/components/whatsapp-product-list.d.ts +15 -0
  59. package/lib/esm/components/whatsapp-product-list.js +22 -0
  60. package/lib/esm/components/whatsapp-product-list.js.map +1 -0
  61. package/lib/esm/components/whatsapp-product.d.ts +7 -0
  62. package/lib/esm/components/whatsapp-product.js +21 -0
  63. package/lib/esm/components/whatsapp-product.js.map +1 -0
  64. package/lib/esm/index-types.d.ts +4 -3
  65. package/lib/esm/index-types.js.map +1 -1
  66. package/lib/esm/util/functional.d.ts +3 -0
  67. package/lib/esm/util/functional.js +26 -0
  68. package/lib/esm/util/functional.js.map +1 -0
  69. package/lib/esm/util/webchat.d.ts +1 -1
  70. package/lib/esm/util/webchat.js.map +1 -1
  71. package/lib/esm/webchat/context/types.d.ts +2 -2
  72. package/lib/esm/webchat/context/use-webchat.d.ts +2 -1
  73. package/lib/esm/webchat/context/use-webchat.js +1 -0
  74. package/lib/esm/webchat/context/use-webchat.js.map +1 -1
  75. package/lib/esm/webchat/index-types.d.ts +0 -3
  76. package/lib/esm/webchat/input-panel/textarea.d.ts +2 -2
  77. package/lib/esm/webchat/input-panel/textarea.js.map +1 -1
  78. package/lib/esm/webchat/theme/types.d.ts +167 -0
  79. package/lib/esm/webchat/theme/types.js +2 -0
  80. package/lib/esm/webchat/theme/types.js.map +1 -0
  81. package/lib/esm/webchat/webchat.js +1 -3
  82. package/lib/esm/webchat/webchat.js.map +1 -1
  83. package/lib/esm/webchat-app.d.ts +3 -2
  84. package/lib/esm/webchat-app.js.map +1 -1
  85. package/package.json +9 -8
  86. package/src/components/index-types.ts +4 -121
  87. package/src/components/index.ts +22 -1
  88. package/src/components/webchat-settings.tsx +13 -1
  89. package/src/components/whatsapp-catalog.tsx +42 -0
  90. package/src/components/whatsapp-media-carousel.tsx +104 -0
  91. package/src/components/whatsapp-product-carousel.tsx +83 -0
  92. package/src/components/whatsapp-product-list.tsx +56 -0
  93. package/src/components/whatsapp-product.tsx +44 -0
  94. package/src/index-types.ts +8 -6
  95. package/src/util/functional.ts +31 -0
  96. package/src/util/webchat.ts +1 -1
  97. package/src/webchat/context/index.tsx +1 -1
  98. package/src/webchat/context/types.ts +7 -11
  99. package/src/webchat/context/use-webchat.ts +3 -1
  100. package/src/webchat/index-types.ts +0 -4
  101. package/src/webchat/input-panel/textarea.tsx +2 -2
  102. package/src/webchat/theme/types.ts +119 -0
  103. package/src/webchat/webchat.tsx +2 -2
  104. package/src/webchat-app.tsx +7 -8
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { SENDERS } from '../index-types';
3
- import { CoverComponentProps } from '../webchat/index-types';
4
3
  export type MessageType = 'audio' | 'buttonmessage' | 'carousel' | 'custom' | 'document' | 'image' | 'location' | 'text' | 'video';
5
4
  export interface MessageProps {
6
5
  blob?: boolean;
@@ -75,142 +74,16 @@ export interface TitleProps {
75
74
  style: string;
76
75
  }
77
76
  export type SubtitleProps = TitleProps;
78
- export type CustomProp = {
79
- custom?: React.ComponentType;
80
- };
81
- export type EnableProp = {
82
- enable?: boolean;
83
- };
84
- export type ImageProp = {
85
- image?: string;
86
- };
87
- export type PersistentMenuCloseOption = {
88
- closeLabel: string;
89
- };
90
- export type PersistentMenuOption = {
91
- label: string;
92
- } & ButtonProps;
93
- export type StyleProp = {
94
- style?: any;
95
- };
96
- export type PersistentMenuTheme = (PersistentMenuCloseOption | PersistentMenuOption)[];
97
- export interface PersistentMenuProps {
98
- onClick: () => void;
99
- options: any;
77
+ export interface CustomMessageType {
78
+ (props: any): JSX.Element;
79
+ customTypeName: string;
80
+ deserialize(msg: any): JSX.Element;
100
81
  }
101
82
  export type BlockInputOption = {
102
83
  preprocess?: (message: string) => string;
103
84
  match: RegExp[];
104
85
  message: string;
105
86
  };
106
- export interface BlobProps {
107
- blobTick?: boolean;
108
- blobTickStyle?: any;
109
- blobWidth?: string;
110
- imageStyle?: any;
111
- }
112
- export interface CustomMessageType {
113
- (props: any): JSX.Element;
114
- customTypeName: string;
115
- deserialize(msg: any): JSX.Element;
116
- }
117
- export interface ThemeProps extends StyleProp {
118
- coverComponent?: CoverComponentOptions;
119
- mobileBreakpoint?: number;
120
- mobileStyle?: any;
121
- webview?: StyleProp & {
122
- header?: StyleProp;
123
- };
124
- animations?: EnableProp;
125
- intro?: StyleProp & ImageProp & CustomProp;
126
- brand?: {
127
- color?: string;
128
- } & ImageProp;
129
- header?: {
130
- title?: string;
131
- subtitle?: string;
132
- } & ImageProp & StyleProp & CustomProp;
133
- customMessageTypes?: CustomMessageType[];
134
- message?: {
135
- bot?: BlobProps & ImageProp & StyleProp;
136
- agent?: ImageProp;
137
- user?: BlobProps & StyleProp;
138
- customTypes?: CustomMessageType[];
139
- } & StyleProp & {
140
- timestamps?: {
141
- withImage?: boolean;
142
- format: () => string;
143
- } & StyleProp & EnableProp;
144
- };
145
- button?: {
146
- autodisable?: boolean;
147
- disabledstyle?: any;
148
- hoverBackground?: string;
149
- hoverTextColor?: string;
150
- messageType?: 'text' | 'payload';
151
- urlIcon?: ImageProp & EnableProp;
152
- } & StyleProp & CustomProp;
153
- replies?: {
154
- align?: 'left' | 'center' | 'right';
155
- wrap?: 'wrap' | 'nowrap';
156
- };
157
- carousel?: {
158
- arrow?: {
159
- left: CustomProp;
160
- right: CustomProp;
161
- };
162
- enableArrows?: boolean;
163
- };
164
- reply?: StyleProp & CustomProp;
165
- triggerButton?: ImageProp & StyleProp & CustomProp;
166
- notifications?: EnableProp & {
167
- banner?: CustomProp & EnableProp & {
168
- text?: string;
169
- };
170
- triggerButton?: EnableProp;
171
- };
172
- scrollButton?: EnableProp & CustomProp;
173
- markdownStyle?: string;
174
- userInput?: {
175
- attachments?: EnableProp & CustomProp;
176
- blockInputs?: BlockInputOption[];
177
- box?: {
178
- placeholder: string;
179
- } & StyleProp;
180
- emojiPicker?: EnableProp & CustomProp;
181
- menu?: {
182
- darkBackground?: boolean;
183
- } & {
184
- custom?: React.ComponentType<PersistentMenuProps>;
185
- };
186
- menuButton?: CustomProp;
187
- persistentMenu?: PersistentMenuTheme;
188
- sendButton?: EnableProp & CustomProp;
189
- } & EnableProp & StyleProp;
190
- imagePreviewer?: React.ComponentType<ImagePreviewerProps>;
191
- }
192
- interface ImagePreviewerProps {
193
- src: string;
194
- isPreviewerOpened: boolean;
195
- closePreviewer: () => void;
196
- }
197
- export interface CoverComponentOptions {
198
- component: React.ComponentType<CoverComponentProps>;
199
- props?: any;
200
- }
201
- export interface WebchatSettingsProps {
202
- blockInputs?: BlockInputOption[];
203
- enableAnimations?: boolean;
204
- enableAttachments?: boolean;
205
- enableEmojiPicker?: boolean;
206
- enableUserInput?: boolean;
207
- persistentMenu?: PersistentMenuTheme;
208
- theme?: ThemeProps;
209
- user?: {
210
- extra_data?: any;
211
- };
212
- }
213
87
  export type WrappedComponent<Props> = React.FunctionComponent<Props> & {
214
88
  customTypeName: string;
215
89
  };
216
- export {};
@@ -4,6 +4,7 @@ export { Carousel } from './carousel';
4
4
  export { customMessage } from './custom-message';
5
5
  export { Document } from './document';
6
6
  export { Element } from './element';
7
+ export { Handoff } from './handoff';
7
8
  export { Image } from './image';
8
9
  export * from './index-types';
9
10
  export { Location } from './location';
@@ -18,7 +19,12 @@ export { Subtitle } from './subtitle';
18
19
  export { Text } from './text';
19
20
  export { Title } from './title';
20
21
  export { Video } from './video';
21
- export { WebchatSettings } from './webchat-settings';
22
+ export { normalizeWebchatSettings, WebchatSettings, WebchatSettingsProps, } from './webchat-settings';
22
23
  export { WhatsappButtonList, WhatsappButtonListProps, WhatsappButtonListRowProps, WhatsappButtonListSectionProps, } from './whatsapp-button-list';
24
+ export { WhatsappCatalog, WhatsappCatalogProps } from './whatsapp-catalog';
23
25
  export { WhatsappCTAUrlButton, WhatsappCTAUrlButtonProps, } from './whatsapp-cta-url-button';
26
+ export { WhatsappMediaCarousel, WhatsappMediaCarouselProps, } from './whatsapp-media-carousel';
27
+ export { WhatsappProduct } from './whatsapp-product';
28
+ export { WhatsappProductCarousel, WhatsappProductCarouselProps, } from './whatsapp-product-carousel';
29
+ export { ProductItem, WhatsappProductList, WhatsappProductListProps, WhatsappProductListSection, } from './whatsapp-product-list';
24
30
  export { WhatsappTemplate } from './whatsapp-template';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WhatsappTemplate = exports.WhatsappCTAUrlButton = exports.WhatsappButtonList = exports.WebchatSettings = exports.Video = exports.Title = exports.Text = exports.Subtitle = exports.ShareButton = exports.Reply = exports.Raw = exports.Pic = exports.MessageTemplate = exports.Message = exports.Location = exports.Image = exports.Element = exports.Document = exports.customMessage = exports.Carousel = exports.Button = exports.Audio = void 0;
3
+ exports.WhatsappTemplate = exports.WhatsappProductList = exports.WhatsappProductCarousel = exports.WhatsappProduct = exports.WhatsappMediaCarousel = exports.WhatsappCTAUrlButton = exports.WhatsappCatalog = exports.WhatsappButtonList = exports.WebchatSettings = exports.normalizeWebchatSettings = exports.Video = exports.Title = exports.Text = exports.Subtitle = exports.ShareButton = exports.Reply = exports.Raw = exports.Pic = exports.MessageTemplate = exports.Message = exports.Location = exports.Image = exports.Handoff = exports.Element = exports.Document = exports.customMessage = exports.Carousel = exports.Button = exports.Audio = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var audio_1 = require("./audio");
6
6
  Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return audio_1.Audio; } });
@@ -14,6 +14,8 @@ var document_1 = require("./document");
14
14
  Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return document_1.Document; } });
15
15
  var element_1 = require("./element");
16
16
  Object.defineProperty(exports, "Element", { enumerable: true, get: function () { return element_1.Element; } });
17
+ var handoff_1 = require("./handoff");
18
+ Object.defineProperty(exports, "Handoff", { enumerable: true, get: function () { return handoff_1.Handoff; } });
17
19
  var image_1 = require("./image");
18
20
  Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return image_1.Image; } });
19
21
  tslib_1.__exportStar(require("./index-types"), exports);
@@ -41,11 +43,22 @@ Object.defineProperty(exports, "Title", { enumerable: true, get: function () { r
41
43
  var video_1 = require("./video");
42
44
  Object.defineProperty(exports, "Video", { enumerable: true, get: function () { return video_1.Video; } });
43
45
  var webchat_settings_1 = require("./webchat-settings");
46
+ Object.defineProperty(exports, "normalizeWebchatSettings", { enumerable: true, get: function () { return webchat_settings_1.normalizeWebchatSettings; } });
44
47
  Object.defineProperty(exports, "WebchatSettings", { enumerable: true, get: function () { return webchat_settings_1.WebchatSettings; } });
45
48
  var whatsapp_button_list_1 = require("./whatsapp-button-list");
46
49
  Object.defineProperty(exports, "WhatsappButtonList", { enumerable: true, get: function () { return whatsapp_button_list_1.WhatsappButtonList; } });
50
+ var whatsapp_catalog_1 = require("./whatsapp-catalog");
51
+ Object.defineProperty(exports, "WhatsappCatalog", { enumerable: true, get: function () { return whatsapp_catalog_1.WhatsappCatalog; } });
47
52
  var whatsapp_cta_url_button_1 = require("./whatsapp-cta-url-button");
48
53
  Object.defineProperty(exports, "WhatsappCTAUrlButton", { enumerable: true, get: function () { return whatsapp_cta_url_button_1.WhatsappCTAUrlButton; } });
54
+ var whatsapp_media_carousel_1 = require("./whatsapp-media-carousel");
55
+ Object.defineProperty(exports, "WhatsappMediaCarousel", { enumerable: true, get: function () { return whatsapp_media_carousel_1.WhatsappMediaCarousel; } });
56
+ var whatsapp_product_1 = require("./whatsapp-product");
57
+ Object.defineProperty(exports, "WhatsappProduct", { enumerable: true, get: function () { return whatsapp_product_1.WhatsappProduct; } });
58
+ var whatsapp_product_carousel_1 = require("./whatsapp-product-carousel");
59
+ Object.defineProperty(exports, "WhatsappProductCarousel", { enumerable: true, get: function () { return whatsapp_product_carousel_1.WhatsappProductCarousel; } });
60
+ var whatsapp_product_list_1 = require("./whatsapp-product-list");
61
+ Object.defineProperty(exports, "WhatsappProductList", { enumerable: true, get: function () { return whatsapp_product_list_1.WhatsappProductList; } });
49
62
  var whatsapp_template_1 = require("./whatsapp-template");
50
63
  Object.defineProperty(exports, "WhatsappTemplate", { enumerable: true, get: function () { return whatsapp_template_1.WhatsappTemplate; } });
51
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;AAAA,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,mDAAg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AAA5B,oGAAA,QAAQ,OAAA;AACjB,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA;AACxB,yDAA8B;AAC9B,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,+CAA4C;AAAnC,2GAAA,WAAW,OAAA;AACpB,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,iCAA+B;AAAtB,8FAAA,KAAK,OAAA;AACd,uDAI2B;AAHzB,4HAAA,wBAAwB,OAAA;AACxB,mHAAA,eAAe,OAAA;AAGjB,+DAK+B;AAJ7B,0HAAA,kBAAkB,OAAA;AAKpB,uDAA0E;AAAjE,mHAAA,eAAe,OAAA;AACxB,qEAGkC;AAFhC,+HAAA,oBAAoB,OAAA;AAGtB,qEAGkC;AAFhC,gIAAA,qBAAqB,OAAA;AAGvB,uDAAoD;AAA3C,mHAAA,eAAe,OAAA;AACxB,yEAGoC;AAFlC,oIAAA,uBAAuB,OAAA;AAGzB,iEAKgC;AAH9B,4HAAA,mBAAmB,OAAA;AAIrB,yDAAsD;AAA7C,qHAAA,gBAAgB,OAAA"}
@@ -1,3 +1,16 @@
1
- import { WebchatSettingsProps } from './index-types';
1
+ import { PersistentMenuOptionsTheme, ThemeProps } from '../webchat/theme/types';
2
+ import { BlockInputOption } from './index-types';
3
+ export interface WebchatSettingsProps {
4
+ blockInputs?: BlockInputOption[];
5
+ enableAnimations?: boolean;
6
+ enableAttachments?: boolean;
7
+ enableEmojiPicker?: boolean;
8
+ enableUserInput?: boolean;
9
+ persistentMenu?: PersistentMenuOptionsTheme;
10
+ theme?: ThemeProps;
11
+ user?: {
12
+ extra_data?: any;
13
+ };
14
+ }
2
15
  export declare const WebchatSettings: ({ theme, blockInputs, persistentMenu, enableEmojiPicker, enableAttachments, enableUserInput, enableAnimations, user, }: WebchatSettingsProps) => any;
3
- export declare const normalizeWebchatSettings: (settings: WebchatSettingsProps) => import("./index-types").ThemeProps;
16
+ export declare const normalizeWebchatSettings: (settings: WebchatSettingsProps) => ThemeProps;
@@ -1 +1 @@
1
- {"version":3,"file":"webchat-settings.js","sourceRoot":"","sources":["../../../src/components/webchat-settings.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AACrC,iCAAyC;AAEzC,yCAA+C;AAC/C,2CAAoD;AACpD,gDAAmD;AAG5C,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,IAAI,GACiB,EAAE,EAAE;IACzB,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,sDAAsD;QACtD,MAAM,EAAE,wBAAwB,EAAE,GAAG,IAAA,kBAAU,EAAC,wBAAc,CAAC,CAAA;QAC/D,wBAAwB,CAAC;YACvB,KAAK;YACL,WAAW;YACX,cAAc;YACd,iBAAiB;YACjB,iBAAiB;YACjB,eAAe;YACf,gBAAgB;SACjB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;IACD,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,MAAM,YAAY,GAAG,IAAA,gCAAwB,EAAC;YAC5C,KAAK;YACL,WAAW;YACX,cAAc;YACd,iBAAiB;YACjB,iBAAiB;YACjB,eAAe;YACf,gBAAgB;SACjB,CAAC,CAAA;QACF,OAAO;QACL,YAAY;QACZ,oCACE,IAAI,EAAE,YAAK,CAAC,gBAAgB,EAC5B,QAAQ,EAAE,IAAA,4BAAmB,EAAC,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,GAC5D,CACH,CAAA;IACH,CAAC,CAAA;IACD,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa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AAC,MAAM,GAAG,gBAAgB,CAAA;KAC3C;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAjCY,QAAA,wBAAwB,4BAiCpC"}
1
+ {"version":3,"file":"webchat-settings.js","sourceRoot":"","sources":["../../../src/components/webchat-settings.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AACrC,iCAAyC;AAEzC,yCAA+C;AAC/C,2CAAoD;AACpD,gDAAmD;AAe5C,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,IAAI,GACiB,EAAE,EAAE;IACzB,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,sDAAsD;QACtD,MAAM,EAAE,wBAAwB,EAAE,GAAG,IAAA,kBAAU,EAAC,wBAAc,CAAC,CAAA;QAC/D,wBAAwB,CAAC;YACvB,KAAK;YACL,WAAW;YACX,cAAc;YACd,iBAAiB;YACjB,iBAAiB;YACjB,eAAe;YACf,gBAAgB;SACjB,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;IACD,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,MAAM,YAAY,GAAG,IAAA,gCAAwB,EAAC;YAC5C,KAAK;YACL,WAAW;YACX,cAAc;YACd,iBAAiB;YACjB,iBAAiB;YACjB,eAAe;YACf,gBAAgB;SACjB,CAAC,CAAA;QACF,OAAO;QACL,YAAY;QACZ,oCACE,IAAI,EAAE,YAAK,CAAC,gBAAgB,EAC5B,QAAQ,EAAE,IAAA,4BAAmB,EAAC,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,GAC5D,CACH,CAAA;IACH,CAAC,CAAA;IACD,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AA3CY,QAAA,eAAe,mBA2C3B;AAEM,MAAM,wBAAwB,GAAG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iCpC"}
@@ -0,0 +1,6 @@
1
+ export interface WhatsappCatalogProps {
2
+ body: string;
3
+ footer?: string;
4
+ thumbnailProductId?: string;
5
+ }
6
+ export declare const WhatsappCatalog: (props: WhatsappCatalogProps) => any;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsappCatalog = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const react_1 = require("../util/react");
7
+ const message_1 = require("./message");
8
+ const serialize = (message) => {
9
+ return { text: message };
10
+ };
11
+ const WhatsappCatalog = (props) => {
12
+ const renderBrowser = () => {
13
+ // Return a dummy message for browser
14
+ const message = `WhatsApp Catalog would be sent to the user.`;
15
+ return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
16
+ };
17
+ const renderNode = () => {
18
+ return (
19
+ // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
20
+ (0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { body: props.body, footer: props.footer, thumbnailProductId: props.thumbnailProductId, type: core_1.INPUT.WHATSAPP_CATALOG })));
21
+ };
22
+ return (0, react_1.renderComponent)({ renderBrowser, renderNode });
23
+ };
24
+ exports.WhatsappCatalog = WhatsappCatalog;
25
+ //# sourceMappingURL=whatsapp-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-catalog.js","sourceRoot":"","sources":["../../../src/components/whatsapp-catalog.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,yCAA+C;AAC/C,uCAAmC;AAQnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAEM,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,6CAA6C,CAAA;QAC7D,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,IAAI,EAAE,YAAK,CAAC,gBAAgB,IAC5B,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AAzBY,QAAA,eAAe,mBAyB3B"}
@@ -0,0 +1,46 @@
1
+ type Parameters = TextParameter | CurrencyParameter | DateTimeParameter;
2
+ interface TextParameter {
3
+ type: 'text';
4
+ text: string;
5
+ }
6
+ interface CurrencyParameter {
7
+ type: 'currency';
8
+ currency: {
9
+ fallbackValue: string;
10
+ code: string;
11
+ amount1000: number;
12
+ };
13
+ }
14
+ interface DateTimeParameter {
15
+ type: 'date_time';
16
+ dateTime: {
17
+ fallbackValue: string;
18
+ };
19
+ }
20
+ type CardButton = QuickReplyButton | UrlButton;
21
+ interface Button {
22
+ type: 'quick_reply' | 'url';
23
+ buttonIndex?: number;
24
+ }
25
+ interface QuickReplyButton extends Button {
26
+ payload: string;
27
+ }
28
+ interface UrlButton extends Button {
29
+ urlVariable: string;
30
+ }
31
+ interface Card {
32
+ fileType: 'image' | 'video';
33
+ fileId: string;
34
+ cardIndex?: number;
35
+ bodyParameters?: Parameters[];
36
+ buttons?: CardButton[];
37
+ extraComponents?: Record<string, any>[];
38
+ }
39
+ export interface WhatsappMediaCarouselProps {
40
+ templateName: string;
41
+ templateLanguage: string;
42
+ cards: Card[];
43
+ bodyParameters?: Parameters[];
44
+ }
45
+ export declare const WhatsappMediaCarousel: (props: WhatsappMediaCarouselProps) => any;
46
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsappMediaCarousel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const functional_1 = require("../util/functional");
7
+ const react_1 = require("../util/react");
8
+ const message_1 = require("./message");
9
+ const serialize = (message) => {
10
+ return { text: message };
11
+ };
12
+ const WhatsappMediaCarousel = (props) => {
13
+ const renderBrowser = () => {
14
+ // Return a dummy message for browser
15
+ const message = `WhatsApp Media Carousel would be sent to the user.`;
16
+ return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
17
+ };
18
+ const getCards = (cards) => {
19
+ cards.forEach((card, index) => {
20
+ var _a;
21
+ if (!card.cardIndex) {
22
+ card.cardIndex = index;
23
+ }
24
+ (_a = card.buttons) === null || _a === void 0 ? void 0 : _a.forEach((button, index) => {
25
+ if (!button.buttonIndex) {
26
+ button.buttonIndex = index;
27
+ }
28
+ });
29
+ });
30
+ return (0, functional_1.toSnakeCaseKeys)(cards);
31
+ };
32
+ const renderNode = () => {
33
+ return (
34
+ // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
35
+ (0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { bodyParameters: JSON.stringify((0, functional_1.toSnakeCaseKeys)(props.bodyParameters)), cards: JSON.stringify(getCards(props.cards)), templateName: props.templateName, templateLanguage: props.templateLanguage, type: core_1.INPUT.WHATSAPP_MEDIA_CAROUSEL })));
36
+ };
37
+ return (0, react_1.renderComponent)({ renderBrowser, renderNode });
38
+ };
39
+ exports.WhatsappMediaCarousel = WhatsappMediaCarousel;
40
+ //# sourceMappingURL=whatsapp-media-carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-media-carousel.js","sourceRoot":"","sources":["../../../src/components/whatsapp-media-carousel.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,mDAAoD;AACpD,yCAA+C;AAC/C,uCAAmC;AAsDnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAEM,MAAM,qBAAqB,GAAG,CAAC,KAAiC,EAAE,EAAE;IACzE,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,oDAAoD,CAAA;QACpE,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;;YAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;aACvB;YACD,MAAA,IAAI,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBACtC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;oBACvB,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;iBAC3B;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,OAAO,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAA,4BAAe,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EACrE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,IAAI,EAAE,YAAK,CAAC,uBAAuB,IACnC,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AAxCY,QAAA,qBAAqB,yBAwCjC"}
@@ -0,0 +1,32 @@
1
+ type Parameters = TextParameter | CurrencyParameter | DateTimeParameter;
2
+ interface TextParameter {
3
+ type: 'text';
4
+ text: string;
5
+ }
6
+ interface CurrencyParameter {
7
+ type: 'currency';
8
+ currency: {
9
+ fallbackValue: string;
10
+ code: string;
11
+ amount1000: number;
12
+ };
13
+ }
14
+ interface DateTimeParameter {
15
+ type: 'date_time';
16
+ dateTime: {
17
+ fallbackValue: string;
18
+ };
19
+ }
20
+ interface Card {
21
+ productRetailerId: string;
22
+ catalogId: string;
23
+ cardIndex?: number;
24
+ }
25
+ export interface WhatsappProductCarouselProps {
26
+ templateName: string;
27
+ templateLanguage: string;
28
+ cards: Card[];
29
+ bodyParameters?: Parameters[];
30
+ }
31
+ export declare const WhatsappProductCarousel: (props: WhatsappProductCarouselProps) => any;
32
+ export {};
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsappProductCarousel = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const functional_1 = require("../util/functional");
7
+ const react_1 = require("../util/react");
8
+ const message_1 = require("./message");
9
+ const serialize = (message) => {
10
+ return { text: message };
11
+ };
12
+ const WhatsappProductCarousel = (props) => {
13
+ const renderBrowser = () => {
14
+ // Return a dummy message for browser
15
+ const message = `WhatsApp Product Carousel would be sent to the user.`;
16
+ return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
17
+ };
18
+ const getCards = (cards) => {
19
+ cards.forEach((card, index) => {
20
+ if (!card.cardIndex) {
21
+ card.cardIndex = index;
22
+ }
23
+ });
24
+ return (0, functional_1.toSnakeCaseKeys)(cards);
25
+ };
26
+ const renderNode = () => {
27
+ return (
28
+ // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
29
+ (0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { bodyParameters: JSON.stringify((0, functional_1.toSnakeCaseKeys)(props.bodyParameters)), cards: JSON.stringify(getCards(props.cards)), templateName: props.templateName, templateLanguage: props.templateLanguage, type: core_1.INPUT.WHATSAPP_PRODUCT_CAROUSEL })));
30
+ };
31
+ return (0, react_1.renderComponent)({ renderBrowser, renderNode });
32
+ };
33
+ exports.WhatsappProductCarousel = WhatsappProductCarousel;
34
+ //# sourceMappingURL=whatsapp-product-carousel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-product-carousel.js","sourceRoot":"","sources":["../../../src/components/whatsapp-product-carousel.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,mDAAoD;AACpD,yCAA+C;AAC/C,uCAAmC;AAoCnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAEM,MAAM,uBAAuB,GAAG,CACrC,KAAmC,EACnC,EAAE;IACF,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,sDAAsD,CAAA;QACtE,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YAC5B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;aACvB;QACH,CAAC,CAAC,CAAA;QACF,OAAO,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAA;IAC/B,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAA,4BAAe,EAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EACrE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,IAAI,EAAE,YAAK,CAAC,yBAAyB,IACrC,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AArCY,QAAA,uBAAuB,2BAqCnC"}
@@ -0,0 +1,15 @@
1
+ export interface ProductItem {
2
+ productRetailerId: string;
3
+ }
4
+ export interface WhatsappProductListSection {
5
+ title: string;
6
+ productItems: ProductItem[];
7
+ }
8
+ export interface WhatsappProductListProps {
9
+ body: string;
10
+ header: string;
11
+ catalogId: string;
12
+ sections: WhatsappProductListSection[];
13
+ footer?: string;
14
+ }
15
+ export declare const WhatsappProductList: (props: WhatsappProductListProps) => any;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsappProductList = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const functional_1 = require("../util/functional");
7
+ const react_1 = require("../util/react");
8
+ const message_1 = require("./message");
9
+ const serialize = (message) => {
10
+ return { text: message };
11
+ };
12
+ const WhatsappProductList = (props) => {
13
+ const renderBrowser = () => {
14
+ // Return a dummy message for browser
15
+ const message = `WhatsApp Product List would be sent to the user.`;
16
+ return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
17
+ };
18
+ const renderNode = () => {
19
+ return (
20
+ // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
21
+ (0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { body: props.body, footer: props.footer, header: props.header, sections: JSON.stringify((0, functional_1.toSnakeCaseKeys)(props.sections)), catalogId: props.catalogId, type: core_1.INPUT.WHATSAPP_PRODUCT_LIST })));
22
+ };
23
+ return (0, react_1.renderComponent)({ renderBrowser, renderNode });
24
+ };
25
+ exports.WhatsappProductList = WhatsappProductList;
26
+ //# sourceMappingURL=whatsapp-product-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-product-list.js","sourceRoot":"","sources":["../../../src/components/whatsapp-product-list.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,mDAAoD;AACpD,yCAA+C;AAC/C,uCAAmC;AAmBnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAEM,MAAM,mBAAmB,GAAG,CAAC,KAA+B,EAAE,EAAE;IACrE,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,kDAAkD,CAAA;QAClE,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAA,4BAAe,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EACzD,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,YAAK,CAAC,qBAAqB,IACjC,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AA3BY,QAAA,mBAAmB,uBA2B/B"}
@@ -0,0 +1,7 @@
1
+ export interface WhatsappProductProps {
2
+ body: string;
3
+ catalogId: string;
4
+ productId: string;
5
+ footer?: string;
6
+ }
7
+ export declare const WhatsappProduct: (props: WhatsappProductProps) => any;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WhatsappProduct = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const core_1 = require("@botonic/core");
6
+ const react_1 = require("../util/react");
7
+ const message_1 = require("./message");
8
+ const serialize = (message) => {
9
+ return { text: message };
10
+ };
11
+ const WhatsappProduct = (props) => {
12
+ const renderBrowser = () => {
13
+ // Return a dummy message for browser
14
+ const message = `WhatsApp Product would be sent to the user.`;
15
+ return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ json: serialize(message) }, props, { type: core_1.INPUT.TEXT }, { children: message })));
16
+ };
17
+ const renderNode = () => {
18
+ return (
19
+ // @ts-ignore Property 'message' does not exist on type 'JSX.IntrinsicElements'.
20
+ (0, jsx_runtime_1.jsx)("message", Object.assign({}, props, { body: props.body, footer: props.footer, catalogId: props.catalogId, productId: props.productId, type: core_1.INPUT.WHATSAPP_PRODUCT })));
21
+ };
22
+ return (0, react_1.renderComponent)({ renderBrowser, renderNode });
23
+ };
24
+ exports.WhatsappProduct = WhatsappProduct;
25
+ //# sourceMappingURL=whatsapp-product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsapp-product.js","sourceRoot":"","sources":["../../../src/components/whatsapp-product.tsx"],"names":[],"mappings":";;;;AAAA,wCAAqC;AAGrC,yCAA+C;AAC/C,uCAAmC;AASnC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,EAAE;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAEM,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,qCAAqC;QACrC,MAAM,OAAO,GAAG,6CAA6C,CAAA;QAC7D,OAAO,CACL,uBAAC,iBAAO,kBAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAM,KAAK,IAAE,IAAI,EAAE,YAAK,CAAC,IAAI,gBAC3D,OAAO,IACA,CACX,CAAA;IACH,CAAC,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,OAAO;QACL,gFAAgF;QAChF,oDACM,KAAK,IACT,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,IAAI,EAAE,YAAK,CAAC,gBAAgB,IAC5B,CACH,CAAA;IACH,CAAC,CAAA;IAED,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AA1BY,QAAA,eAAe,mBA0B3B"}
@@ -1,8 +1,9 @@
1
1
  import { BotRequest as CoreBotRequest, Input as CoreInput, InputType as CoreInputType, Plugin as CorePlugin, Route as CoreRoute, Routes as CoreRoutes, ServerConfig, Session as CoreSession, SessionUser as CoreSessionUser } from '@botonic/core';
2
2
  import React from 'react';
3
- import { BlockInputOption, ButtonProps, CoverComponentOptions, PersistentMenuTheme, ReplyProps, ThemeProps, WebchatSettingsProps } from './components/index-types';
3
+ import { BlockInputOption, ButtonProps, ReplyProps, WebchatSettingsProps } from './components';
4
4
  import { CloseWebviewOptions } from './contexts';
5
5
  import { UseWebchat } from './webchat/context/use-webchat';
6
+ import { CoverComponentOptions, PersistentMenuOptionsTheme, ThemeProps } from './webchat/theme/types';
6
7
  import { WebchatApp } from './webchat-app';
7
8
  /**
8
9
  * See @botonic/core's Response for the description of the Response's semantics*/
@@ -64,7 +65,7 @@ interface AddBotResponseArgs {
64
65
  }
65
66
  export interface WebchatArgs {
66
67
  theme?: ThemeProps;
67
- persistentMenu?: PersistentMenuTheme;
68
+ persistentMenu?: PersistentMenuOptionsTheme;
68
69
  coverComponent?: CoverComponentOptions;
69
70
  blockInputs?: BlockInputOption[];
70
71
  enableEmojiPicker?: boolean;
@@ -94,7 +95,7 @@ export interface WebchatProps {
94
95
  onStateChange: (args: OnStateChangeArgs) => void;
95
96
  shadowDOM?: any;
96
97
  theme?: ThemeProps;
97
- persistentMenu?: PersistentMenuTheme;
98
+ persistentMenu?: PersistentMenuOptionsTheme;
98
99
  coverComponent?: CoverComponentOptions;
99
100
  blockInputs?: BlockInputOption[];
100
101
  enableEmojiPicker?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AAoJA,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;AACjB,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB"}
1
+ {"version":3,"file":"index-types.js","sourceRoot":"","sources":["../../src/index-types.ts"],"names":[],"mappings":";;;AAsJA,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,sBAAW,CAAA;IACX,wBAAa,CAAA;IACb,0BAAe,CAAA;AACjB,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AAED,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,0BAAgB,CAAA;IAChB,4BAAkB,CAAA;AACpB,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB"}
@@ -0,0 +1,3 @@
1
+ type Input = Record<string, any> | Record<string, any>[] | undefined;
2
+ export declare function toSnakeCaseKeys(input: Input): Input;
3
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toSnakeCaseKeys = void 0;
4
+ function camelCaseToSnake(str) {
5
+ return str
6
+ .replace(/([a-z])([A-Z])/g, '$1_$2')
7
+ .replace(/([A-Za-z])(\d)/g, '$1_$2')
8
+ .replace(/(\d)([A-Za-z])/g, '$1_$2')
9
+ .toLowerCase();
10
+ }
11
+ function toSnakeCaseKeys(input) {
12
+ if (Array.isArray(input)) {
13
+ return input.map(item => toSnakeCaseKeys(item));
14
+ }
15
+ if (typeof input === 'object' && input !== null) {
16
+ const result = Object.keys(input).reduce((acc, key) => {
17
+ const snakeKey = camelCaseToSnake(key);
18
+ const value = input[key];
19
+ acc[snakeKey] =
20
+ typeof value === 'object' && value !== null
21
+ ? toSnakeCaseKeys(value)
22
+ : value;
23
+ return acc;
24
+ }, {});
25
+ return result;
26
+ }
27
+ return input;
28
+ }
29
+ exports.toSnakeCaseKeys = toSnakeCaseKeys;
30
+ //# sourceMappingURL=functional.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functional.js","sourceRoot":"","sources":["../../../src/util/functional.ts"],"names":[],"mappings":";;;AAAA,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,GAAG;SACP,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC;SACnC,WAAW,EAAE,CAAA;AAClB,CAAC;AAGD,SAAgB,eAAe,CAAC,KAAY;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;KAChD;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;QAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACpD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;YACtC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;YACxB,GAAG,CAAC,QAAQ,CAAC;gBACX,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;oBACzC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC;oBACxB,CAAC,CAAC,KAAK,CAAA;YAEX,OAAO,GAAG,CAAA;QACZ,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,OAAO,MAAM,CAAA;KACd;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AArBD,0CAqBC"}
@@ -1,4 +1,4 @@
1
- import { ThemeProps } from '../components';
1
+ import { ThemeProps } from '../webchat/theme/types';
2
2
  /**
3
3
  * Returns the value of a property defined in bot's theme based on WEBCHAT.CUSTOM_PROPERTIES dictionary.
4
4
  * It gives preference to nested defined properties (e.g.: header.style) over plain properties (e.g.: headerStyle).