@salesforce/commerce-sdk-react 5.2.0 → 5.2.1

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
@@ -1,3 +1,6 @@
1
+ ## v5.2.1 (May 21, 2026)
2
+ - Add contentLinkUuid support to fix Page Designer integration [#3839](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3839)
3
+
1
4
  ## v5.2.0 (May 07, 2026)
2
5
  - Allow auth related cookies domain to be set via config [#3782](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3782)
3
6
  - WIP: Add support for HttpOnly session cookies [#3804](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3804)
@@ -35,10 +35,11 @@ const Component = exports.Component = /*#__PURE__*/(0, _react.memo)(function Com
35
35
  const componentWithRuntimeProps = component;
36
36
  const designMetadata = {
37
37
  name: (_component$designMeta = component.designMetadata) === null || _component$designMeta === void 0 ? void 0 : _component$designMeta.name,
38
- isFragment: false,
38
+ isFragment: Boolean(componentWithRuntimeProps.fragment),
39
39
  isVisible: Boolean(componentWithRuntimeProps.visible),
40
40
  isLocalized: Boolean(componentWithRuntimeProps.localized),
41
- id: component.id
41
+ id: component.id,
42
+ contentLinkUuid: componentWithRuntimeProps.contentLinkUuid
42
43
  };
43
44
 
44
45
  // Cast DynamicComponent to accept our props since registry returns unknown type
@@ -50,11 +50,14 @@ function renderRegionContent(region, regionId, metadata, className, rest) {
50
50
  region: region,
51
51
  className: className,
52
52
  designMetadata: getDesignMetadata(regionId, metadata)
53
- }, rest), (_region$components = region.components) === null || _region$components === void 0 ? void 0 : _region$components.map(comp => comp.id && /*#__PURE__*/_react.default.createElement(_Component.Component, {
54
- key: comp.id,
55
- component: comp,
56
- regionId: region.id
57
- })));
53
+ }, rest), (_region$components = region.components) === null || _region$components === void 0 ? void 0 : _region$components.map(comp => {
54
+ const key = comp.contentLinkUuid || comp.id;
55
+ return comp.id && /*#__PURE__*/_react.default.createElement(_Component.Component, {
56
+ key: key,
57
+ component: comp,
58
+ regionId: region.id
59
+ });
60
+ }));
58
61
  }
59
62
 
60
63
  /**
@@ -6,7 +6,7 @@ import { type RegionDesignMetadata } from '@salesforce/storefront-next-runtime/d
6
6
  export interface RegionRendererProps extends React.HTMLAttributes<HTMLDivElement> {
7
7
  region: any;
8
8
  children: ReactNode;
9
- designMetadata?: Omit<RegionDesignMetadata, 'componentIds'>;
9
+ designMetadata?: Omit<RegionDesignMetadata, 'contentLinkUuids'>;
10
10
  }
11
11
  /**
12
12
  * RegionWrapper - Smart wrapper that conditionally applies design mode decoration
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.RegionWrapper = RegionWrapper;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _core = require("@salesforce/storefront-next-runtime/design/react/core");
9
- var _react2 = require("@salesforce/storefront-next-runtime/design/react");
10
9
  const _excluded = ["region", "children", "className", "designMetadata"];
11
10
  /*
12
11
  * Copyright (c) 2025, salesforce.com, inc.
@@ -36,7 +35,7 @@ function RegionRenderer({
36
35
  * Create the design-mode decorated version of the region renderer
37
36
  * This wraps the region with Page Designer functionality when in design mode
38
37
  */
39
- const DecoratedRegionRenderer = (0, _react2.createReactRegionDesignDecorator)(RegionRenderer);
38
+ const DecoratedRegionRenderer = (0, _core.createReactRegionDesignDecorator)(RegionRenderer);
40
39
 
