Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gem-sdk/adapter-shopify

Package Overview
Dependencies
Maintainers
2
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gem-sdk/adapter-shopify - npm Package Compare versions

Comparing version 1.12.0 to 1.14.0-dev.284

36

dist/cjs/api/operations/add-to-cart.js

@@ -1,35 +0,1 @@

'use strict';
var cartLinesAdd_generated = require('../../graphql/mutations/cart-lines-add.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const addToCartOperation = (config)=>{
const addToCart = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lines: input.lines.map((v)=>({
merchandiseId: v.variantId,
quantity: v.quantity,
attributes: v.attributes
}))
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartLinesAdd_generated.CartLinesAddDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesAdd?.userErrors.length || !res.data?.cartLinesAdd?.cart) {
throw res.data?.cartLinesAdd?.userErrors;
}
return normalize.normalizeCart(res.data.cartLinesAdd.cart);
};
return addToCart;
};
exports.addToCartOperation = addToCartOperation;
"use strict";var cartLinesAdd_generated=require("../../graphql/mutations/cart-lines-add.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const addToCartOperation=r=>{let t=async t=>{if(!r.storefrontUrl)throw Error("Shop is not connected");let e={cartId:t.cartId,lines:t.lines.map(r=>({merchandiseId:r.variantId,quantity:r.quantity,attributes:r.attributes}))},a=await fetch(r.storefrontUrl,{...common.composeRequest(r),body:JSON.stringify({query:cartLinesAdd_generated.CartLinesAddDocument,variables:e})}).then(r=>r.json());if(a.data?.cartLinesAdd?.userErrors.length||!a.data?.cartLinesAdd?.cart)throw a.data?.cartLinesAdd?.userErrors;return normalize.normalizeCart(a.data.cartLinesAdd.cart)};return t};exports.addToCartOperation=addToCartOperation;

@@ -1,31 +0,1 @@

'use strict';
var cartDiscountCodesUpdate_generated = require('../../graphql/mutations/cart-discount-codes-update.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const cartDiscountCodesUpdateOperation = (config)=>{
const cartNoteUpdate = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
discountCodes: input.discountCodes
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartDiscountCodesUpdate_generated.CartDiscountCodesUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartDiscountCodesUpdate?.userErrors.length || !res.data?.cartDiscountCodesUpdate?.cart) {
throw res.data?.cartDiscountCodesUpdate?.userErrors;
}
return normalize.normalizeCart(res.data.cartDiscountCodesUpdate.cart);
};
return cartNoteUpdate;
};
exports.cartDiscountCodesUpdateOperation = cartDiscountCodesUpdateOperation;
"use strict";var cartDiscountCodesUpdate_generated=require("../../graphql/mutations/cart-discount-codes-update.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const cartDiscountCodesUpdateOperation=t=>{let e=async e=>{if(!t.storefrontUrl)throw Error("Shop is not connected");let r={cartId:e.cartId,discountCodes:e.discountCodes},o=await fetch(t.storefrontUrl,{...common.composeRequest(t),body:JSON.stringify({query:cartDiscountCodesUpdate_generated.CartDiscountCodesUpdateDocument,variables:r})}).then(t=>t.json());if(o.data?.cartDiscountCodesUpdate?.userErrors.length||!o.data?.cartDiscountCodesUpdate?.cart)throw o.data?.cartDiscountCodesUpdate?.userErrors;return normalize.normalizeCart(o.data.cartDiscountCodesUpdate.cart)};return e};exports.cartDiscountCodesUpdateOperation=cartDiscountCodesUpdateOperation;

@@ -1,31 +0,1 @@

'use strict';
var cartNoteUpdate_generated = require('../../graphql/mutations/cart-note-update.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const cartNoteUpdateOperation = (config)=>{
const cartNoteUpdate = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
note: input.note
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartNoteUpdate_generated.CartNoteUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartNoteUpdate?.userErrors.length || !res.data?.cartNoteUpdate?.cart) {
throw res.data?.cartNoteUpdate?.userErrors;
}
return normalize.normalizeCart(res.data.cartNoteUpdate.cart);
};
return cartNoteUpdate;
};
exports.cartNoteUpdateOperation = cartNoteUpdateOperation;
"use strict";var cartNoteUpdate_generated=require("../../graphql/mutations/cart-note-update.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const cartNoteUpdateOperation=t=>{let e=async e=>{if(!t.storefrontUrl)throw Error("Shop is not connected");let r={cartId:e.cartId,note:e.note},a=await fetch(t.storefrontUrl,{...common.composeRequest(t),body:JSON.stringify({query:cartNoteUpdate_generated.CartNoteUpdateDocument,variables:r})}).then(t=>t.json());if(a.data?.cartNoteUpdate?.userErrors.length||!a.data?.cartNoteUpdate?.cart)throw a.data?.cartNoteUpdate?.userErrors;return normalize.normalizeCart(a.data.cartNoteUpdate.cart)};return e};exports.cartNoteUpdateOperation=cartNoteUpdateOperation;

@@ -1,36 +0,1 @@

'use strict';
var cartCreate_generated = require('../../graphql/mutations/cart-create.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const createCartOperation = (config)=>{
const createCart = async (args)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
input: {
lines: args.items.map((v)=>({
merchandiseId: v.variantId,
quantity: v.quantity,
attributes: v.attributes
}))
}
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartCreate_generated.CartCreateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartCreate?.userErrors.length || !res.data?.cartCreate?.cart) {
throw res.data?.cartCreate?.userErrors;
}
return normalize.normalizeCart(res.data.cartCreate.cart);
};
return createCart;
};
exports.createCartOperation = createCartOperation;
"use strict";var cartCreate_generated=require("../../graphql/mutations/cart-create.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const createCartOperation=r=>{let e=async e=>{if(!r.storefrontUrl)throw Error("Shop is not connected");let t={input:{lines:e.items.map(r=>({merchandiseId:r.variantId,quantity:r.quantity,attributes:r.attributes}))}},a=await fetch(r.storefrontUrl,{...common.composeRequest(r),body:JSON.stringify({query:cartCreate_generated.CartCreateDocument,variables:t})}).then(r=>r.json());if(a.data?.cartCreate?.userErrors.length||!a.data?.cartCreate?.cart)throw a.data?.cartCreate?.userErrors;return normalize.normalizeCart(a.data.cartCreate.cart)};return e};exports.createCartOperation=createCartOperation;

@@ -1,30 +0,1 @@

'use strict';
var cart_generated = require('../../graphql/queries/cart.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const getCartOperation = (config)=>{
const getCart = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
id: input.cartId
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cart_generated.CartDocument,
variables
})
}).then((res)=>res.json());
if (!res.data?.cart) {
return undefined;
}
return normalize.normalizeCart(res.data.cart);
};
return getCart;
};
exports.getCartOperation = getCartOperation;
"use strict";var cart_generated=require("../../graphql/queries/cart.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const getCartOperation=r=>{let e=async e=>{if(!r.storefrontUrl)throw Error("Shop is not connected");let t={id:e.cartId},a=await fetch(r.storefrontUrl,{...common.composeRequest(r),body:JSON.stringify({query:cart_generated.CartDocument,variables:t})}).then(r=>r.json());if(a.data?.cart)return normalize.normalizeCart(a.data.cart)};return e};exports.getCartOperation=getCartOperation;

@@ -1,33 +0,1 @@

'use strict';
var cartLinesRemove_generated = require('../../graphql/mutations/cart-lines-remove.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const removeCartItemOperation = (config)=>{
const removeCartItem = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lineIds: [
input.lineId
]
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartLinesRemove_generated.CartLinesRemoveDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesRemove?.userErrors.length || !res.data?.cartLinesRemove?.cart) {
throw res.data?.cartLinesRemove?.userErrors;
}
return normalize.normalizeCart(res.data.cartLinesRemove.cart);
};
return removeCartItem;
};
exports.removeCartItemOperation = removeCartItemOperation;
"use strict";var cartLinesRemove_generated=require("../../graphql/mutations/cart-lines-remove.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const removeCartItemOperation=e=>{let r=async r=>{if(!e.storefrontUrl)throw Error("Shop is not connected");let t={cartId:r.cartId,lineIds:[r.lineId]},o=await fetch(e.storefrontUrl,{...common.composeRequest(e),body:JSON.stringify({query:cartLinesRemove_generated.CartLinesRemoveDocument,variables:t})}).then(e=>e.json());if(o.data?.cartLinesRemove?.userErrors.length||!o.data?.cartLinesRemove?.cart)throw o.data?.cartLinesRemove?.userErrors;return normalize.normalizeCart(o.data.cartLinesRemove.cart)};return r};exports.removeCartItemOperation=removeCartItemOperation;

@@ -1,37 +0,1 @@

'use strict';
var cartLinesUpdate_generated = require('../../graphql/mutations/cart-lines-update.generated.js');
var common = require('../../helpers/common.js');
var normalize = require('../../helpers/normalize.js');
const updateCartLineOperation = (config)=>{
const updateCartLine = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lines: [
{
id: input.line.id,
merchandiseId: input.line.variantId,
quantity: input.line.quantity
}
]
};
const res = await fetch(config.storefrontUrl, {
...common.composeRequest(config),
body: JSON.stringify({
query: cartLinesUpdate_generated.CartLinesUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesUpdate?.userErrors.length || !res.data?.cartLinesUpdate?.cart) {
throw res.data?.cartLinesUpdate?.userErrors;
}
return normalize.normalizeCart(res.data?.cartLinesUpdate.cart);
};
return updateCartLine;
};
exports.updateCartLineOperation = updateCartLineOperation;
"use strict";var cartLinesUpdate_generated=require("../../graphql/mutations/cart-lines-update.generated.js"),common=require("../../helpers/common.js"),normalize=require("../../helpers/normalize.js");const updateCartLineOperation=e=>{let t=async t=>{if(!e.storefrontUrl)throw Error("Shop is not connected");let r={cartId:t.cartId,lines:[{id:t.line.id,merchandiseId:t.line.variantId,quantity:t.line.quantity}]},a=await fetch(e.storefrontUrl,{...common.composeRequest(e),body:JSON.stringify({query:cartLinesUpdate_generated.CartLinesUpdateDocument,variables:r})}).then(e=>e.json());if(a.data?.cartLinesUpdate?.userErrors.length||!a.data?.cartLinesUpdate?.cart)throw a.data?.cartLinesUpdate?.userErrors;return normalize.normalizeCart(a.data?.cartLinesUpdate.cart)};return t};exports.updateCartLineOperation=updateCartLineOperation;

12

dist/cjs/graphql/fragments/cart-line.generated.js

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const CartProductVariantSelect = `
"use strict";const CartProductVariantSelect=`
fragment CartProductVariantSelect on ProductVariant {

@@ -36,4 +34,3 @@ id

}
`;
const CartLineSelect = `
`,CartLineSelect=`
fragment CartLineSelect on CartLine {

@@ -52,5 +49,2 @@ id

}
`;
exports.CartLineSelect = CartLineSelect;
exports.CartProductVariantSelect = CartProductVariantSelect;
`;exports.CartLineSelect=CartLineSelect,exports.CartProductVariantSelect=CartProductVariantSelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const CartUserErrorSelect = `
"use strict";const CartUserErrorSelect=`
fragment CartUserErrorSelect on CartUserError {

@@ -9,4 +7,2 @@ code

}
`;
exports.CartUserErrorSelect = CartUserErrorSelect;
`;exports.CartUserErrorSelect=CartUserErrorSelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const CartSelect = `
"use strict";const CartSelect=`
fragment CartSelect on Cart {

@@ -44,4 +42,2 @@ attributes {

}
`;
exports.CartSelect = CartSelect;
`;exports.CartSelect=CartSelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const CountrySelect = `
"use strict";const CountrySelect=`
fragment CountrySelect on Country {

@@ -12,4 +10,2 @@ isoCode

}
`;
exports.CountrySelect = CountrySelect;
`;exports.CountrySelect=CountrySelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const CurrencySelect = `
"use strict";const CurrencySelect=`
fragment CurrencySelect on Currency {

@@ -9,4 +7,2 @@ isoCode

}
`;
exports.CurrencySelect = CurrencySelect;
`;exports.CurrencySelect=CurrencySelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const ImageSelect = `
"use strict";const ImageSelect=`
fragment ImageSelect on Image {

@@ -11,4 +9,2 @@ id

}
`;
exports.ImageSelect = ImageSelect;
`;exports.ImageSelect=ImageSelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const LanguageSelect = `
"use strict";const LanguageSelect=`
fragment LanguageSelect on Language {

@@ -8,4 +6,2 @@ isoCode

}
`;
exports.LanguageSelect = LanguageSelect;
`;exports.LanguageSelect=LanguageSelect;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const MoneyV2Select = `
"use strict";const MoneyV2Select=`
fragment MoneyV2Select on MoneyV2 {

@@ -8,4 +6,2 @@ amount

}
`;
exports.MoneyV2Select = MoneyV2Select;
`;exports.MoneyV2Select=MoneyV2Select;

@@ -1,4 +0,2 @@

'use strict';
/* eslint-disable */ const ProductSelect = `
"use strict";const ProductSelect=`
fragment ProductSelect on Product {

@@ -50,4 +48,2 @@ availableForSale

}
`;
exports.ProductSelect = ProductSelect;
`;exports.ProductSelect=ProductSelect;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartCreateDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartCreateDocument=`
mutation cartCreate($input: CartInput) {

@@ -25,4 +17,2 @@ cartCreate(input: $input) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartCreateDocument = CartCreateDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartCreateDocument=CartCreateDocument;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartDiscountCodesUpdateDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartDiscountCodesUpdateDocument=`
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {

@@ -25,4 +17,2 @@ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartDiscountCodesUpdateDocument = CartDiscountCodesUpdateDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartDiscountCodesUpdateDocument=CartDiscountCodesUpdateDocument;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartLinesAddDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartLinesAddDocument=`
mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {

@@ -25,4 +17,2 @@ cartLinesAdd(cartId: $cartId, lines: $lines) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartLinesAddDocument = CartLinesAddDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartLinesAddDocument=CartLinesAddDocument;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartLinesRemoveDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartLinesRemoveDocument=`
mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {

@@ -25,4 +17,2 @@ cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartLinesRemoveDocument = CartLinesRemoveDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartLinesRemoveDocument=CartLinesRemoveDocument;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartLinesUpdateDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartLinesUpdateDocument=`
mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {

@@ -25,4 +17,2 @@ cartLinesUpdate(cartId: $cartId, lines: $lines) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartLinesUpdateDocument = CartLinesUpdateDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartLinesUpdateDocument=CartLinesUpdateDocument;

@@ -1,10 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
var cartUserError_generated = require('../fragments/cart-user-error.generated.js');
const CartNoteUpdateDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js"),cartUserError_generated=require("../fragments/cart-user-error.generated.js");const CartNoteUpdateDocument=`
mutation cartNoteUpdate($cartId: ID!, $note: String) {

@@ -25,4 +17,2 @@ cartNoteUpdate(cartId: $cartId, note: $note) {

${image_generated.ImageSelect}
${cartUserError_generated.CartUserErrorSelect}`;
exports.CartNoteUpdateDocument = CartNoteUpdateDocument;
${cartUserError_generated.CartUserErrorSelect}`;exports.CartNoteUpdateDocument=CartNoteUpdateDocument;

@@ -1,9 +0,2 @@

'use strict';
var cart_generated = require('../fragments/cart.generated.js');
var moneyV2_generated = require('../fragments/money-v2.generated.js');
var cartLine_generated = require('../fragments/cart-line.generated.js');
var image_generated = require('../fragments/image.generated.js');
const CartDocument = `
"use strict";var cart_generated=require("../fragments/cart.generated.js"),moneyV2_generated=require("../fragments/money-v2.generated.js"),cartLine_generated=require("../fragments/cart-line.generated.js"),image_generated=require("../fragments/image.generated.js");const CartDocument=`
query cart($id: ID!) {

@@ -18,4 +11,2 @@ cart(id: $id) {

${cartLine_generated.CartProductVariantSelect}
${image_generated.ImageSelect}`;
exports.CartDocument = CartDocument;
${image_generated.ImageSelect}`;exports.CartDocument=CartDocument;

@@ -1,6 +0,2 @@

'use strict';
var product_generated = require('../fragments/product.generated.js');
const ProductDocument = `
"use strict";var product_generated=require("../fragments/product.generated.js");const ProductDocument=`
query product($handle: String, $id: ID) {

@@ -11,4 +7,2 @@ product(handle: $handle, id: $id) {

}
${product_generated.ProductSelect}`;
exports.ProductDocument = ProductDocument;
${product_generated.ProductSelect}`;exports.ProductDocument=ProductDocument;

@@ -1,8 +0,2 @@

'use strict';
var country_generated = require('../fragments/country.generated.js');
var currency_generated = require('../fragments/currency.generated.js');
var language_generated = require('../fragments/language.generated.js');
const ShopMetaDocument = `
"use strict";var country_generated=require("../fragments/country.generated.js"),currency_generated=require("../fragments/currency.generated.js"),language_generated=require("../fragments/language.generated.js");const ShopMetaDocument=`
query shopMeta {

@@ -25,4 +19,2 @@ localization {

${currency_generated.CurrencySelect}
${language_generated.LanguageSelect}`;
exports.ShopMetaDocument = ShopMetaDocument;
${language_generated.LanguageSelect}`;exports.ShopMetaDocument=ShopMetaDocument;

@@ -1,15 +0,1 @@

'use strict';
const composeRequest = (config)=>{
return {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...config.storefrontToken ? {
'X-Shopify-Storefront-Access-Token': config.storefrontToken
} : {}
}
};
};
exports.composeRequest = composeRequest;
"use strict";const composeRequest=e=>({method:"POST",headers:{"Content-Type":"application/json",...e.storefrontToken?{"X-Shopify-Storefront-Access-Token":e.storefrontToken}:{}}});exports.composeRequest=composeRequest;

@@ -1,58 +0,1 @@

'use strict';
const normalizeCartProductVariant = (variant)=>{
const { compareAtPriceV2 , priceV2 , weight , weightUnit , id , sku , image } = variant;
return {
id,
requiresShipping: variant.requiresShipping,
availableForSale: variant.availableForSale,
sku: sku ?? id,
name: variant.title,
listPrice: compareAtPriceV2?.amount ? +compareAtPriceV2?.amount : 0,
price: +priceV2.amount,
weight: {
value: weight ?? 0,
unit: weightUnit
},
image
};
};
const normalizeLineItem = (lineItem)=>{
const { quantity , id , merchandise } = lineItem;
const variant = normalizeCartProductVariant(merchandise);
return {
id,
quantity,
variant,
attributes: lineItem.attributes,
variantId: variant.id,
name: variant.name,
productTitle: merchandise.product.title,
productId: variant.id,
path: merchandise.product.handle,
discounts: []
};
};
const normalizeCart = (cart)=>{
const { cost } = cart;
return {
createdAt: cart.createdAt,
id: cart.id,
lineItems: cart.lines.nodes.map(normalizeLineItem),
subtotalPrice: +cost.subtotalAmount.amount,
totalPrice: +cost.totalAmount.amount,
currency: {
code: cost.totalAmount.currencyCode
},
taxesIncluded: true,
lineItemsSubtotalPrice: +cost.subtotalAmount.amount,
checkoutUrl: cart.checkoutUrl,
note: cart.note,
discounts: cart.discountCodes.map((v)=>({
code: v.code,
applicable: v.applicable
}))
};
};
exports.normalizeCart = normalizeCart;
"use strict";const normalizeCartProductVariant=t=>{let{compareAtPriceV2:e,priceV2:a,weight:r,weightUnit:o,id:i,sku:n,image:l}=t;return{id:i,requiresShipping:t.requiresShipping,availableForSale:t.availableForSale,sku:n??i,name:t.title,listPrice:e?.amount?+e?.amount:0,price:+a.amount,weight:{value:r??0,unit:o},image:l}},normalizeLineItem=t=>{let{quantity:e,id:a,merchandise:r}=t,o=normalizeCartProductVariant(r);return{id:a,quantity:e,variant:o,attributes:t.attributes,variantId:o.id,name:o.name,productTitle:r.product.title,productId:o.id,path:r.product.handle,discounts:[]}},normalizeCart=t=>{let{cost:e}=t;return{createdAt:t.createdAt,id:t.id,lineItems:t.lines.nodes.map(normalizeLineItem),subtotalPrice:+e.subtotalAmount.amount,totalPrice:+e.totalAmount.amount,currency:{code:e.totalAmount.currencyCode},taxesIncluded:!0,lineItemsSubtotalPrice:+e.subtotalAmount.amount,checkoutUrl:t.checkoutUrl,note:t.note,discounts:t.discountCodes.map(t=>({code:t.code,applicable:t.applicable}))}};exports.normalizeCart=normalizeCart;

@@ -1,35 +0,1 @@

'use strict';
var addToCart = require('./api/operations/add-to-cart.js');
var createCart = require('./api/operations/create-cart.js');
var getCart = require('./api/operations/get-cart.js');
var removeCartItem = require('./api/operations/remove-cart-item.js');
var updateCartLine = require('./api/operations/update-cart-line.js');
var cartDiscountCodesUpdate = require('./api/operations/cart-discount-codes-update.js');
var cartNoteUpdate = require('./api/operations/cart-note-update.js');
var product_generated = require('./graphql/queries/product.generated.js');
var shopMeta_generated = require('./graphql/queries/shop-meta.generated.js');
var cartCreate_generated = require('./graphql/mutations/cart-create.generated.js');
var cartDiscountCodesUpdate_generated = require('./graphql/mutations/cart-discount-codes-update.generated.js');
var cartLinesAdd_generated = require('./graphql/mutations/cart-lines-add.generated.js');
var cartLinesRemove_generated = require('./graphql/mutations/cart-lines-remove.generated.js');
var cartLinesUpdate_generated = require('./graphql/mutations/cart-lines-update.generated.js');
var cartNoteUpdate_generated = require('./graphql/mutations/cart-note-update.generated.js');
exports.addToCartOperation = addToCart.addToCartOperation;
exports.createCartOperation = createCart.createCartOperation;
exports.getCartOperation = getCart.getCartOperation;
exports.removeCartItemOperation = removeCartItem.removeCartItemOperation;
exports.updateCartLineOperation = updateCartLine.updateCartLineOperation;
exports.cartDiscountCodesUpdateOperation = cartDiscountCodesUpdate.cartDiscountCodesUpdateOperation;
exports.cartNoteUpdateOperation = cartNoteUpdate.cartNoteUpdateOperation;
exports.ProductDocument = product_generated.ProductDocument;
exports.ShopMetaDocument = shopMeta_generated.ShopMetaDocument;
exports.CartCreateDocument = cartCreate_generated.CartCreateDocument;
exports.CartDiscountCodesUpdateDocument = cartDiscountCodesUpdate_generated.CartDiscountCodesUpdateDocument;
exports.CartLinesAddDocument = cartLinesAdd_generated.CartLinesAddDocument;
exports.CartLinesRemoveDocument = cartLinesRemove_generated.CartLinesRemoveDocument;
exports.CartLinesUpdateDocument = cartLinesUpdate_generated.CartLinesUpdateDocument;
exports.CartNoteUpdateDocument = cartNoteUpdate_generated.CartNoteUpdateDocument;
"use strict";var addToCart=require("./api/operations/add-to-cart.js"),createCart=require("./api/operations/create-cart.js"),getCart=require("./api/operations/get-cart.js"),removeCartItem=require("./api/operations/remove-cart-item.js"),updateCartLine=require("./api/operations/update-cart-line.js"),cartDiscountCodesUpdate=require("./api/operations/cart-discount-codes-update.js"),cartNoteUpdate=require("./api/operations/cart-note-update.js"),product_generated=require("./graphql/queries/product.generated.js"),shopMeta_generated=require("./graphql/queries/shop-meta.generated.js"),cartCreate_generated=require("./graphql/mutations/cart-create.generated.js"),cartDiscountCodesUpdate_generated=require("./graphql/mutations/cart-discount-codes-update.generated.js"),cartLinesAdd_generated=require("./graphql/mutations/cart-lines-add.generated.js"),cartLinesRemove_generated=require("./graphql/mutations/cart-lines-remove.generated.js"),cartLinesUpdate_generated=require("./graphql/mutations/cart-lines-update.generated.js"),cartNoteUpdate_generated=require("./graphql/mutations/cart-note-update.generated.js");exports.addToCartOperation=addToCart.addToCartOperation,exports.createCartOperation=createCart.createCartOperation,exports.getCartOperation=getCart.getCartOperation,exports.removeCartItemOperation=removeCartItem.removeCartItemOperation,exports.updateCartLineOperation=updateCartLine.updateCartLineOperation,exports.cartDiscountCodesUpdateOperation=cartDiscountCodesUpdate.cartDiscountCodesUpdateOperation,exports.cartNoteUpdateOperation=cartNoteUpdate.cartNoteUpdateOperation,exports.ProductDocument=product_generated.ProductDocument,exports.ShopMetaDocument=shopMeta_generated.ShopMetaDocument,exports.CartCreateDocument=cartCreate_generated.CartCreateDocument,exports.CartDiscountCodesUpdateDocument=cartDiscountCodesUpdate_generated.CartDiscountCodesUpdateDocument,exports.CartLinesAddDocument=cartLinesAdd_generated.CartLinesAddDocument,exports.CartLinesRemoveDocument=cartLinesRemove_generated.CartLinesRemoveDocument,exports.CartLinesUpdateDocument=cartLinesUpdate_generated.CartLinesUpdateDocument,exports.CartNoteUpdateDocument=cartNoteUpdate_generated.CartNoteUpdateDocument;

@@ -1,33 +0,1 @@

import { CartLinesAddDocument } from '../../graphql/mutations/cart-lines-add.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const addToCartOperation = (config)=>{
const addToCart = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lines: input.lines.map((v)=>({
merchandiseId: v.variantId,
quantity: v.quantity,
attributes: v.attributes
}))
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartLinesAddDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesAdd?.userErrors.length || !res.data?.cartLinesAdd?.cart) {
throw res.data?.cartLinesAdd?.userErrors;
}
return normalizeCart(res.data.cartLinesAdd.cart);
};
return addToCart;
};
export { addToCartOperation };
import{CartLinesAddDocument as r}from"../../graphql/mutations/cart-lines-add.generated.js";import{composeRequest as t}from"../../helpers/common.js";import{normalizeCart as a}from"../../helpers/normalize.js";let addToCartOperation=e=>{let n=async n=>{if(!e.storefrontUrl)throw Error("Shop is not connected");let o={cartId:n.cartId,lines:n.lines.map(r=>({merchandiseId:r.variantId,quantity:r.quantity,attributes:r.attributes}))},d=await fetch(e.storefrontUrl,{...t(e),body:JSON.stringify({query:r,variables:o})}).then(r=>r.json());if(d.data?.cartLinesAdd?.userErrors.length||!d.data?.cartLinesAdd?.cart)throw d.data?.cartLinesAdd?.userErrors;return a(d.data.cartLinesAdd.cart)};return n};export{addToCartOperation};

@@ -1,29 +0,1 @@

import { CartDiscountCodesUpdateDocument } from '../../graphql/mutations/cart-discount-codes-update.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const cartDiscountCodesUpdateOperation = (config)=>{
const cartNoteUpdate = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
discountCodes: input.discountCodes
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartDiscountCodesUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartDiscountCodesUpdate?.userErrors.length || !res.data?.cartDiscountCodesUpdate?.cart) {
throw res.data?.cartDiscountCodesUpdate?.userErrors;
}
return normalizeCart(res.data.cartDiscountCodesUpdate.cart);
};
return cartNoteUpdate;
};
export { cartDiscountCodesUpdateOperation };
import{CartDiscountCodesUpdateDocument as t}from"../../graphql/mutations/cart-discount-codes-update.generated.js";import{composeRequest as r}from"../../helpers/common.js";import{normalizeCart as o}from"../../helpers/normalize.js";let cartDiscountCodesUpdateOperation=e=>{let a=async a=>{if(!e.storefrontUrl)throw Error("Shop is not connected");let s={cartId:a.cartId,discountCodes:a.discountCodes},d=await fetch(e.storefrontUrl,{...r(e),body:JSON.stringify({query:t,variables:s})}).then(t=>t.json());if(d.data?.cartDiscountCodesUpdate?.userErrors.length||!d.data?.cartDiscountCodesUpdate?.cart)throw d.data?.cartDiscountCodesUpdate?.userErrors;return o(d.data.cartDiscountCodesUpdate.cart)};return a};export{cartDiscountCodesUpdateOperation};

@@ -1,29 +0,1 @@

import { CartNoteUpdateDocument } from '../../graphql/mutations/cart-note-update.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const cartNoteUpdateOperation = (config)=>{
const cartNoteUpdate = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
note: input.note
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartNoteUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartNoteUpdate?.userErrors.length || !res.data?.cartNoteUpdate?.cart) {
throw res.data?.cartNoteUpdate?.userErrors;
}
return normalizeCart(res.data.cartNoteUpdate.cart);
};
return cartNoteUpdate;
};
export { cartNoteUpdateOperation };
import{CartNoteUpdateDocument as t}from"../../graphql/mutations/cart-note-update.generated.js";import{composeRequest as r}from"../../helpers/common.js";import{normalizeCart as e}from"../../helpers/normalize.js";let cartNoteUpdateOperation=o=>{let a=async a=>{if(!o.storefrontUrl)throw Error("Shop is not connected");let n={cartId:a.cartId,note:a.note},p=await fetch(o.storefrontUrl,{...r(o),body:JSON.stringify({query:t,variables:n})}).then(t=>t.json());if(p.data?.cartNoteUpdate?.userErrors.length||!p.data?.cartNoteUpdate?.cart)throw p.data?.cartNoteUpdate?.userErrors;return e(p.data.cartNoteUpdate.cart)};return a};export{cartNoteUpdateOperation};

@@ -1,34 +0,1 @@

import { CartCreateDocument } from '../../graphql/mutations/cart-create.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const createCartOperation = (config)=>{
const createCart = async (args)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
input: {
lines: args.items.map((v)=>({
merchandiseId: v.variantId,
quantity: v.quantity,
attributes: v.attributes
}))
}
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartCreateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartCreate?.userErrors.length || !res.data?.cartCreate?.cart) {
throw res.data?.cartCreate?.userErrors;
}
return normalizeCart(res.data.cartCreate.cart);
};
return createCart;
};
export { createCartOperation };
import{CartCreateDocument as t}from"../../graphql/mutations/cart-create.generated.js";import{composeRequest as r}from"../../helpers/common.js";import{normalizeCart as e}from"../../helpers/normalize.js";let createCartOperation=a=>{let o=async o=>{if(!a.storefrontUrl)throw Error("Shop is not connected");let n={input:{lines:o.items.map(t=>({merchandiseId:t.variantId,quantity:t.quantity,attributes:t.attributes}))}},i=await fetch(a.storefrontUrl,{...r(a),body:JSON.stringify({query:t,variables:n})}).then(t=>t.json());if(i.data?.cartCreate?.userErrors.length||!i.data?.cartCreate?.cart)throw i.data?.cartCreate?.userErrors;return e(i.data.cartCreate.cart)};return o};export{createCartOperation};

