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,UAAUH,IACzCM,aAAaJ,QAAQN,EAAQ,MAAQQ,eACvC,GACA,C","sources":["webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Calendar/types.tsx","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Calendar/styles.module.scss?7ea7","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Calendar/Month.tsx","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Calendar/Week.tsx","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Calendar/index.tsx","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Period.module.scss?09eb","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Time.tsx","webpack://realm_app/./app/javascript/pages/_serverRendered/VendorSiteVisit/Availabilities/Period.tsx","webpack://realm_app/./app/javascript/svgs/arrow-forward-ios.tsx","webpack://realm_app/./app/javascript/utils/recoil.ts"],"sourcesContent":["import dayjs, { Dayjs } from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\n\ndayjs.extend(utc)\ndayjs.extend(timezone)\n\nexport type MarkTypes = 'default' | 'dark'\n\nexport interface CalendarMarks {\n [date: number]: MarkTypes\n}\n\nexport const setMark = function (marks: CalendarMarks, date: Dayjs, mark: MarkTypes): CalendarMarks {\n return { ...marks, [date.startOf('day').toDate().getTime()]: mark }\n}\n\nexport const getMark = function (marks: CalendarMarks, date: Dayjs): undefined | MarkTypes {\n return marks[date.startOf('day').toDate().getTime()]\n}\n\nexport const clearMark = function (marks: CalendarMarks, date: Dayjs): CalendarMarks {\n const remKey = date.startOf('day').toDate().getTime()\n const newMarks = { ...marks }\n delete newMarks[remKey]\n return newMarks\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"calendar\":\"g38aWLYnPZhToChXfOkv\",\"title\":\"WzCTcSYUZ7mvONrV6F6p\",\"controls\":\"GknUK7J_eHlU9AjTgIc2\",\"prev\":\"lPnXs74QX7SiZ8baPUTC\",\"next\":\"cmuSKWduGCMcVNgNc4xl\",\"week\":\"DJdGfNAATXVCLh7WX3MQ\",\"month\":\"Np4Fe80Zqy_XGEtuIEbt\",\"day\":\"OlYG0oIaYTwp7qOmhqkD\",\"dayOfWeek\":\"RIFlSTM1bwL9VUzOQUsV\",\"expandMore\":\"uEgkef_wCyIsdp22LZPN\"};","import React, { FC, useMemo, useCallback } from 'react'\nimport cx from 'classnames'\nimport dayjs, { Dayjs } from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\n\nimport { CalendarMarks, getMark, MarkTypes } from './types'\n\nimport CoreText from 'components/Core/CoreText'\n\nimport styles from './styles.module.scss'\n\ndayjs.extend(utc)\ndayjs.extend(timezone)\n\ninterface MonthDayProps {\n date: Dayjs\n selected: boolean\n marked?: MarkTypes\n onSelected: (day: Dayjs) => void\n}\n\nconst MonthDay: FC = ({ date, selected, marked, onSelected }) => {\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault()\n onSelected(date)\n },\n [onSelected, date]\n )\n\n return (\n
  • \n \n
  • \n )\n}\n\ninterface MonthProps {\n selected: Dayjs\n marks: CalendarMarks\n visibleWeeks: number\n onSelected: (date: Dayjs) => void\n}\n\nconst Month: FC = ({ selected, marks, visibleWeeks, onSelected }) => {\n const days = useMemo(() => {\n const totalDays = visibleWeeks * 7\n const firstOfMonth = selected.startOf('M')\n const adjustFrom = visibleWeeks >= 5 ? firstOfMonth : selected\n const start = adjustFrom.startOf('w')\n\n const theMonth: Array = []\n for (let x = 0; x < totalDays; x++) {\n theMonth.push(start.add(x, 'd'))\n }\n return theMonth\n }, [selected, visibleWeeks])\n\n return (\n
      \n {days.slice(0, 7).map((day) => (\n
    1. \n \n {day.format('ddd')}\n \n
    2. \n ))}\n {days.map((day) => (\n \n ))}\n
    \n )\n}\n\nexport default Month\n","import React, { FC, useMemo, useCallback } from 'react'\nimport cx from 'classnames'\nimport dayjs, { Dayjs } from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\n\nimport { CalendarMarks, getMark, MarkTypes } from './types'\n\nimport CoreText from 'components/Core/CoreText'\n\nimport styles from './styles.module.scss'\n\ndayjs.extend(utc)\ndayjs.extend(timezone)\n\ninterface WeekDayProps {\n date: Dayjs\n selected: boolean\n marked?: MarkTypes\n onSelected: (day: Dayjs) => void\n}\n\nconst WeekDay: FC = ({ date, selected, marked, onSelected }) => {\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault()\n onSelected(date)\n },\n [onSelected, date]\n )\n\n return (\n
  • \n \n
  • \n )\n}\n\ninterface WeekProps {\n selected: Dayjs\n marks: CalendarMarks\n onSelected: (date: Dayjs) => void\n}\n\nconst Week: FC = ({ selected, marks, onSelected }) => {\n const days = useMemo(() => {\n const theWeek: Array = []\n const start = selected.startOf('w')\n for (let x = 0; x < 7; x++) {\n theWeek.push(start.add(x, 'd'))\n }\n return theWeek\n }, [selected])\n\n return (\n
      \n {days.map((day) => (\n \n ))}\n
    \n )\n}\n\nexport default Week\n","import React, { FC, useState, useCallback, useMemo, useEffect } from 'react'\nimport cx from 'classnames'\nimport dayjs, { Dayjs } from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\nimport advanced from 'dayjs/plugin/advancedFormat'\n\nimport { CalendarMarks } from './types'\n\nimport ArrowIcon from 'svgs/arrow-forward-ios'\nimport ExpandIcon from 'svgs/expand-more'\n\nimport CoreButton from 'components/Core/CoreButton'\nimport CoreText from 'components/Core/CoreText'\n\nimport Month from './Month'\nimport Week from './Week'\n\nimport styles from './styles.module.scss'\n\nexport type { CalendarMarks, MarkTypes } from './types'\nexport { setMark } from './types'\n\ndayjs.extend(timezone)\ndayjs.extend(utc)\ndayjs.extend(advanced)\n\ntype View = 'week' | 'twoWeek' | 'month'\n\ninterface CalendarProps {\n className?: string\n selected?: Date\n marks: CalendarMarks\n initialView?: View\n allowViewChange?: boolean\n timezone?: string\n\n onSelectionChange: React.Dispatch>\n onTrackAttempt?: (code: string, flexfield_1?: any) => void\n}\n\nconst Calendar: FC = ({\n className,\n selected,\n marks,\n initialView = 'week',\n allowViewChange = true,\n timezone,\n onSelectionChange,\n onTrackAttempt,\n}) => {\n const [view, setView] = useState(initialView)\n\n const track = useCallback(\n (code: string, flexfield_1?: any) => {\n if (!onTrackAttempt) return\n onTrackAttempt(code, flexfield_1)\n },\n [onTrackAttempt]\n )\n\n const handlePrevClicked = useCallback(() => {\n track('previous', { view: view })\n if (view == 'month') {\n onSelectionChange((prev) => {\n let date = dayjs(prev)\n if (timezone) date = date.tz(timezone)\n return date.add(-1, 'month').toDate()\n })\n } else {\n onSelectionChange((prev) => {\n let date = dayjs(prev)\n if (timezone) date = date.tz(timezone)\n return date.add(-1, 'week').toDate()\n })\n }\n }, [view, onSelectionChange, track, timezone])\n const handleNextClicked = useCallback(() => {\n track('next', { view: view })\n if (view == 'month') {\n onSelectionChange((prev) => {\n let date = dayjs(prev)\n if (timezone) date = date.tz(timezone)\n return date.add(1, 'month').toDate()\n })\n } else {\n onSelectionChange((prev) => {\n let date = dayjs(prev)\n if (timezone) date = date.tz(timezone)\n return date.add(1, 'week').toDate()\n })\n }\n }, [view, onSelectionChange, track, timezone])\n\n const handleTodayClicked = useCallback(() => {\n const date = new Date()\n track('select-date', { date: date, option: 'today' })\n onSelectionChange(new Date())\n }, [onSelectionChange, track])\n\n const handleDateSelected = useCallback(\n (date: Dayjs) => {\n track('select-date', { date: date.toDate() })\n onSelectionChange(date.toDate())\n },\n [onSelectionChange, track]\n )\n\n const handleShowMoreClicked = useCallback(() => {\n track('show-more')\n setView('twoWeek')\n }, [track])\n const handleShowMonthClicked = useCallback(() => {\n track('show-month')\n setView('month')\n }, [track])\n\n useEffect(() => {\n if (!selected) onSelectionChange(new Date())\n }, [selected, onSelectionChange])\n\n const djsSelected = useMemo(() => {\n let date = dayjs(selected)\n if (timezone) date = date.tz(timezone)\n\n return date\n }, [selected, timezone])\n\n return (\n
    \n
    \n \n {djsSelected.format('MMMM, YYYY')}\n \n
    \n }\n size=\"s\"\n kind=\"secondary\"\n onClick={handlePrevClicked}\n />\n \n }\n size=\"s\"\n kind=\"secondary\"\n onClick={handleNextClicked}\n />\n
    \n
    \n {view == 'week' ? (\n \n ) : (\n \n )}\n {allowViewChange && view != 'month' && (\n
    \n {view == 'twoWeek' ? (\n }\n onClick={handleShowMonthClicked}\n />\n ) : (\n }\n onClick={handleShowMoreClicked}\n />\n )}\n
    \n )}\n
    \n )\n}\n\nexport default Calendar\n","// extracted by mini-css-extract-plugin\nexport default {\"period\":\"wyTMtNIQXb5gpSHzpHto\",\"periodTitle\":\"ljvs1zTevJONPQ10eSFA\",\"periodLabel\":\"aArOI8kOZJl1Zz6eqSGQ\",\"periodMore\":\"qGhSnBOcFLCBPpyl35SR\",\"left\":\"u2e_1jMa0nd7gFElj40D\",\"noTimes\":\"pwjT3Kr4u_YoHBtQ0hPj\",\"timeSpinner\":\"JTEKjbPCNM4YJI96qSoc\",\"timesWrapper\":\"IRvdHt5_bc07chuEGc2A\",\"times\":\"nmuYT5BGUgJ9sfYUVUeB\",\"time\":\"Di8UcRbvjxE4q0D3Iho0\",\"selected\":\"aCPhgmioZ797WqYRr69g\"};","import React, { FC, useCallback, useMemo } from 'react'\nimport cx from 'classnames'\nimport dayjs from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\n\nimport CoreButton from 'components/Core/CoreButton'\n\nimport styles from './Period.module.scss'\n\ndayjs.extend(utc)\ndayjs.extend(timezone)\n\nexport interface Block {\n start: Date\n end: Date\n}\n\ninterface TimeProps {\n block: Block\n selected?: Block\n disabled: boolean\n timezone?: string\n onClick: (block: Block) => void\n}\n\nconst Time: FC = ({ block, selected, disabled, timezone, onClick }) => {\n const handleTimeClicked = useCallback(() => {\n onClick(block)\n }, [onClick, block])\n\n const isSelected = block.start.getTime() == selected?.start?.getTime()\n\n const djsStart = useMemo(() => {\n let date = dayjs(block.start)\n if (timezone) date = date.tz(timezone)\n return date\n }, [block.start, timezone])\n\n return (\n \n )\n}\n\nexport default Time\n","import React, { FC, useMemo, useState, useEffect, useRef } from 'react'\nimport dayjs from 'dayjs'\nimport timezone from 'dayjs/plugin/timezone'\nimport utc from 'dayjs/plugin/utc'\n\nimport ArrowIcon from 'svgs/arrow-forward-ios'\n\nimport CoreText from 'components/Core/CoreText'\n\nimport Time, { Block } from './Time'\n\nimport styles from './Period.module.scss'\n\ndayjs.extend(utc)\ndayjs.extend(timezone)\n\ntype Periods = 'morning' | 'afternoon' | 'evening'\nexport const PERIODS: Array = ['morning', 'afternoon', 'evening']\nconst PERIOD_NAME_MAP = {\n ['morning']: { title: 'Morning', empty: 'morning' },\n ['afternoon']: { title: 'Afternoon', empty: 'afternoon' },\n ['evening']: { title: 'Evening', empty: 'evening' },\n}\n\nconst ONE_MINUTE = 60 * 1000\nconst ONE_HOUR = ONE_MINUTE * 60\nfunction timeFromOffset(offset: number): string {\n const h = Math.floor(offset / ONE_HOUR)\n const sH = h.toString().padStart(2, '0')\n const m = Math.floor((offset - h * ONE_HOUR) / ONE_MINUTE)\n const sM = m.toString().padStart(2, '0')\n // Let's only care up to a minute granularity here.\n return `${sH}:${sM}`\n}\n\nfunction getTimeOfDate(value: Date, timeOffset: number, timezone?: string): Date {\n // In order to get the true time of day, we can't use normal math.\n // We need to reparse based on the time that we want.\n // This is because in situations like DST time switch, the difference between\n // 1AM and 2AM is not 3600000 ms like normal, but 7200000 ms!\n // So we can't just say \"add X hour worth of ms to midnight\" to get a time.\n // Further, dayjs's 'add' function just adds to the raw time (which it is supposed to),\n // so if we tried to use this, we'd still end up being an hour ahead or behind on\n // certain days.\n let date = dayjs(value)\n if (timezone) date = date.tz(timezone)\n const sDate = date.format('YYYY-MM-DD')\n const time = timeFromOffset(timeOffset)\n return dayjs.tz(`${sDate} ${time}`, timezone).toDate()\n}\n\nfunction getPeriod(time: Date, timezone?: string): Periods {\n const noon = getTimeOfDate(time, 12 * ONE_HOUR, timezone).getTime()\n const five = getTimeOfDate(time, 17 * ONE_HOUR, timezone).getTime()\n\n const startTime = time.getTime()\n if (startTime < noon) return 'morning'\n else if (startTime < five) return 'afternoon'\n return 'evening'\n}\n\ninterface Props {\n period: Periods\n availabilities: Array\n selected?: Block\n disabled: boolean\n timezone?: string\n onChange: (block: Block) => void\n}\nconst Period: FC = ({ period, availabilities, selected, disabled, timezone, onChange }) => {\n const ref = useRef(null)\n const [hiddenChildren, setHiddenChildren] = useState(0)\n const [childToLeft, setChildToLeft] = useState(false)\n const [childToRight, setChildToRight] = useState(false)\n\n // Divide them into day periods.\n const localAvailabilities = useMemo(() => {\n return availabilities.filter((block) => getPeriod(block.start, timezone) == period)\n }, [availabilities, period, timezone])\n\n useEffect(() => {\n if ('IntersectionObserver' in window) {\n const observer = new IntersectionObserver(\n (entries) => {\n if (ref.current) {\n const root = entries[0].rootBounds\n if (!root) return\n\n let hasLeft = false\n let hasRight = false\n const sum = Array.from(ref.current.children).reduce((sum, entry) => {\n const child = entry.getBoundingClientRect()\n // We need to see at least 25% of the child's right or left to\n // know it is there.\n const childLeft = child.left + child.width * 0.75\n const childRight = child.right - child.width * 0.75\n if (childLeft < root.left) {\n hasLeft = true\n return sum + 1\n } else if (childRight > root.right) {\n hasRight = true\n return sum + 1\n }\n return sum\n }, 0)\n setChildToLeft(hasLeft)\n setChildToRight(hasRight)\n setHiddenChildren(sum)\n }\n },\n { root: ref.current, threshold: 0.25 }\n )\n if (ref.current && localAvailabilities.length > 0) {\n Array.from(ref.current.children).forEach((child) => observer.observe(child))\n } else {\n setChildToLeft(false)\n setChildToRight(false)\n setHiddenChildren(0)\n }\n return () => observer?.disconnect()\n }\n }, [localAvailabilities])\n\n return (\n
  • \n
    \n \n {PERIOD_NAME_MAP[period].title}\n \n {hiddenChildren > 0 && (\n
    \n {childToLeft && }\n {`+${hiddenChildren} more`}\n {childToRight && }\n
    \n )}\n
    \n {localAvailabilities.length == 0 ? (\n {`No available times in the ${PERIOD_NAME_MAP[period].empty} for the selected date`}\n ) : (\n
    \n
      \n {localAvailabilities.map((block) => (\n \n ))}\n
    \n
    \n )}\n
  • \n )\n}\n\nexport default Period\n","import React, { FC } from 'react'\n\ninterface Props {\n className?: string\n}\n\nconst Svg: FC = ({ className }) => (\n \n \n \n)\n\nexport default Svg\n","import dayjs from 'dayjs'\nimport { DefaultValue } from 'recoil'\n\nexport const sessionStorageEffect =\n (key, expirationInHours) =>\n ({ setSelf, onSet }) => {\n // Don't do this if we're SSR\n if (typeof window === 'undefined') return\n\n const savedValue = sessionStorage.getItem(key)\n\n const expKey = `${key}-exp`\n const timestamp = sessionStorage.getItem(expKey)\n const expired = expirationInHours && (!timestamp || dayjs() >= dayjs(timestamp).add(expirationInHours, 'hours'))\n\n if (expired) {\n setSelf(new DefaultValue())\n } else if (savedValue != null) {\n setSelf(JSON.parse(savedValue))\n }\n\n onSet((newValue) => {\n if (newValue instanceof DefaultValue) {\n sessionStorage.removeItem(key)\n sessionStorage.removeItem(expKey)\n } else {\n sessionStorage.setItem(key, JSON.stringify(newValue))\n sessionStorage.setItem(expKey, dayjs().toISOString())\n }\n })\n }\n\nexport const localStorageEffect =\n (key, expirationInHours?) =>\n ({ setSelf, onSet }) => {\n // Don't do this if we're SSR\n if (typeof window === 'undefined') return\n\n const savedValue = localStorage.getItem(key)\n\n const expKey = `${key}-exp`\n const timestamp = localStorage.getItem(expKey)\n const expired = expirationInHours && (!timestamp || dayjs() >= dayjs(timestamp).add(expirationInHours, 'hours'))\n\n if (expired) {\n setSelf(new DefaultValue())\n } else if (savedValue != null) {\n setSelf(JSON.parse(savedValue))\n }\n\n onSet((newValue) => {\n if (newValue instanceof DefaultValue) {\n localStorage.removeItem(key)\n localStorage.removeItem(expKey)\n } else {\n localStorage.setItem(key, JSON.stringify(newValue))\n localStorage.setItem(expKey, dayjs().toISOString())\n }\n })\n }\n"],"names":["setMark","marks","date","mark","startOf","toDate","getTime","getMark","MonthDay","selected","marked","onSelected","handleClick","useCallback","e","preventDefault","className","day","type","onClick","disabled","CoreText","Paragraph","element","size","weight","format","visibleWeeks","days","useMemo","totalDays","firstOfMonth","start","theMonth","x","push","add","month","slice","map","key","dayOfWeek","color","isSame","WeekDay","theWeek","week","initialView","allowViewChange","timezone","onSelectionChange","onTrackAttempt","view","setView","useState","track","code","flexfield_1","handlePrevClicked","prev","tz","handleNextClicked","handleTodayClicked","Date","option","handleDateSelected","handleShowMoreClicked","handleShowMonthClicked","useEffect","djsSelected","calendar","title","controls","CoreButton","icon","A","kind","text","next","expandMore","block","handleTimeClicked","isSelected","djsStart","PERIODS","PERIOD_NAME_MAP","empty","ONE_MINUTE","ONE_HOUR","getTimeOfDate","value","timeOffset","sDate","time","offset","h","Math","floor","toString","padStart","timeFromOffset","period","availabilities","onChange","ref","useRef","hiddenChildren","setHiddenChildren","childToLeft","setChildToLeft","childToRight","setChildToRight","localAvailabilities","filter","noon","five","startTime","getPeriod","window","observer","IntersectionObserver","entries","current","root","rootBounds","hasLeft","hasRight","sum","Array","from","children","reduce","entry","child","getBoundingClientRect","childLeft","left","width","childRight","right","threshold","length","forEach","observe","disconnect","xmlns","viewBox","height","d","fill","sessionStorageEffect","expirationInHours","setSelf","onSet","savedValue","sessionStorage","getItem","expKey","timestamp","JSON","parse","newValue","removeItem","setItem","stringify","toISOString","localStorageEffect","localStorage"],"sourceRoot":""}