Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function renderCheckout(props = {}, context = CONTEXT.POPUP) {
let approved = false;
const payment = memoize(() => {
if (window.xprops.createSubscription) {
return window.xprops.createSubscription({}, {}).then(generateOrderID);
} else if (window.xprops.createBillingAgreement) {
return window.xprops.createBillingAgreement({}, {}).then(generateOrderID);
} else if (window.xprops.createOrder) {
return window.xprops.createOrder({}, {
order: {
create: generateOrderID
}
});
} else {
return ZalgoPromise.try(generateOrderID);
}
runOnClick(() => {
return window.paypal.Checkout({
payment: window.xprops.payment,
onAuthorize: window.xprops.onAuthorize,
onCancel: window.xprops.onCancel,
onError: window.xprops.onError
}).renderTo(window.parent.parent, 'body', CONTEXT.POPUP);
});
node('div', { class: CLASS.OUTLET },
node('node', { el: frame }),
node('node', { el: prerenderFrame })),
node('style', null, `
#${ uid } {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 999;
}
#${ uid }.${ tag }-context-${ CONTEXT.POPUP } {
cursor: pointer;
}
#${ uid }.${ tag }-context-${ CONTEXT.IFRAME } .${ CLASS.OUTLET } {
box-shadow: 2px 2px 10px 3px rgba(0, 0, 0, 0.4);
position: fixed;
top: 50%;
left: 50%;
transform: translate3d(-50%, -50%, 0);
-webkit-transform: translate3d(-50%, -50%, 0);
-moz-transform: translate3d(-50%, -50%, 0);
-o-transform: translate3d(-50%, -50%, 0);
-ms-transform: translate3d(-50%, -50%, 0);
}
#${ uid }.${ tag }-context-${ CONTEXT.IFRAME } .${ CLASS.OUTLET } {
background-color: rgba(0, 0, 0, 0.8);
background: radial-gradient(50% 50%, ellipse closest-corner, rgba(0,0,0,0.6) 1%, rgba(0,0,0,0.8) 100%);
color: #fff;
}
#${ uid } a {
color: #fff;
}
#${ uid } .paypal-checkout-close:before,
#${ uid } .paypal-checkout-close:after {
background-color: #fff;
}
#${ uid }.${ tag }-context-${ CONTEXT.POPUP } {
cursor: pointer;
}
#${ uid } a {
text-decoration: none;
}
#${ uid } .paypal-checkout-modal {
font-family: "HelveticaNeue", "HelveticaNeue-Light", "Helvetica Neue Light", helvetica, arial, sans-serif;
font-size: 14px;
text-align: center;
box-sizing: border-box;
max-width: 350px;
top: 50%;
left: 50%;