Skip to content

Commit 6d3a9bc

Browse files
committed
add v4 migration guide
1 parent f86497e commit 6d3a9bc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ An auto-generated [documentation site](https://salesforcecommercecloud.github.io
2222
**NOTES:**
2323

2424
1. **Type Access**: API class types are accessible through the `<api_class>Types` namespace (e.g., `ShopperProductsTypes`). Individual types can be accessed as `ShopperProductsTypes.Product`.
25-
2625
2. **Type References**: The `References` section under API classes in the generated documentation may show duplicate entries. This occurs because types are exported both at their original definition and under the API class namespace. Both references point to the same underlying type definition.
26+
3. **V4 Migration Guide**: Starting in v5, API classes will no longer be exported under API family namespaces. See the [Sample Code](#sample-code) section for migration examples.
2727

2828
## :warning: Planned API Changes :warning:
2929

@@ -87,6 +87,11 @@ To use an SDK client, instantiate an object of that client and configure these p
8787
// tsc requires the --esModuleInterop flag for this
8888
// Starting in v5, API classes will no longer be namespaced under API family
8989
import { ShopperSearch, ShopperLogin, helpers, slasHelpers } from "commerce-sdk";
90+
// For v4 and below, you'll have to import the API family first
91+
// import { Search, Customer, helpers, slasHelpers } from "commerce-sdk";
92+
// const loginClient = new Customer.ShopperLogin(config);
93+
// const searchClient = new Search.ShopperSearch(config);
94+
9095
// Older Node.js versions can instead use:
9196
// const { ClientConfig, helpers, slasHelpers Search } = require("commerce-sdk");
9297

@@ -130,7 +135,7 @@ async function getGuestUserAuthToken(): Promise<ShopperLoginTypes.TokenResponse>
130135

131136
// Alternatively you may use the SLAS helper functions to generate JWT/access token
132137
const guestTokenResponse = await slasHelpers.loginGuestUser(
133-
new Customer.ShopperLogin(config),
138+
new ShopperLogin(config),
134139
{ redirectURI: 'http://localhost:3000/callback' }
135140
)
136141
.then((guestTokenResponse) => {

0 commit comments

Comments
 (0)