Repository navigation
chore: Rename Webchat to Shopping Assistant and implement new component - #3247
Conversation
- Updated sections.json to reflect the name change from "Webchat" to "ShoppingAssistant" with updated descriptions. - Replaced `useWebchatScript` with `useShoppingAssistant` in ThirdPartyScripts. - Introduced a new `useShoppingAssistant` hook to manage script injection for the Shopping Assistant. - Created a new Shopping Assistant component with corresponding styles and structure. - Removed the old Webchat component and its references. This change enhances the user experience by providing a dedicated Shopping Assistant feature.
WalkthroughThis PR renames the Webchat feature to ShoppingAssistant across the codebase, including section configuration metadata, hook exports, component registrations, and file structure. The old Webchat component is removed and replaced with a new ShoppingAssistant component that maintains the same functionality. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/components/ThirdPartyScripts/useShoppingAssistant.tsx (1)
14-29: Consider addingasyncordeferto the script for better loading performance.The script is injected without
asyncordefer, which means it could block HTML parsing. Unless the Shopping Assistant script requires synchronous loading for initialization, addingscript.async = truewould improve page load performance.💡 Optional performance improvement
const script = document.createElement('script') script.src = SHOPPING_ASSISTANT_SCRIPT_URL + script.async = true const container = containerRef?.current🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/components/ThirdPartyScripts/useShoppingAssistant.tsx` around lines 14 - 29, The injected Shopping Assistant script in useShoppingAssistant (creating `script` with `SHOPPING_ASSISTANT_SCRIPT_URL` and attaching to `containerRef`) is missing async/defer; set `script.async = true` (or `script.defer = true` if the script must execute after parsing) before appending to `containerRef.current` or `document.head` to avoid blocking HTML parsing, keeping the same cleanup that calls `script.remove()` in the returned effect cleanup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/core/src/components/ThirdPartyScripts/useShoppingAssistant.tsx`:
- Around line 14-29: The injected Shopping Assistant script in
useShoppingAssistant (creating `script` with `SHOPPING_ASSISTANT_SCRIPT_URL` and
attaching to `containerRef`) is missing async/defer; set `script.async = true`
(or `script.defer = true` if the script must execute after parsing) before
appending to `containerRef.current` or `document.head` to avoid blocking HTML
parsing, keeping the same cleanup that calls `script.remove()` in the returned
effect cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d3e7735f-c05b-431a-b828-5e0d384a606b
📒 Files selected for processing (9)
packages/core/cms/faststore/sections.jsonpackages/core/src/components/ThirdPartyScripts/index.tspackages/core/src/components/ThirdPartyScripts/useShoppingAssistant.tsxpackages/core/src/components/cms/global/Components.tspackages/core/src/components/sections/ShoppingAssistant/ShoppingAssistant.tsxpackages/core/src/components/sections/ShoppingAssistant/index.tspackages/core/src/components/sections/ShoppingAssistant/section.module.scsspackages/core/src/components/sections/Webchat/Webchat.tsxpackages/core/src/components/sections/Webchat/index.ts
💤 Files with no reviewable changes (2)
- packages/core/src/components/sections/Webchat/index.ts
- packages/core/src/components/sections/Webchat/Webchat.tsx
…nt (#3247) - Updated sections.json to reflect the name change from "Webchat" to "ShoppingAssistant" with updated descriptions. - Replaced `useWebchatScript` with `useShoppingAssistant` in ThirdPartyScripts. - Introduced a new `useShoppingAssistant` hook to manage script injection for the Shopping Assistant. - Created a new Shopping Assistant component with corresponding styles and structure. - Removed the old Webchat component and its references. This change enhances the user experience by providing a dedicated Shopping Assistant feature. <!--- Considering the context, what is the problem we'll solve? Where in VTEX's big picture our issue fits in? Write a tweet about the context and the problem itself. ---> <!--- Tell us the role of the new feature, or component, in its context. Provide details about what you have implemented and screenshots if applicable. ---> <!--- Describe the steps with bullet points. Is there any external link that can be used to better test it or an example? ---> <!--- Add a link to a deploy preview from `starter.store` with this branch being used. ---> <!--- Tip: You can get an installable version of this branch from the CodeSandbox generated when this PR is created. ---> <!--- Spread the knowledge: is there any content you used to create this PR that is worth sharing? ---> <!--- Extra tip: adding references to related issues or mentioning people important to this PR may be good for the documentation and reviewing process ---> <em>You may erase this after checking them all 😉</em> **PR Title and Commit Messages** - [ ] PR title and commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification - Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`, `refactor`, `ci` and `test` **PR Description** - [ ] Added a label according to the PR goal - `breaking change`, `bug`, `contributing`, `performance`, `documentation`.. **Dependencies** - [ ] Committed the `pnpm-lock.yaml` file when there were changes to the packages **Documentation** - [ ] PR description - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **Documentation** * Renamed CMS section from "Webchat" to "Shopping Assistant." * Updated section title and description with new setup instructions pointing to the Agentic CX Dashboard. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
useWebchatScriptwithuseShoppingAssistantin ThirdPartyScripts.useShoppingAssistanthook to manage script injection for the Shopping Assistant.This change enhances the user experience by providing a dedicated Shopping Assistant feature.
What's the purpose of this pull request?
How it works?
How to test it?
Starters Deploy Preview
References
Checklist
You may erase this after checking them all 😉
PR Title and Commit Messages
feat,fix,chore,docs,style,refactor,ciandtestPR Description
breaking change,bug,contributing,performance,documentation..Dependencies
pnpm-lock.yamlfile when there were changes to the packagesDocumentation
@Mariana-Caetanoto review and update (Or submit a doc request)Summary by CodeRabbit