@gomusdev/web-components 4.4.0 → 4.6.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/README.md +16 -0
- package/dist-js/components/checkoutForm/CheckoutGuest.svelte.d.ts +1 -0
- package/dist-js/components/checkoutForm/CheckoutUser.svelte.d.ts +1 -0
- package/dist-js/gomus-webcomponents.iife.js +172 -60
- package/dist-js/gomus-webcomponents.js +172 -60
- package/dist-js/gomus-webcomponents.min.iife.js +20 -20
- package/dist-js/gomus-webcomponents.min.js +4494 -4408
- package/dist-js/src/components/annualTicketPersonalization/lib/PersonalizationDetails.svelte.d.ts +2 -0
- package/dist-js/src/components/cart/mocks/gomusTicketMocks.d.ts +3 -0
- package/dist-js/src/components/checkoutForm/CheckoutGuest.spec.d.ts +1 -0
- package/dist-js/src/components/checkoutForm/CheckoutUser.spec.d.ts +1 -0
- package/dist-js/src/components/checkoutForm/lib.d.ts +2 -1
- package/dist-js/src/components/graveyard/event/lib.svelte.d.ts +1 -0
- package/dist-js/src/components/order/lib/OrderDetails.svelte.d.ts +3 -2
- package/dist-js/src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.d.ts +6 -0
- package/dist-js/src/factories/CartItemFactories.d.ts +18 -0
- package/dist-js/src/go/go.d.ts +3 -2
- package/dist-js/src/lib/models/cart/CartItem.d.ts +23 -0
- package/dist-js/src/lib/models/cart/cart.svelte.d.ts +12 -0
- package/dist-js/src/lib/models/cart/localStorage.svelte.d.ts +3 -0
- package/dist-js/src/lib/models/ticket/UITicket.svelte.d.ts +3 -0
- package/dist-js/src/lib/stores/shop.svelte.d.ts +13 -1
- package/dist-js/src/mocks/ShopMocks.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.6.0 (2026-07-14)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **go:** add go.api.getCustomerMemberships to the window API
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cart:** harden annual-ticket / service-voucher redemption
|
|
12
|
+
|
|
13
|
+
## 4.5.0 (2026-07-13)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **checkout:** split guest and signed-in checkout, gated by go-if, closes [#data](https://gitlab.giantmonkey.de/gomus/frontend/issues/data)
|
|
18
|
+
|
|
3
19
|
## 4.4.0 (2026-07-13)
|
|
4
20
|
|
|
5
21
|
### Features
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -6554,12 +6554,12 @@ createHTML: (html) => {
|
|
|
6554
6554
|
//#endregion
|
|
6555
6555
|
//#region src/lib/stores/auth.svelte.ts
|
|
6556
6556
|
var Auth = class {
|
|
6557
|
-
#data = {
|
|
6557
|
+
#data = /* @__PURE__ */ state(proxy({
|
|
6558
6558
|
uid: "",
|
|
6559
6559
|
client: "",
|
|
6560
6560
|
accessToken: "",
|
|
6561
6561
|
expiry: 0
|
|
6562
|
-
};
|
|
6562
|
+
}));
|
|
6563
6563
|
constructor() {
|
|
6564
6564
|
this.load();
|
|
6565
6565
|
if (typeof window !== "undefined") window.addEventListener("storage", (e) => {
|
|
@@ -6571,34 +6571,39 @@ createHTML: (html) => {
|
|
|
6571
6571
|
if (this.isLoggedIn()) return 20;
|
|
6572
6572
|
}
|
|
6573
6573
|
isAuthenticated() {
|
|
6574
|
-
return this
|
|
6574
|
+
return this.data.uid !== "";
|
|
6575
6575
|
}
|
|
6576
6576
|
isLoggedIn() {
|
|
6577
|
-
return Boolean(this
|
|
6577
|
+
return Boolean(this.data.uid && isEmail(this.data.uid));
|
|
6578
6578
|
}
|
|
6579
6579
|
isGuest() {
|
|
6580
|
-
return Boolean(this
|
|
6580
|
+
return Boolean(this.data.uid && !isEmail(this.data.uid));
|
|
6581
6581
|
}
|
|
6582
6582
|
signOut() {
|
|
6583
|
-
this.#data.uid = "";
|
|
6584
|
-
this.#data.client = "";
|
|
6585
|
-
this.#data.accessToken = "";
|
|
6586
|
-
this.#data.expiry = 0;
|
|
6583
|
+
get$2(this.#data).uid = "";
|
|
6584
|
+
get$2(this.#data).client = "";
|
|
6585
|
+
get$2(this.#data).accessToken = "";
|
|
6586
|
+
get$2(this.#data).expiry = 0;
|
|
6587
6587
|
this.save();
|
|
6588
6588
|
}
|
|
6589
6589
|
signIn(options) {
|
|
6590
|
-
this.#data.uid = options.uid;
|
|
6591
|
-
this.#data.client = options.client;
|
|
6592
|
-
this.#data.accessToken = options.accessToken;
|
|
6593
|
-
this.#data.expiry = options.expiry;
|
|
6590
|
+
get$2(this.#data).uid = options.uid;
|
|
6591
|
+
get$2(this.#data).client = options.client;
|
|
6592
|
+
get$2(this.#data).accessToken = options.accessToken;
|
|
6593
|
+
get$2(this.#data).expiry = options.expiry;
|
|
6594
6594
|
this.save();
|
|
6595
6595
|
}
|
|
6596
6596
|
get data() {
|
|
6597
|
-
if (this.#data.expiry < Math.floor(Date.now() / 1e3))
|
|
6598
|
-
|
|
6597
|
+
if (get$2(this.#data).uid !== "" && get$2(this.#data).expiry < Math.floor(Date.now() / 1e3)) return {
|
|
6598
|
+
uid: "",
|
|
6599
|
+
client: "",
|
|
6600
|
+
accessToken: "",
|
|
6601
|
+
expiry: 0
|
|
6602
|
+
};
|
|
6603
|
+
return get$2(this.#data);
|
|
6599
6604
|
}
|
|
6600
6605
|
toString() {
|
|
6601
|
-
return JSON.stringify(this.#data);
|
|
6606
|
+
return JSON.stringify(get$2(this.#data));
|
|
6602
6607
|
}
|
|
6603
6608
|
save() {
|
|
6604
6609
|
if (typeof localStorage === "undefined") return;
|
|
@@ -6613,6 +6618,10 @@ createHTML: (html) => {
|
|
|
6613
6618
|
}
|
|
6614
6619
|
const d = JSON.parse(str);
|
|
6615
6620
|
if (!(isObject$2(d) && "uid" in d && "client" in d && "accessToken" in d && "expiry" in d)) throw new Error(`(Auth.loadFromString) invalid auth json ${str}`);
|
|
6621
|
+
if (d.uid !== "" && d.expiry < Math.floor(Date.now() / 1e3)) {
|
|
6622
|
+
this.signOut();
|
|
6623
|
+
return;
|
|
6624
|
+
}
|
|
6616
6625
|
this.signIn(d);
|
|
6617
6626
|
}
|
|
6618
6627
|
};
|
|
@@ -12270,6 +12279,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12270
12279
|
if (isUITour(this.product)) segments.push(`tour: ${this.product.instanceKey}`);
|
|
12271
12280
|
if (this.display?.discounted) segments.push("discounted");
|
|
12272
12281
|
if (isMantleTicket(this.product) && this.mantle?.key) segments.push(`mantle_key: ${this.mantle.key}`);
|
|
12282
|
+
if (this.voucher?.code) segments.push(`voucher_code: ${this.voucher.code}`);
|
|
12273
12283
|
return segments.length > 0 ? ` (${segments.join(", ")})` : "";
|
|
12274
12284
|
},
|
|
12275
12285
|
toString() {
|
|
@@ -12360,7 +12370,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12360
12370
|
return createCartItem(createUITicket(cartItem.product, { selectedTime: cartItem.product.selectedTime }), {
|
|
12361
12371
|
time: cartItem.time,
|
|
12362
12372
|
quantity: cartItem.quantity,
|
|
12363
|
-
mantle: cartItem.mantle
|
|
12373
|
+
mantle: cartItem.mantle,
|
|
12374
|
+
voucher: cartItem.voucher
|
|
12364
12375
|
});
|
|
12365
12376
|
case "Event":
|
|
12366
12377
|
if (!isStillValid(cartItem)) return;
|
|
@@ -12508,6 +12519,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12508
12519
|
},
|
|
12509
12520
|
deleteItem(item) {
|
|
12510
12521
|
for (let i = this.items.length - 1; i >= 0; i--) if (this.items[i].uuid === item.uuid) this.items.splice(i, 1);
|
|
12522
|
+
if (item?.voucher?.code && !this.items.some((i) => i.voucher?.code === item.voucher.code)) this.removeCoupon(item.voucher.code);
|
|
12511
12523
|
},
|
|
12512
12524
|
addItem(item) {
|
|
12513
12525
|
const existingItem = this.items.find((i) => i.uuid === item.uuid);
|
|
@@ -12526,7 +12538,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12526
12538
|
removeCoupon(code) {
|
|
12527
12539
|
const upper = code.toUpperCase();
|
|
12528
12540
|
const index = this.coupons.findIndex((c) => c.code === upper);
|
|
12529
|
-
if (index > -1)
|
|
12541
|
+
if (index > -1) {
|
|
12542
|
+
const [removed] = this.coupons.splice(index, 1);
|
|
12543
|
+
if (removed.kind === "serviceVoucher") {
|
|
12544
|
+
for (let i = this.items.length - 1; i >= 0; i--) if (this.items[i].voucher?.code === upper) this.items.splice(i, 1);
|
|
12545
|
+
}
|
|
12546
|
+
}
|
|
12530
12547
|
},
|
|
12531
12548
|
clearCoupons() {
|
|
12532
12549
|
while (this.coupons.length > 0) this.coupons.pop();
|
|
@@ -13624,6 +13641,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13624
13641
|
var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate";
|
|
13625
13642
|
var ORDERS_ENDPOINT = "/api/v4/orders";
|
|
13626
13643
|
var CUSTOMER_ADDRESSES_ENDPOINT = "/api/v4/customer/customer_addresses";
|
|
13644
|
+
var CUSTOMER_MEMBERSHIPS_ENDPOINT = "/api/v4/customer/memberships";
|
|
13627
13645
|
//#endregion
|
|
13628
13646
|
//#region ../../packages/gomus-api/lib/customerLevels.ts
|
|
13629
13647
|
var CustomerLevels = {
|
|
@@ -13749,6 +13767,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13749
13767
|
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13750
13768
|
return this.fetchAndCache(CUSTOMER_ADDRESSES_ENDPOINT, "customerAddresses", "", { cache: 5 });
|
|
13751
13769
|
}
|
|
13770
|
+
getCustomerMemberships() {
|
|
13771
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13772
|
+
return this.fetchAndCache(CUSTOMER_MEMBERSHIPS_ENDPOINT, "customerMemberships", "", { cache: 5 });
|
|
13773
|
+
}
|
|
13752
13774
|
ticketsCalendar(params) {
|
|
13753
13775
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
|
|
13754
13776
|
cache: 60,
|
|
@@ -13946,7 +13968,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13946
13968
|
});
|
|
13947
13969
|
}
|
|
13948
13970
|
getCouponSaleByBarcode(token) {
|
|
13949
|
-
return this.fetchAndCache(`/api/v4/coupon_sales/barcode/${token}`, `coupon_sale_barcode_${token}`, "coupon_sale");
|
|
13971
|
+
return this.fetchAndCache(`/api/v4/coupon_sales/barcode/${token}`, `coupon_sale_barcode_${token}`, "coupon_sale", { cache: 0 });
|
|
13950
13972
|
}
|
|
13951
13973
|
getCoupons() {
|
|
13952
13974
|
return this.fetchAndCache("/api/v4/coupons", "coupons", "coupons", { query: {
|
|
@@ -15205,8 +15227,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15205
15227
|
}
|
|
15206
15228
|
function createDisplayCartItem(cartItem, attrs) {
|
|
15207
15229
|
const quantity = isUITour(cartItem.product) ? 1 : resolveApiQuantity(attrs);
|
|
15208
|
-
const displayPrice = attrs.price_cents ?? cartItem.product.price_cents;
|
|
15209
15230
|
const originalPrice = cartItem.product.price_cents;
|
|
15231
|
+
const displayPrice = originalPrice === 0 ? 0 : attrs.price_cents ?? originalPrice;
|
|
15210
15232
|
const discounted = displayPrice < originalPrice;
|
|
15211
15233
|
return createCartItem({
|
|
15212
15234
|
...cartItem.product,
|
|
@@ -15214,6 +15236,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
15214
15236
|
}, {
|
|
15215
15237
|
quantity,
|
|
15216
15238
|
time: cartItem.time,
|
|
15239
|
+
voucher: cartItem.voucher,
|
|
15217
15240
|
mantle: cartItem.mantle,
|
|
15218
15241
|
display: {
|
|
15219
15242
|
discounted,
|
|
@@ -17827,10 +17850,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17827
17850
|
var root$47 = /* @__PURE__ */ from_html(`<s class="go-cart-item-price-original"> </s> <span class="go-cart-item-price-discounted"> </span>`, 1);
|
|
17828
17851
|
var root_1$15 = /* @__PURE__ */ from_html(`<span class="go-cart-item-price-discounted"> </span>`);
|
|
17829
17852
|
var root_2$11 = /* @__PURE__ */ from_html(`<span data-testid="cart-item-participant-count"> </span>`);
|
|
17830
|
-
var root_3$8 = /* @__PURE__ */ from_html(`<span> </span>`);
|
|
17831
|
-
var root_4$4 = /* @__PURE__ */ from_html(`<
|
|
17832
|
-
var root_5$2 = /* @__PURE__ */ from_html(`<
|
|
17833
|
-
var root_6$2 = /* @__PURE__ */ from_html(`<
|
|
17853
|
+
var root_3$8 = /* @__PURE__ */ from_html(`<span data-testid="cart-item-voucher-quantity"> </span>`);
|
|
17854
|
+
var root_4$4 = /* @__PURE__ */ from_html(`<span> </span>`);
|
|
17855
|
+
var root_5$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button class="go-cart-remove">⨉</button></li>`);
|
|
17856
|
+
var root_6$2 = /* @__PURE__ */ from_html(`<ul class="go-sub-tickets" role="list"></ul>`);
|
|
17857
|
+
var root_7$2 = /* @__PURE__ */ from_html(`<article class="go-cart-item-content"><ul><li class="go-cart-item-title-container"><!></li> <li class="go-cart-item-price"><!></li> <li class="go-cart-item-count"><!></li> <!> <li class="go-cart-item-sum"> </li></ul></article> <!>`, 1);
|
|
17834
17858
|
function Item$1($$anchor, $$props) {
|
|
17835
17859
|
push($$props, true);
|
|
17836
17860
|
let displayItem = prop($$props, "displayItem", 7), displayCart = prop($$props, "displayCart", 7), preview = prop($$props, "preview", 7);
|
|
@@ -17895,8 +17919,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17895
17919
|
};
|
|
17896
17920
|
var fragment = comment();
|
|
17897
17921
|
var node = first_child(fragment);
|
|
17898
|
-
var
|
|
17899
|
-
var fragment_1 =
|
|
17922
|
+
var consequent_10 = ($$anchor) => {
|
|
17923
|
+
var fragment_1 = root_7$2();
|
|
17900
17924
|
var article = first_child(fragment_1);
|
|
17901
17925
|
var ul = child(article);
|
|
17902
17926
|
var li = child(ul);
|
|
@@ -17972,6 +17996,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17972
17996
|
template_effect(() => set_text(text_4, displayItem().quantity));
|
|
17973
17997
|
append($$anchor, span_3);
|
|
17974
17998
|
};
|
|
17999
|
+
var consequent_7 = ($$anchor) => {
|
|
18000
|
+
var span_4 = root_4$4();
|
|
18001
|
+
var text_5 = child(span_4, true);
|
|
18002
|
+
reset(span_4);
|
|
18003
|
+
template_effect(() => set_text(text_5, displayItem().quantity));
|
|
18004
|
+
append($$anchor, span_4);
|
|
18005
|
+
};
|
|
17975
18006
|
var alternate_1 = ($$anchor) => {
|
|
17976
18007
|
{
|
|
17977
18008
|
let $0 = /* @__PURE__ */ user_derived(() => displayItem().quantity ?? 0);
|
|
@@ -17995,13 +18026,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
17995
18026
|
};
|
|
17996
18027
|
if_block(node_3, ($$render) => {
|
|
17997
18028
|
if (displayItem().product.type === "Tour") $$render(consequent_5);
|
|
17998
|
-
else if (
|
|
18029
|
+
else if (displayItem().voucher?.code) $$render(consequent_6, 1);
|
|
18030
|
+
else if (preview()) $$render(consequent_7, 2);
|
|
17999
18031
|
else $$render(alternate_1, -1);
|
|
18000
18032
|
});
|
|
18001
18033
|
reset(li_2);
|
|
18002
18034
|
var node_4 = sibling(li_2, 2);
|
|
18003
|
-
var
|
|
18004
|
-
var li_3 =
|
|
18035
|
+
var consequent_8 = ($$anchor) => {
|
|
18036
|
+
var li_3 = root_5$2();
|
|
18005
18037
|
var button = child(li_3);
|
|
18006
18038
|
reset(li_3);
|
|
18007
18039
|
template_effect(($0) => set_attribute(button, "aria-label", $0), [() => shop.t("cart.item.remove")]);
|
|
@@ -18009,16 +18041,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18009
18041
|
append($$anchor, li_3);
|
|
18010
18042
|
};
|
|
18011
18043
|
if_block(node_4, ($$render) => {
|
|
18012
|
-
if (!preview()) $$render(
|
|
18044
|
+
if (!preview()) $$render(consequent_8);
|
|
18013
18045
|
});
|
|
18014
18046
|
var li_4 = sibling(node_4, 2);
|
|
18015
|
-
var
|
|
18047
|
+
var text_6 = child(li_4, true);
|
|
18016
18048
|
reset(li_4);
|
|
18017
18049
|
reset(ul);
|
|
18018
18050
|
reset(article);
|
|
18019
18051
|
var node_5 = sibling(article, 2);
|
|
18020
|
-
var
|
|
18021
|
-
var ul_1 =
|
|
18052
|
+
var consequent_9 = ($$anchor) => {
|
|
18053
|
+
var ul_1 = root_6$2();
|
|
18022
18054
|
each(ul_1, 21, () => subTicketDefs(get$2(mantleProduct)), (sub) => sub.id, ($$anchor, sub) => {
|
|
18023
18055
|
{
|
|
18024
18056
|
let $0 = /* @__PURE__ */ user_derived(() => displayItem().mantle?.composition?.[get$2(sub).id] ?? 0);
|
|
@@ -18044,13 +18076,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18044
18076
|
append($$anchor, ul_1);
|
|
18045
18077
|
};
|
|
18046
18078
|
if_block(node_5, ($$render) => {
|
|
18047
|
-
if (get$2(mantleProduct)) $$render(
|
|
18079
|
+
if (get$2(mantleProduct)) $$render(consequent_9);
|
|
18048
18080
|
});
|
|
18049
|
-
template_effect(($0) => set_text(
|
|
18081
|
+
template_effect(($0) => set_text(text_6, $0), [() => formatCurrency(displayItem().total_price_cents)]);
|
|
18050
18082
|
append($$anchor, fragment_1);
|
|
18051
18083
|
};
|
|
18052
18084
|
if_block(node, ($$render) => {
|
|
18053
|
-
if (get$2(capacity)) $$render(
|
|
18085
|
+
if (get$2(capacity)) $$render(consequent_10);
|
|
18054
18086
|
});
|
|
18055
18087
|
append($$anchor, fragment);
|
|
18056
18088
|
return pop($$exports);
|
|
@@ -18331,11 +18363,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18331
18363
|
}
|
|
18332
18364
|
customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], []));
|
|
18333
18365
|
//#endregion
|
|
18334
|
-
//#region src/components/checkoutForm/
|
|
18335
|
-
function
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18366
|
+
//#region src/components/checkoutForm/lib.ts
|
|
18367
|
+
async function finalizeCheckout(form, formId) {
|
|
18368
|
+
const cart = shop.cart;
|
|
18369
|
+
if (!cart) return;
|
|
18370
|
+
const paymentMode = form.details.fieldValue("paymentMode");
|
|
18371
|
+
cart.paymentModeId = paymentMode == null ? void 0 : String(paymentMode);
|
|
18372
|
+
const checkout = await shop.checkout(cart.orderData());
|
|
18373
|
+
if (checkout.error) {
|
|
18374
|
+
form.details.apiErrors = checkout.error;
|
|
18375
|
+
return;
|
|
18376
|
+
}
|
|
18377
|
+
const beforeSubmit = configStore.config.forms[formId]?.beforeSubmit;
|
|
18378
|
+
if (beforeSubmit) await beforeSubmit(form.details.formData);
|
|
18379
|
+
const paymentUrl = checkout.data.meta.payment_url;
|
|
18380
|
+
configStore.config.navigateTo?.(paymentUrl);
|
|
18381
|
+
}
|
|
18382
|
+
function setupGuestCheckout(host, custom) {
|
|
18339
18383
|
Forms.defineForm({
|
|
18340
18384
|
id: "checkoutGuest",
|
|
18341
18385
|
submitLabel: "cart.detail.actions.checkout",
|
|
@@ -18366,30 +18410,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18366
18410
|
}
|
|
18367
18411
|
]
|
|
18368
18412
|
});
|
|
18369
|
-
wrapInElement(
|
|
18413
|
+
wrapInElement(host, "go-form", {
|
|
18370
18414
|
"form-id": "checkoutGuest",
|
|
18371
|
-
custom
|
|
18415
|
+
custom
|
|
18372
18416
|
});
|
|
18373
|
-
|
|
18417
|
+
host.addEventListener("submit", async (e) => {
|
|
18374
18418
|
const form = e.target;
|
|
18375
|
-
if (!
|
|
18419
|
+
if (!shop.cart) return;
|
|
18376
18420
|
const auth = await shop.signUp(form.details.formData, true);
|
|
18377
18421
|
if (auth.error) {
|
|
18378
18422
|
form.details.apiErrors = auth.error.errors;
|
|
18379
18423
|
return;
|
|
18380
18424
|
}
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18388
|
-
|
|
18389
|
-
|
|
18390
|
-
|
|
18391
|
-
|
|
18425
|
+
await finalizeCheckout(form, "checkoutGuest");
|
|
18426
|
+
});
|
|
18427
|
+
}
|
|
18428
|
+
function setupUserCheckout(host, custom) {
|
|
18429
|
+
Forms.defineForm({
|
|
18430
|
+
id: "checkoutUser",
|
|
18431
|
+
submitLabel: "cart.detail.actions.checkout",
|
|
18432
|
+
fields: [{
|
|
18433
|
+
key: "acceptTerms",
|
|
18434
|
+
required: true
|
|
18435
|
+
}, {
|
|
18436
|
+
key: "paymentMode",
|
|
18437
|
+
required: true
|
|
18438
|
+
}]
|
|
18439
|
+
});
|
|
18440
|
+
wrapInElement(host, "go-form", {
|
|
18441
|
+
"form-id": "checkoutUser",
|
|
18442
|
+
custom
|
|
18392
18443
|
});
|
|
18444
|
+
host.addEventListener("submit", async (e) => {
|
|
18445
|
+
const form = e.target;
|
|
18446
|
+
await finalizeCheckout(form, "checkoutUser");
|
|
18447
|
+
});
|
|
18448
|
+
}
|
|
18449
|
+
//#endregion
|
|
18450
|
+
//#region src/components/checkoutForm/CheckoutForm.svelte
|
|
18451
|
+
function CheckoutForm($$anchor, $$props) {
|
|
18452
|
+
push($$props, true);
|
|
18453
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18454
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18393
18455
|
return pop({
|
|
18394
18456
|
get custom() {
|
|
18395
18457
|
return custom();
|
|
@@ -18402,6 +18464,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18402
18464
|
}
|
|
18403
18465
|
customElements.define("go-checkout-form", create_custom_element(CheckoutForm, { custom: {} }, [], []));
|
|
18404
18466
|
//#endregion
|
|
18467
|
+
//#region src/components/checkoutForm/CheckoutGuest.svelte
|
|
18468
|
+
function CheckoutGuest($$anchor, $$props) {
|
|
18469
|
+
push($$props, true);
|
|
18470
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18471
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18472
|
+
return pop({
|
|
18473
|
+
get custom() {
|
|
18474
|
+
return custom();
|
|
18475
|
+
},
|
|
18476
|
+
set custom($$value = false) {
|
|
18477
|
+
custom($$value);
|
|
18478
|
+
flushSync();
|
|
18479
|
+
}
|
|
18480
|
+
});
|
|
18481
|
+
}
|
|
18482
|
+
customElements.define("go-checkout-guest", create_custom_element(CheckoutGuest, { custom: {} }, [], []));
|
|
18483
|
+
//#endregion
|
|
18484
|
+
//#region src/components/checkoutForm/CheckoutUser.svelte
|
|
18485
|
+
function CheckoutUser($$anchor, $$props) {
|
|
18486
|
+
push($$props, true);
|
|
18487
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18488
|
+
setupUserCheckout($$props.$$host, custom());
|
|
18489
|
+
return pop({
|
|
18490
|
+
get custom() {
|
|
18491
|
+
return custom();
|
|
18492
|
+
},
|
|
18493
|
+
set custom($$value = false) {
|
|
18494
|
+
custom($$value);
|
|
18495
|
+
flushSync();
|
|
18496
|
+
}
|
|
18497
|
+
});
|
|
18498
|
+
}
|
|
18499
|
+
customElements.define("go-checkout-user", create_custom_element(CheckoutUser, { custom: {} }, [], []));
|
|
18500
|
+
//#endregion
|
|
18405
18501
|
//#region src/components/couponRedemption/lib.ts
|
|
18406
18502
|
var APPLY_ORDER_DISCOUNT = "TokenActions::ApplyOrderDiscount";
|
|
18407
18503
|
async function redeem(token) {
|
|
@@ -18429,15 +18525,21 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18429
18525
|
return { success: true };
|
|
18430
18526
|
}
|
|
18431
18527
|
async function applyVoucher(token, couponSale) {
|
|
18432
|
-
const
|
|
18528
|
+
const code = token.toUpperCase();
|
|
18529
|
+
if (shop.cart.coupons.some((c) => c.code === code)) return { success: true };
|
|
18530
|
+
const tickets = await shop.asyncFetch(() => shop.tickets({ "by_ticket_ids[]": [couponSale.is_voucher_for] }));
|
|
18531
|
+
const ticket = Array.isArray(tickets) ? tickets.find((t) => t.id === couponSale.is_voucher_for) : void 0;
|
|
18433
18532
|
if (!ticket) return fail([shop.t("cart.coupon.form.errors.error")]);
|
|
18434
18533
|
const voucherTicket = {
|
|
18435
18534
|
...ticket,
|
|
18436
18535
|
price_cents: 0
|
|
18437
18536
|
};
|
|
18438
|
-
shop.cart.addItem(createCartItem(createUITicket(voucherTicket), {
|
|
18537
|
+
shop.cart.addItem(createCartItem(createUITicket(voucherTicket), {
|
|
18538
|
+
quantity: 1,
|
|
18539
|
+
voucher: { code }
|
|
18540
|
+
}));
|
|
18439
18541
|
shop.cart.addCoupon({
|
|
18440
|
-
code
|
|
18542
|
+
code,
|
|
18441
18543
|
kind: "serviceVoucher"
|
|
18442
18544
|
});
|
|
18443
18545
|
return { success: true };
|
|
@@ -35760,12 +35862,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
35760
35862
|
const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value);
|
|
35761
35863
|
const _cartView = getCartDetails($$props.$$host);
|
|
35762
35864
|
const cartView = /* @__PURE__ */ user_derived(() => _cartView.value);
|
|
35865
|
+
const auth = shop.auth;
|
|
35763
35866
|
let data = /* @__PURE__ */ user_derived(() => ({
|
|
35764
35867
|
ticketSelection: get$2(ticketSelectionDetails),
|
|
35765
35868
|
personalizationDetails: get$2(personalizationDetails),
|
|
35766
35869
|
formData: get$2(formDetails)?.formData,
|
|
35767
35870
|
cart: shop.cart,
|
|
35768
|
-
cartView: get$2(cartView)
|
|
35871
|
+
cartView: get$2(cartView),
|
|
35872
|
+
auth: {
|
|
35873
|
+
isAuthenticated: auth.isAuthenticated(),
|
|
35874
|
+
isLoggedIn: auth.isLoggedIn(),
|
|
35875
|
+
isGuest: auth.isGuest()
|
|
35876
|
+
}
|
|
35769
35877
|
}));
|
|
35770
35878
|
const _setData = (_data) => {
|
|
35771
35879
|
set(data, _data);
|
|
@@ -38133,6 +38241,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38133
38241
|
getCustomerAddresses: async () => {
|
|
38134
38242
|
await ensureShopReady();
|
|
38135
38243
|
return shop.asyncFetch(() => shop.getCustomerAddresses());
|
|
38244
|
+
},
|
|
38245
|
+
getCustomerMemberships: async () => {
|
|
38246
|
+
await ensureShopReady();
|
|
38247
|
+
return shop.asyncFetch(() => shop.getCustomerMemberships());
|
|
38136
38248
|
}
|
|
38137
38249
|
},
|
|
38138
38250
|
cart: { addTour: async (options) => {
|