@reactionary/medusa 0.10.2 → 0.10.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.
- package/LICENSE +21 -0
- package/capabilities/cart.capability.js +2 -2
- package/capabilities/category.capability.js +2 -2
- package/capabilities/checkout.capability.js +3 -2
- package/capabilities/identity.capability.js +1 -2
- package/capabilities/inventory.capability.js +2 -2
- package/capabilities/order-search.capability.js +2 -2
- package/capabilities/order.capability.js +2 -2
- package/capabilities/personalization-profile.capability.js +2 -2
- package/capabilities/price.capability.js +2 -2
- package/capabilities/product-associations.capability.js +1 -2
- package/capabilities/product-search.capability.js +2 -2
- package/capabilities/product.capability.js +2 -2
- package/capabilities/profile.capability.js +2 -2
- package/core/client.js +2 -0
- package/factories/checkout/checkout.factory.js +5 -10
- package/package.json +2 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Solteq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -42,6 +41,7 @@ class MedusaCartCapability extends CartCapability {
|
|
|
42
41
|
this.config = config;
|
|
43
42
|
this.factory = factory;
|
|
44
43
|
}
|
|
44
|
+
medusaApi;
|
|
45
45
|
config;
|
|
46
46
|
factory;
|
|
47
47
|
/**
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -30,6 +29,7 @@ class MedusaCategoryCapability extends CategoryCapability {
|
|
|
30
29
|
this.config = config;
|
|
31
30
|
this.factory = factory;
|
|
32
31
|
}
|
|
32
|
+
medusaApi;
|
|
33
33
|
config;
|
|
34
34
|
factory;
|
|
35
35
|
alwaysIncludedFields = ["+metadata", "+external_id", "+parent_category.external_id"];
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -42,6 +41,7 @@ class CheckoutNotReadyForFinalizationError extends Error {
|
|
|
42
41
|
this.checkoutIdentifier = checkoutIdentifier;
|
|
43
42
|
this.name = "CheckoutNotReadyForFinalizationError";
|
|
44
43
|
}
|
|
44
|
+
checkoutIdentifier;
|
|
45
45
|
}
|
|
46
46
|
class MedusaCheckoutCapability extends CheckoutCapability {
|
|
47
47
|
constructor(config, cache, context, medusaApi, factory) {
|
|
@@ -50,6 +50,7 @@ class MedusaCheckoutCapability extends CheckoutCapability {
|
|
|
50
50
|
this.config = config;
|
|
51
51
|
this.factory = factory;
|
|
52
52
|
}
|
|
53
|
+
medusaApi;
|
|
53
54
|
config;
|
|
54
55
|
factory;
|
|
55
56
|
/**
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -27,6 +26,7 @@ class MedusaInventoryCapability extends InventoryCapability {
|
|
|
27
26
|
this.config = config;
|
|
28
27
|
this.factory = factory;
|
|
29
28
|
}
|
|
29
|
+
medusaApi;
|
|
30
30
|
config;
|
|
31
31
|
factory;
|
|
32
32
|
async getBySKU(payload) {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -25,6 +24,7 @@ class MedusaOrderSearchCapability extends OrderSearchCapability {
|
|
|
25
24
|
this.config = config;
|
|
26
25
|
this.factory = factory;
|
|
27
26
|
}
|
|
27
|
+
medusaApi;
|
|
28
28
|
config;
|
|
29
29
|
factory;
|
|
30
30
|
/**
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -26,6 +25,7 @@ class MedusaOrderCapability extends OrderCapability {
|
|
|
26
25
|
this.config = config;
|
|
27
26
|
this.factory = factory;
|
|
28
27
|
}
|
|
28
|
+
medusaApi;
|
|
29
29
|
config;
|
|
30
30
|
factory;
|
|
31
31
|
async getById(payload) {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -26,6 +25,7 @@ class MedusaPersonalizationProfileCapability extends PersonalizationProfileCapab
|
|
|
26
25
|
this.config = config;
|
|
27
26
|
this.factory = factory;
|
|
28
27
|
}
|
|
28
|
+
medusaApi;
|
|
29
29
|
config;
|
|
30
30
|
factory;
|
|
31
31
|
filterGroup(_group) {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -26,6 +25,7 @@ class MedusaPriceCapability extends PriceCapability {
|
|
|
26
25
|
this.config = config;
|
|
27
26
|
this.factory = factory;
|
|
28
27
|
}
|
|
28
|
+
medusaApi;
|
|
29
29
|
config;
|
|
30
30
|
factory;
|
|
31
31
|
async getListPrice(payload) {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -27,6 +26,7 @@ class MedusaProductSearchCapability extends ProductSearchCapability {
|
|
|
27
26
|
this.config = config;
|
|
28
27
|
this.factory = factory;
|
|
29
28
|
}
|
|
29
|
+
medusaApi;
|
|
30
30
|
config;
|
|
31
31
|
factory;
|
|
32
32
|
async resolveCategoryIdByExternalId(externalId) {
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -28,6 +27,7 @@ class MedusaProductCapability extends ProductCapability {
|
|
|
28
27
|
this.config = config;
|
|
29
28
|
this.factory = factory;
|
|
30
29
|
}
|
|
30
|
+
medusaApi;
|
|
31
31
|
config;
|
|
32
32
|
alwaysIncludedFields = [
|
|
33
33
|
"+metadata.*",
|
|
@@ -5,8 +5,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
5
5
|
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
6
|
if (decorator = decorators[i])
|
|
7
7
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
9
|
return result;
|
|
11
10
|
};
|
|
12
11
|
import {
|
|
@@ -32,6 +31,7 @@ class MedusaProfileCapability extends ProfileCapability {
|
|
|
32
31
|
this.config = config;
|
|
33
32
|
this.factory = factory;
|
|
34
33
|
}
|
|
34
|
+
medusaApi;
|
|
35
35
|
config;
|
|
36
36
|
includedFields = ["+metadata.*"];
|
|
37
37
|
factory;
|
package/core/client.js
CHANGED
|
@@ -75,17 +75,12 @@ class MedusaCheckoutFactory {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
isReadyForFinalization(price, paymentInstructions, billingAddress, shippingAddress, shippingInstruction) {
|
|
78
|
-
if (!billingAddress)
|
|
79
|
-
|
|
80
|
-
if (!shippingInstruction)
|
|
81
|
-
|
|
82
|
-
if (!shippingAddress && !shippingInstruction.pickupPoint)
|
|
83
|
-
return false;
|
|
84
|
-
if (paymentInstructions.length === 0)
|
|
85
|
-
return false;
|
|
78
|
+
if (!billingAddress) return false;
|
|
79
|
+
if (!shippingInstruction) return false;
|
|
80
|
+
if (!shippingAddress && !shippingInstruction.pickupPoint) return false;
|
|
81
|
+
if (paymentInstructions.length === 0) return false;
|
|
86
82
|
const authorizedPayments = paymentInstructions.filter((paymentInstruction) => paymentInstruction.status === "authorized").map((paymentInstruction) => paymentInstruction.amount.value).reduce((sum, value) => sum + value, 0);
|
|
87
|
-
if (price.grandTotal.value !== authorizedPayments)
|
|
88
|
-
return false;
|
|
83
|
+
if (price.grandTotal.value !== authorizedPayments) return false;
|
|
89
84
|
return true;
|
|
90
85
|
}
|
|
91
86
|
isCart(data) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactionary/medusa",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -10,13 +10,12 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@medusajs/js-sdk": "^2.13.3",
|
|
13
|
-
"@reactionary/core": "0.10.
|
|
13
|
+
"@reactionary/core": "0.10.4",
|
|
14
14
|
"debug": "^4.4.3",
|
|
15
15
|
"@medusajs/types": "^2.13.3",
|
|
16
16
|
"zod": "4.1.9"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@nx/vite": "22.4.5",
|
|
20
19
|
"vitest": "^4.0.9"
|
|
21
20
|
},
|
|
22
21
|
"sideEffects": false
|