@zoho_apptics/apptics-js-sdk 2.0.0-beta.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +127 -16
- package/README.md +357 -215
- package/dist/apptics-pn-sw.js +3 -0
- package/dist/apptics-pn-sw.js.map +1 -0
- 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/batch-Axq9sTzR.min.js +3 -0
- package/dist/chunks/batch-Axq9sTzR.min.js.map +1 -0
- package/dist/chunks/lifecycle-Cvg78jN_.min.js +3 -0
- package/dist/chunks/lifecycle-Cvg78jN_.min.js.map +1 -0
- package/dist/chunks/send-DBpesydB.min.js +3 -0
- package/dist/chunks/send-DBpesydB.min.js.map +1 -0
- package/dist/chunks/transport-B21X39p4.min.js +3 -0
- package/dist/chunks/transport-B21X39p4.min.js.map +1 -0
- package/dist/cjs/core/attempts.js +1 -1
- package/dist/cjs/core/batch.js +4 -4
- package/dist/cjs/core/consent.d.ts +17 -4
- package/dist/cjs/core/consent.js +81 -14
- package/dist/cjs/core/console-call.d.ts +23 -0
- package/dist/cjs/core/console-call.js +63 -0
- package/dist/cjs/core/constants.d.ts +66 -17
- package/dist/cjs/core/constants.js +76 -19
- package/dist/cjs/core/db.js +31 -7
- package/dist/cjs/core/debug.d.ts +6 -4
- package/dist/cjs/core/debug.js +36 -12
- 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.js +19 -4
- package/dist/cjs/core/hooks.d.ts +29 -0
- package/dist/cjs/core/hooks.js +12 -1
- package/dist/cjs/core/locks.js +1 -1
- package/dist/cjs/core/logger.js +1 -1
- package/dist/cjs/core/shield.d.ts +31 -0
- package/dist/cjs/core/shield.js +129 -0
- package/dist/cjs/core/state.d.ts +11 -5
- package/dist/cjs/core/state.js +4 -4
- package/dist/cjs/core/storage.d.ts +7 -0
- package/dist/cjs/core/storage.js +28 -9
- package/dist/cjs/core/stylesheet.js +1 -1
- package/dist/cjs/core/transport.d.ts +15 -4
- package/dist/cjs/core/transport.js +72 -25
- package/dist/cjs/core/utils.js +1 -1
- package/dist/cjs/core/validate.js +6 -5
- package/dist/cjs/device/appversion.d.ts +10 -1
- package/dist/cjs/device/appversion.js +26 -3
- package/dist/cjs/device/index.d.ts +17 -2
- package/dist/cjs/device/index.js +251 -35
- package/dist/cjs/engagement/api-rules.js +1 -1
- package/dist/cjs/engagement/auto-api.js +4 -3
- package/dist/cjs/engagement/auto-screen.js +10 -6
- package/dist/cjs/engagement/defined-events.d.ts +2 -3
- package/dist/cjs/engagement/defined-events.js +10 -16
- package/dist/cjs/engagement/send.js +7 -3
- package/dist/cjs/engagement/session.d.ts +17 -0
- package/dist/cjs/engagement/session.js +154 -23
- package/dist/cjs/engagement/track.d.ts +4 -4
- package/dist/cjs/engagement/track.js +23 -17
- package/dist/cjs/errors/send.js +2 -2
- package/dist/cjs/errors/track.d.ts +2 -1
- package/dist/cjs/errors/track.js +8 -5
- package/dist/cjs/feedback/controls.d.ts +36 -4
- package/dist/cjs/feedback/controls.js +302 -67
- package/dist/cjs/feedback/i18n/index.d.ts +31 -0
- package/dist/cjs/feedback/i18n/index.js +187 -0
- package/dist/cjs/feedback/i18n/strings.d.ts +9 -0
- package/dist/cjs/feedback/i18n/strings.js +8 -0
- package/dist/cjs/feedback/index.js +1 -1
- package/dist/cjs/feedback/logs.d.ts +3 -6
- package/dist/cjs/feedback/logs.js +12 -21
- package/dist/cjs/feedback/quartz.js +5 -2
- package/dist/cjs/feedback/send.d.ts +6 -3
- package/dist/cjs/feedback/send.js +59 -41
- package/dist/cjs/feedback/styles.js +2 -2
- package/dist/cjs/feedback/template.d.ts +4 -2
- package/dist/cjs/feedback/template.js +73 -44
- package/dist/cjs/feedback/ui.d.ts +47 -4
- package/dist/cjs/feedback/ui.js +351 -97
- package/dist/cjs/heatmap/send.d.ts +2 -0
- package/dist/cjs/heatmap/send.js +3 -5
- package/dist/cjs/heatmap/track.js +13 -9
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +55 -18
- package/dist/cjs/lifecycle.d.ts +13 -2
- package/dist/cjs/lifecycle.js +233 -118
- package/dist/cjs/pushnotification/display.d.ts +65 -0
- package/dist/cjs/pushnotification/display.js +112 -0
- package/dist/cjs/pushnotification/index.d.ts +20 -0
- package/dist/cjs/pushnotification/index.js +96 -0
- package/dist/cjs/pushnotification/kept-opens.d.ts +23 -0
- package/dist/cjs/pushnotification/kept-opens.js +64 -0
- package/dist/cjs/pushnotification/notify.d.ts +45 -0
- package/dist/cjs/pushnotification/notify.js +476 -0
- package/dist/cjs/pushnotification/payload.d.ts +65 -0
- package/dist/cjs/pushnotification/payload.js +279 -0
- package/dist/cjs/pushnotification/session.d.ts +46 -0
- package/dist/cjs/pushnotification/session.js +413 -0
- package/dist/cjs/pushnotification/stats.d.ts +45 -0
- package/dist/cjs/pushnotification/stats.js +244 -0
- package/dist/cjs/pushnotification/wms.d.ts +30 -0
- package/dist/cjs/pushnotification/wms.js +374 -0
- package/dist/cjs/remoteconfig/country.js +1 -1
- package/dist/cjs/remoteconfig/custom.js +4 -3
- package/dist/cjs/remoteconfig/evaluate.js +1 -1
- package/dist/cjs/remoteconfig/fetch.d.ts +17 -10
- package/dist/cjs/remoteconfig/fetch.js +146 -32
- package/dist/cjs/remoteconfig/index.d.ts +9 -5
- package/dist/cjs/remoteconfig/index.js +24 -32
- package/dist/cjs/remoteconfig/store.d.ts +15 -7
- package/dist/cjs/remoteconfig/store.js +68 -35
- package/dist/cjs/remoteconfig/tz-countries.js +1 -1
- package/dist/cjs/{core → remotelog}/callsite.d.ts +5 -4
- package/dist/cjs/{core → remotelog}/callsite.js +6 -5
- package/dist/cjs/remotelog/gate.js +1 -1
- package/dist/cjs/remotelog/logger.js +2 -2
- package/dist/cjs/remotelog/send.js +6 -5
- package/dist/cjs/remotelogger/index.js +1 -1
- package/dist/cjs/scheduler.d.ts +3 -1
- package/dist/cjs/scheduler.js +34 -25
- package/dist/cjs/sw/apptics-pn-sw.d.ts +83 -0
- package/dist/cjs/sw/timers.d.ts +44 -0
- package/dist/cjs/types.d.ts +90 -29
- package/dist/cjs/user/index.d.ts +7 -0
- package/dist/cjs/user/index.js +25 -3
- package/dist/esm/core/attempts.js +1 -1
- package/dist/esm/core/batch.js +4 -4
- package/dist/esm/core/consent.d.ts +17 -4
- package/dist/esm/core/consent.js +84 -20
- package/dist/esm/core/console-call.d.ts +23 -0
- package/dist/esm/core/console-call.js +60 -0
- package/dist/esm/core/constants.d.ts +66 -17
- package/dist/esm/core/constants.js +73 -20
- package/dist/esm/core/db.js +31 -7
- package/dist/esm/core/debug.d.ts +6 -4
- package/dist/esm/core/debug.js +37 -13
- 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.js +19 -4
- package/dist/esm/core/hooks.d.ts +29 -0
- package/dist/esm/core/hooks.js +12 -1
- package/dist/esm/core/locks.js +1 -1
- package/dist/esm/core/logger.js +1 -1
- package/dist/esm/core/shield.d.ts +31 -0
- package/dist/esm/core/shield.js +119 -0
- package/dist/esm/core/state.d.ts +11 -5
- package/dist/esm/core/state.js +4 -4
- package/dist/esm/core/storage.d.ts +7 -0
- package/dist/esm/core/storage.js +28 -11
- package/dist/esm/core/stylesheet.js +1 -1
- package/dist/esm/core/transport.d.ts +15 -4
- package/dist/esm/core/transport.js +73 -28
- package/dist/esm/core/utils.js +1 -1
- package/dist/esm/core/validate.js +6 -5
- package/dist/esm/device/appversion.d.ts +10 -1
- package/dist/esm/device/appversion.js +26 -4
- package/dist/esm/device/index.d.ts +17 -2
- package/dist/esm/device/index.js +255 -42
- package/dist/esm/engagement/api-rules.js +1 -1
- package/dist/esm/engagement/auto-api.js +4 -3
- package/dist/esm/engagement/auto-screen.js +10 -6
- package/dist/esm/engagement/defined-events.d.ts +2 -3
- package/dist/esm/engagement/defined-events.js +10 -16
- package/dist/esm/engagement/send.js +7 -3
- package/dist/esm/engagement/session.d.ts +17 -0
- package/dist/esm/engagement/session.js +152 -24
- package/dist/esm/engagement/track.d.ts +4 -4
- package/dist/esm/engagement/track.js +24 -18
- package/dist/esm/errors/send.js +2 -2
- package/dist/esm/errors/track.d.ts +2 -1
- package/dist/esm/errors/track.js +8 -5
- package/dist/esm/feedback/controls.d.ts +36 -4
- package/dist/esm/feedback/controls.js +298 -68
- package/dist/esm/feedback/i18n/index.d.ts +31 -0
- package/dist/esm/feedback/i18n/index.js +178 -0
- package/dist/esm/feedback/i18n/strings.d.ts +9 -0
- package/dist/esm/feedback/i18n/strings.js +4 -0
- package/dist/esm/feedback/index.js +1 -1
- package/dist/esm/feedback/logs.d.ts +3 -6
- package/dist/esm/feedback/logs.js +12 -21
- package/dist/esm/feedback/quartz.js +5 -2
- package/dist/esm/feedback/send.d.ts +6 -3
- package/dist/esm/feedback/send.js +61 -44
- package/dist/esm/feedback/styles.js +2 -2
- package/dist/esm/feedback/template.d.ts +4 -2
- package/dist/esm/feedback/template.js +73 -44
- package/dist/esm/feedback/ui.d.ts +47 -4
- package/dist/esm/feedback/ui.js +353 -99
- package/dist/esm/heatmap/send.d.ts +2 -0
- package/dist/esm/heatmap/send.js +3 -5
- package/dist/esm/heatmap/track.js +13 -9
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +58 -21
- package/dist/esm/lifecycle.d.ts +13 -2
- package/dist/esm/lifecycle.js +238 -125
- package/dist/esm/pushnotification/display.d.ts +65 -0
- package/dist/esm/pushnotification/display.js +95 -0
- package/dist/esm/pushnotification/index.d.ts +20 -0
- package/dist/esm/pushnotification/index.js +91 -0
- package/dist/esm/pushnotification/kept-opens.d.ts +23 -0
- package/dist/esm/pushnotification/kept-opens.js +62 -0
- package/dist/esm/pushnotification/notify.d.ts +45 -0
- package/dist/esm/pushnotification/notify.js +469 -0
- package/dist/esm/pushnotification/payload.d.ts +65 -0
- package/dist/esm/pushnotification/payload.js +272 -0
- package/dist/esm/pushnotification/session.d.ts +46 -0
- package/dist/esm/pushnotification/session.js +402 -0
- package/dist/esm/pushnotification/stats.d.ts +45 -0
- package/dist/esm/pushnotification/stats.js +238 -0
- package/dist/esm/pushnotification/wms.d.ts +30 -0
- package/dist/esm/pushnotification/wms.js +368 -0
- package/dist/esm/remoteconfig/country.js +1 -1
- package/dist/esm/remoteconfig/custom.js +4 -3
- package/dist/esm/remoteconfig/evaluate.js +1 -1
- package/dist/esm/remoteconfig/fetch.d.ts +17 -10
- package/dist/esm/remoteconfig/fetch.js +147 -33
- package/dist/esm/remoteconfig/index.d.ts +9 -5
- package/dist/esm/remoteconfig/index.js +24 -32
- package/dist/esm/remoteconfig/store.d.ts +15 -7
- package/dist/esm/remoteconfig/store.js +68 -36
- package/dist/esm/remoteconfig/tz-countries.js +1 -1
- package/dist/esm/{core → remotelog}/callsite.d.ts +5 -4
- package/dist/esm/{core → remotelog}/callsite.js +6 -5
- package/dist/esm/remotelog/gate.js +1 -1
- package/dist/esm/remotelog/logger.js +2 -2
- package/dist/esm/remotelog/send.js +6 -5
- package/dist/esm/remotelogger/index.js +1 -1
- package/dist/esm/scheduler.d.ts +3 -1
- package/dist/esm/scheduler.js +35 -27
- package/dist/esm/sw/apptics-pn-sw.d.ts +83 -0
- package/dist/esm/sw/timers.d.ts +44 -0
- package/dist/esm/types.d.ts +90 -29
- package/dist/esm/user/index.d.ts +7 -0
- package/dist/esm/user/index.js +26 -5
- package/dist/feedback.esm.min.js +2 -2
- package/dist/feedback.esm.min.js.map +1 -1
- package/dist/pushnotification.esm.min.js +3 -0
- package/dist/pushnotification.esm.min.js.map +1 -0
- 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 +17 -3
- package/dist/chunks/lifecycle-VYr43KcB.min.js +0 -3
- package/dist/chunks/lifecycle-VYr43KcB.min.js.map +0 -1
- package/dist/cjs/auto-init.d.ts +0 -8
- package/dist/cjs/auto-init.js +0 -32
- package/dist/esm/auto-init.d.ts +0 -8
- package/dist/esm/auto-init.js +0 -29
|
@@ -8,6 +8,8 @@ import type { Dict, ServerResult } from '../types.js';
|
|
|
8
8
|
*
|
|
9
9
|
* Gated on the server's own heatmap flag (getsdkconfig module 18), not on engagement: an app may
|
|
10
10
|
* want events while declining to have every click's coordinates recorded.
|
|
11
|
+
*
|
|
12
|
+
* The scheduler reaches it through hooks.sendHeatmaps, which src/index.ts sets.
|
|
11
13
|
*/
|
|
12
14
|
export declare function sendHeatmapData(forget?: boolean): Promise<void>;
|
|
13
15
|
export declare function requestToSendHeatmaps(_payload: Dict, forget?: boolean): Promise<ServerResult>;
|
package/dist/cjs/heatmap/send.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var state = require('../core/state.js');
|
|
@@ -9,7 +9,6 @@ var env = require('../core/env.js');
|
|
|
9
9
|
var consent = require('../core/consent.js');
|
|
10
10
|
var batch = require('../core/batch.js');
|
|
11
11
|
var transport = require('../core/transport.js');
|
|
12
|
-
var hooks = require('../core/hooks.js');
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Sends queued heatmap records to heatmap/add.
|
|
@@ -20,6 +19,8 @@ var hooks = require('../core/hooks.js');
|
|
|
20
19
|
*
|
|
21
20
|
* Gated on the server's own heatmap flag (getsdkconfig module 18), not on engagement: an app may
|
|
22
21
|
* want events while declining to have every click's coordinates recorded.
|
|
22
|
+
*
|
|
23
|
+
* The scheduler reaches it through hooks.sendHeatmaps, which src/index.ts sets.
|
|
23
24
|
*/
|
|
24
25
|
function sendHeatmapData(forget) {
|
|
25
26
|
if (env.is_apptics_disabled() || !consent.shouldTrackOrSendData() || !state._ZAP._heatmapTracking) {
|
|
@@ -74,9 +75,6 @@ function requestToSendHeatmaps(_payload, forget) {
|
|
|
74
75
|
var label = 'requestToSendHeatmaps'; // no i18n
|
|
75
76
|
return batch.sendBatch('heatmap', label, _payload, forget); // no i18n
|
|
76
77
|
}
|
|
77
|
-
// the scheduler flushes through this, so importing the heatmap entry is what puts heatmap
|
|
78
|
-
// records on the flush timer at all
|
|
79
|
-
hooks.hooks.sendHeatmaps = sendHeatmapData;
|
|
80
78
|
|
|
81
79
|
exports.requestToSendHeatmaps = requestToSendHeatmaps;
|
|
82
80
|
exports.sendHeatmapData = sendHeatmapData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var constants = require('../core/constants.js');
|
|
@@ -12,6 +12,7 @@ var consent = require('../core/consent.js');
|
|
|
12
12
|
var track = require('../engagement/track.js');
|
|
13
13
|
var hooks = require('../core/hooks.js');
|
|
14
14
|
var debug = require('../core/debug.js');
|
|
15
|
+
var shield = require('../core/shield.js');
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Where people click and how far they scroll.
|
|
@@ -221,7 +222,7 @@ function store(record) {
|
|
|
221
222
|
recorded++;
|
|
222
223
|
debug.noteDebugActivity();
|
|
223
224
|
// a heatmap record is worth a session in the same way an event is
|
|
224
|
-
session.commitPendingSession();
|
|
225
|
+
shield.quietly('session', session.commitPendingSession()); // no i18n
|
|
225
226
|
storage.heatmap_transactions.add(record);
|
|
226
227
|
logger.Console.dir(record);
|
|
227
228
|
}
|
|
@@ -282,13 +283,13 @@ function watchForDeadClick(record, target) {
|
|
|
282
283
|
catch (err) {
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
285
|
-
setTimeout(function () {
|
|
286
|
+
setTimeout(shield.shield('heatmap dead click', function () {
|
|
286
287
|
observer.disconnect();
|
|
287
288
|
if (!changed && window.location.href === url) {
|
|
288
289
|
record.is_dead_click = 1;
|
|
289
290
|
storage.heatmap_transactions.update(record);
|
|
290
291
|
}
|
|
291
|
-
}, DEAD_CLICK_MS);
|
|
292
|
+
}), DEAD_CLICK_MS);
|
|
292
293
|
}
|
|
293
294
|
/**
|
|
294
295
|
* What a scroll event moved, as a gesture counts it: null for the window (the event's target is
|
|
@@ -345,7 +346,7 @@ function onScroll(event) {
|
|
|
345
346
|
else {
|
|
346
347
|
clearTimeout(scrollTimer);
|
|
347
348
|
}
|
|
348
|
-
scrollTimer = setTimeout(endScrollGesture, SCROLL_IDLE_MS);
|
|
349
|
+
scrollTimer = setTimeout(shield.shield('heatmap scroll', endScrollGesture), SCROLL_IDLE_MS); // no i18n
|
|
349
350
|
}
|
|
350
351
|
/** One record for the whole burst, once the page has been still for SCROLL_IDLE_MS. */
|
|
351
352
|
function endScrollGesture() {
|
|
@@ -404,6 +405,9 @@ function endScrollGesture() {
|
|
|
404
405
|
logger.logFailure(constants.AP_LOG_MODULE.HEATMAP, 'apptics.heatmap: scroll capture failed: ' + String(err)); // no i18n
|
|
405
406
|
}
|
|
406
407
|
}
|
|
408
|
+
// the listeners as added, so the same functions come off again
|
|
409
|
+
const pointerListener = shield.shield('heatmap click', onPointerDown); // no i18n
|
|
410
|
+
const scrollListener = shield.shield('heatmap scroll', onScroll); // no i18n
|
|
407
411
|
/** Turns capture on or off. Listeners are passive, so they never delay a click or a scroll. */
|
|
408
412
|
function trackHeatmap(status) {
|
|
409
413
|
var wanted = typeof status === 'boolean' ? status : true; // no i18n
|
|
@@ -414,14 +418,14 @@ function trackHeatmap(status) {
|
|
|
414
418
|
// where the page already is, so the first gesture is measured from here and not from 0
|
|
415
419
|
lastX = Math.round(window.scrollX || 0);
|
|
416
420
|
lastY = Math.round(window.scrollY || 0);
|
|
417
|
-
window.addEventListener('pointerdown',
|
|
418
|
-
window.addEventListener('scroll',
|
|
421
|
+
window.addEventListener('pointerdown', pointerListener, { capture: true, passive: true }); // no i18n
|
|
422
|
+
window.addEventListener('scroll', scrollListener, { capture: true, passive: true }); // no i18n
|
|
419
423
|
installed = true;
|
|
420
424
|
logger.Console.log('apptics.heatmap: capturing clicks and scrolls'); // no i18n
|
|
421
425
|
return;
|
|
422
426
|
}
|
|
423
|
-
window.removeEventListener('pointerdown',
|
|
424
|
-
window.removeEventListener('scroll',
|
|
427
|
+
window.removeEventListener('pointerdown', pointerListener, true); // no i18n
|
|
428
|
+
window.removeEventListener('scroll', scrollListener, true); // no i18n
|
|
425
429
|
// a gesture still settling when capture stops (a single-page app leaving a heatmap page) is
|
|
426
430
|
// recorded as it stands, not dropped: it was the visitor's last scroll on that page
|
|
427
431
|
if (scrollTimer !== null) {
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import './heatmap/send.js';
|
|
2
1
|
import type { AppticsSdk } from './types.js';
|
|
3
2
|
export type { AppticsSdk, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
|
|
4
3
|
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
@@ -14,7 +13,7 @@ export type { ApiTrackingConfig } from './engagement/api-rules.js';
|
|
|
14
13
|
export declare const AppticsError: AppticsSdk['AppticsError'];
|
|
15
14
|
/** Android's AppticsUser: the signed-in user, and the builder for their properties. */
|
|
16
15
|
export declare const AppticsUser: AppticsSdk['AppticsUser'];
|
|
17
|
-
/** Heatmap capture: AppticsHeatmap.
|
|
16
|
+
/** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
|
|
18
17
|
export declare const AppticsHeatmap: AppticsSdk['AppticsHeatmap'];
|
|
19
18
|
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
20
19
|
export declare const AppticsSettings: AppticsSdk['AppticsSettings'];
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var constants = require('./core/constants.js');
|
|
7
7
|
var guard = require('./core/guard.js');
|
|
8
|
+
var logger = require('./core/logger.js');
|
|
8
9
|
var lifecycle = require('./lifecycle.js');
|
|
9
10
|
var autoApi = require('./engagement/auto-api.js');
|
|
10
11
|
var track = require('./engagement/track.js');
|
|
@@ -17,17 +18,22 @@ var index = require('./user/index.js');
|
|
|
17
18
|
var consent = require('./core/consent.js');
|
|
18
19
|
var scheduler = require('./scheduler.js');
|
|
19
20
|
var track$2 = require('./heatmap/track.js');
|
|
20
|
-
require('./heatmap/send.js');
|
|
21
|
-
var
|
|
21
|
+
var send = require('./heatmap/send.js');
|
|
22
|
+
var hooks = require('./core/hooks.js');
|
|
22
23
|
var debug = require('./core/debug.js');
|
|
23
24
|
|
|
25
|
+
// flush() and the flush timer send heatmap records through this hook. Set here, from a named
|
|
26
|
+
// import, rather than by heatmap/send.ts on being imported: the package's sideEffects list names
|
|
27
|
+
// only the CDN bundle, so a bundler drops a bare `import './heatmap/send.js'`, and with it every
|
|
28
|
+
// heatmap send, while capture carries on filling the queue
|
|
29
|
+
hooks.hooks.sendHeatmaps = send.sendHeatmapData;
|
|
24
30
|
/*
|
|
25
31
|
* Every public call below is a function of its own, with the parameter names the console shows
|
|
26
32
|
* on hover, forwarding to its guard()ed implementation (see forward).
|
|
27
33
|
*/
|
|
28
34
|
const initGuarded = guard.guard('Apptics.init', lifecycle.init); // no i18n
|
|
29
35
|
const readyGuarded = guard.guard('Apptics.ready', lifecycle.ready); // no i18n
|
|
30
|
-
const flushGuarded = guard.guard('Apptics.flush', scheduler.
|
|
36
|
+
const flushGuarded = guard.guard('Apptics.flush', scheduler.calledFlush); // no i18n
|
|
31
37
|
const resetGuarded = guard.guard('Apptics.reset', lifecycle.reset); // no i18n
|
|
32
38
|
/**
|
|
33
39
|
* Debug mode, on or off; works before init(), and wins over `debug` in init(). On, engagement,
|
|
@@ -37,13 +43,23 @@ const resetGuarded = guard.guard('Apptics.reset', lifecycle.reset); // no i18n
|
|
|
37
43
|
*/
|
|
38
44
|
const enableDebugGuarded = guard.guard('Apptics.enableDebug', debug.enableDebug); // no i18n
|
|
39
45
|
const disableDebugGuarded = guard.guard('Apptics.disableDebug', debug.disableDebug); // no i18n
|
|
46
|
+
/** The renamed calls already warned about: once per page each, not once per call. */
|
|
47
|
+
var warnedRenamed = {};
|
|
48
|
+
/** An earlier name of a call still works, with a console warning naming the call to use. */
|
|
49
|
+
function renamed(old, current) {
|
|
50
|
+
if (warnedRenamed[old]) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
warnedRenamed[old] = true;
|
|
54
|
+
logger.warnAlways(old + ' is now ' + current + '; rename it in your code'); // no i18n
|
|
55
|
+
}
|
|
40
56
|
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
41
57
|
const Apptics = {
|
|
42
|
-
/** Starts the SDK
|
|
58
|
+
/** Starts the SDK with the app's config object, which is required. */
|
|
43
59
|
init: function init(config) { return guard.forward(initGuarded, arguments); },
|
|
44
60
|
/** Resolves true once the SDK is running, false if it can't start. */
|
|
45
61
|
ready: function ready() { return guard.forward(readyGuarded, arguments); },
|
|
46
|
-
/** Sends stored engagements, errors and heatmap records now. */
|
|
62
|
+
/** Sends stored engagements, errors and heatmap records now; at most once every 15 seconds. */
|
|
47
63
|
flush: function flush() { return guard.forward(flushGuarded, arguments); },
|
|
48
64
|
/** Clears stored identity, queued data and remote config values, then starts again. */
|
|
49
65
|
reset: function reset() { return guard.forward(resetGuarded, arguments); },
|
|
@@ -51,19 +67,23 @@ const Apptics = {
|
|
|
51
67
|
disableDebug: function disableDebug() { return guard.forward(disableDebugGuarded, arguments); },
|
|
52
68
|
};
|
|
53
69
|
/**
|
|
54
|
-
* Android's AppticsEvents: `addEvent(name, group
|
|
70
|
+
* Android's AppticsEvents: `addEvent(name, group, properties?)`, or
|
|
55
71
|
* `addEvent(AppticsEvent.DefinedEvents.X, properties?)`.
|
|
56
72
|
*/
|
|
57
73
|
const addEventGuarded = guard.guard('AppticsEvent.addEvent', track.trackEvent); // no i18n
|
|
74
|
+
const setClickTrackingGuarded = guard.guard('AppticsEvent.setClickTracking', lifecycle.setClickTracking); // no i18n
|
|
58
75
|
const AppticsEvent = {
|
|
59
76
|
/** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
|
|
60
77
|
DefinedEvents: definedEvents.DefinedEvents,
|
|
61
78
|
addEvent: function addEvent(eventName, groupName, properties) {
|
|
62
79
|
return guard.forward(addEventGuarded, arguments);
|
|
63
80
|
},
|
|
81
|
+
/** Turns click tracking from markup (apeventaction) on or off; the `track_click` config flag sets it at start-up. */
|
|
82
|
+
setClickTracking: function setClickTracking(enabled) { return guard.forward(setClickTrackingGuarded, arguments); },
|
|
64
83
|
};
|
|
65
84
|
const inScreenGuarded = guard.guard('AppticsScreen.inScreen', track.inScreenAt); // no i18n
|
|
66
85
|
const outScreenGuarded = guard.guard('AppticsScreen.outScreen', track.outScreenAt); // no i18n
|
|
86
|
+
const setScreenTrackingGuarded = guard.guard('AppticsScreen.setScreenTracking', lifecycle.setScreenTracking); // no i18n
|
|
67
87
|
/** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
|
|
68
88
|
const AppticsScreen = {
|
|
69
89
|
/**
|
|
@@ -85,11 +105,13 @@ const AppticsScreen = {
|
|
|
85
105
|
outScreen: function outScreen(id) {
|
|
86
106
|
outScreenGuarded(id, utils.nowMs());
|
|
87
107
|
},
|
|
108
|
+
/** Turns automatic screen tracking on or off; the `track_screen` config flag sets it at start-up. */
|
|
109
|
+
setScreenTracking: function setScreenTracking(enabled) { return guard.forward(setScreenTrackingGuarded, arguments); },
|
|
88
110
|
};
|
|
89
111
|
const endTrackApiGuarded = guard.guard('AppticsApi.endTrackApi', track.endTrackApiAt); // no i18n
|
|
90
112
|
const startTrackApiGuarded = guard.guard('AppticsApi.startTrackApi', track.startTrackApi); // no i18n
|
|
91
113
|
const configureGuarded = guard.guard('AppticsApi.configure', apiRules.configureApiTracking); // no i18n
|
|
92
|
-
const
|
|
114
|
+
const setApiTrackingGuarded = guard.guard('AppticsApi.setApiTracking', autoApi.enableApiTracking); // no i18n
|
|
93
115
|
/** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
|
|
94
116
|
const AppticsApi = {
|
|
95
117
|
/** Begins timing one call: returns the id endTrackApi takes. */
|
|
@@ -103,17 +125,27 @@ const AppticsApi = {
|
|
|
103
125
|
ApiTrackingBuilder: apiRules.ApiTrackingBuilder,
|
|
104
126
|
/** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
|
|
105
127
|
configure: function configure(config) { return guard.forward(configureGuarded, arguments); },
|
|
106
|
-
/** Turns automatic API tracking on or off; the `track_api` config flag
|
|
107
|
-
|
|
128
|
+
/** Turns automatic API tracking on or off; the `track_api` config flag sets it at start-up. */
|
|
129
|
+
setApiTracking: function setApiTracking(enabled) { return guard.forward(setApiTrackingGuarded, arguments); },
|
|
130
|
+
/** @deprecated the earlier name of setApiTracking, which it calls, with a warning */
|
|
131
|
+
enableApiTracking: function enableApiTracking(enabled) {
|
|
132
|
+
renamed('AppticsApi.enableApiTracking', 'AppticsApi.setApiTracking'); // no i18n
|
|
133
|
+
return guard.forward(setApiTrackingGuarded, arguments);
|
|
134
|
+
},
|
|
108
135
|
};
|
|
109
136
|
const trackErrorGuarded = guard.guard('AppticsError.trackError', track$1.trackError); // no i18n
|
|
110
|
-
const
|
|
137
|
+
const setErrorTrackingGuarded = guard.guard('AppticsError.setErrorTracking', track$1.setErrorTracking); // no i18n
|
|
111
138
|
/** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
|
|
112
139
|
const AppticsError = {
|
|
113
140
|
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
114
141
|
trackError: function trackError(error, properties) { return guard.forward(trackErrorGuarded, arguments); },
|
|
115
|
-
/** Turns the automatic tracking of uncaught errors and unhandled rejections on or off. */
|
|
116
|
-
|
|
142
|
+
/** Turns the automatic tracking of uncaught errors and unhandled rejections on or off; the `track_error` config flag sets it at start-up. */
|
|
143
|
+
setErrorTracking: function setErrorTracking(enabled) { return guard.forward(setErrorTrackingGuarded, arguments); },
|
|
144
|
+
/** @deprecated the earlier name of setErrorTracking, which it calls, with a warning */
|
|
145
|
+
trackGlobalErrorHandler: function trackGlobalErrorHandler(enabled) {
|
|
146
|
+
renamed('AppticsError.trackGlobalErrorHandler', 'AppticsError.setErrorTracking'); // no i18n
|
|
147
|
+
return guard.forward(setErrorTrackingGuarded, arguments);
|
|
148
|
+
},
|
|
117
149
|
};
|
|
118
150
|
const setUserGuarded = guard.guard('AppticsUser.setUser', index.setUser); // no i18n
|
|
119
151
|
const getUserGuarded = guard.guard('AppticsUser.getUser', index.getUser); // no i18n
|
|
@@ -125,16 +157,22 @@ const AppticsUser = {
|
|
|
125
157
|
getUser: function getUser() { return guard.forward(getUserGuarded, arguments); },
|
|
126
158
|
UserBuilder: index.UserBuilder,
|
|
127
159
|
};
|
|
128
|
-
const
|
|
129
|
-
/** Heatmap capture: AppticsHeatmap.
|
|
160
|
+
const setHeatmapTrackingGuarded = guard.guard('AppticsHeatmap.setHeatmapTracking', track$2.trackHeatmap); // no i18n
|
|
161
|
+
/** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
|
|
130
162
|
const AppticsHeatmap = {
|
|
131
|
-
|
|
163
|
+
/** Starts or stops recording clicks and scrolls; the `track_heatmap` config flag sets it at start-up. */
|
|
164
|
+
setHeatmapTracking: function setHeatmapTracking(enabled) { return guard.forward(setHeatmapTrackingGuarded, arguments); },
|
|
165
|
+
/** @deprecated the earlier name of setHeatmapTracking, which it calls, with a warning */
|
|
166
|
+
trackHeatmap: function trackHeatmap(on) {
|
|
167
|
+
renamed('AppticsHeatmap.trackHeatmap', 'AppticsHeatmap.setHeatmapTracking'); // no i18n
|
|
168
|
+
return guard.forward(setHeatmapTrackingGuarded, arguments);
|
|
169
|
+
},
|
|
132
170
|
};
|
|
133
171
|
const setTrackingStatusGuarded = guard.guard('AppticsSettings.setTrackingStatus', consent.setTrackingStatus); // no i18n
|
|
134
172
|
const getTrackingStatusGuarded = guard.guard('AppticsSettings.getTrackingStatus', consent.getTrackingStatus); // no i18n
|
|
135
173
|
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
136
174
|
const AppticsSettings = {
|
|
137
|
-
/** The states setTrackingStatus takes: USAGE_TRACKING_WITH_PII, USAGE_TRACKING_WITHOUT_PII, NO_TRACKING. */
|
|
175
|
+
/** The states setTrackingStatus takes: USAGE_TRACKING_WITH_PII, USAGE_TRACKING_WITHOUT_PII, ANONYMOUS, NO_TRACKING. */
|
|
138
176
|
AP_TRACKING_STATUS: constants.AP_TRACKING_STATUS,
|
|
139
177
|
setTrackingStatus: function setTrackingStatus(status) { return guard.forward(setTrackingStatusGuarded, arguments); },
|
|
140
178
|
getTrackingStatus: function getTrackingStatus() { return guard.forward(getTrackingStatusGuarded, arguments); },
|
|
@@ -149,7 +187,6 @@ const apptics = {
|
|
|
149
187
|
AppticsSettings,
|
|
150
188
|
AppticsHeatmap,
|
|
151
189
|
};
|
|
152
|
-
autoInit.scheduleAutoInit(Apptics);
|
|
153
190
|
|
|
154
191
|
exports.Apptics = Apptics;
|
|
155
192
|
exports.AppticsApi = AppticsApi;
|
package/dist/cjs/lifecycle.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { type ScreenRouteRule } from './core/constants.js';
|
|
2
2
|
import type { AppticsConfig } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Starts the SDK. The config object is required:
|
|
5
|
-
* supply it (auto-init reads window.appticssettings._defaultoptions and calls init with it).
|
|
4
|
+
* Starts the SDK. The config object is required: the SDK starts only when the app calls this.
|
|
6
5
|
* Returns true when the config has base_url, auth_key, app_domain and appversion and start-up has
|
|
7
6
|
* begun (see ready()), false when it was already running, the config is missing or incomplete, or
|
|
8
7
|
* there is no browser. Start-up calls app/addversion with those four, which answers with aaid, the
|
|
@@ -19,3 +18,15 @@ export declare function screenRouteRules(routes: unknown): ScreenRouteRule[];
|
|
|
19
18
|
export declare function ready(): Promise<boolean>;
|
|
20
19
|
/** Clears stored identity and queues, then starts again from the snippet. */
|
|
21
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;
|