Skip to content

Commit

Permalink
add required cross origin to widgets.js script tag
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidarain1 committed Oct 16, 2024
1 parent 8c5b474 commit 9bf8787
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/checkout/sdk/src/widgets/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('load', () => {
expect(document.head.innerHTML).toBe(
'<script '
+ 'integrity="sha512-abc123" '
+ 'crossorigin="anonymous" '
+ 'id="immutable-checkout-widgets-bundle" '
+ 'data-version="__SDK_VERSION__" '
+ `src="https://cdn.jsdelivr.net/npm/@imtbl/sdk@${SDK_VERSION}/dist/browser/checkout/widgets.js"></script>`,
Expand Down
1 change: 1 addition & 0 deletions packages/checkout/sdk/src/widgets/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export async function loadUnresolvedBundle(
if (!useLocalBundle()) {
const integrityHash = await generateSHA512Hash(cdnUrl);
tag.setAttribute('integrity', integrityHash);
tag.setAttribute('crossorigin', 'anonymous');
}

tag.setAttribute('id', scriptId);
Expand Down

0 comments on commit 9bf8787

Please sign in to comment.