@bikdotai/bik-component-library 0.0.639--beta--0.2 → 0.0.639--prev--beta0.22

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/models/Channels.js"),s=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateAnalyticsComponent.js"),c=require("./modalElements/TemplateSelectModalContent.js"),p=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=v=>{var m,C,h,b,S,E,f,x,P,T;const{selectedTemplate:g,closeDialog:y,showVariableMapping:I,channel:L,htmlContent:A,templateVariables:D,onTemplateSelect:j,globalPlaceholders:w,showOnlyContent:k,whatsappSpecificPickerMeta:H,zIndex:N,showVariableModal:V,variableList:M,discountCode:O,setDiscountCode:B,onBackPress:q,enabledCustomText:F,variableListForImage:_,showSampleValues:W,disableEditVariable:Y,pod:R,extras:$,pickerConf:z,selectedCarouselProducts:U,disableEditExpiry:G,cardWidth:J,onDeleteSelectedProducts:K,fileName:Q,setFileName:X,hideDeviceContainerInPreview:Z,maxCharLimit:ee,onDefaultVariableSelect:te,skipDefaultVariableContent:le,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re,footerButtonText:se,footerInfoText:ne,templateAnalytics:de}=v;l.useEffect((()=>{be(A)}),[A]);const ue=L===r.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(C=null===(m=null==g?void 0:g.components)||void 0===m?void 0:m[1])||void 0===C?void 0:C.type),ce=null==g?void 0:g.isProductCarouselType,[pe,ve]=l.useState(L===r.CHANNEL_TYPE.EMAIL||L==r.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(A),[Se,Ee]=l.useState(!1),[fe,xe]=l.useState([]),[Pe,Te]=l.useState({}),[ge,ye]=l.useState(g),[Ie,Le]=l.useState([]),[Ae,De]=l.useState(null),[je,we]=l.useState(!1),[ke,He]=l.useState(null!=D?D:[]),[Ne,Ve]=l.useState(!1),[Me,Oe]=l.useState(ue?(null===(b=null===(h=null==ge?void 0:ge.mapping)||void 0===h?void 0:h.body)||void 0===b?void 0:b.length)?-1:0:-1),[Be,qe]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,ze]=l.useState(!1),[Ue,Ge]=l.useState(!1),[Je,Ke]=l.useState(!0),[Qe,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{U?qe(U):ce&&qe([])}),[U]),l.useEffect((()=>{var e;if(!je&&ce&&(!U||0===qe.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),Le(l),we(!0)}}),[je]);const tt=l.useMemo((()=>p.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(M))}),[M]),(null==de?void 0:de.show)&&Je?e.jsx(u.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(S=null==ge?void 0:ge.category)&&void 0!==S?S:"")} • ${null!==(E=null==ge?void 0:ge.templateCategory)&&void 0!==E?E:""}`:"",templateAnalytics:de,onClose:()=>{null==y||y(),Ke(!1),Xe(!1)},onCancel:()=>{Ke(!1),Xe(!1)},onProceed:()=>{Ke(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Ue,setHideFooterButton:Ge,hideCrossButton:$e,setHideCrossButton:ze,variableList:Fe,setVariableList:_e,variableCallback:Ae,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:He,isError:Se,setIsError:Ee,channel:L,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ne,setTemplateSelectionTriggered:Ve,enabledCustomText:F,disableEditVariable:Y,pod:R,extras:$,isWhatsappCarousel:ue,selectedCarouselIndex:Me,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Pe,cardCount:ue?null===(x=null===(f=g.components)||void 0===f?void 0:f[1].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:fe,setErrorIndexes:xe,pickerConf:z,carouselProducts:Be,setCarouselProducts:qe,disableEditExpiry:G,cardWidth:J,cardImages:Ie,onDeleteSelectedProducts:K,hideDeviceContainerInPreview:Z,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:ee,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:te,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re}},{children:k?e.jsx(c.default,{variableListFromProps:M,channel:r.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:N,centralContainerStyles:{width:ue?900:L===r.CHANNEL_TYPE.EMAIL&&I?1e3:800},open:Qe,onClose:()=>{Xe(!1),null==y||y()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(P=null==ge?void 0:ge.category)&&void 0!==P?P:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==de?void 0:de.show)return Ke(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(c.default,{variableListFromProps:M,showSampleValues:W,showVariableMapping:I,channel:L,whatsappSpecificPickerMeta:H,showVariableModal:V,discountCode:O,setDiscountCode:B,variableListForImage:_&&(null==_?void 0:_.length)>0?_:Fe,fileName:Q,setFileName:e=>{null==X||X(e)},skipDefaultVariableContent:le}),j?e.jsx(d.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==Be?void 0:Be.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&R!==s.POD.CHATBOT)return void Ee(!0);const t=null==j?void 0:j(ge,ke,null!=he?he:"",Be);Te(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&xe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):Ve(!0)},footerButtonText:se,footerInfoText:ne}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/models/Channels.js"),s=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateAnalyticsComponent.js"),c=require("./modalElements/TemplateSelectModalContent.js"),p=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=v=>{var m,C,h,b,S,E,f,x,P,T;const{selectedTemplate:g,closeDialog:y,showVariableMapping:I,channel:L,htmlContent:A,templateVariables:D,onTemplateSelect:j,globalPlaceholders:w,showOnlyContent:k,whatsappSpecificPickerMeta:H,zIndex:N,showVariableModal:V,variableList:M,discountCode:O,setDiscountCode:B,onBackPress:q,enabledCustomText:F,variableListForImage:_,showSampleValues:W,disableEditVariable:Y,pod:R,extras:$,pickerConf:U,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:G,onDeleteSelectedProducts:J,fileName:K,setFileName:X,hideDeviceContainerInPreview:Z,maxCharLimit:ee,onDefaultVariableSelect:te,skipDefaultVariableContent:le,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re,footerButtonText:se,footerInfoText:ne,templateAnalytics:de}=v;l.useEffect((()=>{be(A)}),[A]);const ue=L===r.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(C=null===(m=null==g?void 0:g.components)||void 0===m?void 0:m[1])||void 0===C?void 0:C.type),ce=null==g?void 0:g.isProductCarouselType,[pe,ve]=l.useState(L===r.CHANNEL_TYPE.EMAIL||L==r.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(A),[Se,Ee]=l.useState(!1),[fe,xe]=l.useState([]),[Pe,Te]=l.useState({}),[ge,ye]=l.useState(g),[Ie,Le]=l.useState([]),[Ae,De]=l.useState(null),[je,we]=l.useState(!1),[ke,He]=l.useState(null!=D?D:[]),[Ne,Ve]=l.useState(!1),[Me,Oe]=l.useState(ue?(null===(b=null===(h=null==ge?void 0:ge.mapping)||void 0===h?void 0:h.body)||void 0===b?void 0:b.length)?-1:0:-1),[Be,qe]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,Ue]=l.useState(!1),[ze,Qe]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?qe(z):ce&&qe([])}),[z]),l.useEffect((()=>{var e;if(!je&&ce&&(!z||0===qe.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),Le(l),we(!0)}}),[je]);const tt=l.useMemo((()=>p.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(M))}),[M]),(null==de?void 0:de.show)&&Ge&&de.templateQuality&&Object.values(s.TEMPLATE_QUALITY).find((e=>e===String(de.templateQuality)))?e.jsx(u.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(S=null==ge?void 0:ge.category)&&void 0!==S?S:"")} • ${null!==(E=null==ge?void 0:ge.templateCategory)&&void 0!==E?E:""}`:"",templateAnalytics:de,onClose:()=>{null==y||y(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:ze,setHideFooterButton:Qe,hideCrossButton:$e,setHideCrossButton:Ue,variableList:Fe,setVariableList:_e,variableCallback:Ae,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:He,isError:Se,setIsError:Ee,channel:L,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ne,setTemplateSelectionTriggered:Ve,enabledCustomText:F,disableEditVariable:Y,pod:R,extras:$,isWhatsappCarousel:ue,selectedCarouselIndex:Me,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Pe,cardCount:ue?null===(x=null===(f=g.components)||void 0===f?void 0:f[1].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:fe,setErrorIndexes:xe,pickerConf:U,carouselProducts:Be,setCarouselProducts:qe,disableEditExpiry:Q,cardWidth:G,cardImages:Ie,onDeleteSelectedProducts:J,hideDeviceContainerInPreview:Z,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:ee,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:te,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re}},{children:k?e.jsx(c.default,{variableListFromProps:M,channel:r.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:N,centralContainerStyles:{width:ue?900:L===r.CHANNEL_TYPE.EMAIL&&I?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==y||y()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(P=null==ge?void 0:ge.category)&&void 0!==P?P:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==de?void 0:de.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(c.default,{variableListFromProps:M,showSampleValues:W,showVariableMapping:I,channel:L,whatsappSpecificPickerMeta:H,showVariableModal:V,discountCode:O,setDiscountCode:B,variableListForImage:_&&(null==_?void 0:_.length)>0?_:Fe,fileName:K,setFileName:e=>{null==X||X(e)},skipDefaultVariableContent:le}),j?e.jsx(d.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==Be?void 0:Be.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&R!==s.POD.CHATBOT)return void Ee(!0);const t=null==j?void 0:j(ge,ke,null!=he?he:"",Be);Te(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&xe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):Ve(!0)},footerButtonText:se,footerInfoText:ne}):e.jsx(e.Fragment,{})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../shimmer/ShimmerComponent/BikShimmer.js"),i=require("../styles/TemplateAnalyticsStyles.js");const t=()=>e.jsxs("div",Object.assign({className:"each--analytics--container"},{children:[e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e.jsx(s.BikShimmer,{boxes:[{width:"24px",height:"24px"}]}),e.jsx(s.BikShimmer,{boxes:[{width:"69px",height:"11px"}]})]})),e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e.jsx(s.BikShimmer,{boxes:[{width:"43px",height:"18px"}]}),e.jsx(s.BikShimmer,{boxes:[{width:"69px",height:"28px"}]})]}))]}));exports.TemplateAnalyticsSkeleton=r=>{const{skipTitleShimmer:x}=r;return e.jsxs(i.RightPanelContainer,{children:[e.jsx("div",{children:x?e.jsx(e.Fragment,{}):e.jsx(s.BikShimmer,{boxes:[{width:"76px",height:"18px"}]})}),e.jsxs("div",Object.assign({className:"mt-3"},{children:[...Array(3).fill(0).map((s=>e.jsx(t,{},s)))]})),e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx(s.BikShimmer,{boxes:[{width:"76px",height:"18px"}]})}),e.jsx("div",Object.assign({className:"mt-3"},{children:e.jsx(t,{})}))]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../shimmer/ShimmerComponent/BikShimmer.js"),i=require("../styles/TemplateAnalyticsStyles.js");const t=()=>e.jsxs("div",Object.assign({className:"each--analytics--container"},{children:[e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e.jsx(s.BikShimmer,{boxes:[{width:"24px",height:"24px"}]}),e.jsx(s.BikShimmer,{boxes:[{width:"69px",height:"11px"}]})]})),e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e.jsx(s.BikShimmer,{boxes:[{width:"43px",height:"18px"}]}),e.jsx(s.BikShimmer,{boxes:[{width:"69px",height:"28px"}]})]}))]}));exports.TemplateAnalyticsSkeleton=r=>{const{skipTitleShimmer:x}=r;return e.jsxs(i.RightPanelContainer,{children:[e.jsx("div",{children:x?e.jsx(e.Fragment,{}):e.jsx(s.BikShimmer,{boxes:[{width:"76px",height:"18px"}]})}),e.jsx("div",Object.assign({className:"mt-3"},{children:[0,1,2].map((s=>e.jsx(t,{},s)))})),e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx(s.BikShimmer,{boxes:[{width:"76px",height:"18px"}]})}),e.jsx("div",Object.assign({className:"mt-3"},{children:e.jsx(t,{})}))]})]})};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o,Fragment as l}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as i,useState as r,useRef as a,useMemo as n}from"react";import s from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{CHANNEL_TYPE as c}from"../template-preview/models/Channels.js";import{POD as p}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as m}from"./context/templateModalContext.js";import v from"./modalElements/Footer.js";import{TemplateAnalyticsComponent as h}from"./modalElements/TemplateAnalyticsComponent.js";import C from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as b}from"./utils/convertPlaceholdersToBikDropdown.js";const f=f=>{var g,x,P,y,E,T,I,S,w,D;const{selectedTemplate:V,closeDialog:k,showVariableMapping:L,channel:A,htmlContent:j,templateVariables:B,onTemplateSelect:H,globalPlaceholders:M,showOnlyContent:F,whatsappSpecificPickerMeta:O,zIndex:W,showVariableModal:N,variableList:$,discountCode:z,setDiscountCode:R,onBackPress:U,enabledCustomText:_,variableListForImage:q,showSampleValues:G,disableEditVariable:J,pod:K,extras:Q,pickerConf:X,selectedCarouselProducts:Y,disableEditExpiry:Z,cardWidth:ee,onDeleteSelectedProducts:oe,fileName:le,setFileName:te,hideDeviceContainerInPreview:ie,maxCharLimit:re,onDefaultVariableSelect:ae,skipDefaultVariableContent:ne,disableDatePicker:se,disableCopyCode:de,initialExpiryDateTime:ue,showDiscountCodeExpiryInfo:ce,footerButtonText:pe,footerInfoText:me,templateAnalytics:ve}=f;i((()=>{ye(j)}),[j]);const he=A===c.WHATSAPP&&"CAROUSEL"===(null===(x=null===(g=null==V?void 0:V.components)||void 0===g?void 0:g[1])||void 0===x?void 0:x.type),Ce=null==V?void 0:V.isProductCarouselType,[be,fe]=r(A===c.EMAIL||A==c.WEBPUSH||he?"desktop":"mobile"),[ge,xe]=r(!1),[Pe,ye]=r(j),[Ee,Te]=r(!1),[Ie,Se]=r([]),[we,De]=r({}),[Ve,ke]=r(V),[Le,Ae]=r([]),[je,Be]=r(null),[He,Me]=r(!1),[Fe,Oe]=r(null!=B?B:[]),[We,Ne]=r(!1),[$e,ze]=r(he?(null===(y=null===(P=null==Ve?void 0:Ve.mapping)||void 0===P?void 0:P.body)||void 0===y?void 0:y.length)?-1:0:-1),[Re,Ue]=r([]),[_e,qe]=r(void 0),Ge=a(null),[Je,Ke]=r(!1),[Qe,Xe]=r(!1),[Ye,Ze]=r(!1),[eo,oo]=r(!0),[lo,to]=r(!0),[io,ro]=r({});i((()=>{Y?Ue(Y):Ce&&Ue([])}),[Y]),i((()=>{var e;if(!He&&Ce&&(!Y||0===Ue.length)){const o=null===(e=null==Ve?void 0:Ve.components)||void 0===e?void 0:e[1].cards,l=[];null==o||o.forEach((e=>{var o;null===(o=null==e?void 0:e.components)||void 0===o||o.forEach((e=>{var o,t,i;"HEADER"===e.type&&l.push(null!==(i=null===(t=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===t?void 0:t[0])&&void 0!==i?i:"")}))})),Ae(l),Me(!0)}}),[He]);const ao=n((()=>b(M)),[M]);return i((()=>{qe(t($))}),[$]),(null==ve?void 0:ve.show)&&eo?e(h,{headingTitle:null==Ve?void 0:Ve.label,headingSubtitle:A===c.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(E=null==Ve?void 0:Ve.category)&&void 0!==E?E:"")} • ${null!==(T=null==Ve?void 0:Ve.templateCategory)&&void 0!==T?T:""}`:"",templateAnalytics:ve,onClose:()=>{null==k||k(),oo(!1),to(!1)},onCancel:()=>{oo(!1),to(!1)},onProceed:()=>{oo(!1),to(!0)},templateId:(null==Ve?void 0:Ve.templateId)||""}):e(m.Provider,Object.assign({value:{hideFooterButton:Ye,setHideFooterButton:Ze,hideCrossButton:Qe,setHideCrossButton:Xe,variableList:_e,setVariableList:qe,variableCallback:je,setVariableCallback:Be,showVariablePicker:ge,setShowVariablePicker:xe,template:Ve,setTemplate:ke,device:be,setDevice:fe,display_content:Pe,setDisplayContent:ye,originalVariableList:Fe,setOriginalVariableList:Oe,isError:Ee,setIsError:Te,channel:A,globalNormalizedPlaceholders:ao,templateSelectionTriggered:We,setTemplateSelectionTriggered:Ne,enabledCustomText:_,disableEditVariable:J,pod:K,extras:Q,isWhatsappCarousel:he,selectedCarouselIndex:$e,setSelectedCarouselIndex:ze,isProductCarouselType:Ce,templateErrorIndexes:we,cardCount:he?null===(S=null===(I=V.components)||void 0===I?void 0:I[1].cards)||void 0===S?void 0:S.length:void 0,errorIndexes:Ie,setErrorIndexes:Se,pickerConf:X,carouselProducts:Re,setCarouselProducts:Ue,disableEditExpiry:Z,cardWidth:ee,cardImages:Le,onDeleteSelectedProducts:oe,hideDeviceContainerInPreview:ie,sliderRef:Ge,isCarouselHovered:Je,setIsCarouselHovered:Ke,maxCharLimit:re,ctaOptionsErrors:io,setCtaOptionsErrors:ro,onDefaultVariableSelect:ae,disableDatePicker:se,disableCopyCode:de,initialExpiryDateTime:ue,showDiscountCodeExpiryInfo:ce}},{children:F?e(C,{variableListFromProps:$,channel:c.EMAIL,hideHeader:!0}):o(u,Object.assign({hideCrossButton:Qe,zIndex:W,centralContainerStyles:{width:he?900:A===c.EMAIL&&L?1e3:800},open:lo,onClose:()=>{to(!1),null==k||k()},headingTitle:null==Ve?void 0:Ve.label,headingSubtitle:A===c.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(w=null==Ve?void 0:Ve.category)&&void 0!==w?w:"")} • ${null!==(D=null==Ve?void 0:Ve.templateCategory)&&void 0!==D?D:""}`:"",onBackPress:()=>{if(null==ve?void 0:ve.show)return oo(!0),void to(!1);null==U||U()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(C,{variableListFromProps:$,showSampleValues:G,showVariableMapping:L,channel:A,whatsappSpecificPickerMeta:O,showVariableModal:N,discountCode:z,setDiscountCode:R,variableListForImage:q&&(null==q?void 0:q.length)>0?q:_e,fileName:le,setFileName:e=>{null==te||te(e)},skipDefaultVariableContent:ne}),H?e(v,{isWhatsappCarousel:null!=he&&he,onSelect:function(){var e;if((null==Re?void 0:Re.length)<1&&Ce)return void Te(!0);if(Object.keys(io).length>0&&K!==p.CHATBOT)return void Te(!0);const o=null==H?void 0:H(Ve,Fe,null!=Pe?Pe:"",Re);De(null!==(e=null==o?void 0:o.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==o?void 0:o.errorIndexes)||(null==o?void 0:o.error)?((null==o?void 0:o.errorIndexes)&&Se(o.errorIndexes),(null==o?void 0:o.error)&&Te(!!(null==o?void 0:o.error))):Ne(!0)},footerButtonText:pe,footerInfoText:me}):e(l,{})]}))}))};export{f as TemplateContextMapper};
1
+ import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as i,useState as r,useRef as a,useMemo as n}from"react";import s from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{CHANNEL_TYPE as c}from"../template-preview/models/Channels.js";import{TEMPLATE_QUALITY as p,POD as m}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as v}from"./context/templateModalContext.js";import h from"./modalElements/Footer.js";import{TemplateAnalyticsComponent as C}from"./modalElements/TemplateAnalyticsComponent.js";import b from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as f}from"./utils/convertPlaceholdersToBikDropdown.js";const g=g=>{var x,y,P,E,S,T,I,w,D,V;const{selectedTemplate:k,closeDialog:L,showVariableMapping:A,channel:j,htmlContent:B,templateVariables:H,onTemplateSelect:M,globalPlaceholders:O,showOnlyContent:F,whatsappSpecificPickerMeta:W,zIndex:N,showVariableModal:$,variableList:z,discountCode:R,setDiscountCode:U,onBackPress:Q,enabledCustomText:_,variableListForImage:q,showSampleValues:G,disableEditVariable:J,pod:K,extras:X,pickerConf:Y,selectedCarouselProducts:Z,disableEditExpiry:ee,cardWidth:le,onDeleteSelectedProducts:oe,fileName:te,setFileName:ie,hideDeviceContainerInPreview:re,maxCharLimit:ae,onDefaultVariableSelect:ne,skipDefaultVariableContent:se,disableDatePicker:de,disableCopyCode:ue,initialExpiryDateTime:ce,showDiscountCodeExpiryInfo:pe,footerButtonText:me,footerInfoText:ve,templateAnalytics:he}=g;i((()=>{Ee(B)}),[B]);const Ce=j===c.WHATSAPP&&"CAROUSEL"===(null===(y=null===(x=null==k?void 0:k.components)||void 0===x?void 0:x[1])||void 0===y?void 0:y.type),be=null==k?void 0:k.isProductCarouselType,[fe,ge]=r(j===c.EMAIL||j==c.WEBPUSH||Ce?"desktop":"mobile"),[xe,ye]=r(!1),[Pe,Ee]=r(B),[Se,Te]=r(!1),[Ie,we]=r([]),[De,Ve]=r({}),[ke,Le]=r(k),[Ae,je]=r([]),[Be,He]=r(null),[Me,Oe]=r(!1),[Fe,We]=r(null!=H?H:[]),[Ne,$e]=r(!1),[ze,Re]=r(Ce?(null===(E=null===(P=null==ke?void 0:ke.mapping)||void 0===P?void 0:P.body)||void 0===E?void 0:E.length)?-1:0:-1),[Ue,Qe]=r([]),[_e,qe]=r(void 0),Ge=a(null),[Je,Ke]=r(!1),[Xe,Ye]=r(!1),[Ze,el]=r(!1),[ll,ol]=r(!0),[tl,il]=r(!0),[rl,al]=r({});i((()=>{Z?Qe(Z):be&&Qe([])}),[Z]),i((()=>{var e;if(!Me&&be&&(!Z||0===Qe.length)){const l=null===(e=null==ke?void 0:ke.components)||void 0===e?void 0:e[1].cards,o=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,t,i;"HEADER"===e.type&&o.push(null!==(i=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==i?i:"")}))})),je(o),Oe(!0)}}),[Me]);const nl=n((()=>f(O)),[O]);return i((()=>{qe(t(z))}),[z]),(null==he?void 0:he.show)&&ll&&he.templateQuality&&Object.values(p).find((e=>e===String(he.templateQuality)))?e(C,{headingTitle:null==ke?void 0:ke.label,headingSubtitle:j===c.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(S=null==ke?void 0:ke.category)&&void 0!==S?S:"")} • ${null!==(T=null==ke?void 0:ke.templateCategory)&&void 0!==T?T:""}`:"",templateAnalytics:he,onClose:()=>{null==L||L(),ol(!1),il(!1)},onCancel:()=>{ol(!1),il(!1)},onProceed:()=>{ol(!1),il(!0)},templateId:(null==ke?void 0:ke.templateId)||""}):e(v.Provider,Object.assign({value:{hideFooterButton:Ze,setHideFooterButton:el,hideCrossButton:Xe,setHideCrossButton:Ye,variableList:_e,setVariableList:qe,variableCallback:Be,setVariableCallback:He,showVariablePicker:xe,setShowVariablePicker:ye,template:ke,setTemplate:Le,device:fe,setDevice:ge,display_content:Pe,setDisplayContent:Ee,originalVariableList:Fe,setOriginalVariableList:We,isError:Se,setIsError:Te,channel:j,globalNormalizedPlaceholders:nl,templateSelectionTriggered:Ne,setTemplateSelectionTriggered:$e,enabledCustomText:_,disableEditVariable:J,pod:K,extras:X,isWhatsappCarousel:Ce,selectedCarouselIndex:ze,setSelectedCarouselIndex:Re,isProductCarouselType:be,templateErrorIndexes:De,cardCount:Ce?null===(w=null===(I=k.components)||void 0===I?void 0:I[1].cards)||void 0===w?void 0:w.length:void 0,errorIndexes:Ie,setErrorIndexes:we,pickerConf:Y,carouselProducts:Ue,setCarouselProducts:Qe,disableEditExpiry:ee,cardWidth:le,cardImages:Ae,onDeleteSelectedProducts:oe,hideDeviceContainerInPreview:re,sliderRef:Ge,isCarouselHovered:Je,setIsCarouselHovered:Ke,maxCharLimit:ae,ctaOptionsErrors:rl,setCtaOptionsErrors:al,onDefaultVariableSelect:ne,disableDatePicker:de,disableCopyCode:ue,initialExpiryDateTime:ce,showDiscountCodeExpiryInfo:pe}},{children:F?e(b,{variableListFromProps:z,channel:c.EMAIL,hideHeader:!0}):l(u,Object.assign({hideCrossButton:Xe,zIndex:N,centralContainerStyles:{width:Ce?900:j===c.EMAIL&&A?1e3:800},open:tl,onClose:()=>{il(!1),null==L||L()},headingTitle:null==ke?void 0:ke.label,headingSubtitle:j===c.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(D=null==ke?void 0:ke.category)&&void 0!==D?D:"")} • ${null!==(V=null==ke?void 0:ke.templateCategory)&&void 0!==V?V:""}`:"",onBackPress:()=>{if(null==he?void 0:he.show)return ol(!0),void il(!1);null==Q||Q()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(b,{variableListFromProps:z,showSampleValues:G,showVariableMapping:A,channel:j,whatsappSpecificPickerMeta:W,showVariableModal:$,discountCode:R,setDiscountCode:U,variableListForImage:q&&(null==q?void 0:q.length)>0?q:_e,fileName:te,setFileName:e=>{null==ie||ie(e)},skipDefaultVariableContent:se}),M?e(h,{isWhatsappCarousel:null!=Ce&&Ce,onSelect:function(){var e;if((null==Ue?void 0:Ue.length)<1&&be)return void Te(!0);if(Object.keys(rl).length>0&&K!==m.CHATBOT)return void Te(!0);const l=null==M?void 0:M(ke,Fe,null!=Pe?Pe:"",Ue);Ve(null!==(e=null==l?void 0:l.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==l?void 0:l.errorIndexes)||(null==l?void 0:l.error)?((null==l?void 0:l.errorIndexes)&&we(l.errorIndexes),(null==l?void 0:l.error)&&Te(!!(null==l?void 0:l.error))):$e(!0)},footerButtonText:me,footerInfoText:ve}):e(o,{})]}))}))};export{g as TemplateContextMapper};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i,Fragment as s}from"react/jsx-runtime";import{BikShimmer as t}from"../../shimmer/ShimmerComponent/BikShimmer.js";import{RightPanelContainer as h}from"../styles/TemplateAnalyticsStyles.js";const r=r=>{const{skipTitleShimmer:c}=r;return e(h,{children:[i("div",{children:c?i(s,{}):i(t,{boxes:[{width:"76px",height:"18px"}]})}),e("div",Object.assign({className:"mt-3"},{children:[...Array(3).fill(0).map((e=>i(a,{},e)))]})),e(s,{children:[i("div",{children:i(t,{boxes:[{width:"76px",height:"18px"}]})}),i("div",Object.assign({className:"mt-3"},{children:i(a,{})}))]})]})},a=()=>e("div",Object.assign({className:"each--analytics--container"},{children:[e("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[i(t,{boxes:[{width:"24px",height:"24px"}]}),i(t,{boxes:[{width:"69px",height:"11px"}]})]})),e("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[i(t,{boxes:[{width:"43px",height:"18px"}]}),i(t,{boxes:[{width:"69px",height:"28px"}]})]}))]}));export{r as TemplateAnalyticsSkeleton};
1
+ import{jsxs as e,jsx as i,Fragment as s}from"react/jsx-runtime";import{BikShimmer as t}from"../../shimmer/ShimmerComponent/BikShimmer.js";import{RightPanelContainer as h}from"../styles/TemplateAnalyticsStyles.js";const c=c=>{const{skipTitleShimmer:a}=c;return e(h,{children:[i("div",{children:a?i(s,{}):i(t,{boxes:[{width:"76px",height:"18px"}]})}),i("div",Object.assign({className:"mt-3"},{children:[0,1,2].map((e=>i(n,{},e)))})),e(s,{children:[i("div",{children:i(t,{boxes:[{width:"76px",height:"18px"}]})}),i("div",Object.assign({className:"mt-3"},{children:i(n,{})}))]})]})},n=()=>e("div",Object.assign({className:"each--analytics--container"},{children:[e("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[i(t,{boxes:[{width:"24px",height:"24px"}]}),i(t,{boxes:[{width:"69px",height:"11px"}]})]})),e("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[i(t,{boxes:[{width:"43px",height:"18px"}]}),i(t,{boxes:[{width:"69px",height:"28px"}]})]}))]}));export{c as TemplateAnalyticsSkeleton};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.639--beta--0.2",
3
+ "version": "0.0.639--prev--beta0.22",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",