@rakutenanalytics/rat-react 0.3.2-rel.0 → 0.3.3-rel.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.js +284 -265
- package/package.json +24 -22
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
import { useState as F, useEffect as R, createContext as se, useContext as ce, useRef as K, useCallback as _e } from "react";
|
|
2
2
|
import { jsx as z } from "react/jsx-runtime";
|
|
3
|
-
var ue = Object.defineProperty, pe = (
|
|
3
|
+
var ue = Object.defineProperty, pe = (a, e, s) => e in a ? ue(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s, P = (a, e, s) => pe(a, typeof e != "symbol" ? e + "" : e, s), k, X = -1, S = function(a) {
|
|
4
4
|
addEventListener("pageshow", function(e) {
|
|
5
|
-
e.persisted && (X = e.timeStamp,
|
|
5
|
+
e.persisted && (X = e.timeStamp, a(e));
|
|
6
6
|
}, !0);
|
|
7
7
|
}, D = function() {
|
|
8
|
-
var
|
|
9
|
-
if (
|
|
8
|
+
var a = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
9
|
+
if (a && a.responseStart > 0 && a.responseStart < performance.now()) return a;
|
|
10
10
|
}, O = function() {
|
|
11
|
-
var
|
|
12
|
-
return
|
|
13
|
-
}, T = function(
|
|
11
|
+
var a = D();
|
|
12
|
+
return a && a.activationStart || 0;
|
|
13
|
+
}, T = function(a, e) {
|
|
14
14
|
var s = D(), _ = "navigate";
|
|
15
|
-
return X >= 0 ? _ = "back-forward-cache" : s && (document.prerendering || O() > 0 ? _ = "prerender" : document.wasDiscarded ? _ = "restore" : s.type && (_ = s.type.replace(/_/g, "-"))), { name:
|
|
16
|
-
}, v = function(
|
|
15
|
+
return X >= 0 ? _ = "back-forward-cache" : s && (document.prerendering || O() > 0 ? _ = "prerender" : document.wasDiscarded ? _ = "restore" : s.type && (_ = s.type.replace(/_/g, "-"))), { name: a, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: _ };
|
|
16
|
+
}, v = function(a, e, s) {
|
|
17
17
|
try {
|
|
18
|
-
if (PerformanceObserver.supportedEntryTypes.includes(
|
|
18
|
+
if (PerformanceObserver.supportedEntryTypes.includes(a)) {
|
|
19
19
|
var _ = new PerformanceObserver(function(t) {
|
|
20
20
|
Promise.resolve().then(function() {
|
|
21
21
|
e(t.getEntries());
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
|
-
return _.observe(Object.assign({ type:
|
|
24
|
+
return _.observe(Object.assign({ type: a, buffered: !0 }, s || {})), _;
|
|
25
25
|
}
|
|
26
26
|
} catch {
|
|
27
27
|
}
|
|
28
|
-
}, d = function(
|
|
28
|
+
}, d = function(a, e, s, _) {
|
|
29
29
|
var t, r;
|
|
30
|
-
return function(
|
|
31
|
-
e.value >= 0 && (
|
|
30
|
+
return function(n) {
|
|
31
|
+
e.value >= 0 && (n || _) && ((r = e.value - (t || 0)) || t === void 0) && (t = e.value, e.delta = r, e.rating = (function(i, o) {
|
|
32
32
|
return i > o[1] ? "poor" : i > o[0] ? "needs-improvement" : "good";
|
|
33
|
-
})(e.value, s),
|
|
33
|
+
})(e.value, s), a(e));
|
|
34
34
|
};
|
|
35
|
-
}, B = function(
|
|
35
|
+
}, B = function(a) {
|
|
36
36
|
requestAnimationFrame(function() {
|
|
37
37
|
return requestAnimationFrame(function() {
|
|
38
|
-
return
|
|
38
|
+
return a();
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
-
}, N = function(
|
|
41
|
+
}, N = function(a) {
|
|
42
42
|
document.addEventListener("visibilitychange", function() {
|
|
43
|
-
document.visibilityState === "hidden" &&
|
|
43
|
+
document.visibilityState === "hidden" && a();
|
|
44
44
|
});
|
|
45
|
-
}, H = function(
|
|
45
|
+
}, H = function(a) {
|
|
46
46
|
var e = !1;
|
|
47
47
|
return function() {
|
|
48
|
-
e || (
|
|
48
|
+
e || (a(), e = !0);
|
|
49
49
|
};
|
|
50
50
|
}, E = -1, W = function() {
|
|
51
51
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
52
|
-
}, L = function(
|
|
53
|
-
document.visibilityState === "hidden" && E > -1 && (E =
|
|
52
|
+
}, L = function(a) {
|
|
53
|
+
document.visibilityState === "hidden" && E > -1 && (E = a.type === "visibilitychange" ? a.timeStamp : 0, le());
|
|
54
54
|
}, G = function() {
|
|
55
55
|
addEventListener("visibilitychange", L, !0), addEventListener("prerenderingchange", L, !0);
|
|
56
56
|
}, le = function() {
|
|
@@ -63,43 +63,43 @@ var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable
|
|
|
63
63
|
})), { get firstHiddenTime() {
|
|
64
64
|
return E;
|
|
65
65
|
} };
|
|
66
|
-
}, b = function(
|
|
66
|
+
}, b = function(a) {
|
|
67
67
|
document.prerendering ? addEventListener("prerenderingchange", function() {
|
|
68
|
-
return
|
|
69
|
-
}, !0) :
|
|
70
|
-
}, j = [1800, 3e3], $ = function(
|
|
68
|
+
return a();
|
|
69
|
+
}, !0) : a();
|
|
70
|
+
}, j = [1800, 3e3], $ = function(a, e) {
|
|
71
71
|
e = e || {}, b(function() {
|
|
72
|
-
var s, _ = J(), t = T("FCP"), r = v("paint", function(
|
|
73
|
-
|
|
72
|
+
var s, _ = J(), t = T("FCP"), r = v("paint", function(n) {
|
|
73
|
+
n.forEach(function(i) {
|
|
74
74
|
i.name === "first-contentful-paint" && (r.disconnect(), i.startTime < _.firstHiddenTime && (t.value = Math.max(i.startTime - O(), 0), t.entries.push(i), s(!0)));
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
|
-
r && (s = d(
|
|
78
|
-
t = T("FCP"), s = d(
|
|
79
|
-
t.value = performance.now() -
|
|
77
|
+
r && (s = d(a, t, j, e.reportAllChanges), S(function(n) {
|
|
78
|
+
t = T("FCP"), s = d(a, t, j, e.reportAllChanges), B(function() {
|
|
79
|
+
t.value = performance.now() - n.timeStamp, s(!0);
|
|
80
80
|
});
|
|
81
81
|
}));
|
|
82
82
|
});
|
|
83
|
-
}, Y = [0.1, 0.25], me = function(
|
|
83
|
+
}, Y = [0.1, 0.25], me = function(a, e) {
|
|
84
84
|
e = e || {}, $(H(function() {
|
|
85
|
-
var s, _ = T("CLS", 0), t = 0, r = [],
|
|
85
|
+
var s, _ = T("CLS", 0), t = 0, r = [], n = function(o) {
|
|
86
86
|
o.forEach(function(c) {
|
|
87
87
|
if (!c.hadRecentInput) {
|
|
88
88
|
var u = r[0], l = r[r.length - 1];
|
|
89
89
|
t && c.startTime - l.startTime < 1e3 && c.startTime - u.startTime < 5e3 ? (t += c.value, r.push(c)) : (t = c.value, r = [c]);
|
|
90
90
|
}
|
|
91
91
|
}), t > _.value && (_.value = t, _.entries = r, s());
|
|
92
|
-
}, i = v("layout-shift",
|
|
93
|
-
i && (s = d(
|
|
94
|
-
|
|
92
|
+
}, i = v("layout-shift", n);
|
|
93
|
+
i && (s = d(a, _, Y, e.reportAllChanges), N(function() {
|
|
94
|
+
n(i.takeRecords()), s(!0);
|
|
95
95
|
}), S(function() {
|
|
96
|
-
t = 0, _ = T("CLS", 0), s = d(
|
|
96
|
+
t = 0, _ = T("CLS", 0), s = d(a, _, Y, e.reportAllChanges), B(function() {
|
|
97
97
|
return s();
|
|
98
98
|
});
|
|
99
99
|
}), setTimeout(s, 0));
|
|
100
100
|
}));
|
|
101
|
-
}, Z = 0, w = 1 / 0, C = 0, he = function(
|
|
102
|
-
|
|
101
|
+
}, Z = 0, w = 1 / 0, C = 0, he = function(a) {
|
|
102
|
+
a.forEach(function(e) {
|
|
103
103
|
e.interactionId && (w = Math.min(w, e.interactionId), C = Math.max(C, e.interactionId), Z = C ? (C - w) / 7 + 1 : 0);
|
|
104
104
|
});
|
|
105
105
|
}, ee = function() {
|
|
@@ -107,17 +107,17 @@ var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable
|
|
|
107
107
|
}, ge = function() {
|
|
108
108
|
"interactionCount" in performance || k || (k = v("event", he, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
109
109
|
}, g = [], A = /* @__PURE__ */ new Map(), te = 0, Te = function() {
|
|
110
|
-
var
|
|
111
|
-
return g[
|
|
112
|
-
}, de = [], fe = function(
|
|
110
|
+
var a = Math.min(g.length - 1, Math.floor((ee() - te) / 50));
|
|
111
|
+
return g[a];
|
|
112
|
+
}, de = [], fe = function(a) {
|
|
113
113
|
if (de.forEach(function(t) {
|
|
114
|
-
return t(
|
|
115
|
-
}),
|
|
116
|
-
var e = g[g.length - 1], s = A.get(
|
|
117
|
-
if (s || g.length < 10 ||
|
|
118
|
-
if (s)
|
|
114
|
+
return t(a);
|
|
115
|
+
}), a.interactionId || a.entryType === "first-input") {
|
|
116
|
+
var e = g[g.length - 1], s = A.get(a.interactionId);
|
|
117
|
+
if (s || g.length < 10 || a.duration > e.latency) {
|
|
118
|
+
if (s) a.duration > s.latency ? (s.entries = [a], s.latency = a.duration) : a.duration === s.latency && a.startTime === s.entries[0].startTime && s.entries.push(a);
|
|
119
119
|
else {
|
|
120
|
-
var _ = { id:
|
|
120
|
+
var _ = { id: a.interactionId, latency: a.duration, entries: [a] };
|
|
121
121
|
A.set(_.id, _), g.push(_);
|
|
122
122
|
}
|
|
123
123
|
g.sort(function(t, r) {
|
|
@@ -127,10 +127,10 @@ var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
}, re = function(
|
|
130
|
+
}, re = function(a) {
|
|
131
131
|
var e = self.requestIdleCallback || self.setTimeout, s = -1;
|
|
132
|
-
return
|
|
133
|
-
}, Q = [200, 500], ye = function(
|
|
132
|
+
return a = H(a), document.visibilityState === "hidden" ? a() : (s = e(a), N(a)), s;
|
|
133
|
+
}, Q = [200, 500], ye = function(a, e) {
|
|
134
134
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, b(function() {
|
|
135
135
|
var s;
|
|
136
136
|
ge();
|
|
@@ -140,53 +140,53 @@ var ue = Object.defineProperty, pe = (n, e, s) => e in n ? ue(n, e, { enumerable
|
|
|
140
140
|
var o = Te();
|
|
141
141
|
o && o.latency !== t.value && (t.value = o.latency, t.entries = o.entries, _());
|
|
142
142
|
});
|
|
143
|
-
},
|
|
144
|
-
_ = d(
|
|
145
|
-
r(
|
|
143
|
+
}, n = v("event", r, { durationThreshold: (s = e.durationThreshold) !== null && s !== void 0 ? s : 40 });
|
|
144
|
+
_ = d(a, t, Q, e.reportAllChanges), n && (n.observe({ type: "first-input", buffered: !0 }), N(function() {
|
|
145
|
+
r(n.takeRecords()), _(!0);
|
|
146
146
|
}), S(function() {
|
|
147
|
-
te = ee(), g.length = 0, A.clear(), t = T("INP"), _ = d(
|
|
147
|
+
te = ee(), g.length = 0, A.clear(), t = T("INP"), _ = d(a, t, Q, e.reportAllChanges);
|
|
148
148
|
}));
|
|
149
149
|
}));
|
|
150
|
-
}, x = [2500, 4e3], V = {}, Ee = function(
|
|
150
|
+
}, x = [2500, 4e3], V = {}, Ee = function(a, e) {
|
|
151
151
|
e = e || {}, b(function() {
|
|
152
152
|
var s, _ = J(), t = T("LCP"), r = function(o) {
|
|
153
153
|
e.reportAllChanges || (o = o.slice(-1)), o.forEach(function(c) {
|
|
154
154
|
c.startTime < _.firstHiddenTime && (t.value = Math.max(c.startTime - O(), 0), t.entries = [c], s());
|
|
155
155
|
});
|
|
156
|
-
},
|
|
157
|
-
if (
|
|
158
|
-
s = d(
|
|
156
|
+
}, n = v("largest-contentful-paint", r);
|
|
157
|
+
if (n) {
|
|
158
|
+
s = d(a, t, x, e.reportAllChanges);
|
|
159
159
|
var i = H(function() {
|
|
160
|
-
V[t.id] || (r(
|
|
160
|
+
V[t.id] || (r(n.takeRecords()), n.disconnect(), V[t.id] = !0, s(!0));
|
|
161
161
|
});
|
|
162
162
|
["keydown", "click"].forEach(function(o) {
|
|
163
163
|
addEventListener(o, function() {
|
|
164
164
|
return re(i);
|
|
165
165
|
}, { once: !0, capture: !0 });
|
|
166
166
|
}), N(i), S(function(o) {
|
|
167
|
-
t = T("LCP"), s = d(
|
|
167
|
+
t = T("LCP"), s = d(a, t, x, e.reportAllChanges), B(function() {
|
|
168
168
|
t.value = performance.now() - o.timeStamp, V[t.id] = !0, s(!0);
|
|
169
169
|
});
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
|
-
}, q = [800, 1800], Se = function
|
|
173
|
+
}, q = [800, 1800], Se = function a(e) {
|
|
174
174
|
document.prerendering ? b(function() {
|
|
175
|
-
return
|
|
175
|
+
return a(e);
|
|
176
176
|
}) : document.readyState !== "complete" ? addEventListener("load", function() {
|
|
177
|
-
return
|
|
177
|
+
return a(e);
|
|
178
178
|
}, !0) : setTimeout(e, 0);
|
|
179
|
-
}, Pe = function(
|
|
179
|
+
}, Pe = function(a, e) {
|
|
180
180
|
e = e || {};
|
|
181
|
-
var s = T("TTFB"), _ = d(
|
|
181
|
+
var s = T("TTFB"), _ = d(a, s, q, e.reportAllChanges);
|
|
182
182
|
Se(function() {
|
|
183
183
|
var t = D();
|
|
184
184
|
t && (s.value = Math.max(t.responseStart - O(), 0), s.entries = [t], _(!0), S(function() {
|
|
185
|
-
s = T("TTFB", 0), (_ = d(
|
|
185
|
+
s = T("TTFB", 0), (_ = d(a, s, q, e.reportAllChanges))(!0);
|
|
186
186
|
}));
|
|
187
187
|
});
|
|
188
188
|
};
|
|
189
|
-
function ve(
|
|
189
|
+
function ve(a = []) {
|
|
190
190
|
const e = {};
|
|
191
191
|
e.ParameterTypes = {
|
|
192
192
|
/** Account ID. */
|
|
@@ -360,10 +360,10 @@ function ve(n = []) {
|
|
|
360
360
|
get: function() {
|
|
361
361
|
return t.__uach_full_version_list;
|
|
362
362
|
},
|
|
363
|
-
set: function(
|
|
364
|
-
if (Array.isArray(
|
|
363
|
+
set: function(n) {
|
|
364
|
+
if (Array.isArray(n))
|
|
365
365
|
try {
|
|
366
|
-
t.__uach_full_version_list =
|
|
366
|
+
t.__uach_full_version_list = n.reduce(function(i, o, c) {
|
|
367
367
|
return i += (c ? ", " : "") + '"' + o.brand + '";v="' + o.version + '"', i;
|
|
368
368
|
}, "");
|
|
369
369
|
} catch (i) {
|
|
@@ -376,14 +376,14 @@ function ve(n = []) {
|
|
|
376
376
|
get: function() {
|
|
377
377
|
return t.__uach_wow64;
|
|
378
378
|
},
|
|
379
|
-
set: function(
|
|
380
|
-
t.__uach_wow64 = (!!
|
|
379
|
+
set: function(n) {
|
|
380
|
+
t.__uach_wow64 = (!!n).toString();
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
384
|
var r = function() {
|
|
385
|
-
var
|
|
386
|
-
|
|
385
|
+
var n = navigator.userAgentData.getHighEntropyValues;
|
|
386
|
+
n = n.call(navigator.userAgentData, [
|
|
387
387
|
"architecture",
|
|
388
388
|
"bitness",
|
|
389
389
|
"model",
|
|
@@ -392,7 +392,7 @@ function ve(n = []) {
|
|
|
392
392
|
"wow64"
|
|
393
393
|
]).then(function(i) {
|
|
394
394
|
i && (t[e.ParameterTypes.UACH_ARCHITECTURE] = i.architecture, t[e.ParameterTypes.UACH_BITNESS] = i.bitness, t[e.ParameterTypes.UACH_FULL_VERSION_LIST] = i.fullVersionList, t[e.ParameterTypes.UACH_MODEL] = i.model, t[e.ParameterTypes.UACH_PLATFORM_VERSION] = i.platformVersion, t[e.ParameterTypes.UACH_WOW64] = i.wow64), e._asyncDelaysFlag = !1;
|
|
395
|
-
}),
|
|
395
|
+
}), n.catch(function() {
|
|
396
396
|
e._asyncDelaysFlag = !1;
|
|
397
397
|
});
|
|
398
398
|
};
|
|
@@ -413,14 +413,14 @@ function ve(n = []) {
|
|
|
413
413
|
return !!t && Object.prototype.toString.call(t) === "[object Object]";
|
|
414
414
|
}, e._mergeDictionaries = function(t, r) {
|
|
415
415
|
if (t && typeof t == "object" && r && typeof r == "object") {
|
|
416
|
-
for (var
|
|
417
|
-
t[
|
|
416
|
+
for (var n in r)
|
|
417
|
+
t[n] = r[n];
|
|
418
418
|
return !0;
|
|
419
419
|
}
|
|
420
420
|
return !1;
|
|
421
421
|
}, e._getCookie = function(t, r) {
|
|
422
|
-
var
|
|
423
|
-
if (
|
|
422
|
+
var n = e._trimString(t);
|
|
423
|
+
if (n === null)
|
|
424
424
|
return e._log("Empty cookie name!"), null;
|
|
425
425
|
r === void 0 && (r = document.cookie);
|
|
426
426
|
var i = r ? r.split(";") : "", o;
|
|
@@ -428,13 +428,13 @@ function ve(n = []) {
|
|
|
428
428
|
var c = i[o].indexOf("=");
|
|
429
429
|
if (c > 0) {
|
|
430
430
|
var u = e._trimString(i[o].substr(0, c));
|
|
431
|
-
if (u ===
|
|
431
|
+
if (u === n)
|
|
432
432
|
return i[o].substr(c + 1);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
return null;
|
|
436
|
-
}, e._setCookie = function(t, r,
|
|
437
|
-
var o = e._trimString(t), c = e._trimString(r), u = parseInt(
|
|
436
|
+
}, e._setCookie = function(t, r, n, i) {
|
|
437
|
+
var o = e._trimString(t), c = e._trimString(r), u = parseInt(n, 10);
|
|
438
438
|
if (o !== null && c !== null && !isNaN(u)) {
|
|
439
439
|
var l = /* @__PURE__ */ new Date();
|
|
440
440
|
u <= 0 ? l.setTime(0) : l.setDate(l.getDate() + u);
|
|
@@ -450,36 +450,36 @@ function ve(n = []) {
|
|
|
450
450
|
}, e._testCookieSupport = function(t) {
|
|
451
451
|
var r = e._KEY_PREFIX_MARKER + "TEST";
|
|
452
452
|
e._setCookie(r, r, 1, t);
|
|
453
|
-
var
|
|
454
|
-
return e._setCookie(r, "", 0, t),
|
|
453
|
+
var n = e._getCookie(r);
|
|
454
|
+
return e._setCookie(r, "", 0, t), n === r;
|
|
455
455
|
}, e._getQueryParam = function(t, r) {
|
|
456
456
|
t = e._trimString(t);
|
|
457
|
-
var
|
|
457
|
+
var n = RegExp("^" + t + "=");
|
|
458
458
|
if (r = r || document.location.search, r) {
|
|
459
459
|
for (var i = r.replace(/^\?/, "").split("&"), o = 0; o < i.length; o++)
|
|
460
|
-
if (
|
|
460
|
+
if (n.test(i[o]))
|
|
461
461
|
return decodeURIComponent(i[o].substring(t.length + 1));
|
|
462
462
|
}
|
|
463
463
|
return null;
|
|
464
464
|
}, e._hash = function(t, r) {
|
|
465
465
|
if (!e._isString(t))
|
|
466
466
|
return "0000";
|
|
467
|
-
var
|
|
468
|
-
for (
|
|
469
|
-
i[
|
|
467
|
+
var n, i = [0, 0, 0, 0];
|
|
468
|
+
for (n = 0; n < t.length; ++n)
|
|
469
|
+
i[n % 4] += t.charCodeAt(n);
|
|
470
470
|
var o = 0;
|
|
471
|
-
for (
|
|
472
|
-
o = (o << 4) + i[
|
|
471
|
+
for (n = 0; n < 4; ++n)
|
|
472
|
+
o = (o << 4) + i[n] % 16;
|
|
473
473
|
return r && (o = o ^ Math.floor(Math.random() * 65536)), ("0000" + o.toString(16)).slice(-4);
|
|
474
474
|
}, e._triggerCustomEvent = function(t, r) {
|
|
475
475
|
try {
|
|
476
|
-
var
|
|
476
|
+
var n;
|
|
477
477
|
if (window.CustomEvent && typeof window.CustomEvent == "function")
|
|
478
|
-
|
|
478
|
+
n = new CustomEvent(t, { detail: r }), document.dispatchEvent(n);
|
|
479
479
|
else if (document.createEvent)
|
|
480
|
-
|
|
480
|
+
n = document.createEvent("CustomEvent"), n.initCustomEvent(t, !0, !0, r), document.dispatchEvent(n);
|
|
481
481
|
else if (document.createEventObject && document.fireEvent)
|
|
482
|
-
|
|
482
|
+
n = document.createEventObject(), n.detail = r, document.fireEvent("onpropertychange", n);
|
|
483
483
|
else
|
|
484
484
|
throw new Error("Cannot instantiate event for " + t);
|
|
485
485
|
e._log("Event dispatched: " + t);
|
|
@@ -519,8 +519,8 @@ function ve(n = []) {
|
|
|
519
519
|
!e._isString(t) || t.length === 0 || this._targetUrls.forEach(function(r) {
|
|
520
520
|
try {
|
|
521
521
|
window.navigator.sendBeacon(r, e._POST_RAW_REQUEST_PARAMETER + t);
|
|
522
|
-
} catch (
|
|
523
|
-
e._log("Error in sending data: " +
|
|
522
|
+
} catch (n) {
|
|
523
|
+
e._log("Error in sending data: " + n.toString());
|
|
524
524
|
}
|
|
525
525
|
});
|
|
526
526
|
}, e.XHRTransport = function(t) {
|
|
@@ -528,8 +528,8 @@ function ve(n = []) {
|
|
|
528
528
|
}, Object.setPrototypeOf(e.XHRTransport.prototype, e.Transport.prototype), e.XHRTransport.prototype._getXHRProvider = function() {
|
|
529
529
|
return window.XMLHttpRequest ? (e._log("Using W3C XMLHttpRequest"), new XMLHttpRequest()) : (e._log("No XMLHttpRequest providers found!"), null);
|
|
530
530
|
}, e.XHRTransport.prototype.send = function(t, r) {
|
|
531
|
-
var
|
|
532
|
-
i ?
|
|
531
|
+
var n = this, i = n._getXHRProvider();
|
|
532
|
+
i ? n._targetUrls.forEach(function(o) {
|
|
533
533
|
r === "POST" ? (i.open("POST", o, !0), i.withCredentials = !0, i.send(e._POST_RAW_REQUEST_PARAMETER + t), e._log("Upload performed successfully")) : r === "GET" ? (i.open("GET", o + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t), !0), i.withCredentials = !0, i.send("")) : e._log("Invalid XMLHttpRequest method");
|
|
534
534
|
}) : e._log("No XMLHttpRequest support, removing data");
|
|
535
535
|
}, e.ParametersContainer = function(t) {
|
|
@@ -539,12 +539,12 @@ function ve(n = []) {
|
|
|
539
539
|
}, e.ParametersContainer.prototype._isValid = function(t) {
|
|
540
540
|
return t == null ? !1 : e._isString(t) ? e._trimString(t) !== "" : typeof t == "number" ? !isNaN(t) && isFinite(t) : !0;
|
|
541
541
|
}, e.ParametersContainer.prototype.insert = function(t, r) {
|
|
542
|
-
var
|
|
543
|
-
if (
|
|
542
|
+
var n = e._trimString(t);
|
|
543
|
+
if (n === null || n === "") {
|
|
544
544
|
e._log("Empty key!");
|
|
545
545
|
return;
|
|
546
546
|
}
|
|
547
|
-
|
|
547
|
+
n in this._parameters && e._log("Overwriting " + n), this._isValid(r) ? this._parameters[n] = typeof r == "string" ? e._trimString(r) : r : e._log("Invalid value for " + n);
|
|
548
548
|
}, e.ParametersContainer.prototype.remove = function(t) {
|
|
549
549
|
var r = e._trimString(t);
|
|
550
550
|
if (r === null || r === "") {
|
|
@@ -557,8 +557,8 @@ function ve(n = []) {
|
|
|
557
557
|
e._log("Invalid object type");
|
|
558
558
|
return;
|
|
559
559
|
}
|
|
560
|
-
for (var
|
|
561
|
-
this.insert(
|
|
560
|
+
for (var n in t)
|
|
561
|
+
this.insert(n, t[n]), r && (this._noMergeParameters[n] = !0);
|
|
562
562
|
}, e.ParametersContainer.prototype.mergeParameters = function(t) {
|
|
563
563
|
if (!e._isObject(t)) {
|
|
564
564
|
e._log("Invalid object type");
|
|
@@ -568,8 +568,8 @@ function ve(n = []) {
|
|
|
568
568
|
if (!this.hasKey(r) || this._noMergeParameters[r])
|
|
569
569
|
this.insert(r, t[r]);
|
|
570
570
|
else {
|
|
571
|
-
var
|
|
572
|
-
e._isArray(
|
|
571
|
+
var n = this.get(r);
|
|
572
|
+
e._isArray(n) && e._isArray(t[r]) ? this.insert(r, n.concat(t[r])) : e._isObject(n) && e._isObject(t[r]) ? e._mergeDictionaries(n, t[r]) : this.insert(r, t[r]);
|
|
573
573
|
}
|
|
574
574
|
}, e.ParametersContainer.prototype.serialize = function() {
|
|
575
575
|
return JSON.stringify(this._parameters);
|
|
@@ -599,8 +599,8 @@ function ve(n = []) {
|
|
|
599
599
|
if (r.length > 1e3)
|
|
600
600
|
return !1;
|
|
601
601
|
e._setCookie(this._marker + t, encodeURIComponent(String(r)), 365);
|
|
602
|
-
var
|
|
603
|
-
return
|
|
602
|
+
var n = e._getCookie(this._marker + t);
|
|
603
|
+
return n !== null && decodeURIComponent(n) === r;
|
|
604
604
|
}, e.CookieStorage.prototype.getForKey = function(t) {
|
|
605
605
|
var r = e._getCookie(this._marker + t);
|
|
606
606
|
return r == null ? null : decodeURIComponent(r);
|
|
@@ -609,9 +609,9 @@ function ve(n = []) {
|
|
|
609
609
|
}, e.CookieStorage.prototype.clear = function() {
|
|
610
610
|
var t = document.cookie && document.cookie.split(";"), r;
|
|
611
611
|
for (r = 0; r < t.length; r++) {
|
|
612
|
-
var
|
|
613
|
-
if (
|
|
614
|
-
var i = e._trimString(t[r].substr(0,
|
|
612
|
+
var n = t[r].indexOf("=");
|
|
613
|
+
if (n > 0) {
|
|
614
|
+
var i = e._trimString(t[r].substr(0, n)) || "";
|
|
615
615
|
i.indexOf(this._marker) === 0 && this.removeKey(i.substring(this._marker.length));
|
|
616
616
|
}
|
|
617
617
|
}
|
|
@@ -622,8 +622,8 @@ function ve(n = []) {
|
|
|
622
622
|
}, e.LocalStorage.prototype.setForKey = function(t, r) {
|
|
623
623
|
try {
|
|
624
624
|
return window.localStorage.setItem(this._marker + t, r), !0;
|
|
625
|
-
} catch (
|
|
626
|
-
e._log("Could not write to local storage: " +
|
|
625
|
+
} catch (n) {
|
|
626
|
+
e._log("Could not write to local storage: " + n.toString());
|
|
627
627
|
}
|
|
628
628
|
return !1;
|
|
629
629
|
}, e.LocalStorage.prototype.getForKey = function(t) {
|
|
@@ -662,12 +662,12 @@ function ve(n = []) {
|
|
|
662
662
|
this._container = {};
|
|
663
663
|
}, e.RamStorage.prototype.hasKey = function(t) {
|
|
664
664
|
return t in this._container;
|
|
665
|
-
}, e.Library = function(t, r,
|
|
665
|
+
}, e.Library = function(t, r, n) {
|
|
666
666
|
this._startTime = /* @__PURE__ */ new Date();
|
|
667
667
|
var i = e._trimString(t);
|
|
668
668
|
if (!i)
|
|
669
669
|
throw "Missing URL!";
|
|
670
|
-
this._targetUrls = [i], this._tabName = void 0, this._pageId = void 0, this._pageViewId = "pv", this._sessionCookieName = "Rp", this._persistentCookieName = "Rz", this._isOnline = navigator && "onLine" in navigator ? navigator.onLine : !0, this._parameters = new e.ParametersContainer(), this._storage = this._getStorageProvider(), this._currentLocation = null, this._reportingInterval = e._DEFAULT_ANALYTICS_INTERVAL, this._storageKey = r || e._OFFLINE_STORAGE_KEY, this._vacuumCallback =
|
|
670
|
+
this._targetUrls = [i], this._tabName = void 0, this._pageId = void 0, this._pageViewId = "pv", this._sessionCookieName = "Rp", this._persistentCookieName = "Rz", this._isOnline = navigator && "onLine" in navigator ? navigator.onLine : !0, this._parameters = new e.ParametersContainer(), this._storage = this._getStorageProvider(), this._currentLocation = null, this._reportingInterval = e._DEFAULT_ANALYTICS_INTERVAL, this._storageKey = r || e._OFFLINE_STORAGE_KEY, this._vacuumCallback = n || function(y) {
|
|
671
671
|
return !0;
|
|
672
672
|
}, this._allowXHR = !0, this._eventQueue = [], this._requestCount = 0;
|
|
673
673
|
var o = this;
|
|
@@ -688,8 +688,8 @@ function ve(n = []) {
|
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
}, e.Library.prototype._getMaxQueryStringSize = function() {
|
|
691
|
-
var t = this._targetUrls.reduce(function(r,
|
|
692
|
-
return Math.max(
|
|
691
|
+
var t = this._targetUrls.reduce(function(r, n) {
|
|
692
|
+
return Math.max(n.length, r);
|
|
693
693
|
}, 0);
|
|
694
694
|
return 2048 - (t + e._GET_RAW_REQUEST_PARAMETER.length);
|
|
695
695
|
}, e.Library.prototype.setMainReceiver = function(t) {
|
|
@@ -713,18 +713,18 @@ function ve(n = []) {
|
|
|
713
713
|
}, e.Library.prototype._normalizeScheme = function(t) {
|
|
714
714
|
var r = t.match(/^(?:https?:)?(?:\/\/)?(.*)$/);
|
|
715
715
|
return "https://" + r[1];
|
|
716
|
-
}, e.Library.prototype._callbackBinder = function(t, r,
|
|
716
|
+
}, e.Library.prototype._callbackBinder = function(t, r, n) {
|
|
717
717
|
var i = t;
|
|
718
718
|
return function() {
|
|
719
|
-
var o =
|
|
720
|
-
return o = Array.prototype.slice.call(arguments[0] ? arguments : [window.event], 0), o = o.concat(
|
|
719
|
+
var o = n || arguments;
|
|
720
|
+
return o = Array.prototype.slice.call(arguments[0] ? arguments : [window.event], 0), o = o.concat(n), i.apply(r || window, o);
|
|
721
721
|
};
|
|
722
722
|
}, e.Library.prototype._vacuum = function(t) {
|
|
723
723
|
if (!this._vacuumCallback || !e._isArray(t) || t.length === 0)
|
|
724
724
|
return null;
|
|
725
|
-
var r = [],
|
|
726
|
-
for (
|
|
727
|
-
var i = t[
|
|
725
|
+
var r = [], n;
|
|
726
|
+
for (n = 0; n < t.length; n++) {
|
|
727
|
+
var i = t[n];
|
|
728
728
|
this._vacuumCallback(JSON.parse(i)) && r.push(i);
|
|
729
729
|
}
|
|
730
730
|
return r;
|
|
@@ -734,8 +734,8 @@ function ve(n = []) {
|
|
|
734
734
|
return !1;
|
|
735
735
|
var t = "ral_localstorage_test", r = "ral_localstorage_test_item";
|
|
736
736
|
window.localStorage.setItem(t, r);
|
|
737
|
-
var
|
|
738
|
-
return window.localStorage.removeItem(t),
|
|
737
|
+
var n = window.localStorage.getItem(t) === r;
|
|
738
|
+
return window.localStorage.removeItem(t), n;
|
|
739
739
|
} catch {
|
|
740
740
|
return !1;
|
|
741
741
|
}
|
|
@@ -816,8 +816,8 @@ function ve(n = []) {
|
|
|
816
816
|
}, e.Library.prototype.setRequestResult = function(t) {
|
|
817
817
|
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.REQUEST_RESULT, t);
|
|
818
818
|
}, e.Library.prototype._formatTimestamp = function(t) {
|
|
819
|
-
var r = t.getMonth() + 1,
|
|
820
|
-
return t.getFullYear() + "-" + (r < 10 ? "0" : "") + r + "-" + (
|
|
819
|
+
var r = t.getMonth() + 1, n = t.getDate(), i = t.getHours(), o = t.getMinutes(), c = t.getSeconds();
|
|
820
|
+
return t.getFullYear() + "-" + (r < 10 ? "0" : "") + r + "-" + (n < 10 ? "0" : "") + n + " " + (i < 10 ? "0" : "") + i + ":" + (o < 10 ? "0" : "") + o + ":" + (c < 10 ? "0" : "") + c;
|
|
821
821
|
}, e.Library.prototype.setPageName = function(t) {
|
|
822
822
|
this._isObjectOrNull(t) || this._parameters.insert(e.ParameterTypes.PAGE_NAME, t);
|
|
823
823
|
}, e.Library.prototype.setPageType = function(t) {
|
|
@@ -828,8 +828,8 @@ function ve(n = []) {
|
|
|
828
828
|
if (t) {
|
|
829
829
|
var r = t;
|
|
830
830
|
if (this._parameters.hasKey(e.ParameterTypes.CUSTOM)) {
|
|
831
|
-
var
|
|
832
|
-
e._mergeDictionaries(
|
|
831
|
+
var n = this._parameters.get(e.ParameterTypes.CUSTOM);
|
|
832
|
+
e._mergeDictionaries(n, t) && (r = n);
|
|
833
833
|
}
|
|
834
834
|
this._parameters.insert(e.ParameterTypes.CUSTOM, r);
|
|
835
835
|
}
|
|
@@ -844,23 +844,23 @@ function ve(n = []) {
|
|
|
844
844
|
}
|
|
845
845
|
for (var r in t)
|
|
846
846
|
if (this._parameters.hasKey(r)) {
|
|
847
|
-
var
|
|
848
|
-
typeof
|
|
847
|
+
var n = this._parameters.get(r);
|
|
848
|
+
typeof n != "object" && (n = []), this._parameters.insert(r, [].concat(n).concat(t[r]));
|
|
849
849
|
} else
|
|
850
850
|
typeof t[r] == "object" ? this._parameters.insert(r, t[r]) : this._parameters.insert(r, [t[r]]);
|
|
851
851
|
}, e.Library.prototype.setOptions = function(t) {
|
|
852
852
|
if (e._isArray(t)) {
|
|
853
|
-
for (var r = {},
|
|
854
|
-
r[t[
|
|
853
|
+
for (var r = {}, n = 0, i = t.length; n < i; ++n)
|
|
854
|
+
r[t[n]] = !0;
|
|
855
855
|
this._setAutoParameters(r);
|
|
856
856
|
}
|
|
857
857
|
}, e.Library.prototype._isRequestInternal = function() {
|
|
858
858
|
return window.navigator.userAgent !== void 0 && window.navigator.userAgent.search(/RAL/i) !== -1;
|
|
859
859
|
}, e.Library.prototype.detectFlashVersion = function() {
|
|
860
860
|
if (document.images) {
|
|
861
|
-
var t = null, r = !1,
|
|
862
|
-
if (navigator.mimeTypes && navigator.mimeTypes[
|
|
863
|
-
var i = navigator.mimeTypes[
|
|
861
|
+
var t = null, r = !1, n = "application/x-shockwave-flash";
|
|
862
|
+
if (navigator.mimeTypes && navigator.mimeTypes[n]) {
|
|
863
|
+
var i = navigator.mimeTypes[n];
|
|
864
864
|
i.enabledPlugin && i.enabledPlugin.description && (t = i.enabledPlugin.description, r = !0);
|
|
865
865
|
} else if (navigator.plugins && "Shockwave Flash" in navigator.plugins) {
|
|
866
866
|
var o = navigator.plugins["Shockwave Flash"];
|
|
@@ -910,8 +910,8 @@ function ve(n = []) {
|
|
|
910
910
|
if (t = r.toString(16) + (r * 17 & 65535).toString(16), window.sessionStorage)
|
|
911
911
|
try {
|
|
912
912
|
window.sessionStorage.setItem(e._KEY_PREFIX_MARKER + e._TAB_ID_KEY, t);
|
|
913
|
-
} catch (
|
|
914
|
-
e._log("Could not write to session storage: " +
|
|
913
|
+
} catch (n) {
|
|
914
|
+
e._log("Could not write to session storage: " + n.toString()), this._tabName = t;
|
|
915
915
|
}
|
|
916
916
|
else
|
|
917
917
|
this._tabName = t;
|
|
@@ -920,8 +920,8 @@ function ve(n = []) {
|
|
|
920
920
|
}, e.Library.prototype._getPageId = function() {
|
|
921
921
|
var t = this._pageId;
|
|
922
922
|
if (!t) {
|
|
923
|
-
var r = e._hash(document.location.href, !0),
|
|
924
|
-
t = r +
|
|
923
|
+
var r = e._hash(document.location.href, !0), n = e._hash(document.referrer, !0), i = e._hash(navigator.userAgent, !0), o = e._hash((/* @__PURE__ */ new Date()).getTime().toString(), !0);
|
|
924
|
+
t = r + n + i + o, this._pageId = t;
|
|
925
925
|
}
|
|
926
926
|
return t;
|
|
927
927
|
}, e.Library.prototype.resetPageId = function() {
|
|
@@ -956,10 +956,10 @@ function ve(n = []) {
|
|
|
956
956
|
}
|
|
957
957
|
}, e.Library.prototype._getBrowserTimings = function() {
|
|
958
958
|
if ("performance" in window) {
|
|
959
|
-
var t, r,
|
|
959
|
+
var t, r, n = !1;
|
|
960
960
|
if (window.performance.getEntriesByType("navigation")) {
|
|
961
961
|
var i = window.performance.getEntriesByType("navigation").length;
|
|
962
|
-
t = window.performance.getEntriesByType("navigation")[i - 1],
|
|
962
|
+
t = window.performance.getEntriesByType("navigation")[i - 1], n = !0;
|
|
963
963
|
}
|
|
964
964
|
if (window.performance.timing && (r = window.performance.timing), !(window.performance.timing || window.performance.getEntriesByType("navigation")))
|
|
965
965
|
return;
|
|
@@ -975,7 +975,7 @@ function ve(n = []) {
|
|
|
975
975
|
c = !0;
|
|
976
976
|
}
|
|
977
977
|
try {
|
|
978
|
-
o[e.ParameterTypes.TOTAL_PAGE_LOAD_TIME] =
|
|
978
|
+
o[e.ParameterTypes.TOTAL_PAGE_LOAD_TIME] = n ? this._getTotalPageLoadTime(t, n) : this._getTotalPageLoadTime(r, n);
|
|
979
979
|
} catch {
|
|
980
980
|
c = !0;
|
|
981
981
|
}
|
|
@@ -1015,8 +1015,8 @@ function ve(n = []) {
|
|
|
1015
1015
|
}, e.Library.prototype._getFingerPrint = function() {
|
|
1016
1016
|
var t, r = e._KEY_PREFIX_MARKER + e._FPRINT_KEY;
|
|
1017
1017
|
if (window.sessionStorage && (t = window.sessionStorage.getItem(r), !t)) {
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1018
|
+
var n = document.createElement("script");
|
|
1019
|
+
n.type = "text/javascript", n.src = "//a.ichiba.jp.rakuten-static.com/com/rat/js/common/fingerprint2.min.js", n.onload = function() {
|
|
1020
1020
|
try {
|
|
1021
1021
|
new Fingerprint2().get(function(o) {
|
|
1022
1022
|
try {
|
|
@@ -1030,7 +1030,7 @@ function ve(n = []) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
1032
|
var i = document.getElementsByTagName("script")[0];
|
|
1033
|
-
i.parentNode.insertBefore(
|
|
1033
|
+
i.parentNode.insertBefore(n, i);
|
|
1034
1034
|
}
|
|
1035
1035
|
return t;
|
|
1036
1036
|
}, e.Library.prototype.webVitals = {
|
|
@@ -1038,13 +1038,13 @@ function ve(n = []) {
|
|
|
1038
1038
|
_cache: {},
|
|
1039
1039
|
_isSendPerf: !1,
|
|
1040
1040
|
_sentMetrics: [],
|
|
1041
|
-
sendPerfListener: function(t, r,
|
|
1041
|
+
sendPerfListener: function(t, r, n) {
|
|
1042
1042
|
var i = this;
|
|
1043
|
-
i._isSendPerf && i.sendWebVitalsPerf(t, r,
|
|
1043
|
+
i._isSendPerf && i.sendWebVitalsPerf(t, r, n);
|
|
1044
1044
|
},
|
|
1045
1045
|
initialize: function(t) {
|
|
1046
1046
|
if (!(!e._WEB_VITALS || this._initialized) && "sendBeacon" in window.navigator) {
|
|
1047
|
-
var r = new e.SendBeaconTransport(t._targetUrls),
|
|
1047
|
+
var r = new e.SendBeaconTransport(t._targetUrls), n = t._getBrowserTimings.bind(t), i = t._parameters, o = this, c = o._cache, u = document.getElementById("ratAccountId"), l = document.getElementById("ratServiceId");
|
|
1048
1048
|
this._isSendPerf = Math.random() < e._WEB_VITALS_SAMPLING_RATIO, u ? c.acc = u.getAttribute("value") : e._log("webVitals.initialize: ratAccountId input tag not found"), l && (c.aid = l.getAttribute("value")), c.SCRIPT_VER = e._WEB_VITALS_SCRIPT_VERSION, c.UID = e._createUUID(), Object.defineProperties(o, {
|
|
1049
1049
|
FCP: {
|
|
1050
1050
|
get: function() {
|
|
@@ -1105,23 +1105,23 @@ function ve(n = []) {
|
|
|
1105
1105
|
});
|
|
1106
1106
|
var h = e._WEB_VITALS.onFCP;
|
|
1107
1107
|
h(function(p) {
|
|
1108
|
-
o._cache.FCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i,
|
|
1108
|
+
o._cache.FCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
|
|
1109
1109
|
});
|
|
1110
1110
|
var m = e._WEB_VITALS.onLCP;
|
|
1111
1111
|
m(function(p) {
|
|
1112
|
-
o._cache.LCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i,
|
|
1112
|
+
o._cache.LCP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
|
|
1113
1113
|
});
|
|
1114
1114
|
var y = e._WEB_VITALS.onCLS;
|
|
1115
1115
|
y(function(p) {
|
|
1116
|
-
o._cache.CLS = p.value.toFixed(3), o._isSendPerf && o.sendWebVitalsPerf(i,
|
|
1116
|
+
o._cache.CLS = p.value.toFixed(3), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
|
|
1117
1117
|
});
|
|
1118
1118
|
var f = e._WEB_VITALS.onTTFB;
|
|
1119
1119
|
f(function(p) {
|
|
1120
|
-
o._cache.TTFB = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i,
|
|
1120
|
+
o._cache.TTFB = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
|
|
1121
1121
|
});
|
|
1122
1122
|
var I = e._WEB_VITALS.onINP;
|
|
1123
1123
|
I(function(p) {
|
|
1124
|
-
o._cache.INP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i,
|
|
1124
|
+
o._cache.INP = Math.round(p.value), o._isSendPerf && o.sendWebVitalsPerf(i, n, r);
|
|
1125
1125
|
}), o._initialized = !0;
|
|
1126
1126
|
}
|
|
1127
1127
|
},
|
|
@@ -1134,12 +1134,12 @@ function ve(n = []) {
|
|
|
1134
1134
|
* @param {Object} transport used to send events (SendBeaconTransport instance)
|
|
1135
1135
|
* @private
|
|
1136
1136
|
*/
|
|
1137
|
-
sendWebVitalsPerf: function(t, r,
|
|
1137
|
+
sendWebVitalsPerf: function(t, r, n) {
|
|
1138
1138
|
var i = this.needsToSendMetric(this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP) && this.needsToSendMetric(this._cache.LCP, e.ParameterTypes.WEB_VITALS_LCP) && this.needsToSendMetric(this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB), o = this.needsToSendMetric(this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS) || this.needsToSendMetric(this._cache.INP, e.ParameterTypes.WEB_VITALS_INP);
|
|
1139
1139
|
if (!(!i && !o) && this._cache.acc && (this._cache.acc = parseInt(this._cache.acc, 10), !isNaN(parseInt(this._cache.acc, 10)))) {
|
|
1140
1140
|
this._cache.aid || (this._cache.aid = e._DEFAULT_SERVICE_ID), e.callQueue = e.callQueue || [];
|
|
1141
1141
|
var c = this.buildPerfData(t, r());
|
|
1142
|
-
|
|
1142
|
+
n.send(JSON.stringify(c)), [
|
|
1143
1143
|
e.ParameterTypes.WEB_VITALS_FCP,
|
|
1144
1144
|
e.ParameterTypes.WEB_VITALS_LCP,
|
|
1145
1145
|
e.ParameterTypes.WEB_VITALS_CLS,
|
|
@@ -1158,7 +1158,7 @@ function ve(n = []) {
|
|
|
1158
1158
|
* @private
|
|
1159
1159
|
*/
|
|
1160
1160
|
buildPerfData: function(t, r) {
|
|
1161
|
-
var
|
|
1161
|
+
var n = {};
|
|
1162
1162
|
return [
|
|
1163
1163
|
e.ParameterTypes.URL,
|
|
1164
1164
|
e.ParameterTypes.USER_AGENT,
|
|
@@ -1174,7 +1174,7 @@ function ve(n = []) {
|
|
|
1174
1174
|
e.ParameterTypes.SESSION_COOKIE_FLAG,
|
|
1175
1175
|
e.ParameterTypes.SESSION_COOKIE_2
|
|
1176
1176
|
].forEach(function(i) {
|
|
1177
|
-
t.hasKey(i) && (
|
|
1177
|
+
t.hasKey(i) && (n[i] = t.get(i));
|
|
1178
1178
|
}), [
|
|
1179
1179
|
[this._cache.FCP, e.ParameterTypes.WEB_VITALS_FCP],
|
|
1180
1180
|
[this._cache.CLS, e.ParameterTypes.WEB_VITALS_CLS],
|
|
@@ -1182,15 +1182,15 @@ function ve(n = []) {
|
|
|
1182
1182
|
[this._cache.TTFB, e.ParameterTypes.WEB_VITALS_TTFB],
|
|
1183
1183
|
[this._cache.INP, e.ParameterTypes.WEB_VITALS_INP]
|
|
1184
1184
|
].forEach(function(i) {
|
|
1185
|
-
this.needsToSendMetric(i[0], i[1]) && (
|
|
1186
|
-
}, this),
|
|
1185
|
+
this.needsToSendMetric(i[0], i[1]) && (n[i[1]] = i[0]);
|
|
1186
|
+
}, this), n[e.ParameterTypes.WEB_VITALS_SCRIPT_VERSION] = e._WEB_VITALS_SCRIPT_VERSION, n[e.ParameterTypes.WEB_VITALS_UNIQUE_IDENTIFIER] = this._cache.UID, [
|
|
1187
1187
|
e.ParameterTypes.TOTAL_PAGE_LOAD_TIME,
|
|
1188
1188
|
e.ParameterTypes.ASYNC_TIMING,
|
|
1189
1189
|
e.ParameterTypes.LOAD_TIMING,
|
|
1190
1190
|
e.ParameterTypes.REQUEST_TIMING
|
|
1191
1191
|
].forEach(function(i) {
|
|
1192
|
-
r.hasOwnProperty(i) && (
|
|
1193
|
-
}),
|
|
1192
|
+
r.hasOwnProperty(i) && (n[i] = r[i]);
|
|
1193
|
+
}), n[e.ParameterTypes.EVENT_TYPE] = "perf", n;
|
|
1194
1194
|
},
|
|
1195
1195
|
/**
|
|
1196
1196
|
* Checks whether metric needs to be sent.
|
|
@@ -1201,8 +1201,8 @@ function ve(n = []) {
|
|
|
1201
1201
|
* @private
|
|
1202
1202
|
*/
|
|
1203
1203
|
needsToSendMetric: function(t, r) {
|
|
1204
|
-
var
|
|
1205
|
-
return
|
|
1204
|
+
var n = t !== void 0, i = this._sentMetrics.indexOf(r) === -1;
|
|
1205
|
+
return n && i;
|
|
1206
1206
|
}
|
|
1207
1207
|
}, e.Library.prototype._setAutoParameters = function(t) {
|
|
1208
1208
|
(!t || t[e.ParameterTypes.SCRIPT_START_TIME]) && this._parameters.insert(e.ParameterTypes.SCRIPT_START_TIME, this._formatTimestamp(this._startTime)), (!t || t[e.ParameterTypes.URL]) && (this._parameters.hasKey(e.ParameterTypes.URL) || this._parameters.insert(e.ParameterTypes.URL, this._getURL())), (!t || t[e.ParameterTypes.REFERRER]) && (this._parameters.hasKey(e.ParameterTypes.REFERRER) || this._parameters.insert(e.ParameterTypes.REFERRER, this._getReferrer())), (!t || t[e.ParameterTypes.TAB_ID]) && this._parameters.insert(e.ParameterTypes.TAB_ID, this._getTabName()), (!t || t[e.ParameterTypes.TIMEZONE]) && this._parameters.insert(e.ParameterTypes.TIMEZONE, this._getTimezone()), (!t || t[e.ParameterTypes.RESOLUTION]) && this._parameters.insert(e.ParameterTypes.RESOLUTION, this._getScreenResolution()), (!t || t[e.ParameterTypes.JAVA_PRESENT]) && this._parameters.insert(e.ParameterTypes.JAVA_PRESENT, this._isJavaEnabled()), (!t || t[e.ParameterTypes.BROWSER_LANGUAGE]) && this._parameters.insert(e.ParameterTypes.BROWSER_LANGUAGE, this._getBrowserLanguage()), (!t || t[e.ParameterTypes.USER_AGENT]) && (this._parameters.hasKey(e.ParameterTypes.USER_AGENT) || this._parameters.insert(e.ParameterTypes.USER_AGENT, this._getUserAgent())), (!t || t[e.ParameterTypes.ONLINE_STATUS]) && this._parameters.insert(e.ParameterTypes.ONLINE_STATUS, this._isOnline), (!t || t[e.ParameterTypes.VERSION]) && this._parameters.insert(e.ParameterTypes.VERSION, e._sdkVersion), (!t || t[e.ParameterTypes.SDK_SOURCE]) && this._parameters.insert(e.ParameterTypes.SDK_SOURCE, e._sdkSource), (!t || t[e.ParameterTypes.LOCATION]) && (this._currentLocation === null ? this._parameters.remove(e.ParameterTypes.LOCATION) : this._parameters.insert(e.ParameterTypes.LOCATION, this._currentLocation)), (!t || t.perf) && this._parameters.mergeParameters(this._getBrowserTimings()), (!t || t[e.ParameterTypes.NAV_TYPE]) && this._parameters.insert(e.ParameterTypes.NAV_TYPE, this._getNavigationType()), (!t || t[e.ParameterTypes.IFRAME_STATUS]) && this._parameters.insert(e.ParameterTypes.IFRAME_STATUS, this._isFrame()), (!t || t[e.ParameterTypes.UACH_ARCHITECTURE]) && (this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture())), (!t || t[e.ParameterTypes.UACH_BITNESS]) && (this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness())), (!t || t[e.ParameterTypes.UACH_FULL_VERSION_LIST]) && (this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList())), (!t || t[e.ParameterTypes.UACH_MODEL]) && (this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel())), (!t || t[e.ParameterTypes.UACH_PLATFORM_VERSION]) && (this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion())), (!t || t[e.ParameterTypes.UACH_WOW64]) && (this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64())), t && t[e.ParameterTypes.WEB_VITALS_LCP] && this._parameters.insert(
|
|
@@ -1241,8 +1241,8 @@ function ve(n = []) {
|
|
|
1241
1241
|
e._log("Using img transport");
|
|
1242
1242
|
try {
|
|
1243
1243
|
for (var r = 0; r < this._targetUrls.length; ++r) {
|
|
1244
|
-
var
|
|
1245
|
-
|
|
1244
|
+
var n = document.createElement("img");
|
|
1245
|
+
n.src = this._targetUrls[r] + e._GET_RAW_REQUEST_PARAMETER + encodeURIComponent(t) + "&t=" + (/* @__PURE__ */ new Date()).getTime();
|
|
1246
1246
|
}
|
|
1247
1247
|
} catch (i) {
|
|
1248
1248
|
return e._log("Single item upload failed: " + i.toString()), !1;
|
|
@@ -1254,8 +1254,8 @@ function ve(n = []) {
|
|
|
1254
1254
|
return !0;
|
|
1255
1255
|
var r = t.length === 1 ? t[0] : "[" + t.join(",") + "]";
|
|
1256
1256
|
e._activeTransport.send(r, "POST");
|
|
1257
|
-
} catch (
|
|
1258
|
-
return e._log("Bulk upload failed: " +
|
|
1257
|
+
} catch (n) {
|
|
1258
|
+
return e._log("Bulk upload failed: " + n.toString()), !1;
|
|
1259
1259
|
}
|
|
1260
1260
|
return !0;
|
|
1261
1261
|
}, e.Library.prototype._sendRecords = function(t) {
|
|
@@ -1264,7 +1264,7 @@ function ve(n = []) {
|
|
|
1264
1264
|
var r = !0;
|
|
1265
1265
|
return t.length === 1 ? encodeURIComponent(t[0]).length < this._getMaxQueryStringSize() ? r = !this._allowXHR && e._transportMethod !== "beacon" ? this._sendSingleRecordImg(t[0]) : this._sendSingleRecord(t[0]) : (e._log("Record too big to send via GET (" + encodeURIComponent(t[0]).length + " characters vs. " + this._getMaxQueryStringSize() + " characters max)"), r = this._sendMultipleRecords(t)) : (this._allowXHR || e._transportMethod === "beacon" ? r = this._sendMultipleRecords(t) : r = !1, r && e._log("All items successfully sent")), r;
|
|
1266
1266
|
}, e.Library.prototype._spoolData = function(t, r) {
|
|
1267
|
-
var
|
|
1267
|
+
var n = null;
|
|
1268
1268
|
if (t.hasKey(e.ParameterTypes.ACCOUNT_ID)) {
|
|
1269
1269
|
var i;
|
|
1270
1270
|
if (/\bsplash\b/i.test(navigator.userAgent) ? i = "splash_agent" : i = this._getSessionCookie(), t.insert(e.ParameterTypes.SESSION_COOKIE, i), /\bra_uid\b/.test(document.cookie)) {
|
|
@@ -1280,19 +1280,19 @@ function ve(n = []) {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
}
|
|
1282
1282
|
var h = e._getCookie(e._DEFAULT_ANALYTICS_COOKIE);
|
|
1283
|
-
t.insert(e.ParameterTypes.ANALYTICS_COOKIE, h), t.hasKey(e.ParameterTypes.SESSION_COOKIE) ? (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !0), t.insert(e.ParameterTypes.SESSION_COOKIE_2, t.get(e.ParameterTypes.SESSION_COOKIE))) : (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !1), t.insert(e.ParameterTypes.SESSION_COOKIE_2, h)), t.insert(e.ParameterTypes.PERSISTENT_COOKIE, this._getPersistentCookie()), this._setCookies(t, ["Rg", "Rt", "BTA001"]),
|
|
1283
|
+
t.insert(e.ParameterTypes.ANALYTICS_COOKIE, h), t.hasKey(e.ParameterTypes.SESSION_COOKIE) ? (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !0), t.insert(e.ParameterTypes.SESSION_COOKIE_2, t.get(e.ParameterTypes.SESSION_COOKIE))) : (t.insert(e.ParameterTypes.SESSION_COOKIE_FLAG, !1), t.insert(e.ParameterTypes.SESSION_COOKIE_2, h)), t.insert(e.ParameterTypes.PERSISTENT_COOKIE, this._getPersistentCookie()), this._setCookies(t, ["Rg", "Rt", "BTA001"]), n = t.serialize();
|
|
1284
1284
|
var m = this._getOfflineEvents();
|
|
1285
|
-
m.length >= e._RECORDS_LIMIT_COUNT && (e._log("Too many records, vacuuming"), m = this._vacuum(m) || m),
|
|
1286
|
-
var y = this._addOfflineEvent(
|
|
1285
|
+
m.length >= e._RECORDS_LIMIT_COUNT && (e._log("Too many records, vacuuming"), m = this._vacuum(m) || m), n.length + m.join().length > e._RECORDS_LIMIT_TOTAL_SIZE && (e._log("Data block too large, vacuuming"), m = this._vacuum(m) || m);
|
|
1286
|
+
var y = this._addOfflineEvent(n);
|
|
1287
1287
|
if (y) {
|
|
1288
|
-
if (
|
|
1288
|
+
if (n = null, r)
|
|
1289
1289
|
return;
|
|
1290
1290
|
} else
|
|
1291
1291
|
e._log("Unable to save data to offline storage");
|
|
1292
1292
|
}
|
|
1293
1293
|
if (this._isOnline) {
|
|
1294
1294
|
var f = this._getOfflineEvents();
|
|
1295
|
-
|
|
1295
|
+
n && f.push(n);
|
|
1296
1296
|
var I = Math.min(f.length, e._RECORDS_CHUNK_LENGTH);
|
|
1297
1297
|
I != f.length ? e._log("Too many records to send in one single operation (" + f.length + " vs " + e._RECORDS_CHUNK_LENGTH + " maximum)") : e._log("Record count threshold not crossed, sending all records in one go");
|
|
1298
1298
|
var p = f.splice(0, I), ie = this._sendRecords(p);
|
|
@@ -1310,8 +1310,8 @@ function ve(n = []) {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
}, e.Library.prototype._setCookies = function(t, r) {
|
|
1312
1312
|
if (e._isArray(r))
|
|
1313
|
-
for (var
|
|
1314
|
-
|
|
1313
|
+
for (var n, i, o = 0; o < r.length; o++)
|
|
1314
|
+
n = r[o], i = e._getCookie(n), i !== null && t.insert(n, decodeURIComponent(i));
|
|
1315
1315
|
}, e.Library.prototype._onlineListener = function(t) {
|
|
1316
1316
|
t = t || window.event, this._isOnline = t.type === "online", e._log("Online status change: " + (this._isOnline ? "Online" : "Offline"));
|
|
1317
1317
|
}, e.Library.prototype._hasOfflineEvents = function() {
|
|
@@ -1332,8 +1332,8 @@ function ve(n = []) {
|
|
|
1332
1332
|
}, e.Library.prototype._addOfflineEvent = function(t) {
|
|
1333
1333
|
var r = !1;
|
|
1334
1334
|
if (t) {
|
|
1335
|
-
var
|
|
1336
|
-
|
|
1335
|
+
var n = this._getOfflineEvents();
|
|
1336
|
+
n.push(t), r = this._storage.setForKey(this._storageKey, n.join(" "));
|
|
1337
1337
|
}
|
|
1338
1338
|
return r;
|
|
1339
1339
|
}, e.Library.prototype._setPosition = function(t) {
|
|
@@ -1367,8 +1367,8 @@ function ve(n = []) {
|
|
|
1367
1367
|
this._parameters.hasKey(e.ParameterTypes.ACCOUNT_ID) && (this._parameters.insert(e.ParameterTypes.PAGE_ID, this._getPageId()), (!this._parameters.hasKey(e.ParameterTypes.SERVICE_ID) || this._parameters.get(e.ParameterTypes.SERVICE_ID) == null) && this._parameters.insert(e.ParameterTypes.SERVICE_ID, e._DEFAULT_SERVICE_ID), this._parameters.hasKey(e.ParameterTypes.UACH_ARCHITECTURE) || this._parameters.insert(e.ParameterTypes.UACH_ARCHITECTURE, this._getUserAgentClientHintArchitecture()), this._parameters.hasKey(e.ParameterTypes.UACH_BITNESS) || this._parameters.insert(e.ParameterTypes.UACH_BITNESS, this._getUserAgentClientHintBitness()), this._parameters.hasKey(e.ParameterTypes.UACH_FULL_VERSION_LIST) || this._parameters.insert(e.ParameterTypes.UACH_FULL_VERSION_LIST, this._getUserAgentClientHintFullVersionList()), this._parameters.hasKey(e.ParameterTypes.UACH_MODEL) || this._parameters.insert(e.ParameterTypes.UACH_MODEL, this._getUserAgentClientHintModel()), this._parameters.hasKey(e.ParameterTypes.UACH_PLATFORM_VERSION) || this._parameters.insert(e.ParameterTypes.UACH_PLATFORM_VERSION, this._getUserAgentClientHintPlatformVersion()), this._parameters.hasKey(e.ParameterTypes.UACH_WOW64) || this._parameters.insert(e.ParameterTypes.UACH_WOW64, this._getUserAgentClientHintWow64()), this._eventQueue.push(this._parameters), this._parameters = new e.ParametersContainer());
|
|
1368
1368
|
}, e.Library.prototype._normalizeEvents = function() {
|
|
1369
1369
|
this._queueEvent();
|
|
1370
|
-
for (var t = 0, r = 1,
|
|
1371
|
-
|
|
1370
|
+
for (var t = 0, r = 1, n, i; r < this._eventQueue.length; )
|
|
1371
|
+
n = this._eventQueue[t], i = this._eventQueue[r], n.get(e.ParameterTypes.ACCOUNT_ID) === i.get(e.ParameterTypes.ACCOUNT_ID) && n.get(e.ParameterTypes.SERVICE_ID) === i.get(e.ParameterTypes.SERVICE_ID) && n.get(e.ParameterTypes.EVENT_TYPE) === i.get(e.ParameterTypes.EVENT_TYPE) && n.shouldMergeSeries() ? (n.mergeParameters(i.clone()), this._eventQueue.splice(r, 1)) : (t++, r++);
|
|
1372
1372
|
}, e.Library.prototype.processQueue = function(t) {
|
|
1373
1373
|
var r = this;
|
|
1374
1374
|
if (!e._isArray(e.callQueue))
|
|
@@ -1376,10 +1376,10 @@ function ve(n = []) {
|
|
|
1376
1376
|
else {
|
|
1377
1377
|
e.callQueue.length && e._log(e.callQueue.length + " elements to process in the queue");
|
|
1378
1378
|
try {
|
|
1379
|
-
for (var
|
|
1380
|
-
|
|
1381
|
-
var i =
|
|
1382
|
-
i in this && this[i].apply(this,
|
|
1379
|
+
for (var n; e.callQueue.length > 0; ) {
|
|
1380
|
+
n = e.callQueue.shift();
|
|
1381
|
+
var i = n[0];
|
|
1382
|
+
i in this && this[i].apply(this, n.slice(1));
|
|
1383
1383
|
}
|
|
1384
1384
|
for (this._normalizeEvents(); this._eventQueue.length > 0; ) {
|
|
1385
1385
|
var o = this._eventQueue.length == 1;
|
|
@@ -1406,12 +1406,35 @@ function ve(n = []) {
|
|
|
1406
1406
|
_.processQueue(!1);
|
|
1407
1407
|
}, e.resetPageId = function() {
|
|
1408
1408
|
return _.resetPageId();
|
|
1409
|
-
}, e.callQueue =
|
|
1409
|
+
}, e.callQueue = a, setTimeout(function() {
|
|
1410
1410
|
_.processQueue(!0);
|
|
1411
1411
|
}, 1), e.live = !0, e;
|
|
1412
1412
|
}
|
|
1413
|
-
var
|
|
1414
|
-
const
|
|
1413
|
+
var ae = /* @__PURE__ */ ((a) => (a.XHR = "xhr", a.BEACON = "beacon", a))(ae || {});
|
|
1414
|
+
const Je = {
|
|
1415
|
+
/** Japan production endpoint */
|
|
1416
|
+
JP: "rat.rakuten.co.jp",
|
|
1417
|
+
/** Japan secure production endpoint */
|
|
1418
|
+
JP_SEC: "secure.rat.rakuten.co.jp",
|
|
1419
|
+
/** France production endpoint */
|
|
1420
|
+
FR: "rat.rakuten.fr",
|
|
1421
|
+
/** Germany production endpoint */
|
|
1422
|
+
DE: "rat.rakuten.de",
|
|
1423
|
+
/** Spain production endpoint */
|
|
1424
|
+
ES: "rat.rakuten.es",
|
|
1425
|
+
/** United Kingdom production endpoint */
|
|
1426
|
+
UK: "rat.rakuten.co.uk",
|
|
1427
|
+
/** Japan staging endpoint */
|
|
1428
|
+
STG_JP: "stg.rat.rakuten.co.jp",
|
|
1429
|
+
/** Japan secure staging endpoint */
|
|
1430
|
+
STG_JP_SEC: "stg.secure.rat.rakuten.co.jp",
|
|
1431
|
+
/** Japan testing endpoint */
|
|
1432
|
+
CHECK_JP: "check.rat.rakuten.co.jp",
|
|
1433
|
+
/** Japan secure testing endpoint */
|
|
1434
|
+
CHECK_JP_SEC: "check.secure.rat.rakuten.co.jp"
|
|
1435
|
+
};
|
|
1436
|
+
var Ie = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Ie || {}), Ce = /* @__PURE__ */ ((a) => (a[a.TEN = 10] = "TEN", a[a.TWENTY = 20] = "TWENTY", a[a.THIRTY = 30] = "THIRTY", a[a.FORTY = 40] = "FORTY", a[a.FIFTY = 50] = "FIFTY", a))(Ce || {}), Ae = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Ae || {}), Le = /* @__PURE__ */ ((a) => (a[a.NOT_APPLIED = 0] = "NOT_APPLIED", a[a.APPLIED = 1] = "APPLIED", a))(Le || {}), Re = /* @__PURE__ */ ((a) => (a[a.V1 = 1] = "V1", a[a.V2 = 2] = "V2", a[a.V3 = 3] = "V3", a[a.V4 = 4] = "V4", a))(Re || {}), Oe = /* @__PURE__ */ ((a) => (a[a.V1 = 1] = "V1", a[a.V2 = 2] = "V2", a))(Oe || {}), Ne = /* @__PURE__ */ ((a) => (a[a.TYPE0 = 0] = "TYPE0", a[a.TYPE1 = 1] = "TYPE1", a[a.TYPE2 = 2] = "TYPE2", a[a.TYPE3 = 3] = "TYPE3", a[a.TYPE255 = 255] = "TYPE255", a))(Ne || {}), be = /* @__PURE__ */ ((a) => (a.OR = "o", a.AND = "a", a.NO = "x", a))(be || {}), Ue = /* @__PURE__ */ ((a) => (a.PC = "PC", a.PC_LOWER = "pc", a.SP = "SP", a.SP_LOWER = "sp", a.TB = "TB", a.TB_LOWER = "tb", a.RESP = "RESP", a.RESP_LOWER = "resp", a))(Ue || {}), we = /* @__PURE__ */ ((a) => (a.TOP = "top", a.SEARCH = "search", a.SHOP_ITEM = "shop_item", a.CART_MODIFY = "cart_modify", a.CART_CHECKOUT = "cart_checkout", a))(we || {}), Ve = /* @__PURE__ */ ((a) => (a[a.V0 = 0] = "V0", a[a.V1 = 1] = "V1", a))(Ve || {}), ke = /* @__PURE__ */ ((a) => (a.NONE = "none", a.OR = "or", a.GENRE = "genre", a.NGRAM = "ngram", a))(ke || {});
|
|
1437
|
+
const Me = {
|
|
1415
1438
|
rpCookie: "Rp",
|
|
1416
1439
|
rzCookie: "Rz",
|
|
1417
1440
|
abTest: "abtest",
|
|
@@ -1433,7 +1456,6 @@ const Fe = {
|
|
|
1433
1456
|
idfaCookie: "cka",
|
|
1434
1457
|
persistentCookie: "ckp",
|
|
1435
1458
|
sessionCookie: "cks",
|
|
1436
|
-
sessionCookieV2: "cks2",
|
|
1437
1459
|
contentLanguage: "cntln",
|
|
1438
1460
|
componentId: "compid",
|
|
1439
1461
|
countryCode: "country",
|
|
@@ -1467,9 +1489,8 @@ const Fe = {
|
|
|
1467
1489
|
batteryUsage: "mbat",
|
|
1468
1490
|
mobileCarrierName: "mcn",
|
|
1469
1491
|
mobileCarrierNameForDualSim: "mcnd",
|
|
1470
|
-
media: "media",
|
|
1471
|
-
eventName: "event_name",
|
|
1472
1492
|
mobileNavigationTime: "mnavtime",
|
|
1493
|
+
mobileNetworkType: "mnetw",
|
|
1473
1494
|
mobileDeviceBrandModel: "model",
|
|
1474
1495
|
mobileOrientation: "mori",
|
|
1475
1496
|
mobileOs: "mos",
|
|
@@ -1496,7 +1517,6 @@ const Fe = {
|
|
|
1496
1517
|
reservedDate: "resdate",
|
|
1497
1518
|
reservationId: "reservation_id",
|
|
1498
1519
|
resultLayout: "reslayout",
|
|
1499
|
-
rgCookie: "Rg",
|
|
1500
1520
|
searchCondition: "scond",
|
|
1501
1521
|
searchEntity: "search_entity",
|
|
1502
1522
|
serviceType: "service",
|
|
@@ -1520,10 +1540,9 @@ const Fe = {
|
|
|
1520
1540
|
userId: "userid",
|
|
1521
1541
|
variantid: "variantid",
|
|
1522
1542
|
itemVariation: "variation",
|
|
1523
|
-
widowbirdPattern: "wb_pattern"
|
|
1524
|
-
userCookieJs: "_ra"
|
|
1543
|
+
widowbirdPattern: "wb_pattern"
|
|
1525
1544
|
};
|
|
1526
|
-
class
|
|
1545
|
+
class Fe {
|
|
1527
1546
|
constructor({
|
|
1528
1547
|
ral: e,
|
|
1529
1548
|
accountId: s,
|
|
@@ -1550,17 +1569,17 @@ class De {
|
|
|
1550
1569
|
this.ral.callQueue.push(["setCookieNames", JSON.stringify(e)]);
|
|
1551
1570
|
}
|
|
1552
1571
|
}
|
|
1553
|
-
function
|
|
1572
|
+
function De(a) {
|
|
1554
1573
|
const e = {};
|
|
1555
|
-
for (const s in
|
|
1556
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
1557
|
-
const _ =
|
|
1558
|
-
_ && (e[_] =
|
|
1574
|
+
for (const s in a)
|
|
1575
|
+
if (Object.prototype.hasOwnProperty.call(a, s)) {
|
|
1576
|
+
const _ = Me[s];
|
|
1577
|
+
_ && (e[_] = a[s]);
|
|
1559
1578
|
}
|
|
1560
1579
|
return e;
|
|
1561
1580
|
}
|
|
1562
|
-
const
|
|
1563
|
-
const
|
|
1581
|
+
const Be = () => {
|
|
1582
|
+
const a = navigator.userAgent, e = a.toLowerCase();
|
|
1564
1583
|
if (e.search(/ipod|iphone/) > -1)
|
|
1565
1584
|
return "iPhone";
|
|
1566
1585
|
if (e.search("ipad") > -1)
|
|
@@ -1584,12 +1603,12 @@ const He = () => {
|
|
|
1584
1603
|
return "Symbian";
|
|
1585
1604
|
if (e.search(/docomo|foma|kddi|softbank|vodafone|j-phone|willcom/) > -1)
|
|
1586
1605
|
return "Feature phone";
|
|
1587
|
-
if (
|
|
1606
|
+
if (a.search(/Win|Mac/) != -1)
|
|
1588
1607
|
return "PC";
|
|
1589
1608
|
}
|
|
1590
1609
|
return "Others";
|
|
1591
|
-
},
|
|
1592
|
-
class
|
|
1610
|
+
}, He = "0.6.3";
|
|
1611
|
+
class Ke {
|
|
1593
1612
|
/**
|
|
1594
1613
|
* Creates a new Tracker instance.
|
|
1595
1614
|
*
|
|
@@ -1625,8 +1644,8 @@ class We {
|
|
|
1625
1644
|
*/
|
|
1626
1645
|
constructor(e) {
|
|
1627
1646
|
P(this, "ral"), P(this, "ralConfig"), this.ral = ve();
|
|
1628
|
-
const s = e.sdkSource ?? "rat-ts", _ = e.sdkVersion ??
|
|
1629
|
-
this.ral.callQueue.push(["setSdkSource", s]), this.ral.callQueue.push(["setSdkVersion", _]), this.ralConfig = new
|
|
1647
|
+
const s = e.sdkSource ?? "rat-ts", _ = e.sdkVersion ?? He;
|
|
1648
|
+
this.ral.callQueue.push(["setSdkSource", s]), this.ral.callQueue.push(["setSdkVersion", _]), this.ralConfig = new Fe({ ral: this.ral, ...e }), this.ralConfig.setTransportMethod(e.transportMethod ?? ae.BEACON), e.mainReceiver && this.ralConfig.setMainReceiver(e.mainReceiver), e.customCookies && this.ralConfig.setCustomCookies(e.customCookies);
|
|
1630
1649
|
}
|
|
1631
1650
|
/**
|
|
1632
1651
|
* Sends a generic analytics event.
|
|
@@ -1653,18 +1672,18 @@ class We {
|
|
|
1653
1672
|
* ```
|
|
1654
1673
|
*/
|
|
1655
1674
|
sendEvent(e) {
|
|
1656
|
-
const { type: s, params: _, customParams: t, cvEvents: r, autoCollectedParams:
|
|
1675
|
+
const { type: s, params: _, customParams: t, cvEvents: r, autoCollectedParams: n } = e, { accountId: i, serviceId: o } = this.ralConfig;
|
|
1657
1676
|
if (this.ral.callQueue.push(["setAccountId", i]), this.ral.callQueue.push(["setServiceId", o]), this.ral.callQueue.push([
|
|
1658
1677
|
"setParameters",
|
|
1659
1678
|
{ js_ua: navigator.userAgent }
|
|
1660
1679
|
]), this.ral.callQueue.push([
|
|
1661
1680
|
"setParameters",
|
|
1662
|
-
{ js_devtype:
|
|
1681
|
+
{ js_devtype: Be() }
|
|
1663
1682
|
]), _) {
|
|
1664
|
-
const c =
|
|
1683
|
+
const c = De(_);
|
|
1665
1684
|
this.ral.callQueue.push(["setParameters", c]);
|
|
1666
1685
|
}
|
|
1667
|
-
t && this.ral.callQueue.push(["setCustomParameters", t]), r && this.ral.callQueue.push(["setParameters", { cv: r }]),
|
|
1686
|
+
t && this.ral.callQueue.push(["setCustomParameters", t]), r && this.ral.callQueue.push(["setParameters", { cv: r }]), n && n.length > 0 && this.ral.callQueue.push(["setOptions", n]), this.ral.callQueue.push(["setEvent", s]);
|
|
1668
1687
|
}
|
|
1669
1688
|
/**
|
|
1670
1689
|
* Sends a pageview event to track page visits.
|
|
@@ -1712,8 +1731,8 @@ class We {
|
|
|
1712
1731
|
*/
|
|
1713
1732
|
sendPageviewEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
|
|
1714
1733
|
if (e) {
|
|
1715
|
-
const { accountId: r, serviceId:
|
|
1716
|
-
if (!e.pageName && r === 7 &&
|
|
1734
|
+
const { accountId: r, serviceId: n } = this.ralConfig;
|
|
1735
|
+
if (!e.pageName && r === 7 && n === 12) {
|
|
1717
1736
|
let i = location.pathname.replace(".html", "").replace("index", "");
|
|
1718
1737
|
i == "/" && (i = "top"), e.pageName = i;
|
|
1719
1738
|
}
|
|
@@ -1723,7 +1742,7 @@ class We {
|
|
|
1723
1742
|
);
|
|
1724
1743
|
i && (e.pageName || (e.pageName = i[1] || "top"), e.siteSection || (e.siteSection = i[1] && i[1].split("/")[1] ? "/" + i[1].split("/")[1] : "top"));
|
|
1725
1744
|
}
|
|
1726
|
-
r === 1 &&
|
|
1745
|
+
r === 1 && n === 1 && document.getElementById("sc_betaInfo") && (e.testTargeting = e.testTargeting || {}, typeof e.testTargeting == "object" && e.testTargeting !== null && (e.testTargeting.ichiba_top = document.getElementById("sc_betaInfo").value));
|
|
1727
1746
|
}
|
|
1728
1747
|
this.sendEvent({ type: "pv", params: e, customParams: s, cvEvents: _, autoCollectedParams: t });
|
|
1729
1748
|
}
|
|
@@ -1771,8 +1790,8 @@ class We {
|
|
|
1771
1790
|
*/
|
|
1772
1791
|
sendClickEvent({ params: e, customParams: s, cvEvents: _, autoCollectedParams: t }) {
|
|
1773
1792
|
e && e.pageType && this.ral.callQueue.push(["setPageType", e.pageType]);
|
|
1774
|
-
const r = ["url", "ua"],
|
|
1775
|
-
this.sendEvent({ type: "click", params: e, customParams: s, cvEvents: _, autoCollectedParams:
|
|
1793
|
+
const r = ["url", "ua"], n = t ? [.../* @__PURE__ */ new Set([...r, ...t])] : r;
|
|
1794
|
+
this.sendEvent({ type: "click", params: e, customParams: s, cvEvents: _, autoCollectedParams: n });
|
|
1776
1795
|
}
|
|
1777
1796
|
/**
|
|
1778
1797
|
* Resets the page ID in the RAL instance.
|
|
@@ -1791,54 +1810,54 @@ class We {
|
|
|
1791
1810
|
this.ral.processImmediate();
|
|
1792
1811
|
}
|
|
1793
1812
|
}
|
|
1794
|
-
const
|
|
1795
|
-
function M(
|
|
1796
|
-
return new
|
|
1797
|
-
...
|
|
1798
|
-
sdkSource:
|
|
1799
|
-
sdkVersion:
|
|
1813
|
+
const We = "0.3.3-rel.0", Ge = "rat-react", je = We;
|
|
1814
|
+
function M(a) {
|
|
1815
|
+
return new Ke({
|
|
1816
|
+
...a,
|
|
1817
|
+
sdkSource: Ge,
|
|
1818
|
+
sdkVersion: je
|
|
1800
1819
|
});
|
|
1801
1820
|
}
|
|
1802
|
-
const $e = (
|
|
1803
|
-
const { accountId: e, serviceId: s } =
|
|
1821
|
+
const $e = (a) => {
|
|
1822
|
+
const { accountId: e, serviceId: s } = a, [_, t] = F(null);
|
|
1804
1823
|
return R(() => {
|
|
1805
|
-
const r = M(
|
|
1824
|
+
const r = M(a);
|
|
1806
1825
|
t(r);
|
|
1807
1826
|
}, [e, s]), _;
|
|
1808
|
-
},
|
|
1809
|
-
function
|
|
1810
|
-
if (!
|
|
1811
|
-
throw new Error(
|
|
1812
|
-
return
|
|
1827
|
+
}, Ye = "useTrackerContext must be used within a TrackerProvider";
|
|
1828
|
+
function Qe(a) {
|
|
1829
|
+
if (!a)
|
|
1830
|
+
throw new Error(Ye);
|
|
1831
|
+
return a;
|
|
1813
1832
|
}
|
|
1814
|
-
const
|
|
1833
|
+
const ne = se(
|
|
1815
1834
|
void 0
|
|
1816
1835
|
), Ze = () => {
|
|
1817
|
-
const
|
|
1818
|
-
return
|
|
1836
|
+
const a = ce(ne);
|
|
1837
|
+
return Qe(a);
|
|
1819
1838
|
};
|
|
1820
|
-
function
|
|
1839
|
+
function xe(a, e) {
|
|
1821
1840
|
const s = {};
|
|
1822
|
-
return
|
|
1841
|
+
return a.forEach(({ key: _, options: t }) => {
|
|
1823
1842
|
s[_] = e(t);
|
|
1824
1843
|
}), s;
|
|
1825
1844
|
}
|
|
1826
1845
|
const et = ({
|
|
1827
|
-
children:
|
|
1846
|
+
children: a,
|
|
1828
1847
|
defaultTrackers: e = []
|
|
1829
1848
|
}) => {
|
|
1830
1849
|
const [s, _] = F({});
|
|
1831
1850
|
R(() => {
|
|
1832
|
-
_(
|
|
1851
|
+
_(xe(e, M));
|
|
1833
1852
|
}, [e]);
|
|
1834
|
-
const t = (
|
|
1853
|
+
const t = (n, i) => {
|
|
1835
1854
|
const o = M(i);
|
|
1836
|
-
_((c) => ({ ...c, [
|
|
1837
|
-
}, r = (
|
|
1838
|
-
return /* @__PURE__ */ z(
|
|
1855
|
+
_((c) => ({ ...c, [n]: o }));
|
|
1856
|
+
}, r = (n) => s[n];
|
|
1857
|
+
return /* @__PURE__ */ z(ne.Provider, { value: { getTracker: r, addTracker: t }, children: a });
|
|
1839
1858
|
};
|
|
1840
|
-
function
|
|
1841
|
-
const { onChange: e, once: s = !0 } =
|
|
1859
|
+
function qe(a) {
|
|
1860
|
+
const { onChange: e, once: s = !0 } = a, [_, t] = F(!1), r = K(null), n = K(null), i = _e(
|
|
1842
1861
|
(o) => {
|
|
1843
1862
|
o.forEach((c) => {
|
|
1844
1863
|
var u;
|
|
@@ -1854,22 +1873,22 @@ function ze(n) {
|
|
|
1854
1873
|
threshold: 0.1
|
|
1855
1874
|
// always partial visibility
|
|
1856
1875
|
});
|
|
1857
|
-
const o =
|
|
1876
|
+
const o = n.current;
|
|
1858
1877
|
return o && r.current.observe(o), () => {
|
|
1859
1878
|
r.current && r.current.disconnect();
|
|
1860
1879
|
};
|
|
1861
|
-
}, [i]), { isVisible: _, containerRef:
|
|
1880
|
+
}, [i]), { isVisible: _, containerRef: n };
|
|
1862
1881
|
}
|
|
1863
1882
|
const tt = ({
|
|
1864
|
-
children:
|
|
1883
|
+
children: a,
|
|
1865
1884
|
tracker: e,
|
|
1866
1885
|
id: s,
|
|
1867
1886
|
onChange: _,
|
|
1868
1887
|
once: t = !0,
|
|
1869
1888
|
style: r,
|
|
1870
|
-
...
|
|
1889
|
+
...n
|
|
1871
1890
|
}) => {
|
|
1872
|
-
const { isVisible: i, containerRef: o } =
|
|
1891
|
+
const { isVisible: i, containerRef: o } = qe({
|
|
1873
1892
|
onChange: _,
|
|
1874
1893
|
once: t
|
|
1875
1894
|
});
|
|
@@ -1886,27 +1905,27 @@ const tt = ({
|
|
|
1886
1905
|
{
|
|
1887
1906
|
ref: o,
|
|
1888
1907
|
style: { overflow: "auto", ...r },
|
|
1889
|
-
...
|
|
1890
|
-
children:
|
|
1908
|
+
...n,
|
|
1909
|
+
children: a
|
|
1891
1910
|
}
|
|
1892
1911
|
);
|
|
1893
1912
|
};
|
|
1894
1913
|
export {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1914
|
+
Ie as AflgEnum,
|
|
1915
|
+
Ce as ChkoutEnum,
|
|
1916
|
+
Ae as IfrEnum,
|
|
1917
|
+
Le as IsscEnum,
|
|
1918
|
+
Re as MnetwEnum,
|
|
1919
|
+
Oe as MoriEnum,
|
|
1920
|
+
Ne as NavtypeEnum,
|
|
1921
|
+
be as OaEnum,
|
|
1922
|
+
Ue as PglEnum,
|
|
1923
|
+
we as PgtEnum,
|
|
1924
|
+
Ve as PowerstatusEnum,
|
|
1925
|
+
Je as ReceiverEndpoint,
|
|
1926
|
+
ke as SrtEnum,
|
|
1908
1927
|
et as TrackerProvider,
|
|
1909
|
-
|
|
1928
|
+
ae as TransportMethod,
|
|
1910
1929
|
tt as VisibilityTracker,
|
|
1911
1930
|
$e as useTracker,
|
|
1912
1931
|
Ze as useTrackerContext
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rakutenanalytics/rat-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3-rel.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -18,33 +18,17 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"build:production": "tsc -b ./tsconfig.lib.json && vite build --mode production",
|
|
25
|
-
"docs": "typedoc",
|
|
26
|
-
"docs:watch": "typedoc --watch",
|
|
27
|
-
"docs:serve": "typedoc && npx http-server docs/api -p 3001 -c-1",
|
|
28
|
-
"docs:deploy": "npm run docs && touch docs/api/.nojekyll && gh-pages -d docs/api -m 'Deploy documentation [skip ci]'",
|
|
29
|
-
"build:all": "npm run build && npm run docs",
|
|
30
|
-
"lint": "eslint .",
|
|
31
|
-
"preview": "vite preview",
|
|
32
|
-
"prepublishOnly": "npm run build:production",
|
|
33
|
-
"compat:legacy": "npm --prefix compat-tests/legacy install && npm --prefix compat-tests/legacy run typecheck",
|
|
34
|
-
"compat:modern": "npm --prefix compat-tests/modern install && npm --prefix compat-tests/modern run typecheck",
|
|
35
|
-
"compat:all": "npm run build && npm run compat:legacy && npm run compat:modern",
|
|
36
|
-
"test": "vitest run",
|
|
37
|
-
"test:watch": "vitest",
|
|
38
|
-
"test:run": "vitest run"
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/rakutenanalytics/rat-react"
|
|
39
24
|
},
|
|
40
|
-
"repository": "https://github.com/rakutenanalytics/rat-react",
|
|
41
25
|
"publishConfig": {
|
|
42
26
|
"registry": "https://registry.npmjs.org",
|
|
43
27
|
"access": "public"
|
|
44
28
|
},
|
|
45
29
|
"devDependencies": {
|
|
46
30
|
"@eslint/js": "^9.13.0",
|
|
47
|
-
"@types/node": "
|
|
31
|
+
"@types/node": "22.19.9",
|
|
48
32
|
"@types/react": "^18.3.11",
|
|
49
33
|
"@types/react-dom": "^18.3.1",
|
|
50
34
|
"@vitejs/plugin-react": "^4.3.3",
|
|
@@ -69,5 +53,23 @@
|
|
|
69
53
|
},
|
|
70
54
|
"dependencies": {
|
|
71
55
|
"@rakutenanalytics/rat-ts": "^0.6.2"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"dev": "vite",
|
|
59
|
+
"build": "tsc -b ./tsconfig.lib.json && vite build --mode staging",
|
|
60
|
+
"build:production": "tsc -b ./tsconfig.lib.json && vite build --mode production",
|
|
61
|
+
"docs": "typedoc",
|
|
62
|
+
"docs:watch": "typedoc --watch",
|
|
63
|
+
"docs:serve": "typedoc && pnpm dlx http-server docs/api -p 3001 -c-1",
|
|
64
|
+
"docs:deploy": "pnpm run docs && touch docs/api/.nojekyll && gh-pages -d docs/api -m 'Deploy documentation [skip ci]'",
|
|
65
|
+
"build:all": "pnpm run build && pnpm run docs",
|
|
66
|
+
"lint": "eslint .",
|
|
67
|
+
"preview": "vite preview",
|
|
68
|
+
"compat:legacy": "pnpm --dir compat-tests/legacy --ignore-workspace install --frozen-lockfile && pnpm --dir compat-tests/legacy --ignore-workspace run typecheck",
|
|
69
|
+
"compat:modern": "pnpm --dir compat-tests/modern --ignore-workspace install --frozen-lockfile && pnpm --dir compat-tests/modern --ignore-workspace run typecheck",
|
|
70
|
+
"compat:all": "pnpm run build && pnpm run compat:legacy && pnpm run compat:modern",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"test:watch": "vitest",
|
|
73
|
+
"test:run": "vitest run"
|
|
72
74
|
}
|
|
73
|
-
}
|
|
75
|
+
}
|