react-stripe-script-loader
Advanced tools
Comparing version 1.0.3 to 1.0.5
47
index.js
@@ -10,3 +10,3 @@ "use strict"; | ||
var _loadScript = _interopRequireDefault(require("./src/loadScript")); | ||
var _loadScript = _interopRequireDefault(require("./loadScript")); | ||
@@ -81,46 +81,1 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _default; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var loadScript = function loadScript(src, uniqueId) { | ||
return new Promise(function (resolve, reject) { | ||
var scriptElement = document.getElementById(uniqueId); | ||
if (!scriptElement) { | ||
var script = document.createElement('script'); | ||
script.src = src; | ||
script.id = uniqueId; | ||
var handleLoadScriptSuccess = function handleLoadScriptSuccess() { | ||
return resolve({ | ||
successful: true | ||
}); | ||
}; | ||
var handleLoadScriptFail = function handleLoadScriptFail(event) { | ||
return reject({ | ||
error: event | ||
}); | ||
}; | ||
script.addEventListener('load', handleLoadScriptSuccess, { | ||
once: true | ||
}); | ||
script.addEventListener('error', handleLoadScriptFail, { | ||
once: true | ||
}); | ||
document.head.appendChild(script); | ||
} else { | ||
resolve({ | ||
successful: true | ||
}); | ||
} | ||
}); | ||
}; | ||
var _default = loadScript; | ||
exports.default = _default; |
{ | ||
"name": "react-stripe-script-loader", | ||
"version": "1.0.3", | ||
"version": "1.0.5", | ||
"description": "React component that lets load Stripe script and shows React Stripe Elements", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"build": "./node_modules/.bin/babel src --out-file index.js" | ||
"build": "./node_modules/.bin/babel src/index.js --out-file index.js" | ||
}, | ||
@@ -11,0 +11,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
334811
98