@bikdotai/bik-component-library 0.0.650 → 0.0.652--beta

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 (123) hide show
  1. package/dist/cjs/assets/icons/RCS_PDF.svg.js +1 -0
  2. package/dist/cjs/assets/icons/state_icon.svg.js +1 -0
  3. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  4. package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  5. package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  6. package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  7. package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  8. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +1 -0
  9. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  10. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  11. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  12. package/dist/cjs/components/carousel-preview/CarouselPreviewCard.js +1 -1
  13. package/dist/cjs/components/carousel-preview/CustomCarouselArrows.js +1 -1
  14. package/dist/cjs/components/dropdown/Dropdown.d.ts +1 -0
  15. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  16. package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +2 -1
  17. package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
  18. package/dist/cjs/components/states/StateComponent.d.ts +2 -1
  19. package/dist/cjs/components/states/StateComponent.js +1 -1
  20. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  21. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  22. package/dist/cjs/components/template-context-mapper/context/templateModalContext.js +1 -1
  23. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
  24. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  25. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  26. package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +4 -4
  27. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +5 -5
  28. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  29. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  30. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  31. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +1 -0
  32. package/dist/cjs/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  33. package/dist/cjs/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  34. package/dist/cjs/components/template-preview/RCS/RCSButtons.d.ts +9 -0
  35. package/dist/cjs/components/template-preview/RCS/RCSButtons.js +1 -0
  36. package/dist/cjs/components/template-preview/RCS/RCSChatHeader.d.ts +2 -0
  37. package/dist/cjs/components/template-preview/RCS/RCSChatHeader.js +1 -0
  38. package/dist/cjs/components/template-preview/RCS/RCSChatPreview.d.ts +2 -0
  39. package/dist/cjs/components/template-preview/RCS/RCSChatPreview.js +1 -0
  40. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +14 -0
  41. package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -0
  42. package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.d.ts +33 -0
  43. package/dist/cjs/components/template-preview/RCS/RCSPreview.styled.js +128 -0
  44. package/dist/cjs/components/template-preview/RCS/RCSTemplateLikePreview.d.ts +3 -0
  45. package/dist/cjs/components/template-preview/RCS/RCSTemplateLikePreview.js +8 -0
  46. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  47. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +2 -0
  48. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  49. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +3 -0
  50. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  51. package/dist/cjs/components/template-preview/helpers/templateMiscHelper.d.ts +8 -0
  52. package/dist/cjs/components/template-preview/helpers/templateMiscHelper.js +1 -0
  53. package/dist/cjs/components/template-preview/models/Channels.d.ts +2 -1
  54. package/dist/cjs/components/template-preview/models/Channels.js +1 -1
  55. package/dist/cjs/components/template-preview/models/EmailTemplate.d.ts +2 -1
  56. package/dist/cjs/components/template-preview/models/RCSTemplate.d.ts +139 -0
  57. package/dist/cjs/components/template-preview/models/RCSTemplate.js +1 -0
  58. package/dist/cjs/components/template-preview/models/SmsTemplate.d.ts +2 -1
  59. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +9 -1
  60. package/dist/cjs/components/template-preview/models/WhatsappCarouselTemplate.d.ts +28 -1
  61. package/dist/cjs/components/template-preview/models/types.d.ts +2 -1
  62. package/dist/esm/assets/icons/RCS_PDF.svg.js +1 -0
  63. package/dist/esm/assets/icons/state_icon.svg.js +1 -0
  64. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
  65. package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  66. package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
  67. package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
  68. package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
  69. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +1 -0
  70. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  71. package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
  72. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  73. package/dist/esm/components/carousel-preview/CarouselPreviewCard.js +1 -1
  74. package/dist/esm/components/carousel-preview/CustomCarouselArrows.js +1 -1
  75. package/dist/esm/components/dropdown/Dropdown.d.ts +1 -0
  76. package/dist/esm/components/dropdown/Dropdown.js +1 -1
  77. package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +2 -1
  78. package/dist/esm/components/shimmer-image/ShimmerImage.js +1 -1
  79. package/dist/esm/components/states/StateComponent.d.ts +2 -1
  80. package/dist/esm/components/states/StateComponent.js +1 -1
  81. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  82. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +2 -0
  83. package/dist/esm/components/template-context-mapper/context/templateModalContext.js +1 -1
  84. package/dist/esm/components/template-context-mapper/modalElements/Body.js +3 -3
  85. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  86. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +2 -2
  87. package/dist/esm/components/template-context-mapper/modalElements/Footer.js +4 -4
  88. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +5 -5
  89. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -1
  90. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +5 -5
  91. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  92. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.d.ts +1 -0
  93. package/dist/esm/components/template-context-mapper/utils/getDataFromTemplateComponent.js +1 -1
  94. package/dist/esm/components/template-context-mapper/utils/getPreviewDimension.js +1 -1
  95. package/dist/esm/components/template-preview/RCS/RCSButtons.d.ts +9 -0
  96. package/dist/esm/components/template-preview/RCS/RCSButtons.js +1 -0
  97. package/dist/esm/components/template-preview/RCS/RCSChatHeader.d.ts +2 -0
  98. package/dist/esm/components/template-preview/RCS/RCSChatHeader.js +1 -0
  99. package/dist/esm/components/template-preview/RCS/RCSChatPreview.d.ts +2 -0
  100. package/dist/esm/components/template-preview/RCS/RCSChatPreview.js +1 -0
  101. package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +14 -0
  102. package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -0
  103. package/dist/esm/components/template-preview/RCS/RCSPreview.styled.d.ts +33 -0
  104. package/dist/esm/components/template-preview/RCS/RCSPreview.styled.js +128 -0
  105. package/dist/esm/components/template-preview/RCS/RCSTemplateLikePreview.d.ts +3 -0
  106. package/dist/esm/components/template-preview/RCS/RCSTemplateLikePreview.js +8 -0
  107. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  108. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +2 -0
  109. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  110. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +3 -0
  111. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  112. package/dist/esm/components/template-preview/helpers/templateMiscHelper.d.ts +8 -0
  113. package/dist/esm/components/template-preview/helpers/templateMiscHelper.js +1 -0
  114. package/dist/esm/components/template-preview/models/Channels.d.ts +2 -1
  115. package/dist/esm/components/template-preview/models/Channels.js +1 -1
  116. package/dist/esm/components/template-preview/models/EmailTemplate.d.ts +2 -1
  117. package/dist/esm/components/template-preview/models/RCSTemplate.d.ts +139 -0
  118. package/dist/esm/components/template-preview/models/RCSTemplate.js +1 -0
  119. package/dist/esm/components/template-preview/models/SmsTemplate.d.ts +2 -1
  120. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +9 -1
  121. package/dist/esm/components/template-preview/models/WhatsappCarouselTemplate.d.ts +28 -1
  122. package/dist/esm/components/template-preview/models/types.d.ts +2 -1
  123. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r,n,c=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var a=e=>c.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),t||(t=c.createElement("rect",{width:24,height:24,fill:"#017AFF",rx:12})),r||(r=c.createElement("rect",{width:10,height:10,x:7,y:7,fill:"#fff",rx:2})),n||(n=c.createElement("path",{fill:"#017AFF",d:"M9.303 10.841c.405 0 .72.084.942.252.225.167.338.419.338.754 0 .35-.113.614-.338.79-.226.174-.526.261-.901.261h-.37V14H8.37v-3.159h.933Zm-.005 1.605c.217 0 .38-.044.49-.133.11-.091.164-.247.164-.466 0-.375-.218-.562-.654-.562h-.324v1.16h.324Zm2.55-1.605c.491 0 .883.111 1.175.334.296.222.444.632.444 1.23 0 .585-.145.998-.435 1.238-.29.238-.656.357-1.101.357h-.86v-3.159h.777Zm-.173.453v2.253h.297c.268 0 .478-.082.63-.246.153-.168.23-.467.23-.896 0-.3-.04-.53-.12-.69a.638.638 0 0 0-.306-.334 1.07 1.07 0 0 0-.453-.087h-.278ZM14.035 14v-3.159h1.788l-.064.448h-1.12v.946h.974v.448h-.974V14h-.603Z"})));exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r,n,c=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}var a=e=>c.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 56"},e),t||(t=c.createElement("rect",{width:56,height:56,fill:"#F0F0F0",rx:28})),r||(r=c.createElement("path",{fill:"#9E9E9E",d:"M28 21.333c.736 0 1.333.597 1.333 1.334V28a1.333 1.333 0 0 1-2.666 0v-5.333c0-.737.596-1.334 1.333-1.334ZM28 33.333a1.333 1.333 0 1 0 0-2.666 1.333 1.333 0 0 0 0 2.666Z"})),n||(n=c.createElement("path",{fill:"#9E9E9E",fillRule:"evenodd",d:"M13.333 28c0-8.1 6.567-14.667 14.667-14.667S42.667 19.9 42.667 28 36.1 42.667 28 42.667 13.333 36.1 13.333 28ZM28 16c-6.628 0-12 5.373-12 12s5.372 12 12 12c6.627 0 12-5.373 12-12s-5.373-12-12-12Z",clipRule:"evenodd"})));exports.default=a;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default EventsTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { QueryBuilderNodeProps } from "../../../types/QueryBuilderNodeProps.type";
2
+ import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
3
3
  declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
4
4
  export default IGTrigger;
@@ -1,2 +1,2 @@
1
- import { QueryBuilderAPIData } from "../../../types/QueryBuilderAPI.type";
1
+ import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
2
2
  export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DropdownOption } from "../../../dropdown/type";
3
- import { QueryBuilderProperty } from "../../types/QueryBuilder.type";
4
- import { QueryBuilderNodeProps } from "../../types/QueryBuilderNodeProps.type";
3
+ import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
4
+ import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
5
5
  declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
6
6
  cacheKey: string;
7
7
  propertyAddBtnText: string;
@@ -36,5 +36,6 @@ export type LineChartProps = {
36
36
  afterBodyCallBack?: (context: any) => void;
37
37
  titleTooltipCallback?: (context: any) => void;
38
38
  isInternationalStore?: boolean;
39
+ customYHeaders?: any;
39
40
  };
