@bikdotai/bik-component-library 0.0.528-beta.0 → 0.0.528-beta.1

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.
@@ -15,4 +15,4 @@
15
15
  height: ${e=>e.isWhatsappCarousel||e.hideDeviceContainerInPreview?"500px":"475px"};
16
16
  overflow-y: auto;
17
17
  background-image: ${e=>e.hideDeviceContainerInPreview?"url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');":"none"};
18
- `;exports.default=i=>{const{showVariableMapping:m,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:j,discountCode:E,setDiscountCode:k,variableListForImage:y,showSampleValues:T}=i,L=t.useRef(),A=t.useRef(),{variableCallback:S,showVariablePicker:V,setShowVariablePicker:q,device:M,display_content:N,channel:O,template:_,setTemplate:W,isWhatsappCarousel:H,isProductCarouselType:I,hideDeviceContainerInPreview:D}=d.useTemplateModalContext();const F=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(f,{children:[e.jsx(w,Object.assign({showOnlyContent:C,showVariableMapping:m,isWhatsappCarousel:H,hideDeviceContainerInPreview:D},{children:"mobile"===M?e.jsx(b.default,{ref:A,display_content:null!=N?N:"",channel:O,template:_,showSampleValues:T}):O===r.CHANNEL_TYPE.WHATSAPP&&H?e.jsx(l.CarouselPreview,{ref:L,channel:O,template:_,showSampleValues:T,isPreview:!1}):O!==r.CHANNEL_TYPE.MESSAGE?e.jsx(c.default,{ref:L,channel:O,display_content:null!=N?N:"",showSampleValues:T}):e.jsx(e.Fragment,{})})),(I||m)&&e.jsxs(g,Object.assign({channel:O,isWhatsappCarousel:H},{children:[e.jsx("div",Object.assign({style:{width:428,display:V?"block":"none"}},{children:e.jsx(s.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>q(!1),onSelect:e=>{S(e),q(!1)},onClose:()=>{q(!1)},type:a.PickerType.EMBEDDED,data:null!=j?j:[]})})),e.jsx("div",Object.assign({style:{padding:"16px 14px",display:V?"none":"block"}},{children:O!==r.CHANNEL_TYPE.WHATSAPP?e.jsx(v.default,{onFocus:O===r.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===M?"template_html_mobile":"template_html_desktop"),o=u.getVariableNameForEmailByIndex(e+1),s=O===r.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(o):document.getElementById(o),d=F(s),c=null==s?void 0:s.offsetLeft;"desktop"===M?d&&L.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=c?c:0,d),p.highlightFor(o,n.COLORS.background.warning.light,2,O,M)):d&&A.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=c?c:0,d),p.highlightFor(o,n.COLORS.background.warning.light,2,O,M))}:void 0,showVariableModal:P,variableList:j,discountCode:E,setDiscountCode:k}):O===r.CHANNEL_TYPE.WHATSAPP&&H?e.jsx(o.default,{whatsappSpecificPickerMeta:x,template:_,showVariableModal:P,variableList:j,variableListForImage:y,discountCode:E,setDiscountCode:k}):e.jsx(h.default,{whatsappSpecificPickerMeta:x,template:_,onTemplateChange:e=>{null==W||W(e)},showVariableModal:P,variableList:j,variableListForImage:y,discountCode:E,setDiscountCode:k})}))]}))]})};
18
+ `;exports.default=i=>{const{showVariableMapping:m,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:j,discountCode:E,setDiscountCode:k,variableListForImage:y,showSampleValues:T}=i,L=t.useRef(),A=t.useRef(),{variableCallback:S,showVariablePicker:V,setShowVariablePicker:q,device:M,display_content:N,channel:O,template:_,setTemplate:W,isWhatsappCarousel:H,isProductCarouselType:I,hideDeviceContainerInPreview:D}=d.useTemplateModalContext();const F=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(f,{children:[e.jsx(w,Object.assign({showOnlyContent:C,showVariableMapping:m,isWhatsappCarousel:H,hideDeviceContainerInPreview:D},{children:"mobile"===M?e.jsx(b.default,{ref:A,display_content:null!=N?N:"",channel:O,template:_,showSampleValues:T}):O===r.CHANNEL_TYPE.WHATSAPP&&H?e.jsx(l.CarouselPreview,{ref:L,channel:O,template:_,showSampleValues:T,isPreview:!1}):O!==r.CHANNEL_TYPE.MESSAGE?e.jsx(c.default,{ref:L,channel:O,display_content:null!=N?N:"",showSampleValues:T}):e.jsx(e.Fragment,{})})),(I||m)&&e.jsxs(g,Object.assign({channel:O,isWhatsappCarousel:H},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:428,display:V?"block":"none"}},{children:e.jsx(s.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>q(!1),onSelect:e=>{S(e),q(!1)},onClose:()=>{q(!1)},type:a.PickerType.EMBEDDED,data:null!=j?j:[]})})),e.jsx("div",Object.assign({style:{padding:"16px 14px",display:V?"none":"block"}},{children:O!==r.CHANNEL_TYPE.WHATSAPP?e.jsx(v.default,{onFocus:O===r.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===M?"template_html_mobile":"template_html_desktop"),o=u.getVariableNameForEmailByIndex(e+1),s=O===r.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(o):document.getElementById(o),d=F(s),c=null==s?void 0:s.offsetLeft;"desktop"===M?d&&L.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=c?c:0,d),p.highlightFor(o,n.COLORS.background.warning.light,2,O,M)):d&&A.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=c?c:0,d),p.highlightFor(o,n.COLORS.background.warning.light,2,O,M))}:void 0,showVariableModal:P,variableList:j,discountCode:E,setDiscountCode:k}):O===r.CHANNEL_TYPE.WHATSAPP&&H?e.jsx(o.default,{whatsappSpecificPickerMeta:x,template:_,showVariableModal:P,variableList:j,variableListForImage:y,discountCode:E,setDiscountCode:k}):e.jsx(h.default,{whatsappSpecificPickerMeta:x,template:_,onTemplateChange:e=>{null==W||W(e)},showVariableModal:P,variableList:j,variableListForImage:y,discountCode:E,setDiscountCode:k})}))]}))]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/plus.svg.js"),l=require("../../assets/icons/triangle_error.svg.js"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),d=require("../input/Input.js"),h=require("../list-item/ListItem.js"),u=require("../switch/Switch.js"),b=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),g=require("./context.js"),p=require("./NoResult.js"),x=require("./recommendVaribles.js"),y=require("./searchVariables.js"),m=require("./styles.js"),O=require("./SubHeaderItems.js");const v=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const i=e.slice(0,a),l=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[i,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:l})),n]})},f=/.*\..*/,S=e=>{if(e.actualValue.match(f)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue};exports.VariablePickerContent=f=>{const{data:C,onSelect:w,showHeader:R,showBackButton:V,hideHeaderCross:k,onBackButtonClick:q,isEvaluationList:B,autoOpenFirst:T,headerText:L}=f,[I,N]=n.useState(C),[_,H]=n.useState(""),[P,E]=n.useState([]),[$,A]=n.useState(""),[F,W]=n.useState(!1),[z,D]=n.useState([]);n.useEffect((()=>{K(!0)}),[]),n.useEffect((()=>{P.length>0?D([P[P.length-1]]):D(C)}),[P]);const K=s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(W(s),s){const e=x.showOnlyRecommendedVariables(I,P);N(e)}else if(P.length>0){const e=$==P[P.length-1].displayName;if(_.length>0&&e){const e=y.searchVariables(_,z,P);N(e)}else N([P[P.length-1].variables])}else if(_.length>0){const e=y.searchVariables(_,z,P);N(e)}else N(C)})),M=()=>{let e=123;return P.length>0&&(e+=32),(f.showHeader||f.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return s.jsx(g.VariablePickerContext.Provider,Object.assign({value:{variables:I,searchText:_,subHeaderStack:P,showRecommended:F,setSubHeaderStack:E,setSearchText:H,setVariables:N,setShowRecommended:W}},{children:s.jsxs("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(R||V)&&s.jsxs(m.HeaderWrapper,{children:[s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[V&&s.jsx(c.IconButton,{Icon:()=>s.jsx(t.default,{width:16,height:16,style:{display:"flex",color:r.COLORS.content.primary}}),onClick:q}),R&&s.jsx(j.TitleRegular,{children:null!=L?L:"Select Variable"})]})),!k&&s.jsx(c.IconButton,{style:{color:"#212121"},Icon:a.default,onClick:()=>f.onClose&&f.onClose()})]}),s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:r.COLORS.surface.subdued}},{children:s.jsx(d.Input,{id:"search-bar-v3-picker",onBlur:e=>{f.onSearchBlur&&f.onSearchBlur(e)},value:_,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||A("");const s=y.searchVariables(e,z,P);if(F){const e=x.showOnlyRecommendedVariables(s,P);N(e)}else N(s);H(e);const t=P.length>0?P[P.length-1].displayName:"home";A(t)}})})),s.jsxs(m.RecommendWrapper,{children:[s.jsx(j.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(u.Switch,{value:F,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield K(s)}))})]}),P.length>0&&s.jsxs(m.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(c.IconButton,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:r.COLORS.content.secondary}}),onClick:e=>{e.stopPropagation();let s=_;const t=[...P],a=t.pop();if(E(t),a.displayName===$&&(H(""),s=""),s.length>0){const e=t.length>0?[t[t.length-1]]:C,a=y.searchVariables(s,e,t);if(F){const e=x.showOnlyRecommendedVariables(a,t);N(e)}else N(a)}else if(t.length>0)if(F){const e=x.showOnlyRecommendedVariables([t[t.length-1].variables],t);N(e)}else N([t[t.length-1].variables]);else if(F){const e=x.showOnlyRecommendedVariables(C,P);N(e)}else N(C)}})})),s.jsx(j.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:P[P.length-1].displayName}))]}),s.jsx(s.Fragment,{children:I.length>0?s.jsx(m.Container,Object.assign({height:M()},{children:I.map(((e,t)=>{var a,n;return e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${r.COLORS.stroke.primary}`}},{children:s.jsx(o.BikAccordion,Object.assign({autoOpen:T&&0===t,headerPadding:"12px 16px",header:s.jsx(j.TitleSmall,Object.assign({style:{color:r.COLORS.content.secondary}},{children:v(e.displayName,_)}))},{children:s.jsx(O.default,{parentVariable:e,disabled:null!==(a=f.disabled)&&void 0!==a&&a,searchText:_,variable:e.variables,onSelect:w})}))}),e.displayName):e.displayName?s.jsx(b.Tooltip,Object.assign({body:O.renderTooltipBody(e),placement:"bottom"},{children:s.jsx(h.ListItem,{variant:f.disabled?"inactive":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)?s.jsx(s.Fragment,{}):s.jsx(i.default,{width:14,height:14}),customListItemLabel:s.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[s.jsx(j.BodySecondary,Object.assign({style:{fontSize:"14px",color:f.disabled?r.COLORS.content.inactive:r.COLORS.text.primary}},{children:v(e.displayName,_)})),!e.isAvailable&&s.jsx(b.Tooltip,Object.assign({body:"Not Recommended"},{children:s.jsx("div",Object.assign({style:{display:"flex",marginTop:2}},{children:s.jsx(l.default,{width:16,height:16,color:r.COLORS.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!f.disabled)if(B){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}),t):s.jsx(O.default,{disabled:null!==(n=f.disabled)&&void 0!==n&&n,searchText:_,variable:e,onSelect:e=>{if(!f.disabled)if(B){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}))})):s.jsx(p.default,{height:M(),searchText:_})})]}))}))},exports.highlightSearchText=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/plus.svg.js"),l=require("../../assets/icons/triangle_error.svg.js"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),d=require("../input/Input.js"),h=require("../list-item/ListItem.js"),u=require("../switch/Switch.js"),b=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),g=require("./context.js"),p=require("./NoResult.js"),x=require("./recommendVaribles.js"),y=require("./searchVariables.js"),m=require("./styles.js"),O=require("./SubHeaderItems.js");const v=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const i=e.slice(0,a),l=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[i,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:l})),n]})},f=/.*\..*/,S=e=>{if(e.actualValue.match(f)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue};exports.VariablePickerContent=f=>{const{data:C,onSelect:w,showHeader:R,showBackButton:V,hideHeaderCross:k,onBackButtonClick:q,isEvaluationList:B,autoOpenFirst:T,headerText:L}=f,[I,N]=n.useState(C),[_,H]=n.useState(""),[P,E]=n.useState([]),[$,A]=n.useState(""),[F,W]=n.useState(!1),[z,D]=n.useState([]);n.useEffect((()=>{K(!0)}),[]),n.useEffect((()=>{P.length>0?D([P[P.length-1]]):D(C)}),[P]);const K=s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(W(s),s){const e=x.showOnlyRecommendedVariables(I,P);N(e)}else if(P.length>0){const e=$==P[P.length-1].displayName;if(_.length>0&&e){const e=y.searchVariables(_,z,P);N(e)}else N([P[P.length-1].variables])}else if(_.length>0){const e=y.searchVariables(_,z,P);N(e)}else N(C)})),M=()=>{let e=131;return P.length>0&&(e+=32),(f.showHeader||f.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return s.jsx(g.VariablePickerContext.Provider,Object.assign({value:{variables:I,searchText:_,subHeaderStack:P,showRecommended:F,setSubHeaderStack:E,setSearchText:H,setVariables:N,setShowRecommended:W}},{children:s.jsxs("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(R||V)&&s.jsxs(m.HeaderWrapper,{children:[s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[V&&s.jsx(c.IconButton,{Icon:()=>s.jsx(t.default,{width:16,height:16,style:{display:"flex",color:r.COLORS.content.primary}}),onClick:q}),R&&s.jsx(j.TitleRegular,{children:null!=L?L:"Select Variable"})]})),!k&&s.jsx(c.IconButton,{style:{color:"#212121"},Icon:a.default,onClick:()=>f.onClose&&f.onClose()})]}),s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:r.COLORS.surface.subdued}},{children:s.jsx(d.Input,{id:"search-bar-v3-picker",onBlur:e=>{f.onSearchBlur&&f.onSearchBlur(e)},value:_,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||A("");const s=y.searchVariables(e,z,P);if(F){const e=x.showOnlyRecommendedVariables(s,P);N(e)}else N(s);H(e);const t=P.length>0?P[P.length-1].displayName:"home";A(t)}})})),s.jsxs(m.RecommendWrapper,{children:[s.jsx(j.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(u.Switch,{value:F,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield K(s)}))})]}),P.length>0&&s.jsxs(m.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(c.IconButton,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:r.COLORS.content.secondary}}),onClick:e=>{e.stopPropagation();let s=_;const t=[...P],a=t.pop();if(E(t),a.displayName===$&&(H(""),s=""),s.length>0){const e=t.length>0?[t[t.length-1]]:C,a=y.searchVariables(s,e,t);if(F){const e=x.showOnlyRecommendedVariables(a,t);N(e)}else N(a)}else if(t.length>0)if(F){const e=x.showOnlyRecommendedVariables([t[t.length-1].variables],t);N(e)}else N([t[t.length-1].variables]);else if(F){const e=x.showOnlyRecommendedVariables(C,P);N(e)}else N(C)}})})),s.jsx(j.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:P[P.length-1].displayName}))]}),s.jsx(s.Fragment,{children:I.length>0?s.jsx(m.Container,Object.assign({height:M()},{children:I.map(((e,t)=>{var a,n;return e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${r.COLORS.stroke.primary}`}},{children:s.jsx(o.BikAccordion,Object.assign({autoOpen:T&&0===t,headerPadding:"12px 16px",header:s.jsx(j.TitleSmall,Object.assign({style:{color:r.COLORS.content.secondary}},{children:v(e.displayName,_)}))},{children:s.jsx(O.default,{parentVariable:e,disabled:null!==(a=f.disabled)&&void 0!==a&&a,searchText:_,variable:e.variables,onSelect:w})}))}),e.displayName):e.displayName?s.jsx(b.Tooltip,Object.assign({body:O.renderTooltipBody(e),placement:"bottom"},{children:s.jsx(h.ListItem,{variant:f.disabled?"inactive":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)?s.jsx(s.Fragment,{}):s.jsx(i.default,{width:14,height:14}),customListItemLabel:s.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[s.jsx(j.BodySecondary,Object.assign({style:{fontSize:"14px",color:f.disabled?r.COLORS.content.inactive:r.COLORS.text.primary}},{children:v(e.displayName,_)})),!e.isAvailable&&s.jsx(b.Tooltip,Object.assign({body:"Not Recommended"},{children:s.jsx("div",Object.assign({style:{display:"flex",marginTop:2}},{children:s.jsx(l.default,{width:16,height:16,color:r.COLORS.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!f.disabled)if(B){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}),t):s.jsx(O.default,{disabled:null!==(n=f.disabled)&&void 0!==n&&n,searchText:_,variable:e,onSelect:e=>{if(!f.disabled)if(B){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}))})):s.jsx(p.default,{height:M(),searchText:_})})]}))}))},exports.highlightSearchText=v;
@@ -15,4 +15,4 @@ import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import"../../cur
15
15
  height: ${e=>e.isWhatsappCarousel||e.hideDeviceContainerInPreview?"500px":"475px"};
16
16
  overflow-y: auto;
17
17
  background-image: ${e=>e.hideDeviceContainerInPreview?"url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');":"none"};
18
- `,P=l=>{const{showVariableMapping:P,showOnlyContent:k,whatsappSpecificPickerMeta:y,showVariableModal:x,variableList:j,discountCode:V,setDiscountCode:M,variableListForImage:S,showSampleValues:W}=l,A=a(),E=a(),{variableCallback:T,showVariablePicker:D,setShowVariablePicker:I,device:L,display_content:B,channel:H,template:O,setTemplate:$,isWhatsappCarousel:_,isProductCarouselType:F,hideDeviceContainerInPreview:G}=c();const N=e=>{let o=0;for(;e;)o+=e.offsetTop,e=e.offsetParent;return o};return e(w,{children:[o(C,Object.assign({showOnlyContent:k,showVariableMapping:P,isWhatsappCarousel:_,hideDeviceContainerInPreview:G},{children:"mobile"===L?o(v,{ref:E,display_content:null!=B?B:"",channel:H,template:O,showSampleValues:W}):H===s.WHATSAPP&&_?o(r,{ref:A,channel:H,template:O,showSampleValues:W,isPreview:!1}):H!==s.MESSAGE?o(u,{ref:A,channel:H,display_content:null!=B?B:"",showSampleValues:W}):o(t,{})})),(F||P)&&e(g,Object.assign({channel:H,isWhatsappCarousel:_},{children:[o("div",Object.assign({style:{width:428,display:D?"block":"none"}},{children:o(p,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>I(!1),onSelect:e=>{T(e),I(!1)},onClose:()=>{I(!1)},type:i.EMBEDDED,data:null!=j?j:[]})})),o("div",Object.assign({style:{padding:"16px 14px",display:D?"none":"block"}},{children:H!==s.WHATSAPP?o(f,{onFocus:H===s.EMAIL?function(e){var o,t,i;const a=null===document||void 0===document?void 0:document.getElementById("mobile"===L?"template_html_mobile":"template_html_desktop"),l=m(e+1),r=H===s.EMAIL?null===(o=null==a?void 0:a.contentWindow)||void 0===o?void 0:o.document.getElementById(l):document.getElementById(l),n=N(r),p=null==r?void 0:r.offsetLeft;"desktop"===L?n&&A.current&&(null===(t=null==a?void 0:a.contentWindow)||void 0===t||t.scrollTo(null!=p?p:0,n),h(l,d.background.warning.light,2,H,L)):n&&E.current&&(null===(i=null==a?void 0:a.contentWindow)||void 0===i||i.scrollTo(null!=p?p:0,n),h(l,d.background.warning.light,2,H,L))}:void 0,showVariableModal:x,variableList:j,discountCode:V,setDiscountCode:M}):H===s.WHATSAPP&&_?o(n,{whatsappSpecificPickerMeta:y,template:O,showVariableModal:x,variableList:j,variableListForImage:S,discountCode:V,setDiscountCode:M}):o(b,{whatsappSpecificPickerMeta:y,template:O,onTemplateChange:e=>{null==$||$(e)},showVariableModal:x,variableList:j,variableListForImage:S,discountCode:V,setDiscountCode:M})}))]}))]})};export{P as default};
18
+ `,P=l=>{const{showVariableMapping:P,showOnlyContent:k,whatsappSpecificPickerMeta:y,showVariableModal:x,variableList:j,discountCode:V,setDiscountCode:M,variableListForImage:S,showSampleValues:W}=l,A=a(),E=a(),{variableCallback:T,showVariablePicker:D,setShowVariablePicker:I,device:L,display_content:B,channel:H,template:O,setTemplate:$,isWhatsappCarousel:_,isProductCarouselType:F,hideDeviceContainerInPreview:G}=c();const N=e=>{let o=0;for(;e;)o+=e.offsetTop,e=e.offsetParent;return o};return e(w,{children:[o(C,Object.assign({showOnlyContent:k,showVariableMapping:P,isWhatsappCarousel:_,hideDeviceContainerInPreview:G},{children:"mobile"===L?o(v,{ref:E,display_content:null!=B?B:"",channel:H,template:O,showSampleValues:W}):H===s.WHATSAPP&&_?o(r,{ref:A,channel:H,template:O,showSampleValues:W,isPreview:!1}):H!==s.MESSAGE?o(u,{ref:A,channel:H,display_content:null!=B?B:"",showSampleValues:W}):o(t,{})})),(F||P)&&e(g,Object.assign({channel:H,isWhatsappCarousel:_},{children:[o("div",Object.assign({style:{height:"100%",width:428,display:D?"block":"none"}},{children:o(p,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>I(!1),onSelect:e=>{T(e),I(!1)},onClose:()=>{I(!1)},type:i.EMBEDDED,data:null!=j?j:[]})})),o("div",Object.assign({style:{padding:"16px 14px",display:D?"none":"block"}},{children:H!==s.WHATSAPP?o(f,{onFocus:H===s.EMAIL?function(e){var o,t,i;const a=null===document||void 0===document?void 0:document.getElementById("mobile"===L?"template_html_mobile":"template_html_desktop"),l=m(e+1),r=H===s.EMAIL?null===(o=null==a?void 0:a.contentWindow)||void 0===o?void 0:o.document.getElementById(l):document.getElementById(l),n=N(r),p=null==r?void 0:r.offsetLeft;"desktop"===L?n&&A.current&&(null===(t=null==a?void 0:a.contentWindow)||void 0===t||t.scrollTo(null!=p?p:0,n),h(l,d.background.warning.light,2,H,L)):n&&E.current&&(null===(i=null==a?void 0:a.contentWindow)||void 0===i||i.scrollTo(null!=p?p:0,n),h(l,d.background.warning.light,2,H,L))}:void 0,showVariableModal:x,variableList:j,discountCode:V,setDiscountCode:M}):H===s.WHATSAPP&&_?o(n,{whatsappSpecificPickerMeta:y,template:O,showVariableModal:x,variableList:j,variableListForImage:S,discountCode:V,setDiscountCode:M}):o(b,{whatsappSpecificPickerMeta:y,template:O,onTemplateChange:e=>{null==$||$(e)},showVariableModal:x,variableList:j,variableListForImage:S,discountCode:V,setDiscountCode:M})}))]}))]})};export{P as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{ListItem as g}from"../list-item/ListItem.js";import{Switch as b}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as y,BodyCaption as v,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as x}from"./context.js";import O from"./NoResult.js";import{showOnlyRecommendedVariables as w}from"./recommendVaribles.js";import{searchVariables as k}from"./searchVariables.js";import{HeaderWrapper as C,RecommendWrapper as S,BackHeader as N,Container as T}from"./styles.js";import V,{renderTooltipBody as I}from"./SubHeaderItems.js";const B=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const l=e.slice(0,o),a=e.slice(o,o+i.length),n=e.slice(o+i.length);return s("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},H=/.*\..*/,L=e=>{if(e.actualValue.match(H)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},R=H=>{const{data:R,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D,headerText:F}=H,[K,q]=r(R),[G,J]=r(""),[M,Q]=r([]),[U,W]=r(""),[X,Y]=r(!1),[Z,ee]=r([]);c((()=>{te(!0)}),[]),c((()=>{M.length>0?ee([M[M.length-1]]):ee(R)}),[M]);const te=t=>e(void 0,void 0,void 0,(function*(){if(Y(t),t){const e=w(K,M);q(e)}else if(M.length>0){const e=U==M[M.length-1].displayName;if(G.length>0&&e){const e=k(G,Z,M);q(e)}else q([M[M.length-1].variables])}else if(G.length>0){const e=k(G,Z,M);q(e)}else q(R)})),se=()=>{let e=123;return M.length>0&&(e+=32),(H.showHeader||H.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(x.Provider,Object.assign({value:{variables:K,searchText:G,subHeaderStack:M,showRecommended:X,setSubHeaderStack:Q,setSearchText:J,setVariables:q,setShowRecommended:Y}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(E||P)&&s(C,{children:[s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[P&&t(m,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:A}),E&&t(f,{children:null!=F?F:"Select Variable"})]})),!_&&t(m,{style:{color:"#212121"},Icon:l,onClick:()=>H.onClose&&H.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{H.onSearchBlur&&H.onSearchBlur(e)},value:G,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||W("");const t=k(e,Z,M);if(X){const e=w(t,M);q(e)}else q(t);J(e);const s=M.length>0?M[M.length-1].displayName:"home";W(s)}})})),s(S,{children:[t(y,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(b,{value:X,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield te(t)}))})]}),M.length>0&&s(N,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(m,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:d.content.secondary}}),onClick:e=>{e.stopPropagation();let t=G;const s=[...M],i=s.pop();if(Q(s),i.displayName===U&&(J(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:R,i=k(t,e,s);if(X){const e=w(i,s);q(e)}else q(i)}else if(s.length>0)if(X){const e=w([s[s.length-1].variables],s);q(e)}else q([s[s.length-1].variables]);else if(X){const e=w(R,M);q(e)}else q(R)}})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:M[M.length-1].displayName}))]}),t(i,{children:K.length>0?t(T,Object.assign({height:se()},{children:K.map(((e,o)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:D&&0===o,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:B(e.displayName,G)}))},{children:t(V,{parentVariable:e,disabled:null!==(l=H.disabled)&&void 0!==l&&l,searchText:G,variable:e.variables,onSelect:$})}))}),e.displayName):e.displayName?t(u,Object.assign({body:I(e),placement:"bottom"},{children:t(g,{variant:H.disabled?"inactive":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)?t(i,{}):t(a,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(y,Object.assign({style:{fontSize:"14px",color:H.disabled?d.content.inactive:d.text.primary}},{children:B(e.displayName,G)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex",marginTop:2}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(V,{disabled:null!==(r=H.disabled)&&void 0!==r&&r,searchText:G,variable:e,onSelect:e=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(O,{height:se(),searchText:G})})]}))}))};export{R as VariablePickerContent,B as highlightSearchText};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{ListItem as g}from"../list-item/ListItem.js";import{Switch as b}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as y,BodyCaption as v,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as x}from"./context.js";import O from"./NoResult.js";import{showOnlyRecommendedVariables as w}from"./recommendVaribles.js";import{searchVariables as k}from"./searchVariables.js";import{HeaderWrapper as C,RecommendWrapper as S,BackHeader as N,Container as T}from"./styles.js";import V,{renderTooltipBody as I}from"./SubHeaderItems.js";const B=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const l=e.slice(0,o),a=e.slice(o,o+i.length),n=e.slice(o+i.length);return s("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},H=/.*\..*/,L=e=>{if(e.actualValue.match(H)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},R=H=>{const{data:R,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D,headerText:F}=H,[K,q]=r(R),[G,J]=r(""),[M,Q]=r([]),[U,W]=r(""),[X,Y]=r(!1),[Z,ee]=r([]);c((()=>{te(!0)}),[]),c((()=>{M.length>0?ee([M[M.length-1]]):ee(R)}),[M]);const te=t=>e(void 0,void 0,void 0,(function*(){if(Y(t),t){const e=w(K,M);q(e)}else if(M.length>0){const e=U==M[M.length-1].displayName;if(G.length>0&&e){const e=k(G,Z,M);q(e)}else q([M[M.length-1].variables])}else if(G.length>0){const e=k(G,Z,M);q(e)}else q(R)})),se=()=>{let e=131;return M.length>0&&(e+=32),(H.showHeader||H.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(x.Provider,Object.assign({value:{variables:K,searchText:G,subHeaderStack:M,showRecommended:X,setSubHeaderStack:Q,setSearchText:J,setVariables:q,setShowRecommended:Y}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%"},onClick:e=>e.stopPropagation()},{children:[(E||P)&&s(C,{children:[s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[P&&t(m,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:A}),E&&t(f,{children:null!=F?F:"Select Variable"})]})),!_&&t(m,{style:{color:"#212121"},Icon:l,onClick:()=>H.onClose&&H.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{H.onSearchBlur&&H.onSearchBlur(e)},value:G,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||W("");const t=k(e,Z,M);if(X){const e=w(t,M);q(e)}else q(t);J(e);const s=M.length>0?M[M.length-1].displayName:"home";W(s)}})})),s(S,{children:[t(y,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(b,{value:X,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield te(t)}))})]}),M.length>0&&s(N,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(m,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:d.content.secondary}}),onClick:e=>{e.stopPropagation();let t=G;const s=[...M],i=s.pop();if(Q(s),i.displayName===U&&(J(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:R,i=k(t,e,s);if(X){const e=w(i,s);q(e)}else q(i)}else if(s.length>0)if(X){const e=w([s[s.length-1].variables],s);q(e)}else q([s[s.length-1].variables]);else if(X){const e=w(R,M);q(e)}else q(R)}})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:M[M.length-1].displayName}))]}),t(i,{children:K.length>0?t(T,Object.assign({height:se()},{children:K.map(((e,o)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:D&&0===o,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:B(e.displayName,G)}))},{children:t(V,{parentVariable:e,disabled:null!==(l=H.disabled)&&void 0!==l&&l,searchText:G,variable:e.variables,onSelect:$})}))}),e.displayName):e.displayName?t(u,Object.assign({body:I(e),placement:"bottom"},{children:t(g,{variant:H.disabled?"inactive":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)?t(i,{}):t(a,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(y,Object.assign({style:{fontSize:"14px",color:H.disabled?d.content.inactive:d.text.primary}},{children:B(e.displayName,G)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex",marginTop:2}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(V,{disabled:null!==(r=H.disabled)&&void 0!==r&&r,searchText:G,variable:e,onSelect:e=>{if(!H.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(O,{height:se(),searchText:G})})]}))}))};export{R as VariablePickerContent,B as highlightSearchText};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.528-beta.0",
3
+ "version": "0.0.528-beta.1",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",