@bikdotai/bik-component-library 0.0.457 → 0.0.458

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../tooltips/Tooltip.js"),require("../../../constants/Theme.js"),require("../../TypographyStyle.js"),require("../../analytics-chips-and-dropdowns/CommonStyles.js");var r=require("../../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("react"),require("../../analytics-chips-and-dropdowns/AnalyticsMetric.js");var a=require("../../tag/Tag.js");require("../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js");var i=require("../../../assets/icons/cross.svg.js"),t=require("../types/SearchFilter.type.js");exports.FilterChipListRenderer=n=>{let{selectedState:l,onDeSelect:s}=n;return e.jsx(e.Fragment,{children:l.map((n=>{var l,o,d,c,p,u,h;return n.type===t.FilterType.Multiple?e.jsx(e.Fragment,{children:null===(l=n.value)||void 0===l?void 0:l.map((r=>{var t,l;return e.jsx(a.Tag,{onTrailingIconClicked:()=>s(n.id,r),style:{cursor:"pointer"},tagText:null!==(l=null===(t=r.label)||void 0===t?void 0:t.slice(0,10))&&void 0!==l?l:"",type:"neutral",theme:"light",TrailingIcon:i.default},`${n.id}-${r.value}`)}))}):n.type===t.FilterType.Date?e.jsx(a.Tag,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:r.formatDate(n.value),type:"neutral",theme:"light",TrailingIcon:i.default},n.id):n.type===t.FilterType.DateRange?e.jsx(a.Tag,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:`${r.formatDate(null===(o=n.value)||void 0===o?void 0:o[0])} to ${r.formatDate(null===(d=n.value)||void 0===d?void 0:d[1])}`,type:"neutral",theme:"light",TrailingIcon:i.default},n.id):e.jsx(a.Tag,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:n.type===t.FilterType.Single?null!==(p=null===(c=n.value)||void 0===c?void 0:c.label)&&void 0!==p?p:"":null!==(h=null===(u=n.value)||void 0===u?void 0:u.toString())&&void 0!==h?h:"",type:"neutral",theme:"light",TrailingIcon:i.default},n.id)}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../tooltips/Tooltip.js"),require("../../../constants/Theme.js"),require("../../TypographyStyle.js"),require("../../analytics-chips-and-dropdowns/CommonStyles.js");var r=require("../../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("react"),require("../../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../../../utils/DateUtils.js");var a=require("../../tag/Tag.js");require("../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js");var i=require("../../../assets/icons/cross.svg.js"),t=require("../types/SearchFilter.type.js");exports.FilterChipListRenderer=l=>{let{selectedState:n,onDeSelect:s}=l;return e.jsx(e.Fragment,{children:n.map((l=>{var n,o,d,c,p,u,h;return l.type===t.FilterType.Multiple?e.jsx(e.Fragment,{children:null===(n=l.value)||void 0===n?void 0:n.map((r=>{var t,n;return e.jsx(a.Tag,{onTrailingIconClicked:()=>s(l.id,r),style:{cursor:"pointer"},tagText:null!==(n=null===(t=r.label)||void 0===t?void 0:t.slice(0,10))&&void 0!==n?n:"",type:"neutral",theme:"light",TrailingIcon:i.default},`${l.id}-${r.value}`)}))}):l.type===t.FilterType.Date?e.jsx(a.Tag,{onTrailingIconClicked:()=>s(l.id,l.value),style:{cursor:"pointer"},tagText:r.formatDate(l.value),type:"neutral",theme:"light",TrailingIcon:i.default},l.id):l.type===t.FilterType.DateRange?e.jsx(a.Tag,{onTrailingIconClicked:()=>s(l.id,l.value),style:{cursor:"pointer"},tagText:`${r.formatDate(null===(o=l.value)||void 0===o?void 0:o[0])} to ${r.formatDate(null===(d=l.value)||void 0===d?void 0:d[1])}`,type:"neutral",theme:"light",TrailingIcon:i.default},l.id):e.jsx(a.Tag,{onTrailingIconClicked:()=>s(l.id,l.value),style:{cursor:"pointer"},tagText:l.type===t.FilterType.Single?null!==(p=null===(c=l.value)||void 0===c?void 0:c.label)&&void 0!==p?p:"":null!==(h=null===(u=l.value)||void 0===u?void 0:u.toString())&&void 0!==h?h:"",type:"neutral",theme:"light",TrailingIcon:i.default},l.id)}))})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../tooltips/Tooltip.js"),require("../../../constants/Theme.js"),require("../../TypographyStyle.js"),require("../../analytics-chips-and-dropdowns/CommonStyles.js");var r=require("../../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("react"),require("../../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../../tag/Tag.js"),require("../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../dropdown/DropdownPopover/index.js");var t=require("../../dropdown/Dropdown.js"),n=require("../../dropdown/ChipDropdown.js");require("../../zeroState/ZeroState.js"),require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../input/Input.js"),require("../../dropdown/MenuItem/MenuItem.js");var a=require("../types/SearchFilter.type.js"),o=require("./DatePickerButton.js"),i=require("./DateRangeOnlyButton.js");const s=[{label:"Last 7 days",value:"7 days",key:7,noOfDays:7},{label:"Last 30 days",value:"30 days",key:30,noOfDays:30},{label:"Custom range",value:"calender",key:"custom",isCustom:!0,dateRangeSelectionOptions:{selectRange:!0}}];exports.SearchFilterItem=d=>{var p,l,c;return d.type===a.FilterType.Date?e.jsx(o.DatePickerButton,Object.assign({},d,{variant:d.variant,onSelect:e=>d.onChange(e)})):d.type===a.FilterType.DateRange?d.rangePickerDateOnly?e.jsx(i.DateRangeOnlyButton,Object.assign({},d,{variant:d.variant,onSelect:e=>d.onChange(e)})):e.jsx(r.AnalyticsDropdown,{datePickerPlacement:d.datePickerPlacement,variant:d.variant,placeholder:d.text,options:d.preset?s:null!==(p=d.options)&&void 0!==p?p:[],onOptionSelected:function(e){var r,t;e.selectedRange&&d.onChange([null===(r=e.selectedRange)||void 0===r?void 0:r[0],null===(t=e.selectedRange)||void 0===t?void 0:t[1]])}},d.id):"small"===d.variant?e.jsx(n.ChipDropdown,{isMultiSelect:d.type===a.FilterType.Multiple,options:null!==(l=d.options)&&void 0!==l?l:[],defaultOptions:d.defaultValue,onSelect:d.onChange,placeHolder:d.text}):e.jsx(t.Dropdown,{isMultiSelect:d.type===a.FilterType.Multiple,size:"small",options:null!==(c=d.options)&&void 0!==c?c:[],defaultOptions:d.defaultValue,onSelect:d.onChange,placeHolder:d.text,width:10*d.text.length+"px"})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../tooltips/Tooltip.js"),require("../../../constants/Theme.js"),require("../../TypographyStyle.js"),require("../../analytics-chips-and-dropdowns/CommonStyles.js");var r=require("../../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("react"),require("../../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js"),require("../../dropdown/DropdownPopover/index.js");var t=require("../../dropdown/Dropdown.js"),n=require("../../dropdown/ChipDropdown.js");require("../../zeroState/ZeroState.js"),require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../checkBox/CheckBox.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../button/Button.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../input/Input.js"),require("../../dropdown/MenuItem/MenuItem.js");var a=require("../types/SearchFilter.type.js"),o=require("./DatePickerButton.js"),i=require("./DateRangeOnlyButton.js");const s=[{label:"Last 7 days",value:"7 days",key:7,noOfDays:7},{label:"Last 30 days",value:"30 days",key:30,noOfDays:30},{label:"Custom range",value:"calender",key:"custom",isCustom:!0,dateRangeSelectionOptions:{selectRange:!0}}];exports.SearchFilterItem=d=>{var p,l,c;return d.type===a.FilterType.Date?e.jsx(o.DatePickerButton,Object.assign({},d,{variant:d.variant,onSelect:e=>d.onChange(e)})):d.type===a.FilterType.DateRange?d.rangePickerDateOnly?e.jsx(i.DateRangeOnlyButton,Object.assign({},d,{variant:d.variant,onSelect:e=>d.onChange(e)})):e.jsx(r.AnalyticsDropdown,{datePickerPlacement:d.datePickerPlacement,variant:d.variant,placeholder:d.text,options:d.preset?s:null!==(p=d.options)&&void 0!==p?p:[],onOptionSelected:function(e){var r,t;e.selectedRange&&d.onChange([null===(r=e.selectedRange)||void 0===r?void 0:r[0],null===(t=e.selectedRange)||void 0===t?void 0:t[1]])}},d.id):"small"===d.variant?e.jsx(n.ChipDropdown,{isMultiSelect:d.type===a.FilterType.Multiple,options:null!==(l=d.options)&&void 0!==l?l:[],defaultOptions:d.defaultValue,onSelect:d.onChange,placeHolder:d.text}):e.jsx(t.Dropdown,{isMultiSelect:d.type===a.FilterType.Multiple,size:"small",options:null!==(c=d.options)&&void 0!==c?c:[],defaultOptions:d.defaultValue,onSelect:d.onChange,placeHolder:d.text,width:10*d.text.length+"px"})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../../constants/Theme.js"),s=require("../../assets/icons/arrow_down.svg.js"),n=require("../../assets/icons/arrow_up.svg.js"),r=require("../../assets/icons/info.svg.js"),o=require("../tag/Tag.js"),a=require("../template-context-mapper/utils/getFormattedMonthDate.js"),l=require("../tooltips/Tooltip.js"),c=require("../TypographyStyle.js"),d=require("./CommonStyles.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=g(t);const y=t=>{let{percent:r,direction:o,timeline:l,customRange:d}=t;const g="negative"===o?s.default:n.default,h="negative"===o?i.COLORS.background.negative.vibrant:"positive"===o?i.COLORS.background.positive.vibrant:i.COLORS.content.placeholder,y="today"===l?"vs yesterday":"yesterday"===l?"vs 1 day before":"7 days"===l?"vs last 7 days":"30 days"===l?"vs last 30 days":"custom"===l&&d?`vs ${a.getFormattedMonthDate(d[0])} - ${a.getFormattedMonthDate(d[1])}`:"";return e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row"}},{children:["number"==typeof r&&e.jsx(g,{color:h,height:20,width:20,style:{marginRight:2}}),"number"==typeof r&&o&&e.jsxs(c.TitleSmall,Object.assign({style:{color:h}},{children:["neutral"===o?0:r,"%"]})),l&&e.jsx(c.Caption,Object.assign({style:{marginLeft:4,color:i.COLORS.content.placeholder}},{children:y}))]}))};exports.AnalyticsTrend=t=>{let{title:s,value:n,trendPercent:a,type:g="horizontal",timeline:p,customRange:u,tooltip:j,card:m=!0,rightSeparator:b=!1,size:v="big",share:x=!1,formatVal:O,prefixSymbol:f,trailingIcon:R,onTrailIconClick:C,iconTooltipBody:S}=t;const T="big"===v?c.TitleLarge:c.TitleMedium,w=void 0!==a?a<0?"negative":0===a?"neutral":"positive":void 0,L=void 0!==a?x?Math.round(a):Math.abs(Math.round(a)):void 0;return e.jsx(d.AnalyticsTrendContainer,Object.assign({card:m},{children:e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,borderRightWidth:b?1:0,borderRightColor:i.COLORS.stroke.primary,borderRightStyle:"solid",paddingLeft:m?0:24,paddingRight:m?0:24,height:"100%",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4,height:"100%"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e.jsx(c.BodySecondary,Object.assign({style:{color:i.COLORS.content.secondary}},{children:s})),j&&e.jsx(l.Tooltip,Object.assign({body:j,placement:"right",width:300},{children:e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",cursor:"pointer"}},{children:e.jsx(r.default,{color:i.COLORS.content.inactive,height:16,width:16})}))}))]})),e.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},x?{justifyContent:"space-between"}:{})},{children:[e.jsx(T,Object.assign({style:{color:i.COLORS.content.primary}},{children:void 0===n?"--":"number"==typeof n&&O?`${null!=f?f:""}${new Intl.NumberFormat("en-IN",{}).format(n)}`:`${null!=f?f:""}${n}`})),"horizontal"===g&&!x&&e.jsx(y,{timeline:p,customRange:u,percent:L,direction:w}),x&&void 0!==L&&e.jsx(o.Tag,{tagText:`${L} %`,theme:"light",type:"neutral"})]})),"vertical"===g&&!x&&e.jsx("div",Object.assign({style:{marginTop:12}},{children:e.jsx(y,{timeline:p,customRange:u,percent:L,direction:w})}))]})),S&&e.jsx(l.Tooltip,Object.assign({body:S,placement:"right"},{children:R&&e.jsx("div",Object.assign({className:"icon--holder",onClick:C},{children:h.default.createElement(R,{height:20,width:20,color:i.COLORS.content.secondary})}))}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("../../utils/DateUtils.js"),s=require("../../constants/Theme.js"),n=require("../../assets/icons/arrow_down.svg.js"),r=require("../../assets/icons/arrow_up.svg.js"),o=require("../../assets/icons/info.svg.js"),a=require("../tag/Tag.js"),l=require("../tooltips/Tooltip.js"),c=require("../TypographyStyle.js"),d=require("./CommonStyles.js");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=g(t);const y=o=>{let{percent:a,direction:l,timeline:d,customRange:g}=o;const u="negative"===l?n.default:r.default,y="negative"===l?s.COLORS.background.negative.vibrant:"positive"===l?s.COLORS.background.positive.vibrant:s.COLORS.content.placeholder,h=t.useRef("today"===d?"vs yesterday":"yesterday"===d?"vs 1 day before":"7 days"===d?"vs last 7 days":"30 days"===d?"vs last 30 days":"");return t.useEffect((()=>{"custom"===d&&g&&(h.current=i.default.getAnalyticsCustomDateTimelineText(g))}),[d,g]),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row"}},{children:["number"==typeof a&&e.jsx(u,{color:y,height:20,width:20,style:{marginRight:2}}),"number"==typeof a&&l&&e.jsxs(c.TitleSmall,Object.assign({style:{color:y}},{children:["neutral"===l?0:a,"%"]})),d&&e.jsx(c.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:h.current}))]}))};exports.AnalyticsTrend=t=>{let{title:i,value:n,trendPercent:r,type:g="horizontal",timeline:h,customRange:j,tooltip:p,card:m=!0,rightSeparator:b=!1,size:x="big",share:f=!1,formatVal:v,prefixSymbol:O,trailingIcon:R,onTrailIconClick:C,iconTooltipBody:T}=t;const S="big"===x?c.TitleLarge:c.TitleMedium,w=void 0!==r?r<0?"negative":0===r?"neutral":"positive":void 0,L=void 0!==r?f?Math.round(r):Math.abs(Math.round(r)):void 0;return e.jsx(d.AnalyticsTrendContainer,Object.assign({card:m},{children:e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,borderRightWidth:b?1:0,borderRightColor:s.COLORS.stroke.primary,borderRightStyle:"solid",paddingLeft:m?0:24,paddingRight:m?0:24,height:"100%",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4,height:"100%"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e.jsx(c.BodySecondary,Object.assign({style:{color:s.COLORS.content.secondary}},{children:i})),p&&e.jsx(l.Tooltip,Object.assign({body:p,placement:"right",width:300},{children:e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",cursor:"pointer"}},{children:e.jsx(o.default,{color:s.COLORS.content.inactive,height:16,width:16})}))}))]})),e.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},f?{justifyContent:"space-between"}:{})},{children:[e.jsx(S,Object.assign({style:{color:s.COLORS.content.primary}},{children:void 0===n?"--":"number"==typeof n&&v?`${null!=O?O:""}${new Intl.NumberFormat("en-IN",{}).format(n)}`:`${null!=O?O:""}${n}`})),"horizontal"===g&&!f&&e.jsx(y,{timeline:h,customRange:j,percent:L,direction:w}),f&&void 0!==L&&e.jsx(a.Tag,{tagText:`${L} %`,theme:"light",type:"neutral"})]})),"vertical"===g&&!f&&e.jsx("div",Object.assign({style:{marginTop:12}},{children:e.jsx(y,{timeline:h,customRange:j,percent:L,direction:w})}))]})),T&&e.jsx(l.Tooltip,Object.assign({body:T,placement:"right"},{children:R&&e.jsx("div",Object.assign({className:"icon--holder",onClick:C},{children:u.default.createElement(R,{height:20,width:20,color:s.COLORS.content.secondary})}))}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("./PostPicker.styled.js"),s=require("../tag/Tag.js"),r=require("../TypographyStyle.js"),i=require("../../utils/unCamelCase.js"),n=require("../../constants/colors.js"),o=require("../../constants/Theme.js"),l=require("../../assets/icons/instagram.svg.js"),d=require("../../assets/icons/warning.svg.js"),c=require("../modals/styledModal.js"),p=require("../shimmer/ShimmerComponent/BikShimmer.js"),h=require("../shimmer-image/ShimmerImage.js"),u=require("../states/StateComponent.js");require("../../_virtual/_tslib.js"),require("../tooltips/Tooltip.js"),require("../analytics-chips-and-dropdowns/CommonStyles.js");var y=require("../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js");var m,g,j=require("../../assets/icons/searchIcon.js");exports.MEDIA_TYPES=void 0,(m=exports.MEDIA_TYPES||(exports.MEDIA_TYPES={})).STORY="story",m.POST="post",m.REEL="reel",exports.DateKeys=void 0,(g=exports.DateKeys||(exports.DateKeys={})).Today="Today",g["7_Days"]="7",g["30_Days"]="30",g.custom="custom",g.Yesterday="Yesterday";const x=[{label:"Today",value:"today",key:exports.DateKeys.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:exports.DateKeys["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:exports.DateKeys["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:exports.DateKeys.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}];exports.PostPicker=m=>{var g,D;const[S,v]=t.useState(null!==(g=m.previouslySelected)&&void 0!==g?g:[]),[w,C]=t.useState(""),[T,b]=t.useState(!1),[O,f]=t.useState(m.media),[q,P]=t.useState(!1),[E,I]=t.useState(!1);t.useEffect((()=>{m.media.length||(b(!0),setTimeout((()=>{b(!1)}),2e3)),v(m.selected||[])}),[]),t.useEffect((()=>{m.media.length>0&&(f(m.media),b(!1))}),[null===(D=null==m?void 0:m.media)||void 0===D?void 0:D.length]),t.useEffect((()=>{S.length>0&&C("")}),[S.length]),t.useEffect((()=>{q&&(f(m.media),I(!1))}),[q]);return e.jsx(e.Fragment,{children:e.jsxs(c.StyledModal,Object.assign({zIndex:201,open:m.showModal,headingTitle:m.title,onClose:m.onClose,centralContainerStyles:{width:1071,height:m.showFilter?612:564},primaryButton:{disabled:!O.length,buttonType:"primary",buttonText:`Select ${i.unCamelCase(m.mediaType)}`,onClick:()=>{S.length?m.onSelect(S):C(`Please select a ${m.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>m.onClose()},footerLeftCustomElement:w?e.jsx(s.Tag,{tagText:w,type:"negative",LeadingIcon:d.default}):S.length?e.jsxs(r.BodySecondary,{children:[S.length," selected"]}):null},{children:[m.showFilter&&e.jsxs("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e.jsx(y.AnalyticsDropdown,{options:x,placeholder:"posted on",resetDropdown:q,onOptionSelected:e=>{var t,a;let s=null,r=null;"Custom range"===e.label?(s=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,r=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(s=e.typeValue[0],r=e.typeValue[1]);const i=m.media.filter((e=>function(e,t,a){const s=new Date(e),r=new Date(t),i=new Date(a);return s>=r&&s<=i}(e.timestamp,s,r)));f(i),I(!0),P(!1)}}),E&&e.jsx(r.ButtonRegular,Object.assign({color:o.COLORS.content.secondary,onClick:()=>P(!0)},{children:"Clear"}))]})),T?e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.jsx(p.BikShimmer,{boxes:[{width:(m.mediaType==exports.MEDIA_TYPES.POST?148:104)+"px",height:(m.mediaType==exports.MEDIA_TYPES.POST?148:172)+"px"}]})})):e.jsx(e.Fragment,{children:O&&O.length?e.jsx(a.StyledProductGrid,Object.assign({mediaType:m.mediaType},{children:O.map((t=>{return e.jsxs(a.StyledProduct,Object.assign({mediaType:m.mediaType,className:""+(s=t,i=S,i.some((e=>e.id===s.id))?"selected":""),onClick:()=>{return e=t,void v((()=>S.find((t=>t.id===e.id))?S.filter((t=>t.id!==e.id)):!m.limit||S.length<m.limit?[...S,e]:(C(`Only ${m.limit} ${m.mediaType}s can be selected`),S)));var e}},{children:[e.jsx(h.ShimmerImage,{imageUrl:t.imageUrl,width:m.mediaType==exports.MEDIA_TYPES.POST?148:104,height:m.mediaType==exports.MEDIA_TYPES.POST?148:172,alt:t.overlayCaption}),e.jsxs("div",Object.assign({className:"overlay"},{children:[e.jsx("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:e.jsxs("div",Object.assign({className:"overlay__redirection"},{children:[e.jsx(l.default,{height:22,width:22}),e.jsx(r.BodyPrimary,Object.assign({color:n.PRIMARY,style:{fontWeight:500}},{children:"View"}))]}))})),e.jsx("div",Object.assign({className:"overlay__caption"},{children:e.jsx(r.BodyCaption,Object.assign({color:o.COLORS.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var s,i}))})):e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:m.media.length?O.length?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${o.COLORS.background.inverse}`,borderRadius:"50%"}},{children:e.jsx(j.SearchIcon,{color:o.COLORS.content.primaryInverse})})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e.jsx(r.TitleMedium,{children:"No results found"}),e.jsx(r.BodyPrimary,{children:"Sorry we could not find any results for the selected filter"})]})),e.jsx("div",Object.assign({onClick:()=>{P(!0)}},{children:e.jsx(r.ButtonLarge,Object.assign({color:`${o.COLORS.content.brand}`},{children:"Clear Filter"}))}))]})):e.jsx(u.StateComponent,{states:u.StateInterface.WARNING,heading:`No ${m.mediaType}s on your account`,subline:`There seems to be no ${m.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})},exports.dateOptions=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("./PostPicker.styled.js"),s=require("../tag/Tag.js"),r=require("../TypographyStyle.js"),i=require("../../utils/unCamelCase.js"),n=require("../../constants/colors.js"),o=require("../../constants/Theme.js"),l=require("../../assets/icons/instagram.svg.js"),d=require("../../assets/icons/warning.svg.js"),c=require("../modals/styledModal.js"),p=require("../shimmer/ShimmerComponent/BikShimmer.js"),u=require("../shimmer-image/ShimmerImage.js"),h=require("../states/StateComponent.js");require("../../_virtual/_tslib.js"),require("../tooltips/Tooltip.js"),require("../analytics-chips-and-dropdowns/CommonStyles.js");var y=require("../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../../utils/DateUtils.js"),require("../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js");var m,g,j=require("../../assets/icons/searchIcon.js");exports.MEDIA_TYPES=void 0,(m=exports.MEDIA_TYPES||(exports.MEDIA_TYPES={})).STORY="story",m.POST="post",m.REEL="reel",exports.DateKeys=void 0,(g=exports.DateKeys||(exports.DateKeys={})).Today="Today",g["7_Days"]="7",g["30_Days"]="30",g.custom="custom",g.Yesterday="Yesterday";const x=[{label:"Today",value:"today",key:exports.DateKeys.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:exports.DateKeys["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:exports.DateKeys["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:exports.DateKeys.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}];exports.PostPicker=m=>{var g,D;const[S,v]=t.useState(null!==(g=m.previouslySelected)&&void 0!==g?g:[]),[w,C]=t.useState(""),[T,b]=t.useState(!1),[O,f]=t.useState(m.media),[q,P]=t.useState(!1),[E,I]=t.useState(!1);t.useEffect((()=>{m.media.length||(b(!0),setTimeout((()=>{b(!1)}),2e3)),v(m.selected||[])}),[]),t.useEffect((()=>{m.media.length>0&&(f(m.media),b(!1))}),[null===(D=null==m?void 0:m.media)||void 0===D?void 0:D.length]),t.useEffect((()=>{S.length>0&&C("")}),[S.length]),t.useEffect((()=>{q&&(f(m.media),I(!1))}),[q]);return e.jsx(e.Fragment,{children:e.jsxs(c.StyledModal,Object.assign({zIndex:201,open:m.showModal,headingTitle:m.title,onClose:m.onClose,centralContainerStyles:{width:1071,height:m.showFilter?612:564},primaryButton:{disabled:!O.length,buttonType:"primary",buttonText:`Select ${i.unCamelCase(m.mediaType)}`,onClick:()=>{S.length?m.onSelect(S):C(`Please select a ${m.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>m.onClose()},footerLeftCustomElement:w?e.jsx(s.Tag,{tagText:w,type:"negative",LeadingIcon:d.default}):S.length?e.jsxs(r.BodySecondary,{children:[S.length," selected"]}):null},{children:[m.showFilter&&e.jsxs("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e.jsx(y.AnalyticsDropdown,{options:x,placeholder:"posted on",resetDropdown:q,onOptionSelected:e=>{var t,a;let s=null,r=null;"Custom range"===e.label?(s=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,r=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(s=e.typeValue[0],r=e.typeValue[1]);const i=m.media.filter((e=>function(e,t,a){const s=new Date(e),r=new Date(t),i=new Date(a);return s>=r&&s<=i}(e.timestamp,s,r)));f(i),I(!0),P(!1)}}),E&&e.jsx(r.ButtonRegular,Object.assign({color:o.COLORS.content.secondary,onClick:()=>P(!0)},{children:"Clear"}))]})),T?e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.jsx(p.BikShimmer,{boxes:[{width:(m.mediaType==exports.MEDIA_TYPES.POST?148:104)+"px",height:(m.mediaType==exports.MEDIA_TYPES.POST?148:172)+"px"}]})})):e.jsx(e.Fragment,{children:O&&O.length?e.jsx(a.StyledProductGrid,Object.assign({mediaType:m.mediaType},{children:O.map((t=>{return e.jsxs(a.StyledProduct,Object.assign({mediaType:m.mediaType,className:""+(s=t,i=S,i.some((e=>e.id===s.id))?"selected":""),onClick:()=>{return e=t,void v((()=>S.find((t=>t.id===e.id))?S.filter((t=>t.id!==e.id)):!m.limit||S.length<m.limit?[...S,e]:(C(`Only ${m.limit} ${m.mediaType}s can be selected`),S)));var e}},{children:[e.jsx(u.ShimmerImage,{imageUrl:t.imageUrl,width:m.mediaType==exports.MEDIA_TYPES.POST?148:104,height:m.mediaType==exports.MEDIA_TYPES.POST?148:172,alt:t.overlayCaption}),e.jsxs("div",Object.assign({className:"overlay"},{children:[e.jsx("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:e.jsxs("div",Object.assign({className:"overlay__redirection"},{children:[e.jsx(l.default,{height:22,width:22}),e.jsx(r.BodyPrimary,Object.assign({color:n.PRIMARY,style:{fontWeight:500}},{children:"View"}))]}))})),e.jsx("div",Object.assign({className:"overlay__caption"},{children:e.jsx(r.BodyCaption,Object.assign({color:o.COLORS.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var s,i}))})):e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:m.media.length?O.length?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${o.COLORS.background.inverse}`,borderRadius:"50%"}},{children:e.jsx(j.SearchIcon,{color:o.COLORS.content.primaryInverse})})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e.jsx(r.TitleMedium,{children:"No results found"}),e.jsx(r.BodyPrimary,{children:"Sorry we could not find any results for the selected filter"})]})),e.jsx("div",Object.assign({onClick:()=>{P(!0)}},{children:e.jsx(r.ButtonLarge,Object.assign({color:`${o.COLORS.content.brand}`},{children:"Clear Filter"}))}))]})):e.jsx(h.StateComponent,{states:h.StateInterface.WARNING,heading:`No ${m.mediaType}s on your account`,subline:`There seems to be no ${m.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})},exports.dateOptions=x;
@@ -18,4 +18,5 @@ export default class DateUtils {
18
18
  static getPastDate: (dt: Date, daysToSubtract: number) => Date;
19
19
  static timeFormatValidation12H: (time: string) => boolean;
20
20
  static convert12HourTimeTo24Hour: (time12h: any) => string;
21
+ static getAnalyticsCustomDateTimelineText: (customRange: Array<Date>) => string;
21
22
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("date-fns");class t{}Object.defineProperty(t,"formatDateInDDMMMYYY",{enumerable:!0,configurable:!0,writable:!0,value:t=>{const a=new Date(t);return e.format(a,"dd MMM yyy")}}),Object.defineProperty(t,"getStringFromDate",{enumerable:!0,configurable:!0,writable:!0,value:function(t){if(!t)return"";switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD"){case"YYYY-MM-DD":{const e=t.getMonth()+1>=10?`${t.getMonth()+1}`:`0${t.getMonth()+1}`,a=t.getDate()>=10?`${t.getDate()}`:`0${t.getDate()}`;return`${t.getFullYear()}-${e}-${a}`}case"dd-MM-yyyy":return e.format(new Date(t),"dd-MM-yyyy");case"dd MMM yyyy":return e.format(new Date(t),"dd MMM yyyy");case"dd/MM/yyyy":return e.format(new Date(t),"dd/MM/yyyy");default:return" "}}}),Object.defineProperty(t,"getTodayStringifyDate",{enumerable:!0,configurable:!0,writable:!0,value:()=>t.getStringFromDate(new Date)}),Object.defineProperty(t,"getDaysBefore",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)}}),Object.defineProperty(t,"nth",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}}),Object.defineProperty(t,"timeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>e>23||t>59?"Not Valid":e-12>=0?((e=e>12?e-12:e)>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"pm":0==e?"12:"+("0"+t).slice(-2)+"am":(e>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"am"}),Object.defineProperty(t,"dateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r)=>{try{const n=a?" "+a+" ":", ";return e.format(t,r?"do MMMM yyyy":"do MMM yyyy")+n+e.format(t,"h:mmaaa")}catch(t){const n=a?" "+a+" ":", ";return e.format(new Date,r?"do MMMM yyyy":"do MMM yyyy")+n+e.format(new Date,"h:mmaaa")}}}),Object.defineProperty(t,"toDateFromSecs",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date(1970,0,1);return t.setSeconds(e),t}}),Object.defineProperty(t,"todayDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:t=>e.isToday(t)?`Today at ${e.format(t,"hh:mmaaa")}`:e.isYesterday(t)?`Yesterday at ${e.format(t,"hh:mmaaa")}`:`${e.format(t,"d MMM yyyy")} at ${e.format(t,"hh:mmaaa")}`}),Object.defineProperty(t,"timeString12hr",{enumerable:!0,configurable:!0,writable:!0,value:e=>new Date("1970-01-01T"+e+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})}),Object.defineProperty(t,"customisedDateTimeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n,o)=>{try{const y=a?" "+a+" ":", ";let i="";return i=o?e.format(t,n||"h:mmaaa")+y+e.format(t,r||"do MMM yyyy"):e.format(t,r||"do MMM yyyy")+y+e.format(t,n||"h:mmaaa"),i}catch(t){console.warn(t.message);const y=a?" "+a+" ":", ";return o?e.format(new Date,n||"h:mmaaa")+y+e.format(new Date,r||"do MMM yyyy"):e.format(new Date,r||"do MMM yyyy")+y+e.format(new Date,n||"h:mmaaa")}}}),Object.defineProperty(t,"formatDateTime",{enumerable:!0,configurable:!0,writable:!0,value:e=>("pm"===e.slice(5,7)?(parseInt(e.slice(0,2))+12).toString():e.slice(0,2))+":"+e.slice(3,5)+":00"}),Object.defineProperty(t,"timeDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n)=>{try{const o=a?" "+a+" ":", ";return e.format(t,r||"h:mmaaa")+o+e.format(t,n||"do MMM yyyy")}catch(t){const o=a?" "+a+" ":", ";return e.format(new Date,r||"h:mmaaa")+o+e.format(new Date,n||"do MMM yyyy")}}}),Object.defineProperty(t,"timeToAMPM",{enumerable:!0,configurable:!0,writable:!0,value:e=>((e=e.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[e]).length>1&&((e=e.slice(1))[5]=+e[0]<12?"AM":"PM",e[0]=+e[0]%12||12),e=e[0]+e[1]+e[2]+" "+e[5])}),Object.defineProperty(t,"timeFormatValidation",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[1-9]|1[012]):[0-5][0-9]\s[AP]{1}[M]{1}$/).test(e)}),Object.defineProperty(t,"onlyDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e.format(t,a||"dd MMM yyyy")}),Object.defineProperty(t,"getPastDate",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e.subDays(t,a)}),Object.defineProperty(t,"timeFormatValidation12H",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[0-9]|1[0-2]):[0-5][0-9]$/).test(e)}),Object.defineProperty(t,"convert12HourTimeTo24Hour",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const[t,a]=e.split(" ");let[r,n]=t.split(":");return"12"===r&&(r="00"),"PM"===a&&(r=parseInt(r,10)+12),`${1===r.length?"0"+r:r}:${n}`}}),exports.default=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("date-fns");class t{}Object.defineProperty(t,"formatDateInDDMMMYYY",{enumerable:!0,configurable:!0,writable:!0,value:t=>{const a=new Date(t);return e.format(a,"dd MMM yyy")}}),Object.defineProperty(t,"getStringFromDate",{enumerable:!0,configurable:!0,writable:!0,value:function(t){if(!t)return"";switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD"){case"YYYY-MM-DD":{const e=t.getMonth()+1>=10?`${t.getMonth()+1}`:`0${t.getMonth()+1}`,a=t.getDate()>=10?`${t.getDate()}`:`0${t.getDate()}`;return`${t.getFullYear()}-${e}-${a}`}case"dd-MM-yyyy":return e.format(new Date(t),"dd-MM-yyyy");case"dd MMM yyyy":return e.format(new Date(t),"dd MMM yyyy");case"dd/MM/yyyy":return e.format(new Date(t),"dd/MM/yyyy");default:return" "}}}),Object.defineProperty(t,"getTodayStringifyDate",{enumerable:!0,configurable:!0,writable:!0,value:()=>t.getStringFromDate(new Date)}),Object.defineProperty(t,"getDaysBefore",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)}}),Object.defineProperty(t,"nth",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}}),Object.defineProperty(t,"timeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>e>23||t>59?"Not Valid":e-12>=0?((e=e>12?e-12:e)>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"pm":0==e?"12:"+("0"+t).slice(-2)+"am":(e>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"am"}),Object.defineProperty(t,"dateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r)=>{try{const n=a?" "+a+" ":", ";return e.format(t,r?"do MMMM yyyy":"do MMM yyyy")+n+e.format(t,"h:mmaaa")}catch(t){const n=a?" "+a+" ":", ";return e.format(new Date,r?"do MMMM yyyy":"do MMM yyyy")+n+e.format(new Date,"h:mmaaa")}}}),Object.defineProperty(t,"toDateFromSecs",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date(1970,0,1);return t.setSeconds(e),t}}),Object.defineProperty(t,"todayDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:t=>e.isToday(t)?`Today at ${e.format(t,"hh:mmaaa")}`:e.isYesterday(t)?`Yesterday at ${e.format(t,"hh:mmaaa")}`:`${e.format(t,"d MMM yyyy")} at ${e.format(t,"hh:mmaaa")}`}),Object.defineProperty(t,"timeString12hr",{enumerable:!0,configurable:!0,writable:!0,value:e=>new Date("1970-01-01T"+e+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})}),Object.defineProperty(t,"customisedDateTimeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n,o)=>{try{const i=a?" "+a+" ":", ";let l="";return l=o?e.format(t,n||"h:mmaaa")+i+e.format(t,r||"do MMM yyyy"):e.format(t,r||"do MMM yyyy")+i+e.format(t,n||"h:mmaaa"),l}catch(t){console.warn(t.message);const i=a?" "+a+" ":", ";return o?e.format(new Date,n||"h:mmaaa")+i+e.format(new Date,r||"do MMM yyyy"):e.format(new Date,r||"do MMM yyyy")+i+e.format(new Date,n||"h:mmaaa")}}}),Object.defineProperty(t,"formatDateTime",{enumerable:!0,configurable:!0,writable:!0,value:e=>("pm"===e.slice(5,7)?(parseInt(e.slice(0,2))+12).toString():e.slice(0,2))+":"+e.slice(3,5)+":00"}),Object.defineProperty(t,"timeDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n)=>{try{const o=a?" "+a+" ":", ";return e.format(t,r||"h:mmaaa")+o+e.format(t,n||"do MMM yyyy")}catch(t){const o=a?" "+a+" ":", ";return e.format(new Date,r||"h:mmaaa")+o+e.format(new Date,n||"do MMM yyyy")}}}),Object.defineProperty(t,"timeToAMPM",{enumerable:!0,configurable:!0,writable:!0,value:e=>((e=e.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[e]).length>1&&((e=e.slice(1))[5]=+e[0]<12?"AM":"PM",e[0]=+e[0]%12||12),e=e[0]+e[1]+e[2]+" "+e[5])}),Object.defineProperty(t,"timeFormatValidation",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[1-9]|1[012]):[0-5][0-9]\s[AP]{1}[M]{1}$/).test(e)}),Object.defineProperty(t,"onlyDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e.format(t,a||"dd MMM yyyy")}),Object.defineProperty(t,"getPastDate",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e.subDays(t,a)}),Object.defineProperty(t,"timeFormatValidation12H",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[0-9]|1[0-2]):[0-5][0-9]$/).test(e)}),Object.defineProperty(t,"convert12HourTimeTo24Hour",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const[t,a]=e.split(" ");let[r,n]=t.split(":");return"12"===r&&(r="00"),"PM"===a&&(r=parseInt(r,10)+12),`${1===r.length?"0"+r:r}:${n}`}}),Object.defineProperty(t,"getAnalyticsCustomDateTimelineText",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!(e&&Array.isArray(e)&&(null==e?void 0:e[0])&&(null==e?void 0:e[1])))return"";const t=new Date("string"==typeof e[0]?new Date(e[0]).getTime():e[0].getTime()),a=new Date("string"==typeof e[1]?new Date(e[1]).getTime():e[1].getTime()),r=864e5,n=Math.floor((a.getTime()-t.getTime())/r),o=new Date(t.getTime()-864e5),i=`${o.toLocaleString("default",{month:"short"})} ${o.getDate()}`,l=new Date(o.getTime()-n*r);return`vs ${`${l.toLocaleString("default",{month:"short"})} ${l.getDate()}`} - ${i}`}}),exports.default=t;
@@ -1 +1 @@
1
- import{jsx as t,Fragment as a}from"react/jsx-runtime";import"../../tooltips/Tooltip.js";import"../../../constants/Theme.js";import"../../TypographyStyle.js";import"../../analytics-chips-and-dropdowns/CommonStyles.js";import{formatDate as i}from"../../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"react";import"../../analytics-chips-and-dropdowns/AnalyticsMetric.js";import{Tag as r}from"../../tag/Tag.js";import"../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import o from"../../../assets/icons/cross.svg.js";import{FilterType as e}from"../types/SearchFilter.type.js";const n=n=>{let{selectedState:l,onDeSelect:s}=n;return t(a,{children:l.map((n=>{var l,p,d,c,h,m,u;return n.type===e.Multiple?t(a,{children:null===(l=n.value)||void 0===l?void 0:l.map((a=>{var i,e;return t(r,{onTrailingIconClicked:()=>s(n.id,a),style:{cursor:"pointer"},tagText:null!==(e=null===(i=a.label)||void 0===i?void 0:i.slice(0,10))&&void 0!==e?e:"",type:"neutral",theme:"light",TrailingIcon:o},`${n.id}-${a.value}`)}))}):n.type===e.Date?t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:i(n.value),type:"neutral",theme:"light",TrailingIcon:o},n.id):n.type===e.DateRange?t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:`${i(null===(p=n.value)||void 0===p?void 0:p[0])} to ${i(null===(d=n.value)||void 0===d?void 0:d[1])}`,type:"neutral",theme:"light",TrailingIcon:o},n.id):t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:n.type===e.Single?null!==(h=null===(c=n.value)||void 0===c?void 0:c.label)&&void 0!==h?h:"":null!==(u=null===(m=n.value)||void 0===m?void 0:m.toString())&&void 0!==u?u:"",type:"neutral",theme:"light",TrailingIcon:o},n.id)}))})};export{n as FilterChipListRenderer};
1
+ import{jsx as t,Fragment as i}from"react/jsx-runtime";import"../../tooltips/Tooltip.js";import"../../../constants/Theme.js";import"../../TypographyStyle.js";import"../../analytics-chips-and-dropdowns/CommonStyles.js";import{formatDate as a}from"../../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"react";import"../../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../../../utils/DateUtils.js";import{Tag as r}from"../../tag/Tag.js";import"../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import o from"../../../assets/icons/cross.svg.js";import{FilterType as e}from"../types/SearchFilter.type.js";const n=n=>{let{selectedState:l,onDeSelect:s}=n;return t(i,{children:l.map((n=>{var l,p,d,c,h,m,u;return n.type===e.Multiple?t(i,{children:null===(l=n.value)||void 0===l?void 0:l.map((i=>{var a,e;return t(r,{onTrailingIconClicked:()=>s(n.id,i),style:{cursor:"pointer"},tagText:null!==(e=null===(a=i.label)||void 0===a?void 0:a.slice(0,10))&&void 0!==e?e:"",type:"neutral",theme:"light",TrailingIcon:o},`${n.id}-${i.value}`)}))}):n.type===e.Date?t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:a(n.value),type:"neutral",theme:"light",TrailingIcon:o},n.id):n.type===e.DateRange?t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:`${a(null===(p=n.value)||void 0===p?void 0:p[0])} to ${a(null===(d=n.value)||void 0===d?void 0:d[1])}`,type:"neutral",theme:"light",TrailingIcon:o},n.id):t(r,{onTrailingIconClicked:()=>s(n.id,n.value),style:{cursor:"pointer"},tagText:n.type===e.Single?null!==(h=null===(c=n.value)||void 0===c?void 0:c.label)&&void 0!==h?h:"":null!==(u=null===(m=n.value)||void 0===m?void 0:m.toString())&&void 0!==u?u:"",type:"neutral",theme:"light",TrailingIcon:o},n.id)}))})};export{n as FilterChipListRenderer};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import"../../tooltips/Tooltip.js";import"../../../constants/Theme.js";import"../../TypographyStyle.js";import"../../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as o}from"../../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"react";import"../../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../../tag/Tag.js";import"../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as e}from"../../dropdown/Dropdown.js";import{ChipDropdown as n}from"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../button/Button.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../input/Input.js";import"../../dropdown/MenuItem/MenuItem.js";import{FilterType as a}from"../types/SearchFilter.type.js";import{DatePickerButton as r}from"./DatePickerButton.js";import{DateRangeOnlyButton as p}from"./DateRangeOnlyButton.js";const i=[{label:"Last 7 days",value:"7 days",key:7,noOfDays:7},{label:"Last 30 days",value:"30 days",key:30,noOfDays:30},{label:"Custom range",value:"calender",key:"custom",isCustom:!0,dateRangeSelectionOptions:{selectRange:!0}}],s=s=>{var d,l,c;return s.type===a.Date?t(r,Object.assign({},s,{variant:s.variant,onSelect:t=>s.onChange(t)})):s.type===a.DateRange?s.rangePickerDateOnly?t(p,Object.assign({},s,{variant:s.variant,onSelect:t=>s.onChange(t)})):t(o,{datePickerPlacement:s.datePickerPlacement,variant:s.variant,placeholder:s.text,options:s.preset?i:null!==(d=s.options)&&void 0!==d?d:[],onOptionSelected:function(t){var o,e;t.selectedRange&&s.onChange([null===(o=t.selectedRange)||void 0===o?void 0:o[0],null===(e=t.selectedRange)||void 0===e?void 0:e[1]])}},s.id):"small"===s.variant?t(n,{isMultiSelect:s.type===a.Multiple,options:null!==(l=s.options)&&void 0!==l?l:[],defaultOptions:s.defaultValue,onSelect:s.onChange,placeHolder:s.text}):t(e,{isMultiSelect:s.type===a.Multiple,size:"small",options:null!==(c=s.options)&&void 0!==c?c:[],defaultOptions:s.defaultValue,onSelect:s.onChange,placeHolder:s.text,width:10*s.text.length+"px"})};export{s as SearchFilterItem};
1
+ import{jsx as t}from"react/jsx-runtime";import"../../tooltips/Tooltip.js";import"../../../constants/Theme.js";import"../../TypographyStyle.js";import"../../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as o}from"../../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"react";import"../../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../../../utils/DateUtils.js";import"../../tag/Tag.js";import"../../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import"../../dropdown/DropdownPopover/index.js";import{Dropdown as e}from"../../dropdown/Dropdown.js";import{ChipDropdown as n}from"../../dropdown/ChipDropdown.js";import"../../zeroState/ZeroState.js";import"../../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../../checkBox/CheckBox.styled.js";import"../../list-item/ListItem.js";import"../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../../button/Button.js";import"../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../../input/Input.js";import"../../dropdown/MenuItem/MenuItem.js";import{FilterType as a}from"../types/SearchFilter.type.js";import{DatePickerButton as r}from"./DatePickerButton.js";import{DateRangeOnlyButton as i}from"./DateRangeOnlyButton.js";const p=[{label:"Last 7 days",value:"7 days",key:7,noOfDays:7},{label:"Last 30 days",value:"30 days",key:30,noOfDays:30},{label:"Custom range",value:"calender",key:"custom",isCustom:!0,dateRangeSelectionOptions:{selectRange:!0}}],s=s=>{var d,l,c;return s.type===a.Date?t(r,Object.assign({},s,{variant:s.variant,onSelect:t=>s.onChange(t)})):s.type===a.DateRange?s.rangePickerDateOnly?t(i,Object.assign({},s,{variant:s.variant,onSelect:t=>s.onChange(t)})):t(o,{datePickerPlacement:s.datePickerPlacement,variant:s.variant,placeholder:s.text,options:s.preset?p:null!==(d=s.options)&&void 0!==d?d:[],onOptionSelected:function(t){var o,e;t.selectedRange&&s.onChange([null===(o=t.selectedRange)||void 0===o?void 0:o[0],null===(e=t.selectedRange)||void 0===e?void 0:e[1]])}},s.id):"small"===s.variant?t(n,{isMultiSelect:s.type===a.Multiple,options:null!==(l=s.options)&&void 0!==l?l:[],defaultOptions:s.defaultValue,onSelect:s.onChange,placeHolder:s.text}):t(e,{isMultiSelect:s.type===a.Multiple,size:"small",options:null!==(c=s.options)&&void 0!==c?c:[],defaultOptions:s.defaultValue,onSelect:s.onChange,placeHolder:s.text,width:10*s.text.length+"px"})};export{s as SearchFilterItem};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import{COLORS as n}from"../../constants/Theme.js";import o from"../../assets/icons/arrow_down.svg.js";import r from"../../assets/icons/arrow_up.svg.js";import s from"../../assets/icons/info.svg.js";import{Tag as a}from"../tag/Tag.js";import{getFormattedMonthDate as l}from"../template-context-mapper/utils/getFormattedMonthDate.js";import{Tooltip as c}from"../tooltips/Tooltip.js";import{BodySecondary as d,TitleSmall as g,Caption as m,TitleLarge as p,TitleMedium as h}from"../TypographyStyle.js";import{AnalyticsTrendContainer as y}from"./CommonStyles.js";const b=o=>{let{title:r,value:l,trendPercent:g,type:m="horizontal",timeline:b,customRange:v,tooltip:j,card:u=!0,rightSeparator:x=!1,size:O="big",share:w=!1,formatVal:I,prefixSymbol:R,trailingIcon:T,onTrailIconClick:$,iconTooltipBody:C}=o;const D="big"===O?p:h,k=void 0!==g?g<0?"negative":0===g?"neutral":"positive":void 0,S=void 0!==g?w?Math.round(g):Math.abs(Math.round(g)):void 0;return e(y,Object.assign({card:u},{children:t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,borderRightWidth:x?1:0,borderRightColor:n.stroke.primary,borderRightStyle:"solid",paddingLeft:u?0:24,paddingRight:u?0:24,height:"100%",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4,height:"100%"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e(d,Object.assign({style:{color:n.content.secondary}},{children:r})),j&&e(c,Object.assign({body:j,placement:"right",width:300},{children:e("div",Object.assign({style:{display:"flex",alignItems:"center",cursor:"pointer"}},{children:e(s,{color:n.content.inactive,height:16,width:16})}))}))]})),t("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},w?{justifyContent:"space-between"}:{})},{children:[e(D,Object.assign({style:{color:n.content.primary}},{children:void 0===l?"--":"number"==typeof l&&I?`${null!=R?R:""}${new Intl.NumberFormat("en-IN",{}).format(l)}`:`${null!=R?R:""}${l}`})),"horizontal"===m&&!w&&e(f,{timeline:b,customRange:v,percent:S,direction:k}),w&&void 0!==S&&e(a,{tagText:`${S} %`,theme:"light",type:"neutral"})]})),"vertical"===m&&!w&&e("div",Object.assign({style:{marginTop:12}},{children:e(f,{timeline:b,customRange:v,percent:S,direction:k})}))]})),C&&e(c,Object.assign({body:C,placement:"right"},{children:T&&e("div",Object.assign({className:"icon--holder",onClick:$},{children:i.createElement(T,{height:20,width:20,color:n.content.secondary})}))}))]}))}))},f=i=>{let{percent:s,direction:a,timeline:c,customRange:d}=i;const p="negative"===a?o:r,h="negative"===a?n.background.negative.vibrant:"positive"===a?n.background.positive.vibrant:n.content.placeholder,y="today"===c?"vs yesterday":"yesterday"===c?"vs 1 day before":"7 days"===c?"vs last 7 days":"30 days"===c?"vs last 30 days":"custom"===c&&d?`vs ${l(d[0])} - ${l(d[1])}`:"";return t("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row"}},{children:["number"==typeof s&&e(p,{color:h,height:20,width:20,style:{marginRight:2}}),"number"==typeof s&&a&&t(g,Object.assign({style:{color:h}},{children:["neutral"===a?0:s,"%"]})),c&&e(m,Object.assign({style:{marginLeft:4,color:n.content.placeholder}},{children:y}))]}))};export{b as AnalyticsTrend};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import i,{useRef as n,useEffect as r}from"react";import o from"../../utils/DateUtils.js";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/arrow_down.svg.js";import l from"../../assets/icons/arrow_up.svg.js";import c from"../../assets/icons/info.svg.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as g}from"../tooltips/Tooltip.js";import{BodySecondary as m,TitleSmall as p,Caption as h,TitleLarge as y,TitleMedium as b}from"../TypographyStyle.js";import{AnalyticsTrendContainer as f}from"./CommonStyles.js";const v=n=>{let{title:r,value:o,trendPercent:a,type:l="horizontal",timeline:p,customRange:h,tooltip:v,card:j=!0,rightSeparator:x=!1,size:O="big",share:w=!1,formatVal:T,prefixSymbol:I,trailingIcon:R,onTrailIconClick:C,iconTooltipBody:D}=n;const k="big"===O?y:b,S=void 0!==a?a<0?"negative":0===a?"neutral":"positive":void 0,$=void 0!==a?w?Math.round(a):Math.abs(Math.round(a)):void 0;return e(f,Object.assign({card:j},{children:t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,borderRightWidth:x?1:0,borderRightColor:s.stroke.primary,borderRightStyle:"solid",paddingLeft:j?0:24,paddingRight:j?0:24,height:"100%",justifyContent:"space-between",alignItems:"center"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:4,height:"100%"}},{children:[t("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e(m,Object.assign({style:{color:s.content.secondary}},{children:r})),v&&e(g,Object.assign({body:v,placement:"right",width:300},{children:e("div",Object.assign({style:{display:"flex",alignItems:"center",cursor:"pointer"}},{children:e(c,{color:s.content.inactive,height:16,width:16})}))}))]})),t("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},w?{justifyContent:"space-between"}:{})},{children:[e(k,Object.assign({style:{color:s.content.primary}},{children:void 0===o?"--":"number"==typeof o&&T?`${null!=I?I:""}${new Intl.NumberFormat("en-IN",{}).format(o)}`:`${null!=I?I:""}${o}`})),"horizontal"===l&&!w&&e(u,{timeline:p,customRange:h,percent:$,direction:S}),w&&void 0!==$&&e(d,{tagText:`${$} %`,theme:"light",type:"neutral"})]})),"vertical"===l&&!w&&e("div",Object.assign({style:{marginTop:12}},{children:e(u,{timeline:p,customRange:h,percent:$,direction:S})}))]})),D&&e(g,Object.assign({body:D,placement:"right"},{children:R&&e("div",Object.assign({className:"icon--holder",onClick:C},{children:i.createElement(R,{height:20,width:20,color:s.content.secondary})}))}))]}))}))},u=i=>{let{percent:c,direction:d,timeline:g,customRange:m}=i;const y="negative"===d?a:l,b="negative"===d?s.background.negative.vibrant:"positive"===d?s.background.positive.vibrant:s.content.placeholder,f=n("today"===g?"vs yesterday":"yesterday"===g?"vs 1 day before":"7 days"===g?"vs last 7 days":"30 days"===g?"vs last 30 days":"");return r((()=>{"custom"===g&&m&&(f.current=o.getAnalyticsCustomDateTimelineText(m))}),[g,m]),t("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row"}},{children:["number"==typeof c&&e(y,{color:b,height:20,width:20,style:{marginRight:2}}),"number"==typeof c&&d&&t(p,Object.assign({style:{color:b}},{children:["neutral"===d?0:c,"%"]})),g&&e(h,Object.assign({style:{marginLeft:4,color:s.content.placeholder}},{children:f.current}))]}))};export{v as AnalyticsTrend};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{StyledProductGrid as o,StyledProduct as r}from"./PostPicker.styled.js";import{Tag as s}from"../tag/Tag.js";import{ButtonRegular as l,BodyPrimary as d,BodyCaption as c,TitleMedium as p,ButtonLarge as m,BodySecondary as h}from"../TypographyStyle.js";import{unCamelCase as y}from"../../utils/unCamelCase.js";import{PRIMARY as g}from"../../constants/colors.js";import{COLORS as u}from"../../constants/Theme.js";import j from"../../assets/icons/instagram.svg.js";import w from"../../assets/icons/warning.svg.js";import{StyledModal as f}from"../modals/styledModal.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as b}from"../shimmer-image/ShimmerImage.js";import{StateComponent as C,StateInterface as T}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import"../tooltips/Tooltip.js";import"../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as D}from"../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import{SearchIcon as O}from"../../assets/icons/searchIcon.js";var x,S;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(x||(x={})),function(e){e.Today="Today",e["7_Days"]="7",e["30_Days"]="30",e.custom="custom",e.Yesterday="Yesterday"}(S||(S={}));const k=[{label:"Today",value:"today",key:S.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:S["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:S["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:S.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}],B=S=>{var B,P;const[I,_]=i(null!==(B=S.previouslySelected)&&void 0!==B?B:[]),[L,V]=i(""),[G,N]=i(!1),[R,$]=i(S.media),[A,M]=i(!1),[E,z]=i(!1);n((()=>{S.media.length||(N(!0),setTimeout((()=>{N(!1)}),2e3)),_(S.selected||[])}),[]),n((()=>{S.media.length>0&&($(S.media),N(!1))}),[null===(P=null==S?void 0:S.media)||void 0===P?void 0:P.length]),n((()=>{I.length>0&&V("")}),[I.length]),n((()=>{A&&($(S.media),z(!1))}),[A]);return e(t,{children:a(f,Object.assign({zIndex:201,open:S.showModal,headingTitle:S.title,onClose:S.onClose,centralContainerStyles:{width:1071,height:S.showFilter?612:564},primaryButton:{disabled:!R.length,buttonType:"primary",buttonText:`Select ${y(S.mediaType)}`,onClick:()=>{I.length?S.onSelect(I):V(`Please select a ${S.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>S.onClose()},footerLeftCustomElement:L?e(s,{tagText:L,type:"negative",LeadingIcon:w}):I.length?a(h,{children:[I.length," selected"]}):null},{children:[S.showFilter&&a("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e(D,{options:k,placeholder:"posted on",resetDropdown:A,onOptionSelected:e=>{var t,a;let i=null,n=null;"Custom range"===e.label?(i=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,n=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(i=e.typeValue[0],n=e.typeValue[1]);const o=S.media.filter((e=>function(e,t,a){const i=new Date(e),n=new Date(t),o=new Date(a);return i>=n&&i<=o}(e.timestamp,i,n)));$(o),z(!0),M(!1)}}),E&&e(l,Object.assign({color:u.content.secondary,onClick:()=>M(!0)},{children:"Clear"}))]})),G?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(v,{boxes:[{width:(S.mediaType==x.POST?148:104)+"px",height:(S.mediaType==x.POST?148:172)+"px"}]})})):e(t,{children:R&&R.length?e(o,Object.assign({mediaType:S.mediaType},{children:R.map((t=>{return a(r,Object.assign({mediaType:S.mediaType,className:""+(i=t,n=I,n.some((e=>e.id===i.id))?"selected":""),onClick:()=>{return e=t,void _((()=>I.find((t=>t.id===e.id))?I.filter((t=>t.id!==e.id)):!S.limit||I.length<S.limit?[...I,e]:(V(`Only ${S.limit} ${S.mediaType}s can be selected`),I)));var e}},{children:[e(b,{imageUrl:t.imageUrl,width:S.mediaType==x.POST?148:104,height:S.mediaType==x.POST?148:172,alt:t.overlayCaption}),a("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:a("div",Object.assign({className:"overlay__redirection"},{children:[e(j,{height:22,width:22}),e(d,Object.assign({color:g,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(c,Object.assign({color:u.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var i,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:S.media.length?R.length?e(t,{}):a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${u.background.inverse}`,borderRadius:"50%"}},{children:e(O,{color:u.content.primaryInverse})})),a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e(p,{children:"No results found"}),e(d,{children:"Sorry we could not find any results for the selected filter"})]})),e("div",Object.assign({onClick:()=>{M(!0)}},{children:e(m,Object.assign({color:`${u.content.brand}`},{children:"Clear Filter"}))}))]})):e(C,{states:T.WARNING,heading:`No ${S.mediaType}s on your account`,subline:`There seems to be no ${S.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})};export{S as DateKeys,x as MEDIA_TYPES,B as PostPicker,k as dateOptions};
1
+ import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import{useState as i,useEffect as n}from"react";import{StyledProductGrid as o,StyledProduct as s}from"./PostPicker.styled.js";import{Tag as r}from"../tag/Tag.js";import{ButtonRegular as l,BodyPrimary as d,BodyCaption as c,TitleMedium as p,ButtonLarge as m,BodySecondary as h}from"../TypographyStyle.js";import{unCamelCase as y}from"../../utils/unCamelCase.js";import{PRIMARY as g}from"../../constants/colors.js";import{COLORS as u}from"../../constants/Theme.js";import j from"../../assets/icons/instagram.svg.js";import w from"../../assets/icons/warning.svg.js";import{StyledModal as f}from"../modals/styledModal.js";import{BikShimmer as v}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as b}from"../shimmer-image/ShimmerImage.js";import{StateComponent as C,StateInterface as T}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";import"../tooltips/Tooltip.js";import"../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as D}from"../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../../utils/DateUtils.js";import"../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import{SearchIcon as O}from"../../assets/icons/searchIcon.js";var x,S;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(x||(x={})),function(e){e.Today="Today",e["7_Days"]="7",e["30_Days"]="30",e.custom="custom",e.Yesterday="Yesterday"}(S||(S={}));const k=[{label:"Today",value:"today",key:S.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:S["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:S["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:S.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}],B=S=>{var B,P;const[I,_]=i(null!==(B=S.previouslySelected)&&void 0!==B?B:[]),[L,V]=i(""),[G,N]=i(!1),[R,$]=i(S.media),[A,M]=i(!1),[E,U]=i(!1);n((()=>{S.media.length||(N(!0),setTimeout((()=>{N(!1)}),2e3)),_(S.selected||[])}),[]),n((()=>{S.media.length>0&&($(S.media),N(!1))}),[null===(P=null==S?void 0:S.media)||void 0===P?void 0:P.length]),n((()=>{I.length>0&&V("")}),[I.length]),n((()=>{A&&($(S.media),U(!1))}),[A]);return e(t,{children:a(f,Object.assign({zIndex:201,open:S.showModal,headingTitle:S.title,onClose:S.onClose,centralContainerStyles:{width:1071,height:S.showFilter?612:564},primaryButton:{disabled:!R.length,buttonType:"primary",buttonText:`Select ${y(S.mediaType)}`,onClick:()=>{I.length?S.onSelect(I):V(`Please select a ${S.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>S.onClose()},footerLeftCustomElement:L?e(r,{tagText:L,type:"negative",LeadingIcon:w}):I.length?a(h,{children:[I.length," selected"]}):null},{children:[S.showFilter&&a("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e(D,{options:k,placeholder:"posted on",resetDropdown:A,onOptionSelected:e=>{var t,a;let i=null,n=null;"Custom range"===e.label?(i=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,n=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(i=e.typeValue[0],n=e.typeValue[1]);const o=S.media.filter((e=>function(e,t,a){const i=new Date(e),n=new Date(t),o=new Date(a);return i>=n&&i<=o}(e.timestamp,i,n)));$(o),U(!0),M(!1)}}),E&&e(l,Object.assign({color:u.content.secondary,onClick:()=>M(!0)},{children:"Clear"}))]})),G?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(v,{boxes:[{width:(S.mediaType==x.POST?148:104)+"px",height:(S.mediaType==x.POST?148:172)+"px"}]})})):e(t,{children:R&&R.length?e(o,Object.assign({mediaType:S.mediaType},{children:R.map((t=>{return a(s,Object.assign({mediaType:S.mediaType,className:""+(i=t,n=I,n.some((e=>e.id===i.id))?"selected":""),onClick:()=>{return e=t,void _((()=>I.find((t=>t.id===e.id))?I.filter((t=>t.id!==e.id)):!S.limit||I.length<S.limit?[...I,e]:(V(`Only ${S.limit} ${S.mediaType}s can be selected`),I)));var e}},{children:[e(b,{imageUrl:t.imageUrl,width:S.mediaType==x.POST?148:104,height:S.mediaType==x.POST?148:172,alt:t.overlayCaption}),a("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:a("div",Object.assign({className:"overlay__redirection"},{children:[e(j,{height:22,width:22}),e(d,Object.assign({color:g,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(c,Object.assign({color:u.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var i,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:S.media.length?R.length?e(t,{}):a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${u.background.inverse}`,borderRadius:"50%"}},{children:e(O,{color:u.content.primaryInverse})})),a("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e(p,{children:"No results found"}),e(d,{children:"Sorry we could not find any results for the selected filter"})]})),e("div",Object.assign({onClick:()=>{M(!0)}},{children:e(m,Object.assign({color:`${u.content.brand}`},{children:"Clear Filter"}))}))]})):e(C,{states:T.WARNING,heading:`No ${S.mediaType}s on your account`,subline:`There seems to be no ${S.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))})};export{S as DateKeys,x as MEDIA_TYPES,B as PostPicker,k as dateOptions};
@@ -18,4 +18,5 @@ export default class DateUtils {
18
18
  static getPastDate: (dt: Date, daysToSubtract: number) => Date;
19
19
  static timeFormatValidation12H: (time: string) => boolean;
20
20
  static convert12HourTimeTo24Hour: (time12h: any) => string;
21
+ static getAnalyticsCustomDateTimelineText: (customRange: Array<Date>) => string;
21
22
  }
@@ -1 +1 @@
1
- import{format as e,isToday as t,isYesterday as a,subDays as r}from"date-fns";class n{}Object.defineProperty(n,"formatDateInDDMMMYYY",{enumerable:!0,configurable:!0,writable:!0,value:t=>{const a=new Date(t);return e(a,"dd MMM yyy")}}),Object.defineProperty(n,"getStringFromDate",{enumerable:!0,configurable:!0,writable:!0,value:function(t){if(!t)return"";switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD"){case"YYYY-MM-DD":{const e=t.getMonth()+1>=10?`${t.getMonth()+1}`:`0${t.getMonth()+1}`,a=t.getDate()>=10?`${t.getDate()}`:`0${t.getDate()}`;return`${t.getFullYear()}-${e}-${a}`}case"dd-MM-yyyy":return e(new Date(t),"dd-MM-yyyy");case"dd MMM yyyy":return e(new Date(t),"dd MMM yyyy");case"dd/MM/yyyy":return e(new Date(t),"dd/MM/yyyy");default:return" "}}}),Object.defineProperty(n,"getTodayStringifyDate",{enumerable:!0,configurable:!0,writable:!0,value:()=>n.getStringFromDate(new Date)}),Object.defineProperty(n,"getDaysBefore",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)}}),Object.defineProperty(n,"nth",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}}),Object.defineProperty(n,"timeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>e>23||t>59?"Not Valid":e-12>=0?((e=e>12?e-12:e)>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"pm":0==e?"12:"+("0"+t).slice(-2)+"am":(e>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"am"}),Object.defineProperty(n,"dateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r)=>{try{const n=a?" "+a+" ":", ";return e(t,r?"do MMMM yyyy":"do MMM yyyy")+n+e(t,"h:mmaaa")}catch(t){const n=a?" "+a+" ":", ";return e(new Date,r?"do MMMM yyyy":"do MMM yyyy")+n+e(new Date,"h:mmaaa")}}}),Object.defineProperty(n,"toDateFromSecs",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date(1970,0,1);return t.setSeconds(e),t}}),Object.defineProperty(n,"todayDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:r=>t(r)?`Today at ${e(r,"hh:mmaaa")}`:a(r)?`Yesterday at ${e(r,"hh:mmaaa")}`:`${e(r,"d MMM yyyy")} at ${e(r,"hh:mmaaa")}`}),Object.defineProperty(n,"timeString12hr",{enumerable:!0,configurable:!0,writable:!0,value:e=>new Date("1970-01-01T"+e+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})}),Object.defineProperty(n,"customisedDateTimeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n,o)=>{try{const l=a?" "+a+" ":", ";let y="";return y=o?e(t,n||"h:mmaaa")+l+e(t,r||"do MMM yyyy"):e(t,r||"do MMM yyyy")+l+e(t,n||"h:mmaaa"),y}catch(t){console.warn(t.message);const l=a?" "+a+" ":", ";return o?e(new Date,n||"h:mmaaa")+l+e(new Date,r||"do MMM yyyy"):e(new Date,r||"do MMM yyyy")+l+e(new Date,n||"h:mmaaa")}}}),Object.defineProperty(n,"formatDateTime",{enumerable:!0,configurable:!0,writable:!0,value:e=>("pm"===e.slice(5,7)?(parseInt(e.slice(0,2))+12).toString():e.slice(0,2))+":"+e.slice(3,5)+":00"}),Object.defineProperty(n,"timeDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n)=>{try{const o=a?" "+a+" ":", ";return e(t,r||"h:mmaaa")+o+e(t,n||"do MMM yyyy")}catch(t){const o=a?" "+a+" ":", ";return e(new Date,r||"h:mmaaa")+o+e(new Date,n||"do MMM yyyy")}}}),Object.defineProperty(n,"timeToAMPM",{enumerable:!0,configurable:!0,writable:!0,value:e=>((e=e.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[e]).length>1&&((e=e.slice(1))[5]=+e[0]<12?"AM":"PM",e[0]=+e[0]%12||12),e=e[0]+e[1]+e[2]+" "+e[5])}),Object.defineProperty(n,"timeFormatValidation",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[1-9]|1[012]):[0-5][0-9]\s[AP]{1}[M]{1}$/).test(e)}),Object.defineProperty(n,"onlyDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e(t,a||"dd MMM yyyy")}),Object.defineProperty(n,"getPastDate",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>r(e,t)}),Object.defineProperty(n,"timeFormatValidation12H",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[0-9]|1[0-2]):[0-5][0-9]$/).test(e)}),Object.defineProperty(n,"convert12HourTimeTo24Hour",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const[t,a]=e.split(" ");let[r,n]=t.split(":");return"12"===r&&(r="00"),"PM"===a&&(r=parseInt(r,10)+12),`${1===r.length?"0"+r:r}:${n}`}});export{n as default};
1
+ import{format as e,isToday as t,isYesterday as a,subDays as r}from"date-fns";class n{}Object.defineProperty(n,"formatDateInDDMMMYYY",{enumerable:!0,configurable:!0,writable:!0,value:t=>{const a=new Date(t);return e(a,"dd MMM yyy")}}),Object.defineProperty(n,"getStringFromDate",{enumerable:!0,configurable:!0,writable:!0,value:function(t){if(!t)return"";switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"YYYY-MM-DD"){case"YYYY-MM-DD":{const e=t.getMonth()+1>=10?`${t.getMonth()+1}`:`0${t.getMonth()+1}`,a=t.getDate()>=10?`${t.getDate()}`:`0${t.getDate()}`;return`${t.getFullYear()}-${e}-${a}`}case"dd-MM-yyyy":return e(new Date(t),"dd-MM-yyyy");case"dd MMM yyyy":return e(new Date(t),"dd MMM yyyy");case"dd/MM/yyyy":return e(new Date(t),"dd/MM/yyyy");default:return" "}}}),Object.defineProperty(n,"getTodayStringifyDate",{enumerable:!0,configurable:!0,writable:!0,value:()=>n.getStringFromDate(new Date)}),Object.defineProperty(n,"getDaysBefore",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)}}),Object.defineProperty(n,"nth",{enumerable:!0,configurable:!0,writable:!0,value:function(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}}),Object.defineProperty(n,"timeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>e>23||t>59?"Not Valid":e-12>=0?((e=e>12?e-12:e)>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"pm":0==e?"12:"+("0"+t).slice(-2)+"am":(e>=10?e:"0"+e)+":"+("0"+t).slice(-2)+"am"}),Object.defineProperty(n,"dateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r)=>{try{const n=a?" "+a+" ":", ";return e(t,r?"do MMMM yyyy":"do MMM yyyy")+n+e(t,"h:mmaaa")}catch(t){const n=a?" "+a+" ":", ";return e(new Date,r?"do MMMM yyyy":"do MMM yyyy")+n+e(new Date,"h:mmaaa")}}}),Object.defineProperty(n,"toDateFromSecs",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const t=new Date(1970,0,1);return t.setSeconds(e),t}}),Object.defineProperty(n,"todayDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:r=>t(r)?`Today at ${e(r,"hh:mmaaa")}`:a(r)?`Yesterday at ${e(r,"hh:mmaaa")}`:`${e(r,"d MMM yyyy")} at ${e(r,"hh:mmaaa")}`}),Object.defineProperty(n,"timeString12hr",{enumerable:!0,configurable:!0,writable:!0,value:e=>new Date("1970-01-01T"+e+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})}),Object.defineProperty(n,"customisedDateTimeFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n,i)=>{try{const o=a?" "+a+" ":", ";let l="";return l=i?e(t,n||"h:mmaaa")+o+e(t,r||"do MMM yyyy"):e(t,r||"do MMM yyyy")+o+e(t,n||"h:mmaaa"),l}catch(t){console.warn(t.message);const o=a?" "+a+" ":", ";return i?e(new Date,n||"h:mmaaa")+o+e(new Date,r||"do MMM yyyy"):e(new Date,r||"do MMM yyyy")+o+e(new Date,n||"h:mmaaa")}}}),Object.defineProperty(n,"formatDateTime",{enumerable:!0,configurable:!0,writable:!0,value:e=>("pm"===e.slice(5,7)?(parseInt(e.slice(0,2))+12).toString():e.slice(0,2))+":"+e.slice(3,5)+":00"}),Object.defineProperty(n,"timeDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a,r,n)=>{try{const i=a?" "+a+" ":", ";return e(t,r||"h:mmaaa")+i+e(t,n||"do MMM yyyy")}catch(t){const i=a?" "+a+" ":", ";return e(new Date,r||"h:mmaaa")+i+e(new Date,n||"do MMM yyyy")}}}),Object.defineProperty(n,"timeToAMPM",{enumerable:!0,configurable:!0,writable:!0,value:e=>((e=e.toString().match(/^([01]\d|2[0-3])(:)([0-5]\d)(:[0-5]\d)?$/)||[e]).length>1&&((e=e.slice(1))[5]=+e[0]<12?"AM":"PM",e[0]=+e[0]%12||12),e=e[0]+e[1]+e[2]+" "+e[5])}),Object.defineProperty(n,"timeFormatValidation",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[1-9]|1[012]):[0-5][0-9]\s[AP]{1}[M]{1}$/).test(e)}),Object.defineProperty(n,"onlyDateFormat",{enumerable:!0,configurable:!0,writable:!0,value:(t,a)=>e(t,a||"dd MMM yyyy")}),Object.defineProperty(n,"getPastDate",{enumerable:!0,configurable:!0,writable:!0,value:(e,t)=>r(e,t)}),Object.defineProperty(n,"timeFormatValidation12H",{enumerable:!0,configurable:!0,writable:!0,value:e=>new RegExp(/^(0?[0-9]|1[0-2]):[0-5][0-9]$/).test(e)}),Object.defineProperty(n,"convert12HourTimeTo24Hour",{enumerable:!0,configurable:!0,writable:!0,value:e=>{const[t,a]=e.split(" ");let[r,n]=t.split(":");return"12"===r&&(r="00"),"PM"===a&&(r=parseInt(r,10)+12),`${1===r.length?"0"+r:r}:${n}`}}),Object.defineProperty(n,"getAnalyticsCustomDateTimelineText",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!(e&&Array.isArray(e)&&(null==e?void 0:e[0])&&(null==e?void 0:e[1])))return"";const t=new Date("string"==typeof e[0]?new Date(e[0]).getTime():e[0].getTime()),a=new Date("string"==typeof e[1]?new Date(e[1]).getTime():e[1].getTime()),r=864e5,n=Math.floor((a.getTime()-t.getTime())/r),i=new Date(t.getTime()-864e5),o=`${i.toLocaleString("default",{month:"short"})} ${i.getDate()}`,l=new Date(i.getTime()-n*r);return`vs ${`${l.toLocaleString("default",{month:"short"})} ${l.getDate()}`} - ${o}`}});export{n as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.457",
3
+ "version": "0.0.458",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.getFormattedMonthDate=function(e){if("string"==typeof e)return e;const r=t[e.getMonth()],n=e.getDate();return`${r} ${n<10?"0":""}${n}`};
@@ -1 +0,0 @@
1
- const t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function e(e){if("string"==typeof e)return e;const n=t[e.getMonth()],r=e.getDate();return`${n} ${r<10?"0":""}${r}`}export{e as getFormattedMonthDate};