@bikdotai/bik-component-library 0.0.566-beta.picker.1 → 0.0.566-beta.tp-1
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/input-with-vars/InputWithVariables.js +2 -2
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +6 -6
- 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 -4
- 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/input-with-vars/InputWithVariables.js +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +0 -2
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +0 -3
- package/dist/esm/components/template-context-mapper/modalElements/Body.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 -4
- 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"),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,
|
|
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)}})}))}))}))})]})};
|
|
@@ -7,7 +7,6 @@ import { EmailTemplateType } from '../template-preview/models/EmailTemplate';
|
|
|
7
7
|
import { SMSTemplateType } from '../template-preview/models/SmsTemplate';
|
|
8
8
|
import { CUSTOM_VARIABLE, GlobalPlaceholderType } from '../template-preview/models/TemplateMeta';
|
|
9
9
|
import { ExtrasWhatsapp, POD, WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
|
|
10
|
-
import { VariableV3 } from '../variable-picker-v3/model';
|
|
11
10
|
export interface TemplateContextMapperProps {
|
|
12
11
|
selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate;
|
|
13
12
|
closeDialog?: () => void;
|
|
@@ -55,6 +54,5 @@ export interface TemplateContextMapperProps {
|
|
|
55
54
|
setFileName?: (name: string) => void;
|
|
56
55
|
hideDeviceContainerInPreview?: boolean;
|
|
57
56
|
maxCharLimit?: number;
|
|
58
|
-
onDefaultVariableSelect?: (variable: VariableV3) => void;
|
|
59
57
|
}
|
|
60
58
|
export declare const TemplateContextMapper: React.FC<TemplateContextMapperProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateSelectModalContent.js"),c=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=p=>{let{selectedTemplate:v,closeDialog:m,showVariableMapping:h,channel:C,htmlContent:S,templateVariables:b,onTemplateSelect:E,globalPlaceholders:x,showOnlyContent:P,whatsappSpecificPickerMeta:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateSelectModalContent.js"),c=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=p=>{let{selectedTemplate:v,closeDialog:m,showVariableMapping:h,channel:C,htmlContent:S,templateVariables:b,onTemplateSelect:E,globalPlaceholders:x,showOnlyContent:P,whatsappSpecificPickerMeta:g,zIndex:f,showVariableModal:T,variableList:L,discountCode:I,setDiscountCode:j,onBackPress:y,enabledCustomText:w,variableListForImage:M,showSampleValues:A,disableEditVariable:k,pod:H,extras:N,pickerConf:V,selectedCarouselProducts:D,disableEditExpiry:O,cardWidth:q,onDeleteSelectedProducts:B,fileName:F,setFileName:_,hideDeviceContainerInPreview:W,maxCharLimit:R}=p;var Y,z,$,U,G,J,K,Q;l.useEffect((()=>{re(S)}),[S]);const X=C===s.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(z=null===(Y=null==v?void 0:v.components)||void 0===Y?void 0:Y[1])||void 0===z?void 0:z.type),Z=null==v?void 0:v.isProductCarouselType,[ee,te]=l.useState(C===s.CHANNEL_TYPE.EMAIL||X?"desktop":"mobile"),[le,oe]=l.useState(!1),[ae,re]=l.useState(S),[se,ie]=l.useState(!1),[ne,de]=l.useState([]),[ue,ce]=l.useState({}),[pe,ve]=l.useState(v),[me,he]=l.useState([]),[Ce,Se]=l.useState(null),[be,Ee]=l.useState(!1),[xe,Pe]=l.useState(null!=b?b:[]),[ge,fe]=l.useState(!1),[Te,Le]=l.useState(X?(null===(U=null===($=null==pe?void 0:pe.mapping)||void 0===$?void 0:$.body)||void 0===U?void 0:U.length)?-1:0:-1),[Ie,je]=l.useState([]),[ye,we]=l.useState(void 0),Me=l.useRef(null),[Ae,ke]=l.useState(!1),[He,Ne]=l.useState(!1),[Ve,De]=l.useState(!1),[Oe,qe]=l.useState({});l.useEffect((()=>{D?je(D):Z&&je([])}),[D]),l.useEffect((()=>{var e;if(!be&&Z&&(!D||0===je.length)){const t=null===(e=null==pe?void 0:pe.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),he(l),Ee(!0)}}),[be]);const Be=l.useMemo((()=>c.convertPlaceholdersToBikDropdown(x)),[x]);return l.useEffect((()=>{we(t.cloneDeep(L))}),[L]),e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Ve,setHideFooterButton:De,hideCrossButton:He,setHideCrossButton:Ne,variableList:ye,setVariableList:we,variableCallback:Ce,setVariableCallback:Se,showVariablePicker:le,setShowVariablePicker:oe,template:pe,setTemplate:ve,device:ee,setDevice:te,display_content:ae,setDisplayContent:re,originalVariableList:xe,setOriginalVariableList:Pe,isError:se,setIsError:ie,channel:C,globalNormalizedPlaceholders:Be,templateSelectionTriggered:ge,setTemplateSelectionTriggered:fe,enabledCustomText:w,disableEditVariable:k,pod:H,extras:N,isWhatsappCarousel:X,selectedCarouselIndex:Te,setSelectedCarouselIndex:Le,isProductCarouselType:Z,templateErrorIndexes:ue,cardCount:X?null===(J=null===(G=v.components)||void 0===G?void 0:G[1].cards)||void 0===J?void 0:J.length:void 0,errorIndexes:ne,setErrorIndexes:de,pickerConf:V,carouselProducts:Ie,setCarouselProducts:je,disableEditExpiry:O,cardWidth:q,cardImages:me,onDeleteSelectedProducts:B,hideDeviceContainerInPreview:W,sliderRef:Me,isCarouselHovered:Ae,setIsCarouselHovered:ke,maxCharLimit:R,ctaOptionsErrors:Oe,setCtaOptionsErrors:qe}},{children:P?e.jsx(u.default,{variableListFromProps:L,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(r.StyledModal,Object.assign({hideCrossButton:He,zIndex:f,centralContainerStyles:{width:X?900:C===s.CHANNEL_TYPE.EMAIL&&h?1e3:800},open:!0,onClose:()=>{null==m||m()},headingTitle:null==pe?void 0:pe.label,headingSubtitle:C===s.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(K=null==pe?void 0:pe.category)&&void 0!==K?K:"")} • ${null!==(Q=null==pe?void 0:pe.templateCategory)&&void 0!==Q?Q:""}`:"",onBackPress:()=>{null==y||y()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(u.default,{variableListFromProps:L,showSampleValues:A,showVariableMapping:h,channel:C,whatsappSpecificPickerMeta:g,showVariableModal:T,discountCode:I,setDiscountCode:j,variableListForImage:M&&(null==M?void 0:M.length)>0?M:ye,fileName:F,setFileName:e=>{null==_||_(e)}}),E?e.jsx(d.default,{isWhatsappCarousel:null!=X&&X,onSelect:function(){var e;if((null==Ie?void 0:Ie.length)<1&&Z)return void ie(!0);if(Object.keys(Oe).length>0&&H!==i.POD.CHATBOT)return void ie(!0);const t=null==E?void 0:E(pe,xe,null!=ae?ae:"",Ie);ce(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&de(t.errorIndexes),(null==t?void 0:t.error)&&ie(!!(null==t?void 0:t.error))):fe(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { VariableV3 } from "../../../helpers";
|
|
2
1
|
import React, { LegacyRef } from 'react';
|
|
3
2
|
import Slider from 'react-slick';
|
|
4
3
|
import { VariableListInterfaceV2 } from "../../add-variableV2";
|
|
@@ -75,7 +74,6 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
75
74
|
setCtaOptionsErrors?: React.Dispatch<React.SetStateAction<{
|
|
76
75
|
[key: string]: string;
|
|
77
76
|
}>> | undefined;
|
|
78
|
-
onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
|
|
79
77
|
}>;
|
|
80
78
|
export declare const useTemplateModalContext: () => {
|
|
81
79
|
hideFooterButton: boolean;
|
|
@@ -142,5 +140,4 @@ export declare const useTemplateModalContext: () => {
|
|
|
142
140
|
setCtaOptionsErrors?: React.Dispatch<React.SetStateAction<{
|
|
143
141
|
[key: string]: string;
|
|
144
142
|
}>> | undefined;
|
|
145
|
-
onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
|
|
146
143
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var t=require("../../variable-picker-v3/model.js"),a=require("lodash"),i=require("react"),l=require("styled-components"),o=require("../../carousel-preview/CarouselPreview.js"),r=require("./EditWhatsAppCarouselTemplateV2.js"),s=require("../../template-preview/models/Channels.js"),n=require("../../TypographyStyle.js"),d=require("../../variable-picker-v3/VariablePicker.js"),p=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),u=require("../utils/constants.js"),h=require("../utils/getVariableNameEmail.js"),m=require("../utils/highlightFor.js"),C=require("./DesktopPreview.js"),v=require("./EditWhatsAppTemplateV2.js"),w=require("./MobilePreview.js"),P=require("./VariableConnectorsPanel.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(l);const g=b.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
// height: 100%;
|
|
4
|
-
`,
|
|
4
|
+
`,E=b.default.div`
|
|
5
5
|
max-width: 450px;
|
|
6
6
|
max-width: ${e=>e.channel===s.CHANNEL_TYPE.EMAIL?"400px":"450px"};
|
|
7
7
|
|
|
8
8
|
height: ${e=>e.channel===s.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
|
|
9
9
|
overflow-y: auto;
|
|
10
10
|
padding-bottom: 24px;
|
|
11
|
-
border-left: ${
|
|
12
|
-
border-top: ${e=>e.isWhatsappCarousel?`${
|
|
11
|
+
border-left: ${p.COLORS.stroke.primary} 1px solid;
|
|
12
|
+
border-top: ${e=>e.isWhatsappCarousel?`${p.COLORS.stroke.primary} 1px solid`:void 0};
|
|
13
13
|
${e=>!e.showVariableMapping&&"width: 340px; height: 500px"};
|
|
14
|
-
`,
|
|
14
|
+
`,f=b.default.div`
|
|
15
15
|
padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
|
|
16
16
|
flex: 1;
|
|
17
17
|
height: ${e=>e.isWhatsappCarousel||e.hideDeviceContainerInPreview?"500px":"475px"};
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
background-image: ${e=>e.hideDeviceContainerInPreview&&e.channel===s.CHANNEL_TYPE.WHATSAPP?`url(${u.BACKGROUND_PREVIEW_IMAGE});`:"none"};
|
|
20
20
|
display: ${e=>e.hideDeviceContainerInPreview&&e.channel===s.CHANNEL_TYPE.WHATSAPP?"flex":"initial"};
|
|
21
21
|
align-items: flex-start;
|
|
22
|
-
`;exports.default=l=>{const{showVariableMapping:u,showOnlyContent:
|
|
22
|
+
`;exports.default=l=>{const{showVariableMapping:u,showOnlyContent:x,whatsappSpecificPickerMeta:b,showVariableModal:j,discountCode:A,setDiscountCode:y,variableListForImage:N,showSampleValues:T,variableListFromProps:S,fileName:L,setFileName:k}=l,M=i.useRef(),V=i.useRef(),{variableList:_,setVariableList:H,variableCallback:q,showVariablePicker:O,setShowVariablePicker:W,device:I,display_content:D,channel:F,template:Y,setTemplate:B,isWhatsappCarousel:$,isProductCarouselType:R,hideDeviceContainerInPreview:G}=c.useTemplateModalContext();const K=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(g,{children:[e.jsx(f,Object.assign({showOnlyContent:x,showVariableMapping:u,isWhatsappCarousel:$,hideDeviceContainerInPreview:G,channel:F},{children:"mobile"===I?e.jsx(w.default,{ref:V,display_content:null!=D?D:"",channel:F,template:Y,showSampleValues:T}):F===s.CHANNEL_TYPE.WHATSAPP&&$?e.jsx(o.CarouselPreview,{ref:M,channel:F,template:Y,showSampleValues:T,isPreview:!1,showArrows:!0}):F!==s.CHANNEL_TYPE.MESSAGE?e.jsx(C.default,{ref:M,channel:F,display_content:null!=D?D:"",showSampleValues:T}):e.jsx(e.Fragment,{})})),(R||u)&&e.jsxs(E,Object.assign({channel:F,isWhatsappCarousel:$,showVariableMapping:!0},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:"whatsapp"===F?428:400,display:O?"block":"none"}},{children:e.jsx(d.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{H(a.cloneDeep(S)),W(!1)},onSelect:e=>{q(e),H(a.cloneDeep(S)),W(!1)},type:t.PickerType.EMBEDDED,data:null!=_?_:[]},Math.random())})),e.jsx("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===F?428:400,display:O?"none":"block"}},{children:F!==s.CHANNEL_TYPE.WHATSAPP?e.jsx(P.default,{onFocus:F===s.CHANNEL_TYPE.EMAIL?function(e){var t,a,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===I?"template_html_mobile":"template_html_desktop"),o=h.getVariableNameForEmailByIndex(e+1),r=F===s.CHANNEL_TYPE.EMAIL?null===(t=null==l?void 0:l.contentWindow)||void 0===t?void 0:t.document.getElementById(o):document.getElementById(o),n=K(r),d=null==r?void 0:r.offsetLeft;"desktop"===I?n&&M.current&&(null===(a=null==l?void 0:l.contentWindow)||void 0===a||a.scrollTo(null!=d?d:0,n),m.highlightFor(o,p.COLORS.background.warning.light,2,F,I)):n&&V.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=d?d:0,n),m.highlightFor(o,p.COLORS.background.warning.light,2,F,I))}:void 0,showVariableModal:j,discountCode:A,setDiscountCode:y}):F===s.CHANNEL_TYPE.WHATSAPP&&$?e.jsx(r.default,{whatsappSpecificPickerMeta:b,template:Y,showVariableModal:j,variableListForImage:N,discountCode:A,setDiscountCode:y}):e.jsx(v.default,{whatsappSpecificPickerMeta:b,template:Y,onTemplateChange:e=>{null==B||B(e)},showVariableModal:j,variableListForImage:N,discountCode:A,setDiscountCode:y,fileName:L,setFileName:k})}))]})),[s.CHANNEL_TYPE.WHATSAPP,s.CHANNEL_TYPE.SMS].includes(F)&&!u&&!R&&e.jsx(E,{children:e.jsx(n.BodySecondary,Object.assign({color:p.COLORS.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};
|
|
@@ -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
|
|
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:"none"}}):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,8 +17,6 @@ export interface VariablePickerV3Props {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
autoOpenFirst?: boolean;
|
|
19
19
|
headerText?: string;
|
|
20
|
-
contentHeight?: string;
|
|
21
|
-
onDefaultVariableSelect?: (variable: VariableV3) => void;
|
|
22
20
|
}
|
|
23
21
|
export interface VariableListInterfaceV3 {
|
|
24
22
|
isSubHeader?: boolean;
|
|
@@ -56,6 +54,4 @@ export interface VariableV3 {
|
|
|
56
54
|
[key: string]: VariableV3;
|
|
57
55
|
};
|
|
58
56
|
needsFetching?: boolean;
|
|
59
|
-
isDefaultValueSupported?: boolean;
|
|
60
|
-
enableDefaultValueForGlobalUsage?: boolean;
|
|
61
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 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
|
|
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 {
|
|
@@ -7,7 +7,6 @@ import { EmailTemplateType } from '../template-preview/models/EmailTemplate';
|
|
|
7
7
|
import { SMSTemplateType } from '../template-preview/models/SmsTemplate';
|
|
8
8
|
import { CUSTOM_VARIABLE, GlobalPlaceholderType } from '../template-preview/models/TemplateMeta';
|
|
9
9
|
import { ExtrasWhatsapp, POD, WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
|
|
10
|
-
import { VariableV3 } from '../variable-picker-v3/model';
|
|
11
10
|
export interface TemplateContextMapperProps {
|
|
12
11
|
selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate;
|
|
13
12
|
closeDialog?: () => void;
|
|
@@ -55,6 +54,5 @@ export interface TemplateContextMapperProps {
|
|
|
55
54
|
setFileName?: (name: string) => void;
|
|
56
55
|
hideDeviceContainerInPreview?: boolean;
|
|
57
56
|
maxCharLimit?: number;
|
|
58
|
-
onDefaultVariableSelect?: (variable: VariableV3) => void;
|
|
59
57
|
}
|
|
60
58
|
export declare const TemplateContextMapper: React.FC<TemplateContextMapperProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as
|
|
1
|
+
import{jsx as e,jsxs as o,Fragment as l}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as r,useState as i,useRef as a,useMemo as s}from"react";import n from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{CHANNEL_TYPE as c}from"../template-preview/models/Channels.js";import{POD as p}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as m}from"./context/templateModalContext.js";import v from"./modalElements/Footer.js";import h from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as b}from"./utils/convertPlaceholdersToBikDropdown.js";const C=C=>{let{selectedTemplate:g,closeDialog:f,showVariableMapping:x,channel:P,htmlContent:E,templateVariables:I,onTemplateSelect:S,globalPlaceholders:T,showOnlyContent:y,whatsappSpecificPickerMeta:w,zIndex:L,showVariableModal:V,variableList:k,discountCode:j,setDiscountCode:M,onBackPress:A,enabledCustomText:D,variableListForImage:B,showSampleValues:F,disableEditVariable:H,pod:O,extras:W,pickerConf:N,selectedCarouselProducts:z,disableEditExpiry:R,cardWidth:$,onDeleteSelectedProducts:U,fileName:_,setFileName:q,hideDeviceContainerInPreview:G,maxCharLimit:J}=C;var K,Q,X,Y,Z,ee,oe,le;r((()=>{ue(E)}),[E]);const te=P===c.WHATSAPP&&"CAROUSEL"===(null===(Q=null===(K=null==g?void 0:g.components)||void 0===K?void 0:K[1])||void 0===Q?void 0:Q.type),re=null==g?void 0:g.isProductCarouselType,[ie,ae]=i(P===c.EMAIL||te?"desktop":"mobile"),[se,ne]=i(!1),[de,ue]=i(E),[ce,pe]=i(!1),[me,ve]=i([]),[he,be]=i({}),[Ce,ge]=i(g),[fe,xe]=i([]),[Pe,Ee]=i(null),[Ie,Se]=i(!1),[Te,ye]=i(null!=I?I:[]),[we,Le]=i(!1),[Ve,ke]=i(te?(null===(Y=null===(X=null==Ce?void 0:Ce.mapping)||void 0===X?void 0:X.body)||void 0===Y?void 0:Y.length)?-1:0:-1),[je,Me]=i([]),[Ae,De]=i(void 0),Be=a(null),[Fe,He]=i(!1),[Oe,We]=i(!1),[Ne,ze]=i(!1),[Re,$e]=i({});r((()=>{z?Me(z):re&&Me([])}),[z]),r((()=>{var e;if(!Ie&&re&&(!z||0===Me.length)){const o=null===(e=null==Ce?void 0:Ce.components)||void 0===e?void 0:e[1].cards,l=[];null==o||o.forEach((e=>{var o;null===(o=null==e?void 0:e.components)||void 0===o||o.forEach((e=>{var o,t,r;"HEADER"===e.type&&l.push(null!==(r=null===(t=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),xe(l),Se(!0)}}),[Ie]);const Ue=s((()=>b(T)),[T]);return r((()=>{De(t(k))}),[k]),e(m.Provider,Object.assign({value:{hideFooterButton:Ne,setHideFooterButton:ze,hideCrossButton:Oe,setHideCrossButton:We,variableList:Ae,setVariableList:De,variableCallback:Pe,setVariableCallback:Ee,showVariablePicker:se,setShowVariablePicker:ne,template:Ce,setTemplate:ge,device:ie,setDevice:ae,display_content:de,setDisplayContent:ue,originalVariableList:Te,setOriginalVariableList:ye,isError:ce,setIsError:pe,channel:P,globalNormalizedPlaceholders:Ue,templateSelectionTriggered:we,setTemplateSelectionTriggered:Le,enabledCustomText:D,disableEditVariable:H,pod:O,extras:W,isWhatsappCarousel:te,selectedCarouselIndex:Ve,setSelectedCarouselIndex:ke,isProductCarouselType:re,templateErrorIndexes:he,cardCount:te?null===(ee=null===(Z=g.components)||void 0===Z?void 0:Z[1].cards)||void 0===ee?void 0:ee.length:void 0,errorIndexes:me,setErrorIndexes:ve,pickerConf:N,carouselProducts:je,setCarouselProducts:Me,disableEditExpiry:R,cardWidth:$,cardImages:fe,onDeleteSelectedProducts:U,hideDeviceContainerInPreview:G,sliderRef:Be,isCarouselHovered:Fe,setIsCarouselHovered:He,maxCharLimit:J,ctaOptionsErrors:Re,setCtaOptionsErrors:$e}},{children:y?e(h,{variableListFromProps:k,channel:c.EMAIL,hideHeader:!0}):o(u,Object.assign({hideCrossButton:Oe,zIndex:L,centralContainerStyles:{width:te?900:P===c.EMAIL&&x?1e3:800},open:!0,onClose:()=>{null==f||f()},headingTitle:null==Ce?void 0:Ce.label,headingSubtitle:P===c.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(oe=null==Ce?void 0:Ce.category)&&void 0!==oe?oe:"")} • ${null!==(le=null==Ce?void 0:Ce.templateCategory)&&void 0!==le?le:""}`:"",onBackPress:()=>{null==A||A()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(h,{variableListFromProps:k,showSampleValues:F,showVariableMapping:x,channel:P,whatsappSpecificPickerMeta:w,showVariableModal:V,discountCode:j,setDiscountCode:M,variableListForImage:B&&(null==B?void 0:B.length)>0?B:Ae,fileName:_,setFileName:e=>{null==q||q(e)}}),S?e(v,{isWhatsappCarousel:null!=te&&te,onSelect:function(){var e;if((null==je?void 0:je.length)<1&&re)return void pe(!0);if(Object.keys(Re).length>0&&O!==p.CHATBOT)return void pe(!0);const o=null==S?void 0:S(Ce,Te,null!=de?de:"",je);be(null!==(e=null==o?void 0:o.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==o?void 0:o.errorIndexes)||(null==o?void 0:o.error)?((null==o?void 0:o.errorIndexes)&&ve(o.errorIndexes),(null==o?void 0:o.error)&&pe(!!(null==o?void 0:o.error))):Le(!0)}}):e(l,{})]}))}))};export{C as TemplateContextMapper};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { VariableV3 } from "../../../helpers";
|
|
2
1
|
import React, { LegacyRef } from 'react';
|
|
3
2
|
import Slider from 'react-slick';
|
|
4
3
|
import { VariableListInterfaceV2 } from "../../add-variableV2";
|
|
@@ -75,7 +74,6 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
75
74
|
setCtaOptionsErrors?: React.Dispatch<React.SetStateAction<{
|
|
76
75
|
[key: string]: string;
|
|
77
76
|
}>> | undefined;
|
|
78
|
-
onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
|
|
79
77
|
}>;
|
|
80
78
|
export declare const useTemplateModalContext: () => {
|
|
81
79
|
hideFooterButton: boolean;
|
|
@@ -142,5 +140,4 @@ export declare const useTemplateModalContext: () => {
|
|
|
142
140
|
setCtaOptionsErrors?: React.Dispatch<React.SetStateAction<{
|
|
143
141
|
[key: string]: string;
|
|
144
142
|
}>> | undefined;
|
|
145
|
-
onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
|
|
146
143
|
};
|
|
@@ -19,4 +19,4 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import"../../cur
|
|
|
19
19
|
background-image: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.WHATSAPP?`url(${u});`:"none"};
|
|
20
20
|
display: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.WHATSAPP?"flex":"initial"};
|
|
21
21
|
align-items: flex-start;
|
|
22
|
-
`,
|
|
22
|
+
`,k=n=>{const{showVariableMapping:u,showOnlyContent:k,whatsappSpecificPickerMeta:S,showVariableModal:j,discountCode:A,setDiscountCode:M,variableListForImage:V,showSampleValues:W,variableListFromProps:T,fileName:E,setFileName:I}=n,D=l(),$=l(),{variableList:H,setVariableList:L,variableCallback:B,showVariablePicker:F,setShowVariablePicker:O,device:_,display_content:N,channel:G,template:q,setTemplate:z,isWhatsappCarousel:J,isProductCarouselType:K,hideDeviceContainerInPreview:Q}=h();const R=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e(P,{children:[t(y,Object.assign({showOnlyContent:k,showVariableMapping:u,isWhatsappCarousel:J,hideDeviceContainerInPreview:Q,channel:G},{children:"mobile"===_?t(g,{ref:$,display_content:null!=N?N:"",channel:G,template:q,showSampleValues:W}):G===p.WHATSAPP&&J?t(r,{ref:D,channel:G,template:q,showSampleValues:W,isPreview:!1,showArrows:!0}):G!==p.MESSAGE?t(f,{ref:D,channel:G,display_content:null!=N?N:"",showSampleValues:W}):t(o,{})})),(K||u)&&e(x,Object.assign({channel:G,isWhatsappCarousel:J,showVariableMapping:!0},{children:[t("div",Object.assign({style:{height:"100%",width:"whatsapp"===G?428:400,display:F?"block":"none"}},{children:t(c,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{L(a(T)),O(!1)},onSelect:e=>{B(e),L(a(T)),O(!1)},type:i.EMBEDDED,data:null!=H?H:[]},Math.random())})),t("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===G?428:400,display:F?"none":"block"}},{children:G!==p.WHATSAPP?t(C,{onFocus:G===p.EMAIL?function(e){var t,o,i;const a=null===document||void 0===document?void 0:document.getElementById("mobile"===_?"template_html_mobile":"template_html_desktop"),l=w(e+1),n=G===p.EMAIL?null===(t=null==a?void 0:a.contentWindow)||void 0===t?void 0:t.document.getElementById(l):document.getElementById(l),r=R(n),s=null==n?void 0:n.offsetLeft;"desktop"===_?r&&D.current&&(null===(o=null==a?void 0:a.contentWindow)||void 0===o||o.scrollTo(null!=s?s:0,r),v(l,m.background.warning.light,2,G,_)):r&&$.current&&(null===(i=null==a?void 0:a.contentWindow)||void 0===i||i.scrollTo(null!=s?s:0,r),v(l,m.background.warning.light,2,G,_))}:void 0,showVariableModal:j,discountCode:A,setDiscountCode:M}):G===p.WHATSAPP&&J?t(s,{whatsappSpecificPickerMeta:S,template:q,showVariableModal:j,variableListForImage:V,discountCode:A,setDiscountCode:M}):t(b,{whatsappSpecificPickerMeta:S,template:q,onTemplateChange:e=>{null==z||z(e)},showVariableModal:j,variableListForImage:V,discountCode:A,setDiscountCode:M,fileName:E,setFileName:I})}))]})),[p.WHATSAPP,p.SMS].includes(G)&&!u&&!K&&t(x,{children:t(d,Object.assign({color:m.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};export{k as default};
|
|
@@ -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
|
|
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:"none"}}):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 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
|
|
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,8 +17,6 @@ export interface VariablePickerV3Props {
|
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
autoOpenFirst?: boolean;
|
|
19
19
|
headerText?: string;
|
|
20
|
-
contentHeight?: string;
|
|
21
|
-
onDefaultVariableSelect?: (variable: VariableV3) => void;
|
|
22
20
|
}
|
|
23
21
|
export interface VariableListInterfaceV3 {
|
|
24
22
|
isSubHeader?: boolean;
|
|
@@ -56,6 +54,4 @@ export interface VariableV3 {
|
|
|
56
54
|
[key: string]: VariableV3;
|
|
57
55
|
};
|
|
58
56
|
needsFetching?: boolean;
|
|
59
|
-
isDefaultValueSupported?: boolean;
|
|
60
|
-
enableDefaultValueForGlobalUsage?: boolean;
|
|
61
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};
|