@gomusdev/web-components 1.8.2 → 1.8.4

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.
@@ -11012,7 +11012,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11012
11012
  class Shop {
11013
11013
  constructor(apiUrl, shopDomain, locale, type = "angular") {
11014
11014
  __privateAdd(this, _Shop_instances);
11015
- __privateAdd(this, _data2, /* @__PURE__ */ state(proxy({ customerSalutations: [], countries: [] })));
11015
+ __privateAdd(this, _data2, /* @__PURE__ */ state(proxy({ customerSalutations: [], countries: [], locales: [] })));
11016
11016
  // Holds the fetch status and timestamp for data requests, tracking whether the request is ongoing or completed and when it was completed.
11017
11017
  __privateAdd(this, _fetchStatus, {});
11018
11018
  __privateAdd(this, _canFetch, () => {
@@ -11212,6 +11212,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11212
11212
  get countries() {
11213
11213
  return this.fetchAndCache("/api/v3/countries", "countries", "countries");
11214
11214
  }
11215
+ get locales() {
11216
+ return this.fetchAndCache("/api/v4/locales", "locales", "locales_options");
11217
+ }
11215
11218
  get urls() {
11216
11219
  return get(__privateGet(this, _data2)).urls;
11217
11220
  }
@@ -11400,10 +11403,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11400
11403
  placeholder: "",
11401
11404
  description: "",
11402
11405
  autocomplete: "language",
11403
- options: () => [
11404
- { value: 1, label: "German" },
11405
- { value: 5, label: "English" }
11406
- ]
11406
+ options: () => shop.locales.map((c) => ({ label: c.locale, value: c.id }))
11407
11407
  },
11408
11408
  acceptTerms: {
11409
11409
  key: "acceptTerms",
@@ -13791,11 +13791,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13791
13791
  let when = prop($$props, "when", 7), then = prop($$props, "then", 7, "show");
13792
13792
  const data = /* @__PURE__ */ state(proxy({}));
13793
13793
  get(data).ticketSelection = getTicketSelectionDetails($$props.$$host);
13794
+ let formDetails = /* @__PURE__ */ state(void 0);
13794
13795
  user_effect(() => {
13795
- var _a2;
13796
- const formDetails = getDetails($$props.$$host);
13797
- if (!formDetails) return;
13798
- get(data).formData = (_a2 = getDetails($$props.$$host)) == null ? void 0 : _a2.formData;
13796
+ if (!get(formDetails)) return;
13797
+ get(data).formData = get(formDetails).formData;
13799
13798
  });
13800
13799
  let evaluatedWhen = /* @__PURE__ */ user_derived(() => evaluateExpression(when(), get(data)));
13801
13800
  let content = null;
@@ -13815,6 +13814,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13815
13814
  }
13816
13815
  }
13817
13816
  });
