Skip to content

Commit bb44dd6

Browse files
merged from upstream
2 parents da91949 + 49931c7 commit bb44dd6

File tree

116 files changed

+3217
-1567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+3217
-1567
lines changed

.github/workflows/publish-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: |
2323
BASE_VERSION=$(node -p "require('./package.json').version.split('-')[0]")
2424
DATE=$(date -u +%Y%m%d%H%M%S)
25-
NEW_VERSION="$BASE_VERSION-nightly-$DATE"
25+
NEW_VERSION="$BASE_VERSION-unstable-$DATE"
2626
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
2727
npm version --no-git-tag-version "$NEW_VERSION"
2828
- run: yarn run renderTemplates

CHANGELOG.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,45 @@
11
# CHANGELOG
22

3-
## v4.1.0
3+
## v4.2.0
44

5-
### Enchancements
5+
### API Versions
6+
7+
New APIs:
8+
- Shopper Configurations
9+
10+
| API Name | API Version |
11+
|----------|-------------|
12+
| shopper-baskets | 1.9.1 |
13+
| shopper-baskets | 2.1.1 |
14+
| shopper-configurations | 1.0.0 |
15+
| shopper-consents | 1.1.2 |
16+
| shopper-context | 1.1.2 |
17+
| shopper-customers | 1.1.2 |
18+
| shopper-experience | 1.0.9 |
19+
| shopper-gift-certificates | 1.0.27 |
20+
| shopper-login | 1.40.0 |
21+
| shopper-orders | 1.5.1 |
22+
| shopper-products | 1.0.39 |
23+
| shopper-promotions | 1.0.37 |
24+
| shopper-search | 1.5.1 |
25+
| shopper-seo | 1.0.14 |
26+
| shopper-stores | 1.0.18 |
27+
28+
## v4.1.0 (DEPRECATED)
29+
30+
### Enhancements
631

