@rebornpay/checkout-seon 0.1.0

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/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @rebornpay/checkout-seon
2
+
3
+ SEON device fingerprint helpers for RebornPay public checkout.
4
+
5
+ ```ts
6
+ import { initCheckoutSeon, collectSeonSession } from "@rebornpay/checkout-seon";
7
+
8
+ await initCheckoutSeon();
9
+ const seonSession = await collectSeonSession();
10
+ ```
11
+
12
+ Pass `seonSession` to `POST /v1/checkout-sessions/{id}/confirm`.
package/dist/index.cjs ADDED
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ collectSeonSession: () => collectSeonSession,
34
+ initCheckoutSeon: () => initCheckoutSeon
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+ var import_seon_javascript_sdk = __toESM(require("@seontechnologies/seon-javascript-sdk"), 1);
38
+ var initialized = false;
39
+ async function initCheckoutSeon() {
40
+ if (initialized || typeof window === "undefined") {
41
+ return;
42
+ }
43
+ await import_seon_javascript_sdk.default.init();
44
+ initialized = true;
45
+ }
46
+ async function collectSeonSession() {
47
+ if (typeof window === "undefined") {
48
+ return null;
49
+ }
50
+ try {
51
+ await initCheckoutSeon();
52
+ const session = await import_seon_javascript_sdk.default.getSession();
53
+ return typeof session === "string" && session.length > 0 ? session : null;
54
+ } catch {
55
+ return null;
56
+ }
57
+ }
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ collectSeonSession,
61
+ initCheckoutSeon
62
+ });
63
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import seon from \"@seontechnologies/seon-javascript-sdk\";\n\nlet initialized = false;\n\n/**\n * Initializes the SEON JavaScript agent. Safe to call multiple times.\n */\nexport async function initCheckoutSeon(): Promise<void> {\n if (initialized || typeof window === \"undefined\") {\n return;\n }\n await seon.init();\n initialized = true;\n}\n\n/**\n * Collects an encrypted Base64 session payload for the Fraud API `session` field.\n * Returns null when collection fails (checkout should still proceed; backend fail-open applies).\n */\nexport async function collectSeonSession(): Promise<string | null> {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n try {\n await initCheckoutSeon();\n const session = await seon.getSession();\n return typeof session === \"string\" && session.length > 0 ? session : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAAiB;AAEjB,IAAI,cAAc;AAKlB,eAAsB,mBAAkC;AACtD,MAAI,eAAe,OAAO,WAAW,aAAa;AAChD;AAAA,EACF;AACA,QAAM,2BAAAA,QAAK,KAAK;AAChB,gBAAc;AAChB;AAMA,eAAsB,qBAA6C;AACjE,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,iBAAiB;AACvB,UAAM,UAAU,MAAM,2BAAAA,QAAK,WAAW;AACtC,WAAO,OAAO,YAAY,YAAY,QAAQ,SAAS,IAAI,UAAU;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["seon"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Initializes the SEON JavaScript agent. Safe to call multiple times.
3
+ */
4
+ declare function initCheckoutSeon(): Promise<void>;
5
+ /**
6
+ * Collects an encrypted Base64 session payload for the Fraud API `session` field.
7
+ * Returns null when collection fails (checkout should still proceed; backend fail-open applies).
8
+ */
9
+ declare function collectSeonSession(): Promise<string | null>;
10
+
11
+ export { collectSeonSession, initCheckoutSeon };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Initializes the SEON JavaScript agent. Safe to call multiple times.
3
+ */
4
+ declare function initCheckoutSeon(): Promise<void>;
5
+ /**
6
+ * Collects an encrypted Base64 session payload for the Fraud API `session` field.
7
+ * Returns null when collection fails (checkout should still proceed; backend fail-open applies).
8
+ */
9
+ declare function collectSeonSession(): Promise<string | null>;
10
+
11
+ export { collectSeonSession, initCheckoutSeon };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ // src/index.ts
2
+ import seon from "@seontechnologies/seon-javascript-sdk";
3
+ var initialized = false;
4
+ async function initCheckoutSeon() {
5
+ if (initialized || typeof window === "undefined") {
6
+ return;
7
+ }
8
+ await seon.init();
9
+ initialized = true;
10
+ }
11
+ async function collectSeonSession() {
12
+ if (typeof window === "undefined") {
13
+ return null;
14
+ }
15
+ try {
16
+ await initCheckoutSeon();
17
+ const session = await seon.getSession();
18
+ return typeof session === "string" && session.length > 0 ? session : null;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+ export {
24
+ collectSeonSession,
25
+ initCheckoutSeon
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import seon from \"@seontechnologies/seon-javascript-sdk\";\n\nlet initialized = false;\n\n/**\n * Initializes the SEON JavaScript agent. Safe to call multiple times.\n */\nexport async function initCheckoutSeon(): Promise<void> {\n if (initialized || typeof window === \"undefined\") {\n return;\n }\n await seon.init();\n initialized = true;\n}\n\n/**\n * Collects an encrypted Base64 session payload for the Fraud API `session` field.\n * Returns null when collection fails (checkout should still proceed; backend fail-open applies).\n */\nexport async function collectSeonSession(): Promise<string | null> {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n try {\n await initCheckoutSeon();\n const session = await seon.getSession();\n return typeof session === \"string\" && session.length > 0 ? session : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,IAAI,cAAc;AAKlB,eAAsB,mBAAkC;AACtD,MAAI,eAAe,OAAO,WAAW,aAAa;AAChD;AAAA,EACF;AACA,QAAM,KAAK,KAAK;AAChB,gBAAc;AAChB;AAMA,eAAsB,qBAA6C;AACjE,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,iBAAiB;AACvB,UAAM,UAAU,MAAM,KAAK,WAAW;AACtC,WAAO,OAAO,YAAY,YAAY,QAAQ,SAAS,IAAI,UAAU;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@rebornpay/checkout-seon",
3
+ "version": "0.1.0",
4
+ "description": "Browser-side SEON device fingerprint helpers for RebornPay checkout",
5
+ "license": "MIT",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/rebornpay-io/reborn-ecosystem.git",
12
+ "directory": "packages/checkout-seon"
13
+ },
14
+ "type": "module",
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "main": "./dist/index.cjs",
20
+ "module": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "import": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./dist/index.d.cts",
30
+ "default": "./dist/index.cjs"
31
+ }
32
+ }
33
+ },
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "keywords": [
38
+ "rebornpay",
39
+ "checkout",
40
+ "seon",
41
+ "antifraud",
42
+ "fingerprint"
43
+ ],
44
+ "dependencies": {
45
+ "@seontechnologies/seon-javascript-sdk": "^6.10.9"
46
+ },
47
+ "devDependencies": {
48
+ "tsup": "^8.5.0",
49
+ "typescript": "^5"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup",
53
+ "lint": "tsc -p tsconfig.json --noEmit",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit"
55
+ }
56
+ }