{"version":3,"sources":["node_modules/dayjs/plugin/advancedFormat.js","node_modules/dayjs/plugin/duration.js","apps/business-center-client/src/app/shared/time-range-shared.ts","apps/business-center-client/src/app/shared/time-range.service.ts"],"sourcesContent":["!function (e, t) {\n \"object\" == typeof exports && \"undefined\" != typeof module ? module.exports = t() : \"function\" == typeof define && define.amd ? define(t) : (e = \"undefined\" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();\n}(this, function () {\n \"use strict\";\n\n return function (e, t) {\n var r = t.prototype,\n n = r.format;\n r.format = function (e) {\n var t = this,\n r = this.$locale();\n if (!this.isValid()) return n.bind(this)(e);\n var s = this.$utils(),\n a = (e || \"YYYY-MM-DDTHH:mm:ssZ\").replace(/\\[([^\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function (e) {\n switch (e) {\n case \"Q\":\n return Math.ceil((t.$M + 1) / 3);\n case \"Do\":\n return r.ordinal(t.$D);\n case \"gggg\":\n return t.weekYear();\n case \"GGGG\":\n return t.isoWeekYear();\n case \"wo\":\n return r.ordinal(t.week(), \"W\");\n case \"w\":\n case \"ww\":\n return s.s(t.week(), \"w\" === e ? 1 : 2, \"0\");\n case \"W\":\n case \"WW\":\n return s.s(t.isoWeek(), \"W\" === e ? 1 : 2, \"0\");\n case \"k\":\n case \"kk\":\n return s.s(String(0 === t.$H ? 24 : t.$H), \"k\" === e ? 1 : 2, \"0\");\n case \"X\":\n return Math.floor(t.$d.getTime() / 1e3);\n case \"x\":\n return t.$d.getTime();\n case \"z\":\n return \"[\" + t.offsetName() + \"]\";\n case \"zzz\":\n return \"[\" + t.offsetName(\"long\") + \"]\";\n default:\n return e;\n }\n });\n return n.bind(this)(a);\n };\n };\n});","!function (t, s) {\n \"object\" == typeof exports && \"undefined\" != typeof module ? module.exports = s() : \"function\" == typeof define && define.amd ? define(s) : (t = \"undefined\" != typeof globalThis ? globalThis : t || self).dayjs_plugin_duration = s();\n}(this, function () {\n \"use strict\";\n\n var t,\n s,\n n = 1e3,\n i = 6e4,\n e = 36e5,\n r = 864e5,\n o = /\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,\n u = 31536e6,\n d = 2628e6,\n a = /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,\n h = {\n years: u,\n months: d,\n days: r,\n hours: e,\n minutes: i,\n seconds: n,\n milliseconds: 1,\n weeks: 6048e5\n },\n c = function (t) {\n return t instanceof g;\n },\n f = function (t, s, n) {\n return new g(t, n, s.$l);\n },\n m = function (t) {\n return s.p(t) + \"s\";\n },\n l = function (t) {\n return t < 0;\n },\n $ = function (t) {\n return l(t) ? Math.ceil(t) : Math.floor(t);\n },\n y = function (t) {\n return Math.abs(t);\n },\n v = function (t, s) {\n return t ? l(t) ? {\n negative: !0,\n format: \"\" + y(t) + s\n } : {\n negative: !1,\n format: \"\" + t + s\n } : {\n negative: !1,\n format: \"\"\n };\n },\n g = function () {\n function l(t, s, n) {\n var i = this;\n if (this.$d = {}, this.$l = n, void 0 === t && (this.$ms = 0, this.parseFromMilliseconds()), s) return f(t * h[m(s)], this);\n if (\"number\" == typeof t) return this.$ms = t, this.parseFromMilliseconds(), this;\n if (\"object\" == typeof t) return Object.keys(t).forEach(function (s) {\n i.$d[m(s)] = t[s];\n }), this.calMilliseconds(), this;\n if (\"string\" == typeof t) {\n var e = t.match(a);\n if (e) {\n var r = e.slice(2).map(function (t) {\n return null != t ? Number(t) : 0;\n });\n return this.$d.years = r[0], this.$d.months = r[1], this.$d.weeks = r[2], this.$d.days = r[3], this.$d.hours = r[4], this.$d.minutes = r[5], this.$d.seconds = r[6], this.calMilliseconds(), this;\n }\n }\n return this;\n }\n var y = l.prototype;\n return y.calMilliseconds = function () {\n var t = this;\n this.$ms = Object.keys(this.$d).reduce(function (s, n) {\n return s + (t.$d[n] || 0) * h[n];\n }, 0);\n }, y.parseFromMilliseconds = function () {\n var t = this.$ms;\n this.$d.years = $(t / u), t %= u, this.$d.months = $(t / d), t %= d, this.$d.days = $(t / r), t %= r, this.$d.hours = $(t / e), t %= e, this.$d.minutes = $(t / i), t %= i, this.$d.seconds = $(t / n), t %= n, this.$d.milliseconds = t;\n }, y.toISOString = function () {\n var t = v(this.$d.years, \"Y\"),\n s = v(this.$d.months, \"M\"),\n n = +this.$d.days || 0;\n this.$d.weeks && (n += 7 * this.$d.weeks);\n var i = v(n, \"D\"),\n e = v(this.$d.hours, \"H\"),\n r = v(this.$d.minutes, \"M\"),\n o = this.$d.seconds || 0;\n this.$d.milliseconds && (o += this.$d.milliseconds / 1e3, o = Math.round(1e3 * o) / 1e3);\n var u = v(o, \"S\"),\n d = t.negative || s.negative || i.negative || e.negative || r.negative || u.negative,\n a = e.format || r.format || u.format ? \"T\" : \"\",\n h = (d ? \"-\" : \"\") + \"P\" + t.format + s.format + i.format + a + e.format + r.format + u.format;\n return \"P\" === h || \"-P\" === h ? \"P0D\" : h;\n }, y.toJSON = function () {\n return this.toISOString();\n }, y.format = function (t) {\n var n = t || \"YYYY-MM-DDTHH:mm:ss\",\n i = {\n Y: this.$d.years,\n YY: s.s(this.$d.years, 2, \"0\"),\n YYYY: s.s(this.$d.years, 4, \"0\"),\n M: this.$d.months,\n MM: s.s(this.$d.months, 2, \"0\"),\n D: this.$d.days,\n DD: s.s(this.$d.days, 2, \"0\"),\n H: this.$d.hours,\n HH: s.s(this.$d.hours, 2, \"0\"),\n m: this.$d.minutes,\n mm: s.s(this.$d.minutes, 2, \"0\"),\n s: this.$d.seconds,\n ss: s.s(this.$d.seconds, 2, \"0\"),\n SSS: s.s(this.$d.milliseconds, 3, \"0\")\n };\n return n.replace(o, function (t, s) {\n return s || String(i[t]);\n });\n }, y.as = function (t) {\n return this.$ms / h[m(t)];\n }, y.get = function (t) {\n var s = this.$ms,\n n = m(t);\n return \"milliseconds\" === n ? s %= 1e3 : s = \"weeks\" === n ? $(s / h[n]) : this.$d[n], s || 0;\n }, y.add = function (t, s, n) {\n var i;\n return i = s ? t * h[m(s)] : c(t) ? t.$ms : f(t, this).$ms, f(this.$ms + i * (n ? -1 : 1), this);\n }, y.subtract = function (t, s) {\n return this.add(t, s, !0);\n }, y.locale = function (t) {\n var s = this.clone();\n return s.$l = t, s;\n }, y.clone = function () {\n return f(this.$ms, this);\n }, y.humanize = function (s) {\n return t().add(this.$ms, \"ms\").locale(this.$l).fromNow(!s);\n }, y.valueOf = function () {\n return this.asMilliseconds();\n }, y.milliseconds = function () {\n return this.get(\"milliseconds\");\n }, y.asMilliseconds = function () {\n return this.as(\"milliseconds\");\n }, y.seconds = function () {\n return this.get(\"seconds\");\n }, y.asSeconds = function () {\n return this.as(\"seconds\");\n }, y.minutes = function () {\n return this.get(\"minutes\");\n }, y.asMinutes = function () {\n return this.as(\"minutes\");\n }, y.hours = function () {\n return this.get(\"hours\");\n }, y.asHours = function () {\n return this.as(\"hours\");\n }, y.days = function () {\n return this.get(\"days\");\n }, y.asDays = function () {\n return this.as(\"days\");\n }, y.weeks = function () {\n return this.get(\"weeks\");\n }, y.asWeeks = function () {\n return this.as(\"weeks\");\n }, y.months = function () {\n return this.get(\"months\");\n }, y.asMonths = function () {\n return this.as(\"months\");\n }, y.years = function () {\n return this.get(\"years\");\n }, y.asYears = function () {\n return this.as(\"years\");\n }, l;\n }(),\n p = function (t, s, n) {\n return t.add(s.years() * n, \"y\").add(s.months() * n, \"M\").add(s.days() * n, \"d\").add(s.hours() * n, \"h\").add(s.minutes() * n, \"m\").add(s.seconds() * n, \"s\").add(s.milliseconds() * n, \"ms\");\n };\n return function (n, i, e) {\n t = e, s = e().$utils(), e.duration = function (t, s) {\n var n = e.locale();\n return f(t, {\n $l: n\n }, s);\n }, e.isDuration = c;\n var r = i.prototype.add,\n o = i.prototype.subtract;\n i.prototype.add = function (t, s) {\n return c(t) ? p(this, t, 1) : r.bind(this)(t, s);\n }, i.prototype.subtract = function (t, s) {\n return c(t) ? p(this, t, -1) : o.bind(this)(t, s);\n };\n };\n});","import { AlignmentPeriodCalendar } from '@vendasta/multi-location-analytics';\nimport { calculateStartDate, DateDuration } from '@vendasta/galaxy/utility/date-utils';\nimport dayjs from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport Duration from 'dayjs/plugin/duration';\n\ndayjs.extend(Duration);\ndayjs.extend(utc);\n\nexport type FormattingOptions = 'month-long' | 'month' | 'week' | 'week-long' | 'day' | 'none';\n\nexport const granularityThresholdForNumberOfDays = 89;\n\n// Granularity is an enumeration of the ways time data may be bucketed by\nexport enum Granularity {\n Month = 'month',\n Week = 'week', // Weeks beginning on Monday\n Day = 'day',\n // More units are available -- these line up with use by dayjs-range and SQL\n}\n\n// Granularity days for marketing funnel metrics\nexport const granularityFunnelMetricsWeekly = 89;\nexport const granularityFunnelMetricsMonthly = 183;\n\n// Takes a preset time range and returns the date boundaries intended for display to user.\nexport function getDateBoundaries(timeRange: string): [dayjs.Dayjs, dayjs.Dayjs] {\n const endMoment = dayjs().startOf('day');\n let startMoment: dayjs.Dayjs;\n const dayOffsetMap = {\n '7days': {\n val: 7,\n type: 'days',\n },\n '30days': {\n val: 30,\n type: 'days',\n },\n '90days': {\n val: 90,\n type: 'days',\n },\n '6months': {\n val: 6,\n type: 'months',\n },\n '12months': {\n val: 12,\n type: 'months',\n },\n };\n // A single day's stats would read the same start end\n if (dayOffsetMap[timeRange].type === 'months') {\n /* For 6 months and 12 months, the date should start with 1 day late for included day */\n const calculatedStart = calculateStartDate(endMoment.toDate(), dayOffsetMap[timeRange].val, DateDuration.months);\n startMoment = dayjs(calculatedStart.setDate(calculatedStart.getDate() + 1));\n } else {\n startMoment = dayjs(calculateStartDate(endMoment.toDate(), dayOffsetMap[timeRange].val - 1, DateDuration.days));\n }\n return [startMoment, endMoment];\n}\n\n// alignUTCDateToLocal is a helper intended to make UTC dates aligned to month/week/day starts to a local date\n// with such an alignment. *This shifts the dayjs in time*, but makes display easier.\nexport function alignUTCDateToLocal(now: Date): Date {\n return new Date(\n now.getUTCFullYear(),\n now.getUTCMonth(),\n now.getUTCDate(),\n now.getUTCHours(),\n now.getUTCMinutes(),\n now.getUTCSeconds(),\n );\n}\n\n// alignLocalDateToUTC is a helper intended to make local dates aligned to month/week/day starts to a UTC date\n// with such an alignment. *This shifts the dayjs in time*,\n// but masks the inability for us to answer timezone specific queries at the dayjs.\nexport function alignLocalDateToUTC(now: Date): Date {\n if (!now) {\n return now;\n }\n return new Date(\n Date.UTC(\n now.getUTCFullYear(),\n now.getUTCMonth(),\n now.getUTCDate(),\n now.getUTCHours(),\n now.getUTCMinutes(),\n now.getUTCSeconds(),\n ),\n );\n}\n\n// Aligns the date passed in to the end of the day (11:59:59 PM)\nexport function alignToEndOfDay(date: Date): Date {\n return dayjs(date).endOf('day').toDate();\n}\n\n// Aligns the date passed in to the start of the day (00:00:00 AM)\nexport function alignToStartOfDay(date: Date): Date {\n return dayjs(date).startOf('day').toDate();\n}\n\n// Aligns the dates passed in to the start and end respectively\nexport function alignStartAndEndDates(startDate: Date, endDate: Date): [Date, Date] {\n return [alignToStartOfDay(startDate), alignToEndOfDay(endDate)];\n}\n\n// Generates Dates with by iterating through range by units\nexport function generateDates(start: Date, end: Date, granularity: Granularity): Date[] {\n const range = [];\n const startDate = new Date(start);\n const endDate = new Date(end);\n switch (granularity) {\n case Granularity.Day: {\n startDate.setDate(startDate.getDate());\n break;\n }\n case Granularity.Week: {\n startDate.setDate(startDate.getDate() - startDate.getDay() + 1);\n endDate.setDate(endDate.getDate() - endDate.getDay() + 1);\n break;\n }\n case Granularity.Month: {\n startDate.setDate(1);\n break;\n }\n }\n const date = new Date(startDate);\n while (date <= endDate) {\n range.push(new Date(date));\n switch (granularity) {\n case Granularity.Day: {\n date.setDate(date.getDate() + 1);\n break;\n }\n case Granularity.Week: {\n date.setDate(date.getDate() + 7);\n break;\n }\n case Granularity.Month: {\n date.setMonth(date.getMonth() + 1);\n break;\n }\n default: {\n console.warn(`granularity default case encountered: ${granularity}`);\n date.setDate(date.getDate() + 1);\n return;\n }\n }\n }\n return range;\n}\n\n// getGranularityForRange matches the granularity algorithm in multiloc analytics\nexport function getGranularityForRange(start: Date, end: Date): Granularity {\n const numMonths = dayjs(end).diff(dayjs(start), 'months');\n if (numMonths >= 8) {\n return Granularity.Month;\n } else if (numMonths >= 2) {\n return Granularity.Week;\n } else {\n return Granularity.Day;\n }\n}\n\n// getUTCDate gets the UTC date\nexport function getUTCDate(date: Date): Date {\n return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n}\n\n// getAlignmentPeriodForRange chooses an alignment period to get a reasonable amount of rows assuming there is data throughout the period\nexport function getAlignmentPeriodForRange(start: Date, end: Date): AlignmentPeriodCalendar {\n return getAlignmentPeriodForMomentRange(dayjs(start), dayjs(end));\n}\n\n// getPreviousPeriod returns the previous period date range given a date range and the time range option\nexport function getPreviousPeriod(startDate: Date, endDate: Date, isMonthlyReport: boolean): [Date, Date] {\n let prevRange: [dayjs.Dayjs, dayjs.Dayjs];\n if (isMonthlyReport) {\n prevRange = previousMonthMoment([dayjs.utc(startDate), dayjs.utc(endDate)]);\n } else {\n prevRange = previousPeriodMoment([dayjs.utc(startDate), dayjs.utc(endDate)]);\n }\n return [prevRange[0].toDate(), prevRange[1].toDate()];\n}\n\n// getAlignmentPeriodForMomentRange chooses an alignment period to get a reasonable amount of rows\n// assuming there is data throughout the period\nexport function getAlignmentPeriodForMomentRange(start: dayjs.Dayjs, end: dayjs.Dayjs): AlignmentPeriodCalendar {\n const numMonths = end.diff(start, 'months');\n if (numMonths >= 8) {\n return AlignmentPeriodCalendar.CALENDAR_MONTH;\n } else if (numMonths >= 2) {\n return AlignmentPeriodCalendar.CALENDAR_WEEK;\n } else {\n return AlignmentPeriodCalendar.CALENDAR_DAY;\n }\n}\n\n// getFormattingOption determines the alignment period and then maps that to a formatting key for charts\nconst formatMap = {};\nformatMap[AlignmentPeriodCalendar.CALENDAR_DAY] = 'day';\nformatMap[AlignmentPeriodCalendar.CALENDAR_WEEK] = 'week';\nformatMap[AlignmentPeriodCalendar.CALENDAR_MONTH] = 'month';\n\nexport function getFormattingOption(start: Date, end: Date): FormattingOptions {\n const alignment = getAlignmentPeriodForRange(start, end);\n return formatMap[alignment] || 'day';\n}\n\n// timeRangeText returns the representation of a time range defined by start end boundaries\nexport function timeRangeText(dStr: string | Date, d2Str: string | Date, g: Granularity): string {\n // Periods starting on dates\n const d = dayjs.utc(dStr);\n const d2 = dayjs.utc(d2Str);\n // Find template to represent period using start date\n let t: string;\n if (g === Granularity.Day) {\n if (d.year() !== d2.year()) {\n t = 'MMM D, YYYY';\n } else {\n t = 'MMM D';\n }\n\n const thisDay = d.format(t);\n const otherDay = d2.format(t);\n\n return `${thisDay} vs ${otherDay}`;\n } else if (g === Granularity.Week) {\n if (d.year() !== d2.year()) {\n t = 'MMM D, YYYY';\n } else {\n t = 'MMM D';\n }\n\n const thisWeek = d.format(t);\n const otherWeek = d2.format(t);\n\n return `Weeks of ${thisWeek} vs ${otherWeek}`;\n } else if (g === Granularity.Month) {\n t = 'MMM YYYY';\n const thisMonth = d.format(t);\n const otherMonth = d2.format(t);\n\n return `${thisMonth} vs ${otherMonth}`;\n }\n}\n\n// Returns the previous period date range given a date range and the time range option\nexport function previousPeriod(dr: [Date, Date]): [Date, Date] {\n // Find the duration in days between end and start\n const s = dayjs(dr[0]);\n const e = dayjs(dr[1]);\n const diff = e.diff(s, 'days', true);\n // Offset both dates by that many days\n const sDate = dayjs(s).subtract(diff, 'day').toDate();\n const eDate = dayjs(e).subtract(diff, 'day').toDate();\n return [sDate, eDate];\n}\n\n// Returns the previous period date range given a date range and the time range option\n// Uses dayjs inputs to avoid assuming timezones\nexport function previousPeriodMoment(dr: [dayjs.Dayjs, dayjs.Dayjs]): [dayjs.Dayjs, dayjs.Dayjs] {\n // Find the duration in days between end and start\n const s = dr[0];\n const e = dr[1];\n\n const diff = e.diff(s, 'days', true);\n const sOut = s.clone().subtract(diff, 'day');\n const eOut = e.clone().subtract(diff, 'day');\n return [sOut, eOut];\n}\n\n// Converts the passed in date to the previous version of the month.\nexport function previousMonthMoment(dr: [dayjs.Dayjs, dayjs.Dayjs]): [dayjs.Dayjs, dayjs.Dayjs] {\n const middleDate = dr[0].utc().date(15).subtract(1, 'month');\n const start = middleDate.utc().startOf('month');\n const end = middleDate.utc().endOf('month');\n\n return [start, end];\n}\n\n// GMB data is 5 days delay, if last 5 days included in selected date range,\n// then return 5 days offsets.\nexport function GMBPeriodMoment(endDate: dayjs.Dayjs): dayjs.Dayjs {\n const e = endDate;\n if (e >= dayjs.utc(dayjs().format('YYYY-MM-DD'))) {\n return dayjs.utc(e.clone()).subtract(5, 'days');\n }\n return e;\n}\n\n// GBPKeywordPreviousPeriodMoment returns the previous period date range given a date range and the time range option\n// and sets the start date to the first day of the month\nexport function GBPKeywordPreviousPeriodMoment(dr: [dayjs.Dayjs, dayjs.Dayjs]): [dayjs.Dayjs, dayjs.Dayjs] {\n // Find the duration in days between end and start\n const s = dr[0];\n const e = dr[1];\n if (\n s.utc().month() === e.utc().month() &&\n s.utc().date() === e.utc().startOf('month').date() &&\n e.utc().date() === e.utc().endOf('month').date() &&\n s.utc().year() === e.utc().year()\n ) {\n // Need to do this weird month subtraction because dayjs doesn't consider the days\n // correctly when you subtract a day/month. e.g.\n // dayjs.utc('2021-07-31').subtract(1, 'month') will return May 31st.\n // Since there's no 31st in June, it will try to find the next valid date, which is May 31st.\n const prevMonth = s.utc().get('month') > 0 ? s.utc().get('month') - 1 : 11;\n const sOut = s.clone().utc().subtract(1, 'month').month(prevMonth);\n const eOut = e.clone().utc().subtract(1, 'month').month(prevMonth);\n\n return [sOut.startOf('month'), eOut.endOf('month')];\n }\n\n const [pSOut, pEOut] = previousPeriodMoment(dr);\n\n return [pSOut.utc().startOf('month'), pEOut];\n}\n","import { inject, Injectable } from '@angular/core';\nimport { DateRangePresetPeriod } from '@vendasta/galaxy/datepicker';\nimport dayjs from 'dayjs';\nimport advancedFormat from 'dayjs/plugin/advancedFormat';\nimport LocalizedFormat from 'dayjs/plugin/localizedFormat';\nimport RelativeTime from 'dayjs/plugin/relativeTime';\nimport utc from 'dayjs/plugin/utc';\nimport { BehaviorSubject, catchError, combineLatest, Observable, of } from 'rxjs';\nimport { distinctUntilChanged, filter, map, shareReplay, take } from 'rxjs/operators';\nimport { alignLocalDateToUTC, FormattingOptions, getDateBoundaries, getFormattingOption } from './time-range-shared';\nimport { filterNullAndUndefined } from '@vendasta/rx-utils';\nimport { LocationsService } from '../locations';\nimport { PartnerMarketConfigService } from '../partner-market-config';\nimport { ActivatedRoute, NavigationEnd, Router } from '@angular/router';\n\ndayjs.extend(LocalizedFormat);\ndayjs.extend(advancedFormat);\ndayjs.extend(RelativeTime);\ndayjs.extend(utc);\n\nexport type TimeRangeKey = '7days' | '30days' | '90days' | '6months' | '12months' | 'custom' | 'month' | 'quarter';\n\nexport interface TimeRangeOptionBase {\n key: TimeRangeKey;\n glxyKey: DateRangePresetPeriod;\n name: string;\n i18nName?: string;\n}\n\nexport interface TimeRangeOption extends TimeRangeOptionBase {\n dates?: string;\n dateRange?: [Date, Date];\n}\n\nexport const AvailableTimeRangeOptions = [\n {\n key: '7days',\n glxyKey: DateRangePresetPeriod.lastSevenDays,\n name: 'Last 7 days',\n i18nName: 'COMMON.TIME_PERIOD.LAST_7_DAYS',\n },\n {\n key: '30days',\n glxyKey: DateRangePresetPeriod.lastThirtyDays,\n name: 'Last 30 days',\n i18nName: 'COMMON.TIME_PERIOD.LAST_30_DAYS',\n },\n {\n key: '90days',\n glxyKey: DateRangePresetPeriod.lastNinetyDays,\n name: 'Last 90 days',\n i18nName: 'COMMON.TIME_PERIOD.LAST_90_DAYS',\n },\n {\n key: '6months',\n glxyKey: DateRangePresetPeriod.lastSixMonths,\n name: 'Last 6 months',\n i18nName: 'COMMON.TIME_PERIOD.LAST_6_MONTHS',\n },\n {\n key: '12months',\n glxyKey: DateRangePresetPeriod.lastTwentyMonths,\n name: 'Last 12 months',\n i18nName: 'COMMON.TIME_PERIOD.LAST_12_MONTHS',\n },\n {\n key: 'custom',\n glxyKey: DateRangePresetPeriod.custom,\n name: 'Custom',\n i18nName: 'COMMON.TIME_PERIOD.SEASON',\n },\n {\n key: 'month',\n glxyKey: DateRangePresetPeriod.byMonth,\n name: 'Month',\n i18nName: 'COMMON.TIME_PERIOD.SEASON',\n },\n {\n key: 'quarter',\n glxyKey: DateRangePresetPeriod.byQuarter,\n name: 'Quarter',\n i18nName: 'COMMON.TIME_PERIOD.SEASON',\n },\n] as const satisfies TimeRangeOptionBase[];\n\n// These are the keys that are not time ranges that only take the current date into account\nexport const CUSTOM_TIME_RANGE_KEYS = ['custom', 'month', 'quarter'];\n\n@Injectable({\n providedIn: 'root',\n})\nexport class TimeRangeService {\n private readonly availableTimeRangeOptions$$ = new BehaviorSubject(\n AvailableTimeRangeOptions.map((option: TimeRangeOptionBase): TimeRangeOption => {\n if (CUSTOM_TIME_RANGE_KEYS.includes(option.key)) {\n return { ...option };\n }\n const [startDate, endDate] = getDateBoundaries(option.key);\n const start = startDate.format('MMM Do, YYYY');\n const end = endDate.format('MMM Do, YYYY');\n return {\n ...option,\n dates: `(${start} - ${end})`,\n dateRange: [startDate.toDate(), endDate.toDate()],\n };\n }),\n );\n\n private readonly selectedTimeRangeKey$$ = new BehaviorSubject(null);\n public readonly initialized$ = this.selectedTimeRangeKey$$.pipe(map(Boolean), distinctUntilChanged());\n public readonly selectedTimeRangeOption$: Observable;\n\n public readonly selectedTimeRangeKey$ = this.selectedTimeRangeKey$$.pipe(filterNullAndUndefined());\n public readonly dateRange$: Observable<[Date, Date]>; // these are local aligned calendar concepts (start of day/month in local)\n\n public utcAlignedDateRange$: Observable<[Date, Date]>; // utc aligned version of dateRange$\n public formattingOption$: Observable; // formatting option applicable to UI\n public startDate$: Observable;\n public endDate$: Observable;\n\n locationsService = inject(LocationsService);\n partnerMarketConfigService = inject(PartnerMarketConfigService);\n router = inject(Router);\n activatedRoute = inject(ActivatedRoute);\n\n constructor() {\n this.initializeTimeRange();\n\n this.selectedTimeRangeOption$ = combineLatest([this.availableTimeRangeOptions$$, this.selectedTimeRangeKey$]).pipe(\n map(([options, selectedKey]) => {\n return options.find((timeRange) => timeRange.key === selectedKey);\n }),\n distinctUntilChanged((prev, current) => {\n if (prev === current) return true;\n const keysMatch = prev.key === current.key;\n const startDatesMatch = prev.dateRange[0].getTime() === current.dateRange[0].getTime();\n const endDatesMatch = prev.dateRange[1].getTime() === current.dateRange[1].getTime();\n return keysMatch && startDatesMatch && endDatesMatch;\n }),\n shareReplay({ refCount: false, bufferSize: 1 }),\n );\n\n this.dateRange$ = this.selectedTimeRangeOption$.pipe(\n map((dr) => dr.dateRange),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n this.utcAlignedDateRange$ = this.dateRange$.pipe(\n map(([startDate, endDate]: [Date, Date]): [Date, Date] => {\n return [alignLocalDateToUTC(startDate), alignLocalDateToUTC(endDate)];\n }),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n this.startDate$ = this.dateRange$.pipe(\n map((tr) => tr[0]),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n this.endDate$ = this.dateRange$.pipe(\n map((tr) => tr[1]),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n this.formattingOption$ = this.dateRange$.pipe(\n map((dateRange) => getFormattingOption(dateRange[0], dateRange[1])),\n distinctUntilChanged(),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n public setTimeRange(timeRangeKey: TimeRangeKey): void {\n let opt = this.getTimeRangeByKey(timeRangeKey);\n // very few partner would have passed in tr=\"None\" (string) value and pass all the checks before\n // the if is to handle \"None\" and other similar but unidentified cases\n if (!opt) {\n timeRangeKey = '7days';\n opt = this.getTimeRangeByKey(timeRangeKey);\n }\n if (CUSTOM_TIME_RANGE_KEYS.includes(opt.key)) {\n // Use the custom\n this.setTimeRangeKey(opt.key);\n } else {\n // Derive the range from preset and now\n const [startDayjs, endDayjs] = getDateBoundaries(opt.key);\n // Update the value on the option so that it sets on the way to custom?\n const start = dayjs.utc(startDayjs).startOf('day').toDate();\n const end = dayjs.utc(endDayjs).endOf('day').toDate();\n opt.dateRange = [start, end];\n this.setDateRange(opt.dateRange, opt.key);\n }\n }\n\n public setDateRange(dr: [Date, Date], trKey: TimeRangeKey): void {\n this.updateTimeRangeByKey(trKey, dr);\n this.setTimeRangeKey(trKey);\n }\n\n private setTimeRangeKey(tr: TimeRangeKey) {\n this.selectedTimeRangeKey$$.next(tr);\n }\n\n getDateFilterOptions(key: TimeRangeKey): DateRangePresetPeriod | undefined {\n return AvailableTimeRangeOptions.find((tro) => tro.key === key).glxyKey;\n }\n\n private getTimeRangeByKey(trKey: TimeRangeKey) {\n return this.availableTimeRangeOptions$$.getValue().find((timeRange) => timeRange.key === trKey);\n }\n\n private updateTimeRangeByKey(trKey: TimeRangeKey, dateRange: [Date, Date]) {\n this.availableTimeRangeOptions$$.next(\n this.availableTimeRangeOptions$$.getValue().map((opt) => {\n if (opt.key !== trKey) return opt;\n return {\n ...opt,\n dateRange,\n };\n }),\n );\n }\n\n private initializeTimeRange() {\n const defaultDateRange$ = combineLatest([\n this.locationsService?.isCurrentLocationABrand$,\n this.partnerMarketConfigService.businessAppConfig$,\n ]).pipe(\n map(([brand, config]) => {\n const defaultRangeKey = brand ? config.multiLocationDefaultTimeRange : config.singleLocationDefaultTimeRange;\n return AvailableTimeRangeOptions.find((type) => type.key === defaultRangeKey)?.key || null;\n }),\n catchError(() => {\n return of('12months' as const);\n }),\n );\n\n const firstPageNavigationEnd$ = this.router.events.pipe(\n filter((event) => event instanceof NavigationEnd),\n take(1),\n );\n\n combineLatest([defaultDateRange$, this.initialized$, firstPageNavigationEnd$])\n .pipe(take(1))\n .subscribe(([defaultDateRange, timeRangeAlreadyInitialized]) => {\n if (timeRangeAlreadyInitialized) return;\n if (useDefaultDateRangeInitializer(this.activatedRoute) && defaultDateRange) {\n this.setTimeRange(defaultDateRange);\n }\n });\n }\n}\n\nexport const hasCustomDateRangeInitializerKey = 'hasCustomDateRangeInit';\n\nfunction useDefaultDateRangeInitializer(activatedRoute: ActivatedRoute): boolean {\n let route = activatedRoute.root;\n do {\n const data = route.snapshot.data;\n if ('pageOptions' in data) {\n if (data.pageOptions[hasCustomDateRangeInitializerKey]) {\n return false;\n }\n }\n route = route.firstChild;\n } while (route);\n return true;\n}\n"],"mappings":"wuBAAA,IAAAA,GAAAC,GAAA,CAAAC,EAAAC,IAAA,EAAC,SAAU,EAAGC,EAAG,CACH,OAAOF,GAAnB,UAA6C,OAAOC,EAAtB,IAA+BA,EAAO,QAAUC,EAAE,EAAkB,OAAO,QAArB,YAA+B,OAAO,IAAM,OAAOA,CAAC,GAAK,EAAmB,OAAO,WAAtB,IAAmC,WAAa,GAAK,MAAM,4BAA8BA,EAAE,CAC9O,GAAEF,EAAM,UAAY,CAClB,aAEA,OAAO,SAAU,EAAGE,EAAG,CACrB,IAAIC,EAAID,EAAE,UACRE,EAAID,EAAE,OACRA,EAAE,OAAS,SAAUE,EAAG,CACtB,IAAIH,EAAI,KACNC,EAAI,KAAK,QAAQ,EACnB,GAAI,CAAC,KAAK,QAAQ,EAAG,OAAOC,EAAE,KAAK,IAAI,EAAEC,CAAC,EAC1C,IAAIC,EAAI,KAAK,OAAO,EAClBC,GAAKF,GAAK,wBAAwB,QAAQ,8DAA+D,SAAUA,EAAG,CACpH,OAAQA,EAAG,CACT,IAAK,IACH,OAAO,KAAK,MAAMH,EAAE,GAAK,GAAK,CAAC,EACjC,IAAK,KACH,OAAOC,EAAE,QAAQD,EAAE,EAAE,EACvB,IAAK,OACH,OAAOA,EAAE,SAAS,EACpB,IAAK,OACH,OAAOA,EAAE,YAAY,E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A+B,KAAKC,cAAc,GAAKyI,GACzD,KAAKlC,aAAakC,CAAgB,CAEtC,CAAC,CACL,iDA7JW1H,EAAgB,CAAA,kCAAhBA,EAAgB4H,QAAhB5H,EAAgB6H,UAAAC,WAFf,MAAM,CAAA,CAAA,SAEP9H,CAAgB,GAAA,EAgKhBT,GAAmC","names":["require_advancedFormat","__commonJSMin","exports","module","t","r","n","e","s","a","require_duration","__commonJSMin","exports","module","t","s","n","i","e","r","o","u","d","a","h","c","g","f","m","l","$","y","v","p","getDateBoundaries","timeRange","endMoment","dayjs","startOf","startMoment","dayOffsetMap","val","type","calculatedStart","calculateStartDate","toDate","DateDuration","months","setDate","getDate","days","alignUTCDateToLocal","now","Date","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","alignLocalDateToUTC","UTC","alignToEndOfDay","date","endOf","alignToStartOfDay","alignStartAndEndDates","startDate","endDate","generateDates","start","end","granularity","range","Granularity","Day","Week","getDay","Month","push","setMonth","getMonth","console","warn","getGranularityForRange","numMonths","diff","getAlignmentPeriodForRange","getAlignmentPeriodForMomentRange","getPreviousPeriod","isMonthlyReport","prevRange","previousMonthMoment","utc","previousPeriodMoment","AlignmentPeriodCalendar","CALENDAR_MONTH","CALENDAR_WEEK","CALENDAR_DAY","getFormattingOption","alignment","formatMap","previousPeriod","dr","s","e","sDate","subtract","eDate","sOut","clone","eOut","middleDate","GMBPeriodMoment","format","GBPKeywordPreviousPeriodMoment","month","year","prevMonth","get","pSOut","pEOut","import_dayjs","import_utc","import_duration","granularityThresholdForNumberOfDays","granularityFunnelMetricsWeekly","granularityFunnelMetricsMonthly","init_time_range_shared","__esmMin","init_vendasta_multi_location_analytics","init_date_utils","extend","Duration","useDefaultDateRangeInitializer","activatedRoute","route","root","data","snapshot","pageOptions","hasCustomDateRangeInitializerKey","firstChild","import_dayjs","import_advancedFormat","import_localizedFormat","import_relativeTime","import_utc","AvailableTimeRangeOptions","CUSTOM_TIME_RANGE_KEYS","TimeRangeService","init_time_range_service","__esmMin","init_core","init_datepicker","init_esm","init_operators","init_time_range_shared","init_src","init_locations","init_partner_market_config","init_router","dayjs","extend","LocalizedFormat","advancedFormat","RelativeTime","utc","key","glxyKey","DateRangePresetPeriod","lastSevenDays","name","i18nName","lastThirtyDays","lastNinetyDays","lastSixMonths","lastTwentyMonths","custom","byMonth","byQuarter","constructor","availableTimeRangeOptions$$","BehaviorSubject","map","option","includes","__spreadValues","startDate","endDate","getDateBoundaries","start","format","end","__spreadProps","dates","dateRange","toDate","selectedTimeRangeKey$$","initialized$","pipe","Boolean","distinctUntilChanged","selectedTimeRangeKey$","filterNullAndUndefined","locationsService","inject","LocationsService","partnerMarketConfigService","PartnerMarketConfigService","router","Router","ActivatedRoute","initializeTimeRange","selectedTimeRangeOption$","combineLatest","options","selectedKey","find","timeRange","prev","current","keysMatch","startDatesMatch","getTime","endDatesMatch","shareReplay","refCount","bufferSize","dateRange$","dr","utcAlignedDateRange$","alignLocalDateToUTC","startDate$","tr","endDate$","formattingOption$","getFormattingOption","setTimeRange","timeRangeKey","opt","getTimeRangeByKey","setTimeRangeKey","startDayjs","endDayjs","startOf","endOf","setDateRange","trKey","updateTimeRangeByKey","next","getDateFilterOptions","tro","getValue","defaultDateRange$","isCurrentLocationABrand$","businessAppConfig$","brand","config","defaultRangeKey","multiLocationDefaultTimeRange","singleLocationDefaultTimeRange","type","catchError","of","firstPageNavigationEnd$","events","filter","event","NavigationEnd","take","subscribe","defaultDateRange","timeRangeAlreadyInitialized","factory","ɵfac","providedIn"],"x_google_ignoreList":[0,1]}