@bikdotai/bik-component-library 0.0.721-beta.0 → 0.0.721-beta.11
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/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.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 +1 -5
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.d.ts +0 -6
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.js +2 -23
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.d.ts +0 -11
- package/dist/cjs/components/feature-announcements/FeatureAnnouncement.types.d.ts +27 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.d.ts +14 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.d.ts +14 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.d.ts +14 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/VideoModal.d.ts +8 -0
- package/dist/cjs/components/feature-announcements/VideoModal.js +1 -0
- package/dist/cjs/components/feature-announcements/index.d.ts +6 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.d.ts +24 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/cjs/components/whats-new/WhatsNew.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/cjs/components/whats-new/index.d.ts +7 -0
- package/dist/cjs/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/cjs/components/whats-new/useWhatsNew.js +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.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 +1 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.d.ts +0 -6
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.js +3 -24
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.d.ts +0 -11
- package/dist/esm/components/feature-announcements/FeatureAnnouncement.types.d.ts +27 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.d.ts +14 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.d.ts +14 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.d.ts +14 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/VideoModal.d.ts +8 -0
- package/dist/esm/components/feature-announcements/VideoModal.js +1 -0
- package/dist/esm/components/feature-announcements/index.d.ts +6 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.d.ts +24 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.js +1 -0
- package/dist/esm/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/esm/components/whats-new/WhatsNew.js +1 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/esm/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/esm/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/esm/components/whats-new/index.d.ts +7 -0
- package/dist/esm/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/esm/components/whats-new/useWhatsNew.js +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.js +0 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraphModel.js +0 -1
|
@@ -36,7 +36,7 @@ export declare class MetaCustomProcessor {
|
|
|
36
36
|
value: {
|
|
37
37
|
operator: string;
|
|
38
38
|
dataType: import("../types").QueryBuilderConnectorType;
|
|
39
|
-
value?: string | number | string[] |
|
|
39
|
+
value?: string | number | string[] | number[] | Date | Date[] | undefined;
|
|
40
40
|
};
|
|
41
41
|
key: string;
|
|
42
42
|
refresh?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../shimmer/ShimmerComponent/ShimmerStyled.js"),i=require("../../utils/DateUtils.js"),s=require("../../constants/Theme.js"),r=require("../../assets/icons/arrow_down.svg.js"),o=require("../../assets/icons/arrow_up.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),x=require("../TypographyStyle.js"),u=require("./chart/utils/calcPercentage.js"),d=require("./CommonStyles.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(t);const j=n=>{let{percent:l,direction:a,timeline:d,customRange:m,trendRaw:p,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../shimmer/ShimmerComponent/ShimmerStyled.js"),i=require("../../utils/DateUtils.js"),s=require("../../constants/Theme.js"),r=require("../../assets/icons/arrow_down.svg.js"),o=require("../../assets/icons/arrow_up.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),x=require("../TypographyStyle.js"),u=require("./chart/utils/calcPercentage.js"),d=require("./CommonStyles.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(t);const j=n=>{let{percent:l,direction:a,timeline:d,customRange:m,trendRaw:p,prefixSymbol:j,trendIconStyle:g,isInternationalStore:h,tooltipTimelineText:y,customTimelineText:R}=n;const b=()=>{const e=((null!=p?p:0)>0?"+":"")+(null!=j?j:"");return void 0===p?"--":`${null!=e?e:""}${(()=>{let e="--";if(p)return e=String(h?u.truncateValueForInternationalStore(Math.abs(p)):u.truncateValueForIndianStore(Math.abs(p))),p<0?"-"+e:e})()}`},[f,O]=t.useState(b()),[S,T]=t.useState(R||"");t.useEffect((()=>{R||T("today"===d?"vs yesterday":"yesterday"===d?"vs 1 day before":"7 days"===d?"vs last 7 days":"30 days"===d?"vs last 30 days":"custom"===d&&m?i.default.getAnalyticsCustomDateTimelineText(m):"")}),[d,m]),t.useEffect((()=>{O(b())}),[p]);const v="negative"===a?r.default:o.default,E="negative"===a?s.COLORS.background.negative.vibrant:"positive"===a?s.COLORS.background.positive.vibrant:s.COLORS.content.placeholder;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row",flexWrap:"wrap"}},{children:["number"==typeof l&&e.jsxRuntimeExports.jsx(v,{color:E,height:16,width:16,style:Object.assign({marginRight:2},null!=g?g:{})}),"number"==typeof l&&a&&e.jsxRuntimeExports.jsxs(x.Caption,Object.assign({style:{color:E}},{children:["neutral"===a?0:l<1e3?l:">999","%"]})),!!p&&e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:`(${f})`})),d&&(y?e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:y,placement:"bottom"},{children:e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:R||S}))})):e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:R||S})))]}))};exports.AnalyticsTrend=t=>{let{title:i,value:r,trendPercent:o,type:m="horizontal",timeline:g,customRange:h,tooltip:y,card:R=!0,rightSeparator:b=!1,size:f="big",share:O=!1,formatVal:S,prefixSymbol:T,trailingIcon:v,onTrailIconClick:E,iconTooltipBody:C,funnelPercent:w,isLoading:I,trendRaw:$,suffixText:L,trendStyle:q,trendContainerStyle:D,trendIconStyle:F,containerStyle:M,prevTrendDiff:k,relativePercentageDiff:P,isInternationalStore:V,Icon:_,iconContainerStyle:z,tooltipTimelineText:A,customTimelineText:N}=t;const B="big"===f?x.TitleLarge:x.TitleMedium,W=void 0!==o?o<0?"negative":0===o?"neutral":"positive":void 0,U=void 0!==o?O?Math.round(o):Math.abs(Math.round(o)):void 0;return e.jsxRuntimeExports.jsx(d.AnalyticsTrendContainer,Object.assign({card:R,style:Object.assign({},M)},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:_?12:4,borderRightWidth:b?1:0,borderRightColor:s.COLORS.stroke.primary,borderRightStyle:"solid",paddingLeft:R?0:24,paddingRight:R?0:24,height:"100%",justifyContent:_?"flex-start":"space-between",alignItems:"center"},null!=D?D:{})},{children:[!!_&&e.jsxRuntimeExports.jsx(d.IconContainer,Object.assign({style:Object.assign({},z)},{children:e.jsxRuntimeExports.jsx(_,{})})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"column",gap:4,height:"100%"},null!=q?q:{})},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(x.BodyCaption,Object.assign({style:{color:s.COLORS.content.secondary}},{children:i})),y&&e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:y,placement:"right",width:300},{children:e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",cursor:"pointer",height:"100%"}},{children:e.jsxRuntimeExports.jsx(l.default,{color:s.COLORS.content.primary,height:16,width:16})}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},O?{justifyContent:"space-between"}:{})},{children:[I&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{width:108,height:26}),!I&&e.jsxRuntimeExports.jsx(B,Object.assign({style:{color:s.COLORS.content.primary}},{children:void 0===r?"--":"number"==typeof r&&S?r>999?V?`${null!=T?T:""}${u.truncateValueForInternationalStore(r)} ${null!=L?L:""}`:`${null!=T?T:""}${u.truncateValueForIndianStore(r)} ${null!=L?L:""}`:`${null!=T?T:""}${new Intl.NumberFormat("en-IN",{maximumFractionDigits:2}).format(r)} ${null!=L?L:""}`:`${null!=T?T:""}${r} ${null!=L?L:""}`})),"number"==typeof P&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${P}%`,theme:"light",type:"neutral"}),"horizontal"===m&&!I&&!O&&e.jsxRuntimeExports.jsx(j,{timeline:g,customRange:h,percent:U,direction:W,trendRaw:$,prefixSymbol:T,trendIconStyle:F,isInternationalStore:V,tooltipTimelineText:A,customTimelineText:N}),I&&!O&&"horizontal"===m&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{height:20,width:141,marginTop:6}),"vertical"===m&&!I&&void 0!==w&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${w} %`,theme:"light",type:"neutral"}),O&&!I&&void 0!==U&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${U} %`,theme:"light",type:"neutral"}),O||I||!k||0==k?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(a.Tag,{tagText:(e=>{const t=Math.abs(e);return t%1!=0?`${t.toFixed(1)} %`:`${t} %`})(k),theme:"light",type:"neutral"})]})),"vertical"===m&&!I&&!O&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginTop:10}},{children:e.jsxRuntimeExports.jsx(j,{timeline:g,customRange:h,percent:U,direction:W,trendRaw:$,prefixSymbol:T,trendIconStyle:F,isInternationalStore:V,tooltipTimelineText:A,customTimelineText:N})})),I&&"vertical"===m&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{height:20,width:141,marginTop:6})]})),C&&!I&&e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:C,placement:"right"},{children:v&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon--holder",onClick:E},{children:p.default.createElement(v,{height:20,width:20,color:s.COLORS.content.secondary})}))}))]}))}))};
|
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("../../../../node_modules/react/jsx-runtime.js"),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"),s=require("../../../modals/styledModal.js"),r=require("../../../TypographyStyle.js"),d=require("../../../../constants/Theme.js"),c=require("../utils/calcPercentage.js"),u=require("./StackedBarChart.model.js"),x=require("./StackedBarChart.styles.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=v(o);i.Chart.register(i.CategoryScale,i.LinearScale,i.BarElement,i.Tooltip,i.Legend,p.default);exports.StackedBarChart=i=>{var o,v,p,O,g,A,b,h,R,j,y,m,f,C,I,T,E,S,N,H,L,k,F,P,B,_,G,w,D,q,Z,z,M,W,$,V,Y,J,K,Q,U,X,ee,te,ie;const{headerIcons:oe=[],legendsAndIconDirection:ae="row"}=i,[le,ne]=a.useState(!1),se=[250,1e3,800,1500,300,600],re=0===i.yAxis.data.length,de=["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"],ce=["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"],ue=i.customBarColors?i.customBarColors:i.customColourScaleBrand||i.customColourScalePastel?i.colorSchema===u.COLOR_SCHEMA.PASTEL?i.customColourScalePastel:i.customColourScaleBrand:i.colorSchema===u.COLOR_SCHEMA.PASTEL?ce:de,xe=i.customHoverColour,ve=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]),pe={};i.yAxis.data.map((e=>{e.map((e=>{pe[e.name]?pe[e.name].push(e.value):pe[e.name]=[e.value]}))}));const Oe=Object.keys(pe).map(((e,t)=>Object.assign({label:e,data:pe[e],backgroundColor:null==ue?void 0:ue[t],hoverBackgroundColor:void 0===xe?void 0:xe[t]},ve))),ge=i.renderInHeightWiseManner?Oe.map(((e,t)=>Object.assign(Object.assign({},e),{order:e.data.reduce(((e,t)=>e+(t||0)),0)}))).sort(((e,t)=>t.order-e.order)):Oe;let Ae=i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),be=ge;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}})(ge.map((e=>e.data)),Ae,i.truncateBars);ge.forEach(((t,i)=>t.data=e.truncatedData[i])),Ae=e.truncatedLabels,be=e.originalData.map(((e,t)=>Object.assign(Object.assign({},ge[t]),{data:e})))}const he={plugins:{legend:{display:!re&&!i.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!re,callbacks:{label:null===(o=i.tooltipConfig)||void 0===o?void 0:o.labelCallback,title:null===(v=i.tooltipConfig)||void 0===v?void 0:v.titleCallback,footer:null===(p=i.tooltipConfig)||void 0===p?void 0:p.footerCallback},footerFont:null===(g=null===(O=i.tooltipConfig)||void 0===O?void 0:O.footerStyles)||void 0===g?void 0:g.footerFont},datalabels:{display:null!==(A=i.showTotal)&&void 0!==A&&A,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:d.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===(b=i.yAxis)||void 0===b?void 0:b.title:null===(h=i.xAxis)||void 0===h?void 0:h.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(R=i.yAxis)||void 0===R?void 0:R.title:null===(j=i.xAxis)||void 0===j?void 0:j.title,color:null!==(f=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(y=i.yAxis)||void 0===y?void 0:y.titleColor:null===(m=i.xAxis)||void 0===m?void 0:m.titleColor)&&void 0!==f?f:d.COLORS.content.secondary,font:{size:d.FONTS.caption.fontSize}},grid:{display:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(C=null==i?void 0:i.showGridLines)||void 0===C?void 0:C.x)||(null===(I=null==i?void 0:i.showGridLines)||void 0===I?void 0:I.x)),color:d.COLORS.background.base},ticks:{fontSize:d.FONTS.caption.fontSize,color:null!==(T=i.yAxis.labelColor)&&void 0!==T?T:d.COLORS.content.secondary,callback:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?e=>{var t;return`${i.isInternationalStore?c.truncateValueForInternationalStore(e):c.truncateValueForIndianStore(e)}${(null===(t=i.yAxis)||void 0===t?void 0:t.axisSuffix)||""}`}:(null===(E=i.xAxis)||void 0===E?void 0:E.axisSuffix)?e=>`${e}${i.xAxis.axisSuffix}`:void 0},stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(S=i.yAxis)||void 0===S?void 0:S.stacked)||(null===(N=i.yAxis)||void 0===N?void 0:N.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}:{}),{max:null===(F=null==i?void 0:i.yAxis)||void 0===F?void 0:F.max,title:{display:!!(i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(P=i.xAxis)||void 0===P?void 0:P.title:null===(B=i.yAxis)||void 0===B?void 0:B.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(_=i.xAxis)||void 0===_?void 0:_.title:null===(G=i.yAxis)||void 0===G?void 0:G.title,color:null!==(q=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(w=i.xAxis)||void 0===w?void 0:w.titleColor:null===(D=i.yAxis)||void 0===D?void 0:D.titleColor)&&void 0!==q?q:d.COLORS.content.secondary,font:{size:d.FONTS.caption.fontSize}},grid:{display:i.orientation!==u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(Z=null==i?void 0:i.showGridLines)||void 0===Z?void 0:Z.y)||(null===(z=null==i?void 0:i.showGridLines)||void 0===z?void 0:z.y)),color:d.COLORS.background.base},ticks:Object.assign(Object.assign({stepSize:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(M=i.xAxis)||void 0===M?void 0:M.stepSize:null===(W=i.yAxis)||void 0===W?void 0:W.stepSize,fontSize:d.FONTS.caption.fontSize,color:null!==($=i.xAxis.labelColor)&&void 0!==$?$:d.COLORS.content.secondary},re?{min:0,max:2e3,stepSize:200}:{}),{callback:(null==i?void 0:i.ticksCallback)?null==i?void 0:i.ticksCallback:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?e=>{var t;return`${i.isInternationalStore?c.truncateValueForInternationalStore(e):c.truncateValueForIndianStore(e)}${(null===(t=i.xAxis)||void 0===t?void 0:t.axisSuffix)||""}`}:(null===(V=i.yAxis)||void 0===V?void 0:V.axisSuffix)?e=>`${e}${i.yAxis.axisSuffix}`:void 0}),stacked:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(Y=i.xAxis)||void 0===Y?void 0:Y.stacked)||(null===(J=i.xAxis)||void 0===J?void 0:J.stacked):"boolean"!=typeof(null===(K=i.yAxis)||void 0===K?void 0:K.stacked)||(null===(Q=i.yAxis)||void 0===Q?void 0:Q.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 he.scales.y.ticks.callback:delete he.scales.x.ticks.callback;const Re={labels:Ae,datasets:re?[{data:se,backgroundColor:"rgba(0,0,0,0)"}]:ge},je={labels:i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:re?[{data:se,backgroundColor:"rgba(0,0,0,0)"}]:be},ye=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e.jsxRuntimeExports.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:Oe.map((t=>e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"4px"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:t.backgroundColor,width:"16px",height:"16px",borderRadius:"2px"}}),e.jsxRuntimeExports.jsx(r.BodyTiny,Object.assign({color:d.COLORS.content.secondary},{children:t.label}))]}),t.label.replace(" ","_"))))}))};return e.jsxRuntimeExports.jsxs(x.GraphContainerWrapper,Object.assign({style:null!==(U=i.wrapperStyle)&&void 0!==U?U:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:i.hideHeading?"flex-end":"space-between"}},{children:[!0!==i.hideHeading&&e.jsxRuntimeExports.jsx(r.TitleRegular,Object.assign({color:null!==(X=i.chartHeading.color)&&void 0!==X?X:d.COLORS.content.secondary},{children:i.chartHeading.heading})),i.allowChartPopup&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end"}},{children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(n.IconButton,{Icon:t.default,onClick:()=>{ne(!0)}})})}))]})),i.customLegend&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:ae,justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(x.HeaderIconWrapper,{children:oe.map(((t,i)=>e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("div",{children:t})},i)))}),ye()]})),e.jsxRuntimeExports.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:null!==(ee=i.graphCanvasHeight)&&void 0!==ee?ee:500,width:null!==(te=i.graphCanvasWidth)&&void 0!==te?te:"auto"}},{children:e.jsxRuntimeExports.jsx(l.Bar,{options:he,data:Re})}))})),le&&e.jsxRuntimeExports.jsx(s.StyledModal,Object.assign({open:le,onClose:()=>ne(!1),closeOnOutsideClick:!0,headingTitle:null===(ie=i.chartHeading)||void 0===ie?void 0:ie.heading,width:"85%"},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({className:"graph__wrapper",style:{padding:"8px"}},{children:[i.customLegend&&ye(!0),e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:"70vh",width:"100%",padding:"16px",borderRadius:"8px"}},{children:e.jsxRuntimeExports.jsx(l.Bar,{options:he,data:je})}))]}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../node_modules/react/jsx-runtime.js"),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"),s=require("../../../modals/styledModal.js"),r=require("../../../TypographyStyle.js"),d=require("../../../../constants/Theme.js"),c=require("../utils/calcPercentage.js"),u=require("./StackedBarChart.model.js"),x=require("./StackedBarChart.styles.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=v(o);i.Chart.register(i.CategoryScale,i.LinearScale,i.BarElement,i.Tooltip,i.Legend,p.default);exports.StackedBarChart=i=>{var o,v,p,g,O,b,h,R,A,j,y,m,C,I,T,E,f,N,S,H,L,k,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,se=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]),de={};i.yAxis.data.map((e=>{e.map((e=>{de[e.name]?de[e.name].push(e.value):de[e.name]=[e.value]}))}));const ce=Object.keys(de).map(((e,t)=>Object.assign({label:e,data:de[e],backgroundColor:null==ne?void 0:ne[t],hoverBackgroundColor:void 0===se?void 0:se[t]},re)));let ue=i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),xe=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,xe=e.originalData.map(((e,t)=>Object.assign(Object.assign({},ce[t]),{data:e})))}const ve={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===(v=i.tooltipConfig)||void 0===v?void 0:v.titleCallback,footer:null===(p=i.tooltipConfig)||void 0===p?void 0:p.footerCallback},footerFont:null===(O=null===(g=i.tooltipConfig)||void 0===g?void 0:g.footerStyles)||void 0===O?void 0:O.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:d.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===(R=i.xAxis)||void 0===R?void 0:R.title),text:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(A=i.yAxis)||void 0===A?void 0:A.title:null===(j=i.xAxis)||void 0===j?void 0:j.title,color:null!==(C=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(y=i.yAxis)||void 0===y?void 0:y.titleColor:null===(m=i.xAxis)||void 0===m?void 0:m.titleColor)&&void 0!==C?C:d.COLORS.content.secondary,font:{size:d.FONTS.caption.fontSize}},grid:{display:i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL&&(void 0===(null===(I=null==i?void 0:i.showGridLines)||void 0===I?void 0:I.x)||(null===(T=null==i?void 0:i.showGridLines)||void 0===T?void 0:T.x)),color:d.COLORS.background.base},ticks:{fontSize:d.FONTS.caption.fontSize,color:null!==(E=i.yAxis.labelColor)&&void 0!==E?E:d.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===(f=i.yAxis)||void 0===f?void 0:f.stacked)||(null===(N=i.yAxis)||void 0===N?void 0:N.stacked):"boolean"!=typeof(null===(S=i.xAxis)||void 0===S?void 0:S.stacked)||(null===(H=i.xAxis)||void 0===H?void 0:H.stacked)},y:Object.assign(Object.assign({},(null===(L=null==i?void 0:i.equalHeight)||void 0===L?void 0:L.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===(k=i.xAxis)||void 0===k?void 0:k.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===(_=i.yAxis)||void 0===_?void 0:_.title,color:null!==(w=i.orientation===u.GRAPH_ORIENTATION.HORIZONTAL?null===(G=i.xAxis)||void 0===G?void 0:G.titleColor:null===(B=i.yAxis)||void 0===B?void 0:B.titleColor)&&void 0!==w?w:d.COLORS.content.secondary,font:{size:d.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:d.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:d.FONTS.caption.fontSize,color:null!==(M=i.xAxis.labelColor)&&void 0!==M?M:d.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 ve.scales.y.ticks.callback:delete ve.scales.x.ticks.callback;const pe={labels:ue,datasets:le?[{data:ae,backgroundColor:"rgba(0,0,0,0)"}]:ce},ge={labels:i.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:le?[{data:ae,backgroundColor:"rgba(0,0,0,0)"}]:xe},Oe=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e.jsxRuntimeExports.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.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"4px"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:t.backgroundColor,width:"16px",height:"16px",borderRadius:"2px"}}),e.jsxRuntimeExports.jsx(r.BodyTiny,Object.assign({color:d.COLORS.content.secondary},{children:t.label}))]}),t.label.replace(" ","_"))))}))};return e.jsxRuntimeExports.jsxs(x.GraphContainerWrapper,Object.assign({style:null!==(K=i.wrapperStyle)&&void 0!==K?K:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:i.hideHeading?"flex-end":"space-between"}},{children:[!0!==i.hideHeading&&e.jsxRuntimeExports.jsx(r.TitleRegular,Object.assign({color:null!==(Q=i.chartHeading.color)&&void 0!==Q?Q:d.COLORS.content.secondary},{children:i.chartHeading.heading})),i.allowChartPopup&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end"}},{children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(n.IconButton,{Icon:t.default,onClick:()=>{oe(!0)}})})}))]})),i.customLegend&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:te,justifyContent:"space-between"}},{children:[e.jsxRuntimeExports.jsx(x.HeaderIconWrapper,{children:ee.map(((t,i)=>e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("div",{children:t})},i)))}),Oe()]})),e.jsxRuntimeExports.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsxRuntimeExports.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.jsxRuntimeExports.jsx(l.Bar,{options:ve,data:pe})}))})),ie&&e.jsxRuntimeExports.jsx(s.StyledModal,Object.assign({open:ie,onClose:()=>oe(!1),closeOnOutsideClick:!0,headingTitle:null===($=i.chartHeading)||void 0===$?void 0:$.heading,width:"85%"},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({className:"graph__wrapper",style:{padding:"8px"}},{children:[i.customLegend&&Oe(!0),e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:"70vh",width:"100%",padding:"16px",borderRadius:"8px"}},{children:e.jsxRuntimeExports.jsx(l.Bar,{options:ve,data:ge})}))]}))}))]}))};
|
|
@@ -7,8 +7,6 @@ export interface AxisDetailsI {
|
|
|
7
7
|
labelColor?: string;
|
|
8
8
|
stepSize?: number;
|
|
9
9
|
stacked?: boolean;
|
|
10
|
-
axisSuffix?: string;
|
|
11
|
-
max?: number;
|
|
12
10
|
}
|
|
13
11
|
export interface XAxisDataI {
|
|
14
12
|
name: string;
|
|
@@ -60,7 +58,6 @@ export interface StackedBarGraphI {
|
|
|
60
58
|
customColourScaleBrand?: string[];
|
|
61
59
|
customColourScalePastel?: string[];
|
|
62
60
|
customHoverColour?: string[];
|
|
63
|
-
customBarColors?: string[];
|
|
64
61
|
isInternationalStore?: boolean;
|
|
65
62
|
truncateBars?: number;
|
|
66
63
|
allowChartPopup?: boolean;
|
|
@@ -84,8 +81,7 @@ export interface StackedBarGraphI {
|
|
|
84
81
|
flag: boolean;
|
|
85
82
|
value: number;
|
|
86
83
|
};
|
|
87
|
-
ticksCallback?: (value: number
|
|
84
|
+
ticksCallback?: (value: number) => string;
|
|
88
85
|
legendsAndIconDirection?: 'row-reverse' | 'row';
|
|
89
86
|
headerIcons?: React.ReactNode[];
|
|
90
|
-
renderInHeightWiseManner?: boolean;
|
|
91
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../node_modules/react/jsx-runtime.js"),i=require("chart.js"),t=require("react-chartjs-2"),r=require("../../../TypographyStyle.js"),o=require("../../../../constants/Theme.js"),s=require("../LineChart/LineChart.styled.js"),a=require("./VerticalBarAndLinearGraph.styles.js");i.Chart.register(i.CategoryScale,i.LinearScale,i.BarElement,i.Tooltip);exports.VerticalBarAndLinearGraph=i=>{var n,l,x,c,d;const p=[0,0,0,0,0,0],g=-1===i.barAxis.data.findIndex((e=>0!==e)),b=-1===i.lineAxis.data.findIndex((e=>0!==e)),u={min:0,max:2e3,stepSize:200},j=[{legend:i.barAxis.title,color:i.barAxis.graphColor},{legend:i.lineAxis.title,color:i.lineAxis.graphColor}],h={responsive:!0,plugins:{legend:{display:!1}},scales:{x:{title:{display:!!i.xAxis.title,text:i.xAxis.title,color:i.xAxis.titleColor,font:{size:o.FONTS.caption.fontSize}},grid:{display:!1,borderColor:o.COLORS.background.base},ticks:{fontSize:o.FONTS.caption.fontSize,color:null!==(n=i.xAxis.labelColor)&&void 0!==n?n:o.COLORS.content.secondary}},bar:{position:"left",title:{display:!!i.barAxis.title,text:i.barAxis.title,color:i.barAxis.titleColor,font:{size:o.FONTS.caption.fontSize}},grid:{borderColor:"white",color:o.COLORS.background.base},ticks:Object.assign({fontSize:o.FONTS.caption.fontSize,color:null!==(l=i.barAxis.labelColor)&&void 0!==l?l:o.COLORS.content.secondary},g?u:{})},line:{position:"right",title:{display:!!i.lineAxis.title,text:i.lineAxis.title,color:i.lineAxis.titleColor,font:{size:o.FONTS.caption.fontSize}},grid:{display:!1,borderColor:"white",color:o.COLORS.background.base},ticks:Object.assign({fontSize:o.FONTS.caption.fontSize,color:null!==(x=i.lineAxis.labelColor)&&void 0!==x?x:o.COLORS.content.secondary},b?u:{}),display:!0}},maintainAspectRatio:!1},A={labels:i.xAxis.forceShowXAxis?i.xAxis.data.map((e=>e.toString())):g&&b?["-","-","-","-","-","-"]:i.xAxis.data.map((e=>e.toString())),datasets:[{yAxisID:"line",type:"line",data:b?p:i.lineAxis.data,borderColor:i.lineAxis.graphColor||"rgba(0,0,0,0)",borderWidth:2,fill:!1,pointRadius:1},{yAxisID:"bar",type:"bar",data:g?p:i.barAxis.data,backgroundColor:i.barAxis.graphColor||"rgba(0,0,0,0)",barPercentage:.4,categoryPercentage:1,borderRadius:4}]};return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:2}},{children:[e.jsxRuntimeExports.jsx(s.LegendWrapper,Object.assign({position:"center"},{children:j.map(((i,t)=>{let{legend:o,color:a}=i;return o?e.jsxRuntimeExports.jsxs(s.LegendContainer,{children:[e.jsxRuntimeExports.jsx(s.LegendColor,{color:a}),e.jsxRuntimeExports.jsx(r.SmallRegular,Object.assign({color:"#667085"},{children:o}))]},t):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})}))})),e.jsxRuntimeExports.jsxs(a.GraphContainerWrapper,{children:[i.chartHeading&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginBottom:24}},{children:e.jsxRuntimeExports.jsx(r.TitleRegular,Object.assign({color:null!==(c=i.chartHeading.color)&&void 0!==c?c:o.COLORS.content.secondary},{children:i.chartHeading.heading}))})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:null!==(d=i.graphCanvasHeight)&&void 0!==d?d:500}},{children:e.jsxRuntimeExports.jsx(t.Chart,{type:"bar",data:A,options:h})}))]})]}))};
|
|
@@ -1,7 +1 @@
|
|
|
1
1
|
export declare const GraphContainerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const LegendsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const LegendMiddleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const LegendColorBox: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
-
color: string;
|
|
6
|
-
}, never>;
|
|
7
|
-
export declare const GraphWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../../../constants/Theme.js");function
|
|
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}}const n=t(e).default.div`
|
|
2
2
|
background-color: ${r.COLORS.surface.standard};
|
|
3
3
|
padding: 0;
|
|
4
|
-
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: row;
|
|
7
|
-
gap: 10px;
|
|
8
|
-
padding: 0px 24px 12px 24px;
|
|
9
|
-
justify-content: flex-end;
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
`,o=t.default.div`
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
gap: 8px;
|
|
15
|
-
margin-top: 4px;
|
|
16
|
-
`,i=t.default.div`
|
|
17
|
-
background-color: ${e=>e.color};
|
|
18
|
-
width: 16px;
|
|
19
|
-
height: 16px;
|
|
20
|
-
border-radius: 2px;
|
|
21
|
-
`,n=t.default.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
gap: 2;
|
|
25
|
-
`;exports.GraphContainerWrapper=d,exports.GraphWrapper=n,exports.LegendColorBox=i,exports.LegendMiddleWrapper=o,exports.LegendsWrapper=a;
|
|
4
|
+
`;exports.GraphContainerWrapper=n;
|
|
@@ -4,17 +4,11 @@ export interface AxisDetailsI {
|
|
|
4
4
|
data: number[] | string[];
|
|
5
5
|
labelColor?: string;
|
|
6
6
|
graphColor?: string;
|
|
7
|
-
axisSuffix?: string;
|
|
8
|
-
max?: number;
|
|
9
7
|
}
|
|
10
8
|
export interface ChartHeadingI {
|
|
11
9
|
heading: string;
|
|
12
10
|
color?: string;
|
|
13
11
|
}
|
|
14
|
-
export declare enum GRAPH_ORIENTATION {
|
|
15
|
-
VERTICAL = "vertical",
|
|
16
|
-
HORIZONTAL = "horizontal"
|
|
17
|
-
}
|
|
18
12
|
export interface VerticalBarAndLinearGraphI {
|
|
19
13
|
graphCanvasHeight?: number;
|
|
20
14
|
tickColor?: string;
|
|
@@ -24,10 +18,5 @@ export interface VerticalBarAndLinearGraphI {
|
|
|
24
18
|
forceShowXAxis?: boolean;
|
|
25
19
|
};
|
|
26
20
|
lineAxis: AxisDetailsI;
|
|
27
|
-
lineAxis2?: AxisDetailsI;
|
|
28
21
|
barAxis: AxisDetailsI;
|
|
29
|
-
isInternationalStore?: boolean;
|
|
30
|
-
customLegend?: boolean;
|
|
31
|
-
orientation?: GRAPH_ORIENTATION;
|
|
32
|
-
noDummyValues?: boolean;
|
|
33
22
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface FeatureAnnouncement {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
content: string;
|
|
6
|
+
buttonText: string;
|
|
7
|
+
displayImage: string;
|
|
8
|
+
featureTag: string;
|
|
9
|
+
featureUpdateType: 'Major' | 'Minor';
|
|
10
|
+
image: string;
|
|
11
|
+
module: string[];
|
|
12
|
+
pageUrls: string[];
|
|
13
|
+
productVideo: string;
|
|
14
|
+
redirectUrl: string;
|
|
15
|
+
updates: string;
|
|
16
|
+
visibility: boolean;
|
|
17
|
+
createdAt: any;
|
|
18
|
+
expirationDate?: {
|
|
19
|
+
seconds: number;
|
|
20
|
+
} | string | Date;
|
|
21
|
+
}
|
|
22
|
+
export interface StoreFeatureProgress {
|
|
23
|
+
storeId: string;
|
|
24
|
+
viewedFeatures: {
|
|
25
|
+
[featureId: string]: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncementRepoInjected, RouterProps } from './useFeatureAnnouncements';
|
|
3
|
+
interface FeatureAnnouncementProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
fetchVisibleFeatures: FeatureAnnouncementRepoInjected['fetchVisibleFeatures'];
|
|
6
|
+
getStoreFeatureProgress: FeatureAnnouncementRepoInjected['getStoreFeatureProgress'];
|
|
7
|
+
fetchFeatureById: FeatureAnnouncementRepoInjected['fetchFeatureById'];
|
|
8
|
+
markFeatureAsViewedForStore: FeatureAnnouncementRepoInjected['markFeatureAsViewedForStore'];
|
|
9
|
+
isFeatureApplicableToCurrentPage: FeatureAnnouncementRepoInjected['isFeatureApplicableToCurrentPage'];
|
|
10
|
+
module?: string;
|
|
11
|
+
router?: RouterProps;
|
|
12
|
+
}
|
|
13
|
+
declare const FeatureAnnouncementProvider: React.FC<FeatureAnnouncementProviderProps>;
|
|
14
|
+
export default FeatureAnnouncementProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),o=require("react-joyride"),n=require("./MajorUpdatePopup.js"),a=require("./MinorUpdatePopup.js"),r=require("./useFeatureAnnouncements.js"),s=require("./VideoModal.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(o);const u="#007bff";exports.default=i=>{let{children:d,fetchVisibleFeatures:p,getStoreFeatureProgress:c,fetchFeatureById:f,markFeatureAsViewedForStore:b,isFeatureApplicableToCurrentPage:g,module:x,router:h}=i;var m;const{majorUpdateFeatures:C,minorUpdateFeatures:k,isLoading:S,markFeatureAsViewed:y}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:c,fetchFeatureById:f,markFeatureAsViewedForStore:b,isFeatureApplicableToCurrentPage:g,module:x,router:h}),[T,w]=t.useState(null),[B,j]=t.useState(null),[E,v]=t.useState(!1),[F,I]=t.useState([]),[N,R]=t.useState(!1),[P,M]=t.useState([]),[W,q]=t.useState(!1),[O,V]=t.useState(!1),[A,L]=t.useState([]),[U,$]=t.useState(!1),[z,_]=t.useState(!1),[D,G]=t.useState(!1),[H,J]=t.useState(""),[K,Q]=t.useState(!1),[X,Y]=t.useState(!1),[Z,ee]=t.useState(!1);t.useEffect((()=>{if(!(C.length>0)||T||S||W||K)0!==C.length||S||_(!0);else{_(!1),$(!1),v(!1),I([]),j(null),L([]);const e=()=>{document.querySelector('[data-testid="whats-new-button"]')?te(C[0]):setTimeout(e,1e3)};e()}}),[C,T,S,W,K]),t.useEffect((()=>{var e;const t=null===(e=null==h?void 0:h.query)||void 0===e?void 0:e.featureId;if(!t||S||0===k.length)return;const o=k.find((e=>e.id===t));if(!o||!o.featureTag)return;$(!0),V(!0);let n=0;const a=setInterval((()=>{n++;const e=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;document.querySelector(e)?(ue(o),setTimeout((()=>V(!1)),100),clearInterval(a)):n>=25&&(console.warn(`FeatureAnnouncements: Timed out waiting for element with selector: ${e}`),V(!1),clearInterval(a))}),200);return()=>{clearInterval(a),V(!1)}}),[k,null===(m=null==h?void 0:h.query)||void 0===m?void 0:m.featureId,S]),t.useEffect((()=>{if(k.length>0&&!S&&!E&&!O&&!B&&!U&&z&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||O||B||U||!z)return;const a=k.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;const t=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`;return null!==document.querySelector(t)}));a.length>0&&(L(a),ue(a[0]),e&&(e.disconnect(),e=null),t&&(window.removeEventListener("scroll",t),t=null),o&&(clearTimeout(o),o=null))};return e=new MutationObserver((e=>{let t=!1;for(const o of e){if("childList"===o.type&&o.addedNodes.length>0)for(let e=0;e<o.addedNodes.length;e++){const n=o.addedNodes[e];if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(e.id||e.querySelector("[id]")){t=!0;break}}}if(t)break}E||n||O||B||U||!z||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||O||B||U||!z||a()}),200))})),t=()=>{E||n||O||B||U||!z||(o&&clearTimeout(o),o=setTimeout((()=>{n||O||B||U||!z||a()}),300))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||O||B||U||!z||a()}),100),setTimeout((()=>{n||O||B||U||!z||a()}),1e3),setTimeout((()=>{n||O||B||U||!z||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}(0===k.length||S)&&(v(!1),I([]),j(null),L([]),$(!1))}),[k,S,E,O,B,U,z,y,K]);const te=t=>{w(t);const o=C.findIndex((e=>e.id===t.id)),a=C.length,r=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:a,onSkip:()=>oe(t),onExplore:()=>ne(t),onPrevious:()=>ae(t),onNext:()=>re(t),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(r),R(!0)},oe=t.useCallback((e=>{(e||T)&&(q(!0),C.forEach((e=>{y(e.id)})),R(!1),w(null),M([]),_(!0),setTimeout((()=>{q(!1)}),500))}),[T,C,y]),ne=t.useCallback((e=>{q(!0),y(e.id),e.productVideo&&(J(e.productVideo),G(!0),Q(!0)),R(!1),w(null),M([]);C.findIndex((t=>t.id===e.id))===C.length-1&&_(!0),setTimeout((()=>{q(!1)}),500)}),[C,y]),ae=t.useCallback((t=>{const o=t||T;if(!o)return;const a=C.findIndex((e=>e.id===o.id));if(a>0){const t=C[a-1];w(t);const o=a-1,r=C.length,s=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>oe(t),onExplore:()=>ne(t),onPrevious:()=>ae(t),onNext:()=>re(t),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(s)}}),[T,C]),re=t.useCallback((t=>{const o=t||T;if(!o)return;const a=C.findIndex((e=>e.id===o.id));if(a<C.length-1){const t=C[a+1];w(t);const o=a+1,r=C.length,s=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>oe(t),onExplore:()=>ne(t),onPrevious:()=>ae(t),onNext:()=>re(t),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(s)}else q(!0),y(o.id),R(!1),w(null),M([]),_(!0),setTimeout((()=>{q(!1)}),500)}),[T,C,y]),se=()=>{if(C.length>0&&!T){document.querySelector('[data-testid="whats-new-button"]')&&te(C[0])}};t.useEffect((()=>(window.showMajorUpdatePopup=se,()=>{delete window.showMajorUpdatePopup})),[C,T]);const ie=t.useCallback((e=>{const{action:t}=e;t===o.ACTIONS.CLOSE&&(T&&(q(!0),C.forEach((e=>{y(e.id)})),_(!0),setTimeout((()=>{q(!1)}),500)),R(!1),w(null),M([]))}),[T,C,y]),le=t.useCallback((e=>{const{action:t}=e;t===o.ACTIONS.CLOSE&&(B&&(V(!0),$(!0),k.forEach((e=>{y(e.id)})),setTimeout((()=>{V(!1)}),500)),v(!1),j(null),I([]))}),[B,k,y]),ue=t=>{j(t);const o=A.findIndex((e=>e.id===t.id)),n=A.length,r=[{target:t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>de(t),onExplore:()=>pe(t),onPrevious:()=>ce(t),onNext:()=>fe(t),setIsClosing:ee}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(r),v(!0)},de=t.useCallback((e=>{(e||B)&&(V(!0),$(!0),k.forEach((e=>{y(e.id)})),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500))}),[B,k,y]),pe=t.useCallback((e=>{V(!0),$(!0),y(e.id),e.productVideo&&(J(e.productVideo),G(!0),Q(!0)),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500)}),[y]),ce=t.useCallback((t=>{const o=t||B;if(!o)return;const n=A.findIndex((e=>e.id===o.id));if(n>0){const t=A[n-1];j(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=n-1,s=A.length,i=[{target:o,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:r,totalFeatures:s,onSkip:()=>de(t),onExplore:()=>pe(t),onPrevious:()=>ce(t),onNext:()=>fe(t),setIsClosing:ee}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(i)}}),[B,A]),fe=t.useCallback((t=>{const o=t||B;if(!o)return;const n=A.findIndex((e=>e.id===o.id));if(n<A.length-1){const t=A[n+1];j(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=n+1,s=A.length,i=[{target:o,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:r,totalFeatures:s,onSkip:()=>de(t),onExplore:()=>pe(t),onPrevious:()=>ce(t),onNext:()=>fe(t),setIsClosing:ee}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(i)}else V(!0),$(!0),y(o.id),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500)}),[B,A,y]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d,P.length>0&&e.jsxRuntimeExports.jsx(l.default,{steps:P,run:N,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ie,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:u,zIndex:1e4,width:"auto",arrowColor:X?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}}),F.length>0&&e.jsxRuntimeExports.jsx(l.default,{steps:F,run:E,continuous:!1,showProgress:!1,showSkipButton:!1,callback:le,disableOverlayClose:!0,disableCloseOnEsc:!1,styles:{options:{primaryColor:u,zIndex:1e4,width:"auto",arrowColor:Z?"transparent":"#ffffff"},overlay:{backgroundColor:Z?"transparent":"rgba(0, 0, 0, 0.4)"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:Z?"none":"0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}}),e.jsxRuntimeExports.jsx(s.VideoModal,{isOpen:D,videoUrl:H,onClose:()=>{G(!1),J(""),Q(!1)}})]})};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
3
|
+
interface MajorUpdatePopupProps {
|
|
4
|
+
feature: FeatureAnnouncement;
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
totalFeatures: number;
|
|
7
|
+
onSkip: () => void;
|
|
8
|
+
onExplore: () => void;
|
|
9
|
+
onPrevious: () => void;
|
|
10
|
+
onNext: () => void;
|
|
11
|
+
setIsClosing?: (isClosing: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const MajorUpdatePopup: React.FC<MajorUpdatePopupProps>;
|
|
14
|
+
export default MajorUpdatePopup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react");const n=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value};exports.default=r=>{let{feature:o,currentIndex:s,totalFeatures:i,onSkip:l,onExplore:a,onPrevious:c,onNext:u,setIsClosing:p}=r;const[x,d]=t.useState(!1),[g,f]=t.useState(!1),[h,y]=t.useState(""),j=t.useRef(null);t.useEffect((()=>{x&&f(!0)}),[x]);const b=e=>{if(j.current){const e=j.current.closest('[class*="react-joyride__tooltip"]');if(e){const t=e.querySelector('[class*="react-joyride__arrow"]');t&&(t.style.display="none",t.style.visibility="hidden",t.style.opacity="0")}}let t=null;if(t=document.querySelector('[data-testid="whats-new-button"]'),t||(t=document.querySelector(".main-icon-class")),!t){const e=document.querySelector('svg[viewBox="0 0 32 32"]');if(e){e.querySelector('clipPath[id*="clip"]')&&(t=e.closest('[data-testid="whats-new-button"]')||e.parentElement)}}if(console.log("What's New button found:",!!t,t),t&&j.current){const e=j.current.getBoundingClientRect(),n=t.getBoundingClientRect();console.log("Popup rect:",e),console.log("Target rect:",n);const r=n.left+n.width/2-(e.left+e.width/2),o=n.top+n.height/2-(e.top+e.height/2);console.log("Translation:",{translateX:r,translateY:o}),y(`translate(${r}px, ${o}px) scale(0)`)}else y("scale(0)");null==p||p(!0),d(!0),setTimeout((()=>{e()}),1150)};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({ref:j,style:{width:"959px",height:"274px",display:"flex",backgroundColor:"#212121",borderRadius:"4px",overflow:"hidden",position:"relative",transform:g?h:"scale(1)",opacity:g?0:1,transition:"transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1)"}},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),b(l)},style:{position:"absolute",top:"10px",right:"10px",background:"transparent",border:"none",color:"#BDBDBD",fontSize:"14px",fontWeight:"500",cursor:"pointer",zIndex:10,transition:"all 0.2s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f3f4f6",e.currentTarget.style.color="#374151"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.color="#6b7280"}},{children:"Skip"})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:"#212121",width:"480px",height:"274px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"}},{children:o.displayImage?e.jsxRuntimeExports.jsx("img",{src:o.displayImage,alt:o.title,style:{width:"464px",height:"258px",objectFit:"cover"},onError:e=>{o.image&&(e.target.src=o.image)}}):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",width:"290px",height:"258px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:"Feature Preview"}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{flex:1,display:"flex",margin:"0 8px 0 0",flexDirection:"column",justifyContent:"space-between",background:"transparent"}},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:{fontSize:"16px",fontWeight:"600",padding:"36px 0 0 0",color:"#fff",lineHeight:"1.25",textAlign:"left"}},{children:o.title})),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"rgba(255, 255, 255, 0.8)",textAlign:"left"},dangerouslySetInnerHTML:{__html:n(o.content||o.body||"")}}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{b(a)},style:{backgroundColor:"transparent",border:"1px solid #FEC02D",color:"#FEC02D",borderRadius:"4px",fontSize:"14px",fontWeight:"600",cursor:"pointer",width:"154px",height:"32px",transition:"all 0.2s",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="rgba(254, 192, 45, 0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},{children:o.buttonText||"Explore the feature"}))})]}),i>1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"absolute",bottom:"16px",right:"16px",display:"flex",gap:"8px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),b(c)},disabled:0===s,style:{width:"24px",height:"24px",backgroundColor:"transparent",border:"none",color:0===s?"#666":"#fff",fontSize:"20px",cursor:0===s?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},onMouseEnter:e=>{0!==s&&(e.currentTarget.style.color="#FEC02D")},onMouseLeave:e=>{0!==s&&(e.currentTarget.style.color="#fff")}},{children:"‹"})),e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),b(u)},disabled:s===i-1,style:{width:"24px",height:"24px",backgroundColor:"transparent",border:"none",color:s===i-1?"#666":"#fff",fontSize:"20px",cursor:s===i-1?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},onMouseEnter:e=>{s!==i-1&&(e.currentTarget.style.color="#FEC02D")},onMouseLeave:e=>{s!==i-1&&(e.currentTarget.style.color="#fff")}},{children:"›"}))]}))]}))]}))})};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
3
|
+
interface MinorUpdatePopupProps {
|
|
4
|
+
feature: FeatureAnnouncement;
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
totalFeatures: number;
|
|
7
|
+
onSkip: () => void;
|
|
8
|
+
onExplore: () => void;
|
|
9
|
+
onPrevious: () => void;
|
|
10
|
+
onNext: () => void;
|
|
11
|
+
setIsClosing?: (isClosing: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const MinorUpdatePopup: React.FC<MinorUpdatePopupProps>;
|
|
14
|
+
export default MinorUpdatePopup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react");const i=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value};exports.default=s=>{let{feature:r,currentIndex:n,totalFeatures:o,onSkip:l,onExplore:a,onPrevious:x,onNext:p,setIsClosing:c}=s;const[d,u]=t.useState(!1),[f,g]=t.useState(!1),[h,j]=t.useState(""),b=t.useRef(null);t.useEffect((()=>{d&&g(!0)}),[d]);const m=e=>{if(b.current){const e=b.current.closest('[class*="react-joyride__tooltip"]');if(e){const t=e.querySelector('[class*="react-joyride__arrow"]');t&&(t.style.display="none",t.style.visibility="hidden",t.style.opacity="0")}}if(b.current&&r.featureTag){const e=r.featureTag.startsWith("#")||r.featureTag.startsWith(".")||r.featureTag.startsWith("[")?r.featureTag:`#${r.featureTag}`,t=document.querySelector(e);if(t){const e=b.current.getBoundingClientRect(),i=t.getBoundingClientRect(),s=i.left+i.width/2-(e.left+e.width/2),r=i.top+i.height/2-(e.top+e.height/2);j(`translate(${s}px, ${r}px) scale(0)`)}else j("scale(0)")}else j("scale(0)");null==c||c(!0),u(!0),setTimeout((()=>{e()}),1150)};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({ref:b,style:{width:"519px",height:"160px",display:"flex",backgroundColor:"#ffffff",borderRadius:"4px",overflow:"hidden",position:"relative",boxShadow:"0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04)",transform:f?h:"scale(1)",opacity:f?0:1,transition:"transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1)"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:"#f9fafb",borderRadius:"4px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",margin:"13px 10px 13px 10px",width:"235px",minWidth:"235px",maxWidth:"235px",height:"134px"}},{children:r.displayImage?e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative",width:"235px",height:"134px"}},{children:[e.jsxRuntimeExports.jsx("img",{src:r.displayImage,alt:r.title,style:{width:"235px",height:"134px",objectFit:"cover",borderRadius:"4px",display:"block"},onError:e=>{r.image&&(e.target.src=r.image)}}),e.jsxRuntimeExports.jsx("div",Object.assign({style:{position:"absolute",top:"0px",left:"0px",right:"0px",height:"27px",backgroundColor:"rgba(0, 0, 0, 0.26)",borderRadius:"4px 4px 4px 4px",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10}},{children:e.jsxRuntimeExports.jsx("span",Object.assign({style:{color:"#ffffff",fontWeight:"600",fontSize:"14px"}},{children:"New feature"}))}))]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",borderRadius:"4px"}},{children:"Feature Preview"}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{flex:1,display:"flex",margin:"13px 13px 13px 3px",flexDirection:"column",justifyContent:"space-between",background:"transparent"}},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:{fontSize:"16px",fontWeight:"600",padding:"0 0 0 0",color:"#212121",lineHeight:"1.25",textAlign:"left"}},{children:r.title})),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",fontWeight:"400",lineHeight:"1.2",color:"#616161",textAlign:"left",maxHeight:"48px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical"},dangerouslySetInnerHTML:{__html:i(r.content||r.body||"")}})]}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"absolute",bottom:"13px",right:"10px",display:"flex",gap:"16px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx("span",Object.assign({onClick:()=>m(l),style:{color:"#4B1583",fontSize:"14px",fontWeight:"500",cursor:"pointer",transition:"all 0.2s"}},{children:"Understood"})),r.productVideo&&e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{m(a)},style:{backgroundColor:"#4B1583",border:"none",color:"#ffffff",borderRadius:"4px",fontSize:"14px",fontWeight:"600",cursor:"pointer",width:"154px",height:"32px",transition:"all 0.2s",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center"}},{children:r.buttonText||"Explore the feature"}))]}))]}))]}))})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js");exports.VideoModal=t=>{let{isOpen:o,videoUrl:r,onClose:i}=t;if(!o)return null;const s=r.includes("youtube.com")||r.includes("youtu.be")?r.replace("watch?v=","embed/").replace("youtu.be/","youtube.com/embed/"):r,n=r.includes("youtube.com")||r.includes("youtu.be");return e.jsxRuntimeExports.jsx("div",Object.assign({style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.9)",zIndex:2e3,display:"flex",justifyContent:"center",alignItems:"center",padding:"20px"},onClick:e=>{e.target===e.currentTarget&&i()}},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative",width:"90vw",height:"90vh",maxWidth:"1200px",maxHeight:"800px",backgroundColor:"black",borderRadius:"12px",overflow:"hidden",boxShadow:"0 25px 50px rgba(0, 0, 0, 0.8)"},onClick:e=>e.stopPropagation()},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:i,style:{position:"absolute",top:"20px",right:"20px",background:"rgba(0, 0, 0, 0.7)",border:"none",color:"white",fontSize:"24px",width:"40px",height:"40px",borderRadius:"50%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,transition:"background-color 0.2s"},onMouseOver:e=>{e.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.9)"},onMouseOut:e=>{e.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.7)"}},{children:"×"})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:r?n?e.jsxRuntimeExports.jsx("iframe",{width:"100%",height:"100%",src:s,title:"Product Video",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:{borderRadius:"12px"}}):e.jsxRuntimeExports.jsxs("video",Object.assign({controls:!0,autoPlay:!0,style:{width:"100%",height:"100%",objectFit:"contain",borderRadius:"12px"}},{children:[e.jsxRuntimeExports.jsx("source",{src:r,type:"video/mp4"}),e.jsxRuntimeExports.jsx("source",{src:r,type:"video/webm"}),e.jsxRuntimeExports.jsx("source",{src:r,type:"video/ogg"}),"Your browser does not support the video tag."]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"white",fontSize:"18px",textAlign:"center"}},{children:"No video available"}))}))]}))}))};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as FeatureAnnouncementProvider } from './FeatureAnnouncementProvider';
|
|
2
|
+
export { default as MajorUpdatePopup } from './MajorUpdatePopup';
|
|
3
|
+
export { default as MinorUpdatePopup } from './MinorUpdatePopup';
|
|
4
|
+
export { VideoModal } from './VideoModal';
|
|
5
|
+
export * from './useFeatureAnnouncements';
|
|
6
|
+
export * from './FeatureAnnouncement.types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
2
|
+
export interface FeatureAnnouncementRepoInjected {
|
|
3
|
+
fetchVisibleFeatures: (module?: string) => Promise<[any, FeatureAnnouncement[] | null]>;
|
|
4
|
+
getStoreFeatureProgress: (storeId: string) => Promise<[any, any | null]>;
|
|
5
|
+
fetchFeatureById: (featureId: string) => Promise<[any, FeatureAnnouncement | null]>;
|
|
6
|
+
markFeatureAsViewedForStore: (storeId: string, featureId: string) => Promise<[any]>;
|
|
7
|
+
isFeatureApplicableToCurrentPage: (feature: FeatureAnnouncement) => boolean;
|
|
8
|
+
module?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RouterProps {
|
|
11
|
+
pathname: string;
|
|
12
|
+
query: Record<string, string | string[] | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const useFeatureAnnouncements: ({ fetchVisibleFeatures, getStoreFeatureProgress, fetchFeatureById, markFeatureAsViewedForStore, isFeatureApplicableToCurrentPage, module, router, }: FeatureAnnouncementRepoInjected & {
|
|
15
|
+
router?: RouterProps | undefined;
|
|
16
|
+
}) => {
|
|
17
|
+
features: FeatureAnnouncement[];
|
|
18
|
+
majorUpdateFeatures: FeatureAnnouncement[];
|
|
19
|
+
minorUpdateFeatures: FeatureAnnouncement[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
markFeatureAsViewed: (featureId: string) => Promise<void>;
|
|
23
|
+
refetch: () => Promise<void>;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react");exports.useFeatureAnnouncements=r=>{let{fetchVisibleFeatures:a,getStoreFeatureProgress:o,fetchFeatureById:n,markFeatureAsViewedForStore:i,isFeatureApplicableToCurrentPage:l,module:u,router:s}=r;const c=(()=>{const[e,r]=t.useState(null);return t.useEffect((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem("storeId")||localStorage.getItem("Bik/StoreId")||localStorage.getItem("currentStore")||localStorage.getItem("store"),!e){const t=localStorage.getItem("Bik/CurrentUser");t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get("storeId"))}catch(e){console.error("FeatureAnnouncements: Failed to get store ID",e)}r(e)}}),[]),e})(),[d,f]=t.useState([]),[p,g]=t.useState([]),[y,m]=t.useState([]),[w,v]=t.useState(!1),[F,h]=t.useState(null),D=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(c){v(!0),h(null);try{const[e,t]=yield a(u);if(e||!t)return console.error("FeatureAnnouncements: Failed to fetch features",e),void h("Failed to fetch features");const[r,n]=yield o(c);r&&console.warn("FeatureAnnouncements: Progress fetch failed, treating all features as new",r);const i=new Date,s="undefined"!=typeof window?window.location.pathname:"",d=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&i<t},p=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.includes(s)}return!0},y=t.filter((e=>{var t;return!((null===(t=null==n?void 0:n.viewedFeatures)||void 0===t?void 0:t[e.id])||!1)&&l(e)&&d(e)&&p(e)})),w=y.filter((e=>"Major"===e.featureUpdateType)),v=y.filter((e=>"Minor"===e.featureUpdateType));f(y),g(w),setTimeout((()=>{m(v)}),2e3)}catch(e){console.error("FeatureAnnouncements: Unexpected error in fetchFeatures",e),h("An unexpected error occurred")}finally{v(!1)}}}))),[c,a,o,l,u]),S=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){v(!0),h(null);try{const[e,r]=yield n(t);if(e||!r)return void h("Failed to fetch feature by ID");"Major"===r.featureUpdateType?g([r]):m([r]),f([r])}catch(e){h("An unexpected error occurred while fetching by ID")}finally{v(!1)}}))),[n]),x=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!c)return;const[e]=yield i(c,t);e?(console.warn("FeatureAnnouncements: Failed to mark feature as viewed, removing from local state anyway",e),f((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),m((e=>e.filter((e=>e.id!==t))))):(f((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),m((e=>e.filter((e=>e.id!==t)))))}))),[c,i]);return t.useEffect((()=>{if(!s)return void D();const e=s.query.featureId;e?S(e):D()}),[null==s?void 0:s.query,D,S]),{features:d,majorUpdateFeatures:p,minorUpdateFeatures:y,isLoading:w,error:F,markFeatureAsViewed:x,refetch:D}};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WhatsNewContent } from './WhatsNew.types';
|
|
3
|
+
interface WhatsNewProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
searchPlaceholder?: string;
|
|
7
|
+
emptyStateTitle?: string;
|
|
8
|
+
emptyStateDescription?: string;
|
|
9
|
+
noResultsText?: string;
|
|
10
|
+
width?: string;
|
|
11
|
+
onContentClick?: (content: WhatsNewContent) => void;
|
|
12
|
+
renderCustomContent?: (content: WhatsNewContent) => React.ReactNode;
|
|
13
|
+
buttonTestId?: string;
|
|
14
|
+
iconWidth?: number;
|
|
15
|
+
iconHeight?: number;
|
|
16
|
+
customIcon?: React.ComponentType<{
|
|
17
|
+
width?: number;
|
|
18
|
+
height?: number;
|
|
19
|
+
color?: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare const WhatsNew: React.FC<WhatsNewProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../node_modules/react/jsx-runtime.js"),e=require("react"),n=require("./WhatsNewButton.js"),o=require("./WhatsNewPanel.js"),s=require("./WhatsNewProvider.js");exports.WhatsNew=r=>{let{title:i="What's new",tooltip:a="What's new",searchPlaceholder:u="Search posts",emptyStateTitle:c="Nothing new!",emptyStateDescription:h="There are no new updates or features at the moment. Check back soon!",noResultsText:l="Sorry, no results found.",width:d="480px",onContentClick:p,renderCustomContent:w,buttonTestId:x="whats-new-button",iconWidth:m=32,iconHeight:C=32,customIcon:j}=r;const[W,N]=e.useState(!1),{whatsNewContent:g,isLoading:S,newContentCount:y}=s.useWhatsNewContext();return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(n.WhatsNewButton,{onClick:()=>N(!0),newContentCount:y,isOpen:W,isLoading:S,tooltip:a,testId:x,iconWidth:m,iconHeight:C,customIcon:j}),t.jsxRuntimeExports.jsx(o.WhatsNewPanel,{isOpen:W,onClose:()=>N(!1),content:g,isLoading:S,title:i,searchPlaceholder:u,emptyStateTitle:c,emptyStateDescription:h,noResultsText:l,width:d,onContentClick:t=>{p&&p(t)},renderCustomContent:w})]})};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const WhatsNewIconContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
count?: number | undefined;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const WhatsNewWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const MainContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const MainCardContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const BackgroundImageContainer: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
imageUrl: string;
|
|
9
|
+
height?: string | undefined;
|
|
10
|
+
width?: string | undefined;
|
|
11
|
+
}, never>;
|