@misiki/gocommerce-connector 0.25.0 → 0.27.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 +2 -2
- package/dist/{index-BWg1KptA.d.cts → index-BY0qUnNO.d.cts} +34 -0
- package/dist/{index-BWg1KptA.d.ts → index-BY0qUnNO.d.ts} +34 -0
- package/dist/index.cjs +13 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +13 -5
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +13 -5
- package/dist/services/index.js.map +1 -1
- package/package.json +1 -1
package/dist/services/index.cjs
CHANGED
|
@@ -616,6 +616,7 @@ function toProduct(p, extra = {}) {
|
|
|
616
616
|
freeGift: freeGiftOf(p),
|
|
617
617
|
// Counted by the engine, rounded down, and absent rather than zero.
|
|
618
618
|
soldAtLeast: typeof p.sold_at_least === "number" && p.sold_at_least > 0 ? p.sold_at_least : null,
|
|
619
|
+
designable: typeof p.designable === "boolean" ? p.designable : void 0,
|
|
619
620
|
// Product-level stock is what a card shows before a variant is picked:
|
|
620
621
|
// buyable when any live variant is, counted only where counting means
|
|
621
622
|
// something.
|
|
@@ -676,6 +677,7 @@ function fromSearchDoc(d) {
|
|
|
676
677
|
// built from it must not claim to count.
|
|
677
678
|
manageInventory: false,
|
|
678
679
|
allowBackorder: false,
|
|
680
|
+
designable: typeof d.designable === "boolean" ? d.designable : void 0,
|
|
679
681
|
productTags: arr(d.tags).join(","),
|
|
680
682
|
category: d.category ? { name: d.category.split(" / ").pop() ?? d.category, slug: "" } : null,
|
|
681
683
|
vendor: d.vendor ? { businessName: d.vendor } : null,
|
|
@@ -959,7 +961,7 @@ function toOrder(o) {
|
|
|
959
961
|
taxIncluded: o.tax_inclusive,
|
|
960
962
|
total: toMajor(o.total),
|
|
961
963
|
refunded: toMajor(o.refunded),
|
|
962
|
-
codCharges:
|
|
964
|
+
codCharges: toMajor(o.payment_fee),
|
|
963
965
|
coupon: code ? { code } : null,
|
|
964
966
|
userEmail: o.email,
|
|
965
967
|
email: o.email,
|
|
@@ -1791,7 +1793,7 @@ var CartService = class extends BaseService {
|
|
|
1791
1793
|
await this.data(`/api/carts/${encodeURIComponent(id2)}/line-items`, { method: "POST", body })
|
|
1792
1794
|
);
|
|
1793
1795
|
} catch (err) {
|
|
1794
|
-
if (
|
|
1796
|
+
if (cartGone(err)) {
|
|
1795
1797
|
const fresh = await this.open();
|
|
1796
1798
|
return this.present(
|
|
1797
1799
|
await this.data(`/api/carts/${encodeURIComponent(fresh)}/line-items`, { method: "POST", body })
|
|
@@ -2029,6 +2031,8 @@ var CartService = class extends BaseService {
|
|
|
2029
2031
|
}
|
|
2030
2032
|
};
|
|
2031
2033
|
var clean = (id2) => id2 && id2 !== "undefined" && id2 !== "null" ? id2 : null;
|
|
2034
|
+
var cartGone = (err) => err instanceof GoCommerceError && (err.code === "cart_not_found" || err.code === "cart_checked_out" || cartGoneOnOlderEngine(err));
|
|
2035
|
+
var cartGoneOnOlderEngine = (err) => err.code === "not_found" && err.message === "cart not found" || err.code === "conflict" && err.message === "this cart has already been checked out";
|
|
2032
2036
|
var cartService = new CartService();
|
|
2033
2037
|
|
|
2034
2038
|
// src/services/customizer-service.ts
|
|
@@ -2361,6 +2365,7 @@ var PaymentMethodService = class extends BaseService {
|
|
|
2361
2365
|
title: m.name,
|
|
2362
2366
|
description: "",
|
|
2363
2367
|
img: drive(m.code).img ?? null,
|
|
2368
|
+
fee: toMajor(m.fee),
|
|
2364
2369
|
rank: i,
|
|
2365
2370
|
active: true,
|
|
2366
2371
|
isActive: true
|
|
@@ -2450,7 +2455,8 @@ var OrderService = class extends BaseService {
|
|
|
2450
2455
|
title: l.title,
|
|
2451
2456
|
img: mediaUrl(l.image_url),
|
|
2452
2457
|
price: toMajor(l.unit_price),
|
|
2453
|
-
qty: l.quantity
|
|
2458
|
+
qty: l.quantity,
|
|
2459
|
+
designId: l.metadata?.design?.id ?? null
|
|
2454
2460
|
});
|
|
2455
2461
|
}
|
|
2456
2462
|
}
|
|
@@ -2460,7 +2466,8 @@ var OrderService = class extends BaseService {
|
|
|
2460
2466
|
return lines.flatMap((l, i) => {
|
|
2461
2467
|
const p = live[i];
|
|
2462
2468
|
if (!p) return [];
|
|
2463
|
-
|
|
2469
|
+
const designable = typeof p.designable === "boolean" ? p.designable : void 0;
|
|
2470
|
+
return [{ ...l, productId: String(l.productId), variantId: String(l.variantId), slug: p.slug, designable }];
|
|
2464
2471
|
});
|
|
2465
2472
|
}
|
|
2466
2473
|
/** The "someone just bought" popup would publish other shoppers' purchases; the engine offers none. */
|
|
@@ -3226,7 +3233,8 @@ var StoreService = class extends BaseService {
|
|
|
3226
3233
|
currency: {
|
|
3227
3234
|
...base.currency ?? {},
|
|
3228
3235
|
code,
|
|
3229
|
-
symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code)
|
|
3236
|
+
symbol: sameCurrency ? base.currency?.symbol ?? symbolFor(code) : symbolFor(code),
|
|
3237
|
+
includesTax: profile?.prices_include_tax
|
|
3230
3238
|
},
|
|
3231
3239
|
language: ready.language,
|
|
3232
3240
|
plugins: {
|