@@ -1,28 +0,1 @@

import { CartDocument } from '../../graphql/queries/cart.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const getCartOperation = (config)=>{
const getCart = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
id: input.cartId
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartDocument,
variables
})
}).then((res)=>res.json());
if (!res.data?.cart) {
return undefined;
}
return normalizeCart(res.data.cart);
};
return getCart;
};
export { getCartOperation };
import{CartDocument as r}from"../../graphql/queries/cart.generated.js";import{composeRequest as t}from"../../helpers/common.js";import{normalizeCart as e}from"../../helpers/normalize.js";let getCartOperation=o=>{let a=async a=>{if(!o.storefrontUrl)throw Error("Shop is not connected");let n={id:a.cartId},i=await fetch(o.storefrontUrl,{...t(o),body:JSON.stringify({query:r,variables:n})}).then(r=>r.json());if(i.data?.cart)return e(i.data.cart)};return a};export{getCartOperation};

@@ -1,31 +0,1 @@

import { CartLinesRemoveDocument } from '../../graphql/mutations/cart-lines-remove.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const removeCartItemOperation = (config)=>{
const removeCartItem = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lineIds: [
input.lineId
]
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartLinesRemoveDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesRemove?.userErrors.length || !res.data?.cartLinesRemove?.cart) {
throw res.data?.cartLinesRemove?.userErrors;
}
return normalizeCart(res.data.cartLinesRemove.cart);
};
return removeCartItem;
};
export { removeCartItemOperation };
import{CartLinesRemoveDocument as r}from"../../graphql/mutations/cart-lines-remove.generated.js";import{composeRequest as e}from"../../helpers/common.js";import{normalizeCart as t}from"../../helpers/normalize.js";let removeCartItemOperation=o=>{let a=async a=>{if(!o.storefrontUrl)throw Error("Shop is not connected");let n={cartId:a.cartId,lineIds:[a.lineId]},s=await fetch(o.storefrontUrl,{...e(o),body:JSON.stringify({query:r,variables:n})}).then(r=>r.json());if(s.data?.cartLinesRemove?.userErrors.length||!s.data?.cartLinesRemove?.cart)throw s.data?.cartLinesRemove?.userErrors;return t(s.data.cartLinesRemove.cart)};return a};export{removeCartItemOperation};

