@bikdotai/bik-component-library 0.0.466-beta.10 → 0.0.466-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/cjs/assets/{bundle-0deb4a74.css → bundle-2fc1db34.css} +5 -0
  2. package/dist/cjs/components/carousel-preview/CarouselPreview.d.ts +1 -1
  3. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  4. package/dist/cjs/components/carousel-preview/CarouselPreview.style.d.ts +0 -1
  5. package/dist/cjs/components/carousel-preview/CarouselPreview.style.js +1 -6
  6. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.d.ts +1 -1
  7. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  8. package/dist/cjs/components/template-context-mapper/Badge/index.d.ts +1 -4
  9. package/dist/cjs/components/template-context-mapper/Badge/index.js +3 -3
  10. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  11. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +4 -5
  12. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.style.js +5 -6
  13. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  14. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  15. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +3 -2
  16. package/dist/esm/assets/{bundle-0deb4a74.css → bundle-2fc1db34.css} +5 -0
  17. package/dist/esm/components/carousel-preview/CarouselPreview.d.ts +1 -1
  18. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  19. package/dist/esm/components/carousel-preview/CarouselPreview.style.d.ts +0 -1
  20. package/dist/esm/components/carousel-preview/CarouselPreview.style.js +1 -6
  21. package/dist/esm/components/carousel-preview/CarouselPreviewCard.d.ts +1 -1
  22. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  23. package/dist/esm/components/template-context-mapper/Badge/index.d.ts +1 -4
  24. package/dist/esm/components/template-context-mapper/Badge/index.js +3 -3
  25. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  26. package/dist/esm/components/template-context-mapper/modalElements/Body.js +5 -6
  27. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.style.js +3 -4
  28. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  29. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  30. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +1 -0
  31. package/package.json +1 -1
