Skip to content

Commit 2611018

Browse files
authored
Merge branch 'develop' into hotfix/validate-project-type-err
2 parents 2f3c013 + 68d1dfb commit 2611018

File tree

28 files changed

+280
-194
lines changed

28 files changed

+280
-194
lines changed

packages/commerce-sdk-react/src/auth/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,8 @@ class Auth {
13261326
callback_uri: parameters.callback_uri,
13271327
hint: parameters.hint || 'cross_device',
13281328
locale: parameters.locale,
1329-
code_challenge: parameters.code_challenge,
1330-
idp_name: parameters.idp_name
1329+
idp_name: parameters.idp_name,
1330+
...(parameters.code_challenge && {code_challenge: parameters.code_challenge})
13311331
}
13321332
}
13331333

@@ -1357,8 +1357,8 @@ class Auth {
13571357
channel_id: parameters.channel_id || slasClient.clientConfig.parameters.siteId,
13581358
client_id: parameters.client_id || slasClient.clientConfig.parameters.clientId,
13591359
new_password: parameters.new_password,
1360-
code_verifier: parameters.code_verifier,
1361-
hint: parameters.hint
1360+
hint: parameters.hint,
1361+
code_verifier: parameters.code_verifier
13621362
}
13631363
}
13641364

packages/pwa-kit-create-app/assets/bootstrap/js/config/default.js.hbs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
/* eslint-disable @typescript-eslint/no-var-requires */
88
const sites = require('./sites.js')
9-
const {parseCommerceAgentSettings} = require('./utils.js')
9+
const {parseSettings} = require('./utils.js')
1010

1111
module.exports = {
1212
app: {
@@ -23,9 +23,17 @@ module.exports = {
2323
// Commerce shopping agent configuration for embedded messaging service
2424
// This enables an agentic shopping experience in the application
2525
// This property accepts either a JSON string or a plain JavaScript object.
26-
// The value is set from the COMMERCE_AGENT_SETTINGS environment variable.
27-
// If the COMMERCE_AGENT_SETTINGS environment variable is not set, the feature is disabled.
28-
commerceAgent: parseCommerceAgentSettings(process.env.COMMERCE_AGENT_SETTINGS),
26+
commerceAgent: parseSettings(process.env.COMMERCE_AGENT_SETTINGS) || {
27+
enabled: 'false',
28+
askAgentOnSearch: 'false',
29+
embeddedServiceName: '',
30+
embeddedServiceEndpoint: '',
31+
scriptSourceUrl: '',
32+
scrt2Url: '',
33+
salesforceOrgId: '',
34+
commerceOrgId: '',
35+
siteId: ''
36+
},
2937
// Customize how your 'site' and 'locale' are displayed in the url.
3038
url: {
3139
{{#if answers.project.demo.enableDemoSettings}}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2021, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
8+
/**
9+
* Safely parses settings from either a JSON string or object
10+
* @param {string|object} settings - The settings
11+
* @returns {object} Parsed settings object
12+
*/
13+
function parseSettings(settings) {
14+
// If settings is already an object, return it
15+
if (typeof settings === 'object' && settings !== null) {
16+
return settings
17+
}
18+
19+
// If settings is a string, try to parse it
20+
if (typeof settings === 'string') {
21+
try {
22+
return JSON.parse(settings)
23+
} catch (error) {
24+
console.warn('Invalid json format:', error.message)
25+
return
26+
}
27+
}
28+
29+
console.warn('Cannot parse settings from:', settings)
30+
return
31+
}
32+
33+
module.exports = {
34+
parseSettings
35+
}

packages/pwa-kit-create-app/assets/bootstrap/js/config/utils.js.hbs

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

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/default.js.hbs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
/* eslint-disable @typescript-eslint/no-var-requires */
88
const sites = require('./sites.js')
9-
const {parseCommerceAgentSettings} = require('./utils.js')
9+
const {parseSettings} = require('./utils.js')
1010

1111
module.exports = {
1212
app: {
@@ -23,9 +23,17 @@ module.exports = {
2323
// Commerce shopping agent configuration for embedded messaging service
2424
// This enables an agentic shopping experience in the application
2525
// This property accepts either a JSON string or a plain JavaScript object.
26-
// The value is set from the COMMERCE_AGENT_SETTINGS environment variable.
27-
// If the COMMERCE_AGENT_SETTINGS environment variable is not set, the feature is disabled.
28-
commerceAgent: parseCommerceAgentSettings(process.env.COMMERCE_AGENT_SETTINGS),
26+
commerceAgent: parseSettings(process.env.COMMERCE_AGENT_SETTINGS) || {
27+
enabled: 'false',
28+
askAgentOnSearch: 'false',
29+
embeddedServiceName: '',
30+
embeddedServiceEndpoint: '',
31+
scriptSourceUrl: '',
32+
scrt2Url: '',
33+
salesforceOrgId: '',
34+
commerceOrgId: '',
35+
siteId: ''
36+
},
2937
// Customize settings for your url
3038
url: {
3139
{{#if answers.project.demo.enableDemoSettings}}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2021, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6+
*/
7+
8+
/**
9+
* Safely parses settings from either a JSON string or object
10+
* @param {string|object} settings - The settings
11+
* @returns {object} Parsed settings object
12+
*/
13+
function parseSettings(settings) {
14+
// If settings is already an object, return it
15+
if (typeof settings === 'object' && settings !== null) {
16+
return settings
17+
}
18+
19+
// If settings is a string, try to parse it
20+
if (typeof settings === 'string') {
21+
try {
22+
return JSON.parse(settings)
23+
} catch (error) {
24+
console.warn('Invalid json format:', error.message)
25+
return
26+
}
27+
}
28+
29+
console.warn('Cannot parse settings from:', settings)
30+
return
31+
}
32+
33+
module.exports = {
34+
parseSettings
35+
}

packages/pwa-kit-create-app/assets/templates/@salesforce/retail-react-app/config/utils.js.hbs

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

packages/pwa-kit-mcp/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## v0.2.1-dev (Aug 11, 2025)
2+
- Normalize tool names; Add introduction section for PWA Kit MCP and resize the images on README. [#3239](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3239)
23

34
## v0.1.1 (Aug 11, 2025)
45
- Add missing `shelljs` dependency. [#3053](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3053)

packages/pwa-kit-mcp/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ It allows AI agents to query context-aware services like this server to help dev
1212
👉 **[Read more at modelcontextprotocol.io](https://modelcontextprotocol.io/)**
1313

1414

15+
## What is PWA-Kit-MCP?
16+
17+
PWA-Kit-MCP is a local STDIO MCP Server that communicates via STDIO and operates in conjunction with a running local process, making it a fully locally installed MCP server. It provides an initial suite of MCP tools intended to standardize and optimize the developer workflow for PWA Kit storefront development. These tools facilitate project creation, supply development guidelines, enable the generation of new components and pages, and support site validation through performance and accessibility testing.
18+
19+
1520
## 🧰 Features
1621

1722
The PWA Kit MCP Server offers the following intelligent tools tailored to Salesforce Commerce Cloud PWA development:
1823

19-
* **`create_app_guidelines`**:
24+
* **`create_storefront_app`**:
2025
Guides agents and developers through creating a new PWA Kit project with `@salesforce/pwa-kit-create-app`.
2126

22-
* **`create_new_sample_component`**:
27+
* **`create_sample_component`**:
2328
Walks developers through a brief Q\&A to scaffold a component using the commerce data model, layout, and structure.
2429

25-
* **`create_sample_storefront_page`**:
30+
* **`create_sample_page`**:
2631
Interactive tool to generate a new PWA storefront page with custom routing and components.
2732

2833
* **`development_guidelines`**:
@@ -44,10 +49,10 @@ The PWA Kit MCP Server offers the following intelligent tools tailored to Salesf
4449
1. Open **Cursor**.
4550

4651
2. Navigate to **Settings > Cursor Settings...**
47-
![](https://raw.githubusercontent.com/SalesforceCommerceCloud/pwa-kit/refs/heads/develop/packages/pwa-kit-mcp/docs/images/cursor-settings.png)
52+
<img src="https://raw.githubusercontent.com/SalesforceCommerceCloud/pwa-kit/refs/heads/develop/packages/pwa-kit-mcp/docs/images/cursor-settings.png" alt="Cursor Settings Screenshot" width="50%" />
4853

4954
3. Go to **Tools & Integrations > MCP Tools > New MCP Server**
50-
![](https://raw.githubusercontent.com/SalesforceCommerceCloud/pwa-kit/refs/heads/develop/packages/pwa-kit-mcp/docs/images/cursor-mcp-tools.png)
55+
<img src="https://raw.githubusercontent.com/SalesforceCommerceCloud/pwa-kit/refs/heads/develop/packages/pwa-kit-mcp/docs/images/cursor-mcp-tools.png" alt="Cursor MCP Tools Screenshot" width="50%" />
5156

5257
4. Update your `mcp.json` like this (edit the placeholders as needed):
5358
```json
@@ -86,7 +91,7 @@ Then send JSON-RPC requests like:
8691

8792
```json
8893
{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}
89-
{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "create_new_component", "arguments": {}}}
94+
{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "create_sample_component", "arguments": {}}}
9095
```
9196

9297
---
@@ -127,6 +132,5 @@ the output on "MCP Logs".
127132
| `package.json` | Node.js dependencies and project scripts |
128133
| `mcp.json` | MCP client configuration (used by Cursor or other IDEs) |
129134
| `src/server/` | Main server entry point (`server.js`) |
130-
| `src/tools/` | Contains all MCP tools like `create-app-guideline`, `site-test`, etc. |
131-
| `src/utils/` | Shared utility functions |
132-
| `
135+
| `src/tools/` | Contains all MCP tools like `create-storefront-app`, `site-test`, etc. |
136+
| `src/utils/` | Shared utility functions |

packages/pwa-kit-mcp/src/tools/create-app-guideline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ If the user requests a project using a **template**:
6363
`
6464

6565
export default {
66-
name: 'create_app_guidelines',
66+
name: 'create_storefront_app',
6767
description: `
6868
6969
This tool is used to provide the agent with the instructions on how to use the @salesforce/pwa-kit-create-app CLI tool to create a new PWA Kit projects.

0 commit comments

Comments
 (0)