@gomusdev/web-components 4.8.2 → 4.9.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.9.1 (2026-07-20)
4
+
5
+ ### Bug Fixes
6
+
7
+ * **checkoutForm:** handle meta.status and payment_data on checkout, closes [#152](https://gitlab.giantmonkey.de/gomus/frontend/issues/152)
8
+
9
+ ## 4.9.0 (2026-07-16)
10
+
11
+ ### Features
12
+
13
+ * **auth:** add go-set-password to complete the password reset flow, closes [#96](https://gitlab.giantmonkey.de/gomus/frontend/issues/96)
14
+
3
15
  ## 4.8.2 (2026-07-16)
4
16
 
5
17
  ### Bug Fixes
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -12238,6 +12238,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12238
12238
  };
12239
12239
  return {
12240
12240
  ...finalOptions,
12241
+ quantity: finalOptions.quantity ?? 0,
12242
+ time: finalOptions.time ?? "",
12241
12243
  type: product.type,
12242
12244
  product,
12243
12245
  /**
@@ -12297,7 +12299,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12297
12299
  return this.uuid + ":" + this.quantity;
12298
12300
  },
12299
12301
  get price_cents() {
12300
- if (this.time && this.product.dynamic_prices?.[this.time] != null) return this.product.dynamic_prices[this.time];
12302
+ const dynamicPrices = "dynamic_prices" in this.product ? this.product.dynamic_prices : null;
12303
+ if (this.time && dynamicPrices?.[this.time] != null) return dynamicPrices[this.time];
12301
12304
  return this.product.price_cents;
12302
12305
  },
12303
12306
  get price_formatted() {
@@ -12480,10 +12483,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12480
12483
  //#region src/lib/models/cart/cart.svelte.ts
12481
12484
  var lastUuid = 0;
12482
12485
  function createCart(products, contingent = 20) {
12486
+ const items = proxy([]);
12487
+ const coupons = proxy([]);
12488
+ let paymentModeId = /* @__PURE__ */ state(void 0);
12483
12489
  const cart = {
12484
- items: proxy([]),
12485
- coupons: proxy([]),
12486
- paymentModeId: void 0,
12490
+ items,
12491
+ coupons,
12492
+ get paymentModeId() {
12493
+ return get$2(paymentModeId);
12494
+ },
12495
+ set paymentModeId(value) {
12496
+ set(paymentModeId, value, true);
12497
+ },
12487
12498
  uid: `cart-${lastUuid++}`,
12488
12499
  get nonEmptyItems() {
12489
12500
  return this.items.filter((i) => i.quantity > 0);
@@ -13878,6 +13889,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13878
13889
  requiredFields: ["email"]
13879
13890
  });
13880
13891
  }
13892
+ /**
13893
+ * Sets a new password using the one-time credentials the backend appends to
13894
+ * the reset-mail redirect (`access-token`, `client`, `uid` query params).
13895
+ * Unlike `updatePassword` no `current_password` is needed — the reset link
13896
+ * flags the session with `allow_password_change`. The 200 response carries
13897
+ * fresh auth headers which AuthMiddleware ingests, signing the customer in.
13898
+ */
13899
+ setNewPassword(params, headers) {
13900
+ return this.apiPut("/api/v4/auth/password", {
13901
+ body: params,
13902
+ requiredFields: ["password", "password_confirmation"],
13903
+ params: { header: headers }
13904
+ });
13905
+ }
13881
13906
  activateMembership(params) {
13882
13907
  return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13883
13908
  body: params,
@@ -14258,7 +14283,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14258
14283
  var getPersonalizationDetails = createGetDetails(KEY$5);
14259
14284
  //#endregion
14260
14285
  //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalization.svelte
14261
- var root$57 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14286
+ var root$58 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14262
14287
  var root_1$21 = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
14263
14288
  function AnnualTicketPersonalization($$anchor, $$props) {
14264
14289
  push($$props, true);
@@ -14293,7 +14318,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14293
14318
  reset(li_1);
14294
14319
  var node_2 = sibling(li_1, 2);
14295
14320
  var consequent = ($$anchor) => {
14296
- var li_2 = root$57();
14321
+ var li_2 = root$58();
14297
14322
  var a = child(li_2);
14298
14323
  var text_2 = child(a, true);
14299
14324
  reset(a);
@@ -14681,7 +14706,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14681
14706
  function AnnualTicketPersonalizationForm($$anchor, $$props) {
14682
14707
  push($$props, true);
14683
14708
  let token = prop($$props, "token", 7), ticketSaleId = prop($$props, "ticketSaleId", 7);
14684
- let form;
14709
+ let form = null;
14685
14710
  const details = new PersonalizationDetails();
14686
14711
  setPersonalizationDetails($$props.$$host, details);
14687
14712
  user_effect(() => {
@@ -14749,12 +14774,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14749
14774
  } };
14750
14775
  const result = await shop.finalizePersonalizations(token(), body);
14751
14776
  if (result.error) {
14752
- form.details.apiErrors = [result.error.error];
14777
+ form.details.apiErrors = result.error.error ? [result.error.error] : [];
14753
14778
  return;
14754
14779
  }
14755
14780
  const beforeSubmit = configStore.config.forms.personalization?.beforeSubmit;
14756
14781
  if (beforeSubmit) beforeSubmit(body);
14757
- if (configStore.config.urls.annualTicketPersonalizationFormSubmit?.()) configStore.config.navigateTo(configStore.config.urls.annualTicketPersonalizationFormSubmit());
14782
+ const submitUrl = configStore.config.urls.annualTicketPersonalizationFormSubmit?.(token());
14783
+ if (submitUrl) configStore.config.navigateTo(submitUrl);
14758
14784
  }
14759
14785
  let templateForm = null;
14760
14786
  let templateBlueprint = null;
@@ -14979,7 +15005,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14979
15005
  }
14980
15006
  //#endregion
14981
15007
  //#region src/components/forms/ui/generic/Form.svelte
14982
- var root$56 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
15008
+ var root$57 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14983
15009
  function Form($$anchor, $$props) {
14984
15010
  push($$props, true);
14985
15011
  let formId = prop($$props, "formId", 7), custom = prop($$props, "custom", 7);
@@ -15025,7 +15051,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15025
15051
  var fragment = comment();
15026
15052
  var node = first_child(fragment);
15027
15053
  var consequent = ($$anchor) => {
15028
- var fragment_1 = root$56();
15054
+ var fragment_1 = root$57();
15029
15055
  var go_submit = sibling(sibling(first_child(fragment_1), 2), 2);
15030
15056
  var text = child(go_submit, true);
15031
15057
  reset(go_submit);
@@ -15052,10 +15078,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15052
15078
  }, [], ["details"]));
15053
15079
  //#endregion
15054
15080
  //#region src/components/auth/passwordReset/PasswordReset.svelte
15055
- var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15081
+ var root$56 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15056
15082
  function PasswordReset($$anchor, $$props) {
15057
15083
  push($$props, true);
15058
- let custom = prop($$props, "custom", 7, false);
15084
+ let custom = prop($$props, "custom", 7, false), redirectUrl = prop($$props, "redirectUrl", 7, "");
15059
15085
  Forms.defineForm({
15060
15086
  id: "passwordReset",
15061
15087
  submitLabel: "user.passwordReset.actions.requestPasswordReset",
@@ -15066,7 +15092,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15066
15092
  });
15067
15093
  async function passwordReset(event) {
15068
15094
  const details = event.target.details;
15069
- const result = await shop.passwordReset(details.formData);
15095
+ const params = details.formData;
15096
+ const result = await shop.passwordReset(redirectUrl() ? {
15097
+ ...params,
15098
+ redirect_url: redirectUrl()
15099
+ } : params);
15070
15100
  if (result.data) {
15071
15101
  $$props.$$host.dispatchEvent(new Event("go-success", {
15072
15102
  bubbles: true,
@@ -15083,16 +15113,105 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15083
15113
  set custom($$value = false) {
15084
15114
  custom($$value);
15085
15115
  flushSync();
15116
+ },
15117
+ get redirectUrl() {
15118
+ return redirectUrl();
15119
+ },
15120
+ set redirectUrl($$value = "") {
15121
+ redirectUrl($$value);
15122
+ flushSync();
15086
15123
  }
15087
15124
  };
15088
- var go_form = root$55();
15125
+ var go_form = root$56();
15089
15126
  set_custom_element_data(go_form, "formId", "passwordReset");
15090
15127
  template_effect(() => set_custom_element_data(go_form, "custom", custom()));
15091
15128
  event("submit", go_form, passwordReset);
15092
15129
  append($$anchor, go_form);
15093
15130
  return pop($$exports);
15094
15131
  }
15095
- customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
15132
+ customElements.define("go-password-reset", create_custom_element(PasswordReset, {
15133
+ redirectUrl: {
15134
+ attribute: "redirect-url",
15135
+ type: "String"
15136
+ },
15137
+ custom: {}
15138
+ }, [], []));
15139
+ //#endregion
15140
+ //#region src/components/auth/setPassword/SetPassword.svelte
15141
+ var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15142
+ function SetPassword($$anchor, $$props) {
15143
+ push($$props, true);
15144
+ let accessToken = prop($$props, "accessToken", 7, ""), client = prop($$props, "client", 7, ""), uid = prop($$props, "uid", 7, "");
15145
+ Forms.defineForm({
15146
+ id: "setPassword",
15147
+ submitLabel: "user.passwordReset.actions.resetPassword",
15148
+ fields: [{
15149
+ key: "newPassword",
15150
+ required: true
15151
+ }, {
15152
+ key: "confirmPassword",
15153
+ required: true
15154
+ }]
15155
+ });
15156
+ async function setNewPassword(event) {
15157
+ const details = event.target.details;
15158
+ const result = await shop.setNewPassword(details.formData, {
15159
+ "access-token": accessToken(),
15160
+ client: client(),
15161
+ uid: uid()
15162
+ });
15163
+ if (result.data) {
15164
+ $$props.$$host.dispatchEvent(new Event("go-success", {
15165
+ bubbles: true,
15166
+ composed: true
15167
+ }));
15168
+ details.successMessage = result.data.message;
15169
+ details.apiErrors = [];
15170
+ } else details.apiErrors = result.error.errors;
15171
+ }
15172
+ var $$exports = {
15173
+ get accessToken() {
15174
+ return accessToken();
15175
+ },
15176
+ set accessToken($$value = "") {
15177
+ accessToken($$value);
15178
+ flushSync();
15179
+ },
15180
+ get client() {
15181
+ return client();
15182
+ },
15183
+ set client($$value = "") {
15184
+ client($$value);
15185
+ flushSync();
15186
+ },
15187
+ get uid() {
15188
+ return uid();
15189
+ },
15190
+ set uid($$value = "") {
15191
+ uid($$value);
15192
+ flushSync();
15193
+ }
15194
+ };
15195
+ var go_form = root$55();
15196
+ set_custom_element_data(go_form, "formId", "setPassword");
15197
+ event("submit", go_form, setNewPassword);
15198
+ append($$anchor, go_form);
15199
+ return pop($$exports);
15200
+ }
15201
+ customElements.define("go-set-password", create_custom_element(SetPassword, {
15202
+ accessToken: {
15203
+ attribute: "access-token",
15204
+ type: "String"
15205
+ },
15206
+ client: {
15207
+ attribute: "client",
15208
+ type: "String"
15209
+ },
15210
+ uid: {
15211
+ attribute: "uid",
15212
+ type: "String"
15213
+ }
15214
+ }, [], []));
15096
15215
  //#endregion
15097
15216
  //#region src/components/auth/signIn/SignIn.svelte
15098
15217
  function SignIn($$anchor, $$props) {
@@ -18404,6 +18523,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18404
18523
  customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], []));
18405
18524
  //#endregion
18406
18525
  //#region src/components/checkoutForm/lib.ts
18526
+ function postToPaymentProvider(paymentData) {
18527
+ const form = document.createElement("form");
18528
+ form.method = "post";
18529
+ form.action = paymentData.url;
18530
+ for (const [key, value] of Object.entries(paymentData.params)) {
18531
+ const input = document.createElement("input");
18532
+ input.type = "hidden";
18533
+ input.name = key;
18534
+ input.value = String(value);
18535
+ form.appendChild(input);
18536
+ }
18537
+ document.body.appendChild(form);
18538
+ form.submit();
18539
+ }
18407
18540
  async function finalizeCheckout(form, formId) {
18408
18541
  const cart = shop.cart;
18409
18542
  if (!cart) return;
@@ -18416,8 +18549,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
18416
18549
  }
18417
18550
  const beforeSubmit = configStore.config.forms[formId]?.beforeSubmit;
18418
18551
  if (beforeSubmit) await beforeSubmit(form.details.formData);
18419
- const paymentUrl = checkout.data.meta.payment_url;
18420
- configStore.config.navigateTo?.(paymentUrl);
18552
+ const meta = checkout.data.meta;
18553
+ const navigateTo = configStore.config.navigateTo;
18554
+ if (meta.status === "success") navigateTo?.(shop.urls.checkoutSuccess(checkout.data.order.token));
18555
+ else if (meta.status === "fail") navigateTo?.(shop.urls.checkoutFailure(""));
18556
+ else if (meta.payment_url) navigateTo?.(meta.payment_url);
18557
+ else if (meta.payment_data) postToPaymentProvider(meta.payment_data);
18558
+ else navigateTo?.(shop.urls.checkoutFailure(""));
18421
18559
  }
18422
18560
  function setupGuestCheckout(host, custom) {
18423
18561
  Forms.defineForm({
@@ -12237,6 +12237,8 @@ function createCartItem(product, options) {
12237
12237
  };
12238
12238
  return {
12239
12239
  ...finalOptions,
12240
+ quantity: finalOptions.quantity ?? 0,
12241
+ time: finalOptions.time ?? "",
12240
12242
  type: product.type,
12241
12243
  product,
12242
12244
  /**
@@ -12296,7 +12298,8 @@ function createCartItem(product, options) {
12296
12298
  return this.uuid + ":" + this.quantity;
12297
12299
  },
12298
12300
  get price_cents() {
12299
- if (this.time && this.product.dynamic_prices?.[this.time] != null) return this.product.dynamic_prices[this.time];
12301
+ const dynamicPrices = "dynamic_prices" in this.product ? this.product.dynamic_prices : null;
12302
+ if (this.time && dynamicPrices?.[this.time] != null) return dynamicPrices[this.time];
12300
12303
  return this.product.price_cents;
12301
12304
  },
12302
12305
  get price_formatted() {
@@ -12479,10 +12482,18 @@ var defined = (x) => x !== void 0;
12479
12482
  //#region src/lib/models/cart/cart.svelte.ts
12480
12483
  var lastUuid = 0;
12481
12484
  function createCart(products, contingent = 20) {
12485
+ const items = proxy([]);
12486
+ const coupons = proxy([]);
12487
+ let paymentModeId = /* @__PURE__ */ state(void 0);
12482
12488
  const cart = {
12483
- items: proxy([]),
12484
- coupons: proxy([]),
12485
- paymentModeId: void 0,
12489
+ items,
12490
+ coupons,
12491
+ get paymentModeId() {
12492
+ return get$2(paymentModeId);
12493
+ },
12494
+ set paymentModeId(value) {
12495
+ set(paymentModeId, value, true);
12496
+ },
12486
12497
  uid: `cart-${lastUuid++}`,
12487
12498
  get nonEmptyItems() {
12488
12499
  return this.items.filter((i) => i.quantity > 0);
@@ -13877,6 +13888,20 @@ var Shop = class {
13877
13888
  requiredFields: ["email"]
13878
13889
  });
13879
13890
  }
13891
+ /**
13892
+ * Sets a new password using the one-time credentials the backend appends to
13893
+ * the reset-mail redirect (`access-token`, `client`, `uid` query params).
13894
+ * Unlike `updatePassword` no `current_password` is needed — the reset link
13895
+ * flags the session with `allow_password_change`. The 200 response carries
13896
+ * fresh auth headers which AuthMiddleware ingests, signing the customer in.
13897
+ */
13898
+ setNewPassword(params, headers) {
13899
+ return this.apiPut("/api/v4/auth/password", {
13900
+ body: params,
13901
+ requiredFields: ["password", "password_confirmation"],
13902
+ params: { header: headers }
13903
+ });
13904
+ }
13880
13905
  activateMembership(params) {
13881
13906
  return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13882
13907
  body: params,
@@ -14257,7 +14282,7 @@ var setPersonalizationDetails = createSetDetails(KEY$5);
14257
14282
  var getPersonalizationDetails = createGetDetails(KEY$5);
14258
14283
  //#endregion
14259
14284
  //#region src/components/annualTicketPersonalization/components/AnnualTicketPersonalization.svelte
14260
- var root$57 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14285
+ var root$58 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
14261
14286
  var root_1$21 = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
14262
14287
  function AnnualTicketPersonalization($$anchor, $$props) {
14263
14288
  push($$props, true);
@@ -14292,7 +14317,7 @@ function AnnualTicketPersonalization($$anchor, $$props) {
14292
14317
  reset(li_1);
14293
14318
  var node_2 = sibling(li_1, 2);
14294
14319
  var consequent = ($$anchor) => {
14295
- var li_2 = root$57();
14320
+ var li_2 = root$58();
14296
14321
  var a = child(li_2);
14297
14322
  var text_2 = child(a, true);
14298
14323
  reset(a);
@@ -14680,7 +14705,7 @@ function errors(fields) {
14680
14705
  function AnnualTicketPersonalizationForm($$anchor, $$props) {
14681
14706
  push($$props, true);
14682
14707
  let token = prop($$props, "token", 7), ticketSaleId = prop($$props, "ticketSaleId", 7);
14683
- let form;
14708
+ let form = null;
14684
14709
  const details = new PersonalizationDetails();
14685
14710
  setPersonalizationDetails($$props.$$host, details);
14686
14711
  user_effect(() => {
@@ -14748,12 +14773,13 @@ function AnnualTicketPersonalizationForm($$anchor, $$props) {
14748
14773
  } };
14749
14774
  const result = await shop.finalizePersonalizations(token(), body);
14750
14775
  if (result.error) {
14751
- form.details.apiErrors = [result.error.error];
14776
+ form.details.apiErrors = result.error.error ? [result.error.error] : [];
14752
14777
  return;
14753
14778
  }
14754
14779
  const beforeSubmit = configStore.config.forms.personalization?.beforeSubmit;
14755
14780
  if (beforeSubmit) beforeSubmit(body);
14756
- if (configStore.config.urls.annualTicketPersonalizationFormSubmit?.()) configStore.config.navigateTo(configStore.config.urls.annualTicketPersonalizationFormSubmit());
14781
+ const submitUrl = configStore.config.urls.annualTicketPersonalizationFormSubmit?.(token());
14782
+ if (submitUrl) configStore.config.navigateTo(submitUrl);
14757
14783
  }
14758
14784
  let templateForm = null;
14759
14785
  let templateBlueprint = null;
@@ -14978,7 +15004,7 @@ function wrapInElement(host, tag, props) {
14978
15004
  }
14979
15005
  //#endregion
14980
15006
  //#region src/components/forms/ui/generic/Form.svelte
14981
- var root$56 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
15007
+ var root$57 = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit> </go-submit>`, 3);
14982
15008
  function Form($$anchor, $$props) {
14983
15009
  push($$props, true);
14984
15010
  let formId = prop($$props, "formId", 7), custom = prop($$props, "custom", 7);
@@ -15024,7 +15050,7 @@ function Form($$anchor, $$props) {
15024
15050
  var fragment = comment();
15025
15051
  var node = first_child(fragment);
15026
15052
  var consequent = ($$anchor) => {
15027
- var fragment_1 = root$56();
15053
+ var fragment_1 = root$57();
15028
15054
  var go_submit = sibling(sibling(first_child(fragment_1), 2), 2);
15029
15055
  var text = child(go_submit, true);
15030
15056
  reset(go_submit);
@@ -15051,10 +15077,10 @@ customElements.define("go-form", create_custom_element(Form, {
15051
15077
  }, [], ["details"]));
15052
15078
  //#endregion
15053
15079
  //#region src/components/auth/passwordReset/PasswordReset.svelte
15054
- var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15080
+ var root$56 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15055
15081
  function PasswordReset($$anchor, $$props) {
15056
15082
  push($$props, true);
15057
- let custom = prop($$props, "custom", 7, false);
15083
+ let custom = prop($$props, "custom", 7, false), redirectUrl = prop($$props, "redirectUrl", 7, "");
15058
15084
  Forms.defineForm({
15059
15085
  id: "passwordReset",
15060
15086
  submitLabel: "user.passwordReset.actions.requestPasswordReset",
@@ -15065,7 +15091,11 @@ function PasswordReset($$anchor, $$props) {
15065
15091
  });
15066
15092
  async function passwordReset(event) {
15067
15093
  const details = event.target.details;
15068
- const result = await shop.passwordReset(details.formData);
15094
+ const params = details.formData;
15095
+ const result = await shop.passwordReset(redirectUrl() ? {
15096
+ ...params,
15097
+ redirect_url: redirectUrl()
15098
+ } : params);
15069
15099
  if (result.data) {
15070
15100
  $$props.$$host.dispatchEvent(new Event("go-success", {
15071
15101
  bubbles: true,
@@ -15082,16 +15112,105 @@ function PasswordReset($$anchor, $$props) {
15082
15112
  set custom($$value = false) {
15083
15113
  custom($$value);
15084
15114
  flushSync();
15115
+ },
15116
+ get redirectUrl() {
15117
+ return redirectUrl();
15118
+ },
15119
+ set redirectUrl($$value = "") {
15120
+ redirectUrl($$value);
15121
+ flushSync();
15085
15122
  }
15086
15123
  };
15087
- var go_form = root$55();
15124
+ var go_form = root$56();
15088
15125
  set_custom_element_data(go_form, "formId", "passwordReset");
15089
15126
  template_effect(() => set_custom_element_data(go_form, "custom", custom()));
15090
15127
  event("submit", go_form, passwordReset);
15091
15128
  append($$anchor, go_form);
15092
15129
  return pop($$exports);
15093
15130
  }
15094
- customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
15131
+ customElements.define("go-password-reset", create_custom_element(PasswordReset, {
15132
+ redirectUrl: {
15133
+ attribute: "redirect-url",
15134
+ type: "String"
15135
+ },
15136
+ custom: {}
15137
+ }, [], []));
15138
+ //#endregion
15139
+ //#region src/components/auth/setPassword/SetPassword.svelte
15140
+ var root$55 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
15141
+ function SetPassword($$anchor, $$props) {
15142
+ push($$props, true);
15143
+ let accessToken = prop($$props, "accessToken", 7, ""), client = prop($$props, "client", 7, ""), uid = prop($$props, "uid", 7, "");
15144
+ Forms.defineForm({
15145
+ id: "setPassword",
15146
+ submitLabel: "user.passwordReset.actions.resetPassword",
15147
+ fields: [{
15148
+ key: "newPassword",
15149
+ required: true
15150
+ }, {
15151
+ key: "confirmPassword",
15152
+ required: true
15153
+ }]
15154
+ });
15155
+ async function setNewPassword(event) {
15156
+ const details = event.target.details;
15157
+ const result = await shop.setNewPassword(details.formData, {
15158
+ "access-token": accessToken(),
15159
+ client: client(),
15160
+ uid: uid()
15161
+ });
15162
+ if (result.data) {
15163
+ $$props.$$host.dispatchEvent(new Event("go-success", {
15164
+ bubbles: true,
15165
+ composed: true
15166
+ }));
15167
+ details.successMessage = result.data.message;
15168
+ details.apiErrors = [];
15169
+ } else details.apiErrors = result.error.errors;
15170
+ }
15171
+ var $$exports = {
15172
+ get accessToken() {
15173
+ return accessToken();
15174
+ },
15175
+ set accessToken($$value = "") {
15176
+ accessToken($$value);
15177
+ flushSync();
15178
+ },
15179
+ get client() {
15180
+ return client();
15181
+ },
15182
+ set client($$value = "") {
15183
+ client($$value);
15184
+ flushSync();
15185
+ },
15186
+ get uid() {
15187
+ return uid();
15188
+ },
15189
+ set uid($$value = "") {
15190
+ uid($$value);
15191
+ flushSync();
15192
+ }
15193
+ };
15194
+ var go_form = root$55();
15195
+ set_custom_element_data(go_form, "formId", "setPassword");
15196
+ event("submit", go_form, setNewPassword);
15197
+ append($$anchor, go_form);
15198
+ return pop($$exports);
15199
+ }
15200
+ customElements.define("go-set-password", create_custom_element(SetPassword, {
15201
+ accessToken: {
15202
+ attribute: "access-token",
15203
+ type: "String"
15204
+ },
15205
+ client: {
15206
+ attribute: "client",
15207
+ type: "String"
15208
+ },
15209
+ uid: {
15210
+ attribute: "uid",
15211
+ type: "String"
15212
+ }
15213
+ }, [], []));
15095
15214
  //#endregion
15096
15215
  //#region src/components/auth/signIn/SignIn.svelte
15097
15216
  function SignIn($$anchor, $$props) {
@@ -18403,6 +18522,20 @@ function CartCounter($$anchor, $$props) {
18403
18522
  customElements.define("go-cart-counter", create_custom_element(CartCounter, {}, [], []));
18404
18523
  //#endregion
18405
18524
  //#region src/components/checkoutForm/lib.ts
18525
+ function postToPaymentProvider(paymentData) {
18526
+ const form = document.createElement("form");
18527
+ form.method = "post";
18528
+ form.action = paymentData.url;
18529
+ for (const [key, value] of Object.entries(paymentData.params)) {
18530
+ const input = document.createElement("input");
18531
+ input.type = "hidden";
18532
+ input.name = key;
18533
+ input.value = String(value);
18534
+ form.appendChild(input);
18535
+ }
18536
+ document.body.appendChild(form);
18537
+ form.submit();
18538
+ }
18406
18539
  async function finalizeCheckout(form, formId) {
18407
18540
  const cart = shop.cart;
18408
18541
  if (!cart) return;
@@ -18415,8 +18548,13 @@ async function finalizeCheckout(form, formId) {
18415
18548
  }
18416
18549
  const beforeSubmit = configStore.config.forms[formId]?.beforeSubmit;
18417
18550
  if (beforeSubmit) await beforeSubmit(form.details.formData);
18418
- const paymentUrl = checkout.data.meta.payment_url;
18419
- configStore.config.navigateTo?.(paymentUrl);
18551
+ const meta = checkout.data.meta;
18552
+ const navigateTo = configStore.config.navigateTo;
18553
+ if (meta.status === "success") navigateTo?.(shop.urls.checkoutSuccess(checkout.data.order.token));
18554
+ else if (meta.status === "fail") navigateTo?.(shop.urls.checkoutFailure(""));
18555
+ else if (meta.payment_url) navigateTo?.(meta.payment_url);
18556
+ else if (meta.payment_data) postToPaymentProvider(meta.payment_data);
18557
+ else navigateTo?.(shop.urls.checkoutFailure(""));
18420
18558
  }
18421
18559
  function setupGuestCheckout(host, custom) {
18422
18560
  Forms.defineForm({