Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
window.xprops.createOrder = mockAsyncProp(expect('createOrder', async () => {
return ZalgoPromise.try(() => {
return orderID;
});
}));
tryInit(method : () => mixed) : ZalgoPromise> {
return ZalgoPromise.try(method).catch(err => {
this.onInit.reject(err);
}).then(() => {
return this.onInit;
});
}
function initiatePayment({ payment } : { payment : Payment }) : ZalgoPromise {
return ZalgoPromise.try(() => {
if (paymentProcessing) {
return;
}
props = getProps({ facilitatorAccessToken });
const { win, fundingSource } = payment;
const { onClick } = props;
if (onClick) {
onClick({ fundingSource });
}
if (isEnabled()) {
paymentProcessing = true;
openPrerenderFrame() : ZalgoPromise> {
return ZalgoPromise.try(() => {
if (this.driver.openPrerenderFrame) {
return this.driver.openPrerenderFrame.call(this);
}
});
}
function normalizeDomain(win : CrossDomainWindowType, targetDomain : DomainMatcher, actualDomain : ?string, { send } : { send : SendType }) : ZalgoPromise> {
if (typeof targetDomain === 'string') {
return ZalgoPromise.resolve(targetDomain);
}
return ZalgoPromise.try(() => {
return actualDomain || sayHello(win, { send }).then(({ domain }) => domain);
}).then(normalizedDomain => {
if (!matchDomain(targetDomain, targetDomain)) {
throw new Error(`Domain ${ stringify(targetDomain) } does not match ${ stringify(targetDomain) }`);
}
return normalizedDomain;
});
}
render(target : CrossDomainWindowType, container : string | HTMLElement, context : $Values) : ZalgoPromise {
return ZalgoPromise.try(() => {
this.component.log(`render`);
this.driver = RENDER_DRIVERS[context];
const uid = `${ ZOID }-${ this.component.tag }-${ uniqueID() }`;
const domain = this.getDomain();
const childDomain = this.getChildDomain();
this.component.checkAllowRender(target, domain, container);
if (target !== window) {
this.delegate(context, target);
}
const windowProp = this.props.window;
const init = this.initPromise;
const onCancel = once(() => {
return ZalgoPromise.try(() => {
if (approved) {
return false;
}
return validationPromise;
}).then(valid => {
if (!valid) {
return;
}
return createOrder().then(orderID => {
return window.xprops.onCancel({ orderID });
}).catch(err => {
return window.xprops.onError(err);
showComponent() : ZalgoPromise {
return ZalgoPromise.try(() => {
if (this.props.onDisplay) {
return this.props.onDisplay();
}
}).then(() => {
if (this.element) {
return showAndAnimate(this.element, ANIMATION_NAMES.SHOW_COMPONENT, this.clean.register);
}
});
}
runTimeout() : ZalgoPromise {
return ZalgoPromise.try(() => {
const timeout = this.props.timeout;
if (timeout) {
return this.initPromise.timeout(timeout, new Error(`Loading component timed out after ${ timeout } milliseconds`));
}
});
}