@gomusdev/web-components 1.44.0 → 1.46.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.
@@ -56,6 +56,7 @@ export declare class PersonalizationDetails {
56
56
  }[];
57
57
  } | null;
58
58
  }[];
59
+ is_bmc_ticket?: boolean | undefined;
59
60
  }[];
60
61
  } | undefined;
61
62
  get ticketSale(): {
@@ -91,7 +92,9 @@ export declare class PersonalizationDetails {
91
92
  }[];
92
93
  } | null;
93
94
  }[];
95
+ is_bmc_ticket?: boolean | undefined;
94
96
  } | undefined;
97
+ get isBmcTicket(): Boolean;
95
98
  goToPersonalization(ticketSale: TicketSale): any;
96
99
  }
97
100
  export declare const setPersonalizationDetails: (host: HTMLElement, details: PersonalizationDetails) => void;
@@ -12816,19 +12816,28 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
12816
12816
  this.update();
12817
12817
  }
12818
12818
  update() {
12819
- this.options = assign(this.defaultConfig, this.override);
12819
+ const merged = assign(this.defaultConfig, this.override);
12820
+ merged.forms = Object.keys({ ...this.defaultConfig.forms, ...this.override.forms }).reduce(
12821
+ (acc, key) => {
12822
+ acc[key] = {
12823
+ ...this.defaultConfig.forms[key],
12824
+ ...this.override.forms[key]
12825
+ };
12826
+ return acc;
12827
+ },
12828
+ {}
12829
+ );
12830
+ this.options = merged;
12820
12831
  }
12821
12832
  get config() {
12822
12833
  return this.options;
12823
12834
  }
12824
12835
  define(options) {
12825
- console.log("ConfigStore.define", options);
12826
12836
  this.override = assign(this.override, options);
12827
12837
  this.update();
12828
12838
  return this;
12829
12839
  }
