@blotoutio/providers-blotout-wallet-sdk 0.42.1 → 0.43.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/index.cjs.js +220 -183
- package/index.js +220 -183
- package/index.mjs +220 -183
- package/package.json +1 -1
- package/stores/shopify/index.cjs.js +3 -5
- package/stores/shopify/index.js +3 -5
- package/stores/shopify/index.mjs +3 -5
@@ -10,8 +10,7 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
10
10
|
method: 'POST',
|
11
11
|
body: JSON.stringify({
|
12
12
|
items: items.map((item) => ({
|
13
|
-
id: item.productId,
|
14
|
-
variant_id: item.variantId,
|
13
|
+
id: item.variantId || item.productId,
|
15
14
|
quantity: item.amount,
|
16
15
|
})),
|
17
16
|
}),
|
@@ -20,7 +19,6 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
20
19
|
if (!response.ok) {
|
21
20
|
throw new Error('Could not add items', { cause: await response.text() });
|
22
21
|
}
|
23
|
-
return this.getCart();
|
24
22
|
});
|
25
23
|
},
|
26
24
|
clearCart() {
|
@@ -47,8 +45,8 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
47
45
|
}
|
48
46
|
return response.json();
|
49
47
|
})
|
50
|
-
.then((cart) => cart.items.map(({
|
51
|
-
productId:
|
48
|
+
.then((cart) => cart.items.map(({ product_id, variant_id, title, quantity, price }) => ({
|
49
|
+
productId: product_id.toString(),
|
52
50
|
variantId: (variant_id === null || variant_id === void 0 ? void 0 : variant_id.toString()) || null,
|
53
51
|
name: title,
|
54
52
|
amount: quantity,
|
package/stores/shopify/index.js
CHANGED
@@ -11,8 +11,7 @@
|
|
11
11
|
method: 'POST',
|
12
12
|
body: JSON.stringify({
|
13
13
|
items: items.map((item) => ({
|
14
|
-
id: item.productId,
|
15
|
-
variant_id: item.variantId,
|
14
|
+
id: item.variantId || item.productId,
|
16
15
|
quantity: item.amount,
|
17
16
|
})),
|
18
17
|
}),
|
@@ -21,7 +20,6 @@
|
|
21
20
|
if (!response.ok) {
|
22
21
|
throw new Error('Could not add items', { cause: await response.text() });
|
23
22
|
}
|
24
|
-
return this.getCart();
|
25
23
|
});
|
26
24
|
},
|
27
25
|
clearCart() {
|
@@ -48,8 +46,8 @@
|
|
48
46
|
}
|
49
47
|
return response.json();
|
50
48
|
})
|
51
|
-
.then((cart) => cart.items.map(({
|
52
|
-
productId:
|
49
|
+
.then((cart) => cart.items.map(({ product_id, variant_id, title, quantity, price }) => ({
|
50
|
+
productId: product_id.toString(),
|
53
51
|
variantId: (variant_id === null || variant_id === void 0 ? void 0 : variant_id.toString()) || null,
|
54
52
|
name: title,
|
55
53
|
amount: quantity,
|
package/stores/shopify/index.mjs
CHANGED
@@ -8,8 +8,7 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
8
8
|
method: 'POST',
|
9
9
|
body: JSON.stringify({
|
10
10
|
items: items.map((item) => ({
|
11
|
-
id: item.productId,
|
12
|
-
variant_id: item.variantId,
|
11
|
+
id: item.variantId || item.productId,
|
13
12
|
quantity: item.amount,
|
14
13
|
})),
|
15
14
|
}),
|
@@ -18,7 +17,6 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
18
17
|
if (!response.ok) {
|
19
18
|
throw new Error('Could not add items', { cause: await response.text() });
|
20
19
|
}
|
21
|
-
return this.getCart();
|
22
20
|
});
|
23
21
|
},
|
24
22
|
clearCart() {
|
@@ -45,8 +43,8 @@ const createShopApi = (fetchOverride = window.fetch) => ({
|
|
45
43
|
}
|
46
44
|
return response.json();
|
47
45
|
})
|
48
|
-
.then((cart) => cart.items.map(({
|
49
|
-
productId:
|
46
|
+
.then((cart) => cart.items.map(({ product_id, variant_id, title, quantity, price }) => ({
|
47
|
+
productId: product_id.toString(),
|
50
48
|
variantId: (variant_id === null || variant_id === void 0 ? void 0 : variant_id.toString()) || null,
|
51
49
|
name: title,
|
52
50
|
amount: quantity,
|