@rudderstack/analytics-js 3.0.0-beta.5 → 3.0.0-beta.8
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 +41 -3
- package/dist/npm/index.d.ts +1229 -0
- package/{legacy → dist/npm/legacy}/cjs/index.js +693 -816
- package/{legacy → dist/npm/legacy}/esm/index.js +693 -816
- package/{legacy → dist/npm/legacy}/umd/index.js +693 -816
- package/{modern → dist/npm/modern}/cjs/index.js +191 -312
- package/{modern → dist/npm/modern}/esm/index.js +191 -312
- package/{modern → dist/npm/modern}/umd/index.js +191 -312
- package/package.json +28 -113
- package/index.d.ts +0 -387
@@ -4,347 +4,355 @@ var UaChTrackLevel=/*#__PURE__*/function(UaChTrackLevel){UaChTrackLevel["None"]=
|
|
4
4
|
* Represents the options parameter for anonymousId
|
5
5
|
*/ /**
|
6
6
|
* Represents the beacon queue options parameter in loadOptions type
|
7
|
-
*/
|
7
|
+
*/ /**
|
8
8
|
* Represents the queue options parameter in loadOptions type
|
9
9
|
*/ /**
|
10
10
|
* Represents the destinations queue options parameter in loadOptions type
|
11
|
-
*/
|
11
|
+
*/var DeliveryType=/*#__PURE__*/function(DeliveryType){DeliveryType["Immediate"]="immediate";DeliveryType["Buffer"]="buffer";return DeliveryType;}({});var StorageStrategy=/*#__PURE__*/function(StorageStrategy){StorageStrategy["None"]="none";StorageStrategy["Session"]="session";StorageStrategy["AnonymousId"]="anonymousId";return StorageStrategy;}({});/**
|
12
12
|
* Represents the options parameter in the load API
|
13
13
|
*/
|
14
14
|
|
15
|
+
var StorageEncryptionVersion=/*#__PURE__*/function(StorageEncryptionVersion){StorageEncryptionVersion["Legacy"]="legacy";StorageEncryptionVersion["V3"]="v3";return StorageEncryptionVersion;}({});// default
|
16
|
+
var SUPPORTED_STORAGE_TYPES=['localStorage','memoryStorage','cookieStorage','sessionStorage','none'];var DEFAULT_STORAGE_TYPE='cookieStorage';var CookieSameSite=/*#__PURE__*/function(CookieSameSite){CookieSameSite["Strict"]="Strict";CookieSameSite["Lax"]="Lax";CookieSameSite["None"]="None";return CookieSameSite;}({});
|
17
|
+
|
15
18
|
/**
|
16
19
|
* Represents residency server input the options
|
17
20
|
*/var ResidencyServerRegion=/*#__PURE__*/function(ResidencyServerRegion){ResidencyServerRegion["US"]="US";ResidencyServerRegion["EU"]="EU";return ResidencyServerRegion;}({});
|
18
21
|
|
19
22
|
var LogLevel=/*#__PURE__*/function(LogLevel){LogLevel["Log"]="LOG";LogLevel["Info"]="INFO";LogLevel["Debug"]="DEBUG";LogLevel["Warn"]="WARN";LogLevel["Error"]="ERROR";LogLevel["None"]="NONE";return LogLevel;}({});
|
20
23
|
|
21
|
-
var PluginName=/*#__PURE__*/function(PluginName){PluginName["BeaconQueue"]="BeaconQueue";PluginName["DeviceModeDestinations"]="DeviceModeDestinations";PluginName["DeviceModeTransformation"]="DeviceModeTransformation";PluginName["ErrorReporting"]="ErrorReporting";PluginName["ExternalAnonymousId"]="ExternalAnonymousId";PluginName["GoogleLinker"]="GoogleLinker";PluginName["
|
24
|
+
var PluginName=/*#__PURE__*/function(PluginName){PluginName["BeaconQueue"]="BeaconQueue";PluginName["Bugsnag"]="Bugsnag";PluginName["DeviceModeDestinations"]="DeviceModeDestinations";PluginName["DeviceModeTransformation"]="DeviceModeTransformation";PluginName["ErrorReporting"]="ErrorReporting";PluginName["ExternalAnonymousId"]="ExternalAnonymousId";PluginName["GoogleLinker"]="GoogleLinker";PluginName["KetchConsentManager"]="KetchConsentManager";PluginName["NativeDestinationQueue"]="NativeDestinationQueue";PluginName["OneTrustConsentManager"]="OneTrustConsentManager";PluginName["StorageEncryption"]="StorageEncryption";PluginName["StorageEncryptionLegacy"]="StorageEncryptionLegacy";PluginName["StorageMigrator"]="StorageMigrator";PluginName["XhrQueue"]="XhrQueue";return PluginName;}({});
|
22
25
|
|
23
|
-
function ownKeys(
|
24
|
-
var
|
26
|
+
function ownKeys(e, r) {
|
27
|
+
var t = Object.keys(e);
|
25
28
|
if (Object.getOwnPropertySymbols) {
|
26
|
-
var
|
27
|
-
|
28
|
-
return Object.getOwnPropertyDescriptor(
|
29
|
-
})),
|
29
|
+
var o = Object.getOwnPropertySymbols(e);
|
30
|
+
r && (o = o.filter(function (r) {
|
31
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
32
|
+
})), t.push.apply(t, o);
|
30
33
|
}
|
31
|
-
return
|
34
|
+
return t;
|
32
35
|
}
|
33
|
-
function _objectSpread2(
|
34
|
-
for (var
|
35
|
-
var
|
36
|
-
|
37
|
-
_defineProperty(
|
38
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(
|
39
|
-
Object.defineProperty(
|
36
|
+
function _objectSpread2(e) {
|
37
|
+
for (var r = 1; r < arguments.length; r++) {
|
38
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
39
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
40
|
+
_defineProperty(e, r, t[r]);
|
41
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
42
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
40
43
|
});
|
41
44
|
}
|
42
|
-
return
|
45
|
+
return e;
|
43
46
|
}
|
44
47
|
function _regeneratorRuntime() {
|
45
48
|
_regeneratorRuntime = function () {
|
46
|
-
return
|
49
|
+
return e;
|
47
50
|
};
|
48
|
-
var
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
var t,
|
52
|
+
e = {},
|
53
|
+
r = Object.prototype,
|
54
|
+
n = r.hasOwnProperty,
|
55
|
+
o = Object.defineProperty || function (t, e, r) {
|
56
|
+
t[e] = r.value;
|
53
57
|
},
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
function define(
|
59
|
-
return Object.defineProperty(
|
60
|
-
value:
|
58
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
59
|
+
a = i.iterator || "@@iterator",
|
60
|
+
c = i.asyncIterator || "@@asyncIterator",
|
61
|
+
u = i.toStringTag || "@@toStringTag";
|
62
|
+
function define(t, e, r) {
|
63
|
+
return Object.defineProperty(t, e, {
|
64
|
+
value: r,
|
61
65
|
enumerable: !0,
|
62
66
|
configurable: !0,
|
63
67
|
writable: !0
|
64
|
-
}),
|
68
|
+
}), t[e];
|
65
69
|
}
|
66
70
|
try {
|
67
71
|
define({}, "");
|
68
|
-
} catch (
|
69
|
-
define = function (
|
70
|
-
return
|
72
|
+
} catch (t) {
|
73
|
+
define = function (t, e, r) {
|
74
|
+
return t[e] = r;
|
71
75
|
};
|
72
76
|
}
|
73
|
-
function wrap(
|
74
|
-
var
|
75
|
-
|
76
|
-
|
77
|
-
return
|
78
|
-
value: makeInvokeMethod(
|
79
|
-
}),
|
77
|
+
function wrap(t, e, r, n) {
|
78
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
79
|
+
a = Object.create(i.prototype),
|
80
|
+
c = new Context(n || []);
|
81
|
+
return o(a, "_invoke", {
|
82
|
+
value: makeInvokeMethod(t, r, c)
|
83
|
+
}), a;
|
80
84
|
}
|
81
|
-
function tryCatch(
|
85
|
+
function tryCatch(t, e, r) {
|
82
86
|
try {
|
83
87
|
return {
|
84
88
|
type: "normal",
|
85
|
-
arg:
|
89
|
+
arg: t.call(e, r)
|
86
90
|
};
|
87
|
-
} catch (
|
91
|
+
} catch (t) {
|
88
92
|
return {
|
89
93
|
type: "throw",
|
90
|
-
arg:
|
94
|
+
arg: t
|
91
95
|
};
|
92
96
|
}
|
93
97
|
}
|
94
|
-
|
95
|
-
var
|
98
|
+
e.wrap = wrap;
|
99
|
+
var h = "suspendedStart",
|
100
|
+
l = "suspendedYield",
|
101
|
+
f = "executing",
|
102
|
+
s = "completed",
|
103
|
+
y = {};
|
96
104
|
function Generator() {}
|
97
105
|
function GeneratorFunction() {}
|
98
106
|
function GeneratorFunctionPrototype() {}
|
99
|
-
var
|
100
|
-
define(
|
107
|
+
var p = {};
|
108
|
+
define(p, a, function () {
|
101
109
|
return this;
|
102
110
|
});
|
103
|
-
var
|
104
|
-
|
105
|
-
|
106
|
-
var
|
107
|
-
function defineIteratorMethods(
|
108
|
-
["next", "throw", "return"].forEach(function (
|
109
|
-
define(
|
110
|
-
return this._invoke(
|
111
|
+
var d = Object.getPrototypeOf,
|
112
|
+
v = d && d(d(values([])));
|
113
|
+
v && v !== r && n.call(v, a) && (p = v);
|
114
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
115
|
+
function defineIteratorMethods(t) {
|
116
|
+
["next", "throw", "return"].forEach(function (e) {
|
117
|
+
define(t, e, function (t) {
|
118
|
+
return this._invoke(e, t);
|
111
119
|
});
|
112
120
|
});
|
113
121
|
}
|
114
|
-
function AsyncIterator(
|
115
|
-
function invoke(
|
116
|
-
var
|
117
|
-
if ("throw" !==
|
118
|
-
var
|
119
|
-
|
120
|
-
return
|
121
|
-
invoke("next",
|
122
|
-
}, function (
|
123
|
-
invoke("throw",
|
124
|
-
}) :
|
125
|
-
|
126
|
-
}, function (
|
127
|
-
return invoke("throw",
|
122
|
+
function AsyncIterator(t, e) {
|
123
|
+
function invoke(r, o, i, a) {
|
124
|
+
var c = tryCatch(t[r], t, o);
|
125
|
+
if ("throw" !== c.type) {
|
126
|
+
var u = c.arg,
|
127
|
+
h = u.value;
|
128
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
129
|
+
invoke("next", t, i, a);
|
130
|
+
}, function (t) {
|
131
|
+
invoke("throw", t, i, a);
|
132
|
+
}) : e.resolve(h).then(function (t) {
|
133
|
+
u.value = t, i(u);
|
134
|
+
}, function (t) {
|
135
|
+
return invoke("throw", t, i, a);
|
128
136
|
});
|
129
137
|
}
|
130
|
-
|
138
|
+
a(c.arg);
|
131
139
|
}
|
132
|
-
var
|
133
|
-
|
134
|
-
value: function (
|
140
|
+
var r;
|
141
|
+
o(this, "_invoke", {
|
142
|
+
value: function (t, n) {
|
135
143
|
function callInvokeWithMethodAndArg() {
|
136
|
-
return new
|
137
|
-
invoke(
|
144
|
+
return new e(function (e, r) {
|
145
|
+
invoke(t, n, e, r);
|
138
146
|
});
|
139
147
|
}
|
140
|
-
return
|
148
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
141
149
|
}
|
142
150
|
});
|
143
151
|
}
|
144
|
-
function makeInvokeMethod(
|
145
|
-
var
|
146
|
-
return function (
|
147
|
-
if (
|
148
|
-
if (
|
149
|
-
if ("throw" ===
|
152
|
+
function makeInvokeMethod(e, r, n) {
|
153
|
+
var o = h;
|
154
|
+
return function (i, a) {
|
155
|
+
if (o === f) throw new Error("Generator is already running");
|
156
|
+
if (o === s) {
|
157
|
+
if ("throw" === i) throw a;
|
150
158
|
return {
|
151
|
-
value:
|
159
|
+
value: t,
|
152
160
|
done: !0
|
153
161
|
};
|
154
162
|
}
|
155
|
-
for (
|
156
|
-
var
|
157
|
-
if (
|
158
|
-
var
|
159
|
-
if (
|
160
|
-
if (
|
161
|
-
return
|
163
|
+
for (n.method = i, n.arg = a;;) {
|
164
|
+
var c = n.delegate;
|
165
|
+
if (c) {
|
166
|
+
var u = maybeInvokeDelegate(c, n);
|
167
|
+
if (u) {
|
168
|
+
if (u === y) continue;
|
169
|
+
return u;
|
162
170
|
}
|
163
171
|
}
|
164
|
-
if ("next" ===
|
165
|
-
if (
|
166
|
-
|
167
|
-
} else "return" ===
|
168
|
-
|
169
|
-
var
|
170
|
-
if ("normal" ===
|
171
|
-
if (
|
172
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
173
|
+
if (o === h) throw o = s, n.arg;
|
174
|
+
n.dispatchException(n.arg);
|
175
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
176
|
+
o = f;
|
177
|
+
var p = tryCatch(e, r, n);
|
178
|
+
if ("normal" === p.type) {
|
179
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
172
180
|
return {
|
173
|
-
value:
|
174
|
-
done:
|
181
|
+
value: p.arg,
|
182
|
+
done: n.done
|
175
183
|
};
|
176
184
|
}
|
177
|
-
"throw" ===
|
185
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
178
186
|
}
|
179
187
|
};
|
180
188
|
}
|
181
|
-
function maybeInvokeDelegate(
|
182
|
-
var
|
183
|
-
|
184
|
-
if (
|
185
|
-
var
|
186
|
-
if ("throw" ===
|
187
|
-
var
|
188
|
-
return
|
189
|
+
function maybeInvokeDelegate(e, r) {
|
190
|
+
var n = r.method,
|
191
|
+
o = e.iterator[n];
|
192
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
193
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
194
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
195
|
+
var a = i.arg;
|
196
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
189
197
|
}
|
190
|
-
function pushTryEntry(
|
191
|
-
var
|
192
|
-
tryLoc:
|
198
|
+
function pushTryEntry(t) {
|
199
|
+
var e = {
|
200
|
+
tryLoc: t[0]
|
193
201
|
};
|
194
|
-
1 in
|
202
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
195
203
|
}
|
196
|
-
function resetTryEntry(
|
197
|
-
var
|
198
|
-
|
204
|
+
function resetTryEntry(t) {
|
205
|
+
var e = t.completion || {};
|
206
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
199
207
|
}
|
200
|
-
function Context(
|
208
|
+
function Context(t) {
|
201
209
|
this.tryEntries = [{
|
202
210
|
tryLoc: "root"
|
203
|
-
}],
|
211
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
204
212
|
}
|
205
|
-
function values(
|
206
|
-
if (
|
207
|
-
var
|
208
|
-
if (
|
209
|
-
if ("function" == typeof
|
210
|
-
if (!isNaN(
|
211
|
-
var
|
212
|
-
|
213
|
-
for (; ++
|
214
|
-
return next.value =
|
213
|
+
function values(e) {
|
214
|
+
if (e || "" === e) {
|
215
|
+
var r = e[a];
|
216
|
+
if (r) return r.call(e);
|
217
|
+
if ("function" == typeof e.next) return e;
|
218
|
+
if (!isNaN(e.length)) {
|
219
|
+
var o = -1,
|
220
|
+
i = function next() {
|
221
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
222
|
+
return next.value = t, next.done = !0, next;
|
215
223
|
};
|
216
|
-
return
|
224
|
+
return i.next = i;
|
217
225
|
}
|
218
226
|
}
|
219
|
-
throw new TypeError(typeof
|
227
|
+
throw new TypeError(typeof e + " is not iterable");
|
220
228
|
}
|
221
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype,
|
229
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
222
230
|
value: GeneratorFunctionPrototype,
|
223
231
|
configurable: !0
|
224
|
-
}),
|
232
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
225
233
|
value: GeneratorFunction,
|
226
234
|
configurable: !0
|
227
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype,
|
228
|
-
var
|
229
|
-
return !!
|
230
|
-
},
|
231
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(
|
232
|
-
},
|
235
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
236
|
+
var e = "function" == typeof t && t.constructor;
|
237
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
238
|
+
}, e.mark = function (t) {
|
239
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
240
|
+
}, e.awrap = function (t) {
|
233
241
|
return {
|
234
|
-
__await:
|
242
|
+
__await: t
|
235
243
|
};
|
236
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype,
|
244
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
237
245
|
return this;
|
238
|
-
}),
|
239
|
-
void 0 ===
|
240
|
-
var
|
241
|
-
return
|
242
|
-
return
|
246
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
247
|
+
void 0 === i && (i = Promise);
|
248
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
249
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
250
|
+
return t.done ? t.value : a.next();
|
243
251
|
});
|
244
|
-
}, defineIteratorMethods(
|
252
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
245
253
|
return this;
|
246
|
-
}), define(
|
254
|
+
}), define(g, "toString", function () {
|
247
255
|
return "[object Generator]";
|
248
|
-
}),
|
249
|
-
var
|
250
|
-
|
251
|
-
for (var
|
252
|
-
return
|
253
|
-
for (;
|
254
|
-
var
|
255
|
-
if (
|
256
|
+
}), e.keys = function (t) {
|
257
|
+
var e = Object(t),
|
258
|
+
r = [];
|
259
|
+
for (var n in e) r.push(n);
|
260
|
+
return r.reverse(), function next() {
|
261
|
+
for (; r.length;) {
|
262
|
+
var t = r.pop();
|
263
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
256
264
|
}
|
257
265
|
return next.done = !0, next;
|
258
266
|
};
|
259
|
-
},
|
267
|
+
}, e.values = values, Context.prototype = {
|
260
268
|
constructor: Context,
|
261
|
-
reset: function (
|
262
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent =
|
269
|
+
reset: function (e) {
|
270
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
263
271
|
},
|
264
272
|
stop: function () {
|
265
273
|
this.done = !0;
|
266
|
-
var
|
267
|
-
if ("throw" ===
|
274
|
+
var t = this.tryEntries[0].completion;
|
275
|
+
if ("throw" === t.type) throw t.arg;
|
268
276
|
return this.rval;
|
269
277
|
},
|
270
|
-
dispatchException: function (
|
271
|
-
if (this.done) throw
|
272
|
-
var
|
273
|
-
function handle(
|
274
|
-
return
|
278
|
+
dispatchException: function (e) {
|
279
|
+
if (this.done) throw e;
|
280
|
+
var r = this;
|
281
|
+
function handle(n, o) {
|
282
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
275
283
|
}
|
276
|
-
for (var
|
277
|
-
var
|
278
|
-
|
279
|
-
if ("root" ===
|
280
|
-
if (
|
281
|
-
var
|
282
|
-
|
283
|
-
if (
|
284
|
-
if (this.prev <
|
285
|
-
if (this.prev <
|
286
|
-
} else if (
|
287
|
-
if (this.prev <
|
284
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
285
|
+
var i = this.tryEntries[o],
|
286
|
+
a = i.completion;
|
287
|
+
if ("root" === i.tryLoc) return handle("end");
|
288
|
+
if (i.tryLoc <= this.prev) {
|
289
|
+
var c = n.call(i, "catchLoc"),
|
290
|
+
u = n.call(i, "finallyLoc");
|
291
|
+
if (c && u) {
|
292
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
293
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
294
|
+
} else if (c) {
|
295
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
288
296
|
} else {
|
289
|
-
if (!
|
290
|
-
if (this.prev <
|
297
|
+
if (!u) throw new Error("try statement without catch or finally");
|
298
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
291
299
|
}
|
292
300
|
}
|
293
301
|
}
|
294
302
|
},
|
295
|
-
abrupt: function (
|
296
|
-
for (var
|
297
|
-
var
|
298
|
-
if (
|
299
|
-
var
|
303
|
+
abrupt: function (t, e) {
|
304
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
305
|
+
var o = this.tryEntries[r];
|
306
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
307
|
+
var i = o;
|
300
308
|
break;
|
301
309
|
}
|
302
310
|
}
|
303
|
-
|
304
|
-
var
|
305
|
-
return
|
311
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
312
|
+
var a = i ? i.completion : {};
|
313
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
306
314
|
},
|
307
|
-
complete: function (
|
308
|
-
if ("throw" ===
|
309
|
-
return "break" ===
|
315
|
+
complete: function (t, e) {
|
316
|
+
if ("throw" === t.type) throw t.arg;
|
317
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
310
318
|
},
|
311
|
-
finish: function (
|
312
|
-
for (var
|
313
|
-
var
|
314
|
-
if (
|
319
|
+
finish: function (t) {
|
320
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
321
|
+
var r = this.tryEntries[e];
|
322
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
315
323
|
}
|
316
324
|
},
|
317
|
-
catch: function (
|
318
|
-
for (var
|
319
|
-
var
|
320
|
-
if (
|
321
|
-
var
|
322
|
-
if ("throw" ===
|
323
|
-
var
|
324
|
-
resetTryEntry(
|
325
|
+
catch: function (t) {
|
326
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
327
|
+
var r = this.tryEntries[e];
|
328
|
+
if (r.tryLoc === t) {
|
329
|
+
var n = r.completion;
|
330
|
+
if ("throw" === n.type) {
|
331
|
+
var o = n.arg;
|
332
|
+
resetTryEntry(r);
|
325
333
|
}
|
326
|
-
return
|
334
|
+
return o;
|
327
335
|
}
|
328
336
|
}
|
329
337
|
throw new Error("illegal catch attempt");
|
330
338
|
},
|
331
|
-
delegateYield: function (
|
339
|
+
delegateYield: function (e, r, n) {
|
332
340
|
return this.delegate = {
|
333
|
-
iterator: values(
|
334
|
-
resultName:
|
335
|
-
nextLoc:
|
336
|
-
}, "next" === this.method && (this.arg =
|
341
|
+
iterator: values(e),
|
342
|
+
resultName: r,
|
343
|
+
nextLoc: n
|
344
|
+
}, "next" === this.method && (this.arg = t), y;
|
337
345
|
}
|
338
|
-
},
|
346
|
+
}, e;
|
339
347
|
}
|
340
|
-
function _typeof(
|
348
|
+
function _typeof(o) {
|
341
349
|
"@babel/helpers - typeof";
|
342
350
|
|
343
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (
|
344
|
-
return typeof
|
345
|
-
} : function (
|
346
|
-
return
|
347
|
-
}, _typeof(
|
351
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
352
|
+
return typeof o;
|
353
|
+
} : function (o) {
|
354
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
355
|
+
}, _typeof(o);
|
348
356
|
}
|
349
357
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
350
358
|
try {
|
@@ -481,57 +489,8 @@ function _isPlaceholder(a){return a!=null&&_typeof(a)==='object'&&a['@@functiona
|
|
481
489
|
* @return {Function} The curried function.
|
482
490
|
*/function _curry3(fn){return function f3(a,b,c){switch(arguments.length){case 0:return f3;case 1:return _isPlaceholder(a)?f3:_curry2(function(_b,_c){return fn(a,_b,_c);});case 2:return _isPlaceholder(a)&&_isPlaceholder(b)?f3:_isPlaceholder(a)?_curry2(function(_a,_c){return fn(_a,b,_c);}):_isPlaceholder(b)?_curry2(function(_b,_c){return fn(a,_b,_c);}):_curry1(function(_c){return fn(a,b,_c);});default:return _isPlaceholder(a)&&_isPlaceholder(b)&&_isPlaceholder(c)?f3:_isPlaceholder(a)&&_isPlaceholder(b)?_curry2(function(_a,_b){return fn(_a,_b,c);}):_isPlaceholder(a)&&_isPlaceholder(c)?_curry2(function(_a,_c){return fn(_a,b,_c);}):_isPlaceholder(b)&&_isPlaceholder(c)?_curry2(function(_b,_c){return fn(a,_b,_c);}):_isPlaceholder(a)?_curry1(function(_a){return fn(_a,b,c);}):_isPlaceholder(b)?_curry1(function(_b){return fn(a,_b,c);}):_isPlaceholder(c)?_curry1(function(_c){return fn(a,b,_c);}):fn(a,b,c);}};}
|
483
491
|
|
484
|
-
/**
|
485
|
-
* Tests whether or not an object is an array.
|
486
|
-
*
|
487
|
-
* @private
|
488
|
-
* @param {*} val The object to test.
|
489
|
-
* @return {Boolean} `true` if `val` is an array, `false` otherwise.
|
490
|
-
* @example
|
491
|
-
*
|
492
|
-
* _isArray([]); //=> true
|
493
|
-
* _isArray(null); //=> false
|
494
|
-
* _isArray({}); //=> false
|
495
|
-
*/var _isArray = Array.isArray||function _isArray(val){return val!=null&&val.length>=0&&Object.prototype.toString.call(val)==='[object Array]';};
|
496
|
-
|
497
|
-
function _arrayFromIterator(iter){var list=[];var next;while(!(next=iter.next()).done){list.push(next.value);}return list;}
|
498
|
-
|
499
|
-
function _includesWith(pred,x,list){var idx=0;var len=list.length;while(idx<len){if(pred(x,list[idx])){return true;}idx+=1;}return false;}
|
500
|
-
|
501
|
-
function _functionName(f){// String(x => x) evaluates to "x => x", so the pattern may not match.
|
502
|
-
var match=String(f).match(/^function (\w*)/);return match==null?'':match[1];}
|
503
|
-
|
504
492
|
function _has(prop,obj){return Object.prototype.hasOwnProperty.call(obj,prop);}
|
505
493
|
|
506
|
-
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
507
|
-
function _objectIs(a,b){// SameValue algorithm
|
508
|
-
if(a===b){// Steps 1-5, 7-10
|
509
|
-
// Steps 6.b-6.e: +0 != -0
|
510
|
-
return a!==0||1/a===1/b;}else {// Step 6.a: NaN == NaN
|
511
|
-
return a!==a&&b!==b;}}var _objectIs$1 = typeof Object.is==='function'?Object.is:_objectIs;
|
512
|
-
|
513
|
-
var toString=Object.prototype.toString;var _isArguments=/*#__PURE__*/function(){return toString.call(arguments)==='[object Arguments]'?function _isArguments(x){return toString.call(x)==='[object Arguments]';}:function _isArguments(x){return _has('callee',x);};}();
|
514
|
-
|
515
|
-
var hasEnumBug=!/*#__PURE__*/{toString:null}.propertyIsEnumerable('toString');var nonEnumerableProps=['constructor','valueOf','isPrototypeOf','toString','propertyIsEnumerable','hasOwnProperty','toLocaleString'];// Safari bug
|
516
|
-
var hasArgsEnumBug=/*#__PURE__*/function(){return arguments.propertyIsEnumerable('length');}();var contains=function contains(list,item){var idx=0;while(idx<list.length){if(list[idx]===item){return true;}idx+=1;}return false;};/**
|
517
|
-
* Returns a list containing the names of all the enumerable own properties of
|
518
|
-
* the supplied object.
|
519
|
-
* Note that the order of the output array is not guaranteed to be consistent
|
520
|
-
* across different JS platforms.
|
521
|
-
*
|
522
|
-
* @func
|
523
|
-
* @memberOf R
|
524
|
-
* @since v0.1.0
|
525
|
-
* @category Object
|
526
|
-
* @sig {k: v} -> [k]
|
527
|
-
* @param {Object} obj The object to extract properties from
|
528
|
-
* @return {Array} An array of the object's own properties.
|
529
|
-
* @see R.keysIn, R.values, R.toPairs
|
530
|
-
* @example
|
531
|
-
*
|
532
|
-
* R.keys({a: 1, b: 2, c: 3}); //=> ['a', 'b', 'c']
|
533
|
-
*/var keys=typeof Object.keys==='function'&&!hasArgsEnumBug?/*#__PURE__*/_curry1(function keys(obj){return Object(obj)!==obj?[]:Object.keys(obj);}):/*#__PURE__*/_curry1(function keys(obj){if(Object(obj)!==obj){return [];}var prop,nIdx;var ks=[];var checkArgsLength=hasArgsEnumBug&&_isArguments(obj);for(prop in obj){if(_has(prop,obj)&&(!checkArgsLength||prop!=='length')){ks[ks.length]=prop;}}if(hasEnumBug){nIdx=nonEnumerableProps.length-1;while(nIdx>=0){prop=nonEnumerableProps[nIdx];if(_has(prop,obj)&&!contains(ks,prop)){ks[ks.length]=prop;}nIdx-=1;}}return ks;});
|
534
|
-
|
535
494
|
/**
|
536
495
|
* Gives a single-word string description of the (native) type of a value,
|
537
496
|
* returning such answers as 'Object', 'Number', 'Array', or 'Null'. Does not
|
@@ -558,45 +517,6 @@ var hasArgsEnumBug=/*#__PURE__*/function(){return arguments.propertyIsEnumerable
|
|
558
517
|
* R.type(undefined); //=> "Undefined"
|
559
518
|
*/var type=/*#__PURE__*/_curry1(function type(val){return val===null?'Null':val===undefined?'Undefined':Object.prototype.toString.call(val).slice(8,-1);});
|
560
519
|
|
561
|
-
/**
|
562
|
-
* private _uniqContentEquals function.
|
563
|
-
* That function is checking equality of 2 iterator contents with 2 assumptions
|
564
|
-
* - iterators lengths are the same
|
565
|
-
* - iterators values are unique
|
566
|
-
*
|
567
|
-
* false-positive result will be returned for comparison of, e.g.
|
568
|
-
* - [1,2,3] and [1,2,3,4]
|
569
|
-
* - [1,1,1] and [1,2,3]
|
570
|
-
* */function _uniqContentEquals(aIterator,bIterator,stackA,stackB){var a=_arrayFromIterator(aIterator);var b=_arrayFromIterator(bIterator);function eq(_a,_b){return _equals(_a,_b,stackA.slice(),stackB.slice());}// if *a* array contains any element that is not included in *b*
|
571
|
-
return !_includesWith(function(b,aItem){return !_includesWith(eq,aItem,b);},b,a);}function _equals(a,b,stackA,stackB){if(_objectIs$1(a,b)){return true;}var typeA=type(a);if(typeA!==type(b)){return false;}if(typeof a['fantasy-land/equals']==='function'||typeof b['fantasy-land/equals']==='function'){return typeof a['fantasy-land/equals']==='function'&&a['fantasy-land/equals'](b)&&typeof b['fantasy-land/equals']==='function'&&b['fantasy-land/equals'](a);}if(typeof a.equals==='function'||typeof b.equals==='function'){return typeof a.equals==='function'&&a.equals(b)&&typeof b.equals==='function'&&b.equals(a);}switch(typeA){case'Arguments':case'Array':case'Object':if(typeof a.constructor==='function'&&_functionName(a.constructor)==='Promise'){return a===b;}break;case'Boolean':case'Number':case'String':if(!(_typeof(a)===_typeof(b)&&_objectIs$1(a.valueOf(),b.valueOf()))){return false;}break;case'Date':if(!_objectIs$1(a.valueOf(),b.valueOf())){return false;}break;case'Error':return a.name===b.name&&a.message===b.message;case'RegExp':if(!(a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline&&a.sticky===b.sticky&&a.unicode===b.unicode)){return false;}break;}var idx=stackA.length-1;while(idx>=0){if(stackA[idx]===a){return stackB[idx]===b;}idx-=1;}switch(typeA){case'Map':if(a.size!==b.size){return false;}return _uniqContentEquals(a.entries(),b.entries(),stackA.concat([a]),stackB.concat([b]));case'Set':if(a.size!==b.size){return false;}return _uniqContentEquals(a.values(),b.values(),stackA.concat([a]),stackB.concat([b]));case'Arguments':case'Array':case'Object':case'Boolean':case'Number':case'String':case'Date':case'Error':case'RegExp':case'Int8Array':case'Uint8Array':case'Uint8ClampedArray':case'Int16Array':case'Uint16Array':case'Int32Array':case'Uint32Array':case'Float32Array':case'Float64Array':case'ArrayBuffer':break;default:// Values of other types are only equal if identical.
|
572
|
-
return false;}var keysA=keys(a);if(keysA.length!==keys(b).length){return false;}var extendedStackA=stackA.concat([a]);var extendedStackB=stackB.concat([b]);idx=keysA.length-1;while(idx>=0){var key=keysA[idx];if(!(_has(key,b)&&_equals(b[key],a[key],extendedStackA,extendedStackB))){return false;}idx-=1;}return true;}
|
573
|
-
|
574
|
-
/**
|
575
|
-
* Returns `true` if its arguments are equivalent, `false` otherwise. Handles
|
576
|
-
* cyclical data structures.
|
577
|
-
*
|
578
|
-
* Dispatches symmetrically to the `equals` methods of both arguments, if
|
579
|
-
* present.
|
580
|
-
*
|
581
|
-
* @func
|
582
|
-
* @memberOf R
|
583
|
-
* @since v0.15.0
|
584
|
-
* @category Relation
|
585
|
-
* @sig a -> b -> Boolean
|
586
|
-
* @param {*} a
|
587
|
-
* @param {*} b
|
588
|
-
* @return {Boolean}
|
589
|
-
* @example
|
590
|
-
*
|
591
|
-
* R.equals(1, 1); //=> true
|
592
|
-
* R.equals(1, '1'); //=> false
|
593
|
-
* R.equals([1, 2, 3], [1, 2, 3]); //=> true
|
594
|
-
*
|
595
|
-
* const a = {}; a.v = a;
|
596
|
-
* const b = {}; b.v = b;
|
597
|
-
* R.equals(a, b); //=> true
|
598
|
-
*/var equals=/*#__PURE__*/_curry2(function equals(a,b){return _equals(a,b,[],[]);});
|
599
|
-
|
600
520
|
function _isObject(x){return Object.prototype.toString.call(x)==='[object Object]';}
|
601
521
|
|
602
522
|
/**
|
@@ -681,71 +601,6 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
681
601
|
* objects[0] === objectsClone[0]; //=> false
|
682
602
|
*/var clone=/*#__PURE__*/_curry1(function clone(value){return value!=null&&typeof value.clone==='function'?value.clone():_clone(value,true);});var clone$1 = clone;
|
683
603
|
|
684
|
-
/**
|
685
|
-
* Tests whether or not an object is a typed array.
|
686
|
-
*
|
687
|
-
* @private
|
688
|
-
* @param {*} val The object to test.
|
689
|
-
* @return {Boolean} `true` if `val` is a typed array, `false` otherwise.
|
690
|
-
* @example
|
691
|
-
*
|
692
|
-
* _isTypedArray(new Uint8Array([])); //=> true
|
693
|
-
* _isTypedArray(new Float32Array([])); //=> true
|
694
|
-
* _isTypedArray([]); //=> false
|
695
|
-
* _isTypedArray(null); //=> false
|
696
|
-
* _isTypedArray({}); //=> false
|
697
|
-
*/function _isTypedArray(val){var type=Object.prototype.toString.call(val);return type==='[object Uint8ClampedArray]'||type==='[object Int8Array]'||type==='[object Uint8Array]'||type==='[object Int16Array]'||type==='[object Uint16Array]'||type==='[object Int32Array]'||type==='[object Uint32Array]'||type==='[object Float32Array]'||type==='[object Float64Array]'||type==='[object BigInt64Array]'||type==='[object BigUint64Array]';}
|
698
|
-
|
699
|
-
/**
|
700
|
-
* Returns the empty value of its argument's type. Ramda defines the empty
|
701
|
-
* value of Array (`[]`), Object (`{}`), String (`''`),
|
702
|
-
* TypedArray (`Uint8Array []`, `Float32Array []`, etc), and Arguments. Other
|
703
|
-
* types are supported if they define `<Type>.empty`,
|
704
|
-
* `<Type>.prototype.empty` or implement the
|
705
|
-
* [FantasyLand Monoid spec](https://github.com/fantasyland/fantasy-land#monoid).
|
706
|
-
*
|
707
|
-
* Dispatches to the `empty` method of the first argument, if present.
|
708
|
-
*
|
709
|
-
* @func
|
710
|
-
* @memberOf R
|
711
|
-
* @since v0.3.0
|
712
|
-
* @category Function
|
713
|
-
* @sig a -> a
|
714
|
-
* @param {*} x
|
715
|
-
* @return {*}
|
716
|
-
* @example
|
717
|
-
*
|
718
|
-
* R.empty(Just(42)); //=> Nothing()
|
719
|
-
* R.empty([1, 2, 3]); //=> []
|
720
|
-
* R.empty('unicorns'); //=> ''
|
721
|
-
* R.empty({x: 1, y: 2}); //=> {}
|
722
|
-
* R.empty(Uint8Array.from('123')); //=> Uint8Array []
|
723
|
-
*/var empty=/*#__PURE__*/_curry1(function empty(x){return x!=null&&typeof x['fantasy-land/empty']==='function'?x['fantasy-land/empty']():x!=null&&x.constructor!=null&&typeof x.constructor['fantasy-land/empty']==='function'?x.constructor['fantasy-land/empty']():x!=null&&typeof x.empty==='function'?x.empty():x!=null&&x.constructor!=null&&typeof x.constructor.empty==='function'?x.constructor.empty():_isArray(x)?[]:_isString(x)?'':_isObject(x)?{}:_isArguments(x)?function(){return arguments;}():_isTypedArray(x)?x.constructor.from(''):void 0// else
|
724
|
-
;});
|
725
|
-
|
726
|
-
/**
|
727
|
-
* Returns `true` if the given value is its type's empty value; `false`
|
728
|
-
* otherwise.
|
729
|
-
*
|
730
|
-
* @func
|
731
|
-
* @memberOf R
|
732
|
-
* @since v0.1.0
|
733
|
-
* @category Logic
|
734
|
-
* @sig a -> Boolean
|
735
|
-
* @param {*} x
|
736
|
-
* @return {Boolean}
|
737
|
-
* @see R.empty
|
738
|
-
* @example
|
739
|
-
*
|
740
|
-
* R.isEmpty([1, 2, 3]); //=> false
|
741
|
-
* R.isEmpty([]); //=> true
|
742
|
-
* R.isEmpty(''); //=> true
|
743
|
-
* R.isEmpty(null); //=> false
|
744
|
-
* R.isEmpty({}); //=> true
|
745
|
-
* R.isEmpty({length: 0}); //=> false
|
746
|
-
* R.isEmpty(Uint8Array.from('')); //=> true
|
747
|
-
*/var isEmpty=/*#__PURE__*/_curry1(function isEmpty(x){return x!=null&&equals(x,empty(x));});var isEmpty$1 = isEmpty;
|
748
|
-
|
749
604
|
/**
|
750
605
|
* Retrieves the values at given paths of an object.
|
751
606
|
*
|
@@ -923,6 +778,10 @@ var cachedCopy=map.get(value);if(cachedCopy){return cachedCopy;}map.set(value,co
|
|
923
778
|
* @param value input value
|
924
779
|
* @returns boolean
|
925
780
|
*/var isDefinedAndNotNull=function isDefinedAndNotNull(value){return !isNullOrUndefined(value);};/**
|
781
|
+
* A function to check given value is defined and not null
|
782
|
+
* @param value input value
|
783
|
+
* @returns boolean
|
784
|
+
*/var isDefinedNotNullAndNotEmptyString=function isDefinedNotNullAndNotEmptyString(value){return isDefinedAndNotNull(value)&&value!=='';};/**
|
926
785
|
* Determines if the input is an instance of Error
|
927
786
|
* @param obj input value
|
928
787
|
* @returns true if the input is an instance of Error and false otherwise
|
@@ -1018,17 +877,24 @@ if(isDefined(payload.groupId)){payload.groupId=tryStringify(payload.groupId);}el
|
|
1018
877
|
|
1019
878
|
var CAPABILITIES_MANAGER='CapabilitiesManager';var CONFIG_MANAGER='ConfigManager';var EVENT_MANAGER='EventManager';var PLUGINS_MANAGER='PluginsManager';var USER_SESSION_MANAGER='UserSessionManager';var ERROR_HANDLER='ErrorHandler';var PLUGIN_ENGINE='PluginEngine';var STORE_MANAGER='StoreManager';var READY_API='readyApi';var LOAD_CONFIGURATION='LoadConfiguration';var EVENT_REPOSITORY='EventRepository';var EXTERNAL_SRC_LOADER='ExternalSrcLoader';var HTTP_CLIENT='HttpClient';var RS_APP='RudderStackApplication';var ANALYTICS_CORE='AnalyticsCore';
|
1020
879
|
|
1021
|
-
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.0.0-beta.
|
880
|
+
var APP_NAME='RudderLabs JavaScript SDK';var APP_VERSION='3.0.0-beta.8';var APP_NAMESPACE='com.rudderlabs.javascript';var MODULE_TYPE='npm';var ADBLOCK_PAGE_CATEGORY='RudderJS-Initiated';var ADBLOCK_PAGE_NAME='ad-block page request';var ADBLOCK_PAGE_PATH='/ad-blocked';var GLOBAL_PRELOAD_BUFFER='preloadedEventsBuffer';
|
1022
881
|
|
1023
882
|
var QUERY_PARAM_TRAIT_PREFIX='ajs_trait_';var QUERY_PARAM_PROPERTY_PREFIX='ajs_prop_';var QUERY_PARAM_ANONYMOUS_ID_KEY='ajs_aid';var QUERY_PARAM_USER_ID_KEY='ajs_uid';var QUERY_PARAM_TRACK_EVENT_NAME_KEY='ajs_event';
|
1024
883
|
|
884
|
+
var DEFAULT_XHR_TIMEOUT_MS=10*1000;// 10 seconds
|
885
|
+
var DEFAULT_COOKIE_MAX_AGE_MS=31536000*1000;// 1 year
|
886
|
+
var DEFAULT_SESSION_TIMEOUT_MS=30*60*1000;// 30 minutes
|
887
|
+
var MIN_SESSION_TIMEOUT_MS=10*1000;// 10 seconds
|
888
|
+
var DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS=10*1000;// 10 seconds
|
889
|
+
var DEBOUNCED_TIMEOUT_MS=250;// 250 milliseconds
|
890
|
+
|
1025
891
|
/**
|
1026
892
|
* Create globally accessible RudderStackGlobals object
|
1027
893
|
*/var createExposedGlobals=function createExposedGlobals(){var analyticsInstanceId=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'app';if(!globalThis.RudderStackGlobals){globalThis.RudderStackGlobals={};}if(!globalThis.RudderStackGlobals[analyticsInstanceId]){globalThis.RudderStackGlobals[analyticsInstanceId]={};}};/**
|
1028
894
|
* Add move values to globally accessible RudderStackGlobals object per analytics instance
|
1029
895
|
*/var setExposedGlobal=function setExposedGlobal(keyName,value){var analyticsInstanceId=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'app';createExposedGlobals(analyticsInstanceId);globalThis.RudderStackGlobals[analyticsInstanceId][keyName]=value;};/**
|
1030
896
|
* Get values from globally accessible RudderStackGlobals object by analytics instance
|
1031
|
-
*/var getExposedGlobal=function getExposedGlobal(keyName){var analyticsInstanceId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'app';createExposedGlobals(analyticsInstanceId);return globalThis.RudderStackGlobals[analyticsInstanceId][keyName];};
|
897
|
+
*/var getExposedGlobal=function getExposedGlobal(keyName){var analyticsInstanceId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'app';createExposedGlobals(analyticsInstanceId);return globalThis.RudderStackGlobals[analyticsInstanceId][keyName];};function debounce(func,thisArg){var delay=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEBOUNCED_TIMEOUT_MS;var timeoutId;return function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}globalThis.clearTimeout(timeoutId);timeoutId=globalThis.setTimeout(function(){func.apply(thisArg,args);},delay);};}
|
1032
898
|
|
1033
899
|
/**
|
1034
900
|
* Parse query string params into object values for keys that start with a defined prefix
|
@@ -1059,14 +925,14 @@ var JSON_STRINGIFY='JSONStringify';var getCircularReplacer=function getCircularR
|
|
1059
925
|
return function(key,value){if(excludeKeys!==null&&excludeKeys!==void 0&&excludeKeys.includes(key)){return undefined;}if(excludeNull&&isNullOrUndefined(value)){return undefined;}if(_typeof(value)!=='object'||isNull(value)){return value;}// `this` is the object that value is contained in, i.e., its direct parent.
|
1060
926
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
1061
927
|
// @ts-ignore-next-line
|
1062
|
-
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0
|
928
|
+
while(ancestors.length>0&&ancestors[ancestors.length-1]!==this){ancestors.pop();}if(ancestors.includes(value)){logger===null||logger===void 0||logger.warn(CIRCULAR_REFERENCE_WARNING(JSON_STRINGIFY,key));return '[Circular Reference]';}ancestors.push(value);return value;};};/**
|
1063
929
|
* Utility method for JSON stringify object excluding null values & circular references
|
1064
930
|
*
|
1065
931
|
* @param {*} value input
|
1066
932
|
* @param {boolean} excludeNull if it should exclude nul or not
|
1067
933
|
* @param {function} logger optional logger methods for warning
|
1068
934
|
* @returns string
|
1069
|
-
*/var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0
|
935
|
+
*/var stringifyWithoutCircular=function stringifyWithoutCircular(value,excludeNull,excludeKeys,logger){try{return JSON.stringify(value,getCircularReplacer(excludeNull,excludeKeys,logger));}catch(err){logger===null||logger===void 0||logger.warn(JSON_STRINGIFY_WARNING,err);return null;}};
|
1070
936
|
|
1071
937
|
/**
|
1072
938
|
* Get mutated error with issue prepended to error message
|
@@ -1117,9 +983,9 @@ timeoutID=globalThis.setTimeout(function(){reject(new Error(SCRIPT_LOAD_TIMEOUT_
|
|
1117
983
|
* Load external resource of type javascript
|
1118
984
|
*/_createClass(ExternalSrcLoader,[{key:"loadJSFile",value:function loadJSFile(config){var _this=this;var url=config.url,id=config.id,timeout=config.timeout,async=config.async,callback=config.callback,extraAttributes=config.extraAttributes;var isFireAndForget=!(callback&&isFunction(callback));jsFileLoader(url,id,timeout||this.timeout,async,extraAttributes).then(function(id){if(!isFireAndForget){callback(id);}}).catch(function(err){_this.onError(err);if(!isFireAndForget){callback();}});}/**
|
1119
985
|
* Handle errors
|
1120
|
-
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0
|
986
|
+
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,EXTERNAL_SRC_LOADER);}else {throw error;}}}]);return ExternalSrcLoader;}();
|
1121
987
|
|
1122
|
-
function i(){throw new Error("Cycle detected");}function t(){if(!(
|
988
|
+
function i(){throw new Error("Cycle detected");}function t(){if(!(f>1)){var i,t=!1;while(void 0!==s){var r=s;s=void 0;v++;while(void 0!==r){var n=r.o;r.o=void 0;r.f&=-3;if(!(8&r.f)&&a(r))try{r.c();}catch(r){if(!t){i=r;t=!0;}}r=n;}}v=0;f--;if(t)throw i;}else f--;}function r(i){if(f>0)return i();f++;try{return i();}finally{t();}}var n=void 0;var s=void 0,f=0,v=0,e=0;function u(i){if(void 0!==n){var t=i.n;if(void 0===t||t.t!==n){t={i:0,S:i,p:n.s,n:void 0,t:n,e:void 0,x:void 0,r:t};if(void 0!==n.s)n.s.n=t;n.s=t;i.n=t;if(32&n.f)i.S(t);return t;}else if(-1===t.i){t.i=0;if(void 0!==t.n){t.n.p=t.p;if(void 0!==t.p)t.p.n=t.n;t.p=n.s;t.n=void 0;n.s.n=t;n.s=t;}return t;}}}function c(i){this.v=i;this.i=0;this.n=void 0;this.t=void 0;}c.prototype.h=function(){return !0;};c.prototype.S=function(i){if(this.t!==i&&void 0===i.e){i.x=this.t;if(void 0!==this.t)this.t.e=i;this.t=i;}};c.prototype.U=function(i){if(void 0!==this.t){var t=i.e,r=i.x;if(void 0!==t){t.x=r;i.e=void 0;}if(void 0!==r){r.e=t;i.x=void 0;}if(i===this.t)this.t=r;}};c.prototype.subscribe=function(i){var t=this;return E(function(){var r=t.value,n=32&this.f;this.f&=-33;try{i(r);}finally{this.f|=n;}});};c.prototype.valueOf=function(){return this.value;};c.prototype.toString=function(){return this.value+"";};c.prototype.toJSON=function(){return this.value;};c.prototype.peek=function(){return this.v;};Object.defineProperty(c.prototype,"value",{get:function get(){var i=u(this);if(void 0!==i)i.i=this.i;return this.v;},set:function set(r){if(n instanceof y)!function(){throw new Error("Computed cannot have side-effects");}();if(r!==this.v){if(v>100)i();this.v=r;this.i++;e++;f++;try{for(var o=this.t;void 0!==o;o=o.x)o.t.N();}finally{t();}}}});function d(i){return new c(i);}function a(i){for(var t=i.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return !0;return !1;}function l(i){for(var t=i.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r)t.r=r;t.S.n=t;t.i=-1;if(void 0===t.n){i.s=t;break;}}}function w(i){var t=i.s,r=void 0;while(void 0!==t){var n=t.p;if(-1===t.i){t.S.U(t);if(void 0!==n)n.n=t.n;if(void 0!==t.n)t.n.p=n;}else r=t;t.S.n=t.r;if(void 0!==t.r)t.r=void 0;t=n;}i.s=r;}function y(i){c.call(this,void 0);this.x=i;this.s=void 0;this.g=e-1;this.f=4;}(y.prototype=new c()).h=function(){this.f&=-3;if(1&this.f)return !1;if(32==(36&this.f))return !0;this.f&=-5;if(this.g===e)return !0;this.g=e;this.f|=1;if(this.i>0&&!a(this)){this.f&=-2;return !0;}var i=n;try{l(this);n=this;var t=this.x();if(16&this.f||this.v!==t||0===this.i){this.v=t;this.f&=-17;this.i++;}}catch(i){this.v=i;this.f|=16;this.i++;}n=i;w(this);this.f&=-2;return !0;};y.prototype.S=function(i){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t);}c.prototype.S.call(this,i);};y.prototype.U=function(i){if(void 0!==this.t){c.prototype.U.call(this,i);if(void 0===this.t){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t);}}};y.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var i=this.t;void 0!==i;i=i.x)i.t.N();}};y.prototype.peek=function(){if(!this.h())i();if(16&this.f)throw this.v;return this.v;};Object.defineProperty(y.prototype,"value",{get:function get(){if(1&this.f)i();var t=u(this);this.h();if(void 0!==t)t.i=this.i;if(16&this.f)throw this.v;return this.v;}});function p(i){var r=i.u;i.u=void 0;if("function"==typeof r){f++;var o=n;n=void 0;try{r();}catch(t){i.f&=-2;i.f|=8;g(i);throw t;}finally{n=o;t();}}}function g(i){for(var t=i.s;void 0!==t;t=t.n)t.S.U(t);i.x=void 0;i.s=void 0;p(i);}function b(i){if(n!==this)throw new Error("Out-of-order effect");w(this);n=i;this.f&=-2;if(8&this.f)g(this);t();}function x(i){this.x=i;this.u=void 0;this.s=void 0;this.o=void 0;this.f=32;}x.prototype.c=function(){var i=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();if("function"==typeof t)this.u=t;}finally{i();}};x.prototype.S=function(){if(1&this.f)i();this.f|=1;this.f&=-9;p(this);l(this);f++;var t=n;n=this;return b.bind(this,t);};x.prototype.N=function(){if(!(2&this.f)){this.f|=2;this.o=s;s=this;}};x.prototype.d=function(){this.f|=8;if(!(1&this.f))g(this);};function E(i){var t=new x(i);try{t.c();}catch(i){t.d();throw i;}return t.d.bind(t);}
|
1123
989
|
|
1124
990
|
var LifecycleStatus=/*#__PURE__*/function(LifecycleStatus){LifecycleStatus["Mounted"]="mounted";LifecycleStatus["BrowserCapabilitiesReady"]="browserCapabilitiesReady";LifecycleStatus["Configured"]="configured";LifecycleStatus["PluginsLoading"]="pluginsLoading";LifecycleStatus["PluginsReady"]="pluginsReady";LifecycleStatus["Initialized"]="initialized";LifecycleStatus["Loaded"]="loaded";LifecycleStatus["DestinationsLoading"]="destinationsLoading";LifecycleStatus["DestinationsReady"]="destinationsReady";LifecycleStatus["Ready"]="ready";return LifecycleStatus;}({});
|
1125
991
|
|
@@ -1131,7 +997,7 @@ var LifecycleStatus=/*#__PURE__*/function(LifecycleStatus){LifecycleStatus["Moun
|
|
1131
997
|
|
1132
998
|
var _LOG_LEVEL_MAP;var LOG_LEVEL_MAP=(_LOG_LEVEL_MAP={},_defineProperty(_LOG_LEVEL_MAP,LogLevel.Log,0),_defineProperty(_LOG_LEVEL_MAP,LogLevel.Info,1),_defineProperty(_LOG_LEVEL_MAP,LogLevel.Debug,2),_defineProperty(_LOG_LEVEL_MAP,LogLevel.Warn,3),_defineProperty(_LOG_LEVEL_MAP,LogLevel.Error,4),_defineProperty(_LOG_LEVEL_MAP,LogLevel.None,5),_LOG_LEVEL_MAP);var DEFAULT_LOG_LEVEL=LogLevel.Error;var LOG_MSG_PREFIX='RS SDK';var LOG_MSG_PREFIX_STYLE='font-weight: bold; background: black; color: white;';var LOG_MSG_STYLE='font-weight: normal;';/**
|
1133
999
|
* Service to log messages/data to output provider, default is console
|
1134
|
-
*/var Logger=/*#__PURE__*/function(){function Logger(){var minLogLevel=arguments.length>0&&arguments[0]!==undefined?arguments[0]:DEFAULT_LOG_LEVEL;var scope=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var logProvider=arguments.length>2&&arguments[2]!==undefined?arguments[2]:console;_classCallCheck(this,Logger);this.minLogLevel=LOG_LEVEL_MAP[minLogLevel];this.scope=scope;this.logProvider=logProvider;}_createClass(Logger,[{key:"log",value:function log(){for(var _len=arguments.length,data=new Array(_len),_key=0;_key<_len;_key++){data[_key]=arguments[_key];}this.outputLog(LogLevel.Log,data);}},{key:"info",value:function info(){for(var _len2=arguments.length,data=new Array(_len2),_key2=0;_key2<_len2;_key2++){data[_key2]=arguments[_key2];}this.outputLog(LogLevel.Info,data);}},{key:"debug",value:function debug(){for(var _len3=arguments.length,data=new Array(_len3),_key3=0;_key3<_len3;_key3++){data[_key3]=arguments[_key3];}this.outputLog(LogLevel.Debug,data);}},{key:"warn",value:function warn(){for(var _len4=arguments.length,data=new Array(_len4),_key4=0;_key4<_len4;_key4++){data[_key4]=arguments[_key4];}this.outputLog(LogLevel.Warn,data);}},{key:"error",value:function error(){for(var _len5=arguments.length,data=new Array(_len5),_key5=0;_key5<_len5;_key5++){data[_key5]=arguments[_key5];}this.outputLog(LogLevel.Error,data);}},{key:"outputLog",value:function outputLog(logMethod,data){if(this.minLogLevel<=LOG_LEVEL_MAP[logMethod]){var _this$logProvider;(_this$logProvider=this.logProvider)[logMethod.toLowerCase()].apply(_this$logProvider,_toConsumableArray(this.formatLogData(data)));}}},{key:"setScope",value:function setScope(scopeVal){this.scope=scopeVal||this.scope;}// TODO: should we allow to change the level via global variable on run time
|
1000
|
+
*/var Logger=/*#__PURE__*/function(){function Logger(){var minLogLevel=arguments.length>0&&arguments[0]!==undefined?arguments[0]:DEFAULT_LOG_LEVEL;var scope=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var logProvider=arguments.length>2&&arguments[2]!==undefined?arguments[2]:console;_classCallCheck(this,Logger);this.minLogLevel=LOG_LEVEL_MAP[minLogLevel];this.scope=scope;this.logProvider=logProvider;}_createClass(Logger,[{key:"log",value:function log(){for(var _len=arguments.length,data=new Array(_len),_key=0;_key<_len;_key++){data[_key]=arguments[_key];}this.outputLog(LogLevel.Log,data);}},{key:"info",value:function info(){for(var _len2=arguments.length,data=new Array(_len2),_key2=0;_key2<_len2;_key2++){data[_key2]=arguments[_key2];}this.outputLog(LogLevel.Info,data);}},{key:"debug",value:function debug(){for(var _len3=arguments.length,data=new Array(_len3),_key3=0;_key3<_len3;_key3++){data[_key3]=arguments[_key3];}this.outputLog(LogLevel.Debug,data);}},{key:"warn",value:function warn(){for(var _len4=arguments.length,data=new Array(_len4),_key4=0;_key4<_len4;_key4++){data[_key4]=arguments[_key4];}this.outputLog(LogLevel.Warn,data);}},{key:"error",value:function error(){for(var _len5=arguments.length,data=new Array(_len5),_key5=0;_key5<_len5;_key5++){data[_key5]=arguments[_key5];}this.outputLog(LogLevel.Error,data);}},{key:"outputLog",value:function outputLog(logMethod,data){if(this.minLogLevel<=LOG_LEVEL_MAP[logMethod]){var _this$logProvider,_this$logProvider2;(_this$logProvider=(_this$logProvider2=this.logProvider)[logMethod.toLowerCase()])===null||_this$logProvider===void 0||_this$logProvider.call.apply(_this$logProvider,[_this$logProvider2].concat(_toConsumableArray(this.formatLogData(data))));}}},{key:"setScope",value:function setScope(scopeVal){this.scope=scopeVal||this.scope;}// TODO: should we allow to change the level via global variable on run time
|
1135
1001
|
// to assist on the fly debugging?
|
1136
1002
|
},{key:"setMinLogLevel",value:function setMinLogLevel(logLevel){this.minLogLevel=LOG_LEVEL_MAP[logLevel];if(isUndefined(this.minLogLevel)){this.minLogLevel=LOG_LEVEL_MAP[DEFAULT_LOG_LEVEL];}}/**
|
1137
1003
|
* Formats the console message using `scope` and styles
|
@@ -1145,63 +1011,58 @@ LOG_MSG_STYLE// reset the style for the actual message
|
|
1145
1011
|
if(!isString(data[0])){styledLogArgs.push(data[0]);}// append rest of the original arguments
|
1146
1012
|
styledLogArgs.push.apply(styledLogArgs,_toConsumableArray(data.slice(1)));return styledLogArgs;}return data;}}]);return Logger;}();var defaultLogger=new Logger();
|
1147
1013
|
|
1148
|
-
var StorageEncryptionVersion=/*#__PURE__*/function(StorageEncryptionVersion){StorageEncryptionVersion["Legacy"]="legacy";StorageEncryptionVersion["V3"]="v3";return StorageEncryptionVersion;}({});// default
|
1149
|
-
var SUPPORTED_STORAGE_TYPES=['localStorage','memoryStorage','cookieStorage','sessionStorage','none'];var DEFAULT_STORAGE_TYPE='cookieStorage';
|
1150
|
-
|
1151
1014
|
var SOURCE_CONFIG_OPTION_ERROR="\"getSourceConfig\" must be a function. Please make sure that it is defined and returns a valid source configuration object.";var INTG_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for integrations is not valid.";var PLUGINS_CDN_BASE_URL_ERROR="Failed to load the SDK as the CDN base URL for plugins is not valid.";var DATA_PLANE_URL_ERROR="Failed to load the SDK as the data plane URL could not be determined. Please check that the data plane URL is set correctly and try again.";var XHR_PAYLOAD_PREP_ERROR="Failed to prepare data for the request.";var EVENT_OBJECT_GENERATION_ERROR="Failed to generate the event object.";var PLUGIN_EXT_POINT_MISSING_ERROR="Failed to invoke plugin because the extension point name is missing.";var PLUGIN_EXT_POINT_INVALID_ERROR="Failed to invoke plugin because the extension point name is invalid.";// ERROR
|
1152
1015
|
var UNSUPPORTED_CONSENT_MANAGER_ERROR=function UNSUPPORTED_CONSENT_MANAGER_ERROR(context,selectedConsentManager,consentManagersToPluginNameMap){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The consent manager \"").concat(selectedConsentManager,"\" is not supported. Please choose one of the following supported consent managers: \"").concat(Object.keys(consentManagersToPluginNameMap),"\".");};var REPORTING_PLUGIN_INIT_FAILURE_ERROR=function REPORTING_PLUGIN_INIT_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to initialize the error reporting plugin.");};var NOTIFY_FAILURE_ERROR=function NOTIFY_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to notify the error.");};var PLUGIN_NAME_MISSING_ERROR=function PLUGIN_NAME_MISSING_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin name is missing.");};var PLUGIN_ALREADY_EXISTS_ERROR=function PLUGIN_ALREADY_EXISTS_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" already exists.");};var PLUGIN_NOT_FOUND_ERROR=function PLUGIN_NOT_FOUND_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found.");};var PLUGIN_ENGINE_BUG_ERROR=function PLUGIN_ENGINE_BUG_ERROR(context,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.");};var PLUGIN_DEPS_ERROR=function PLUGIN_DEPS_ERROR(context,pluginName,notExistDeps){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Plugin \"").concat(pluginName,"\" could not be loaded because some of its dependencies \"").concat(notExistDeps,"\" do not exist.");};var PLUGIN_INVOCATION_ERROR=function PLUGIN_INVOCATION_ERROR(context,extPoint,pluginName){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to invoke the \"").concat(extPoint,"\" extension point of plugin \"").concat(pluginName,"\".");};var STORAGE_UNAVAILABILITY_ERROR_PREFIX=function STORAGE_UNAVAILABILITY_ERROR_PREFIX(context,storageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(storageType,"\" storage type is ");};var SOURCE_CONFIG_FETCH_ERROR=function SOURCE_CONFIG_FETCH_ERROR(reason){return "Failed to fetch the source config. Reason: ".concat(reason);};var WRITE_KEY_VALIDATION_ERROR=function WRITE_KEY_VALIDATION_ERROR(writeKey){return "The write key \"".concat(writeKey,"\" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.");};var DATA_PLANE_URL_VALIDATION_ERROR=function DATA_PLANE_URL_VALIDATION_ERROR(dataPlaneUrl){return "The data plane URL \"".concat(dataPlaneUrl,"\" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.");};var READY_API_CALLBACK_ERROR=function READY_API_CALLBACK_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The callback is not a function.");};var XHR_DELIVERY_ERROR=function XHR_DELIVERY_ERROR(prefix,status,statusText,url){return "".concat(prefix," with status: ").concat(status,", ").concat(statusText," for URL: ").concat(url,".");};var XHR_REQUEST_ERROR=function XHR_REQUEST_ERROR(prefix,e,url){return "".concat(prefix," due to timeout or no connection (").concat(e?e.type:'',") for URL: ").concat(url,".");};var XHR_SEND_ERROR=function XHR_SEND_ERROR(prefix,url){return "".concat(prefix," for URL: ").concat(url);};var STORE_DATA_SAVE_ERROR=function STORE_DATA_SAVE_ERROR(key){return "Failed to save the value for \"".concat(key,"\" to storage");};var STORE_DATA_FETCH_ERROR=function STORE_DATA_FETCH_ERROR(key){return "Failed to retrieve or parse data for \"".concat(key,"\" from storage");};// WARNING
|
1153
|
-
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType,defaultStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported
|
1016
|
+
var STORAGE_TYPE_VALIDATION_WARNING=function STORAGE_TYPE_VALIDATION_WARNING(context,storageType,defaultStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(storageType,"\" is not supported. Please choose one of the following supported types: \"").concat(SUPPORTED_STORAGE_TYPES,"\". The default type \"").concat(defaultStorageType,"\" will be used instead.");};var UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING=function UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(context,selectedErrorReportingProvider,errorReportingProvidersToPluginNameMap,defaultProvider){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The error reporting provider \"").concat(selectedErrorReportingProvider,"\" is not supported. Please choose one of the following supported providers: \"").concat(Object.keys(errorReportingProvidersToPluginNameMap),"\". The default provider \"").concat(defaultProvider,"\" will be used instead.");};var UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING=function UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(context,selectedStorageEncryptionVersion,storageEncryptionVersionsToPluginNameMap,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage encryption version \"").concat(selectedStorageEncryptionVersion,"\" is not supported. Please choose one of the following supported versions: \"").concat(Object.keys(storageEncryptionVersionsToPluginNameMap),"\". The default version \"").concat(defaultVersion,"\" will be used instead.");};var STORAGE_DATA_MIGRATION_OVERRIDE_WARNING=function STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(context,storageEncryptionVersion,defaultVersion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage data migration has been disabled because the configured storage encryption version (").concat(storageEncryptionVersion,") is not the latest (").concat(defaultVersion,"). To enable storage data migration, please update the storage encryption version to the latest version.");};var UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING=function UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING(context,selectedResidencyServerRegion,defaultRegion){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The residency server region \"").concat(selectedResidencyServerRegion,"\" is not supported. Please choose one of the following supported regions: \"").concat(Object.values(ResidencyServerRegion),"\". The default region \"").concat(defaultRegion,"\" will be used instead.");};var RESERVED_KEYWORD_WARNING=function RESERVED_KEYWORD_WARNING(context,property,parentKeyPath,reservedElements){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(property,"\" property defined under \"").concat(parentKeyPath,"\" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (").concat(reservedElements,").");};var INVALID_CONTEXT_OBJECT_WARNING=function INVALID_CONTEXT_OBJECT_WARNING(logContext){return "".concat(logContext).concat(LOG_CONTEXT_SEPARATOR,"Please make sure that the \"context\" property in the event API's \"options\" argument is a valid object literal with key-value pairs.");};var UNSUPPORTED_BEACON_API_WARNING=function UNSUPPORTED_BEACON_API_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The Beacon API is not supported by your browser. The events will be sent using XHR instead.");};var TIMEOUT_NOT_NUMBER_WARNING=function TIMEOUT_NOT_NUMBER_WARNING(context,timeout,defaultValue){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value \"").concat(timeout,"\" is not a number. The default timeout of ").concat(defaultValue," ms will be used instead.");};var TIMEOUT_ZERO_WARNING=function TIMEOUT_ZERO_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.");};var TIMEOUT_NOT_RECOMMENDED_WARNING=function TIMEOUT_NOT_RECOMMENDED_WARNING(context,timeout,minTimeout){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The session timeout value ").concat(timeout," ms is less than the recommended minimum of ").concat(minTimeout," ms. Please consider increasing the timeout value to ensure optimal performance and reliability.");};var INVALID_SESSION_ID_WARNING=function INVALID_SESSION_ID_WARNING(context,sessionId,minSessionIdLength){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided session ID (").concat(sessionId,") is either invalid, not a positive integer, or not at least \"").concat(minSessionIdLength,"\" digits long. A new session ID will be auto-generated instead.");};var STORAGE_QUOTA_EXCEEDED_WARNING=function STORAGE_QUOTA_EXCEEDED_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.");};var STORAGE_UNAVAILABLE_WARNING=function STORAGE_UNAVAILABLE_WARNING(context,selectedStorageType,finalStorageType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The storage type \"").concat(selectedStorageType,"\" is not available. The SDK will be initialized with \"").concat(finalStorageType,"\" instead.");};var WRITE_KEY_NOT_A_STRING_ERROR=function WRITE_KEY_NOT_A_STRING_ERROR(context,writeKey){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The write key \"").concat(writeKey,"\" is not a string. Please check that the write key is correct and try again.");};var EMPTY_GROUP_CALL_ERROR=function EMPTY_GROUP_CALL_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The group() method must be called with at least one argument.");};var READY_CALLBACK_INVOKE_ERROR="Failed to invoke the ready callback";var API_CALLBACK_INVOKE_ERROR="API Callback Invocation Failed";var INVALID_CONFIG_URL_WARNING=function INVALID_CONFIG_URL_WARNING(context,configUrl){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The provided config URL \"").concat(configUrl,"\" is invalid. Using the default value instead.");};var POLYFILL_SCRIPT_LOAD_ERROR=function POLYFILL_SCRIPT_LOAD_ERROR(scriptId,url){return "Failed to load the polyfill script with ID \"".concat(scriptId,"\" from URL ").concat(url,".");};var COOKIE_DATA_ENCODING_ERROR="Failed to encode the cookie data.";var UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY=function UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(context,selectedStrategy,defaultStrategy){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent storage strategy \"").concat(selectedStrategy,"\" is not supported. Please choose one of the following supported strategies: \"").concat(Object.values(StorageStrategy),"\". The default strategy \"").concat(defaultStrategy,"\" will be used instead.");};var UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE=function UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(context,selectedDeliveryType,defaultDeliveryType){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The pre-consent events delivery type \"").concat(selectedDeliveryType,"\" is not supported. Please choose one of the following supported types: \"").concat(Object.values(DeliveryType),"\". The default type \"").concat(defaultDeliveryType,"\" will be used instead.");};// DEBUG
|
1154
1017
|
|
1155
|
-
var
|
1156
|
-
var DEFAULT_COOKIE_MAX_AGE_MS=31536000*1000;// 1 year
|
1157
|
-
var DEFAULT_SESSION_TIMEOUT_MS=30*60*1000;// 30 minutes
|
1158
|
-
var MIN_SESSION_TIMEOUT_MS=10*1000;// 10 seconds
|
1159
|
-
var DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS=10*1000;// 10 seconds
|
1018
|
+
var CDN_INT_DIR='js-integrations';var CDN_PLUGINS_DIR='plugins';
|
1160
1019
|
|
1161
|
-
var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CDN_ARCH_VERSION_DIR='v3';var
|
1020
|
+
var BUILD_TYPE='legacy';var SDK_CDN_BASE_URL='https://cdn.rudderlabs.com';var CDN_ARCH_VERSION_DIR='v3';var DEST_SDK_BASE_URL="".concat(SDK_CDN_BASE_URL,"/beta/3.0.0-beta/").concat(BUILD_TYPE,"/").concat(CDN_INT_DIR);var PLUGINS_BASE_URL="".concat(SDK_CDN_BASE_URL,"/beta/3.0.0-beta/").concat(BUILD_TYPE,"/").concat(CDN_PLUGINS_DIR);// TODO: change the above to production URLs when beta phase is done
|
1162
1021
|
// const DEST_SDK_BASE_URL = `${SDK_CDN_BASE_URL}/latest/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${CDN_INT_DIR}`;
|
1163
1022
|
// const PLUGINS_BASE_URL = `${SDK_CDN_BASE_URL}/latest/${CDN_ARCH_VERSION_DIR}/${BUILD_TYPE}/${CDN_PLUGINS_DIR}`;
|
1164
1023
|
var DEFAULT_CONFIG_BE_URL='https://api.rudderstack.com';
|
1165
1024
|
|
1166
1025
|
var _StorageEncryptionVer;var DEFAULT_ERROR_REPORTING_PROVIDER='bugsnag';var DEFAULT_STORAGE_ENCRYPTION_VERSION=StorageEncryptionVersion.V3;var ConsentManagersToPluginNameMap={oneTrust:PluginName.OneTrustConsentManager,ketch:PluginName.KetchConsentManager};var ErrorReportingProvidersToPluginNameMap=_defineProperty({},DEFAULT_ERROR_REPORTING_PROVIDER,PluginName.Bugsnag);var StorageEncryptionVersionsToPluginNameMap=(_StorageEncryptionVer={},_defineProperty(_StorageEncryptionVer,DEFAULT_STORAGE_ENCRYPTION_VERSION,PluginName.StorageEncryption),_defineProperty(_StorageEncryptionVer,StorageEncryptionVersion.Legacy,PluginName.StorageEncryptionLegacy),_StorageEncryptionVer);
|
1167
1026
|
|
1168
|
-
var defaultLoadOptions={logLevel:LogLevel.Error,configUrl:DEFAULT_CONFIG_BE_URL,loadIntegration:true,sessions:{autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS},sameSiteCookie:CookieSameSite.Lax,polyfillIfRequired:true,integrations:{All:true},useBeacon:false,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:false,uaChTrackLevel:UaChTrackLevel.None,plugins:[],useGlobalIntegrationsConfigInEvents:false,bufferDataPlaneEventsUntilReady:false,dataPlaneEventsBufferTimeout:DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,storage:{encryption:{version:DEFAULT_STORAGE_ENCRYPTION_VERSION},migrate:false},sendAdblockPageOptions:{}};var loadOptionsState=
|
1027
|
+
var defaultLoadOptions={logLevel:LogLevel.Error,configUrl:DEFAULT_CONFIG_BE_URL,loadIntegration:true,sessions:{autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS},sameSiteCookie:CookieSameSite.Lax,polyfillIfRequired:true,integrations:{All:true},useBeacon:false,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:false,uaChTrackLevel:UaChTrackLevel.None,plugins:[],useGlobalIntegrationsConfigInEvents:false,bufferDataPlaneEventsUntilReady:false,dataPlaneEventsBufferTimeout:DEFAULT_DATA_PLANE_EVENTS_BUFFER_TIMEOUT_MS,storage:{encryption:{version:DEFAULT_STORAGE_ENCRYPTION_VERSION},migrate:false},sendAdblockPageOptions:{}};var loadOptionsState=d(clone$1(defaultLoadOptions));
|
1028
|
+
|
1029
|
+
var userSessionStorageKeys={userId:'rl_user_id',userTraits:'rl_trait',anonymousId:'rl_anonymous_id',groupId:'rl_group_id',groupTraits:'rl_group_trait',initialReferrer:'rl_page_init_referrer',initialReferringDomain:'rl_page_init_referring_domain',sessionInfo:'rl_session'};var defaultUserSessionValues={userId:'',userTraits:{},anonymousId:'',groupId:'',groupTraits:{},initialReferrer:'',initialReferringDomain:'',sessionInfo:{}};
|
1169
1030
|
|
1170
|
-
var defaultSessionInfo={autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS};var sessionState={userId:
|
1031
|
+
var defaultSessionInfo={autoTrack:true,timeout:DEFAULT_SESSION_TIMEOUT_MS};var sessionState={userId:d(defaultUserSessionValues.userId),userTraits:d(defaultUserSessionValues.userTraits),anonymousId:d(defaultUserSessionValues.anonymousId),groupId:d(defaultUserSessionValues.groupId),groupTraits:d(defaultUserSessionValues.groupTraits),initialReferrer:d(defaultUserSessionValues.initialReferrer),initialReferringDomain:d(defaultUserSessionValues.initialReferringDomain),sessionInfo:d(defaultUserSessionValues.sessionInfo)};
|
1171
1032
|
|
1172
|
-
var capabilitiesState={isOnline:
|
1033
|
+
var capabilitiesState={isOnline:d(true),storage:{isLocalStorageAvailable:d(false),isCookieStorageAvailable:d(false),isSessionStorageAvailable:d(false)},isBeaconAvailable:d(false),isLegacyDOM:d(false),isUaCHAvailable:d(false),isCryptoAvailable:d(false),isIE11:d(false),isAdBlocked:d(false)};
|
1173
1034
|
|
1174
|
-
var reportingState={isErrorReportingEnabled:
|
1035
|
+
var reportingState={isErrorReportingEnabled:d(false),isMetricsReportingEnabled:d(false),errorReportingProviderPluginName:d(undefined)};
|
1175
1036
|
|
1176
|
-
var sourceConfigState=
|
1037
|
+
var sourceConfigState=d(undefined);
|
1177
1038
|
|
1178
|
-
var lifecycleState={activeDataplaneUrl:
|
1039
|
+
var lifecycleState={activeDataplaneUrl:d(undefined),integrationsCDNPath:d(DEST_SDK_BASE_URL),pluginsCDNPath:d(PLUGINS_BASE_URL),sourceConfigUrl:d(undefined),status:d(undefined),initialized:d(false),logLevel:d(LogLevel.Error),loaded:d(false),readyCallbacks:d([]),writeKey:d(undefined),dataPlaneUrl:d(undefined)};
|
1179
1040
|
|
1180
|
-
var consentsState={data:
|
1041
|
+
var consentsState={data:d({initialized:false}),activeConsentManagerPluginName:d(undefined),preConsentOptions:d({enabled:false})};
|
1181
1042
|
|
1182
|
-
var metricsState={retries:
|
1043
|
+
var metricsState={retries:d(0),dropped:d(0),sent:d(0),queued:d(0),triggered:d(0)};
|
1183
1044
|
|
1184
|
-
var contextState={app:
|
1045
|
+
var contextState={app:d({name:APP_NAME,namespace:APP_NAMESPACE,version:APP_VERSION}),traits:d(null),library:d({name:APP_NAME,version:APP_VERSION}),userAgent:d(''),device:d(null),network:d(null),os:d({name:'',version:''}),locale:d(null),screen:d({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),'ua-ch':d(undefined)};
|
1185
1046
|
|
1186
|
-
var nativeDestinationsState={configuredDestinations:
|
1047
|
+
var nativeDestinationsState={configuredDestinations:d([]),activeDestinations:d([]),loadOnlyIntegrations:d({}),failedDestinations:d([]),loadIntegration:d(true),initializedDestinations:d([]),clientDestinationsReady:d(false),integrationsConfig:d({})};
|
1187
1048
|
|
1188
|
-
var eventBufferState={toBeProcessedArray:
|
1049
|
+
var eventBufferState={toBeProcessedArray:d([]),readyCallbacksArray:d([])};
|
1189
1050
|
|
1190
|
-
var pluginsState={ready:
|
1051
|
+
var pluginsState={ready:d(false),loadedPlugins:d([]),failedPlugins:d([]),pluginsToLoadFromConfig:d([]),activePlugins:d([]),totalPluginsToLoad:d(0)};
|
1191
1052
|
|
1192
|
-
var storageState={encryptionPluginName:
|
1053
|
+
var storageState={encryptionPluginName:d(undefined),migrate:d(false),type:d(undefined),cookie:d(undefined),entries:d({}),trulyAnonymousTracking:d(false)};
|
1193
1054
|
|
1194
1055
|
var defaultStateValues={capabilities:capabilitiesState,consents:consentsState,context:contextState,eventBuffer:eventBufferState,lifecycle:lifecycleState,loadOptions:loadOptionsState,metrics:metricsState,nativeDestinations:nativeDestinationsState,plugins:pluginsState,reporting:reportingState,session:sessionState,source:sourceConfigState,storage:storageState};var state=_objectSpread2({},clone$1(defaultStateValues));
|
1195
1056
|
|
1196
1057
|
// to next or return the value if it is the last one instead of an array per
|
1197
1058
|
// plugin that is the normal invoke
|
1198
1059
|
// TODO: add invoke method for extension point that we know only one plugin can be used. add invokeMultiple and invokeSingle methods
|
1199
|
-
var PluginEngine=/*#__PURE__*/function(){function PluginEngine(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,PluginEngine);_defineProperty(this,"plugins",[]);_defineProperty(this,"byName",{});_defineProperty(this,"cache",{});_defineProperty(this,"config",{throws:true});this.config=_objectSpread2({throws:true},options);this.logger=logger;}_createClass(PluginEngine,[{key:"register",value:function register(plugin,state){if(!plugin.name){var errorMessage=PLUGIN_NAME_MISSING_ERROR(PLUGIN_ENGINE);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0
|
1200
|
-
var notExistDeps=plugin.deps.filter(function(dependency){return !_this.byName[dependency];});(_this$logger5=_this.logger)===null||_this$logger5===void 0
|
1060
|
+
var PluginEngine=/*#__PURE__*/function(){function PluginEngine(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,PluginEngine);_defineProperty(this,"plugins",[]);_defineProperty(this,"byName",{});_defineProperty(this,"cache",{});_defineProperty(this,"config",{throws:true});this.config=_objectSpread2({throws:true},options);this.logger=logger;}_createClass(PluginEngine,[{key:"register",value:function register(plugin,state){if(!plugin.name){var errorMessage=PLUGIN_NAME_MISSING_ERROR(PLUGIN_ENGINE);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.error(errorMessage,plugin);}}if(this.byName[plugin.name]){var _errorMessage=PLUGIN_ALREADY_EXISTS_ERROR(PLUGIN_ENGINE,plugin.name);if(this.config.throws){throw new Error(_errorMessage);}else {var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.error(_errorMessage);}}this.cache={};this.plugins=this.plugins.slice();var pos=this.plugins.length;this.plugins.forEach(function(pluginItem,index){var _pluginItem$deps;if((_pluginItem$deps=pluginItem.deps)!==null&&_pluginItem$deps!==void 0&&_pluginItem$deps.includes(plugin.name)){pos=Math.min(pos,index);}});this.plugins.splice(pos,0,plugin);this.byName[plugin.name]=plugin;if(plugin.initialize&&isFunction(plugin.initialize)){plugin.initialize(state);}}},{key:"unregister",value:function unregister(name){var plugin=this.byName[name];if(!plugin){var errorMessage=PLUGIN_NOT_FOUND_ERROR(PLUGIN_ENGINE,name);if(this.config.throws){throw new Error(errorMessage);}else {var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.error(errorMessage);}}var index=this.plugins.indexOf(plugin);if(index===-1){var _errorMessage2=PLUGIN_ENGINE_BUG_ERROR(PLUGIN_ENGINE,name);if(this.config.throws){throw new Error(_errorMessage2);}else {var _this$logger4;(_this$logger4=this.logger)===null||_this$logger4===void 0||_this$logger4.error(_errorMessage2);}}this.cache={};delete this.byName[name];this.plugins=this.plugins.slice();this.plugins.splice(index,1);}},{key:"getPlugin",value:function getPlugin(name){return this.byName[name];}},{key:"getPlugins",value:function getPlugins(extPoint){var _this=this;var lifeCycleName=extPoint!==null&&extPoint!==void 0?extPoint:'.';if(!this.cache[lifeCycleName]){this.cache[lifeCycleName]=this.plugins.filter(function(plugin){var _plugin$deps;if((_plugin$deps=plugin.deps)!==null&&_plugin$deps!==void 0&&_plugin$deps.some(function(dependency){return !_this.byName[dependency];})){var _this$logger5;// If deps not exist, then not load it.
|
1061
|
+
var notExistDeps=plugin.deps.filter(function(dependency){return !_this.byName[dependency];});(_this$logger5=_this.logger)===null||_this$logger5===void 0||_this$logger5.error(PLUGIN_DEPS_ERROR(PLUGIN_ENGINE,plugin.name,notExistDeps));return false;}return lifeCycleName==='.'?true:hasValueByPath(plugin,lifeCycleName);});}return this.cache[lifeCycleName];}// This method allows to process this.plugins so that it could
|
1201
1062
|
// do some unified pre-process before application starts.
|
1202
1063
|
},{key:"processRawPlugins",value:function processRawPlugins(callback){callback(this.plugins);this.cache={};}},{key:"invoke",value:function invoke(extPoint){var _this$config$throws,_this2=this;var allowMultiple=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}var extensionPointName=extPoint;if(!extensionPointName){throw new Error(PLUGIN_EXT_POINT_MISSING_ERROR);}var noCall=extensionPointName.startsWith('!');var throws=(_this$config$throws=this.config.throws)!==null&&_this$config$throws!==void 0?_this$config$throws:extensionPointName.endsWith('!');// eslint-disable-next-line unicorn/better-regex
|
1203
1064
|
extensionPointName=extensionPointName.replace(/(^!|!$)/g,'');if(!extensionPointName){throw new Error(PLUGIN_EXT_POINT_INVALID_ERROR);}var extensionPointNameParts=extensionPointName.split('.');extensionPointNameParts.pop();var pluginMethodPath=extensionPointNameParts.join('.');var pluginsToInvoke=allowMultiple?this.getPlugins(extensionPointName):[this.getPlugins(extensionPointName)[0]];return pluginsToInvoke.map(function(plugin){var method=getValueByPath(plugin,extensionPointName);if(!isFunction(method)||noCall){return method;}try{return method.apply(getValueByPath(plugin,pluginMethodPath),args);}catch(err){// When a plugin failed, doesn't break the app
|
1204
|
-
if(throws){throw err;}else {var _this2$logger;(_this2$logger=_this2.logger)===null||_this2$logger===void 0
|
1065
|
+
if(throws){throw err;}else {var _this2$logger;(_this2$logger=_this2.logger)===null||_this2$logger===void 0||_this2$logger.error(PLUGIN_INVOCATION_ERROR(PLUGIN_ENGINE,extensionPointName,plugin.name),err);}}return null;});}},{key:"invokeSingle",value:function invokeSingle(extPoint){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}return this.invoke.apply(this,[extPoint,false].concat(args))[0];}},{key:"invokeMultiple",value:function invokeMultiple(extPoint){for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++){args[_key3-1]=arguments[_key3];}return this.invoke.apply(this,[extPoint,true].concat(args));}}]);return PluginEngine;}();var defaultPluginEngine=new PluginEngine({throws:true},defaultLogger);
|
1205
1066
|
|
1206
1067
|
var FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';var ERROR_MESSAGES_TO_BE_FILTERED=[FAILED_REQUEST_ERR_MSG_PREFIX];
|
1207
1068
|
|
@@ -1216,7 +1077,7 @@ var FAILED_REQUEST_ERR_MSG_PREFIX='The request failed';var ERROR_MESSAGES_TO_BE_
|
|
1216
1077
|
/**
|
1217
1078
|
* A service to handle errors
|
1218
1079
|
*/var ErrorHandler=/*#__PURE__*/function(){// If no logger is passed errors will be thrown as unhandled error
|
1219
|
-
function ErrorHandler(logger,pluginEngine){_classCallCheck(this,ErrorHandler);this.logger=logger;this.pluginEngine=pluginEngine;}_createClass(ErrorHandler,[{key:"init",value:function init(externalSrcLoader){var _this=this;if(!this.pluginEngine){return;}try{var extPoint='errorReporting.init';var errReportingInitVal=this.pluginEngine.invokeSingle(extPoint,state,this.pluginEngine,externalSrcLoader,this.logger);if(errReportingInitVal instanceof Promise){errReportingInitVal.then(function(client){_this.errReportingClient=client;}).catch(function(err){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0
|
1080
|
+
function ErrorHandler(logger,pluginEngine){_classCallCheck(this,ErrorHandler);this.logger=logger;this.pluginEngine=pluginEngine;}_createClass(ErrorHandler,[{key:"init",value:function init(externalSrcLoader){var _this=this;if(!this.pluginEngine){return;}try{var extPoint='errorReporting.init';var errReportingInitVal=this.pluginEngine.invokeSingle(extPoint,state,this.pluginEngine,externalSrcLoader,this.logger);if(errReportingInitVal instanceof Promise){errReportingInitVal.then(function(client){_this.errReportingClient=client;}).catch(function(err){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.error(REPORTING_PLUGIN_INIT_FAILURE_ERROR(ERROR_HANDLER),err);});}}catch(err){this.onError(err,ERROR_HANDLER);}}},{key:"onError",value:function onError(error){var context=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'';var customMessage=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';var shouldAlwaysThrow=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;// Error handling is already implemented in processError method
|
1220
1081
|
var errorMessage=processError(error);// If no error message after we normalize, then we swallow/ignore the errors
|
1221
1082
|
if(!errorMessage){return;}errorMessage=removeDoubleSpaces("".concat(context).concat(LOG_CONTEXT_SEPARATOR).concat(customMessage," ").concat(errorMessage));var normalizedError=error;// Enhance error message
|
1222
1083
|
if(isTypeOfError(error)){normalizedError.message=errorMessage;}else {normalizedError=new Error(errorMessage);}this.notifyError(normalizedError);if(this.logger){this.logger.error(errorMessage);if(shouldAlwaysThrow){throw normalizedError;}}else {throw normalizedError;}}/**
|
@@ -1229,7 +1090,7 @@ if(isTypeOfError(error)){normalizedError.message=errorMessage;}else {normalizedE
|
|
1229
1090
|
*
|
1230
1091
|
* @param {Error} error Error instance from handled error
|
1231
1092
|
*/},{key:"notifyError",value:function notifyError(error){if(this.pluginEngine&&isAllowedToBeNotified(error)){try{this.pluginEngine.invokeSingle('errorReporting.notify',this.pluginEngine,this.errReportingClient,error,state,this.logger);}catch(err){var _this$logger2;// Not calling onError here as we don't want to go into infinite loop
|
1232
|
-
(_this$logger2=this.logger)===null||_this$logger2===void 0
|
1093
|
+
(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.error(NOTIFY_FAILURE_ERROR(ERROR_HANDLER),err);}}}}]);return ErrorHandler;}();var defaultErrorHandler=new ErrorHandler(defaultLogger,defaultPluginEngine);
|
1233
1094
|
|
1234
1095
|
var DestinationConnectionMode=/*#__PURE__*/function(DestinationConnectionMode){DestinationConnectionMode["Hybrid"]="hybrid";DestinationConnectionMode["Cloud"]="cloud";DestinationConnectionMode["Device"]="device";return DestinationConnectionMode;}({});
|
1235
1096
|
|
@@ -1255,295 +1116,281 @@ destination.config.useNativeSDK===true);};var isHybridModeDestination=function i
|
|
1255
1116
|
* @returns ISO formatted timestamp string
|
1256
1117
|
*/var getCurrentTimeFormatted=function getCurrentTimeFormatted(){var curDateTime=new Date().toISOString();return curDateTime;};
|
1257
1118
|
|
1258
|
-
|
1259
|
-
|
1260
|
-
var SIZE=4096,HEX$1=[],IDX$1=0,BUFFER$1;for(;IDX$1<256;IDX$1++){HEX$1[IDX$1]=(IDX$1+256).toString(16).substring(1);}function v4$1(){if(!BUFFER$1||IDX$1+16>SIZE){BUFFER$1=random(SIZE);IDX$1=0;}var i=0,tmp,out='';for(;i<16;i++){tmp=BUFFER$1[IDX$1+i];if(i==6)out+=HEX$1[tmp&15|64];else if(i==8)out+=HEX$1[tmp&63|128];else out+=HEX$1[tmp];if(i&1&&i>1&&i<11)out+='-';}IDX$1+=16;return out;}
|
1119
|
+
var EVENT_PAYLOAD_SIZE_BYTES_LIMIT=32*1024;// 32 KB
|
1261
1120
|
|
1262
|
-
var
|
1121
|
+
var INVALID_SOURCE_CONFIG_ERROR="Invalid source configuration or source id.";// ERROR
|
1122
|
+
var BEACON_QUEUE_SEND_ERROR=function BEACON_QUEUE_SEND_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to send events batch data to the browser's beacon queue. The events will be dropped.");};var BEACON_QUEUE_DELIVERY_ERROR=function BEACON_QUEUE_DELIVERY_ERROR(url){return "Failed to send events batch data to the browser's beacon queue for URL ".concat(url,".");};var BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR=function BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to convert events batch object to string.");};var BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR=function BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to convert events batch object to Blob.");};var BUGSNAG_SDK_LOAD_ERROR=function BUGSNAG_SDK_LOAD_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load the Bugsnag SDK.");};var DESTINATION_NOT_SUPPORTED_ERROR=function DESTINATION_NOT_SUPPORTED_ERROR(destUserFriendlyId){return "Destination ".concat(destUserFriendlyId," is not supported.");};var DESTINATION_SDK_LOAD_ERROR=function DESTINATION_SDK_LOAD_ERROR(context,destUserFriendlyId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load script for destination ").concat(destUserFriendlyId,".");};var DESTINATION_INIT_ERROR=function DESTINATION_INIT_ERROR(destUserFriendlyId){return "Failed to initialize destination ".concat(destUserFriendlyId,".");};var DESTINATION_INTEGRATIONS_DATA_ERROR=function DESTINATION_INTEGRATIONS_DATA_ERROR(destUserFriendlyId){return "Failed to get integrations data for destination ".concat(destUserFriendlyId,".");};var DESTINATION_EVENT_FILTERING_WARNING=function DESTINATION_EVENT_FILTERING_WARNING(context,eventName,destUserFriendlyId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(eventName,"\" track event has been filtered for the \"").concat(destUserFriendlyId,"\" destination.");};var ONETRUST_ACCESS_ERROR=function ONETRUST_ACCESS_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to access OneTrust SDK resources. Please ensure that the OneTrust SDK is loaded successfully before RudderStack SDK.");};var KETCH_CONSENT_COOKIE_READ_ERROR=function KETCH_CONSENT_COOKIE_READ_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to read the consent cookie.");};var KETCH_CONSENT_COOKIE_PARSE_ERROR=function KETCH_CONSENT_COOKIE_PARSE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to parse the consent cookie.");};var DESTINATION_CONSENT_STATUS_ERROR="Failed to determine the consent status for the destination. Please check the destination configuration and try again.";var STORAGE_MIGRATION_ERROR=function STORAGE_MIGRATION_ERROR(key){return "Failed to retrieve or parse data for ".concat(key," from storage.");};var RETRY_QUEUE_PROCESS_ERROR=function RETRY_QUEUE_PROCESS_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Process function threw an error.");};var EVENT_DELIVERY_FAILURE_ERROR_PREFIX=function EVENT_DELIVERY_FAILURE_ERROR_PREFIX(context,url){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to deliver event(s) to ").concat(url,".");};var BUGSNAG_API_KEY_VALIDATION_ERROR=function BUGSNAG_API_KEY_VALIDATION_ERROR(apiKey){return "The Bugsnag API key (".concat(apiKey,") is invalid or not provided.");};var DESTINATION_READY_TIMEOUT_ERROR=function DESTINATION_READY_TIMEOUT_ERROR(timeout,destUserFriendlyId){return "A timeout of ".concat(timeout," ms occurred while trying to check the ready status for \"").concat(destUserFriendlyId,"\" destination.");};var DESTINATION_EVENT_FORWARDING_ERROR=function DESTINATION_EVENT_FORWARDING_ERROR(destUserFriendlyId){return "Failed to forward event to destination \"".concat(destUserFriendlyId,"\".");};var BUGSNAG_SDK_LOAD_TIMEOUT_ERROR=function BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(timeout){return "A timeout ".concat(timeout," ms occurred while trying to load the Bugsnag SDK.");};// WARN
|
1123
|
+
var EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING=function EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING(context,payloadSize,sizeLimit){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The size of the event payload (").concat(payloadSize," bytes) exceeds the maximum limit of ").concat(sizeLimit," bytes. Events with large payloads may be dropped in the future. Please review your instrumentation to ensure that event payloads are within the size limit.");};var EVENT_PAYLOAD_SIZE_VALIDATION_WARNING=function EVENT_PAYLOAD_SIZE_VALIDATION_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to validate event payload size. Please make sure that the event payload is within the size limit and is a valid JSON object.");};// DEBUG
|
1124
|
+
var BEACON_PLUGIN_EVENTS_QUEUE_DEBUG=function BEACON_PLUGIN_EVENTS_QUEUE_DEBUG(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Sending events to data plane.");};
|
1263
1125
|
|
1264
|
-
var
|
1126
|
+
var QUEUE_UTILITIES='QueueUtilities';/**
|
1127
|
+
* Utility to get the stringified event payload
|
1128
|
+
* @param event RudderEvent object
|
1129
|
+
* @param logger Logger instance
|
1130
|
+
* @returns stringified event payload. Empty string if error occurs.
|
1131
|
+
*/var getDeliveryPayload$1=function getDeliveryPayload(event,logger){return stringifyWithoutCircular(event,true,undefined,logger);};var getBatchDeliveryPayload=function getBatchDeliveryPayload(events,logger){return stringifyWithoutCircular({batch:events},true,undefined,logger);};/**
|
1132
|
+
* Utility to validate final payload size before sending to server
|
1133
|
+
* @param event RudderEvent object
|
1134
|
+
* @param logger Logger instance
|
1135
|
+
*/var validateEventPayloadSize=function validateEventPayloadSize(event,logger){var payloadStr=getDeliveryPayload$1(event,logger);if(payloadStr){var payloadSize=payloadStr.length;if(payloadSize>EVENT_PAYLOAD_SIZE_BYTES_LIMIT){logger===null||logger===void 0||logger.warn(EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING(QUEUE_UTILITIES,payloadSize,EVENT_PAYLOAD_SIZE_BYTES_LIMIT));}}else {logger===null||logger===void 0||logger.warn(EVENT_PAYLOAD_SIZE_VALIDATION_WARNING(QUEUE_UTILITIES));}};/**
|
1136
|
+
* Mutates the event and return final event for delivery
|
1137
|
+
* Updates certain parameters like sentAt timestamp, integrations config etc.
|
1138
|
+
* @param event RudderEvent object
|
1139
|
+
* @param state Application state
|
1140
|
+
* @returns Final event ready to be delivered
|
1141
|
+
*/var getFinalEventForDeliveryMutator=function getFinalEventForDeliveryMutator(event){var finalEvent=clone$1(event);// Update sentAt timestamp to the latest timestamp
|
1142
|
+
finalEvent.sentAt=getCurrentTimeFormatted();return finalEvent;};
|
1265
1143
|
|
1266
|
-
var
|
1144
|
+
var removeDuplicateSlashes=function removeDuplicateSlashes(str){return str.replace(/\/{2,}/g,'/');};
|
1267
1145
|
|
1268
|
-
var
|
1146
|
+
var DEFAULT_BEACON_QUEUE_MAX_SIZE=10;var DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS=10*60*1000;// 10 minutes
|
1147
|
+
// Limit of the Beacon transfer mechanism on the browsers
|
1148
|
+
var MAX_BATCH_PAYLOAD_SIZE_BYTES=64*1024;// 64 KB
|
1149
|
+
var DEFAULT_BEACON_QUEUE_OPTIONS={maxItems:DEFAULT_BEACON_QUEUE_MAX_SIZE,flushQueueInterval:DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS};var DATA_PLANE_API_VERSION$1='v1';var QUEUE_NAME$2='rudder_beacon';var BEACON_QUEUE_PLUGIN='BeaconQueuePlugin';
|
1269
1150
|
|
1270
|
-
|
1151
|
+
/**
|
1152
|
+
* Utility to get the stringified event payload as Blob
|
1153
|
+
* @param events RudderEvent object array
|
1154
|
+
* @param logger Logger instance
|
1155
|
+
* @returns stringified events payload as Blob, undefined if error occurs.
|
1156
|
+
*/var getDeliveryPayload=function getDeliveryPayload(events,logger){var data={batch:events};try{var blobPayload=stringifyWithoutCircular(data,true);var blobOptions={type:'text/plain'};if(blobPayload){return new Blob([blobPayload],blobOptions);}logger===null||logger===void 0||logger.error(BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN));}catch(err){logger===null||logger===void 0||logger.error(BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN),err);}return undefined;};var getNormalizedBeaconQueueOptions=function getNormalizedBeaconQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_BEACON_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl$1=function getDeliveryUrl(dataplaneUrl,writeKey){var dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/','beacon','/',DATA_PLANE_API_VERSION$1,'/',"batch?writeKey=".concat(writeKey)].join('')),dpUrl).href;};
|
1271
1157
|
|
1272
|
-
|
1158
|
+
function random(len){return crypto.getRandomValues(new Uint8Array(len));}
|
1273
1159
|
|
1274
|
-
var
|
1160
|
+
var SIZE=4096,HEX$1=[],IDX$1=0,BUFFER$1;for(;IDX$1<256;IDX$1++){HEX$1[IDX$1]=(IDX$1+256).toString(16).substring(1);}function v4$1(){if(!BUFFER$1||IDX$1+16>SIZE){BUFFER$1=random(SIZE);IDX$1=0;}var i=0,tmp,out='';for(;i<16;i++){tmp=BUFFER$1[IDX$1+i];if(i==6)out+=HEX$1[tmp&15|64];else if(i==8)out+=HEX$1[tmp&63|128];else out+=HEX$1[tmp];if(i&1&&i>1&&i<11)out+='-';}IDX$1+=16;return out;}
|
1275
1161
|
|
1276
|
-
var
|
1162
|
+
var IDX=256,HEX=[],BUFFER;while(IDX--)HEX[IDX]=(IDX+256).toString(16).substring(1);function v4(){var i=0,num,out='';if(!BUFFER||IDX+16>256){BUFFER=Array(i=256);while(i--)BUFFER[i]=256*Math.random()|0;i=IDX=0;}for(;i<16;i++){num=BUFFER[IDX+i];if(i==6)out+=HEX[num&15|64];else if(i==8)out+=HEX[num&63|128];else out+=HEX[num];if(i&1&&i>1&&i<11)out+='-';}IDX++;return out;}
|
1277
1163
|
|
1278
|
-
var
|
1164
|
+
var hasCrypto$1=function hasCrypto(){return !isNullOrUndefined(globalThis.crypto)&&isFunction(globalThis.crypto.getRandomValues);};
|
1279
1165
|
|
1280
|
-
var
|
1166
|
+
var generateUUID=function generateUUID(){if(hasCrypto$1()){return v4$1();}return v4();};
|
1281
1167
|
|
1282
|
-
var
|
1168
|
+
var COOKIE_STORAGE='cookieStorage';var LOCAL_STORAGE='localStorage';var SESSION_STORAGE='sessionStorage';var MEMORY_STORAGE='memoryStorage';var NO_STORAGE='none';
|
1283
1169
|
|
1284
|
-
var
|
1170
|
+
var sortByTime$1=function sortByTime(a,b){return a.time-b.time;};var BeaconItemsQueue=/*#__PURE__*/function(){function BeaconItemsQueue(name,options,queueProcessCb,storeManager){var _options$maxItems,_options$flushQueueIn;var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:MEMORY_STORAGE;_classCallCheck(this,BeaconItemsQueue);this.storeManager=storeManager;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.maxItems=(_options$maxItems=options.maxItems)!==null&&_options$maxItems!==void 0?_options$maxItems:DEFAULT_BEACON_QUEUE_OPTIONS.maxItems;this.timeouts={flushQueueTimeOutInterval:(_options$flushQueueIn=options.flushQueueInterval)!==null&&_options$flushQueueIn!==void 0?_options$flushQueueIn:DEFAULT_BEACON_QUEUE_OPTIONS.flushQueueInterval};this.flushInProgress=false;this.nextFlushPending=false;// Set up our empty queues
|
1171
|
+
this.store=this.storeManager.setStore({id:this.id,name:this.name,type:storageType});this.flushQueue=this.flushQueue.bind(this);this.attachListeners();this.flushQueueTimeOut=undefined;this.scheduleTimeoutActive=false;}_createClass(BeaconItemsQueue,[{key:"attachListeners",value:function attachListeners(){var _this=this;globalThis.addEventListener('visibilitychange',function(){if(document.visibilityState==='hidden'){_this.flushQueue();}});}},{key:"getQueue",value:function getQueue(name){var _this$store$get;return (_this$store$get=this.store.get(name!==null&&name!==void 0?name:this.name))!==null&&_this$store$get!==void 0?_this$store$get:[];}},{key:"setQueue",value:function setQueue(name,value){this.store.set(name!==null&&name!==void 0?name:this.name,value!==null&&value!==void 0?value:[]);}},{key:"start",value:function start(){if(!this.scheduleTimeoutActive){this.flushQueueTimeOut=globalThis.setTimeout(this.flushQueue,this.timeouts.flushQueueTimeOutInterval);this.scheduleTimeoutActive=true;}}},{key:"stop",value:function stop(){if(this.scheduleTimeoutActive){clearTimeout(this.flushQueueTimeOut);this.scheduleTimeoutActive=false;}}},{key:"enqueue",value:function enqueue(entry){var queue=this.getQueue();// Get max items from the queue minus one
|
1172
|
+
queue=queue.slice(-(this.maxItems-1));queue.push(entry);queue=queue.sort(sortByTime$1);// Calculate response payload size after the addition of new event
|
1173
|
+
var eventsToSend=queue.slice(0);var batchData=getDeliveryPayload(eventsToSend.map(function(queueItem){return queueItem.item.event;}));// Send events that existed in the queue if totaling more max payload size
|
1174
|
+
var isExceededMaxPayloadSize=Boolean(batchData&&batchData.size>MAX_BATCH_PAYLOAD_SIZE_BYTES);if(isExceededMaxPayloadSize){// Flush all previous items
|
1175
|
+
eventsToSend=queue.slice(0,queue.length-1);this.flushQueue(eventsToSend);// Add only latest item in the remaining queue that is cleared appropriately in flushQueue
|
1176
|
+
queue=this.getQueue();queue.push(entry);}this.setQueue(this.name,queue);// If queue has total of max items then flush
|
1177
|
+
if(queue.length===this.maxItems){this.flushQueue();}this.start();}},{key:"addItem",value:function addItem(itemData){this.enqueue({item:itemData,attemptNumber:0,time:Date.now(),id:generateUUID()});}},{key:"flushQueue",value:function flushQueue(queueItems){var _this2=this;if(!this.flushInProgress){this.flushInProgress=true;var batchItems=queueItems!==null&&queueItems!==void 0?queueItems:this.getQueue();var batchData=batchItems&&batchItems.length>0?batchItems.slice(0,batchItems.length):[];// TODO: add retry mechanism here
|
1178
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1179
|
+
var beaconSendCallback=function beaconSendCallback(error,response){_this2.setQueue(_this2.name,[]);_this2.stop();_this2.flushInProgress=false;if(_this2.nextFlushPending){_this2.nextFlushPending=false;_this2.flushQueue();}};if(batchData.length>0){this.processQueueCb(batchData,beaconSendCallback);return;}// If no items to send just clear timer
|
1180
|
+
beaconSendCallback(null);}else {this.nextFlushPending=true;}}}]);return BeaconItemsQueue;}();
|
1285
1181
|
|
1286
|
-
var
|
1182
|
+
var pluginName$d='BeaconQueue';var BeaconQueue=function BeaconQueue(){return {name:pluginName$d,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$d]);},dataplaneEventsQueue:{/**
|
1183
|
+
* Initialize the queue for delivery
|
1184
|
+
* @param state Application state
|
1185
|
+
* @param httpClient http client instance
|
1186
|
+
* @param storeManager Store Manager instance
|
1187
|
+
* @param errorHandler Error handler instance
|
1188
|
+
* @param logger Logger instance
|
1189
|
+
* @returns BeaconItemsQueue instance
|
1190
|
+
*/init:function init(state,httpClient,storeManager,errorHandler,logger){var _state$loadOptions$va;var writeKey=state.lifecycle.writeKey.value;var dataplaneUrl=state.lifecycle.activeDataplaneUrl.value;var url=getDeliveryUrl$1(dataplaneUrl,writeKey);var finalQOpts=getNormalizedBeaconQueueOptions((_state$loadOptions$va=state.loadOptions.value.beaconQueueOptions)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:{});var queueProcessCallback=function queueProcessCallback(queueItems,done){logger===null||logger===void 0||logger.debug(BEACON_PLUGIN_EVENTS_QUEUE_DEBUG(BEACON_QUEUE_PLUGIN));var finalEvents=queueItems.map(function(queueItem){return getFinalEventForDeliveryMutator(queueItem.item.event);});var data=getDeliveryPayload(finalEvents);if(data){try{var isEnqueuedInBeacon=navigator.sendBeacon(url,data);if(!isEnqueuedInBeacon){logger===null||logger===void 0||logger.error(BEACON_QUEUE_SEND_ERROR(BEACON_QUEUE_PLUGIN));}done(null,isEnqueuedInBeacon);}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,BEACON_QUEUE_PLUGIN,BEACON_QUEUE_DELIVERY_ERROR(url));done(err);}}else {// Mark the item as done so that it can be removed from the queue
|
1191
|
+
done(null);}};var eventsQueue=new BeaconItemsQueue("".concat(QUEUE_NAME$2,"_").concat(writeKey,"}"),finalQOpts,queueProcessCallback,storeManager);return eventsQueue;},/**
|
1192
|
+
* Add event to the queue for delivery
|
1193
|
+
* @param state Application state
|
1194
|
+
* @param eventsQueue IQueue instance
|
1195
|
+
* @param event RudderEvent object
|
1196
|
+
* @param errorHandler Error handler instance
|
1197
|
+
* @param logger Logger instance
|
1198
|
+
* @returns none
|
1199
|
+
*/enqueue:function enqueue(state,eventsQueue,event,errorHandler,logger){// sentAt is only added here for the validation step
|
1200
|
+
// It'll be updated to the latest timestamp during actual delivery
|
1201
|
+
event.sentAt=getCurrentTimeFormatted();validateEventPayloadSize(event,logger);eventsQueue.addItem({event:event});}}};};
|
1287
1202
|
|
1288
|
-
var
|
1203
|
+
var BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME='bugsnag';// For version 6 and below
|
1204
|
+
var BUGSNAG_LIB_V7_INSTANCE_GLOBAL_KEY_NAME='Bugsnag';var GLOBAL_LIBRARY_OBJECT_NAMES=[BUGSNAG_LIB_V7_INSTANCE_GLOBAL_KEY_NAME,BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];var BUGSNAG_CDN_URL='https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js';var ERROR_REPORT_PROVIDER_NAME_BUGSNAG='rs-bugsnag';// This API key token is parsed in the CI pipeline
|
1205
|
+
var API_KEY='0d96a60df267f4a13f808bbaa54e535c';var BUGSNAG_VALID_MAJOR_VERSION='6';var SDK_LOAD_POLL_INTERVAL_MS=100;// ms
|
1206
|
+
var MAX_WAIT_FOR_SDK_LOAD_MS=100*SDK_LOAD_POLL_INTERVAL_MS;// ms
|
1207
|
+
// Errors from the below scripts are NOT allowed to reach Bugsnag
|
1208
|
+
var SDK_FILE_NAME_PREFIXES=function SDK_FILE_NAME_PREFIXES(){return ['rsa'// Prefix for all the SDK scripts including plugins and module federated chunks
|
1209
|
+
];};var DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
|
1210
|
+
// Potential PII or sensitive data
|
1211
|
+
var APP_STATE_EXCLUDE_KEYS=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1212
|
+
'eventBuffer',// pre-load event buffer (may contain PII)
|
1213
|
+
'traits'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1289
1214
|
|
1290
|
-
var
|
1215
|
+
var isValidVersion=function isValidVersion(globalLibInstance){var _globalLibInstance$_c;// For version 7
|
1216
|
+
// eslint-disable-next-line no-underscore-dangle
|
1217
|
+
var version=globalLibInstance===null||globalLibInstance===void 0||(_globalLibInstance$_c=globalLibInstance._client)===null||_globalLibInstance$_c===void 0||(_globalLibInstance$_c=_globalLibInstance$_c._notifier)===null||_globalLibInstance$_c===void 0?void 0:_globalLibInstance$_c.version;// For versions older than 7
|
1218
|
+
if(!version){var _tempInstance$notifie;var tempInstance=globalLibInstance({apiKey:API_KEY,releaseStage:'version-test',// eslint-disable-next-line func-names, object-shorthand
|
1219
|
+
beforeSend:function beforeSend(){return false;}});version=(_tempInstance$notifie=tempInstance.notifier)===null||_tempInstance$notifie===void 0?void 0:_tempInstance$notifie.version;}return version&&version.charAt(0)===BUGSNAG_VALID_MAJOR_VERSION;};var isRudderSDKError=function isRudderSDKError(event){var _event$stacktrace;var errorOrigin=(_event$stacktrace=event.stacktrace)===null||_event$stacktrace===void 0||(_event$stacktrace=_event$stacktrace[0])===null||_event$stacktrace===void 0?void 0:_event$stacktrace.file;if(!errorOrigin||typeof errorOrigin!=='string'){return false;}// Prefix folder for all the destination SDK scripts
|
1220
|
+
var isDestinationIntegrationBundle=errorOrigin.includes(CDN_INT_DIR);var srcFileName=errorOrigin.substring(errorOrigin.lastIndexOf('/')+1);return isDestinationIntegrationBundle||SDK_FILE_NAME_PREFIXES().some(function(prefix){return srcFileName.startsWith(prefix)&&srcFileName.endsWith('.js');});};var enhanceErrorEventMutator=function enhanceErrorEventMutator(event,metadataSource){event.updateMetaData('source',{metadataSource:metadataSource});var errorMessage=event.errorMessage;// eslint-disable-next-line no-param-reassign
|
1221
|
+
event.context=errorMessage;// Hack for easily grouping the script load errors
|
1222
|
+
// on the dashboard
|
1223
|
+
if(errorMessage.includes('error in script loading')){// eslint-disable-next-line no-param-reassign
|
1224
|
+
event.context='Script load failures';}// eslint-disable-next-line no-param-reassign
|
1225
|
+
event.severity='error';};var onError=function onError(state){var _state$source$value;var metadataSource=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id;return function(event){try{// Discard the event if it's not originated at the SDK
|
1226
|
+
if(!isRudderSDKError(event)){return false;}enhanceErrorEventMutator(event,metadataSource);return true;}catch(_unused){// Drop the error event if it couldn't be filtered as
|
1227
|
+
// it is most likely a non-SDK error
|
1228
|
+
return false;}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:'3.0.0-beta.8',// Set SDK version as the app version from build config
|
1229
|
+
metaData:{SDK:{name:'JS',installType:'npm'}},beforeSend:onError(state),autoCaptureSessions:false,// auto capture sessions is disabled
|
1230
|
+
collectUserIp:false,// collecting user's IP is disabled
|
1231
|
+
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
1232
|
+
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage(),user:{id:state.lifecycle.writeKey.value},logger:logger,networkBreadcrumbsEnabled:false};var client=globalBugsnagLibInstance(clientConfig);return client;};var isApiKeyValid=function isApiKeyValid(apiKey){var isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};var loadBugsnagSDK=function loadBugsnagSDK(externalSrcLoader,logger){var isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(function(globalKeyName){return !globalThis[globalKeyName];});if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:function callback(id){if(!id){logger===null||logger===void 0||logger.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};var initBugsnagClient=function initBugsnagClient(state,promiseResolve,promiseReject,logger){var time=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){var client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
1233
|
+
globalThis.setTimeout(initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};var getAppStateForMetadata=function getAppStateForMetadata(state){var stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):undefined;};
|
1291
1234
|
|
1292
|
-
var
|
1235
|
+
var pluginName$c='Bugsnag';var Bugsnag=function Bugsnag(){return {name:pluginName$c,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$c]);},errorReportingProvider:{init:function init(state,externalSrcLoader,logger){return new Promise(function(resolve,reject){// If API key token is not parsed or invalid, don't proceed to initialize the client
|
1236
|
+
if(!isApiKeyValid(API_KEY)){reject(new Error(BUGSNAG_API_KEY_VALIDATION_ERROR(API_KEY)));return;}loadBugsnagSDK(externalSrcLoader,logger);initBugsnagClient(state,resolve,reject,logger);});},notify:function notify(client,error,state,logger){client===null||client===void 0||client.notify(error,{metaData:{state:getAppStateForMetadata(state)}});},breadcrumb:function breadcrumb(client,message,logger){client===null||client===void 0||client.leaveBreadcrumb(message);}}};};
|
1293
1237
|
|
1294
|
-
var _CNameMapping$
|
1238
|
+
var _CNameMapping$19;var DIR_NAME$19='AdobeAnalytics';var NAME$19='ADOBE_ANALYTICS';var DISPLAY_NAME$19='Adobe Analytics';var DISPLAY_NAME_TO_DIR_NAME_MAP$19=_defineProperty({},DISPLAY_NAME$19,DIR_NAME$19);(_CNameMapping$19={'Adobe Analytics':NAME$19,ADOBEANALYTICS:NAME$19,'ADOBE ANALYTICS':NAME$19},_defineProperty(_CNameMapping$19,NAME$19,NAME$19),_defineProperty(_CNameMapping$19,"AdobeAnalytics",NAME$19),_defineProperty(_CNameMapping$19,"adobeanalytics",NAME$19),_defineProperty(_CNameMapping$19,'adobe analytics',NAME$19),_defineProperty(_CNameMapping$19,'Adobe analytics',NAME$19),_defineProperty(_CNameMapping$19,'adobe Analytics',NAME$19),_CNameMapping$19);
|
1295
1239
|
|
1296
|
-
var _CNameMapping$
|
1240
|
+
var _CNameMapping$18;var DIR_NAME$18='Amplitude';var NAME$18='AM';var DISPLAY_NAME$18='Amplitude';var DISPLAY_NAME_TO_DIR_NAME_MAP$18=_defineProperty({},DISPLAY_NAME$18,DIR_NAME$18);(_CNameMapping$18={},_defineProperty(_CNameMapping$18,NAME$18,NAME$18),_defineProperty(_CNameMapping$18,"AMPLITUDE",NAME$18),_defineProperty(_CNameMapping$18,"Amplitude",NAME$18),_defineProperty(_CNameMapping$18,"am",NAME$18),_CNameMapping$18);
|
1297
1241
|
|
1298
|
-
var _CNameMapping$
|
1242
|
+
var _CNameMapping$17;var DIR_NAME$17='Appcues';var NAME$17='APPCUES';var DISPLAY_NAME$17='Appcues';var DISPLAY_NAME_TO_DIR_NAME_MAP$17=_defineProperty({},DISPLAY_NAME$17,DIR_NAME$17);(_CNameMapping$17={},_defineProperty(_CNameMapping$17,NAME$17,NAME$17),_defineProperty(_CNameMapping$17,"Appcues",NAME$17),_defineProperty(_CNameMapping$17,'App Cues',NAME$17),_defineProperty(_CNameMapping$17,"appcues",NAME$17),_CNameMapping$17);
|
1299
1243
|
|
1300
|
-
var _CNameMapping$
|
1244
|
+
var _CNameMapping$16;var DIR_NAME$16='BingAds';var NAME$16='BINGADS';var DISPLAY_NAME$16='Bing Ads';var DISPLAY_NAME_TO_DIR_NAME_MAP$16=_defineProperty({},DISPLAY_NAME$16,DIR_NAME$16);(_CNameMapping$16={},_defineProperty(_CNameMapping$16,NAME$16,NAME$16),_defineProperty(_CNameMapping$16,"BingAds",NAME$16),_defineProperty(_CNameMapping$16,"bingads",NAME$16),_defineProperty(_CNameMapping$16,'Bing Ads',NAME$16),_defineProperty(_CNameMapping$16,'Bing ads',NAME$16),_defineProperty(_CNameMapping$16,'bing Ads',NAME$16),_defineProperty(_CNameMapping$16,'bing ads',NAME$16),_CNameMapping$16);
|
1301
1245
|
|
1302
|
-
var _CNameMapping$
|
1246
|
+
var _CNameMapping$15;var DIR_NAME$15='Braze';var NAME$15='BRAZE';var DISPLAY_NAME$15='Braze';var DISPLAY_NAME_TO_DIR_NAME_MAP$15=_defineProperty({},DISPLAY_NAME$15,DIR_NAME$15);(_CNameMapping$15={},_defineProperty(_CNameMapping$15,NAME$15,NAME$15),_defineProperty(_CNameMapping$15,"Braze",NAME$15),_defineProperty(_CNameMapping$15,"braze",NAME$15),_CNameMapping$15);
|
1303
1247
|
|
1304
|
-
var _CNameMapping$
|
1248
|
+
var _CNameMapping$14;var DIR_NAME$14='Bugsnag';var NAME$14='BUGSNAG';var DISPLAY_NAME$14='Bugsnag';var DISPLAY_NAME_TO_DIR_NAME_MAP$14=_defineProperty({},DISPLAY_NAME$14,DIR_NAME$14);(_CNameMapping$14={},_defineProperty(_CNameMapping$14,NAME$14,NAME$14),_defineProperty(_CNameMapping$14,"bugsnag",NAME$14),_defineProperty(_CNameMapping$14,"Bugsnag",NAME$14),_CNameMapping$14);
|
1305
1249
|
|
1306
|
-
var _CNameMapping$
|
1250
|
+
var _CNameMapping$13;var DIR_NAME$13='Chartbeat';var NAME$13='CHARTBEAT';var DISPLAY_NAME$13='Chartbeat';var DISPLAY_NAME_TO_DIR_NAME_MAP$13=_defineProperty({},DISPLAY_NAME$13,DIR_NAME$13);(_CNameMapping$13={},_defineProperty(_CNameMapping$13,NAME$13,NAME$13),_defineProperty(_CNameMapping$13,"Chartbeat",NAME$13),_defineProperty(_CNameMapping$13,"chartbeat",NAME$13),_defineProperty(_CNameMapping$13,'Chart Beat',NAME$13),_defineProperty(_CNameMapping$13,'chart beat',NAME$13),_CNameMapping$13);
|
1307
1251
|
|
1308
|
-
var _CNameMapping$
|
1252
|
+
var _CNameMapping$12;var DIR_NAME$12='Clevertap';var NAME$12='CLEVERTAP';var DISPLAY_NAME$12='CleverTap';var DISPLAY_NAME_TO_DIR_NAME_MAP$12=_defineProperty({},DISPLAY_NAME$12,DIR_NAME$12);(_CNameMapping$12={},_defineProperty(_CNameMapping$12,NAME$12,NAME$12),_defineProperty(_CNameMapping$12,"Clevertap",NAME$12),_defineProperty(_CNameMapping$12,"clevertap",NAME$12),_CNameMapping$12);
|
1309
1253
|
|
1310
|
-
var _CNameMapping$
|
1254
|
+
var _CNameMapping$11;var DIR_NAME$11='Comscore';var NAME$11='COMSCORE';var DISPLAY_NAME$11='Comscore';var DISPLAY_NAME_TO_DIR_NAME_MAP$11=_defineProperty({},DISPLAY_NAME$11,DIR_NAME$11);(_CNameMapping$11={},_defineProperty(_CNameMapping$11,NAME$11,NAME$11),_defineProperty(_CNameMapping$11,"Comscore",NAME$11),_defineProperty(_CNameMapping$11,'Com Score',NAME$11),_defineProperty(_CNameMapping$11,'com Score',NAME$11),_defineProperty(_CNameMapping$11,'com score',NAME$11),_defineProperty(_CNameMapping$11,'Com score',NAME$11),_CNameMapping$11);
|
1311
1255
|
|
1312
|
-
var _CNameMapping$
|
1256
|
+
var _CNameMapping$10;var DIR_NAME$10='Criteo';var NAME$10='CRITEO';var DISPLAY_NAME$10='Criteo';var DISPLAY_NAME_TO_DIR_NAME_MAP$10=_defineProperty({},DISPLAY_NAME$10,DIR_NAME$10);(_CNameMapping$10={},_defineProperty(_CNameMapping$10,NAME$10,NAME$10),_defineProperty(_CNameMapping$10,"Criteo",NAME$10),_defineProperty(_CNameMapping$10,"criteo",NAME$10),_CNameMapping$10);
|
1313
1257
|
|
1314
|
-
var _CNameMapping
|
1258
|
+
var _CNameMapping$$;var DIR_NAME$$='CustomerIO';var NAME$$='CUSTOMERIO';var DISPLAY_NAME$$='Customer IO';var DISPLAY_NAME_TO_DIR_NAME_MAP$$=_defineProperty({},DISPLAY_NAME$$,DIR_NAME$$);(_CNameMapping$$={},_defineProperty(_CNameMapping$$,NAME$$,NAME$$),_defineProperty(_CNameMapping$$,"Customerio",NAME$$),_defineProperty(_CNameMapping$$,'Customer.io',NAME$$),_defineProperty(_CNameMapping$$,'CUSTOMER.IO',NAME$$),_defineProperty(_CNameMapping$$,'customer.io',NAME$$),_CNameMapping$$);
|
1315
1259
|
|
1316
|
-
var _CNameMapping$
|
1260
|
+
var _CNameMapping$_;var DIR_NAME$_='Drip';var NAME$_='DRIP';var DISPLAY_NAME$_='Drip';var DISPLAY_NAME_TO_DIR_NAME_MAP$_=_defineProperty({},DISPLAY_NAME$_,DIR_NAME$_);(_CNameMapping$_={},_defineProperty(_CNameMapping$_,NAME$_,NAME$_),_defineProperty(_CNameMapping$_,"Drip",NAME$_),_defineProperty(_CNameMapping$_,"drip",NAME$_),_CNameMapping$_);
|
1317
1261
|
|
1318
|
-
var _CNameMapping$
|
1262
|
+
var _CNameMapping$Z;var DIR_NAME$Z='FacebookPixel';var NAME$Z='FACEBOOK_PIXEL';var DISPLAY_NAME$Z='Facebook Pixel';var DISPLAY_NAME_TO_DIR_NAME_MAP$Z=_defineProperty({},DISPLAY_NAME$Z,DIR_NAME$Z);(_CNameMapping$Z={},_defineProperty(_CNameMapping$Z,NAME$Z,NAME$Z),_defineProperty(_CNameMapping$Z,'FB Pixel',NAME$Z),_defineProperty(_CNameMapping$Z,'Facebook Pixel',NAME$Z),_defineProperty(_CNameMapping$Z,'facebook pixel',NAME$Z),_defineProperty(_CNameMapping$Z,"fbpixel",NAME$Z),_defineProperty(_CNameMapping$Z,"FBPIXEL",NAME$Z),_defineProperty(_CNameMapping$Z,"FB_PIXEL",NAME$Z),_CNameMapping$Z);
|
1319
1263
|
|
1320
|
-
var _CNameMapping$
|
1264
|
+
var _CNameMapping$Y;var DIR_NAME$Y='Fullstory';var NAME$Y='FULLSTORY';var DISPLAY_NAME$Y='Fullstory';var DISPLAY_NAME_TO_DIR_NAME_MAP$Y=_defineProperty({},DISPLAY_NAME$Y,DIR_NAME$Y);(_CNameMapping$Y={},_defineProperty(_CNameMapping$Y,NAME$Y,NAME$Y),_defineProperty(_CNameMapping$Y,"Fullstory",NAME$Y),_defineProperty(_CNameMapping$Y,"FullStory",NAME$Y),_defineProperty(_CNameMapping$Y,'full Story',NAME$Y),_defineProperty(_CNameMapping$Y,'Full Story',NAME$Y),_defineProperty(_CNameMapping$Y,'Full story',NAME$Y),_defineProperty(_CNameMapping$Y,'full story',NAME$Y),_defineProperty(_CNameMapping$Y,"fullstory",NAME$Y),_CNameMapping$Y);
|
1321
1265
|
|
1322
|
-
var _CNameMapping$
|
1266
|
+
var _CNameMapping$X;var DIR_NAME$X='GA';var NAME$X='GA';var DISPLAY_NAME$X='Google Analytics';var DISPLAY_NAME_TO_DIR_NAME_MAP$X=_defineProperty({},DISPLAY_NAME$X,DIR_NAME$X);(_CNameMapping$X={},_defineProperty(_CNameMapping$X,NAME$X,NAME$X),_defineProperty(_CNameMapping$X,'Google Analytics',NAME$X),_defineProperty(_CNameMapping$X,"GoogleAnalytics",NAME$X),_defineProperty(_CNameMapping$X,'GOOGLE ANALYTICS',NAME$X),_defineProperty(_CNameMapping$X,'google analytics',NAME$X),_CNameMapping$X);
|
1323
1267
|
|
1324
|
-
var _CNameMapping$
|
1268
|
+
var _CNameMapping$W;var DIR_NAME$W='GA4';var NAME$W='GA4';var DISPLAY_NAME$W='Google Analytics 4 (GA4)';var DISPLAY_NAME_TO_DIR_NAME_MAP$W=_defineProperty({},DISPLAY_NAME$W,DIR_NAME$W);(_CNameMapping$W={},_defineProperty(_CNameMapping$W,NAME$W,NAME$W),_defineProperty(_CNameMapping$W,'Google Analytics 4',NAME$W),_defineProperty(_CNameMapping$W,'Google analytics 4',NAME$W),_defineProperty(_CNameMapping$W,'google analytics 4',NAME$W),_defineProperty(_CNameMapping$W,'Google Analytics4',NAME$W),_defineProperty(_CNameMapping$W,'Google analytics4',NAME$W),_defineProperty(_CNameMapping$W,'google analytics4',NAME$W),_defineProperty(_CNameMapping$W,'Google Analytics 4 (GA4)',NAME$W),_defineProperty(_CNameMapping$W,'google analytics 4 (ga4)',NAME$W),_defineProperty(_CNameMapping$W,"GoogleAnalytics4",NAME$W),_CNameMapping$W);
|
1325
1269
|
|
1326
|
-
var _CNameMapping$
|
1270
|
+
var _CNameMapping$V;var DIR_NAME$V='GoogleAds';var NAME$V='GOOGLEADS';var DISPLAY_NAME$V='Google Ads';var DISPLAY_NAME_TO_DIR_NAME_MAP$V=_defineProperty({},DISPLAY_NAME$V,DIR_NAME$V);(_CNameMapping$V={},_defineProperty(_CNameMapping$V,NAME$V,NAME$V),_defineProperty(_CNameMapping$V,'Google Ads',NAME$V),_defineProperty(_CNameMapping$V,"GoogleAds",NAME$V),_defineProperty(_CNameMapping$V,'GOOGLE ADS',NAME$V),_defineProperty(_CNameMapping$V,'google ads',NAME$V),_defineProperty(_CNameMapping$V,"googleads",NAME$V),_CNameMapping$V);
|
1327
1271
|
|
1328
|
-
var _CNameMapping$
|
1272
|
+
var _CNameMapping$U;var DIR_NAME$U='GoogleOptimize';var NAME$U='GOOGLE_OPTIMIZE';var DISPLAY_NAME$U='Google Optimize';var DISPLAY_NAME_TO_DIR_NAME_MAP$U=_defineProperty({},DISPLAY_NAME$U,DIR_NAME$U);(_CNameMapping$U={},_defineProperty(_CNameMapping$U,NAME$U,NAME$U),_defineProperty(_CNameMapping$U,'Google Optimize',NAME$U),_defineProperty(_CNameMapping$U,"GoogleOptimize",NAME$U),_defineProperty(_CNameMapping$U,"Googleoptimize",NAME$U),_defineProperty(_CNameMapping$U,"GOOGLEOPTIMIZE",NAME$U),_defineProperty(_CNameMapping$U,'google optimize',NAME$U),_defineProperty(_CNameMapping$U,'Google optimize',NAME$U),_defineProperty(_CNameMapping$U,'GOOGLE OPTIMIZE',NAME$U),_CNameMapping$U);
|
1329
1273
|
|
1330
|
-
var _CNameMapping$
|
1274
|
+
var _CNameMapping$T;var DIR_NAME$T='GoogleTagManager';var NAME$T='GTM';var DISPLAY_NAME$T='Google Tag Manager';var DISPLAY_NAME_TO_DIR_NAME_MAP$T=_defineProperty({},DISPLAY_NAME$T,DIR_NAME$T);(_CNameMapping$T={},_defineProperty(_CNameMapping$T,NAME$T,NAME$T),_defineProperty(_CNameMapping$T,'Google Tag Manager',NAME$T),_defineProperty(_CNameMapping$T,'google tag manager',NAME$T),_defineProperty(_CNameMapping$T,'googletag manager',NAME$T),_defineProperty(_CNameMapping$T,"googletagmanager",NAME$T),_CNameMapping$T);
|
1331
1275
|
|
1332
|
-
var _CNameMapping$
|
1276
|
+
var _CNameMapping$S;var DIR_NAME$S='Heap';var NAME$S='HEAP';var DISPLAY_NAME$S='Heap.io';var DISPLAY_NAME_TO_DIR_NAME_MAP$S=_defineProperty({},DISPLAY_NAME$S,DIR_NAME$S);(_CNameMapping$S={},_defineProperty(_CNameMapping$S,NAME$S,NAME$S),_defineProperty(_CNameMapping$S,"Heap",NAME$S),_defineProperty(_CNameMapping$S,"heap",NAME$S),_defineProperty(_CNameMapping$S,'Heap.io',NAME$S),_CNameMapping$S);
|
1333
1277
|
|
1334
|
-
var _CNameMapping$
|
1278
|
+
var _CNameMapping$R;var DIR_NAME$R='Hotjar';var NAME$R='HOTJAR';var DISPLAY_NAME$R='Hotjar';var DISPLAY_NAME_TO_DIR_NAME_MAP$R=_defineProperty({},DISPLAY_NAME$R,DIR_NAME$R);(_CNameMapping$R={},_defineProperty(_CNameMapping$R,NAME$R,NAME$R),_defineProperty(_CNameMapping$R,"Hotjar",NAME$R),_defineProperty(_CNameMapping$R,"hotjar",NAME$R),_defineProperty(_CNameMapping$R,'Hot Jar',NAME$R),_defineProperty(_CNameMapping$R,'hot jar',NAME$R),_CNameMapping$R);
|
1335
1279
|
|
1336
|
-
var _CNameMapping$
|
1280
|
+
var _CNameMapping$Q;var DIR_NAME$Q='HubSpot';var NAME$Q='HS';var DISPLAY_NAME$Q='HubSpot';var DISPLAY_NAME_TO_DIR_NAME_MAP$Q=_defineProperty({},DISPLAY_NAME$Q,DIR_NAME$Q);(_CNameMapping$Q={},_defineProperty(_CNameMapping$Q,NAME$Q,NAME$Q),_defineProperty(_CNameMapping$Q,"Hubspot",NAME$Q),_defineProperty(_CNameMapping$Q,"HUBSPOT",NAME$Q),_defineProperty(_CNameMapping$Q,'hub spot',NAME$Q),_defineProperty(_CNameMapping$Q,'Hub Spot',NAME$Q),_defineProperty(_CNameMapping$Q,'Hub spot',NAME$Q),_CNameMapping$Q);
|
1337
1281
|
|
1338
|
-
var _CNameMapping$
|
1282
|
+
var _CNameMapping$P;var DIR_NAME$P='INTERCOM';var NAME$P='INTERCOM';var DISPLAY_NAME$P='Intercom';var DISPLAY_NAME_TO_DIR_NAME_MAP$P=_defineProperty({},DISPLAY_NAME$P,DIR_NAME$P);(_CNameMapping$P={},_defineProperty(_CNameMapping$P,NAME$P,NAME$P),_defineProperty(_CNameMapping$P,"Intercom",NAME$P),_defineProperty(_CNameMapping$P,"intercom",NAME$P),_CNameMapping$P);
|
1339
1283
|
|
1340
|
-
var _CNameMapping$
|
1284
|
+
var _CNameMapping$O;var DIR_NAME$O='Keen';var NAME$O='KEEN';var DISPLAY_NAME$O='Keen';var DISPLAY_NAME_TO_DIR_NAME_MAP$O=_defineProperty({},DISPLAY_NAME$O,DIR_NAME$O);(_CNameMapping$O={},_defineProperty(_CNameMapping$O,NAME$O,NAME$O),_defineProperty(_CNameMapping$O,"Keen",NAME$O),_defineProperty(_CNameMapping$O,'Keen.io',NAME$O),_defineProperty(_CNameMapping$O,"keen",NAME$O),_defineProperty(_CNameMapping$O,'keen.io',NAME$O),_CNameMapping$O);
|
1341
1285
|
|
1342
|
-
var _CNameMapping$
|
1286
|
+
var _CNameMapping$N;var DIR_NAME$N='Kissmetrics';var NAME$N='KISSMETRICS';var DISPLAY_NAME$N='Kiss Metrics';var DISPLAY_NAME_TO_DIR_NAME_MAP$N=_defineProperty({},DISPLAY_NAME$N,DIR_NAME$N);(_CNameMapping$N={},_defineProperty(_CNameMapping$N,NAME$N,NAME$N),_defineProperty(_CNameMapping$N,"Kissmetrics",NAME$N),_defineProperty(_CNameMapping$N,"kissmetrics",NAME$N),_CNameMapping$N);
|
1343
1287
|
|
1344
|
-
var _CNameMapping$
|
1288
|
+
var _CNameMapping$M;var DIR_NAME$M='Klaviyo';var NAME$M='KLAVIYO';var DISPLAY_NAME$M='Klaviyo';var DISPLAY_NAME_TO_DIR_NAME_MAP$M=_defineProperty({},DISPLAY_NAME$M,DIR_NAME$M);(_CNameMapping$M={},_defineProperty(_CNameMapping$M,NAME$M,NAME$M),_defineProperty(_CNameMapping$M,"Klaviyo",NAME$M),_defineProperty(_CNameMapping$M,"klaviyo",NAME$M),_CNameMapping$M);
|
1345
1289
|
|
1346
|
-
var _CNameMapping$
|
1290
|
+
var _CNameMapping$L;var DIR_NAME$L='LaunchDarkly';var NAME$L='LAUNCHDARKLY';var DISPLAY_NAME$L='LaunchDarkly';var DISPLAY_NAME_TO_DIR_NAME_MAP$L=_defineProperty({},DISPLAY_NAME$L,DIR_NAME$L);(_CNameMapping$L={},_defineProperty(_CNameMapping$L,NAME$L,NAME$L),_defineProperty(_CNameMapping$L,"LaunchDarkly",NAME$L),_defineProperty(_CNameMapping$L,"Launch_Darkly",NAME$L),_defineProperty(_CNameMapping$L,'Launch Darkly',NAME$L),_defineProperty(_CNameMapping$L,"launchDarkly",NAME$L),_defineProperty(_CNameMapping$L,'launch darkly',NAME$L),_CNameMapping$L);
|
1347
1291
|
|
1348
|
-
var _CNameMapping$
|
1292
|
+
var _CNameMapping$K;var DIR_NAME$K='LinkedInInsightTag';var NAME$K='LINKEDIN_INSIGHT_TAG';var DISPLAY_NAME$K='Linkedin Insight Tag';var DISPLAY_NAME_TO_DIR_NAME_MAP$K=_defineProperty({},DISPLAY_NAME$K,DIR_NAME$K);(_CNameMapping$K={},_defineProperty(_CNameMapping$K,NAME$K,NAME$K),_defineProperty(_CNameMapping$K,'LinkedIn Insight Tag',NAME$K),_defineProperty(_CNameMapping$K,'LinkedIn insight tag',NAME$K),_defineProperty(_CNameMapping$K,'linkedIn insight tag',NAME$K),_defineProperty(_CNameMapping$K,"Linkedin_insight_tag",NAME$K),_defineProperty(_CNameMapping$K,"LinkedinInsighttag",NAME$K),_defineProperty(_CNameMapping$K,"LinkedinInsightTag",NAME$K),_defineProperty(_CNameMapping$K,"LinkedInInsightTag",NAME$K),_defineProperty(_CNameMapping$K,"Linkedininsighttag",NAME$K),_defineProperty(_CNameMapping$K,"LINKEDININSIGHTTAG",NAME$K),_defineProperty(_CNameMapping$K,"linkedininsighttag",NAME$K),_CNameMapping$K);
|
1349
1293
|
|
1350
|
-
var _CNameMapping$
|
1294
|
+
var _CNameMapping$J;var DIR_NAME$J='Lotame';var NAME$J='LOTAME';var DISPLAY_NAME$J='Lotame';var DISPLAY_NAME_TO_DIR_NAME_MAP$J=_defineProperty({},DISPLAY_NAME$J,DIR_NAME$J);(_CNameMapping$J={},_defineProperty(_CNameMapping$J,NAME$J,NAME$J),_defineProperty(_CNameMapping$J,"Lotame",NAME$J),_defineProperty(_CNameMapping$J,"lotame",NAME$J),_CNameMapping$J);
|
1351
1295
|
|
1352
|
-
var _CNameMapping$
|
1296
|
+
var _CNameMapping$I;var DIR_NAME$I='Lytics';var NAME$I='LYTICS';var DISPLAY_NAME$I='Lytics';var DISPLAY_NAME_TO_DIR_NAME_MAP$I=_defineProperty({},DISPLAY_NAME$I,DIR_NAME$I);(_CNameMapping$I={},_defineProperty(_CNameMapping$I,NAME$I,NAME$I),_defineProperty(_CNameMapping$I,"Lytics",NAME$I),_defineProperty(_CNameMapping$I,"lytics",NAME$I),_CNameMapping$I);
|
1353
1297
|
|
1354
|
-
var _CNameMapping$
|
1298
|
+
var _CNameMapping$H;var DIR_NAME$H='Mixpanel';var NAME$H='MP';var DISPLAY_NAME$H='Mixpanel';var DISPLAY_NAME_TO_DIR_NAME_MAP$H=_defineProperty({},DISPLAY_NAME$H,DIR_NAME$H);(_CNameMapping$H={},_defineProperty(_CNameMapping$H,NAME$H,NAME$H),_defineProperty(_CNameMapping$H,"MIXPANEL",NAME$H),_defineProperty(_CNameMapping$H,"Mixpanel",NAME$H),_defineProperty(_CNameMapping$H,'MIX PANEL',NAME$H),_defineProperty(_CNameMapping$H,'Mix panel',NAME$H),_defineProperty(_CNameMapping$H,'Mix Panel',NAME$H),_CNameMapping$H);
|
1355
1299
|
|
1356
|
-
var _CNameMapping$
|
1300
|
+
var _CNameMapping$G;var DIR_NAME$G='MoEngage';var NAME$G='MOENGAGE';var DISPLAY_NAME$G='MoEngage';var DISPLAY_NAME_TO_DIR_NAME_MAP$G=_defineProperty({},DISPLAY_NAME$G,DIR_NAME$G);(_CNameMapping$G={},_defineProperty(_CNameMapping$G,NAME$G,NAME$G),_defineProperty(_CNameMapping$G,"MoEngage",NAME$G),_defineProperty(_CNameMapping$G,"moengage",NAME$G),_defineProperty(_CNameMapping$G,"Moengage",NAME$G),_defineProperty(_CNameMapping$G,'Mo Engage',NAME$G),_defineProperty(_CNameMapping$G,'mo engage',NAME$G),_defineProperty(_CNameMapping$G,'Mo engage',NAME$G),_CNameMapping$G);
|
1357
1301
|
|
1358
|
-
var _CNameMapping$
|
1302
|
+
var _CNameMapping$F;var DIR_NAME$F='Optimizely';var NAME$F='OPTIMIZELY';var DISPLAY_NAME$F='Optimizely Web';var DISPLAY_NAME_TO_DIR_NAME_MAP$F=_defineProperty({},DISPLAY_NAME$F,DIR_NAME$F);(_CNameMapping$F={},_defineProperty(_CNameMapping$F,NAME$F,NAME$F),_defineProperty(_CNameMapping$F,"Optimizely",NAME$F),_defineProperty(_CNameMapping$F,"optimizely",NAME$F),_CNameMapping$F);
|
1359
1303
|
|
1360
|
-
var _CNameMapping$
|
1304
|
+
var _CNameMapping$E;var DIR_NAME$E='Pendo';var NAME$E='PENDO';var DISPLAY_NAME$E='Pendo';var DISPLAY_NAME_TO_DIR_NAME_MAP$E=_defineProperty({},DISPLAY_NAME$E,DIR_NAME$E);(_CNameMapping$E={},_defineProperty(_CNameMapping$E,NAME$E,NAME$E),_defineProperty(_CNameMapping$E,"Pendo",NAME$E),_defineProperty(_CNameMapping$E,"pendo",NAME$E),_CNameMapping$E);
|
1361
1305
|
|
1362
|
-
var _CNameMapping$
|
1306
|
+
var _CNameMapping$D;var DIR_NAME$D='PinterestTag';var NAME$D='PINTEREST_TAG';var DISPLAY_NAME$D='Pinterest Tag';var DISPLAY_NAME_TO_DIR_NAME_MAP$D=_defineProperty({},DISPLAY_NAME$D,DIR_NAME$D);(_CNameMapping$D={},_defineProperty(_CNameMapping$D,NAME$D,NAME$D),_defineProperty(_CNameMapping$D,"PinterestTag",NAME$D),_defineProperty(_CNameMapping$D,"Pinterest_Tag",NAME$D),_defineProperty(_CNameMapping$D,"PINTERESTTAG",NAME$D),_defineProperty(_CNameMapping$D,"pinterest",NAME$D),_defineProperty(_CNameMapping$D,"PinterestAds",NAME$D),_defineProperty(_CNameMapping$D,"Pinterest_Ads",NAME$D),_defineProperty(_CNameMapping$D,"Pinterest",NAME$D),_defineProperty(_CNameMapping$D,'Pinterest Tag',NAME$D),_defineProperty(_CNameMapping$D,'Pinterest tag',NAME$D),_defineProperty(_CNameMapping$D,'PINTEREST TAG',NAME$D),_defineProperty(_CNameMapping$D,'pinterest tag',NAME$D),_defineProperty(_CNameMapping$D,'Pinterest Ads',NAME$D),_defineProperty(_CNameMapping$D,'Pinterest ads',NAME$D),_CNameMapping$D);
|
1363
1307
|
|
1364
|
-
var _CNameMapping$
|
1308
|
+
var _CNameMapping$C;var DIR_NAME$C='PostAffiliatePro';var NAME$C='POST_AFFILIATE_PRO';var DISPLAY_NAME$C='Post Affiliate Pro';var DISPLAY_NAME_TO_DIR_NAME_MAP$C=_defineProperty({},DISPLAY_NAME$C,DIR_NAME$C);(_CNameMapping$C={},_defineProperty(_CNameMapping$C,NAME$C,NAME$C),_defineProperty(_CNameMapping$C,"PostAffiliatePro",NAME$C),_defineProperty(_CNameMapping$C,"Post_affiliate_pro",NAME$C),_defineProperty(_CNameMapping$C,'Post Affiliate Pro',NAME$C),_defineProperty(_CNameMapping$C,'Post affiliate pro',NAME$C),_defineProperty(_CNameMapping$C,'post affiliate pro',NAME$C),_defineProperty(_CNameMapping$C,"postaffiliatepro",NAME$C),_defineProperty(_CNameMapping$C,"POSTAFFILIATEPRO",NAME$C),_CNameMapping$C);
|
1365
1309
|
|
1366
|
-
var _CNameMapping$
|
1310
|
+
var _CNameMapping$B;var DIR_NAME$B='Posthog';var NAME$B='POSTHOG';var DISPLAY_NAME$B='PostHog';var DISPLAY_NAME_TO_DIR_NAME_MAP$B=_defineProperty({},DISPLAY_NAME$B,DIR_NAME$B);(_CNameMapping$B={},_defineProperty(_CNameMapping$B,NAME$B,NAME$B),_defineProperty(_CNameMapping$B,"PostHog",NAME$B),_defineProperty(_CNameMapping$B,"Posthog",NAME$B),_defineProperty(_CNameMapping$B,"posthog",NAME$B),_defineProperty(_CNameMapping$B,'Post Hog',NAME$B),_defineProperty(_CNameMapping$B,'Post hog',NAME$B),_defineProperty(_CNameMapping$B,'post hog',NAME$B),_CNameMapping$B);
|
1367
1311
|
|
1368
|
-
var _CNameMapping$
|
1312
|
+
var _CNameMapping$A;var DIR_NAME$A='ProfitWell';var NAME$A='PROFITWELL';var DISPLAY_NAME$A='ProfitWell';var DISPLAY_NAME_TO_DIR_NAME_MAP$A=_defineProperty({},DISPLAY_NAME$A,DIR_NAME$A);(_CNameMapping$A={},_defineProperty(_CNameMapping$A,NAME$A,NAME$A),_defineProperty(_CNameMapping$A,"ProfitWell",NAME$A),_defineProperty(_CNameMapping$A,"profitwell",NAME$A),_defineProperty(_CNameMapping$A,"Profitwell",NAME$A),_defineProperty(_CNameMapping$A,'Profit Well',NAME$A),_defineProperty(_CNameMapping$A,'profit well',NAME$A),_defineProperty(_CNameMapping$A,'Profit well',NAME$A),_CNameMapping$A);
|
1369
1313
|
|
1370
|
-
var _CNameMapping$
|
1314
|
+
var _CNameMapping$z;var DIR_NAME$z='Qualtrics';var NAME$z='QUALTRICS';var DISPLAY_NAME$z='Qualtrics';var DISPLAY_NAME_TO_DIR_NAME_MAP$z=_defineProperty({},DISPLAY_NAME$z,DIR_NAME$z);(_CNameMapping$z={},_defineProperty(_CNameMapping$z,NAME$z,NAME$z),_defineProperty(_CNameMapping$z,"Qualtrics",NAME$z),_defineProperty(_CNameMapping$z,"qualtrics",NAME$z),_CNameMapping$z);
|
1371
1315
|
|
1372
|
-
var _CNameMapping$
|
1316
|
+
var _CNameMapping$y;var DIR_NAME$y='QuantumMetric';var NAME$y='QUANTUMMETRIC';var DISPLAY_NAME$y='Quantum Metric';var DISPLAY_NAME_TO_DIR_NAME_MAP$y=_defineProperty({},DISPLAY_NAME$y,DIR_NAME$y);(_CNameMapping$y={},_defineProperty(_CNameMapping$y,NAME$y,NAME$y),_defineProperty(_CNameMapping$y,'Quantum Metric',NAME$y),_defineProperty(_CNameMapping$y,'quantum Metric',NAME$y),_defineProperty(_CNameMapping$y,'quantum metric',NAME$y),_defineProperty(_CNameMapping$y,"QuantumMetric",NAME$y),_defineProperty(_CNameMapping$y,"quantumMetric",NAME$y),_defineProperty(_CNameMapping$y,"quantummetric",NAME$y),_defineProperty(_CNameMapping$y,"Quantum_Metric",NAME$y),_CNameMapping$y);
|
1373
1317
|
|
1374
|
-
var _CNameMapping$
|
1318
|
+
var _CNameMapping$x;var DIR_NAME$x='RedditPixel';var NAME$x='REDDIT_PIXEL';var DISPLAY_NAME$x='Reddit Pixel';var DISPLAY_NAME_TO_DIR_NAME_MAP$x=_defineProperty({},DISPLAY_NAME$x,DIR_NAME$x);(_CNameMapping$x={},_defineProperty(_CNameMapping$x,NAME$x,NAME$x),_defineProperty(_CNameMapping$x,"Reddit_Pixel",NAME$x),_defineProperty(_CNameMapping$x,"RedditPixel",NAME$x),_defineProperty(_CNameMapping$x,"REDDITPIXEL",NAME$x),_defineProperty(_CNameMapping$x,"redditpixel",NAME$x),_defineProperty(_CNameMapping$x,'Reddit Pixel',NAME$x),_defineProperty(_CNameMapping$x,'REDDIT PIXEL',NAME$x),_defineProperty(_CNameMapping$x,'reddit pixel',NAME$x),_CNameMapping$x);
|
1375
1319
|
|
1376
|
-
var _CNameMapping$
|
1320
|
+
var _CNameMapping$w;var DIR_NAME$w='Sentry';var NAME$w='SENTRY';var DISPLAY_NAME$w='Sentry';var DISPLAY_NAME_TO_DIR_NAME_MAP$w=_defineProperty({},DISPLAY_NAME$w,DIR_NAME$w);(_CNameMapping$w={},_defineProperty(_CNameMapping$w,NAME$w,NAME$w),_defineProperty(_CNameMapping$w,"sentry",NAME$w),_defineProperty(_CNameMapping$w,"Sentry",NAME$w),_CNameMapping$w);
|
1377
1321
|
|
1378
|
-
var _CNameMapping$
|
1322
|
+
var _CNameMapping$v;var DIR_NAME$v='SnapPixel';var NAME$v='SNAP_PIXEL';var DISPLAY_NAME$v='Snap Pixel';var DISPLAY_NAME_TO_DIR_NAME_MAP$v=_defineProperty({},DISPLAY_NAME$v,DIR_NAME$v);(_CNameMapping$v={},_defineProperty(_CNameMapping$v,NAME$v,NAME$v),_defineProperty(_CNameMapping$v,"Snap_Pixel",NAME$v),_defineProperty(_CNameMapping$v,"SnapPixel",NAME$v),_defineProperty(_CNameMapping$v,"SNAPPIXEL",NAME$v),_defineProperty(_CNameMapping$v,"snappixel",NAME$v),_defineProperty(_CNameMapping$v,'Snap Pixel',NAME$v),_defineProperty(_CNameMapping$v,'SNAP PIXEL',NAME$v),_defineProperty(_CNameMapping$v,'snap pixel',NAME$v),_CNameMapping$v);
|
1379
1323
|
|
1380
|
-
var _CNameMapping$
|
1324
|
+
var _CNameMapping$u;var DIR_NAME$u='TVSquared';var NAME$u='TVSQUARED';var DISPLAY_NAME$u='TVSquared';var DISPLAY_NAME_TO_DIR_NAME_MAP$u=_defineProperty({},DISPLAY_NAME$u,DIR_NAME$u);(_CNameMapping$u={},_defineProperty(_CNameMapping$u,NAME$u,NAME$u),_defineProperty(_CNameMapping$u,"TVSquared",NAME$u),_defineProperty(_CNameMapping$u,"tvsquared",NAME$u),_defineProperty(_CNameMapping$u,"tvSquared",NAME$u),_defineProperty(_CNameMapping$u,"TvSquared",NAME$u),_defineProperty(_CNameMapping$u,"Tvsquared",NAME$u),_defineProperty(_CNameMapping$u,'TV Squared',NAME$u),_defineProperty(_CNameMapping$u,'tv squared',NAME$u),_defineProperty(_CNameMapping$u,'tv Squared',NAME$u),_CNameMapping$u);
|
1381
1325
|
|
1382
|
-
var _CNameMapping$
|
1326
|
+
var _CNameMapping$t;var DIR_NAME$t='VWO';var NAME$t='VWO';var DISPLAY_NAME$t='VWO';var DISPLAY_NAME_TO_DIR_NAME_MAP$t=_defineProperty({},DISPLAY_NAME$t,DIR_NAME$t);(_CNameMapping$t={},_defineProperty(_CNameMapping$t,NAME$t,NAME$t),_defineProperty(_CNameMapping$t,"VisualWebsiteOptimizer",NAME$t),_defineProperty(_CNameMapping$t,"Visualwebsiteoptimizer",NAME$t),_defineProperty(_CNameMapping$t,"visualwebsiteoptimizer",NAME$t),_defineProperty(_CNameMapping$t,"vwo",NAME$t),_defineProperty(_CNameMapping$t,'Visual Website Optimizer',NAME$t),_defineProperty(_CNameMapping$t,'Visual website optimizer',NAME$t),_defineProperty(_CNameMapping$t,'visual website optimizer',NAME$t),_CNameMapping$t);
|
1383
1327
|
|
1384
|
-
var _CNameMapping$
|
1328
|
+
var _CNameMapping$s;var DIR_NAME$s='GA360';var NAME$s='GA360';var DISPLAY_NAME$s='Google Analytics 360';var DISPLAY_NAME_TO_DIR_NAME_MAP$s=_defineProperty({},DISPLAY_NAME$s,DIR_NAME$s);(_CNameMapping$s={},_defineProperty(_CNameMapping$s,NAME$s,NAME$s),_defineProperty(_CNameMapping$s,'Google Analytics 360',NAME$s),_defineProperty(_CNameMapping$s,'Google analytics 360',NAME$s),_defineProperty(_CNameMapping$s,'google analytics 360',NAME$s),_defineProperty(_CNameMapping$s,'Google Analytics360',NAME$s),_defineProperty(_CNameMapping$s,'Google analytics360',NAME$s),_defineProperty(_CNameMapping$s,'google analytics360',NAME$s),_defineProperty(_CNameMapping$s,"GoogleAnalytics360",NAME$s),_defineProperty(_CNameMapping$s,'GA 360',NAME$s),_CNameMapping$s);
|
1385
1329
|
|
1386
|
-
var _CNameMapping$
|
1330
|
+
var _CNameMapping$r;var DIR_NAME$r='Adroll';var NAME$r='ADROLL';var DISPLAY_NAME$r='Adroll';var DISPLAY_NAME_TO_DIR_NAME_MAP$r=_defineProperty({},DISPLAY_NAME$r,DIR_NAME$r);(_CNameMapping$r={},_defineProperty(_CNameMapping$r,NAME$r,NAME$r),_defineProperty(_CNameMapping$r,"Adroll",NAME$r),_defineProperty(_CNameMapping$r,'Ad roll',NAME$r),_defineProperty(_CNameMapping$r,'ad roll',NAME$r),_defineProperty(_CNameMapping$r,"adroll",NAME$r),_CNameMapping$r);
|
1387
1331
|
|
1388
|
-
var _CNameMapping$
|
1332
|
+
var _CNameMapping$q;var DIR_NAME$q='DCMFloodlight';var NAME$q='DCM_FLOODLIGHT';var DISPLAY_NAME$q='DCM Floodlight';var DISPLAY_NAME_TO_DIR_NAME_MAP$q=_defineProperty({},DISPLAY_NAME$q,DIR_NAME$q);(_CNameMapping$q={},_defineProperty(_CNameMapping$q,NAME$q,NAME$q),_defineProperty(_CNameMapping$q,'DCM Floodlight',NAME$q),_defineProperty(_CNameMapping$q,'dcm floodlight',NAME$q),_defineProperty(_CNameMapping$q,'Dcm Floodlight',NAME$q),_defineProperty(_CNameMapping$q,"DCMFloodlight",NAME$q),_defineProperty(_CNameMapping$q,"dcmfloodlight",NAME$q),_defineProperty(_CNameMapping$q,"DcmFloodlight",NAME$q),_defineProperty(_CNameMapping$q,"dcm_floodlight",NAME$q),_defineProperty(_CNameMapping$q,"DCM_Floodlight",NAME$q),_CNameMapping$q);
|
1389
1333
|
|
1390
|
-
var _CNameMapping$
|
1334
|
+
var _CNameMapping$p;var DIR_NAME$p='Matomo';var NAME$p='MATOMO';var DISPLAY_NAME$p='Matomo';var DISPLAY_NAME_TO_DIR_NAME_MAP$p=_defineProperty({},DISPLAY_NAME$p,DIR_NAME$p);(_CNameMapping$p={},_defineProperty(_CNameMapping$p,NAME$p,NAME$p),_defineProperty(_CNameMapping$p,"Matomo",NAME$p),_defineProperty(_CNameMapping$p,"matomo",NAME$p),_CNameMapping$p);
|
1391
1335
|
|
1392
|
-
var _CNameMapping$
|
1336
|
+
var _CNameMapping$o;var DIR_NAME$o='Vero';var NAME$o='VERO';var DISPLAY_NAME$o='Vero';var DISPLAY_NAME_TO_DIR_NAME_MAP$o=_defineProperty({},DISPLAY_NAME$o,DIR_NAME$o);(_CNameMapping$o={},_defineProperty(_CNameMapping$o,NAME$o,NAME$o),_defineProperty(_CNameMapping$o,"Vero",NAME$o),_defineProperty(_CNameMapping$o,"vero",NAME$o),_CNameMapping$o);
|
1393
1337
|
|
1394
|
-
var _CNameMapping$
|
1338
|
+
var _CNameMapping$n;var DIR_NAME$n='Mouseflow';var NAME$n='MOUSEFLOW';var DISPLAY_NAME$n='Mouseflow';var DISPLAY_NAME_TO_DIR_NAME_MAP$n=_defineProperty({},DISPLAY_NAME$n,DIR_NAME$n);(_CNameMapping$n={},_defineProperty(_CNameMapping$n,NAME$n,NAME$n),_defineProperty(_CNameMapping$n,"Mouseflow",NAME$n),_defineProperty(_CNameMapping$n,"mouseflow",NAME$n),_defineProperty(_CNameMapping$n,"mouseFlow",NAME$n),_defineProperty(_CNameMapping$n,"MouseFlow",NAME$n),_defineProperty(_CNameMapping$n,'Mouse flow',NAME$n),_defineProperty(_CNameMapping$n,'mouse flow',NAME$n),_defineProperty(_CNameMapping$n,'mouse Flow',NAME$n),_defineProperty(_CNameMapping$n,'Mouse Flow',NAME$n),_CNameMapping$n);
|
1395
1339
|
|
1396
|
-
var _CNameMapping$
|
1340
|
+
var _CNameMapping$m;var DIR_NAME$m='Rockerbox';var NAME$m='ROCKERBOX';var DISPLAY_NAME$m='Rockerbox';var DISPLAY_NAME_TO_DIR_NAME_MAP$m=_defineProperty({},DISPLAY_NAME$m,DIR_NAME$m);(_CNameMapping$m={},_defineProperty(_CNameMapping$m,NAME$m,NAME$m),_defineProperty(_CNameMapping$m,"Rockerbox",NAME$m),_defineProperty(_CNameMapping$m,"rockerbox",NAME$m),_defineProperty(_CNameMapping$m,"RockerBox",NAME$m),_defineProperty(_CNameMapping$m,'Rocker box',NAME$m),_defineProperty(_CNameMapping$m,'rocker box',NAME$m),_defineProperty(_CNameMapping$m,'Rocker Box',NAME$m),_CNameMapping$m);
|
1397
1341
|
|
1398
|
-
var _CNameMapping$
|
1342
|
+
var _CNameMapping$l;var DIR_NAME$l='ConvertFlow';var NAME$l='CONVERTFLOW';var DISPLAY_NAME$l='ConvertFlow';var DISPLAY_NAME_TO_DIR_NAME_MAP$l=_defineProperty({},DISPLAY_NAME$l,DIR_NAME$l);(_CNameMapping$l={},_defineProperty(_CNameMapping$l,NAME$l,NAME$l),_defineProperty(_CNameMapping$l,"Convertflow",NAME$l),_defineProperty(_CNameMapping$l,"convertflow",NAME$l),_defineProperty(_CNameMapping$l,"convertFlow",NAME$l),_defineProperty(_CNameMapping$l,"ConvertFlow",NAME$l),_defineProperty(_CNameMapping$l,'Convert flow',NAME$l),_defineProperty(_CNameMapping$l,'convert flow',NAME$l),_defineProperty(_CNameMapping$l,'convert Flow',NAME$l),_defineProperty(_CNameMapping$l,'Convert Flow',NAME$l),_defineProperty(_CNameMapping$l,'CONVERT FLOW',NAME$l),_CNameMapping$l);
|
1399
1343
|
|
1400
|
-
var _CNameMapping$
|
1344
|
+
var _CNameMapping$k;var DIR_NAME$k='SnapEngage';var NAME$k='SNAPENGAGE';var DISPLAY_NAME$k='SnapEngage';var DISPLAY_NAME_TO_DIR_NAME_MAP$k=_defineProperty({},DISPLAY_NAME$k,DIR_NAME$k);(_CNameMapping$k={},_defineProperty(_CNameMapping$k,NAME$k,NAME$k),_defineProperty(_CNameMapping$k,"SnapEngage",NAME$k),_defineProperty(_CNameMapping$k,"Snap_Engage",NAME$k),_defineProperty(_CNameMapping$k,"snapengage",NAME$k),_defineProperty(_CNameMapping$k,'SNAP ENGAGE',NAME$k),_defineProperty(_CNameMapping$k,'Snap Engage',NAME$k),_defineProperty(_CNameMapping$k,'snap engage',NAME$k),_CNameMapping$k);
|
1401
1345
|
|
1402
|
-
var _CNameMapping$
|
1346
|
+
var _CNameMapping$j;var DIR_NAME$j='LiveChat';var NAME$j='LIVECHAT';var DISPLAY_NAME$j='LiveChat';var DISPLAY_NAME_TO_DIR_NAME_MAP$j=_defineProperty({},DISPLAY_NAME$j,DIR_NAME$j);(_CNameMapping$j={},_defineProperty(_CNameMapping$j,NAME$j,NAME$j),_defineProperty(_CNameMapping$j,"LiveChat",NAME$j),_defineProperty(_CNameMapping$j,"Live_Chat",NAME$j),_defineProperty(_CNameMapping$j,"livechat",NAME$j),_defineProperty(_CNameMapping$j,'LIVE CHAT',NAME$j),_defineProperty(_CNameMapping$j,'Live Chat',NAME$j),_defineProperty(_CNameMapping$j,'live chat',NAME$j),_CNameMapping$j);
|
1403
1347
|
|
1404
|
-
var _CNameMapping$
|
1348
|
+
var _CNameMapping$i;var DIR_NAME$i='Shynet';var NAME$i='SHYNET';var DISPLAY_NAME$i='Shynet';var DISPLAY_NAME_TO_DIR_NAME_MAP$i=_defineProperty({},DISPLAY_NAME$i,DIR_NAME$i);(_CNameMapping$i={},_defineProperty(_CNameMapping$i,NAME$i,NAME$i),_defineProperty(_CNameMapping$i,"shynet",NAME$i),_defineProperty(_CNameMapping$i,"ShyNet",NAME$i),_defineProperty(_CNameMapping$i,"shyNet",NAME$i),_defineProperty(_CNameMapping$i,"Shynet",NAME$i),_defineProperty(_CNameMapping$i,'shy net',NAME$i),_defineProperty(_CNameMapping$i,'Shy Net',NAME$i),_defineProperty(_CNameMapping$i,'shy Net',NAME$i),_defineProperty(_CNameMapping$i,'Shy net',NAME$i),_CNameMapping$i);
|
1405
1349
|
|
1406
|
-
var _CNameMapping$
|
1350
|
+
var _CNameMapping$h;var DIR_NAME$h='Woopra';var NAME$h='WOOPRA';var DISPLAY_NAME$h='Woopra';var DISPLAY_NAME_TO_DIR_NAME_MAP$h=_defineProperty({},DISPLAY_NAME$h,DIR_NAME$h);(_CNameMapping$h={},_defineProperty(_CNameMapping$h,NAME$h,NAME$h),_defineProperty(_CNameMapping$h,"Woopra",NAME$h),_defineProperty(_CNameMapping$h,"woopra",NAME$h),_CNameMapping$h);
|
1407
1351
|
|
1408
|
-
var _CNameMapping$
|
1352
|
+
var _CNameMapping$g;var DIR_NAME$g='RollBar';var NAME$g='ROLLBAR';var DISPLAY_NAME$g='RollBar';var DISPLAY_NAME_TO_DIR_NAME_MAP$g=_defineProperty({},DISPLAY_NAME$g,DIR_NAME$g);(_CNameMapping$g={},_defineProperty(_CNameMapping$g,NAME$g,NAME$g),_defineProperty(_CNameMapping$g,"RollBar",NAME$g),_defineProperty(_CNameMapping$g,"Roll_Bar",NAME$g),_defineProperty(_CNameMapping$g,"rollbar",NAME$g),_defineProperty(_CNameMapping$g,"Rollbar",NAME$g),_defineProperty(_CNameMapping$g,'ROLL BAR',NAME$g),_defineProperty(_CNameMapping$g,'Roll Bar',NAME$g),_defineProperty(_CNameMapping$g,'roll bar',NAME$g),_CNameMapping$g);
|
1409
1353
|
|
1410
|
-
var _CNameMapping$
|
1354
|
+
var _CNameMapping$f;var DIR_NAME$f='QuoraPixel';var NAME$f='QUORA_PIXEL';var DISPLAY_NAME$f='Quora Pixel';var DISPLAY_NAME_TO_DIR_NAME_MAP$f=_defineProperty({},DISPLAY_NAME$f,DIR_NAME$f);(_CNameMapping$f={},_defineProperty(_CNameMapping$f,NAME$f,NAME$f),_defineProperty(_CNameMapping$f,'Quora Pixel',NAME$f),_defineProperty(_CNameMapping$f,'Quora pixel',NAME$f),_defineProperty(_CNameMapping$f,'QUORA PIXEL',NAME$f),_defineProperty(_CNameMapping$f,"QuoraPixel",NAME$f),_defineProperty(_CNameMapping$f,"Quorapixel",NAME$f),_defineProperty(_CNameMapping$f,"QUORAPIXEL",NAME$f),_defineProperty(_CNameMapping$f,"Quora_Pixel",NAME$f),_defineProperty(_CNameMapping$f,"quora_pixel",NAME$f),_defineProperty(_CNameMapping$f,"Quora",NAME$f),_CNameMapping$f);
|
1411
1355
|
|
1412
|
-
var _CNameMapping$
|
1356
|
+
var _CNameMapping$e;var DIR_NAME$e='June';var NAME$e='JUNE';var DISPLAY_NAME$e='June';var DISPLAY_NAME_TO_DIR_NAME_MAP$e=_defineProperty({},DISPLAY_NAME$e,DIR_NAME$e);(_CNameMapping$e={},_defineProperty(_CNameMapping$e,NAME$e,NAME$e),_defineProperty(_CNameMapping$e,"June",NAME$e),_defineProperty(_CNameMapping$e,"june",NAME$e),_CNameMapping$e);
|
1413
1357
|
|
1414
|
-
var _CNameMapping;var DIR_NAME='
|
1358
|
+
var _CNameMapping$d;var DIR_NAME$d='Engage';var NAME$d='ENGAGE';var DISPLAY_NAME$d='Engage';var DISPLAY_NAME_TO_DIR_NAME_MAP$d=_defineProperty({},DISPLAY_NAME$d,DIR_NAME$d);(_CNameMapping$d={},_defineProperty(_CNameMapping$d,NAME$d,NAME$d),_defineProperty(_CNameMapping$d,"Engage",NAME$d),_defineProperty(_CNameMapping$d,"engage",NAME$d),_CNameMapping$d);
|
1415
1359
|
|
1416
|
-
var
|
1417
|
-
// we're converting the definition name to display names temporarily
|
1418
|
-
var destCNamesToDisplayNamesMap=_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},replaceValuesWithDisplayName(CNameMapping$18,DISPLAY_NAME$18)),replaceValuesWithDisplayName(CNameMapping$17,DISPLAY_NAME$17)),replaceValuesWithDisplayName(CNameMapping$16,DISPLAY_NAME$16)),replaceValuesWithDisplayName(CNameMapping$15,DISPLAY_NAME$15)),replaceValuesWithDisplayName(CNameMapping$14,DISPLAY_NAME$14)),replaceValuesWithDisplayName(CNameMapping$13,DISPLAY_NAME$13)),replaceValuesWithDisplayName(CNameMapping$12,DISPLAY_NAME$12)),replaceValuesWithDisplayName(CNameMapping$11,DISPLAY_NAME$11)),replaceValuesWithDisplayName(CNameMapping$10,DISPLAY_NAME$10)),replaceValuesWithDisplayName(CNameMapping$$,DISPLAY_NAME$$)),replaceValuesWithDisplayName(CNameMapping$_,DISPLAY_NAME$_)),replaceValuesWithDisplayName(CNameMapping$Z,DISPLAY_NAME$Z)),replaceValuesWithDisplayName(CNameMapping$Y,DISPLAY_NAME$Y)),replaceValuesWithDisplayName(CNameMapping$X,DISPLAY_NAME$X)),replaceValuesWithDisplayName(CNameMapping$W,DISPLAY_NAME$W)),replaceValuesWithDisplayName(CNameMapping$V,DISPLAY_NAME$V)),replaceValuesWithDisplayName(CNameMapping$r,DISPLAY_NAME$r)),replaceValuesWithDisplayName(CNameMapping$U,DISPLAY_NAME$U)),replaceValuesWithDisplayName(CNameMapping$T,DISPLAY_NAME$T)),replaceValuesWithDisplayName(CNameMapping$S,DISPLAY_NAME$S)),replaceValuesWithDisplayName(CNameMapping$R,DISPLAY_NAME$R)),replaceValuesWithDisplayName(CNameMapping$Q,DISPLAY_NAME$Q)),replaceValuesWithDisplayName(CNameMapping$P,DISPLAY_NAME$P)),replaceValuesWithDisplayName(CNameMapping$O,DISPLAY_NAME$O)),replaceValuesWithDisplayName(CNameMapping$N,DISPLAY_NAME$N)),replaceValuesWithDisplayName(CNameMapping$M,DISPLAY_NAME$M)),replaceValuesWithDisplayName(CNameMapping$L,DISPLAY_NAME$L)),replaceValuesWithDisplayName(CNameMapping$K,DISPLAY_NAME$K)),replaceValuesWithDisplayName(CNameMapping$J,DISPLAY_NAME$J)),replaceValuesWithDisplayName(CNameMapping$I,DISPLAY_NAME$I)),replaceValuesWithDisplayName(CNameMapping$H,DISPLAY_NAME$H)),replaceValuesWithDisplayName(CNameMapping$G,DISPLAY_NAME$G)),replaceValuesWithDisplayName(CNameMapping$F,DISPLAY_NAME$F)),replaceValuesWithDisplayName(CNameMapping$E,DISPLAY_NAME$E)),replaceValuesWithDisplayName(CNameMapping$D,DISPLAY_NAME$D)),replaceValuesWithDisplayName(CNameMapping$C,DISPLAY_NAME$C)),replaceValuesWithDisplayName(CNameMapping$B,DISPLAY_NAME$B)),replaceValuesWithDisplayName(CNameMapping$A,DISPLAY_NAME$A)),replaceValuesWithDisplayName(CNameMapping$z,DISPLAY_NAME$z)),replaceValuesWithDisplayName(CNameMapping$y,DISPLAY_NAME$y)),replaceValuesWithDisplayName(CNameMapping$x,DISPLAY_NAME$x)),replaceValuesWithDisplayName(CNameMapping$w,DISPLAY_NAME$w)),replaceValuesWithDisplayName(CNameMapping$v,DISPLAY_NAME$v)),replaceValuesWithDisplayName(CNameMapping$u,DISPLAY_NAME$u)),replaceValuesWithDisplayName(CNameMapping$t,DISPLAY_NAME$t)),replaceValuesWithDisplayName(CNameMapping$s,DISPLAY_NAME$s)),replaceValuesWithDisplayName(CNameMapping$q,DISPLAY_NAME$q)),replaceValuesWithDisplayName(CNameMapping$p,DISPLAY_NAME$p)),replaceValuesWithDisplayName(CNameMapping$o,DISPLAY_NAME$o)),replaceValuesWithDisplayName(CNameMapping$n,DISPLAY_NAME$n)),replaceValuesWithDisplayName(CNameMapping$m,DISPLAY_NAME$m)),replaceValuesWithDisplayName(CNameMapping$k,DISPLAY_NAME$k)),replaceValuesWithDisplayName(CNameMapping$j,DISPLAY_NAME$j)),replaceValuesWithDisplayName(CNameMapping$i,DISPLAY_NAME$i)),replaceValuesWithDisplayName(CNameMapping$h,DISPLAY_NAME$h)),replaceValuesWithDisplayName(CNameMapping$g,DISPLAY_NAME$g)),replaceValuesWithDisplayName(CNameMapping$f,DISPLAY_NAME$f)),replaceValuesWithDisplayName(CNameMapping$e,DISPLAY_NAME$e)),replaceValuesWithDisplayName(CNameMapping$d,DISPLAY_NAME$d)),replaceValuesWithDisplayName(CNameMapping$c,DISPLAY_NAME$c)),replaceValuesWithDisplayName(CNameMapping$b,DISPLAY_NAME$b)),replaceValuesWithDisplayName(CNameMapping$l,DISPLAY_NAME$l)),replaceValuesWithDisplayName(CNameMapping$a,DISPLAY_NAME$a)),replaceValuesWithDisplayName(CNameMapping$9,DISPLAY_NAME$9)),replaceValuesWithDisplayName(CNameMapping$8,DISPLAY_NAME$8)),replaceValuesWithDisplayName(CNameMapping$7,DISPLAY_NAME$7)),replaceValuesWithDisplayName(CNameMapping$6,DISPLAY_NAME$6)),replaceValuesWithDisplayName(CNameMapping$5,DISPLAY_NAME$5)),replaceValuesWithDisplayName(CNameMapping$4,DISPLAY_NAME$4)),replaceValuesWithDisplayName(CNameMapping$3,DISPLAY_NAME$3)),replaceValuesWithDisplayName(CNameMapping$2,DISPLAY_NAME$2)),replaceValuesWithDisplayName(CNameMapping$1,DISPLAY_NAME$1)),replaceValuesWithDisplayName(CNameMapping,DISPLAY_NAME));
|
1360
|
+
var _CNameMapping$c;var DIR_NAME$c='Iterable';var NAME$c='ITERABLE';var DISPLAY_NAME$c='Iterable';var DISPLAY_NAME_TO_DIR_NAME_MAP$c=_defineProperty({},DISPLAY_NAME$c,DIR_NAME$c);(_CNameMapping$c={},_defineProperty(_CNameMapping$c,NAME$c,NAME$c),_defineProperty(_CNameMapping$c,"Iterable",NAME$c),_defineProperty(_CNameMapping$c,"iterable",NAME$c),_CNameMapping$c);
|
1419
1361
|
|
1420
|
-
|
1421
|
-
* Converts the common names of the destinations to their display names
|
1422
|
-
* @param intgOptions Load or API integration options
|
1423
|
-
*/var normalizeIntegrationOptions=function normalizeIntegrationOptions(intgOptions){var normalizedIntegrationOptions={};if(intgOptions){Object.keys(intgOptions).forEach(function(key){var destOpts=clone$1(intgOptions[key]);if(key==='All'){normalizedIntegrationOptions[key]=Boolean(destOpts);}else {var displayName=destCNamesToDisplayNamesMap[key];if(displayName){normalizedIntegrationOptions[displayName]=destOpts;}else {normalizedIntegrationOptions[key]=destOpts;}}});}if(isUndefined(normalizedIntegrationOptions.All)){normalizedIntegrationOptions.All=true;}return normalizedIntegrationOptions;};
|
1362
|
+
var _CNameMapping$b;var DIR_NAME$b='YandexMetrica';var NAME$b='YANDEX_METRICA';var DISPLAY_NAME$b='Yandex.Metrica';var DISPLAY_NAME_TO_DIR_NAME_MAP$b=_defineProperty({},DISPLAY_NAME$b,DIR_NAME$b);(_CNameMapping$b={},_defineProperty(_CNameMapping$b,NAME$b,NAME$b),_defineProperty(_CNameMapping$b,"Yandexmetrica",NAME$b),_defineProperty(_CNameMapping$b,"yandexmetrica",NAME$b),_defineProperty(_CNameMapping$b,"yandexMetrica",NAME$b),_defineProperty(_CNameMapping$b,"YandexMetrica",NAME$b),_CNameMapping$b);
|
1424
1363
|
|
1425
|
-
var
|
1364
|
+
var _CNameMapping$a;var DIR_NAME$a='Refiner';var NAME$a='REFINER';var DISPLAY_NAME$a='Refiner';var DISPLAY_NAME_TO_DIR_NAME_MAP$a=_defineProperty({},DISPLAY_NAME$a,DIR_NAME$a);(_CNameMapping$a={},_defineProperty(_CNameMapping$a,NAME$a,NAME$a),_defineProperty(_CNameMapping$a,"Refiner",NAME$a),_defineProperty(_CNameMapping$a,"refiner",NAME$a),_CNameMapping$a);
|
1426
1365
|
|
1427
|
-
var
|
1428
|
-
var BEACON_QUEUE_SEND_ERROR=function BEACON_QUEUE_SEND_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to send events batch data to the browser's beacon queue. The events will be dropped.");};var BEACON_QUEUE_DELIVERY_ERROR=function BEACON_QUEUE_DELIVERY_ERROR(url){return "Failed to send events batch data to the browser's beacon queue for URL ".concat(url,".");};var BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR=function BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to convert events batch object to string.");};var BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR=function BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to convert events batch object to Blob.");};var BUGSNAG_SDK_LOAD_ERROR=function BUGSNAG_SDK_LOAD_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load the Bugsnag SDK.");};var DESTINATION_NOT_SUPPORTED_ERROR=function DESTINATION_NOT_SUPPORTED_ERROR(destUserFriendlyId){return "Destination ".concat(destUserFriendlyId," is not supported.");};var DESTINATION_SDK_LOAD_ERROR=function DESTINATION_SDK_LOAD_ERROR(context,destUserFriendlyId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to load script for destination ").concat(destUserFriendlyId,".");};var DESTINATION_INIT_ERROR=function DESTINATION_INIT_ERROR(destUserFriendlyId){return "Failed to initialize destination ".concat(destUserFriendlyId,".");};var DESTINATION_INTEGRATIONS_DATA_ERROR=function DESTINATION_INTEGRATIONS_DATA_ERROR(destUserFriendlyId){return "Failed to get integrations data for destination ".concat(destUserFriendlyId,".");};var DESTINATION_EVENT_FILTERING_WARNING=function DESTINATION_EVENT_FILTERING_WARNING(context,eventName,destUserFriendlyId){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The \"").concat(eventName,"\" track event has been filtered for the \"").concat(destUserFriendlyId,"\" destination.");};var ONETRUST_ACCESS_ERROR=function ONETRUST_ACCESS_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to access OneTrust SDK resources. Please ensure that the OneTrust SDK is loaded successfully before RudderStack SDK.");};var KETCH_CONSENT_COOKIE_READ_ERROR=function KETCH_CONSENT_COOKIE_READ_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to read the consent cookie.");};var KETCH_CONSENT_COOKIE_PARSE_ERROR=function KETCH_CONSENT_COOKIE_PARSE_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to parse the consent cookie.");};var DESTINATION_CONSENT_STATUS_ERROR="Failed to determine the consent status for the destination. Please check the destination configuration and try again.";var STORAGE_MIGRATION_ERROR=function STORAGE_MIGRATION_ERROR(key){return "Failed to retrieve or parse data for ".concat(key," from storage.");};var EVENT_STRINGIFY_ERROR=function EVENT_STRINGIFY_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to convert event object to string.");};var RETRY_QUEUE_PROCESS_ERROR=function RETRY_QUEUE_PROCESS_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Process function threw an error.");};var EVENT_PAYLOAD_PREPARATION_ERROR=function EVENT_PAYLOAD_PREPARATION_ERROR(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to prepare the event payload for delivery. The event will be dropped.");};var EVENT_DELIVERY_FAILURE_ERROR_PREFIX=function EVENT_DELIVERY_FAILURE_ERROR_PREFIX(context,url){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to deliver event to ").concat(url,".");};var BUGSNAG_API_KEY_VALIDATION_ERROR=function BUGSNAG_API_KEY_VALIDATION_ERROR(apiKey){return "The Bugsnag API key (".concat(apiKey,") is invalid or not provided.");};var DESTINATION_READY_TIMEOUT_ERROR=function DESTINATION_READY_TIMEOUT_ERROR(timeout,destUserFriendlyId){return "A timeout of ".concat(timeout," ms occurred while trying to check the ready status for \"").concat(destUserFriendlyId,"\" destination.");};var DESTINATION_EVENT_FORWARDING_ERROR=function DESTINATION_EVENT_FORWARDING_ERROR(destUserFriendlyId){return "Failed to forward event to destination \"".concat(destUserFriendlyId,"\".");};var BUGSNAG_SDK_LOAD_TIMEOUT_ERROR=function BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(timeout){return "A timeout ".concat(timeout," ms occurred while trying to load the Bugsnag SDK.");};// WARN
|
1429
|
-
var EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING=function EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING(context,payloadSize,sizeLimit){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"The size of the event payload (").concat(payloadSize," bytes) exceeds the maximum limit of ").concat(sizeLimit," bytes. Events with large payloads may be dropped in the future. Please review your instrumentation to ensure that event payloads are within the size limit.");};var EVENT_PAYLOAD_SIZE_VALIDATION_WARNING=function EVENT_PAYLOAD_SIZE_VALIDATION_WARNING(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Failed to validate event payload size. Please make sure that the event payload is within the size limit and is a valid JSON object.");};// DEBUG
|
1430
|
-
var BEACON_PLUGIN_EVENTS_QUEUE_DEBUG=function BEACON_PLUGIN_EVENTS_QUEUE_DEBUG(context){return "".concat(context).concat(LOG_CONTEXT_SEPARATOR,"Sending events to data plane.");};
|
1366
|
+
var _CNameMapping$9;var DIR_NAME$9='Qualaroo';var NAME$9='QUALAROO';var DISPLAY_NAME$9='Qualaroo';var DISPLAY_NAME_TO_DIR_NAME_MAP$9=_defineProperty({},DISPLAY_NAME$9,DIR_NAME$9);(_CNameMapping$9={},_defineProperty(_CNameMapping$9,NAME$9,NAME$9),_defineProperty(_CNameMapping$9,"Qualaroo",NAME$9),_defineProperty(_CNameMapping$9,"qualaroo",NAME$9),_CNameMapping$9);
|
1431
1367
|
|
1432
|
-
var
|
1433
|
-
* Utility to get the stringified event payload
|
1434
|
-
* @param event RudderEvent object
|
1435
|
-
* @param logger Logger instance
|
1436
|
-
* @returns stringified event payload. Empty string if error occurs.
|
1437
|
-
*/var getDeliveryPayload$1=function getDeliveryPayload(event,logger){var deliveryPayloadStr='';try{deliveryPayloadStr=stringifyWithoutCircular(event,true);}catch(err){logger===null||logger===void 0?void 0:logger.error(EVENT_STRINGIFY_ERROR(QUEUE_UTILITIES),err);}return deliveryPayloadStr;};/**
|
1438
|
-
* Utility to validate final payload size before sending to server
|
1439
|
-
* @param event RudderEvent object
|
1440
|
-
* @param logger Logger instance
|
1441
|
-
*/var validateEventPayloadSize=function validateEventPayloadSize(event,logger){var payloadStr=getDeliveryPayload$1(event,logger);if(payloadStr){var payloadSize=payloadStr.length;if(payloadSize>EVENT_PAYLOAD_SIZE_BYTES_LIMIT){logger===null||logger===void 0?void 0:logger.warn(EVENT_PAYLOAD_SIZE_CHECK_FAIL_WARNING(QUEUE_UTILITIES,payloadSize,EVENT_PAYLOAD_SIZE_BYTES_LIMIT));}}else {logger===null||logger===void 0?void 0:logger.warn(EVENT_PAYLOAD_SIZE_VALIDATION_WARNING(QUEUE_UTILITIES));}};/**
|
1442
|
-
* Filters and returns the user supplied integrations config that should take preference over the destination specific integrations config
|
1443
|
-
* @param eventIntgConfig User supplied integrations config at event level
|
1444
|
-
* @param destinationsIntgConfig Cumulative integrations config from all destinations
|
1445
|
-
* @returns Filtered user supplied integrations config
|
1446
|
-
*/var getOverriddenIntegrationOptions=function getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig){return Object.keys(eventIntgConfig).filter(function(intgName){return eventIntgConfig[intgName]!==true||!destinationsIntgConfig[intgName];}).reduce(function(obj,key){var retVal=clone$1(obj);retVal[key]=eventIntgConfig[key];return retVal;},{});};/**
|
1447
|
-
* Mutates the event and return final event for delivery
|
1448
|
-
* Updates certain parameters like sentAt timestamp, integrations config etc.
|
1449
|
-
* @param event RudderEvent object
|
1450
|
-
* @param state Application state
|
1451
|
-
* @returns Final event ready to be delivered
|
1452
|
-
*/var getFinalEventForDeliveryMutator=function getFinalEventForDeliveryMutator(event,state){var finalEvent=clone$1(event);// Update sentAt timestamp to the latest timestamp
|
1453
|
-
finalEvent.sentAt=getCurrentTimeFormatted();// Merge the destination specific integrations config with the event's integrations config
|
1454
|
-
// In general, the preference is given to the event's integrations config
|
1455
|
-
var eventIntgConfig=normalizeIntegrationOptions(event.integrations);var destinationsIntgConfig=state.nativeDestinations.integrationsConfig.value;var overriddenIntgOpts=getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig);finalEvent.integrations=mergeDeepRight(destinationsIntgConfig,overriddenIntgOpts);return finalEvent;};
|
1368
|
+
var _CNameMapping$8;var DIR_NAME$8='Podsights';var NAME$8='PODSIGHTS';var DISPLAY_NAME$8='Podsights';var DISPLAY_NAME_TO_DIR_NAME_MAP$8=_defineProperty({},DISPLAY_NAME$8,DIR_NAME$8);(_CNameMapping$8={},_defineProperty(_CNameMapping$8,NAME$8,NAME$8),_defineProperty(_CNameMapping$8,"Podsights",NAME$8),_defineProperty(_CNameMapping$8,"PodSights",NAME$8),_defineProperty(_CNameMapping$8,'pod Sights',NAME$8),_defineProperty(_CNameMapping$8,'Pod Sights',NAME$8),_defineProperty(_CNameMapping$8,'pod sights',NAME$8),_defineProperty(_CNameMapping$8,'POD SIGHTS',NAME$8),_defineProperty(_CNameMapping$8,'Pod sights',NAME$8),_CNameMapping$8);// default mapping for the events
|
1456
1369
|
|
1457
|
-
var
|
1370
|
+
var _CNameMapping$7;var DIR_NAME$7='Axeptio';var NAME$7='AXEPTIO';var DISPLAY_NAME$7='Axeptio';var DISPLAY_NAME_TO_DIR_NAME_MAP$7=_defineProperty({},DISPLAY_NAME$7,DIR_NAME$7);(_CNameMapping$7={},_defineProperty(_CNameMapping$7,NAME$7,NAME$7),_defineProperty(_CNameMapping$7,"Axeptio",NAME$7),_defineProperty(_CNameMapping$7,"axeptio",NAME$7),_CNameMapping$7);
|
1458
1371
|
|
1459
|
-
var
|
1460
|
-
// Limit of the Beacon transfer mechanism on the browsers
|
1461
|
-
var MAX_BATCH_PAYLOAD_SIZE_BYTES=64*1024;// 64 KB
|
1462
|
-
var DEFAULT_BEACON_QUEUE_OPTIONS={maxItems:DEFAULT_BEACON_QUEUE_MAX_SIZE,flushQueueInterval:DEFAULT_BEACON_QUEUE_FLUSH_INTERVAL_MS};var DATA_PLANE_API_VERSION$1='v1';var QUEUE_NAME$2='rudder_beacon';var BEACON_QUEUE_PLUGIN='BeaconQueuePlugin';
|
1372
|
+
var _CNameMapping$6;var DIR_NAME$6='Satismeter';var NAME$6='SATISMETER';var DISPLAY_NAME$6='Satismeter';var DISPLAY_NAME_TO_DIR_NAME_MAP$6=_defineProperty({},DISPLAY_NAME$6,DIR_NAME$6);(_CNameMapping$6={},_defineProperty(_CNameMapping$6,NAME$6,NAME$6),_defineProperty(_CNameMapping$6,"Satismeter",NAME$6),_defineProperty(_CNameMapping$6,"SatisMeter",NAME$6),_CNameMapping$6);
|
1463
1373
|
|
1464
|
-
|
1465
|
-
* Utility to get the stringified event payload as Blob
|
1466
|
-
* @param events RudderEvent object array
|
1467
|
-
* @param logger Logger instance
|
1468
|
-
* @returns stringified events payload as Blob, undefined if error occurs.
|
1469
|
-
*/var getDeliveryPayload=function getDeliveryPayload(events,logger){var data={batch:events};try{var blobPayload=stringifyWithoutCircular(data,true);var blobOptions={type:'text/plain'};if(blobPayload){return new Blob([blobPayload],blobOptions);}logger===null||logger===void 0?void 0:logger.error(BEACON_QUEUE_STRING_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN));}catch(err){logger===null||logger===void 0?void 0:logger.error(BEACON_QUEUE_BLOB_CONVERSION_FAILURE_ERROR(BEACON_QUEUE_PLUGIN),err);}return undefined;};var getNormalizedBeaconQueueOptions=function getNormalizedBeaconQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_BEACON_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl$1=function getDeliveryUrl(dataplaneUrl,writeKey){var dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/','beacon','/',DATA_PLANE_API_VERSION$1,'/',"batch?writeKey=".concat(writeKey)].join('')),dpUrl).href;};
|
1374
|
+
var _CNameMapping$5;var DIR_NAME$5='MicrosoftClarity';var NAME$5='MICROSOFT_CLARITY';var DISPLAY_NAME$5='Microsoft Clarity';var DISPLAY_NAME_TO_DIR_NAME_MAP$5=_defineProperty({},DISPLAY_NAME$5,DIR_NAME$5);(_CNameMapping$5={},_defineProperty(_CNameMapping$5,NAME$5,NAME$5),_defineProperty(_CNameMapping$5,'Microsoft Clarity',NAME$5),_defineProperty(_CNameMapping$5,'Microsoft clarity',NAME$5),_defineProperty(_CNameMapping$5,'microsoft clarity',NAME$5),_defineProperty(_CNameMapping$5,"Microsoft_clarity",NAME$5),_defineProperty(_CNameMapping$5,"MicrosoftClarity",NAME$5),_defineProperty(_CNameMapping$5,"MICROSOFTCLARITY",NAME$5),_defineProperty(_CNameMapping$5,"microsoftclarity",NAME$5),_defineProperty(_CNameMapping$5,"microsoftClarity",NAME$5),_CNameMapping$5);
|
1470
1375
|
|
1471
|
-
var
|
1376
|
+
var _CNameMapping$4;var DIR_NAME$4='Sendinblue';var NAME$4='SENDINBLUE';var DISPLAY_NAME$4='Sendinblue';var DISPLAY_NAME_TO_DIR_NAME_MAP$4=_defineProperty({},DISPLAY_NAME$4,DIR_NAME$4);(_CNameMapping$4={},_defineProperty(_CNameMapping$4,NAME$4,NAME$4),_defineProperty(_CNameMapping$4,"Sendinblue",NAME$4),_defineProperty(_CNameMapping$4,"sendinblue",NAME$4),_defineProperty(_CNameMapping$4,"SendinBlue",NAME$4),_CNameMapping$4);
|
1472
1377
|
|
1473
|
-
var
|
1474
|
-
this.store=this.storeManager.setStore({id:this.id,name:this.name,type:storageType});this.flushQueue=this.flushQueue.bind(this);this.attachListeners();this.flushQueueTimeOut=undefined;this.scheduleTimeoutActive=false;}_createClass(BeaconItemsQueue,[{key:"attachListeners",value:function attachListeners(){var _this=this;globalThis.addEventListener('visibilitychange',function(){if(document.visibilityState==='hidden'){_this.flushQueue();}});}},{key:"getQueue",value:function getQueue(name){var _this$store$get;return (_this$store$get=this.store.get(name!==null&&name!==void 0?name:this.name))!==null&&_this$store$get!==void 0?_this$store$get:[];}},{key:"setQueue",value:function setQueue(name,value){this.store.set(name!==null&&name!==void 0?name:this.name,value!==null&&value!==void 0?value:[]);}},{key:"start",value:function start(){if(!this.scheduleTimeoutActive){this.flushQueueTimeOut=globalThis.setTimeout(this.flushQueue,this.timeouts.flushQueueTimeOutInterval);this.scheduleTimeoutActive=true;}}},{key:"stop",value:function stop(){if(this.scheduleTimeoutActive){clearTimeout(this.flushQueueTimeOut);this.scheduleTimeoutActive=false;}}},{key:"enqueue",value:function enqueue(entry){var queue=this.getQueue();// Get max items from the queue minus one
|
1475
|
-
queue=queue.slice(-(this.maxItems-1));queue.push(entry);queue=queue.sort(sortByTime$1);// Calculate response payload size after the addition of new event
|
1476
|
-
var eventsToSend=queue.slice(0);var batchData=getDeliveryPayload(eventsToSend.map(function(queueItem){return queueItem.item.event;}));// Send events that existed in the queue if totaling more max payload size
|
1477
|
-
var isExceededMaxPayloadSize=Boolean(batchData&&batchData.length>MAX_BATCH_PAYLOAD_SIZE_BYTES);if(isExceededMaxPayloadSize){// Flush all previous items
|
1478
|
-
eventsToSend=queue.slice(0,queue.length-1);this.flushQueue(eventsToSend);// Add only latest item in the remaining queue that is cleared appropriately in flushQueue
|
1479
|
-
queue=this.getQueue();queue.push(entry);}this.setQueue(this.name,queue);// If queue has total of max items then flush
|
1480
|
-
if(queue.length===this.maxItems){this.flushQueue();}this.start();}},{key:"addItem",value:function addItem(item){this.enqueue({item:item,attemptNumber:0,time:Date.now(),id:generateUUID()});}},{key:"flushQueue",value:function flushQueue(queueItems){var _this2=this;if(!this.flushInProgress){this.flushInProgress=true;var batchItems=queueItems!==null&&queueItems!==void 0?queueItems:this.getQueue();var batchData=batchItems&&batchItems.length>0?batchItems.slice(0,batchItems.length):[];// TODO: add retry mechanism here
|
1481
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1482
|
-
var beaconSendCallback=function beaconSendCallback(error,response){_this2.setQueue(_this2.name,[]);_this2.stop();_this2.flushInProgress=false;if(_this2.nextFlushPending){_this2.nextFlushPending=false;_this2.flushQueue();}};if(batchData.length>0){this.processQueueCb(batchData,beaconSendCallback);return;}// If no items to send just clear timer
|
1483
|
-
beaconSendCallback(null);}else {this.nextFlushPending=true;}}}]);return BeaconItemsQueue;}();
|
1378
|
+
var _CNameMapping$3;var DIR_NAME$3='Olark';var NAME$3='OLARK';var DISPLAY_NAME$3='Olark';var DISPLAY_NAME_TO_DIR_NAME_MAP$3=_defineProperty({},DISPLAY_NAME$3,DIR_NAME$3);(_CNameMapping$3={},_defineProperty(_CNameMapping$3,NAME$3,NAME$3),_defineProperty(_CNameMapping$3,"Olark",NAME$3),_defineProperty(_CNameMapping$3,"olark",NAME$3),_CNameMapping$3);
|
1484
1379
|
|
1485
|
-
var
|
1486
|
-
* Initialize the queue for delivery
|
1487
|
-
* @param state Application state
|
1488
|
-
* @param httpClient http client instance
|
1489
|
-
* @param storeManager Store Manager instance
|
1490
|
-
* @param errorHandler Error handler instance
|
1491
|
-
* @param logger Logger instance
|
1492
|
-
* @returns BeaconItemsQueue instance
|
1493
|
-
*/init:function init(state,httpClient,storeManager,errorHandler,logger){var _state$loadOptions$va;var writeKey=state.lifecycle.writeKey.value;var dataplaneUrl=state.lifecycle.activeDataplaneUrl.value;var url=getDeliveryUrl$1(dataplaneUrl,writeKey);var finalQOpts=getNormalizedBeaconQueueOptions((_state$loadOptions$va=state.loadOptions.value.beaconQueueOptions)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:{});var queueProcessCallback=function queueProcessCallback(queueItems,done){logger===null||logger===void 0?void 0:logger.debug(BEACON_PLUGIN_EVENTS_QUEUE_DEBUG(BEACON_QUEUE_PLUGIN));var finalEvents=queueItems.map(function(queueItem){return getFinalEventForDeliveryMutator(queueItem.item.event,state);});var data=getDeliveryPayload(finalEvents);if(data){try{var isEnqueuedInBeacon=navigator.sendBeacon(url,data);if(!isEnqueuedInBeacon){logger===null||logger===void 0?void 0:logger.error(BEACON_QUEUE_SEND_ERROR(BEACON_QUEUE_PLUGIN));}done(null,isEnqueuedInBeacon);}catch(err){errorHandler===null||errorHandler===void 0?void 0:errorHandler.onError(err,BEACON_QUEUE_PLUGIN,BEACON_QUEUE_DELIVERY_ERROR(url));done(err);}}else {// Mark the item as done so that it can be removed from the queue
|
1494
|
-
done(null);}};var eventsQueue=new BeaconItemsQueue("".concat(QUEUE_NAME$2,"_").concat(writeKey,"}"),finalQOpts,queueProcessCallback,storeManager);return eventsQueue;},/**
|
1495
|
-
* Add event to the queue for delivery
|
1496
|
-
* @param state Application state
|
1497
|
-
* @param eventsQueue IQueue instance
|
1498
|
-
* @param event RudderEvent object
|
1499
|
-
* @param errorHandler Error handler instance
|
1500
|
-
* @param logger Logger instance
|
1501
|
-
* @returns none
|
1502
|
-
*/enqueue:function enqueue(state,eventsQueue,event,errorHandler,logger){// sentAt is only added here for the validation step
|
1503
|
-
// It'll be updated to the latest timestamp during actual delivery
|
1504
|
-
event.sentAt=getCurrentTimeFormatted();validateEventPayloadSize(event,logger);eventsQueue.addItem({event:event});}}};};
|
1380
|
+
var _CNameMapping$2;var DIR_NAME$2='Lemnisk';var NAME$2='LEMNISK';var DISPLAY_NAME$2='Lemnisk';var DISPLAY_NAME_TO_DIR_NAME_MAP$2=_defineProperty({},DISPLAY_NAME$2,DIR_NAME$2);(_CNameMapping$2={},_defineProperty(_CNameMapping$2,NAME$2,NAME$2),_defineProperty(_CNameMapping$2,"LEMNISK_MARKETING_AUTOMATION",NAME$2),_defineProperty(_CNameMapping$2,'Lemnisk Marketing Automation',NAME$2),_defineProperty(_CNameMapping$2,"LemniskMarketingAutomation",NAME$2),_defineProperty(_CNameMapping$2,"lemniskmarketingautomation",NAME$2),_defineProperty(_CNameMapping$2,"lemniskMarketingAutomation",NAME$2),_defineProperty(_CNameMapping$2,"lemnisk",NAME$2),_defineProperty(_CNameMapping$2,"Lemnisk",NAME$2),_CNameMapping$2);
|
1505
1381
|
|
1506
|
-
var
|
1382
|
+
var _CNameMapping$1;var DIR_NAME$1='TiktokAds';var NAME$1='TIKTOK_ADS';var DISPLAY_NAME$1='TikTok Ads';var DISPLAY_NAME_TO_DIR_NAME_MAP$1=_defineProperty({},DISPLAY_NAME$1,DIR_NAME$1);(_CNameMapping$1={},_defineProperty(_CNameMapping$1,NAME$1,NAME$1),_defineProperty(_CNameMapping$1,"TiktokAds",NAME$1),_defineProperty(_CNameMapping$1,'Tiktok ads',NAME$1),_defineProperty(_CNameMapping$1,'Tiktok Ads',NAME$1),_defineProperty(_CNameMapping$1,'Tik Tok Ads',NAME$1),_defineProperty(_CNameMapping$1,'tik tok ads',NAME$1),_defineProperty(_CNameMapping$1,"tiktokads",NAME$1),_CNameMapping$1);
|
1507
1383
|
|
1508
|
-
var
|
1509
|
-
var BUGSNAG_LIB_V7_INSTANCE_GLOBAL_KEY_NAME='Bugsnag';var GLOBAL_LIBRARY_OBJECT_NAMES=[BUGSNAG_LIB_V7_INSTANCE_GLOBAL_KEY_NAME,BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];var BUGSNAG_CDN_URL='https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js';var ERROR_REPORT_PROVIDER_NAME_BUGSNAG='rs-bugsnag';// This API key token is parsed in the CI pipeline
|
1510
|
-
var API_KEY='0d96a60df267f4a13f808bbaa54e535c';var BUGSNAG_VALID_MAJOR_VERSION='6';var SDK_LOAD_POLL_INTERVAL_MS=100;// ms
|
1511
|
-
var MAX_WAIT_FOR_SDK_LOAD_MS=100*SDK_LOAD_POLL_INTERVAL_MS;// ms
|
1512
|
-
// Errors from the below scripts are NOT allowed to reach Bugsnag
|
1513
|
-
var SDK_FILE_NAME_PREFIXES=function SDK_FILE_NAME_PREFIXES(){return ['rsa'].concat(_toConsumableArray(Object.values(destDisplayNamesToFileNamesMap)));};var DEV_HOSTS=['www.test-host.com','localhost','127.0.0.1','[::1]'];// List of keys to exclude from the metadata
|
1514
|
-
// Potential PII or sensitive data
|
1515
|
-
var APP_STATE_EXCLUDE_KEYS=['userId','userTraits','groupId','groupTraits','anonymousId','config','instance',// destination instance objects
|
1516
|
-
'anonymousUserId','eventBuffer',// pre-load event buffer (may contain PII)
|
1517
|
-
'traits'];var BUGSNAG_PLUGIN='BugsnagPlugin';
|
1384
|
+
var _CNameMapping;var DIR_NAME='ActiveCampaign';var NAME='ACTIVE_CAMPAIGN';var DISPLAY_NAME='Active Campaign';var DISPLAY_NAME_TO_DIR_NAME_MAP=_defineProperty({},DISPLAY_NAME,DIR_NAME);(_CNameMapping={ActiveCampaign:NAME,'Active Campaign':NAME,'ACTIVE CAMPAIGN':NAME},_defineProperty(_CNameMapping,NAME,NAME),_defineProperty(_CNameMapping,"activecampaign",NAME),_defineProperty(_CNameMapping,'active campaign',NAME),_defineProperty(_CNameMapping,'Active campaign',NAME),_defineProperty(_CNameMapping,'active Campaign',NAME),_defineProperty(_CNameMapping,"active_campaign",NAME),_CNameMapping);
|
1518
1385
|
|
1519
|
-
var
|
1520
|
-
// eslint-disable-next-line no-underscore-dangle
|
1521
|
-
var version=globalLibInstance===null||globalLibInstance===void 0||(_globalLibInstance$_c=globalLibInstance._client)===null||_globalLibInstance$_c===void 0||(_globalLibInstance$_c=_globalLibInstance$_c._notifier)===null||_globalLibInstance$_c===void 0?void 0:_globalLibInstance$_c.version;// For versions older than 7
|
1522
|
-
if(!version){var _tempInstance$notifie;var tempInstance=globalLibInstance({apiKey:API_KEY,releaseStage:'version-test',// eslint-disable-next-line func-names, object-shorthand
|
1523
|
-
beforeSend:function beforeSend(){return false;}});version=(_tempInstance$notifie=tempInstance.notifier)===null||_tempInstance$notifie===void 0?void 0:_tempInstance$notifie.version;}return version&&version.charAt(0)===BUGSNAG_VALID_MAJOR_VERSION;};var isRudderSDKError=function isRudderSDKError(event){var _event$stacktrace;var errorOrigin=(_event$stacktrace=event.stacktrace)===null||_event$stacktrace===void 0||(_event$stacktrace=_event$stacktrace[0])===null||_event$stacktrace===void 0?void 0:_event$stacktrace.file;if(!errorOrigin||typeof errorOrigin!=='string'){return false;}var srcFileName=errorOrigin.substring(errorOrigin.lastIndexOf('/')+1);return SDK_FILE_NAME_PREFIXES().some(function(prefix){return srcFileName.startsWith(prefix)&&srcFileName.endsWith('.js');});};var enhanceErrorEventMutator=function enhanceErrorEventMutator(event,metadataSource){event.updateMetaData('source',{metadataSource:metadataSource});var errorMessage=event.errorMessage;// eslint-disable-next-line no-param-reassign
|
1524
|
-
event.context=errorMessage;// Hack for easily grouping the script load errors
|
1525
|
-
// on the dashboard
|
1526
|
-
if(errorMessage.includes('error in script loading')){// eslint-disable-next-line no-param-reassign
|
1527
|
-
event.context='Script load failures';}// eslint-disable-next-line no-param-reassign
|
1528
|
-
event.severity='error';};var onError=function onError(state){var _state$source$value;var metadataSource=(_state$source$value=state.source.value)===null||_state$source$value===void 0?void 0:_state$source$value.id;return function(event){try{// Discard the event if it's not originated at the SDK
|
1529
|
-
if(!isRudderSDKError(event)){return false;}enhanceErrorEventMutator(event,metadataSource);return true;}catch(_unused){// Drop the error event if it couldn't be filtered as
|
1530
|
-
// it is most likely a non-SDK error
|
1531
|
-
return false;}};};var getReleaseStage=function getReleaseStage(){var host=globalThis.location.hostname;return host&&DEV_HOSTS.includes(host)?'development':'production';};var getGlobalBugsnagLibInstance=function getGlobalBugsnagLibInstance(){return globalThis[BUGSNAG_LIB_INSTANCE_GLOBAL_KEY_NAME];};var getNewClient=function getNewClient(state,logger){var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();var clientConfig={apiKey:API_KEY,appVersion:'3.0.0-beta.5',// Set SDK version as the app version from build config
|
1532
|
-
metaData:{SDK:{name:'JS',installType:'npm'}},beforeSend:onError(state),autoCaptureSessions:false,// auto capture sessions is disabled
|
1533
|
-
collectUserIp:false,// collecting user's IP is disabled
|
1534
|
-
// enabledBreadcrumbTypes: ['error', 'log', 'user'], // for v7 and above
|
1535
|
-
maxEvents:100,maxBreadcrumbs:40,releaseStage:getReleaseStage(),user:{id:state.lifecycle.writeKey.value},logger:logger};var client=globalBugsnagLibInstance(clientConfig);return client;};var isApiKeyValid=function isApiKeyValid(apiKey){var isAPIKeyValid=!(apiKey.startsWith('{{')||apiKey.endsWith('}}')||apiKey.length===0);return isAPIKeyValid;};var loadBugsnagSDK=function loadBugsnagSDK(externalSrcLoader,logger){var isNotLoaded=GLOBAL_LIBRARY_OBJECT_NAMES.every(function(globalKeyName){return !globalThis[globalKeyName];});if(!isNotLoaded){return;}externalSrcLoader.loadJSFile({url:BUGSNAG_CDN_URL,id:ERROR_REPORT_PROVIDER_NAME_BUGSNAG,callback:function callback(id){if(!id){logger===null||logger===void 0?void 0:logger.error(BUGSNAG_SDK_LOAD_ERROR(BUGSNAG_PLUGIN));}}});};var initBugsnagClient=function initBugsnagClient(state,promiseResolve,promiseReject,logger){var time=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var globalBugsnagLibInstance=getGlobalBugsnagLibInstance();if(typeof globalBugsnagLibInstance==='function'){if(isValidVersion(globalBugsnagLibInstance)){var client=getNewClient(state,logger);promiseResolve(client);}}else if(time>=MAX_WAIT_FOR_SDK_LOAD_MS){promiseReject(new Error(BUGSNAG_SDK_LOAD_TIMEOUT_ERROR(MAX_WAIT_FOR_SDK_LOAD_MS)));}else {// Try to initialize the client after a delay
|
1536
|
-
globalThis.setTimeout(initBugsnagClient,SDK_LOAD_POLL_INTERVAL_MS,state,promiseResolve,promiseReject,logger,time+SDK_LOAD_POLL_INTERVAL_MS);}};var getAppStateForMetadata=function getAppStateForMetadata(state){var stateStr=stringifyWithoutCircular(state,false,APP_STATE_EXCLUDE_KEYS);return stateStr!==null?JSON.parse(stateStr):undefined;};
|
1386
|
+
var destDisplayNamesToFileNamesMap=_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({},DISPLAY_NAME_TO_DIR_NAME_MAP$Q),DISPLAY_NAME_TO_DIR_NAME_MAP$X),DISPLAY_NAME_TO_DIR_NAME_MAP$R),DISPLAY_NAME_TO_DIR_NAME_MAP$V),DISPLAY_NAME_TO_DIR_NAME_MAP$t),DISPLAY_NAME_TO_DIR_NAME_MAP$T),DISPLAY_NAME_TO_DIR_NAME_MAP$15),DISPLAY_NAME_TO_DIR_NAME_MAP$P),DISPLAY_NAME_TO_DIR_NAME_MAP$O),DISPLAY_NAME_TO_DIR_NAME_MAP$N),DISPLAY_NAME_TO_DIR_NAME_MAP$$),DISPLAY_NAME_TO_DIR_NAME_MAP$13),DISPLAY_NAME_TO_DIR_NAME_MAP$11),DISPLAY_NAME_TO_DIR_NAME_MAP$Z),DISPLAY_NAME_TO_DIR_NAME_MAP$J),DISPLAY_NAME_TO_DIR_NAME_MAP$F),DISPLAY_NAME_TO_DIR_NAME_MAP$14),DISPLAY_NAME_TO_DIR_NAME_MAP$Y),DISPLAY_NAME_TO_DIR_NAME_MAP$u),DISPLAY_NAME_TO_DIR_NAME_MAP$W),DISPLAY_NAME_TO_DIR_NAME_MAP$G),DISPLAY_NAME_TO_DIR_NAME_MAP$18),DISPLAY_NAME_TO_DIR_NAME_MAP$E),DISPLAY_NAME_TO_DIR_NAME_MAP$I),DISPLAY_NAME_TO_DIR_NAME_MAP$17),DISPLAY_NAME_TO_DIR_NAME_MAP$B),DISPLAY_NAME_TO_DIR_NAME_MAP$M),DISPLAY_NAME_TO_DIR_NAME_MAP$12),DISPLAY_NAME_TO_DIR_NAME_MAP$16),DISPLAY_NAME_TO_DIR_NAME_MAP$D),DISPLAY_NAME_TO_DIR_NAME_MAP$19),DISPLAY_NAME_TO_DIR_NAME_MAP$K),DISPLAY_NAME_TO_DIR_NAME_MAP$x),DISPLAY_NAME_TO_DIR_NAME_MAP$_),DISPLAY_NAME_TO_DIR_NAME_MAP$S),DISPLAY_NAME_TO_DIR_NAME_MAP$10),DISPLAY_NAME_TO_DIR_NAME_MAP$H),DISPLAY_NAME_TO_DIR_NAME_MAP$z),DISPLAY_NAME_TO_DIR_NAME_MAP$A),DISPLAY_NAME_TO_DIR_NAME_MAP$w),DISPLAY_NAME_TO_DIR_NAME_MAP$y),DISPLAY_NAME_TO_DIR_NAME_MAP$v),DISPLAY_NAME_TO_DIR_NAME_MAP$C),DISPLAY_NAME_TO_DIR_NAME_MAP$U),DISPLAY_NAME_TO_DIR_NAME_MAP$L),DISPLAY_NAME_TO_DIR_NAME_MAP$s),DISPLAY_NAME_TO_DIR_NAME_MAP$r),DISPLAY_NAME_TO_DIR_NAME_MAP$q),DISPLAY_NAME_TO_DIR_NAME_MAP$p),DISPLAY_NAME_TO_DIR_NAME_MAP$o),DISPLAY_NAME_TO_DIR_NAME_MAP$n),DISPLAY_NAME_TO_DIR_NAME_MAP$m),DISPLAY_NAME_TO_DIR_NAME_MAP$l),DISPLAY_NAME_TO_DIR_NAME_MAP$k),DISPLAY_NAME_TO_DIR_NAME_MAP$j),DISPLAY_NAME_TO_DIR_NAME_MAP$i),DISPLAY_NAME_TO_DIR_NAME_MAP$h),DISPLAY_NAME_TO_DIR_NAME_MAP$g),DISPLAY_NAME_TO_DIR_NAME_MAP$f),DISPLAY_NAME_TO_DIR_NAME_MAP$e),DISPLAY_NAME_TO_DIR_NAME_MAP$d),DISPLAY_NAME_TO_DIR_NAME_MAP$c),DISPLAY_NAME_TO_DIR_NAME_MAP$b),DISPLAY_NAME_TO_DIR_NAME_MAP$a),DISPLAY_NAME_TO_DIR_NAME_MAP$9),DISPLAY_NAME_TO_DIR_NAME_MAP$8),DISPLAY_NAME_TO_DIR_NAME_MAP$7),DISPLAY_NAME_TO_DIR_NAME_MAP$6),DISPLAY_NAME_TO_DIR_NAME_MAP$5),DISPLAY_NAME_TO_DIR_NAME_MAP$4),DISPLAY_NAME_TO_DIR_NAME_MAP$3),DISPLAY_NAME_TO_DIR_NAME_MAP$2),DISPLAY_NAME_TO_DIR_NAME_MAP$1),DISPLAY_NAME_TO_DIR_NAME_MAP);
|
1537
1387
|
|
1538
|
-
var
|
1539
|
-
if(!isApiKeyValid(API_KEY)){reject(new Error(BUGSNAG_API_KEY_VALIDATION_ERROR(API_KEY)));return;}loadBugsnagSDK(externalSrcLoader,logger);initBugsnagClient(state,resolve,reject,logger);});},notify:function notify(client,error,state,logger){client===null||client===void 0?void 0:client.notify(error,{metaData:{state:getAppStateForMetadata(state)}});},breadcrumb:function breadcrumb(client,message,logger){client===null||client===void 0?void 0:client.leaveBreadcrumb(message);}}};};
|
1388
|
+
var DEFAULT_INTEGRATIONS_CONFIG={All:true};
|
1540
1389
|
|
1541
1390
|
var READY_CHECK_TIMEOUT_MS=11*1000;// 11 seconds
|
1542
1391
|
var SCRIPT_LOAD_TIMEOUT_MS=10*1000;// 10 seconds
|
1543
1392
|
var DEVICE_MODE_DESTINATIONS_PLUGIN='DeviceModeDestinationsPlugin';
|
1544
1393
|
|
1545
|
-
var isDestIntgConfigTruthy=function isDestIntgConfigTruthy(destIntgConfig){return !isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;};var isDestIntgConfigFalsy=function isDestIntgConfigFalsy(destIntgConfig){return !isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;};
|
1546
|
-
|
1547
1394
|
/**
|
1548
1395
|
* Determines if the destination SDK code is evaluated
|
1549
1396
|
* @param destSDKIdentifier The name of the global globalThis object that contains the destination SDK
|
@@ -1551,27 +1398,29 @@ var isDestIntgConfigTruthy=function isDestIntgConfigTruthy(destIntgConfig){retur
|
|
1551
1398
|
* @param logger Logger instance
|
1552
1399
|
* @returns true if the destination SDK code is evaluated, false otherwise
|
1553
1400
|
*/var isDestinationSDKMounted=function isDestinationSDKMounted(destSDKIdentifier,sdkTypeName,logger){return Boolean(globalThis[destSDKIdentifier]&&globalThis[destSDKIdentifier][sdkTypeName]&&globalThis[destSDKIdentifier][sdkTypeName].prototype&&typeof globalThis[destSDKIdentifier][sdkTypeName].prototype.constructor!=='undefined');};var createDestinationInstance=function createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state){var rAnalytics=globalThis.rudderanalytics;var analytics=rAnalytics.getAnalyticsInstance(state.lifecycle.writeKey.value);return new globalThis[destSDKIdentifier][sdkTypeName](clone$1(dest.config),{loadIntegration:state.nativeDestinations.loadIntegration.value,logLevel:state.lifecycle.logLevel.value,loadOnlyIntegrations:state.nativeDestinations.loadOnlyIntegrations.value,page:function page(category,name,properties,options,callback){return analytics.page(pageArgumentsToCallOptions(category,name,properties,options,callback));},track:function track(event,properties,options,callback){return analytics.track(trackArgumentsToCallOptions(event,properties,options,callback));},identify:function identify(userId,traits,options,callback){return analytics.identify(identifyArgumentsToCallOptions(userId,traits,options,callback));},alias:function alias(to,from,options,callback){return analytics.alias(aliasArgumentsToCallOptions(to,from,options,callback));},group:function group(groupId,traits,options,callback){return analytics.group(groupArgumentsToCallOptions(groupId,traits,options,callback));},getAnonymousId:function getAnonymousId(){return analytics.getAnonymousId();},getUserId:function getUserId(){return analytics.getUserId();},getUserTraits:function getUserTraits(){return analytics.getUserTraits();},getGroupId:function getGroupId(){return analytics.getGroupId();},getGroupTraits:function getGroupTraits(){return analytics.getGroupTraits();},getSessionId:function getSessionId(){return analytics.getSessionId();}},{shouldApplyDeviceModeTransformation:dest.shouldApplyDeviceModeTransformation,propagateEventsUntransformedOnError:dest.propagateEventsUntransformedOnError,destinationId:dest.id});};var isDestinationReady=function isDestinationReady(dest){return new Promise(function(resolve,reject){var instance=dest.instance;var handleNumber;var checkReady=function checkReady(){if(instance.isLoaded()&&(!instance.isReady||instance.isReady())){resolve(true);}else {handleNumber=globalThis.requestAnimationFrame(checkReady);}};checkReady();setTimeout(function(){globalThis.cancelAnimationFrame(handleNumber);reject(new Error(DESTINATION_READY_TIMEOUT_ERROR(READY_CHECK_TIMEOUT_MS,dest.userFriendlyId)));},READY_CHECK_TIMEOUT_MS);});};/**
|
1554
|
-
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
1555
|
-
* @param intgOpts Integration options object
|
1556
|
-
* @param destinations Destinations array
|
1557
|
-
* @returns Destinations array filtered based on the integration options
|
1558
|
-
*/var filterDestinations=function filterDestinations(intgOpts,destinations){var allOptVal=intgOpts.All;return destinations.filter(function(dest){var destDisplayName=dest.displayName;var isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};/**
|
1559
1401
|
* Extracts the integration config, if any, from the given destination
|
1560
1402
|
* and merges it with the current integrations config
|
1561
1403
|
* @param dest Destination object
|
1562
1404
|
* @param curDestIntgConfig Current destinations integration config
|
1563
1405
|
* @param logger Logger object
|
1564
1406
|
* @returns Combined destinations integrations config
|
1565
|
-
*/var getCumulativeIntegrationsConfig=function getCumulativeIntegrationsConfig(dest,curDestIntgConfig,errorHandler){var _dest$instance;var integrationsConfig=curDestIntgConfig;if(isFunction((_dest$instance=dest.instance)===null||_dest$instance===void 0?void 0:_dest$instance.getDataForIntegrationsObject)){try{var _dest$instance2;integrationsConfig=mergeDeepRight(curDestIntgConfig,
|
1566
|
-
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.initializedDestinations.value),[initializedDestination]);}).catch(function(err){
|
1567
|
-
logger===null||logger===void 0
|
1407
|
+
*/var getCumulativeIntegrationsConfig=function getCumulativeIntegrationsConfig(dest,curDestIntgConfig,errorHandler){var _dest$instance;var integrationsConfig=curDestIntgConfig;if(isFunction((_dest$instance=dest.instance)===null||_dest$instance===void 0?void 0:_dest$instance.getDataForIntegrationsObject)){try{var _dest$instance2;integrationsConfig=mergeDeepRight(curDestIntgConfig,(_dest$instance2=dest.instance)===null||_dest$instance2===void 0?void 0:_dest$instance2.getDataForIntegrationsObject());}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INTEGRATIONS_DATA_ERROR(dest.userFriendlyId));}}return integrationsConfig;};var initializeDestination=function initializeDestination(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger){try{var initializedDestination=clone$1(dest);var destInstance=createDestinationInstance(destSDKIdentifier,sdkTypeName,dest,state);initializedDestination.instance=destInstance;destInstance.init();isDestinationReady(initializedDestination).then(function(){// Collect the integrations data for the hybrid mode destinations
|
1408
|
+
if(isHybridModeDestination(initializedDestination)){state.nativeDestinations.integrationsConfig.value=getCumulativeIntegrationsConfig(initializedDestination,state.nativeDestinations.integrationsConfig.value,errorHandler);}state.nativeDestinations.initializedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.initializedDestinations.value),[initializedDestination]);}).catch(function(err){state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);// The error message is already formatted in the isDestinationReady function
|
1409
|
+
logger===null||logger===void 0||logger.error(err);});}catch(err){state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);errorHandler===null||errorHandler===void 0||errorHandler.onError(err,DEVICE_MODE_DESTINATIONS_PLUGIN,DESTINATION_INIT_ERROR(dest.userFriendlyId));}};
|
1410
|
+
|
1411
|
+
var isDestIntgConfigTruthy=function isDestIntgConfigTruthy(destIntgConfig){return !isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===true;};var isDestIntgConfigFalsy=function isDestIntgConfigFalsy(destIntgConfig){return !isUndefined(destIntgConfig)&&Boolean(destIntgConfig)===false;};/**
|
1412
|
+
* Filters the destinations that should not be loaded or forwarded events to based on the integration options (load or events API)
|
1413
|
+
* @param intgOpts Integration options object
|
1414
|
+
* @param destinations Destinations array
|
1415
|
+
* @returns Destinations array filtered based on the integration options
|
1416
|
+
*/var filterDestinations=function filterDestinations(intgOpts,destinations){var allOptVal=intgOpts.All;return destinations.filter(function(dest){var destDisplayName=dest.displayName;var isDestEnabled;if(allOptVal){isDestEnabled=true;if(isDestIntgConfigFalsy(intgOpts[destDisplayName])){isDestEnabled=false;}}else {isDestEnabled=false;if(isDestIntgConfigTruthy(intgOpts[destDisplayName])){isDestEnabled=true;}}return isDestEnabled;});};
|
1568
1417
|
|
1569
|
-
var pluginName$b='DeviceModeDestinations';var DeviceModeDestinations=function DeviceModeDestinations(){return {name:pluginName$b,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$b]);},nativeDestinations:{setActiveDestinations:function setActiveDestinations(state,pluginsManager,errorHandler,logger){
|
1570
|
-
state.nativeDestinations.loadOnlyIntegrations.value=
|
1571
|
-
var configSupportedDestinations=state.nativeDestinations.configuredDestinations.value.filter(function(configDest){if(destDisplayNamesToFileNamesMap[configDest.displayName]){return true;}errorHandler===null||errorHandler===void 0
|
1418
|
+
var pluginName$b='DeviceModeDestinations';var DeviceModeDestinations=function DeviceModeDestinations(){return {name:pluginName$b,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$b]);},nativeDestinations:{setActiveDestinations:function setActiveDestinations(state,pluginsManager,errorHandler,logger){var _clone;// Normalize the integration options from the load API call
|
1419
|
+
state.nativeDestinations.loadOnlyIntegrations.value=(_clone=clone$1(state.loadOptions.value.integrations))!==null&&_clone!==void 0?_clone:DEFAULT_INTEGRATIONS_CONFIG;state.nativeDestinations.loadIntegration.value=state.loadOptions.value.loadIntegration;// Filter destination that doesn't have mapping config-->Integration names
|
1420
|
+
var configSupportedDestinations=state.nativeDestinations.configuredDestinations.value.filter(function(configDest){if(destDisplayNamesToFileNamesMap[configDest.displayName]){return true;}errorHandler===null||errorHandler===void 0||errorHandler.onError(new Error(DESTINATION_NOT_SUPPORTED_ERROR(configDest.userFriendlyId)),DEVICE_MODE_DESTINATIONS_PLUGIN);return false;});// Filter destinations that are disabled through load options
|
1572
1421
|
var destinationsToLoad=filterDestinations(state.nativeDestinations.loadOnlyIntegrations.value,configSupportedDestinations);var consentedDestinations=destinationsToLoad.filter(function(dest){var _pluginsManager$invok;return(// if consent manager is not configured, then default to load the destination
|
1573
1422
|
(_pluginsManager$invok=pluginsManager.invokeSingle("consentManager.isDestinationConsented",state,dest.config,errorHandler,logger))!==null&&_pluginsManager$invok!==void 0?_pluginsManager$invok:true);});state.nativeDestinations.activeDestinations.value=consentedDestinations;},load:function load(state,externalSrcLoader,errorHandler,logger,externalScriptOnLoad){var integrationsCDNPath=state.lifecycle.integrationsCDNPath.value;var activeDestinations=state.nativeDestinations.activeDestinations.value;activeDestinations.forEach(function(dest){var sdkName=destDisplayNamesToFileNamesMap[dest.displayName];var destSDKIdentifier="".concat(sdkName,"_RS");// this is the name of the object loaded on the window
|
1574
|
-
var sdkTypeName=sdkName;if(!isDestinationSDKMounted(destSDKIdentifier,sdkTypeName)){var destSdkURL="".concat(integrationsCDNPath,"/").concat(sdkName,".min.js");externalSrcLoader.loadJSFile({url:destSdkURL,id:dest.userFriendlyId,callback:externalScriptOnLoad!==null&&externalScriptOnLoad!==void 0?externalScriptOnLoad:function(id){if(!id){logger===null||logger===void 0
|
1423
|
+
var sdkTypeName=sdkName;if(!isDestinationSDKMounted(destSDKIdentifier,sdkTypeName)){var destSdkURL="".concat(integrationsCDNPath,"/").concat(sdkName,".min.js");externalSrcLoader.loadJSFile({url:destSdkURL,id:dest.userFriendlyId,callback:externalScriptOnLoad!==null&&externalScriptOnLoad!==void 0?externalScriptOnLoad:function(id){if(!id){logger===null||logger===void 0||logger.error(DESTINATION_SDK_LOAD_ERROR(DEVICE_MODE_DESTINATIONS_PLUGIN,dest.userFriendlyId));state.nativeDestinations.failedDestinations.value=[].concat(_toConsumableArray(state.nativeDestinations.failedDestinations.value),[dest]);}else {initializeDestination(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger);}},timeout:SCRIPT_LOAD_TIMEOUT_MS});}else {initializeDestination(dest,state,destSDKIdentifier,sdkTypeName,errorHandler,logger);}});}}};};
|
1575
1424
|
|
1576
1425
|
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-param-reassign */var pluginName$a='DeviceModeTransformation';var DeviceModeTransformation=function DeviceModeTransformation(){return {name:pluginName$a,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$a]);},transformEvent:{enqueue:function enqueue(state,pluginsManager,event,destination,errorHandler,logger){// TODO: Implement DMT logic here
|
1577
1426
|
// TODO: for now this is a pass through
|
@@ -1676,11 +1525,42 @@ return crc.toString(36);};/**
|
|
1676
1525
|
* @return {?Object<string, string>}
|
1677
1526
|
*/var parseLinker=function parseLinker(value){var linkerObj=parseLinkerParamValue(value);if(!linkerObj){return null;}var checksum=linkerObj.checksum,serializedIds=linkerObj.serializedIds;if(!isCheckSumValid(serializedIds,checksum)){return null;}return deserialize(serializedIds);};
|
1678
1527
|
|
1679
|
-
var pluginName$7='GoogleLinker'
|
1680
|
-
|
1528
|
+
var pluginName$7='GoogleLinker';var GoogleLinker=function GoogleLinker(){return {name:pluginName$7,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$7]);},userSession:{anonymousIdGoogleLinker:function anonymousIdGoogleLinker(rudderAmpLinkerParam){if(!rudderAmpLinkerParam){return null;}var parsedAnonymousIdObj=rudderAmpLinkerParam?parseLinker(rudderAmpLinkerParam):null;return parsedAnonymousIdObj?parsedAnonymousIdObj[AMP_LINKER_ANONYMOUS_ID_KEY]:null;}}};};
|
1529
|
+
|
1530
|
+
var KETCH_CONSENT_MANAGER_PLUGIN='KetchConsentManagerPlugin';var KETCH_CONSENT_COOKIE_NAME_V1='_ketch_consent_v1_';
|
1531
|
+
|
1532
|
+
/**
|
1533
|
+
* Gets the consent data from the Ketch's consent cookie
|
1534
|
+
* @param storeManager Store manager instance
|
1535
|
+
* @param logger Logger instance
|
1536
|
+
* @returns Consent data from the consent cookie
|
1537
|
+
*/var getKetchConsentData=function getKetchConsentData(storeManager,logger){var rawConsentCookieData=null;try{// Create a data store instance to read the consent cookie
|
1538
|
+
var dataStore=storeManager===null||storeManager===void 0?void 0:storeManager.setStore({id:KETCH_CONSENT_MANAGER_PLUGIN,name:KETCH_CONSENT_MANAGER_PLUGIN,type:COOKIE_STORAGE});rawConsentCookieData=dataStore===null||dataStore===void 0?void 0:dataStore.engine.getItem(KETCH_CONSENT_COOKIE_NAME_V1);}catch(err){logger===null||logger===void 0||logger.error(KETCH_CONSENT_COOKIE_READ_ERROR(KETCH_CONSENT_MANAGER_PLUGIN),err);return undefined;}if(isNullOrUndefined(rawConsentCookieData)){return undefined;}// Decode and parse the cookie data to JSON
|
1539
|
+
var consentCookieData;try{consentCookieData=JSON.parse(fromBase64(rawConsentCookieData));}catch(err){logger===null||logger===void 0||logger.error(KETCH_CONSENT_COOKIE_PARSE_ERROR(KETCH_CONSENT_MANAGER_PLUGIN),err);return undefined;}if(!consentCookieData){return undefined;}// Convert the cookie data to consent data
|
1540
|
+
var consentPurposes={};Object.entries(consentCookieData).forEach(function(pEntry){var purposeCode=pEntry[0];var purposeValue=pEntry[1];consentPurposes[purposeCode]=(purposeValue===null||purposeValue===void 0?void 0:purposeValue.status)==='granted';});return consentPurposes;};/**
|
1541
|
+
* Gets the consent data in the format expected by the application state
|
1542
|
+
* @param ketchConsentData Consent data derived from the consent cookie
|
1543
|
+
* @returns Consent data
|
1544
|
+
*/var getConsentData=function getConsentData(ketchConsentData){var allowedConsents=[];var deniedConsentIds=[];var initialized=false;if(ketchConsentData){Object.entries(ketchConsentData).forEach(function(e){var purposeCode=e[0];var isConsented=e[1];if(isConsented){allowedConsents.push(purposeCode);}else {deniedConsentIds.push(purposeCode);}});initialized=true;}return {initialized:initialized,allowedConsents:allowedConsents,deniedConsentIds:deniedConsentIds};};var updateConsentStateFromData=function updateConsentStateFromData(state,ketchConsentData){var consentData=getConsentData(ketchConsentData);state.consents.data.value=consentData;};
|
1545
|
+
|
1546
|
+
var pluginName$6='KetchConsentManager';var KetchConsentManager=function KetchConsentManager(){return {name:pluginName$6,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$6]);},consentManager:{init:function init(state,storeManager,logger){// getKetchUserConsentedPurposes returns current ketch opted-in purposes
|
1547
|
+
// This will be helpful for debugging
|
1548
|
+
globalThis.getKetchUserConsentedPurposes=function(){var _state$consents$data$;return (_state$consents$data$=state.consents.data.value.allowedConsents)===null||_state$consents$data$===void 0?void 0:_state$consents$data$.slice();};// getKetchUserDeniedPurposes returns current ketch opted-out purposes
|
1549
|
+
// This will be helpful for debugging
|
1550
|
+
globalThis.getKetchUserDeniedPurposes=function(){var _state$consents$data$2;return (_state$consents$data$2=state.consents.data.value.deniedConsentIds)===null||_state$consents$data$2===void 0?void 0:_state$consents$data$2.slice();};// updateKetchConsent callback function to update current consent purpose state
|
1551
|
+
// this will be called from ketch rudderstack plugin
|
1552
|
+
globalThis.updateKetchConsent=function(ketchConsentData){updateConsentStateFromData(state,ketchConsentData);};// retrieve consent data and update the state
|
1553
|
+
var ketchConsentData;if(!isUndefined(globalThis.ketchConsent)){ketchConsentData=globalThis.ketchConsent;}else {ketchConsentData=getKetchConsentData(storeManager,logger);}updateConsentStateFromData(state,ketchConsentData);},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){var consentData=state.consents.data.value;if(!consentData.initialized){return true;}var allowedConsents=consentData.allowedConsents;try{var ketchConsentPurposes=destConfig.ketchConsentPurposes;// If the destination do not have this mapping events will be sent.
|
1554
|
+
if(!ketchConsentPurposes||ketchConsentPurposes.length===0){return true;}var purposes=ketchConsentPurposes.map(function(p){return p.purpose;}).filter(function(n){return n;});// Check if any of the destination's mapped ketch purposes are consented by the user in the browser.
|
1555
|
+
var containsAnyOfConsent=purposes.some(function(element){return allowedConsents.includes(element.trim());});return containsAnyOfConsent;}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,KETCH_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR);return true;}}}};};
|
1556
|
+
|
1557
|
+
var QueueStatuses={IN_PROGRESS:'inProgress',QUEUE:'queue',RECLAIM_START:'reclaimStart',RECLAIM_END:'reclaimEnd',ACK:'ack',BATCH_QUEUE:'batchQueue'};
|
1681
1558
|
|
1682
1559
|
var ScheduleModes=/*#__PURE__*/function(ScheduleModes){ScheduleModes[ScheduleModes["ASAP"]=1]="ASAP";ScheduleModes[ScheduleModes["RESCHEDULE"]=2]="RESCHEDULE";ScheduleModes[ScheduleModes["ABANDON"]=3]="ABANDON";return ScheduleModes;}({});var DEFAULT_CLOCK_LATE_FACTOR=2;var DEFAULT_CLOCK={setTimeout:function setTimeout(fn,ms){return globalThis.setTimeout(fn,ms);},clearTimeout:function clearTimeout(id){return globalThis.clearTimeout(id);},Date:globalThis.Date,clockLateFactor:DEFAULT_CLOCK_LATE_FACTOR};var Schedule=/*#__PURE__*/function(){function Schedule(){_classCallCheck(this,Schedule);_defineProperty(this,"tasks",{});_defineProperty(this,"nextId",1);_defineProperty(this,"clock",DEFAULT_CLOCK);}_createClass(Schedule,[{key:"now",value:function now(){return +new this.clock.Date();}},{key:"run",value:function run(task,timeout,mode){var id=(this.nextId+1).toString();this.tasks[id]=this.clock.setTimeout(this.handle(id,task,timeout,mode||ScheduleModes.ASAP),timeout);return id;}},{key:"handle",value:function handle(id,callback,timeout,mode){var _this=this;var start=this.now();return function(){delete _this.tasks[id];var elapsedTimeoutTime=start+timeout*(_this.clock.clockLateFactor||DEFAULT_CLOCK_LATE_FACTOR);var currentTime=_this.now();var notCompletedOrTimedOut=mode>=ScheduleModes.RESCHEDULE&&elapsedTimeoutTime<currentTime;if(notCompletedOrTimedOut){if(mode===ScheduleModes.RESCHEDULE){_this.run(callback,timeout,mode);}return undefined;}return callback();};}},{key:"cancel",value:function cancel(id){if(this.tasks[id]){this.clock.clearTimeout(this.tasks[id]);delete this.tasks[id];}}},{key:"cancelAll",value:function cancelAll(){Object.values(this.tasks).forEach(this.clock.clearTimeout);this.tasks={};}},{key:"setClock",value:function setClock(newClock){this.clock=newClock;}},{key:"resetClock",value:function resetClock(){this.clock=DEFAULT_CLOCK;}}]);return Schedule;}();
|
1683
1560
|
|
1561
|
+
var DEFAULT_MIN_RETRY_DELAY_MS=1000;var DEFAULT_MAX_RETRY_DELAY_MS=30000;var DEFAULT_BACKOFF_FACTOR=2;var DEFAULT_BACKOFF_JITTER=0;var DEFAULT_MAX_RETRY_ATTEMPTS=Infinity;var DEFAULT_MAX_ITEMS=Infinity;var DEFAULT_ACK_TIMER_MS=1000;var DEFAULT_RECLAIM_TIMER_MS=3000;var DEFAULT_RECLAIM_TIMEOUT_MS=10000;var DEFAULT_RECLAIM_WAIT_MS=500;var DEFAULT_MAX_BATCH_SIZE_BYTES=1024*1024;// 1MB
|
1562
|
+
var DEFAULT_MAX_BATCH_ITEMS=100;
|
1563
|
+
|
1684
1564
|
var sortByTime=function sortByTime(a,b){return a.time-b.time;};var RETRY_QUEUE='RetryQueue';/**
|
1685
1565
|
* Constructs a RetryQueue backed by localStorage
|
1686
1566
|
*
|
@@ -1688,10 +1568,11 @@ var sortByTime=function sortByTime(a,b){return a.time-b.time;};var RETRY_QUEUE='
|
|
1688
1568
|
* @param {String} name The name of the queue. Will be used to find abandoned queues and retry their items
|
1689
1569
|
* @param {Object} [opts] Optional argument to override `maxItems`, `maxAttempts`, `minRetryDelay, `maxRetryDelay`, `backoffFactor` and `backoffJitter`.
|
1690
1570
|
* @param {QueueProcessCallback} fn The function to call in order to process an item added to the queue
|
1691
|
-
*/var RetryQueue=/*#__PURE__*/function(){function RetryQueue(name,options,queueProcessCb,storeManager){var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:LOCAL_STORAGE;var logger=arguments.length>5?arguments[5]:undefined;_classCallCheck(this,RetryQueue);this.storeManager=storeManager;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.maxItems=options.maxItems||
|
1692
|
-
this.timeouts={
|
1693
|
-
this.store=this.storeManager.setStore({id:this.id,name:this.name,validKeys:QueueStatuses,type:storageType});this.setQueue(QueueStatuses.IN_PROGRESS,{});this.setQueue(QueueStatuses.QUEUE,[]);// bind recurring tasks for ease of use
|
1694
|
-
this.ack=this.ack.bind(this);this.checkReclaim=this.checkReclaim.bind(this);this.processHead=this.processHead.bind(this);this.scheduleTimeoutActive=false;}_createClass(RetryQueue,[{key:"
|
1571
|
+
*/var RetryQueue=/*#__PURE__*/function(){function RetryQueue(name,options,queueProcessCb,storeManager){var storageType=arguments.length>4&&arguments[4]!==undefined?arguments[4]:LOCAL_STORAGE;var logger=arguments.length>5?arguments[5]:undefined;var queueBatchItemsSizeCalculatorCb=arguments.length>6?arguments[6]:undefined;_classCallCheck(this,RetryQueue);this.storeManager=storeManager;this.name=name;this.id=generateUUID();this.processQueueCb=queueProcessCb;this.maxItems=options.maxItems||DEFAULT_MAX_ITEMS;this.maxAttempts=options.maxAttempts||DEFAULT_MAX_RETRY_ATTEMPTS;this.enableBatching=isObjectLiteralAndNotNull(options.batch);this.queueBatchItemsSizeCalculatorCb=queueBatchItemsSizeCalculatorCb;this.configureBatchingOptions(options);this.logger=logger;this.backoff={minRetryDelay:options.minRetryDelay||DEFAULT_MIN_RETRY_DELAY_MS,maxRetryDelay:options.maxRetryDelay||DEFAULT_MAX_RETRY_DELAY_MS,factor:options.backoffFactor||DEFAULT_BACKOFF_FACTOR,jitter:options.backoffJitter||DEFAULT_BACKOFF_JITTER};// painstakingly tuned. that's why they're not "easily" configurable
|
1572
|
+
this.timeouts={ackTimer:DEFAULT_ACK_TIMER_MS,reclaimTimer:DEFAULT_RECLAIM_TIMER_MS,reclaimTimeout:DEFAULT_RECLAIM_TIMEOUT_MS,reclaimWait:DEFAULT_RECLAIM_WAIT_MS};this.schedule=new Schedule();this.processId='0';// Set up our empty queues
|
1573
|
+
this.store=this.storeManager.setStore({id:this.id,name:this.name,validKeys:QueueStatuses,type:storageType});this.setQueue(QueueStatuses.IN_PROGRESS,{});this.setQueue(QueueStatuses.QUEUE,[]);this.setQueue(QueueStatuses.BATCH_QUEUE,[]);// bind recurring tasks for ease of use
|
1574
|
+
this.ack=this.ack.bind(this);this.checkReclaim=this.checkReclaim.bind(this);this.processHead=this.processHead.bind(this);this.scheduleTimeoutActive=false;}_createClass(RetryQueue,[{key:"configureBatchingOptions",value:function configureBatchingOptions(options){if(this.enableBatching){this.batch=options.batch;if(isDefined(this.batch.maxSize)){this.batch.maxSize=+this.batch.maxSize||DEFAULT_MAX_BATCH_SIZE_BYTES;}if(isDefined(this.batch.maxItems)){this.batch.maxItems=+this.batch.maxItems||DEFAULT_MAX_BATCH_ITEMS;}// if both maxSize and maxItems are undefined, disable batching
|
1575
|
+
if(isUndefined(this.batch.maxSize)&&isUndefined(this.batch.maxItems)){this.enableBatching=false;}}}},{key:"getQueue",value:function getQueue(name){return this.store.get(name!==null&&name!==void 0?name:this.name);}// TODO: fix the type of different queues to be the same if possible
|
1695
1576
|
},{key:"setQueue",value:function setQueue(name,value){this.store.set(name!==null&&name!==void 0?name:this.name,value!==null&&value!==void 0?value:[]);}/**
|
1696
1577
|
* Stops processing the queue
|
1697
1578
|
*/},{key:"stop",value:function stop(){this.schedule.cancelAll();this.scheduleTimeoutActive=false;}/**
|
@@ -1707,34 +1588,38 @@ this.ack=this.ack.bind(this);this.checkReclaim=this.checkReclaim.bind(this);this
|
|
1707
1588
|
*
|
1708
1589
|
* @param {Number} attemptNumber The attemptNumber (1 for first retry)
|
1709
1590
|
* @return {Number} The delay in milliseconds to wait before attempting a retry
|
1710
|
-
*/},{key:"getDelay",value:function getDelay(attemptNumber){var ms=this.backoff.
|
1591
|
+
*/},{key:"getDelay",value:function getDelay(attemptNumber){var ms=this.backoff.minRetryDelay*Math.pow(this.backoff.factor,attemptNumber);if(this.backoff.jitter){var rand=Math.random();var deviation=Math.floor(rand*this.backoff.jitter*ms);if(Math.floor(rand*10)<5){ms-=deviation;}else {ms+=deviation;}}return Number(Math.min(ms,this.backoff.maxRetryDelay).toPrecision(1));}},{key:"enqueue",value:function enqueue(entry){var curEntry;if(this.enableBatching){var _ref;var batchQueue=(_ref=this.getQueue(QueueStatuses.BATCH_QUEUE))!==null&&_ref!==void 0?_ref:[];batchQueue=batchQueue.slice(-batchQueue.length);batchQueue.push(entry);// if batch criteria is met, queue the batch events to the main queue and clear batch queue
|
1592
|
+
if(this.isBatchReadyToDispatch(batchQueue)){var batchItems=batchQueue.map(function(queueItem){return queueItem.item;});curEntry=this.generateQueueItem(batchItems);batchQueue=[];}this.setQueue(QueueStatuses.BATCH_QUEUE,batchQueue);}else {curEntry=entry;}// when batching is enabled, `curEntry` could be `undefined` if the batch criteria is not met
|
1593
|
+
if(curEntry){var _ref2;var queue=(_ref2=this.getQueue(QueueStatuses.QUEUE))!==null&&_ref2!==void 0?_ref2:[];queue=queue.slice(-(this.maxItems-1));queue.push(curEntry);queue=queue.sort(sortByTime);this.setQueue(QueueStatuses.QUEUE,queue);if(this.scheduleTimeoutActive){this.processHead();}}}/**
|
1711
1594
|
* Adds an item to the queue
|
1712
1595
|
*
|
1713
|
-
* @param {Object}
|
1714
|
-
*/},{key:"addItem",value:function addItem(
|
1596
|
+
* @param {Object} itemData The item to process
|
1597
|
+
*/},{key:"addItem",value:function addItem(itemData){this.enqueue(this.generateQueueItem(itemData));}},{key:"generateQueueItem",value:function generateQueueItem(itemData){return {item:itemData,attemptNumber:0,time:this.schedule.now(),id:generateUUID()};}/**
|
1715
1598
|
* Adds an item to the retry queue
|
1716
1599
|
*
|
1717
|
-
* @param {Object}
|
1600
|
+
* @param {Object} itemData The item to retry
|
1718
1601
|
* @param {Number} attemptNumber The attempt number (1 for first retry)
|
1719
1602
|
* @param {Error} [error] The error from previous attempt, if there was one
|
1720
1603
|
* @param {String} [id] The id of the queued message used for tracking duplicate entries
|
1721
|
-
*/},{key:"requeue",value:function requeue(
|
1604
|
+
*/},{key:"requeue",value:function requeue(itemData,attemptNumber,error,id){if(this.shouldRetry(itemData,attemptNumber)){this.enqueue({item:itemData,attemptNumber:attemptNumber,time:this.schedule.now()+this.getDelay(attemptNumber),id:id||generateUUID()});}}},{key:"isBatchReadyToDispatch",value:function isBatchReadyToDispatch(batchItems){var _this$batch,_this$batch3;var lengthCriteriaMet=false;if(isDefined((_this$batch=this.batch)===null||_this$batch===void 0?void 0:_this$batch.maxItems)){var _this$batch2;lengthCriteriaMet=batchItems.length>=((_this$batch2=this.batch)===null||_this$batch2===void 0?void 0:_this$batch2.maxItems);}if(lengthCriteriaMet){return true;}var sizeCriteriaMet=false;if(isDefined((_this$batch3=this.batch)===null||_this$batch3===void 0?void 0:_this$batch3.maxSize)&&isDefined(this.queueBatchItemsSizeCalculatorCb)){var _this$batch4;var curBatchSize=this.queueBatchItemsSizeCalculatorCb(batchItems.map(function(queueItem){return queueItem.item;}));sizeCriteriaMet=curBatchSize>=((_this$batch4=this.batch)===null||_this$batch4===void 0?void 0:_this$batch4.maxSize);}return sizeCriteriaMet;}},{key:"processHead",value:function processHead(){var _ref3,_ref4,_this=this,_ref6;// cancel the scheduled task if it exists
|
1722
1605
|
this.schedule.cancel(this.processId);// Pop the head off the queue
|
1723
|
-
var queue=(
|
1724
|
-
var processItemCallback=function processItemCallback(el,id){return function(err,res){var
|
1606
|
+
var queue=(_ref3=this.getQueue(QueueStatuses.QUEUE))!==null&&_ref3!==void 0?_ref3:[];var inProgress=(_ref4=this.getQueue(QueueStatuses.IN_PROGRESS))!==null&&_ref4!==void 0?_ref4:{};var now=this.schedule.now();var toRun=[];// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
1607
|
+
var processItemCallback=function processItemCallback(el,id){return function(err,res){var _ref5;var inProgress=(_ref5=_this.getQueue(QueueStatuses.IN_PROGRESS))!==null&&_ref5!==void 0?_ref5:{};delete inProgress[id];_this.setQueue(QueueStatuses.IN_PROGRESS,inProgress);if(err){_this.requeue(el.item,el.attemptNumber+1,err,el.id);}};};var enqueueItem=function enqueueItem(el,id){toRun.push({item:el.item,done:processItemCallback(el,id),attemptNumber:el.attemptNumber});};var inProgressSize=Object.keys(inProgress).length;// eslint-disable-next-line no-plusplus
|
1725
1608
|
while(queue.length>0&&queue[0].time<=now&&inProgressSize++<this.maxItems){var el=queue.shift();if(el){var id=generateUUID();// Save this to the in progress map
|
1726
1609
|
inProgress[id]={item:el.item,attemptNumber:el.attemptNumber,time:this.schedule.now()};enqueueItem(el,id);}}this.setQueue(QueueStatuses.QUEUE,queue);this.setQueue(QueueStatuses.IN_PROGRESS,inProgress);toRun.forEach(function(el){// TODO: handle processQueueCb timeout
|
1727
|
-
try{var willBeRetried=_this.shouldRetry(el.item,el.attemptNumber+1);_this.processQueueCb(el.item,el.done,el.attemptNumber,_this.maxAttempts,willBeRetried);}catch(err){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0
|
1728
|
-
queue=(
|
1729
|
-
},{key:"ack",value:function ack(){this.setQueue(QueueStatuses.ACK,this.schedule.now());this.setQueue(QueueStatuses.RECLAIM_START,null);this.setQueue(QueueStatuses.RECLAIM_END,null);this.schedule.run(this.ack,this.timeouts.
|
1730
|
-
addConcatQueue(their.queue,0);//
|
1610
|
+
try{var willBeRetried=_this.shouldRetry(el.item,el.attemptNumber+1);_this.processQueueCb(el.item,el.done,el.attemptNumber,_this.maxAttempts,willBeRetried);}catch(err){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.error(RETRY_QUEUE_PROCESS_ERROR(RETRY_QUEUE),err);}});// re-read the queue in case the process function finished immediately or added another item
|
1611
|
+
queue=(_ref6=this.getQueue(QueueStatuses.QUEUE))!==null&&_ref6!==void 0?_ref6:[];this.schedule.cancel(this.processId);if(queue.length>0){var nextProcessExecutionTime=queue[0].time-now;this.processId=this.schedule.run(this.processHead,nextProcessExecutionTime,ScheduleModes.ASAP);}}// Ack continuously to prevent other tabs from claiming our queue
|
1612
|
+
},{key:"ack",value:function ack(){this.setQueue(QueueStatuses.ACK,this.schedule.now());this.setQueue(QueueStatuses.RECLAIM_START,null);this.setQueue(QueueStatuses.RECLAIM_END,null);this.schedule.run(this.ack,this.timeouts.ackTimer,ScheduleModes.ASAP);}},{key:"reclaim",value:function reclaim(id){var _this$getQueue,_other$get,_other$get2,_other$get3,_this2=this;var other=this.storeManager.setStore({id:id,name:this.name,validKeys:QueueStatuses,type:LOCAL_STORAGE});var our={queue:(_this$getQueue=this.getQueue(QueueStatuses.QUEUE))!==null&&_this$getQueue!==void 0?_this$getQueue:[]};var their={inProgress:(_other$get=other.get(QueueStatuses.IN_PROGRESS))!==null&&_other$get!==void 0?_other$get:{},batchQueue:(_other$get2=other.get(QueueStatuses.BATCH_QUEUE))!==null&&_other$get2!==void 0?_other$get2:[],queue:(_other$get3=other.get(QueueStatuses.QUEUE))!==null&&_other$get3!==void 0?_other$get3:[]};var trackMessageIds=[];var addConcatQueue=function addConcatQueue(queue,incrementAttemptNumberBy){var concatIterator=function concatIterator(el){var id=el.id||generateUUID();if(trackMessageIds.includes(id));else {our.queue.push({item:el.item,attemptNumber:el.attemptNumber+incrementAttemptNumberBy,time:_this2.schedule.now(),id:id});trackMessageIds.push(id);}};if(Array.isArray(queue)){queue.forEach(concatIterator);}else if(queue){Object.values(queue).forEach(concatIterator);}};// add their queue to ours, resetting run-time to immediate and copying the attempt#
|
1613
|
+
addConcatQueue(their.queue,0);// Process batch queue items
|
1614
|
+
if(this.enableBatching){their.batchQueue.forEach(function(el){var id=el.id||generateUUID();if(trackMessageIds.includes(id));else {_this2.enqueue(el);trackMessageIds.push(id);}});}else {// if batching is not enabled in the current instance, add those items to the main queue directly
|
1615
|
+
addConcatQueue(their.batchQueue,0);}// if the queue is abandoned, all the in-progress are failed. retry them immediately and increment the attempt#
|
1731
1616
|
addConcatQueue(their.inProgress,1);our.queue=our.queue.sort(sortByTime);this.setQueue(QueueStatuses.QUEUE,our.queue);// remove all keys one by on next tick to avoid NS_ERROR_STORAGE_BUSY error
|
1732
|
-
try{this.clearOtherQueue(other,1);}catch(e){var isLocalStorageBusy=e.name==='NS_ERROR_STORAGE_BUSY'||e.code==='NS_ERROR_STORAGE_BUSY'||e.code===0x80630001;if(isLocalStorageBusy){try{this.clearOtherQueue(other,40);}catch(retryError){
|
1617
|
+
try{this.clearOtherQueue(other,1);}catch(e){var isLocalStorageBusy=e.name==='NS_ERROR_STORAGE_BUSY'||e.code==='NS_ERROR_STORAGE_BUSY'||e.code===0x80630001;if(isLocalStorageBusy){try{this.clearOtherQueue(other,40);}catch(retryError){var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.error(retryError);}}else {var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.error(e);}}// process the new items we claimed
|
1733
1618
|
this.processHead();}// eslint-disable-next-line class-methods-use-this
|
1734
|
-
},{key:"clearOtherQueue",value:function clearOtherQueue(other,localStorageBackoff){globalThis.setTimeout(function(){other.remove(QueueStatuses.IN_PROGRESS);globalThis.setTimeout(function(){other.remove(QueueStatuses.QUEUE);globalThis.setTimeout(function(){other.remove(QueueStatuses.RECLAIM_START);globalThis.setTimeout(function(){other.remove(QueueStatuses.RECLAIM_END);globalThis.setTimeout(function(){other.remove(QueueStatuses.ACK);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);}},{key:"checkReclaim",value:function checkReclaim(){var _this3=this;var createReclaimStartTask=function createReclaimStartTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_END)!==_this3.id){return;}if(store.get(QueueStatuses.RECLAIM_START)!==_this3.id){return;}_this3.reclaim(store.id);};};var createReclaimEndTask=function createReclaimEndTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_START)!==_this3.id){return;}store.set(QueueStatuses.RECLAIM_END,_this3.id);_this3.schedule.run(createReclaimStartTask(store),_this3.timeouts.
|
1619
|
+
},{key:"clearOtherQueue",value:function clearOtherQueue(other,localStorageBackoff){globalThis.setTimeout(function(){other.remove(QueueStatuses.BATCH_QUEUE);globalThis.setTimeout(function(){other.remove(QueueStatuses.IN_PROGRESS);globalThis.setTimeout(function(){other.remove(QueueStatuses.QUEUE);globalThis.setTimeout(function(){other.remove(QueueStatuses.RECLAIM_START);globalThis.setTimeout(function(){other.remove(QueueStatuses.RECLAIM_END);globalThis.setTimeout(function(){other.remove(QueueStatuses.ACK);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);},localStorageBackoff);}},{key:"checkReclaim",value:function checkReclaim(){var _this3=this;var createReclaimStartTask=function createReclaimStartTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_END)!==_this3.id){return;}if(store.get(QueueStatuses.RECLAIM_START)!==_this3.id){return;}_this3.reclaim(store.id);};};var createReclaimEndTask=function createReclaimEndTask(store){return function(){if(store.get(QueueStatuses.RECLAIM_START)!==_this3.id){return;}store.set(QueueStatuses.RECLAIM_END,_this3.id);_this3.schedule.run(createReclaimStartTask(store),_this3.timeouts.reclaimWait,ScheduleModes.ABANDON);};};var tryReclaim=function tryReclaim(store){store.set(QueueStatuses.RECLAIM_START,_this3.id);store.set(QueueStatuses.ACK,_this3.schedule.now());_this3.schedule.run(createReclaimEndTask(store),_this3.timeouts.reclaimWait,ScheduleModes.ABANDON);};var findOtherQueues=function findOtherQueues(name){var res=[];var storage=_this3.store.getOriginalEngine();for(var i=0;i<storage.length;i++){var k=storage.key(i);var parts=k?k.split('.'):[];if(parts.length!==3){// eslint-disable-next-line no-continue
|
1735
1620
|
continue;}if(parts[0]!==name){// eslint-disable-next-line no-continue
|
1736
1621
|
continue;}if(parts[2]!==QueueStatuses.ACK){// eslint-disable-next-line no-continue
|
1737
|
-
continue;}res.push(_this3.storeManager.setStore({id:parts[1],name:name,validKeys:QueueStatuses,type:LOCAL_STORAGE}));}return res;};findOtherQueues(this.name).forEach(function(store){if(store.id===_this3.id){return;}if(_this3.schedule.now()-store.get(QueueStatuses.ACK)<_this3.timeouts.
|
1622
|
+
continue;}res.push(_this3.storeManager.setStore({id:parts[1],name:name,validKeys:QueueStatuses,type:LOCAL_STORAGE}));}return res;};findOtherQueues(this.name).forEach(function(store){if(store.id===_this3.id){return;}if(_this3.schedule.now()-store.get(QueueStatuses.ACK)<_this3.timeouts.reclaimTimeout){return;}tryReclaim(store);});this.schedule.run(this.checkReclaim,this.timeouts.reclaimTimer,ScheduleModes.RESCHEDULE);}}]);return RetryQueue;}();
|
1738
1623
|
|
1739
1624
|
var DEFAULT_QUEUE_OPTIONS={maxItems:100};var QUEUE_NAME$1='rudder_destinations_events';var NATIVE_DESTINATION_QUEUE_PLUGIN='NativeDestinationQueuePlugin';
|
1740
1625
|
|
@@ -1742,9 +1627,9 @@ var getNormalizedQueueOptions$1=function getNormalizedQueueOptions(queueOpts){re
|
|
1742
1627
|
case'blacklistedEvents':{if(!isValidEventName(eventName)){return false;}var trimmedEventName=eventName.trim();if(Array.isArray(blacklistedEvents)){return blacklistedEvents.some(function(eventObj){return eventObj.eventName.trim()===trimmedEventName;});}return false;}// Whitelist is chosen for filtering events
|
1743
1628
|
case'whitelistedEvents':{if(!isValidEventName(eventName)){return true;}var _trimmedEventName=eventName.trim();if(Array.isArray(whitelistedEvents)){return !whitelistedEvents.some(function(eventObj){return eventObj.eventName.trim()===_trimmedEventName;});}return true;}case'disable':default:return false;}};var sendEventToDestination=function sendEventToDestination(item,dest,errorHandler,logger){var methodName=item.type.toString();try{var _dest$instance,_dest$instance$method;// Destinations expect the event to be wrapped under the `message` key
|
1744
1629
|
// This will remain until we update the destinations to accept the event directly
|
1745
|
-
(_dest$instance=dest.instance)===null||_dest$instance===void 0||(_dest$instance$method=_dest$instance[methodName])===null||_dest$instance$method===void 0
|
1630
|
+
(_dest$instance=dest.instance)===null||_dest$instance===void 0||(_dest$instance$method=_dest$instance[methodName])===null||_dest$instance$method===void 0||_dest$instance$method.call(_dest$instance,{message:item});}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,NATIVE_DESTINATION_QUEUE_PLUGIN,DESTINATION_EVENT_FORWARDING_ERROR(dest.userFriendlyId));}};
|
1746
1631
|
|
1747
|
-
var pluginName$
|
1632
|
+
var pluginName$5='NativeDestinationQueue';var NativeDestinationQueue=function NativeDestinationQueue(){return {name:pluginName$5,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$5]);},destinationsEventsQueue:{/**
|
1748
1633
|
* Initialize the queue for delivery to destinations
|
1749
1634
|
* @param state Application state
|
1750
1635
|
* @param pluginsManager PluginsManager instance
|
@@ -1753,7 +1638,7 @@ var pluginName$6='NativeDestinationQueue';var NativeDestinationQueue=function Na
|
|
1753
1638
|
* @param logger Logger instance
|
1754
1639
|
* @returns IQueue instance
|
1755
1640
|
*/init:function init(state,pluginsManager,storeManager,errorHandler,logger){var finalQOpts=getNormalizedQueueOptions$1(state.loadOptions.value.destinationsQueueOptions);var writeKey=state.lifecycle.writeKey.value;var eventsQueue=new RetryQueue(// adding write key to the queue name to avoid conflicts
|
1756
|
-
"".concat(QUEUE_NAME$1,"_").concat(writeKey),finalQOpts,function(rudderEvent,done){var destinationsToSend=filterDestinations(rudderEvent.integrations,state.nativeDestinations.initializedDestinations.value);destinationsToSend.forEach(function(dest){var clonedRudderEvent=clone$1(rudderEvent);var sendEvent=!isEventDenyListed(clonedRudderEvent.type,clonedRudderEvent.event,dest);if(!sendEvent){logger===null||logger===void 0
|
1641
|
+
"".concat(QUEUE_NAME$1,"_").concat(writeKey),finalQOpts,function(rudderEvent,done){var destinationsToSend=filterDestinations(rudderEvent.integrations,state.nativeDestinations.initializedDestinations.value);destinationsToSend.forEach(function(dest){var clonedRudderEvent=clone$1(rudderEvent);var sendEvent=!isEventDenyListed(clonedRudderEvent.type,clonedRudderEvent.event,dest);if(!sendEvent){logger===null||logger===void 0||logger.warn(DESTINATION_EVENT_FILTERING_WARNING(NATIVE_DESTINATION_QUEUE_PLUGIN,clonedRudderEvent.event,dest.userFriendlyId));return;}if(dest.shouldApplyDeviceModeTransformation){pluginsManager.invokeSingle('transformEvent.enqueue',state,clonedRudderEvent,dest,logger);}else {sendEventToDestination(clonedRudderEvent,dest,errorHandler);}});// Mark success always
|
1757
1642
|
done(null);},storeManager,MEMORY_STORAGE);// TODO: This seems to not work as expected. Need to investigate
|
1758
1643
|
// effect(() => {
|
1759
1644
|
// if (state.nativeDestinations.clientDestinationsReady.value === true) {
|
@@ -1768,7 +1653,7 @@ return eventsQueue;},/**
|
|
1768
1653
|
* @param errorHandler Error handler instance
|
1769
1654
|
* @param logger Logger instance
|
1770
1655
|
* @returns none
|
1771
|
-
*/enqueue:function enqueue(state,eventsQueue,event,errorHandler,logger){
|
1656
|
+
*/enqueue:function enqueue(state,eventsQueue,event,errorHandler,logger){eventsQueue.addItem(event);},/**
|
1772
1657
|
* This extension point is used to directly send the transformed event to the destination
|
1773
1658
|
* @param state Application state
|
1774
1659
|
* @param event RudderEvent Object
|
@@ -1779,7 +1664,7 @@ return eventsQueue;},/**
|
|
1779
1664
|
|
1780
1665
|
var ONETRUST_CONSENT_MANAGER_PLUGIN='OneTrustConsentManagerPlugin';
|
1781
1666
|
|
1782
|
-
var pluginName$
|
1667
|
+
var pluginName$4='OneTrustConsentManager';var OneTrustConsentManager=function OneTrustConsentManager(){return {name:pluginName$4,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$4]);},consentManager:{init:function init(state,storeManager,logger){if(!globalThis.OneTrust||!globalThis.OnetrustActiveGroups){logger===null||logger===void 0||logger.error(ONETRUST_ACCESS_ERROR(ONETRUST_CONSENT_MANAGER_PLUGIN));state.consents.data.value={initialized:false};return;}// OneTrustConsentManager SDK populates a data layer object OnetrustActiveGroups with
|
1783
1668
|
// the cookie categories Ids that the user has consented to.
|
1784
1669
|
// Eg: ',C0001,C0003,'
|
1785
1670
|
// We split it and save it as an array.
|
@@ -1790,34 +1675,7 @@ if(!oneTrustCookieCategories){return true;}// Change the structure of oneTrustCo
|
|
1790
1675
|
// Eg:
|
1791
1676
|
// ["Performance Cookies", "Functional Cookies"]
|
1792
1677
|
var validOneTrustCookieCategories=oneTrustCookieCategories.map(function(c){return c.oneTrustCookieCategory;}).filter(function(n){return n;});var containsAllConsent=true;// Check if all the destination's mapped cookie categories are consented by the user in the browser.
|
1793
|
-
containsAllConsent=validOneTrustCookieCategories.every(function(element){return Object.keys(allowedConsents).includes(element.trim())||Object.values(allowedConsents).includes(element.trim());});return containsAllConsent;}catch(err){errorHandler===null||errorHandler===void 0
|
1794
|
-
|
1795
|
-
var KETCH_CONSENT_MANAGER_PLUGIN='KetchConsentManagerPlugin';var KETCH_CONSENT_COOKIE_NAME_V1='_ketch_consent_v1_';
|
1796
|
-
|
1797
|
-
/**
|
1798
|
-
* Gets the consent data from the Ketch's consent cookie
|
1799
|
-
* @param storeManager Store manager instance
|
1800
|
-
* @param logger Logger instance
|
1801
|
-
* @returns Consent data from the consent cookie
|
1802
|
-
*/var getKetchConsentData=function getKetchConsentData(storeManager,logger){var rawConsentCookieData=null;try{// Create a data store instance to read the consent cookie
|
1803
|
-
var dataStore=storeManager===null||storeManager===void 0?void 0:storeManager.setStore({id:KETCH_CONSENT_MANAGER_PLUGIN,name:KETCH_CONSENT_MANAGER_PLUGIN,type:COOKIE_STORAGE});rawConsentCookieData=dataStore===null||dataStore===void 0?void 0:dataStore.engine.getItem(KETCH_CONSENT_COOKIE_NAME_V1);}catch(err){logger===null||logger===void 0?void 0:logger.error(KETCH_CONSENT_COOKIE_READ_ERROR(KETCH_CONSENT_MANAGER_PLUGIN),err);return undefined;}if(isNullOrUndefined(rawConsentCookieData)){return undefined;}// Decode and parse the cookie data to JSON
|
1804
|
-
var consentCookieData;try{consentCookieData=JSON.parse(fromBase64(rawConsentCookieData));}catch(err){logger===null||logger===void 0?void 0:logger.error(KETCH_CONSENT_COOKIE_PARSE_ERROR(KETCH_CONSENT_MANAGER_PLUGIN),err);return undefined;}if(!consentCookieData){return undefined;}// Convert the cookie data to consent data
|
1805
|
-
var consentPurposes={};Object.entries(consentCookieData).forEach(function(pEntry){var purposeCode=pEntry[0];var purposeValue=pEntry[1];consentPurposes[purposeCode]=(purposeValue===null||purposeValue===void 0?void 0:purposeValue.status)==='granted';});return consentPurposes;};/**
|
1806
|
-
* Gets the consent data in the format expected by the application state
|
1807
|
-
* @param ketchConsentData Consent data derived from the consent cookie
|
1808
|
-
* @returns Consent data
|
1809
|
-
*/var getConsentData=function getConsentData(ketchConsentData){var allowedConsents=[];var deniedConsentIds=[];var initialized=false;if(ketchConsentData){Object.entries(ketchConsentData).forEach(function(e){var purposeCode=e[0];var isConsented=e[1];if(isConsented){allowedConsents.push(purposeCode);}else {deniedConsentIds.push(purposeCode);}});initialized=true;}return {initialized:initialized,allowedConsents:allowedConsents,deniedConsentIds:deniedConsentIds};};var updateConsentStateFromData=function updateConsentStateFromData(state,ketchConsentData){var consentData=getConsentData(ketchConsentData);state.consents.data.value=consentData;};
|
1810
|
-
|
1811
|
-
var pluginName$4='KetchConsentManager';var KetchConsentManager=function KetchConsentManager(){return {name:pluginName$4,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$4]);},consentManager:{init:function init(state,storeManager,logger){// getKetchUserConsentedPurposes returns current ketch opted-in purposes
|
1812
|
-
// This will be helpful for debugging
|
1813
|
-
globalThis.getKetchUserConsentedPurposes=function(){var _state$consents$data$;return (_state$consents$data$=state.consents.data.value.allowedConsents)===null||_state$consents$data$===void 0?void 0:_state$consents$data$.slice();};// getKetchUserDeniedPurposes returns current ketch opted-out purposes
|
1814
|
-
// This will be helpful for debugging
|
1815
|
-
globalThis.getKetchUserDeniedPurposes=function(){var _state$consents$data$2;return (_state$consents$data$2=state.consents.data.value.deniedConsentIds)===null||_state$consents$data$2===void 0?void 0:_state$consents$data$2.slice();};// updateKetchConsent callback function to update current consent purpose state
|
1816
|
-
// this will be called from ketch rudderstack plugin
|
1817
|
-
globalThis.updateKetchConsent=function(ketchConsentData){updateConsentStateFromData(state,ketchConsentData);};// retrieve consent data and update the state
|
1818
|
-
var ketchConsentData;if(!isUndefined(globalThis.ketchConsent)){ketchConsentData=globalThis.ketchConsent;}else {ketchConsentData=getKetchConsentData(storeManager,logger);}updateConsentStateFromData(state,ketchConsentData);},isDestinationConsented:function isDestinationConsented(state,destConfig,errorHandler,logger){var consentData=state.consents.data.value;if(!consentData.initialized){return true;}var allowedConsents=consentData.allowedConsents;try{var ketchConsentPurposes=destConfig.ketchConsentPurposes;// If the destination do not have this mapping events will be sent.
|
1819
|
-
if(!ketchConsentPurposes||ketchConsentPurposes.length===0){return true;}var purposes=ketchConsentPurposes.map(function(p){return p.purpose;}).filter(function(n){return n;});// Check if any of the destination's mapped ketch purposes are consented by the user in the browser.
|
1820
|
-
var containsAnyOfConsent=purposes.some(function(element){return allowedConsents.includes(element.trim());});return containsAnyOfConsent;}catch(err){errorHandler===null||errorHandler===void 0?void 0:errorHandler.onError(err,KETCH_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR);return true;}}}};};
|
1678
|
+
containsAllConsent=validOneTrustCookieCategories.every(function(element){return Object.keys(allowedConsents).includes(element.trim())||Object.values(allowedConsents).includes(element.trim());});return containsAllConsent;}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,ONETRUST_CONSENT_MANAGER_PLUGIN,DESTINATION_CONSENT_STATUS_ERROR);return true;}}}};};
|
1821
1679
|
|
1822
1680
|
var ENCRYPTION_PREFIX_V3='RS_ENC_v3_';
|
1823
1681
|
|
@@ -2991,7 +2849,7 @@ var STORAGE_MIGRATOR_PLUGIN='StorageMigratorPlugin';
|
|
2991
2849
|
var pluginName$1='StorageMigrator';var StorageMigrator=function StorageMigrator(){return {name:pluginName$1,initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName$1]);},storage:{migrate:function migrate(key,storageEngine,errorHandler,logger){try{var storedVal=storageEngine.getItem(key);if(isNullOrUndefined(storedVal)){return null;}var decryptedVal=decrypt(storedVal);// The value is not encrypted using legacy encryption
|
2992
2850
|
// Try latest
|
2993
2851
|
if(decryptedVal===storedVal){decryptedVal=decrypt$1(storedVal);}if(isNullOrUndefined(decryptedVal)){return null;}// storejs that is used in localstorage engine already deserializes json strings but swallows errors
|
2994
|
-
return JSON.parse(decryptedVal);}catch(err){errorHandler===null||errorHandler===void 0
|
2852
|
+
return JSON.parse(decryptedVal);}catch(err){errorHandler===null||errorHandler===void 0||errorHandler.onError(err,STORAGE_MIGRATOR_PLUGIN,STORAGE_MIGRATION_ERROR(key));return null;}}}};};
|
2995
2853
|
|
2996
2854
|
var isErrRetryable=function isErrRetryable(details){var isRetryableNWFailure=false;if(details!==null&&details!==void 0&&details.error&&details!==null&&details!==void 0&&details.xhr){var xhrStatus=details.xhr.status;// same as in v1.1
|
2997
2855
|
isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRetryableNWFailure;};
|
@@ -2999,7 +2857,7 @@ isRetryableNWFailure=xhrStatus===429||xhrStatus>=500&&xhrStatus<600;}return isRe
|
|
2999
2857
|
var DEFAULT_RETRY_QUEUE_OPTIONS={maxRetryDelay:360000,minRetryDelay:1000,backoffFactor:2,maxAttempts:10,maxItems:100};var REQUEST_TIMEOUT_MS=10*1000;// 10 seconds
|
3000
2858
|
var DATA_PLANE_API_VERSION='v1';var QUEUE_NAME='rudder';var XHR_QUEUE_PLUGIN='XhrQueuePlugin';
|
3001
2859
|
|
3002
|
-
var getNormalizedQueueOptions=function getNormalizedQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_RETRY_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl=function getDeliveryUrl(dataplaneUrl,
|
2860
|
+
var getNormalizedQueueOptions=function getNormalizedQueueOptions(queueOpts){return mergeDeepRight(DEFAULT_RETRY_QUEUE_OPTIONS,queueOpts);};var getDeliveryUrl=function getDeliveryUrl(dataplaneUrl,endpoint){var dpUrl=new URL(dataplaneUrl);return new URL(removeDuplicateSlashes([dpUrl.pathname,'/',DATA_PLANE_API_VERSION,'/',endpoint].join('')),dpUrl).href;};var getBatchDeliveryUrl=function getBatchDeliveryUrl(dataplaneUrl){return getDeliveryUrl(dataplaneUrl,'batch');};var logErrorOnFailure=function logErrorOnFailure(details,url,willBeRetried,attemptNumber,maxRetryAttempts,logger){if(isUndefined(details===null||details===void 0?void 0:details.error)||isUndefined(logger)){return;}var isRetryableFailure=isErrRetryable(details);var errMsg=EVENT_DELIVERY_FAILURE_ERROR_PREFIX(XHR_QUEUE_PLUGIN,url);var dropMsg="The event(s) will be dropped.";if(isRetryableFailure){if(willBeRetried){errMsg="".concat(errMsg," It/they will be retried.");if(attemptNumber>0){errMsg="".concat(errMsg," Retry attempt ").concat(attemptNumber," of ").concat(maxRetryAttempts,".");}}else {errMsg="".concat(errMsg," Retries exhausted (").concat(maxRetryAttempts,"). ").concat(dropMsg);}}else {errMsg="".concat(errMsg," ").concat(dropMsg);}logger===null||logger===void 0||logger.error(errMsg);};var getRequestInfo=function getRequestInfo(itemData,state,logger){var data;var headers;var url;if(Array.isArray(itemData)){var finalEvents=itemData.map(function(queueItemData){return getFinalEventForDeliveryMutator(queueItemData.event);});data=getBatchDeliveryPayload(finalEvents,logger);headers=_objectSpread2({},itemData[0].headers);url=getBatchDeliveryUrl(state.lifecycle.activeDataplaneUrl.value);}else {var eventUrl=itemData.url,event=itemData.event,eventHeaders=itemData.headers;var finalEvent=getFinalEventForDeliveryMutator(event);data=getDeliveryPayload$1(finalEvent,logger);headers=_objectSpread2({},eventHeaders);url=eventUrl;}return {data:data,headers:headers,url:url};};
|
3003
2861
|
|
3004
2862
|
var pluginName='XhrQueue';var XhrQueue=function XhrQueue(){return {name:pluginName,deps:[],initialize:function initialize(state){state.plugins.loadedPlugins.value=[].concat(_toConsumableArray(state.plugins.loadedPlugins.value),[pluginName]);},dataplaneEventsQueue:{/**
|
3005
2863
|
* Initialize the queue for delivery
|
@@ -3010,9 +2868,8 @@ var pluginName='XhrQueue';var XhrQueue=function XhrQueue(){return {name:pluginNa
|
|
3010
2868
|
* @param logger Logger instance
|
3011
2869
|
* @returns RetryQueue instance
|
3012
2870
|
*/init:function init(state,httpClient,storeManager,errorHandler,logger){var writeKey=state.lifecycle.writeKey.value;httpClient.setAuthHeader(writeKey);var finalQOpts=getNormalizedQueueOptions(state.loadOptions.value.queueOptions);var eventsQueue=new RetryQueue(// adding write key to the queue name to avoid conflicts
|
3013
|
-
"".concat(QUEUE_NAME,"_").concat(writeKey),finalQOpts,function(
|
3014
|
-
var queueErrResp=isErrRetryable(details)?details:null;logErrorOnFailure(details,
|
3015
|
-
done(null);}},storeManager);return eventsQueue;},/**
|
2871
|
+
"".concat(QUEUE_NAME,"_").concat(writeKey),finalQOpts,function(itemData,done,attemptNumber,maxRetryAttempts,willBeRetried){var _getRequestInfo=getRequestInfo(itemData,state,logger),data=_getRequestInfo.data,url=_getRequestInfo.url,headers=_getRequestInfo.headers;httpClient.getAsyncData({url:url,options:{method:'POST',headers:headers,data:data,sendRawData:true},isRawResponse:true,timeout:REQUEST_TIMEOUT_MS,callback:function callback(result,details){// null means item will not be requeued
|
2872
|
+
var queueErrResp=isErrRetryable(details)?details:null;logErrorOnFailure(details,url,willBeRetried,attemptNumber,maxRetryAttempts,logger);done(queueErrResp,result);}});},storeManager,LOCAL_STORAGE,logger,function(itemData){var _getBatchDeliveryPayl;var events=itemData.map(function(queueItemData){return queueItemData.event;});return (_getBatchDeliveryPayl=getBatchDeliveryPayload(events,logger))===null||_getBatchDeliveryPayl===void 0?void 0:_getBatchDeliveryPayl.length;});return eventsQueue;},/**
|
3016
2873
|
* Add event to the queue for delivery
|
3017
2874
|
* @param state Application state
|
3018
2875
|
* @param eventsQueue RetryQueue instance
|
@@ -3027,10 +2884,9 @@ event.sentAt=getCurrentTimeFormatted();validateEventPayloadSize(event,logger);va
|
|
3027
2884
|
var headers={// TODO: why do we need this header value?
|
3028
2885
|
AnonymousId:toBase64(event.anonymousId)};eventsQueue.addItem({url:url,headers:headers,event:event});}}};};
|
3029
2886
|
|
3030
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
3031
2887
|
/**
|
3032
2888
|
* Map plugin names to direct code imports from plugins package
|
3033
|
-
*/var legacyBuildPluginImports=function legacyBuildPluginImports(){return {Bugsnag:Bugsnag,
|
2889
|
+
*/var legacyBuildPluginImports=function legacyBuildPluginImports(){return {BeaconQueue:BeaconQueue,Bugsnag:Bugsnag,DeviceModeDestinations:DeviceModeDestinations,DeviceModeTransformation:DeviceModeTransformation,ErrorReporting:ErrorReporting,ExternalAnonymousId:ExternalAnonymousId,GoogleLinker:GoogleLinker,KetchConsentManager:KetchConsentManager,NativeDestinationQueue:NativeDestinationQueue,OneTrustConsentManager:OneTrustConsentManager,StorageEncryption:StorageEncryption,StorageEncryptionLegacy:StorageEncryptionLegacy,StorageMigrator:StorageMigrator,XhrQueue:XhrQueue};};
|
3034
2890
|
|
3035
2891
|
/**
|
3036
2892
|
* Map of mandatory plugin names and direct imports
|
@@ -3048,7 +2904,7 @@ var PluginsManager=/*#__PURE__*/function(){function PluginsManager(engine,errorH
|
|
3048
2904
|
this.setActivePlugins();this.registerLocalPlugins();this.registerRemotePlugins();this.attachEffects();}/**
|
3049
2905
|
* Update state based on plugin loaded status
|
3050
2906
|
*/ // eslint-disable-next-line class-methods-use-this
|
3051
|
-
},{key:"attachEffects",value:function attachEffects(){
|
2907
|
+
},{key:"attachEffects",value:function attachEffects(){E(function(){var isAllPluginsReady=state.plugins.activePlugins.value.length===0||state.plugins.loadedPlugins.value.length+state.plugins.failedPlugins.value.length===state.plugins.totalPluginsToLoad.value;if(isAllPluginsReady){r(function(){state.plugins.ready.value=true;// TODO: decide what to do if a plugin fails to load for any reason.
|
3052
2908
|
// Should we stop here or should we progress?
|
3053
2909
|
state.lifecycle.status.value=LifecycleStatus.PluginsReady;});}});}/**
|
3054
2910
|
* Determine the list of plugins that should be loaded based on sourceConfig & load options
|
@@ -3056,14 +2912,14 @@ state.lifecycle.status.value=LifecycleStatus.PluginsReady;});}});}/**
|
|
3056
2912
|
},{key:"getPluginsToLoadBasedOnConfig",value:function getPluginsToLoadBasedOnConfig(){var _state$nativeDestinat;// This contains the default plugins if load option has been omitted by user
|
3057
2913
|
var pluginsToLoadFromConfig=state.plugins.pluginsToLoadFromConfig.value;if(!pluginsToLoadFromConfig){return [];}// Error reporting related plugins
|
3058
2914
|
var supportedErrReportingProviderPluginNames=Object.values(ErrorReportingProvidersToPluginNameMap);if(state.reporting.errorReportingProviderPluginName.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !(pluginName!==state.reporting.errorReportingProviderPluginName.value&&supportedErrReportingProviderPluginNames.includes(pluginName));});}else {pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !(pluginName===PluginName.ErrorReporting||supportedErrReportingProviderPluginNames.includes(pluginName));});}// dataplane events delivery plugins
|
3059
|
-
if(state.loadOptions.value.useBeacon===true&&state.capabilities.isBeaconAvailable.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!==PluginName.XhrQueue;});}else {if(state.loadOptions.value.useBeacon===true){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0
|
2915
|
+
if(state.loadOptions.value.useBeacon===true&&state.capabilities.isBeaconAvailable.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!==PluginName.XhrQueue;});}else {if(state.loadOptions.value.useBeacon===true){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(UNSUPPORTED_BEACON_API_WARNING(PLUGINS_MANAGER));}pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!==PluginName.BeaconQueue;});}// Device mode destinations related plugins
|
3060
2916
|
if(getNonCloudDestinations((_state$nativeDestinat=state.nativeDestinations.configuredDestinations.value)!==null&&_state$nativeDestinat!==void 0?_state$nativeDestinat:[]).length===0){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return ![PluginName.DeviceModeDestinations,PluginName.DeviceModeTransformation,PluginName.NativeDestinationQueue].includes(pluginName);});}// Consent Management related plugins
|
3061
2917
|
var supportedConsentManagerPlugins=Object.values(ConsentManagersToPluginNameMap);pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !(pluginName!==state.consents.activeConsentManagerPluginName.value&&supportedConsentManagerPlugins.includes(pluginName));});// Storage encryption related plugins
|
3062
2918
|
var supportedStorageEncryptionPlugins=Object.values(StorageEncryptionVersionsToPluginNameMap);pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return !(pluginName!==state.storage.encryptionPluginName.value&&supportedStorageEncryptionPlugins.includes(pluginName));});// Storage migrator related plugins
|
3063
2919
|
if(!state.storage.migrate.value){pluginsToLoadFromConfig=pluginsToLoadFromConfig.filter(function(pluginName){return pluginName!==PluginName.StorageMigrator;});}return [].concat(_toConsumableArray(Object.keys(getMandatoryPluginsMap())),_toConsumableArray(pluginsToLoadFromConfig));}/**
|
3064
2920
|
* Determine the list of plugins that should be activated
|
3065
2921
|
*/},{key:"setActivePlugins",value:function setActivePlugins(){var pluginsToLoad=this.getPluginsToLoadBasedOnConfig();// Merging available mandatory and optional plugin name list
|
3066
|
-
var availablePlugins=[].concat(_toConsumableArray(Object.keys(pluginsInventory)),_toConsumableArray(remotePluginNames));var activePlugins=[];var failedPlugins=[];pluginsToLoad.forEach(function(pluginName){if(availablePlugins.includes(pluginName)){activePlugins.push(pluginName);}else {failedPlugins.push(pluginName);}});if(failedPlugins.length>0){this.onError(new Error("Ignoring loading of unknown plugins: ".concat(failedPlugins.join(','),". Mandatory plugins: ").concat(Object.keys(getMandatoryPluginsMap()).join(','),". Load option plugins: ").concat(state.plugins.pluginsToLoadFromConfig.value.join(','))));}
|
2922
|
+
var availablePlugins=[].concat(_toConsumableArray(Object.keys(pluginsInventory)),_toConsumableArray(remotePluginNames));var activePlugins=[];var failedPlugins=[];pluginsToLoad.forEach(function(pluginName){if(availablePlugins.includes(pluginName)){activePlugins.push(pluginName);}else {failedPlugins.push(pluginName);}});if(failedPlugins.length>0){this.onError(new Error("Ignoring loading of unknown plugins: ".concat(failedPlugins.join(','),". Mandatory plugins: ").concat(Object.keys(getMandatoryPluginsMap()).join(','),". Load option plugins: ").concat(state.plugins.pluginsToLoadFromConfig.value.join(','))));}r(function(){state.plugins.totalPluginsToLoad.value=pluginsToLoad.length;state.plugins.activePlugins.value=activePlugins;state.plugins.failedPlugins.value=failedPlugins;});}/**
|
3067
2923
|
* Register plugins that are direct imports to PluginEngine
|
3068
2924
|
*/},{key:"registerLocalPlugins",value:function registerLocalPlugins(){var _this=this;Object.values(pluginsInventory).forEach(function(localPlugin){if(state.plugins.activePlugins.value.includes(localPlugin().name)){_this.register([localPlugin()]);}});}/**
|
3069
2925
|
* Register plugins that are dynamic imports to PluginEngine
|
@@ -3103,13 +2959,17 @@ xhr.timeout=timeout;Object.keys(options.headers).forEach(function(headerName){if
|
|
3103
2959
|
* Implement requests in a non-blocking way
|
3104
2960
|
*/},{key:"getAsyncData",value:function getAsyncData(config){var _this=this;var callback=config.callback,url=config.url,options=config.options,timeout=config.timeout,isRawResponse=config.isRawResponse;var isFireAndForget=!(callback&&isFunction(callback));xhrRequest(createXhrRequestOptions(url,options,this.basicAuthHeader),timeout,this.logger).then(function(data){if(!isFireAndForget){callback(isRawResponse?data.response:responseTextToJson(data.response,_this.onError),data);}}).catch(function(data){var _data$error;_this.onError((_data$error=data.error)!==null&&_data$error!==void 0?_data$error:data);if(!isFireAndForget){callback(undefined,data);}});}/**
|
3105
2961
|
* Handle errors
|
3106
|
-
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0
|
2962
|
+
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,HTTP_CLIENT);}else {throw error;}}/**
|
3107
2963
|
* Set basic authentication header (eg writekey)
|
3108
2964
|
*/},{key:"setAuthHeader",value:function setAuthHeader(value){var noBtoa=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var authVal=noBtoa?value:toBase64("".concat(value,":"));this.basicAuthHeader="Basic ".concat(authVal);}/**
|
3109
2965
|
* Clear basic authentication header
|
3110
2966
|
*/},{key:"resetAuthHeader",value:function resetAuthHeader(){this.basicAuthHeader=undefined;}}]);return HttpClient;}();var defaultHttpClient=new HttpClient(defaultErrorHandler,defaultLogger);
|
3111
2967
|
|
3112
|
-
var
|
2968
|
+
var UserSessionKeys=/*#__PURE__*/function(UserSessionKeys){UserSessionKeys["userId"]="userId";UserSessionKeys["userTraits"]="userTraits";UserSessionKeys["anonymousId"]="anonymousId";UserSessionKeys["groupId"]="groupId";UserSessionKeys["groupTraits"]="groupTraits";UserSessionKeys["initialReferrer"]="initialReferrer";UserSessionKeys["initialReferringDomain"]="initialReferringDomain";UserSessionKeys["sessionInfo"]="sessionInfo";return UserSessionKeys;}({});
|
2969
|
+
|
2970
|
+
var STORAGE_TEST_COOKIE='test_rudder_cookie';var STORAGE_TEST_LOCAL_STORAGE='test_rudder_ls';var STORAGE_TEST_SESSION_STORAGE='test_rudder_ss';var STORAGE_TEST_TOP_LEVEL_DOMAIN='__tld__';var CLIENT_DATA_STORE_COOKIE='clientDataInCookie';var CLIENT_DATA_STORE_LS='clientDataInLocalStorage';var CLIENT_DATA_STORE_MEMORY='clientDataInMemory';
|
2971
|
+
|
2972
|
+
var _storageClientDataSto;var storageClientDataStoreNameMap=(_storageClientDataSto={},_defineProperty(_storageClientDataSto,COOKIE_STORAGE,CLIENT_DATA_STORE_COOKIE),_defineProperty(_storageClientDataSto,LOCAL_STORAGE,CLIENT_DATA_STORE_LS),_defineProperty(_storageClientDataSto,MEMORY_STORAGE,CLIENT_DATA_STORE_MEMORY),_storageClientDataSto);
|
3113
2973
|
|
3114
2974
|
var detectAdBlockers=function detectAdBlockers(errorHandler,logger){// Apparently, '?view=ad' is a query param that is blocked by majority of adblockers
|
3115
2975
|
// Use source config URL here as it is very unlikely to be blocked by adblockers
|
@@ -3123,7 +2983,7 @@ state.capabilities.isAdBlocked.value=(details===null||details===void 0?void 0:de
|
|
3123
2983
|
|
3124
2984
|
var hasCrypto=function hasCrypto(){return !isNullOrUndefined(globalThis.crypto)&&isFunction(globalThis.crypto.getRandomValues);};var hasUAClientHints=function hasUAClientHints(){return !isNullOrUndefined(globalThis.navigator.userAgentData);};var hasBeacon=function hasBeacon(){return !isNullOrUndefined(globalThis.navigator.sendBeacon)&&isFunction(globalThis.navigator.sendBeacon);};var isIE11=function isIE11(){return Boolean(globalThis.navigator.userAgent.match(/Trident.*rv:11\./));};
|
3125
2985
|
|
3126
|
-
var getUserAgentClientHint=function getUserAgentClientHint(callback){var level=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'none';if(level==='none'){callback(undefined);}if(level==='default'){callback(navigator.userAgentData);}if(level==='full'){var _navigator$userAgentD;(_navigator$userAgentD=navigator.userAgentData)===null||_navigator$userAgentD===void 0
|
2986
|
+
var getUserAgentClientHint=function getUserAgentClientHint(callback){var level=arguments.length>1&&arguments[1]!==undefined?arguments[1]:'none';if(level==='none'){callback(undefined);}if(level==='default'){callback(navigator.userAgentData);}if(level==='full'){var _navigator$userAgentD;(_navigator$userAgentD=navigator.userAgentData)===null||_navigator$userAgentD===void 0||_navigator$userAgentD.getHighEntropyValues(['architecture','bitness','brands','mobile','model','platform','platformVersion','uaFullVersion','fullVersionList','wow64']).then(function(ua){callback(ua);}).catch(function(){callback();});}};
|
3127
2987
|
|
3128
2988
|
var isDatasetAvailable=function isDatasetAvailable(){var testElement=document.createElement('div');testElement.setAttribute('data-a-b','c');return testElement.dataset?testElement.dataset.aB==='c':false;};var legacyJSEngineRequiredPolyfills={URLSearchParams:function URLSearchParams(){return !globalThis.URLSearchParams;},URL:function URL(){return !isFunction(globalThis.URL);},MutationObserver:function(_MutationObserver){function MutationObserver(){return _MutationObserver.apply(this,arguments);}MutationObserver.toString=function(){return _MutationObserver.toString();};return MutationObserver;}(function(){return isUndefined(MutationObserver);}),Promise:function(_Promise){function Promise(){return _Promise.apply(this,arguments);}Promise.toString=function(){return _Promise.toString();};return Promise;}(function(){return isUndefined(Promise);}),'Number.isNaN':function NumberIsNaN(){return !Number.isNaN;},'Number.isInteger':function NumberIsInteger(){return !Number.isInteger;},'Array.from':function ArrayFrom(){return !Array.from;},'Array.prototype.find':function ArrayPrototypeFind(){return !Array.prototype.find;},'Array.prototype.includes':function ArrayPrototypeIncludes(){return !Array.prototype.includes;},'String.prototype.endsWith':function StringPrototypeEndsWith(){return !String.prototype.endsWith;},'String.prototype.startsWith':function StringPrototypeStartsWith(){return !String.prototype.startsWith;},'String.prototype.includes':function StringPrototypeIncludes(){return !String.prototype.includes;},'Object.entries':function ObjectEntries(){return !Object.entries;},'Object.values':function ObjectValues(){return !Object.values;},'Element.prototype.dataset':function ElementPrototypeDataset(){return !isDatasetAvailable();},'String.prototype.replaceAll':function StringPrototypeReplaceAll(){return !String.prototype.replaceAll;},TextEncoder:function(_TextEncoder){function TextEncoder(){return _TextEncoder.apply(this,arguments);}TextEncoder.toString=function(){return _TextEncoder.toString();};return TextEncoder;}(function(){return isUndefined(TextEncoder);}),TextDecoder:function(_TextDecoder){function TextDecoder(){return _TextDecoder.apply(this,arguments);}TextDecoder.toString=function(){return _TextDecoder.toString();};return TextDecoder;}(function(){return isUndefined(TextDecoder);}),'String.fromCodePoint':function StringFromCodePoint(){return !String.fromCodePoint;},requestAnimationFrame:function requestAnimationFrame(){return !isFunction(globalThis.requestAnimationFrame);},cancelAnimationFrame:function cancelAnimationFrame(){return !isFunction(globalThis.cancelAnimationFrame);},CustomEvent:function CustomEvent(){return !isFunction(globalThis.CustomEvent);}};var isLegacyJSEngine=function isLegacyJSEngine(){var requiredCapabilitiesList=Object.keys(legacyJSEngineRequiredPolyfills);var needsPolyfill=false;/* eslint-disable-next-line unicorn/no-for-loop */for(var i=0;i<requiredCapabilitiesList.length;i++){var isCapabilityMissing=legacyJSEngineRequiredPolyfills[requiredCapabilitiesList[i]];if(isCapabilityMissing()){needsPolyfill=true;break;}}return needsPolyfill;};
|
3129
2989
|
|
@@ -3134,24 +2994,26 @@ var matchingCodes=[22,1014];// [everything except Firefox, Firefox]
|
|
3134
2994
|
var isQuotaExceededError=matchingNames.includes(e.name)||matchingCodes.includes(e.code);return e instanceof DOMException&&isQuotaExceededError;};// TODO: also check for SecurityErrors
|
3135
2995
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage#exceptions
|
3136
2996
|
var isStorageAvailable=function isStorageAvailable(){var type=arguments.length>0&&arguments[0]!==undefined?arguments[0]:LOCAL_STORAGE;var storageInstance=arguments.length>1?arguments[1]:undefined;var logger=arguments.length>2?arguments[2]:undefined;var storage;var testData;try{switch(type){case MEMORY_STORAGE:return true;case COOKIE_STORAGE:storage=storageInstance;testData=STORAGE_TEST_COOKIE;break;case LOCAL_STORAGE:storage=storageInstance!==null&&storageInstance!==void 0?storageInstance:globalThis.localStorage;testData=STORAGE_TEST_LOCAL_STORAGE;// was STORAGE_TEST_LOCAL_STORAGE in ours and generateUUID() in segment retry one
|
3137
|
-
break;case SESSION_STORAGE:storage=storageInstance!==null&&storageInstance!==void 0?storageInstance:globalThis.sessionStorage;testData=STORAGE_TEST_SESSION_STORAGE;break;default:return false;}if(!storage){return false;}storage.setItem(testData,'true');if(storage.getItem(testData)){storage.removeItem(testData);return true;}return false;}catch(err){var msgPrefix=STORAGE_UNAVAILABILITY_ERROR_PREFIX(CAPABILITIES_MANAGER,type);var reason='unavailable';if(isStorageQuotaExceeded(err)){reason='full';}logger===null||logger===void 0
|
2997
|
+
break;case SESSION_STORAGE:storage=storageInstance!==null&&storageInstance!==void 0?storageInstance:globalThis.sessionStorage;testData=STORAGE_TEST_SESSION_STORAGE;break;default:return false;}if(!storage){return false;}storage.setItem(testData,'true');if(storage.getItem(testData)){storage.removeItem(testData);return true;}return false;}catch(err){var msgPrefix=STORAGE_UNAVAILABILITY_ERROR_PREFIX(CAPABILITIES_MANAGER,type);var reason='unavailable';if(isStorageQuotaExceeded(err)){reason='full';}logger===null||logger===void 0||logger.error("".concat(msgPrefix).concat(reason,"."),err);return false;}};
|
3138
2998
|
|
3139
2999
|
/**
|
3140
3000
|
* Encode.
|
3141
|
-
*/var encode=function encode(value){return encodeURIComponent(value);};/**
|
3001
|
+
*/var encode=function encode(value,logger){try{return encodeURIComponent(value);}catch(err){logger===null||logger===void 0||logger.error(COOKIE_DATA_ENCODING_ERROR,err);return undefined;}};/**
|
3142
3002
|
* Decode
|
3143
|
-
*/var decode=function decode(value){return decodeURIComponent(value);}
|
3003
|
+
*/var decode=function decode(value){try{return decodeURIComponent(value);}catch(err){// Do nothing as non-RS SDK cookies may not be URI encoded
|
3004
|
+
return undefined;}};/**
|
3144
3005
|
* Parse cookie `str`
|
3145
|
-
*/var parse=function parse(str){var obj={};var pairs=str.split(/\s*;\s*/);var pair;if(!pairs[0]){return obj;}
|
3006
|
+
*/var parse=function parse(str){var obj={};var pairs=str.split(/\s*;\s*/);var pair;if(!pairs[0]){return obj;}// TODO: Decode only the cookies that are needed by the SDK
|
3007
|
+
pairs.forEach(function(pairItem){pair=pairItem.split('=');var keyName=decode(pair[0]);if(keyName){obj[keyName]=decode(pair[1]);}});return obj;};/**
|
3146
3008
|
* Set cookie `name` to `value`
|
3147
|
-
*/var set=function set(name,value,optionsConfig){var options=_objectSpread2({},optionsConfig)||{};var cookieString="".concat(encode(name),"=").concat(encode(value));if(isNull(value)){options.maxage=-1;}if(options.maxage){options.expires=new Date(+new Date()+options.maxage);}if(options.path){cookieString+="; path=".concat(options.path);}if(options.domain){cookieString+="; domain=".concat(options.domain);}if(options.expires){cookieString+="; expires=".concat(options.expires.toUTCString());}if(options.samesite){cookieString+="; samesite=".concat(options.samesite);}if(options.secure){cookieString+="; secure";}globalThis.document.cookie=cookieString;};/**
|
3009
|
+
*/var set=function set(name,value,optionsConfig,logger){var options=_objectSpread2({},optionsConfig)||{};var cookieString="".concat(encode(name,logger),"=").concat(encode(value,logger));if(isNull(value)){options.maxage=-1;}if(options.maxage){options.expires=new Date(+new Date()+options.maxage);}if(options.path){cookieString+="; path=".concat(options.path);}if(options.domain){cookieString+="; domain=".concat(options.domain);}if(options.expires){cookieString+="; expires=".concat(options.expires.toUTCString());}if(options.samesite){cookieString+="; samesite=".concat(options.samesite);}if(options.secure){cookieString+="; secure";}globalThis.document.cookie=cookieString;};/**
|
3148
3010
|
* Return all cookies
|
3149
3011
|
*/var all=function all(){var cookieStringValue=globalThis.document.cookie;return parse(cookieStringValue);};/**
|
3150
3012
|
* Get cookie `name`
|
3151
3013
|
*/var get=function get(name){return all()[name];};/**
|
3152
3014
|
* Set or get cookie `name` with `value` and `options` object
|
3153
3015
|
*/ // eslint-disable-next-line func-names
|
3154
|
-
var cookie=function cookie(name,value,options){switch(arguments.length){case 3:case 2:return set(name,value,options);case 1:if(name){return get(name);}return all();default:return all();}};
|
3016
|
+
var cookie=function cookie(name,value,options,logger){switch(arguments.length){case 4:case 3:case 2:return set(name,value,options,logger);case 1:if(name){return get(name);}return all();default:return all();}};
|
3155
3017
|
|
3156
3018
|
var legacyGetHostname=function legacyGetHostname(href){var l=document.createElement('a');l.href=href;return l.hostname;};/**
|
3157
3019
|
* Levels returns all levels of the given url
|
@@ -3181,7 +3043,7 @@ var getDefaultCookieOptions=function getDefaultCookieOptions(){var topDomain=dom
|
|
3181
3043
|
/**
|
3182
3044
|
* A storage utility to persist values in cookies via Storage interface
|
3183
3045
|
*/var CookieStorage=/*#__PURE__*/function(){function CookieStorage(){var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var logger=arguments.length>1?arguments[1]:undefined;_classCallCheck(this,CookieStorage);_defineProperty(this,"isSupportAvailable",true);_defineProperty(this,"isEnabled",true);_defineProperty(this,"length",0);if(CookieStorage.globalSingleton){// eslint-disable-next-line no-constructor-return
|
3184
|
-
return CookieStorage.globalSingleton;}this.options=getDefaultCookieOptions();this.logger=logger;this.configure(options);CookieStorage.globalSingleton=this;}_createClass(CookieStorage,[{key:"configure",value:function configure(options){var _this$options;this.options=mergeDeepRight((_this$options=this.options)!==null&&_this$options!==void 0?_this$options:{},options);this.isSupportAvailable=isStorageAvailable(COOKIE_STORAGE,this,this.logger);this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable);return this.options;}},{key:"setItem",value:function setItem(key,value){cookie(key,value,this.options);this.length=Object.keys(cookie()).length;return true;}// eslint-disable-next-line class-methods-use-this
|
3046
|
+
return CookieStorage.globalSingleton;}this.options=getDefaultCookieOptions();this.logger=logger;this.configure(options);CookieStorage.globalSingleton=this;}_createClass(CookieStorage,[{key:"configure",value:function configure(options){var _this$options;this.options=mergeDeepRight((_this$options=this.options)!==null&&_this$options!==void 0?_this$options:{},options);this.isSupportAvailable=isStorageAvailable(COOKIE_STORAGE,this,this.logger);this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable);return this.options;}},{key:"setItem",value:function setItem(key,value){cookie(key,value,this.options,this.logger);this.length=Object.keys(cookie()).length;return true;}// eslint-disable-next-line class-methods-use-this
|
3185
3047
|
},{key:"getItem",value:function getItem(key){var value=cookie(key);return isUndefined(value)?null:value;}},{key:"removeItem",value:function removeItem(key){var result=this.setItem(key,null);this.length=Object.keys(cookie()).length;return result;}// eslint-disable-next-line class-methods-use-this
|
3186
3048
|
},{key:"clear",value:function clear(){// Not implemented
|
3187
3049
|
// getting a list of all cookie storage keys and remove all values
|
@@ -3239,7 +3101,7 @@ Object.keys(validKeys).forEach(function(key){var value=_this.get(validKeys[key])
|
|
3239
3101
|
_this.remove(key);});this.engine=inMemoryStorage;}/**
|
3240
3102
|
* Set value by key.
|
3241
3103
|
*/},{key:"set",value:function set(key,value){var validKey=this.createValidKey(key);if(!validKey){return;}try{// storejs that is used in localstorage engine already stringifies json
|
3242
|
-
this.engine.setItem(validKey,this.encrypt(stringifyWithoutCircular(value,false,[],this.logger)));}catch(err){if(isStorageQuotaExceeded(err)){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0
|
3104
|
+
this.engine.setItem(validKey,this.encrypt(stringifyWithoutCircular(value,false,[],this.logger)));}catch(err){if(isStorageQuotaExceeded(err)){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(STORAGE_QUOTA_EXCEEDED_WARNING("Store ".concat(this.id)));// switch to inMemory engine
|
3243
3105
|
this.swapQueueStoreToInMemoryEngine();// and save it there
|
3244
3106
|
this.set(key,value);}else {this.onError(getMutatedError(err,STORE_DATA_SAVE_ERROR(key)));}}}/**
|
3245
3107
|
* Get by Key.
|
@@ -3256,24 +3118,26 @@ return JSON.parse(str);}catch(err){this.onError(new Error("".concat(STORE_DATA_F
|
|
3256
3118
|
* Extension point to use with encryption plugins
|
3257
3119
|
*/},{key:"crypto",value:function crypto(value,mode){var noEncryption=!this.isEncrypted||!value||typeof value!=='string'||trim(value)==='';if(noEncryption){return value;}var extensionPointName="storage.".concat(mode);var formattedValue=this.pluginsManager?this.pluginsManager.invokeSingle(extensionPointName,value):value;return typeof formattedValue==='undefined'?value:formattedValue!==null&&formattedValue!==void 0?formattedValue:'';}/**
|
3258
3120
|
* Handle errors
|
3259
|
-
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0
|
3121
|
+
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,"Store ".concat(this.id));}else {throw error;}}}]);return Store;}();
|
3260
3122
|
|
3261
3123
|
/**
|
3262
3124
|
* A service to manage stores & available storage client configurations
|
3263
3125
|
*/var StoreManager=/*#__PURE__*/function(){function StoreManager(pluginsManager,errorHandler,logger){_classCallCheck(this,StoreManager);_defineProperty(this,"stores",{});_defineProperty(this,"isInitialized",false);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.hasErrorHandler=Boolean(this.errorHandler);this.pluginsManager=pluginsManager;this.onError=this.onError.bind(this);}/**
|
3264
3126
|
* Configure available storage client instances
|
3265
|
-
*/_createClass(StoreManager,[{key:"init",value:function init(){if(this.isInitialized){return;}var config={cookieOptions:{samesite:state.loadOptions.value.sameSiteCookie,secure:state.loadOptions.value.secureCookie,domain:state.loadOptions.value.setCookieDomain,enabled:true},localStorageOptions:{enabled:true},inMemoryStorageOptions:{enabled:true}};configureStorageEngines(removeUndefinedValues(config.cookieOptions),removeUndefinedValues(config.localStorageOptions),removeUndefinedValues(config.inMemoryStorageOptions));this.initClientDataStore();this.isInitialized=true;}/**
|
3127
|
+
*/_createClass(StoreManager,[{key:"init",value:function init(){var _state$storage$cookie;if(this.isInitialized){return;}var config={cookieOptions:{samesite:state.loadOptions.value.sameSiteCookie,secure:state.loadOptions.value.secureCookie,domain:state.loadOptions.value.setCookieDomain,enabled:true},localStorageOptions:{enabled:true},inMemoryStorageOptions:{enabled:true}};configureStorageEngines(removeUndefinedValues(mergeDeepRight(config.cookieOptions||{},((_state$storage$cookie=state.storage.cookie)===null||_state$storage$cookie===void 0?void 0:_state$storage$cookie.value)||{})),removeUndefinedValues(config.localStorageOptions),removeUndefinedValues(config.inMemoryStorageOptions));this.initClientDataStore();this.isInitialized=true;}/**
|
3266
3128
|
* Create store to persist data used by the SDK like session, used details etc
|
3267
|
-
*/},{key:"initClientDataStore",value:function initClientDataStore(){var
|
3268
|
-
if((_getStorageEngine2=getStorageEngine(COOKIE_STORAGE))!==null&&_getStorageEngine2!==void 0&&_getStorageEngine2.isEnabled){finalStorageType=COOKIE_STORAGE;}else if((_getStorageEngine3=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine3!==void 0&&_getStorageEngine3.isEnabled){finalStorageType=LOCAL_STORAGE;}else {finalStorageType=MEMORY_STORAGE;}break;}if(finalStorageType!==storageType){var _this$logger;(_this$logger=
|
3129
|
+
*/},{key:"initClientDataStore",value:function initClientDataStore(){var _state$loadOptions$va,_this=this,_getStorageEngine4,_getStorageEngine5;var globalStorageType=state.storage.type.value;var trulyAnonymousTracking=true;var entries=(_state$loadOptions$va=state.loadOptions.value.storage)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.entries;Object.keys(UserSessionKeys).forEach(function(sessionKey){var _entries$key,_getStorageEngine,_getStorageEngine2,_getStorageEngine3;var key=sessionKey;var storageKey=sessionKey;var providedStorageType=entries===null||entries===void 0||(_entries$key=entries[key])===null||_entries$key===void 0?void 0:_entries$key.type;var storageType=providedStorageType||globalStorageType||DEFAULT_STORAGE_TYPE;var finalStorageType=storageType;switch(storageType){case LOCAL_STORAGE:if(!((_getStorageEngine=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine!==void 0&&_getStorageEngine.isEnabled)){finalStorageType=MEMORY_STORAGE;}break;case MEMORY_STORAGE:case NO_STORAGE:break;case COOKIE_STORAGE:default:// First try setting the storage to cookie else to local storage
|
3130
|
+
if((_getStorageEngine2=getStorageEngine(COOKIE_STORAGE))!==null&&_getStorageEngine2!==void 0&&_getStorageEngine2.isEnabled){finalStorageType=COOKIE_STORAGE;}else if((_getStorageEngine3=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine3!==void 0&&_getStorageEngine3.isEnabled){finalStorageType=LOCAL_STORAGE;}else {finalStorageType=MEMORY_STORAGE;}break;}if(finalStorageType!==storageType){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.warn(STORAGE_UNAVAILABLE_WARNING(STORE_MANAGER,storageType,finalStorageType));}if(finalStorageType!==NO_STORAGE){trulyAnonymousTracking=false;}var storageState=state.storage.entries.value;state.storage.entries.value=_objectSpread2(_objectSpread2({},storageState),{},_defineProperty({},sessionKey,{type:finalStorageType,key:userSessionStorageKeys[storageKey]}));});state.storage.trulyAnonymousTracking.value=trulyAnonymousTracking;// TODO: fill in extra config values and bring them in from StoreManagerOptions if needed
|
3269
3131
|
// TODO: should we pass the keys for all in order to validate or leave free as v1.1?
|
3270
|
-
|
3132
|
+
// Initializing all the enabled store because previous user data might be in different storage
|
3133
|
+
// that needs auto migration
|
3134
|
+
var storageTypesRequiringInitialization=[MEMORY_STORAGE];if((_getStorageEngine4=getStorageEngine(LOCAL_STORAGE))!==null&&_getStorageEngine4!==void 0&&_getStorageEngine4.isEnabled){storageTypesRequiringInitialization.push(LOCAL_STORAGE);}if((_getStorageEngine5=getStorageEngine(COOKIE_STORAGE))!==null&&_getStorageEngine5!==void 0&&_getStorageEngine5.isEnabled){storageTypesRequiringInitialization.push(COOKIE_STORAGE);}storageTypesRequiringInitialization.forEach(function(storageType){_this.setStore({id:storageClientDataStoreNameMap[storageType],name:storageClientDataStoreNameMap[storageType],isEncrypted:true,noCompoundKey:true,type:storageType});});}/**
|
3271
3135
|
* Create a new store
|
3272
3136
|
*/},{key:"setStore",value:function setStore(storeConfig){var storageEngine=getStorageEngine(storeConfig.type);this.stores[storeConfig.id]=new Store(storeConfig,storageEngine,this.pluginsManager);return this.stores[storeConfig.id];}/**
|
3273
3137
|
* Retrieve a store
|
3274
3138
|
*/},{key:"getStore",value:function getStore(id){return this.stores[id];}/**
|
3275
3139
|
* Handle errors
|
3276
|
-
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0
|
3140
|
+
*/},{key:"onError",value:function onError(error){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,STORE_MANAGER);}else {throw error;}}}]);return StoreManager;}();
|
3277
3141
|
|
3278
3142
|
/**
|
3279
3143
|
* Removes trailing slash from url
|
@@ -3320,8 +3184,11 @@ var defaultOptionalPluginsList=[PluginName.Bugsnag,PluginName.DeviceModeDestinat
|
|
3320
3184
|
* @returns boolean
|
3321
3185
|
*/var isPositiveInteger=function isPositiveInteger(num){return isNumber(num)&&num>=0&&Number.isInteger(num);};
|
3322
3186
|
|
3323
|
-
var normalizeLoadOptions=function normalizeLoadOptions(loadOptionsFromState,loadOptions){var _normalizedLoadOpts$p;// TODO: Maybe add warnings for invalid values
|
3324
|
-
var normalizedLoadOpts=clone$1(loadOptions);if(!isString(normalizedLoadOpts.setCookieDomain)){delete normalizedLoadOpts.setCookieDomain;}if(!getObjectValues(CookieSameSite).includes(normalizedLoadOpts.sameSiteCookie)){delete normalizedLoadOpts.sameSiteCookie;}normalizedLoadOpts.secureCookie=normalizedLoadOpts.secureCookie===true;if(!getObjectValues(UaChTrackLevel).includes(normalizedLoadOpts.uaChTrackLevel)){delete normalizedLoadOpts.uaChTrackLevel;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.integrations)){delete normalizedLoadOpts.integrations;}normalizedLoadOpts.plugins=(_normalizedLoadOpts$p=normalizedLoadOpts.plugins)!==null&&_normalizedLoadOpts$p!==void 0?_normalizedLoadOpts$p:defaultOptionalPluginsList;normalizedLoadOpts.useGlobalIntegrationsConfigInEvents=normalizedLoadOpts.useGlobalIntegrationsConfigInEvents===true;normalizedLoadOpts.bufferDataPlaneEventsUntilReady=normalizedLoadOpts.bufferDataPlaneEventsUntilReady===true;normalizedLoadOpts.sendAdblockPage=normalizedLoadOpts.sendAdblockPage===true;if(!isObjectLiteralAndNotNull(normalizedLoadOpts.sendAdblockPageOptions)){delete normalizedLoadOpts.sendAdblockPageOptions;}if(!isDefined(normalizedLoadOpts.loadIntegration)){delete normalizedLoadOpts.loadIntegration;}else {normalizedLoadOpts.loadIntegration=normalizedLoadOpts.loadIntegration===true;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.storage)){delete normalizedLoadOpts.storage;}else {var _normalizedLoadOpts$s;normalizedLoadOpts.storage=removeUndefinedAndNullValues(normalizedLoadOpts.storage);normalizedLoadOpts.storage.migrate=((_normalizedLoadOpts$s=normalizedLoadOpts.storage)===null||_normalizedLoadOpts$s===void 0?void 0:_normalizedLoadOpts$s.migrate)===true;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.beaconQueueOptions)){delete normalizedLoadOpts.beaconQueueOptions;}else {normalizedLoadOpts.beaconQueueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.beaconQueueOptions);}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.destinationsQueueOptions)){delete normalizedLoadOpts.destinationsQueueOptions;}else {normalizedLoadOpts.destinationsQueueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.destinationsQueueOptions);}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.queueOptions)){delete normalizedLoadOpts.queueOptions;}else {normalizedLoadOpts.queueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.queueOptions);}normalizedLoadOpts.lockIntegrationsVersion=normalizedLoadOpts.lockIntegrationsVersion===true;if(!isNumber(normalizedLoadOpts.dataPlaneEventsBufferTimeout)){delete normalizedLoadOpts.dataPlaneEventsBufferTimeout;}var mergedLoadOptions=mergeDeepRight(loadOptionsFromState,normalizedLoadOpts);return mergedLoadOptions;};var getSourceConfigURL=function getSourceConfigURL(configUrl,writeKey,lockIntegrationsVersion,logger){var defSearchParams=new URLSearchParams({p:MODULE_TYPE,v:APP_VERSION,build:BUILD_TYPE,writeKey:writeKey,lockIntegrationsVersion:lockIntegrationsVersion.toString()});var origin=DEFAULT_CONFIG_BE_URL;var searchParams=defSearchParams;var pathname='/sourceConfig/';var hash=''
|
3187
|
+
var normalizeLoadOptions=function normalizeLoadOptions(loadOptionsFromState,loadOptions){var _normalizedLoadOpts$p,_normalizedLoadOpts$s2;// TODO: Maybe add warnings for invalid values
|
3188
|
+
var normalizedLoadOpts=clone$1(loadOptions);if(!isString(normalizedLoadOpts.setCookieDomain)){delete normalizedLoadOpts.setCookieDomain;}if(!getObjectValues(CookieSameSite).includes(normalizedLoadOpts.sameSiteCookie)){delete normalizedLoadOpts.sameSiteCookie;}normalizedLoadOpts.secureCookie=normalizedLoadOpts.secureCookie===true;if(!getObjectValues(UaChTrackLevel).includes(normalizedLoadOpts.uaChTrackLevel)){delete normalizedLoadOpts.uaChTrackLevel;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.integrations)){delete normalizedLoadOpts.integrations;}normalizedLoadOpts.plugins=(_normalizedLoadOpts$p=normalizedLoadOpts.plugins)!==null&&_normalizedLoadOpts$p!==void 0?_normalizedLoadOpts$p:defaultOptionalPluginsList;normalizedLoadOpts.useGlobalIntegrationsConfigInEvents=normalizedLoadOpts.useGlobalIntegrationsConfigInEvents===true;normalizedLoadOpts.bufferDataPlaneEventsUntilReady=normalizedLoadOpts.bufferDataPlaneEventsUntilReady===true;normalizedLoadOpts.sendAdblockPage=normalizedLoadOpts.sendAdblockPage===true;if(!isObjectLiteralAndNotNull(normalizedLoadOpts.sendAdblockPageOptions)){delete normalizedLoadOpts.sendAdblockPageOptions;}if(!isDefined(normalizedLoadOpts.loadIntegration)){delete normalizedLoadOpts.loadIntegration;}else {normalizedLoadOpts.loadIntegration=normalizedLoadOpts.loadIntegration===true;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.storage)){delete normalizedLoadOpts.storage;}else {var _normalizedLoadOpts$s;normalizedLoadOpts.storage=removeUndefinedAndNullValues(normalizedLoadOpts.storage);normalizedLoadOpts.storage.migrate=((_normalizedLoadOpts$s=normalizedLoadOpts.storage)===null||_normalizedLoadOpts$s===void 0?void 0:_normalizedLoadOpts$s.migrate)===true;}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.beaconQueueOptions)){delete normalizedLoadOpts.beaconQueueOptions;}else {normalizedLoadOpts.beaconQueueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.beaconQueueOptions);}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.destinationsQueueOptions)){delete normalizedLoadOpts.destinationsQueueOptions;}else {normalizedLoadOpts.destinationsQueueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.destinationsQueueOptions);}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.queueOptions)){delete normalizedLoadOpts.queueOptions;}else {normalizedLoadOpts.queueOptions=removeUndefinedAndNullValues(normalizedLoadOpts.queueOptions);}normalizedLoadOpts.lockIntegrationsVersion=normalizedLoadOpts.lockIntegrationsVersion===true;if(!isNumber(normalizedLoadOpts.dataPlaneEventsBufferTimeout)){delete normalizedLoadOpts.dataPlaneEventsBufferTimeout;}if(!isObjectLiteralAndNotNull((_normalizedLoadOpts$s2=normalizedLoadOpts.storage)===null||_normalizedLoadOpts$s2===void 0?void 0:_normalizedLoadOpts$s2.cookie)){var _normalizedLoadOpts$s3;(_normalizedLoadOpts$s3=normalizedLoadOpts.storage)===null||_normalizedLoadOpts$s3===void 0||delete _normalizedLoadOpts$s3.cookie;}else {var _normalizedLoadOpts$s4;normalizedLoadOpts.storage.cookie=removeUndefinedAndNullValues((_normalizedLoadOpts$s4=normalizedLoadOpts.storage)===null||_normalizedLoadOpts$s4===void 0?void 0:_normalizedLoadOpts$s4.cookie);}if(!isObjectLiteralAndNotNull(normalizedLoadOpts.preConsent)){delete normalizedLoadOpts.preConsent;}else {normalizedLoadOpts.preConsent=removeUndefinedAndNullValues(normalizedLoadOpts.preConsent);}var mergedLoadOptions=mergeDeepRight(loadOptionsFromState,normalizedLoadOpts);return mergedLoadOptions;};var getSourceConfigURL=function getSourceConfigURL(configUrl,writeKey,lockIntegrationsVersion,logger){var defSearchParams=new URLSearchParams({p:MODULE_TYPE,v:APP_VERSION,build:BUILD_TYPE,writeKey:writeKey,lockIntegrationsVersion:lockIntegrationsVersion.toString()});var origin=DEFAULT_CONFIG_BE_URL;var searchParams=defSearchParams;var pathname='/sourceConfig/';var hash='';// Ideally, this check is not required but URL polyfill
|
3189
|
+
// doesn't seem to throw errors for empty URLs
|
3190
|
+
// TODO: Need to improve this check to find out if the URL is valid or not
|
3191
|
+
if(configUrl){try{var configUrlInstance=new URL(configUrl);if(!removeTrailingSlashes(configUrlInstance.pathname).endsWith('/sourceConfig')){configUrlInstance.pathname="".concat(removeTrailingSlashes(configUrlInstance.pathname),"/sourceConfig/");}configUrlInstance.pathname=removeDuplicateSlashes(configUrlInstance.pathname);defSearchParams.forEach(function(value,key){if(configUrlInstance.searchParams.get(key)===null){configUrlInstance.searchParams.set(key,value);}});origin=configUrlInstance.origin;pathname=configUrlInstance.pathname;searchParams=configUrlInstance.searchParams;hash=configUrlInstance.hash;}catch(err){logger===null||logger===void 0||logger.warn(INVALID_CONFIG_URL_WARNING(CONFIG_MANAGER,configUrl));}}return "".concat(origin).concat(pathname,"?").concat(searchParams).concat(hash);};
|
3325
3192
|
|
3326
3193
|
/**
|
3327
3194
|
* A function to filter enabled destinations and map to required properties only
|
@@ -3334,7 +3201,7 @@ var DEFAULT_REGION='US';/**
|
|
3334
3201
|
* A function to get url from source config response
|
3335
3202
|
* @param {array} urls An array of objects containing urls
|
3336
3203
|
* @returns
|
3337
|
-
*/var getDefaultUrlOfRegion=function getDefaultUrlOfRegion(urls){var url;if(Array.isArray(urls)&&urls.length>0){var obj=urls.find(function(elem){return elem.default===true;});if(obj&&isValidUrl(obj.url)){return obj.url;}}return url;};var validateResidencyServerRegion=function validateResidencyServerRegion(residencyServerRegion,logger){if(residencyServerRegion&&!Object.values(ResidencyServerRegion).includes(residencyServerRegion)){logger===null||logger===void 0
|
3204
|
+
*/var getDefaultUrlOfRegion=function getDefaultUrlOfRegion(urls){var url;if(Array.isArray(urls)&&urls.length>0){var obj=urls.find(function(elem){return elem.default===true;});if(obj&&isValidUrl(obj.url)){return obj.url;}}return url;};var validateResidencyServerRegion=function validateResidencyServerRegion(residencyServerRegion,logger){if(residencyServerRegion&&!Object.values(ResidencyServerRegion).includes(residencyServerRegion)){logger===null||logger===void 0||logger.warn(UNSUPPORTED_RESIDENCY_SERVER_REGION_WARNING(CONFIG_MANAGER,residencyServerRegion,DEFAULT_REGION));return undefined;}return residencyServerRegion;};/**
|
3338
3205
|
* A function to determine the dataPlaneUrl
|
3339
3206
|
* @param {Object} dataplanes An object containing dataPlaneUrl for different region
|
3340
3207
|
* @param {String} serverUrl dataPlaneUrl provided in the load call
|
@@ -3346,21 +3213,39 @@ if(dataplanes&&Object.keys(dataplanes).length>0){var _validateResidencySer;var r
|
|
3346
3213
|
if(serverUrl){return serverUrl;}// return undefined if data plane url can not be determined
|
3347
3214
|
return undefined;};
|
3348
3215
|
|
3216
|
+
var DEFAULT_PRE_CONSENT_STORAGE_STRATEGY=StorageStrategy.None;var DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE=DeliveryType.Immediate;
|
3217
|
+
|
3349
3218
|
var isErrorReportingEnabled=function isErrorReportingEnabled(sourceConfig){var _sourceConfig$statsCo;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo=sourceConfig.statsCollection)===null||_sourceConfig$statsCo===void 0||(_sourceConfig$statsCo=_sourceConfig$statsCo.errors)===null||_sourceConfig$statsCo===void 0?void 0:_sourceConfig$statsCo.enabled)===true;};var getErrorReportingProviderNameFromConfig=function getErrorReportingProviderNameFromConfig(sourceConfig){var _sourceConfig$statsCo2;return sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo2=sourceConfig.statsCollection)===null||_sourceConfig$statsCo2===void 0||(_sourceConfig$statsCo2=_sourceConfig$statsCo2.errors)===null||_sourceConfig$statsCo2===void 0?void 0:_sourceConfig$statsCo2.provider;};var isMetricsReportingEnabled=function isMetricsReportingEnabled(sourceConfig){var _sourceConfig$statsCo3;return (sourceConfig===null||sourceConfig===void 0||(_sourceConfig$statsCo3=sourceConfig.statsCollection)===null||_sourceConfig$statsCo3===void 0||(_sourceConfig$statsCo3=_sourceConfig$statsCo3.metrics)===null||_sourceConfig$statsCo3===void 0?void 0:_sourceConfig$statsCo3.enabled)===true;};
|
3350
3219
|
|
3220
|
+
/**
|
3221
|
+
* A function to get the name of the consent manager with enabled true set in the load options
|
3222
|
+
* @param cookieConsentOptions Input provided as load option
|
3223
|
+
* @returns string|undefined
|
3224
|
+
*
|
3225
|
+
* Example input: {
|
3226
|
+
* oneTrust:{
|
3227
|
+
* enabled: true
|
3228
|
+
* }
|
3229
|
+
* }
|
3230
|
+
*
|
3231
|
+
* Output: 'oneTrust'
|
3232
|
+
*/var getUserSelectedConsentManager=function getUserSelectedConsentManager(cookieConsentOptions){if(!isNonEmptyObject(cookieConsentOptions)){return undefined;}var validCookieConsentOptions=cookieConsentOptions;return Object.keys(validCookieConsentOptions).find(function(e){return e&&validCookieConsentOptions[e].enabled===true;});};
|
3233
|
+
|
3351
3234
|
/**
|
3352
3235
|
* Determines the SDK url
|
3353
3236
|
* @returns sdkURL
|
3354
|
-
*/var getSDKUrl=function getSDKUrl(){var scripts=document.getElementsByTagName('script');var sdkURL;var scriptList=Array.prototype.slice.call(scripts);scriptList.some(function(script){var curScriptSrc=removeTrailingSlashes(script.getAttribute('src'));if(curScriptSrc){var urlMatches=curScriptSrc.match(/^.*rsa?(\.min)?\.js$/);if(urlMatches){sdkURL=curScriptSrc;return true;}}return false;})
|
3355
|
-
return sdkURL;};/**
|
3237
|
+
*/var getSDKUrl=function getSDKUrl(){var scripts=document.getElementsByTagName('script');var sdkURL;var scriptList=Array.prototype.slice.call(scripts);scriptList.some(function(script){var curScriptSrc=removeTrailingSlashes(script.getAttribute('src'));if(curScriptSrc){var urlMatches=curScriptSrc.match(/^.*rsa?(\.min)?\.js$/);if(urlMatches){sdkURL=curScriptSrc;return true;}}return false;});return sdkURL;};/**
|
3356
3238
|
* Updates the reporting state variables from the source config data
|
3357
3239
|
* @param res Source config
|
3358
3240
|
* @param logger Logger instance
|
3359
3241
|
*/var updateReportingState=function updateReportingState(res,logger){state.reporting.isErrorReportingEnabled.value=isErrorReportingEnabled(res.source.config);state.reporting.isMetricsReportingEnabled.value=isMetricsReportingEnabled(res.source.config);if(state.reporting.isErrorReportingEnabled.value){var errReportingProvider=getErrorReportingProviderNameFromConfig(res.source.config);// Get the corresponding plugin name of the selected error reporting provider from the supported error reporting providers
|
3360
3242
|
var errReportingProviderPlugin=errReportingProvider?ErrorReportingProvidersToPluginNameMap[errReportingProvider]:undefined;if(!isUndefined(errReportingProvider)&&!errReportingProviderPlugin){// set the default error reporting provider
|
3361
|
-
logger===null||logger===void 0
|
3362
|
-
logger===null||logger===void 0
|
3363
|
-
var configuredMigrationValue=
|
3243
|
+
logger===null||logger===void 0||logger.warn(UNSUPPORTED_ERROR_REPORTING_PROVIDER_WARNING(CONFIG_MANAGER,errReportingProvider,ErrorReportingProvidersToPluginNameMap,DEFAULT_ERROR_REPORTING_PROVIDER));}state.reporting.errorReportingProviderPluginName.value=errReportingProviderPlugin!==null&&errReportingProviderPlugin!==void 0?errReportingProviderPlugin:ErrorReportingProvidersToPluginNameMap[DEFAULT_ERROR_REPORTING_PROVIDER];}};var updateStorageState=function updateStorageState(logger){var _storageOptsFromLoad$;var storageOptsFromLoad=state.loadOptions.value.storage;var storageType=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.type;if(isDefined(storageType)&&!isValidStorageType(storageType)){logger===null||logger===void 0||logger.warn(STORAGE_TYPE_VALIDATION_WARNING(CONFIG_MANAGER,storageType,DEFAULT_STORAGE_TYPE));storageType=DEFAULT_STORAGE_TYPE;}var storageEncryptionVersion=storageOptsFromLoad===null||storageOptsFromLoad===void 0||(_storageOptsFromLoad$=storageOptsFromLoad.encryption)===null||_storageOptsFromLoad$===void 0?void 0:_storageOptsFromLoad$.version;var encryptionPluginName=storageEncryptionVersion&&StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];if(!isUndefined(storageEncryptionVersion)&&isUndefined(encryptionPluginName)){// set the default encryption plugin
|
3244
|
+
logger===null||logger===void 0||logger.warn(UNSUPPORTED_STORAGE_ENCRYPTION_VERSION_WARNING(CONFIG_MANAGER,storageEncryptionVersion,StorageEncryptionVersionsToPluginNameMap,DEFAULT_STORAGE_ENCRYPTION_VERSION));storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}else if(isUndefined(storageEncryptionVersion)){storageEncryptionVersion=DEFAULT_STORAGE_ENCRYPTION_VERSION;}// Allow migration only if the configured encryption version is the default encryption version
|
3245
|
+
var configuredMigrationValue=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.migrate;var finalMigrationVal=configuredMigrationValue&&storageEncryptionVersion===DEFAULT_STORAGE_ENCRYPTION_VERSION;if(configuredMigrationValue===true&&state.storage.migrate.value!==configuredMigrationValue){logger===null||logger===void 0||logger.warn(STORAGE_DATA_MIGRATION_OVERRIDE_WARNING(CONFIG_MANAGER,storageEncryptionVersion,DEFAULT_STORAGE_ENCRYPTION_VERSION));}r(function(){state.storage.type.value=storageType;state.storage.cookie.value=storageOptsFromLoad===null||storageOptsFromLoad===void 0?void 0:storageOptsFromLoad.cookie;state.storage.encryptionPluginName.value=StorageEncryptionVersionsToPluginNameMap[storageEncryptionVersion];state.storage.migrate.value=finalMigrationVal;});};var updateConsentsState=function updateConsentsState(logger){var _preConsentOpts$stora,_preConsentOpts$stora2,_preConsentOpts$event,_preConsentOpts$event2;// Get the consent manager if provided as load option
|
3246
|
+
var selectedConsentManager=getUserSelectedConsentManager(state.loadOptions.value.cookieConsentManager);var consentManagerPluginName;if(selectedConsentManager){// Get the corresponding plugin name of the selected consent manager from the supported consent managers
|
3247
|
+
consentManagerPluginName=ConsentManagersToPluginNameMap[selectedConsentManager];if(!consentManagerPluginName){logger===null||logger===void 0||logger.error(UNSUPPORTED_CONSENT_MANAGER_ERROR(CONFIG_MANAGER,selectedConsentManager,ConsentManagersToPluginNameMap));}}// Pre-consent
|
3248
|
+
var preConsentOpts=state.loadOptions.value.preConsent;var storageStrategy=(_preConsentOpts$stora=preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$stora2=preConsentOpts.storage)===null||_preConsentOpts$stora2===void 0?void 0:_preConsentOpts$stora2.strategy)!==null&&_preConsentOpts$stora!==void 0?_preConsentOpts$stora:DEFAULT_PRE_CONSENT_STORAGE_STRATEGY;if(isDefined(storageStrategy)&&!Object.values(StorageStrategy).includes(storageStrategy)){var _preConsentOpts$stora3;storageStrategy=DEFAULT_PRE_CONSENT_STORAGE_STRATEGY;logger===null||logger===void 0||logger.warn(UNSUPPORTED_PRE_CONSENT_STORAGE_STRATEGY(CONFIG_MANAGER,preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$stora3=preConsentOpts.storage)===null||_preConsentOpts$stora3===void 0?void 0:_preConsentOpts$stora3.strategy,DEFAULT_PRE_CONSENT_STORAGE_STRATEGY));}var eventsDeliveryType=(_preConsentOpts$event=preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$event2=preConsentOpts.events)===null||_preConsentOpts$event2===void 0?void 0:_preConsentOpts$event2.delivery)!==null&&_preConsentOpts$event!==void 0?_preConsentOpts$event:DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE;if(isDefined(eventsDeliveryType)&&!Object.values(DeliveryType).includes(eventsDeliveryType)){var _preConsentOpts$event3;eventsDeliveryType=DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE;logger===null||logger===void 0||logger.warn(UNSUPPORTED_PRE_CONSENT_EVENTS_DELIVERY_TYPE(CONFIG_MANAGER,preConsentOpts===null||preConsentOpts===void 0||(_preConsentOpts$event3=preConsentOpts.events)===null||_preConsentOpts$event3===void 0?void 0:_preConsentOpts$event3.delivery,DEFAULT_PRE_CONSENT_EVENTS_DELIVERY_TYPE));}r(function(){var _state$loadOptions$va,_state$loadOptions$va2;state.consents.activeConsentManagerPluginName.value=consentManagerPluginName;state.consents.preConsentOptions.value={enabled:((_state$loadOptions$va=state.loadOptions.value.preConsent)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.enabled)===true,storage:{strategy:storageStrategy},events:{delivery:eventsDeliveryType},trackConsent:((_state$loadOptions$va2=state.loadOptions.value.preConsent)===null||_state$loadOptions$va2===void 0?void 0:_state$loadOptions$va2.trackConsent)===true};});};
|
3364
3249
|
|
3365
3250
|
/**
|
3366
3251
|
* A function that determines integration SDK loading path
|
@@ -3379,51 +3264,33 @@ if(lockIntegrationsVersion){integrationsCDNPath=integrationsCDNPath.replace(CDN_
|
|
3379
3264
|
if(customPluginsCDNPath){pluginsCDNPath=removeTrailingSlashes(customPluginsCDNPath);if(!pluginsCDNPath||pluginsCDNPath&&!isValidUrl(pluginsCDNPath)){throw new Error(PLUGINS_CDN_BASE_URL_ERROR);}return pluginsCDNPath;}// Get the base path from the SDK script tag src attribute or use the default path
|
3380
3265
|
var sdkURL=getSDKUrl();pluginsCDNPath=sdkURL&&isString(sdkURL)?sdkURL.split('/').slice(0,-1).concat(CDN_PLUGINS_DIR).join('/'):PLUGINS_BASE_URL;return pluginsCDNPath;};
|
3381
3266
|
|
3382
|
-
/**
|
3383
|
-
* A function to get the name of the consent manager with enabled true set in the load options
|
3384
|
-
* @param cookieConsentOptions Input provided as load option
|
3385
|
-
* @returns string|undefined
|
3386
|
-
*
|
3387
|
-
* Example input: {
|
3388
|
-
* oneTrust:{
|
3389
|
-
* enabled: true
|
3390
|
-
* }
|
3391
|
-
* }
|
3392
|
-
*
|
3393
|
-
* Output: 'oneTrust'
|
3394
|
-
*/var getUserSelectedConsentManager=function getUserSelectedConsentManager(cookieConsentOptions){if(!isNonEmptyObject(cookieConsentOptions)){return undefined;}var validCookieConsentOptions=cookieConsentOptions;return Object.keys(validCookieConsentOptions).find(function(e){return e&&validCookieConsentOptions[e].enabled===true;});};
|
3395
|
-
|
3396
|
-
var ConfigManager=/*#__PURE__*/function(){function ConfigManager(httpClient,errorHandler,logger){_classCallCheck(this,ConfigManager);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.httpClient=httpClient;this.hasErrorHandler=Boolean(this.errorHandler);this.onError=this.onError.bind(this);this.processConfig=this.processConfig.bind(this);}_createClass(ConfigManager,[{key:"attachEffects",value:function attachEffects(){var _this=this;b(function(){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0?void 0:_this$logger.setMinLogLevel(state.lifecycle.logLevel.value);});}/**
|
3267
|
+
var ConfigManager=/*#__PURE__*/function(){function ConfigManager(httpClient,errorHandler,logger){_classCallCheck(this,ConfigManager);_defineProperty(this,"hasErrorHandler",false);this.errorHandler=errorHandler;this.logger=logger;this.httpClient=httpClient;this.hasErrorHandler=Boolean(this.errorHandler);this.onError=this.onError.bind(this);this.processConfig=this.processConfig.bind(this);}_createClass(ConfigManager,[{key:"attachEffects",value:function attachEffects(){var _this=this;E(function(){var _this$logger;(_this$logger=_this.logger)===null||_this$logger===void 0||_this$logger.setMinLogLevel(state.lifecycle.logLevel.value);});}/**
|
3397
3268
|
* A function to validate, construct and store loadOption, lifecycle, source and destination
|
3398
3269
|
* config related information in global state
|
3399
|
-
*/},{key:"init",value:function init(){var _this2=this;
|
3270
|
+
*/},{key:"init",value:function init(){var _this2=this;this.attachEffects();var lockIntegrationsVersion=state.loadOptions.value.lockIntegrationsVersion;validateLoadArgs(state.lifecycle.writeKey.value,state.lifecycle.dataPlaneUrl.value);// determine the path to fetch integration SDK from
|
3400
3271
|
var intgCdnUrl=getIntegrationsCDNPath(APP_VERSION,lockIntegrationsVersion,state.loadOptions.value.destSDKBaseURL);// determine the path to fetch remote plugins from
|
3401
|
-
var pluginsCDNPath=getPluginsCDNPath(state.loadOptions.value.pluginsSDKBaseURL);//
|
3402
|
-
|
3403
|
-
consentManagerPluginName=ConsentManagersToPluginNameMap[selectedConsentManager];if(!consentManagerPluginName){var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0?void 0:_this$logger2.error(UNSUPPORTED_CONSENT_MANAGER_ERROR(CONFIG_MANAGER,selectedConsentManager,ConsentManagersToPluginNameMap));}}updateStorageState(this.logger);// set application lifecycle state in global state
|
3404
|
-
o(function(){var _state$loadOptions$va;state.lifecycle.integrationsCDNPath.value=intgCdnUrl;state.lifecycle.pluginsCDNPath.value=pluginsCDNPath;if(state.loadOptions.value.logLevel){state.lifecycle.logLevel.value=state.loadOptions.value.logLevel;}if(state.loadOptions.value.configUrl){state.lifecycle.sourceConfigUrl.value=getSourceConfigURL(state.loadOptions.value.configUrl,state.lifecycle.writeKey.value,lockIntegrationsVersion,_this2.logger);}// Set consent manager plugin name in state
|
3405
|
-
state.consents.activeConsentManagerPluginName.value=consentManagerPluginName;// set storage type in state
|
3406
|
-
var storageType=(_state$loadOptions$va=state.loadOptions.value.storage)===null||_state$loadOptions$va===void 0?void 0:_state$loadOptions$va.type;if(!isValidStorageType(storageType)){var _this2$logger;(_this2$logger=_this2.logger)===null||_this2$logger===void 0?void 0:_this2$logger.warn(STORAGE_TYPE_VALIDATION_WARNING(CONFIG_MANAGER,storageType,DEFAULT_STORAGE_TYPE));state.storage.type.value=DEFAULT_STORAGE_TYPE;}else {state.storage.type.value=storageType;}});this.getConfig();}/**
|
3272
|
+
var pluginsCDNPath=getPluginsCDNPath(state.loadOptions.value.pluginsSDKBaseURL);updateStorageState(this.logger);updateConsentsState(this.logger);// set application lifecycle state in global state
|
3273
|
+
r(function(){state.lifecycle.integrationsCDNPath.value=intgCdnUrl;state.lifecycle.pluginsCDNPath.value=pluginsCDNPath;if(state.loadOptions.value.logLevel){state.lifecycle.logLevel.value=state.loadOptions.value.logLevel;}state.lifecycle.sourceConfigUrl.value=getSourceConfigURL(state.loadOptions.value.configUrl,state.lifecycle.writeKey.value,lockIntegrationsVersion,_this2.logger);});this.getConfig();}/**
|
3407
3274
|
* Handle errors
|
3408
|
-
*/},{key:"onError",value:function onError(error,customMessage,shouldAlwaysThrow){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0
|
3275
|
+
*/},{key:"onError",value:function onError(error,customMessage,shouldAlwaysThrow){if(this.hasErrorHandler){var _this$errorHandler;(_this$errorHandler=this.errorHandler)===null||_this$errorHandler===void 0||_this$errorHandler.onError(error,CONFIG_MANAGER,customMessage,shouldAlwaysThrow);}else {throw error;}}/**
|
3409
3276
|
* A callback function that is executed once we fetch the source config response.
|
3410
3277
|
* Use to construct and store information that are dependent on the sourceConfig.
|
3411
|
-
*/},{key:"processConfig",value:function processConfig(response,details){
|
3278
|
+
*/},{key:"processConfig",value:function processConfig(response,details){// TODO: add retry logic with backoff based on rejectionDetails.xhr.status
|
3412
3279
|
// We can use isErrRetryable utility method
|
3413
|
-
if(!response){this.onError(SOURCE_CONFIG_FETCH_ERROR(details===null||details===void 0?void 0:details.error));return;}var res;var errMessage='Unable to process/parse source config';try{if(isString(response)){res=JSON.parse(response);}else {res=response;}}catch(e){this.onError(e,errMessage,true);return;}if(!isValidSourceConfig(res)){this.onError(new Error(errMessage),undefined,true);return;}//
|
3280
|
+
if(!response){this.onError(SOURCE_CONFIG_FETCH_ERROR(details===null||details===void 0?void 0:details.error));return;}var res;var errMessage='Unable to process/parse source config';try{if(isString(response)){res=JSON.parse(response);}else {res=response;}}catch(e){this.onError(e,errMessage,true);return;}if(!isValidSourceConfig(res)){this.onError(new Error(errMessage),undefined,true);return;}// set the values in state for reporting slice
|
3281
|
+
updateReportingState(res,this.logger);// determine the dataPlane url
|
3414
3282
|
var dataPlaneUrl=resolveDataPlaneUrl(res.source.dataplanes,state.lifecycle.dataPlaneUrl.value,state.loadOptions.value.residencyServer,this.logger);if(!dataPlaneUrl){this.onError(new Error(DATA_PLANE_URL_ERROR),undefined,true);return;}var nativeDestinations=res.source.destinations.length>0?filterEnabledDestination(res.source.destinations):[];// set in the state --> source, destination, lifecycle, reporting
|
3415
|
-
|
3283
|
+
r(function(){var _state$loadOptions$va;// set source related information in state
|
3416
3284
|
state.source.value={config:res.source.config,id:res.source.id};// set device mode destination related information in state
|
3417
|
-
state.nativeDestinations.configuredDestinations.value=nativeDestinations;// set the
|
3418
|
-
|
3419
|
-
state.plugins.pluginsToLoadFromConfig.value=(_state$loadOptions$va2=state.loadOptions.value.plugins)!==null&&_state$loadOptions$va2!==void 0?_state$loadOptions$va2:[];// set application lifecycle state
|
3285
|
+
state.nativeDestinations.configuredDestinations.value=nativeDestinations;// set the desired optional plugins
|
3286
|
+
state.plugins.pluginsToLoadFromConfig.value=(_state$loadOptions$va=state.loadOptions.value.plugins)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:[];// set application lifecycle state
|
3420
3287
|
// Cast to string as we are sure that the value is not undefined
|
3421
3288
|
state.lifecycle.activeDataplaneUrl.value=removeTrailingSlashes(dataPlaneUrl);state.lifecycle.status.value=LifecycleStatus.Configured;});}/**
|
3422
3289
|
* A function to fetch source config either from /sourceConfig endpoint
|
3423
3290
|
* or from getSourceConfig load option
|
3424
3291
|
* @returns
|
3425
|
-
*/},{key:"getConfig",value:function getConfig(){var
|
3426
|
-
var res=sourceConfigFunc();if(res instanceof Promise){res.then(function(pRes){return
|
3292
|
+
*/},{key:"getConfig",value:function getConfig(){var _this3=this;var sourceConfigFunc=state.loadOptions.value.getSourceConfig;if(sourceConfigFunc){if(!isFunction(sourceConfigFunc)){throw new Error(SOURCE_CONFIG_OPTION_ERROR);}// fetch source config from the function
|
3293
|
+
var res=sourceConfigFunc();if(res instanceof Promise){res.then(function(pRes){return _this3.processConfig(pRes);}).catch(function(err){_this3.onError(err,'SourceConfig');});}else {this.processConfig(res);}}else {// fetch source config from config url API
|
3427
3294
|
this.httpClient.getAsyncData({url:state.lifecycle.sourceConfigUrl.value,options:{headers:{'Content-Type':undefined}},callback:this.processConfig});}}}]);return ConfigManager;}();
|
3428
3295
|
|
3429
3296
|
/**
|
@@ -3450,19 +3317,18 @@ var POLYFILL_SCRIPT_ID='rudderstackPolyfill';
|
|
3450
3317
|
var CapabilitiesManager=/*#__PURE__*/function(){function CapabilitiesManager(errorHandler,logger){_classCallCheck(this,CapabilitiesManager);this.logger=logger;this.errorHandler=errorHandler;this.externalSrcLoader=new ExternalSrcLoader(this.errorHandler,this.logger);this.onError=this.onError.bind(this);this.onReady=this.onReady.bind(this);}_createClass(CapabilitiesManager,[{key:"init",value:function init(){try{this.prepareBrowserCapabilities();this.attachWindowListeners();}catch(err){this.onError(err);}}/**
|
3451
3318
|
* Detect supported capabilities and set values in state
|
3452
3319
|
*/ // eslint-disable-next-line class-methods-use-this
|
3453
|
-
},{key:"detectBrowserCapabilities",value:function detectBrowserCapabilities(){var _this=this;
|
3320
|
+
},{key:"detectBrowserCapabilities",value:function detectBrowserCapabilities(){var _this=this;r(function(){// Storage related details
|
3454
3321
|
state.capabilities.storage.isCookieStorageAvailable.value=isStorageAvailable(COOKIE_STORAGE,getStorageEngine(COOKIE_STORAGE),_this.logger);state.capabilities.storage.isLocalStorageAvailable.value=isStorageAvailable(LOCAL_STORAGE,undefined,_this.logger);state.capabilities.storage.isSessionStorageAvailable.value=isStorageAvailable(SESSION_STORAGE,undefined,_this.logger);// Browser feature detection details
|
3455
3322
|
state.capabilities.isBeaconAvailable.value=hasBeacon();state.capabilities.isUaCHAvailable.value=hasUAClientHints();state.capabilities.isCryptoAvailable.value=hasCrypto();state.capabilities.isIE11.value=isIE11();state.capabilities.isOnline.value=globalThis.navigator.onLine;// Get page context details
|
3456
3323
|
state.context.userAgent.value=getUserAgent();state.context.locale.value=getLanguage();state.context.screen.value=getScreenDetails();if(hasUAClientHints()){getUserAgentClientHint(function(uach){state.context['ua-ch'].value=uach;},state.loadOptions.value.uaChTrackLevel);}});// Ad blocker detection
|
3457
|
-
|
3324
|
+
E(function(){if(state.loadOptions.value.sendAdblockPage===true&&state.lifecycle.sourceConfigUrl.value!==undefined){detectAdBlockers(_this.errorHandler,_this.logger);}});}/**
|
3458
3325
|
* Detect if polyfills are required and then load script from polyfill URL
|
3459
|
-
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _state$loadOptions$va,_this2=this;state.capabilities.isLegacyDOM.value=isLegacyJSEngine();var polyfillUrl=(_state$loadOptions$va=state.loadOptions.value.polyfillURL)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:POLYFILL_URL;var shouldLoadPolyfill=state.loadOptions.value.polyfillIfRequired&&state.capabilities.isLegacyDOM.value&&Boolean(polyfillUrl);if(shouldLoadPolyfill){var _this$externalSrcLoad
|
3460
|
-
//
|
3461
|
-
var
|
3326
|
+
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){var _state$loadOptions$va,_this2=this;state.capabilities.isLegacyDOM.value=isLegacyJSEngine();var polyfillUrl=(_state$loadOptions$va=state.loadOptions.value.polyfillURL)!==null&&_state$loadOptions$va!==void 0?_state$loadOptions$va:POLYFILL_URL;var shouldLoadPolyfill=state.loadOptions.value.polyfillIfRequired&&state.capabilities.isLegacyDOM.value&&Boolean(polyfillUrl);if(shouldLoadPolyfill){var _this$externalSrcLoad;var isDefaultPolyfillService=polyfillUrl!==state.loadOptions.value.polyfillURL;if(isDefaultPolyfillService){var polyfillCallback=function polyfillCallback(){return _this2.onReady();};// write key specific callback
|
3327
|
+
// NOTE: we're not putting this into RudderStackGlobals as providing the property path to the callback function in the polyfill URL is not possible
|
3328
|
+
var polyfillCallbackName="RS_polyfillCallback_".concat(state.lifecycle.writeKey.value);globalThis[polyfillCallbackName]=polyfillCallback;polyfillUrl="".concat(polyfillUrl,"&callback=").concat(polyfillCallbackName);}(_this$externalSrcLoad=this.externalSrcLoader)===null||_this$externalSrcLoad===void 0||_this$externalSrcLoad.loadJSFile({url:polyfillUrl,id:POLYFILL_SCRIPT_ID,async:true,timeout:POLYFILL_LOAD_TIMEOUT,callback:function callback(scriptId){if(!scriptId){_this2.onError(new Error(POLYFILL_SCRIPT_LOAD_ERROR(POLYFILL_SCRIPT_ID,polyfillUrl)));}else if(!isDefaultPolyfillService){_this2.onReady();}}});}else {this.onReady();}}/**
|
3462
3329
|
* Attach listeners to window to observe event that update capabilities state values
|
3463
3330
|
*/ // eslint-disable-next-line class-methods-use-this
|
3464
|
-
},{key:"attachWindowListeners",value:function attachWindowListeners(){globalThis.addEventListener('offline',function(){state.capabilities.isOnline.value=false;});globalThis.addEventListener('online',function(){state.capabilities.isOnline.value=true;})
|
3465
|
-
}/**
|
3331
|
+
},{key:"attachWindowListeners",value:function attachWindowListeners(){globalThis.addEventListener('offline',function(){state.capabilities.isOnline.value=false;});globalThis.addEventListener('online',function(){state.capabilities.isOnline.value=true;});globalThis.addEventListener('resize',debounce(function(){state.context.screen.value=getScreenDetails();},this));}/**
|
3466
3332
|
* Set the lifecycle status to next phase
|
3467
3333
|
*/ // eslint-disable-next-line class-methods-use-this
|
3468
3334
|
},{key:"onReady",value:function onReady(){this.detectBrowserCapabilities();state.lifecycle.status.value=LifecycleStatus.BrowserCapabilitiesReady;}/**
|
@@ -3474,7 +3340,7 @@ var CHANNEL='web';// These are the top-level elements in the standard RudderStac
|
|
3474
3340
|
var TOP_LEVEL_ELEMENTS=['integrations','anonymousId','originalTimestamp'];// Reserved elements in the context of standard RudderStack event spec
|
3475
3341
|
// Typically, these elements are not allowed to be overridden by the user
|
3476
3342
|
var CONTEXT_RESERVED_ELEMENTS=['library','consentManagement','userAgent','ua-ch','screen'];// Reserved elements in the standard RudderStack event spec
|
3477
|
-
var RESERVED_ELEMENTS=['anonymousId','sentAt','receivedAt','timestamp','originalTimestamp','event','messageId','channel'];
|
3343
|
+
var RESERVED_ELEMENTS=['anonymousId','sentAt','receivedAt','timestamp','originalTimestamp','event','messageId','channel'];
|
3478
3344
|
|
3479
3345
|
/**
|
3480
3346
|
* To get the page properties for context object
|
@@ -3489,10 +3355,9 @@ var curPageProps=getDefaultPageProperties();var ctxPageProps={};Object.keys(curP
|
|
3489
3355
|
var curPageProps=getDefaultPageProperties();Object.keys(curPageProps).forEach(function(key){if(isUndefined(pageProps[key])){pageProps[key]=optionsPageProps[key]||curPageProps[key];}});if(isUndefined(pageProps.initial_referrer)){pageProps.initial_referrer=optionsPageProps.initial_referrer||state.session.initialReferrer.value;}if(isUndefined(pageProps.initial_referring_domain)){pageProps.initial_referring_domain=optionsPageProps.initial_referring_domain||state.session.initialReferringDomain.value;}return pageProps;};/**
|
3490
3356
|
* Utility to check for reserved keys in the input object
|
3491
3357
|
* @param obj Generic object
|
3492
|
-
* @param eventType Rudder event type
|
3493
3358
|
* @param parentKeyPath Object's parent key path
|
3494
3359
|
* @param logger Logger instance
|
3495
|
-
*/var checkForReservedElementsInObject=function checkForReservedElementsInObject(obj,parentKeyPath,logger){if(isObjectLiteralAndNotNull(obj)){Object.keys(obj).forEach(function(property){if(RESERVED_ELEMENTS.includes(property)||RESERVED_ELEMENTS.includes(property.toLowerCase())){logger===null||logger===void 0
|
3360
|
+
*/var checkForReservedElementsInObject=function checkForReservedElementsInObject(obj,parentKeyPath,logger){if(isObjectLiteralAndNotNull(obj)){Object.keys(obj).forEach(function(property){if(RESERVED_ELEMENTS.includes(property)||RESERVED_ELEMENTS.includes(property.toLowerCase())){logger===null||logger===void 0||logger.warn(RESERVED_KEYWORD_WARNING(EVENT_MANAGER,property,parentKeyPath,RESERVED_ELEMENTS));}});}};/**
|
3496
3361
|
* Checks for reserved keys in traits, properties, and contextual traits
|
3497
3362
|
* @param rudderEvent Generated rudder event
|
3498
3363
|
* @param logger Logger instance
|
@@ -3509,7 +3374,7 @@ rudderEvent.originalTimestamp=options.originalTimestamp;}};/**
|
|
3509
3374
|
* @param rudderContext Generated rudder event
|
3510
3375
|
* @param options API options
|
3511
3376
|
* @param logger Logger instance
|
3512
|
-
*/var getMergedContext=function getMergedContext(rudderContext,options,logger){var context=rudderContext;Object.keys(options).forEach(function(key){if(!TOP_LEVEL_ELEMENTS.includes(key)&&!CONTEXT_RESERVED_ELEMENTS.includes(key)){if(key!=='context'){context=mergeDeepRight(context,_defineProperty({},key,options[key]));}else if(!isUndefined(options[key])&&isObjectLiteralAndNotNull(options[key])){var tempContext={};Object.keys(options[key]).forEach(function(e){if(!CONTEXT_RESERVED_ELEMENTS.includes(e)){tempContext[e]=options[key][e];}});context=mergeDeepRight(context,_objectSpread2({},tempContext));}else {logger===null||logger===void 0
|
3377
|
+
*/var getMergedContext=function getMergedContext(rudderContext,options,logger){var context=rudderContext;Object.keys(options).forEach(function(key){if(!TOP_LEVEL_ELEMENTS.includes(key)&&!CONTEXT_RESERVED_ELEMENTS.includes(key)){if(key!=='context'){context=mergeDeepRight(context,_defineProperty({},key,options[key]));}else if(!isUndefined(options[key])&&isObjectLiteralAndNotNull(options[key])){var tempContext={};Object.keys(options[key]).forEach(function(e){if(!CONTEXT_RESERVED_ELEMENTS.includes(e)){tempContext[e]=options[key][e];}});context=mergeDeepRight(context,_objectSpread2({},tempContext));}else {logger===null||logger===void 0||logger.warn(INVALID_CONTEXT_OBJECT_WARNING(EVENT_MANAGER));}}});return context;};/**
|
3513
3378
|
* A function to determine whether SDK should use the integration option provided in load call
|
3514
3379
|
* @returns boolean
|
3515
3380
|
*/var shouldUseGlobalIntegrationsConfigInEvents=function shouldUseGlobalIntegrationsConfigInEvents(){return state.loadOptions.value.useGlobalIntegrationsConfigInEvents&&isObjectLiteralAndNotNull(state.nativeDestinations.loadOnlyIntegrations.value);};/**
|
@@ -3529,10 +3394,10 @@ rudderEvent.context=getMergedContext(rudderEvent.context,options);}};/**
|
|
3529
3394
|
* @param pageProps Page properties
|
3530
3395
|
* @param logger logger
|
3531
3396
|
* @returns Enriched RudderEvent object
|
3532
|
-
*/var getEnrichedEvent=function getEnrichedEvent(rudderEvent,options,pageProps,logger){var commonEventData={channel:CHANNEL,context:{traits:clone$1(state.session.userTraits.value),sessionId:state.session.sessionInfo.value.id||undefined,sessionStart:state.session.sessionInfo.value.sessionStart||undefined,consentManagement:{deniedConsentIds:clone$1(state.consents.data.value.deniedConsentIds)},'ua-ch':state.context['ua-ch'].value,app:state.context.app.value,library:state.context.library.value,userAgent:state.context.userAgent.value,os:state.context.os.value,locale:state.context.locale.value
|
3533
|
-
|
3534
|
-
commonEventData.anonymousId=
|
3535
|
-
|
3397
|
+
*/var getEnrichedEvent=function getEnrichedEvent(rudderEvent,options,pageProps,logger){var _state$storage$entrie;var commonEventData={channel:CHANNEL,context:{traits:clone$1(state.session.userTraits.value),sessionId:state.session.sessionInfo.value.id||undefined,sessionStart:state.session.sessionInfo.value.sessionStart||undefined,consentManagement:{deniedConsentIds:clone$1(state.consents.data.value.deniedConsentIds)},'ua-ch':state.context['ua-ch'].value,app:state.context.app.value,library:state.context.library.value,userAgent:state.context.userAgent.value,os:state.context.os.value,locale:state.context.locale.value,screen:state.context.screen.value,campaign:extractUTMParameters(globalThis.location.href),page:getContextPageProperties(pageProps)},originalTimestamp:getCurrentTimeFormatted(),integrations:DEFAULT_INTEGRATIONS_CONFIG,messageId:generateUUID(),userId:rudderEvent.userId||state.session.userId.value};if(((_state$storage$entrie=state.storage.entries.value.anonymousId)===null||_state$storage$entrie===void 0?void 0:_state$storage$entrie.type)===NO_STORAGE){// Generate new anonymous id for each request
|
3398
|
+
commonEventData.anonymousId=generateUUID();}else {// Type casting to string as the user session manager will take care of initializing the value
|
3399
|
+
commonEventData.anonymousId=state.session.anonymousId.value;}// set truly anonymous tracking flag
|
3400
|
+
if(state.storage.trulyAnonymousTracking.value){commonEventData.context.trulyAnonymousTracking=true;}if(rudderEvent.type===RudderEventType.Identify){var _state$storage$entrie2;commonEventData.context.traits=((_state$storage$entrie2=state.storage.entries.value.userTraits)===null||_state$storage$entrie2===void 0?void 0:_state$storage$entrie2.type)!==NO_STORAGE?clone$1(state.session.userTraits.value):rudderEvent.context.traits;}if(rudderEvent.type===RudderEventType.Group){if(rudderEvent.groupId||state.session.groupId.value){commonEventData.groupId=rudderEvent.groupId||state.session.groupId.value;}if(rudderEvent.traits||state.session.groupTraits.value){var _state$storage$entrie3;commonEventData.traits=((_state$storage$entrie3=state.storage.entries.value.groupTraits)===null||_state$storage$entrie3===void 0?void 0:_state$storage$entrie3.type)!==NO_STORAGE?clone$1(state.session.groupTraits.value):rudderEvent.traits;}}var processedEvent=mergeDeepRight(rudderEvent,commonEventData);// Set the default values for the event properties
|
3536
3401
|
// matching with v1.1 payload
|
3537
3402
|
if(processedEvent.event===undefined){processedEvent.event=null;}if(processedEvent.properties===undefined){processedEvent.properties=null;}processOptions(processedEvent,options);// TODO: We might not need this check altogether
|
3538
3403
|
checkForReservedElements(processedEvent,logger);// Update the integrations config for the event
|
@@ -3595,7 +3460,7 @@ var MIN_SESSION_ID_LENGTH=10;/**
|
|
3595
3460
|
* Function to validate user provided sessionId
|
3596
3461
|
* @param {number} sessionId
|
3597
3462
|
* @returns
|
3598
|
-
*/var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger===null||logger===void 0
|
3463
|
+
*/var isManualSessionIdValid=function isManualSessionIdValid(sessionId,logger){if(!sessionId||!isPositiveInteger(sessionId)||!hasMinLength(MIN_SESSION_ID_LENGTH,sessionId)){logger===null||logger===void 0||logger.warn(INVALID_SESSION_ID_WARNING(USER_SESSION_MANAGER,sessionId,MIN_SESSION_ID_LENGTH));return false;}return true;};/**
|
3599
3464
|
* A function to generate new auto tracking session
|
3600
3465
|
* @param sessionTimeout current timestamp
|
3601
3466
|
* @returns SessionInfo
|
@@ -3606,21 +3471,19 @@ timeout:timeout,sessionStart:undefined,autoTrack:true};};/**
|
|
3606
3471
|
* @param id Provided sessionId
|
3607
3472
|
* @param logger Logger module
|
3608
3473
|
* @returns SessionInfo
|
3609
|
-
*/var generateManualTrackingSession=function generateManualTrackingSession(id,logger){var sessionId=isManualSessionIdValid(id,logger)?id:generateSessionId();return {id:sessionId,sessionStart:undefined,manualTrack:true};};
|
3474
|
+
*/var generateManualTrackingSession=function generateManualTrackingSession(id,logger){var sessionId=isManualSessionIdValid(id,logger)?id:generateSessionId();return {id:sessionId,sessionStart:undefined,manualTrack:true};};var isStorageTypeValidForStoringData=function isStorageTypeValidForStoringData(storageType){return !!(storageType===COOKIE_STORAGE||storageType===LOCAL_STORAGE||storageType===MEMORY_STORAGE);};
|
3610
3475
|
|
3611
|
-
var
|
3612
|
-
|
3613
|
-
var UserSessionManager=/*#__PURE__*/function(){function UserSessionManager(errorHandler,logger,pluginsManager,store){_classCallCheck(this,UserSessionManager);this.store=store;this.pluginsManager=pluginsManager;this.logger=logger;this.errorHandler=errorHandler;this.onError=this.onError.bind(this);}/**
|
3476
|
+
var UserSessionManager=/*#__PURE__*/function(){function UserSessionManager(errorHandler,logger,pluginsManager,storeManager){_classCallCheck(this,UserSessionManager);this.storeManager=storeManager;this.pluginsManager=pluginsManager;this.logger=logger;this.errorHandler=errorHandler;this.onError=this.onError.bind(this);}/**
|
3614
3477
|
* Initialize User session with values from storage
|
3615
3478
|
* @param store Selected store
|
3616
|
-
*/_createClass(UserSessionManager,[{key:"init",value:function init(
|
3617
|
-
|
3618
|
-
this.initializeSessionTracking()
|
3619
|
-
this.registerEffects();}}
|
3479
|
+
*/_createClass(UserSessionManager,[{key:"init",value:function init(){this.migrateStorageIfNeeded();this.migrateDataFromPreviousStorage();// get the values from storage and set it again
|
3480
|
+
var userId=this.getUserId();var userTraits=this.getUserTraits();var groupId=this.getGroupId();var groupTraits=this.getGroupTraits();var anonymousId=this.getAnonymousId();if(userId){this.setUserId(userId);}if(userTraits){this.setUserTraits(userTraits);}if(groupId){this.setGroupId(groupId);}if(groupTraits){this.setGroupTraits(groupTraits);}if(anonymousId){this.setAnonymousId(anonymousId);}var initialReferrer=this.getInitialReferrer();var initialReferringDomain=this.getInitialReferringDomain();if(initialReferrer&&initialReferringDomain){this.setInitialReferrer(initialReferrer);this.setInitialReferringDomain(initialReferringDomain);}else if(initialReferrer){this.setInitialReferrer(initialReferrer);this.setInitialReferringDomain(getReferringDomain(initialReferrer));}else {var referrer=getReferrer();this.setInitialReferrer(referrer);this.setInitialReferringDomain(getReferringDomain(referrer));}// Initialize session tracking
|
3481
|
+
if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.sessionInfo)){this.initializeSessionTracking();}// Register the effect to sync with storage
|
3482
|
+
this.registerEffects();}},{key:"isPersistenceEnabledForStorageEntry",value:function isPersistenceEnabledForStorageEntry(entryName){var _entries$entryName;var entries=state.storage.entries.value;return isStorageTypeValidForStoringData((_entries$entryName=entries[entryName])===null||_entries$entryName===void 0?void 0:_entries$entryName.type);}},{key:"migrateDataFromPreviousStorage",value:function migrateDataFromPreviousStorage(){var _this=this;var entries=state.storage.entries.value;Object.keys(entries).forEach(function(entry){var _entries$key,_this$storeManager;var key=entry;var currentStorage=(_entries$key=entries[key])===null||_entries$key===void 0?void 0:_entries$key.type;var curStore=(_this$storeManager=_this.storeManager)===null||_this$storeManager===void 0?void 0:_this$storeManager.getStore(storageClientDataStoreNameMap[currentStorage]);var storages=[COOKIE_STORAGE,LOCAL_STORAGE];storages.forEach(function(storage){var _this$storeManager2;var store=(_this$storeManager2=_this.storeManager)===null||_this$storeManager2===void 0?void 0:_this$storeManager2.getStore(storageClientDataStoreNameMap[storage]);if(storage!==currentStorage&&store){if(curStore){var value=store===null||store===void 0?void 0:store.get(userSessionStorageKeys[key]);if(isDefinedNotNullAndNotEmptyString(value)){curStore===null||curStore===void 0||curStore.set(userSessionStorageKeys[key],value);}}store===null||store===void 0||store.remove(userSessionStorageKeys[key]);}});});}},{key:"migrateStorageIfNeeded",value:function migrateStorageIfNeeded(){var _this$storeManager3,_this$storeManager4,_this2=this;if(!state.storage.migrate.value){return;}var cookieStorage=(_this$storeManager3=this.storeManager)===null||_this$storeManager3===void 0?void 0:_this$storeManager3.getStore(CLIENT_DATA_STORE_COOKIE);var localStorage=(_this$storeManager4=this.storeManager)===null||_this$storeManager4===void 0?void 0:_this$storeManager4.getStore(CLIENT_DATA_STORE_LS);var stores=[];if(cookieStorage){stores.push(cookieStorage);}if(localStorage){stores.push(localStorage);}Object.keys(userSessionStorageKeys).forEach(function(storageEntryKey){var key=storageEntryKey;var storageEntry=userSessionStorageKeys[key];stores.forEach(function(store){var _this2$pluginsManager;var migratedVal=(_this2$pluginsManager=_this2.pluginsManager)===null||_this2$pluginsManager===void 0?void 0:_this2$pluginsManager.invokeSingle('storage.migrate',storageEntry,store.engine,_this2.errorHandler,_this2.logger);if(migratedVal){store.set(storageEntry,migratedVal);}});});}/**
|
3620
3483
|
* A function to initialize sessionTracking
|
3621
|
-
*/},{key:"initializeSessionTracking",value:function initializeSessionTracking(){var _this$getSessionFromS;var sessionInfo=(_this$getSessionFromS=this.getSessionFromStorage())!==null&&_this$getSessionFromS!==void 0?_this$getSessionFromS:defaultSessionInfo;var finalAutoTrackingStatus=!(state.loadOptions.value.sessions.autoTrack===false||sessionInfo.manualTrack===true);var sessionTimeout;var configuredSessionTimeout=state.loadOptions.value.sessions.timeout;if(!isPositiveInteger(configuredSessionTimeout)){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0
|
3484
|
+
*/},{key:"initializeSessionTracking",value:function initializeSessionTracking(){var _this$getSessionFromS;var sessionInfo=(_this$getSessionFromS=this.getSessionFromStorage())!==null&&_this$getSessionFromS!==void 0?_this$getSessionFromS:defaultSessionInfo;var finalAutoTrackingStatus=!(state.loadOptions.value.sessions.autoTrack===false||sessionInfo.manualTrack===true);var sessionTimeout;var configuredSessionTimeout=state.loadOptions.value.sessions.timeout;if(!isPositiveInteger(configuredSessionTimeout)){var _this$logger;(_this$logger=this.logger)===null||_this$logger===void 0||_this$logger.warn(TIMEOUT_NOT_NUMBER_WARNING(USER_SESSION_MANAGER,configuredSessionTimeout,DEFAULT_SESSION_TIMEOUT_MS));sessionTimeout=DEFAULT_SESSION_TIMEOUT_MS;}else {sessionTimeout=configuredSessionTimeout;}if(sessionTimeout===0){var _this$logger2;(_this$logger2=this.logger)===null||_this$logger2===void 0||_this$logger2.warn(TIMEOUT_ZERO_WARNING(USER_SESSION_MANAGER));finalAutoTrackingStatus=false;}// In case user provides a timeout value greater than 0 but less than 10 seconds SDK will show a warning
|
3622
3485
|
// and will proceed with it
|
3623
|
-
if(sessionTimeout>0&&sessionTimeout<MIN_SESSION_TIMEOUT_MS){var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0
|
3486
|
+
if(sessionTimeout>0&&sessionTimeout<MIN_SESSION_TIMEOUT_MS){var _this$logger3;(_this$logger3=this.logger)===null||_this$logger3===void 0||_this$logger3.warn(TIMEOUT_NOT_RECOMMENDED_WARNING(USER_SESSION_MANAGER,sessionTimeout,MIN_SESSION_TIMEOUT_MS));}state.session.sessionInfo.value=_objectSpread2(_objectSpread2({},sessionInfo),{},{timeout:sessionTimeout,autoTrack:finalAutoTrackingStatus});// If auto session tracking is enabled start the session tracking
|
3624
3487
|
if(state.session.sessionInfo.value.autoTrack){this.startOrRenewAutoTracking();}}/**
|
3625
3488
|
* Handles error
|
3626
3489
|
* @param error The error object
|
@@ -3628,87 +3491,90 @@ if(state.session.sessionInfo.value.autoTrack){this.startOrRenewAutoTracking();}}
|
|
3628
3491
|
* A function to sync values in storage
|
3629
3492
|
* @param key
|
3630
3493
|
* @param value
|
3631
|
-
*/},{key:"syncValueToStorage",value:function syncValueToStorage(
|
3494
|
+
*/},{key:"syncValueToStorage",value:function syncValueToStorage(sessionKey,value){var _entries$sessionKey,_entries$sessionKey2;var entries=state.storage.entries.value;var storage=(_entries$sessionKey=entries[sessionKey])===null||_entries$sessionKey===void 0?void 0:_entries$sessionKey.type;var key=(_entries$sessionKey2=entries[sessionKey])===null||_entries$sessionKey2===void 0?void 0:_entries$sessionKey2.key;if(isStorageTypeValidForStoringData(storage)){var _this$storeManager5;var curStore=(_this$storeManager5=this.storeManager)===null||_this$storeManager5===void 0?void 0:_this$storeManager5.getStore(storageClientDataStoreNameMap[storage]);if(value&&isString(value)||isNonEmptyObject(value)){curStore===null||curStore===void 0||curStore.set(key,value);}else {curStore===null||curStore===void 0||curStore.remove(key);}}}/**
|
3632
3495
|
* Function to update storage whenever state value changes
|
3633
|
-
*/},{key:"registerEffects",value:function registerEffects(){var
|
3496
|
+
*/},{key:"registerEffects",value:function registerEffects(){var _this3=this;/**
|
3634
3497
|
* Update userId in storage automatically when userId is updated in state
|
3635
|
-
*/
|
3498
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.userId,state.session.userId.value);});/**
|
3636
3499
|
* Update user traits in storage automatically when it is updated in state
|
3637
|
-
*/
|
3500
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.userTraits,state.session.userTraits.value);});/**
|
3638
3501
|
* Update group id in storage automatically when it is updated in state
|
3639
|
-
*/
|
3502
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.groupId,state.session.groupId.value);});/**
|
3640
3503
|
* Update group traits in storage automatically when it is updated in state
|
3641
|
-
*/
|
3504
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.groupTraits,state.session.groupTraits.value);});/**
|
3642
3505
|
* Update anonymous user id in storage automatically when it is updated in state
|
3643
|
-
*/
|
3506
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.anonymousId,state.session.anonymousId.value);});/**
|
3644
3507
|
* Update initial referrer in storage automatically when it is updated in state
|
3645
|
-
*/
|
3508
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.initialReferrer,state.session.initialReferrer.value);});/**
|
3646
3509
|
* Update initial referring domain in storage automatically when it is updated in state
|
3647
|
-
*/
|
3510
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.initialReferringDomain,state.session.initialReferringDomain.value);});/**
|
3648
3511
|
* Update session tracking info in storage automatically when it is updated in state
|
3649
|
-
*/
|
3512
|
+
*/E(function(){_this3.syncValueToStorage(UserSessionKeys.sessionInfo,state.session.sessionInfo.value);});}/**
|
3650
3513
|
* Sets anonymous id in the following precedence:
|
3651
3514
|
*
|
3652
3515
|
* 1. anonymousId: Id directly provided to the function.
|
3653
3516
|
* 2. rudderAmpLinkerParam: value generated from linker query parm (rudderstack)
|
3654
3517
|
* using parseLinker util.
|
3655
3518
|
* 3. generateUUID: A new unique id is generated and assigned.
|
3656
|
-
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){
|
3519
|
+
*/},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var _state$storage$entrie;var finalAnonymousId=anonymousId;var storage=(_state$storage$entrie=state.storage.entries.value.anonymousId)===null||_state$storage$entrie===void 0?void 0:_state$storage$entrie.type;if(isStorageTypeValidForStoringData(storage)){if(!finalAnonymousId&&rudderAmpLinkerParam){var _this$pluginsManager;var linkerPluginsResult=(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0?void 0:_this$pluginsManager.invokeMultiple('userSession.anonymousIdGoogleLinker',rudderAmpLinkerParam);finalAnonymousId=linkerPluginsResult===null||linkerPluginsResult===void 0?void 0:linkerPluginsResult[0];}state.session.anonymousId.value=finalAnonymousId||this.generateAnonymousId();}}/**
|
3657
3520
|
* Generate a new anonymousId
|
3658
3521
|
* @returns string anonymousID
|
3659
3522
|
*/},{key:"generateAnonymousId",value:function generateAnonymousId(){return generateUUID();}/**
|
3660
3523
|
* Fetches anonymousId
|
3661
3524
|
* @param options option to fetch it from external source
|
3662
3525
|
* @returns anonymousId
|
3663
|
-
*/},{key:"getAnonymousId",value:function getAnonymousId(options){var
|
3664
|
-
var
|
3665
|
-
var autoCapturedAnonymousId=(_this$
|
3526
|
+
*/},{key:"getAnonymousId",value:function getAnonymousId(options){var _state$storage$entrie2,_state$storage$entrie3;var storage=(_state$storage$entrie2=state.storage.entries.value.anonymousId)===null||_state$storage$entrie2===void 0?void 0:_state$storage$entrie2.type;var key=(_state$storage$entrie3=state.storage.entries.value.anonymousId)===null||_state$storage$entrie3===void 0?void 0:_state$storage$entrie3.key;var persistedAnonymousId;// fetch the anonymousId from storage
|
3527
|
+
if(isStorageTypeValidForStoringData(storage)){var _this$storeManager6;var store=(_this$storeManager6=this.storeManager)===null||_this$storeManager6===void 0?void 0:_this$storeManager6.getStore(storageClientDataStoreNameMap[storage]);persistedAnonymousId=store===null||store===void 0?void 0:store.get(key);if(!persistedAnonymousId&&options){var _this$pluginsManager2;// fetch anonymousId from external source
|
3528
|
+
var autoCapturedAnonymousId=(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0?void 0:_this$pluginsManager2.invokeSingle('storage.getAnonymousId',getStorageEngine,options);persistedAnonymousId=autoCapturedAnonymousId;}state.session.anonymousId.value=persistedAnonymousId||this.generateAnonymousId();}return state.session.anonymousId.value;}},{key:"getItem",value:function getItem(sessionKey){var _entries$sessionKey3,_entries$sessionKey4;var entries=state.storage.entries.value;var storage=(_entries$sessionKey3=entries[sessionKey])===null||_entries$sessionKey3===void 0?void 0:_entries$sessionKey3.type;var key=(_entries$sessionKey4=entries[sessionKey])===null||_entries$sessionKey4===void 0?void 0:_entries$sessionKey4.key;if(isStorageTypeValidForStoringData(storage)){var _this$storeManager7,_store$get;var store=(_this$storeManager7=this.storeManager)===null||_this$storeManager7===void 0?void 0:_this$storeManager7.getStore(storageClientDataStoreNameMap[storage]);return (_store$get=store===null||store===void 0?void 0:store.get(key))!==null&&_store$get!==void 0?_store$get:null;}return null;}/**
|
3666
3529
|
* Fetches User Id
|
3667
3530
|
* @returns
|
3668
|
-
*/},{key:"getUserId",value:function getUserId(){
|
3531
|
+
*/},{key:"getUserId",value:function getUserId(){return this.getItem(UserSessionKeys.userId);}/**
|
3669
3532
|
* Fetches User Traits
|
3670
3533
|
* @returns
|
3671
|
-
*/},{key:"getUserTraits",value:function getUserTraits(){
|
3534
|
+
*/},{key:"getUserTraits",value:function getUserTraits(){return this.getItem(UserSessionKeys.userTraits);}/**
|
3672
3535
|
* Fetches Group Id
|
3673
3536
|
* @returns
|
3674
|
-
*/},{key:"getGroupId",value:function getGroupId(){
|
3537
|
+
*/},{key:"getGroupId",value:function getGroupId(){return this.getItem(UserSessionKeys.groupId);}/**
|
3675
3538
|
* Fetches Group Traits
|
3676
3539
|
* @returns
|
3677
|
-
*/},{key:"getGroupTraits",value:function getGroupTraits(){
|
3540
|
+
*/},{key:"getGroupTraits",value:function getGroupTraits(){return this.getItem(UserSessionKeys.groupTraits);}/**
|
3678
3541
|
* Fetches Initial Referrer
|
3679
3542
|
* @returns
|
3680
|
-
*/},{key:"getInitialReferrer",value:function getInitialReferrer(){
|
3543
|
+
*/},{key:"getInitialReferrer",value:function getInitialReferrer(){return this.getItem(UserSessionKeys.initialReferrer);}/**
|
3681
3544
|
* Fetches Initial Referring domain
|
3682
3545
|
* @returns
|
3683
|
-
*/},{key:"getInitialReferringDomain",value:function getInitialReferringDomain(){
|
3546
|
+
*/},{key:"getInitialReferringDomain",value:function getInitialReferringDomain(){return this.getItem(UserSessionKeys.initialReferringDomain);}/**
|
3684
3547
|
* Fetches session tracking information from storage
|
3685
3548
|
* @returns
|
3686
|
-
*/},{key:"getSessionFromStorage",value:function getSessionFromStorage(){
|
3549
|
+
*/},{key:"getSessionFromStorage",value:function getSessionFromStorage(){return this.getItem(UserSessionKeys.sessionInfo);}/**
|
3550
|
+
* If session is active it returns the sessionId
|
3551
|
+
* @returns
|
3552
|
+
*/},{key:"getSessionId",value:function getSessionId(){if(state.session.sessionInfo.value.autoTrack&&!hasSessionExpired(state.session.sessionInfo.value.expiresAt)||state.session.sessionInfo.value.manualTrack){return state.session.sessionInfo.value.id||null;}return null;}/**
|
3687
3553
|
* A function to update current session info after each event call
|
3688
3554
|
*/},{key:"refreshSession",value:function refreshSession(){if(state.session.sessionInfo.value.autoTrack||state.session.sessionInfo.value.manualTrack){if(state.session.sessionInfo.value.autoTrack){this.startOrRenewAutoTracking();}if(state.session.sessionInfo.value.sessionStart===undefined){state.session.sessionInfo.value=_objectSpread2(_objectSpread2({},state.session.sessionInfo.value),{},{sessionStart:true});}else if(state.session.sessionInfo.value.sessionStart){state.session.sessionInfo.value=_objectSpread2(_objectSpread2({},state.session.sessionInfo.value),{},{sessionStart:false});}}}/**
|
3689
3555
|
* Reset state values
|
3690
3556
|
* @param resetAnonymousId
|
3691
3557
|
* @param noNewSessionStart
|
3692
3558
|
* @returns
|
3693
|
-
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var
|
3559
|
+
*/},{key:"reset",value:function reset(resetAnonymousId,noNewSessionStart){var _this4=this;var _state$session$sessio=state.session.sessionInfo.value,manualTrack=_state$session$sessio.manualTrack,autoTrack=_state$session$sessio.autoTrack;r(function(){state.session.userId.value=defaultUserSessionValues.userId;state.session.userTraits.value=defaultUserSessionValues.userTraits;state.session.groupId.value=defaultUserSessionValues.groupId;state.session.groupTraits.value=defaultUserSessionValues.groupTraits;if(resetAnonymousId){state.session.anonymousId.value=defaultUserSessionValues.anonymousId;}if(noNewSessionStart){return;}if(autoTrack){state.session.sessionInfo.value=defaultUserSessionValues.sessionInfo;_this4.startOrRenewAutoTracking();}else if(manualTrack){_this4.startManualTrackingInternal();}});}/**
|
3694
3560
|
* Set user Id
|
3695
3561
|
* @param userId
|
3696
|
-
*/},{key:"setUserId",value:function setUserId(userId){if(this.
|
3562
|
+
*/},{key:"setUserId",value:function setUserId(userId){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.userId)){state.session.userId.value=userId;}}/**
|
3697
3563
|
* Set user traits
|
3698
3564
|
* @param traits
|
3699
|
-
*/},{key:"setUserTraits",value:function setUserTraits(traits){if(
|
3565
|
+
*/},{key:"setUserTraits",value:function setUserTraits(traits){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.userTraits)&&traits){var _state$session$userTr;state.session.userTraits.value=mergeDeepRight((_state$session$userTr=state.session.userTraits.value)!==null&&_state$session$userTr!==void 0?_state$session$userTr:{},traits);}}/**
|
3700
3566
|
* Set group Id
|
3701
3567
|
* @param groupId
|
3702
|
-
*/},{key:"setGroupId",value:function setGroupId(groupId){if(this.
|
3568
|
+
*/},{key:"setGroupId",value:function setGroupId(groupId){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.groupId)){state.session.groupId.value=groupId;}}/**
|
3703
3569
|
* Set group traits
|
3704
3570
|
* @param traits
|
3705
|
-
*/},{key:"setGroupTraits",value:function setGroupTraits(traits){if(
|
3571
|
+
*/},{key:"setGroupTraits",value:function setGroupTraits(traits){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.groupTraits)&&traits){var _state$session$groupT;state.session.groupTraits.value=mergeDeepRight((_state$session$groupT=state.session.groupTraits.value)!==null&&_state$session$groupT!==void 0?_state$session$groupT:{},traits);}}/**
|
3706
3572
|
* Set initial referrer
|
3707
3573
|
* @param referrer
|
3708
|
-
*/},{key:"setInitialReferrer",value:function setInitialReferrer(referrer){if(this.
|
3574
|
+
*/},{key:"setInitialReferrer",value:function setInitialReferrer(referrer){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.initialReferrer)){state.session.initialReferrer.value=referrer;}}/**
|
3709
3575
|
* Set initial referring domain
|
3710
3576
|
* @param referrer
|
3711
|
-
*/},{key:"setInitialReferringDomain",value:function setInitialReferringDomain(
|
3577
|
+
*/},{key:"setInitialReferringDomain",value:function setInitialReferringDomain(referringDomain){if(this.isPersistenceEnabledForStorageEntry(UserSessionKeys.initialReferringDomain)){state.session.initialReferringDomain.value=referringDomain;}}/**
|
3712
3578
|
* A function to check for existing session details and depending on that create a new session.
|
3713
3579
|
*/},{key:"startOrRenewAutoTracking",value:function startOrRenewAutoTracking(){if(hasSessionExpired(state.session.sessionInfo.value.expiresAt)){state.session.sessionInfo.value=generateAutoTrackingSession(state.session.sessionInfo.value.timeout);}else {var timestamp=Date.now();var timeout=state.session.sessionInfo.value.timeout;state.session.sessionInfo.value=mergeDeepRight(state.session.sessionInfo.value,{expiresAt:timestamp+timeout// set the expiry time of the session
|
3714
3580
|
});}}/**
|
@@ -3719,10 +3585,7 @@ var autoCapturedAnonymousId=(_this$pluginsManager3=this.pluginsManager)===null||
|
|
3719
3585
|
* An internal function to start manual session
|
3720
3586
|
*/},{key:"startManualTrackingInternal",value:function startManualTrackingInternal(){this.start(Date.now());}/**
|
3721
3587
|
* A public method to end an ongoing session.
|
3722
|
-
*/},{key:"end",value:function end(){state.session.sessionInfo.value={};}
|
3723
|
-
* Clear storage
|
3724
|
-
* @param resetAnonymousId
|
3725
|
-
*/},{key:"clearUserSessionStorage",value:function clearUserSessionStorage(resetAnonymousId){var _this$store12,_this$store13,_this$store14,_this$store15;(_this$store12=this.store)===null||_this$store12===void 0?void 0:_this$store12.remove(userSessionStorageKeys.userId);(_this$store13=this.store)===null||_this$store13===void 0?void 0:_this$store13.remove(userSessionStorageKeys.userTraits);(_this$store14=this.store)===null||_this$store14===void 0?void 0:_this$store14.remove(userSessionStorageKeys.groupId);(_this$store15=this.store)===null||_this$store15===void 0?void 0:_this$store15.remove(userSessionStorageKeys.groupTraits);if(resetAnonymousId){var _this$store16;(_this$store16=this.store)===null||_this$store16===void 0?void 0:_this$store16.remove(userSessionStorageKeys.anonymousUserId);}}}]);return UserSessionManager;}();
|
3588
|
+
*/},{key:"end",value:function end(){state.session.sessionInfo.value={};}}]);return UserSessionManager;}();
|
3726
3589
|
|
3727
3590
|
/**
|
3728
3591
|
* A buffer queue to serve as a store for any type of data
|
@@ -3730,6 +3593,20 @@ var autoCapturedAnonymousId=(_this$pluginsManager3=this.pluginsManager)===null||
|
|
3730
3593
|
|
3731
3594
|
var DATA_PLANE_QUEUE_EXT_POINT_PREFIX='dataplaneEventsQueue';var DESTINATIONS_QUEUE_EXT_POINT_PREFIX='destinationsEventsQueue';
|
3732
3595
|
|
3596
|
+
/**
|
3597
|
+
* Filters and returns the user supplied integrations config that should take preference over the destination specific integrations config
|
3598
|
+
* @param eventIntgConfig User supplied integrations config at event level
|
3599
|
+
* @param destinationsIntgConfig Cumulative integrations config from all destinations
|
3600
|
+
* @returns Filtered user supplied integrations config
|
3601
|
+
*/var getOverriddenIntegrationOptions=function getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig){return Object.keys(eventIntgConfig).filter(function(intgName){return eventIntgConfig[intgName]!==true||!destinationsIntgConfig[intgName];}).reduce(function(obj,key){var retVal=clone$1(obj);retVal[key]=eventIntgConfig[key];return retVal;},{});};/**
|
3602
|
+
* Returns the event object with final integrations config
|
3603
|
+
* @param event RudderEvent object
|
3604
|
+
* @param state Application state
|
3605
|
+
* @returns Mutated event with final integrations config
|
3606
|
+
*/var getFinalEvent=function getFinalEvent(event,state){var _event$integrations;var finalEvent=clone$1(event);// Merge the destination specific integrations config with the event's integrations config
|
3607
|
+
// In general, the preference is given to the event's integrations config
|
3608
|
+
var eventIntgConfig=(_event$integrations=event.integrations)!==null&&_event$integrations!==void 0?_event$integrations:DEFAULT_INTEGRATIONS_CONFIG;var destinationsIntgConfig=state.nativeDestinations.integrationsConfig.value;var overriddenIntgOpts=getOverriddenIntegrationOptions(eventIntgConfig,destinationsIntgConfig);finalEvent.integrations=mergeDeepRight(destinationsIntgConfig,overriddenIntgOpts);return finalEvent;};
|
3609
|
+
|
3733
3610
|
/**
|
3734
3611
|
* Event repository class responsible for queuing events for further processing and delivery
|
3735
3612
|
*/var EventRepository=/*#__PURE__*/function(){/**
|
@@ -3741,19 +3618,19 @@ var DATA_PLANE_QUEUE_EXT_POINT_PREFIX='dataplaneEventsQueue';var DESTINATIONS_QU
|
|
3741
3618
|
*/function EventRepository(pluginsManager,storeManager,errorHandler,logger){_classCallCheck(this,EventRepository);this.pluginsManager=pluginsManager;this.errorHandler=errorHandler;this.logger=logger;this.httpClient=new HttpClient(errorHandler,logger);this.storeManager=storeManager;this.onError=this.onError.bind(this);}/**
|
3742
3619
|
* Initializes the event repository
|
3743
3620
|
*/_createClass(EventRepository,[{key:"init",value:function init(){var _this=this;this.dataplaneEventsQueue=this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".init"),state,this.httpClient,this.storeManager,this.errorHandler,this.logger);this.destinationsEventsQueue=this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".init"),state,this.pluginsManager,this.storeManager,this.errorHandler,this.logger);// Start the queue once the client destinations are ready
|
3744
|
-
|
3745
|
-
* Enqueues the event for processing
|
3746
|
-
* @param event RudderEvent object
|
3747
|
-
* @param callback API callback function
|
3748
|
-
*/},{key:"enqueue",value:function enqueue(event,callback){var _this2=this;// Start the queue processing only when the destinations are ready or hybrid mode destinations exist
|
3621
|
+
E(function(){if(state.nativeDestinations.clientDestinationsReady.value===true){var _this$destinationsEve;(_this$destinationsEve=_this.destinationsEventsQueue)===null||_this$destinationsEve===void 0||_this$destinationsEve.start();}});// Start the queue processing only when the destinations are ready or hybrid mode destinations exist
|
3749
3622
|
// However, events will be enqueued for now.
|
3750
3623
|
// At the time of processing the events, the integrations config data from destinations
|
3751
3624
|
// is merged into the event object
|
3752
|
-
|
3753
|
-
if(state.loadOptions.value.bufferDataPlaneEventsUntilReady===true){globalThis.setTimeout(function(){var
|
3625
|
+
var timeoutId;E(function(){var _this$dataplaneEvents;var shouldBufferDpEvents=state.loadOptions.value.bufferDataPlaneEventsUntilReady===true&&state.nativeDestinations.clientDestinationsReady.value===false;var hybridDestExist=state.nativeDestinations.activeDestinations.value.some(function(dest){return isHybridModeDestination(dest);});if((hybridDestExist===false||shouldBufferDpEvents===false)&&((_this$dataplaneEvents=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents===void 0?void 0:_this$dataplaneEvents.scheduleTimeoutActive)!==true){var _this$dataplaneEvents2;globalThis.clearTimeout(timeoutId);(_this$dataplaneEvents2=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents2===void 0||_this$dataplaneEvents2.start();}});// Force start the data plane events queue processing after a timeout
|
3626
|
+
if(state.loadOptions.value.bufferDataPlaneEventsUntilReady===true){timeoutId=globalThis.setTimeout(function(){var _this$dataplaneEvents3;if(((_this$dataplaneEvents3=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents3===void 0?void 0:_this$dataplaneEvents3.scheduleTimeoutActive)!==true){var _this$dataplaneEvents4;(_this$dataplaneEvents4=_this.dataplaneEventsQueue)===null||_this$dataplaneEvents4===void 0||_this$dataplaneEvents4.start();}},state.loadOptions.value.dataPlaneEventsBufferTimeout);}}/**
|
3627
|
+
* Enqueues the event for processing
|
3628
|
+
* @param event RudderEvent object
|
3629
|
+
* @param callback API callback function
|
3630
|
+
*/},{key:"enqueue",value:function enqueue(event,callback){var dpQEvent=getFinalEvent(event,state);this.pluginsManager.invokeSingle("".concat(DATA_PLANE_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.dataplaneEventsQueue,dpQEvent,this.errorHandler,this.logger);var dQEvent=clone$1(event);this.pluginsManager.invokeSingle("".concat(DESTINATIONS_QUEUE_EXT_POINT_PREFIX,".enqueue"),state,this.destinationsEventsQueue,dQEvent,this.errorHandler,this.logger);// Invoke the callback if it exists
|
3754
3631
|
try{// Using the event sent to the data plane queue here
|
3755
3632
|
// to ensure the mutated (if any) event is sent to the callback
|
3756
|
-
callback===null||callback===void 0
|
3633
|
+
callback===null||callback===void 0||callback(dpQEvent);}catch(error){this.onError(error,API_CALLBACK_INVOKE_ERROR);}}/**
|
3757
3634
|
* Handles error
|
3758
3635
|
* @param error The error object
|
3759
3636
|
* @param customMessage a message
|
@@ -3768,30 +3645,30 @@ callback===null||callback===void 0?void 0:callback(dpQEvent);}catch(error){this.
|
|
3768
3645
|
* Start application lifecycle if not already started
|
3769
3646
|
*/_createClass(Analytics,[{key:"load",value:function load(writeKey,dataPlaneUrl){var loadOptions=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(state.lifecycle.status.value){return;}var clonedDataPlaneUrl=clone$1(dataPlaneUrl);var clonedLoadOptions=clone$1(loadOptions);// dataPlaneUrl is not provided
|
3770
3647
|
if(isObjectAndNotNull(dataPlaneUrl)){clonedLoadOptions=dataPlaneUrl;clonedDataPlaneUrl=undefined;}// Set initial state values
|
3771
|
-
|
3648
|
+
r(function(){state.lifecycle.writeKey.value=writeKey;state.lifecycle.dataPlaneUrl.value=clonedDataPlaneUrl;state.loadOptions.value=normalizeLoadOptions(state.loadOptions.value,clonedLoadOptions);state.lifecycle.status.value=LifecycleStatus.Mounted;});// Expose state to global objects
|
3772
3649
|
setExposedGlobal('state',state,writeKey);// Configure initial config of any services or components here
|
3773
3650
|
// State application lifecycle
|
3774
3651
|
this.startLifecycle();}// Start lifecycle methods
|
3775
3652
|
/**
|
3776
3653
|
* Orchestrate the lifecycle of the application phases/status
|
3777
|
-
*/},{key:"startLifecycle",value:function startLifecycle(){var _this=this;
|
3654
|
+
*/},{key:"startLifecycle",value:function startLifecycle(){var _this=this;E(function(){try{switch(state.lifecycle.status.value){case LifecycleStatus.Mounted:_this.prepareBrowserCapabilities();break;case LifecycleStatus.BrowserCapabilitiesReady:// initialize the preloaded events enqueuing
|
3778
3655
|
retrievePreloadBufferEvents(_this);_this.prepareInternalServices();_this.loadConfig();break;case LifecycleStatus.Configured:_this.loadPlugins();break;case LifecycleStatus.PluginsLoading:break;case LifecycleStatus.PluginsReady:_this.init();break;case LifecycleStatus.Initialized:_this.onInitialized();break;case LifecycleStatus.Loaded:_this.loadDestinations();_this.processBufferedEvents();break;case LifecycleStatus.DestinationsLoading:break;case LifecycleStatus.DestinationsReady:_this.onDestinationsReady();break;case LifecycleStatus.Ready:_this.onReady();break;default:break;}}catch(err){var issue='Failed to load the SDK';_this.errorHandler.onError(getMutatedError(err,issue),ANALYTICS_CORE);}});}/**
|
3779
3656
|
* Load browser polyfill if required
|
3780
3657
|
*/},{key:"prepareBrowserCapabilities",value:function prepareBrowserCapabilities(){this.capabilitiesManager.init();}/**
|
3781
3658
|
* Enqueue in SDK preload buffer events, used from preloadBuffer component
|
3782
3659
|
*/},{key:"enqueuePreloadBufferEvents",value:function enqueuePreloadBufferEvents(bufferedEvents){var _this2=this;if(Array.isArray(bufferedEvents)){bufferedEvents.forEach(function(bufferedEvent){return _this2.preloadBuffer.enqueue(clone$1(bufferedEvent));});}}/**
|
3783
3660
|
* Process the buffer preloaded events by passing their arguments to the respective facade methods
|
3784
|
-
*/},{key:"processDataInPreloadBuffer",value:function processDataInPreloadBuffer(){while(this.preloadBuffer.size()>0){var eventToProcess=this.preloadBuffer.dequeue();if(eventToProcess){consumePreloadBufferedEvent(_toConsumableArray(eventToProcess),this);}}}},{key:"prepareInternalServices",value:function prepareInternalServices(){this.pluginsManager=new PluginsManager(defaultPluginEngine,this.errorHandler,this.logger);this.storeManager=new StoreManager(this.pluginsManager,this.errorHandler,this.logger);this.configManager=new ConfigManager(this.httpClient,this.errorHandler,this.logger);this.userSessionManager=new UserSessionManager(this.errorHandler,this.logger,this.pluginsManager);this.eventRepository=new EventRepository(this.pluginsManager,this.storeManager,this.errorHandler,this.logger);this.eventManager=new EventManager(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger);}/**
|
3661
|
+
*/},{key:"processDataInPreloadBuffer",value:function processDataInPreloadBuffer(){while(this.preloadBuffer.size()>0){var eventToProcess=this.preloadBuffer.dequeue();if(eventToProcess){consumePreloadBufferedEvent(_toConsumableArray(eventToProcess),this);}}}},{key:"prepareInternalServices",value:function prepareInternalServices(){this.pluginsManager=new PluginsManager(defaultPluginEngine,this.errorHandler,this.logger);this.storeManager=new StoreManager(this.pluginsManager,this.errorHandler,this.logger);this.configManager=new ConfigManager(this.httpClient,this.errorHandler,this.logger);this.userSessionManager=new UserSessionManager(this.errorHandler,this.logger,this.pluginsManager,this.storeManager);this.eventRepository=new EventRepository(this.pluginsManager,this.storeManager,this.errorHandler,this.logger);this.eventManager=new EventManager(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger);}/**
|
3785
3662
|
* Load configuration
|
3786
|
-
*/},{key:"loadConfig",value:function loadConfig(){var _this$configManager;if(!state.lifecycle.writeKey.value){this.errorHandler.onError(new Error('A write key is required to load the SDK. Please provide a valid write key.'),LOAD_CONFIGURATION);return;}this.httpClient.setAuthHeader(state.lifecycle.writeKey.value);(_this$configManager=this.configManager)===null||_this$configManager===void 0
|
3663
|
+
*/},{key:"loadConfig",value:function loadConfig(){var _this$configManager;if(!state.lifecycle.writeKey.value){this.errorHandler.onError(new Error('A write key is required to load the SDK. Please provide a valid write key.'),LOAD_CONFIGURATION);return;}this.httpClient.setAuthHeader(state.lifecycle.writeKey.value);(_this$configManager=this.configManager)===null||_this$configManager===void 0||_this$configManager.init();}/**
|
3787
3664
|
* Initialize the storage and event queue
|
3788
|
-
*/},{key:"init",value:function init(){var _this$storeManager,_this$
|
3789
|
-
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0
|
3790
|
-
if(state.consents.activeConsentManagerPluginName.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0
|
3791
|
-
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0
|
3665
|
+
*/},{key:"init",value:function init(){var _this$storeManager,_this$userSessionMana,_this$eventManager;this.errorHandler.init(this.externalSrcLoader);// Initialize storage
|
3666
|
+
(_this$storeManager=this.storeManager)===null||_this$storeManager===void 0||_this$storeManager.init();(_this$userSessionMana=this.userSessionManager)===null||_this$userSessionMana===void 0||_this$userSessionMana.init();// Initialize consent manager
|
3667
|
+
if(state.consents.activeConsentManagerPluginName.value){var _this$pluginsManager;(_this$pluginsManager=this.pluginsManager)===null||_this$pluginsManager===void 0||_this$pluginsManager.invokeSingle("consentManager.init",state,this.storeManager,this.logger);}// Initialize event manager
|
3668
|
+
(_this$eventManager=this.eventManager)===null||_this$eventManager===void 0||_this$eventManager.init();// Mark the SDK as initialized
|
3792
3669
|
state.lifecycle.status.value=LifecycleStatus.Initialized;}/**
|
3793
3670
|
* Load plugins
|
3794
|
-
*/},{key:"loadPlugins",value:function loadPlugins(){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0
|
3671
|
+
*/},{key:"loadPlugins",value:function loadPlugins(){var _this$pluginsManager2;(_this$pluginsManager2=this.pluginsManager)===null||_this$pluginsManager2===void 0||_this$pluginsManager2.init();// TODO: are we going to enable custom plugins to be passed as load options?
|
3795
3672
|
// registerCustomPlugins(state.loadOptions.value.customPlugins);
|
3796
3673
|
}/**
|
3797
3674
|
* Trigger onLoaded callback if any is provided in config & emit initialised event
|
@@ -3800,7 +3677,7 @@ this.processDataInPreloadBuffer();// TODO: we need to avoid passing the window o
|
|
3800
3677
|
// as this will prevent us from supporting multiple SDK instances in the same page
|
3801
3678
|
// Execute onLoaded callback if provided in load options
|
3802
3679
|
if(isFunction(state.loadOptions.value.onLoaded)){state.loadOptions.value.onLoaded(globalThis.rudderanalytics);}// Set lifecycle state
|
3803
|
-
|
3680
|
+
r(function(){state.lifecycle.loaded.value=true;state.lifecycle.status.value=LifecycleStatus.Loaded;});this.initialized=true;// Emit an event to use as substitute to the onLoaded callback
|
3804
3681
|
var initializedEvent=new CustomEvent('RSA_Initialised',{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:true,cancelable:true,composed:true});globalThis.document.dispatchEvent(initializedEvent);}/**
|
3805
3682
|
* Emit ready event
|
3806
3683
|
*/ // eslint-disable-next-line class-methods-use-this
|
@@ -3811,9 +3688,9 @@ var readyEvent=new CustomEvent('RSA_Ready',{detail:{analyticsInstance:globalThis
|
|
3811
3688
|
state.eventBuffer.toBeProcessedArray.value.forEach(function(bufferedItem){var methodName=bufferedItem[0];if(isFunction(_this3[methodName])){var _ref;(_ref=_this3)[methodName].apply(_ref,_toConsumableArray(bufferedItem.slice(1)));}});state.eventBuffer.toBeProcessedArray.value=[];}/**
|
3812
3689
|
* Load device mode destinations
|
3813
3690
|
*/},{key:"loadDestinations",value:function loadDestinations(){var _this$pluginsManager3,_this$pluginsManager4;// Set in state the desired activeDestinations to inject in DOM
|
3814
|
-
(_this$pluginsManager3=this.pluginsManager)===null||_this$pluginsManager3===void 0
|
3815
|
-
state.lifecycle.status.value=LifecycleStatus.DestinationsLoading;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0
|
3816
|
-
|
3691
|
+
(_this$pluginsManager3=this.pluginsManager)===null||_this$pluginsManager3===void 0||_this$pluginsManager3.invokeSingle('nativeDestinations.setActiveDestinations',state,this.pluginsManager,this.errorHandler,this.logger);var totalDestinationsToLoad=state.nativeDestinations.activeDestinations.value.length;if(totalDestinationsToLoad===0){state.lifecycle.status.value=LifecycleStatus.DestinationsReady;return;}// Start loading native integration scripts and create instances
|
3692
|
+
state.lifecycle.status.value=LifecycleStatus.DestinationsLoading;(_this$pluginsManager4=this.pluginsManager)===null||_this$pluginsManager4===void 0||_this$pluginsManager4.invokeSingle('nativeDestinations.load',state,this.externalSrcLoader,this.errorHandler,this.logger);// Progress to next lifecycle phase if all native destinations are initialized or failed
|
3693
|
+
E(function(){var areAllDestinationsReady=totalDestinationsToLoad===0||state.nativeDestinations.initializedDestinations.value.length+state.nativeDestinations.failedDestinations.value.length===totalDestinationsToLoad;if(areAllDestinationsReady){r(function(){state.lifecycle.status.value=LifecycleStatus.DestinationsReady;state.nativeDestinations.clientDestinationsReady.value=true;});}});}/**
|
3817
3694
|
* Invoke the ready callbacks if any exist
|
3818
3695
|
*/ // eslint-disable-next-line class-methods-use-this
|
3819
3696
|
},{key:"onDestinationsReady",value:function onDestinationsReady(){var _this4=this;state.eventBuffer.readyCallbacksArray.value.forEach(function(callback){try{callback();}catch(err){_this4.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}});state.lifecycle.status.value=LifecycleStatus.Ready;}// End lifecycle methods
|
@@ -3822,20 +3699,20 @@ b(function(){var areAllDestinationsReady=totalDestinationsToLoad===0||state.nati
|
|
3822
3699
|
* If destinations are loaded or no integration is available for loading
|
3823
3700
|
* execute the callback immediately else push the callbacks to a queue that
|
3824
3701
|
* will be executed after loading completes
|
3825
|
-
*/if(state.lifecycle.status.value===LifecycleStatus.Ready){try{callback();}catch(err){this.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}}else {state.eventBuffer.readyCallbacksArray.value.push(callback);}}},{key:"page",value:function page(payload){var _this$eventManager2;var type='page';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}(_this$eventManager2=this.eventManager)===null||_this$eventManager2===void 0
|
3702
|
+
*/if(state.lifecycle.status.value===LifecycleStatus.Ready){try{callback();}catch(err){this.errorHandler.onError(err,ANALYTICS_CORE,READY_CALLBACK_INVOKE_ERROR);}}else {state.eventBuffer.readyCallbacksArray.value.push(callback);}}},{key:"page",value:function page(payload){var _this$eventManager2;var type='page';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}(_this$eventManager2=this.eventManager)===null||_this$eventManager2===void 0||_this$eventManager2.addEvent({type:RudderEventType.Page,category:payload.category,name:payload.name,properties:payload.properties,options:payload.options,callback:payload.callback});// TODO: Maybe we should alter the behavior to send the ad-block page event even if the SDK is still loaded. It'll be pushed into the to be processed queue.
|
3826
3703
|
// Send automatic ad blocked page event if adblockers are detected on the page
|
3827
3704
|
// Check page category to avoid infinite loop
|
3828
3705
|
if(state.capabilities.isAdBlocked.value===true&&payload.category!==ADBLOCK_PAGE_CATEGORY){var pageCallArgs={category:ADBLOCK_PAGE_CATEGORY,name:ADBLOCK_PAGE_NAME,properties:{// 'title' is intentionally omitted as it does not make sense
|
3829
3706
|
// in v3 implementation
|
3830
|
-
path:ADBLOCK_PAGE_PATH},options:state.loadOptions.value.sendAdblockPageOptions};this.page(pageCallArgs);}}},{key:"track",value:function track(payload){var _this$eventManager3;var type='track';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}(_this$eventManager3=this.eventManager)===null||_this$eventManager3===void 0
|
3831
|
-
if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0
|
3832
|
-
if(!isNull(payload.groupId)){var _this$userSessionMana6;(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0
|
3833
|
-
if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,anonymousId,rudderAmpLinkerParam]);return;}(_this$userSessionMana10=this.userSessionManager)===null||_this$userSessionMana10===void 0
|
3707
|
+
path:ADBLOCK_PAGE_PATH},options:state.loadOptions.value.sendAdblockPageOptions};this.page(pageCallArgs);}}},{key:"track",value:function track(payload){var _this$eventManager3;var type='track';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}(_this$eventManager3=this.eventManager)===null||_this$eventManager3===void 0||_this$eventManager3.addEvent({type:RudderEventType.Track,name:payload.name||undefined,properties:payload.properties,options:payload.options,callback:payload.callback});}},{key:"identify",value:function identify(payload){var _this$userSessionMana3,_this$eventManager4;var type='identify';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}var shouldResetSession=Boolean(payload.userId&&state.session.userId.value&&payload.userId!==state.session.userId.value);if(shouldResetSession){this.reset();}// `null` value indicates that previous user ID needs to be retained
|
3708
|
+
if(!isNull(payload.userId)){var _this$userSessionMana2;(_this$userSessionMana2=this.userSessionManager)===null||_this$userSessionMana2===void 0||_this$userSessionMana2.setUserId(payload.userId);}(_this$userSessionMana3=this.userSessionManager)===null||_this$userSessionMana3===void 0||_this$userSessionMana3.setUserTraits(payload.traits);(_this$eventManager4=this.eventManager)===null||_this$eventManager4===void 0||_this$eventManager4.addEvent({type:RudderEventType.Identify,userId:payload.userId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"alias",value:function alias(payload){var _ref2,_payload$from,_this$userSessionMana4,_this$userSessionMana5,_this$eventManager5;var type='alias';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}var previousId=(_ref2=(_payload$from=payload.from)!==null&&_payload$from!==void 0?_payload$from:(_this$userSessionMana4=this.userSessionManager)===null||_this$userSessionMana4===void 0?void 0:_this$userSessionMana4.getUserId())!==null&&_ref2!==void 0?_ref2:(_this$userSessionMana5=this.userSessionManager)===null||_this$userSessionMana5===void 0?void 0:_this$userSessionMana5.getAnonymousId();(_this$eventManager5=this.eventManager)===null||_this$eventManager5===void 0||_this$eventManager5.addEvent({type:RudderEventType.Alias,to:payload.to,from:previousId,options:payload.options,callback:payload.callback});}},{key:"group",value:function group(payload){var _this$userSessionMana7,_this$eventManager6;var type='group';this.errorHandler.leaveBreadcrumb("New ".concat(type," event"));state.metrics.triggered.value+=1;if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,payload]);return;}// `null` value indicates that previous group ID needs to be retained
|
3709
|
+
if(!isNull(payload.groupId)){var _this$userSessionMana6;(_this$userSessionMana6=this.userSessionManager)===null||_this$userSessionMana6===void 0||_this$userSessionMana6.setGroupId(payload.groupId);}(_this$userSessionMana7=this.userSessionManager)===null||_this$userSessionMana7===void 0||_this$userSessionMana7.setGroupTraits(payload.traits);(_this$eventManager6=this.eventManager)===null||_this$eventManager6===void 0||_this$eventManager6.addEvent({type:RudderEventType.Group,groupId:payload.groupId,traits:payload.traits,options:payload.options,callback:payload.callback});}},{key:"reset",value:function reset(resetAnonymousId){var _this$userSessionMana8;var type='reset';this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation, resetAnonymousId: ").concat(resetAnonymousId));if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,resetAnonymousId]);return;}(_this$userSessionMana8=this.userSessionManager)===null||_this$userSessionMana8===void 0||_this$userSessionMana8.reset(resetAnonymousId);}},{key:"getAnonymousId",value:function getAnonymousId(options){var _this$userSessionMana9;return (_this$userSessionMana9=this.userSessionManager)===null||_this$userSessionMana9===void 0?void 0:_this$userSessionMana9.getAnonymousId(options);}},{key:"setAnonymousId",value:function setAnonymousId(anonymousId,rudderAmpLinkerParam){var _this$userSessionMana10;var type='setAnonymousId';// Buffering is needed as setting the anonymous ID may require invoking the GoogleLinker plugin
|
3710
|
+
if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,anonymousId,rudderAmpLinkerParam]);return;}(_this$userSessionMana10=this.userSessionManager)===null||_this$userSessionMana10===void 0||_this$userSessionMana10.setAnonymousId(anonymousId,rudderAmpLinkerParam);}// eslint-disable-next-line class-methods-use-this
|
3834
3711
|
},{key:"getUserId",value:function getUserId(){return state.session.userId.value;}// eslint-disable-next-line class-methods-use-this
|
3835
3712
|
},{key:"getUserTraits",value:function getUserTraits(){return state.session.userTraits.value;}// eslint-disable-next-line class-methods-use-this
|
3836
3713
|
},{key:"getGroupId",value:function getGroupId(){return state.session.groupId.value;}// eslint-disable-next-line class-methods-use-this
|
3837
|
-
},{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana11;var type='startSession';this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,sessionId]);return;}(_this$userSessionMana11=this.userSessionManager)===null||_this$userSessionMana11===void 0
|
3838
|
-
},{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana13
|
3714
|
+
},{key:"getGroupTraits",value:function getGroupTraits(){return state.session.groupTraits.value;}},{key:"startSession",value:function startSession(sessionId){var _this$userSessionMana11;var type='startSession';this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type,sessionId]);return;}(_this$userSessionMana11=this.userSessionManager)===null||_this$userSessionMana11===void 0||_this$userSessionMana11.start(sessionId);}},{key:"endSession",value:function endSession(){var _this$userSessionMana12;var type='endSession';this.errorHandler.leaveBreadcrumb("New ".concat(type," invocation"));if(!state.lifecycle.loaded.value){state.eventBuffer.toBeProcessedArray.value.push([type]);return;}(_this$userSessionMana12=this.userSessionManager)===null||_this$userSessionMana12===void 0||_this$userSessionMana12.end();}// eslint-disable-next-line class-methods-use-this
|
3715
|
+
},{key:"getSessionId",value:function getSessionId(){var _this$userSessionMana13;var sessionId=(_this$userSessionMana13=this.userSessionManager)===null||_this$userSessionMana13===void 0?void 0:_this$userSessionMana13.getSessionId();return sessionId!==null&&sessionId!==void 0?sessionId:null;}// End consumer exposed methods
|
3839
3716
|
}]);return Analytics;}();
|
3840
3717
|
|
3841
3718
|
/*
|
@@ -3853,7 +3730,7 @@ this.triggerBufferedLoadEvent();}/**
|
|
3853
3730
|
* Set instance to use if no specific writeKey is provided in methods
|
3854
3731
|
* automatically for the first created instance
|
3855
3732
|
* TODO: to support multiple analytics instances in the near future
|
3856
|
-
*/_createClass(RudderAnalytics,[{key:"setDefaultInstanceKey",value:function setDefaultInstanceKey(writeKey){if(
|
3733
|
+
*/_createClass(RudderAnalytics,[{key:"setDefaultInstanceKey",value:function setDefaultInstanceKey(writeKey){if(writeKey){this.defaultAnalyticsKey=writeKey;}}/**
|
3857
3734
|
* Retrieve an existing analytics instance
|
3858
3735
|
*/},{key:"getAnalyticsInstance",value:function getAnalyticsInstance(writeKey){var instanceId=writeKey!==null&&writeKey!==void 0?writeKey:this.defaultAnalyticsKey;var analyticsInstanceExists=Boolean(this.analyticsInstances[instanceId]);if(!analyticsInstanceExists){this.analyticsInstances[instanceId]=new Analytics();}return this.analyticsInstances[instanceId];}/**
|
3859
3736
|
* Create new analytics instance and trigger application lifecycle start
|