@botonic/react 0.41.1-alpha.0 → 0.42.0-alpha.1
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/index-types.d.ts +0 -1
- package/lib/cjs/components/index.d.ts +0 -1
- package/lib/cjs/components/index.js +1 -3
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/multichannel/whatsapp/constants.d.ts +0 -1
- package/lib/cjs/components/multichannel/whatsapp/constants.js +1 -2
- package/lib/cjs/components/multichannel/whatsapp/constants.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/debug-message.js +22 -0
- package/lib/cjs/components/system-debug-trace/debug-message.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/bot-action.d.ts +7 -0
- package/lib/cjs/components/system-debug-trace/events/bot-action.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/bot-action.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-channel.d.ts +7 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-channel.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-channel.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-country.d.ts +7 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-country.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-country.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-custom.d.ts +8 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-custom.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-custom.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.d.ts +10 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js +20 -0
- package/lib/cjs/components/system-debug-trace/events/conditional-queue-status.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/constants.d.ts +4 -0
- package/lib/cjs/components/system-debug-trace/events/constants.js +4 -0
- package/lib/cjs/components/system-debug-trace/events/constants.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/handoff-success.d.ts +2 -0
- package/lib/cjs/components/system-debug-trace/events/handoff-success.js +23 -4
- package/lib/cjs/components/system-debug-trace/events/handoff-success.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/index.d.ts +7 -0
- package/lib/cjs/components/system-debug-trace/events/index.js +7 -0
- package/lib/cjs/components/system-debug-trace/events/index.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/events/redirect-flow.d.ts +10 -0
- package/lib/cjs/components/system-debug-trace/events/redirect-flow.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/redirect-flow.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.d.ts +8 -0
- package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.js +18 -0
- package/lib/cjs/components/system-debug-trace/events/webview-action-triggered.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/icons/arrow-progress.d.ts +2 -0
- package/lib/cjs/components/system-debug-trace/icons/arrow-progress.js +10 -0
- package/lib/cjs/components/system-debug-trace/icons/arrow-progress.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/icons/code.d.ts +2 -0
- package/lib/cjs/components/system-debug-trace/icons/code.js +10 -0
- package/lib/cjs/components/system-debug-trace/icons/code.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/icons/split.d.ts +2 -0
- package/lib/cjs/components/system-debug-trace/icons/split.js +10 -0
- package/lib/cjs/components/system-debug-trace/icons/split.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/icons/window-restore.d.ts +2 -0
- package/lib/cjs/components/system-debug-trace/icons/window-restore.js +10 -0
- package/lib/cjs/components/system-debug-trace/icons/window-restore.js.map +1 -0
- package/lib/cjs/components/system-debug-trace/styles.js +7 -4
- package/lib/cjs/components/system-debug-trace/styles.js.map +1 -1
- package/lib/cjs/components/system-debug-trace/types.d.ts +2 -2
- package/lib/cjs/components/whatsapp-media-carousel.js +0 -3
- package/lib/cjs/components/whatsapp-media-carousel.js.map +1 -1
- package/lib/cjs/index-types.d.ts +8 -0
- package/lib/cjs/index-types.js.map +1 -1
- package/lib/cjs/webchat/context/index.js +14 -0
- package/lib/cjs/webchat/context/index.js.map +1 -1
- package/lib/esm/components/index-types.d.ts +0 -1
- package/lib/esm/components/index.d.ts +0 -1
- package/lib/esm/components/index.js +0 -1
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/multichannel/whatsapp/constants.d.ts +0 -1
- package/lib/esm/components/multichannel/whatsapp/constants.js +0 -1
- package/lib/esm/components/multichannel/whatsapp/constants.js.map +1 -1
- package/lib/esm/components/system-debug-trace/debug-message.js +24 -2
- package/lib/esm/components/system-debug-trace/debug-message.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/bot-action.d.ts +7 -0
- package/lib/esm/components/system-debug-trace/events/bot-action.js +14 -0
- package/lib/esm/components/system-debug-trace/events/bot-action.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/conditional-channel.d.ts +7 -0
- package/lib/esm/components/system-debug-trace/events/conditional-channel.js +14 -0
- package/lib/esm/components/system-debug-trace/events/conditional-channel.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/conditional-country.d.ts +7 -0
- package/lib/esm/components/system-debug-trace/events/conditional-country.js +14 -0
- package/lib/esm/components/system-debug-trace/events/conditional-country.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/conditional-custom.d.ts +8 -0
- package/lib/esm/components/system-debug-trace/events/conditional-custom.js +14 -0
- package/lib/esm/components/system-debug-trace/events/conditional-custom.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.d.ts +10 -0
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js +16 -0
- package/lib/esm/components/system-debug-trace/events/conditional-queue-status.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/constants.d.ts +4 -0
- package/lib/esm/components/system-debug-trace/events/constants.js +4 -0
- package/lib/esm/components/system-debug-trace/events/constants.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/handoff-success.d.ts +2 -0
- package/lib/esm/components/system-debug-trace/events/handoff-success.js +23 -4
- package/lib/esm/components/system-debug-trace/events/handoff-success.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/index.d.ts +7 -0
- package/lib/esm/components/system-debug-trace/events/index.js +7 -0
- package/lib/esm/components/system-debug-trace/events/index.js.map +1 -1
- package/lib/esm/components/system-debug-trace/events/redirect-flow.d.ts +10 -0
- package/lib/esm/components/system-debug-trace/events/redirect-flow.js +14 -0
- package/lib/esm/components/system-debug-trace/events/redirect-flow.js.map +1 -0
- package/lib/esm/components/system-debug-trace/events/webview-action-triggered.d.ts +8 -0
- package/lib/esm/components/system-debug-trace/events/webview-action-triggered.js +14 -0
- package/lib/esm/components/system-debug-trace/events/webview-action-triggered.js.map +1 -0
- package/lib/esm/components/system-debug-trace/icons/arrow-progress.d.ts +2 -0
- package/lib/esm/components/system-debug-trace/icons/arrow-progress.js +6 -0
- package/lib/esm/components/system-debug-trace/icons/arrow-progress.js.map +1 -0
- package/lib/esm/components/system-debug-trace/icons/code.d.ts +2 -0
- package/lib/esm/components/system-debug-trace/icons/code.js +6 -0
- package/lib/esm/components/system-debug-trace/icons/code.js.map +1 -0
- package/lib/esm/components/system-debug-trace/icons/split.d.ts +2 -0
- package/lib/esm/components/system-debug-trace/icons/split.js +6 -0
- package/lib/esm/components/system-debug-trace/icons/split.js.map +1 -0
- package/lib/esm/components/system-debug-trace/icons/window-restore.d.ts +2 -0
- package/lib/esm/components/system-debug-trace/icons/window-restore.js +6 -0
- package/lib/esm/components/system-debug-trace/icons/window-restore.js.map +1 -0
- package/lib/esm/components/system-debug-trace/styles.js +7 -4
- package/lib/esm/components/system-debug-trace/styles.js.map +1 -1
- package/lib/esm/components/system-debug-trace/types.d.ts +2 -2
- package/lib/esm/components/whatsapp-media-carousel.js +0 -3
- package/lib/esm/components/whatsapp-media-carousel.js.map +1 -1
- package/lib/esm/index-types.d.ts +8 -0
- package/lib/esm/index-types.js.map +1 -1
- package/lib/esm/webchat/context/index.js +14 -0
- package/lib/esm/webchat/context/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/index-types.ts +0 -1
- package/src/components/index.ts +0 -4
- package/src/components/multichannel/whatsapp/constants.ts +0 -1
- package/src/components/system-debug-trace/debug-message.tsx +30 -2
- package/src/components/system-debug-trace/events/bot-action.tsx +28 -0
- package/src/components/system-debug-trace/events/conditional-channel.tsx +28 -0
- package/src/components/system-debug-trace/events/conditional-country.tsx +28 -0
- package/src/components/system-debug-trace/events/conditional-custom.tsx +29 -0
- package/src/components/system-debug-trace/events/conditional-queue-status.tsx +37 -0
- package/src/components/system-debug-trace/events/constants.ts +4 -0
- package/src/components/system-debug-trace/events/handoff-success.tsx +45 -8
- package/src/components/system-debug-trace/events/index.ts +7 -0
- package/src/components/system-debug-trace/events/redirect-flow.tsx +31 -0
- package/src/components/system-debug-trace/events/webview-action-triggered.tsx +29 -0
- package/src/components/system-debug-trace/icons/arrow-progress.tsx +15 -0
- package/src/components/system-debug-trace/icons/code.tsx +15 -0
- package/src/components/system-debug-trace/icons/split.tsx +15 -0
- package/src/components/system-debug-trace/icons/window-restore.tsx +15 -0
- package/src/components/system-debug-trace/styles.ts +7 -4
- package/src/components/system-debug-trace/types.ts +14 -0
- package/src/components/whatsapp-media-carousel.tsx +0 -3
- package/src/index-types.ts +9 -0
- package/src/webchat/context/index.tsx +17 -0
- package/lib/cjs/components/whatsapp-interactive-media-carousel.d.ts +0 -15
- package/lib/cjs/components/whatsapp-interactive-media-carousel.js +0 -19
- package/lib/cjs/components/whatsapp-interactive-media-carousel.js.map +0 -1
- package/lib/esm/components/whatsapp-interactive-media-carousel.d.ts +0 -15
- package/lib/esm/components/whatsapp-interactive-media-carousel.js +0 -15
- package/lib/esm/components/whatsapp-interactive-media-carousel.js.map +0 -1
- package/src/components/whatsapp-interactive-media-carousel.tsx +0 -52
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EventAction } from '@botonic/core'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { WindowRestoreSvg } from '../icons/window-restore'
|
|
5
|
+
import { DebugEventConfig } from '../types'
|
|
6
|
+
|
|
7
|
+
export interface WebviewActionTriggeredDebugEvent {
|
|
8
|
+
action: EventAction.WebviewActionTriggered
|
|
9
|
+
webview_target_id: string
|
|
10
|
+
webview_name: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const getWebviewActionTriggeredEventConfig = (
|
|
14
|
+
data: WebviewActionTriggeredDebugEvent
|
|
15
|
+
): DebugEventConfig => {
|
|
16
|
+
const title = (
|
|
17
|
+
<>
|
|
18
|
+
Webview action triggered <span>- {data.webview_name}</span>
|
|
19
|
+
</>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
action: EventAction.WebviewActionTriggered,
|
|
24
|
+
title,
|
|
25
|
+
component: null,
|
|
26
|
+
icon: <WindowRestoreSvg />,
|
|
27
|
+
collapsible: false,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '../../../constants'
|
|
4
|
+
import { IconProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export const ArrowProgressSvg = ({ color = COLORS.N500 }: IconProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
|
|
9
|
+
<path
|
|
10
|
+
d='M294.8 97.8C303.8 94.1 314.1 96.1 321 103L361 143C370.4 152.4 370.4 167.6 361 176.9L321 216.9C314.1 223.8 303.8 225.8 294.8 222.1C285.8 218.4 280 209.7 280 200L280 192L176 192C149.5 192 128 213.5 128 240C128 266.5 149.5 288 176 288L464 288C525.9 288 576 338.1 576 400C576 446.4 547.8 486.1 507.7 503.2C498.4 527.1 475.2 544 448 544C412.7 544 384 515.3 384 480C384 444.7 412.7 416 448 416C466.6 416 483.4 423.9 495 436.6C505.4 427.8 512 414.7 512 400C512 373.5 490.5 352 464 352L176 352C114.1 352 64 301.9 64 240C64 178.1 114.1 128 176 128L280 128L280 120C280 110.3 285.8 101.5 294.8 97.8zM480 96C515.3 96 544 124.7 544 160C544 195.3 515.3 224 480 224C444.7 224 416 195.3 416 160C416 124.7 444.7 96 480 96zM215.4 512C204.3 531.1 183.7 544 160 544C124.7 544 96 515.3 96 480C96 444.7 124.7 416 160 416C183.7 416 204.4 428.9 215.4 448L248 448L248 440C248 430.3 253.8 421.5 262.8 417.8C271.8 414.1 282.1 416.1 289 423L329 463C338.4 472.4 338.4 487.6 329 496.9L289 536.9C282.1 543.8 271.8 545.8 262.8 542.1C253.8 538.4 248 529.7 248 520L248 512L215.4 512z'
|
|
11
|
+
fill='currentColor'
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '../../../constants'
|
|
4
|
+
import { IconProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export const CodeSvg = ({ color = COLORS.N500 }: IconProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
|
|
9
|
+
<path
|
|
10
|
+
d='M392.8 65.2C375.8 60.3 358.1 70.2 353.2 87.2L225.2 535.2C220.3 552.2 230.2 569.9 247.2 574.8C264.2 579.7 281.9 569.8 286.8 552.8L414.8 104.8C419.7 87.8 409.8 70.1 392.8 65.2zM457.4 201.3C444.9 213.8 444.9 234.1 457.4 246.6L530.8 320L457.4 393.4C444.9 405.9 444.9 426.2 457.4 438.7C469.9 451.2 490.2 451.2 502.7 438.7L598.7 342.7C611.2 330.2 611.2 309.9 598.7 297.4L502.7 201.4C490.2 188.9 469.9 188.9 457.4 201.4zM182.7 201.3C170.2 188.8 149.9 188.8 137.4 201.3L41.4 297.3C28.9 309.8 28.9 330.1 41.4 342.6L137.4 438.6C149.9 451.1 170.2 451.1 182.7 438.6C195.2 426.1 195.2 405.8 182.7 393.3L109.3 320L182.6 246.6C195.1 234.1 195.1 213.8 182.6 201.3z'
|
|
11
|
+
fill='currentColor'
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '../../../constants'
|
|
4
|
+
import { IconProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export const SplitSvg = ({ color = COLORS.N500 }: IconProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
|
|
9
|
+
<path
|
|
10
|
+
d='M467.8 66.4C479.8 61.4 493.5 64.2 502.7 73.3L566.7 137.3C572.7 143.3 576.1 151.4 576.1 159.9C576.1 168.4 572.7 176.5 566.7 182.5L502.7 246.5C493.5 255.7 479.8 258.4 467.8 253.4C455.8 248.4 448 236.9 448 224L448 192L410.5 192C402 192 393.9 195.4 387.9 201.4L269.3 320L387.9 438.6C393.9 444.6 402 448 410.5 448L448 448L448 416C448 403.1 455.8 391.4 467.8 386.4C479.8 381.4 493.5 384.2 502.7 393.3L566.7 457.3C572.7 463.3 576.1 471.4 576.1 479.9C576.1 488.4 572.7 496.5 566.7 502.5L502.7 566.5C493.5 575.7 479.8 578.4 467.8 573.4C455.8 568.4 448 556.9 448 544L448 512L410.5 512C385 512 360.6 501.9 342.6 483.9L210.7 352L96 352C78.3 352 64 337.7 64 320C64 302.3 78.3 288 96 288L210.7 288L342.6 156.1C360.6 138.1 385 128 410.5 128L448 128L448 96C448 83.1 455.8 71.4 467.8 66.4z'
|
|
11
|
+
fill='currentColor'
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { COLORS } from '../../../constants'
|
|
4
|
+
import { IconProps } from '../types'
|
|
5
|
+
|
|
6
|
+
export const WindowRestoreSvg = ({ color = COLORS.N500 }: IconProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640' fill={color}>
|
|
9
|
+
<path
|
|
10
|
+
d='M544 160L192 160C192 124.7 220.7 96 256 96L544 96C579.3 96 608 124.7 608 160L608 352C608 387.3 579.3 416 544 416L496 416L496 352L544 352L544 160zM32 288C32 252.7 60.7 224 96 224L384 224C419.3 224 448 252.7 448 288L448 480C448 515.3 419.3 544 384 544L96 544C60.7 544 32 515.3 32 480L32 288zM96 328C96 341.3 106.7 352 120 352L360 352C373.3 352 384 341.3 384 328C384 314.7 373.3 304 360 304L120 304C106.7 304 96 314.7 96 328z'
|
|
11
|
+
fill='currentColor'
|
|
12
|
+
/>
|
|
13
|
+
</svg>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -120,13 +120,14 @@ export const StyledDebugLabel = styled.strong`
|
|
|
120
120
|
`
|
|
121
121
|
|
|
122
122
|
export const StyledDebugValue = styled.div`
|
|
123
|
-
display: flex;
|
|
124
|
-
align-items: center;
|
|
125
|
-
gap: 8px;
|
|
126
123
|
font-weight: 600;
|
|
127
124
|
font-size: 12px;
|
|
128
125
|
color: ${COLORS.N700};
|
|
129
126
|
line-height: 1.5;
|
|
127
|
+
width: 100%;
|
|
128
|
+
overflow-wrap: break-word;
|
|
129
|
+
word-break: break-word;
|
|
130
|
+
white-space: pre-wrap;
|
|
130
131
|
|
|
131
132
|
> svg {
|
|
132
133
|
width: 14px;
|
|
@@ -134,7 +135,9 @@ export const StyledDebugValue = styled.div`
|
|
|
134
135
|
min-width: 14px;
|
|
135
136
|
min-height: 14px;
|
|
136
137
|
flex-shrink: 0;
|
|
137
|
-
display: block;
|
|
138
|
+
display: inline-block;
|
|
139
|
+
vertical-align: middle;
|
|
140
|
+
margin-right: 8px;
|
|
138
141
|
}
|
|
139
142
|
`
|
|
140
143
|
|
|
@@ -2,11 +2,18 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
AiAgentDebugEvent,
|
|
5
|
+
BotActionDebugEvent,
|
|
6
|
+
ConditionalChannelDebugEvent,
|
|
7
|
+
ConditionalCountryDebugEvent,
|
|
8
|
+
ConditionalCustomDebugEvent,
|
|
9
|
+
ConditionalQueueStatusDebugEvent,
|
|
5
10
|
FallbackDebugEvent,
|
|
6
11
|
HandoffSuccessDebugEvent,
|
|
7
12
|
KeywordDebugEvent,
|
|
8
13
|
KnowledgeBaseDebugEvent,
|
|
14
|
+
RedirectFlowDebugEvent,
|
|
9
15
|
SmartIntentDebugEvent,
|
|
16
|
+
WebviewActionTriggeredDebugEvent,
|
|
10
17
|
} from './events'
|
|
11
18
|
|
|
12
19
|
export interface IconProps {
|
|
@@ -21,6 +28,13 @@ export type DebugEvent =
|
|
|
21
28
|
| FallbackDebugEvent
|
|
22
29
|
| SmartIntentDebugEvent
|
|
23
30
|
| HandoffSuccessDebugEvent
|
|
31
|
+
| BotActionDebugEvent
|
|
32
|
+
| ConditionalChannelDebugEvent
|
|
33
|
+
| ConditionalCountryDebugEvent
|
|
34
|
+
| ConditionalCustomDebugEvent
|
|
35
|
+
| ConditionalQueueStatusDebugEvent
|
|
36
|
+
| RedirectFlowDebugEvent
|
|
37
|
+
| WebviewActionTriggeredDebugEvent
|
|
24
38
|
|
|
25
39
|
export interface DebugEventConfig {
|
|
26
40
|
action: string
|
|
@@ -61,9 +61,6 @@ const serialize = (message: string) => {
|
|
|
61
61
|
return { text: message }
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/*
|
|
65
|
-
Reference: https://developers.facebook.com/docs/whatsapp/business-management-api/message-templates/media-card-carousel-templates
|
|
66
|
-
*/
|
|
67
64
|
export const WhatsappMediaCarousel = (props: WhatsappMediaCarouselProps) => {
|
|
68
65
|
const renderBrowser = () => {
|
|
69
66
|
// Return a dummy message for browser
|
package/src/index-types.ts
CHANGED
|
@@ -81,6 +81,13 @@ interface AddSystemResponseArgs {
|
|
|
81
81
|
response: any
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
export interface MinimalHubtypeMessage {
|
|
85
|
+
id: string
|
|
86
|
+
type: string
|
|
87
|
+
action: string
|
|
88
|
+
text: string
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
export interface PreviewUtils {
|
|
85
92
|
getChunkIdsGroupedBySource: (
|
|
86
93
|
chunkIds: string[]
|
|
@@ -88,6 +95,8 @@ export interface PreviewUtils {
|
|
|
88
95
|
onClickOpenChunks: (
|
|
89
96
|
chunkIdsGroupedBySource: ChunkIdsGroupedBySourceData[]
|
|
90
97
|
) => void
|
|
98
|
+
getMessageById: (messageId: string) => Promise<MinimalHubtypeMessage>
|
|
99
|
+
trackPreviewEventOpened: (eventProperties: Record<string, unknown>) => void
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
export interface WebchatArgs {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createContext } from 'react'
|
|
2
2
|
|
|
3
|
+
import { ChunkIdsGroupedBySourceData } from '../../components/system-debug-trace/events/knowledge-bases-types'
|
|
4
|
+
import { MinimalHubtypeMessage } from '../../index-types'
|
|
3
5
|
import { WebchatContextProps, WebchatState } from './types'
|
|
4
6
|
|
|
5
7
|
export { ClientSession, WebchatState } from './types'
|
|
@@ -73,6 +75,21 @@ export const WebchatContext = createContext<WebchatContextProps>({
|
|
|
73
75
|
return
|
|
74
76
|
},
|
|
75
77
|
webchatState: {} as WebchatState,
|
|
78
|
+
previewUtils: {
|
|
79
|
+
trackPreviewEventOpened: () => {
|
|
80
|
+
return
|
|
81
|
+
},
|
|
82
|
+
getChunkIdsGroupedBySource: async () => {
|
|
83
|
+
return [] as ChunkIdsGroupedBySourceData[]
|
|
84
|
+
},
|
|
85
|
+
onClickOpenChunks: () => {
|
|
86
|
+
return
|
|
87
|
+
},
|
|
88
|
+
getMessageById: async () => {
|
|
89
|
+
return {} as MinimalHubtypeMessage
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
|
|
76
93
|
trackEvent: async () => {
|
|
77
94
|
return
|
|
78
95
|
},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
interface ActionCard {
|
|
2
|
-
buttonText: string;
|
|
3
|
-
buttonUrl: string;
|
|
4
|
-
imageLink: string;
|
|
5
|
-
}
|
|
6
|
-
interface Card {
|
|
7
|
-
text: string;
|
|
8
|
-
action: ActionCard;
|
|
9
|
-
}
|
|
10
|
-
export interface WhatsappInteractiveMediaCarouselProps {
|
|
11
|
-
cards: Card[];
|
|
12
|
-
textMessage: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const WhatsappInteractiveMediaCarousel: (props: WhatsappInteractiveMediaCarouselProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WhatsappInteractiveMediaCarousel = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const util_1 = require("../util");
|
|
6
|
-
const button_1 = require("./button");
|
|
7
|
-
const carousel_1 = require("./carousel");
|
|
8
|
-
const element_1 = require("./element");
|
|
9
|
-
const constants_1 = require("./multichannel/whatsapp/constants");
|
|
10
|
-
const pic_1 = require("./pic");
|
|
11
|
-
const title_1 = require("./title");
|
|
12
|
-
/*
|
|
13
|
-
Reference: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/interactive-media-carousel-messages/
|
|
14
|
-
*/
|
|
15
|
-
const WhatsappInteractiveMediaCarousel = (props) => {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(carousel_1.Carousel, Object.assign({ text: (0, util_1.truncateText)(props.textMessage, constants_1.WHATSAPP_MAX_BODY_CHARS) }, { children: props.cards.map((card, index) => ((0, jsx_runtime_1.jsxs)(element_1.Element, { children: [(0, jsx_runtime_1.jsx)(pic_1.Pic, { src: card.action.imageLink }), (0, jsx_runtime_1.jsx)(title_1.Title, { children: (0, util_1.truncateText)(card.text, constants_1.WHATSAPP_MAX_CAROUSEL_CARD_TEXT_CHARS) }), (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ url: card.action.buttonUrl }, { children: (0, util_1.truncateText)(card.action.buttonText, constants_1.WHATSAPP_MAX_BUTTON_CHARS) }))] }, index))) })));
|
|
17
|
-
};
|
|
18
|
-
exports.WhatsappInteractiveMediaCarousel = WhatsappInteractiveMediaCarousel;
|
|
19
|
-
//# sourceMappingURL=whatsapp-interactive-media-carousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-interactive-media-carousel.js","sourceRoot":"","sources":["../../../src/components/whatsapp-interactive-media-carousel.tsx"],"names":[],"mappings":";;;;AAEA,kCAAsC;AACtC,qCAAiC;AACjC,yCAAqC;AACrC,uCAAmC;AACnC,iEAI0C;AAC1C,+BAA2B;AAC3B,mCAA+B;AAkB/B;;EAEE;AACK,MAAM,gCAAgC,GAAG,CAC9C,KAA4C,EAC5C,EAAE;IACF,OAAO,CACL,uBAAC,mBAAQ,kBAAC,IAAI,EAAE,IAAA,mBAAY,EAAC,KAAK,CAAC,WAAW,EAAE,mCAAuB,CAAC,gBACrE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,wBAAC,iBAAO,eACN,uBAAC,SAAG,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,GAAI,EACnC,uBAAC,aAAK,cACH,IAAA,mBAAY,EAAC,IAAI,CAAC,IAAI,EAAE,iDAAqC,CAAC,GACzD,EACR,uBAAC,eAAM,kBAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,gBAC/B,IAAA,mBAAY,EAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,qCAAyB,CAAC,IACzD,KAPG,KAAK,CAQT,CACX,CAAC,IACO,CACZ,CAAA;AACH,CAAC,CAAA;AAlBY,QAAA,gCAAgC,oCAkB5C"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
interface ActionCard {
|
|
2
|
-
buttonText: string;
|
|
3
|
-
buttonUrl: string;
|
|
4
|
-
imageLink: string;
|
|
5
|
-
}
|
|
6
|
-
interface Card {
|
|
7
|
-
text: string;
|
|
8
|
-
action: ActionCard;
|
|
9
|
-
}
|
|
10
|
-
export interface WhatsappInteractiveMediaCarouselProps {
|
|
11
|
-
cards: Card[];
|
|
12
|
-
textMessage: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const WhatsappInteractiveMediaCarousel: (props: WhatsappInteractiveMediaCarouselProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { truncateText } from '../util';
|
|
3
|
-
import { Button } from './button';
|
|
4
|
-
import { Carousel } from './carousel';
|
|
5
|
-
import { Element } from './element';
|
|
6
|
-
import { WHATSAPP_MAX_BODY_CHARS, WHATSAPP_MAX_BUTTON_CHARS, WHATSAPP_MAX_CAROUSEL_CARD_TEXT_CHARS, } from './multichannel/whatsapp/constants';
|
|
7
|
-
import { Pic } from './pic';
|
|
8
|
-
import { Title } from './title';
|
|
9
|
-
/*
|
|
10
|
-
Reference: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/interactive-media-carousel-messages/
|
|
11
|
-
*/
|
|
12
|
-
export const WhatsappInteractiveMediaCarousel = (props) => {
|
|
13
|
-
return (_jsx(Carousel, Object.assign({ text: truncateText(props.textMessage, WHATSAPP_MAX_BODY_CHARS) }, { children: props.cards.map((card, index) => (_jsxs(Element, { children: [_jsx(Pic, { src: card.action.imageLink }), _jsx(Title, { children: truncateText(card.text, WHATSAPP_MAX_CAROUSEL_CARD_TEXT_CHARS) }), _jsx(Button, Object.assign({ url: card.action.buttonUrl }, { children: truncateText(card.action.buttonText, WHATSAPP_MAX_BUTTON_CHARS) }))] }, index))) })));
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=whatsapp-interactive-media-carousel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-interactive-media-carousel.js","sourceRoot":"","sources":["../../../src/components/whatsapp-interactive-media-carousel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAkB/B;;EAEE;AACF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,KAA4C,EAC5C,EAAE;IACF,OAAO,CACL,KAAC,QAAQ,kBAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,CAAC,gBACrE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,MAAC,OAAO,eACN,KAAC,GAAG,IAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,GAAI,EACnC,KAAC,KAAK,cACH,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,qCAAqC,CAAC,GACzD,EACR,KAAC,MAAM,kBAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,gBAC/B,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,yBAAyB,CAAC,IACzD,KAPG,KAAK,CAQT,CACX,CAAC,IACO,CACZ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
import { truncateText } from '../util'
|
|
4
|
-
import { Button } from './button'
|
|
5
|
-
import { Carousel } from './carousel'
|
|
6
|
-
import { Element } from './element'
|
|
7
|
-
import {
|
|
8
|
-
WHATSAPP_MAX_BODY_CHARS,
|
|
9
|
-
WHATSAPP_MAX_BUTTON_CHARS,
|
|
10
|
-
WHATSAPP_MAX_CAROUSEL_CARD_TEXT_CHARS,
|
|
11
|
-
} from './multichannel/whatsapp/constants'
|
|
12
|
-
import { Pic } from './pic'
|
|
13
|
-
import { Title } from './title'
|
|
14
|
-
|
|
15
|
-
interface ActionCard {
|
|
16
|
-
buttonText: string
|
|
17
|
-
buttonUrl: string
|
|
18
|
-
imageLink: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Card {
|
|
22
|
-
text: string
|
|
23
|
-
action: ActionCard
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface WhatsappInteractiveMediaCarouselProps {
|
|
27
|
-
cards: Card[]
|
|
28
|
-
textMessage: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/*
|
|
32
|
-
Reference: https://developers.facebook.com/docs/whatsapp/cloud-api/messages/interactive-media-carousel-messages/
|
|
33
|
-
*/
|
|
34
|
-
export const WhatsappInteractiveMediaCarousel = (
|
|
35
|
-
props: WhatsappInteractiveMediaCarouselProps
|
|
36
|
-
) => {
|
|
37
|
-
return (
|
|
38
|
-
<Carousel text={truncateText(props.textMessage, WHATSAPP_MAX_BODY_CHARS)}>
|
|
39
|
-
{props.cards.map((card, index) => (
|
|
40
|
-
<Element key={index}>
|
|
41
|
-
<Pic src={card.action.imageLink} />
|
|
42
|
-
<Title>
|
|
43
|
-
{truncateText(card.text, WHATSAPP_MAX_CAROUSEL_CARD_TEXT_CHARS)}
|
|
44
|
-
</Title>
|
|
45
|
-
<Button url={card.action.buttonUrl}>
|
|
46
|
-
{truncateText(card.action.buttonText, WHATSAPP_MAX_BUTTON_CHARS)}
|
|
47
|
-
</Button>
|
|
48
|
-
</Element>
|
|
49
|
-
))}
|
|
50
|
-
</Carousel>
|
|
51
|
-
)
|
|
52
|
-
}
|