Skip to content

Commit d120e40

Browse files
authored
Updates made to style tags to fix inline styling errors with strict CSP. Nonce added to style tags that were resulting in errors being thrown (#2486)
1 parent 8980daa commit d120e40

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Diff for: src/funding/paypal/template.jsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
Style,
88
type ChildType,
99
} from "@krakenjs/jsx-pragmatic/src";
10+
import { getCSPNonce } from "@paypal/sdk-client/src";
1011
import {
1112
PPLogoExternalImage,
1213
PPLogoInlineSVG,
@@ -271,8 +272,10 @@ export function WalletLabelOld(opts: WalletLabelOptions): ?ChildType {
271272
);
272273
}
273274

275+
const cspNonce = getCSPNonce();
276+
274277
return (
275-
<Style css={css}>
278+
<Style nonce={cspNonce} css={css}>
276279
<div class="wallet-label">
277280
<div class="paypal-mark">
278281
{__WEB__ ? (
@@ -472,8 +475,10 @@ export function WalletLabel(opts: WalletLabelOptions): ?ChildType {
472475
attrs[ATTRIBUTE.PAY_NOW] = true;
473476
}
474477

478+
const cspNonce = getCSPNonce();
479+
475480
return (
476-
<Style css={css}>
481+
<Style nonce={cspNonce} css={css}>
477482
<div class="wallet-label-new" {...attrs}>
478483
{branded ? (
479484
<div class="paypal-mark">

Diff for: src/funding/venmo/template.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* @flow */
22
/** @jsx node */
33
import { node, Style, type ChildType } from "@krakenjs/jsx-pragmatic/src";
4+
import { getCSPNonce } from "@paypal/sdk-client/src";
45
import {
56
VenmoLogoExternalImage,
67
VenmoLogoInlineSVG,
@@ -32,8 +33,10 @@ export function WalletLabel({ ...props }: WalletLabelOptions): ChildType {
3233
label = instrument.label;
3334
}
3435

36+
const cspNonce = getCSPNonce();
37+
3538
return (
36-
<Style css={css}>
39+
<Style nonce={cspNonce} css={css}>
3740
<div class="wallet-label-venmo">
3841
<div class="divider">|</div>
3942
{logo && (

Diff for: src/ui/text/text.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
type ChildType,
88
type NullableChildrenType,
99
} from "@krakenjs/jsx-pragmatic/src";
10+
import { getCSPNonce } from "@paypal/sdk-client/src";
1011

1112
import { CLASS, TEXT_COLOR } from "../../constants";
1213

@@ -49,8 +50,10 @@ export function PlaceHolder({
4950
chars,
5051
color = TEXT_COLOR.WHITE,
5152
}: PlaceHolderProps): ChildType {
53+
const cspNonce = getCSPNonce();
54+
5255
return (
53-
<Style css={css}>
56+
<Style nonce={cspNonce} css={css}>
5457
<div class={["placeholder", `color-${color}`].join(" ")}>
5558
{new Array(chars).fill("x").join("")}
5659
</div>

0 commit comments

Comments
 (0)