@gomusdev/web-components 4.1.1 → 4.2.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.0 (2026-07-09)
4
+
5
+ ### Features
6
+
7
+ * **membership:** add <go-membership-activation> form web component
8
+
3
9
  ## 4.1.1 (2026-07-09)
4
10
 
5
11
  ### Bug Fixes
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -13545,6 +13545,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13545
13545
  var SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
13546
13546
  var SIGN_UP_ENDPOINT = "/api/v4/auth";
13547
13547
  var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
13548
+ var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate";
13548
13549
  var ORDERS_ENDPOINT = "/api/v4/orders";
13549
13550
  //#endregion
13550
13551
  //#region ../../packages/gomus-api/lib/customerLevels.ts
@@ -13763,6 +13764,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13763
13764
  requiredFields: ["email"]
13764
13765
  });
13765
13766
  }
13767
+ activateMembership(params) {
13768
+ return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13769
+ body: params,
13770
+ requiredFields: ["email"],
13771
+ parseAs: "text"
13772
+ });
13773
+ }
13766
13774
  checkout(params) {
13767
13775
  return this.apiPost(`/api/v4/orders`, {
13768
13776
  body: params,
@@ -35772,6 +35780,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
35772
35780
  type: "String"
35773
35781
  } }, [], []));
35774
35782
  //#endregion
35783
+ //#region src/components/membershipActivation/MembershipActivation.svelte
35784
+ function MembershipActivation($$anchor, $$props) {
35785
+ push($$props, true);
35786
+ let custom = prop($$props, "custom", 7, false);
35787
+ Forms.defineForm({
35788
+ id: "membershipActivation",
35789
+ submitLabel: "membership.activation.actions.submit",
35790
+ fields: [{
35791
+ key: "email",
35792
+ required: true
35793
+ }]
35794
+ });
35795
+ async function onSubmit(event) {
35796
+ const details = event.target.details;
35797
+ if ((await shop.activateMembership(details.formData)).response?.ok) $$props.$$host.dispatchEvent(new Event("go-success", {
35798
+ bubbles: true,
35799
+ composed: true
35800
+ }));
35801
+ else details.apiErrors = [shop.t("membership.activation.form.errors.requestFailed")];
35802
+ }
35803
+ wrapInElement($$props.$$host, "go-form", {
35804
+ "form-id": "membershipActivation",
35805
+ custom: custom()
35806
+ });
35807
+ $$props.$$host.addEventListener("submit", onSubmit);
35808
+ return pop({
35809
+ get custom() {
35810
+ return custom();
35811
+ },
35812
+ set custom($$value = false) {
35813
+ custom($$value);
35814
+ flushSync();
35815
+ }
35816
+ });
35817
+ }
35818
+ customElements.define("go-membership-activation", create_custom_element(MembershipActivation, { custom: {
35819
+ attribute: "custom",
35820
+ reflect: true,
35821
+ type: "Boolean"
35822
+ } }, [], []));
35823
+ //#endregion
35775
35824
  //#region src/components/order/lib/OrderDetails.svelte.ts
35776
35825
  var OrderDetails = class {
35777
35826
  #token = /* @__PURE__ */ state();
@@ -13544,6 +13544,7 @@ var TICKETS_ENDPOINT = "/api/v4/tickets";
13544
13544
  var SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
13545
13545
  var SIGN_UP_ENDPOINT = "/api/v4/auth";
13546
13546
  var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
13547
+ var MEMBERSHIP_ACTIVATION_ENDPOINT = "/api/v4/customer/memberships/activate";
13547
13548
  var ORDERS_ENDPOINT = "/api/v4/orders";
13548
13549
  //#endregion
13549
13550
  //#region ../../packages/gomus-api/lib/customerLevels.ts
@@ -13762,6 +13763,13 @@ var Shop = class {
13762
13763
  requiredFields: ["email"]
13763
13764
  });
13764
13765
  }
13766
+ activateMembership(params) {
13767
+ return this.apiPost(MEMBERSHIP_ACTIVATION_ENDPOINT, {
13768
+ body: params,
13769
+ requiredFields: ["email"],
13770
+ parseAs: "text"
13771
+ });
13772
+ }
13765
13773
  checkout(params) {
13766
13774
  return this.apiPost(`/api/v4/orders`, {
13767
13775
  body: params,
@@ -35771,6 +35779,47 @@ customElements.define("go-link", create_custom_element(Link, { to: {
35771
35779
  type: "String"
35772
35780
  } }, [], []));
35773
35781
  //#endregion
35782
+ //#region src/components/membershipActivation/MembershipActivation.svelte
35783
+ function MembershipActivation($$anchor, $$props) {
35784
+ push($$props, true);
35785
+ let custom = prop($$props, "custom", 7, false);
35786
+ Forms.defineForm({
35787
+ id: "membershipActivation",
35788
+ submitLabel: "membership.activation.actions.submit",
35789
+ fields: [{
35790
+ key: "email",
35791
+ required: true
35792
+ }]
35793
+ });
35794
+ async function onSubmit(event) {
35795
+ const details = event.target.details;
35796
+ if ((await shop.activateMembership(details.formData)).response?.ok) $$props.$$host.dispatchEvent(new Event("go-success", {
35797
+ bubbles: true,
35798
+ composed: true
35799
+ }));
35800
+ else details.apiErrors = [shop.t("membership.activation.form.errors.requestFailed")];
35801
+ }
35802
+ wrapInElement($$props.$$host, "go-form", {
35803
+ "form-id": "membershipActivation",
35804
+ custom: custom()
35805
+ });
35806
+ $$props.$$host.addEventListener("submit", onSubmit);
35807
+ return pop({
35808
+ get custom() {
35809
+ return custom();
35810
+ },
35811
+ set custom($$value = false) {
35812
+ custom($$value);
35813
+ flushSync();
35814
+ }
35815
+ });
35816
+ }
35817
+ customElements.define("go-membership-activation", create_custom_element(MembershipActivation, { custom: {
35818
+ attribute: "custom",
35819
+ reflect: true,
35820
+ type: "Boolean"
35821
+ } }, [], []));
35822
+ //#endregion
35774
35823
  //#region src/components/order/lib/OrderDetails.svelte.ts
35775
35824
  var OrderDetails = class {
35776
35825
  #token = /* @__PURE__ */ state();