@bikdotai/bik-component-library 0.0.505 → 0.0.506-beta-pdf

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.
Files changed (31) hide show
  1. package/dist/cjs/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  6. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  7. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.js +18 -6
  8. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +3 -1
  9. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  10. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +2 -0
  11. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
  12. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +3 -1
  13. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +7 -1
  14. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
  15. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  16. package/dist/esm/components/QueryBuilder/Filters/Segment/components/SegmentFilter.js +1 -1
  17. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  18. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  19. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  20. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  21. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  22. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.js +17 -5
  23. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +3 -1
  24. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  25. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +2 -0
  26. package/dist/esm/components/template-context-mapper/modalElements/Body.js +2 -2
  27. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +3 -1
  28. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +7 -1
  29. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
  30. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("../../../components/AllowedListDropdown.js"),i=require("../../../helpers/ApiResponse.helper.js"),o=require("../../../hooks/useQueryBuilder.js"),d=require("../../../hooks/useQueryBuilderCache.js"),s=require("../../../components/DropdownWrapper.js"),u=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");const a=new i.ApiResponseHelper;exports.default=i=>{let{node:n,allowedNodes:t,apiHandler:v,mode:c,selectorKey:p}=i;var y,m,j,f,h,w,g,x,B;const{updateMeta:k,selectType:A,createMeta:b}=o.useQueryBuilder(p),{cacheWrap:q}=d.useQueryBuilderCache(),[D,Q]=r.useState(!1),[S,_]=r.useState([]),I=n.metas.find((e=>"segmentID"===e.key));return r.useEffect((()=>{I||b({key:"segmentID"},n._id),q((()=>v({})),"SEGMENT_FILTER").then((e=>{if(e&&Array.isArray(e))_([...e.map((e=>({label:e.name,value:e.id,description:e.description,selected:"create"!==c&&(!!(null==I?void 0:I.value)&&I.value===e.id)})))]);else{const r=a.convertToGroupOptions(e,(null==I?void 0:I.value)?[I.value]:void 0);_([...r])}Q(!1)}))}),[]),e.jsx(u.BaseQueryBuilderNode,Object.assign({node:n,mode:c},{children:e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e.jsx(l.default,{disabled:"view"===c,loading:D,selectedType:n.type,allowedList:t,onSelect:function(e){Array.isArray(e)||(Q(!0),A(e.value,n._id),b({key:"segmentID"},n._id)),Q(!1)}}),(null===(m=null===(y=null==n?void 0:n.metas)||void 0===y?void 0:y[0])||void 0===m?void 0:m.key)&&e.jsx(s.default,{selectedValues:(null==I?void 0:I.value)?[I.value]:void 0,isSearchable:!0,isLoading:D,disabled:"view"===c,width:"200px",dropdownLabel:"Select segment",options:S,onSelect:function(e){Array.isArray(e)||k({key:"segmentID",value:e.value,error:{}},n._id)},error:null!==(x=null!==(w=null===(h=null===(f=null===(j=n.metas)||void 0===j?void 0:j[0])||void 0===f?void 0:f.error)||void 0===h?void 0:h.key)&&void 0!==w?w:null===(g=null==I?void 0:I.error)||void 0===g?void 0:g.key)&&void 0!==x?x:null===(B=null==I?void 0:I.error)||void 0===B?void 0:B.value})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("../../../components/AllowedListDropdown.js"),i=require("../../../helpers/ApiResponse.helper.js"),o=require("../../../hooks/useQueryBuilder.js"),d=require("../../../hooks/useQueryBuilderCache.js"),s=require("../../../types/QueryBuilder.type.js"),u=require("../../../components/DropdownWrapper.js"),t=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");const a=new i.ApiResponseHelper;exports.default=i=>{let{node:n,allowedNodes:v,apiHandler:c,mode:p,selectorKey:y}=i;var m,j,f,h,B,w,g,x,k;const{updateMeta:q,selectType:A,createMeta:Q}=o.useQueryBuilder(y),{cacheWrap:b}=d.useQueryBuilderCache(),[S,T]=r.useState(!1),[_,D]=r.useState([]),E=n.metas.find((e=>"segmentID"===e.key));return r.useEffect((()=>{E||Q({key:"segmentID"},n._id),b((()=>c({})),"SEGMENT_FILTER").then((e=>{if(e&&Array.isArray(e))D([...e.map((e=>({label:e.name,value:e.id,description:e.description,selected:"create"!==p&&(!!(null==E?void 0:E.value)&&E.value===e.id)})))]);else{const r=a.convertToGroupOptions(e,(null==E?void 0:E.value)?[E.value]:void 0);D([...r])}T(!1)}))}),[]),e.jsx(t.BaseQueryBuilderNode,Object.assign({node:n,mode:p},{children:e.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e.jsx(l.default,{disabled:"view"===p,loading:S,selectedType:n.type,allowedList:v,onSelect:function(e){Array.isArray(e)||(T(!0),A(e.value,n._id),e.value==s.QueryBuilderType.SEGMENT_FILTER&&Q({key:"segmentID"},n._id)),T(!1)}}),(null===(j=null===(m=null==n?void 0:n.metas)||void 0===m?void 0:m[0])||void 0===j?void 0:j.key)&&e.jsx(u.default,{selectedValues:(null==E?void 0:E.value)?[E.value]:void 0,isSearchable:!0,isLoading:S,disabled:"view"===p,width:"200px",dropdownLabel:"Select segment",options:_,onSelect:function(e){Array.isArray(e)||q({key:"segmentID",value:e.value,error:{}},n._id)},error:null!==(x=null!==(w=null===(B=null===(h=null===(f=n.metas)||void 0===f?void 0:f[0])||void 0===h?void 0:h.error)||void 0===B?void 0:B.key)&&void 0!==w?w:null===(g=null==E?void 0:E.error)||void 0===g?void 0:g.key)&&void 0!==x?x:null===(k=null==E?void 0:E.error)||void 0===k?void 0:k.value})]}))}))};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
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 "../../../types/QueryBuilderAPI.type";
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 "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
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;
@@ -1,25 +1,37 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),o=require("../../../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);const i=r.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=o(e);const i=t.default.div`
2
2
  border-radius: ${e=>"2.0"===e.version?8:4}px;
3
3
  border: ${e=>"2.0"===e.version?0:1}px solid
4
- ${o.COLORS.stroke.primary};
4
+ ${r.COLORS.stroke.primary};
5
5
  max-height: 640px;
6
6
  overflow: hidden;
7
7
  display: flex;
8
8
  flex-direction: row;
9
9
  position: relative;
10
10
  padding: ${e=>"2.0"===e.version?4:0}px;
11
- background-color: ${o.COLORS.surface.standard};
12
- `;r.default.div`
11
+ background-color: ${r.COLORS.surface.standard};
12
+ `;t.default.div`
13
13
  padding: 14px 16px 14px 18px;
14
14
  flex-direction: row;
15
15
  align-items: center;
16
16
  border-bottom-width: 1px;
17
17
  border-bottom-style: solid;
18
- border-bottom-color: ${o.COLORS.stroke.primary};
18
+ border-bottom-color: ${r.COLORS.stroke.primary};
19
19
  width: 100%;
20
20
  height: 100%;
21
- `;const d=r.default.div`
21
+ `;const d=t.default.div`
22
22
  max-height: ${e=>"number"==typeof e.maxHeight?`${e.maxHeight}px`:e.maxHeight};
23
23
  overflow-y: auto;
24
24
  position: relative;
25
+ &::-webkit-scrollbar-thumb {
26
+ background: #e0e0e0;
27
+ border-radius: 8px;
28
+ }
29
+ &::-webkit-scrollbar {
30
+ height: 5px;
31
+ display: block;
32
+ width: 8px;
33
+ }
34
+ &::-webkit-scrollbar-thumb:horizontal {
35
+ width: 8px;
36
+ }
25
37
  `;exports.MenuListContainer=d,exports.OpennedDropdownContainer=i;
@@ -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"),o=require("../modals/styledModal.js"),a=require("../template-preview/models/Channels.js"),r=require("./context/templateModalContext.js"),s=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:v,htmlContent:h,templateVariables:m,onTemplateSelect:C,globalPlaceholders:E,showOnlyContent:S,whatsappSpecificPickerMeta:x,zIndex:b,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,onBackPress:j,enabledCustomText:M,variableListForImage:I,showSampleValues:L,disableEditVariable:y,pod:A,extras:w,pickerConf:N,selectedCarouselProducts:V,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:q}=d;var H,_,O,W,F,Y;l.useEffect((()=>{G(h)}),[h]);const B=v===a.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(_=null===(H=null==u?void 0:u.components)||void 0===H?void 0:H[1])||void 0===_?void 0:_.type),z=null==u?void 0:u.isProductCarouselType,[R,U]=l.useState(v===a.CHANNEL_TYPE.EMAIL||B?"desktop":"mobile"),[$,G]=l.useState(h),[J,K]=l.useState(!1),[Q,X]=l.useState([]),[Z,ee]=l.useState(u),[le,te]=l.useState([]),[oe,ae]=l.useState(!1),[re,se]=l.useState(null!=m?m:[]),[ie,ne]=l.useState(!1),[de,ue]=l.useState(-1),[ce,pe]=l.useState([]);l.useEffect((()=>{V?pe(V):z&&pe([])}),[V]),l.useEffect((()=>{var e;if(!oe&&z&&(!V||0===pe.length)){const l=null===(e=null==Z?void 0:Z.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,o,a;"HEADER"===e.type&&t.push(null!==(a=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),te(t),ae(!0)}}),[oe]);const ve=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(E)),[E]);return e.jsx(r.TemplateModalContext.Provider,Object.assign({value:{template:Z,setTemplate:ee,device:R,setDevice:U,display_content:$,setDisplayContent:G,originalVariableList:re,setOriginalVariableList:se,isError:J,setIsError:K,channel:v,globalNormalizedPlaceholders:ve,templateSelectionTriggered:ie,setTemplateSelectionTriggered:ne,enabledCustomText:M,disableEditVariable:y,pod:A,extras:w,isWhatsappCarousel:B,selectedCarouselIndex:de,setSelectedCarouselIndex:ue,isProductCarouselType:z,cardCount:B?null===(W=null===(O=u.components)||void 0===O?void 0:O[1].cards)||void 0===W?void 0:W.length:void 0,errorIndexes:Q,setErrorIndexes:X,pickerConf:N,carouselProducts:ce,setCarouselProducts:pe,disableEditExpiry:D,cardWidth:k,cardImages:le,onDeleteSelectedProducts:q}},{children:S?e.jsx(i.default,{channel:a.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(o.StyledModal,Object.assign({zIndex:b,centralContainerStyles:{width:B?900:v===a.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==Z?void 0:Z.label,headingSubtitle:v===a.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(F=null==Z?void 0:Z.category)&&void 0!==F?F:"")} • ${null!==(Y=null==Z?void 0:Z.templateCategory)&&void 0!==Y?Y:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:p,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,variableListForImage:I&&(null==I?void 0:I.length)>0?I:P}),C?e.jsx(s.default,{isWhatsappCarousel:null!=B&&B,onSelect:function(){if((null==ce?void 0:ce.length)<1&&z)return void K(!0);const e=null==C?void 0:C(Z,re,null!=$?$:"",ce);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&X(e.errorIndexes),(null==e?void 0:e.error)&&K(!!(null==e?void 0:e.error))):ne(!0)}}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),o=require("../modals/styledModal.js"),a=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");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:v,htmlContent:m,templateVariables:h,onTemplateSelect:C,globalPlaceholders:E,showOnlyContent:S,whatsappSpecificPickerMeta:x,zIndex:b,showVariableModal:g,variableList:P,discountCode:f,setDiscountCode:T,onBackPress:j,enabledCustomText:M,variableListForImage:I,showSampleValues:L,disableEditVariable:y,pod:N,extras:A,pickerConf:w,selectedCarouselProducts:V,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:q,fileName:H,setFileName:_}=d;var F,O,W,Y,B,z;l.useEffect((()=>{K(m)}),[m]);const R=v===a.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(O=null===(F=null==u?void 0:u.components)||void 0===F?void 0:F[1])||void 0===O?void 0:O.type),U=null==u?void 0:u.isProductCarouselType,[$,G]=l.useState(v===a.CHANNEL_TYPE.EMAIL||R?"desktop":"mobile"),[J,K]=l.useState(m),[Q,X]=l.useState(!1),[Z,ee]=l.useState([]),[le,te]=l.useState(u),[oe,ae]=l.useState([]),[se,re]=l.useState(!1),[ie,ne]=l.useState(null!=h?h:[]),[de,ue]=l.useState(!1),[ce,pe]=l.useState(-1),[ve,me]=l.useState([]);l.useEffect((()=>{V?me(V):U&&me([])}),[V]),l.useEffect((()=>{var e;if(!se&&U&&(!V||0===me.length)){const l=null===(e=null==le?void 0:le.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,o,a;"HEADER"===e.type&&t.push(null!==(a=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),ae(t),re(!0)}}),[se]);const he=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(E)),[E]);return e.jsx(s.TemplateModalContext.Provider,Object.assign({value:{template:le,setTemplate:te,device:$,setDevice:G,display_content:J,setDisplayContent:K,originalVariableList:ie,setOriginalVariableList:ne,isError:Q,setIsError:X,channel:v,globalNormalizedPlaceholders:he,templateSelectionTriggered:de,setTemplateSelectionTriggered:ue,enabledCustomText:M,disableEditVariable:y,pod:N,extras:A,isWhatsappCarousel:R,selectedCarouselIndex:ce,setSelectedCarouselIndex:pe,isProductCarouselType:U,cardCount:R?null===(Y=null===(W=u.components)||void 0===W?void 0:W[1].cards)||void 0===Y?void 0:Y.length:void 0,errorIndexes:Z,setErrorIndexes:ee,pickerConf:w,carouselProducts:ve,setCarouselProducts:me,disableEditExpiry:D,cardWidth:k,cardImages:oe,onDeleteSelectedProducts:q}},{children:S?e.jsx(i.default,{channel:a.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(o.StyledModal,Object.assign({zIndex:b,centralContainerStyles:{width:R?900:v===a.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==le?void 0:le.label,headingSubtitle:v===a.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(B=null==le?void 0:le.category)&&void 0!==B?B:"")} • ${null!==(z=null==le?void 0:le.templateCategory)&&void 0!==z?z:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:p,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:g,variableList:P,discountCode:f,setDiscountCode:T,variableListForImage:I&&(null==I?void 0:I.length)>0?I:P,fileName:H,setFileName:_}),C?e.jsx(r.default,{isWhatsappCarousel:null!=R&&R,onSelect:function(){if((null==ve?void 0:ve.length)<1&&U)return void X(!0);const e=null==C?void 0:C(le,ie,null!=J?J:"",ve);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&ee(e.errorIndexes),(null==e?void 0:e.error)&&X(!!(null==e?void 0:e.error))):ue(!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"),o=require("./EditWhatsAppCarouselTemplateV2.js"),i=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 v=m(a);const C=v.default.div`
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=v.default.div`
4
+ `,C=f.default.div`
5
5
  padding: 16px 14px;
6
6
  max-width: 450px;
7
7
 
8
- height: ${e=>e.channel===i.CHANNEL_TYPE.WHATSAPP?"500px":"475px"};
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=v.default.div`
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:v,whatsappSpecificPickerMeta:g,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j,variableListForImage:E,showSampleValues:L}=a,T=t.useRef(),A=t.useRef(),{device:y,display_content:S,channel:M,template:N,setTemplate:_,isWhatsappCarousel:V,isProductCarouselType:W}=r.useTemplateModalContext();const q=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(C,{children:[e.jsx(x,Object.assign({showOnlyContent:v,showVariableMapping:m,isWhatsappCarousel:V},{children:"mobile"===y?e.jsx(c.default,{ref:A,display_content:null!=S?S:"",channel:M,template:N,showSampleValues:L}):M===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(l.CarouselPreview,{ref:T,channel:M,template:N,showSampleValues:L,isPreview:!1}):M!==i.CHANNEL_TYPE.MESSAGE?e.jsx(d.default,{ref:T,channel:M,display_content:null!=S?S:"",showSampleValues:L}):e.jsx(e.Fragment,{})})),(W||m)&&e.jsx(f,Object.assign({channel:M,isWhatsappCarousel:V},{children:M!==i.CHANNEL_TYPE.WHATSAPP?e.jsx(h.default,{onFocus:M===i.CHANNEL_TYPE.EMAIL?function(e){var t,a,l;const o=null===document||void 0===document?void 0:document.getElementById("mobile"===y?"template_html_mobile":"template_html_desktop"),r=n.getVariableNameForEmailByIndex(e+1),d=M===i.CHANNEL_TYPE.EMAIL?null===(t=null==o?void 0:o.contentWindow)||void 0===t?void 0:t.document.getElementById(r):document.getElementById(r),p=q(d),c=null==d?void 0:d.offsetLeft;"desktop"===y?p&&T.current&&(null===(a=null==o?void 0:o.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,M,y)):p&&A.current&&(null===(l=null==o?void 0:o.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,M,y))}:void 0,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j}):M===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(o.default,{whatsappSpecificPickerMeta:g,template:N,showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j}):e.jsx(p.default,{whatsappSpecificPickerMeta:g,template:N,onTemplateChange:e=>{null==_||_(e)},showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j})}))]})};
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})}))]})};
@@ -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("../../input/Input.js"),i=require("../../template-preview/models/TemplateMeta.js"),l=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),a=require("../utils/getDataFromTemplateComponent.js"),d=require("./BackTrackComponent.js"),r=require("./DiscountCodeComponent.js"),u=require("./EditMediaV2.style.js"),p=require("./EditWhatsAppTemplateMediaV2.js"),c=require("./VariableConnector.js"),v=require("./VariableConnectorsPanel.js"),m=require("./VariableConnectorWhatsApp.js"),b=require("./VariableEditorHeader.js"),g=require("./WhatsAppTemplateCardButtonV2.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const j=f(require("styled-components")).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=f=>{let{template:h,onTemplateChange:O,whatsappSpecificPickerMeta:C,showVariableModal:T,variableList:x,variableListForImage:y,discountCode:B,setDiscountCode:E,fileName:V,setFileName:k}=f;var L,D,q,U,I,P,w,R,A,M,S,N,_,H,F,Q,Y,K,W,$,z;const X=h.isCarouselType,{originalVariableList:Z,pod:G,extras:J,selectedCarouselIndex:ee,isProductCarouselType:ne}=s.useTemplateModalContext(),{descriptionComponents:te,urlBtns:oe,qrbBtns:ie,imageComponent:le,bodyVariables:se,headerVariables:ae}=a.getAllDataFromTemplateComponent(h),[de,re]=t.useState(!1),[ue,pe]=t.useState(-1===ee?{descriptionComponents:te,urlBtns:oe,qrbBtns:ie,imageComponent:le,bodyVariables:se,headerVariables:ae}:{}),[ce,ve]=t.useState(!1),[me,be]=t.useState(V),[ge,fe]=t.useState("");function je(e,t,o){var i,l,s,a,d,r,u,p,c,v;const m=null!=ee&&ee>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[ee].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[ee]}: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!=ee&&ee>-1&&ne){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==O||O(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))?re(!0):(re(!1),null==E||E(""))}if(null!=ee&&ee>-1){const e=n.cloneDeep(h);e.components[1].cards[ee].components=b.components,e.mapping.cards[ee]=b.mapping,null==O||O(Object.assign({},e))}else null==O||O(b)}function he(e,t,o){var i,l,s,a,d,r;const u=null!=ee&&ee>-1?{components:null===(i=Object.assign({},h).components[1].cards)||void 0===i?void 0:i[ee].components,mapping:null===(l=Object.assign({},h).mapping.cards)||void 0===l?void 0:l[ee]}:Object.assign({},h);if(null!=ee&&ee>-1&&ne){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==O||O(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!=ee&&ee>-1){const e=n.cloneDeep(h);e.components[1].cards[ee].components=u.components,null==O||O(Object.assign({},e))}else null==O||O(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))))re(!0);else{re(!1);const e=null===(n=null==J?void 0:J.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[h]),t.useEffect((()=>{var e,n,t,o;if(null!=ee&&ee>-1){const i={components:null===(n=null===(e=h.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ee].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[ee]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:p}=a.getAllDataFromTemplateComponent(i);pe({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:p})}else if(null!=ee&&-1===ee){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=a.getAllDataFromTemplateComponent(h);pe({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[ee]),t.useEffect((()=>{var e,n,t,o;if(null!=ee&&ee>-1&&ce){const i={components:null===(n=null===(e=h.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[ee].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[ee]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:p}=a.getAllDataFromTemplateComponent(i);pe({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:p}),ve(!1)}}),[ce]);return e.jsxs(v.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!ue.imageComponent&&!ne&&e.jsxs(u.EditTemplateMediaContainer,{children:[e.jsx(p.default,{whatsappSpecificPickerMeta:C,mediaComponent:X?ue.imageComponent:le,updateTemplateImageUrl:function(e,t){var o,i,l,s,a,d,r,u;let p;p=null!=ee&&ee>-1?{components:null===(i=null===(o=h.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[ee].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[ee]}: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!=ee&&ee>-1){const e=n.cloneDeep(h);e.components[1].cards[ee].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[ee]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==O||O(Object.assign({},e)),ve(!0)}else null==O||O(Object.assign({},p))},template:h,variableListForImage:y}),(null==le?void 0:le.format)==i.HEADER_TYPES.DOCUMENT?e.jsx(j,{children:e.jsx(o.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:me,errorMessage:ge||void 0,onBlur:()=>{if(!me)return;/[^a-zA-Z0-9._]/.test(me)?fe("Please enter a valid PDF name"):(fe(""),null==k||k(me))},onChangeText:e=>{fe(""),be(e)}})}):e.jsx(e.Fragment,{})]}),ue.bodyVariables.length>0&&e.jsx(b.default,{containerStyle:{paddingTop:ue.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===(L=ue.descriptionComponents)||void 0===L?void 0:L.map(((n,t)=>e.jsx(m.default,{originalVariableList:null!=ee&&ee>-1?Z.cards[ee]:Z,type:n.type,descriptionComponent:n.component,showVariableModal:T,variableList:x},t))),(null===(q=null===(D=null!=ee&&ee>-1?Z.cards[ee].buttons:null==Z?void 0:Z.buttons)||void 0===D?void 0:D.filter((e=>"URL"===e.type)))||void 0===q?void 0:q.length)>0&&e.jsx(b.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(I=null===(U=null!=ee&&ee>-1?Z.cards[ee].buttons:null==Z?void 0:Z.buttons)||void 0===U?void 0:U.filter((e=>G===l.POD.CHATBOT||"URL"===e.type)))||void 0===I?void 0:I.map(((n,t)=>{if("URL"===n.type)return e.jsx(g.default,{variableListIndex:t,CTAoptions:null==C?void 0:C.CTAoptions,button:n,currentVariableList:null!=ee&&ee>-1?Object.assign({},Z.cards[ee]):Object.assign({},Z),updateSelectedURLTemplateBtn:je,variableList:x},`${t}_${ee}`)})),G===l.POD.CHATBOT&&(null===(w=null===(P=ie[0])||void 0===P?void 0:P.component)||void 0===w?void 0:w.buttons)&&(null===(M=null===(A=null===(R=ie[0])||void 0===R?void 0:R.component)||void 0===A?void 0:A.buttons)||void 0===M?void 0:M.length)>0&&e.jsx(d.BackTrackComponent,{backTrackMessage:null===(S=null==J?void 0:J.backTrackExtra)||void 0===S?void 0:S[0],setBackTrackMessage:null===(N=null==J?void 0:J.backTrackExtra)||void 0===N?void 0:N[1]}),(null===(H=null===(_=null!=ee&&ee>-1?Z.cards[ee].buttons:null==Z?void 0:Z.buttons)||void 0===_?void 0:_.filter((e=>"QUICK_REPLY"===e.type)))||void 0===H?void 0:H.length)>0&&(G!==l.POD.CHATBOT?e.jsx(b.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(d.BackTrackComponent,{backTrackMessage:null===(F=null==J?void 0:J.backTrackExtra)||void 0===F?void 0:F[0],setBackTrackMessage:null===(Q=null==J?void 0:J.backTrackExtra)||void 0===Q?void 0:Q[1]})),null===(K=null===(Y=null!=ee&&ee>-1?Z.cards[ee].buttons:null==Z?void 0:Z.buttons)||void 0===Y?void 0:Y.filter((e=>"QUICK_REPLY"===e.type)))||void 0===K?void 0:K.map(((n,t)=>{if("QUICK_REPLY"===n.type&&G!==l.POD.CHATBOT)return e.jsx(g.default,{variableListIndex:t,QRBoptions:null==C?void 0:C.QRBoptions,button:n,currentVariableList:null!=ee&&ee>-1?Object.assign({},Z.cards[ee]):Object.assign({},Z),updateSelectedQRBTemplateBtn:he},`${t}_${ee}`)})),G===l.POD.CHATBOT&&de&&e.jsx(r.DiscountCodeComponent,{discountCode:null===(W=null==J?void 0:J.discountCodeExtra)||void 0===W?void 0:W[0],setDiscountCode:null===($=null==J?void 0:J.discountCodeExtra)||void 0===$?void 0:$[1],variableList:x}),null===(z=null!=ee&&ee>-1?Z.cards[ee].buttons:null==Z?void 0:Z.buttons)||void 0===z?void 0:z.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(c.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:x,componentType:"BUTTONS"},t)}))]}))};
@@ -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;
@@ -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"),t=require("./Header.js");exports.default=i=>{let{channel:r,showVariableMapping:o,showOnlyContent:l,whatsappSpecificPickerMeta:n,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:w}=i;return e.jsx("div",Object.assign({style:{paddingBottom:0}},{children:e.jsxs("div",{children:[r===a.CHANNEL_TYPE.EMAIL&&e.jsx(t.default,{showOnlyContent:l}),e.jsx(s.default,{whatsappSpecificPickerMeta:n,showVariableMapping:!!o,showOnlyContent:l,showVariableModal:d,variableList:p,discountCode:u,setDiscountCode:c,variableListForImage:h,showSampleValues:w})]})}))};
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})]})}))};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as l,useEffect as r}from"react";import i from"../../../components/AllowedListDropdown.js";import{ApiResponseHelper as d}from"../../../helpers/ApiResponse.helper.js";import{useQueryBuilder as n}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as s}from"../../../hooks/useQueryBuilderCache.js";import t from"../../../components/DropdownWrapper.js";import{BaseQueryBuilderNode as a}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const u=new d,v=d=>{let{node:v,allowedNodes:p,apiHandler:c,mode:m,selectorKey:y}=d;var f,h,w,g,j,k,A,b,D;const{updateMeta:B,selectType:x,createMeta:I}=n(y),{cacheWrap:L}=s(),[S,T]=l(!1),[_,N]=l([]),Q=v.metas.find((e=>"segmentID"===e.key));return r((()=>{Q||I({key:"segmentID"},v._id),L((()=>c({})),"SEGMENT_FILTER").then((e=>{if(e&&Array.isArray(e))N([...e.map((e=>({label:e.name,value:e.id,description:e.description,selected:"create"!==m&&(!!(null==Q?void 0:Q.value)&&Q.value===e.id)})))]);else{const o=u.convertToGroupOptions(e,(null==Q?void 0:Q.value)?[Q.value]:void 0);N([...o])}T(!1)}))}),[]),e(a,Object.assign({node:v,mode:m},{children:o("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(i,{disabled:"view"===m,loading:S,selectedType:v.type,allowedList:p,onSelect:function(e){Array.isArray(e)||(T(!0),x(e.value,v._id),I({key:"segmentID"},v._id)),T(!1)}}),(null===(h=null===(f=null==v?void 0:v.metas)||void 0===f?void 0:f[0])||void 0===h?void 0:h.key)&&e(t,{selectedValues:(null==Q?void 0:Q.value)?[Q.value]:void 0,isSearchable:!0,isLoading:S,disabled:"view"===m,width:"200px",dropdownLabel:"Select segment",options:_,onSelect:function(e){Array.isArray(e)||B({key:"segmentID",value:e.value,error:{}},v._id)},error:null!==(b=null!==(k=null===(j=null===(g=null===(w=v.metas)||void 0===w?void 0:w[0])||void 0===g?void 0:g.error)||void 0===j?void 0:j.key)&&void 0!==k?k:null===(A=null==Q?void 0:Q.error)||void 0===A?void 0:A.key)&&void 0!==b?b:null===(D=null==Q?void 0:Q.error)||void 0===D?void 0:D.value})]}))}))};export{v as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useState as r,useEffect as l}from"react";import i from"../../../components/AllowedListDropdown.js";import{ApiResponseHelper as d}from"../../../helpers/ApiResponse.helper.js";import{useQueryBuilder as t}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as n}from"../../../hooks/useQueryBuilderCache.js";import{QueryBuilderType as s}from"../../../types/QueryBuilder.type.js";import a from"../../../components/DropdownWrapper.js";import{BaseQueryBuilderNode as u}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const v=new d,p=d=>{let{node:p,allowedNodes:m,apiHandler:c,mode:y,selectorKey:f}=d;var h,w,g,j,k,A,b,B,D;const{updateMeta:T,selectType:E,createMeta:I}=t(f),{cacheWrap:L}=n(),[S,_]=r(!1),[x,N]=r([]),Q=p.metas.find((e=>"segmentID"===e.key));return l((()=>{Q||I({key:"segmentID"},p._id),L((()=>c({})),"SEGMENT_FILTER").then((e=>{if(e&&Array.isArray(e))N([...e.map((e=>({label:e.name,value:e.id,description:e.description,selected:"create"!==y&&(!!(null==Q?void 0:Q.value)&&Q.value===e.id)})))]);else{const o=v.convertToGroupOptions(e,(null==Q?void 0:Q.value)?[Q.value]:void 0);N([...o])}_(!1)}))}),[]),e(u,Object.assign({node:p,mode:y},{children:o("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[e(i,{disabled:"view"===y,loading:S,selectedType:p.type,allowedList:m,onSelect:function(e){Array.isArray(e)||(_(!0),E(e.value,p._id),e.value==s.SEGMENT_FILTER&&I({key:"segmentID"},p._id)),_(!1)}}),(null===(w=null===(h=null==p?void 0:p.metas)||void 0===h?void 0:h[0])||void 0===w?void 0:w.key)&&e(a,{selectedValues:(null==Q?void 0:Q.value)?[Q.value]:void 0,isSearchable:!0,isLoading:S,disabled:"view"===y,width:"200px",dropdownLabel:"Select segment",options:x,onSelect:function(e){Array.isArray(e)||T({key:"segmentID",value:e.value,error:{}},p._id)},error:null!==(B=null!==(A=null===(k=null===(j=null===(g=p.metas)||void 0===g?void 0:g[0])||void 0===j?void 0:j.error)||void 0===k?void 0:k.key)&&void 0!==A?A:null===(b=null==Q?void 0:Q.error)||void 0===b?void 0:b.key)&&void 0!==B?B:null===(D=null==Q?void 0:Q.error)||void 0===D?void 0:D.value})]}))}))};export{p as default};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
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 "../../../types/QueryBuilderAPI.type";
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 "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
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;
@@ -1,25 +1,37 @@
1
- import o from"styled-components";import{COLORS as e}from"../../../../constants/Theme.js";const r=o.div`
1
+ import o from"styled-components";import{COLORS as r}from"../../../../constants/Theme.js";const e=o.div`
2
2
  border-radius: ${o=>"2.0"===o.version?8:4}px;
