@salesforce/retail-react-app 8.0.0-dev → 8.0.0-nightly-20250828080201

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  - Add support for environment level base paths on /mobify routes [#2892](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2892)
3
3
  - Fix private client endpoint prop name [#3177](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3177)
4
4
  - This feature introduces an AI-powered shopping assistant that integrates Salesforce Embedded Messaging Service with PWA Kit applications. The shopper agent provides real-time chat support, search assistance, and personalized shopping guidance directly within the e-commerce experience. [#2658](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2658)
5
- - Added support for Multi-Ship [#3056](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3056)
5
+ - Added support for Multi-Ship [#3056](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3056) [#3199] (https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3199)
6
6
  - The feature toggle for partial hydration is now found in the config file (`config.app.partialHydrationEnabled`) [#3058](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3058)
7
7
  - Mask user not found messages to prevent user enumeration from passwordless login [#3113](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3113)
8
8
  - [Bugfix] Pin `@chakra-ui/react` version to 2.7.0 to avoid breaking changes from 2.10.9 [#2658](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2658)
@@ -143,8 +143,8 @@ export const useProductAddressAssignment = (basket) => {
143
143
  const shipment = existingShipments.find((s) => s.shipmentId === item.shipmentId)
144
144
 
145
145
  if (shipment && !isAddressEmpty(shipment.shippingAddress)) {
146
- const existingAddress = guestAddresses.find((addr) =>
147
- areAddressesEqual(addr, shipment.shippingAddress)
146
+ const existingAddress = [...guestAddresses, ...newGuestAddresses].find(
147
+ (addr) => areAddressesEqual(addr, shipment.shippingAddress)
148
148
  )
149
149
 
150
150
  if (existingAddress) {
@@ -249,6 +249,60 @@ describe('useProductAddressAssignment', () => {
249
249
 
250
250
  expect(result.current.availableAddresses).toHaveLength(initialAddressCount)
251
251
  })
252
+
253
+ test('should reuse same address for multiple items with identical shipping address', () => {
254
+ mockUseCurrentCustomer.mockReturnValue({
255
+ data: mockGuestCustomer,
256
+ isLoading: false
257
+ })
258
+
259
+ // Create a basket where both items are in the same shipment
260
+ const basketWithSameAddress = {
261
+ basketId: 'basket-1',
262
+ productItems: [
263
+ {itemId: 'item-1', productId: 'product-1', shipmentId: 'shipment-1'},
264
+ {itemId: 'item-2', productId: 'product-2', shipmentId: 'shipment-1'}
265
+ ],
266
+ shipments: [
267
+ {
268
+ shipmentId: 'shipment-1',
269
+ shippingMethod: {id: 'delivery-method-1'},
270
+ shippingAddress: {
271
+ firstName: 'John',
272
+ lastName: 'Doe',
273
+ address1: '123 Main St',
274
+ city: 'San Francisco',
275
+ stateCode: 'CA',
276
+ postalCode: '94105',
277
+ countryCode: 'US',
278
+ phone: '4155551234'
279
+ }
280
+ }
281
+ ]
282
+ }
283
+
284
+ const {result} = renderHook(() => useProductAddressAssignment(basketWithSameAddress))
285
+
286
+ // Should create only one address entry for both items
287
+ expect(result.current.availableAddresses).toHaveLength(1)
288
+
289
+ // Both items should reference the same address ID
290
+ const addressId1 = result.current.selectedAddresses['item-1']
291
+ const addressId2 = result.current.selectedAddresses['item-2']
292
+
293
+ expect(addressId1).toBeDefined()
294
+ expect(addressId2).toBeDefined()
295
+ expect(addressId1).toBe(addressId2)
296
+
297
+ // The address should match what was in the shipment
298
+ const address = result.current.availableAddresses[0]
299
+ expect(address.firstName).toBe('John')
300
+ expect(address.lastName).toBe('Doe')
301
+ expect(address.address1).toBe('123 Main St')
302
+
303
+ // All items should have addresses (button should be enabled)
304
+ expect(result.current.allItemsHaveAddresses).toBe(true)
305
+ })
252
306
  })
253
307
 
254
308
  describe('addGuestAddress', () => {
@@ -7,8 +7,7 @@
7
7
 
8
8
  import {
9
9
  cleanAddressForOrder,
10
- areAddressesEqual,
11
- isAddressEmpty
10
+ areAddressesEqual
12
11
  } from '@salesforce/retail-react-app/app/utils/address-utils'
13
12
  import {DEFAULT_SHIPMENT_ID} from '@salesforce/retail-react-app/app/constants'
14
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/retail-react-app",
3
- "version": "8.0.0-dev",
3
+ "version": "8.0.0-nightly-20250828080201",
4
4
  "license": "See license in LICENSE",
5
5
  "author": "cc-pwa-kit@salesforce.com",
6
6
  "ccExtensibility": {
@@ -46,10 +46,10 @@
46
46
  "@loadable/component": "^5.15.3",
47
47
  "@peculiar/webcrypto": "^1.4.2",
48
48
  "@salesforce/cc-datacloud-typescript": "1.1.2",
49
- "@salesforce/commerce-sdk-react": "4.0.0-dev",
50
- "@salesforce/pwa-kit-dev": "3.12.0-dev",
51
- "@salesforce/pwa-kit-react-sdk": "3.12.0-dev",
52
- "@salesforce/pwa-kit-runtime": "3.12.0-dev",
49
+ "@salesforce/commerce-sdk-react": "4.0.0-nightly-20250828080201",
50
+ "@salesforce/pwa-kit-dev": "3.12.0-nightly-20250828080201",
51
+ "@salesforce/pwa-kit-react-sdk": "3.12.0-nightly-20250828080201",
52
+ "@salesforce/pwa-kit-runtime": "3.12.0-nightly-20250828080201",
53
53
  "@tanstack/react-query": "^4.28.0",
54
54
  "@tanstack/react-query-devtools": "^4.29.1",
55
55
  "@testing-library/dom": "^9.0.1",
@@ -107,5 +107,5 @@
107
107
  "maxSize": "335 kB"
108
108
  }
109
109
  ],
110
- "gitHead": "60d9a47ad71824709be52bbe1110b092f7698244"
110
+ "gitHead": "bbb28ea725d93cab820571dcac5e11ef84bc4894"
111
111
  }