@bikdotai/bik-component-library 0.0.419-beta.19 → 0.0.419-beta.20

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.
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 19 19"},e),t||(t=r.createElement("path",{fill:"#1877F2",fillRule:"evenodd",d:"M8.137 3.676a.75.75 0 0 0-.817.163l-5.25 5.25a.75.75 0 0 0 0 1.06l5.25 5.25a.75.75 0 0 0 1.28-.53v-2.307c3.146.15 5.305 1.274 6.89 3.493a.75.75 0 0 0 1.346-.583c-.393-1.963-1.186-3.97-2.609-5.597-1.321-1.51-3.157-2.656-5.627-3.14V4.37a.75.75 0 0 0-.463-.693ZM7.1 6.18v1.19c0 .372.275.689.644.742 2.452.35 4.163 1.39 5.354 2.751.528.603.96 1.277 1.31 1.994-1.754-1.239-3.917-1.813-6.558-1.813a.75.75 0 0 0-.75.75v1.264L3.661 9.62l3.44-3.44Z",clipRule:"evenodd"})));exports.default=a;
@@ -1,19 +1,19 @@
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/RedirectToNew.svg.js"),i=require("styled-components"),o=require("../../template-context-mapper/context/templateModalContext.js"),n=require("../../tooltips/Tooltip.js"),l=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),p=require("../helpers/VariableEditorHelper.js"),x=require("../models/TemplateMeta.js"),u=require("./ChatBtn.js"),h=require("./ChatUI.style.js"),m=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),c=require("./MediaCard.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var T=j(i);const f=T.default.div`
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"),o=require("styled-components"),n=require("../../template-context-mapper/context/templateModalContext.js"),l=require("../../tooltips/Tooltip.js"),d=require("../../TypographyStyle.js"),p=require("../../../constants/Theme.js"),x=require("../helpers/VariableEditorHelper.js"),u=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(o);const y=f.default.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,y=T.default.div`
7
+ `,C=f.default.div`
8
8
  font-family: 'Inter';
9
9
  font-style: normal;
10
10
  font-weight: 400;
11
11
  font-size: 14px;
12
12
  line-height: 20px;
13
13
  padding: 8px 12px 0px;
14
- color: ${d.COLORS.content.primary};
14
+ color: ${p.COLORS.content.primary};
15
15
  word-wrap: break-word;
