@reservamos/browser-analytics 1.0.14 → 1.0.22-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/browser-analytics.cjs +3 -3
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.d.ts +13 -0
- package/dist/browser-analytics.esm.js +536 -431
- 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 +2 -2
- package/src/events/geolocationSelected/geolocationSelectedSchema.ts +13 -0
- package/src/events/geolocationSelected/index.ts +7 -0
- package/src/events/geolocationSelected/trackGeolocationSelected.ts +21 -0
- package/src/index.ts +4 -0
- package/src/init.ts +2 -2
- package/src/services/fingerprint.ts +4 -0
- package/src/services/geolocation.test.ts +261 -0
- package/src/services/geolocation.ts +270 -24
- package/src/services/mixpanel.ts +13 -0
- package/src/services/validator/validator.ts +2 -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(e2) {
|
|
28
|
+
return obj[e2];
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
|
|
@@ -387,7 +387,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
387
387
|
overrideMap,
|
|
388
388
|
overrideMap === errorMap ? void 0 : errorMap
|
|
389
389
|
// then global default map
|
|
390
|
-
].filter((
|
|
390
|
+
].filter((x2) => !!x2)
|
|
391
391
|
});
|
|
392
392
|
ctx.common.issues.push(issue);
|
|
393
393
|
}
|
|
@@ -450,10 +450,10 @@ const INVALID = Object.freeze({
|
|
|
450
450
|
});
|
|
451
451
|
const DIRTY = (value) => ({ status: "dirty", value });
|
|
452
452
|
const OK = (value) => ({ status: "valid", value });
|
|
453
|
-
const isAborted = (
|
|
454
|
-
const isDirty = (
|
|
455
|
-
const isValid = (
|
|
456
|
-
const isAsync = (
|
|
453
|
+
const isAborted = (x2) => x2.status === "aborted";
|
|
454
|
+
const isDirty = (x2) => x2.status === "dirty";
|
|
455
|
+
const isValid = (x2) => x2.status === "valid";
|
|
456
|
+
const isAsync = (x2) => typeof Promise !== "undefined" && x2 instanceof Promise;
|
|
457
457
|
function __classPrivateFieldGet(receiver, state, kind, f2) {
|
|
458
458
|
if (typeof state === "function" ? receiver !== state || !f2 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
459
459
|
return state.get(receiver);
|
|
@@ -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 e2 = new Error(message);
|
|
467
|
+
return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
|
|
468
468
|
};
|
|
469
469
|
var errorUtil;
|
|
470
470
|
(function(errorUtil2) {
|
|
@@ -2783,7 +2783,7 @@ class ZodTuple extends ZodType {
|
|
|
2783
2783
|
if (!schema)
|
|
2784
2784
|
return null;
|
|
2785
2785
|
return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
|
|
2786
|
-
}).filter((
|
|
2786
|
+
}).filter((x2) => !!x2);
|
|
2787
2787
|
if (ctx.common.async) {
|
|
2788
2788
|
return Promise.all(items).then((results) => {
|
|
2789
2789
|
return ParseStatus.mergeArray(status, results);
|
|
@@ -3041,7 +3041,7 @@ class ZodFunction extends ZodType {
|
|
|
3041
3041
|
ctx.schemaErrorMap,
|
|
3042
3042
|
getErrorMap(),
|
|
3043
3043
|
errorMap
|
|
3044
|
-
].filter((
|
|
3044
|
+
].filter((x2) => !!x2),
|
|
3045
3045
|
issueData: {
|
|
3046
3046
|
code: ZodIssueCode.invalid_arguments,
|
|
3047
3047
|
argumentsError: error
|
|
@@ -3057,7 +3057,7 @@ class ZodFunction extends ZodType {
|
|
|
3057
3057
|
ctx.schemaErrorMap,
|
|
3058
3058
|
getErrorMap(),
|
|
3059
3059
|
errorMap
|
|
3060
|
-
].filter((
|
|
3060
|
+
].filter((x2) => !!x2),
|
|
3061
3061
|
issueData: {
|
|
3062
3062
|
code: ZodIssueCode.invalid_return_type,
|
|
3063
3063
|
returnTypeError: error
|
|
@@ -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((e2) => {
|
|
3074
|
+
error.addIssue(makeArgsIssue(args, e2));
|
|
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((e2) => {
|
|
3079
|
+
error.addIssue(makeReturnsIssue(result, e2));
|
|
3080
3080
|
throw error;
|
|
3081
3081
|
});
|
|
3082
3082
|
return parsedReturns;
|
|
@@ -3921,27 +3921,6 @@ 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 __assign = function() {
|
|
3925
|
-
__assign = Object.assign || function __assign2(t2) {
|
|
3926
|
-
for (var s2, i = 1, n2 = arguments.length; i < n2; i++) {
|
|
3927
|
-
s2 = arguments[i];
|
|
3928
|
-
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2];
|
|
3929
|
-
}
|
|
3930
|
-
return t2;
|
|
3931
|
-
};
|
|
3932
|
-
return __assign.apply(this, arguments);
|
|
3933
|
-
};
|
|
3934
|
-
function __rest$1(s2, e) {
|
|
3935
|
-
var t2 = {};
|
|
3936
|
-
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e.indexOf(p2) < 0)
|
|
3937
|
-
t2[p2] = s2[p2];
|
|
3938
|
-
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3939
|
-
for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
|
|
3940
|
-
if (e.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i]))
|
|
3941
|
-
t2[p2[i]] = s2[p2[i]];
|
|
3942
|
-
}
|
|
3943
|
-
return t2;
|
|
3944
|
-
}
|
|
3945
3924
|
function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
3946
3925
|
function adopt(value) {
|
|
3947
3926
|
return value instanceof P2 ? value : new P2(function(resolve) {
|
|
@@ -3952,15 +3931,15 @@ function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
|
3952
3931
|
function fulfilled(value) {
|
|
3953
3932
|
try {
|
|
3954
3933
|
step(generator.next(value));
|
|
3955
|
-
} catch (
|
|
3956
|
-
reject(
|
|
3934
|
+
} catch (e2) {
|
|
3935
|
+
reject(e2);
|
|
3957
3936
|
}
|
|
3958
3937
|
}
|
|
3959
3938
|
function rejected(value) {
|
|
3960
3939
|
try {
|
|
3961
3940
|
step(generator["throw"](value));
|
|
3962
|
-
} catch (
|
|
3963
|
-
reject(
|
|
3941
|
+
} catch (e2) {
|
|
3942
|
+
reject(e2);
|
|
3964
3943
|
}
|
|
3965
3944
|
}
|
|
3966
3945
|
function step(result) {
|
|
@@ -3969,208 +3948,189 @@ function __awaiter$1(thisArg, _arguments, P2, generator) {
|
|
|
3969
3948
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3970
3949
|
});
|
|
3971
3950
|
}
|
|
3972
|
-
function __spreadArray(to, from, pack) {
|
|
3973
|
-
if (pack || arguments.length === 2) for (var i = 0, l2 = from.length, ar; i < l2; i++) {
|
|
3974
|
-
if (ar || !(i in from)) {
|
|
3975
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3976
|
-
ar[i] = from[i];
|
|
3977
|
-
}
|
|
3978
|
-
}
|
|
3979
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3980
|
-
}
|
|
3981
3951
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
3982
|
-
var
|
|
3983
|
-
return
|
|
3984
|
-
};
|
|
3985
|
-
function
|
|
3986
|
-
return function(
|
|
3987
|
-
return Object.prototype.hasOwnProperty.call(
|
|
3988
|
-
}(
|
|
3989
|
-
}
|
|
3990
|
-
function
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
var R2 = function() {
|
|
3997
|
-
return i.removeEventListener(a2, u3);
|
|
3952
|
+
var e2 = new Error(message);
|
|
3953
|
+
return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
|
|
3954
|
+
};
|
|
3955
|
+
function e(e2, t2) {
|
|
3956
|
+
return function(e3, t3) {
|
|
3957
|
+
return Object.prototype.hasOwnProperty.call(e3, t3);
|
|
3958
|
+
}(e2, t2) ? e2[t2] : void 0;
|
|
3959
|
+
}
|
|
3960
|
+
function t$3(e2, t2, n2, r2) {
|
|
3961
|
+
const o2 = document, i = "securitypolicyviolation";
|
|
3962
|
+
let R2;
|
|
3963
|
+
const s2 = (t3) => {
|
|
3964
|
+
const n3 = new URL(e2, location.href), { blockedURI: r3 } = t3;
|
|
3965
|
+
r3 !== n3.href && r3 !== n3.protocol.slice(0, -1) && r3 !== n3.origin || (R2 = t3, a2());
|
|
3998
3966
|
};
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
if (R2(), o2) return n2(o2);
|
|
4009
|
-
throw e2;
|
|
4010
|
-
});
|
|
4011
|
-
});
|
|
3967
|
+
o2.addEventListener(i, s2);
|
|
3968
|
+
const a2 = () => o2.removeEventListener(i, s2);
|
|
3969
|
+
return Promise.resolve().then(t2).then((e3) => (a2(), e3), (e3) => new Promise((e4) => {
|
|
3970
|
+
const t3 = new MessageChannel();
|
|
3971
|
+
t3.port1.onmessage = () => e4(), t3.port2.postMessage(null);
|
|
3972
|
+
}).then(() => {
|
|
3973
|
+
if (a2(), R2) return n2(R2);
|
|
3974
|
+
throw e3;
|
|
3975
|
+
}));
|
|
4012
3976
|
}
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
for (
|
|
4016
|
-
|
|
4017
|
-
r2 !==
|
|
4018
|
-
} else t2 +=
|
|
3977
|
+
function n$2(e2) {
|
|
3978
|
+
let t2 = "";
|
|
3979
|
+
for (let n2 = 0; n2 < e2.length; ++n2) if (n2 > 0) {
|
|
3980
|
+
const r2 = e2[n2].toLowerCase();
|
|
3981
|
+
r2 !== e2[n2] ? t2 += ` ${r2}` : t2 += e2[n2];
|
|
3982
|
+
} else t2 += e2[n2].toUpperCase();
|
|
4019
3983
|
return t2;
|
|
4020
3984
|
}
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
R3
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
return
|
|
4050
|
-
}
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
3985
|
+
const r$2 = { default: "endpoint" }, o$2 = { default: "tlsEndpoint" }, i$3 = "Client timeout", R$1 = "Network connection error", s$3 = "Network request aborted", a$2 = "Response cannot be parsed", c$3 = "Blocked by CSP", E$1 = "The endpoint parameter is not a valid URL", l$2 = "Handle on demand agent data error", u$2 = /* @__PURE__ */ n$2("WrongRegion"), d$2 = /* @__PURE__ */ n$2("SubscriptionNotActive"), _$1 = /* @__PURE__ */ n$2("UnsupportedVersion"), O = /* @__PURE__ */ n$2("InstallationMethodRestricted"), p$1 = /* @__PURE__ */ n$2("HostnameRestricted"), I = /* @__PURE__ */ n$2("IntegrationFailed"), f$2 = /* @__PURE__ */ n$2("NetworkRestricted"), N = /* @__PURE__ */ n$2("InvalidProxyIntegrationSecret"), T = /* @__PURE__ */ n$2("InvalidProxyIntegrationHeaders"), h = /* @__PURE__ */ n$2("ProxyIntegrationSecretEnvironmentMismatch");
|
|
3986
|
+
const v = "API key required", m$1 = "API key not found", A = "API key expired", w$1 = "Request cannot be parsed", P = "Request failed", D = "Request failed to process", S = "Too many requests, rate limit exceeded", y$1 = "Not available for this origin", g$1 = "Not available with restricted header", L = v, C = m$1, U = A;
|
|
3987
|
+
var b = "3.12.6";
|
|
3988
|
+
const M = "Failed to load the JS script of the agent", K = "9319";
|
|
3989
|
+
function V(e2, t2) {
|
|
3990
|
+
const n2 = [], [r2, o2] = function(e3) {
|
|
3991
|
+
const t3 = function(e4) {
|
|
3992
|
+
const t4 = [...e4];
|
|
3993
|
+
return { current: () => t4[0], postpone() {
|
|
3994
|
+
const e5 = t4.shift();
|
|
3995
|
+
void 0 !== e5 && t4.push(e5);
|
|
3996
|
+
}, exclude() {
|
|
3997
|
+
t4.shift();
|
|
3998
|
+
} };
|
|
3999
|
+
}(e3), n3 = /* @__PURE__ */ function(e4, t4) {
|
|
4000
|
+
let n4 = 0;
|
|
4001
|
+
return () => Math.random() * Math.min(t4, e4 * Math.pow(2, n4++));
|
|
4002
|
+
}(100, 3e3), r3 = /* @__PURE__ */ new Set();
|
|
4003
|
+
return [t3.current(), (e4, o3) => {
|
|
4004
|
+
let i2;
|
|
4005
|
+
const R3 = o3 instanceof Error ? o3.message : "";
|
|
4006
|
+
if (R3 === c$3 || R3 === E$1) t3.exclude(), i2 = 0;
|
|
4007
|
+
else if (R3 === K) t3.exclude();
|
|
4008
|
+
else if (R3 === M) {
|
|
4009
|
+
const n4 = Date.now() - e4.getTime() < 50, o4 = t3.current();
|
|
4010
|
+
o4 && n4 && !r3.has(o4) && (r3.add(o4), i2 = 0), t3.postpone();
|
|
4011
|
+
} else t3.postpone();
|
|
4012
|
+
const s2 = t3.current();
|
|
4013
|
+
return void 0 === s2 ? void 0 : [s2, null != i2 ? i2 : e4.getTime() + n3() - Date.now()];
|
|
4014
|
+
}];
|
|
4015
|
+
}(e2);
|
|
4016
|
+
let i;
|
|
4017
|
+
if (void 0 === r2) return Promise.reject(new TypeError("The list of script URL patterns is empty"));
|
|
4018
|
+
const R2 = (e3) => {
|
|
4019
|
+
const r3 = /* @__PURE__ */ new Date(), s2 = (t3) => n2.push({ url: e3, startedAt: r3, finishedAt: /* @__PURE__ */ new Date(), error: t3 }), a2 = t2(e3);
|
|
4020
|
+
return a2.then(() => s2(), s2), a2.catch((e4) => {
|
|
4021
|
+
if (null != i || (i = e4), n2.length >= 5) throw i;
|
|
4022
|
+
const t3 = o2(r3, e4);
|
|
4023
|
+
if (!t3) throw i;
|
|
4024
|
+
const [s3, a3] = t3;
|
|
4025
|
+
return (c2 = a3, new Promise((e5) => setTimeout(e5, c2))).then(() => R2(s3));
|
|
4026
|
+
var c2;
|
|
4063
4027
|
});
|
|
4064
4028
|
};
|
|
4065
|
-
return
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
var
|
|
4070
|
-
function
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4029
|
+
return R2(r2).then((e3) => [e3, n2]);
|
|
4030
|
+
}
|
|
4031
|
+
const k = "https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js", G = k;
|
|
4032
|
+
function B(t2) {
|
|
4033
|
+
var n2, r2;
|
|
4034
|
+
const { picked: o2, rest: i } = function(e2, t3) {
|
|
4035
|
+
const n3 = {}, r3 = {};
|
|
4036
|
+
for (const [o3, i2] of Object.entries(e2)) t3.includes(o3) ? n3[o3] = i2 : r3[o3] = i2;
|
|
4037
|
+
return { picked: n3, rest: r3 };
|
|
4038
|
+
}(t2, ["scriptUrlPattern", "token", "apiKey"]), R2 = o2.token, s2 = null !== (n2 = o2.apiKey) && void 0 !== n2 ? n2 : R2, a2 = null !== (r2 = e(t2, "scriptUrlPattern")) && void 0 !== r2 ? r2 : k, [c2, E2] = function() {
|
|
4039
|
+
const e2 = [], t3 = () => {
|
|
4075
4040
|
e2.push({ time: /* @__PURE__ */ new Date(), state: document.visibilityState });
|
|
4076
|
-
},
|
|
4077
|
-
return e3.addEventListener(
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
});
|
|
4094
|
-
}(c2, u3);
|
|
4095
|
-
return M(e2, V);
|
|
4096
|
-
}).catch(function(e2) {
|
|
4097
|
-
throw l2(), function(e3) {
|
|
4098
|
-
if (e3 instanceof Error && e3.message === C) return new Error(b);
|
|
4041
|
+
}, n3 = function(e3, t4, n4, r3) {
|
|
4042
|
+
return e3.addEventListener(t4, n4, r3), () => e3.removeEventListener(t4, n4, r3);
|
|
4043
|
+
}(document, "visibilitychange", t3);
|
|
4044
|
+
return t3(), [e2, n3];
|
|
4045
|
+
}();
|
|
4046
|
+
return Promise.resolve().then(() => {
|
|
4047
|
+
if (!s2 || "string" != typeof s2) throw new Error(v);
|
|
4048
|
+
const e2 = function(e3, t3) {
|
|
4049
|
+
return (Array.isArray(e3) ? e3 : [e3]).map((e4) => function(e5, t4) {
|
|
4050
|
+
const n3 = encodeURIComponent;
|
|
4051
|
+
return e5.replace(/<[^<>]+>/g, (e6) => "<version>" === e6 ? "3" : "<apiKey>" === e6 ? n3(t4) : "<loaderVersion>" === e6 ? n3(b) : e6);
|
|
4052
|
+
}(String(e4), t3));
|
|
4053
|
+
}(a2, s2);
|
|
4054
|
+
return V(e2, F);
|
|
4055
|
+
}).catch((e2) => {
|
|
4056
|
+
throw E2(), function(e3) {
|
|
4057
|
+
if (e3 instanceof Error && e3.message === K) return new Error(M);
|
|
4099
4058
|
return e3;
|
|
4100
4059
|
}(e2);
|
|
4101
|
-
}).then(
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
if (function(e2, t3) {
|
|
4136
|
-
var n3, r2 = null === (n3 = Object.getOwnPropertyDescriptor) || void 0 === n3 ? void 0 : n3.call(Object, e2, t3);
|
|
4137
|
-
(null == r2 ? void 0 : r2.configurable) ? delete e2[t3] : r2 && !r2.writable || (e2[t3] = void 0);
|
|
4138
|
-
}(e, t2), "function" != typeof (null == n2 ? void 0 : n2.load)) throw new Error(C);
|
|
4060
|
+
}).then(([e2, t3]) => (E2(), e2.load({ ...i, ldi: { attempts: t3, visibilityStates: c2 } })));
|
|
4061
|
+
}
|
|
4062
|
+
function F(e2) {
|
|
4063
|
+
return t$3(e2, () => function(e3) {
|
|
4064
|
+
return new Promise((t2, n2) => {
|
|
4065
|
+
if (function(e4) {
|
|
4066
|
+
if (URL.prototype) try {
|
|
4067
|
+
return new URL(e4, location.href), false;
|
|
4068
|
+
} catch (t3) {
|
|
4069
|
+
if (t3 instanceof Error && "TypeError" === t3.name) return true;
|
|
4070
|
+
throw t3;
|
|
4071
|
+
}
|
|
4072
|
+
}(e3)) throw new Error(E$1);
|
|
4073
|
+
const r2 = document.createElement("script"), o2 = () => {
|
|
4074
|
+
var e4;
|
|
4075
|
+
return null === (e4 = r2.parentNode) || void 0 === e4 ? void 0 : e4.removeChild(r2);
|
|
4076
|
+
}, i = document.head || document.getElementsByTagName("head")[0];
|
|
4077
|
+
r2.onload = () => {
|
|
4078
|
+
o2(), t2();
|
|
4079
|
+
}, r2.onerror = () => {
|
|
4080
|
+
o2(), n2(new Error(M));
|
|
4081
|
+
}, r2.async = true, r2.src = e3, i.appendChild(r2);
|
|
4082
|
+
});
|
|
4083
|
+
}(e2), () => {
|
|
4084
|
+
throw new Error(c$3);
|
|
4085
|
+
}).then(x);
|
|
4086
|
+
}
|
|
4087
|
+
function x() {
|
|
4088
|
+
const e2 = window, t2 = "__fpjs_p_l_b", n2 = e2[t2];
|
|
4089
|
+
if (function(e3, t3) {
|
|
4090
|
+
var n3;
|
|
4091
|
+
const r2 = null === (n3 = Object.getOwnPropertyDescriptor) || void 0 === n3 ? void 0 : n3.call(Object, e3, t3);
|
|
4092
|
+
(null == r2 ? void 0 : r2.configurable) ? delete e3[t3] : r2 && !r2.writable || (e3[t3] = void 0);
|
|
4093
|
+
}(e2, t2), "function" != typeof (null == n2 ? void 0 : n2.load)) throw new Error(K);
|
|
4139
4094
|
return n2;
|
|
4140
4095
|
}
|
|
4141
|
-
var
|
|
4096
|
+
var H = { load: B, defaultScriptUrlPattern: G, ERROR_SCRIPT_LOAD_FAIL: M, ERROR_API_KEY_EXPIRED: A, ERROR_API_KEY_INVALID: m$1, ERROR_API_KEY_MISSING: v, ERROR_BAD_REQUEST_FORMAT: w$1, ERROR_BAD_RESPONSE_FORMAT: a$2, ERROR_CLIENT_TIMEOUT: i$3, ERROR_CSP_BLOCK: c$3, ERROR_FORBIDDEN_ENDPOINT: p$1, ERROR_FORBIDDEN_HEADER: g$1, ERROR_FORBIDDEN_ORIGIN: y$1, ERROR_GENERAL_SERVER_FAILURE: P, ERROR_HANDLE_AGENT_DATA: l$2, ERROR_INSTALLATION_METHOD_RESTRICTED: O, ERROR_INTEGRATION_FAILURE: I, ERROR_INVALID_ENDPOINT: E$1, ERROR_INVALID_PROXY_INTEGRATION_HEADERS: T, ERROR_INVALID_PROXY_INTEGRATION_SECRET: N, ERROR_NETWORK_ABORT: s$3, ERROR_NETWORK_CONNECTION: R$1, ERROR_NETWORK_RESTRICTED: f$2, ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH: h, ERROR_RATE_LIMIT: S, ERROR_SERVER_TIMEOUT: D, ERROR_SUBSCRIPTION_NOT_ACTIVE: d$2, ERROR_TOKEN_EXPIRED: U, ERROR_TOKEN_INVALID: C, ERROR_TOKEN_MISSING: L, ERROR_UNSUPPORTED_VERSION: _$1, ERROR_WRONG_REGION: u$2, defaultEndpoint: r$2, defaultTlsEndpoint: o$2 };
|
|
4142
4097
|
const FingerprintJSPro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4143
4098
|
__proto__: null,
|
|
4144
|
-
ERROR_API_KEY_EXPIRED:
|
|
4145
|
-
ERROR_API_KEY_INVALID:
|
|
4146
|
-
ERROR_API_KEY_MISSING:
|
|
4147
|
-
ERROR_BAD_REQUEST_FORMAT:
|
|
4148
|
-
ERROR_BAD_RESPONSE_FORMAT:
|
|
4149
|
-
ERROR_CLIENT_TIMEOUT:
|
|
4150
|
-
ERROR_CSP_BLOCK:
|
|
4151
|
-
ERROR_FORBIDDEN_ENDPOINT:
|
|
4152
|
-
ERROR_FORBIDDEN_HEADER:
|
|
4099
|
+
ERROR_API_KEY_EXPIRED: A,
|
|
4100
|
+
ERROR_API_KEY_INVALID: m$1,
|
|
4101
|
+
ERROR_API_KEY_MISSING: v,
|
|
4102
|
+
ERROR_BAD_REQUEST_FORMAT: w$1,
|
|
4103
|
+
ERROR_BAD_RESPONSE_FORMAT: a$2,
|
|
4104
|
+
ERROR_CLIENT_TIMEOUT: i$3,
|
|
4105
|
+
ERROR_CSP_BLOCK: c$3,
|
|
4106
|
+
ERROR_FORBIDDEN_ENDPOINT: p$1,
|
|
4107
|
+
ERROR_FORBIDDEN_HEADER: g$1,
|
|
4153
4108
|
ERROR_FORBIDDEN_ORIGIN: y$1,
|
|
4154
|
-
ERROR_GENERAL_SERVER_FAILURE:
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4109
|
+
ERROR_GENERAL_SERVER_FAILURE: P,
|
|
4110
|
+
ERROR_HANDLE_AGENT_DATA: l$2,
|
|
4111
|
+
ERROR_INSTALLATION_METHOD_RESTRICTED: O,
|
|
4112
|
+
ERROR_INTEGRATION_FAILURE: I,
|
|
4113
|
+
ERROR_INVALID_ENDPOINT: E$1,
|
|
4114
|
+
ERROR_INVALID_PROXY_INTEGRATION_HEADERS: T,
|
|
4115
|
+
ERROR_INVALID_PROXY_INTEGRATION_SECRET: N,
|
|
4116
|
+
ERROR_NETWORK_ABORT: s$3,
|
|
4159
4117
|
ERROR_NETWORK_CONNECTION: R$1,
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4118
|
+
ERROR_NETWORK_RESTRICTED: f$2,
|
|
4119
|
+
ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH: h,
|
|
4120
|
+
ERROR_RATE_LIMIT: S,
|
|
4121
|
+
ERROR_SCRIPT_LOAD_FAIL: M,
|
|
4122
|
+
ERROR_SERVER_TIMEOUT: D,
|
|
4123
|
+
ERROR_SUBSCRIPTION_NOT_ACTIVE: d$2,
|
|
4124
|
+
ERROR_TOKEN_EXPIRED: U,
|
|
4125
|
+
ERROR_TOKEN_INVALID: C,
|
|
4126
|
+
ERROR_TOKEN_MISSING: L,
|
|
4127
|
+
ERROR_UNSUPPORTED_VERSION: _$1,
|
|
4128
|
+
ERROR_WRONG_REGION: u$2,
|
|
4129
|
+
default: H,
|
|
4130
|
+
defaultEndpoint: r$2,
|
|
4131
|
+
defaultScriptUrlPattern: G,
|
|
4132
|
+
defaultTlsEndpoint: o$2,
|
|
4133
|
+
load: B
|
|
4174
4134
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4175
4135
|
const CACHE_KEY_PREFIX = "@fpjs@client@";
|
|
4176
4136
|
const MAX_CACHE_LIFE = 60 * 60 * 24;
|
|
@@ -4211,7 +4171,7 @@ class LocalStorageCache {
|
|
|
4211
4171
|
}
|
|
4212
4172
|
try {
|
|
4213
4173
|
return JSON.parse(json);
|
|
4214
|
-
} catch (
|
|
4174
|
+
} catch (e2) {
|
|
4215
4175
|
return;
|
|
4216
4176
|
}
|
|
4217
4177
|
}
|
|
@@ -4246,7 +4206,7 @@ class SessionStorageCache {
|
|
|
4246
4206
|
}
|
|
4247
4207
|
try {
|
|
4248
4208
|
return JSON.parse(json);
|
|
4249
|
-
} catch (
|
|
4209
|
+
} catch (e2) {
|
|
4250
4210
|
return;
|
|
4251
4211
|
}
|
|
4252
4212
|
}
|
|
@@ -4366,7 +4326,7 @@ var CacheLocation;
|
|
|
4366
4326
|
CacheLocation2["SessionStorage"] = "sessionstorage";
|
|
4367
4327
|
CacheLocation2["NoCache"] = "nocache";
|
|
4368
4328
|
})(CacheLocation || (CacheLocation = {}));
|
|
4369
|
-
var version$1 = "1.3.
|
|
4329
|
+
var version$1 = "1.3.3";
|
|
4370
4330
|
const cacheLocationBuilders = {
|
|
4371
4331
|
[CacheLocation.Memory]: () => new InMemoryCache().enclosedCache,
|
|
4372
4332
|
[CacheLocation.LocalStorage]: (prefix) => new LocalStorageCache(prefix),
|
|
@@ -4378,14 +4338,14 @@ const doesBrowserSupportCacheLocation = (cacheLocation) => {
|
|
|
4378
4338
|
case CacheLocation.SessionStorage:
|
|
4379
4339
|
try {
|
|
4380
4340
|
window.sessionStorage.getItem("item");
|
|
4381
|
-
} catch (
|
|
4341
|
+
} catch (e2) {
|
|
4382
4342
|
return false;
|
|
4383
4343
|
}
|
|
4384
4344
|
return true;
|
|
4385
4345
|
case CacheLocation.LocalStorage:
|
|
4386
4346
|
try {
|
|
4387
4347
|
window.localStorage.getItem("item");
|
|
4388
|
-
} catch (
|
|
4348
|
+
} catch (e2) {
|
|
4389
4349
|
return false;
|
|
4390
4350
|
}
|
|
4391
4351
|
return true;
|
|
@@ -4403,6 +4363,9 @@ class FpjsClient {
|
|
|
4403
4363
|
this.agentPromise = null;
|
|
4404
4364
|
this.customAgent = options === null || options === void 0 ? void 0 : options.customAgent;
|
|
4405
4365
|
this.agent = {
|
|
4366
|
+
collect: () => {
|
|
4367
|
+
throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.");
|
|
4368
|
+
},
|
|
4406
4369
|
get: () => {
|
|
4407
4370
|
throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.");
|
|
4408
4371
|
}
|
|
@@ -4438,17 +4401,21 @@ class FpjsClient {
|
|
|
4438
4401
|
*/
|
|
4439
4402
|
init(passedLoadOptions) {
|
|
4440
4403
|
return __awaiter$1(this, void 0, void 0, function* () {
|
|
4441
|
-
var _a, _b;
|
|
4404
|
+
var _a, _b, _c;
|
|
4442
4405
|
if (!this.loadOptions && !passedLoadOptions) {
|
|
4443
4406
|
throw new TypeError("No load options provided");
|
|
4444
4407
|
}
|
|
4445
|
-
const
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4408
|
+
const integrationInfo = (
|
|
4409
|
+
// @ts-ignore
|
|
4410
|
+
((_a = this.loadOptions) === null || _a === void 0 ? void 0 : _a.silent) === true ? [] : [
|
|
4411
|
+
...((_b = this.loadOptions) === null || _b === void 0 ? void 0 : _b.integrationInfo) || [],
|
|
4412
|
+
...(passedLoadOptions === null || passedLoadOptions === void 0 ? void 0 : passedLoadOptions.integrationInfo) || [],
|
|
4413
|
+
`spa-sdk/${version$1}`
|
|
4414
|
+
]
|
|
4415
|
+
);
|
|
4416
|
+
const loadOptions = Object.assign(Object.assign(Object.assign({}, this.loadOptions), passedLoadOptions), { integrationInfo });
|
|
4450
4417
|
if (!this.agentPromise) {
|
|
4451
|
-
const agentLoader = (
|
|
4418
|
+
const agentLoader = (_c = this.customAgent) !== null && _c !== void 0 ? _c : FingerprintJSPro;
|
|
4452
4419
|
this.agentPromise = agentLoader.load(loadOptions).then((agent) => {
|
|
4453
4420
|
this.agent = agent;
|
|
4454
4421
|
return agent;
|
|
@@ -4565,8 +4532,8 @@ function buildProxyUrl(url) {
|
|
|
4565
4532
|
return `${url}?${PROXY_QUERY_PARAM}`;
|
|
4566
4533
|
}
|
|
4567
4534
|
async function initFingerprint(apiKey, proxyUrl) {
|
|
4568
|
-
const customEndpointArray = [
|
|
4569
|
-
const customScriptEndpointArray = [
|
|
4535
|
+
const customEndpointArray = [r$2];
|
|
4536
|
+
const customScriptEndpointArray = [G];
|
|
4570
4537
|
if (proxyUrl) {
|
|
4571
4538
|
customEndpointArray.unshift(proxyUrl);
|
|
4572
4539
|
customScriptEndpointArray.unshift(buildProxyUrl(proxyUrl));
|
|
@@ -4588,6 +4555,9 @@ async function initFingerprint(apiKey, proxyUrl) {
|
|
|
4588
4555
|
}
|
|
4589
4556
|
async function getFingerprint(cacheOnly = false) {
|
|
4590
4557
|
if (!window.fingerprintConfig) {
|
|
4558
|
+
if (cacheOnly) {
|
|
4559
|
+
return "";
|
|
4560
|
+
}
|
|
4591
4561
|
throw new Error("Fingerprint configuration is not initialized.");
|
|
4592
4562
|
}
|
|
4593
4563
|
const cachedFingerprint = getCachedFingerprint();
|
|
@@ -4681,16 +4651,16 @@ const o$1 = {
|
|
|
4681
4651
|
code: 60,
|
|
4682
4652
|
message: "Tarifa no disponible"
|
|
4683
4653
|
}
|
|
4684
|
-
}, n = (
|
|
4654
|
+
}, n = (e2) => ({
|
|
4685
4655
|
// INVALID_DISCOUNT
|
|
4686
4656
|
11: {
|
|
4687
4657
|
code: 500,
|
|
4688
|
-
message:
|
|
4658
|
+
message: e2
|
|
4689
4659
|
},
|
|
4690
4660
|
//EXPIRED_DISCOUNT
|
|
4691
4661
|
12: {
|
|
4692
4662
|
code: 501,
|
|
4693
|
-
message:
|
|
4663
|
+
message: e2
|
|
4694
4664
|
}
|
|
4695
4665
|
}), a = {
|
|
4696
4666
|
// unavailable_student
|
|
@@ -4728,24 +4698,24 @@ const o$1 = {
|
|
|
4728
4698
|
code: 60,
|
|
4729
4699
|
message: "Error desconocido"
|
|
4730
4700
|
}
|
|
4731
|
-
}, c$1 = (
|
|
4701
|
+
}, c$1 = (e2) => ({
|
|
4732
4702
|
30: {
|
|
4733
4703
|
code: 30,
|
|
4734
|
-
message:
|
|
4704
|
+
message: e2
|
|
4735
4705
|
}
|
|
4736
4706
|
}), d$1 = {
|
|
4737
4707
|
50: {
|
|
4738
4708
|
code: 50,
|
|
4739
4709
|
message: "Unknow Error"
|
|
4740
4710
|
}
|
|
4741
|
-
}, i$2 = (
|
|
4711
|
+
}, i$2 = (e2) => ({
|
|
4742
4712
|
...o$1,
|
|
4743
4713
|
...s$1,
|
|
4744
4714
|
...r,
|
|
4745
|
-
...n(
|
|
4715
|
+
...n(e2),
|
|
4746
4716
|
...a,
|
|
4747
4717
|
...d$1,
|
|
4748
|
-
...c$1(
|
|
4718
|
+
...c$1(e2)
|
|
4749
4719
|
});
|
|
4750
4720
|
class o extends Error {
|
|
4751
4721
|
constructor(r2 = -100, s2 = "Unknown error", t2 = null) {
|
|
@@ -4753,10 +4723,10 @@ class o extends Error {
|
|
|
4753
4723
|
}
|
|
4754
4724
|
}
|
|
4755
4725
|
async function w(t2) {
|
|
4756
|
-
const
|
|
4726
|
+
const e2 = [404, 422, 500], r2 = await t2.json();
|
|
4757
4727
|
if (t2.ok)
|
|
4758
4728
|
return r2;
|
|
4759
|
-
if (
|
|
4729
|
+
if (e2.includes(t2.status))
|
|
4760
4730
|
switch (t2.status) {
|
|
4761
4731
|
case 404:
|
|
4762
4732
|
throw new o(100, "Not found");
|
|
@@ -4772,8 +4742,8 @@ async function w(t2) {
|
|
|
4772
4742
|
}
|
|
4773
4743
|
function l$1(t2) {
|
|
4774
4744
|
if (t2.errors instanceof Array) {
|
|
4775
|
-
const { code:
|
|
4776
|
-
throw n2 ? new o(n2.code, n2.message, t2.errors[0]) : new o(
|
|
4745
|
+
const { code: e2 = -100, message: r2 = "Unknown error" } = t2.errors[0] || {}, n2 = i$2(r2)[e2];
|
|
4746
|
+
throw n2 ? new o(n2.code, n2.message, t2.errors[0]) : new o(e2, r2, t2.errors[0]);
|
|
4777
4747
|
} else
|
|
4778
4748
|
return t2;
|
|
4779
4749
|
}
|
|
@@ -4787,7 +4757,7 @@ function y(...t2) {
|
|
|
4787
4757
|
);
|
|
4788
4758
|
return new Headers(r2);
|
|
4789
4759
|
}
|
|
4790
|
-
function c(t2,
|
|
4760
|
+
function c(t2, e2 = {}, r2 = {}, n2) {
|
|
4791
4761
|
const {
|
|
4792
4762
|
apiKey: o2,
|
|
4793
4763
|
withCredentials: a2,
|
|
@@ -4798,21 +4768,21 @@ function c(t2, e = {}, r2 = {}, n2) {
|
|
|
4798
4768
|
Authorization: `Token token=${r2.apiKey || o2}`,
|
|
4799
4769
|
"Content-Type": "application/json"
|
|
4800
4770
|
};
|
|
4801
|
-
return s2 && (u3.Authorization = `Token ${r2.apiKey || o2}, Bearer ${s2}`),
|
|
4771
|
+
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);
|
|
4802
4772
|
}
|
|
4803
|
-
function E(t2,
|
|
4804
|
-
return c(t2,
|
|
4773
|
+
function E(t2, e2 = {}, r2) {
|
|
4774
|
+
return c(t2, e2, {}, r2);
|
|
4805
4775
|
}
|
|
4806
4776
|
let u$1 = class u {
|
|
4807
4777
|
constructor({
|
|
4808
|
-
url:
|
|
4778
|
+
url: e2,
|
|
4809
4779
|
watch: i,
|
|
4810
4780
|
expect: h2,
|
|
4811
4781
|
maxRetries: t2 = 30,
|
|
4812
4782
|
interval: s2 = 2e3,
|
|
4813
4783
|
eachCall: c2 = null
|
|
4814
4784
|
}) {
|
|
4815
|
-
this.url =
|
|
4785
|
+
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);
|
|
4816
4786
|
}
|
|
4817
4787
|
start() {
|
|
4818
4788
|
return this.execute(this.maxRetries);
|
|
@@ -4820,11 +4790,11 @@ let u$1 = class u {
|
|
|
4820
4790
|
abort() {
|
|
4821
4791
|
this.aborted = true;
|
|
4822
4792
|
}
|
|
4823
|
-
execute(
|
|
4793
|
+
execute(e2) {
|
|
4824
4794
|
const i = (t2) => {
|
|
4825
|
-
if (this.expect.includes(t2[this.watch]) ||
|
|
4795
|
+
if (this.expect.includes(t2[this.watch]) || e2 === 1 || this.aborted) {
|
|
4826
4796
|
let s2 = t2[this.watch];
|
|
4827
|
-
|
|
4797
|
+
e2 === 1 ? s2 = "retries_exceeded" : this.aborted && (s2 = "aborted"), this.timers.forEach(clearInterval), this.executeEachCall(s2, t2);
|
|
4828
4798
|
} else if (t2[this.watch] === "failed")
|
|
4829
4799
|
this.timers.forEach(clearInterval), this.executeEachCall("failed", t2);
|
|
4830
4800
|
else {
|
|
@@ -4832,15 +4802,15 @@ let u$1 = class u {
|
|
|
4832
4802
|
const s2 = window.setTimeout(
|
|
4833
4803
|
this.execute,
|
|
4834
4804
|
this.interval,
|
|
4835
|
-
|
|
4805
|
+
e2 - 1
|
|
4836
4806
|
);
|
|
4837
4807
|
this.timers.push(s2);
|
|
4838
4808
|
}
|
|
4839
4809
|
}, h2 = (t2) => this.executeEachCall("error", t2);
|
|
4840
4810
|
return E(this.url, {}, h2).then(i);
|
|
4841
4811
|
}
|
|
4842
|
-
executeEachCall(
|
|
4843
|
-
this.eachCall instanceof Function && this.eachCall({ status:
|
|
4812
|
+
executeEachCall(e2, i) {
|
|
4813
|
+
this.eachCall instanceof Function && this.eachCall({ status: e2, payload: i }) && this.abort();
|
|
4844
4814
|
}
|
|
4845
4815
|
};
|
|
4846
4816
|
function j({
|
|
@@ -4850,23 +4820,23 @@ function j({
|
|
|
4850
4820
|
let n2, i = {
|
|
4851
4821
|
"Content-Type": "application/json"
|
|
4852
4822
|
}, r2;
|
|
4853
|
-
function f2(
|
|
4854
|
-
n2 =
|
|
4823
|
+
function f2(e2) {
|
|
4824
|
+
n2 = e2.baseUrl, i = {
|
|
4855
4825
|
...i,
|
|
4856
|
-
...
|
|
4826
|
+
...e2.defaultHeaders || {}
|
|
4857
4827
|
};
|
|
4858
4828
|
}
|
|
4859
|
-
function p2(
|
|
4860
|
-
r2 =
|
|
4829
|
+
function p2(e2) {
|
|
4830
|
+
r2 = e2;
|
|
4861
4831
|
}
|
|
4862
4832
|
function d2() {
|
|
4863
4833
|
if (!n2)
|
|
4864
4834
|
throw new Error(`Base URL is not set for ${h2} API.`);
|
|
4865
4835
|
}
|
|
4866
4836
|
const $ = { body: {} };
|
|
4867
|
-
async function y2(
|
|
4837
|
+
async function y2(e2, t2 = $) {
|
|
4868
4838
|
d2();
|
|
4869
|
-
const { body: s2, headers: o2 = {}, apiVersion: a2 = c2 } = t2, u3 = `${n2}/${a2}/${
|
|
4839
|
+
const { body: s2, headers: o2 = {}, apiVersion: a2 = c2 } = t2, u3 = `${n2}/${a2}/${e2}`, l2 = {
|
|
4870
4840
|
...i,
|
|
4871
4841
|
...o2,
|
|
4872
4842
|
...r2 ? { Authorization: r2 } : {}
|
|
@@ -4877,23 +4847,23 @@ function j({
|
|
|
4877
4847
|
headers: l2
|
|
4878
4848
|
})).json();
|
|
4879
4849
|
}
|
|
4880
|
-
async function w2(
|
|
4850
|
+
async function w2(e2, t2 = {}) {
|
|
4881
4851
|
d2();
|
|
4882
|
-
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${
|
|
4852
|
+
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`;
|
|
4883
4853
|
return (await fetch(a2, { headers: s2 })).json();
|
|
4884
4854
|
}
|
|
4885
|
-
function
|
|
4855
|
+
function H2(e2, t2) {
|
|
4886
4856
|
const o2 = {
|
|
4887
|
-
url: `${n2}/${c2}/${
|
|
4857
|
+
url: `${n2}/${c2}/${e2}`,
|
|
4888
4858
|
watch: t2.watch,
|
|
4889
4859
|
expect: t2.expect,
|
|
4890
4860
|
eachCall: t2.onEachResponse
|
|
4891
4861
|
};
|
|
4892
4862
|
return new u$1(o2);
|
|
4893
4863
|
}
|
|
4894
|
-
async function b2(
|
|
4864
|
+
async function b2(e2, t2 = {}) {
|
|
4895
4865
|
d2();
|
|
4896
|
-
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${
|
|
4866
|
+
const { headers: s2 = {}, apiVersion: o2 = c2 } = t2, a2 = `${n2}/${o2}/${e2}`, u3 = {
|
|
4897
4867
|
...i,
|
|
4898
4868
|
...s2,
|
|
4899
4869
|
...r2 ? { Authorization: r2 } : {}
|
|
@@ -4909,7 +4879,7 @@ function j({
|
|
|
4909
4879
|
delete: b2,
|
|
4910
4880
|
setAuthorizationHeader: p2,
|
|
4911
4881
|
setConfig: f2,
|
|
4912
|
-
poll:
|
|
4882
|
+
poll: H2
|
|
4913
4883
|
};
|
|
4914
4884
|
}
|
|
4915
4885
|
const t$1 = j({
|
|
@@ -4917,64 +4887,64 @@ const t$1 = j({
|
|
|
4917
4887
|
defaultApiVersion: "v1"
|
|
4918
4888
|
});
|
|
4919
4889
|
async function t(o2) {
|
|
4920
|
-
const { data:
|
|
4890
|
+
const { data: e2 } = await t$1.post(
|
|
4921
4891
|
"anonymous_profiles/identify",
|
|
4922
4892
|
{
|
|
4923
4893
|
body: o2
|
|
4924
4894
|
}
|
|
4925
4895
|
);
|
|
4926
|
-
return
|
|
4896
|
+
return e2;
|
|
4927
4897
|
}
|
|
4928
4898
|
const s = {
|
|
4929
4899
|
createAnonymousProfile: t
|
|
4930
4900
|
};
|
|
4931
4901
|
function d({
|
|
4932
|
-
searchId:
|
|
4902
|
+
searchId: e2,
|
|
4933
4903
|
userIdentifier: t2
|
|
4934
4904
|
}) {
|
|
4935
4905
|
return t$1.get(
|
|
4936
|
-
`trip_recommendations/${
|
|
4906
|
+
`trip_recommendations/${e2}/${t2}`
|
|
4937
4907
|
);
|
|
4938
4908
|
}
|
|
4939
|
-
function i$1(
|
|
4909
|
+
function i$1(e2) {
|
|
4940
4910
|
return t$1.post("seat_recommendations", {
|
|
4941
|
-
body:
|
|
4911
|
+
body: e2
|
|
4942
4912
|
});
|
|
4943
4913
|
}
|
|
4944
4914
|
function p({
|
|
4945
|
-
distinct_id:
|
|
4915
|
+
distinct_id: e2,
|
|
4946
4916
|
...t2
|
|
4947
4917
|
}) {
|
|
4948
|
-
return t$1.post(`seat_recommendations/${
|
|
4918
|
+
return t$1.post(`seat_recommendations/${e2}`, {
|
|
4949
4919
|
body: t2
|
|
4950
4920
|
});
|
|
4951
4921
|
}
|
|
4952
|
-
function u2(
|
|
4953
|
-
const { start: o2, onEachResponse: r2 } = t2, c2 = `profiles/${
|
|
4922
|
+
function u2(e2, t2) {
|
|
4923
|
+
const { start: o2, onEachResponse: r2 } = t2, c2 = `profiles/${e2}`, a2 = {
|
|
4954
4924
|
watch: "state",
|
|
4955
4925
|
expect: "finished",
|
|
4956
4926
|
onEachResponse: r2
|
|
4957
4927
|
}, s2 = t$1.poll(c2, a2);
|
|
4958
4928
|
return o2 && s2.start(), s2;
|
|
4959
4929
|
}
|
|
4960
|
-
async function m(
|
|
4930
|
+
async function m(e2) {
|
|
4961
4931
|
return t$1.post("profiles", {
|
|
4962
|
-
body:
|
|
4932
|
+
body: e2
|
|
4963
4933
|
});
|
|
4964
4934
|
}
|
|
4965
|
-
async function l(
|
|
4935
|
+
async function l(e2) {
|
|
4966
4936
|
return t$1.post("passengers", {
|
|
4967
|
-
body:
|
|
4937
|
+
body: e2
|
|
4968
4938
|
});
|
|
4969
4939
|
}
|
|
4970
|
-
async function f$1(
|
|
4940
|
+
async function f$1(e2) {
|
|
4971
4941
|
return t$1.get(
|
|
4972
|
-
`passengers/${
|
|
4942
|
+
`passengers/${e2}`
|
|
4973
4943
|
);
|
|
4974
4944
|
}
|
|
4975
|
-
async function g(
|
|
4945
|
+
async function g(e2, t2) {
|
|
4976
4946
|
return t$1.delete(
|
|
4977
|
-
`passengers/${
|
|
4947
|
+
`passengers/${e2}/${t2}`
|
|
4978
4948
|
);
|
|
4979
4949
|
}
|
|
4980
4950
|
const R = {
|
|
@@ -5175,11 +5145,11 @@ function is2DCanvasBlank(canvas) {
|
|
|
5175
5145
|
if (!ctx)
|
|
5176
5146
|
return true;
|
|
5177
5147
|
const chunkSize = 50;
|
|
5178
|
-
for (let
|
|
5148
|
+
for (let x2 = 0; x2 < canvas.width; x2 += chunkSize) {
|
|
5179
5149
|
for (let y2 = 0; y2 < canvas.height; y2 += chunkSize) {
|
|
5180
5150
|
const getImageData = ctx.getImageData;
|
|
5181
5151
|
const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
5182
|
-
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx,
|
|
5152
|
+
const pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x2, y2, Math.min(chunkSize, canvas.width - x2), Math.min(chunkSize, canvas.height - y2)).data.buffer);
|
|
5183
5153
|
if (pixelBuffer.some((pixel) => pixel !== 0))
|
|
5184
5154
|
return false;
|
|
5185
5155
|
}
|
|
@@ -5376,7 +5346,7 @@ function _isBlockedElement(element, blockClass, blockSelector) {
|
|
|
5376
5346
|
if (blockSelector) {
|
|
5377
5347
|
return element.matches(blockSelector);
|
|
5378
5348
|
}
|
|
5379
|
-
} catch (
|
|
5349
|
+
} catch (e2) {
|
|
5380
5350
|
}
|
|
5381
5351
|
return false;
|
|
5382
5352
|
}
|
|
@@ -5424,7 +5394,7 @@ function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors)
|
|
|
5424
5394
|
return true;
|
|
5425
5395
|
}
|
|
5426
5396
|
}
|
|
5427
|
-
} catch (
|
|
5397
|
+
} catch (e2) {
|
|
5428
5398
|
}
|
|
5429
5399
|
return false;
|
|
5430
5400
|
}
|
|
@@ -5713,7 +5683,7 @@ function serializeElementNode(n2, options) {
|
|
|
5713
5683
|
try {
|
|
5714
5684
|
if (customElements.get(tagName))
|
|
5715
5685
|
isCustomElement = true;
|
|
5716
|
-
} catch (
|
|
5686
|
+
} catch (e2) {
|
|
5717
5687
|
}
|
|
5718
5688
|
return {
|
|
5719
5689
|
type: NodeType.Element,
|
|
@@ -6139,7 +6109,7 @@ function isBlocked(node, blockClass, blockSelector, checkAncestors) {
|
|
|
6139
6109
|
if (classMatchesRegex(el, blockClass, checkAncestors))
|
|
6140
6110
|
return true;
|
|
6141
6111
|
}
|
|
6142
|
-
} catch (
|
|
6112
|
+
} catch (e2) {
|
|
6143
6113
|
}
|
|
6144
6114
|
if (blockSelector) {
|
|
6145
6115
|
if (el.matches(blockSelector))
|
|
@@ -6675,7 +6645,7 @@ class MutationBuffer {
|
|
|
6675
6645
|
if (!this.unattachedDoc) {
|
|
6676
6646
|
try {
|
|
6677
6647
|
this.unattachedDoc = document.implementation.createHTMLDocument();
|
|
6678
|
-
} catch (
|
|
6648
|
+
} catch (e2) {
|
|
6679
6649
|
this.unattachedDoc = this.doc;
|
|
6680
6650
|
}
|
|
6681
6651
|
}
|
|
@@ -7008,12 +6978,12 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror: mirror2
|
|
|
7008
6978
|
pointerType = currentPointerType;
|
|
7009
6979
|
currentPointerType = null;
|
|
7010
6980
|
}
|
|
7011
|
-
const
|
|
7012
|
-
if (!
|
|
6981
|
+
const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
6982
|
+
if (!e2) {
|
|
7013
6983
|
return;
|
|
7014
6984
|
}
|
|
7015
6985
|
const id = mirror2.getId(target);
|
|
7016
|
-
const { clientX, clientY } =
|
|
6986
|
+
const { clientX, clientY } = e2;
|
|
7017
6987
|
callbackWrapper(mouseInteractionCb)(Object.assign({ type: MouseInteractions[thisEventKey], id, x: clientX, y: clientY }, pointerType !== null && { pointerType }));
|
|
7018
6988
|
};
|
|
7019
6989
|
};
|
|
@@ -7354,7 +7324,7 @@ function initAdoptedStyleSheetObserver({ mirror: mirror2, stylesheetManager }, h
|
|
|
7354
7324
|
if (hostId !== null && hostId !== -1) {
|
|
7355
7325
|
try {
|
|
7356
7326
|
stylesheetManager.adoptStyleSheets(sheets, hostId);
|
|
7357
|
-
} catch (
|
|
7327
|
+
} catch (e2) {
|
|
7358
7328
|
}
|
|
7359
7329
|
}
|
|
7360
7330
|
return result;
|
|
@@ -7529,7 +7499,7 @@ function initCustomElementObserver({ doc, customElementCb }) {
|
|
|
7529
7499
|
name
|
|
7530
7500
|
}
|
|
7531
7501
|
});
|
|
7532
|
-
} catch (
|
|
7502
|
+
} catch (e2) {
|
|
7533
7503
|
console.warn(`Custom element callback failed for ${name}`);
|
|
7534
7504
|
}
|
|
7535
7505
|
return original.apply(this, [name, constructor, options]);
|
|
@@ -7803,18 +7773,18 @@ class IframeManager {
|
|
|
7803
7773
|
if (transformedEvent)
|
|
7804
7774
|
this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout);
|
|
7805
7775
|
}
|
|
7806
|
-
transformCrossOriginEvent(iframeEl,
|
|
7776
|
+
transformCrossOriginEvent(iframeEl, e2) {
|
|
7807
7777
|
var _a;
|
|
7808
|
-
switch (
|
|
7778
|
+
switch (e2.type) {
|
|
7809
7779
|
case EventType$1.FullSnapshot: {
|
|
7810
7780
|
this.crossOriginIframeMirror.reset(iframeEl);
|
|
7811
7781
|
this.crossOriginIframeStyleMirror.reset(iframeEl);
|
|
7812
|
-
this.replaceIdOnNode(
|
|
7813
|
-
const rootId =
|
|
7782
|
+
this.replaceIdOnNode(e2.data.node, iframeEl);
|
|
7783
|
+
const rootId = e2.data.node.id;
|
|
7814
7784
|
this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
|
|
7815
|
-
this.patchRootIdOnNode(
|
|
7785
|
+
this.patchRootIdOnNode(e2.data.node, rootId);
|
|
7816
7786
|
return {
|
|
7817
|
-
timestamp:
|
|
7787
|
+
timestamp: e2.timestamp,
|
|
7818
7788
|
type: EventType$1.IncrementalSnapshot,
|
|
7819
7789
|
data: {
|
|
7820
7790
|
source: IncrementalSource$1.Mutation,
|
|
@@ -7822,7 +7792,7 @@ class IframeManager {
|
|
|
7822
7792
|
{
|
|
7823
7793
|
parentId: this.mirror.getId(iframeEl),
|
|
7824
7794
|
nextId: null,
|
|
7825
|
-
node:
|
|
7795
|
+
node: e2.data.node
|
|
7826
7796
|
}
|
|
7827
7797
|
],
|
|
7828
7798
|
removes: [],
|
|
@@ -7838,16 +7808,16 @@ class IframeManager {
|
|
|
7838
7808
|
return false;
|
|
7839
7809
|
}
|
|
7840
7810
|
case EventType$1.Plugin: {
|
|
7841
|
-
return
|
|
7811
|
+
return e2;
|
|
7842
7812
|
}
|
|
7843
7813
|
case EventType$1.Custom: {
|
|
7844
|
-
this.replaceIds(
|
|
7845
|
-
return
|
|
7814
|
+
this.replaceIds(e2.data.payload, iframeEl, ["id", "parentId", "previousId", "nextId"]);
|
|
7815
|
+
return e2;
|
|
7846
7816
|
}
|
|
7847
7817
|
case EventType$1.IncrementalSnapshot: {
|
|
7848
|
-
switch (
|
|
7818
|
+
switch (e2.data.source) {
|
|
7849
7819
|
case IncrementalSource$1.Mutation: {
|
|
7850
|
-
|
|
7820
|
+
e2.data.adds.forEach((n2) => {
|
|
7851
7821
|
this.replaceIds(n2, iframeEl, [
|
|
7852
7822
|
"parentId",
|
|
7853
7823
|
"nextId",
|
|
@@ -7857,24 +7827,24 @@ class IframeManager {
|
|
|
7857
7827
|
const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);
|
|
7858
7828
|
rootId && this.patchRootIdOnNode(n2.node, rootId);
|
|
7859
7829
|
});
|
|
7860
|
-
|
|
7830
|
+
e2.data.removes.forEach((n2) => {
|
|
7861
7831
|
this.replaceIds(n2, iframeEl, ["parentId", "id"]);
|
|
7862
7832
|
});
|
|
7863
|
-
|
|
7833
|
+
e2.data.attributes.forEach((n2) => {
|
|
7864
7834
|
this.replaceIds(n2, iframeEl, ["id"]);
|
|
7865
7835
|
});
|
|
7866
|
-
|
|
7836
|
+
e2.data.texts.forEach((n2) => {
|
|
7867
7837
|
this.replaceIds(n2, iframeEl, ["id"]);
|
|
7868
7838
|
});
|
|
7869
|
-
return
|
|
7839
|
+
return e2;
|
|
7870
7840
|
}
|
|
7871
7841
|
case IncrementalSource$1.Drag:
|
|
7872
7842
|
case IncrementalSource$1.TouchMove:
|
|
7873
7843
|
case IncrementalSource$1.MouseMove: {
|
|
7874
|
-
|
|
7844
|
+
e2.data.positions.forEach((p2) => {
|
|
7875
7845
|
this.replaceIds(p2, iframeEl, ["id"]);
|
|
7876
7846
|
});
|
|
7877
|
-
return
|
|
7847
|
+
return e2;
|
|
7878
7848
|
}
|
|
7879
7849
|
case IncrementalSource$1.ViewportResize: {
|
|
7880
7850
|
return false;
|
|
@@ -7884,31 +7854,31 @@ class IframeManager {
|
|
|
7884
7854
|
case IncrementalSource$1.Scroll:
|
|
7885
7855
|
case IncrementalSource$1.CanvasMutation:
|
|
7886
7856
|
case IncrementalSource$1.Input: {
|
|
7887
|
-
this.replaceIds(
|
|
7888
|
-
return
|
|
7857
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
7858
|
+
return e2;
|
|
7889
7859
|
}
|
|
7890
7860
|
case IncrementalSource$1.StyleSheetRule:
|
|
7891
7861
|
case IncrementalSource$1.StyleDeclaration: {
|
|
7892
|
-
this.replaceIds(
|
|
7893
|
-
this.replaceStyleIds(
|
|
7894
|
-
return
|
|
7862
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
7863
|
+
this.replaceStyleIds(e2.data, iframeEl, ["styleId"]);
|
|
7864
|
+
return e2;
|
|
7895
7865
|
}
|
|
7896
7866
|
case IncrementalSource$1.Font: {
|
|
7897
|
-
return
|
|
7867
|
+
return e2;
|
|
7898
7868
|
}
|
|
7899
7869
|
case IncrementalSource$1.Selection: {
|
|
7900
|
-
|
|
7870
|
+
e2.data.ranges.forEach((range) => {
|
|
7901
7871
|
this.replaceIds(range, iframeEl, ["start", "end"]);
|
|
7902
7872
|
});
|
|
7903
|
-
return
|
|
7873
|
+
return e2;
|
|
7904
7874
|
}
|
|
7905
7875
|
case IncrementalSource$1.AdoptedStyleSheet: {
|
|
7906
|
-
this.replaceIds(
|
|
7907
|
-
this.replaceStyleIds(
|
|
7908
|
-
(_a =
|
|
7876
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
7877
|
+
this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]);
|
|
7878
|
+
(_a = e2.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
|
|
7909
7879
|
this.replaceStyleIds(style, iframeEl, ["styleId"]);
|
|
7910
7880
|
});
|
|
7911
|
-
return
|
|
7881
|
+
return e2;
|
|
7912
7882
|
}
|
|
7913
7883
|
}
|
|
7914
7884
|
}
|
|
@@ -8003,7 +7973,7 @@ class ShadowDomManager {
|
|
|
8003
7973
|
this.restoreHandlers.forEach((handler) => {
|
|
8004
7974
|
try {
|
|
8005
7975
|
handler();
|
|
8006
|
-
} catch (
|
|
7976
|
+
} catch (e2) {
|
|
8007
7977
|
}
|
|
8008
7978
|
});
|
|
8009
7979
|
this.restoreHandlers = [];
|
|
@@ -8024,13 +7994,13 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
8024
7994
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
8025
7995
|
PERFORMANCE OF THIS SOFTWARE.
|
|
8026
7996
|
***************************************************************************** */
|
|
8027
|
-
function __rest(s2,
|
|
7997
|
+
function __rest(s2, e2) {
|
|
8028
7998
|
var t2 = {};
|
|
8029
|
-
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) &&
|
|
7999
|
+
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0)
|
|
8030
8000
|
t2[p2] = s2[p2];
|
|
8031
8001
|
if (s2 != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8032
8002
|
for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
|
|
8033
|
-
if (
|
|
8003
|
+
if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i]))
|
|
8034
8004
|
t2[p2[i]] = s2[p2[i]];
|
|
8035
8005
|
}
|
|
8036
8006
|
return t2;
|
|
@@ -8045,15 +8015,15 @@ function __awaiter(thisArg, _arguments, P2, generator) {
|
|
|
8045
8015
|
function fulfilled(value) {
|
|
8046
8016
|
try {
|
|
8047
8017
|
step(generator.next(value));
|
|
8048
|
-
} catch (
|
|
8049
|
-
reject(
|
|
8018
|
+
} catch (e2) {
|
|
8019
|
+
reject(e2);
|
|
8050
8020
|
}
|
|
8051
8021
|
}
|
|
8052
8022
|
function rejected(value) {
|
|
8053
8023
|
try {
|
|
8054
8024
|
step(generator["throw"](value));
|
|
8055
|
-
} catch (
|
|
8056
|
-
reject(
|
|
8025
|
+
} catch (e2) {
|
|
8026
|
+
reject(e2);
|
|
8057
8027
|
}
|
|
8058
8028
|
}
|
|
8059
8029
|
function step(result) {
|
|
@@ -8374,15 +8344,15 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8374
8344
|
function fulfilled(value) {
|
|
8375
8345
|
try {
|
|
8376
8346
|
step(generator.next(value));
|
|
8377
|
-
} catch (
|
|
8378
|
-
reject(
|
|
8347
|
+
} catch (e2) {
|
|
8348
|
+
reject(e2);
|
|
8379
8349
|
}
|
|
8380
8350
|
}
|
|
8381
8351
|
function rejected(value) {
|
|
8382
8352
|
try {
|
|
8383
8353
|
step(generator["throw"](value));
|
|
8384
|
-
} catch (
|
|
8385
|
-
reject(
|
|
8354
|
+
} catch (e2) {
|
|
8355
|
+
reject(e2);
|
|
8386
8356
|
}
|
|
8387
8357
|
}
|
|
8388
8358
|
function step(result) {
|
|
@@ -8432,10 +8402,10 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8432
8402
|
});
|
|
8433
8403
|
}
|
|
8434
8404
|
const worker = self;
|
|
8435
|
-
worker.onmessage = function(
|
|
8405
|
+
worker.onmessage = function(e2) {
|
|
8436
8406
|
return __awaiter2(this, void 0, void 0, function* () {
|
|
8437
8407
|
if ("OffscreenCanvas" in globalThis) {
|
|
8438
|
-
const { id, bitmap, width, height, dataURLOptions } =
|
|
8408
|
+
const { id, bitmap, width, height, dataURLOptions } = e2.data;
|
|
8439
8409
|
const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
|
|
8440
8410
|
const offscreen = new OffscreenCanvas(width, height);
|
|
8441
8411
|
const ctx = offscreen.getContext("2d");
|
|
@@ -8460,7 +8430,7 @@ var WorkerFactory = createInlineWorkerFactory(
|
|
|
8460
8430
|
});
|
|
8461
8431
|
lastBlobMap.set(id, base64);
|
|
8462
8432
|
} else {
|
|
8463
|
-
return worker.postMessage({ id:
|
|
8433
|
+
return worker.postMessage({ id: e2.data.id });
|
|
8464
8434
|
}
|
|
8465
8435
|
});
|
|
8466
8436
|
};
|
|
@@ -8512,12 +8482,12 @@ class CanvasManager {
|
|
|
8512
8482
|
const canvasContextReset = initCanvasContextObserver(win2, blockClass, blockSelector, true);
|
|
8513
8483
|
const snapshotInProgressMap = /* @__PURE__ */ new Map();
|
|
8514
8484
|
const worker = new WorkerFactory();
|
|
8515
|
-
worker.onmessage = (
|
|
8516
|
-
const { id } =
|
|
8485
|
+
worker.onmessage = (e2) => {
|
|
8486
|
+
const { id } = e2.data;
|
|
8517
8487
|
snapshotInProgressMap.set(id, false);
|
|
8518
|
-
if (!("base64" in
|
|
8488
|
+
if (!("base64" in e2.data))
|
|
8519
8489
|
return;
|
|
8520
|
-
const { base64, type, width, height } =
|
|
8490
|
+
const { base64, type, width, height } = e2.data;
|
|
8521
8491
|
this.mutationCb({
|
|
8522
8492
|
id,
|
|
8523
8493
|
type: CanvasContext["2D"],
|
|
@@ -8729,8 +8699,8 @@ class ProcessedNodeManager {
|
|
|
8729
8699
|
this.loop = false;
|
|
8730
8700
|
}
|
|
8731
8701
|
}
|
|
8732
|
-
function wrapEvent(
|
|
8733
|
-
return Object.assign(Object.assign({},
|
|
8702
|
+
function wrapEvent(e2) {
|
|
8703
|
+
return Object.assign(Object.assign({}, e2), { timestamp: nowTimestamp() });
|
|
8734
8704
|
}
|
|
8735
8705
|
let wrappedEmit;
|
|
8736
8706
|
let takeFullSnapshot;
|
|
@@ -8747,7 +8717,7 @@ function record(options = {}) {
|
|
|
8747
8717
|
if (window.parent.document) {
|
|
8748
8718
|
passEmitsToParent = false;
|
|
8749
8719
|
}
|
|
8750
|
-
} catch (
|
|
8720
|
+
} catch (e2) {
|
|
8751
8721
|
passEmitsToParent = true;
|
|
8752
8722
|
}
|
|
8753
8723
|
}
|
|
@@ -8791,43 +8761,43 @@ function record(options = {}) {
|
|
|
8791
8761
|
polyfill();
|
|
8792
8762
|
let lastFullSnapshotEvent;
|
|
8793
8763
|
let incrementalSnapshotCount = 0;
|
|
8794
|
-
const eventProcessor = (
|
|
8764
|
+
const eventProcessor = (e2) => {
|
|
8795
8765
|
for (const plugin of plugins || []) {
|
|
8796
8766
|
if (plugin.eventProcessor) {
|
|
8797
|
-
|
|
8767
|
+
e2 = plugin.eventProcessor(e2);
|
|
8798
8768
|
}
|
|
8799
8769
|
}
|
|
8800
8770
|
if (packFn && !passEmitsToParent) {
|
|
8801
|
-
|
|
8771
|
+
e2 = packFn(e2);
|
|
8802
8772
|
}
|
|
8803
|
-
return
|
|
8773
|
+
return e2;
|
|
8804
8774
|
};
|
|
8805
|
-
wrappedEmit = (
|
|
8775
|
+
wrappedEmit = (e2, isCheckout) => {
|
|
8806
8776
|
var _a;
|
|
8807
|
-
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
|
|
8777
|
+
if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) && e2.type !== EventType$1.FullSnapshot && !(e2.type === EventType$1.IncrementalSnapshot && e2.data.source === IncrementalSource$1.Mutation)) {
|
|
8808
8778
|
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
8809
8779
|
}
|
|
8810
8780
|
if (inEmittingFrame) {
|
|
8811
|
-
emit === null || emit === void 0 ? void 0 : emit(eventProcessor(
|
|
8781
|
+
emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e2), isCheckout);
|
|
8812
8782
|
} else if (passEmitsToParent) {
|
|
8813
8783
|
const message = {
|
|
8814
8784
|
type: "rrweb",
|
|
8815
|
-
event: eventProcessor(
|
|
8785
|
+
event: eventProcessor(e2),
|
|
8816
8786
|
origin: window.location.origin,
|
|
8817
8787
|
isCheckout
|
|
8818
8788
|
};
|
|
8819
8789
|
window.parent.postMessage(message, "*");
|
|
8820
8790
|
}
|
|
8821
|
-
if (
|
|
8822
|
-
lastFullSnapshotEvent =
|
|
8791
|
+
if (e2.type === EventType$1.FullSnapshot) {
|
|
8792
|
+
lastFullSnapshotEvent = e2;
|
|
8823
8793
|
incrementalSnapshotCount = 0;
|
|
8824
|
-
} else if (
|
|
8825
|
-
if (
|
|
8794
|
+
} else if (e2.type === EventType$1.IncrementalSnapshot) {
|
|
8795
|
+
if (e2.data.source === IncrementalSource$1.Mutation && e2.data.isAttachIframe) {
|
|
8826
8796
|
return;
|
|
8827
8797
|
}
|
|
8828
8798
|
incrementalSnapshotCount++;
|
|
8829
8799
|
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
8830
|
-
const exceedTime = checkoutEveryNms &&
|
|
8800
|
+
const exceedTime = checkoutEveryNms && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
8831
8801
|
if (exceedCount || exceedTime) {
|
|
8832
8802
|
takeFullSnapshot(true);
|
|
8833
8803
|
}
|
|
@@ -9316,7 +9286,7 @@ _.isArray = nativeIsArray || function(obj) {
|
|
|
9316
9286
|
_.isFunction = function(f2) {
|
|
9317
9287
|
try {
|
|
9318
9288
|
return /^\s*\bfunction\b/.test(f2);
|
|
9319
|
-
} catch (
|
|
9289
|
+
} catch (x2) {
|
|
9320
9290
|
return false;
|
|
9321
9291
|
}
|
|
9322
9292
|
};
|
|
@@ -9558,10 +9528,10 @@ _.JSONDecode = function() {
|
|
|
9558
9528
|
"r": "\r",
|
|
9559
9529
|
"t": " "
|
|
9560
9530
|
}, text, error = function(m2) {
|
|
9561
|
-
var
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
throw
|
|
9531
|
+
var e2 = new SyntaxError(m2);
|
|
9532
|
+
e2.at = at;
|
|
9533
|
+
e2.text = text;
|
|
9534
|
+
throw e2;
|
|
9565
9535
|
}, next = function(c2) {
|
|
9566
9536
|
if (c2 && c2 !== ch) {
|
|
9567
9537
|
error("Expected '" + c2 + "' instead of '" + ch + "'");
|
|
@@ -10088,8 +10058,8 @@ _.register_event = function() {
|
|
|
10088
10058
|
}();
|
|
10089
10059
|
var TOKEN_MATCH_REGEX = new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');
|
|
10090
10060
|
_.dom_query = /* @__PURE__ */ function() {
|
|
10091
|
-
function getAllChildren(
|
|
10092
|
-
return
|
|
10061
|
+
function getAllChildren(e2) {
|
|
10062
|
+
return e2.all ? e2.all : e2.getElementsByTagName("*");
|
|
10093
10063
|
}
|
|
10094
10064
|
var bad_whitespace = /[\t\r\n]/g;
|
|
10095
10065
|
function hasClass(elem, selector) {
|
|
@@ -10171,38 +10141,38 @@ _.dom_query = /* @__PURE__ */ function() {
|
|
|
10171
10141
|
var checkFunction;
|
|
10172
10142
|
switch (attrOperator) {
|
|
10173
10143
|
case "=":
|
|
10174
|
-
checkFunction = function(
|
|
10175
|
-
return
|
|
10144
|
+
checkFunction = function(e2) {
|
|
10145
|
+
return e2.getAttribute(attrName) == attrValue;
|
|
10176
10146
|
};
|
|
10177
10147
|
break;
|
|
10178
10148
|
case "~":
|
|
10179
|
-
checkFunction = function(
|
|
10180
|
-
return
|
|
10149
|
+
checkFunction = function(e2) {
|
|
10150
|
+
return e2.getAttribute(attrName).match(new RegExp("\\b" + attrValue + "\\b"));
|
|
10181
10151
|
};
|
|
10182
10152
|
break;
|
|
10183
10153
|
case "|":
|
|
10184
|
-
checkFunction = function(
|
|
10185
|
-
return
|
|
10154
|
+
checkFunction = function(e2) {
|
|
10155
|
+
return e2.getAttribute(attrName).match(new RegExp("^" + attrValue + "-?"));
|
|
10186
10156
|
};
|
|
10187
10157
|
break;
|
|
10188
10158
|
case "^":
|
|
10189
|
-
checkFunction = function(
|
|
10190
|
-
return
|
|
10159
|
+
checkFunction = function(e2) {
|
|
10160
|
+
return e2.getAttribute(attrName).indexOf(attrValue) === 0;
|
|
10191
10161
|
};
|
|
10192
10162
|
break;
|
|
10193
10163
|
case "$":
|
|
10194
|
-
checkFunction = function(
|
|
10195
|
-
return
|
|
10164
|
+
checkFunction = function(e2) {
|
|
10165
|
+
return e2.getAttribute(attrName).lastIndexOf(attrValue) == e2.getAttribute(attrName).length - attrValue.length;
|
|
10196
10166
|
};
|
|
10197
10167
|
break;
|
|
10198
10168
|
case "*":
|
|
10199
|
-
checkFunction = function(
|
|
10200
|
-
return
|
|
10169
|
+
checkFunction = function(e2) {
|
|
10170
|
+
return e2.getAttribute(attrName).indexOf(attrValue) > -1;
|
|
10201
10171
|
};
|
|
10202
10172
|
break;
|
|
10203
10173
|
default:
|
|
10204
|
-
checkFunction = function(
|
|
10205
|
-
return
|
|
10174
|
+
checkFunction = function(e2) {
|
|
10175
|
+
return e2.getAttribute(attrName);
|
|
10206
10176
|
};
|
|
10207
10177
|
}
|
|
10208
10178
|
currentContext = [];
|
|
@@ -11395,11 +11365,11 @@ DomTracker.prototype.track = function(query, event_name, properties, user_callba
|
|
|
11395
11365
|
return;
|
|
11396
11366
|
}
|
|
11397
11367
|
_.each(elements, function(element) {
|
|
11398
|
-
_.register_event(element, this.override_event, function(
|
|
11368
|
+
_.register_event(element, this.override_event, function(e2) {
|
|
11399
11369
|
var options = {};
|
|
11400
11370
|
var props = that.create_properties(properties, this);
|
|
11401
11371
|
var timeout = that.mp.get_config("track_links_timeout");
|
|
11402
|
-
that.event_handler(
|
|
11372
|
+
that.event_handler(e2, this, options);
|
|
11403
11373
|
window.setTimeout(that.track_callback(user_callback, props, options, true), timeout);
|
|
11404
11374
|
that.mp.track(event_name, props, that.track_callback(user_callback, props, options));
|
|
11405
11375
|
});
|
|
@@ -12215,8 +12185,8 @@ var load_extra_bundle = function(src, _onload) {
|
|
|
12215
12185
|
var mixpanel_master;
|
|
12216
12186
|
var INIT_MODULE = 0;
|
|
12217
12187
|
var INIT_SNIPPET = 1;
|
|
12218
|
-
var IDENTITY_FUNC = function(
|
|
12219
|
-
return
|
|
12188
|
+
var IDENTITY_FUNC = function(x2) {
|
|
12189
|
+
return x2;
|
|
12220
12190
|
};
|
|
12221
12191
|
var NOOP_FUNC = function() {
|
|
12222
12192
|
};
|
|
@@ -12624,16 +12594,16 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12624
12594
|
} else if (use_sendBeacon) {
|
|
12625
12595
|
try {
|
|
12626
12596
|
succeeded = sendBeacon(url, body_data);
|
|
12627
|
-
} catch (
|
|
12628
|
-
lib.report_error(
|
|
12597
|
+
} catch (e2) {
|
|
12598
|
+
lib.report_error(e2);
|
|
12629
12599
|
succeeded = false;
|
|
12630
12600
|
}
|
|
12631
12601
|
try {
|
|
12632
12602
|
if (callback) {
|
|
12633
12603
|
callback(succeeded ? 1 : 0);
|
|
12634
12604
|
}
|
|
12635
|
-
} catch (
|
|
12636
|
-
lib.report_error(
|
|
12605
|
+
} catch (e2) {
|
|
12606
|
+
lib.report_error(e2);
|
|
12637
12607
|
}
|
|
12638
12608
|
} else if (USE_XHR) {
|
|
12639
12609
|
try {
|
|
@@ -12659,8 +12629,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12659
12629
|
var response;
|
|
12660
12630
|
try {
|
|
12661
12631
|
response = _.JSONDecode(req.responseText);
|
|
12662
|
-
} catch (
|
|
12663
|
-
lib.report_error(
|
|
12632
|
+
} catch (e2) {
|
|
12633
|
+
lib.report_error(e2);
|
|
12664
12634
|
if (options.ignore_json_errors) {
|
|
12665
12635
|
response = req.responseText;
|
|
12666
12636
|
} else {
|
|
@@ -12692,8 +12662,8 @@ MixpanelLib.prototype._send_request = function(url, data, options, callback) {
|
|
|
12692
12662
|
}
|
|
12693
12663
|
};
|
|
12694
12664
|
req.send(body_data);
|
|
12695
|
-
} catch (
|
|
12696
|
-
lib.report_error(
|
|
12665
|
+
} catch (e2) {
|
|
12666
|
+
lib.report_error(e2);
|
|
12697
12667
|
succeeded = false;
|
|
12698
12668
|
}
|
|
12699
12669
|
} else {
|
|
@@ -13387,7 +13357,7 @@ var add_dom_loaded_handler = function() {
|
|
|
13387
13357
|
function do_scroll_check() {
|
|
13388
13358
|
try {
|
|
13389
13359
|
document$1.documentElement.doScroll("left");
|
|
13390
|
-
} catch (
|
|
13360
|
+
} catch (e2) {
|
|
13391
13361
|
setTimeout(do_scroll_check, 1);
|
|
13392
13362
|
return;
|
|
13393
13363
|
}
|
|
@@ -13404,7 +13374,7 @@ var add_dom_loaded_handler = function() {
|
|
|
13404
13374
|
var toplevel = false;
|
|
13405
13375
|
try {
|
|
13406
13376
|
toplevel = win.frameElement === null;
|
|
13407
|
-
} catch (
|
|
13377
|
+
} catch (e2) {
|
|
13408
13378
|
}
|
|
13409
13379
|
if (document$1.documentElement.doScroll && toplevel) {
|
|
13410
13380
|
do_scroll_check();
|
|
@@ -13425,7 +13395,7 @@ function loadNoop(_src, onload) {
|
|
|
13425
13395
|
onload();
|
|
13426
13396
|
}
|
|
13427
13397
|
var mixpanel = init_as_module(loadNoop);
|
|
13428
|
-
const version = "1.0.
|
|
13398
|
+
const version = "1.0.22-alpha.0";
|
|
13429
13399
|
const MIXPANEL_DISTINCT_ID_CACHE_KEY = "mp_distinct_id";
|
|
13430
13400
|
function init$2(mixpanelToken, debug = false, proxyUrl) {
|
|
13431
13401
|
return new Promise((resolve) => {
|
|
@@ -13450,6 +13420,12 @@ function attachProperty(key, value) {
|
|
|
13450
13420
|
}
|
|
13451
13421
|
mixpanel.people.union(key, [value]);
|
|
13452
13422
|
}
|
|
13423
|
+
function setPeopleProperties(properties) {
|
|
13424
|
+
if (!isReady()) {
|
|
13425
|
+
return;
|
|
13426
|
+
}
|
|
13427
|
+
mixpanel.people.set(properties);
|
|
13428
|
+
}
|
|
13453
13429
|
function isReady() {
|
|
13454
13430
|
return window.mixpanel !== void 0;
|
|
13455
13431
|
}
|
|
@@ -13479,8 +13455,18 @@ const mixpanelService = {
|
|
|
13479
13455
|
track,
|
|
13480
13456
|
identify: identify$1,
|
|
13481
13457
|
attachProperty,
|
|
13458
|
+
setPeopleProperties,
|
|
13482
13459
|
getMixpanelDistinctId
|
|
13483
13460
|
};
|
|
13461
|
+
const geolocationSelectedSchema = z.object({
|
|
13462
|
+
"Selected City": z.string().min(1, "Selected city is required"),
|
|
13463
|
+
"Selected Country Code": z.string().min(1, "Selected Country Code is required")
|
|
13464
|
+
});
|
|
13465
|
+
const EVENT_NAME$a = "Geolocation Selected";
|
|
13466
|
+
function trackGeolocationSelected(eventData, meta = {}) {
|
|
13467
|
+
trackEvent(EVENT_NAME$a, eventData, meta);
|
|
13468
|
+
mixpanelService.setPeopleProperties(eventData);
|
|
13469
|
+
}
|
|
13484
13470
|
const IdentifySchema = z.object({
|
|
13485
13471
|
firstName: z.string().optional(),
|
|
13486
13472
|
lastName: z.string().optional(),
|
|
@@ -13790,7 +13776,8 @@ const eventSchemas = {
|
|
|
13790
13776
|
"Interest In Search": interestInSearchSchema,
|
|
13791
13777
|
"View Results": viewResultsSchema,
|
|
13792
13778
|
"Purchase Attempt": purchaseAttemptSchema,
|
|
13793
|
-
"Picked Departure": pickedDepartureSchema
|
|
13779
|
+
"Picked Departure": pickedDepartureSchema,
|
|
13780
|
+
"Geolocation Selected": geolocationSelectedSchema
|
|
13794
13781
|
};
|
|
13795
13782
|
function parseEventProps(eventName, eventData) {
|
|
13796
13783
|
const eventSchema = eventSchemas[eventName] || customEventSchema;
|
|
@@ -13840,7 +13827,6 @@ async function init$1(config) {
|
|
|
13840
13827
|
mixpanelProxyUrl,
|
|
13841
13828
|
identifyProxyUrl
|
|
13842
13829
|
} = config;
|
|
13843
|
-
geolocationService.init();
|
|
13844
13830
|
await mixpanelService.init(mixpanelToken, debug, mixpanelProxyUrl);
|
|
13845
13831
|
try {
|
|
13846
13832
|
await fingerprintService.initFingerprint(
|
|
@@ -13850,6 +13836,7 @@ async function init$1(config) {
|
|
|
13850
13836
|
} catch (error) {
|
|
13851
13837
|
console.error("Error initializing identification service:", error);
|
|
13852
13838
|
}
|
|
13839
|
+
geolocationService.init();
|
|
13853
13840
|
configService.setEnvironment(isSandbox ? "sandbox" : "prod");
|
|
13854
13841
|
f.setConfig(configService.getCoreAPIConfig());
|
|
13855
13842
|
onLoaded();
|
|
@@ -13859,47 +13846,164 @@ function isTrackerReady() {
|
|
|
13859
13846
|
}
|
|
13860
13847
|
let currentCoordinates = null;
|
|
13861
13848
|
const GEOLOCATION_PERMISSION_KEY = "geolocationPermissionTimestamp";
|
|
13849
|
+
const GEOLOCATION_CACHE_KEY = "geolocationCache";
|
|
13850
|
+
const GEOLOCATION_TRACK_EVENT = "Geolocation Requested";
|
|
13862
13851
|
const SEVEN_DAYS_IN_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
13852
|
+
const GEOLOCATION_REQUEST_TIMEOUT_MS = 1e4;
|
|
13853
|
+
const GEOLOCATION_OPTIONS = {
|
|
13854
|
+
enableHighAccuracy: true,
|
|
13855
|
+
timeout: GEOLOCATION_REQUEST_TIMEOUT_MS,
|
|
13856
|
+
maximumAge: 0
|
|
13857
|
+
};
|
|
13858
|
+
function safeGetItem(key) {
|
|
13859
|
+
try {
|
|
13860
|
+
return localStorage.getItem(key);
|
|
13861
|
+
} catch {
|
|
13862
|
+
return null;
|
|
13863
|
+
}
|
|
13864
|
+
}
|
|
13865
|
+
function safeSetItem(key, value) {
|
|
13866
|
+
try {
|
|
13867
|
+
localStorage.setItem(key, value);
|
|
13868
|
+
} catch {
|
|
13869
|
+
}
|
|
13870
|
+
}
|
|
13871
|
+
function toISO(timestamp) {
|
|
13872
|
+
return new Date(timestamp).toISOString();
|
|
13873
|
+
}
|
|
13874
|
+
function isGeolocationCache(value) {
|
|
13875
|
+
if (typeof value !== "object" || value === null) {
|
|
13876
|
+
return false;
|
|
13877
|
+
}
|
|
13878
|
+
const cache = value;
|
|
13879
|
+
return typeof cache.lat === "number" && typeof cache.long === "number" && typeof cache.updatedAt === "string" && (cache.accuracy === void 0 || typeof cache.accuracy === "number");
|
|
13880
|
+
}
|
|
13881
|
+
function loadCoordinatesFromStorage() {
|
|
13882
|
+
const raw = safeGetItem(GEOLOCATION_CACHE_KEY);
|
|
13883
|
+
if (!raw) {
|
|
13884
|
+
return null;
|
|
13885
|
+
}
|
|
13886
|
+
try {
|
|
13887
|
+
const parsed = JSON.parse(raw);
|
|
13888
|
+
return isGeolocationCache(parsed) ? parsed : null;
|
|
13889
|
+
} catch {
|
|
13890
|
+
return null;
|
|
13891
|
+
}
|
|
13892
|
+
}
|
|
13893
|
+
function saveCoordinatesToStorage(coords, updatedAt, accuracy) {
|
|
13894
|
+
safeSetItem(
|
|
13895
|
+
GEOLOCATION_CACHE_KEY,
|
|
13896
|
+
JSON.stringify({
|
|
13897
|
+
lat: coords.lat,
|
|
13898
|
+
long: coords.long,
|
|
13899
|
+
updatedAt,
|
|
13900
|
+
...accuracy !== void 0 && { accuracy }
|
|
13901
|
+
})
|
|
13902
|
+
);
|
|
13903
|
+
}
|
|
13904
|
+
function restoreCoordinatesFromStorage() {
|
|
13905
|
+
const cache = loadCoordinatesFromStorage();
|
|
13906
|
+
if (cache) {
|
|
13907
|
+
currentCoordinates = { lat: cache.lat, long: cache.long };
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13863
13910
|
function isPermissionTimestampValid(lastPermissionTimestamp) {
|
|
13864
13911
|
if (!lastPermissionTimestamp) return false;
|
|
13865
13912
|
const now = Date.now();
|
|
13866
13913
|
return now - parseInt(lastPermissionTimestamp, 10) < SEVEN_DAYS_IN_MS;
|
|
13867
13914
|
}
|
|
13868
13915
|
function updatePermissionTimestamp(timestamp) {
|
|
13869
|
-
|
|
13916
|
+
safeSetItem(GEOLOCATION_PERMISSION_KEY, timestamp.toString());
|
|
13917
|
+
}
|
|
13918
|
+
function getGeolocationStatus(error) {
|
|
13919
|
+
return error.code === error.PERMISSION_DENIED ? "denied" : "error";
|
|
13920
|
+
}
|
|
13921
|
+
function buildGeolocationEventProperties(data) {
|
|
13922
|
+
const properties = {
|
|
13923
|
+
"Geolocation Updated At": data.updatedAt,
|
|
13924
|
+
"Geolocation Status": data.status
|
|
13925
|
+
};
|
|
13926
|
+
if (data.accuracy !== void 0) {
|
|
13927
|
+
properties["Geolocation Accuracy"] = data.accuracy;
|
|
13928
|
+
}
|
|
13929
|
+
if (data.errorCode !== void 0) {
|
|
13930
|
+
properties["Geolocation Error Code"] = data.errorCode;
|
|
13931
|
+
}
|
|
13932
|
+
const coordinates = getCoordinates();
|
|
13933
|
+
if (coordinates) {
|
|
13934
|
+
properties.$latitude = coordinates.lat;
|
|
13935
|
+
properties.$longitude = coordinates.long;
|
|
13936
|
+
}
|
|
13937
|
+
return properties;
|
|
13938
|
+
}
|
|
13939
|
+
function buildGeolocationProfileProperties(data) {
|
|
13940
|
+
const properties = {
|
|
13941
|
+
"Geolocation Updated At": data.updatedAt,
|
|
13942
|
+
"Geolocation Status": data.status
|
|
13943
|
+
};
|
|
13944
|
+
const coordinates = getCoordinates();
|
|
13945
|
+
if (coordinates) {
|
|
13946
|
+
properties.$latitude = coordinates.lat;
|
|
13947
|
+
properties.$longitude = coordinates.long;
|
|
13948
|
+
}
|
|
13949
|
+
return properties;
|
|
13950
|
+
}
|
|
13951
|
+
function syncGeolocationToMixpanel(data) {
|
|
13952
|
+
if (!isTrackerReady()) {
|
|
13953
|
+
return;
|
|
13954
|
+
}
|
|
13955
|
+
const eventProperties = buildGeolocationEventProperties(data);
|
|
13956
|
+
const profileProperties = buildGeolocationProfileProperties(data);
|
|
13957
|
+
trackCustomEvent(GEOLOCATION_TRACK_EVENT, eventProperties);
|
|
13958
|
+
mixpanelService.setPeopleProperties(profileProperties);
|
|
13870
13959
|
}
|
|
13871
13960
|
function init() {
|
|
13961
|
+
restoreCoordinatesFromStorage();
|
|
13872
13962
|
return new Promise((resolve) => {
|
|
13873
|
-
|
|
13874
|
-
|
|
13875
|
-
);
|
|
13963
|
+
var _a;
|
|
13964
|
+
const lastPermissionTimestamp = safeGetItem(GEOLOCATION_PERMISSION_KEY);
|
|
13876
13965
|
if (isPermissionTimestampValid(lastPermissionTimestamp)) {
|
|
13966
|
+
const cache = loadCoordinatesFromStorage();
|
|
13967
|
+
const updatedAt2 = (cache == null ? void 0 : cache.updatedAt) ?? (lastPermissionTimestamp ? toISO(parseInt(lastPermissionTimestamp, 10)) : (/* @__PURE__ */ new Date()).toISOString());
|
|
13968
|
+
syncGeolocationToMixpanel({
|
|
13969
|
+
status: "skipped_cache",
|
|
13970
|
+
updatedAt: updatedAt2,
|
|
13971
|
+
accuracy: cache == null ? void 0 : cache.accuracy
|
|
13972
|
+
});
|
|
13877
13973
|
resolve(currentCoordinates);
|
|
13878
13974
|
return;
|
|
13879
13975
|
}
|
|
13880
|
-
const GEOLOCATION_TRACK_EVENT = "Geolocation Requested";
|
|
13881
13976
|
const now = Date.now();
|
|
13977
|
+
const updatedAt = toISO(now);
|
|
13978
|
+
if (!((_a = navigator.geolocation) == null ? void 0 : _a.getCurrentPosition)) {
|
|
13979
|
+
syncGeolocationToMixpanel({ status: "error", updatedAt });
|
|
13980
|
+
resolve(null);
|
|
13981
|
+
return;
|
|
13982
|
+
}
|
|
13882
13983
|
navigator.geolocation.getCurrentPosition(
|
|
13883
13984
|
(geolocation) => {
|
|
13884
|
-
const { latitude: lat, longitude: long } = geolocation.coords;
|
|
13985
|
+
const { latitude: lat, longitude: long, accuracy } = geolocation.coords;
|
|
13885
13986
|
currentCoordinates = { lat, long };
|
|
13987
|
+
saveCoordinatesToStorage(currentCoordinates, updatedAt, accuracy);
|
|
13886
13988
|
updatePermissionTimestamp(now);
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
}
|
|
13989
|
+
syncGeolocationToMixpanel({
|
|
13990
|
+
status: "granted",
|
|
13991
|
+
updatedAt,
|
|
13992
|
+
accuracy
|
|
13993
|
+
});
|
|
13892
13994
|
resolve(currentCoordinates);
|
|
13893
13995
|
},
|
|
13894
|
-
() => {
|
|
13996
|
+
(error) => {
|
|
13997
|
+
const status = getGeolocationStatus(error);
|
|
13895
13998
|
updatePermissionTimestamp(now);
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
}
|
|
13999
|
+
syncGeolocationToMixpanel({
|
|
14000
|
+
status,
|
|
14001
|
+
updatedAt,
|
|
14002
|
+
errorCode: error.code
|
|
14003
|
+
});
|
|
13901
14004
|
resolve(null);
|
|
13902
|
-
}
|
|
14005
|
+
},
|
|
14006
|
+
GEOLOCATION_OPTIONS
|
|
13903
14007
|
);
|
|
13904
14008
|
});
|
|
13905
14009
|
}
|
|
@@ -14402,7 +14506,8 @@ const analytics = {
|
|
|
14402
14506
|
purchaseAttempt: trackPurchaseAttempt,
|
|
14403
14507
|
pickedDeparture: trackSearch$1,
|
|
14404
14508
|
customEvent: trackCustomEvent,
|
|
14405
|
-
purchaseCanceled: trackPurchaseCanceled
|
|
14509
|
+
purchaseCanceled: trackPurchaseCanceled,
|
|
14510
|
+
geolocationSelected: trackGeolocationSelected
|
|
14406
14511
|
}
|
|
14407
14512
|
};
|
|
14408
14513
|
export {
|