@@ -1,35 +0,1 @@

import { CartLinesUpdateDocument } from '../../graphql/mutations/cart-lines-update.generated.js';
import { composeRequest } from '../../helpers/common.js';
import { normalizeCart } from '../../helpers/normalize.js';
const updateCartLineOperation = (config)=>{
const updateCartLine = async (input)=>{
if (!config.storefrontUrl) {
throw new Error('Shop is not connected');
}
const variables = {
cartId: input.cartId,
lines: [
{
id: input.line.id,
merchandiseId: input.line.variantId,
quantity: input.line.quantity
}
]
};
const res = await fetch(config.storefrontUrl, {
...composeRequest(config),
body: JSON.stringify({
query: CartLinesUpdateDocument,
variables
})
}).then((res)=>res.json());
if (res.data?.cartLinesUpdate?.userErrors.length || !res.data?.cartLinesUpdate?.cart) {
throw res.data?.cartLinesUpdate?.userErrors;
}
return normalizeCart(res.data?.cartLinesUpdate.cart);
};
return updateCartLine;
};
export { updateCartLineOperation };
import{CartLinesUpdateDocument as t}from"../../graphql/mutations/cart-lines-update.generated.js";import{composeRequest as r}from"../../helpers/common.js";import{normalizeCart as e}from"../../helpers/normalize.js";let updateCartLineOperation=a=>{let n=async n=>{if(!a.storefrontUrl)throw Error("Shop is not connected");let i={cartId:n.cartId,lines:[{id:n.line.id,merchandiseId:n.line.variantId,quantity:n.line.quantity}]},o=await fetch(a.storefrontUrl,{...r(a),body:JSON.stringify({query:t,variables:i})}).then(t=>t.json());if(o.data?.cartLinesUpdate?.userErrors.length||!o.data?.cartLinesUpdate?.cart)throw o.data?.cartLinesUpdate?.userErrors;return e(o.data?.cartLinesUpdate.cart)};return n};export{updateCartLineOperation};

