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

@onefootprint/footprint-js

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onefootprint/footprint-js - npm Package Compare versions

Comparing version 0.3.1-beta.5 to 0.3.1-beta.6

205

dist/footprint-js.js

@@ -1,4 +0,4 @@

var L = Object.defineProperty;
var A = (n, t, e) => t in n ? L(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
var b = (n, t, e) => (A(n, typeof t != "symbol" ? t + "" : t, e), e);
var I = Object.defineProperty;
var P = (n, e, t) => e in n ? I(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
var b = (n, e, t) => (P(n, typeof e != "symbol" ? e + "" : e, t), t);
var f = /* @__PURE__ */ ((n) => (n.closed = "closed", n.completed = "completed", n.canceled = "canceled", n))(f || {});

@@ -12,13 +12,13 @@ /**

**/
var h = "application/x-postmate-v1+json", I = 5, P = 0, k = function() {
return ++P;
var h = "application/x-postmate-v1+json", k = 5, D = 0, V = function() {
return ++D;
}, d = function() {
var t;
return p.debug ? (t = console).log.apply(t, arguments) : null;
}, D = function(t) {
var e = document.createElement("a");
e.href = t;
var r = e.protocol.length > 4 ? e.protocol : window.location.protocol, o = e.host.length ? e.port === "80" || e.port === "443" ? e.hostname : e.host : window.location.host;
return e.origin || r + "//" + o;
}, V = {
var e;
return p.debug ? (e = console).log.apply(e, arguments) : null;
}, R = function(e) {
var t = document.createElement("a");
t.href = e;
var r = t.protocol.length > 4 ? t.protocol : window.location.protocol, o = t.host.length ? t.port === "80" || t.port === "443" ? t.hostname : t.host : window.location.host;
return t.origin || r + "//" + o;
}, M = {
handshake: 1,

@@ -30,11 +30,11 @@ "handshake-reply": 1,

request: 1
}, y = function(t, e) {
return !(typeof e == "string" && t.origin !== e || !t.data || typeof t.data == "object" && !("postmate" in t.data) || t.data.type !== h || !V[t.data.postmate]);
}, R = function(t, e) {
var r = typeof t[e] == "function" ? t[e]() : t[e];
}, y = function(e, t) {
return !(typeof t == "string" && e.origin !== t || !e.data || typeof e.data == "object" && !("postmate" in e.data) || e.data.type !== h || !M[e.data.postmate]);
}, B = function(e, t) {
var r = typeof e[t] == "function" ? e[t]() : e[t];
return p.Promise.resolve(r);
}, M = /* @__PURE__ */ function() {
function n(e) {
}, F = /* @__PURE__ */ function() {
function n(t) {
var r = this;
this.parent = e.parent, this.frame = e.frame, this.child = e.child, this.childOrigin = e.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (d("Parent: Registering API"), d("Parent: Awaiting messages...")), this.listener = function(o) {
this.parent = t.parent, this.frame = t.frame, this.child = t.child, this.childOrigin = t.childOrigin, this.events = {}, process.env.NODE_ENV !== "production" && (d("Parent: Registering API"), d("Parent: Awaiting messages...")), this.listener = function(o) {
if (!y(o, r.childOrigin))

@@ -46,7 +46,7 @@ return !1;

}
var t = n.prototype;
return t.get = function(r) {
var e = n.prototype;
return e.get = function(r) {
var o = this;
return new p.Promise(function(i) {
var a = k(), s = function c(l) {
var a = V(), s = function c(l) {
l.data.uid === a && l.data.postmate === "reply" && (o.parent.removeEventListener("message", c, !1), i(l.data.value));

@@ -61,3 +61,3 @@ };

});
}, t.call = function(r, o) {
}, e.call = function(r, o) {
this.child.postMessage({

@@ -69,11 +69,11 @@ postmate: "call",

}, this.childOrigin);
}, t.on = function(r, o) {
}, e.on = function(r, o) {
this.events[r] = o;
}, t.destroy = function() {
}, e.destroy = function() {
process.env.NODE_ENV !== "production" && d("Parent: Destroying Postmate instance"), window.removeEventListener("message", this.listener, !1), this.frame.parentNode.removeChild(this.frame);
}, n;
}(), B = /* @__PURE__ */ function() {
function n(e) {
}(), S = /* @__PURE__ */ function() {
function n(t) {
var r = this;
this.model = e.model, this.parent = e.parent, this.parentOrigin = e.parentOrigin, this.child = e.child, process.env.NODE_ENV !== "production" && (d("Child: Registering API"), d("Child: Awaiting messages...")), this.child.addEventListener("message", function(o) {
this.model = t.model, this.parent = t.parent, this.parentOrigin = t.parentOrigin, this.child = t.child, process.env.NODE_ENV !== "production" && (d("Child: Registering API"), d("Child: Awaiting messages...")), this.child.addEventListener("message", function(o) {
if (!!y(o, r.parentOrigin)) {

@@ -86,3 +86,3 @@ process.env.NODE_ENV !== "production" && d("Child: Received request", o.data);

}
R(r.model, a).then(function(l) {
B(r.model, a).then(function(l) {
return o.source.postMessage({

@@ -99,4 +99,4 @@ property: a,

}
var t = n.prototype;
return t.emit = function(r, o) {
var e = n.prototype;
return e.emit = function(r, o) {
process.env.NODE_ENV !== "production" && d('Child: Emitting Event "' + r + '"', o), this.parent.postMessage({

@@ -112,12 +112,12 @@ postmate: "emit",

}(), p = /* @__PURE__ */ function() {
function n(e) {
var r = e.container, o = r === void 0 ? typeof o < "u" ? o : document.body : r, i = e.model, a = e.url, s = e.name, c = e.classListArray, l = c === void 0 ? [] : c;
function n(t) {
var r = t.container, o = r === void 0 ? typeof o < "u" ? o : document.body : r, i = t.model, a = t.url, s = t.name, c = t.classListArray, l = c === void 0 ? [] : c;
return this.parent = window, this.frame = document.createElement("iframe"), this.frame.name = s || "", this.frame.classList.add.apply(this.frame.classList, l), o.appendChild(this.frame), this.child = this.frame.contentWindow || this.frame.contentDocument.parentWindow, this.model = i || {}, this.sendHandshake(a);
}
var t = n.prototype;
return t.sendHandshake = function(r) {
var o = this, i = D(r), a = 0, s;
var e = n.prototype;
return e.sendHandshake = function(r) {
var o = this, i = R(r), a = 0, s;
return new n.Promise(function(c, l) {
var u = function m(v) {
return y(v, i) ? v.data.postmate === "handshake-reply" ? (clearInterval(s), process.env.NODE_ENV !== "production" && d("Parent: Received handshake reply from Child"), o.parent.removeEventListener("message", m, !1), o.childOrigin = v.origin, process.env.NODE_ENV !== "production" && d("Parent: Saving Child origin", o.childOrigin), c(new M(o))) : (process.env.NODE_ENV !== "production" && d("Parent: Invalid handshake reply"), l("Failed handshake")) : !1;
return y(v, i) ? v.data.postmate === "handshake-reply" ? (clearInterval(s), process.env.NODE_ENV !== "production" && d("Parent: Received handshake reply from Child"), o.parent.removeEventListener("message", m, !1), o.childOrigin = v.origin, process.env.NODE_ENV !== "production" && d("Parent: Saving Child origin", o.childOrigin), c(new F(o))) : (process.env.NODE_ENV !== "production" && d("Parent: Invalid handshake reply"), l("Failed handshake")) : !1;
};

@@ -132,3 +132,3 @@ o.parent.addEventListener("message", u, !1);

model: o.model
}, i), a === I && clearInterval(s);
}, i), a === k && clearInterval(s);
}, w = function() {

@@ -152,7 +152,7 @@ E(), s = setInterval(E, 500);

p.Model = /* @__PURE__ */ function() {
function n(e) {
return this.child = window, this.model = e, this.parent = this.child.parent, this.sendHandshakeReply();
function n(t) {
return this.child = window, this.model = t, this.parent = this.child.parent, this.sendHandshakeReply();
}
var t = n.prototype;
return t.sendHandshakeReply = function() {
var e = n.prototype;
return e.sendHandshakeReply = function() {
var r = this;

@@ -170,3 +170,3 @@ return new p.Promise(function(o, i) {

r.model[u] = l[u];
}), process.env.NODE_ENV !== "production" && d("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && d("Child: Saving Parent origin", r.parentOrigin), o(new B(r));
}), process.env.NODE_ENV !== "production" && d("Child: Inherited and extended model from Parent")), process.env.NODE_ENV !== "production" && d("Child: Saving Parent origin", r.parentOrigin), o(new S(r));
}

@@ -180,56 +180,56 @@ return i("Handshake Reply Failed");

}();
const N = "footprint-container", O = "footprint-overlay", C = "footprint-loading-indicator", F = (n) => {
const t = _();
return n.appendChild(t), t;
}, S = (n) => {
const N = "footprint-container", O = "footprint-overlay", C = "footprint-loading-indicator", x = (n) => {
const e = _();
return n.appendChild(e), e;
}, T = (n) => {
document.body.classList.add("footprint-body-locked");
const t = document.createElement("div");
t.setAttribute("id", O);
const e = $(C);
t.appendChild(e), t.classList.add("footprint-overlay"), n.appendChild(t);
}, x = () => {
const e = document.createElement("div");
e.setAttribute("id", O);
const t = q(C);
e.appendChild(t), e.classList.add("footprint-overlay"), n.appendChild(e);
}, H = () => {
const n = document.getElementById(C);
n && n.remove();
}, T = () => {
}, $ = () => {
document.body.classList.remove("footprint-body-locked");
const n = document.getElementById(O);
n && n.remove();
}, H = () => {
}, j = () => {
const n = document.getElementById(N);
if (n)
return n;
const e = document.createElement("div");
return e.setAttribute("id", N), document.body.appendChild(e), e;
}, q = (n) => {
const e = document.createElement("div");
e.setAttribute("id", n), e.classList.add("footprint-loading-indicator");
const t = document.createElement("div");
return t.setAttribute("id", N), document.body.appendChild(t), t;
}, $ = (n) => {
const t = document.createElement("div");
t.setAttribute("id", n), t.classList.add("footprint-loading-indicator");
const e = document.createElement("div");
e.classList.add("footprint-loading-spin");
t.classList.add("footprint-loading-spin");
const r = document.createElementNS("http://www.w3.org/2000/svg", "svg");
r.setAttribute("width", "24px"), r.setAttribute("height", "24px"), r.setAttribute("fill", "none"), r.setAttribute("aria-hidden", "true");
const o = document.createElementNS("http://www.w3.org/2000/svg", "path");
return o.setAttribute("d", "M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"), o.setAttribute("fill", "#FFFFFF"), r.appendChild(o), e.appendChild(r), t.appendChild(e), t;
}, j = () => {
return o.setAttribute("d", "M12 2a10 10 0 0 1 10 10h-2a7.999 7.999 0 0 0-8-8V2Z"), o.setAttribute("fill", "#FFFFFF"), r.appendChild(o), t.appendChild(r), e.appendChild(t), e;
}, U = () => {
const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
n.setAttribute("width", "24px"), n.setAttribute("height", "24px"), n.setAttribute("fill", "none"), n.setAttribute("aria-hidden", "true");
const t = document.createElementNS("http://www.w3.org/2000/svg", "path");
return t.setAttribute(
const e = document.createElementNS("http://www.w3.org/2000/svg", "path");
return e.setAttribute(
"d",
"M14.66 14h2.666v-2.36a2.666 2.666 0 1 1 0-4.614V4H6.66v16h4.666v-2.666A3.333 3.333 0 0 1 14.66 14Z"
), t.setAttribute("fill", "#76fb8f"), n.appendChild(t), n;
), e.setAttribute("fill", "#76fb8f"), n.appendChild(e), n;
}, _ = () => {
const n = j(), t = document.createElement("button");
t.appendChild(n);
const e = document.createElement("span");
return e.innerText = "Verify with Footprint", t.appendChild(e), t.classList.add("footprint-button"), t;
const n = U(), e = document.createElement("button");
e.appendChild(n);
const t = document.createElement("span");
return t.innerText = "Verify with Footprint", e.appendChild(t), e.classList.add("footprint-button"), e;
};
class q {
class z {
constructor() {
b(this, "child", null);
}
async show(t) {
const { url: e } = t, r = () => {
x();
}, o = H();
S(o);
async show(e) {
const { url: t } = e, r = () => {
H();
}, o = j();
T(o);
const i = await new p({

@@ -239,3 +239,3 @@ classListArray: ["footprint-modal"],

name: "footprint-iframe",
url: e
url: t
});

@@ -247,19 +247,19 @@ i.frame.setAttribute(

}
on(t, e) {
on(e, t) {
if (!this.child)
throw new Error("Footprint should be open in order to listen events");
return this.child.on(t, e);
return this.child.on(e, t);
}
hide() {
T(), this.child && this.child.destroy();
$(), this.child && this.child.destroy();
}
createButton(t) {
const e = _();
return t.appendChild(e), e;
createButton(e) {
const t = _();
return e.appendChild(t), t;
}
}
const g = new q(), U = (n) => {
const t = (r) => g.on(f.completed, (o) => {
const g = new z(), G = (n) => {
const e = (r) => g.on(f.completed, (o) => {
o && typeof o == "string" && r(o);
}), e = (r) => g.on(f.canceled, r);
}), t = (r) => g.on(f.canceled, r);
return {

@@ -269,9 +269,10 @@ show: async ({ publicKey: r, onCompleted: o, onCanceled: i }) => {

url: r ? `${n}?public_key=${r}` : n
}), o && t(o), i && e(i);
}), o && e(o), i && t(i);
}
};
}, z = typeof window > "u", G = (n) => {
}, W = typeof window > "u", X = (n) => {
window.setTimeout(n, 0);
}, W = (n) => {
const t = async (i) => {
}, L = (n) => {
console.log("0");
const e = async (i) => {
await n.show({

@@ -288,6 +289,8 @@ publicKey: i,

});
}, e = () => {
}, t = () => {
console.log("4");
const i = document.getElementById("footprint-button");
if (!i)
return;
console.log("5");
const a = i.getAttribute("data-public-key");

@@ -298,22 +301,24 @@ if (!a)

);
r(a, i);
console.log("6"), r(a, i);
}, r = (i, a) => {
G(() => {
F(a).addEventListener("click", () => {
t(i);
X(() => {
x(a).addEventListener("click", () => {
e(i);
});
});
}, o = () => {
z || document.addEventListener("DOMContentLoaded", () => e());
console.log("2"), !W && (console.log("3"), document.addEventListener("DOMContentLoaded", () => t()));
};
return () => {
o();
console.log("1"), o();
};
}, X = (n = "production", t) => n === "local" ? "http://localhost:3000/" : n === "development" ? "https://id.preview.onefootprint.com" : n === "preview" && t ? t === "development" ? "https://id.preview.onefootprint.com" : `https://bifrost-git-${t.toLowerCase().split("/").join("-")}.preview.onefootprint.com` : "https://id.onefootprint.com", Z = X(
}, Z = (n = "production", e) => n === "local" ? "http://localhost:3000/" : n === "development" ? "https://id.preview.onefootprint.com" : n === "preview" && e ? e === "development" ? "https://id.preview.onefootprint.com" : `https://bifrost-git-${e.toLowerCase().split("/").join("-")}.preview.onefootprint.com` : "https://id.onefootprint.com", A = Z(
process.env.NEXT_PUBLIC_VERCEL_ENV,
process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF
), Y = U(Z);
W(Y)();
), Y = G(A);
console.log("url", A);
console.log("vanillaIntegration", L);
L(Y)();
export {
Y as default
};

@@ -5,3 +5,3 @@ {

"type": "module",
"version": "0.3.1-beta.5",
"version": "0.3.1-beta.6",
"main": "./dist/footprint-js.umd.cjs",

@@ -8,0 +8,0 @@ "module": "./dist/footprint-js.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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