Skip to content

Switch to injecting in-app SDK from CDN #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

BernardGatt
Copy link

@BernardGatt BernardGatt commented Aug 6, 2025

Instead of relying on our NPM package, we’re now pulling the latest version of the in-app plugin directly from our CDN.

We cannot merge this PR until the Gist in-app SDK is served through CIO's assets domain.

Part of: INAPP-13803

Bernard Gatt added 4 commits August 5, 2025 15:28
@BernardGatt BernardGatt requested a review from Copilot August 6, 2025 13:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR switches from using the NPM package customerio-gist-web to dynamically loading the Gist library from a CDN. This change allows for remote injection of the in-app SDK without requiring package updates.

Key changes:

  • Removes NPM dependency on customerio-gist-web and replaces it with dynamic CDN loading
  • Adds a new build script for updating browser packages on CDP
  • Downgrades Node.js version from 18.19.0 to 14.21.3

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/update_browser_packages_on_cdp.sh New build script for copying UMD assets to edge API
packages/browser/src/plugins/in-app-plugin/index.ts Replaces static Gist import with dynamic CDN loading function
packages/browser/src/plugins/in-app-plugin/__tests__/index.test.ts Updates tests to mock global Gist object and CDN loading behavior
packages/browser/package.json Removes customerio-gist-web dependency
.mise.toml Downgrades Node.js version to 14.21.3


// Create script tag to load from CDN
const script = document.createElement('script')
script.src = 'https://code.gist.build/web/latest/gist.min.js'
Copy link
Preview

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

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

Using 'latest' in the CDN URL can lead to unpredictable behavior and breaking changes. Consider pinning to a specific version for better stability and predictability.

Suggested change
script.src = 'https://code.gist.build/web/latest/gist.min.js'
// Pinned to a specific version for stability; update as needed
script.src = 'https://code.gist.build/web/1.0.0/gist.min.js'

Copilot uses AI. Check for mistakes.

Copy link
Author

Choose a reason for hiding this comment

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

The src will change to a CIO DNS with a version dedicated to CDP.

Copy link
Author

Choose a reason for hiding this comment

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

Due to CSP and our docs, we can't use the new CIO domains. The code.gist.build domain is already in our CSP docs so we should be fine.

@BernardGatt BernardGatt changed the title Switch to injecting in-app SDK from CDN (do not merge) Switch to injecting in-app SDK from CDN Aug 19, 2025
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.

1 participant