@bikdotai/bik-component-library 0.0.466-beta.3 → 0.0.466-beta.5

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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -11,4 +11,5 @@ export declare const CarouselPreview: React.ForwardRefExoticComponent<{
11
11
  template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
12
12
  showSampleValues?: boolean | undefined;
13
13
  isPreview?: boolean | undefined;
14
+ removeBottomBorder?: boolean | undefined;
14
15
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),n=require("../../assets/icons/chevronRight.svg.js"),l=require("pure-react-carousel"),i=require("react"),r=require("./CarouselPreview.style.js"),s=require("./CarouselPreviewCard.js"),o=require("../../constants/Theme.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(i).default.forwardRef(((i,a)=>{let{channel:d,template:u,showSampleValues:c,isPreview:h}=i;var v,g,p,j,x,m;const f=null===(v=null==u?void 0:u.components)||void 0===v?void 0:v[1].cards;let b="500px";const w=null!==(p=null===(g=null==u?void 0:u.components)||void 0===g?void 0:g[0].text)&&void 0!==p?p:"";return w.length>100&&w.length<300?b="530px":w.length>300&&w.length<600?b="560px":w.length>600&&w.length<900?b="590px":w.length>900&&w.length<1200&&(b="620px"),e.jsxs(r.Container,{children:[e.jsx(s.default,{channel:d,template:u,carouselCardIndex:-1,isPreview:h,width:"77%"}),!!(null==f?void 0:f.length)&&e.jsx(l.CarouselProvider,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(j=null==f?void 0:f.length)&&void 0!==j?j:1,orientation:"horizontal",visibleSlides:1.3,dragEnabled:!0,touchEnabled:!0},{children:e.jsxs(r.CarouselContainer,Object.assign({height:b},{children:[!h&&e.jsx(l.ButtonBack,Object.assign({className:"left_button"},{children:e.jsx(t.default,{height:10,width:10,color:o.COLORS.content.primary})})),e.jsx(l.Slider,Object.assign({className:"slider"},{children:null===(m=null===(x=null==u?void 0:u.components)||void 0===x?void 0:x[1].cards)||void 0===m?void 0:m.map(((t,n)=>{var i,r;const o={components:t.components,mapping:null===(r=null===(i=null==u?void 0:u.mapping)||void 0===i?void 0:i.cards)||void 0===r?void 0:r[n]};return e.jsx(l.Slide,Object.assign({index:n},{children:e.jsx(s.default,{channel:d,template:o,carouselCardIndex:n,isPreview:h,width:"100%"},n)}),n)}))})),!h&&e.jsx(l.ButtonNext,Object.assign({className:"right_button"},{children:e.jsx(n.default,{height:10,width:10,color:o.COLORS.content.primary})}))]}))}))]})}));exports.CarouselPreview=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),n=require("../../assets/icons/chevronRight.svg.js"),r=require("pure-react-carousel"),l=require("react"),i=require("./CarouselPreview.style.js"),s=require("./CarouselPreviewCard.js"),o=require("../../constants/Theme.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const d=a(l).default.forwardRef(((l,a)=>{let{channel:d,template:u,showSampleValues:c,isPreview:h,removeBottomBorder:v}=l;var g,j,p,x,m,b;const f=null===(g=null==u?void 0:u.components)||void 0===g?void 0:g[1].cards;let w="500px";const C=null!==(p=null===(j=null==u?void 0:u.components)||void 0===j?void 0:j[0].text)&&void 0!==p?p:"";return C.length>100&&C.length<300?w="530px":C.length>300&&C.length<600?w="560px":C.length>600&&C.length<900?w="590px":C.length>900&&C.length<1200&&(w="620px"),e.jsxs(i.Container,Object.assign({removeBottomBorder:v},{children:[e.jsx(s.default,{channel:d,currentTemplate:u,carouselCardIndex:-1,isPreview:h,width:"77%"}),!!(null==f?void 0:f.length)&&e.jsx(r.CarouselProvider,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(x=null==f?void 0:f.length)&&void 0!==x?x:1,orientation:"horizontal",visibleSlides:1.3,dragEnabled:!0,touchEnabled:!0},{children:e.jsxs(i.CarouselContainer,Object.assign({height:w},{children:[!h&&e.jsx(r.ButtonBack,Object.assign({className:"left_button"},{children:e.jsx(t.default,{height:10,width:10,color:o.COLORS.content.primary})})),e.jsx(r.Slider,Object.assign({className:"slider"},{children:null===(b=null===(m=null==u?void 0:u.components)||void 0===m?void 0:m[1].cards)||void 0===b?void 0:b.map(((t,n)=>{var l,i;const o={components:t.components,mapping:null===(i=null===(l=null==u?void 0:u.mapping)||void 0===l?void 0:l.cards)||void 0===i?void 0:i[n]};return e.jsx(r.Slide,Object.assign({index:n},{children:e.jsx(s.default,{channel:d,currentTemplate:o,carouselCardIndex:n,isPreview:h,width:"100%"},n)}),n)}))})),!h&&e.jsx(r.ButtonNext,Object.assign({className:"right_button"},{children:e.jsx(n.default,{height:10,width:10,color:o.COLORS.content.primary})}))]}))}))]}))}));exports.CarouselPreview=d;
@@ -1,5 +1,6 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
2
2
  showHeader?: boolean | undefined;
3
+ removeBottomBorder?: boolean | undefined;
3
4
  }, never>;
4
5
  export declare const CarouselContainer: import("styled-components").StyledComponent<"div", any, {
5
6
  height: string;
@@ -2,7 +2,7 @@
2
2
  background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');
3
3
  border-color: ${t.COLORS.stroke.primary};
4
4
  border-top-style: solid;
5
- border-bottom-style: solid;
5
+ border-bottom-style: ${e=>e.removeBottomBorder?"unset":"solid"};
6
6
  border-top-width: 1px;
7
7
  border-bottom-width: 1px;
8
8
  background-repeat: no-repeat;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CHANNEL_TYPE } from "../template-preview/models/Channels";
3
3
  declare const CarouselPreviewCard: React.ForwardRefExoticComponent<{
4
4
  channel: CHANNEL_TYPE;
5
- template: any;
5
+ currentTemplate: any;
6
6
  showSampleValues?: boolean | undefined;
7
7
  carouselCardIndex?: number | undefined;
8
8
  isPreview?: boolean | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/TemplatePreview.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../constants/Theme.js"),require("../curtain/CurtainHelper.js"),require("../template-preview/models/TemplateMeta.js"),require("../template-preview/models/WhatsAppTemplate.js");const i=s(t).default.forwardRef((t=>{let{channel:s,template:i,showSampleValues:p,carouselCardIndex:l,isPreview:u,width:n}=t;const{cardWidth:o}=r.useTemplateModalContext();return e.jsx("div",Object.assign({style:{width:n||o}},{children:e.jsx(a.TemplatePreview,{showSampleValues:p,template:i,channel:s,size:"small",hideHeader:!0,carouselCardIndex:l,isWhatsappCarousel:!0,isPreview:u})}))}));exports.default=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/TemplatePreview.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../constants/Theme.js"),require("../curtain/CurtainHelper.js"),require("../template-preview/models/TemplateMeta.js"),require("../template-preview/models/WhatsAppTemplate.js");const l=i(t).default.forwardRef((t=>{let{channel:i,currentTemplate:l,showSampleValues:s,carouselCardIndex:p,isPreview:n,width:u}=t;var o,d,m;const{cardWidth:c,template:v}=r.useTemplateModalContext(),h=(null!==(m=null===(d=null===(o=null==v?void 0:v.components)||void 0===o?void 0:o[1].cards)||void 0===d?void 0:d.length)&&void 0!==m?m:0)-1===p?12:0;return e.jsx("div",Object.assign({style:{width:u||c}},{children:e.jsx(a.TemplatePreview,{showSampleValues:s,template:l,channel:i,size:"small",hideHeader:!0,carouselCardIndex:p,isWhatsappCarousel:!0,isPreview:n,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:h}}})}))}));exports.default=l;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),o=require("../modals/styledModal.js"),a=require("../template-preview/models/Channels.js"),r=require("./context/templateModalContext.js"),s=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:v,htmlContent:h,templateVariables:m,onTemplateSelect:C,globalPlaceholders:E,showOnlyContent:S,whatsappSpecificPickerMeta:x,zIndex:b,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,onBackPress:j,enabledCustomText:M,variableListForImage:I,showSampleValues:L,disableEditVariable:y,pod:A,extras:w,pickerConf:N,selectedCarouselProducts:V,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:q}=d;var H,_,O,W,F,Y;l.useEffect((()=>{G(h)}),[h]);const B=v===a.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(_=null===(H=null==u?void 0:u.components)||void 0===H?void 0:H[1])||void 0===_?void 0:_.type),z=null==u?void 0:u.isProductCarouselType,[R,U]=l.useState(v===a.CHANNEL_TYPE.EMAIL||B?"desktop":"mobile"),[$,G]=l.useState(h),[J,K]=l.useState(!1),[Q,X]=l.useState([]),[Z,ee]=l.useState(u),[le,te]=l.useState([]),[oe,ae]=l.useState(!1),[re,se]=l.useState(null!=m?m:[]),[ie,ne]=l.useState(!1),[de,ue]=l.useState(-1),[ce,pe]=l.useState([]);l.useEffect((()=>{V?pe(V):z&&pe([])}),[V]),l.useEffect((()=>{var e;if(!oe&&z){const l=null===(e=null==Z?void 0:Z.components)||void 0===e?void 0:e[1].cards,t=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,o,a;"HEADER"===e.type&&t.push(null!==(a=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),te(t),ae(!0)}}),[oe]);const ve=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(E)),[E]);return e.jsx(r.TemplateModalContext.Provider,Object.assign({value:{template:Z,setTemplate:ee,device:R,setDevice:U,display_content:$,setDisplayContent:G,originalVariableList:re,setOriginalVariableList:se,isError:J,setIsError:K,channel:v,globalNormalizedPlaceholders:ve,templateSelectionTriggered:ie,setTemplateSelectionTriggered:ne,enabledCustomText:M,disableEditVariable:y,pod:A,extras:w,isWhatsappCarousel:B,selectedCarouselIndex:de,setSelectedCarouselIndex:ue,isProductCarouselType:z,cardCount:B?null===(W=null===(O=u.components)||void 0===O?void 0:O[1].cards)||void 0===W?void 0:W.length:void 0,errorIndexes:Q,setErrorIndexes:X,pickerConf:N,carouselProducts:ce,setCarouselProducts:pe,disableEditExpiry:D,cardWidth:k,cardImages:le,onDeleteSelectedProducts:q}},{children:S?e.jsx(i.default,{channel:a.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(o.StyledModal,Object.assign({zIndex:b,centralContainerStyles:{width:B?900:v===a.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==Z?void 0:Z.label,headingSubtitle:v===a.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(F=null==Z?void 0:Z.category)&&void 0!==F?F:"")} • ${null!==(Y=null==Z?void 0:Z.templateCategory)&&void 0!==Y?Y:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:p,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,variableListForImage:I&&(null==I?void 0:I.length)>0?I:P}),C?e.jsx(s.default,{isWhatsappCarousel:null!=B&&B,onSelect:function(){if((null==ce?void 0:ce.length)<1&&z)return void K(!0);const e=null==C?void 0:C(Z,re,null!=$?$:"",ce);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&X(e.errorIndexes),(null==e?void 0:e.error)&&K(!!(null==e?void 0:e.error))):ne(!0)}}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),o=require("../modals/styledModal.js"),a=require("../template-preview/models/Channels.js"),r=require("./context/templateModalContext.js"),s=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:v,htmlContent:h,templateVariables:m,onTemplateSelect:C,globalPlaceholders:E,showOnlyContent:S,whatsappSpecificPickerMeta:x,zIndex:b,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,onBackPress:j,enabledCustomText:M,variableListForImage:I,showSampleValues:L,disableEditVariable:y,pod:A,extras:w,pickerConf:N,selectedCarouselProducts:V,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:q}=d;var H,_,O,W,F,Y;l.useEffect((()=>{G(h)}),[h]);const B=v===a.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(_=null===(H=null==u?void 0:u.components)||void 0===H?void 0:H[1])||void 0===_?void 0:_.type),z=null==u?void 0:u.isProductCarouselType,[R,U]=l.useState(v===a.CHANNEL_TYPE.EMAIL||B?"desktop":"mobile"),[$,G]=l.useState(h),[J,K]=l.useState(!1),[Q,X]=l.useState([]),[Z,ee]=l.useState(u),[le,te]=l.useState([]),[oe,ae]=l.useState(!1),[re,se]=l.useState(null!=m?m:[]),[ie,ne]=l.useState(!1),[de,ue]=l.useState(-1),[ce,pe]=l.useState([]);l.useEffect((()=>{V?pe(V):z&&pe([])}),[V]),l.useEffect((()=>{var e;if(!oe&&z&&(!V||0===pe.length)){const l=null===(e=null==Z?void 0:Z.components)||void 0===e?void 0:e[1].cards,t=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,o,a;"HEADER"===e.type&&t.push(null!==(a=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),te(t),ae(!0)}}),[oe]);const ve=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(E)),[E]);return e.jsx(r.TemplateModalContext.Provider,Object.assign({value:{template:Z,setTemplate:ee,device:R,setDevice:U,display_content:$,setDisplayContent:G,originalVariableList:re,setOriginalVariableList:se,isError:J,setIsError:K,channel:v,globalNormalizedPlaceholders:ve,templateSelectionTriggered:ie,setTemplateSelectionTriggered:ne,enabledCustomText:M,disableEditVariable:y,pod:A,extras:w,isWhatsappCarousel:B,selectedCarouselIndex:de,setSelectedCarouselIndex:ue,isProductCarouselType:z,cardCount:B?null===(W=null===(O=u.components)||void 0===O?void 0:O[1].cards)||void 0===W?void 0:W.length:void 0,errorIndexes:Q,setErrorIndexes:X,pickerConf:N,carouselProducts:ce,setCarouselProducts:pe,disableEditExpiry:D,cardWidth:k,cardImages:le,onDeleteSelectedProducts:q}},{children:S?e.jsx(i.default,{channel:a.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(o.StyledModal,Object.assign({zIndex:b,centralContainerStyles:{width:B?900:v===a.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==Z?void 0:Z.label,headingSubtitle:v===a.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(F=null==Z?void 0:Z.category)&&void 0!==F?F:"")} • ${null!==(Y=null==Z?void 0:Z.templateCategory)&&void 0!==Y?Y:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:p,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,variableListForImage:I&&(null==I?void 0:I.length)>0?I:P}),C?e.jsx(s.default,{isWhatsappCarousel:null!=B&&B,onSelect:function(){if((null==ce?void 0:ce.length)<1&&z)return void K(!0);const e=null==C?void 0:C(Z,re,null!=$?$:"",ce);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&X(e.errorIndexes),(null==e?void 0:e.error)&&K(!!(null==e?void 0:e.error))):ne(!0)}}):e.jsx(e.Fragment,{})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),l=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js"),require("../../add-variableV2/AddVariableV2.styled.js");var i=require("../../button/Button.js");require("../../icon-button/IconButton.js"),require("../../input/Input.js"),require("../../tooltips/Tooltip.js");var o=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var s=require("../../TypographyStyle.js"),n=require("../../product-picker-v2/modal.js"),d=require("../context/templateModalContext.js"),c=require("./EditWhatsAppTemplateV2.js"),u=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../curtain/CurtainHelper.js"),require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/WhatsAppTemplate.js");exports.default=m=>{let{template:h,whatsappSpecificPickerMeta:g,showVariableModal:v,variableList:j,variableListForImage:x,discountCode:y,setDiscountCode:b}=m;var f,C;const{selectedCarouselIndex:O,setTemplate:I,pickerConf:q,isProductCarouselType:w,pod:P,cardCount:S,carouselProducts:T,setCarouselProducts:L,isError:k,cardImages:B,disableEditVariable:V,onDeleteSelectedProducts:A}=d.useTemplateModalContext(),[E,M]=a.useState(-1==O?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[R,F]=a.useState(!1),[D,W]=a.useState(!1),[_,N]=a.useState(!1);a.useEffect((()=>{M(-1==O?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[O]);return e.jsxs("div",{children:[e.jsx(s.TitleMedium,Object.assign({style:{marginLeft:10,marginBottom:24}},{children:E})),w&&(null!==(f=null==T?void 0:T.length)&&void 0!==f?f:0)>0&&null!=O&&O>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(u.ProductBox,{editItem:()=>{1===(null==T?void 0:T.length)&&"variable"===T[0].name?N(!0):F(!R)},cardBody:1===(null==T?void 0:T.length)&&"variable"===T[0].name?`${T[0].productName}`:`${null==T?void 0:T.length} Products Selected`,hideIcon:1===(null==T?void 0:T.length)&&"variable"===T[0].name,deleteItem:()=>{var e;if(1===(null==T?void 0:T.length)&&"variable"===T[0].name)return void(null==L||L([]));const t=r.cloneDeep(Object.assign({},h));console.log("cardImages selectedTemplate: ",t),t&&(console.log("cardImages: ",B),B&&B.length>0?null==B||B.forEach(((e,r)=>{var a;t.components[1].cards[r].components[0].example.header_handle=[null!==(a=B[r])&&void 0!==a?a:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,r)=>{t.components[1].cards[r].components[0].example.header_handle=[""]})),null==I||I(t),console.log("cardImages22 selectedTemplate: ",t)),null==L||L([]),null==A||A()}}),T&&(null==T?void 0:T.length)>0&&"variable"!=T[0].name&&e.jsx(i.Button,{disabled:(null!==(C=null==T?void 0:T.length)&&void 0!==C?C:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{W(!0),F(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!V&&w&&0===(null==T?void 0:T.length)&&null!=O&&O>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(s.TitleRegular,{children:"Product(s)"}),e.jsx(s.BodySecondary,{children:`Select ${null!=S?S:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:k?`2px dashed ${o.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:k?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(t.default,{width:18,height:18,color:o.COLORS.content.secondary})})),onClick:e=>{F(!0)}}),P===p.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(s.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:k?`2px dashed ${o.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:k?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(t.default,{width:18,height:18,color:o.COLORS.content.secondary})})),onClick:e=>{N(!0)}})]})]}))]}),e.jsx(c.default,{whatsappSpecificPickerMeta:g,template:h,onTemplateChange:e=>{null==I||I(e)},showVariableModal:v,variableList:j,variableListForImage:x,discountCode:y,setDiscountCode:b}),R&&q&&e.jsx(n.ProductPickerModal,{zIndex:200,startupScreen:D?n.ScreenName.RearrangeProducts:n.ScreenName.Collections,rearrangeEnabled:!0,storeId:q.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const r of e){const e=null==r?void 0:r.collectionId,a=r.productId,l=r.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),a in t[e].products||(t[e].products[a]={variants:{},name:(null==r?void 0:r.productName)||"",image:(null==r?void 0:r.productImage)||""}),t[e].products[a].variants[l]={name:(null==r?void 0:r.name)||"",price:"",image:(null==r?void 0:r.image)||"",quantity:r.quantity||0,displayOrder:r.displayOrder}}return t}return{}})(null!=T?T:[]),collectionFetcher:q.fetchCollections,productFetcher:q.fetchProducts,onAdd:(e,t)=>{var a;W(!1);const l=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const i=r[e].variants;if(void 0!==i&&Object.keys(i).length)for(const o of Object.keys(i)){const{name:s,image:n,quantity:d,displayOrder:c}=i[o],u={name:s,image:null!==(a=null!=n?n:r[e].image)&&void 0!==a?a:"",quantity:d,variantId:o,productId:e,displayOrder:c,collectionId:t,productName:r[e].name,productImage:r[e].image};l.push(u)}}}const i=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),o=l.map((e=>e.image)),s=r.cloneDeep(Object.assign({},h));s&&(o.forEach(((e,t)=>{var r;s.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(r=null==B?void 0:B[t])&&void 0!==r?r:""]})),null==I||I(s)),null==L||L(i),F(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:R,onClose:()=>{F(!1)},exactLimit:null!=S?S:1}),_&&e.jsx(l.AddVariableV2SideModal,{zIndex:2e3,data:null!=j?j:[],showVariable:_,setShowVariable:N,placeholder:"Add a variable",customTrigger:e=>{null==L||L([{name:"variable",productName:e.actualValue}])}})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),l=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),i=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js"),require("../../add-variableV2/AddVariableV2.styled.js");var s=require("../../button/Button.js"),o=require("../../icon-button/IconButton.js");require("../../input/Input.js"),require("../../tooltips/Tooltip.js");var n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../product-picker-v2/modal.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),m=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../curtain/CurtainHelper.js"),require("../../template-preview/models/TemplateMeta.js");var h=require("../../template-preview/models/WhatsAppTemplate.js");exports.default=g=>{let{template:v,whatsappSpecificPickerMeta:j,showVariableModal:x,variableList:y,variableListForImage:b,discountCode:f,setDiscountCode:C}=g;var I,O;const{selectedCarouselIndex:q,setTemplate:w,pickerConf:S,isProductCarouselType:P,pod:T,cardCount:k,carouselProducts:B,setCarouselProducts:L,isError:V,cardImages:A,disableEditVariable:E,onDeleteSelectedProducts:M,setSelectedCarouselIndex:R}=u.useTemplateModalContext(),[D,F]=a.useState(-1==q?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[W,_]=a.useState(!1),[N,$]=a.useState(!1),[z,G]=a.useState(!1);a.useEffect((()=>{F(-1==q?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[q]);return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=q&&q>=0&&e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{null==R||R(-1)}}),e.jsx(d.TitleMedium,Object.assign({style:{marginLeft:10}},{children:D}))]})),P&&(null!==(I=null==B?void 0:B.length)&&void 0!==I?I:0)>0&&null!=q&&q>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(m.ProductBox,{editItem:()=>{1===(null==B?void 0:B.length)&&"variable"===B[0].name?G(!0):_(!W)},cardBody:1===(null==B?void 0:B.length)&&"variable"===B[0].name?`${B[0].productName}`:`${null==B?void 0:B.length} Products Selected`,hideIcon:1===(null==B?void 0:B.length)&&"variable"===B[0].name,deleteItem:()=>{var e;if(1===(null==B?void 0:B.length)&&"variable"===B[0].name)return void(null==L||L([]));const t=r.cloneDeep(Object.assign({},v));console.log("cardImages selectedTemplate: ",t),t&&(console.log("cardImages: ",A),A&&A.length>0?null==A||A.forEach(((e,l)=>{var r;t.components[1].cards[l].components[0].example.header_handle=[null!==(r=A[l])&&void 0!==r?r:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=[""]})),null==w||w(t),console.log("cardImages22 selectedTemplate: ",t)),null==L||L([]),null==M||M()}}),B&&(null==B?void 0:B.length)>0&&"variable"!=B[0].name&&e.jsx(s.Button,{disabled:(null!==(O=null==B?void 0:B.length)&&void 0!==O?O:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{$(!0),_(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!E&&P&&0===(null==B?void 0:B.length)&&null!=q&&q>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(d.TitleRegular,{children:"Product(s)"}),e.jsx(d.BodySecondary,{children:`Select ${null!=k?k:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:V?`2px dashed ${n.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:V?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(l.default,{width:18,height:18,color:n.COLORS.content.secondary})})),onClick:e=>{_(!0)}}),T===h.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(d.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:V?`2px dashed ${n.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:V?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(l.default,{width:18,height:18,color:n.COLORS.content.secondary})})),onClick:e=>{G(!0)}})]})]}))]}),e.jsx(p.default,{whatsappSpecificPickerMeta:j,template:v,onTemplateChange:e=>{null==w||w(e)},showVariableModal:x,variableList:y,variableListForImage:b,discountCode:f,setDiscountCode:C}),W&&S&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:N?c.ScreenName.RearrangeProducts:c.ScreenName.Collections,rearrangeEnabled:!0,storeId:S.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,r=l.productId,a=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),r in t[e].products||(t[e].products[r]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[r].variants[a]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=B?B:[]),collectionFetcher:S.fetchCollections,productFetcher:S.fetchProducts,onAdd:(e,t)=>{var l;$(!1);const a=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const i=r[e].variants;if(void 0!==i&&Object.keys(i).length)for(const s of Object.keys(i)){const{name:o,image:n,quantity:d,displayOrder:c}=i[s],u={name:o,image:null!==(l=null!=n?n:r[e].image)&&void 0!==l?l:"",quantity:d,variantId:s,productId:e,displayOrder:c,collectionId:t,productName:r[e].name,productImage:r[e].image};a.push(u)}}}const i=a.sort(((e,t)=>e.displayOrder-t.displayOrder)),s=a.map((e=>e.image)),o=r.cloneDeep(Object.assign({},v));o&&(s.forEach(((e,t)=>{var l;o.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==A?void 0:A[t])&&void 0!==l?l:""]})),null==w||w(o)),null==L||L(i),_(!1)},searchInCollectionFetcher:S.searchInCollection,searchFetcher:S.searchProducts,visible:W,onClose:()=>{_(!1)},exactLimit:null!=k?k:1}),z&&e.jsx(i.AddVariableV2SideModal,{zIndex:2e3,data:null!=y?y:[],showVariable:z,setShowVariable:G,placeholder:"Add a variable",customTrigger:e=>{null==L||L([{name:"variable",productName:e.actualValue}])}})]})};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -11,4 +11,5 @@ export declare const CarouselPreview: React.ForwardRefExoticComponent<{
11
11
  template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
12
12
  showSampleValues?: boolean | undefined;
13
13
  isPreview?: boolean | undefined;
14
+ removeBottomBorder?: boolean | undefined;
14
15
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as n}from"react/jsx-runtime";import t from"../../assets/icons/chevronLeft.svg.js";import l from"../../assets/icons/chevronRight.svg.js";import{CarouselProvider as i,ButtonBack as o,Slider as r,Slide as s,ButtonNext as a}from"pure-react-carousel";import d from"react";import{Container as c,CarouselContainer as h}from"./CarouselPreview.style.js";import m from"./CarouselPreviewCard.js";import{COLORS as v}from"../../constants/Theme.js";const p=d.forwardRef(((d,p)=>{let{channel:u,template:g,showSampleValues:f,isPreview:j}=d;var b,w,x,O,C,P;const S=null===(b=null==g?void 0:g.components)||void 0===b?void 0:b[1].cards;let y="500px";const N=null!==(x=null===(w=null==g?void 0:g.components)||void 0===w?void 0:w[0].text)&&void 0!==x?x:"";return N.length>100&&N.length<300?y="530px":N.length>300&&N.length<600?y="560px":N.length>600&&N.length<900?y="590px":N.length>900&&N.length<1200&&(y="620px"),e(c,{children:[n(m,{channel:u,template:g,carouselCardIndex:-1,isPreview:j,width:"77%"}),!!(null==S?void 0:S.length)&&n(i,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(O=null==S?void 0:S.length)&&void 0!==O?O:1,orientation:"horizontal",visibleSlides:1.3,dragEnabled:!0,touchEnabled:!0},{children:e(h,Object.assign({height:y},{children:[!j&&n(o,Object.assign({className:"left_button"},{children:n(t,{height:10,width:10,color:v.content.primary})})),n(r,Object.assign({className:"slider"},{children:null===(P=null===(C=null==g?void 0:g.components)||void 0===C?void 0:C[1].cards)||void 0===P?void 0:P.map(((e,t)=>{var l,i;const o={components:e.components,mapping:null===(i=null===(l=null==g?void 0:g.mapping)||void 0===l?void 0:l.cards)||void 0===i?void 0:i[t]};return n(s,Object.assign({index:t},{children:n(m,{channel:u,template:o,carouselCardIndex:t,isPreview:j,width:"100%"},t)}),t)}))})),!j&&n(a,Object.assign({className:"right_button"},{children:n(l,{height:10,width:10,color:v.content.primary})}))]}))}))]})}));export{p as CarouselPreview};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import n from"../../assets/icons/chevronLeft.svg.js";import o from"../../assets/icons/chevronRight.svg.js";import{CarouselProvider as i,ButtonBack as l,Slider as r,Slide as s,ButtonNext as a}from"pure-react-carousel";import d from"react";import{Container as c,CarouselContainer as h}from"./CarouselPreview.style.js";import m from"./CarouselPreviewCard.js";import{COLORS as v}from"../../constants/Theme.js";const p=d.forwardRef(((d,p)=>{let{channel:u,template:g,showSampleValues:j,isPreview:b,removeBottomBorder:f}=d;var w,x,O,C,P,S;const B=null===(w=null==g?void 0:g.components)||void 0===w?void 0:w[1].cards;let y="500px";const N=null!==(O=null===(x=null==g?void 0:g.components)||void 0===x?void 0:x[0].text)&&void 0!==O?O:"";return N.length>100&&N.length<300?y="530px":N.length>300&&N.length<600?y="560px":N.length>600&&N.length<900?y="590px":N.length>900&&N.length<1200&&(y="620px"),e(c,Object.assign({removeBottomBorder:f},{children:[t(m,{channel:u,currentTemplate:g,carouselCardIndex:-1,isPreview:b,width:"77%"}),!!(null==B?void 0:B.length)&&t(i,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(C=null==B?void 0:B.length)&&void 0!==C?C:1,orientation:"horizontal",visibleSlides:1.3,dragEnabled:!0,touchEnabled:!0},{children:e(h,Object.assign({height:y},{children:[!b&&t(l,Object.assign({className:"left_button"},{children:t(n,{height:10,width:10,color:v.content.primary})})),t(r,Object.assign({className:"slider"},{children:null===(S=null===(P=null==g?void 0:g.components)||void 0===P?void 0:P[1].cards)||void 0===S?void 0:S.map(((e,n)=>{var o,i;const l={components:e.components,mapping:null===(i=null===(o=null==g?void 0:g.mapping)||void 0===o?void 0:o.cards)||void 0===i?void 0:i[n]};return t(s,Object.assign({index:n},{children:t(m,{channel:u,currentTemplate:l,carouselCardIndex:n,isPreview:b,width:"100%"},n)}),n)}))})),!b&&t(a,Object.assign({className:"right_button"},{children:t(o,{height:10,width:10,color:v.content.primary})}))]}))}))]}))}));export{p as CarouselPreview};
@@ -1,5 +1,6 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
2
2
  showHeader?: boolean | undefined;
