@bikdotai/bik-component-library 0.0.564-beta.picker.9 → 0.0.564-bik-scroll
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/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +0 -2
- package/dist/cjs/components/WhatsAppTextEditor/WhatsAppTextEditor.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
- package/dist/cjs/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/model.d.ts +0 -3
- package/dist/cjs/components/variable-picker-v3/styles.d.ts +1 -3
- package/dist/cjs/components/variable-picker-v3/styles.js +4 -4
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.d.ts +0 -2
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditor.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.js +1 -1
- package/dist/esm/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +1 -1
- package/dist/esm/components/variable-picker-v3/model.d.ts +0 -3
- package/dist/esm/components/variable-picker-v3/styles.d.ts +1 -3
- package/dist/esm/components/variable-picker-v3/styles.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/variable-picker-v3/DefaultVariableContent.d.ts +0 -8
- package/dist/cjs/components/variable-picker-v3/DefaultVariableContent.js +0 -1
- package/dist/esm/components/variable-picker-v3/DefaultVariableContent.d.ts +0 -8
- package/dist/esm/components/variable-picker-v3/DefaultVariableContent.js +0 -1
|
@@ -12,7 +12,6 @@ export type CustomEditorProps = React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
12
12
|
* Calls only for editor only error, not for errors coming from outside
|
|
13
13
|
*/
|
|
14
14
|
onError?: (err: string) => void;
|
|
15
|
-
onClickVariable?: (variable: string) => void;
|
|
16
15
|
};
|
|
17
16
|
export type CustomEditorRef = {
|
|
18
17
|
addTextOrWrap: (textToAdd: string) => {
|
|
@@ -38,5 +37,4 @@ export declare const WhatsAppTextEditor: React.ForwardRefExoticComponent<React.T
|
|
|
38
37
|
* Calls only for editor only error, not for errors coming from outside
|
|
39
38
|
*/
|
|
40
39
|
onError?: ((err: string) => void) | undefined;
|
|
41
|
-
onClickVariable?: ((variable: string) => void) | undefined;
|
|
42
40
|
} & React.RefAttributes<CustomEditorRef>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("../../assets/icons/info.svg.js"),r=require("../../helpers/BaseWhatsappContentLang.helper.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("../../assets/icons/info.svg.js"),r=require("../../helpers/BaseWhatsappContentLang.helper.js"),l=require("react"),o=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),u=require("./CustomEditor.styled.js"),s=require("./WhatsAppTextEditorHeader.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=c(l);const d="Character limit reached",v=new r.BaseWhatsappContentLangHelper,h={[s.EditorActionTypes.BOLD]:"*",[s.EditorActionTypes.ITALIC]:"_",[s.EditorActionTypes.STRIKETHROUGH]:"~"},p=a.default.forwardRef(((r,c)=>{var a,p,{onChange:f,text:g,RightComponent:x,error:j,limit:m,onError:C,rows:E,actions:T}=r,O=e.__rest(r,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const y=l.useRef(null);function L(e){const t=null==y?void 0:y.current;null!=t&&(t.selectionStart?(t.focus(),t.selectionEnd=e):t.focus())}function S(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart,n=y.current.selectionEnd,l=e;if(t===n)return R(l);{r=v.wrappWildcard(t,n,l,r);const e=v.getHTML(r);return y.current.value=r,{text:r,html:e}}}return{text:r,html:r}}function R(e){var t,n;let r=null!==(n=null===(t=y.current)||void 0===t?void 0:t.value)&&void 0!==n?n:"";if(y.current&&e){const t=y.current.selectionStart;if(t===y.current.selectionEnd)return H(e,t)}return{text:r,html:r}}function H(e,t){var n,r;let l=null!==(r=null===(n=y.current)||void 0===n?void 0:n.value)&&void 0!==r?r:"";l=l.slice(0,t)+e+l.slice(t);const o=v.getHTML(l);return y.current.value=l,{text:l,html:o}}return l.useImperativeHandle(c,(()=>({addTextOrWrap:S,addText:R,get(){var e,t;return null!==(t=null===(e=y.current)||void 0===e?void 0:e.value)&&void 0!==t?t:""},setCaretPosition:L}))),l.useEffect((()=>{if(null==y?void 0:y.current){y.current.value=g||"";const e=v.getHTML(g||"");null==f||f(g||"",e)}}),[g]),l.useEffect((()=>{var e,t;(null===(e=null==y?void 0:y.current)||void 0===e?void 0:e.value)&&m&&((null===(t=null==y?void 0:y.current)||void 0===t?void 0:t.value.length)>m?null==C||C(d):null==C||C(null!=j?j:""))}),[null===(a=null==y?void 0:y.current)||void 0===a?void 0:a.value.length]),t.jsxs(u.OuterContainer,{children:[t.jsxs(u.Container,Object.assign({isError:!!j},{children:[t.jsx(s.WhatsAppTextEditorHeader,{actions:T,ref:y,onActionSelect:function(e){if((null==h?void 0:h[e])&&y.current){const t=y.current.selectionStart;if(t===y.current.selectionEnd){H(null==h?void 0:h[e],t);const{text:n,html:r}=H(null==h?void 0:h[e],t);L(t+1),null==f||f(n,r)}else{const{text:t,html:n}=S(null==h?void 0:h[e]);null==f||f(t,n)}}},RightComponent:x,onEmojiClick:function(e){const{text:t,html:n}=R(e);null==f||f(t,n)}}),t.jsx(u.TextSpace,Object.assign({ref:y,onChange:function(e){const t=e.target.value,n=v.getHTML(t);null==f||f(t,n)}},O,{rows:E}))]})),j&&j!==d?t.jsxs("div",Object.assign({style:{display:"flex",gap:6,alignItems:"center"}},{children:[t.jsx(n.default,{width:16,height:16,color:o.COLORS.content.negative}),t.jsx(i.BodyCaption,Object.assign({color:o.COLORS.content.negative},{children:j}))]})):t.jsx(t.Fragment,{children:m&&(null==y?void 0:y.current)?t.jsxs(i.BodyCaption,Object.assign({style:{color:j===d||(null===(p=null==y?void 0:y.current)||void 0===p?void 0:p.value.length)>m?o.COLORS.content.negative:o.COLORS.content.secondary}},{children:[y.current.value.length,"/",m]})):t.jsx(t.Fragment,{})})]})}));p.displayName="WhatsAppTextEditor",exports.WhatsAppTextEditor=p;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),r=require("react"),t=require("styled-components"),l=require("uuid"),i=require("../../constants/Theme.js"),s=require("../add-variableV2/AddVariableBox.styled.js"),n=require("../floater/floater.js"),u=require("../input/Input.js"),c=require("../TypographyStyle.js"),o=require("../variable-picker-v3/VariablePicker.js"),d=require("../variable-picker-v3/model.js"),v=require("./customPortal.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const b=p(t).default.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
margin-bottom: 12px;
|
|
4
4
|
input {
|
|
5
5
|
color: ${e=>e.isVar?i.COLORS.stroke.brand:"black"};
|
|
6
6
|
}
|
|
7
|
-
`;exports.InputWithVariables=
|
|
7
|
+
`;exports.InputWithVariables=t=>{let{type:i,allowMix:p,onChange:h,prevVariable:x,variablesList:j,onBlur:y,onlyVariables:g,placeHolder:T,showAddButton:f=!0,showHelp:V,errorMessage:m,maxCharLimit:k,noMaxCharCheck:C,labelText:E,labelElement:O,isRequired:S=!1,hintText:q,onEnterPress:P,pickerType:w=d.PickerType.FLOATER,portalElement:R,showVarHeader:F,varHeaderText:A,onPickerToggle:D}=t;const M=r.useRef(),B=r.useRef(!0),I=r.useRef(null),[L,H]=r.useState(!1),[N]=r.useState(l.v4()),[$,z]=r.useState(),[_,K]=r.useState(x),[W,G]=r.useState(!1),[J,Q]=r.useState(!1),[U,X]=r.useState(0);return r.useEffect((()=>{if($&&$.actualValue)if(p){if(K((e=>{return{actualValue:(a=e.actualValue,r=$.actualValue,t=U,a.slice(0,t)+r+a.slice(t)),variableType:"string"};var a,r,t})),I.current){X(I.current.selectionStart);const e=U+$.actualValue.length+2;I.current.setSelectionRange(e,e),X(e)}}else K((e=>({actualValue:$.actualValue,variableType:$.variableType,needsFetching:$.needsFetching})))}),[$]),r.useEffect((()=>{B.current?B.current=!1:h(_)}),[_]),e.jsxs(e.Fragment,{children:[e.jsxs(b,Object.assign({isVar:/^{{.*}}$/.test(_.actualValue),onKeyDown:e=>{"Enter"===e.key&&(null==P||P(_.actualValue))}},{children:[e.jsx(u.Input,{isRequired:S,hintText:q,type:null!=i?i:"text",id:N,ref:I,skipFocus:!0,isActive:L,value:_.actualValue,validate:e=>[!0,""],errorMessage:m,noMaxCharCheck:C,maxCharLimit:k,labelText:E,labelElement:O,placeholder:T||"Add a value",onClick:e=>{I.current&&X(I.current.selectionStart)},onChangeText:(e,a)=>{if(I.current&&X(I.current.selectionStart),g){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||K({actualValue:"",variableType:"string"})}else K(p?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{H(!0),Q(!0)},onBlur:e=>{var a,r,t,l,i,s;null==y||y(e,_),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"variable-picker-v3"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)||(null===(l=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===l?void 0:l.includes("accordion"))||"back-btn-v3"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(I.current&&I.current.focus(),H(!0)):"search-bar-v3-picker"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?H(!0):(H(!1),G(!1),null==D||D(!1),Q(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[_.actualValue&&V&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(c.BodyCaption,{children:`This value is of type ${_.variableType}`})})),f&&J&&e.jsx("div",Object.assign({style:{marginTop:m||q?"-24px":"0px"}},{children:e.jsx(s.AddVariableStyled,Object.assign({ref:M,id:"addVar",onClick:()=>{G(!W),null==D||D(!W)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),W&&e.jsx(e.Fragment,{children:w===d.PickerType.EMBEDDED?e.jsx(v.CustomPortal,Object.assign({zIndex:101,element:null!=R?R:document.body},{children:e.jsx(o.VariablePicker,{width:"344px",showHeader:F,headerText:A,onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.EMBEDDED,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})})):e.jsx("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:e.jsx(n.Floater,Object.assign({refElement:M},{children:e.jsx("div",Object.assign({style:{height:500}},{children:e.jsx(o.VariablePicker,{onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.FLOATER,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})}))}))}))})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../button/Button.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplatePreview.styled.js");const s="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=s,exports.default=r=>{let{template:o,handleViewTemplate:i,hideHeader:l,hideViewButton:p,containerStyle:d,emailHtmlContainerId:c,emailDisplayContent:u,applyBorderBottom:m}=r;return e.jsxs(n.EmailContainer,Object.assign({hideHeader:l,style:Object.assign({},null!=d?d:{})},{children:[!l&&e.jsx(n.Header,{children:e.jsx(a.TitleRegular,Object.assign({style:{maxWidth:"100%"}},{children:o.name}))}),e.jsx(n.IframeContainer,Object.assign({applyBorderBottom:m},{children:u?e.jsx("iframe",{title:"Email template preview",id:null!=c?c:"",width:"100%",srcDoc:(x=u,x.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${s}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../button/Button.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplatePreview.styled.js");const s="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=s,exports.default=r=>{let{template:o,handleViewTemplate:i,hideHeader:l,hideViewButton:p,containerStyle:d,emailHtmlContainerId:c,emailDisplayContent:u,applyBorderBottom:m}=r;return e.jsxs(n.EmailContainer,Object.assign({hideHeader:l,style:Object.assign({},null!=d?d:{})},{children:[!l&&e.jsx(n.Header,{children:e.jsx(a.TitleRegular,Object.assign({style:{maxWidth:"100%"}},{children:o.name}))}),e.jsx(n.IframeContainer,Object.assign({applyBorderBottom:m},{children:u?e.jsx("iframe",{title:"Email template preview",id:null!=c?c:"",width:"100%",srcDoc:(x=u,x.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${s}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"auto"}}):e.jsx(n.ImageContainer,Object.assign({hideHeader:l},{children:e.jsx(n.CardLoadingContainer,{})}))})),!p&&e.jsx(n.ViewButton,{children:e.jsx(t.Button,{buttonType:"tertiary",buttonText:"View",onClick:()=>{i&&i()}})})]}));var x};
|
|
@@ -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"),
|
|
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"),u=require("../list-item/ListItem.js"),h=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:T,autoOpenFirst:B,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%",outline:"none"},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,borderTopLeftRadius:4,borderTopRightRadius:4}},{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(h.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:B&&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+F):e.displayName?s.jsx(b.Tooltip,Object.assign({body:O.renderTooltipBody(e),placement:"bottom"},{children:s.jsx(u.ListItem,{variant:f.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||f.disabled?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: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(T){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(T){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;
|
|
@@ -17,7 +17,6 @@ export interface VariablePickerV3Props {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
autoOpenFirst?: boolean;
|
|
19
19
|
headerText?: string;
|
|
20
|
-
contentHeight?: string;
|
|
21
20
|
}
|
|
22
21
|
export interface VariableListInterfaceV3 {
|
|
23
22
|
isSubHeader?: boolean;
|
|
@@ -55,6 +54,4 @@ export interface VariableV3 {
|
|
|
55
54
|
[key: string]: VariableV3;
|
|
56
55
|
};
|
|
57
56
|
needsFetching?: boolean;
|
|
58
|
-
isDefaultValueSupported?: boolean;
|
|
59
|
-
enableDefaultValueForGlobalUsage?: boolean;
|
|
60
57
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
-
openDefault?: boolean | undefined;
|
|
3
|
-
}, never>;
|
|
1
|
+
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
2
|
export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
3
|
export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
4
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);const i=o.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
padding:
|
|
4
|
+
padding: 12px 16px 0px 16px;
|
|
5
5
|
background-color: ${t.COLORS.surface.subdued};
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
border-top-right-radius: 4px;
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
padding: 12px 16px;
|
|
14
14
|
background-color: ${t.COLORS.surface.subdued};
|
|
15
15
|
border-bottom: 1px solid ${t.COLORS.stroke.primary};
|
|
16
|
-
`,
|
|
16
|
+
`,d=o.default.div`
|
|
17
17
|
position: relative;
|
|
18
18
|
display: flex;
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: center;
|
|
21
21
|
height: 32px;
|
|
22
22
|
background-color: ${t.COLORS.background.base};
|
|
23
|
-
`,
|
|
23
|
+
`,p=o.default.div`
|
|
24
24
|
margin: 8px;
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-direction: column;
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
&::-webkit-scrollbar-thumb:horizontal {
|
|
40
40
|
width: 8px;
|
|
41
41
|
}
|
|
42
|
-
`;exports.BackHeader=
|
|
42
|
+
`;exports.BackHeader=d,exports.Container=p,exports.HeaderWrapper=i,exports.RecommendWrapper=a;
|
|
@@ -12,7 +12,6 @@ export type CustomEditorProps = React.TextareaHTMLAttributes<HTMLTextAreaElement
|
|
|
12
12
|
* Calls only for editor only error, not for errors coming from outside
|
|
13
13
|
*/
|
|
14
14
|
onError?: (err: string) => void;
|
|
15
|
-
onClickVariable?: (variable: string) => void;
|
|
16
15
|
};
|
|
17
16
|
export type CustomEditorRef = {
|
|
18
17
|
addTextOrWrap: (textToAdd: string) => {
|
|
@@ -38,5 +37,4 @@ export declare const WhatsAppTextEditor: React.ForwardRefExoticComponent<React.T
|
|
|
38
37
|
* Calls only for editor only error, not for errors coming from outside
|
|
39
38
|
*/
|
|
40
39
|
onError?: ((err: string) => void) | undefined;
|
|
41
|
-
onClickVariable?: ((variable: string) => void) | undefined;
|
|
42
40
|
} & React.RefAttributes<CustomEditorRef>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as
|
|
1
|
+
import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as n,jsx as e,Fragment as r}from"react/jsx-runtime";import l from"../../assets/icons/info.svg.js";import{BaseWhatsappContentLangHelper as o}from"../../helpers/BaseWhatsappContentLang.helper.js";import i,{useRef as u,useImperativeHandle as c,useEffect as s}from"react";import{COLORS as a}from"../../constants/Theme.js";import{BodyCaption as d}from"../TypographyStyle.js";import{OuterContainer as v,Container as m,TextSpace as h}from"./CustomEditor.styled.js";import{EditorActionTypes as f,WhatsAppTextEditorHeader as g}from"./WhatsAppTextEditorHeader.js";const p="Character limit reached",x=new o,j={[f.BOLD]:"*",[f.ITALIC]:"_",[f.STRIKETHROUGH]:"~"},T=i.forwardRef(((o,i)=>{var f,T,{onChange:C,text:E,RightComponent:y,error:O,limit:w,onError:H,rows:L,actions:S}=o,b=t(o,["onChange","text","RightComponent","error","limit","onError","rows","actions"]);const R=u(null);function W(t){const n=null==R?void 0:R.current;null!=n&&(n.selectionStart?(n.focus(),n.selectionEnd=t):n.focus())}function A(t){var n,e;let r=null!==(e=null===(n=R.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(R.current&&t){const n=R.current.selectionStart,e=R.current.selectionEnd,l=t;if(n===e)return I(l);{r=x.wrappWildcard(n,e,l,r);const t=x.getHTML(r);return R.current.value=r,{text:r,html:t}}}return{text:r,html:r}}function I(t){var n,e;let r=null!==(e=null===(n=R.current)||void 0===n?void 0:n.value)&&void 0!==e?e:"";if(R.current&&t){const n=R.current.selectionStart;if(n===R.current.selectionEnd)return M(t,n)}return{text:r,html:r}}function M(t,n){var e,r;let l=null!==(r=null===(e=R.current)||void 0===e?void 0:e.value)&&void 0!==r?r:"";l=l.slice(0,n)+t+l.slice(n);const o=x.getHTML(l);return R.current.value=l,{text:l,html:o}}return c(i,(()=>({addTextOrWrap:A,addText:I,get(){var t,n;return null!==(n=null===(t=R.current)||void 0===t?void 0:t.value)&&void 0!==n?n:""},setCaretPosition:W}))),s((()=>{if(null==R?void 0:R.current){R.current.value=E||"";const t=x.getHTML(E||"");null==C||C(E||"",t)}}),[E]),s((()=>{var t,n;(null===(t=null==R?void 0:R.current)||void 0===t?void 0:t.value)&&w&&((null===(n=null==R?void 0:R.current)||void 0===n?void 0:n.value.length)>w?null==H||H(p):null==H||H(null!=O?O:""))}),[null===(f=null==R?void 0:R.current)||void 0===f?void 0:f.value.length]),n(v,{children:[n(m,Object.assign({isError:!!O},{children:[e(g,{actions:S,ref:R,onActionSelect:function(t){if((null==j?void 0:j[t])&&R.current){const n=R.current.selectionStart;if(n===R.current.selectionEnd){M(null==j?void 0:j[t],n);const{text:e,html:r}=M(null==j?void 0:j[t],n);W(n+1),null==C||C(e,r)}else{const{text:n,html:e}=A(null==j?void 0:j[t]);null==C||C(n,e)}}},RightComponent:y,onEmojiClick:function(t){const{text:n,html:e}=I(t);null==C||C(n,e)}}),e(h,Object.assign({ref:R,onChange:function(t){const n=t.target.value,e=x.getHTML(n);null==C||C(n,e)}},b,{rows:L}))]})),O&&O!==p?n("div",Object.assign({style:{display:"flex",gap:6,alignItems:"center"}},{children:[e(l,{width:16,height:16,color:a.content.negative}),e(d,Object.assign({color:a.content.negative},{children:O}))]})):e(r,{children:w&&(null==R?void 0:R.current)?n(d,Object.assign({style:{color:O===p||(null===(T=null==R?void 0:R.current)||void 0===T?void 0:T.value.length)>w?a.content.negative:a.content.secondary}},{children:[R.current.value.length,"/",w]})):e(r,{})})]})}));T.displayName="WhatsAppTextEditor";export{T as WhatsAppTextEditor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as
|
|
1
|
+
import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as t,useState as i,useEffect as n}from"react";import o from"styled-components";import{v4 as s}from"uuid";import{COLORS as c}from"../../constants/Theme.js";import{AddVariableStyled as d}from"../add-variableV2/AddVariableBox.styled.js";import{Floater as u}from"../floater/floater.js";import{Input as p}from"../input/Input.js";import{BodyCaption as v}from"../TypographyStyle.js";import{VariablePicker as m}from"../variable-picker-v3/VariablePicker.js";import{PickerType as h}from"../variable-picker-v3/model.js";import{CustomPortal as b}from"./customPortal.js";const g=o=>{let{type:c,allowMix:g,onChange:f,prevVariable:T,variablesList:x,onBlur:V,onlyVariables:j,placeHolder:k,showAddButton:C=!0,showHelp:E,errorMessage:O,maxCharLimit:w,noMaxCharCheck:D,labelText:A,labelElement:M,isRequired:S=!1,hintText:B,onEnterPress:F,pickerType:R=h.FLOATER,portalElement:H,showVarHeader:I,varHeaderText:L,onPickerToggle:P}=o;const N=t(),$=t(!0),q=t(null),[z,K]=i(!1),[G]=i(s()),[J,Q]=i(),[U,W]=i(T),[X,Y]=i(!1),[Z,_]=i(!1),[ee,ae]=i(0);return n((()=>{if(J&&J.actualValue)if(g){if(W((e=>{return{actualValue:(a=e.actualValue,l=J.actualValue,r=ee,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),q.current){ae(q.current.selectionStart);const e=ee+J.actualValue.length+2;q.current.setSelectionRange(e,e),ae(e)}}else W((e=>({actualValue:J.actualValue,variableType:J.variableType,needsFetching:J.needsFetching})))}),[J]),n((()=>{$.current?$.current=!1:f(U)}),[U]),e(a,{children:[e(y,Object.assign({isVar:/^{{.*}}$/.test(U.actualValue),onKeyDown:e=>{"Enter"===e.key&&(null==F||F(U.actualValue))}},{children:[l(p,{isRequired:S,hintText:B,type:null!=c?c:"text",id:G,ref:q,skipFocus:!0,isActive:z,value:U.actualValue,validate:e=>[!0,""],errorMessage:O,noMaxCharCheck:D,maxCharLimit:w,labelText:A,labelElement:M,placeholder:k||"Add a value",onClick:e=>{q.current&&ae(q.current.selectionStart)},onChangeText:(e,a)=>{if(q.current&&ae(q.current.selectionStart),j){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||W({actualValue:"",variableType:"string"})}else W(g?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{K(!0),_(!0)},onBlur:e=>{var a,l,r,t,i,n;null==V||V(e,U),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"variable-picker-v3"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(t=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===t?void 0:t.includes("accordion"))||"back-btn-v3"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(q.current&&q.current.focus(),K(!0)):"search-bar-v3-picker"===(null===(n=e.relatedTarget)||void 0===n?void 0:n.id)?K(!0):(K(!1),Y(!1),null==P||P(!1),_(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[U.actualValue&&E&&l("div",Object.assign({style:{marginTop:4}},{children:l(v,{children:`This value is of type ${U.variableType}`})})),C&&Z&&l("div",Object.assign({style:{marginTop:O||B?"-24px":"0px"}},{children:l(d,Object.assign({ref:N,id:"addVar",onClick:()=>{Y(!X),null==P||P(!X)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),X&&l(a,{children:R===h.EMBEDDED?l(b,Object.assign({zIndex:101,element:null!=H?H:document.body},{children:l(m,{width:"344px",showHeader:I,headerText:L,onClose:()=>{Y(!1),null==P||P(!1)},type:h.EMBEDDED,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})})):l("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:l(u,Object.assign({refElement:N},{children:l("div",Object.assign({style:{height:500}},{children:l(m,{onClose:()=>{Y(!1),null==P||P(!1)},type:h.FLOATER,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})}))}))}))})]})},y=o.div`
|
|
2
2
|
position: relative;
|
|
3
3
|
margin-bottom: 12px;
|
|
4
4
|
input {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Button as a}from"../button/Button.js";import{TitleRegular as n}from"../TypographyStyle.js";import{EmailContainer as s,Header as r,IframeContainer as o,ImageContainer as p,CardLoadingContainer as i,ViewButton as l}from"./EmailTemplatePreview.styled.js";const d="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c",c=c=>{let{template:m,handleViewTemplate:u,hideHeader:h,hideViewButton:y,containerStyle:b,emailHtmlContainerId:g,emailDisplayContent:f,applyBorderBottom:C}=c;return e(s,Object.assign({hideHeader:h,style:Object.assign({},null!=b?b:{})},{children:[!h&&t(r,{children:t(n,Object.assign({style:{maxWidth:"100%"}},{children:m.name}))}),t(o,Object.assign({applyBorderBottom:C},{children:f?t("iframe",{title:"Email template preview",id:null!=g?g:"",width:"100%",srcDoc:(j=f,j.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${d}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Button as a}from"../button/Button.js";import{TitleRegular as n}from"../TypographyStyle.js";import{EmailContainer as s,Header as r,IframeContainer as o,ImageContainer as p,CardLoadingContainer as i,ViewButton as l}from"./EmailTemplatePreview.styled.js";const d="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c",c=c=>{let{template:m,handleViewTemplate:u,hideHeader:h,hideViewButton:y,containerStyle:b,emailHtmlContainerId:g,emailDisplayContent:f,applyBorderBottom:C}=c;return e(s,Object.assign({hideHeader:h,style:Object.assign({},null!=b?b:{})},{children:[!h&&t(r,{children:t(n,Object.assign({style:{maxWidth:"100%"}},{children:m.name}))}),t(o,Object.assign({applyBorderBottom:C},{children:f?t("iframe",{title:"Email template preview",id:null!=g?g:"",width:"100%",srcDoc:(j=f,j.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${d}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"auto"}}):t(p,Object.assign({hideHeader:h},{children:t(i,{})}))})),!y&&t(l,{children:t(a,{buttonType:"tertiary",buttonText:"View",onClick:()=>{u&&u()}})})]}));var j};export{d as DEFAULT_IMAGE,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as
|
|
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 T,Container as N}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]})},R=/.*\..*/,L=e=>{if(e.actualValue.match(R)){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},H=R=>{const{data:H,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D,headerText:F}=R,[K,q]=r(H),[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(H)}),[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(H)})),se=()=>{let e=131;return M.length>0&&(e+=32),(R.showHeader||R.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%",outline:"none"},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:()=>R.onClose&&R.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{R.onSearchBlur&&R.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(T,{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]]:H,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(H,M);q(e)}else q(H)}})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:M[M.length-1].displayName}))]}),t(i,{children:K.length>0?t(N,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=R.disabled)&&void 0!==l&&l,searchText:G,variable:e.variables,onSelect:$})}))}),e.displayName+X):e.displayName?t(u,Object.assign({body:I(e),placement:"bottom"},{children:t(g,{variant:R.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||R.disabled?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: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(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(V,{disabled:null!==(r=R.disabled)&&void 0!==r&&r,searchText:G,variable:e,onSelect:e=>{if(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(O,{height:se(),searchText:G})})]}))}))};export{H as VariablePickerContent,B as highlightSearchText};
|
|
@@ -17,7 +17,6 @@ export interface VariablePickerV3Props {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
autoOpenFirst?: boolean;
|
|
19
19
|
headerText?: string;
|
|
20
|
-
contentHeight?: string;
|
|
21
20
|
}
|
|
22
21
|
export interface VariableListInterfaceV3 {
|
|
23
22
|
isSubHeader?: boolean;
|
|
@@ -55,6 +54,4 @@ export interface VariableV3 {
|
|
|
55
54
|
[key: string]: VariableV3;
|
|
56
55
|
};
|
|
57
56
|
needsFetching?: boolean;
|
|
58
|
-
isDefaultValueSupported?: boolean;
|
|
59
|
-
enableDefaultValueForGlobalUsage?: boolean;
|
|
60
57
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
-
openDefault?: boolean | undefined;
|
|
3
|
-
}, never>;
|
|
1
|
+
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
2
|
export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
3
|
export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
4
|
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from"styled-components";import{COLORS as t}from"../../constants/Theme.js";const o=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
padding:
|
|
4
|
+
padding: 12px 16px 0px 16px;
|
|
5
5
|
background-color: ${t.surface.subdued};
|
|
6
6
|
justify-content: space-between;
|
|
7
7
|
border-top-right-radius: 4px;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),a=require("../button/Button.js"),t=require("../checkBox/CheckBox.js"),s=require("../input/Input.js"),r=require("../TypographyStyle.js");exports.DefaultVariableContent=l=>{var n,d,o;const[u,c]=i.useState(l.variable.defaultValue||""),[p,x]=i.useState(""),[b,g]=i.useState(!!(null===(n=l.variable)||void 0===n?void 0:n.enableDefaultValueForGlobalUsage));return e.jsx(e.Fragment,{children:e.jsxs("div",Object.assign({style:{padding:"0 16px",paddingTop:12,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:[e.jsx("div",Object.assign({style:{paddingBottom:16,borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(r.TitleRegular,{children:null===(d=l.variable)||void 0===d?void 0:d.displayName})})),e.jsxs("div",Object.assign({style:{paddingTop:24}},{children:[e.jsx(s.Input,{onChangeText:e=>{x(""),c(e)},value:u,isRequired:!0,labelText:"Default Value",hintText:"Used if this field is missing for a customer",errorMessage:null!=p?p:"",maxCharLimit:25}),e.jsxs("div",Object.assign({style:{paddingTop:24,gap:8,alignItems:"flex-start"},className:"d-flex"},{children:[e.jsx(t.CheckBox,{isChecked:b,onValueChange:e=>g(e),size:"SMALL",skipHoverState:!0}),e.jsx(r.BodySecondary,Object.assign({style:{marginTop:-2}},{children:`Make this the default value for ‘${null===(o=l.variable)||void 0===o?void 0:o.displayName}’`}))]})),e.jsx("div",Object.assign({style:{padding:"24px 0px",display:"flex",flexDirection:"row",justifyContent:"flex-end"}},{children:e.jsx(a.Button,{buttonText:"Insert Variable",buttonType:"primary",onClick:()=>{if(!u)return void x("This field is required");const e=Object.assign(Object.assign({},l.variable),{defaultValue:u,enableDefaultValueForGlobalUsage:b});l.onInsertVariable(e)}})}))]}))]}))})};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e,Fragment as i,jsxs as a}from"react/jsx-runtime";import{useState as t}from"react";import{Button as l}from"../button/Button.js";import{CheckBox as r}from"../checkBox/CheckBox.js";import{Input as o}from"../input/Input.js";import{TitleRegular as s,BodySecondary as n}from"../TypographyStyle.js";const d=d=>{var p,u,c;const[b,f]=t(d.variable.defaultValue||""),[g,m]=t(""),[h,v]=t(!!(null===(p=d.variable)||void 0===p?void 0:p.enableDefaultValueForGlobalUsage));return e(i,{children:a("div",Object.assign({style:{padding:"0 16px",paddingTop:12,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:[e("div",Object.assign({style:{paddingBottom:16,borderBottom:"1px solid #E0E0E0"}},{children:e(s,{children:null===(u=d.variable)||void 0===u?void 0:u.displayName})})),a("div",Object.assign({style:{paddingTop:24}},{children:[e(o,{onChangeText:e=>{m(""),f(e)},value:b,isRequired:!0,labelText:"Default Value",hintText:"Used if this field is missing for a customer",errorMessage:null!=g?g:"",maxCharLimit:25}),a("div",Object.assign({style:{paddingTop:24,gap:8,alignItems:"flex-start"},className:"d-flex"},{children:[e(r,{isChecked:h,onValueChange:e=>v(e),size:"SMALL",skipHoverState:!0}),e(n,Object.assign({style:{marginTop:-2}},{children:`Make this the default value for ‘${null===(c=d.variable)||void 0===c?void 0:c.displayName}’`}))]})),e("div",Object.assign({style:{padding:"24px 0px",display:"flex",flexDirection:"row",justifyContent:"flex-end"}},{children:e(l,{buttonText:"Insert Variable",buttonType:"primary",onClick:()=>{if(!b)return void m("This field is required");const e=Object.assign(Object.assign({},d.variable),{defaultValue:b,enableDefaultValueForGlobalUsage:h});d.onInsertVariable(e)}})}))]}))]}))})};export{d as DefaultVariableContent};
|