@anker-in/shopify-sdk 1.0.1 → 1.0.2
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10441,8 +10441,8 @@ declare function createCart(client: ShopifyClient, options?: CreateCartOptions):
|
|
|
10441
10441
|
*/
|
|
10442
10442
|
|
|
10443
10443
|
interface AddCartLinesOptions {
|
|
10444
|
-
/** Cart ID (
|
|
10445
|
-
cartId
|
|
10444
|
+
/** Cart ID (optional, will use cookie if not provided) */
|
|
10445
|
+
cartId?: string;
|
|
10446
10446
|
/** Lines to add */
|
|
10447
10447
|
lines: CartLineInput[];
|
|
10448
10448
|
/** Cookie adapter for managing cart ID */
|
package/dist/index.d.ts
CHANGED
|
@@ -10441,8 +10441,8 @@ declare function createCart(client: ShopifyClient, options?: CreateCartOptions):
|
|
|
10441
10441
|
*/
|
|
10442
10442
|
|
|
10443
10443
|
interface AddCartLinesOptions {
|
|
10444
|
-
/** Cart ID (
|
|
10445
|
-
cartId
|
|
10444
|
+
/** Cart ID (optional, will use cookie if not provided) */
|
|
10445
|
+
cartId?: string;
|
|
10446
10446
|
/** Lines to add */
|
|
10447
10447
|
lines: CartLineInput[];
|
|
10448
10448
|
/** Cookie adapter for managing cart ID */
|
package/dist/index.js
CHANGED
|
@@ -1548,8 +1548,12 @@ async function createCart(client, options = {}) {
|
|
|
1548
1548
|
|
|
1549
1549
|
// src/api/cart/add-cart-lines.ts
|
|
1550
1550
|
async function addCartLines(client, options) {
|
|
1551
|
-
const { cartId, lines, cookieAdapter, metafieldIdentifiers } = options;
|
|
1551
|
+
const { cartId: providedCartId, lines, cookieAdapter, metafieldIdentifiers } = options;
|
|
1552
1552
|
const locale = client.getLocale();
|
|
1553
|
+
const cartId = providedCartId || cookieAdapter?.getCartId(locale);
|
|
1554
|
+
if (!cartId) {
|
|
1555
|
+
throw new Error("Invalid input used for this operation: Miss cartId");
|
|
1556
|
+
}
|
|
1553
1557
|
const normalizedMetafieldIdentifiers = constructMetafieldIdentifiersQueryParams(
|
|
1554
1558
|
metafieldIdentifiers,
|
|
1555
1559
|
client.getConfig().getMetafieldNamespacePrefix()
|