Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/zoid/qr-code/container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { destroyElement, type EventEmitterType } from "@krakenjs/belter/src";
import { EVENT, type RenderOptionsType } from "@krakenjs/zoid/src";
import { node, dom, type ChildType } from "@krakenjs/jsx-pragmatic/src";
import { getCSPNonce } from "@paypal/sdk-client/src";

import { type QRCodeProps } from "./types";

Expand Down Expand Up @@ -113,7 +114,6 @@ export function QRCodeContainer({
export function containerTemplate({
frame,
prerenderFrame,
props,
doc,
uid,
event,
Expand All @@ -122,7 +122,7 @@ export function containerTemplate({
return;
}

const { cspNonce } = props;
const cspNonce = __WEB__ ? getCSPNonce() : undefined;

return (
<QRCodeContainer
Expand Down
10 changes: 5 additions & 5 deletions src/zoid/qr-code/prerender.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
import { type RenderOptionsType } from "@krakenjs/zoid/src";
import { node, dom } from "@krakenjs/jsx-pragmatic/src";
import { SpinnerPage } from "@paypal/common-components/src";
import { getCSPNonce } from "@paypal/sdk-client/src";

import { type QRCodeProps } from "./types";

export function prerenderTemplate({
doc,
props,
close,
}: RenderOptionsType<QRCodeProps>): ?HTMLElement {
const cspNonce = __WEB__ ? getCSPNonce() : undefined;

const style = `
#close {
position: absolute;
Expand Down Expand Up @@ -42,11 +44,9 @@ export function prerenderTemplate({
`;

const children = [
<style nonce={props.cspNonce} innerHTML={style} />,
<style nonce={cspNonce} innerHTML={style} />,
<a href="#" id="close" aria-label="close" role="button" onClick={close} />,
];

return new SpinnerPage({ nonce: props.cspNonce }, children).render(
dom({ doc })
);
return new SpinnerPage({ nonce: cspNonce }, children).render(dom({ doc }));
}