commerce-sdk-isomorphic 1.10.3 → 1.11.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/CHANGELOG.md +14 -0
- package/README.md +31 -12
- package/lib/index.cjs.d.ts +1082 -40
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.d.ts +1082 -40
- package/lib/index.esm.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v1.11.0
|
|
4
|
+
|
|
5
|
+
#### Enhancements
|
|
6
|
+
|
|
7
|
+
* Add support for Shopper Login (SLAS) prviate client with helper functions [#148](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/140)
|
|
8
|
+
* ⚠️ WARNING ⚠️: Users should be extremely cautious about using the SLAS private client helper functions in the browser as it can expose your client secret
|
|
9
|
+
* Add support for custom query parameters [#139](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/139)
|
|
10
|
+
|
|
11
|
+
## v1.10.4
|
|
12
|
+
|
|
13
|
+
#### Bug fixes
|
|
14
|
+
|
|
15
|
+
- Mark `expand` query parameter for `getProduct` endpoint as optional instead of required
|
|
16
|
+
|
|
3
17
|
## v1.10.3
|
|
4
18
|
|
|
5
19
|
#### Bug fixes
|
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# commerce-sdk-isomorphic
|
|
2
2
|
|
|
3
|
-
[![CircleCI][circleci-image]][circleci-url]
|
|
4
|
-
|
|
5
3
|
The Salesforce Commerce SDK (Isomorphic) allows easy interaction with the B2C Commerce platform’s Shopper APIs on the Node.js runtime and works both in browsers and Node applications. For a Node-based SDK that can access the Admin APIs in addition to the Shopper APIs, see the main [Commerce SDK](https://github.com/SalesforceCommerceCloud/commerce-sdk).
|
|
6
4
|
|
|
7
5
|
## Getting Started
|
|
8
6
|
|
|
9
7
|
### Requirements
|
|
10
8
|
|
|
11
|
-
- Node `^12.x`, `^14.x`, or `^
|
|
9
|
+
- Node `^12.x`, `^14.x`, `^16.x`, `^18.x` or `^20.x`
|
|
10
|
+
|
|
12
11
|
|
|
13
12
|
### Installation
|
|
14
13
|
|
|
@@ -30,6 +29,7 @@ npm install commerce-sdk-isomorphic
|
|
|
30
29
|
|
|
31
30
|
### Configure the Isomorphic SDK
|
|
32
31
|
|
|
32
|
+
|
|
33
33
|
```javascript
|
|
34
34
|
/**
|
|
35
35
|
* Configure required parameters
|
|
@@ -58,6 +58,14 @@ const {access_token, refresh_token} = await helpers.loginGuestUser(
|
|
|
58
58
|
{redirectURI: `${config.proxy}/callback`} // Callback URL must be configured in SLAS Admin
|
|
59
59
|
);
|
|
60
60
|
|
|
61
|
+
// Execute Private Client OAuth with PKCE to acquire guest tokens
|
|
62
|
+
// ***WARNING*** Be cautious about using this function in the browser as you may end up exposing your client secret
|
|
63
|
+
// only use it when you know your slas client secret is secured
|
|
64
|
+
// const {access_token, refresh_token} = await helpers.loginGuestUserPrivate(
|
|
65
|
+
// shopperLogin,
|
|
66
|
+
// {}, {clientSecret: '<your-slas-client-secret>'}
|
|
67
|
+
// );
|
|
68
|
+
|
|
61
69
|
const shopperSearch = new ShopperSearch({
|
|
62
70
|
...config,
|
|
63
71
|
headers: {authorization: `Bearer ${access_token}`},
|
|
@@ -111,17 +119,28 @@ _headers:_ A collection of key/value string pairs representing additional header
|
|
|
111
119
|
|
|
112
120
|
_throwOnBadResponse:_ Default value is false. When set to true, the SDK throws an Error on responses with statuses that are not 2xx or 304.
|
|
113
121
|
|
|
114
|
-
### Public Client Shopper Login helpers
|
|
122
|
+
### Public/Private Client Shopper Login (SLAS) helpers
|
|
115
123
|
|
|
116
|
-
A collection of helper functions are available in this SDK to simplify [Public
|
|
117
|
-
Client Shopper Login OAuth
|
|
118
|
-
flows](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login:Summary). See sample code above for guest login.
|
|
124
|
+
A collection of helper functions are available in this SDK to simplify [Public/Private Client Shopper Login OAuth flows](https://developer.salesforce.com/docs/commerce/commerce-api/references?meta=shopper-login:Summary). See sample code above for guest login.
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
**⚠️ WARNING ⚠️**
|
|
127
|
+
Users should be extremely cautious about using the SLAS private client helper functions in the browser as it can expose your client secret. Ensure that your client secret is secured before running the function client side.
|
|
121
128
|
|
|
122
|
-
|
|
129
|
+
### Custom Query Parameters
|
|
123
130
|
|
|
124
|
-
|
|
131
|
+
With the introduction of [hooks for Commerce APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html), customers can pass custom query parameters through the SDK to be used in their custom hook. Custom query parameters must begin with `c_`:
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
133
|
+
```javascript
|
|
134
|
+
const searchResult = await shopperSearch.productSearch({
|
|
135
|
+
parameters: {
|
|
136
|
+
q: 'shirt',
|
|
137
|
+
c_paramkey: '<param-value>'
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Invalid query parameters that are not a part of the API and do not follow the `c_` custom query parameter convention will be filtered from the request and a warning will be displayed.
|
|
143
|
+
|
|
144
|
+
## License Information
|
|
145
|
+
|
|
146
|
+
The Commerce SDK Isomorphic is licensed under BSD-3-Clause license. See the [license](./LICENSE.txt) for details.
|