@bikdotai/bik-component-library 0.0.314-beta.29 → 0.0.314-beta.30
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("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),o=require("../template-preview/models/Channels.js"),s=require("./context/templateModalContext.js"),i=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:c,closeDialog:u,showVariableMapping:p,channel:h,htmlContent:m,templateVariables:g,onTemplateSelect:C,globalPlaceholders:S,showOnlyContent:v,whatsappSpecificPickerMeta:b,zIndex:j,showVariableModal:M,variableList:T,discountCode:E,setDiscountCode:P,onBackPress:x}=d;var L,f;t.useEffect((()=>{y(m)}),[m]);const[k,w]=t.useState(h===o.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[q,y]=t.useState(m),[A,N]=t.useState(!1),[D,I]=t.useState(c),[V,_]=t.useState(null!=g?g:[]),[H,O]=t.useState(!1),[B,Y]=t.useState(!1);const z=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(S)),[S]);return e.jsx(s.TemplateModalContext.Provider,Object.assign({value:{template:D,setTemplate:I,device:k,setDevice:w,display_content:q,setDisplayContent:y,originalVariableList:V,setOriginalVariableList:_,isError:A,setIsError:N,channel:h,globalNormalizedPlaceholders:z,templateSelectionTriggered:H,setTemplateSelectionTriggered:O,isChecked:B,setIsChecked:Y}},{children:v?e.jsx(r.default,{channel:o.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:j,centralContainerStyles:{width:h===o.CHANNEL_TYPE.EMAIL&&p?1e3:650},open:!0,onClose:()=>{null==u||u()},headingTitle:null==D?void 0:D.label,headingSubtitle:h===o.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(L=null==D?void 0:D.category)&&void 0!==L?L:"")} • ${null!==(f=null==D?void 0:D.templateCategory)&&void 0!==f?f:""}`:"",onBackPress:()=>{null==x||x()}},{children:[e.jsx(r.default,{showVariableMapping:p,channel:h,whatsappSpecificPickerMeta:b,showVariableModal:M,variableList:T,discountCode:E,setDiscountCode:P}),C?e.jsx(i.default,{onSelect:function(){const e=null==C?void 0:C(D,V,null!=q?q:"");console.log("isChecked; ",B),console.log("discountCode; ",E),e?N(!!e):!B||E&&0!==E.trim().length?(!B&&P&&P(""),O(!0)):(N(!0),console.log("isChecked; error "))}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useEffect as o,useState as i,useMemo as a}from"react";import n from"../../utils/StringUtils.js";import{StyledModal as
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useEffect as o,useState as i,useMemo as a}from"react";import n from"../../utils/StringUtils.js";import{StyledModal as s}from"../modals/styledModal.js";import{CHANNEL_TYPE as r}from"../template-preview/models/Channels.js";import{TemplateModalContext as c}from"./context/templateModalContext.js";import d from"./modalElements/Footer.js";import m from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const h=h=>{let{selectedTemplate:g,closeDialog:u,showVariableMapping:C,channel:b,htmlContent:v,templateVariables:f,onTemplateSelect:M,globalPlaceholders:S,showOnlyContent:j,whatsappSpecificPickerMeta:k,zIndex:w,showVariableModal:P,variableList:T,discountCode:L,setDiscountCode:y,onBackPress:E}=h;var I,V;o((()=>{O(v)}),[v]);const[x,D]=i(b===r.EMAIL?"desktop":"mobile"),[A,O]=i(v),[z,B]=i(!1),[F,H]=i(g),[$,N]=i(null!=f?f:[]),[U,W]=i(!1),[_,q]=i(!1);const G=a((()=>p(S)),[S]);return e(c.Provider,Object.assign({value:{template:F,setTemplate:H,device:x,setDevice:D,display_content:A,setDisplayContent:O,originalVariableList:$,setOriginalVariableList:N,isError:z,setIsError:B,channel:b,globalNormalizedPlaceholders:G,templateSelectionTriggered:U,setTemplateSelectionTriggered:W,isChecked:_,setIsChecked:q}},{children:j?e(m,{channel:r.EMAIL,hideHeader:!0}):t(s,Object.assign({zIndex:w,centralContainerStyles:{width:b===r.EMAIL&&C?1e3:650},open:!0,onClose:()=>{null==u||u()},headingTitle:null==F?void 0:F.label,headingSubtitle:b===r.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(I=null==F?void 0:F.category)&&void 0!==I?I:"")} • ${null!==(V=null==F?void 0:F.templateCategory)&&void 0!==V?V:""}`:"",onBackPress:()=>{null==E||E()}},{children:[e(m,{showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:k,showVariableModal:P,variableList:T,discountCode:L,setDiscountCode:y}),M?e(d,{onSelect:function(){const e=null==M?void 0:M(F,$,null!=A?A:"");console.log("isChecked; ",_),console.log("discountCode; ",L),e?B(!!e):!_||L&&0!==L.trim().length?(!_&&y&&y(""),W(!0)):(B(!0),console.log("isChecked; error "))}}):e(l,{})]}))}))};export{h as TemplateContextMapper};
|