2
0

(engine) Improve engine overall robustness

This commit is contained in:
Baptiste Arnaud
2023-01-25 11:27:47 +01:00
parent ff62b922a0
commit 30baa611e5
210 changed files with 1820 additions and 1919 deletions

View File

@ -1,4 +1,4 @@
import { GoogleAnalyticsOptions } from 'models'
import type { GoogleAnalyticsOptions } from 'models'
declare const gtag: (
type: string,

View File

@ -0,0 +1,13 @@
import { Stripe } from '@stripe/stripe-js'
export const loadStripe = (publishableKey: string): Promise<Stripe> =>
new Promise<Stripe>((resolve) => {
if (window.Stripe) return resolve(window.Stripe(publishableKey))
const script = document.createElement('script')
script.src = 'https://js.stripe.com/v3'
document.body.appendChild(script)
script.onload = () => {
if (!window.Stripe) throw new Error('Stripe.js failed to load.')
resolve(window.Stripe(publishableKey))
}
})