@bikdotai/bik-component-library 0.0.286 → 0.0.288

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.
@@ -4,4 +4,4 @@
4
4
  background: ${e=>e.focused&&e.channel===s.CHANNEL_TYPE.EMAIL?c.COLORS.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,x={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"};exports.Container=g,exports.default=a=>{let{onFocus:b,variable:_,index:h,showVariableModal:j,variableList:A}=a;var N;const[P,T]=t.useState(!1),[y,C]=t.useState(""),[L,f]=t.useState([]),[O,S]=t.useState(),[k,V]=t.useState(!1),{device:H,channel:M,isError:q,originalVariableList:w,template:I,templateSelectionTriggered:Y,setTemplate:W,setDisplayContent:B,setOriginalVariableList:R,globalNormalizedPlaceholders:U}=v.useTemplateModalContext();function $(e,l){var t,a,n;const i=e;C(""),S(i),M===s.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(D(null!==(t=i.value)&&void 0!==t?t:"","string"),null==z||z(null!==(a=_.index)&&void 0!==a?a:0,`[[${i.value}]]`)):(null==z||z(null!==(n=_.index)&&void 0!==n?n:0,_.variableName),D("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?D(i.value,"url"===i.bikPlaceholderType?"link":"string"):(C(""),D("",i.value))}function D(e,l){var t,a;const n="custom_link"===l?"link":"custom_text"===l?"string":l;if(M!==s.CHANNEL_TYPE.WHATSAPP){const a=p.getVariableNameForEmailByIndex(h+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===H?"template_html_mobile":"template_html_desktop"),o=M===s.CHANNEL_TYPE.EMAIL?null===(t=null==i?void 0:i.contentWindow)||void 0===t?void 0:t.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==l&&"custom_link"!==l||e?e:_.variableName);const u=w.map(((l,t)=>t===h?Object.assign(Object.assign({},l),{type:n,updatedValue:e}):l));null==R||R(u)}if(M===s.CHANNEL_TYPE.WHATSAPP){const l=null===(a=w.body)||void 0===a?void 0:a.map(((l,t)=>t===h?Object.assign(Object.assign({},l),{type:n,updatedValue:e}):l));null==R||R((e=>Object.assign(Object.assign({},e),{body:l,buttons:w.buttons})))}}function z(e,l){var t;const a=Object.assign({},I),n=null===(t=null==a?void 0:a.components)||void 0===t?void 0:t.map((t=>{var a,n,i,o,u;const s=Object.assign({},t);if("BODY"===t.type&&(null===(n=null===(a=t.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0])){const t=[...null!==(u=null===(o=null===(i=s.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[t]});return Object.assign(Object.assign({},s),{example:a})}return t}));a.components=n,null==W||W(a)}return t.useEffect((()=>{P&&(null==b||b())}),[P]),t.useEffect((()=>{!function(){var e,l,t,a,n;const i="mobile"===H?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),u=(null!==(a=null===(t=null===(l=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===l?void 0:l.body)||void 0===t?void 0:t.innerHTML)&&void 0!==a?a:"")+(null===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);M===s.CHANNEL_TYPE.EMAIL&&(null==B||B(u))}()}),[Y]),t.useEffect((()=>{var e;const l=[];let t=[];if(M===s.CHANNEL_TYPE.MESSAGE){const e=null!=U?U:[];f([{label:"",options:[E,x]},...e]),t=[{label:"",options:[E,x]},...e]}else{"link"===(null==_?void 0:_.type)?(l.push({label:"",options:[x,E]}),S(x)):(l.push({label:"",options:[x,E]}),S(E));const e=null!=U?U:[];f([...l,...e.map((e=>{var l,t;return Object.assign(Object.assign({},e),{label:d.default.toCapitilize(null===(t=null===(l=e.label)||void 0===l?void 0:l.replace(/([A-Z])/g," $1"))||void 0===t?void 0:t.toLowerCase())})}))]),t=[...l,...e]}if((M===s.CHANNEL_TYPE.WHATSAPP||M===s.CHANNEL_TYPE.EMAIL||M===s.CHANNEL_TYPE.MESSAGE)&&_.updatedValue)if(u.placeHolderNamePattern.test(_.updatedValue)&&M===s.CHANNEL_TYPE.WHATSAPP||_.updatedValue.startsWith("{{")&&M!==s.CHANNEL_TYPE.WHATSAPP){const e=function(e,l,t){var a;let n={label:"",value:""};const i=t===s.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");j?n={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}:l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(_,t,M);e.value&&S(e)}else(null===(e=_.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(S(x),C(_.updatedValue.split("https://")[1])):(S(E),C(_.updatedValue))}),[]),e.jsxs(g,Object.assign({channel:M,focused:P,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:q&&!O?c.COLORS.content.negative:c.COLORS.content.primary}},{children:[null===(N=_.variableName)||void 0===N?void 0:N.replace("{{","").replace("}}","")," ","link"===(null==_?void 0:_.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:j?e.jsx(o.Input,{state:"none",value:O?O.label:"Custom text",onChangeText:()=>{},rightIcon:{icon:()=>e.jsx(l.default,{onClick:()=>{V(!k)},width:24,height:24,color:c.COLORS.content.primary})}}):e.jsx(i.Dropdown,{options:L,isSearchable:!1,onSelect:$,defaultOptions:O?[Object.assign(Object.assign({},O),{selected:!0})]:[]})})),("custom_text"===(null==O?void 0:O.value)||"custom_link"===(null==O?void 0:O.value))&&e.jsx(o.Input,{labelText:"custom_text"===(null==O?void 0:O.value)?"Custom text value":"custom_link"===(null==O?void 0:O.value)?"Custom URL value":"",id:`variable-value-${null==O?void 0:O.value}-${h}`,value:y,errorMessage:q?y?"custom_link"!==O.value||m.validateIsUrl(y)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==O?void 0:O.value)?void 0:30,prefixText:"custom_link"===(null==O?void 0:O.value)?"https://":"",placeholder:"link"===_.type||"custom_link"===O.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;C(l);const a="custom_link"===(null==O?void 0:O.value)?`https://${l}`:l;D(a,e),M===s.CHANNEL_TYPE.WHATSAPP&&(null==z||z(null!==(t=_.index)&&void 0!==t?t:0,a))}(O.value,e)}),k&&e.jsx(n.AddVariableV2SideModal,{data:null!=A?A:[],showVariable:k,setShowVariable:V,placeholder:"Add a variable",customTrigger:e=>{"{{custom.url}}"===e.actualValue?$({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?$({label:e.displayName,selected:!0,value:"custom_text"}):$({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
7
+ `,x={value:"custom_link",label:"Custom URL"},E={value:"custom_text",label:"Custom text"};exports.Container=g,exports.default=a=>{let{onFocus:b,variable:_,index:h,showVariableModal:j,variableList:A}=a;var N;const[P,T]=t.useState(!1),[y,C]=t.useState(""),[L,f]=t.useState([]),[O,S]=t.useState(),[k,V]=t.useState(!1),{device:H,channel:M,isError:q,originalVariableList:I,template:w,templateSelectionTriggered:Y,setTemplate:W,setDisplayContent:B,setOriginalVariableList:R,globalNormalizedPlaceholders:U}=v.useTemplateModalContext();function $(e,l){var t,a,n;const i=e;C(""),S(i),M===s.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(D(null!==(t=i.value)&&void 0!==t?t:"","string"),null==z||z(null!==(a=_.index)&&void 0!==a?a:0,`[[${i.value}]]`)):(null==z||z(null!==(n=_.index)&&void 0!==n?n:0,_.variableName),D("","url"===i.bikPlaceholderType?"link":"string")):"custom_text"!==i.value&&"custom_link"!==i.value?D(i.value,"url"===i.bikPlaceholderType?"link":"string"):(C(""),D("",i.value))}function D(e,l){var t,a;const n="custom_link"===l?"link":"custom_text"===l?"string":l;if(M!==s.CHANNEL_TYPE.WHATSAPP){const a=p.getVariableNameForEmailByIndex(h+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===H?"template_html_mobile":"template_html_desktop"),o=M===s.CHANNEL_TYPE.EMAIL?null===(t=null==i?void 0:i.contentWindow)||void 0===t?void 0:t.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==l&&"custom_link"!==l||e?e:_.variableName);const u=I.map(((l,t)=>t===h?Object.assign(Object.assign({},l),{type:n,updatedValue:e}):l));null==R||R(u)}if(M===s.CHANNEL_TYPE.WHATSAPP){const l=null===(a=I.body)||void 0===a?void 0:a.map(((l,t)=>t===h?Object.assign(Object.assign({},l),{type:n,updatedValue:e}):l));null==R||R((e=>Object.assign(Object.assign({},e),{body:l,buttons:I.buttons})))}}function z(e,l){var t;const a=Object.assign({},w),n=null===(t=null==a?void 0:a.components)||void 0===t?void 0:t.map((t=>{var a,n,i,o,u;const s=Object.assign({},t);if("BODY"===t.type&&(null===(n=null===(a=t.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0])){const t=[...null!==(u=null===(o=null===(i=s.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==u?u:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[t]});return Object.assign(Object.assign({},s),{example:a})}return t}));a.components=n,null==W||W(a)}return t.useEffect((()=>{P&&(null==b||b())}),[P]),t.useEffect((()=>{!function(){var e,l,t,a,n;const i="mobile"===H?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),u=(null!==(a=null===(t=null===(l=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===l?void 0:l.body)||void 0===t?void 0:t.innerHTML)&&void 0!==a?a:"")+(null===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);M===s.CHANNEL_TYPE.EMAIL&&(null==B||B(u))}()}),[Y]),t.useEffect((()=>{var e;const l=[];let t=[];if(M===s.CHANNEL_TYPE.MESSAGE){const e=null!=U?U:[];f([{label:"",options:[E,x]},...e]),t=[{label:"",options:[E,x]},...e]}else{"link"===(null==_?void 0:_.type)?(l.push({label:"",options:[x,E]}),S(x)):(l.push({label:"",options:[x,E]}),S(E));const e=null!=U?U:[];f([...l,...e.map((e=>{var l,t;return Object.assign(Object.assign({},e),{label:d.default.toCapitilize(null===(t=null===(l=e.label)||void 0===l?void 0:l.replace(/([A-Z])/g," $1"))||void 0===t?void 0:t.toLowerCase())})}))]),t=[...l,...e]}if((M===s.CHANNEL_TYPE.WHATSAPP||M===s.CHANNEL_TYPE.EMAIL||M===s.CHANNEL_TYPE.MESSAGE)&&_.updatedValue)if(u.placeHolderNamePattern.test(_.updatedValue)&&M===s.CHANNEL_TYPE.WHATSAPP||_.updatedValue.startsWith("{{")&&M!==s.CHANNEL_TYPE.WHATSAPP){const e=function(e,l,t){var a;let n={label:"",value:""};const i=t===s.CHANNEL_TYPE.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");j?n={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}:l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===i.trim()&&(n=e)}))}));return n}(_,t,M);e.value&&S(e)}else(null===(e=_.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(S(x),C(_.updatedValue.split("https://")[1])):(S(E),C(_.updatedValue))}),[]),e.jsxs(g,Object.assign({channel:M,focused:P,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1)},{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:q&&!O?c.COLORS.content.negative:c.COLORS.content.primary}},{children:[null===(N=_.variableName)||void 0===N?void 0:N.replace("{{","").replace("}}","")," ","link"===(null==_?void 0:_.type)?"link":"variable"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:j?e.jsx(o.Input,{state:"none",value:O?O.label:"Custom text",onChangeText:()=>{},rightIcon:{icon:()=>e.jsx(l.default,{onClick:()=>{V(!k)},width:24,height:24,color:c.COLORS.content.primary})}}):e.jsx(i.Dropdown,{options:L,isSearchable:!1,onSelect:$,defaultOptions:O?[Object.assign(Object.assign({},O),{selected:!0})]:[]})})),("custom_text"===(null==O?void 0:O.value)||"custom_link"===(null==O?void 0:O.value))&&e.jsx(o.Input,{labelText:"custom_text"===(null==O?void 0:O.value)?"Custom text value":"custom_link"===(null==O?void 0:O.value)?"Custom URL value":"",id:`variable-value-${null==O?void 0:O.value}-${h}`,value:y,errorMessage:q?y?"custom_link"!==O.value||m.validateIsUrl(y)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==O?void 0:O.value)?void 0:30,prefixText:"custom_link"===(null==O?void 0:O.value)?"https://":"",placeholder:"link"===_.type||"custom_link"===O.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;C(l);const a="custom_link"===(null==O?void 0:O.value)?`https://${l}`:l;D(a,e),M===s.CHANNEL_TYPE.WHATSAPP&&(null==z||z(null!==(t=_.index)&&void 0!==t?t:0,a))}(O.value,e)}),k&&e.jsx(n.AddVariableV2SideModal,{zIndex:2e3,data:null!=A?A:[],showVariable:k,setShowVariable:V,placeholder:"Add a variable",customTrigger:e=>{"{{custom.url}}"===e.actualValue?$({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?$({label:e.displayName,selected:!0,value:"custom_text"}):$({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
@@ -7,5 +7,6 @@ export interface TooltipProps extends TooltipInternalProps {
7
7
  children: ReactNode;
8
8
  tooltipContent?: JSX.Element;
9
9
  alwaysVisible?: boolean;
10
+ hideArrow?: boolean;
10
11
  }
11
12
  export declare const Tooltip: FunctionComponent<TooltipProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("@tippyjs/react"),n=require("react"),r=require("./TooltipInternal.js"),i=require("../../constants/Theme.js");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=o(e),l=o(n);const p=`\n\t.tippy-content {\n\t\tpadding: 0px;\n\t}\n\t.tippy-arrow {\n\t\tcolor: ${t=>i.COLORS.content.primary};\n\t}\n\t.overflow-wrap-tippy {\n\t\toverflow-wrap: anywhere;\n\t}\n`;exports.Tooltip=e=>l.default.isValidElement(e.children)?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:p}),t.jsx(a.default,Object.assign({appendTo:document.body,className:"overflow-wrap-tippy",placement:e.placement||"right",maxWidth:e.width,animation:"fade",arrow:!0,interactive:!0,delay:e.delay,visible:e.alwaysVisible,content:e.tooltipContent?e.tooltipContent:t.jsx(r.default,{title:e.title,body:e.body,buttonProps:e.buttonProps})},{children:e.children}))]}):null;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("@tippyjs/react"),n=require("react"),r=require("./TooltipInternal.js"),i=require("../../constants/Theme.js");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=o(e),l=o(n);const p=`\n\t.tippy-content {\n\t\tpadding: 0px;\n\t}\n\t.tippy-arrow {\n\t\tcolor: ${t=>i.COLORS.content.primary};\n\t}\n\t.overflow-wrap-tippy {\n\t\toverflow-wrap: anywhere;\n\t}\n`;exports.Tooltip=e=>{var n;return l.default.isValidElement(e.children)?t.jsxs(t.Fragment,{children:[t.jsx("style",{children:p}),t.jsx(a.default,Object.assign({appendTo:document.body,className:"overflow-wrap-tippy",placement:e.placement||"right",maxWidth:e.width,animation:"fade",arrow:null===(n=!e.hideArrow)||void 0===n||n,interactive:!0,delay:e.delay,visible:e.alwaysVisible,content:e.tooltipContent?e.tooltipContent:t.jsx(r.default,{title:e.title,body:e.body,buttonProps:e.buttonProps})},{children:e.children}))]}):null};
@@ -4,4 +4,4 @@ import{jsxs as e,jsx as l}from"react/jsx-runtime";import t from"../../../assets/
4
4
  background: ${e=>e.focused&&e.channel===d.EMAIL?v.background.warning.light:"transparent"};
5
5
  border-radius: 4px;
6
6
  padding: 8px 10px;
7
- `,x={value:"custom_link",label:"Custom URL"},f={value:"custom_text",label:"Custom text"},j=n=>{let{onFocus:j,variable:_,index:y,showVariableModal:k,variableList:V}=n;var A;const[O,T]=a(!1),[P,S]=a(""),[E,L]=a([]),[C,w]=a(),[M,W]=a(!1),{device:I,channel:H,isError:B,originalVariableList:N,template:$,templateSelectionTriggered:U,setTemplate:R,setDisplayContent:D,setOriginalVariableList:z,globalNormalizedPlaceholders:G}=p();function q(e,l){var t,a,o;const n=e;S(""),w(n),H===d.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value?(F(null!==(t=n.value)&&void 0!==t?t:"","string"),null==Y||Y(null!==(a=_.index)&&void 0!==a?a:0,`[[${n.value}]]`)):(null==Y||Y(null!==(o=_.index)&&void 0!==o?o:0,_.variableName),F("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?F(n.value,"url"===n.bikPlaceholderType?"link":"string"):(S(""),F("",n.value))}function F(e,l){var t,a;const o="custom_link"===l?"link":"custom_text"===l?"string":l;if(H!==d.WHATSAPP){const a=b(y+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===I?"template_html_mobile":"template_html_desktop"),i=H===d.EMAIL?null===(t=null==n?void 0:n.contentWindow)||void 0===t?void 0:t.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==l&&"custom_link"!==l||e?e:_.variableName);const u=N.map(((l,t)=>t===y?Object.assign(Object.assign({},l),{type:o,updatedValue:e}):l));null==z||z(u)}if(H===d.WHATSAPP){const l=null===(a=N.body)||void 0===a?void 0:a.map(((l,t)=>t===y?Object.assign(Object.assign({},l),{type:o,updatedValue:e}):l));null==z||z((e=>Object.assign(Object.assign({},e),{body:l,buttons:N.buttons})))}}function Y(e,l){var t;const a=Object.assign({},$),o=null===(t=null==a?void 0:a.components)||void 0===t?void 0:t.map((t=>{var a,o,n,i,u;const s=Object.assign({},t);if("BODY"===t.type&&(null===(o=null===(a=t.example)||void 0===a?void 0:a.body_text)||void 0===o?void 0:o[0])){const t=[...null!==(u=null===(i=null===(n=s.example)||void 0===n?void 0:n.body_text)||void 0===i?void 0:i[0])&&void 0!==u?u:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[t]});return Object.assign(Object.assign({},s),{example:a})}return t}));a.components=o,null==R||R(a)}return o((()=>{O&&(null==j||j())}),[O]),o((()=>{!function(){var e,l,t,a,o;const n="mobile"===I?"template_html_mobile":"template_html_desktop",i=document.getElementById(n),u=(null!==(a=null===(t=null===(l=null===(e=null==i?void 0:i.contentWindow)||void 0===e?void 0:e.document)||void 0===l?void 0:l.body)||void 0===t?void 0:t.innerHTML)&&void 0!==a?a:"")+(null===(o=null==i?void 0:i.contentWindow)||void 0===o?void 0:o.document.head.innerHTML);H===d.EMAIL&&(null==D||D(u))}()}),[U]),o((()=>{var e;const l=[];let t=[];if(H===d.MESSAGE){const e=null!=G?G:[];L([{label:"",options:[f,x]},...e]),t=[{label:"",options:[f,x]},...e]}else{"link"===(null==_?void 0:_.type)?(l.push({label:"",options:[x,f]}),w(x)):(l.push({label:"",options:[x,f]}),w(f));const e=null!=G?G:[];L([...l,...e.map((e=>{var l,t;return Object.assign(Object.assign({},e),{label:m.toCapitilize(null===(t=null===(l=e.label)||void 0===l?void 0:l.replace(/([A-Z])/g," $1"))||void 0===t?void 0:t.toLowerCase())})}))]),t=[...l,...e]}if((H===d.WHATSAPP||H===d.EMAIL||H===d.MESSAGE)&&_.updatedValue)if(r.test(_.updatedValue)&&H===d.WHATSAPP||_.updatedValue.startsWith("{{")&&H!==d.WHATSAPP){const e=function(e,l,t){var a;let o={label:"",value:""};const n=t===d.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");k?o={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}:l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===n.trim()&&(o=e)}))}));return o}(_,t,H);e.value&&w(e)}else(null===(e=_.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(w(x),S(_.updatedValue.split("https://")[1])):(w(f),S(_.updatedValue))}),[]),e(h,Object.assign({channel:H,focused:O,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1)},{children:[l("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:B&&!C?v.content.negative:v.content.primary}},{children:[null===(A=_.variableName)||void 0===A?void 0:A.replace("{{","").replace("}}","")," ","link"===(null==_?void 0:_.type)?"link":"variable"]}))})),l("div",Object.assign({style:{marginBottom:12}},{children:k?l(s,{state:"none",value:C?C.label:"Custom text",onChangeText:()=>{},rightIcon:{icon:()=>l(t,{onClick:()=>{W(!M)},width:24,height:24,color:v.content.primary})}}):l(u,{options:E,isSearchable:!1,onSelect:q,defaultOptions:C?[Object.assign(Object.assign({},C),{selected:!0})]:[]})})),("custom_text"===(null==C?void 0:C.value)||"custom_link"===(null==C?void 0:C.value))&&l(s,{labelText:"custom_text"===(null==C?void 0:C.value)?"Custom text value":"custom_link"===(null==C?void 0:C.value)?"Custom URL value":"",id:`variable-value-${null==C?void 0:C.value}-${y}`,value:P,errorMessage:B?P?"custom_link"!==C.value||g(P)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==C?void 0:C.value)?void 0:30,prefixText:"custom_link"===(null==C?void 0:C.value)?"https://":"",placeholder:"link"===_.type||"custom_link"===C.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;S(l);const a="custom_link"===(null==C?void 0:C.value)?`https://${l}`:l;F(a,e),H===d.WHATSAPP&&(null==Y||Y(null!==(t=_.index)&&void 0!==t?t:0,a))}(C.value,e)}),M&&l(i,{data:null!=V?V:[],showVariable:M,setShowVariable:W,placeholder:"Add a variable",customTrigger:e=>{"{{custom.url}}"===e.actualValue?q({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?q({label:e.displayName,selected:!0,value:"custom_text"}):q({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{h as Container,j as default};
7
+ `,x={value:"custom_link",label:"Custom URL"},f={value:"custom_text",label:"Custom text"},j=n=>{let{onFocus:j,variable:_,index:y,showVariableModal:k,variableList:V}=n;var A;const[O,T]=a(!1),[P,S]=a(""),[E,L]=a([]),[C,w]=a(),[M,W]=a(!1),{device:I,channel:H,isError:B,originalVariableList:N,template:$,templateSelectionTriggered:U,setTemplate:R,setDisplayContent:z,setOriginalVariableList:D,globalNormalizedPlaceholders:G}=p();function q(e,l){var t,a,o;const n=e;S(""),w(n),H===d.WHATSAPP?"custom_text"!==n.value&&"custom_link"!==n.value?(F(null!==(t=n.value)&&void 0!==t?t:"","string"),null==Y||Y(null!==(a=_.index)&&void 0!==a?a:0,`[[${n.value}]]`)):(null==Y||Y(null!==(o=_.index)&&void 0!==o?o:0,_.variableName),F("","url"===n.bikPlaceholderType?"link":"string")):"custom_text"!==n.value&&"custom_link"!==n.value?F(n.value,"url"===n.bikPlaceholderType?"link":"string"):(S(""),F("",n.value))}function F(e,l){var t,a;const o="custom_link"===l?"link":"custom_text"===l?"string":l;if(H!==d.WHATSAPP){const a=b(y+1),n=null===document||void 0===document?void 0:document.getElementById("mobile"===I?"template_html_mobile":"template_html_desktop"),i=H===d.EMAIL?null===(t=null==n?void 0:n.contentWindow)||void 0===t?void 0:t.document.getElementById(a):document.getElementById(a);i&&(i.textContent="custom_text"!==l&&"custom_link"!==l||e?e:_.variableName);const u=N.map(((l,t)=>t===y?Object.assign(Object.assign({},l),{type:o,updatedValue:e}):l));null==D||D(u)}if(H===d.WHATSAPP){const l=null===(a=N.body)||void 0===a?void 0:a.map(((l,t)=>t===y?Object.assign(Object.assign({},l),{type:o,updatedValue:e}):l));null==D||D((e=>Object.assign(Object.assign({},e),{body:l,buttons:N.buttons})))}}function Y(e,l){var t;const a=Object.assign({},$),o=null===(t=null==a?void 0:a.components)||void 0===t?void 0:t.map((t=>{var a,o,n,i,u;const s=Object.assign({},t);if("BODY"===t.type&&(null===(o=null===(a=t.example)||void 0===a?void 0:a.body_text)||void 0===o?void 0:o[0])){const t=[...null!==(u=null===(i=null===(n=s.example)||void 0===n?void 0:n.body_text)||void 0===i?void 0:i[0])&&void 0!==u?u:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},s.example),{body_text:[t]});return Object.assign(Object.assign({},s),{example:a})}return t}));a.components=o,null==R||R(a)}return o((()=>{O&&(null==j||j())}),[O]),o((()=>{!function(){var e,l,t,a,o;const n="mobile"===I?"template_html_mobile":"template_html_desktop",i=document.getElementById(n),u=(null!==(a=null===(t=null===(l=null===(e=null==i?void 0:i.contentWindow)||void 0===e?void 0:e.document)||void 0===l?void 0:l.body)||void 0===t?void 0:t.innerHTML)&&void 0!==a?a:"")+(null===(o=null==i?void 0:i.contentWindow)||void 0===o?void 0:o.document.head.innerHTML);H===d.EMAIL&&(null==z||z(u))}()}),[U]),o((()=>{var e;const l=[];let t=[];if(H===d.MESSAGE){const e=null!=G?G:[];L([{label:"",options:[f,x]},...e]),t=[{label:"",options:[f,x]},...e]}else{"link"===(null==_?void 0:_.type)?(l.push({label:"",options:[x,f]}),w(x)):(l.push({label:"",options:[x,f]}),w(f));const e=null!=G?G:[];L([...l,...e.map((e=>{var l,t;return Object.assign(Object.assign({},e),{label:m.toCapitilize(null===(t=null===(l=e.label)||void 0===l?void 0:l.replace(/([A-Z])/g," $1"))||void 0===t?void 0:t.toLowerCase())})}))]),t=[...l,...e]}if((H===d.WHATSAPP||H===d.EMAIL||H===d.MESSAGE)&&_.updatedValue)if(r.test(_.updatedValue)&&H===d.WHATSAPP||_.updatedValue.startsWith("{{")&&H!==d.WHATSAPP){const e=function(e,l,t){var a;let o={label:"",value:""};const n=t===d.WHATSAPP?e.updatedValue.replace("[[","").replace("]]",""):e.updatedValue.replace("{{","").replace("}}","");k?o={label:e.updatedValue?e.updatedValue.replace("{{","").replace("}}","").trim().replace("."," "):"",value:null!==(a=e.updatedValue)&&void 0!==a?a:""}:l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===n.trim()&&(o=e)}))}));return o}(_,t,H);e.value&&w(e)}else(null===(e=_.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(w(x),S(_.updatedValue.split("https://")[1])):(w(f),S(_.updatedValue))}),[]),e(h,Object.assign({channel:H,focused:O,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1)},{children:[l("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:B&&!C?v.content.negative:v.content.primary}},{children:[null===(A=_.variableName)||void 0===A?void 0:A.replace("{{","").replace("}}","")," ","link"===(null==_?void 0:_.type)?"link":"variable"]}))})),l("div",Object.assign({style:{marginBottom:12}},{children:k?l(s,{state:"none",value:C?C.label:"Custom text",onChangeText:()=>{},rightIcon:{icon:()=>l(t,{onClick:()=>{W(!M)},width:24,height:24,color:v.content.primary})}}):l(u,{options:E,isSearchable:!1,onSelect:q,defaultOptions:C?[Object.assign(Object.assign({},C),{selected:!0})]:[]})})),("custom_text"===(null==C?void 0:C.value)||"custom_link"===(null==C?void 0:C.value))&&l(s,{labelText:"custom_text"===(null==C?void 0:C.value)?"Custom text value":"custom_link"===(null==C?void 0:C.value)?"Custom URL value":"",id:`variable-value-${null==C?void 0:C.value}-${y}`,value:P,errorMessage:B?P?"custom_link"!==C.value||g(P)?"":"Enter valid URL":"Required field":"",maxCharLimit:"custom_link"===(null==C?void 0:C.value)?void 0:30,prefixText:"custom_link"===(null==C?void 0:C.value)?"https://":"",placeholder:"link"===_.type||"custom_link"===C.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;S(l);const a="custom_link"===(null==C?void 0:C.value)?`https://${l}`:l;F(a,e),H===d.WHATSAPP&&(null==Y||Y(null!==(t=_.index)&&void 0!==t?t:0,a))}(C.value,e)}),M&&l(i,{zIndex:2e3,data:null!=V?V:[],showVariable:M,setShowVariable:W,placeholder:"Add a variable",customTrigger:e=>{"{{custom.url}}"===e.actualValue?q({label:e.displayName,selected:!0,value:"custom_link"}):"{{custom.text}}"==e.actualValue?q({label:e.displayName,selected:!0,value:"custom_text"}):q({label:e.actualValue.replace("{{","").replace("}}","").trim().replace("."," "),selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{h as Container,j as default};
@@ -7,5 +7,6 @@ export interface TooltipProps extends TooltipInternalProps {
7
7
  children: ReactNode;
8
8
  tooltipContent?: JSX.Element;
9
9
  alwaysVisible?: boolean;
10
+ hideArrow?: boolean;
10
11
  }
11
12
  export declare const Tooltip: FunctionComponent<TooltipProps>;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as n,jsx as o}from"react/jsx-runtime";import e from"@tippyjs/react";import r from"react";import i from"./TooltipInternal.js";import{COLORS as p}from"../../constants/Theme.js";const a=`\n\t.tippy-content {\n\t\tpadding: 0px;\n\t}\n\t.tippy-arrow {\n\t\tcolor: ${t=>p.content.primary};\n\t}\n\t.overflow-wrap-tippy {\n\t\toverflow-wrap: anywhere;\n\t}\n`,l=p=>r.isValidElement(p.children)?t(n,{children:[o("style",{children:a}),o(e,Object.assign({appendTo:document.body,className:"overflow-wrap-tippy",placement:p.placement||"right",maxWidth:p.width,animation:"fade",arrow:!0,interactive:!0,delay:p.delay,visible:p.alwaysVisible,content:p.tooltipContent?p.tooltipContent:o(i,{title:p.title,body:p.body,buttonProps:p.buttonProps})},{children:p.children}))]}):null;export{l as Tooltip};
1
+ import{jsxs as t,Fragment as n,jsx as o}from"react/jsx-runtime";import e from"@tippyjs/react";import r from"react";import i from"./TooltipInternal.js";import{COLORS as p}from"../../constants/Theme.js";const a=`\n\t.tippy-content {\n\t\tpadding: 0px;\n\t}\n\t.tippy-arrow {\n\t\tcolor: ${t=>p.content.primary};\n\t}\n\t.overflow-wrap-tippy {\n\t\toverflow-wrap: anywhere;\n\t}\n`,l=p=>{var l;return r.isValidElement(p.children)?t(n,{children:[o("style",{children:a}),o(e,Object.assign({appendTo:document.body,className:"overflow-wrap-tippy",placement:p.placement||"right",maxWidth:p.width,animation:"fade",arrow:null===(l=!p.hideArrow)||void 0===l||l,interactive:!0,delay:p.delay,visible:p.alwaysVisible,content:p.tooltipContent?p.tooltipContent:o(i,{title:p.title,body:p.body,buttonProps:p.buttonProps})},{children:p.children}))]}):null};export{l as Tooltip};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.286",
3
+ "version": "0.0.288",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",