commerce-sdk-isomorphic 1.13.1 → 2.1.0-dev.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 +31 -0
- package/README.md +77 -0
- package/lib/index.cjs.d.ts +4683 -894
- package/lib/index.cjs.js +1 -1
- package/lib/index.esm.d.ts +4683 -894
- package/lib/index.esm.js +1 -1
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v2.0.0
|
|
4
|
+
|
|
5
|
+
#### API Changes
|
|
6
|
+
|
|
7
|
+
*Shopper Stores*
|
|
8
|
+
|
|
9
|
+
* API Added
|
|
10
|
+
|
|
11
|
+
*Shopper Orders*
|
|
12
|
+
|
|
13
|
+
* New endpoint added
|
|
14
|
+
|
|
15
|
+
| **Endpoint Name** | **Description** |
|
|
16
|
+
| ------------- |-------------|
|
|
17
|
+
| guestOrderLookup | Lookup a guest order |
|
|
18
|
+
|
|
19
|
+
*Shopper Customers*
|
|
20
|
+
|
|
21
|
+
- Removal of deprecated endpoints:
|
|
22
|
+
- `invalidateCustomerAuth`
|
|
23
|
+
- `authorizeCustomer`
|
|
24
|
+
- `authorizeTrustedSystem`
|
|
25
|
+
|
|
26
|
+
#### Enchancements
|
|
27
|
+
|
|
28
|
+
- Add helper function `callCustomEndpoint` to call [Custom APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/custom-apis.html) - [#149](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/149)
|
|
29
|
+
|
|
30
|
+
#### Bug fixes
|
|
31
|
+
|
|
32
|
+
- Fixed createCodeVerifier adding entropy to be successfully indexed by Google Search Console [#150](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/150)
|
|
33
|
+
|
|
3
34
|
## v1.13.1
|
|
4
35
|
|
|
5
36
|
#### Bug fixes
|
package/README.md
CHANGED
|
@@ -141,6 +141,83 @@ const searchResult = await shopperSearch.productSearch({
|
|
|
141
141
|
|
|
142
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
143
|
|
|
144
|
+
### Custom APIs
|
|
145
|
+
|
|
146
|
+
The SDK supports calling [custom APIs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/custom-apis.html) with a helper function, `callCustomEndpoint`.
|
|
147
|
+
|
|
148
|
+
Example usage:
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
import pkg from 'commerce-sdk-isomorphic';
|
|
152
|
+
const { helpers } = pkg;
|
|
153
|
+
|
|
154
|
+
const clientConfigExample = {
|
|
155
|
+
parameters: {
|
|
156
|
+
clientId: "<your-client-id>",
|
|
157
|
+
organizationId: "<your-org-id>",
|
|
158
|
+
shortCode: "<your-short-code>",
|
|
159
|
+
siteId: "<your-site-id>",
|
|
160
|
+
},
|
|
161
|
+
// If not provided, it'll use the default production URI:
|
|
162
|
+
// 'https://{shortCode}.api.commercecloud.salesforce.com/custom/{apiName}/{apiVersion}'
|
|
163
|
+
// path parameters should be wrapped in curly braces like the default production URI
|
|
164
|
+
baseUri: "<your-base-uri>"
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Required params: apiName, endpointPath, shortCode, organizaitonId
|
|
168
|
+
// Required path params can be passed into:
|
|
169
|
+
// options.customApiPathParameters or clientConfig.parameters
|
|
170
|
+
const customApiArgs = {
|
|
171
|
+
apiName: 'loyalty-info',
|
|
172
|
+
apiVersion: 'v1', // defaults to v1 if not provided
|
|
173
|
+
endpointPath: 'customers'
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const accessToken = '<INSERT ACCESS TOKEN HERE>';
|
|
177
|
+
|
|
178
|
+
let getResponse = await helpers.callCustomEndpoint({
|
|
179
|
+
options: {
|
|
180
|
+
method: 'GET',
|
|
181
|
+
parameters: {
|
|
182
|
+
queryParameter: 'queryParameter1',
|
|
183
|
+
},
|
|
184
|
+
headers: {
|
|
185
|
+
// Content-Type is defaulted to application/json if not provided
|
|
186
|
+
'Content-Type': 'application/json',
|
|
187
|
+
authorization: `Bearer ${access_token}`
|
|
188
|
+
},
|
|
189
|
+
customApiPathParameters: customApiArgs
|
|
190
|
+
},
|
|
191
|
+
clientConfig: clientConfigExample,
|
|
192
|
+
// Flag to retrieve raw response or data from helper function
|
|
193
|
+
rawResponse: false,
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
let postResponse = await helpers.callCustomEndpoint({
|
|
197
|
+
options: {
|
|
198
|
+
method: 'POST',
|
|
199
|
+
parameters: {
|
|
200
|
+
queryParameter: 'queryParameter1',
|
|
201
|
+
},
|
|
202
|
+
headers: {
|
|
203
|
+
authorization: `Bearer ${access_token}`
|
|
204
|
+
},
|
|
205
|
+
customApiPathParameters: customApiArgs,
|
|
206
|
+
body: JSON.stringify({ data: 'data' })
|
|
207
|
+
},
|
|
208
|
+
clientConfig: clientConfigExample,
|
|
209
|
+
// Flag to retrieve raw response or data from helper function
|
|
210
|
+
rawResponse: false,
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
console.log('get response: ', getResponse)
|
|
214
|
+
console.log('post response: ', postResponse)
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
For more documentation about this helper function, please refer to the [commerce-sdk-isomorphic docs](https://salesforcecommercecloud.github.io/commerce-sdk-isomorphic/modules/helpers.html).
|
|
218
|
+
|
|
219
|
+
For more information about custom APIs, please refer to the [Salesforce Developer Docs](https://developer.salesforce.com/docs/commerce/commerce-api/guide/custom-apis.html)
|
|
220
|
+
|
|
144
221
|
## License Information
|
|
145
222
|
|
|
146
223
|
The Commerce SDK Isomorphic is licensed under BSD-3-Clause license. See the [license](./LICENSE.txt) for details.
|