@gomusdev/web-components 3.10.1 → 3.11.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.11.0 (2026-07-06)
4
+
5
+ ### Features
6
+
7
+ * **finalize-changelog:** stamp `UNRELEASED` markers with release version and expand MDX tracking
8
+ * **go-api:** fail validateToken early without a local token
9
+
10
+ ## 3.10.2 (2026-07-02)
11
+
12
+ ### Bug Fixes
13
+
14
+ * **release:** build bundle and stamp released version so the skill auto-publishes
15
+
3
16
  ## 3.10.1 (2026-07-02)
4
17
 
5
18
  ### Bug Fixes
@@ -13421,6 +13421,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13421
13421
  };
13422
13422
  //#endregion
13423
13423
  //#region src/lib/stores/shop.svelte.ts
13424
+ var NOT_SIGNED_IN = { error: {
13425
+ success: false,
13426
+ errors: ["Not signed in"]
13427
+ } };
13424
13428
  var Shop = class {
13425
13429
  type;
13426
13430
  #data = /* @__PURE__ */ state(proxy({
@@ -13519,8 +13523,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
13519
13523
  get _data() {
13520
13524
  return get$2(this.#data);
13521
13525
  }
13522
- validateToken() {
13523
- return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `validateToken`, "", { cache: 5 });
13526
+ getCustomer() {
13527
+ if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
13528
+ return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `getCustomer`, "", { cache: 5 });
13524
13529
  }
13525
13530
  ticketsCalendar(params) {
13526
13531
  return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
@@ -34052,7 +34057,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34052
34057
  ]
34053
34058
  });
34054
34059
  let form = /* @__PURE__ */ state(void 0);
34055
- const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
34060
+ const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
34056
34061
  onMount(async () => {
34057
34062
  await shop.waitForAllFetches();
34058
34063
  await pollUntilTruthy(() => get$2(form).details);
@@ -34071,7 +34076,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34071
34076
  var root$4 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1);
34072
34077
  function Overview($$anchor, $$props) {
34073
34078
  push($$props, true);
34074
- const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
34079
+ const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
34075
34080
  const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data);
34076
34081
  var fragment = comment();
34077
34082
  var node = first_child(fragment);
@@ -37290,14 +37295,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
37290
37295
  } }, [], []));
37291
37296
  //#endregion
37292
37297
  //#region src/go/go.ts
37298
+ var initPromise = null;
37299
+ async function ensureShopReady() {
37300
+ if (initPromise) return initPromise;
37301
+ if (!shop.client) throw new Error("[go.api] Shop not initialized — call go.init({ shop, api, locale }) first.");
37302
+ }
37293
37303
  async function initGo(window) {
37294
37304
  const stub = window.go;
37295
37305
  let q = stub && stub._queue || [];
37296
37306
  console.log(q);
37297
- for (const command of q) try {
37298
- await go[command.method](command.options);
37299
- } catch (e) {
37300
- console.error(e);
37307
+ for (const command of q) {
37308
+ if (command.method === "load") continue;
37309
+ try {
37310
+ await go[command.method](command.options);
37311
+ } catch (e) {
37312
+ console.error(e);
37313
+ }
37301
37314
  }
37302
37315
  window.go = go;
37303
37316
  if (stub) stub._queue = null;
@@ -37308,8 +37321,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
37308
37321
  configStore.define(options);
37309
37322
  },
37310
37323
  init: async (options) => {
37311
- await shop.load("https://" + options.api, options.shop, options.locale);
37312
- }
37324
+ try {
37325
+ initPromise = shop.load("https://" + options.api, options.shop, options.locale);
37326
+ await initPromise;
37327
+ } catch (e) {
37328
+ initPromise = null;
37329
+ throw e;
37330
+ }
37331
+ },
37332
+ api: { getCustomer: async () => {
37333
+ await ensureShopReady();
37334
+ return shop.asyncFetch(() => shop.getCustomer());
37335
+ } }
37313
37336
  };