3
+ removeBottomBorder?: boolean | undefined;
3
4
  }, never>;
4
5
  export declare const CarouselContainer: import("styled-components").StyledComponent<"div", any, {
5
6
  height: string;
@@ -2,7 +2,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
2
2
  background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');
3
3
  border-color: ${o.stroke.primary};
4
4
  border-top-style: solid;
5
- border-bottom-style: solid;
5
+ border-bottom-style: ${e=>e.removeBottomBorder?"unset":"solid"};
6
6
  border-top-width: 1px;
7
7
  border-bottom-width: 1px;
8
8
  background-repeat: no-repeat;
@@ -11,7 +11,7 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
11
11
  position: relative;
12
12
  height: 500px;
13
13
  overflow-y: auto;
14
- `,i=e.div`
14
+ `,r=e.div`
15
15
  flex-direction: row;
16
16
  display: flex;
17
17
  align-items: center;
@@ -49,4 +49,4 @@ import e from"styled-components";import{COLORS as o}from"../../constants/Theme.j
49
49
  width: 100%;
50
50
  height: ${e=>e.height};
51
51
  }
52
- `;export{i as CarouselContainer,t as Container};
52
+ `;export{r as CarouselContainer,t as Container};
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CHANNEL_TYPE } from "../template-preview/models/Channels";
3
3
  declare const CarouselPreviewCard: React.ForwardRefExoticComponent<{
4
4
  channel: CHANNEL_TYPE;
5
- template: any;
5
+ currentTemplate: any;
6
6
  showSampleValues?: boolean | undefined;
7
7
  carouselCardIndex?: number | undefined;
8
8
  isPreview?: boolean | undefined;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import t from"react";import{useTemplateModalContext as a}from"../template-context-mapper/context/templateModalContext.js";import{TemplatePreview as p}from"../template-preview/TemplatePreview.js";import"../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../constants/Theme.js";import"../curtain/CurtainHelper.js";import"../template-preview/models/TemplateMeta.js";import"../template-preview/models/WhatsAppTemplate.js";const r=t.forwardRef((t=>{let{channel:r,template:s,showSampleValues:i,carouselCardIndex:m,isPreview:l,width:o}=t;const{cardWidth:n}=a();return e("div",Object.assign({style:{width:o||n}},{children:e(p,{showSampleValues:i,template:s,channel:r,size:"small",hideHeader:!0,carouselCardIndex:m,isWhatsappCarousel:!0,isPreview:l})}))}));export{r as default};
1
+ import{jsx as e}from"react/jsx-runtime";import t from"react";import{useTemplateModalContext as a}from"../template-context-mapper/context/templateModalContext.js";import{TemplatePreview as p}from"../template-preview/TemplatePreview.js";import"../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../constants/Theme.js";import"../curtain/CurtainHelper.js";import"../template-preview/models/TemplateMeta.js";import"../template-preview/models/WhatsAppTemplate.js";const r=t.forwardRef((t=>{let{channel:r,currentTemplate:i,showSampleValues:l,carouselCardIndex:s,isPreview:o,width:m}=t;var n,d,c;const{cardWidth:h,template:v}=a(),w=(null!==(c=null===(d=null===(n=null==v?void 0:v.components)||void 0===n?void 0:n[1].cards)||void 0===d?void 0:d.length)&&void 0!==c?c:0)-1===s?12:0;return e("div",Object.assign({style:{width:m||h}},{children:e(p,{showSampleValues:l,template:i,channel:r,size:"small",hideHeader:!0,carouselCardIndex:s,isWhatsappCarousel:!0,isPreview:o,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:w}}})}))}));export{r as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as r,useMemo as i}from"react";import a from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as s}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import u from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const m=m=>{let{selectedTemplate:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:x,onTemplateSelect:f,globalPlaceholders:E,showOnlyContent:P,whatsappSpecificPickerMeta:S,zIndex:I,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,onBackPress:L,enabledCustomText:V,variableListForImage:j,showSampleValues:A,disableEditVariable:D,pod:k,extras:O,pickerConf:W,selectedCarouselProducts:F,disableEditExpiry:H,cardWidth:z,onDeleteSelectedProducts:B}=m;var R,U,$,_,N,q;t((()=>{Y(g)}),[g]);const G=b===s.WHATSAPP&&"CAROUSEL"===(null===(U=null===(R=null==v?void 0:v.components)||void 0===R?void 0:R[1])||void 0===U?void 0:U.type),J=null==v?void 0:v.isProductCarouselType,[K,Q]=r(b===s.EMAIL||G?"desktop":"mobile"),[X,Y]=r(g),[Z,ee]=r(!1),[le,oe]=r([]),[te,re]=r(v),[ie,ae]=r([]),[ne,se]=r(!1),[de,ce]=r(null!=x?x:[]),[ue,pe]=r(!1),[me,ve]=r(-1),[he,Ce]=r([]);t((()=>{F?Ce(F):J&&Ce([])}),[F]),t((()=>{var e;if(!ne&&J){const l=null===(e=null==te?void 0:te.components)||void 0===e?void 0:e[1].cards,o=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,t,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),ae(o),se(!0)}}),[ne]);const be=i((()=>p(E)),[E]);return e(d.Provider,Object.assign({value:{template:te,setTemplate:re,device:K,setDevice:Q,display_content:X,setDisplayContent:Y,originalVariableList:de,setOriginalVariableList:ce,isError:Z,setIsError:ee,channel:b,globalNormalizedPlaceholders:be,templateSelectionTriggered:ue,setTemplateSelectionTriggered:pe,enabledCustomText:V,disableEditVariable:D,pod:k,extras:O,isWhatsappCarousel:G,selectedCarouselIndex:me,setSelectedCarouselIndex:ve,isProductCarouselType:J,cardCount:G?null===(_=null===($=v.components)||void 0===$?void 0:$[1].cards)||void 0===_?void 0:_.length:void 0,errorIndexes:le,setErrorIndexes:oe,pickerConf:W,carouselProducts:he,setCarouselProducts:Ce,disableEditExpiry:H,cardWidth:z,cardImages:ie,onDeleteSelectedProducts:B}},{children:P?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:I,centralContainerStyles:{width:G?900:b===s.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==te?void 0:te.label,headingSubtitle:b===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(N=null==te?void 0:te.category)&&void 0!==N?N:"")} • ${null!==(q=null==te?void 0:te.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:A,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,variableListForImage:j&&(null==j?void 0:j.length)>0?j:y}),f?e(c,{isWhatsappCarousel:null!=G&&G,onSelect:function(){if((null==he?void 0:he.length)<1&&J)return void ee(!0);const e=null==f?void 0:f(te,de,null!=X?X:"",he);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&oe(e.errorIndexes),(null==e?void 0:e.error)&&ee(!!(null==e?void 0:e.error))):pe(!0)}}):e(o,{})]}))}))};export{m as TemplateContextMapper};
1
+ import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as r,useMemo as i}from"react";import a from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as s}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import u from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const m=m=>{let{selectedTemplate:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:x,onTemplateSelect:f,globalPlaceholders:E,showOnlyContent:P,whatsappSpecificPickerMeta:S,zIndex:I,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,onBackPress:L,enabledCustomText:V,variableListForImage:j,showSampleValues:A,disableEditVariable:D,pod:k,extras:O,pickerConf:W,selectedCarouselProducts:F,disableEditExpiry:H,cardWidth:z,onDeleteSelectedProducts:B}=m;var R,U,$,_,N,q;t((()=>{Y(g)}),[g]);const G=b===s.WHATSAPP&&"CAROUSEL"===(null===(U=null===(R=null==v?void 0:v.components)||void 0===R?void 0:R[1])||void 0===U?void 0:U.type),J=null==v?void 0:v.isProductCarouselType,[K,Q]=r(b===s.EMAIL||G?"desktop":"mobile"),[X,Y]=r(g),[Z,ee]=r(!1),[le,oe]=r([]),[te,re]=r(v),[ie,ae]=r([]),[ne,se]=r(!1),[de,ce]=r(null!=x?x:[]),[ue,pe]=r(!1),[me,ve]=r(-1),[he,Ce]=r([]);t((()=>{F?Ce(F):J&&Ce([])}),[F]),t((()=>{var e;if(!ne&&J&&(!F||0===Ce.length)){const l=null===(e=null==te?void 0:te.components)||void 0===e?void 0:e[1].cards,o=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,t,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),ae(o),se(!0)}}),[ne]);const be=i((()=>p(E)),[E]);return e(d.Provider,Object.assign({value:{template:te,setTemplate:re,device:K,setDevice:Q,display_content:X,setDisplayContent:Y,originalVariableList:de,setOriginalVariableList:ce,isError:Z,setIsError:ee,channel:b,globalNormalizedPlaceholders:be,templateSelectionTriggered:ue,setTemplateSelectionTriggered:pe,enabledCustomText:V,disableEditVariable:D,pod:k,extras:O,isWhatsappCarousel:G,selectedCarouselIndex:me,setSelectedCarouselIndex:ve,isProductCarouselType:J,cardCount:G?null===(_=null===($=v.components)||void 0===$?void 0:$[1].cards)||void 0===_?void 0:_.length:void 0,errorIndexes:le,setErrorIndexes:oe,pickerConf:W,carouselProducts:he,setCarouselProducts:Ce,disableEditExpiry:H,cardWidth:z,cardImages:ie,onDeleteSelectedProducts:B}},{children:P?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:I,centralContainerStyles:{width:G?900:b===s.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==te?void 0:te.label,headingSubtitle:b===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(N=null==te?void 0:te.category)&&void 0!==N?N:"")} • ${null!==(q=null==te?void 0:te.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:A,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,variableListForImage:j&&(null==j?void 0:j.length)>0?j:y}),f?e(c,{isWhatsappCarousel:null!=G&&G,onSelect:function(){if((null==he?void 0:he.length)<1&&J)return void ee(!0);const e=null==f?void 0:f(te,de,null!=X?X:"",he);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&oe(e.errorIndexes),(null==e?void 0:e.error)&&ee(!!(null==e?void 0:e.error))):pe(!0)}}):e(o,{})]}))}))};export{m as TemplateContextMapper};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import l from"../../../assets/icons/PlusIcon.js";import{cloneDeep as i}from"lodash";import{useState as a,useEffect as r}from"react";import{AddVariableV2SideModal as n}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import{Button as s}from"../../button/Button.js";import"../../icon-button/IconButton.js";import"../../input/Input.js";import"../../tooltips/Tooltip.js";import{COLORS as d}from"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleMedium as c,TitleRegular as m,BodySecondary as p,BodyCaption as u}from"../../TypographyStyle.js";import{ProductPickerModal as h,ScreenName as g}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as b}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../curtain/CurtainHelper.js";import"../../template-preview/models/TemplateMeta.js";import{POD as y}from"../../template-preview/models/WhatsAppTemplate.js";const j=j=>{let{template:I,whatsappSpecificPickerMeta:x,showVariableModal:w,variableList:C,variableListForImage:O,discountCode:P,setDiscountCode:T}=j;var k,S;const{selectedCarouselIndex:V,setTemplate:L,pickerConf:A,isProductCarouselType:E,pod:B,cardCount:M,carouselProducts:F,setCarouselProducts:W,isError:D,cardImages:R,disableEditVariable:$,onDeleteSelectedProducts:_}=v(),[q,z]=a(-1==V?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[N,G]=a(!1),[H,J]=a(!1),[K,Q]=a(!1);r((()=>{z(-1==V?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[V]);return e("div",{children:[t(c,Object.assign({style:{marginLeft:10,marginBottom:24}},{children:q})),E&&(null!==(k=null==F?void 0:F.length)&&void 0!==k?k:0)>0&&null!=V&&V>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(b,{editItem:()=>{1===(null==F?void 0:F.length)&&"variable"===F[0].name?Q(!0):G(!N)},cardBody:1===(null==F?void 0:F.length)&&"variable"===F[0].name?`${F[0].productName}`:`${null==F?void 0:F.length} Products Selected`,hideIcon:1===(null==F?void 0:F.length)&&"variable"===F[0].name,deleteItem:()=>{var e;if(1===(null==F?void 0:F.length)&&"variable"===F[0].name)return void(null==W||W([]));const t=i(Object.assign({},I));console.log("cardImages selectedTemplate: ",t),t&&(console.log("cardImages: ",R),R&&R.length>0?null==R||R.forEach(((e,o)=>{var l;t.components[1].cards[o].components[0].example.header_handle=[null!==(l=R[o])&&void 0!==l?l:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,o)=>{t.components[1].cards[o].components[0].example.header_handle=[""]})),null==L||L(t),console.log("cardImages22 selectedTemplate: ",t)),null==W||W([]),null==_||_()}}),F&&(null==F?void 0:F.length)>0&&"variable"!=F[0].name&&t(s,{disabled:(null!==(S=null==F?void 0:F.length)&&void 0!==S?S:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{J(!0),G(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!$&&E&&0===(null==F?void 0:F.length)&&null!=V&&V>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(m,{children:"Product(s)"}),t(p,{children:`Select ${null!=M?M:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:D?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:D?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(l,{width:18,height:18,color:d.content.secondary})})),onClick:e=>{G(!0)}}),B===y.CHATBOT&&e(o,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(u,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:D?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:D?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(l,{width:18,height:18,color:d.content.secondary})})),onClick:e=>{Q(!0)}})]})]}))]}),t(f,{whatsappSpecificPickerMeta:x,template:I,onTemplateChange:e=>{null==L||L(e)},showVariableModal:w,variableList:C,variableListForImage:O,discountCode:P,setDiscountCode:T}),N&&A&&t(h,{zIndex:200,startupScreen:H?g.RearrangeProducts:g.Collections,rearrangeEnabled:!0,storeId:A.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const o of e){const e=null==o?void 0:o.collectionId,l=o.productId,i=o.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),l in t[e].products||(t[e].products[l]={variants:{},name:(null==o?void 0:o.productName)||"",image:(null==o?void 0:o.productImage)||""}),t[e].products[l].variants[i]={name:(null==o?void 0:o.name)||"",price:"",image:(null==o?void 0:o.image)||"",quantity:o.quantity||0,displayOrder:o.displayOrder}}return t}return{}})(null!=F?F:[]),collectionFetcher:A.fetchCollections,productFetcher:A.fetchProducts,onAdd:(e,t)=>{var o;J(!1);const l=[];delete e.isCustom;for(const t of Object.keys(e)){const i=e[t].products;if(void 0!==i&&Object.keys(i).length)for(const e of Object.keys(i)){const a=i[e].variants;if(void 0!==a&&Object.keys(a).length)for(const r of Object.keys(a)){const{name:n,image:s,quantity:d,displayOrder:c}=a[r],m={name:n,image:null!==(o=null!=s?s:i[e].image)&&void 0!==o?o:"",quantity:d,variantId:r,productId:e,displayOrder:c,collectionId:t,productName:i[e].name,productImage:i[e].image};l.push(m)}}}const a=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),r=l.map((e=>e.image)),n=i(Object.assign({},I));n&&(r.forEach(((e,t)=>{var o;n.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==R?void 0:R[t])&&void 0!==o?o:""]})),null==L||L(n)),null==W||W(a),G(!1)},searchInCollectionFetcher:A.searchInCollection,searchFetcher:A.searchProducts,visible:N,onClose:()=>{G(!1)},exactLimit:null!=M?M:1}),K&&t(n,{zIndex:2e3,data:null!=C?C:[],showVariable:K,setShowVariable:Q,placeholder:"Add a variable",customTrigger:e=>{null==W||W([{name:"variable",productName:e.actualValue}])}})]})};export{j as default};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import l from"../../../assets/icons/arrow_back.svg.js";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as a}from"lodash";import{useState as r,useEffect as n}from"react";import{AddVariableV2SideModal as s}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import{Button as d}from"../../button/Button.js";import{IconButton as c}from"../../icon-button/IconButton.js";import"../../input/Input.js";import"../../tooltips/Tooltip.js";import{COLORS as m}from"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleMedium as p,TitleRegular as u,BodySecondary as h,BodyCaption as g}from"../../TypographyStyle.js";import{ProductPickerModal as v,ScreenName as f}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import y from"./EditWhatsAppTemplateV2.js";import{ProductBox as j}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../curtain/CurtainHelper.js";import"../../template-preview/models/TemplateMeta.js";import{POD as I}from"../../template-preview/models/WhatsAppTemplate.js";const x=x=>{let{template:w,whatsappSpecificPickerMeta:C,showVariableModal:O,variableList:P,variableListForImage:T,discountCode:k,setDiscountCode:S}=x;var V,L;const{selectedCarouselIndex:A,setTemplate:E,pickerConf:B,isProductCarouselType:M,pod:F,cardCount:W,carouselProducts:D,setCarouselProducts:R,isError:_,cardImages:$,disableEditVariable:q,onDeleteSelectedProducts:z,setSelectedCarouselIndex:N}=b(),[G,H]=r(-1==A?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[J,K]=r(!1),[Q,U]=r(!1),[X,Y]=r(!1);n((()=>{H(-1==A?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[A]);return e("div",{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=A&&A>=0&&t(c,{Icon:l,onClick:()=>{null==N||N(-1)}}),t(p,Object.assign({style:{marginLeft:10}},{children:G}))]})),M&&(null!==(V=null==D?void 0:D.length)&&void 0!==V?V:0)>0&&null!=A&&A>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(j,{editItem:()=>{1===(null==D?void 0:D.length)&&"variable"===D[0].name?Y(!0):K(!J)},cardBody:1===(null==D?void 0:D.length)&&"variable"===D[0].name?`${D[0].productName}`:`${null==D?void 0:D.length} Products Selected`,hideIcon:1===(null==D?void 0:D.length)&&"variable"===D[0].name,deleteItem:()=>{var e;if(1===(null==D?void 0:D.length)&&"variable"===D[0].name)return void(null==R||R([]));const t=a(Object.assign({},w));console.log("cardImages selectedTemplate: ",t),t&&(console.log("cardImages: ",$),$&&$.length>0?null==$||$.forEach(((e,o)=>{var l;t.components[1].cards[o].components[0].example.header_handle=[null!==(l=$[o])&&void 0!==l?l:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,o)=>{t.components[1].cards[o].components[0].example.header_handle=[""]})),null==E||E(t),console.log("cardImages22 selectedTemplate: ",t)),null==R||R([]),null==z||z()}}),D&&(null==D?void 0:D.length)>0&&"variable"!=D[0].name&&t(d,{disabled:(null!==(L=null==D?void 0:D.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{U(!0),K(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!q&&M&&0===(null==D?void 0:D.length)&&null!=A&&A>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(u,{children:"Product(s)"}),t(h,{children:`Select ${null!=W?W:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(d,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${m.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(i,{width:18,height:18,color:m.content.secondary})})),onClick:e=>{K(!0)}}),F===I.CHATBOT&&e(o,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(g,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(d,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${m.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(i,{width:18,height:18,color:m.content.secondary})})),onClick:e=>{Y(!0)}})]})]}))]}),t(y,{whatsappSpecificPickerMeta:C,template:w,onTemplateChange:e=>{null==E||E(e)},showVariableModal:O,variableList:P,variableListForImage:T,discountCode:k,setDiscountCode:S}),J&&B&&t(v,{zIndex:200,startupScreen:Q?f.RearrangeProducts:f.Collections,rearrangeEnabled:!0,storeId:B.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const o of e){const e=null==o?void 0:o.collectionId,l=o.productId,i=o.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),l in t[e].products||(t[e].products[l]={variants:{},name:(null==o?void 0:o.productName)||"",image:(null==o?void 0:o.productImage)||""}),t[e].products[l].variants[i]={name:(null==o?void 0:o.name)||"",price:"",image:(null==o?void 0:o.image)||"",quantity:o.quantity||0,displayOrder:o.displayOrder}}return t}return{}})(null!=D?D:[]),collectionFetcher:B.fetchCollections,productFetcher:B.fetchProducts,onAdd:(e,t)=>{var o;U(!1);const l=[];delete e.isCustom;for(const t of Object.keys(e)){const i=e[t].products;if(void 0!==i&&Object.keys(i).length)for(const e of Object.keys(i)){const a=i[e].variants;if(void 0!==a&&Object.keys(a).length)for(const r of Object.keys(a)){const{name:n,image:s,quantity:d,displayOrder:c}=a[r],m={name:n,image:null!==(o=null!=s?s:i[e].image)&&void 0!==o?o:"",quantity:d,variantId:r,productId:e,displayOrder:c,collectionId:t,productName:i[e].name,productImage:i[e].image};l.push(m)}}}const i=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),r=l.map((e=>e.image)),n=a(Object.assign({},w));n&&(r.forEach(((e,t)=>{var o;n.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==$?void 0:$[t])&&void 0!==o?o:""]})),null==E||E(n)),null==R||R(i),K(!1)},searchInCollectionFetcher:B.searchInCollection,searchFetcher:B.searchProducts,visible:J,onClose:()=>{K(!1)},exactLimit:null!=W?W:1}),X&&t(s,{zIndex:2e3,data:null!=P?P:[],showVariable:X,setShowVariable:Y,placeholder:"Add a variable",customTrigger:e=>{null==R||R([{name:"variable",productName:e.actualValue}])}})]})};export{x as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.466-beta.3",
3
+ "version": "0.0.466-beta.5",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",