@jitsu/js 1.9.0-canary.583.20240115215752 → 1.9.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/.turbo/turbo-build.log +85 -85
- package/.turbo/turbo-clean.log +5 -5
- package/.turbo/turbo-test.log +239 -227
- package/__tests__/playwright/cases/callbacks.html +21 -0
- package/__tests__/playwright/integration.test.ts +26 -2
- package/dist/browser.d.ts +1 -1
- package/dist/jitsu.cjs.js +514 -36
- package/dist/jitsu.d.ts +4 -0
- package/dist/jitsu.es.js +514 -36
- package/dist/version.d.ts +1 -1
- package/dist/web/p.js.txt +532 -37
- package/package.json +3 -2
- package/src/analytics-plugin.ts +26 -1
- package/src/browser.ts +17 -2
- package/src/destination-plugins/gtm.ts +19 -30
- package/src/index.ts +10 -10
- package/src/jitsu.ts +5 -0
- package/src/version.ts +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
+
<title>Tracking page</title>
|
|
8
|
+
<script type="text/javascript" src="<%=trackingBase%>/p.js" defer></script>
|
|
9
|
+
<script>
|
|
10
|
+
(window.jitsuQ = window.jitsuQ || []).push(function (jitsu) {
|
|
11
|
+
jitsu.track("test-event1");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
(window.jitsuQ = window.jitsuQ || []).push(["track", "test-event2"]);
|
|
15
|
+
</script>
|
|
16
|
+
</head>
|
|
17
|
+
|
|
18
|
+
<body>
|
|
19
|
+
<h1>Test</h1>
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
|
@@ -191,7 +191,31 @@ function describeEvent(type: string, body: any) {
|
|
|
191
191
|
.join(", ");
|
|
192
192
|
return `${type}${type === "track" ? `(${body.event})` : ""}[${params}]`;
|
|
193
193
|
}
|
|
194
|
+
|
|
195
|
+
function clearRequestLog() {
|
|
196
|
+
requestLog.length = 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
test("jitsu-queue-callbacks", async ({ browser }) => {
|
|
200
|
+
clearRequestLog();
|
|
201
|
+
const browserContext = await browser.newContext();
|
|
202
|
+
const { page, uncaughtErrors } = await createLoggingPage(browserContext);
|
|
203
|
+
const [pageResult] = await Promise.all([page.goto(`${server.baseUrl}/callbacks.html`)]);
|
|
204
|
+
await page.waitForFunction(() => window["jitsu"] !== undefined, undefined, {
|
|
205
|
+
timeout: 1000,
|
|
206
|
+
polling: 100,
|
|
207
|
+
});
|
|
208
|
+
//wait for some time since the server has an artificial latency of 30ms
|
|
209
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
210
|
+
console.log(
|
|
211
|
+
`📝 Request log size of ${requestLog.length}`,
|
|
212
|
+
requestLog.map(x => describeEvent(x.type, x.body))
|
|
213
|
+
);
|
|
214
|
+
expect(requestLog.length).toBe(3);
|
|
215
|
+
});
|
|
216
|
+
|
|
194
217
|
test("url-bug", async ({ browser }) => {
|
|
218
|
+
clearRequestLog();
|
|
195
219
|
//tests a bug in getanalytics.io where the url without slash provided by
|
|
196
220
|
//<link rel="canonical" ../> causes incorrect page path
|
|
197
221
|
const browserContext = await browser.newContext();
|
|
@@ -221,7 +245,7 @@ test("url-bug", async ({ browser }) => {
|
|
|
221
245
|
});
|
|
222
246
|
|
|
223
247
|
test("basic", async ({ browser }) => {
|
|
224
|
-
|
|
248
|
+
clearRequestLog();
|
|
225
249
|
const browserContext = await browser.newContext();
|
|
226
250
|
|
|
227
251
|
const { page: firstPage, uncaughtErrors: firstPageErrors } = await createLoggingPage(browserContext);
|
|
@@ -290,7 +314,7 @@ test("basic", async ({ browser }) => {
|
|
|
290
314
|
timeout: 1000,
|
|
291
315
|
polling: 100,
|
|
292
316
|
});
|
|
293
|
-
|
|
317
|
+
clearRequestLog();
|
|
294
318
|
|
|
295
319
|
await secondPage.evaluate(generateTestEvents);
|
|
296
320
|
expect(secondPageErrors.length).toBe(0);
|
package/dist/browser.d.ts
CHANGED