@stacksee/analytics 0.8.0 → 0.9.2
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/dist/{axios-gULqh8dv.js → axios-0_CwElpL.js} +2 -2
- package/dist/{bento-node-sdk.esm-C4HG7SVz.js → bento-node-sdk.esm-CWEAoj97.js} +69 -69
- package/dist/{index-bgxxv-IJ.js → index-zS7gy63J.js} +12 -12
- package/dist/providers/bento/client.d.ts +101 -0
- package/dist/providers/client.js +203 -69
- package/dist/providers/server.js +6 -3
- package/dist/{web-CvEQewPd.js → web-imCcOhDC.js} +7 -7
- package/package.json +5 -1
|
@@ -4,9 +4,9 @@ function Zr() {
|
|
|
4
4
|
if (Tt) return y;
|
|
5
5
|
Tt = 1, Object.defineProperty(y, "__esModule", { value: !0 }), y.PirschEndpoint = y.PIRSCH_URL_LENGTH_LIMIT = y.PIRSCH_IDENTIFICATION_CODE_LENGTH = y.PIRSCH_ACCESS_TOKEN_LENGTH = y.PIRSCH_CLIENT_SECRET_LENGTH = y.PIRSCH_CLIENT_ID_LENGTH = y.PIRSCH_ACCESS_TOKEN_PREFIX = y.PIRSCH_PROXY_HEADERS = y.PIRSCH_REFERRER_QUERY_PARAMETERS = y.PIRSCH_DEFAULT_PROTOCOL = y.PIRSCH_DEFAULT_TIMEOUT = y.PIRSCH_DEFAULT_BASE_URL = void 0, y.PIRSCH_DEFAULT_BASE_URL = "https://api.pirsch.io", y.PIRSCH_DEFAULT_TIMEOUT = 5e3, y.PIRSCH_DEFAULT_PROTOCOL = "https", y.PIRSCH_REFERRER_QUERY_PARAMETERS = ["ref", "referer", "referrer", "source", "utm_source"], y.PIRSCH_PROXY_HEADERS = ["cf-connecting-ip", "x-forwarded-for", "forwarded", "x-real-ip"], y.PIRSCH_ACCESS_TOKEN_PREFIX = "pa_", y.PIRSCH_CLIENT_ID_LENGTH = 32, y.PIRSCH_CLIENT_SECRET_LENGTH = 64, y.PIRSCH_ACCESS_TOKEN_LENGTH = 45, y.PIRSCH_IDENTIFICATION_CODE_LENGTH = 32, y.PIRSCH_URL_LENGTH_LIMIT = 1800;
|
|
6
6
|
var A;
|
|
7
|
-
return function(m) {
|
|
7
|
+
return (function(m) {
|
|
8
8
|
m.AUTHENTICATION = "token", m.HIT = "hit", m.HIT_BATCH = "hit/batch", m.EVENT = "event", m.EVENT_BATCH = "event/batch", m.SESSION = "session", m.SESSION_BATCH = "session/batch", m.DOMAIN = "domain", m.SESSION_DURATION = "statistics/duration/session", m.TIME_ON_PAGE = "statistics/duration/page", m.UTM_SOURCE = "statistics/utm/source", m.UTM_MEDIUM = "statistics/utm/medium", m.UTM_CAMPAIGN = "statistics/utm/campaign", m.UTM_CONTENT = "statistics/utm/content", m.UTM_TERM = "statistics/utm/term", m.TOTAL_VISITORS = "statistics/total", m.VISITORS = "statistics/visitor", m.PAGES = "statistics/page", m.ENTRY_PAGES = "statistics/page/entry", m.EXIT_PAGES = "statistics/page/exit", m.CONVERSION_GOALS = "statistics/goals", m.EVENTS = "statistics/events", m.EVENT_METADATA = "statistics/event/meta", m.LIST_EVENTS = "statistics/event/list", m.EVENTS_PAGES = "statistics/event/page", m.GROWTH_RATE = "statistics/growth", m.ACTIVE_VISITORS = "statistics/active", m.TIME_OF_DAY = "statistics/hours", m.LANGUAGE = "statistics/language", m.REFERRER = "statistics/referrer", m.OS = "statistics/os", m.OS_VERSION = "statistics/os/version", m.BROWSER = "statistics/browser", m.BROWSER_VERSION = "statistics/browser/version", m.COUNTRY = "statistics/country", m.REGION = "statistics/region", m.CITY = "statistics/city", m.PLATFORM = "statistics/platform", m.SCREEN = "statistics/screen", m.KEYWORDS = "statistics/keywords", m.TAG_KEYS = "statistics/tags", m.TAG_DETAILS = "statistics/tag/details", m.LIST_FUNNEL = "/api/v1/funnel", m.FUNNEL = "/api/v1/statistics/funnel";
|
|
9
|
-
}(A || (y.PirschEndpoint = A = {})), y;
|
|
9
|
+
})(A || (y.PirschEndpoint = A = {})), y;
|
|
10
10
|
}
|
|
11
11
|
var _t;
|
|
12
12
|
function sn() {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { c as W, g as ae } from "./_commonjsHelpers-B4e78b8K.js";
|
|
2
2
|
var Z = { exports: {} }, re;
|
|
3
3
|
function se() {
|
|
4
|
-
return re || (re = 1, function(l, c) {
|
|
5
|
-
var t = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof W < "u" && W, a = function() {
|
|
4
|
+
return re || (re = 1, (function(l, c) {
|
|
5
|
+
var t = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof W < "u" && W, a = (function() {
|
|
6
6
|
function u() {
|
|
7
7
|
this.fetch = !1, this.DOMException = t.DOMException;
|
|
8
8
|
}
|
|
9
9
|
return u.prototype = t, new u();
|
|
10
|
-
}();
|
|
10
|
+
})();
|
|
11
11
|
(function(u) {
|
|
12
12
|
(function(i) {
|
|
13
13
|
var p = typeof u < "u" && u || typeof self < "u" && self || // eslint-disable-next-line no-undef
|
|
14
14
|
typeof W < "u" && W || {}, e = {
|
|
15
15
|
searchParams: "URLSearchParams" in p,
|
|
16
16
|
iterable: "Symbol" in p && "iterator" in Symbol,
|
|
17
|
-
blob: "FileReader" in p && "Blob" in p && function() {
|
|
17
|
+
blob: "FileReader" in p && "Blob" in p && (function() {
|
|
18
18
|
try {
|
|
19
19
|
return new Blob(), !0;
|
|
20
20
|
} catch {
|
|
21
21
|
return !1;
|
|
22
22
|
}
|
|
23
|
-
}(),
|
|
23
|
+
})(),
|
|
24
24
|
formData: "FormData" in p,
|
|
25
25
|
arrayBuffer: "ArrayBuffer" in p
|
|
26
26
|
};
|
|
@@ -198,12 +198,12 @@ function se() {
|
|
|
198
198
|
this.url = n.url, this.credentials = n.credentials, r.headers || (this.headers = new g(n.headers)), this.method = n.method, this.mode = n.mode, this.signal = n.signal, !s && n._bodyInit != null && (s = n._bodyInit, n.bodyUsed = !0);
|
|
199
199
|
} else
|
|
200
200
|
this.url = String(n);
|
|
201
|
-
if (this.credentials = r.credentials || this.credentials || "same-origin", (r.headers || !this.headers) && (this.headers = new g(r.headers)), this.method = Q(r.method || this.method || "GET"), this.mode = r.mode || this.mode || null, this.signal = r.signal || this.signal || function() {
|
|
201
|
+
if (this.credentials = r.credentials || this.credentials || "same-origin", (r.headers || !this.headers) && (this.headers = new g(r.headers)), this.method = Q(r.method || this.method || "GET"), this.mode = r.mode || this.mode || null, this.signal = r.signal || this.signal || (function() {
|
|
202
202
|
if ("AbortController" in p) {
|
|
203
203
|
var h = new AbortController();
|
|
204
204
|
return h.signal;
|
|
205
205
|
}
|
|
206
|
-
}(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && s)
|
|
206
|
+
})(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && s)
|
|
207
207
|
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
208
208
|
if (this._initBody(s), (this.method === "GET" || this.method === "HEAD") && (r.cache === "no-store" || r.cache === "no-cache")) {
|
|
209
209
|
var f = /([?&])_=[^&]*/;
|
|
@@ -338,7 +338,7 @@ function se() {
|
|
|
338
338
|
})(a), a.fetch.ponyfill = !0, delete a.fetch.polyfill;
|
|
339
339
|
var o = t.fetch ? t : a;
|
|
340
340
|
c = o.fetch, c.default = o.fetch, c.fetch = o.fetch, c.Headers = o.Headers, c.Request = o.Request, c.Response = o.Response, l.exports = c;
|
|
341
|
-
}(Z, Z.exports)), Z.exports;
|
|
341
|
+
})(Z, Z.exports)), Z.exports;
|
|
342
342
|
}
|
|
343
343
|
var ue = se();
|
|
344
344
|
const te = /* @__PURE__ */ ae(ue);
|
|
@@ -717,48 +717,48 @@ function R(l) {
|
|
|
717
717
|
}), K(a, t);
|
|
718
718
|
}, R(l);
|
|
719
719
|
}
|
|
720
|
-
var le = /* @__PURE__ */ function(l) {
|
|
720
|
+
var le = /* @__PURE__ */ (function(l) {
|
|
721
721
|
function c(t) {
|
|
722
722
|
var a;
|
|
723
723
|
return t === void 0 && (t = "Too few subscribers"), a = l.call(this, t) || this, a.name = "TooFewSubscribersError", a;
|
|
724
724
|
}
|
|
725
725
|
return D(c, l), c;
|
|
726
|
-
}(/* @__PURE__ */ R(Error)), fe = /* @__PURE__ */ function(l) {
|
|
726
|
+
})(/* @__PURE__ */ R(Error)), fe = /* @__PURE__ */ (function(l) {
|
|
727
727
|
function c(t) {
|
|
728
728
|
var a;
|
|
729
729
|
return t === void 0 && (t = "Too many subscribers"), a = l.call(this, t) || this, a.name = "TooManySubscribersError", a;
|
|
730
730
|
}
|
|
731
731
|
return D(c, l), c;
|
|
732
|
-
}(/* @__PURE__ */ R(Error)), he = /* @__PURE__ */ function(l) {
|
|
732
|
+
})(/* @__PURE__ */ R(Error)), he = /* @__PURE__ */ (function(l) {
|
|
733
733
|
function c(t) {
|
|
734
734
|
var a;
|
|
735
735
|
return t === void 0 && (t = "Too few events"), a = l.call(this, t) || this, a.name = "TooFewEventsError", a;
|
|
736
736
|
}
|
|
737
737
|
return D(c, l), c;
|
|
738
|
-
}(/* @__PURE__ */ R(Error)), pe = /* @__PURE__ */ function(l) {
|
|
738
|
+
})(/* @__PURE__ */ R(Error)), pe = /* @__PURE__ */ (function(l) {
|
|
739
739
|
function c(t) {
|
|
740
740
|
var a;
|
|
741
741
|
return t === void 0 && (t = "Too many events"), a = l.call(this, t) || this, a.name = "TooManyEventsError", a;
|
|
742
742
|
}
|
|
743
743
|
return D(c, l), c;
|
|
744
|
-
}(/* @__PURE__ */ R(Error)), de = /* @__PURE__ */ function(l) {
|
|
744
|
+
})(/* @__PURE__ */ R(Error)), de = /* @__PURE__ */ (function(l) {
|
|
745
745
|
function c(t) {
|
|
746
746
|
var a;
|
|
747
747
|
return t === void 0 && (t = "Too few emails"), a = l.call(this, t) || this, a.name = "TooFewEmailsError", a;
|
|
748
748
|
}
|
|
749
749
|
return D(c, l), c;
|
|
750
|
-
}(/* @__PURE__ */ R(Error)), ye = /* @__PURE__ */ function(l) {
|
|
750
|
+
})(/* @__PURE__ */ R(Error)), ye = /* @__PURE__ */ (function(l) {
|
|
751
751
|
function c(t) {
|
|
752
752
|
var a;
|
|
753
753
|
return t === void 0 && (t = "Too many emails"), a = l.call(this, t) || this, a.name = "TooManyEmailsError", a;
|
|
754
754
|
}
|
|
755
755
|
return D(c, l), c;
|
|
756
|
-
}(/* @__PURE__ */ R(Error)), ve = /* @__PURE__ */ function() {
|
|
756
|
+
})(/* @__PURE__ */ R(Error)), ve = /* @__PURE__ */ (function() {
|
|
757
757
|
function l(t) {
|
|
758
758
|
this._client = void 0, this._maxEmailBatchSize = 100, this._maxBatchSize = 1e3, this._url = "/batch", this._client = t;
|
|
759
759
|
}
|
|
760
760
|
var c = l.prototype;
|
|
761
|
-
return c.importSubscribers = /* @__PURE__ */ function() {
|
|
761
|
+
return c.importSubscribers = /* @__PURE__ */ (function() {
|
|
762
762
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
763
763
|
var i;
|
|
764
764
|
return y().wrap(function(e) {
|
|
@@ -791,7 +791,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
791
791
|
return t.apply(this, arguments);
|
|
792
792
|
}
|
|
793
793
|
return a;
|
|
794
|
-
}(), c.importEvents = /* @__PURE__ */ function() {
|
|
794
|
+
})(), c.importEvents = /* @__PURE__ */ (function() {
|
|
795
795
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
796
796
|
var i;
|
|
797
797
|
return y().wrap(function(e) {
|
|
@@ -824,7 +824,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
824
824
|
return t.apply(this, arguments);
|
|
825
825
|
}
|
|
826
826
|
return a;
|
|
827
|
-
}(), c.sendTransactionalEmails = /* @__PURE__ */ function() {
|
|
827
|
+
})(), c.sendTransactionalEmails = /* @__PURE__ */ (function() {
|
|
828
828
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
829
829
|
var i;
|
|
830
830
|
return y().wrap(function(e) {
|
|
@@ -857,20 +857,20 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
857
857
|
return t.apply(this, arguments);
|
|
858
858
|
}
|
|
859
859
|
return a;
|
|
860
|
-
}(), l;
|
|
861
|
-
}(), be = /* @__PURE__ */ function(l) {
|
|
860
|
+
})(), l;
|
|
861
|
+
})(), be = /* @__PURE__ */ (function(l) {
|
|
862
862
|
function c(t) {
|
|
863
863
|
var a;
|
|
864
864
|
return t === void 0 && (t = "Not authorized"), a = l.call(this, t) || this, a.name = "NotAuthorizedError", a;
|
|
865
865
|
}
|
|
866
866
|
return D(c, l), c;
|
|
867
|
-
}(/* @__PURE__ */ R(Error)), me = /* @__PURE__ */ function(l) {
|
|
867
|
+
})(/* @__PURE__ */ R(Error)), me = /* @__PURE__ */ (function(l) {
|
|
868
868
|
function c(t) {
|
|
869
869
|
var a;
|
|
870
870
|
return t === void 0 && (t = "You are being rate limited"), a = l.call(this, t) || this, a.name = "RateLimitedError", a;
|
|
871
871
|
}
|
|
872
872
|
return D(c, l), c;
|
|
873
|
-
}(/* @__PURE__ */ R(Error)), we = /* @__PURE__ */ function() {
|
|
873
|
+
})(/* @__PURE__ */ R(Error)), we = /* @__PURE__ */ (function() {
|
|
874
874
|
function l(t) {
|
|
875
875
|
var a;
|
|
876
876
|
this._headers = {}, this._baseUrl = "https://app.bentonow.com/api/v1", this._siteUuid = "", this._logErrors = !1, this._baseUrl = ((a = t.clientOptions) == null ? void 0 : a.baseUrl) || this._baseUrl, this._siteUuid = t.siteUuid, this._headers = this._extractHeaders(t.authentication), this._logErrors = t.logErrors || !1;
|
|
@@ -883,7 +883,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
883
883
|
te("" + u._baseUrl + a + "?" + e, {
|
|
884
884
|
method: "GET",
|
|
885
885
|
headers: u._headers
|
|
886
|
-
}).then(/* @__PURE__ */ function() {
|
|
886
|
+
}).then(/* @__PURE__ */ (function() {
|
|
887
887
|
var v = w(/* @__PURE__ */ y().mark(function P(O) {
|
|
888
888
|
return y().wrap(function(_) {
|
|
889
889
|
for (; ; ) switch (_.prev = _.next) {
|
|
@@ -906,7 +906,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
906
906
|
return function(P) {
|
|
907
907
|
return v.apply(this, arguments);
|
|
908
908
|
};
|
|
909
|
-
}()).then(function(v) {
|
|
909
|
+
})()).then(function(v) {
|
|
910
910
|
return i(v);
|
|
911
911
|
}).catch(function(v) {
|
|
912
912
|
return p(v);
|
|
@@ -922,7 +922,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
922
922
|
"Content-Type": "application/json"
|
|
923
923
|
}),
|
|
924
924
|
body: e
|
|
925
|
-
}).then(/* @__PURE__ */ function() {
|
|
925
|
+
}).then(/* @__PURE__ */ (function() {
|
|
926
926
|
var v = w(/* @__PURE__ */ y().mark(function P(O) {
|
|
927
927
|
return y().wrap(function(_) {
|
|
928
928
|
for (; ; ) switch (_.prev = _.next) {
|
|
@@ -945,7 +945,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
945
945
|
return function(P) {
|
|
946
946
|
return v.apply(this, arguments);
|
|
947
947
|
};
|
|
948
|
-
}()).then(function(v) {
|
|
948
|
+
})()).then(function(v) {
|
|
949
949
|
return i(v);
|
|
950
950
|
}).catch(function(v) {
|
|
951
951
|
return p(v);
|
|
@@ -971,7 +971,7 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
971
971
|
}, c._isSuccessfulStatus = function(a) {
|
|
972
972
|
var o = [200, 201];
|
|
973
973
|
return o.includes(a);
|
|
974
|
-
}, c._getErrorForResponse = /* @__PURE__ */ function() {
|
|
974
|
+
}, c._getErrorForResponse = /* @__PURE__ */ (function() {
|
|
975
975
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
976
976
|
var i, p;
|
|
977
977
|
return y().wrap(function(v) {
|
|
@@ -1013,17 +1013,17 @@ var le = /* @__PURE__ */ function(l) {
|
|
|
1013
1013
|
return t.apply(this, arguments);
|
|
1014
1014
|
}
|
|
1015
1015
|
return a;
|
|
1016
|
-
}(), l;
|
|
1017
|
-
}(), L;
|
|
1016
|
+
})(), l;
|
|
1017
|
+
})(), L;
|
|
1018
1018
|
(function(l) {
|
|
1019
1019
|
l.ADD_FIELD = "add_field", l.ADD_TAG = "add_tag", l.CHANGE_EMAIL = "change_email", l.REMOVE_FIELD = "remove_field", l.REMOVE_TAG = "remove_tag", l.SUBSCRIBE = "subscribe", l.UNSUBSCRIBE = "unsubscribe";
|
|
1020
1020
|
})(L || (L = {}));
|
|
1021
|
-
var ge = /* @__PURE__ */ function() {
|
|
1021
|
+
var ge = /* @__PURE__ */ (function() {
|
|
1022
1022
|
function l(t) {
|
|
1023
1023
|
this._client = void 0, this._url = "/fetch/commands", this._client = t;
|
|
1024
1024
|
}
|
|
1025
1025
|
var c = l.prototype;
|
|
1026
|
-
return c.addTag = /* @__PURE__ */ function() {
|
|
1026
|
+
return c.addTag = /* @__PURE__ */ (function() {
|
|
1027
1027
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1028
1028
|
var i;
|
|
1029
1029
|
return y().wrap(function(e) {
|
|
@@ -1054,7 +1054,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1054
1054
|
return t.apply(this, arguments);
|
|
1055
1055
|
}
|
|
1056
1056
|
return a;
|
|
1057
|
-
}(), c.removeTag = /* @__PURE__ */ function() {
|
|
1057
|
+
})(), c.removeTag = /* @__PURE__ */ (function() {
|
|
1058
1058
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1059
1059
|
var i;
|
|
1060
1060
|
return y().wrap(function(e) {
|
|
@@ -1085,7 +1085,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1085
1085
|
return t.apply(this, arguments);
|
|
1086
1086
|
}
|
|
1087
1087
|
return a;
|
|
1088
|
-
}(), c.addField = /* @__PURE__ */ function() {
|
|
1088
|
+
})(), c.addField = /* @__PURE__ */ (function() {
|
|
1089
1089
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1090
1090
|
var i;
|
|
1091
1091
|
return y().wrap(function(e) {
|
|
@@ -1116,7 +1116,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1116
1116
|
return t.apply(this, arguments);
|
|
1117
1117
|
}
|
|
1118
1118
|
return a;
|
|
1119
|
-
}(), c.removeField = /* @__PURE__ */ function() {
|
|
1119
|
+
})(), c.removeField = /* @__PURE__ */ (function() {
|
|
1120
1120
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1121
1121
|
var i;
|
|
1122
1122
|
return y().wrap(function(e) {
|
|
@@ -1147,7 +1147,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1147
1147
|
return t.apply(this, arguments);
|
|
1148
1148
|
}
|
|
1149
1149
|
return a;
|
|
1150
|
-
}(), c.subscribe = /* @__PURE__ */ function() {
|
|
1150
|
+
})(), c.subscribe = /* @__PURE__ */ (function() {
|
|
1151
1151
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1152
1152
|
var i;
|
|
1153
1153
|
return y().wrap(function(e) {
|
|
@@ -1177,7 +1177,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1177
1177
|
return t.apply(this, arguments);
|
|
1178
1178
|
}
|
|
1179
1179
|
return a;
|
|
1180
|
-
}(), c.unsubscribe = /* @__PURE__ */ function() {
|
|
1180
|
+
})(), c.unsubscribe = /* @__PURE__ */ (function() {
|
|
1181
1181
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1182
1182
|
var i;
|
|
1183
1183
|
return y().wrap(function(e) {
|
|
@@ -1207,7 +1207,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1207
1207
|
return t.apply(this, arguments);
|
|
1208
1208
|
}
|
|
1209
1209
|
return a;
|
|
1210
|
-
}(), c.changeEmail = /* @__PURE__ */ function() {
|
|
1210
|
+
})(), c.changeEmail = /* @__PURE__ */ (function() {
|
|
1211
1211
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1212
1212
|
var i;
|
|
1213
1213
|
return y().wrap(function(e) {
|
|
@@ -1238,13 +1238,13 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1238
1238
|
return t.apply(this, arguments);
|
|
1239
1239
|
}
|
|
1240
1240
|
return a;
|
|
1241
|
-
}(), l;
|
|
1242
|
-
}(), Ee = /* @__PURE__ */ function() {
|
|
1241
|
+
})(), l;
|
|
1242
|
+
})(), Ee = /* @__PURE__ */ (function() {
|
|
1243
1243
|
function l(t) {
|
|
1244
1244
|
this._client = void 0, this._url = "/experimental", this._client = t;
|
|
1245
1245
|
}
|
|
1246
1246
|
var c = l.prototype;
|
|
1247
|
-
return c.validateEmail = /* @__PURE__ */ function() {
|
|
1247
|
+
return c.validateEmail = /* @__PURE__ */ (function() {
|
|
1248
1248
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1249
1249
|
var i;
|
|
1250
1250
|
return y().wrap(function(e) {
|
|
@@ -1268,7 +1268,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1268
1268
|
return t.apply(this, arguments);
|
|
1269
1269
|
}
|
|
1270
1270
|
return a;
|
|
1271
|
-
}(), c.guessGender = /* @__PURE__ */ function() {
|
|
1271
|
+
})(), c.guessGender = /* @__PURE__ */ (function() {
|
|
1272
1272
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1273
1273
|
var i;
|
|
1274
1274
|
return y().wrap(function(e) {
|
|
@@ -1287,7 +1287,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1287
1287
|
return t.apply(this, arguments);
|
|
1288
1288
|
}
|
|
1289
1289
|
return a;
|
|
1290
|
-
}(), c.geolocate = /* @__PURE__ */ function() {
|
|
1290
|
+
})(), c.geolocate = /* @__PURE__ */ (function() {
|
|
1291
1291
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1292
1292
|
var i;
|
|
1293
1293
|
return y().wrap(function(e) {
|
|
@@ -1312,7 +1312,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1312
1312
|
return t.apply(this, arguments);
|
|
1313
1313
|
}
|
|
1314
1314
|
return a;
|
|
1315
|
-
}(), c.checkBlacklist = /* @__PURE__ */ function() {
|
|
1315
|
+
})(), c.checkBlacklist = /* @__PURE__ */ (function() {
|
|
1316
1316
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1317
1317
|
var i;
|
|
1318
1318
|
return y().wrap(function(e) {
|
|
@@ -1331,13 +1331,13 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1331
1331
|
return t.apply(this, arguments);
|
|
1332
1332
|
}
|
|
1333
1333
|
return a;
|
|
1334
|
-
}(), l;
|
|
1335
|
-
}(), _e = /* @__PURE__ */ function() {
|
|
1334
|
+
})(), l;
|
|
1335
|
+
})(), _e = /* @__PURE__ */ (function() {
|
|
1336
1336
|
function l(t) {
|
|
1337
1337
|
this._client = void 0, this._url = "/fetch/fields", this._client = t;
|
|
1338
1338
|
}
|
|
1339
1339
|
var c = l.prototype;
|
|
1340
|
-
return c.getFields = /* @__PURE__ */ function() {
|
|
1340
|
+
return c.getFields = /* @__PURE__ */ (function() {
|
|
1341
1341
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o() {
|
|
1342
1342
|
var u;
|
|
1343
1343
|
return y().wrap(function(p) {
|
|
@@ -1362,7 +1362,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1362
1362
|
return t.apply(this, arguments);
|
|
1363
1363
|
}
|
|
1364
1364
|
return a;
|
|
1365
|
-
}(), c.createField = /* @__PURE__ */ function() {
|
|
1365
|
+
})(), c.createField = /* @__PURE__ */ (function() {
|
|
1366
1366
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1367
1367
|
var i;
|
|
1368
1368
|
return y().wrap(function(e) {
|
|
@@ -1389,13 +1389,13 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1389
1389
|
return t.apply(this, arguments);
|
|
1390
1390
|
}
|
|
1391
1391
|
return a;
|
|
1392
|
-
}(), l;
|
|
1393
|
-
}(), Te = /* @__PURE__ */ function() {
|
|
1392
|
+
})(), l;
|
|
1393
|
+
})(), Te = /* @__PURE__ */ (function() {
|
|
1394
1394
|
function l(t) {
|
|
1395
1395
|
this._client = void 0, this._url = "/fetch/responses", this._client = t;
|
|
1396
1396
|
}
|
|
1397
1397
|
var c = l.prototype;
|
|
1398
|
-
return c.getResponses = /* @__PURE__ */ function() {
|
|
1398
|
+
return c.getResponses = /* @__PURE__ */ (function() {
|
|
1399
1399
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1400
1400
|
var i;
|
|
1401
1401
|
return y().wrap(function(e) {
|
|
@@ -1422,13 +1422,13 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1422
1422
|
return t.apply(this, arguments);
|
|
1423
1423
|
}
|
|
1424
1424
|
return a;
|
|
1425
|
-
}(), l;
|
|
1426
|
-
}(), ke = /* @__PURE__ */ function() {
|
|
1425
|
+
})(), l;
|
|
1426
|
+
})(), ke = /* @__PURE__ */ (function() {
|
|
1427
1427
|
function l(t) {
|
|
1428
1428
|
this._client = void 0, this._url = "/fetch/subscribers", this._client = t;
|
|
1429
1429
|
}
|
|
1430
1430
|
var c = l.prototype;
|
|
1431
|
-
return c.getSubscribers = /* @__PURE__ */ function() {
|
|
1431
|
+
return c.getSubscribers = /* @__PURE__ */ (function() {
|
|
1432
1432
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1433
1433
|
var i;
|
|
1434
1434
|
return y().wrap(function(e) {
|
|
@@ -1453,7 +1453,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1453
1453
|
return t.apply(this, arguments);
|
|
1454
1454
|
}
|
|
1455
1455
|
return a;
|
|
1456
|
-
}(), c.createSubscriber = /* @__PURE__ */ function() {
|
|
1456
|
+
})(), c.createSubscriber = /* @__PURE__ */ (function() {
|
|
1457
1457
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1458
1458
|
var i;
|
|
1459
1459
|
return y().wrap(function(e) {
|
|
@@ -1480,13 +1480,13 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1480
1480
|
return t.apply(this, arguments);
|
|
1481
1481
|
}
|
|
1482
1482
|
return a;
|
|
1483
|
-
}(), l;
|
|
1484
|
-
}(), Be = /* @__PURE__ */ function() {
|
|
1483
|
+
})(), l;
|
|
1484
|
+
})(), Be = /* @__PURE__ */ (function() {
|
|
1485
1485
|
function l(t) {
|
|
1486
1486
|
this._client = void 0, this._url = "/fetch/tags", this._client = t;
|
|
1487
1487
|
}
|
|
1488
1488
|
var c = l.prototype;
|
|
1489
|
-
return c.getTags = /* @__PURE__ */ function() {
|
|
1489
|
+
return c.getTags = /* @__PURE__ */ (function() {
|
|
1490
1490
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o() {
|
|
1491
1491
|
var u;
|
|
1492
1492
|
return y().wrap(function(p) {
|
|
@@ -1511,7 +1511,7 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1511
1511
|
return t.apply(this, arguments);
|
|
1512
1512
|
}
|
|
1513
1513
|
return a;
|
|
1514
|
-
}(), c.createTag = /* @__PURE__ */ function() {
|
|
1514
|
+
})(), c.createTag = /* @__PURE__ */ (function() {
|
|
1515
1515
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1516
1516
|
var i;
|
|
1517
1517
|
return y().wrap(function(e) {
|
|
@@ -1538,17 +1538,17 @@ var ge = /* @__PURE__ */ function() {
|
|
|
1538
1538
|
return t.apply(this, arguments);
|
|
1539
1539
|
}
|
|
1540
1540
|
return a;
|
|
1541
|
-
}(), l;
|
|
1542
|
-
}(), N;
|
|
1541
|
+
})(), l;
|
|
1542
|
+
})(), N;
|
|
1543
1543
|
(function(l) {
|
|
1544
1544
|
l.PURCHASE = "$purchase", l.SUBSCRIBE = "$subscribe", l.TAG = "$tag", l.REMOVE_TAG = "$remove_tag", l.UNSUBSCRIBE = "$unsubscribe", l.UPDATE_FIELDS = "$update_fields";
|
|
1545
1545
|
})(N || (N = {}));
|
|
1546
|
-
var Oe = /* @__PURE__ */ function() {
|
|
1546
|
+
var Oe = /* @__PURE__ */ (function() {
|
|
1547
1547
|
function l(t) {
|
|
1548
1548
|
this._client = void 0, this.Batch = void 0, this.Commands = void 0, this.Experimental = void 0, this.Fields = void 0, this.Forms = void 0, this.Subscribers = void 0, this.Tags = void 0, this._client = new we(t), this.Batch = new ve(this._client), this.Commands = new ge(this._client), this.Experimental = new Ee(this._client), this.Fields = new _e(this._client), this.Forms = new Te(this._client), this.Subscribers = new ke(this._client), this.Tags = new Be(this._client);
|
|
1549
1549
|
}
|
|
1550
1550
|
var c = l.prototype;
|
|
1551
|
-
return c.tagSubscriber = /* @__PURE__ */ function() {
|
|
1551
|
+
return c.tagSubscriber = /* @__PURE__ */ (function() {
|
|
1552
1552
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1553
1553
|
var i;
|
|
1554
1554
|
return y().wrap(function(e) {
|
|
@@ -1576,7 +1576,7 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1576
1576
|
return t.apply(this, arguments);
|
|
1577
1577
|
}
|
|
1578
1578
|
return a;
|
|
1579
|
-
}(), c.addSubscriber = /* @__PURE__ */ function() {
|
|
1579
|
+
})(), c.addSubscriber = /* @__PURE__ */ (function() {
|
|
1580
1580
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1581
1581
|
var i;
|
|
1582
1582
|
return y().wrap(function(e) {
|
|
@@ -1602,7 +1602,7 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1602
1602
|
return t.apply(this, arguments);
|
|
1603
1603
|
}
|
|
1604
1604
|
return a;
|
|
1605
|
-
}(), c.removeSubscriber = /* @__PURE__ */ function() {
|
|
1605
|
+
})(), c.removeSubscriber = /* @__PURE__ */ (function() {
|
|
1606
1606
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1607
1607
|
var i;
|
|
1608
1608
|
return y().wrap(function(e) {
|
|
@@ -1627,7 +1627,7 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1627
1627
|
return t.apply(this, arguments);
|
|
1628
1628
|
}
|
|
1629
1629
|
return a;
|
|
1630
|
-
}(), c.updateFields = /* @__PURE__ */ function() {
|
|
1630
|
+
})(), c.updateFields = /* @__PURE__ */ (function() {
|
|
1631
1631
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1632
1632
|
var i;
|
|
1633
1633
|
return y().wrap(function(e) {
|
|
@@ -1653,7 +1653,7 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1653
1653
|
return t.apply(this, arguments);
|
|
1654
1654
|
}
|
|
1655
1655
|
return a;
|
|
1656
|
-
}(), c.trackPurchase = /* @__PURE__ */ function() {
|
|
1656
|
+
})(), c.trackPurchase = /* @__PURE__ */ (function() {
|
|
1657
1657
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1658
1658
|
var i;
|
|
1659
1659
|
return y().wrap(function(e) {
|
|
@@ -1679,7 +1679,7 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1679
1679
|
return t.apply(this, arguments);
|
|
1680
1680
|
}
|
|
1681
1681
|
return a;
|
|
1682
|
-
}(), c.track = /* @__PURE__ */ function() {
|
|
1682
|
+
})(), c.track = /* @__PURE__ */ (function() {
|
|
1683
1683
|
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1684
1684
|
var i;
|
|
1685
1685
|
return y().wrap(function(e) {
|
|
@@ -1700,8 +1700,8 @@ var Oe = /* @__PURE__ */ function() {
|
|
|
1700
1700
|
return t.apply(this, arguments);
|
|
1701
1701
|
}
|
|
1702
1702
|
return a;
|
|
1703
|
-
}(), l;
|
|
1704
|
-
}(), Ae = function(c) {
|
|
1703
|
+
})(), l;
|
|
1704
|
+
})(), Ae = function(c) {
|
|
1705
1705
|
this.V1 = void 0, this.V1 = new Oe(c);
|
|
1706
1706
|
};
|
|
1707
1707
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as S, r as F, b as w } from "./axios-
|
|
1
|
+
import { a as S, r as F, b as w } from "./axios-0_CwElpL.js";
|
|
2
2
|
import { a as R } from "./_commonjsHelpers-B4e78b8K.js";
|
|
3
3
|
function I(r, i) {
|
|
4
4
|
for (var _ = 0; _ < i.length; _++) {
|
|
@@ -654,19 +654,19 @@ var k;
|
|
|
654
654
|
function V() {
|
|
655
655
|
if (k) return v;
|
|
656
656
|
k = 1;
|
|
657
|
-
var r = v && v.__createBinding || (Object.create ? function(a, t, s, n) {
|
|
657
|
+
var r = v && v.__createBinding || (Object.create ? (function(a, t, s, n) {
|
|
658
658
|
n === void 0 && (n = s);
|
|
659
659
|
var o = Object.getOwnPropertyDescriptor(t, s);
|
|
660
660
|
(!o || ("get" in o ? !t.__esModule : o.writable || o.configurable)) && (o = { enumerable: !0, get: function() {
|
|
661
661
|
return t[s];
|
|
662
662
|
} }), Object.defineProperty(a, n, o);
|
|
663
|
-
} : function(a, t, s, n) {
|
|
663
|
+
}) : (function(a, t, s, n) {
|
|
664
664
|
n === void 0 && (n = s), a[n] = t[s];
|
|
665
|
-
}), i = v && v.__setModuleDefault || (Object.create ? function(a, t) {
|
|
665
|
+
})), i = v && v.__setModuleDefault || (Object.create ? (function(a, t) {
|
|
666
666
|
Object.defineProperty(a, "default", { enumerable: !0, value: t });
|
|
667
|
-
} : function(a, t) {
|
|
667
|
+
}) : function(a, t) {
|
|
668
668
|
a.default = t;
|
|
669
|
-
}), _ = v && v.__importStar || /* @__PURE__ */ function() {
|
|
669
|
+
}), _ = v && v.__importStar || /* @__PURE__ */ (function() {
|
|
670
670
|
var a = function(t) {
|
|
671
671
|
return a = Object.getOwnPropertyNames || function(s) {
|
|
672
672
|
var n = [];
|
|
@@ -680,7 +680,7 @@ function V() {
|
|
|
680
680
|
if (t != null) for (var n = a(t), o = 0; o < n.length; o++) n[o] !== "default" && r(s, t, n[o]);
|
|
681
681
|
return i(s, t), s;
|
|
682
682
|
};
|
|
683
|
-
}(), f = v && v.__awaiter || function(a, t, s, n) {
|
|
683
|
+
})(), f = v && v.__awaiter || function(a, t, s, n) {
|
|
684
684
|
function o(p) {
|
|
685
685
|
return p instanceof s ? p : new s(function(m) {
|
|
686
686
|
m(p);
|
|
@@ -805,20 +805,20 @@ function V() {
|
|
|
805
805
|
}
|
|
806
806
|
var G;
|
|
807
807
|
function D() {
|
|
808
|
-
return G || (G = 1, function(r) {
|
|
809
|
-
var i = g && g.__createBinding || (Object.create ? function(f, l, e, d) {
|
|
808
|
+
return G || (G = 1, (function(r) {
|
|
809
|
+
var i = g && g.__createBinding || (Object.create ? (function(f, l, e, d) {
|
|
810
810
|
d === void 0 && (d = e);
|
|
811
811
|
var c = Object.getOwnPropertyDescriptor(l, e);
|
|
812
812
|
(!c || ("get" in c ? !l.__esModule : c.writable || c.configurable)) && (c = { enumerable: !0, get: function() {
|
|
813
813
|
return l[e];
|
|
814
814
|
} }), Object.defineProperty(f, d, c);
|
|
815
|
-
} : function(f, l, e, d) {
|
|
815
|
+
}) : (function(f, l, e, d) {
|
|
816
816
|
d === void 0 && (d = e), f[d] = l[e];
|
|
817
|
-
}), _ = g && g.__exportStar || function(f, l) {
|
|
817
|
+
})), _ = g && g.__exportStar || function(f, l) {
|
|
818
818
|
for (var e in f) e !== "default" && !Object.prototype.hasOwnProperty.call(l, e) && i(l, f, e);
|
|
819
819
|
};
|
|
820
820
|
Object.defineProperty(r, "__esModule", { value: !0 }), _(N(), r), _(S(), r), _(V(), r);
|
|
821
|
-
}(g)), g;
|
|
821
|
+
})(g)), g;
|
|
822
822
|
}
|
|
823
823
|
var L = D();
|
|
824
824
|
const Y = /* @__PURE__ */ I({
|
|
@@ -8,6 +8,11 @@ interface BentoClient {
|
|
|
8
8
|
updateFields(fields: Record<string, unknown>): void;
|
|
9
9
|
getEmail(): string | null;
|
|
10
10
|
getName(): string | null;
|
|
11
|
+
showSurveyForm(element: HTMLElement, surveyId: string, type?: "popup" | "inline"): void;
|
|
12
|
+
spamCheck(email: string): Promise<boolean>;
|
|
13
|
+
showChat?(): void;
|
|
14
|
+
hideChat?(): void;
|
|
15
|
+
openChat?(): void;
|
|
11
16
|
}
|
|
12
17
|
export interface BentoClientConfig {
|
|
13
18
|
/**
|
|
@@ -43,5 +48,101 @@ export declare class BentoClientProvider extends BaseAnalyticsProvider {
|
|
|
43
48
|
pageView(properties?: Record<string, unknown>, context?: EventContext): void;
|
|
44
49
|
pageLeave(properties?: Record<string, unknown>, context?: EventContext): void;
|
|
45
50
|
reset(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Add a tag to the current user
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* bentoProvider.tag('premium_user');
|
|
57
|
+
* bentoProvider.tag('beta_tester');
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
tag(tag: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get the current user's email address
|
|
63
|
+
*
|
|
64
|
+
* @returns The user's email or null if not identified
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const email = bentoProvider.getEmail();
|
|
69
|
+
* if (email) {
|
|
70
|
+
* console.log('Current user:', email);
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
getEmail(): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Get the current user's name
|
|
77
|
+
*
|
|
78
|
+
* @returns The user's name or null if not set
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const name = bentoProvider.getName();
|
|
83
|
+
* if (name) {
|
|
84
|
+
* console.log('Welcome back,', name);
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
getName(): string | null;
|
|
89
|
+
/**
|
|
90
|
+
* Show a Bento survey form
|
|
91
|
+
*
|
|
92
|
+
* @param element - The HTML element to render the survey in
|
|
93
|
+
* @param surveyId - The survey ID from your Bento account
|
|
94
|
+
* @param type - Display type: 'popup' or 'inline' (default: 'popup')
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* const container = document.getElementById('survey-container');
|
|
99
|
+
* if (container) {
|
|
100
|
+
* bentoProvider.showSurveyForm(container, 'survey-123', 'popup');
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
showSurveyForm(element: HTMLElement, surveyId: string, type?: "popup" | "inline"): void;
|
|
105
|
+
/**
|
|
106
|
+
* Validate an email address using Bento's spam check
|
|
107
|
+
*
|
|
108
|
+
* @param email - The email address to validate
|
|
109
|
+
* @returns Promise that resolves to true if email is valid, false if spam
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const isValid = await bentoProvider.spamCheck('user@example.com');
|
|
114
|
+
* if (!isValid) {
|
|
115
|
+
* console.log('Invalid or spam email detected');
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
spamCheck(email: string): Promise<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* Show the Bento chat widget
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* bentoProvider.showChat();
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
showChat(): void;
|
|
129
|
+
/**
|
|
130
|
+
* Hide the Bento chat widget
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* bentoProvider.hideChat();
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
hideChat(): void;
|
|
138
|
+
/**
|
|
139
|
+
* Open the Bento chat widget
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* bentoProvider.openChat();
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
openChat(): void;
|
|
46
147
|
}
|
|
47
148
|
export {};
|
package/dist/providers/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
|
-
var f = (
|
|
3
|
-
var r = (
|
|
4
|
-
import { B as
|
|
5
|
-
import { i as
|
|
2
|
+
var f = (l, h, i) => h in l ? u(l, h, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[h] = i;
|
|
3
|
+
var r = (l, h, i) => f(l, typeof h != "symbol" ? h + "" : h, i);
|
|
4
|
+
import { B as d } from "../base.provider-AfFL5W_P.js";
|
|
5
|
+
import { i as a } from "../client-DTHZYkxx.js";
|
|
6
6
|
import { P as E } from "../client-DTHZYkxx.js";
|
|
7
|
-
class
|
|
7
|
+
class b extends d {
|
|
8
8
|
constructor(i) {
|
|
9
9
|
super({ debug: i.debug, enabled: i.enabled });
|
|
10
10
|
r(this, "name", "Bento-Client");
|
|
@@ -16,7 +16,7 @@ class y extends o {
|
|
|
16
16
|
}
|
|
17
17
|
async initialize() {
|
|
18
18
|
if (this.isEnabled() && !this.initialized) {
|
|
19
|
-
if (!
|
|
19
|
+
if (!a()) {
|
|
20
20
|
this.log("Skipping initialization - not in browser environment");
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -37,35 +37,35 @@ class y extends o {
|
|
|
37
37
|
this.scriptLoaded = !0, i();
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const s = document.createElement("script");
|
|
41
|
+
s.src = `https://fast.bentonow.com?site_uuid=${this.config.siteUuid}`, s.async = !0, s.defer = !0, s.onload = () => {
|
|
42
42
|
this.scriptLoaded = !0, i();
|
|
43
|
-
},
|
|
43
|
+
}, s.onerror = () => {
|
|
44
44
|
e(new Error("Failed to load Bento script"));
|
|
45
|
-
}, document.head.appendChild(
|
|
45
|
+
}, document.head.appendChild(s);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
async waitForBento(i = 50, e = 100) {
|
|
49
|
-
for (let
|
|
49
|
+
for (let t = 0; t < i; t++) {
|
|
50
50
|
if (window.bento)
|
|
51
51
|
return;
|
|
52
|
-
await new Promise((
|
|
52
|
+
await new Promise((s) => setTimeout(s, e));
|
|
53
53
|
}
|
|
54
54
|
throw new Error("Bento SDK not available after loading script");
|
|
55
55
|
}
|
|
56
56
|
identify(i, e) {
|
|
57
57
|
if (!this.isEnabled() || !this.initialized || !this.bento) return;
|
|
58
|
-
const
|
|
59
|
-
if (this.bento.identify(
|
|
60
|
-
const
|
|
61
|
-
delete
|
|
58
|
+
const t = (e == null ? void 0 : e.email) || i;
|
|
59
|
+
if (this.bento.identify(t), e) {
|
|
60
|
+
const s = { ...e };
|
|
61
|
+
delete s.email, Object.keys(s).length > 0 && this.bento.updateFields(s);
|
|
62
62
|
}
|
|
63
|
-
this.log("Identified user", { userId: i, email:
|
|
63
|
+
this.log("Identified user", { userId: i, email: t, traits: e });
|
|
64
64
|
}
|
|
65
65
|
track(i, e) {
|
|
66
|
-
var
|
|
66
|
+
var s, n;
|
|
67
67
|
if (!this.isEnabled() || !this.initialized || !this.bento) return;
|
|
68
|
-
const
|
|
68
|
+
const t = {
|
|
69
69
|
...i.properties,
|
|
70
70
|
category: i.category,
|
|
71
71
|
timestamp: i.timestamp || Date.now(),
|
|
@@ -81,15 +81,15 @@ class y extends o {
|
|
|
81
81
|
...(e == null ? void 0 : e.device) && { device: e.device },
|
|
82
82
|
...(e == null ? void 0 : e.utm) && { utm: e.utm },
|
|
83
83
|
// Include user email and traits as regular event properties
|
|
84
|
-
...((
|
|
85
|
-
...((
|
|
84
|
+
...((s = e == null ? void 0 : e.user) == null ? void 0 : s.email) && { user_email: e.user.email },
|
|
85
|
+
...((n = e == null ? void 0 : e.user) == null ? void 0 : n.traits) && { user_traits: e.user.traits }
|
|
86
86
|
};
|
|
87
|
-
this.bento.track(i.action,
|
|
87
|
+
this.bento.track(i.action, t), this.log("Tracked event", { event: i, context: e });
|
|
88
88
|
}
|
|
89
89
|
pageView(i, e) {
|
|
90
|
-
if (!(!this.isEnabled() || !this.initialized || !this.bento || !
|
|
90
|
+
if (!(!this.isEnabled() || !this.initialized || !this.bento || !a())) {
|
|
91
91
|
if (this.bento.view(), i || e != null && e.page) {
|
|
92
|
-
const
|
|
92
|
+
const t = {
|
|
93
93
|
...i,
|
|
94
94
|
...(e == null ? void 0 : e.page) && {
|
|
95
95
|
path: e.page.path,
|
|
@@ -97,15 +97,15 @@ class y extends o {
|
|
|
97
97
|
referrer: e.page.referrer
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
this.bento.track("$
|
|
100
|
+
this.bento.track("$view", t);
|
|
101
101
|
}
|
|
102
102
|
this.log("Tracked page view", { properties: i, context: e });
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
pageLeave(i, e) {
|
|
106
|
-
if (!this.isEnabled() || !this.initialized || !this.bento || !
|
|
106
|
+
if (!this.isEnabled() || !this.initialized || !this.bento || !a())
|
|
107
107
|
return;
|
|
108
|
-
const
|
|
108
|
+
const t = {
|
|
109
109
|
...i,
|
|
110
110
|
...(e == null ? void 0 : e.page) && {
|
|
111
111
|
path: e.page.path,
|
|
@@ -113,13 +113,147 @@ class y extends o {
|
|
|
113
113
|
referrer: e.page.referrer
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
|
-
this.bento.track("$pageleave",
|
|
116
|
+
this.bento.track("$pageleave", t), this.log("Tracked page leave", { properties: i, context: e });
|
|
117
117
|
}
|
|
118
118
|
reset() {
|
|
119
|
-
!this.isEnabled() || !this.initialized || !this.bento || !
|
|
119
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || this.log("Reset user session - Note: Bento doesn't have a native reset method");
|
|
120
|
+
}
|
|
121
|
+
// ============================================================================
|
|
122
|
+
// Bento-Specific Utility Methods
|
|
123
|
+
// ============================================================================
|
|
124
|
+
/**
|
|
125
|
+
* Add a tag to the current user
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* bentoProvider.tag('premium_user');
|
|
130
|
+
* bentoProvider.tag('beta_tester');
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
tag(i) {
|
|
134
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || (this.bento.tag(i), this.log("Added tag to user", { tag: i }));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get the current user's email address
|
|
138
|
+
*
|
|
139
|
+
* @returns The user's email or null if not identified
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const email = bentoProvider.getEmail();
|
|
144
|
+
* if (email) {
|
|
145
|
+
* console.log('Current user:', email);
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
getEmail() {
|
|
150
|
+
return !this.isEnabled() || !this.initialized || !this.bento || !a() ? null : this.bento.getEmail();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get the current user's name
|
|
154
|
+
*
|
|
155
|
+
* @returns The user's name or null if not set
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const name = bentoProvider.getName();
|
|
160
|
+
* if (name) {
|
|
161
|
+
* console.log('Welcome back,', name);
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
getName() {
|
|
166
|
+
return !this.isEnabled() || !this.initialized || !this.bento || !a() ? null : this.bento.getName();
|
|
167
|
+
}
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// Survey Methods
|
|
170
|
+
// ============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Show a Bento survey form
|
|
173
|
+
*
|
|
174
|
+
* @param element - The HTML element to render the survey in
|
|
175
|
+
* @param surveyId - The survey ID from your Bento account
|
|
176
|
+
* @param type - Display type: 'popup' or 'inline' (default: 'popup')
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const container = document.getElementById('survey-container');
|
|
181
|
+
* if (container) {
|
|
182
|
+
* bentoProvider.showSurveyForm(container, 'survey-123', 'popup');
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
showSurveyForm(i, e, t = "popup") {
|
|
187
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || (this.bento.showSurveyForm(i, e, t), this.log("Showed survey form", { surveyId: e, type: t }));
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Validate an email address using Bento's spam check
|
|
191
|
+
*
|
|
192
|
+
* @param email - The email address to validate
|
|
193
|
+
* @returns Promise that resolves to true if email is valid, false if spam
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const isValid = await bentoProvider.spamCheck('user@example.com');
|
|
198
|
+
* if (!isValid) {
|
|
199
|
+
* console.log('Invalid or spam email detected');
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
async spamCheck(i) {
|
|
204
|
+
if (!this.isEnabled() || !this.initialized || !this.bento || !a())
|
|
205
|
+
return !1;
|
|
206
|
+
try {
|
|
207
|
+
const e = await this.bento.spamCheck(i);
|
|
208
|
+
return this.log("Spam check completed", { email: i, result: e }), e;
|
|
209
|
+
} catch (e) {
|
|
210
|
+
return console.error("[Bento-Client] Spam check failed:", e), !1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// ============================================================================
|
|
214
|
+
// Chat Methods (if chat is enabled in Bento)
|
|
215
|
+
// ============================================================================
|
|
216
|
+
/**
|
|
217
|
+
* Show the Bento chat widget
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* bentoProvider.showChat();
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
showChat() {
|
|
225
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || (this.bento.showChat ? (this.bento.showChat(), this.log("Showed chat widget")) : console.warn(
|
|
226
|
+
"[Bento-Client] Chat not available. Make sure chat is enabled in your Bento settings."
|
|
227
|
+
));
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Hide the Bento chat widget
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* bentoProvider.hideChat();
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
hideChat() {
|
|
238
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || (this.bento.hideChat ? (this.bento.hideChat(), this.log("Hid chat widget")) : console.warn(
|
|
239
|
+
"[Bento-Client] Chat not available. Make sure chat is enabled in your Bento settings."
|
|
240
|
+
));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Open the Bento chat widget
|
|
244
|
+
*
|
|
245
|
+
* @example
|
|
246
|
+
* ```typescript
|
|
247
|
+
* bentoProvider.openChat();
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
openChat() {
|
|
251
|
+
!this.isEnabled() || !this.initialized || !this.bento || !a() || (this.bento.openChat ? (this.bento.openChat(), this.log("Opened chat widget")) : console.warn(
|
|
252
|
+
"[Bento-Client] Chat not available. Make sure chat is enabled in your Bento settings."
|
|
253
|
+
));
|
|
120
254
|
}
|
|
121
255
|
}
|
|
122
|
-
class w extends
|
|
256
|
+
class w extends d {
|
|
123
257
|
constructor(i) {
|
|
124
258
|
super({ debug: i.debug, enabled: i.enabled });
|
|
125
259
|
r(this, "name", "Pirsch-Client");
|
|
@@ -130,14 +264,14 @@ class w extends o {
|
|
|
130
264
|
}
|
|
131
265
|
async initialize() {
|
|
132
266
|
if (this.isEnabled() && !this.initialized) {
|
|
133
|
-
if (!
|
|
267
|
+
if (!a()) {
|
|
134
268
|
this.log("Skipping initialization - not in browser environment");
|
|
135
269
|
return;
|
|
136
270
|
}
|
|
137
271
|
if (!this.config.identificationCode || typeof this.config.identificationCode != "string")
|
|
138
272
|
throw new Error("Pirsch requires an identificationCode");
|
|
139
273
|
try {
|
|
140
|
-
const { Pirsch: i } = await import("../web-
|
|
274
|
+
const { Pirsch: i } = await import("../web-imCcOhDC.js").then((e) => e.w);
|
|
141
275
|
this.client = new i({
|
|
142
276
|
identificationCode: this.config.identificationCode,
|
|
143
277
|
...this.config.hostname && { hostname: this.config.hostname }
|
|
@@ -154,14 +288,14 @@ class w extends o {
|
|
|
154
288
|
!this.isEnabled() || !this.initialized || !this.client || (this.client.event("user_identified", 0, {
|
|
155
289
|
userId: i,
|
|
156
290
|
...e
|
|
157
|
-
}).catch((
|
|
158
|
-
console.error("[Pirsch-Client] Failed to track identify event:",
|
|
291
|
+
}).catch((t) => {
|
|
292
|
+
console.error("[Pirsch-Client] Failed to track identify event:", t);
|
|
159
293
|
}), this.log("Identified user via event", { userId: i, traits: e }));
|
|
160
294
|
}
|
|
161
295
|
async track(i, e) {
|
|
162
|
-
var
|
|
296
|
+
var s, n;
|
|
163
297
|
if (!this.isEnabled() || !this.initialized || !this.client) return;
|
|
164
|
-
const
|
|
298
|
+
const t = {
|
|
165
299
|
...i.properties,
|
|
166
300
|
category: i.category,
|
|
167
301
|
...i.userId && { userId: i.userId },
|
|
@@ -173,21 +307,21 @@ class w extends o {
|
|
|
173
307
|
},
|
|
174
308
|
...(e == null ? void 0 : e.device) && { device: e.device },
|
|
175
309
|
...(e == null ? void 0 : e.utm) && { utm: e.utm },
|
|
176
|
-
...((
|
|
177
|
-
...((
|
|
310
|
+
...((s = e == null ? void 0 : e.user) == null ? void 0 : s.email) && { user_email: e.user.email },
|
|
311
|
+
...((n = e == null ? void 0 : e.user) == null ? void 0 : n.traits) && { user_traits: e.user.traits }
|
|
178
312
|
};
|
|
179
313
|
try {
|
|
180
|
-
await this.client.event(i.action, 0,
|
|
181
|
-
} catch (
|
|
182
|
-
console.error("[Pirsch-Client] Failed to track event:",
|
|
314
|
+
await this.client.event(i.action, 0, t), this.log("Tracked event", { event: i, context: e });
|
|
315
|
+
} catch (o) {
|
|
316
|
+
console.error("[Pirsch-Client] Failed to track event:", o);
|
|
183
317
|
}
|
|
184
318
|
}
|
|
185
319
|
pageView(i, e) {
|
|
186
|
-
if (!(!this.isEnabled() || !this.initialized || !this.client || !
|
|
187
|
-
if (this.client.hit().catch((
|
|
188
|
-
console.error("[Pirsch-Client] Failed to track page view:",
|
|
320
|
+
if (!(!this.isEnabled() || !this.initialized || !this.client || !a())) {
|
|
321
|
+
if (this.client.hit().catch((t) => {
|
|
322
|
+
console.error("[Pirsch-Client] Failed to track page view:", t);
|
|
189
323
|
}), i && Object.keys(i).length > 0) {
|
|
190
|
-
const
|
|
324
|
+
const t = {
|
|
191
325
|
...i,
|
|
192
326
|
...(e == null ? void 0 : e.page) && {
|
|
193
327
|
path: e.page.path,
|
|
@@ -195,10 +329,10 @@ class w extends o {
|
|
|
195
329
|
referrer: e.page.referrer
|
|
196
330
|
}
|
|
197
331
|
};
|
|
198
|
-
this.client.event("page_view", 0,
|
|
332
|
+
this.client.event("page_view", 0, t).catch((s) => {
|
|
199
333
|
console.error(
|
|
200
334
|
"[Pirsch-Client] Failed to track page view event:",
|
|
201
|
-
|
|
335
|
+
s
|
|
202
336
|
);
|
|
203
337
|
});
|
|
204
338
|
}
|
|
@@ -206,28 +340,28 @@ class w extends o {
|
|
|
206
340
|
}
|
|
207
341
|
}
|
|
208
342
|
pageLeave(i, e) {
|
|
209
|
-
if (!this.isEnabled() || !this.initialized || !this.client || !
|
|
343
|
+
if (!this.isEnabled() || !this.initialized || !this.client || !a())
|
|
210
344
|
return;
|
|
211
|
-
const
|
|
345
|
+
const t = {
|
|
212
346
|
...i,
|
|
213
347
|
...(e == null ? void 0 : e.page) && {
|
|
214
348
|
path: e.page.path,
|
|
215
349
|
title: e.page.title
|
|
216
350
|
}
|
|
217
351
|
};
|
|
218
|
-
this.client.event("page_leave", 0,
|
|
219
|
-
console.error("[Pirsch-Client] Failed to track page leave:",
|
|
352
|
+
this.client.event("page_leave", 0, t).catch((s) => {
|
|
353
|
+
console.error("[Pirsch-Client] Failed to track page leave:", s);
|
|
220
354
|
}), this.log("Tracked page leave", { properties: i, context: e });
|
|
221
355
|
}
|
|
222
356
|
reset() {
|
|
223
|
-
!this.isEnabled() || !this.initialized || !this.client || !
|
|
357
|
+
!this.isEnabled() || !this.initialized || !this.client || !a() || (this.client.event("session_reset", 0, {}).catch((i) => {
|
|
224
358
|
console.error("[Pirsch-Client] Failed to track session reset:", i);
|
|
225
359
|
}), this.log("Reset user session"));
|
|
226
360
|
}
|
|
227
361
|
}
|
|
228
|
-
class
|
|
362
|
+
class y extends d {
|
|
229
363
|
constructor(i) {
|
|
230
|
-
var e,
|
|
364
|
+
var e, t, s, n, o;
|
|
231
365
|
super({ debug: i.debug, enabled: i.enabled });
|
|
232
366
|
r(this, "name", "Proxy");
|
|
233
367
|
r(this, "config");
|
|
@@ -238,7 +372,7 @@ class m extends o {
|
|
|
238
372
|
r(this, "retryAttempts");
|
|
239
373
|
r(this, "retryBackoff");
|
|
240
374
|
r(this, "retryInitialDelay");
|
|
241
|
-
this.config = i, this.batchSize = ((e = i.batch) == null ? void 0 : e.size) ?? 10, this.batchInterval = ((
|
|
375
|
+
this.config = i, this.batchSize = ((e = i.batch) == null ? void 0 : e.size) ?? 10, this.batchInterval = ((t = i.batch) == null ? void 0 : t.interval) ?? 5e3, this.retryAttempts = ((s = i.retry) == null ? void 0 : s.attempts) ?? 3, this.retryBackoff = ((n = i.retry) == null ? void 0 : n.backoff) ?? "exponential", this.retryInitialDelay = ((o = i.retry) == null ? void 0 : o.initialDelay) ?? 1e3, typeof window < "u" && (window.addEventListener("beforeunload", () => {
|
|
242
376
|
this.flush(!0);
|
|
243
377
|
}), document.addEventListener("visibilitychange", () => {
|
|
244
378
|
document.visibilityState === "hidden" && this.flush(!0);
|
|
@@ -298,19 +432,19 @@ class m extends o {
|
|
|
298
432
|
}, this.batchInterval));
|
|
299
433
|
}
|
|
300
434
|
async sendEvents(i, e = !1) {
|
|
301
|
-
const
|
|
435
|
+
const t = { events: i };
|
|
302
436
|
if (e && typeof navigator < "u" && navigator.sendBeacon) {
|
|
303
|
-
const
|
|
437
|
+
const s = new Blob([JSON.stringify(t)], {
|
|
304
438
|
type: "application/json"
|
|
305
439
|
});
|
|
306
|
-
navigator.sendBeacon(this.config.endpoint,
|
|
440
|
+
navigator.sendBeacon(this.config.endpoint, s) || console.warn("[Proxy] Failed to send events via beacon");
|
|
307
441
|
return;
|
|
308
442
|
}
|
|
309
|
-
await this.sendWithRetry(
|
|
443
|
+
await this.sendWithRetry(t);
|
|
310
444
|
}
|
|
311
445
|
async sendWithRetry(i, e = 0) {
|
|
312
446
|
try {
|
|
313
|
-
const
|
|
447
|
+
const t = await fetch(this.config.endpoint, {
|
|
314
448
|
method: "POST",
|
|
315
449
|
headers: {
|
|
316
450
|
"Content-Type": "application/json",
|
|
@@ -320,15 +454,15 @@ class m extends o {
|
|
|
320
454
|
// Don't include credentials by default
|
|
321
455
|
credentials: "same-origin"
|
|
322
456
|
});
|
|
323
|
-
if (!
|
|
324
|
-
throw new Error(`HTTP ${
|
|
457
|
+
if (!t.ok)
|
|
458
|
+
throw new Error(`HTTP ${t.status}: ${t.statusText}`);
|
|
325
459
|
this.log(`Sent ${i.events.length} events successfully`);
|
|
326
|
-
} catch (
|
|
460
|
+
} catch (t) {
|
|
327
461
|
if (e < this.retryAttempts) {
|
|
328
|
-
const
|
|
329
|
-
return this.log(`Retry attempt ${e + 1} after ${
|
|
462
|
+
const s = this.calculateRetryDelay(e);
|
|
463
|
+
return this.log(`Retry attempt ${e + 1} after ${s}ms`, { error: t }), await new Promise((n) => setTimeout(n, s)), this.sendWithRetry(i, e + 1);
|
|
330
464
|
}
|
|
331
|
-
throw console.error("[Proxy] Failed to send events after retries:",
|
|
465
|
+
throw console.error("[Proxy] Failed to send events after retries:", t), t;
|
|
332
466
|
}
|
|
333
467
|
}
|
|
334
468
|
calculateRetryDelay(i) {
|
|
@@ -365,9 +499,9 @@ class m extends o {
|
|
|
365
499
|
}
|
|
366
500
|
}
|
|
367
501
|
export {
|
|
368
|
-
|
|
369
|
-
|
|
502
|
+
d as BaseAnalyticsProvider,
|
|
503
|
+
b as BentoClientProvider,
|
|
370
504
|
w as PirschClientProvider,
|
|
371
505
|
E as PostHogClientProvider,
|
|
372
|
-
|
|
506
|
+
y as ProxyProvider
|
|
373
507
|
};
|
package/dist/providers/server.js
CHANGED
|
@@ -23,7 +23,7 @@ class v extends p {
|
|
|
23
23
|
if (!((e = this.config.authentication) != null && e.secretKey) || typeof this.config.authentication.secretKey != "string")
|
|
24
24
|
throw new Error("Bento requires authentication.secretKey");
|
|
25
25
|
try {
|
|
26
|
-
const { Analytics: s } = await import("../bento-node-sdk.esm-
|
|
26
|
+
const { Analytics: s } = await import("../bento-node-sdk.esm-CWEAoj97.js"), { debug: a, enabled: t, ...o } = this.config;
|
|
27
27
|
this.client = new s(o), this.initialized = !0, this.log("Initialized successfully", {
|
|
28
28
|
siteUuid: this.config.siteUuid
|
|
29
29
|
});
|
|
@@ -89,7 +89,7 @@ class v extends p {
|
|
|
89
89
|
}, t = ((r = e == null ? void 0 : e.user) == null ? void 0 : r.traits) || {};
|
|
90
90
|
this.client.V1.track({
|
|
91
91
|
email: s,
|
|
92
|
-
type: "$
|
|
92
|
+
type: "$view",
|
|
93
93
|
details: a,
|
|
94
94
|
fields: t
|
|
95
95
|
}).catch((h) => {
|
|
@@ -119,7 +119,7 @@ class E extends p {
|
|
|
119
119
|
if (!this.config.clientSecret || typeof this.config.clientSecret != "string")
|
|
120
120
|
throw new Error("Pirsch requires a clientSecret (or access key)");
|
|
121
121
|
try {
|
|
122
|
-
const { Pirsch: i } = await import("../index-
|
|
122
|
+
const { Pirsch: i } = await import("../index-zS7gy63J.js").then((t) => t.i), { debug: e, enabled: s, ...a } = this.config;
|
|
123
123
|
this.client = new i(a), this.initialized = !0, this.log("Initialized successfully", {
|
|
124
124
|
hostname: this.config.hostname
|
|
125
125
|
});
|
|
@@ -233,12 +233,14 @@ async function g(l, n, i) {
|
|
|
233
233
|
device: {
|
|
234
234
|
...(e = r.context) == null ? void 0 : e.device,
|
|
235
235
|
// Add IP (using type assertion for extended fields)
|
|
236
|
+
// biome-ignore lint/suspicious/noExplicitAny: IP field not in base device type
|
|
236
237
|
...t ? { ip: t } : {}
|
|
237
238
|
}
|
|
238
239
|
};
|
|
239
240
|
await n.track(r.event.action, r.event.properties, {
|
|
240
241
|
userId: r.event.userId,
|
|
241
242
|
sessionId: r.event.sessionId,
|
|
243
|
+
// biome-ignore lint/suspicious/noExplicitAny: Generic context forwarding requires type assertion
|
|
242
244
|
context: h
|
|
243
245
|
});
|
|
244
246
|
break;
|
|
@@ -253,6 +255,7 @@ async function g(l, n, i) {
|
|
|
253
255
|
...o,
|
|
254
256
|
device: {
|
|
255
257
|
...(s = r.context) == null ? void 0 : s.device,
|
|
258
|
+
// biome-ignore lint/suspicious/noExplicitAny: IP field not in base device type
|
|
256
259
|
// Add IP (using type assertion for extended fields)
|
|
257
260
|
...t ? { ip: t } : {}
|
|
258
261
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as O, a as P, b as E } from "./axios-
|
|
1
|
+
import { r as O, a as P, b as E } from "./axios-0_CwElpL.js";
|
|
2
2
|
function j(f, p) {
|
|
3
3
|
for (var d = 0; d < p.length; d++) {
|
|
4
4
|
const o = p[d];
|
|
@@ -19,19 +19,19 @@ var r = {}, w;
|
|
|
19
19
|
function C() {
|
|
20
20
|
if (w) return r;
|
|
21
21
|
w = 1;
|
|
22
|
-
var f = r && r.__createBinding || (Object.create ? function(c, e, t, n) {
|
|
22
|
+
var f = r && r.__createBinding || (Object.create ? (function(c, e, t, n) {
|
|
23
23
|
n === void 0 && (n = t);
|
|
24
24
|
var i = Object.getOwnPropertyDescriptor(e, t);
|
|
25
25
|
(!i || ("get" in i ? !e.__esModule : i.writable || i.configurable)) && (i = { enumerable: !0, get: function() {
|
|
26
26
|
return e[t];
|
|
27
27
|
} }), Object.defineProperty(c, n, i);
|
|
28
|
-
} : function(c, e, t, n) {
|
|
28
|
+
}) : (function(c, e, t, n) {
|
|
29
29
|
n === void 0 && (n = t), c[n] = e[t];
|
|
30
|
-
}), p = r && r.__setModuleDefault || (Object.create ? function(c, e) {
|
|
30
|
+
})), p = r && r.__setModuleDefault || (Object.create ? (function(c, e) {
|
|
31
31
|
Object.defineProperty(c, "default", { enumerable: !0, value: e });
|
|
32
|
-
} : function(c, e) {
|
|
32
|
+
}) : function(c, e) {
|
|
33
33
|
c.default = e;
|
|
34
|
-
}), d = r && r.__importStar || /* @__PURE__ */ function() {
|
|
34
|
+
}), d = r && r.__importStar || /* @__PURE__ */ (function() {
|
|
35
35
|
var c = function(e) {
|
|
36
36
|
return c = Object.getOwnPropertyNames || function(t) {
|
|
37
37
|
var n = [];
|
|
@@ -45,7 +45,7 @@ function C() {
|
|
|
45
45
|
if (e != null) for (var n = c(e), i = 0; i < n.length; i++) n[i] !== "default" && f(t, e, n[i]);
|
|
46
46
|
return p(t, e), t;
|
|
47
47
|
};
|
|
48
|
-
}(), o = r && r.__awaiter || function(c, e, t, n) {
|
|
48
|
+
})(), o = r && r.__awaiter || function(c, e, t, n) {
|
|
49
49
|
function i(s) {
|
|
50
50
|
return s instanceof t ? s : new t(function(l) {
|
|
51
51
|
l(s);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksee/analytics",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "A highly typed, provider-agnostic analytics library for TypeScript applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"analytics",
|
|
37
37
|
"typescript",
|
|
38
38
|
"posthog",
|
|
39
|
+
"bento",
|
|
40
|
+
"pirsch",
|
|
39
41
|
"tracking",
|
|
40
42
|
"events",
|
|
41
43
|
"type-safe"
|
|
@@ -74,6 +76,8 @@
|
|
|
74
76
|
"test": "vitest run",
|
|
75
77
|
"test:watch": "vitest",
|
|
76
78
|
"build": "vite build",
|
|
79
|
+
"dev": "pnpm --filter @stacksee/docs dev",
|
|
80
|
+
"build:docs": "pnpm --filter @stacksee/docs build",
|
|
77
81
|
"deploy": "npm publish",
|
|
78
82
|
"typecheck": "tsc --noEmit",
|
|
79
83
|
"ci:publish": "pnpm build && changeset publish",
|