Skip to content

[CDX-424]: add CDN/script tag integration example to README - #47

Merged
esezen merged 3 commits into
mainfrom
cdx-424-rex-ui-add-cdn-script-tag-integration-example-to-readme
May 12, 2026
Merged

esezen merged 3 commits into
mainfrom
cdx-424-rex-ui-add-cdn-script-tag-integration-example-to-readme

Conversation

@niizom

@niizom niizom commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Pull Request Checklist

Before you submit a pull request, please make sure you have to following:

  • I have added or updated TypeScript types for my changes, ensuring they are compatible with the existing codebase.
  • I have added JSDoc comments to my TypeScript definitions for improved documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added any necessary documentation (if appropriate).
  • I have made sure my PR is up-to-date with the main branch.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no API changes)
  • Documentation content changes
  • TypeScript type definitions update
  • Other... Please describe:

Copilot AI review requested due to automatic review settings April 23, 2026 17:23
@niizom
niizom requested a review from a team as a code owner April 23, 2026 17:23
constructor-claude-bedrock[bot]

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md

@esezen esezen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Left some comments

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
constructor-claude-bedrock[bot]

This comment was marked as outdated.

Comment thread README.md Outdated

@esezen esezen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@esezen
esezen merged commit 21a41bc into main May 12, 2026
8 checks passed
@esezen
esezen deleted the cdx-424-rex-ui-add-cdn-script-tag-integration-example-to-readme branch May 12, 2026 00:01

@constructor-claude-bedrock constructor-claude-bedrock Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: ⚠️ Needs Work

Comment thread README.md

```html
<!-- replace x.x.x with the desired version -->
<script defer src="https://cdn.cnstrc.com/ui/recommendations/x.x.x.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
<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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
CioRecommendations({
selector: '#recommendations-container',
includeCSS: true,
apiKey: 'key_M57QS8SMPdLdLx4x',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
</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/).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants