@stacksee/analytics 0.5.0 → 0.8.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/dist/_commonjsHelpers-B4e78b8K.js +28 -0
- package/dist/axios-gULqh8dv.js +1820 -0
- package/dist/bento-node-sdk.esm-C4HG7SVz.js +1711 -0
- package/dist/index-bgxxv-IJ.js +829 -0
- package/dist/providers/bento/client.d.ts +47 -0
- package/dist/providers/bento/server.d.ts +58 -0
- package/dist/providers/client.d.ts +7 -0
- package/dist/providers/client.js +371 -4
- package/dist/providers/pirsch/client.d.ts +34 -0
- package/dist/providers/pirsch/server.d.ts +49 -0
- package/dist/providers/proxy/client.d.ts +56 -0
- package/dist/providers/proxy/server.d.ts +55 -0
- package/dist/providers/proxy/types.d.ts +64 -0
- package/dist/providers/server.d.ts +6 -0
- package/dist/providers/server.js +305 -4
- package/dist/web-CvEQewPd.js +220 -0
- package/package.json +3 -1
- package/readme.md +48 -21
|
@@ -0,0 +1,1711 @@
|
|
|
1
|
+
import { c as W, g as ae } from "./_commonjsHelpers-B4e78b8K.js";
|
|
2
|
+
var Z = { exports: {} }, re;
|
|
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() {
|
|
6
|
+
function u() {
|
|
7
|
+
this.fetch = !1, this.DOMException = t.DOMException;
|
|
8
|
+
}
|
|
9
|
+
return u.prototype = t, new u();
|
|
10
|
+
}();
|
|
11
|
+
(function(u) {
|
|
12
|
+
(function(i) {
|
|
13
|
+
var p = typeof u < "u" && u || typeof self < "u" && self || // eslint-disable-next-line no-undef
|
|
14
|
+
typeof W < "u" && W || {}, e = {
|
|
15
|
+
searchParams: "URLSearchParams" in p,
|
|
16
|
+
iterable: "Symbol" in p && "iterator" in Symbol,
|
|
17
|
+
blob: "FileReader" in p && "Blob" in p && function() {
|
|
18
|
+
try {
|
|
19
|
+
return new Blob(), !0;
|
|
20
|
+
} catch {
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
}(),
|
|
24
|
+
formData: "FormData" in p,
|
|
25
|
+
arrayBuffer: "ArrayBuffer" in p
|
|
26
|
+
};
|
|
27
|
+
function v(n) {
|
|
28
|
+
return n && DataView.prototype.isPrototypeOf(n);
|
|
29
|
+
}
|
|
30
|
+
if (e.arrayBuffer)
|
|
31
|
+
var P = [
|
|
32
|
+
"[object Int8Array]",
|
|
33
|
+
"[object Uint8Array]",
|
|
34
|
+
"[object Uint8ClampedArray]",
|
|
35
|
+
"[object Int16Array]",
|
|
36
|
+
"[object Uint16Array]",
|
|
37
|
+
"[object Int32Array]",
|
|
38
|
+
"[object Uint32Array]",
|
|
39
|
+
"[object Float32Array]",
|
|
40
|
+
"[object Float64Array]"
|
|
41
|
+
], O = ArrayBuffer.isView || function(n) {
|
|
42
|
+
return n && P.indexOf(Object.prototype.toString.call(n)) > -1;
|
|
43
|
+
};
|
|
44
|
+
function F(n) {
|
|
45
|
+
if (typeof n != "string" && (n = String(n)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(n) || n === "")
|
|
46
|
+
throw new TypeError('Invalid character in header field name: "' + n + '"');
|
|
47
|
+
return n.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
function _(n) {
|
|
50
|
+
return typeof n != "string" && (n = String(n)), n;
|
|
51
|
+
}
|
|
52
|
+
function $(n) {
|
|
53
|
+
var r = {
|
|
54
|
+
next: function() {
|
|
55
|
+
var s = n.shift();
|
|
56
|
+
return { done: s === void 0, value: s };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return e.iterable && (r[Symbol.iterator] = function() {
|
|
60
|
+
return r;
|
|
61
|
+
}), r;
|
|
62
|
+
}
|
|
63
|
+
function g(n) {
|
|
64
|
+
this.map = {}, n instanceof g ? n.forEach(function(r, s) {
|
|
65
|
+
this.append(s, r);
|
|
66
|
+
}, this) : Array.isArray(n) ? n.forEach(function(r) {
|
|
67
|
+
if (r.length != 2)
|
|
68
|
+
throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + r.length);
|
|
69
|
+
this.append(r[0], r[1]);
|
|
70
|
+
}, this) : n && Object.getOwnPropertyNames(n).forEach(function(r) {
|
|
71
|
+
this.append(r, n[r]);
|
|
72
|
+
}, this);
|
|
73
|
+
}
|
|
74
|
+
g.prototype.append = function(n, r) {
|
|
75
|
+
n = F(n), r = _(r);
|
|
76
|
+
var s = this.map[n];
|
|
77
|
+
this.map[n] = s ? s + ", " + r : r;
|
|
78
|
+
}, g.prototype.delete = function(n) {
|
|
79
|
+
delete this.map[F(n)];
|
|
80
|
+
}, g.prototype.get = function(n) {
|
|
81
|
+
return n = F(n), this.has(n) ? this.map[n] : null;
|
|
82
|
+
}, g.prototype.has = function(n) {
|
|
83
|
+
return this.map.hasOwnProperty(F(n));
|
|
84
|
+
}, g.prototype.set = function(n, r) {
|
|
85
|
+
this.map[F(n)] = _(r);
|
|
86
|
+
}, g.prototype.forEach = function(n, r) {
|
|
87
|
+
for (var s in this.map)
|
|
88
|
+
this.map.hasOwnProperty(s) && n.call(r, this.map[s], s, this);
|
|
89
|
+
}, g.prototype.keys = function() {
|
|
90
|
+
var n = [];
|
|
91
|
+
return this.forEach(function(r, s) {
|
|
92
|
+
n.push(s);
|
|
93
|
+
}), $(n);
|
|
94
|
+
}, g.prototype.values = function() {
|
|
95
|
+
var n = [];
|
|
96
|
+
return this.forEach(function(r) {
|
|
97
|
+
n.push(r);
|
|
98
|
+
}), $(n);
|
|
99
|
+
}, g.prototype.entries = function() {
|
|
100
|
+
var n = [];
|
|
101
|
+
return this.forEach(function(r, s) {
|
|
102
|
+
n.push([s, r]);
|
|
103
|
+
}), $(n);
|
|
104
|
+
}, e.iterable && (g.prototype[Symbol.iterator] = g.prototype.entries);
|
|
105
|
+
function k(n) {
|
|
106
|
+
if (!n._noBody) {
|
|
107
|
+
if (n.bodyUsed)
|
|
108
|
+
return Promise.reject(new TypeError("Already read"));
|
|
109
|
+
n.bodyUsed = !0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function G(n) {
|
|
113
|
+
return new Promise(function(r, s) {
|
|
114
|
+
n.onload = function() {
|
|
115
|
+
r(n.result);
|
|
116
|
+
}, n.onerror = function() {
|
|
117
|
+
s(n.error);
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function H(n) {
|
|
122
|
+
var r = new FileReader(), s = G(r);
|
|
123
|
+
return r.readAsArrayBuffer(n), s;
|
|
124
|
+
}
|
|
125
|
+
function j(n) {
|
|
126
|
+
var r = new FileReader(), s = G(r), f = /charset=([A-Za-z0-9_-]+)/.exec(n.type), d = f ? f[1] : "utf-8";
|
|
127
|
+
return r.readAsText(n, d), s;
|
|
128
|
+
}
|
|
129
|
+
function z(n) {
|
|
130
|
+
for (var r = new Uint8Array(n), s = new Array(r.length), f = 0; f < r.length; f++)
|
|
131
|
+
s[f] = String.fromCharCode(r[f]);
|
|
132
|
+
return s.join("");
|
|
133
|
+
}
|
|
134
|
+
function q(n) {
|
|
135
|
+
if (n.slice)
|
|
136
|
+
return n.slice(0);
|
|
137
|
+
var r = new Uint8Array(n.byteLength);
|
|
138
|
+
return r.set(new Uint8Array(n)), r.buffer;
|
|
139
|
+
}
|
|
140
|
+
function I() {
|
|
141
|
+
return this.bodyUsed = !1, this._initBody = function(n) {
|
|
142
|
+
this.bodyUsed = this.bodyUsed, this._bodyInit = n, n ? typeof n == "string" ? this._bodyText = n : e.blob && Blob.prototype.isPrototypeOf(n) ? this._bodyBlob = n : e.formData && FormData.prototype.isPrototypeOf(n) ? this._bodyFormData = n : e.searchParams && URLSearchParams.prototype.isPrototypeOf(n) ? this._bodyText = n.toString() : e.arrayBuffer && e.blob && v(n) ? (this._bodyArrayBuffer = q(n.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : e.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(n) || O(n)) ? this._bodyArrayBuffer = q(n) : this._bodyText = n = Object.prototype.toString.call(n) : (this._noBody = !0, this._bodyText = ""), this.headers.get("content-type") || (typeof n == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : e.searchParams && URLSearchParams.prototype.isPrototypeOf(n) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
|
|
143
|
+
}, e.blob && (this.blob = function() {
|
|
144
|
+
var n = k(this);
|
|
145
|
+
if (n)
|
|
146
|
+
return n;
|
|
147
|
+
if (this._bodyBlob)
|
|
148
|
+
return Promise.resolve(this._bodyBlob);
|
|
149
|
+
if (this._bodyArrayBuffer)
|
|
150
|
+
return Promise.resolve(new Blob([this._bodyArrayBuffer]));
|
|
151
|
+
if (this._bodyFormData)
|
|
152
|
+
throw new Error("could not read FormData body as blob");
|
|
153
|
+
return Promise.resolve(new Blob([this._bodyText]));
|
|
154
|
+
}), this.arrayBuffer = function() {
|
|
155
|
+
if (this._bodyArrayBuffer) {
|
|
156
|
+
var n = k(this);
|
|
157
|
+
return n || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
|
|
158
|
+
this._bodyArrayBuffer.buffer.slice(
|
|
159
|
+
this._bodyArrayBuffer.byteOffset,
|
|
160
|
+
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
|
161
|
+
)
|
|
162
|
+
) : Promise.resolve(this._bodyArrayBuffer));
|
|
163
|
+
} else {
|
|
164
|
+
if (e.blob)
|
|
165
|
+
return this.blob().then(H);
|
|
166
|
+
throw new Error("could not read as ArrayBuffer");
|
|
167
|
+
}
|
|
168
|
+
}, this.text = function() {
|
|
169
|
+
var n = k(this);
|
|
170
|
+
if (n)
|
|
171
|
+
return n;
|
|
172
|
+
if (this._bodyBlob)
|
|
173
|
+
return j(this._bodyBlob);
|
|
174
|
+
if (this._bodyArrayBuffer)
|
|
175
|
+
return Promise.resolve(z(this._bodyArrayBuffer));
|
|
176
|
+
if (this._bodyFormData)
|
|
177
|
+
throw new Error("could not read FormData body as text");
|
|
178
|
+
return Promise.resolve(this._bodyText);
|
|
179
|
+
}, e.formData && (this.formData = function() {
|
|
180
|
+
return this.text().then(x);
|
|
181
|
+
}), this.json = function() {
|
|
182
|
+
return this.text().then(JSON.parse);
|
|
183
|
+
}, this;
|
|
184
|
+
}
|
|
185
|
+
var U = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
186
|
+
function Q(n) {
|
|
187
|
+
var r = n.toUpperCase();
|
|
188
|
+
return U.indexOf(r) > -1 ? r : n;
|
|
189
|
+
}
|
|
190
|
+
function S(n, r) {
|
|
191
|
+
if (!(this instanceof S))
|
|
192
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
193
|
+
r = r || {};
|
|
194
|
+
var s = r.body;
|
|
195
|
+
if (n instanceof S) {
|
|
196
|
+
if (n.bodyUsed)
|
|
197
|
+
throw new TypeError("Already read");
|
|
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
|
+
} else
|
|
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() {
|
|
202
|
+
if ("AbortController" in p) {
|
|
203
|
+
var h = new AbortController();
|
|
204
|
+
return h.signal;
|
|
205
|
+
}
|
|
206
|
+
}(), this.referrer = null, (this.method === "GET" || this.method === "HEAD") && s)
|
|
207
|
+
throw new TypeError("Body not allowed for GET or HEAD requests");
|
|
208
|
+
if (this._initBody(s), (this.method === "GET" || this.method === "HEAD") && (r.cache === "no-store" || r.cache === "no-cache")) {
|
|
209
|
+
var f = /([?&])_=[^&]*/;
|
|
210
|
+
if (f.test(this.url))
|
|
211
|
+
this.url = this.url.replace(f, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
|
|
212
|
+
else {
|
|
213
|
+
var d = /\?/;
|
|
214
|
+
this.url += (d.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
S.prototype.clone = function() {
|
|
219
|
+
return new S(this, { body: this._bodyInit });
|
|
220
|
+
};
|
|
221
|
+
function x(n) {
|
|
222
|
+
var r = new FormData();
|
|
223
|
+
return n.trim().split("&").forEach(function(s) {
|
|
224
|
+
if (s) {
|
|
225
|
+
var f = s.split("="), d = f.shift().replace(/\+/g, " "), h = f.join("=").replace(/\+/g, " ");
|
|
226
|
+
r.append(decodeURIComponent(d), decodeURIComponent(h));
|
|
227
|
+
}
|
|
228
|
+
}), r;
|
|
229
|
+
}
|
|
230
|
+
function X(n) {
|
|
231
|
+
var r = new g(), s = n.replace(/\r?\n[\t ]+/g, " ");
|
|
232
|
+
return s.split("\r").map(function(f) {
|
|
233
|
+
return f.indexOf(`
|
|
234
|
+
`) === 0 ? f.substr(1, f.length) : f;
|
|
235
|
+
}).forEach(function(f) {
|
|
236
|
+
var d = f.split(":"), h = d.shift().trim();
|
|
237
|
+
if (h) {
|
|
238
|
+
var b = d.join(":").trim();
|
|
239
|
+
try {
|
|
240
|
+
r.append(h, b);
|
|
241
|
+
} catch (E) {
|
|
242
|
+
console.warn("Response " + E.message);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}), r;
|
|
246
|
+
}
|
|
247
|
+
I.call(S.prototype);
|
|
248
|
+
function A(n, r) {
|
|
249
|
+
if (!(this instanceof A))
|
|
250
|
+
throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
|
|
251
|
+
if (r || (r = {}), this.type = "default", this.status = r.status === void 0 ? 200 : r.status, this.status < 200 || this.status > 599)
|
|
252
|
+
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
|
|
253
|
+
this.ok = this.status >= 200 && this.status < 300, this.statusText = r.statusText === void 0 ? "" : "" + r.statusText, this.headers = new g(r.headers), this.url = r.url || "", this._initBody(n);
|
|
254
|
+
}
|
|
255
|
+
I.call(A.prototype), A.prototype.clone = function() {
|
|
256
|
+
return new A(this._bodyInit, {
|
|
257
|
+
status: this.status,
|
|
258
|
+
statusText: this.statusText,
|
|
259
|
+
headers: new g(this.headers),
|
|
260
|
+
url: this.url
|
|
261
|
+
});
|
|
262
|
+
}, A.error = function() {
|
|
263
|
+
var n = new A(null, { status: 200, statusText: "" });
|
|
264
|
+
return n.ok = !1, n.status = 0, n.type = "error", n;
|
|
265
|
+
};
|
|
266
|
+
var V = [301, 302, 303, 307, 308];
|
|
267
|
+
A.redirect = function(n, r) {
|
|
268
|
+
if (V.indexOf(r) === -1)
|
|
269
|
+
throw new RangeError("Invalid status code");
|
|
270
|
+
return new A(null, { status: r, headers: { location: n } });
|
|
271
|
+
}, i.DOMException = p.DOMException;
|
|
272
|
+
try {
|
|
273
|
+
new i.DOMException();
|
|
274
|
+
} catch {
|
|
275
|
+
i.DOMException = function(r, s) {
|
|
276
|
+
this.message = r, this.name = s;
|
|
277
|
+
var f = Error(r);
|
|
278
|
+
this.stack = f.stack;
|
|
279
|
+
}, i.DOMException.prototype = Object.create(Error.prototype), i.DOMException.prototype.constructor = i.DOMException;
|
|
280
|
+
}
|
|
281
|
+
function M(n, r) {
|
|
282
|
+
return new Promise(function(s, f) {
|
|
283
|
+
var d = new S(n, r);
|
|
284
|
+
if (d.signal && d.signal.aborted)
|
|
285
|
+
return f(new i.DOMException("Aborted", "AbortError"));
|
|
286
|
+
var h = new XMLHttpRequest();
|
|
287
|
+
function b() {
|
|
288
|
+
h.abort();
|
|
289
|
+
}
|
|
290
|
+
h.onload = function() {
|
|
291
|
+
var m = {
|
|
292
|
+
statusText: h.statusText,
|
|
293
|
+
headers: X(h.getAllResponseHeaders() || "")
|
|
294
|
+
};
|
|
295
|
+
d.url.indexOf("file://") === 0 && (h.status < 200 || h.status > 599) ? m.status = 200 : m.status = h.status, m.url = "responseURL" in h ? h.responseURL : m.headers.get("X-Request-URL");
|
|
296
|
+
var B = "response" in h ? h.response : h.responseText;
|
|
297
|
+
setTimeout(function() {
|
|
298
|
+
s(new A(B, m));
|
|
299
|
+
}, 0);
|
|
300
|
+
}, h.onerror = function() {
|
|
301
|
+
setTimeout(function() {
|
|
302
|
+
f(new TypeError("Network request failed"));
|
|
303
|
+
}, 0);
|
|
304
|
+
}, h.ontimeout = function() {
|
|
305
|
+
setTimeout(function() {
|
|
306
|
+
f(new TypeError("Network request timed out"));
|
|
307
|
+
}, 0);
|
|
308
|
+
}, h.onabort = function() {
|
|
309
|
+
setTimeout(function() {
|
|
310
|
+
f(new i.DOMException("Aborted", "AbortError"));
|
|
311
|
+
}, 0);
|
|
312
|
+
};
|
|
313
|
+
function E(m) {
|
|
314
|
+
try {
|
|
315
|
+
return m === "" && p.location.href ? p.location.href : m;
|
|
316
|
+
} catch {
|
|
317
|
+
return m;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (h.open(d.method, E(d.url), !0), d.credentials === "include" ? h.withCredentials = !0 : d.credentials === "omit" && (h.withCredentials = !1), "responseType" in h && (e.blob ? h.responseType = "blob" : e.arrayBuffer && (h.responseType = "arraybuffer")), r && typeof r.headers == "object" && !(r.headers instanceof g || p.Headers && r.headers instanceof p.Headers)) {
|
|
321
|
+
var T = [];
|
|
322
|
+
Object.getOwnPropertyNames(r.headers).forEach(function(m) {
|
|
323
|
+
T.push(F(m)), h.setRequestHeader(m, _(r.headers[m]));
|
|
324
|
+
}), d.headers.forEach(function(m, B) {
|
|
325
|
+
T.indexOf(B) === -1 && h.setRequestHeader(B, m);
|
|
326
|
+
});
|
|
327
|
+
} else
|
|
328
|
+
d.headers.forEach(function(m, B) {
|
|
329
|
+
h.setRequestHeader(B, m);
|
|
330
|
+
});
|
|
331
|
+
d.signal && (d.signal.addEventListener("abort", b), h.onreadystatechange = function() {
|
|
332
|
+
h.readyState === 4 && d.signal.removeEventListener("abort", b);
|
|
333
|
+
}), h.send(typeof d._bodyInit > "u" ? null : d._bodyInit);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return M.polyfill = !0, p.fetch || (p.fetch = M, p.Headers = g, p.Request = S, p.Response = A), i.Headers = g, i.Request = S, i.Response = A, i.fetch = M, i;
|
|
337
|
+
})({});
|
|
338
|
+
})(a), a.fetch.ponyfill = !0, delete a.fetch.polyfill;
|
|
339
|
+
var o = t.fetch ? t : a;
|
|
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;
|
|
342
|
+
}
|
|
343
|
+
var ue = se();
|
|
344
|
+
const te = /* @__PURE__ */ ae(ue);
|
|
345
|
+
function ne(l, c, t, a, o, u, i) {
|
|
346
|
+
try {
|
|
347
|
+
var p = l[u](i), e = p.value;
|
|
348
|
+
} catch (v) {
|
|
349
|
+
return void t(v);
|
|
350
|
+
}
|
|
351
|
+
p.done ? c(e) : Promise.resolve(e).then(a, o);
|
|
352
|
+
}
|
|
353
|
+
function w(l) {
|
|
354
|
+
return function() {
|
|
355
|
+
var c = this, t = arguments;
|
|
356
|
+
return new Promise(function(a, o) {
|
|
357
|
+
var u = l.apply(c, t);
|
|
358
|
+
function i(e) {
|
|
359
|
+
ne(u, a, o, i, p, "next", e);
|
|
360
|
+
}
|
|
361
|
+
function p(e) {
|
|
362
|
+
ne(u, a, o, i, p, "throw", e);
|
|
363
|
+
}
|
|
364
|
+
i(void 0);
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function oe(l, c, t) {
|
|
369
|
+
if (ie()) return Reflect.construct.apply(null, arguments);
|
|
370
|
+
var a = [null];
|
|
371
|
+
a.push.apply(a, c);
|
|
372
|
+
var o = new (l.bind.apply(l, a))();
|
|
373
|
+
return t && K(o, t.prototype), o;
|
|
374
|
+
}
|
|
375
|
+
function J() {
|
|
376
|
+
return J = Object.assign ? Object.assign.bind() : function(l) {
|
|
377
|
+
for (var c = 1; c < arguments.length; c++) {
|
|
378
|
+
var t = arguments[c];
|
|
379
|
+
for (var a in t) ({}).hasOwnProperty.call(t, a) && (l[a] = t[a]);
|
|
380
|
+
}
|
|
381
|
+
return l;
|
|
382
|
+
}, J.apply(null, arguments);
|
|
383
|
+
}
|
|
384
|
+
function ee(l) {
|
|
385
|
+
return ee = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
|
|
386
|
+
return c.__proto__ || Object.getPrototypeOf(c);
|
|
387
|
+
}, ee(l);
|
|
388
|
+
}
|
|
389
|
+
function D(l, c) {
|
|
390
|
+
l.prototype = Object.create(c.prototype), l.prototype.constructor = l, K(l, c);
|
|
391
|
+
}
|
|
392
|
+
function ce(l) {
|
|
393
|
+
try {
|
|
394
|
+
return Function.toString.call(l).indexOf("[native code]") !== -1;
|
|
395
|
+
} catch {
|
|
396
|
+
return typeof l == "function";
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
function ie() {
|
|
400
|
+
try {
|
|
401
|
+
var l = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
402
|
+
}));
|
|
403
|
+
} catch {
|
|
404
|
+
}
|
|
405
|
+
return (ie = function() {
|
|
406
|
+
return !!l;
|
|
407
|
+
})();
|
|
408
|
+
}
|
|
409
|
+
function y() {
|
|
410
|
+
y = function() {
|
|
411
|
+
return c;
|
|
412
|
+
};
|
|
413
|
+
var l, c = {}, t = Object.prototype, a = t.hasOwnProperty, o = Object.defineProperty || function(r, s, f) {
|
|
414
|
+
r[s] = f.value;
|
|
415
|
+
}, u = typeof Symbol == "function" ? Symbol : {}, i = u.iterator || "@@iterator", p = u.asyncIterator || "@@asyncIterator", e = u.toStringTag || "@@toStringTag";
|
|
416
|
+
function v(r, s, f) {
|
|
417
|
+
return Object.defineProperty(r, s, {
|
|
418
|
+
value: f,
|
|
419
|
+
enumerable: !0,
|
|
420
|
+
configurable: !0,
|
|
421
|
+
writable: !0
|
|
422
|
+
}), r[s];
|
|
423
|
+
}
|
|
424
|
+
try {
|
|
425
|
+
v({}, "");
|
|
426
|
+
} catch {
|
|
427
|
+
v = function(s, f, d) {
|
|
428
|
+
return s[f] = d;
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
function P(r, s, f, d) {
|
|
432
|
+
var h = s && s.prototype instanceof G ? s : G, b = Object.create(h.prototype), E = new M(d || []);
|
|
433
|
+
return o(b, "_invoke", {
|
|
434
|
+
value: x(r, f, E)
|
|
435
|
+
}), b;
|
|
436
|
+
}
|
|
437
|
+
function O(r, s, f) {
|
|
438
|
+
try {
|
|
439
|
+
return {
|
|
440
|
+
type: "normal",
|
|
441
|
+
arg: r.call(s, f)
|
|
442
|
+
};
|
|
443
|
+
} catch (d) {
|
|
444
|
+
return {
|
|
445
|
+
type: "throw",
|
|
446
|
+
arg: d
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
c.wrap = P;
|
|
451
|
+
var F = "suspendedStart", _ = "suspendedYield", $ = "executing", g = "completed", k = {};
|
|
452
|
+
function G() {
|
|
453
|
+
}
|
|
454
|
+
function H() {
|
|
455
|
+
}
|
|
456
|
+
function j() {
|
|
457
|
+
}
|
|
458
|
+
var z = {};
|
|
459
|
+
v(z, i, function() {
|
|
460
|
+
return this;
|
|
461
|
+
});
|
|
462
|
+
var q = Object.getPrototypeOf, I = q && q(q(n([])));
|
|
463
|
+
I && I !== t && a.call(I, i) && (z = I);
|
|
464
|
+
var U = j.prototype = G.prototype = Object.create(z);
|
|
465
|
+
function Q(r) {
|
|
466
|
+
["next", "throw", "return"].forEach(function(s) {
|
|
467
|
+
v(r, s, function(f) {
|
|
468
|
+
return this._invoke(s, f);
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function S(r, s) {
|
|
473
|
+
function f(h, b, E, T) {
|
|
474
|
+
var m = O(r[h], r, b);
|
|
475
|
+
if (m.type !== "throw") {
|
|
476
|
+
var B = m.arg, Y = B.value;
|
|
477
|
+
return Y && typeof Y == "object" && a.call(Y, "__await") ? s.resolve(Y.__await).then(function(C) {
|
|
478
|
+
f("next", C, E, T);
|
|
479
|
+
}, function(C) {
|
|
480
|
+
f("throw", C, E, T);
|
|
481
|
+
}) : s.resolve(Y).then(function(C) {
|
|
482
|
+
B.value = C, E(B);
|
|
483
|
+
}, function(C) {
|
|
484
|
+
return f("throw", C, E, T);
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
T(m.arg);
|
|
488
|
+
}
|
|
489
|
+
var d;
|
|
490
|
+
o(this, "_invoke", {
|
|
491
|
+
value: function(h, b) {
|
|
492
|
+
function E() {
|
|
493
|
+
return new s(function(T, m) {
|
|
494
|
+
f(h, b, T, m);
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
return d = d ? d.then(E, E) : E();
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
function x(r, s, f) {
|
|
502
|
+
var d = F;
|
|
503
|
+
return function(h, b) {
|
|
504
|
+
if (d === $) throw Error("Generator is already running");
|
|
505
|
+
if (d === g) {
|
|
506
|
+
if (h === "throw") throw b;
|
|
507
|
+
return {
|
|
508
|
+
value: l,
|
|
509
|
+
done: !0
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
for (f.method = h, f.arg = b; ; ) {
|
|
513
|
+
var E = f.delegate;
|
|
514
|
+
if (E) {
|
|
515
|
+
var T = X(E, f);
|
|
516
|
+
if (T) {
|
|
517
|
+
if (T === k) continue;
|
|
518
|
+
return T;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (f.method === "next") f.sent = f._sent = f.arg;
|
|
522
|
+
else if (f.method === "throw") {
|
|
523
|
+
if (d === F) throw d = g, f.arg;
|
|
524
|
+
f.dispatchException(f.arg);
|
|
525
|
+
} else f.method === "return" && f.abrupt("return", f.arg);
|
|
526
|
+
d = $;
|
|
527
|
+
var m = O(r, s, f);
|
|
528
|
+
if (m.type === "normal") {
|
|
529
|
+
if (d = f.done ? g : _, m.arg === k) continue;
|
|
530
|
+
return {
|
|
531
|
+
value: m.arg,
|
|
532
|
+
done: f.done
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
m.type === "throw" && (d = g, f.method = "throw", f.arg = m.arg);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
function X(r, s) {
|
|
540
|
+
var f = s.method, d = r.iterator[f];
|
|
541
|
+
if (d === l) return s.delegate = null, f === "throw" && r.iterator.return && (s.method = "return", s.arg = l, X(r, s), s.method === "throw") || f !== "return" && (s.method = "throw", s.arg = new TypeError("The iterator does not provide a '" + f + "' method")), k;
|
|
542
|
+
var h = O(d, r.iterator, s.arg);
|
|
543
|
+
if (h.type === "throw") return s.method = "throw", s.arg = h.arg, s.delegate = null, k;
|
|
544
|
+
var b = h.arg;
|
|
545
|
+
return b ? b.done ? (s[r.resultName] = b.value, s.next = r.nextLoc, s.method !== "return" && (s.method = "next", s.arg = l), s.delegate = null, k) : b : (s.method = "throw", s.arg = new TypeError("iterator result is not an object"), s.delegate = null, k);
|
|
546
|
+
}
|
|
547
|
+
function A(r) {
|
|
548
|
+
var s = {
|
|
549
|
+
tryLoc: r[0]
|
|
550
|
+
};
|
|
551
|
+
1 in r && (s.catchLoc = r[1]), 2 in r && (s.finallyLoc = r[2], s.afterLoc = r[3]), this.tryEntries.push(s);
|
|
552
|
+
}
|
|
553
|
+
function V(r) {
|
|
554
|
+
var s = r.completion || {};
|
|
555
|
+
s.type = "normal", delete s.arg, r.completion = s;
|
|
556
|
+
}
|
|
557
|
+
function M(r) {
|
|
558
|
+
this.tryEntries = [{
|
|
559
|
+
tryLoc: "root"
|
|
560
|
+
}], r.forEach(A, this), this.reset(!0);
|
|
561
|
+
}
|
|
562
|
+
function n(r) {
|
|
563
|
+
if (r || r === "") {
|
|
564
|
+
var s = r[i];
|
|
565
|
+
if (s) return s.call(r);
|
|
566
|
+
if (typeof r.next == "function") return r;
|
|
567
|
+
if (!isNaN(r.length)) {
|
|
568
|
+
var f = -1, d = function h() {
|
|
569
|
+
for (; ++f < r.length; ) if (a.call(r, f)) return h.value = r[f], h.done = !1, h;
|
|
570
|
+
return h.value = l, h.done = !0, h;
|
|
571
|
+
};
|
|
572
|
+
return d.next = d;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
throw new TypeError(typeof r + " is not iterable");
|
|
576
|
+
}
|
|
577
|
+
return H.prototype = j, o(U, "constructor", {
|
|
578
|
+
value: j,
|
|
579
|
+
configurable: !0
|
|
580
|
+
}), o(j, "constructor", {
|
|
581
|
+
value: H,
|
|
582
|
+
configurable: !0
|
|
583
|
+
}), H.displayName = v(j, e, "GeneratorFunction"), c.isGeneratorFunction = function(r) {
|
|
584
|
+
var s = typeof r == "function" && r.constructor;
|
|
585
|
+
return !!s && (s === H || (s.displayName || s.name) === "GeneratorFunction");
|
|
586
|
+
}, c.mark = function(r) {
|
|
587
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(r, j) : (r.__proto__ = j, v(r, e, "GeneratorFunction")), r.prototype = Object.create(U), r;
|
|
588
|
+
}, c.awrap = function(r) {
|
|
589
|
+
return {
|
|
590
|
+
__await: r
|
|
591
|
+
};
|
|
592
|
+
}, Q(S.prototype), v(S.prototype, p, function() {
|
|
593
|
+
return this;
|
|
594
|
+
}), c.AsyncIterator = S, c.async = function(r, s, f, d, h) {
|
|
595
|
+
h === void 0 && (h = Promise);
|
|
596
|
+
var b = new S(P(r, s, f, d), h);
|
|
597
|
+
return c.isGeneratorFunction(s) ? b : b.next().then(function(E) {
|
|
598
|
+
return E.done ? E.value : b.next();
|
|
599
|
+
});
|
|
600
|
+
}, Q(U), v(U, e, "Generator"), v(U, i, function() {
|
|
601
|
+
return this;
|
|
602
|
+
}), v(U, "toString", function() {
|
|
603
|
+
return "[object Generator]";
|
|
604
|
+
}), c.keys = function(r) {
|
|
605
|
+
var s = Object(r), f = [];
|
|
606
|
+
for (var d in s) f.push(d);
|
|
607
|
+
return f.reverse(), function h() {
|
|
608
|
+
for (; f.length; ) {
|
|
609
|
+
var b = f.pop();
|
|
610
|
+
if (b in s) return h.value = b, h.done = !1, h;
|
|
611
|
+
}
|
|
612
|
+
return h.done = !0, h;
|
|
613
|
+
};
|
|
614
|
+
}, c.values = n, M.prototype = {
|
|
615
|
+
constructor: M,
|
|
616
|
+
reset: function(r) {
|
|
617
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = l, this.done = !1, this.delegate = null, this.method = "next", this.arg = l, this.tryEntries.forEach(V), !r) for (var s in this) s.charAt(0) === "t" && a.call(this, s) && !isNaN(+s.slice(1)) && (this[s] = l);
|
|
618
|
+
},
|
|
619
|
+
stop: function() {
|
|
620
|
+
this.done = !0;
|
|
621
|
+
var r = this.tryEntries[0].completion;
|
|
622
|
+
if (r.type === "throw") throw r.arg;
|
|
623
|
+
return this.rval;
|
|
624
|
+
},
|
|
625
|
+
dispatchException: function(r) {
|
|
626
|
+
if (this.done) throw r;
|
|
627
|
+
var s = this;
|
|
628
|
+
function f(m, B) {
|
|
629
|
+
return b.type = "throw", b.arg = r, s.next = m, B && (s.method = "next", s.arg = l), !!B;
|
|
630
|
+
}
|
|
631
|
+
for (var d = this.tryEntries.length - 1; d >= 0; --d) {
|
|
632
|
+
var h = this.tryEntries[d], b = h.completion;
|
|
633
|
+
if (h.tryLoc === "root") return f("end");
|
|
634
|
+
if (h.tryLoc <= this.prev) {
|
|
635
|
+
var E = a.call(h, "catchLoc"), T = a.call(h, "finallyLoc");
|
|
636
|
+
if (E && T) {
|
|
637
|
+
if (this.prev < h.catchLoc) return f(h.catchLoc, !0);
|
|
638
|
+
if (this.prev < h.finallyLoc) return f(h.finallyLoc);
|
|
639
|
+
} else if (E) {
|
|
640
|
+
if (this.prev < h.catchLoc) return f(h.catchLoc, !0);
|
|
641
|
+
} else {
|
|
642
|
+
if (!T) throw Error("try statement without catch or finally");
|
|
643
|
+
if (this.prev < h.finallyLoc) return f(h.finallyLoc);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
abrupt: function(r, s) {
|
|
649
|
+
for (var f = this.tryEntries.length - 1; f >= 0; --f) {
|
|
650
|
+
var d = this.tryEntries[f];
|
|
651
|
+
if (d.tryLoc <= this.prev && a.call(d, "finallyLoc") && this.prev < d.finallyLoc) {
|
|
652
|
+
var h = d;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
h && (r === "break" || r === "continue") && h.tryLoc <= s && s <= h.finallyLoc && (h = null);
|
|
657
|
+
var b = h ? h.completion : {};
|
|
658
|
+
return b.type = r, b.arg = s, h ? (this.method = "next", this.next = h.finallyLoc, k) : this.complete(b);
|
|
659
|
+
},
|
|
660
|
+
complete: function(r, s) {
|
|
661
|
+
if (r.type === "throw") throw r.arg;
|
|
662
|
+
return r.type === "break" || r.type === "continue" ? this.next = r.arg : r.type === "return" ? (this.rval = this.arg = r.arg, this.method = "return", this.next = "end") : r.type === "normal" && s && (this.next = s), k;
|
|
663
|
+
},
|
|
664
|
+
finish: function(r) {
|
|
665
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
666
|
+
var f = this.tryEntries[s];
|
|
667
|
+
if (f.finallyLoc === r) return this.complete(f.completion, f.afterLoc), V(f), k;
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
catch: function(r) {
|
|
671
|
+
for (var s = this.tryEntries.length - 1; s >= 0; --s) {
|
|
672
|
+
var f = this.tryEntries[s];
|
|
673
|
+
if (f.tryLoc === r) {
|
|
674
|
+
var d = f.completion;
|
|
675
|
+
if (d.type === "throw") {
|
|
676
|
+
var h = d.arg;
|
|
677
|
+
V(f);
|
|
678
|
+
}
|
|
679
|
+
return h;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
throw Error("illegal catch attempt");
|
|
683
|
+
},
|
|
684
|
+
delegateYield: function(r, s, f) {
|
|
685
|
+
return this.delegate = {
|
|
686
|
+
iterator: n(r),
|
|
687
|
+
resultName: s,
|
|
688
|
+
nextLoc: f
|
|
689
|
+
}, this.method === "next" && (this.arg = l), k;
|
|
690
|
+
}
|
|
691
|
+
}, c;
|
|
692
|
+
}
|
|
693
|
+
function K(l, c) {
|
|
694
|
+
return K = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, a) {
|
|
695
|
+
return t.__proto__ = a, t;
|
|
696
|
+
}, K(l, c);
|
|
697
|
+
}
|
|
698
|
+
function R(l) {
|
|
699
|
+
var c = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
700
|
+
return R = function(t) {
|
|
701
|
+
if (t === null || !ce(t)) return t;
|
|
702
|
+
if (typeof t != "function") throw new TypeError("Super expression must either be null or a function");
|
|
703
|
+
if (c !== void 0) {
|
|
704
|
+
if (c.has(t)) return c.get(t);
|
|
705
|
+
c.set(t, a);
|
|
706
|
+
}
|
|
707
|
+
function a() {
|
|
708
|
+
return oe(t, arguments, ee(this).constructor);
|
|
709
|
+
}
|
|
710
|
+
return a.prototype = Object.create(t.prototype, {
|
|
711
|
+
constructor: {
|
|
712
|
+
value: a,
|
|
713
|
+
enumerable: !1,
|
|
714
|
+
writable: !0,
|
|
715
|
+
configurable: !0
|
|
716
|
+
}
|
|
717
|
+
}), K(a, t);
|
|
718
|
+
}, R(l);
|
|
719
|
+
}
|
|
720
|
+
var le = /* @__PURE__ */ function(l) {
|
|
721
|
+
function c(t) {
|
|
722
|
+
var a;
|
|
723
|
+
return t === void 0 && (t = "Too few subscribers"), a = l.call(this, t) || this, a.name = "TooFewSubscribersError", a;
|
|
724
|
+
}
|
|
725
|
+
return D(c, l), c;
|
|
726
|
+
}(/* @__PURE__ */ R(Error)), fe = /* @__PURE__ */ function(l) {
|
|
727
|
+
function c(t) {
|
|
728
|
+
var a;
|
|
729
|
+
return t === void 0 && (t = "Too many subscribers"), a = l.call(this, t) || this, a.name = "TooManySubscribersError", a;
|
|
730
|
+
}
|
|
731
|
+
return D(c, l), c;
|
|
732
|
+
}(/* @__PURE__ */ R(Error)), he = /* @__PURE__ */ function(l) {
|
|
733
|
+
function c(t) {
|
|
734
|
+
var a;
|
|
735
|
+
return t === void 0 && (t = "Too few events"), a = l.call(this, t) || this, a.name = "TooFewEventsError", a;
|
|
736
|
+
}
|
|
737
|
+
return D(c, l), c;
|
|
738
|
+
}(/* @__PURE__ */ R(Error)), pe = /* @__PURE__ */ function(l) {
|
|
739
|
+
function c(t) {
|
|
740
|
+
var a;
|
|
741
|
+
return t === void 0 && (t = "Too many events"), a = l.call(this, t) || this, a.name = "TooManyEventsError", a;
|
|
742
|
+
}
|
|
743
|
+
return D(c, l), c;
|
|
744
|
+
}(/* @__PURE__ */ R(Error)), de = /* @__PURE__ */ function(l) {
|
|
745
|
+
function c(t) {
|
|
746
|
+
var a;
|
|
747
|
+
return t === void 0 && (t = "Too few emails"), a = l.call(this, t) || this, a.name = "TooFewEmailsError", a;
|
|
748
|
+
}
|
|
749
|
+
return D(c, l), c;
|
|
750
|
+
}(/* @__PURE__ */ R(Error)), ye = /* @__PURE__ */ function(l) {
|
|
751
|
+
function c(t) {
|
|
752
|
+
var a;
|
|
753
|
+
return t === void 0 && (t = "Too many emails"), a = l.call(this, t) || this, a.name = "TooManyEmailsError", a;
|
|
754
|
+
}
|
|
755
|
+
return D(c, l), c;
|
|
756
|
+
}(/* @__PURE__ */ R(Error)), ve = /* @__PURE__ */ function() {
|
|
757
|
+
function l(t) {
|
|
758
|
+
this._client = void 0, this._maxEmailBatchSize = 100, this._maxBatchSize = 1e3, this._url = "/batch", this._client = t;
|
|
759
|
+
}
|
|
760
|
+
var c = l.prototype;
|
|
761
|
+
return c.importSubscribers = /* @__PURE__ */ function() {
|
|
762
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
763
|
+
var i;
|
|
764
|
+
return y().wrap(function(e) {
|
|
765
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
766
|
+
case 0:
|
|
767
|
+
if (u.subscribers.length !== 0) {
|
|
768
|
+
e.next = 2;
|
|
769
|
+
break;
|
|
770
|
+
}
|
|
771
|
+
throw new le("You must send between 1 and 1,000 subscribers.");
|
|
772
|
+
case 2:
|
|
773
|
+
if (!(u.subscribers.length > this._maxBatchSize)) {
|
|
774
|
+
e.next = 4;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
throw new fe("You must send between 1 and 1,000 subscribers.");
|
|
778
|
+
case 4:
|
|
779
|
+
return e.next = 6, this._client.post(this._url + "/subscribers", {
|
|
780
|
+
subscribers: u.subscribers
|
|
781
|
+
});
|
|
782
|
+
case 6:
|
|
783
|
+
return i = e.sent, e.abrupt("return", i.results);
|
|
784
|
+
case 8:
|
|
785
|
+
case "end":
|
|
786
|
+
return e.stop();
|
|
787
|
+
}
|
|
788
|
+
}, o, this);
|
|
789
|
+
}));
|
|
790
|
+
function a(o) {
|
|
791
|
+
return t.apply(this, arguments);
|
|
792
|
+
}
|
|
793
|
+
return a;
|
|
794
|
+
}(), c.importEvents = /* @__PURE__ */ function() {
|
|
795
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
796
|
+
var i;
|
|
797
|
+
return y().wrap(function(e) {
|
|
798
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
799
|
+
case 0:
|
|
800
|
+
if (u.events.length !== 0) {
|
|
801
|
+
e.next = 2;
|
|
802
|
+
break;
|
|
803
|
+
}
|
|
804
|
+
throw new he("You must send between 1 and 1,000 events.");
|
|
805
|
+
case 2:
|
|
806
|
+
if (!(u.events.length > this._maxBatchSize)) {
|
|
807
|
+
e.next = 4;
|
|
808
|
+
break;
|
|
809
|
+
}
|
|
810
|
+
throw new pe("You must send between 1 and 1,000 events.");
|
|
811
|
+
case 4:
|
|
812
|
+
return e.next = 6, this._client.post(this._url + "/events", {
|
|
813
|
+
events: u.events
|
|
814
|
+
});
|
|
815
|
+
case 6:
|
|
816
|
+
return i = e.sent, e.abrupt("return", i.results);
|
|
817
|
+
case 8:
|
|
818
|
+
case "end":
|
|
819
|
+
return e.stop();
|
|
820
|
+
}
|
|
821
|
+
}, o, this);
|
|
822
|
+
}));
|
|
823
|
+
function a(o) {
|
|
824
|
+
return t.apply(this, arguments);
|
|
825
|
+
}
|
|
826
|
+
return a;
|
|
827
|
+
}(), c.sendTransactionalEmails = /* @__PURE__ */ function() {
|
|
828
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
829
|
+
var i;
|
|
830
|
+
return y().wrap(function(e) {
|
|
831
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
832
|
+
case 0:
|
|
833
|
+
if (u.emails.length !== 0) {
|
|
834
|
+
e.next = 2;
|
|
835
|
+
break;
|
|
836
|
+
}
|
|
837
|
+
throw new de("You must send between 1 and 100 emails.");
|
|
838
|
+
case 2:
|
|
839
|
+
if (!(u.emails.length > this._maxEmailBatchSize)) {
|
|
840
|
+
e.next = 4;
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
843
|
+
throw new ye("You must send between 1 and 100 emails.");
|
|
844
|
+
case 4:
|
|
845
|
+
return e.next = 6, this._client.post(this._url + "/emails", {
|
|
846
|
+
emails: u.emails
|
|
847
|
+
});
|
|
848
|
+
case 6:
|
|
849
|
+
return i = e.sent, e.abrupt("return", i.results);
|
|
850
|
+
case 8:
|
|
851
|
+
case "end":
|
|
852
|
+
return e.stop();
|
|
853
|
+
}
|
|
854
|
+
}, o, this);
|
|
855
|
+
}));
|
|
856
|
+
function a(o) {
|
|
857
|
+
return t.apply(this, arguments);
|
|
858
|
+
}
|
|
859
|
+
return a;
|
|
860
|
+
}(), l;
|
|
861
|
+
}(), be = /* @__PURE__ */ function(l) {
|
|
862
|
+
function c(t) {
|
|
863
|
+
var a;
|
|
864
|
+
return t === void 0 && (t = "Not authorized"), a = l.call(this, t) || this, a.name = "NotAuthorizedError", a;
|
|
865
|
+
}
|
|
866
|
+
return D(c, l), c;
|
|
867
|
+
}(/* @__PURE__ */ R(Error)), me = /* @__PURE__ */ function(l) {
|
|
868
|
+
function c(t) {
|
|
869
|
+
var a;
|
|
870
|
+
return t === void 0 && (t = "You are being rate limited"), a = l.call(this, t) || this, a.name = "RateLimitedError", a;
|
|
871
|
+
}
|
|
872
|
+
return D(c, l), c;
|
|
873
|
+
}(/* @__PURE__ */ R(Error)), we = /* @__PURE__ */ function() {
|
|
874
|
+
function l(t) {
|
|
875
|
+
var a;
|
|
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;
|
|
877
|
+
}
|
|
878
|
+
var c = l.prototype;
|
|
879
|
+
return c.get = function(a, o) {
|
|
880
|
+
var u = this;
|
|
881
|
+
return o === void 0 && (o = {}), new Promise(function(i, p) {
|
|
882
|
+
var e = u._getQueryParameters(o);
|
|
883
|
+
te("" + u._baseUrl + a + "?" + e, {
|
|
884
|
+
method: "GET",
|
|
885
|
+
headers: u._headers
|
|
886
|
+
}).then(/* @__PURE__ */ function() {
|
|
887
|
+
var v = w(/* @__PURE__ */ y().mark(function P(O) {
|
|
888
|
+
return y().wrap(function(_) {
|
|
889
|
+
for (; ; ) switch (_.prev = _.next) {
|
|
890
|
+
case 0:
|
|
891
|
+
if (!u._isSuccessfulStatus(O.status)) {
|
|
892
|
+
_.next = 2;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
return _.abrupt("return", O.json());
|
|
896
|
+
case 2:
|
|
897
|
+
return _.next = 4, u._getErrorForResponse(O);
|
|
898
|
+
case 4:
|
|
899
|
+
throw _.sent;
|
|
900
|
+
case 5:
|
|
901
|
+
case "end":
|
|
902
|
+
return _.stop();
|
|
903
|
+
}
|
|
904
|
+
}, P);
|
|
905
|
+
}));
|
|
906
|
+
return function(P) {
|
|
907
|
+
return v.apply(this, arguments);
|
|
908
|
+
};
|
|
909
|
+
}()).then(function(v) {
|
|
910
|
+
return i(v);
|
|
911
|
+
}).catch(function(v) {
|
|
912
|
+
return p(v);
|
|
913
|
+
});
|
|
914
|
+
});
|
|
915
|
+
}, c.post = function(a, o) {
|
|
916
|
+
var u = this;
|
|
917
|
+
return o === void 0 && (o = {}), new Promise(function(i, p) {
|
|
918
|
+
var e = u._getBody(o);
|
|
919
|
+
te("" + u._baseUrl + a, {
|
|
920
|
+
method: "POST",
|
|
921
|
+
headers: J({}, u._headers, {
|
|
922
|
+
"Content-Type": "application/json"
|
|
923
|
+
}),
|
|
924
|
+
body: e
|
|
925
|
+
}).then(/* @__PURE__ */ function() {
|
|
926
|
+
var v = w(/* @__PURE__ */ y().mark(function P(O) {
|
|
927
|
+
return y().wrap(function(_) {
|
|
928
|
+
for (; ; ) switch (_.prev = _.next) {
|
|
929
|
+
case 0:
|
|
930
|
+
if (!u._isSuccessfulStatus(O.status)) {
|
|
931
|
+
_.next = 2;
|
|
932
|
+
break;
|
|
933
|
+
}
|
|
934
|
+
return _.abrupt("return", O.json());
|
|
935
|
+
case 2:
|
|
936
|
+
return _.next = 4, u._getErrorForResponse(O);
|
|
937
|
+
case 4:
|
|
938
|
+
throw _.sent;
|
|
939
|
+
case 5:
|
|
940
|
+
case "end":
|
|
941
|
+
return _.stop();
|
|
942
|
+
}
|
|
943
|
+
}, P);
|
|
944
|
+
}));
|
|
945
|
+
return function(P) {
|
|
946
|
+
return v.apply(this, arguments);
|
|
947
|
+
};
|
|
948
|
+
}()).then(function(v) {
|
|
949
|
+
return i(v);
|
|
950
|
+
}).catch(function(v) {
|
|
951
|
+
return p(v);
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
}, c._extractHeaders = function(a) {
|
|
955
|
+
var o = Buffer.from(a.publishableKey + ":" + a.secretKey).toString("base64");
|
|
956
|
+
return {
|
|
957
|
+
Authorization: "Basic " + o
|
|
958
|
+
};
|
|
959
|
+
}, c._getBody = function(a) {
|
|
960
|
+
return JSON.stringify(J({}, a, {
|
|
961
|
+
site_uuid: this._siteUuid
|
|
962
|
+
}));
|
|
963
|
+
}, c._getQueryParameters = function(a) {
|
|
964
|
+
for (var o = J({}, a, {
|
|
965
|
+
site_uuid: this._siteUuid
|
|
966
|
+
}), u = new URLSearchParams(), i = 0, p = Object.entries(o); i < p.length; i++) {
|
|
967
|
+
var e = p[i], v = e[0], P = e[1];
|
|
968
|
+
u.append(v, P);
|
|
969
|
+
}
|
|
970
|
+
return u.toString();
|
|
971
|
+
}, c._isSuccessfulStatus = function(a) {
|
|
972
|
+
var o = [200, 201];
|
|
973
|
+
return o.includes(a);
|
|
974
|
+
}, c._getErrorForResponse = /* @__PURE__ */ function() {
|
|
975
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
976
|
+
var i, p;
|
|
977
|
+
return y().wrap(function(v) {
|
|
978
|
+
for (; ; ) switch (v.prev = v.next) {
|
|
979
|
+
case 0:
|
|
980
|
+
if (this._logErrors && console.error(u), u.status !== 401) {
|
|
981
|
+
v.next = 3;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
return v.abrupt("return", new be());
|
|
985
|
+
case 3:
|
|
986
|
+
if (u.status !== 429) {
|
|
987
|
+
v.next = 5;
|
|
988
|
+
break;
|
|
989
|
+
}
|
|
990
|
+
return v.abrupt("return", new me());
|
|
991
|
+
case 5:
|
|
992
|
+
i = u.headers.get("Content-Type"), p = "", v.t0 = i == null ? void 0 : i.toLocaleLowerCase(), v.next = v.t0 === "text/plain" ? 10 : v.t0 === "application/json" ? 14 : 20;
|
|
993
|
+
break;
|
|
994
|
+
case 10:
|
|
995
|
+
return v.next = 12, u.text();
|
|
996
|
+
case 12:
|
|
997
|
+
return p = v.sent, v.abrupt("break", 22);
|
|
998
|
+
case 14:
|
|
999
|
+
return v.t1 = JSON, v.next = 17, u.json();
|
|
1000
|
+
case 17:
|
|
1001
|
+
return v.t2 = v.sent, p = v.t1.stringify.call(v.t1, v.t2), v.abrupt("break", 22);
|
|
1002
|
+
case 20:
|
|
1003
|
+
return p = "Unknown response from the Bento API.", v.abrupt("break", 22);
|
|
1004
|
+
case 22:
|
|
1005
|
+
return v.abrupt("return", new Error("[" + u.status + "] - " + p));
|
|
1006
|
+
case 23:
|
|
1007
|
+
case "end":
|
|
1008
|
+
return v.stop();
|
|
1009
|
+
}
|
|
1010
|
+
}, o, this);
|
|
1011
|
+
}));
|
|
1012
|
+
function a(o) {
|
|
1013
|
+
return t.apply(this, arguments);
|
|
1014
|
+
}
|
|
1015
|
+
return a;
|
|
1016
|
+
}(), l;
|
|
1017
|
+
}(), L;
|
|
1018
|
+
(function(l) {
|
|
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
|
+
})(L || (L = {}));
|
|
1021
|
+
var ge = /* @__PURE__ */ function() {
|
|
1022
|
+
function l(t) {
|
|
1023
|
+
this._client = void 0, this._url = "/fetch/commands", this._client = t;
|
|
1024
|
+
}
|
|
1025
|
+
var c = l.prototype;
|
|
1026
|
+
return c.addTag = /* @__PURE__ */ function() {
|
|
1027
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1028
|
+
var i;
|
|
1029
|
+
return y().wrap(function(e) {
|
|
1030
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1031
|
+
case 0:
|
|
1032
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1033
|
+
command: {
|
|
1034
|
+
command: L.ADD_TAG,
|
|
1035
|
+
email: u.email,
|
|
1036
|
+
query: u.tagName
|
|
1037
|
+
}
|
|
1038
|
+
});
|
|
1039
|
+
case 2:
|
|
1040
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1041
|
+
e.next = 5;
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
return e.abrupt("return", null);
|
|
1045
|
+
case 5:
|
|
1046
|
+
return e.abrupt("return", i.data);
|
|
1047
|
+
case 6:
|
|
1048
|
+
case "end":
|
|
1049
|
+
return e.stop();
|
|
1050
|
+
}
|
|
1051
|
+
}, o, this);
|
|
1052
|
+
}));
|
|
1053
|
+
function a(o) {
|
|
1054
|
+
return t.apply(this, arguments);
|
|
1055
|
+
}
|
|
1056
|
+
return a;
|
|
1057
|
+
}(), c.removeTag = /* @__PURE__ */ function() {
|
|
1058
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1059
|
+
var i;
|
|
1060
|
+
return y().wrap(function(e) {
|
|
1061
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1062
|
+
case 0:
|
|
1063
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1064
|
+
command: {
|
|
1065
|
+
command: L.REMOVE_TAG,
|
|
1066
|
+
email: u.email,
|
|
1067
|
+
query: u.tagName
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
case 2:
|
|
1071
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1072
|
+
e.next = 5;
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
return e.abrupt("return", null);
|
|
1076
|
+
case 5:
|
|
1077
|
+
return e.abrupt("return", i.data);
|
|
1078
|
+
case 6:
|
|
1079
|
+
case "end":
|
|
1080
|
+
return e.stop();
|
|
1081
|
+
}
|
|
1082
|
+
}, o, this);
|
|
1083
|
+
}));
|
|
1084
|
+
function a(o) {
|
|
1085
|
+
return t.apply(this, arguments);
|
|
1086
|
+
}
|
|
1087
|
+
return a;
|
|
1088
|
+
}(), c.addField = /* @__PURE__ */ function() {
|
|
1089
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1090
|
+
var i;
|
|
1091
|
+
return y().wrap(function(e) {
|
|
1092
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1093
|
+
case 0:
|
|
1094
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1095
|
+
command: {
|
|
1096
|
+
command: L.ADD_FIELD,
|
|
1097
|
+
email: u.email,
|
|
1098
|
+
query: u.field
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
case 2:
|
|
1102
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1103
|
+
e.next = 5;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
return e.abrupt("return", null);
|
|
1107
|
+
case 5:
|
|
1108
|
+
return e.abrupt("return", i.data);
|
|
1109
|
+
case 6:
|
|
1110
|
+
case "end":
|
|
1111
|
+
return e.stop();
|
|
1112
|
+
}
|
|
1113
|
+
}, o, this);
|
|
1114
|
+
}));
|
|
1115
|
+
function a(o) {
|
|
1116
|
+
return t.apply(this, arguments);
|
|
1117
|
+
}
|
|
1118
|
+
return a;
|
|
1119
|
+
}(), c.removeField = /* @__PURE__ */ function() {
|
|
1120
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1121
|
+
var i;
|
|
1122
|
+
return y().wrap(function(e) {
|
|
1123
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1124
|
+
case 0:
|
|
1125
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1126
|
+
command: {
|
|
1127
|
+
command: L.REMOVE_FIELD,
|
|
1128
|
+
email: u.email,
|
|
1129
|
+
query: u.fieldName
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
case 2:
|
|
1133
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1134
|
+
e.next = 5;
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
return e.abrupt("return", null);
|
|
1138
|
+
case 5:
|
|
1139
|
+
return e.abrupt("return", i.data);
|
|
1140
|
+
case 6:
|
|
1141
|
+
case "end":
|
|
1142
|
+
return e.stop();
|
|
1143
|
+
}
|
|
1144
|
+
}, o, this);
|
|
1145
|
+
}));
|
|
1146
|
+
function a(o) {
|
|
1147
|
+
return t.apply(this, arguments);
|
|
1148
|
+
}
|
|
1149
|
+
return a;
|
|
1150
|
+
}(), c.subscribe = /* @__PURE__ */ function() {
|
|
1151
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1152
|
+
var i;
|
|
1153
|
+
return y().wrap(function(e) {
|
|
1154
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1155
|
+
case 0:
|
|
1156
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1157
|
+
command: {
|
|
1158
|
+
command: L.SUBSCRIBE,
|
|
1159
|
+
email: u.email
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1162
|
+
case 2:
|
|
1163
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1164
|
+
e.next = 5;
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
return e.abrupt("return", null);
|
|
1168
|
+
case 5:
|
|
1169
|
+
return e.abrupt("return", i.data);
|
|
1170
|
+
case 6:
|
|
1171
|
+
case "end":
|
|
1172
|
+
return e.stop();
|
|
1173
|
+
}
|
|
1174
|
+
}, o, this);
|
|
1175
|
+
}));
|
|
1176
|
+
function a(o) {
|
|
1177
|
+
return t.apply(this, arguments);
|
|
1178
|
+
}
|
|
1179
|
+
return a;
|
|
1180
|
+
}(), c.unsubscribe = /* @__PURE__ */ function() {
|
|
1181
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1182
|
+
var i;
|
|
1183
|
+
return y().wrap(function(e) {
|
|
1184
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1185
|
+
case 0:
|
|
1186
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1187
|
+
command: {
|
|
1188
|
+
command: L.UNSUBSCRIBE,
|
|
1189
|
+
email: u.email
|
|
1190
|
+
}
|
|
1191
|
+
});
|
|
1192
|
+
case 2:
|
|
1193
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1194
|
+
e.next = 5;
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
return e.abrupt("return", null);
|
|
1198
|
+
case 5:
|
|
1199
|
+
return e.abrupt("return", i.data);
|
|
1200
|
+
case 6:
|
|
1201
|
+
case "end":
|
|
1202
|
+
return e.stop();
|
|
1203
|
+
}
|
|
1204
|
+
}, o, this);
|
|
1205
|
+
}));
|
|
1206
|
+
function a(o) {
|
|
1207
|
+
return t.apply(this, arguments);
|
|
1208
|
+
}
|
|
1209
|
+
return a;
|
|
1210
|
+
}(), c.changeEmail = /* @__PURE__ */ function() {
|
|
1211
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1212
|
+
var i;
|
|
1213
|
+
return y().wrap(function(e) {
|
|
1214
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1215
|
+
case 0:
|
|
1216
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1217
|
+
command: {
|
|
1218
|
+
command: L.CHANGE_EMAIL,
|
|
1219
|
+
email: u.oldEmail,
|
|
1220
|
+
query: u.newEmail
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
case 2:
|
|
1224
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1225
|
+
e.next = 5;
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
return e.abrupt("return", null);
|
|
1229
|
+
case 5:
|
|
1230
|
+
return e.abrupt("return", i.data);
|
|
1231
|
+
case 6:
|
|
1232
|
+
case "end":
|
|
1233
|
+
return e.stop();
|
|
1234
|
+
}
|
|
1235
|
+
}, o, this);
|
|
1236
|
+
}));
|
|
1237
|
+
function a(o) {
|
|
1238
|
+
return t.apply(this, arguments);
|
|
1239
|
+
}
|
|
1240
|
+
return a;
|
|
1241
|
+
}(), l;
|
|
1242
|
+
}(), Ee = /* @__PURE__ */ function() {
|
|
1243
|
+
function l(t) {
|
|
1244
|
+
this._client = void 0, this._url = "/experimental", this._client = t;
|
|
1245
|
+
}
|
|
1246
|
+
var c = l.prototype;
|
|
1247
|
+
return c.validateEmail = /* @__PURE__ */ function() {
|
|
1248
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1249
|
+
var i;
|
|
1250
|
+
return y().wrap(function(e) {
|
|
1251
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1252
|
+
case 0:
|
|
1253
|
+
return e.next = 2, this._client.post(this._url + "/validation", {
|
|
1254
|
+
email: u.email,
|
|
1255
|
+
ip: u.ip,
|
|
1256
|
+
name: u.name,
|
|
1257
|
+
user_agent: u.userAgent
|
|
1258
|
+
});
|
|
1259
|
+
case 2:
|
|
1260
|
+
return i = e.sent, e.abrupt("return", i.valid);
|
|
1261
|
+
case 4:
|
|
1262
|
+
case "end":
|
|
1263
|
+
return e.stop();
|
|
1264
|
+
}
|
|
1265
|
+
}, o, this);
|
|
1266
|
+
}));
|
|
1267
|
+
function a(o) {
|
|
1268
|
+
return t.apply(this, arguments);
|
|
1269
|
+
}
|
|
1270
|
+
return a;
|
|
1271
|
+
}(), c.guessGender = /* @__PURE__ */ function() {
|
|
1272
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1273
|
+
var i;
|
|
1274
|
+
return y().wrap(function(e) {
|
|
1275
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1276
|
+
case 0:
|
|
1277
|
+
return e.next = 2, this._client.post(this._url + "/gender", u);
|
|
1278
|
+
case 2:
|
|
1279
|
+
return i = e.sent, e.abrupt("return", i);
|
|
1280
|
+
case 4:
|
|
1281
|
+
case "end":
|
|
1282
|
+
return e.stop();
|
|
1283
|
+
}
|
|
1284
|
+
}, o, this);
|
|
1285
|
+
}));
|
|
1286
|
+
function a(o) {
|
|
1287
|
+
return t.apply(this, arguments);
|
|
1288
|
+
}
|
|
1289
|
+
return a;
|
|
1290
|
+
}(), c.geolocate = /* @__PURE__ */ function() {
|
|
1291
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1292
|
+
var i;
|
|
1293
|
+
return y().wrap(function(e) {
|
|
1294
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1295
|
+
case 0:
|
|
1296
|
+
return e.next = 2, this._client.get(this._url + "/geolocation", u);
|
|
1297
|
+
case 2:
|
|
1298
|
+
if (i = e.sent, Object.keys(i).length !== 0) {
|
|
1299
|
+
e.next = 5;
|
|
1300
|
+
break;
|
|
1301
|
+
}
|
|
1302
|
+
return e.abrupt("return", null);
|
|
1303
|
+
case 5:
|
|
1304
|
+
return e.abrupt("return", i);
|
|
1305
|
+
case 6:
|
|
1306
|
+
case "end":
|
|
1307
|
+
return e.stop();
|
|
1308
|
+
}
|
|
1309
|
+
}, o, this);
|
|
1310
|
+
}));
|
|
1311
|
+
function a(o) {
|
|
1312
|
+
return t.apply(this, arguments);
|
|
1313
|
+
}
|
|
1314
|
+
return a;
|
|
1315
|
+
}(), c.checkBlacklist = /* @__PURE__ */ function() {
|
|
1316
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1317
|
+
var i;
|
|
1318
|
+
return y().wrap(function(e) {
|
|
1319
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1320
|
+
case 0:
|
|
1321
|
+
return e.next = 2, this._client.get(this._url + "/blacklist.json", u);
|
|
1322
|
+
case 2:
|
|
1323
|
+
return i = e.sent, e.abrupt("return", i);
|
|
1324
|
+
case 4:
|
|
1325
|
+
case "end":
|
|
1326
|
+
return e.stop();
|
|
1327
|
+
}
|
|
1328
|
+
}, o, this);
|
|
1329
|
+
}));
|
|
1330
|
+
function a(o) {
|
|
1331
|
+
return t.apply(this, arguments);
|
|
1332
|
+
}
|
|
1333
|
+
return a;
|
|
1334
|
+
}(), l;
|
|
1335
|
+
}(), _e = /* @__PURE__ */ function() {
|
|
1336
|
+
function l(t) {
|
|
1337
|
+
this._client = void 0, this._url = "/fetch/fields", this._client = t;
|
|
1338
|
+
}
|
|
1339
|
+
var c = l.prototype;
|
|
1340
|
+
return c.getFields = /* @__PURE__ */ function() {
|
|
1341
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o() {
|
|
1342
|
+
var u;
|
|
1343
|
+
return y().wrap(function(p) {
|
|
1344
|
+
for (; ; ) switch (p.prev = p.next) {
|
|
1345
|
+
case 0:
|
|
1346
|
+
return p.next = 2, this._client.get(this._url);
|
|
1347
|
+
case 2:
|
|
1348
|
+
if (u = p.sent, !(Object.keys(u).length === 0 || !u.data)) {
|
|
1349
|
+
p.next = 5;
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
return p.abrupt("return", null);
|
|
1353
|
+
case 5:
|
|
1354
|
+
return p.abrupt("return", u.data);
|
|
1355
|
+
case 6:
|
|
1356
|
+
case "end":
|
|
1357
|
+
return p.stop();
|
|
1358
|
+
}
|
|
1359
|
+
}, o, this);
|
|
1360
|
+
}));
|
|
1361
|
+
function a() {
|
|
1362
|
+
return t.apply(this, arguments);
|
|
1363
|
+
}
|
|
1364
|
+
return a;
|
|
1365
|
+
}(), c.createField = /* @__PURE__ */ function() {
|
|
1366
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1367
|
+
var i;
|
|
1368
|
+
return y().wrap(function(e) {
|
|
1369
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1370
|
+
case 0:
|
|
1371
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1372
|
+
field: u
|
|
1373
|
+
});
|
|
1374
|
+
case 2:
|
|
1375
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1376
|
+
e.next = 5;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
return e.abrupt("return", null);
|
|
1380
|
+
case 5:
|
|
1381
|
+
return e.abrupt("return", i.data);
|
|
1382
|
+
case 6:
|
|
1383
|
+
case "end":
|
|
1384
|
+
return e.stop();
|
|
1385
|
+
}
|
|
1386
|
+
}, o, this);
|
|
1387
|
+
}));
|
|
1388
|
+
function a(o) {
|
|
1389
|
+
return t.apply(this, arguments);
|
|
1390
|
+
}
|
|
1391
|
+
return a;
|
|
1392
|
+
}(), l;
|
|
1393
|
+
}(), Te = /* @__PURE__ */ function() {
|
|
1394
|
+
function l(t) {
|
|
1395
|
+
this._client = void 0, this._url = "/fetch/responses", this._client = t;
|
|
1396
|
+
}
|
|
1397
|
+
var c = l.prototype;
|
|
1398
|
+
return c.getResponses = /* @__PURE__ */ function() {
|
|
1399
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1400
|
+
var i;
|
|
1401
|
+
return y().wrap(function(e) {
|
|
1402
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1403
|
+
case 0:
|
|
1404
|
+
return e.next = 2, this._client.get(this._url, {
|
|
1405
|
+
id: u
|
|
1406
|
+
});
|
|
1407
|
+
case 2:
|
|
1408
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1409
|
+
e.next = 5;
|
|
1410
|
+
break;
|
|
1411
|
+
}
|
|
1412
|
+
return e.abrupt("return", null);
|
|
1413
|
+
case 5:
|
|
1414
|
+
return e.abrupt("return", i.data);
|
|
1415
|
+
case 6:
|
|
1416
|
+
case "end":
|
|
1417
|
+
return e.stop();
|
|
1418
|
+
}
|
|
1419
|
+
}, o, this);
|
|
1420
|
+
}));
|
|
1421
|
+
function a(o) {
|
|
1422
|
+
return t.apply(this, arguments);
|
|
1423
|
+
}
|
|
1424
|
+
return a;
|
|
1425
|
+
}(), l;
|
|
1426
|
+
}(), ke = /* @__PURE__ */ function() {
|
|
1427
|
+
function l(t) {
|
|
1428
|
+
this._client = void 0, this._url = "/fetch/subscribers", this._client = t;
|
|
1429
|
+
}
|
|
1430
|
+
var c = l.prototype;
|
|
1431
|
+
return c.getSubscribers = /* @__PURE__ */ function() {
|
|
1432
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1433
|
+
var i;
|
|
1434
|
+
return y().wrap(function(e) {
|
|
1435
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1436
|
+
case 0:
|
|
1437
|
+
return e.next = 2, this._client.get(this._url, u);
|
|
1438
|
+
case 2:
|
|
1439
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1440
|
+
e.next = 5;
|
|
1441
|
+
break;
|
|
1442
|
+
}
|
|
1443
|
+
return e.abrupt("return", null);
|
|
1444
|
+
case 5:
|
|
1445
|
+
return e.abrupt("return", i.data);
|
|
1446
|
+
case 6:
|
|
1447
|
+
case "end":
|
|
1448
|
+
return e.stop();
|
|
1449
|
+
}
|
|
1450
|
+
}, o, this);
|
|
1451
|
+
}));
|
|
1452
|
+
function a(o) {
|
|
1453
|
+
return t.apply(this, arguments);
|
|
1454
|
+
}
|
|
1455
|
+
return a;
|
|
1456
|
+
}(), c.createSubscriber = /* @__PURE__ */ function() {
|
|
1457
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1458
|
+
var i;
|
|
1459
|
+
return y().wrap(function(e) {
|
|
1460
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1461
|
+
case 0:
|
|
1462
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1463
|
+
subscriber: u
|
|
1464
|
+
});
|
|
1465
|
+
case 2:
|
|
1466
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1467
|
+
e.next = 5;
|
|
1468
|
+
break;
|
|
1469
|
+
}
|
|
1470
|
+
return e.abrupt("return", null);
|
|
1471
|
+
case 5:
|
|
1472
|
+
return e.abrupt("return", i.data);
|
|
1473
|
+
case 6:
|
|
1474
|
+
case "end":
|
|
1475
|
+
return e.stop();
|
|
1476
|
+
}
|
|
1477
|
+
}, o, this);
|
|
1478
|
+
}));
|
|
1479
|
+
function a(o) {
|
|
1480
|
+
return t.apply(this, arguments);
|
|
1481
|
+
}
|
|
1482
|
+
return a;
|
|
1483
|
+
}(), l;
|
|
1484
|
+
}(), Be = /* @__PURE__ */ function() {
|
|
1485
|
+
function l(t) {
|
|
1486
|
+
this._client = void 0, this._url = "/fetch/tags", this._client = t;
|
|
1487
|
+
}
|
|
1488
|
+
var c = l.prototype;
|
|
1489
|
+
return c.getTags = /* @__PURE__ */ function() {
|
|
1490
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o() {
|
|
1491
|
+
var u;
|
|
1492
|
+
return y().wrap(function(p) {
|
|
1493
|
+
for (; ; ) switch (p.prev = p.next) {
|
|
1494
|
+
case 0:
|
|
1495
|
+
return p.next = 2, this._client.get(this._url);
|
|
1496
|
+
case 2:
|
|
1497
|
+
if (u = p.sent, !(Object.keys(u).length === 0 || !u.data)) {
|
|
1498
|
+
p.next = 5;
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1501
|
+
return p.abrupt("return", null);
|
|
1502
|
+
case 5:
|
|
1503
|
+
return p.abrupt("return", u.data);
|
|
1504
|
+
case 6:
|
|
1505
|
+
case "end":
|
|
1506
|
+
return p.stop();
|
|
1507
|
+
}
|
|
1508
|
+
}, o, this);
|
|
1509
|
+
}));
|
|
1510
|
+
function a() {
|
|
1511
|
+
return t.apply(this, arguments);
|
|
1512
|
+
}
|
|
1513
|
+
return a;
|
|
1514
|
+
}(), c.createTag = /* @__PURE__ */ function() {
|
|
1515
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1516
|
+
var i;
|
|
1517
|
+
return y().wrap(function(e) {
|
|
1518
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1519
|
+
case 0:
|
|
1520
|
+
return e.next = 2, this._client.post(this._url, {
|
|
1521
|
+
tag: u
|
|
1522
|
+
});
|
|
1523
|
+
case 2:
|
|
1524
|
+
if (i = e.sent, !(Object.keys(i).length === 0 || !i.data)) {
|
|
1525
|
+
e.next = 5;
|
|
1526
|
+
break;
|
|
1527
|
+
}
|
|
1528
|
+
return e.abrupt("return", null);
|
|
1529
|
+
case 5:
|
|
1530
|
+
return e.abrupt("return", i.data);
|
|
1531
|
+
case 6:
|
|
1532
|
+
case "end":
|
|
1533
|
+
return e.stop();
|
|
1534
|
+
}
|
|
1535
|
+
}, o, this);
|
|
1536
|
+
}));
|
|
1537
|
+
function a(o) {
|
|
1538
|
+
return t.apply(this, arguments);
|
|
1539
|
+
}
|
|
1540
|
+
return a;
|
|
1541
|
+
}(), l;
|
|
1542
|
+
}(), N;
|
|
1543
|
+
(function(l) {
|
|
1544
|
+
l.PURCHASE = "$purchase", l.SUBSCRIBE = "$subscribe", l.TAG = "$tag", l.REMOVE_TAG = "$remove_tag", l.UNSUBSCRIBE = "$unsubscribe", l.UPDATE_FIELDS = "$update_fields";
|
|
1545
|
+
})(N || (N = {}));
|
|
1546
|
+
var Oe = /* @__PURE__ */ function() {
|
|
1547
|
+
function l(t) {
|
|
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
|
+
}
|
|
1550
|
+
var c = l.prototype;
|
|
1551
|
+
return c.tagSubscriber = /* @__PURE__ */ function() {
|
|
1552
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1553
|
+
var i;
|
|
1554
|
+
return y().wrap(function(e) {
|
|
1555
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1556
|
+
case 0:
|
|
1557
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1558
|
+
events: [{
|
|
1559
|
+
date: u.date,
|
|
1560
|
+
details: {
|
|
1561
|
+
tag: u.tagName
|
|
1562
|
+
},
|
|
1563
|
+
email: u.email,
|
|
1564
|
+
type: N.TAG
|
|
1565
|
+
}]
|
|
1566
|
+
});
|
|
1567
|
+
case 2:
|
|
1568
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1569
|
+
case 4:
|
|
1570
|
+
case "end":
|
|
1571
|
+
return e.stop();
|
|
1572
|
+
}
|
|
1573
|
+
}, o, this);
|
|
1574
|
+
}));
|
|
1575
|
+
function a(o) {
|
|
1576
|
+
return t.apply(this, arguments);
|
|
1577
|
+
}
|
|
1578
|
+
return a;
|
|
1579
|
+
}(), c.addSubscriber = /* @__PURE__ */ function() {
|
|
1580
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1581
|
+
var i;
|
|
1582
|
+
return y().wrap(function(e) {
|
|
1583
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1584
|
+
case 0:
|
|
1585
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1586
|
+
events: [{
|
|
1587
|
+
date: u.date,
|
|
1588
|
+
email: u.email,
|
|
1589
|
+
type: N.SUBSCRIBE,
|
|
1590
|
+
fields: u.fields || {}
|
|
1591
|
+
}]
|
|
1592
|
+
});
|
|
1593
|
+
case 2:
|
|
1594
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1595
|
+
case 4:
|
|
1596
|
+
case "end":
|
|
1597
|
+
return e.stop();
|
|
1598
|
+
}
|
|
1599
|
+
}, o, this);
|
|
1600
|
+
}));
|
|
1601
|
+
function a(o) {
|
|
1602
|
+
return t.apply(this, arguments);
|
|
1603
|
+
}
|
|
1604
|
+
return a;
|
|
1605
|
+
}(), c.removeSubscriber = /* @__PURE__ */ function() {
|
|
1606
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1607
|
+
var i;
|
|
1608
|
+
return y().wrap(function(e) {
|
|
1609
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1610
|
+
case 0:
|
|
1611
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1612
|
+
events: [{
|
|
1613
|
+
date: u.date,
|
|
1614
|
+
email: u.email,
|
|
1615
|
+
type: N.UNSUBSCRIBE
|
|
1616
|
+
}]
|
|
1617
|
+
});
|
|
1618
|
+
case 2:
|
|
1619
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1620
|
+
case 4:
|
|
1621
|
+
case "end":
|
|
1622
|
+
return e.stop();
|
|
1623
|
+
}
|
|
1624
|
+
}, o, this);
|
|
1625
|
+
}));
|
|
1626
|
+
function a(o) {
|
|
1627
|
+
return t.apply(this, arguments);
|
|
1628
|
+
}
|
|
1629
|
+
return a;
|
|
1630
|
+
}(), c.updateFields = /* @__PURE__ */ function() {
|
|
1631
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1632
|
+
var i;
|
|
1633
|
+
return y().wrap(function(e) {
|
|
1634
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1635
|
+
case 0:
|
|
1636
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1637
|
+
events: [{
|
|
1638
|
+
date: u.date,
|
|
1639
|
+
email: u.email,
|
|
1640
|
+
type: N.UPDATE_FIELDS,
|
|
1641
|
+
fields: u.fields
|
|
1642
|
+
}]
|
|
1643
|
+
});
|
|
1644
|
+
case 2:
|
|
1645
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1646
|
+
case 4:
|
|
1647
|
+
case "end":
|
|
1648
|
+
return e.stop();
|
|
1649
|
+
}
|
|
1650
|
+
}, o, this);
|
|
1651
|
+
}));
|
|
1652
|
+
function a(o) {
|
|
1653
|
+
return t.apply(this, arguments);
|
|
1654
|
+
}
|
|
1655
|
+
return a;
|
|
1656
|
+
}(), c.trackPurchase = /* @__PURE__ */ function() {
|
|
1657
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1658
|
+
var i;
|
|
1659
|
+
return y().wrap(function(e) {
|
|
1660
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1661
|
+
case 0:
|
|
1662
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1663
|
+
events: [{
|
|
1664
|
+
date: u.date,
|
|
1665
|
+
email: u.email,
|
|
1666
|
+
type: N.PURCHASE,
|
|
1667
|
+
details: u.purchaseDetails
|
|
1668
|
+
}]
|
|
1669
|
+
});
|
|
1670
|
+
case 2:
|
|
1671
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1672
|
+
case 4:
|
|
1673
|
+
case "end":
|
|
1674
|
+
return e.stop();
|
|
1675
|
+
}
|
|
1676
|
+
}, o, this);
|
|
1677
|
+
}));
|
|
1678
|
+
function a(o) {
|
|
1679
|
+
return t.apply(this, arguments);
|
|
1680
|
+
}
|
|
1681
|
+
return a;
|
|
1682
|
+
}(), c.track = /* @__PURE__ */ function() {
|
|
1683
|
+
var t = /* @__PURE__ */ w(/* @__PURE__ */ y().mark(function o(u) {
|
|
1684
|
+
var i;
|
|
1685
|
+
return y().wrap(function(e) {
|
|
1686
|
+
for (; ; ) switch (e.prev = e.next) {
|
|
1687
|
+
case 0:
|
|
1688
|
+
return e.next = 2, this.Batch.importEvents({
|
|
1689
|
+
events: [u]
|
|
1690
|
+
});
|
|
1691
|
+
case 2:
|
|
1692
|
+
return i = e.sent, e.abrupt("return", i === 1);
|
|
1693
|
+
case 4:
|
|
1694
|
+
case "end":
|
|
1695
|
+
return e.stop();
|
|
1696
|
+
}
|
|
1697
|
+
}, o, this);
|
|
1698
|
+
}));
|
|
1699
|
+
function a(o) {
|
|
1700
|
+
return t.apply(this, arguments);
|
|
1701
|
+
}
|
|
1702
|
+
return a;
|
|
1703
|
+
}(), l;
|
|
1704
|
+
}(), Ae = function(c) {
|
|
1705
|
+
this.V1 = void 0, this.V1 = new Oe(c);
|
|
1706
|
+
};
|
|
1707
|
+
export {
|
|
1708
|
+
Ae as Analytics,
|
|
1709
|
+
be as NotAuthorizedError,
|
|
1710
|
+
me as RateLimitedError
|
|
1711
|
+
};
|