@bikdotai/bik-component-library 0.0.721-beta.36 → 0.0.721-beta.37
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/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/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/VideoModal.d.ts +3 -0
- package/dist/cjs/components/feature-announcements/VideoModal.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/animations.d.ts +27 -0
- package/dist/cjs/components/feature-announcements/constants/animations.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/dimensions.d.ts +56 -0
- package/dist/cjs/components/feature-announcements/constants/dimensions.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/index.d.ts +19 -0
- package/dist/cjs/components/feature-announcements/constants/index.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/localStorageKeys.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/constants/localStorageKeys.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/selectors.d.ts +21 -0
- package/dist/cjs/components/feature-announcements/constants/selectors.js +1 -0
- package/dist/cjs/components/feature-announcements/constants/zIndex.d.ts +10 -0
- package/dist/cjs/components/feature-announcements/constants/zIndex.js +1 -0
- package/dist/cjs/components/feature-announcements/hooks/index.d.ts +1 -0
- package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -0
- package/dist/cjs/components/feature-announcements/index.d.ts +7 -0
- package/dist/cjs/components/feature-announcements/styles/index.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/styles/joyride.styles.d.ts +125 -0
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.d.ts +23 -0
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/styles/minorPopup.styles.d.ts +16 -0
- package/dist/cjs/components/feature-announcements/styles/minorPopup.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/styles/videoModal.styles.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/styles/videoModal.styles.js +1 -0
- package/dist/cjs/components/feature-announcements/types/feature.types.d.ts +40 -0
- package/dist/cjs/components/feature-announcements/types/index.d.ts +4 -0
- package/dist/cjs/components/feature-announcements/types/props.types.d.ts +43 -0
- package/dist/cjs/components/feature-announcements/types/repository.types.d.ts +11 -0
- package/dist/cjs/components/feature-announcements/types/router.types.d.ts +7 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/utils/animationHelpers.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/utils/animationHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/elementHelpers.d.ts +30 -0
- package/dist/cjs/components/feature-announcements/utils/elementHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/htmlHelpers.d.ts +18 -0
- package/dist/cjs/components/feature-announcements/utils/htmlHelpers.js +1 -0
- package/dist/cjs/components/feature-announcements/utils/index.d.ts +3 -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 +12 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.js +199 -0
- package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +59 -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/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/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.d.ts +4 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.d.ts +4 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.d.ts +4 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/VideoModal.d.ts +3 -0
- package/dist/esm/components/feature-announcements/VideoModal.js +1 -0
- package/dist/esm/components/feature-announcements/constants/animations.d.ts +27 -0
- package/dist/esm/components/feature-announcements/constants/animations.js +1 -0
- package/dist/esm/components/feature-announcements/constants/dimensions.d.ts +56 -0
- package/dist/esm/components/feature-announcements/constants/dimensions.js +1 -0
- package/dist/esm/components/feature-announcements/constants/index.d.ts +19 -0
- package/dist/esm/components/feature-announcements/constants/index.js +1 -0
- package/dist/esm/components/feature-announcements/constants/localStorageKeys.d.ts +18 -0
- package/dist/esm/components/feature-announcements/constants/localStorageKeys.js +1 -0
- package/dist/esm/components/feature-announcements/constants/selectors.d.ts +21 -0
- package/dist/esm/components/feature-announcements/constants/selectors.js +1 -0
- package/dist/esm/components/feature-announcements/constants/zIndex.d.ts +10 -0
- package/dist/esm/components/feature-announcements/constants/zIndex.js +1 -0
- package/dist/esm/components/feature-announcements/hooks/index.d.ts +1 -0
- package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.d.ts +13 -0
- package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -0
- package/dist/esm/components/feature-announcements/index.d.ts +7 -0
- package/dist/esm/components/feature-announcements/styles/index.d.ts +4 -0
- package/dist/esm/components/feature-announcements/styles/joyride.styles.d.ts +125 -0
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.d.ts +23 -0
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.js +1 -0
- package/dist/esm/components/feature-announcements/styles/minorPopup.styles.d.ts +16 -0
- package/dist/esm/components/feature-announcements/styles/minorPopup.styles.js +1 -0
- package/dist/esm/components/feature-announcements/styles/videoModal.styles.d.ts +13 -0
- package/dist/esm/components/feature-announcements/styles/videoModal.styles.js +1 -0
- package/dist/esm/components/feature-announcements/types/feature.types.d.ts +40 -0
- package/dist/esm/components/feature-announcements/types/index.d.ts +4 -0
- package/dist/esm/components/feature-announcements/types/props.types.d.ts +43 -0
- package/dist/esm/components/feature-announcements/types/repository.types.d.ts +11 -0
- package/dist/esm/components/feature-announcements/types/router.types.d.ts +7 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.d.ts +13 -0
- package/dist/esm/components/feature-announcements/utils/animationHelpers.d.ts +18 -0
- package/dist/esm/components/feature-announcements/utils/animationHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/elementHelpers.d.ts +30 -0
- package/dist/esm/components/feature-announcements/utils/elementHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/htmlHelpers.d.ts +18 -0
- package/dist/esm/components/feature-announcements/utils/htmlHelpers.js +1 -0
- package/dist/esm/components/feature-announcements/utils/index.d.ts +3 -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 +12 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.js +199 -0
- package/dist/esm/components/whats-new/WhatsNew.types.d.ts +59 -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
|
@@ -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 e=require("../../../../node_modules/react/jsx-runtime.js"),i=require("chart.js"),t=require("react-chartjs-2"),r=require("../../../TypographyStyle.js"),
|
|
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 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("../../node_modules/react/jsx-runtime.js"),o=require("react"),n=require("react-joyride");require("./constants/animations.js");var a=require("./constants/selectors.js"),r=require("./hooks/useFeatureAnnouncements.js"),s=require("./MajorUpdatePopup.js"),i=require("./MinorUpdatePopup.js"),l=require("./VideoModal.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(n);exports.default=d=>{let{children:c,fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}=d;var y;const{majorUpdateFeatures:S,minorUpdateFeatures:C,isLoading:k,markFeatureAsViewed:T}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}),[v,w]=o.useState(null),[j,E]=o.useState(null),[B,I]=o.useState(!1),[F,N]=o.useState([]),[q,R]=o.useState(!1),[P,_]=o.useState([]),[O,W]=o.useState(!1),[M,V]=o.useState(!1),[A,L]=o.useState([]),[U,$]=o.useState(!1),[z,H]=o.useState(!1),[Z,D]=o.useState(!1),[G,J]=o.useState(""),[K,Q]=o.useState(!1),[X,Y]=o.useState(!1),[ee,te]=o.useState(!1),[oe,ne]=o.useState(0),[ae,re]=o.useState(0),[se,ie]=o.useState(new Set);o.useEffect((()=>{const e="minor-spotlight-cutout-style";let t=document.getElementById(e);return t||(t=document.createElement("style"),t.id=e,document.head.appendChild(t)),t.textContent="\n\t\t\t.react-joyride__spotlight {\n\t\t\t\ttransition: box-shadow 0.3s ease-in-out !important;\n\t\t\t\twill-change: box-shadow, transform;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t\t.react-joyride__tooltip {\n\t\t\t\twill-change: transform, opacity;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t",()=>{const t=document.getElementById(e);t&&t.remove()}}),[]),o.useEffect((()=>{ne((e=>e+1)),re((e=>e+1)),Y(!1),te(!1),ie(new Set)}),[null==x?void 0:x.pathname]),o.useEffect((()=>{if(!(S.length>0)||v||k||O||K)0!==S.length||k||H(!0);else{H(!1),$(!1),I(!1),N([]),E(null),L([]);const e=()=>{document.querySelector('[data-testid="whats-new-button"]')?le(S[0]):setTimeout(e,1e3)};e()}}),[S,v,k,O,K]),o.useEffect((()=>{var e;const t=null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId;if(!t||k||0===C.length)return;const o=C.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}`;if(document.querySelector(e)){const e=[o];L(e),he(o,e),clearInterval(a)}else n>=25&&(V(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[C,null===(y=null==x?void 0:x.query)||void 0===y?void 0:y.featureId,k]),o.useEffect((()=>{var e;if(C.length>0&&!k&&!B&&!M&&!j&&!U&&z&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||M||j||U||!z)return;const a=C.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;if(se.has(e.id))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),he(a[0],a),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}B||n||M||j||U||!z||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||M||j||U||!z||a()}),200))})),t=()=>{B||n||M||j||U||!z||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||M||j||U||!z||a()}),300)})))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||M||j||U||!z||a()}),100),setTimeout((()=>{n||M||j||U||!z||a()}),1e3),setTimeout((()=>{n||M||j||U||!z||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}if(0===C.length||k){(null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId)&&j||(I(!1),N([]),E(null),L([]),$(!1))}}),[C,k,B,M,j,U,z,T,K]);const le=e=>{w(e);const o=S.findIndex((t=>t.id===e.id)),n=S.length,r=[{target:a.SELECTORS.WHATS_NEW_BUTTON,content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,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"}}}];_(r),R(!0)},de=o.useCallback((e=>{(e||v)&&(W(!0),S.forEach((e=>{T(e.id)})),R(!1),w(null),_([]),H(!0),setTimeout((()=>{W(!1)}),500))}),[v,S,T]),ue=o.useCallback((e=>{W(!0),T(e.id),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),R(!1),w(null),_([]);S.findIndex((t=>t.id===e.id))===S.length-1&&H(!0),setTimeout((()=>{W(!1)}),500)}),[S,T]),ce=o.useCallback((e=>{const o=e||v;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n>0){const e=S[n-1];w(e);const o=n-1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,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"}}}];_(r)}}),[v,S]),pe=o.useCallback((e=>{const o=e||v;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n<S.length-1){const e=S[n+1];w(e);const o=n+1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,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"}}}];_(r)}else W(!0),T(o.id),R(!1),w(null),_([]),H(!0),setTimeout((()=>{W(!1)}),500)}),[v,S,T]),fe=()=>{if(S.length>0&&!v){document.querySelector('[data-testid="whats-new-button"]')&&le(S[0])}};o.useEffect((()=>(window.showMajorUpdatePopup=fe,()=>{delete window.showMajorUpdatePopup})),[S,v]);const be=o.useCallback((e=>{const{action:t}=e;t===n.ACTIONS.CLOSE&&(v&&(W(!0),S.forEach((e=>{T(e.id)})),H(!0),setTimeout((()=>{W(!1)}),500)),R(!1),w(null),_([]))}),[v,S,T]),ge=o.useCallback((e=>{const{action:t}=e;if(t===n.ACTIONS.CLOSE){if(j){V(!0),T(j.id);A.findIndex((e=>e.id===j.id))===A.length-1&&$(!0),setTimeout((()=>{V(!1)}),500)}I(!1),E(null),N([])}}),[j,A,T]),he=(o,n)=>e.__awaiter(void 0,void 0,void 0,(function*(){E(o);const e=n||A,a=e.findIndex((e=>e.id===o.id)),r=e.length,s=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,l=document.querySelector(s);if(l)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(l,120)}catch(e){}const d=[{target:s,content:t.jsxRuntimeExports.jsx(i.default,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>me(o),onExplore:()=>xe(o),onPrevious:()=>ye(o),onNext:()=>Se(o),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:o,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"}}}];N(d),I(!0)})),me=o.useCallback((e=>{const t=e||j;if(t){V(!0),T(t.id),ie((e=>new Set(e).add(t.id))),I(!1),E(null),N([]);const e=A.find((e=>e.id!==t.id&&!se.has(e.id)));setTimeout((()=>{V(!1),e?he(e,A):$(!0)}),500)}}),[j,A,T,se]),xe=o.useCallback((e=>{V(!0),T(e.id),ie((t=>new Set(t).add(e.id))),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),I(!1),E(null),N([]);const t=A.find((t=>t.id!==e.id&&!se.has(t.id)));setTimeout((()=>{V(!1),t&&!e.productVideo?he(t,A):t||$(!0)}),500)}),[A,T,se]),ye=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n>0){const e=A[n-1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n-1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,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"}}}];N(l)}}))),[j,A]),Se=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n<A.length-1){const e=A[n+1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n+1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,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"}}}];N(l)}else V(!0),$(!0),T(e.id),I(!1),E(null),N([]),setTimeout((()=>{V(!1)}),500)}))),[j,A,T]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[c,P.length>0&&t.jsxRuntimeExports.jsx(u.default,{steps:P,run:q,continuous:!1,showProgress:!1,showSkipButton:!1,callback:be,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!0,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:X?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"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"}},`major-joyride-${oe}`),F.length>0&&t.jsxRuntimeExports.jsx(u.default,{steps:F,run:B,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ge,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ee?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ee?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 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"}},`minor-joyride-${ae}`),t.jsxRuntimeExports.jsx(l.VideoModal,{isOpen:Z,videoUrl:G,onClose:()=>{D(!1),J(""),Q(!1);const e=A.find((e=>!se.has(e.id)));e?setTimeout((()=>{he(e,A)}),300):$(!0)}})]})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),s=require("./constants/index.js"),n=require("./styles/majorPopup.styles.js");require("../../constants/Theme.js"),require("./constants/animations.js");var r=require("./utils/htmlHelpers.js"),o=require("./utils/animationHelpers.js"),i=require("./utils/elementHelpers.js");exports.default=a=>{let{feature:u,currentIndex:l,totalFeatures:c,onSkip:j,onExplore:x,onPrevious:g,onNext:d,setIsClosing:p}=a;const[E,b]=t.useState(!1),[T,m]=t.useState(!1),[y,v]=t.useState(""),O=t.useRef(null);t.useEffect((()=>{E&&m(!0)}),[E]);const h=n.getMajorPopupStyles(T,y);return e.jsxRuntimeExports.jsxs("div",Object.assign({ref:O,style:h.container},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),(e=>{o.hideJoyrideArrow(O.current);const t=i.findWhatsNewButton();if(t&&O.current){const e=o.calculateCloseTransform(O.current,t);v(e)}else v("scale(0)");null==p||p(!0),b(!0),o.executeAfterAnimation(e)})(j)},style:h.skipButton.base,onMouseEnter:e=>Object.assign(e.currentTarget.style,h.skipButton.hover),onMouseLeave:e=>Object.assign(e.currentTarget.style,h.skipButton.base)},{children:s.TEXT.SKIP_BUTTON})),e.jsxRuntimeExports.jsx("div",Object.assign({style:h.imageContainer},{children:u.displayImage?e.jsxRuntimeExports.jsx("img",{src:u.displayImage,alt:u.title,style:h.image,onError:e=>{u.image&&(e.target.src=u.image)}}):e.jsxRuntimeExports.jsx("div",Object.assign({style:h.imagePlaceholder},{children:s.TEXT.FEATURE_PREVIEW_PLACEHOLDER}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:h.contentContainer},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:h.title},{children:u.title})),e.jsxRuntimeExports.jsx("div",{style:h.content,dangerouslySetInnerHTML:{__html:r.decodeHTMLEntities(u.content||u.body||"")}}),e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{x(),o.hideJoyrideArrow(O.current);const e=i.findWhatsNewButton();if(e&&O.current){const t=o.calculateCloseTransform(O.current,e);v(t)}else v("scale(0)");null==p||p(!0),b(!0)},style:h.exploreButton.base,onMouseEnter:e=>Object.assign(e.currentTarget.style,h.exploreButton.hover),onMouseLeave:e=>Object.assign(e.currentTarget.style,h.exploreButton.base)},{children:u.buttonText||s.TEXT.DEFAULT_BUTTON_TEXT}))]}),c>1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:h.navigationContainer},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),g()},disabled:0===l,style:h.navigationButton(0===l).base,onMouseEnter:e=>{0!==l&&Object.assign(e.currentTarget.style,h.navigationButton(!1).hover)},onMouseLeave:e=>{0!==l&&Object.assign(e.currentTarget.style,h.navigationButton(!1).base)}},{children:s.TEXT.NAVIGATION_PREVIOUS})),e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),d()},disabled:l===c-1,style:h.navigationButton(l===c-1).base,onMouseEnter:e=>{l!==c-1&&Object.assign(e.currentTarget.style,h.navigationButton(!1).hover)},onMouseLeave:e=>{l!==c-1&&Object.assign(e.currentTarget.style,h.navigationButton(l===c-1).base)}},{children:s.TEXT.NAVIGATION_NEXT}))]}))]}))]}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),s=require("./constants/index.js");require("../../constants/Theme.js"),require("./constants/animations.js");var r=require("./styles/minorPopup.styles.js"),n=require("./utils/htmlHelpers.js"),i=require("./utils/animationHelpers.js"),a=require("./utils/elementHelpers.js");exports.default=l=>{let{feature:o,currentIndex:u,totalFeatures:c,onSkip:x,onExplore:j,onPrevious:d,onNext:m,setIsClosing:E}=l;const[g,p]=t.useState(!1),[T,y]=t.useState(!1),[f,h]=t.useState(""),R=t.useRef(null);t.useEffect((()=>{g&&y(!0)}),[g]);const b=r.getMinorPopupStyles(T,f);return e.jsxRuntimeExports.jsxs("div",Object.assign({ref:R,style:b.container},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:b.imageContainer},{children:o.displayImage?e.jsxRuntimeExports.jsxs("div",Object.assign({style:b.imageWrapper},{children:[e.jsxRuntimeExports.jsx("img",{src:o.displayImage,alt:o.title,style:b.image,onError:e=>{o.image&&(e.target.src=o.image)}}),e.jsxRuntimeExports.jsx("div",Object.assign({style:b.badge},{children:e.jsxRuntimeExports.jsx("span",Object.assign({style:b.badgeText},{children:s.TEXT.NEW_FEATURE_BADGE}))}))]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:b.imagePlaceholder},{children:s.TEXT.FEATURE_PREVIEW_PLACEHOLDER}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:b.contentContainer},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:b.title},{children:o.title})),e.jsxRuntimeExports.jsx("div",{style:b.content,dangerouslySetInnerHTML:{__html:n.decodeHTMLEntities(o.content||o.body||"")}})]}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:b.actionsContainer},{children:[e.jsxRuntimeExports.jsx("span",Object.assign({onClick:()=>{(e=>{if(i.hideJoyrideArrow(R.current),R.current&&o.featureTag){const e=a.findFeatureTagElement(o.featureTag);if(e){const t=i.calculateCloseTransform(R.current,e);h(t)}else h("scale(0)")}else h("scale(0)");null==E||E(!0),p(!0),i.executeAfterAnimation(e)})(x)},style:b.understoodText},{children:s.TEXT.UNDERSTOOD})),o.productVideo&&e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{if(j(),i.hideJoyrideArrow(R.current),R.current&&o.featureTag){const e=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,t=document.querySelector(e);if(t){const e=i.calculateCloseTransform(R.current,t);h(e)}else h("scale(0)")}else h("scale(0)");null==E||E(!0),p(!0)},style:b.exploreButton},{children:o.buttonText||s.TEXT.DEFAULT_BUTTON_TEXT}))]}))]}))]}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),s=require("./constants/index.js");require("../../constants/Theme.js"),require("./constants/animations.js");var t=require("./styles/videoModal.styles.js"),o=require("./utils/htmlHelpers.js");exports.VideoModal=r=>{let{isOpen:i,videoUrl:l,onClose:n}=r;if(!i)return null;const a=o.formatVideoUrl(l),d=o.isYouTubeVideo(l);return e.jsxRuntimeExports.jsx("div",Object.assign({style:t.videoModalStyles.backdrop,onClick:e=>{e.target===e.currentTarget&&n()}},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:t.videoModalStyles.container,onClick:e=>e.stopPropagation()},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:n,style:t.videoModalStyles.closeButton.base,onMouseOver:e=>Object.assign(e.currentTarget.style,t.videoModalStyles.closeButton.hover),onMouseOut:e=>Object.assign(e.currentTarget.style,t.videoModalStyles.closeButton.base)},{children:"×"})),e.jsxRuntimeExports.jsx("div",Object.assign({style:t.videoModalStyles.videoWrapper},{children:l?d?e.jsxRuntimeExports.jsx("iframe",{width:"100%",height:"100%",src:a,title:s.TEXT.VIDEO_MODAL_TITLE,frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:t.videoModalStyles.iframe}):e.jsxRuntimeExports.jsxs("video",Object.assign({controls:!0,autoPlay:!0,style:t.videoModalStyles.video},{children:[e.jsxRuntimeExports.jsx("source",{src:l,type:"video/mp4"}),e.jsxRuntimeExports.jsx("source",{src:l,type:"video/webm"}),e.jsxRuntimeExports.jsx("source",{src:l,type:"video/ogg"}),"Your browser does not support the video tag."]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:t.videoModalStyles.noVideoMessage},{children:s.TEXT.NO_VIDEO_AVAILABLE}))}))]}))}))};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animation timing constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const ANIMATION_TIMING: {
|
|
5
|
+
readonly CLOSE_DURATION: 1150;
|
|
6
|
+
readonly PROCESSING_DELAY: 500;
|
|
7
|
+
readonly MINOR_POPUP_DELAY: 2000;
|
|
8
|
+
readonly TRANSITION_DURATION: "1s";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Animation easing functions
|
|
12
|
+
*/
|
|
13
|
+
export declare const ANIMATION_EASING: {
|
|
14
|
+
readonly STANDARD: "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Element check configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare const ELEMENT_CHECK_CONFIG: {
|
|
20
|
+
readonly MAX_ATTEMPTS: 25;
|
|
21
|
+
readonly RETRY_INTERVAL_MS: 200;
|
|
22
|
+
readonly SCROLL_DEBOUNCE_MS: 300;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Combined transition string
|
|
26
|
+
*/
|
|
27
|
+
export declare const POPUP_TRANSITION: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const N={CLOSE_DURATION:1150,PROCESSING_DELAY:500,MINOR_POPUP_DELAY:2e3,TRANSITION_DURATION:"1s"},A={STANDARD:"cubic-bezier(0.4, 0, 0.2, 1)"},I=`transform ${N.TRANSITION_DURATION} ${A.STANDARD}, opacity ${N.TRANSITION_DURATION} ${A.STANDARD}`;exports.ANIMATION_EASING=A,exports.ANIMATION_TIMING=N,exports.POPUP_TRANSITION=I;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popup dimension constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const POPUP_DIMENSIONS: {
|
|
5
|
+
readonly MAJOR: {
|
|
6
|
+
readonly width: 959;
|
|
7
|
+
readonly height: 274;
|
|
8
|
+
readonly imageWidth: 480;
|
|
9
|
+
readonly imageHeight: 274;
|
|
10
|
+
readonly imageInnerWidth: 464;
|
|
11
|
+
readonly imageInnerHeight: 258;
|
|
12
|
+
readonly imagePlaceholderWidth: 290;
|
|
13
|
+
readonly imagePlaceholderHeight: 258;
|
|
14
|
+
};
|
|
15
|
+
readonly MINOR: {
|
|
16
|
+
readonly width: 519;
|
|
17
|
+
readonly height: 160;
|
|
18
|
+
readonly imageWidth: 235;
|
|
19
|
+
readonly imageHeight: 134;
|
|
20
|
+
readonly badgeHeight: 27;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Spacing constants
|
|
25
|
+
*/
|
|
26
|
+
export declare const SPACING: {
|
|
27
|
+
readonly MAJOR: {
|
|
28
|
+
readonly contentMargin: "0 8px 0 0";
|
|
29
|
+
readonly imagePadding: "8px";
|
|
30
|
+
readonly titlePadding: "36px 0 0 0";
|
|
31
|
+
readonly buttonMarginTop: "16px";
|
|
32
|
+
readonly skipButtonTop: "10px";
|
|
33
|
+
readonly skipButtonRight: "10px";
|
|
34
|
+
readonly navigationBottom: "16px";
|
|
35
|
+
readonly navigationRight: "16px";
|
|
36
|
+
readonly navigationGap: "8px";
|
|
37
|
+
};
|
|
38
|
+
readonly MINOR: {
|
|
39
|
+
readonly imageMargin: "13px 10px 13px 10px";
|
|
40
|
+
readonly contentMargin: "13px 13px 13px 3px";
|
|
41
|
+
readonly actionsBottom: "13px";
|
|
42
|
+
readonly actionsRight: "10px";
|
|
43
|
+
readonly actionsGap: "16px";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Border radius constants
|
|
48
|
+
*/
|
|
49
|
+
export declare const BORDER_RADIUS: {
|
|
50
|
+
readonly POPUP: "4px";
|
|
51
|
+
readonly IMAGE: "4px";
|
|
52
|
+
readonly BUTTON: "4px";
|
|
53
|
+
readonly VIDEO_MODAL: "12px";
|
|
54
|
+
readonly CLOSE_BUTTON: "50%";
|
|
55
|
+
readonly SPOTLIGHT: "8px";
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BORDER_RADIUS={POPUP:"4px",IMAGE:"4px",BUTTON:"4px",VIDEO_MODAL:"12px",CLOSE_BUTTON:"50%",SPOTLIGHT:"8px"},exports.POPUP_DIMENSIONS={MAJOR:{width:959,height:274,imageWidth:480,imageHeight:274,imageInnerWidth:464,imageInnerHeight:258,imagePlaceholderWidth:290,imagePlaceholderHeight:258},MINOR:{width:519,height:160,imageWidth:235,imageHeight:134,badgeHeight:27}},exports.SPACING={MAJOR:{contentMargin:"0 8px 0 0",imagePadding:"8px",titlePadding:"36px 0 0 0",buttonMarginTop:"16px",skipButtonTop:"10px",skipButtonRight:"10px",navigationBottom:"16px",navigationRight:"16px",navigationGap:"8px"},MINOR:{imageMargin:"13px 10px 13px 10px",contentMargin:"13px 13px 13px 3px",actionsBottom:"13px",actionsRight:"10px",actionsGap:"16px"}};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export * from './animations';
|
|
2
|
+
export * from './dimensions';
|
|
3
|
+
export * from './selectors';
|
|
4
|
+
export * from './zIndex';
|
|
5
|
+
export * from './localStorageKeys';
|
|
6
|
+
/**
|
|
7
|
+
* Text constants
|
|
8
|
+
*/
|
|
9
|
+
export declare const TEXT: {
|
|
10
|
+
readonly DEFAULT_BUTTON_TEXT: "Explore the feature";
|
|
11
|
+
readonly SKIP_BUTTON: "Skip";
|
|
12
|
+
readonly UNDERSTOOD: "Understood";
|
|
13
|
+
readonly NEW_FEATURE_BADGE: "New feature";
|
|
14
|
+
readonly FEATURE_PREVIEW_PLACEHOLDER: "Feature Preview";
|
|
15
|
+
readonly NO_VIDEO_AVAILABLE: "No video available";
|
|
16
|
+
readonly VIDEO_MODAL_TITLE: "Product Video";
|
|
17
|
+
readonly NAVIGATION_PREVIOUS: "‹";
|
|
18
|
+
readonly NAVIGATION_NEXT: "›";
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animations.js");exports.ANIMATION_EASING=e.ANIMATION_EASING,exports.ANIMATION_TIMING=e.ANIMATION_TIMING,exports.POPUP_TRANSITION=e.POPUP_TRANSITION,exports.TEXT={DEFAULT_BUTTON_TEXT:"Explore the feature",SKIP_BUTTON:"Skip",UNDERSTOOD:"Understood",NEW_FEATURE_BADGE:"New feature",FEATURE_PREVIEW_PLACEHOLDER:"Feature Preview",NO_VIDEO_AVAILABLE:"No video available",VIDEO_MODAL_TITLE:"Product Video",NAVIGATION_PREVIOUS:"‹",NAVIGATION_NEXT:"›"};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local storage keys for feature announcements
|
|
3
|
+
*/
|
|
4
|
+
export declare const LOCAL_STORAGE_KEYS: {
|
|
5
|
+
readonly STORE_ID: "storeId";
|
|
6
|
+
readonly BIK_STORE_ID: "Bik/StoreId";
|
|
7
|
+
readonly CURRENT_STORE: "currentStore";
|
|
8
|
+
readonly STORE: "store";
|
|
9
|
+
readonly CURRENT_USER: "Bik/CurrentUser";
|
|
10
|
+
readonly QUERY_PARAM: "storeId";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* URL query parameters
|
|
14
|
+
*/
|
|
15
|
+
export declare const QUERY_PARAMS: {
|
|
16
|
+
readonly FEATURE_ID: "featureId";
|
|
17
|
+
readonly STORE_ID: "storeId";
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.LOCAL_STORAGE_KEYS={STORE_ID:"storeId",BIK_STORE_ID:"Bik/StoreId",CURRENT_STORE:"currentStore",STORE:"store",CURRENT_USER:"Bik/CurrentUser",QUERY_PARAM:"storeId"},exports.QUERY_PARAMS={FEATURE_ID:"featureId",STORE_ID:"storeId"};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS selectors for feature announcements
|
|
3
|
+
*/
|
|
4
|
+
export declare const SELECTORS: {
|
|
5
|
+
readonly WHATS_NEW_BUTTON: "[data-testid=\"whats-new-button\"]";
|
|
6
|
+
readonly MAIN_ICON_CLASS: ".main-icon-class";
|
|
7
|
+
readonly SVG_VIEWBOX: "svg[viewBox=\"0 0 32 32\"]";
|
|
8
|
+
readonly CLIPPATH_PATTERN: "clipPath[id*=\"clip\"]";
|
|
9
|
+
readonly JOYRIDE_TOOLTIP: "[class*=\"react-joyride__tooltip\"]";
|
|
10
|
+
readonly JOYRIDE_ARROW: "[class*=\"react-joyride__arrow\"]";
|
|
11
|
+
readonly JOYRIDE_SPOTLIGHT: ".react-joyride__spotlight";
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Data test IDs
|
|
15
|
+
*/
|
|
16
|
+
export declare const TEST_IDS: {
|
|
17
|
+
readonly WHATS_NEW_BUTTON: "whats-new-button";
|
|
18
|
+
readonly MAJOR_POPUP: "major-update-popup";
|
|
19
|
+
readonly MINOR_POPUP: "minor-update-popup";
|
|
20
|
+
readonly VIDEO_MODAL: "video-modal";
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.SELECTORS={WHATS_NEW_BUTTON:'[data-testid="whats-new-button"]',MAIN_ICON_CLASS:".main-icon-class",SVG_VIEWBOX:'svg[viewBox="0 0 32 32"]',CLIPPATH_PATTERN:'clipPath[id*="clip"]',JOYRIDE_TOOLTIP:'[class*="react-joyride__tooltip"]',JOYRIDE_ARROW:'[class*="react-joyride__arrow"]',JOYRIDE_SPOTLIGHT:".react-joyride__spotlight"};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.Z_INDEX={JOYRIDE:1e4,VIDEO_MODAL:2e3,SKIP_BUTTON:10,IMAGE_BADGE:10,CLOSE_BUTTON:10};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFeatureAnnouncements } from './useFeatureAnnouncements';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FeatureAnnouncement, FeatureAnnouncementRepository, RouterProps } from '../types';
|
|
2
|
+
export declare const useFeatureAnnouncements: ({ fetchVisibleFeatures, getStoreFeatureProgress, fetchFeatureById, markFeatureAsViewedForStore, isFeatureApplicableToCurrentPage, module, router, }: FeatureAnnouncementRepository & {
|
|
3
|
+
module?: string | undefined;
|
|
4
|
+
router?: RouterProps | undefined;
|
|
5
|
+
}) => {
|
|
6
|
+
features: FeatureAnnouncement[];
|
|
7
|
+
majorUpdateFeatures: FeatureAnnouncement[];
|
|
8
|
+
minorUpdateFeatures: FeatureAnnouncement[];
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
markFeatureAsViewed: (featureId: string) => Promise<void>;
|
|
12
|
+
refetch: () => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react"),r=require("../constants/animations.js"),a=require("../constants/localStorageKeys.js");exports.useFeatureAnnouncements=o=>{let{fetchVisibleFeatures:n,getStoreFeatureProgress:i,fetchFeatureById:l,markFeatureAsViewedForStore:u,isFeatureApplicableToCurrentPage:s,module:c,router:d}=o;var f;const p=(()=>{const[e,r]=t.useState(null);return t.useEffect((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.BIK_STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_STORE)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE),!e){const t=localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_USER);t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get(a.LOCAL_STORAGE_KEYS.QUERY_PARAM))}catch(e){console.error("FeatureAnnouncements: Failed to get store ID",e)}r(e)}}),[]),e})(),[A,S]=t.useState([]),[_,g]=t.useState([]),[v,y]=t.useState([]),[E,m]=t.useState(!1),[R,w]=t.useState(null),F=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(p){m(!0),w(null);try{const[e,t]=yield n(c);if(e||!t)return console.error("FeatureAnnouncements: Failed to fetch features",e),void w("Failed to fetch features");const[a,o]=yield i(p);a&&console.warn("FeatureAnnouncements: Progress fetch failed, treating all features as new",a);const l=new Date,u="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()))&&l<t},f=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(u)}return!0},A=t.filter((e=>{var t;return!((null===(t=null==o?void 0:o.viewedFeatures)||void 0===t?void 0:t[e.id])||!1)&&s(e)&&d(e)&&f(e)})),_=A.filter((e=>"Major"===e.featureUpdateType)),v=A.filter((e=>"Minor"===e.featureUpdateType));S(A),g(_),setTimeout((()=>{y(v)}),r.ANIMATION_TIMING.MINOR_POPUP_DELAY)}catch(e){console.error("FeatureAnnouncements: Unexpected error in fetchFeatures",e),w("An unexpected error occurred")}finally{m(!1)}}}))),[p,n,i,s,c]),T=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){m(!0),w(null);try{const[e,r]=yield l(t);if(e||!r)return void w("Failed to fetch feature by ID");"Major"===r.featureUpdateType?g([r]):y([r]),S([r])}catch(e){w("An unexpected error occurred while fetching by ID")}finally{m(!1)}}))),[l]),U=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!p)return;const[e]=yield u(p,t);e?(console.warn("FeatureAnnouncements: Failed to mark feature as viewed, removing from local state anyway",e),S((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),y((e=>e.filter((e=>e.id!==t))))):(S((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),y((e=>e.filter((e=>e.id!==t)))))}))),[p,u]);return t.useEffect((()=>{var e;const t=null===(e=null==d?void 0:d.query)||void 0===e?void 0:e[a.QUERY_PARAMS.FEATURE_ID];t&&d?T(t):F()}),[null==d?void 0:d.pathname,null===(f=null==d?void 0:d.query)||void 0===f?void 0:f[a.QUERY_PARAMS.FEATURE_ID],p,F,T,d]),{features:A,majorUpdateFeatures:_,minorUpdateFeatures:v,isLoading:E,error:R,markFeatureAsViewed:U,refetch:F}};
|
|
@@ -0,0 +1,7 @@
|
|
|
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 { useFeatureAnnouncements } from './hooks/useFeatureAnnouncements';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { TEXT, ANIMATION_TIMING, POPUP_DIMENSIONS } from './constants';
|