@bikdotai/bik-component-library 0.0.507 → 0.0.508-beta-err
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/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/input/Input.d.ts +1 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +2 -0
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +7 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/validateName.d.ts +1 -0
- package/dist/cjs/components/template-context-mapper/utils/validateName.js +1 -0
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +4 -0
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +5 -3
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/input/Input.d.ts +1 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +2 -0
- package/dist/esm/components/template-context-mapper/modalElements/Body.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +7 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/validateName.d.ts +1 -0
- package/dist/esm/components/template-context-mapper/utils/validateName.js +1 -0
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.js +2 -2
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +4 -0
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +6 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -57,5 +57,6 @@ export interface InputProps {
|
|
|
57
57
|
autoGrow?: boolean;
|
|
58
58
|
minHeight?: string;
|
|
59
59
|
maxHeight?: string;
|
|
60
|
+
labelTextBold?: boolean;
|
|
60
61
|
}
|
|
61
62
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | null>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/info.svg.js"),n=require("react"),i=require("../button/Button.js"),r=require("./Input-helper.js"),s=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/info.svg.js"),n=require("react"),i=require("../button/Button.js"),r=require("./Input-helper.js"),s=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),a=require("../../constants/Theme.js"),o=require("../../assets/icons/errorInfo.svg.js"),u=require("./context/InputStyleProvider.js"),c=require("./Input.styled.js");const d=n.forwardRef(((d,h)=>{var v,p,x,g,j;const{placeholder:f,leftIcon:y,rightIcon:b,labelText:m,maxCharLimit:C,isRequired:I,hintText:O,type:w,state:S,validate:T,variant:E,button:k,suffixText:q,prefixText:H,onChangeText:F,value:L,noErrorHint:R,reset:B,rangeValidation:M,noKeyDownChange:z,version:A,noMaxCharCheck:D,labelElement:_,autoGrow:K,minHeight:P,maxHeight:G,labelTextBold:N}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},d),W=null==y?void 0:y.icon,V=null==b?void 0:b.icon,[$,J]=n.useState(!1),[Q,U]=n.useState(!1),[X,Y]=n.useState(),Z="small"===E?"18px":"22px",ee=n.useContext(u.InputStyleContext),[te,ne]=n.useState(),ie=n.useRef(null),re=null!=h?h:ie;n.useEffect((()=>{ne(L),!L&&K&&(re.current.style.height=P||"48px")}),[L]),n.useEffect((()=>{var e;re.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,re.current))}),[re]),n.useEffect((()=>{const e=re.current;if(e&&["phonenumber","zip","number"].includes(w))return e.addEventListener("wheel",oe,{passive:!1}),()=>{e.removeEventListener("wheel",oe)}}),[]),n.useEffect((()=>{B&&ne("")}),[B]),n.useEffect((()=>{var e;U(!!d.isActive),d.isActive&&(null===(e=re.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{Y(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;J(!1),("invalid"===d.state||X||"disabled-invalid"===d.state)&&J(!0),"active"===d.state&&(null===(e=re.current)||void 0===e||e.focus())}),[d.state,X]),n.useEffect((()=>{J(!!X)}),[X]);const se=function(e){if(r.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},le=()=>"zip"===w?6:60,ae=e=>{const t=0!==C?C:le();if(z||F(L||"",e),D)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},oe=e=>{e.preventDefault()},ue=e=>{let t=e.target.value;const n=0!==C?C+1:le();!D&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),F(t,e),d.textControl||ne(t),K&&(re.current.style.height=`${re.current.scrollHeight}px`,t||(re.current.style.height=P||"48px"));const i=T||r.validateInput;if(!i||!r.isFunction(i))return;const[s,l]=i(t,w,M);J(!s),Y(d.errorMessage?d.errorMessage:l)},ce=e=>{var t;d.skipFocus||U(!0),se(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},de=e=>{var t;d.skipFocus||U(!1),se(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},he=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==w&&e.jsx("input",{"data-test":d["data-test"],id:d.id,style:null!==(t=null==ee?void 0:ee.input)&&void 0!==t?t:{},ref:re,type:["phonenumber","zip","number"].includes(w)?"number":w,value:te,onFocus:e=>ce(e),onBlur:e=>de(e),placeholder:f||"Enter here",onChange:ue,onClick:e=>se(d.onClick),onKeyDown:e=>ae(e)}),"multiline"===w&&e.jsx("textarea",{"data-test":d["data-test"],value:te,ref:re,onFocus:e=>ce(e),onBlur:e=>de(e),onClick:e=>se(d.onClick),placeholder:f||"Enter here",onChange:ue,onKeyDown:e=>ae(e),maxLength:C>0?C:void 0})]})};return e.jsxs(c.RootContainer,Object.assign({width:d.width,height:d.height,state:S,type:w,style:null!==(v=null==ee?void 0:ee.RootContainer)&&void 0!==v?v:{}},{children:[!R&&(!!O||!!X)&&e.jsxs(c.InputFooter,Object.assign({invalid:!!X},{children:[!!X&&e.jsx(o.default,{width:16,height:16}),X||O]})),e.jsxs(c.InputWrapper,Object.assign({variant:E,state:S,width:d.width,isActive:"active"===S||Q,isInvalid:$,style:null!==(p=null==ee?void 0:ee.InputWrapper)&&void 0!==p?p:{},version:A,height:d.height},{children:[!!W&&e.jsx(c.IconHolder,Object.assign({variant:E,iconSize:Z,onClick:()=>se(null==y?void 0:y.callback),isLeft:!0,style:null!==(x=null==ee?void 0:ee.IconHolder)&&void 0!==x?x:{}},{children:e.jsx(W,{})})),!!H&&e.jsx(c.PrefixHolder,Object.assign({variant:E},{children:H})),"default"===E&&e.jsx(c.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:P,maxHeight:G,autoGrow:K},{children:he()})),"small"===E&&e.jsx(c.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:he()})),!!V&&e.jsx(c.IconHolder,Object.assign({variant:E,iconSize:Z,onClick:()=>se(null==b?void 0:b.callback),isLeft:!1},{children:e.jsx(V,{})})),!!q&&e.jsx(c.SuffixHolder,Object.assign({variant:E},{children:q})),k&&k.text&&e.jsx(i.Button,{buttonText:k.text,onClick:()=>se(null==k?void 0:k.onClick)})]})),(!!m||!!C)&&e.jsxs(c.InputHeader,Object.assign({invalid:$},{children:[_&&_,e.jsxs("div",Object.assign({className:"label__container"},{children:[N?e.jsxs(l.TitleSmall,{children:[m,I?e.jsx("span",{children:"*"}):""]}):e.jsxs(l.BodySecondary,{children:[m,I?e.jsx("span",{children:"*"}):""]}),d.tooltipText&&e.jsx(s.Tooltip,Object.assign({body:d.tooltipText,placement:"top"},{children:e.jsx("span",{children:e.jsx(t.default,{style:{marginTop:-3},width:18,height:18,color:$?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),C>0&&e.jsxs(c.MaxCharStyle,{children:[null!==(j=null===(g=d.value)||void 0===g?void 0:g.length)&&void 0!==j?j:0,"/",C]})]}))]}))}));d.displayName="Input",exports.Input=d;
|
|
@@ -46,5 +46,7 @@ export interface TemplateContextMapperProps {
|
|
|
46
46
|
disableEditExpiry?: boolean;
|
|
47
47
|
cardWidth?: number;
|
|
48
48
|
onDeleteSelectedProducts?: () => void;
|
|
49
|
+
fileName?: string;
|
|
50
|
+
setFileName?: (name: string) => void;
|
|
49
51
|
}
|
|
50
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, pickerConf, selectedCarouselProducts, disableEditExpiry, cardWidth, onDeleteSelectedProducts, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, pickerConf, selectedCarouselProducts, disableEditExpiry, cardWidth, onDeleteSelectedProducts, fileName, setFileName, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),o=require("../template-preview/models/Channels.js"),s=require("./context/templateModalContext.js"),r=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js"),d=require("./utils/validateName.js");exports.TemplateContextMapper=u=>{let{selectedTemplate:c,closeDialog:p,showVariableMapping:v,channel:m,htmlContent:h,templateVariables:C,onTemplateSelect:E,globalPlaceholders:S,showOnlyContent:x,whatsappSpecificPickerMeta:b,zIndex:g,showVariableModal:P,variableList:f,discountCode:T,setDiscountCode:j,onBackPress:I,enabledCustomText:M,variableListForImage:N,showSampleValues:L,disableEditVariable:y,pod:A,extras:w,pickerConf:V,selectedCarouselProducts:q,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:H,fileName:_,setFileName:F}=u;var O,W,Y,B,z,R;l.useEffect((()=>{Q(h)}),[h]);const U=m===o.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(W=null===(O=null==c?void 0:c.components)||void 0===O?void 0:O[1])||void 0===W?void 0:W.type),$=null==c?void 0:c.isProductCarouselType,[G,J]=l.useState(m===o.CHANNEL_TYPE.EMAIL||U?"desktop":"mobile"),[K,Q]=l.useState(h),[X,Z]=l.useState(!1),[ee,le]=l.useState([]),[te,ae]=l.useState(c),[oe,se]=l.useState([]),[re,ie]=l.useState(!1),[ne,de]=l.useState(null!=C?C:[]),[ue,ce]=l.useState(!1),[pe,ve]=l.useState(-1),[me,he]=l.useState([]),[Ce,Ee]=l.useState(_);l.useEffect((()=>{q?he(q):$&&he([])}),[q]),l.useEffect((()=>{var e;if(!re&&$&&(!q||0===he.length)){const l=null===(e=null==te?void 0:te.components)||void 0===e?void 0:e[1].cards,t=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,a,o;"HEADER"===e.type&&t.push(null!==(o=null===(a=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===a?void 0:a[0])&&void 0!==o?o:"")}))})),se(t),ie(!0)}}),[re]);const Se=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(S)),[S]);return e.jsx(s.TemplateModalContext.Provider,Object.assign({value:{template:te,setTemplate:ae,device:G,setDevice:J,display_content:K,setDisplayContent:Q,originalVariableList:ne,setOriginalVariableList:de,isError:X,setIsError:Z,channel:m,globalNormalizedPlaceholders:Se,templateSelectionTriggered:ue,setTemplateSelectionTriggered:ce,enabledCustomText:M,disableEditVariable:y,pod:A,extras:w,isWhatsappCarousel:U,selectedCarouselIndex:pe,setSelectedCarouselIndex:ve,isProductCarouselType:$,cardCount:U?null===(B=null===(Y=c.components)||void 0===Y?void 0:Y[1].cards)||void 0===B?void 0:B.length:void 0,errorIndexes:ee,setErrorIndexes:le,pickerConf:V,carouselProducts:me,setCarouselProducts:he,disableEditExpiry:D,cardWidth:k,cardImages:oe,onDeleteSelectedProducts:H}},{children:x?e.jsx(i.default,{channel:o.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:g,centralContainerStyles:{width:U?900:m===o.CHANNEL_TYPE.EMAIL&&v?1e3:800},open:!0,onClose:()=>{null==p||p()},headingTitle:null==te?void 0:te.label,headingSubtitle:m===o.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(z=null==te?void 0:te.category)&&void 0!==z?z:"")} • ${null!==(R=null==te?void 0:te.templateCategory)&&void 0!==R?R:""}`:"",onBackPress:()=>{null==I||I()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:v,channel:m,whatsappSpecificPickerMeta:b,showVariableModal:P,variableList:f,discountCode:T,setDiscountCode:j,variableListForImage:N&&(null==N?void 0:N.length)>0?N:f,fileName:_,setFileName:e=>{null==F||F(e),Ee(e)}}),E?e.jsx(r.default,{isWhatsappCarousel:null!=U&&U,onSelect:function(){if((null==me?void 0:me.length)<1&&$)return void Z(!0);if(!Ce||d.validateInputName(Ce))return void Z(!0);const e=null==E?void 0:E(te,ne,null!=K?K:"",me);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&le(e.errorIndexes),(null==e?void 0:e.error)&&Z(!!(null==e?void 0:e.error))):ce(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -10,6 +10,8 @@ export interface BodyProps {
|
|
|
10
10
|
discountCode?: string;
|
|
11
11
|
setDiscountCode?: (code: string) => void;
|
|
12
12
|
showSampleValues?: boolean;
|
|
13
|
+
fileName?: string;
|
|
14
|
+
setFileName?: (name: string) => void;
|
|
13
15
|
}
|
|
14
16
|
declare const Body: (props: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default Body;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("styled-components"),l=require("../../carousel-preview/CarouselPreview.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("styled-components"),l=require("../../carousel-preview/CarouselPreview.js"),i=require("./EditWhatsAppCarouselTemplateV2.js"),o=require("../../template-preview/models/Channels.js"),s=require("../../../constants/Theme.js"),r=require("../context/templateModalContext.js"),n=require("../utils/getVariableNameEmail.js"),u=require("../utils/highlightFor.js"),d=require("./DesktopPreview.js"),p=require("./EditWhatsAppTemplateV2.js"),c=require("./MobilePreview.js"),h=require("./VariableConnectorsPanel.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(a);const v=f.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
// height: 100%;
|
|
4
|
-
`,f
|
|
4
|
+
`,C=f.default.div`
|
|
5
5
|
padding: 16px 14px;
|
|
6
6
|
max-width: 450px;
|
|
7
7
|
|
|
8
|
-
height: ${e=>e.channel===
|
|
8
|
+
height: ${e=>e.channel===o.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
|
|
9
9
|
overflow-y: auto;
|
|
10
10
|
padding-bottom: 24px;
|
|
11
11
|
border-left: ${s.COLORS.stroke.primary} 1px solid;
|
|
12
12
|
border-top: ${e=>e.isWhatsappCarousel?`${s.COLORS.stroke.primary} 1px solid`:void 0};
|
|
13
|
-
`,x=
|
|
13
|
+
`,x=f.default.div`
|
|
14
14
|
padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
|
|
15
15
|
flex: 1;
|
|
16
16
|
height: ${e=>e.isWhatsappCarousel?"500px":"475px"};
|
|
17
17
|
overflow-y: auto;
|
|
18
|
-
`;exports.default=a=>{const{showVariableMapping:m,showOnlyContent:
|
|
18
|
+
`;exports.default=a=>{const{showVariableMapping:m,showOnlyContent:f,whatsappSpecificPickerMeta:g,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j,variableListForImage:E,showSampleValues:L,fileName:T,setFileName:A}=a,N=t.useRef(),y=t.useRef(),{device:S,display_content:M,channel:_,template:V,setTemplate:W,isWhatsappCarousel:q,isProductCarouselType:O}=r.useTemplateModalContext();const F=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(v,{children:[e.jsx(x,Object.assign({showOnlyContent:f,showVariableMapping:m,isWhatsappCarousel:q},{children:"mobile"===S?e.jsx(c.default,{ref:y,display_content:null!=M?M:"",channel:_,template:V,showSampleValues:L}):_===o.CHANNEL_TYPE.WHATSAPP&&q?e.jsx(l.CarouselPreview,{ref:N,channel:_,template:V,showSampleValues:L,isPreview:!1}):_!==o.CHANNEL_TYPE.MESSAGE?e.jsx(d.default,{ref:N,channel:_,display_content:null!=M?M:"",showSampleValues:L}):e.jsx(e.Fragment,{})})),(O||m)&&e.jsx(C,Object.assign({channel:_,isWhatsappCarousel:q},{children:_!==o.CHANNEL_TYPE.WHATSAPP?e.jsx(h.default,{onFocus:_===o.CHANNEL_TYPE.EMAIL?function(e){var t,a,l;const i=null===document||void 0===document?void 0:document.getElementById("mobile"===S?"template_html_mobile":"template_html_desktop"),r=n.getVariableNameForEmailByIndex(e+1),d=_===o.CHANNEL_TYPE.EMAIL?null===(t=null==i?void 0:i.contentWindow)||void 0===t?void 0:t.document.getElementById(r):document.getElementById(r),p=F(d),c=null==d?void 0:d.offsetLeft;"desktop"===S?p&&N.current&&(null===(a=null==i?void 0:i.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,_,S)):p&&y.current&&(null===(l=null==i?void 0:i.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,_,S))}:void 0,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j}):_===o.CHANNEL_TYPE.WHATSAPP&&q?e.jsx(i.default,{whatsappSpecificPickerMeta:g,template:V,showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j}):e.jsx(p.default,{whatsappSpecificPickerMeta:g,template:V,onTemplateChange:e=>{null==W||W(e)},showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j,fileName:T,setFileName:A})}))]})};
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface EditWhatsAppTemplateV2Props {
|
|
|
12
12
|
variableListForImage?: VariableListInterfaceV2[];
|
|
13
13
|
discountCode?: string;
|
|
14
14
|
setDiscountCode?: (code: string) => void;
|
|
15
|
+
fileName?: string;
|
|
16
|
+
setFileName?: (name: string) => void;
|
|
15
17
|
}
|
|
16
|
-
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, fileName, setFileName, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default EditWhatsAppTemplateV2;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("../../template-preview/models/WhatsAppTemplate.js"),i=require("../context/templateModalContext.js"),l=require("../utils/getDataFromTemplateComponent.js"),s=require("./BackTrackComponent.js"),a=require("./DiscountCodeComponent.js"),d=require("./EditMediaV2.style.js"),r=require("./EditWhatsAppTemplateMediaV2.js"),u=require("./VariableConnector.js"),c=require("./VariableConnectorsPanel.js"),p=require("./VariableConnectorWhatsApp.js"),v=require("./VariableEditorHeader.js"),m=require("./WhatsAppTemplateCardButtonV2.js");exports.default=b=>{let{template:g,onTemplateChange:f,whatsappSpecificPickerMeta:j,showVariableModal:O,variableList:C,variableListForImage:h,discountCode:T,setDiscountCode:x}=b;var y,B,V,k,E,L,U,q,D,I,w,R,P,A,M,S,_,N,H,Q,Y;const F=g.isCarouselType,{originalVariableList:K,pod:W,extras:$,selectedCarouselIndex:X,isProductCarouselType:z}=i.useTemplateModalContext(),{descriptionComponents:G,urlBtns:J,qrbBtns:Z,imageComponent:ee,bodyVariables:ne,headerVariables:te}=l.getAllDataFromTemplateComponent(g),[oe,ie]=t.useState(!1),[le,se]=t.useState(-1===X?{descriptionComponents:G,urlBtns:J,qrbBtns:Z,imageComponent:ee,bodyVariables:ne,headerVariables:te}:{}),[ae,de]=t.useState(!1);function re(e,t,o){var i,l,s,a,d,r,u,c,p,v;const m=null!=X&&X>-1?{components:null===(i=Object.assign({},g).components[1].cards)||void 0===i?void 0:i[X].components,mapping:null===(l=Object.assign({},g).mapping.cards)||void 0===l?void 0:l[X]}:Object.assign({},g),b=n.cloneDeep(m),j="custom"===t&&"string"==typeof e,O=j?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=X&&X>-1&&z){const t=Object.assign({},g).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let s=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[O]});const a=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},e),{buttons:a})}return e}))})))}):e})),i=null===(a=null===(s=Object.assign({},g).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>j?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(g);return l.components=t,l.mapping.cards=i,void(null==f||f(Object.assign({},l)))}const C=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==C&&C>-1){const n=null===(d=null==b?void 0:b.components[C].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let s=n[o];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(c=null===(u=null===(r=b.components)||void 0===r?void 0:r[C])||void 0===u?void 0:u.buttons)&&void 0!==c?c:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e)),d=Object.assign(Object.assign({},b.components[C]),{buttons:a}),v=null===(p=b.mapping)||void 0===p?void 0:p.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[C]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?ie(!0):(ie(!1),null==x||x(""))}if(null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=b.components,e.mapping.cards[X]=b.mapping,null==f||f(Object.assign({},e))}else null==f||f(b)}function ue(e,t,o){var i,l,s,a,d,r;const u=null!=X&&X>-1?{components:null===(i=Object.assign({},g).components[1].cards)||void 0===i?void 0:i[X].components,mapping:null===(l=Object.assign({},g).mapping.cards)||void 0===l?void 0:l[X]}:Object.assign({},g);if(null!=X&&X>-1&&z){const t=Object.assign({},g).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const s=null===(t=n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let a=null!==(i=null==s?void 0:s[o])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(g);return i.components=t,void(null==f||f(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null==u?void 0:u.components[c].buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(d=null===(a=u.components)||void 0===a?void 0:a[c])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),s=[...u.components];s[c]=l,u.components=s}}if(null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=u.components,null==f||f(Object.assign({},e))}else null==f||f(u)}return t.useEffect((()=>{var e,n;if(null===(e=g.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))ie(!0);else{ie(!1);const e=null===(n=null==$?void 0:$.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[g]),t.useEffect((()=>{var e,n,t,o;if(null!=X&&X>-1){const i={components:null===(n=null===(e=g.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[X].components,mapping:null===(o=null===(t=null==g?void 0:g.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[X]},{descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}=l.getAllDataFromTemplateComponent(i);se({descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c})}else if(null!=X&&-1===X){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:s}=l.getAllDataFromTemplateComponent(g);se({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:s})}}),[X]),t.useEffect((()=>{var e,n,t,o;if(null!=X&&X>-1&&ae){const i={components:null===(n=null===(e=g.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[X].components,mapping:null===(o=null===(t=null==g?void 0:g.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[X]},{descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}=l.getAllDataFromTemplateComponent(i);se({descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}),de(!1)}}),[ae]),e.jsxs(c.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!le.imageComponent&&!z&&e.jsx(d.EditTemplateMediaContainer,{children:e.jsx(r.default,{whatsappSpecificPickerMeta:j,mediaComponent:F?le.imageComponent:ee,updateTemplateImageUrl:function(e,t){var o,i,l,s,a,d,r,u;let c;c=null!=X&&X>-1?{components:null===(i=null===(o=g.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[X].components,mapping:null===(s=null===(l=null==g?void 0:g.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[X]}:Object.assign({},g);const p=null===(a=null==c?void 0:c.components)||void 0===a?void 0:a.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==p&&p>-1&&(null==c?void 0:c.components[p])){const n=Object.assign(Object.assign({},c.components[p]),{format:t,example:{header_handle:[e]}}),o=[...c.components];o[p]=n,c=Object.assign(Object.assign({},c),{components:o})}if(c.mapping&&(c.mapping=Object.assign(Object.assign({},c.mapping),{header:void 0})),null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=c.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[X]=null!==(u=c.mapping)&&void 0!==u?u:{}),null==f||f(Object.assign({},e)),de(!0)}else null==f||f(Object.assign({},c))},template:g,variableListForImage:h})}),le.bodyVariables.length>0&&e.jsx(v.default,{containerStyle:{paddingTop:le.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(y=le.descriptionComponents)||void 0===y?void 0:y.map(((n,t)=>e.jsx(p.default,{originalVariableList:null!=X&&X>-1?K.cards[X]:K,type:n.type,descriptionComponent:n.component,showVariableModal:O,variableList:C},t))),(null===(V=null===(B=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===B?void 0:B.filter((e=>"URL"===e.type)))||void 0===V?void 0:V.length)>0&&e.jsx(v.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(E=null===(k=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===k?void 0:k.filter((e=>W===o.POD.CHATBOT||"URL"===e.type)))||void 0===E?void 0:E.map(((n,t)=>{if("URL"===n.type)return e.jsx(m.default,{variableListIndex:t,CTAoptions:null==j?void 0:j.CTAoptions,button:n,currentVariableList:null!=X&&X>-1?Object.assign({},K.cards[X]):Object.assign({},K),updateSelectedURLTemplateBtn:re,variableList:C},`${t}_${X}`)})),W===o.POD.CHATBOT&&(null===(U=null===(L=Z[0])||void 0===L?void 0:L.component)||void 0===U?void 0:U.buttons)&&(null===(I=null===(D=null===(q=Z[0])||void 0===q?void 0:q.component)||void 0===D?void 0:D.buttons)||void 0===I?void 0:I.length)>0&&e.jsx(s.BackTrackComponent,{backTrackMessage:null===(w=null==$?void 0:$.backTrackExtra)||void 0===w?void 0:w[0],setBackTrackMessage:null===(R=null==$?void 0:$.backTrackExtra)||void 0===R?void 0:R[1]}),(null===(A=null===(P=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===P?void 0:P.filter((e=>"QUICK_REPLY"===e.type)))||void 0===A?void 0:A.length)>0&&(W!==o.POD.CHATBOT?e.jsx(v.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(s.BackTrackComponent,{backTrackMessage:null===(M=null==$?void 0:$.backTrackExtra)||void 0===M?void 0:M[0],setBackTrackMessage:null===(S=null==$?void 0:$.backTrackExtra)||void 0===S?void 0:S[1]})),null===(N=null===(_=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===_?void 0:_.filter((e=>"QUICK_REPLY"===e.type)))||void 0===N?void 0:N.map(((n,t)=>{if("QUICK_REPLY"===n.type&&W!==o.POD.CHATBOT)return e.jsx(m.default,{variableListIndex:t,QRBoptions:null==j?void 0:j.QRBoptions,button:n,currentVariableList:null!=X&&X>-1?Object.assign({},K.cards[X]):Object.assign({},K),updateSelectedQRBTemplateBtn:ue},`${t}_${X}`)})),W===o.POD.CHATBOT&&oe&&e.jsx(a.DiscountCodeComponent,{discountCode:null===(H=null==$?void 0:$.discountCodeExtra)||void 0===H?void 0:H[0],setDiscountCode:null===(Q=null==$?void 0:$.discountCodeExtra)||void 0===Q?void 0:Q[1],variableList:C}),null===(Y=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===Y?void 0:Y.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(u.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:C,componentType:"BUTTONS"},t)}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),s=require("../../template-preview/models/WhatsAppTemplate.js"),a=require("../context/templateModalContext.js"),d=require("../utils/getDataFromTemplateComponent.js"),r=require("../utils/validateName.js"),u=require("./BackTrackComponent.js"),p=require("./DiscountCodeComponent.js"),c=require("./EditMediaV2.style.js"),v=require("./EditWhatsAppTemplateMediaV2.js"),m=require("./VariableConnector.js"),b=require("./VariableConnectorsPanel.js"),g=require("./VariableConnectorWhatsApp.js"),f=require("./VariableEditorHeader.js"),j=require("./WhatsAppTemplateCardButtonV2.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const O=h(o).default.div`
|
|
2
|
+
padding-top: 24px;
|
|
3
|
+
padding-left: 10px;
|
|
4
|
+
padding-right: 10px;
|
|
5
|
+
margin-bottom: 8px;
|
|
6
|
+
line-height: normal;
|
|
7
|
+
`;exports.default=o=>{let{template:h,onTemplateChange:C,whatsappSpecificPickerMeta:T,showVariableModal:x,variableList:y,variableListForImage:B,discountCode:E,setDiscountCode:V,fileName:k,setFileName:L}=o;var q,D,U,I,P,R,w,A,M,N,S,_,F,H,Q,Y,K,W,$,X,z;const G=h.isCarouselType,{originalVariableList:J,pod:Z,extras:ee,selectedCarouselIndex:ne,isProductCarouselType:te}=a.useTemplateModalContext(),{descriptionComponents:oe,urlBtns:ie,qrbBtns:le,imageComponent:se,bodyVariables:ae,headerVariables:de}=d.getAllDataFromTemplateComponent(h),[re,ue]=t.useState(!1),[pe,ce]=t.useState(-1===ne?{descriptionComponents:oe,urlBtns:ie,qrbBtns:le,imageComponent:se,bodyVariables:ae,headerVariables:de}:{}),[ve,me]=t.useState(!1),[be,ge]=t.useState(k),[fe,je]=t.useState();function he(e,t,o){var i,l,s,a,d,r,u,p,c,v;const m=null!=ne&&ne>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[ne].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[ne]}:Object.assign({},h),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=ne&&ne>-1&&te){const t=Object.assign({},h).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let s=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[f]});const a=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},e),{buttons:a})}return e}))})))}):e})),i=null===(a=null===(s=Object.assign({},h).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(h);return l.components=t,l.mapping.cards=i,void(null==C||C(Object.assign({},l)))}const j=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==j&&j>-1){const n=null===(d=null==b?void 0:b.components[j].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let s=n[o];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(p=null===(u=null===(r=b.components)||void 0===r?void 0:r[j])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e)),d=Object.assign(Object.assign({},b.components[j]),{buttons:a}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[j]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?ue(!0):(ue(!1),null==V||V(""))}if(null!=ne&&ne>-1){const e=n.cloneDeep(h);e.components[1].cards[ne].components=b.components,e.mapping.cards[ne]=b.mapping,null==C||C(Object.assign({},e))}else null==C||C(b)}function Oe(e,t,o){var i,l,s,a,d,r;const u=null!=ne&&ne>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[ne].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[ne]}:Object.assign({},h);if(null!=ne&&ne>-1&&te){const t=Object.assign({},h).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const s=null===(t=n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let a=null!==(i=null==s?void 0:s[o])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(h);return i.components=t,void(null==C||C(Object.assign({},i)))}const p=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==p&&p>-1){const n=null===(s=null==u?void 0:u.components[p].buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(d=null===(a=u.components)||void 0===a?void 0:a[p])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},u.components[p]),{buttons:i}),s=[...u.components];s[p]=l,u.components=s}}if(null!=ne&&ne>-1){const e=n.cloneDeep(h);e.components[1].cards[ne].components=u.components,null==C||C(Object.assign({},e))}else null==C||C(u)}t.useEffect((()=>{var e,n;if(null===(e=h.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))ue(!0);else{ue(!1);const e=null===(n=null==ee?void 0:ee.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[h]),t.useEffect((()=>{var e,n,t,o;if(null!=ne&&ne>-1){const i={components:null===(n=null===(e=h.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ne].components,mapping:null===(o=null===(t=null==h?void 0:h.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ne]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:u,headerVariables:p}=d.getAllDataFromTemplateComponent(i);ce({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:u,headerVariables:p})}else if(null!=ne&&-1===ne){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=d.getAllDataFromTemplateComponent(h);ce({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[ne]),t.useEffect((()=>{var e,n,t,o;if(null!=ne&&ne>-1&&ve){const i={components:null===(n=null===(e=h.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ne].components,mapping:null===(o=null===(t=null==h?void 0:h.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[ne]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:u,headerVariables:p}=d.getAllDataFromTemplateComponent(i);ce({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:u,headerVariables:p}),me(!1)}}),[ve]);return e.jsxs(b.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!pe.imageComponent&&!te&&e.jsxs(c.EditTemplateMediaContainer,{children:[e.jsx(v.default,{whatsappSpecificPickerMeta:T,mediaComponent:G?pe.imageComponent:se,updateTemplateImageUrl:function(e,t){var o,i,l,s,a,d,r,u;let p;p=null!=ne&&ne>-1?{components:null===(i=null===(o=h.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[ne].components,mapping:null===(s=null===(l=null==h?void 0:h.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[ne]}:Object.assign({},h);const c=null===(a=null==p?void 0:p.components)||void 0===a?void 0:a.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==p?void 0:p.components[c])){const n=Object.assign(Object.assign({},p.components[c]),{format:t,example:{header_handle:[e]}}),o=[...p.components];o[c]=n,p=Object.assign(Object.assign({},p),{components:o})}if(p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0})),null!=ne&&ne>-1){const e=n.cloneDeep(h);e.components[1].cards[ne].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==e?void 0:e.mapping)||void 0===r?void 0:r.cards.length)>0&&(e.mapping.cards[ne]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==C||C(Object.assign({},e)),me(!0)}else null==C||C(Object.assign({},p))},template:h,variableListForImage:B}),(null==se?void 0:se.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(O,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:be,errorMessage:fe||void 0,onBlur:()=>{if(!be)return null==L||L(""),void je("PDF name is Required");const e=r.validateInputName(be);null==L||L(be),je(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{je(""),ge(e)}})}):e.jsx(e.Fragment,{})]}),pe.bodyVariables.length>0&&e.jsx(f.default,{containerStyle:{paddingTop:pe.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(q=pe.descriptionComponents)||void 0===q?void 0:q.map(((n,t)=>e.jsx(g.default,{originalVariableList:null!=ne&&ne>-1?J.cards[ne]:J,type:n.type,descriptionComponent:n.component,showVariableModal:x,variableList:y},t))),(null===(U=null===(D=null!=ne&&ne>-1?J.cards[ne].buttons:null==J?void 0:J.buttons)||void 0===D?void 0:D.filter((e=>"URL"===e.type)))||void 0===U?void 0:U.length)>0&&e.jsx(f.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(P=null===(I=null!=ne&&ne>-1?J.cards[ne].buttons:null==J?void 0:J.buttons)||void 0===I?void 0:I.filter((e=>Z===s.POD.CHATBOT||"URL"===e.type)))||void 0===P?void 0:P.map(((n,t)=>{if("URL"===n.type)return e.jsx(j.default,{variableListIndex:t,CTAoptions:null==T?void 0:T.CTAoptions,button:n,currentVariableList:null!=ne&&ne>-1?Object.assign({},J.cards[ne]):Object.assign({},J),updateSelectedURLTemplateBtn:he,variableList:y},`${t}_${ne}`)})),Z===s.POD.CHATBOT&&(null===(w=null===(R=le[0])||void 0===R?void 0:R.component)||void 0===w?void 0:w.buttons)&&(null===(N=null===(M=null===(A=le[0])||void 0===A?void 0:A.component)||void 0===M?void 0:M.buttons)||void 0===N?void 0:N.length)>0&&e.jsx(u.BackTrackComponent,{backTrackMessage:null===(S=null==ee?void 0:ee.backTrackExtra)||void 0===S?void 0:S[0],setBackTrackMessage:null===(_=null==ee?void 0:ee.backTrackExtra)||void 0===_?void 0:_[1]}),(null===(H=null===(F=null!=ne&&ne>-1?J.cards[ne].buttons:null==J?void 0:J.buttons)||void 0===F?void 0:F.filter((e=>"QUICK_REPLY"===e.type)))||void 0===H?void 0:H.length)>0&&(Z!==s.POD.CHATBOT?e.jsx(f.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(u.BackTrackComponent,{backTrackMessage:null===(Q=null==ee?void 0:ee.backTrackExtra)||void 0===Q?void 0:Q[0],setBackTrackMessage:null===(Y=null==ee?void 0:ee.backTrackExtra)||void 0===Y?void 0:Y[1]})),null===(W=null===(K=null!=ne&&ne>-1?J.cards[ne].buttons:null==J?void 0:J.buttons)||void 0===K?void 0:K.filter((e=>"QUICK_REPLY"===e.type)))||void 0===W?void 0:W.map(((n,t)=>{if("QUICK_REPLY"===n.type&&Z!==s.POD.CHATBOT)return e.jsx(j.default,{variableListIndex:t,QRBoptions:null==T?void 0:T.QRBoptions,button:n,currentVariableList:null!=ne&&ne>-1?Object.assign({},J.cards[ne]):Object.assign({},J),updateSelectedQRBTemplateBtn:Oe},`${t}_${ne}`)})),Z===s.POD.CHATBOT&&re&&e.jsx(p.DiscountCodeComponent,{discountCode:null===($=null==ee?void 0:ee.discountCodeExtra)||void 0===$?void 0:$[0],setDiscountCode:null===(X=null==ee?void 0:ee.discountCodeExtra)||void 0===X?void 0:X[1],variableList:y}),null===(z=null!=ne&&ne>-1?J.cards[ne].buttons:null==J?void 0:J.buttons)||void 0===z?void 0:z.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(m.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:y,componentType:"BUTTONS"},t)}))]}))};
|
package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface TemplateSelectModalContentProps {
|
|
|
13
13
|
discountCode?: string;
|
|
14
14
|
setDiscountCode?: (code: string) => void;
|
|
15
15
|
showSampleValues?: boolean;
|
|
16
|
+
fileName?: string;
|
|
17
|
+
setFileName?: (name: string) => void;
|
|
16
18
|
}
|
|
17
|
-
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, variableListForImage, showSampleValues, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, variableListForImage, showSampleValues, fileName, setFileName, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export default TemplateSelectModalContent;
|
package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../template-preview/models/Channels.js"),s=require("./Body.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../template-preview/models/Channels.js"),s=require("./Body.js"),i=require("./Header.js");exports.default=t=>{let{channel:l,showVariableMapping:r,showOnlyContent:o,whatsappSpecificPickerMeta:n,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:m,fileName:w,setFileName:b}=t;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[l===a.CHANNEL_TYPE.EMAIL&&e.jsx(i.default,{showOnlyContent:o}),e.jsx(s.default,{whatsappSpecificPickerMeta:n,showVariableMapping:!!r,showOnlyContent:o,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:m,fileName:w,setFileName:b})]})}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateInputName: (name: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.validateInputName=e=>!!/[^a-zA-Z0-9._ ]/.test(e);
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:
|
|
7
|
+
`;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:g,headerAssetLink:S,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:F,isPreview:O}=a,M=new l.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:d.COLORS.content.primary,margin:12,fontSize:C?d.FONTS.caption.fontSize:d.FONTS.bodySecondary.fontSize,fontWeight:d.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(p.Container,Object.assign({isPreview:O},{children:[e.jsx(u,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(T.default,{bold:!0,text:g}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:S,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!j&&e.jsx(e.Fragment,{children:F?e.jsx(e.Fragment,{children:F}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(j)}}):e.jsx(n.BodySecondary,{children:j})})}),e.jsxs(p.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(p.FooterText,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(p.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(h.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};
|
|
@@ -9,6 +9,10 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
|
|
|
9
9
|
numberOfLines?: number | undefined;
|
|
10
10
|
color?: string | undefined;
|
|
11
11
|
}, never>;
|
|
12
|
+
export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
numberOfLines?: number | undefined;
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
}, never>;
|
|
12
16
|
export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
17
|
export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
18
|
export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
white-space: nowrap;
|
|
22
22
|
overflow: hidden;
|
|
23
23
|
text-wrap: wrap;
|
|
24
|
-
`,s=i.default
|
|
24
|
+
`,s=i.default(d)`
|
|
25
|
+
max-width: 200px;
|
|
26
|
+
`,p=i.default.div`
|
|
25
27
|
border-radius: 8px;
|
|
26
28
|
display: flex;
|
|
27
29
|
flex-direction: column;
|
|
@@ -37,7 +39,7 @@
|
|
|
37
39
|
justify-content: center;
|
|
38
40
|
align-items: center;
|
|
39
41
|
border-top: 1px solid ${r.COLORS.stroke.primary};
|
|
40
|
-
`,
|
|
42
|
+
`,x=i.default.div`
|
|
41
43
|
display: flex;
|
|
42
44
|
flex-direction: row;
|
|
43
45
|
justify-content: space-between;
|
|
@@ -60,4 +62,4 @@
|
|
|
60
62
|
position: absolute;
|
|
61
63
|
top: 16px;
|
|
62
64
|
right: 16px;
|
|
63
|
-
`,exports.ChatBtnContainer=n,exports.Container=a,exports.FooterWrapper=
|
|
65
|
+
`,exports.ChatBtnContainer=n,exports.Container=a,exports.FooterText=s,exports.FooterWrapper=x,exports.MediaContainer=p,exports.TimeStamp=d;
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
`,g=f.default(C)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,E=new u.VariableEditorHelper;exports.ChatUIV2=o=>{const{bodyText:p,footerText:u,headerMediaType:T,headerText:f,headerAssetLink:v,headerAssetName:b,quickReplybtn:q,ctaBtn:O,actionTypes:_,extras:w,showHeader:P,imagePreviewStyles:
|
|
19
|
+
`,E=new u.VariableEditorHelper;exports.ChatUIV2=o=>{const{bodyText:p,footerText:u,headerMediaType:T,headerText:f,headerAssetLink:v,headerAssetName:b,quickReplybtn:q,ctaBtn:O,actionTypes:_,extras:w,showHeader:P,imagePreviewStyles:I,size:S,bodyVariableList:L,headerVariableList:A,buttons:M,limitedTimeOfferComponent:N,carouselCardIndex:R,isWhatsappCarousel:B,isPreview:H}=o,Y=E.format(p,L),F=E.format(f,A),{selectedCarouselIndex:U,isProductCarouselType:D,errorIndexes:V}=n.useTemplateModalContext(),k={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:a.default,QUICK_REPLY:i.default};return e.jsxs(h.Container,Object.assign({isCarouselCard:null!=R&&R>-1,showBorder:null!=R&&R===U||D&&null!=R&&R>-1&&null!=U&&U>-1,hasError:null==V?void 0:V.includes(null!=R?R:-2),isWhatsappCarousel:B,isPreview:H},{children:[!B&&e.jsx(y,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===x.HEADER_TYPES.TEXT?e.jsx(g,{dangerouslySetInnerHTML:{__html:F}}):T!==x.HEADER_TYPES.NONE?e.jsx(j.MediaCard,{headerAssetLink:v,headerAssetName:b,mediaType:T,imagePreviewStyles:T===x.HEADER_TYPES.IMAGE?I:{}}):e.jsx(e.Fragment,{}),(null==N?void 0:N.dateTime)?e.jsx(m.LimitedTimeOffer,{text:N.text,dateTime:N.dateTime,code:N.code}):e.jsx(e.Fragment,{}),!!p&&e.jsx(e.Fragment,{children:e.jsx(C,{dangerouslySetInnerHTML:{__html:Y}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(l.Tooltip,Object.assign({body:null!=u?u:"",placement:"top"},{children:e.jsx(h.FooterText,Object.assign({style:{flex:1}},{children:u}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),M&&M.length>0?M.map(((t,r)=>e.jsx(c.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:k[t.type],size:S},r))):_===x.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==q?void 0:q.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text},r)))}):_===x.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(c.ChatBtn,{textTypography:P?d.Caption:d.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:a.default,size:S},r)))}):e.jsx(e.Fragment,{})]}))};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -57,5 +57,6 @@ export interface InputProps {
|
|
|
57
57
|
autoGrow?: boolean;
|
|
58
58
|
minHeight?: string;
|
|
59
59
|
maxHeight?: string;
|
|
60
|
+
labelTextBold?: boolean;
|
|
60
61
|
}
|
|
61
62
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | null>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"../../assets/icons/info.svg.js";import{forwardRef as r,useState as l,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as u,validateInput as h}from"./Input-helper.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{BodySecondary as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i from"../../assets/icons/info.svg.js";import{forwardRef as r,useState as l,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as u,validateInput as h}from"./Input-helper.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{TitleSmall as v,BodySecondary as p}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";import m from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as f}from"./context/InputStyleProvider.js";import{RootContainer as b,InputFooter as x,InputWrapper as y,IconHolder as j,PrefixHolder as C,InputContainer as w,InputContainerSmall as k,SuffixHolder as O,InputHeader as T,MaxCharStyle as I}from"./Input.styled.js";const H=r(((r,H)=>{var L,E,z,A,B;const{placeholder:D,leftIcon:F,rightIcon:M,labelText:S,maxCharLimit:K,isRequired:R,hintText:G,type:N,state:_,validate:q,variant:P,button:V,suffixText:W,prefixText:$,onChangeText:J,value:Q,noErrorHint:U,reset:X,rangeValidation:Y,noKeyDownChange:Z,version:ee,noMaxCharCheck:te,labelElement:ne,autoGrow:ie,minHeight:re,maxHeight:le,labelTextBold:oe}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},r),ae=null==F?void 0:F.icon,se=null==M?void 0:M.icon,[ce,ue]=l(!1),[he,de]=l(!1),[ve,pe]=l(),ge="small"===P?"18px":"22px",me=o(f),[fe,be]=l(),xe=a(null),ye=null!=H?H:xe;s((()=>{be(Q),!Q&&ie&&(ye.current.style.height=re||"48px")}),[Q]),s((()=>{var e;ye.current&&(null===(e=r.onReferenceInit)||void 0===e||e.call(r,ye.current))}),[ye]),s((()=>{const e=ye.current;if(e&&["phonenumber","zip","number"].includes(N))return e.addEventListener("wheel",ke,{passive:!1}),()=>{e.removeEventListener("wheel",ke)}}),[]),s((()=>{X&&be("")}),[X]),s((()=>{var e;de(!!r.isActive),r.isActive&&(null===(e=ye.current)||void 0===e||e.focus())}),[r.isActive]),s((()=>{pe(r.errorMessage)}),[r.errorMessage]),s((()=>{var e;ue(!1),("invalid"===r.state||ve||"disabled-invalid"===r.state)&&ue(!0),"active"===r.state&&(null===(e=ye.current)||void 0===e||e.focus())}),[r.state,ve]),s((()=>{ue(!!ve)}),[ve]);const je=function(e){if(u(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},Ce=()=>"zip"===N?6:60,we=e=>{const t=0!==K?K:Ce();if(Z||J(Q||"",e),te)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ke=e=>{e.preventDefault()},Oe=e=>{let t=e.target.value;const n=0!==K?K+1:Ce();!te&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),J(t,e),r.textControl||be(t),ie&&(ye.current.style.height=`${ye.current.scrollHeight}px`,t||(ye.current.style.height=re||"48px"));const i=q||h;if(!i||!u(i))return;const[l,o]=i(t,N,Y);ue(!l),pe(r.errorMessage?r.errorMessage:o)},Te=e=>{var t;r.skipFocus||de(!0),je(null===(t=r.onFocus)||void 0===t?void 0:t.call(r,e))},Ie=e=>{var t;r.skipFocus||de(!1),je(null===(t=r.onBlur)||void 0===t?void 0:t.call(r,e))},He=()=>{var i;return e(n,{children:["multiline"!==N&&t("input",{"data-test":r["data-test"],id:r.id,style:null!==(i=null==me?void 0:me.input)&&void 0!==i?i:{},ref:ye,type:["phonenumber","zip","number"].includes(N)?"number":N,value:fe,onFocus:e=>Te(e),onBlur:e=>Ie(e),placeholder:D||"Enter here",onChange:Oe,onClick:e=>je(r.onClick),onKeyDown:e=>we(e)}),"multiline"===N&&t("textarea",{"data-test":r["data-test"],value:fe,ref:ye,onFocus:e=>Te(e),onBlur:e=>Ie(e),onClick:e=>je(r.onClick),placeholder:D||"Enter here",onChange:Oe,onKeyDown:e=>we(e),maxLength:K>0?K:void 0})]})};return e(b,Object.assign({width:r.width,height:r.height,state:_,type:N,style:null!==(L=null==me?void 0:me.RootContainer)&&void 0!==L?L:{}},{children:[!U&&(!!G||!!ve)&&e(x,Object.assign({invalid:!!ve},{children:[!!ve&&t(m,{width:16,height:16}),ve||G]})),e(y,Object.assign({variant:P,state:_,width:r.width,isActive:"active"===_||he,isInvalid:ce,style:null!==(E=null==me?void 0:me.InputWrapper)&&void 0!==E?E:{},version:ee,height:r.height},{children:[!!ae&&t(j,Object.assign({variant:P,iconSize:ge,onClick:()=>je(null==F?void 0:F.callback),isLeft:!0,style:null!==(z=null==me?void 0:me.IconHolder)&&void 0!==z?z:{}},{children:t(ae,{})})),!!$&&t(C,Object.assign({variant:P},{children:$})),"default"===P&&t(w,Object.assign({height:r.height,type:r.type,minHeight:re,maxHeight:le,autoGrow:ie},{children:He()})),"small"===P&&t(k,Object.assign({height:r.height,type:r.type},{children:He()})),!!se&&t(j,Object.assign({variant:P,iconSize:ge,onClick:()=>je(null==M?void 0:M.callback),isLeft:!1},{children:t(se,{})})),!!W&&t(O,Object.assign({variant:P},{children:W})),V&&V.text&&t(c,{buttonText:V.text,onClick:()=>je(null==V?void 0:V.onClick)})]})),(!!S||!!K)&&e(T,Object.assign({invalid:ce},{children:[ne&&ne,e("div",Object.assign({className:"label__container"},{children:[e(oe?v:p,{children:[S,R?t("span",{children:"*"}):""]}),r.tooltipText&&t(d,Object.assign({body:r.tooltipText,placement:"top"},{children:t("span",{children:t(i,{style:{marginTop:-3},width:18,height:18,color:ce?g.content.negative:g.content.primary})})}))]})),K>0&&e(I,{children:[null!==(B=null===(A=r.value)||void 0===A?void 0:A.length)&&void 0!==B?B:0,"/",K]})]}))]}))}));H.displayName="Input";export{H as Input};
|
|
@@ -46,5 +46,7 @@ export interface TemplateContextMapperProps {
|
|
|
46
46
|
disableEditExpiry?: boolean;
|
|
47
47
|
cardWidth?: number;
|
|
48
48
|
onDeleteSelectedProducts?: () => void;
|
|
49
|
+
fileName?: string;
|
|
50
|
+
setFileName?: (name: string) => void;
|
|
49
51
|
}
|
|
50
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, pickerConf, selectedCarouselProducts, disableEditExpiry, cardWidth, onDeleteSelectedProducts, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, pickerConf, selectedCarouselProducts, disableEditExpiry, cardWidth, onDeleteSelectedProducts, fileName, setFileName, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as
|
|
1
|
+
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as i,useMemo as r}from"react";import a from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as s}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import u from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";import{validateInputName as m}from"./utils/validateName.js";const v=v=>{let{selectedTemplate:h,closeDialog:C,showVariableMapping:b,channel:g,htmlContent:f,templateVariables:x,onTemplateSelect:E,globalPlaceholders:P,showOnlyContent:S,whatsappSpecificPickerMeta:I,zIndex:T,showVariableModal:y,variableList:w,discountCode:M,setDiscountCode:j,onBackPress:L,enabledCustomText:V,variableListForImage:A,showSampleValues:D,disableEditVariable:k,pod:F,extras:N,pickerConf:O,selectedCarouselProducts:W,disableEditExpiry:H,cardWidth:z,onDeleteSelectedProducts:B,fileName:R,setFileName:U}=v;var $,_,q,G,J,K;t((()=>{le(f)}),[f]);const Q=g===s.WHATSAPP&&"CAROUSEL"===(null===(_=null===($=null==h?void 0:h.components)||void 0===$?void 0:$[1])||void 0===_?void 0:_.type),X=null==h?void 0:h.isProductCarouselType,[Y,Z]=i(g===s.EMAIL||Q?"desktop":"mobile"),[ee,le]=i(f),[oe,te]=i(!1),[ie,re]=i([]),[ae,ne]=i(h),[se,de]=i([]),[ce,ue]=i(!1),[pe,me]=i(null!=x?x:[]),[ve,he]=i(!1),[Ce,be]=i(-1),[ge,fe]=i([]),[xe,Ee]=i(R);t((()=>{W?fe(W):X&&fe([])}),[W]),t((()=>{var e;if(!ce&&X&&(!W||0===fe.length)){const l=null===(e=null==ae?void 0:ae.components)||void 0===e?void 0:e[1].cards,o=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,t,i;"HEADER"===e.type&&o.push(null!==(i=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==i?i:"")}))})),de(o),ue(!0)}}),[ce]);const Pe=r((()=>p(P)),[P]);return e(d.Provider,Object.assign({value:{template:ae,setTemplate:ne,device:Y,setDevice:Z,display_content:ee,setDisplayContent:le,originalVariableList:pe,setOriginalVariableList:me,isError:oe,setIsError:te,channel:g,globalNormalizedPlaceholders:Pe,templateSelectionTriggered:ve,setTemplateSelectionTriggered:he,enabledCustomText:V,disableEditVariable:k,pod:F,extras:N,isWhatsappCarousel:Q,selectedCarouselIndex:Ce,setSelectedCarouselIndex:be,isProductCarouselType:X,cardCount:Q?null===(G=null===(q=h.components)||void 0===q?void 0:q[1].cards)||void 0===G?void 0:G.length:void 0,errorIndexes:ie,setErrorIndexes:re,pickerConf:O,carouselProducts:ge,setCarouselProducts:fe,disableEditExpiry:H,cardWidth:z,cardImages:se,onDeleteSelectedProducts:B}},{children:S?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:T,centralContainerStyles:{width:Q?900:g===s.EMAIL&&b?1e3:800},open:!0,onClose:()=>{null==C||C()},headingTitle:null==ae?void 0:ae.label,headingSubtitle:g===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(J=null==ae?void 0:ae.category)&&void 0!==J?J:"")} • ${null!==(K=null==ae?void 0:ae.templateCategory)&&void 0!==K?K:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:D,showVariableMapping:b,channel:g,whatsappSpecificPickerMeta:I,showVariableModal:y,variableList:w,discountCode:M,setDiscountCode:j,variableListForImage:A&&(null==A?void 0:A.length)>0?A:w,fileName:R,setFileName:e=>{null==U||U(e),Ee(e)}}),E?e(c,{isWhatsappCarousel:null!=Q&&Q,onSelect:function(){if((null==ge?void 0:ge.length)<1&&X)return void te(!0);if(!xe||m(xe))return void te(!0);const e=null==E?void 0:E(ae,pe,null!=ee?ee:"",ge);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&re(e.errorIndexes),(null==e?void 0:e.error)&&te(!!(null==e?void 0:e.error))):he(!0)}}):e(o,{})]}))}))};export{v as TemplateContextMapper};
|
|
@@ -10,6 +10,8 @@ export interface BodyProps {
|
|
|
10
10
|
discountCode?: string;
|
|
11
11
|
setDiscountCode?: (code: string) => void;
|
|
12
12
|
showSampleValues?: boolean;
|
|
13
|
+
fileName?: string;
|
|
14
|
+
setFileName?: (name: string) => void;
|
|
13
15
|
}
|
|
14
16
|
declare const Body: (props: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
export default Body;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useRef as a}from"react";import i from"styled-components";import{CarouselPreview as l}from"../../carousel-preview/CarouselPreview.js";import s from"./EditWhatsAppCarouselTemplateV2.js";import{CHANNEL_TYPE as n}from"../../template-preview/models/Channels.js";import{COLORS as r}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as m}from"../utils/getVariableNameEmail.js";import{highlightFor as d}from"../utils/highlightFor.js";import c from"./DesktopPreview.js";import u from"./EditWhatsAppTemplateV2.js";import h from"./MobilePreview.js";import f from"./VariableConnectorsPanel.js";const v=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
// height: 100%;
|
|
4
4
|
`,w=i.div`
|
|
@@ -15,4 +15,4 @@ import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import{useRef as
|
|
|
15
15
|
flex: 1;
|
|
16
16
|
height: ${e=>e.isWhatsappCarousel?"500px":"475px"};
|
|
17
17
|
overflow-y: auto;
|
|
18
|
-
`,g=i=>{const{showVariableMapping:g,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j,variableListForImage:M,showSampleValues:V}=i,
|
|
18
|
+
`,g=i=>{const{showVariableMapping:g,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j,variableListForImage:M,showSampleValues:V,fileName:A,setFileName:S}=i,T=a(),k=a(),{device:E,display_content:L,channel:I,template:F,setTemplate:_,isWhatsappCarousel:$,isProductCarouselType:D}=p();const N=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e(v,{children:[t(b,Object.assign({showOnlyContent:C,showVariableMapping:g,isWhatsappCarousel:$},{children:"mobile"===E?t(h,{ref:k,display_content:null!=L?L:"",channel:I,template:F,showSampleValues:V}):I===n.WHATSAPP&&$?t(l,{ref:T,channel:I,template:F,showSampleValues:V,isPreview:!1}):I!==n.MESSAGE?t(c,{ref:T,channel:I,display_content:null!=L?L:"",showSampleValues:V}):t(o,{})})),(D||g)&&t(w,Object.assign({channel:I,isWhatsappCarousel:$},{children:I!==n.WHATSAPP?t(f,{onFocus:I===n.EMAIL?function(e){var t,o,a;const i=null===document||void 0===document?void 0:document.getElementById("mobile"===E?"template_html_mobile":"template_html_desktop"),l=m(e+1),s=I===n.EMAIL?null===(t=null==i?void 0:i.contentWindow)||void 0===t?void 0:t.document.getElementById(l):document.getElementById(l),p=N(s),c=null==s?void 0:s.offsetLeft;"desktop"===E?p&&T.current&&(null===(o=null==i?void 0:i.contentWindow)||void 0===o||o.scrollTo(null!=c?c:0,p),d(l,r.background.warning.light,2,I,E)):p&&k.current&&(null===(a=null==i?void 0:i.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),d(l,r.background.warning.light,2,I,E))}:void 0,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j}):I===n.WHATSAPP&&$?t(s,{whatsappSpecificPickerMeta:x,template:F,showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j}):t(u,{whatsappSpecificPickerMeta:x,template:F,onTemplateChange:e=>{null==_||_(e)},showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j,fileName:A,setFileName:S})}))]})};export{g as default};
|
package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface EditWhatsAppTemplateV2Props {
|
|
|
12
12
|
variableListForImage?: VariableListInterfaceV2[];
|
|
13
13
|
discountCode?: string;
|
|
14
14
|
setDiscountCode?: (code: string) => void;
|
|
15
|
+
fileName?: string;
|
|
16
|
+
setFileName?: (name: string) => void;
|
|
15
17
|
}
|
|
16
|
-
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const EditWhatsAppTemplateV2: ({ template, onTemplateChange, whatsappSpecificPickerMeta, showVariableModal, variableList, variableListForImage, discountCode, setDiscountCode, fileName, setFileName, }: EditWhatsAppTemplateV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default EditWhatsAppTemplateV2;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import{jsxs as n,jsx as o}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useState as e,useEffect as i}from"react";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as a}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as d}from"./BackTrackComponent.js";import{DiscountCodeComponent as r}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as p}from"./EditMediaV2.style.js";import c from"./EditWhatsAppTemplateMediaV2.js";import u from"./VariableConnector.js";import{Container as m}from"./VariableConnectorsPanel.js";import v from"./VariableConnectorWhatsApp.js";import b from"./VariableEditorHeader.js";import g from"./WhatsAppTemplateCardButtonV2.js";const f=f=>{let{template:h,onTemplateChange:O,whatsappSpecificPickerMeta:j,showVariableModal:C,variableList:T,variableListForImage:y,discountCode:x,setDiscountCode:V}=f;var B,k,E,L,U,I,w,R,A,P,M,N,S,H,_,Q,q,Y,D,K,W;const $=h.isCarouselType,{originalVariableList:F,pod:X,extras:z,selectedCarouselIndex:G,isProductCarouselType:J}=s(),{descriptionComponents:Z,urlBtns:nn,qrbBtns:on,imageComponent:tn,bodyVariables:en,headerVariables:ln}=a(h),[sn,an]=e(!1),[dn,rn]=e(-1===G?{descriptionComponents:Z,urlBtns:nn,qrbBtns:on,imageComponent:tn,bodyVariables:en,headerVariables:ln}:{}),[pn,cn]=e(!1);function un(n,o,e){var i,l,s,a,d,r,p,c,u,m;const v=null!=G&&G>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[G].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[G]}:Object.assign({},h),b=t(v),g="custom"===o&&"string"==typeof n,f=g?n:"string"!=typeof n?n.defaultValue?n.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=G&&G>-1&&J){const o=Object.assign({},h).components.map((n=>{var o;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(o=n.cards)||void 0===o?void 0:o.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var o,t,i;if("BUTTONS"===n.type){const l=null===(o=n.buttons)||void 0===o?void 0:o.filter((n=>"URL"===n.type));let s=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[f]});const a=null===(i=n.buttons)||void 0===i?void 0:i.map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n));return Object.assign(Object.assign({},n),{buttons:a})}return n}))})))}):n})),i=null===(a=null===(s=Object.assign({},h).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((o=>{var t;return Object.assign(Object.assign({},o),{buttons:null===(t=null==o?void 0:o.buttons)||void 0===t?void 0:t.map((o=>g?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:""))})})),l=t(h);return l.components=o,l.mapping.cards=i,void(null==O||O(Object.assign({},l)))}const j=null==b?void 0:b.components.findIndex((n=>"BUTTONS"===n.type));if(void 0!==j&&j>-1){const t=null===(d=null==b?void 0:b.components[j].buttons)||void 0===d?void 0:d.filter((n=>"URL"===n.type));if((null==t?void 0:t.length)>0){const i="custom"===o&&"string"==typeof n,l=i?n:"string"!=typeof n&&n.defaultValue?n.defaultValue:"https://d.bik.ai/";let s=t[e];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(c=null===(p=null===(r=b.components)||void 0===r?void 0:r[j])||void 0===p?void 0:p.buttons)&&void 0!==c?c:[]].map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n)),d=Object.assign(Object.assign({},b.components[j]),{buttons:a}),m=null===(u=b.mapping)||void 0===u?void 0:u.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[j]=d,b.components=g}}if("string"!=typeof n){"checkout.checkoutUrl"===(null===(m=n.placeHolder)||void 0===m?void 0:m.slice(2,-2))?an(!0):(an(!1),null==V||V(""))}if(null!=G&&G>-1){const n=t(h);n.components[1].cards[G].components=b.components,n.mapping.cards[G]=b.mapping,null==O||O(Object.assign({},n))}else null==O||O(b)}function mn(n,o,e){var i,l,s,a,d,r;const p=null!=G&&G>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[G].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[G]}:Object.assign({},h);if(null!=G&&G>-1&&J){const o=Object.assign({},h).components.map((o=>{var t;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(t=o.cards)||void 0===t?void 0:t.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var t,i,l;if("BUTTONS"===o.type){const s=null===(t=o.buttons)||void 0===t?void 0:t.filter((n=>"QUICK_REPLY"===n.type));let a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:n.flowId,flowName:n.flowName});const d=null===(l=o.buttons)||void 0===l?void 0:l.map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==a?void 0:a.text)?a:n));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),i=t(h);return i.components=o,void(null==O||O(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((n=>"BUTTONS"===n.type));if(void 0!==c&&c>-1){const o=null===(s=null==p?void 0:p.components[c].buttons)||void 0===s?void 0:s.filter((n=>"QUICK_REPLY"===n.type));if(o){let t=o[e];t=Object.assign(Object.assign({},t),{flowId:n.flowId,flowName:n.flowName});const i=[...null!==(r=null===(d=null===(a=p.components)||void 0===a?void 0:a[c])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==t?void 0:t.text)?t:n)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),s=[...p.components];s[c]=l,p.components=s}}if(null!=G&&G>-1){const n=t(h);n.components[1].cards[G].components=p.components,null==O||O(Object.assign({},n))}else null==O||O(p)}return i((()=>{var n,o;if(null===(n=h.mapping.buttons)||void 0===n?void 0:n.find((n=>"checkout.checkoutUrl"===n.slice(2,-2))))an(!0);else{an(!1);const n=null===(o=null==z?void 0:z.discountCodeExtra)||void 0===o?void 0:o[1];null==n||n("")}}),[h]),i((()=>{var n,o,t,e;if(null!=G&&G>-1){const i={components:null===(o=null===(n=h.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[G].components,mapping:null===(e=null===(t=null==h?void 0:h.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[G]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:p,headerVariables:c}=a(i);rn({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:p,headerVariables:c})}else if(null!=G&&-1===G){const{descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l}=a(h);rn({descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l})}}),[G]),i((()=>{var n,o,t,e;if(null!=G&&G>-1&&pn){const i={components:null===(o=null===(n=h.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[G].components,mapping:null===(e=null===(t=null==h?void 0:h.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[G]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:p,headerVariables:c}=a(i);rn({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:p,headerVariables:c}),cn(!1)}}),[pn]),n(m,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!dn.imageComponent&&!J&&o(p,{children:o(c,{whatsappSpecificPickerMeta:j,mediaComponent:$?dn.imageComponent:tn,updateTemplateImageUrl:function(n,o){var e,i,l,s,a,d,r,p;let c;c=null!=G&&G>-1?{components:null===(i=null===(e=h.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[G].components,mapping:null===(s=null===(l=null==h?void 0:h.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[G]}:Object.assign({},h);const u=null===(a=null==c?void 0:c.components)||void 0===a?void 0:a.findIndex((n=>{if("HEADER"===n.type&&"NONE"!==n.format&&"TEXT"!==n.format)return!0}));if(void 0!==u&&u>-1&&(null==c?void 0:c.components[u])){const t=Object.assign(Object.assign({},c.components[u]),{format:o,example:{header_handle:[n]}}),e=[...c.components];e[u]=t,c=Object.assign(Object.assign({},c),{components:e})}if(c.mapping&&(c.mapping=Object.assign(Object.assign({},c.mapping),{header:void 0})),null!=G&&G>-1){const n=t(h);n.components[1].cards[G].components=c.components,(null===(d=null==n?void 0:n.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==n?void 0:n.mapping)||void 0===r?void 0:r.cards.length)>0&&(n.mapping.cards[G]=null!==(p=c.mapping)&&void 0!==p?p:{}),null==O||O(Object.assign({},n)),cn(!0)}else null==O||O(Object.assign({},c))},template:h,variableListForImage:y})}),dn.bodyVariables.length>0&&o(b,{containerStyle:{paddingTop:dn.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(B=dn.descriptionComponents)||void 0===B?void 0:B.map(((n,t)=>o(v,{originalVariableList:null!=G&&G>-1?F.cards[G]:F,type:n.type,descriptionComponent:n.component,showVariableModal:C,variableList:T},t))),(null===(E=null===(k=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===k?void 0:k.filter((n=>"URL"===n.type)))||void 0===E?void 0:E.length)>0&&o(b,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(U=null===(L=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===L?void 0:L.filter((n=>X===l.CHATBOT||"URL"===n.type)))||void 0===U?void 0:U.map(((n,t)=>{if("URL"===n.type)return o(g,{variableListIndex:t,CTAoptions:null==j?void 0:j.CTAoptions,button:n,currentVariableList:null!=G&&G>-1?Object.assign({},F.cards[G]):Object.assign({},F),updateSelectedURLTemplateBtn:un,variableList:T},`${t}_${G}`)})),X===l.CHATBOT&&(null===(w=null===(I=on[0])||void 0===I?void 0:I.component)||void 0===w?void 0:w.buttons)&&(null===(P=null===(A=null===(R=on[0])||void 0===R?void 0:R.component)||void 0===A?void 0:A.buttons)||void 0===P?void 0:P.length)>0&&o(d,{backTrackMessage:null===(M=null==z?void 0:z.backTrackExtra)||void 0===M?void 0:M[0],setBackTrackMessage:null===(N=null==z?void 0:z.backTrackExtra)||void 0===N?void 0:N[1]}),(null===(H=null===(S=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===S?void 0:S.filter((n=>"QUICK_REPLY"===n.type)))||void 0===H?void 0:H.length)>0&&(X!==l.CHATBOT?o(b,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(d,{backTrackMessage:null===(_=null==z?void 0:z.backTrackExtra)||void 0===_?void 0:_[0],setBackTrackMessage:null===(Q=null==z?void 0:z.backTrackExtra)||void 0===Q?void 0:Q[1]})),null===(Y=null===(q=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===q?void 0:q.filter((n=>"QUICK_REPLY"===n.type)))||void 0===Y?void 0:Y.map(((n,t)=>{if("QUICK_REPLY"===n.type&&X!==l.CHATBOT)return o(g,{variableListIndex:t,QRBoptions:null==j?void 0:j.QRBoptions,button:n,currentVariableList:null!=G&&G>-1?Object.assign({},F.cards[G]):Object.assign({},F),updateSelectedQRBTemplateBtn:mn},`${t}_${G}`)})),X===l.CHATBOT&&sn&&o(r,{discountCode:null===(D=null==z?void 0:z.discountCodeExtra)||void 0===D?void 0:D[0],setDiscountCode:null===(K=null==z?void 0:z.discountCodeExtra)||void 0===K?void 0:K[1],variableList:T}),null===(W=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===W?void 0:W.map(((n,t)=>{var e,i,l;if("COPY_CODE"===n.type)return o(u,{index:t,variable:{variableName:null!==(e=n.text)&&void 0!==e?e:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:T,componentType:"BUTTONS"},t)}))]}))};export{f as default};
|
|
1
|
+
import{jsxs as n,jsx as o,Fragment as t}from"react/jsx-runtime";import{cloneDeep as e}from"lodash";import{useState as i,useEffect as l}from"react";import s from"styled-components";import{Input as a}from"../../input/Input.js";import{HEADER_TYPES as d}from"../../template-preview/models/TemplateMeta.js";import{POD as r}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as c}from"../utils/getDataFromTemplateComponent.js";import{validateInputName as u}from"../utils/validateName.js";import{BackTrackComponent as m}from"./BackTrackComponent.js";import{DiscountCodeComponent as v}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as b}from"./EditMediaV2.style.js";import g from"./EditWhatsAppTemplateMediaV2.js";import f from"./VariableConnector.js";import{Container as h}from"./VariableConnectorsPanel.js";import j from"./VariableConnectorWhatsApp.js";import O from"./VariableEditorHeader.js";import C from"./WhatsAppTemplateCardButtonV2.js";const T=s=>{let{template:T,onTemplateChange:y,whatsappSpecificPickerMeta:V,showVariableModal:B,variableList:E,variableListForImage:k,discountCode:L,setDiscountCode:U,fileName:I,setFileName:w}=s;var R,P,N,A,M,S,D,H,_,Q,q,Y,F,K,W,$,X,z,G,J,Z;const nn=T.isCarouselType,{originalVariableList:on,pod:tn,extras:en,selectedCarouselIndex:ln,isProductCarouselType:sn}=p(),{descriptionComponents:an,urlBtns:dn,qrbBtns:rn,imageComponent:pn,bodyVariables:cn,headerVariables:un}=c(T),[mn,vn]=i(!1),[bn,gn]=i(-1===ln?{descriptionComponents:an,urlBtns:dn,qrbBtns:rn,imageComponent:pn,bodyVariables:cn,headerVariables:un}:{}),[fn,hn]=i(!1),[jn,On]=i(I),[Cn,Tn]=i();function xn(n,o,t){var i,l,s,a,d,r,p,c,u,m;const v=null!=ln&&ln>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[ln].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[ln]}:Object.assign({},T),b=e(v),g="custom"===o&&"string"==typeof n,f=g?n:"string"!=typeof n?n.defaultValue?n.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=ln&&ln>-1&&sn){const o=Object.assign({},T).components.map((n=>{var o;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(o=n.cards)||void 0===o?void 0:o.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var o,e,i;if("BUTTONS"===n.type){const l=null===(o=n.buttons)||void 0===o?void 0:o.filter((n=>"URL"===n.type));let s=null!==(e=null==l?void 0:l[t])&&void 0!==e?e:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[f]});const a=null===(i=n.buttons)||void 0===i?void 0:i.map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n));return Object.assign(Object.assign({},n),{buttons:a})}return n}))})))}):n})),i=null===(a=null===(s=Object.assign({},T).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((o=>{var t;return Object.assign(Object.assign({},o),{buttons:null===(t=null==o?void 0:o.buttons)||void 0===t?void 0:t.map((o=>g?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:""))})})),l=e(T);return l.components=o,l.mapping.cards=i,void(null==y||y(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((n=>"BUTTONS"===n.type));if(void 0!==h&&h>-1){const e=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((n=>"URL"===n.type));if((null==e?void 0:e.length)>0){const i="custom"===o&&"string"==typeof n,l=i?n:"string"!=typeof n&&n.defaultValue?n.defaultValue:"https://d.bik.ai/";let s=e[t];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(c=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==c?c:[]].map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n)),d=Object.assign(Object.assign({},b.components[h]),{buttons:a}),m=null===(u=b.mapping)||void 0===u?void 0:u.buttons;m&&m.length>0&&(m[t]=i?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof n){"checkout.checkoutUrl"===(null===(m=n.placeHolder)||void 0===m?void 0:m.slice(2,-2))?vn(!0):(vn(!1),null==U||U(""))}if(null!=ln&&ln>-1){const n=e(T);n.components[1].cards[ln].components=b.components,n.mapping.cards[ln]=b.mapping,null==y||y(Object.assign({},n))}else null==y||y(b)}function yn(n,o,t){var i,l,s,a,d,r;const p=null!=ln&&ln>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[ln].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[ln]}:Object.assign({},T);if(null!=ln&&ln>-1&&sn){const o=Object.assign({},T).components.map((o=>{var e;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(e=o.cards)||void 0===e?void 0:e.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var e,i,l;if("BUTTONS"===o.type){const s=null===(e=o.buttons)||void 0===e?void 0:e.filter((n=>"QUICK_REPLY"===n.type));let a=null!==(i=null==s?void 0:s[t])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:n.flowId,flowName:n.flowName});const d=null===(l=o.buttons)||void 0===l?void 0:l.map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==a?void 0:a.text)?a:n));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),i=e(T);return i.components=o,void(null==y||y(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((n=>"BUTTONS"===n.type));if(void 0!==c&&c>-1){const o=null===(s=null==p?void 0:p.components[c].buttons)||void 0===s?void 0:s.filter((n=>"QUICK_REPLY"===n.type));if(o){let e=o[t];e=Object.assign(Object.assign({},e),{flowId:n.flowId,flowName:n.flowName});const i=[...null!==(r=null===(d=null===(a=p.components)||void 0===a?void 0:a[c])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==e?void 0:e.text)?e:n)),l=Object.assign(Object.assign({},p.components[c]),{buttons:i}),s=[...p.components];s[c]=l,p.components=s}}if(null!=ln&&ln>-1){const n=e(T);n.components[1].cards[ln].components=p.components,null==y||y(Object.assign({},n))}else null==y||y(p)}l((()=>{var n,o;if(null===(n=T.mapping.buttons)||void 0===n?void 0:n.find((n=>"checkout.checkoutUrl"===n.slice(2,-2))))vn(!0);else{vn(!1);const n=null===(o=null==en?void 0:en.discountCodeExtra)||void 0===o?void 0:o[1];null==n||n("")}}),[T]),l((()=>{var n,o,t,e;if(null!=ln&&ln>-1){const i={components:null===(o=null===(n=T.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[ln].components,mapping:null===(e=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[ln]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);gn({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=ln&&-1===ln){const{descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l}=c(T);gn({descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l})}}),[ln]),l((()=>{var n,o,t,e;if(null!=ln&&ln>-1&&fn){const i={components:null===(o=null===(n=T.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[ln].components,mapping:null===(e=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[ln]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:p}=c(i);gn({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:p}),hn(!1)}}),[fn]);return n(h,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!bn.imageComponent&&!sn&&n(b,{children:[o(g,{whatsappSpecificPickerMeta:V,mediaComponent:nn?bn.imageComponent:pn,updateTemplateImageUrl:function(n,o){var t,i,l,s,a,d,r,p;let c;c=null!=ln&&ln>-1?{components:null===(i=null===(t=T.components[1])||void 0===t?void 0:t.cards)||void 0===i?void 0:i[ln].components,mapping:null===(s=null===(l=null==T?void 0:T.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[ln]}:Object.assign({},T);const u=null===(a=null==c?void 0:c.components)||void 0===a?void 0:a.findIndex((n=>{if("HEADER"===n.type&&"NONE"!==n.format&&"TEXT"!==n.format)return!0}));if(void 0!==u&&u>-1&&(null==c?void 0:c.components[u])){const t=Object.assign(Object.assign({},c.components[u]),{format:o,example:{header_handle:[n]}}),e=[...c.components];e[u]=t,c=Object.assign(Object.assign({},c),{components:e})}if(c.mapping&&(c.mapping=Object.assign(Object.assign({},c.mapping),{header:void 0})),null!=ln&&ln>-1){const n=e(T);n.components[1].cards[ln].components=c.components,(null===(d=null==n?void 0:n.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==n?void 0:n.mapping)||void 0===r?void 0:r.cards.length)>0&&(n.mapping.cards[ln]=null!==(p=c.mapping)&&void 0!==p?p:{}),null==y||y(Object.assign({},n)),hn(!0)}else null==y||y(Object.assign({},c))},template:T,variableListForImage:k}),(null==pn?void 0:pn.format)==d.DOCUMENT?o(x,{children:o(a,{labelText:"PDF Name",placeholder:"Enter the name",value:jn,errorMessage:Cn||void 0,onBlur:()=>{if(!jn)return null==w||w(""),void Tn("PDF name is Required");const n=u(jn);null==w||w(jn),Tn(n?"Please enter a valid PDF name":void 0)},onChangeText:n=>{Tn(""),On(n)}})}):o(t,{})]}),bn.bodyVariables.length>0&&o(O,{containerStyle:{paddingTop:bn.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(R=bn.descriptionComponents)||void 0===R?void 0:R.map(((n,t)=>o(j,{originalVariableList:null!=ln&&ln>-1?on.cards[ln]:on,type:n.type,descriptionComponent:n.component,showVariableModal:B,variableList:E},t))),(null===(N=null===(P=null!=ln&&ln>-1?on.cards[ln].buttons:null==on?void 0:on.buttons)||void 0===P?void 0:P.filter((n=>"URL"===n.type)))||void 0===N?void 0:N.length)>0&&o(O,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(M=null===(A=null!=ln&&ln>-1?on.cards[ln].buttons:null==on?void 0:on.buttons)||void 0===A?void 0:A.filter((n=>tn===r.CHATBOT||"URL"===n.type)))||void 0===M?void 0:M.map(((n,t)=>{if("URL"===n.type)return o(C,{variableListIndex:t,CTAoptions:null==V?void 0:V.CTAoptions,button:n,currentVariableList:null!=ln&&ln>-1?Object.assign({},on.cards[ln]):Object.assign({},on),updateSelectedURLTemplateBtn:xn,variableList:E},`${t}_${ln}`)})),tn===r.CHATBOT&&(null===(D=null===(S=rn[0])||void 0===S?void 0:S.component)||void 0===D?void 0:D.buttons)&&(null===(Q=null===(_=null===(H=rn[0])||void 0===H?void 0:H.component)||void 0===_?void 0:_.buttons)||void 0===Q?void 0:Q.length)>0&&o(m,{backTrackMessage:null===(q=null==en?void 0:en.backTrackExtra)||void 0===q?void 0:q[0],setBackTrackMessage:null===(Y=null==en?void 0:en.backTrackExtra)||void 0===Y?void 0:Y[1]}),(null===(K=null===(F=null!=ln&&ln>-1?on.cards[ln].buttons:null==on?void 0:on.buttons)||void 0===F?void 0:F.filter((n=>"QUICK_REPLY"===n.type)))||void 0===K?void 0:K.length)>0&&(tn!==r.CHATBOT?o(O,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(m,{backTrackMessage:null===(W=null==en?void 0:en.backTrackExtra)||void 0===W?void 0:W[0],setBackTrackMessage:null===($=null==en?void 0:en.backTrackExtra)||void 0===$?void 0:$[1]})),null===(z=null===(X=null!=ln&&ln>-1?on.cards[ln].buttons:null==on?void 0:on.buttons)||void 0===X?void 0:X.filter((n=>"QUICK_REPLY"===n.type)))||void 0===z?void 0:z.map(((n,t)=>{if("QUICK_REPLY"===n.type&&tn!==r.CHATBOT)return o(C,{variableListIndex:t,QRBoptions:null==V?void 0:V.QRBoptions,button:n,currentVariableList:null!=ln&&ln>-1?Object.assign({},on.cards[ln]):Object.assign({},on),updateSelectedQRBTemplateBtn:yn},`${t}_${ln}`)})),tn===r.CHATBOT&&mn&&o(v,{discountCode:null===(G=null==en?void 0:en.discountCodeExtra)||void 0===G?void 0:G[0],setDiscountCode:null===(J=null==en?void 0:en.discountCodeExtra)||void 0===J?void 0:J[1],variableList:E}),null===(Z=null!=ln&&ln>-1?on.cards[ln].buttons:null==on?void 0:on.buttons)||void 0===Z?void 0:Z.map(((n,t)=>{var e,i,l;if("COPY_CODE"===n.type)return o(f,{index:t,variable:{variableName:null!==(e=n.text)&&void 0!==e?e:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:E,componentType:"BUTTONS"},t)}))]}))},x=s.div`
|
|
2
|
+
padding-top: 24px;
|
|
3
|
+
padding-left: 10px;
|
|
4
|
+
padding-right: 10px;
|
|
5
|
+
margin-bottom: 8px;
|
|
6
|
+
line-height: normal;
|
|
7
|
+
`;export{T as default};
|
package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface TemplateSelectModalContentProps {
|
|
|
13
13
|
discountCode?: string;
|
|
14
14
|
setDiscountCode?: (code: string) => void;
|
|
15
15
|
showSampleValues?: boolean;
|
|
16
|
+
fileName?: string;
|
|
17
|
+
setFileName?: (name: string) => void;
|
|
16
18
|
}
|
|
17
|
-
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, variableListForImage, showSampleValues, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const TemplateSelectModalContent: ({ channel, showVariableMapping, showOnlyContent, whatsappSpecificPickerMeta, showVariableModal, variableList, discountCode, setDiscountCode, variableListForImage, showSampleValues, fileName, setFileName, }: TemplateSelectModalContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export default TemplateSelectModalContent;
|
package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{CHANNEL_TYPE as
|
|
1
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import{CHANNEL_TYPE as i}from"../../template-preview/models/Channels.js";import t from"./Body.js";import o from"./Header.js";const s=s=>{let{channel:l,showVariableMapping:r,showOnlyContent:n,whatsappSpecificPickerMeta:m,showVariableModal:p,variableList:d,discountCode:c,setDiscountCode:h,variableListForImage:w,showSampleValues:b,fileName:f,setFileName:u}=s;return e("div",Object.assign({style:{paddingBottom:0}},{children:a("div",{children:[l===i.EMAIL&&e(o,{showOnlyContent:n}),e(t,{whatsappSpecificPickerMeta:m,showVariableMapping:!!r,showOnlyContent:n,showVariableModal:p,variableList:d,discountCode:c,setDiscountCode:h,variableListForImage:w,showSampleValues:b,fileName:f,setFileName:u})]})}))};export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateInputName: (name: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=t=>!!/[^a-zA-Z0-9._ ]/.test(t);export{t as validateInputName};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,TimeStamp as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,FooterText as j,TimeStamp as v}from"./ChatUI.style.js";import{MediaCard as w}from"./MediaCard.js";import b from"./RenderTemplateWithVariable.js";const u=n.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,S=n=>{const{bodyText:S,footerText:N,headerMediaType:A,headerText:M,headerAssetLink:C,headerAssetName:L,quickReplybtn:k,ctaBtn:z,actionTypes:B,textType:E,extras:I,showHeader:P,imagePreviewStyles:R,size:W,children:H,isPreview:O}=n,_=new c,U=a((()=>({color:l.content.primary,margin:12,fontSize:P?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:O},{children:[t(u,{children:t(o,{color:"white",height:8,width:8})}),A===f.TEXT?t(b,{bold:!0,text:M}):A!==f.NONE?t(w,{headerAssetLink:C,headerAssetName:L,mediaType:A,imagePreviewStyles:A===f.IMAGE?R:{}}):t(r,{}),!!S&&t(r,{children:t(r,H?{children:H}:{children:"html"===E?t("div",{className:"richTextEditor",style:U,dangerouslySetInnerHTML:{__html:_.convertToHTML(S)}}):t(p,{children:S})})}),e(g,{children:[t(m,Object.assign({body:null!=N?N:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:N}))})),t(v,{children:"16:48"})]}),B===y.QUICK_REPLY?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{text:e.text},r)))}):B===y.CTA_BTN?t("div",{children:null==z?void 0:z.map(((e,r)=>t(T,{textTypography:P?d:p,extraContent:I?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:W},r)))}):t(r,{})]}))};export{S as default};
|
|
@@ -9,6 +9,10 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
|
|
|
9
9
|
numberOfLines?: number | undefined;
|
|
10
10
|
color?: string | undefined;
|
|
11
11
|
}, never>;
|
|
12
|
+
export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
|
|
13
|
+
numberOfLines?: number | undefined;
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
}, never>;
|
|
12
16
|
export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
13
17
|
export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
18
|
export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -21,7 +21,9 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
|
|
|
21
21
|
white-space: nowrap;
|
|
22
22
|
overflow: hidden;
|
|
23
23
|
text-wrap: wrap;
|
|
24
|
-
`,d=e
|
|
24
|
+
`,d=e(i)`
|
|
25
|
+
max-width: 200px;
|
|
26
|
+
`,s=e.div`
|
|
25
27
|
border-radius: 8px;
|
|
26
28
|
display: flex;
|
|
27
29
|
flex-direction: column;
|
|
@@ -30,14 +32,14 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
|
|
|
30
32
|
min-height: 152px;
|
|
31
33
|
margin-bottom: 4px;
|
|
32
34
|
margin: 0px 8px;
|
|
33
|
-
`,
|
|
35
|
+
`,p=e.div`
|
|
34
36
|
padding: 12px;
|
|
35
37
|
display: flex;
|
|
36
38
|
flex-direction: row;
|
|
37
39
|
justify-content: center;
|
|
38
40
|
align-items: center;
|
|
39
41
|
border-top: 1px solid ${t.stroke.primary};
|
|
40
|
-
`,
|
|
42
|
+
`,a=e.div`
|
|
41
43
|
display: flex;
|
|
42
44
|
flex-direction: row;
|
|
43
45
|
justify-content: space-between;
|
|
@@ -60,4 +62,4 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
|
|
|
60
62
|
position: absolute;
|
|
61
63
|
top: 16px;
|
|
62
64
|
right: 16px;
|
|
63
|
-
`;export{
|
|
65
|
+
`;export{p as ChatBtnContainer,o as Container,d as FooterText,a as FooterWrapper,s as MediaContainer,i as TimeStamp};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,TimeStamp as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,FooterText as C,TimeStamp as j}from"./ChatUI.style.js";import{LimitedTimeOffer as v}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as b}from"./MediaCard.js";const w=l.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,I=l.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
@@ -13,7 +13,7 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"..
|
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
14
|
color: ${h.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,O=l(I)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,E=new f,L=l=>{const{bodyText:h,footerText:f,headerMediaType:L,headerText:P,headerAssetLink:_,headerAssetName:N,quickReplybtn:M,ctaBtn:R,actionTypes:A,extras:B,showHeader:H,imagePreviewStyles:S,size:U,bodyVariableList:k,headerVariableList:z,buttons:Y,limitedTimeOfferComponent:V,carouselCardIndex:q,isWhatsappCarousel:D,isPreview:K}=l,Q=E.format(h,k),W=E.format(P,z),{selectedCarouselIndex:G,isProductCarouselType:X,errorIndexes:$}=m(),F={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=q&&q>-1,showBorder:null!=q&&q===G||X&&null!=q&&q>-1&&null!=G&&G>-1,hasError:null==$?void 0:$.includes(null!=q?q:-2),isWhatsappCarousel:D,isPreview:K},{children:[!D&&t(w,{children:t(i,{color:"white",height:8,width:8})}),L===x.TEXT?t(O,{dangerouslySetInnerHTML:{__html:W}}):L!==x.NONE?t(b,{headerAssetLink:_,headerAssetName:N,mediaType:L,imagePreviewStyles:L===x.IMAGE?S:{}}):t(o,{}),(null==V?void 0:V.dateTime)?t(v,{text:V.text,dateTime:V.dateTime,code:V.code}):t(o,{}),!!h&&t(o,{children:t(I,{dangerouslySetInnerHTML:{__html:Q}})}),e(g,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(j,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(u,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:F[e.type],size:U},o))):A===y.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(u,{text:e.text},o)))}):A===y.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(u,{textTypography:H?d:c,extraContent:B?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:U},o)))}):t(o,{})]}))};export{L as ChatUIV2};
|