@rebilly/framepay 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/index.d.ts +1790 -0
- package/dist/index.es.js +29 -0
- package/dist/index.umd.cjs +33 -0
- package/package.json +43 -0
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const DEFAULT_SCRIPT_LINK = "https://framepay.rebilly.com/framepay.js";
|
|
2
|
+
const DEFAULT_STYLE_LINK = "https://framepay.rebilly.com/framepay.css";
|
|
3
|
+
async function loadFramepay({
|
|
4
|
+
scriptLink,
|
|
5
|
+
styleLink
|
|
6
|
+
} = {}) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
if (window.Framepay) {
|
|
9
|
+
resolve(window.Framepay);
|
|
10
|
+
} else {
|
|
11
|
+
const framepayStyle = document.createElement("link");
|
|
12
|
+
framepayStyle.setAttribute("href", styleLink ?? DEFAULT_STYLE_LINK);
|
|
13
|
+
framepayStyle.setAttribute("rel", "stylesheet");
|
|
14
|
+
document.head.prepend(framepayStyle);
|
|
15
|
+
const framepayScript = document.createElement("script");
|
|
16
|
+
framepayScript.setAttribute("src", scriptLink ?? DEFAULT_SCRIPT_LINK);
|
|
17
|
+
framepayScript.onload = () => resolve(window.Framepay);
|
|
18
|
+
framepayScript.onerror = () => reject(
|
|
19
|
+
new Error(
|
|
20
|
+
"@rebilly/framepay npm package: Failed to load FramePay script"
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
document.head.append(framepayScript);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
loadFramepay
|
|
29
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.framepay = {}));
|
|
3
|
+
})(this, function(exports2) {
|
|
4
|
+
"use strict";
|
|
5
|
+
const DEFAULT_SCRIPT_LINK = "https://framepay.rebilly.com/framepay.js";
|
|
6
|
+
const DEFAULT_STYLE_LINK = "https://framepay.rebilly.com/framepay.css";
|
|
7
|
+
async function loadFramepay({
|
|
8
|
+
scriptLink,
|
|
9
|
+
styleLink
|
|
10
|
+
} = {}) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
if (window.Framepay) {
|
|
13
|
+
resolve(window.Framepay);
|
|
14
|
+
} else {
|
|
15
|
+
const framepayStyle = document.createElement("link");
|
|
16
|
+
framepayStyle.setAttribute("href", styleLink ?? DEFAULT_STYLE_LINK);
|
|
17
|
+
framepayStyle.setAttribute("rel", "stylesheet");
|
|
18
|
+
document.head.prepend(framepayStyle);
|
|
19
|
+
const framepayScript = document.createElement("script");
|
|
20
|
+
framepayScript.setAttribute("src", scriptLink ?? DEFAULT_SCRIPT_LINK);
|
|
21
|
+
framepayScript.onload = () => resolve(window.Framepay);
|
|
22
|
+
framepayScript.onerror = () => reject(
|
|
23
|
+
new Error(
|
|
24
|
+
"@rebilly/framepay npm package: Failed to load FramePay script"
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
document.head.append(framepayScript);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports2.loadFramepay = loadFramepay;
|
|
32
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
33
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rebilly/framepay",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A wrapper to load Rebilly's FramePay library and provide TypeScript types",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"framepay",
|
|
9
|
+
"rebilly",
|
|
10
|
+
"billing",
|
|
11
|
+
"payment"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"main": "./dist/index.es.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./dist/index.es.js",
|
|
25
|
+
"require": "./dist/index.umd.cjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc && vite build"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@types/applepayjs": "^14.0.8",
|
|
33
|
+
"@types/googlepay": "^0.7.6",
|
|
34
|
+
"rebilly-js-sdk": "*"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@rebilly/eslint-config": "*",
|
|
38
|
+
"@rebilly/framepay-app": "*",
|
|
39
|
+
"typescript": "^5.4.5",
|
|
40
|
+
"vite": "^5.4.9",
|
|
41
|
+
"vite-plugin-dts": "^4.2.4"
|
|
42
|
+
}
|
|
43
|
+
}
|