Skip to content

Commit aa38e7f

Browse files
authored
feat: avoid apply twice markdownMeta function (#2993)
## Description Avoid apply twice markdownMeta when transform Text with one url button to WhatsappCTAURLBUtoon inside Multichannel
1 parent 5ebe8e1 commit aa38e7f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/botonic-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@botonic/react",
3-
"version": "0.33.0",
3+
"version": "0.33.1",
44
"license": "MIT",
55
"description": "Build Chatbots using React",
66
"main": "./lib/cjs",

packages/botonic-react/src/components/multichannel/multichannel-text.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ export const MultichannelText = props => {
164164
}
165165
return row
166166
})
167-
const whatsbuttonlistProps = {
167+
const whatsAppButtonListProps = {
168168
body: index === 0 ? texts.join('') : buttonsTextSeparator,
169169
button: menuButtonTextWhatsappList,
170170
sections: [{ rows }],
171171
}
172172

173173
return {
174174
type: INPUT.WHATSAPP_BUTTON_LIST,
175-
props: whatsbuttonlistProps,
175+
props: whatsAppButtonListProps,
176176
}
177177
}
178178
)
@@ -239,10 +239,14 @@ export const MultichannelText = props => {
239239
)
240240

241241
if (postbackButtonElements.length === 0) {
242+
// Use texts[0] instead of textElements[0] as a body to avoid apply the markdownMeta function twice.
243+
// If the markdownMeta function is applied twice, bold is replaced by italics.
244+
const body = texts[0] || ''
245+
242246
if (urlButtonElements.length === 1) {
243247
return (
244248
<WhatsappCTAUrlButton
245-
body={textElements[0]}
249+
body={body}
246250
displayText={urlButtonElements[0].props.children}
247251
url={urlButtonElements[0].props.url}
248252
/>
@@ -252,7 +256,7 @@ export const MultichannelText = props => {
252256
if (webviewButtonElements.length === 1) {
253257
return (
254258
<WhatsappCTAUrlButton
255-
body={textElements[0]}
259+
body={body}
256260
displayText={webviewButtonElements[0].props.children}
257261
webview={webviewButtonElements[0].props.webview}
258262
params={webviewButtonElements[0].props.params}

0 commit comments

Comments
 (0)