@bikdotai/bik-component-library 0.0.414 → 0.0.415

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"),a=require("../../dropdown/Dropdown.js"),l=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),o=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=c=>{let{button:b,updateSelectedURLTemplateBtn:m,updateSelectedQRBTemplateBtn:v,originalVariableList:j,CTAoptions:x,QRBoptions:y,variableList:O}=c;var g,f,h,T;const[L,U]=t.useState(""),[V,R]=t.useState(),C=t.useCallback((()=>O?[...O,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom url":{description:void 0,displayName:"Custom url",actualValue:"{{custom.url}}",variableType:"any",isAvailable:!0}}}].sort(((e,t)=>e.orderId-t.orderId)):O),[O]),q=t.useMemo((()=>C()),[C]),{setOriginalVariableList:w,isError:I,disableEditVariable:B,pod:N}=d.useTemplateModalContext();function S(e){U(e);const t=[Object.assign(Object.assign({},j.buttons[0]),{type:o.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==w||w((e=>Object.assign(Object.assign({},e),{body:[...j.body],buttons:[...t]}))),null==m||m(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(b.buttonVariable&&s.editableVarPattern.test(b.buttonVariable))R(i.CUSTOM_URL_NAME),U((null===(e=b.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===b.type?x:y;e="URL"===b.type?t.findIndex((e=>e.placeHolder===b.buttonVariable)):t.findIndex((e=>e.label===b.flowName)),e>-1&&R(t[e])}}),[]),N!==o.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:[b.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(a.Dropdown,{disabled:B,options:"URL"===b.type?x:y,isSearchable:!1,onSelect:function(e,t){const a=e;R(a);const l=("URL"===b.type?x:y).find((e=>e.placeHolder===a.placeHolder));if(l)if("custom_link"!==l.value){let e;"URL"===b.type?(e=[Object.assign(Object.assign({},j.buttons[0]),{type:"URL",buttonVariable:a.placeHolder,example:["https://bik.ai/"]})],null==m||m({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder")):(e=j.buttons.map(((e,t)=>t===b.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:a.label,flowId:a.value}):e)),null==v||v({flowName:a.label,flowId:a.value},"placeholder",b.index)),null==w||w((t=>Object.assign(Object.assign({},t),{body:[...j.body],buttons:[...e]})))}else S("")},defaultOptions:V?[Object.assign(Object.assign({},V),{selected:!0})]:[]})})),"custom_link"===(null==V?void 0:V.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(l.Input,{state:B?"disabled":"none",errorMessage:I?L?u.validateIsUrl(L)?"":"Enter valid URL":"Required field":"",value:L,prefixText:"custom_link"===(null==V?void 0:V.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:S})}))]}):e.jsx(p.default,{index:0,variable:{variableName:null!==(g=b.text)&&void 0!==g?g:"",updatedValue:"((customPlaceholderName))"===b.buttonVariable?`${null===(f=b.example)||void 0===f?void 0:f[0]}`:null!==(h=b.buttonVariable)&&void 0!==h?h:"",type:"link",isEditableVariable:!0,index:null!==(T=b.index)&&void 0!==T?T:0},showVariableModal:!0,componentType:"BUTTONS",variableList:q,CTAoptions:x})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../../dropdown/Dropdown.js"),l=require("../../input/Input.js"),s=require("../../template-preview/constants/regexPatterns.js"),i=require("../../template-preview/models/TemplateMeta.js"),r=require("../../template-preview/models/WhatsAppTemplate.js"),o=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../utils/validateIsUrl.js"),p=require("./VariableConnector.js");exports.default=c=>{let{button:b,updateSelectedURLTemplateBtn:m,updateSelectedQRBTemplateBtn:j,originalVariableList:v,CTAoptions:x,QRBoptions:y,variableList:O}=c;var g,h,f,T;const[L,U]=t.useState(""),[V,C]=t.useState(),R=t.useCallback((()=>O?[...O,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom url":{description:void 0,displayName:"Custom url",actualValue:"{{custom.url}}",variableType:"any",isAvailable:!0}}}].sort(((e,t)=>e.orderId-t.orderId)):O),[O]),q=t.useMemo((()=>R()),[R]),{setOriginalVariableList:w,isError:I,disableEditVariable:B,pod:N}=d.useTemplateModalContext();function S(e){U(e);const t=[Object.assign(Object.assign({},v.buttons[0]),{type:r.BUTTON_TYPE.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==w||w((e=>Object.assign(Object.assign({},e),{body:[...v.body],buttons:[...t]}))),null==m||m(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(b.buttonVariable&&s.editableVarPattern.test(b.buttonVariable))C(i.CUSTOM_URL_NAME),U((null===(e=b.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===b.type?x:y;e="URL"===b.type?t.findIndex((e=>e.placeHolder===b.buttonVariable)):t.findIndex((e=>e.label===b.flowName)),e>-1&&C(t[e])}}),[]),N!==r.POD.CHATBOT?e.jsxs(p.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(o.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:[b.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(a.Dropdown,{disabled:B,options:"URL"===b.type?x:y,isSearchable:!1,onSelect:function(e,t){const a=e;C(a);const l=("URL"===b.type?x:y).find((e=>e.placeHolder===a.placeHolder));if(l)if("custom_link"!==l.value){let e;"URL"===b.type?(e=[Object.assign(Object.assign({},v.buttons[0]),{type:"URL",buttonVariable:a.placeHolder,example:["https://bik.ai/"]})],null==m||m({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder")):(e=v.buttons.map(((e,t)=>t===b.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:a.label,flowId:a.value}):e)),null==j||j({flowName:a.label,flowId:a.value},"placeholder",b.index)),null==w||w((t=>Object.assign(Object.assign({},t),{body:[...v.body],buttons:[...e]})))}else S("")},defaultOptions:V?[Object.assign(Object.assign({},V),{selected:!0})]:[]})})),"custom_link"===(null==V?void 0:V.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(l.Input,{state:B?"disabled":"none",errorMessage:I?L?u.validateIsUrl(L)?"":"Enter valid URL":"Required field":"",value:L,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:S,maxCharLimit:2e3})}))]}):e.jsx(p.default,{index:0,variable:{variableName:null!==(g=b.text)&&void 0!==g?g:"",updatedValue:"((customPlaceholderName))"===b.buttonVariable?`${null===(h=b.example)||void 0===h?void 0:h[0]}`:null!==(f=b.buttonVariable)&&void 0!==f?f:"",type:"link",isEditableVariable:!0,index:null!==(T=b.index)&&void 0!==T?T:0},showVariableModal:!0,componentType:"BUTTONS",variableList:q,CTAoptions:x})};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useCallback as a,useMemo as o,useEffect as i}from"react";import{Dropdown as s}from"../../dropdown/Dropdown.js";import{Input as n}from"../../input/Input.js";import{editableVarPattern as r}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as d}from"../../template-preview/models/TemplateMeta.js";import{POD as p,BUTTON_TYPE as m}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as u}from"../../../constants/Theme.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import{validateIsUrl as v}from"../utils/validateIsUrl.js";import f,{Container as j}from"./VariableConnector.js";const y=y=>{let{button:g,updateSelectedURLTemplateBtn:h,updateSelectedQRBTemplateBtn:x,originalVariableList:O,CTAoptions:T,QRBoptions:V,variableList:L}=y;var R,U,w,C;const[I,B]=l(""),[N,H]=l(),E=a((()=>L?[...L,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom url":{description:void 0,displayName:"Custom url",actualValue:"{{custom.url}}",variableType:"any",isAvailable:!0}}}].sort(((e,t)=>e.orderId-t.orderId)):L),[L]),S=o((()=>E()),[E]),{setOriginalVariableList:k,isError:A,disableEditVariable:M,pod:P}=b();function _(e){B(e);const t=[Object.assign(Object.assign({},O.buttons[0]),{type:m.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==k||k((e=>Object.assign(Object.assign({},e),{body:[...O.body],buttons:[...t]}))),null==h||h(`https://${e}`,"custom")}return i((()=>{var e;if(g.buttonVariable&&r.test(g.buttonVariable))H(d),B((null===(e=g.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===g.type?T:V;e="URL"===g.type?t.findIndex((e=>e.placeHolder===g.buttonVariable)):t.findIndex((e=>e.label===g.flowName)),e>-1&&H(t[e])}}),[]),P!==p.CHATBOT?e(j,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(c,Object.assign({style:{color:u.content.primary}},{children:[g.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(s,{disabled:M,options:"URL"===g.type?T:V,isSearchable:!1,onSelect:function(e,t){const l=e;H(l);const a=("URL"===g.type?T:V).find((e=>e.placeHolder===l.placeHolder));if(a)if("custom_link"!==a.value){let e;"URL"===g.type?(e=[Object.assign(Object.assign({},O.buttons[0]),{type:"URL",buttonVariable:l.placeHolder,example:["https://bik.ai/"]})],null==h||h({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder")):(e=O.buttons.map(((e,t)=>t===g.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:l.label,flowId:l.value}):e)),null==x||x({flowName:l.label,flowId:l.value},"placeholder",g.index)),null==k||k((t=>Object.assign(Object.assign({},t),{body:[...O.body],buttons:[...e]})))}else _("")},defaultOptions:N?[Object.assign(Object.assign({},N),{selected:!0})]:[]})})),"custom_link"===(null==N?void 0:N.value)&&t("div",Object.assign({style:{marginBottom:20}},{children:t(n,{state:M?"disabled":"none",errorMessage:A?I?v(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"custom_link"===(null==N?void 0:N.value)?"https://":"",placeholder:"Enter custom URL here",onChangeText:_})}))]}):t(f,{index:0,variable:{variableName:null!==(R=g.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===g.buttonVariable?`${null===(U=g.example)||void 0===U?void 0:U[0]}`:null!==(w=g.buttonVariable)&&void 0!==w?w:"",type:"link",isEditableVariable:!0,index:null!==(C=g.index)&&void 0!==C?C:0},showVariableModal:!0,componentType:"BUTTONS",variableList:S,CTAoptions:T})};export{y as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as a,useCallback as l,useMemo as o,useEffect as i}from"react";import{Dropdown as s}from"../../dropdown/Dropdown.js";import{Input as r}from"../../input/Input.js";import{editableVarPattern as n}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as d}from"../../template-preview/models/TemplateMeta.js";import{POD as p,BUTTON_TYPE as m}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as b}from"../../TypographyStyle.js";import{COLORS as c}from"../../../constants/Theme.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{validateIsUrl as v}from"../utils/validateIsUrl.js";import f,{Container as j}from"./VariableConnector.js";const y=y=>{let{button:g,updateSelectedURLTemplateBtn:h,updateSelectedQRBTemplateBtn:x,originalVariableList:O,CTAoptions:L,QRBoptions:T,variableList:V}=y;var R,U,w,C;const[I,B]=a(""),[N,H]=a(),E=l((()=>V?[...V,{description:"",displayName:"Custom variables",orderId:1,variables:{"Custom url":{description:void 0,displayName:"Custom url",actualValue:"{{custom.url}}",variableType:"any",isAvailable:!0}}}].sort(((e,t)=>e.orderId-t.orderId)):V),[V]),S=o((()=>E()),[E]),{setOriginalVariableList:A,isError:k,disableEditVariable:M,pod:P}=u();function Q(e){B(e);const t=[Object.assign(Object.assign({},O.buttons[0]),{type:m.URL,buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]})];null==A||A((e=>Object.assign(Object.assign({},e),{body:[...O.body],buttons:[...t]}))),null==h||h(`https://${e}`,"custom")}return i((()=>{var e;if(g.buttonVariable&&n.test(g.buttonVariable))H(d),B((null===(e=g.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===g.type?L:T;e="URL"===g.type?t.findIndex((e=>e.placeHolder===g.buttonVariable)):t.findIndex((e=>e.label===g.flowName)),e>-1&&H(t[e])}}),[]),P!==p.CHATBOT?e(j,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(b,Object.assign({style:{color:c.content.primary}},{children:[g.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(s,{disabled:M,options:"URL"===g.type?L:T,isSearchable:!1,onSelect:function(e,t){const a=e;H(a);const l=("URL"===g.type?L:T).find((e=>e.placeHolder===a.placeHolder));if(l)if("custom_link"!==l.value){let e;"URL"===g.type?(e=[Object.assign(Object.assign({},O.buttons[0]),{type:"URL",buttonVariable:a.placeHolder,example:["https://bik.ai/"]})],null==h||h({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder")):(e=O.buttons.map(((e,t)=>t===g.index?Object.assign(Object.assign({},e),{type:"QUICK_REPLY",flowName:a.label,flowId:a.value}):e)),null==x||x({flowName:a.label,flowId:a.value},"placeholder",g.index)),null==A||A((t=>Object.assign(Object.assign({},t),{body:[...O.body],buttons:[...e]})))}else Q("")},defaultOptions:N?[Object.assign(Object.assign({},N),{selected:!0})]:[]})})),"custom_link"===(null==N?void 0:N.value)&&t("div",Object.assign({style:{marginBottom:20}},{children:t(r,{state:M?"disabled":"none",errorMessage:k?I?v(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:Q,maxCharLimit:2e3})}))]}):t(f,{index:0,variable:{variableName:null!==(R=g.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===g.buttonVariable?`${null===(U=g.example)||void 0===U?void 0:U[0]}`:null!==(w=g.buttonVariable)&&void 0!==w?w:"",type:"link",isEditableVariable:!0,index:null!==(C=g.index)&&void 0!==C?C:0},showVariableModal:!0,componentType:"BUTTONS",variableList:S,CTAoptions:L})};export{y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.414",
3
+ "version": "0.0.415",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",