diff --git a/src/factory.ts b/src/factory.ts index 58474114..b832055b 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -37,6 +37,10 @@ export const createPlaid = (options: PlaidLinkOptions) => { throw new Error('Plaid not loaded'); } + // Pass jss nonce if it's set + const nonceNode = document.querySelector('meta[property="csp-nonce"]') + options.nonce = nonceNode ? nonceNode.getAttribute('content') : null + const config = renameKeyInObject( options, 'publicKey', diff --git a/src/types/index.ts b/src/types/index.ts index 5203fe6c..78d2a692 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -12,6 +12,8 @@ interface CommonPlaidLinkOptions { onLoad?: Function; // A callback that is called during a user's flow in Link. onEvent?: Function; + // jss nonce setting from the page if the user has set it. + nonce?: string | null } export type PlaidLinkOptionsWithPublicKey = (CommonPlaidLinkOptions & {