How to use react-async-script - 8 common examples

To help you get started, we’ve selected a few react-async-script 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 joincivil / Civil / packages / components / src / Tokens / buy / AirswapBuyCVL.tsx View on Github external
token: tokenAddress,
        address: buyFromAddress,
        // amount: amountString,
        onComplete: () => {
          this.props.onComplete();
        },
        onCancel: () => {
          console.info("Trade cancelled");
        },
      },
      "body",
    );
  }
}

export const AirswapBuyCVL = makeAsyncScriptLoader(airswapScript)(BuyCVLBase);
github joincivil / Civil / packages / components / src / Airswap / AirswapSellCVL.tsx View on Github external
// @ts-ignore
    window.AirSwap.Trader.render(
      {
        mode: "sell",
        env: environment,
        token: tokenAddress,
        onComplete: () => {
          this.props.onComplete();
        },
      },
      "body",
    );
  }
}

export const AirswapSellCVL = makeAsyncScriptLoader(airswapScript)(SellCVLBase);
github BulletTrainHQ / bullet-train-frontend / web / components / pages / AccountPage.js View on Github external
) : (
                                    <div>
                                        <h2>Your organisation is on the Startup plan</h2>
                                        <p>Click <a>here</a> if you'd like to cancel your plan</p>
                                    </div>
                                )) : null}
                            
                        )
                    }
                
            
        );
    }
};

const WrappedAccountPage = makeAsyncScriptLoader(ConfigProvider(AccountPage), 'https://js.chargebee.com/v2/chargebee.js', {
    removeOnUnmount: true
});

AccountPage.propTypes = {};

module.exports = (props) =&gt; (
     {
        Chargebee.init({
            site: Project.chargebee.site
        });
        Chargebee.registerAgain();
    }} /&gt;
);
github BulletTrainHQ / bullet-train-frontend / web / components / modals / Payment.js View on Github external
)
                    }
                
            
        );
    }
};

const WrappedPaymentModal = makeAsyncScriptLoader(ConfigProvider(PaymentModal), 'https://js.chargebee.com/v2/chargebee.js', {
    removeOnUnmount: true,
});

PaymentModal.propTypes = {};

module.exports = props =&gt; (
     {
          Chargebee.init({
              site: Project.chargebee.site,
          });
          Chargebee.registerAgain();
          Chargebee.getInstance().setCheckoutCallbacks(cart =&gt; ({
              success: () =&gt; {
                  AppActions.editOrganisation(Object.assign({}, AccountStore.getOrganisation(), {
                      paid_subscription: true,
github dozoisch / react-google-recaptcha / src / recaptcha-wrapper.js View on Github external
function getOptions() {
  return (typeof window !== "undefined" && window.recaptchaOptions) || {};
}
function getURL() {
  const dynamicOptions = getOptions();
  const lang = dynamicOptions.lang ? `&hl=${dynamicOptions.lang}` : "";
  const hostname = dynamicOptions.useRecaptchaNet ? "recaptcha.net" : "www.google.com";
  return `https://${hostname}/recaptcha/api.js?onload=${callbackName}&render=explicit${lang}`;
}

const callbackName = "onloadcallback";
const globalName = "grecaptcha";
const initialOptions = getOptions();

export default makeAsyncScriptLoader(getURL, {
  callbackName,
  globalName,
  removeOnUnmount: initialOptions.removeOnUnmount || false,
})(ReCAPTCHA);
github joincivil / Civil / packages / sdk / src / react / boosts / payments / BoostPayStripe.tsx View on Github external
private renderPaymentForm = (): JSX.Element =&gt; {
    const AsyncScriptLoader = makeAsyncScriptLoader("https://js.stripe.com/v3/")(LoadingMessage);
    if (this.state.stripeLoaded) {
      return (
        
          
            
              {(paymentsCreateStripePayment: MutationFunc) =&gt; {
                return (
github joincivil / Civil / packages / components / src / Payments / PaymentsStripe.tsx View on Github external
public render(): JSX.Element {
    const userChannelID = (this.context &amp;&amp; this.context.currentUser &amp;&amp; this.context.currentUser.userChannel.id) || "";
    const userEmail =
      this.context &amp;&amp; this.context.currentUser &amp;&amp; this.context.currentUser.userChannel.EmailAddressRestricted;
    const AsyncScriptLoader = makeAsyncScriptLoader("https://js.stripe.com/v3/")(LoadingMessage);
    if (this.state.stripeLoaded) {
      return (
        
          
            
              {(paymentsCreateStripePayment: MutationFunc) =&gt; {
                return (
                  
                    {(setEmailMutation: MutationFunc) =&gt; {
                      return (
github MoveOnOrg / Spoke / src / containers / hoc / load-stripe.js View on Github external
render() {
      const WrappedComponent = makeAsyncScriptLoader(
        () =&gt; ,
        'https://js.stripe.com/v2/',
        {
          globalName: 'Stripe'
        }
      )
      return (
        
      )
    }
  }

react-async-script

A composition mixin for loading scripts asynchronously for React

MIT
Latest version published 4 years ago

Package Health Score

68 / 100
Full package analysis

Popular react-async-script functions