@gomusdev/web-components 3.10.2 → 3.12.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 +13 -0
- package/dist-js/gomus-webcomponents.iife.js +46 -9
- package/dist-js/gomus-webcomponents.js +46 -9
- package/dist-js/gomus-webcomponents.min.iife.js +20 -20
- package/dist-js/gomus-webcomponents.min.js +3832 -3808
- package/dist-js/src/go/go.d.ts +13 -0
- package/dist-js/src/lib/stores/shop.svelte.d.ts +5 -2
- package/dist-js/src/main.d.ts +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.12.0 (2026-07-07)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **go-api:** add go.api.getOrders() with pagination
|
|
8
|
+
|
|
9
|
+
## 3.11.0 (2026-07-06)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **finalize-changelog:** stamp `UNRELEASED` markers with release version and expand MDX tracking
|
|
14
|
+
* **go-api:** fail validateToken early without a local token
|
|
15
|
+
|
|
3
16
|
## 3.10.2 (2026-07-02)
|
|
4
17
|
|
|
5
18
|
### Bug Fixes
|
|
@@ -13413,6 +13413,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13413
13413
|
var SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
|
|
13414
13414
|
var SIGN_UP_ENDPOINT = "/api/v4/auth";
|
|
13415
13415
|
var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
|
|
13416
|
+
var ORDERS_ENDPOINT = "/api/v4/orders";
|
|
13416
13417
|
//#endregion
|
|
13417
13418
|
//#region ../../packages/gomus-api/lib/customerLevels.ts
|
|
13418
13419
|
var CustomerLevels = {
|
|
@@ -13421,6 +13422,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13421
13422
|
};
|
|
13422
13423
|
//#endregion
|
|
13423
13424
|
//#region src/lib/stores/shop.svelte.ts
|
|
13425
|
+
var NOT_SIGNED_IN = { error: {
|
|
13426
|
+
success: false,
|
|
13427
|
+
errors: ["Not signed in"]
|
|
13428
|
+
} };
|
|
13424
13429
|
var Shop = class {
|
|
13425
13430
|
type;
|
|
13426
13431
|
#data = /* @__PURE__ */ state(proxy({
|
|
@@ -13519,8 +13524,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13519
13524
|
get _data() {
|
|
13520
13525
|
return get$2(this.#data);
|
|
13521
13526
|
}
|
|
13522
|
-
|
|
13523
|
-
|
|
13527
|
+
getCustomer() {
|
|
13528
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13529
|
+
return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `getCustomer`, "", { cache: 5 });
|
|
13530
|
+
}
|
|
13531
|
+
getOrders(params = {}) {
|
|
13532
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13533
|
+
return this.fetchAndCache(ORDERS_ENDPOINT, `orders-${JSON.stringify(params)}`, "", {
|
|
13534
|
+
cache: 5,
|
|
13535
|
+
query: params
|
|
13536
|
+
});
|
|
13524
13537
|
}
|
|
13525
13538
|
ticketsCalendar(params) {
|
|
13526
13539
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
|
|
@@ -34052,7 +34065,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
34052
34065
|
]
|
|
34053
34066
|
});
|
|
34054
34067
|
let form = /* @__PURE__ */ state(void 0);
|
|
34055
|
-
const user = /* @__PURE__ */ user_derived(() => shop.
|
|
34068
|
+
const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
|
|
34056
34069
|
onMount(async () => {
|
|
34057
34070
|
await shop.waitForAllFetches();
|
|
34058
34071
|
await pollUntilTruthy(() => get$2(form).details);
|
|
@@ -34071,7 +34084,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
34071
34084
|
var root$4 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1);
|
|
34072
34085
|
function Overview($$anchor, $$props) {
|
|
34073
34086
|
push($$props, true);
|
|
34074
|
-
const user = /* @__PURE__ */ user_derived(() => shop.
|
|
34087
|
+
const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
|
|
34075
34088
|
const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data);
|
|
34076
34089
|
var fragment = comment();
|
|
34077
34090
|
var node = first_child(fragment);
|
|
@@ -37290,14 +37303,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37290
37303
|
} }, [], []));
|
|
37291
37304
|
//#endregion
|
|
37292
37305
|
//#region src/go/go.ts
|
|
37306
|
+
var initPromise = null;
|
|
37307
|
+
async function ensureShopReady() {
|
|
37308
|
+
if (initPromise) return initPromise;
|
|
37309
|
+
if (!shop.client) throw new Error("[go.api] Shop not initialized — call go.init({ shop, api, locale }) first.");
|
|
37310
|
+
}
|
|
37293
37311
|
async function initGo(window) {
|
|
37294
37312
|
const stub = window.go;
|
|
37295
37313
|
let q = stub && stub._queue || [];
|
|
37296
37314
|
console.log(q);
|
|
37297
|
-
for (const command of q)
|
|
37298
|
-
|
|
37299
|
-
|
|
37300
|
-
|
|
37315
|
+
for (const command of q) {
|
|
37316
|
+
if (command.method === "load") continue;
|
|
37317
|
+
try {
|
|
37318
|
+
await go[command.method](command.options);
|
|
37319
|
+
} catch (e) {
|
|
37320
|
+
console.error(e);
|
|
37321
|
+
}
|
|
37301
37322
|
}
|
|
37302
37323
|
window.go = go;
|
|
37303
37324
|
if (stub) stub._queue = null;
|
|
@@ -37308,7 +37329,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37308
37329
|
configStore.define(options);
|
|
37309
37330
|
},
|
|
37310
37331
|
init: async (options) => {
|
|
37311
|
-
|
|
37332
|
+
try {
|
|
37333
|
+
initPromise = shop.load("https://" + options.api, options.shop, options.locale);
|
|
37334
|
+
await initPromise;
|
|
37335
|
+
} catch (e) {
|
|
37336
|
+
initPromise = null;
|
|
37337
|
+
throw e;
|
|
37338
|
+
}
|
|
37339
|
+
},
|
|
37340
|
+
api: {
|
|
37341
|
+
getCustomer: async () => {
|
|
37342
|
+
await ensureShopReady();
|
|
37343
|
+
return shop.asyncFetch(() => shop.getCustomer());
|
|
37344
|
+
},
|
|
37345
|
+
getOrders: async (params) => {
|
|
37346
|
+
await ensureShopReady();
|
|
37347
|
+
return shop.asyncFetch(() => shop.getOrders(params));
|
|
37348
|
+
}
|
|
37312
37349
|
}
|
|
37313
37350
|
};
|
|
37314
37351
|
(async () => {
|
|
@@ -13412,6 +13412,7 @@ var TICKETS_ENDPOINT = "/api/v4/tickets";
|
|
|
13412
13412
|
var SIGN_IN_ENDPOINT = "/api/v4/auth/sign_in";
|
|
13413
13413
|
var SIGN_UP_ENDPOINT = "/api/v4/auth";
|
|
13414
13414
|
var WITHDRAWAL_ENDPOINT = "/api/v4/orders/withdrawals";
|
|
13415
|
+
var ORDERS_ENDPOINT = "/api/v4/orders";
|
|
13415
13416
|
//#endregion
|
|
13416
13417
|
//#region ../../packages/gomus-api/lib/customerLevels.ts
|
|
13417
13418
|
var CustomerLevels = {
|
|
@@ -13420,6 +13421,10 @@ var CustomerLevels = {
|
|
|
13420
13421
|
};
|
|
13421
13422
|
//#endregion
|
|
13422
13423
|
//#region src/lib/stores/shop.svelte.ts
|
|
13424
|
+
var NOT_SIGNED_IN = { error: {
|
|
13425
|
+
success: false,
|
|
13426
|
+
errors: ["Not signed in"]
|
|
13427
|
+
} };
|
|
13423
13428
|
var Shop = class {
|
|
13424
13429
|
type;
|
|
13425
13430
|
#data = /* @__PURE__ */ state(proxy({
|
|
@@ -13518,8 +13523,16 @@ var Shop = class {
|
|
|
13518
13523
|
get _data() {
|
|
13519
13524
|
return get$2(this.#data);
|
|
13520
13525
|
}
|
|
13521
|
-
|
|
13522
|
-
|
|
13526
|
+
getCustomer() {
|
|
13527
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13528
|
+
return this.fetchAndCache(VALIDATE_TOKEN_ENDPOINT, `getCustomer`, "", { cache: 5 });
|
|
13529
|
+
}
|
|
13530
|
+
getOrders(params = {}) {
|
|
13531
|
+
if (!this.auth.data.accessToken) return NOT_SIGNED_IN;
|
|
13532
|
+
return this.fetchAndCache(ORDERS_ENDPOINT, `orders-${JSON.stringify(params)}`, "", {
|
|
13533
|
+
cache: 5,
|
|
13534
|
+
query: params
|
|
13535
|
+
});
|
|
13523
13536
|
}
|
|
13524
13537
|
ticketsCalendar(params) {
|
|
13525
13538
|
return this.fetchAndCache(TICKETS_CALENDAR_ENDPOINT, `ticketsCalendar-${JSON.stringify(params)}`, "data", {
|
|
@@ -34051,7 +34064,7 @@ function Details$2($$anchor, $$props) {
|
|
|
34051
34064
|
]
|
|
34052
34065
|
});
|
|
34053
34066
|
let form = /* @__PURE__ */ state(void 0);
|
|
34054
|
-
const user = /* @__PURE__ */ user_derived(() => shop.
|
|
34067
|
+
const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
|
|
34055
34068
|
onMount(async () => {
|
|
34056
34069
|
await shop.waitForAllFetches();
|
|
34057
34070
|
await pollUntilTruthy(() => get$2(form).details);
|
|
@@ -34070,7 +34083,7 @@ customElements.define("go-profile-details", create_custom_element(Details$2, {},
|
|
|
34070
34083
|
var root$4 = /* @__PURE__ */ from_html(`<div class="go-profile-fullname"> </div> <div class="go-profile-email"> </div>`, 1);
|
|
34071
34084
|
function Overview($$anchor, $$props) {
|
|
34072
34085
|
push($$props, true);
|
|
34073
|
-
const user = /* @__PURE__ */ user_derived(() => shop.
|
|
34086
|
+
const user = /* @__PURE__ */ user_derived(() => shop.getCustomer());
|
|
34074
34087
|
const data = /* @__PURE__ */ user_derived(() => get$2(user)?.data);
|
|
34075
34088
|
var fragment = comment();
|
|
34076
34089
|
var node = first_child(fragment);
|
|
@@ -37289,14 +37302,22 @@ customElements.define("go-withdrawal-form", create_custom_element(Withdrawal, {
|
|
|
37289
37302
|
} }, [], []));
|
|
37290
37303
|
//#endregion
|
|
37291
37304
|
//#region src/go/go.ts
|
|
37305
|
+
var initPromise = null;
|
|
37306
|
+
async function ensureShopReady() {
|
|
37307
|
+
if (initPromise) return initPromise;
|
|
37308
|
+
if (!shop.client) throw new Error("[go.api] Shop not initialized — call go.init({ shop, api, locale }) first.");
|
|
37309
|
+
}
|
|
37292
37310
|
async function initGo(window) {
|
|
37293
37311
|
const stub = window.go;
|
|
37294
37312
|
let q = stub && stub._queue || [];
|
|
37295
37313
|
console.log(q);
|
|
37296
|
-
for (const command of q)
|
|
37297
|
-
|
|
37298
|
-
|
|
37299
|
-
|
|
37314
|
+
for (const command of q) {
|
|
37315
|
+
if (command.method === "load") continue;
|
|
37316
|
+
try {
|
|
37317
|
+
await go[command.method](command.options);
|
|
37318
|
+
} catch (e) {
|
|
37319
|
+
console.error(e);
|
|
37320
|
+
}
|
|
37300
37321
|
}
|
|
37301
37322
|
window.go = go;
|
|
37302
37323
|
if (stub) stub._queue = null;
|
|
@@ -37307,7 +37328,23 @@ var go = {
|
|
|
37307
37328
|
configStore.define(options);
|
|
37308
37329
|
},
|
|
37309
37330
|
init: async (options) => {
|
|
37310
|
-
|
|
37331
|
+
try {
|
|
37332
|
+
initPromise = shop.load("https://" + options.api, options.shop, options.locale);
|
|
37333
|
+
await initPromise;
|
|
37334
|
+
} catch (e) {
|
|
37335
|
+
initPromise = null;
|
|
37336
|
+
throw e;
|
|
37337
|
+
}
|
|
37338
|
+
},
|
|
37339
|
+
api: {
|
|
37340
|
+
getCustomer: async () => {
|
|
37341
|
+
await ensureShopReady();
|
|
37342
|
+
return shop.asyncFetch(() => shop.getCustomer());
|
|
37343
|
+
},
|
|
37344
|
+
getOrders: async (params) => {
|
|
37345
|
+
await ensureShopReady();
|
|
37346
|
+
return shop.asyncFetch(() => shop.getOrders(params));
|
|
37347
|
+
}
|
|
37311
37348
|
}
|
|
37312
37349
|
};
|
|
37313
37350
|
(async () => {
|