Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Checkout.renderTo = (win) => {
info('force_ie_full_page');
flushLogs();
// $FlowFixMe
const checkout = Checkout.init({
onAuthorize: noop
});
checkout.delegate(win);
checkout.openContainer().then(() => {
checkout.event.triggerOnce(CONSTANTS.EVENTS.CLOSE);
checkout.showContainer();
});
// $FlowFixMe
Button.xprops.payment().then(token => {
}).catch(err => {
info('pptm_script_error', { error: stringifyError(err) });
});
}
}
if (isCheckpointUnique(`${ name }_${ treatment }`)) {
track({
[ FPTI.KEY.STATE ]: FPTI.STATE.PXP,
[ FPTI.KEY.TRANSITION ]: FPTI.TRANSITION.PXP,
[ FPTI.KEY.EXPERIMENT_NAME ]: name,
[ FPTI.KEY.TREATMENT_NAME ]: treatment,
...payload
});
}
let event = `${ name }_${ treatment }_${ checkpointName }`;
if (isCheckpointUnique(event)) {
info(event, { ...payload, expuid: uid });
}
flushLogs();
return this;
},
function shouldCreateInitialPptmScript() : boolean {
const id = window.location.hostname;
if (!id) {
return false;
}
if (isPayPalDomain()) {
return false;
}
const existingScript = getElement(PPTM_ID);
const alreadyDownloaded = Boolean(existingScript);
if (alreadyDownloaded) {
info('pptm_tried_loading_twice');
return false;
}
return true;
}
export function createPptmScript() {
const id = window.location.hostname;
if (!id) {
return;
}
const alreadyDownloaded = Boolean(getElement(PPTM_ID));
if (alreadyDownloaded) {
info('pptm_tried_loading_twice');
return;
}
track({
[ FPTI.KEY.STATE ]: FPTI.STATE.PPTM,
[ FPTI.KEY.TRANSITION ]: FPTI.TRANSITION.PPTM_LOAD
});
const fullUrl = extendUrl(config.pptmUrl, {
t: 'xo',
id: window.location.hostname,
mrid: config.merchantID
});
loadScript(fullUrl, 0, { async: true, id: PPTM_ID }).then(() => {
track({
}).catch(err => {
info('pptm_script_error', { error: stringifyError(err) });
});
},
log(event, payload = {}) {
$logger.info(`xc_${this.name}_${event}`, payload);
}