@bikdotai/bik-component-library 0.0.802 → 0.0.803
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/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js.map +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +4 -3
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js.map +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js.map +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +4 -3
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/chevronDownOutline.svg.js"),r=require("../../../assets/icons/copy-code-icon.svg.js"),s=require("../../../assets/icons/halfRectangle.svg.js"),i=require("../../../assets/icons/phone.svg.js"),a=require("../../../assets/icons/qrb.svg.js"),o=require("../../../assets/icons/RedirectToNew.svg.js"),l=require("styled-components"),n=require("../../template-context-mapper/context/templateModalContext.js"),d=require("../../tooltips/Tooltip.js"),p=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),x=require("../helpers/VariableEditorHelper.js"),c=require("../models/TemplateMeta.js"),h=require("./ChatBtn.js"),m=require("./ChatUI.style.js"),j=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/chevronDownOutline.svg.js"),r=require("../../../assets/icons/copy-code-icon.svg.js"),s=require("../../../assets/icons/halfRectangle.svg.js"),i=require("../../../assets/icons/phone.svg.js"),a=require("../../../assets/icons/qrb.svg.js"),o=require("../../../assets/icons/RedirectToNew.svg.js"),l=require("styled-components"),n=require("../../template-context-mapper/context/templateModalContext.js"),d=require("../../tooltips/Tooltip.js"),p=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),x=require("../helpers/VariableEditorHelper.js"),c=require("../models/TemplateMeta.js"),h=require("./ChatBtn.js"),m=require("./ChatUI.style.js"),j=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),T=require("./MediaCard.js");function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=C(l);const y=f.default.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -7.7px;
|
|
6
6
|
top: -8px;
|
|
7
|
-
`,g=
|
|
7
|
+
`,g=f.default.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
14
|
color: ${u.COLORS.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,E=f.default(g)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,v=new x.VariableEditorHelper;exports.ChatUIV2=l=>{const{bodyText:u,footerText:x,headerMediaType:C,headerText:f,headerAssetLink:O,headerAssetName:I,quickReplybtn:S,ctaBtn:_,actionTypes:L,extras:q,showHeader:P,imagePreviewStyles:b,size:w,bodyVariableList:A,headerVariableList:N,buttons:R,limitedTimeOfferComponent:M,carouselCardIndex:H,isWhatsappCarousel:B,isPreview:Y,children:F,hideFooter:D=!1}=l,U=v.format(null==u?void 0:u.replace(/</g,"<").replace(/>/g,">"),A),V=v.format(null==f?void 0:f.replace(/</g,"<").replace(/>/g,">"),N),{selectedCarouselIndex:k,isProductCarouselType:z,errorIndexes:Q,isCarouselHovered:W}=n.useTemplateModalContext(),K={COPY_CODE:r.default,PHONE_NUMBER:i.default,URL:o.default,QUICK_REPLY:a.default,VOICE_CALL:i.default,CALL_PERMISSION:t.default,REQUEST_CONTACT_INFO:void 0};return e.jsxs(m.Container,Object.assign({isCarouselCard:null!=H&&H>-1,showBorder:null!=H&&H===k||z&&null!=H&&H>-1&&null!=k&&k>-1,hasError:null==Q?void 0:Q.includes(null!=H?H:-2),isWhatsappCarousel:B,isPreview:Y,showDashedBorder:z&&W&&(null!=k?k:-1)<0&&(null!=H?H:-1)>-1},{children:[!B&&e.jsx(y,{children:e.jsx(s.default,{color:"white",height:8,width:8})}),C===c.HEADER_TYPES.TEXT?e.jsx(E,{dangerouslySetInnerHTML:{__html:V}}):C!==c.HEADER_TYPES.NONE?e.jsx(T.MediaCard,{headerAssetLink:O,headerAssetName:I,mediaType:C,imagePreviewStyles:C===c.HEADER_TYPES.IMAGE?b:{}}):e.jsx(e.Fragment,{}),(null==M?void 0:M.dateTime)?e.jsx(j.LimitedTimeOffer,{text:M.text,dateTime:M.dateTime,code:M.code}):e.jsx(e.Fragment,{}),!!u&&e.jsx(e.Fragment,{children:e.jsx(g,{dangerouslySetInnerHTML:{__html:U},style:{flex:1}})}),F,!D&&e.jsxs(m.FooterWrapper,{children:[e.jsx(d.Tooltip,Object.assign({body:null!=x?x:"",placement:"top"},{children:e.jsx(m.FooterText,Object.assign({style:{flex:1}},{children:x}))})),e.jsx(m.TimeStamp,{children:"16:48"})]}),R&&R.length>0?R.map(((t,r)=>e.jsx(h.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:K[t.type],size:w,iconPosition:"CALL_PERMISSION"===t.type?"right":"left",textTypography:"CALL_PERMISSION"===t.type?p.TitleSmall:void 0},r))):L===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==S?void 0:S.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):L===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==_?void 0:_.map(((t,r)=>e.jsx(h.ChatBtn,{textTypography:P?p.Caption:p.BodySecondary,extraContent:q?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?i.default:o.default,size:w},r)))}):e.jsx(e.Fragment,{})]}))},exports.HtmlContainer=g;
|
|
20
20
|
//# sourceMappingURL=ChatUiV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatUiV2.js","sources":["../../../../../src/components/template-preview/WhatsApp/ChatUiV2.tsx"],"sourcesContent":["import ChevronDownIcon from '@src/assets/icons/chevronDownOutline.svg';\nimport CopyCodeIcon from '@src/assets/icons/copy-code-icon.svg';\nimport HalfRectangleIcon from '@src/assets/icons/halfRectangle.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport QRBIcon from '@src/assets/icons/qrb.svg';\nimport RedirectToIcon from '@src/assets/icons/RedirectToNew.svg';\nimport styled from 'styled-components';\nimport { useTemplateModalContext } from '@src/components/template-context-mapper/context/templateModalContext';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodySecondary,\n\tCaption,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariableEditorHelper } from '../helpers/VariableEditorHelper';\nimport { ACTIONS_TYPES, HEADER_TYPES } from '../models/TemplateMeta';\nimport {\n\tWhatsappLikePreviewTypes,\n\tWhatsappTemplateButtonTypes,\n} from '../models/WhatsAppTemplate';\nimport { ChatBtn } from './ChatBtn';\nimport {\n\tContainer,\n\tFooterText,\n\tFooterWrapper,\n\tTimeStamp,\n} from './ChatUI.style';\nimport { LimitedTimeOffer } from './LimitedTimeOffer/LimitedTimeOffer.index';\nimport { MediaCard } from './MediaCard';\n\nconst SideCaret = styled.div`\n\tposition: absolute;\n\twidth: 8px;\n\theight: 8px;\n\tleft: -7.7px;\n\ttop: -8px;\n`;\n\nexport const HtmlContainer = styled.div`\n\tfont-family: 'Inter';\n\tfont-style: normal;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpadding: 8px 12px 0px;\n\tcolor: ${COLORS.content.primary};\n\tword-wrap: break-word;\n`;\n\nconst HeaderTextContainer = styled(HtmlContainer)`\n\tfont-weight: 600;\n\tmargin-bottom: 8px;\n`;\n\nconst variableEditorHelper = new VariableEditorHelper();\n\nexport const ChatUIV2 = (props: WhatsappLikePreviewTypes) => {\n\tconst {\n\t\tbodyText,\n\t\tfooterText,\n\t\theaderMediaType,\n\t\theaderText,\n\t\theaderAssetLink,\n\t\theaderAssetName,\n\t\tquickReplybtn,\n\t\tctaBtn,\n\t\tactionTypes,\n\t\textras,\n\t\tshowHeader,\n\t\timagePreviewStyles,\n\t\tsize,\n\t\tbodyVariableList,\n\t\theaderVariableList,\n\t\tbuttons,\n\t\tlimitedTimeOfferComponent,\n\t\tcarouselCardIndex,\n\t\tisWhatsappCarousel,\n\t\tisPreview,\n\t\tchildren,\n\t\thideFooter = false,\n\t} = props;\n\n\tconst bodyHTML = variableEditorHelper.format(\n\t\tbodyText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\tbodyVariableList,\n\t);\n\tconst headerHtml = variableEditorHelper.format(\n\t\theaderText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\theaderVariableList,\n\t);\n\tconst {\n\t\tselectedCarouselIndex,\n\t\tisProductCarouselType,\n\t\terrorIndexes,\n\t\tisCarouselHovered,\n\t} = useTemplateModalContext();\n\n\tconst icons: Record<WhatsappTemplateButtonTypes, React.FC> = {\n\t\tCOPY_CODE: CopyCodeIcon,\n\t\tPHONE_NUMBER: PhoneIcon,\n\t\tURL: RedirectToIcon,\n\t\tQUICK_REPLY: QRBIcon,\n\t\tVOICE_CALL: PhoneIcon,\n\t\tCALL_PERMISSION: ChevronDownIcon,\n\t};\n\n\treturn (\n\t\t<Container\n\t\t\tisCarouselCard={carouselCardIndex != undefined && carouselCardIndex > -1}\n\t\t\tshowBorder={\n\t\t\t\t(carouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex === selectedCarouselIndex) ||\n\t\t\t\t(isProductCarouselType &&\n\t\t\t\t\tcarouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex > -1 &&\n\t\t\t\t\tselectedCarouselIndex != undefined &&\n\t\t\t\t\tselectedCarouselIndex > -1)\n\t\t\t}\n\t\t\thasError={errorIndexes?.includes(carouselCardIndex ?? -2)}\n\t\t\tisWhatsappCarousel={isWhatsappCarousel}\n\t\t\tisPreview={isPreview}\n\t\t\tshowDashedBorder={\n\t\t\t\tisProductCarouselType &&\n\t\t\t\tisCarouselHovered &&\n\t\t\t\t(selectedCarouselIndex ?? -1) < 0 &&\n\t\t\t\t(carouselCardIndex ?? -1) > -1\n\t\t\t}\n\t\t>\n\t\t\t{!isWhatsappCarousel && (\n\t\t\t\t<SideCaret>\n\t\t\t\t\t<HalfRectangleIcon color={'white'} height={8} width={8} />\n\t\t\t\t</SideCaret>\n\t\t\t)}\n\t\t\t{headerMediaType === HEADER_TYPES.TEXT ? (\n\t\t\t\t<HeaderTextContainer\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: headerHtml,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : headerMediaType !== HEADER_TYPES.NONE ? (\n\t\t\t\t<MediaCard\n\t\t\t\t\theaderAssetLink={headerAssetLink}\n\t\t\t\t\theaderAssetName={headerAssetName}\n\t\t\t\t\tmediaType={headerMediaType}\n\t\t\t\t\timagePreviewStyles={\n\t\t\t\t\t\theaderMediaType === HEADER_TYPES.IMAGE ? imagePreviewStyles : {}\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{/* Rendering LTO if dateTime exists */}\n\t\t\t{limitedTimeOfferComponent?.dateTime ? (\n\t\t\t\t<LimitedTimeOffer\n\t\t\t\t\ttext={limitedTimeOfferComponent.text}\n\t\t\t\t\tdateTime={limitedTimeOfferComponent.dateTime}\n\t\t\t\t\tcode={limitedTimeOfferComponent.code}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{!!bodyText && (\n\t\t\t\t<>\n\t\t\t\t\t<HtmlContainer\n\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t__html: bodyHTML,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{children}\n\t\t\t{!hideFooter && (\n\t\t\t\t<FooterWrapper>\n\t\t\t\t\t<Tooltip body={footerText ?? ''} placement={'top'}>\n\t\t\t\t\t\t<FooterText style={{ flex: 1 }}>{footerText}</FooterText>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<TimeStamp>16:48</TimeStamp>\n\t\t\t\t</FooterWrapper>\n\t\t\t)}\n\n\t\t\t{/* Instead of action Type, this renders ChatBtn for all buttons. Rest of the code based on Action Type is maintained for backward compatibility */}\n\t\t\t{buttons && buttons.length > 0 ? (\n\t\t\t\tbuttons.map((button, i) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttext={button.type === 'COPY_CODE' ? 'Copy code' : button.text}\n\t\t\t\t\t\t\tIcon={icons[button.type]}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t\ticonPosition={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? 'right' : 'left'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttextTypography={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? TitleSmall : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) : actionTypes === ACTIONS_TYPES.QUICK_REPLY ? (\n\t\t\t\t<div>\n\t\t\t\t\t{quickReplybtn?.map((button, i) => (\n\t\t\t\t\t\t<ChatBtn key={i} text={button.text} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : actionTypes === ACTIONS_TYPES.CTA_BTN ? (\n\t\t\t\t<div>\n\t\t\t\t\t{ctaBtn?.map((ctaBtn, i) => (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttextTypography={showHeader ? Caption : BodySecondary}\n\t\t\t\t\t\t\textraContent={extras ? ctaBtn.extra : undefined}\n\t\t\t\t\t\t\tplaceholder={ctaBtn.placeholder}\n\t\t\t\t\t\t\ttext={ctaBtn.text}\n\t\t\t\t\t\t\tIcon={ctaBtn.type === 'phoneNumber' ? PhoneIcon : RedirectToIcon}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["SideCaret","styled","div","HtmlContainer","COLORS","content","primary","HeaderTextContainer","variableEditorHelper","VariableEditorHelper","props","bodyText","footerText","headerMediaType","headerText","headerAssetLink","headerAssetName","quickReplybtn","ctaBtn","actionTypes","extras","showHeader","imagePreviewStyles","size","bodyVariableList","headerVariableList","buttons","limitedTimeOfferComponent","carouselCardIndex","isWhatsappCarousel","isPreview","children","hideFooter","bodyHTML","format","replace","headerHtml","selectedCarouselIndex","isProductCarouselType","errorIndexes","isCarouselHovered","useTemplateModalContext","icons","COPY_CODE","CopyCodeIcon","PHONE_NUMBER","PhoneIcon","URL","RedirectToIcon","QUICK_REPLY","QRBIcon","VOICE_CALL","CALL_PERMISSION","ChevronDownIcon","_jsxs","Container","Object","assign","isCarouselCard","undefined","showBorder","hasError","includes","showDashedBorder","_jsx","jsx","HalfRectangleIcon","color","height","width","HEADER_TYPES","TEXT","dangerouslySetInnerHTML","__html","NONE","MediaCard","mediaType","IMAGE","_Fragment","Fragment","dateTime","LimitedTimeOffer","text","code","style","flex","FooterWrapper","Tooltip","body","placement","FooterText","TimeStamp","length","map","button","i","ChatBtn","type","Icon","iconPosition","textTypography","TitleSmall","ACTIONS_TYPES","CTA_BTN","Caption","BodySecondary","extraContent","extra","placeholder"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ChatUiV2.js","sources":["../../../../../src/components/template-preview/WhatsApp/ChatUiV2.tsx"],"sourcesContent":["import ChevronDownIcon from '@src/assets/icons/chevronDownOutline.svg';\nimport CopyCodeIcon from '@src/assets/icons/copy-code-icon.svg';\nimport HalfRectangleIcon from '@src/assets/icons/halfRectangle.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport QRBIcon from '@src/assets/icons/qrb.svg';\nimport RedirectToIcon from '@src/assets/icons/RedirectToNew.svg';\nimport styled from 'styled-components';\nimport { useTemplateModalContext } from '@src/components/template-context-mapper/context/templateModalContext';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodySecondary,\n\tCaption,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariableEditorHelper } from '../helpers/VariableEditorHelper';\nimport { ACTIONS_TYPES, HEADER_TYPES } from '../models/TemplateMeta';\nimport {\n\tWhatsappLikePreviewTypes,\n\tWhatsappTemplateButtonTypes,\n} from '../models/WhatsAppTemplate';\nimport { ChatBtn } from './ChatBtn';\nimport {\n\tContainer,\n\tFooterText,\n\tFooterWrapper,\n\tTimeStamp,\n} from './ChatUI.style';\nimport { LimitedTimeOffer } from './LimitedTimeOffer/LimitedTimeOffer.index';\nimport { MediaCard } from './MediaCard';\n\nconst SideCaret = styled.div`\n\tposition: absolute;\n\twidth: 8px;\n\theight: 8px;\n\tleft: -7.7px;\n\ttop: -8px;\n`;\n\nexport const HtmlContainer = styled.div`\n\tfont-family: 'Inter';\n\tfont-style: normal;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpadding: 8px 12px 0px;\n\tcolor: ${COLORS.content.primary};\n\tword-wrap: break-word;\n`;\n\nconst HeaderTextContainer = styled(HtmlContainer)`\n\tfont-weight: 600;\n\tmargin-bottom: 8px;\n`;\n\nconst variableEditorHelper = new VariableEditorHelper();\n\nexport const ChatUIV2 = (props: WhatsappLikePreviewTypes) => {\n\tconst {\n\t\tbodyText,\n\t\tfooterText,\n\t\theaderMediaType,\n\t\theaderText,\n\t\theaderAssetLink,\n\t\theaderAssetName,\n\t\tquickReplybtn,\n\t\tctaBtn,\n\t\tactionTypes,\n\t\textras,\n\t\tshowHeader,\n\t\timagePreviewStyles,\n\t\tsize,\n\t\tbodyVariableList,\n\t\theaderVariableList,\n\t\tbuttons,\n\t\tlimitedTimeOfferComponent,\n\t\tcarouselCardIndex,\n\t\tisWhatsappCarousel,\n\t\tisPreview,\n\t\tchildren,\n\t\thideFooter = false,\n\t} = props;\n\n\tconst bodyHTML = variableEditorHelper.format(\n\t\tbodyText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\tbodyVariableList,\n\t);\n\tconst headerHtml = variableEditorHelper.format(\n\t\theaderText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\theaderVariableList,\n\t);\n\tconst {\n\t\tselectedCarouselIndex,\n\t\tisProductCarouselType,\n\t\terrorIndexes,\n\t\tisCarouselHovered,\n\t} = useTemplateModalContext();\n\n\tconst icons: Record<WhatsappTemplateButtonTypes, React.FC | undefined> = {\n\t\tCOPY_CODE: CopyCodeIcon,\n\t\tPHONE_NUMBER: PhoneIcon,\n\t\tURL: RedirectToIcon,\n\t\tQUICK_REPLY: QRBIcon,\n\t\tVOICE_CALL: PhoneIcon,\n\t\tCALL_PERMISSION: ChevronDownIcon,\n\t\tREQUEST_CONTACT_INFO: undefined,\n\t};\n\n\treturn (\n\t\t<Container\n\t\t\tisCarouselCard={carouselCardIndex != undefined && carouselCardIndex > -1}\n\t\t\tshowBorder={\n\t\t\t\t(carouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex === selectedCarouselIndex) ||\n\t\t\t\t(isProductCarouselType &&\n\t\t\t\t\tcarouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex > -1 &&\n\t\t\t\t\tselectedCarouselIndex != undefined &&\n\t\t\t\t\tselectedCarouselIndex > -1)\n\t\t\t}\n\t\t\thasError={errorIndexes?.includes(carouselCardIndex ?? -2)}\n\t\t\tisWhatsappCarousel={isWhatsappCarousel}\n\t\t\tisPreview={isPreview}\n\t\t\tshowDashedBorder={\n\t\t\t\tisProductCarouselType &&\n\t\t\t\tisCarouselHovered &&\n\t\t\t\t(selectedCarouselIndex ?? -1) < 0 &&\n\t\t\t\t(carouselCardIndex ?? -1) > -1\n\t\t\t}\n\t\t>\n\t\t\t{!isWhatsappCarousel && (\n\t\t\t\t<SideCaret>\n\t\t\t\t\t<HalfRectangleIcon color={'white'} height={8} width={8} />\n\t\t\t\t</SideCaret>\n\t\t\t)}\n\t\t\t{headerMediaType === HEADER_TYPES.TEXT ? (\n\t\t\t\t<HeaderTextContainer\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: headerHtml,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : headerMediaType !== HEADER_TYPES.NONE ? (\n\t\t\t\t<MediaCard\n\t\t\t\t\theaderAssetLink={headerAssetLink}\n\t\t\t\t\theaderAssetName={headerAssetName}\n\t\t\t\t\tmediaType={headerMediaType}\n\t\t\t\t\timagePreviewStyles={\n\t\t\t\t\t\theaderMediaType === HEADER_TYPES.IMAGE ? imagePreviewStyles : {}\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{/* Rendering LTO if dateTime exists */}\n\t\t\t{limitedTimeOfferComponent?.dateTime ? (\n\t\t\t\t<LimitedTimeOffer\n\t\t\t\t\ttext={limitedTimeOfferComponent.text}\n\t\t\t\t\tdateTime={limitedTimeOfferComponent.dateTime}\n\t\t\t\t\tcode={limitedTimeOfferComponent.code}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{!!bodyText && (\n\t\t\t\t<>\n\t\t\t\t\t<HtmlContainer\n\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t__html: bodyHTML,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{children}\n\t\t\t{!hideFooter && (\n\t\t\t\t<FooterWrapper>\n\t\t\t\t\t<Tooltip body={footerText ?? ''} placement={'top'}>\n\t\t\t\t\t\t<FooterText style={{ flex: 1 }}>{footerText}</FooterText>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<TimeStamp>16:48</TimeStamp>\n\t\t\t\t</FooterWrapper>\n\t\t\t)}\n\n\t\t\t{/* Instead of action Type, this renders ChatBtn for all buttons. Rest of the code based on Action Type is maintained for backward compatibility */}\n\t\t\t{buttons && buttons.length > 0 ? (\n\t\t\t\tbuttons.map((button, i) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttext={button.type === 'COPY_CODE' ? 'Copy code' : button.text}\n\t\t\t\t\t\t\tIcon={icons[button.type]}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t\ticonPosition={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? 'right' : 'left'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttextTypography={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? TitleSmall : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) : actionTypes === ACTIONS_TYPES.QUICK_REPLY ? (\n\t\t\t\t<div>\n\t\t\t\t\t{quickReplybtn?.map((button, i) => (\n\t\t\t\t\t\t<ChatBtn key={i} text={button.text} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : actionTypes === ACTIONS_TYPES.CTA_BTN ? (\n\t\t\t\t<div>\n\t\t\t\t\t{ctaBtn?.map((ctaBtn, i) => (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttextTypography={showHeader ? Caption : BodySecondary}\n\t\t\t\t\t\t\textraContent={extras ? ctaBtn.extra : undefined}\n\t\t\t\t\t\t\tplaceholder={ctaBtn.placeholder}\n\t\t\t\t\t\t\ttext={ctaBtn.text}\n\t\t\t\t\t\t\tIcon={ctaBtn.type === 'phoneNumber' ? PhoneIcon : RedirectToIcon}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["SideCaret","styled","div","HtmlContainer","COLORS","content","primary","HeaderTextContainer","variableEditorHelper","VariableEditorHelper","props","bodyText","footerText","headerMediaType","headerText","headerAssetLink","headerAssetName","quickReplybtn","ctaBtn","actionTypes","extras","showHeader","imagePreviewStyles","size","bodyVariableList","headerVariableList","buttons","limitedTimeOfferComponent","carouselCardIndex","isWhatsappCarousel","isPreview","children","hideFooter","bodyHTML","format","replace","headerHtml","selectedCarouselIndex","isProductCarouselType","errorIndexes","isCarouselHovered","useTemplateModalContext","icons","COPY_CODE","CopyCodeIcon","PHONE_NUMBER","PhoneIcon","URL","RedirectToIcon","QUICK_REPLY","QRBIcon","VOICE_CALL","CALL_PERMISSION","ChevronDownIcon","REQUEST_CONTACT_INFO","undefined","_jsxs","Container","Object","assign","isCarouselCard","showBorder","hasError","includes","showDashedBorder","_jsx","jsx","HalfRectangleIcon","color","height","width","HEADER_TYPES","TEXT","dangerouslySetInnerHTML","__html","NONE","MediaCard","mediaType","IMAGE","_Fragment","Fragment","dateTime","LimitedTimeOffer","text","code","style","flex","FooterWrapper","Tooltip","body","placement","FooterText","TimeStamp","length","map","button","i","ChatBtn","type","Icon","iconPosition","textTypography","TitleSmall","ACTIONS_TYPES","CTA_BTN","Caption","BodySecondary","extraContent","extra","placeholder"],"mappings":"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"}
|
|
@@ -19,7 +19,7 @@ export type WhatsAppTemplate = {
|
|
|
19
19
|
has_expiration: boolean;
|
|
20
20
|
};
|
|
21
21
|
buttons?: {
|
|
22
|
-
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL';
|
|
22
|
+
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'REQUEST_CONTACT_INFO';
|
|
23
23
|
text?: string;
|
|
24
24
|
url?: string;
|
|
25
25
|
example?: string[];
|
|
@@ -59,7 +59,7 @@ export type WhatsAppTemplate = {
|
|
|
59
59
|
showCallPermissionCard?: boolean;
|
|
60
60
|
callPermissionText?: string;
|
|
61
61
|
};
|
|
62
|
-
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'CALL_PERMISSION';
|
|
62
|
+
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'CALL_PERMISSION' | 'REQUEST_CONTACT_INFO';
|
|
63
63
|
export type CreateTemplateType = {
|
|
64
64
|
/** Data */
|
|
65
65
|
headerType: HEADER_TYPES;
|
|
@@ -291,7 +291,8 @@ export declare enum BUTTON_TYPE {
|
|
|
291
291
|
URL = "URL",
|
|
292
292
|
PHONE_NUMBER = "PHONE_NUMBER",
|
|
293
293
|
COPY_CODE = "COPY_CODE",
|
|
294
|
-
VOICE_CALL = "VOICE_CALL"
|
|
294
|
+
VOICE_CALL = "VOICE_CALL",
|
|
295
|
+
REQUEST_CONTACT_INFO = "REQUEST_CONTACT_INFO"
|
|
295
296
|
}
|
|
296
297
|
export declare enum POD {
|
|
297
298
|
CHATBOT = "CHATBOT",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var E,T,O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_QUALITY=void 0,(E=exports.TEMPLATE_QUALITY||(exports.TEMPLATE_QUALITY={})).GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",E.UNKNOWN="UNKNOWN",exports.BUTTON_TYPE=void 0,(T=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",T.URL="URL",T.PHONE_NUMBER="PHONE_NUMBER",T.COPY_CODE="COPY_CODE",T.VOICE_CALL="VOICE_CALL",exports.POD=void 0,(O=exports.POD||(exports.POD={})).CHATBOT="CHATBOT",O.GROWTH="GROWTH",O.CAMPAIGN="CAMPAIGN",O.CRM="CRM",O.INTEGRATIONS="INTEGRATIONS",O.OPENAI="OPENAI",O.DM="DM",O.FRONTEND="FRONTEND";
|
|
1
|
+
"use strict";var E,T,O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_QUALITY=void 0,(E=exports.TEMPLATE_QUALITY||(exports.TEMPLATE_QUALITY={})).GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",E.UNKNOWN="UNKNOWN",exports.BUTTON_TYPE=void 0,(T=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",T.URL="URL",T.PHONE_NUMBER="PHONE_NUMBER",T.COPY_CODE="COPY_CODE",T.VOICE_CALL="VOICE_CALL",T.REQUEST_CONTACT_INFO="REQUEST_CONTACT_INFO",exports.POD=void 0,(O=exports.POD||(exports.POD={})).CHATBOT="CHATBOT",O.GROWTH="GROWTH",O.CAMPAIGN="CAMPAIGN",O.CRM="CRM",O.INTEGRATIONS="INTEGRATIONS",O.OPENAI="OPENAI",O.DM="DM",O.FRONTEND="FRONTEND";
|
|
2
2
|
//# sourceMappingURL=WhatsAppTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsAppTemplate.js","sources":["../../../../../src/components/template-preview/models/WhatsAppTemplate.ts"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { variableType } from '../helpers/VariableEditorHelper';\nimport { CHANNEL_TYPE } from './Channels';\nimport {\n\tACTIONS_TYPES,\n\tButtonPlaceHolderOptions,\n\tCUSTOM_VARIABLE,\n\tHEADER_TYPES,\n\tQUICK_REPLY_BUTTON,\n\tTEMPLATE_STATUS,\n} from './TemplateMeta';\n\nexport type WhatsAppTemplate = {\n\tname: string;\n\tlabel: string;\n\trecommended?: boolean;\n\ttemplateId?: string;\n\tchannel: CHANNEL_TYPE;\n\ttemplateCategory: string;\n\ttype?: 'email' | 'whatsapp';\n\tcomponents: {\n\t\ttype:\n\t\t\t| 'HEADER'\n\t\t\t| 'BODY'\n\t\t\t| 'BUTTONS'\n\t\t\t| 'FOOTER'\n\t\t\t| 'limited_time_offer'\n\t\t\t| 'TITLE';\n\t\tformat?: HEADER_TYPES;\n\t\ttext?: string;\n\t\tlimited_time_offer?: {\n\t\t\ttext: string;\n\t\t\thas_expiration: boolean;\n\t\t};\n\t\tbuttons?: {\n\t\t\ttype: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL';\n\t\t\ttext?: string;\n\t\t\turl?: string;\n\t\t\texample?: string[];\n\t\t\tlinkMode?: 'custom' | 'home';\n\t\t\tphone_number?: string;\n\t\t\tflowName?: string;\n\t\t\tflowId?: string;\n\t\t}[];\n\t\texample?: {\n\t\t\theader_handle?: Array<string>;\n\t\t\tbody_text?: Array<string[]>;\n\t\t\theader_text?: Array<string>;\n\t\t\tlimited_time_offer?: string;\n\t\t\ttitle_text?: Array<string[]>;\n\t\t};\n\t}[];\n\tmapping: {\n\t\theader?: string[];\n\t\tbody?: string[];\n\t\tbuttons?: string[];\n\t\ttitle?: string[];\n\t};\n\n\thtmlContentUrl?: string;\n\tlanguage: 'en_US';\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\tthumbnailImageUrl?: string;\n\tFB_blob_key?: string;\n\treason?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tisDraft?: boolean;\n\tnewQualityScore?: TEMPLATE_QUALITY;\n\tpreviousQualityScore?: TEMPLATE_QUALITY;\n\taiContentConfigId?: string;\n\tisAiGenerated?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\n\nexport type WhatsappTemplateButtonTypes =\n\t| 'QUICK_REPLY'\n\t| 'URL'\n\t| 'PHONE_NUMBER'\n\t| 'COPY_CODE'\n\t| 'VOICE_CALL'\n\t| 'CALL_PERMISSION';\n\nexport type CreateTemplateType = {\n\t/** Data */\n\theaderType: HEADER_TYPES;\n\theaderAssetLink?: string | null;\n\theaderAssetName?: string | null;\n\theaderText?: string;\n\n\theaderVariables: templateVariable[];\n\tbodyVariables: templateVariable[];\n\ttitleVariables?: templateVariable[];\n\n\tbodyText?: string;\n\ttitleText?: string;\n\tbodyTextRaw?: string;\n\n\tfooterText?: string;\n\n\tactionsType: ACTIONS_TYPES;\n\n\tquickReply: Array<QUICK_REPLY_BUTTON>;\n\tctaBtn: {\n\t\tphoneNumber?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tphoneNumber?: string;\n\t\t};\n\t\twebsiteLinkBtn?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tlinkOpens?: string;\n\t\t\tplaceholder?: string;\n\t\t};\n\t};\n\tallButtons: WhatsappPreviewButtonType[];\n\n\tmeta: {\n\t\tname: string;\n\t\tcategory?: string;\n\t\tsubCategory?: string;\n\t\tlanguage?: string;\n\t\ttemplateId?: string;\n\t};\n\n\tmode: 'edit' | 'create';\n\talreadyAsADraft?: boolean;\n\t/** UI */\n\tinitialLoading: boolean;\n\n\tlimitedTimeOfferComponent: {\n\t\ttext: string;\n\t\tdateTime: string;\n\t\tcode: string;\n\t};\n\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\n\terror: {\n\t\tmodalError?: string;\n\t\theader?: string;\n\t\tbody?: string;\n\t\tfooter?: string;\n\t\tquickReply?: Array<string | null>;\n\t\tmeta?: {\n\t\t\tname?: string;\n\t\t};\n\t\tctaBtn?: {\n\t\t\tphoneNumber: {\n\t\t\t\tbtnText: string;\n\t\t\t\tlink: string;\n\t\t\t};\n\t\t\twebsiteLink: { btnText: string; link: string };\n\t\t};\n\t};\n\n\t/** DATA DUMP */\n\tbuttonPlaceholders?: templatePlaceHolder[];\n};\n\nexport type templatePlaceHolder = {\n\tdefault_value: string;\n\tplaceHolder: string;\n\ttitle: string;\n};\n\nexport type templateVariable = {\n\teditable: boolean;\n\tvariableName: string;\n\tvariableVal?: string;\n\teditableDefaultValues?: string | null;\n\tidx: number;\n};\n\nexport type getTemplateByIdResponse = {\n\tcomponents: WhatsAppTemplate['components'];\n\tlanguage: string;\n\tlabel: string;\n\tcreatedAt: any;\n\ttemplateId: string;\n\tname: string;\n\tcreatedBy: string;\n\tchannel: string;\n\tisDraft?: boolean;\n\tmapping: TemplateVariableMapping;\n\tisArchive?: boolean;\n\tstoreId: string;\n\tchannelTemplateId: string;\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\ttemplateCategory: string;\n\tsyncOnboarding?: boolean;\n\trecomendedForCohorts?: string[];\n\thtmlContentUrl?: string;\n};\n\nexport type TemplateVariableMapping = {\n\tbody: string[];\n\tbuttons: string[];\n\theader: string[];\n\tfooter: string[];\n\ttitle?: string[];\n};\n\nexport type WhatsappLikePreviewTypes = {\n\tbodyText?: string;\n\tfooterText?: string;\n\theaderMediaType: HEADER_TYPES;\n\theaderText?: string;\n\theaderAssetLink?: string;\n\theaderAssetName?: string;\n\tquickReplybtn?: QUICK_REPLY_BUTTON[];\n\tctaBtn?: {\n\t\ttype: 'phoneNumber' | 'website';\n\t\ttext: string;\n\t\textra?: string;\n\t\tplaceholder?: string;\n\t}[];\n\tactionTypes?: ACTIONS_TYPES;\n\ttextType: 'html' | 'markdown';\n\thidePreviewText?: boolean;\n\textras?: boolean;\n\tcontainerStyle?: React.CSSProperties;\n\tshowHeader?: boolean;\n\tcontainerPadding?: string;\n\timagePreviewStyles?: React.CSSProperties;\n\tsize?: 'small' | 'large';\n\tzeroStateComponent: ReactElement<any, any>;\n\tchildren?: React.ReactNode;\n\tbodyVariableList?: variableType[];\n\theaderVariableList?: variableType[];\n\tcarouselCardIndex?: number;\n\tbuttons?: WhatsappPreviewButtonType[];\n\tlimitedTimeOfferComponent?: CreateTemplateType['limitedTimeOfferComponent'];\n\tisWhatsappCarousel?: boolean;\n\tisPreview?: boolean;\n\ttitleText?: string;\n\ttitleVariableList?: variableType[];\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\thideFooter?: boolean;\n};\n\nexport type WhatsappPreviewButtonType = {\n\ttype: WhatsappTemplateButtonTypes;\n\ttext: string;\n\tplaceholder?: string;\n\tflowId: string;\n\tflowName: string;\n};\n\nexport enum TEMPLATE_QUALITY {\n\tGREEN = 'GREEN',\n\tYELLOW = 'YELLOW',\n\tRED = 'RED',\n\tUNKNOWN = 'UNKNOWN',\n}\n\nexport type WhatsappMeta = {\n\tcontainerStyle?: React.CSSProperties | undefined;\n\ttemplateContainerStyles?: React.CSSProperties | undefined;\n\tsize?: 'small' | 'large';\n\tshowWhatsAppHeader?: boolean;\n\twhatsAppExtras?: boolean;\n\tzeroStateComponent?: ReactElement;\n\tusePlaceHolderName?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\nexport interface IMimeTypeResponse {\n\tisValid: boolean;\n\tmimeType: string;\n}\nexport type WhatsAppPickerMeta = {\n\tuploadMediaFiles: (\n\t\tparams: WhatsAppMediaUploadRequest,\n\t\tindex?: number,\n\t) => Promise<WhatsAppMediaUploadResponse>;\n\tuploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;\n\tvalidateMimeType?: (file: File | Blob) => Promise<IMimeTypeResponse>;\n\tCTAoptions?: ButtonPlaceHolderOptions[];\n\tQRBoptions?: ButtonPlaceHolderOptions[];\n};\n\nexport type WhatsAppMediaUploadResponse = {\n\tsuccess: boolean;\n\turl?: string;\n};\nexport interface MediaLinkUploadResponse extends WhatsAppMediaUploadResponse {\n\tsize: number;\n\ttype: string;\n}\n\nexport type WhatsAppMediaUploadRequest = {\n\tfile: File;\n\tfileName: string;\n\tisImage: boolean;\n};\n\nexport interface WhatsAppTemplateVariables {\n\tbody: CUSTOM_VARIABLE[];\n\theader: CUSTOM_VARIABLE[];\n\tbuttons: TEMPLATE_BUTTON[];\n\ttitle?: CUSTOM_VARIABLE[];\n}\n\nexport type CTABtnValType =\n\t| {\n\t\t\tdefaultValue: string;\n\t\t\tplaceHolder: string;\n\t }\n\t| string;\n\nexport type QRBBtnValType = {\n\tflowId?: string;\n\tflowName?: string;\n};\n\nexport type TEMPLATE_BUTTON = {\n\ttype: BUTTON_TYPE;\n\ttext?: string;\n\turl?: string;\n\texample?: string[] | string;\n\tlinkMode?: 'custom' | 'home';\n\tphone_number?: string;\n\tbuttonVariable?: string;\n\tindex?: number;\n\tflowId?: string;\n\tflowName?: string;\n\tqueryParams?: { key: string; value: string }[];\n};\n\nexport enum BUTTON_TYPE {\n\tQUICK_REPLY = 'QUICK_REPLY',\n\tURL = 'URL',\n\tPHONE_NUMBER = 'PHONE_NUMBER',\n\tCOPY_CODE = 'COPY_CODE',\n\tVOICE_CALL = 'VOICE_CALL',\n}\n\nexport enum POD {\n\tCHATBOT = 'CHATBOT',\n\tGROWTH = 'GROWTH',\n\tCAMPAIGN = 'CAMPAIGN',\n\tCRM = 'CRM',\n\tINTEGRATIONS = 'INTEGRATIONS',\n\tOPENAI = 'OPENAI',\n\tDM = 'DM',\n\tFRONTEND = 'FRONTEND',\n}\n\nexport type ExtrasWhatsapp = {\n\tdiscountCodeExtra?: [\n\t\tdiscountCode: string,\n\t\tsetDiscountCode: (discountCode: string) => void,\n\t];\n\tbackTrackExtra?: [\n\t\tbackTrackMessage: string,\n\t\tsetBackTrackMessage: (backTrackMessage: string) => void,\n\t];\n};\n\nexport type TemplateAnalyticsI = {\n\tfetchAnalytics?: (templateId: string) => Promise<TemplateAnalyticsResponseI>;\n\tshow?: boolean;\n\ttemplateQuality?: TEMPLATE_QUALITY;\n\tdata?: TemplateAnalyticsDataI;\n};\n\nexport type TemplateAnalyticsResponseI = {\n\tsuccess: boolean;\n\tanalytics?: TemplateAnalyticsDataI;\n};\nexport interface TemplateAnalyticsDataI {\n\ttotalReads: number;\n\ttotalSent: number;\n\ttotalDelivered: number;\n\tdeliveredPercentage: number;\n\treadPercentage: number;\n\tclickAnalytics: {\n\t\t[buttonName: string]: {\n\t\t\ttotalClicks: number;\n\t\t\tclickPercentage: number;\n\t\t};\n\t};\n\tperformance: {\n\t\t//eg: ['GREEN','YELLOW','RED','GREEN']\n\t\tqualityTimeLine: TEMPLATE_QUALITY[];\n\t};\n}\n\nexport interface TemplateAnalyticsComponentI {\n\ttemplateAnalytics?: TemplateAnalyticsI;\n\ttemplateId: string;\n\tonClose?: () => void;\n\tonProceed?: () => void;\n\tonCancel?: () => void;\n\theadingTitle?: string;\n\theadingSubtitle?: string;\n\tanalyticsData?: TemplateAnalyticsDataI;\n}\n"],"names":["TEMPLATE_QUALITY","BUTTON_TYPE","POD"],"mappings":"aA+PA,IAAYA,EAiFAC,EAQAC,yDAzFAF,QAKXA,sBAAA,GALWA,EAAAA,2BAAAA,QAAAA,iBAKX,CAAA,IAJA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,IAAA,MACAA,EAAA,QAAA,UA6EWC,QAMXA,iBAAA,GANWA,EAAAA,sBAAAA,QAAAA,YAMX,CAAA,IALA,YAAA,cACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,UAAA,YACAA,EAAA,WAAA,aAGWC,QASXA,SAAA,GATWA,EAAAA,QAAGA,MAAHA,YASX,CAAA,IARA,QAAA,UACAA,EAAA,OAAA,SACAA,EAAA,SAAA,WACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,OAAA,SACAA,EAAA,GAAA,KACAA,EAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"WhatsAppTemplate.js","sources":["../../../../../src/components/template-preview/models/WhatsAppTemplate.ts"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { variableType } from '../helpers/VariableEditorHelper';\nimport { CHANNEL_TYPE } from './Channels';\nimport {\n\tACTIONS_TYPES,\n\tButtonPlaceHolderOptions,\n\tCUSTOM_VARIABLE,\n\tHEADER_TYPES,\n\tQUICK_REPLY_BUTTON,\n\tTEMPLATE_STATUS,\n} from './TemplateMeta';\n\nexport type WhatsAppTemplate = {\n\tname: string;\n\tlabel: string;\n\trecommended?: boolean;\n\ttemplateId?: string;\n\tchannel: CHANNEL_TYPE;\n\ttemplateCategory: string;\n\ttype?: 'email' | 'whatsapp';\n\tcomponents: {\n\t\ttype:\n\t\t\t| 'HEADER'\n\t\t\t| 'BODY'\n\t\t\t| 'BUTTONS'\n\t\t\t| 'FOOTER'\n\t\t\t| 'limited_time_offer'\n\t\t\t| 'TITLE';\n\t\tformat?: HEADER_TYPES;\n\t\ttext?: string;\n\t\tlimited_time_offer?: {\n\t\t\ttext: string;\n\t\t\thas_expiration: boolean;\n\t\t};\n\t\tbuttons?: {\n\t\t\ttype:\n\t\t\t\t| 'QUICK_REPLY'\n\t\t\t\t| 'URL'\n\t\t\t\t| 'PHONE_NUMBER'\n\t\t\t\t| 'COPY_CODE'\n\t\t\t\t| 'VOICE_CALL'\n\t\t\t\t| 'REQUEST_CONTACT_INFO';\n\t\t\ttext?: string;\n\t\t\turl?: string;\n\t\t\texample?: string[];\n\t\t\tlinkMode?: 'custom' | 'home';\n\t\t\tphone_number?: string;\n\t\t\tflowName?: string;\n\t\t\tflowId?: string;\n\t\t}[];\n\t\texample?: {\n\t\t\theader_handle?: Array<string>;\n\t\t\tbody_text?: Array<string[]>;\n\t\t\theader_text?: Array<string>;\n\t\t\tlimited_time_offer?: string;\n\t\t\ttitle_text?: Array<string[]>;\n\t\t};\n\t}[];\n\tmapping: {\n\t\theader?: string[];\n\t\tbody?: string[];\n\t\tbuttons?: string[];\n\t\ttitle?: string[];\n\t};\n\n\thtmlContentUrl?: string;\n\tlanguage: 'en_US';\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\tthumbnailImageUrl?: string;\n\tFB_blob_key?: string;\n\treason?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tisDraft?: boolean;\n\tnewQualityScore?: TEMPLATE_QUALITY;\n\tpreviousQualityScore?: TEMPLATE_QUALITY;\n\taiContentConfigId?: string;\n\tisAiGenerated?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\n\nexport type WhatsappTemplateButtonTypes =\n\t| 'QUICK_REPLY'\n\t| 'URL'\n\t| 'PHONE_NUMBER'\n\t| 'COPY_CODE'\n\t| 'VOICE_CALL'\n\t| 'CALL_PERMISSION'\n\t| 'REQUEST_CONTACT_INFO';\n\nexport type CreateTemplateType = {\n\t/** Data */\n\theaderType: HEADER_TYPES;\n\theaderAssetLink?: string | null;\n\theaderAssetName?: string | null;\n\theaderText?: string;\n\n\theaderVariables: templateVariable[];\n\tbodyVariables: templateVariable[];\n\ttitleVariables?: templateVariable[];\n\n\tbodyText?: string;\n\ttitleText?: string;\n\tbodyTextRaw?: string;\n\n\tfooterText?: string;\n\n\tactionsType: ACTIONS_TYPES;\n\n\tquickReply: Array<QUICK_REPLY_BUTTON>;\n\tctaBtn: {\n\t\tphoneNumber?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tphoneNumber?: string;\n\t\t};\n\t\twebsiteLinkBtn?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tlinkOpens?: string;\n\t\t\tplaceholder?: string;\n\t\t};\n\t};\n\tallButtons: WhatsappPreviewButtonType[];\n\n\tmeta: {\n\t\tname: string;\n\t\tcategory?: string;\n\t\tsubCategory?: string;\n\t\tlanguage?: string;\n\t\ttemplateId?: string;\n\t};\n\n\tmode: 'edit' | 'create';\n\talreadyAsADraft?: boolean;\n\t/** UI */\n\tinitialLoading: boolean;\n\n\tlimitedTimeOfferComponent: {\n\t\ttext: string;\n\t\tdateTime: string;\n\t\tcode: string;\n\t};\n\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\n\terror: {\n\t\tmodalError?: string;\n\t\theader?: string;\n\t\tbody?: string;\n\t\tfooter?: string;\n\t\tquickReply?: Array<string | null>;\n\t\tmeta?: {\n\t\t\tname?: string;\n\t\t};\n\t\tctaBtn?: {\n\t\t\tphoneNumber: {\n\t\t\t\tbtnText: string;\n\t\t\t\tlink: string;\n\t\t\t};\n\t\t\twebsiteLink: { btnText: string; link: string };\n\t\t};\n\t};\n\n\t/** DATA DUMP */\n\tbuttonPlaceholders?: templatePlaceHolder[];\n};\n\nexport type templatePlaceHolder = {\n\tdefault_value: string;\n\tplaceHolder: string;\n\ttitle: string;\n};\n\nexport type templateVariable = {\n\teditable: boolean;\n\tvariableName: string;\n\tvariableVal?: string;\n\teditableDefaultValues?: string | null;\n\tidx: number;\n};\n\nexport type getTemplateByIdResponse = {\n\tcomponents: WhatsAppTemplate['components'];\n\tlanguage: string;\n\tlabel: string;\n\tcreatedAt: any;\n\ttemplateId: string;\n\tname: string;\n\tcreatedBy: string;\n\tchannel: string;\n\tisDraft?: boolean;\n\tmapping: TemplateVariableMapping;\n\tisArchive?: boolean;\n\tstoreId: string;\n\tchannelTemplateId: string;\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\ttemplateCategory: string;\n\tsyncOnboarding?: boolean;\n\trecomendedForCohorts?: string[];\n\thtmlContentUrl?: string;\n};\n\nexport type TemplateVariableMapping = {\n\tbody: string[];\n\tbuttons: string[];\n\theader: string[];\n\tfooter: string[];\n\ttitle?: string[];\n};\n\nexport type WhatsappLikePreviewTypes = {\n\tbodyText?: string;\n\tfooterText?: string;\n\theaderMediaType: HEADER_TYPES;\n\theaderText?: string;\n\theaderAssetLink?: string;\n\theaderAssetName?: string;\n\tquickReplybtn?: QUICK_REPLY_BUTTON[];\n\tctaBtn?: {\n\t\ttype: 'phoneNumber' | 'website';\n\t\ttext: string;\n\t\textra?: string;\n\t\tplaceholder?: string;\n\t}[];\n\tactionTypes?: ACTIONS_TYPES;\n\ttextType: 'html' | 'markdown';\n\thidePreviewText?: boolean;\n\textras?: boolean;\n\tcontainerStyle?: React.CSSProperties;\n\tshowHeader?: boolean;\n\tcontainerPadding?: string;\n\timagePreviewStyles?: React.CSSProperties;\n\tsize?: 'small' | 'large';\n\tzeroStateComponent: ReactElement<any, any>;\n\tchildren?: React.ReactNode;\n\tbodyVariableList?: variableType[];\n\theaderVariableList?: variableType[];\n\tcarouselCardIndex?: number;\n\tbuttons?: WhatsappPreviewButtonType[];\n\tlimitedTimeOfferComponent?: CreateTemplateType['limitedTimeOfferComponent'];\n\tisWhatsappCarousel?: boolean;\n\tisPreview?: boolean;\n\ttitleText?: string;\n\ttitleVariableList?: variableType[];\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\thideFooter?: boolean;\n};\n\nexport type WhatsappPreviewButtonType = {\n\ttype: WhatsappTemplateButtonTypes;\n\ttext: string;\n\tplaceholder?: string;\n\tflowId: string;\n\tflowName: string;\n};\n\nexport enum TEMPLATE_QUALITY {\n\tGREEN = 'GREEN',\n\tYELLOW = 'YELLOW',\n\tRED = 'RED',\n\tUNKNOWN = 'UNKNOWN',\n}\n\nexport type WhatsappMeta = {\n\tcontainerStyle?: React.CSSProperties | undefined;\n\ttemplateContainerStyles?: React.CSSProperties | undefined;\n\tsize?: 'small' | 'large';\n\tshowWhatsAppHeader?: boolean;\n\twhatsAppExtras?: boolean;\n\tzeroStateComponent?: ReactElement;\n\tusePlaceHolderName?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\nexport interface IMimeTypeResponse {\n\tisValid: boolean;\n\tmimeType: string;\n}\nexport type WhatsAppPickerMeta = {\n\tuploadMediaFiles: (\n\t\tparams: WhatsAppMediaUploadRequest,\n\t\tindex?: number,\n\t) => Promise<WhatsAppMediaUploadResponse>;\n\tuploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;\n\tvalidateMimeType?: (file: File | Blob) => Promise<IMimeTypeResponse>;\n\tCTAoptions?: ButtonPlaceHolderOptions[];\n\tQRBoptions?: ButtonPlaceHolderOptions[];\n};\n\nexport type WhatsAppMediaUploadResponse = {\n\tsuccess: boolean;\n\turl?: string;\n};\nexport interface MediaLinkUploadResponse extends WhatsAppMediaUploadResponse {\n\tsize: number;\n\ttype: string;\n}\n\nexport type WhatsAppMediaUploadRequest = {\n\tfile: File;\n\tfileName: string;\n\tisImage: boolean;\n};\n\nexport interface WhatsAppTemplateVariables {\n\tbody: CUSTOM_VARIABLE[];\n\theader: CUSTOM_VARIABLE[];\n\tbuttons: TEMPLATE_BUTTON[];\n\ttitle?: CUSTOM_VARIABLE[];\n}\n\nexport type CTABtnValType =\n\t| {\n\t\t\tdefaultValue: string;\n\t\t\tplaceHolder: string;\n\t }\n\t| string;\n\nexport type QRBBtnValType = {\n\tflowId?: string;\n\tflowName?: string;\n};\n\nexport type TEMPLATE_BUTTON = {\n\ttype: BUTTON_TYPE;\n\ttext?: string;\n\turl?: string;\n\texample?: string[] | string;\n\tlinkMode?: 'custom' | 'home';\n\tphone_number?: string;\n\tbuttonVariable?: string;\n\tindex?: number;\n\tflowId?: string;\n\tflowName?: string;\n\tqueryParams?: { key: string; value: string }[];\n};\n\nexport enum BUTTON_TYPE {\n\tQUICK_REPLY = 'QUICK_REPLY',\n\tURL = 'URL',\n\tPHONE_NUMBER = 'PHONE_NUMBER',\n\tCOPY_CODE = 'COPY_CODE',\n\tVOICE_CALL = 'VOICE_CALL',\n\tREQUEST_CONTACT_INFO = 'REQUEST_CONTACT_INFO',\n}\n\nexport enum POD {\n\tCHATBOT = 'CHATBOT',\n\tGROWTH = 'GROWTH',\n\tCAMPAIGN = 'CAMPAIGN',\n\tCRM = 'CRM',\n\tINTEGRATIONS = 'INTEGRATIONS',\n\tOPENAI = 'OPENAI',\n\tDM = 'DM',\n\tFRONTEND = 'FRONTEND',\n}\n\nexport type ExtrasWhatsapp = {\n\tdiscountCodeExtra?: [\n\t\tdiscountCode: string,\n\t\tsetDiscountCode: (discountCode: string) => void,\n\t];\n\tbackTrackExtra?: [\n\t\tbackTrackMessage: string,\n\t\tsetBackTrackMessage: (backTrackMessage: string) => void,\n\t];\n};\n\nexport type TemplateAnalyticsI = {\n\tfetchAnalytics?: (templateId: string) => Promise<TemplateAnalyticsResponseI>;\n\tshow?: boolean;\n\ttemplateQuality?: TEMPLATE_QUALITY;\n\tdata?: TemplateAnalyticsDataI;\n};\n\nexport type TemplateAnalyticsResponseI = {\n\tsuccess: boolean;\n\tanalytics?: TemplateAnalyticsDataI;\n};\nexport interface TemplateAnalyticsDataI {\n\ttotalReads: number;\n\ttotalSent: number;\n\ttotalDelivered: number;\n\tdeliveredPercentage: number;\n\treadPercentage: number;\n\tclickAnalytics: {\n\t\t[buttonName: string]: {\n\t\t\ttotalClicks: number;\n\t\t\tclickPercentage: number;\n\t\t};\n\t};\n\tperformance: {\n\t\t//eg: ['GREEN','YELLOW','RED','GREEN']\n\t\tqualityTimeLine: TEMPLATE_QUALITY[];\n\t};\n}\n\nexport interface TemplateAnalyticsComponentI {\n\ttemplateAnalytics?: TemplateAnalyticsI;\n\ttemplateId: string;\n\tonClose?: () => void;\n\tonProceed?: () => void;\n\tonCancel?: () => void;\n\theadingTitle?: string;\n\theadingSubtitle?: string;\n\tanalyticsData?: TemplateAnalyticsDataI;\n}\n"],"names":["TEMPLATE_QUALITY","BUTTON_TYPE","POD"],"mappings":"aAsQA,IAAYA,EAiFAC,EASAC,yDA1FAF,QAKXA,sBAAA,GALWA,EAAAA,2BAAAA,QAAAA,iBAKX,CAAA,IAJA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,IAAA,MACAA,EAAA,QAAA,UA6EWC,QAOXA,iBAAA,GAPWA,EAAAA,sBAAAA,QAAAA,YAOX,CAAA,IANA,YAAA,cACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,UAAA,YACAA,EAAA,WAAA,aACAA,EAAA,qBAAA,uBAGWC,QASXA,SAAA,GATWA,EAAAA,QAAGA,MAAHA,YASX,CAAA,IARA,QAAA,UACAA,EAAA,OAAA,SACAA,EAAA,SAAA,WACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,OAAA,SACAA,EAAA,GAAA,KACAA,EAAA,SAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/chevronDownOutline.svg.js";import i from"../../../assets/icons/copy-code-icon.svg.js";import s from"../../../assets/icons/halfRectangle.svg.js";import l from"../../../assets/icons/phone.svg.js";import n from"../../../assets/icons/qrb.svg.js";import a from"../../../assets/icons/RedirectToNew.svg.js";import p from"styled-components";import{useTemplateModalContext as d}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{TitleSmall as c,Caption as h,BodySecondary as f}from"../../TypographyStyle.js";import{COLORS as x}from"../../../constants/Theme.js";import{VariableEditorHelper as y}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as g,ACTIONS_TYPES as u}from"../models/TemplateMeta.js";import{ChatBtn as C}from"./ChatBtn.js";import{Container as T,FooterWrapper as v,FooterText as j,TimeStamp as I}from"./ChatUI.style.js";import{LimitedTimeOffer as L}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/chevronDownOutline.svg.js";import i from"../../../assets/icons/copy-code-icon.svg.js";import s from"../../../assets/icons/halfRectangle.svg.js";import l from"../../../assets/icons/phone.svg.js";import n from"../../../assets/icons/qrb.svg.js";import a from"../../../assets/icons/RedirectToNew.svg.js";import p from"styled-components";import{useTemplateModalContext as d}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{TitleSmall as c,Caption as h,BodySecondary as f}from"../../TypographyStyle.js";import{COLORS as x}from"../../../constants/Theme.js";import{VariableEditorHelper as y}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as g,ACTIONS_TYPES as u}from"../models/TemplateMeta.js";import{ChatBtn as C}from"./ChatBtn.js";import{Container as T,FooterWrapper as v,FooterText as j,TimeStamp as I}from"./ChatUI.style.js";import{LimitedTimeOffer as L}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as O}from"./MediaCard.js";const w=p.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -7.7px;
|
|
6
6
|
top: -8px;
|
|
7
|
-
`,
|
|
7
|
+
`,E=p.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
@@ -13,8 +13,8 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"..
|
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
14
|
color: ${x.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,b=p(E)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,_=new y,N=p=>{const{bodyText:x,footerText:y,headerMediaType:N,headerText:P,headerAssetLink:S,headerAssetName:A,quickReplybtn:M,ctaBtn:R,actionTypes:B,extras:H,showHeader:U,imagePreviewStyles:k,size:z,bodyVariableList:D,headerVariableList:V,buttons:Y,limitedTimeOfferComponent:Q,carouselCardIndex:q,isWhatsappCarousel:F,isPreview:K,children:W,hideFooter:G=!1}=p,X=_.format(null==x?void 0:x.replace(/</g,"<").replace(/>/g,">"),D),$=_.format(null==P?void 0:P.replace(/</g,"<").replace(/>/g,">"),V),{selectedCarouselIndex:J,isProductCarouselType:Z,errorIndexes:ee,isCarouselHovered:te}=d(),oe={COPY_CODE:i,PHONE_NUMBER:l,URL:a,QUICK_REPLY:n,VOICE_CALL:l,CALL_PERMISSION:r,REQUEST_CONTACT_INFO:void 0};return e(T,Object.assign({isCarouselCard:null!=q&&q>-1,showBorder:null!=q&&q===J||Z&&null!=q&&q>-1&&null!=J&&J>-1,hasError:null==ee?void 0:ee.includes(null!=q?q:-2),isWhatsappCarousel:F,isPreview:K,showDashedBorder:Z&&te&&(null!=J?J:-1)<0&&(null!=q?q:-1)>-1},{children:[!F&&t(w,{children:t(s,{color:"white",height:8,width:8})}),N===g.TEXT?t(b,{dangerouslySetInnerHTML:{__html:$}}):N!==g.NONE?t(O,{headerAssetLink:S,headerAssetName:A,mediaType:N,imagePreviewStyles:N===g.IMAGE?k:{}}):t(o,{}),(null==Q?void 0:Q.dateTime)?t(L,{text:Q.text,dateTime:Q.dateTime,code:Q.code}):t(o,{}),!!x&&t(o,{children:t(E,{dangerouslySetInnerHTML:{__html:X},style:{flex:1}})}),W,!G&&e(v,{children:[t(m,Object.assign({body:null!=y?y:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:y}))})),t(I,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(C,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:oe[e.type],size:z,iconPosition:"CALL_PERMISSION"===e.type?"right":"left",textTypography:"CALL_PERMISSION"===e.type?c:void 0},o))):B===u.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(C,{text:e.text},o)))}):B===u.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(C,{textTypography:U?h:f,extraContent:H?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?l:a,size:z},o)))}):t(o,{})]}))};export{N as ChatUIV2,E as HtmlContainer};
|
|
20
20
|
//# sourceMappingURL=ChatUiV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatUiV2.js","sources":["../../../../../src/components/template-preview/WhatsApp/ChatUiV2.tsx"],"sourcesContent":["import ChevronDownIcon from '@src/assets/icons/chevronDownOutline.svg';\nimport CopyCodeIcon from '@src/assets/icons/copy-code-icon.svg';\nimport HalfRectangleIcon from '@src/assets/icons/halfRectangle.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport QRBIcon from '@src/assets/icons/qrb.svg';\nimport RedirectToIcon from '@src/assets/icons/RedirectToNew.svg';\nimport styled from 'styled-components';\nimport { useTemplateModalContext } from '@src/components/template-context-mapper/context/templateModalContext';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodySecondary,\n\tCaption,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariableEditorHelper } from '../helpers/VariableEditorHelper';\nimport { ACTIONS_TYPES, HEADER_TYPES } from '../models/TemplateMeta';\nimport {\n\tWhatsappLikePreviewTypes,\n\tWhatsappTemplateButtonTypes,\n} from '../models/WhatsAppTemplate';\nimport { ChatBtn } from './ChatBtn';\nimport {\n\tContainer,\n\tFooterText,\n\tFooterWrapper,\n\tTimeStamp,\n} from './ChatUI.style';\nimport { LimitedTimeOffer } from './LimitedTimeOffer/LimitedTimeOffer.index';\nimport { MediaCard } from './MediaCard';\n\nconst SideCaret = styled.div`\n\tposition: absolute;\n\twidth: 8px;\n\theight: 8px;\n\tleft: -7.7px;\n\ttop: -8px;\n`;\n\nexport const HtmlContainer = styled.div`\n\tfont-family: 'Inter';\n\tfont-style: normal;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpadding: 8px 12px 0px;\n\tcolor: ${COLORS.content.primary};\n\tword-wrap: break-word;\n`;\n\nconst HeaderTextContainer = styled(HtmlContainer)`\n\tfont-weight: 600;\n\tmargin-bottom: 8px;\n`;\n\nconst variableEditorHelper = new VariableEditorHelper();\n\nexport const ChatUIV2 = (props: WhatsappLikePreviewTypes) => {\n\tconst {\n\t\tbodyText,\n\t\tfooterText,\n\t\theaderMediaType,\n\t\theaderText,\n\t\theaderAssetLink,\n\t\theaderAssetName,\n\t\tquickReplybtn,\n\t\tctaBtn,\n\t\tactionTypes,\n\t\textras,\n\t\tshowHeader,\n\t\timagePreviewStyles,\n\t\tsize,\n\t\tbodyVariableList,\n\t\theaderVariableList,\n\t\tbuttons,\n\t\tlimitedTimeOfferComponent,\n\t\tcarouselCardIndex,\n\t\tisWhatsappCarousel,\n\t\tisPreview,\n\t\tchildren,\n\t\thideFooter = false,\n\t} = props;\n\n\tconst bodyHTML = variableEditorHelper.format(\n\t\tbodyText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\tbodyVariableList,\n\t);\n\tconst headerHtml = variableEditorHelper.format(\n\t\theaderText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\theaderVariableList,\n\t);\n\tconst {\n\t\tselectedCarouselIndex,\n\t\tisProductCarouselType,\n\t\terrorIndexes,\n\t\tisCarouselHovered,\n\t} = useTemplateModalContext();\n\n\tconst icons: Record<WhatsappTemplateButtonTypes, React.FC> = {\n\t\tCOPY_CODE: CopyCodeIcon,\n\t\tPHONE_NUMBER: PhoneIcon,\n\t\tURL: RedirectToIcon,\n\t\tQUICK_REPLY: QRBIcon,\n\t\tVOICE_CALL: PhoneIcon,\n\t\tCALL_PERMISSION: ChevronDownIcon,\n\t};\n\n\treturn (\n\t\t<Container\n\t\t\tisCarouselCard={carouselCardIndex != undefined && carouselCardIndex > -1}\n\t\t\tshowBorder={\n\t\t\t\t(carouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex === selectedCarouselIndex) ||\n\t\t\t\t(isProductCarouselType &&\n\t\t\t\t\tcarouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex > -1 &&\n\t\t\t\t\tselectedCarouselIndex != undefined &&\n\t\t\t\t\tselectedCarouselIndex > -1)\n\t\t\t}\n\t\t\thasError={errorIndexes?.includes(carouselCardIndex ?? -2)}\n\t\t\tisWhatsappCarousel={isWhatsappCarousel}\n\t\t\tisPreview={isPreview}\n\t\t\tshowDashedBorder={\n\t\t\t\tisProductCarouselType &&\n\t\t\t\tisCarouselHovered &&\n\t\t\t\t(selectedCarouselIndex ?? -1) < 0 &&\n\t\t\t\t(carouselCardIndex ?? -1) > -1\n\t\t\t}\n\t\t>\n\t\t\t{!isWhatsappCarousel && (\n\t\t\t\t<SideCaret>\n\t\t\t\t\t<HalfRectangleIcon color={'white'} height={8} width={8} />\n\t\t\t\t</SideCaret>\n\t\t\t)}\n\t\t\t{headerMediaType === HEADER_TYPES.TEXT ? (\n\t\t\t\t<HeaderTextContainer\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: headerHtml,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : headerMediaType !== HEADER_TYPES.NONE ? (\n\t\t\t\t<MediaCard\n\t\t\t\t\theaderAssetLink={headerAssetLink}\n\t\t\t\t\theaderAssetName={headerAssetName}\n\t\t\t\t\tmediaType={headerMediaType}\n\t\t\t\t\timagePreviewStyles={\n\t\t\t\t\t\theaderMediaType === HEADER_TYPES.IMAGE ? imagePreviewStyles : {}\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{/* Rendering LTO if dateTime exists */}\n\t\t\t{limitedTimeOfferComponent?.dateTime ? (\n\t\t\t\t<LimitedTimeOffer\n\t\t\t\t\ttext={limitedTimeOfferComponent.text}\n\t\t\t\t\tdateTime={limitedTimeOfferComponent.dateTime}\n\t\t\t\t\tcode={limitedTimeOfferComponent.code}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{!!bodyText && (\n\t\t\t\t<>\n\t\t\t\t\t<HtmlContainer\n\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t__html: bodyHTML,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{children}\n\t\t\t{!hideFooter && (\n\t\t\t\t<FooterWrapper>\n\t\t\t\t\t<Tooltip body={footerText ?? ''} placement={'top'}>\n\t\t\t\t\t\t<FooterText style={{ flex: 1 }}>{footerText}</FooterText>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<TimeStamp>16:48</TimeStamp>\n\t\t\t\t</FooterWrapper>\n\t\t\t)}\n\n\t\t\t{/* Instead of action Type, this renders ChatBtn for all buttons. Rest of the code based on Action Type is maintained for backward compatibility */}\n\t\t\t{buttons && buttons.length > 0 ? (\n\t\t\t\tbuttons.map((button, i) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttext={button.type === 'COPY_CODE' ? 'Copy code' : button.text}\n\t\t\t\t\t\t\tIcon={icons[button.type]}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t\ticonPosition={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? 'right' : 'left'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttextTypography={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? TitleSmall : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) : actionTypes === ACTIONS_TYPES.QUICK_REPLY ? (\n\t\t\t\t<div>\n\t\t\t\t\t{quickReplybtn?.map((button, i) => (\n\t\t\t\t\t\t<ChatBtn key={i} text={button.text} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : actionTypes === ACTIONS_TYPES.CTA_BTN ? (\n\t\t\t\t<div>\n\t\t\t\t\t{ctaBtn?.map((ctaBtn, i) => (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttextTypography={showHeader ? Caption : BodySecondary}\n\t\t\t\t\t\t\textraContent={extras ? ctaBtn.extra : undefined}\n\t\t\t\t\t\t\tplaceholder={ctaBtn.placeholder}\n\t\t\t\t\t\t\ttext={ctaBtn.text}\n\t\t\t\t\t\t\tIcon={ctaBtn.type === 'phoneNumber' ? PhoneIcon : RedirectToIcon}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["SideCaret","styled","div","HtmlContainer","COLORS","content","primary","HeaderTextContainer","variableEditorHelper","VariableEditorHelper","ChatUIV2","props","bodyText","footerText","headerMediaType","headerText","headerAssetLink","headerAssetName","quickReplybtn","ctaBtn","actionTypes","extras","showHeader","imagePreviewStyles","size","bodyVariableList","headerVariableList","buttons","limitedTimeOfferComponent","carouselCardIndex","isWhatsappCarousel","isPreview","children","hideFooter","bodyHTML","format","replace","headerHtml","selectedCarouselIndex","isProductCarouselType","errorIndexes","isCarouselHovered","useTemplateModalContext","icons","COPY_CODE","CopyCodeIcon","PHONE_NUMBER","PhoneIcon","URL","RedirectToIcon","QUICK_REPLY","QRBIcon","VOICE_CALL","CALL_PERMISSION","ChevronDownIcon","_jsxs","Container","Object","assign","isCarouselCard","undefined","showBorder","hasError","includes","showDashedBorder","_jsx","HalfRectangleIcon","color","height","width","HEADER_TYPES","TEXT","dangerouslySetInnerHTML","__html","NONE","MediaCard","mediaType","IMAGE","_Fragment","dateTime","LimitedTimeOffer","text","code","style","flex","FooterWrapper","Tooltip","body","placement","FooterText","TimeStamp","length","map","button","i","ChatBtn","type","Icon","iconPosition","textTypography","TitleSmall","ACTIONS_TYPES","CTA_BTN","Caption","BodySecondary","extraContent","extra","placeholder"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ChatUiV2.js","sources":["../../../../../src/components/template-preview/WhatsApp/ChatUiV2.tsx"],"sourcesContent":["import ChevronDownIcon from '@src/assets/icons/chevronDownOutline.svg';\nimport CopyCodeIcon from '@src/assets/icons/copy-code-icon.svg';\nimport HalfRectangleIcon from '@src/assets/icons/halfRectangle.svg';\nimport PhoneIcon from '@src/assets/icons/phone.svg';\nimport QRBIcon from '@src/assets/icons/qrb.svg';\nimport RedirectToIcon from '@src/assets/icons/RedirectToNew.svg';\nimport styled from 'styled-components';\nimport { useTemplateModalContext } from '@src/components/template-context-mapper/context/templateModalContext';\nimport { Tooltip } from '@src/components/tooltips';\nimport {\n\tBodySecondary,\n\tCaption,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport { VariableEditorHelper } from '../helpers/VariableEditorHelper';\nimport { ACTIONS_TYPES, HEADER_TYPES } from '../models/TemplateMeta';\nimport {\n\tWhatsappLikePreviewTypes,\n\tWhatsappTemplateButtonTypes,\n} from '../models/WhatsAppTemplate';\nimport { ChatBtn } from './ChatBtn';\nimport {\n\tContainer,\n\tFooterText,\n\tFooterWrapper,\n\tTimeStamp,\n} from './ChatUI.style';\nimport { LimitedTimeOffer } from './LimitedTimeOffer/LimitedTimeOffer.index';\nimport { MediaCard } from './MediaCard';\n\nconst SideCaret = styled.div`\n\tposition: absolute;\n\twidth: 8px;\n\theight: 8px;\n\tleft: -7.7px;\n\ttop: -8px;\n`;\n\nexport const HtmlContainer = styled.div`\n\tfont-family: 'Inter';\n\tfont-style: normal;\n\tfont-weight: 400;\n\tfont-size: 14px;\n\tline-height: 20px;\n\tpadding: 8px 12px 0px;\n\tcolor: ${COLORS.content.primary};\n\tword-wrap: break-word;\n`;\n\nconst HeaderTextContainer = styled(HtmlContainer)`\n\tfont-weight: 600;\n\tmargin-bottom: 8px;\n`;\n\nconst variableEditorHelper = new VariableEditorHelper();\n\nexport const ChatUIV2 = (props: WhatsappLikePreviewTypes) => {\n\tconst {\n\t\tbodyText,\n\t\tfooterText,\n\t\theaderMediaType,\n\t\theaderText,\n\t\theaderAssetLink,\n\t\theaderAssetName,\n\t\tquickReplybtn,\n\t\tctaBtn,\n\t\tactionTypes,\n\t\textras,\n\t\tshowHeader,\n\t\timagePreviewStyles,\n\t\tsize,\n\t\tbodyVariableList,\n\t\theaderVariableList,\n\t\tbuttons,\n\t\tlimitedTimeOfferComponent,\n\t\tcarouselCardIndex,\n\t\tisWhatsappCarousel,\n\t\tisPreview,\n\t\tchildren,\n\t\thideFooter = false,\n\t} = props;\n\n\tconst bodyHTML = variableEditorHelper.format(\n\t\tbodyText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\tbodyVariableList,\n\t);\n\tconst headerHtml = variableEditorHelper.format(\n\t\theaderText?.replace(/</g, '<').replace(/>/g, '>'),\n\t\theaderVariableList,\n\t);\n\tconst {\n\t\tselectedCarouselIndex,\n\t\tisProductCarouselType,\n\t\terrorIndexes,\n\t\tisCarouselHovered,\n\t} = useTemplateModalContext();\n\n\tconst icons: Record<WhatsappTemplateButtonTypes, React.FC | undefined> = {\n\t\tCOPY_CODE: CopyCodeIcon,\n\t\tPHONE_NUMBER: PhoneIcon,\n\t\tURL: RedirectToIcon,\n\t\tQUICK_REPLY: QRBIcon,\n\t\tVOICE_CALL: PhoneIcon,\n\t\tCALL_PERMISSION: ChevronDownIcon,\n\t\tREQUEST_CONTACT_INFO: undefined,\n\t};\n\n\treturn (\n\t\t<Container\n\t\t\tisCarouselCard={carouselCardIndex != undefined && carouselCardIndex > -1}\n\t\t\tshowBorder={\n\t\t\t\t(carouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex === selectedCarouselIndex) ||\n\t\t\t\t(isProductCarouselType &&\n\t\t\t\t\tcarouselCardIndex != undefined &&\n\t\t\t\t\tcarouselCardIndex > -1 &&\n\t\t\t\t\tselectedCarouselIndex != undefined &&\n\t\t\t\t\tselectedCarouselIndex > -1)\n\t\t\t}\n\t\t\thasError={errorIndexes?.includes(carouselCardIndex ?? -2)}\n\t\t\tisWhatsappCarousel={isWhatsappCarousel}\n\t\t\tisPreview={isPreview}\n\t\t\tshowDashedBorder={\n\t\t\t\tisProductCarouselType &&\n\t\t\t\tisCarouselHovered &&\n\t\t\t\t(selectedCarouselIndex ?? -1) < 0 &&\n\t\t\t\t(carouselCardIndex ?? -1) > -1\n\t\t\t}\n\t\t>\n\t\t\t{!isWhatsappCarousel && (\n\t\t\t\t<SideCaret>\n\t\t\t\t\t<HalfRectangleIcon color={'white'} height={8} width={8} />\n\t\t\t\t</SideCaret>\n\t\t\t)}\n\t\t\t{headerMediaType === HEADER_TYPES.TEXT ? (\n\t\t\t\t<HeaderTextContainer\n\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t__html: headerHtml,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : headerMediaType !== HEADER_TYPES.NONE ? (\n\t\t\t\t<MediaCard\n\t\t\t\t\theaderAssetLink={headerAssetLink}\n\t\t\t\t\theaderAssetName={headerAssetName}\n\t\t\t\t\tmediaType={headerMediaType}\n\t\t\t\t\timagePreviewStyles={\n\t\t\t\t\t\theaderMediaType === HEADER_TYPES.IMAGE ? imagePreviewStyles : {}\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{/* Rendering LTO if dateTime exists */}\n\t\t\t{limitedTimeOfferComponent?.dateTime ? (\n\t\t\t\t<LimitedTimeOffer\n\t\t\t\t\ttext={limitedTimeOfferComponent.text}\n\t\t\t\t\tdateTime={limitedTimeOfferComponent.dateTime}\n\t\t\t\t\tcode={limitedTimeOfferComponent.code}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\n\t\t\t{!!bodyText && (\n\t\t\t\t<>\n\t\t\t\t\t<HtmlContainer\n\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t__html: bodyHTML,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tstyle={{ flex: 1 }}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t{children}\n\t\t\t{!hideFooter && (\n\t\t\t\t<FooterWrapper>\n\t\t\t\t\t<Tooltip body={footerText ?? ''} placement={'top'}>\n\t\t\t\t\t\t<FooterText style={{ flex: 1 }}>{footerText}</FooterText>\n\t\t\t\t\t</Tooltip>\n\n\t\t\t\t\t<TimeStamp>16:48</TimeStamp>\n\t\t\t\t</FooterWrapper>\n\t\t\t)}\n\n\t\t\t{/* Instead of action Type, this renders ChatBtn for all buttons. Rest of the code based on Action Type is maintained for backward compatibility */}\n\t\t\t{buttons && buttons.length > 0 ? (\n\t\t\t\tbuttons.map((button, i) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttext={button.type === 'COPY_CODE' ? 'Copy code' : button.text}\n\t\t\t\t\t\t\tIcon={icons[button.type]}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t\ticonPosition={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? 'right' : 'left'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttextTypography={\n\t\t\t\t\t\t\t\tbutton.type === 'CALL_PERMISSION' ? TitleSmall : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t) : actionTypes === ACTIONS_TYPES.QUICK_REPLY ? (\n\t\t\t\t<div>\n\t\t\t\t\t{quickReplybtn?.map((button, i) => (\n\t\t\t\t\t\t<ChatBtn key={i} text={button.text} />\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : actionTypes === ACTIONS_TYPES.CTA_BTN ? (\n\t\t\t\t<div>\n\t\t\t\t\t{ctaBtn?.map((ctaBtn, i) => (\n\t\t\t\t\t\t<ChatBtn\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\ttextTypography={showHeader ? Caption : BodySecondary}\n\t\t\t\t\t\t\textraContent={extras ? ctaBtn.extra : undefined}\n\t\t\t\t\t\t\tplaceholder={ctaBtn.placeholder}\n\t\t\t\t\t\t\ttext={ctaBtn.text}\n\t\t\t\t\t\t\tIcon={ctaBtn.type === 'phoneNumber' ? PhoneIcon : RedirectToIcon}\n\t\t\t\t\t\t\tsize={size}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\t<></>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["SideCaret","styled","div","HtmlContainer","COLORS","content","primary","HeaderTextContainer","variableEditorHelper","VariableEditorHelper","ChatUIV2","props","bodyText","footerText","headerMediaType","headerText","headerAssetLink","headerAssetName","quickReplybtn","ctaBtn","actionTypes","extras","showHeader","imagePreviewStyles","size","bodyVariableList","headerVariableList","buttons","limitedTimeOfferComponent","carouselCardIndex","isWhatsappCarousel","isPreview","children","hideFooter","bodyHTML","format","replace","headerHtml","selectedCarouselIndex","isProductCarouselType","errorIndexes","isCarouselHovered","useTemplateModalContext","icons","COPY_CODE","CopyCodeIcon","PHONE_NUMBER","PhoneIcon","URL","RedirectToIcon","QUICK_REPLY","QRBIcon","VOICE_CALL","CALL_PERMISSION","ChevronDownIcon","REQUEST_CONTACT_INFO","undefined","_jsxs","Container","Object","assign","isCarouselCard","showBorder","hasError","includes","showDashedBorder","_jsx","HalfRectangleIcon","color","height","width","HEADER_TYPES","TEXT","dangerouslySetInnerHTML","__html","NONE","MediaCard","mediaType","IMAGE","_Fragment","dateTime","LimitedTimeOffer","text","code","style","flex","FooterWrapper","Tooltip","body","placement","FooterText","TimeStamp","length","map","button","i","ChatBtn","type","Icon","iconPosition","textTypography","TitleSmall","ACTIONS_TYPES","CTA_BTN","Caption","BodySecondary","extraContent","extra","placeholder"],"mappings":"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"}
|
|
@@ -19,7 +19,7 @@ export type WhatsAppTemplate = {
|
|
|
19
19
|
has_expiration: boolean;
|
|
20
20
|
};
|
|
21
21
|
buttons?: {
|
|
22
|
-
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL';
|
|
22
|
+
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'REQUEST_CONTACT_INFO';
|
|
23
23
|
text?: string;
|
|
24
24
|
url?: string;
|
|
25
25
|
example?: string[];
|
|
@@ -59,7 +59,7 @@ export type WhatsAppTemplate = {
|
|
|
59
59
|
showCallPermissionCard?: boolean;
|
|
60
60
|
callPermissionText?: string;
|
|
61
61
|
};
|
|
62
|
-
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'CALL_PERMISSION';
|
|
62
|
+
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL' | 'CALL_PERMISSION' | 'REQUEST_CONTACT_INFO';
|
|
63
63
|
export type CreateTemplateType = {
|
|
64
64
|
/** Data */
|
|
65
65
|
headerType: HEADER_TYPES;
|
|
@@ -291,7 +291,8 @@ export declare enum BUTTON_TYPE {
|
|
|
291
291
|
URL = "URL",
|
|
292
292
|
PHONE_NUMBER = "PHONE_NUMBER",
|
|
293
293
|
COPY_CODE = "COPY_CODE",
|
|
294
|
-
VOICE_CALL = "VOICE_CALL"
|
|
294
|
+
VOICE_CALL = "VOICE_CALL",
|
|
295
|
+
REQUEST_CONTACT_INFO = "REQUEST_CONTACT_INFO"
|
|
295
296
|
}
|
|
296
297
|
export declare enum POD {
|
|
297
298
|
CHATBOT = "CHATBOT",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var E,N,O;!function(E){E.GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",E.UNKNOWN="UNKNOWN"}(E||(E={})),function(E){E.QUICK_REPLY="QUICK_REPLY",E.URL="URL",E.PHONE_NUMBER="PHONE_NUMBER",E.COPY_CODE="COPY_CODE",E.VOICE_CALL="VOICE_CALL"}(N||(N={})),function(E){E.CHATBOT="CHATBOT",E.GROWTH="GROWTH",E.CAMPAIGN="CAMPAIGN",E.CRM="CRM",E.INTEGRATIONS="INTEGRATIONS",E.OPENAI="OPENAI",E.DM="DM",E.FRONTEND="FRONTEND"}(O||(O={}));export{N as BUTTON_TYPE,O as POD,E as TEMPLATE_QUALITY};
|
|
1
|
+
var E,N,O;!function(E){E.GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",E.UNKNOWN="UNKNOWN"}(E||(E={})),function(E){E.QUICK_REPLY="QUICK_REPLY",E.URL="URL",E.PHONE_NUMBER="PHONE_NUMBER",E.COPY_CODE="COPY_CODE",E.VOICE_CALL="VOICE_CALL",E.REQUEST_CONTACT_INFO="REQUEST_CONTACT_INFO"}(N||(N={})),function(E){E.CHATBOT="CHATBOT",E.GROWTH="GROWTH",E.CAMPAIGN="CAMPAIGN",E.CRM="CRM",E.INTEGRATIONS="INTEGRATIONS",E.OPENAI="OPENAI",E.DM="DM",E.FRONTEND="FRONTEND"}(O||(O={}));export{N as BUTTON_TYPE,O as POD,E as TEMPLATE_QUALITY};
|
|
2
2
|
//# sourceMappingURL=WhatsAppTemplate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WhatsAppTemplate.js","sources":["../../../../../src/components/template-preview/models/WhatsAppTemplate.ts"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { variableType } from '../helpers/VariableEditorHelper';\nimport { CHANNEL_TYPE } from './Channels';\nimport {\n\tACTIONS_TYPES,\n\tButtonPlaceHolderOptions,\n\tCUSTOM_VARIABLE,\n\tHEADER_TYPES,\n\tQUICK_REPLY_BUTTON,\n\tTEMPLATE_STATUS,\n} from './TemplateMeta';\n\nexport type WhatsAppTemplate = {\n\tname: string;\n\tlabel: string;\n\trecommended?: boolean;\n\ttemplateId?: string;\n\tchannel: CHANNEL_TYPE;\n\ttemplateCategory: string;\n\ttype?: 'email' | 'whatsapp';\n\tcomponents: {\n\t\ttype:\n\t\t\t| 'HEADER'\n\t\t\t| 'BODY'\n\t\t\t| 'BUTTONS'\n\t\t\t| 'FOOTER'\n\t\t\t| 'limited_time_offer'\n\t\t\t| 'TITLE';\n\t\tformat?: HEADER_TYPES;\n\t\ttext?: string;\n\t\tlimited_time_offer?: {\n\t\t\ttext: string;\n\t\t\thas_expiration: boolean;\n\t\t};\n\t\tbuttons?: {\n\t\t\ttype: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE' | 'VOICE_CALL';\n\t\t\ttext?: string;\n\t\t\turl?: string;\n\t\t\texample?: string[];\n\t\t\tlinkMode?: 'custom' | 'home';\n\t\t\tphone_number?: string;\n\t\t\tflowName?: string;\n\t\t\tflowId?: string;\n\t\t}[];\n\t\texample?: {\n\t\t\theader_handle?: Array<string>;\n\t\t\tbody_text?: Array<string[]>;\n\t\t\theader_text?: Array<string>;\n\t\t\tlimited_time_offer?: string;\n\t\t\ttitle_text?: Array<string[]>;\n\t\t};\n\t}[];\n\tmapping: {\n\t\theader?: string[];\n\t\tbody?: string[];\n\t\tbuttons?: string[];\n\t\ttitle?: string[];\n\t};\n\n\thtmlContentUrl?: string;\n\tlanguage: 'en_US';\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\tthumbnailImageUrl?: string;\n\tFB_blob_key?: string;\n\treason?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tisDraft?: boolean;\n\tnewQualityScore?: TEMPLATE_QUALITY;\n\tpreviousQualityScore?: TEMPLATE_QUALITY;\n\taiContentConfigId?: string;\n\tisAiGenerated?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\n\nexport type WhatsappTemplateButtonTypes =\n\t| 'QUICK_REPLY'\n\t| 'URL'\n\t| 'PHONE_NUMBER'\n\t| 'COPY_CODE'\n\t| 'VOICE_CALL'\n\t| 'CALL_PERMISSION';\n\nexport type CreateTemplateType = {\n\t/** Data */\n\theaderType: HEADER_TYPES;\n\theaderAssetLink?: string | null;\n\theaderAssetName?: string | null;\n\theaderText?: string;\n\n\theaderVariables: templateVariable[];\n\tbodyVariables: templateVariable[];\n\ttitleVariables?: templateVariable[];\n\n\tbodyText?: string;\n\ttitleText?: string;\n\tbodyTextRaw?: string;\n\n\tfooterText?: string;\n\n\tactionsType: ACTIONS_TYPES;\n\n\tquickReply: Array<QUICK_REPLY_BUTTON>;\n\tctaBtn: {\n\t\tphoneNumber?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tphoneNumber?: string;\n\t\t};\n\t\twebsiteLinkBtn?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tlinkOpens?: string;\n\t\t\tplaceholder?: string;\n\t\t};\n\t};\n\tallButtons: WhatsappPreviewButtonType[];\n\n\tmeta: {\n\t\tname: string;\n\t\tcategory?: string;\n\t\tsubCategory?: string;\n\t\tlanguage?: string;\n\t\ttemplateId?: string;\n\t};\n\n\tmode: 'edit' | 'create';\n\talreadyAsADraft?: boolean;\n\t/** UI */\n\tinitialLoading: boolean;\n\n\tlimitedTimeOfferComponent: {\n\t\ttext: string;\n\t\tdateTime: string;\n\t\tcode: string;\n\t};\n\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\n\terror: {\n\t\tmodalError?: string;\n\t\theader?: string;\n\t\tbody?: string;\n\t\tfooter?: string;\n\t\tquickReply?: Array<string | null>;\n\t\tmeta?: {\n\t\t\tname?: string;\n\t\t};\n\t\tctaBtn?: {\n\t\t\tphoneNumber: {\n\t\t\t\tbtnText: string;\n\t\t\t\tlink: string;\n\t\t\t};\n\t\t\twebsiteLink: { btnText: string; link: string };\n\t\t};\n\t};\n\n\t/** DATA DUMP */\n\tbuttonPlaceholders?: templatePlaceHolder[];\n};\n\nexport type templatePlaceHolder = {\n\tdefault_value: string;\n\tplaceHolder: string;\n\ttitle: string;\n};\n\nexport type templateVariable = {\n\teditable: boolean;\n\tvariableName: string;\n\tvariableVal?: string;\n\teditableDefaultValues?: string | null;\n\tidx: number;\n};\n\nexport type getTemplateByIdResponse = {\n\tcomponents: WhatsAppTemplate['components'];\n\tlanguage: string;\n\tlabel: string;\n\tcreatedAt: any;\n\ttemplateId: string;\n\tname: string;\n\tcreatedBy: string;\n\tchannel: string;\n\tisDraft?: boolean;\n\tmapping: TemplateVariableMapping;\n\tisArchive?: boolean;\n\tstoreId: string;\n\tchannelTemplateId: string;\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\ttemplateCategory: string;\n\tsyncOnboarding?: boolean;\n\trecomendedForCohorts?: string[];\n\thtmlContentUrl?: string;\n};\n\nexport type TemplateVariableMapping = {\n\tbody: string[];\n\tbuttons: string[];\n\theader: string[];\n\tfooter: string[];\n\ttitle?: string[];\n};\n\nexport type WhatsappLikePreviewTypes = {\n\tbodyText?: string;\n\tfooterText?: string;\n\theaderMediaType: HEADER_TYPES;\n\theaderText?: string;\n\theaderAssetLink?: string;\n\theaderAssetName?: string;\n\tquickReplybtn?: QUICK_REPLY_BUTTON[];\n\tctaBtn?: {\n\t\ttype: 'phoneNumber' | 'website';\n\t\ttext: string;\n\t\textra?: string;\n\t\tplaceholder?: string;\n\t}[];\n\tactionTypes?: ACTIONS_TYPES;\n\ttextType: 'html' | 'markdown';\n\thidePreviewText?: boolean;\n\textras?: boolean;\n\tcontainerStyle?: React.CSSProperties;\n\tshowHeader?: boolean;\n\tcontainerPadding?: string;\n\timagePreviewStyles?: React.CSSProperties;\n\tsize?: 'small' | 'large';\n\tzeroStateComponent: ReactElement<any, any>;\n\tchildren?: React.ReactNode;\n\tbodyVariableList?: variableType[];\n\theaderVariableList?: variableType[];\n\tcarouselCardIndex?: number;\n\tbuttons?: WhatsappPreviewButtonType[];\n\tlimitedTimeOfferComponent?: CreateTemplateType['limitedTimeOfferComponent'];\n\tisWhatsappCarousel?: boolean;\n\tisPreview?: boolean;\n\ttitleText?: string;\n\ttitleVariableList?: variableType[];\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\thideFooter?: boolean;\n};\n\nexport type WhatsappPreviewButtonType = {\n\ttype: WhatsappTemplateButtonTypes;\n\ttext: string;\n\tplaceholder?: string;\n\tflowId: string;\n\tflowName: string;\n};\n\nexport enum TEMPLATE_QUALITY {\n\tGREEN = 'GREEN',\n\tYELLOW = 'YELLOW',\n\tRED = 'RED',\n\tUNKNOWN = 'UNKNOWN',\n}\n\nexport type WhatsappMeta = {\n\tcontainerStyle?: React.CSSProperties | undefined;\n\ttemplateContainerStyles?: React.CSSProperties | undefined;\n\tsize?: 'small' | 'large';\n\tshowWhatsAppHeader?: boolean;\n\twhatsAppExtras?: boolean;\n\tzeroStateComponent?: ReactElement;\n\tusePlaceHolderName?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\nexport interface IMimeTypeResponse {\n\tisValid: boolean;\n\tmimeType: string;\n}\nexport type WhatsAppPickerMeta = {\n\tuploadMediaFiles: (\n\t\tparams: WhatsAppMediaUploadRequest,\n\t\tindex?: number,\n\t) => Promise<WhatsAppMediaUploadResponse>;\n\tuploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;\n\tvalidateMimeType?: (file: File | Blob) => Promise<IMimeTypeResponse>;\n\tCTAoptions?: ButtonPlaceHolderOptions[];\n\tQRBoptions?: ButtonPlaceHolderOptions[];\n};\n\nexport type WhatsAppMediaUploadResponse = {\n\tsuccess: boolean;\n\turl?: string;\n};\nexport interface MediaLinkUploadResponse extends WhatsAppMediaUploadResponse {\n\tsize: number;\n\ttype: string;\n}\n\nexport type WhatsAppMediaUploadRequest = {\n\tfile: File;\n\tfileName: string;\n\tisImage: boolean;\n};\n\nexport interface WhatsAppTemplateVariables {\n\tbody: CUSTOM_VARIABLE[];\n\theader: CUSTOM_VARIABLE[];\n\tbuttons: TEMPLATE_BUTTON[];\n\ttitle?: CUSTOM_VARIABLE[];\n}\n\nexport type CTABtnValType =\n\t| {\n\t\t\tdefaultValue: string;\n\t\t\tplaceHolder: string;\n\t }\n\t| string;\n\nexport type QRBBtnValType = {\n\tflowId?: string;\n\tflowName?: string;\n};\n\nexport type TEMPLATE_BUTTON = {\n\ttype: BUTTON_TYPE;\n\ttext?: string;\n\turl?: string;\n\texample?: string[] | string;\n\tlinkMode?: 'custom' | 'home';\n\tphone_number?: string;\n\tbuttonVariable?: string;\n\tindex?: number;\n\tflowId?: string;\n\tflowName?: string;\n\tqueryParams?: { key: string; value: string }[];\n};\n\nexport enum BUTTON_TYPE {\n\tQUICK_REPLY = 'QUICK_REPLY',\n\tURL = 'URL',\n\tPHONE_NUMBER = 'PHONE_NUMBER',\n\tCOPY_CODE = 'COPY_CODE',\n\tVOICE_CALL = 'VOICE_CALL',\n}\n\nexport enum POD {\n\tCHATBOT = 'CHATBOT',\n\tGROWTH = 'GROWTH',\n\tCAMPAIGN = 'CAMPAIGN',\n\tCRM = 'CRM',\n\tINTEGRATIONS = 'INTEGRATIONS',\n\tOPENAI = 'OPENAI',\n\tDM = 'DM',\n\tFRONTEND = 'FRONTEND',\n}\n\nexport type ExtrasWhatsapp = {\n\tdiscountCodeExtra?: [\n\t\tdiscountCode: string,\n\t\tsetDiscountCode: (discountCode: string) => void,\n\t];\n\tbackTrackExtra?: [\n\t\tbackTrackMessage: string,\n\t\tsetBackTrackMessage: (backTrackMessage: string) => void,\n\t];\n};\n\nexport type TemplateAnalyticsI = {\n\tfetchAnalytics?: (templateId: string) => Promise<TemplateAnalyticsResponseI>;\n\tshow?: boolean;\n\ttemplateQuality?: TEMPLATE_QUALITY;\n\tdata?: TemplateAnalyticsDataI;\n};\n\nexport type TemplateAnalyticsResponseI = {\n\tsuccess: boolean;\n\tanalytics?: TemplateAnalyticsDataI;\n};\nexport interface TemplateAnalyticsDataI {\n\ttotalReads: number;\n\ttotalSent: number;\n\ttotalDelivered: number;\n\tdeliveredPercentage: number;\n\treadPercentage: number;\n\tclickAnalytics: {\n\t\t[buttonName: string]: {\n\t\t\ttotalClicks: number;\n\t\t\tclickPercentage: number;\n\t\t};\n\t};\n\tperformance: {\n\t\t//eg: ['GREEN','YELLOW','RED','GREEN']\n\t\tqualityTimeLine: TEMPLATE_QUALITY[];\n\t};\n}\n\nexport interface TemplateAnalyticsComponentI {\n\ttemplateAnalytics?: TemplateAnalyticsI;\n\ttemplateId: string;\n\tonClose?: () => void;\n\tonProceed?: () => void;\n\tonCancel?: () => void;\n\theadingTitle?: string;\n\theadingSubtitle?: string;\n\tanalyticsData?: TemplateAnalyticsDataI;\n}\n"],"names":["TEMPLATE_QUALITY","BUTTON_TYPE","POD"],"mappings":"IA+PYA,EAiFAC,EAQAC,GAzFZ,SAAYF,GACXA,EAAA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,IAAA,MACAA,EAAA,QAAA,SACA,CALD,CAAYA,IAAAA,EAKX,CAAA,IA4ED,SAAYC,GACXA,EAAA,YAAA,cACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,UAAA,YACAA,EAAA,WAAA,YACA,CAND,CAAYA,IAAAA,EAMX,CAAA,IAED,SAAYC,GACXA,EAAA,QAAA,UACAA,EAAA,OAAA,SACAA,EAAA,SAAA,WACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,OAAA,SACAA,EAAA,GAAA,KACAA,EAAA,SAAA,UACA,CATD,CAAYA,IAAAA,EASX,CAAA"}
|
|
1
|
+
{"version":3,"file":"WhatsAppTemplate.js","sources":["../../../../../src/components/template-preview/models/WhatsAppTemplate.ts"],"sourcesContent":["import React, { ReactElement } from 'react';\nimport { variableType } from '../helpers/VariableEditorHelper';\nimport { CHANNEL_TYPE } from './Channels';\nimport {\n\tACTIONS_TYPES,\n\tButtonPlaceHolderOptions,\n\tCUSTOM_VARIABLE,\n\tHEADER_TYPES,\n\tQUICK_REPLY_BUTTON,\n\tTEMPLATE_STATUS,\n} from './TemplateMeta';\n\nexport type WhatsAppTemplate = {\n\tname: string;\n\tlabel: string;\n\trecommended?: boolean;\n\ttemplateId?: string;\n\tchannel: CHANNEL_TYPE;\n\ttemplateCategory: string;\n\ttype?: 'email' | 'whatsapp';\n\tcomponents: {\n\t\ttype:\n\t\t\t| 'HEADER'\n\t\t\t| 'BODY'\n\t\t\t| 'BUTTONS'\n\t\t\t| 'FOOTER'\n\t\t\t| 'limited_time_offer'\n\t\t\t| 'TITLE';\n\t\tformat?: HEADER_TYPES;\n\t\ttext?: string;\n\t\tlimited_time_offer?: {\n\t\t\ttext: string;\n\t\t\thas_expiration: boolean;\n\t\t};\n\t\tbuttons?: {\n\t\t\ttype:\n\t\t\t\t| 'QUICK_REPLY'\n\t\t\t\t| 'URL'\n\t\t\t\t| 'PHONE_NUMBER'\n\t\t\t\t| 'COPY_CODE'\n\t\t\t\t| 'VOICE_CALL'\n\t\t\t\t| 'REQUEST_CONTACT_INFO';\n\t\t\ttext?: string;\n\t\t\turl?: string;\n\t\t\texample?: string[];\n\t\t\tlinkMode?: 'custom' | 'home';\n\t\t\tphone_number?: string;\n\t\t\tflowName?: string;\n\t\t\tflowId?: string;\n\t\t}[];\n\t\texample?: {\n\t\t\theader_handle?: Array<string>;\n\t\t\tbody_text?: Array<string[]>;\n\t\t\theader_text?: Array<string>;\n\t\t\tlimited_time_offer?: string;\n\t\t\ttitle_text?: Array<string[]>;\n\t\t};\n\t}[];\n\tmapping: {\n\t\theader?: string[];\n\t\tbody?: string[];\n\t\tbuttons?: string[];\n\t\ttitle?: string[];\n\t};\n\n\thtmlContentUrl?: string;\n\tlanguage: 'en_US';\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\tthumbnailImageUrl?: string;\n\tFB_blob_key?: string;\n\treason?: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n\tisDraft?: boolean;\n\tnewQualityScore?: TEMPLATE_QUALITY;\n\tpreviousQualityScore?: TEMPLATE_QUALITY;\n\taiContentConfigId?: string;\n\tisAiGenerated?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\n\nexport type WhatsappTemplateButtonTypes =\n\t| 'QUICK_REPLY'\n\t| 'URL'\n\t| 'PHONE_NUMBER'\n\t| 'COPY_CODE'\n\t| 'VOICE_CALL'\n\t| 'CALL_PERMISSION'\n\t| 'REQUEST_CONTACT_INFO';\n\nexport type CreateTemplateType = {\n\t/** Data */\n\theaderType: HEADER_TYPES;\n\theaderAssetLink?: string | null;\n\theaderAssetName?: string | null;\n\theaderText?: string;\n\n\theaderVariables: templateVariable[];\n\tbodyVariables: templateVariable[];\n\ttitleVariables?: templateVariable[];\n\n\tbodyText?: string;\n\ttitleText?: string;\n\tbodyTextRaw?: string;\n\n\tfooterText?: string;\n\n\tactionsType: ACTIONS_TYPES;\n\n\tquickReply: Array<QUICK_REPLY_BUTTON>;\n\tctaBtn: {\n\t\tphoneNumber?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tphoneNumber?: string;\n\t\t};\n\t\twebsiteLinkBtn?: {\n\t\t\tisChecked?: boolean;\n\t\t\tbtnText?: string;\n\t\t\tlinkOpens?: string;\n\t\t\tplaceholder?: string;\n\t\t};\n\t};\n\tallButtons: WhatsappPreviewButtonType[];\n\n\tmeta: {\n\t\tname: string;\n\t\tcategory?: string;\n\t\tsubCategory?: string;\n\t\tlanguage?: string;\n\t\ttemplateId?: string;\n\t};\n\n\tmode: 'edit' | 'create';\n\talreadyAsADraft?: boolean;\n\t/** UI */\n\tinitialLoading: boolean;\n\n\tlimitedTimeOfferComponent: {\n\t\ttext: string;\n\t\tdateTime: string;\n\t\tcode: string;\n\t};\n\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\n\terror: {\n\t\tmodalError?: string;\n\t\theader?: string;\n\t\tbody?: string;\n\t\tfooter?: string;\n\t\tquickReply?: Array<string | null>;\n\t\tmeta?: {\n\t\t\tname?: string;\n\t\t};\n\t\tctaBtn?: {\n\t\t\tphoneNumber: {\n\t\t\t\tbtnText: string;\n\t\t\t\tlink: string;\n\t\t\t};\n\t\t\twebsiteLink: { btnText: string; link: string };\n\t\t};\n\t};\n\n\t/** DATA DUMP */\n\tbuttonPlaceholders?: templatePlaceHolder[];\n};\n\nexport type templatePlaceHolder = {\n\tdefault_value: string;\n\tplaceHolder: string;\n\ttitle: string;\n};\n\nexport type templateVariable = {\n\teditable: boolean;\n\tvariableName: string;\n\tvariableVal?: string;\n\teditableDefaultValues?: string | null;\n\tidx: number;\n};\n\nexport type getTemplateByIdResponse = {\n\tcomponents: WhatsAppTemplate['components'];\n\tlanguage: string;\n\tlabel: string;\n\tcreatedAt: any;\n\ttemplateId: string;\n\tname: string;\n\tcreatedBy: string;\n\tchannel: string;\n\tisDraft?: boolean;\n\tmapping: TemplateVariableMapping;\n\tisArchive?: boolean;\n\tstoreId: string;\n\tchannelTemplateId: string;\n\tstatus: TEMPLATE_STATUS;\n\tcategory: string;\n\ttemplateCategory: string;\n\tsyncOnboarding?: boolean;\n\trecomendedForCohorts?: string[];\n\thtmlContentUrl?: string;\n};\n\nexport type TemplateVariableMapping = {\n\tbody: string[];\n\tbuttons: string[];\n\theader: string[];\n\tfooter: string[];\n\ttitle?: string[];\n};\n\nexport type WhatsappLikePreviewTypes = {\n\tbodyText?: string;\n\tfooterText?: string;\n\theaderMediaType: HEADER_TYPES;\n\theaderText?: string;\n\theaderAssetLink?: string;\n\theaderAssetName?: string;\n\tquickReplybtn?: QUICK_REPLY_BUTTON[];\n\tctaBtn?: {\n\t\ttype: 'phoneNumber' | 'website';\n\t\ttext: string;\n\t\textra?: string;\n\t\tplaceholder?: string;\n\t}[];\n\tactionTypes?: ACTIONS_TYPES;\n\ttextType: 'html' | 'markdown';\n\thidePreviewText?: boolean;\n\textras?: boolean;\n\tcontainerStyle?: React.CSSProperties;\n\tshowHeader?: boolean;\n\tcontainerPadding?: string;\n\timagePreviewStyles?: React.CSSProperties;\n\tsize?: 'small' | 'large';\n\tzeroStateComponent: ReactElement<any, any>;\n\tchildren?: React.ReactNode;\n\tbodyVariableList?: variableType[];\n\theaderVariableList?: variableType[];\n\tcarouselCardIndex?: number;\n\tbuttons?: WhatsappPreviewButtonType[];\n\tlimitedTimeOfferComponent?: CreateTemplateType['limitedTimeOfferComponent'];\n\tisWhatsappCarousel?: boolean;\n\tisPreview?: boolean;\n\ttitleText?: string;\n\ttitleVariableList?: variableType[];\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n\thideFooter?: boolean;\n};\n\nexport type WhatsappPreviewButtonType = {\n\ttype: WhatsappTemplateButtonTypes;\n\ttext: string;\n\tplaceholder?: string;\n\tflowId: string;\n\tflowName: string;\n};\n\nexport enum TEMPLATE_QUALITY {\n\tGREEN = 'GREEN',\n\tYELLOW = 'YELLOW',\n\tRED = 'RED',\n\tUNKNOWN = 'UNKNOWN',\n}\n\nexport type WhatsappMeta = {\n\tcontainerStyle?: React.CSSProperties | undefined;\n\ttemplateContainerStyles?: React.CSSProperties | undefined;\n\tsize?: 'small' | 'large';\n\tshowWhatsAppHeader?: boolean;\n\twhatsAppExtras?: boolean;\n\tzeroStateComponent?: ReactElement;\n\tusePlaceHolderName?: boolean;\n\tshowCallPermissionCard?: boolean;\n\tcallPermissionText?: string;\n};\nexport interface IMimeTypeResponse {\n\tisValid: boolean;\n\tmimeType: string;\n}\nexport type WhatsAppPickerMeta = {\n\tuploadMediaFiles: (\n\t\tparams: WhatsAppMediaUploadRequest,\n\t\tindex?: number,\n\t) => Promise<WhatsAppMediaUploadResponse>;\n\tuploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;\n\tvalidateMimeType?: (file: File | Blob) => Promise<IMimeTypeResponse>;\n\tCTAoptions?: ButtonPlaceHolderOptions[];\n\tQRBoptions?: ButtonPlaceHolderOptions[];\n};\n\nexport type WhatsAppMediaUploadResponse = {\n\tsuccess: boolean;\n\turl?: string;\n};\nexport interface MediaLinkUploadResponse extends WhatsAppMediaUploadResponse {\n\tsize: number;\n\ttype: string;\n}\n\nexport type WhatsAppMediaUploadRequest = {\n\tfile: File;\n\tfileName: string;\n\tisImage: boolean;\n};\n\nexport interface WhatsAppTemplateVariables {\n\tbody: CUSTOM_VARIABLE[];\n\theader: CUSTOM_VARIABLE[];\n\tbuttons: TEMPLATE_BUTTON[];\n\ttitle?: CUSTOM_VARIABLE[];\n}\n\nexport type CTABtnValType =\n\t| {\n\t\t\tdefaultValue: string;\n\t\t\tplaceHolder: string;\n\t }\n\t| string;\n\nexport type QRBBtnValType = {\n\tflowId?: string;\n\tflowName?: string;\n};\n\nexport type TEMPLATE_BUTTON = {\n\ttype: BUTTON_TYPE;\n\ttext?: string;\n\turl?: string;\n\texample?: string[] | string;\n\tlinkMode?: 'custom' | 'home';\n\tphone_number?: string;\n\tbuttonVariable?: string;\n\tindex?: number;\n\tflowId?: string;\n\tflowName?: string;\n\tqueryParams?: { key: string; value: string }[];\n};\n\nexport enum BUTTON_TYPE {\n\tQUICK_REPLY = 'QUICK_REPLY',\n\tURL = 'URL',\n\tPHONE_NUMBER = 'PHONE_NUMBER',\n\tCOPY_CODE = 'COPY_CODE',\n\tVOICE_CALL = 'VOICE_CALL',\n\tREQUEST_CONTACT_INFO = 'REQUEST_CONTACT_INFO',\n}\n\nexport enum POD {\n\tCHATBOT = 'CHATBOT',\n\tGROWTH = 'GROWTH',\n\tCAMPAIGN = 'CAMPAIGN',\n\tCRM = 'CRM',\n\tINTEGRATIONS = 'INTEGRATIONS',\n\tOPENAI = 'OPENAI',\n\tDM = 'DM',\n\tFRONTEND = 'FRONTEND',\n}\n\nexport type ExtrasWhatsapp = {\n\tdiscountCodeExtra?: [\n\t\tdiscountCode: string,\n\t\tsetDiscountCode: (discountCode: string) => void,\n\t];\n\tbackTrackExtra?: [\n\t\tbackTrackMessage: string,\n\t\tsetBackTrackMessage: (backTrackMessage: string) => void,\n\t];\n};\n\nexport type TemplateAnalyticsI = {\n\tfetchAnalytics?: (templateId: string) => Promise<TemplateAnalyticsResponseI>;\n\tshow?: boolean;\n\ttemplateQuality?: TEMPLATE_QUALITY;\n\tdata?: TemplateAnalyticsDataI;\n};\n\nexport type TemplateAnalyticsResponseI = {\n\tsuccess: boolean;\n\tanalytics?: TemplateAnalyticsDataI;\n};\nexport interface TemplateAnalyticsDataI {\n\ttotalReads: number;\n\ttotalSent: number;\n\ttotalDelivered: number;\n\tdeliveredPercentage: number;\n\treadPercentage: number;\n\tclickAnalytics: {\n\t\t[buttonName: string]: {\n\t\t\ttotalClicks: number;\n\t\t\tclickPercentage: number;\n\t\t};\n\t};\n\tperformance: {\n\t\t//eg: ['GREEN','YELLOW','RED','GREEN']\n\t\tqualityTimeLine: TEMPLATE_QUALITY[];\n\t};\n}\n\nexport interface TemplateAnalyticsComponentI {\n\ttemplateAnalytics?: TemplateAnalyticsI;\n\ttemplateId: string;\n\tonClose?: () => void;\n\tonProceed?: () => void;\n\tonCancel?: () => void;\n\theadingTitle?: string;\n\theadingSubtitle?: string;\n\tanalyticsData?: TemplateAnalyticsDataI;\n}\n"],"names":["TEMPLATE_QUALITY","BUTTON_TYPE","POD"],"mappings":"IAsQYA,EAiFAC,EASAC,GA1FZ,SAAYF,GACXA,EAAA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,IAAA,MACAA,EAAA,QAAA,SACA,CALD,CAAYA,IAAAA,EAKX,CAAA,IA4ED,SAAYC,GACXA,EAAA,YAAA,cACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,UAAA,YACAA,EAAA,WAAA,aACAA,EAAA,qBAAA,sBACA,CAPD,CAAYA,IAAAA,EAOX,CAAA,IAED,SAAYC,GACXA,EAAA,QAAA,UACAA,EAAA,OAAA,SACAA,EAAA,SAAA,WACAA,EAAA,IAAA,MACAA,EAAA,aAAA,eACAA,EAAA,OAAA,SACAA,EAAA,GAAA,KACAA,EAAA,SAAA,UACA,CATD,CAAYA,IAAAA,EASX,CAAA"}
|