Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getSDKMeta() : string {
return base64encode(JSON.stringify({
url: getScriptUrl(),
stageHost: getStageHost(),
apiStageHost: getAPIStageHost()
})).replace(/\=+$/, ''); // eslint-disable-line no-useless-escape
}
it('should successfully get client access token', () => {
const clientAccessToken = 'abc12354321';
const clientToken = base64encode(JSON.stringify({
paypal: {
accessToken: clientAccessToken
}
}));
const url = insertMockSDKScript({
attributes: {
'data-client-token': clientToken
}
});
if (clientAccessToken !== getClientAccessToken()) {
throw new Error(`Expected client access token to be ${ clientAccessToken }, got ${ getClientAccessToken() || 'undefined' } from ${ url }`);
}
});
def: () => {
return base64encode(JSON.stringify({
url: getCurrentScriptUrl()
}));
}
}
return inlineMemoize(createAccessToken, () => {
getLogger().info(`rest_api_create_access_token`);
const basicAuth = base64encode(`${ clientID }:`);
return request({
method: `post`,
url: AUTH_API_URL,
headers: {
Authorization: `Basic ${ basicAuth }`
},
data: {
grant_type: `client_credentials`
}
}).then(({ body }) => {
if (body && body.error === 'invalid_client') {
throw new Error(`Auth Api invalid client id: ${ clientID }:\n\n${ JSON.stringify(body, null, 4) }`);
export function buildChildWindowName(name, childPayload) {
var normalizedName = normalizeString(name);
var encodedPayload = base64encode(JSON.stringify(childPayload));
return '__' + ZOID + '__' + normalizedName + '__' + encodedPayload + '__';
}
def: () => {
return base64encode(JSON.stringify({
url: getCurrentScriptUrl()
}));
}
},
buildWindowName({ proxyWin, childDomain, domain, target, uid, context } : { proxyWin : ProxyWindow, childDomain : string, domain : string | RegExp, target : CrossDomainWindowType, context : $Values, uid : string }) : string {
const childPayload = this.buildChildPayload({ proxyWin, childDomain, domain, target, context, uid });
return `__${ ZOID }__${ this.component.name }__${ base64encode(JSON.stringify(childPayload)) }__`;
}
const paypalLogo = (typeof fundingLogos.paypal === 'function')
? fundingLogos.paypal({ logoColor })
: fundingLogos.paypal[logoColor];
const el = (
<div aria-label="PayPal Checkout Overlay" aria-modal="true" role="dialog" class="{" id="{">
<a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
</a><div class="paypal-checkout-modal"><a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
<div class="paypal-checkout-logo">
<img src="{" alt="pp" class="paypal-checkout-logo-pp">
<img src="{" alt="paypal" class="paypal-checkout-logo-paypal">
</div>
<div class="paypal-checkout-message">
{content.windowMessage}
</div>
</a><div class="paypal-checkout-continue"><a role="button" aria-label="close" close="" class="paypal-checkout-close" href="#">
</a><a href="#">{content.continue}</a>
</div>
<div class="paypal-checkout-loader">
<div class="paypal-spinner">
</div>
</div>
<div class="paypal-checkout-iframe-container">
{outlet}
</div>
</div></div>
return inlineMemoize(createAccessToken, () => {
getLogger().info(`rest_api_create_access_token`);
const basicAuth = base64encode(`${ clientID }:`);
return request({
method: `post`,
url: getAuthAPIUrl(),
headers: {
Authorization: `Basic ${ basicAuth }`
},
data: {
grant_type: `client_credentials`
}
}).then(({ body }) => {
if (body && body.error === 'invalid_client') {
throw new Error(`Auth Api invalid client id: ${ clientID }:\n\n${ JSON.stringify(body, null, 4) }`);
return cards.map(name => {
const logo = cardLogos[name];
return (
<div tabindex="0" class="{" name="" size="">
<img name="" alt="{" src="{" style="{">
</div>
);
});
}