@bikdotai/bik-component-library 0.0.612-beta-vsp.16 → 0.0.613

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 (19) hide show
  1. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  2. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  3. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  6. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  7. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  8. package/dist/cjs/components/template-context-mapper/utils/validateName.d.ts +0 -1
  9. package/dist/cjs/components/template-context-mapper/utils/validateName.js +1 -1
  10. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  11. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  12. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  13. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  14. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  15. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  16. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  17. package/dist/esm/components/template-context-mapper/utils/validateName.d.ts +0 -1
  18. package/dist/esm/components/template-context-mapper/utils/validateName.js +1 -1
  19. package/package.json +1 -1
@@ -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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var n=require("../../variable-picker-v3/model.js"),t=require("lodash"),o=require("react"),i=require("styled-components"),l=require("../../input/Input.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../template-preview/models/TemplateMeta.js"),d=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../context/templateModalContext.js"),u=require("../utils/constants.js"),p=require("../utils/getDataFromTemplateComponent.js"),c=require("../utils/validateIsUrl.js"),v=require("../utils/validateName.js"),m=require("./BackTrackComponent.js"),b=require("./DiscountCodeComponent.js"),g=require("./EditMediaModal.js"),h=require("./EditMediaV2.js"),f=require("./EditMediaV2.style.js"),j=require("./useEditWhtasappTemplateMedia.js"),C=require("./VariableConnector.js"),T=require("./VariableConnectorsPanel.js"),O=require("./VariableConnectorWhatsApp.js"),x=require("./VariableEditorHeader.js"),E=require("./WhatsAppTemplateCardButtonV2.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const V=y(i).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("styled-components"),i=require("../../input/Input.js"),l=require("../../template-preview/models/TemplateMeta.js"),a=require("../../template-preview/models/WhatsAppTemplate.js"),s=require("../context/templateModalContext.js"),d=require("../utils/constants.js"),u=require("../utils/getDataFromTemplateComponent.js"),r=require("../utils/validateIsUrl.js"),p=require("../utils/validateName.js"),c=require("./BackTrackComponent.js"),v=require("./DiscountCodeComponent.js"),m=require("./EditMediaModal.js"),b=require("./EditMediaV2.js"),g=require("./EditMediaV2.style.js"),f=require("./useEditWhtasappTemplateMedia.js"),j=require("./VariableConnector.js"),h=require("./VariableConnectorsPanel.js"),C=require("./VariableConnectorWhatsApp.js"),x=require("./VariableEditorHeader.js"),O=require("./WhatsAppTemplateCardButtonV2.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const y=T(o).default.div`
2
2
  padding-top: 24px;
3
3
  padding-left: 10px;
4
4
  padding-right: 10px;
5
5
  margin-bottom: 8px;
6
6
  line-height: normal;
7
- `;exports.default=i=>{let{template:y,onTemplateChange:B,whatsappSpecificPickerMeta:M,showVariableModal:k,variableListForImage:D,setDiscountCode:I,fileName:q,setFileName:P}=i;var R,L,A,U,w,H,N,_,S,F,Q,Y,W,K,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,re,ue,pe,ce,ve,me,be,ge,he,fe;const je=y.isCarouselType,{originalVariableList:Ce,pod:Te,extras:Oe,selectedCarouselIndex:xe,isProductCarouselType:Ee,disableCopyCode:ye,isError:Ve}=r.useTemplateModalContext(),{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}=p.getAllDataFromTemplateComponent(y),Pe=o.useRef(null),[Re,Le]=o.useState(!1),[Ae,Ue]=o.useState(-1===xe?{descriptionComponents:Be,urlBtns:Me,qrbBtns:ke,imageComponent:De,bodyVariables:Ie,headerVariables:qe}:{}),{uploadMediaLink:we,uploadMediaFiles:He,validateMimeType:Ne}=M,_e=j.useEditWhatsappTemplateMedia({uploadMediaLink:we,uploadMediaFiles:He,updateTemplateImageUrl:function(e,n){var o,i,l,a,s,d,r,u;let p;p=null!=xe&&xe>-1?{components:null===(i=null===(o=y.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[xe].components,mapping:null===(a=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[xe]}:Object.assign({},y);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.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 t=Object.assign(Object.assign({},p.components[c]),{format:n,example:{header_handle:[e]}}),o=[...p.components];o[c]=t,p=Object.assign(Object.assign({},p),{components:o})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=xe&&xe>-1){const e=t.cloneDeep(y);e.components[1].cards[xe].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[xe]=null!==(u=p.mapping)&&void 0!==u?u:{}),null==B||B(Object.assign({},e)),Fe(!0)}else null==B||B(Object.assign({},p))},validateMimeType:Ne,mediaComponent:je?Ae.imageComponent:De,fileRef:Pe}),[Se,Fe]=o.useState(!1),[Qe,Ye]=o.useState(q),[We,Ke]=o.useState();function $e(e,n,o){var i,l,a,s,d,r,u,p,c,v;const m=null!=xe&&xe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},y),b=t.cloneDeep(m),g="custom"===n&&"string"==typeof e,h=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=xe&&xe>-1&&Ee){const n=Object.assign({},y).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 a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[h]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},y).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.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=t.cloneDeep(y);return l.components=n,l.mapping.cards=i,void(null==B||B(Object.assign({},l)))}const f=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==f&&f>-1){const t=null===(d=null==b?void 0:b.components[f].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(u=null===(r=b.components)||void 0===r?void 0:r[f])||void 0===u?void 0:u.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[f]),{buttons:s}),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[f]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?Le(!0):(Le(!1),null==I||I(""))}if(null!=xe&&xe>-1){const e=t.cloneDeep(y);e.components[1].cards[xe].components=b.components,e.mapping.cards[xe]=b.mapping,null==B||B(Object.assign({},e))}else null==B||B(b)}function Ge(e,n,o){var i,l,a,s,d,r,u;const p=null!=xe&&xe>-1?{components:null===(i=Object.assign({},y).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},y).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},y);if(null!=xe&&xe>-1&&Ee){const n=Object.assign({},y).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 a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t.cloneDeep(y);return i.components=n,void(null==B||B(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.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!==(u=null===(r=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==u?u:[]].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({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=xe&&xe>-1){const e=t.cloneDeep(y);e.components[1].cards[xe].components=p.components,null==B||B(Object.assign({},e))}else null==B||B(p)}o.useEffect((()=>{var e,n;if(null===(e=y.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))Le(!0);else{Le(!1);const e=null===(n=null==Oe?void 0:Oe.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[y]),o.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u})}else if(null!=xe&&-1===xe){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=p.getAllDataFromTemplateComponent(y);Ue({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[xe]),o.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1&&Se){const i={components:null===(n=null===(e=y.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}=p.getAllDataFromTemplateComponent(i);Ue({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:u}),Fe(!1)}}),[Se]);const Xe=()=>{if(!q)return void Ke("PDF name is Required");const e=v.validateInputNameChatbot(q);null==P||P(null!=q?q:""),Ke(e?"Please enter a valid PDF name":void 0)};o.useEffect((()=>{Ve&&Te===d.POD.CHATBOT&&Xe()}),[Ve]);const ze=je?Ae.imageComponent:De;return _e.openEditMedia?e.jsx(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(g.default,{mediaComponentFormat:null!==(R=ze.format)&&void 0!==R?R:s.HEADER_TYPES.IMAGE,uploadMedia:_e.uploadMedia,variableListForImage:D||[],useEditWhatsappTemplateMediaResponse:_e,setOpenEditMedia:_e.setOpenEditMedia,openEditMedia:_e.openEditMedia,editIconRef:_e.editIconRef,fileRef:Pe})})):e.jsxs(T.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Ee?"420px":"auto"}},{children:[!!Ae.imageComponent&&!Ee&&e.jsxs(f.EditTemplateMediaContainer,{children:[e.jsx(h.default,{imageName:null!==(A=null===(L=null==ze?void 0:ze.example)||void 0===L?void 0:L.header_handle)&&void 0!==A?A:[],handleImageChange:_e.handleImageChange,mediaType:null==ze?void 0:ze.format,error:_e.error,isLoading:_e.loading,setOpenEditMedia:_e.setOpenEditMedia,selectedVariable:c.isVariable(null!==(H=null===(w=null===(U=null==ze?void 0:ze.example)||void 0===U?void 0:U.header_handle)||void 0===w?void 0:w[0])&&void 0!==H?H:"")?null===(_=null===(N=null==ze?void 0:ze.example)||void 0===N?void 0:N.header_handle)||void 0===_?void 0:_[0]:(null===(F=null===(S=null==y?void 0:y.mapping)||void 0===S?void 0:S.header)||void 0===F?void 0:F[0])?null===(Y=null===(Q=null==y?void 0:y.mapping)||void 0===Q?void 0:Q.header)||void 0===Y?void 0:Y[0]:_e.selectedVariable}),(null==De?void 0:De.format)==s.HEADER_TYPES.DOCUMENT?e.jsx(V,{children:Te===d.POD.CHATBOT?e.jsx(a.InputWithVariables,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:We||void 0,onBlur:Te!==d.POD.CHATBOT?Xe:void 0,onChange:e=>{var n;Ke(""),null==P||P(null!==(n=null==e?void 0:e.actualValue)&&void 0!==n?n:"")},pickerType:n.PickerType.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=q?q:"",variableType:"string"},variablesList:D,showAddButton:Te===d.POD.CHATBOT}):e.jsx(l.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Qe,errorMessage:We||void 0,onBlur:()=>{if(!Qe)return null==P||P(""),void Ke("PDF name is Required");const e=v.validateInputName(Qe);null==P||P(Qe),Ke(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Ke(""),Ye(e)}})}):e.jsx(e.Fragment,{})]}),(null===(W=Ae.bodyVariables)||void 0===W?void 0:W.length)>0&&e.jsx(x.default,{containerStyle:{paddingTop:Ae.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===(K=Ae.descriptionComponents)||void 0===K?void 0:K.map(((n,t)=>e.jsx(O.default,{originalVariableList:null!=xe&&xe>-1?Ce.cards[xe]:Ce,type:n.type,descriptionComponent:n.component,showVariableModal:k},t))),(null===(X=null===(G=null!=xe&&xe>-1?null===($=Ce.cards[xe])||void 0===$?void 0:$.buttons:null==Ce?void 0:Ce.buttons)||void 0===G?void 0:G.filter((e=>"URL"===e.type)))||void 0===X?void 0:X.length)>0&&e.jsx(x.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(Z=null===(J=null!=xe&&xe>-1?null===(z=Ce.cards[xe])||void 0===z?void 0:z.buttons:null==Ce?void 0:Ce.buttons)||void 0===J?void 0:J.filter((e=>Te===d.POD.CHATBOT||"URL"===e.type)))||void 0===Z?void 0:Z.map(((n,t)=>{const o=n.buttonVariable===u.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(E.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==M?void 0:M.CTAoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},Ce.cards[xe]):Object.assign({},Ce),updateSelectedURLTemplateBtn:$e},`${t}_${xe}`)})),Te===d.POD.CHATBOT&&(null===(ne=null===(ee=ke[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)&&(null===(ie=null===(oe=null===(te=ke[0])||void 0===te?void 0:te.component)||void 0===oe?void 0:oe.buttons)||void 0===ie?void 0:ie.length)>0&&e.jsx(m.BackTrackComponent,{backTrackMessage:null===(le=null==Oe?void 0:Oe.backTrackExtra)||void 0===le?void 0:le[0],setBackTrackMessage:null===(ae=null==Oe?void 0:Oe.backTrackExtra)||void 0===ae?void 0:ae[1]}),(null===(re=null===(de=null!=xe&&xe>-1?null===(se=Ce.cards[xe])||void 0===se?void 0:se.buttons:null==Ce?void 0:Ce.buttons)||void 0===de?void 0:de.filter((e=>"QUICK_REPLY"===e.type)))||void 0===re?void 0:re.length)>0&&(Te!==d.POD.CHATBOT?e.jsx(x.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(m.BackTrackComponent,{backTrackMessage:null===(ue=null==Oe?void 0:Oe.backTrackExtra)||void 0===ue?void 0:ue[0],setBackTrackMessage:null===(pe=null==Oe?void 0:Oe.backTrackExtra)||void 0===pe?void 0:pe[1]})),null===(me=null===(ve=null!=xe&&xe>-1?null===(ce=Ce.cards[xe])||void 0===ce?void 0:ce.buttons:null==Ce?void 0:Ce.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.map(((n,t)=>{if("QUICK_REPLY"===n.type&&Te!==d.POD.CHATBOT)return e.jsx(E.default,{variableListIndex:t,QRBoptions:null==M?void 0:M.QRBoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},Ce.cards[xe]):Object.assign({},Ce),updateSelectedQRBTemplateBtn:Ge},`${t}_${xe}`)})),Te===d.POD.CHATBOT&&Re&&e.jsx(b.DiscountCodeComponent,{discountCode:null===(be=null==Oe?void 0:Oe.discountCodeExtra)||void 0===be?void 0:be[0],setDiscountCode:null===(ge=null==Oe?void 0:Oe.discountCodeExtra)||void 0===ge?void 0:ge[1]}),null===(fe=null!=xe&&xe>-1?null===(he=Ce.cards[xe])||void 0===he?void 0:he.buttons:null==Ce?void 0:Ce.buttons)||void 0===fe?void 0:fe.map(((n,t)=>{var o,i,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:ye?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(l.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(i=n.buttonVariable)&&void 0!==i?i:"",onChangeText:()=>{}})})):e.jsx(C.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
7
+ `;exports.default=o=>{let{template:T,onTemplateChange:E,whatsappSpecificPickerMeta:V,showVariableModal:B,variableListForImage:M,setDiscountCode:k,fileName:I,setFileName:R}=o;var q,D,L,U,A,P,w,_,N,S,F,H,Q,Y,K,W,$,G,X,z,J,Z,ee,ne,te,oe,ie,le,ae,se,de,ue,re,pe,ce,ve,me,be,ge;const fe=T.isCarouselType,{originalVariableList:je,pod:he,extras:Ce,selectedCarouselIndex:xe,isProductCarouselType:Oe,disableCopyCode:Te}=s.useTemplateModalContext(),{descriptionComponents:ye,urlBtns:Ee,qrbBtns:Ve,imageComponent:Be,bodyVariables:Me,headerVariables:ke}=u.getAllDataFromTemplateComponent(T),Ie=t.useRef(null),[Re,qe]=t.useState(!1),[De,Le]=t.useState(-1===xe?{descriptionComponents:ye,urlBtns:Ee,qrbBtns:Ve,imageComponent:Be,bodyVariables:Me,headerVariables:ke}:{}),{uploadMediaLink:Ue,uploadMediaFiles:Ae,validateMimeType:Pe}=V,we=f.useEditWhatsappTemplateMedia({uploadMediaLink:Ue,uploadMediaFiles:Ae,updateTemplateImageUrl:function(e,t){var o,i,l,a,s,d,u,r;let p;p=null!=xe&&xe>-1?{components:null===(i=null===(o=T.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[xe].components,mapping:null===(a=null===(l=null==T?void 0:T.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[xe]}:Object.assign({},T);const c=null===(s=null==p?void 0:p.components)||void 0===s?void 0:s.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})}p.mapping&&(p.mapping=Object.assign(Object.assign({},p.mapping),{header:void 0}));if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=p.components,(null===(d=null==e?void 0:e.mapping)||void 0===d?void 0:d.cards)&&(null===(u=null==e?void 0:e.mapping)||void 0===u?void 0:u.cards.length)>0&&(e.mapping.cards[xe]=null!==(r=p.mapping)&&void 0!==r?r:{}),null==E||E(Object.assign({},e)),Ne(!0)}else null==E||E(Object.assign({},p))},validateMimeType:Pe,mediaComponent:fe?De.imageComponent:Be,fileRef:Ie}),[_e,Ne]=t.useState(!1),[Se,Fe]=t.useState(I),[He,Qe]=t.useState();function Ye(e,t,o){var i,l,a,s,d,u,r,p,c,v;const m=null!=xe&&xe>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},T),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!=xe&&xe>-1&&Oe){const t=Object.assign({},T).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 a=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),i=null===(s=null===(a=Object.assign({},T).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.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(T);return l.components=t,l.mapping.cards=i,void(null==E||E(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 a=n[o];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(p=null===(r=null===(u=b.components)||void 0===u?void 0:u[j])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[j]),{buttons:s}),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))?qe(!0):(qe(!1),null==k||k(""))}if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=b.components,e.mapping.cards[xe]=b.mapping,null==E||E(Object.assign({},e))}else null==E||E(b)}function Ke(e,t,o){var i,l,a,s,d,u,r;const p=null!=xe&&xe>-1?{components:null===(i=Object.assign({},T).components[1].cards)||void 0===i?void 0:i[xe].components,mapping:null===(l=Object.assign({},T).mapping.cards)||void 0===l?void 0:l[xe]}:Object.assign({},T);if(null!=xe&&xe>-1&&Oe){const t=Object.assign({},T).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 a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[o])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(T);return i.components=t,void(null==E||E(Object.assign({},i)))}const c=null==p?void 0:p.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==p?void 0:p.components[c])||void 0===a?void 0:a.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===(u=null===(d=p.components)||void 0===d?void 0:d[c])||void 0===u?void 0:u.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({},p.components[c]),{buttons:i}),a=[...p.components];a[c]=l,p.components=a}}if(null!=xe&&xe>-1){const e=n.cloneDeep(T);e.components[1].cards[xe].components=p.components,null==E||E(Object.assign({},e))}else null==E||E(p)}t.useEffect((()=>{var e,n;if(null===(e=T.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))qe(!0);else{qe(!1);const e=null===(n=null==Ce?void 0:Ce.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[T]),t.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Le({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=xe&&-1===xe){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=u.getAllDataFromTemplateComponent(T);Le({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[xe]),t.useEffect((()=>{var e,n,t,o;if(null!=xe&&xe>-1&&_e){const i={components:null===(n=null===(e=T.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[xe].components,mapping:null===(o=null===(t=null==T?void 0:T.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[xe]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=u.getAllDataFromTemplateComponent(i);Le({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Ne(!1)}}),[_e]);const We=fe?De.imageComponent:Be;return we.openEditMedia?e.jsx(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e.jsx(m.default,{mediaComponentFormat:null!==(q=We.format)&&void 0!==q?q:l.HEADER_TYPES.IMAGE,uploadMedia:we.uploadMedia,variableListForImage:M||[],useEditWhatsappTemplateMediaResponse:we,setOpenEditMedia:we.setOpenEditMedia,openEditMedia:we.openEditMedia,editIconRef:we.editIconRef,fileRef:Ie})})):e.jsxs(h.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Oe?"420px":"auto"}},{children:[!!De.imageComponent&&!Oe&&e.jsxs(g.EditTemplateMediaContainer,{children:[e.jsx(b.default,{imageName:null!==(L=null===(D=null==We?void 0:We.example)||void 0===D?void 0:D.header_handle)&&void 0!==L?L:[],handleImageChange:we.handleImageChange,mediaType:null==We?void 0:We.format,error:we.error,isLoading:we.loading,setOpenEditMedia:we.setOpenEditMedia,selectedVariable:r.isVariable(null!==(P=null===(A=null===(U=null==We?void 0:We.example)||void 0===U?void 0:U.header_handle)||void 0===A?void 0:A[0])&&void 0!==P?P:"")?null===(_=null===(w=null==We?void 0:We.example)||void 0===w?void 0:w.header_handle)||void 0===_?void 0:_[0]:(null===(S=null===(N=null==T?void 0:T.mapping)||void 0===N?void 0:N.header)||void 0===S?void 0:S[0])?null===(H=null===(F=null==T?void 0:T.mapping)||void 0===F?void 0:F.header)||void 0===H?void 0:H[0]:we.selectedVariable}),(null==Be?void 0:Be.format)==l.HEADER_TYPES.DOCUMENT?e.jsx(y,{children:e.jsx(i.Input,{labelText:"PDF Name",placeholder:"Enter the name",value:Se,errorMessage:He||void 0,onBlur:()=>{if(!Se)return null==R||R(""),void Qe("PDF name is Required");const e=p.validateInputName(Se);null==R||R(Se),Qe(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Qe(""),Fe(e)}})}):e.jsx(e.Fragment,{})]}),(null===(Q=De.bodyVariables)||void 0===Q?void 0:Q.length)>0&&e.jsx(x.default,{containerStyle:{paddingTop:De.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=De.descriptionComponents)||void 0===Y?void 0:Y.map(((n,t)=>e.jsx(C.default,{originalVariableList:null!=xe&&xe>-1?je.cards[xe]:je,type:n.type,descriptionComponent:n.component,showVariableModal:B},t))),(null===($=null===(W=null!=xe&&xe>-1?null===(K=je.cards[xe])||void 0===K?void 0:K.buttons:null==je?void 0:je.buttons)||void 0===W?void 0:W.filter((e=>"URL"===e.type)))||void 0===$?void 0:$.length)>0&&e.jsx(x.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(z=null===(X=null!=xe&&xe>-1?null===(G=je.cards[xe])||void 0===G?void 0:G.buttons:null==je?void 0:je.buttons)||void 0===X?void 0:X.filter((e=>he===a.POD.CHATBOT||"URL"===e.type)))||void 0===z?void 0:z.map(((n,t)=>{const o=n.buttonVariable===d.STATIC_URL_VARIABLE_NAME;if("URL"===n.type)return e.jsx(O.default,{variableListIndex:t,disableEdit:o,CTAoptions:null==V?void 0:V.CTAoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},je.cards[xe]):Object.assign({},je),updateSelectedURLTemplateBtn:Ye},`${t}_${xe}`)})),he===a.POD.CHATBOT&&(null===(Z=null===(J=Ve[0])||void 0===J?void 0:J.component)||void 0===Z?void 0:Z.buttons)&&(null===(te=null===(ne=null===(ee=Ve[0])||void 0===ee?void 0:ee.component)||void 0===ne?void 0:ne.buttons)||void 0===te?void 0:te.length)>0&&e.jsx(c.BackTrackComponent,{backTrackMessage:null===(oe=null==Ce?void 0:Ce.backTrackExtra)||void 0===oe?void 0:oe[0],setBackTrackMessage:null===(ie=null==Ce?void 0:Ce.backTrackExtra)||void 0===ie?void 0:ie[1]}),(null===(se=null===(ae=null!=xe&&xe>-1?null===(le=je.cards[xe])||void 0===le?void 0:le.buttons:null==je?void 0:je.buttons)||void 0===ae?void 0:ae.filter((e=>"QUICK_REPLY"===e.type)))||void 0===se?void 0:se.length)>0&&(he!==a.POD.CHATBOT?e.jsx(x.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(c.BackTrackComponent,{backTrackMessage:null===(de=null==Ce?void 0:Ce.backTrackExtra)||void 0===de?void 0:de[0],setBackTrackMessage:null===(ue=null==Ce?void 0:Ce.backTrackExtra)||void 0===ue?void 0:ue[1]})),null===(ce=null===(pe=null!=xe&&xe>-1?null===(re=je.cards[xe])||void 0===re?void 0:re.buttons:null==je?void 0:je.buttons)||void 0===pe?void 0:pe.filter((e=>"QUICK_REPLY"===e.type)))||void 0===ce?void 0:ce.map(((n,t)=>{if("QUICK_REPLY"===n.type&&he!==a.POD.CHATBOT)return e.jsx(O.default,{variableListIndex:t,QRBoptions:null==V?void 0:V.QRBoptions,button:n,currentVariableList:null!=xe&&xe>-1?Object.assign({},je.cards[xe]):Object.assign({},je),updateSelectedQRBTemplateBtn:Ke},`${t}_${xe}`)})),he===a.POD.CHATBOT&&Re&&e.jsx(v.DiscountCodeComponent,{discountCode:null===(ve=null==Ce?void 0:Ce.discountCodeExtra)||void 0===ve?void 0:ve[0],setDiscountCode:null===(me=null==Ce?void 0:Ce.discountCodeExtra)||void 0===me?void 0:me[1]}),null===(ge=null!=xe&&xe>-1?null===(be=je.cards[xe])||void 0===be?void 0:be.buttons:null==je?void 0:je.buttons)||void 0===ge?void 0:ge.map(((n,t)=>{var o,l,a,s,d;if("COPY_CODE"===n.type)return e.jsx(e.Fragment,{children:Te?e.jsx("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e.jsx(i.Input,{state:"disabled",labelText:null!==(o=n.text)&&void 0!==o?o:"Copy Code",value:null!==(l=n.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):e.jsx(j.default,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=n.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))};
@@ -1,2 +1 @@
1
1
  export declare const validateInputName: (name: string) => boolean;
2
- export declare const validateInputNameChatbot: (name: string) => boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.validateInputName=t=>!!/[^a-zA-Z0-9._ ]/.test(t),exports.validateInputNameChatbot=t=>{const e=/[^a-zA-Z0-9._ {}]/.test(t),a=t.match(/\{\{[a-zA-Z0-9._]+\}\}/g)||[],s=a.every((t=>t.startsWith("{{")&&t.endsWith("}}")));return!(!(e||t.includes("{{")&&0===a.length)&&s)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.validateInputName=e=>!!/[^a-zA-Z0-9._ ]/.test(e);
@@ -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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1,7 +1,7 @@
1
- import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import"../../curtain/CurtainHelper.js";import{PickerType as t}from"../../variable-picker-v3/model.js";import{cloneDeep as i}from"lodash";import{useRef as l,useState as a,useEffect as s}from"react";import d from"styled-components";import{Input as r}from"../../input/Input.js";import{InputWithVariables as p}from"../../input-with-vars/InputWithVariables.js";import{HEADER_TYPES as u}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import{STATIC_URL_VARIABLE_NAME as m}from"../utils/constants.js";import{getAllDataFromTemplateComponent as b}from"../utils/getDataFromTemplateComponent.js";import{isVariable as g}from"../utils/validateIsUrl.js";import{validateInputName as f,validateInputNameChatbot as h}from"../utils/validateName.js";import{BackTrackComponent as C}from"./BackTrackComponent.js";import{DiscountCodeComponent as O}from"./DiscountCodeComponent.js";import j from"./EditMediaModal.js";import T from"./EditMediaV2.js";import{EditTemplateMediaContainer as x}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as y}from"./useEditWhtasappTemplateMedia.js";import E from"./VariableConnector.js";import{Container as V}from"./VariableConnectorsPanel.js";import B from"./VariableConnectorWhatsApp.js";import M from"./VariableEditorHeader.js";import k from"./WhatsAppTemplateCardButtonV2.js";const I=d=>{let{template:I,onTemplateChange:R,whatsappSpecificPickerMeta:U,showVariableModal:w,variableListForImage:P,setDiscountCode:A,fileName:H,setFileName:N}=d;var D,_,F,S,q,Q,Y,K,W,$,G,X,z,J,Z,ee,oe,ne,te,ie,le,ae,se,de,re,pe,ue,ce,ve,me,be,ge,fe,he,Ce,Oe,je,Te,xe;const ye=I.isCarouselType,{originalVariableList:Ee,pod:Ve,extras:Be,selectedCarouselIndex:Me,isProductCarouselType:ke,disableCopyCode:Ie,isError:Le}=v(),{descriptionComponents:Re,urlBtns:Ue,qrbBtns:we,imageComponent:Pe,bodyVariables:Ae,headerVariables:He}=b(I),Ne=l(null),[De,_e]=a(!1),[Fe,Se]=a(-1===Me?{descriptionComponents:Re,urlBtns:Ue,qrbBtns:we,imageComponent:Pe,bodyVariables:Ae,headerVariables:He}:{}),{uploadMediaLink:qe,uploadMediaFiles:Qe,validateMimeType:Ye}=U,Ke=y({uploadMediaLink:qe,uploadMediaFiles:Qe,updateTemplateImageUrl:function(e,o){var n,t,l,a,s,d,r,p;let u;u=null!=Me&&Me>-1?{components:null===(t=null===(n=I.components[1])||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me].components,mapping:null===(a=null===(l=null==I?void 0:I.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Me]}:Object.assign({},I);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const n=Object.assign(Object.assign({},u.components[c]),{format:o,example:{header_handle:[e]}}),t=[...u.components];t[c]=n,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=u.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[Me]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==R||R(Object.assign({},e)),$e(!0)}else null==R||R(Object.assign({},u))},validateMimeType:Ye,mediaComponent:ye?Fe.imageComponent:Pe,fileRef:Ne}),[We,$e]=a(!1),[Ge,Xe]=a(H),[ze,Je]=a();function Ze(e,o,n){var t,l,a,s,d,r,p,u,c,v;const m=null!=Me&&Me>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[Me].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[Me]}:Object.assign({},I),b=i(m),g="custom"===o&&"string"==typeof e,f=g?e:"string"!=typeof e?e.defaultValue?e.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Me&&Me>-1&&ke){const o=Object.assign({},I).components.map((e=>{var o;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(o=e.cards)||void 0===o?void 0:o.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var o,t,i;if("BUTTONS"===e.type){const l=null===(o=e.buttons)||void 0===o?void 0:o.filter((e=>"URL"===e.type));let a=null!==(t=null==l?void 0:l[n])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},e),{buttons:s})}return e}))})))}):e})),t=null===(s=null===(a=Object.assign({},I).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((o=>{var n;return Object.assign(Object.assign({},o),{buttons:null===(n=null==o?void 0:o.buttons)||void 0===n?void 0:n.map((o=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=i(I);return l.components=o,l.mapping.cards=t,void(null==R||R(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==t?void 0:t.length)>0){const i="custom"===o&&"string"==typeof e,l=i?e:"string"!=typeof e&&e.defaultValue?e.defaultValue:"https://d.bik.ai/";let a=t[n];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),v=null===(c=b.mapping)||void 0===c?void 0:c.buttons;v&&v.length>0&&(v[n]=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[h]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?_e(!0):(_e(!1),null==A||A(""))}if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=b.components,e.mapping.cards[Me]=b.mapping,null==R||R(Object.assign({},e))}else null==R||R(b)}function eo(e,o,n){var t,l,a,s,d,r,p;const u=null!=Me&&Me>-1?{components:null===(t=Object.assign({},I).components[1].cards)||void 0===t?void 0:t[Me].components,mapping:null===(l=Object.assign({},I).mapping.cards)||void 0===l?void 0:l[Me]}:Object.assign({},I);if(null!=Me&&Me>-1&&ke){const o=Object.assign({},I).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 a=null===(t=null==o?void 0:o.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let s=null!==(i=null==a?void 0:a[n])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=null==o?void 0:o.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),t=i(I);return t.components=o,void(null==R||R(Object.assign({},t)))}const c=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const o=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(o){let t=o[n];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].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}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Me&&Me>-1){const e=i(I);e.components[1].cards[Me].components=u.components,null==R||R(Object.assign({},e))}else null==R||R(u)}s((()=>{var e,o;if(null===(e=I.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))_e(!0);else{_e(!1);const e=null===(o=null==Be?void 0:Be.discountCodeExtra)||void 0===o?void 0:o[1];null==e||e("")}}),[I]),s((()=>{var e,o,n,t;if(null!=Me&&Me>-1){const i={components:null===(o=null===(e=I.components[1])||void 0===e?void 0:e.cards)||void 0===o?void 0:o[Me].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);Se({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Me&&-1===Me){const{descriptionComponents:e,urlBtns:o,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l}=b(I);Se({descriptionComponents:e,urlBtns:o,qrbBtns:n,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Me]),s((()=>{var e,o,n,t;if(null!=Me&&Me>-1&&We){const i={components:null===(o=null===(e=I.components[1])||void 0===e?void 0:e.cards)||void 0===o?void 0:o[Me].components,mapping:null===(t=null===(n=null==I?void 0:I.mapping)||void 0===n?void 0:n.cards)||void 0===t?void 0:t[Me]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=b(i);Se({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),$e(!1)}}),[We]);const oo=()=>{if(!H)return void Je("PDF name is Required");const e=h(H);null==N||N(null!=H?H:""),Je(e?"Please enter a valid PDF name":void 0)};s((()=>{Le&&Ve===c.CHATBOT&&oo()}),[Le]);const no=ye?Fe.imageComponent:Pe;return Ke.openEditMedia?e(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:e(j,{mediaComponentFormat:null!==(D=no.format)&&void 0!==D?D:u.IMAGE,uploadMedia:Ke.uploadMedia,variableListForImage:P||[],useEditWhatsappTemplateMediaResponse:Ke,setOpenEditMedia:Ke.setOpenEditMedia,openEditMedia:Ke.openEditMedia,editIconRef:Ke.editIconRef,fileRef:Ne})})):o(V,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:ke?"420px":"auto"}},{children:[!!Fe.imageComponent&&!ke&&o(x,{children:[e(T,{imageName:null!==(F=null===(_=null==no?void 0:no.example)||void 0===_?void 0:_.header_handle)&&void 0!==F?F:[],handleImageChange:Ke.handleImageChange,mediaType:null==no?void 0:no.format,error:Ke.error,isLoading:Ke.loading,setOpenEditMedia:Ke.setOpenEditMedia,selectedVariable:g(null!==(Q=null===(q=null===(S=null==no?void 0:no.example)||void 0===S?void 0:S.header_handle)||void 0===q?void 0:q[0])&&void 0!==Q?Q:"")?null===(K=null===(Y=null==no?void 0:no.example)||void 0===Y?void 0:Y.header_handle)||void 0===K?void 0:K[0]:(null===($=null===(W=null==I?void 0:I.mapping)||void 0===W?void 0:W.header)||void 0===$?void 0:$[0])?null===(X=null===(G=null==I?void 0:I.mapping)||void 0===G?void 0:G.header)||void 0===X?void 0:X[0]:Ke.selectedVariable}),(null==Pe?void 0:Pe.format)==u.DOCUMENT?e(L,{children:Ve===c.CHATBOT?e(p,{labelText:"PDF Name",placeHolder:"Enter the name",errorMessage:ze||void 0,onBlur:Ve!==c.CHATBOT?oo:void 0,onChange:e=>{var o;Je(""),null==N||N(null!==(o=null==e?void 0:e.actualValue)&&void 0!==o?o:"")},pickerType:t.EMBEDDED,noMaxCharCheck:!0,allowMix:!0,showVarHeader:!0,varHeaderText:"Select variable",prevVariable:{actualValue:null!=H?H:"",variableType:"string"},variablesList:P,showAddButton:Ve===c.CHATBOT}):e(r,{labelText:"PDF Name",placeholder:"Enter the name",value:Ge,errorMessage:ze||void 0,onBlur:()=>{if(!Ge)return null==N||N(""),void Je("PDF name is Required");const e=f(Ge);null==N||N(Ge),Je(e?"Please enter a valid PDF name":void 0)},onChangeText:e=>{Je(""),Xe(e)}})}):e(n,{})]}),(null===(z=Fe.bodyVariables)||void 0===z?void 0:z.length)>0&&e(M,{containerStyle:{paddingTop:Fe.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===(J=Fe.descriptionComponents)||void 0===J?void 0:J.map(((o,n)=>e(B,{originalVariableList:null!=Me&&Me>-1?Ee.cards[Me]:Ee,type:o.type,descriptionComponent:o.component,showVariableModal:w},n))),(null===(oe=null===(ee=null!=Me&&Me>-1?null===(Z=Ee.cards[Me])||void 0===Z?void 0:Z.buttons:null==Ee?void 0:Ee.buttons)||void 0===ee?void 0:ee.filter((e=>"URL"===e.type)))||void 0===oe?void 0:oe.length)>0&&e(M,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(ie=null===(te=null!=Me&&Me>-1?null===(ne=Ee.cards[Me])||void 0===ne?void 0:ne.buttons:null==Ee?void 0:Ee.buttons)||void 0===te?void 0:te.filter((e=>Ve===c.CHATBOT||"URL"===e.type)))||void 0===ie?void 0:ie.map(((o,n)=>{const t=o.buttonVariable===m;if("URL"===o.type)return e(k,{variableListIndex:n,disableEdit:t,CTAoptions:null==U?void 0:U.CTAoptions,button:o,currentVariableList:null!=Me&&Me>-1?Object.assign({},Ee.cards[Me]):Object.assign({},Ee),updateSelectedURLTemplateBtn:Ze},`${n}_${Me}`)})),Ve===c.CHATBOT&&(null===(ae=null===(le=we[0])||void 0===le?void 0:le.component)||void 0===ae?void 0:ae.buttons)&&(null===(re=null===(de=null===(se=we[0])||void 0===se?void 0:se.component)||void 0===de?void 0:de.buttons)||void 0===re?void 0:re.length)>0&&e(C,{backTrackMessage:null===(pe=null==Be?void 0:Be.backTrackExtra)||void 0===pe?void 0:pe[0],setBackTrackMessage:null===(ue=null==Be?void 0:Be.backTrackExtra)||void 0===ue?void 0:ue[1]}),(null===(me=null===(ve=null!=Me&&Me>-1?null===(ce=Ee.cards[Me])||void 0===ce?void 0:ce.buttons:null==Ee?void 0:Ee.buttons)||void 0===ve?void 0:ve.filter((e=>"QUICK_REPLY"===e.type)))||void 0===me?void 0:me.length)>0&&(Ve!==c.CHATBOT?e(M,{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(C,{backTrackMessage:null===(be=null==Be?void 0:Be.backTrackExtra)||void 0===be?void 0:be[0],setBackTrackMessage:null===(ge=null==Be?void 0:Be.backTrackExtra)||void 0===ge?void 0:ge[1]})),null===(Ce=null===(he=null!=Me&&Me>-1?null===(fe=Ee.cards[Me])||void 0===fe?void 0:fe.buttons:null==Ee?void 0:Ee.buttons)||void 0===he?void 0:he.filter((e=>"QUICK_REPLY"===e.type)))||void 0===Ce?void 0:Ce.map(((o,n)=>{if("QUICK_REPLY"===o.type&&Ve!==c.CHATBOT)return e(k,{variableListIndex:n,QRBoptions:null==U?void 0:U.QRBoptions,button:o,currentVariableList:null!=Me&&Me>-1?Object.assign({},Ee.cards[Me]):Object.assign({},Ee),updateSelectedQRBTemplateBtn:eo},`${n}_${Me}`)})),Ve===c.CHATBOT&&De&&e(O,{discountCode:null===(Oe=null==Be?void 0:Be.discountCodeExtra)||void 0===Oe?void 0:Oe[0],setDiscountCode:null===(je=null==Be?void 0:Be.discountCodeExtra)||void 0===je?void 0:je[1]}),null===(xe=null!=Me&&Me>-1?null===(Te=Ee.cards[Me])||void 0===Te?void 0:Te.buttons:null==Ee?void 0:Ee.buttons)||void 0===xe?void 0:xe.map(((o,t)=>{var i,l,a,s,d;if("COPY_CODE"===o.type)return e(n,{children:Ie?e("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:e(r,{state:"disabled",labelText:null!==(i=o.text)&&void 0!==i?i:"Copy Code",value:null!==(l=o.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):e(E,{index:t,variable:{variableName:null!==(a=o.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=o.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(d=o.index)&&void 0!==d?d:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:o.type},t)})}))]}))},L=d.div`
1
+ import{jsx as o,jsxs as n,Fragment as e}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useRef as i,useState as l,useEffect as a}from"react";import s from"styled-components";import{Input as d}from"../../input/Input.js";import{HEADER_TYPES as r}from"../../template-preview/models/TemplateMeta.js";import{POD as p}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import{STATIC_URL_VARIABLE_NAME as c}from"../utils/constants.js";import{getAllDataFromTemplateComponent as m}from"../utils/getDataFromTemplateComponent.js";import{isVariable as v}from"../utils/validateIsUrl.js";import{validateInputName as b}from"../utils/validateName.js";import{BackTrackComponent as g}from"./BackTrackComponent.js";import{DiscountCodeComponent as f}from"./DiscountCodeComponent.js";import h from"./EditMediaModal.js";import j from"./EditMediaV2.js";import{EditTemplateMediaContainer as O}from"./EditMediaV2.style.js";import{useEditWhatsappTemplateMedia as C}from"./useEditWhtasappTemplateMedia.js";import T from"./VariableConnector.js";import{Container as x}from"./VariableConnectorsPanel.js";import y from"./VariableConnectorWhatsApp.js";import E from"./VariableEditorHeader.js";import V from"./WhatsAppTemplateCardButtonV2.js";const B=s=>{let{template:B,onTemplateChange:k,whatsappSpecificPickerMeta:I,showVariableModal:L,variableListForImage:R,setDiscountCode:U,fileName:w,setFileName:N}=s;var P,A,_,D,H,S,F,Q,q,Y,K,W,$,G,X,z,J,Z,oo,no,eo,to,io,lo,ao,so,ro,po,uo,co,mo,vo,bo,go,fo,ho,jo,Oo,Co;const To=B.isCarouselType,{originalVariableList:xo,pod:yo,extras:Eo,selectedCarouselIndex:Vo,isProductCarouselType:Bo,disableCopyCode:Mo}=u(),{descriptionComponents:ko,urlBtns:Io,qrbBtns:Lo,imageComponent:Ro,bodyVariables:Uo,headerVariables:wo}=m(B),No=i(null),[Po,Ao]=l(!1),[_o,Do]=l(-1===Vo?{descriptionComponents:ko,urlBtns:Io,qrbBtns:Lo,imageComponent:Ro,bodyVariables:Uo,headerVariables:wo}:{}),{uploadMediaLink:Ho,uploadMediaFiles:So,validateMimeType:Fo}=I,Qo=C({uploadMediaLink:Ho,uploadMediaFiles:So,updateTemplateImageUrl:function(o,n){var e,i,l,a,s,d,r,p;let u;u=null!=Vo&&Vo>-1?{components:null===(i=null===(e=B.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[Vo].components,mapping:null===(a=null===(l=null==B?void 0:B.mapping)||void 0===l?void 0:l.cards)||void 0===a?void 0:a[Vo]}:Object.assign({},B);const c=null===(s=null==u?void 0:u.components)||void 0===s?void 0:s.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==c&&c>-1&&(null==u?void 0:u.components[c])){const e=Object.assign(Object.assign({},u.components[c]),{format:n,example:{header_handle:[o]}}),t=[...u.components];t[c]=e,u=Object.assign(Object.assign({},u),{components:t})}u.mapping&&(u.mapping=Object.assign(Object.assign({},u.mapping),{header:void 0}));if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=u.components,(null===(d=null==o?void 0:o.mapping)||void 0===d?void 0:d.cards)&&(null===(r=null==o?void 0:o.mapping)||void 0===r?void 0:r.cards.length)>0&&(o.mapping.cards[Vo]=null!==(p=u.mapping)&&void 0!==p?p:{}),null==k||k(Object.assign({},o)),Yo(!0)}else null==k||k(Object.assign({},u))},validateMimeType:Fo,mediaComponent:To?_o.imageComponent:Ro,fileRef:No}),[qo,Yo]=l(!1),[Ko,Wo]=l(w),[$o,Go]=l();function Xo(o,n,e){var i,l,a,s,d,r,p,u,c,m;const v=null!=Vo&&Vo>-1?{components:null===(i=Object.assign({},B).components[1].cards)||void 0===i?void 0:i[Vo].components,mapping:null===(l=Object.assign({},B).mapping.cards)||void 0===l?void 0:l[Vo]}:Object.assign({},B),b=t(v),g="custom"===n&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue?o.defaultValue:"https://d.bik.ai/":"https://d.bik.ai";if(null!=Vo&&Vo>-1&&Bo){const n=Object.assign({},B).components.map((o=>{var n;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(n=o.cards)||void 0===n?void 0:n.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var n,t,i;if("BUTTONS"===o.type){const l=null===(n=o.buttons)||void 0===n?void 0:n.filter((o=>"URL"===o.type));let a=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[f]});const s=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},o),{buttons:s})}return o}))})))}):o})),i=null===(s=null===(a=Object.assign({},B).mapping)||void 0===a?void 0:a.cards)||void 0===s?void 0:s.map((n=>{var e;return Object.assign(Object.assign({},n),{buttons:null===(e=null==n?void 0:n.buttons)||void 0===e?void 0:e.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(B);return l.components=n,l.mapping.cards=i,void(null==k||k(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==h&&h>-1){const t=null===(d=null==b?void 0:b.components[h].buttons)||void 0===d?void 0:d.filter((o=>"URL"===o.type));if((null==t?void 0:t.length)>0){const i="custom"===n&&"string"==typeof o,l=i?o:"string"!=typeof o&&o.defaultValue?o.defaultValue:"https://d.bik.ai/";let a=t[e];a=Object.assign(Object.assign({},a),{url:"https://d.bik.ai/{{1}}",example:[l]});const s=[...null!==(u=null===(p=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===p?void 0:p.buttons)&&void 0!==u?u:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:s}),m=null===(c=b.mapping)||void 0===c?void 0:c.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof o?o.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 o){"checkout.checkoutUrl"===(null===(m=o.placeHolder)||void 0===m?void 0:m.slice(2,-2))?Ao(!0):(Ao(!1),null==U||U(""))}if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=b.components,o.mapping.cards[Vo]=b.mapping,null==k||k(Object.assign({},o))}else null==k||k(b)}function zo(o,n,e){var i,l,a,s,d,r,p;const u=null!=Vo&&Vo>-1?{components:null===(i=Object.assign({},B).components[1].cards)||void 0===i?void 0:i[Vo].components,mapping:null===(l=Object.assign({},B).mapping.cards)||void 0===l?void 0:l[Vo]}:Object.assign({},B);if(null!=Vo&&Vo>-1&&Bo){const n=Object.assign({},B).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 a=null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.filter((o=>"QUICK_REPLY"===o.type));let s=null!==(i=null==a?void 0:a[e])&&void 0!==i?i:{};s=Object.assign(Object.assign({},s),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=null==n?void 0:n.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t(B);return i.components=n,void(null==k||k(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==c&&c>-1){const n=null===(s=null===(a=null==u?void 0:u.components[c])||void 0===a?void 0:a.buttons)||void 0===s?void 0:s.filter((o=>"QUICK_REPLY"===o.type));if(n){let t=n[e];t=Object.assign(Object.assign({},t),{flowId:o.flowId,flowName:o.flowName});const i=[...null!==(p=null===(r=null===(d=u.components)||void 0===d?void 0:d[c])||void 0===r?void 0:r.buttons)&&void 0!==p?p:[]].map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==t?void 0:t.text)?t:o)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),a=[...u.components];a[c]=l,u.components=a}}if(null!=Vo&&Vo>-1){const o=t(B);o.components[1].cards[Vo].components=u.components,null==k||k(Object.assign({},o))}else null==k||k(u)}a((()=>{var o,n;if(null===(o=B.mapping.buttons)||void 0===o?void 0:o.find((o=>"checkout.checkoutUrl"===o.slice(2,-2))))Ao(!0);else{Ao(!1);const o=null===(n=null==Eo?void 0:Eo.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[B]),a((()=>{var o,n,e,t;if(null!=Vo&&Vo>-1){const i={components:null===(n=null===(o=B.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Vo].components,mapping:null===(t=null===(e=null==B?void 0:B.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Vo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=m(i);Do({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p})}else if(null!=Vo&&-1===Vo){const{descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l}=m(B);Do({descriptionComponents:o,urlBtns:n,qrbBtns:e,imageComponent:t,bodyVariables:i,headerVariables:l})}}),[Vo]),a((()=>{var o,n,e,t;if(null!=Vo&&Vo>-1&&qo){const i={components:null===(n=null===(o=B.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[Vo].components,mapping:null===(t=null===(e=null==B?void 0:B.mapping)||void 0===e?void 0:e.cards)||void 0===t?void 0:t[Vo]},{descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}=m(i);Do({descriptionComponents:l,urlBtns:a,qrbBtns:s,imageComponent:d,bodyVariables:r,headerVariables:p}),Yo(!1)}}),[qo]);const Jo=To?_o.imageComponent:Ro;return Qo.openEditMedia?o(x,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:o(h,{mediaComponentFormat:null!==(P=Jo.format)&&void 0!==P?P:r.IMAGE,uploadMedia:Qo.uploadMedia,variableListForImage:R||[],useEditWhatsappTemplateMediaResponse:Qo,setOpenEditMedia:Qo.setOpenEditMedia,openEditMedia:Qo.openEditMedia,editIconRef:Qo.editIconRef,fileRef:No})})):n(x,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460,minWidth:Bo?"420px":"auto"}},{children:[!!_o.imageComponent&&!Bo&&n(O,{children:[o(j,{imageName:null!==(_=null===(A=null==Jo?void 0:Jo.example)||void 0===A?void 0:A.header_handle)&&void 0!==_?_:[],handleImageChange:Qo.handleImageChange,mediaType:null==Jo?void 0:Jo.format,error:Qo.error,isLoading:Qo.loading,setOpenEditMedia:Qo.setOpenEditMedia,selectedVariable:v(null!==(S=null===(H=null===(D=null==Jo?void 0:Jo.example)||void 0===D?void 0:D.header_handle)||void 0===H?void 0:H[0])&&void 0!==S?S:"")?null===(Q=null===(F=null==Jo?void 0:Jo.example)||void 0===F?void 0:F.header_handle)||void 0===Q?void 0:Q[0]:(null===(Y=null===(q=null==B?void 0:B.mapping)||void 0===q?void 0:q.header)||void 0===Y?void 0:Y[0])?null===(W=null===(K=null==B?void 0:B.mapping)||void 0===K?void 0:K.header)||void 0===W?void 0:W[0]:Qo.selectedVariable}),(null==Ro?void 0:Ro.format)==r.DOCUMENT?o(M,{children:o(d,{labelText:"PDF Name",placeholder:"Enter the name",value:Ko,errorMessage:$o||void 0,onBlur:()=>{if(!Ko)return null==N||N(""),void Go("PDF name is Required");const o=b(Ko);null==N||N(Ko),Go(o?"Please enter a valid PDF name":void 0)},onChangeText:o=>{Go(""),Wo(o)}})}):o(e,{})]}),(null===($=_o.bodyVariables)||void 0===$?void 0:$.length)>0&&o(E,{containerStyle:{paddingTop:_o.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===(G=_o.descriptionComponents)||void 0===G?void 0:G.map(((n,e)=>o(y,{originalVariableList:null!=Vo&&Vo>-1?xo.cards[Vo]:xo,type:n.type,descriptionComponent:n.component,showVariableModal:L},e))),(null===(J=null===(z=null!=Vo&&Vo>-1?null===(X=xo.cards[Vo])||void 0===X?void 0:X.buttons:null==xo?void 0:xo.buttons)||void 0===z?void 0:z.filter((o=>"URL"===o.type)))||void 0===J?void 0:J.length)>0&&o(E,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(no=null===(oo=null!=Vo&&Vo>-1?null===(Z=xo.cards[Vo])||void 0===Z?void 0:Z.buttons:null==xo?void 0:xo.buttons)||void 0===oo?void 0:oo.filter((o=>yo===p.CHATBOT||"URL"===o.type)))||void 0===no?void 0:no.map(((n,e)=>{const t=n.buttonVariable===c;if("URL"===n.type)return o(V,{variableListIndex:e,disableEdit:t,CTAoptions:null==I?void 0:I.CTAoptions,button:n,currentVariableList:null!=Vo&&Vo>-1?Object.assign({},xo.cards[Vo]):Object.assign({},xo),updateSelectedURLTemplateBtn:Xo},`${e}_${Vo}`)})),yo===p.CHATBOT&&(null===(to=null===(eo=Lo[0])||void 0===eo?void 0:eo.component)||void 0===to?void 0:to.buttons)&&(null===(ao=null===(lo=null===(io=Lo[0])||void 0===io?void 0:io.component)||void 0===lo?void 0:lo.buttons)||void 0===ao?void 0:ao.length)>0&&o(g,{backTrackMessage:null===(so=null==Eo?void 0:Eo.backTrackExtra)||void 0===so?void 0:so[0],setBackTrackMessage:null===(ro=null==Eo?void 0:Eo.backTrackExtra)||void 0===ro?void 0:ro[1]}),(null===(co=null===(uo=null!=Vo&&Vo>-1?null===(po=xo.cards[Vo])||void 0===po?void 0:po.buttons:null==xo?void 0:xo.buttons)||void 0===uo?void 0:uo.filter((o=>"QUICK_REPLY"===o.type)))||void 0===co?void 0:co.length)>0&&(yo!==p.CHATBOT?o(E,{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(g,{backTrackMessage:null===(mo=null==Eo?void 0:Eo.backTrackExtra)||void 0===mo?void 0:mo[0],setBackTrackMessage:null===(vo=null==Eo?void 0:Eo.backTrackExtra)||void 0===vo?void 0:vo[1]})),null===(fo=null===(go=null!=Vo&&Vo>-1?null===(bo=xo.cards[Vo])||void 0===bo?void 0:bo.buttons:null==xo?void 0:xo.buttons)||void 0===go?void 0:go.filter((o=>"QUICK_REPLY"===o.type)))||void 0===fo?void 0:fo.map(((n,e)=>{if("QUICK_REPLY"===n.type&&yo!==p.CHATBOT)return o(V,{variableListIndex:e,QRBoptions:null==I?void 0:I.QRBoptions,button:n,currentVariableList:null!=Vo&&Vo>-1?Object.assign({},xo.cards[Vo]):Object.assign({},xo),updateSelectedQRBTemplateBtn:zo},`${e}_${Vo}`)})),yo===p.CHATBOT&&Po&&o(f,{discountCode:null===(ho=null==Eo?void 0:Eo.discountCodeExtra)||void 0===ho?void 0:ho[0],setDiscountCode:null===(jo=null==Eo?void 0:Eo.discountCodeExtra)||void 0===jo?void 0:jo[1]}),null===(Co=null!=Vo&&Vo>-1?null===(Oo=xo.cards[Vo])||void 0===Oo?void 0:Oo.buttons:null==xo?void 0:xo.buttons)||void 0===Co?void 0:Co.map(((n,t)=>{var i,l,a,s,r;if("COPY_CODE"===n.type)return o(e,{children:Mo?o("div",Object.assign({style:{marginBottom:20,borderRadius:4,padding:"8px 10px"}},{children:o(d,{state:"disabled",labelText:null!==(i=n.text)&&void 0!==i?i:"Copy Code",value:null!==(l=n.buttonVariable)&&void 0!==l?l:"",onChangeText:()=>{}})})):o(T,{index:t,variable:{variableName:null!==(a=n.text)&&void 0!==a?a:"Copy Code",updatedValue:null!==(s=n.buttonVariable)&&void 0!==s?s:"",type:"string",isEditableVariable:!0,index:null!==(r=n.index)&&void 0!==r?r:0},showVariableModal:!0,componentType:"BUTTONS",buttonType:n.type},t)})}))]}))},M=s.div`
2
2
  padding-top: 24px;
3
3
  padding-left: 10px;
4
4
  padding-right: 10px;
5
5
  margin-bottom: 8px;
6
6
  line-height: normal;
7
- `;export{I as default};
7
+ `;export{B as default};
@@ -1,2 +1 @@
1
1
  export declare const validateInputName: (name: string) => boolean;
2
- export declare const validateInputNameChatbot: (name: string) => boolean;
@@ -1 +1 @@
1
- const t=t=>!!/[^a-zA-Z0-9._ ]/.test(t),e=t=>{const e=/[^a-zA-Z0-9._ {}]/.test(t),s=t.match(/\{\{[a-zA-Z0-9._]+\}\}/g)||[],n=s.every((t=>t.startsWith("{{")&&t.endsWith("}}")));return!(!(e||t.includes("{{")&&0===s.length)&&n)};export{t as validateInputName,e as validateInputNameChatbot};
1
+ const t=t=>!!/[^a-zA-Z0-9._ ]/.test(t);export{t as validateInputName};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.612-beta-vsp.16",
3
+ "version": "0.0.613",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",