@elasticpath/js-sdk 0.0.0-semantic-release → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,39 +2,45 @@
2
2
 
3
3
  # Elastic Path Commerce Cloud JavaScript SDK
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@elasticpath/sdk.svg)](https://www.npmjs.com/package/@elasticpath/sdk)
5
+ [![npm version](https://img.shields.io/npm/v/@elasticpath/js-sdk.svg)](https://www.npmjs.com/package/@elasticpath/js-sdk)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/elasticpath/js-sdk/issues)
8
8
  [![follow on Twitter](https://img.shields.io/twitter/follow/elasticpath?style=social&logo=twitter)](https://twitter.com/intent/follow?screen_name=elasticpath)
9
9
 
10
- > A simple to use API interface to help get you off the ground quickly and efficiently with your Elastic Path Commerce Cloud JavaScript apps.
10
+ > [!IMPORTANT]
11
+ > This repository has been migrated from [@moltin/sdk](https://www.npmjs.com/package/@moltin/sdk). If you are a previous user of the Moltin SDK, read our [guide](MIGRATION_GUIDE.md) to learn more about migrating your implementation to this codebase
12
+
13
+ A simple to use API interface to help get you off the ground quickly and efficiently with your Elastic Path Commerce Cloud JavaScript apps.
11
14
 
12
15
  📚 [API reference](https://documentation.elasticpath.com/commerce-cloud/docs/developer/get-started/sdk.html#officially-supported-sdk) — 📚 [Elastic Path Commerce Cloud](https://www.elasticpath.com)
13
16
 
14
17
  ## 🛠 Installation
15
18
 
16
- Install the package from [npm](https://www.npmjs.com/package/@elasticpath/sdk) and import in your project.
19
+ Install the package from [npm](https://www.npmjs.com/package/@elasticpath/js-sdk) and import in your project.
17
20
 
18
21
  ```bash
19
- npm install --save @elasticpath/sdk
22
+ npm install --save @elasticpath/js-sdk
20
23
  ```
21
24
 
22
25
  ## ⛽️ Usage
23
26
 
24
- To get started, instantiate a new ElasticPath client with your store credentials.
27
+ To get started, instantiate a new Elastic Path client with your store credentials.
28
+
29
+
30
+ > [!NOTE]
31
+ > This requires an [Elastic Path Commerce Cloud](https://www.elasticpath.com) account. You can sign up for a free trial [here](https://cm.elasticpath.com/free-trial)
25
32
 
26
- > **Note:** This requires an [Elastic Path Commerce Cloud](https://www.elasticpath.com) account.
27
33
 
28
34
  ```js
29
35
  // JavaScript
30
- import { gateway as ElasticPathGateway } from '@elasticpath/sdk'
36
+ import { gateway as ElasticPathGateway } from '@elasticpath/js-sdk'
31
37
 
32
38
  const ElasticPath = ElasticPathGateway({
33
39
  client_id: 'XXX'
34
40
  })
35
41
 
36
42
  // Node.js
37
- const ElasticPathGateway = require('@elasticpath/sdk').gateway
43
+ const ElasticPathGateway = require('@elasticpath/js-sdk').gateway
38
44
 
39
45
  const ElasticPath = ElasticPathGateway({
40
46
  client_id: 'XXX',
@@ -45,7 +51,7 @@ const ElasticPath = ElasticPathGateway({
45
51
  Alternatively you can include the `UMD` bundle via [UNPKG](https://unpkg.com) like so:
46
52
 
47
53
  ``` html
48
- <script src="https://unpkg.com/@elasticpath/sdk"></script>
54
+ <script src="https://unpkg.com/@elasticpath/js-sdk"></script>
49
55
 
50
56
  <script>
51
57
  const ElasticPath = elasticpath.gateway({
@@ -88,7 +94,7 @@ const ElasticPath = ElasticPathGateway({
88
94
  By default the Elastic Path Commerce Cloud SDK persists data to `window.localStorage` in the browser and `node-localstorage` in Node. If this doesn't suit your needs you can override the default storage with a `MemoryStorageFactory` which will persist data for the life cycle of the JavaScript VM:
89
95
 
90
96
  ```js
91
- import { gateway as ElasticPathGateway, MemoryStorageFactory } from '@elasticpath/sdk'
97
+ import { gateway as ElasticPathGateway, MemoryStorageFactory } from '@elasticpath/js-sdk'
92
98
 
93
99
  const ElasticPath = ElasticPathGateway({
94
100
  client_id: 'XXX',
@@ -113,7 +119,7 @@ You can support multiple gateways with a `name` property when initializing the g
113
119
  `name` should be unique to avoid sharing storage keys with the other gateways of the same name.
114
120
 
115
121
  ```js
116
- import { gateway as EPCCGateway } from "@elasticpath/sdk"
122
+ import { gateway as EPCCGateway } from "@elasticpath/js-sdk"
117
123
 
118
124
  const gatewayOne = EPCCGateway({
119
125
  name: "my-first-gateway",
@@ -140,8 +146,8 @@ You can pass them into the config used by the gateway like this:
140
146
 
141
147
  ``` TypeScript
142
148
  // JavaScript
143
- import { gateway as ElasticPathGateway } from '@elasticpath/sdk'
144
- // const ElasticPathGateway = require('@elasticpath/sdk').gateway -> for Node
149
+ import { gateway as ElasticPathGateway } from '@elasticpath/js-sdk'
150
+ // const ElasticPathGateway = require('@elasticpath/js-sdk').gateway -> for Node
145
151
 
146
152
  const ElasticPath = ElasticPathGateway({
147
153
  client_id: 'XXX',
@@ -228,7 +234,7 @@ The Elastic Path Commerce Cloud JavaScript SDK is fully supported in Typescript.
228
234
  Imported module will contain all interfaces needed to consume backend services. i.e:
229
235
 
230
236
  ```TypeScript
231
- import * as elasticpath from '@elasticpath/sdk';
237
+ import * as elasticpath from '@elasticpath/js-sdk';
232
238
 
233
239
  const product: elasticpath.ProductBase = {...}
234
240
  ```
@@ -246,7 +252,7 @@ const product: Product = {...}
246
252
  Here is an example of a simple product creation:
247
253
 
248
254
  ```TypeScript
249
- import { ElasticPath, gateway, ProductBase, Resource } from '@elasticpath/sdk';
255
+ import { ElasticPath, gateway, ProductBase, Resource } from '@elasticpath/js-sdk';
250
256
 
251
257
  async function main() {
252
258
  const g: ElasticPath = gateway({client_id, client_secret});
@@ -274,14 +280,14 @@ async function main() {
274
280
  }
275
281
  ```
276
282
 
277
- You can also extend any base interface compatible with flows to create any custom interfaces that you might be using by re-declaring `@elasticpath/sdk` module. Following example adds several properties to `ProductsBase` interface that correspond to flows added to the backend.
283
+ You can also extend any base interface compatible with flows to create any custom interfaces that you might be using by re-declaring `@elasticpath/js-sdk` module. Following example adds several properties to `ProductsBase` interface that correspond to flows added to the backend.
278
284
 
279
285
  In your project add a definition file (with a `.d.ts` extension) with a following code:
280
286
 
281
287
  ```TypeScript
282
- import * as elasticpath from '@elasticpath/sdk';
288
+ import * as elasticpath from '@elasticpath/js-sdk';
283
289
 
284
- declare module '@elasticpath/sdk' {
290
+ declare module '@elasticpath/js-sdk' {
285
291
 
286
292
  interface Weight {
287
293
  g: number;