16
- `,C=T.default(y)`
16
+ `,g=f.default(C)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,g=new p.VariableEditorHelper;exports.ChatUIV2=i=>{const{bodyText:d,footerText:p,headerMediaType:j,headerText:T,headerAssetLink:E,headerAssetName:b,quickReplybtn:q,ctaBtn:v,actionTypes:O,extras:S,showHeader:_,imagePreviewStyles:w,size:I,bodyVariableList:L,headerVariableList:P,buttons:A,limitedTimeOfferComponent:M,carouselCardIndex:N}=i,R=g.format(d,L),B=g.format(T,P),{isWhatsappCarousel:H,selectedCarouselIndex:Y}=o.useTemplateModalContext(),F={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:a.default,QUICK_REPLY:()=>e.jsx(e.Fragment,{})};return e.jsxs(h.Container,Object.assign({isCarouselCard:null!=N&&N>-1,showBorder:null!=N&&N===Y,isWhatsappCarousel:H},{children:[!H&&e.jsx(f,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),j===x.HEADER_TYPES.TEXT?e.jsx(C,{dangerouslySetInnerHTML:{__html:B}}):j!==x.HEADER_TYPES.NONE?e.jsx(c.MediaCard,{headerAssetLink:E,headerAssetName:b,mediaType:j,imagePreviewStyles:j===x.HEADER_TYPES.IMAGE?w:{}}):e.jsx(e.Fragment,{}),(null==M?void 0:M.dateTime)?e.jsx(m.LimitedTimeOffer,{text:M.text,dateTime:M.dateTime,code:M.code}):e.jsx(e.Fragment,{}),!!d&&e.jsx(e.Fragment,{children:e.jsx(y,{dangerouslySetInnerHTML:{__html:R}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(n.Tooltip,Object.assign({body:null!=p?p:"",placement:"top"},{children:e.jsx(h.TimeStamp,Object.assign({style:{flex:1}},{children:p}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),A&&A.length>0?A.map(((t,r)=>e.jsx(u.ChatBtn,{text:t.text,Icon:F[t.type],size:I},r))):O===x.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==q?void 0:q.map(((t,r)=>e.jsx(u.ChatBtn,{text:t.text},r)))}):O===x.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(u.ChatBtn,{textTypography:_?l.Caption:l.BodySecondary,extraContent:S?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:a.default,size:I},r)))}):e.jsx(e.Fragment,{})]}))};
19
+ `,E=new x.VariableEditorHelper;exports.ChatUIV2=o=>{const{bodyText:p,footerText:x,headerMediaType:T,headerText:f,headerAssetLink:b,headerAssetName:q,quickReplybtn:v,ctaBtn:O,actionTypes:S,extras:_,showHeader:w,imagePreviewStyles:I,size:L,bodyVariableList:P,headerVariableList:A,buttons:M,limitedTimeOfferComponent:N,carouselCardIndex:R}=o,B=E.format(p,P),H=E.format(f,A),{isWhatsappCarousel:Y,selectedCarouselIndex:U}=n.useTemplateModalContext(),F={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===U,isWhatsappCarousel:Y},{children:[!Y&&e.jsx(y,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===u.HEADER_TYPES.TEXT?e.jsx(g,{dangerouslySetInnerHTML:{__html:H}}):T!==u.HEADER_TYPES.NONE?e.jsx(j.MediaCard,{headerAssetLink:b,headerAssetName:q,mediaType:T,imagePreviewStyles:T===u.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(C,{dangerouslySetInnerHTML:{__html:B}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(l.Tooltip,Object.assign({body:null!=x?x:"",placement:"top"},{children:e.jsx(h.TimeStamp,Object.assign({style:{flex:1}},{children:x}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),M&&M.length>0?M.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text,Icon:F[t.type],size:L},r))):S===u.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text},r)))}):S===u.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(c.ChatBtn,{textTypography:w?d.Caption:d.BodySecondary,extraContent:_?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:i.default,size:L},r)))}):e.jsx(e.Fragment,{})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../template-context-mapper/context/templateModalContext.js"),a=require("./helpers/TemplateCreatorHelper.js"),i=require("./models/TemplateMeta.js"),o=require("./utils/TemplateHelperUtils.js"),r=require("./WhatsApp/WhatsAppLikePreview.js"),n=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=d=>{let{template:s,extras:p,containerStyle:u,usePlaceHolderName:v,showHeader:m,zeroStateComponent:h,size:x,showSampleValues:c,carouselCardIndex:b,isWhatsappCarousel:T}=d;var y,w,k,C,V,B,N,j,f,A,L,P,S,g,q,F,E,H,O,W,I,U;console.log("template preview 22: ",b,s);const{selectedCarouselIndex:D}=t.useTemplateModalContext(),[M,R]=l.useState(),z=new a.TemplateCreatorHelper,_=new o.TemplateHelperUtils,Y=[];return(null===(w=null===(y=null==M?void 0:M.ctaBtn)||void 0===y?void 0:y.phoneNumber)||void 0===w?void 0:w.isChecked)&&Y.push({type:"phoneNumber",text:null!==(k=M.ctaBtn.phoneNumber.btnText)&&void 0!==k?k:"",extra:null!==(C=M.ctaBtn.phoneNumber.phoneNumber)&&void 0!==C?C:""}),(null===(B=null===(V=null==M?void 0:M.ctaBtn)||void 0===V?void 0:V.websiteLinkBtn)||void 0===B?void 0:B.isChecked)&&Y.push({type:"website",text:null!==(N=M.ctaBtn.websiteLinkBtn.btnText)&&void 0!==N?N:"",extra:null!==(f=null===(j=M.ctaBtn.websiteLinkBtn)||void 0===j?void 0:j.linkOpens)&&void 0!==f?f:"",placeholder:null!==(A=M.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==A?A:""}),l.useEffect((()=>{s&&z.parseUITemplateFromDBFormat({dbFormattedTemplate:s,isDuplicate:!1,showSampleValues:c,isV2:!s.htmlContentUrl}).then((e=>{R(Object.assign({},e))}))}),[s,c]),l.useEffect((()=>{s&&z.parseUITemplateFromDBFormat({dbFormattedTemplate:s,isDuplicate:!1,showSampleValues:c,isV2:!s.htmlContentUrl}).then((e=>{R(Object.assign({},e))}))}),[D]),s?s.htmlContentUrl?e.jsx(r.WhatsappLikePreview,{showHeader:m,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:_.whatsappOnlyFillVariablesValueInBodyText(null!==(E=null==M?void 0:M.bodyText)&&void 0!==E?E:"",null!==(H=null==M?void 0:M.bodyVariables)&&void 0!==H?H:[],v),footerText:null==M?void 0:M.footerText,headerMediaType:(null==M?void 0:M.headerType)||i.HEADER_TYPES.NONE,headerText:_.fillVariablesValInBodyText(null!==(O=null==M?void 0:M.headerText)&&void 0!==O?O:"",null!==(W=null==M?void 0:M.headerVariables)&&void 0!==W?W:[],v),headerAssetLink:null!==(I=null==M?void 0:M.headerAssetLink)&&void 0!==I?I:"",headerAssetName:null!==(U=null==M?void 0:M.headerAssetName)&&void 0!==U?U:"",quickReplybtn:null==M?void 0:M.quickReply,ctaBtn:Y,actionTypes:null==M?void 0:M.actionsType,extras:p,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "})}):e.jsx(n.WhatsappLikePreviewV2,{showHeader:m,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:null==M?void 0:M.bodyText,footerText:null==M?void 0:M.footerText,headerMediaType:(null==M?void 0:M.headerType)||i.HEADER_TYPES.NONE,headerText:null==M?void 0:M.headerText,headerAssetLink:null!==(L=null==M?void 0:M.headerAssetLink)&&void 0!==L?L:"",headerAssetName:null!==(P=null==M?void 0:M.headerAssetName)&&void 0!==P?P:"",quickReplybtn:null==M?void 0:M.quickReply,ctaBtn:Y,actionTypes:null==M?void 0:M.actionsType,extras:p,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:b,zeroStateComponent:null!=h?h:e.jsx(e.Fragment,{children:" "}),bodyVariableList:null!==(g=null===(S=null==M?void 0:M.bodyVariables)||void 0===S?void 0:S.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==g?g:[],headerVariableList:null!==(F=null===(q=null==M?void 0:M.headerVariables)||void 0===q?void 0:q.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==F?F:[],buttons:null==M?void 0:M.allButtons,limitedTimeOfferComponent:null==M?void 0:M.limitedTimeOfferComponent,isWhatsappCarousel:T}):e.jsx(e.Fragment,{children:h})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../template-context-mapper/context/templateModalContext.js"),a=require("./helpers/TemplateCreatorHelper.js"),i=require("./models/TemplateMeta.js"),r=require("./utils/TemplateHelperUtils.js"),n=require("./WhatsApp/WhatsAppLikePreview.js"),o=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=d=>{let{template:s,extras:p,containerStyle:u,usePlaceHolderName:v,showHeader:h,zeroStateComponent:m,size:x,showSampleValues:c,carouselCardIndex:b,isWhatsappCarousel:T}=d;var y,w,k,C,V,B,N,j,f,A,L,P,S,q,F,g,E,H,O,W,I,U;const{selectedCarouselIndex:D}=t.useTemplateModalContext(),[M,R]=l.useState(),z=new a.TemplateCreatorHelper,_=new r.TemplateHelperUtils,Y=[];return(null===(w=null===(y=null==M?void 0:M.ctaBtn)||void 0===y?void 0:y.phoneNumber)||void 0===w?void 0:w.isChecked)&&Y.push({type:"phoneNumber",text:null!==(k=M.ctaBtn.phoneNumber.btnText)&&void 0!==k?k:"",extra:null!==(C=M.ctaBtn.phoneNumber.phoneNumber)&&void 0!==C?C:""}),(null===(B=null===(V=null==M?void 0:M.ctaBtn)||void 0===V?void 0:V.websiteLinkBtn)||void 0===B?void 0:B.isChecked)&&Y.push({type:"website",text:null!==(N=M.ctaBtn.websiteLinkBtn.btnText)&&void 0!==N?N:"",extra:null!==(f=null===(j=M.ctaBtn.websiteLinkBtn)||void 0===j?void 0:j.linkOpens)&&void 0!==f?f:"",placeholder:null!==(A=M.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==A?A:""}),l.useEffect((()=>{s&&z.parseUITemplateFromDBFormat({dbFormattedTemplate:s,isDuplicate:!1,showSampleValues:c,isV2:!s.htmlContentUrl}).then((e=>{R(Object.assign({},e))}))}),[s,c]),l.useEffect((()=>{s&&z.parseUITemplateFromDBFormat({dbFormattedTemplate:s,isDuplicate:!1,showSampleValues:c,isV2:!s.htmlContentUrl}).then((e=>{R(Object.assign({},e))}))}),[D]),s?s.htmlContentUrl?e.jsx(n.WhatsappLikePreview,{showHeader:h,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:_.whatsappOnlyFillVariablesValueInBodyText(null!==(E=null==M?void 0:M.bodyText)&&void 0!==E?E:"",null!==(H=null==M?void 0:M.bodyVariables)&&void 0!==H?H:[],v),footerText:null==M?void 0:M.footerText,headerMediaType:(null==M?void 0:M.headerType)||i.HEADER_TYPES.NONE,headerText:_.fillVariablesValInBodyText(null!==(O=null==M?void 0:M.headerText)&&void 0!==O?O:"",null!==(W=null==M?void 0:M.headerVariables)&&void 0!==W?W:[],v),headerAssetLink:null!==(I=null==M?void 0:M.headerAssetLink)&&void 0!==I?I:"",headerAssetName:null!==(U=null==M?void 0:M.headerAssetName)&&void 0!==U?U:"",quickReplybtn:null==M?void 0:M.quickReply,ctaBtn:Y,actionTypes:null==M?void 0:M.actionsType,extras:p,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=m?m:e.jsx(e.Fragment,{children:" "})}):e.jsx(o.WhatsappLikePreviewV2,{showHeader:h,containerPadding:"large"===x?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:u,textType:"html",bodyText:null==M?void 0:M.bodyText,footerText:null==M?void 0:M.footerText,headerMediaType:(null==M?void 0:M.headerType)||i.HEADER_TYPES.NONE,headerText:null==M?void 0:M.headerText,headerAssetLink:null!==(L=null==M?void 0:M.headerAssetLink)&&void 0!==L?L:"",headerAssetName:null!==(P=null==M?void 0:M.headerAssetName)&&void 0!==P?P:"",quickReplybtn:null==M?void 0:M.quickReply,ctaBtn:Y,actionTypes:null==M?void 0:M.actionsType,extras:p,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:b,zeroStateComponent:null!=m?m:e.jsx(e.Fragment,{children:" "}),bodyVariableList:null!==(q=null===(S=null==M?void 0:M.bodyVariables)||void 0===S?void 0:S.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==q?q:[],headerVariableList:null!==(g=null===(F=null==M?void 0:M.headerVariables)||void 0===F?void 0:F.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==g?g:[],buttons:null==M?void 0:M.allButtons,limitedTimeOfferComponent:null==M?void 0:M.limitedTimeOfferComponent,isWhatsappCarousel:T}):e.jsx(e.Fragment,{children:m})};
@@ -0,0 +1 @@
1
+ import*as e from"react";var a;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},t.apply(this,arguments)}var r=r=>e.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 19 19"},r),a||(a=e.createElement("path",{fill:"#1877F2",fillRule:"evenodd",d:"M8.137 3.676a.75.75 0 0 0-.817.163l-5.25 5.25a.75.75 0 0 0 0 1.06l5.25 5.25a.75.75 0 0 0 1.28-.53v-2.307c3.146.15 5.305 1.274 6.89 3.493a.75.75 0 0 0 1.346-.583c-.393-1.963-1.186-3.97-2.609-5.597-1.321-1.51-3.157-2.656-5.627-3.14V4.37a.75.75 0 0 0-.463-.693ZM7.1 6.18v1.19c0 .372.275.689.644.742 2.452.35 4.163 1.39 5.354 2.751.528.603.96 1.277 1.31 1.994-1.754-1.239-3.917-1.813-6.558-1.813a.75.75 0 0 0-.75.75v1.264L3.661 9.62l3.44-3.44Z",clipRule:"evenodd"})));export{r as default};
@@ -1,19 +1,19 @@
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 a from"../../../assets/icons/RedirectToNew.svg.js";import n from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as l}from"../../tooltips/Tooltip.js";import{Caption as p,BodySecondary as d}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as c}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as f,ACTIONS_TYPES as x}from"../models/TemplateMeta.js";import{ChatBtn as y}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,TimeStamp as u}from"./ChatUI.style.js";import{LimitedTimeOffer as j}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as C}from"./MediaCard.js";const b=n.div`
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 a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import m from"styled-components";import{useTemplateModalContext as l}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as h}from"../../TypographyStyle.js";import{COLORS as c}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as g,FooterWrapper as j,TimeStamp as u}from"./ChatUI.style.js";import{LimitedTimeOffer as C}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as b}from"./MediaCard.js";const v=m.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,v=n.div`
7
+ `,w=m.div`
8
8
  font-family: 'Inter';
