@botonic/react 0.32.0-alpha.0 → 0.33.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/carousel.d.ts +8 -9
- package/lib/cjs/components/carousel.js +25 -21
- package/lib/cjs/components/carousel.js.map +1 -1
- package/lib/cjs/components/element.d.ts +7 -3
- package/lib/cjs/components/element.js +6 -6
- package/lib/cjs/components/element.js.map +1 -1
- package/lib/cjs/components/index-types.d.ts +3 -8
- package/lib/cjs/components/message/message-footer.js +2 -2
- package/lib/cjs/components/multichannel/index-types.d.ts +0 -4
- package/lib/cjs/components/multichannel/multichannel-carousel.d.ts +1 -1
- package/lib/cjs/components/multichannel/multichannel-carousel.js +59 -62
- package/lib/cjs/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/cjs/components/multichannel/multichannel-context.d.ts +0 -3
- package/lib/cjs/components/multichannel/multichannel-context.js +0 -3
- package/lib/cjs/components/multichannel/multichannel-context.js.map +1 -1
- package/lib/cjs/components/pic.d.ts +8 -5
- package/lib/cjs/components/pic.js +8 -8
- package/lib/cjs/components/pic.js.map +1 -1
- package/lib/cjs/components/subtitle.d.ts +9 -5
- package/lib/cjs/components/subtitle.js +6 -7
- package/lib/cjs/components/subtitle.js.map +1 -1
- package/lib/cjs/components/title.d.ts +9 -5
- package/lib/cjs/components/title.js +6 -7
- package/lib/cjs/components/title.js.map +1 -1
- package/lib/cjs/components/whatsapp-button-list.js +5 -5
- package/lib/cjs/components/whatsapp-button-list.js.map +1 -1
- package/lib/cjs/components/whatsapp-cta-url-button.js +2 -2
- package/lib/cjs/components/whatsapp-cta-url-button.js.map +1 -1
- package/lib/cjs/index-types.d.ts +1 -1
- package/lib/cjs/msg-to-botonic.js +2 -2
- package/lib/cjs/webchat-app.js +1 -1
- package/lib/cjs/webchat-app.js.map +1 -1
- package/lib/esm/components/carousel.d.ts +8 -9
- package/lib/esm/components/carousel.js +25 -21
- package/lib/esm/components/carousel.js.map +1 -1
- package/lib/esm/components/element.d.ts +7 -3
- package/lib/esm/components/element.js +4 -4
- package/lib/esm/components/element.js.map +1 -1
- package/lib/esm/components/index-types.d.ts +3 -8
- package/lib/esm/components/message/message-footer.js +2 -2
- package/lib/esm/components/multichannel/index-types.d.ts +0 -4
- package/lib/esm/components/multichannel/multichannel-carousel.d.ts +1 -1
- package/lib/esm/components/multichannel/multichannel-carousel.js +61 -64
- package/lib/esm/components/multichannel/multichannel-carousel.js.map +1 -1
- package/lib/esm/components/multichannel/multichannel-context.d.ts +0 -3
- package/lib/esm/components/multichannel/multichannel-context.js +0 -3
- package/lib/esm/components/multichannel/multichannel-context.js.map +1 -1
- package/lib/esm/components/pic.d.ts +8 -5
- package/lib/esm/components/pic.js +6 -6
- package/lib/esm/components/pic.js.map +1 -1
- package/lib/esm/components/subtitle.d.ts +9 -5
- package/lib/esm/components/subtitle.js +4 -5
- package/lib/esm/components/subtitle.js.map +1 -1
- package/lib/esm/components/title.d.ts +9 -5
- package/lib/esm/components/title.js +4 -5
- package/lib/esm/components/title.js.map +1 -1
- package/lib/esm/components/whatsapp-button-list.js +5 -5
- package/lib/esm/components/whatsapp-button-list.js.map +1 -1
- package/lib/esm/components/whatsapp-cta-url-button.js +2 -2
- package/lib/esm/components/whatsapp-cta-url-button.js.map +1 -1
- package/lib/esm/index-types.d.ts +1 -1
- package/lib/esm/msg-to-botonic.js +2 -2
- package/lib/esm/webchat-app.js +1 -1
- package/lib/esm/webchat-app.js.map +1 -1
- package/package.json +2 -2
- package/src/components/{carousel.jsx → carousel.tsx} +58 -33
- package/src/components/{element.jsx → element.tsx} +8 -3
- package/src/components/index-types.ts +4 -11
- package/src/components/message/message-footer.tsx +2 -2
- package/src/components/multichannel/index-types.ts +0 -4
- package/src/components/multichannel/multichannel-carousel.jsx +93 -93
- package/src/components/multichannel/multichannel-context.jsx +0 -3
- package/src/components/{pic.jsx → pic.tsx} +12 -5
- package/src/components/{subtitle.jsx → subtitle.tsx} +10 -10
- package/src/components/{title.jsx → title.tsx} +8 -6
- package/src/components/whatsapp-button-list.tsx +5 -5
- package/src/components/whatsapp-cta-url-button.tsx +5 -2
- package/src/index-types.ts +2 -0
- package/src/msg-to-botonic.jsx +2 -2
- package/src/webchat-app.tsx +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { INPUT } from '@botonic/core';
|
|
2
|
+
import { CarouselProps } from './index-types';
|
|
3
|
+
export declare const Carousel: {
|
|
4
|
+
(props: CarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
serialize: (carouselProps: any) => {
|
|
6
|
+
type: INPUT;
|
|
7
|
+
elements: any;
|
|
8
|
+
};
|
|
8
9
|
};
|
|
9
|
-
import { INPUT } from "@botonic/core/lib/cjs/models/legacy-types";
|
|
10
|
-
export {};
|
|
@@ -4,7 +4,7 @@ exports.Carousel = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const core_1 = require("@botonic/core");
|
|
7
|
-
const react_1 =
|
|
7
|
+
const react_1 = require("react");
|
|
8
8
|
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
9
9
|
const leftArrow_svg_1 = tslib_1.__importDefault(require("../assets/leftArrow.svg"));
|
|
10
10
|
const rightArrow_svg_1 = tslib_1.__importDefault(require("../assets/rightArrow.svg"));
|
|
@@ -37,10 +37,13 @@ const StyledArrowContainer = styled_components_1.default.div `
|
|
|
37
37
|
align-items: center;
|
|
38
38
|
cursor: pointer;
|
|
39
39
|
justify-content: ${props => props.justifyContent};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
|
|
41
|
+
${props => (props.left ? ` left: ${props.left}px` : '')};
|
|
42
|
+
${props => (props.right ? ` right: ${props.right}px` : '')};
|
|
43
|
+
${props => (props.arrow === 'right' ? 'border-top-right-radius: 30px' : '')};
|
|
44
|
+
${props => props.arrow === 'right' ? 'border-bottom-right-radius: 30px' : ''};
|
|
45
|
+
${props => (props.arrow === 'left' ? 'border-top-left-radius: 30px' : '')};
|
|
46
|
+
${props => (props.arrow === 'left' ? 'border-bottom-left-radius: 30px' : '')};
|
|
44
47
|
`;
|
|
45
48
|
const StyledArrow = styled_components_1.default.img `
|
|
46
49
|
width: 20px;
|
|
@@ -52,26 +55,21 @@ const serialize = carouselProps => {
|
|
|
52
55
|
carouselChildren = [carouselChildren];
|
|
53
56
|
return {
|
|
54
57
|
type: core_1.INPUT.CAROUSEL,
|
|
55
|
-
elements: carouselChildren.map(e => e
|
|
58
|
+
elements: carouselChildren.map(e => { var _a; return ((_a = e === null || e === void 0 ? void 0 : e.type) === null || _a === void 0 ? void 0 : _a.serialize) && e.type.serialize(e.props); }),
|
|
56
59
|
};
|
|
57
60
|
};
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
* @param {MessageProps} props
|
|
61
|
-
* @returns {JSX.Element}
|
|
62
|
-
*/
|
|
63
|
-
const Carousel = props => {
|
|
61
|
+
const Carousel = (props) => {
|
|
64
62
|
const { getThemeProperty } = (0, react_1.useContext)(context_1.WebchatContext);
|
|
65
|
-
let content = props.children;
|
|
66
63
|
const [hasLeftArrow, setLeftArrow] = (0, react_1.useState)(false);
|
|
67
64
|
const [hasRightArrow, setRightArrow] = (0, react_1.useState)(true);
|
|
68
65
|
const carouselRef = (0, react_1.useRef)(null);
|
|
69
|
-
const CustomCarouselLeftArrow = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customCarouselLeftArrow
|
|
70
|
-
const CustomCarouselRightArrow = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customCarouselRightArrow
|
|
66
|
+
const CustomCarouselLeftArrow = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customCarouselLeftArrow);
|
|
67
|
+
const CustomCarouselRightArrow = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.customCarouselRightArrow);
|
|
71
68
|
// TODO: Investigate why when set to false, scroll is enabled via dragging the bar but not hovering the carousel elements
|
|
72
69
|
const carouselArrowsEnabled = getThemeProperty(constants_1.WEBCHAT.CUSTOM_PROPERTIES.enableCarouselArrows, true);
|
|
73
70
|
const scrollCarouselBy = value => {
|
|
74
|
-
|
|
71
|
+
var _a;
|
|
72
|
+
(_a = carouselRef.current) === null || _a === void 0 ? void 0 : _a.scrollBy({
|
|
75
73
|
left: value,
|
|
76
74
|
behavior: 'smooth',
|
|
77
75
|
});
|
|
@@ -95,15 +93,21 @@ const Carousel = props => {
|
|
|
95
93
|
if (carousel && carousel.addEventListener) {
|
|
96
94
|
carousel.addEventListener('scroll', setArrowsVisibility, false);
|
|
97
95
|
}
|
|
98
|
-
|
|
99
|
-
carousel.
|
|
100
|
-
|
|
96
|
+
return () => {
|
|
97
|
+
if (carousel && carousel.removeEventListener) {
|
|
98
|
+
carousel.removeEventListener('scroll', setArrowsVisibility, false);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
101
|
}, [carouselRef.current]);
|
|
102
102
|
const carouselProps = Object.assign(Object.assign({}, props), { children: buttons_disabler_1.ButtonsDisabler.updateChildrenButtons(props.children) });
|
|
103
103
|
if ((0, core_1.isBrowser)()) {
|
|
104
|
-
|
|
104
|
+
return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ style: {
|
|
105
|
+
width: '85%',
|
|
106
|
+
padding: 0,
|
|
107
|
+
backgroundColor: constants_1.COLORS.TRANSPARENT,
|
|
108
|
+
}, blob: false, json: serialize(carouselProps), type: core_1.INPUT.CAROUSEL }, carouselProps, { children: (0, jsx_runtime_1.jsx)(ScrollableCarousel, { children: (0, jsx_runtime_1.jsxs)(StyledCarousel, Object.assign({ ref: carouselRef, carouselArrowsEnabled: carouselArrowsEnabled }, { children: [(0, jsx_runtime_1.jsx)(StyledItems, { children: carouselProps.children }), carouselArrowsEnabled && getArrows()] })) }) })));
|
|
105
109
|
}
|
|
106
|
-
return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ style: { width: '85%', padding: 0, backgroundColor: constants_1.COLORS.TRANSPARENT }, blob: false, json: serialize(carouselProps), type: core_1.INPUT.CAROUSEL }, carouselProps, { children:
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)(message_1.Message, Object.assign({ style: { width: '85%', padding: 0, backgroundColor: constants_1.COLORS.TRANSPARENT }, blob: false, json: serialize(carouselProps), type: core_1.INPUT.CAROUSEL }, carouselProps, { children: props.children })));
|
|
107
111
|
};
|
|
108
112
|
exports.Carousel = Carousel;
|
|
109
113
|
exports.Carousel.serialize = serialize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/components/carousel.
|
|
1
|
+
{"version":3,"file":"carousel.js","sourceRoot":"","sources":["../../../src/components/carousel.tsx"],"names":[],"mappings":";;;;;AAAA,wCAAgD;AAChD,iCAAsE;AACtE,kFAAsC;AAEtC,oFAA+C;AAC/C,sFAAiD;AACjD,4CAA8C;AAC9C,qDAAkD;AAClD,gDAAmD;AACnD,yDAAoD;AAEpD,uCAAmC;AAEnC,MAAM,kBAAkB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;CAGpC,CAAA;AAMD,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAqB;;;;;IAKlD,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,qBAAqB,IAAI,mBAAmB;CAC9D,CAAA;AAED,MAAM,WAAW,GAAG,2BAAM,CAAC,GAAG,CAAA;;CAE7B,CAAA;AASD,MAAM,oBAAoB,GAAG,2BAAM,CAAC,GAAG,CAA2B;;;;;gBAKlD,kBAAM,CAAC,MAAM;;;;qBAIR,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc;;IAE9C,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAA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
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ElementProps {
|
|
3
|
+
children: React.ReactNode[];
|
|
4
4
|
}
|
|
5
|
+
export declare const Element: {
|
|
6
|
+
(props: ElementProps): any;
|
|
7
|
+
serialize(elementProps: any): any;
|
|
8
|
+
};
|
|
@@ -3,10 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Element = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
6
|
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
8
7
|
const constants_1 = require("../constants");
|
|
9
|
-
const
|
|
8
|
+
const react_1 = require("../util/react");
|
|
10
9
|
const button_1 = require("./button");
|
|
11
10
|
const ElementContainer = styled_components_1.default.div `
|
|
12
11
|
display: flex;
|
|
@@ -18,16 +17,17 @@ const ElementContainer = styled_components_1.default.div `
|
|
|
18
17
|
overflow: hidden;
|
|
19
18
|
justify-content: space-between;
|
|
20
19
|
`;
|
|
21
|
-
const Element = props => {
|
|
20
|
+
const Element = (props) => {
|
|
22
21
|
const renderBrowser = () => ((0, jsx_runtime_1.jsx)(ElementContainer, { children: props.children }));
|
|
22
|
+
// @ts-ignore
|
|
23
23
|
const renderNode = () => (0, jsx_runtime_1.jsx)("element", { children: props.children });
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, react_1.renderComponent)({ renderBrowser, renderNode });
|
|
25
25
|
};
|
|
26
26
|
exports.Element = Element;
|
|
27
27
|
exports.Element.serialize = elementProps => {
|
|
28
28
|
const element = Object.assign({}, ...elementProps.children
|
|
29
|
-
.filter(c => c
|
|
30
|
-
.map(c => c.type.serialize && c.type.serialize(c.props)));
|
|
29
|
+
.filter(c => { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.name) !== button_1.Button.name; })
|
|
30
|
+
.map(c => { var _a; return ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.serialize) && c.type.serialize(c.props); }));
|
|
31
31
|
// When we are serializer buttons from backend, we are receiving the data
|
|
32
32
|
// as an array of buttons, so we have to keep robust with serve and deal with arrays
|
|
33
33
|
element.buttons = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/components/element.
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/components/element.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AAEtC,4CAA8C;AAC9C,yCAA+C;AAC/C,qCAAiC;AAEjC,MAAM,gBAAgB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;WAGxB,mBAAO,CAAC,QAAQ,CAAC,aAAa;kBACvB,mBAAO,CAAC,QAAQ,CAAC,oBAAoB;;sBAEjC,kBAAM,CAAC,cAAc;;;CAG1C,CAAA;AAMM,MAAM,OAAO,GAAG,CAAC,KAAmB,EAAE,EAAE;IAC7C,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAC1B,uBAAC,gBAAgB,cAAE,KAAK,CAAC,QAAQ,GAAoB,CACtD,CAAA;IAED,aAAa;IACb,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,8CAAU,KAAK,CAAC,QAAQ,GAAW,CAAA;IAE5D,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AATY,QAAA,OAAO,WASnB;AAED,eAAO,CAAC,SAAS,GAAG,YAAY,CAAC,EAAE;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAC3B,EAAE,EACF,GAAG,YAAY,CAAC,QAAQ;SACrB,MAAM,CAAC,CAAC,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI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
|
@@ -18,6 +18,9 @@ export interface TextProps extends MessageProps {
|
|
|
18
18
|
inferenceId?: string;
|
|
19
19
|
botInteractionId?: string;
|
|
20
20
|
}
|
|
21
|
+
export interface CarouselProps extends MessageProps {
|
|
22
|
+
children: React.ReactNode[];
|
|
23
|
+
}
|
|
21
24
|
export interface Webview {
|
|
22
25
|
name: string;
|
|
23
26
|
}
|
|
@@ -41,9 +44,6 @@ export interface ReplyProps {
|
|
|
41
44
|
payload?: string;
|
|
42
45
|
children: string;
|
|
43
46
|
}
|
|
44
|
-
export interface PicProps {
|
|
45
|
-
src: string;
|
|
46
|
-
}
|
|
47
47
|
export interface ImageProps extends MessageProps {
|
|
48
48
|
src: string;
|
|
49
49
|
input?: {
|
|
@@ -69,11 +69,6 @@ export interface DocumentProps extends MessageProps {
|
|
|
69
69
|
};
|
|
70
70
|
from?: any;
|
|
71
71
|
}
|
|
72
|
-
export interface TitleProps {
|
|
73
|
-
children: React.ReactNode;
|
|
74
|
-
style: string;
|
|
75
|
-
}
|
|
76
|
-
export type SubtitleProps = TitleProps;
|
|
77
72
|
export interface CustomMessageType {
|
|
78
73
|
(props: any): JSX.Element;
|
|
79
74
|
customTypeName: string;
|
|
@@ -12,10 +12,10 @@ const MessageFooter = ({ enabletimestamps, messageJSON, sentBy, feedbackEnabled,
|
|
|
12
12
|
const { getThemeProperty } = (0, react_1.useContext)(context_1.WebchatContext);
|
|
13
13
|
const { timestampsEnabled, timestampStyle } = (0, timestamps_1.resolveMessageTimestamps)(getThemeProperty, enabletimestamps);
|
|
14
14
|
const isSentByUser = sentBy === index_types_1.SENDERS.user;
|
|
15
|
-
const
|
|
15
|
+
const messageFooterClass = isSentByUser
|
|
16
16
|
? 'message-footer-user'
|
|
17
17
|
: 'message-footer-bot';
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(styles_1.MessageFooterContainer, Object.assign({ className:
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.MessageFooterContainer, Object.assign({ className: messageFooterClass, isSentByUser: isSentByUser }, { children: [timestampsEnabled ? ((0, jsx_runtime_1.jsx)(timestamps_1.MessageTimestamp, { sentBy: sentBy, style: timestampStyle, timestamp: messageJSON.timestamp })) : null, feedbackEnabled ? ((0, jsx_runtime_1.jsx)(message_feedback_1.MessageFeedback, { inferenceId: inferenceId, messageId: messageJSON.id, botInteractionId: botInteractionId })) : null] })));
|
|
19
19
|
};
|
|
20
20
|
exports.MessageFooter = MessageFooter;
|
|
21
21
|
//# sourceMappingURL=message-footer.js.map
|
|
@@ -19,10 +19,6 @@ export interface MultichannelTextProps extends MultichannelViewOptions {
|
|
|
19
19
|
}
|
|
20
20
|
export interface MultichannelCarouselProps extends MultichannelViewOptions {
|
|
21
21
|
enableURL?: boolean;
|
|
22
|
-
indexMode?: IndexMode;
|
|
23
|
-
showTitle?: boolean;
|
|
24
|
-
showSubtitle?: boolean;
|
|
25
|
-
buttonsAsText?: boolean;
|
|
26
22
|
}
|
|
27
23
|
export interface MultichannelButtonProps {
|
|
28
24
|
newline?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function MultichannelCarousel(props: any):
|
|
1
|
+
export function MultichannelCarousel(props: any): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,74 +6,71 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const core_1 = require("@botonic/core");
|
|
7
7
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
8
8
|
const contexts_1 = require("../../contexts");
|
|
9
|
+
const button_1 = require("../button");
|
|
9
10
|
const carousel_1 = require("../carousel");
|
|
10
|
-
const
|
|
11
|
+
const image_1 = require("../image");
|
|
12
|
+
const text_1 = require("../text");
|
|
13
|
+
const whatsapp_cta_url_button_1 = require("../whatsapp-cta-url-button");
|
|
11
14
|
const multichannel_utils_1 = require("./multichannel-utils");
|
|
15
|
+
const markdown_meta_1 = require("./whatsapp/markdown-meta");
|
|
12
16
|
const MultichannelCarousel = props => {
|
|
13
17
|
const requestContext = (0, react_1.useContext)(contexts_1.RequestContext);
|
|
14
|
-
|
|
15
|
-
if ((0, core_1.isWhatsapp)(requestContext.session)) {
|
|
16
|
-
const elements = props.children
|
|
17
|
-
.map(e => e.props.children)
|
|
18
|
-
.map((element, i) => {
|
|
19
|
-
let imageProps = undefined;
|
|
20
|
-
let title = undefined;
|
|
21
|
-
let subtitle = undefined;
|
|
22
|
-
const buttons = [];
|
|
23
|
-
for (const node of element) {
|
|
24
|
-
if ((0, multichannel_utils_1.isNodePic)(node)) {
|
|
25
|
-
imageProps = node.props;
|
|
26
|
-
}
|
|
27
|
-
if ((0, multichannel_utils_1.isNodeTitle)(node)) {
|
|
28
|
-
title = node.props.children;
|
|
29
|
-
}
|
|
30
|
-
if ((0, multichannel_utils_1.isNodeSubtitle)(node)) {
|
|
31
|
-
subtitle = node.props.children;
|
|
32
|
-
}
|
|
33
|
-
if ((0, multichannel_utils_1.isMultichannelButton)(node)) {
|
|
34
|
-
buttons.push(node);
|
|
35
|
-
}
|
|
36
|
-
//TODO support fragment containing an array
|
|
37
|
-
if (Array.isArray(node)) {
|
|
38
|
-
buttons.push(getButtons(node));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
let header = '';
|
|
42
|
-
if (props.showTitle && title) {
|
|
43
|
-
header += `${title ? `**${title}**` : ''}`;
|
|
44
|
-
if (title && subtitle) {
|
|
45
|
-
header += ' ';
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
if (props.showSubtitle && subtitle) {
|
|
49
|
-
header += `_${subtitle}_`;
|
|
50
|
-
}
|
|
51
|
-
return (
|
|
52
|
-
// TODO: newkey only for 1 nested button
|
|
53
|
-
(0, jsx_runtime_1.jsxs)(multichannel_text_1.MultichannelText, Object.assign({ newkey: i, indexMode: props.indexMode, buttonsAsText: props.buttonsAsText }, { children: [header || null, buttons] }), i));
|
|
54
|
-
// TODO: in the future, this would be the default mode
|
|
55
|
-
// } else {
|
|
56
|
-
// return (
|
|
57
|
-
// <React.Fragment key={i}>
|
|
58
|
-
// <Image
|
|
59
|
-
// src={imageSrc}
|
|
60
|
-
// caption={carouselToCaption(
|
|
61
|
-
// i + 1,
|
|
62
|
-
// title,
|
|
63
|
-
// subtitle,
|
|
64
|
-
// imageSrc,
|
|
65
|
-
// buttonProps
|
|
66
|
-
// )}
|
|
67
|
-
// ></Image>
|
|
68
|
-
// </React.Fragment>
|
|
69
|
-
// )
|
|
70
|
-
// }
|
|
71
|
-
});
|
|
72
|
-
return elements;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
18
|
+
if ((0, core_1.isDev)(requestContext.session) || (0, core_1.isWebchat)(requestContext.session)) {
|
|
75
19
|
return (0, jsx_runtime_1.jsx)(carousel_1.Carousel, Object.assign({}, props, { children: props.children }));
|
|
76
20
|
}
|
|
21
|
+
const messages = [];
|
|
22
|
+
const childrenElements = props.children.map(e => e.props.children);
|
|
23
|
+
childrenElements.forEach((element, i) => {
|
|
24
|
+
const { imageProps, title, subtitle, buttons } = parseCarouselElement(element);
|
|
25
|
+
const textMessage = getTextMessage(requestContext.session, title, subtitle);
|
|
26
|
+
if (imageProps === null || imageProps === void 0 ? void 0 : imageProps.src) {
|
|
27
|
+
const messageWithImage = (0, jsx_runtime_1.jsx)(image_1.Image, { src: imageProps.src });
|
|
28
|
+
messages.push(messageWithImage);
|
|
29
|
+
}
|
|
30
|
+
if ((0, core_1.isWhatsapp)(requestContext.session) &&
|
|
31
|
+
buttons.some(button => button.url)) {
|
|
32
|
+
const messageWithButtonUrl = ((0, jsx_runtime_1.jsx)(whatsapp_cta_url_button_1.WhatsappCTAUrlButton, { body: title, footer: `_${subtitle}_`, displayText: buttons[0].text, url: buttons[0].url }, `carousel-element-${i}-cta-url`));
|
|
33
|
+
messages.push(messageWithButtonUrl);
|
|
34
|
+
}
|
|
35
|
+
const messageWithButtons = buttons.some(button => button.payload) ? ((0, jsx_runtime_1.jsxs)(text_1.Text, { children: [textMessage, buttons
|
|
36
|
+
.filter(button => (0, core_1.isWhatsapp)(requestContext.session) && !button.url)
|
|
37
|
+
.map(button => ((0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ payload: button.payload, url: button.url }, { children: button.text }), `carousel-element-${i}-button`)))] }, `carousel-element-${i}-text`)) : ([]);
|
|
38
|
+
messages.push(messageWithButtons);
|
|
39
|
+
});
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: messages });
|
|
77
41
|
};
|
|
78
42
|
exports.MultichannelCarousel = MultichannelCarousel;
|
|
43
|
+
function getButtons(node) {
|
|
44
|
+
return [].concat((0, multichannel_utils_1.getFilteredElements)(node, multichannel_utils_1.isMultichannelButton));
|
|
45
|
+
}
|
|
46
|
+
function parseCarouselElement(element) {
|
|
47
|
+
let imageProps, title, subtitle;
|
|
48
|
+
const buttonsChildren = [];
|
|
49
|
+
for (const node of element) {
|
|
50
|
+
if ((0, multichannel_utils_1.isNodePic)(node))
|
|
51
|
+
imageProps = node.props;
|
|
52
|
+
if ((0, multichannel_utils_1.isNodeTitle)(node))
|
|
53
|
+
title = node.props.children;
|
|
54
|
+
if ((0, multichannel_utils_1.isNodeSubtitle)(node))
|
|
55
|
+
subtitle = node.props.children;
|
|
56
|
+
if ((0, multichannel_utils_1.isMultichannelButton)(node))
|
|
57
|
+
buttonsChildren.push(node);
|
|
58
|
+
if (Array.isArray(node))
|
|
59
|
+
buttonsChildren.push(...getButtons(node));
|
|
60
|
+
}
|
|
61
|
+
const buttons = buttonsChildren.map(button => {
|
|
62
|
+
return {
|
|
63
|
+
text: button.props.children,
|
|
64
|
+
payload: button.props.payload,
|
|
65
|
+
url: button.props.url,
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
return { imageProps, title, subtitle, buttons };
|
|
69
|
+
}
|
|
70
|
+
function getTextMessage(session, title, subtitle) {
|
|
71
|
+
const formattedTextMessage = `**${title}**${subtitle ? ` _${subtitle}_` : ''}`;
|
|
72
|
+
return (0, core_1.isWhatsapp)(session) || (0, core_1.isFacebook)(session)
|
|
73
|
+
? (0, markdown_meta_1.convertToMarkdownMeta)(formattedTextMessage)
|
|
74
|
+
: formattedTextMessage;
|
|
75
|
+
}
|
|
79
76
|
//# sourceMappingURL=multichannel-carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multichannel-carousel.js","sourceRoot":"","sources":["../../../../src/components/multichannel/multichannel-carousel.jsx"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"multichannel-carousel.js","sourceRoot":"","sources":["../../../../src/components/multichannel/multichannel-carousel.jsx"],"names":[],"mappings":";;;;;AAAA,wCAAwE;AACxE,uDAAyC;AAEzC,6CAA+C;AAC/C,sCAAkC;AAClC,0CAAsC;AACtC,oCAAgC;AAChC,kCAA8B;AAC9B,wEAAiE;AACjE,6DAM6B;AAC7B,4DAAgE;AAEzD,MAAM,oBAAoB,GAAG,KAAK,CAAC,EAAE;IAC1C,MAAM,cAAc,GAAG,IAAA,kBAAU,EAAC,yBAAc,CAAC,CAAA;IAEjD,IAAI,IAAA,YAAK,EAAC,cAAc,CAAC,OAAO,CAAC,IAAI,IAAA,gBAAS,EAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QACtE,OAAO,uBAAC,mBAAQ,oBAAK,KAAK,cAAG,KAAK,CAAC,QAAQ,IAAY,CAAA;KACxD;IAED,MAAM,QAAQ,GAAG,EAAE,CAAA;IACnB,MAAM,gBAAgB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IAElE,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;QACtC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAC5C,oBAAoB,CAAC,OAAO,CAAC,CAAA;QAE/B,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,OAAO,EA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ACH,CAAC,CAAC,CAAA;IAEF,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA;AACjD,CAAC;AAED,SAAS,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ;IAC9C,MAAM,oBAAoB,GAAG,KAAK,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;IAC9E,OAAO,IAAA,iBAAU,EAAC,OAAO,CAAC,IAAI,IAAA,iBAAU,EAAC,OAAO,CAAC;QAC/C,CAAC,CAAC,IAAA,qCAAqB,EAAC,oBAAoB,CAAC;QAC7C,CAAC,CAAC,oBAAoB,CAAA;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multichannel-context.js","sourceRoot":"","sources":["../../../../src/components/multichannel/multichannel-context.jsx"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAEZ,QAAA,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAC;IACrD,SAAS,EAAE,IAAI;IACf,
|
|
1
|
+
{"version":3,"file":"multichannel-context.js","sourceRoot":"","sources":["../../../../src/components/multichannel/multichannel-context.jsx"],"names":[],"mappings":";;;;AAAA,0DAAyB;AAEZ,QAAA,mBAAmB,GAAG,eAAK,CAAC,aAAa,CAAC;IACrD,SAAS,EAAE,IAAI;IACf,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE,GAAG;CACpB,CAAC,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
function serialize(picProps: any): {
|
|
4
|
-
pic: any;
|
|
5
|
-
};
|
|
1
|
+
export interface PicProps {
|
|
2
|
+
src: string;
|
|
6
3
|
}
|
|
4
|
+
export declare const Pic: {
|
|
5
|
+
(props: PicProps): any;
|
|
6
|
+
serialize(props: PicProps): {
|
|
7
|
+
pic: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -3,28 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Pic = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
6
|
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
8
7
|
const constants_1 = require("../constants");
|
|
9
8
|
const environment_1 = require("../util/environment");
|
|
10
|
-
const
|
|
9
|
+
const react_1 = require("../util/react");
|
|
11
10
|
const PicStyled = styled_components_1.default.img `
|
|
12
11
|
border-top-left-radius: 8px;
|
|
13
12
|
border-top-right-radius: 8px;
|
|
14
13
|
width: ${constants_1.WEBCHAT.DEFAULTS.ELEMENT_WIDTH}px;
|
|
15
14
|
height: 140px;
|
|
16
|
-
background: ${constants_1.COLORS.SOLID_WHITE}
|
|
17
|
-
|
|
15
|
+
background: ${constants_1.COLORS.SOLID_WHITE};
|
|
16
|
+
object-fit: center/cover;
|
|
18
17
|
border-bottom: 1px solid ${constants_1.COLORS.SEASHELL_WHITE};
|
|
19
18
|
`;
|
|
20
|
-
const Pic = props => {
|
|
19
|
+
const Pic = (props) => {
|
|
21
20
|
props = Object.assign(Object.assign({}, props), { src: (0, environment_1.staticAsset)(props.src) });
|
|
22
21
|
const renderBrowser = () => (0, jsx_runtime_1.jsx)(PicStyled, { src: props.src });
|
|
22
|
+
// @ts-ignore
|
|
23
23
|
const renderNode = () => (0, jsx_runtime_1.jsx)("pic", { children: props.src });
|
|
24
|
-
return (0,
|
|
24
|
+
return (0, react_1.renderComponent)({ renderBrowser, renderNode });
|
|
25
25
|
};
|
|
26
26
|
exports.Pic = Pic;
|
|
27
|
-
exports.Pic.serialize =
|
|
28
|
-
return { pic:
|
|
27
|
+
exports.Pic.serialize = (props) => {
|
|
28
|
+
return { pic: props.src };
|
|
29
29
|
};
|
|
30
30
|
//# sourceMappingURL=pic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pic.js","sourceRoot":"","sources":["../../../src/components/pic.
|
|
1
|
+
{"version":3,"file":"pic.js","sourceRoot":"","sources":["../../../src/components/pic.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AAEtC,4CAA8C;AAC9C,qDAAiD;AACjD,yCAA+C;AAE/C,MAAM,SAAS,GAAG,2BAAM,CAAC,GAAG,CAAA;;;WAGjB,mBAAO,CAAC,QAAQ,CAAC,aAAa;;gBAEzB,kBAAM,CAAC,WAAW;;6BAEL,kBAAM,CAAC,cAAc;CACjD,CAAA;AAKM,MAAM,GAAG,GAAG,CAAC,KAAe,EAAE,EAAE;IACrC,KAAK,mCAAQ,KAAK,KAAE,GAAG,EAAE,IAAA,yBAAW,EAAC,KAAK,CAAC,GAAG,CAAC,GAAE,CAAA;IAEjD,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,uBAAC,SAAS,IAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAI,CAAA;IAEzD,aAAa;IACb,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,0CAAM,KAAK,CAAC,GAAG,GAAO,CAAA;IAE/C,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AATY,QAAA,GAAG,OASf;AAED,WAAG,CAAC,SAAS,GAAG,CAAC,KAAe,EAAE,EAAE;IAClC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAA;AAC3B,CAAC,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
subtitle: any;
|
|
5
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SubtitleProps {
|
|
3
|
+
children: React.ReactNode;
|
|
6
4
|
}
|
|
5
|
+
export declare const Subtitle: {
|
|
6
|
+
(props: SubtitleProps): any;
|
|
7
|
+
serialize(props: SubtitleProps): {
|
|
8
|
+
subtitle: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -3,22 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Subtitle = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
6
|
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
8
7
|
const constants_1 = require("../constants");
|
|
9
|
-
const
|
|
8
|
+
const react_1 = require("../util/react");
|
|
10
9
|
const SubtitleContainer = styled_components_1.default.div `
|
|
11
10
|
font-size: 12px;
|
|
12
11
|
padding: 0px 15px 10px 15px;
|
|
13
12
|
color: ${constants_1.COLORS.MID_GRAY};
|
|
14
13
|
`;
|
|
15
|
-
const Subtitle = props => {
|
|
16
|
-
const renderBrowser = () => ((0, jsx_runtime_1.jsx)(SubtitleContainer,
|
|
14
|
+
const Subtitle = (props) => {
|
|
15
|
+
const renderBrowser = () => ((0, jsx_runtime_1.jsx)(SubtitleContainer, { children: props.children }));
|
|
17
16
|
const renderNode = () => (0, jsx_runtime_1.jsx)("desc", { children: props.children });
|
|
18
|
-
return (0,
|
|
17
|
+
return (0, react_1.renderComponent)({ renderBrowser, renderNode });
|
|
19
18
|
};
|
|
20
19
|
exports.Subtitle = Subtitle;
|
|
21
|
-
exports.Subtitle.serialize =
|
|
22
|
-
return { subtitle:
|
|
20
|
+
exports.Subtitle.serialize = (props) => {
|
|
21
|
+
return { subtitle: props.children };
|
|
23
22
|
};
|
|
24
23
|
//# sourceMappingURL=subtitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subtitle.js","sourceRoot":"","sources":["../../../src/components/subtitle.
|
|
1
|
+
{"version":3,"file":"subtitle.js","sourceRoot":"","sources":["../../../src/components/subtitle.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AAEtC,4CAAqC;AACrC,yCAA+C;AAE/C,MAAM,iBAAiB,GAAG,2BAAM,CAAC,GAAG,CAAA;;;WAGzB,kBAAM,CAAC,QAAQ;CACzB,CAAA;AAMM,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,CAC1B,uBAAC,iBAAiB,cAAE,KAAK,CAAC,QAAQ,GAAqB,CACxD,CAAA;IAED,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,2CAAO,KAAK,CAAC,QAAQ,GAAQ,CAAA;IAEtD,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AARY,QAAA,QAAQ,YAQpB;AAED,gBAAQ,CAAC,SAAS,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC5C,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAA;AACrC,CAAC,CAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
title: any;
|
|
5
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TitleProps {
|
|
3
|
+
children: React.ReactNode;
|
|
6
4
|
}
|
|
5
|
+
export declare const Title: {
|
|
6
|
+
(props: TitleProps): any;
|
|
7
|
+
serialize(props: TitleProps): {
|
|
8
|
+
title: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -3,20 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Title = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
6
|
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
|
|
8
|
-
const
|
|
7
|
+
const react_1 = require("../util/react");
|
|
9
8
|
const TitleContainer = styled_components_1.default.div `
|
|
10
9
|
font-size: 14px;
|
|
11
10
|
padding: 10px 15px;
|
|
12
11
|
`;
|
|
13
|
-
const Title = props => {
|
|
14
|
-
const renderBrowser = () => (
|
|
12
|
+
const Title = (props) => {
|
|
13
|
+
const renderBrowser = () => (0, jsx_runtime_1.jsx)(TitleContainer, { children: props.children });
|
|
15
14
|
const renderNode = () => (0, jsx_runtime_1.jsx)("title", { children: props.children });
|
|
16
|
-
return (0,
|
|
15
|
+
return (0, react_1.renderComponent)({ renderBrowser, renderNode });
|
|
17
16
|
};
|
|
18
17
|
exports.Title = Title;
|
|
19
|
-
exports.Title.serialize =
|
|
20
|
-
return { title:
|
|
18
|
+
exports.Title.serialize = (props) => {
|
|
19
|
+
return { title: props.children };
|
|
21
20
|
};
|
|
22
21
|
//# sourceMappingURL=title.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"title.js","sourceRoot":"","sources":["../../../src/components/title.
|
|
1
|
+
{"version":3,"file":"title.js","sourceRoot":"","sources":["../../../src/components/title.tsx"],"names":[],"mappings":";;;;;AACA,kFAAsC;AAEtC,yCAA+C;AAE/C,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAA;AAKM,MAAM,KAAK,GAAG,CAAC,KAAiB,EAAE,EAAE;IACzC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,uBAAC,cAAc,cAAE,KAAK,CAAC,QAAQ,GAAkB,CAAA;IAE7E,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,4CAAQ,KAAK,CAAC,QAAQ,GAAS,CAAA;IAExD,OAAO,IAAA,uBAAe,EAAC,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA;AANY,QAAA,KAAK,SAMjB;AAED,aAAK,CAAC,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAA;AAClC,CAAC,CAAA"}
|