Socket
Socket
Sign inDemoInstall

react-stripe-script-loader

Package Overview
Dependencies
8
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

src/loadScript.js

2

package.json
{
"name": "react-stripe-script-loader",
"version": "1.0.2",
"version": "1.0.3",
"description": "React component that lets load Stripe script and shows React Stripe Elements",

@@ -5,0 +5,0 @@ "main": "index.js",

import React, { useState, useEffect } from 'react'
import loadScript from './loadScript'
const loadScript = (src, uniqueId) =>
new Promise((resolve, reject) => {
const scriptElement = document.getElementById(uniqueId)
if (!scriptElement) {
const script = document.createElement('script')
script.src = src
script.id = uniqueId
const handleLoadScriptSuccess = () => resolve({ successful: true })
const handleLoadScriptFail = event => reject({ error: event })
script.addEventListener('load', handleLoadScriptSuccess, { once: true })
script.addEventListener('error', handleLoadScriptFail, { once: true })
document.head.appendChild(script)
} else {
resolve({ successful: true })
}
})
const StripeScriptLoader = ({

@@ -24,0 +5,0 @@ children,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc