-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add TSDocs focused on SDK usage and deprecate magentoModule (…
…#1519) * refactor: prepare migration to middlewareModule * chore: deprecate magentoModule * docs: document usage of middlewareModule with Magento 2 integration (#1520) * docs: document usage of middlewareModule with Magento 2 integration * Update docs/content/2.getting-started/3.supported-features.md Co-authored-by: Matt Maribojoc <[email protected]> --------- Co-authored-by: Matt Maribojoc <[email protected]> --------- Co-authored-by: Matt Maribojoc <[email protected]>
- Loading branch information
1 parent
8138228
commit 6672edf
Showing
79 changed files
with
3,431 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
"@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<MagentoEndpoints>, | ||
{ 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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@vue-storefront/magento-api": patch | ||
--- | ||
|
||
[CHANGED] Update TSDocs of API methods. Now, they contain examples of usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.