37314
37337
  (async () => {
37315
37338
  await initGo(window);
@@ -13420,6 +13420,10 @@ var CustomerLevels = {
13420
13420
  };
13421
13421
  //#endregion
13422
13422
  //#region src/lib/stores/shop.svelte.ts
13423
+ var NOT_SIGNED_IN = { error: {
13424
+ success: false,
13425
+ errors: ["Not signed in"]
13426
+ } };
13423
13427
  var Shop = class {
13424
13428
  type;
13425
13429
  #data = /* @__PURE__ */ state(proxy({
@@ -13518,8 +13522,9 @@ var Shop = class {
13518
13522
  get _data() {
13519
13523
  return get$2(this.#data);
13520
13524
  }
13521
- validateToken() {
13522
- return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `validateToken`, "", { cache: 5 });
13525
+ getCustomer() {
13526
+ if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
13527
+ return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `getCustomer`, "", { cache: 5 });
13523
13528
  }
13524
13529
  ticketsCalendar(params) {
13525
13530
  return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
@@ -34051,7 +34056,7 @@ function Details$2($$anchor, $$props) {
34051
34056
  ]
34052
34057
  });
34053
34058
  let form = /* @__PURE__ */ state(void 0);
34054
- const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
34059
+ const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
34055
34060
  onMount(async () => {
34056
34061
  await shop.waitForAllFetches();
34057
34062
  await pollUntilTruthy(() => get$2(form).details);
@@ -34070,7 +34075,7 @@ customElements.define("go-profile-details", create_custom_element(Details$2, {},
34070
34075
  var root$4 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1);
34071
34076
  function Overview($$anchor, $$props) {
34072
34077
  push($$props, true);
34073
- const user = /* @__PURE__ */ user_derived(() => shop.validateToken());
34078
+ const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
34074
34079
  const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data);
34075
34080
  var fragment = comment();
34076
34081
  var node = first_child(fragment);
@@ -37289,14 +37294,22 @@ customElements.define("go-withdrawal-form", create_custom_element(Withdrawal, {
37289
37294
  } }, [], []));
37290
37295
  //#endregion
37291
37296
  //#region src/go/go.ts
37297
+ var initPromise = null;
37298
+ async function ensureShopReady() {
37299
+ if (initPromise) return initPromise;
37300
+ if (!shop.client) throw new Error("[go.api] Shop not initialized — call go.init({ shop, api, locale }) first.");
37301
+ }
37292
37302
  async function initGo(window) {
37293
37303
  const stub = window.go;
37294
37304
  let q = stub && stub._queue || [];
37295
37305
  console.log(q);
37296
- for (const command of q) try {
37297
- await go[command.method](command.options);
37298
- } catch (e) {
37299
- console.error(e);
37306
+ for (const command of q) {
37307
+ if (command.method === "load") continue;
37308
+ try {
37309
+ await go[command.method](command.options);
37310
+ } catch (e) {
37311
+ console.error(e);
37312
+ }
37300
37313
  }
37301
37314
  window.go = go;
37302
37315
  if (stub) stub._queue = null;
@@ -37307,8 +37320,18 @@ var go = {
37307
37320
  configStore.define(options);
37308
37321
  },
37309
37322
  init: async (options) => {
37310
- await shop.load("https://" + options.api, options.shop, options.locale);
37311
- }
37323
+ try {
37324
+ initPromise = shop.load("https://" + options.api, options.shop, options.locale);
37325
+ await initPromise;
37326
+ } catch (e) {
37327
+ initPromise = null;
37328
+ throw e;
37329
+ }
37330
+ },
37331
+ api: { getCustomer: async () => {
37332
+ await ensureShopReady();
37333
+ return shop.asyncFetch(() => shop.getCustomer());
37334
+ } }
37312
37335
  };
37313
37336
  (async () => {
37314
37337
  await initGo(window);