9
9
  font-style: normal;
10
10
  font-weight: 400;
11
11
  font-size: 14px;
12
12
  line-height: 20px;
13
13
  padding: 8px 12px 0px;
14
- color: ${h.content.primary};
14
+ color: ${c.content.primary};
15
15
  word-wrap: break-word;
16
- `,w=n(v)`
16
+ `,I=m(w)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,I=new c,L=n=>{const{bodyText:h,footerText:c,headerMediaType:L,headerText:O,headerAssetLink:E,headerAssetName:N,quickReplybtn:_,ctaBtn:M,actionTypes:R,extras:A,showHeader:P,imagePreviewStyles:B,size:H,bodyVariableList:S,headerVariableList:U,buttons:k,limitedTimeOfferComponent:z,carouselCardIndex:V}=n,Y=I.format(h,S),K=I.format(O,U),{isWhatsappCarousel:Q,selectedCarouselIndex:W}=m(),q={COPY_CODE:r,PHONE_NUMBER:s,URL:a,QUICK_REPLY:()=>t(o,{})};return e(T,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===W,isWhatsappCarousel:Q},{children:[!Q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),L===f.TEXT?t(w,{dangerouslySetInnerHTML:{__html:K}}):L!==f.NONE?t(C,{headerAssetLink:E,headerAssetName:N,mediaType:L,imagePreviewStyles:L===f.IMAGE?B:{}}):t(o,{}),(null==z?void 0:z.dateTime)?t(j,{text:z.text,dateTime:z.dateTime,code:z.code}):t(o,{}),!!h&&t(o,{children:t(v,{dangerouslySetInnerHTML:{__html:Y}})}),e(g,{children:[t(l,Object.assign({body:null!=c?c:"",placement:"top"},{children:t(u,Object.assign({style:{flex:1}},{children:c}))})),t(u,{children:"16:48"})]}),k&&k.length>0?k.map(((e,o)=>t(y,{text:e.text,Icon:q[e.type],size:H},o))):R===x.QUICK_REPLY?t("div",{children:null==_?void 0:_.map(((e,o)=>t(y,{text:e.text},o)))}):R===x.CTA_BTN?t("div",{children:null==M?void 0:M.map(((e,o)=>t(y,{textTypography:P?p:d,extraContent:A?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:a,size:H},o)))}):t(o,{})]}))};export{L as ChatUIV2};
19
+ `,L=new f,O=m=>{const{bodyText:c,footerText:f,headerMediaType:O,headerText:E,headerAssetLink:N,headerAssetName:_,quickReplybtn:M,ctaBtn:R,actionTypes:A,extras:P,showHeader:B,imagePreviewStyles:H,size:S,bodyVariableList:U,headerVariableList:k,buttons:z,limitedTimeOfferComponent:V,carouselCardIndex:Y}=m,q=L.format(c,U),K=L.format(E,k),{isWhatsappCarousel:Q,selectedCarouselIndex:W}=l(),D={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(g,Object.assign({isCarouselCard:null!=Y&&Y>-1,showBorder:null!=Y&&Y===W,isWhatsappCarousel:Q},{children:[!Q&&t(v,{children:t(i,{color:"white",height:8,width:8})}),O===x.TEXT?t(I,{dangerouslySetInnerHTML:{__html:K}}):O!==x.NONE?t(b,{headerAssetLink:N,headerAssetName:_,mediaType:O,imagePreviewStyles:O===x.IMAGE?H:{}}):t(o,{}),(null==V?void 0:V.dateTime)?t(C,{text:V.text,dateTime:V.dateTime,code:V.code}):t(o,{}),!!c&&t(o,{children:t(w,{dangerouslySetInnerHTML:{__html:q}})}),e(j,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(u,Object.assign({style:{flex:1}},{children:f}))})),t(u,{children:"16:48"})]}),z&&z.length>0?z.map(((e,o)=>t(T,{text:e.text,Icon:D[e.type],size:S},o))):A===y.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(T,{text:e.text},o)))}):A===y.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(T,{textTypography:B?d:h,extraContent:P?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:S},o)))}):t(o,{})]}))};export{O as ChatUIV2};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as l}from"react/jsx-runtime";import{useState as t,useEffect as a}from"react";import{useTemplateModalContext as o}from"../template-context-mapper/context/templateModalContext.js";import{TemplateCreatorHelper as i}from"./helpers/TemplateCreatorHelper.js";import{HEADER_TYPES as n}from"./models/TemplateMeta.js";import{TemplateHelperUtils as r}from"./utils/TemplateHelperUtils.js";import{WhatsappLikePreview as d}from"./WhatsApp/WhatsAppLikePreview.js";import{WhatsappLikePreviewV2 as p}from"./WhatsApp/WhatsAppLikePreviewV2.js";const s=s=>{let{template:u,extras:v,containerStyle:m,usePlaceHolderName:h,showHeader:x,zeroStateComponent:c,size:b,showSampleValues:T,carouselCardIndex:y,isWhatsappCarousel:w}=s;var f,B,N,V,k,C,A,L,j,S,g,F,P,O,I,H,U,W,q,z,D,M;console.log("template preview 22: ",y,u);const{selectedCarouselIndex:R}=o(),[E,G]=t(),J=new i,K=new r,Q=[];return(null===(B=null===(f=null==E?void 0:E.ctaBtn)||void 0===f?void 0:f.phoneNumber)||void 0===B?void 0:B.isChecked)&&Q.push({type:"phoneNumber",text:null!==(N=E.ctaBtn.phoneNumber.btnText)&&void 0!==N?N:"",extra:null!==(V=E.ctaBtn.phoneNumber.phoneNumber)&&void 0!==V?V:""}),(null===(C=null===(k=null==E?void 0:E.ctaBtn)||void 0===k?void 0:k.websiteLinkBtn)||void 0===C?void 0:C.isChecked)&&Q.push({type:"website",text:null!==(A=E.ctaBtn.websiteLinkBtn.btnText)&&void 0!==A?A:"",extra:null!==(j=null===(L=E.ctaBtn.websiteLinkBtn)||void 0===L?void 0:L.linkOpens)&&void 0!==j?j:"",placeholder:null!==(S=E.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==S?S:""}),a((()=>{u&&J.parseUITemplateFromDBFormat({dbFormattedTemplate:u,isDuplicate:!1,showSampleValues:T,isV2:!u.htmlContentUrl}).then((e=>{G(Object.assign({},e))}))}),[u,T]),a((()=>{u&&J.parseUITemplateFromDBFormat({dbFormattedTemplate:u,isDuplicate:!1,showSampleValues:T,isV2:!u.htmlContentUrl}).then((e=>{G(Object.assign({},e))}))}),[R]),u?u.htmlContentUrl?e(d,{showHeader:x,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:m,textType:"html",bodyText:K.whatsappOnlyFillVariablesValueInBodyText(null!==(U=null==E?void 0:E.bodyText)&&void 0!==U?U:"",null!==(W=null==E?void 0:E.bodyVariables)&&void 0!==W?W:[],h),footerText:null==E?void 0:E.footerText,headerMediaType:(null==E?void 0:E.headerType)||n.NONE,headerText:K.fillVariablesValInBodyText(null!==(q=null==E?void 0:E.headerText)&&void 0!==q?q:"",null!==(z=null==E?void 0:E.headerVariables)&&void 0!==z?z:[],h),headerAssetLink:null!==(D=null==E?void 0:E.headerAssetLink)&&void 0!==D?D:"",headerAssetName:null!==(M=null==E?void 0:E.headerAssetName)&&void 0!==M?M:"",quickReplybtn:null==E?void 0:E.quickReply,ctaBtn:Q,actionTypes:null==E?void 0:E.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=c?c:e(l,{children:" "})}):e(p,{showHeader:x,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:m,textType:"html",bodyText:null==E?void 0:E.bodyText,footerText:null==E?void 0:E.footerText,headerMediaType:(null==E?void 0:E.headerType)||n.NONE,headerText:null==E?void 0:E.headerText,headerAssetLink:null!==(g=null==E?void 0:E.headerAssetLink)&&void 0!==g?g:"",headerAssetName:null!==(F=null==E?void 0:E.headerAssetName)&&void 0!==F?F:"",quickReplybtn:null==E?void 0:E.quickReply,ctaBtn:Q,actionTypes:null==E?void 0:E.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:y,zeroStateComponent:null!=c?c:e(l,{children:" "}),bodyVariableList:null!==(O=null===(P=null==E?void 0:E.bodyVariables)||void 0===P?void 0:P.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==O?O:[],headerVariableList:null!==(H=null===(I=null==E?void 0:E.headerVariables)||void 0===I?void 0:I.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==H?H:[],buttons:null==E?void 0:E.allButtons,limitedTimeOfferComponent:null==E?void 0:E.limitedTimeOfferComponent,isWhatsappCarousel:w}):e(l,{children:c})};export{s as default};
1
+ import{jsx as e,Fragment as l}from"react/jsx-runtime";import{useState as t,useEffect as a}from"react";import{useTemplateModalContext as o}from"../template-context-mapper/context/templateModalContext.js";import{TemplateCreatorHelper as i}from"./helpers/TemplateCreatorHelper.js";import{HEADER_TYPES as n}from"./models/TemplateMeta.js";import{TemplateHelperUtils as r}from"./utils/TemplateHelperUtils.js";import{WhatsappLikePreview as d}from"./WhatsApp/WhatsAppLikePreview.js";import{WhatsappLikePreviewV2 as p}from"./WhatsApp/WhatsAppLikePreviewV2.js";const s=s=>{let{template:u,extras:v,containerStyle:m,usePlaceHolderName:h,showHeader:x,zeroStateComponent:c,size:b,showSampleValues:T,carouselCardIndex:y,isWhatsappCarousel:w}=s;var f,B,N,V,k,C,A,L,j,S,F,P,g,O,I,H,U,W,q,z,D,M;const{selectedCarouselIndex:R}=o(),[E,G]=t(),J=new i,K=new r,Q=[];return(null===(B=null===(f=null==E?void 0:E.ctaBtn)||void 0===f?void 0:f.phoneNumber)||void 0===B?void 0:B.isChecked)&&Q.push({type:"phoneNumber",text:null!==(N=E.ctaBtn.phoneNumber.btnText)&&void 0!==N?N:"",extra:null!==(V=E.ctaBtn.phoneNumber.phoneNumber)&&void 0!==V?V:""}),(null===(C=null===(k=null==E?void 0:E.ctaBtn)||void 0===k?void 0:k.websiteLinkBtn)||void 0===C?void 0:C.isChecked)&&Q.push({type:"website",text:null!==(A=E.ctaBtn.websiteLinkBtn.btnText)&&void 0!==A?A:"",extra:null!==(j=null===(L=E.ctaBtn.websiteLinkBtn)||void 0===L?void 0:L.linkOpens)&&void 0!==j?j:"",placeholder:null!==(S=E.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==S?S:""}),a((()=>{u&&J.parseUITemplateFromDBFormat({dbFormattedTemplate:u,isDuplicate:!1,showSampleValues:T,isV2:!u.htmlContentUrl}).then((e=>{G(Object.assign({},e))}))}),[u,T]),a((()=>{u&&J.parseUITemplateFromDBFormat({dbFormattedTemplate:u,isDuplicate:!1,showSampleValues:T,isV2:!u.htmlContentUrl}).then((e=>{G(Object.assign({},e))}))}),[R]),u?u.htmlContentUrl?e(d,{showHeader:x,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:m,textType:"html",bodyText:K.whatsappOnlyFillVariablesValueInBodyText(null!==(U=null==E?void 0:E.bodyText)&&void 0!==U?U:"",null!==(W=null==E?void 0:E.bodyVariables)&&void 0!==W?W:[],h),footerText:null==E?void 0:E.footerText,headerMediaType:(null==E?void 0:E.headerType)||n.NONE,headerText:K.fillVariablesValInBodyText(null!==(q=null==E?void 0:E.headerText)&&void 0!==q?q:"",null!==(z=null==E?void 0:E.headerVariables)&&void 0!==z?z:[],h),headerAssetLink:null!==(D=null==E?void 0:E.headerAssetLink)&&void 0!==D?D:"",headerAssetName:null!==(M=null==E?void 0:E.headerAssetName)&&void 0!==M?M:"",quickReplybtn:null==E?void 0:E.quickReply,ctaBtn:Q,actionTypes:null==E?void 0:E.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=c?c:e(l,{children:" "})}):e(p,{showHeader:x,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:m,textType:"html",bodyText:null==E?void 0:E.bodyText,footerText:null==E?void 0:E.footerText,headerMediaType:(null==E?void 0:E.headerType)||n.NONE,headerText:null==E?void 0:E.headerText,headerAssetLink:null!==(F=null==E?void 0:E.headerAssetLink)&&void 0!==F?F:"",headerAssetName:null!==(P=null==E?void 0:E.headerAssetName)&&void 0!==P?P:"",quickReplybtn:null==E?void 0:E.quickReply,ctaBtn:Q,actionTypes:null==E?void 0:E.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:y,zeroStateComponent:null!=c?c:e(l,{children:" "}),bodyVariableList:null!==(O=null===(g=null==E?void 0:E.bodyVariables)||void 0===g?void 0:g.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==O?O:[],headerVariableList:null!==(H=null===(I=null==E?void 0:E.headerVariables)||void 0===I?void 0:I.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==H?H:[],buttons:null==E?void 0:E.allButtons,limitedTimeOfferComponent:null==E?void 0:E.limitedTimeOfferComponent,isWhatsappCarousel:w}):e(l,{children:c})};export{s as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.419-beta.19",
3
+ "version": "0.0.419-beta.20",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",