@gomusdev/web-components 4.3.0 → 4.5.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 +12 -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 +125 -37
- package/dist-js/gomus-webcomponents.js +125 -37
- package/dist-js/gomus-webcomponents.min.iife.js +20 -20
- package/dist-js/gomus-webcomponents.min.js +3585 -3514
- 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/go/go.d.ts +3 -2
- package/dist-js/src/lib/stores/shop.svelte.d.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.5.0 (2026-07-13)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **checkout:** split guest and signed-in checkout, gated by go-if, closes [#data](https://gitlab.giantmonkey.de/gomus/frontend/issues/data)
|
|
8
|
+
|
|
9
|
+
## 4.4.0 (2026-07-13)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **go-api:** add go.api.getCustomerAddresses()
|
|
14
|
+
|
|
3
15
|
## 4.3.0 (2026-07-13)
|
|
4
16
|
|
|
5
17
|
### 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
|
};
|
|
@@ -13623,6 +13632,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13623
13632
|
var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
|
|
13624
13633
|
var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate";
|
|
13625
13634
|
var ORDERS_ENDPOINT = "/api/v4/orders";
|
|
13635
|
+
var CUSTOMER_ADDRESSES_ENDPOINT = "/api/v4/customer/customer_addresses";
|
|
13626
13636
|
//#endregion
|
|
13627
13637
|
//#region ../../packages/gomus-api/lib/customerLevels.ts
|
|
13628
13638
|
var CustomerLevels = {
|
|
@@ -13744,6 +13754,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13744
13754
|
query: params
|
|
13745
13755
|
});
|
|
13746
13756
|
}
|
|
13757
|
+
getCustomerAddresses() {
|
|
13758
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13759
|
+
return this.fetchAndCache(CUSTOMER_ADDRESSES_ENDPOINT, "customerAddresses", "", { cache: 5 });
|
|
13760
|
+
}
|
|
13747
13761
|
ticketsCalendar(params) {
|
|
13748
13762
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
|
|
13749
13763
|
cache: 60,
|
|
@@ -18326,11 +18340,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18326
18340
|
}
|
|
18327
18341
|
customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], []));
|
|
18328
18342
|
//#endregion
|
|
18329
|
-
//#region src/components/checkoutForm/
|
|
18330
|
-
function
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
|
|
18343
|
+
//#region src/components/checkoutForm/lib.ts
|
|
18344
|
+
async function finalizeCheckout(form, formId) {
|
|
18345
|
+
const cart = shop.cart;
|
|
18346
|
+
if (!cart) return;
|
|
18347
|
+
const paymentMode = form.details.fieldValue("paymentMode");
|
|
18348
|
+
cart.paymentModeId = paymentMode == null ? void 0 : String(paymentMode);
|
|
18349
|
+
const checkout = await shop.checkout(cart.orderData());
|
|
18350
|
+
if (checkout.error) {
|
|
18351
|
+
form.details.apiErrors = checkout.error;
|
|
18352
|
+
return;
|
|
18353
|
+
}
|
|
18354
|
+
const beforeSubmit = configStore.config.forms[formId]?.beforeSubmit;
|
|
18355
|
+
if (beforeSubmit) await beforeSubmit(form.details.formData);
|
|
18356
|
+
const paymentUrl = checkout.data.meta.payment_url;
|
|
18357
|
+
configStore.config.navigateTo?.(paymentUrl);
|
|
18358
|
+
}
|
|
18359
|
+
function setupGuestCheckout(host, custom) {
|
|
18334
18360
|
Forms.defineForm({
|
|
18335
18361
|
id: "checkoutGuest",
|
|
18336
18362
|
submitLabel: "cart.detail.actions.checkout",
|
|
@@ -18361,30 +18387,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18361
18387
|
}
|
|
18362
18388
|
]
|
|
18363
18389
|
});
|
|
18364
|
-
wrapInElement(
|
|
18390
|
+
wrapInElement(host, "go-form", {
|
|
18365
18391
|
"form-id": "checkoutGuest",
|
|
18366
|
-
custom
|
|
18392
|
+
custom
|
|
18367
18393
|
});
|
|
18368
|
-
|
|
18394
|
+
host.addEventListener("submit", async (e) => {
|
|
18369
18395
|
const form = e.target;
|
|
18370
|
-
if (!
|
|
18396
|
+
if (!shop.cart) return;
|
|
18371
18397
|
const auth = await shop.signUp(form.details.formData, true);
|
|
18372
18398
|
if (auth.error) {
|
|
18373
18399
|
form.details.apiErrors = auth.error.errors;
|
|
18374
18400
|
return;
|
|
18375
18401
|
}
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18402
|
+
await finalizeCheckout(form, "checkoutGuest");
|
|
18403
|
+
});
|
|
18404
|
+
}
|
|
18405
|
+
function setupUserCheckout(host, custom) {
|
|
18406
|
+
Forms.defineForm({
|
|
18407
|
+
id: "checkoutUser",
|
|
18408
|
+
submitLabel: "cart.detail.actions.checkout",
|
|
18409
|
+
fields: [{
|
|
18410
|
+
key: "acceptTerms",
|
|
18411
|
+
required: true
|
|
18412
|
+
}, {
|
|
18413
|
+
key: "paymentMode",
|
|
18414
|
+
required: true
|
|
18415
|
+
}]
|
|
18416
|
+
});
|
|
18417
|
+
wrapInElement(host, "go-form", {
|
|
18418
|
+
"form-id": "checkoutUser",
|
|
18419
|
+
custom
|
|
18420
|
+
});
|
|
18421
|
+
host.addEventListener("submit", async (e) => {
|
|
18422
|
+
const form = e.target;
|
|
18423
|
+
await finalizeCheckout(form, "checkoutUser");
|
|
18387
18424
|
});
|
|
18425
|
+
}
|
|
18426
|
+
//#endregion
|
|
18427
|
+
//#region src/components/checkoutForm/CheckoutForm.svelte
|
|
18428
|
+
function CheckoutForm($$anchor, $$props) {
|
|
18429
|
+
push($$props, true);
|
|
18430
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18431
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18388
18432
|
return pop({
|
|
18389
18433
|
get custom() {
|
|
18390
18434
|
return custom();
|
|
@@ -18397,6 +18441,40 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
18397
18441
|
}
|
|
18398
18442
|
customElements.define("go-checkout-form", create_custom_element(CheckoutForm, { custom: {} }, [], []));
|
|
18399
18443
|
//#endregion
|
|
18444
|
+
//#region src/components/checkoutForm/CheckoutGuest.svelte
|
|
18445
|
+
function CheckoutGuest($$anchor, $$props) {
|
|
18446
|
+
push($$props, true);
|
|
18447
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18448
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18449
|
+
return pop({
|
|
18450
|
+
get custom() {
|
|
18451
|
+
return custom();
|
|
18452
|
+
},
|
|
18453
|
+
set custom($$value = false) {
|
|
18454
|
+
custom($$value);
|
|
18455
|
+
flushSync();
|
|
18456
|
+
}
|
|
18457
|
+
});
|
|
18458
|
+
}
|
|
18459
|
+
customElements.define("go-checkout-guest", create_custom_element(CheckoutGuest, { custom: {} }, [], []));
|
|
18460
|
+
//#endregion
|
|
18461
|
+
//#region src/components/checkoutForm/CheckoutUser.svelte
|
|
18462
|
+
function CheckoutUser($$anchor, $$props) {
|
|
18463
|
+
push($$props, true);
|
|
18464
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18465
|
+
setupUserCheckout($$props.$$host, custom());
|
|
18466
|
+
return pop({
|
|
18467
|
+
get custom() {
|
|
18468
|
+
return custom();
|
|
18469
|
+
},
|
|
18470
|
+
set custom($$value = false) {
|
|
18471
|
+
custom($$value);
|
|
18472
|
+
flushSync();
|
|
18473
|
+
}
|
|
18474
|
+
});
|
|
18475
|
+
}
|
|
18476
|
+
customElements.define("go-checkout-user", create_custom_element(CheckoutUser, { custom: {} }, [], []));
|
|
18477
|
+
//#endregion
|
|
18400
18478
|
//#region src/components/couponRedemption/lib.ts
|
|
18401
18479
|
var APPLY_ORDER_DISCOUNT = "TokenActions::ApplyOrderDiscount";
|
|
18402
18480
|
async function redeem(token) {
|
|
@@ -35755,12 +35833,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
35755
35833
|
const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value);
|
|
35756
35834
|
const _cartView = getCartDetails($$props.$$host);
|
|
35757
35835
|
const cartView = /* @__PURE__ */ user_derived(() => _cartView.value);
|
|
35836
|
+
const auth = shop.auth;
|
|
35758
35837
|
let data = /* @__PURE__ */ user_derived(() => ({
|
|
35759
35838
|
ticketSelection: get$2(ticketSelectionDetails),
|
|
35760
35839
|
personalizationDetails: get$2(personalizationDetails),
|
|
35761
35840
|
formData: get$2(formDetails)?.formData,
|
|
35762
35841
|
cart: shop.cart,
|
|
35763
|
-
cartView: get$2(cartView)
|
|
35842
|
+
cartView: get$2(cartView),
|
|
35843
|
+
auth: {
|
|
35844
|
+
isAuthenticated: auth.isAuthenticated(),
|
|
35845
|
+
isLoggedIn: auth.isLoggedIn(),
|
|
35846
|
+
isGuest: auth.isGuest()
|
|
35847
|
+
}
|
|
35764
35848
|
}));
|
|
35765
35849
|
const _setData = (_data) => {
|
|
35766
35850
|
set(data, _data);
|
|
@@ -38124,6 +38208,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38124
38208
|
getOrders: async (params) => {
|
|
38125
38209
|
await ensureShopReady();
|
|
38126
38210
|
return shop.asyncFetch(() => shop.getOrders(params));
|
|
38211
|
+
},
|
|
38212
|
+
getCustomerAddresses: async () => {
|
|
38213
|
+
await ensureShopReady();
|
|
38214
|
+
return shop.asyncFetch(() => shop.getCustomerAddresses());
|
|
38127
38215
|
}
|
|
38128
38216
|
},
|
|
38129
38217
|
cart: { addTour: async (options) => {
|
|
@@ -6553,12 +6553,12 @@ var assign = (initial, override) => {
|
|
|
6553
6553
|
//#endregion
|
|
6554
6554
|
//#region src/lib/stores/auth.svelte.ts
|
|
6555
6555
|
var Auth = class {
|
|
6556
|
-
#data = {
|
|
6556
|
+
#data = /* @__PURE__ */ state(proxy({
|
|
6557
6557
|
uid: "",
|
|
6558
6558
|
client: "",
|
|
6559
6559
|
accessToken: "",
|
|
6560
6560
|
expiry: 0
|
|
6561
|
-
};
|
|
6561
|
+
}));
|
|
6562
6562
|
constructor() {
|
|
6563
6563
|
this.load();
|
|
6564
6564
|
if (typeof window !== "undefined") window.addEventListener("storage", (e) => {
|
|
@@ -6570,34 +6570,39 @@ var Auth = class {
|
|
|
6570
6570
|
if (this.isLoggedIn()) return 20;
|
|
6571
6571
|
}
|
|
6572
6572
|
isAuthenticated() {
|
|
6573
|
-
return this
|
|
6573
|
+
return this.data.uid !== "";
|
|
6574
6574
|
}
|
|
6575
6575
|
isLoggedIn() {
|
|
6576
|
-
return Boolean(this
|
|
6576
|
+
return Boolean(this.data.uid && isEmail(this.data.uid));
|
|
6577
6577
|
}
|
|
6578
6578
|
isGuest() {
|
|
6579
|
-
return Boolean(this
|
|
6579
|
+
return Boolean(this.data.uid && !isEmail(this.data.uid));
|
|
6580
6580
|
}
|
|
6581
6581
|
signOut() {
|
|
6582
|
-
this.#data.uid = "";
|
|
6583
|
-
this.#data.client = "";
|
|
6584
|
-
this.#data.accessToken = "";
|
|
6585
|
-
this.#data.expiry = 0;
|
|
6582
|
+
get$2(this.#data).uid = "";
|
|
6583
|
+
get$2(this.#data).client = "";
|
|
6584
|
+
get$2(this.#data).accessToken = "";
|
|
6585
|
+
get$2(this.#data).expiry = 0;
|
|
6586
6586
|
this.save();
|
|
6587
6587
|
}
|
|
6588
6588
|
signIn(options) {
|
|
6589
|
-
this.#data.uid = options.uid;
|
|
6590
|
-
this.#data.client = options.client;
|
|
6591
|
-
this.#data.accessToken = options.accessToken;
|
|
6592
|
-
this.#data.expiry = options.expiry;
|
|
6589
|
+
get$2(this.#data).uid = options.uid;
|
|
6590
|
+
get$2(this.#data).client = options.client;
|
|
6591
|
+
get$2(this.#data).accessToken = options.accessToken;
|
|
6592
|
+
get$2(this.#data).expiry = options.expiry;
|
|
6593
6593
|
this.save();
|
|
6594
6594
|
}
|
|
6595
6595
|
get data() {
|
|
6596
|
-
if (this.#data.expiry < Math.floor(Date.now() / 1e3))
|
|
6597
|
-
|
|
6596
|
+
if (get$2(this.#data).uid !== "" && get$2(this.#data).expiry < Math.floor(Date.now() / 1e3)) return {
|
|
6597
|
+
uid: "",
|
|
6598
|
+
client: "",
|
|
6599
|
+
accessToken: "",
|
|
6600
|
+
expiry: 0
|
|
6601
|
+
};
|
|
6602
|
+
return get$2(this.#data);
|
|
6598
6603
|
}
|
|
6599
6604
|
toString() {
|
|
6600
|
-
return JSON.stringify(this.#data);
|
|
6605
|
+
return JSON.stringify(get$2(this.#data));
|
|
6601
6606
|
}
|
|
6602
6607
|
save() {
|
|
6603
6608
|
if (typeof localStorage === "undefined") return;
|
|
@@ -6612,6 +6617,10 @@ var Auth = class {
|
|
|
6612
6617
|
}
|
|
6613
6618
|
const d = JSON.parse(str);
|
|
6614
6619
|
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}`);
|
|
6620
|
+
if (d.uid !== "" && d.expiry < Math.floor(Date.now() / 1e3)) {
|
|
6621
|
+
this.signOut();
|
|
6622
|
+
return;
|
|
6623
|
+
}
|
|
6615
6624
|
this.signIn(d);
|
|
6616
6625
|
}
|
|
6617
6626
|
};
|
|
@@ -13622,6 +13631,7 @@ var SIGN_UP_ENDPOINT = "/api/v4/auth";
|
|
|
13622
13631
|
var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
|
|
13623
13632
|
var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate";
|
|
13624
13633
|
var ORDERS_ENDPOINT = "/api/v4/orders";
|
|
13634
|
+
var CUSTOMER_ADDRESSES_ENDPOINT = "/api/v4/customer/customer_addresses";
|
|
13625
13635
|
//#endregion
|
|
13626
13636
|
//#region ../../packages/gomus-api/lib/customerLevels.ts
|
|
13627
13637
|
var CustomerLevels = {
|
|
@@ -13743,6 +13753,10 @@ var Shop = class {
|
|
|
13743
13753
|
query: params
|
|
13744
13754
|
});
|
|
13745
13755
|
}
|
|
13756
|
+
getCustomerAddresses() {
|
|
13757
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13758
|
+
return this.fetchAndCache(CUSTOMER_ADDRESSES_ENDPOINT, "customerAddresses", "", { cache: 5 });
|
|
13759
|
+
}
|
|
13746
13760
|
ticketsCalendar(params) {
|
|
13747
13761
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
|
|
13748
13762
|
cache: 60,
|
|
@@ -18325,11 +18339,23 @@ function CartCounter($$anchor, $$props) {
|
|
|
18325
18339
|
}
|
|
18326
18340
|
customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], []));
|
|
18327
18341
|
//#endregion
|
|
18328
|
-
//#region src/components/checkoutForm/
|
|
18329
|
-
function
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
|
|
18342
|
+
//#region src/components/checkoutForm/lib.ts
|
|
18343
|
+
async function finalizeCheckout(form, formId) {
|
|
18344
|
+
const cart = shop.cart;
|
|
18345
|
+
if (!cart) return;
|
|
18346
|
+
const paymentMode = form.details.fieldValue("paymentMode");
|
|
18347
|
+
cart.paymentModeId = paymentMode == null ? void 0 : String(paymentMode);
|
|
18348
|
+
const checkout = await shop.checkout(cart.orderData());
|
|
18349
|
+
if (checkout.error) {
|
|
18350
|
+
form.details.apiErrors = checkout.error;
|
|
18351
|
+
return;
|
|
18352
|
+
}
|
|
18353
|
+
const beforeSubmit = configStore.config.forms[formId]?.beforeSubmit;
|
|
18354
|
+
if (beforeSubmit) await beforeSubmit(form.details.formData);
|
|
18355
|
+
const paymentUrl = checkout.data.meta.payment_url;
|
|
18356
|
+
configStore.config.navigateTo?.(paymentUrl);
|
|
18357
|
+
}
|
|
18358
|
+
function setupGuestCheckout(host, custom) {
|
|
18333
18359
|
Forms.defineForm({
|
|
18334
18360
|
id: "checkoutGuest",
|
|
18335
18361
|
submitLabel: "cart.detail.actions.checkout",
|
|
@@ -18360,30 +18386,48 @@ function CheckoutForm($$anchor, $$props) {
|
|
|
18360
18386
|
}
|
|
18361
18387
|
]
|
|
18362
18388
|
});
|
|
18363
|
-
wrapInElement(
|
|
18389
|
+
wrapInElement(host, "go-form", {
|
|
18364
18390
|
"form-id": "checkoutGuest",
|
|
18365
|
-
custom
|
|
18391
|
+
custom
|
|
18366
18392
|
});
|
|
18367
|
-
|
|
18393
|
+
host.addEventListener("submit", async (e) => {
|
|
18368
18394
|
const form = e.target;
|
|
18369
|
-
if (!
|
|
18395
|
+
if (!shop.cart) return;
|
|
18370
18396
|
const auth = await shop.signUp(form.details.formData, true);
|
|
18371
18397
|
if (auth.error) {
|
|
18372
18398
|
form.details.apiErrors = auth.error.errors;
|
|
18373
18399
|
return;
|
|
18374
18400
|
}
|
|
18375
|
-
|
|
18376
|
-
|
|
18377
|
-
|
|
18378
|
-
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18401
|
+
await finalizeCheckout(form, "checkoutGuest");
|
|
18402
|
+
});
|
|
18403
|
+
}
|
|
18404
|
+
function setupUserCheckout(host, custom) {
|
|
18405
|
+
Forms.defineForm({
|
|
18406
|
+
id: "checkoutUser",
|
|
18407
|
+
submitLabel: "cart.detail.actions.checkout",
|
|
18408
|
+
fields: [{
|
|
18409
|
+
key: "acceptTerms",
|
|
18410
|
+
required: true
|
|
18411
|
+
}, {
|
|
18412
|
+
key: "paymentMode",
|
|
18413
|
+
required: true
|
|
18414
|
+
}]
|
|
18415
|
+
});
|
|
18416
|
+
wrapInElement(host, "go-form", {
|
|
18417
|
+
"form-id": "checkoutUser",
|
|
18418
|
+
custom
|
|
18419
|
+
});
|
|
18420
|
+
host.addEventListener("submit", async (e) => {
|
|
18421
|
+
const form = e.target;
|
|
18422
|
+
await finalizeCheckout(form, "checkoutUser");
|
|
18386
18423
|
});
|
|
18424
|
+
}
|
|
18425
|
+
//#endregion
|
|
18426
|
+
//#region src/components/checkoutForm/CheckoutForm.svelte
|
|
18427
|
+
function CheckoutForm($$anchor, $$props) {
|
|
18428
|
+
push($$props, true);
|
|
18429
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18430
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18387
18431
|
return pop({
|
|
18388
18432
|
get custom() {
|
|
18389
18433
|
return custom();
|
|
@@ -18396,6 +18440,40 @@ function CheckoutForm($$anchor, $$props) {
|
|
|
18396
18440
|
}
|
|
18397
18441
|
customElements.define("go-checkout-form", create_custom_element(CheckoutForm, { custom: {} }, [], []));
|
|
18398
18442
|
//#endregion
|
|
18443
|
+
//#region src/components/checkoutForm/CheckoutGuest.svelte
|
|
18444
|
+
function CheckoutGuest($$anchor, $$props) {
|
|
18445
|
+
push($$props, true);
|
|
18446
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18447
|
+
setupGuestCheckout($$props.$$host, custom());
|
|
18448
|
+
return pop({
|
|
18449
|
+
get custom() {
|
|
18450
|
+
return custom();
|
|
18451
|
+
},
|
|
18452
|
+
set custom($$value = false) {
|
|
18453
|
+
custom($$value);
|
|
18454
|
+
flushSync();
|
|
18455
|
+
}
|
|
18456
|
+
});
|
|
18457
|
+
}
|
|
18458
|
+
customElements.define("go-checkout-guest", create_custom_element(CheckoutGuest, { custom: {} }, [], []));
|
|
18459
|
+
//#endregion
|
|
18460
|
+
//#region src/components/checkoutForm/CheckoutUser.svelte
|
|
18461
|
+
function CheckoutUser($$anchor, $$props) {
|
|
18462
|
+
push($$props, true);
|
|
18463
|
+
let custom = prop($$props, "custom", 7, false);
|
|
18464
|
+
setupUserCheckout($$props.$$host, custom());
|
|
18465
|
+
return pop({
|
|
18466
|
+
get custom() {
|
|
18467
|
+
return custom();
|
|
18468
|
+
},
|
|
18469
|
+
set custom($$value = false) {
|
|
18470
|
+
custom($$value);
|
|
18471
|
+
flushSync();
|
|
18472
|
+
}
|
|
18473
|
+
});
|
|
18474
|
+
}
|
|
18475
|
+
customElements.define("go-checkout-user", create_custom_element(CheckoutUser, { custom: {} }, [], []));
|
|
18476
|
+
//#endregion
|
|
18399
18477
|
//#region src/components/couponRedemption/lib.ts
|
|
18400
18478
|
var APPLY_ORDER_DISCOUNT = "TokenActions::ApplyOrderDiscount";
|
|
18401
18479
|
async function redeem(token) {
|
|
@@ -35754,12 +35832,18 @@ function If($$anchor, $$props) {
|
|
|
35754
35832
|
const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value);
|
|
35755
35833
|
const _cartView = getCartDetails($$props.$$host);
|
|
35756
35834
|
const cartView = /* @__PURE__ */ user_derived(() => _cartView.value);
|
|
35835
|
+
const auth = shop.auth;
|
|
35757
35836
|
let data = /* @__PURE__ */ user_derived(() => ({
|
|
35758
35837
|
ticketSelection: get$2(ticketSelectionDetails),
|
|
35759
35838
|
personalizationDetails: get$2(personalizationDetails),
|
|
35760
35839
|
formData: get$2(formDetails)?.formData,
|
|
35761
35840
|
cart: shop.cart,
|
|
35762
|
-
cartView: get$2(cartView)
|
|
35841
|
+
cartView: get$2(cartView),
|
|
35842
|
+
auth: {
|
|
35843
|
+
isAuthenticated: auth.isAuthenticated(),
|
|
35844
|
+
isLoggedIn: auth.isLoggedIn(),
|
|
35845
|
+
isGuest: auth.isGuest()
|
|
35846
|
+
}
|
|
35763
35847
|
}));
|
|
35764
35848
|
const _setData = (_data) => {
|
|
35765
35849
|
set(data, _data);
|
|
@@ -38123,6 +38207,10 @@ var go = {
|
|
|
38123
38207
|
getOrders: async (params) => {
|
|
38124
38208
|
await ensureShopReady();
|
|
38125
38209
|
return shop.asyncFetch(() => shop.getOrders(params));
|
|
38210
|
+
},
|
|
38211
|
+
getCustomerAddresses: async () => {
|
|
38212
|
+
await ensureShopReady();
|
|
38213
|
+
return shop.asyncFetch(() => shop.getCustomerAddresses());
|
|
38126
38214
|
}
|
|
38127
38215
|
},
|
|
38128
38216
|
cart: { addTour: async (options) => {
|