PWA Kit 3.20.0 fixes Trusted Agent (Order on Behalf) login, expands the Commerce Client Shopper Agent widget with new configuration and UI options, cuts SSR runtime cost by removing per-request CloudWatch metrics, hardens session-token handling on load, and corrects a Data Cloud recommender field name.
Highlights
- 🤝 Trusted Agent (Order on Behalf) login fix — The Trusted Agent login popup no longer hangs blank.
authorizeTrustedAgentnow sends an OAuthstate(a CSRF nonce) that the storefront callback requires, anduseTrustedAgentverifies it. Delivery also moved to a same-originpostMessage(with aBroadcastChannelfallback), so login completes even under aCross-Origin-Opener-Policy: same-originheader. (#3976, #3959) - 🤖 Commerce Client Shopper Agent widget — New floating action button (
cc_showFab), component overrides (cc_overridesUrl/cc_overrides), page-push layout (cc_pagePush), escalation/transcript toggles, panel open-state persistence,cc_cdnVersionbundle resolution, andcc_-prefixed config namespacing. (#3966, #3963, #3926) - 💸 SSR cost reduction — Removed the custom per-request CloudWatch metrics from the SSR server to eliminate the per-request
PutMetricDatacost. Backward-compatible:app.sendMetric()andMetricsSenderare retained as no-ops. (#3962) - 🛡️ Resilient session-token handling — A stale or malformed session token on load no longer throws
Invalid token specified: missing part #2; the flow clears the bad token and falls back to a refresh / guest login. (#3931) - 📊 Data Cloud recommender fix — Corrects the catalog event field name
personalizationContextId→personalizationContentIdso the recommender UUID is no longer dropped on ingest. (#3952)
Package Changes
@salesforce/commerce-sdk-react@5.4.0
- [Bugfix] Fix Trusted Agent (Order on Behalf) login hanging on a blank popup because
authorizeTrustedAgentnever sent an OAuthstate.authorizeTrustedAgentnow generates a CSRFstate(a nonce distinct from the PKCE code verifier), sends it on the authorize request, and returns it;useTrustedAgentcompares the popup-echoedstateagainst the one it minted before exchanging the code, and SLAS additionally bindsstate↔codeon the token request. #3976 - [Bugfix] Fix Trusted Agent (Order on Behalf) login failing when the storefront sends a
Cross-Origin-Opener-Policy: same-originheader.useTrustedAgentnow receives the result out of band viapostMessagefrom the same-origin callback page with aBroadcastChannelfallback, and no longer treats a severedpopup.closedas user cancellation. Exposes auseTrustedAgentPopupCallbackhook for the callback page. AddsTRUSTED_AGENT_RUNBOOK.md. #3959 - [Bugfix] Gracefully handle stale or malformed session tokens on load. An undecodable access token is discarded (and its cookie cleared) and treated as expired, an undecodable SFRA
cc-athandoff token is cleared with a fallback to the local store, and a malformedfetchedTokenis ignored — in every case the flow falls through to a refresh / guest login instead of throwing. Only affects non-HttpOnly / SSR / hybrid mode. #3931
@salesforce/pwa-kit-runtime@3.20.0
- Remove the custom per-request CloudWatch metrics emitted by the SSR remote server (
GCTime,RequestTime,RequestSuccess,RequestFailed*,LambdaCreated,LambdaReused,RenderTime,RenderErrors) to eliminate thePutMetricDatacost incurred on every request. Not a breaking change:app.sendMetric()and theMetricsSender(send()/flush()) are retained with their original signatures as no-ops. #3962
@salesforce/pwa-kit-dev@3.20.0
- The dev server's
app.sendMetric()is now a backwards-compatible no-op, following removal of custom per-request CloudWatch metrics inpwa-kit-runtime. #3962
@salesforce/pwa-kit-create-app@3.20.0
- [Bugfix] Keep the generated
ssr.js.hbsandrequest-processor.jstemplates in sync withtemplate-retail-react-appfor the Trusted Agent (Order on Behalf) callback fix. The request processor now keepscodeon a/callbackrequest whenstateis also present, and the generated/callbackhandler serves that variant withCache-Control: no-storeso the callback page can post the result back to the opener, while the standard SLAS redirect stays CDN cacheable. #3959
@salesforce/pwa-kit-react-sdk@3.20.0
- Version-alignment release; no functional changes to
pwa-kit-react-sdksince v3.19.0.
@salesforce/retail-react-app@10.2.0
Features
- Add
cc_showFabfor the Commerce Client shopper-agent widget: when'true', renders a floating action button atcc_widgetPositionthat opens the agent panel and hides while it is open. Defaults to'false'. #3966 - Add component overrides for the Commerce Client shopper-agent widget: set
cc_overridesUrl(HTTPS URL of a hosted override script) orcc_overrides(inline map of override keys to registered custom-element tag names). Mutually exclusive —cc_overrideswins when both are set. A validcc_overridesUrlorigin is added to thescript-srcCSP directive. #3963 - Persist the Commerce Client shopper-agent panel's open-state to
sessionStorageso it stays open across page navigations until the shopper closes it. - Add configurable
cc_enableEscalationToAgentandcc_enableDownloadTranscripttoggles (both default'true') to hide the human-agent escalation control or the transcript-download control. - Add
cc_pagePush: when enabled, storefront content shifts aside (desktoplg+ only) to make room for the open full-height side panel instead of being overlaid, and follows the panel across left/right moves. - Resolve the Commerce Client messaging bundle URL from a
cc_cdnVersioninterpolated into the Cimulate CDN, withcommerceClientScriptSourceUrlas an explicit override for local dev / self-hosting. - Namespace all Commerce Client shopper-agent config-input properties under a
cc_prefix (e.g.cc_esDeveloperName,cc_dialogFullHeight,cc_widgetPosition,cc_isOpen) to disambiguate them from the shared/MIAW fields inCOMMERCE_AGENT_SETTINGS.
Bug fixes
- [Bugfix] Fix the Data Cloud recommender catalog event field name:
personalizationContextId→personalizationContentId. TheContextspelling did not match the@salesforce/cc-datacloud-typescriptSDK type, so the recommender UUID (__recoUUID) was sent under a key Data Cloud does not recognize and is expected to be dropped on ingest. #3952 - [Bugfix] Deliver the Trusted Agent (Order on Behalf) result from the
/callbackpage back to the opener. The request processor now keepscodewhenstateis also present (the Trusted Agent redirect) and serves itCache-Control: no-store; the callback page postscodeandstateto the opener viapostMessage(scoped to its origin) with aBroadcastChannelfallback, so login completes even under aCross-Origin-Opener-Policy: same-originheader. The standard SLAS login redirect carries nostate, so it stays CDN cacheable. #3959 - [Bugfix] Honor
cc_dialogFullHeight: 'false', which was previously dropped from the widget options so the bundle's full-height default always won. - [Bugfix] Remove the
cc_pagePushcontent shift while the panel is expanded into a modal, instead of leaving the storefront pushed aside under the centered overlay.
@salesforce/pwa-kit-mcp@0.5.0
- No change this release; already published on npm.
Full Changelog: v3.19.0...v3.20.0