@bikdotai/bik-component-library 0.0.559-beta.tp-1 → 0.0.559

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.
@@ -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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateSelectModalContent.js"),c=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=p=>{let{selectedTemplate:v,closeDialog:m,showVariableMapping:h,channel:C,htmlContent:S,templateVariables:b,onTemplateSelect:E,globalPlaceholders:x,showOnlyContent:P,whatsappSpecificPickerMeta:g,zIndex:f,showVariableModal:T,variableList:L,discountCode:I,setDiscountCode:j,onBackPress:y,enabledCustomText:w,variableListForImage:M,showSampleValues:A,disableEditVariable:k,pod:H,extras:N,pickerConf:V,selectedCarouselProducts:D,disableEditExpiry:O,cardWidth:q,onDeleteSelectedProducts:B,fileName:F,setFileName:_,hideDeviceContainerInPreview:W,maxCharLimit:R}=p;var Y,z,$,U,G,J,K,Q;l.useEffect((()=>{re(S)}),[S]);const X=C===s.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(z=null===(Y=null==v?void 0:v.components)||void 0===Y?void 0:Y[1])||void 0===z?void 0:z.type),Z=null==v?void 0:v.isProductCarouselType,[ee,te]=l.useState(C===s.CHANNEL_TYPE.EMAIL||X?"desktop":"mobile"),[le,oe]=l.useState(!1),[ae,re]=l.useState(S),[se,ie]=l.useState(!1),[ne,de]=l.useState([]),[ue,ce]=l.useState({}),[pe,ve]=l.useState(v),[me,he]=l.useState([]),[Ce,Se]=l.useState(null),[be,Ee]=l.useState(!1),[xe,Pe]=l.useState(null!=b?b:[]),[ge,fe]=l.useState(!1),[Te,Le]=l.useState(X?(null===(U=null===($=null==pe?void 0:pe.mapping)||void 0===$?void 0:$.body)||void 0===U?void 0:U.length)?-1:0:-1),[Ie,je]=l.useState([]),[ye,we]=l.useState(void 0),Me=l.useRef(null),[Ae,ke]=l.useState(!1),[He,Ne]=l.useState(!1),[Ve,De]=l.useState(!1),[Oe,qe]=l.useState({});l.useEffect((()=>{D?je(D):Z&&je([])}),[D]),l.useEffect((()=>{var e;if(!be&&Z&&(!D||0===je.length)){const t=null===(e=null==pe?void 0:pe.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),he(l),Ee(!0)}}),[be]);const Be=l.useMemo((()=>c.convertPlaceholdersToBikDropdown(x)),[x]);return l.useEffect((()=>{we(t.cloneDeep(L))}),[L]),e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Ve,setHideFooterButton:De,hideCrossButton:He,setHideCrossButton:Ne,variableList:ye,setVariableList:we,variableCallback:Ce,setVariableCallback:Se,showVariablePicker:le,setShowVariablePicker:oe,template:pe,setTemplate:ve,device:ee,setDevice:te,display_content:ae,setDisplayContent:re,originalVariableList:xe,setOriginalVariableList:Pe,isError:se,setIsError:ie,channel:C,globalNormalizedPlaceholders:Be,templateSelectionTriggered:ge,setTemplateSelectionTriggered:fe,enabledCustomText:w,disableEditVariable:k,pod:H,extras:N,isWhatsappCarousel:X,selectedCarouselIndex:Te,setSelectedCarouselIndex:Le,isProductCarouselType:Z,templateErrorIndexes:ue,cardCount:X?null===(J=null===(G=v.components)||void 0===G?void 0:G[1].cards)||void 0===J?void 0:J.length:void 0,errorIndexes:ne,setErrorIndexes:de,pickerConf:V,carouselProducts:Ie,setCarouselProducts:je,disableEditExpiry:O,cardWidth:q,cardImages:me,onDeleteSelectedProducts:B,hideDeviceContainerInPreview:W,sliderRef:Me,isCarouselHovered:Ae,setIsCarouselHovered:ke,maxCharLimit:R,ctaOptionsErrors:Oe,setCtaOptionsErrors:qe}},{children:P?e.jsx(u.default,{variableListFromProps:L,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(r.StyledModal,Object.assign({hideCrossButton:He,zIndex:f,centralContainerStyles:{width:X?900:C===s.CHANNEL_TYPE.EMAIL&&h?1e3:800},open:!0,onClose:()=>{null==m||m()},headingTitle:null==pe?void 0:pe.label,headingSubtitle:C===s.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(K=null==pe?void 0:pe.category)&&void 0!==K?K:"")} • ${null!==(Q=null==pe?void 0:pe.templateCategory)&&void 0!==Q?Q:""}`:"",onBackPress:()=>{null==y||y()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(u.default,{variableListFromProps:L,showSampleValues:A,showVariableMapping:h,channel:C,whatsappSpecificPickerMeta:g,showVariableModal:T,discountCode:I,setDiscountCode:j,variableListForImage:M&&(null==M?void 0:M.length)>0?M:ye,fileName:F,setFileName:e=>{null==_||_(e)}}),E?e.jsx(d.default,{isWhatsappCarousel:null!=X&&X,onSelect:function(){var e;if((null==Ie?void 0:Ie.length)<1&&Z)return void ie(!0);if(Object.keys(Oe).length>0&&H!==i.POD.CHATBOT)return void ie(!0);const t=null==E?void 0:E(pe,xe,null!=ae?ae:"",Ie);ce(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&de(t.errorIndexes),(null==t?void 0:t.error)&&ie(!!(null==t?void 0:t.error))):fe(!0)}}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),r=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),n=require("./modalElements/Footer.js"),d=require("./modalElements/TemplateSelectModalContent.js"),u=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=c=>{let{selectedTemplate:v,closeDialog:p,showVariableMapping:m,channel:h,htmlContent:C,templateVariables:S,onTemplateSelect:b,globalPlaceholders:E,showOnlyContent:x,whatsappSpecificPickerMeta:P,zIndex:g,showVariableModal:f,variableList:T,discountCode:L,setDiscountCode:I,onBackPress:y,enabledCustomText:j,variableListForImage:w,showSampleValues:M,disableEditVariable:k,pod:N,extras:V,pickerConf:A,selectedCarouselProducts:H,disableEditExpiry:D,cardWidth:O,onDeleteSelectedProducts:q,fileName:F,setFileName:B,hideDeviceContainerInPreview:_,maxCharLimit:W}=c;var R,Y,z,$,U,G,J,K;l.useEffect((()=>{ae(C)}),[C]);const Q=h===s.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(Y=null===(R=null==v?void 0:v.components)||void 0===R?void 0:R[1])||void 0===Y?void 0:Y.type),X=null==v?void 0:v.isProductCarouselType,[Z,ee]=l.useState(h===s.CHANNEL_TYPE.EMAIL||Q?"desktop":"mobile"),[te,le]=l.useState(!1),[oe,ae]=l.useState(C),[re,se]=l.useState(!1),[ie,ne]=l.useState([]),[de,ue]=l.useState({}),[ce,ve]=l.useState(v),[pe,me]=l.useState([]),[he,Ce]=l.useState(null),[Se,be]=l.useState(!1),[Ee,xe]=l.useState(null!=S?S:[]),[Pe,ge]=l.useState(!1),[fe,Te]=l.useState(Q?(null===($=null===(z=null==ce?void 0:ce.mapping)||void 0===z?void 0:z.body)||void 0===$?void 0:$.length)?-1:0:-1),[Le,Ie]=l.useState([]),[ye,je]=l.useState(void 0),we=l.useRef(null),[Me,ke]=l.useState(!1),[Ne,Ve]=l.useState(!1),[Ae,He]=l.useState(!1),[De,Oe]=l.useState({});l.useEffect((()=>{H?Ie(H):X&&Ie([])}),[H]),l.useEffect((()=>{var e;if(!Se&&X&&(!H||0===Ie.length)){const t=null===(e=null==ce?void 0:ce.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),me(l),be(!0)}}),[Se]);const qe=l.useMemo((()=>u.convertPlaceholdersToBikDropdown(E)),[E]);return l.useEffect((()=>{je(t.cloneDeep(T))}),[T]),e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Ae,setHideFooterButton:He,hideCrossButton:Ne,setHideCrossButton:Ve,variableList:ye,setVariableList:je,variableCallback:he,setVariableCallback:Ce,showVariablePicker:te,setShowVariablePicker:le,template:ce,setTemplate:ve,device:Z,setDevice:ee,display_content:oe,setDisplayContent:ae,originalVariableList:Ee,setOriginalVariableList:xe,isError:re,setIsError:se,channel:h,globalNormalizedPlaceholders:qe,templateSelectionTriggered:Pe,setTemplateSelectionTriggered:ge,enabledCustomText:j,disableEditVariable:k,pod:N,extras:V,isWhatsappCarousel:Q,selectedCarouselIndex:fe,setSelectedCarouselIndex:Te,isProductCarouselType:X,templateErrorIndexes:de,cardCount:Q?null===(G=null===(U=v.components)||void 0===U?void 0:U[1].cards)||void 0===G?void 0:G.length:void 0,errorIndexes:ie,setErrorIndexes:ne,pickerConf:A,carouselProducts:Le,setCarouselProducts:Ie,disableEditExpiry:D,cardWidth:O,cardImages:pe,onDeleteSelectedProducts:q,hideDeviceContainerInPreview:_,sliderRef:we,isCarouselHovered:Me,setIsCarouselHovered:ke,maxCharLimit:W,ctaOptionsErrors:De,setCtaOptionsErrors:Oe}},{children:x?e.jsx(d.default,{variableListFromProps:T,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(r.StyledModal,Object.assign({hideCrossButton:Ne,zIndex:g,centralContainerStyles:{width:Q?900:h===s.CHANNEL_TYPE.EMAIL&&m?1e3:800},open:!0,onClose:()=>{null==p||p()},headingTitle:null==ce?void 0:ce.label,headingSubtitle:h===s.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(J=null==ce?void 0:ce.category)&&void 0!==J?J:"")} • ${null!==(K=null==ce?void 0:ce.templateCategory)&&void 0!==K?K:""}`:"",onBackPress:()=>{null==y||y()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(d.default,{variableListFromProps:T,showSampleValues:M,showVariableMapping:m,channel:h,whatsappSpecificPickerMeta:P,showVariableModal:f,discountCode:L,setDiscountCode:I,variableListForImage:w&&(null==w?void 0:w.length)>0?w:ye,fileName:F,setFileName:e=>{null==B||B(e)}}),b?e.jsx(n.default,{isWhatsappCarousel:null!=Q&&Q,onSelect:function(){var e;if((null==Le?void 0:Le.length)<1&&X)return void se(!0);if(Object.keys(De).length>0)return void se(!0);const t=null==b?void 0:b(ce,Ee,null!=oe?oe:"",Le);ue(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&ne(t.errorIndexes),(null==t?void 0:t.error)&&se(!!(null==t?void 0:t.error))):ge(!0)}}):e.jsx(e.Fragment,{})]}))}))};
@@ -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 +1 @@
1
- import{jsx as e,jsxs as o,Fragment as l}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as r,useState as i,useRef as a,useMemo as s}from"react";import n from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{CHANNEL_TYPE as c}from"../template-preview/models/Channels.js";import{POD as p}from"../template-preview/models/WhatsAppTemplate.js";import{TemplateModalContext as m}from"./context/templateModalContext.js";import v from"./modalElements/Footer.js";import h from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as b}from"./utils/convertPlaceholdersToBikDropdown.js";const C=C=>{let{selectedTemplate:g,closeDialog:f,showVariableMapping:x,channel:P,htmlContent:E,templateVariables:I,onTemplateSelect:S,globalPlaceholders:T,showOnlyContent:y,whatsappSpecificPickerMeta:w,zIndex:L,showVariableModal:V,variableList:k,discountCode:j,setDiscountCode:M,onBackPress:A,enabledCustomText:D,variableListForImage:B,showSampleValues:F,disableEditVariable:H,pod:O,extras:W,pickerConf:N,selectedCarouselProducts:z,disableEditExpiry:R,cardWidth:$,onDeleteSelectedProducts:U,fileName:_,setFileName:q,hideDeviceContainerInPreview:G,maxCharLimit:J}=C;var K,Q,X,Y,Z,ee,oe,le;r((()=>{ue(E)}),[E]);const te=P===c.WHATSAPP&&"CAROUSEL"===(null===(Q=null===(K=null==g?void 0:g.components)||void 0===K?void 0:K[1])||void 0===Q?void 0:Q.type),re=null==g?void 0:g.isProductCarouselType,[ie,ae]=i(P===c.EMAIL||te?"desktop":"mobile"),[se,ne]=i(!1),[de,ue]=i(E),[ce,pe]=i(!1),[me,ve]=i([]),[he,be]=i({}),[Ce,ge]=i(g),[fe,xe]=i([]),[Pe,Ee]=i(null),[Ie,Se]=i(!1),[Te,ye]=i(null!=I?I:[]),[we,Le]=i(!1),[Ve,ke]=i(te?(null===(Y=null===(X=null==Ce?void 0:Ce.mapping)||void 0===X?void 0:X.body)||void 0===Y?void 0:Y.length)?-1:0:-1),[je,Me]=i([]),[Ae,De]=i(void 0),Be=a(null),[Fe,He]=i(!1),[Oe,We]=i(!1),[Ne,ze]=i(!1),[Re,$e]=i({});r((()=>{z?Me(z):re&&Me([])}),[z]),r((()=>{var e;if(!Ie&&re&&(!z||0===Me.length)){const o=null===(e=null==Ce?void 0:Ce.components)||void 0===e?void 0:e[1].cards,l=[];null==o||o.forEach((e=>{var o;null===(o=null==e?void 0:e.components)||void 0===o||o.forEach((e=>{var o,t,r;"HEADER"===e.type&&l.push(null!==(r=null===(t=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),xe(l),Se(!0)}}),[Ie]);const Ue=s((()=>b(T)),[T]);return r((()=>{De(t(k))}),[k]),e(m.Provider,Object.assign({value:{hideFooterButton:Ne,setHideFooterButton:ze,hideCrossButton:Oe,setHideCrossButton:We,variableList:Ae,setVariableList:De,variableCallback:Pe,setVariableCallback:Ee,showVariablePicker:se,setShowVariablePicker:ne,template:Ce,setTemplate:ge,device:ie,setDevice:ae,display_content:de,setDisplayContent:ue,originalVariableList:Te,setOriginalVariableList:ye,isError:ce,setIsError:pe,channel:P,globalNormalizedPlaceholders:Ue,templateSelectionTriggered:we,setTemplateSelectionTriggered:Le,enabledCustomText:D,disableEditVariable:H,pod:O,extras:W,isWhatsappCarousel:te,selectedCarouselIndex:Ve,setSelectedCarouselIndex:ke,isProductCarouselType:re,templateErrorIndexes:he,cardCount:te?null===(ee=null===(Z=g.components)||void 0===Z?void 0:Z[1].cards)||void 0===ee?void 0:ee.length:void 0,errorIndexes:me,setErrorIndexes:ve,pickerConf:N,carouselProducts:je,setCarouselProducts:Me,disableEditExpiry:R,cardWidth:$,cardImages:fe,onDeleteSelectedProducts:U,hideDeviceContainerInPreview:G,sliderRef:Be,isCarouselHovered:Fe,setIsCarouselHovered:He,maxCharLimit:J,ctaOptionsErrors:Re,setCtaOptionsErrors:$e}},{children:y?e(h,{variableListFromProps:k,channel:c.EMAIL,hideHeader:!0}):o(u,Object.assign({hideCrossButton:Oe,zIndex:L,centralContainerStyles:{width:te?900:P===c.EMAIL&&x?1e3:800},open:!0,onClose:()=>{null==f||f()},headingTitle:null==Ce?void 0:Ce.label,headingSubtitle:P===c.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(oe=null==Ce?void 0:Ce.category)&&void 0!==oe?oe:"")} • ${null!==(le=null==Ce?void 0:Ce.templateCategory)&&void 0!==le?le:""}`:"",onBackPress:()=>{null==A||A()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(h,{variableListFromProps:k,showSampleValues:F,showVariableMapping:x,channel:P,whatsappSpecificPickerMeta:w,showVariableModal:V,discountCode:j,setDiscountCode:M,variableListForImage:B&&(null==B?void 0:B.length)>0?B:Ae,fileName:_,setFileName:e=>{null==q||q(e)}}),S?e(v,{isWhatsappCarousel:null!=te&&te,onSelect:function(){var e;if((null==je?void 0:je.length)<1&&re)return void pe(!0);if(Object.keys(Re).length>0&&O!==p.CHATBOT)return void pe(!0);const o=null==S?void 0:S(Ce,Te,null!=de?de:"",je);be(null!==(e=null==o?void 0:o.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==o?void 0:o.errorIndexes)||(null==o?void 0:o.error)?((null==o?void 0:o.errorIndexes)&&ve(o.errorIndexes),(null==o?void 0:o.error)&&pe(!!(null==o?void 0:o.error))):Le(!0)}}):e(l,{})]}))}))};export{C as TemplateContextMapper};
1
+ import{jsx as e,jsxs as o,Fragment as l}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useEffect as r,useState as i,useRef as a,useMemo as s}from"react";import n from"../../utils/StringUtils.js";import{COLORS as d}from"../../constants/Theme.js";import{StyledModal as u}from"../modals/styledModal.js";import{CHANNEL_TYPE as c}from"../template-preview/models/Channels.js";import{TemplateModalContext as m}from"./context/templateModalContext.js";import p from"./modalElements/Footer.js";import v from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as h}from"./utils/convertPlaceholdersToBikDropdown.js";const b=b=>{let{selectedTemplate:C,closeDialog:g,showVariableMapping:f,channel:x,htmlContent:P,templateVariables:E,onTemplateSelect:I,globalPlaceholders:S,showOnlyContent:y,whatsappSpecificPickerMeta:w,zIndex:L,showVariableModal:T,variableList:V,discountCode:k,setDiscountCode:j,onBackPress:M,enabledCustomText:D,variableListForImage:F,showSampleValues:A,disableEditVariable:B,pod:H,extras:O,pickerConf:W,selectedCarouselProducts:N,disableEditExpiry:z,cardWidth:R,onDeleteSelectedProducts:$,fileName:U,setFileName:_,hideDeviceContainerInPreview:q,maxCharLimit:G}=b;var J,K,Q,X,Y,Z,ee,oe;r((()=>{de(P)}),[P]);const le=x===c.WHATSAPP&&"CAROUSEL"===(null===(K=null===(J=null==C?void 0:C.components)||void 0===J?void 0:J[1])||void 0===K?void 0:K.type),te=null==C?void 0:C.isProductCarouselType,[re,ie]=i(x===c.EMAIL||le?"desktop":"mobile"),[ae,se]=i(!1),[ne,de]=i(P),[ue,ce]=i(!1),[me,pe]=i([]),[ve,he]=i({}),[be,Ce]=i(C),[ge,fe]=i([]),[xe,Pe]=i(null),[Ee,Ie]=i(!1),[Se,ye]=i(null!=E?E:[]),[we,Le]=i(!1),[Te,Ve]=i(le?(null===(X=null===(Q=null==be?void 0:be.mapping)||void 0===Q?void 0:Q.body)||void 0===X?void 0:X.length)?-1:0:-1),[ke,je]=i([]),[Me,De]=i(void 0),Fe=a(null),[Ae,Be]=i(!1),[He,Oe]=i(!1),[We,Ne]=i(!1),[ze,Re]=i({});r((()=>{N?je(N):te&&je([])}),[N]),r((()=>{var e;if(!Ee&&te&&(!N||0===je.length)){const o=null===(e=null==be?void 0:be.components)||void 0===e?void 0:e[1].cards,l=[];null==o||o.forEach((e=>{var o;null===(o=null==e?void 0:e.components)||void 0===o||o.forEach((e=>{var o,t,r;"HEADER"===e.type&&l.push(null!==(r=null===(t=null===(o=e.example)||void 0===o?void 0:o.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),fe(l),Ie(!0)}}),[Ee]);const $e=s((()=>h(S)),[S]);return r((()=>{De(t(V))}),[V]),e(m.Provider,Object.assign({value:{hideFooterButton:We,setHideFooterButton:Ne,hideCrossButton:He,setHideCrossButton:Oe,variableList:Me,setVariableList:De,variableCallback:xe,setVariableCallback:Pe,showVariablePicker:ae,setShowVariablePicker:se,template:be,setTemplate:Ce,device:re,setDevice:ie,display_content:ne,setDisplayContent:de,originalVariableList:Se,setOriginalVariableList:ye,isError:ue,setIsError:ce,channel:x,globalNormalizedPlaceholders:$e,templateSelectionTriggered:we,setTemplateSelectionTriggered:Le,enabledCustomText:D,disableEditVariable:B,pod:H,extras:O,isWhatsappCarousel:le,selectedCarouselIndex:Te,setSelectedCarouselIndex:Ve,isProductCarouselType:te,templateErrorIndexes:ve,cardCount:le?null===(Z=null===(Y=C.components)||void 0===Y?void 0:Y[1].cards)||void 0===Z?void 0:Z.length:void 0,errorIndexes:me,setErrorIndexes:pe,pickerConf:W,carouselProducts:ke,setCarouselProducts:je,disableEditExpiry:z,cardWidth:R,cardImages:ge,onDeleteSelectedProducts:$,hideDeviceContainerInPreview:q,sliderRef:Fe,isCarouselHovered:Ae,setIsCarouselHovered:Be,maxCharLimit:G,ctaOptionsErrors:ze,setCtaOptionsErrors:Re}},{children:y?e(v,{variableListFromProps:V,channel:c.EMAIL,hideHeader:!0}):o(u,Object.assign({hideCrossButton:He,zIndex:L,centralContainerStyles:{width:le?900:x===c.EMAIL&&f?1e3:800},open:!0,onClose:()=>{null==g||g()},headingTitle:null==be?void 0:be.label,headingSubtitle:x===c.WHATSAPP?`${n.capitaliseFirstLetterOfString(null!==(ee=null==be?void 0:be.category)&&void 0!==ee?ee:"")} • ${null!==(oe=null==be?void 0:be.templateCategory)&&void 0!==oe?oe:""}`:"",onBackPress:()=>{null==M||M()},modalHeaderStyles:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:[e(v,{variableListFromProps:V,showSampleValues:A,showVariableMapping:f,channel:x,whatsappSpecificPickerMeta:w,showVariableModal:T,discountCode:k,setDiscountCode:j,variableListForImage:F&&(null==F?void 0:F.length)>0?F:Me,fileName:U,setFileName:e=>{null==_||_(e)}}),I?e(p,{isWhatsappCarousel:null!=le&&le,onSelect:function(){var e;if((null==ke?void 0:ke.length)<1&&te)return void ce(!0);if(Object.keys(ze).length>0)return void ce(!0);const o=null==I?void 0:I(be,Se,null!=ne?ne:"",ke);he(null!==(e=null==o?void 0:o.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==o?void 0:o.errorIndexes)||(null==o?void 0:o.error)?((null==o?void 0:o.errorIndexes)&&pe(o.errorIndexes),(null==o?void 0:o.error)&&ce(!!(null==o?void 0:o.error))):Le(!0)}}):e(l,{})]}))}))};export{b as TemplateContextMapper};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.559-beta.tp-1",
3
+ "version": "0.0.559",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",