Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tosspayments/payment-sdk

Package Overview
Dependencies
Maintainers
0
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tosspayments/payment-sdk - npm Package Compare versions

Comparing version 1.7.2-alpha.0 to 1.7.2-alpha.2.0

70

dist/tosspayments.cjs.js

@@ -5,39 +5,61 @@ 'use strict';

var cachedPromise;
var cachedPromise = null;
function loadScript(src, namespace) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var existingElement = document.querySelector("[src=\"".concat(src, "\"]"));
if (existingElement != null && cachedPromise !== undefined) {
if (cachedPromise != null) {
return cachedPromise;
}
if (existingElement != null && getNamespace(namespace) !== undefined) {
return Promise.resolve(getNamespace(namespace));
}
var promise = new Promise(function (resolve, reject) {
try {
var onLoad = function onLoad() {
if (getNamespace(namespace) != null) {
resolve(getNamespace(namespace));
} else {
reject(new Error("[TossPayments SDK] ".concat(namespace, " is not available")));
}
};
var script = document.createElement('script');
script.src = src;
var onError = function onError() {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
};
if (options.priority !== undefined) {
script.fetchPriority = options.priority;
}
if (typeof window === 'undefined' || typeof document === 'undefined') {
return resolve(null);
}
cachedPromise = new Promise(function (resolve, reject) {
script.onload = function () {
var loadedNamespace = getNamespace(namespace);
if (getNamespace(namespace) != null) {
return resolve(getNamespace(namespace));
}
if (loadedNamespace !== undefined) {
resolve(loadedNamespace);
} else {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
var existingScript = document.querySelector("script[src=\"".concat(src, "\"]"));
if (existingScript != null) {
var _existingScript$paren;
existingScript.removeEventListener('load', onLoad);
existingScript.removeEventListener('error', onError);
(_existingScript$paren = existingScript.parentElement) === null || _existingScript$paren === void 0 ? void 0 : _existingScript$paren.removeChild(existingScript);
}
};
script.onerror = function () {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
};
var script = document.createElement('script');
script.src = src;
script.addEventListener('load', onLoad);
script.addEventListener('error', onError);
document.head.appendChild(script);
if (options.priority != null) {
script.fetchPriority = options.priority;
}
document.head.appendChild(script);
} catch (error) {
reject(error);
return;
}
});
cachedPromise = promise["catch"](function (error) {
cachedPromise = null;
return Promise.reject(error);
});
return cachedPromise;

@@ -48,3 +70,3 @@ }

return window[name];
}
} // Test용

@@ -51,0 +73,0 @@ var SCRIPT_URL = 'https://js.tosspayments.com/v1';

@@ -1,38 +0,60 @@

var cachedPromise;
var cachedPromise = null;
function loadScript(src, namespace) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var existingElement = document.querySelector("[src=\"".concat(src, "\"]"));
if (existingElement != null && cachedPromise !== undefined) {
if (cachedPromise != null) {
return cachedPromise;
}
if (existingElement != null && getNamespace(namespace) !== undefined) {
return Promise.resolve(getNamespace(namespace));
}
var promise = new Promise(function (resolve, reject) {
try {
var onLoad = function onLoad() {
if (getNamespace(namespace) != null) {
resolve(getNamespace(namespace));
} else {
reject(new Error("[TossPayments SDK] ".concat(namespace, " is not available")));
}
};
var script = document.createElement('script');
script.src = src;
var onError = function onError() {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
};
if (options.priority !== undefined) {
script.fetchPriority = options.priority;
}
if (typeof window === 'undefined' || typeof document === 'undefined') {
return resolve(null);
}
cachedPromise = new Promise(function (resolve, reject) {
script.onload = function () {
var loadedNamespace = getNamespace(namespace);
if (getNamespace(namespace) != null) {
return resolve(getNamespace(namespace));
}
if (loadedNamespace !== undefined) {
resolve(loadedNamespace);
} else {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
var existingScript = document.querySelector("script[src=\"".concat(src, "\"]"));
if (existingScript != null) {
var _existingScript$paren;
existingScript.removeEventListener('load', onLoad);
existingScript.removeEventListener('error', onError);
(_existingScript$paren = existingScript.parentElement) === null || _existingScript$paren === void 0 ? void 0 : _existingScript$paren.removeChild(existingScript);
}
};
script.onerror = function () {
reject(new Error("[TossPayments SDK] Failed to load script: [".concat(src, "]")));
};
var script = document.createElement('script');
script.src = src;
script.addEventListener('load', onLoad);
script.addEventListener('error', onError);
document.head.appendChild(script);
if (options.priority != null) {
script.fetchPriority = options.priority;
}
document.head.appendChild(script);
} catch (error) {
reject(error);
return;
}
});
cachedPromise = promise["catch"](function (error) {
cachedPromise = null;
return Promise.reject(error);
});
return cachedPromise;

@@ -43,3 +65,3 @@ }

return window[name];
}
} // Test용

@@ -46,0 +68,0 @@ var SCRIPT_URL = 'https://js.tosspayments.com/v1';

{
"name": "@tosspayments/payment-sdk",
"description": "TossPayments.js Payment SDK",
"version": "1.7.2-alpha.0",
"version": "1.7.2-alpha.2.0",
"main": "dist/tosspayments.cjs.js",

@@ -12,3 +12,3 @@ "module": "dist/tosspayments.esm.js",

"prepack": "yarn build",
"test": "jest",
"test": "vitest",
"typecheck": "tsc --noEmit"

@@ -24,11 +24,10 @@ },

"@rollup/plugin-typescript": "^8.3.0",
"@tosspayments/sdk-loader": "1.2.1-alpha.0",
"@types/jest": "^27.0.0",
"jest": "^27.0.7",
"@tosspayments/sdk-loader": "1.2.1-alpha.1.0",
"happy-dom": "^14.12.3",
"prettier": "^2.0.2",
"rollup": "^2.60.0",
"rollup-plugin-babel": "^4.4.0",
"ts-jest": "^27.0.7",
"tslib": "^1.11.1",
"typescript": "^4.5.2"
"typescript": "5.2.2",
"vitest": "^1.6.0"
},

@@ -45,3 +44,3 @@ "files": [

},
"gitHead": "61a4736909d1d7df660bb2af567ed46567961e9c"
"gitHead": "b50d0d5975b9d6e8dec619a72ab468d0059586c3"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc