mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-09 17:22:00 +08:00
2.4 KiB
2.4 KiB
Aura — Patching homeGuestLayout.json
Target file:
experiences/<siteName>/views/homeGuestLayout.json
The patch is applied by scripts/patch_aura_bundle.sh. Invoke as:
scripts/patch_aura_bundle.sh <homeGuestLayout.json> <deploymentName> <scrtUrl> <siteEndpoint>
Aura differs from LWR: component keys are componentName / componentAttributes (not definition / attributes), and there is no dxpStyle field. See manual_fallback.md if the script cannot run.
What the script does
- Reads
<homeGuestLayout.json>withjq. - Iterates
.regions[]and selects the first region whose.components[]is non-empty. - Recursively searches components (descending through every level of
forceCommunity:sectionwrapper'scomponentAttributes.regions[].components[]) for.componentName == "experience_messaging:embeddedMessaging". - If found — updates that node's
.componentAttributesto the six standard values and preserves the existing.id:deploymentName,scrtUrl,siteEndpoint(from CLI args)isExpSiteAuthMode: false,hideChatButtonOnLoad: "Default",clientVersion: "WebV1"
- If absent — appends a fresh
forceCommunity:sectionwrapper. The nested region carriesid,type: "region",regionLabel: "Column",regionName: "column",renditionMap: {}. - Writes the file back with jq's 2-space indentation.
Re-running is idempotent — the script updates in place rather than appending a second wrapper.
How to verify
-
Exactly one messaging node exists:
jq '[.. | select(.componentName? == "experience_messaging:embeddedMessaging")] | length' <homeGuestLayout.json> # → 1 -
All new IDs are UUIDs (no reused IDs from the fixture):
jq '[.. | .id? // empty] | unique | length' <homeGuestLayout.json> -
The sibling
<siteName>.site-meta.xmlstill exists in the retrieve directory — it must be copied at deploy time or the deploy will be rejected.
Common failures
| Symptom | Cause |
|---|---|
| Deploy succeeds but chat button never appears | Wrote definition instead of componentName |
| Section deployed but empty | Nested region missing type: "region" or renditionMap |
| Deploy fails with "site metadata not found" | Sibling <siteName>.site-meta.xml was not copied alongside the experiences/ bundle |
| Two chat buttons after re-run | Detection did not recurse through forceCommunity:section wrappers' nested regions |