@bikdotai/bik-component-library 0.0.433-beta.4 → 0.0.433-beta.5
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.
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/package.json +1 -1
package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -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"),i=require("../../template-preview/constants/regexPatterns.js"),
|
|
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"),i=require("../../template-preview/constants/regexPatterns.js"),r=require("../../template-preview/models/TemplateMeta.js"),s=require("../../template-preview/models/WhatsAppTemplate.js"),o=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),d=require("../context/templateModalContext.js"),u=require("../custom-hooks/useAdditionalVariables.js"),p=require("../utils/validateIsUrl.js"),c=require("./VariableConnector.js");exports.default=b=>{let{variableListIndex:m,button:v,updateSelectedURLTemplateBtn:x,updateSelectedQRBTemplateBtn:j,originalVariableList:h,CTAoptions:y,QRBoptions:f,variableList:L}=b;var T,V,g,q;const[O,R]=t.useState(""),[U,C]=t.useState(),S=u.useAdditionalVariables({variableList:L,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{isError:w,disableEditVariable:B,pod:I}=d.useTemplateModalContext();function M(e){R(e),null==x||x(`https://${e}`,"custom")}return t.useEffect((()=>{var e;if(v.buttonVariable&&i.editableVarPattern.test(v.buttonVariable))C(r.CUSTOM_URL_NAME),R((null===(e=v.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===v.type?y:f;e="URL"===v.type?t.findIndex((e=>e.placeHolder===v.buttonVariable)):t.findIndex((e=>e.label===v.flowName)),e>-1&&C(t[e])}}),[]),I!==s.POD.CHATBOT?e.jsxs(c.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(o.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:[v.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(a.Dropdown,{disabled:B,options:"URL"===v.type?y:f,isSearchable:!1,onSelect:function(e,t){const a=e;C(a);const l=("URL"===v.type?y:f).find((e=>e.placeHolder===a.placeHolder));l&&("custom_link"!==l.value?"URL"===v.type?null==x||x({defaultValue:l.value,placeHolder:l.placeHolder},"placeholder"):null==j||j({flowName:a.label,flowId:a.value},"placeholder",v.index):M(""))},defaultOptions:U?[Object.assign(Object.assign({},U),{selected:!0})]:[]})})),"custom_link"===(null==U?void 0:U.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(l.Input,{state:B?"disabled":"none",errorMessage:w?O?p.validateIsUrl(O)?"":"Enter valid URL":"Required field":"",value:O,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:M,maxCharLimit:2e3})}))]}):e.jsx(c.default,{index:m,variable:{variableName:null!==(T=v.text)&&void 0!==T?T:"",updatedValue:"((customPlaceholderName))"===v.buttonVariable?`${null===(V=v.example)||void 0===V?void 0:V[0]}`:null!==(g=v.buttonVariable)&&void 0!==g?g:"",type:"link",isEditableVariable:!0,index:null!==(q=v.index)&&void 0!==q?q:0},showVariableModal:!0,componentType:"BUTTONS",variableList:S,CTAoptions:y})};
|
package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import{Dropdown as o}from"../../dropdown/Dropdown.js";import{Input as i}from"../../input/Input.js";import{editableVarPattern as r}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as n}from"../../template-preview/models/TemplateMeta.js";import{POD as s}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as p}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as m}from"../context/templateModalContext.js";import{useAdditionalVariables as c}from"../custom-hooks/useAdditionalVariables.js";import{validateIsUrl as u}from"../utils/validateIsUrl.js";import b,{Container as v}from"./VariableConnector.js";const f=f=>{let{variableListIndex:h,button:x,updateSelectedURLTemplateBtn:j,updateSelectedQRBTemplateBtn:y,originalVariableList:g,CTAoptions:L,QRBoptions:T,variableList:V}=f;var R,U,w,B;const[C,O]=l(""),[N,H]=l(),I=c({variableList:V,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom URL",variableValue:"{{custom.url}}"}),{isError:S,disableEditVariable:A,pod:E}=m();function k(e){O(e),null==j||j(`https://${e}`,"custom")}return a((()=>{var e;if(x.buttonVariable&&r.test(x.buttonVariable))H(n),O((null===(e=x.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===x.type?L:T;e="URL"===x.type?t.findIndex((e=>e.placeHolder===x.buttonVariable)):t.findIndex((e=>e.label===x.flowName)),e>-1&&H(t[e])}}),[]),E!==s.CHATBOT?e(v,{children:[t("div",Object.assign({style:{marginBottom:8}},{children:e(p,Object.assign({style:{color:d.content.primary}},{children:[x.text," button"]}))})),t("div",Object.assign({style:{marginBottom:12}},{children:t(o,{disabled:A,options:"URL"===x.type?L:T,isSearchable:!1,onSelect:function(e,t){const l=e;H(l);const a=("URL"===x.type?L:T).find((e=>e.placeHolder===l.placeHolder));a&&("custom_link"!==a.value?"URL"===x.type?null==j||j({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder"):null==y||y({flowName:l.label,flowId:l.value},"placeholder",x.index):k(""))},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(i,{state:A?"disabled":"none",errorMessage:S?C?u(C)?"":"Enter valid URL":"Required field":"",value:C,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:k,maxCharLimit:2e3})}))]}):t(b,{index:h,variable:{variableName:null!==(R=x.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===x.buttonVariable?`${null===(U=x.example)||void 0===U?void 0:U[0]}`:null!==(w=x.buttonVariable)&&void 0!==w?w:"",type:"link",isEditableVariable:!0,index:null!==(B=x.index)&&void 0!==B?B:0},showVariableModal:!0,componentType:"BUTTONS",variableList:I,CTAoptions:L})};export{f as default};
|