13817
+ onMount(async () => {
13818
+ set(formDetails, await pollUntilTruthy(() => getDetails($$props.$$host)), true);
13819
+ });
13818
13820
  return pop({
13819
13821
  get data() {
13820
13822
  return get(data);
@@ -11012,7 +11012,7 @@ function formatDate(isoDateString, options = {
11012
11012
  class Shop {
11013
11013
  constructor(apiUrl, shopDomain, locale, type = "angular") {
11014
11014
  __privateAdd(this, _Shop_instances);
11015
- __privateAdd(this, _data2, /* @__PURE__ */ state(proxy({ customerSalutations: [], countries: [] })));
11015
+ __privateAdd(this, _data2, /* @__PURE__ */ state(proxy({ customerSalutations: [], countries: [], locales: [] })));
11016
11016
  // Holds the fetch status and timestamp for data requests, tracking whether the request is ongoing or completed and when it was completed.
11017
11017
  __privateAdd(this, _fetchStatus, {});
11018
11018
  __privateAdd(this, _canFetch, () => {
@@ -11212,6 +11212,9 @@ class Shop {
11212
11212
  get countries() {
11213
11213
  return this.fetchAndCache("/api/v3/countries", "countries", "countries");
11214
11214
  }
11215
+ get locales() {
11216
+ return this.fetchAndCache("/api/v4/locales", "locales", "locales_options");
11217
+ }
11215
11218
  get urls() {
11216
11219
  return get(__privateGet(this, _data2)).urls;
11217
11220
  }
@@ -11400,10 +11403,7 @@ var allFields = {
11400
11403
  placeholder: "",
11401
11404
  description: "",
11402
11405
  autocomplete: "language",
11403
- options: () => [
11404
- { value: 1, label: "German" },
11405
- { value: 5, label: "English" }
11406
- ]
11406
+ options: () => shop.locales.map((c) => ({ label: c.locale, value: c.id }))
11407
11407
  },
11408
11408
  acceptTerms: {
11409
11409
  key: "acceptTerms",
@@ -13791,11 +13791,10 @@ function If($$anchor, $$props) {
13791
13791
  let when = prop($$props, "when", 7), then = prop($$props, "then", 7, "show");
13792
13792
  const data = /* @__PURE__ */ state(proxy({}));
13793
13793
  get(data).ticketSelection = getTicketSelectionDetails($$props.$$host);
13794
+ let formDetails = /* @__PURE__ */ state(void 0);
13794
13795
  user_effect(() => {
13795
- var _a2;
13796
- const formDetails = getDetails($$props.$$host);
13797
- if (!formDetails) return;
13798
- get(data).formData = (_a2 = getDetails($$props.$$host)) == null ? void 0 : _a2.formData;
13796
+ if (!get(formDetails)) return;
13797
+ get(data).formData = get(formDetails).formData;
13799
13798
  });
13800
13799
  let evaluatedWhen = /* @__PURE__ */ user_derived(() => evaluateExpression(when(), get(data)));
13801
13800
  let content = null;
@@ -13815,6 +13814,9 @@ function If($$anchor, $$props) {
13815
13814
  }
13816
13815
  }
13817
13816
  });
13817
+ onMount(async () => {
13818
+ set(formDetails, await pollUntilTruthy(() => getDetails($$props.$$host)), true);
13819
+ });
13818
13820
  return pop({
13819
13821
  get data() {
13820
13822
  return get(data);
@@ -3,7 +3,7 @@ import { ShopUrls } from '../helpers/urls';
3
3
  import { User } from './user.svelte.ts';
4
4
  import { OpenApiClient } from '@gomus/api';
5
5
  import { TicketsAndQuotasParams, TicketsCalendarParams, TicketsParams } from '@gomus/api/lib/types.ts';
6
- import { CheckoutParams, CheckoutResponse, Country, Event, Exhibition, Merchandise, Museum, Salutation, ShopType, SignInParams, SignInResponse, SignUpParams, SignUpResponse, Tour } from '@gomus/types';
6
+ import { CheckoutParams, CheckoutResponse, Country, Event, Exhibition, LocaleOptions, Merchandise, Museum, Salutation, ShopType, SignInParams, SignInResponse, SignUpParams, SignUpResponse, Tour } from '@gomus/types';
7
7
  export type ShopKind = 'angular' | 'jmb';
8
8
  export declare class Shop {
9
9
  #private;
@@ -118,6 +118,7 @@ export declare class Shop {
118
118
  urls?: ShopUrls;
119
119
  customerSalutations?: Salutation[];
120
120
  countries?: Country[];
121
+ locales?: LocaleOptions;
121
122
  };
122
123
  ticketsCalendar(params: TicketsCalendarParams): CalendarDates;
123
124
  ticketsAndQuotas(params: TicketsAndQuotasParams): {
@@ -373,6 +374,10 @@ export declare class Shop {
373
374
  id: number;
374
375
  name: string;
375
376
  }[];
377
+ get locales(): {
378
+ id: number;
379
+ locale: string;
380
+ }[];
376
381
  get urls(): {
377
382
  account: () => string;
378
383
  annualTickets: () => string;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.8.2",
7
+ "version": "1.8.4",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",