diff --git a/.changeset/eighty-papayas-occur.md b/.changeset/eighty-papayas-occur.md deleted file mode 100644 index 70223458c..000000000 --- a/.changeset/eighty-papayas-occur.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -"@vue-storefront/magento-sdk": patch ---- - -[CHANGED] `magentoModule` has been deprecated. Use `middlewareModule` from `@vue-storefront/sdk` package instead. - -```diff -- import { initSDK, buildModule } from '@vue-storefront/sdk'; -- import { magentoModule } from '@vsf-enterprise/magento-sdk' -+ import { initSDK, buildModule, middlewareModule } from '@vue-storefront/sdk'; -+ import { Endpoints as MagentoEndpoints } from '@vsf-enterprise/sapcc-api'; // In Alokai Storefront you should import it from `storefront-middleware/types.ts` - -const sdkConfig = { - magento: - buildModule( -- magentoModule, -+ middlewareModule, - { apiUrl: 'http://localhost:8181/magento' } - ) -}; -``` - -Updating your `magentoModule` to this version should not disrupt your existing code; however, switching to `middlewareModule` will require certain modifications. - -To migrate: - -- Use custom query as a second argument of `middlewareModule` function. - -```diff -const customQuery = { - cart: 'cart-custom-query', - metadata: { - fields: 'id items { uid }' - } -}; -- const cart = await sdk.magento.cart({ cartId: '123'}, { customQuery }); -+ const cart = await sdk.magento.cart({ cartId: '123'}, customQuery); -``` diff --git a/.changeset/gorgeous-news-notice.md b/.changeset/gorgeous-news-notice.md deleted file mode 100644 index 1af4b91f6..000000000 --- a/.changeset/gorgeous-news-notice.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@vue-storefront/magento-api": patch ---- - -[CHANGED] Update TSDocs of API methods. Now, they contain examples of usage. diff --git a/.changeset/popular-bats-suffer.md b/.changeset/popular-bats-suffer.md deleted file mode 100644 index ff811bc03..000000000 --- a/.changeset/popular-bats-suffer.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@vue-storefront/magento-api": minor ---- - -[CHANGED] Enhanced default GQL `productDetailsQuery` with new fields: `stock_status` and `only_x_left_in_stock`. [#1521](https://github.com/vuestorefront/magento2/pull/1521/files) diff --git a/docs/content/5.api/magento-api.api.json b/docs/content/5.api/magento-api.api.json index b42d73f9f..a4727169c 100644 --- a/docs/content/5.api/magento-api.api.json +++ b/docs/content/5.api/magento-api.api.json @@ -172,7 +172,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addBundleProductsToCart:function(1)", - "docComment": "", + "docComment": "/**\n * Add bundle products to cart.\n *\n * @example\n *\n * Adding bundle products to cart with default parameters.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const cart = await sdk.magento.addBundleProductsToCart(\n * {\n * cart_id: '123',\n * cart_items: [\n * {\n * data: {\n * quantity: 1,\n * sku: TEST_BUNDLE_SKU,\n * },\n * bundle_options: [\n * {\n * id: 1,\n * quantity: 1,\n * value: ['1'],\n * },\n * {\n * id: 2,\n * quantity: 1,\n * value: ['4'],\n * },\n * {\n * id: 3,\n * quantity: 1,\n * value: ['5'],\n * },\n * {\n * id: 4,\n * quantity: 1,\n * value: ['8'],\n * },\n * ]\n * }\n * );\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for adding bundle products to cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'add-bundle-products-to-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation addBundleProductsToCart($input: AddBundleProductsToCartInput) {\n * addBundleProductsToCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`,\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to modify response containing the cart, which is sent as part of the adding product to cart mutation\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'add-bundle-products-to-cart-custom-query',\n * metadata: {\n * fields: 'id items { uid }'\n * }\n * };\n *\n *\n * const cart = await sdk.magento.addBundleProductsToCart(\n * {\n * // use the payload from the previous example\n * },\n * customQuery\n * );\n *\n * // Result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -287,7 +287,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addConfigurableProductsToCart:function(1)", - "docComment": "/**\n * Adds a set of configurable products to a specified cart\n *\n * @param context - VSF Context\n *\n * @param input - ID of the cart and products to be added\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Add configurable products to cart.\n *\n * @example\n *\n * Adding configurable products to cart with default parameters.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const cart = await sdk.magento.addConfigurableProductsToCart(\n * {\n * cart_id: '123',\n * cart_items: [\n * {\n * data: {\n * quantity: 1,\n * sku: 'MH01-XS-Black',\n * },\n * parent_sku: 'MH01',\n * customizable_options: [],\n * }\n * ]\n * }\n * );\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for adding configurable products to cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'add-configurable-products-to-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation addConfigurableProductsToCart($input: AddConfigurableProductsToCartInput) {\n * addConfigurableProductsToCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`,\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to modify response containing the cart, which is sent as part of the adding product to cart mutation\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'add-configurable-products-to-cart-custom-query',\n * metadata: {\n * fields: 'id items { uid }'\n * }\n * };\n *\n *\n * const cart = await sdk.magento.addConfigurableProductsToCart(\n * {\n * cart_id: '123',\n * cart_items: [\n * {\n * data: {\n * quantity: 1,\n * sku: 'MH01-XS-Black',\n * },\n * parent_sku: 'MH01',\n * customizable_options: [],\n * }\n * ]\n * },\n * customQuery\n * );\n *\n * // Result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -402,7 +402,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addDownloadableProductsToCart:function(1)", - "docComment": "/**\n * Adds a set of downloadable products to a specified cart\n *\n * @param context - VSF Context\n *\n * @param input - ID of the cart and products to be added\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Adds a set of downloadable products to a specified cart\n */\n", "excerptTokens": [ { "kind": "Content", @@ -517,7 +517,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addProductsToCart:function(1)", - "docComment": "/**\n * Adds products to the specified cart\n *\n * @param context - VSF Context\n *\n * @param input - ID of the cart and products to be added\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Add products to cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // add products to cart with default parameters (returns cart)\n * const cart = await sdk.magento.addProductsToCart(\n * {\n * cartId: '123',\n * cartItems: [\n * {\n * sku: 'WSH12',\n * quantity: 1,\n * selected_options: [\n * // option IDs retrieved from product\n * 'Y29uZmlndXJhYmxlLzkzLzUz',\n * 'Y29uZmlndXJhYmxlLzE0NC8xNzE='\n * ]\n * }\n * ]\n * }\n * );\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for adding products to cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'add-products-to-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation addProductsToCart($cartId: String!, $cartItems: [CartItemInput!]!) {\n * addProductsToCart(cartId: $cartId, cartItems: $cartItems) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n *\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to modify response containing the cart, which is sent as part of the adding product to cart mutation\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'add-products-to-cart-custom-query',\n * metadata: {\n * fields: 'id items { uid }'\n * }\n * };\n *\n *\n * const cart = await sdk.magento.addProductsToCart(\n * {\n * cartId: '123',\n * cartItems: [\n * {\n * sku: 'WSH12',\n * quantity: 1,\n * selected_options: [\n * 'Y29uZmlndXJhYmxlLzkzLzUz',\n * 'Y29uZmlndXJhYmxlLzE0NC8xNzE='\n * ]\n * }\n * ]\n * },\n * customQuery\n * );\n *\n * // Result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -632,7 +632,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addProductToWishList:function(1)", - "docComment": "", + "docComment": "/**\n * Add products to wishlist\n *\n * @example\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const wishlist = await sdk.magento.addProductToWishList({\n * // Wishlist ID\n * id: '258',\n * // Products to add to wishlist with given ID\n * items: [{quantity: 1, sku: 'WSH12'}]\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for searching categories\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'add-product-to-wishlist-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation addProductsToWishlist($id: ID!, $items: [WishlistItemInput!]!) {\n * addProductsToWishlist(wishlistId: $id, wishlistItems: $items) {\n * wishlist {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * }\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query (mutation) to add products to wishlist\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * addProductsToWishList: 'add-product-to-wishlist-custom-query',\n * metadata: {\n * fields: 'id items_count'\n * }\n * };\n *\n * const result = await sdk.magento.addProductToWishList({\n * id: '258',\n * items: [{ quantity: 1, sku: '258'}]\n * }, customQuery);\n *\n * // Returned wishlist will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -747,7 +747,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addSimpleProductsToCart:function(1)", - "docComment": "", + "docComment": "/**\n * Add simple products to cart.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -862,7 +862,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!addVirtualProductsToCart:function(1)", - "docComment": "/**\n * Adds a set of virtual products to a specified cart\n *\n * @param context - VSF Context\n *\n * @param input - ID of the cart and products to add\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Adds a set of virtual products to a specified cart\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1002,7 +1002,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!applyCouponToCart:function(1)", - "docComment": "/**\n * Applies a coupon to a given card\n *\n * @param context - VSF context\n *\n * @param input - ID of the card and coupon to apply\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Apply coupon to cart\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // apply coupon parameters\n * const params = {\n * cart_id: 'test-cart-id',\n * coupon_code: 'test-coupon-code'\n * };\n *\n * // The result of the coupon application\n * const result = await sdk.magento.applyCouponToCart(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for getting cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'apply-coupon-to-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation applyCouponToCart($input: ApplyCouponToCartInput) {\n * applyCouponToCart(input: $input) {\n * ${metadata.fields}\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch reduced amount of data\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * applyCouponToCart: 'apply-coupon-to-cart-custom-query',\n * metadata: {\n * fields: 'cart { applied_coupons { code } }'\n * }\n * };\n *\n * const params = {\n * cart_id: 'test-cart-id',\n * coupon_code: 'test-coupon-code'\n * };\n *\n * // The result will contain only fields configured in the custom query\n * const result = await sdk.magento.applyCouponToCart(params, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1117,7 +1117,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!availableStores:function(1)", - "docComment": "/**\n * Returns list of available stores\n */\n", + "docComment": "/**\n * Fetch available stores\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch available stores\n * const result = await sdk.magento.availableStores();\n *\n * // result.data.availableStores contains the available stores\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'available-stores-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query availableStores {\n * availableStores {\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * availableStores: 'available-stores-custom-query',\n * metadata: {\n * fields: 'code store_name'\n * }\n * };\n *\n * const result = await sdk.magento.availableStores(customQuery);\n *\n * // result.data.availableStores contains the available stores with only the fields specified in the custom query\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1216,7 +1216,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!cart:function(1)", - "docComment": "/**\n * Fetches a cart by its ID\n *\n * @param context - VSF context\n *\n * @param cartId - ID of the cart to fetch\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get cart\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch cart with default parameters\n * const cart = await sdk.magento.cart({ cartId: '123' });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for getting cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query cart($cartId: String!) {\n * cart(cart_id:$cartId) {\n * ${metadata.fields}\n * }\n * }`\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch cart\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'cart-custom-query',\n * metadata: {\n * fields: 'id items { uid }'\n * }\n * };\n *\n * const cart = await sdk.magento.cart({ cartId: '123'}, customQuery);\n *\n * // Cart will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1330,7 +1330,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!cartTotalQty:function(1)", - "docComment": "", + "docComment": "/**\n * Resolve cart total quantity This method is optimized to fetch only total quantity of the cart and not the whole cart object. Do not use `cart` query inf you want to fetch only total quantity of the cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch total quantity of the cart\n * const { data } await sdk.magento.cartTotalQty({cartId: 'some_cart_id' });\n *\n * // total quantity of the cart available in data.cart.total_quantity\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1428,7 +1428,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!categories:function(1)", - "docComment": "/**\n * Fetches categories.\n *\n * @param context - Context\n *\n * @param params - \n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch list of all categories matching specified filters\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of categories with default parameters\n * const categories = await sdk.magento.categories({});\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for fetching categories.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'categories-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query categories {\n * categories {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch categories.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * categories: 'categories-custom-query',\n * metadata: {\n * fields: 'items { uid name }'\n * }\n * };\n *\n * const categories = await sdk.magento.categories({}, customQuery);\n *\n * // Category list will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1543,7 +1543,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!categoryList:function(1)", - "docComment": "/**\n * Fetches the category list.\n *\n * @deprecated\n *\n * Use `categories` method instead\n *\n * @param context - VSF Context\n *\n * @param params - \n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch list of all categories without filters\n *\n * @deprecated\n *\n * Use `categories` method instead.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1658,7 +1658,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!categorySearch:function(1)", - "docComment": "/**\n * Searches for categories using received filters.\n *\n * @param context - VSF Context\n *\n * @param filters - filters used to search for categories. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Search categories\n *\n * @example\n *\n * Simple usage without filters\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of categories with default parameters\n * const categories = await sdk.magento.categorySearch();\n * ```\n *\n * @example\n *\n * Usage with filters\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // make a request to fetch list of categories with custom parameters\n * const details = await sdk.magento.categorySearch({\n * filters: {\n * category_uid: {\n * in: ['MjA=']\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for searching categories\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'category-search-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query categorySearch($filters: CategoryFilterInput) {\n * categoryList(filters: $filters) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to search categories.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * categorySearch: 'category-search-custom-query',\n * metadata: {\n * fields: 'children_count products { total_count }'\n * }\n * };\n *\n * const result = await sdk.magento.categorySearch({\n * filter: {\n * category_uid: {\n * in: ['=MjA']\n * }\n * }\n * }, customQuery);\n *\n * // Details will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -1773,7 +1773,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!changeCustomerPassword:function(1)", - "docComment": "/**\n * Changes password of the current customer. To override the default query, use the `changeCustomerPassword` query key.\n */\n", + "docComment": "/**\n * Change customer password.\n *\n * @example\n *\n * Simple usage, change customer password:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const result = await sdk.magento.changeCustomerPassword({\n * currentPassword: 'currentPassword',\n * newPassword: 'newPassword'\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for changeCustomerPassword:\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'change-customer-password-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation changeCustomerPassword($currentPassword: String!, $newPassword: String!) {\n * changeCustomerPassword(\n * currentPassword: $currentPassword\n * newPassword: $newPassword\n * ) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to narrow down the response data:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * changeCustomerPassword: 'change-customer-password-custom-query',\n * metadata: {\n * fields: 'email'\n * }\n * };\n *\n * const result = await sdk.magento.changeCustomerPassword({\n * currentPassword: 'currentPassword',\n * newPassword: 'newPassword'\n * }, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2047,7 +2047,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!cmsBlocks:function(1)", - "docComment": "/**\n * Fetch CMS Blocks from Magento Api.\n *\n * @param context - VSF Context\n *\n * @param identifiers - identifiers of CMS blocks\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default cmsBlocks query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch cms blocks.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch few cms blocks by their identifiers\n * const { data } = await sdk.magento.cmsBlocks({\n * identifiers: ['id1', 'id2']\n * });\n *\n * // result will contain cms blocks with the specified identifiers\n * data.cmsBlocks.items.forEach(block => console.log(block.identifier));\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'cms-blocks-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query cmsBlock($identifiers: [String]) {\n * cmsBlocks(identifiers: $identifiers) {\n * items {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * // fetch only title\n * const customQuery = {\n * cmsBlocks: 'cms-blocks-custom-query',\n * metadata: {\n * fields: 'title'\n * }\n * };\n *\n * const { data } = await sdk.magento.cmsBlocks({\n * identifiers: ['id1', 'id2']\n * }, customQuery);\n *\n * // data will contain only block titles\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2161,7 +2161,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!cmsPage:function(1)", - "docComment": "/**\n * Fetch CMS Page from Magento\n *\n * @param context - VSF Context\n *\n * @param identifier - identifier of CMS page\n *\n * @param customQuery - (optional) - custom query that extends default cmsPage GraphQL query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch CMS page\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch home page by the page identifier\n * const result = await sdk.magento.cmsPage({\n * identifier: 'home'\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'cms-page-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query cmsPage($identifier: String) {\n * cmsPage(identifier:$identifier) {\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields to only the content and title\n * const customQuery = {\n * cmsPage: 'cms-page-custom-query',\n * metadata: {\n * fields: 'title content'\n * }\n * };\n *\n * const result = await sdk.magento.cmsPage({\n * identifier: 'home'\n * }, customQuery);\n *\n * // result will only contain the title and content fields\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2655,7 +2655,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!countries:function(1)", - "docComment": "/**\n * Loads the list of countries\n *\n * @param context - VSF Context\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch list of countries\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of countries\n * const result = await sdk.magento.countries();\n *\n * // result.data.countries is an array of countries\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'countries-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query countriesList {\n * countries {\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * countries: 'countries-custom-query',\n * metadata: {\n * fields: 'full_name_english'\n * }\n * };\n *\n * const result = await sdk.magento.countries(customQuery);\n *\n * // result.data.countries will only contain the full_name_english field\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2754,7 +2754,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!country:function(1)", - "docComment": "/**\n * Fetches the information about a country given its ID\n *\n * @param context - VSF Context\n *\n * @param id - ID of the country to be fetched\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetches the information about a country given its ID\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2868,7 +2868,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!createCustomer:function(1)", - "docComment": "/**\n * Registers a new customer. To override the default query, use the `createCustomer` query key.\n */\n", + "docComment": "/**\n * Create a new customer.\n *\n * @example\n *\n * Simple usage with basic customer data:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const params = {\n * email: 'john.doe@gmail.com'\n * firstname: 'John',\n * lastname: 'Doe',\n * }\n *\n * const result = await sdk.magento.createCustomer(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for creating a customer\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'create-customer-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query customer {\n * customer {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch customer\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n *\n * const customQuery = {\n * customer: 'create customer-custom-query',\n * metadata: {\n * fields: 'email firstname lastname'\n * }\n * };\n *\n * const params = {\n * email: 'john.doe@gmail.com'\n * firstname: 'John',\n * lastname: 'Doe',\n * }\n *\n * const result = await sdk.magento.createCustomer(params, customQuery)\n *\n * // result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -2983,7 +2983,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!createCustomerAddress:function(1)", - "docComment": "/**\n * Creates a customer address.\n *\n * @param context - VSF Context\n *\n * @param input - new customer address data\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Create a customer address.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const address: CustomerAddressInput = {\n * city: 'some city',\n * country_code: CountryCodeEnum.Us,\n * default_billing: false,\n * default_shipping: false,\n * firstname: 'John',\n * lastname: 'Doe',\n * postcode: '08701',\n * street: ['street'],\n * telephone: '123123123',\n * region: {\n * region_code: 'NJ',\n * region_id: 41,\n * region: 'New Jersey'\n * }\n * };\n *\n * // customer address will be created for the currently logged in customer\n * await sdk.magento.createCustomerAddress(address);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'create-customer-address-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation createCustomerAddress($input: CustomerAddressInput!) {\n * createCustomerAddress(input: $input) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the API\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * createCustomerAddress: 'create-customer-address-custom-query',\n * metadata: {\n * fields: 'id city'\n * }\n * };\n *\n * // address parameter is the same as in the simple usage example\n * const result = await sdk.magento.createCustomerAddress(address, customQuery);\n *\n * result.data.createCustomerAddress.city; // 'some city'\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3098,7 +3098,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!createEmptyCart:function(1)", - "docComment": "", + "docComment": "/**\n * Create an empty cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // create an empty cart\n * const cart = await sdk.magento.createEmptyCart();\n *\n * // cart id can be accessed from the response\n * const cartId = cart.data.createEmptyCart;\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3181,7 +3181,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!createProductReview:function(1)", - "docComment": "/**\n * Creates a new product review\n */\n", + "docComment": "/**\n * Create product review\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // create review data structure\n * const review = {\n * sku: 'some-sku',\n * nickname: 'john.doe',\n * summary: 'awesome thing, whatever it is!',\n * text: 'this is a test review',\n * ratings: [{\n * id: 'NA==', // base64 encoded id\n * value_id: 'MjA=' // base64 encoded value_id\n * }]\n * };\n *\n * const result = await sdk.magento.createProductReview(review);\n *\n * // result will contain the created review and summary data\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3280,7 +3280,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!currency:function(1)", - "docComment": "/**\n * Fetches the currency information.\n *\n * @param context - VSF context\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch available currencies in a store.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch available currencies\n * const result = await sdk.magento.currency();\n *\n * // result would be something like:\n * // {\n * // \"data\": {\n * // \"currency\": {\n * // \"_currency_code\": \"EUR\",\n * // \"_currency_symbol\": \"€\",\n * // \"default_display_currency_code\": \"EUR\",\n * // \"default_display_currency_symbol\": \"€\",\n * // \"available_currency_codes\": [\n * // \"EUR\",\n * // \"USD\"\n * // ],\n * // \"exchange_rates\": [\n * // {\n * // \"currency_to\": \"EUR\",\n * // \"rate\": 1\n * // },\n * // {\n * // \"currency_to\": \"USD\",\n * // \"rate\": 1.2\n * // }\n * // ]\n * // }\n * // }\n * // }\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'currency-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query currency {\n * currency{\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch a list of currencies with limited number of fields\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * currency: 'currency-custom-query',\n * metadata: {\n * fields: '_currency_code'\n * }\n * };\n *\n * const result = await sdk.magento.currency(customQuery);\n *\n * // result will contain only the _currency_code field\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3379,7 +3379,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!customer:function(1)", - "docComment": "/**\n * Returns the information about the current customer. To override the default query, use the `customer` query key.\n */\n", + "docComment": "/**\n * Get current customer information\n *\n * @example\n *\n * The `customer()` returns the currently active user. This means that the request needs to contain an authorization token, which will tell Magento whose customer data should be fetched.\n *\n * If your browser has a VSF customer cookie saved, you can just call `customer()` without any parameters - the token will be attached automatically on every request to the middleware.\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch customer\n * const customer = await sdk.magento.customer();\n * ```\n *\n * @example\n *\n * If you're calling `customer()` in a non-browser context (for example in integration tests) where it's not possible to save a cookie, you can attach the token manually using `customHeaders`\n *\n * Usage with manual authorization:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const token = '123'\n * const customHeaders = { Authorization: `Bearer {token}` }\n *\n * // fetch customer\n * const customer = await sdk.magento.customer({ customHeaders });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for fetching customer\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'customer-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query customer {\n * customer {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch customer\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * customer: 'customer-custom-query',\n * metadata: {\n * fields: 'email firstname lastname'\n * }\n * };\n *\n * const customer = await sdk.magento.customer(customQuery);\n *\n * // customer will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3478,7 +3478,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!customerCart:function(1)", - "docComment": "/**\n * Fetches the cart of the current logged in user\n *\n * @param context - VSF context\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch customer cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch customer cart\n * const { data } = await sdk.magento.customerCart();\n *\n * // data contains cart details\n * const email = data?.customerCart?.email;\n *\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for customerCart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'customer-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query customerCart {\n * customerCart {\n * ${metadata.fields}\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query, when compared to the default query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * customerCart: 'customer-cart-custom-query',\n * metadata: {\n * fields: 'id email items { id sku }\n * }\n * };\n *\n * const result = await sdk.magento.customerCart(customQuery);\n *\n * // result contains cart details with only the fields specified in the custom query\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3692,7 +3692,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!customerProductReview:function(1)", - "docComment": "/**\n * Returns product reviews created by the current customer\n *\n * @deprecated\n *\n * Use {@link @vue-storefront/magento-api#reviews} instead.\n */\n", + "docComment": "/**\n * Returns product reviews created by the current customer\n *\n * @deprecated\n *\n * Use {@link https://docs.alokai.com/integrations/magento/api/magento-api/reviews | reviews} instead.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3807,7 +3807,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!customMutation:function(1)", - "docComment": "", + "docComment": "/**\n * Send an arbitrary GraphQL mutation to the Magento GraphQL endpoint For sending query, please see {@link https://docs.vuestorefront.io/integrations/magento/api/magento-api/customQuery | customQuery}.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Prepare custom mutation\n * // Do not use gql-tag (gql``) here.\n * // For syntax highlighting (provided by respective IDE extensions), add the `#graphql` comment at the start of the template string\n * const mutation = `#graphql\n * mutation generateCustomerToken($email: String!, $password: String!) {\n * generateCustomerToken(email: $email, password: $password) {\n * token\n * }\n * }\n * `;\n *\n * // Prepare mutation variables\n * const mutationVariables = {\n * email: TEST_USER_EMAIL,\n * password: TEST_USER_PASSWORD\n * };\n *\n * // use custom mutation and variables to fetch response adjusted to your needs\n * const result = await sdk.magento.customMutation({\n * mutation,\n * mutationVariables\n * });\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -3947,7 +3947,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!customQuery:function(1)", - "docComment": "", + "docComment": "/**\n * Send an arbitrary GraphQL query to the Magento GraphQL endpoint For sending mutation, please see {@link https://docs.vuestorefront.io/integrations/magento/api/magento-api/customMutation | customMutation}.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Do not use gql-tag (gql``) here.\n * // For syntax highlighting (provided by respective IDE extensions), add the `#graphql` comment at the start of the template string\n *\n * const query = `#graphql\n * query($search: String!) {\n * products(search: $search) {\n * items {\n * name\n * }\n * }\n * }\n * `;\n *\n * const queryVariables: GetProductSearchParams = { search: \"t-shirt\" };\n *\n * // fetch query response\n * const customQueryResult = await sdk.magento.customQuery({\n * query: query,\n * queryVariables\n * });\n * ```\n *\n * @example\n *\n * If you want the method to send a GET instead of a POST request, use the `options.clientConfig` parameter.\n * ```ts\n * const customQueryResult = await sdk.magento.customQuery(\n * {\n * query,\n * queryVariables\n * },\n * {\n * clientConfig: {\n * method: 'GET'\n * }\n * }\n * );\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4078,7 +4078,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!deleteCustomerAddress:function(1)", - "docComment": "/**\n * Deletes a customer address.\n *\n * @param context - VSF Context\n *\n * @param addressId - ID of the customer address to delete\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Delete a customer address.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const addressId = 12;\n * // customer address will be remove for the currently logged in customer\n * const response = await sdk.magento.deleteCustomerAddress({ id: addressId });\n * // response.data?.deleteCustomerAddress - result is stored here, it's boolean\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4215,7 +4215,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!generateCustomerToken:function(1)", - "docComment": "/**\n * Logs in the customer based on provided username and password. To override the default query, use the `generateCustomerToken` query key.\n */\n", + "docComment": "/**\n * Generate customer token\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch token\n * const result = await sdk.magento.generateCustomerToken({\n * email: 'some-email',\n * password: 'some-password'\n * });\n *\n * // Token is now available in result.data.generateCustomerToken.token\n * ```\n *\n * *\n *\n * @example\n *\n * Creating a custom GraphQL query to fetch additional data:\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'generate-customer-token-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation generateCustomerToken($email: String!, $password: String!) {\n * generateCustomerToken(email: $email, password: $password) {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * route: 'generate-customer-token-custom-query',\n * metadata: {\n * fields: 'token additional_field'\n * }\n * };\n *\n * // data will contain only the fields specified in the custom query.\n * const result = await sdk.magento.generateCustomerToken({\n * email: 'some-email',\n * password: 'some-password'\n * }, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4329,7 +4329,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!getAvailableCustomerPaymentMethods:function(1)", - "docComment": "", + "docComment": "/**\n * Fetch available payment methods for a logged in customer.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch available payment methods for a logged in customer\n * const result = await sdk.magento.getAvailableCustomerPaymentMethods();\n *\n * // example result\n * {\n * \"data\": {\n * \"cart\": {\n * \"__typename\": \"Cart\",\n * \"available_payment_methods\": [\n * {\n * \"__typename\": \"AvailablePaymentMethod\",\n * \"code\": \"checkmo\",\n * \"title\": \"Check / Money order\"\n * }\n * ]\n * }\n * },\n * \"loading\": false,\n * \"networkStatus\": 7\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4412,7 +4412,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!getAvailableCustomerShippingMethods:function(1)", - "docComment": "/**\n * Retrive available shipping methods for current customer\n *\n * @param context - VSF Context\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch available shipping methods for current customer. Customer must be logged in.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch available shipping methods for current customer\n * const result = await sdk.magento.getAvailableCustomerShippingMethods();\n * // e.g. output:\n * // {\n * // \"data\": {\n * // \"customerCart\": {\n * // \"shipping_addresses\": [\n * // address1: {\n * // \"available_shipping_methods\": [...]\n * // },\n * // ]\n * // }\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'get-available-customer-shipping-methods-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query CustomerAvailableShippingMethods {\n * customerCart {\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the API\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n *\n * const customQuery = {\n * getAvailableCustomerShippingMethods: 'get-available-customer-shipping-methods-custom-query',\n * metadata: {\n * fields: 'shipping_addresses { available_shipping_methods { available method_title } }'\n * }\n * };\n *\n * const result = await sdk.magento.getAvailableCustomerShippingMethods(customQuery);\n *\n * // the result will contain only the data defined in the custom query\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4511,7 +4511,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!getAvailablePaymentMethods:function(1)", - "docComment": "/**\n * Fetches the available payment methods for the received cart.\n *\n * @param context - VSF context\n *\n * @param cartId - cart ID\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get available payment methods for the received guest cart. To get available customer payment methods use {@link https://docs.vuestorefront.io/integrations/magento/api/magento-api/getAvailableCustomerPaymentMethods | getAvailableCustomerPaymentMethods}.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch guest available payment methods\n * const result = await sdk.magento.getAvailablePaymentMethods({\n * cartId: 'masked-cart-id'\n * });\n *\n * // example result\n * {\n * \"data\": {\n * \"cart\": {\n * \"__typename\": \"Cart\",\n * \"available_payment_methods\": [\n * {\n * \"__typename\": \"AvailablePaymentMethod\",\n * \"code\": \"checkmo\",\n * \"title\": \"Check / Money order\"\n * }\n * ]\n * }\n * },\n * \"loading\": false,\n * \"networkStatus\": 7\n * }\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4609,7 +4609,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!getAvailableShippingMethods:function(1)", - "docComment": "", + "docComment": "/**\n * Fetch guest's available shipping methods\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch guest's available shipping methods\n * const result = await sdk.magento.getAvailableShippingMethods({\n * cart_id: TEST_CART_ID\n * });\n * // array of available shipping methods for selected shipping address:\n * result.data.cart.shipping_addresses[0].available_shipping_methods[0];\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for fetching only what's requested from shipping methods\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'get-available-shipping-methods-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query GuestAvailableShippingMethods($cart_id: String!) {\n * cart(cart_id:$cart_id) {\n * shipping_addresses {\n * available_shipping_methods {\n * ${metadata.fields}\n * }\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch only method_title field\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * shippingMethods: 'get-available-shipping-methods-custom-query',\n * metadata: {\n * fields: 'method_title'\n * }\n * };\n *\n * const result = await sdk.magento.getAvailableShippingMethods({ cart_id: '123'}, customQuery);\n *\n * // result contains the customer addresses with only the city method_title. Of course, it has same shape as in the \"simple usage\" example.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4724,7 +4724,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!getCustomerAddresses:function(1)", - "docComment": "/**\n * Fetches customer addresses.\n *\n * @param context - VSF Context\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get customer addresses. Customer must be logged in before calling this method.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch customer addresses if customer is logged in\n * const { data } = await sdk.magento.getCustomerAddresses();\n *\n * // data contains the customer addresses\n * data.customer.addresses; // array of customer addresses\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'get-customer-addresses-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query getCustomerAddresses {\n * customer {\n * addresses {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * getCustomerAddresses: 'get-customer-addresses-custom-query',\n * metadata: {\n * fields: 'city'\n * }\n * };\n *\n * const { data } = await sdk.magento.getCustomerAddresses(customQuery);\n *\n * // data contains the customer addresses with only the city field\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -4891,7 +4891,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!mergeCarts:function(1)", - "docComment": "", + "docComment": "/**\n * Merge carts\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const params = {\n * sourceCartId: 'pCS0ykep1l3wGlPKSyWLJq5fb1DxIQcp',\n * // this cart needs to have been created by a logged in user\n * destinationCartId: 'xiYYh2ep0l3xGtPsz2WLJf5f31DxBJx0'\n * }\n *\n * // merge carts and return the result (cart)\n * const mergedCart = await sdk.magento.mergeCarts(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for merging carts\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'merge-carts-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation mergeCarts($sourceCartId: String!, $destinationCartId: String!) {\n * mergeCarts(source_cart_id: $sourceCartId, destination_cart_id: $destinationCartId) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to merge carts\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'merge-carts-custom-query',\n * metadata: {\n * fields: 'id items { product { name } }'\n * }\n * };\n *\n * const params = {\n * sourceCartId: 'pCS0ykep1l3wGlPKSyWLJq5fb1DxIQcp',\n * destinationCartId: 'xiYYh2ep0l3xGtPsz2WLJf5f31DxBJx0'\n * }\n * const mergedCart = await sdk.magento.mergeCarts(params, customQuery);\n *\n * // Merged cart will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5005,7 +5005,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!placeOrder:function(1)", - "docComment": "/**\n * Places an order for received cart.\n *\n * @param context - VSF Context\n *\n * @param input - the order's input, containing the cart's ID\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Place an order.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // place an order\n * const result = await sdk.magento.placeOrder({cart_id: 'some-cart-id'});\n *\n * // example result:\n * {\n * \"data\": {\n * \"placeOrder\": {\n * \"__typename\": \"PlaceOrderOutput\",\n * \"order\": {\n * \"__typename\": \"Order\",\n * \"order_number\": \"000000522\"\n * }\n * }\n * }\n * }\n * ```\n *\n * @example\n *\n * The complete flow of placing an order for a guest user:\n *\n * ```ts const emptyCart = await sdk.magento.createEmptyCart(); // create an empty cart const cartId = emptyCart?.data?.createEmptyCart || ''; // get cart id from the response\n *\n * // set guest email on the cart await sdk.magento.setGuestEmailOnCart({ cart_id: cartId, email: 'john.doe+test@vuestorefront.io' });\n *\n * // add products to the cart await sdk.magento.addProductsToCart({ cartId, cartItems: [ { quantity: 1, sku: 'some-sku', // size and color selected_options: ['Y29uZmlndXJhYmxlLzkzLzUz', 'Y29uZmlndXJhYmxlLzE0NC8xNzE='] } ] });\n *\n * const address = { firstname: 'John', lastname: 'Doe', city: 'New York', country_code: 'US', street: ['Street 1', 'Street 2'], telephone: '123 123 123', region: 'AL', postcode: '10001', save_in_address_book: false }\n *\n * // set shipping and billing address await sdk.magento.setShippingAddressesOnCart({ cart_id: cartId, shipping_addresses: [{ address }] }); await sdk.magento.setBillingAddressOnCart({ cart_id: cartId, billing_address: { address } });\n *\n * // await sdk.magento.setShippingMethodsOnCart({ cart_id: cartId, shipping_methods: [{ carrier_code: 'flatrate', method_code: 'flatrate' }] }); await sdk.magento.setPaymentMethodOnCart({ cart_id: cartId, payment_method: { code: 'checkmo' } });\n *\n * // place the order const result = await sdk.magento.placeOrder({ cart_id: cartId });\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5104,7 +5104,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!productDetails:function(1)", - "docComment": "/**\n * Fetches the list of products with details using sort, filters and pagination.\n *\n * @param context - VSF context\n *\n * @param searchParams - params with sort, filters and pagination\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get products details\n *\n * @example\n *\n * Simple usage without filters, sorting or pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of products with default parameters\n * const details = await sdk.magento.productDetails({});\n * ```\n *\n * @example\n *\n * Usage with filters, sorting and pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // make a request to fetch list of products with custom parameters\n * const details = await sdk.magento.productDetails({\n * pageSize: 20,\n * currentPage: 1,\n * filter: {\n * sku: {\n * eq: PRODUCT_SKU\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for adding product details.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'product-details-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query productDetails(\n * $search: String = \"\",\n * $filter: ProductAttributeFilterInput,\n * $pageSize: Int = 10,\n * $currentPage: Int = 1,\n * $sort: ProductAttributeSortInput\n * ) {\n * products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch product details.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * productDetails: 'product-details-custom-query',\n * metadata: {\n * fields: 'items { sku name }'\n * }\n * };\n *\n * const details = await sdk.magento.productDetails({\n * filter: {\n * sku: {\n * eq: 'some-sku' // optional SKU filter\n * }\n * }\n * }, customQuery);\n *\n * // Details will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5219,7 +5219,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!productReview:function(1)", - "docComment": "/**\n * Returns reviews of the provided product\n */\n", + "docComment": "/**\n * Fetch product reviews\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch all products reviews (default pagination limit is 10)\n * const result = await sdk.magento.productReview({});\n * ```\n *\n * @example\n *\n * Fetching reviews for a specific product:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const result = await sdk.magento.productReview({ filter: { sku: { eq: '24-MB01' } );\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'product-review-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query productReview($search: String = \"\", $filter: ProductAttributeFilterInput, $pageSize: Int = 10, $currentPage: Int = 1, $sort: ProductAttributeSortInput) {\n * products(search: $search, filter: $filter, sort: $sort) {\n * items {\n * review_count\n * reviews(pageSize: $pageSize, currentPage: $currentPage) {\n * items {\n * ${metadata?.fields}\n * }\n * }\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to change the amount of fields returned by the query:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * productReview: 'product-review-custom-query',\n * metadata: {\n * fields: 'average_rating'\n * }\n * };\n *\n * const result = await sdk.magento.productReview({}, customQuery);\n *\n * // result.data.products.items[0].reviews.items[0] will only contain the average_rating field\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5334,7 +5334,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!productReviewRatingsMetadata:function(1)", - "docComment": "/**\n * Returns the active ratings attributes and the values each rating can have.\n */\n", + "docComment": "/**\n * Get the active ratings attributes and the values each rating can have.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch the active ratings attributes and the values each rating can have\n * const { data } = await sdk.magento.productReviewRatingsMetadata();\n *\n * data.productReviewRatingsMetadata.items; // array of review's attributes\n * data.productReviewRatingsMetadata.items[0].values; // array of possible values of the review's attributes\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'product-review-ratings-metadata-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query productReviewRatingsMetadata {\n * productReviewRatingsMetadata {\n * items {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * productReviewRatingsMetadata: 'product-review-ratings-metadata-custom-query',\n * metadata: {\n * fields: `\n * name\n * values {\n * value\n * }\n * `\n * }\n * };\n *\n * const { data } = await sdk.magento.productReviewRatingsMetadata(customQuery);\n *\n * // data.productReviewRatingsMetadata.items[0] will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5433,7 +5433,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!products:function(1)", - "docComment": "/**\n * Fetches products using received search term and params for filter, sort and pagination.\n *\n * @param context - VSF context\n *\n * @param searchParams - search term and params for filter, sort and pagination\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get products\n *\n * @example\n *\n * Simple usage without filters, sorting or pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of products with default parameters\n * const details = await sdk.magento.products({});\n * ```\n *\n * @example\n *\n * Usage with filters, sorting and pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // make a request to fetch list of products with custom parameters\n * const details = await sdk.magento.products({\n * pageSize: 20,\n * currentPage: 1,\n * filter: {\n * sku: {\n * eq: PRODUCT_SKU\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for fetching products.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'products-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query productsList(\n * $search: String = \"\",\n * $filter: ProductAttributeFilterInput,\n * $pageSize: Int = 10,\n * $currentPage: Int = 1,\n * $sort: ProductAttributeSortInput\n * ) {\n * products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch products list.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * products: 'products-custom-query',\n * metadata: {\n * fields: 'items { sku name }'\n * }\n * };\n *\n * const products = await sdk.magento.products({\n * filter: {\n * sku: {\n * eq: 'some-sku' // optional SKU filter\n * }\n * }\n * }, customQuery);\n *\n * // Products will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5694,7 +5694,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!relatedProducts:function(1)", - "docComment": "/**\n * Searches for related products using params for sorting, filtering and pagination.\n *\n * @param context - VSF context\n *\n * @param searchParams - params for sorting, filtering and pagination\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Get related products\n *\n * @example\n *\n * Simple usage without filters, sorting or pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Fetch list of products filtered by the SKU\n * // Only the parent product is affected by filters\n * const products = await sdk.magento.relatedProduct({\n * pageSize: 1,\n * filter: {\n * sku: {\n * eq: PRODUCT_SKU\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Usage with filters, sorting and pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // make a request to fetch list of products with custom parameters\n * const products = await sdk.magento.relatedProduct({\n * pageSize: 20,\n * currentPage: 1,\n * filter: {\n * sku: {\n * eq: PRODUCT_SKU\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query getting related products.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'related-product-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query relatedProduct(\n * $search: String = \"\",\n * $filter: ProductAttributeFilterInput,\n * $pageSize: Int = 10,\n * $currentPage: Int = 1,\n * $sort: ProductAttributeSortInput\n * ) {\n * products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch related products.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * relatedProduct: 'related-product-custom-query',\n * metadata: {\n * fields: 'items { related_products { uid __typename } }'\n * }\n * };\n *\n * const result = await sdk.magento.relatedProduct({\n * filter: {\n * sku: {\n * eq: 'some-sku' // optional SKU filter\n * }\n * }\n * }, customQuery);\n *\n * // Result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5809,7 +5809,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!removeCouponFromCart:function(1)", - "docComment": "/**\n * Removes a coupon from a cart\n *\n * @param context - VSF context\n *\n * @param input - ID of the cart and coupon to remove\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Remove coupon from cart\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // assuming that the coupon code is already applied to the cart\n * const params = {\n * cart_id: 'test-cart-id',\n * };\n *\n * // Remove coupon from cart\n * const result = await sdk.magento.removeCouponFromCart(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for getting cart\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'remove-coupon-from-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation removeCouponFromCart($input: RemoveCouponFromCartInput) {\n * removeCouponFromCart(input: $input) {\n * ${metadata.fields}\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch reduced amount of data\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const customQuery = {\n * removeCouponFromCart: 'remove-coupon-from-cart-custom-query',\n * metadata: {\n * fields: 'cart { applied_coupons { code } }'\n * }\n * };\n *\n * // The only required parameter is cart_id\n * const params = {\n * cart_id: 'test-cart-id',\n * };\n *\n * // The result will contain only fields configured in the custom query\n * const result = await sdk.magento.removeCouponFromCart(params, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -5924,7 +5924,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!removeItemFromCart:function(1)", - "docComment": "/**\n * Removes an item from the given cart\n *\n * @param context - VSF context\n *\n * @param input - ID of the cart and item to be removed from it\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Remove item from cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Assumes that the cart has an item with the UID 'MY='.\n * // Configure method parameters\n * const params = { cart_id: TEST_CART_ID, cart_item_uid: 'MY=' }\n *\n * const result = await sdk.magento.removeItemFromCart(params);\n *\n * // result will contain the updated cart.\n * // you can look at the cart items to see that the item with the UID 'MY=' has been removed.\n * const hasItem = result.data?.removeItemFromCart!.cart!.items!.find(item => item!.uid === 'MY=');\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for manipulating the cart response data.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'remove-item-from-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation removeItemFromCart($input: RemoveItemFromCartInput) {\n * removeItemFromCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * // this will reduce the amount of data transferred from the server to the client.\n *\n * // All we need is the cart ID and the email address of the customer.\n * const customQuery = {\n * cart: 'remove-item-from-cart-custom-query',\n * metadata: {\n * fields: 'id email'\n * }\n * };\n *\n * // Assumes that the cart has an item with the UID 'MY='.\n * // Uses params from the previous example and the custom query.\n * const result = await sdk.magento.removeItemFromCart(params, customQuery);\n *\n * // result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6039,7 +6039,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!removeProductsFromWishlist:function(1)", - "docComment": "", + "docComment": "/**\n * Remove products from wishlist Customer must be logged in to perform this operation. (token in headers)\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // remove\n * const result = await sdk.magento.removeProductsFromWishlist({\n * id: 'some-wishlist-id',\n * items: ['some-product-id']\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'remove-products-from-wishlist-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation removeProductsFromWishlist($id: ID!, $items: [ID!]!) {\n * removeProductsFromWishlist(wishlistId: $id, wishlistItemsIds: $items) {\n * wishlist {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the API\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * removeProductsFromWishlist: 'remove-products-from-wishlist-custom-query',\n * metadata: {\n * fields: 'id'\n * }\n * };\n *\n * const result = await sdk.magento.removeProductsFromWishlist({\n * id: 'some-wishlist-id',\n * items: ['item-id-1', 'item-id-2']\n * }, customQuery);\n *\n * // result should be narrowed to only contain the `id` field\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6154,7 +6154,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!requestPasswordResetEmail:function(1)", - "docComment": "/**\n * Requests a password reset email to be sent to the user\n *\n * @param context - VSF Context\n *\n * @param input - Email for which to request a password reset\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Request password reset email\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // trigger sending of password reset email\n * const result = await sdk.magento.requestPasswordResetEmail({ email: 'john.doe@gmail.com'});\n *\n * // result.data.requestPasswordResetEmail contains the boolean response from the API\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6253,7 +6253,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!resetPassword:function(1)", - "docComment": "/**\n * Resets a user's password\n *\n * @param context - VSF Context\n *\n * @param input - Params used to reset a user's password\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Reset customer password.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch resetPassword\n * const await sdk.magento.resetPassword({\n * email: 'customer.email@gmail.com'\n * newPassword: 'newPassword',\n * resetPasswordToken: 'resetPasswordToken' // token obtained from email {@link @vue-storefront/magento-sdk#requestPasswordResetEmail}\n * });\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6352,7 +6352,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!reviews:function(1)", - "docComment": "/**\n * Returns product reviews created by the current customer\n */\n", + "docComment": "/**\n * Fetch customer reviews\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch reviews, customer must be logged in\n * const result = await sdk.magento.reviews();\n *\n * // log all reviews\n * result?.data?.customer?.reviews?.items.forEach(review => console.log(review));\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'customer-product-review-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query reviews($pageSize: Int = 10, $currentPage: Int = 1) {\n * customer {\n * reviews(pageSize: $pageSize, currentPage: $currentPage) {\n * ${metadata?.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of fields returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * // fetch only text\n *\n * const customQuery = {\n * reviews: 'customer-product-review-custom-query',\n * metadata: {\n * fields: 'items { text }'\n * }\n * };\n *\n * const result = await sdk.magento.reviews({}, customQuery);\n *\n * // result will only contain the text of the reviews\n * result?.data?.customer?.reviews?.items.forEach(review => console.log(review.text));\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6467,7 +6467,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!revokeCustomerToken:function(1)", - "docComment": "/**\n * Logs out the current customer. To override the default query, use the `revokeCustomerToken` query key.\n */\n", + "docComment": "/**\n * Revoke customer token. It is used to log out the current customer.\n *\n * @example\n *\n * Simple usage if the customer is logged in and the token is valid:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // token will be invalidated and the customer will be logged out\n * await sdk.magento.revokeCustomerToken();\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6550,7 +6550,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!route:function(1)", - "docComment": "/**\n * Returns the canonical URL for a specified product, category, or CMS page\n *\n * @param context - VSF Context\n *\n * @param url - the URL to be resolved\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Resolve a route object data\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch route object data\n * const result = await sdk.magento.route({\n * url: 'aether-gym-pant.html'\n * });\n *\n * // Example result:\n * {\n * data: {\n * route: { type: 'PRODUCT', sku: 'MP11', __typename: 'ConfigurableProduct' }\n * },\n * loading: false,\n * networkStatus: 7\n * }\n * ```\n *\n * *\n *\n * @example\n *\n * Creating a custom GraphQL query to fetch additional data:\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'route-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query route($url: String!) {\n * route(url: $url) {\n * ${metadata?.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * route: 'route-custom-query',\n * metadata: {\n * fields: 'type ... on CategoryInterface { uid name image}' // fetch additional name and image fields\n * }\n * };\n *\n * // data will contain only the fields specified in the custom query.\n * const { data } = await sdk.magento.route({ url: 'women.html' }, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6673,7 +6673,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!setBillingAddressOnCart:function(1)", - "docComment": "", + "docComment": "/**\n * Set billing address on the cart\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Prepare parameters\n * const params = {\n * cart_id: 'some-cart-id',\n * billing_address: {\n * address: {\n * firstname: 'John',\n * lastname: 'Doe',\n * city: 'New York',\n * country_code: 'US',\n * street: ['Street 1', 'Street 2'],\n * telephone: '123 123 123',\n * region: 'AL',\n * postcode: '10001',\n * save_in_address_book: false\n * },\n * }\n * };\n *\n * // Set shipping address on the cart\n * await sdk.magento.setBillingAddressOnCart(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for reducing the amount of fields returned by the query, when compared to the default query.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'set-billing-address-on-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation setBillingAddressOnCart($input: SetBillingAddressOnCartInput) {\n * setBillingAddressOnCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * setBillingAddressOnCart: 'set-billing-address-on-cart-custom-query',\n * metadata: {\n * fields: 'billing_address { city }'\n * }\n * };\n *\n * // data will contain only the fields specified in the custom query.\n * const { data } = await sdk.magento.setBillingAddressOnCart(params, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6788,7 +6788,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!setGuestEmailOnCart:function(1)", - "docComment": "/**\n * Set the guest user email on the cart\n *\n * @param context - VSF Context\n *\n * @param input - Variables to set guest email\n *\n * @param customQuery - (optional) - Custom query that will extend default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Set the guest user email on the cart\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // set an email on the cart\n * const result = await sdk.magento.setGuestEmailOnCart({ cart_id: 'some-cart-id', email: 'some-email' });\n *\n * // new email will be set on the cart\n * // data.setGuestEmailOnCart.cart.email will contain the email address\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -6903,7 +6903,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!setPaymentMethodOnCart:function(1)", - "docComment": "/**\n * Sets received payment method on cart.\n *\n * @param context - VSF context\n *\n * @param input - params containing the cart's ID and the payment method\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Set payment method on cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * const params = {\n * cart_id: 'some-cart-id'\n * payment_method: {\n * code: 'checkmo'\n * }\n * };\n *\n * // sets payment method on cart and return payment information\n * // data contains properties like `available_payment_methods` and `selected_payment_method`\n * const { data } = await sdk.magento.setPaymentMethodOnCart(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for configuring the response data structure\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'set-payment-method-on-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation setPaymentMethodOnCart($input: SetPaymentMethodOnCartInput) {\n * setPaymentMethodOnCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created with the `set-payment-method-on-cart-custom-query` in the previous example\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * setPaymentMethodOnCart: 'set-payment-method-on-cart-custom-query',\n * metadata: {\n * fields: 'available_payment_methods { code title }'\n * }\n * };\n *\n * // Params and options are the same as in the previous example\n * const { data } = await sdk.magento.setPaymentMethodOnCart(params, customQuery);\n *\n * // data contains only the properties selected in the custom query\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7018,7 +7018,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!setShippingAddressesOnCart:function(1)", - "docComment": "/**\n * Sets a shipping address on received cart.\n *\n * @param context - VSF context\n *\n * @param input - params with cart ID and shipping address.\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Set shipping addresses on the cart It should be used to set single or multiple shipping addresses on the cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Prepare parameters\n * const params = {\n * cart_id: 'some-cart-id',\n * shipping_addresses: [\n * {\n * address: {\n * firstname: 'John',\n * lastname: 'Doe',\n * city: 'New York',\n * country_code: 'US',\n * street: ['Street 1', 'Street 2'],\n * telephone: '123 123 123',\n * region: 'AL',\n * postcode: '10001',\n * save_in_address_book: false\n * },\n * }\n * ]\n * };\n *\n * // Set shipping address on the cart\n * await sdk.magento.setShippingAddressesOnCart(params);\n * ```\n *\n * @example\n *\n * You can also use the `setShippingAddressesOnCart` method to set multiple shipping addresses on the cart.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Prepare parameters\n * const params = {\n * cart_id: 'some-cart-id',\n * shipping_addresses: [\n * {\n * address: address1, // address1 is an object with address details\n * },\n * {\n * address: address2, // address2 is an object with address details\n * }\n * ];\n *\n * // This will set address1 and address2 on the cart\n * await sdk.magento.setShippingAddressesOnCart(params);\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for reducing the amount of fields returned by the query, when compared to the default query.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'set-shipping-addresses-on-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation setShippingAddressesOnCart($input: SetShippingAddressesOnCartInput) {\n * setShippingAddressesOnCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * cart: 'set-shipping-addresses-on-cart-custom-query',\n * metadata: {\n * fields: 'shipping_addresses { city }'\n * }\n * };\n *\n * // data will contain only the fields specified in the custom query.\n * const { data } = await sdk.magento.setShippingAddressesOnCart(params, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7133,7 +7133,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!setShippingMethodsOnCart:function(1)", - "docComment": "/**\n * Sets a shipping method on received cart.\n *\n * @param context - VSF context\n *\n * @param input - params with cart ID and shipping method.\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Set shipping methods on cart. Before using this method, you need to set shipping address on cart.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Assuming that shipping address is already set on cart.\n * // if not, you need to set shipping address on cart first.\n *\n * const params = {\n * cart_id: 'some-cart-id',\n * shipping_methods: [\n * {\n * carrier_code: 'flatrate',\n * method_code: 'flatrate'\n * }\n * ]\n * };\n *\n * const { data } = await sdk.magento.setShippingMethodsOnCart(params);\n *\n * // you can get set shipping methods on cart response from\n * // data?.setShippingMethodsOnCart?.cart?.shipping_addresses?.[0]?.selected_shipping_method?.method_code\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query to change the amount of fields returned by the query, when compared to the default query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'set-shipping-methods-on-cart-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation setShippingMethodsOnCart($input: SetShippingMethodsOnCartInput) {\n * setShippingMethodsOnCart(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * // you will get only selected_shipping_method.method_code field\n *\n * const customQuery = {\n * setShippingMethodsOnCart: 'set-shipping-methods-on-cart-custom-query',\n * metadata: {\n * fields: 'shipping_addresses { selected_shipping_method { method_code } }'\n * }\n * };\n *\n * const params = {\n * cart_id: 'some-cart-id',\n * shipping_methods: [\n * {\n * carrier_code: 'flatrate',\n * method_code: 'flatrate'\n * }\n * ]\n * };\n *\n * const { data } = await sdk.magento.setShippingMethodsOnCart(params, customQuery);\n *\n * // data will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7402,7 +7402,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!storeConfig:function(1)", - "docComment": "/**\n * Fetches the store configuration from the API\n *\n * @param context - VSF Context\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetch store configuration\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch store configuration\n * const result = await sdk.magento.storeConfig();\n *\n * // result?.data?.storeConfig contains the store configuration\n * ```\n *\n * @example\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'store-config-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query storeConfig {\n * storeConfig {\n * ${metadata?.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to select only the fields you need\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // we want to fetch only logo related data\n * const customQuery = {\n * storeConfig: 'store-config-custom-query',\n * metadata: {\n * fields: 'logo_alt logo_height logo_width'\n * }\n * };\n *\n * const result = await sdk.magento.storeConfig(customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7553,7 +7553,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!subscribeEmailToNewsletter:function(1)", - "docComment": "/**\n * Subscribes an email in the newsletter.\n *\n * @param context - VSF context\n *\n * @param input - params with the email to subscribe\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Allows guests and registered customers to sign up to receive newsletters.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // subscribe an email in the newsletter. * const email = 'somemail@vsf.local';\n * const result = await sdk.magento.subscribeEmailToNewsletter({ email });\n *\n * result.data?.subscribeEmailToNewsletter?.status; // status of the operation. Possible values: https://developer.adobe.com/commerce/webapi/graphql/schema/customer/mutations/subscribe-email-to-newsletter/#subscriptionstatusesenum\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7652,7 +7652,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!updateCartItems:function(1)", - "docComment": "/**\n * Updates the contents of the given cart\n *\n * @param context - VSF context\n *\n * @param input - ID of the cart and the items to update it\n *\n * @param customQuery - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Update items in the cart\n *\n * @example\n *\n * Simple usage, updating the quantity of a cart item:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // update the quantity of a cart item\n * const result = await sdk.magento.updateCartItems({\n * cart_id: 'some-cart-id'\n * cart_items: [{\n * cart_item_uid: 'MY=',\n * quantity: 10 // update the quantity to 10\n * }]\n * });\n *\n * // result will contain the updated cart.\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for manipulating the cart response data.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'update-cart-items-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation updateCartItems($input: UpdateCartItemsInput) {\n * updateCartItems(input: $input) {\n * cart {\n * ${metadata.fields}\n * }\n * }\n * }`\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query created in the previous example. Note that the custom query must be passed to the `customQuery` property of the `options` parameter. The `metadata` property of the `options` parameter can be used to pass additional data to the custom query.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * updateCartItems: 'update-cart-items-custom-query',\n * metadata: {\n * fields: 'id items { uid quantity product { uid sku }}'\n * }\n * };\n *\n * // update the quantity of a cart item with params and custom query\n * // Params are the same as in the previous example.\n * const result = await sdk.magento.updateCartItems(params, customQuery);\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7767,7 +7767,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!updateCustomer:function(1)", - "docComment": "/**\n * Updates the data of the current customer. To override the default query, use the `updateCustomer` query key.\n */\n", + "docComment": "/**\n * Update customer data. Customer data is updated based on the current customer token.\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // Updates customer first name\n * const result = await sdk.magento.updateCustomer({\n * firstname: 'New John'\n * });\n *\n * // result contains updated customer data\n * console.log(result); // result.data.updateCustomerV2.customer.firstname === 'New John'\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'update-customer-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation updateCustomer($input: CustomerUpdateInput!) {\n * updateCustomerV2(input: $input) {\n * customer {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to reduce the amount of data returned by the query\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * updateCustomer: 'update-customer-custom-query',\n * metadata: {\n * fields: 'firstname lastname'\n * }\n * };\n *\n * const result = await sdk.magento.updateCustomer({\n * firstname: 'New John'\n * lastname: 'New Doe'\n * }, customQuery);\n *\n * // result contains only the fields specified in the custom query\n * // result.data.updateCustomerV2.customer.firstname === 'New John'\n * // result.data.updateCustomerV2.customer.lastname === 'New Doe'\n * console.log(result); // result.data.updateCustomerV2.customer.firstname === 'New John'\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7882,7 +7882,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!updateCustomerAddress:function(1)", - "docComment": "/**\n * Updates a customer address.\n *\n * @param context - VSF Context\n *\n * @param params - object with address identifier and the updated data\n *\n * @param customQuery - (optional) custom GraphQL query that extends the default query\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Update customer address The user needs to be logged in in order to send this request\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch updated customer address\n * const result = await sdk.magento.updateCustomerAddress();\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for updating customer address\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'update-customer-address-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation updateCustomerAddress($id: Int!, $input: CustomerAddressInput) {\n * updateCustomerAddress(id: $id, input: $input) {\n * ${metadata.fields}\n * }\n * }\n * `\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to update customer address\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * updateCustomerAddress: 'update-customer-address-custom-query',\n * metadata: {\n * fields: 'id city company'\n * }\n * };\n *\n * const result = await sdk.magento.updateCustomerAddress({ id: 308, input: { city: \"Warsaw\" } }, customQuery);\n *\n * // result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -7997,7 +7997,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!updateCustomerEmail:function(1)", - "docComment": "", + "docComment": "/**\n * Update customer email\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // update customer\n * const result = await sdk.magento.updateCustomerEmail({ email: \"johndoe@example.com\", password: \"hunter2\" });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for updating customer\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'update-customer-email-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * mutation updateCustomerEmail($email: String!, $password: String!) {\n * updateCustomerEmail(email: $email, password: $password){\n * customer {\n * ${metadata.fields}\n * }\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to update customer\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * // reduce the amount of fields returned by the query, when compared to the default query\n * const customQuery = {\n * updateCustomerEmail: 'update-customer-email-custom-query',\n * metadata: {\n * fields: 'email firstname'\n * }\n * };\n *\n * const result = await sdk.magento.updateCustomerEmail({ email: \"johndoe@example.com\", password: \"hunter2\" }, customQuery);\n *\n * // Result will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -8112,7 +8112,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!upsellProducts:function(1)", - "docComment": "/**\n * Returns upsell products matching the provided parameters. To override the default query, use the `upsellProducts` query key.\n */\n", + "docComment": "/**\n * Get upsell products for a given product.\n *\n * @example\n *\n * Simple usage without filters, sorting or pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // fetch list of upsell-products with default parameters\n * const upsellProducts = await sdk.magento.upsellProducts({});\n * ```\n *\n * @example\n *\n * Usage with filters, sorting and pagination:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // make a request to fetch list of products with upsell products\n * const upsellProducts = await sdk.magento.upsellProducts({\n * pageSize: 20,\n * currentPage: 1,\n * filter: {\n * sku: {\n * eq: PRODUCT_SKU\n * }\n * }\n * });\n * ```\n *\n * @example\n *\n * Creating a custom GraphQL query for getting upsellProducts.\n * ```ts\n * module.exports = {\n * integrations: {\n * magento: {\n * customQueries: {\n * 'upsell-products-custom-query': ({ variables, metadata }) => ({\n * variables,\n * query: `\n * query upsellProducts(\n * $search: String = \"\",\n * $filter: ProductAttributeFilterInput,\n * $pageSize: Int = 10,\n * $currentPage: Int = 1,\n * $sort: ProductAttributeSortInput\n * ) {\n * products(search: $search, filter: $filter, sort: $sort, pageSize: $pageSize, currentPage: $currentPage) {\n * ${metadata.fields}\n * }\n * }\n * `\n * }),\n * },\n * }\n * }\n * };\n * ```\n *\n * @example\n *\n * Using a custom GraphQL query to fetch upsell-products.\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n * const customQuery = {\n * upsellProducts: 'upsell-products-custom-query',\n * metadata: {\n * fields: 'items { sku name upsell_products { sku } }'\n * }\n * };\n *\n * const upsellProducts = await sdk.magento.upsellProducts({\n * filter: {\n * sku: {\n * eq: 'some-sku' // optional SKU filter\n * }\n * }\n * }, customQuery);\n *\n * // upsellProducts will contain only the fields specified in the custom query.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", @@ -8227,7 +8227,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!urlResolver:function(1)", - "docComment": "/**\n * Fetches the resolver for received URL.\n *\n * @deprecated\n *\n * - use route instead\n *\n * @param context - VSF Context\n *\n * @param url - the URL to be resolved\n *\n * @param customQuery - (optional) - custom GraphQL query that extends the default one\n *\n * @param customHeaders - (optional) - custom headers that extends the default headers\n */\n", + "docComment": "/**\n * Fetches the resolver for received URL.\n *\n * @deprecated\n *\n * - use {@link https://docs.alokai.com/integrations/magento/api/magento-api/route | route} instead.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -8384,7 +8384,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!wishlist:function(1)", - "docComment": "", + "docComment": "/**\n * Get wishlist.\n */\n", "excerptTokens": [ { "kind": "Content", @@ -8499,7 +8499,7 @@ { "kind": "Function", "canonicalReference": "@vue-storefront/magento-api!wishlistItemsCount:function(1)", - "docComment": "", + "docComment": "/**\n * Count items in the wishlist\n *\n * @example\n *\n * Simple usage:\n * ```ts\n * import { sdk } from '~/sdk.config.ts';\n *\n * // returns items counter of each wishlist for currently logged in customer\n * const response = await sdk.magento.wishlistItemsCount();\n * // response.data?.customer!.wishlists - array with object containing items counter.\n * // response.data?.customer!.wishlists[X]!.items_count - items_counter for each selected wishlist.\n * // index of element in the array isn't equal wishlist's id in the magento.\n * ```\n *\n */\n", "excerptTokens": [ { "kind": "Content", diff --git a/docs/content/6.reference/changelogs/vue-storefront-magento-api.md b/docs/content/6.reference/changelogs/vue-storefront-magento-api.md index 6f2f335c2..eaebf0373 100644 --- a/docs/content/6.reference/changelogs/vue-storefront-magento-api.md +++ b/docs/content/6.reference/changelogs/vue-storefront-magento-api.md @@ -1,5 +1,15 @@ # @vue-storefront/magento-api +## 3.1.0 + +### Minor Changes + +- 6dc90582: [CHANGED] Enhanced default GQL `productDetailsQuery` with new fields: `stock_status` and `only_x_left_in_stock`. [#1521](https://github.com/vuestorefront/magento2/pull/1521/files) + +### Patch Changes + +- 6672edfb: [CHANGED] Update TSDocs of API methods. Now, they contain examples of usage. + ## 3.0.0 ### Major Changes diff --git a/docs/content/6.reference/changelogs/vue-storefront-magento-sdk.md b/docs/content/6.reference/changelogs/vue-storefront-magento-sdk.md index 2b631b5dc..71589d8f1 100644 --- a/docs/content/6.reference/changelogs/vue-storefront-magento-sdk.md +++ b/docs/content/6.reference/changelogs/vue-storefront-magento-sdk.md @@ -1,5 +1,44 @@ # @vue-storefront/magento-sdk +## 2.3.2 + +### Patch Changes + +- 6672edfb: [CHANGED] `magentoModule` has been deprecated. Use `middlewareModule` from `@vue-storefront/sdk` package instead. + + ```diff + - import { initSDK, buildModule } from '@vue-storefront/sdk'; + - import { magentoModule } from '@vsf-enterprise/magento-sdk' + + import { initSDK, buildModule, middlewareModule } from '@vue-storefront/sdk'; + + import { Endpoints as MagentoEndpoints } from '@vsf-enterprise/sapcc-api'; // In Alokai Storefront you should import it from `storefront-middleware/types.ts` + + const sdkConfig = { + magento: + buildModule( + - magentoModule, + + middlewareModule, + { apiUrl: 'http://localhost:8181/magento' } + ) + }; + ``` + + Updating your `magentoModule` to this version should not disrupt your existing code; however, switching to `middlewareModule` will require certain modifications. + + To migrate: + + - Use custom query as a second argument of `middlewareModule` function. + + ```diff + const customQuery = { + cart: 'cart-custom-query', + metadata: { + fields: 'id items { uid }' + } + }; + - const cart = await sdk.magento.cart({ cartId: '123'}, { customQuery }); + + const cart = await sdk.magento.cart({ cartId: '123'}, customQuery); + ``` + ## 2.3.1 ### Patch Changes diff --git a/packages/api-client/CHANGELOG.md b/packages/api-client/CHANGELOG.md index 6f2f335c2..eaebf0373 100644 --- a/packages/api-client/CHANGELOG.md +++ b/packages/api-client/CHANGELOG.md @@ -1,5 +1,15 @@ # @vue-storefront/magento-api +## 3.1.0 + +### Minor Changes + +- 6dc90582: [CHANGED] Enhanced default GQL `productDetailsQuery` with new fields: `stock_status` and `only_x_left_in_stock`. [#1521](https://github.com/vuestorefront/magento2/pull/1521/files) + +### Patch Changes + +- 6672edfb: [CHANGED] Update TSDocs of API methods. Now, they contain examples of usage. + ## 3.0.0 ### Major Changes diff --git a/packages/api-client/package.json b/packages/api-client/package.json index 1abfeb509..01d08536d 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-api", - "version": "3.0.0", + "version": "3.1.0", "sideEffects": false, "homepage": "https://github.com/vuestorefront/magento2", "bugs": { diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 2b631b5dc..71589d8f1 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,44 @@ # @vue-storefront/magento-sdk +## 2.3.2 + +### Patch Changes + +- 6672edfb: [CHANGED] `magentoModule` has been deprecated. Use `middlewareModule` from `@vue-storefront/sdk` package instead. + + ```diff + - import { initSDK, buildModule } from '@vue-storefront/sdk'; + - import { magentoModule } from '@vsf-enterprise/magento-sdk' + + import { initSDK, buildModule, middlewareModule } from '@vue-storefront/sdk'; + + import { Endpoints as MagentoEndpoints } from '@vsf-enterprise/sapcc-api'; // In Alokai Storefront you should import it from `storefront-middleware/types.ts` + + const sdkConfig = { + magento: + buildModule( + - magentoModule, + + middlewareModule, + { apiUrl: 'http://localhost:8181/magento' } + ) + }; + ``` + + Updating your `magentoModule` to this version should not disrupt your existing code; however, switching to `middlewareModule` will require certain modifications. + + To migrate: + + - Use custom query as a second argument of `middlewareModule` function. + + ```diff + const customQuery = { + cart: 'cart-custom-query', + metadata: { + fields: 'id items { uid }' + } + }; + - const cart = await sdk.magento.cart({ cartId: '123'}, { customQuery }); + + const cart = await sdk.magento.cart({ cartId: '123'}, customQuery); + ``` + ## 2.3.1 ### Patch Changes diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 77b742dde..794f85810 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@vue-storefront/magento-sdk", - "version": "2.3.1", + "version": "2.3.2", "main": "lib/index.cjs.js", "module": "lib/index.es.js", "types": "lib/index.d.ts", @@ -26,7 +26,7 @@ "@vue-storefront/magento-types": "^1.2.0" }, "devDependencies": { - "@vue-storefront/magento-api": "^3.0.0", + "@vue-storefront/magento-api": "^3.1.0", "nock": "^13.2.9", "@types/node": "^12.12.14" },