732
- Use native node fetch available in node 18+ instead of `node-fetch` polyfill [#214](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/214)
833
- Support subpath imports for individual APIs and named imports [#219](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/219)
934
- Add importer utility for dynamic imports [#236](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/236)
1035

36+
NOTE: This release is deprecated. The features introduced in v4.1.0 were experimental and were removed in v4.2.0
37+
38+
## v4.0.1
39+
40+
### Bug Fixes
41+
- Fix incorrect encoding of multi-segment endpoint paths in `callCustomEndpoint` [#246](https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pull/246)
42+
1143
## v4.0.0
1244

1345
### API Versions
@@ -39,6 +71,9 @@
3971
- Remove API version from client config
4072
- Use `ShopperBasketsV2` API class to use V2 of Shopper Baskets
4173

74+
**NOTE: The Shopper-Consents API is experimental and will not be available for consumption until October 21st, 2025.
75+
DO NOT use Shopper-Consents API in production, this api might be subject to change.**
76+
4277
## v3.4.0
4378

4479
### API Changes

README.md

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,7 @@ yarn install commerce-sdk-isomorphic
6565
### Usage
6666

6767
```javascript
68-
import ocapi from 'commerce-sdk-isomorphic';
69-
const { helpers, ShopperLogin, ShopperSearch } = ocapi;
70-
71-
// Named imports also work
72-
// import {helpers, ShopperLogin, ShopperSearch} from 'commerce-sdk-isomorphic';
73-
74-
// Alternatively, you can use subpath imports to import a single API at a time instead of the entire SDK
75-
// Useful for when you want a slimmer bundle size and only need a single API
76-
// import * as helpers from 'commerce-sdk-isomorphic/helpers'
77-
// import { ShopperProducts } from 'commerce-sdk-isomorphic/shopperProducts';
78-
// import { ShopperSearch } from 'commerce-sdk-isomorphic/shopperSearch';
68+
import {helpers, ShopperLogin, ShopperSearch} from 'commerce-sdk-isomorphic';
7969

8070
const config = {
8171
// SCAPI does not support CORS, so client side requests must use a reverse proxy.
@@ -103,52 +93,6 @@ const searchResult = await shopperSearch.productSearch({
10393
});
10494
```
10595

106-
#### Import Strategies
107-
108-
The SDK supports multiple import patterns to accommodate different use cases:
109-
110-
**Default Import (Full SDK)**
111-
```javascript
112-
import ocapi from 'commerce-sdk-isomorphic';
113-
const { helpers, ShopperLogin, ShopperSearch } = ocapi;
114-
```
115-
116-
**Named Imports (Full SDK)**
117-
```javascript
118-
import { helpers, ShopperLogin, ShopperSearch } from 'commerce-sdk-isomorphic';
119-
```
120-
121-
**Subpath Imports (Individual APIs and Common dependencies)**
122-
123-
*ESM (ES Modules):*
124-
```javascript
125-
import { ShopperLogin } from 'commerce-sdk-isomorphic/shopperLogin';
126-
import * as helpers from 'commerce-sdk-isomorphic/helpers';
127-
```
128-
129-
*CommonJS:*
130-
```javascript
131-
const { ShopperLogin } = require('commerce-sdk-isomorphic/shopperLogin');
132-
const helpers = require('commerce-sdk-isomorphic/helpers');
133-
```
134-
135-
#### Choosing the Right Import Strategy
136-
137-
**Use Default/Named Imports when:**
138-
- You need multiple APIs from the SDK
139-
- You want the smallest overall bundle size for comprehensive usage
140-
- The entire SDK is optimized and maximally compressed as a single bundle
141-
142-
**Note:** Default and named imports load the entire SDK, including all APIs, helpers, and dependencies.
143-
144-
**Use Subpath Imports when:**
145-
- You only need specific APIs
146-
- You want to minimize initial bundle size
147-
- You're implementing dynamic loading for better page performance
148-
- You need granular control over which APIs are loaded
149-
150-
**Note:** While subpath imports reduce initial bundle size, using them for all APIs will result in a larger total bundle size due to duplicated dependencies required for standalone operation.
151-
15296
#### Fetch Options
15397

15498
You can configure how the SDK makes requests using the `fetchOptions` parameter. It is passed to [node-fetch](https://github.com/node-fetch/node-fetch/1#api) on the server and [whatwg-fetch](https://github.github.io/fetch/) on browser.

apis/shopper-baskets-oas-1.9.0/.metadata.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

apis/shopper-baskets-oas-1.9.0/exchange.json renamed to apis/shopper-baskets-oas-1.9.1/exchange.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Shopper Baskets OAS",
44
"groupId": "893f605e-10e2-423a-bdb4-f952f56eb6d8",
55
"assetId": "shopper-baskets-oas",
6-
"version": "1.9.0",
6+
"version": "1.9.1",
77
"classifier": "oas",
88
"tags": [],
99
"descriptorVersion": "1.0.0",

apis/shopper-baskets-oas-1.9.0/shopper-baskets-oas-v1-public.yaml renamed to apis/shopper-baskets-oas-1.9.1/shopper-baskets-oas-v1-public.yaml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
openapi: 3.0.3
22
info:
3+
x-api-type: Shopper
4+
x-api-family: Checkout
35
title: Shopper Baskets
4-
version: v1
6+
version: 1.9.1
57
description: |-
8+
[Download API specification](https://developer.salesforce.com/static/commercecloud/commerce-api/shopper-baskets/shopper-baskets-oas-v1-public.yaml)
9+
610
# API Overview
711
812
Use the Shopper Baskets API to create a basket in the B2C Commerce system and populate it with all the data required to ready the basket for checkout.
@@ -161,6 +165,8 @@ paths:
161165
description: Thrown if the shipment with the given shipment ID is unknown.
162166
content:
163167
application/problem+json:
168+
schema:
169+
$ref: '#/components/schemas/ErrorResponse'
164170
examples:
165171
ShipmentNotFound:
166172
$ref: '#/components/examples/ShipmentNotFound'
@@ -184,30 +190,37 @@ paths:
184190
description: |-
185191
Transfer the previous shopper's basket to the current shopper by updating the basket's owner. No other values change. You must obtain the shopper authorization token via SLAS and you must provide the ‘guest usid‘ in both the ‘/oauth2/login‘ and ‘/oauth2/token‘ calls while fetching the registered user JWT token.
186192
187-
A success response contains the transferred basket.
193+
This endpoint provides different methods for handling the scenario in which both a previous guest shopper and the current registered shopper have an active basket attached, and utilizes the `merge` parameter as follows:
194+
- `true` (recommended): Triggers a merge hook for graceful handling and prevents 409 status returns. For more information, refer to the `merge` parameter documentation.
195+
- `false`: Either overrides the basket of the current registered shopper or returns a 409 response, and allows you to choose between the options explained below.
188196
189-
If the current shopper has an active basket, and the `overrideExisting` request parameter is `false`, then the transfer request returns a BasketTransferException (HTTP status 409). You can proceed with one of these options:
197+
If you call the endpoint with `merge=false` and the current shopper has an active basket, you have two options using the `overrideExisting` parameter. Setting it to `true` deletes the registered user's basket, while setting it to `false` returns a `BasketTransferException` (HTTP status 409), after which you can choose how to proceed:
190198
- Keep the current shopper's active basket.
191-
- Merge the previous and current shoppers' baskets by calling the `baskets/merge` endpoint.
192-
- Force the transfer by calling the `baskets/transfer` endpoint again, with the parameter `overrideExisting=true`. Forcing the transfer deletes the current shopper's active basket.
199+
- Merge the previous and current shoppers' baskets by calling the `baskets/actions/merge` endpoint.
200+
- Force the transfer by calling the `baskets/actions/transfer` endpoint again, with the parameter `overrideExisting=true`. Forcing the transfer deletes the current shopper's active basket.
201+
202+
A successful response provides the transferred (and merged) current basket. However, if neither the previous nor current shopper had an active basket, a 204 (No Content) response is returned.
193203
operationId: transferBasket
194204
summary: Transfer an existing basket.
195205
security:
196206
- ShopperToken:
197207
- sfcc.shopper-baskets-orders.rw
198208
parameters:
199209
- $ref: '#/components/parameters/overrideExisting'
210+
- $ref: '#/components/parameters/merge'
200211
- $ref: '#/components/parameters/locale'
201212
responses:
202213
'200':
203-
description: The transferred basket.
214+
description: The current basket.
204215
content:
205216
application/json:
206217
schema:
207218
$ref: '#/components/schemas/Basket'
208219
examples:
209220
BasketPost:
210221
$ref: '#/components/examples/examples-BasketPost'
222+
'204':
223+
description: The operation was successful. No current basket was returned because neither the previous nor current shopper had an active basket attached that could be transferred.
211224
'403':
212225
description: The call returns this error if no SLAS token for a registered shopper is available.
213226
content:
@@ -219,9 +232,9 @@ paths:
219232
$ref: '#/components/examples/ForbiddenMissingPrevCustomerInfo'
220233
'409':
221234
description: |-
222-
The call returns this response in either of these cases:
235+
The call returns this response when the `merge` request parameter is set to `false` and one of the following cases applies:
223236
- The previous shopper has no active basket.
224-
- The current shopper has an active basket and the `overrideExisting` query parameter was `false` (default value).
237+
- The current shopper has an active basket and the `overrideExisting` query parameter is set to `false` (default value).
225238
content:
226239
application/json:
227240
schema:
@@ -239,6 +252,8 @@ paths:
239252
operationId: mergeBasket
240253
summary: Merge baskets.
241254
description: |-
255+
( DEPRECATED ) Instead of using this endpoint, we recommend using the `/baskets/actions/transfer` endpoint with the `merge=true` parameter, because the transfer endpoint offers greater customization by invoking a hook, allowing for adjustments if the default implementation does not process the merge as expected.
256+
242257
Merge data from the previous shopper's basket into the current shopper's active basket and delete the previous shopper's basket. This endpoint doesn't merge Personally Identifiable Information (PII). You must obtain the shopper authorization token via SLAS and you must provide the ‘guest usid‘ in both the ‘/oauth2/login‘ and ‘/oauth2/token‘ calls while fetching the registered user JWT token. After the merge, all basket amounts are recalculated and totaled, including lookups for prices, taxes, shipping, and promotions, unless hooks are enabled.
243258
244259
The following information is merged:
@@ -3901,6 +3916,14 @@ components:
39013916
default: false
39023917
type: boolean
39033918
example: false
3919+
merge:
3920+
name: merge
3921+
in: query
3922+
description: "This parameter controls the behavior:\n - `false` (default): Transfers the basket or returns a 409 response with the appropriate message (taking `overrideExisting` in consideration).\n - `true`: (recommended): Executes the dw.order.mergeBasket hook if at least one basket exists.\n\nThe hook dw.order.mergeBasket default implementation merges a source basket into the current basket. This behavior can be customized, as shown \nin this [sample implementation](https://gist.github.com/sf-thomas-loesche/3446c7d71a97e559bf1caee96ae56d9f).\n\nThere are four possible use cases:\n\na) Guest basket and registered basket exist\nThe guest basket becomes the current basket for the registered shopper by updating the basket's owner (no personal data is removed). The hook \ndw.order.mergeBasket is called with the source basket (former registered shopper basket) and the transferred current basket (former guest basket).\n\nb) Guest basket exists but no registered basket exists\nThe guest basket becomes the current basket for the registered shopper by updating the basket's owner (no personal data is removed). The hook \ndw.order.mergeBasket is called without the source basket (null passed to the hook) and the transferred current basket (former guest basket).\n\nc) No guest basket exists but a registered basket exists\nThe registered basket is retained. The hook dw.order.mergeBasket is called with the retained current basket but without the source basket (null \npassed to the hook).\n\nd) Neither basket exists\nThe hook dw.order.mergeBasket is not called.\n\nThe API returns the current basket (after executing dw.order.mergeBasket)."
3923+
schema:
3924+
default: false
3925+
type: boolean
3926+
example: false
39043927
createDestinationBasket:
39053928
name: createDestinationBasket
39063929
in: query

apis/shopper-baskets-oas-2.1.0/.metadata.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

apis/shopper-baskets-oas-2.1.0/exchange.json renamed to apis/shopper-baskets-oas-2.1.1/exchange.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Shopper Baskets OAS",
44
"groupId": "893f605e-10e2-423a-bdb4-f952f56eb6d8",
55
"assetId": "shopper-baskets-oas",
6-
"version": "2.1.0",
6+
"version": "2.1.1",
77
"classifier": "oas",
88
"tags": [],
99
"descriptorVersion": "1.0.0",

0 commit comments

Comments
 (0)