@gomusdev/web-components 1.20.1 → 1.22.0
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.
- package/dist-js/components/cart/mocks/gomusTicketMocks.d.ts +107 -10
- package/dist-js/components/cart/mocks/testCart.d.ts +1 -1
- package/dist-js/components/link/Link.svelte.d.ts +1 -0
- package/dist-js/components/link/entry.d.ts +0 -0
- package/dist-js/components/ticketSelection/TicketSelectionDetails.svelte.d.ts +6 -7
- package/dist-js/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.d.ts +24 -8
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegment.svelte.d.ts +1 -767
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegmentDetails.svelte.d.ts +1027 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/utils.svelte.d.ts +2 -7
- package/dist-js/gomus-webcomponents.css +9 -2
- package/dist-js/gomus-webcomponents.iife.js +757 -482
- package/dist-js/gomus-webcomponents.js +757 -482
- package/dist-js/lib/helpers/context.svelte.d.ts +1 -0
- package/dist-js/lib/models/cart/CartEvents.svelte.d.ts +1 -0
- package/dist-js/lib/models/cart/CartItem.d.ts +37 -0
- package/dist-js/lib/models/cart/cart.svelte.d.ts +191 -0
- package/dist-js/lib/models/cart/localStorage.spec.d.ts +1 -0
- package/dist-js/lib/models/cart/localStorage.svelte.d.ts +46 -0
- package/dist-js/lib/models/cart/selectOptions.d.ts +10 -0
- package/dist-js/lib/models/cart/selectOptions.spec.d.ts +1 -0
- package/dist-js/lib/models/cart/types.d.ts +13 -0
- package/dist-js/lib/models/scalePrice/UIScaledPrice.spec.d.ts +1 -0
- package/dist-js/lib/models/scalePrice/UIScaledPrice.svelte.d.ts +51 -0
- package/dist-js/lib/models/ticket/UITicket.spec.d.ts +1 -0
- package/dist-js/lib/{gomusTicket.svelte.d.ts → models/ticket/UITicket.svelte.d.ts} +109 -11
- package/dist-js/lib/stores/shop.svelte.d.ts +41 -0
- package/dist-js/lib/vitest/msw/handlers.d.ts +1 -1
- package/dist-js/mocks/MSWMocks.d.ts +3 -0
- package/dist-js/mocks/ScalingPricesMocks.d.ts +24 -0
- package/dist-js/mocks/mocks.d.ts +1324 -695
- package/package.json +1 -1
- package/dist-js/components/cart/lib/CartEvents.svelte.d.ts +0 -1
- package/dist-js/components/cart/lib/CartItem.d.ts +0 -135
- package/dist-js/components/cart/lib/cart.svelte.d.ts +0 -616
- package/dist-js/components/cart/lib/localStorage.svelte.d.ts +0 -146
- /package/dist-js/components/{cart/lib/CartEvents.spec.d.ts → link/Link.spec.d.ts} +0 -0
- /package/dist-js/components/{cart/lib/cart.svelte.spec.d.ts → ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegment.spec.d.ts} +0 -0
- /package/dist-js/{components/cart/lib/localStorage.spec.d.ts → lib/models/cart/CartEvents.spec.d.ts} +0 -0
- /package/dist-js/lib/{gomusTicket.spec.d.ts → models/cart/cart.svelte.spec.d.ts} +0 -0
|
@@ -5484,6 +5484,12 @@ class DetailsWrapper {
|
|
|
5484
5484
|
}
|
|
5485
5485
|
#data = /* @__PURE__ */ state(proxy({ value: void 0 }));
|
|
5486
5486
|
error = false;
|
|
5487
|
+
// creates a DetailsWrapper with a static value
|
|
5488
|
+
static static(data) {
|
|
5489
|
+
const ret = new DetailsWrapper(null, null);
|
|
5490
|
+
ret.value = data;
|
|
5491
|
+
return ret;
|
|
5492
|
+
}
|
|
5487
5493
|
load() {
|
|
5488
5494
|
pollUntilTruthy(
|
|
5489
5495
|
() => {
|
|
@@ -5565,6 +5571,254 @@ function toursGroupUrl(id) {
|
|
|
5565
5571
|
const groups = shop.settings?.multipleToursMenuItems.tour_groups[id] || [];
|
|
5566
5572
|
return `/#/products/tours?category_id=${groups.join("&category_id=")}`;
|
|
5567
5573
|
}
|
|
5574
|
+
const isArray = Array.isArray;
|
|
5575
|
+
const isObject$2 = (value) => {
|
|
5576
|
+
return !!value && value.constructor === Object;
|
|
5577
|
+
};
|
|
5578
|
+
const isString = (value) => {
|
|
5579
|
+
return typeof value === "string" || value instanceof String;
|
|
5580
|
+
};
|
|
5581
|
+
const isNumber = (value) => {
|
|
5582
|
+
try {
|
|
5583
|
+
return Number(value) === value;
|
|
5584
|
+
} catch {
|
|
5585
|
+
return false;
|
|
5586
|
+
}
|
|
5587
|
+
};
|
|
5588
|
+
function sum(array2, fn) {
|
|
5589
|
+
return (array2 || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0);
|
|
5590
|
+
}
|
|
5591
|
+
const sort = (array2, getter, desc = false) => {
|
|
5592
|
+
if (!array2)
|
|
5593
|
+
return [];
|
|
5594
|
+
const asc = (a2, b) => getter(a2) - getter(b);
|
|
5595
|
+
const dsc = (a2, b) => getter(b) - getter(a2);
|
|
5596
|
+
return array2.slice().sort(desc === true ? dsc : asc);
|
|
5597
|
+
};
|
|
5598
|
+
const alphabetical = (array2, getter, dir = "asc") => {
|
|
5599
|
+
if (!array2)
|
|
5600
|
+
return [];
|
|
5601
|
+
const asc = (a2, b) => `${getter(a2)}`.localeCompare(getter(b));
|
|
5602
|
+
const dsc = (a2, b) => `${getter(b)}`.localeCompare(getter(a2));
|
|
5603
|
+
return array2.slice().sort(dir === "desc" ? dsc : asc);
|
|
5604
|
+
};
|
|
5605
|
+
const iterate = (count, func, initValue) => {
|
|
5606
|
+
let value = initValue;
|
|
5607
|
+
for (let i = 1; i <= count; i++) {
|
|
5608
|
+
value = func(value, i);
|
|
5609
|
+
}
|
|
5610
|
+
return value;
|
|
5611
|
+
};
|
|
5612
|
+
const omit = (obj, keys2) => {
|
|
5613
|
+
if (!obj)
|
|
5614
|
+
return {};
|
|
5615
|
+
if (!keys2 || keys2.length === 0)
|
|
5616
|
+
return obj;
|
|
5617
|
+
return keys2.reduce(
|
|
5618
|
+
(acc, key) => {
|
|
5619
|
+
delete acc[key];
|
|
5620
|
+
return acc;
|
|
5621
|
+
},
|
|
5622
|
+
{ ...obj }
|
|
5623
|
+
);
|
|
5624
|
+
};
|
|
5625
|
+
const assign = (initial, override) => {
|
|
5626
|
+
if (!initial || !override)
|
|
5627
|
+
return initial ?? override ?? {};
|
|
5628
|
+
return Object.entries({ ...initial, ...override }).reduce(
|
|
5629
|
+
(acc, [key, value]) => {
|
|
5630
|
+
return {
|
|
5631
|
+
...acc,
|
|
5632
|
+
[key]: (() => {
|
|
5633
|
+
if (isObject$2(initial[key]))
|
|
5634
|
+
return assign(initial[key], value);
|
|
5635
|
+
return value;
|
|
5636
|
+
})()
|
|
5637
|
+
};
|
|
5638
|
+
},
|
|
5639
|
+
{}
|
|
5640
|
+
);
|
|
5641
|
+
};
|
|
5642
|
+
class Auth {
|
|
5643
|
+
#data = {
|
|
5644
|
+
uid: "",
|
|
5645
|
+
client: "",
|
|
5646
|
+
accessToken: "",
|
|
5647
|
+
expiry: 0
|
|
5648
|
+
// Unix time (seconds)
|
|
5649
|
+
};
|
|
5650
|
+
constructor() {
|
|
5651
|
+
setInterval(() => this.load(), 1e3);
|
|
5652
|
+
}
|
|
5653
|
+
customerLevel() {
|
|
5654
|
+
if (this.isGuest()) return 10;
|
|
5655
|
+
if (this.isLoggedIn()) return 20;
|
|
5656
|
+
return void 0;
|
|
5657
|
+
}
|
|
5658
|
+
isAuthenticated() {
|
|
5659
|
+
return this.#data.uid !== "";
|
|
5660
|
+
}
|
|
5661
|
+
isLoggedIn() {
|
|
5662
|
+
return Boolean(this.#data.uid && isEmail(this.#data.uid));
|
|
5663
|
+
}
|
|
5664
|
+
isGuest() {
|
|
5665
|
+
return Boolean(this.#data.uid && !isEmail(this.#data.uid));
|
|
5666
|
+
}
|
|
5667
|
+
// This should be manually called whenever we are signing out
|
|
5668
|
+
signOut() {
|
|
5669
|
+
this.#data.uid = "";
|
|
5670
|
+
this.#data.client = "";
|
|
5671
|
+
this.#data.accessToken = "";
|
|
5672
|
+
this.#data.expiry = 0;
|
|
5673
|
+
this.save();
|
|
5674
|
+
}
|
|
5675
|
+
// This happens automatically via the AuthMiddleware
|
|
5676
|
+
signIn(options) {
|
|
5677
|
+
this.#data.uid = options.uid;
|
|
5678
|
+
this.#data.client = options.client;
|
|
5679
|
+
this.#data.accessToken = options.accessToken;
|
|
5680
|
+
this.#data.expiry = options.expiry;
|
|
5681
|
+
this.save();
|
|
5682
|
+
}
|
|
5683
|
+
get data() {
|
|
5684
|
+
if (this.#data.expiry < Math.floor(Date.now() / 1e3)) {
|
|
5685
|
+
this.signOut();
|
|
5686
|
+
}
|
|
5687
|
+
return this.#data;
|
|
5688
|
+
}
|
|
5689
|
+
toString() {
|
|
5690
|
+
return JSON.stringify(this.#data);
|
|
5691
|
+
}
|
|
5692
|
+
save() {
|
|
5693
|
+
localStorage.setItem("go-auth", this.toString());
|
|
5694
|
+
}
|
|
5695
|
+
load() {
|
|
5696
|
+
const str = localStorage.getItem("go-auth");
|
|
5697
|
+
if (!str) {
|
|
5698
|
+
this.signOut();
|
|
5699
|
+
return;
|
|
5700
|
+
}
|
|
5701
|
+
const d = JSON.parse(str);
|
|
5702
|
+
if (!(isObject$2(d) && "uid" in d && "client" in d && "accessToken" in d && "expiry" in d)) {
|
|
5703
|
+
throw new Error(`(Auth.loadFromString) invalid auth json ${str}`);
|
|
5704
|
+
}
|
|
5705
|
+
this.signIn(d);
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
const auth = new Auth();
|
|
5709
|
+
class AuthMiddleware {
|
|
5710
|
+
constructor(auth2) {
|
|
5711
|
+
this.auth = auth2;
|
|
5712
|
+
}
|
|
5713
|
+
/**
|
|
5714
|
+
* Intercepts and modifies outgoing HTTP requests by adding authentication headers.
|
|
5715
|
+
*/
|
|
5716
|
+
onRequest({ request }) {
|
|
5717
|
+
const { uid, client: client2, accessToken, expiry } = this.auth.data;
|
|
5718
|
+
const h = request.headers;
|
|
5719
|
+
if (uid && !h.has("uid")) h.set("uid", uid);
|
|
5720
|
+
if (client2 && !h.has("client")) h.set("client", client2);
|
|
5721
|
+
if (accessToken && !h.has("access-token")) h.set("access-token", accessToken);
|
|
5722
|
+
if (expiry && !h.has("expiry")) h.set("expiry", String(expiry));
|
|
5723
|
+
if (accessToken && !h.has("token-type")) h.set("token-type", "Bearer");
|
|
5724
|
+
}
|
|
5725
|
+
/**
|
|
5726
|
+
* Intercepts HTTP responses and updates authentication state if new credentials are received.
|
|
5727
|
+
*/
|
|
5728
|
+
onResponse({ response }) {
|
|
5729
|
+
const accessToken = response.headers.get("access-token");
|
|
5730
|
+
const client2 = response.headers.get("client");
|
|
5731
|
+
const uid = response.headers.get("uid");
|
|
5732
|
+
const expiry = parseInt(response.headers.get("expiry") || "");
|
|
5733
|
+
if (accessToken && client2 && uid && expiry) {
|
|
5734
|
+
this.auth.signIn({ uid, client: client2, accessToken, expiry });
|
|
5735
|
+
}
|
|
5736
|
+
return response;
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
function getCookie(name) {
|
|
5740
|
+
if (typeof document === "undefined") {
|
|
5741
|
+
return void 0;
|
|
5742
|
+
}
|
|
5743
|
+
const value = `; ${document.cookie}`;
|
|
5744
|
+
const parts = value.split(`; ${name}=`);
|
|
5745
|
+
if (parts.length === 2) {
|
|
5746
|
+
const rawValue = parts.pop()?.split(";").shift();
|
|
5747
|
+
return rawValue ? decodeURIComponent(rawValue) : void 0;
|
|
5748
|
+
}
|
|
5749
|
+
return void 0;
|
|
5750
|
+
}
|
|
5751
|
+
class User {
|
|
5752
|
+
get isAuthenticated() {
|
|
5753
|
+
return this.isLoggedIn || this.isGuest;
|
|
5754
|
+
}
|
|
5755
|
+
}
|
|
5756
|
+
class AngularUser extends User {
|
|
5757
|
+
constructor() {
|
|
5758
|
+
super();
|
|
5759
|
+
}
|
|
5760
|
+
get isLoggedIn() {
|
|
5761
|
+
try {
|
|
5762
|
+
const raw = getCookie("auth_headers");
|
|
5763
|
+
if (!raw) return false;
|
|
5764
|
+
const auth2 = JSON.parse(raw);
|
|
5765
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
5766
|
+
if (!auth2["access-token"]) return false;
|
|
5767
|
+
if (parseInt(auth2["expiry"], 10) < now) return false;
|
|
5768
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth2["uid"]);
|
|
5769
|
+
} catch {
|
|
5770
|
+
return false;
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
get isGuest() {
|
|
5774
|
+
if (this.isLoggedIn) return false;
|
|
5775
|
+
try {
|
|
5776
|
+
const raw = getCookie("auth_headers");
|
|
5777
|
+
if (!raw) return true;
|
|
5778
|
+
const auth2 = JSON.parse(raw);
|
|
5779
|
+
return typeof auth2["uid"] === "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth2["uid"]);
|
|
5780
|
+
} catch {
|
|
5781
|
+
return true;
|
|
5782
|
+
}
|
|
5783
|
+
}
|
|
5784
|
+
}
|
|
5785
|
+
class JMBUser extends User {
|
|
5786
|
+
get isGuest() {
|
|
5787
|
+
throw new Error("Not implemented.");
|
|
5788
|
+
}
|
|
5789
|
+
get isLoggedIn() {
|
|
5790
|
+
throw new Error("Not implemented");
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
const getUserProvider = (type) => {
|
|
5794
|
+
switch (type) {
|
|
5795
|
+
case "angular":
|
|
5796
|
+
return new AngularUser();
|
|
5797
|
+
case "jmb":
|
|
5798
|
+
return new JMBUser();
|
|
5799
|
+
default:
|
|
5800
|
+
let never = type;
|
|
5801
|
+
throw new Error("Unhandled shop type: " + never);
|
|
5802
|
+
}
|
|
5803
|
+
};
|
|
5804
|
+
function isEmpty(value) {
|
|
5805
|
+
return value === null || value === void 0 || typeof value === "string" && value.trim() === "";
|
|
5806
|
+
}
|
|
5807
|
+
function validateRequiredFields(body, requiredFields) {
|
|
5808
|
+
const errors2 = {};
|
|
5809
|
+
if (!requiredFields || requiredFields.length === 0) {
|
|
5810
|
+
return errors2;
|
|
5811
|
+
}
|
|
5812
|
+
for (const field of requiredFields) {
|
|
5813
|
+
if (!(field in body) || isEmpty(body[field])) {
|
|
5814
|
+
errors2[field] = [`Field '${field}' is required and cannot be empty`];
|
|
5815
|
+
}
|
|
5816
|
+
}
|
|
5817
|
+
return errors2;
|
|
5818
|
+
}
|
|
5819
|
+
function validateApiPostBody(body, requiredFields) {
|
|
5820
|
+
return validateRequiredFields(body, requiredFields);
|
|
5821
|
+
}
|
|
5568
5822
|
const defaultErrorConfig = {
|
|
5569
5823
|
withStackTrace: false
|
|
5570
5824
|
};
|
|
@@ -6315,316 +6569,69 @@ function defaultPathSerializer(pathname, pathParams) {
|
|
|
6315
6569
|
}
|
|
6316
6570
|
return nextURL;
|
|
6317
6571
|
}
|
|
6318
|
-
function defaultBodySerializer(body) {
|
|
6319
|
-
if (body instanceof FormData) {
|
|
6320
|
-
return body;
|
|
6321
|
-
}
|
|
6322
|
-
return JSON.stringify(body);
|
|
6323
|
-
}
|
|
6324
|
-
function createFinalURL(pathname, options) {
|
|
6325
|
-
let finalURL = `${options.baseUrl}${pathname}`;
|
|
6326
|
-
if (options.params?.path) {
|
|
6327
|
-
finalURL = defaultPathSerializer(finalURL, options.params.path);
|
|
6328
|
-
}
|
|
6329
|
-
let search = options.querySerializer(options.params.query ?? {});
|
|
6330
|
-
if (search.startsWith("?")) {
|
|
6331
|
-
search = search.substring(1);
|
|
6332
|
-
}
|
|
6333
|
-
if (search) {
|
|
6334
|
-
finalURL += `?${search}`;
|
|
6335
|
-
}
|
|
6336
|
-
return finalURL;
|
|
6337
|
-
}
|
|
6338
|
-
function mergeHeaders(...allHeaders) {
|
|
6339
|
-
const finalHeaders = new Headers();
|
|
6340
|
-
for (const h of allHeaders) {
|
|
6341
|
-
if (!h || typeof h !== "object") {
|
|
6342
|
-
continue;
|
|
6343
|
-
}
|
|
6344
|
-
const iterator = h instanceof Headers ? h.entries() : Object.entries(h);
|
|
6345
|
-
for (const [k, v] of iterator) {
|
|
6346
|
-
if (v === null) {
|
|
6347
|
-
finalHeaders.delete(k);
|
|
6348
|
-
} else if (Array.isArray(v)) {
|
|
6349
|
-
for (const v2 of v) {
|
|
6350
|
-
finalHeaders.append(k, v2);
|
|
6351
|
-
}
|
|
6352
|
-
} else if (v !== void 0) {
|
|
6353
|
-
finalHeaders.set(k, v);
|
|
6354
|
-
}
|
|
6355
|
-
}
|
|
6356
|
-
}
|
|
6357
|
-
return finalHeaders;
|
|
6358
|
-
}
|
|
6359
|
-
function removeTrailingSlash(url) {
|
|
6360
|
-
if (url.endsWith("/")) {
|
|
6361
|
-
return url.substring(0, url.length - 1);
|
|
6362
|
-
}
|
|
6363
|
-
return url;
|
|
6364
|
-
}
|
|
6365
|
-
function client(publicApiUrl, shopUrl) {
|
|
6366
|
-
return createClient({ baseUrl: `${publicApiUrl}`, headers: { "X-Shop-Url": shopUrl } });
|
|
6367
|
-
}
|
|
6368
|
-
const TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar";
|
|
6369
|
-
const TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas";
|
|
6370
|
-
const TICKETS_ENDPOINT = "/api/v4/tickets";
|
|
6371
|
-
const SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
|
|
6372
|
-
const SIGN_UP_ENDPOINT = "/api/v4/auth";
|
|
6373
|
-
const CustomerLevels = {
|
|
6374
|
-
// NORMAL: 0,
|
|
6375
|
-
// WIDGET: 5,
|
|
6376
|
-
SHOP_GUEST: 10,
|
|
6377
|
-
SHOP: 20
|
|
6378
|
-
// CASH_POINT: 30,
|
|
6379
|
-
};
|
|
6380
|
-
const isArray = Array.isArray;
|
|
6381
|
-
const isObject$2 = (value) => {
|
|
6382
|
-
return !!value && value.constructor === Object;
|
|
6383
|
-
};
|
|
6384
|
-
const isString = (value) => {
|
|
6385
|
-
return typeof value === "string" || value instanceof String;
|
|
6386
|
-
};
|
|
6387
|
-
const isNumber = (value) => {
|
|
6388
|
-
try {
|
|
6389
|
-
return Number(value) === value;
|
|
6390
|
-
} catch {
|
|
6391
|
-
return false;
|
|
6392
|
-
}
|
|
6393
|
-
};
|
|
6394
|
-
function sum(array2, fn) {
|
|
6395
|
-
return (array2 || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0);
|
|
6396
|
-
}
|
|
6397
|
-
const sort = (array2, getter, desc = false) => {
|
|
6398
|
-
if (!array2)
|
|
6399
|
-
return [];
|
|
6400
|
-
const asc = (a2, b) => getter(a2) - getter(b);
|
|
6401
|
-
const dsc = (a2, b) => getter(b) - getter(a2);
|
|
6402
|
-
return array2.slice().sort(desc === true ? dsc : asc);
|
|
6403
|
-
};
|
|
6404
|
-
const alphabetical = (array2, getter, dir = "asc") => {
|
|
6405
|
-
if (!array2)
|
|
6406
|
-
return [];
|
|
6407
|
-
const asc = (a2, b) => `${getter(a2)}`.localeCompare(getter(b));
|
|
6408
|
-
const dsc = (a2, b) => `${getter(b)}`.localeCompare(getter(a2));
|
|
6409
|
-
return array2.slice().sort(dir === "desc" ? dsc : asc);
|
|
6410
|
-
};
|
|
6411
|
-
const iterate = (count, func, initValue) => {
|
|
6412
|
-
let value = initValue;
|
|
6413
|
-
for (let i = 1; i <= count; i++) {
|
|
6414
|
-
value = func(value, i);
|
|
6415
|
-
}
|
|
6416
|
-
return value;
|
|
6417
|
-
};
|
|
6418
|
-
const omit = (obj, keys2) => {
|
|
6419
|
-
if (!obj)
|
|
6420
|
-
return {};
|
|
6421
|
-
if (!keys2 || keys2.length === 0)
|
|
6422
|
-
return obj;
|
|
6423
|
-
return keys2.reduce(
|
|
6424
|
-
(acc, key) => {
|
|
6425
|
-
delete acc[key];
|
|
6426
|
-
return acc;
|
|
6427
|
-
},
|
|
6428
|
-
{ ...obj }
|
|
6429
|
-
);
|
|
6430
|
-
};
|
|
6431
|
-
const assign = (initial, override) => {
|
|
6432
|
-
if (!initial || !override)
|
|
6433
|
-
return initial ?? override ?? {};
|
|
6434
|
-
return Object.entries({ ...initial, ...override }).reduce(
|
|
6435
|
-
(acc, [key, value]) => {
|
|
6436
|
-
return {
|
|
6437
|
-
...acc,
|
|
6438
|
-
[key]: (() => {
|
|
6439
|
-
if (isObject$2(initial[key]))
|
|
6440
|
-
return assign(initial[key], value);
|
|
6441
|
-
return value;
|
|
6442
|
-
})()
|
|
6443
|
-
};
|
|
6444
|
-
},
|
|
6445
|
-
{}
|
|
6446
|
-
);
|
|
6447
|
-
};
|
|
6448
|
-
class Auth {
|
|
6449
|
-
#data = {
|
|
6450
|
-
uid: "",
|
|
6451
|
-
client: "",
|
|
6452
|
-
accessToken: "",
|
|
6453
|
-
expiry: 0
|
|
6454
|
-
// Unix time (seconds)
|
|
6455
|
-
};
|
|
6456
|
-
constructor() {
|
|
6457
|
-
setInterval(() => this.load(), 1e3);
|
|
6458
|
-
}
|
|
6459
|
-
customerLevel() {
|
|
6460
|
-
if (this.isGuest()) return 10;
|
|
6461
|
-
if (this.isLoggedIn()) return 20;
|
|
6462
|
-
return void 0;
|
|
6463
|
-
}
|
|
6464
|
-
isAuthenticated() {
|
|
6465
|
-
return this.#data.uid !== "";
|
|
6466
|
-
}
|
|
6467
|
-
isLoggedIn() {
|
|
6468
|
-
return Boolean(this.#data.uid && isEmail(this.#data.uid));
|
|
6469
|
-
}
|
|
6470
|
-
isGuest() {
|
|
6471
|
-
return Boolean(this.#data.uid && !isEmail(this.#data.uid));
|
|
6472
|
-
}
|
|
6473
|
-
// This should be manually called whenever we are signing out
|
|
6474
|
-
signOut() {
|
|
6475
|
-
this.#data.uid = "";
|
|
6476
|
-
this.#data.client = "";
|
|
6477
|
-
this.#data.accessToken = "";
|
|
6478
|
-
this.#data.expiry = 0;
|
|
6479
|
-
this.save();
|
|
6480
|
-
}
|
|
6481
|
-
// This happens automatically via the AuthMiddleware
|
|
6482
|
-
signIn(options) {
|
|
6483
|
-
this.#data.uid = options.uid;
|
|
6484
|
-
this.#data.client = options.client;
|
|
6485
|
-
this.#data.accessToken = options.accessToken;
|
|
6486
|
-
this.#data.expiry = options.expiry;
|
|
6487
|
-
this.save();
|
|
6488
|
-
}
|
|
6489
|
-
get data() {
|
|
6490
|
-
if (this.#data.expiry < Math.floor(Date.now() / 1e3)) {
|
|
6491
|
-
this.signOut();
|
|
6492
|
-
}
|
|
6493
|
-
return this.#data;
|
|
6494
|
-
}
|
|
6495
|
-
toString() {
|
|
6496
|
-
return JSON.stringify(this.#data);
|
|
6497
|
-
}
|
|
6498
|
-
save() {
|
|
6499
|
-
localStorage.setItem("go-auth", this.toString());
|
|
6500
|
-
}
|
|
6501
|
-
load() {
|
|
6502
|
-
const str = localStorage.getItem("go-auth");
|
|
6503
|
-
if (!str) {
|
|
6504
|
-
this.signOut();
|
|
6505
|
-
return;
|
|
6506
|
-
}
|
|
6507
|
-
const d = JSON.parse(str);
|
|
6508
|
-
if (!(isObject$2(d) && "uid" in d && "client" in d && "accessToken" in d && "expiry" in d)) {
|
|
6509
|
-
throw new Error(`(Auth.loadFromString) invalid auth json ${str}`);
|
|
6510
|
-
}
|
|
6511
|
-
this.signIn(d);
|
|
6512
|
-
}
|
|
6513
|
-
}
|
|
6514
|
-
const auth = new Auth();
|
|
6515
|
-
class AuthMiddleware {
|
|
6516
|
-
constructor(auth2) {
|
|
6517
|
-
this.auth = auth2;
|
|
6518
|
-
}
|
|
6519
|
-
/**
|
|
6520
|
-
* Intercepts and modifies outgoing HTTP requests by adding authentication headers.
|
|
6521
|
-
*/
|
|
6522
|
-
onRequest({ request }) {
|
|
6523
|
-
const { uid, client: client2, accessToken, expiry } = this.auth.data;
|
|
6524
|
-
const h = request.headers;
|
|
6525
|
-
if (uid && !h.has("uid")) h.set("uid", uid);
|
|
6526
|
-
if (client2 && !h.has("client")) h.set("client", client2);
|
|
6527
|
-
if (accessToken && !h.has("access-token")) h.set("access-token", accessToken);
|
|
6528
|
-
if (expiry && !h.has("expiry")) h.set("expiry", String(expiry));
|
|
6529
|
-
if (accessToken && !h.has("token-type")) h.set("token-type", "Bearer");
|
|
6530
|
-
}
|
|
6531
|
-
/**
|
|
6532
|
-
* Intercepts HTTP responses and updates authentication state if new credentials are received.
|
|
6533
|
-
*/
|
|
6534
|
-
onResponse({ response }) {
|
|
6535
|
-
const accessToken = response.headers.get("access-token");
|
|
6536
|
-
const client2 = response.headers.get("client");
|
|
6537
|
-
const uid = response.headers.get("uid");
|
|
6538
|
-
const expiry = parseInt(response.headers.get("expiry") || "");
|
|
6539
|
-
if (accessToken && client2 && uid && expiry) {
|
|
6540
|
-
this.auth.signIn({ uid, client: client2, accessToken, expiry });
|
|
6541
|
-
}
|
|
6542
|
-
return response;
|
|
6543
|
-
}
|
|
6544
|
-
}
|
|
6545
|
-
function getCookie(name) {
|
|
6546
|
-
if (typeof document === "undefined") {
|
|
6547
|
-
return void 0;
|
|
6548
|
-
}
|
|
6549
|
-
const value = `; ${document.cookie}`;
|
|
6550
|
-
const parts = value.split(`; ${name}=`);
|
|
6551
|
-
if (parts.length === 2) {
|
|
6552
|
-
const rawValue = parts.pop()?.split(";").shift();
|
|
6553
|
-
return rawValue ? decodeURIComponent(rawValue) : void 0;
|
|
6554
|
-
}
|
|
6555
|
-
return void 0;
|
|
6556
|
-
}
|
|
6557
|
-
class User {
|
|
6558
|
-
get isAuthenticated() {
|
|
6559
|
-
return this.isLoggedIn || this.isGuest;
|
|
6560
|
-
}
|
|
6561
|
-
}
|
|
6562
|
-
class AngularUser extends User {
|
|
6563
|
-
constructor() {
|
|
6564
|
-
super();
|
|
6565
|
-
}
|
|
6566
|
-
get isLoggedIn() {
|
|
6567
|
-
try {
|
|
6568
|
-
const raw = getCookie("auth_headers");
|
|
6569
|
-
if (!raw) return false;
|
|
6570
|
-
const auth2 = JSON.parse(raw);
|
|
6571
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
6572
|
-
if (!auth2["access-token"]) return false;
|
|
6573
|
-
if (parseInt(auth2["expiry"], 10) < now) return false;
|
|
6574
|
-
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth2["uid"]);
|
|
6575
|
-
} catch {
|
|
6576
|
-
return false;
|
|
6577
|
-
}
|
|
6578
|
-
}
|
|
6579
|
-
get isGuest() {
|
|
6580
|
-
if (this.isLoggedIn) return false;
|
|
6581
|
-
try {
|
|
6582
|
-
const raw = getCookie("auth_headers");
|
|
6583
|
-
if (!raw) return true;
|
|
6584
|
-
const auth2 = JSON.parse(raw);
|
|
6585
|
-
return typeof auth2["uid"] === "string" && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(auth2["uid"]);
|
|
6586
|
-
} catch {
|
|
6587
|
-
return true;
|
|
6588
|
-
}
|
|
6572
|
+
function defaultBodySerializer(body) {
|
|
6573
|
+
if (body instanceof FormData) {
|
|
6574
|
+
return body;
|
|
6589
6575
|
}
|
|
6576
|
+
return JSON.stringify(body);
|
|
6590
6577
|
}
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6578
|
+
function createFinalURL(pathname, options) {
|
|
6579
|
+
let finalURL = `${options.baseUrl}${pathname}`;
|
|
6580
|
+
if (options.params?.path) {
|
|
6581
|
+
finalURL = defaultPathSerializer(finalURL, options.params.path);
|
|
6594
6582
|
}
|
|
6595
|
-
|
|
6596
|
-
|
|
6583
|
+
let search = options.querySerializer(options.params.query ?? {});
|
|
6584
|
+
if (search.startsWith("?")) {
|
|
6585
|
+
search = search.substring(1);
|
|
6597
6586
|
}
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
switch (type) {
|
|
6601
|
-
case "angular":
|
|
6602
|
-
return new AngularUser();
|
|
6603
|
-
case "jmb":
|
|
6604
|
-
return new JMBUser();
|
|
6605
|
-
default:
|
|
6606
|
-
let never = type;
|
|
6607
|
-
throw new Error("Unhandled shop type: " + never);
|
|
6587
|
+
if (search) {
|
|
6588
|
+
finalURL += `?${search}`;
|
|
6608
6589
|
}
|
|
6609
|
-
|
|
6610
|
-
function isEmpty(value) {
|
|
6611
|
-
return value === null || value === void 0 || typeof value === "string" && value.trim() === "";
|
|
6590
|
+
return finalURL;
|
|
6612
6591
|
}
|
|
6613
|
-
function
|
|
6614
|
-
const
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6592
|
+
function mergeHeaders(...allHeaders) {
|
|
6593
|
+
const finalHeaders = new Headers();
|
|
6594
|
+
for (const h of allHeaders) {
|
|
6595
|
+
if (!h || typeof h !== "object") {
|
|
6596
|
+
continue;
|
|
6597
|
+
}
|
|
6598
|
+
const iterator = h instanceof Headers ? h.entries() : Object.entries(h);
|
|
6599
|
+
for (const [k, v] of iterator) {
|
|
6600
|
+
if (v === null) {
|
|
6601
|
+
finalHeaders.delete(k);
|
|
6602
|
+
} else if (Array.isArray(v)) {
|
|
6603
|
+
for (const v2 of v) {
|
|
6604
|
+
finalHeaders.append(k, v2);
|
|
6605
|
+
}
|
|
6606
|
+
} else if (v !== void 0) {
|
|
6607
|
+
finalHeaders.set(k, v);
|
|
6608
|
+
}
|
|
6621
6609
|
}
|
|
6622
6610
|
}
|
|
6623
|
-
return
|
|
6611
|
+
return finalHeaders;
|
|
6624
6612
|
}
|
|
6625
|
-
function
|
|
6626
|
-
|
|
6613
|
+
function removeTrailingSlash(url) {
|
|
6614
|
+
if (url.endsWith("/")) {
|
|
6615
|
+
return url.substring(0, url.length - 1);
|
|
6616
|
+
}
|
|
6617
|
+
return url;
|
|
6618
|
+
}
|
|
6619
|
+
function client(publicApiUrl, shopUrl) {
|
|
6620
|
+
return createClient({ baseUrl: `${publicApiUrl}`, headers: { "X-Shop-Url": shopUrl } });
|
|
6627
6621
|
}
|
|
6622
|
+
const CALENDAR_ENDPOINT = "/api/v4/calendar";
|
|
6623
|
+
const TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar";
|
|
6624
|
+
const TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas";
|
|
6625
|
+
const TICKETS_ENDPOINT = "/api/v4/tickets";
|
|
6626
|
+
const SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
|
|
6627
|
+
const SIGN_UP_ENDPOINT = "/api/v4/auth";
|
|
6628
|
+
const CustomerLevels = {
|
|
6629
|
+
// NORMAL: 0,
|
|
6630
|
+
// WIDGET: 5,
|
|
6631
|
+
SHOP_GUEST: 10,
|
|
6632
|
+
SHOP: 20
|
|
6633
|
+
// CASH_POINT: 30,
|
|
6634
|
+
};
|
|
6628
6635
|
var util;
|
|
6629
6636
|
(function(util2) {
|
|
6630
6637
|
util2.assertEqual = (val) => val;
|
|
@@ -11902,6 +11909,9 @@ class Shop {
|
|
|
11902
11909
|
ticketsCalendar(params) {
|
|
11903
11910
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", { cache: 60, query: params });
|
|
11904
11911
|
}
|
|
11912
|
+
calendar(params) {
|
|
11913
|
+
return this.fetchAndCache(CALENDAR_ENDPOINT, `calendar-${JSON.stringify(params)}`, "data", { cache: 60, query: params });
|
|
11914
|
+
}
|
|
11905
11915
|
ticketsAndQuotas(params) {
|
|
11906
11916
|
return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
|
|
11907
11917
|
}
|
|
@@ -11963,7 +11973,7 @@ class Shop {
|
|
|
11963
11973
|
options.cache ??= 1e3;
|
|
11964
11974
|
options.path ??= {};
|
|
11965
11975
|
if (!this.#canFetch()) {
|
|
11966
|
-
console.warn("(fetchAndCache) Shop not loaded!");
|
|
11976
|
+
console.warn("(fetchAndCache) Couldn't fetch, Shop not loaded!");
|
|
11967
11977
|
return get$2(this.#data)[dataKey];
|
|
11968
11978
|
}
|
|
11969
11979
|
const query = assign(options.query, { per_page: 1e3 });
|
|
@@ -11977,6 +11987,11 @@ class Shop {
|
|
|
11977
11987
|
}
|
|
11978
11988
|
return get$2(this.#data)[dataKey];
|
|
11979
11989
|
}
|
|
11990
|
+
clearCache() {
|
|
11991
|
+
console.log("CLEAR CACHE");
|
|
11992
|
+
this.#fetchStatus = {};
|
|
11993
|
+
set(this.#data, {}, true);
|
|
11994
|
+
}
|
|
11980
11995
|
get museums() {
|
|
11981
11996
|
return this.fetchAndCache("/api/v4/museums", "museums", "museums");
|
|
11982
11997
|
}
|
|
@@ -11986,6 +12001,9 @@ class Shop {
|
|
|
11986
12001
|
getEvent(id) {
|
|
11987
12002
|
return this.fetchAndCache(`/api/v4/events/${id}`, `single_event_${id}`, "event");
|
|
11988
12003
|
}
|
|
12004
|
+
getEventDetailsOnDate(eventId, dateId) {
|
|
12005
|
+
return this.fetchAndCache(`/api/v4/events/${eventId}/dates/${dateId}`, `/api/v4/events/${eventId}/dates/${dateId}`, "date");
|
|
12006
|
+
}
|
|
11989
12007
|
get events() {
|
|
11990
12008
|
return this.fetchAndCache("/api/v4/events", "events", "events");
|
|
11991
12009
|
}
|
|
@@ -12555,7 +12573,7 @@ const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
|
12555
12573
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
12556
12574
|
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
12557
12575
|
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
12558
|
-
const uuid$
|
|
12576
|
+
const uuid$2 = (version2) => {
|
|
12559
12577
|
if (!version2)
|
|
12560
12578
|
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
12561
12579
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
@@ -12982,9 +13000,9 @@ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
12982
13000
|
const v = versionMap[def.version];
|
|
12983
13001
|
if (v === void 0)
|
|
12984
13002
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
12985
|
-
def.pattern ?? (def.pattern = uuid$
|
|
13003
|
+
def.pattern ?? (def.pattern = uuid$2(v));
|
|
12986
13004
|
} else
|
|
12987
|
-
def.pattern ?? (def.pattern = uuid$
|
|
13005
|
+
def.pattern ?? (def.pattern = uuid$2());
|
|
12988
13006
|
$ZodStringFormat.init(inst, def);
|
|
12989
13007
|
});
|
|
12990
13008
|
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
@@ -15024,6 +15042,7 @@ class FormDetails {
|
|
|
15024
15042
|
* @param {string[] | Record<string, string[]>} errors - Errors passed as an array or an object where keys are API field keys and values are arrays of error messages. If an array is provided, it assigns the errors directly. If an object is provided, it maps the errors to the respective fields based on their API keys.
|
|
15025
15043
|
*/
|
|
15026
15044
|
set apiErrors(errors2) {
|
|
15045
|
+
get$2(this.#fields).forEach((f) => f.apiErrors = []);
|
|
15027
15046
|
if (isArray(errors2)) {
|
|
15028
15047
|
set(this.#apiErrors, errors2, true);
|
|
15029
15048
|
return;
|
|
@@ -15072,7 +15091,7 @@ const KEY$3 = "go-form-details";
|
|
|
15072
15091
|
const setDetails$1 = createSetDetails(KEY$3);
|
|
15073
15092
|
const getDetails$1 = createGetDetails(KEY$3);
|
|
15074
15093
|
function wrapInElement(host, tag, props) {
|
|
15075
|
-
const first = host.firstElementChild;
|
|
15094
|
+
const first = host.firstElementChild || void 0;
|
|
15076
15095
|
if (host.children?.length === 1 && first?.tagName.toLowerCase() === tag) {
|
|
15077
15096
|
return first;
|
|
15078
15097
|
}
|
|
@@ -15103,8 +15122,10 @@ function Form($$anchor, $$props) {
|
|
|
15103
15122
|
async function handleSubmit(event) {
|
|
15104
15123
|
event.preventDefault();
|
|
15105
15124
|
details.validateForm();
|
|
15106
|
-
details?.form?.dispatchEvent(new Event("after-validation", event));
|
|
15125
|
+
details?.form?.dispatchEvent(new Event("go-after-validation", event));
|
|
15107
15126
|
if (details.isValid) {
|
|
15127
|
+
console.log("hoo");
|
|
15128
|
+
details.apiErrors = {};
|
|
15108
15129
|
details?.form?.dispatchEvent(new Event("go-submit", event));
|
|
15109
15130
|
}
|
|
15110
15131
|
}
|
|
@@ -15291,7 +15312,7 @@ customElements.define("go-sign-up", create_custom_element(
|
|
|
15291
15312
|
[],
|
|
15292
15313
|
false
|
|
15293
15314
|
));
|
|
15294
|
-
function
|
|
15315
|
+
function dispatchCartEvents() {
|
|
15295
15316
|
let lastLength = 0;
|
|
15296
15317
|
effect_root(() => {
|
|
15297
15318
|
user_effect(() => {
|
|
@@ -15304,7 +15325,37 @@ function dispathCartEvents() {
|
|
|
15304
15325
|
});
|
|
15305
15326
|
});
|
|
15306
15327
|
}
|
|
15307
|
-
function
|
|
15328
|
+
function isUIEventTicket(x) {
|
|
15329
|
+
return x.product_type === "Event";
|
|
15330
|
+
}
|
|
15331
|
+
let uuid$1 = 1;
|
|
15332
|
+
function createUIEventTicket(apiTicket, dateId, options) {
|
|
15333
|
+
const finalOptions = { minAvailableCapacity: 0, selectedTime: "", ...{} };
|
|
15334
|
+
const product = {
|
|
15335
|
+
product_type: "Event",
|
|
15336
|
+
id: dateId,
|
|
15337
|
+
tax_included: true,
|
|
15338
|
+
...apiTicket
|
|
15339
|
+
};
|
|
15340
|
+
const uiTicket = {
|
|
15341
|
+
uid: uuid$1++,
|
|
15342
|
+
...product,
|
|
15343
|
+
...apiTicket,
|
|
15344
|
+
...finalOptions,
|
|
15345
|
+
type: "scale",
|
|
15346
|
+
get max_capacity() {
|
|
15347
|
+
return 18;
|
|
15348
|
+
},
|
|
15349
|
+
get min_quantity() {
|
|
15350
|
+
return 0;
|
|
15351
|
+
},
|
|
15352
|
+
get max_quantity() {
|
|
15353
|
+
return 18;
|
|
15354
|
+
}
|
|
15355
|
+
};
|
|
15356
|
+
return uiTicket;
|
|
15357
|
+
}
|
|
15358
|
+
function createCartItem(product, options) {
|
|
15308
15359
|
const finalOptions = {
|
|
15309
15360
|
quantity: 0,
|
|
15310
15361
|
time: "",
|
|
@@ -15312,26 +15363,56 @@ function createCartItem(ticket, options) {
|
|
|
15312
15363
|
};
|
|
15313
15364
|
return {
|
|
15314
15365
|
...finalOptions,
|
|
15315
|
-
type:
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15366
|
+
type: product.product_type,
|
|
15367
|
+
product,
|
|
15368
|
+
/**
|
|
15369
|
+
* is passed to the Order API
|
|
15370
|
+
*/
|
|
15371
|
+
orderAttributes() {
|
|
15372
|
+
const base = {
|
|
15373
|
+
shipped_with_merchandise_id: null,
|
|
15374
|
+
shipping_mode: "email"
|
|
15322
15375
|
};
|
|
15376
|
+
switch (this.type) {
|
|
15377
|
+
case "Ticket":
|
|
15378
|
+
return {
|
|
15379
|
+
id: this.product.id,
|
|
15380
|
+
time: this.time,
|
|
15381
|
+
quantity: this.quantity,
|
|
15382
|
+
...base
|
|
15383
|
+
};
|
|
15384
|
+
case "Event":
|
|
15385
|
+
if (!isUIEventTicket(this.product)) {
|
|
15386
|
+
throw new Error("Event ticket is not a scale ticket");
|
|
15387
|
+
}
|
|
15388
|
+
const scaleTicket = this.product;
|
|
15389
|
+
return {
|
|
15390
|
+
id: this.product.id,
|
|
15391
|
+
quantities: { [scaleTicket.scale_price_id]: this.quantity },
|
|
15392
|
+
...base
|
|
15393
|
+
};
|
|
15394
|
+
default:
|
|
15395
|
+
const exhastedChecking = this.type;
|
|
15396
|
+
throw new Error(`(orderAttributes) Unhandled case: ${exhastedChecking}`);
|
|
15397
|
+
}
|
|
15323
15398
|
},
|
|
15324
15399
|
get uuid() {
|
|
15325
|
-
return this.type + "-" + this.
|
|
15400
|
+
return this.type + "-" + this.product.id + this.subId;
|
|
15401
|
+
},
|
|
15402
|
+
get subId() {
|
|
15403
|
+
if (isUIEventTicket(this.product)) {
|
|
15404
|
+
return ` (scale_price: ${this.product.scale_price_id})`;
|
|
15405
|
+
}
|
|
15406
|
+
return "";
|
|
15326
15407
|
},
|
|
15327
15408
|
get price_cents() {
|
|
15328
|
-
return this.
|
|
15409
|
+
return this.product.price_cents;
|
|
15329
15410
|
},
|
|
15330
15411
|
get price_formatted() {
|
|
15331
15412
|
return formatCurrency(this.price_cents);
|
|
15332
15413
|
},
|
|
15333
15414
|
get final_price_cents() {
|
|
15334
|
-
const taxFactor = this.
|
|
15415
|
+
const taxFactor = this.product.tax_included ? 1 : 1 + this.product.vat_pct / 100;
|
|
15335
15416
|
return this.price_cents * taxFactor;
|
|
15336
15417
|
},
|
|
15337
15418
|
get final_price_formatted() {
|
|
@@ -15346,49 +15427,26 @@ function createCartItem(ticket, options) {
|
|
|
15346
15427
|
};
|
|
15347
15428
|
}
|
|
15348
15429
|
let uuid = 1;
|
|
15430
|
+
function isUITicket(x) {
|
|
15431
|
+
return x.product_type === "Ticket";
|
|
15432
|
+
}
|
|
15349
15433
|
function createUITicket(apiTicket, options) {
|
|
15350
|
-
const finalOptions = {
|
|
15351
|
-
|
|
15352
|
-
selectedTime: "",
|
|
15353
|
-
quantity: 0,
|
|
15354
|
-
...options ?? {}
|
|
15355
|
-
};
|
|
15434
|
+
const finalOptions = { minAvailableCapacity: 0, selectedTime: "", ...options ?? {} };
|
|
15435
|
+
const product = { product_type: "Ticket", ...apiTicket };
|
|
15356
15436
|
const _ = { ...apiTicket, ...finalOptions };
|
|
15357
15437
|
const uiTicket = {
|
|
15358
15438
|
uid: uuid++,
|
|
15439
|
+
...product,
|
|
15359
15440
|
..._,
|
|
15360
|
-
|
|
15441
|
+
product_type: "Ticket",
|
|
15361
15442
|
type: { time_slot: "timeslot", normal: "day", annual: "annual" }[_.ticket_type],
|
|
15362
|
-
shop_order: _.shop_order ?? 0
|
|
15363
|
-
get max_capacity() {
|
|
15364
|
-
return max_capacity(this);
|
|
15365
|
-
},
|
|
15366
|
-
get min_quantity() {
|
|
15367
|
-
return this.min_persons;
|
|
15368
|
-
},
|
|
15369
|
-
get max_quantity() {
|
|
15370
|
-
return Math.min(this.max_persons, this.max_capacity);
|
|
15371
|
-
}
|
|
15443
|
+
shop_order: _.shop_order ?? 0
|
|
15372
15444
|
};
|
|
15373
15445
|
return uiTicket;
|
|
15374
15446
|
}
|
|
15375
15447
|
function initUITimeslotTickets(tickets) {
|
|
15376
15448
|
return sort(Object.values(tickets).map((ticket) => createUITicket(ticket)), (f) => f.shop_order);
|
|
15377
15449
|
}
|
|
15378
|
-
function max_capacity(ticket) {
|
|
15379
|
-
switch (ticket.type) {
|
|
15380
|
-
case "timeslot":
|
|
15381
|
-
const timeslotTicket = ticket;
|
|
15382
|
-
return (timeslotTicket.capacities ? Math.max(0, ...Object.values(timeslotTicket.capacities)) : timeslotTicket.max_persons) + ticket.quantity;
|
|
15383
|
-
case "annual":
|
|
15384
|
-
return ticket.max_persons;
|
|
15385
|
-
case "day":
|
|
15386
|
-
return ticket.max_persons;
|
|
15387
|
-
default:
|
|
15388
|
-
const exhastedChecking = ticket.type;
|
|
15389
|
-
throw new Error(`(max_capacity) Unhandled case: ${exhastedChecking}`);
|
|
15390
|
-
}
|
|
15391
|
-
}
|
|
15392
15450
|
function updateLocalStorage(cart2) {
|
|
15393
15451
|
const content = JSON.stringify(cart2.items || []);
|
|
15394
15452
|
localStorage.setItem("go-cart", content);
|
|
@@ -15398,12 +15456,12 @@ function generateCartItem(cartItem) {
|
|
|
15398
15456
|
const type = cartItem.type;
|
|
15399
15457
|
switch (type) {
|
|
15400
15458
|
case "Ticket":
|
|
15401
|
-
if (cartItem.
|
|
15402
|
-
const ticket = createUITicket(cartItem.
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
|
|
15406
|
-
return createCartItem(
|
|
15459
|
+
if (cartItem.product.ticket_type === "timeslot" && !inTheFuture(cartItem.attributes.time)) return;
|
|
15460
|
+
const ticket = createUITicket(cartItem.product, { minAvailableCapacity: 0 });
|
|
15461
|
+
return createCartItem(ticket, { time: cartItem.time, quantity: cartItem.quantity });
|
|
15462
|
+
case "Event":
|
|
15463
|
+
const event = createUIEventTicket(cartItem.product, cartItem.id);
|
|
15464
|
+
return createCartItem(event, { time: cartItem.time, quantity: cartItem.quantity });
|
|
15407
15465
|
default:
|
|
15408
15466
|
const _exhaustiveCheck = type;
|
|
15409
15467
|
throw new Error(`Unhandled case: ${_exhaustiveCheck}`);
|
|
@@ -15419,7 +15477,10 @@ function loadFromLocalStorage(cart2) {
|
|
|
15419
15477
|
console.dir({ lsItems, content });
|
|
15420
15478
|
throw new Error("go-cart is not an array");
|
|
15421
15479
|
}
|
|
15422
|
-
if (lsItems.length === 0)
|
|
15480
|
+
if (lsItems.length === 0) {
|
|
15481
|
+
cart2.clearItems();
|
|
15482
|
+
return [];
|
|
15483
|
+
}
|
|
15423
15484
|
cart2.items = lsItems.map(generateCartItem).filter(defined);
|
|
15424
15485
|
return cart2.items;
|
|
15425
15486
|
} catch (e) {
|
|
@@ -15459,10 +15520,12 @@ const inTheFuture = (time2) => {
|
|
|
15459
15520
|
};
|
|
15460
15521
|
const defined = (x) => x !== void 0;
|
|
15461
15522
|
let lastUuid = 0;
|
|
15462
|
-
function createCart(
|
|
15523
|
+
function createCart(products, contingent = 20) {
|
|
15463
15524
|
const items = proxy([]);
|
|
15464
15525
|
const cart2 = {
|
|
15465
15526
|
items,
|
|
15527
|
+
// caps the total number of items in the cart
|
|
15528
|
+
contingent,
|
|
15466
15529
|
uid: `cart-${lastUuid++}`,
|
|
15467
15530
|
get nonEmptyItems() {
|
|
15468
15531
|
return this.items.filter((i) => i.quantity > 0);
|
|
@@ -15470,16 +15533,12 @@ function createCart(tickets, options) {
|
|
|
15470
15533
|
get totalPriceCents() {
|
|
15471
15534
|
return Math.max(0, sum(this.items, (item) => item.total_price_cents));
|
|
15472
15535
|
},
|
|
15473
|
-
|
|
15536
|
+
get totalQuantity() {
|
|
15537
|
+
return sum(this.items, (item) => item.quantity);
|
|
15538
|
+
},
|
|
15539
|
+
orderData() {
|
|
15474
15540
|
return {
|
|
15475
|
-
items: this.items.map((item) => ({
|
|
15476
|
-
type: item.type,
|
|
15477
|
-
attributes: {
|
|
15478
|
-
...item.attributes,
|
|
15479
|
-
shipped_with_merchandise_id: null,
|
|
15480
|
-
shipping_mode: "email"
|
|
15481
|
-
}
|
|
15482
|
-
})),
|
|
15541
|
+
items: this.items.map((item) => ({ type: item.type, attributes: item.orderAttributes() })),
|
|
15483
15542
|
shipping_address_id: null,
|
|
15484
15543
|
comment: null,
|
|
15485
15544
|
reference: null,
|
|
@@ -15509,16 +15568,16 @@ function createCart(tickets, options) {
|
|
|
15509
15568
|
items2.forEach((item) => this.addItem(item));
|
|
15510
15569
|
}
|
|
15511
15570
|
};
|
|
15512
|
-
if (
|
|
15571
|
+
if (products) products.forEach((p2) => cart2.addItem(createCartItem(p2)));
|
|
15513
15572
|
return cart2;
|
|
15514
15573
|
}
|
|
15515
15574
|
function formatCurrency(priceCents) {
|
|
15516
15575
|
priceCents = priceCents ?? 0;
|
|
15517
15576
|
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(priceCents / 100);
|
|
15518
15577
|
}
|
|
15519
|
-
const cart = proxy(createCart([]));
|
|
15578
|
+
const cart = proxy(createCart([], { syncLocalStorage: true }));
|
|
15520
15579
|
syncCartToLocalStorage(cart);
|
|
15521
|
-
|
|
15580
|
+
dispatchCartEvents();
|
|
15522
15581
|
var root_2$q = /* @__PURE__ */ from_html(`<li data-go-cart-header-remove="">remove</li>`);
|
|
15523
15582
|
var root_5$2 = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`);
|
|
15524
15583
|
var root_4$5 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
|
|
@@ -15587,20 +15646,20 @@ function Cart($$anchor, $$props) {
|
|
|
15587
15646
|
var span_2 = root_5$2();
|
|
15588
15647
|
var text_2 = child(span_2, true);
|
|
15589
15648
|
reset(span_2);
|
|
15590
|
-
template_effect(($0) => set_text(text_2, $0), [() => formatTime(get$2(cartItem).
|
|
15649
|
+
template_effect(($0) => set_text(text_2, $0), [() => formatTime(get$2(cartItem).time)]);
|
|
15591
15650
|
append($$anchor5, span_2);
|
|
15592
15651
|
};
|
|
15593
15652
|
if_block(node_4, ($$render) => {
|
|
15594
|
-
if (get$2(cartItem).
|
|
15653
|
+
if (get$2(cartItem).product.type === "timeslot") $$render(consequent_1);
|
|
15595
15654
|
});
|
|
15596
15655
|
}
|
|
15597
15656
|
template_effect(($0) => set_text(text_1, $0), [
|
|
15598
|
-
() => formatDate(get$2(cartItem).
|
|
15657
|
+
() => formatDate(get$2(cartItem).time, { month: "numeric", day: "numeric" }, shop.locale)
|
|
15599
15658
|
]);
|
|
15600
15659
|
append($$anchor4, fragment_2);
|
|
15601
15660
|
};
|
|
15602
15661
|
if_block(node_3, ($$render) => {
|
|
15603
|
-
if (get$2(cartItem).
|
|
15662
|
+
if (get$2(cartItem).product.type === "timeslot" && get$2(cartItem).time) $$render(consequent_2);
|
|
15604
15663
|
});
|
|
15605
15664
|
}
|
|
15606
15665
|
reset(li_3);
|
|
@@ -15631,7 +15690,7 @@ function Cart($$anchor, $$props) {
|
|
|
15631
15690
|
reset(li_2);
|
|
15632
15691
|
template_effect(() => {
|
|
15633
15692
|
set_attribute(article, "data-testid", get$2(cartItem).uuid);
|
|
15634
|
-
set_text(text2, get$2(cartItem).
|
|
15693
|
+
set_text(text2, get$2(cartItem).product.title);
|
|
15635
15694
|
set_text(text_3, get$2(cartItem).final_price_formatted);
|
|
15636
15695
|
set_text(text_4, get$2(cartItem).quantity);
|
|
15637
15696
|
set_text(text_5, get$2(cartItem).total_price_formatted);
|
|
@@ -15718,7 +15777,7 @@ function CheckoutForm($$anchor, $$props) {
|
|
|
15718
15777
|
form.details.apiErrors = auth2.error.errors;
|
|
15719
15778
|
return;
|
|
15720
15779
|
}
|
|
15721
|
-
const checkout = await shop.checkout(cart.
|
|
15780
|
+
const checkout = await shop.checkout(cart.orderData());
|
|
15722
15781
|
if (checkout.error) {
|
|
15723
15782
|
form.details.apiErrors = checkout.error;
|
|
15724
15783
|
return;
|
|
@@ -21610,7 +21669,7 @@ class CalendarHeaderState {
|
|
|
21610
21669
|
}
|
|
21611
21670
|
}
|
|
21612
21671
|
var root_2$p = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
21613
|
-
function Calendar$
|
|
21672
|
+
function Calendar$1($$anchor, $$props) {
|
|
21614
21673
|
push($$props, true);
|
|
21615
21674
|
let child$1 = prop($$props, "child", 7), children = prop($$props, "children", 7), id = prop($$props, "id", 23, useId), ref = prop($$props, "ref", 15, null), value = prop($$props, "value", 15), onValueChange = prop($$props, "onValueChange", 7, noop), placeholder = prop($$props, "placeholder", 15), onPlaceholderChange = prop($$props, "onPlaceholderChange", 7, noop), weekdayFormat = prop($$props, "weekdayFormat", 7, "narrow"), weekStartsOn = prop($$props, "weekStartsOn", 7), pagedNavigation = prop($$props, "pagedNavigation", 7, false), isDateDisabled = prop($$props, "isDateDisabled", 7, () => false), isDateUnavailable = prop($$props, "isDateUnavailable", 7, () => false), fixedWeeks = prop($$props, "fixedWeeks", 7, false), numberOfMonths = prop($$props, "numberOfMonths", 7, 1), locale = prop($$props, "locale", 7), calendarLabel = prop($$props, "calendarLabel", 7, "Event"), disabled = prop($$props, "disabled", 7, false), readonly2 = prop($$props, "readonly", 7, false), minValue = prop($$props, "minValue", 7, void 0), maxValue = prop($$props, "maxValue", 7, void 0), preventDeselect = prop($$props, "preventDeselect", 7, false), type = prop($$props, "type", 7), disableDaysOutsideMonth = prop($$props, "disableDaysOutsideMonth", 7, true), initialFocus = prop($$props, "initialFocus", 7, false), maxDays = prop($$props, "maxDays", 7), monthFormat = prop($$props, "monthFormat", 7, "long"), yearFormat = prop($$props, "yearFormat", 7, "numeric"), restProps = /* @__PURE__ */ rest_props($$props, [
|
|
21616
21675
|
"$$slots",
|
|
@@ -21924,7 +21983,7 @@ function Calendar$2($$anchor, $$props) {
|
|
|
21924
21983
|
return pop($$exports);
|
|
21925
21984
|
}
|
|
21926
21985
|
create_custom_element(
|
|
21927
|
-
Calendar$
|
|
21986
|
+
Calendar$1,
|
|
21928
21987
|
{
|
|
21929
21988
|
child: {},
|
|
21930
21989
|
children: {},
|
|
@@ -30237,7 +30296,7 @@ function ErrorsFeedback($$anchor, $$props) {
|
|
|
30237
30296
|
const _details = getDetails$1($$props.$$host);
|
|
30238
30297
|
const details = /* @__PURE__ */ user_derived(() => _details.value);
|
|
30239
30298
|
user_effect(() => {
|
|
30240
|
-
get$2(details)?.form?.addEventListener("after-validation", () => {
|
|
30299
|
+
get$2(details)?.form?.addEventListener("go-after-validation", () => {
|
|
30241
30300
|
set(errorsOnSubmit, errors(get$2(details)?.fields), true);
|
|
30242
30301
|
});
|
|
30243
30302
|
});
|
|
@@ -30378,7 +30437,7 @@ function evaluateExpression(expression, data) {
|
|
|
30378
30437
|
console.log(`Error while evaluating when (${expression}) in go-if: ${error.message}`);
|
|
30379
30438
|
}
|
|
30380
30439
|
}
|
|
30381
|
-
const validTicketSelectionFilters = ["timeslot", "day", "annual"];
|
|
30440
|
+
const validTicketSelectionFilters = ["timeslot", "day", "annual", "scaled-price"];
|
|
30382
30441
|
let lastUId = 0;
|
|
30383
30442
|
class TicketSelectionDetails {
|
|
30384
30443
|
uid = lastUId++;
|
|
@@ -30396,19 +30455,12 @@ class TicketSelectionDetails {
|
|
|
30396
30455
|
set filters(value) {
|
|
30397
30456
|
set(this.#filters, value, true);
|
|
30398
30457
|
}
|
|
30399
|
-
#
|
|
30400
|
-
get
|
|
30401
|
-
return get$2(this.#
|
|
30458
|
+
#eventIds = /* @__PURE__ */ state();
|
|
30459
|
+
get eventIds() {
|
|
30460
|
+
return get$2(this.#eventIds);
|
|
30402
30461
|
}
|
|
30403
|
-
set
|
|
30404
|
-
set(this.#
|
|
30405
|
-
}
|
|
30406
|
-
#eventId = /* @__PURE__ */ state();
|
|
30407
|
-
get eventId() {
|
|
30408
|
-
return get$2(this.#eventId);
|
|
30409
|
-
}
|
|
30410
|
-
set eventId(value) {
|
|
30411
|
-
set(this.#eventId, value, true);
|
|
30462
|
+
set eventIds(value) {
|
|
30463
|
+
set(this.#eventIds, value, true);
|
|
30412
30464
|
}
|
|
30413
30465
|
#museumIds = /* @__PURE__ */ state();
|
|
30414
30466
|
get museumIds() {
|
|
@@ -30452,24 +30504,25 @@ class TicketSelectionDetails {
|
|
|
30452
30504
|
set selectedTimeslot(value) {
|
|
30453
30505
|
set(this.#selectedTimeslot, value, true);
|
|
30454
30506
|
}
|
|
30455
|
-
#
|
|
30456
|
-
get
|
|
30457
|
-
return get$2(this.#
|
|
30507
|
+
#ticketSegments = /* @__PURE__ */ state(proxy([]));
|
|
30508
|
+
get ticketSegments() {
|
|
30509
|
+
return get$2(this.#ticketSegments);
|
|
30458
30510
|
}
|
|
30459
|
-
set
|
|
30460
|
-
set(this.#
|
|
30511
|
+
set ticketSegments(value) {
|
|
30512
|
+
set(this.#ticketSegments, value, true);
|
|
30461
30513
|
}
|
|
30462
|
-
#preCarts = /* @__PURE__ */ user_derived(() => this.
|
|
30514
|
+
#preCarts = /* @__PURE__ */ user_derived(() => this.ticketSegments.map((tg) => tg.preCart));
|
|
30463
30515
|
get preCarts() {
|
|
30464
30516
|
return get$2(this.#preCarts);
|
|
30465
30517
|
}
|
|
30466
30518
|
set preCarts(value) {
|
|
30467
30519
|
set(this.#preCarts, value);
|
|
30468
30520
|
}
|
|
30469
|
-
|
|
30470
|
-
this.
|
|
30521
|
+
addTicketSegment(ticketGroup) {
|
|
30522
|
+
this.ticketSegments.push(ticketGroup);
|
|
30471
30523
|
}
|
|
30472
30524
|
get isTimeslotsVisible() {
|
|
30525
|
+
if (this.mode === "event") return false;
|
|
30473
30526
|
return Boolean(this.filters?.includes("timeslot") && this.selectedDate);
|
|
30474
30527
|
}
|
|
30475
30528
|
get isTicketsVisible() {
|
|
@@ -30479,11 +30532,25 @@ class TicketSelectionDetails {
|
|
|
30479
30532
|
return Boolean(this.selectedDate);
|
|
30480
30533
|
case "annual":
|
|
30481
30534
|
return true;
|
|
30535
|
+
case "scaled-price":
|
|
30536
|
+
return true;
|
|
30482
30537
|
case "timeslot":
|
|
30483
|
-
|
|
30538
|
+
switch (this.mode) {
|
|
30539
|
+
case "event":
|
|
30540
|
+
return Boolean(this.selectedDate);
|
|
30541
|
+
case "ticket":
|
|
30542
|
+
return Boolean(this.selectedDate && this.selectedTimeslot);
|
|
30543
|
+
case "tour":
|
|
30544
|
+
return true;
|
|
30545
|
+
case void 0:
|
|
30546
|
+
return false;
|
|
30547
|
+
default:
|
|
30548
|
+
const exhaustedChecking2 = this.mode;
|
|
30549
|
+
throw new Error(`(isTicketsVisible) Unhandled case: ${exhaustedChecking2}`);
|
|
30550
|
+
}
|
|
30484
30551
|
default:
|
|
30485
30552
|
const exhaustedChecking = filter;
|
|
30486
|
-
|
|
30553
|
+
throw new Error(`(isTicketsVisible) Unhandled case: ${exhaustedChecking}`);
|
|
30487
30554
|
}
|
|
30488
30555
|
};
|
|
30489
30556
|
return this.filters?.some(byFilter);
|
|
@@ -30971,7 +31038,7 @@ function Breakdown($$anchor, $$props) {
|
|
|
30971
31038
|
reset(ul);
|
|
30972
31039
|
reset(li);
|
|
30973
31040
|
reset(ol);
|
|
30974
|
-
template_effect(($0) => set_text(text2, `Total: ${$0 ?? ""}`), [() => formatCurrency(get$2(order).total_price_cents)]);
|
|
31041
|
+
template_effect(($0) => set_text(text2, `Total: ${$0 ?? ""}`), [() => formatCurrency$1(get$2(order).total_price_cents)]);
|
|
30975
31042
|
append($$anchor2, ol);
|
|
30976
31043
|
};
|
|
30977
31044
|
if_block(node, ($$render) => {
|
|
@@ -31079,16 +31146,19 @@ function Wrapper($$anchor, $$props) {
|
|
|
31079
31146
|
create_custom_element(Wrapper, { host: {}, children: {} }, [], [], true);
|
|
31080
31147
|
function TicketSelection($$anchor, $$props) {
|
|
31081
31148
|
push($$props, true);
|
|
31082
|
-
let mode = prop($$props, "mode", 7), filters = prop($$props, "filters", 7),
|
|
31149
|
+
let mode = prop($$props, "mode", 7), filters = prop($$props, "filters", 7), eventIds = prop($$props, "eventIds", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), selectedDate = prop($$props, "selectedDate", 7), ticketIds = prop($$props, "ticketIds", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7);
|
|
31083
31150
|
const details = new TicketSelectionDetails();
|
|
31084
31151
|
user_effect(() => {
|
|
31085
31152
|
details.mode = mode();
|
|
31086
31153
|
details.filters = parseTokens(filters(), validTicketSelectionFilters);
|
|
31087
|
-
details.
|
|
31154
|
+
details.eventIds = parseIds(eventIds());
|
|
31088
31155
|
details.museumIds = parseIds(museumIds());
|
|
31089
31156
|
details.exhibitionIds = parseIds(exhibitionIds());
|
|
31090
31157
|
details.ticketIds = parseIds(ticketIds());
|
|
31091
31158
|
details.ticketGroupIds = parseIds(ticketGroupIds());
|
|
31159
|
+
if (selectedDate()) {
|
|
31160
|
+
details.selectedDate = $fae977aafc393c5c$export$6b862160d295c8e(selectedDate());
|
|
31161
|
+
}
|
|
31092
31162
|
});
|
|
31093
31163
|
setTicketSelectionDetails($$props.$$host, details);
|
|
31094
31164
|
var $$exports = {
|
|
@@ -31107,11 +31177,11 @@ function TicketSelection($$anchor, $$props) {
|
|
|
31107
31177
|
filters($$value);
|
|
31108
31178
|
flushSync();
|
|
31109
31179
|
},
|
|
31110
|
-
get
|
|
31111
|
-
return
|
|
31180
|
+
get eventIds() {
|
|
31181
|
+
return eventIds();
|
|
31112
31182
|
},
|
|
31113
|
-
set
|
|
31114
|
-
|
|
31183
|
+
set eventIds($$value) {
|
|
31184
|
+
eventIds($$value);
|
|
31115
31185
|
flushSync();
|
|
31116
31186
|
},
|
|
31117
31187
|
get museumIds() {
|
|
@@ -31128,6 +31198,13 @@ function TicketSelection($$anchor, $$props) {
|
|
|
31128
31198
|
exhibitionIds($$value);
|
|
31129
31199
|
flushSync();
|
|
31130
31200
|
},
|
|
31201
|
+
get selectedDate() {
|
|
31202
|
+
return selectedDate();
|
|
31203
|
+
},
|
|
31204
|
+
set selectedDate($$value) {
|
|
31205
|
+
selectedDate($$value);
|
|
31206
|
+
flushSync();
|
|
31207
|
+
},
|
|
31131
31208
|
get ticketIds() {
|
|
31132
31209
|
return ticketIds();
|
|
31133
31210
|
},
|
|
@@ -31149,11 +31226,12 @@ customElements.define("go-ticket-selection", create_custom_element(
|
|
|
31149
31226
|
TicketSelection,
|
|
31150
31227
|
{
|
|
31151
31228
|
mode: { attribute: "mode", reflect: true, type: "String" },
|
|
31152
|
-
|
|
31229
|
+
eventIds: { attribute: "event-ids", reflect: true, type: "String" },
|
|
31153
31230
|
ticketIds: { attribute: "ticket-ids", reflect: true, type: "String" },
|
|
31154
31231
|
ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" },
|
|
31155
31232
|
museumIds: { attribute: "museum-ids", reflect: true, type: "String" },
|
|
31156
31233
|
exhibitionIds: { attribute: "exhibition-ids", reflect: true, type: "String" },
|
|
31234
|
+
selectedDate: { attribute: "selected-date", reflect: true, type: "String" },
|
|
31157
31235
|
filters: {}
|
|
31158
31236
|
},
|
|
31159
31237
|
[],
|
|
@@ -31186,7 +31264,7 @@ function TicketsSum($$anchor, $$props) {
|
|
|
31186
31264
|
pop();
|
|
31187
31265
|
}
|
|
31188
31266
|
customElements.define("go-tickets-sum", create_custom_element(TicketsSum, {}, [], [], false));
|
|
31189
|
-
class
|
|
31267
|
+
class TicketSegmentDetails {
|
|
31190
31268
|
#ticketSelectionDetails;
|
|
31191
31269
|
get ticketSelectionDetails() {
|
|
31192
31270
|
return get$2(this.#ticketSelectionDetails);
|
|
@@ -31201,12 +31279,19 @@ class TicketGroupDetails {
|
|
|
31201
31279
|
set tickets(value) {
|
|
31202
31280
|
set(this.#tickets, value, true);
|
|
31203
31281
|
}
|
|
31204
|
-
#
|
|
31282
|
+
#contingent = /* @__PURE__ */ state(100);
|
|
31283
|
+
get contingent() {
|
|
31284
|
+
return get$2(this.#contingent);
|
|
31285
|
+
}
|
|
31286
|
+
set contingent(value) {
|
|
31287
|
+
set(this.#contingent, value, true);
|
|
31288
|
+
}
|
|
31289
|
+
#preCart = /* @__PURE__ */ state(proxy(createCart()));
|
|
31205
31290
|
get preCart() {
|
|
31206
31291
|
return get$2(this.#preCart);
|
|
31207
31292
|
}
|
|
31208
31293
|
set preCart(value) {
|
|
31209
|
-
set(this.#preCart, value);
|
|
31294
|
+
set(this.#preCart, value, true);
|
|
31210
31295
|
}
|
|
31211
31296
|
#filters = /* @__PURE__ */ state("timeslot");
|
|
31212
31297
|
get filters() {
|
|
@@ -31215,6 +31300,13 @@ class TicketGroupDetails {
|
|
|
31215
31300
|
set filters(value) {
|
|
31216
31301
|
set(this.#filters, value, true);
|
|
31217
31302
|
}
|
|
31303
|
+
#dateId = /* @__PURE__ */ state();
|
|
31304
|
+
get dateId() {
|
|
31305
|
+
return get$2(this.#dateId);
|
|
31306
|
+
}
|
|
31307
|
+
set dateId(value) {
|
|
31308
|
+
set(this.#dateId, value, true);
|
|
31309
|
+
}
|
|
31218
31310
|
constructor(type, tsdWrapper) {
|
|
31219
31311
|
this.filters = type;
|
|
31220
31312
|
this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value);
|
|
@@ -31222,9 +31314,19 @@ class TicketGroupDetails {
|
|
|
31222
31314
|
user_effect(() => {
|
|
31223
31315
|
this.ticketSelectionDetails;
|
|
31224
31316
|
untrack(() => {
|
|
31225
|
-
this.ticketSelectionDetails?.
|
|
31317
|
+
this.ticketSelectionDetails?.addTicketSegment(this);
|
|
31226
31318
|
});
|
|
31227
31319
|
});
|
|
31320
|
+
user_effect(() => {
|
|
31321
|
+
this.preCart = createCart(this.preCartTickets(), this.contingent);
|
|
31322
|
+
});
|
|
31323
|
+
});
|
|
31324
|
+
}
|
|
31325
|
+
toString() {
|
|
31326
|
+
return JSON.stringify({
|
|
31327
|
+
tickets: this.tickets,
|
|
31328
|
+
filters: this.filters,
|
|
31329
|
+
preCart: this.preCart
|
|
31228
31330
|
});
|
|
31229
31331
|
}
|
|
31230
31332
|
preCartTickets() {
|
|
@@ -31237,6 +31339,8 @@ class TicketGroupDetails {
|
|
|
31237
31339
|
return this.dayTickets;
|
|
31238
31340
|
case "custom":
|
|
31239
31341
|
return this.tickets;
|
|
31342
|
+
case "scaled-price":
|
|
31343
|
+
return this.scaledPricesTickets;
|
|
31240
31344
|
default:
|
|
31241
31345
|
const exhaustiveCheck = this.filters;
|
|
31242
31346
|
if (exhaustiveCheck) throw new Error(`(TicketGroup) Unhandled case: ${exhaustiveCheck}`);
|
|
@@ -31288,19 +31392,61 @@ class TicketGroupDetails {
|
|
|
31288
31392
|
if (!tickets) return [];
|
|
31289
31393
|
return initUITimeslotTickets(tickets);
|
|
31290
31394
|
}
|
|
31395
|
+
get scaledPricesTickets() {
|
|
31396
|
+
const tsd = this.ticketSelectionDetails;
|
|
31397
|
+
if (!this.ensureScaledPrices()) return [];
|
|
31398
|
+
const eid = tsd.eventIds[0];
|
|
31399
|
+
const event = snapshot(shop.getEventDetailsOnDate(eid, this.dateId));
|
|
31400
|
+
const ret = event?.prices.map((t) => createUIEventTicket(t, this.dateId)) || [];
|
|
31401
|
+
const seats = {
|
|
31402
|
+
max_per_registration: 2,
|
|
31403
|
+
available: 100,
|
|
31404
|
+
overbook: true,
|
|
31405
|
+
...event?.seats
|
|
31406
|
+
};
|
|
31407
|
+
const max_per_registration = seats.max_per_registration || seats.available;
|
|
31408
|
+
this.contingent = seats.overbook ? max_per_registration : Math.min(seats.available, max_per_registration);
|
|
31409
|
+
return ret;
|
|
31410
|
+
}
|
|
31411
|
+
ensureScaledPrices() {
|
|
31412
|
+
const tsd = this.ticketSelectionDetails;
|
|
31413
|
+
if (!tsd) {
|
|
31414
|
+
console.warn("(scaledPricesTickets) tsd is undefined");
|
|
31415
|
+
return false;
|
|
31416
|
+
}
|
|
31417
|
+
if (!tsd.eventIds?.length) {
|
|
31418
|
+
console.warn("(scaledPricesTickets) eventIds is undefined");
|
|
31419
|
+
return false;
|
|
31420
|
+
}
|
|
31421
|
+
if (!this.filters?.includes("scaled-price")) {
|
|
31422
|
+
console.warn("(scaledPricesTickets) filters should include scaled-price");
|
|
31423
|
+
return false;
|
|
31424
|
+
}
|
|
31425
|
+
if (!this.dateId) {
|
|
31426
|
+
console.warn("(scaledPricesTickets) date-id is not given to the go-ticket-segment");
|
|
31427
|
+
return false;
|
|
31428
|
+
}
|
|
31429
|
+
if (tsd.eventIds.length > 1) throw new Error("(scaledPricesTickets) currently we support only one eventId in go-ticket-selection");
|
|
31430
|
+
return true;
|
|
31431
|
+
}
|
|
31291
31432
|
}
|
|
31292
31433
|
const KEY = "go-ticket-segment";
|
|
31293
|
-
const
|
|
31294
|
-
const
|
|
31434
|
+
const setTicketSegmentDetails = createSetDetails(KEY);
|
|
31435
|
+
const getTicketSegmentDetails = createGetDetails(KEY);
|
|
31295
31436
|
function TicketSegment($$anchor, $$props) {
|
|
31296
31437
|
push($$props, true);
|
|
31297
|
-
const filters = prop($$props, "filters", 7);
|
|
31438
|
+
const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7);
|
|
31298
31439
|
if (!filters()) throw new Error("filters is required");
|
|
31440
|
+
console.log("TicketSegment: ", filters(), "dateId: ", dateId());
|
|
31299
31441
|
const tsdWrapper = getTicketSelectionDetails($$props.$$host);
|
|
31300
|
-
const details = new
|
|
31301
|
-
|
|
31442
|
+
const details = new TicketSegmentDetails(filters(), tsdWrapper);
|
|
31443
|
+
setTicketSegmentDetails($$props.$$host, details);
|
|
31444
|
+
details.filters = filters();
|
|
31445
|
+
details.dateId = dateId();
|
|
31302
31446
|
user_effect(() => {
|
|
31303
31447
|
details.filters = filters();
|
|
31448
|
+
details.dateId = dateId();
|
|
31449
|
+
console.log("SET DATEID,", dateId());
|
|
31304
31450
|
});
|
|
31305
31451
|
var $$exports = {
|
|
31306
31452
|
details,
|
|
@@ -31310,11 +31456,27 @@ function TicketSegment($$anchor, $$props) {
|
|
|
31310
31456
|
set filters($$value) {
|
|
31311
31457
|
filters($$value);
|
|
31312
31458
|
flushSync();
|
|
31459
|
+
},
|
|
31460
|
+
get dateId() {
|
|
31461
|
+
return dateId();
|
|
31462
|
+
},
|
|
31463
|
+
set dateId($$value) {
|
|
31464
|
+
dateId($$value);
|
|
31465
|
+
flushSync();
|
|
31313
31466
|
}
|
|
31314
31467
|
};
|
|
31315
31468
|
return pop($$exports);
|
|
31316
31469
|
}
|
|
31317
|
-
customElements.define("go-ticket-segment", create_custom_element(
|
|
31470
|
+
customElements.define("go-ticket-segment", create_custom_element(
|
|
31471
|
+
TicketSegment,
|
|
31472
|
+
{
|
|
31473
|
+
dateId: { attribute: "date-id", reflect: true, type: "Number" },
|
|
31474
|
+
filters: {}
|
|
31475
|
+
},
|
|
31476
|
+
[],
|
|
31477
|
+
["details"],
|
|
31478
|
+
false
|
|
31479
|
+
));
|
|
31318
31480
|
function updateSelectedTickets(ci, target, tsd) {
|
|
31319
31481
|
if (!tsd) {
|
|
31320
31482
|
console.warn("tsd is undefined");
|
|
@@ -31322,22 +31484,34 @@ function updateSelectedTickets(ci, target, tsd) {
|
|
|
31322
31484
|
}
|
|
31323
31485
|
const el = target;
|
|
31324
31486
|
ci.quantity = parseInt(el.value);
|
|
31325
|
-
ci.time = selectedTime(ci.
|
|
31487
|
+
ci.time = selectedTime(ci.product, tsd);
|
|
31326
31488
|
}
|
|
31327
|
-
function selectedTime(
|
|
31328
|
-
switch (
|
|
31329
|
-
case "
|
|
31330
|
-
if (!
|
|
31331
|
-
throw new Error("(selectedTime)
|
|
31489
|
+
function selectedTime(product, tsd) {
|
|
31490
|
+
switch (product.product_type) {
|
|
31491
|
+
case "Ticket":
|
|
31492
|
+
if (!isUITicket(product)) {
|
|
31493
|
+
throw new Error("(selectedTime) this should not happen");
|
|
31332
31494
|
}
|
|
31333
|
-
|
|
31334
|
-
|
|
31335
|
-
|
|
31336
|
-
|
|
31337
|
-
|
|
31495
|
+
const ticket = product;
|
|
31496
|
+
switch (ticket.type) {
|
|
31497
|
+
case "timeslot":
|
|
31498
|
+
if (!tsd.selectedTimeslot) {
|
|
31499
|
+
throw new Error("(selectedTime) selected timeslot is undefined");
|
|
31500
|
+
}
|
|
31501
|
+
return tsd.selectedTimeslot;
|
|
31502
|
+
case "annual":
|
|
31503
|
+
return berlinNowISO();
|
|
31504
|
+
case "day":
|
|
31505
|
+
return dayTicketSelectedTime(tsd);
|
|
31506
|
+
default:
|
|
31507
|
+
const exhaustedChecking2 = ticket.type;
|
|
31508
|
+
throw new Error(`(selectedTime) Unhandled Ticket Type: ${exhaustedChecking2}`);
|
|
31509
|
+
}
|
|
31510
|
+
case "Event":
|
|
31511
|
+
return "";
|
|
31338
31512
|
default:
|
|
31339
|
-
const exhaustedChecking =
|
|
31340
|
-
throw new Error(`(selectedTime) Unhandled
|
|
31513
|
+
const exhaustedChecking = product.product_type;
|
|
31514
|
+
throw new Error(`(selectedTime) Unhandled product type: ${exhaustedChecking}`);
|
|
31341
31515
|
}
|
|
31342
31516
|
}
|
|
31343
31517
|
function berlinNowISO() {
|
|
@@ -31351,35 +31525,70 @@ function dayTicketSelectedTime(tsd) {
|
|
|
31351
31525
|
}
|
|
31352
31526
|
return $11d87f3f76e88657$export$84c95a83c799e074(tsd.selectedDate, "Europe/Berlin").toString().slice(0, -15);
|
|
31353
31527
|
}
|
|
31354
|
-
function
|
|
31355
|
-
|
|
31356
|
-
|
|
31357
|
-
|
|
31358
|
-
|
|
31528
|
+
function selectOptions(cart2, item) {
|
|
31529
|
+
let min2 = 0;
|
|
31530
|
+
let max2 = cart2.contingent;
|
|
31531
|
+
switch (item.type) {
|
|
31532
|
+
case "Ticket":
|
|
31533
|
+
if (!isUITicket(item.product)) {
|
|
31534
|
+
throw new Error("(selectOptionsImpl) impossible");
|
|
31535
|
+
}
|
|
31536
|
+
min2 = Math.max(min2, 1, item.product.min_persons);
|
|
31537
|
+
max2 = Math.min(max2, item.product.max_persons, ticketsMaxCapacity(item.product));
|
|
31538
|
+
break;
|
|
31539
|
+
case "Event":
|
|
31540
|
+
break;
|
|
31541
|
+
default:
|
|
31542
|
+
const Unhandled = item.type;
|
|
31543
|
+
throw new Error(`(selectOptionsImpl) Unhandled case: ${Unhandled}`);
|
|
31544
|
+
}
|
|
31545
|
+
return { min: min2, max: max2 };
|
|
31546
|
+
}
|
|
31547
|
+
function generateQuantityOptions(cart2, item) {
|
|
31548
|
+
const { min: min2, max: max2 } = selectOptions(cart2, item);
|
|
31549
|
+
if (max2 < min2) {
|
|
31550
|
+
throw new Error("(generateQuantityOptions) max must be greater than min");
|
|
31359
31551
|
}
|
|
31360
31552
|
const options = [{ value: 0, label: "0" }];
|
|
31361
|
-
for (let quantity =
|
|
31362
|
-
|
|
31553
|
+
for (let quantity = min2; quantity <= max2; quantity++) {
|
|
31554
|
+
if (quantity == 0) continue;
|
|
31555
|
+
options.push({
|
|
31556
|
+
value: quantity,
|
|
31557
|
+
label: quantity.toString()
|
|
31558
|
+
});
|
|
31363
31559
|
}
|
|
31364
31560
|
return options;
|
|
31365
31561
|
}
|
|
31562
|
+
function ticketsMaxCapacity(ticket) {
|
|
31563
|
+
switch (ticket.type) {
|
|
31564
|
+
case "timeslot":
|
|
31565
|
+
const timeslotTicket = ticket;
|
|
31566
|
+
return timeslotTicket.capacities ? Math.max(0, ...Object.values(timeslotTicket.capacities)) : timeslotTicket.max_persons;
|
|
31567
|
+
case "annual":
|
|
31568
|
+
return ticket.max_persons;
|
|
31569
|
+
case "day":
|
|
31570
|
+
return ticket.max_persons;
|
|
31571
|
+
default:
|
|
31572
|
+
const exhastedChecking = ticket.type;
|
|
31573
|
+
throw new Error(`(max_capacity) Unhandled case: ${exhastedChecking}`);
|
|
31574
|
+
}
|
|
31575
|
+
}
|
|
31366
31576
|
var root_2$2 = /* @__PURE__ */ from_html(`<option> </option>`);
|
|
31367
31577
|
var root_1$2 = /* @__PURE__ */ from_html(`<select></select>`);
|
|
31368
31578
|
var root_4 = /* @__PURE__ */ from_html(`<li><article data-go-ticket=""><ul><li data-go-tickets-title=""> </li> <li data-go-tickets-description=""><!></li> <li data-go-tickets-price=""> </li> <li data-go-tickets-quality=""><!></li></ul></article></li>`);
|
|
31369
31579
|
var root_3$1 = /* @__PURE__ */ from_html(`<ol data-testid="tickets"><li data-go-tickets-header="" data-testid="tickets-header"><ul><li data-go-tickets-title="">Title</li> <li data-go-tickets-description="">Description</li> <li data-go-tickets-price="">Price</li> <li data-go-tickets-quality="">Quantity</li></ul></li> <!></ol>`);
|
|
31370
31580
|
function Body($$anchor, $$props) {
|
|
31371
31581
|
push($$props, true);
|
|
31372
|
-
const select = ($$anchor2,
|
|
31373
|
-
const ticket = /* @__PURE__ */ user_derived(() => ci().item);
|
|
31582
|
+
const select = ($$anchor2, cart2 = noop$1, item = noop$1) => {
|
|
31374
31583
|
var select_1 = root_1$2();
|
|
31375
|
-
select_1.__change = (e) => updateSelectedTickets(
|
|
31376
|
-
each(select_1, 21, () => generateQuantityOptions(
|
|
31584
|
+
select_1.__change = (e) => updateSelectedTickets(item(), e.target, get$2(details)?.ticketSelectionDetails);
|
|
31585
|
+
each(select_1, 21, () => generateQuantityOptions(cart2(), item()), index$1, ($$anchor3, quantity) => {
|
|
31377
31586
|
var option = root_2$2();
|
|
31378
31587
|
var text2 = child(option, true);
|
|
31379
31588
|
reset(option);
|
|
31380
31589
|
var option_value = {};
|
|
31381
31590
|
template_effect(() => {
|
|
31382
|
-
set_selected(option,
|
|
31591
|
+
set_selected(option, item().quantity === get$2(quantity).value);
|
|
31383
31592
|
set_text(text2, get$2(quantity).label);
|
|
31384
31593
|
if (option_value !== (option_value = get$2(quantity).value)) {
|
|
31385
31594
|
option.value = (option.__value = get$2(quantity).value) ?? "";
|
|
@@ -31390,7 +31599,7 @@ function Body($$anchor, $$props) {
|
|
|
31390
31599
|
reset(select_1);
|
|
31391
31600
|
append($$anchor2, select_1);
|
|
31392
31601
|
};
|
|
31393
|
-
const _details =
|
|
31602
|
+
const _details = getTicketSegmentDetails($$props.$$host);
|
|
31394
31603
|
const details = /* @__PURE__ */ user_derived(() => _details.value);
|
|
31395
31604
|
const anyItems = /* @__PURE__ */ user_derived(() => get$2(details)?.preCart?.items.length && get$2(details)?.preCart?.items.length > 0);
|
|
31396
31605
|
var fragment = comment();
|
|
@@ -31408,21 +31617,21 @@ function Body($$anchor, $$props) {
|
|
|
31408
31617
|
reset(li_1);
|
|
31409
31618
|
var li_2 = sibling(li_1, 2);
|
|
31410
31619
|
var node_2 = child(li_2);
|
|
31411
|
-
html$2(node_2, () => get$2(ci).
|
|
31620
|
+
html$2(node_2, () => get$2(ci).product.description);
|
|
31412
31621
|
reset(li_2);
|
|
31413
31622
|
var li_3 = sibling(li_2, 2);
|
|
31414
31623
|
var text_2 = child(li_3, true);
|
|
31415
31624
|
reset(li_3);
|
|
31416
31625
|
var li_4 = sibling(li_3, 2);
|
|
31417
31626
|
var node_3 = child(li_4);
|
|
31418
|
-
select(node_3, () => get$2(ci));
|
|
31627
|
+
select(node_3, () => get$2(details)?.preCart, () => get$2(ci));
|
|
31419
31628
|
reset(li_4);
|
|
31420
31629
|
reset(ul);
|
|
31421
31630
|
reset(article);
|
|
31422
31631
|
reset(li);
|
|
31423
31632
|
template_effect(() => {
|
|
31424
31633
|
set_attribute(article, "data-testid", get$2(ci).uuid);
|
|
31425
|
-
set_text(text_1, get$2(ci).
|
|
31634
|
+
set_text(text_1, get$2(ci).product.title);
|
|
31426
31635
|
set_text(text_2, get$2(ci).price_formatted);
|
|
31427
31636
|
});
|
|
31428
31637
|
append($$anchor3, li);
|
|
@@ -31441,7 +31650,7 @@ delegate(["change"]);
|
|
|
31441
31650
|
customElements.define("go-ticket-segment-body", create_custom_element(Body, {}, [], [], false));
|
|
31442
31651
|
function Sum($$anchor, $$props) {
|
|
31443
31652
|
push($$props, true);
|
|
31444
|
-
const _details =
|
|
31653
|
+
const _details = getTicketSegmentDetails($$props.$$host);
|
|
31445
31654
|
const details = /* @__PURE__ */ user_derived(() => _details.value);
|
|
31446
31655
|
next();
|
|
31447
31656
|
var text2 = text$1();
|
|
@@ -31602,7 +31811,14 @@ function Timeslots($$anchor, $$props) {
|
|
|
31602
31811
|
}
|
|
31603
31812
|
delegate(["change"]);
|
|
31604
31813
|
customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"], false));
|
|
31605
|
-
|
|
31814
|
+
class Calendar {
|
|
31815
|
+
#details = /* @__PURE__ */ state();
|
|
31816
|
+
get details() {
|
|
31817
|
+
return get$2(this.#details);
|
|
31818
|
+
}
|
|
31819
|
+
set details(value) {
|
|
31820
|
+
set(this.#details, value, true);
|
|
31821
|
+
}
|
|
31606
31822
|
#startAt = /* @__PURE__ */ state(proxy($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())));
|
|
31607
31823
|
get startAt() {
|
|
31608
31824
|
return get$2(this.#startAt);
|
|
@@ -31617,6 +31833,26 @@ let Calendar$1 = class Calendar {
|
|
|
31617
31833
|
set selected(value) {
|
|
31618
31834
|
set(this.#selected, value, true);
|
|
31619
31835
|
}
|
|
31836
|
+
get dates() {
|
|
31837
|
+
if (!this.details) {
|
|
31838
|
+
console.warn("(Calendar) details is undefined");
|
|
31839
|
+
return void 0;
|
|
31840
|
+
}
|
|
31841
|
+
switch (this.details.mode) {
|
|
31842
|
+
case "ticket":
|
|
31843
|
+
return this.ticketsDates();
|
|
31844
|
+
case "event":
|
|
31845
|
+
return this.eventsDates();
|
|
31846
|
+
case "tour":
|
|
31847
|
+
throw new Error("(Calendar) Tour mode not supported");
|
|
31848
|
+
case void 0:
|
|
31849
|
+
console.error("(Calendar) Mode is undefined");
|
|
31850
|
+
return void 0;
|
|
31851
|
+
default:
|
|
31852
|
+
const exhaustedChecking = this.details.mode;
|
|
31853
|
+
throw new Error(`(Calendar) Unhandled case: ${exhaustedChecking}`);
|
|
31854
|
+
}
|
|
31855
|
+
}
|
|
31620
31856
|
isDateDisabled(date2) {
|
|
31621
31857
|
return date2.compare($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2())) < 0;
|
|
31622
31858
|
}
|
|
@@ -31626,33 +31862,40 @@ let Calendar$1 = class Calendar {
|
|
|
31626
31862
|
}
|
|
31627
31863
|
return false;
|
|
31628
31864
|
}
|
|
31629
|
-
|
|
31630
|
-
|
|
31631
|
-
|
|
31632
|
-
|
|
31633
|
-
|
|
31634
|
-
|
|
31635
|
-
|
|
31636
|
-
|
|
31637
|
-
}
|
|
31638
|
-
|
|
31639
|
-
|
|
31640
|
-
|
|
31641
|
-
|
|
31642
|
-
|
|
31643
|
-
|
|
31644
|
-
|
|
31645
|
-
|
|
31646
|
-
|
|
31647
|
-
|
|
31648
|
-
|
|
31649
|
-
|
|
31865
|
+
// @ts-ignore
|
|
31866
|
+
apiFilters() {
|
|
31867
|
+
return this.details?.filters?.map((f) => ({
|
|
31868
|
+
day: "normal",
|
|
31869
|
+
timeslot: "time_slot",
|
|
31870
|
+
annual: "annual",
|
|
31871
|
+
"scaled-price": "scaled_price"
|
|
31872
|
+
})[f]);
|
|
31873
|
+
}
|
|
31874
|
+
params() {
|
|
31875
|
+
if (!this.details) return {};
|
|
31876
|
+
const params = {
|
|
31877
|
+
by_bookable: true,
|
|
31878
|
+
// This should give a type error, but it doesn't because we are using by_ticket_types[] which the type doesn't know
|
|
31879
|
+
// we filter out undefined values
|
|
31880
|
+
//@ts-ignore
|
|
31881
|
+
"by_ticket_types[]": this.apiFilters,
|
|
31882
|
+
"by_ticket_ids[]": this.details.ticketIds,
|
|
31883
|
+
"by_ticket_group_ids[]": this.details.ticketGroupIds,
|
|
31884
|
+
"by_museum_ids[]": this.details.museumIds,
|
|
31885
|
+
"by_exhibition_ids[]": this.details.exhibitionIds,
|
|
31886
|
+
"by_event_ids[]": this.details.eventIds,
|
|
31887
|
+
// these logic are there to minimize fetches
|
|
31888
|
+
start_at: this.startAt.set({ day: 1 }).toString(),
|
|
31889
|
+
end_at: this.startAt.add({ months: 1 }).set({ day: 14 }).toString()
|
|
31890
|
+
};
|
|
31891
|
+
return params;
|
|
31650
31892
|
}
|
|
31651
|
-
|
|
31652
|
-
|
|
31893
|
+
eventsDates() {
|
|
31894
|
+
const ret = shop.calendar(this.params());
|
|
31895
|
+
return ret;
|
|
31653
31896
|
}
|
|
31654
|
-
|
|
31655
|
-
const ret = shop.ticketsCalendar(this.params);
|
|
31897
|
+
ticketsDates() {
|
|
31898
|
+
const ret = shop.ticketsCalendar(this.params());
|
|
31656
31899
|
return ret;
|
|
31657
31900
|
}
|
|
31658
31901
|
}
|
|
@@ -31839,7 +32082,7 @@ function CalendarUI($$anchor, $$props) {
|
|
|
31839
32082
|
});
|
|
31840
32083
|
append($$anchor2, fragment);
|
|
31841
32084
|
};
|
|
31842
|
-
component(node, () => Calendar$
|
|
32085
|
+
component(node, () => Calendar$1, ($$anchor2, Calendar_Root) => {
|
|
31843
32086
|
Calendar_Root($$anchor2, {
|
|
31844
32087
|
weekdayFormat: "long",
|
|
31845
32088
|
fixedWeeks: true,
|
|
@@ -31875,15 +32118,18 @@ function CalendarUI($$anchor, $$props) {
|
|
|
31875
32118
|
}
|
|
31876
32119
|
create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], true);
|
|
31877
32120
|
var root$1 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
|
|
31878
|
-
function
|
|
32121
|
+
function Calendar_1($$anchor, $$props) {
|
|
31879
32122
|
push($$props, true);
|
|
31880
|
-
const ticketsCalendar = new
|
|
32123
|
+
const ticketsCalendar = new Calendar();
|
|
31881
32124
|
const details = ticketsCalendar;
|
|
31882
32125
|
const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
31883
32126
|
const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
|
|
31884
32127
|
user_effect(() => {
|
|
31885
32128
|
ticketsCalendar.details = get$2(ticketSelectionDetails);
|
|
31886
|
-
if (get$2(ticketSelectionDetails))
|
|
32129
|
+
if (get$2(ticketSelectionDetails)) {
|
|
32130
|
+
get$2(ticketSelectionDetails).mode;
|
|
32131
|
+
get$2(ticketSelectionDetails).selectedDate = void 0;
|
|
32132
|
+
}
|
|
31887
32133
|
});
|
|
31888
32134
|
let wrapper = /* @__PURE__ */ state(void 0);
|
|
31889
32135
|
onMount(() => {
|
|
@@ -31903,7 +32149,7 @@ function Calendar2($$anchor, $$props) {
|
|
|
31903
32149
|
});
|
|
31904
32150
|
};
|
|
31905
32151
|
if_block(node, ($$render) => {
|
|
31906
|
-
if (get$2(ticketSelectionDetails)?.
|
|
32152
|
+
if (get$2(ticketSelectionDetails)?.isCalendarVisible) $$render(consequent);
|
|
31907
32153
|
});
|
|
31908
32154
|
}
|
|
31909
32155
|
reset(div);
|
|
@@ -31911,7 +32157,7 @@ function Calendar2($$anchor, $$props) {
|
|
|
31911
32157
|
append($$anchor, div);
|
|
31912
32158
|
return pop($$exports);
|
|
31913
32159
|
}
|
|
31914
|
-
customElements.define("go-calendar", create_custom_element(
|
|
32160
|
+
customElements.define("go-calendar", create_custom_element(Calendar_1, {}, [], ["details"], false));
|
|
31915
32161
|
class Details2 {
|
|
31916
32162
|
#ticketSelectionDetails;
|
|
31917
32163
|
get ticketSelectionDetails() {
|
|
@@ -31935,7 +32181,7 @@ class Details2 {
|
|
|
31935
32181
|
}
|
|
31936
32182
|
const preCarts = this.ticketSelectionDetails.preCarts;
|
|
31937
32183
|
const newItems = preCarts.flatMap((pc) => {
|
|
31938
|
-
return pc.nonEmptyItems.map((i) => createCartItem(i.
|
|
32184
|
+
return pc.nonEmptyItems.map((i) => createCartItem(i.product, { quantity: i.quantity, time: i.time }));
|
|
31939
32185
|
});
|
|
31940
32186
|
cart.addItems(newItems);
|
|
31941
32187
|
preCarts.forEach((pc) => pc.items.forEach((i) => i.quantity = 0));
|
|
@@ -31972,3 +32218,32 @@ function AddToCartButton($$anchor, $$props) {
|
|
|
31972
32218
|
}
|
|
31973
32219
|
delegate(["click"]);
|
|
31974
32220
|
customElements.define("go-add-to-cart-button", create_custom_element(AddToCartButton, {}, [], ["details"], false));
|
|
32221
|
+
function Link($$anchor, $$props) {
|
|
32222
|
+
push($$props, true);
|
|
32223
|
+
const to = prop($$props, "to", 7);
|
|
32224
|
+
const href = /* @__PURE__ */ user_derived(() => go.config.urls[to()]);
|
|
32225
|
+
const a2 = wrapInElement($$props.$$host, "a");
|
|
32226
|
+
user_effect(() => {
|
|
32227
|
+
if (!get$2(href)) {
|
|
32228
|
+
console.warn(`[go-link] No URL found for route "${to()}".`);
|
|
32229
|
+
a2.removeAttribute("href");
|
|
32230
|
+
return;
|
|
32231
|
+
}
|
|
32232
|
+
a2.setAttribute("href", get$2(href)());
|
|
32233
|
+
});
|
|
32234
|
+
a2.addEventListener("click", (e) => {
|
|
32235
|
+
e.preventDefault();
|
|
32236
|
+
go.config.navigateTo(go.config.urls[to()]());
|
|
32237
|
+
});
|
|
32238
|
+
var $$exports = {
|
|
32239
|
+
get to() {
|
|
32240
|
+
return to();
|
|
32241
|
+
},
|
|
32242
|
+
set to($$value) {
|
|
32243
|
+
to($$value);
|
|
32244
|
+
flushSync();
|
|
32245
|
+
}
|
|
32246
|
+
};
|
|
32247
|
+
return pop($$exports);
|
|
32248
|
+
}
|
|
32249
|
+
customElements.define("go-link", create_custom_element(Link, { to: { attribute: "to", reflect: true, type: "String" } }, [], [], false));
|