@bikdotai/bik-component-library 0.0.595 → 0.0.596
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/ChatUI.js +2 -2
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +2 -2
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/halfRectangle.svg.js"),r=require("../../../assets/icons/phone.svg.js"),s=require("../../../assets/icons/RedirectToNew.svg.js"),i=require("react"),a=require("styled-components"),o=require("../../tooltips/Tooltip.js"),n=require("../../TypographyStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/halfRectangle.svg.js"),r=require("../../../assets/icons/phone.svg.js"),s=require("../../../assets/icons/RedirectToNew.svg.js"),i=require("react"),a=require("styled-components"),o=require("../../tooltips/Tooltip.js"),n=require("../../TypographyStyle.js"),l=require("../../../constants/Theme.js"),d=require("../helpers/WhatsAppFormatToHTML.js"),c=require("../models/TemplateMeta.js"),p=require("./ChatBtn.js"),h=require("./ChatUI.style.js"),x=require("./MediaCard.js"),u=require("./RenderTemplateWithVariable.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const j=T(a).default.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -7.7px;
|
|
6
6
|
top: -8px;
|
|
7
|
-
`;exports.default=a=>{const{bodyText:
|
|
7
|
+
`;exports.default=a=>{const{bodyText:T,footerText:m,headerMediaType:y,headerText:g,headerAssetLink:S,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:F,isPreview:O}=a,M=new d.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:l.COLORS.content.primary,margin:12,fontSize:C?l.FONTS.caption.fontSize:l.FONTS.bodySecondary.fontSize,fontWeight:l.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(h.Container,Object.assign({isPreview:O},{children:[e.jsx(j,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(u.default,{bold:!0,text:null==g?void 0:g.replace(/</g,"<").replace(/>/g,">")}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:S,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!T&&e.jsx(e.Fragment,{children:F?e.jsx(e.Fragment,{children:F}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(T)}}):e.jsx(n.BodySecondary,{children:null==T?void 0:T.replace(/</g,"<").replace(/>/g,">")})})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(h.FooterText,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(p.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(p.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/copy-code-icon.svg.js"),r=require("../../../assets/icons/halfRectangle.svg.js"),s=require("../../../assets/icons/phone.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/copy-code-icon.svg.js"),r=require("../../../assets/icons/halfRectangle.svg.js"),s=require("../../../assets/icons/phone.svg.js"),a=require("../../../assets/icons/qrb.svg.js"),i=require("../../../assets/icons/RedirectToNew.svg.js"),l=require("styled-components"),o=require("../../template-context-mapper/context/templateModalContext.js"),n=require("../../tooltips/Tooltip.js"),d=require("../../TypographyStyle.js"),p=require("../../../constants/Theme.js"),u=require("../helpers/VariableEditorHelper.js"),x=require("../models/TemplateMeta.js"),c=require("./ChatBtn.js"),h=require("./ChatUI.style.js"),m=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),j=require("./MediaCard.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=T(l);const g=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
|
-
`,
|
|
7
|
+
`,y=f.default.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
14
|
color: ${p.COLORS.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,C=f.default(y)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,v=new u.VariableEditorHelper;exports.ChatUIV2=l=>{const{bodyText:p,footerText:u,headerMediaType:T,headerText:f,headerAssetLink:E,headerAssetName:b,quickReplybtn:q,ctaBtn:O,actionTypes:w,extras:_,showHeader:P,imagePreviewStyles:I,size:S,bodyVariableList:L,headerVariableList:A,buttons:M,limitedTimeOfferComponent:N,carouselCardIndex:R,isWhatsappCarousel:B,isPreview:H}=l,Y=v.format(null==p?void 0:p.replace(/</g,"<").replace(/>/g,">"),L),D=v.format(null==f?void 0:f.replace(/</g,"<").replace(/>/g,">"),A),{selectedCarouselIndex:F,isProductCarouselType:U,errorIndexes:V,isCarouselHovered:k}=o.useTemplateModalContext(),z={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:i.default,QUICK_REPLY:a.default};return e.jsxs(h.Container,Object.assign({isCarouselCard:null!=R&&R>-1,showBorder:null!=R&&R===F||U&&null!=R&&R>-1&&null!=F&&F>-1,hasError:null==V?void 0:V.includes(null!=R?R:-2),isWhatsappCarousel:B,isPreview:H,showDashedBorder:U&&k&&(null!=F?F:-1)<0&&(null!=R?R:-1)>-1},{children:[!B&&e.jsx(g,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===x.HEADER_TYPES.TEXT?e.jsx(C,{dangerouslySetInnerHTML:{__html:D}}):T!==x.HEADER_TYPES.NONE?e.jsx(j.MediaCard,{headerAssetLink:E,headerAssetName:b,mediaType:T,imagePreviewStyles:T===x.HEADER_TYPES.IMAGE?I:{}}):e.jsx(e.Fragment,{}),(null==N?void 0:N.dateTime)?e.jsx(m.LimitedTimeOffer,{text:N.text,dateTime:N.dateTime,code:N.code}):e.jsx(e.Fragment,{}),!!p&&e.jsx(e.Fragment,{children:e.jsx(y,{dangerouslySetInnerHTML:{__html:Y},style:{flex:1}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(n.Tooltip,Object.assign({body:null!=u?u:"",placement:"top"},{children:e.jsx(h.FooterText,Object.assign({style:{flex:1}},{children:u}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),M&&M.length>0?M.map(((t,r)=>e.jsx(c.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:z[t.type],size:S},r))):w===x.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==q?void 0:q.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text},r)))}):w===x.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(c.ChatBtn,{textTypography:P?d.Caption:d.BodySecondary,extraContent:_?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:i.default,size:S},r)))}):e.jsx(e.Fragment,{})]}))};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as l}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as m}from"../../TypographyStyle.js";import{COLORS as d,FONTS as c}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as h}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as g}from"../models/TemplateMeta.js";import{ChatBtn as y}from"./ChatBtn.js";import{Container as T,FooterWrapper as x,FooterText as v,TimeStamp as j}from"./ChatUI.style.js";import{MediaCard as w}from"./MediaCard.js";import b from"./RenderTemplateWithVariable.js";const u=n.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -7.7px;
|
|
6
6
|
top: -8px;
|
|
7
|
-
`,S=n=>{const{bodyText:S,footerText:N,headerMediaType:A,headerText:M,headerAssetLink:C,headerAssetName:L,quickReplybtn:k,ctaBtn:z,actionTypes:B,textType:E,extras:I,showHeader:P,imagePreviewStyles:R,size:W,children:H,isPreview:O}=n,_=new
|
|
7
|
+
`,S=n=>{const{bodyText:S,footerText:N,headerMediaType:A,headerText:M,headerAssetLink:C,headerAssetName:L,quickReplybtn:k,ctaBtn:z,actionTypes:B,textType:E,extras:I,showHeader:P,imagePreviewStyles:R,size:W,children:H,isPreview:O}=n,_=new h,U=a((()=>({color:d.content.primary,margin:12,fontSize:P?c.caption.fontSize:c.bodySecondary.fontSize,fontWeight:c.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(T,Object.assign({isPreview:O},{children:[t(u,{children:t(o,{color:"white",height:8,width:8})}),A===f.TEXT?t(b,{bold:!0,text:null==M?void 0:M.replace(/</g,"<").replace(/>/g,">")}):A!==f.NONE?t(w,{headerAssetLink:C,headerAssetName:L,mediaType:A,imagePreviewStyles:A===f.IMAGE?R:{}}):t(r,{}),!!S&&t(r,{children:t(r,H?{children:H}:{children:"html"===E?t("div",{className:"richTextEditor",style:U,dangerouslySetInnerHTML:{__html:_.convertToHTML(S)}}):t(p,{children:null==S?void 0:S.replace(/</g,"<").replace(/>/g,">")})})}),e(x,{children:[t(l,Object.assign({body:null!=N?N:"",placement:"top"},{children:t(v,Object.assign({style:{flex:1}},{children:N}))})),t(j,{children:"16:48"})]}),B===g.QUICK_REPLY?t("div",{children:null==k?void 0:k.map(((e,r)=>t(y,{text:e.text},r)))}):B===g.CTA_BTN?t("div",{children:null==z?void 0:z.map(((e,r)=>t(y,{textTypography:P?m:p,extraContent:I?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:W},r)))}):t(r,{})]}))};export{S as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import l from"../../../assets/icons/qrb.svg.js";import a from"../../../assets/icons/RedirectToNew.svg.js";import n from"styled-components";import{useTemplateModalContext as p}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as d}from"../../tooltips/Tooltip.js";import{Caption as m,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as u}from"../models/TemplateMeta.js";import{ChatBtn as g}from"./ChatBtn.js";import{Container as y,FooterWrapper as T,FooterText as C,TimeStamp as v}from"./ChatUI.style.js";import{LimitedTimeOffer as j}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as w}from"./MediaCard.js";const b=n.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
@@ -11,9 +11,9 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"..
|
|
|
11
11
|
font-size: 14px;
|
|
12
12
|
line-height: 20px;
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
|
-
color: ${
|
|
14
|
+
color: ${h.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
16
|
`,O=n(I)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,E=new f,L=n=>{const{bodyText:
|
|
19
|
+
`,E=new f,L=n=>{const{bodyText:h,footerText:f,headerMediaType:L,headerText:P,headerAssetLink:_,headerAssetName:N,quickReplybtn:M,ctaBtn:R,actionTypes:A,extras:B,showHeader:H,imagePreviewStyles:S,size:U,bodyVariableList:k,headerVariableList:z,buttons:Y,limitedTimeOfferComponent:D,carouselCardIndex:V,isWhatsappCarousel:q,isPreview:K}=n,Q=E.format(null==h?void 0:h.replace(/</g,"<").replace(/>/g,">"),k),W=E.format(null==P?void 0:P.replace(/</g,"<").replace(/>/g,">"),z),{selectedCarouselIndex:G,isProductCarouselType:X,errorIndexes:$,isCarouselHovered:F}=p(),J={COPY_CODE:r,PHONE_NUMBER:s,URL:a,QUICK_REPLY:l};return e(y,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===G||X&&null!=V&&V>-1&&null!=G&&G>-1,hasError:null==$?void 0:$.includes(null!=V?V:-2),isWhatsappCarousel:q,isPreview:K,showDashedBorder:X&&F&&(null!=G?G:-1)<0&&(null!=V?V:-1)>-1},{children:[!q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),L===x.TEXT?t(O,{dangerouslySetInnerHTML:{__html:W}}):L!==x.NONE?t(w,{headerAssetLink:_,headerAssetName:N,mediaType:L,imagePreviewStyles:L===x.IMAGE?S:{}}):t(o,{}),(null==D?void 0:D.dateTime)?t(j,{text:D.text,dateTime:D.dateTime,code:D.code}):t(o,{}),!!h&&t(o,{children:t(I,{dangerouslySetInnerHTML:{__html:Q},style:{flex:1}})}),e(T,{children:[t(d,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(v,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(g,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:J[e.type],size:U},o))):A===u.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(g,{text:e.text},o)))}):A===u.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(g,{textTypography:H?m:c,extraContent:B?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:a,size:U},o)))}):t(o,{})]}))};export{L as ChatUIV2};
|