@bikdotai/bik-component-library 0.0.575-beta-02 → 0.0.575-beta-03
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-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/cjs/components/template-preview/models/WebpushTemplate.d.ts +4 -0
- package/dist/cjs/components/template-preview/webpush/WebpushPreview.js +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/helpers/WebpushTemplateHelper.js +1 -1
- package/dist/esm/components/template-preview/models/WebpushTemplate.d.ts +4 -0
- package/dist/esm/components/template-preview/webpush/WebpushPreview.js +1 -1
- package/package.json +1 -1
|
@@ -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"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateSelectModalContent.js"),c=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=p=>{let{selectedTemplate:v,closeDialog:m,showVariableMapping:h,channel:C,htmlContent:b,templateVariables:S,onTemplateSelect:E,globalPlaceholders:P,showOnlyContent:x,whatsappSpecificPickerMeta:f,zIndex:g,showVariableModal:T,variableList:L,discountCode:I,setDiscountCode:j,onBackPress:y,enabledCustomText:V,variableListForImage:w,showSampleValues:D,disableEditVariable:k,pod:A,extras:H,pickerConf:M,selectedCarouselProducts:N,disableEditExpiry:O,cardWidth:q,onDeleteSelectedProducts:B,fileName:F,setFileName:_,hideDeviceContainerInPreview:W,maxCharLimit:Y,onDefaultVariableSelect:R,skipDefaultVariableContent:z}=p;var U,$,G,J,K,Q,X,Z;l.useEffect((()=>{ie(b)}),[b]);const ee=C===s.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===($=null===(U=null==v?void 0:v.components)||void 0===U?void 0:U[1])||void 0===$?void 0:$.type),te=null==v?void 0:v.isProductCarouselType,[le,oe]=l.useState(C===s.CHANNEL_TYPE.EMAIL||C==s.CHANNEL_TYPE.WEBPUSH||ee?"desktop":"mobile"),[ae,re]=l.useState(!1),[se,ie]=l.useState(b),[ne,de]=l.useState(!1),[ue,ce]=l.useState([]),[pe,ve]=l.useState({}),[me,he]=l.useState(v),[Ce,be]=l.useState([]),[Se,Ee]=l.useState(null),[Pe,xe]=l.useState(!1),[fe,ge]=l.useState(null!=S?S:[]),[Te,Le]=l.useState(!1),[Ie,je]=l.useState(ee?(null===(J=null===(G=null==me?void 0:me.mapping)||void 0===G?void 0:G.body)||void 0===J?void 0:J.length)?-1:0:-1),[ye,Ve]=l.useState([]),[we,De]=l.useState(void 0),ke=l.useRef(null),[Ae,He]=l.useState(!1),[Me,Ne]=l.useState(!1),[Oe,qe]=l.useState(!1),[Be,Fe]=l.useState({});l.useEffect((()=>{N?Ve(N):te&&Ve([])}),[N]),l.useEffect((()=>{var e;if(!Pe&&te&&(!N||0===Ve.length)){const t=null===(e=null==me?void 0:me.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:"")}))})),be(l),xe(!0)}}),[Pe]);const _e=l.useMemo((()=>c.convertPlaceholdersToBikDropdown(P)),[P]);return l.useEffect((()=>{De(t.cloneDeep(L))}),[L]),e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Oe,setHideFooterButton:qe,hideCrossButton:Me,setHideCrossButton:Ne,variableList:we,setVariableList:De,variableCallback:Se,setVariableCallback:Ee,showVariablePicker:ae,setShowVariablePicker:re,template:me,setTemplate:he,device:le,setDevice:oe,display_content:se,setDisplayContent:ie,originalVariableList:fe,setOriginalVariableList:ge,isError:ne,setIsError:de,channel:C,globalNormalizedPlaceholders:_e,templateSelectionTriggered:Te,setTemplateSelectionTriggered:Le,enabledCustomText:V,disableEditVariable:k,pod:A,extras:H,isWhatsappCarousel:ee,selectedCarouselIndex:Ie,setSelectedCarouselIndex:je,isProductCarouselType:te,templateErrorIndexes:pe,cardCount:ee?null===(Q=null===(K=v.components)||void 0===K?void 0:K[1].cards)||void 0===Q?void 0:Q.length:void 0,errorIndexes:ue,setErrorIndexes:ce,pickerConf:M,carouselProducts:ye,setCarouselProducts:Ve,disableEditExpiry:O,cardWidth:q,cardImages:Ce,onDeleteSelectedProducts:B,hideDeviceContainerInPreview:W,sliderRef:ke,isCarouselHovered:Ae,setIsCarouselHovered:He,maxCharLimit:Y,ctaOptionsErrors:Be,setCtaOptionsErrors:Fe,onDefaultVariableSelect:R}},{children:x?e.jsx(u.default,{variableListFromProps:L,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(r.StyledModal,Object.assign({hideCrossButton:Me,zIndex:g,centralContainerStyles:{width:ee?900:C===s.CHANNEL_TYPE.EMAIL&&h?1e3:800},open:!0,onClose:()=>{null==m||m()},headingTitle:null==me?void 0:me.label,headingSubtitle:C===s.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(X=null==me?void 0:me.category)&&void 0!==X?X:"")} • ${null!==(Z=null==me?void 0:me.templateCategory)&&void 0!==Z?Z:""}`:"",onBackPress:()=>{null==y||y()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(u.default,{variableListFromProps:L,showSampleValues:D,showVariableMapping:h,channel:C,whatsappSpecificPickerMeta:f,showVariableModal:T,discountCode:I,setDiscountCode:j,variableListForImage:w&&(null==w?void 0:w.length)>0?w:we,fileName:F,setFileName:e=>{null==_||_(e)},skipDefaultVariableContent:z}),E?e.jsx(d.default,{isWhatsappCarousel:null!=ee&&ee,onSelect:function(){var e;if((null==ye?void 0:ye.length)<1&&te)return void de(!0);if(Object.keys(Be).length>0&&A!==i.POD.CHATBOT)return void de(!0);const t=null==E?void 0:E(me,fe,null!=se?se:"",ye);ve(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)&&ce(t.errorIndexes),(null==t?void 0:t.error)&&de(!!(null==t?void 0:t.error))):Le(!0)}}):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"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateSelectModalContent.js"),c=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=p=>{let{selectedTemplate:v,closeDialog:m,showVariableMapping:h,channel:C,htmlContent:b,templateVariables:S,onTemplateSelect:E,globalPlaceholders:P,showOnlyContent:x,whatsappSpecificPickerMeta:f,zIndex:g,showVariableModal:T,variableList:L,discountCode:I,setDiscountCode:j,onBackPress:y,enabledCustomText:V,variableListForImage:w,showSampleValues:D,disableEditVariable:k,pod:A,extras:H,pickerConf:M,selectedCarouselProducts:N,disableEditExpiry:O,cardWidth:q,onDeleteSelectedProducts:B,fileName:F,setFileName:_,hideDeviceContainerInPreview:W,maxCharLimit:Y,onDefaultVariableSelect:R,skipDefaultVariableContent:z}=p;var U,$,G,J,K,Q,X,Z;l.useEffect((()=>{ie(b)}),[b]);const ee=C===s.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===($=null===(U=null==v?void 0:v.components)||void 0===U?void 0:U[1])||void 0===$?void 0:$.type),te=null==v?void 0:v.isProductCarouselType,[le,oe]=l.useState(C===s.CHANNEL_TYPE.EMAIL||C==s.CHANNEL_TYPE.WEBPUSH||ee?"desktop":"mobile"),[ae,re]=l.useState(!1),[se,ie]=l.useState(b),[ne,de]=l.useState(!1),[ue,ce]=l.useState([]),[pe,ve]=l.useState({}),[me,he]=l.useState(v),[Ce,be]=l.useState([]),[Se,Ee]=l.useState(null),[Pe,xe]=l.useState(!1),[fe,ge]=l.useState(null!=S?S:[]),[Te,Le]=l.useState(!1),[Ie,je]=l.useState(ee?(null===(J=null===(G=null==me?void 0:me.mapping)||void 0===G?void 0:G.body)||void 0===J?void 0:J.length)?-1:0:-1),[ye,Ve]=l.useState([]),[we,De]=l.useState(void 0),ke=l.useRef(null),[Ae,He]=l.useState(!1),[Me,Ne]=l.useState(!1),[Oe,qe]=l.useState(!1),[Be,Fe]=l.useState({});l.useEffect((()=>{N?Ve(N):te&&Ve([])}),[N]),l.useEffect((()=>{var e;if(!Pe&&te&&(!N||0===Ve.length)){const t=null===(e=null==me?void 0:me.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:"")}))})),be(l),xe(!0)}}),[Pe]);const _e=l.useMemo((()=>c.convertPlaceholdersToBikDropdown(P)),[P]);return l.useEffect((()=>{De(t.cloneDeep(L))}),[L]),e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Oe,setHideFooterButton:qe,hideCrossButton:Me,setHideCrossButton:Ne,variableList:we,setVariableList:De,variableCallback:Se,setVariableCallback:Ee,showVariablePicker:ae,setShowVariablePicker:re,template:me,setTemplate:he,device:le,setDevice:oe,display_content:se,setDisplayContent:ie,originalVariableList:fe,setOriginalVariableList:ge,isError:ne,setIsError:de,channel:C,globalNormalizedPlaceholders:_e,templateSelectionTriggered:Te,setTemplateSelectionTriggered:Le,enabledCustomText:V,disableEditVariable:k,pod:A,extras:H,isWhatsappCarousel:ee,selectedCarouselIndex:Ie,setSelectedCarouselIndex:je,isProductCarouselType:te,templateErrorIndexes:pe,cardCount:ee?null===(Q=null===(K=v.components)||void 0===K?void 0:K[1].cards)||void 0===Q?void 0:Q.length:void 0,errorIndexes:ue,setErrorIndexes:ce,pickerConf:M,carouselProducts:ye,setCarouselProducts:Ve,disableEditExpiry:O,cardWidth:q,cardImages:Ce,onDeleteSelectedProducts:B,hideDeviceContainerInPreview:W,sliderRef:ke,isCarouselHovered:Ae,setIsCarouselHovered:He,maxCharLimit:Y,ctaOptionsErrors:Be,setCtaOptionsErrors:Fe,onDefaultVariableSelect:R}},{children:x?e.jsx(u.default,{variableListFromProps:L,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(r.StyledModal,Object.assign({hideCrossButton:Me,zIndex:g,centralContainerStyles:{width:ee?900:C===s.CHANNEL_TYPE.EMAIL&&h?1e3:800},open:!0,onClose:()=>{null==m||m()},headingTitle:null==me?void 0:me.label,headingSubtitle:C===s.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(X=null==me?void 0:me.category)&&void 0!==X?X:"")} • ${null!==(Z=null==me?void 0:me.templateCategory)&&void 0!==Z?Z:""}`:"",onBackPress:()=>{null==y||y()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(u.default,{variableListFromProps:L,showSampleValues:D,showVariableMapping:h,channel:C,whatsappSpecificPickerMeta:f,showVariableModal:T,discountCode:I,setDiscountCode:j,variableListForImage:w&&(null==w?void 0:w.length)>0?w:we,fileName:F,setFileName:e=>{null==_||_(e)},skipDefaultVariableContent:z}),E?e.jsx(d.default,{isWhatsappCarousel:null!=ee&&ee,onSelect:function(){var e;if((null==ye?void 0:ye.length)<1&&te)return void de(!0);if(Object.keys(Be).length>0&&A!==i.POD.CHATBOT)return void de(!0);console.log("template",me);const t=null==E?void 0:E(me,fe,null!=se?se:"",ye);ve(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)&&ce(t.errorIndexes),(null==t?void 0:t.error)&&de(!!(null==t?void 0:t.error))):Le(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../constants/Theme.js"),require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var t=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var i=require("../../template-preview/constants/TemplateConstants.js"),l=require("../../../utils/variableUtils.js");exports.default=()=>{function n(e,t,i,n){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../constants/Theme.js"),require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var t=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var i=require("../../template-preview/constants/TemplateConstants.js"),l=require("../../../utils/variableUtils.js");exports.default=()=>{function n(e,t,i,n,o){const u=t.map(((t,u)=>{const s=a(t);if(n)return{variableName:t,isEditableVariable:!1,updatedValue:t,index:u,variableValue:t,type:"string"};const d=function(e,t,i,n){const a=i&&i.length?i:l.extractVariables(e);if(!a||!a.length)return[];const o=[];return a.forEach(((e,i)=>{var l,a,u,s;const d=r(t,`{{${e}}}`);if(d){const{actualValue:t,defaultValue:r}=d,v="{{custom.text}}"===t||"{{custom.url}}"===t;o.push({editable:v,variableVal:v?null===(a=null===(l=null==n?void 0:n.filter((t=>t.name==e)))||void 0===l?void 0:l[0])||void 0===a?void 0:a.value:r,editableDefaultValues:v?void 0:r,variableName:t,updatedValue:v?null===(s=null===(u=null==n?void 0:n.filter((t=>t.name==e)))||void 0===u?void 0:u[0])||void 0===s?void 0:s.value:r,idx:i})}})),o}(s?t:i,e,void 0,o);if(d.length>0){const e=d[0];return{variableName:e.variableName,isEditableVariable:!0,updatedValue:(null==e?void 0:e.updatedValue)?null==e?void 0:e.updatedValue:s?e.variableName:t,index:u,variableValue:e.variableVal,type:"string"}}return null})).filter((e=>null!==e));return u}const a=e=>e.includes("{{")&&e.includes("}}"),o=(e,t)=>e&&e.length?e.flatMap(((e,i)=>{var n;return a(e)?e.includes("editableVariable")?(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.value)||e:l.extractVariables(e).map((e=>`{{${e}}}`))||[]:e})):[];const r=(e,t)=>{for(const i of e)for(const e in i.variables){const l=i.variables[e];if(l.actualValue===t||t.includes("editableVariable")&&l.actualValue.includes("custom.text"))return l}return null};return{processWebpushTemplate:function(r,u,s,d){var v,b,p,c,m,f,h,L;return e.__awaiter(this,void 0,void 0,(function*(){const e=Object.assign({},r);e.components=function(e){let t;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){console.error("Error parsing webpush component JSON:",e),t={}}else t=e;return t}(e.components);const{components:{title:V,body:g,buttons:w,icon:y,image:_},webpushBroadcastConfig:C}=e;let x={title:o(null!==(v=null==C?void 0:C.title)&&void 0!==v?v:[]),body:o(null!==(b=null==C?void 0:C.body)&&void 0!==b?b:[],null==g?void 0:g.variables),buttonsW:null!==(p=null==C?void 0:C.buttons)&&void 0!==p?p:[]};if(!e.webpushBroadcastConfig){const t=null!==(c=null==g?void 0:g.text)&&void 0!==c?c:"string"==typeof g?g:"",n=w&&(null==w?void 0:w.length)?w.map((e=>(null==e?void 0:e.websiteLink)==i.CUSTOM_URL_PLACEHOLDER?null==e?void 0:e.redirectionLink:null==e?void 0:e.websiteLink)).filter((e=>void 0!==e)):[],a=l.extractVariables(t).map(((e,t)=>{var i,l;return e.includes("editableVariable")?(null===(l=null===(i=null==g?void 0:g.variables)||void 0===i?void 0:i[t])||void 0===l?void 0:l.value)||e:`{{${e}}}`}));x={title:l.extractVariables(V).map((e=>`{{${e}}}`)),body:a,buttonsW:[]};const o={title:null!==(m=x.title)&&void 0!==m?m:[],body:null!==(f=x.body)&&void 0!==f?f:[],buttons:n,icon:y?[y]:void 0,image:_?[_]:void 0,redirectionLink:(null==g?void 0:g.redirectionLink)?[null==g?void 0:g.redirectionLink]:[]};e.webpushBroadcastConfig=o}const W=w&&w.length?w.map(((e,l)=>({type:t.BUTTON_TYPE.URL,text:null==e?void 0:e.text,url:"https://d.bik.ai/{{1}}",example:x.buttonsW&&x.buttonsW.length?a(x.buttonsW[l])?[""]:[x.buttonsW[l]]:e.redirectionLink?[e.redirectionLink]:void 0,buttonVariable:x.buttonsW&&x.buttonsW.length?a(x.buttonsW[l])?x.buttonsW[l]:i.CUSTOM_URL_PLACEHOLDER_VAR:e.websiteLink?e.websiteLink==i.CUSTOM_URL_PLACEHOLDER?i.CUSTOM_URL_PLACEHOLDER_VAR:e.websiteLink:i.CUSTOM_URL_PLACEHOLDER_VAR,index:l}))):[],k={title:n(u,x.title,V,d),body:n(u,x.body,(null==g?void 0:g.text)||"",d,null==g?void 0:g.variables),buttons:W};return{templateVariableMapping:{title:(null===(h=null==s?void 0:s.title)||void 0===h?void 0:h.length)?s.title:k.title,body:(null===(L=null==s?void 0:s.body)||void 0===L?void 0:L.length)?s.body:k.body,buttons:k.buttons,icon:[],header:[]},webpushBroadcastConfig:e.webpushBroadcastConfig,template:e}}))},isValidUrl:e=>{try{return new URL(e),!0}catch(e){return!1}}}};
|
|
@@ -43,6 +43,10 @@ export type WebPushComponentType = {
|
|
|
43
43
|
text: string;
|
|
44
44
|
redirectionLink?: string;
|
|
45
45
|
websiteLink?: string;
|
|
46
|
+
variables?: {
|
|
47
|
+
name: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[];
|
|
46
50
|
};
|
|
47
51
|
export type WebPushTemplateComponent = {
|
|
48
52
|
[WEB_PUSH_COMPONENT_TYPE.TITLE]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../models/WebpushTemplate.js"),t=require("../utils/TemplateHelperUtils.js"),i=require("./WebpushPreview.styled.js");exports.default=n=>{var l,a,r,E,O,c;const{components:P,webpushBroadcastConfig:_}=n.template,o=(new t.TemplateHelperUtils).parseJsonString(P),T="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",N=(e,s)=>{let t=0;return e?e.replace(/{{(.*?)}}/g,((e,i)=>{const n=i.trim();if(s&&s.length&&t<s.length){const e=s[t];return t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../models/WebpushTemplate.js"),t=require("../utils/TemplateHelperUtils.js"),i=require("./WebpushPreview.styled.js");exports.default=n=>{var l,a,r,E,O,c;const{components:P,webpushBroadcastConfig:_}=n.template,o=(new t.TemplateHelperUtils).parseJsonString(P),T="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",N=(e,s)=>{let t=0;return e?e.replace(/{{(.*?)}}/g,((e,i)=>{const n=i.trim();if(s&&s.length&&t<s.length){const e=s[t];return t++,`${e} `}return`{{${n}}}`})):""},d=N(o[s.WEB_PUSH_COMPONENT_TYPE.TITLE],null==_?void 0:_.title),g=N(null!==(r=null!==(a=null===(l=o[s.WEB_PUSH_COMPONENT_TYPE.BODY])||void 0===l?void 0:l.text)&&void 0!==a?a:o[s.WEB_PUSH_COMPONENT_TYPE.BODY])&&void 0!==r?r:"",null==_?void 0:_.body);return e.jsxs(i.WebpushPreviewContainer,Object.assign({style:Object.assign({},n.extraContainerCss)},{children:[e.jsxs("div",Object.assign({className:"icon--header"},{children:[e.jsx("div",Object.assign({className:"icon-img-container"},{children:e.jsx("img",{src:(null===(E=null==_?void 0:_[s.WEB_PUSH_COMPONENT_TYPE.ICON])||void 0===E?void 0:E.length)?_[s.WEB_PUSH_COMPONENT_TYPE.ICON][0]:o[s.WEB_PUSH_COMPONENT_TYPE.ICON]||T,alt:"icon-image"})})),e.jsxs("div",Object.assign({className:"text--container"},{children:[e.jsx("div",{children:d}),e.jsx("div",Object.assign({style:{marginTop:3}},{children:g}))]}))]})),o[s.WEB_PUSH_COMPONENT_TYPE.IMAGE]&&o[s.WEB_PUSH_COMPONENT_TYPE.IMAGE].length&&e.jsx("div",Object.assign({className:"banner-img-container"},{children:e.jsx("img",{src:(null===(O=null==_?void 0:_[s.WEB_PUSH_COMPONENT_TYPE.IMAGE])||void 0===O?void 0:O.length)?_[s.WEB_PUSH_COMPONENT_TYPE.IMAGE][0]:null!==(c=o[s.WEB_PUSH_COMPONENT_TYPE.IMAGE])&&void 0!==c?c:T,alt:"icon-image"})})),o[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS]&&o[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length&&e.jsx("div",Object.assign({className:"button-container "+(1===o[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length?"single-button":"")},{children:o[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].map(((t,i)=>e.jsx("div",Object.assign({className:"each--btn",style:{flex:1===o[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length?"0 0 50%":"1"}},{children:e.jsx("div",Object.assign({className:"text-btn"},{children:t.text}))}),`webpush-buttons-${i}`)))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as r,useState as i,useRef as a,useMemo as s}from"react";import n 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 h from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as b}from"./utils/convertPlaceholdersToBikDropdown.js";const C=C=>{let{selectedTemplate:f,closeDialog:g,showVariableMapping:P,channel:x,htmlContent:E,templateVariables:S,onTemplateSelect:I,globalPlaceholders:T,showOnlyContent:V,whatsappSpecificPickerMeta:y,zIndex:w,showVariableModal:k,variableList:L,discountCode:D,setDiscountCode:j,onBackPress:M,enabledCustomText:A,variableListForImage:B,showSampleValues:H,disableEditVariable:F,pod:O,extras:W,pickerConf:N,selectedCarouselProducts:z,disableEditExpiry:R,cardWidth:U,onDeleteSelectedProducts:$,fileName:_,setFileName:q,hideDeviceContainerInPreview:G,maxCharLimit:J,onDefaultVariableSelect:K,skipDefaultVariableContent:Q}=C;var X,Y,Z,ee,le,oe,te,re;r((()=>{pe(E)}),[E]);const ie=x===c.WHATSAPP&&"CAROUSEL"===(null===(Y=null===(X=null==f?void 0:f.components)||void 0===X?void 0:X[1])||void 0===Y?void 0:Y.type),ae=null==f?void 0:f.isProductCarouselType,[se,ne]=i(x===c.EMAIL||x==c.WEBPUSH||ie?"desktop":"mobile"),[de,ue]=i(!1),[ce,pe]=i(E),[me,ve]=i(!1),[he,be]=i([]),[Ce,fe]=i({}),[ge,Pe]=i(f),[xe,Ee]=i([]),[Se,Ie]=i(null),[Te,Ve]=i(!1),[ye,we]=i(null!=S?S:[]),[ke,Le]=i(!1),[De,je]=i(ie?(null===(ee=null===(Z=null==ge?void 0:ge.mapping)||void 0===Z?void 0:Z.body)||void 0===ee?void 0:ee.length)?-1:0:-1),[Me,Ae]=i([]),[Be,He]=i(void 0),Fe=a(null),[Oe,We]=i(!1),[Ne,ze]=i(!1),[Re,Ue]=i(!1),[$e,_e]=i({});r((()=>{z?Ae(z):ae&&Ae([])}),[z]),r((()=>{var e;if(!Te&&ae&&(!z||0===Ae.length)){const l=null===(e=null==ge?void 0:ge.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,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),Ee(o),Ve(!0)}}),[Te]);const qe=s((()=>b(T)),[T]);return r((()=>{He(t(L))}),[L]),e(m.Provider,Object.assign({value:{hideFooterButton:Re,setHideFooterButton:Ue,hideCrossButton:Ne,setHideCrossButton:ze,variableList:Be,setVariableList:He,variableCallback:Se,setVariableCallback:Ie,showVariablePicker:de,setShowVariablePicker:ue,template:ge,setTemplate:Pe,device:se,setDevice:ne,display_content:ce,setDisplayContent:pe,originalVariableList:ye,setOriginalVariableList:we,isError:me,setIsError:ve,channel:x,globalNormalizedPlaceholders:qe,templateSelectionTriggered:ke,setTemplateSelectionTriggered:Le,enabledCustomText:A,disableEditVariable:F,pod:O,extras:W,isWhatsappCarousel:ie,selectedCarouselIndex:De,setSelectedCarouselIndex:je,isProductCarouselType:ae,templateErrorIndexes:Ce,cardCount:ie?null===(oe=null===(le=f.components)||void 0===le?void 0:le[1].cards)||void 0===oe?void 0:oe.length:void 0,errorIndexes:he,setErrorIndexes:be,pickerConf:N,carouselProducts:Me,setCarouselProducts:Ae,disableEditExpiry:R,cardWidth:U,cardImages:xe,onDeleteSelectedProducts:$,hideDeviceContainerInPreview:G,sliderRef:Fe,isCarouselHovered:Oe,setIsCarouselHovered:We,maxCharLimit:J,ctaOptionsErrors:$e,setCtaOptionsErrors:_e,onDefaultVariableSelect:K}},{children:V?e(h,{variableListFromProps:L,channel:c.EMAIL,hideHeader:!0}):l(u,Object.assign({hideCrossButton:Ne,zIndex:w,centralContainerStyles:{width:ie?900:x===c.EMAIL&&P?1e3:800},open:!0,onClose:()=>{null==g||g()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:x===c.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(te=null==ge?void 0:ge.category)&&void 0!==te?te:"")} • ${null!==(re=null==ge?void 0:ge.templateCategory)&&void 0!==re?re:""}`:"",onBackPress:()=>{null==M||M()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(h,{variableListFromProps:L,showSampleValues:H,showVariableMapping:P,channel:x,whatsappSpecificPickerMeta:y,showVariableModal:k,discountCode:D,setDiscountCode:j,variableListForImage:B&&(null==B?void 0:B.length)>0?B:Be,fileName:_,setFileName:e=>{null==q||q(e)},skipDefaultVariableContent:Q}),I?e(v,{isWhatsappCarousel:null!=ie&&ie,onSelect:function(){var e;if((null==Me?void 0:Me.length)<1&&ae)return void ve(!0);if(Object.keys($e).length>0&&O!==p.CHATBOT)return void ve(!0);const l=null==I?void 0:I(ge,ye,null!=ce?ce:"",Me);fe(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)&&be(l.errorIndexes),(null==l?void 0:l.error)&&ve(!!(null==l?void 0:l.error))):Le(!0)}}):e(o,{})]}))}))};export{C 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 r,useState as i,useRef as a,useMemo as s}from"react";import n 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 h from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as b}from"./utils/convertPlaceholdersToBikDropdown.js";const C=C=>{let{selectedTemplate:f,closeDialog:g,showVariableMapping:P,channel:x,htmlContent:E,templateVariables:S,onTemplateSelect:I,globalPlaceholders:T,showOnlyContent:V,whatsappSpecificPickerMeta:y,zIndex:w,showVariableModal:k,variableList:L,discountCode:D,setDiscountCode:j,onBackPress:M,enabledCustomText:A,variableListForImage:B,showSampleValues:H,disableEditVariable:F,pod:O,extras:W,pickerConf:N,selectedCarouselProducts:z,disableEditExpiry:R,cardWidth:U,onDeleteSelectedProducts:$,fileName:_,setFileName:q,hideDeviceContainerInPreview:G,maxCharLimit:J,onDefaultVariableSelect:K,skipDefaultVariableContent:Q}=C;var X,Y,Z,ee,le,oe,te,re;r((()=>{pe(E)}),[E]);const ie=x===c.WHATSAPP&&"CAROUSEL"===(null===(Y=null===(X=null==f?void 0:f.components)||void 0===X?void 0:X[1])||void 0===Y?void 0:Y.type),ae=null==f?void 0:f.isProductCarouselType,[se,ne]=i(x===c.EMAIL||x==c.WEBPUSH||ie?"desktop":"mobile"),[de,ue]=i(!1),[ce,pe]=i(E),[me,ve]=i(!1),[he,be]=i([]),[Ce,fe]=i({}),[ge,Pe]=i(f),[xe,Ee]=i([]),[Se,Ie]=i(null),[Te,Ve]=i(!1),[ye,we]=i(null!=S?S:[]),[ke,Le]=i(!1),[De,je]=i(ie?(null===(ee=null===(Z=null==ge?void 0:ge.mapping)||void 0===Z?void 0:Z.body)||void 0===ee?void 0:ee.length)?-1:0:-1),[Me,Ae]=i([]),[Be,He]=i(void 0),Fe=a(null),[Oe,We]=i(!1),[Ne,ze]=i(!1),[Re,Ue]=i(!1),[$e,_e]=i({});r((()=>{z?Ae(z):ae&&Ae([])}),[z]),r((()=>{var e;if(!Te&&ae&&(!z||0===Ae.length)){const l=null===(e=null==ge?void 0:ge.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,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),Ee(o),Ve(!0)}}),[Te]);const qe=s((()=>b(T)),[T]);return r((()=>{He(t(L))}),[L]),e(m.Provider,Object.assign({value:{hideFooterButton:Re,setHideFooterButton:Ue,hideCrossButton:Ne,setHideCrossButton:ze,variableList:Be,setVariableList:He,variableCallback:Se,setVariableCallback:Ie,showVariablePicker:de,setShowVariablePicker:ue,template:ge,setTemplate:Pe,device:se,setDevice:ne,display_content:ce,setDisplayContent:pe,originalVariableList:ye,setOriginalVariableList:we,isError:me,setIsError:ve,channel:x,globalNormalizedPlaceholders:qe,templateSelectionTriggered:ke,setTemplateSelectionTriggered:Le,enabledCustomText:A,disableEditVariable:F,pod:O,extras:W,isWhatsappCarousel:ie,selectedCarouselIndex:De,setSelectedCarouselIndex:je,isProductCarouselType:ae,templateErrorIndexes:Ce,cardCount:ie?null===(oe=null===(le=f.components)||void 0===le?void 0:le[1].cards)||void 0===oe?void 0:oe.length:void 0,errorIndexes:he,setErrorIndexes:be,pickerConf:N,carouselProducts:Me,setCarouselProducts:Ae,disableEditExpiry:R,cardWidth:U,cardImages:xe,onDeleteSelectedProducts:$,hideDeviceContainerInPreview:G,sliderRef:Fe,isCarouselHovered:Oe,setIsCarouselHovered:We,maxCharLimit:J,ctaOptionsErrors:$e,setCtaOptionsErrors:_e,onDefaultVariableSelect:K}},{children:V?e(h,{variableListFromProps:L,channel:c.EMAIL,hideHeader:!0}):l(u,Object.assign({hideCrossButton:Ne,zIndex:w,centralContainerStyles:{width:ie?900:x===c.EMAIL&&P?1e3:800},open:!0,onClose:()=>{null==g||g()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:x===c.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(te=null==ge?void 0:ge.category)&&void 0!==te?te:"")} • ${null!==(re=null==ge?void 0:ge.templateCategory)&&void 0!==re?re:""}`:"",onBackPress:()=>{null==M||M()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(h,{variableListFromProps:L,showSampleValues:H,showVariableMapping:P,channel:x,whatsappSpecificPickerMeta:y,showVariableModal:k,discountCode:D,setDiscountCode:j,variableListForImage:B&&(null==B?void 0:B.length)>0?B:Be,fileName:_,setFileName:e=>{null==q||q(e)},skipDefaultVariableContent:Q}),I?e(v,{isWhatsappCarousel:null!=ie&&ie,onSelect:function(){var e;if((null==Me?void 0:Me.length)<1&&ae)return void ve(!0);if(Object.keys($e).length>0&&O!==p.CHATBOT)return void ve(!0);console.log("template",ge);const l=null==I?void 0:I(ge,ye,null!=ce?ce:"",Me);fe(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)&&be(l.errorIndexes),(null==l?void 0:l.error)&&ve(!!(null==l?void 0:l.error))):Le(!0)}}):e(o,{})]}))}))};export{C as TemplateContextMapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{BUTTON_TYPE as t}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{CUSTOM_URL_PLACEHOLDER as i,CUSTOM_URL_PLACEHOLDER_VAR as l}from"../../template-preview/constants/TemplateConstants.js";import{extractVariables as n}from"../../../utils/variableUtils.js";const o=()=>{function o(e,t,i,l,o){const r=t.map(((t,r)=>{const s=a(t);if(l)return{variableName:t,isEditableVariable:!1,updatedValue:t,index:r,variableValue:t,type:"string"};const d=function(e,t,i,l){const o=i&&i.length?i:n(e);if(!o||!o.length)return[];const a=[];return o.forEach(((e,i)=>{var n,o,r,s;const d=u(t,`{{${e}}}`);if(d){const{actualValue:t,defaultValue:u}=d,v="{{custom.text}}"===t||"{{custom.url}}"===t;a.push({editable:v,variableVal:v?null===(o=null===(n=null==l?void 0:l.filter((t=>t.name==e)))||void 0===n?void 0:n[0])||void 0===o?void 0:o.value:u,editableDefaultValues:v?void 0:u,variableName:t,updatedValue:v?null===(s=null===(r=null==l?void 0:l.filter((t=>t.name==e)))||void 0===r?void 0:r[0])||void 0===s?void 0:s.value:u,idx:i})}})),a}(s?t:i,e,void 0,o);if(d.length>0){const e=d[0];return{variableName:e.variableName,isEditableVariable:!0,updatedValue:(null==e?void 0:e.updatedValue)?null==e?void 0:e.updatedValue:s?e.variableName:t,index:r,variableValue:e.variableVal,type:"string"}}return null})).filter((e=>null!==e));return r}const a=e=>e.includes("{{")&&e.includes("}}"),r=(e,t)=>e&&e.length?e.flatMap(((e,i)=>{var l;return a(e)?e.includes("editableVariable")?(null===(l=null==t?void 0:t[i])||void 0===l?void 0:l.value)||e:n(e).map((e=>`{{${e}}}`))||[]:e})):[];const u=(e,t)=>{for(const i of e)for(const e in i.variables){const l=i.variables[e];if(l.actualValue===t||t.includes("editableVariable")&&l.actualValue.includes("custom.text"))return l}return null};return{processWebpushTemplate:function(u,s,d,v){var p,b,c,m,f,h,g,V;return e(this,void 0,void 0,(function*(){const e=Object.assign({},u);e.components=function(e){let t;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){console.error("Error parsing webpush component JSON:",e),t={}}else t=e;return t}(e.components);const{components:{title:w,body:y,buttons:W,icon:k,image:L},webpushBroadcastConfig:j}=e;let x={title:r(null!==(p=null==j?void 0:j.title)&&void 0!==p?p:[]),body:r(null!==(b=null==j?void 0:j.body)&&void 0!==b?b:[],null==y?void 0:y.variables),buttonsW:null!==(c=null==j?void 0:j.buttons)&&void 0!==c?c:[]};if(!e.webpushBroadcastConfig){const t=null!==(m=null==y?void 0:y.text)&&void 0!==m?m:"string"==typeof y?y:"",l=W&&(null==W?void 0:W.length)?W.map((e=>(null==e?void 0:e.websiteLink)==i?null==e?void 0:e.redirectionLink:null==e?void 0:e.websiteLink)).filter((e=>void 0!==e)):[],o=n(t).map(((e,t)=>{var i,l;return e.includes("editableVariable")?(null===(l=null===(i=null==y?void 0:y.variables)||void 0===i?void 0:i[t])||void 0===l?void 0:l.value)||e:`{{${e}}}`}));x={title:n(w).map((e=>`{{${e}}}`)),body:o,buttonsW:[]};const a={title:null!==(f=x.title)&&void 0!==f?f:[],body:null!==(h=x.body)&&void 0!==h?h:[],buttons:l,icon:k?[k]:void 0,image:L?[L]:void 0,redirectionLink:(null==y?void 0:y.redirectionLink)?[null==y?void 0:y.redirectionLink]:[]};e.webpushBroadcastConfig=a}const C=W&&W.length?W.map(((e,n)=>({type:t.URL,text:null==e?void 0:e.text,url:"https://d.bik.ai/{{1}}",example:x.buttonsW&&x.buttonsW.length?a(x.buttonsW[n])?[""]:[x.buttonsW[n]]:e.redirectionLink?[e.redirectionLink]:void 0,buttonVariable:x.buttonsW&&x.buttonsW.length?a(x.buttonsW[n])?x.buttonsW[n]:l:e.websiteLink?e.websiteLink==i?l:e.websiteLink:l,index:n}))):[],N={title:o(s,x.title,w,v),body:o(s,x.body,(null==y?void 0:y.text)||"",v,null==y?void 0:y.variables),buttons:C};return{templateVariableMapping:{title:(null===(g=null==d?void 0:d.title)||void 0===g?void 0:g.length)?d.title:N.title,body:(null===(V=null==d?void 0:d.body)||void 0===V?void 0:V.length)?d.body:N.body,buttons:N.buttons,icon:[],header:[]},webpushBroadcastConfig:e.webpushBroadcastConfig,template:e}}))},isValidUrl:e=>{try{return new URL(e),!0}catch(e){return!1}}}};export{o as default};
|
|
@@ -43,6 +43,10 @@ export type WebPushComponentType = {
|
|
|
43
43
|
text: string;
|
|
44
44
|
redirectionLink?: string;
|
|
45
45
|
websiteLink?: string;
|
|
46
|
+
variables?: {
|
|
47
|
+
name: string;
|
|
48
|
+
value: string;
|
|
49
|
+
}[];
|
|
46
50
|
};
|
|
47
51
|
export type WebPushTemplateComponent = {
|
|
48
52
|
[WEB_PUSH_COMPONENT_TYPE.TITLE]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{WEB_PUSH_COMPONENT_TYPE as i}from"../models/WebpushTemplate.js";import{TemplateHelperUtils as n}from"../utils/TemplateHelperUtils.js";import{WebpushPreviewContainer as s}from"./WebpushPreview.styled.js";const a=a=>{var l,o,c,r,d,m;const{components:g,webpushBroadcastConfig:b}=a.template,h=(new n).parseJsonString(g),u="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",v=(e,t)=>{let i=0;return e?e.replace(/{{(.*?)}}/g,((e,n)=>{const s=n.trim();if(t&&t.length&&i<t.length){const e=t[i];return i
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{WEB_PUSH_COMPONENT_TYPE as i}from"../models/WebpushTemplate.js";import{TemplateHelperUtils as n}from"../utils/TemplateHelperUtils.js";import{WebpushPreviewContainer as s}from"./WebpushPreview.styled.js";const a=a=>{var l,o,c,r,d,m;const{components:g,webpushBroadcastConfig:b}=a.template,h=(new n).parseJsonString(g),u="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",v=(e,t)=>{let i=0;return e?e.replace(/{{(.*?)}}/g,((e,n)=>{const s=n.trim();if(t&&t.length&&i<t.length){const e=t[i];return i++,`${e} `}return`{{${s}}}`})):""},p=v(h[i.TITLE],null==b?void 0:b.title),O=v(null!==(c=null!==(o=null===(l=h[i.BODY])||void 0===l?void 0:l.text)&&void 0!==o?o:h[i.BODY])&&void 0!==c?c:"",null==b?void 0:b.body);return e(s,Object.assign({style:Object.assign({},a.extraContainerCss)},{children:[e("div",Object.assign({className:"icon--header"},{children:[t("div",Object.assign({className:"icon-img-container"},{children:t("img",{src:(null===(r=null==b?void 0:b[i.ICON])||void 0===r?void 0:r.length)?b[i.ICON][0]:h[i.ICON]||u,alt:"icon-image"})})),e("div",Object.assign({className:"text--container"},{children:[t("div",{children:p}),t("div",Object.assign({style:{marginTop:3}},{children:O}))]}))]})),h[i.IMAGE]&&h[i.IMAGE].length&&t("div",Object.assign({className:"banner-img-container"},{children:t("img",{src:(null===(d=null==b?void 0:b[i.IMAGE])||void 0===d?void 0:d.length)?b[i.IMAGE][0]:null!==(m=h[i.IMAGE])&&void 0!==m?m:u,alt:"icon-image"})})),h[i.BUTTONS]&&h[i.BUTTONS].length&&t("div",Object.assign({className:"button-container "+(1===h[i.BUTTONS].length?"single-button":"")},{children:h[i.BUTTONS].map(((e,n)=>t("div",Object.assign({className:"each--btn",style:{flex:1===h[i.BUTTONS].length?"0 0 50%":"1"}},{children:t("div",Object.assign({className:"text-btn"},{children:e.text}))}),`webpush-buttons-${n}`)))}))]}))};export{a as default};
|