3
3
  border: ${o=>"2.0"===o.version?0:1}px solid
4
- ${e.stroke.primary};
4
+ ${r.stroke.primary};
5
5
  max-height: 640px;
6
6
  overflow: hidden;
7
7
  display: flex;
8
8
  flex-direction: row;
9
9
  position: relative;
10
10
  padding: ${o=>"2.0"===o.version?4:0}px;
11
- background-color: ${e.surface.standard};
11
+ background-color: ${r.surface.standard};
12
12
  `;o.div`
13
13
  padding: 14px 16px 14px 18px;
14
14
  flex-direction: row;
15
15
  align-items: center;
16
16
  border-bottom-width: 1px;
17
17
  border-bottom-style: solid;
18
- border-bottom-color: ${e.stroke.primary};
18
+ border-bottom-color: ${r.stroke.primary};
19
19
  width: 100%;
20
20
  height: 100%;
21
21
  `;const i=o.div`
22
22
  max-height: ${o=>"number"==typeof o.maxHeight?`${o.maxHeight}px`:o.maxHeight};
23
23
  overflow-y: auto;
24
24
  position: relative;
25
- `;export{i as MenuListContainer,r as OpennedDropdownContainer};
25
+ &::-webkit-scrollbar-thumb {
26
+ background: #e0e0e0;
27
+ border-radius: 8px;
28
+ }
29
+ &::-webkit-scrollbar {
30
+ height: 5px;
31
+ display: block;
32
+ width: 8px;
33
+ }
34
+ &::-webkit-scrollbar-thumb:horizontal {
35
+ width: 8px;
36
+ }
37
+ `;export{i as MenuListContainer,e as OpennedDropdownContainer};
@@ -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 r,useMemo as i}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";const m=m=>{let{selectedTemplate:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:x,onTemplateSelect:f,globalPlaceholders:E,showOnlyContent:P,whatsappSpecificPickerMeta:S,zIndex:I,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,onBackPress:L,enabledCustomText:V,variableListForImage:j,showSampleValues:A,disableEditVariable:D,pod:k,extras:O,pickerConf:W,selectedCarouselProducts:F,disableEditExpiry:H,cardWidth:z,onDeleteSelectedProducts:B}=m;var R,U,$,_,N,q;t((()=>{Y(g)}),[g]);const G=b===s.WHATSAPP&&"CAROUSEL"===(null===(U=null===(R=null==v?void 0:v.components)||void 0===R?void 0:R[1])||void 0===U?void 0:U.type),J=null==v?void 0:v.isProductCarouselType,[K,Q]=r(b===s.EMAIL||G?"desktop":"mobile"),[X,Y]=r(g),[Z,ee]=r(!1),[le,oe]=r([]),[te,re]=r(v),[ie,ae]=r([]),[ne,se]=r(!1),[de,ce]=r(null!=x?x:[]),[ue,pe]=r(!1),[me,ve]=r(-1),[he,Ce]=r([]);t((()=>{F?Ce(F):J&&Ce([])}),[F]),t((()=>{var e;if(!ne&&J&&(!F||0===Ce.length)){const l=null===(e=null==te?void 0:te.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,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),ae(o),se(!0)}}),[ne]);const be=i((()=>p(E)),[E]);return e(d.Provider,Object.assign({value:{template:te,setTemplate:re,device:K,setDevice:Q,display_content:X,setDisplayContent:Y,originalVariableList:de,setOriginalVariableList:ce,isError:Z,setIsError:ee,channel:b,globalNormalizedPlaceholders:be,templateSelectionTriggered:ue,setTemplateSelectionTriggered:pe,enabledCustomText:V,disableEditVariable:D,pod:k,extras:O,isWhatsappCarousel:G,selectedCarouselIndex:me,setSelectedCarouselIndex:ve,isProductCarouselType:J,cardCount:G?null===(_=null===($=v.components)||void 0===$?void 0:$[1].cards)||void 0===_?void 0:_.length:void 0,errorIndexes:le,setErrorIndexes:oe,pickerConf:W,carouselProducts:he,setCarouselProducts:Ce,disableEditExpiry:H,cardWidth:z,cardImages:ie,onDeleteSelectedProducts:B}},{children:P?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:I,centralContainerStyles:{width:G?900:b===s.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==te?void 0:te.label,headingSubtitle:b===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(N=null==te?void 0:te.category)&&void 0!==N?N:"")} • ${null!==(q=null==te?void 0:te.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:A,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,variableListForImage:j&&(null==j?void 0:j.length)>0?j:y}),f?e(c,{isWhatsappCarousel:null!=G&&G,onSelect:function(){if((null==he?void 0:he.length)<1&&J)return void ee(!0);const e=null==f?void 0:f(te,de,null!=X?X:"",he);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&oe(e.errorIndexes),(null==e?void 0:e.error)&&ee(!!(null==e?void 0:e.error))):pe(!0)}}):e(o,{})]}))}))};export{m as TemplateContextMapper};
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";const m=m=>{let{selectedTemplate:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:f,onTemplateSelect:x,globalPlaceholders:E,showOnlyContent:P,whatsappSpecificPickerMeta:S,zIndex:I,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,onBackPress:L,enabledCustomText:V,variableListForImage:j,showSampleValues:A,disableEditVariable:D,pod:k,extras:F,pickerConf:O,selectedCarouselProducts:W,disableEditExpiry:N,cardWidth:H,onDeleteSelectedProducts:z,fileName:B,setFileName:R}=m;var U,$,_,q,G,J;t((()=>{ee(g)}),[g]);const K=b===s.WHATSAPP&&"CAROUSEL"===(null===($=null===(U=null==v?void 0:v.components)||void 0===U?void 0:U[1])||void 0===$?void 0:$.type),Q=null==v?void 0:v.isProductCarouselType,[X,Y]=i(b===s.EMAIL||K?"desktop":"mobile"),[Z,ee]=i(g),[le,oe]=i(!1),[te,ie]=i([]),[re,ae]=i(v),[ne,se]=i([]),[de,ce]=i(!1),[ue,pe]=i(null!=f?f:[]),[me,ve]=i(!1),[he,Ce]=i(-1),[be,ge]=i([]);t((()=>{W?ge(W):Q&&ge([])}),[W]),t((()=>{var e;if(!de&&Q&&(!W||0===ge.length)){const l=null===(e=null==re?void 0:re.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:"")}))})),se(o),ce(!0)}}),[de]);const fe=r((()=>p(E)),[E]);return e(d.Provider,Object.assign({value:{template:re,setTemplate:ae,device:X,setDevice:Y,display_content:Z,setDisplayContent:ee,originalVariableList:ue,setOriginalVariableList:pe,isError:le,setIsError:oe,channel:b,globalNormalizedPlaceholders:fe,templateSelectionTriggered:me,setTemplateSelectionTriggered:ve,enabledCustomText:V,disableEditVariable:D,pod:k,extras:F,isWhatsappCarousel:K,selectedCarouselIndex:he,setSelectedCarouselIndex:Ce,isProductCarouselType:Q,cardCount:K?null===(q=null===(_=v.components)||void 0===_?void 0:_[1].cards)||void 0===q?void 0:q.length:void 0,errorIndexes:te,setErrorIndexes:ie,pickerConf:O,carouselProducts:be,setCarouselProducts:ge,disableEditExpiry:N,cardWidth:H,cardImages:ne,onDeleteSelectedProducts:z}},{children:P?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:I,centralContainerStyles:{width:K?900:b===s.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==re?void 0:re.label,headingSubtitle:b===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(G=null==re?void 0:re.category)&&void 0!==G?G:"")} • ${null!==(J=null==re?void 0:re.templateCategory)&&void 0!==J?J:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:A,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,variableListForImage:j&&(null==j?void 0:j.length)>0?j:y,fileName:B,setFileName:R}),x?e(c,{isWhatsappCarousel:null!=K&&K,onSelect:function(){if((null==be?void 0:be.length)<1&&Q)return void oe(!0);const e=null==x?void 0:x(re,ue,null!=Z?Z:"",be);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&ie(e.errorIndexes),(null==e?void 0:e.error)&&oe(!!(null==e?void 0:e.error))):ve(!0)}}):e(o,{})]}))}))};export{m 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 o,Fragment as t}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 d}from"../utils/getVariableNameEmail.js";import{highlightFor as m}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`
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,A=a(),S=a(),{device:T,display_content:k,channel:E,template:L,setTemplate:I,isWhatsappCarousel:_,isProductCarouselType:$}=p();const D=e=>{let o=0;for(;e;)o+=e.offsetTop,e=e.offsetParent;return o};return e(v,{children:[o(b,Object.assign({showOnlyContent:C,showVariableMapping:g,isWhatsappCarousel:_},{children:"mobile"===T?o(h,{ref:S,display_content:null!=k?k:"",channel:E,template:L,showSampleValues:V}):E===n.WHATSAPP&&_?o(l,{ref:A,channel:E,template:L,showSampleValues:V,isPreview:!1}):E!==n.MESSAGE?o(c,{ref:A,channel:E,display_content:null!=k?k:"",showSampleValues:V}):o(t,{})})),($||g)&&o(w,Object.assign({channel:E,isWhatsappCarousel:_},{children:E!==n.WHATSAPP?o(f,{onFocus:E===n.EMAIL?function(e){var o,t,a;const i=null===document||void 0===document?void 0:document.getElementById("mobile"===T?"template_html_mobile":"template_html_desktop"),l=d(e+1),s=E===n.EMAIL?null===(o=null==i?void 0:i.contentWindow)||void 0===o?void 0:o.document.getElementById(l):document.getElementById(l),p=D(s),c=null==s?void 0:s.offsetLeft;"desktop"===T?p&&A.current&&(null===(t=null==i?void 0:i.contentWindow)||void 0===t||t.scrollTo(null!=c?c:0,p),m(l,r.background.warning.light,2,E,T)):p&&S.current&&(null===(a=null==i?void 0:i.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),m(l,r.background.warning.light,2,E,T))}:void 0,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j}):E===n.WHATSAPP&&_?o(s,{whatsappSpecificPickerMeta:x,template:L,showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j}):o(u,{whatsappSpecificPickerMeta:x,template:L,onTemplateChange:e=>{null==I||I(e)},showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j})}))]})};export{g as default};
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};
@@ -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{Input as s}from"../../input/Input.js";import{HEADER_TYPES as a}from"../../template-preview/models/TemplateMeta.js";import{POD as d}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as r}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as p}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as c}from"./BackTrackComponent.js";import{DiscountCodeComponent as u}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as m}from"./EditMediaV2.style.js";import v from"./EditWhatsAppTemplateMediaV2.js";import b from"./VariableConnector.js";import{Container as g}from"./VariableConnectorsPanel.js";import f from"./VariableConnectorWhatsApp.js";import h from"./VariableEditorHeader.js";import O from"./WhatsAppTemplateCardButtonV2.js";import j from"styled-components";const C=j=>{let{template:C,onTemplateChange:x,whatsappSpecificPickerMeta:y,showVariableModal:V,variableList:B,variableListForImage:E,discountCode:k,setDiscountCode:L,fileName:U,setFileName:I}=j;var w,R,P,A,N,M,S,_,H,D,Q,q,Y,K,F,W,$,z,X,Z,G;const J=C.isCarouselType,{originalVariableList:nn,pod:on,extras:tn,selectedCarouselIndex:en,isProductCarouselType:ln}=r(),{descriptionComponents:sn,urlBtns:an,qrbBtns:dn,imageComponent:rn,bodyVariables:pn,headerVariables:cn}=p(C),[un,mn]=i(!1),[vn,bn]=i(-1===en?{descriptionComponents:sn,urlBtns:an,qrbBtns:dn,imageComponent:rn,bodyVariables:pn,headerVariables:cn}:{}),[gn,fn]=i(!1),[hn,On]=i(U),[jn,Cn]=i("");function Tn(n,o,t){var i,l,s,a,d,r,p,c,u,m;const v=null!=en&&en>-1?{components:null===(i=Object.assign({},C).components[1].cards)||void 0===i?void 0:i[en].components,mapping:null===(l=Object.assign({},C).mapping.cards)||void 0===l?void 0:l[en]}:Object.assign({},C),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!=en&&en>-1&&ln){const o=Object.assign({},C).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({},C).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(C);return l.components=o,l.mapping.cards=i,void(null==x||x(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))?mn(!0):(mn(!1),null==L||L(""))}if(null!=en&&en>-1){const n=e(C);n.components[1].cards[en].components=b.components,n.mapping.cards[en]=b.mapping,null==x||x(Object.assign({},n))}else null==x||x(b)}function xn(n,o,t){var i,l,s,a,d,r;const p=null!=en&&en>-1?{components:null===(i=Object.assign({},C).components[1].cards)||void 0===i?void 0:i[en].components,mapping:null===(l=Object.assign({},C).mapping.cards)||void 0===l?void 0:l[en]}:Object.assign({},C);if(null!=en&&en>-1&&ln){const o=Object.assign({},C).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(C);return i.components=o,void(null==x||x(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!=en&&en>-1){const n=e(C);n.components[1].cards[en].components=p.components,null==x||x(Object.assign({},n))}else null==x||x(p)}l((()=>{var n,o;if(null===(n=C.mapping.buttons)||void 0===n?void 0:n.find((n=>"checkout.checkoutUrl"===n.slice(2,-2))))mn(!0);else{mn(!1);const n=null===(o=null==tn?void 0:tn.discountCodeExtra)||void 0===o?void 0:o[1];null==n||n("")}}),[C]),l((()=>{var n,o,t,e;if(null!=en&&en>-1){const i={components:null===(o=null===(n=C.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[en].components,mapping:null===(e=null===(t=null==C?void 0:C.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[en]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:c}=p(i);bn({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:c})}else if(null!=en&&-1===en){const{descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l}=p(C);bn({descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l})}}),[en]),l((()=>{var n,o,t,e;if(null!=en&&en>-1&&gn){const i={components:null===(o=null===(n=C.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[en].components,mapping:null===(e=null===(t=null==C?void 0:C.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[en]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:c}=p(i);bn({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:d,bodyVariables:r,headerVariables:c}),fn(!1)}}),[gn]);return n(g,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!vn.imageComponent&&!ln&&n(m,{children:[o(v,{whatsappSpecificPickerMeta:y,mediaComponent:J?vn.imageComponent:rn,updateTemplateImageUrl:function(n,o){var t,i,l,s,a,d,r,p;let c;c=null!=en&&en>-1?{components:null===(i=null===(t=C.components[1])||void 0===t?void 0:t.cards)||void 0===i?void 0:i[en].components,mapping:null===(s=null===(l=null==C?void 0:C.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[en]}:Object.assign({},C);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!=en&&en>-1){const n=e(C);n.components[1].cards[en].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[en]=null!==(p=c.mapping)&&void 0!==p?p:{}),null==x||x(Object.assign({},n)),fn(!0)}else null==x||x(Object.assign({},c))},template:C,variableListForImage:E}),(null==rn?void 0:rn.format)==a.DOCUMENT?o(T,{children:o(s,{labelText:"PDF Name",placeholder:"Enter the name",value:hn,errorMessage:jn||void 0,onBlur:()=>{if(!hn)return;/[^a-zA-Z0-9._]/.test(hn)?Cn("Please enter a valid PDF name"):(Cn(""),null==I||I(hn))},onChangeText:n=>{Cn(""),On(n)}})}):o(t,{})]}),vn.bodyVariables.length>0&&o(h,{containerStyle:{paddingTop:vn.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===(w=vn.descriptionComponents)||void 0===w?void 0:w.map(((n,t)=>o(f,{originalVariableList:null!=en&&en>-1?nn.cards[en]:nn,type:n.type,descriptionComponent:n.component,showVariableModal:V,variableList:B},t))),(null===(P=null===(R=null!=en&&en>-1?nn.cards[en].buttons:null==nn?void 0:nn.buttons)||void 0===R?void 0:R.filter((n=>"URL"===n.type)))||void 0===P?void 0:P.length)>0&&o(h,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(N=null===(A=null!=en&&en>-1?nn.cards[en].buttons:null==nn?void 0:nn.buttons)||void 0===A?void 0:A.filter((n=>on===d.CHATBOT||"URL"===n.type)))||void 0===N?void 0:N.map(((n,t)=>{if("URL"===n.type)return o(O,{variableListIndex:t,CTAoptions:null==y?void 0:y.CTAoptions,button:n,currentVariableList:null!=en&&en>-1?Object.assign({},nn.cards[en]):Object.assign({},nn),updateSelectedURLTemplateBtn:Tn,variableList:B},`${t}_${en}`)})),on===d.CHATBOT&&(null===(S=null===(M=dn[0])||void 0===M?void 0:M.component)||void 0===S?void 0:S.buttons)&&(null===(D=null===(H=null===(_=dn[0])||void 0===_?void 0:_.component)||void 0===H?void 0:H.buttons)||void 0===D?void 0:D.length)>0&&o(c,{backTrackMessage:null===(Q=null==tn?void 0:tn.backTrackExtra)||void 0===Q?void 0:Q[0],setBackTrackMessage:null===(q=null==tn?void 0:tn.backTrackExtra)||void 0===q?void 0:q[1]}),(null===(K=null===(Y=null!=en&&en>-1?nn.cards[en].buttons:null==nn?void 0:nn.buttons)||void 0===Y?void 0:Y.filter((n=>"QUICK_REPLY"===n.type)))||void 0===K?void 0:K.length)>0&&(on!==d.CHATBOT?o(h,{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(c,{backTrackMessage:null===(F=null==tn?void 0:tn.backTrackExtra)||void 0===F?void 0:F[0],setBackTrackMessage:null===(W=null==tn?void 0:tn.backTrackExtra)||void 0===W?void 0:W[1]})),null===(z=null===($=null!=en&&en>-1?nn.cards[en].buttons:null==nn?void 0:nn.buttons)||void 0===$?void 0:$.filter((n=>"QUICK_REPLY"===n.type)))||void 0===z?void 0:z.map(((n,t)=>{if("QUICK_REPLY"===n.type&&on!==d.CHATBOT)return o(O,{variableListIndex:t,QRBoptions:null==y?void 0:y.QRBoptions,button:n,currentVariableList:null!=en&&en>-1?Object.assign({},nn.cards[en]):Object.assign({},nn),updateSelectedQRBTemplateBtn:xn},`${t}_${en}`)})),on===d.CHATBOT&&un&&o(u,{discountCode:null===(X=null==tn?void 0:tn.discountCodeExtra)||void 0===X?void 0:X[0],setDiscountCode:null===(Z=null==tn?void 0:tn.discountCodeExtra)||void 0===Z?void 0:Z[1],variableList:B}),null===(G=null!=en&&en>-1?nn.cards[en].buttons:null==nn?void 0:nn.buttons)||void 0===G?void 0:G.map(((n,t)=>{var e,i,l;if("COPY_CODE"===n.type)return o(b,{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:B,componentType:"BUTTONS"},t)}))]}))},T=j.div`
2
+ padding-top: 24px;
3
+ padding-left: 10px;
4
+ padding-right: 10px;
5
+ margin-bottom: 8px;
6
+ line-height: normal;
7
+ `;export{C as default};
@@ -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;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import{CHANNEL_TYPE as o}from"../../template-preview/models/Channels.js";import t from"./Body.js";import i from"./Header.js";const s=s=>{let{channel:r,showVariableMapping:l,showOnlyContent:n,whatsappSpecificPickerMeta:p,showVariableModal:d,variableList:c,discountCode:m,setDiscountCode:h,variableListForImage:w,showSampleValues:b}=s;return e("div",Object.assign({style:{paddingBottom:0}},{children:a("div",{children:[r===o.EMAIL&&e(i,{showOnlyContent:n}),e(t,{whatsappSpecificPickerMeta:p,showVariableMapping:!!l,showOnlyContent:n,showVariableModal:d,variableList:c,discountCode:m,setDiscountCode:h,variableListForImage:w,showSampleValues:b})]})}))};export{s as default};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.505",
3
+ "version": "0.0.506-beta-pdf",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",