magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

`@vue-storefront/magento-sdk` is deprecated

Open NyllRE opened this issue 1 year ago • 0 comments

Whenever I try to use the magento sdk it keeps saying that it's deprecated and to use the vsf-enterprise module or magento2-sdk, the thing is the magento2-sdk doesn't even exist and the @vsf-enterprise module just isn't available. this is a very big breaking issue and it's stopping my process. this is the message that comes when hovering on the function:

image

@deprecated Use middlewareModule instead.

- 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/magento-api';
const sdkConfig = {
  magneto:
    buildModule(
-      magentoModule,
+      middlewareModule<MagentoEndpoints>,
      { apiUrl: 'http://localhost:8181/magneto' }
    )
};

export const sdk = initSDK(sdkConfig);

// Breaking changes: // - Custom queries are now a second argument of the methods.

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);

@example Initialization of the Magento module.

import { initSDK, buildModule } from '@vue-storefront/sdk';
import { magentoModule, MagentoModuleType } from '@vue-storefront/magento2-sdk'

const sdkConfig = {
  magento:
    buildModule(
      magentoModule,
      {
        apiUrl: 'http://localhost:8181/magento',
      }
    )
};

export const sdk = initSDK<typeof sdkConfig>(sdkConfig);

NyllRE avatar Dec 16 '24 14:12 NyllRE