The Elastic Path Commerce Cloud JavaScript SDK has been migrated from @moltin/sdk to @elasticpath/js-sdk. This was an overdue change, and will allow us to consolidate our version control usage behind the @elasticpath namespace.
We are also taking this opportunity to entirely remove legacy naming (moltin) from the codebase to avoid confusion.
- Package Name: The package name has changed from
@moltin/sdkto@elasticpath/js-sdk. - GitHub Repository: The GitHub repository has moved from
moltin/js-sdktoelasticpath/js-sdk.
Note
We are aligning the package name with the repository name, i.e. js-sdk, rather than just sdk. We are reserving the sdk name for future use.
npm install --save @moltin/sdkReplace the old package with the new one:
npm install --save @elasticpath/js-sdkimport { gateway as MoltinGateway } from '@moltin/sdk'
const Moltin = MoltinGateway({
client_id: 'XXX'
})import { gateway as ElasticPathGateway } from '@elasticpath/js-sdk'
const ElasticPath = ElasticPathGateway({
client_id: 'XXX'
})- Change the import path: Update all occurrences of
@moltin/sdkto@elasticpath/js-sdk. - Rename the import alias: If you are using
MoltinGateway, change it toElasticPathGateway(or a name of your choice). - Update instance names: Rename any instances of
MoltintoElasticPathto maintain consistency and clarity in your codebase.
If you are directly accessing any of the state the SDK persists in localStorage or cookies, update your references like so:
- mcart becomes epcart
- mcurrency becomes epcurrency
- moltinCredentials becomes epCredentials
Caution
Accessing this SDK state directly is not recommended
The compiled SDK and types published in /dist as moltin.cjs.js, moltin.d.ts, moltin.esm.js, and moltin.js are now published as index