@bikdotai/bik-component-library 0.0.660-5 → 0.0.660-6
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.
- package/dist/cjs/_virtual/bik-store.js +1 -0
- package/dist/cjs/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +2 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +2 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +6 -2
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +11 -13
- package/dist/cjs/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/cjs/components/discount-modal/DiscountModal.js +1 -1
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/cjs/components/plans/SubscriptionPlan.d.ts +1 -0
- package/dist/cjs/components/plans/SubscriptionPlan.js +1 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +7 -5
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/cjs/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/utility.d.ts +2 -1
- package/dist/cjs/components/product-picker-v2/utility.js +1 -1
- package/dist/cjs/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +1 -0
- package/dist/esm/_virtual/bik-store.js +1 -0
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNodes.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +2 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +2 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.js +5 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +11 -13
- package/dist/esm/components/discount-modal/DiscountModal.d.ts +2 -0
- package/dist/esm/components/discount-modal/DiscountModal.js +1 -1
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/plans/NewSubscriptionPlan.js +1 -1
- package/dist/esm/components/plans/SubscriptionPlan.d.ts +1 -0
- package/dist/esm/components/plans/SubscriptionPlan.js +1 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +7 -5
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +5 -3
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/rearrangeScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.d.ts +3 -1
- package/dist/esm/components/product-picker-v2/selectedScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/utility.d.ts +2 -1
- package/dist/esm/components/product-picker-v2/utility.js +1 -1
- package/dist/esm/node_modules/@bikdotai/bik-models/growth/models/bik-store.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.__exports={};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-redux"),s=require("../../button/Button.js"),i=require("../../dropdown/Dropdown.js"),l=require("../constants/operators.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-redux"),s=require("../../button/Button.js"),i=require("../../dropdown/Dropdown.js"),l=require("../constants/operators.js"),o=require("../hooks/useQueryBuilder.js"),d=require("./AddNodeButton.js"),n=require("./DeleteButton.js"),a=require("./QueryBuilderNode/QueryBuilderNode.js"),u=require("./QueryBuilderNodes.styled.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const j=c(t).default.forwardRef(((c,j)=>{let{infinite:p,addNodeBtnText:x,allowedNodes:y,typesAPIHandlers:f,onStateChange:g,mode:v,selectorKey:b}=c;var O;const m=r.useSelector((e=>null==e?void 0:e[b])),{deleteNode:w,clearAll:h,selectJoinOperator:N,fillState:q}=o.useQueryBuilder(b);t.useEffect((()=>{null==g||g(Object.assign({},m))}),[m]);const B=l.JOIN_OPERATOR_OPTIONS.map((e=>(null==m?void 0:m.operator)&&e.value===m.operator?Object.assign(Object.assign({},e),{selected:!0}):e));return t.useImperativeHandle(j,(()=>({getState:()=>Object.assign({},m),fillState(e){q(Object.assign({},e))},clearAll:h}))),e.jsxs(e.Fragment,{children:[null===(O=null==m?void 0:m.nodes)||void 0===O?void 0:O.map(((t,r)=>e.jsxs(e.Fragment,{children:[0!==r&&e.jsx("div",Object.assign({style:{width:80,position:"relative"}},{children:e.jsx(i.Dropdown,{disabled:"view"===v,onSelect:e=>{N(e.value)},options:B,width:"80px",height:96,size:"small",skipSorting:!0})})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:12}},{children:[e.jsx(u.LinedContainer,Object.assign({style:{paddingTop:0===r?0:24,maxWidth:"calc(100% - 24px)"}},{children:e.jsx(a.default,{selectorKey:b,mode:null!=v?v:"create",allowedNodes:y,node:t,apiHandler:f[t.type]})})),"view"!==v?e.jsx(e.Fragment,{children:0!==r&&e.jsx(n.default,{onClick:()=>w(t._id)})}):e.jsx(e.Fragment,{})]}),t._id)]}))),p&&"view"!==v&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[e.jsx(d.default,{buttonText:x,allowedNodes:y,selectorKey:b}),e.jsx(s.Button,{buttonText:"Clear filters",size:"medium",buttonType:"tertiaryGray",onClick:()=>h(y[0])})]}))]})}));j.displayName="QueryBuilderNodes",exports.default=j;
|
|
@@ -37,5 +37,7 @@ export type LineChartProps = {
|
|
|
37
37
|
titleTooltipCallback?: (context: any) => void;
|
|
38
38
|
isInternationalStore?: boolean;
|
|
39
39
|
customYHeaders?: any;
|
|
40
|
+
legendsAndIconDirection?: 'row-reverse' | 'row';
|
|
41
|
+
headerIcons?: React.ReactNode[];
|
|
40
42
|
};
|
|
41
43
|
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),n=require("react"),l=require("react-chartjs-2"),r=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:C,tension:v,isNewStyles:h,prefixCurrencyInYAxis:x,pointRadius:O,useKFormat:j,lineThickness:m,ticksLabelCallback:S,labelCallback:L,afterBodyCallBack:f,titleTooltipCallback:k,isInternationalStore:R,customYHeaders:w,headerIcons:q=[],legendsAndIconDirection:B="row"}=t;var F,T,I;const[E,z]=n.useState(null),A=n.useRef();n.useEffect((()=>{var e,t,n,l;if(null===(l=null===(n=null===(t=null===(e=A.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===n?void 0:n.ticks)||void 0===l?void 0:l.length){const e=38*A.current.scales.y.ticks.length;z(e)}}),[A]);const D=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 n,l,r;return Object.assign(Object.assign({tension:null!=v?v:.4,fill:e.gradient?"start":0},((e,t)=>{const n={borderColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)};return h?Object.assign({pointStyle:"circle",pointRadius:O||(d&&d.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)},n):Object.assign({pointRadius:null!=O?O:1},n)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(l=null!==(n=e.lineWidth)&&void 0!==n?n:m)&&void 0!==l?l:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,E?E-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(r=e.backgroundColor)&&void 0!==r?r:"transparent",legend:e.legend})}))},P={maintainAspectRatio:g,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=h&&h,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:C?0:y,max:C?10:b,ticks:{color:i.COLORS.content.secondary,callback:e=>{var t,n;return j?`${null!==(t=null==s?void 0:s.yPrefix)&&void 0!==t?t:""}${R?o.truncateValueForInternationalStore(e):o.truncateValueForIndianStore(e)}${null!=x?x:""}`:w&&Object.keys(w).length>0?w[e]:`${null!==(n=null==s?void 0:s.yPrefix)&&void 0!==n?n:""}${e}${null!=x?x:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:C?1:p,padding:h?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===(F=null==s?void 0:s.yDrawBorder)||void 0===F||F}},x:{ticks:{callback:S,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!==(T=null==s?void 0:s.xDrawBorder)&&void 0!==T&&T}}}};return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},g?{}:{height:null!==(I=null!=c?c:E)&&void 0!==I?I:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[e.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"space-between",width:"100%",flexDirection:B}},{children:[e.jsx(a.LegendWrapper,{children:q.map(((t,n)=>e.jsx(a.LegendContainer,{children:t},n)))}),e.jsx(a.LegendWrapper,{children:D.map(((t,n)=>{let{text:l,color:i,square:o}=t;return l?e.jsxs(a.LegendContainer,{children:[e.jsx(a.LegendColor,{color:i,square:o,newStyle:h}),e.jsx(r.BodyTiny,Object.assign({color:"#667085"},{children:l}))]},n):e.jsx(e.Fragment,{})}))})]})),e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(l.Line,{ref:A,options:P,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 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 s=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 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("../../../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/Modals/DescriptionModal.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?t.truncateValueForInternationalStore(l):t.truncateValueForIndianStore(l):l} (${A}% of ${i}${void 0!==c?c?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?"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zdCBiYXJDaGFydERhdGEgPSB7XHJcbiAgICAgICAgeEF4aXMsXHJcbiAgICAgICAgeUF4aXMsXHJcbiAgICAgICAgYmFyQ29sb3JSR0JBOiB7IHI6IDIxMCwgZzogMTc0LCBiOiAyNTUsIGE6IDEgfSxcclxuICAgIH07XHJcbiAgICByZXR1cm4gYmFyQ2hhcnREYXRhO1xyXG59O1xyXG5jb25zdCBvcHRpb25zID0gKGN1cnJlbmN5UHJvcHMpID0+ICh7XHJcbiAgICBwbHVnaW5zOiB7XHJcbiAgICAgICAgbGVnZW5kOiB7XHJcbiAgICAgICAgICAgIGRpc3BsYXk6IGZhbHNlLFxyXG4gICAgICAgIH0sXHJcbiAgICAgICAgdG9vbHRpcDoge1xyXG4gICAgICAgICAgICBlbmFibGVkOiB0cnVlLFxyXG4gICAgICAgICAgICBjYWxsYmFja3M6IHtcclxuICAgICAgICAgICAgICAgIGxhYmVsOiAodG9vbHRpcEl0ZW0pID0+IHtcclxuICAgICAgICAgICAgICAgICAgICB2YXIgX2E7XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKCF0b29sdGlwSXRlbS5sYWJlbCkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2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Li4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdOyB9KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyQ29sb3I6IFsnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlclJhZGl1czogOCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgfTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkRGF0YSh0cnVuY2F0ZWREYXRhU2V0KTtcclxuICAgICAgICAgICAgY29uc3QgdHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yID0gdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UsIGluZGV4KSA9PiAoT2JqZWN0LmFzc2lnbih7IGNvbG9yOiBHUkFQSF9DT0xPUlNbaW5kZXggJSBHUkFQSF9DT0xPUlMubGVuZ3RoXSB9LCBzbGljZSkpKTtcclxuICAgICAgICAgICAgc2V0VHJ1bmNhdGVkU2xpY2VzV2l0aENvbG9yKHRydW5jYXRlZFNsaWNlc1dpdGhDb2xvcik7XHJcbiAgICAgICAgfVxyXG4g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2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkY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AgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnc3BhY2UtYmV0d2VlbicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzgwdmgnLFxyXG4gICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7IHdpZHRoOiAnNTUlJywgbWFyZ2luTGVmdDogJzQlJyB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBqdXN0aWZ5Q29udGVudDogJ2NlbnRlcicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6IGRhdGEsIG9wdGlvbnM6IE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSwgb3B0aW9ucyhjdXJyZW5jeVByb3BzKSksIHsgbWFpbnRhaW5Bc3BlY3RSYXRpbzogc2l6ZSA/IGZhbHNlIDogdHJ1ZSB9KSB9KSB9KSkgfSkpLCBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMzAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6ICcxMDAlJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBvdmVyZmxvd1k6ICdhdXRvJyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogX2pzeChQaWVDaGFydCwgeyBzbGljZXM6IHNsaWNlc1dpdGhDb2xvciB9KSB9KSldIH0pKSB9KSkpLCBzaG93QmFyQ2hhcnQgJiYgYmFyQ2hhcnREYXRhICYmIChfanN4KFN0eWxlZE1vZGFsLCBPYmplY3QuYXNzaWduKHsgb3Blbjogc2hvd0JhckNoYXJ0LCBvbkNsb3NlOiAoKSA9PiBzZXRTaG93QmFyQ2hhcnQoZmFsc2UpLCBjbG9zZU9uT3V0c2lkZUNsaWNrOiB0cnVlLCBoZWFkaW5nVGl0bGU6IHRpdGxlLCB3aWR0aDogXCI4NSVcIiB9LCB7IGNoaWxkcmVuOiBfanN4KFwiZGl2XCIsIE9iamVjdC5hc3NpZ24oeyBzdHlsZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/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,R]=l.useState(),[J,V]=l.useState(),[F,S]=l.useState([]),[v,q]=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){R({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}]};R(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&&q(((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(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(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 s=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 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("../../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.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/Modals/DescriptionModal.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?t.truncateValueForInternationalStore(l):t.truncateValueForIndianStore(l):l} (${A}% of ${i}${void 0!==c?c?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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUErRThCIiwiZmlsZSI6IlBpZUNoYXJ0QW5hbHl0aWNzLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGpzeCBhcyBfanN4LCBGcmFnbWVudCBhcyBfRnJhZ21lbnQsIGpzeHMgYXMgX2pzeHMgfSBmcm9tIFwicmVhY3QvanN4LXJ1bnRpbWVcIjtcclxuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xyXG5pbXBvcnQgQmFyQ2hhcnRJY29uIGZyb20gJ0BzcmMvYXNzZXRzL2ljb25zL0NoYXJ0QmFyLnN2Zyc7XHJcbmltcG9ydCBNYXhpbWl6ZUljb24gZnJvbSAnQHNyYy9hc3NldHMvaWNvbnMvbWF4aW1pemUuc3ZnJztcclxuaW1wb3J0IHsgU3RyaW5nVXRpbHMgfSBmcm9tIFwiLi4vLi4vLi4vLi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1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gYCAwJWA7XHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsID0gdG9vbHRpcEl0ZW0uZGF0YXNldC5kYXRhLnJlZHVjZSgoYWNjLCBjdXIpID0+IGFjYyArIGN1ciwgMCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGVyY2VudGFnZSA9IHBhcnNlRmxvYXQoKCh0b29sdGlwSXRlbS5yYXcgLyB0b3RhbCkgKiAxMDApLnRvRml4ZWQoMSkpO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbGFiZWwsIHJhdyB9ID0gdG9vbHRpcEl0ZW07XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgc3ltYm9sID0gKF9hID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLnN5bWJvbCkgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogJyc7XHJcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNJbnRsID0gY3VycmVuY3lQcm9wcyA9PT0gbnVsbCB8fCBjdXJyZW5jeVByb3BzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBjdXJyZW5jeVByb3BzLmlzSW50ZXJuYXRpb25hbFN0b3JlO1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gaXNJbnRsICE9PSB1bmRlZmluZWRcclxuICAgICAgICAgICAgICAgICAgICAgICAgPyBpc0ludGxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgID8gdHJ1bmNhdGVWYWx1ZUZvckludGVybmF0aW9uYWxTdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA6IHRydW5jYXRlVmFsdWVGb3JJbmRpYW5TdG9yZShyYXcpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogcmF3O1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRvdGFsVmFsdWUgPSBpc0ludGwgIT09IHVuZGVmaW5lZFxyXG4gICAgICAgICAgICAgICAgICAgICAgICA/IGlzSW50bFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPyB0cnVuY2F0ZVZhbHVlRm9ySW50ZXJuYXRpb25hbFN0b3JlKHRvdGFsKVxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgOiB0cnVuY2F0ZVZhbHVlRm9ySW5kaWFuU3RvcmUodG90YWwpXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIDogdG90YWw7XHJcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIFtcclxuICAgICAgICAgICAgICAgICAgICAgICAgYCAke2xhYmVsfWAsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGAgJHtzeW1ib2x9JHt2YWx1ZX0gKCR7cGVyY2VudGFnZX0lIG9mICR7c3ltYm9sfSR7dG90YWxWYWx1ZX0pYCxcclxuICAgICAgICAgICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICB9LFxyXG4gICAgfSxcclxufSk7XHJcbmNvbnN0IEdSQVBIX0NPTE9SUyA9IFtcclxuICAgICcjNUUwN0JCJyxcclxuICAgICcjOUU3N0VEJyxcclxuICAgICcjRDJBRUZGJyxcclxuICAgICcjQ0RFMUZGJyxcclxuICAgICcjOTJBRkZBJyxcclxuICAgICcjMzkzNUUxJyxcclxuXTtcclxuY29uc3QgQ2FydFN0eWxlZCA9IHN0eWxlZC5kaXYgYFxuXHRiYWNrZ3JvdW5kOiAkeyhwcm9wcykgPT4gQ09MT1JTLnN1cmZhY2Uuc3RhbmRhcmR9O1xuXHRib3JkZXI6IDFweCBzb2xpZCAkeyhwcm9wcykgPT4gQ09MT1JTLnN0cm9rZS5wcmltYXJ5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GF0ZShudWxsKTtcclxuICAgIHVzZUVmZmVjdCgoKSA9PiB7XHJcbiAgICAgICAgY29uc3QgdG90YWxTdW0gPSBzbGljZXMucmVkdWNlKChzdW0sIHNsaWNlKSA9PiBzdW0gKyBzbGljZS5jb3VudCwgMCk7XHJcbiAgICAgICAgbGV0IHVwZGF0ZWRTbGljZXNXaXRoQ29sb3IgPSBbXTtcclxuICAgICAgICB1cGRhdGVkU2xpY2VzV2l0aENvbG9yID0gT2JqZWN0LmtleXMoc2xpY2VzKS5tYXAoKGtleSwgaW5kZXgpID0+IChPYmplY3QuYXNzaWduKHsgY29sb3I6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdIH0sIHNsaWNlc1trZXldKSkpO1xyXG4gICAgICAgIHNldFNsaWNlc1dpdGhDb2xvcihbLi4udXBkYXRlZFNsaWNlc1dpdGhDb2xvcl0pO1xyXG4gICAgICAgIGlmICh0b3RhbFN1bSA9PT0gMCkge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgZGF0YXNldHM6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGRhdGE6IFsxMDBdLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IFsnI0YwRjBGMCddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogMCxcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgXSxcclxuICAgICAgICAgICAgICAgIGxhYmVsczogW10sXHJcbiAgICAgICAgICAgIH07XHJcbiAgICAgICAgICAgIHNldERhdGEoZGF0YVNldCk7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGVsc2Uge1xyXG4gICAgICAgICAgICBjb25zdCBkYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiBzbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZUVhY2hXb3JkKHNsaWNlLm5hbWUpKSxcclxuICAgICAgICAgICAgICAgIGRhdGFzZXRzOiBbXHJcbiAgICAgICAgICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkYXRhOiBzbGljZXMubWFwKChzbGljZSkgPT4gc2xpY2UuY291bnQpLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kQ29sb3I6IHNsaWNlcy5tYXAoKHNsaWNlLCBpbmRleCkgPT4geyB2YXIgX2E7IHJldHVybiAoX2EgPSBzbGljZS5jb2xvcikgIT09IG51bGwgJiYgX2EgIT09IHZvaWQgMCA/IF9hIDogR1JBUEhfQ09MT1JTW2luZGV4ICUgR1JBUEhfQ09MT1JTLmxlbmd0aF07IH0pLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJDb2xvcjogWyd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZScsICd3aGl0ZSddLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBib3JkZXJXaWR0aDogNCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyUmFkaXVzOiA4LFxyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBdLFxyXG4gICAgICAgICAgICB9O1xyXG4gICAgICAgICAgICBzZXREYXRhKGRhdGFTZXQpO1xyXG4gICAgICAgIH1cclxuICAgICAgICBpZiAodHJ1bmNhdGVTbGljZXMgJiYgc2xpY2VzLmxlbmd0aCA+IHRydW5jYXRlU2xpY2VzKSB7XHJcbiAgICAgICAgICAgIGNvbnN0IHRydW5jYXRlZFNsaWNlcyA9IHNsaWNlcy5zbGljZSgwLCB0cnVuY2F0ZVNsaWNlcyk7XHJcbiAgICAgICAgICAgIGNvbnN0IG90aGVyU2xpY2VzID0gc2xpY2VzLnNsaWNlKHRydW5jYXRlU2xpY2VzKTtcclxuICAgICAgICAgICAgY29uc3Qgb3RoZXJDb3VudCA9IG90aGVyU2xpY2VzLnJlZHVjZSgoc3VtLCBzbGljZSkgPT4gc3VtICsgc2xpY2UuY291bnQsIDApO1xyXG4gICAgICAgICAgICB0cnVuY2F0ZWRTbGljZXMucHVzaCh7IG5hbWU6ICdPdGhlcicsIGNvdW50OiBvdGhlckNvdW50IH0pO1xyXG4gICAgICAgICAgICBjb25zdCB0cnVuY2F0ZWREYXRhU2V0ID0ge1xyXG4gICAgICAgICAgICAgICAgbGFiZWxzOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSkgPT4gU3RyaW5nVXRpbHMuY2FwaXRhbGl6ZShzbGljZS5uYW1lKSksXHJcbiAgICAgICAgICAgICAgICBkYXRhc2V0czogW1xyXG4gICAgICAgICAgICAgICAgICAgIHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgZGF0YTogdHJ1bmNhdGVkU2xpY2VzLm1hcCgoc2xpY2UpID0+IHNsaWNlLmNvdW50KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZENvbG9yOiB0cnVuY2F0ZWRTbGljZXMubWFwKChzbGljZSwgaW5kZXgpID0+IHsgdmFyIF9hOyByZXR1cm4gKF9hID0gc2xpY2UuY29sb3IpICE9PSBudWxsICYmIF9hICE9PSB2b2lkIDAgPyBfYSA6IEdSQVBIX0NPTE9SU1tpbmRleCAlIEdSQVBIX0NPTE9SUy5sZW5ndGhdOyB9KSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyQ29sb3I6IFsnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnLCAnd2hpdGUnXSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgYm9yZGVyV2lkdGg6IDQsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGJvcmRlclJhZGl1czogOCxcclxuICAgICAgICAgICA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dGxlLmxlbmd0aCkgPT09IDAgPyAnZmxleC1lbmQnIDogJ3NwYWNlLWJldHdlZW4nLFxyXG4gICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBbIWhpZGVUaXRsZSAmJiB0aXRsZSAmJiAoX2pzeChUaXRsZU1lZGl1bSwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYXJnaW5Cb3R0b206IDE2LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IHRpdGxlIH0pKSksIF9qc3hzKFwiZGl2XCIsIHsgY2hpbGRyZW46IFtzaG93Q29udmVydFRvQmFyQ2hhcnQgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBCYXJDaGFydEljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd0JhckNoYXJ0KHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpLCBhbGxvd0NoYXJ0UG9wdXAgJiYgKF9qc3goSWNvbkJ1dHRvbiwgeyBJY29uOiBNYXhpbWl6ZUljb24sIG9uQ2xpY2s6ICgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc2V0U2hvd1BvcHVwKHRydWUpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gfSkpXSB9KV0gfSkpLCBfanN4cyhcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAncm93JyB9LCB7IGNoaWxkcmVuOiBbX2pzeChcImRpdlwiLCBPYmplY3QuYXNzaWduKHsgY2xhc3NOYW1lOiAnY29sLTYgJywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdjZW50ZXInLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IHNpemUsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiBzaXplLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KERvdWdobnV0LCB7IGRhdGE6ICh0cnVuY2F0ZVNsaWNlcyA/IHRydW5jYXRlZERhdGEgOiBkYXRhKSwgb3B0aW9uczogT2JqZWN0LmFzc2lnbihPYmplY3QuYXNzaWduKHt9LCBvcHRpb25zKGN1cnJlbmN5UHJvcHMpKSwgeyBtYWludGFpbkFzcGVjdFJhdGlvOiBzaXplID8gZmFsc2UgOiB0cnVlIH0pIH0pIH0pKSB9KSksIF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IGNsYXNzTmFtZTogJ2NvbC02Jywgc3R5bGU6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmdMZWZ0OiA0OCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6ICdmbGV4JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZsZXhEaXJlY3Rpb246ICdjb2x1bW4nLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAganVzdGlmeUNvbnRlbnQ6ICdmbGV4LXN0YXJ0JyxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfSB9LCB7IGNoaWxkcmVuOiBfanN4KFBpZUNoYXJ0LCB7IHNsaWNlczogdHJ1bmNhdGVTbGljZXMgPyB0cnVuY2F0ZWRTbGljZXNXaXRoQ29sb3IgOiBzbGljZXNXaXRoQ29sb3IsIHNpemU6IHNpemUgfSkgfSkpXSB9KSksIHNob3dQb3B1cCAmJiAoX2pzeChTdHlsZWRNb2RhbCwgT2JqZWN0LmFzc2lnbih7IG9wZW46IHNob3dQb3B1cCwgb25DbG9zZTogKCkgPT4gc2V0U2hvd1BvcHVwKGZhbHNlKSwgY2xvc2VPbk91dHNpZGVDbGljazogdHJ1ZSwgaGVhZGluZ1RpdGxlOiB0aXRsZSwgd2lkdGg6IFwiNzUlXCIgfSwgeyBjaGlsZHJlbjogX2pzeHMoXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhZGRpbmc6IDI0LFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGp1c3RpZnlDb250ZW50OiAnc3BhY2UtYmV0d2VlbicsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzgwdmgnLFxyXG4gICAgICAgICAgICAgICAgICAgIH0gfSwgeyBjaGlsZHJlbjogW19qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7IHdpZHRoOiAnNTUlJywgbWFyZ2luTGVmdDogJzQlJyB9IH0sIHsgY2hpbGRyZW46IF9qc3goXCJkaXZcIiwgT2JqZWN0LmFzc2lnbih7IHN0eWxlOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAnMTAwJScsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGhlaWdodDogJzEwMCUnLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkaXNwbGF5OiAnZmxleCcsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFsaWduSXRlbXM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AgICAgICAgICBwYWRkaW5nOiAnMjRweCAwJyxcclxuICAgICAgICAgICAgICAgICAgICB9IH0sIHsgY2hpbGRyZW46IF9qc3goVmVydGljYWxHcmFwaCwgeyB4QXhpczogYmFyQ2hhcnREYXRhLnhBeGlzLCB5QXhpczogYmFyQ2hhcnREYXRhLnlBeGlzLCBiYXJDb2xvclJHQkE6IGJhckNoYXJ0RGF0YSA9PT0gbnVsbCB8fCBiYXJDaGFydERhdGEgPT09IHZvaWQgMCA/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,R]=l.useState(),[J,V]=l.useState(),[F,S]=l.useState([]),[v,q]=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){R({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}]};R(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&&q(((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(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(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,{})};
|
package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../assets/icons/maximize.svg.js"),i=require("chart.js"),o=require("chartjs-plugin-datalabels"),a=require("react"),l=require("react-chartjs-2"),n=require("../../../icon-button/IconButton.js"),d=require("../../../modals/styledModal.js"),r=require("../../../TypographyStyle.js"),s=require("../../../../constants/Theme.js"),c=require("../utils/calcPercentage.js"),u=require("./StackedBarChart.model.js"),v=require("./StackedBarChart.styles.js");function O(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=O(o);i.Chart.register(i.CategoryScale,i.LinearScale,i.BarElement,i.Tooltip,i.Legend,g.default);exports.StackedBarChart=i=>{var o,O,g,p,x,b,A,h,y,R,C,T,I,f,j,N,S,m,L,k,H,E,F,P,G,_,B,w,D,q,Z,z,M,W,V,Y,J,K,Q,U,X,$;const[ee,te]=a.useState(!1),ie=[250,1e3,800,1500,300,600],oe=0===i.yAxis.data.length,ae=void 0===i.customColourScaleBrand&&void 0===i.customColourScalePastel?i.colorSchema===u.COLOR_SCHEMA.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"]:i.colorSchema===u.COLOR_SCHEMA.PASTEL?i.customColourScalePastel:i.customColourScaleBrand,le=i.customHoverColour,ne=a.useMemo((()=>{var e,t,o;return Object.assign(Object.assign({barPercentage:(null==i?void 0:i.barPercentage)||.4,categoryPercentage:1,pointStyle:"circle",barWidth:i.barWidth,borderRadius:(null==i?void 0:i.borderRadius)||void 0},"object"==typeof(null==i?void 0:i.borderRadius)?{borderSkipped:!1}:{}),(null===(e=null==i?void 0:i.addBarGap)||void 0===e?void 0:e.flag)?{borderWidth:{top:(null===(t=null==i?void 0:i.addBarGap)||void 0===t?void 0:t.value)||2,bottom:(null===(o=null==i?void 0:i.addBarGap)||void 0===o?void 0:o.value)||2,right:0,left:0},borderColor:"transparent"}:{})}),[i.barWidth,null==i?void 0:i.borderRadius,null==i?void 0:i.barPercentage,null==i?void 0:i.addBarGap]),de={};i.yAxis.data.map((e=>{e.map((e=>{de[e.name]?de[e.name].push(e.value):de[e.name]=[e.value]}))}));const re=Object.keys(de).map(((e,t)=>Object.assign({label:e,data:de[e],backgroundColor:null==ae?void 0:ae[t],hoverBackgroundColor:void 0===le?void 0:le[t]},ne)));let se=i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),ce=re;if(i.truncateBars){const e=((e,t,i)=>{if(t.length<=i)return{truncatedData:e,truncatedLabels:t,originalData:e,originalLabels:t};const o=e.map((e=>e.slice(0,i))),a=e.map((e=>e.slice(i).reduce(((e,t)=>e+t),0)));o.forEach(((e,t)=>e.push(a[t])));const l=t.slice(0,i);return l.push("Others"),{truncatedData:o,truncatedLabels:l,originalData:e,originalLabels:t}})(re.map((e=>e.data)),se,i.truncateBars);re.forEach(((t,i)=>t.data=e.truncatedData[i])),se=e.truncatedLabels,ce=e.originalData.map(((e,t)=>Object.assign(Object.assign({},re[t]),{data:e})))}const ue={plugins:{legend:{display:!oe&&!i.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!oe,callbacks:{label:null===(o=i.tooltipConfig)||void 0===o?void 0:o.labelCallback,title:null===(O=i.tooltipConfig)||void 0===O?void 0:O.titleCallback,footer:null===(g=i.tooltipConfig)||void 0===g?void 0:g.footerCallback},footerFont:null===(x=null===(p=i.tooltipConfig)||void 0===p?void 0:p.footerStyles)||void 0===x?void 0:x.footerFont},datalabels:{display:null!==(b=i.showTotal)&&void 0!==b&&b,anchor:"end",align:"end",clamp:!0,formatter:(e,t)=>{var i;const o=t.datasetIndex,a=t.chart.data.datasets;if(o!==a.length-1)return"";const l=t.dataIndex;let n=0;for(let e=0;e<a.length;e++)n+=null!==(i=a[e].data[l])&&void 0!==i?i:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:s.COLORS.content.secondary}},layout:{padding:{right:i.showTotal&&i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?50:0,top:i.showTotal&&i.orientation!=u.GRAPH_ORIENTATION.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!i.customLegend,labels:{usePointStyle:!0}},indexAxis:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(A=i.yAxis)||void 0===A?void 0:A.title:null===(h=i.xAxis)||void 0===h?void 0:h.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(y=i.yAxis)||void 0===y?void 0:y.title:null===(R=i.xAxis)||void 0===R?void 0:R.title,color:null!==(I=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(C=i.yAxis)||void 0===C?void 0:C.titleColor:null===(T=i.xAxis)||void 0===T?void 0:T.titleColor)&&void 0!==I?I:s.COLORS.content.secondary,font:{size:s.FONTS.caption.fontSize}},grid:{display:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(f=null==i?void 0:i.showGridLines)||void 0===f?void 0:f.x)||(null===(j=null==i?void 0:i.showGridLines)||void 0===j?void 0:j.x)),color:s.COLORS.background.base},ticks:{fontSize:s.FONTS.caption.fontSize,color:null!==(N=i.yAxis.labelColor)&&void 0!==N?N:s.COLORS.content.secondary,callback:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?i.isInternationalStore?c.truncateValueForInternationalStore:c.truncateValueForIndianStore:void 0},stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(S=i.yAxis)||void 0===S?void 0:S.stacked)||(null===(m=i.yAxis)||void 0===m?void 0:m.stacked):"boolean"!=typeof(null===(L=i.xAxis)||void 0===L?void 0:L.stacked)||(null===(k=i.xAxis)||void 0===k?void 0:k.stacked)},y:Object.assign(Object.assign({},(null===(H=null==i?void 0:i.equalHeight)||void 0===H?void 0:H.flag)?{suggestedMin:-(null==i?void 0:i.equalHeight.max),suggestedMax:null==i?void 0:i.equalHeight.max}:{}),{title:{display:!!(i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(E=i.xAxis)||void 0===E?void 0:E.title:null===(F=i.yAxis)||void 0===F?void 0:F.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(P=i.xAxis)||void 0===P?void 0:P.title:null===(G=i.yAxis)||void 0===G?void 0:G.title,color:null!==(w=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(_=i.xAxis)||void 0===_?void 0:_.titleColor:null===(B=i.yAxis)||void 0===B?void 0:B.titleColor)&&void 0!==w?w:s.COLORS.content.secondary,font:{size:s.FONTS.caption.fontSize}},grid:{display:i.orientation!==u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(D=null==i?void 0:i.showGridLines)||void 0===D?void 0:D.y)||(null===(q=null==i?void 0:i.showGridLines)||void 0===q?void 0:q.y)),color:s.COLORS.background.base},ticks:Object.assign(Object.assign({stepSize:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(Z=i.xAxis)||void 0===Z?void 0:Z.stepSize:null===(z=i.yAxis)||void 0===z?void 0:z.stepSize,fontSize:s.FONTS.caption.fontSize,color:null!==(M=i.xAxis.labelColor)&&void 0!==M?M:s.COLORS.content.secondary},oe?{min:0,max:2e3,stepSize:200}:{}),{callback:(null==i?void 0:i.ticksCallback)?null==i?void 0:i.ticksCallback:i.orientation!==u.GRAPH_ORIENTATION.VERTICAL?i.isInternationalStore?c.truncateValueForInternationalStore:c.truncateValueForIndianStore:void 0}),stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(W=i.xAxis)||void 0===W?void 0:W.stacked)||(null===(V=i.xAxis)||void 0===V?void 0:V.stacked):"boolean"!=typeof(null===(Y=i.yAxis)||void 0===Y?void 0:Y.stacked)||(null===(J=i.yAxis)||void 0===J?void 0:J.stacked)})},onClick:(e,t)=>{if(!i.onBarClick)return;const o=t[0].datasetIndex,a=t[0].index,l=e.chart.data.datasets[o].label,n=e.chart.data.labels[a];i.onBarClick(n,l)},onHover:(e,t)=>{i.onBarClick&&t.length&&(e.native.target.style.cursor="pointer")}};i.orientation&&i.orientation!==u.GRAPH_ORIENTATION.VERTICAL?delete ue.scales.y.ticks.callback:delete ue.scales.x.ticks.callback;const ve={labels:se,datasets:oe?[{data:ie,backgroundColor:"rgba(0,0,0,0)"}]:re},Oe={labels:i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:oe?[{data:ie,backgroundColor:"rgba(0,0,0,0)"}]:ce},ge=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e.jsx("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:i.allowChartPopup&&!t?"flex-start":"flex-end",flexWrap:"wrap"}},{children:re.map((t=>e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"4px"}},{children:[e.jsx("div",{style:{backgroundColor:t.backgroundColor,width:"16px",height:"16px",borderRadius:"2px"}}),e.jsx(r.BodyTiny,Object.assign({color:s.COLORS.content.secondary},{children:t.label}))]}),t.label.replace(" ","_"))))}))};return e.jsxs(v.GraphContainerWrapper,Object.assign({style:null!==(K=i.wrapperStyle)&&void 0!==K?K:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:i.hideHeading?"flex-end":"space-between"}},{children:[!0!==i.hideHeading&&e.jsx(r.TitleRegular,Object.assign({color:null!==(Q=i.chartHeading.color)&&void 0!==Q?Q:s.COLORS.content.secondary},{children:i.chartHeading.heading})),i.allowChartPopup&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end"}},{children:e.jsx("div",{children:e.jsx(n.IconButton,{Icon:t.default,onClick:()=>{te(!0)}})})}))]})),i.customLegend&&ge(),e.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsx("div",Object.assign({style:{height:null!==(U=i.graphCanvasHeight)&&void 0!==U?U:500,width:null!==(X=i.graphCanvasWidth)&&void 0!==X?X:"auto"}},{children:e.jsx(l.Bar,{options:ue,data:ve})}))})),ee&&e.jsx(d.StyledModal,Object.assign({open:ee,onClose:()=>te(!1),closeOnOutsideClick:!0,headingTitle:null===($=i.chartHeading)||void 0===$?void 0:$.heading,width:"85%"},{children:e.jsxs("div",Object.assign({className:"graph__wrapper",style:{padding:"8px"}},{children:[i.customLegend&&ge(!0),e.jsx("div",Object.assign({style:{height:"70vh",width:"100%",padding:"16px",borderRadius:"8px"}},{children:e.jsx(l.Bar,{options:ue,data:Oe})}))]}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../assets/icons/maximize.svg.js"),i=require("chart.js"),o=require("chartjs-plugin-datalabels"),a=require("react"),l=require("react-chartjs-2"),n=require("../../../icon-button/IconButton.js"),d=require("../../../modals/styledModal.js"),r=require("../../../TypographyStyle.js"),s=require("../../../../constants/Theme.js"),c=require("../utils/calcPercentage.js"),u=require("./StackedBarChart.model.js"),v=require("./StackedBarChart.styles.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=g(o);i.Chart.register(i.CategoryScale,i.LinearScale,i.BarElement,i.Tooltip,i.Legend,p.default);exports.StackedBarChart=i=>{var o,g,p,O,x,b,h,A,y,C,R,I,T,j,f,N,S,m,H,L,k,E,F,P,G,_,B,w,D,q,Z,z,M,W,V,Y,J,K,Q,U,X,$;const{headerIcons:ee=[],legendsAndIconDirection:te="row"}=i,[ie,oe]=a.useState(!1),ae=[250,1e3,800,1500,300,600],le=0===i.yAxis.data.length,ne=void 0===i.customColourScaleBrand&&void 0===i.customColourScalePastel?i.colorSchema===u.COLOR_SCHEMA.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"]:i.colorSchema===u.COLOR_SCHEMA.PASTEL?i.customColourScalePastel:i.customColourScaleBrand,de=i.customHoverColour,re=a.useMemo((()=>{var e,t,o;return Object.assign(Object.assign({barPercentage:(null==i?void 0:i.barPercentage)||.4,categoryPercentage:1,pointStyle:"circle",barWidth:i.barWidth,borderRadius:(null==i?void 0:i.borderRadius)||void 0},"object"==typeof(null==i?void 0:i.borderRadius)?{borderSkipped:!1}:{}),(null===(e=null==i?void 0:i.addBarGap)||void 0===e?void 0:e.flag)?{borderWidth:{top:(null===(t=null==i?void 0:i.addBarGap)||void 0===t?void 0:t.value)||2,bottom:(null===(o=null==i?void 0:i.addBarGap)||void 0===o?void 0:o.value)||2,right:0,left:0},borderColor:"transparent"}:{})}),[i.barWidth,null==i?void 0:i.borderRadius,null==i?void 0:i.barPercentage,null==i?void 0:i.addBarGap]),se={};i.yAxis.data.map((e=>{e.map((e=>{se[e.name]?se[e.name].push(e.value):se[e.name]=[e.value]}))}));const ce=Object.keys(se).map(((e,t)=>Object.assign({label:e,data:se[e],backgroundColor:null==ne?void 0:ne[t],hoverBackgroundColor:void 0===de?void 0:de[t]},re)));let ue=i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),ve=ce;if(i.truncateBars){const e=((e,t,i)=>{if(t.length<=i)return{truncatedData:e,truncatedLabels:t,originalData:e,originalLabels:t};const o=e.map((e=>e.slice(0,i))),a=e.map((e=>e.slice(i).reduce(((e,t)=>e+t),0)));o.forEach(((e,t)=>e.push(a[t])));const l=t.slice(0,i);return l.push("Others"),{truncatedData:o,truncatedLabels:l,originalData:e,originalLabels:t}})(ce.map((e=>e.data)),ue,i.truncateBars);ce.forEach(((t,i)=>t.data=e.truncatedData[i])),ue=e.truncatedLabels,ve=e.originalData.map(((e,t)=>Object.assign(Object.assign({},ce[t]),{data:e})))}const ge={plugins:{legend:{display:!le&&!i.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!le,callbacks:{label:null===(o=i.tooltipConfig)||void 0===o?void 0:o.labelCallback,title:null===(g=i.tooltipConfig)||void 0===g?void 0:g.titleCallback,footer:null===(p=i.tooltipConfig)||void 0===p?void 0:p.footerCallback},footerFont:null===(x=null===(O=i.tooltipConfig)||void 0===O?void 0:O.footerStyles)||void 0===x?void 0:x.footerFont},datalabels:{display:null!==(b=i.showTotal)&&void 0!==b&&b,anchor:"end",align:"end",clamp:!0,formatter:(e,t)=>{var i;const o=t.datasetIndex,a=t.chart.data.datasets;if(o!==a.length-1)return"";const l=t.dataIndex;let n=0;for(let e=0;e<a.length;e++)n+=null!==(i=a[e].data[l])&&void 0!==i?i:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:s.COLORS.content.secondary}},layout:{padding:{right:i.showTotal&&i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?50:0,top:i.showTotal&&i.orientation!=u.GRAPH_ORIENTATION.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!i.customLegend,labels:{usePointStyle:!0}},indexAxis:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(h=i.yAxis)||void 0===h?void 0:h.title:null===(A=i.xAxis)||void 0===A?void 0:A.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(y=i.yAxis)||void 0===y?void 0:y.title:null===(C=i.xAxis)||void 0===C?void 0:C.title,color:null!==(T=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(R=i.yAxis)||void 0===R?void 0:R.titleColor:null===(I=i.xAxis)||void 0===I?void 0:I.titleColor)&&void 0!==T?T:s.COLORS.content.secondary,font:{size:s.FONTS.caption.fontSize}},grid:{display:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(j=null==i?void 0:i.showGridLines)||void 0===j?void 0:j.x)||(null===(f=null==i?void 0:i.showGridLines)||void 0===f?void 0:f.x)),color:s.COLORS.background.base},ticks:{fontSize:s.FONTS.caption.fontSize,color:null!==(N=i.yAxis.labelColor)&&void 0!==N?N:s.COLORS.content.secondary,callback:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?i.isInternationalStore?c.truncateValueForInternationalStore:c.truncateValueForIndianStore:void 0},stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(S=i.yAxis)||void 0===S?void 0:S.stacked)||(null===(m=i.yAxis)||void 0===m?void 0:m.stacked):"boolean"!=typeof(null===(H=i.xAxis)||void 0===H?void 0:H.stacked)||(null===(L=i.xAxis)||void 0===L?void 0:L.stacked)},y:Object.assign(Object.assign({},(null===(k=null==i?void 0:i.equalHeight)||void 0===k?void 0:k.flag)?{suggestedMin:-(null==i?void 0:i.equalHeight.max),suggestedMax:null==i?void 0:i.equalHeight.max}:{}),{title:{display:!!(i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(E=i.xAxis)||void 0===E?void 0:E.title:null===(F=i.yAxis)||void 0===F?void 0:F.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(P=i.xAxis)||void 0===P?void 0:P.title:null===(G=i.yAxis)||void 0===G?void 0:G.title,color:null!==(w=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(_=i.xAxis)||void 0===_?void 0:_.titleColor:null===(B=i.yAxis)||void 0===B?void 0:B.titleColor)&&void 0!==w?w:s.COLORS.content.secondary,font:{size:s.FONTS.caption.fontSize}},grid:{display:i.orientation!==u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(D=null==i?void 0:i.showGridLines)||void 0===D?void 0:D.y)||(null===(q=null==i?void 0:i.showGridLines)||void 0===q?void 0:q.y)),color:s.COLORS.background.base},ticks:Object.assign(Object.assign({stepSize:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(Z=i.xAxis)||void 0===Z?void 0:Z.stepSize:null===(z=i.yAxis)||void 0===z?void 0:z.stepSize,fontSize:s.FONTS.caption.fontSize,color:null!==(M=i.xAxis.labelColor)&&void 0!==M?M:s.COLORS.content.secondary},le?{min:0,max:2e3,stepSize:200}:{}),{callback:(null==i?void 0:i.ticksCallback)?null==i?void 0:i.ticksCallback:i.orientation!==u.GRAPH_ORIENTATION.VERTICAL?i.isInternationalStore?c.truncateValueForInternationalStore:c.truncateValueForIndianStore:void 0}),stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(W=i.xAxis)||void 0===W?void 0:W.stacked)||(null===(V=i.xAxis)||void 0===V?void 0:V.stacked):"boolean"!=typeof(null===(Y=i.yAxis)||void 0===Y?void 0:Y.stacked)||(null===(J=i.yAxis)||void 0===J?void 0:J.stacked)})},onClick:(e,t)=>{if(!i.onBarClick)return;const o=t[0].datasetIndex,a=t[0].index,l=e.chart.data.datasets[o].label,n=e.chart.data.labels[a];i.onBarClick(n,l)},onHover:(e,t)=>{i.onBarClick&&t.length&&(e.native.target.style.cursor="pointer")}};i.orientation&&i.orientation!==u.GRAPH_ORIENTATION.VERTICAL?delete ge.scales.y.ticks.callback:delete ge.scales.x.ticks.callback;const pe={labels:ue,datasets:le?[{data:ae,backgroundColor:"rgba(0,0,0,0)"}]:ce},Oe={labels:i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:le?[{data:ae,backgroundColor:"rgba(0,0,0,0)"}]:ve},xe=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e.jsx("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:i.allowChartPopup&&!t?"flex-start":"flex-end",flexWrap:"wrap"}},{children:ce.map((t=>e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"4px"}},{children:[e.jsx("div",{style:{backgroundColor:t.backgroundColor,width:"16px",height:"16px",borderRadius:"2px"}}),e.jsx(r.BodyTiny,Object.assign({color:s.COLORS.content.secondary},{children:t.label}))]}),t.label.replace(" ","_"))))}))};return e.jsxs(v.GraphContainerWrapper,Object.assign({style:null!==(K=i.wrapperStyle)&&void 0!==K?K:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:i.hideHeading?"flex-end":"space-between"}},{children:[!0!==i.hideHeading&&e.jsx(r.TitleRegular,Object.assign({color:null!==(Q=i.chartHeading.color)&&void 0!==Q?Q:s.COLORS.content.secondary},{children:i.chartHeading.heading})),i.allowChartPopup&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end"}},{children:e.jsx("div",{children:e.jsx(n.IconButton,{Icon:t.default,onClick:()=>{oe(!0)}})})}))]})),i.customLegend&&e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:te,justifyContent:"space-between"}},{children:[e.jsx(v.HeaderIconWrapper,{children:ee.map(((t,i)=>e.jsx("div",{children:e.jsx("div",{children:t})},i)))}),xe()]})),e.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsx("div",Object.assign({style:{height:null!==(U=i.graphCanvasHeight)&&void 0!==U?U:500,width:null!==(X=i.graphCanvasWidth)&&void 0!==X?X:"auto"}},{children:e.jsx(l.Bar,{options:ge,data:pe})}))})),ie&&e.jsx(d.StyledModal,Object.assign({open:ie,onClose:()=>oe(!1),closeOnOutsideClick:!0,headingTitle:null===($=i.chartHeading)||void 0===$?void 0:$.heading,width:"85%"},{children:e.jsxs("div",Object.assign({className:"graph__wrapper",style:{padding:"8px"}},{children:[i.customLegend&&xe(!0),e.jsx("div",Object.assign({style:{height:"70vh",width:"100%",padding:"16px",borderRadius:"8px"}},{children:e.jsx(l.Bar,{options:ge,data:Oe})}))]}))}))]}))};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../../../constants/Theme.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e);const n=a.default.div`
|
|
2
2
|
background-color: ${r.COLORS.surface.standard};
|
|
3
3
|
padding: ${e=>{var r;return null!==(r=e.padding)&&void 0!==r?r:"24px"}};
|
|
4
4
|
border: none;
|
|
@@ -28,4 +28,8 @@
|
|
|
28
28
|
.legend__set {
|
|
29
29
|
margin-top: 16px;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
`,p=a.default.div`
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 8px;
|
|
35
|
+
`;exports.GraphContainerWrapper=n,exports.HeaderIconWrapper=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),x=require("../button/Button.js"),g=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),O=require("../tooltips/Tooltip.js"),m=require("../TypographyStyle.js"),f=require("./DataSourceInfoFooter.js"),v=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js");exports.DataSourcePanel=L=>{var b,E;const{appType:w,storeId:D,messageSource:N,setMessageSourcePanel:R,hideCloseButton:_,isSourceInfoFetched:B,allSourceInfoDetail:q,ChecklistType:A,title:F,zeroStateButton:k,editableSources:P,preFillTrainingSourceCount:M,redirect:U,footerButtonOption:K,fetchTrainingSourceCount:W,fetchProductFAQCount:H,productSourceData:$}=L,{sources:Q}=N,Y=["blog","article","page","policy"],[G,X]=p.useState(!1),[z,V]=p.useState(!1),[J,Z]=p.useState(0),[ee,te]=p.useState(),[se,ie]=p.useState(null!=M?M:{}),oe={};S.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;A[s]&&(oe[A[s]]=e.jsx(y.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const ne=Q.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),le=Q.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ae=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{}),[H,W,null==N?void 0:N.messageId,N.sources,M,D]);const re=e=>!!(e&&0===e.length||(null==N?void 0:N.isUnsatisfactoryAnswer)),de=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=I.CustomDataType.FILES:Y.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},ce=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",ue=s=>"products"==s||"product"==s?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==s?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==s||"fetched links"==s?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==s?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==s?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),pe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};return G||!B?e.jsx(v.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsxs(e.Fragment,{children:[e.jsx(v.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(m.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(b=oe[N.intent])&&void 0!==b?b:oe.GENERIC,!_&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>R(void 0)},{children:e.jsx(s.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),re(Q)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(m.TitleSmall,{children:"Insufficient data"})})),e.jsx(m.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),k&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(x.Button,{LeadingIcon:null!==(t=k.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(s=k.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{k.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:N.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${w===I.AppType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!re(Q)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[ne.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(m.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ne.map(((t,s)=>{var o,n,l,a;const r=de(t.type||t.subTitle||"OpenAI"),c=de(t.type||t.subTitle||"OpenAI",!0),u=ce(r),p=null==P?void 0:P.includes(c),x=q[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==$?void 0:$[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==ne?void 0:ne.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ue(r),e.jsx(O.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(m.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?U(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==A.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(g.IconButton,{Icon:i.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==x?void 0:x.onEditClick(x.data,x.type),disabled:!x,disabledTooltip:"This source is deleted"}):e.jsx(g.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!x,disabledTooltip:"This source is deleted",onClick:()=>U(t)})}))]}))]})),j&&e.jsx("div",{children:e.jsxs(m.BodyCaption,Object.assign({className:"product-data"},{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;te({title:C,description:pe(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>te(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(O.Tooltip,Object.assign({body:y},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]}))})]}),`info-${s}`)}))}))]})),le.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(m.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:le.map(((t,s)=>{var o,n,l,a,r,c,u,p,x,C,j,y,f,v,S,T,L;const b=de(t.type||t.subTitle||"OpenAI"),E=de(t.type||t.subTitle||"OpenAI",!0),w=ce(b),D=null==P?void 0:P.includes(E),N="Products"===t.subTitle?q[null!==(o=t.productId)&&void 0!==o?o:"Products"]:q[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===A.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(x=null==N?void 0:N.content)&&void 0!==x?x:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.WEBSITE_LINKS)||void 0===f?void 0:f.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.TEXTS)||void 0===v?void 0:v.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==le?void 0:le.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ue(b),e.jsx(O.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(m.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?U(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==A.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(g.IconButton,{Icon:i.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(g.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>U(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:pe(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))]}))]})),z&&!re(Q)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(f.default,{appType:w,storeId:D,messageSource:N,sourceIntent:null!==(E=N.intent)&&void 0!==E?E:A.GENERIC,faqCount:J,trainingSourceCount:se,ShowTrainingDataSource:ae,ChecklistType:A,footerButtonOption:K})}))]})}),ee&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>te(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:ee.title,description:ee.description,imageUrl:ee.imageUrl,onClose:ee.onClose})}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),y=require("../side-modal/SideModal.js"),j=require("../tag/Tag.js"),O=require("../tooltips/Tooltip.js"),m=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js");exports.DataSourcePanel=L=>{var b,E;const{appType:w,storeId:D,messageSource:N,setMessageSourcePanel:R,hideCloseButton:_,isSourceInfoFetched:B,allSourceInfoDetail:q,ChecklistType:A,title:F,zeroStateButton:k,editableSources:P,preFillTrainingSourceCount:M,redirect:U,footerButtonOption:K,fetchTrainingSourceCount:W,fetchProductFAQCount:H,productSourceData:$}=L,{sources:Q}=N,Y=["blog","article","page","policy"],[G,X]=p.useState(!1),[z,V]=p.useState(!1),[J,Z]=p.useState(0),[ee,te]=p.useState(),[ie,se]=p.useState(null!=M?M:{}),oe={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;A[i]&&(oe[A[i]]=e.jsx(j.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const ne=Q.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),le=Q.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ae=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{A[t]&&(e[A[t]]=A[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[A]);p.useEffect((()=>{var e,t,i,s;if(!(null==N?void 0:N.messageId))return;X(!0),V(!1!==(null===(t=null===(e=N.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=N.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=N.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));H(D,n).then((e=>Z(e))).then((()=>{M?(se(M),setTimeout((()=>X(!1)),100)):W(D).then((e=>se(e))).then((()=>{setTimeout((()=>X(!1)),100)}))}))}),[H,W,null==N?void 0:N.messageId,N.sources,M,D]);const re=e=>!!(e&&0===e.length||(null==N?void 0:N.isUnsatisfactoryAnswer)),de=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:Y.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},ce=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",ue=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),pe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return G||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(m.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(b=oe[N.intent])&&void 0!==b?b:oe.GENERIC,!_&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>R(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),re(Q)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(m.TitleSmall,{children:"Insufficient data"})})),e.jsx(m.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),k&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=k.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=k.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{k.onClick()}})}))]}))})()})):e.jsx(j.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:N.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${w===I.AppType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!re(Q)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[ne.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(m.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:ne.map(((t,i)=>{var o,n,l,a;const r=de(t.type||t.subTitle||"OpenAI"),c=de(t.type||t.subTitle||"OpenAI",!0),u=ce(r),p=null==P?void 0:P.includes(c),g=q[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,y=t.productId&&(null==$?void 0:$[t.productId]),j=y&&y.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==ne?void 0:ne.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ue(r),e.jsx(O.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(m.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?U(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==A.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>U(t)})}))]}))]})),y&&e.jsxs(m.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;te({title:C,description:pe(y.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>te(void 0)})}},{children:`${null===(n=y.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>y.onEditFaqClick(y.faqs)},{children:`${null===(l=y.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(O.Tooltip,Object.assign({body:j,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=y.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),le.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(m.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:le.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,y,j,v,f,S,T,L;const b=de(t.type||t.subTitle||"OpenAI"),E=de(t.type||t.subTitle||"OpenAI",!0),w=ce(b),D=null==P?void 0:P.includes(E),N="Products"===t.subTitle?q[null!==(o=t.productId)&&void 0!==o?o:"Products"]:q[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===A.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(y=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==y?y:"":E.toLowerCase()===(null===(j=I.CustomDataType.FETCHED_LINKS)||void 0===j?void 0:j.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===A.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==le?void 0:le.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ue(b),e.jsx(O.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(m.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?U(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==A.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>U(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(m.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:pe(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),z&&!re(Q)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:w,storeId:D,messageSource:N,sourceIntent:null!==(E=N.intent)&&void 0!==E?E:A.GENERIC,faqCount:J,trainingSourceCount:ie,ShowTrainingDataSource:ae,ChecklistType:A,footerButtonOption:K})}))]})}),ee&&e.jsx(y.SideModal,Object.assign({header:"Product description",onClose:()=>te(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:ee.title,description:ee.description,imageUrl:ee.imageUrl,onClose:ee.onClose})}))]})};
|
|
@@ -26,21 +26,19 @@
|
|
|
26
26
|
flex-direction: column;
|
|
27
27
|
gap: 8px;
|
|
28
28
|
|
|
29
|
-
.product-data {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
background-color: ${o.COLORS.surface.hovered};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
.product-data-text2 {
|
|
40
|
-
padding: 2px;
|
|
41
|
-
color: ${o.COLORS.content.secondary};
|
|
29
|
+
.product-data-text1 {
|
|
30
|
+
padding: 2px;
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
color: ${o.COLORS.content.secondary};
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
&:active {
|
|
35
|
+
background-color: ${o.COLORS.surface.hovered};
|
|
42
36
|
}
|
|
43
37
|
}
|
|
38
|
+
.product-data-text2 {
|
|
39
|
+
padding: 2px;
|
|
40
|
+
color: ${o.COLORS.content.secondary};
|
|
41
|
+
}
|
|
44
42
|
.source {
|
|
45
43
|
border-radius: 12px;
|
|
46
44
|
background-color: ${o.COLORS.surface.subdued};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { ICouponData } from "./type";
|
|
3
4
|
import { Collection, Product } from "../product-picker/type";
|
|
@@ -27,6 +28,7 @@ export interface DiscountDialogueI {
|
|
|
27
28
|
fetchCollections: any;
|
|
28
29
|
fetchProducts: any;
|
|
29
30
|
storeId: string;
|
|
31
|
+
appType?: ApplicationType;
|
|
30
32
|
};
|
|
31
33
|
errorMsg?: string;
|
|
32
34
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.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("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),T=require("../../assets/icons/triangle_error.svg.js"),C=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),E=require("../variable-picker-v3/model.js"),P=require("../variable-picker-v3/VariablePicker.js"),O=require("./DiscountModal.styled.js"),I=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js");exports.DiscountModal=b=>{var y,D,N,m,h,U,f,A,g,j,R;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:b.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[x,F]=t.useState(),[q,L]=t.useState(),[k,M]=t.useState(),[Y,w]=t.useState(null!==(y=b.data)&&void 0!==y?y:"string"==typeof b.hideOption?{isStaticCoupon:"dynamic"===b.hideOption}:{isStaticCoupon:!0}),[G,B]=t.useState(!0),[X,Q]=t.useState(),[H,z]=t.useState((null===(D=b.data)||void 0===D?void 0:D.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(N=b.data)||void 0===N?void 0:N.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,K]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[Z,J]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[W,ee]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[te,ie]=t.useState(void 0),[oe,ne]=t.useState(void 0),[le,re]=t.useState(void 0),[ae,de]=t.useState(void 0),[se,ce]=t.useState(void 0),[ue,pe]=t.useState(void 0),[Te,Ce]=t.useState(0),[Se,Ee]=t.useState(""),[Pe,Oe]=t.useState(V[0]),[Ie,ve]=t.useState(!1),[_e,be]=t.useState(i.initialStaticCouponErrorState),[ye,De]=t.useState(i.initialDynamicCouponErrorState),[Ne,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),he=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:X===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:X===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:X===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{b.makeExpiryMandatory&&ve(!0)}),[b.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();Q(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},T=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(ve(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?K(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(K(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,de)):K(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?ee(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(ee(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,de)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?J(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(J(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),T(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ce));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}w(Object.assign({},c)),b.hideProbability||(s=ge()),B(I.validateDiscountData(c,H,u,b.hideProbability||!1,s,!!c.isStaticCoupon)),b.hideProbability||ge()}),[]),t.useEffect((()=>{let e;b.hideProbability||(e=ge()),B(I.validateDiscountData(Y,H,X,b.hideProbability||!1,e,!!Y.isStaticCoupon))}),[Y,Te,X,H]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!b.newPickerConf&&((null===(e=b.products)||void 0===e?void 0:e.length)||(null===(t=b.collection)||void 0===t?void 0:t.length))){if(b.products&&(null===(i=b.products)||void 0===i?void 0:i.length)){if(null===(o=b.data)||void 0===o?void 0:o.entitledProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ne(e)}if(null===(n=b.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=b.products.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ie(e)}}if(b.collection&&b.collection.length){if(null===(l=b.data)||void 0===l?void 0:l.entitledCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));pe(e)}if(null===(r=b.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=b.collection.filter((e=>{var t,i;return null===(i=null===(t=b.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));re(e)}}}}),[b.products,b.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=b.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&ne(b.data.productsConf.entitledProducts),(null===(o=null===(i=b.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&ie(b.data.productsConf.prerequisiteProducts),(null===(l=null===(n=b.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&pe(b.data.collectionsConf.entitledCollections),(null===(a=null===(r=b.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&re(b.data.collectionsConf.prerequisiteCollections)}),[null===(m=b.data)||void 0===m?void 0:m.productsConf,null===(h=b.data)||void 0===h?void 0:h.collectionsConf]),t.useEffect((()=>{if(!oe)return;if(b.newPickerConf){const e=[];return Object.values(oe).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}const e=oe.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledProductIds:e}))}),[oe]),t.useEffect((()=>{if(!te)return;if(b.newPickerConf){const e=[];return Object.values(te).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}const e=te.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteProductIds:e}))}),[te]),t.useEffect((()=>{if(!ue)return;if(b.newPickerConf){(null==ue?void 0:ue.isCustom)&&delete ue.isCustom;const e=Object.keys(ue).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}const e=ue.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{entitledCollectionIds:e}))}),[ue]),t.useEffect((()=>{if(!le)return;if(b.newPickerConf){(null==le?void 0:le.isCustom)&&delete le.isCustom;const e=Object.keys(le).map((e=>parseInt(e)));return void w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}const e=le.map((e=>parseInt(e.id)));w(Object.assign(Object.assign({},Y),{prerequisiteCollectionIds:e}))}),[le]);const Ue=()=>{var e,t;let o,n=Y;return Y.isStaticCoupon||(Y.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:Y.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=Y.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=Y.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=Y.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||Y.prerequisiteQuantity||Y.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},fe=()=>{be(i.initialStaticCouponErrorState),De(i.initialDynamicCouponErrorState)},Ae=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=Y.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":Y.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},ge=()=>{if(!b.quadrant||!b.probability)return;const e=[...b.probability];let t=[];e.length>=b.quadrant&&e.splice(b.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(Y.probability||0);return Ce(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},je=e=>{var t,o,n,l,r,a,d,s,c,u,p,T,C,S,E,P;const O=e.value;Q(O),ie([]),ne([]),re([]),pe([]),O===i.DISCOUNT_TYPES.FREE_SHIPPING?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(t=Y.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=Y.expireAfter)&&void 0!==o?o:void 0,probability:Y.probability,minQuantity:null!==(n=Y.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=Y.minAmount)&&void 0!==l?l:void 0}):O===i.DISCOUNT_TYPES.BUY_X_GET_Y?w({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(r=Y.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=Y.expireAfter)&&void 0!==a?a:void 0,probability:Y.probability,minQuantity:void 0,minAmount:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=Y.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(s=Y.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=Y.expireAfter)&&void 0!==c?c:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(u=Y.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=Y.minAmount)&&void 0!==p?p:void 0}):O===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&w({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(T=Y.valueType)&&void 0!==T?T:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:Y.quadrant,isStaticCoupon:!1,title:Y.title,expireAt:null!==(C=Y.expireAt)&&void 0!==C?C:void 0,expireAfter:null!==(S=Y.expireAfter)&&void 0!==S?S:void 0,probability:Y.probability,value:Y.value,minQuantity:null!==(E=Y.minQuantity)&&void 0!==E?E:void 0,minAmount:null!==(P=Y.minAmount)&&void 0!==P?P:void 0})},Re=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:C.default});return e.jsxs(r.StyledModal,Object.assign({width:(k||x)&&b.newPickerConf?"25px":"640px",open:b.isOpen,hideCrossButton:!!q,headingTitle:x?"Select Products":b.title,headingSubtitle:x?void 0:b.subTitle,footerLeftCustomElement:Se?Re(Se):b.errorMsg?Re(b.errorMsg):!b.quadrant||b.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:T.default})})})),headerRightCustomElement:b.allowStaticCoupon||x?void 0:e.jsx(o.Dropdown,{options:he,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{je(e)}}),onClose:b.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:x?{buttonType:"primary",onClick:()=>{F(void 0)},buttonText:"Add"}:k?{buttonType:"primary",onClick:()=>{M(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=b.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(fe(),Y.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=Y,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!b.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(Ae(r))return void be(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:Y.title})}else{const r={invalidCouponTitle:!Y.title,inValidProbability:!b.hideProbability&&(null!==(e=Y.probability)&&void 0!==e?e:-1)<=0||(null!==(t=Y.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=Y.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!Y.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(X!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&H!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=Y;r.inValidMinimumAmount=H===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=H===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(Ie&&(r.inValidCouponExpiry=!Y.expireAt&&!Y.expireAfter),X!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&X!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidCollectionSelection=!0)),X===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(Y.prerequisiteQuantity||(r.inValidBuyXValue=!0),Y.entitledQuantity||(r.inValidGetYValue=!0),Z!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!te||Object.keys(te).length||se||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),Z===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&le&&!Object.keys(le).length&&(r.inValidBuyXCollectionSelection=!0),W!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!oe||Object.keys(oe).length||ae||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),W===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&ue&&!Object.keys(ue).length&&(r.inValidGetYCollectionSelection=!0)),Ae(r))return void De(r);if(G||Te>1)return void Ee(!b.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");b.onSaveClicked(Object.assign(Object.assign({},Y),{description:I.descriptionBuilder(Y,b.currency,null!==(n=b.products)&&void 0!==n?n:[],null!==(l=b.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[]},collectionsConf:{entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[]},productVariableConf:{entitledProductVariable:null!=ae?ae:{},prerequisiteProductVariable:null!=se?se:{}}}))}}},secondaryButton:x?{buttonType:"tertiaryGray",onClick:()=>{F(void 0)},buttonText:"Back"}:k?{buttonType:"tertiaryGray",onClick:()=>{M(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:b.onClose,buttonText:"Cancel"}},{children:[!x&&!k&&e.jsxs(O.StyledDiscountDialogueContainer,{children:[b.allowStaticCoupon&&!x&&e.jsxs(O.CouponTypeContainerStyled,Object.assign({selectedDiv:Y.isStaticCoupon?1:2},{children:["static"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{Y.isStaticCoupon||(w({isStaticCoupon:!0,quadrant:Y.quadrant}),Ee(""),fe())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===b.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;Y.isStaticCoupon&&(Q(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),w({isStaticCoupon:!1,quadrant:Y.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),fe(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:b.currency||""}))}),ve(null!==(t=b.makeExpiryMandatory)&&void 0!==t&&t),z(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:Y.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:Y.isStaticCoupon?{}:{color:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),Y.isStaticCoupon&&!x&&e.jsx(_.default,{discountData:Y,setDiscountData:w,hideProbability:b.hideProbability||!1,discountAdminUrl:b.discountAdminUrl,staticDiscountValidationError:_e,currency:b.currency}),!Y.isStaticCoupon&&!x&&!k&&e.jsx(v.default,{currency:b.currency,entitledProducts:null!=oe?oe:[],prerequisiteProducts:null!=te?te:[],setEntitledProducts:ne,setPrerequisiteProducts:ie,discountData:Y,productPickerOpen:x,productVariablePickerOpen:q,setIsProductPickerOpen:F,setIsProductVariablePickerOpen:L,setDiscountData:w,selectedCouponType:X,setSelectedCouponType:Q,selectedMinimumRequirement:H,setSelectedMinimumRequirement:z,discountCouponAppliesTo:$,offerAppliesToBuy:Z,offerAppliesToGet:W,setDiscountCouponAppliesTo:K,setOfferAppliesToBuy:J,setOfferAppliesToGet:ee,hideProbability:b.hideProbability||!1,hideExpiration:b.hideExpiration||!1,allowStaticCoupon:b.allowStaticCoupon,onChangeCouponType:je,collectionPickerOpen:k,entitledCollections:null!=ue?ue:[],prerequisiteCollections:null!=le?le:[],setIsCollectionPickerOpen:M,setEntitledCollections:pe,setPrerequisiteCollections:re,useNewPicker:!!b.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Pe,isProductVariableSupported:b.isProductVariableSupported,entitledProductVariable:ae,setEntitledProductVariable:de,preRequisiteProductVariable:se,setPreRequisiteProductVariable:ce,productVariableList:b.productVariableList,isAddExpirationChecked:Ie,setIsAddExpirationChecked:ve,dynamicDiscountValidationError:ye,setDynamicDiscountValidationError:De,setValidationErrorMessage:Ee,resetValidationErrors:fe,discountDetailsOptions:V,selectedExpiration:Ne,setSelectedExpiration:me,makeExpiryMandatory:!!b.makeExpiryMandatory})]}),!!x&&e.jsxs(e.Fragment,{children:[!b.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(f=b.products)&&void 0!==f?f:[],title:"Select Products",onClose:()=>{F(void 0)},selectedProducts:null!==(A=x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te)&&void 0!==A?A:[],setSelectedProducts:x===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onSearchKeyChange:b.onProductSearch})})),b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>F(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:x===v.DISCOUNT_PRODUCTS.ENTITLED?oe:te,onAdd:e=>{x===v.DISCOUNT_PRODUCTS.ENTITLED?ne(e):ie(e),F(void 0)},zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,customCollectionRestriction:!1,searchFetcher:b.newPickerConf.searchProducts,hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!k&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[b.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>M(void 0),collectionFetcher:b.newPickerConf.fetchCollections,productFetcher:b.newPickerConf.fetchProducts,selectedItems:k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),k===v.DISCOUNT_PRODUCTS.ENTITLED?pe(e):re(e),M(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:b.newPickerConf.storeId,searchInCollectionFetcher:b.newPickerConf.searchInCollection,searchFetcher:b.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!b.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(g=b.collection)&&void 0!==g?g:[],title:"Select Products",onClose:()=>{M(void 0)},selectedProducts:null!==(j=k===v.DISCOUNT_PRODUCTS.ENTITLED?ue:le)&&void 0!==j?j:[],setSelectedProducts:k===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onSearchKeyChange:b.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(O.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(P.VariablePicker,{type:E.PickerType.EMBEDDED,data:null!==(R=b.productVariableList)&&void 0!==R?R:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;de({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ce({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("react"),i=require("./type.js");require("../dropdown/DropdownPopover/index.js");var o=require("../dropdown/Dropdown.js");require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var n=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.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("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../icon-button/IconButton.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");var r=require("../modals/styledModal.js"),a=require("../product-picker/ProductPickerModal.js"),d=require("../tag/Tag.js"),s=require("../tooltips/Tooltip.js"),c=require("../../assets/icons/gift_icon.svg.js"),u=require("../../assets/icons/percentage_icon.svg.js"),p=require("../../assets/icons/shipping_icon.svg.js"),C=require("../../assets/icons/triangle_error.svg.js"),T=require("../../assets/icons/warning.svg.js"),S=require("../product-picker-v2/modal.js"),P=require("../variable-picker-v3/model.js"),E=require("../variable-picker-v3/VariablePicker.js"),I=require("./DiscountModal.styled.js"),O=require("./DiscountUtils.js"),v=require("./DynamicCoupon/DynamicCoupon.js"),_=require("./StaticCoupon/StaticCoupon.js"),b=require("../../_virtual/bik-store.js");exports.DiscountModal=y=>{var D,N,h,m,f,U,A,g,j,R,x;const V=[{id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t,lineHeight:.9}},{children:y.currency||""}))},{id:"1",label:"Percentage",value:"percentage",icon:t=>e.jsx(u.default,{width:24,height:24,color:t})},{id:"2",label:"Buy X get Y",value:i.DISCOUNT_TYPES.BUY_X_GET_Y,icon:t=>e.jsx(c.default,{width:24,height:24,color:t})},{id:"3",label:"Free Shipping",value:i.DISCOUNT_TYPES.FREE_SHIPPING,icon:t=>e.jsx(p.default,{width:24,height:24,color:t})}],[F,k]=t.useState(),[q,L]=t.useState(),[M,Y]=t.useState(),[w,G]=t.useState(null!==(D=y.data)&&void 0!==D?D:"string"==typeof y.hideOption?{isStaticCoupon:"dynamic"===y.hideOption}:{isStaticCoupon:!0}),[B,X]=t.useState(!0),[Q,H]=t.useState(),[z,K]=t.useState((null===(N=y.data)||void 0===N?void 0:N.minAmount)?i.MIN_PURCHASE_REQUIREMENT.AMOUNT:(null===(h=y.data)||void 0===h?void 0:h.minQuantity)?i.MIN_PURCHASE_REQUIREMENT.QUANTITY:i.MIN_PURCHASE_REQUIREMENT.NA),[$,Z]=t.useState(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),[J,W]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ee,te]=t.useState(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),[ie,oe]=t.useState(void 0),[ne,le]=t.useState(void 0),[re,ae]=t.useState(void 0),[de,se]=t.useState(void 0),[ce,ue]=t.useState(void 0),[pe,Ce]=t.useState(void 0),[Te,Se]=t.useState(0),[Pe,Ee]=t.useState(""),[Ie,Oe]=t.useState(V[0]),[ve,_e]=t.useState(!1),[be,ye]=t.useState(i.initialStaticCouponErrorState),[De,Ne]=t.useState(i.initialDynamicCouponErrorState),[he,me]=t.useState(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION),fe=[{value:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER,label:"Amount off on order",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER},{value:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS,label:"Amount off on products",selected:Q===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS},{value:i.DISCOUNT_TYPES.BUY_X_GET_Y,label:"Buy X Get Y FREE",selected:Q===i.DISCOUNT_TYPES.BUY_X_GET_Y},{value:i.DISCOUNT_TYPES.FREE_SHIPPING,label:"Free shipping",selected:Q===i.DISCOUNT_TYPES.FREE_SHIPPING}];t.useEffect((()=>{y.makeExpiryMandatory&&_e(!0)}),[y.makeExpiryMandatory]),t.useEffect((()=>{var e,t,o,n,l,r,a,d;let s;const{tempCouponData:c,discountType:u}=Ue();H(u);const p=(e,t)=>{Oe(c.valueType===i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?V[e]:V[t])},C=(e,t)=>{Object.keys(e||{}).length&&t(e)};switch(((null==c?void 0:c.expireAfter)||(null==c?void 0:c.expireAt))&&(_e(!0),(null==c?void 0:c.expireAt)&&me(i.COUPON_EXPIRATION.FIXED_EXPIRATION),(null==c?void 0:c.expireAfter)&&me(i.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)),u){case i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:p(0,1),Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:p(0,1),(null===(e=c.entitledCollectionIds)||void 0===e?void 0:e.length)?Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS):(null===(t=c.entitledProductIds)||void 0===t?void 0:t.length)||(null===(o=c.productVariableConf)||void 0===o?void 0:o.entitledProductVariable)?(Z(i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(n=c.productVariableConf)||void 0===n?void 0:n.entitledProductVariable,se)):Z(i.DISCOUNT_APPLIES_TO.ENTIRE_ORDER);break;case i.DISCOUNT_TYPES.BUY_X_GET_Y:Oe(V[2]),(null===(l=c.entitledCollectionIds)||void 0===l?void 0:l.length)?te(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(te(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(r=c.productVariableConf)||void 0===r?void 0:r.entitledProductVariable,se)),(null===(a=c.prerequisiteCollectionIds)||void 0===a?void 0:a.length)?W(i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS):(W(i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS),C(null===(d=c.productVariableConf)||void 0===d?void 0:d.prerequisiteProductVariable,ue));break;case i.DISCOUNT_TYPES.FREE_SHIPPING:Oe(V[3])}G(Object.assign({},c)),y.hideProbability||(s=je()),X(O.validateDiscountData(c,z,u,y.hideProbability||!1,s,!!c.isStaticCoupon)),y.hideProbability||je()}),[]),t.useEffect((()=>{let e;y.hideProbability||(e=je()),X(O.validateDiscountData(w,z,Q,y.hideProbability||!1,e,!!w.isStaticCoupon))}),[w,Te,Q,z]),t.useEffect((()=>{var e,t,i,o,n,l,r;if(!y.newPickerConf&&((null===(e=y.products)||void 0===e?void 0:e.length)||(null===(t=y.collection)||void 0===t?void 0:t.length))){if(y.products&&(null===(i=y.products)||void 0===i?void 0:i.length)){if(null===(o=y.data)||void 0===o?void 0:o.entitledProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));le(e)}if(null===(n=y.data)||void 0===n?void 0:n.prerequisiteProductIds){const e=y.products.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteProductIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));oe(e)}}if(y.collection&&y.collection.length){if(null===(l=y.data)||void 0===l?void 0:l.entitledCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.entitledCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));Ce(e)}if(null===(r=y.data)||void 0===r?void 0:r.prerequisiteCollectionIds){const e=y.collection.filter((e=>{var t,i;return null===(i=null===(t=y.data)||void 0===t?void 0:t.prerequisiteCollectionIds)||void 0===i?void 0:i.includes(parseInt(e.id))}));ae(e)}}}}),[y.products,y.collection]),t.useEffect((()=>{var e,t,i,o,n,l,r,a;(null===(t=null===(e=y.data)||void 0===e?void 0:e.productsConf)||void 0===t?void 0:t.entitledProducts)&&le(y.data.productsConf.entitledProducts),(null===(o=null===(i=y.data)||void 0===i?void 0:i.productsConf)||void 0===o?void 0:o.prerequisiteProducts)&&oe(y.data.productsConf.prerequisiteProducts),(null===(l=null===(n=y.data)||void 0===n?void 0:n.collectionsConf)||void 0===l?void 0:l.entitledCollections)&&Ce(y.data.collectionsConf.entitledCollections),(null===(a=null===(r=y.data)||void 0===r?void 0:r.collectionsConf)||void 0===a?void 0:a.prerequisiteCollections)&&ae(y.data.collectionsConf.prerequisiteCollections)}),[null===(m=y.data)||void 0===m?void 0:m.productsConf,null===(f=y.data)||void 0===f?void 0:f.collectionsConf]),t.useEffect((()=>{if(!ne)return;if(y.newPickerConf){const e=[];return Object.values(ne).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}const e=ne.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledProductIds:e}))}),[ne]),t.useEffect((()=>{if(!ie)return;if(y.newPickerConf){const e=[];return Object.values(ie).forEach((t=>{t.products&&Object.keys(t.products).forEach((t=>{e.push(parseInt(t))}))})),void G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}const e=ie.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteProductIds:e}))}),[ie]),t.useEffect((()=>{if(!pe)return;if(y.newPickerConf){(null==pe?void 0:pe.isCustom)&&delete pe.isCustom;const e=Object.keys(pe).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}const e=pe.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{entitledCollectionIds:e}))}),[pe]),t.useEffect((()=>{if(!re)return;if(y.newPickerConf){(null==re?void 0:re.isCustom)&&delete re.isCustom;const e=Object.keys(re).map((e=>parseInt(e)));return void G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}const e=re.map((e=>parseInt(e.id)));G(Object.assign(Object.assign({},w),{prerequisiteCollectionIds:e}))}),[re]);const Ue=()=>{var e,t;let o,n=w;return w.isStaticCoupon||(w.targetType===i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE?o=i.DISCOUNT_TYPES.FREE_SHIPPING:w.targetType===i.DISCOUNT_TARGET_TYPES.LINE_ITEM?o=w.targetSelection===i.DISCOUNT_TARGET_SELECTION.ENTITLED?(null===(e=w.prerequisiteProductIds)||void 0===e?void 0:e.length)||(null===(t=w.prerequisiteCollectionIds)||void 0===t?void 0:t.length)||w.prerequisiteQuantity||w.entitledQuantity?i.DISCOUNT_TYPES.BUY_X_GET_Y:i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS:i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER:(n=Object.assign(Object.assign({},n),{targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),o=i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER)),{discountType:o,tempCouponData:n}},Ae=()=>{ye(i.initialStaticCouponErrorState),Ne(i.initialDynamicCouponErrorState)},ge=e=>{var t;const i={invalidDiscountCode:"Please add Discount Code",invalidCouponTitle:"Please add Discount Coupon Title",invalidCouponDescription:"Please add Coupon Description",inValidProbability:e.inValidProbability&&(null!==(t=w.probability)&&void 0!==t?t:-1)>1?"Probability should not exceed 1":w.isStaticCoupon?"Please add Probability":"Probability should be greater than 0",inValidDiscountAmount:"Please add Discount Amount",inValidMinimumAmount:"Specify minimum amount required",inValidMinimumQuantity:"Specify minimum items required",inValidCouponExpiry:"Please add Coupon Expiry",inValidProductSelection:"Please specify the products",inValidProductVariableSelection:"Please specify the product variables",inValidCollectionSelection:"Please specify the collections",inValidBuyXValue:"Please specify buy product quantity",inValidGetYValue:"Please specify get product quantity",inValidBuyXProductSelection:"Please specify the products",inValidBuyXCollectionSelection:"Please specify the collections",inValidGetYProductSelection:"Please specify the products",inValidGetYCollectionSelection:"Please specify the collections",inValidBuyXProductVariableSelection:"Please specify the product variables",inValidGetYProductVariableSelection:"Please specify the product variables"};let o="";Object.keys(e).forEach((t=>{e[t]&&(o=i[t])}));const n=Object.values(e).filter(Boolean).length;return n>0&&(Ee(n>1?"Please add discount details":o),!0)},je=()=>{if(!y.quadrant||!y.probability)return;const e=[...y.probability];let t=[];e.length>=y.quadrant&&e.splice(y.quadrant-1,1),t=e;const i=t.reduce(((e,t)=>e+t),0)+(w.probability||0);return Se(parseFloat(i.toFixed(4))),parseFloat(i.toFixed(4))},Re=e=>{var t,o,n,l,r,a,d,s,c,u,p,C,T,S,P,E;const I=e.value;H(I),oe([]),le([]),ae([]),Ce([]),I===i.DISCOUNT_TYPES.FREE_SHIPPING?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.SHIPPING_LINE,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(t=w.expireAt)&&void 0!==t?t:void 0,expireAfter:null!==(o=w.expireAfter)&&void 0!==o?o:void 0,probability:w.probability,minQuantity:null!==(n=w.minQuantity)&&void 0!==n?n:void 0,minAmount:null!==(l=w.minAmount)&&void 0!==l?l:void 0}):I===i.DISCOUNT_TYPES.BUY_X_GET_Y?G({value:100,targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:i.DISCOUNT_VALUE_TYPES.PERCENTAGE,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(r=w.expireAt)&&void 0!==r?r:void 0,expireAfter:null!==(a=w.expireAfter)&&void 0!==a?a:void 0,probability:w.probability,minQuantity:void 0,minAmount:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER?G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(d=w.valueType)&&void 0!==d?d:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(s=w.expireAt)&&void 0!==s?s:void 0,expireAfter:null!==(c=w.expireAfter)&&void 0!==c?c:void 0,probability:w.probability,value:w.value,minQuantity:null!==(u=w.minQuantity)&&void 0!==u?u:void 0,minAmount:null!==(p=w.minAmount)&&void 0!==p?p:void 0}):I===i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS&&G({targetSelection:i.DISCOUNT_TARGET_SELECTION.ENTITLED,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,valueType:null!==(C=w.valueType)&&void 0!==C?C:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,quadrant:w.quadrant,isStaticCoupon:!1,title:w.title,expireAt:null!==(T=w.expireAt)&&void 0!==T?T:void 0,expireAfter:null!==(S=w.expireAfter)&&void 0!==S?S:void 0,probability:w.probability,value:w.value,minQuantity:null!==(P=w.minQuantity)&&void 0!==P?P:void 0,minAmount:null!==(E=w.minAmount)&&void 0!==E?E:void 0})},xe=t=>t&&e.jsx(d.Tag,{theme:"light",tagText:t,type:"negative",LeadingIcon:T.default});return e.jsxs(r.StyledModal,Object.assign({width:(M||F)&&y.newPickerConf?"25px":"640px",open:y.isOpen,hideCrossButton:!!q,headingTitle:F?"Select Products":y.title,headingSubtitle:F?void 0:y.subTitle,footerLeftCustomElement:Pe?xe(Pe):y.errorMsg?xe(y.errorMsg):!y.quadrant||y.hideProbability?e.jsx(e.Fragment,{}):Te<=1?e.jsx(d.Tag,{theme:"light",tagText:`Current probability sum: ${Te}`,type:"white"}):e.jsx(s.Tooltip,Object.assign({body:"Probability sum should not exceed 1",placement:"top"},{children:e.jsx("div",{children:e.jsx(d.Tag,{style:{cursor:"pointer"},theme:"light",tagText:`Current probability sum: ${Te}`,type:"negative",LeadingIcon:C.default})})})),headerRightCustomElement:y.allowStaticCoupon||F?void 0:e.jsx(o.Dropdown,{options:fe,width:"200px",placement:"bottom-start",size:"small",onSelect:e=>{Re(e)}}),onClose:y.onClose,footerContainerStyle:{borderTop:`1px solid ${l.DEFAULT_THEME.colorsV2.stroke.primary}`},primaryButton:F?{buttonType:"primary",onClick:()=>{k(void 0)},buttonText:"Add"}:M?{buttonType:"primary",onClick:()=>{Y(void 0)},buttonText:"Add"}:{buttonType:"primary",buttonText:"Create discount code",isLoading:null!==(U=y.loading)&&void 0!==U&&U,onClick:()=>{var e,t,o,n,l;if(Ae(),w.isStaticCoupon){const{isStaticCoupon:e,couponCode:t,title:i,description:o,quadrant:n,probability:l}=w,r={invalidDiscountCode:!t,invalidCouponTitle:!i,invalidCouponDescription:!o,inValidProbability:!y.hideProbability&&(null!=l?l:-1)<0||(null!=l?l:0)>1||Number.isNaN(null!=l?l:0)};if(ge(r))return void ye(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked({quadrant:n,couponCode:t,description:o,isStaticCoupon:e,probability:l,title:w.title})}else{const r={invalidCouponTitle:!w.title,inValidProbability:!y.hideProbability&&(null!==(e=w.probability)&&void 0!==e?e:-1)<=0||(null!==(t=w.probability)&&void 0!==t?t:-1)>1||Number.isNaN(null!==(o=w.probability)&&void 0!==o?o:-1),inValidDiscountAmount:!w.value,inValidMinimumQuantity:!1,inValidMinimumAmount:!1,inValidCouponExpiry:!1,inValidProductSelection:!1,inValidProductVariableSelection:!1,inValidCollectionSelection:!1,inValidBuyXValue:!1,inValidGetYValue:!1,inValidBuyXProductSelection:!1,inValidGetYProductSelection:!1,inValidBuyXCollectionSelection:!1,inValidGetYCollectionSelection:!1,inValidBuyXProductVariableSelection:!1,inValidGetYProductVariableSelection:!1};if(Q!==i.DISCOUNT_TYPES.BUY_X_GET_Y&&z!==i.MIN_PURCHASE_REQUIREMENT.NA){const{minAmount:e,minQuantity:t}=w;r.inValidMinimumAmount=z===i.MIN_PURCHASE_REQUIREMENT.AMOUNT&&!e,r.inValidMinimumQuantity=z===i.MIN_PURCHASE_REQUIREMENT.QUANTITY&&!t}if(ve&&(r.inValidCouponExpiry=!w.expireAt&&!w.expireAfter),Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER&&Q!==i.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS||($!==i.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidProductSelection=!0,r.inValidProductVariableSelection=!0),$===i.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidCollectionSelection=!0)),Q===i.DISCOUNT_TYPES.BUY_X_GET_Y&&(w.prerequisiteQuantity||(r.inValidBuyXValue=!0),w.entitledQuantity||(r.inValidGetYValue=!0),J!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ie||Object.keys(ie).length||ce||(r.inValidBuyXProductSelection=!0,r.inValidBuyXProductVariableSelection=!0),J===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&re&&!Object.keys(re).length&&(r.inValidBuyXCollectionSelection=!0),ee!==i.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS||!ne||Object.keys(ne).length||de||(r.inValidGetYProductSelection=!0,r.inValidGetYProductVariableSelection=!0),ee===i.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS&&pe&&!Object.keys(pe).length&&(r.inValidGetYCollectionSelection=!0)),ge(r))return void Ne(r);if(B||Te>1)return void Ee(!y.hideProbability&&Te>1?"Probability sum should not exceed 1":"Invalid coupon details");y.onSaveClicked(Object.assign(Object.assign({},w),{description:O.descriptionBuilder(w,y.currency,null!==(n=y.products)&&void 0!==n?n:[],null!==(l=y.collection)&&void 0!==l?l:[]),productsConf:{entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[]},collectionsConf:{entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[]},productVariableConf:{entitledProductVariable:null!=de?de:{},prerequisiteProductVariable:null!=ce?ce:{}}}))}}},secondaryButton:F?{buttonType:"tertiaryGray",onClick:()=>{k(void 0)},buttonText:"Back"}:M?{buttonType:"tertiaryGray",onClick:()=>{Y(void 0)},buttonText:"Back"}:{buttonType:"tertiaryGray",onClick:y.onClose,buttonText:"Cancel"}},{children:[!F&&!M&&e.jsxs(I.StyledDiscountDialogueContainer,{children:[y.allowStaticCoupon&&!F&&e.jsxs(I.CouponTypeContainerStyled,Object.assign({selectedDiv:w.isStaticCoupon?1:2},{children:["static"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{w.isStaticCoupon||(G({isStaticCoupon:!0,quadrant:w.quadrant}),Ee(""),Ae())}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?l.DEFAULT_THEME.colorsV2.content.brand:void 0}},{children:"Static Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{color:l.DEFAULT_THEME.colorsV2.content.brand}:{}},{children:"A uniform code provided manually, used for providing the same discount to all customers."}))]})),"dynamic"===y.hideOption?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({className:"coupon-type__container",onClick:()=>{var t;w.isStaticCoupon&&(H(i.DISCOUNT_TYPES.AMOUNT_OFF_ORDER),G({isStaticCoupon:!1,quadrant:w.quadrant,targetType:i.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:i.DISCOUNT_TARGET_SELECTION.ALL,valueType:i.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT}),Ee(""),Ae(),Oe({id:"0",label:"Amount",value:"amount",icon:t=>e.jsx("span",Object.assign({style:{fontSize:20,color:t}},{children:y.currency||""}))}),_e(null!==(t=y.makeExpiryMandatory)&&void 0!==t&&t),K(i.MIN_PURCHASE_REQUIREMENT.NA))}},{children:[e.jsx(n.TitleSmall,Object.assign({style:{marginBottom:"4px",color:w.isStaticCoupon?void 0:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Dynamic Code"})),e.jsx(n.BodyCaption,Object.assign({style:w.isStaticCoupon?{}:{color:l.DEFAULT_THEME.colorsV2.content.brand}},{children:"Code will be unique for all customers, with the first 5 letters of the customer's name, followed by 10 random characters."}))]}))]})),e.jsx(n.TitleRegular,Object.assign({style:{marginTop:"24px"}},{children:"Coupon Details"})),w.isStaticCoupon&&!F&&e.jsx(_.default,{discountData:w,setDiscountData:G,hideProbability:y.hideProbability||!1,discountAdminUrl:y.discountAdminUrl,staticDiscountValidationError:be,currency:y.currency}),!w.isStaticCoupon&&!F&&!M&&e.jsx(v.default,{currency:y.currency,entitledProducts:null!=ne?ne:[],prerequisiteProducts:null!=ie?ie:[],setEntitledProducts:le,setPrerequisiteProducts:oe,discountData:w,productPickerOpen:F,productVariablePickerOpen:q,setIsProductPickerOpen:k,setIsProductVariablePickerOpen:L,setDiscountData:G,selectedCouponType:Q,setSelectedCouponType:H,selectedMinimumRequirement:z,setSelectedMinimumRequirement:K,discountCouponAppliesTo:$,offerAppliesToBuy:J,offerAppliesToGet:ee,setDiscountCouponAppliesTo:Z,setOfferAppliesToBuy:W,setOfferAppliesToGet:te,hideProbability:y.hideProbability||!1,hideExpiration:y.hideExpiration||!1,allowStaticCoupon:y.allowStaticCoupon,onChangeCouponType:Re,collectionPickerOpen:M,entitledCollections:null!=pe?pe:[],prerequisiteCollections:null!=re?re:[],setIsCollectionPickerOpen:Y,setEntitledCollections:Ce,setPrerequisiteCollections:ae,useNewPicker:!!y.newPickerConf,setSelectedDiscountDetails:Oe,selectedDiscountDetails:Ie,isProductVariableSupported:y.isProductVariableSupported,entitledProductVariable:de,setEntitledProductVariable:se,preRequisiteProductVariable:ce,setPreRequisiteProductVariable:ue,productVariableList:y.productVariableList,isAddExpirationChecked:ve,setIsAddExpirationChecked:_e,dynamicDiscountValidationError:De,setDynamicDiscountValidationError:Ne,setValidationErrorMessage:Ee,resetValidationErrors:Ae,discountDetailsOptions:V,selectedExpiration:he,setSelectedExpiration:me,makeExpiryMandatory:!!y.makeExpiryMandatory})]}),!!F&&e.jsxs(e.Fragment,{children:[!y.newPickerConf&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(A=y.products)&&void 0!==A?A:[],title:"Select Products",onClose:()=>{k(void 0)},selectedProducts:null!==(g=F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie)&&void 0!==g?g:[],setSelectedProducts:F===v.DISCOUNT_PRODUCTS.ENTITLED?le:oe,onSearchKeyChange:y.onProductSearch})})),y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>k(void 0),collectionFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.fetchCollections)?y.newPickerConf.fetchCollections(e,t,!1,i):null},productFetcher:(e,t,i,o,n)=>{var l;return(null===(l=y.newPickerConf)||void 0===l?void 0:l.fetchProducts)?y.newPickerConf.fetchProducts(e,t,o,n,!1,i):null},selectedItems:F===v.DISCOUNT_PRODUCTS.ENTITLED?ne:ie,onAdd:e=>{F===v.DISCOUNT_PRODUCTS.ENTITLED?le(e):oe(e),k(void 0)},zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:(e,t,i,o)=>{var n;return(null===(n=y.newPickerConf)||void 0===n?void 0:n.searchInCollection)?y.newPickerConf.searchInCollection(e,t,i,!1,o):null},customCollectionRestriction:!1,searchFetcher:(e,t,i)=>{var o;return(null===(o=y.newPickerConf)||void 0===o?void 0:o.searchProducts)?y.newPickerConf.searchProducts(e,t,!1,i):null},hideCollectionCheckbox:!0,hideVariantCheckbox:!0,selectProductsFromCustomCollection:!0,hideSelectionCount:!0})]}),!!M&&e.jsx("div",Object.assign({style:{padding:"12px 0"}},{children:e.jsxs(e.Fragment,{children:[y.newPickerConf&&e.jsx(S.ProductPickerModal,{visible:!0,onClose:()=>Y(void 0),collectionFetcher:y.newPickerConf.fetchCollections,productFetcher:y.newPickerConf.fetchProducts,selectedItems:M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re,onAdd:e=>{Object.values(e).forEach((e=>{e.products&&delete e.products})),M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce(e):ae(e),Y(void 0)},customCollectionRestriction:!1,zIndex:200,storeId:y.newPickerConf.storeId,appType:y.newPickerConf.appType||b.__exports.ApplicationType.BIK,searchInCollectionFetcher:y.newPickerConf.searchInCollection,searchFetcher:y.newPickerConf.searchProducts,hideProductCheckbox:!0,hideVariantCheckbox:!0,title:"Select Collections",hideGlobalSearch:!0,hideSelectionCount:!0}),!y.newPickerConf&&e.jsx(a.ProductPickerContent,{show:!0,onSave:()=>{},products:null!==(j=y.collection)&&void 0!==j?j:[],title:"Select Products",onClose:()=>{Y(void 0)},selectedProducts:null!==(R=M===v.DISCOUNT_PRODUCTS.ENTITLED?pe:re)&&void 0!==R?R:[],setSelectedProducts:M===v.DISCOUNT_PRODUCTS.ENTITLED?Ce:ae,onSearchKeyChange:y.onCollectionSearch,searchPlaceholder:"Search collections..."})]})})),q&&e.jsx(I.VariablePickerContainer,{children:e.jsx("div",Object.assign({style:{width:"50%",height:"100%",marginLeft:"50%"}},{children:e.jsx(E.VariablePicker,{type:P.PickerType.EMBEDDED,data:null!==(x=y.productVariableList)&&void 0!==x?x:[],showHeader:!0,onSelect:e=>{if(q===v.DISCOUNT_PRODUCTS.ENTITLED){const{displayName:t,actualValue:i,isAvailable:o}=e;se({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}if(q===v.DISCOUNT_PRODUCTS.PREREQUISITE){const{displayName:t,actualValue:i,isAvailable:o}=e;ue({displayName:t,actualValue:i,isAvailable:o}),L(void 0)}},onClose:()=>{L(void 0)}})}))})]}))};
|