@@ -1,2 +0,2 @@

/* eslint-disable */ const CartProductVariantSelect = `
let CartProductVariantSelect=`
fragment CartProductVariantSelect on ProductVariant {

@@ -34,4 +34,3 @@ id

}
`;
const CartLineSelect = `
`,CartLineSelect=`
fragment CartLineSelect on CartLine {

@@ -50,4 +49,2 @@ id

}
`;
export { CartLineSelect, CartProductVariantSelect };
`;export{CartLineSelect,CartProductVariantSelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const CartUserErrorSelect = `
let CartUserErrorSelect=`
fragment CartUserErrorSelect on CartUserError {

@@ -7,4 +7,2 @@ code

}
`;
export { CartUserErrorSelect };
`;export{CartUserErrorSelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const CartSelect = `
let CartSelect=`
fragment CartSelect on Cart {

@@ -42,4 +42,2 @@ attributes {

}
`;
export { CartSelect };
`;export{CartSelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const CountrySelect = `
let CountrySelect=`
fragment CountrySelect on Country {

@@ -10,4 +10,2 @@ isoCode

}
`;
export { CountrySelect };
`;export{CountrySelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const CurrencySelect = `
let CurrencySelect=`
fragment CurrencySelect on Currency {

@@ -7,4 +7,2 @@ isoCode

}
`;
export { CurrencySelect };
`;export{CurrencySelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const ImageSelect = `
let ImageSelect=`
fragment ImageSelect on Image {

@@ -9,4 +9,2 @@ id

}
`;
export { ImageSelect };
`;export{ImageSelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const LanguageSelect = `
let LanguageSelect=`
fragment LanguageSelect on Language {

@@ -6,4 +6,2 @@ isoCode

}
`;
export { LanguageSelect };
`;export{LanguageSelect};

@@ -1,2 +0,2 @@

/* eslint-disable */ const MoneyV2Select = `
let MoneyV2Select=`
fragment MoneyV2Select on MoneyV2 {

@@ -6,4 +6,2 @@ amount

}
`;
export { MoneyV2Select };
`;export{MoneyV2Select};

@@ -1,2 +0,2 @@

/* eslint-disable */ const ProductSelect = `
let ProductSelect=`
fragment ProductSelect on Product {

@@ -48,4 +48,2 @@ availableForSale

}
`;
export { ProductSelect };
`;export{ProductSelect};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartCreateDocument = `
import{CartSelect as r}from"../fragments/cart.generated.js";import{MoneyV2Select as e}from"../fragments/money-v2.generated.js";import{CartLineSelect as t,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as m}from"../fragments/image.generated.js";import{CartUserErrorSelect as n}from"../fragments/cart-user-error.generated.js";let CartCreateDocument=`
mutation cartCreate($input: CartInput) {

@@ -18,9 +12,7 @@ cartCreate(input: $input) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartCreateDocument };
${r}
${e}
${t}
${a}
${m}
${n}`;export{CartCreateDocument};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartDiscountCodesUpdateDocument = `
import{CartSelect as t}from"../fragments/cart.generated.js";import{MoneyV2Select as r}from"../fragments/money-v2.generated.js";import{CartLineSelect as e,CartProductVariantSelect as o}from"../fragments/cart-line.generated.js";import{ImageSelect as a}from"../fragments/image.generated.js";import{CartUserErrorSelect as s}from"../fragments/cart-user-error.generated.js";let CartDiscountCodesUpdateDocument=`
mutation cartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {

@@ -18,9 +12,7 @@ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartDiscountCodesUpdateDocument };
${t}
${r}
${e}
${o}
${a}
${s}`;export{CartDiscountCodesUpdateDocument};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartLinesAddDocument = `
import{CartSelect as r}from"../fragments/cart.generated.js";import{MoneyV2Select as e}from"../fragments/money-v2.generated.js";import{CartLineSelect as t,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as n}from"../fragments/image.generated.js";import{CartUserErrorSelect as s}from"../fragments/cart-user-error.generated.js";let CartLinesAddDocument=`
mutation cartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {

@@ -18,9 +12,7 @@ cartLinesAdd(cartId: $cartId, lines: $lines) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartLinesAddDocument };
${r}
${e}
${t}
${a}
${n}
${s}`;export{CartLinesAddDocument};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartLinesRemoveDocument = `
import{CartSelect as e}from"../fragments/cart.generated.js";import{MoneyV2Select as r}from"../fragments/money-v2.generated.js";import{CartLineSelect as t,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as m}from"../fragments/image.generated.js";import{CartUserErrorSelect as n}from"../fragments/cart-user-error.generated.js";let CartLinesRemoveDocument=`
mutation cartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {

@@ -18,9 +12,7 @@ cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartLinesRemoveDocument };
${e}
${r}
${t}
${a}
${m}
${n}`;export{CartLinesRemoveDocument};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartLinesUpdateDocument = `
import{CartSelect as e}from"../fragments/cart.generated.js";import{MoneyV2Select as r}from"../fragments/money-v2.generated.js";import{CartLineSelect as t,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as n}from"../fragments/image.generated.js";import{CartUserErrorSelect as s}from"../fragments/cart-user-error.generated.js";let CartLinesUpdateDocument=`
mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {

@@ -18,9 +12,7 @@ cartLinesUpdate(cartId: $cartId, lines: $lines) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartLinesUpdateDocument };
${e}
${r}
${t}
${a}
${n}
${s}`;export{CartLinesUpdateDocument};

@@ -1,8 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
import { CartUserErrorSelect } from '../fragments/cart-user-error.generated.js';
const CartNoteUpdateDocument = `
import{CartSelect as t}from"../fragments/cart.generated.js";import{MoneyV2Select as r}from"../fragments/money-v2.generated.js";import{CartLineSelect as e,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as o}from"../fragments/image.generated.js";import{CartUserErrorSelect as m}from"../fragments/cart-user-error.generated.js";let CartNoteUpdateDocument=`
mutation cartNoteUpdate($cartId: ID!, $note: String) {

@@ -18,9 +12,7 @@ cartNoteUpdate(cartId: $cartId, note: $note) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}
${CartUserErrorSelect}`;
export { CartNoteUpdateDocument };
${t}
${r}
${e}
${a}
${o}
${m}`;export{CartNoteUpdateDocument};

@@ -1,7 +0,2 @@

import { CartSelect } from '../fragments/cart.generated.js';
import { MoneyV2Select } from '../fragments/money-v2.generated.js';
import { CartLineSelect, CartProductVariantSelect } from '../fragments/cart-line.generated.js';
import { ImageSelect } from '../fragments/image.generated.js';
const CartDocument = `
import{CartSelect as e}from"../fragments/cart.generated.js";import{MoneyV2Select as r}from"../fragments/money-v2.generated.js";import{CartLineSelect as t,CartProductVariantSelect as a}from"../fragments/cart-line.generated.js";import{ImageSelect as m}from"../fragments/image.generated.js";let CartDocument=`
query cart($id: ID!) {

@@ -12,8 +7,6 @@ cart(id: $id) {

}
${CartSelect}
${MoneyV2Select}
${CartLineSelect}
${CartProductVariantSelect}
${ImageSelect}`;
export { CartDocument };
${e}
${r}
${t}
${a}
${m}`;export{CartDocument};

@@ -1,4 +0,2 @@

import { ProductSelect } from '../fragments/product.generated.js';
const ProductDocument = `
import{ProductSelect as t}from"../fragments/product.generated.js";let ProductDocument=`
query product($handle: String, $id: ID) {

@@ -9,4 +7,2 @@ product(handle: $handle, id: $id) {

}
${ProductSelect}`;
export { ProductDocument };
${t}`;export{ProductDocument};

@@ -1,6 +0,2 @@

import { CountrySelect } from '../fragments/country.generated.js';
import { CurrencySelect } from '../fragments/currency.generated.js';
import { LanguageSelect } from '../fragments/language.generated.js';
const ShopMetaDocument = `
import{CountrySelect as e}from"../fragments/country.generated.js";import{CurrencySelect as t}from"../fragments/currency.generated.js";import{LanguageSelect as o}from"../fragments/language.generated.js";let ShopMetaDocument=`
query shopMeta {

@@ -21,6 +17,4 @@ localization {

}
${CountrySelect}
${CurrencySelect}
${LanguageSelect}`;
export { ShopMetaDocument };
${e}
${t}
${o}`;export{ShopMetaDocument};

@@ -1,13 +0,1 @@

const composeRequest = (config)=>{
return {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...config.storefrontToken ? {
'X-Shopify-Storefront-Access-Token': config.storefrontToken
} : {}
}
};
};
export { composeRequest };
let composeRequest=e=>({method:"POST",headers:{"Content-Type":"application/json",...e.storefrontToken?{"X-Shopify-Storefront-Access-Token":e.storefrontToken}:{}}});export{composeRequest};

@@ -1,56 +0,1 @@

const normalizeCartProductVariant = (variant)=>{
const { compareAtPriceV2 , priceV2 , weight , weightUnit , id , sku , image } = variant;
return {
id,
requiresShipping: variant.requiresShipping,
availableForSale: variant.availableForSale,
sku: sku ?? id,
name: variant.title,
listPrice: compareAtPriceV2?.amount ? +compareAtPriceV2?.amount : 0,
price: +priceV2.amount,
weight: {
value: weight ?? 0,
unit: weightUnit
},
image
};
};
const normalizeLineItem = (lineItem)=>{
const { quantity , id , merchandise } = lineItem;
const variant = normalizeCartProductVariant(merchandise);
return {
id,
quantity,
variant,
attributes: lineItem.attributes,
variantId: variant.id,
name: variant.name,
productTitle: merchandise.product.title,
productId: variant.id,
path: merchandise.product.handle,
discounts: []
};
};
const normalizeCart = (cart)=>{
const { cost } = cart;
return {
createdAt: cart.createdAt,
id: cart.id,
lineItems: cart.lines.nodes.map(normalizeLineItem),
subtotalPrice: +cost.subtotalAmount.amount,
totalPrice: +cost.totalAmount.amount,
currency: {
code: cost.totalAmount.currencyCode
},
taxesIncluded: true,
lineItemsSubtotalPrice: +cost.subtotalAmount.amount,
checkoutUrl: cart.checkoutUrl,
note: cart.note,
discounts: cart.discountCodes.map((v)=>({
code: v.code,
applicable: v.applicable
}))
};
};
export { normalizeCart };
let normalizeCartProductVariant=t=>{let{compareAtPriceV2:e,priceV2:a,weight:r,weightUnit:o,id:i,sku:n,image:l}=t;return{id:i,requiresShipping:t.requiresShipping,availableForSale:t.availableForSale,sku:n??i,name:t.title,listPrice:e?.amount?+e?.amount:0,price:+a.amount,weight:{value:r??0,unit:o},image:l}},normalizeLineItem=t=>{let{quantity:e,id:a,merchandise:r}=t,o=normalizeCartProductVariant(r);return{id:a,quantity:e,variant:o,attributes:t.attributes,variantId:o.id,name:o.name,productTitle:r.product.title,productId:o.id,path:r.product.handle,discounts:[]}},normalizeCart=t=>{let{cost:e}=t;return{createdAt:t.createdAt,id:t.id,lineItems:t.lines.nodes.map(normalizeLineItem),subtotalPrice:+e.subtotalAmount.amount,totalPrice:+e.totalAmount.amount,currency:{code:e.totalAmount.currencyCode},taxesIncluded:!0,lineItemsSubtotalPrice:+e.subtotalAmount.amount,checkoutUrl:t.checkoutUrl,note:t.note,discounts:t.discountCodes.map(t=>({code:t.code,applicable:t.applicable}))}};export{normalizeCart};

@@ -1,15 +0,1 @@

export { addToCartOperation } from './api/operations/add-to-cart.js';
export { createCartOperation } from './api/operations/create-cart.js';
export { getCartOperation } from './api/operations/get-cart.js';
export { removeCartItemOperation } from './api/operations/remove-cart-item.js';
export { updateCartLineOperation } from './api/operations/update-cart-line.js';
export { cartDiscountCodesUpdateOperation } from './api/operations/cart-discount-codes-update.js';
export { cartNoteUpdateOperation } from './api/operations/cart-note-update.js';
export { ProductDocument } from './graphql/queries/product.generated.js';
export { ShopMetaDocument } from './graphql/queries/shop-meta.generated.js';
export { CartCreateDocument } from './graphql/mutations/cart-create.generated.js';
export { CartDiscountCodesUpdateDocument } from './graphql/mutations/cart-discount-codes-update.generated.js';
export { CartLinesAddDocument } from './graphql/mutations/cart-lines-add.generated.js';
export { CartLinesRemoveDocument } from './graphql/mutations/cart-lines-remove.generated.js';
export { CartLinesUpdateDocument } from './graphql/mutations/cart-lines-update.generated.js';
export { CartNoteUpdateDocument } from './graphql/mutations/cart-note-update.generated.js';
export{addToCartOperation}from"./api/operations/add-to-cart.js";export{createCartOperation}from"./api/operations/create-cart.js";export{getCartOperation}from"./api/operations/get-cart.js";export{removeCartItemOperation}from"./api/operations/remove-cart-item.js";export{updateCartLineOperation}from"./api/operations/update-cart-line.js";export{cartDiscountCodesUpdateOperation}from"./api/operations/cart-discount-codes-update.js";export{cartNoteUpdateOperation}from"./api/operations/cart-note-update.js";export{ProductDocument}from"./graphql/queries/product.generated.js";export{ShopMetaDocument}from"./graphql/queries/shop-meta.generated.js";export{CartCreateDocument}from"./graphql/mutations/cart-create.generated.js";export{CartDiscountCodesUpdateDocument}from"./graphql/mutations/cart-discount-codes-update.generated.js";export{CartLinesAddDocument}from"./graphql/mutations/cart-lines-add.generated.js";export{CartLinesRemoveDocument}from"./graphql/mutations/cart-lines-remove.generated.js";export{CartLinesUpdateDocument}from"./graphql/mutations/cart-lines-update.generated.js";export{CartNoteUpdateDocument}from"./graphql/mutations/cart-note-update.generated.js";
{
"name": "@gem-sdk/adapter-shopify",
"version": "1.12.0",
"version": "1.14.0-dev.284",
"license": "MIT",

@@ -26,3 +26,3 @@ "sideEffects": false,

"dependencies": {
"@gem-sdk/adapter-common": "*"
"@gem-sdk/adapter-common": "1.14.0-dev.284"
},

@@ -29,0 +29,0 @@ "module": "dist/esm/index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc