\n \n\n","import type { UseFetchOptions } from '@vueuse/core'\nimport { type MaybeRefOrGetter, toValue } from 'vue'\nimport { useThFetch } from '@/composables/useThFetch'\nimport { useConfigurationStore } from '@/stores/useConfigurationStore'\nimport type { TillhubResponse } from '@/types/TillhubResponse'\n\nexport interface TimeSlotsQueryParams {\n start: Date | string\n end: Date | string\n branchId: string\n lineItems: { serviceId: string; staffId: string | null }[]\n // When rescheduling an appointment, this should be the id of the current appointment\n // so that the backend takes into consideration available slots as if this appointment\n // did not exist at all\n excludeAppointmentId?: string\n}\n\nexport function useTimeSlotsQuery(\n params: MaybeRefOrGetter,\n options?: UseFetchOptions\n) {\n const store = useConfigurationStore()\n\n return useThFetch(`/v0/reservations/time-slots/${store.organization}`, {\n ...options,\n afterFetch(ctx) {\n const data = ctx.data as TillhubResponse\n\n return {\n ...ctx,\n data: data.results\n }\n }\n })\n .post(() => {\n const { start, end, lineItems, excludeAppointmentId, branchId } = toValue(params)\n\n return {\n start,\n end,\n branchId,\n excludeAppointments: excludeAppointmentId ? [excludeAppointmentId] : undefined,\n desiredServices: lineItems.map((lineItem) => {\n return {\n serviceId: lineItem.serviceId,\n staffId: lineItem.staffId || undefined\n }\n })\n }\n })\n .json()\n}\n","\n\n\n
\n\n","export class TimeSlotNotAvailableError implements Error {\n name = 'TimeSlotNotAvailableError'\n message = 'Time slot not available'\n}\n","import { ref, type Ref, watch, onUnmounted } from 'vue'\n\n/**\n * You can use this composable if you need to add a sticky element, stuck to the bottom of\n * the screen. It causes an issue with the footer, as it overlays it and it makes it inaccessible\n * through scroll.\n * The padding amount added should be more or less equal to the size of the sticky element\n */\nexport function useAddBodyMobilePaddingBottom(isActive: Ref = ref(true)) {\n const className = 'max-md:pb-24'\n\n watch(\n isActive,\n (isActive) => {\n if (isActive) {\n document.body.classList.add(className)\n\n return\n }\n\n document.body.classList.remove(className)\n },\n {\n immediate: true\n }\n )\n\n onUnmounted(() => document.body.classList.remove(className))\n}\n"],"names":["classes","computed","color","size","props","useTimeSlotsQuery","params","options","store","useConfigurationStore","useThFetch","ctx","data","start","end","lineItems","excludeAppointmentId","branchId","toValue","lineItem","ISO_DATE_FORMAT","t","useI18n","localizedDayjs","useLocalizedDayjs","dayjs","useDayjs","merchantTimezone","merchantTimezoneFormatted","getMerchantTimezoneFormatted","timeSlotsByDate","acc","timeSlot","date","selectedDate","ref","activeDateRange","setActiveDateRange","endDate","startDate","selectFirstDayWithTimeSlots","day","daysOfTheWeek","goToNextWeek","emit","goToPreviousWeek","isPreviousWeekDisabled","allowedDateRange","isNextWeekDisabled","daysCount","today","_","index","formatted","setInitialSelectedDate","targetDate","rangeStartDate","createDateInMerchantLocalTime","watch","activeMonthName","format","timeSlotsForSelectedDate","slots","reactive","TIME_FORMAT","dismissTimezoneNotification","selectedDateFormatted","addTimeIntervalToDate","interval","value","type","min_booking_lead_time","max_booking_lead_time","backendDateRange","getBackendDateRange","startOfWeek","isActiveDateRangeWithinBackendDateRange","fetchedRange","isStartSame","isStartWithinRange","isEndSame","isEndWithinRange","onNavigateNextWeek","dateRange","onNavigatePreviousWeek","isFetching","error","fetchTimeSlots","stopHandle","TimeSlotNotAvailableError","__publicField","useAddBodyMobilePaddingBottom","isActive","className","onUnmounted"],"mappings":"soCAoBMA,EAAUC,EAAS,IAAM,CACvB,KAAA,CAAE,MAAAC,EAAO,KAAAC,CAAS,EAAAC,EAKjB,MAAA,CACL,aAAcA,EAAM,QAEpB,cAAeA,EAAM,SACrB,kCAAmCA,EAAM,UAAYA,EAAM,QAC3D,6GACEF,IAAU,QACZ,qBAAsBC,IAAS,KAC/B,qBAAsBA,IAAS,KAC/B,8BAA+BA,IAAS,IAAA,CAC1C,CACD,4ZCpBe,SAAAE,GACdC,EACAC,EACA,CACA,MAAMC,EAAQC,IAEd,OAAOC,GAAW,+BAA+BF,EAAM,YAAY,GAAI,CACrE,GAAGD,EACH,WAAWI,EAAK,CACd,MAAMC,EAAOD,EAAI,KAEV,MAAA,CACL,GAAGA,EACH,KAAMC,E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