Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a README section documenting how to use the library via CDN/script-tag for no-build environments.
Changes:
- Added “CDN / Script Tag” usage instructions with unpkg/jsDelivr links.
- Included a full HTML example showing initialization via
CioRecommendations. - Added guidance about version pinning and a link to releases/Storybook.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This PR adds a CDN / Script Tag integration section to the README for no-build environments — the structure and prose are clear, but there are a few accuracy and consistency issues that should be addressed before merging.
Inline comments: 4 discussions added
Overall Assessment:
|
|
||
| ```html | ||
| <!-- replace x.x.x with the desired version --> | ||
| <script defer src="https://cdn.cnstrc.com/ui/recommendations/x.x.x.js"></script> |
There was a problem hiding this comment.
Important Issue: The CDN URL format https://cdn.cnstrc.com/ui/recommendations/x.x.x.js is a placeholder and is not verified to be correct. The actual bundle filename produced by the build is constructorio-ui-recommendations-bundled.js (as defined in vite.config.js). The URL should reflect the real artifact name. For example: https://cdn.cnstrc.com/ui/recommendations/constructorio-ui-recommendations-bundled@x.x.x.js — or whatever the actual published CDN path is. Using an incorrect URL in example code will break any copy-paste use by developers.
| <script defer src="https://cdn.cnstrc.com/ui/recommendations/x.x.x.js"></script> | ||
| ``` | ||
|
|
||
| > **Note:** Always pin to a specific version (e.g. `@1.0.0`) rather than `@latest` to avoid unexpected breaking changes in production. Check the [GitHub releases page](https://github.com/Constructor-io/constructorio-ui-recommendations/releases) for the latest stable version. |
There was a problem hiding this comment.
Important Issue: The note says to pin to @1.0.0 as an example, but the <script> URL above uses a path segment x.x.x.js (not a query param or @ suffix). The note's syntax example (@1.0.0) is inconsistent with the URL format shown. Align the version-pinning example with the actual URL format used in the code block so users aren't confused about where/how the version is embedded in the URL.
| CioRecommendations({ | ||
| selector: '#recommendations-container', | ||
| includeCSS: true, | ||
| apiKey: 'key_M57QS8SMPdLdLx4x', |
There was a problem hiding this comment.
Important Issue: The apiKey value 'key_M57QS8SMPdLdLx4x' appears to be a real or demo API key that is already used in other sections of the README. While it may be an intentional demo key, the new CDN section also omits podId in the snippet note — the inline script block does include it as 'YOUR_POD_ID' which is correct, but podId is absent from the Vanilla JS section above (README line ~91). Consistency: confirm whether podId is required for the CDN use case and make sure the podId placeholder is not accidentally omitted or left as a real value.
| </html> | ||
| ``` | ||
|
|
||
| When `includeCSS: true` is set, default styles are automatically injected (scoped to `.cio-recommendations`). For the full list of configuration options, refer to the [Storybook API reference](https://constructor-io.github.io/constructorio-ui-recommendations/). |
There was a problem hiding this comment.
Suggestion: The closing paragraph would be clearer if it also mentioned that defer is important when the <script> tag is placed in <head> (so the DOM is ready before the inline initialization script runs). Without defer, the inline <script> block in <body> that calls CioRecommendations(...) could execute before the library has loaded. A short note like "Ensure the library <script> tag appears before the initialization script, or use defer on the library tag and place the initialization script after the DOM element" would prevent a common integration mistake.
Pull Request Checklist
Before you submit a pull request, please make sure you have to following:
PR Type
What kind of change does this PR introduce?