How to use the belter/src.parseQuery function in belter

To help you get started, we’ve selected a few belter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / paypal-card-components / src / contingency-flow.js View on Github external
function start(url : string) : ZalgoPromise {
  const params = parseQuery(url.split('?')[1]);
  
  const body = document.body;
  if (!body) {
    throw new Error(`No document body available to render to`);
  }

  return new ZalgoPromise((resolve, reject) => {
    contingencyResolveFunction = resolve;

    // $FlowFixMe
    contingency.Component({
      action:              params.action,
      xcomponent:          '1',
      flow:                params.flow,
      cart_id:             params.cart_id,
      onContingencyResult: (err, result) => {
github paypal / paypal-smart-payment-buttons / test / client / mocks.js View on Github external
const onLoad = () => {
            if (!win) {
                throw new Error(`Expecred win to be set`);
            }

            const [ stringUrl, stringQuery ] = currentUrl.split('?');

            if (expectedUrl && stringUrl !== expectedUrl) {
                throw new Error(`Expected url to be ${ expectedUrl }, got ${ stringUrl }`);
            }

            const query = parseQuery(stringQuery);

            for (const key of expectedQuery) {
                if (!query[key]) {
                    throw new Error(`Expected query param: ${ key }`);
                }
            }

            onOpen({
                win,
                url: currentUrl,
                query
            });
        };
github paypal / paypal-smart-payment-buttons / test / client / native.js View on Github external
}).then(res => {
                            if (!res.redirectUrl) {
                                throw new Error(`Expected native redirect url`);
                            }

                            const redirectQuery = parseQuery(res.redirectUrl.split('?')[1]);

                            if (!redirectQuery.sdkMeta) {
                                throw new Error(`Expected sdkMeta to be passed in url`);
                            }

                            if (!redirectQuery.sessionUID) {
                                throw new Error(`Expected sessionUID to be passed in url`);
                            }

                            if (!redirectQuery.pageUrl) {
                                throw new Error(`Expected pageUrl to be passed in url`);
                            }

                            if (!redirectQuery.buttonSessionID) {
                                throw new Error(`Expected sdkMeta to be passed in url`);
                            }
github paypal / paypal-smart-payment-buttons / test / client / native.js View on Github external
window.open = expect('windowOpen', (url) => {
                window.open = windowOpen;

                if (!url) {
                    throw new Error(`Expected url to be immediately passed to window.open`);
                }

                if (url.indexOf('/smart/checkout/native') === -1) {
                    throw new Error(`Expected paypal native url`);
                }

                const query = parseQuery(url.split('?')[1]);
                const { sessionUID, pageUrl } = query;

                if (!sessionUID) {
                    throw new Error(`Expected sessionUID to be passed in url`);
                }

                if (!pageUrl) {
                    throw new Error(`Expected pageUrl to be passed in url`);
                }

                win = {
                    location: {
                        href: url
                    },
                    closed: false,
                    close:  avoid('close')
github paypal / paypal-sdk-client / dist / module / script.js View on Github external
export function getSDKQueryParams() {
    var script = getSDKScript();
    return parseQuery(script.src.split('?')[1] || '');
}
github paypal / paypal-sdk-client / src / script.js View on Github external
export function getSDKQueryParams() : { [string] : string } {
    const script = getSDKScript();
    return parseQuery(script.src.split('?')[1] || '');
}