40
41
  export declare const LineChart: React.FC<LineChartProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),l=require("react"),r=require("react-chartjs-2"),n=require("../../../TypographyStyle.js"),i=require("../../../../constants/Theme.js"),o=require("../utils/calcPercentage.js"),a=require("./LineChart.styled.js");t.Chart.register(t.CategoryScale,t.LinearScale,t.PointElement,t.BarElement,t.LineElement,t.ArcElement,t.Filler,t.Title,t.Tooltip,t.Legend);exports.LineChart=t=>{let{scaleText:s,labels:d,canvasHeight:c,datas:u,maintainAspectRatio:g=!1,stepSize:p,min:y,max:b,isZeroState:v,tension:C,isNewStyles:O,prefixCurrencyInYAxis:h,pointRadius:x,useKFormat:S,lineThickness:j,ticksLabelCallback:m,labelCallback:L,afterBodyCallBack:f,titleTooltipCallback:k,isInternationalStore:R}=t;var q,B,w;const[F,T]=l.useState(null),E=l.useRef();l.useEffect((()=>{var e,t,l,r;if(null===(r=null===(l=null===(t=null===(e=E.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===l?void 0:l.ticks)||void 0===r?void 0:r.length){const e=38*E.current.scales.y.ticks.length;T(e)}}),[E]);const z=u.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?i.COLORS.content.placeholder:i.COLORS.background.brand,square:e.squareLegends}))),I={labels:d,datasets:u.map(((e,t)=>{var l,r,n;return Object.assign(Object.assign({tension:null!=C?C:.4,fill:e.gradient?"start":0},((e,t)=>{const l={borderColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)};return O?Object.assign({pointStyle:"circle",pointRadius:x||(d&&d.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)},l):Object.assign({pointRadius:null!=x?x:1},l)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(r=null!==(l=e.lineWidth)&&void 0!==l?l:j)&&void 0!==r?r:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,F?F-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(n=e.backgroundColor)&&void 0!==n?n:"transparent",legend:e.legend})}))},$={maintainAspectRatio:g,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=O&&O,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>i.COLORS.content.primaryInverse,backgroundColor:i.COLORS.content.primary,callbacks:{labelTextColor:()=>i.COLORS.content.primaryInverse,title:k,label:L,afterBody:f},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:v?0:y,max:v?10:b,ticks:{color:i.COLORS.content.secondary,callback:e=>{var t,l;return S?`${null!==(t=null==s?void 0:s.yPrefix)&&void 0!==t?t:""}${R?o.truncateValueForInternationalStore(e):o.truncateValueForIndianStore(e)}${null!=h?h:""}`:`${null!==(l=null==s?void 0:s.yPrefix)&&void 0!==l?l:""}${e}${null!=h?h:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:v?1:p,padding:O?24:0},title:{display:!!(null==s?void 0:s.y),text:null==s?void 0:s.y},grid:{color:i.COLORS.background.base,drawBorder:null===(q=null==s?void 0:s.yDrawBorder)||void 0===q||q}},x:{ticks:{callback:m,color:i.COLORS.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==s?void 0:s.x),text:null==s?void 0:s.x},grid:{display:!1,drawBorder:null!==(B=null==s?void 0:s.xDrawBorder)&&void 0!==B&&B}}}};return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},g?{}:{height:null!==(w=null!=c?c:F)&&void 0!==w?w:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[e.jsx(a.LegendWrapper,{children:z.map(((t,l)=>{let{text:r,color:i,square:o}=t;return r?e.jsxs(a.LegendContainer,{children:[e.jsx(a.LegendColor,{color:i,square:o,newStyle:O}),e.jsx(n.BodyTiny,Object.assign({color:"#667085"},{children:r}))]},l):e.jsx(e.Fragment,{})}))}),e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(r.Line,{ref:E,options:$,data:I})}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),l=require("react"),r=require("react-chartjs-2"),n=require("../../../TypographyStyle.js"),i=require("../../../../constants/Theme.js"),o=require("../utils/calcPercentage.js"),a=require("./LineChart.styled.js");t.Chart.register(t.CategoryScale,t.LinearScale,t.PointElement,t.BarElement,t.LineElement,t.ArcElement,t.Filler,t.Title,t.Tooltip,t.Legend);exports.LineChart=t=>{let{scaleText:s,labels:d,canvasHeight:c,datas:u,maintainAspectRatio:g=!1,stepSize:p,min:y,max:b,isZeroState:v,tension:C,isNewStyles:O,prefixCurrencyInYAxis:h,pointRadius:x,useKFormat:S,lineThickness:j,ticksLabelCallback:m,labelCallback:L,afterBodyCallBack:k,titleTooltipCallback:f,isInternationalStore:R,customYHeaders:q}=t;var B,w,F;const[T,E]=l.useState(null),z=l.useRef();l.useEffect((()=>{var e,t,l,r;if(null===(r=null===(l=null===(t=null===(e=z.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===l?void 0:l.ticks)||void 0===r?void 0:r.length){const e=38*z.current.scales.y.ticks.length;E(e)}}),[z]);const I=u.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?i.COLORS.content.placeholder:i.COLORS.background.brand,square:e.squareLegends}))),$={labels:d,datasets:u.map(((e,t)=>{var l,r,n;return Object.assign(Object.assign({tension:null!=C?C:.4,fill:e.gradient?"start":0},((e,t)=>{const l={borderColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)};return O?Object.assign({pointStyle:"circle",pointRadius:x||(d&&d.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)},l):Object.assign({pointRadius:null!=x?x:1},l)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(r=null!==(l=e.lineWidth)&&void 0!==l?l:j)&&void 0!==r?r:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,T?T-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(n=e.backgroundColor)&&void 0!==n?n:"transparent",legend:e.legend})}))},A={maintainAspectRatio:g,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=O&&O,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>i.COLORS.content.primaryInverse,backgroundColor:i.COLORS.content.primary,callbacks:{labelTextColor:()=>i.COLORS.content.primaryInverse,title:f,label:L,afterBody:k},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:v?0:y,max:v?10:b,ticks:{color:i.COLORS.content.secondary,callback:e=>{var t,l;return S?`${null!==(t=null==s?void 0:s.yPrefix)&&void 0!==t?t:""}${R?o.truncateValueForInternationalStore(e):o.truncateValueForIndianStore(e)}${null!=h?h:""}`:q&&Object.keys(q).length>0?q[e]:`${null!==(l=null==s?void 0:s.yPrefix)&&void 0!==l?l:""}${e}${null!=h?h:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:v?1:p,padding:O?24:0},title:{display:!!(null==s?void 0:s.y),text:null==s?void 0:s.y},grid:{color:i.COLORS.background.base,drawBorder:null===(B=null==s?void 0:s.yDrawBorder)||void 0===B||B}},x:{ticks:{callback:m,color:i.COLORS.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==s?void 0:s.x),text:null==s?void 0:s.x},grid:{display:!1,drawBorder:null!==(w=null==s?void 0:s.xDrawBorder)&&void 0!==w&&w}}}};return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},g?{}:{height:null!==(F=null!=c?c:T)&&void 0!==F?F:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[e.jsx(a.LegendWrapper,{children:I.map(((t,l)=>{let{text:r,color:i,square:o}=t;return r?e.jsxs(a.LegendContainer,{children:[e.jsx(a.LegendColor,{color:i,square:o,newStyle:O}),e.jsx(n.BodyTiny,Object.assign({color:"#667085"},{children:r}))]},l):e.jsx(e.Fragment,{})}))}),e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(r.Line,{ref:z,options:A,data:$})}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("@emotion/styled/base"),I=require("react/jsx-runtime"),e=require("../../../../assets/icons/ChartBar.svg.js"),C=require("../../../../assets/icons/maximize.svg.js");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var A=require("../../../../utils/StringUtils.js"),r=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var l=require("react");require("../../../checkBox/CheckBox.styled.js");var c=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../button/Button.js"),require("../../../toaster/Toaster.styled.js"),require("../../../tooltips/Tooltip.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js");var i=require("../../../icon-button/IconButton.js");require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../curtain/CurtainHelper.js"),require("../../../variable-picker-v3/model.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../template-preview/models/WhatsAppTemplate.js"),require("../../../template-preview/models/Channels.js"),require("lodash");var s=require("../../../modals/styledModal.js");require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/styles/TemplateAnalyticsStyles.js"),require("../../../template-context-mapper/utils/TemplateConstants.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../../_virtual/_tslib.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../progress-bar-v2/ProgressBarV2.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("../../../datePicker/DatePickerWrapper.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("react-calendar"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../../../../utils/DateUtils.js");var t=require("../utils/calcPercentage.js");require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var a=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js");var d=require("../VerticalBarGraph/VerticalGraph.js");require("../VerticalBarGraph/FunnelVerticalBarGraph.js"),require("../heatmap/HeatMap.js"),require("../heatmap/HeatMapVertical.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/modal.js"),require("../../../modals/modal.styled.js"),require("../../../variable-picker-v3/NoResult.js"),require("../../../variable-picker-v3/styles.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js"),require("react-slick"),require("../../../carousel-preview/CarouselPreview.style.js"),require("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js"),require("../../../floating-input-dropdown/FloatingInputDropdown.js"),require("../../../dropdown/MultilevelDropdownPopover/index.js"),require("../../../multi-level-dropdown/MultiLevelDropdown.styled.js"),require("../../../data-source-panel/DataSourceInfoFooter.js"),require("../../../data-source-panel/DataSourcePanel.style.js"),require("../../../data-source-panel/model.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryResponseList.style.js");var n=require("chart.js"),o=require("react-chartjs-2");function u(g){return g&&"object"==typeof g&&"default"in g?g:{default:g}}var b=u(g);n.Chart.register(n.ArcElement,n.Legend);const p=g=>({plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:I=>{var e;if(!I.label)return" 0%";const C=I.dataset.data.reduce(((g,I)=>g+I),0),A=parseFloat((I.raw/C*100).toFixed(1)),{label:r,raw:l}=I,c=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",i=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${c}${void 0!==i?i?t.truncateValueForInternationalStore(l):t.truncateValueForIndianStore(l):l} (${A}% of ${c}${void 0!==i?i?t.truncateValueForInternationalStore(C):t.truncateValueForIndianStore(C):C})`]}}}}}),G=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],y=b.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(g=>r.COLORS.surface.standard),";border:1px solid ",(g=>r.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgQmFyQ2hhcnRJY29uIGZyb20gJ0BzcmMvYXNzZXRzL2ljb25zL0NoYXJ0QmFyLnN2Zyc7XHJcbmltcG9ydCBNYXhpbWl6ZUljb24gZnJvbSAnQHNyYy9hc3NldHMvaWNvbnMvbWF4aW1pemUuc3ZnJztcclxuaW1wb3J0IHsgU3RyaW5nVXRpbHMgfSBmcm9tIFwiLi4vLi4vLi4vLi4vaW5kZXhcIjtcclxuaW1wb3J0IHsgQXJjRWxlbWVudCwgQ2hhcnQgYXMgQ2hhcnRKUywgTGVnZW5kIH0gZnJvbSAnY2hhcnQuanM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xyXG4gICAgICAgIGRhdGE6IHhBeGlzRGF0YSxcclxuICAgICAgICB0aXRsZTogeEF4aXNUaXRsZSAhPT0gbnVsbCAmJiB4QXhpc1RpdGxlICE9PSB2b2lkIDAgPyB4QXhpc1RpdGxlIDogJycsXHJcbiAgICB9O1xyXG4gICAgY29uc3QgeUF4aXMgPSB7XHJcbiAgICAgICAgZGF0YTogeUF4aXNEYXRhLFxyXG4gICAgICAgIHRpdGxlOiB5QXhpc1RpdGxlICE9PSBudWxsICYmIHlBeGlzVGl0bGUgIT09IHZvaWQgMCA/IHlBeGlzVGl0bGUgOiAnJyxcclxuICAgIH07XHJcbiAgICBjb25zdCBiYXJDaGFydERhdGEgPSB7XHJcbiAgICAgICAgeEF4aXMsXHJcbiAgICAgICAgeUF4aXMsXHJcbiAgICAgICAgYmFyQ29sb3JSR0JBOiB7IHI6IDIxMCwgZzogMTc0LCBiOiAyNTUsIGE6IDEgfSxcclxuICAgIH07XHJcbiAgICByZXR1cm4gYmFyQ2hhcnREYXRhO1xyXG59O1xyXG5jb25zdCBvcHRpb25zID0gKGN1cnJlbmN5UHJvcHMpID0+ICh7XHJcbiAgICBwbHVnaW5zOiB7XHJcbiAgICAgICAgbGVnZW5kOiB7XHJcbiAgICAgICAgICAgIGRpc3BsYXk6IGZhbHNlLFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgdG9vbHRpcDoge1xyXG4gICAgICAgICAgICBlbmFibGVkOiB0cnVlLFxyXG4gICAgICAgICAgICBjYWxsYmFja3M6IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRDJBRUZGJyxcclxuICAgICcjQ0RFMUZGJyxcclxuICAgICcjOTJBRkZBJyxcclxuICAgICcjMzkzNUUxJyxcclxuXTtcclxuY29uc3QgQ2FydFN0eWxlZCA9IHN0eWxlZC5kaXYgYFxuXHRiYWNrZ3JvdW5kOiAkeyhwcm9wcykgPT4gQ09MT1JTLnN1cmZhY2Uuc3RhbmRhcmR9O1xuXHRib3JkZXI6IDFweCBzb2xpZCAkeyhwcm9wcykgPT4gQ09MT1JTLnN0cm9rZS5wcmltYXJ5fTtcblx0Ym9yZGVyLXJhZGl1czogNHB4O1xuYDtcclxuZXhwb3J0IGNvbnN0IENhcmQgPSAocHJvcHMpID0+IHtcclxuICAgIHJldHVybiBfan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0sIHNsaWNlKSA9PiBzdW0gKyBzbGljZS5jb3VudCwgMCk7XHJcbiAgICAgICAgbGV0IHVwZGF0ZWRTbGljZXNXaXRoQ29sb3IgPSBbXTtcclxuICAgICAgICB1cGRhdGVkU2xpY2VzV2l0aENvbG9yID0gT2JqZWN0LmtleXMoc2xpY2VzKS5tYXAoKGtleSwgaW5kZXgpID0+IChPYmplY3QuYXNzaWduKHsgY29sb3I6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdIH0sIHNsaWNlc1trZXldKSkpO1xyXG4gICAgICAgIHNldFNsaWNlc1dpdGhDb2xvcihbLi4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdOyB9KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyQ29sb3I6IFsnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlclJhZGl1czogOCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkRGF0YSh0cnV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kcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhEaXJlY3Rpb246ICdjb2x1bW4nLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdmbGV4LXN0YXJ0JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogdHJ1bmNhdGVTbGljZXMgPyB0cnVuY2F0ZWRTbGljZXNXaXRoQ29sb3IgOiBzbGljZXNXaXRoQ29sb3IsIHNpemU6IHNpemUgfSkgfSkpXSB9KSksIHNob3dQb3B1cCAmJiAoX2pzeChTdHlsZWRNb2RhbCwgT2JqZWN0LmFzc2lnbih7IG9wZW46IHNob3dQb3B1cCwgb25DbG9zZTogKCkgPT4gc2V0U2hvd1BvcHVwKGZhbHNlKSwgY2xvc2VPbk91dHNpZGVDbGljazogdHJ1ZSwgaGVhZGluZ1RpdGxlOiB0aXRsZSwgd2lkdGg6IFwiNzUlXCIgfSwgeyBjaGlsZHJlbjogX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDI0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnc3BhY2UtYmV0d2VlbicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzgwdmgnLFxyXG4gICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7IHdpZHRoOiAnNTUlJywgbWFyZ2luTGVmdDogJzQlJyB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICA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CwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGJhckNoYXJ0RGF0YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:t,size:n,allowChartPopup:u,showConvertToBarChart:b,truncateSlices:y,barChartXAxisTitle:h,barChartYAxisTitle:X,hideTitle:m=!1,currencyProps:B}=g;const[x,j]=l.useState(!1),[Z,H]=l.useState(!1),[N,W]=l.useState([]),[Y,J]=l.useState(),[R,V]=l.useState(),[F,S]=l.useState([]),[v,k]=l.useState(null);return l.useEffect((()=>{const g=t.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(t).map(((g,I)=>Object.assign({color:G[I%G.length]},t[g]))),W([...I]),0===g){J({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:t.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:t.map((g=>g.count)),backgroundColor:t.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};J(g)}if(y&&t.length>y){const g=t.slice(0,y),I=t.slice(y).reduce(((g,I)=>g+I.count),0);g.push({name:"Other",count:I});const e={labels:g.map((g=>A.default.capitalize(g.name))),datasets:[{data:g.map((g=>g.count)),backgroundColor:g.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};V(e);const C=g.map(((g,I)=>Object.assign({color:G[I%G.length]},g)));S(C)}b&&k(((g,I,e)=>({xAxis:{data:g.map((g=>g.name)),title:null!=I?I:""},yAxis:{data:g.map((g=>g.count)),title:null!=e?e:""},barColorRGBA:{r:210,g:174,b:255,a:1}}))(t,h,X))}),[t,y]),Y?I.jsxs(I.Fragment,{children:[I.jsxs("div",Object.assign({style:{display:"flex",justifyContent:m||0===(null==r?void 0:r.length)?"flex-end":"space-between"}},{children:[!m&&r&&I.jsx(c.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(i.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(i.IconButton,{Icon:C.default,onClick:()=>{j(!0)}})]})]})),I.jsxs("div",Object.assign({className:"row"},{children:[I.jsx("div",Object.assign({className:"col-6 ",style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx("div",Object.assign({style:{width:n,height:n}},{children:I.jsx(o.Doughnut,{data:y?R:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"flex-start"}},{children:I.jsx(a.PieChart,{slices:y?F:N,size:n})}))]})),x&&I.jsx(s.StyledModal,Object.assign({open:x,onClose:()=>j(!1),closeOnOutsideClick:!0,headingTitle:r,width:"75%"},{children:I.jsxs("div",Object.assign({style:{padding:24,display:"flex",justifyContent:"space-between",height:"80vh"}},{children:[I.jsx("div",Object.assign({style:{width:"55%",marginLeft:"4%"}},{children:I.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx(o.Doughnut,{data:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({style:{width:"30%",height:"100%",overflowY:"auto"}},{children:I.jsx(a.PieChart,{slices:N})}))]}))})),Z&&v&&I.jsx(s.StyledModal,Object.assign({open:Z,onClose:()=>H(!1),closeOnOutsideClick:!0,headingTitle:r,width:"85%"},{children:I.jsx("div",Object.assign({style:{padding:"24px 0"}},{children:I.jsx(d.VerticalGraph,{xAxis:v.xAxis,yAxis:v.yAxis,barColorRGBA:null==v?void 0:v.barColorRGBA})}))}))]}):I.jsx(I.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var g=require("@emotion/styled/base"),I=require("react/jsx-runtime"),e=require("../../../../assets/icons/ChartBar.svg.js"),C=require("../../../../assets/icons/maximize.svg.js");require("@amplitude/analytics-browser"),require("../../../../amplitude/model.js");var A=require("../../../../utils/StringUtils.js"),r=require("../../../../constants/Theme.js");require("../../../../constants/zindex.js");var l=require("react");require("../../../checkBox/CheckBox.styled.js");var i=require("../../../TypographyStyle.js");require("../../../list-item/ListItem.js"),require("../../../pagination/Pagination.js"),require("../../../radioButton/RadioButton.styled.js"),require("react-dom"),require("react-toastify"),require("../../../button/Button.js"),require("../../../toaster/Toaster.styled.js"),require("../../../tooltips/Tooltip.js"),require("../../../spinner/Spinner.js"),require("../../../stepper/Stepper.styled.js"),require("../../../tag/Tag.js");var c=require("../../../icon-button/IconButton.js");require("../../../template-preview/TemplatePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../../curtain/CurtainHelper.js"),require("../../../variable-picker-v3/model.js"),require("../../../template-preview/models/TemplateMeta.js"),require("../../../template-preview/models/WhatsAppTemplate.js"),require("../../../template-preview/models/Channels.js"),require("lodash");var t=require("../../../modals/styledModal.js");require("../../../template-preview/models/RCSTemplate.js"),require("../../../template-context-mapper/context/templateModalContext.js"),require("../../../template-context-mapper/modalElements/Footer.js"),require("../../../template-context-mapper/styles/TemplateAnalyticsStyles.js"),require("../../../template-context-mapper/utils/TemplateConstants.js"),require("../../../shimmer/ShimmerComponent/ShimmerStyled.js"),require("../../../template-context-mapper/modalElements/Body.js"),require("../../../template-context-mapper/modalElements/Header.js"),require("../../../../_virtual/_tslib.js"),require("../../../zeroState/ZeroState.js"),require("../../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../../input/Input.js"),require("react-bootstrap"),require("../../../floating-action-button/FloatingActionButton.styles.js"),require("../../../image-compress/ImageCompress.js"),require("../../../progress-bar/ProgressBarComponent.js"),require("../../../progress-bar-v2/ProgressBarV2.js"),require("../../../QueryBuilder/QueryBuilder.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.js"),require("../../../QueryBuilder/constants/connectorPosition.js"),require("../../../QueryBuilder/constants/connector.js"),require("../../../QueryBuilder/types/QueryBuilder.type.js"),require("../../../dropdown/Dropdown.js"),require("../../../QueryBuilder/components/InputLoader.js"),require("../../../QueryBuilder/components/Connectors/Components/EmojiPicker.js"),require("react-chips"),require("../../../input/ChipInput.styled.js"),require("../../../QueryBuilder/components/Connectors/Components/FrequencyIntegerPositiveSingle.js"),require("../../../QueryBuilder/components/Connectors/Components/IgPicker.js"),require("../../../QueryBuilder/components/Connectors/Components/InTheLast.js"),require("../../../QueryBuilder/components/Connectors/Components/InTwoLast.js"),require("../../../datePicker/DatePickerWrapper.js"),require("../../../QueryBuilder/components/Connectors/Connector.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.js"),require("../../../QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.js"),require("../../../QueryBuilder/redux/queryBuilder.reducer.js"),require("../../../QueryBuilder/redux/queryBuilderCache.reducer.js"),require("../../../QueryBuilder/types/QueryBuilderOperator.type.js"),require("../../../dropdown/DropdownPopover/index.js"),require("../../../dropdown/ChipDropdown.js"),require("../../../dropdown/MenuItem/MenuItem.js"),require("../../../analytics-card/AnalyticsCard.styled.js"),require("../../CommonStyles.js"),require("react-calendar"),require("../../../datePicker/DatePicker.styled.js"),require("../../AnalyticsMetric.js"),require("../../../../utils/DateUtils.js");var s=require("../utils/calcPercentage.js");require("../LineChart/LineChart.js"),require("../linearChipGroupedChart/LinearChipGroupedChart.styled.js");var a=require("./PieChart.js");require("../HorizontalBarGraph/HorizontalGraph.js"),require("../StackedBarChart/StackedBarChart.js"),require("../StackedBarChart/StackedBarDistributionChart.js"),require("../StackedBarChart/StackedBarDistributionChart.model.js");var d=require("../VerticalBarGraph/VerticalGraph.js");require("../VerticalBarGraph/FunnelVerticalBarGraph.js"),require("../heatmap/HeatMap.js"),require("../heatmap/HeatMapVertical.js"),require("../VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../../avatar/Avatar.js"),require("../../../avatar/AvatarHelper.js"),require("../../../alerts/Alert.styled.js"),require("../../../alerts/AlertHelper.js"),require("../../../thumbnail/Thumbnail.js"),require("../../../curtain/Curtain.styled.js"),require("../../../switch/Switch.js"),require("../../../plans/SubscriptionPlanStyled.js"),require("../../../plans/SubscriptionPlanSelector.js"),require("../../../plans/SubscriptionPlansCollected.js"),require("../../../tabs/Tabs.js"),require("../../../TablePagination/TablePagination.styled.js"),require("../../../TablePagination/TablePaginationCard.js"),require("../../../states/StateComponent.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditor.js"),require("../../../WhatsAppTextEditor/WhatsAppTextEditorHeader.js"),require("../../../card-selection-modal/CardSelectionModal.styled.js"),require("react-image-crop"),require("../../../buttonGroup/ButtonGroupStyle.js"),require("../../../accordion/Accordion.style.js"),require("../../../accordion/AccordionArrow.js"),require("../../../file-uploader/FileUploaderStyle.js"),require("../../../colourInput/ColourInput.styled.js"),require("../../../bik-layout/CommonStyles.js"),require("../../../navigation-hyperlink/NavigationHyperlink.js"),require("../../../bik-layout/SidebarStyles.js"),require("date-fns"),require("react-popper"),require("../../../dropdown/Common.styled.js"),require("../../../custom-date-time/CustomDateTime.styled.js"),require("../../../../node_modules/lodash.debounce/index.js"),require("../../../product-picker/ProductPicker.styled.js"),require("../../../discount-modal/type.js"),require("../../../product-picker-v2/modal.js"),require("../../../modals/modal.styled.js"),require("../../../variable-picker-v3/NoResult.js"),require("../../../variable-picker-v3/styles.js"),require("../../../discount-modal/DiscountModal.styled.js"),require("../../../discount-modal/DynamicCoupon/DynamicCoupon.js"),require("../../../country-code-picker/CountryCodePicker.styled.js"),require("../../../carousel/carousel.js"),require("../../../carousel-secondary/CarouselSecondary.js"),require("../../../access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.js"),require("../../../radioList/RadioList.styled.js"),require("../../../checkList/CheckList.styled.js"),require("../../../postPicker/postPicker.js"),require("../../../dropdown-button/DropdownButton.style.js"),require("../../../side-modal/SideModal.style.js"),require("../../../add-variableV2/AddVariableV2.styled.js"),require("../../../SearchFilter/types/SearchFilter.type.js"),require("../../../SearchFilter/components/DatePickerButton.js"),require("../../../SearchFilter/components/DateRangeOnlyButton.js"),require("../../../input-with-vars/InputWithVariables.js"),require("../../../star-rating/StarRating.js"),require("../../../dashboard-review-popup/components/FiveStar.styled.js"),require("../../../dashboard-review-popup/components/Form.styled.js"),require("../../../dashboard-review-popup/components/ZeroState.js"),require("../../../dashboard-review-popup/DashboardReviewPopUp.styled.js"),require("../../../testimonial-card/TestimonialCard.style.js"),require("../../../slider/slider.js"),require("react-slick"),require("../../../carousel-preview/CarouselPreview.style.js"),require("../../../template-preview/RCS/RCSPreview.styled.js"),require("../../../card-selector/CardSelector.styled.js"),require("../../../action-button/ActionButton.styled.js"),require("../../../floating-input-dropdown/FloatingInputDropdown.js"),require("../../../dropdown/MultilevelDropdownPopover/index.js"),require("../../../multi-level-dropdown/MultiLevelDropdown.styled.js"),require("../../../data-source-panel/DataSourceInfoFooter.js"),require("../../../data-source-panel/DataSourcePanel.style.js"),require("../../../data-source-panel/model.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.js"),require("../../../unsatisfactory-response-list/UnsatisfactoryResponseList.style.js");var n=require("chart.js"),o=require("react-chartjs-2");function u(g){return g&&"object"==typeof g&&"default"in g?g:{default:g}}var b=u(g);n.Chart.register(n.ArcElement,n.Legend);const p=g=>({plugins:{legend:{display:!1},tooltip:{enabled:!0,callbacks:{label:I=>{var e;if(!I.label)return" 0%";const C=I.dataset.data.reduce(((g,I)=>g+I),0),A=parseFloat((I.raw/C*100).toFixed(1)),{label:r,raw:l}=I,i=null!==(e=null==g?void 0:g.symbol)&&void 0!==e?e:"",c=null==g?void 0:g.isInternationalStore;return[` ${r}`,` ${i}${void 0!==c?c?s.truncateValueForInternationalStore(l):s.truncateValueForIndianStore(l):l} (${A}% of ${i}${void 0!==c?c?s.truncateValueForInternationalStore(C):s.truncateValueForIndianStore(C):C})`]}}}}}),G=["#5E07BB","#9E77ED","#D2AEFF","#CDE1FF","#92AFFA","#3935E1"],y=b.default("div","production"===process.env.NODE_ENV?{target:"elaov7f0"}:{target:"elaov7f0",label:"CartStyled"})("background:",(g=>r.COLORS.surface.standard),";border:1px solid ",(g=>r.COLORS.stroke.primary),";border-radius:4px;"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxu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BsYXk6IGZhbHNlLFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgdG9vbHRpcDoge1xyXG4gICAgICAgICAgICBlbmFibGVkOiB0cnVlLFxyXG4gICAgICAgICAgICBjYWxsYmFja3M6IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRD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ICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRle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gICAgcmV0dXJuIChfanN4cyhfRnJhZ21lbnQsIHsgY2hpbGRyZW46IFtfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6IGhpZGVUaXRsZSB8fCAodGl0bGUgPT09IG51bGwgfHwgdGl0bGUgPT09IHZvaWQgMCA/IHZvaWQgMCA6IHRpdGxlLmxlbmd0aCkgPT09IDAgPyAnZmxleC1lbmQnIDogJ3NwYWNlLWJldHdlZW4nLFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICA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gT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyhjdXJyZW5jeVByb3BzKSksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMzAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICcxMDAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyZmxvd1k6ICdhdXRvJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogX2pzeChQaWVDaGFydCwgeyBzbGljZXM6IHNsaWNlc1dpdGhDb2xvciB9KSB9KSldIH0pKSB9KSkpLCBzaG93QmFyQ2hhcnQgJiYgYmFyQ2hhcnREYXRhICYmIChfanN4KFN0eWxlZE1vZGFsLCBPYmplY3QuYXNzaWduKHsgb3Blbjogc2hvd0JhckNoYXJ0LCBvbkNsb3NlOiAoKSA9PiBzZXRTaG93QmFyQ2hhcnQoZmFsc2UpLCBjbG9zZU9uT3V0c2lkZUNsaWNrOiB0cnVlLCBoZWFkaW5nVGl0bGU6IHRpdGxlLCB3aWR0aDogXCI4NSVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/IHZvaWQgMCA6IGJhckNoYXJ0RGF0YS5iYXJDb2xvclJHQkEgfSkgfSkpIH0pKSldIH0pKTtcclxufTtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9UGllQ2hhcnRBbmFseXRpY3MuanMubWFwIl19 */"));exports.Card=g=>I.jsx(y,Object.assign({style:{padding:24}},{children:g.children})),exports.PieChartAnalytics=g=>{let{title:r,slices:s,size:n,allowChartPopup:u,showConvertToBarChart:b,truncateSlices:y,barChartXAxisTitle:h,barChartYAxisTitle:X,hideTitle:m=!1,currencyProps:B}=g;const[x,j]=l.useState(!1),[Z,H]=l.useState(!1),[N,W]=l.useState([]),[Y,R]=l.useState(),[J,V]=l.useState(),[F,S]=l.useState([]),[v,w]=l.useState(null);return l.useEffect((()=>{const g=s.reduce(((g,I)=>g+I.count),0);let I=[];if(I=Object.keys(s).map(((g,I)=>Object.assign({color:G[I%G.length]},s[g]))),W([...I]),0===g){R({datasets:[{data:[100],backgroundColor:["#F0F0F0"],borderWidth:0}],labels:[]})}else{const g={labels:s.map((g=>A.default.capitalizeEachWord(g.name))),datasets:[{data:s.map((g=>g.count)),backgroundColor:s.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};R(g)}if(y&&s.length>y){const g=s.slice(0,y),I=s.slice(y).reduce(((g,I)=>g+I.count),0);g.push({name:"Other",count:I});const e={labels:g.map((g=>A.default.capitalize(g.name))),datasets:[{data:g.map((g=>g.count)),backgroundColor:g.map(((g,I)=>{var e;return null!==(e=g.color)&&void 0!==e?e:G[I%G.length]})),borderColor:["white","white","white","white","white","white"],borderWidth:4,borderRadius:8}]};V(e);const C=g.map(((g,I)=>Object.assign({color:G[I%G.length]},g)));S(C)}b&&w(((g,I,e)=>({xAxis:{data:g.map((g=>g.name)),title:null!=I?I:""},yAxis:{data:g.map((g=>g.count)),title:null!=e?e:""},barColorRGBA:{r:210,g:174,b:255,a:1}}))(s,h,X))}),[s,y]),Y?I.jsxs(I.Fragment,{children:[I.jsxs("div",Object.assign({style:{display:"flex",justifyContent:m||0===(null==r?void 0:r.length)?"flex-end":"space-between"}},{children:[!m&&r&&I.jsx(i.TitleMedium,Object.assign({style:{marginBottom:16}},{children:r})),I.jsxs("div",{children:[b&&I.jsx(c.IconButton,{Icon:e.default,onClick:()=>{H(!0)}}),u&&I.jsx(c.IconButton,{Icon:C.default,onClick:()=>{j(!0)}})]})]})),I.jsxs("div",Object.assign({className:"row"},{children:[I.jsx("div",Object.assign({className:"col-6 ",style:{display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx("div",Object.assign({style:{width:n,height:n}},{children:I.jsx(o.Doughnut,{data:y?J:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({className:"col-6",style:{paddingLeft:48,display:"flex",flexDirection:"column",justifyContent:"flex-start"}},{children:I.jsx(a.PieChart,{slices:y?F:N,size:n})}))]})),x&&I.jsx(t.StyledModal,Object.assign({open:x,onClose:()=>j(!1),closeOnOutsideClick:!0,headingTitle:r,width:"75%"},{children:I.jsxs("div",Object.assign({style:{padding:24,display:"flex",justifyContent:"space-between",height:"80vh"}},{children:[I.jsx("div",Object.assign({style:{width:"55%",marginLeft:"4%"}},{children:I.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:I.jsx(o.Doughnut,{data:Y,options:Object.assign(Object.assign({},p(B)),{maintainAspectRatio:!n})})}))})),I.jsx("div",Object.assign({style:{width:"30%",height:"100%",overflowY:"auto"}},{children:I.jsx(a.PieChart,{slices:N})}))]}))})),Z&&v&&I.jsx(t.StyledModal,Object.assign({open:Z,onClose:()=>H(!1),closeOnOutsideClick:!0,headingTitle:r,width:"85%"},{children:I.jsx("div",Object.assign({style:{padding:"24px 0"}},{children:I.jsx(d.VerticalGraph,{xAxis:v.xAxis,yAxis:v.yAxis,barColorRGBA:null==v?void 0:v.barColorRGBA})}))}))]}):I.jsx(I.Fragment,{})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("react-slick"),t=require("./CarouselPreview.style.js"),l=require("./CarouselPreviewCard.js"),n=require("../template-context-mapper/context/templateModalContext.js"),s=require("./CustomCarouselArrows.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=i(r),d=i(o);const u=a.default.forwardRef((r=>{let{channel:o,template:i,isPreview:a,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:p}=r;var m,C,w;const x=null===(m=null==i?void 0:i.components)||void 0===m?void 0:m[1].cards,{sliderRef:j,selectedCarouselIndex:f,cardCount:h,setIsCarouselHovered:g}=n.useTemplateModalContext();return e.jsxs(t.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:p},{children:[e.jsx(l.default,{channel:o,currentTemplate:i,carouselCardIndex:-1,isPreview:a,width:"77%"}),!!(null==x?void 0:x.length)&&e.jsx(t.CarouselSlickContainer,Object.assign({cardCount:null!=h?h:0,selectedCarouselIndex:null!=f?f:-1,onMouseEnter:()=>null==g?void 0:g(!0),onMouseLeave:()=>null==g?void 0:g(!1)},{children:e.jsx(d.default,Object.assign({ref:j,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!a,centerMode:!0,arrows:v,adaptiveHeight:!0,nextArrow:e.jsx(s.CustomCarouselRightArrow,{isPreview:null!=a&&a}),prevArrow:e.jsx(s.CustomCarouselLeftArrow,{isPreview:null!=a&&a})},{children:null===(w=null===(C=null==i?void 0:i.components)||void 0===C?void 0:C[1].cards)||void 0===w?void 0:w.map(((r,t)=>{var n,s;const d={components:r.components,mapping:null===(s=null===(n=null==i?void 0:i.mapping)||void 0===n?void 0:n.cards)||void 0===s?void 0:s[t]};return e.jsx(l.default,{channel:o,currentTemplate:d,carouselCardIndex:t,isPreview:a,width:"100%"},t)}))}))}))]}))}));exports.CarouselPreview=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("react-slick"),l=require("./CarouselPreview.style.js"),o=require("./CarouselPreviewCard.js"),s=require("../template-context-mapper/context/templateModalContext.js"),n=require("../template-preview/helpers/templateMiscHelper.js"),a=require("../template-preview/RCS/RCSPreview.styled.js"),i=require("./CustomCarouselArrows.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(r),c=d(t);const v=u.default.forwardRef((r=>{let{channel:t,template:i,isPreview:d,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:C}=r;var w,m;const{sliderRef:x,selectedCarouselIndex:j,cardCount:h,setIsCarouselHovered:f,cardIndex:P}=s.useTemplateModalContext(),R=-1==P?n.determineCardIndex(t):P,g=null===(m=null===(w=null==i?void 0:i.components)||void 0===w?void 0:w[R])||void 0===m?void 0:m.cards,I=(null==g?void 0:g.length)?e.jsx(p,{cards:g,cardCount:null!=h?h:0,selectedCarouselIndex:null!=j?j:-1,sliderRef:x,isPreview:d,showArrows:v,channel:t,template:i,setIsCarouselHovered:f}):null;return n.isRCSChannel(t)?e.jsx(a.RCSCarousalContainer,Object.assign({borderRadius:c},{children:I})):e.jsxs(l.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:C},{children:[e.jsx(o.default,{channel:t,currentTemplate:i,carouselCardIndex:-1,isPreview:d,width:"77%"}),I]}))})),p=r=>{let{cards:t,cardCount:s,selectedCarouselIndex:n,sliderRef:a,isPreview:d,showArrows:u,channel:v,template:p,setIsCarouselHovered:C}=r;return e.jsx(l.CarouselSlickContainer,Object.assign({cardCount:s,selectedCarouselIndex:n,onMouseEnter:()=>null==C?void 0:C(!0),onMouseLeave:()=>null==C?void 0:C(!1)},{children:e.jsx(c.default,Object.assign({ref:a,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:u,adaptiveHeight:!0,nextArrow:e.jsx(i.CustomCarouselRightArrow,{isPreview:null!=d&&d}),prevArrow:e.jsx(i.CustomCarouselLeftArrow,{isPreview:null!=d&&d})},{children:null==t?void 0:t.map(((r,t)=>{var l,s;const n={components:r.components,mapping:null===(s=null===(l=null==p?void 0:p.mapping)||void 0===l?void 0:l.cards)||void 0===s?void 0:s[t],content:null==p?void 0:p.content,templateType:null==p?void 0:p.templateType};return e.jsx(o.default,{channel:v,currentTemplate:n,carouselCardIndex:t,isPreview:d,width:"100%"},t)}))}))}))};exports.CarouselPreview=v;
@@ -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("../variable-picker-v3/model.js"),require("../template-preview/models/TemplateMeta.js"),require("../template-preview/models/WhatsAppTemplate.js"),require("../template-preview/models/Channels.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:h}=r.useTemplateModalContext(),v=(null!==(m=null===(d=null===(o=null==h?void 0:h.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,height:(null!=p?p:-1)>-1?"100%":"auto"}},{children:e.jsx(a.TemplatePreview,{showSampleValues:s,template:l,channel:i,size:"small",hideHeader:!0,carouselCardIndex:p,isWhatsappCarousel:!0,isPreview:n,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:v,height:"100%"}}})}))}));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");require("../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../constants/Theme.js"),require("../curtain/CurtainHelper.js"),require("../variable-picker-v3/model.js"),require("../template-preview/models/TemplateMeta.js"),require("../template-preview/models/WhatsAppTemplate.js"),require("../template-preview/models/Channels.js");var i=require("../template-preview/helpers/templateMiscHelper.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const s=l(t).default.forwardRef((t=>{let{channel:l,currentTemplate:s,showSampleValues:p,carouselCardIndex:n,isPreview:u,width:d}=t;var o,m,c;const{cardWidth:v,template:h,cardIndex:w}=r.useTemplateModalContext(),j=-1==w?i.determineCardIndex(l):w,q=(null!==(c=null===(m=null===(o=null==h?void 0:h.components)||void 0===o?void 0:o[j].cards)||void 0===m?void 0:m.length)&&void 0!==c?c:0)-1===n?12:0;return e.jsx("div",Object.assign({style:{width:d||v,height:(null!=n?n:-1)>-1?"100%":"auto"}},{children:e.jsx(a.TemplatePreview,{showSampleValues:p,template:s,channel:l,size:"small",hideHeader:!0,carouselCardIndex:n,isWhatsappCarousel:!0,isPreview:u,whatsAppSpecificMeta:{templateContainerStyles:{marginRight:q,height:"100%"}}})}))}));exports.default=s;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/chevronLeft.svg.js"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("../../constants/Theme.js"),n=require("../template-context-mapper/context/templateModalContext.js");exports.CustomCarouselLeftArrow=t=>{const{className:o,style:r,onClick:a,isPreview:c}=t,{selectedCarouselIndex:i,setSelectedCarouselIndex:u}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)<1||c||null==u||u((null!=i?i:-1)-1)}},{children:e.jsx(s.default,{height:10,width:10,color:l.COLORS.content.primary})}))},exports.CustomCarouselRightArrow=s=>{const{className:o,style:r,onClick:a,isPreview:c}=s,{selectedCarouselIndex:i,setSelectedCarouselIndex:u,cardCount:d}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{console.log("onClick",i,d),null==a||a(e),(null!=i?i:-1)>=(null!=d?d:-1)-1||c||null==u||u((null!=i?i:-1)+1)}},{children:e.jsx(t.default,{height:10,width:10,color:l.COLORS.content.primary})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../assets/icons/chevronLeft.svg.js"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("../../constants/Theme.js"),n=require("../template-context-mapper/context/templateModalContext.js");exports.CustomCarouselLeftArrow=t=>{const{className:o,style:r,onClick:a,isPreview:c}=t,{selectedCarouselIndex:i,setSelectedCarouselIndex:u}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)<1||c||null==u||u((null!=i?i:-1)-1)}},{children:e.jsx(s.default,{height:10,width:10,color:l.COLORS.content.primary})}))},exports.CustomCarouselRightArrow=s=>{const{className:o,style:r,onClick:a,isPreview:c}=s,{selectedCarouselIndex:i,setSelectedCarouselIndex:u,cardCount:d}=n.useTemplateModalContext();return e.jsx("div",Object.assign({className:o,style:Object.assign(Object.assign({},r),{display:a&&(null!=i?i:-1)>-1||c?"flex":"none",content:"none"}),onClick:e=>{null==a||a(e),(null!=i?i:-1)>=(null!=d?d:-1)-1||c||null==u||u((null!=i?i:-1)+1)}},{children:e.jsx(t.default,{height:10,width:10,color:l.COLORS.content.primary})}))};
@@ -14,5 +14,6 @@ export type DropdownProps = OpenDropdownProps & {
14
14
  truncatedText?: boolean;
15
15
  'data-test'?: string;
16
16
  showLeadingIconInPlaceholder?: boolean;
17
+ showTrailingIconPlaceholder?: boolean;
17
18
  };
18
19
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),l=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),r=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function u(){}const c=c=>{var p,h,v,x,g,{placeHolder:j,size:f,onSelect:w,defaultOptions:S,disabled:b,noErrorHint:I,placeHolderHeight:O,showPlaceholderWhenSelected:m=!1,inputStyle:y={},inputType:D="default",onDeleteChip:q,truncatedText:H,showLeadingIconInPlaceholder:C=!1}=c,P=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder"]);const[T,E]=n.useState(!1),_=null!=f?f:"default",z=n.useRef(),[W,A]=n.useState(null!=S?S:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==P?void 0:P.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),A([...t])}),[P.options]),n.useEffect((()=>{S&&A([...S])}),[S]);const L=d.getSelectedOptionsAsText(W);return t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("x-small"===_?24:"small"===_?32:48),width:null!==(h=null!==(p=P.buttonWidth)&&void 0!==p?p:P.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===_?"4px 8px":"6px 8px"},y),input:{minHeight:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":P["data-test"],ref:z,onSelect:function(e){Array.isArray(e)?A([...e]):A([e]),null==w||w(e)},disabled:b,onDropdownVisbilityChange:e=>E(e)},P,{children:["default"==D&&t.jsx(i.Input,{version:P.version,noErrorHint:I,state:b?"disabled":"none",value:m?j:null!=L?L:"",errorMessage:P.error,variant:_,placeholder:null!=j?j:"Select an option",width:null!==(v=P.width)&&void 0!==v?v:"100%",onChangeText:u,leftIcon:C&&(null===(x=W[0])||void 0===x?void 0:x.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=W[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>t.jsx(l.default,{style:{transform:T?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===_?16:"small"===_?20:24,height:"x-small"===_?16:"small"===_?20:24,color:o.COLORS.content.primary})},truncateText:null==H||H}),"chip"==D&&t.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:W,onDeleteChip:e=>{null==q||q(e)},isDropdownOpened:T,sizeToUse:_,containerStyle:{width:null!==(g=P.width)&&void 0!==g?g:"100%",cursor:"pointer"}})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),l=require("../../constants/Theme.js"),o=require("../../assets/icons/chevronDown.svg.js"),i=require("../input/Input.js"),r=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function u(){}const c=c=>{var p,h,v,g,x,{placeHolder:j,size:f,onSelect:w,defaultOptions:I,disabled:b,noErrorHint:y,placeHolderHeight:O,showPlaceholderWhenSelected:S=!1,inputStyle:m={},inputType:D="default",onDeleteChip:P,truncatedText:T,showLeadingIconInPlaceholder:q=!1,showTrailingIconPlaceholder:H=!1}=c,C=e.__rest(c,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder"]);const[E,_]=n.useState(!1),z=null!=f?f:"default",W=n.useRef(),[A,L]=n.useState(null!=I?I:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==C?void 0:C.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),L([...t])}),[C.options]),n.useEffect((()=>{I&&L([...I])}),[I]);const M=d.getSelectedOptionsAsText(A);return t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign({height:O||("x-small"===z?24:"small"===z?32:48),width:null!==(h=null!==(p=C.buttonWidth)&&void 0!==p?p:C.width)&&void 0!==h?h:"100%",zIndex:1,cursor:"pointer",padding:"x-small"===z?"4px 8px":"6px 8px"},m),input:{minHeight:"100%"}}},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":C["data-test"],ref:W,onSelect:function(e){Array.isArray(e)?L([...e]):L([e]),null==w||w(e)},disabled:b,onDropdownVisbilityChange:e=>_(e)},C,{children:["default"==D&&t.jsx(i.Input,{version:C.version,noErrorHint:y,state:b?"disabled":"none",value:S?j:null!=M?M:"",errorMessage:C.error,variant:z,placeholder:null!=j?j:"Select an option",width:null!==(v=C.width)&&void 0!==v?v:"100%",onChangeText:u,leftIcon:q&&(null===(g=A[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=A[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[H&&(null===(e=A[0])||void 0===e?void 0:e.trailingIcon),t.jsx(o.default,{style:{transform:E?"rotate(180deg)":"rotate(0deg)"},onClick:u,width:"x-small"===z?16:"small"===z?20:24,height:"x-small"===z?16:"small"===z?20:24,color:l.COLORS.content.primary})]}))}},truncateText:null==T||T}),"chip"==D&&t.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:A,onDeleteChip:e=>{null==P||P(e)},isDropdownOpened:E,sizeToUse:z,containerStyle:{width:null!==(x=C.width)&&void 0!==x?x:"100%",cursor:"pointer"}})]}))}))};c.displayName="Dropdown",exports.Dropdown=c;
@@ -2,11 +2,12 @@ import React from 'react';
2
2
  export type ShimmerImageProps = {
3
3
  imageUrl: string;
4
4
  width: number | string;
5
- height: number;
5
+ height: number | string;
6
6
  alt?: string;
7
7
  borderRadius?: number;
8
8
  defaultImageUrl?: string;
9
9
  useDynamicInfoImageSize?: boolean;
10
+ imagePreviewStyles?: React.CSSProperties;
10
11
  };
11
12
  export declare const DEFAULT_IMAGE = "https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";
12
13
  export declare const ShimmerImage: React.FC<ShimmerImageProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../shimmer/ShimmerComponent/BikShimmer.js");const r="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=r,exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:n,alt:c,useDynamicInfoImageSize:d,defaultImageUrl:m=r}=s;const[u,h]=t.useState(!0),[g,b]=t.useState(!1);return t.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{b(!1),h(!1)},e.onerror=()=>{b(!0),h(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:Object.assign(Object.assign({position:"relative",width:d?`min(100%, ${o}px)`:o},d?{aspectRatio:1}:{height:l}),{borderRadius:n})},{children:[u&&e.jsx(i.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),g?e.jsx("img",{src:m,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("img",{src:a,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:u?"none":"block",width:"100%",height:"100%",objectFit:"cover"}})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../shimmer/ShimmerComponent/BikShimmer.js");const r="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=r,exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:n,alt:c,useDynamicInfoImageSize:m,defaultImageUrl:d=r,imagePreviewStyles:u}=s;const[g,h]=t.useState(!0),[b,p]=t.useState(!1);return t.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{p(!1),h(!1)},e.onerror=()=>{p(!0),h(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:Object.assign(Object.assign({position:"relative",width:m?`min(100%, ${o}px)`:o},m?{aspectRatio:1}:{height:l}),{borderRadius:n})},{children:[g&&e.jsx(i.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),b?e.jsx("img",{src:d,alt:null!=c?c:"Image",style:{borderRadius:null!=n?n:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("img",{src:a,alt:null!=c?c:"Image",style:Object.assign({borderRadius:null!=n?n:0,display:g?"none":"block",width:"100%",height:"100%",objectFit:"cover"},u)})]}))};
@@ -6,7 +6,8 @@ export declare enum StateInterface {
6
6
  ERROR = "error",
7
7
  WARNING = "warning",
8
8
  LOADING = "loading",
9
- RETRY = "retry"
9
+ RETRY = "retry",
10
+ INFO = "info"
10
11
  }
11
12
  export declare enum ButtonActions {
12
13
  CANCEL = "cancel",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,s,n=require("react/jsx-runtime"),r=require("../../constants/Theme.js"),o=require("../../assets/icons/errorIcon.svg.js"),i=require("../../assets/icons/retryIcon.svg.js"),a=require("../../assets/icons/successIcon.svg.js"),c=require("../../assets/icons/warningIcon.svg.js"),u=require("../button/Button.js"),d=require("../spinner/Spinner.js"),l=require("../TypographyStyle.js"),x=require("./StateComponent.styled.js");exports.StateInterface=void 0,(t=exports.StateInterface||(exports.StateInterface={})).SUCCESS="success",t.ERROR="error",t.WARNING="warning",t.LOADING="loading",t.RETRY="retry",exports.ButtonActions=void 0,(e=exports.ButtonActions||(exports.ButtonActions={})).CANCEL="cancel",e.OTHER="other",exports.ButtonTypes=void 0,(s=exports.ButtonTypes||(exports.ButtonTypes={})).SINGLE="SINGLE",s.DOUBLE="DOUBLE";exports.StateComponent=t=>{var e;const s=()=>p==exports.StateInterface.SUCCESS?n.jsx(a.default,{}):p==exports.StateInterface.WARNING?n.jsx(c.default,{}):p==exports.StateInterface.ERROR?n.jsx(o.default,{}):p===exports.StateInterface.LOADING?n.jsx(d.Spinner,{size:"large"}):p===exports.StateInterface.RETRY?n.jsx(i.default,{}):void 0,{states:p,heading:j,subline:S,icon:h=s(),isButtonEnabled:g,type:y,buttonText:B,buttonType:I,onButtonClick:L,leadingIcon:O,width:T,headerImage:C,iconWidth:R,iconHeight:b,closeButtonType:E,secondaryButtonText:m,"data-test":A}=t;return n.jsxs(x.StateComponentContainer,Object.assign({width:T,"data-test":A},{children:[n.jsx(x.StateIcon,Object.assign({iconWidth:R,iconHeight:b},{children:C?n.jsx("img",{src:C,width:"100%",height:"auto",alt:""}):h})),n.jsxs(x.StateHeading,Object.assign({size:t.size},{children:["SMALL"===t.size&&n.jsx(l.TitleRegular,{children:j}),"SMALL"!==t.size&&n.jsx(l.TitleMedium,{children:j})]})),n.jsxs(x.StateSubline,{children:["SMALL"!==t.size&&n.jsx(l.BodyPrimary,Object.assign({color:r.COLORS.content.secondary},{children:S})),"SMALL"===t.size&&n.jsx(l.BodySecondary,Object.assign({color:r.COLORS.content.secondary},{children:S}))]}),null!==(e=t.children)&&void 0!==e?e:n.jsx(n.Fragment,{}),g&&n.jsx(n.Fragment,{children:n.jsxs(x.ButtonContainer,Object.assign({size:t.size},{children:[y==exports.ButtonTypes.DOUBLE&&n.jsx(u.Button,{"data-test":`${A}-cancel`,onClick:()=>L&&L(exports.ButtonActions.CANCEL),buttonType:E||"secondary",buttonText:m||"Cancel",matchParentWidth:!0}),n.jsx(u.Button,{"data-test":`${A}-primary`,onClick:()=>L&&L(exports.ButtonActions.OTHER),buttonType:null!=I?I:"primary",LeadingIcon:O,buttonText:null!=B?B:"Retry",matchParentWidth:!0})]}))})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,s,n=require("react/jsx-runtime"),r=require("../../constants/Theme.js"),o=require("../../assets/icons/errorIcon.svg.js"),i=require("../../assets/icons/retryIcon.svg.js"),a=require("../../assets/icons/successIcon.svg.js"),c=require("../../assets/icons/warningIcon.svg.js"),u=require("../../assets/icons/state_icon.svg.js"),d=require("../button/Button.js"),l=require("../spinner/Spinner.js"),x=require("../TypographyStyle.js"),p=require("./StateComponent.styled.js");exports.StateInterface=void 0,(e=exports.StateInterface||(exports.StateInterface={})).SUCCESS="success",e.ERROR="error",e.WARNING="warning",e.LOADING="loading",e.RETRY="retry",e.INFO="info",exports.ButtonActions=void 0,(t=exports.ButtonActions||(exports.ButtonActions={})).CANCEL="cancel",t.OTHER="other",exports.ButtonTypes=void 0,(s=exports.ButtonTypes||(exports.ButtonTypes={})).SINGLE="SINGLE",s.DOUBLE="DOUBLE";exports.StateComponent=e=>{var t;const s=()=>j==exports.StateInterface.SUCCESS?n.jsx(a.default,{}):j==exports.StateInterface.WARNING?n.jsx(c.default,{}):j==exports.StateInterface.ERROR?n.jsx(o.default,{}):j===exports.StateInterface.LOADING?n.jsx(l.Spinner,{size:"large"}):j===exports.StateInterface.RETRY?n.jsx(i.default,{}):j==exports.StateInterface.INFO?n.jsx(u.default,{}):void 0,{states:j,heading:S,subline:h,icon:g=s(),isButtonEnabled:y,type:I,buttonText:B,buttonType:O,onButtonClick:L,leadingIcon:T,width:C,headerImage:R,iconWidth:b,iconHeight:f,closeButtonType:E,secondaryButtonText:m,"data-test":A}=e;return n.jsxs(p.StateComponentContainer,Object.assign({width:C,"data-test":A},{children:[n.jsx(p.StateIcon,Object.assign({iconWidth:b,iconHeight:f},{children:R?n.jsx("img",{src:R,width:"100%",height:"auto",alt:""}):g})),n.jsxs(p.StateHeading,Object.assign({size:e.size},{children:["SMALL"===e.size&&n.jsx(x.TitleRegular,{children:S}),"SMALL"!==e.size&&n.jsx(x.TitleMedium,{children:S})]})),n.jsxs(p.StateSubline,{children:["SMALL"!==e.size&&n.jsx(x.BodyPrimary,Object.assign({color:r.COLORS.content.secondary},{children:h})),"SMALL"===e.size&&n.jsx(x.BodySecondary,Object.assign({color:r.COLORS.content.secondary},{children:h}))]}),null!==(t=e.children)&&void 0!==t?t:n.jsx(n.Fragment,{}),y&&n.jsx(n.Fragment,{children:n.jsxs(p.ButtonContainer,Object.assign({size:e.size},{children:[I==exports.ButtonTypes.DOUBLE&&n.jsx(d.Button,{"data-test":`${A}-cancel`,onClick:()=>L&&L(exports.ButtonActions.CANCEL),buttonType:E||"secondary",buttonText:m||"Cancel",matchParentWidth:!0}),n.jsx(d.Button,{"data-test":`${A}-primary`,onClick:()=>L&&L(exports.ButtonActions.OTHER),buttonType:null!=O?O:"primary",LeadingIcon:T,buttonText:null!=B?B:"Retry",matchParentWidth:!0})]}))})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),o=require("../../utils/StringUtils.js"),a=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/models/Channels.js"),s=require("../template-preview/models/WhatsAppTemplate.js"),n=require("./context/templateModalContext.js"),d=require("./modalElements/Footer.js"),u=require("./modalElements/TemplateAnalyticsComponent.js"),c=require("./modalElements/TemplateSelectModalContent.js"),p=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=v=>{var m,C,h,b,S,E,f,x,P,T;const{selectedTemplate:g,closeDialog:y,showVariableMapping:I,channel:L,htmlContent:A,templateVariables:D,onTemplateSelect:j,globalPlaceholders:w,showOnlyContent:k,whatsappSpecificPickerMeta:H,zIndex:N,showVariableModal:V,variableList:M,discountCode:O,setDiscountCode:B,onBackPress:q,enabledCustomText:F,variableListForImage:_,showSampleValues:W,disableEditVariable:Y,pod:R,extras:$,pickerConf:U,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:G,onDeleteSelectedProducts:J,fileName:K,setFileName:X,hideDeviceContainerInPreview:Z,maxCharLimit:ee,onDefaultVariableSelect:te,skipDefaultVariableContent:le,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re,footerButtonText:se,footerInfoText:ne,templateAnalytics:de}=v;l.useEffect((()=>{be(A)}),[A]);const ue=L===r.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(C=null===(m=null==g?void 0:g.components)||void 0===m?void 0:m[1])||void 0===C?void 0:C.type),ce=null==g?void 0:g.isProductCarouselType,[pe,ve]=l.useState(L===r.CHANNEL_TYPE.EMAIL||L==r.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(A),[Se,Ee]=l.useState(!1),[fe,xe]=l.useState([]),[Pe,Te]=l.useState({}),[ge,ye]=l.useState(g),[Ie,Le]=l.useState([]),[Ae,De]=l.useState(null),[je,we]=l.useState(!1),[ke,He]=l.useState(null!=D?D:[]),[Ne,Ve]=l.useState(!1),[Me,Oe]=l.useState(ue?(null===(b=null===(h=null==ge?void 0:ge.mapping)||void 0===h?void 0:h.body)||void 0===b?void 0:b.length)?-1:0:-1),[Be,qe]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,Ue]=l.useState(!1),[ze,Qe]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?qe(z):ce&&qe([])}),[z]),l.useEffect((()=>{var e;if(!je&&ce&&(!z||0===qe.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[1].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,o,a;"HEADER"===e.type&&l.push(null!==(a=null===(o=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===o?void 0:o[0])&&void 0!==a?a:"")}))})),Le(l),we(!0)}}),[je]);const tt=l.useMemo((()=>p.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(M))}),[M]),(null==de?void 0:de.show)&&Ge&&de.templateQuality&&Object.values(s.TEMPLATE_QUALITY).find((e=>e===String(de.templateQuality)))?e.jsx(u.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(S=null==ge?void 0:ge.category)&&void 0!==S?S:"")} • ${null!==(E=null==ge?void 0:ge.templateCategory)&&void 0!==E?E:""}`:"",templateAnalytics:de,onClose:()=>{null==y||y(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(n.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:ze,setHideFooterButton:Qe,hideCrossButton:$e,setHideCrossButton:Ue,variableList:Fe,setVariableList:_e,variableCallback:Ae,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:He,isError:Se,setIsError:Ee,channel:L,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ne,setTemplateSelectionTriggered:Ve,enabledCustomText:F,disableEditVariable:Y,pod:R,extras:$,isWhatsappCarousel:ue,selectedCarouselIndex:Me,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Pe,cardCount:ue?null===(x=null===(f=g.components)||void 0===f?void 0:f[1].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:fe,setErrorIndexes:xe,pickerConf:U,carouselProducts:Be,setCarouselProducts:qe,disableEditExpiry:Q,cardWidth:G,cardImages:Ie,onDeleteSelectedProducts:J,hideDeviceContainerInPreview:Z,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:ee,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:te,disableDatePicker:oe,disableCopyCode:ae,initialExpiryDateTime:ie,showDiscountCodeExpiryInfo:re}},{children:k?e.jsx(c.default,{variableListFromProps:M,channel:r.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:N,centralContainerStyles:{width:ue?900:L===r.CHANNEL_TYPE.EMAIL&&I?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==y||y()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:L===r.CHANNEL_TYPE.WHATSAPP?`${o.default.capitaliseFirstLetterOfString(null!==(P=null==ge?void 0:ge.category)&&void 0!==P?P:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==de?void 0:de.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${a.COLORS.stroke.primary}`}},{children:[e.jsx(c.default,{variableListFromProps:M,showSampleValues:W,showVariableMapping:I,channel:L,whatsappSpecificPickerMeta:H,showVariableModal:V,discountCode:O,setDiscountCode:B,variableListForImage:_&&(null==_?void 0:_.length)>0?_:Fe,fileName:K,setFileName:e=>{null==X||X(e)},skipDefaultVariableContent:le}),j?e.jsx(d.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==Be?void 0:Be.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&R!==s.POD.CHATBOT)return void Ee(!0);const t=null==j?void 0:j(ge,ke,null!=he?he:"",Be);Te(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&xe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):Ve(!0)},footerButtonText:se,footerInfoText:ne}):e.jsx(e.Fragment,{})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),a=require("../../utils/StringUtils.js"),o=require("../../constants/Theme.js"),i=require("../modals/styledModal.js"),r=require("../template-preview/helpers/templateMiscHelper.js"),s=require("../template-preview/models/Channels.js"),n=require("../template-preview/models/WhatsAppTemplate.js"),d=require("./context/templateModalContext.js"),u=require("./modalElements/Footer.js"),c=require("./modalElements/TemplateAnalyticsComponent.js"),p=require("./modalElements/TemplateSelectModalContent.js"),v=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=m=>{var C,h,b,S,E,x,f,T;const{selectedTemplate:P,closeDialog:g,showVariableMapping:y,channel:I,htmlContent:L,templateVariables:j,onTemplateSelect:D,globalPlaceholders:w,showOnlyContent:A,whatsappSpecificPickerMeta:k,zIndex:M,showVariableModal:V,variableList:H,discountCode:N,setDiscountCode:O,onBackPress:q,enabledCustomText:B,variableListForImage:F,showSampleValues:_,disableEditVariable:W,pod:Y,extras:R,pickerConf:$,selectedCarouselProducts:z,disableEditExpiry:Q,cardWidth:U,onDeleteSelectedProducts:G,fileName:J,setFileName:K,hideDeviceContainerInPreview:X,maxCharLimit:Z,onDefaultVariableSelect:ee,skipDefaultVariableContent:te,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,footerButtonText:re,footerInfoText:se,templateAnalytics:ne}=m;l.useEffect((()=>{be(L)}),[L]);const de=r.determineCardIndex(I),ue=r.isItCarousal(I,P),ce=null==P?void 0:P.isProductCarouselType,[pe,ve]=l.useState(I===s.CHANNEL_TYPE.EMAIL||I==s.CHANNEL_TYPE.WEBPUSH||ue?"desktop":"mobile"),[me,Ce]=l.useState(!1),[he,be]=l.useState(L),[Se,Ee]=l.useState(!1),[xe,fe]=l.useState([]),[Te,Pe]=l.useState({}),[ge,ye]=l.useState(P),[Ie,Le]=l.useState([]),[je,De]=l.useState(null),[we,Ae]=l.useState(!1),[ke,Me]=l.useState(null!=j?j:[]),[Ve,He]=l.useState(!1),[Ne,Oe]=l.useState(ue?(null===(h=null===(C=null==ge?void 0:ge.mapping)||void 0===C?void 0:C.body)||void 0===h?void 0:h.length)?-1:0:-1),[qe,Be]=l.useState([]),[Fe,_e]=l.useState(void 0),We=l.useRef(null),[Ye,Re]=l.useState(!1),[$e,ze]=l.useState(!1),[Qe,Ue]=l.useState(!1),[Ge,Je]=l.useState(!0),[Ke,Xe]=l.useState(!0),[Ze,et]=l.useState({});l.useEffect((()=>{z?Be(z):ce&&Be([])}),[z]),l.useEffect((()=>{var e;if(!we&&ce&&(!z||0===Be.length)){const t=null===(e=null==ge?void 0:ge.components)||void 0===e?void 0:e[de].cards,l=[];null==t||t.forEach((e=>{var t;null===(t=null==e?void 0:e.components)||void 0===t||t.forEach((e=>{var t,a,o;"HEADER"===e.type&&l.push(null!==(o=null===(a=null===(t=e.example)||void 0===t?void 0:t.header_handle)||void 0===a?void 0:a[0])&&void 0!==o?o:"")}))})),Le(l),Ae(!0)}}),[we]);const tt=l.useMemo((()=>v.convertPlaceholdersToBikDropdown(w)),[w]);return l.useEffect((()=>{_e(t.cloneDeep(H))}),[H]),(null==ne?void 0:ne.show)&&Ge&&ne.templateQuality&&Object.values(n.TEMPLATE_QUALITY).find((e=>e===String(ne.templateQuality)))?e.jsx(c.TemplateAnalyticsComponent,{headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP?`${a.default.capitaliseFirstLetterOfString(null!==(b=null==ge?void 0:ge.category)&&void 0!==b?b:"")} • ${null!==(S=null==ge?void 0:ge.templateCategory)&&void 0!==S?S:""}`:"",templateAnalytics:ne,onClose:()=>{null==g||g(),Je(!1),Xe(!1)},onCancel:()=>{Je(!1),Xe(!1)},onProceed:()=>{Je(!1),Xe(!0)},templateId:(null==ge?void 0:ge.templateId)||""}):e.jsx(d.TemplateModalContext.Provider,Object.assign({value:{hideFooterButton:Qe,setHideFooterButton:Ue,hideCrossButton:$e,setHideCrossButton:ze,variableList:Fe,setVariableList:_e,variableCallback:je,setVariableCallback:De,showVariablePicker:me,setShowVariablePicker:Ce,template:ge,setTemplate:ye,device:pe,setDevice:ve,display_content:he,setDisplayContent:be,originalVariableList:ke,setOriginalVariableList:Me,isError:Se,setIsError:Ee,channel:I,globalNormalizedPlaceholders:tt,templateSelectionTriggered:Ve,setTemplateSelectionTriggered:He,enabledCustomText:B,disableEditVariable:W,pod:Y,extras:R,isWhatsappCarousel:ue,selectedCarouselIndex:Ne,setSelectedCarouselIndex:Oe,isProductCarouselType:ce,templateErrorIndexes:Te,cardCount:ue?null===(x=null===(E=P.components)||void 0===E?void 0:E[de].cards)||void 0===x?void 0:x.length:void 0,errorIndexes:xe,setErrorIndexes:fe,pickerConf:$,carouselProducts:qe,setCarouselProducts:Be,disableEditExpiry:Q,cardWidth:U,cardImages:Ie,onDeleteSelectedProducts:G,hideDeviceContainerInPreview:X,sliderRef:We,isCarouselHovered:Ye,setIsCarouselHovered:Re,maxCharLimit:Z,ctaOptionsErrors:Ze,setCtaOptionsErrors:et,onDefaultVariableSelect:ee,disableDatePicker:le,disableCopyCode:ae,initialExpiryDateTime:oe,showDiscountCodeExpiryInfo:ie,cardIndex:de}},{children:A?e.jsx(p.default,{variableListFromProps:H,channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(i.StyledModal,Object.assign({hideCrossButton:$e,zIndex:M,centralContainerStyles:{width:ue?900:I===s.CHANNEL_TYPE.EMAIL&&y?1e3:800},open:Ke,onClose:()=>{Xe(!1),null==g||g()},headingTitle:null==ge?void 0:ge.label,headingSubtitle:I===s.CHANNEL_TYPE.WHATSAPP||r.isRCSChannel(I)?`${a.default.capitaliseFirstLetterOfString(null!==(f=null==ge?void 0:ge.category)&&void 0!==f?f:"")} • ${null!==(T=null==ge?void 0:ge.templateCategory)&&void 0!==T?T:""}`:"",onBackPress:()=>{if(null==ne?void 0:ne.show)return Je(!0),void Xe(!1);null==q||q()},modalHeaderStyles:{borderBottom:`1px solid ${o.COLORS.stroke.primary}`}},{children:[e.jsx(p.default,{variableListFromProps:H,showSampleValues:_,showVariableMapping:y,channel:I,whatsappSpecificPickerMeta:k,showVariableModal:V,discountCode:N,setDiscountCode:O,variableListForImage:F&&(null==F?void 0:F.length)>0?F:Fe,fileName:J,setFileName:e=>{null==K||K(e)},skipDefaultVariableContent:te}),D?e.jsx(u.default,{isWhatsappCarousel:null!=ue&&ue,onSelect:function(){var e;if((null==qe?void 0:qe.length)<1&&ce)return void Ee(!0);if(Object.keys(Ze).length>0&&Y!==n.POD.CHATBOT)return void Ee(!0);const t=null==D?void 0:D(ge,ke,null!=he?he:"",qe);Pe(null!==(e=null==t?void 0:t.templateErrorIndexes)&&void 0!==e?e:{body:[],buttons:[]}),(null==t?void 0:t.errorIndexes)||(null==t?void 0:t.error)?((null==t?void 0:t.errorIndexes)&&fe(t.errorIndexes),(null==t?void 0:t.error)&&Ee(!!(null==t?void 0:t.error))):He(!0)},footerButtonText:re,footerInfoText:se}):e.jsx(e.Fragment,{})]}))}))};
@@ -78,6 +78,7 @@ export declare const TemplateModalContext: React.Context<{
78
78
  [key: string]: string;
79
79
  }>> | undefined;
80
80
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
81
+ cardIndex: number;
81
82
  }>;
82
83
  export declare const useTemplateModalContext: () => {
83
84
  showDiscountCodeExpiryInfo?: boolean | undefined;
@@ -149,4 +150,5 @@ export declare const useTemplateModalContext: () => {
149
150
  [key: string]: string;
150
151
  }>> | undefined;
151
152
  onDefaultVariableSelect?: ((variable: VariableV3) => void) | undefined;
153
+ cardIndex: number;
152
154
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../template-preview/models/Channels.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=a(e).default.createContext({hideFooterButton:!1,setHideFooterButton:()=>{},hideCrossButton:!1,setHideCrossButton:()=>{},variableList:[],setVariableList:()=>{},variableCallback:null,setVariableCallback:null,showVariablePicker:!1,setShowVariablePicker:()=>{},device:"desktop",templateSelectionTriggered:!1,display_content:null,originalVariableList:[],channel:t.CHANNEL_TYPE.EMAIL,template:null,isError:!1,enabledCustomText:!1,disableEditVariable:!1,disableEditExpiry:!1,disableDatePicker:!1,showDiscountCodeExpiryInfo:!1});exports.TemplateModalContext=l,exports.useTemplateModalContext=()=>e.useContext(l);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../template-preview/models/Channels.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=a(e).default.createContext({hideFooterButton:!1,setHideFooterButton:()=>{},hideCrossButton:!1,setHideCrossButton:()=>{},variableList:[],setVariableList:()=>{},variableCallback:null,setVariableCallback:null,showVariablePicker:!1,setShowVariablePicker:()=>{},device:"desktop",templateSelectionTriggered:!1,display_content:null,originalVariableList:[],channel:t.CHANNEL_TYPE.EMAIL,template:null,isError:!1,enabledCustomText:!1,disableEditVariable:!1,disableEditExpiry:!1,disableDatePicker:!1,showDiscountCodeExpiryInfo:!1,cardIndex:-1});exports.TemplateModalContext=l,exports.useTemplateModalContext=()=>e.useContext(l);
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var a=require("../../variable-picker-v3/model.js"),t=require("lodash"),i=require("react"),l=require("styled-components"),r=require("../../carousel-preview/CarouselPreview.js"),s=require("./EditWhatsAppCarouselTemplateV2.js"),o=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js"),require("../../template-preview/models/WhatsAppTemplate.js");var p=require("../../template-preview/models/Channels.js"),d=require("../../TypographyStyle.js"),u=require("../../variable-picker-v3/VariablePicker.js"),c=require("../context/templateModalContext.js"),h=require("../utils/constants.js"),m=require("../utils/getVariableNameEmail.js"),v=require("../utils/highlightFor.js"),w=require("./DesktopPreview.js"),C=require("./EditWebpushTemplate.js"),P=require("./EditWhatsAppTemplateV2.js"),b=require("./MobilePreview.js"),E=require("./VariableConnectorsPanel.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=f(l);const j=x.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../curtain/CurtainHelper.js");var a=require("../../variable-picker-v3/model.js"),t=require("lodash"),i=require("react"),l=require("styled-components"),r=require("../../carousel-preview/CarouselPreview.js"),s=require("./EditWhatsAppCarouselTemplateV2.js"),o=require("../../template-preview/TemplatePreview.js");require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var n=require("../../../constants/Theme.js");require("../../template-preview/models/TemplateMeta.js"),require("../../template-preview/models/WhatsAppTemplate.js");var p=require("../../template-preview/models/Channels.js"),d=require("../../TypographyStyle.js"),u=require("../../variable-picker-v3/VariablePicker.js"),c=require("../context/templateModalContext.js"),h=require("../utils/constants.js"),m=require("../utils/getVariableNameEmail.js"),C=require("../utils/highlightFor.js"),v=require("./DesktopPreview.js"),P=require("./EditWebpushTemplate.js"),w=require("./EditWhatsAppTemplateV2.js"),E=require("./MobilePreview.js"),b=require("./VariableConnectorsPanel.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=f(l);const A=x.default.div`
2
2
  display: flex;
3
3
  // height: 100%;
4
- `,g=x.default.div`
4
+ `,j=x.default.div`
5
5
  max-width: 450px;
6
6
  max-width: ${e=>e.channel===p.CHANNEL_TYPE.EMAIL?"400px":"450px"};
7
7
 
@@ -11,12 +11,12 @@
11
11
  border-left: ${n.COLORS.stroke.primary} 1px solid;
12
12
  border-top: ${e=>e.isWhatsappCarousel?`${n.COLORS.stroke.primary} 1px solid`:void 0};
13
13
  ${e=>!e.showVariableMapping&&"width: 340px; height: 500px"};
14
- `,A=x.default.div`
14
+ `,N=x.default.div`
15
15
  padding: ${e=>e.isWhatsappCarousel?void 0:e.showOnlyContent?"16px 14px":"16px 32px"};
16
16
  flex: 1;
17
17
  height: ${e=>e.isWhatsappCarousel||e.hideDeviceContainerInPreview?"500px":"475px"};
18
18
  overflow-y: auto;
19
19
  background-image: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.CHANNEL_TYPE.WHATSAPP?`url(${h.BACKGROUND_PREVIEW_IMAGE});`:"none"};
20
- display: ${e=>e.hideDeviceContainerInPreview&&e.channel===p.CHANNEL_TYPE.WHATSAPP?"flex":"initial"};
20
+ display: ${e=>!e.hideDeviceContainerInPreview||e.channel!==p.CHANNEL_TYPE.WHATSAPP&&e.channel!==p.CHANNEL_TYPE.RCS?"initial":"flex"};
21
21
  align-items: flex-start;
22
- `;exports.default=l=>{const{showVariableMapping:h,showOnlyContent:f,whatsappSpecificPickerMeta:x,showVariableModal:T,discountCode:N,setDiscountCode:S,variableListForImage:y,showSampleValues:k,variableListFromProps:L,fileName:V,setFileName:H,skipDefaultVariableContent:W}=l,q=i.useRef(),M=i.useRef(),{variableList:_,setVariableList:D,variableCallback:O,showVariablePicker:I,setShowVariablePicker:Y,device:B,display_content:F,channel:$,template:R,setTemplate:G,isWhatsappCarousel:U,isProductCarouselType:K,hideDeviceContainerInPreview:z,onDefaultVariableSelect:J}=c.useTemplateModalContext();const Q=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(j,{children:[e.jsx(A,Object.assign({showOnlyContent:f,showVariableMapping:h,isWhatsappCarousel:U,hideDeviceContainerInPreview:z,channel:$,skipDefaultVariableContent:W},{children:"mobile"===B?e.jsx(b.default,{ref:M,display_content:null!=F?F:"",channel:$,template:R,showSampleValues:k}):$===p.CHANNEL_TYPE.WHATSAPP&&U?e.jsx(r.CarouselPreview,{ref:q,channel:$,template:R,showSampleValues:k,isPreview:!1,showArrows:!0}):$===p.CHANNEL_TYPE.WEBPUSH?e.jsx(o.TemplatePreview,{showSampleValues:k,channel:$,hideHeader:!0,template:R}):$!==p.CHANNEL_TYPE.MESSAGE?e.jsx(w.default,{ref:q,channel:$,display_content:null!=F?F:"",showSampleValues:k}):e.jsx(e.Fragment,{})})),(K||h)&&e.jsxs(g,Object.assign({channel:$,isWhatsappCarousel:U,showVariableMapping:!0},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:"whatsapp"===$?428:400,display:I?"block":"none"}},{children:e.jsx(u.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{D(t.cloneDeep(L)),Y(!1)},onSelect:e=>{O(e),D(t.cloneDeep(L)),Y(!1)},type:a.PickerType.EMBEDDED,data:null!=_?_:[],onDefaultVariableSelect:J,skipDefaultVariableContent:W},Math.random())})),e.jsx("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===$||"webpush"==$?428:400,display:I?"none":"block"}},{children:$!==p.CHANNEL_TYPE.WHATSAPP?$==p.CHANNEL_TYPE.WEBPUSH?e.jsx(C.default,{whatsappSpecificPickerMeta:x,template:R,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T}):e.jsx(E.default,{onFocus:$===p.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===B?"template_html_mobile":"template_html_desktop"),r=m.getVariableNameForEmailByIndex(e+1),s=$===p.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(r):document.getElementById(r),o=Q(s),d=null==s?void 0:s.offsetLeft;"desktop"===B?o&&q.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=d?d:0,o),v.highlightFor(r,n.COLORS.background.warning.light,2,$,B)):o&&M.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=d?d:0,o),v.highlightFor(r,n.COLORS.background.warning.light,2,$,B))}:void 0,showVariableModal:T,discountCode:N,setDiscountCode:S}):$===p.CHANNEL_TYPE.WHATSAPP&&U?e.jsx(s.default,{whatsappSpecificPickerMeta:x,template:R,showVariableModal:T,variableListForImage:y,discountCode:N,setDiscountCode:S}):e.jsx(P.default,{whatsappSpecificPickerMeta:x,template:R,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T,variableListForImage:y,discountCode:N,setDiscountCode:S,fileName:V,setFileName:H})}))]})),[p.CHANNEL_TYPE.WHATSAPP,p.CHANNEL_TYPE.SMS].includes($)&&!h&&!K&&e.jsx(g,{children:e.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};
22
+ `;exports.default=l=>{const{showVariableMapping:h,showOnlyContent:f,whatsappSpecificPickerMeta:x,showVariableModal:T,discountCode:g,setDiscountCode:S,variableListForImage:L,showSampleValues:y,variableListFromProps:H,fileName:k,setFileName:V,skipDefaultVariableContent:_}=l,W=i.useRef(),q=i.useRef(),{variableList:M,setVariableList:D,variableCallback:O,showVariablePicker:Y,setShowVariablePicker:I,device:B,display_content:R,channel:F,template:$,setTemplate:G,isWhatsappCarousel:U,isProductCarouselType:K,hideDeviceContainerInPreview:z,onDefaultVariableSelect:J}=c.useTemplateModalContext();const Q=e=>{let a=0;for(;e;)a+=e.offsetTop,e=e.offsetParent;return a};return e.jsxs(A,{children:[e.jsx(N,Object.assign({showOnlyContent:f,showVariableMapping:h,isWhatsappCarousel:U,hideDeviceContainerInPreview:z,channel:F,skipDefaultVariableContent:_},{children:"mobile"===B?e.jsx(E.default,{ref:q,display_content:null!=R?R:"",channel:F,template:$,showSampleValues:y}):F!==p.CHANNEL_TYPE.WHATSAPP&&F!==p.CHANNEL_TYPE.RCS||!U?F===p.CHANNEL_TYPE.WEBPUSH?e.jsx(o.TemplatePreview,{showSampleValues:y,channel:F,hideHeader:!0,template:$}):F!==p.CHANNEL_TYPE.MESSAGE?e.jsx(v.default,{ref:W,channel:F,display_content:null!=R?R:"",showSampleValues:y}):e.jsx(e.Fragment,{}):e.jsx(r.CarouselPreview,{ref:W,channel:F,template:$,showSampleValues:y,isPreview:!0,showArrows:!0})})),(K||h)&&e.jsxs(j,Object.assign({channel:F,isWhatsappCarousel:U,showVariableMapping:!0},{children:[e.jsx("div",Object.assign({style:{height:"100%",width:"whatsapp"===F?428:400,display:Y?"block":"none"}},{children:e.jsx(u.VariablePicker,{hideHeaderCross:!0,showHeader:!0,showBackButton:!0,onBackButtonClick:()=>{D(t.cloneDeep(H)),I(!1)},onSelect:e=>{O(e),D(t.cloneDeep(H)),I(!1)},type:a.PickerType.EMBEDDED,data:null!=M?M:[],onDefaultVariableSelect:J,skipDefaultVariableContent:_},Math.random())})),e.jsx("div",Object.assign({style:{padding:"16px 14px",width:"whatsapp"===F||"webpush"==F||"rcs"==F?428:400,display:Y?"none":"block"}},{children:F!==p.CHANNEL_TYPE.WHATSAPP&&F!==(null===p.CHANNEL_TYPE||void 0===p.CHANNEL_TYPE?void 0:p.CHANNEL_TYPE.RCS)?F==p.CHANNEL_TYPE.WEBPUSH?e.jsx(P.default,{whatsappSpecificPickerMeta:x,template:$,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T}):e.jsx(b.default,{onFocus:F===p.CHANNEL_TYPE.EMAIL?function(e){var a,t,i;const l=null===document||void 0===document?void 0:document.getElementById("mobile"===B?"template_html_mobile":"template_html_desktop"),r=m.getVariableNameForEmailByIndex(e+1),s=F===p.CHANNEL_TYPE.EMAIL?null===(a=null==l?void 0:l.contentWindow)||void 0===a?void 0:a.document.getElementById(r):document.getElementById(r),o=Q(s),d=null==s?void 0:s.offsetLeft;"desktop"===B?o&&W.current&&(null===(t=null==l?void 0:l.contentWindow)||void 0===t||t.scrollTo(null!=d?d:0,o),C.highlightFor(r,n.COLORS.background.warning.light,2,F,B)):o&&q.current&&(null===(i=null==l?void 0:l.contentWindow)||void 0===i||i.scrollTo(null!=d?d:0,o),C.highlightFor(r,n.COLORS.background.warning.light,2,F,B))}:void 0,showVariableModal:T,discountCode:g,setDiscountCode:S}):F!==p.CHANNEL_TYPE.WHATSAPP&&F!==p.CHANNEL_TYPE.RCS||!U?e.jsx(w.default,{whatsappSpecificPickerMeta:x,template:$,onTemplateChange:e=>{null==G||G(e)},showVariableModal:T,variableListForImage:L,discountCode:g,setDiscountCode:S,fileName:k,setFileName:V}):e.jsx(s.default,{whatsappSpecificPickerMeta:x,template:$,showVariableModal:T,variableListForImage:L,discountCode:g,setDiscountCode:S})}))]})),[p.CHANNEL_TYPE.WHATSAPP,p.CHANNEL_TYPE.SMS].includes(F)&&!h&&!K&&e.jsx(j,{children:e.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.secondary,style:{fontStyle:"italic"}},{children:"Click on ‘Select template’ below to use it"}))})]})};
@@ -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"),l=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var m=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var h=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../TypographyStyle.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:j,showVariableModal:f,variableListForImage:b,discountCode:C,setDiscountCode:O}=x;var I,S,P,q,w,k,T,B;const{selectedCarouselIndex:L,setTemplate:R,pickerConf:E,isProductCarouselType:M,pod:D,cardCount:A,carouselProducts:F,setCarouselProducts:V,isError:W,cardImages:N,disableEditVariable:$,onDeleteSelectedProducts:_,setSelectedCarouselIndex:z,setVariableCallback:G,setShowVariablePicker:H,sliderRef:J}=u.useTemplateModalContext(),[K,Q]=r.useState(-1==L?"First Message (Step 1/2)":M?"Product Carousel "+((null===(S=null===(I=null==y?void 0:y.mapping)||void 0===I?void 0:I.body)||void 0===S?void 0:S.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(q=null===(P=null==y?void 0:y.mapping)||void 0===P?void 0:P.body)||void 0===q?void 0:q.length)?"(Step 2/2)":"")),[U,X]=r.useState(!1),[Y,Z]=r.useState(!1),ee=L===(null!=A?A:-1)-1,te=(null!=L?L:-1)<1;r.useEffect((()=>{var e,t,l,n;Q(-1==L?"First Message (Step 1/2)":M?"Product Carousel "+((null===(t=null===(e=null==y?void 0:y.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==y?void 0:y.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[L]);const le=e=>{null==V||V([{name:"variable",productName:e.actualValue}])};return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[null!=L&&L>=0&&!!(null===(k=null===(w=null==y?void 0:y.mapping)||void 0===w?void 0:w.body)||void 0===k?void 0:k.length)&&e.jsx(s.IconButton,{Icon:t.default,onClick:()=>{null==z||z(-1)}}),e.jsx(g.TitleMedium,Object.assign({style:{marginLeft:10}},{children:K}))]})),M&&(null!==(T=null==F?void 0:F.length)&&void 0!==T?T:0)>0&&null!=L&&L>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==F?void 0:F.length)&&"variable"===F[0].name?(G((()=>le)),H(!0)):X(!U)},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==V||V([]));const t=o.cloneDeep(Object.assign({},y));t&&(N&&N.length>0?null==N||N.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=N[l])&&void 0!==n?n:"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,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==R||R(t)),null==V||V([]),null==_||_()}}),F&&(null==F?void 0:F.length)>0&&"variable"!=F[0].name&&e.jsx(a.Button,{disabled:(null!==(B=null==F?void 0:F.length)&&void 0!==B?B:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{Z(!0),X(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!$&&M&&0===(null==F?void 0:F.length)&&null!=L&&L>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(g.TitleRegular,{children:"Product(s)"}),e.jsx(g.BodySecondary,{children:`Select ${null!=A?A:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:W?16:12,marginRight:W?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:W?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:m.COLORS.content.secondary})})),onClick:e=>{X(!0)}}),D===h.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(g.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:W?`2px dashed ${m.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:m.COLORS.content.secondary})})),onClick:e=>{G((()=>le)),H(!0)}})]})]})),W&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!M&&(null!=L?L:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:m.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:l.default,disabled:te,width:8,height:14,svgStyle:te?{}:{color:m.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickPrev(),(null!=L?L:-1)<1||null==z||z((e=>e-1))}}),e.jsx(g.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:m.COLORS.content.secondary},{children:`Card ${(null!=L?L:0)+1}/${A}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:ee,svgStyle:ee?{}:{color:m.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==J?void 0:J.current)||void 0===e||e.slickNext(),(null!=L?L:-1)>=(null!=A?A:-1)-1||null==z||z((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:j,template:y,onTemplateChange:e=>{null==R||R(e)},showVariableModal:f,variableListForImage:b,discountCode:C,setDiscountCode:O}),U&&E&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:Y?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:E.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=F?F:[]),collectionFetcher:E.fetchCollections,productFetcher:E.fetchProducts,onAdd:(e,t)=>{var l,n,i,r,a,s;Z(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:m,displayOrder:h}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:m,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},y));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==N?void 0:N[t])&&void 0!==l?l:""]})),null==R||R(p)),null==V||V(c),X(!1)},searchInCollectionFetcher:E.searchInCollection,searchFetcher:E.searchProducts,visible:U,onClose:()=>{X(!1)},exactLimit:null!=A?A:1})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("../../../assets/icons/arrow_back.svg.js"),t=require("../../../assets/icons/chevronLeft.svg.js"),n=require("../../../assets/icons/chevronRight.svg.js"),i=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),s=require("../../icon-button/IconButton.js"),d=require("../../product-picker-v2/modal.js"),c=require("../Badge/index.js"),u=require("../context/templateModalContext.js"),p=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var m=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var g=require("../../template-preview/helpers/templateMiscHelper.js"),j=require("../../TypographyStyle.js");exports.default=x=>{let{template:y,whatsappSpecificPickerMeta:f,showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}=x;var I,q,w,P,k,T,B,L;const{selectedCarouselIndex:R,setTemplate:E,pickerConf:M,isProductCarouselType:D,pod:A,cardCount:F,carouselProducts:V,setCarouselProducts:W,isError:N,cardImages:$,disableEditVariable:_,onDeleteSelectedProducts:z,setSelectedCarouselIndex:G,setVariableCallback:H,setShowVariablePicker:J,sliderRef:K}=u.useTemplateModalContext(),[Q,U]=r.useState(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(q=null===(I=null==y?void 0:y.mapping)||void 0===I?void 0:I.body)||void 0===q?void 0:q.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(P=null===(w=null==y?void 0:y.mapping)||void 0===w?void 0:w.body)||void 0===P?void 0:P.length)?"(Step 2/2)":"")),[X,Y]=r.useState(!1),[Z,ee]=r.useState(!1),le=R===(null!=F?F:-1)-1,te=(null!=R?R:-1)<1;r.useEffect((()=>{var e,l,t,n;U(g.isRCSChannel(null==y?void 0:y.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":D?"Product Carousel "+((null===(l=null===(e=null==y?void 0:y.mapping)||void 0===e?void 0:e.body)||void 0===l?void 0:l.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(t=null==y?void 0:y.mapping)||void 0===t?void 0:t.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[R]);const ne=e=>{null==W||W([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===R&&g.isRCSChannel(null==y?void 0:y.channel)&&(null==G||G(0))}),[R,null==y?void 0:y.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!g.isRCSChannel(null==y?void 0:y.channel)&&null!=R&&R>=0&&!!(null===(T=null===(k=null==y?void 0:y.mapping)||void 0===k?void 0:k.body)||void 0===T?void 0:T.length)&&e.jsx(s.IconButton,{Icon:l.default,onClick:()=>{null==G||G(-1)}}),e.jsx(j.TitleMedium,Object.assign({style:{marginLeft:10}},{children:Q}))]})),D&&(null!==(B=null==V?void 0:V.length)&&void 0!==B?B:0)>0&&null!=R&&R>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(v.ProductBox,{editItem:()=>{1===(null==V?void 0:V.length)&&"variable"===V[0].name?(H((()=>ne)),J(!0)):Y(!X)},cardBody:1===(null==V?void 0:V.length)&&"variable"===V[0].name?`${V[0].productName}`:`${null==V?void 0:V.length} Products Selected`,hideIcon:1===(null==V?void 0:V.length)&&"variable"===V[0].name,deleteItem:()=>{var e;if(1===(null==V?void 0:V.length)&&"variable"===V[0].name)return void(null==W||W([]));const l=o.cloneDeep(Object.assign({},y));l&&($&&$.length>0?null==$||$.forEach(((e,t)=>{var n;l.components[1].cards[t].components[0].example.header_handle=[null!==(n=$[t])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==l?void 0:l.components[1].cards)||void 0===e||e.forEach(((e,t)=>{l.components[1].cards[t].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==E||E(l)),null==W||W([]),null==z||z()}}),V&&(null==V?void 0:V.length)>0&&"variable"!=V[0].name&&e.jsx(a.Button,{disabled:(null!==(L=null==V?void 0:V.length)&&void 0!==L?L:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{ee(!0),Y(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!_&&D&&0===(null==V?void 0:V.length)&&null!=R&&R>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(j.TitleRegular,{children:"Product(s)"}),e.jsx(j.BodySecondary,{children:`Select ${null!=F?F:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:N?16:12,marginRight:N?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{Y(!0)}}),A===m.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(j.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:N?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:N?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{H((()=>ne)),J(!0)}})]})]})),N&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(c.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!D&&(null!=R?R:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(s.IconButton,{Icon:t.default,disabled:te,width:8,height:14,svgStyle:te?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickPrev(),(null!=R?R:-1)<1||null==G||G((e=>e-1))}}),e.jsx(j.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=R?R:0)+1}/${F}`})),e.jsx(s.IconButton,{Icon:n.default,width:8,height:14,disabled:le,svgStyle:le?{}:{color:h.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==K?void 0:K.current)||void 0===e||e.slickNext(),(null!=R?R:-1)>=(null!=F?F:-1)-1||null==G||G((e=>e+1))}})]})),e.jsx(p.default,{whatsappSpecificPickerMeta:f,template:y,onTemplateChange:e=>{null==E||E(e)},showVariableModal:b,variableListForImage:C,discountCode:O,setDiscountCode:S}),X&&M&&e.jsx(d.ProductPickerModal,{zIndex:200,startupScreen:Z?d.ScreenName.RearrangeProducts:d.ScreenName.Collections,rearrangeEnabled:!0,storeId:M.storeId,selectedItems:(e=>{if(e.length>0){const l={};for(const t of e){const e=null==t?void 0:t.collectionId,n=t.productId,i=t.variantId;e in l||(l[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in l[e].products||(l[e].products[n]={variants:{},name:(null==t?void 0:t.productName)||"",image:(null==t?void 0:t.productImage)||""}),l[e].products[n].variants[i]={name:(null==t?void 0:t.name)||"",price:"",image:(null==t?void 0:t.image)||"",quantity:t.quantity||0,displayOrder:t.displayOrder}}return l}return{}})(null!=V?V:[]),collectionFetcher:M.fetchCollections,productFetcher:M.fetchProducts,onAdd:(e,l)=>{var t,n,i,r,a,s;ee(!1);const d=[];delete e.isCustom;for(const l of Object.keys(e)){const o=e[l].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const c=o[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(t=o[e])||void 0===t?void 0:t.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:l,productName:null!==(r=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==r?r:"",productImage:null!==(s=null===(a=o[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,l)=>e.displayOrder-l.displayOrder)),u=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},y));p&&(u.forEach(((e,l)=>{var t;p.components[1].cards[l].components[0].example.header_handle=e?[e]:[null!==(t=null==$?void 0:$[l])&&void 0!==t?t:""]})),null==E||E(p)),null==W||W(c),Y(!1)},searchInCollectionFetcher:M.searchInCollection,searchFetcher:M.searchProducts,visible:X,onClose:()=>{Y(!1)},exactLimit:null!=F?F:1})]}))};