41
40
  /**
42
41
  * RegionWrapper - Smart wrapper that conditionally applies design mode decoration
@@ -72,7 +71,7 @@ function RegionWrapper(_ref) {
72
71
  var _region$components;
73
72
  return {
74
73
  id: region.id,
75
- componentIds: (region === null || region === void 0 ? void 0 : (_region$components = region.components) === null || _region$components === void 0 ? void 0 : _region$components.map(cmp => cmp.id)) || [],
74
+ contentLinkUuids: (region === null || region === void 0 ? void 0 : (_region$components = region.components) === null || _region$components === void 0 ? void 0 : _region$components.map(cmp => cmp.contentLinkUuid || cmp.id)) || [],
76
75
  componentTypeExclusions: (designMetadata === null || designMetadata === void 0 ? void 0 : designMetadata.componentTypeExclusions) || [],
77
76
  componentTypeInclusions: (designMetadata === null || designMetadata === void 0 ? void 0 : designMetadata.componentTypeInclusions) || []
78
77
  };
@@ -1,4 +1,4 @@
1
- import { type ReactDesignComponentType } from '@salesforce/storefront-next-runtime/design/react';
1
+ import { type ReactDesignComponentType } from '@salesforce/storefront-next-runtime/design/react/core';
2
2
  import { ComponentRegistry } from '@salesforce/storefront-next-runtime/design';
3
3
  /**
4
4
  * Factory function to create a React-specific component registry
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createReactComponentRegistry = createReactComponentRegistry;
7
7
  exports.registry = void 0;
8
- var _react = require("@salesforce/storefront-next-runtime/design/react");
8
+ var _core = require("@salesforce/storefront-next-runtime/design/react/core");
9
9
  var _design = require("@salesforce/storefront-next-runtime/design");
10
10
  /*
11
11
  * Copyright (c) 2025, salesforce.com, inc.
@@ -20,7 +20,7 @@ var _design = require("@salesforce/storefront-next-runtime/design");
20
20
  */
21
21
  function createReactComponentRegistry() {
22
22
  return new _design.ComponentRegistry({
23
- adapter: (0, _react.createReactAdapter)()
23
+ adapter: (0, _core.createReactAdapter)()
24
24
  });
25
25
  }
26
26
 
@@ -7,8 +7,14 @@ type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType[number];
7
7
  declare const CLIENT_KEY: "shopperExperience";
8
8
  type Client = NonNullable<ApiClients[typeof CLIENT_KEY]>;
9
9
  export type Page = DataType<Client['getPage']>;
10
- export type Region = ArrayElement<NonNullable<Page['regions']>>;
11
- export type Component = ArrayElement<NonNullable<Region['components']>>;
10
+ type BaseRegion = ArrayElement<NonNullable<Page['regions']>>;
11
+ type BaseComponent = ArrayElement<NonNullable<BaseRegion['components']>>;
12
+ export type Component = BaseComponent & {
13
+ contentLinkUuid?: string;
14
+ };
15
+ export type Region = Omit<BaseRegion, 'components'> & {
16
+ components?: Component[];
17
+ };
12
18
  /**
13
19
  * Extended Page type with design metadata and component data
14
20
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/commerce-sdk-react",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "A library that provides react hooks for fetching data from Commerce Cloud",
5
5
  "homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
6
6
  "bugs": {
@@ -40,13 +40,13 @@
40
40
  "version": "node ./scripts/version.js"
41
41
  },
42
42
  "dependencies": {
43
- "@salesforce/storefront-next-runtime": "0.1.1",
43
+ "@salesforce/storefront-next-runtime": "0.4.2",
44
44
  "commerce-sdk-isomorphic": "5.2.0",
45
45
  "js-cookie": "^3.0.1",
46
46
  "jwt-decode": "^4.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@salesforce/pwa-kit-dev": "3.18.0",
49
+ "@salesforce/pwa-kit-dev": "3.18.1",
50
50
  "@tanstack/react-query": "^4.28.0",
51
51
  "@testing-library/jest-dom": "^5.16.5",
52
52
  "@testing-library/react": "^14.0.0",
@@ -61,7 +61,7 @@
61
61
  "@types/react-helmet": "~6.1.6",
62
62
  "@types/react-router-dom": "~5.3.3",
63
63
  "cross-env": "^5.2.1",
64
- "internal-lib-build": "3.18.0",
64
+ "internal-lib-build": "3.18.1",
65
65
  "jsonwebtoken": "^9.0.0",
66
66
  "nock": "^13.3.0",
67
67
  "nodemon": "^2.0.22",
@@ -91,11 +91,12 @@
91
91
  "overrides": {
92
92
  "@salesforce/storefront-next-runtime": {
93
93
  "react": "^18.2.0",
94
- "react-dom": "^18.2.0"
94
+ "react-dom": "^18.2.0",
95
+ "react-router": "^5.3.4"
95
96
  }
96
97
  },
97
98
  "publishConfig": {
98
99
  "directory": "dist"
99
100
  },
100
- "gitHead": "2f979acd3f44c121968b50ce4c731dbcd047a677"
101
+ "gitHead": "c9397dd6adc78039f0ddfc5b1b0aeb264ace425e"
101
102
  }