@@ -1,5 +1,10 @@
1
1
  .buttonBack___1mlaL,.buttonFirst___2rhFr,.buttonLast___2yuh0,.buttonNext___2mOCa,.buttonNext___3Lm3s,.dot___3c3SI{cursor:pointer}.image___xtQGH{display:block;width:100%;height:100%}.spinner___27VUp{position:absolute;top:calc(50% - 15px);left:calc(50% - 15px);width:30px;height:30px;animation-name:spin___S3UuE;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite;border:4px solid #a9a9a9;border-top-color:#000;border-radius:30px}@keyframes spin___S3UuE{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.container___2O72F{position:relative;overflow:hidden;height:100%;width:100%}.overlay___IV4qY{position:absolute;top:0;left:0;bottom:0;right:0;opacity:0;cursor:zoom-in;transition:opacity .3s,transform .3s}.hover___MYy31,.loading___1pvNI,.zoom___3kqYk{opacity:1}.imageLoadingSpinnerContainer___3UIPD{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}.slide___3-Nqo{position:relative;display:block;box-sizing:border-box;height:0;margin:0;list-style-type:none}.slide___3-Nqo:focus{outline:none!important}.slideHorizontal___1NzNV{float:left}[dir=rtl] .slideHorizontal___1NzNV{direction:rtl;transform:scaleX(-1)}.slideInner___2mfX9{position:absolute;top:0;left:0;width:100%;height:100%}.focusRing___1airF{position:absolute;top:5px;right:5px;bottom:5px;left:5px;pointer-events:none;outline-width:5px;outline-style:solid;outline-color:Highlight}@media (-webkit-min-device-pixel-ratio:0){.focusRing___1airF{outline-style:auto;outline-color:-webkit-focus-ring-color}}.horizontalSlider___281Ls{position:relative;overflow:hidden;touch-action:pan-y pinch-zoom}[dir=rtl] .horizontalSlider___281Ls{direction:ltr;transform:scaleX(-1)}.horizontalSliderTray___1L-0W{overflow:hidden;width:100%}.verticalSlider___34ZFD{position:relative;overflow:hidden}.verticalSliderTray___267D8{overflow:hidden}.verticalTray___12Key{float:left}.verticalSlideTrayWrap___2nO7o{overflow:hidden}.sliderTray___-vHFQ{display:block;list-style:none;padding:0;margin:0}.sliderAnimation___300FY{transition:transform .5s;transition-timing-function:cubic-bezier(.645,.045,.355,1);will-change:transform}.masterSpinnerContainer___1Z6hB{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}
2
2
  /*# sourceMappingURL=react-carousel.es.css.map */
3
+ .carousel__slide-focus-ring {
4
+ display: none !important;
5
+ outline-width: 0 !important;
6
+ }
7
+
3
8
  .ReactCrop{position:relative;display:inline-block;cursor:crosshair;overflow:hidden;max-width:100%}.ReactCrop *,.ReactCrop *:before,.ReactCrop *:after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{display:block;max-width:100%;max-height:inherit}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>video{touch-action:none}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-selection{position:absolute;top:0;left:0;transform:translateZ(0);cursor:move;box-shadow:0 0 0 9999em #00000080}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--no-animate .ReactCrop__crop-selection{outline:1px dashed white}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection){animation:marching-ants 1s;background-image:linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%);background-size:10px 1px,10px 1px,1px 10px,1px 10px;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;color:#fff;animation-play-state:running;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop__crop-selection:focus{outline:none;border-color:#00f;border-style:solid}.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";display:block;position:absolute;background-color:#fff6}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333%;left:33.3333333333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6666%;left:66.6666666667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333%;top:33.3333333333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6666%;top:66.6666666667%}.ReactCrop__drag-handle{position:absolute}.ReactCrop__drag-handle:after{position:absolute;content:"";display:block;width:10px;height:10px;background-color:#0003;border:1px solid rgba(255,255,255,.7);outline:1px solid transparent}.ReactCrop__drag-handle:focus:after{border-color:#00f;background:#2dbfff}.ReactCrop .ord-nw{top:0;left:0;margin-top:-5px;margin-left:-5px;cursor:nw-resize}.ReactCrop .ord-nw:after{top:0;left:0}.ReactCrop .ord-n{top:0;left:50%;margin-top:-5px;margin-left:-5px;cursor:n-resize}.ReactCrop .ord-n:after{top:0}.ReactCrop .ord-ne{top:0;right:0;margin-top:-5px;margin-right:-5px;cursor:ne-resize}.ReactCrop .ord-ne:after{top:0;right:0}.ReactCrop .ord-e{top:50%;right:0;margin-top:-5px;margin-right:-5px;cursor:e-resize}.ReactCrop .ord-e:after{right:0}.ReactCrop .ord-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px;cursor:se-resize}.ReactCrop .ord-se:after{bottom:0;right:0}.ReactCrop .ord-s{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px;cursor:s-resize}.ReactCrop .ord-s:after{bottom:0}.ReactCrop .ord-sw{bottom:0;left:0;margin-bottom:-5px;margin-left:-5px;cursor:sw-resize}.ReactCrop .ord-sw:after{bottom:0;left:0}.ReactCrop .ord-w{top:50%;left:0;margin-top:-5px;margin-left:-5px;cursor:w-resize}.ReactCrop .ord-w:after{left:0}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{top:0;left:0;width:100%;height:6px;margin-top:-3px}.ReactCrop__drag-bar.ord-e{right:0;top:0;width:6px;height:100%;margin-right:-3px}.ReactCrop__drag-bar.ord-s{bottom:0;left:0;width:100%;height:6px;margin-bottom:-3px}.ReactCrop__drag-bar.ord-w{top:0;left:0;width:6px;height:100%;margin-left:-3px}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer: coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:24px;height:24px}}
4
9
 
5
10
  @charset "UTF-8";/*!
@@ -5,10 +5,10 @@ import { EmailTemplateType } from "../template-preview/models/EmailTemplate";
5
5
  import { SMSTemplateType } from "../template-preview/models/SmsTemplate";
6
6
  import { WhatsAppCarouselTemplate } from "../template-preview/models/WhatsappCarouselTemplate";
7
7
  import { WhatsAppTemplate } from "../template-preview/models/WhatsAppTemplate";
8
+ import './global.css';
8
9
  export declare const CarouselPreview: React.ForwardRefExoticComponent<{
9
10
  channel: CHANNEL_TYPE;
10
11
  template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
11
12
  showSampleValues?: boolean | undefined;
12
13
  isPreview?: boolean | undefined;
13
- removeBottomBorder?: boolean | undefined;
14
14
  } & 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"),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
+ "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,6 +1,5 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
2
2
  showHeader?: boolean | undefined;
3
- removeBottomBorder?: boolean | undefined;
4
3
  }, never>;
5
4
  export declare const CarouselContainer: import("styled-components").StyledComponent<"div", any, {
6
5
  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: ${e=>e.removeBottomBorder?"unset":"solid"};
5
+ border-bottom-style: solid;
6
6
  border-top-width: 1px;
7
7
  border-bottom-width: 1px;
8
8
  background-repeat: no-repeat;
@@ -49,9 +49,4 @@
49
49
  width: 100%;
50
50
  height: ${e=>e.height};
51
51
  }
52
-
53
- .carousel__slide-focus-ring {
54
- display: none !important;
55
- outline-width: 0 !important;
56
- }
57
52
  `;exports.CarouselContainer=n,exports.Container=i;
@@ -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
- currentTemplate: any;
5
+ template: 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 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
+ "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,8 +1,5 @@
1
- export declare const BadgeContainer: import("styled-components").StyledComponent<"div", any, {
2
- padding?: string | undefined;
3
- }, never>;
1
+ export declare const BadgeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
2
  export interface BadgeProps {
5
3
  errorText: string;
6
- padding?: string;
7
4
  }
8
5
  export declare const Badge: (props: BadgeProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/alert.svg.js"),r=require("styled-components"),n=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=a(r).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/alert.svg.js"),t=require("styled-components"),n=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=o(t).default.div`
2
2
  background: ${i.COLORS.background.negative.light};
3
3
  display: flex;
4
4
  align-items: center;
5
- padding: ${e=>e.padding?"8px":"0px"} 12px;
5
+ padding: 0px 12px;
6
6
  gap: 8px;
7
7
  border-radius: 4px;
8
8
  margin-right: 12px;
9
9
  color: ${i.COLORS.content.negative};
10
- `;exports.Badge=r=>{const{errorText:a,padding:d}=r;return e.jsxs(s,Object.assign({padding:d},{children:[e.jsx(t.default,{height:20,width:20,color:i.COLORS.content.negative}),e.jsx(n.BodySecondary,{children:a})]}))},exports.BadgeContainer=s;
10
+ `;exports.Badge=t=>{const{errorText:o}=t;return e.jsxs(s,{children:[e.jsx(r.default,{height:20,width:20,color:i.COLORS.content.negative}),e.jsx(n.BodySecondary,{children:o})]})},exports.BadgeContainer=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),o=require("../modals/styledModal.js"),a=require("../template-preview/models/Channels.js"),r=require("./context/templateModalContext.js"),s=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:v,htmlContent:h,templateVariables:m,onTemplateSelect:C,globalPlaceholders:E,showOnlyContent:S,whatsappSpecificPickerMeta:x,zIndex:b,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,onBackPress:j,enabledCustomText:M,variableListForImage:I,showSampleValues:L,disableEditVariable:y,pod:A,extras:w,pickerConf:N,selectedCarouselProducts:V,disableEditExpiry:D,cardWidth:k,onDeleteSelectedProducts:q}=d;var H,_,O,W,F,Y;l.useEffect((()=>{G(h)}),[h]);const B=v===a.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(_=null===(H=null==u?void 0:u.components)||void 0===H?void 0:H[1])||void 0===_?void 0:_.type),z=null==u?void 0:u.isProductCarouselType,[R,U]=l.useState(v===a.CHANNEL_TYPE.EMAIL||B?"desktop":"mobile"),[$,G]=l.useState(h),[J,K]=l.useState(!1),[Q,X]=l.useState([]),[Z,ee]=l.useState(u),[le,te]=l.useState([]),[oe,ae]=l.useState(!1),[re,se]=l.useState(null!=m?m:[]),[ie,ne]=l.useState(!1),[de,ue]=l.useState(-1),[ce,pe]=l.useState([]);l.useEffect((()=>{V?pe(V):z&&pe([])}),[V]),l.useEffect((()=>{var e;if(!oe&&z&&(!V||0===pe.length)){const l=null===(e=null==Z?void 0:Z.components)||void 0===e?void 0:e[1].cards,t=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,o,a;"HEADER"===e.type&&t.push(null!==(a=null===(o=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),te(t),ae(!0)}}),[oe]);const ve=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(E)),[E]);return e.jsx(r.TemplateModalContext.Provider,Object.assign({value:{template:Z,setTemplate:ee,device:R,setDevice:U,display_content:$,setDisplayContent:G,originalVariableList:re,setOriginalVariableList:se,isError:J,setIsError:K,channel:v,globalNormalizedPlaceholders:ve,templateSelectionTriggered:ie,setTemplateSelectionTriggered:ne,enabledCustomText:M,disableEditVariable:y,pod:A,extras:w,isWhatsappCarousel:B,selectedCarouselIndex:de,setSelectedCarouselIndex:ue,isProductCarouselType:z,cardCount:B?null===(W=null===(O=u.components)||void 0===O?void 0:O[1].cards)||void 0===W?void 0:W.length:void 0,errorIndexes:Q,setErrorIndexes:X,pickerConf:N,carouselProducts:ce,setCarouselProducts:pe,disableEditExpiry:D,cardWidth:k,cardImages:le,onDeleteSelectedProducts:q}},{children:S?e.jsx(i.default,{channel:a.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(o.StyledModal,Object.assign({zIndex:b,centralContainerStyles:{width:B?900:v===a.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==Z?void 0:Z.label,headingSubtitle:v===a.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(F=null==Z?void 0:Z.category)&&void 0!==F?F:"")} • ${null!==(Y=null==Z?void 0:Z.templateCategory)&&void 0!==Y?Y:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e.jsx(i.default,{showSampleValues:L,showVariableMapping:p,channel:v,whatsappSpecificPickerMeta:x,showVariableModal:g,variableList:P,discountCode:T,setDiscountCode:f,variableListForImage:I&&(null==I?void 0:I.length)>0?I:P}),C?e.jsx(s.default,{isWhatsappCarousel:null!=B&&B,onSelect:function(){if((null==ce?void 0:ce.length)<1&&z)return void K(!0);const e=null==C?void 0:C(Z,re,null!=$?$:"",ce);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&X(e.errorIndexes),(null==e?void 0:e.error)&&K(!!(null==e?void 0:e.error))):ne(!0)}}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),o=require("../modals/styledModal.js"),a=require("../template-preview/models/Channels.js"),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,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("styled-components"),l=require("../../carousel-preview/CarouselPreview.js"),o=require("./EditWhatsAppCarouselTemplateV2.js"),i=require("../../template-preview/models/Channels.js"),s=require("../../../constants/Theme.js"),r=require("../context/templateModalContext.js"),n=require("../utils/getVariableNameEmail.js"),u=require("../utils/highlightFor.js"),d=require("./DesktopPreview.js"),p=require("./EditWhatsAppTemplateV2.js"),c=require("./MobilePreview.js"),h=require("./VariableConnectorsPanel.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=m(a);const C=v.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("styled-components"),l=require("../../carousel-preview/CarouselPreview.js"),o=require("./EditWhatsAppCarouselTemplateV2.js"),i=require("../../template-preview/models/Channels.js"),s=require("../../../constants/Theme.js"),n=require("../context/templateModalContext.js"),r=require("../utils/getVariableNameEmail.js"),u=require("../utils/highlightFor.js"),d=require("./DesktopPreview.js"),p=require("./EditWhatsAppTemplateV2.js"),c=require("./MobilePreview.js"),h=require("./VariableConnectorsPanel.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=m(a);const v=f.default.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
- `,f=v.default.div`
4
+ `,C=f.default.div`
5
5
  padding: 16px 14px;
6
6
  max-width: 450px;
7
7
 
@@ -9,10 +9,9 @@
9
9
  overflow-y: auto;
10
10
  padding-bottom: 24px;
11
11
  border-left: ${s.COLORS.stroke.primary} 1px solid;
12
- border-top: ${e=>e.isWhatsappCarousel?`${s.COLORS.stroke.primary} 1px solid`:void 0};
13
- `,x=v.default.div`
12
+ `,x=f.default.div`
14
13
  padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
15
14
  flex: 1;
16
15
  height: ${e=>e.isWhatsappCarousel?"500px":"475px"};
17
16
  overflow-y: auto;
18
- `;exports.default=a=>{const{showVariableMapping:m,showOnlyContent:v,whatsappSpecificPickerMeta:g,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j,variableListForImage:E,showSampleValues:L}=a,T=t.useRef(),A=t.useRef(),{device:y,display_content:S,channel:M,template:N,setTemplate:_,isWhatsappCarousel:V,isProductCarouselType:W}=r.useTemplateModalContext();const q=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(C,{children:[e.jsx(x,Object.assign({showOnlyContent:v,showVariableMapping:m,isWhatsappCarousel:V},{children:"mobile"===y?e.jsx(c.default,{ref:A,display_content:null!=S?S:"",channel:M,template:N,showSampleValues:L}):M===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(l.CarouselPreview,{ref:T,channel:M,template:N,showSampleValues:L,isPreview:!1}):M!==i.CHANNEL_TYPE.MESSAGE?e.jsx(d.default,{ref:T,channel:M,display_content:null!=S?S:"",showSampleValues:L}):e.jsx(e.Fragment,{})})),(W||m)&&e.jsx(f,Object.assign({channel:M,isWhatsappCarousel:V},{children:M!==i.CHANNEL_TYPE.WHATSAPP?e.jsx(h.default,{onFocus:M===i.CHANNEL_TYPE.EMAIL?function(e){var t,a,l;const o=null===document||void 0===document?void 0:document.getElementById("mobile"===y?"template_html_mobile":"template_html_desktop"),r=n.getVariableNameForEmailByIndex(e+1),d=M===i.CHANNEL_TYPE.EMAIL?null===(t=null==o?void 0:o.contentWindow)||void 0===t?void 0:t.document.getElementById(r):document.getElementById(r),p=q(d),c=null==d?void 0:d.offsetLeft;"desktop"===y?p&&T.current&&(null===(a=null==o?void 0:o.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,M,y)):p&&A.current&&(null===(l=null==o?void 0:o.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),u.highlightFor(r,s.COLORS.background.warning.light,2,M,y))}:void 0,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j}):M===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(o.default,{whatsappSpecificPickerMeta:g,template:N,showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j}):e.jsx(p.default,{whatsappSpecificPickerMeta:g,template:N,onTemplateChange:e=>{null==_||_(e)},showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j})}))]})};
17
+ `;exports.default=a=>{const{showVariableMapping:m,showOnlyContent:f,whatsappSpecificPickerMeta:g,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j,variableListForImage:E,showSampleValues:T}=a,A=t.useRef(),L=t.useRef(),{device:y,display_content:M,channel:N,template:S,setTemplate:_,isWhatsappCarousel:V,isProductCarouselType:q}=n.useTemplateModalContext();const W=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e.jsxs(v,{children:[e.jsx(x,Object.assign({showOnlyContent:f,showVariableMapping:m,isWhatsappCarousel:V},{children:"mobile"===y?e.jsx(c.default,{ref:L,display_content:null!=M?M:"",channel:N,template:S,showSampleValues:T}):N===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(l.CarouselPreview,{ref:A,channel:N,template:S,showSampleValues:T,isPreview:!1}):N!==i.CHANNEL_TYPE.MESSAGE?e.jsx(d.default,{ref:A,channel:N,display_content:null!=M?M:"",showSampleValues:T}):e.jsx(e.Fragment,{})})),(q||m)&&e.jsx(C,Object.assign({channel:N},{children:N!==i.CHANNEL_TYPE.WHATSAPP?e.jsx(h.default,{onFocus:N===i.CHANNEL_TYPE.EMAIL?function(e){var t,a,l;const o=null===document||void 0===document?void 0:document.getElementById("mobile"===y?"template_html_mobile":"template_html_desktop"),n=r.getVariableNameForEmailByIndex(e+1),d=N===i.CHANNEL_TYPE.EMAIL?null===(t=null==o?void 0:o.contentWindow)||void 0===t?void 0:t.document.getElementById(n):document.getElementById(n),p=W(d),c=null==d?void 0:d.offsetLeft;"desktop"===y?p&&A.current&&(null===(a=null==o?void 0:o.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),u.highlightFor(n,s.COLORS.background.warning.light,2,N,y)):p&&L.current&&(null===(l=null==o?void 0:o.contentWindow)||void 0===l||l.scrollTo(null!=c?c:0,p),u.highlightFor(n,s.COLORS.background.warning.light,2,N,y))}:void 0,showVariableModal:w,variableList:b,discountCode:P,setDiscountCode:j}):N===i.CHANNEL_TYPE.WHATSAPP&&V?e.jsx(o.default,{whatsappSpecificPickerMeta:g,template:S,showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j}):e.jsx(p.default,{whatsappSpecificPickerMeta:g,template:S,onTemplateChange:e=>{null==_||_(e)},showVariableModal:w,variableList:b,variableListForImage:E,discountCode:P,setDiscountCode:j})}))]})};
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);const i=o.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=r(e);const o=i.default.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: 12px;
5
5
  /* justify-content: center; */
6
6
  flex: 1;
7
- `,n=o.default.div`
7
+ `,n=i.default.div`
8
8
  width: 56px;
9
9
  height: 56px;
10
10
  display: flex;
@@ -16,7 +16,7 @@
16
16
  border: 1px solid ${t.COLORS.stroke.primary};
17
17
  box-sizing: content-box;
18
18
  cursor: ${e=>e.error?"pointer":"default"};
19
- `,d=o.default.div`
19
+ `,d=i.default.div`
20
20
  padding: 8px;
21
21
  flex-direction: row;
22
22
  display: flex;
@@ -25,8 +25,7 @@
25
25
  border: 1px solid ${t.COLORS.stroke.primary};
26
26
  border-radius: 4px;
27
27
  margin-left: 8px;
28
- `,a=o.default.div`
28
+ `,a=i.default.div`
29
29
  padding-bottom: 0px;
30
30
  min-width: 285px;
31
- margin-bottom: 16px;
32
- `;exports.Container=d,exports.EditTemplateMediaContainer=a,exports.ImageContainer=n,exports.RightComponent=i;
31
+ `;exports.Container=d,exports.EditTemplateMediaContainer=a,exports.ImageContainer=n,exports.RightComponent=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),r=require("../../../assets/icons/PlusIcon.js"),a=require("lodash"),l=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("../Badge/index.js"),p=require("../context/templateModalContext.js"),m=require("./EditWhatsAppTemplateV2.js"),h=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 g=require("../../template-preview/models/WhatsAppTemplate.js");exports.default=v=>{let{template:j,whatsappSpecificPickerMeta:x,showVariableModal:y,variableList:b,variableListForImage:f,discountCode:C,setDiscountCode:I}=v;var O,q;const{selectedCarouselIndex:S,setTemplate:w,pickerConf:P,isProductCarouselType:T,pod:k,cardCount:B,carouselProducts:L,setCarouselProducts:V,isError:A,cardImages:E,disableEditVariable:M,onDeleteSelectedProducts:R,setSelectedCarouselIndex:D}=p.useTemplateModalContext(),[F,W]=l.useState(-1==S?"First Message (Step 1/2)":T?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)"),[_,N]=l.useState(!1),[$,z]=l.useState(!1),[G,H]=l.useState(!1);l.useEffect((()=>{W(-1==S?"First Message (Step 1/2)":T?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)")}),[S]);return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=S&&S>=0&&e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{null==D||D(-1)}}),e.jsx(d.TitleMedium,Object.assign({style:{marginLeft:10}},{children:F}))]})),T&&(null!==(O=null==L?void 0:L.length)&&void 0!==O?O:0)>0&&null!=S&&S>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(h.ProductBox,{editItem:()=>{1===(null==L?void 0:L.length)&&"variable"===L[0].name?H(!0):N(!_)},cardBody:1===(null==L?void 0:L.length)&&"variable"===L[0].name?`${L[0].productName}`:`${null==L?void 0:L.length} Products Selected`,hideIcon:1===(null==L?void 0:L.length)&&"variable"===L[0].name,deleteItem:()=>{var e;if(1===(null==L?void 0:L.length)&&"variable"===L[0].name)return void(null==V||V([]));const t=a.cloneDeep(Object.assign({},j));console.log("cardImages selectedTemplate: ",t),t&&(console.log("cardImages: ",E),E&&E.length>0?null==E||E.forEach(((e,r)=>{var a;t.components[1].cards[r].components[0].example.header_handle=[null!==(a=E[r])&&void 0!==a?a:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):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=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==w||w(t),console.log("cardImages22 selectedTemplate: ",t)),null==V||V([]),null==R||R()}}),L&&(null==L?void 0:L.length)>0&&"variable"!=L[0].name&&e.jsx(s.Button,{disabled:(null!==(q=null==L?void 0:L.length)&&void 0!==q?q:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{z(!0),N(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!M&&T&&0===(null==L?void 0:L.length)&&null!=S&&S>=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!=B?B:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:A?16:12,marginRight:A?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:A?`2px dashed ${n.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:A?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(r.default,{width:18,height:18,color:n.COLORS.content.secondary})})),onClick:e=>{N(!0)}}),k===g.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:A?`2px dashed ${n.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:A?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(r.default,{width:18,height:18,color:n.COLORS.content.secondary})})),onClick:e=>{H(!0)}})]})]})),A&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(u.Badge,{padding:"8px",errorText:"Please add products"})}))]}),e.jsx(m.default,{whatsappSpecificPickerMeta:x,template:j,onTemplateChange:e=>{null==w||w(e)},showVariableModal:y,variableList:b,variableListForImage:f,discountCode:C,setDiscountCode:I}),_&&P&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:$?c.ScreenName.RearrangeProducts:c.ScreenName.Collections,rearrangeEnabled:!0,storeId:P.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!=L?L:[]),collectionFetcher:P.fetchCollections,productFetcher:P.fetchProducts,onAdd:(e,t)=>{var r;z(!1);const l=[];delete e.isCustom;for(const t of Object.keys(e)){const a=e[t].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const i=a[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!==(r=null!=n?n:a[e].image)&&void 0!==r?r:"",quantity:d,variantId:s,productId:e,displayOrder:c,collectionId:t,productName:a[e].name,productImage:a[e].image};l.push(u)}}}const i=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),s=l.map((e=>e.image)),o=a.cloneDeep(Object.assign({},j));o&&(s.forEach(((e,t)=>{var r;o.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(r=null==E?void 0:E[t])&&void 0!==r?r:""]})),null==w||w(o)),null==V||V(i),N(!1)},searchInCollectionFetcher:P.searchInCollection,searchFetcher:P.searchProducts,visible:_,onClose:()=>{N(!1)},exactLimit:null!=B?B:1}),G&&e.jsx(i.AddVariableV2SideModal,{zIndex:2e3,data:null!=b?b:[],showVariable:G,setShowVariable:H,placeholder:"Add a variable",customTrigger:e=>{null==V||V([{name:"variable",productName:e.actualValue}])}})]})};
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 n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var s=require("../../TypographyStyle.js"),o=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:q,pickerConf:I,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));t&&(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==q||q(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 ${n.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:n.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 ${n.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:n.COLORS.content.secondary})})),onClick:e=>{N(!0)}})]})]}))]}),e.jsx(c.default,{whatsappSpecificPickerMeta:g,template:h,onTemplateChange:e=>{null==q||q(e)},showVariableModal:v,variableList:j,variableListForImage:x,discountCode:y,setDiscountCode:b}),R&&I&&e.jsx(o.ProductPickerModal,{zIndex:200,startupScreen:D?o.ScreenName.RearrangeProducts:o.ScreenName.Collections,rearrangeEnabled:!0,storeId:I.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:I.fetchCollections,productFetcher:I.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 n of Object.keys(i)){const{name:s,image:o,quantity:d,displayOrder:c}=i[n],u={name:s,image:null!==(a=null!=o?o:r[e].image)&&void 0!==a?a:"",quantity:d,variantId:n,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)),n=l.map((e=>e.image)),s=r.cloneDeep(Object.assign({},h));s&&(n.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==q||q(s)),null==L||L(i),F(!1)},searchInCollectionFetcher:I.searchInCollection,searchFetcher:I.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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("../../template-preview/models/WhatsAppTemplate.js"),i=require("../context/templateModalContext.js"),l=require("../utils/getDataFromTemplateComponent.js"),s=require("./BackTrackComponent.js"),a=require("./DiscountCodeComponent.js"),d=require("./EditMediaV2.style.js"),r=require("./EditWhatsAppTemplateMediaV2.js"),c=require("./VariableConnector.js"),u=require("./VariableConnectorsPanel.js"),p=require("./VariableConnectorWhatsApp.js"),v=require("./VariableEditorHeader.js"),m=require("./WhatsAppTemplateCardButtonV2.js");exports.default=b=>{let{template:g,onTemplateChange:j,whatsappSpecificPickerMeta:f,showVariableModal:O,variableList:C,variableListForImage:h,discountCode:T,setDiscountCode:x}=b;var y,B,V,E,k,L,U,D,q,I,w,R,P,A,M,S,_,N,H,Q,Y;const F=g.isCarouselType,{originalVariableList:K,pod:W,extras:$,selectedCarouselIndex:X,isProductCarouselType:z}=i.useTemplateModalContext(),{descriptionComponents:G,urlBtns:J,qrbBtns:Z,imageComponent:ee,bodyVariables:ne,headerVariables:te}=l.getAllDataFromTemplateComponent(g),[oe,ie]=t.useState(!1),[le,se]=t.useState(-1===X?{descriptionComponents:G,urlBtns:J,qrbBtns:Z,imageComponent:ee,bodyVariables:ne,headerVariables:te}:{}),[ae,de]=t.useState(!1);function re(e,t,o){var i,l,s,a,d,r,c,u,p,v;const m=null!=X&&X>-1?{components:null===(i=Object.assign({},g).components[1].cards)||void 0===i?void 0:i[X].components,mapping:null===(l=Object.assign({},g).mapping.cards)||void 0===l?void 0:l[X]}:Object.assign({},g),b=n.cloneDeep(m),f="custom"===t&&"string"==typeof e,O=f?e:"string"!=typeof e?e.defaultValue:"";if(null!=X&&X>-1&&z){const t=Object.assign({},g).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let s=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[O]});const a=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},e),{buttons:a})}return e}))})))}):e})),i=null===(a=null===(s=Object.assign({},g).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>f?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(g);return l.components=t,l.mapping.cards=i,void(null==j||j(Object.assign({},l)))}const C=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==C&&C>-1){const n=null===(d=null==b?void 0:b.components[C].buttons)||void 0===d?void 0:d.filter((e=>"URL"===e.type));if((null==n?void 0:n.length)>0){const i="custom"===t&&"string"==typeof e,l=i?e:"string"!=typeof e?e.defaultValue:"";let s=n[o];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(u=null===(c=null===(r=b.components)||void 0===r?void 0:r[C])||void 0===c?void 0:c.buttons)&&void 0!==u?u:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e)),d=Object.assign(Object.assign({},b.components[C]),{buttons:a}),v=null===(p=b.mapping)||void 0===p?void 0:p.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[C]=d,b.components=g}}if("string"!=typeof e){"checkout.checkoutUrl"===(null===(v=e.placeHolder)||void 0===v?void 0:v.slice(2,-2))?ie(!0):(ie(!1),null==x||x(""))}if(null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=b.components,e.mapping.cards[X]=b.mapping,null==j||j(Object.assign({},e))}else null==j||j(b)}function ce(e,t,o){var i,l,s,a,d,r;const c=null!=X&&X>-1?{components:null===(i=Object.assign({},g).components[1].cards)||void 0===i?void 0:i[X].components,mapping:null===(l=Object.assign({},g).mapping.cards)||void 0===l?void 0:l[X]}:Object.assign({},g);if(null!=X&&X>-1&&z){const t=Object.assign({},g).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const s=null===(t=n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let a=null!==(i=null==s?void 0:s[o])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(g);return i.components=t,void(null==j||j(Object.assign({},i)))}const u=null==c?void 0:c.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==u&&u>-1){const n=null===(s=null==c?void 0:c.components[u].buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(d=null===(a=c.components)||void 0===a?void 0:a[u])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},c.components[u]),{buttons:i}),s=[...c.components];s[u]=l,c.components=s}}if(null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=c.components,null==j||j(Object.assign({},e))}else null==j||j(c)}return t.useEffect((()=>{var e,n;if(null===(e=g.mapping.buttons)||void 0===e?void 0:e.find((e=>"checkout.checkoutUrl"===e.slice(2,-2))))ie(!0);else{ie(!1);const e=null===(n=null==$?void 0:$.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[g]),t.useEffect((()=>{var e,n,t,o;if(null!=X&&X>-1){const i={components:null===(n=null===(e=g.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[X].components,mapping:null===(o=null===(t=null==g?void 0:g.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[X]},{descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:u}=l.getAllDataFromTemplateComponent(i);se({descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:u})}else if(null!=X&&-1===X){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:s}=l.getAllDataFromTemplateComponent(g);se({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:s})}}),[X]),t.useEffect((()=>{var e,n,t,o;if(null!=X&&X>-1&&ae){const i={components:null===(n=null===(e=g.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[X].components,mapping:null===(o=null===(t=null==g?void 0:g.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[X]},{descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:u}=l.getAllDataFromTemplateComponent(i);se({descriptionComponents:s,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:u}),de(!1)}}),[ae]),console.log("templateComponentData: ",le),e.jsxs(u.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!le.imageComponent&&!z&&e.jsx(d.EditTemplateMediaContainer,{children:e.jsx(r.default,{whatsappSpecificPickerMeta:f,mediaComponent:F?le.imageComponent:ee,updateTemplateImageUrl:function(e,t){var o,i,l,s,a;let d;d=null!=X&&X>-1?{components:null===(i=null===(o=g.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[X].components,mapping:null===(s=null===(l=null==g?void 0:g.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[X]}:Object.assign({},g);const r=null===(a=null==d?void 0:d.components)||void 0===a?void 0:a.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==r&&r>-1&&(null==d?void 0:d.components[r])){const n=Object.assign(Object.assign({},d.components[r]),{format:t,example:{header_handle:[e]}}),o=[...d.components];o[r]=n,d=Object.assign(Object.assign({},d),{components:o})}if(d.mapping&&(d.mapping=Object.assign(Object.assign({},d.mapping),{header:void 0})),null!=X&&X>-1){const e=n.cloneDeep(g);e.components[1].cards[X].components=d.components,e.mapping.cards[X]=d.mapping,null==j||j(Object.assign({},e)),de(!0)}else null==j||j(Object.assign({},d))},template:g,variableListForImage:h})}),le.bodyVariables.length>0&&e.jsx(v.default,{containerStyle:{paddingTop:le.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(y=le.descriptionComponents)||void 0===y?void 0:y.map(((n,t)=>e.jsx(p.default,{originalVariableList:null!=X&&X>-1?K.cards[X]:K,type:n.type,descriptionComponent:n.component,showVariableModal:O,variableList:C},t))),(null===(V=null===(B=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===B?void 0:B.filter((e=>"URL"===e.type)))||void 0===V?void 0:V.length)>0&&e.jsx(v.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(k=null===(E=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===E?void 0:E.filter((e=>W===o.POD.CHATBOT||"URL"===e.type)))||void 0===k?void 0:k.map(((n,t)=>{if("URL"===n.type)return e.jsx(m.default,{variableListIndex:t,CTAoptions:null==f?void 0:f.CTAoptions,button:n,currentVariableList:null!=X&&X>-1?Object.assign({},K.cards[X]):Object.assign({},K),updateSelectedURLTemplateBtn:re,variableList:C},`${t}_${X}`)})),W===o.POD.CHATBOT&&(null===(U=null===(L=Z[0])||void 0===L?void 0:L.component)||void 0===U?void 0:U.buttons)&&(null===(I=null===(q=null===(D=Z[0])||void 0===D?void 0:D.component)||void 0===q?void 0:q.buttons)||void 0===I?void 0:I.length)>0&&e.jsx(s.BackTrackComponent,{backTrackMessage:null===(w=null==$?void 0:$.backTrackExtra)||void 0===w?void 0:w[0],setBackTrackMessage:null===(R=null==$?void 0:$.backTrackExtra)||void 0===R?void 0:R[1]}),(null===(A=null===(P=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===P?void 0:P.filter((e=>"QUICK_REPLY"===e.type)))||void 0===A?void 0:A.length)>0&&(W!==o.POD.CHATBOT?e.jsx(v.default,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):e.jsx(s.BackTrackComponent,{backTrackMessage:null===(M=null==$?void 0:$.backTrackExtra)||void 0===M?void 0:M[0],setBackTrackMessage:null===(S=null==$?void 0:$.backTrackExtra)||void 0===S?void 0:S[1]})),null===(N=null===(_=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===_?void 0:_.filter((e=>"QUICK_REPLY"===e.type)))||void 0===N?void 0:N.map(((n,t)=>{if("QUICK_REPLY"===n.type&&W!==o.POD.CHATBOT)return e.jsx(m.default,{variableListIndex:t,QRBoptions:null==f?void 0:f.QRBoptions,button:n,currentVariableList:null!=X&&X>-1?Object.assign({},K.cards[X]):Object.assign({},K),updateSelectedQRBTemplateBtn:ce},`${t}_${X}`)})),W===o.POD.CHATBOT&&oe&&e.jsx(a.DiscountCodeComponent,{discountCode:null===(H=null==$?void 0:$.discountCodeExtra)||void 0===H?void 0:H[0],setDiscountCode:null===(Q=null==$?void 0:$.discountCodeExtra)||void 0===Q?void 0:Q[1],variableList:C}),null===(Y=null!=X&&X>-1?K.cards[X].buttons:null==K?void 0:K.buttons)||void 0===Y?void 0:Y.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(c.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:C,componentType:"BUTTONS"},t)}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("lodash"),t=require("react"),o=require("../../template-preview/models/WhatsAppTemplate.js"),i=require("../context/templateModalContext.js"),l=require("../custom-hooks/useAdditionalVariables.js"),s=require("../utils/getDataFromTemplateComponent.js"),a=require("./BackTrackComponent.js"),d=require("./DiscountCodeComponent.js"),r=require("./EditMediaV2.style.js"),u=require("./EditWhatsAppTemplateMediaV2.js"),c=require("./VariableConnector.js"),p=require("./VariableConnectorsPanel.js"),v=require("./VariableConnectorWhatsApp.js"),m=require("./VariableEditorHeader.js"),b=require("./WhatsAppTemplateCardButtonV2.js");exports.default=g=>{let{template:j,onTemplateChange:f,whatsappSpecificPickerMeta:C,showVariableModal:O,variableList:h,variableListForImage:T,discountCode:x,setDiscountCode:y}=g;var V,B,E,k,L,D,U,q,I,w,A,R,P,M,S,N,_,H,Q,Y,F;const K=j.isCarouselType,{originalVariableList:W,pod:$,extras:X,selectedCarouselIndex:z,isProductCarouselType:G}=i.useTemplateModalContext(),{descriptionComponents:J,urlBtns:Z,qrbBtns:ee,imageComponent:ne,bodyVariables:te,headerVariables:oe}=s.getAllDataFromTemplateComponent(j),[ie,le]=t.useState(!1),[se,ae]=t.useState(-1===z?{descriptionComponents:J,urlBtns:Z,qrbBtns:ee,imageComponent:ne,bodyVariables:te,headerVariables:oe}:{}),[de,re]=t.useState(!1);function ue(e,t,o){var i,l,s,a,d,r,u,c,p,v;const m=null!=z&&z>-1?{components:null===(i=Object.assign({},j).components[1].cards)||void 0===i?void 0:i[z].components,mapping:null===(l=Object.assign({},j).mapping.cards)||void 0===l?void 0:l[z]}:Object.assign({},j),b=n.cloneDeep(m),g="custom"===t&&"string"==typeof e,C=g?e:"string"!=typeof e?e.defaultValue:"";if(null!=z&&z>-1&&G){const t=Object.assign({},j).components.map((e=>{var n;return"CAROUSEL"===e.type?Object.assign(Object.assign({},e),{cards:null===(n=e.cards)||void 0===n?void 0:n.map((e=>Object.assign(Object.assign({},e),{components:e.components.map((e=>{var n,t,i;if("BUTTONS"===e.type){const l=null===(n=e.buttons)||void 0===n?void 0:n.filter((e=>"URL"===e.type));let s=null!==(t=null==l?void 0:l[o])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[C]});const a=null===(i=e.buttons)||void 0===i?void 0:i.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e));return Object.assign(Object.assign({},e),{buttons:a})}return e}))})))}):e})),i=null===(a=null===(s=Object.assign({},j).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:""))})})),l=n.cloneDeep(j);return l.components=t,l.mapping.cards=i,void(null==f||f(Object.assign({},l)))}const O=null==b?void 0:b.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==O&&O>-1){const n=null===(d=null==b?void 0:b.components[O].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:"";let s=n[o];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(c=null===(u=null===(r=b.components)||void 0===r?void 0:r[O])||void 0===u?void 0:u.buttons)&&void 0!==c?c:[]].map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==s?void 0:s.text)?s:e)),d=Object.assign(Object.assign({},b.components[O]),{buttons:a}),v=null===(p=b.mapping)||void 0===p?void 0:p.buttons;v&&v.length>0&&(v[o]=i?"((customBtnPlaceholder))":"string"!=typeof e?e.placeHolder:"");const m=Object.assign(Object.assign({},b.mapping),{buttons:v});b.mapping=m;const g=[...b.components];g[O]=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==y||y(""))}if(null!=z&&z>-1){const e=n.cloneDeep(j);e.components[1].cards[z].components=b.components,e.mapping.cards[z]=b.mapping,null==f||f(Object.assign({},e))}else null==f||f(b)}function ce(e,t,o){var i,l,s,a,d,r;const u=null!=z&&z>-1?{components:null===(i=Object.assign({},j).components[1].cards)||void 0===i?void 0:i[z].components,mapping:null===(l=Object.assign({},j).mapping.cards)||void 0===l?void 0:l[z]}:Object.assign({},j);if(null!=z&&z>-1&&G){const t=Object.assign({},j).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const s=null===(t=n.buttons)||void 0===t?void 0:t.filter((e=>"QUICK_REPLY"===e.type));let a=null!==(i=null==s?void 0:s[o])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:e.flowId,flowName:e.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==a?void 0:a.text)?a:e));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=n.cloneDeep(j);return i.components=t,void(null==f||f(Object.assign({},i)))}const c=null==u?void 0:u.components.findIndex((e=>"BUTTONS"===e.type));if(void 0!==c&&c>-1){const n=null===(s=null==u?void 0:u.components[c].buttons)||void 0===s?void 0:s.filter((e=>"QUICK_REPLY"===e.type));if(n){let t=n[o];t=Object.assign(Object.assign({},t),{flowId:e.flowId,flowName:e.flowName});const i=[...null!==(r=null===(d=null===(a=u.components)||void 0===a?void 0:a[c])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),l=Object.assign(Object.assign({},u.components[c]),{buttons:i}),s=[...u.components];s[c]=l,u.components=s}}if(null!=z&&z>-1){const e=n.cloneDeep(j);e.components[1].cards[z].components=u.components,null==f||f(Object.assign({},e))}else null==f||f(u)}t.useEffect((()=>{var e,n;if(null===(e=j.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==X?void 0:X.discountCodeExtra)||void 0===n?void 0:n[1];null==e||e("")}}),[j]),t.useEffect((()=>{var e,n,t,o;if(null!=z&&z>-1){const i={components:null===(n=null===(e=j.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[z].components,mapping:null===(o=null===(t=null==j?void 0:j.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[z]},{descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}=s.getAllDataFromTemplateComponent(i);ae({descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c})}else if(null!=z&&-1===z){const{descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l}=s.getAllDataFromTemplateComponent(j);ae({descriptionComponents:e,urlBtns:n,qrbBtns:t,imageComponent:o,bodyVariables:i,headerVariables:l})}}),[z]),t.useEffect((()=>{var e,n,t,o;if(null!=z&&z>-1&&de){const i={components:null===(n=null===(e=j.components[1])||void 0===e?void 0:e.cards)||void 0===n?void 0:n[z].components,mapping:null===(o=null===(t=null==j?void 0:j.mapping)||void 0===t?void 0:t.cards)||void 0===o?void 0:o[z]},{descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}=s.getAllDataFromTemplateComponent(i);ae({descriptionComponents:l,urlBtns:a,qrbBtns:d,imageComponent:r,bodyVariables:u,headerVariables:c}),re(!1)}}),[de]);const pe=l.useAdditionalVariables({variableList:h,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});return console.log("templateComponentData: ",se),e.jsxs(p.Container,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!se.imageComponent&&!G&&e.jsx(r.EditTemplateMediaContainer,{children:e.jsx(u.default,{whatsappSpecificPickerMeta:C,mediaComponent:K?se.imageComponent:ne,updateTemplateImageUrl:function(e,t){var o,i,l,s,a;let d;d=null!=z&&z>-1?{components:null===(i=null===(o=j.components[1])||void 0===o?void 0:o.cards)||void 0===i?void 0:i[z].components,mapping:null===(s=null===(l=null==j?void 0:j.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[z]}:Object.assign({},j);const r=null===(a=null==d?void 0:d.components)||void 0===a?void 0:a.findIndex((e=>{if("HEADER"===e.type&&"NONE"!==e.format&&"TEXT"!==e.format)return!0}));if(void 0!==r&&r>-1&&(null==d?void 0:d.components[r])){const n=Object.assign(Object.assign({},d.components[r]),{format:t,example:{header_handle:[e]}}),o=[...d.components];o[r]=n,d=Object.assign(Object.assign({},d),{components:o})}if(d.mapping&&(d.mapping=Object.assign(Object.assign({},d.mapping),{header:void 0})),null!=z&&z>-1){const e=n.cloneDeep(j);e.components[1].cards[z].components=d.components,e.mapping.cards[z]=d.mapping,null==f||f(Object.assign({},e)),re(!0)}else null==f||f(Object.assign({},d))},template:j,variableListForImage:T})}),(se.bodyVariables.length>0||se.headerVariables.length>0)&&e.jsx(m.default,{containerStyle:{paddingTop:se.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===(V=se.descriptionComponents)||void 0===V?void 0:V.map(((n,t)=>e.jsx(v.default,{originalVariableList:null!=z&&z>-1?W.cards[z]:W,type:n.type,descriptionComponent:n.component,showVariableModal:O,variableList:pe},t))),(null===(E=null===(B=null!=z&&z>-1?W.cards[z].buttons:null==W?void 0:W.buttons)||void 0===B?void 0:B.filter((e=>"URL"===e.type)))||void 0===E?void 0:E.length)>0&&e.jsx(m.default,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(L=null===(k=null!=z&&z>-1?W.cards[z].buttons:null==W?void 0:W.buttons)||void 0===k?void 0:k.filter((e=>$===o.POD.CHATBOT||"URL"===e.type)))||void 0===L?void 0:L.map(((n,t)=>{if("URL"===n.type)return e.jsx(b.default,{variableListIndex:t,CTAoptions:null==C?void 0:C.CTAoptions,button:n,currentVariableList:null!=z&&z>-1?Object.assign({},W.cards[z]):Object.assign({},W),updateSelectedURLTemplateBtn:ue,variableList:h},`${t}_${z}`)})),$===o.POD.CHATBOT&&(null===(U=null===(D=ee[0])||void 0===D?void 0:D.component)||void 0===U?void 0:U.buttons)&&(null===(w=null===(I=null===(q=ee[0])||void 0===q?void 0:q.component)||void 0===I?void 0:I.buttons)||void 0===w?void 0:w.length)>0&&e.jsx(a.BackTrackComponent,{backTrackMessage:null===(A=null==X?void 0:X.backTrackExtra)||void 0===A?void 0:A[0],setBackTrackMessage:null===(R=null==X?void 0:X.backTrackExtra)||void 0===R?void 0:R[1]}),(null===(M=null===(P=null!=z&&z>-1?W.cards[z].buttons:null==W?void 0:W.buttons)||void 0===P?void 0:P.filter((e=>"QUICK_REPLY"===e.type)))||void 0===M?void 0:M.length)>0&&($!==o.POD.CHATBOT?e.jsx(m.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(a.BackTrackComponent,{backTrackMessage:null===(S=null==X?void 0:X.backTrackExtra)||void 0===S?void 0:S[0],setBackTrackMessage:null===(N=null==X?void 0:X.backTrackExtra)||void 0===N?void 0:N[1]})),null===(H=null===(_=null!=z&&z>-1?W.cards[z].buttons:null==W?void 0:W.buttons)||void 0===_?void 0:_.filter((e=>"QUICK_REPLY"===e.type)))||void 0===H?void 0:H.map(((n,t)=>{if("QUICK_REPLY"===n.type&&$!==o.POD.CHATBOT)return e.jsx(b.default,{variableListIndex:t,QRBoptions:null==C?void 0:C.QRBoptions,button:n,currentVariableList:null!=z&&z>-1?Object.assign({},W.cards[z]):Object.assign({},W),updateSelectedQRBTemplateBtn:ce},`${t}_${z}`)})),$===o.POD.CHATBOT&&ie&&e.jsx(d.DiscountCodeComponent,{discountCode:null===(Q=null==X?void 0:X.discountCodeExtra)||void 0===Q?void 0:Q[0],setDiscountCode:null===(Y=null==X?void 0:X.discountCodeExtra)||void 0===Y?void 0:Y[1],variableList:h}),null===(F=null!=z&&z>-1?W.cards[z].buttons:null==W?void 0:W.buttons)||void 0===F?void 0:F.map(((n,t)=>{var o,i,l;if("COPY_CODE"===n.type)return e.jsx(c.default,{index:t,variable:{variableName:null!==(o=n.text)&&void 0!==o?o:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:pe,componentType:"BUTTONS"},t)}))]}))};
@@ -1,4 +1,5 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../../assets/icons/info.svg.js"),t=require("react"),i=require("styled-components"),r=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js");var s=require("../../../assets/icons/plus.svg.js");require("../../add-variableV2/AddVariableV2.styled.js"),require("../../button/Button.js"),require("../../icon-button/IconButton.js");var l=require("../../input/Input.js"),n=require("../../tooltips/Tooltip.js"),o=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../checkBox/CheckBox.js"),u=require("../context/templateModalContext.js"),h=require("./VariableConnector.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(i);const p=b.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../../assets/icons/info.svg.js"),t=require("react"),i=require("styled-components"),r=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js");var s=require("../../../assets/icons/plus.svg.js");require("../../add-variableV2/AddVariableV2.styled.js"),require("../../button/Button.js"),require("../../icon-button/IconButton.js");var l=require("../../input/Input.js"),o=require("../../tooltips/Tooltip.js"),n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var d=require("../../TypographyStyle.js"),c=require("../../checkBox/CheckBox.js"),u=require("../context/templateModalContext.js"),h=require("./VariableConnector.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=x(i);const p=b.default.div`
2
+ overflow-y: auto;
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  height: 100%;
@@ -25,4 +26,4 @@
25
26
  align-items: center;
26
27
  gap: 5px;
27
28
  }
28
- `;exports.AddVariableStyled=j,exports.Container=p,exports.default=i=>{let{onFocus:x,showVariableModal:b,variableList:g,discountCode:f,setDiscountCode:v}=i;const{originalVariableList:y,disableEditVariable:m}=u.useTemplateModalContext(),[V,O]=t.useState(!1),[q,S]=t.useState(!1),[C,w]=t.useState(!1),[k,T]=t.useState(""),[B,L]=t.useState(!1),E=t.useRef(),A=t.useRef();return t.useEffect((()=>{v&&v(f+k)}),[k]),t.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(O(!0),f&&L&&L(!0))}))}),[y]),e.jsxs(p,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(d.TitleRegular,Object.assign({style:{color:o.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(n.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(a.default,{width:20,height:20,color:o.COLORS.content.placeholder})}))}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:o.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((a,t)=>!a.isEditableVariable||m?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:o.COLORS.content.primary}},{children:["Locked variable ",t+1]})),e.jsx(l.Input,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),t):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(h.default,{index:t,variable:a,onFocus:()=>null==x?void 0:x(t),showVariableModal:b,variableList:g,setShowDiscountCheckBox:O})}),t))),(V||f)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(c.CheckBox,{isChecked:B,onValueChange:()=>{B&&v&&v(""),L(!B)}}),e.jsx(d.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),B&&e.jsxs("div",Object.assign({ref:E,style:{margin:10}},{children:[e.jsx(l.Input,{placeholder:"Enter your discount code",onChangeText:e=>{v&&v(e)},value:f,onFocus:()=>{S(!0)},onBlur:e=>{var a;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)?(E.current&&E.current.focus(),S(!0)):(S(!1),w(!1))},noErrorHint:!0,validate:e=>[!0,""]}),q&&e.jsx(j,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),w(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),C&&e.jsx(r.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:C,setShowVariable:w,variableValue:k,setVariableValue:T,placeholder:"Add a variable",customTrigger:e=>{T(e.actualValue),S(!1)}})]})};
29
+ `;exports.AddVariableStyled=j,exports.Container=p,exports.default=i=>{let{onFocus:x,showVariableModal:b,variableList:g,discountCode:f,setDiscountCode:v}=i;const{originalVariableList:y,disableEditVariable:m}=u.useTemplateModalContext(),[V,O]=t.useState(!1),[q,S]=t.useState(!1),[w,C]=t.useState(!1),[k,T]=t.useState(""),[B,L]=t.useState(!1),E=t.useRef(),A=t.useRef();return t.useEffect((()=>{v&&v(f+k)}),[k]),t.useEffect((()=>{y.forEach((e=>{"checkout.checkoutUrl"===e.updatedValue.replace("{{","").replace("}}","")&&(O(!0),f&&L&&L(!0))}))}),[y]),e.jsxs(p,{children:[e.jsxs("div",Object.assign({style:{padding:8}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:8,alignItems:"center",marginBottom:4}},{children:[e.jsx(d.TitleRegular,Object.assign({style:{color:n.COLORS.content.primary}},{children:"Edit variables and links"})),e.jsx(o.Tooltip,Object.assign({body:"Variables are placeholder texts which can either be filled by data, eg: customer name or can have any custom text within them"},{children:e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(a.default,{width:20,height:20,color:n.COLORS.content.placeholder})}))}))]})),e.jsx(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.secondary}},{children:"You can view variables and links on the left underlined in purple colour."}))]})),null==y?void 0:y.map(((a,t)=>!a.isEditableVariable||m?e.jsxs("div",Object.assign({style:{margin:"16px 8px"}},{children:[e.jsxs(d.BodySecondary,Object.assign({style:{color:n.COLORS.content.primary}},{children:["Locked variable ",t+1]})),e.jsx(l.Input,{state:"disabled",placeholder:a.variableName,onChangeText:()=>{}})]}),t):e.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsx(h.default,{index:t,variable:a,onFocus:()=>null==x?void 0:x(t),showVariableModal:b,variableList:g,setShowDiscountCheckBox:O})}),t))),(V||f)&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(c.CheckBox,{isChecked:B,onValueChange:()=>{B&&v&&v(""),L(!B)}}),e.jsx(d.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),B&&e.jsxs("div",Object.assign({ref:E,style:{margin:10}},{children:[e.jsx(l.Input,{placeholder:"Enter your discount code",onChangeText:e=>{v&&v(e)},value:f,onFocus:()=>{S(!0)},onBlur:e=>{var a;"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)?(E.current&&E.current.focus(),S(!0)):(S(!1),C(!1))},noErrorHint:!0,validate:e=>[!0,""]}),q&&e.jsx(j,Object.assign({ref:A,id:"addVar",onClick:e=>{e.stopPropagation(),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:20,height:20,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]})),w&&e.jsx(r.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:w,setShowVariable:C,variableValue:k,setVariableValue:T,placeholder:"Add a variable",customTrigger:e=>{T(e.actualValue),S(!1)}})]})};
@@ -1,5 +1,10 @@
1
1
  .buttonBack___1mlaL,.buttonFirst___2rhFr,.buttonLast___2yuh0,.buttonNext___2mOCa,.buttonNext___3Lm3s,.dot___3c3SI{cursor:pointer}.image___xtQGH{display:block;width:100%;height:100%}.spinner___27VUp{position:absolute;top:calc(50% - 15px);left:calc(50% - 15px);width:30px;height:30px;animation-name:spin___S3UuE;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite;border:4px solid #a9a9a9;border-top-color:#000;border-radius:30px}@keyframes spin___S3UuE{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.container___2O72F{position:relative;overflow:hidden;height:100%;width:100%}.overlay___IV4qY{position:absolute;top:0;left:0;bottom:0;right:0;opacity:0;cursor:zoom-in;transition:opacity .3s,transform .3s}.hover___MYy31,.loading___1pvNI,.zoom___3kqYk{opacity:1}.imageLoadingSpinnerContainer___3UIPD{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}.slide___3-Nqo{position:relative;display:block;box-sizing:border-box;height:0;margin:0;list-style-type:none}.slide___3-Nqo:focus{outline:none!important}.slideHorizontal___1NzNV{float:left}[dir=rtl] .slideHorizontal___1NzNV{direction:rtl;transform:scaleX(-1)}.slideInner___2mfX9{position:absolute;top:0;left:0;width:100%;height:100%}.focusRing___1airF{position:absolute;top:5px;right:5px;bottom:5px;left:5px;pointer-events:none;outline-width:5px;outline-style:solid;outline-color:Highlight}@media (-webkit-min-device-pixel-ratio:0){.focusRing___1airF{outline-style:auto;outline-color:-webkit-focus-ring-color}}.horizontalSlider___281Ls{position:relative;overflow:hidden;touch-action:pan-y pinch-zoom}[dir=rtl] .horizontalSlider___281Ls{direction:ltr;transform:scaleX(-1)}.horizontalSliderTray___1L-0W{overflow:hidden;width:100%}.verticalSlider___34ZFD{position:relative;overflow:hidden}.verticalSliderTray___267D8{overflow:hidden}.verticalTray___12Key{float:left}.verticalSlideTrayWrap___2nO7o{overflow:hidden}.sliderTray___-vHFQ{display:block;list-style:none;padding:0;margin:0}.sliderAnimation___300FY{transition:transform .5s;transition-timing-function:cubic-bezier(.645,.045,.355,1);will-change:transform}.masterSpinnerContainer___1Z6hB{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#f4f4f4}
2
2
  /*# sourceMappingURL=react-carousel.es.css.map */
3
+ .carousel__slide-focus-ring {
4
+ display: none !important;
5
+ outline-width: 0 !important;
6
+ }
7
+
3
8
  .ReactCrop{position:relative;display:inline-block;cursor:crosshair;overflow:hidden;max-width:100%}.ReactCrop *,.ReactCrop *:before,.ReactCrop *:after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{display:block;max-width:100%;max-height:inherit}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>video{touch-action:none}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-selection{position:absolute;top:0;left:0;transform:translateZ(0);cursor:move;box-shadow:0 0 0 9999em #00000080}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--no-animate .ReactCrop__crop-selection{outline:1px dashed white}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection){animation:marching-ants 1s;background-image:linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%);background-size:10px 1px,10px 1px,1px 10px,1px 10px;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;color:#fff;animation-play-state:running;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop__crop-selection:focus{outline:none;border-color:#00f;border-style:solid}.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after,.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{content:"";display:block;position:absolute;background-color:#fff6}.ReactCrop__rule-of-thirds-vt:before,.ReactCrop__rule-of-thirds-vt:after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt:before{left:33.3333%;left:33.3333333333%}.ReactCrop__rule-of-thirds-vt:after{left:66.6666%;left:66.6666666667%}.ReactCrop__rule-of-thirds-hz:before,.ReactCrop__rule-of-thirds-hz:after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz:before{top:33.3333%;top:33.3333333333%}.ReactCrop__rule-of-thirds-hz:after{top:66.6666%;top:66.6666666667%}.ReactCrop__drag-handle{position:absolute}.ReactCrop__drag-handle:after{position:absolute;content:"";display:block;width:10px;height:10px;background-color:#0003;border:1px solid rgba(255,255,255,.7);outline:1px solid transparent}.ReactCrop__drag-handle:focus:after{border-color:#00f;background:#2dbfff}.ReactCrop .ord-nw{top:0;left:0;margin-top:-5px;margin-left:-5px;cursor:nw-resize}.ReactCrop .ord-nw:after{top:0;left:0}.ReactCrop .ord-n{top:0;left:50%;margin-top:-5px;margin-left:-5px;cursor:n-resize}.ReactCrop .ord-n:after{top:0}.ReactCrop .ord-ne{top:0;right:0;margin-top:-5px;margin-right:-5px;cursor:ne-resize}.ReactCrop .ord-ne:after{top:0;right:0}.ReactCrop .ord-e{top:50%;right:0;margin-top:-5px;margin-right:-5px;cursor:e-resize}.ReactCrop .ord-e:after{right:0}.ReactCrop .ord-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px;cursor:se-resize}.ReactCrop .ord-se:after{bottom:0;right:0}.ReactCrop .ord-s{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px;cursor:s-resize}.ReactCrop .ord-s:after{bottom:0}.ReactCrop .ord-sw{bottom:0;left:0;margin-bottom:-5px;margin-left:-5px;cursor:sw-resize}.ReactCrop .ord-sw:after{bottom:0;left:0}.ReactCrop .ord-w{top:50%;left:0;margin-top:-5px;margin-left:-5px;cursor:w-resize}.ReactCrop .ord-w:after{left:0}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{top:0;left:0;width:100%;height:6px;margin-top:-3px}.ReactCrop__drag-bar.ord-e{right:0;top:0;width:6px;height:100%;margin-right:-3px}.ReactCrop__drag-bar.ord-s{bottom:0;left:0;width:100%;height:6px;margin-bottom:-3px}.ReactCrop__drag-bar.ord-w{top:0;left:0;width:6px;height:100%;margin-left:-3px}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media (pointer: coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:24px;height:24px}}
4
9
 
5
10
  @charset "UTF-8";/*!
@@ -5,10 +5,10 @@ import { EmailTemplateType } from "../template-preview/models/EmailTemplate";
5
5
  import { SMSTemplateType } from "../template-preview/models/SmsTemplate";
6
6
  import { WhatsAppCarouselTemplate } from "../template-preview/models/WhatsappCarouselTemplate";
7
7
  import { WhatsAppTemplate } from "../template-preview/models/WhatsAppTemplate";
8
+ import './global.css';
8
9
  export declare const CarouselPreview: React.ForwardRefExoticComponent<{
9
10
  channel: CHANNEL_TYPE;
10
11
  template: WhatsAppTemplate | EmailTemplateType | SMSTemplateType | WhatsAppCarouselTemplate | null;
11
12
  showSampleValues?: boolean | undefined;
12
13
  isPreview?: boolean | undefined;
13
- removeBottomBorder?: boolean | undefined;
14
14
  } & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
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
+ 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,6 +1,5 @@
1
1
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
2
2
  showHeader?: boolean | undefined;
3
- removeBottomBorder?: boolean | undefined;
4
3
  }, never>;
5
4
  export declare const CarouselContainer: import("styled-components").StyledComponent<"div", any, {
6
5
  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: ${e=>e.removeBottomBorder?"unset":"solid"};
5
+ border-bottom-style: solid;
6
6
  border-top-width: 1px;
7
7
  border-bottom-width: 1px;
8
8
  background-repeat: no-repeat;
@@ -49,9 +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
-
53
- .carousel__slide-focus-ring {
54
- display: none !important;
55
- outline-width: 0 !important;
56
- }
57
52
  `;export{i 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
- currentTemplate: any;
5
+ template: 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,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
+ 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,8 +1,5 @@
1
- export declare const BadgeContainer: import("styled-components").StyledComponent<"div", any, {
2
- padding?: string | undefined;
3
- }, never>;
1
+ export declare const BadgeContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
2
  export interface BadgeProps {
5
3
  errorText: string;
6
- padding?: string;
7
4
  }
8
5
  export declare const Badge: (props: BadgeProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,10 @@
1
- import{jsxs as t,jsx as r}from"react/jsx-runtime";import e from"../../../assets/icons/alert.svg.js";import n from"styled-components";import{BodySecondary as o}from"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";const p=n.div`
1
+ import{jsxs as r,jsx as t}from"react/jsx-runtime";import e from"../../../assets/icons/alert.svg.js";import o from"styled-components";import{BodySecondary as n}from"../../TypographyStyle.js";import{COLORS as i}from"../../../constants/Theme.js";const s=o.div`
2
2
  background: ${i.background.negative.light};
3
3
  display: flex;
4
4
  align-items: center;
5
- padding: ${t=>t.padding?"8px":"0px"} 12px;
5
+ padding: 0px 12px;
6
6
  gap: 8px;
7
7
  border-radius: 4px;
8
8
  margin-right: 12px;
9
9
  color: ${i.content.negative};
10
- `,a=n=>{const{errorText:a,padding:s}=n;return t(p,Object.assign({padding:s},{children:[r(e,{height:20,width:20,color:i.content.negative}),r(o,{children:a})]}))};export{a as Badge,p as BadgeContainer};
10
+ `,p=o=>{const{errorText:p}=o;return r(s,{children:[t(e,{height:20,width:20,color:i.content.negative}),t(n,{children:p})]})};export{p as Badge,s as BadgeContainer};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as r,useMemo as i}from"react";import a from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as s}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import u from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as p}from"./utils/convertPlaceholdersToBikDropdown.js";const m=m=>{let{selectedTemplate:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:x,onTemplateSelect:f,globalPlaceholders:E,showOnlyContent:P,whatsappSpecificPickerMeta:S,zIndex:I,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,onBackPress:L,enabledCustomText:V,variableListForImage:j,showSampleValues:A,disableEditVariable:D,pod:k,extras:O,pickerConf:W,selectedCarouselProducts:F,disableEditExpiry:H,cardWidth:z,onDeleteSelectedProducts:B}=m;var R,U,$,_,N,q;t((()=>{Y(g)}),[g]);const G=b===s.WHATSAPP&&"CAROUSEL"===(null===(U=null===(R=null==v?void 0:v.components)||void 0===R?void 0:R[1])||void 0===U?void 0:U.type),J=null==v?void 0:v.isProductCarouselType,[K,Q]=r(b===s.EMAIL||G?"desktop":"mobile"),[X,Y]=r(g),[Z,ee]=r(!1),[le,oe]=r([]),[te,re]=r(v),[ie,ae]=r([]),[ne,se]=r(!1),[de,ce]=r(null!=x?x:[]),[ue,pe]=r(!1),[me,ve]=r(-1),[he,Ce]=r([]);t((()=>{F?Ce(F):J&&Ce([])}),[F]),t((()=>{var e;if(!ne&&J&&(!F||0===Ce.length)){const l=null===(e=null==te?void 0:te.components)||void 0===e?void 0:e[1].cards,o=[];null==l||l.forEach((e=>{var l;null===(l=null==e?void 0:e.components)||void 0===l||l.forEach((e=>{var l,t,r;"HEADER"===e.type&&o.push(null!==(r=null===(t=null===(l=e.example)||void 0===l?void 0:l.header_handle)||void 0===t?void 0:t[0])&&void 0!==r?r:"")}))})),ae(o),se(!0)}}),[ne]);const be=i((()=>p(E)),[E]);return e(d.Provider,Object.assign({value:{template:te,setTemplate:re,device:K,setDevice:Q,display_content:X,setDisplayContent:Y,originalVariableList:de,setOriginalVariableList:ce,isError:Z,setIsError:ee,channel:b,globalNormalizedPlaceholders:be,templateSelectionTriggered:ue,setTemplateSelectionTriggered:pe,enabledCustomText:V,disableEditVariable:D,pod:k,extras:O,isWhatsappCarousel:G,selectedCarouselIndex:me,setSelectedCarouselIndex:ve,isProductCarouselType:J,cardCount:G?null===(_=null===($=v.components)||void 0===$?void 0:$[1].cards)||void 0===_?void 0:_.length:void 0,errorIndexes:le,setErrorIndexes:oe,pickerConf:W,carouselProducts:he,setCarouselProducts:Ce,disableEditExpiry:H,cardWidth:z,cardImages:ie,onDeleteSelectedProducts:B}},{children:P?e(u,{channel:s.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:I,centralContainerStyles:{width:G?900:b===s.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==te?void 0:te.label,headingSubtitle:b===s.WHATSAPP?`${a.capitaliseFirstLetterOfString(null!==(N=null==te?void 0:te.category)&&void 0!==N?N:"")} • ${null!==(q=null==te?void 0:te.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e(u,{showSampleValues:A,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:y,discountCode:w,setDiscountCode:M,variableListForImage:j&&(null==j?void 0:j.length)>0?j:y}),f?e(c,{isWhatsappCarousel:null!=G&&G,onSelect:function(){if((null==he?void 0:he.length)<1&&J)return void ee(!0);const e=null==f?void 0:f(te,de,null!=X?X:"",he);(null==e?void 0:e.errorIndexes)||(null==e?void 0:e.error)?((null==e?void 0:e.errorIndexes)&&oe(e.errorIndexes),(null==e?void 0:e.error)&&ee(!!(null==e?void 0:e.error))):pe(!0)}}):e(o,{})]}))}))};export{m as TemplateContextMapper};
1
+ import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as 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,18 +1,17 @@
1
- import{jsxs as e,jsx as o,Fragment as t}from"react/jsx-runtime";import{useRef as a}from"react";import i from"styled-components";import{CarouselPreview as l}from"../../carousel-preview/CarouselPreview.js";import s from"./EditWhatsAppCarouselTemplateV2.js";import{CHANNEL_TYPE as n}from"../../template-preview/models/Channels.js";import{COLORS as r}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as d}from"../utils/getVariableNameEmail.js";import{highlightFor as m}from"../utils/highlightFor.js";import c from"./DesktopPreview.js";import u from"./EditWhatsAppTemplateV2.js";import h from"./MobilePreview.js";import f from"./VariableConnectorsPanel.js";const v=i.div`
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useRef as a}from"react";import l from"styled-components";import{CarouselPreview as i}from"../../carousel-preview/CarouselPreview.js";import n from"./EditWhatsAppCarouselTemplateV2.js";import{CHANNEL_TYPE as s}from"../../template-preview/models/Channels.js";import{COLORS as r}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{getVariableNameForEmailByIndex as d}from"../utils/getVariableNameEmail.js";import{highlightFor as m}from"../utils/highlightFor.js";import c from"./DesktopPreview.js";import u from"./EditWhatsAppTemplateV2.js";import h from"./MobilePreview.js";import f from"./VariableConnectorsPanel.js";const v=l.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
- `,w=i.div`
4
+ `,w=l.div`
5
5
  padding: 16px 14px;
6
6
  max-width: 450px;
7
7
 
8
- height: ${e=>e.channel===n.WHATSAPP?"500px":"475px"};
8
+ height: ${e=>e.channel===s.WHATSAPP?"500px":"475px"};
9
9
  overflow-y: auto;
10
10
  padding-bottom: 24px;
11
11
  border-left: ${r.stroke.primary} 1px solid;
12
- border-top: ${e=>e.isWhatsappCarousel?`${r.stroke.primary} 1px solid`:void 0};
13
- `,b=i.div`
12
+ `,g=l.div`
14
13
  padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
15
14
  flex: 1;
16
15
  height: ${e=>e.isWhatsappCarousel?"500px":"475px"};
17
16
  overflow-y: auto;
18
- `,g=i=>{const{showVariableMapping:g,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j,variableListForImage:M,showSampleValues:V}=i,A=a(),S=a(),{device:T,display_content:k,channel:E,template:L,setTemplate:I,isWhatsappCarousel:_,isProductCarouselType:$}=p();const D=e=>{let o=0;for(;e;)o+=e.offsetTop,e=e.offsetParent;return o};return e(v,{children:[o(b,Object.assign({showOnlyContent:C,showVariableMapping:g,isWhatsappCarousel:_},{children:"mobile"===T?o(h,{ref:S,display_content:null!=k?k:"",channel:E,template:L,showSampleValues:V}):E===n.WHATSAPP&&_?o(l,{ref:A,channel:E,template:L,showSampleValues:V,isPreview:!1}):E!==n.MESSAGE?o(c,{ref:A,channel:E,display_content:null!=k?k:"",showSampleValues:V}):o(t,{})})),($||g)&&o(w,Object.assign({channel:E,isWhatsappCarousel:_},{children:E!==n.WHATSAPP?o(f,{onFocus:E===n.EMAIL?function(e){var o,t,a;const i=null===document||void 0===document?void 0:document.getElementById("mobile"===T?"template_html_mobile":"template_html_desktop"),l=d(e+1),s=E===n.EMAIL?null===(o=null==i?void 0:i.contentWindow)||void 0===o?void 0:o.document.getElementById(l):document.getElementById(l),p=D(s),c=null==s?void 0:s.offsetLeft;"desktop"===T?p&&A.current&&(null===(t=null==i?void 0:i.contentWindow)||void 0===t||t.scrollTo(null!=c?c:0,p),m(l,r.background.warning.light,2,E,T)):p&&S.current&&(null===(a=null==i?void 0:i.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),m(l,r.background.warning.light,2,E,T))}:void 0,showVariableModal:P,variableList:y,discountCode:W,setDiscountCode:j}):E===n.WHATSAPP&&_?o(s,{whatsappSpecificPickerMeta:x,template:L,showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j}):o(u,{whatsappSpecificPickerMeta:x,template:L,onTemplateChange:e=>{null==I||I(e)},showVariableModal:P,variableList:y,variableListForImage:M,discountCode:W,setDiscountCode:j})}))]})};export{g as default};
17
+ `,b=l=>{const{showVariableMapping:b,showOnlyContent:C,whatsappSpecificPickerMeta:x,showVariableModal:P,variableList:y,discountCode:j,setDiscountCode:M,variableListForImage:V,showSampleValues:A}=l,S=a(),T=a(),{device:W,display_content:E,channel:L,template:k,setTemplate:I,isWhatsappCarousel:_,isProductCarouselType:D}=p();const F=e=>{let t=0;for(;e;)t+=e.offsetTop,e=e.offsetParent;return t};return e(v,{children:[t(g,Object.assign({showOnlyContent:C,showVariableMapping:b,isWhatsappCarousel:_},{children:"mobile"===W?t(h,{ref:T,display_content:null!=E?E:"",channel:L,template:k,showSampleValues:A}):L===s.WHATSAPP&&_?t(i,{ref:S,channel:L,template:k,showSampleValues:A,isPreview:!1}):L!==s.MESSAGE?t(c,{ref:S,channel:L,display_content:null!=E?E:"",showSampleValues:A}):t(o,{})})),(D||b)&&t(w,Object.assign({channel:L},{children:L!==s.WHATSAPP?t(f,{onFocus:L===s.EMAIL?function(e){var t,o,a;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===W?"template_html_mobile":"template_html_desktop"),i=d(e+1),n=L===s.EMAIL?null===(t=null==l?void 0:l.contentWindow)||void 0===t?void 0:t.document.getElementById(i):document.getElementById(i),p=F(n),c=null==n?void 0:n.offsetLeft;"desktop"===W?p&&S.current&&(null===(o=null==l?void 0:l.contentWindow)||void 0===o||o.scrollTo(null!=c?c:0,p),m(i,r.background.warning.light,2,L,W)):p&&T.current&&(null===(a=null==l?void 0:l.contentWindow)||void 0===a||a.scrollTo(null!=c?c:0,p),m(i,r.background.warning.light,2,L,W))}:void 0,showVariableModal:P,variableList:y,discountCode:j,setDiscountCode:M}):L===s.WHATSAPP&&_?t(n,{whatsappSpecificPickerMeta:x,template:k,showVariableModal:P,variableList:y,variableListForImage:V,discountCode:j,setDiscountCode:M}):t(u,{whatsappSpecificPickerMeta:x,template:k,onTemplateChange:e=>{null==I||I(e)},showVariableModal:P,variableList:y,variableListForImage:V,discountCode:j,setDiscountCode:M})}))]})};export{b as default};
@@ -4,7 +4,7 @@ import e from"styled-components";import{COLORS as r}from"../../../constants/Them
4
4
  gap: 12px;
5
5
  /* justify-content: center; */
6
6
  flex: 1;
7
- `,o=e.div`
7
+ `,i=e.div`
8
8
  width: 56px;
9
9
  height: 56px;
10
10
  display: flex;
@@ -16,7 +16,7 @@ import e from"styled-components";import{COLORS as r}from"../../../constants/Them
16
16
  border: 1px solid ${r.stroke.primary};
17
17
  box-sizing: content-box;
18
18
  cursor: ${e=>e.error?"pointer":"default"};
19
- `,i=e.div`
19
+ `,o=e.div`
20
20
  padding: 8px;
21
21
  flex-direction: row;
22
22
  display: flex;
@@ -28,5 +28,4 @@ import e from"styled-components";import{COLORS as r}from"../../../constants/Them
28
28
  `,n=e.div`
29
29
  padding-bottom: 0px;
30
30
  min-width: 285px;
31
- margin-bottom: 16px;
32
- `;export{i as Container,n as EditTemplateMediaContainer,o as ImageContainer,t as RightComponent};
31
+ `;export{o as Container,n as EditTemplateMediaContainer,i as ImageContainer,t as RightComponent};
@@ -1 +1 @@
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 a from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as i,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{Badge as y}from"../Badge/index.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";import j from"./EditWhatsAppTemplateV2.js";import{ProductBox as x}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 C=C=>{let{template:w,whatsappSpecificPickerMeta:O,showVariableModal:P,variableList:T,variableListForImage:k,discountCode:S,setDiscountCode:L}=C;var V,A;const{selectedCarouselIndex:B,setTemplate:E,pickerConf:M,isProductCarouselType:F,pod:W,cardCount:D,carouselProducts:q,setCarouselProducts:R,isError:_,cardImages:$,disableEditVariable:z,onDeleteSelectedProducts:N,setSelectedCarouselIndex:G}=b(),[H,J]=i(-1==B?"First Message (Step 1/2)":F?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)"),[K,Q]=i(!1),[U,X]=i(!1),[Y,Z]=i(!1);n((()=>{J(-1==B?"First Message (Step 1/2)":F?"Product Carousel (Step 2/2)":"Carousel Cards (Step 2/2)")}),[B]);return e("div",{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center",marginBottom:24}},{children:[null!=B&&B>=0&&t(c,{Icon:l,onClick:()=>{null==G||G(-1)}}),t(p,Object.assign({style:{marginLeft:10}},{children:H}))]})),F&&(null!==(V=null==q?void 0:q.length)&&void 0!==V?V:0)>0&&null!=B&&B>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(x,{editItem:()=>{1===(null==q?void 0:q.length)&&"variable"===q[0].name?Z(!0):Q(!K)},cardBody:1===(null==q?void 0:q.length)&&"variable"===q[0].name?`${q[0].productName}`:`${null==q?void 0:q.length} Products Selected`,hideIcon:1===(null==q?void 0:q.length)&&"variable"===q[0].name,deleteItem:()=>{var e;if(1===(null==q?void 0:q.length)&&"variable"===q[0].name)return void(null==R||R([]));const t=r(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:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):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=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==E||E(t),console.log("cardImages22 selectedTemplate: ",t)),null==R||R([]),null==N||N()}}),q&&(null==q?void 0:q.length)>0&&"variable"!=q[0].name&&t(d,{disabled:(null!==(A=null==q?void 0:q.length)&&void 0!==A?A:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{X(!0),Q(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!z&&F&&0===(null==q?void 0:q.length)&&null!=B&&B>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(u,{children:"Product(s)"}),t(h,{children:`Select ${null!=D?D:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16: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(a,{width:18,height:18,color:m.content.secondary})})),onClick:e=>{Q(!0)}}),W===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(a,{width:18,height:18,color:m.content.secondary})})),onClick:e=>{Z(!0)}})]})]})),_&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(y,{padding:"8px",errorText:"Please add products"})}))]}),t(j,{whatsappSpecificPickerMeta:O,template:w,onTemplateChange:e=>{null==E||E(e)},showVariableModal:P,variableList:T,variableListForImage:k,discountCode:S,setDiscountCode:L}),K&&M&&t(v,{zIndex:200,startupScreen:U?f.RearrangeProducts:f.Collections,rearrangeEnabled:!0,storeId:M.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,a=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[a]={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!=q?q:[]),collectionFetcher:M.fetchCollections,productFetcher:M.fetchProducts,onAdd:(e,t)=>{var o;X(!1);const l=[];delete e.isCustom;for(const t of Object.keys(e)){const a=e[t].products;if(void 0!==a&&Object.keys(a).length)for(const e of Object.keys(a)){const r=a[e].variants;if(void 0!==r&&Object.keys(r).length)for(const i of Object.keys(r)){const{name:n,image:s,quantity:d,displayOrder:c}=r[i],m={name:n,image:null!==(o=null!=s?s:a[e].image)&&void 0!==o?o:"",quantity:d,variantId:i,productId:e,displayOrder:c,collectionId:t,productName:a[e].name,productImage:a[e].image};l.push(m)}}}const a=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),i=l.map((e=>e.image)),n=r(Object.assign({},w));n&&(i.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(a),Q(!1)},searchInCollectionFetcher:M.searchInCollection,searchFetcher:M.searchProducts,visible:K,onClose:()=>{Q(!1)},exactLimit:null!=D?D:1}),Y&&t(s,{zIndex:2e3,data:null!=T?T:[],showVariable:Y,setShowVariable:Z,placeholder:"Add a variable",customTrigger:e=>{null==R||R([{name:"variable",productName:e.actualValue}])}})]})};export{C as default};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as l}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:x,whatsappSpecificPickerMeta:I,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=l(Object.assign({},x));t&&(R&&R.length>0?null==R||R.forEach(((e,o)=>{var i;t.components[1].cards[o].components[0].example.header_handle=[null!==(i=R[o])&&void 0!==i?i:""]})):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)),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(i,{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(i,{width:18,height:18,color:d.content.secondary})})),onClick:e=>{Q(!0)}})]})]}))]}),t(f,{whatsappSpecificPickerMeta:I,template:x,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,i=o.productId,l=o.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),i in t[e].products||(t[e].products[i]={variants:{},name:(null==o?void 0:o.productName)||"",image:(null==o?void 0:o.productImage)||""}),t[e].products[i].variants[l]={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 i=[];delete e.isCustom;for(const t of Object.keys(e)){const l=e[t].products;if(void 0!==l&&Object.keys(l).length)for(const e of Object.keys(l)){const a=l[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:l[e].image)&&void 0!==o?o:"",quantity:d,variantId:r,productId:e,displayOrder:c,collectionId:t,productName:l[e].name,productImage:l[e].image};i.push(m)}}}const a=i.sort(((e,t)=>e.displayOrder-t.displayOrder)),r=i.map((e=>e.image)),n=l(Object.assign({},x));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 +1 @@
1
- import{jsxs as n,jsx as o}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useState as e,useEffect as i}from"react";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{getAllDataFromTemplateComponent as a}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as d}from"./BackTrackComponent.js";import{DiscountCodeComponent as r}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as c}from"./EditMediaV2.style.js";import p from"./EditWhatsAppTemplateMediaV2.js";import u from"./VariableConnector.js";import{Container as m}from"./VariableConnectorsPanel.js";import v from"./VariableConnectorWhatsApp.js";import b from"./VariableEditorHeader.js";import g from"./WhatsAppTemplateCardButtonV2.js";const f=f=>{let{template:O,onTemplateChange:j,whatsappSpecificPickerMeta:h,showVariableModal:C,variableList:T,variableListForImage:y,discountCode:x,setDiscountCode:B}=f;var V,E,L,k,U,I,w,R,A,P,M,N,S,H,_,Q,q,D,Y,K,W;const $=O.isCarouselType,{originalVariableList:F,pod:X,extras:z,selectedCarouselIndex:G,isProductCarouselType:J}=s(),{descriptionComponents:Z,urlBtns:nn,qrbBtns:on,imageComponent:tn,bodyVariables:en,headerVariables:ln}=a(O),[sn,an]=e(!1),[dn,rn]=e(-1===G?{descriptionComponents:Z,urlBtns:nn,qrbBtns:on,imageComponent:tn,bodyVariables:en,headerVariables:ln}:{}),[cn,pn]=e(!1);function un(n,o,e){var i,l,s,a,d,r,c,p,u,m;const v=null!=G&&G>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[G].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[G]}:Object.assign({},O),b=t(v),g="custom"===o&&"string"==typeof n,f=g?n:"string"!=typeof n?n.defaultValue:"";if(null!=G&&G>-1&&J){const o=Object.assign({},O).components.map((n=>{var o;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(o=n.cards)||void 0===o?void 0:o.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var o,t,i;if("BUTTONS"===n.type){const l=null===(o=n.buttons)||void 0===o?void 0:o.filter((n=>"URL"===n.type));let s=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[f]});const a=null===(i=n.buttons)||void 0===i?void 0:i.map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n));return Object.assign(Object.assign({},n),{buttons:a})}return n}))})))}):n})),i=null===(a=null===(s=Object.assign({},O).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((o=>{var t;return Object.assign(Object.assign({},o),{buttons:null===(t=null==o?void 0:o.buttons)||void 0===t?void 0:t.map((o=>g?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:""))})})),l=t(O);return l.components=o,l.mapping.cards=i,void(null==j||j(Object.assign({},l)))}const h=null==b?void 0:b.components.findIndex((n=>"BUTTONS"===n.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((n=>"URL"===n.type));if((null==t?void 0:t.length)>0){const i="custom"===o&&"string"==typeof n,l=i?n:"string"!=typeof n?n.defaultValue:"";let s=t[e];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(p=null===(c=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===c?void 0:c.buttons)&&void 0!==p?p:[]].map((n=>"URL"===n.type&&(null==n?void 0:n.text)===(null==s?void 0:s.text)?s:n)),d=Object.assign(Object.assign({},b.components[h]),{buttons:a}),m=null===(u=b.mapping)||void 0===u?void 0:u.buttons;m&&m.length>0&&(m[e]=i?"((customBtnPlaceholder))":"string"!=typeof n?n.placeHolder:"");const v=Object.assign(Object.assign({},b.mapping),{buttons:m});b.mapping=v;const g=[...b.components];g[h]=d,b.components=g}}if("string"!=typeof n){"checkout.checkoutUrl"===(null===(m=n.placeHolder)||void 0===m?void 0:m.slice(2,-2))?an(!0):(an(!1),null==B||B(""))}if(null!=G&&G>-1){const n=t(O);n.components[1].cards[G].components=b.components,n.mapping.cards[G]=b.mapping,null==j||j(Object.assign({},n))}else null==j||j(b)}function mn(n,o,e){var i,l,s,a,d,r;const c=null!=G&&G>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[G].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[G]}:Object.assign({},O);if(null!=G&&G>-1&&J){const o=Object.assign({},O).components.map((o=>{var t;return"CAROUSEL"===o.type?Object.assign(Object.assign({},o),{cards:null===(t=o.cards)||void 0===t?void 0:t.map((o=>Object.assign(Object.assign({},o),{components:o.components.map((o=>{var t,i,l;if("BUTTONS"===o.type){const s=null===(t=o.buttons)||void 0===t?void 0:t.filter((n=>"QUICK_REPLY"===n.type));let a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:n.flowId,flowName:n.flowName});const d=null===(l=o.buttons)||void 0===l?void 0:l.map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==a?void 0:a.text)?a:n));return Object.assign(Object.assign({},o),{buttons:d})}return o}))})))}):o})),i=t(O);return i.components=o,void(null==j||j(Object.assign({},i)))}const p=null==c?void 0:c.components.findIndex((n=>"BUTTONS"===n.type));if(void 0!==p&&p>-1){const o=null===(s=null==c?void 0:c.components[p].buttons)||void 0===s?void 0:s.filter((n=>"QUICK_REPLY"===n.type));if(o){let t=o[e];t=Object.assign(Object.assign({},t),{flowId:n.flowId,flowName:n.flowName});const i=[...null!==(r=null===(d=null===(a=c.components)||void 0===a?void 0:a[p])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].map((n=>"QUICK_REPLY"===n.type&&(null==n?void 0:n.text)===(null==t?void 0:t.text)?t:n)),l=Object.assign(Object.assign({},c.components[p]),{buttons:i}),s=[...c.components];s[p]=l,c.components=s}}if(null!=G&&G>-1){const n=t(O);n.components[1].cards[G].components=c.components,null==j||j(Object.assign({},n))}else null==j||j(c)}return i((()=>{var n,o;if(null===(n=O.mapping.buttons)||void 0===n?void 0:n.find((n=>"checkout.checkoutUrl"===n.slice(2,-2))))an(!0);else{an(!1);const n=null===(o=null==z?void 0:z.discountCodeExtra)||void 0===o?void 0:o[1];null==n||n("")}}),[O]),i((()=>{var n,o,t,e;if(null!=G&&G>-1){const i={components:null===(o=null===(n=O.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[G].components,mapping:null===(e=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[G]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:p}=a(i);rn({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:p})}else if(null!=G&&-1===G){const{descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l}=a(O);rn({descriptionComponents:n,urlBtns:o,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l})}}),[G]),i((()=>{var n,o,t,e;if(null!=G&&G>-1&&cn){const i={components:null===(o=null===(n=O.components[1])||void 0===n?void 0:n.cards)||void 0===o?void 0:o[G].components,mapping:null===(e=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[G]},{descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:p}=a(i);rn({descriptionComponents:l,urlBtns:s,qrbBtns:d,imageComponent:r,bodyVariables:c,headerVariables:p}),pn(!1)}}),[cn]),console.log("templateComponentData: ",dn),n(m,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!dn.imageComponent&&!J&&o(c,{children:o(p,{whatsappSpecificPickerMeta:h,mediaComponent:$?dn.imageComponent:tn,updateTemplateImageUrl:function(n,o){var e,i,l,s,a;let d;d=null!=G&&G>-1?{components:null===(i=null===(e=O.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[G].components,mapping:null===(s=null===(l=null==O?void 0:O.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[G]}:Object.assign({},O);const r=null===(a=null==d?void 0:d.components)||void 0===a?void 0:a.findIndex((n=>{if("HEADER"===n.type&&"NONE"!==n.format&&"TEXT"!==n.format)return!0}));if(void 0!==r&&r>-1&&(null==d?void 0:d.components[r])){const t=Object.assign(Object.assign({},d.components[r]),{format:o,example:{header_handle:[n]}}),e=[...d.components];e[r]=t,d=Object.assign(Object.assign({},d),{components:e})}if(d.mapping&&(d.mapping=Object.assign(Object.assign({},d.mapping),{header:void 0})),null!=G&&G>-1){const n=t(O);n.components[1].cards[G].components=d.components,n.mapping.cards[G]=d.mapping,null==j||j(Object.assign({},n)),pn(!0)}else null==j||j(Object.assign({},d))},template:O,variableListForImage:y})}),dn.bodyVariables.length>0&&o(b,{containerStyle:{paddingTop:dn.mediaComponent?24:8},headerText:"Edit variable values",subText:"Edit values for the variables used in template",toolTipInfo:"Variables are placeholder texts which can either be filled through data or custom texts. These can be edited through the dropdowns below"}),null===(V=dn.descriptionComponents)||void 0===V?void 0:V.map(((n,t)=>o(v,{originalVariableList:null!=G&&G>-1?F.cards[G]:F,type:n.type,descriptionComponent:n.component,showVariableModal:C,variableList:T},t))),(null===(L=null===(E=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===E?void 0:E.filter((n=>"URL"===n.type)))||void 0===L?void 0:L.length)>0&&o(b,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(U=null===(k=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===k?void 0:k.filter((n=>X===l.CHATBOT||"URL"===n.type)))||void 0===U?void 0:U.map(((n,t)=>{if("URL"===n.type)return o(g,{variableListIndex:t,CTAoptions:null==h?void 0:h.CTAoptions,button:n,currentVariableList:null!=G&&G>-1?Object.assign({},F.cards[G]):Object.assign({},F),updateSelectedURLTemplateBtn:un,variableList:T},`${t}_${G}`)})),X===l.CHATBOT&&(null===(w=null===(I=on[0])||void 0===I?void 0:I.component)||void 0===w?void 0:w.buttons)&&(null===(P=null===(A=null===(R=on[0])||void 0===R?void 0:R.component)||void 0===A?void 0:A.buttons)||void 0===P?void 0:P.length)>0&&o(d,{backTrackMessage:null===(M=null==z?void 0:z.backTrackExtra)||void 0===M?void 0:M[0],setBackTrackMessage:null===(N=null==z?void 0:z.backTrackExtra)||void 0===N?void 0:N[1]}),(null===(H=null===(S=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===S?void 0:S.filter((n=>"QUICK_REPLY"===n.type)))||void 0===H?void 0:H.length)>0&&(X!==l.CHATBOT?o(b,{headerText:"Edit buttons",subText:"Edit the chatflows triggered on clicking the buttons",toolTipInfo:"There is an option to trigger chatflows through the buttons which can keep the user engaged"}):o(d,{backTrackMessage:null===(_=null==z?void 0:z.backTrackExtra)||void 0===_?void 0:_[0],setBackTrackMessage:null===(Q=null==z?void 0:z.backTrackExtra)||void 0===Q?void 0:Q[1]})),null===(D=null===(q=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===q?void 0:q.filter((n=>"QUICK_REPLY"===n.type)))||void 0===D?void 0:D.map(((n,t)=>{if("QUICK_REPLY"===n.type&&X!==l.CHATBOT)return o(g,{variableListIndex:t,QRBoptions:null==h?void 0:h.QRBoptions,button:n,currentVariableList:null!=G&&G>-1?Object.assign({},F.cards[G]):Object.assign({},F),updateSelectedQRBTemplateBtn:mn},`${t}_${G}`)})),X===l.CHATBOT&&sn&&o(r,{discountCode:null===(Y=null==z?void 0:z.discountCodeExtra)||void 0===Y?void 0:Y[0],setDiscountCode:null===(K=null==z?void 0:z.discountCodeExtra)||void 0===K?void 0:K[1],variableList:T}),null===(W=null!=G&&G>-1?F.cards[G].buttons:null==F?void 0:F.buttons)||void 0===W?void 0:W.map(((n,t)=>{var e,i,l;if("COPY_CODE"===n.type)return o(u,{index:t,variable:{variableName:null!==(e=n.text)&&void 0!==e?e:"Copy Code",updatedValue:null!==(i=n.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=n.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:T,componentType:"BUTTONS"},t)}))]}))};export{f as default};
1
+ import{jsxs as o,jsx as n}from"react/jsx-runtime";import{cloneDeep as t}from"lodash";import{useState as e,useEffect as i}from"react";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{useTemplateModalContext as s}from"../context/templateModalContext.js";import{useAdditionalVariables as a}from"../custom-hooks/useAdditionalVariables.js";import{getAllDataFromTemplateComponent as d}from"../utils/getDataFromTemplateComponent.js";import{BackTrackComponent as r}from"./BackTrackComponent.js";import{DiscountCodeComponent as c}from"./DiscountCodeComponent.js";import{EditTemplateMediaContainer as p}from"./EditMediaV2.style.js";import u from"./EditWhatsAppTemplateMediaV2.js";import m from"./VariableConnector.js";import{Container as v}from"./VariableConnectorsPanel.js";import b from"./VariableConnectorWhatsApp.js";import g from"./VariableEditorHeader.js";import f from"./WhatsAppTemplateCardButtonV2.js";const h=h=>{let{template:O,onTemplateChange:j,whatsappSpecificPickerMeta:C,showVariableModal:T,variableList:y,variableListForImage:x,discountCode:V,setDiscountCode:B}=h;var E,L,k,U,I,w,R,A,N,P,M,S,H,_,D,Q,q,Y,K,W,$;const F=O.isCarouselType,{originalVariableList:X,pod:z,extras:G,selectedCarouselIndex:J,isProductCarouselType:Z}=s(),{descriptionComponents:oo,urlBtns:no,qrbBtns:to,imageComponent:eo,bodyVariables:io,headerVariables:lo}=d(O),[so,ao]=e(!1),[ro,co]=e(-1===J?{descriptionComponents:oo,urlBtns:no,qrbBtns:to,imageComponent:eo,bodyVariables:io,headerVariables:lo}:{}),[po,uo]=e(!1);function mo(o,n,e){var i,l,s,a,d,r,c,p,u,m;const v=null!=J&&J>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[J].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[J]}:Object.assign({},O),b=t(v),g="custom"===n&&"string"==typeof o,f=g?o:"string"!=typeof o?o.defaultValue:"";if(null!=J&&J>-1&&Z){const n=Object.assign({},O).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 s=null!==(t=null==l?void 0:l[e])&&void 0!==t?t:{};s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[f]});const a=null===(i=o.buttons)||void 0===i?void 0:i.map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o));return Object.assign(Object.assign({},o),{buttons:a})}return o}))})))}):o})),i=null===(a=null===(s=Object.assign({},O).mapping)||void 0===s?void 0:s.cards)||void 0===a?void 0:a.map((n=>{var t;return Object.assign(Object.assign({},n),{buttons:null===(t=null==n?void 0:n.buttons)||void 0===t?void 0:t.map((n=>g?"((customBtnPlaceholder))":"string"!=typeof o?o.placeHolder:""))})})),l=t(O);return l.components=n,l.mapping.cards=i,void(null==j||j(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:"";let s=t[e];s=Object.assign(Object.assign({},s),{url:"https://d.bik.ai/{{1}}",example:[l]});const a=[...null!==(p=null===(c=null===(r=b.components)||void 0===r?void 0:r[h])||void 0===c?void 0:c.buttons)&&void 0!==p?p:[]].map((o=>"URL"===o.type&&(null==o?void 0:o.text)===(null==s?void 0:s.text)?s:o)),d=Object.assign(Object.assign({},b.components[h]),{buttons:a}),m=null===(u=b.mapping)||void 0===u?void 0:u.buttons;m&&m.length>0&&(m[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==B||B(""))}if(null!=J&&J>-1){const o=t(O);o.components[1].cards[J].components=b.components,o.mapping.cards[J]=b.mapping,null==j||j(Object.assign({},o))}else null==j||j(b)}function vo(o,n,e){var i,l,s,a,d,r;const c=null!=J&&J>-1?{components:null===(i=Object.assign({},O).components[1].cards)||void 0===i?void 0:i[J].components,mapping:null===(l=Object.assign({},O).mapping.cards)||void 0===l?void 0:l[J]}:Object.assign({},O);if(null!=J&&J>-1&&Z){const n=Object.assign({},O).components.map((n=>{var t;return"CAROUSEL"===n.type?Object.assign(Object.assign({},n),{cards:null===(t=n.cards)||void 0===t?void 0:t.map((n=>Object.assign(Object.assign({},n),{components:n.components.map((n=>{var t,i,l;if("BUTTONS"===n.type){const s=null===(t=n.buttons)||void 0===t?void 0:t.filter((o=>"QUICK_REPLY"===o.type));let a=null!==(i=null==s?void 0:s[e])&&void 0!==i?i:{};a=Object.assign(Object.assign({},a),{flowId:o.flowId,flowName:o.flowName});const d=null===(l=n.buttons)||void 0===l?void 0:l.map((o=>"QUICK_REPLY"===o.type&&(null==o?void 0:o.text)===(null==a?void 0:a.text)?a:o));return Object.assign(Object.assign({},n),{buttons:d})}return n}))})))}):n})),i=t(O);return i.components=n,void(null==j||j(Object.assign({},i)))}const p=null==c?void 0:c.components.findIndex((o=>"BUTTONS"===o.type));if(void 0!==p&&p>-1){const n=null===(s=null==c?void 0:c.components[p].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!==(r=null===(d=null===(a=c.components)||void 0===a?void 0:a[p])||void 0===d?void 0:d.buttons)&&void 0!==r?r:[]].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({},c.components[p]),{buttons:i}),s=[...c.components];s[p]=l,c.components=s}}if(null!=J&&J>-1){const o=t(O);o.components[1].cards[J].components=c.components,null==j||j(Object.assign({},o))}else null==j||j(c)}i((()=>{var o,n;if(null===(o=O.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==G?void 0:G.discountCodeExtra)||void 0===n?void 0:n[1];null==o||o("")}}),[O]),i((()=>{var o,n,t,e;if(null!=J&&J>-1){const i={components:null===(n=null===(o=O.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[J].components,mapping:null===(e=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[J]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:c,headerVariables:p}=d(i);co({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:c,headerVariables:p})}else if(null!=J&&-1===J){const{descriptionComponents:o,urlBtns:n,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l}=d(O);co({descriptionComponents:o,urlBtns:n,qrbBtns:t,imageComponent:e,bodyVariables:i,headerVariables:l})}}),[J]),i((()=>{var o,n,t,e;if(null!=J&&J>-1&&po){const i={components:null===(n=null===(o=O.components[1])||void 0===o?void 0:o.cards)||void 0===n?void 0:n[J].components,mapping:null===(e=null===(t=null==O?void 0:O.mapping)||void 0===t?void 0:t.cards)||void 0===e?void 0:e[J]},{descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:c,headerVariables:p}=d(i);co({descriptionComponents:l,urlBtns:s,qrbBtns:a,imageComponent:r,bodyVariables:c,headerVariables:p}),uo(!1)}}),[po]);const bo=a({variableList:y,categoryDisplayName:"Custom Variables",variableDisplayName:"Custom Text",variableValue:"{{custom.text}}"});return console.log("templateComponentData: ",ro),o(v,Object.assign({style:{flexDirection:"column",width:400,maxHeight:460}},{children:[!!ro.imageComponent&&!Z&&n(p,{children:n(u,{whatsappSpecificPickerMeta:C,mediaComponent:F?ro.imageComponent:eo,updateTemplateImageUrl:function(o,n){var e,i,l,s,a;let d;d=null!=J&&J>-1?{components:null===(i=null===(e=O.components[1])||void 0===e?void 0:e.cards)||void 0===i?void 0:i[J].components,mapping:null===(s=null===(l=null==O?void 0:O.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[J]}:Object.assign({},O);const r=null===(a=null==d?void 0:d.components)||void 0===a?void 0:a.findIndex((o=>{if("HEADER"===o.type&&"NONE"!==o.format&&"TEXT"!==o.format)return!0}));if(void 0!==r&&r>-1&&(null==d?void 0:d.components[r])){const t=Object.assign(Object.assign({},d.components[r]),{format:n,example:{header_handle:[o]}}),e=[...d.components];e[r]=t,d=Object.assign(Object.assign({},d),{components:e})}if(d.mapping&&(d.mapping=Object.assign(Object.assign({},d.mapping),{header:void 0})),null!=J&&J>-1){const o=t(O);o.components[1].cards[J].components=d.components,o.mapping.cards[J]=d.mapping,null==j||j(Object.assign({},o)),uo(!0)}else null==j||j(Object.assign({},d))},template:O,variableListForImage:x})}),(ro.bodyVariables.length>0||ro.headerVariables.length>0)&&n(g,{containerStyle:{paddingTop:ro.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===(E=ro.descriptionComponents)||void 0===E?void 0:E.map(((o,t)=>n(b,{originalVariableList:null!=J&&J>-1?X.cards[J]:X,type:o.type,descriptionComponent:o.component,showVariableModal:T,variableList:bo},t))),(null===(k=null===(L=null!=J&&J>-1?X.cards[J].buttons:null==X?void 0:X.buttons)||void 0===L?void 0:L.filter((o=>"URL"===o.type)))||void 0===k?void 0:k.length)>0&&n(g,{headerText:"Edit buttons",subText:"Edit the link connected to the CTA button"}),null===(I=null===(U=null!=J&&J>-1?X.cards[J].buttons:null==X?void 0:X.buttons)||void 0===U?void 0:U.filter((o=>z===l.CHATBOT||"URL"===o.type)))||void 0===I?void 0:I.map(((o,t)=>{if("URL"===o.type)return n(f,{variableListIndex:t,CTAoptions:null==C?void 0:C.CTAoptions,button:o,currentVariableList:null!=J&&J>-1?Object.assign({},X.cards[J]):Object.assign({},X),updateSelectedURLTemplateBtn:mo,variableList:y},`${t}_${J}`)})),z===l.CHATBOT&&(null===(R=null===(w=to[0])||void 0===w?void 0:w.component)||void 0===R?void 0:R.buttons)&&(null===(P=null===(N=null===(A=to[0])||void 0===A?void 0:A.component)||void 0===N?void 0:N.buttons)||void 0===P?void 0:P.length)>0&&n(r,{backTrackMessage:null===(M=null==G?void 0:G.backTrackExtra)||void 0===M?void 0:M[0],setBackTrackMessage:null===(S=null==G?void 0:G.backTrackExtra)||void 0===S?void 0:S[1]}),(null===(_=null===(H=null!=J&&J>-1?X.cards[J].buttons:null==X?void 0:X.buttons)||void 0===H?void 0:H.filter((o=>"QUICK_REPLY"===o.type)))||void 0===_?void 0:_.length)>0&&(z!==l.CHATBOT?n(g,{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"}):n(r,{backTrackMessage:null===(D=null==G?void 0:G.backTrackExtra)||void 0===D?void 0:D[0],setBackTrackMessage:null===(Q=null==G?void 0:G.backTrackExtra)||void 0===Q?void 0:Q[1]})),null===(Y=null===(q=null!=J&&J>-1?X.cards[J].buttons:null==X?void 0:X.buttons)||void 0===q?void 0:q.filter((o=>"QUICK_REPLY"===o.type)))||void 0===Y?void 0:Y.map(((o,t)=>{if("QUICK_REPLY"===o.type&&z!==l.CHATBOT)return n(f,{variableListIndex:t,QRBoptions:null==C?void 0:C.QRBoptions,button:o,currentVariableList:null!=J&&J>-1?Object.assign({},X.cards[J]):Object.assign({},X),updateSelectedQRBTemplateBtn:vo},`${t}_${J}`)})),z===l.CHATBOT&&so&&n(c,{discountCode:null===(K=null==G?void 0:G.discountCodeExtra)||void 0===K?void 0:K[0],setDiscountCode:null===(W=null==G?void 0:G.discountCodeExtra)||void 0===W?void 0:W[1],variableList:y}),null===($=null!=J&&J>-1?X.cards[J].buttons:null==X?void 0:X.buttons)||void 0===$?void 0:$.map(((o,t)=>{var e,i,l;if("COPY_CODE"===o.type)return n(m,{index:t,variable:{variableName:null!==(e=o.text)&&void 0!==e?e:"Copy Code",updatedValue:null!==(i=o.buttonVariable)&&void 0!==i?i:"",type:"string",isEditableVariable:!0,index:null!==(l=o.index)&&void 0!==l?l:0},showVariableModal:!0,variableList:bo,componentType:"BUTTONS"},t)}))]}))};export{h as default};
@@ -1,4 +1,5 @@
1
1
  import{jsxs as e,jsx as i}from"react/jsx-runtime";import t from"../../../assets/icons/info.svg.js";import{useState as a,useRef as o,useEffect as r}from"react";import l from"styled-components";import{AddVariableV2SideModal as n}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import s from"../../../assets/icons/plus.svg.js";import"../../add-variableV2/AddVariableV2.styled.js";import"../../button/Button.js";import"../../icon-button/IconButton.js";import{Input as d}from"../../input/Input.js";import{Tooltip as c}from"../../tooltips/Tooltip.js";import{COLORS as p}from"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleRegular as m,BodySecondary as h,TitleSmall as b}from"../../TypographyStyle.js";import{CheckBox as g}from"../../checkBox/CheckBox.js";import{useTemplateModalContext as u}from"../context/templateModalContext.js";import f from"./VariableConnector.js";const v=l.div`
2
+ overflow-y: auto;
2
3
  display: flex;
3
4
  flex-direction: column;
4
5
  height: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.466-beta.10",
3
+ "version": "0.0.466-beta.2",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",