@konnectio/core
Version:
Konnectio Core Frontend Integration.
1,049 lines (1,048 loc) • 43.9 kB
JavaScript
import { d as q, u as oe, s as z, c as W, r as Fe, a as g, b as o, g as e, w as m, q as J, e as t, n as xe, i as c, f as v, h as r, t as l, F as C, v as U, o as et, j as tt, x as de, y as nt, z as M, A as at, S as ot, k as lt, _ as st, l as it, m as rt, p as ut } from "./mitt-BJqPn_wb.js";
import { a as Pe, f as ae, g as K, B as dt, h as ue, l as ct, s as G, e as ce, _ as Z, I as ne, i as mt, j as me, u as he, k as pt, m as vt, n as bt, o as Q, T as re, O as ft, p as gt, q as we, C as kt, r as yt, t as ht, v as Dt } from "./SelectField.vue_vue_type_style_index_0_lang-BcUXwydD.js";
import { G as Pt } from "./style-CzdIazhD.js";
import { _ as $t } from "./_.vue_vue_type_style_index_0_lang-DZVNIQB4.js";
import { B as wt, _ as Et, R as _t, L as Le, S as Ot, M as Vt, T as Tt, C as Nt, V as Ft, a as Lt } from "./masonry.plugin-B03gaQmZ.js";
import { g as Bt, e as At, c as Ct, n as St, a as Ee, m as _e, b as Oe, d as Ve, f as Te, _ as It } from "./AvailabilitySkeleton.vue_vue_type_style_index_0_scoped_86730e88_lang-BZuSNGry.js";
import { C as Rt, P as Mt, a as Ut } from "./CheckoutWindow-BE4Pox7h.js";
import { E as Gt } from "./EventAvailabilityForm-LEySl_-6.js";
import "./Field.vue_vue_type_style_index_0_scoped_6ef33e68_lang-Bf-R8I1k.js";
function zt(w) {
return (n) => {
const k = (w ? Math[w] : Math.trunc)(n);
return k === 0 ? 0 : k;
};
}
function qt(w, n, a) {
const k = Bt(), p = a?.locale ?? k.locale ?? At, b = Ct(w, n);
if (isNaN(b))
throw new RangeError("Invalid time value");
const i = Object.assign({}, a, {
addSuffix: a?.addSuffix,
comparison: b
}), [f, y] = St(
a?.in,
...b > 0 ? [n, w] : [w, n]
), s = zt("round"), O = y.getTime() - f.getTime(), P = O / Te, L = Ee(y) - Ee(f), _ = (O - L) / Te, V = a?.unit;
let E;
if (P < 1 ? E = "second" : P < 60 ? E = "minute" : P < _e ? E = "hour" : _ < Oe ? E = "day" : _ < Ve ? E = "month" : E = "year", E === "second") {
const $ = s(O / 1e3);
return p.formatDistance("xSeconds", $, i);
} else if (E === "minute") {
const $ = s(P);
return p.formatDistance("xMinutes", $, i);
} else if (E === "hour") {
const $ = s(P / 60);
return p.formatDistance("xHours", $, i);
} else if (E === "day") {
const $ = s(_ / _e);
return p.formatDistance("xDays", $, i);
} else if (E === "month") {
const $ = s(_ / Oe);
return $ === 12 && V !== "month" ? p.formatDistance("xYears", 1, i) : p.formatDistance("xMonths", $, i);
} else {
const $ = s(_ / Ve);
return p.formatDistance("xYears", $, i);
}
}
const Ht = { class: "konnectio-event-listing-action-button" }, Yt = /* @__PURE__ */ q({
__name: "_",
props: {
name: {},
description: {},
toDate: {},
listingId: {},
tableGroupId: {},
days: {},
length: {},
timeFrom: {},
timeTo: {},
maxOnlineReservationLimit: {},
minimumPersonCount: {},
maxGuests: {},
fromPrice: { default: 0 },
gallery: {},
soldOut: { type: Boolean, default: !1 },
useNumberOfProductsForPersons: { type: Boolean },
type: {},
trackingEnabled: { type: Boolean },
disableDeepLink: { type: Boolean, default: !1 },
callback: {}
},
setup(w) {
const { t: n } = oe(), a = w, { display: k } = Pe(), {
hideEventGuestAmount: p
} = z(ae()), {
maxNumberOfPeople: b,
numberOfPeople: i,
eventId: f,
currentEventDate: y,
tableGroupId: s
} = z(K()), {
getTemplateAvailability: O,
getEventAvailability: P,
isEventListingLoading: L
} = K(), _ = W(() => a.maxGuests || a.maxOnlineReservationLimit || b.value || 1 / 0), V = Fe(0), E = W(() => L(a.listingId)), $ = () => {
if (!a.useNumberOfProductsForPersons && (V.value === 0 || isNaN(V.value))) {
k({
type: "error",
message: n("alert.error.selectPeople")
});
return;
}
f.value = a.listingId, i.value = a.useNumberOfProductsForPersons ? NaN : V.value, O(a.callback);
}, H = () => {
if (!a.useNumberOfProductsForPersons && (V.value === 0 || isNaN(V.value))) {
k({
type: "error",
message: n("alert.error.selectPeople")
});
return;
}
f.value = a.listingId, s.value = a.tableGroupId, i.value = a.useNumberOfProductsForPersons ? NaN : V.value, P(a.callback);
};
return (h, A) => (o(), g(wt, {
type: "event",
"listing-id": h.listingId,
gallery: h.gallery,
name: h.name,
description: h.description,
"prices-from": h.fromPrice,
"to-date": h.toDate,
layout: e(dt).Event,
"disable-deep-link": h.disableDeepLink
}, {
description: m(() => [
J(h.$slots, "description", { maxNumberOfPeople: e(b) }, void 0, !0)
]),
action: m(() => [
J(h.$slots, "action", {}, () => [
t("div", {
class: xe([
"konnectio-event-listing-action",
{ "no-selectable-people": h.useNumberOfProductsForPersons }
])
}, [
h.useNumberOfProductsForPersons ? c("", !0) : (o(), g(ue, {
key: 0,
modelValue: V.value,
"onUpdate:modelValue": A[0] || (A[0] = (Y) => V.value = Y),
label: e(n)("event.numberOfGuests"),
icon: "users",
"icon-type": "fas",
"icon-placement": "label",
description: _.value <= 20 && !e(p) ? `${e(n)("general.availableFor")}: 1 - ${_.value} ${e(ct)(e(n)("general.guests"))}` : void 0,
"min-value": 0,
"max-value": _.value
}, null, 8, ["modelValue", "label", "description", "max-value"])),
t("div", Ht, [
v(ce, {
label: h.soldOut ? e(n)("event.soldOut") : e(n)("event.bookNowButton"),
disabled: h.soldOut,
"is-loading": E.value,
"full-width": "",
"sub-label": e(G)(e(y)),
onClickEvent: A[1] || (A[1] = (Y) => h.type === "event" ? H() : $())
}, null, 8, ["label", "disabled", "is-loading", "sub-label"])
])
], 2)
], !0)
]),
_: 3
}, 8, ["listing-id", "gallery", "name", "description", "prices-from", "to-date", "layout", "disable-deep-link"]));
}
}), Be = /* @__PURE__ */ Z(Yt, [["__scopeId", "data-v-5bd6f82e"]]), jt = { class: "konnectio-event-listing-information-new" };
const Wt = {
key: 1,
class: "konnectio-pill-button"
}, Zt = { class: "konnectio-pill-button" }, Qt = { key: 0 }, Jt = { key: 1 }, Kt = /* @__PURE__ */ q({
__name: "Event",
props: {
name: {},
description: {},
fromDate: {},
toDate: {},
length: {},
timeFrom: {},
timeTo: {},
gallery: {},
days: {},
listingId: {},
tableGroupId: {},
maxOnlineReservationLimit: {},
minimumPersonCount: {},
fromPrice: { default: 0 },
soldOut: { type: Boolean },
useNumberOfProductsForPersons: { type: Boolean },
trackingEnabled: { type: Boolean },
callback: {}
},
setup(w) {
const n = w, { t: a } = oe(), {
hideEventLength: k,
hideEventEndTime: p
} = z(ae()), b = W(() => {
const i = n.length.split(":");
return qt(
new Date(2e3, 0, 1, Number(i[0]), Number(i[1]), 0),
new Date(2e3, 0, 1, 0, 0, 0)
);
});
return (i, f) => (o(), g(Be, {
"listing-id": i.listingId,
name: i.name,
description: i.description,
gallery: i.gallery,
"prices-from": i.fromPrice,
"table-group-id": i.tableGroupId,
"max-guests": i.maxOnlineReservationLimit,
"use-number-of-products-for-persons": i.useNumberOfProductsForPersons,
"to-date": i.toDate,
"sold-out": i.soldOut,
type: "event",
callback: i.callback
}, {
description: m(() => [
i.description ? (o(), g(Et, {
key: 0,
text: i.description
}, null, 8, ["text"])) : c("", !0),
t("ul", jt, [
c("", !0),
e(k) ? c("", !0) : (o(), r("li", Wt, [
t("div", null, [
v(ne, {
icon: "calendar-clock",
color: "header"
}),
t("span", null, l(e(a)("event.lengthOfEvent")), 1)
]),
t("span", null, l(b.value), 1)
])),
t("li", Zt, [
t("div", null, [
v(ne, {
icon: "calendar-clock",
color: "header"
}),
t("span", null, l(e(a)("event.startAndEndTime")), 1)
]),
e(p) ? (o(), r("span", Jt, l(e(me)(i.timeFrom)), 1)) : (o(), r("span", Qt, l(e(mt)(i.timeFrom, i.timeTo)), 1))
])
])
]),
action: m(() => [
J(i.$slots, "action", {}, void 0, !0)
]),
_: 3
}, 8, ["listing-id", "name", "description", "gallery", "prices-from", "table-group-id", "max-guests", "use-number-of-products-for-persons", "to-date", "sold-out", "callback"]));
}
}), De = /* @__PURE__ */ Z(Kt, [["__scopeId", "data-v-47a0d2c1"]]), Xt = {
key: 0,
class: "konnectio-event-grouped-listings-container"
}, xt = { class: "konnectio-event-grouped-listings" }, en = /* @__PURE__ */ q({
__name: "Event",
props: {
name: {},
events: {},
callback: { type: Function }
},
setup(w) {
return (n, a) => n.events && n.events.length > 1 ? (o(), r("div", Xt, [
c("", !0),
t("ul", xt, [
(o(!0), r(C, null, U(n.events, ({
id: k,
days: p,
name: b,
timeFrom: i,
timeTo: f,
tableGroupId: y,
description: s,
soldOut: O,
length: P,
images: L,
maxOnlineReservationLimit: _,
maxPaxPerReservation: V,
useNumberOfProductsForPersons: E,
maxTicketsLimit: $
}) => (o(), g(De, {
key: k,
type: "event",
"listing-id": k,
"table-group-id": y,
description: s,
name: b,
length: P,
gallery: L,
days: p,
"max-online-reservation-limit": V || _ || $,
"time-from": i,
"time-to": f,
"sold-out": O,
"use-number-of-products-for-persons": E,
callback: n.callback
}, null, 8, ["listing-id", "table-group-id", "description", "name", "length", "gallery", "days", "max-online-reservation-limit", "time-from", "time-to", "sold-out", "use-number-of-products-for-persons", "callback"]))), 128))
])
])) : n.events ? (o(), g(De, {
key: n.events[0].id,
type: "event",
"listing-id": n.events[0].id,
"table-group-id": n.events[0].tableGroupId,
description: n.events[0].description,
name: n.events[0].name,
length: n.events[0].length,
gallery: n.events[0].images,
days: n.events[0].days,
"from-date": n.events[0].fromDate,
"to-date": n.events[0].toDate,
"max-online-reservation-limit": n.events[0].maxPaxPerReservation || n.events[0].maxOnlineReservationLimit || n.events[0].maxTicketsLimit,
"time-from": n.events[0].timeFrom,
"time-to": n.events[0].timeTo,
"sold-out": n.events[0].soldOut,
"use-number-of-products-for-persons": n.events[0].useNumberOfProductsForPersons,
callback: n.callback
}, null, 8, ["listing-id", "table-group-id", "description", "name", "length", "gallery", "days", "from-date", "to-date", "max-online-reservation-limit", "time-from", "time-to", "sold-out", "use-number-of-products-for-persons", "callback"])) : c("", !0);
}
}), tn = /* @__PURE__ */ Z(en, [["__scopeId", "data-v-71c9af93"]]), nn = { class: "konnectio-special-offer-availability" }, an = { class: "konnectio-special-offer-availability-button" }, on = { class: "konnectio-warning-notice" }, ln = { key: 0 }, sn = { key: 1 }, rn = /* @__PURE__ */ q({
__name: "NextEvent",
props: {
name: {},
description: {},
fromDate: {},
toDate: {},
length: {},
timeFrom: {},
timeTo: {},
gallery: {},
days: {},
listingId: {},
tableGroupId: {},
maxOnlineReservationLimit: {},
minimumPersonCount: {},
soldOut: { type: Boolean },
useNumberOfProductsForPersons: { type: Boolean },
trackingEnabled: { type: Boolean },
callback: { type: Function }
},
setup(w) {
const { t: n } = oe(), { updateEventDate: a } = he(), { display: k } = Pe(), p = Fe(), b = w;
function i() {
p.value ? a(p.value) : k({
message: n("alert.error.selectDate"),
type: "error"
});
}
const f = W(() => pt(b.fromDate, b.toDate) <= 1), y = W(() => [0, 1, 2, 3, 4, 5, 6].filter((s) => !vt(b.days).includes(s)));
return et(() => {
f.value && (p.value = new Date(b.fromDate));
}), (s, O) => (o(), g(De, {
name: s.name,
description: s.description,
"from-date": s.fromDate,
"to-date": s.toDate,
length: s.length,
"time-from": s.timeFrom,
"time-to": s.timeTo,
gallery: s.gallery,
days: s.days,
"listing-id": s.listingId,
"table-group-id": s.tableGroupId,
"max-online-reservation-limit": s.maxOnlineReservationLimit,
"minimum-person-count": s.minimumPersonCount,
"use-number-of-products-for-persons": s.useNumberOfProductsForPersons,
"tracking-enabled": s.trackingEnabled,
"sold-out": s.soldOut,
callback: s.callback,
"disable-deep-link": !0
}, {
action: m(() => [
t("div", null, [
t("div", nn, [
v(It, {
modelValue: p.value,
"onUpdate:modelValue": O[0] || (O[0] = (P) => p.value = P),
label: `${e(n)("event.selectDate")}*`,
placeholder: e(n)("event.selectDate"),
"icon-type": "fas",
"icon-placement": "label",
readonly: f.value,
"start-date": s.fromDate !== "0001-01-01T00:00:00Z" ? new Date(s.fromDate) : new Date(s.toDate),
"min-date": s.fromDate !== "0001-01-01T00:00:00Z" ? new Date(s.fromDate) : new Date(s.toDate),
"max-date": new Date(s.toDate),
"disabled-week-days": y.value
}, null, 8, ["modelValue", "label", "placeholder", "readonly", "start-date", "min-date", "max-date", "disabled-week-days"]),
t("div", an, [
v(ce, {
label: e(n)("availability.buttonLabel"),
onClick: tt(i, ["prevent"])
}, null, 8, ["label"])
])
]),
t("div", on, [
f.value ? (o(), r("span", ln, [
de("*" + l(e(n)("event.canBeBooked")) + " ", 1),
t("u", null, l(e(G)(s.fromDate)), 1)
])) : (o(), r("span", sn, [
de("*" + l(e(n)("event.canBeBooked")) + " ", 1),
t("u", null, l(e(bt)(s.days)), 1)
]))
])
])
]),
_: 1
}, 8, ["name", "description", "from-date", "to-date", "length", "time-from", "time-to", "gallery", "days", "listing-id", "table-group-id", "max-online-reservation-limit", "minimum-person-count", "use-number-of-products-for-persons", "tracking-enabled", "sold-out", "callback"]));
}
}), un = /* @__PURE__ */ Z(rn, [["__scopeId", "data-v-f6aed3b0"]]), dn = /* @__PURE__ */ q({
__name: "Template",
props: {
name: {},
description: {},
fromDate: {},
toDate: {},
listingId: {},
tableGroupId: {},
maxOnlineReservationLimit: {},
minimumPersonCount: {},
fromPrice: { default: 0 },
images: {},
trackingEnabled: { type: Boolean },
callback: {}
},
setup(w) {
return (n, a) => (o(), g(Be, {
"listing-id": n.listingId,
gallery: n.images,
name: n.name,
description: n.description,
"prices-from": n.fromPrice,
"to-date": n.toDate,
type: "template",
callback: n.callback
}, null, 8, ["listing-id", "gallery", "name", "description", "prices-from", "to-date", "callback"]));
}
}), cn = { key: 0 }, mn = { key: 1 }, pn = { key: 2 }, vn = { key: 0 }, bn = { key: 4 }, fn = { key: 5 }, gn = { key: 0 }, kn = { key: 0 }, yn = { key: 1 }, hn = {
key: 0,
class: "konnectio-capitalize"
}, Dn = /* @__PURE__ */ q({
__name: "EventReservationForm",
props: {
showGiftCard: { type: Boolean, default: !1 },
showTermsNotice: { type: Boolean, default: !1 },
prevCallback: {}
},
setup(w) {
const { t: n } = oe(), a = nt(), {
areListingsAvailable: k,
arrivalTime: p,
numberOfPeople: b,
numberOfRooms: i,
numberOfTotalDays: f,
isTemplateEvent: y,
currentEventDate: s,
length: O,
fromDate: P,
tableBasePrice: L,
getTemplateData: _,
basePrice: V,
totalPrice: E,
weekendFee: $,
roomUpgrade: H,
discountCode: h,
totalSelectedProducts: A
} = z(K()), { totalAddonPrice: Y, validateDiscountCode: pe } = K(), { currency: le, hideEventLength: ve } = z(ae());
return (R, se) => (o(), g(_t, {
"discount-code": e(h),
"onUpdate:discountCode": se[0] || (se[0] = (j) => M(h) ? h.value = j : null),
"validate-discount-code": e(pe),
"show-gift-card": R.showGiftCard,
"show-terms-notice": R.showTermsNotice,
"is-sidebar-loading": !e(k),
"base-price": e(V),
"total-price": e(E),
"weekend-fee": e($),
"room-upgrade": e(H),
notice: e(n)("event.reservationNotice"),
"prev-callback": R.prevCallback
}, at({
form: m(() => [
J(R.$slots, "form", {}, void 0, !0)
]),
"reservation-summary": m(() => [
e(y) ? c("", !0) : (o(), r("li", cn, [
t("span", null, l(e(n)("general.date")), 1),
t("b", null, l(e(G)(e(s))), 1)
])),
e(b) > 0 ? (o(), r("li", mn, [
t("span", null, l(e(n)("event.numberOfGuests")), 1),
t("b", null, l(e(b)), 1)
])) : c("", !0),
!e(y) && e(A) > 0 ? (o(), r("li", pn, [
t("span", null, l(e(n)("event.numberOfProducts")), 1),
t("b", null, l(e(A)), 1)
])) : c("", !0),
e(y) ? (o(), r(C, { key: 3 }, [
t("li", null, [
t("span", null, l(e(n)("booking.reservation.arrival")), 1),
t("b", null, l(e(G)(e(P))), 1)
]),
t("li", null, [
t("span", null, l(e(n)("booking.reservation.departure")), 1),
t("b", null, l(e(G)(e(P), e(f))), 1)
]),
t("li", null, [
t("span", null, l(e(n)("event.numberOfRooms")), 1),
t("b", null, l(e(i)), 1)
]),
e(f) > 0 ? (o(), r("li", vn, [
t("span", null, l(e(n)("event.numberOfDays")), 1),
t("b", null, l(e(f)), 1)
])) : c("", !0)
], 64)) : c("", !0),
!e(y) && e(p) ? (o(), r("li", bn, [
t("span", null, l(e(n)("event.startOfEvent")), 1),
t("b", null, l(e(me)(e(p))), 1)
])) : c("", !0),
!e(y) && e(O) && !e(ve) ? (o(), r("li", fn, [
t("span", null, l(e(n)("event.lengthOfEvent")), 1),
t("b", null, l(e(me)(e(O))), 1)
])) : c("", !0)
]),
"price-summary": m(() => [
!e(y) && e(L) > 0 ? (o(), r("li", gn, [
t("span", null, l(e(n)("booking.availability.basePrice")), 1),
t("b", null, l(e(Q)(e(L), e(le))), 1)
])) : c("", !0),
e(_) ? (o(!0), r(C, { key: 1 }, U(e(_), ({ roomGroupId: j }, X) => (o(), r(C, null, [
e(Y)(j, X) > 0 ? (o(), r("li", { key: j }, [
t("span", null, l(e(n)("booking.reservation.addons")) + " - " + l(e(n)("booking.reservation.room")) + " #" + l(X + 1), 1),
t("b", null, l(e(Q)(e(Y)(j, X), e(le))), 1)
])) : c("", !0)
], 64))), 256)) : c("", !0)
]),
navigation: m(() => [
J(R.$slots, "navigation", {}, void 0, !0)
]),
"mobile-under-price": m(() => [
e(y) && e(f) > 0 ? (o(), r("div", kn, [
t("span", null, l(e(G)(e(P))) + " - " + l(e(G)(e(P), e(f))), 1)
])) : (o(), r("div", yn, [
t("span", null, l(e(G)(e(s))), 1)
]))
]),
"mobile-summary": m(() => [
!e(y) && e(A) > 0 ? (o(), r("span", hn, l(e(n)("event.numberOfProducts")) + ": " + l(e(A)), 1)) : c("", !0)
]),
_: 2
}, [
e(a).sidebar ? {
name: "sidebar",
fn: m(() => [
J(R.$slots, "sidebar", {}, void 0, !0)
]),
key: "0"
} : void 0
]), 1032, ["discount-code", "validate-discount-code", "show-gift-card", "show-terms-notice", "is-sidebar-loading", "base-price", "total-price", "weekend-fee", "room-upgrade", "notice", "prev-callback"]));
}
}), ye = /* @__PURE__ */ Z(Dn, [["__scopeId", "data-v-9b28e490"]]), Pn = { class: "event-skeleton" }, $n = { class: "event-skeleton-content" }, wn = { class: "event-skeleton-sidebar" }, En = /* @__PURE__ */ q({
__name: "EventSkeleton",
setup(w) {
return (n, a) => (o(), r("div", Pn, [
t("div", $n, [
v(Le)
]),
t("div", wn, [
c("", !0),
v(Ot)
])
]));
}
}), _n = /* @__PURE__ */ Z(En, [["__scopeId", "data-v-3e15c4e3"]]), On = {
key: 0,
id: "konnectio-event-listings-wrapper"
}, Vn = {
key: 0,
class: "konnectio-hotel-availability-title"
}, Tn = { class: "konnectio-event-listings" }, Nn = { class: "konnectio-hotel-availability-title" }, Fn = { class: "konnectio-event-listings" }, Ln = ["innerHTML"], Bn = { class: "konnectio-panel" }, An = {
key: 0,
id: "konnectio-event-addons"
}, Cn = { class: "konnectio-table with-lines" }, Sn = { class: "konnectio-event-addons-price" }, In = { class: "konnectio-event-addons-input" }, Rn = { class: "konnectio-event-addons-price" }, Mn = { class: "konnectio-event-addons-price" }, Un = {
key: 1,
class: "konnectio-table with-lines without-header"
}, Gn = { class: "konnectio-table-addons-information" }, zn = { key: 0 }, qn = { class: "konnectio-table-addons-option" }, Hn = { class: "konnectio-panel" }, Yn = /* @__PURE__ */ q({
name: "EventLayout",
__name: "Event",
props: {
accessToken: {},
onlyShow: { default: "everything" },
selectedLocation: {},
resetDate: { default: "no" },
hideLocations: { default: "no" },
hideRemarks: { default: "no" },
hideAllergies: { default: "no" },
styling: {}
},
setup(w) {
const n = w, { t: a } = oe(), {
addons: k,
products: p,
numberOfDays: b,
name: i,
phone: f,
email: y,
remark: s,
allergies: O,
arrivalTime: P,
hasEvents: L,
hasTemplates: _,
getEvents: V,
getTemplates: E,
getEventData: $,
getTemplateData: H,
getEventTableData: h,
hasProducts: A,
eventRateType: Y,
areListingsAvailable: pe,
isAvailabilityDataAvailable: le,
hasListingData: ve,
isPaymentLoading: R,
isReservationFormFilled: se,
requiresArrivalTime: j,
hasSelectedRequiredProducts: X,
getUnavailableEvents: be
} = z(K()), { currency: ie } = z(ae()), { setActiveIdFilter: Ae } = ae(), { eventDate: Ce, eventLocation: Se } = z(he()), { isValidRestaurantId: Ie } = he(), {
initialize: Re,
fetchListings: Me,
createBooking: Ue,
localAddonPrice: Ge,
totalAddonPrice: ze,
reset: qe,
goBack: $e
} = K(), { display: fe } = Pe(), He = W(() => [
{
id: "availability",
label: a("booking.availability.title"),
icon: "search"
},
{
id: "addons",
label: a("general.addons"),
icon: "shopping-cart",
hidden: !1
},
{
id: "reservation",
label: a("booking.reservation.title"),
icon: "concierge-bell"
},
{
id: "payment",
hidden: !0
},
{
id: "confirmation",
label: a("booking.confirmation.title"),
icon: "calendar-check"
}
]), Ye = W(() => {
const D = [];
return h.value && h.value.forEach((d) => {
D.find((F) => F.value === d.time) || D.push({
label: me(d.time),
value: d.time
});
}), D;
});
function je() {
qe(n.resetDate === "yes");
}
function We() {
const D = yt("history", {
removeNullishValues: !0
}), d = parseInt(D.rid), F = D.d, T = parseInt(D.eid);
if (F)
if (ht(F)) {
const u = new Date(F), S = u.setHours(12, 0, 0, 0), I = (/* @__PURE__ */ new Date()).setHours(12, 0, 0, 0);
S >= I ? Ce.value = u : (fe({
message: a("alert.error.invalidDateRange"),
type: "error"
}), D.d = void 0);
} else
fe({
message: a("alert.error.wrongDateFormat"),
type: "error"
});
isNaN(d) || (Ie(d) ? Se.value = d : (D.rid = void 0, fe({
message: a("alert.error.hotelIdNotFound"),
type: "error"
}))), isNaN(T) || Ae(T), Me();
}
return (D, d) => (o(), g(kt, { styling: D.styling }, {
default: m(() => [
(o(), g(ot, { onResolve: We }, {
default: m(() => [
v($t, {
id: "konnectio-event-module",
"access-token": D.accessToken,
callback: e(Re)
}, {
default: m(() => [
v(Vt, {
steps: He.value,
onReset: je
}, {
availability: m(({ next: F }) => [
v(ye, null, {
sidebar: m(() => [
v(Gt, {
redirection: !1,
"selected-location": Number(D.selectedLocation),
"hide-locations": D.hideLocations === "yes"
}, null, 8, ["selected-location", "hide-locations"])
]),
form: m(() => [
e(ve) && e(pe) ? (o(), r("div", On, [
e(V).length > 0 && e(be).length > 0 ? (o(), r("h2", Vn, [
v(ne, {
icon: "calendar-clock",
type: "fal",
color: "header"
}),
t("span", null, l(e(a)("event.availableNow")), 1)
])) : c("", !0),
t("ul", Tn, [
e(L) && D.onlyShow !== "templates" ? (o(!0), r(C, { key: 0 }, U(e(V), (T) => (o(), g(tn, {
name: T.name,
events: T.events,
callback: F
}, null, 8, ["name", "events", "callback"]))), 256)) : c("", !0),
e(_) && D.onlyShow !== "events" ? (o(!0), r(C, { key: 1 }, U(e(E), ({
id: T,
name: u,
fromDate: S,
toDate: I,
minimumPersonCount: N,
fromPrice: B,
description: x,
images: ee
}) => (o(), g(dn, {
key: T,
"listing-id": T,
name: u,
images: ee,
description: x,
"from-date": S,
"to-date": I,
"minimum-person-count": N,
fromPrice: B,
callback: F
}, null, 8, ["listing-id", "name", "images", "description", "from-date", "to-date", "minimum-person-count", "fromPrice", "callback"]))), 128)) : c("", !0)
]),
e(be).length > 0 && D.onlyShow !== "templates" ? (o(), r(C, { key: 1 }, [
t("h2", Nn, [
v(ne, {
icon: "calendar-circle-exclamation",
type: "fal",
color: "header"
}),
t("span", null, l(e(a)("event.availableLater")), 1)
]),
t("ul", Fn, [
(o(!0), r(C, null, U(e(be), ({
id: T,
days: u,
name: S,
timeFrom: I,
timeTo: N,
fromDate: B,
toDate: x,
tableGroupId: ee,
description: ge,
soldOut: ke,
length: te,
images: Ze,
maxOnlineReservationLimit: Qe,
maxPaxPerReservation: Je,
useNumberOfProductsForPersons: Ke,
maxTicketsLimit: Xe
}) => (o(), g(un, {
key: T,
type: "event",
"listing-id": T,
"table-group-id": ee,
description: ge,
name: S,
length: te,
gallery: Ze,
days: u,
"from-date": B,
"to-date": x,
"max-online-reservation-limit": Je || Qe || Xe,
"time-from": I,
"time-to": N,
"sold-out": ke,
"use-number-of-products-for-persons": Ke,
callback: F
}, null, 8, ["listing-id", "table-group-id", "description", "name", "length", "gallery", "days", "from-date", "to-date", "max-online-reservation-limit", "time-from", "time-to", "sold-out", "use-number-of-products-for-persons", "callback"]))), 128))
])
], 64)) : c("", !0),
!e(L) && !e(_) || !e(L) && D.onlyShow === "events" || !e(_) && D.onlyShow === "templates" ? (o(), r("div", {
key: 2,
class: "konnectio-panel",
innerHTML: e(a)("event.nothingAvailable")
}, null, 8, Ln)) : c("", !0)
])) : (o(), g(Le, { key: 1 }))
]),
_: 2
}, 1024)
]),
addons: m(({ next: F, prev: T }) => [
e(le) ? (o(), g(ye, {
key: 0,
"prev-callback": () => e($e)(T)
}, {
form: m(() => [
t("form", Bn, [
t("h2", null, [
t("span", null, l(e(a)("event.selectProducts")), 1)
]),
e(H) && e(H).length > 0 ? (o(), r("ul", An, [
(o(!0), r(C, null, U(e(H), ({
roomGroupId: u,
addons: S,
adultPerRoom: I
}, N) => (o(), r("li", { key: u }, [
t("h5", null, [
t("span", null, l(e(a)("booking.reservation.room")) + " #" + l(N + 1), 1),
d[7] || (d[7] = de(" (")),
v(ne, {
icon: "male",
type: "fas",
color: "header"
}),
de(" " + l(I) + ") ", 1)
]),
t("table", Cn, [
t("thead", null, [
t("tr", null, [
t("th", null, [
t("span", null, l(e(a)("booking.reservation.addons")), 1)
]),
d[8] || (d[8] = t("th", { class: "konnectio-event-addons-input" }, null, -1)),
t("th", Sn, [
t("span", null, l(e(a)("booking.availability.price")), 1)
])
])
]),
t("tbody", null, [
(o(!0), r(C, null, U(S, ({
id: B,
cardinality: x,
name: ee,
price: ge,
quantityStrategy: ke
}) => (o(), r("tr", { key: B }, [
t("td", null, [
t("b", null, l(ee), 1),
d[9] || (d[9] = t("br", null, null, -1)),
t("span", null, l(e(Q)(ge, e(ie))) + " " + l(e(gt)(ke)), 1)
]),
t("td", In, [
x === 3 ? (o(), g(ue, {
key: 0,
modelValue: e(k)[`${u}.${B}.${N}`],
"onUpdate:modelValue": (te) => e(k)[`${u}.${B}.${N}`] = te,
small: !0,
"min-value": 0
}, null, 8, ["modelValue", "onUpdate:modelValue"])) : (o(), g(Ut, {
key: 1,
modelValue: e(k)[`${u}.${B}.${N}`],
"onUpdate:modelValue": (te) => e(k)[`${u}.${B}.${N}`] = te,
numeric: !0
}, null, 8, ["modelValue", "onUpdate:modelValue"]))
]),
t("td", Rn, [
t("span", null, l(e(Q)(e(Ge)(B, u, N), e(ie))), 1)
])
]))), 128))
]),
t("tfoot", null, [
t("tr", null, [
d[10] || (d[10] = t("td", null, null, -1)),
d[11] || (d[11] = t("td", null, null, -1)),
t("td", Mn, [
t("u", null, [
t("span", null, l(e(Q)(e(ze)(u, N), e(ie))), 1)
])
])
])
])
])
]))), 128))
])) : c("", !0),
e(A) ? (o(), r("table", Un, [
t("tbody", null, [
(o(!0), r(C, null, U(e($).products, ({ id: u, name: S, price: I, description: N }) => (o(), r("tr", { key: u }, [
t("td", Gn, [
t("b", null, [
t("span", null, l(e(we)(S)), 1)
]),
N && N !== S ? (o(), r("span", zn, l(e(we)(N)), 1)) : c("", !0),
t("u", null, l(e(Q)(I, e(ie))), 1)
]),
t("td", qn, [
v(ue, {
modelValue: e(p)[u],
"onUpdate:modelValue": (B) => e(p)[u] = B,
small: !0,
"min-value": 0
}, null, 8, ["modelValue", "onUpdate:modelValue"])
])
]))), 128))
])
])) : c("", !0)
])
]),
navigation: m(() => [
v(ce, {
label: e(a)("event.startReservation"),
disabled: !e(X),
"full-width": "",
onClickEvent: F
}, null, 8, ["label", "disabled", "onClickEvent"])
]),
_: 2
}, 1032, ["prev-callback"])) : c("", !0)
]),
reservation: m(({ next: F, prev: T }) => [
v(ye, {
"show-terms-notice": !0,
"show-gift-card": !0,
"prev-callback": () => e($e)(T)
}, {
form: m(() => [
t("form", Hn, [
t("h2", null, [
t("span", null, l(e(a)("booking.reservation.detailsTitle")), 1)
]),
v(re, {
modelValue: e(i),
"onUpdate:modelValue": d[0] || (d[0] = (u) => M(i) ? i.value = u : null),
type: "text",
label: e(a)("booking.reservation.name"),
icon: "user-alt",
placeholder: e(a)("booking.reservation.namePlaceholder"),
required: ""
}, null, 8, ["modelValue", "label", "placeholder"]),
v(re, {
modelValue: e(y),
"onUpdate:modelValue": d[1] || (d[1] = (u) => M(y) ? y.value = u : null),
label: e(a)("booking.reservation.email"),
type: "email",
name: "email",
autocomplete: "email",
icon: "at",
placeholder: e(a)("booking.reservation.emailPlaceholder"),
required: ""
}, null, 8, ["modelValue", "label", "placeholder"]),
v(Mt, {
modelValue: e(f),
"onUpdate:modelValue": d[2] || (d[2] = (u) => M(f) ? f.value = u : null),
label: e(a)("booking.reservation.phone"),
icon: "phone-office",
placeholder: e(a)("booking.reservation.phonePlaceholder"),
required: ""
}, null, 8, ["modelValue", "label", "placeholder"]),
e(j) ? (o(), g(Nt, {
key: 0,
modelValue: e(P),
"onUpdate:modelValue": d[3] || (d[3] = (u) => M(P) ? P.value = u : null),
label: e(a)("event.selectArrivalTime"),
name: "eventTimeTable",
checkboxes: Ye.value,
required: ""
}, null, 8, ["modelValue", "label", "checkboxes"])) : c("", !0),
e(Y) === e(ft).FullDayEvent ? (o(), g(ue, {
key: 1,
modelValue: e(b),
"onUpdate:modelValue": d[4] || (d[4] = (u) => M(b) ? b.value = u : null),
label: e(a)("event.numberOfDays"),
"min-value": 1,
required: ""
}, null, 8, ["modelValue", "label"])) : c("", !0),
D.hideRemarks !== "yes" ? (o(), g(re, {
key: 2,
modelValue: e(s),
"onUpdate:modelValue": d[5] || (d[5] = (u) => M(s) ? s.value = u : null),
type: "textarea",
label: e(a)("booking.reservation.remark"),
icon: "info-circle",
placeholder: e(a)("booking.reservation.remarkPlaceholder")
}, null, 8, ["modelValue", "label", "placeholder"])) : c("", !0),
D.hideAllergies !== "yes" ? (o(), g(re, {
key: 3,
modelValue: e(O),
"onUpdate:modelValue": d[6] || (d[6] = (u) => M(O) ? O.value = u : null),
type: "textarea",
label: e(a)("booking.reservation.allergies"),
icon: "allergies",
placeholder: e(a)("booking.reservation.allergiesPlaceholder")
}, null, 8, ["modelValue", "label", "placeholder"])) : c("", !0)
])
]),
navigation: m(() => [
v(ce, {
label: e(a)("general.confirmReservation"),
"is-loading": e(R),
disabled: !e(se),
"full-width": "",
onClickEvent: (u) => e(Ue)(F)
}, null, 8, ["label", "is-loading", "disabled", "onClickEvent"])
]),
_: 2
}, 1032, ["prev-callback"])
]),
payment: m(() => [
v(Rt)
]),
confirmation: m(() => [
v(Tt, {
message: e(a)("event.confirmationMessage")
}, null, 8, ["message"])
]),
_: 1
}, 8, ["steps"])
]),
_: 1
}, 8, ["access-token", "callback"])
]),
fallback: m(() => [
v(_n)
]),
_: 1
}))
]),
_: 1
}, 8, ["styling"]));
}
}), Ne = /* @__PURE__ */ Z(Yn, [["__scopeId", "data-v-3b1c5396"]]), jn = lt(), Wn = st, Zn = Wn();
class Qn extends HTMLElement {
vueApp;
constructor() {
super();
}
disconnectedCallback() {
this.vueApp.unmount();
}
connectedCallback() {
const n = it(Ne, this.attributes);
this.vueApp = rt(Ne, n), this.vueApp.provide("emitter", Zn), this.vueApp.use(ut), this.vueApp.use(jn), this.vueApp.use(Ft), this.vueApp.use(Pt), this.vueApp.use(Lt), this.vueApp.use(Dt, { bootstrap: !0 });
const a = document.createElement("div");
this.vueApp.mount(a), this.appendChild(a.children[0]);
}
}
window.customElements.define("konnectio-event", Qn);
export {
Qn as default
};
//# sourceMappingURL=event.js.map