@zoho_apptics/apptics-js-sdk 2.0.0-beta → 2.0.0-beta.2
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 +191 -21
- package/README.md +519 -333
- package/dist/apptics.esm.min.js +2 -2
- package/dist/apptics.esm.min.js.map +1 -1
- package/dist/apptics.min.js +2 -2
- package/dist/apptics.min.js.map +1 -1
- package/dist/chunks/lifecycle-C6m1W7jo.min.js +3 -0
- package/dist/chunks/lifecycle-C6m1W7jo.min.js.map +1 -0
- package/dist/chunks/send-CgUO82ne.min.js +3 -0
- package/dist/chunks/send-CgUO82ne.min.js.map +1 -0
- package/dist/cjs/core/attempts.js +1 -1
- package/dist/cjs/core/batch.js +2 -2
- package/dist/cjs/core/consent.d.ts +18 -4
- package/dist/cjs/core/consent.js +31 -15
- package/dist/cjs/core/constants.d.ts +57 -27
- package/dist/cjs/core/constants.js +52 -33
- package/dist/cjs/core/db.d.ts +12 -4
- package/dist/cjs/core/db.js +167 -34
- package/dist/cjs/core/debug.js +1 -1
- package/dist/cjs/core/env.d.ts +0 -3
- package/dist/cjs/core/env.js +1 -9
- package/dist/cjs/core/framework-id.d.ts +1 -1
- package/dist/cjs/core/framework-id.js +3 -3
- package/dist/cjs/core/guard.d.ts +9 -0
- package/dist/cjs/core/guard.js +27 -13
- package/dist/cjs/core/hooks.d.ts +7 -4
- package/dist/cjs/core/hooks.js +3 -3
- package/dist/cjs/core/locks.d.ts +9 -0
- package/dist/cjs/core/locks.js +22 -0
- package/dist/cjs/core/logger.d.ts +3 -4
- package/dist/cjs/core/logger.js +4 -40
- package/dist/cjs/core/state.d.ts +9 -6
- package/dist/cjs/core/state.js +3 -5
- package/dist/cjs/core/storage.d.ts +20 -5
- package/dist/cjs/core/storage.js +115 -20
- package/dist/cjs/core/stylesheet.d.ts +8 -0
- package/dist/cjs/core/stylesheet.js +29 -0
- package/dist/cjs/core/transport.d.ts +2 -0
- package/dist/cjs/core/transport.js +30 -18
- package/dist/cjs/core/utils.js +1 -1
- package/dist/cjs/core/validate.js +2 -2
- package/dist/cjs/device/appversion.d.ts +10 -6
- package/dist/cjs/device/appversion.js +38 -3
- package/dist/cjs/device/index.d.ts +28 -2
- package/dist/cjs/device/index.js +312 -44
- package/dist/cjs/engagement/api-rules.d.ts +32 -67
- package/dist/cjs/engagement/api-rules.js +144 -157
- package/dist/cjs/engagement/auto-api.js +2 -2
- package/dist/cjs/engagement/auto-screen.d.ts +2 -0
- package/dist/cjs/engagement/auto-screen.js +67 -3
- package/dist/cjs/engagement/defined-events.js +1 -1
- package/dist/cjs/engagement/send.js +12 -3
- package/dist/cjs/engagement/session.d.ts +29 -3
- package/dist/cjs/engagement/session.js +253 -26
- package/dist/cjs/engagement/track.d.ts +4 -4
- package/dist/cjs/engagement/track.js +58 -30
- package/dist/cjs/errors/send.js +2 -2
- package/dist/cjs/errors/track.d.ts +2 -1
- package/dist/cjs/errors/track.js +49 -7
- package/dist/cjs/feedback/controls.d.ts +12 -0
- package/dist/cjs/feedback/controls.js +104 -25
- package/dist/cjs/feedback/index.d.ts +8 -7
- package/dist/cjs/feedback/index.js +32 -13
- package/dist/cjs/feedback/logs.d.ts +13 -11
- package/dist/cjs/feedback/logs.js +57 -28
- package/dist/cjs/feedback/quartz.d.ts +18 -0
- package/dist/cjs/feedback/quartz.js +105 -0
- package/dist/cjs/feedback/send.d.ts +5 -2
- package/dist/cjs/feedback/send.js +30 -28
- package/dist/cjs/feedback/styles.d.ts +10 -0
- package/dist/cjs/feedback/styles.js +8 -0
- package/dist/cjs/feedback/template.d.ts +1 -1
- package/dist/cjs/feedback/template.js +20 -12
- package/dist/cjs/feedback/ui.d.ts +21 -6
- package/dist/cjs/feedback/ui.js +283 -70
- package/dist/cjs/heatmap/send.d.ts +2 -0
- package/dist/cjs/heatmap/send.js +3 -5
- package/dist/cjs/heatmap/track.d.ts +1 -1
- package/dist/cjs/heatmap/track.js +87 -16
- package/dist/cjs/index.d.ts +16 -63
- package/dist/cjs/index.js +144 -95
- package/dist/cjs/lifecycle.d.ts +21 -3
- package/dist/cjs/lifecycle.js +353 -89
- package/dist/cjs/remoteconfig/country.d.ts +4 -0
- package/dist/cjs/remoteconfig/country.js +73 -0
- package/dist/cjs/remoteconfig/custom.d.ts +7 -7
- package/dist/cjs/remoteconfig/custom.js +31 -51
- package/dist/cjs/remoteconfig/evaluate.d.ts +3 -3
- package/dist/cjs/remoteconfig/evaluate.js +56 -43
- package/dist/cjs/remoteconfig/fetch.d.ts +16 -9
- package/dist/cjs/remoteconfig/fetch.js +120 -39
- package/dist/cjs/remoteconfig/index.d.ts +19 -8
- package/dist/cjs/remoteconfig/index.js +81 -39
- package/dist/cjs/remoteconfig/store.d.ts +15 -7
- package/dist/cjs/remoteconfig/store.js +68 -35
- package/dist/cjs/remoteconfig/tz-countries.d.ts +8 -0
- package/dist/cjs/remoteconfig/tz-countries.js +13 -0
- package/dist/{esm/core → cjs/remotelog}/callsite.d.ts +11 -4
- package/dist/cjs/{core → remotelog}/callsite.js +30 -7
- package/dist/cjs/remotelog/gate.d.ts +2 -11
- package/dist/cjs/remotelog/gate.js +9 -35
- package/dist/cjs/remotelog/index.d.ts +4 -21
- package/dist/cjs/remotelog/logger.d.ts +11 -17
- package/dist/cjs/remotelog/logger.js +31 -59
- package/dist/cjs/remotelog/send.js +11 -11
- package/dist/cjs/remotelogger/index.d.ts +12 -0
- package/dist/cjs/remotelogger/index.js +18 -0
- package/dist/cjs/scheduler.d.ts +3 -1
- package/dist/cjs/scheduler.js +25 -22
- package/dist/cjs/types.d.ts +208 -90
- package/dist/cjs/user/index.js +16 -7
- package/dist/esm/core/attempts.js +1 -1
- package/dist/esm/core/batch.js +2 -2
- package/dist/esm/core/consent.d.ts +18 -4
- package/dist/esm/core/consent.js +32 -17
- package/dist/esm/core/constants.d.ts +57 -27
- package/dist/esm/core/constants.js +51 -33
- package/dist/esm/core/db.d.ts +12 -4
- package/dist/esm/core/db.js +164 -35
- package/dist/esm/core/debug.js +1 -1
- package/dist/esm/core/env.d.ts +0 -3
- package/dist/esm/core/env.js +2 -9
- package/dist/esm/core/framework-id.d.ts +1 -1
- package/dist/esm/core/framework-id.js +3 -3
- package/dist/esm/core/guard.d.ts +9 -0
- package/dist/esm/core/guard.js +27 -14
- package/dist/esm/core/hooks.d.ts +7 -4
- package/dist/esm/core/hooks.js +3 -3
- package/dist/esm/core/locks.d.ts +9 -0
- package/dist/esm/core/locks.js +20 -0
- package/dist/esm/core/logger.d.ts +3 -4
- package/dist/esm/core/logger.js +4 -40
- package/dist/esm/core/state.d.ts +9 -6
- package/dist/esm/core/state.js +3 -5
- package/dist/esm/core/storage.d.ts +20 -5
- package/dist/esm/core/storage.js +113 -21
- package/dist/esm/core/stylesheet.d.ts +8 -0
- package/dist/esm/core/stylesheet.js +27 -0
- package/dist/esm/core/transport.d.ts +2 -0
- package/dist/esm/core/transport.js +30 -19
- package/dist/esm/core/utils.js +1 -1
- package/dist/esm/core/validate.js +2 -2
- package/dist/esm/device/appversion.d.ts +10 -6
- package/dist/esm/device/appversion.js +37 -4
- package/dist/esm/device/index.d.ts +28 -2
- package/dist/esm/device/index.js +313 -49
- package/dist/esm/engagement/api-rules.d.ts +32 -67
- package/dist/esm/engagement/api-rules.js +143 -155
- package/dist/esm/engagement/auto-api.js +3 -3
- package/dist/esm/engagement/auto-screen.d.ts +2 -0
- package/dist/esm/engagement/auto-screen.js +67 -4
- package/dist/esm/engagement/defined-events.js +1 -1
- package/dist/esm/engagement/send.js +12 -3
- package/dist/esm/engagement/session.d.ts +29 -3
- package/dist/esm/engagement/session.js +251 -30
- package/dist/esm/engagement/track.d.ts +4 -4
- package/dist/esm/engagement/track.js +65 -37
- package/dist/esm/errors/send.js +2 -2
- package/dist/esm/errors/track.d.ts +2 -1
- package/dist/esm/errors/track.js +49 -7
- package/dist/esm/feedback/controls.d.ts +12 -0
- package/dist/esm/feedback/controls.js +103 -26
- package/dist/esm/feedback/index.d.ts +8 -7
- package/dist/esm/feedback/index.js +34 -13
- package/dist/esm/feedback/logs.d.ts +13 -11
- package/dist/esm/feedback/logs.js +59 -30
- package/dist/esm/feedback/quartz.d.ts +18 -0
- package/dist/esm/feedback/quartz.js +99 -0
- package/dist/esm/feedback/send.d.ts +5 -2
- package/dist/esm/feedback/send.js +31 -31
- package/dist/esm/feedback/styles.d.ts +10 -0
- package/dist/esm/feedback/styles.js +4 -0
- package/dist/esm/feedback/template.d.ts +1 -1
- package/dist/esm/feedback/template.js +20 -12
- package/dist/esm/feedback/ui.d.ts +21 -6
- package/dist/esm/feedback/ui.js +283 -71
- package/dist/esm/heatmap/send.d.ts +2 -0
- package/dist/esm/heatmap/send.js +3 -5
- package/dist/esm/heatmap/track.d.ts +1 -1
- package/dist/esm/heatmap/track.js +87 -16
- package/dist/esm/index.d.ts +16 -63
- package/dist/esm/index.js +148 -83
- package/dist/esm/lifecycle.d.ts +21 -3
- package/dist/esm/lifecycle.js +359 -98
- package/dist/esm/remoteconfig/country.d.ts +4 -0
- package/dist/esm/remoteconfig/country.js +70 -0
- package/dist/esm/remoteconfig/custom.d.ts +7 -7
- package/dist/esm/remoteconfig/custom.js +32 -52
- package/dist/esm/remoteconfig/evaluate.d.ts +3 -3
- package/dist/esm/remoteconfig/evaluate.js +57 -44
- package/dist/esm/remoteconfig/fetch.d.ts +16 -9
- package/dist/esm/remoteconfig/fetch.js +120 -39
- package/dist/esm/remoteconfig/index.d.ts +19 -8
- package/dist/esm/remoteconfig/index.js +82 -40
- package/dist/esm/remoteconfig/store.d.ts +15 -7
- package/dist/esm/remoteconfig/store.js +68 -36
- package/dist/esm/remoteconfig/tz-countries.d.ts +8 -0
- package/dist/esm/remoteconfig/tz-countries.js +11 -0
- package/dist/{cjs/core → esm/remotelog}/callsite.d.ts +11 -4
- package/dist/esm/{core → remotelog}/callsite.js +30 -8
- package/dist/esm/remotelog/gate.d.ts +2 -11
- package/dist/esm/remotelog/gate.js +10 -32
- package/dist/esm/remotelog/index.d.ts +4 -21
- package/dist/esm/remotelog/logger.d.ts +11 -17
- package/dist/esm/remotelog/logger.js +33 -61
- package/dist/esm/remotelog/send.js +13 -13
- package/dist/esm/remotelogger/index.d.ts +12 -0
- package/dist/esm/remotelogger/index.js +13 -0
- package/dist/esm/scheduler.d.ts +3 -1
- package/dist/esm/scheduler.js +26 -24
- package/dist/esm/types.d.ts +208 -90
- package/dist/esm/user/index.js +18 -8
- package/dist/feedback.esm.min.js +2 -2
- package/dist/feedback.esm.min.js.map +1 -1
- package/dist/remoteconfig.esm.min.js +3 -0
- package/dist/remoteconfig.esm.min.js.map +1 -0
- package/dist/remotelogger.esm.min.js +3 -0
- package/dist/remotelogger.esm.min.js.map +1 -0
- package/package.json +16 -17
- package/dist/chunks/batch-BU_mTpm1.min.js +0 -3
- package/dist/chunks/batch-BU_mTpm1.min.js.map +0 -1
- package/dist/chunks/logs-Bea5zUW_.min.js +0 -3
- package/dist/chunks/logs-Bea5zUW_.min.js.map +0 -1
- package/dist/cjs/auto-init.d.ts +0 -8
- package/dist/cjs/auto-init.js +0 -32
- package/dist/cjs/heatmap/index.d.ts +0 -16
- package/dist/cjs/heatmap/index.js +0 -22
- package/dist/cjs/remotelog/index.js +0 -55
- package/dist/esm/auto-init.d.ts +0 -8
- package/dist/esm/auto-init.js +0 -29
- package/dist/esm/heatmap/index.d.ts +0 -16
- package/dist/esm/heatmap/index.js +0 -17
- package/dist/esm/remotelog/index.js +0 -51
- package/dist/heatmap.esm.min.js +0 -3
- package/dist/heatmap.esm.min.js.map +0 -1
- package/dist/style.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { AP_LOG_MODULE, AP_CONFIG, AP_TRACKING_STATUS } from '../core/constants.js';
|
|
3
3
|
import { getConfig, _ZAP } from '../core/state.js';
|
|
4
4
|
import { Console, logFailure } from '../core/logger.js';
|
|
@@ -22,6 +22,12 @@ import { noteDebugActivity } from '../core/debug.js';
|
|
|
22
22
|
*/
|
|
23
23
|
/** How long the page must be still before a scroll burst counts as one finished gesture. */
|
|
24
24
|
const SCROLL_IDLE_MS = 150;
|
|
25
|
+
/**
|
|
26
|
+
* How much of the viewport, each way, an element must cover for its scrolling to be the page's.
|
|
27
|
+
* An app whose layout scrolls a content pane instead of the window (most dashboards do) still
|
|
28
|
+
* gets a scroll map; a dropdown list or a small table scrolling on its own is not the page moving.
|
|
29
|
+
*/
|
|
30
|
+
const PAGE_SCROLLER_SHARE = 0.5;
|
|
25
31
|
/** Clicks closer than this in time and space count as one angry repetition. */
|
|
26
32
|
const RAGE_WINDOW_MS = 1000;
|
|
27
33
|
const RAGE_RADIUS_PX = 30;
|
|
@@ -40,6 +46,10 @@ var scrollStart = 0;
|
|
|
40
46
|
var scrollStartX = 0;
|
|
41
47
|
var scrollStartY = 0;
|
|
42
48
|
var scrollTimer = null;
|
|
49
|
+
/** What the gesture in progress scrolls: null for the window, else the page's content pane. */
|
|
50
|
+
var scrolling = null;
|
|
51
|
+
/** Where each content pane was after its last gesture, as lastX / lastY are for the window. */
|
|
52
|
+
var paneAt = new WeakMap();
|
|
43
53
|
/**
|
|
44
54
|
* Where the page was before the current gesture began.
|
|
45
55
|
*
|
|
@@ -122,7 +132,7 @@ function labelFor(node) {
|
|
|
122
132
|
if (!node) {
|
|
123
133
|
return ''; // no i18n
|
|
124
134
|
}
|
|
125
|
-
var attributes = ['data-ap-label', 'apeventaction', 'aria-label', 'name', 'id', 'title']; // no i18n
|
|
135
|
+
var attributes = ['data-ap-label', 'apeventaction', 'data-apeventaction', 'aria-label', 'name', 'id', 'title']; // no i18n
|
|
126
136
|
for (var i = 0; i < attributes.length; i++) {
|
|
127
137
|
var value = node.getAttribute ? node.getAttribute(attributes[i]) : null;
|
|
128
138
|
if (!isEmpty(value)) {
|
|
@@ -278,14 +288,57 @@ function watchForDeadClick(record, target) {
|
|
|
278
288
|
}
|
|
279
289
|
}, DEAD_CLICK_MS);
|
|
280
290
|
}
|
|
281
|
-
|
|
291
|
+
/**
|
|
292
|
+
* What a scroll event moved, as a gesture counts it: null for the window (the event's target is
|
|
293
|
+
* the document), the element when it is big enough to be the page's own scrolling, and undefined
|
|
294
|
+
* for anything smaller, which is not recorded.
|
|
295
|
+
*/
|
|
296
|
+
function scrollerOf(target) {
|
|
297
|
+
var doc = document;
|
|
298
|
+
// the window and the document are not elements: either is the page itself scrolling
|
|
299
|
+
if (!target || target.nodeType !== 1 || target === doc.documentElement || target === doc.body) {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
var el = target;
|
|
303
|
+
var big = el.clientHeight >= (window.innerHeight || 0) * PAGE_SCROLLER_SHARE
|
|
304
|
+
&& el.clientWidth >= viewportWidth() * PAGE_SCROLLER_SHARE;
|
|
305
|
+
return big ? el : undefined;
|
|
306
|
+
}
|
|
307
|
+
/** Where a scroller is now. */
|
|
308
|
+
function positionOf(scroller) {
|
|
309
|
+
return scroller === null
|
|
310
|
+
? { x: Math.round(window.scrollX || window.pageXOffset || 0), y: Math.round(window.scrollY || window.pageYOffset || 0) }
|
|
311
|
+
: { x: Math.round(scroller.scrollLeft || 0), y: Math.round(scroller.scrollTop || 0) };
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Where a scroller was before this gesture: what the last one left. A content pane seen for the
|
|
315
|
+
* first time is taken to have been at its top, which is where a pane starts.
|
|
316
|
+
*/
|
|
317
|
+
function startOf(scroller) {
|
|
318
|
+
if (scroller === null) {
|
|
319
|
+
return { x: lastX, y: lastY };
|
|
320
|
+
}
|
|
321
|
+
return paneAt.get(scroller) || { x: 0, y: 0 };
|
|
322
|
+
}
|
|
323
|
+
function onScroll(event) {
|
|
282
324
|
if (!canTrackHeatmap('heatmap') || !underCap()) { // no i18n
|
|
283
325
|
return;
|
|
284
326
|
}
|
|
327
|
+
var scroller = scrollerOf(event ? event.target : null);
|
|
328
|
+
if (scroller === undefined) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (scrollTimer !== null && scroller !== scrolling) {
|
|
332
|
+
// another scroller started moving: the gesture on the first one is over
|
|
333
|
+
clearTimeout(scrollTimer);
|
|
334
|
+
endScrollGesture();
|
|
335
|
+
}
|
|
285
336
|
if (scrollTimer === null) {
|
|
337
|
+
scrolling = scroller;
|
|
338
|
+
var start = startOf(scroller);
|
|
286
339
|
scrollStart = nowMs();
|
|
287
|
-
scrollStartX =
|
|
288
|
-
scrollStartY =
|
|
340
|
+
scrollStartX = start.x;
|
|
341
|
+
scrollStartY = start.y;
|
|
289
342
|
}
|
|
290
343
|
else {
|
|
291
344
|
clearTimeout(scrollTimer);
|
|
@@ -295,13 +348,21 @@ function onScroll() {
|
|
|
295
348
|
/** One record for the whole burst, once the page has been still for SCROLL_IDLE_MS. */
|
|
296
349
|
function endScrollGesture() {
|
|
297
350
|
scrollTimer = null;
|
|
351
|
+
var scroller = scrolling;
|
|
352
|
+
scrolling = null;
|
|
298
353
|
try {
|
|
299
|
-
var
|
|
300
|
-
var
|
|
354
|
+
var end = positionOf(scroller);
|
|
355
|
+
var endX = end.x;
|
|
356
|
+
var endY = end.y;
|
|
301
357
|
var dx = endX - scrollStartX;
|
|
302
358
|
var dy = endY - scrollStartY;
|
|
303
|
-
|
|
304
|
-
|
|
359
|
+
if (scroller === null) {
|
|
360
|
+
lastX = endX;
|
|
361
|
+
lastY = endY;
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
paneAt.set(scroller, end);
|
|
365
|
+
}
|
|
305
366
|
if (dx === 0 && dy === 0) {
|
|
306
367
|
return;
|
|
307
368
|
}
|
|
@@ -310,8 +371,14 @@ function endScrollGesture() {
|
|
|
310
371
|
var direction = Math.abs(dy) >= Math.abs(dx)
|
|
311
372
|
? (dy > 0 ? 'down-scroll' : 'up-scroll') // no i18n
|
|
312
373
|
: (dx > 0 ? 'right-scroll' : 'left-scroll'); // no i18n
|
|
313
|
-
|
|
314
|
-
|
|
374
|
+
// the depth is of what scrolled: the document, or the content pane and its own content
|
|
375
|
+
var height = (scroller === null ? contentHeight() : scroller.scrollHeight) || 1;
|
|
376
|
+
var visible = scroller === null ? (window.innerHeight || 0) : scroller.clientHeight;
|
|
377
|
+
store(Object.assign(common(), scroller === null ? {} : {
|
|
378
|
+
content_height: scroller.scrollHeight,
|
|
379
|
+
scroll_offset_x: endX,
|
|
380
|
+
scroll_offset_y: endY,
|
|
381
|
+
}, {
|
|
315
382
|
// the server accepts only event|default|buttonclick here; what kind of movement it
|
|
316
383
|
// was belongs in gesture_type. input_type is left off rather than invented: a wheel
|
|
317
384
|
// carries no pointer type, and the intended vocabulary has no value for "unknown"
|
|
@@ -324,7 +391,7 @@ function endScrollGesture() {
|
|
|
324
391
|
coordinate_y: endY,
|
|
325
392
|
normalized_x: 0,
|
|
326
393
|
// how far down the page the gesture left them, which is what a scroll map reads
|
|
327
|
-
normalized_y: fraction(endY +
|
|
394
|
+
normalized_y: fraction(endY + visible, height),
|
|
328
395
|
velocity: Math.round((distance / duration) * 1000),
|
|
329
396
|
is_clickable: 0,
|
|
330
397
|
is_rage_click: 0,
|
|
@@ -336,7 +403,7 @@ function endScrollGesture() {
|
|
|
336
403
|
}
|
|
337
404
|
}
|
|
338
405
|
/** Turns capture on or off. Listeners are passive, so they never delay a click or a scroll. */
|
|
339
|
-
function
|
|
406
|
+
function trackHeatmap(status) {
|
|
340
407
|
var wanted = typeof status === 'boolean' ? status : true; // no i18n
|
|
341
408
|
if (wanted === installed) {
|
|
342
409
|
return;
|
|
@@ -353,10 +420,13 @@ function enableHeatmap(status) {
|
|
|
353
420
|
}
|
|
354
421
|
window.removeEventListener('pointerdown', onPointerDown, true); // no i18n
|
|
355
422
|
window.removeEventListener('scroll', onScroll, true); // no i18n
|
|
423
|
+
// a gesture still settling when capture stops (a single-page app leaving a heatmap page) is
|
|
424
|
+
// recorded as it stands, not dropped: it was the visitor's last scroll on that page
|
|
356
425
|
if (scrollTimer !== null) {
|
|
357
426
|
clearTimeout(scrollTimer);
|
|
358
|
-
|
|
427
|
+
endScrollGesture();
|
|
359
428
|
}
|
|
429
|
+
scrolling = null;
|
|
360
430
|
installed = false;
|
|
361
431
|
Console.log('apptics.heatmap: capture stopped'); // no i18n
|
|
362
432
|
}
|
|
@@ -366,9 +436,10 @@ function resetHeatmapSession() {
|
|
|
366
436
|
recentClicks = [];
|
|
367
437
|
lastX = 0;
|
|
368
438
|
lastY = 0;
|
|
439
|
+
paneAt = new WeakMap();
|
|
369
440
|
}
|
|
370
441
|
// init() and reset() drive capture through these, so neither has to import this module
|
|
371
|
-
hooks.
|
|
442
|
+
hooks.trackHeatmap = trackHeatmap;
|
|
372
443
|
hooks.resetHeatmap = resetHeatmapSession;
|
|
373
444
|
|
|
374
|
-
export {
|
|
445
|
+
export { resetHeatmapSession, trackHeatmap };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,68 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { enableGlobalErrorHandler as enableGlobalErrorHandlerImpl } from './errors/track.js';
|
|
7
|
-
import { getUser as getUserImpl, UserBuilder, users } from './user/index.js';
|
|
8
|
-
import { getTrackingStatus as getTrackingStatusImpl, setTrackingStatus as setTrackingStatusImpl } from './core/consent.js';
|
|
9
|
-
import { flush as flushImpl } from './scheduler.js';
|
|
10
|
-
import { addDiagnosticsInfo as addDiagnosticsInfoImpl, addFeedbackLog as addFeedbackLogImpl } from './feedback/logs.js';
|
|
11
|
-
import type { AppticsApi } from './types.js';
|
|
12
|
-
import { disableDebug as disableDebugImpl, enableDebug as enableDebugImpl } from './core/debug.js';
|
|
13
|
-
import { AppticsLogger } from './remotelog/logger.js';
|
|
14
|
-
export type { AppticsLogger as AppticsLoggerApi } from './remotelog/logger.js';
|
|
15
|
-
export type { AppticsApi, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
|
|
16
|
-
/** Android's Apptics: `Apptics.init(config)` starts the SDK. */
|
|
17
|
-
export declare const Apptics: {
|
|
18
|
-
/** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
|
|
19
|
-
init: typeof initImpl;
|
|
20
|
-
};
|
|
21
|
-
export declare const ready: typeof readyImpl;
|
|
22
|
-
/** Android's AppticsEvents: `addEvent(name, group?, properties?)`, or `addEvent(DefinedEvents.X, properties?)`. */
|
|
23
|
-
export declare const AppticsEvents: {
|
|
24
|
-
addEvent: AppticsApi["AppticsEvents"]["addEvent"];
|
|
25
|
-
};
|
|
26
|
-
/** Apptics' defined events, as Android's DefinedEvents, to log with AppticsEvents.addEvent. */
|
|
27
|
-
export { DefinedEvents };
|
|
1
|
+
import type { AppticsSdk } from './types.js';
|
|
2
|
+
export type { AppticsSdk, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
|
|
3
|
+
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
4
|
+
export declare const Apptics: AppticsSdk['Apptics'];
|
|
5
|
+
export declare const AppticsEvent: AppticsSdk['AppticsEvent'];
|
|
28
6
|
export type { DefinedEvent } from './engagement/defined-events.js';
|
|
29
7
|
/** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
|
|
30
|
-
export declare const
|
|
8
|
+
export declare const AppticsScreen: AppticsSdk['AppticsScreen'];
|
|
31
9
|
/** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
|
|
32
|
-
export declare const
|
|
33
|
-
export { ApiTrackingBuilder };
|
|
10
|
+
export declare const AppticsApi: AppticsSdk['AppticsApi'];
|
|
34
11
|
export type { ApiTrackingConfig } from './engagement/api-rules.js';
|
|
35
|
-
/**
|
|
36
|
-
export declare const
|
|
37
|
-
/**
|
|
38
|
-
export declare const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
export declare const
|
|
43
|
-
|
|
44
|
-
export declare const getTrackingStatus: typeof getTrackingStatusImpl;
|
|
45
|
-
export declare const flush: typeof flushImpl;
|
|
46
|
-
/** Records a line for the next feedback submission. Costs nothing until feedback is sent. */
|
|
47
|
-
export declare const addFeedbackLog: typeof addFeedbackLogImpl;
|
|
48
|
-
/** Records a diagnostics key/value, grouped under `heading`, for the next feedback submission. */
|
|
49
|
-
export declare const addDiagnosticsInfo: typeof addDiagnosticsInfoImpl;
|
|
50
|
-
/**
|
|
51
|
-
* Turns debug mode on; works before init(), and wins over `debug` in init().
|
|
52
|
-
*
|
|
53
|
-
* On, engagement, exception and log go to their `debug/` twins and the answers carry a request id
|
|
54
|
-
* and a link into the server's own logs. It switches itself off after an hour with nothing
|
|
55
|
-
* tracked, so a forgotten tab stops tracing on its own.
|
|
56
|
-
*/
|
|
57
|
-
export declare const enableDebug: typeof enableDebugImpl;
|
|
58
|
-
/** Turns debug mode off; works before init(), and wins over `debug` in init(). */
|
|
59
|
-
export declare const disableDebug: typeof disableDebugImpl;
|
|
60
|
-
export declare const reset: typeof resetImpl;
|
|
61
|
-
/**
|
|
62
|
-
* Android's AppticsLogger, shown on the console's Remote Logger page. Off until
|
|
63
|
-
* `AppticsLogger.enable()`; then `AppticsLogger.v / d / i / w / e(tag, message, ...details)`.
|
|
64
|
-
*/
|
|
65
|
-
export { AppticsLogger };
|
|
66
|
-
export { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS, UserBuilder, users };
|
|
67
|
-
declare const apptics: AppticsApi;
|
|
12
|
+
/** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
|
|
13
|
+
export declare const AppticsError: AppticsSdk['AppticsError'];
|
|
14
|
+
/** Android's AppticsUser: the signed-in user, and the builder for their properties. */
|
|
15
|
+
export declare const AppticsUser: AppticsSdk['AppticsUser'];
|
|
16
|
+
/** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
|
|
17
|
+
export declare const AppticsHeatmap: AppticsSdk['AppticsHeatmap'];
|
|
18
|
+
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
19
|
+
export declare const AppticsSettings: AppticsSdk['AppticsSettings'];
|
|
20
|
+
declare const apptics: AppticsSdk;
|
|
68
21
|
export default apptics;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,42 +1,92 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
-
import {
|
|
3
|
-
import { guard } from './core/guard.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
+
import { AP_TRACKING_STATUS } from './core/constants.js';
|
|
3
|
+
import { forward, guard } from './core/guard.js';
|
|
4
|
+
import { warnAlways } from './core/logger.js';
|
|
5
|
+
import { reset, ready, init, setClickTracking, setScreenTracking } from './lifecycle.js';
|
|
6
|
+
import { enableApiTracking } from './engagement/auto-api.js';
|
|
7
|
+
import { endTrackApiAt, outScreenAt, inScreenAt, startTrackApi, trackEvent } from './engagement/track.js';
|
|
7
8
|
import { DefinedEvents } from './engagement/defined-events.js';
|
|
8
9
|
import { nowMs, getNewUUID } from './core/utils.js';
|
|
9
10
|
import { validateScreenName } from './core/validate.js';
|
|
10
11
|
import { ApiTrackingBuilder, configureApiTracking } from './engagement/api-rules.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { disableDebug
|
|
19
|
-
import { AppticsLogger } from './remotelog/logger.js';
|
|
12
|
+
import { setErrorTracking, trackError } from './errors/track.js';
|
|
13
|
+
import { UserBuilder, getUser, setUser } from './user/index.js';
|
|
14
|
+
import { getTrackingStatus, setTrackingStatus } from './core/consent.js';
|
|
15
|
+
import { calledFlush } from './scheduler.js';
|
|
16
|
+
import { trackHeatmap } from './heatmap/track.js';
|
|
17
|
+
import { sendHeatmapData } from './heatmap/send.js';
|
|
18
|
+
import { hooks } from './core/hooks.js';
|
|
19
|
+
import { disableDebug, enableDebug } from './core/debug.js';
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// flush() and the flush timer send heatmap records through this hook. Set here, from a named
|
|
22
|
+
// import, rather than by heatmap/send.ts on being imported: the package's sideEffects list names
|
|
23
|
+
// only the CDN bundle, so a bundler drops a bare `import './heatmap/send.js'`, and with it every
|
|
24
|
+
// heatmap send, while capture carries on filling the queue
|
|
25
|
+
hooks.sendHeatmaps = sendHeatmapData;
|
|
26
|
+
/*
|
|
27
|
+
* Every public call below is a function of its own, with the parameter names the console shows
|
|
28
|
+
* on hover, forwarding to its guard()ed implementation (see forward).
|
|
29
|
+
*/
|
|
30
|
+
const initGuarded = guard('Apptics.init', init); // no i18n
|
|
31
|
+
const readyGuarded = guard('Apptics.ready', ready); // no i18n
|
|
32
|
+
const flushGuarded = guard('Apptics.flush', calledFlush); // no i18n
|
|
33
|
+
const resetGuarded = guard('Apptics.reset', reset); // no i18n
|
|
34
|
+
/**
|
|
35
|
+
* Debug mode, on or off; works before init(), and wins over `debug` in init(). On, engagement,
|
|
36
|
+
* exception and log go to their `debug/` twins and the answers carry a request id and a link into
|
|
37
|
+
* the server's own logs. It switches itself off after an hour with nothing tracked, so a forgotten
|
|
38
|
+
* tab stops tracing on its own.
|
|
39
|
+
*/
|
|
40
|
+
const enableDebugGuarded = guard('Apptics.enableDebug', enableDebug); // no i18n
|
|
41
|
+
const disableDebugGuarded = guard('Apptics.disableDebug', disableDebug); // no i18n
|
|
42
|
+
/** The renamed calls already warned about: once per page each, not once per call. */
|
|
43
|
+
var warnedRenamed = {};
|
|
44
|
+
/** An earlier name of a call still works, with a console warning naming the call to use. */
|
|
45
|
+
function renamed(old, current) {
|
|
46
|
+
if (warnedRenamed[old]) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
warnedRenamed[old] = true;
|
|
50
|
+
warnAlways(old + ' is now ' + current + '; rename it in your code'); // no i18n
|
|
51
|
+
}
|
|
52
|
+
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
22
53
|
const Apptics = {
|
|
23
|
-
/** Starts the SDK
|
|
24
|
-
init:
|
|
54
|
+
/** Starts the SDK with the app's config object, which is required. */
|
|
55
|
+
init: function init(config) { return forward(initGuarded, arguments); },
|
|
56
|
+
/** Resolves true once the SDK is running, false if it can't start. */
|
|
57
|
+
ready: function ready() { return forward(readyGuarded, arguments); },
|
|
58
|
+
/** Sends stored engagements, errors and heatmap records now; at most once every 15 seconds. */
|
|
59
|
+
flush: function flush() { return forward(flushGuarded, arguments); },
|
|
60
|
+
/** Clears stored identity, queued data and remote config values, then starts again. */
|
|
61
|
+
reset: function reset() { return forward(resetGuarded, arguments); },
|
|
62
|
+
enableDebug: function enableDebug() { return forward(enableDebugGuarded, arguments); },
|
|
63
|
+
disableDebug: function disableDebug() { return forward(disableDebugGuarded, arguments); },
|
|
25
64
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Android's AppticsEvents: `addEvent(name, group, properties?)`, or
|
|
67
|
+
* `addEvent(AppticsEvent.DefinedEvents.X, properties?)`.
|
|
68
|
+
*/
|
|
69
|
+
const addEventGuarded = guard('AppticsEvent.addEvent', trackEvent); // no i18n
|
|
70
|
+
const setClickTrackingGuarded = guard('AppticsEvent.setClickTracking', setClickTracking); // no i18n
|
|
71
|
+
const AppticsEvent = {
|
|
72
|
+
/** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
|
|
73
|
+
DefinedEvents: DefinedEvents,
|
|
74
|
+
addEvent: function addEvent(eventName, groupName, properties) {
|
|
75
|
+
return forward(addEventGuarded, arguments);
|
|
76
|
+
},
|
|
77
|
+
/** Turns click tracking from markup (apeventaction) on or off; the `track_click` config flag sets it at start-up. */
|
|
78
|
+
setClickTracking: function setClickTracking(enabled) { return forward(setClickTrackingGuarded, arguments); },
|
|
30
79
|
};
|
|
31
|
-
const inScreenGuarded = guard('
|
|
32
|
-
const outScreenGuarded = guard('
|
|
80
|
+
const inScreenGuarded = guard('AppticsScreen.inScreen', inScreenAt); // no i18n
|
|
81
|
+
const outScreenGuarded = guard('AppticsScreen.outScreen', outScreenAt); // no i18n
|
|
82
|
+
const setScreenTrackingGuarded = guard('AppticsScreen.setScreenTracking', setScreenTracking); // no i18n
|
|
33
83
|
/** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
|
|
34
|
-
const
|
|
84
|
+
const AppticsScreen = {
|
|
35
85
|
/**
|
|
36
86
|
* Records a screen view and returns its id. The view ends at the next screen, when the page is
|
|
37
87
|
* hidden or its session ends, or when the id is handed to outScreen. '' for an invalid name.
|
|
38
88
|
*/
|
|
39
|
-
inScreen: function (screenName, properties) {
|
|
89
|
+
inScreen: function inScreen(screenName, properties) {
|
|
40
90
|
if (!validateScreenName(screenName)) {
|
|
41
91
|
// inScreenAt reports it; the caller still needs an answer now
|
|
42
92
|
inScreenGuarded(screenName, properties, '', nowMs()); // no i18n
|
|
@@ -48,75 +98,90 @@ const AppticsScreenTracker = {
|
|
|
48
98
|
return id;
|
|
49
99
|
},
|
|
50
100
|
/** Ends the screen view inScreen began, before the next screen would. */
|
|
51
|
-
outScreen: function (id) {
|
|
101
|
+
outScreen: function outScreen(id) {
|
|
52
102
|
outScreenGuarded(id, nowMs());
|
|
53
103
|
},
|
|
104
|
+
/** Turns automatic screen tracking on or off; the `track_screen` config flag sets it at start-up. */
|
|
105
|
+
setScreenTracking: function setScreenTracking(enabled) { return forward(setScreenTrackingGuarded, arguments); },
|
|
54
106
|
};
|
|
55
|
-
const endTrackApiGuarded = guard('
|
|
107
|
+
const endTrackApiGuarded = guard('AppticsApi.endTrackApi', endTrackApiAt); // no i18n
|
|
108
|
+
const startTrackApiGuarded = guard('AppticsApi.startTrackApi', startTrackApi); // no i18n
|
|
109
|
+
const configureGuarded = guard('AppticsApi.configure', configureApiTracking); // no i18n
|
|
110
|
+
const setApiTrackingGuarded = guard('AppticsApi.setApiTracking', enableApiTracking); // no i18n
|
|
56
111
|
/** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
|
|
57
|
-
const
|
|
112
|
+
const AppticsApi = {
|
|
58
113
|
/** Begins timing one call: returns the id endTrackApi takes. */
|
|
59
|
-
startTrackApi:
|
|
114
|
+
startTrackApi: function startTrackApi(url, method) { return forward(startTrackApiGuarded, arguments); },
|
|
60
115
|
/** Finishes a call startTrackApi began and records it. */
|
|
61
|
-
endTrackApi: function (id, responseCode, responseMessage) {
|
|
116
|
+
endTrackApi: function endTrackApi(id, responseCode, responseMessage) {
|
|
62
117
|
// the end time now, not when a call made during start-up is replayed
|
|
63
118
|
endTrackApiGuarded(id, responseCode, responseMessage, nowMs());
|
|
64
119
|
},
|
|
120
|
+
/** Builds the rules configure takes: `new AppticsApi.ApiTrackingBuilder()…build()`. */
|
|
121
|
+
ApiTrackingBuilder: ApiTrackingBuilder,
|
|
65
122
|
/** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
|
|
66
|
-
configure:
|
|
123
|
+
configure: function configure(config) { return forward(configureGuarded, arguments); },
|
|
124
|
+
/** Turns automatic API tracking on or off; the `track_api` config flag sets it at start-up. */
|
|
125
|
+
setApiTracking: function setApiTracking(enabled) { return forward(setApiTrackingGuarded, arguments); },
|
|
126
|
+
/** @deprecated the earlier name of setApiTracking, which it calls, with a warning */
|
|
127
|
+
enableApiTracking: function enableApiTracking(enabled) {
|
|
128
|
+
renamed('AppticsApi.enableApiTracking', 'AppticsApi.setApiTracking'); // no i18n
|
|
129
|
+
return forward(setApiTrackingGuarded, arguments);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
const trackErrorGuarded = guard('AppticsError.trackError', trackError); // no i18n
|
|
133
|
+
const setErrorTrackingGuarded = guard('AppticsError.setErrorTracking', setErrorTracking); // no i18n
|
|
134
|
+
/** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
|
|
135
|
+
const AppticsError = {
|
|
136
|
+
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
137
|
+
trackError: function trackError(error, properties) { return forward(trackErrorGuarded, arguments); },
|
|
138
|
+
/** Turns the automatic tracking of uncaught errors and unhandled rejections on or off; the `track_error` config flag sets it at start-up. */
|
|
139
|
+
setErrorTracking: function setErrorTracking(enabled) { return forward(setErrorTrackingGuarded, arguments); },
|
|
140
|
+
/** @deprecated the earlier name of setErrorTracking, which it calls, with a warning */
|
|
141
|
+
trackGlobalErrorHandler: function trackGlobalErrorHandler(enabled) {
|
|
142
|
+
renamed('AppticsError.trackGlobalErrorHandler', 'AppticsError.setErrorTracking'); // no i18n
|
|
143
|
+
return forward(setErrorTrackingGuarded, arguments);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
const setUserGuarded = guard('AppticsUser.setUser', setUser); // no i18n
|
|
147
|
+
const getUserGuarded = guard('AppticsUser.getUser', getUser); // no i18n
|
|
148
|
+
/** Android's AppticsUser: the signed-in user, and the builder for their properties. */
|
|
149
|
+
const AppticsUser = {
|
|
150
|
+
/** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
|
|
151
|
+
setUser: function setUser(userid, groupid, properties) { return forward(setUserGuarded, arguments); },
|
|
152
|
+
/** The registered user, or {} when there is none. */
|
|
153
|
+
getUser: function getUser() { return forward(getUserGuarded, arguments); },
|
|
154
|
+
UserBuilder: UserBuilder,
|
|
155
|
+
};
|
|
156
|
+
const setHeatmapTrackingGuarded = guard('AppticsHeatmap.setHeatmapTracking', trackHeatmap); // no i18n
|
|
157
|
+
/** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
|
|
158
|
+
const AppticsHeatmap = {
|
|
159
|
+
/** Starts or stops recording clicks and scrolls; the `track_heatmap` config flag sets it at start-up. */
|
|
160
|
+
setHeatmapTracking: function setHeatmapTracking(enabled) { return forward(setHeatmapTrackingGuarded, arguments); },
|
|
161
|
+
/** @deprecated the earlier name of setHeatmapTracking, which it calls, with a warning */
|
|
162
|
+
trackHeatmap: function trackHeatmap(on) {
|
|
163
|
+
renamed('AppticsHeatmap.trackHeatmap', 'AppticsHeatmap.setHeatmapTracking'); // no i18n
|
|
164
|
+
return forward(setHeatmapTrackingGuarded, arguments);
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
const setTrackingStatusGuarded = guard('AppticsSettings.setTrackingStatus', setTrackingStatus); // no i18n
|
|
168
|
+
const getTrackingStatusGuarded = guard('AppticsSettings.getTrackingStatus', getTrackingStatus); // no i18n
|
|
169
|
+
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
170
|
+
const AppticsSettings = {
|
|
171
|
+
/** The states setTrackingStatus takes: USAGE_TRACKING_WITH_PII, USAGE_TRACKING_WITHOUT_PII, NO_TRACKING. */
|
|
172
|
+
AP_TRACKING_STATUS: AP_TRACKING_STATUS,
|
|
173
|
+
setTrackingStatus: function setTrackingStatus(status) { return forward(setTrackingStatusGuarded, arguments); },
|
|
174
|
+
getTrackingStatus: function getTrackingStatus() { return forward(getTrackingStatusGuarded, arguments); },
|
|
67
175
|
};
|
|
68
|
-
/** Turns automatic API tracking on or off; the `track_api` config flag is the usual way to set it. */
|
|
69
|
-
const enableApiTracking = guard('enableApiTracking', enableApiTracking$1); // no i18n
|
|
70
|
-
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
71
|
-
const AppticsTrackError = guard('AppticsTrackError', trackError); // no i18n
|
|
72
|
-
const enableGlobalErrorHandler = guard('enableGlobalErrorHandler', enableGlobalErrorHandler$1); // no i18n
|
|
73
|
-
/** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
|
|
74
|
-
const AppticsSetUser = guard('AppticsSetUser', setUser); // no i18n
|
|
75
|
-
const getUser = guard('getUser', getUser$1); // no i18n
|
|
76
|
-
const setTrackingStatus = guard('setTrackingStatus', setTrackingStatus$1); // no i18n
|
|
77
|
-
const getTrackingStatus = guard('getTrackingStatus', getTrackingStatus$1); // no i18n
|
|
78
|
-
const flush = guard('flush', flush$1); // no i18n
|
|
79
|
-
/** Records a line for the next feedback submission. Costs nothing until feedback is sent. */
|
|
80
|
-
const addFeedbackLog = guard('addFeedbackLog', addFeedbackLog$1); // no i18n
|
|
81
|
-
/** Records a diagnostics key/value, grouped under `heading`, for the next feedback submission. */
|
|
82
|
-
const addDiagnosticsInfo = guard('addDiagnosticsInfo', addDiagnosticsInfo$1); // no i18n
|
|
83
|
-
/**
|
|
84
|
-
* Turns debug mode on; works before init(), and wins over `debug` in init().
|
|
85
|
-
*
|
|
86
|
-
* On, engagement, exception and log go to their `debug/` twins and the answers carry a request id
|
|
87
|
-
* and a link into the server's own logs. It switches itself off after an hour with nothing
|
|
88
|
-
* tracked, so a forgotten tab stops tracing on its own.
|
|
89
|
-
*/
|
|
90
|
-
const enableDebug = guard('enableDebug', enableDebug$1); // no i18n
|
|
91
|
-
/** Turns debug mode off; works before init(), and wins over `debug` in init(). */
|
|
92
|
-
const disableDebug = guard('disableDebug', disableDebug$1); // no i18n
|
|
93
|
-
const reset = guard('reset', reset$1); // no i18n
|
|
94
176
|
const apptics = {
|
|
95
177
|
Apptics,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
enableDebug,
|
|
104
|
-
disableDebug,
|
|
105
|
-
enableApiTracking,
|
|
106
|
-
AppticsTrackError,
|
|
107
|
-
enableGlobalErrorHandler,
|
|
108
|
-
AppticsSetUser,
|
|
109
|
-
getUser,
|
|
110
|
-
users,
|
|
111
|
-
setTrackingStatus,
|
|
112
|
-
getTrackingStatus,
|
|
113
|
-
flush,
|
|
114
|
-
addFeedbackLog,
|
|
115
|
-
addDiagnosticsInfo,
|
|
116
|
-
reset,
|
|
117
|
-
AP_TRACKING_STATUS,
|
|
118
|
-
AP_FEEDBACK_TYPE,
|
|
178
|
+
AppticsEvent,
|
|
179
|
+
AppticsScreen,
|
|
180
|
+
AppticsApi,
|
|
181
|
+
AppticsError,
|
|
182
|
+
AppticsUser,
|
|
183
|
+
AppticsSettings,
|
|
184
|
+
AppticsHeatmap,
|
|
119
185
|
};
|
|
120
|
-
scheduleAutoInit(Apptics);
|
|
121
186
|
|
|
122
|
-
export {
|
|
187
|
+
export { Apptics, AppticsApi, AppticsError, AppticsEvent, AppticsHeatmap, AppticsScreen, AppticsSettings, AppticsUser, apptics as default };
|
package/dist/esm/lifecycle.d.ts
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
+
import { type ScreenRouteRule } from './core/constants.js';
|
|
1
2
|
import type { AppticsConfig } from './types.js';
|
|
2
3
|
/**
|
|
3
|
-
* Starts the SDK. The config object is required:
|
|
4
|
-
*
|
|
5
|
-
* Returns true when the config has serviceUrl, zak, identifier and appversion and start-up has
|
|
4
|
+
* Starts the SDK. The config object is required: the SDK starts only when the app calls this.
|
|
5
|
+
* Returns true when the config has base_url, auth_key, app_domain and appversion and start-up has
|
|
6
6
|
* begun (see ready()), false when it was already running, the config is missing or incomplete, or
|
|
7
7
|
* there is no browser. Start-up calls app/addversion with those four, which answers with aaid, the
|
|
8
8
|
* portal and project ids and the rest; then device/add registers the browser, as in 1.x.
|
|
9
9
|
*/
|
|
10
10
|
export declare function init(config: AppticsConfig): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* screen_routes as init() keeps it: each entry checked, an exact path cleaned up, a regex given as
|
|
13
|
+
* a string compiled. An entry that cannot be used is left out, and said, rather than matching
|
|
14
|
+
* something its author did not mean.
|
|
15
|
+
*/
|
|
16
|
+
export declare function screenRouteRules(routes: unknown): ScreenRouteRule[];
|
|
11
17
|
/** Resolves true once start-up has finished, false if init() refused or storage is unusable. */
|
|
12
18
|
export declare function ready(): Promise<boolean>;
|
|
13
19
|
/** Clears stored identity and queues, then starts again from the snippet. */
|
|
14
20
|
export declare function reset(): void;
|
|
21
|
+
/**
|
|
22
|
+
* AppticsEvent.setClickTracking: click tracking from markup on or off, as the `track_click`
|
|
23
|
+
* config sets it. The listener stays; it checks the switch on every click.
|
|
24
|
+
*/
|
|
25
|
+
export declare function setClickTracking(enabled?: boolean): void;
|
|
26
|
+
/**
|
|
27
|
+
* AppticsScreen.setScreenTracking: automatic screen tracking on or off, as the `track_screen`
|
|
28
|
+
* config sets it. Applied now once the SDK is running; before that it is only noted, and start()
|
|
29
|
+
* switches tracking to it. Like the other switches, the next init() (a reset() too) goes back to
|
|
30
|
+
* what its config says.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setScreenTracking(enabled?: boolean): void;
|