12830
12840
  default(options) {
12831
- console.log("ConfigStore.default", options);
12832
12841
  this.defaultConfig = assign(this.defaultConfig, options);
12833
12842
  this.update();
12834
12843
  return this;
@@ -12860,6 +12869,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
12860
12869
  get ticketSale() {
12861
12870
  if (this.ticketSaleId) return snapshot(this.order?.ticket_sales.find((ts) => ts.id == this.ticketSaleId));
12862
12871
  }
12872
+ get isBmcTicket() {
12873
+ return this.ticketSale?.is_bmc_ticket || false;
12874
+ }
12863
12875
  goToPersonalization(ticketSale) {
12864
12876
  if (configStore.config.urls.annualTicketPersonalizationForm) {
12865
12877
  return configStore.config.urls.annualTicketPersonalizationForm(this.token, ticketSale.id);
@@ -12870,6 +12882,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
12870
12882
  }
12871
12883
  const KEY$4 = "go-annual-ticket-personalization";
12872
12884
  const setPersonalizationDetails = createSetDetails(KEY$4);
12885
+ const getPersonalizationDetails = createGetDetails(KEY$4);
12873
12886
  var root_3$9 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
12874
12887
  var root_2$q = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
12875
12888
  function AnnualTicketPersonalization($$anchor, $$props) {
@@ -16475,14 +16488,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16475
16488
  fill(data) {
16476
16489
  const fs = this.fields;
16477
16490
  Object.entries(data).forEach(([key, val]) => {
16478
- console.log(key, val);
16479
16491
  const f = fs.find((f2) => f2.apiKey === key);
16480
16492
  if (!f) {
16481
16493
  console.warn(`(FormDetails.fill) Field with API key ${key} not found.`);
16482
16494
  return;
16483
16495
  }
16484
16496
  if (f.type === "select") {
16485
- console.log(f.options());
16486
16497
  if (!f.options?.().find((o) => o.value === val)) {
16487
16498
  throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`);
16488
16499
  }
@@ -16590,7 +16601,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16590
16601
  [],
16591
16602
  ["details"]
16592
16603
  ));
16593
- var root$c = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16604
+ var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16594
16605
  function PasswordReset($$anchor, $$props) {
16595
16606
  push($$props, true);
16596
16607
  let custom2 = prop($$props, "custom", 7, false);
@@ -16620,7 +16631,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16620
16631
  flushSync();
16621
16632
  }
16622
16633
  };
16623
- var go_form = root$c();
16634
+ var go_form = root$a();
16624
16635
  set_custom_element_data(go_form, "formId", "passwordReset");
16625
16636
  template_effect(() => set_custom_element_data(go_form, "custom", custom2()));
16626
16637
  event("submit", go_form, passwordReset);
@@ -16628,7 +16639,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16628
16639
  return pop($$exports);
16629
16640
  }
16630
16641
  customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
16631
- var root$b = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16632
16642
  function SignIn($$anchor, $$props) {
16633
16643
  push($$props, true);
16634
16644
  Forms.defineForm({
@@ -16639,6 +16649,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16639
16649
  { key: "password", required: true }
16640
16650
  ]
16641
16651
  });
16652
+ let custom2 = prop($$props, "custom", 7, false);
16642
16653
  async function signIn(event2) {
16643
16654
  const form = event2.target;
16644
16655
  const details = form.details;
@@ -16649,11 +16660,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16649
16660
  details.apiErrors = result.error.errors;
16650
16661
  }
16651
16662
  }
16652
- var go_form = root$b();
16653
- set_custom_element_data(go_form, "formId", "signIn");
16654
- event("submit", go_form, signIn);
16655
- append($$anchor, go_form);
16656
- pop();
16663
+ wrapInElement($$props.$$host, "go-form", { "form-id": "signIn", custom: custom2() });
16664
+ $$props.$$host.addEventListener("submit", signIn);
16665
+ var $$exports = {
16666
+ get custom() {
16667
+ return custom2();
16668
+ },
16669
+ set custom($$value = false) {
16670
+ custom2($$value);
16671
+ flushSync();
16672
+ }
16673
+ };
16674
+ return pop($$exports);
16657
16675
  }
16658
16676
  customElements.define("go-sign-in", create_custom_element(
16659
16677
  SignIn,
@@ -16663,9 +16681,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16663
16681
  [],
16664
16682
  []
16665
16683
  ));
16666
- var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16667
16684
  function SignUp($$anchor, $$props) {
16668
16685
  push($$props, true);
16686
+ let custom2 = prop($$props, "custom", 7, false);
16669
16687
  Forms.defineForm({
16670
16688
  id: "signUp",
16671
16689
  submitLabel: "common.actions.register",
@@ -16696,11 +16714,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16696
16714
  details.apiErrors = result.error.errors;
16697
16715
  }
16698
16716
  }
16699
- var go_form = root$a();
16700
- set_custom_element_data(go_form, "formId", "signUp");
16701
- event("submit", go_form, signUp);
16702
- append($$anchor, go_form);
16703
- pop();
16717
+ wrapInElement($$props.$$host, "go-form", { "form-id": "signUp", custom: custom2() });
16718
+ $$props.$$host.addEventListener("submit", signUp);
16719
+ var $$exports = {
16720
+ get custom() {
16721
+ return custom2();
16722
+ },
16723
+ set custom($$value = false) {
16724
+ custom2($$value);
16725
+ flushSync();
16726
+ }
16727
+ };
16728
+ return pop($$exports);
16704
16729
  }
16705
16730
  customElements.define("go-sign-up", create_custom_element(
16706
16731
  SignUp,
@@ -17140,26 +17165,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17140
17165
  ]
17141
17166
  });
17142
17167
  wrapInElement($$props.$$host, "go-form", { "form-id": "checkoutGuest", custom: custom2() });
17143
- const form = $$props.$$host.querySelector("go-form");
17144
- onMount(async () => {
17145
- $$props.$$host.addEventListener("go-submit", async (e) => {
17146
- const auth = await shop.signUp(form.details.formData, true);
17147
- if (auth.error) {
17148
- form.details.apiErrors = auth.error.errors;
17149
- return;
17150
- }
17151
- const checkout = await shop.checkout(get$2(cart).orderData());
17152
- if (checkout.error) {
17153
- form.details.apiErrors = checkout.error;
17154
- return;
17155
- }
17156
- const beforeSubmit = configStore.config.forms.checkoutGuest?.beforeSubmit;
17157
- if (beforeSubmit) {
17158
- await beforeSubmit(form.details.formData);
17159
- }
17160
- const paymentUrl = checkout.data.meta.payment_url;
17161
- configStore.config.navigateTo?.(paymentUrl);
17162
- });
17168
+ $$props.$$host.addEventListener("submit", async (e) => {
17169
+ const form = e.target;
17170
+ const auth = await shop.signUp(form.details.formData, true);
17171
+ if (auth.error) {
17172
+ form.details.apiErrors = auth.error.errors;
17173
+ return;
17174
+ }
17175
+ const checkout = await shop.checkout(get$2(cart).orderData());
17176
+ if (checkout.error) {
17177
+ form.details.apiErrors = checkout.error;
17178
+ return;
17179
+ }
17180
+ const beforeSubmit = configStore.config.forms.checkoutGuest?.beforeSubmit;
17181
+ if (beforeSubmit) {
17182
+ await beforeSubmit(form.details.formData);
17183
+ }
17184
+ const paymentUrl = checkout.data.meta.payment_url;
17185
+ configStore.config.navigateTo?.(paymentUrl);
17163
17186
  });
17164
17187
  var $$exports = {
17165
17188
  get custom() {
@@ -31631,10 +31654,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31631
31654
  let when = prop($$props, "when", 7), then = prop($$props, "then", 7, "show");
31632
31655
  const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
31633
31656
  const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
31657
+ const _personalizationDetails = getPersonalizationDetails($$props.$$host);
31658
+ const personalizationDetails = /* @__PURE__ */ user_derived(() => _personalizationDetails.value);
31634
31659
  const _formDetails = getDetails$1($$props.$$host);
31635
31660
  const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value);
31636
31661
  let data = /* @__PURE__ */ user_derived(() => ({
31637
31662
  ticketSelection: get$2(ticketSelectionDetails),
31663
+ personalizationDetails: get$2(personalizationDetails),
31638
31664
  formData: get$2(formDetails)?.formData,
31639
31665
  cart: shop.cart
31640
31666
  }));
@@ -12816,19 +12816,28 @@ class ConfigStoreSvelte {
12816
12816
  this.update();
12817
12817
  }
12818
12818
  update() {
12819
- this.options = assign(this.defaultConfig, this.override);
12819
+ const merged = assign(this.defaultConfig, this.override);
12820
+ merged.forms = Object.keys({ ...this.defaultConfig.forms, ...this.override.forms }).reduce(
12821
+ (acc, key) => {
12822
+ acc[key] = {
12823
+ ...this.defaultConfig.forms[key],
12824
+ ...this.override.forms[key]
12825
+ };
12826
+ return acc;
12827
+ },
12828
+ {}
12829
+ );
12830
+ this.options = merged;
12820
12831
  }
12821
12832
  get config() {
12822
12833
  return this.options;
12823
12834
  }
12824
12835
  define(options) {
12825
- console.log("ConfigStore.define", options);
12826
12836
  this.override = assign(this.override, options);
12827
12837
  this.update();
12828
12838
  return this;
12829
12839
  }
12830
12840
  default(options) {
12831
- console.log("ConfigStore.default", options);
12832
12841
  this.defaultConfig = assign(this.defaultConfig, options);
12833
12842
  this.update();
12834
12843
  return this;
@@ -12860,6 +12869,9 @@ class PersonalizationDetails {
12860
12869
  get ticketSale() {
12861
12870
  if (this.ticketSaleId) return snapshot(this.order?.ticket_sales.find((ts) => ts.id == this.ticketSaleId));
12862
12871
  }
12872
+ get isBmcTicket() {
12873
+ return this.ticketSale?.is_bmc_ticket || false;
12874
+ }
12863
12875
  goToPersonalization(ticketSale) {
12864
12876
  if (configStore.config.urls.annualTicketPersonalizationForm) {
12865
12877
  return configStore.config.urls.annualTicketPersonalizationForm(this.token, ticketSale.id);
@@ -12870,6 +12882,7 @@ class PersonalizationDetails {
12870
12882
  }
12871
12883
  const KEY$4 = "go-annual-ticket-personalization";
12872
12884
  const setPersonalizationDetails = createSetDetails(KEY$4);
12885
+ const getPersonalizationDetails = createGetDetails(KEY$4);
12873
12886
  var root_3$9 = /* @__PURE__ */ from_html(`<li><a> </a></li>`);
12874
12887
  var root_2$q = /* @__PURE__ */ from_html(`<ul class="go-annual-ticket"><li class="go-annual-ticket-title"> </li> <li class="go-annual-ticket-personalization-count"> </li> <!></ul>`);
12875
12888
  function AnnualTicketPersonalization($$anchor, $$props) {
@@ -16475,14 +16488,12 @@ class FormDetails {
16475
16488
  fill(data) {
16476
16489
  const fs = this.fields;
16477
16490
  Object.entries(data).forEach(([key, val]) => {
16478
- console.log(key, val);
16479
16491
  const f = fs.find((f2) => f2.apiKey === key);
16480
16492
  if (!f) {
16481
16493
  console.warn(`(FormDetails.fill) Field with API key ${key} not found.`);
16482
16494
  return;
16483
16495
  }
16484
16496
  if (f.type === "select") {
16485
- console.log(f.options());
16486
16497
  if (!f.options?.().find((o) => o.value === val)) {
16487
16498
  throw new Error(`(FormDetails.fill) Field ${key} has invalid value: ${val}`);
16488
16499
  }
@@ -16590,7 +16601,7 @@ customElements.define("go-form", create_custom_element(
16590
16601
  [],
16591
16602
  ["details"]
16592
16603
  ));
16593
- var root$c = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16604
+ var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16594
16605
  function PasswordReset($$anchor, $$props) {
16595
16606
  push($$props, true);
16596
16607
  let custom2 = prop($$props, "custom", 7, false);
@@ -16620,7 +16631,7 @@ function PasswordReset($$anchor, $$props) {
16620
16631
  flushSync();
16621
16632
  }
16622
16633
  };
16623
- var go_form = root$c();
16634
+ var go_form = root$a();
16624
16635
  set_custom_element_data(go_form, "formId", "passwordReset");
16625
16636
  template_effect(() => set_custom_element_data(go_form, "custom", custom2()));
16626
16637
  event("submit", go_form, passwordReset);
@@ -16628,7 +16639,6 @@ function PasswordReset($$anchor, $$props) {
16628
16639
  return pop($$exports);
16629
16640
  }
16630
16641
  customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], []));
16631
- var root$b = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16632
16642
  function SignIn($$anchor, $$props) {
16633
16643
  push($$props, true);
16634
16644
  Forms.defineForm({
@@ -16639,6 +16649,7 @@ function SignIn($$anchor, $$props) {
16639
16649
  { key: "password", required: true }
16640
16650
  ]
16641
16651
  });
16652
+ let custom2 = prop($$props, "custom", 7, false);
16642
16653
  async function signIn(event2) {
16643
16654
  const form = event2.target;
16644
16655
  const details = form.details;
@@ -16649,11 +16660,18 @@ function SignIn($$anchor, $$props) {
16649
16660
  details.apiErrors = result.error.errors;
16650
16661
  }
16651
16662
  }
16652
- var go_form = root$b();
16653
- set_custom_element_data(go_form, "formId", "signIn");
16654
- event("submit", go_form, signIn);
16655
- append($$anchor, go_form);
16656
- pop();
16663
+ wrapInElement($$props.$$host, "go-form", { "form-id": "signIn", custom: custom2() });
16664
+ $$props.$$host.addEventListener("submit", signIn);
16665
+ var $$exports = {
16666
+ get custom() {
16667
+ return custom2();
16668
+ },
16669
+ set custom($$value = false) {
16670
+ custom2($$value);
16671
+ flushSync();
16672
+ }
16673
+ };
16674
+ return pop($$exports);
16657
16675
  }
16658
16676
  customElements.define("go-sign-in", create_custom_element(
16659
16677
  SignIn,
@@ -16663,9 +16681,9 @@ customElements.define("go-sign-in", create_custom_element(
16663
16681
  [],
16664
16682
  []
16665
16683
  ));
16666
- var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
16667
16684
  function SignUp($$anchor, $$props) {
16668
16685
  push($$props, true);
16686
+ let custom2 = prop($$props, "custom", 7, false);
16669
16687
  Forms.defineForm({
16670
16688
  id: "signUp",
16671
16689
  submitLabel: "common.actions.register",
@@ -16696,11 +16714,18 @@ function SignUp($$anchor, $$props) {
16696
16714
  details.apiErrors = result.error.errors;
16697
16715
  }
16698
16716
  }
16699
- var go_form = root$a();
16700
- set_custom_element_data(go_form, "formId", "signUp");
16701
- event("submit", go_form, signUp);
16702
- append($$anchor, go_form);
16703
- pop();
16717
+ wrapInElement($$props.$$host, "go-form", { "form-id": "signUp", custom: custom2() });
16718
+ $$props.$$host.addEventListener("submit", signUp);
16719
+ var $$exports = {
16720
+ get custom() {
16721
+ return custom2();
16722
+ },
16723
+ set custom($$value = false) {
16724
+ custom2($$value);
16725
+ flushSync();
16726
+ }
16727
+ };
16728
+ return pop($$exports);
16704
16729
  }
16705
16730
  customElements.define("go-sign-up", create_custom_element(
16706
16731
  SignUp,
@@ -17140,26 +17165,24 @@ function CheckoutForm($$anchor, $$props) {
17140
17165
  ]
17141
17166
  });
17142
17167
  wrapInElement($$props.$$host, "go-form", { "form-id": "checkoutGuest", custom: custom2() });
17143
- const form = $$props.$$host.querySelector("go-form");
17144
- onMount(async () => {
17145
- $$props.$$host.addEventListener("go-submit", async (e) => {
17146
- const auth = await shop.signUp(form.details.formData, true);
17147
- if (auth.error) {
17148
- form.details.apiErrors = auth.error.errors;
17149
- return;
17150
- }
17151
- const checkout = await shop.checkout(get$2(cart).orderData());
17152
- if (checkout.error) {
17153
- form.details.apiErrors = checkout.error;
17154
- return;
17155
- }
17156
- const beforeSubmit = configStore.config.forms.checkoutGuest?.beforeSubmit;
17157
- if (beforeSubmit) {
17158
- await beforeSubmit(form.details.formData);
17159
- }
17160
- const paymentUrl = checkout.data.meta.payment_url;
17161
- configStore.config.navigateTo?.(paymentUrl);
17162
- });
17168
+ $$props.$$host.addEventListener("submit", async (e) => {
17169
+ const form = e.target;
17170
+ const auth = await shop.signUp(form.details.formData, true);
17171
+ if (auth.error) {
17172
+ form.details.apiErrors = auth.error.errors;
17173
+ return;
17174
+ }
17175
+ const checkout = await shop.checkout(get$2(cart).orderData());
17176
+ if (checkout.error) {
17177
+ form.details.apiErrors = checkout.error;
17178
+ return;
17179
+ }
17180
+ const beforeSubmit = configStore.config.forms.checkoutGuest?.beforeSubmit;
17181
+ if (beforeSubmit) {
17182
+ await beforeSubmit(form.details.formData);
17183
+ }
17184
+ const paymentUrl = checkout.data.meta.payment_url;
17185
+ configStore.config.navigateTo?.(paymentUrl);
17163
17186
  });
17164
17187
  var $$exports = {
17165
17188
  get custom() {
@@ -31631,10 +31654,13 @@ function If($$anchor, $$props) {
31631
31654
  let when = prop($$props, "when", 7), then = prop($$props, "then", 7, "show");
31632
31655
  const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
31633
31656
  const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
31657
+ const _personalizationDetails = getPersonalizationDetails($$props.$$host);
31658
+ const personalizationDetails = /* @__PURE__ */ user_derived(() => _personalizationDetails.value);
31634
31659
  const _formDetails = getDetails$1($$props.$$host);
31635
31660
  const formDetails = /* @__PURE__ */ user_derived(() => _formDetails.value);
31636
31661
  let data = /* @__PURE__ */ user_derived(() => ({
31637
31662
  ticketSelection: get$2(ticketSelectionDetails),
31663
+ personalizationDetails: get$2(personalizationDetails),
31638
31664
  formData: get$2(formDetails)?.formData,
31639
31665
  cart: shop.cart
31640
31666
  }));
@@ -1 +1 @@
1
- export declare function wrapInElement(host: HTMLElement, tag: string, props?: Record<string, string | boolean>): HTMLElement;
1
+ export declare function wrapInElement(host: HTMLElement, tag: string, props?: Record<string, unknown | boolean>): HTMLElement;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.44.0",
7
+ "version": "1.46.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",