@bikdotai/bik-component-library 0.0.264-beta.7 → 0.0.264-beta.8
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,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("react"),a=require("styled-components"),n=require("../../add-variableV2/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/edit.svg.js"),l=require("react"),a=require("styled-components"),n=require("../../add-variableV2/AddVariableV2SideModal.js"),i=require("../../dropdown/Dropdown.js"),o=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),u=require("../../template-preview/models/Channels.js"),r=require("../../TypographyStyle.js"),d=require("../../../utils/StringUtils.js"),c=require("../../../constants/Theme.js"),v=require("../context/templateModalContext.js"),p=require("../utils/getVariableNameEmail.js"),m=require("../utils/validateIsUrl.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const g=b(a).default.div`
|
|
2
2
|
/* surface/$color-background-warning-light */
|
|
3
3
|
|
|
4
|
-
background: ${e=>e.focused&&e.channel===
|
|
4
|
+
background: ${e=>e.focused&&e.channel===u.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[y,P]=l.useState(!1),[T,
|
|
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[y,P]=l.useState(!1),[T,f]=l.useState(""),[C,L]=l.useState([]),[O,S]=l.useState(),[k,H]=l.useState(!1),{device:V,channel:M,isError:q,originalVariableList:w,template:I,templateSelectionTriggered:Y,setTemplate:W,setDisplayContent:B,setOriginalVariableList:R,globalNormalizedPlaceholders:U}=v.useTemplateModalContext();function $(e,t){var l,a,n;const i=e;f(""),S(i),M===u.CHANNEL_TYPE.WHATSAPP?"custom_text"!==i.value&&"custom_link"!==i.value?(D(null!==(l=i.value)&&void 0!==l?l:"","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"):(f(""),D("",i.value))}function D(e,t){var l,a;const n="custom_link"===t?"link":"custom_text"===t?"string":t;if(M!==u.CHANNEL_TYPE.WHATSAPP){const a=p.getVariableNameForEmailByIndex(h+1),i=null===document||void 0===document?void 0:document.getElementById("mobile"===V?"template_html_mobile":"template_html_desktop"),o=M===u.CHANNEL_TYPE.EMAIL?null===(l=null==i?void 0:i.contentWindow)||void 0===l?void 0:l.document.getElementById(a):document.getElementById(a);o&&(o.textContent="custom_text"!==t&&"custom_link"!==t||e?e:_.variableName);const s=w.map(((t,l)=>l===h?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==R||R(s)}if(M===u.CHANNEL_TYPE.WHATSAPP){const t=null===(a=w.body)||void 0===a?void 0:a.map(((t,l)=>l===h?Object.assign(Object.assign({},t),{type:n,updatedValue:e}):t));null==R||R((e=>Object.assign(Object.assign({},e),{body:t,buttons:w.buttons})))}}function z(e,t){var l;const a=Object.assign({},I),n=null===(l=null==a?void 0:a.components)||void 0===l?void 0:l.map((l=>{var a,n,i,o,s;const u=Object.assign({},l);if("BODY"===l.type&&(null===(n=null===(a=l.example)||void 0===a?void 0:a.body_text)||void 0===n?void 0:n[0])){const l=[...null!==(s=null===(o=null===(i=u.example)||void 0===i?void 0:i.body_text)||void 0===o?void 0:o[0])&&void 0!==s?s:[]];l[e]=t.replace("{{","").replace("}}","").replace("((","").replace("))","");const a=Object.assign(Object.assign({},u.example),{body_text:[l]});return Object.assign(Object.assign({},u),{example:a})}return l}));a.components=n,null==W||W(a)}return l.useEffect((()=>{y&&(null==b||b())}),[y]),l.useEffect((()=>{!function(){var e,t,l,a,n;const i="mobile"===V?"template_html_mobile":"template_html_desktop",o=document.getElementById(i),s=(null!==(a=null===(l=null===(t=null===(e=null==o?void 0:o.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.body)||void 0===l?void 0:l.innerHTML)&&void 0!==a?a:"")+(null===(n=null==o?void 0:o.contentWindow)||void 0===n?void 0:n.document.head.innerHTML);M===u.CHANNEL_TYPE.EMAIL&&(null==B||B(s))}()}),[Y]),l.useEffect((()=>{var e;const t=[];let l=[];if(M===u.CHANNEL_TYPE.MESSAGE){const e=null!=U?U:[];L([{label:"",options:[E,x]},...e]),l=[{label:"",options:[E,x]},...e]}else{"link"===(null==_?void 0:_.type)?(t.push({label:"",options:[x,E]}),S(x)):(t.push({label:"",options:[x,E]}),S(E));const e=null!=U?U:[];L([...t,...e.map((e=>{var t,l;return Object.assign(Object.assign({},e),{label:d.default.toCapitilize(null===(l=null===(t=e.label)||void 0===t?void 0:t.replace(/([A-Z])/g," $1"))||void 0===l?void 0:l.toLowerCase())})}))]),l=[...t,...e]}if((M===u.CHANNEL_TYPE.WHATSAPP||M===u.CHANNEL_TYPE.EMAIL||M===u.CHANNEL_TYPE.MESSAGE)&&_.updatedValue)if(s.placeHolderNamePattern.test(_.updatedValue)&&M===u.CHANNEL_TYPE.WHATSAPP||_.updatedValue.startsWith("{{")&&M!==u.CHANNEL_TYPE.WHATSAPP){const e=function(e,t,l){let a={label:"",value:""};const n=l===u.CHANNEL_TYPE.WHATSAPP?e.replace("[[","").replace("]]",""):e.replace("{{","").replace("}}","");return t.map((e=>{e.options.map((e=>{var t;(null===(t=e.value)||void 0===t?void 0:t.replace("{{","").replace("}}","").trim())===n.trim()&&(a=e)}))})),a}(_.updatedValue,l,M);e.value&&S(e)}else(null===(e=_.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(S(x),f(_.updatedValue.split("https://")[1])):(S(E),f(_.updatedValue))}),[]),l.useEffect((()=>{console.log("selectedOption: ",O)}),[O]),e.jsxs(g,Object.assign({channel:M,focused:y,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!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(t.default,{onClick:()=>{H(!k)},width:24,height:24,color:c.COLORS.content.primary})}}):e.jsx(i.Dropdown,{options:C,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:T,errorMessage:q?T?"custom_link"!==O.value||m.validateIsUrl(T)?"":"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,t){var l;f(t);const a="custom_link"===(null==O?void 0:O.value)?`https://${t}`:t;D(a,e),M===u.CHANNEL_TYPE.WHATSAPP&&(null==z||z(null!==(l=_.index)&&void 0!==l?l:0,a))}(O.value,e)}),k&&e.jsx(n.AddVariableV2SideModal,{data:null!=A?A:[],showVariable:k,setShowVariable:H,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.displayName,selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};
|
|
@@ -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:y,index:_,showVariableModal:k,variableList:A}=n;var O;const[T,P]=o(!1),[V,S]=o(""),[E,L]=o([]),[C,w]=o(),[M,W]=o(!1),{device:I,channel:H,isError:N,originalVariableList:B,template:$,templateSelectionTriggered:U,setTemplate:R,setDisplayContent:D,setOriginalVariableList:z,globalNormalizedPlaceholders:G}=p();function q(e,l){var t,o,a;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!==(o=y.index)&&void 0!==o?o:0,`[[${n.value}]]`)):(null==Y||Y(null!==(a=y.index)&&void 0!==a?a:0,y.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,o;const a="custom_link"===l?"link":"custom_text"===l?"string":l;if(H!==d.WHATSAPP){const o=b(_+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(o):document.getElementById(o);i&&(i.textContent="custom_text"!==l&&"custom_link"!==l||e?e:y.variableName);const s=B.map(((l,t)=>t===_?Object.assign(Object.assign({},l),{type:a,updatedValue:e}):l));null==z||z(s)}if(H===d.WHATSAPP){const l=null===(o=B.body)||void 0===o?void 0:o.map(((l,t)=>t===_?Object.assign(Object.assign({},l),{type:a,updatedValue:e}):l));null==z||z((e=>Object.assign(Object.assign({},e),{body:l,buttons:B.buttons})))}}function Y(e,l){var t;const o=Object.assign({},$),a=null===(t=null==o?void 0:o.components)||void 0===t?void 0:t.map((t=>{var o,a,n,i,s;const u=Object.assign({},t);if("BODY"===t.type&&(null===(a=null===(o=t.example)||void 0===o?void 0:o.body_text)||void 0===a?void 0:a[0])){const t=[...null!==(s=null===(i=null===(n=u.example)||void 0===n?void 0:n.body_text)||void 0===i?void 0:i[0])&&void 0!==s?s:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const o=Object.assign(Object.assign({},u.example),{body_text:[t]});return Object.assign(Object.assign({},u),{example:o})}return t}));o.components=a,null==R||R(o)}return a((()=>{T&&(null==j||j())}),[T]),a((()=>{!function(){var e,l,t,o,a;const n="mobile"===I?"template_html_mobile":"template_html_desktop",i=document.getElementById(n),s=(null!==(o=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!==o?o:"")+(null===(a=null==i?void 0:i.contentWindow)||void 0===a?void 0:a.document.head.innerHTML);H===d.EMAIL&&(null==D||D(s))}()}),[U]),a((()=>{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==y?void 0:y.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)&&y.updatedValue)if(r.test(y.updatedValue)&&H===d.WHATSAPP||y.updatedValue.startsWith("{{")&&H!==d.WHATSAPP){const e=function(e,l,t){let o={label:"",value:""};const a=t===d.WHATSAPP?e.replace("[[","").replace("]]",""):e.replace("{{","").replace("}}","");return l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===a.trim()&&(o=e)}))})),o}(y.updatedValue,t,H);e.value&&w(e)}else(null===(e=y.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(w(x),S(y.updatedValue.split("https://")[1])):(w(f),S(y.updatedValue))}),[]),e(h,Object.assign({channel:H,focused:T,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1)},{children:[l("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:N&&!C?v.content.negative:v.content.primary}},{children:[null===(O=y.variableName)||void 0===O?void 0:O.replace("{{","").replace("}}","")," ","link"===(null==y?void 0:y.type)?"link":"variable"]}))})),l("div",Object.assign({style:{marginBottom:12}},{children:k?l(u,{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(s,{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(u,{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}-${_}`,value:V,errorMessage:N?V?"custom_link"!==C.value||g(V)?"":"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"===y.type||"custom_link"===C.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;S(l);const o="custom_link"===(null==C?void 0:C.value)?`https://${l}`:l;F(o,e),H===d.WHATSAPP&&(null==Y||Y(null!==(t=y.index)&&void 0!==t?t:0,o))}(C.value,e)}),M&&l(i,{data:null!=A?A:[],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.displayName,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:y,index:_,showVariableModal:k,variableList:A}=n;var O;const[T,P]=o(!1),[V,S]=o(""),[E,L]=o([]),[C,w]=o(),[M,W]=o(!1),{device:I,channel:H,isError:N,originalVariableList:B,template:$,templateSelectionTriggered:U,setTemplate:R,setDisplayContent:D,setOriginalVariableList:z,globalNormalizedPlaceholders:G}=p();function q(e,l){var t,o,a;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!==(o=y.index)&&void 0!==o?o:0,`[[${n.value}]]`)):(null==Y||Y(null!==(a=y.index)&&void 0!==a?a:0,y.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,o;const a="custom_link"===l?"link":"custom_text"===l?"string":l;if(H!==d.WHATSAPP){const o=b(_+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(o):document.getElementById(o);i&&(i.textContent="custom_text"!==l&&"custom_link"!==l||e?e:y.variableName);const s=B.map(((l,t)=>t===_?Object.assign(Object.assign({},l),{type:a,updatedValue:e}):l));null==z||z(s)}if(H===d.WHATSAPP){const l=null===(o=B.body)||void 0===o?void 0:o.map(((l,t)=>t===_?Object.assign(Object.assign({},l),{type:a,updatedValue:e}):l));null==z||z((e=>Object.assign(Object.assign({},e),{body:l,buttons:B.buttons})))}}function Y(e,l){var t;const o=Object.assign({},$),a=null===(t=null==o?void 0:o.components)||void 0===t?void 0:t.map((t=>{var o,a,n,i,s;const u=Object.assign({},t);if("BODY"===t.type&&(null===(a=null===(o=t.example)||void 0===o?void 0:o.body_text)||void 0===a?void 0:a[0])){const t=[...null!==(s=null===(i=null===(n=u.example)||void 0===n?void 0:n.body_text)||void 0===i?void 0:i[0])&&void 0!==s?s:[]];t[e]=l.replace("{{","").replace("}}","").replace("((","").replace("))","");const o=Object.assign(Object.assign({},u.example),{body_text:[t]});return Object.assign(Object.assign({},u),{example:o})}return t}));o.components=a,null==R||R(o)}return a((()=>{T&&(null==j||j())}),[T]),a((()=>{!function(){var e,l,t,o,a;const n="mobile"===I?"template_html_mobile":"template_html_desktop",i=document.getElementById(n),s=(null!==(o=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!==o?o:"")+(null===(a=null==i?void 0:i.contentWindow)||void 0===a?void 0:a.document.head.innerHTML);H===d.EMAIL&&(null==D||D(s))}()}),[U]),a((()=>{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==y?void 0:y.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)&&y.updatedValue)if(r.test(y.updatedValue)&&H===d.WHATSAPP||y.updatedValue.startsWith("{{")&&H!==d.WHATSAPP){const e=function(e,l,t){let o={label:"",value:""};const a=t===d.WHATSAPP?e.replace("[[","").replace("]]",""):e.replace("{{","").replace("}}","");return l.map((e=>{e.options.map((e=>{var l;(null===(l=e.value)||void 0===l?void 0:l.replace("{{","").replace("}}","").trim())===a.trim()&&(o=e)}))})),o}(y.updatedValue,t,H);e.value&&w(e)}else(null===(e=y.updatedValue)||void 0===e?void 0:e.startsWith("https"))?(w(x),S(y.updatedValue.split("https://")[1])):(w(f),S(y.updatedValue))}),[]),a((()=>{console.log("selectedOption: ",C)}),[C]),e(h,Object.assign({channel:H,focused:T,onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1)},{children:[l("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:N&&!C?v.content.negative:v.content.primary}},{children:[null===(O=y.variableName)||void 0===O?void 0:O.replace("{{","").replace("}}","")," ","link"===(null==y?void 0:y.type)?"link":"variable"]}))})),l("div",Object.assign({style:{marginBottom:12}},{children:k?l(u,{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(s,{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(u,{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}-${_}`,value:V,errorMessage:N?V?"custom_link"!==C.value||g(V)?"":"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"===y.type||"custom_link"===C.value?"Enter custom URL here":"Enter custom text here",onChangeText:e=>function(e,l){var t;S(l);const o="custom_link"===(null==C?void 0:C.value)?`https://${l}`:l;F(o,e),H===d.WHATSAPP&&(null==Y||Y(null!==(t=y.index)&&void 0!==t?t:0,o))}(C.value,e)}),M&&l(i,{data:null!=A?A:[],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.displayName,selected:!0,value:e.actualValue,bikPlaceholderType:"string"})}})]}))};export{h as Container,j as default};
|