@reservamos/browser-analytics 1.1.7-alpha.0 → 1.1.7
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/CHANGELOG.md +7 -1
- package/README.md +35 -0
- package/dist/browser-analytics.cjs +3 -3
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.d.ts +55 -55
- package/dist/browser-analytics.esm.js +1138 -844
- package/dist/browser-analytics.esm.js.map +1 -1
- package/dist/browser-analytics.iife.js +3 -3
- package/dist/browser-analytics.iife.js.map +1 -1
- package/package.json +3 -3
- package/src/events/identify/identify.robustness.test.ts +220 -0
- package/src/events/identify/identify.test.ts +6 -4
- package/src/events/identify/identify.ts +84 -42
- package/src/index.ts +2 -0
- package/src/profiles/createAnonymousProfile/createAnonymousProfile.identify.test.ts +56 -0
- package/src/profiles/createAnonymousProfile/createAnonymousProfile.ts +39 -12
- package/src/services/botDetectionRelay.test.ts +154 -0
- package/src/services/botDetectionRelay.ts +54 -0
- package/src/services/fingerprint.test.ts +250 -35
- package/src/services/fingerprint.ts +89 -12
- package/src/services/mixpanel.test.ts +160 -0
- package/src/services/mixpanel.ts +32 -6
- package/src/track.test.ts +156 -0
- package/src/track.ts +24 -5
- package/src/types/botDetection.ts +16 -0
- package/src/util/identifyAttempt.ts +139 -0
|
@@ -24,8 +24,8 @@ var util;
|
|
|
24
24
|
return util2.objectValues(filtered);
|
|
25
25
|
};
|
|
26
26
|
util2.objectValues = (obj) => {
|
|
27
|
-
return util2.objectKeys(obj).map(function(
|
|
28
|
-
return obj[
|
|
27
|
+
return util2.objectKeys(obj).map(function(e3) {
|
|
28
|
+
return obj[e3];
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
@@ -89,8 +89,8 @@ const ZodParsedType = util.arrayToEnum([
|
|
|
89
89
|
"set"
|
|
90
90
|
]);
|
|
91
91
|
const getParsedType = (data) => {
|
|
92
|
-
const
|
|
93
|
-
switch (
|
|
92
|
+
const t4 = typeof data;
|
|
93
|
+
switch (t4) {
|
|
94
94
|
case "undefined":
|
|
95
95
|
return ZodParsedType.undefined;
|
|
96
96
|
case "string":
|
|
@@ -463,8 +463,8 @@ function __classPrivateFieldSet(receiver, state, value, kind, f2) {
|
|
|
463
463
|
return state.set(receiver, value), value;
|
|
464
464
|
}
|
|
465
465
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
466
|
-
var
|
|
467
|
-
return
|
|
466
|
+
var e3 = new Error(message);
|
|
467
|
+
return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3;
|
|
468
468
|
};
|
|
469
469
|
var errorUtil;
|
|
470
470
|
(function(errorUtil2) {
|
|
@@ -3070,13 +3070,13 @@ class ZodFunction extends ZodType {
|
|
|
3070
3070
|
const me = this;
|
|
3071
3071
|
return OK(async function(...args) {
|
|
3072
3072
|
const error = new ZodError([]);
|
|
3073
|
-
const parsedArgs = await me._def.args.parseAsync(args, params).catch((
|
|
3074
|
-
error.addIssue(makeArgsIssue(args,
|
|
3073
|
+
const parsedArgs = await me._def.args.parseAsync(args, params).catch((e3) => {
|
|
3074
|
+
error.addIssue(makeArgsIssue(args, e3));
|
|
3075
3075
|
throw error;
|
|
3076
3076
|
});
|
|
3077
3077
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
3078
|
-
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((
|
|
3079
|
-
error.addIssue(makeReturnsIssue(result,
|
|
3078
|
+
const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e3) => {
|
|
3079
|
+
error.addIssue(makeReturnsIssue(result, e3));
|
|
3080
3080
|
throw error;
|
|
3081
3081
|
});
|
|
3082
3082
|
return parsedReturns;
|
|
@@ -3921,6 +3921,451 @@ const customEventSchema = z.record(
|
|
|
3921
3921
|
z.union([allowedPrimitiveSchema, z.array(allowedPrimitiveSchema)])
|
|
3922
3922
|
);
|
|
3923
3923
|
const eventNameSchema = z.string().min(1, "Event name is required");
|
|
3924
|
+
var e$3 = {
|
|
3925
|
+
sandbox: {
|
|
3926
|
+
search: "https://search.resertravel.com/api",
|
|
3927
|
+
purchase: "https://purchases.resertravel.com/api",
|
|
3928
|
+
core: "",
|
|
3929
|
+
config: ""
|
|
3930
|
+
},
|
|
3931
|
+
production: {
|
|
3932
|
+
search: "https://search.reservamos.mx/api",
|
|
3933
|
+
purchase: "https://compras.reservamos.mx/api",
|
|
3934
|
+
core: "",
|
|
3935
|
+
config: ""
|
|
3936
|
+
}
|
|
3937
|
+
}, t$7 = "sandbox", n$6 = {
|
|
3938
|
+
env: t$7,
|
|
3939
|
+
headers: {},
|
|
3940
|
+
searchUrl: e$3[t$7].search,
|
|
3941
|
+
purchaseUrl: e$3[t$7].purchase,
|
|
3942
|
+
coreUrl: e$3[t$7].core,
|
|
3943
|
+
configUrl: e$3[t$7].config,
|
|
3944
|
+
version: "v2",
|
|
3945
|
+
coreVersion: "v1",
|
|
3946
|
+
configVersion: "v1",
|
|
3947
|
+
apiKey: void 0,
|
|
3948
|
+
userAuthToken: void 0,
|
|
3949
|
+
withCredentials: false
|
|
3950
|
+
}, r$6 = Object.assign({}, n$6);
|
|
3951
|
+
var e$2 = { 1: {
|
|
3952
|
+
code: 200,
|
|
3953
|
+
message: "Operación no autorizada"
|
|
3954
|
+
} }, t$6 = {
|
|
3955
|
+
3: {
|
|
3956
|
+
code: 300,
|
|
3957
|
+
message: "Parámetros incorrectos"
|
|
3958
|
+
},
|
|
3959
|
+
7: {
|
|
3960
|
+
code: 301,
|
|
3961
|
+
message: "Fecha inválida"
|
|
3962
|
+
}
|
|
3963
|
+
}, n$5 = {
|
|
3964
|
+
10: {
|
|
3965
|
+
code: 400,
|
|
3966
|
+
message: "No existe el viaje"
|
|
3967
|
+
},
|
|
3968
|
+
20: {
|
|
3969
|
+
code: 60,
|
|
3970
|
+
message: "No se encontró el viaje"
|
|
3971
|
+
},
|
|
3972
|
+
21: {
|
|
3973
|
+
code: 60,
|
|
3974
|
+
message: "Tarifa no disponible"
|
|
3975
|
+
},
|
|
3976
|
+
22: {
|
|
3977
|
+
code: 60,
|
|
3978
|
+
message: "Tarifa no disponible"
|
|
3979
|
+
}
|
|
3980
|
+
}, r$5 = (e3) => ({
|
|
3981
|
+
11: {
|
|
3982
|
+
code: 500,
|
|
3983
|
+
message: e3
|
|
3984
|
+
},
|
|
3985
|
+
12: {
|
|
3986
|
+
code: 501,
|
|
3987
|
+
message: e3
|
|
3988
|
+
}
|
|
3989
|
+
}), i$6 = {
|
|
3990
|
+
23: {
|
|
3991
|
+
code: 60,
|
|
3992
|
+
message: "Estudiante no disponible"
|
|
3993
|
+
},
|
|
3994
|
+
24: {
|
|
3995
|
+
code: 60,
|
|
3996
|
+
message: "Profesor no disponible"
|
|
3997
|
+
},
|
|
3998
|
+
25: {
|
|
3999
|
+
code: 60,
|
|
4000
|
+
message: "Menor no disponible"
|
|
4001
|
+
},
|
|
4002
|
+
26: {
|
|
4003
|
+
code: 60,
|
|
4004
|
+
message: "Capacidades diferentes no disponible"
|
|
4005
|
+
},
|
|
4006
|
+
27: {
|
|
4007
|
+
code: 60,
|
|
4008
|
+
message: "INSEN no disponible"
|
|
4009
|
+
},
|
|
4010
|
+
28: {
|
|
4011
|
+
code: 60,
|
|
4012
|
+
message: "General no disponible"
|
|
4013
|
+
},
|
|
4014
|
+
29: {
|
|
4015
|
+
code: 60,
|
|
4016
|
+
message: "Error desconocido"
|
|
4017
|
+
}
|
|
4018
|
+
}, a$5 = (e3) => ({ 30: {
|
|
4019
|
+
code: 30,
|
|
4020
|
+
message: e3
|
|
4021
|
+
} }), o$4 = { 50: {
|
|
4022
|
+
code: 50,
|
|
4023
|
+
message: "Unknown Error"
|
|
4024
|
+
} }, s$3 = (s2) => ({
|
|
4025
|
+
...e$2,
|
|
4026
|
+
...t$6,
|
|
4027
|
+
...n$5,
|
|
4028
|
+
...r$5(s2),
|
|
4029
|
+
...i$6,
|
|
4030
|
+
...o$4,
|
|
4031
|
+
...a$5(s2)
|
|
4032
|
+
});
|
|
4033
|
+
var e$1 = class e extends Error {
|
|
4034
|
+
constructor(e3 = -100, t4 = "Unknown error", n2 = null, r2 = null) {
|
|
4035
|
+
super(t4), this.code = e3, this.details = n2, this.errors = r2, this.stack = (/* @__PURE__ */ Error()).stack;
|
|
4036
|
+
}
|
|
4037
|
+
};
|
|
4038
|
+
var r$4 = Symbol("parseFailure");
|
|
4039
|
+
async function i$5(e3) {
|
|
4040
|
+
let t4 = await e3.text();
|
|
4041
|
+
if (!t4 || !t4.trim()) return {};
|
|
4042
|
+
try {
|
|
4043
|
+
return JSON.parse(t4);
|
|
4044
|
+
} catch {
|
|
4045
|
+
return {
|
|
4046
|
+
[r$4]: true,
|
|
4047
|
+
message: t4.slice(0, 200),
|
|
4048
|
+
statusText: e3.statusText
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
async function a$4(e3, { skipErrorMapping: t4 = false } = {}) {
|
|
4053
|
+
let a2 = [
|
|
4054
|
+
404,
|
|
4055
|
+
422,
|
|
4056
|
+
500
|
|
4057
|
+
], o2 = await i$5(e3);
|
|
4058
|
+
if (o2[r$4]) throw new e$1(e3.status, o2.message || e3.statusText, o2);
|
|
4059
|
+
if (e3.ok) return o2;
|
|
4060
|
+
if (t4) throw new e$1(e3.status, o2.message || e3.statusText, o2);
|
|
4061
|
+
if (a2.includes(e3.status)) switch (e3.status) {
|
|
4062
|
+
case 404:
|
|
4063
|
+
throw new e$1(100, "Not found");
|
|
4064
|
+
case 422:
|
|
4065
|
+
return o2;
|
|
4066
|
+
case 500:
|
|
4067
|
+
throw new e$1(101, "Server error");
|
|
4068
|
+
default:
|
|
4069
|
+
throw new e$1();
|
|
4070
|
+
}
|
|
4071
|
+
else throw new e$1(e3.status, o2.message || e3.statusText, o2);
|
|
4072
|
+
}
|
|
4073
|
+
function o$3(e3) {
|
|
4074
|
+
if (e3.errors instanceof Array) {
|
|
4075
|
+
let { code: r2 = -100, message: i = "Unknown error" } = e3.errors[0] || {}, a2 = s$3(i)[r2];
|
|
4076
|
+
throw a2 ? new e$1(a2.code, a2.message, e3.errors[0], e3.errors) : new e$1(r2, i, e3.errors[0], e3.errors);
|
|
4077
|
+
} else return e3;
|
|
4078
|
+
}
|
|
4079
|
+
function s$2(...e3) {
|
|
4080
|
+
let t4 = Object.keys(Object.assign({}, ...e3)).reduce((t5, n2) => ({
|
|
4081
|
+
...t5,
|
|
4082
|
+
[n2]: e3.map((e4) => n2 in e4 && e4[n2]).filter(Boolean)
|
|
4083
|
+
}), {});
|
|
4084
|
+
return new Headers(t4);
|
|
4085
|
+
}
|
|
4086
|
+
function c$2(t4, n2 = {}, r2 = {}, i) {
|
|
4087
|
+
let { apiKey: c2, withCredentials: l2, userAuthToken: u2, headers: d2 } = r$6, f2 = {
|
|
4088
|
+
Accept: "application/json",
|
|
4089
|
+
Authorization: `Token token=${r2.apiKey || c2}`,
|
|
4090
|
+
"Content-Type": "application/json"
|
|
4091
|
+
};
|
|
4092
|
+
u2 && (f2.Authorization = `Token ${r2.apiKey || c2}, Bearer ${u2}`), n2.headers = s$2(d2, f2), n2.credentials = n2.credentials ?? (l2 ? "include" : "omit");
|
|
4093
|
+
let { skipErrorMapping: p2 } = n2;
|
|
4094
|
+
delete n2.skipErrorMapping, typeof n2.body != "string" && (n2.body = JSON.stringify(n2.body));
|
|
4095
|
+
let m2 = fetch(t4, n2).then((e3) => a$4(e3, { skipErrorMapping: p2 }));
|
|
4096
|
+
return (p2 ? m2 : m2.then(o$3)).catch(i);
|
|
4097
|
+
}
|
|
4098
|
+
function u$1(e3, t4 = {}, n2) {
|
|
4099
|
+
return c$2(e3, t4, {}, n2);
|
|
4100
|
+
}
|
|
4101
|
+
var t$5 = class t {
|
|
4102
|
+
constructor({ url: e3, watch: t4, expect: n2, maxRetries: r2 = 30, interval: i = 2e3, eachCall: a2 = null }) {
|
|
4103
|
+
this.url = e3, this.watch = t4, this.expect = n2 instanceof Array ? n2 : [n2], this.interval = i, this.maxRetries = r2, this.eachCall = a2 && a2.bind(this), this.aborted = false, this.timers = [], this.execute = this.execute.bind(this), this.executeEachCall = this.executeEachCall.bind(this);
|
|
4104
|
+
}
|
|
4105
|
+
start() {
|
|
4106
|
+
return console.log("Starting poll"), this.execute(this.maxRetries);
|
|
4107
|
+
}
|
|
4108
|
+
abort() {
|
|
4109
|
+
this.aborted = true;
|
|
4110
|
+
}
|
|
4111
|
+
execute(t4) {
|
|
4112
|
+
return u$1(this.url, {}, (e3) => this.executeEachCall("error", e3)).then((e3) => {
|
|
4113
|
+
if (this.expect.includes(e3[this.watch]) || t4 === 1 || this.aborted) {
|
|
4114
|
+
let n2 = e3[this.watch];
|
|
4115
|
+
t4 === 1 ? n2 = "retries_exceeded" : this.aborted && (n2 = "aborted"), this.timers.forEach(clearInterval), this.executeEachCall(n2, e3);
|
|
4116
|
+
} else if (e3[this.watch] === "failed") this.timers.forEach(clearInterval), this.executeEachCall("failed", e3);
|
|
4117
|
+
else {
|
|
4118
|
+
this.executeEachCall("pending", e3);
|
|
4119
|
+
let n2 = window.setTimeout(this.execute, this.interval, t4 - 1);
|
|
4120
|
+
this.timers.push(n2);
|
|
4121
|
+
}
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
executeEachCall(e3, t4) {
|
|
4125
|
+
this.eachCall instanceof Function && this.eachCall({
|
|
4126
|
+
status: e3,
|
|
4127
|
+
payload: t4
|
|
4128
|
+
}) && this.abort();
|
|
4129
|
+
}
|
|
4130
|
+
};
|
|
4131
|
+
var t$4 = class t2 extends Error {
|
|
4132
|
+
constructor(e3) {
|
|
4133
|
+
super(e3), this.name = "ApiConfigurationError";
|
|
4134
|
+
}
|
|
4135
|
+
};
|
|
4136
|
+
function n$4(e3, n2, r2, i) {
|
|
4137
|
+
try {
|
|
4138
|
+
let a2 = new URL(e3);
|
|
4139
|
+
if (!["http:", "https:"].includes(a2.protocol) || a2.username || a2.password || a2.search || a2.hash) throw new t$4("Invalid configured API URL.");
|
|
4140
|
+
let o2 = a2.pathname.replace(/\/+$/, ""), s2 = i.replace(/^\/+|\/+$/g, "");
|
|
4141
|
+
return o2.endsWith(`/${n2}`) ? a2.pathname = `${o2}/${r2}` : s2 && o2.endsWith(`/${s2}`) ? a2.pathname = `${o2}/${n2}/${r2}` : a2.pathname = `${o2}${s2 ? `/${s2}` : ""}/${n2}/${r2}`, a2.toString();
|
|
4142
|
+
} catch {
|
|
4143
|
+
throw new t$4("Invalid configured API URL.");
|
|
4144
|
+
}
|
|
4145
|
+
}
|
|
4146
|
+
function r$3({ apiName: r2, defaultApiVersion: i }) {
|
|
4147
|
+
let a2, o2 = { "Content-Type": "application/json" }, s2;
|
|
4148
|
+
function c2(e3) {
|
|
4149
|
+
a2 = e3.baseUrl, o2 = {
|
|
4150
|
+
...o2,
|
|
4151
|
+
...e3.defaultHeaders || {}
|
|
4152
|
+
};
|
|
4153
|
+
}
|
|
4154
|
+
function l2(e3) {
|
|
4155
|
+
s2 = e3;
|
|
4156
|
+
}
|
|
4157
|
+
function u2() {
|
|
4158
|
+
if (!a2) throw Error(`Base URL is not set for ${r2} API.`);
|
|
4159
|
+
}
|
|
4160
|
+
let d2 = { body: {} };
|
|
4161
|
+
async function f2(e3, c3 = d2) {
|
|
4162
|
+
var l3;
|
|
4163
|
+
let f3 = "responseType" in c3 ? c3 : void 0;
|
|
4164
|
+
if (f3 && !a2) throw new t$4(`Base URL is not set for ${r2} API.`);
|
|
4165
|
+
u2();
|
|
4166
|
+
let { body: p3, headers: m3 = {}, apiVersion: h3 = i } = c3, g3 = (f3 == null ? void 0 : f3.apiPrefix) === void 0 ? `${a2}/${h3}/${e3}` : n$4(a2 || "", h3, e3, f3.apiPrefix), _2 = {
|
|
4167
|
+
...o2,
|
|
4168
|
+
...m3,
|
|
4169
|
+
...s2 ? { Authorization: s2 } : {}
|
|
4170
|
+
}, v2 = (f3 == null || (l3 = f3.omitHeaders) == null ? void 0 : l3.map((e4) => e4.toLowerCase())) || [];
|
|
4171
|
+
for (let e4 of Object.keys(_2)) v2.includes(e4.toLowerCase()) && delete _2[e4];
|
|
4172
|
+
let y2 = await fetch(g3, {
|
|
4173
|
+
method: "POST",
|
|
4174
|
+
body: JSON.stringify(p3),
|
|
4175
|
+
headers: _2,
|
|
4176
|
+
...(f3 == null ? void 0 : f3.signal) && { signal: f3.signal }
|
|
4177
|
+
});
|
|
4178
|
+
return f3 ? y2 : await y2.json();
|
|
4179
|
+
}
|
|
4180
|
+
async function p2(e3, t4 = d2) {
|
|
4181
|
+
u2();
|
|
4182
|
+
let { body: n2, headers: r3 = {}, apiVersion: c3 = i } = t4, l3 = `${a2}/${c3}/${e3}`, f3 = {
|
|
4183
|
+
...o2,
|
|
4184
|
+
...r3,
|
|
4185
|
+
...s2 ? { Authorization: s2 } : {}
|
|
4186
|
+
};
|
|
4187
|
+
return await (await fetch(l3, {
|
|
4188
|
+
method: "PUT",
|
|
4189
|
+
body: JSON.stringify(n2),
|
|
4190
|
+
headers: f3
|
|
4191
|
+
})).json();
|
|
4192
|
+
}
|
|
4193
|
+
async function m2(e3, t4 = {}) {
|
|
4194
|
+
u2();
|
|
4195
|
+
let { headers: n2 = {}, apiVersion: r3 = i } = t4, o3 = `${a2}/${r3}/${e3}`;
|
|
4196
|
+
return await (await fetch(o3, { headers: n2 })).json();
|
|
4197
|
+
}
|
|
4198
|
+
function h2(t4, n2) {
|
|
4199
|
+
return new t$5({
|
|
4200
|
+
url: `${a2}/${i}/${t4}`,
|
|
4201
|
+
watch: n2.watch,
|
|
4202
|
+
expect: n2.expect,
|
|
4203
|
+
eachCall: n2.onEachResponse
|
|
4204
|
+
});
|
|
4205
|
+
}
|
|
4206
|
+
async function g2(e3, t4 = {}) {
|
|
4207
|
+
u2();
|
|
4208
|
+
let { headers: n2 = {}, apiVersion: r3 = i } = t4, c3 = `${a2}/${r3}/${e3}`, l3 = {
|
|
4209
|
+
...o2,
|
|
4210
|
+
...n2,
|
|
4211
|
+
...s2 ? { Authorization: s2 } : {}
|
|
4212
|
+
};
|
|
4213
|
+
return await (await fetch(c3, {
|
|
4214
|
+
method: "DELETE",
|
|
4215
|
+
headers: l3
|
|
4216
|
+
})).json();
|
|
4217
|
+
}
|
|
4218
|
+
return {
|
|
4219
|
+
get: m2,
|
|
4220
|
+
post: f2,
|
|
4221
|
+
put: p2,
|
|
4222
|
+
delete: g2,
|
|
4223
|
+
setAuthorizationHeader: l2,
|
|
4224
|
+
setConfig: c2,
|
|
4225
|
+
poll: h2
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
var t$3 = r$3({
|
|
4229
|
+
apiName: "Core",
|
|
4230
|
+
defaultApiVersion: "v1"
|
|
4231
|
+
});
|
|
4232
|
+
var n$3 = 5e3;
|
|
4233
|
+
function r$2(e3, t4) {
|
|
4234
|
+
try {
|
|
4235
|
+
e3 == null || e3(t4);
|
|
4236
|
+
} catch {
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
async function i$4(e3) {
|
|
4240
|
+
if (e3.ok) return "http_accepted";
|
|
4241
|
+
if (e3.status === 401) {
|
|
4242
|
+
try {
|
|
4243
|
+
let t4 = await e3.json();
|
|
4244
|
+
if (typeof t4 == "object" && t4 && "error" in t4) {
|
|
4245
|
+
if (t4.error === "Unauthorized") return "origin_not_authorized";
|
|
4246
|
+
if (t4.error === "Unauthorized token") return "bearer_rejected";
|
|
4247
|
+
}
|
|
4248
|
+
} catch {
|
|
4249
|
+
}
|
|
4250
|
+
return "authentication_rejected";
|
|
4251
|
+
}
|
|
4252
|
+
return e3.status === 403 ? "forbidden" : e3.status === 422 ? "invalid_payload" : e3.status === 503 ? "service_unavailable" : "http_error";
|
|
4253
|
+
}
|
|
4254
|
+
async function a$3({ requestId: a2, visitorId: o2, distinctId: s2, purchaseToken: c2, onDiagnostic: l2 }) {
|
|
4255
|
+
if (!a2 || !o2) return r$2(l2, {
|
|
4256
|
+
httpStatus: null,
|
|
4257
|
+
reason: "invalid_configuration"
|
|
4258
|
+
}), false;
|
|
4259
|
+
let u2 = new AbortController(), d2 = setTimeout(() => u2.abort(), n$3);
|
|
4260
|
+
try {
|
|
4261
|
+
let e3 = await t$3.post("fingerprint/bot-detection", {
|
|
4262
|
+
body: {
|
|
4263
|
+
requestId: a2,
|
|
4264
|
+
visitorId: o2,
|
|
4265
|
+
...s2 && { distinctId: s2 },
|
|
4266
|
+
...c2 && { purchaseToken: c2 },
|
|
4267
|
+
eventName: "Fingerprint Requested"
|
|
4268
|
+
},
|
|
4269
|
+
responseType: "response",
|
|
4270
|
+
apiPrefix: "api",
|
|
4271
|
+
omitHeaders: ["Origin"],
|
|
4272
|
+
signal: u2.signal
|
|
4273
|
+
});
|
|
4274
|
+
return l2 && r$2(l2, {
|
|
4275
|
+
httpStatus: e3.status,
|
|
4276
|
+
reason: await i$4(e3)
|
|
4277
|
+
}), e3.ok;
|
|
4278
|
+
} catch (t4) {
|
|
4279
|
+
return r$2(l2, {
|
|
4280
|
+
httpStatus: null,
|
|
4281
|
+
reason: t4 instanceof t$4 ? "invalid_configuration" : u2.signal.aborted ? "timeout" : "network_or_cors"
|
|
4282
|
+
}), false;
|
|
4283
|
+
} finally {
|
|
4284
|
+
clearTimeout(d2);
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
var o$2 = { sendObservation: a$3 };
|
|
4288
|
+
async function t$2(t4) {
|
|
4289
|
+
let { data: n2 } = await t$3.post("anonymous_profiles/identify", { body: t4 });
|
|
4290
|
+
return n2;
|
|
4291
|
+
}
|
|
4292
|
+
var n$2 = { createAnonymousProfile: t$2 };
|
|
4293
|
+
function t$1({ searchId: t4, userIdentifier: n2 }) {
|
|
4294
|
+
return t$3.get(`trip_recommendations/${t4}/${n2}`);
|
|
4295
|
+
}
|
|
4296
|
+
function n$1(t4) {
|
|
4297
|
+
return t$3.post("seat_recommendations", { body: t4 });
|
|
4298
|
+
}
|
|
4299
|
+
function r$1({ distinct_id: t4, ...n2 }) {
|
|
4300
|
+
return t$3.post(`seat_recommendations/${t4}`, { body: n2 });
|
|
4301
|
+
}
|
|
4302
|
+
function i$3(t4, n2) {
|
|
4303
|
+
let { start: r2, onEachResponse: i } = n2, a2 = `profiles/${t4}`, o2 = {
|
|
4304
|
+
watch: "state",
|
|
4305
|
+
expect: "finished",
|
|
4306
|
+
onEachResponse: i
|
|
4307
|
+
}, s2 = t$3.poll(a2, o2);
|
|
4308
|
+
return r2 && s2.start(), s2;
|
|
4309
|
+
}
|
|
4310
|
+
async function a$2(t4) {
|
|
4311
|
+
return t$3.post("profiles", { body: t4 });
|
|
4312
|
+
}
|
|
4313
|
+
async function o$1(t4) {
|
|
4314
|
+
return t$3.post("passengers", { body: t4 });
|
|
4315
|
+
}
|
|
4316
|
+
async function s$1(t4) {
|
|
4317
|
+
return t$3.get(`passengers/${t4}`);
|
|
4318
|
+
}
|
|
4319
|
+
async function c$1(t4, n2) {
|
|
4320
|
+
return t$3.delete(`passengers/${t4}/${n2}`);
|
|
4321
|
+
}
|
|
4322
|
+
var l$1 = {
|
|
4323
|
+
getRecommendedTrips: t$1,
|
|
4324
|
+
createRecommendedPlaces: a$2,
|
|
4325
|
+
pollRecommendedPlaces: i$3,
|
|
4326
|
+
createRecommendedSeats: n$1,
|
|
4327
|
+
getRecommendedSeats: r$1,
|
|
4328
|
+
getFrequentPassengers: s$1,
|
|
4329
|
+
createFrequentPassengers: o$1,
|
|
4330
|
+
deleteFrequentPassenger: c$1
|
|
4331
|
+
};
|
|
4332
|
+
var i$2 = {
|
|
4333
|
+
setConfig: t$3.setConfig,
|
|
4334
|
+
recommendations: l$1,
|
|
4335
|
+
profiles: n$2,
|
|
4336
|
+
fingerprint: o$2
|
|
4337
|
+
}, a$1 = i$2;
|
|
4338
|
+
const BOT_DETECTION_EVENTS = [
|
|
4339
|
+
"Search",
|
|
4340
|
+
"Payment Attempt",
|
|
4341
|
+
"Purchase Attempt"
|
|
4342
|
+
];
|
|
4343
|
+
function isEnabledFor(eventName) {
|
|
4344
|
+
return BOT_DETECTION_EVENTS.includes(eventName);
|
|
4345
|
+
}
|
|
4346
|
+
async function relay(payload) {
|
|
4347
|
+
try {
|
|
4348
|
+
await a$1.fingerprint.sendObservation({
|
|
4349
|
+
requestId: payload.requestId,
|
|
4350
|
+
visitorId: payload.visitorId,
|
|
4351
|
+
distinctId: payload.distinctId,
|
|
4352
|
+
onDiagnostic(diagnostic) {
|
|
4353
|
+
if (diagnostic.reason !== "http_accepted") {
|
|
4354
|
+
console.error(
|
|
4355
|
+
"Error relaying Fingerprint identification:",
|
|
4356
|
+
diagnostic
|
|
4357
|
+
);
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
});
|
|
4361
|
+
} catch (error) {
|
|
4362
|
+
console.error("Error relaying Fingerprint identification:", error);
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
const botDetectionRelayService = {
|
|
4366
|
+
isEnabledFor,
|
|
4367
|
+
relay
|
|
4368
|
+
};
|
|
3924
4369
|
function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
3925
4370
|
function adopt(value) {
|
|
3926
4371
|
return value instanceof P2 ? value : new P2(function(resolve) {
|
|
@@ -3931,15 +4376,15 @@ function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
|
3931
4376
|
function fulfilled(value) {
|
|
3932
4377
|
try {
|
|
3933
4378
|
step(generator.next(value));
|
|
3934
|
-
} catch (
|
|
3935
|
-
reject(
|
|
4379
|
+
} catch (e3) {
|
|
4380
|
+
reject(e3);
|
|
3936
4381
|
}
|
|
3937
4382
|
}
|
|
3938
4383
|
function rejected(value) {
|
|
3939
4384
|
try {
|
|
3940
4385
|
step(generator["throw"](value));
|
|
3941
|
-
} catch (
|
|
3942
|
-
reject(
|
|
4386
|
+
} catch (e3) {
|
|
4387
|
+
reject(e3);
|
|
3943
4388
|
}
|
|
3944
4389
|
}
|
|
3945
4390
|
function step(result) {
|
|
@@ -3949,187 +4394,187 @@ function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
|
3949
4394
|
});
|
|
3950
4395
|
}
|
|
3951
4396
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
3952
|
-
var
|
|
3953
|
-
return
|
|
4397
|
+
var e3 = new Error(message);
|
|
4398
|
+
return e3.name = "SuppressedError", e3.error = error, e3.suppressed = suppressed, e3;
|
|
3954
4399
|
};
|
|
3955
|
-
function
|
|
3956
|
-
return function(
|
|
3957
|
-
return Object.prototype.hasOwnProperty.call(
|
|
3958
|
-
}(
|
|
4400
|
+
function e2(e3, t4) {
|
|
4401
|
+
return function(e4, t5) {
|
|
4402
|
+
return Object.prototype.hasOwnProperty.call(e4, t5);
|
|
4403
|
+
}(e3, t4) ? e3[t4] : void 0;
|
|
3959
4404
|
}
|
|
3960
|
-
function
|
|
4405
|
+
function t3(e3, t4, n2, r2) {
|
|
3961
4406
|
const o2 = document, i = "securitypolicyviolation";
|
|
3962
4407
|
let R2;
|
|
3963
|
-
const s2 = (
|
|
3964
|
-
const n3 = new URL(
|
|
3965
|
-
r3 !== n3.href && r3 !== n3.protocol.slice(0, -1) && r3 !== n3.origin || (R2 =
|
|
4408
|
+
const s2 = (t5) => {
|
|
4409
|
+
const n3 = new URL(e3, location.href), { blockedURI: r3 } = t5;
|
|
4410
|
+
r3 !== n3.href && r3 !== n3.protocol.slice(0, -1) && r3 !== n3.origin || (R2 = t5, a2());
|
|
3966
4411
|
};
|
|
3967
4412
|
o2.addEventListener(i, s2);
|
|
3968
4413
|
const a2 = () => o2.removeEventListener(i, s2);
|
|
3969
|
-
return Promise.resolve().then(
|
|
3970
|
-
const
|
|
3971
|
-
|
|
4414
|
+
return Promise.resolve().then(t4).then((e4) => (a2(), e4), (e4) => new Promise((e5) => {
|
|
4415
|
+
const t5 = new MessageChannel();
|
|
4416
|
+
t5.port1.onmessage = () => e5(), t5.port2.postMessage(null);
|
|
3972
4417
|
}).then(() => {
|
|
3973
4418
|
if (a2(), R2) return n2(R2);
|
|
3974
|
-
throw
|
|
4419
|
+
throw e4;
|
|
3975
4420
|
}));
|
|
3976
4421
|
}
|
|
3977
|
-
function n
|
|
3978
|
-
let
|
|
3979
|
-
for (let n2 = 0; n2 <
|
|
3980
|
-
const r2 =
|
|
3981
|
-
r2 !==
|
|
3982
|
-
} else
|
|
3983
|
-
return
|
|
4422
|
+
function n(e3) {
|
|
4423
|
+
let t4 = "";
|
|
4424
|
+
for (let n2 = 0; n2 < e3.length; ++n2) if (n2 > 0) {
|
|
4425
|
+
const r2 = e3[n2].toLowerCase();
|
|
4426
|
+
r2 !== e3[n2] ? t4 += ` ${r2}` : t4 += e3[n2];
|
|
4427
|
+
} else t4 += e3[n2].toUpperCase();
|
|
4428
|
+
return t4;
|
|
3984
4429
|
}
|
|
3985
|
-
const r
|
|
3986
|
-
const v = "API key required", m
|
|
4430
|
+
const r = { default: "endpoint" }, o = { default: "tlsEndpoint" }, i$1 = "Client timeout", R = "Network connection error", s = "Network request aborted", a = "Response cannot be parsed", c = "Blocked by CSP", E = "The endpoint parameter is not a valid URL", l = "Handle on demand agent data error", u = /* @__PURE__ */ n("WrongRegion"), d = /* @__PURE__ */ n("SubscriptionNotActive"), _$1 = /* @__PURE__ */ n("UnsupportedVersion"), O = /* @__PURE__ */ n("InstallationMethodRestricted"), p = /* @__PURE__ */ n("HostnameRestricted"), I = /* @__PURE__ */ n("IntegrationFailed"), f = /* @__PURE__ */ n("NetworkRestricted"), N = /* @__PURE__ */ n("InvalidProxyIntegrationSecret"), T = /* @__PURE__ */ n("InvalidProxyIntegrationHeaders"), h = /* @__PURE__ */ n("ProxyIntegrationSecretEnvironmentMismatch");
|
|
4431
|
+
const v = "API key required", m = "API key not found", A = "API key expired", w = "Request cannot be parsed", P = "Request failed", D = "Request failed to process", S = "Too many requests, rate limit exceeded", y = "Not available for this origin", g = "Not available with restricted header", L = v, C = m, U = A;
|
|
3987
4432
|
var b = "3.12.6";
|
|
3988
4433
|
const M = "Failed to load the JS script of the agent", K = "9319";
|
|
3989
|
-
function V(
|
|
3990
|
-
const n2 = [], [r2, o2] = function(
|
|
3991
|
-
const
|
|
3992
|
-
const
|
|
3993
|
-
return { current: () =>
|
|
3994
|
-
const
|
|
3995
|
-
void 0 !==
|
|
4434
|
+
function V(e3, t4) {
|
|
4435
|
+
const n2 = [], [r2, o2] = function(e4) {
|
|
4436
|
+
const t5 = function(e5) {
|
|
4437
|
+
const t6 = [...e5];
|
|
4438
|
+
return { current: () => t6[0], postpone() {
|
|
4439
|
+
const e6 = t6.shift();
|
|
4440
|
+
void 0 !== e6 && t6.push(e6);
|
|
3996
4441
|
}, exclude() {
|
|
3997
|
-
|
|
4442
|
+
t6.shift();
|
|
3998
4443
|
} };
|
|
3999
|
-
}(
|
|
4444
|
+
}(e4), n3 = /* @__PURE__ */ function(e5, t6) {
|
|
4000
4445
|
let n4 = 0;
|
|
4001
|
-
return () => Math.random() * Math.min(
|
|
4446
|
+
return () => Math.random() * Math.min(t6, e5 * Math.pow(2, n4++));
|
|
4002
4447
|
}(100, 3e3), r3 = /* @__PURE__ */ new Set();
|
|
4003
|
-
return [
|
|
4448
|
+
return [t5.current(), (e5, o3) => {
|
|
4004
4449
|
let i2;
|
|
4005
4450
|
const R3 = o3 instanceof Error ? o3.message : "";
|
|
4006
|
-
if (R3 === c
|
|
4007
|
-
else if (R3 === K)
|
|
4451
|
+
if (R3 === c || R3 === E) t5.exclude(), i2 = 0;
|
|
4452
|
+
else if (R3 === K) t5.exclude();
|
|
4008
4453
|
else if (R3 === M) {
|
|
4009
|
-
const n4 = Date.now() -
|
|
4010
|
-
o4 && n4 && !r3.has(o4) && (r3.add(o4), i2 = 0),
|
|
4011
|
-
} else
|
|
4012
|
-
const s2 =
|
|
4013
|
-
return void 0 === s2 ? void 0 : [s2, null != i2 ? i2 :
|
|
4454
|
+
const n4 = Date.now() - e5.getTime() < 50, o4 = t5.current();
|
|
4455
|
+
o4 && n4 && !r3.has(o4) && (r3.add(o4), i2 = 0), t5.postpone();
|
|
4456
|
+
} else t5.postpone();
|
|
4457
|
+
const s2 = t5.current();
|
|
4458
|
+
return void 0 === s2 ? void 0 : [s2, null != i2 ? i2 : e5.getTime() + n3() - Date.now()];
|
|
4014
4459
|
}];
|
|
4015
|
-
}(
|
|
4460
|
+
}(e3);
|
|
4016
4461
|
let i;
|
|
4017
4462
|
if (void 0 === r2) return Promise.reject(new TypeError("The list of script URL patterns is empty"));
|
|
4018
|
-
const R2 = (
|
|
4019
|
-
const r3 = /* @__PURE__ */ new Date(), s2 = (
|
|
4020
|
-
return a2.then(() => s2(), s2), a2.catch((
|
|
4021
|
-
if (null != i || (i =
|
|
4022
|
-
const
|
|
4023
|
-
if (!
|
|
4024
|
-
const [s3, a3] =
|
|
4025
|
-
return (c2 = a3, new Promise((
|
|
4463
|
+
const R2 = (e4) => {
|
|
4464
|
+
const r3 = /* @__PURE__ */ new Date(), s2 = (t5) => n2.push({ url: e4, startedAt: r3, finishedAt: /* @__PURE__ */ new Date(), error: t5 }), a2 = t4(e4);
|
|
4465
|
+
return a2.then(() => s2(), s2), a2.catch((e5) => {
|
|
4466
|
+
if (null != i || (i = e5), n2.length >= 5) throw i;
|
|
4467
|
+
const t5 = o2(r3, e5);
|
|
4468
|
+
if (!t5) throw i;
|
|
4469
|
+
const [s3, a3] = t5;
|
|
4470
|
+
return (c2 = a3, new Promise((e6) => setTimeout(e6, c2))).then(() => R2(s3));
|
|
4026
4471
|
var c2;
|
|
4027
4472
|
});
|
|
4028
4473
|
};
|
|
4029
|
-
return R2(r2).then((
|
|
4474
|
+
return R2(r2).then((e4) => [e4, n2]);
|
|
4030
4475
|
}
|
|
4031
4476
|
const k = "https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js", G = k;
|
|
4032
|
-
function B(
|
|
4477
|
+
function B(t4) {
|
|
4033
4478
|
var n2, r2;
|
|
4034
|
-
const { picked: o2, rest: i } = function(
|
|
4479
|
+
const { picked: o2, rest: i } = function(e3, t5) {
|
|
4035
4480
|
const n3 = {}, r3 = {};
|
|
4036
|
-
for (const [o3, i2] of Object.entries(
|
|
4481
|
+
for (const [o3, i2] of Object.entries(e3)) t5.includes(o3) ? n3[o3] = i2 : r3[o3] = i2;
|
|
4037
4482
|
return { picked: n3, rest: r3 };
|
|
4038
|
-
}(
|
|
4039
|
-
const
|
|
4040
|
-
|
|
4041
|
-
}, n3 = function(
|
|
4042
|
-
return
|
|
4043
|
-
}(document, "visibilitychange",
|
|
4044
|
-
return
|
|
4483
|
+
}(t4, ["scriptUrlPattern", "token", "apiKey"]), R2 = o2.token, s2 = null !== (n2 = o2.apiKey) && void 0 !== n2 ? n2 : R2, a2 = null !== (r2 = e2(t4, "scriptUrlPattern")) && void 0 !== r2 ? r2 : k, [c2, E2] = function() {
|
|
4484
|
+
const e3 = [], t5 = () => {
|
|
4485
|
+
e3.push({ time: /* @__PURE__ */ new Date(), state: document.visibilityState });
|
|
4486
|
+
}, n3 = function(e4, t6, n4, r3) {
|
|
4487
|
+
return e4.addEventListener(t6, n4, r3), () => e4.removeEventListener(t6, n4, r3);
|
|
4488
|
+
}(document, "visibilitychange", t5);
|
|
4489
|
+
return t5(), [e3, n3];
|
|
4045
4490
|
}();
|
|
4046
4491
|
return Promise.resolve().then(() => {
|
|
4047
4492
|
if (!s2 || "string" != typeof s2) throw new Error(v);
|
|
4048
|
-
const
|
|
4049
|
-
return (Array.isArray(
|
|
4493
|
+
const e3 = function(e4, t5) {
|
|
4494
|
+
return (Array.isArray(e4) ? e4 : [e4]).map((e5) => function(e6, t6) {
|
|
4050
4495
|
const n3 = encodeURIComponent;
|
|
4051
|
-
return
|
|
4052
|
-
}(String(
|
|
4496
|
+
return e6.replace(/<[^<>]+>/g, (e7) => "<version>" === e7 ? "3" : "<apiKey>" === e7 ? n3(t6) : "<loaderVersion>" === e7 ? n3(b) : e7);
|
|
4497
|
+
}(String(e5), t5));
|
|
4053
4498
|
}(a2, s2);
|
|
4054
|
-
return V(
|
|
4055
|
-
}).catch((
|
|
4056
|
-
throw E2(), function(
|
|
4057
|
-
if (
|
|
4058
|
-
return
|
|
4059
|
-
}(
|
|
4060
|
-
}).then(([
|
|
4061
|
-
}
|
|
4062
|
-
function F(
|
|
4063
|
-
return
|
|
4064
|
-
return new Promise((
|
|
4065
|
-
if (function(
|
|
4499
|
+
return V(e3, F);
|
|
4500
|
+
}).catch((e3) => {
|
|
4501
|
+
throw E2(), function(e4) {
|
|
4502
|
+
if (e4 instanceof Error && e4.message === K) return new Error(M);
|
|
4503
|
+
return e4;
|
|
4504
|
+
}(e3);
|
|
4505
|
+
}).then(([e3, t5]) => (E2(), e3.load({ ...i, ldi: { attempts: t5, visibilityStates: c2 } })));
|
|
4506
|
+
}
|
|
4507
|
+
function F(e3) {
|
|
4508
|
+
return t3(e3, () => function(e4) {
|
|
4509
|
+
return new Promise((t4, n2) => {
|
|
4510
|
+
if (function(e5) {
|
|
4066
4511
|
if (URL.prototype) try {
|
|
4067
|
-
return new URL(
|
|
4068
|
-
} catch (
|
|
4069
|
-
if (
|
|
4070
|
-
throw
|
|
4512
|
+
return new URL(e5, location.href), false;
|
|
4513
|
+
} catch (t5) {
|
|
4514
|
+
if (t5 instanceof Error && "TypeError" === t5.name) return true;
|
|
4515
|
+
throw t5;
|
|
4071
4516
|
}
|
|
4072
|
-
}(
|
|
4517
|
+
}(e4)) throw new Error(E);
|
|
4073
4518
|
const r2 = document.createElement("script"), o2 = () => {
|
|
4074
|
-
var
|
|
4075
|
-
return null === (
|
|
4519
|
+
var e5;
|
|
4520
|
+
return null === (e5 = r2.parentNode) || void 0 === e5 ? void 0 : e5.removeChild(r2);
|
|
4076
4521
|
}, i = document.head || document.getElementsByTagName("head")[0];
|
|
4077
4522
|
r2.onload = () => {
|
|
4078
|
-
o2(),
|
|
4523
|
+
o2(), t4();
|
|
4079
4524
|
}, r2.onerror = () => {
|
|
4080
4525
|
o2(), n2(new Error(M));
|
|
4081
|
-
}, r2.async = true, r2.src =
|
|
4526
|
+
}, r2.async = true, r2.src = e4, i.appendChild(r2);
|
|
4082
4527
|
});
|
|
4083
|
-
}(
|
|
4084
|
-
throw new Error(c
|
|
4528
|
+
}(e3), () => {
|
|
4529
|
+
throw new Error(c);
|
|
4085
4530
|
}).then(x);
|
|
4086
4531
|
}
|
|
4087
4532
|
function x() {
|
|
4088
|
-
const
|
|
4089
|
-
if (function(
|
|
4533
|
+
const e3 = window, t4 = "__fpjs_p_l_b", n2 = e3[t4];
|
|
4534
|
+
if (function(e4, t5) {
|
|
4090
4535
|
var n3;
|
|
4091
|
-
const r2 = null === (n3 = Object.getOwnPropertyDescriptor) || void 0 === n3 ? void 0 : n3.call(Object,
|
|
4092
|
-
(null == r2 ? void 0 : r2.configurable) ? delete
|
|
4093
|
-
}(
|
|
4536
|
+
const r2 = null === (n3 = Object.getOwnPropertyDescriptor) || void 0 === n3 ? void 0 : n3.call(Object, e4, t5);
|
|
4537
|
+
(null == r2 ? void 0 : r2.configurable) ? delete e4[t5] : r2 && !r2.writable || (e4[t5] = void 0);
|
|
4538
|
+
}(e3, t4), "function" != typeof (null == n2 ? void 0 : n2.load)) throw new Error(K);
|
|
4094
4539
|
return n2;
|
|
4095
4540
|
}
|
|
4096
|
-
var H = { load: B, defaultScriptUrlPattern: G, ERROR_SCRIPT_LOAD_FAIL: M, ERROR_API_KEY_EXPIRED: A, ERROR_API_KEY_INVALID: m
|
|
4541
|
+
var H = { load: B, defaultScriptUrlPattern: G, ERROR_SCRIPT_LOAD_FAIL: M, ERROR_API_KEY_EXPIRED: A, ERROR_API_KEY_INVALID: m, ERROR_API_KEY_MISSING: v, ERROR_BAD_REQUEST_FORMAT: w, ERROR_BAD_RESPONSE_FORMAT: a, ERROR_CLIENT_TIMEOUT: i$1, ERROR_CSP_BLOCK: c, ERROR_FORBIDDEN_ENDPOINT: p, ERROR_FORBIDDEN_HEADER: g, ERROR_FORBIDDEN_ORIGIN: y, ERROR_GENERAL_SERVER_FAILURE: P, ERROR_HANDLE_AGENT_DATA: l, ERROR_INSTALLATION_METHOD_RESTRICTED: O, ERROR_INTEGRATION_FAILURE: I, ERROR_INVALID_ENDPOINT: E, ERROR_INVALID_PROXY_INTEGRATION_HEADERS: T, ERROR_INVALID_PROXY_INTEGRATION_SECRET: N, ERROR_NETWORK_ABORT: s, ERROR_NETWORK_CONNECTION: R, ERROR_NETWORK_RESTRICTED: f, ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH: h, ERROR_RATE_LIMIT: S, ERROR_SERVER_TIMEOUT: D, ERROR_SUBSCRIPTION_NOT_ACTIVE: d, ERROR_TOKEN_EXPIRED: U, ERROR_TOKEN_INVALID: C, ERROR_TOKEN_MISSING: L, ERROR_UNSUPPORTED_VERSION: _$1, ERROR_WRONG_REGION: u, defaultEndpoint: r, defaultTlsEndpoint: o };
|
|
4097
4542
|
const FingerprintJSPro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4098
4543
|
__proto__: null,
|
|
4099
4544
|
ERROR_API_KEY_EXPIRED: A,
|
|
4100
|
-
ERROR_API_KEY_INVALID: m
|
|
4545
|
+
ERROR_API_KEY_INVALID: m,
|
|
4101
4546
|
ERROR_API_KEY_MISSING: v,
|
|
4102
|
-
ERROR_BAD_REQUEST_FORMAT: w
|
|
4103
|
-
ERROR_BAD_RESPONSE_FORMAT: a
|
|
4104
|
-
ERROR_CLIENT_TIMEOUT: i$
|
|
4105
|
-
ERROR_CSP_BLOCK: c
|
|
4106
|
-
ERROR_FORBIDDEN_ENDPOINT: p
|
|
4107
|
-
ERROR_FORBIDDEN_HEADER: g
|
|
4108
|
-
ERROR_FORBIDDEN_ORIGIN: y
|
|
4547
|
+
ERROR_BAD_REQUEST_FORMAT: w,
|
|
4548
|
+
ERROR_BAD_RESPONSE_FORMAT: a,
|
|
4549
|
+
ERROR_CLIENT_TIMEOUT: i$1,
|
|
4550
|
+
ERROR_CSP_BLOCK: c,
|
|
4551
|
+
ERROR_FORBIDDEN_ENDPOINT: p,
|
|
4552
|
+
ERROR_FORBIDDEN_HEADER: g,
|
|
4553
|
+
ERROR_FORBIDDEN_ORIGIN: y,
|
|
4109
4554
|
ERROR_GENERAL_SERVER_FAILURE: P,
|
|
4110
|
-
ERROR_HANDLE_AGENT_DATA: l
|
|
4555
|
+
ERROR_HANDLE_AGENT_DATA: l,
|
|
4111
4556
|
ERROR_INSTALLATION_METHOD_RESTRICTED: O,
|
|
4112
4557
|
ERROR_INTEGRATION_FAILURE: I,
|
|
4113
|
-
ERROR_INVALID_ENDPOINT: E
|
|
4558
|
+
ERROR_INVALID_ENDPOINT: E,
|
|
4114
4559
|
ERROR_INVALID_PROXY_INTEGRATION_HEADERS: T,
|
|
4115
4560
|
ERROR_INVALID_PROXY_INTEGRATION_SECRET: N,
|
|
4116
|
-
ERROR_NETWORK_ABORT: s
|
|
4117
|
-
ERROR_NETWORK_CONNECTION: R
|
|
4118
|
-
ERROR_NETWORK_RESTRICTED: f
|
|
4561
|
+
ERROR_NETWORK_ABORT: s,
|
|
4562
|
+
ERROR_NETWORK_CONNECTION: R,
|
|
4563
|
+
ERROR_NETWORK_RESTRICTED: f,
|
|
4119
4564
|
ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH: h,
|
|
4120
4565
|
ERROR_RATE_LIMIT: S,
|
|
4121
4566
|
ERROR_SCRIPT_LOAD_FAIL: M,
|
|
4122
4567
|
ERROR_SERVER_TIMEOUT: D,
|
|
4123
|
-
ERROR_SUBSCRIPTION_NOT_ACTIVE: d
|
|
4568
|
+
ERROR_SUBSCRIPTION_NOT_ACTIVE: d,
|
|
4124
4569
|
ERROR_TOKEN_EXPIRED: U,
|
|
4125
4570
|
ERROR_TOKEN_INVALID: C,
|
|
4126
4571
|
ERROR_TOKEN_MISSING: L,
|
|
4127
4572
|
ERROR_UNSUPPORTED_VERSION: _$1,
|
|
4128
|
-
ERROR_WRONG_REGION: u
|
|
4573
|
+
ERROR_WRONG_REGION: u,
|
|
4129
4574
|
default: H,
|
|
4130
|
-
defaultEndpoint: r
|
|
4575
|
+
defaultEndpoint: r,
|
|
4131
4576
|
defaultScriptUrlPattern: G,
|
|
4132
|
-
defaultTlsEndpoint: o
|
|
4577
|
+
defaultTlsEndpoint: o,
|
|
4133
4578
|
load: B
|
|
4134
4579
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4135
4580
|
const CACHE_KEY_PREFIX = "@fpjs@client@";
|
|
@@ -4171,7 +4616,7 @@ class LocalStorageCache {
|
|
|
4171
4616
|
}
|
|
4172
4617
|
try {
|
|
4173
4618
|
return JSON.parse(json);
|
|
4174
|
-
} catch (
|
|
4619
|
+
} catch (e3) {
|
|
4175
4620
|
return;
|
|
4176
4621
|
}
|
|
4177
4622
|
}
|
|
@@ -4206,7 +4651,7 @@ class SessionStorageCache {
|
|
|
4206
4651
|
}
|
|
4207
4652
|
try {
|
|
4208
4653
|
return JSON.parse(json);
|
|
4209
|
-
} catch (
|
|
4654
|
+
} catch (e3) {
|
|
4210
4655
|
return;
|
|
4211
4656
|
}
|
|
4212
4657
|
}
|
|
@@ -4338,14 +4783,14 @@ const doesBrowserSupportCacheLocation = (cacheLocation) => {
|
|
|
4338
4783
|
case CacheLocation.SessionStorage:
|
|
4339
4784
|
try {
|
|
4340
4785
|
window.sessionStorage.getItem("item");
|
|
4341
|
-
} catch (
|
|
4786
|
+
} catch (e3) {
|
|
4342
4787
|
return false;
|
|
4343
4788
|
}
|
|
4344
4789
|
return true;
|
|
4345
4790
|
case CacheLocation.LocalStorage:
|
|
4346
4791
|
try {
|
|
4347
4792
|
window.localStorage.getItem("item");
|
|
4348
|
-
} catch (
|
|
4793
|
+
} catch (e3) {
|
|
4349
4794
|
return false;
|
|
4350
4795
|
}
|
|
4351
4796
|
return true;
|
|
@@ -4490,529 +4935,10 @@ class FpjsClient {
|
|
|
4490
4935
|
}
|
|
4491
4936
|
const agentResult = yield this.agent.get(options);
|
|
4492
4937
|
yield this.cacheManager.set(key, agentResult);
|
|
4493
|
-
return Object.assign(Object.assign({}, agentResult), { cacheHit: false });
|
|
4494
|
-
});
|
|
4495
|
-
}
|
|
4496
|
-
}
|
|
4497
|
-
const DEFAULT_CACHE_NAME = "default_fingerprint_cache";
|
|
4498
|
-
const DEFAULT_CACHE_TIME_IN_DAYS = 7;
|
|
4499
|
-
const PROXY_QUERY_PARAM = "apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>";
|
|
4500
|
-
let fingerprintAgentReady = false;
|
|
4501
|
-
const getExpirationDate = (cacheTimeInDays) => {
|
|
4502
|
-
const currentDate = /* @__PURE__ */ new Date();
|
|
4503
|
-
const futureDate = new Date(
|
|
4504
|
-
currentDate.getTime() + cacheTimeInDays * 24 * 60 * 60 * 1e3
|
|
4505
|
-
);
|
|
4506
|
-
return futureDate.getTime();
|
|
4507
|
-
};
|
|
4508
|
-
const getCachedFingerprint = () => {
|
|
4509
|
-
const { cacheName = DEFAULT_CACHE_NAME } = window.fingerprintConfig;
|
|
4510
|
-
try {
|
|
4511
|
-
const cachedData = JSON.parse(localStorage.getItem(cacheName) || "null");
|
|
4512
|
-
if (cachedData && cachedData.expiresAt > Date.now()) {
|
|
4513
|
-
return cachedData.fingerprint;
|
|
4514
|
-
}
|
|
4515
|
-
localStorage.removeItem(cacheName);
|
|
4516
|
-
return null;
|
|
4517
|
-
} catch {
|
|
4518
|
-
return null;
|
|
4519
|
-
}
|
|
4520
|
-
};
|
|
4521
|
-
const setCachedFingerprint = (fingerprint) => {
|
|
4522
|
-
const {
|
|
4523
|
-
cacheName = DEFAULT_CACHE_NAME,
|
|
4524
|
-
cacheTimeInDays = DEFAULT_CACHE_TIME_IN_DAYS
|
|
4525
|
-
} = window.fingerprintConfig;
|
|
4526
|
-
const cacheData = {
|
|
4527
|
-
fingerprint,
|
|
4528
|
-
expiresAt: getExpirationDate(cacheTimeInDays)
|
|
4529
|
-
};
|
|
4530
|
-
localStorage.setItem(cacheName, JSON.stringify(cacheData));
|
|
4531
|
-
};
|
|
4532
|
-
function buildProxyUrl(url) {
|
|
4533
|
-
return `${url}?${PROXY_QUERY_PARAM}`;
|
|
4534
|
-
}
|
|
4535
|
-
async function initFingerprint(apiKey, proxyUrl) {
|
|
4536
|
-
const customEndpointArray = [r$2];
|
|
4537
|
-
const customScriptEndpointArray = [G];
|
|
4538
|
-
if (proxyUrl) {
|
|
4539
|
-
customEndpointArray.unshift(proxyUrl);
|
|
4540
|
-
customScriptEndpointArray.unshift(buildProxyUrl(proxyUrl));
|
|
4541
|
-
}
|
|
4542
|
-
fingerprintAgentReady = false;
|
|
4543
|
-
window.fingerprintConfig = {};
|
|
4544
|
-
const client = new FpjsClient({
|
|
4545
|
-
loadOptions: {
|
|
4546
|
-
apiKey,
|
|
4547
|
-
endpoint: customEndpointArray,
|
|
4548
|
-
scriptUrlPattern: customScriptEndpointArray
|
|
4549
|
-
}
|
|
4550
|
-
});
|
|
4551
|
-
window.fpClient = client;
|
|
4552
|
-
try {
|
|
4553
|
-
await client.init();
|
|
4554
|
-
if (window.fpClient === client) {
|
|
4555
|
-
fingerprintAgentReady = true;
|
|
4556
|
-
}
|
|
4557
|
-
} catch (error) {
|
|
4558
|
-
if (window.fpClient === client) {
|
|
4559
|
-
fingerprintAgentReady = false;
|
|
4560
|
-
}
|
|
4561
|
-
console.error("Error initializing identification service:", error);
|
|
4562
|
-
throw error;
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4565
|
-
async function getFingerprint(cacheOnly = false) {
|
|
4566
|
-
if (!window.fingerprintConfig) {
|
|
4567
|
-
if (cacheOnly) {
|
|
4568
|
-
return "";
|
|
4569
|
-
}
|
|
4570
|
-
throw new Error("Fingerprint configuration is not initialized.");
|
|
4571
|
-
}
|
|
4572
|
-
const cachedFingerprint = getCachedFingerprint();
|
|
4573
|
-
if (cachedFingerprint) {
|
|
4574
|
-
return cachedFingerprint;
|
|
4575
|
-
}
|
|
4576
|
-
if (cacheOnly || !isFingerprintReady()) {
|
|
4577
|
-
return "";
|
|
4578
|
-
}
|
|
4579
|
-
try {
|
|
4580
|
-
const fpClient = window.fpClient;
|
|
4581
|
-
const { visitorId: fingerprint } = await fpClient.getVisitorData();
|
|
4582
|
-
setCachedFingerprint(fingerprint);
|
|
4583
|
-
return fingerprint;
|
|
4584
|
-
} catch (error) {
|
|
4585
|
-
console.error("Error retrieving fingerprint:", error);
|
|
4586
|
-
throw error;
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4589
|
-
function isFingerprintReady() {
|
|
4590
|
-
return window.fpClient !== void 0 && fingerprintAgentReady;
|
|
4591
|
-
}
|
|
4592
|
-
const fingerprintService = {
|
|
4593
|
-
initFingerprint,
|
|
4594
|
-
getFingerprint,
|
|
4595
|
-
isFingerprintReady,
|
|
4596
|
-
getCachedFingerprint
|
|
4597
|
-
};
|
|
4598
|
-
const r$1 = {
|
|
4599
|
-
sandbox: {
|
|
4600
|
-
search: "https://search.resertravel.com/api",
|
|
4601
|
-
purchase: "https://purchases.resertravel.com/api",
|
|
4602
|
-
core: ""
|
|
4603
|
-
},
|
|
4604
|
-
production: {
|
|
4605
|
-
search: "https://search.reservamos.mx/api",
|
|
4606
|
-
purchase: "https://compras.reservamos.mx/api",
|
|
4607
|
-
core: ""
|
|
4608
|
-
}
|
|
4609
|
-
}, s$2 = "sandbox", a$1 = "v2", t$2 = "v1", n$1 = {
|
|
4610
|
-
env: s$2,
|
|
4611
|
-
headers: {},
|
|
4612
|
-
searchUrl: r$1[s$2].search,
|
|
4613
|
-
purchaseUrl: r$1[s$2].purchase,
|
|
4614
|
-
coreUrl: r$1[s$2].core,
|
|
4615
|
-
version: a$1,
|
|
4616
|
-
coreVersion: t$2,
|
|
4617
|
-
apiKey: void 0,
|
|
4618
|
-
userAuthToken: void 0,
|
|
4619
|
-
withCredentials: false
|
|
4620
|
-
};
|
|
4621
|
-
let c$2 = Object.assign({}, n$1);
|
|
4622
|
-
const o$1 = {
|
|
4623
|
-
// UNAUTHORIZED
|
|
4624
|
-
1: {
|
|
4625
|
-
code: 200,
|
|
4626
|
-
message: "Operación no autorizada"
|
|
4627
|
-
}
|
|
4628
|
-
}, s$1 = {
|
|
4629
|
-
// INCORRECT_PARAMS
|
|
4630
|
-
3: {
|
|
4631
|
-
code: 300,
|
|
4632
|
-
message: "Parámetros incorrectos"
|
|
4633
|
-
},
|
|
4634
|
-
// INCORRECT_DATE
|
|
4635
|
-
7: {
|
|
4636
|
-
code: 301,
|
|
4637
|
-
message: "Fecha inválida"
|
|
4638
|
-
}
|
|
4639
|
-
}, r = {
|
|
4640
|
-
// NONEXISTENT_TRIP
|
|
4641
|
-
10: {
|
|
4642
|
-
code: 400,
|
|
4643
|
-
message: "No existe el viaje"
|
|
4644
|
-
},
|
|
4645
|
-
// journey_key_not_found
|
|
4646
|
-
20: {
|
|
4647
|
-
code: 60,
|
|
4648
|
-
message: "No se encontró el viaje"
|
|
4649
|
-
},
|
|
4650
|
-
// sold_out_fare_code
|
|
4651
|
-
21: {
|
|
4652
|
-
code: 60,
|
|
4653
|
-
message: "Tarifa no disponible"
|
|
4654
|
-
},
|
|
4655
|
-
// unavailable_fare_code
|
|
4656
|
-
22: {
|
|
4657
|
-
code: 60,
|
|
4658
|
-
message: "Tarifa no disponible"
|
|
4659
|
-
}
|
|
4660
|
-
}, n = (e2) => ({
|
|
4661
|
-
// INVALID_DISCOUNT
|
|
4662
|
-
11: {
|
|
4663
|
-
code: 500,
|
|
4664
|
-
message: e2
|
|
4665
|
-
},
|
|
4666
|
-
//EXPIRED_DISCOUNT
|
|
4667
|
-
12: {
|
|
4668
|
-
code: 501,
|
|
4669
|
-
message: e2
|
|
4670
|
-
}
|
|
4671
|
-
}), a = {
|
|
4672
|
-
// unavailable_student
|
|
4673
|
-
23: {
|
|
4674
|
-
code: 60,
|
|
4675
|
-
message: "Estudiante no disponible"
|
|
4676
|
-
},
|
|
4677
|
-
// unavailable_teacher
|
|
4678
|
-
24: {
|
|
4679
|
-
code: 60,
|
|
4680
|
-
message: "Profesor no disponible"
|
|
4681
|
-
},
|
|
4682
|
-
// unavailable_minor
|
|
4683
|
-
25: {
|
|
4684
|
-
code: 60,
|
|
4685
|
-
message: "Menor no disponible"
|
|
4686
|
-
},
|
|
4687
|
-
// unavailable_special
|
|
4688
|
-
26: {
|
|
4689
|
-
code: 60,
|
|
4690
|
-
message: "Capacidades diferentes no disponible"
|
|
4691
|
-
},
|
|
4692
|
-
// unavailable_older
|
|
4693
|
-
27: {
|
|
4694
|
-
code: 60,
|
|
4695
|
-
message: "INSEN no disponible"
|
|
4696
|
-
},
|
|
4697
|
-
// unavailable_general
|
|
4698
|
-
28: {
|
|
4699
|
-
code: 60,
|
|
4700
|
-
message: "General no disponible"
|
|
4701
|
-
},
|
|
4702
|
-
// unavailable_unknown
|
|
4703
|
-
29: {
|
|
4704
|
-
code: 60,
|
|
4705
|
-
message: "Error desconocido"
|
|
4706
|
-
}
|
|
4707
|
-
}, c$1 = (e2) => ({
|
|
4708
|
-
30: {
|
|
4709
|
-
code: 30,
|
|
4710
|
-
message: e2
|
|
4711
|
-
}
|
|
4712
|
-
}), d$1 = {
|
|
4713
|
-
50: {
|
|
4714
|
-
code: 50,
|
|
4715
|
-
message: "Unknow Error"
|
|
4716
|
-
}
|
|
4717
|
-
}, i$2 = (e2) => ({
|
|
4718
|
-
...o$1,
|
|
4719
|
-
...s$1,
|
|
4720
|
-
...r,
|
|
4721
|
-
...n(e2),
|
|
4722
|
-
...a,
|
|
4723
|
-
...d$1,
|
|
4724
|
-
...c$1(e2)
|
|
4725
|
-
});
|
|
4726
|
-
class o extends Error {
|
|
4727
|
-
constructor(r2 = -100, s2 = "Unknown error", t2 = null) {
|
|
4728
|
-
super(s2), this.code = r2, this.details = t2, this.stack = new Error().stack;
|
|
4729
|
-
}
|
|
4730
|
-
}
|
|
4731
|
-
async function w(t2) {
|
|
4732
|
-
const e2 = [404, 422, 500], r2 = await t2.json();
|
|
4733
|
-
if (t2.ok)
|
|
4734
|
-
return r2;
|
|
4735
|
-
if (e2.includes(t2.status))
|
|
4736
|
-
switch (t2.status) {
|
|
4737
|
-
case 404:
|
|
4738
|
-
throw new o(100, "Not found");
|
|
4739
|
-
case 422:
|
|
4740
|
-
return r2;
|
|
4741
|
-
case 500:
|
|
4742
|
-
throw new o(101, "Server error");
|
|
4743
|
-
default:
|
|
4744
|
-
throw new o();
|
|
4745
|
-
}
|
|
4746
|
-
else
|
|
4747
|
-
throw new o(t2.status, r2.message || t2.statusText, r2);
|
|
4748
|
-
}
|
|
4749
|
-
function l$1(t2) {
|
|
4750
|
-
if (t2.errors instanceof Array) {
|
|
4751
|
-
const { code: e2 = -100, message: r2 = "Unknown error" } = t2.errors[0] || {}, n2 = i$2(r2)[e2];
|
|
4752
|
-
throw n2 ? new o(n2.code, n2.message, t2.errors[0]) : new o(e2, r2, t2.errors[0]);
|
|
4753
|
-
} else
|
|
4754
|
-
return t2;
|
|
4755
|
-
}
|
|
4756
|
-
function y(...t2) {
|
|
4757
|
-
const r2 = Object.keys(Object.assign({}, ...t2)).reduce(
|
|
4758
|
-
(n2, o2) => ({
|
|
4759
|
-
...n2,
|
|
4760
|
-
[o2]: t2.map((a2) => o2 in a2 && a2[o2]).filter(Boolean)
|
|
4761
|
-
}),
|
|
4762
|
-
{}
|
|
4763
|
-
);
|
|
4764
|
-
return new Headers(r2);
|
|
4765
|
-
}
|
|
4766
|
-
function c(t2, e2 = {}, r2 = {}, n2) {
|
|
4767
|
-
const {
|
|
4768
|
-
apiKey: o2,
|
|
4769
|
-
withCredentials: a2,
|
|
4770
|
-
userAuthToken: s2,
|
|
4771
|
-
headers: d2
|
|
4772
|
-
} = c$2, u3 = {
|
|
4773
|
-
Accept: "application/json",
|
|
4774
|
-
Authorization: `Token token=${r2.apiKey || o2}`,
|
|
4775
|
-
"Content-Type": "application/json"
|
|
4776
|
-
};
|
|
4777
|
-
return s2 && (u3.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`), e2.headers = y(d2, u3), e2.credentials = a2 ? "include" : "omit", typeof e2.body != "string" && (e2.body = JSON.stringify(e2.body)), fetch(t2, e2).then(w).then(l$1).catch(n2);
|
|
4778
|
-
}
|
|
4779
|
-
function E(t2, e2 = {}, r2) {
|
|
4780
|
-
return c(t2, e2, {}, r2);
|
|
4781
|
-
}
|
|
4782
|
-
let u$1 = class u {
|
|
4783
|
-
constructor({
|
|
4784
|
-
url: e2,
|
|
4785
|
-
watch: i,
|
|
4786
|
-
expect: h2,
|
|
4787
|
-
maxRetries: t2 = 30,
|
|
4788
|
-
interval: s2 = 2e3,
|
|
4789
|
-
eachCall: c2 = null
|
|
4790
|
-
}) {
|
|
4791
|
-
this.url = e2, this.watch = i, this.expect = h2 instanceof Array ? h2 : [h2], this.interval = s2, this.maxRetries = t2, this.eachCall = c2 && c2.bind(this), this.aborted = false, this.timers = [], this.execute = this.execute.bind(this), this.executeEachCall = this.executeEachCall.bind(this);
|
|
4792
|
-
}
|
|
4793
|
-
start() {
|
|
4794
|
-
return this.execute(this.maxRetries);
|
|
4795
|
-
}
|
|
4796
|
-
abort() {
|
|
4797
|
-
this.aborted = true;
|
|
4798
|
-
}
|
|
4799
|
-
execute(e2) {
|
|
4800
|
-
const i = (t2) => {
|
|
4801
|
-
if (this.expect.includes(t2[this.watch]) || e2 === 1 || this.aborted) {
|
|
4802
|
-
let s2 = t2[this.watch];
|
|
4803
|
-
e2 === 1 ? s2 = "retries_exceeded" : this.aborted && (s2 = "aborted"), this.timers.forEach(clearInterval), this.executeEachCall(s2, t2);
|
|
4804
|
-
} else if (t2[this.watch] === "failed")
|
|
4805
|
-
this.timers.forEach(clearInterval), this.executeEachCall("failed", t2);
|
|
4806
|
-
else {
|
|
4807
|
-
this.executeEachCall("pending", t2);
|
|
4808
|
-
const s2 = window.setTimeout(
|
|
4809
|
-
this.execute,
|
|
4810
|
-
this.interval,
|
|
4811
|
-
e2 - 1
|
|
4812
|
-
);
|
|
4813
|
-
this.timers.push(s2);
|
|
4814
|
-
}
|
|
4815
|
-
}, h2 = (t2) => this.executeEachCall("error", t2);
|
|
4816
|
-
return E(this.url, {}, h2).then(i);
|
|
4817
|
-
}
|
|
4818
|
-
executeEachCall(e2, i) {
|
|
4819
|
-
this.eachCall instanceof Function && this.eachCall({ status: e2, payload: i }) && this.abort();
|
|
4820
|
-
}
|
|
4821
|
-
};
|
|
4822
|
-
function j({
|
|
4823
|
-
apiName: h2,
|
|
4824
|
-
defaultApiVersion: c2
|
|
4825
|
-
}) {
|
|
4826
|
-
let n2, i = {
|
|
4827
|
-
"Content-Type": "application/json"
|
|
4828
|
-
}, r2;
|
|
4829
|
-
function f2(e2) {
|
|
4830
|
-
n2 = e2.baseUrl, i = {
|
|
4831
|
-
...i,
|
|
4832
|
-
...e2.defaultHeaders || {}
|
|
4833
|
-
};
|
|
4834
|
-
}
|
|
4835
|
-
function p2(e2) {
|
|
4836
|
-
r2 = e2;
|
|
4837
|
-
}
|
|
4838
|
-
function d2() {
|
|
4839
|
-
if (!n2)
|
|
4840
|
-
throw new Error(`Base URL is not set for ${h2} API.`);
|
|
4841
|
-
}
|
|
4842
|
-
const $ = { body: {} };
|
|
4843
|
-
async function y2(e2, t2 = $) {
|
|
4844
|
-
d2();
|
|
4845
|
-
const { body: s2, headers: o2 = {}, apiVersion: a2 = c2 } = t2, u3 = `${n2}/${a2}/${e2}`, l2 = {
|
|
4846
|
-
...i,
|
|
4847
|
-
...o2,
|
|
4848
|
-
...r2 ? { Authorization: r2 } : {}
|
|
4849
|
-
};
|
|
4850
|
-
return (await fetch(u3, {
|
|
4851
|
-
method: "POST",
|
|
4852
|
-
body: JSON.stringify(s2),
|
|
4853
|
-
headers: l2
|
|
4854
|
-
})).json();
|
|
4855
|
-
}
|
|
4856
|
-
async function w2(e2, t2 = {}) {
|
|
4857
|
-
d2();
|
|
4858
|
-
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`;
|
|
4859
|
-
return (await fetch(a2, { headers: s2 })).json();
|
|
4860
|
-
}
|
|
4861
|
-
function H2(e2, t2) {
|
|
4862
|
-
const o2 = {
|
|
4863
|
-
url: `${n2}/${c2}/${e2}`,
|
|
4864
|
-
watch: t2.watch,
|
|
4865
|
-
expect: t2.expect,
|
|
4866
|
-
eachCall: t2.onEachResponse
|
|
4867
|
-
};
|
|
4868
|
-
return new u$1(o2);
|
|
4869
|
-
}
|
|
4870
|
-
async function b2(e2, t2 = {}) {
|
|
4871
|
-
d2();
|
|
4872
|
-
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`, u3 = {
|
|
4873
|
-
...i,
|
|
4874
|
-
...s2,
|
|
4875
|
-
...r2 ? { Authorization: r2 } : {}
|
|
4876
|
-
};
|
|
4877
|
-
return (await fetch(a2, {
|
|
4878
|
-
method: "DELETE",
|
|
4879
|
-
headers: u3
|
|
4880
|
-
})).json();
|
|
4881
|
-
}
|
|
4882
|
-
return {
|
|
4883
|
-
get: w2,
|
|
4884
|
-
post: y2,
|
|
4885
|
-
delete: b2,
|
|
4886
|
-
setAuthorizationHeader: p2,
|
|
4887
|
-
setConfig: f2,
|
|
4888
|
-
poll: H2
|
|
4889
|
-
};
|
|
4890
|
-
}
|
|
4891
|
-
const t$1 = j({
|
|
4892
|
-
apiName: "Core",
|
|
4893
|
-
defaultApiVersion: "v1"
|
|
4894
|
-
});
|
|
4895
|
-
async function t(o2) {
|
|
4896
|
-
const { data: e2 } = await t$1.post(
|
|
4897
|
-
"anonymous_profiles/identify",
|
|
4898
|
-
{
|
|
4899
|
-
body: o2
|
|
4900
|
-
}
|
|
4901
|
-
);
|
|
4902
|
-
return e2;
|
|
4903
|
-
}
|
|
4904
|
-
const s = {
|
|
4905
|
-
createAnonymousProfile: t
|
|
4906
|
-
};
|
|
4907
|
-
function d({
|
|
4908
|
-
searchId: e2,
|
|
4909
|
-
userIdentifier: t2
|
|
4910
|
-
}) {
|
|
4911
|
-
return t$1.get(
|
|
4912
|
-
`trip_recommendations/${e2}/${t2}`
|
|
4913
|
-
);
|
|
4914
|
-
}
|
|
4915
|
-
function i$1(e2) {
|
|
4916
|
-
return t$1.post("seat_recommendations", {
|
|
4917
|
-
body: e2
|
|
4918
|
-
});
|
|
4919
|
-
}
|
|
4920
|
-
function p({
|
|
4921
|
-
distinct_id: e2,
|
|
4922
|
-
...t2
|
|
4923
|
-
}) {
|
|
4924
|
-
return t$1.post(`seat_recommendations/${e2}`, {
|
|
4925
|
-
body: t2
|
|
4926
|
-
});
|
|
4927
|
-
}
|
|
4928
|
-
function u2(e2, t2) {
|
|
4929
|
-
const { start: o2, onEachResponse: r2 } = t2, c2 = `profiles/${e2}`, a2 = {
|
|
4930
|
-
watch: "state",
|
|
4931
|
-
expect: "finished",
|
|
4932
|
-
onEachResponse: r2
|
|
4933
|
-
}, s2 = t$1.poll(c2, a2);
|
|
4934
|
-
return o2 && s2.start(), s2;
|
|
4935
|
-
}
|
|
4936
|
-
async function m(e2) {
|
|
4937
|
-
return t$1.post("profiles", {
|
|
4938
|
-
body: e2
|
|
4939
|
-
});
|
|
4940
|
-
}
|
|
4941
|
-
async function l(e2) {
|
|
4942
|
-
return t$1.post("passengers", {
|
|
4943
|
-
body: e2
|
|
4944
|
-
});
|
|
4945
|
-
}
|
|
4946
|
-
async function f$1(e2) {
|
|
4947
|
-
return t$1.get(
|
|
4948
|
-
`passengers/${e2}`
|
|
4949
|
-
);
|
|
4950
|
-
}
|
|
4951
|
-
async function g(e2, t2) {
|
|
4952
|
-
return t$1.delete(
|
|
4953
|
-
`passengers/${e2}/${t2}`
|
|
4954
|
-
);
|
|
4955
|
-
}
|
|
4956
|
-
const R = {
|
|
4957
|
-
getRecommendedTrips: d,
|
|
4958
|
-
createRecommendedPlaces: m,
|
|
4959
|
-
pollRecommendedPlaces: u2,
|
|
4960
|
-
createRecommendedSeats: i$1,
|
|
4961
|
-
getRecommendedSeats: p,
|
|
4962
|
-
getFrequentPassengers: f$1,
|
|
4963
|
-
createFrequentPassengers: l,
|
|
4964
|
-
deleteFrequentPassenger: g
|
|
4965
|
-
};
|
|
4966
|
-
const f = {
|
|
4967
|
-
setConfig: t$1.setConfig,
|
|
4968
|
-
recommendations: R,
|
|
4969
|
-
profiles: s
|
|
4970
|
-
};
|
|
4971
|
-
let environment;
|
|
4972
|
-
let appName;
|
|
4973
|
-
const origin = window.location.origin;
|
|
4974
|
-
const coreAPIConfig = {
|
|
4975
|
-
sandbox: {
|
|
4976
|
-
baseUrl: "https://datalake-api-dev.reservamossaas.com/api",
|
|
4977
|
-
defaultHeaders: {
|
|
4978
|
-
Origin: origin,
|
|
4979
|
-
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
4980
|
-
}
|
|
4981
|
-
},
|
|
4982
|
-
prod: {
|
|
4983
|
-
baseUrl: "https://data-lake.reservamossaas.com/api",
|
|
4984
|
-
defaultHeaders: {
|
|
4985
|
-
Origin: origin,
|
|
4986
|
-
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
4987
|
-
}
|
|
4988
|
-
}
|
|
4989
|
-
};
|
|
4990
|
-
function setEnvironment(env) {
|
|
4991
|
-
environment = env;
|
|
4992
|
-
}
|
|
4993
|
-
function setAppName(name) {
|
|
4994
|
-
appName = name;
|
|
4995
|
-
}
|
|
4996
|
-
function getCoreAPIConfig() {
|
|
4997
|
-
if (!environment) {
|
|
4998
|
-
throw new Error(
|
|
4999
|
-
"Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment."
|
|
5000
|
-
);
|
|
4938
|
+
return Object.assign(Object.assign({}, agentResult), { cacheHit: false });
|
|
4939
|
+
});
|
|
5001
4940
|
}
|
|
5002
|
-
const config = coreAPIConfig[environment];
|
|
5003
|
-
return {
|
|
5004
|
-
...config,
|
|
5005
|
-
defaultHeaders: {
|
|
5006
|
-
...config.defaultHeaders,
|
|
5007
|
-
...appName ? { "x-app-name": appName } : {}
|
|
5008
|
-
}
|
|
5009
|
-
};
|
|
5010
4941
|
}
|
|
5011
|
-
const configService = {
|
|
5012
|
-
setEnvironment,
|
|
5013
|
-
setAppName,
|
|
5014
|
-
getCoreAPIConfig
|
|
5015
|
-
};
|
|
5016
4942
|
var NodeType;
|
|
5017
4943
|
(function(NodeType2) {
|
|
5018
4944
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
@@ -5364,7 +5290,7 @@ function _isBlockedElement(element, blockClass, blockSelector) {
|
|
|
5364
5290
|
if (blockSelector) {
|
|
5365
5291
|
return element.matches(blockSelector);
|
|
5366
5292
|
}
|
|
5367
|
-
} catch (
|
|
5293
|
+
} catch (e3) {
|
|
5368
5294
|
}
|
|
5369
5295
|
return false;
|
|
5370
5296
|
}
|
|
@@ -5412,7 +5338,7 @@ function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors)
|
|
|
5412
5338
|
return true;
|
|
5413
5339
|
}
|
|
5414
5340
|
}
|
|
5415
|
-
} catch (
|
|
5341
|
+
} catch (e3) {
|
|
5416
5342
|
}
|
|
5417
5343
|
return false;
|
|
5418
5344
|
}
|
|
@@ -5701,7 +5627,7 @@ function serializeElementNode(n2, options) {
|
|
|
5701
5627
|
try {
|
|
5702
5628
|
if (customElements.get(tagName))
|
|
5703
5629
|
isCustomElement = true;
|
|
5704
|
-
} catch (
|
|
5630
|
+
} catch (e3) {
|
|
5705
5631
|
}
|
|
5706
5632
|
return {
|
|
5707
5633
|
type: NodeType.Element,
|
|
@@ -6127,7 +6053,7 @@ function isBlocked(node, blockClass, blockSelector, checkAncestors) {
|
|
|
6127
6053
|
if (classMatchesRegex(el, blockClass, checkAncestors))
|
|
6128
6054
|
return true;
|
|
6129
6055
|
}
|
|
6130
|
-
} catch (
|
|
6056
|
+
} catch (e3) {
|
|
6131
6057
|
}
|
|
6132
6058
|
if (blockSelector) {
|
|
6133
6059
|
if (el.matches(blockSelector))
|
|
@@ -6663,7 +6589,7 @@ class MutationBuffer {
|
|
|
6663
6589
|
if (!this.unattachedDoc) {
|
|
6664
6590
|
try {
|
|
6665
6591
|
this.unattachedDoc = document.implementation.createHTMLDocument();
|
|
6666
|
-
} catch (
|
|
6592
|
+
} catch (e3) {
|
|
6667
6593
|
this.unattachedDoc = this.doc;
|
|
6668
6594
|
}
|
|
6669
6595
|
}
|
|
@@ -6996,12 +6922,12 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror: mirror2
|
|
|
6996
6922
|
pointerType = currentPointerType;
|
|
6997
6923
|
currentPointerType = null;
|
|
6998
6924
|
}
|
|
6999
|
-
const
|
|
7000
|
-
if (!
|
|
6925
|
+
const e3 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
6926
|
+
if (!e3) {
|
|
7001
6927
|
return;
|
|
7002
6928
|
}
|
|
7003
6929
|
const id = mirror2.getId(target);
|
|
7004
|
-
const { clientX, clientY } =
|
|
6930
|
+
const { clientX, clientY } = e3;
|
|
7005
6931
|
callbackWrapper(mouseInteractionCb)(Object.assign({ type: MouseInteractions[thisEventKey], id, x: clientX, y: clientY }, pointerType !== null && { pointerType }));
|
|
7006
6932
|
};
|
|
7007
6933
|
};
|
|
@@ -7342,7 +7268,7 @@ function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, h
|
|
|
7342
7268
|
if (hostId !== null && hostId !== -1) {
|
|
7343
7269
|
try {
|
|
7344
7270
|
stylesheetManager.adoptStyleSheets(sheets, hostId);
|
|
7345
|
-
} catch (
|
|
7271
|
+
} catch (e3) {
|
|
7346
7272
|
}
|
|
7347
7273
|
}
|
|
7348
7274
|
return result;
|
|
@@ -7517,7 +7443,7 @@ function initCustomElementObserver({ doc, customElementCb }) {
|
|
|
7517
7443
|
name
|
|
7518
7444
|
}
|
|
7519
7445
|
});
|
|
7520
|
-
} catch (
|
|
7446
|
+
} catch (e3) {
|
|
7521
7447
|
console.warn(`Custom element callback failed for ${name}`);
|
|
7522
7448
|
}
|
|
7523
7449
|
return original.apply(this, [name, constructor, options]);
|
|
@@ -7791,18 +7717,18 @@ class IframeManager {
|
|
|
7791
7717
|
if (transformedEvent)
|
|
7792
7718
|
this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout);
|
|
7793
7719
|
}
|
|
7794
|
-
transformCrossOriginEvent(iframeEl,
|
|
7720
|
+
transformCrossOriginEvent(iframeEl, e3) {
|
|
7795
7721
|
var _a;
|
|
7796
|
-
switch (
|
|
7722
|
+
switch (e3.type) {
|
|
7797
7723
|
case EventType$1.FullSnapshot: {
|
|
7798
7724
|
this.crossOriginIframeMirror.reset(iframeEl);
|
|
7799
7725
|
this.crossOriginIframeStyleMirror.reset(iframeEl);
|
|
7800
|
-
this.replaceIdOnNode(
|
|
7801
|
-
const rootId =
|
|
7726
|
+
this.replaceIdOnNode(e3.data.node, iframeEl);
|
|
7727
|
+
const rootId = e3.data.node.id;
|
|
7802
7728
|
this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
|
|
7803
|
-
this.patchRootIdOnNode(
|
|
7729
|
+
this.patchRootIdOnNode(e3.data.node, rootId);
|
|
7804
7730
|
return {
|
|
7805
|
-
timestamp:
|
|
7731
|
+
timestamp: e3.timestamp,
|
|
7806
7732
|
type: EventType$1.IncrementalSnapshot,
|
|
7807
7733
|
data: {
|
|
7808
7734
|
source: IncrementalSource$1.Mutation,
|
|
@@ -7810,7 +7736,7 @@ class IframeManager {
|
|
|
7810
7736
|
{
|
|
7811
7737
|
parentId: this.mirror.getId(iframeEl),
|
|
7812
7738
|
nextId: null,
|
|
7813
|
-
node:
|
|
7739
|
+
node: e3.data.node
|
|
7814
7740
|
}
|
|
7815
7741
|
],
|
|
7816
7742
|
removes: [],
|
|
@@ -7826,16 +7752,16 @@ class IframeManager {
|
|
|
7826
7752
|
return false;
|
|
7827
7753
|
}
|
|
7828
7754
|
case EventType$1.Plugin: {
|
|
7829
|
-
return
|
|
7755
|
+
return e3;
|
|
7830
7756
|
}
|
|
7831
7757
|
case EventType$1.Custom: {
|
|
7832
|
-
this.replaceIds(
|
|
7833
|
-
return
|
|
7758
|
+
this.replaceIds(e3.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]);
|
|
7759
|
+
return e3;
|
|
7834
7760
|
}
|
|
7835
7761
|
case EventType$1.IncrementalSnapshot: {
|
|
7836
|
-
switch (
|
|
7762
|
+
switch (e3.data.source) {
|
|
7837
7763
|
case IncrementalSource$1.Mutation: {
|
|
7838
|
-
|
|
7764
|
+
e3.data.adds.forEach((n2) => {
|
|
7839
7765
|
this.replaceIds(n2, iframeEl, [
|
|
7840
7766
|
"parentId",
|
|
7841
7767
|
"nextId",
|
|
@@ -7845,24 +7771,24 @@ class IframeManager {
|
|
|
7845
7771
|
const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);
|
|
7846
7772
|
rootId && this.patchRootIdOnNode(n2.node, rootId);
|
|
7847
7773
|
});
|
|
7848
|
-
|
|
7774
|
+
e3.data.removes.forEach((n2) => {
|
|
7849
7775
|
this.replaceIds(n2, iframeEl, ["parentId", "id"]);
|
|
7850
7776
|
});
|
|
7851
|
-
|
|
7777
|
+
e3.data.attributes.forEach((n2) => {
|
|
7852
7778
|
this.replaceIds(n2, iframeEl, ["id"]);
|
|
7853
7779
|
});
|
|
7854
|
-
|
|
7780
|
+
e3.data.texts.forEach((n2) => {
|
|
7855
7781
|
this.replaceIds(n2, iframeEl, ["id"]);
|
|
7856
7782
|
});
|
|
7857
|
-
return
|
|
7783
|
+
return e3;
|
|
7858
7784
|
}
|
|
7859
7785
|
case IncrementalSource$1.Drag:
|
|
7860
7786
|
case IncrementalSource$1.TouchMove:
|
|
7861
7787
|
case IncrementalSource$1.MouseMove: {
|
|
7862
|
-
|
|
7788
|
+
e3.data.positions.forEach((p2) => {
|
|
7863
7789
|
this.replaceIds(p2, iframeEl, ["id"]);
|
|
7864
7790
|
});
|
|
7865
|
-
return
|
|
7791
|
+
return e3;
|
|
7866
7792
|
}
|
|
7867
7793
|
case IncrementalSource$1.ViewportResize: {
|
|
7868
7794
|
return false;
|
|
@@ -7872,31 +7798,31 @@ class IframeManager {
|
|
|
7872
7798
|
case IncrementalSource$1.Scroll:
|
|
7873
7799
|
case IncrementalSource$1.CanvasMutation:
|
|
7874
7800
|
case IncrementalSource$1.Input: {
|
|
7875
|
-
this.replaceIds(
|
|
7876
|
-
return
|
|
7801
|
+
this.replaceIds(e3.data, iframeEl, ["id"]);
|
|
7802
|
+
return e3;
|
|
7877
7803
|
}
|
|
7878
7804
|
case IncrementalSource$1.StyleSheetRule:
|
|
7879
7805
|
case IncrementalSource$1.StyleDeclaration: {
|
|
7880
|
-
this.replaceIds(
|
|
7881
|
-
this.replaceStyleIds(
|
|
7882
|
-
return
|
|
7806
|
+
this.replaceIds(e3.data, iframeEl, ["id"]);
|
|
7807
|
+
this.replaceStyleIds(e3.data, iframeEl, ["styleId"]);
|
|
7808
|
+
return e3;
|
|
7883
7809
|
}
|
|
7884
7810
|
case IncrementalSource$1.Font: {
|
|
7885
|
-
return
|
|
7811
|
+
return e3;
|
|
7886
7812
|
}
|
|
7887
7813
|
case IncrementalSource$1.Selection: {
|
|
7888
|
-
|
|
7814
|
+
e3.data.ranges.forEach((range) => {
|
|
7889
7815
|
this.replaceIds(range, iframeEl, ["start", "end"]);
|
|
7890
7816
|
});
|
|
7891
|
-
return
|
|
7817
|
+
return e3;
|
|
7892
7818
|
}
|
|
7893
7819
|
case IncrementalSource$1.AdoptedStyleSheet: {
|
|
7894
|
-
this.replaceIds(
|
|
7895
|
-
this.replaceStyleIds(
|
|
7896
|
-
(_a =
|
|
7820
|
+
this.replaceIds(e3.data, iframeEl, ["id"]);
|
|
7821
|
+
this.replaceStyleIds(e3.data, iframeEl, ["styleIds"]);
|
|
7822
|
+
(_a = e3.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
|
|
7897
7823
|
this.replaceStyleIds(style, iframeEl, ["styleId"]);
|
|
7898
7824
|
});
|
|
7899
|
-
return
|
|
7825
|
+
return e3;
|
|
7900
7826
|
}
|
|
7901
7827
|
}
|
|
7902
7828
|
}
|
|
@@ -7991,7 +7917,7 @@ class ShadowDomManager {
|
|
|
7991
7917
|
this.restoreHandlers.forEach((handler) => {
|
|
7992
7918
|
try {
|
|
7993
7919
|
handler();
|
|
7994
|
-
} catch (
|
|
7920
|
+
} catch (e3) {
|
|
7995
7921
|
}
|
|
7996
7922
|
});
|
|
7997
7923
|
this.restoreHandlers = [];
|
|
@@ -8012,16 +7938,16 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
8012
7938
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
8013
7939
|
PERFORMANCE OF THIS SOFTWARE.
|
|
8014
7940
|
***************************************************************************** */
|
|
8015
|
-
function __rest(s2,
|
|
8016
|
-
var
|
|
8017
|
-
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) &&
|
|
8018
|
-
|
|
7941
|
+
function __rest(s2, e3) {
|
|
7942
|
+
var t4 = {};
|
|
7943
|
+
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e3.indexOf(p2) < 0)
|
|
7944
|
+
t4[p2] = s2[p2];
|
|
8019
7945
|
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8020
7946
|
for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
|
|
8021
|
-
if (
|
|
8022
|
-
|
|
7947
|
+
if (e3.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i]))
|
|
7948
|
+
t4[p2[i]] = s2[p2[i]];
|
|
8023
7949
|
}
|
|
8024
|
-
return
|
|
7950
|
+
return t4;
|
|
8025
7951
|
}
|
|
8026
7952
|
function __awaiter(thisArg, _arguments, P2, generator) {
|
|
8027
7953
|
function adopt(value) {
|
|
@@ -8033,15 +7959,15 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
8033
7959
|
function fulfilled(value) {
|
|
8034
7960
|
try {
|
|
8035
7961
|
step(generator.next(value));
|
|
8036
|
-
} catch (
|
|
8037
|
-
reject(
|
|
7962
|
+
} catch (e3) {
|
|
7963
|
+
reject(e3);
|
|
8038
7964
|
}
|
|
8039
7965
|
}
|
|
8040
7966
|
function rejected(value) {
|
|
8041
7967
|
try {
|
|
8042
7968
|
step(generator["throw"](value));
|
|
8043
|
-
} catch (
|
|
8044
|
-
reject(
|
|
7969
|
+
} catch (e3) {
|
|
7970
|
+
reject(e3);
|
|
8045
7971
|
}
|
|
8046
7972
|
}
|
|
8047
7973
|
function step(result) {
|
|
@@ -8362,15 +8288,15 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8362
8288
|
function fulfilled(value) {
|
|
8363
8289
|
try {
|
|
8364
8290
|
step(generator.next(value));
|
|
8365
|
-
} catch (
|
|
8366
|
-
reject(
|
|
8291
|
+
} catch (e3) {
|
|
8292
|
+
reject(e3);
|
|
8367
8293
|
}
|
|
8368
8294
|
}
|
|
8369
8295
|
function rejected(value) {
|
|
8370
8296
|
try {
|
|
8371
8297
|
step(generator["throw"](value));
|
|
8372
|
-
} catch (
|
|
8373
|
-
reject(
|
|
8298
|
+
} catch (e3) {
|
|
8299
|
+
reject(e3);
|
|
8374
8300
|
}
|
|
8375
8301
|
}
|
|
8376
8302
|
function step(result) {
|
|
@@ -8420,10 +8346,10 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8420
8346
|
});
|
|
8421
8347
|
}
|
|
8422
8348
|
const worker = self;
|
|
8423
|
-
worker.onmessage = function(
|
|
8349
|
+
worker.onmessage = function(e3) {
|
|
8424
8350
|
return __awaiter2(this, void 0, void 0, function* () {
|
|
8425
8351
|
if ("OffscreenCanvas" in globalThis) {
|
|
8426
|
-
const { id, bitmap, width, height, dataURLOptions } =
|
|
8352
|
+
const { id, bitmap, width, height, dataURLOptions } = e3.data;
|
|
8427
8353
|
const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
|
|
8428
8354
|
const offscreen = new OffscreenCanvas(width, height);
|
|
8429
8355
|
const ctx = offscreen.getContext("2d");
|
|
@@ -8448,7 +8374,7 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8448
8374
|
});
|
|
8449
8375
|
lastBlobMap.set(id, base64);
|
|
8450
8376
|
} else {
|
|
8451
|
-
return worker.postMessage({ id:
|
|
8377
|
+
return worker.postMessage({ id: e3.data.id });
|
|
8452
8378
|
}
|
|
8453
8379
|
});
|
|
8454
8380
|
};
|
|
@@ -8500,12 +8426,12 @@ class CanvasManager {
|
|
|
8500
8426
|
const canvasContextReset = initCanvasContextObserver(win2, blockClass, blockSelector, true);
|
|
8501
8427
|
const snapshotInProgressMap = /* @__PURE__ */ new Map();
|
|
8502
8428
|
const worker = new WorkerFactory();
|
|
8503
|
-
worker.onmessage = (
|
|
8504
|
-
const { id } =
|
|
8429
|
+
worker.onmessage = (e3) => {
|
|
8430
|
+
const { id } = e3.data;
|
|
8505
8431
|
snapshotInProgressMap.set(id, false);
|
|
8506
|
-
if (!("base64" in
|
|
8432
|
+
if (!("base64" in e3.data))
|
|
8507
8433
|
return;
|
|
8508
|
-
const { base64, type, width, height } =
|
|
8434
|
+
const { base64, type, width, height } = e3.data;
|
|
8509
8435
|
this.mutationCb({
|
|
8510
8436
|
id,
|
|
8511
8437
|
type: CanvasContext["2D"],
|
|
@@ -8717,8 +8643,8 @@ class ProcessedNodeManager {
|
|
|
8717
8643
|
this.loop = false;
|
|
8718
8644
|
}
|
|
8719
8645
|
}
|
|
8720
|
-
function wrapEvent(
|
|
8721
|
-
return Object.assign(Object.assign({},
|
|
8646
|
+
function wrapEvent(e3) {
|
|
8647
|
+
return Object.assign(Object.assign({}, e3), { timestamp: nowTimestamp() });
|
|
8722
8648
|
}
|
|
8723
8649
|
let wrappedEmit;
|
|
8724
8650
|
let takeFullSnapshot;
|
|
@@ -8735,7 +8661,7 @@ function record(options = {}) {
|
|
|
8735
8661
|
if (window.parent.document) {
|
|
8736
8662
|
passEmitsToParent = false;
|
|
8737
8663
|
}
|
|
8738
|
-
} catch (
|
|
8664
|
+
} catch (e3) {
|
|
8739
8665
|
passEmitsToParent = true;
|
|
8740
8666
|
}
|
|
8741
8667
|
}
|
|
@@ -8779,43 +8705,43 @@ function record(options = {}) {
|
|
|
8779
8705
|
polyfill();
|
|
8780
8706
|
let lastFullSnapshotEvent;
|
|
8781
8707
|
let incrementalSnapshotCount = 0;
|
|
8782
|
-
const eventProcessor = (
|
|
8708
|
+
const eventProcessor = (e3) => {
|
|
8783
8709
|
for (const plugin of plugins || []) {
|
|
8784
8710
|
if (plugin.eventProcessor) {
|
|
8785
|
-
|
|
8711
|
+
e3 = plugin.eventProcessor(e3);
|
|
8786
8712
|
}
|
|
8787
8713
|
}
|
|
8788
8714
|
if (packFn && !passEmitsToParent) {
|
|
8789
|
-
|
|
8715
|
+
e3 = packFn(e3);
|
|
8790
8716
|
}
|
|
8791
|
-
return
|
|
8717
|
+
return e3;
|
|
8792
8718
|
};
|
|
8793
|
-
wrappedEmit = (
|
|
8719
|
+
wrappedEmit = (e3, isCheckout) => {
|
|
8794
8720
|
var _a;
|
|
8795
|
-
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
8721
|
+
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) && e3.type !== EventType$1.FullSnapshot && !(e3.type === EventType$1.IncrementalSnapshot && e3.data.source === IncrementalSource$1.Mutation)) {
|
|
8796
8722
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
8797
8723
|
}
|
|
8798
8724
|
if (inEmittingFrame) {
|
|
8799
|
-
emit === null || emit === void 0 ? void 0 : emit(eventProcessor(
|
|
8725
|
+
emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e3), isCheckout);
|
|
8800
8726
|
} else if (passEmitsToParent) {
|
|
8801
8727
|
const message = {
|
|
8802
8728
|
type: "rrweb",
|
|
8803
|
-
event: eventProcessor(
|
|
8729
|
+
event: eventProcessor(e3),
|
|
8804
8730
|
origin: window.location.origin,
|
|
8805
8731
|
isCheckout
|
|
8806
8732
|
};
|
|
8807
8733
|
window.parent.postMessage(message, "*");
|
|
8808
8734
|
}
|
|
8809
|
-
if (
|
|
8810
|
-
lastFullSnapshotEvent =
|
|
8735
|
+
if (e3.type === EventType$1.FullSnapshot) {
|
|
8736
|
+
lastFullSnapshotEvent = e3;
|
|
8811
8737
|
incrementalSnapshotCount = 0;
|
|
8812
|
-
} else if (
|
|
8813
|
-
if (
|
|
8738
|
+
} else if (e3.type === EventType$1.IncrementalSnapshot) {
|
|
8739
|
+
if (e3.data.source === IncrementalSource$1.Mutation && e3.data.isAttachIframe) {
|
|
8814
8740
|
return;
|
|
8815
8741
|
}
|
|
8816
8742
|
incrementalSnapshotCount++;
|
|
8817
8743
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
8818
|
-
const exceedTime = checkoutEveryNms &&
|
|
8744
|
+
const exceedTime = checkoutEveryNms && e3.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
8819
8745
|
if (exceedCount || exceedTime) {
|
|
8820
8746
|
takeFullSnapshot(true);
|
|
8821
8747
|
}
|
|
@@ -9546,10 +9472,10 @@ _.JSONDecode = function() {
|
|
|
9546
9472
|
"r": "\r",
|
|
9547
9473
|
"t": " "
|
|
9548
9474
|
}, text, error = function(m2) {
|
|
9549
|
-
var
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
throw
|
|
9475
|
+
var e3 = new SyntaxError(m2);
|
|
9476
|
+
e3.at = at;
|
|
9477
|
+
e3.text = text;
|
|
9478
|
+
throw e3;
|
|
9553
9479
|
}, next = function(c2) {
|
|
9554
9480
|
if (c2 && c2 !== ch) {
|
|
9555
9481
|
error("Expected '" + c2 + "' instead of '" + ch + "'");
|
|
@@ -9804,9 +9730,9 @@ _.UUID = /* @__PURE__ */ function() {
|
|
|
9804
9730
|
var UA = function() {
|
|
9805
9731
|
var ua = userAgent, i, ch, buffer = [], ret = 0;
|
|
9806
9732
|
function xor(result, byte_array) {
|
|
9807
|
-
var
|
|
9808
|
-
for (
|
|
9809
|
-
tmp |= buffer[
|
|
9733
|
+
var j, tmp = 0;
|
|
9734
|
+
for (j = 0; j < byte_array.length; j++) {
|
|
9735
|
+
tmp |= buffer[j] << j * 8;
|
|
9810
9736
|
}
|
|
9811
9737
|
return result ^ tmp;
|
|
9812
9738
|
}
|
|
@@ -10076,8 +10002,8 @@ _.register_event = function() {
|
|
|
10076
10002
|
}();
|
|
10077
10003
|
var TOKEN_MATCH_REGEX = new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');
|
|
10078
10004
|
_.dom_query = /* @__PURE__ */ function() {
|
|
10079
|
-
function getAllChildren(
|
|
10080
|
-
return
|
|
10005
|
+
function getAllChildren(e3) {
|
|
10006
|
+
return e3.all ? e3.all : e3.getElementsByTagName("*");
|
|
10081
10007
|
}
|
|
10082
10008
|
var bad_whitespace = /[\t\r\n]/g;
|
|
10083
10009
|
function hasClass(elem, selector) {
|
|
@@ -10089,7 +10015,7 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10089
10015
|
return [];
|
|
10090
10016
|
}
|
|
10091
10017
|
var tokens = selector.split(" ");
|
|
10092
|
-
var token, bits, tagName, found, foundCount, i,
|
|
10018
|
+
var token, bits, tagName, found, foundCount, i, j, k2, elements, currentContextIndex;
|
|
10093
10019
|
var currentContext = [document$1];
|
|
10094
10020
|
for (i = 0; i < tokens.length; i++) {
|
|
10095
10021
|
token = tokens[i].replace(/^\s+/, "").replace(/\s+$/, "");
|
|
@@ -10113,11 +10039,11 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10113
10039
|
}
|
|
10114
10040
|
found = [];
|
|
10115
10041
|
foundCount = 0;
|
|
10116
|
-
for (
|
|
10042
|
+
for (j = 0; j < currentContext.length; j++) {
|
|
10117
10043
|
if (tagName == "*") {
|
|
10118
|
-
elements = getAllChildren(currentContext[
|
|
10044
|
+
elements = getAllChildren(currentContext[j]);
|
|
10119
10045
|
} else {
|
|
10120
|
-
elements = currentContext[
|
|
10046
|
+
elements = currentContext[j].getElementsByTagName(tagName);
|
|
10121
10047
|
}
|
|
10122
10048
|
for (k2 = 0; k2 < elements.length; k2++) {
|
|
10123
10049
|
found[foundCount++] = elements[k2];
|
|
@@ -10125,10 +10051,10 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10125
10051
|
}
|
|
10126
10052
|
currentContext = [];
|
|
10127
10053
|
currentContextIndex = 0;
|
|
10128
|
-
for (
|
|
10129
|
-
if (found[
|
|
10130
|
-
hasClass(found[
|
|
10131
|
-
currentContext[currentContextIndex++] = found[
|
|
10054
|
+
for (j = 0; j < found.length; j++) {
|
|
10055
|
+
if (found[j].className && _.isString(found[j].className) && // some SVG elements have classNames which are not strings
|
|
10056
|
+
hasClass(found[j], className)) {
|
|
10057
|
+
currentContext[currentContextIndex++] = found[j];
|
|
10132
10058
|
}
|
|
10133
10059
|
}
|
|
10134
10060
|
continue;
|
|
@@ -10144,11 +10070,11 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10144
10070
|
}
|
|
10145
10071
|
found = [];
|
|
10146
10072
|
foundCount = 0;
|
|
10147
|
-
for (
|
|
10073
|
+
for (j = 0; j < currentContext.length; j++) {
|
|
10148
10074
|
if (tagName == "*") {
|
|
10149
|
-
elements = getAllChildren(currentContext[
|
|
10075
|
+
elements = getAllChildren(currentContext[j]);
|
|
10150
10076
|
} else {
|
|
10151
|
-
elements = currentContext[
|
|
10077
|
+
elements = currentContext[j].getElementsByTagName(tagName);
|
|
10152
10078
|
}
|
|
10153
10079
|
for (k2 = 0; k2 < elements.length; k2++) {
|
|
10154
10080
|
found[foundCount++] = elements[k2];
|
|
@@ -10159,45 +10085,45 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10159
10085
|
var checkFunction;
|
|
10160
10086
|
switch (attrOperator) {
|
|
10161
10087
|
case "=":
|
|
10162
|
-
checkFunction = function(
|
|
10163
|
-
return
|
|
10088
|
+
checkFunction = function(e3) {
|
|
10089
|
+
return e3.getAttribute(attrName) == attrValue;
|
|
10164
10090
|
};
|
|
10165
10091
|
break;
|
|
10166
10092
|
case "~":
|
|
10167
|
-
checkFunction = function(
|
|
10168
|
-
return
|
|
10093
|
+
checkFunction = function(e3) {
|
|
10094
|
+
return e3.getAttribute(attrName).match(new RegExp("\\b" + attrValue + "\\b"));
|
|
10169
10095
|
};
|
|
10170
10096
|
break;
|
|
10171
10097
|
case "|":
|
|
10172
|
-
checkFunction = function(
|
|
10173
|
-
return
|
|
10098
|
+
checkFunction = function(e3) {
|
|
10099
|
+
return e3.getAttribute(attrName).match(new RegExp("^" + attrValue + "-?"));
|
|
10174
10100
|
};
|
|
10175
10101
|
break;
|
|
10176
10102
|
case "^":
|
|
10177
|
-
checkFunction = function(
|
|
10178
|
-
return
|
|
10103
|
+
checkFunction = function(e3) {
|
|
10104
|
+
return e3.getAttribute(attrName).indexOf(attrValue) === 0;
|
|
10179
10105
|
};
|
|
10180
10106
|
break;
|
|
10181
10107
|
case "$":
|
|
10182
|
-
checkFunction = function(
|
|
10183
|
-
return
|
|
10108
|
+
checkFunction = function(e3) {
|
|
10109
|
+
return e3.getAttribute(attrName).lastIndexOf(attrValue) == e3.getAttribute(attrName).length - attrValue.length;
|
|
10184
10110
|
};
|
|
10185
10111
|
break;
|
|
10186
10112
|
case "*":
|
|
10187
|
-
checkFunction = function(
|
|
10188
|
-
return
|
|
10113
|
+
checkFunction = function(e3) {
|
|
10114
|
+
return e3.getAttribute(attrName).indexOf(attrValue) > -1;
|
|
10189
10115
|
};
|
|
10190
10116
|
break;
|
|
10191
10117
|
default:
|
|
10192
|
-
checkFunction = function(
|
|
10193
|
-
return
|
|
10118
|
+
checkFunction = function(e3) {
|
|
10119
|
+
return e3.getAttribute(attrName);
|
|
10194
10120
|
};
|
|
10195
10121
|
}
|
|
10196
10122
|
currentContext = [];
|
|
10197
10123
|
currentContextIndex = 0;
|
|
10198
|
-
for (
|
|
10199
|
-
if (checkFunction(found[
|
|
10200
|
-
currentContext[currentContextIndex++] = found[
|
|
10124
|
+
for (j = 0; j < found.length; j++) {
|
|
10125
|
+
if (checkFunction(found[j])) {
|
|
10126
|
+
currentContext[currentContextIndex++] = found[j];
|
|
10201
10127
|
}
|
|
10202
10128
|
}
|
|
10203
10129
|
continue;
|
|
@@ -10205,8 +10131,8 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10205
10131
|
tagName = token;
|
|
10206
10132
|
found = [];
|
|
10207
10133
|
foundCount = 0;
|
|
10208
|
-
for (
|
|
10209
|
-
elements = currentContext[
|
|
10134
|
+
for (j = 0; j < currentContext.length; j++) {
|
|
10135
|
+
elements = currentContext[j].getElementsByTagName(tagName);
|
|
10210
10136
|
for (k2 = 0; k2 < elements.length; k2++) {
|
|
10211
10137
|
found[foundCount++] = elements[k2];
|
|
10212
10138
|
}
|
|
@@ -11383,11 +11309,11 @@ DomTracker.prototype.track = function(query, event_name, properties, user_callba
|
|
|
11383
11309
|
return;
|
|
11384
11310
|
}
|
|
11385
11311
|
_.each(elements, function(element) {
|
|
11386
|
-
_.register_event(element, this.override_event, function(
|
|
11312
|
+
_.register_event(element, this.override_event, function(e3) {
|
|
11387
11313
|
var options = {};
|
|
11388
11314
|
var props = that.create_properties(properties, this);
|
|
11389
11315
|
var timeout = that.mp.get_config("track_links_timeout");
|
|
11390
|
-
that.event_handler(
|
|
11316
|
+
that.event_handler(e3, this, options);
|
|
11391
11317
|
window.setTimeout(that.track_callback(user_callback, props, options, true), timeout);
|
|
11392
11318
|
that.mp.track(event_name, props, that.track_callback(user_callback, props, options));
|
|
11393
11319
|
});
|
|
@@ -11850,7 +11776,7 @@ MixpanelPeople.prototype._flush = function(_set_callback, _add_callback, _append
|
|
|
11850
11776
|
_remove_callback(response, data);
|
|
11851
11777
|
}
|
|
11852
11778
|
};
|
|
11853
|
-
for (var
|
|
11779
|
+
for (var j = $remove_queue.length - 1; j >= 0; j--) {
|
|
11854
11780
|
$remove_queue = this._mixpanel["persistence"].load_queue(REMOVE_ACTION);
|
|
11855
11781
|
$remove_item = $remove_queue.pop();
|
|
11856
11782
|
_this._mixpanel["persistence"].save();
|
|
@@ -12612,16 +12538,16 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12612
12538
|
} else if (use_sendBeacon) {
|
|
12613
12539
|
try {
|
|
12614
12540
|
succeeded = sendBeacon(url, body_data);
|
|
12615
|
-
} catch (
|
|
12616
|
-
lib.report_error(
|
|
12541
|
+
} catch (e3) {
|
|
12542
|
+
lib.report_error(e3);
|
|
12617
12543
|
succeeded = false;
|
|
12618
12544
|
}
|
|
12619
12545
|
try {
|
|
12620
12546
|
if (callback) {
|
|
12621
12547
|
callback(succeeded ? 1 : 0);
|
|
12622
12548
|
}
|
|
12623
|
-
} catch (
|
|
12624
|
-
lib.report_error(
|
|
12549
|
+
} catch (e3) {
|
|
12550
|
+
lib.report_error(e3);
|
|
12625
12551
|
}
|
|
12626
12552
|
} else if (USE_XHR) {
|
|
12627
12553
|
try {
|
|
@@ -12647,8 +12573,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12647
12573
|
var response;
|
|
12648
12574
|
try {
|
|
12649
12575
|
response = _.JSONDecode(req.responseText);
|
|
12650
|
-
} catch (
|
|
12651
|
-
lib.report_error(
|
|
12576
|
+
} catch (e3) {
|
|
12577
|
+
lib.report_error(e3);
|
|
12652
12578
|
if (options.ignore_json_errors) {
|
|
12653
12579
|
response = req.responseText;
|
|
12654
12580
|
} else {
|
|
@@ -12680,8 +12606,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12680
12606
|
}
|
|
12681
12607
|
};
|
|
12682
12608
|
req.send(body_data);
|
|
12683
|
-
} catch (
|
|
12684
|
-
lib.report_error(
|
|
12609
|
+
} catch (e3) {
|
|
12610
|
+
lib.report_error(e3);
|
|
12685
12611
|
succeeded = false;
|
|
12686
12612
|
}
|
|
12687
12613
|
} else {
|
|
@@ -13375,7 +13301,7 @@ var add_dom_loaded_handler = function() {
|
|
|
13375
13301
|
function do_scroll_check() {
|
|
13376
13302
|
try {
|
|
13377
13303
|
document$1.documentElement.doScroll("left");
|
|
13378
|
-
} catch (
|
|
13304
|
+
} catch (e3) {
|
|
13379
13305
|
setTimeout(do_scroll_check, 1);
|
|
13380
13306
|
return;
|
|
13381
13307
|
}
|
|
@@ -13392,7 +13318,7 @@ var add_dom_loaded_handler = function() {
|
|
|
13392
13318
|
var toplevel = false;
|
|
13393
13319
|
try {
|
|
13394
13320
|
toplevel = win.frameElement === null;
|
|
13395
|
-
} catch (
|
|
13321
|
+
} catch (e3) {
|
|
13396
13322
|
}
|
|
13397
13323
|
if (document$1.documentElement.doScroll && toplevel) {
|
|
13398
13324
|
do_scroll_check();
|
|
@@ -13413,10 +13339,99 @@ function loadNoop(_src, onload) {
|
|
|
13413
13339
|
onload();
|
|
13414
13340
|
}
|
|
13415
13341
|
var mixpanel = init_as_module(loadNoop);
|
|
13416
|
-
|
|
13342
|
+
function createIdentifyReporter() {
|
|
13343
|
+
const reported = /* @__PURE__ */ new Set();
|
|
13344
|
+
return (stage, reason, httpStatus) => {
|
|
13345
|
+
const key = `${stage}:${reason}`;
|
|
13346
|
+
if (reported.has(key)) return;
|
|
13347
|
+
reported.add(key);
|
|
13348
|
+
const payload = {
|
|
13349
|
+
stage,
|
|
13350
|
+
reason,
|
|
13351
|
+
...httpStatus !== void 0 ? { httpStatus } : {}
|
|
13352
|
+
};
|
|
13353
|
+
try {
|
|
13354
|
+
if (mixpanelService.isReady()) {
|
|
13355
|
+
trackEventError(
|
|
13356
|
+
"Identify",
|
|
13357
|
+
new Error(`Identify ${stage}: ${reason}`),
|
|
13358
|
+
payload
|
|
13359
|
+
);
|
|
13360
|
+
} else {
|
|
13361
|
+
console.error("Identify diagnostic", payload);
|
|
13362
|
+
}
|
|
13363
|
+
} catch {
|
|
13364
|
+
console.error("Identify diagnostic", payload);
|
|
13365
|
+
}
|
|
13366
|
+
};
|
|
13367
|
+
}
|
|
13368
|
+
function waitForIdentifyReady(report) {
|
|
13369
|
+
if (mixpanelService.isReady()) return Promise.resolve(true);
|
|
13370
|
+
return new Promise((resolve) => {
|
|
13371
|
+
let active = true;
|
|
13372
|
+
const finish = (ready) => {
|
|
13373
|
+
if (!active) return;
|
|
13374
|
+
active = false;
|
|
13375
|
+
clearTimeout(timer);
|
|
13376
|
+
window.removeEventListener("Tracker Ready", onReady);
|
|
13377
|
+
if (!ready) report("readiness", "timeout");
|
|
13378
|
+
resolve(ready);
|
|
13379
|
+
};
|
|
13380
|
+
const onReady = () => {
|
|
13381
|
+
if (mixpanelService.isReady()) finish(true);
|
|
13382
|
+
};
|
|
13383
|
+
const timer = setTimeout(() => finish(false), 5e3);
|
|
13384
|
+
window.addEventListener("Tracker Ready", onReady);
|
|
13385
|
+
onReady();
|
|
13386
|
+
});
|
|
13387
|
+
}
|
|
13388
|
+
function waitForIdentifyStage(stage, timeout, run, report) {
|
|
13389
|
+
return new Promise((resolve) => {
|
|
13390
|
+
let active = true;
|
|
13391
|
+
const finish = (value) => {
|
|
13392
|
+
if (!active) return;
|
|
13393
|
+
active = false;
|
|
13394
|
+
clearTimeout(timer);
|
|
13395
|
+
resolve(value);
|
|
13396
|
+
};
|
|
13397
|
+
const timer = setTimeout(() => {
|
|
13398
|
+
report(stage, "timeout");
|
|
13399
|
+
finish();
|
|
13400
|
+
}, timeout);
|
|
13401
|
+
const context = {
|
|
13402
|
+
isActive: () => active,
|
|
13403
|
+
report: (...args) => {
|
|
13404
|
+
if (active) report(...args);
|
|
13405
|
+
}
|
|
13406
|
+
};
|
|
13407
|
+
void Promise.resolve().then(() => run(context)).then(
|
|
13408
|
+
(value) => finish(value),
|
|
13409
|
+
() => {
|
|
13410
|
+
if (active) report(stage, "failed");
|
|
13411
|
+
finish();
|
|
13412
|
+
}
|
|
13413
|
+
);
|
|
13414
|
+
});
|
|
13415
|
+
}
|
|
13416
|
+
function observeIdentifyResult(stage, report, onTimeout) {
|
|
13417
|
+
let active = true;
|
|
13418
|
+
const complete = (reason, httpStatus) => {
|
|
13419
|
+
if (!active) return;
|
|
13420
|
+
active = false;
|
|
13421
|
+
clearTimeout(timer);
|
|
13422
|
+
if (reason) report(stage, reason, httpStatus);
|
|
13423
|
+
};
|
|
13424
|
+
const timer = setTimeout(() => {
|
|
13425
|
+
complete(stage === "people" ? "unobserved" : "timeout");
|
|
13426
|
+
onTimeout == null ? void 0 : onTimeout();
|
|
13427
|
+
}, 5e3);
|
|
13428
|
+
return { complete };
|
|
13429
|
+
}
|
|
13430
|
+
const version = "1.1.7";
|
|
13417
13431
|
const MIXPANEL_DISTINCT_ID_CACHE_KEY = "mp_distinct_id";
|
|
13418
|
-
const
|
|
13419
|
-
"Event Source": "sdk"
|
|
13432
|
+
const SDK_SUPER_PROPERTIES = {
|
|
13433
|
+
"Event Source": "sdk",
|
|
13434
|
+
"Reservamos Version": version
|
|
13420
13435
|
};
|
|
13421
13436
|
function init$2(mixpanelToken, debug = false, proxyUrl) {
|
|
13422
13437
|
return new Promise((resolve) => {
|
|
@@ -13424,17 +13439,35 @@ function init$2(mixpanelToken, debug = false, proxyUrl) {
|
|
|
13424
13439
|
debug,
|
|
13425
13440
|
loaded: () => {
|
|
13426
13441
|
window.mixpanel = mixpanel;
|
|
13427
|
-
mixpanel.register({ ...
|
|
13442
|
+
mixpanel.register({ ...SDK_SUPER_PROPERTIES });
|
|
13428
13443
|
resolve();
|
|
13429
13444
|
},
|
|
13430
13445
|
...proxyUrl && { api_host: proxyUrl }
|
|
13431
13446
|
});
|
|
13432
13447
|
});
|
|
13433
13448
|
}
|
|
13434
|
-
function identify$1(userId, properties) {
|
|
13449
|
+
function identify$1(userId, properties, report) {
|
|
13435
13450
|
mixpanel.identify(userId);
|
|
13436
|
-
|
|
13437
|
-
|
|
13451
|
+
try {
|
|
13452
|
+
updateCachedDistinctId(userId);
|
|
13453
|
+
} catch {
|
|
13454
|
+
report == null ? void 0 : report("cache", "unavailable");
|
|
13455
|
+
}
|
|
13456
|
+
if (!report) {
|
|
13457
|
+
mixpanel.people.set(properties);
|
|
13458
|
+
return;
|
|
13459
|
+
}
|
|
13460
|
+
const observer = observeIdentifyResult("people", report);
|
|
13461
|
+
try {
|
|
13462
|
+
mixpanel.people.set(properties, (response) => {
|
|
13463
|
+
const status = typeof response === "number" ? response : response == null ? void 0 : response.status;
|
|
13464
|
+
observer.complete(
|
|
13465
|
+
status === 1 ? void 0 : status === 0 ? "failed" : "unconfirmed"
|
|
13466
|
+
);
|
|
13467
|
+
});
|
|
13468
|
+
} catch {
|
|
13469
|
+
observer.complete("failed");
|
|
13470
|
+
}
|
|
13438
13471
|
}
|
|
13439
13472
|
function attachProperty(key, value) {
|
|
13440
13473
|
if (!isReady()) {
|
|
@@ -13480,6 +13513,195 @@ const mixpanelService = {
|
|
|
13480
13513
|
setPeopleProperties,
|
|
13481
13514
|
getMixpanelDistinctId
|
|
13482
13515
|
};
|
|
13516
|
+
const DEFAULT_CACHE_NAME = "default_fingerprint_cache";
|
|
13517
|
+
const DEFAULT_CACHE_TIME_IN_DAYS = 7;
|
|
13518
|
+
const PROXY_QUERY_PARAM = "apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>";
|
|
13519
|
+
let fingerprintAgentReady = false;
|
|
13520
|
+
const getExpirationDate = (cacheTimeInDays) => {
|
|
13521
|
+
const currentDate = /* @__PURE__ */ new Date();
|
|
13522
|
+
const futureDate = new Date(
|
|
13523
|
+
currentDate.getTime() + cacheTimeInDays * 24 * 60 * 60 * 1e3
|
|
13524
|
+
);
|
|
13525
|
+
return futureDate.getTime();
|
|
13526
|
+
};
|
|
13527
|
+
const getCachedFingerprint = () => {
|
|
13528
|
+
return readCachedFingerprint();
|
|
13529
|
+
};
|
|
13530
|
+
function readCachedFingerprint(context) {
|
|
13531
|
+
const { cacheName = DEFAULT_CACHE_NAME } = window.fingerprintConfig;
|
|
13532
|
+
try {
|
|
13533
|
+
const cachedData = JSON.parse(localStorage.getItem(cacheName) || "null");
|
|
13534
|
+
if (cachedData && cachedData.expiresAt > Date.now()) {
|
|
13535
|
+
return cachedData.fingerprint;
|
|
13536
|
+
}
|
|
13537
|
+
localStorage.removeItem(cacheName);
|
|
13538
|
+
return null;
|
|
13539
|
+
} catch {
|
|
13540
|
+
context == null ? void 0 : context.report("cache", "unavailable");
|
|
13541
|
+
return null;
|
|
13542
|
+
}
|
|
13543
|
+
}
|
|
13544
|
+
const setCachedFingerprint = (fingerprint) => {
|
|
13545
|
+
const {
|
|
13546
|
+
cacheName = DEFAULT_CACHE_NAME,
|
|
13547
|
+
cacheTimeInDays = DEFAULT_CACHE_TIME_IN_DAYS
|
|
13548
|
+
} = window.fingerprintConfig;
|
|
13549
|
+
const cacheData = {
|
|
13550
|
+
fingerprint,
|
|
13551
|
+
expiresAt: getExpirationDate(cacheTimeInDays)
|
|
13552
|
+
};
|
|
13553
|
+
localStorage.setItem(cacheName, JSON.stringify(cacheData));
|
|
13554
|
+
};
|
|
13555
|
+
function buildProxyUrl(url) {
|
|
13556
|
+
return `${url}?${PROXY_QUERY_PARAM}`;
|
|
13557
|
+
}
|
|
13558
|
+
async function initFingerprint(apiKey, proxyUrl) {
|
|
13559
|
+
const customEndpointArray = [r];
|
|
13560
|
+
const customScriptEndpointArray = [G];
|
|
13561
|
+
if (proxyUrl) {
|
|
13562
|
+
customEndpointArray.unshift(proxyUrl);
|
|
13563
|
+
customScriptEndpointArray.unshift(buildProxyUrl(proxyUrl));
|
|
13564
|
+
}
|
|
13565
|
+
fingerprintAgentReady = false;
|
|
13566
|
+
window.fingerprintConfig = {};
|
|
13567
|
+
const client = new FpjsClient({
|
|
13568
|
+
loadOptions: {
|
|
13569
|
+
apiKey,
|
|
13570
|
+
endpoint: customEndpointArray,
|
|
13571
|
+
scriptUrlPattern: customScriptEndpointArray
|
|
13572
|
+
}
|
|
13573
|
+
});
|
|
13574
|
+
window.fpClient = client;
|
|
13575
|
+
try {
|
|
13576
|
+
await client.init();
|
|
13577
|
+
if (window.fpClient === client) {
|
|
13578
|
+
fingerprintAgentReady = true;
|
|
13579
|
+
}
|
|
13580
|
+
} catch (error) {
|
|
13581
|
+
if (window.fpClient === client) {
|
|
13582
|
+
fingerprintAgentReady = false;
|
|
13583
|
+
}
|
|
13584
|
+
console.error("Error initializing identification service:", error);
|
|
13585
|
+
throw error;
|
|
13586
|
+
}
|
|
13587
|
+
}
|
|
13588
|
+
async function getFingerprint(cacheOnly = false) {
|
|
13589
|
+
return readFingerprint(cacheOnly);
|
|
13590
|
+
}
|
|
13591
|
+
function getFingerprintForIdentify(context) {
|
|
13592
|
+
return readFingerprint(false, context);
|
|
13593
|
+
}
|
|
13594
|
+
async function readFingerprint(cacheOnly, context) {
|
|
13595
|
+
if (!window.fingerprintConfig) {
|
|
13596
|
+
if (cacheOnly) {
|
|
13597
|
+
return "";
|
|
13598
|
+
}
|
|
13599
|
+
throw new Error("Fingerprint configuration is not initialized.");
|
|
13600
|
+
}
|
|
13601
|
+
const cachedFingerprint = readCachedFingerprint(context);
|
|
13602
|
+
if (cachedFingerprint) {
|
|
13603
|
+
return cachedFingerprint;
|
|
13604
|
+
}
|
|
13605
|
+
if (cacheOnly || !isFingerprintReady()) {
|
|
13606
|
+
return "";
|
|
13607
|
+
}
|
|
13608
|
+
const { visitorId } = await requestIdentification(false, context);
|
|
13609
|
+
return visitorId;
|
|
13610
|
+
}
|
|
13611
|
+
async function identifyVisitor(ignoreCache = false) {
|
|
13612
|
+
return requestIdentification(ignoreCache);
|
|
13613
|
+
}
|
|
13614
|
+
async function requestIdentification(ignoreCache, context) {
|
|
13615
|
+
if (!isFingerprintReady()) {
|
|
13616
|
+
throw new Error("Identification service is not initialized.");
|
|
13617
|
+
}
|
|
13618
|
+
try {
|
|
13619
|
+
const result = await window.fpClient.getVisitorData({}, ignoreCache);
|
|
13620
|
+
if (!context || context.isActive()) {
|
|
13621
|
+
try {
|
|
13622
|
+
setCachedFingerprint(result.visitorId);
|
|
13623
|
+
} catch (error) {
|
|
13624
|
+
if (!context) throw error;
|
|
13625
|
+
context.report("cache", "unavailable");
|
|
13626
|
+
}
|
|
13627
|
+
if (typeof result.visitorFound === "boolean") {
|
|
13628
|
+
try {
|
|
13629
|
+
mixpanelService.setPeopleProperties({
|
|
13630
|
+
"Visitor Found": result.visitorFound
|
|
13631
|
+
});
|
|
13632
|
+
} catch (error) {
|
|
13633
|
+
if (context) context.report("fingerprint", "failed");
|
|
13634
|
+
else console.error("Error updating Mixpanel visitor profile:", error);
|
|
13635
|
+
}
|
|
13636
|
+
}
|
|
13637
|
+
}
|
|
13638
|
+
return {
|
|
13639
|
+
visitorId: result.visitorId,
|
|
13640
|
+
requestId: result.requestId,
|
|
13641
|
+
...typeof result.visitorFound === "boolean" ? { visitorFound: result.visitorFound } : {},
|
|
13642
|
+
confidenceScore: result.confidence.score,
|
|
13643
|
+
cacheHit: result.cacheHit
|
|
13644
|
+
};
|
|
13645
|
+
} catch (error) {
|
|
13646
|
+
if (!context) console.error("Error retrieving fingerprint:", error);
|
|
13647
|
+
throw error;
|
|
13648
|
+
}
|
|
13649
|
+
}
|
|
13650
|
+
function isFingerprintReady() {
|
|
13651
|
+
return window.fpClient !== void 0 && fingerprintAgentReady;
|
|
13652
|
+
}
|
|
13653
|
+
const fingerprintService = {
|
|
13654
|
+
initFingerprint,
|
|
13655
|
+
getFingerprint,
|
|
13656
|
+
identifyVisitor,
|
|
13657
|
+
isFingerprintReady,
|
|
13658
|
+
getCachedFingerprint
|
|
13659
|
+
};
|
|
13660
|
+
let environment;
|
|
13661
|
+
let appName;
|
|
13662
|
+
const origin = window.location.origin;
|
|
13663
|
+
const coreAPIConfig = {
|
|
13664
|
+
sandbox: {
|
|
13665
|
+
baseUrl: "https://datalake-api-dev.reservamossaas.com/api",
|
|
13666
|
+
defaultHeaders: {
|
|
13667
|
+
Origin: origin,
|
|
13668
|
+
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
13669
|
+
}
|
|
13670
|
+
},
|
|
13671
|
+
prod: {
|
|
13672
|
+
baseUrl: "https://data-lake.reservamossaas.com/api",
|
|
13673
|
+
defaultHeaders: {
|
|
13674
|
+
Origin: origin,
|
|
13675
|
+
Authorization: "Bearer 753bf0710dc920a84236d42241d4f487"
|
|
13676
|
+
}
|
|
13677
|
+
}
|
|
13678
|
+
};
|
|
13679
|
+
function setEnvironment(env) {
|
|
13680
|
+
environment = env;
|
|
13681
|
+
}
|
|
13682
|
+
function setAppName(name) {
|
|
13683
|
+
appName = name;
|
|
13684
|
+
}
|
|
13685
|
+
function getCoreAPIConfig() {
|
|
13686
|
+
if (!environment) {
|
|
13687
|
+
throw new Error(
|
|
13688
|
+
"Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment."
|
|
13689
|
+
);
|
|
13690
|
+
}
|
|
13691
|
+
const config = coreAPIConfig[environment];
|
|
13692
|
+
return {
|
|
13693
|
+
...config,
|
|
13694
|
+
defaultHeaders: {
|
|
13695
|
+
...config.defaultHeaders,
|
|
13696
|
+
...appName ? { "x-app-name": appName } : {}
|
|
13697
|
+
}
|
|
13698
|
+
};
|
|
13699
|
+
}
|
|
13700
|
+
const configService = {
|
|
13701
|
+
setEnvironment,
|
|
13702
|
+
setAppName,
|
|
13703
|
+
getCoreAPIConfig
|
|
13704
|
+
};
|
|
13483
13705
|
const geolocationSelectedSchema = z.object({
|
|
13484
13706
|
"Selected City": z.string().min(1, "Selected city is required"),
|
|
13485
13707
|
"Selected Country Code": z.string().min(1, "Selected Country Code is required")
|
|
@@ -13880,7 +14102,7 @@ async function init$1(config) {
|
|
|
13880
14102
|
if (appName2) {
|
|
13881
14103
|
configService.setAppName(appName2);
|
|
13882
14104
|
}
|
|
13883
|
-
|
|
14105
|
+
a$1.setConfig(configService.getCoreAPIConfig());
|
|
13884
14106
|
onLoaded();
|
|
13885
14107
|
}
|
|
13886
14108
|
function isTrackerReady() {
|
|
@@ -14152,9 +14374,18 @@ async function trackEvent(eventName, eventProperties, meta = {}) {
|
|
|
14152
14374
|
}
|
|
14153
14375
|
try {
|
|
14154
14376
|
validatorService.parseEventProps(eventName, eventProperties);
|
|
14155
|
-
const
|
|
14156
|
-
|
|
14157
|
-
|
|
14377
|
+
const distinctId = mixpanelService.getMixpanelDistinctId();
|
|
14378
|
+
const botDetectionEnabled = botDetectionRelayService.isEnabledFor(eventName);
|
|
14379
|
+
let fingerprint;
|
|
14380
|
+
let fingerprintRequestId;
|
|
14381
|
+
if (botDetectionEnabled && fingerprintService.isFingerprintReady()) {
|
|
14382
|
+
const identification = await fingerprintService.identifyVisitor(true);
|
|
14383
|
+
fingerprint = identification.visitorId;
|
|
14384
|
+
fingerprintRequestId = identification.requestId;
|
|
14385
|
+
} else {
|
|
14386
|
+
const cacheOnly = !FP_TRIGGER_EVENTS.includes(eventName);
|
|
14387
|
+
fingerprint = await fingerprintService.getFingerprint(cacheOnly);
|
|
14388
|
+
}
|
|
14158
14389
|
const defaultCoordinates = {};
|
|
14159
14390
|
const coordinates = geolocationService.getCoordinates();
|
|
14160
14391
|
const geolocationSource = geolocationService.getGeolocationSource();
|
|
@@ -14178,6 +14409,14 @@ async function trackEvent(eventName, eventProperties, meta = {}) {
|
|
|
14178
14409
|
...meta
|
|
14179
14410
|
};
|
|
14180
14411
|
mixpanelService.track(eventName, properties);
|
|
14412
|
+
if (fingerprintRequestId) {
|
|
14413
|
+
void botDetectionRelayService.relay({
|
|
14414
|
+
requestId: fingerprintRequestId,
|
|
14415
|
+
visitorId: fingerprint,
|
|
14416
|
+
...distinctId && { distinctId },
|
|
14417
|
+
eventName
|
|
14418
|
+
});
|
|
14419
|
+
}
|
|
14181
14420
|
} catch (error) {
|
|
14182
14421
|
console.error(`Error tracking event '${eventName}':`, error);
|
|
14183
14422
|
trackEventError(eventName, error, eventProperties);
|
|
@@ -14266,20 +14505,37 @@ function getAnonymousProfilePayload(values, identifiersProps) {
|
|
|
14266
14505
|
}
|
|
14267
14506
|
async function createAnonymousProfile(payload) {
|
|
14268
14507
|
try {
|
|
14269
|
-
|
|
14270
|
-
const identifiers = [];
|
|
14271
|
-
const userFingerprintId = fingerprintService.getCachedFingerprint();
|
|
14272
|
-
const distinctId = mixpanelService.getMixpanelDistinctId();
|
|
14273
|
-
if (userFingerprintId)
|
|
14274
|
-
identifiers.push({ key: "fingerprint", value: userFingerprintId });
|
|
14275
|
-
if (distinctId) identifiers.push({ key: "distinct_id", value: distinctId });
|
|
14276
|
-
const dataPayload = getAnonymousProfilePayload(payload, identifiers);
|
|
14277
|
-
return await f.profiles.createAnonymousProfile(dataPayload);
|
|
14508
|
+
return await requestAnonymousProfile(payload);
|
|
14278
14509
|
} catch (error) {
|
|
14279
14510
|
console.error("Could not create anonymous profile:", error);
|
|
14280
14511
|
return void 0;
|
|
14281
14512
|
}
|
|
14282
14513
|
}
|
|
14514
|
+
function createAnonymousProfileForIdentify(payload, report) {
|
|
14515
|
+
return requestAnonymousProfile(payload, report);
|
|
14516
|
+
}
|
|
14517
|
+
async function requestAnonymousProfile(payload, report) {
|
|
14518
|
+
validatorService.validateProps(payload, CreateAnonymousProfileSchema);
|
|
14519
|
+
const identifiers = [];
|
|
14520
|
+
const readIdentifier = (read) => {
|
|
14521
|
+
if (!report) return read();
|
|
14522
|
+
try {
|
|
14523
|
+
return read();
|
|
14524
|
+
} catch {
|
|
14525
|
+
report("cache", "unavailable");
|
|
14526
|
+
return null;
|
|
14527
|
+
}
|
|
14528
|
+
};
|
|
14529
|
+
const userFingerprintId = readIdentifier(
|
|
14530
|
+
fingerprintService.getCachedFingerprint
|
|
14531
|
+
);
|
|
14532
|
+
const distinctId = readIdentifier(mixpanelService.getMixpanelDistinctId);
|
|
14533
|
+
if (userFingerprintId)
|
|
14534
|
+
identifiers.push({ key: "fingerprint", value: userFingerprintId });
|
|
14535
|
+
if (distinctId) identifiers.push({ key: "distinct_id", value: distinctId });
|
|
14536
|
+
const dataPayload = getAnonymousProfilePayload(payload, identifiers);
|
|
14537
|
+
return await a$1.profiles.createAnonymousProfile(dataPayload);
|
|
14538
|
+
}
|
|
14283
14539
|
const KNOWN_PROPERTIES = ["firstName", "lastName", "email", "phone"];
|
|
14284
14540
|
const FINGERPRINT_PROPERTY = "Known Fingerprints";
|
|
14285
14541
|
function mapProperties(properties) {
|
|
@@ -14300,8 +14556,9 @@ function mapProperties(properties) {
|
|
|
14300
14556
|
);
|
|
14301
14557
|
return { ...parsedProperties, ...additionalProperties };
|
|
14302
14558
|
}
|
|
14303
|
-
const identifyWithLocation = async (userId, properties) => {
|
|
14559
|
+
const identifyWithLocation = async (userId, properties, report) => {
|
|
14304
14560
|
var _a, _b, _c;
|
|
14561
|
+
let observer;
|
|
14305
14562
|
try {
|
|
14306
14563
|
const coordinates = geolocationService.getCoordinates();
|
|
14307
14564
|
if (!coordinates) {
|
|
@@ -14316,50 +14573,87 @@ const identifyWithLocation = async (userId, properties) => {
|
|
|
14316
14573
|
delete properties.firstName;
|
|
14317
14574
|
delete properties.lastName;
|
|
14318
14575
|
const coreApiConfig = configService.getCoreAPIConfig();
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14326
|
-
}
|
|
14327
|
-
|
|
14328
|
-
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14332
|
-
|
|
14333
|
-
|
|
14334
|
-
|
|
14335
|
-
|
|
14576
|
+
const controller = new AbortController();
|
|
14577
|
+
observer = observeIdentifyResult(
|
|
14578
|
+
"datalake",
|
|
14579
|
+
report,
|
|
14580
|
+
() => controller.abort()
|
|
14581
|
+
);
|
|
14582
|
+
const response = await fetch(
|
|
14583
|
+
`${coreApiConfig.baseUrl}/v1/datalake/identify`,
|
|
14584
|
+
{
|
|
14585
|
+
method: "POST",
|
|
14586
|
+
signal: controller.signal,
|
|
14587
|
+
headers: {
|
|
14588
|
+
"Content-Type": "application/json",
|
|
14589
|
+
"Authorization": ((_a = coreApiConfig.defaultHeaders) == null ? void 0 : _a.Authorization) || "",
|
|
14590
|
+
"Origin": ((_b = coreApiConfig.defaultHeaders) == null ? void 0 : _b.Origin) || "",
|
|
14591
|
+
...((_c = coreApiConfig.defaultHeaders) == null ? void 0 : _c["x-app-name"]) ? { "x-app-name": coreApiConfig.defaultHeaders["x-app-name"] } : {}
|
|
14592
|
+
},
|
|
14593
|
+
body: JSON.stringify({
|
|
14594
|
+
profile_params: {
|
|
14595
|
+
...properties,
|
|
14596
|
+
distinct_id: userId
|
|
14597
|
+
}
|
|
14598
|
+
})
|
|
14599
|
+
}
|
|
14600
|
+
);
|
|
14601
|
+
observer.complete(
|
|
14602
|
+
response.ok ? void 0 : "http_error",
|
|
14603
|
+
response.ok ? void 0 : response.status
|
|
14604
|
+
);
|
|
14605
|
+
} catch {
|
|
14606
|
+
if (observer) observer.complete("failed");
|
|
14607
|
+
else report("datalake", "failed");
|
|
14336
14608
|
}
|
|
14337
14609
|
};
|
|
14338
14610
|
async function identify(userId, properties = {}) {
|
|
14339
|
-
|
|
14611
|
+
const report = createIdentifyReporter();
|
|
14612
|
+
if (!await waitForIdentifyReady(report)) return;
|
|
14613
|
+
try {
|
|
14340
14614
|
try {
|
|
14341
14615
|
validatorService.parseIdentifyProps(properties);
|
|
14342
14616
|
if (!userId) {
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
}
|
|
14346
|
-
const anonymousProfile = await createAnonymousProfile(properties);
|
|
14347
|
-
if (anonymousProfile) {
|
|
14348
|
-
properties.reservamos_one_id = anonymousProfile.id;
|
|
14617
|
+
report("validation", "invalid_input");
|
|
14618
|
+
return;
|
|
14349
14619
|
}
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14620
|
+
} catch {
|
|
14621
|
+
report("validation", "invalid_input");
|
|
14622
|
+
return;
|
|
14623
|
+
}
|
|
14624
|
+
const anonymousProfile = await waitForIdentifyStage(
|
|
14625
|
+
"profile",
|
|
14626
|
+
3e3,
|
|
14627
|
+
(context) => createAnonymousProfileForIdentify({ ...properties }, context.report),
|
|
14628
|
+
report
|
|
14629
|
+
);
|
|
14630
|
+
if (anonymousProfile) {
|
|
14631
|
+
properties.reservamos_one_id = anonymousProfile.id;
|
|
14632
|
+
}
|
|
14633
|
+
const mappedProps = mapProperties(properties);
|
|
14634
|
+
try {
|
|
14635
|
+
mixpanelService.identify(userId, mappedProps, report);
|
|
14636
|
+
} catch {
|
|
14637
|
+
report("mixpanel", "failed");
|
|
14638
|
+
}
|
|
14639
|
+
const fingerprint = await waitForIdentifyStage(
|
|
14640
|
+
"fingerprint",
|
|
14641
|
+
2e3,
|
|
14642
|
+
getFingerprintForIdentify,
|
|
14643
|
+
report
|
|
14644
|
+
);
|
|
14645
|
+
if (fingerprint) {
|
|
14646
|
+
try {
|
|
14354
14647
|
mixpanelService.attachProperty(FINGERPRINT_PROPERTY, fingerprint);
|
|
14648
|
+
} catch {
|
|
14649
|
+
report("fingerprint", "failed");
|
|
14355
14650
|
}
|
|
14356
|
-
} catch (error) {
|
|
14357
|
-
console.error("Error identifying user", error);
|
|
14358
|
-
trackEventError("Identify", error, { userId, properties });
|
|
14359
|
-
} finally {
|
|
14360
|
-
identifyWithLocation(userId, properties);
|
|
14361
14651
|
}
|
|
14362
|
-
}
|
|
14652
|
+
} catch {
|
|
14653
|
+
report("mixpanel", "failed");
|
|
14654
|
+
} finally {
|
|
14655
|
+
void identifyWithLocation(userId, properties, report);
|
|
14656
|
+
}
|
|
14363
14657
|
}
|
|
14364
14658
|
z.object({
|
|
14365
14659
|
"Operation Id": stringField("Operation Id"),
|
|
@@ -14395,7 +14689,7 @@ async function createFrequentPassengers(payload) {
|
|
|
14395
14689
|
if (!distinctId) {
|
|
14396
14690
|
throw new Error("No distinct ID found");
|
|
14397
14691
|
}
|
|
14398
|
-
return await
|
|
14692
|
+
return await a$1.recommendations.createFrequentPassengers({
|
|
14399
14693
|
...payload,
|
|
14400
14694
|
distinct_id: distinctId,
|
|
14401
14695
|
device_fingerprint: userFingerprintId || ""
|
|
@@ -14426,7 +14720,7 @@ async function createRecommendedSeats$1(payload) {
|
|
|
14426
14720
|
if (!distinctId) {
|
|
14427
14721
|
throw new Error("No distinct ID found");
|
|
14428
14722
|
}
|
|
14429
|
-
return await
|
|
14723
|
+
return await a$1.recommendations.createRecommendedSeats({
|
|
14430
14724
|
...payload,
|
|
14431
14725
|
distinct_id: distinctId,
|
|
14432
14726
|
device_fingerprint: userFingerprintId || ""
|
|
@@ -14448,7 +14742,7 @@ async function deleteFrequentPassengers(payload) {
|
|
|
14448
14742
|
if (!distinctId) {
|
|
14449
14743
|
throw new Error("No distinct ID found");
|
|
14450
14744
|
}
|
|
14451
|
-
return await
|
|
14745
|
+
return await a$1.recommendations.deleteFrequentPassenger(
|
|
14452
14746
|
distinctId,
|
|
14453
14747
|
payload.passengerId
|
|
14454
14748
|
);
|
|
@@ -14462,7 +14756,7 @@ async function getFrequentPassengers() {
|
|
|
14462
14756
|
if (!distinctId) {
|
|
14463
14757
|
throw new Error("No distinct ID found");
|
|
14464
14758
|
}
|
|
14465
|
-
return await
|
|
14759
|
+
return await a$1.recommendations.getFrequentPassengers(distinctId);
|
|
14466
14760
|
} catch (error) {
|
|
14467
14761
|
throw new Error(error instanceof Error ? error.message : String(error));
|
|
14468
14762
|
}
|
|
@@ -14474,7 +14768,7 @@ const pollingRecommendedPlaces = async (response) => {
|
|
|
14474
14768
|
resolve(response);
|
|
14475
14769
|
return;
|
|
14476
14770
|
}
|
|
14477
|
-
|
|
14771
|
+
a$1.recommendations.pollRecommendedPlaces(polling_id, {
|
|
14478
14772
|
start: true,
|
|
14479
14773
|
watch: "state",
|
|
14480
14774
|
expect: "finished",
|
|
@@ -14496,7 +14790,7 @@ async function getRecommendedPlaces() {
|
|
|
14496
14790
|
if (!distinctId) {
|
|
14497
14791
|
throw new Error("No distinct ID found");
|
|
14498
14792
|
}
|
|
14499
|
-
const response = await
|
|
14793
|
+
const response = await a$1.recommendations.createRecommendedPlaces({
|
|
14500
14794
|
distinct_id: distinctId
|
|
14501
14795
|
});
|
|
14502
14796
|
if (!response) {
|
|
@@ -14525,7 +14819,7 @@ async function createRecommendedSeats(payload) {
|
|
|
14525
14819
|
if (!distinctId) {
|
|
14526
14820
|
throw new Error("No distinct ID found");
|
|
14527
14821
|
}
|
|
14528
|
-
return await
|
|
14822
|
+
return await a$1.recommendations.getRecommendedSeats({
|
|
14529
14823
|
...payload,
|
|
14530
14824
|
distinct_id: distinctId
|
|
14531
14825
|
});
|
|
@@ -14544,7 +14838,7 @@ async function getRecommendedTrips({
|
|
|
14544
14838
|
validatorService.validateProps({ searchId }, GetRecommendedTripsSchema);
|
|
14545
14839
|
const identifier = fingerprintService.getCachedFingerprint() || mixpanelService.getMixpanelDistinctId();
|
|
14546
14840
|
if (!identifier) throw new Error("No identifier id");
|
|
14547
|
-
const response = await
|
|
14841
|
+
const response = await a$1.recommendations.getRecommendedTrips({
|
|
14548
14842
|
searchId,
|
|
14549
14843
|
userIdentifier: String(identifier)
|
|
14550
14844
|
});
|