feat(bot-info): add site setup wizard#397
Conversation
Turn the post-install bot-info widget into an interactive setup wizard. Using the one-time token stored from the URL fragment, it authenticates to the admin API, loads the org/site config, and presents a single scrollable form to validate users and the content source before saving. - Org users section (new orgs only, gated on new_org=true): editable email + role rows, blocked from saving when empty. - Site administrators section: editable rows seeded from access.json. - Content source: URL + type (DA/SharePoint/Google Drive/AEM/BYOM), auto-detected from the URL. - On submit, diffs and posts org users, rebuilds access.json, and updates the site content source, then shows a confirmation that reflects the actual saved configuration. Pure logic (content-source detection/build, org-user diffing) is extracted into wizard.js with unit tests. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
|
|
Code ReviewSummaryWell-structured PR converting a static confirmation page into an interactive setup wizard. Pure logic is cleanly extracted into Issues FoundSHOULD FIX:
CONSIDER:
VerdictREQUEST CHANGES — Fix the |
- add rel="noopener noreferrer" to all target="_blank" links - namespace the setup token session key (bot-info-setup-token) - default new org-user rows to the least-privileged author role (site-admin rows still default to admin) Co-Authored-By: Claude Opus 4.8 <[email protected]>
Use the DA editor URL only for DA sources; for SharePoint/Google Drive/AEM/BYOM, link straight to the provided content source URL. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Revert new-row default back to admin (this is the initial setup) and add an "admin roles" documentation link to both user sections. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…site Rename the "Site administrators" section to "Site users" with matching copy, and visually emphasize the org and site names throughout. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Each user row now shows a compact roles summary button that expands the role pills on demand, reducing clutter for the 8 available roles. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Keep the role pills visible but only surface the primary admin role by default; the remaining roles collapse behind an inline … link (auto -expanded when one of them is already selected). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Mirror the other admin tools by adding a console block that logs each admin API request/response during load and save, plus info/success/error status messages, so the setup flow is more transparent. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The site config response already contains the access sub-object, so drop the redundant separate access.json read during load. Co-Authored-By: Claude Opus 4.8 <[email protected]>
DA is now the default content source with a fixed, read-only URL
(content.da.live/{org}/{site}). A "use a different content source"
checkbox reveals the non-DA type selector and an editable URL.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Wrap the DA intro text and fixed URL in one container and hide it when "use a different content source" is checked. The previous .bot-info-field display rule also overrode the aria-hidden hide. Co-Authored-By: Claude Opus 4.8 <[email protected]>
When config can't be loaded (e.g. an expired token / 401), the error screen now offers a "Continue to your site" button that shows an adapted confirmation: next-steps and DA defaults only, without the inaccurate "what we did" summary. Refactors the confirmation into a shared showConfirmation() used by both the save and skip paths. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Soften the error copy, point to the continue button, and ask for a plain screenshot instead of a console screenshot. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Rename the AEM content source kind to "AEM Authoring" and add a suffix field (default .html) that's shown for AEM Authoring and BYOM sources and written to content.source.suffix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
- cap the suffix input width and apply the shared input styling - clear the suffix when switching to BYOM; default to .html for AEM - assert buildContentSource never sets a suffix for DA/SharePoint/Google Co-Authored-By: Claude Opus 4.8 <[email protected]>
Only BYOM exposes the editable suffix field; AEM Authoring keeps it hidden while still writing its .html default to content.source.suffix. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Auto-select the content source type from the URL only for definite provider matches (SharePoint/Google/AEM); never override the user's selection with the BYOM fallback. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The user selects the content source type explicitly; remove the URL change listener that auto-switched it. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Capture token_id (the admin api key id) from the fragment alongside the token and store it. After the config saves successfully, delete that key from the org config (new orgs) or site config, so the one-time setup key can't be reused. Best-effort: a failed deletion is logged but doesn't fail the setup. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Remove the setup token and key id from session storage once the config is saved and the key is revoked. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Writing the whole site config after updating access.json overwrote the just-added site users with the stale copy read on load. Update only the content sub-config instead. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Write just { source } rather than merging the stale loaded content, so
the content update carries only the intended change.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Show a per-type example URL in the content source URL field, updating as the content source type changes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Rename "AEM Authoring" back to "AEM" and give it a fixed, non-editable URL (https://api.aem.live/{org}/sites/{site}/source, type markup). The URL field is read-only when AEM is selected; detection recognizes the new api.aem.live format (and legacy adobeaemcloud). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Drop suffix support from the AEM kind so buildContentSource never attaches a suffix for AEM; only BYOM carries one now. Co-Authored-By: Claude Opus 4.8 <[email protected]>
What
Turns the post-install
bot-infowidget into an interactive site setup wizard. After AEM Code Sync is added to a repo, the user lands here withorg,site,user, optionalurlquery params and a one-timetokenin the URL fragment. The widget now:#tokenintosessionStorageand scrubs it from the URL.Authorization: token …, no interactive-login fallback) and loads the org/site config.new_org=true); editable email + role rows; saving is blocked when the list is empty.access.json.access.json, and updates the site'scontent.source.https://da.live/#/{org}/{site}.Why
The previous widget was a static confirmation page that didn't match the real setup state and required users to bounce out to separate admin tools. This guides new sites through user and content-source setup in one step, right after install.
How it was tested
npm run lint— clean.npm test— 552/552 pass, including new unit tests for the extracted pure logic inwizard.js(detectContentSourceKind,buildContentSource,diffOrgUsers).TESTING.md; DOM building and API calls are exercised manually.Reuses
parseUsersFromAccessConfig/buildAccessConfig(user-admin), content-source detection (site-admin), and the sharedhelix-admin.jsclient.Test plan
npm run lint)npm test, 552/552)wizard.js🤖 Generated with Claude Code