@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,11 +1,11 @@
|
|
|
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 { LOG_FUNCTION_MAX, CONSOLE_LOG_MAX_BODY, REMOTE_LOG_LEVEL, LOG_FILENAME_MAX } from '../core/constants.js';
|
|
3
3
|
import { _ZAP } from '../core/state.js';
|
|
4
4
|
import { warnAlways, Console } from '../core/logger.js';
|
|
5
5
|
import { nowMs, isEmpty } from '../core/utils.js';
|
|
6
|
-
import {
|
|
6
|
+
import { remotelog_transactions } from '../core/storage.js';
|
|
7
7
|
import { postToApptics, apiHeaders, isPermanentRefusal, getMetaObj, postKeepalive } from '../core/transport.js';
|
|
8
|
-
import {
|
|
8
|
+
import { remoteLoggerReachable } from './gate.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Delivery for the remote logger.
|
|
@@ -40,7 +40,7 @@ function entryFor(item) {
|
|
|
40
40
|
var entry = {
|
|
41
41
|
sessionstarttime: _ZAP._current_session.starttime || item.happenedat || nowMs(),
|
|
42
42
|
logtime: item.happenedat || nowMs(),
|
|
43
|
-
// an app's line carries the level it was logged at;
|
|
43
|
+
// an app's line carries the level it was logged at; only a line an older SDK stored has none
|
|
44
44
|
level: Number(item.level) || REMOTE_LOG_LEVEL,
|
|
45
45
|
logmessage: String(item.exceptionlog).slice(0, CONSOLE_LOG_MAX_BODY),
|
|
46
46
|
function: String(item.module || 'SDK').slice(0, LOG_FUNCTION_MAX), // no i18n
|
|
@@ -85,7 +85,7 @@ function trim(items) {
|
|
|
85
85
|
if (keepFrom === 0) {
|
|
86
86
|
return items;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
remotelog_transactions.remove(items.slice(0, keepFrom));
|
|
89
89
|
return items.slice(keepFrom);
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -93,21 +93,21 @@ function trim(items) {
|
|
|
93
93
|
* retrying it could only fail the same way and would hold every later line behind it.
|
|
94
94
|
*/
|
|
95
95
|
function sendStoredLogs() {
|
|
96
|
-
if (sending || !
|
|
96
|
+
if (sending || !remoteLoggerReachable() || navigator.onLine === false) {
|
|
97
97
|
return Promise.resolve();
|
|
98
98
|
}
|
|
99
99
|
sending = true;
|
|
100
|
-
return
|
|
100
|
+
return remotelog_transactions.all().then(function (stored) {
|
|
101
101
|
var batch = trim(stored).slice(0, MAX_PER_BATCH);
|
|
102
102
|
if (batch.length === 0) {
|
|
103
103
|
return undefined;
|
|
104
104
|
}
|
|
105
105
|
return postToApptics('consolelog', bodyFor(batch), apiHeaders(), LABEL).then(function () {
|
|
106
|
-
return
|
|
106
|
+
return remotelog_transactions.remove(batch);
|
|
107
107
|
}, function (err) {
|
|
108
108
|
if (isPermanentRefusal(err)) {
|
|
109
109
|
warnAlways('apptics: the server refused these log lines, so they were dropped: ' + String(err && err.message)); // no i18n
|
|
110
|
-
return
|
|
110
|
+
return remotelog_transactions.remove(batch);
|
|
111
111
|
}
|
|
112
112
|
Console.log(LABEL + ': ' + String(err)); // no i18n
|
|
113
113
|
return undefined;
|
|
@@ -124,20 +124,20 @@ function sendStoredLogs() {
|
|
|
124
124
|
* stay stored until the server has confirmed them.
|
|
125
125
|
*/
|
|
126
126
|
function forgetStoredLogs() {
|
|
127
|
-
if (!
|
|
127
|
+
if (!remoteLoggerReachable()) {
|
|
128
128
|
return Promise.resolve();
|
|
129
129
|
}
|
|
130
|
-
return
|
|
130
|
+
return remotelog_transactions.all().then(function (stored) {
|
|
131
131
|
if (stored.length === 0) {
|
|
132
132
|
return undefined;
|
|
133
133
|
}
|
|
134
134
|
var batch = stored.slice(0, MAX_PER_BATCH);
|
|
135
135
|
// removed once the server has them; lines whose answer never comes go on the next visit
|
|
136
136
|
postKeepalive('consolelog', bodyFor(batch), apiHeaders(), LABEL).then(function () {
|
|
137
|
-
return
|
|
137
|
+
return remotelog_transactions.remove(batch);
|
|
138
138
|
}, function (err) {
|
|
139
139
|
if (isPermanentRefusal(err)) {
|
|
140
|
-
return
|
|
140
|
+
return remotelog_transactions.remove(batch);
|
|
141
141
|
}
|
|
142
142
|
Console.log(LABEL + ': ' + String(err)); // no i18n
|
|
143
143
|
return undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The app logger, shipped as its own entry point:
|
|
3
|
+
* import { AppticsLogger } from '@zoho_apptics/apptics-js-sdk/remote-logger';
|
|
4
|
+
*
|
|
5
|
+
* AppticsLogger: verbose / debug / info / warn / error(message, props?), shown on the
|
|
6
|
+
* console's Remote Logger page. A line is recorded as it is written, with no switch to turn on.
|
|
7
|
+
* Apps that don't import it don't ship it.
|
|
8
|
+
*/
|
|
9
|
+
import { AppticsLogger } from '../remotelog/logger.js';
|
|
10
|
+
export { AppticsLogger };
|
|
11
|
+
export type { AppticsLogger as AppticsLoggerApi } from '../remotelog/logger.js';
|
|
12
|
+
export default AppticsLogger;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
+
import { AppticsLogger } from '../remotelog/logger.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The app logger, shipped as its own entry point:
|
|
6
|
+
* import { AppticsLogger } from '@zoho_apptics/apptics-js-sdk/remote-logger';
|
|
7
|
+
*
|
|
8
|
+
* AppticsLogger: verbose / debug / info / warn / error(message, props?), shown on the
|
|
9
|
+
* console's Remote Logger page. A line is recorded as it is written, with no switch to turn on.
|
|
10
|
+
* Apps that don't import it don't ship it.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export { AppticsLogger, AppticsLogger as default };
|
package/dist/esm/scheduler.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* response (page hide), so they survive the page going away.
|
|
4
4
|
*/
|
|
5
5
|
export declare function flush(forget?: boolean): Promise<void>;
|
|
6
|
-
/**
|
|
6
|
+
/** Apptics.flush(): flush(), at most once every CALLED_FLUSH_GAP_MS. A call sooner sends nothing. */
|
|
7
|
+
export declare function calledFlush(): Promise<void>;
|
|
8
|
+
/** Starts the flush interval once; later calls do nothing until stopTimers(). */
|
|
7
9
|
export declare function startTimers(): void;
|
|
8
10
|
export declare function stopTimers(): void;
|
package/dist/esm/scheduler.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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 { _ZAP, getConfig } from './core/state.js';
|
|
3
|
-
import { nowMs } from './core/utils.js';
|
|
4
3
|
import { Console } from './core/logger.js';
|
|
4
|
+
import { nowMs } from './core/utils.js';
|
|
5
5
|
import { canTrack } from './core/consent.js';
|
|
6
6
|
import { clearDefer } from './core/batch.js';
|
|
7
7
|
import { sendEngagementData } from './engagement/send.js';
|
|
8
8
|
import { sendErrorData } from './errors/send.js';
|
|
9
9
|
import { hooks } from './core/hooks.js';
|
|
10
|
-
import {
|
|
10
|
+
import { stopServerSettingChecks } from './device/index.js';
|
|
11
11
|
import { expireDebugIfIdle } from './core/debug.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -23,13 +23,30 @@ function flush(forget) {
|
|
|
23
23
|
return sendEngagementData(forget).then(function () {
|
|
24
24
|
return sendErrorData(forget);
|
|
25
25
|
}).then(function () {
|
|
26
|
-
//
|
|
26
|
+
// the hook heatmap/send.ts sets
|
|
27
27
|
return hooks.sendHeatmaps(forget);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* How often Apptics.flush() sends when it is called by hand, from the console or the app's own
|
|
32
|
+
* code: once every 15 seconds, however often it is called. The SDK's own sends (the flush
|
|
33
|
+
* interval, page hide and close, back online) call flush() directly and are not held to it.
|
|
34
|
+
*/
|
|
35
|
+
const CALLED_FLUSH_GAP_MS = 15 * 1000;
|
|
36
|
+
/** When Apptics.flush() last sent; 0 until it has. */
|
|
37
|
+
var calledFlushAt = 0;
|
|
38
|
+
/** Apptics.flush(): flush(), at most once every CALLED_FLUSH_GAP_MS. A call sooner sends nothing. */
|
|
39
|
+
function calledFlush() {
|
|
40
|
+
var now = nowMs();
|
|
41
|
+
if (calledFlushAt > 0 && now - calledFlushAt < CALLED_FLUSH_GAP_MS) {
|
|
42
|
+
Console.log('Apptics.flush: sent ' + (now - calledFlushAt) + ' ms ago; it sends at most once every ' + CALLED_FLUSH_GAP_MS + ' ms, and the timer sends the rest'); // no i18n
|
|
43
|
+
return Promise.resolve();
|
|
44
|
+
}
|
|
45
|
+
calledFlushAt = now;
|
|
46
|
+
return flush();
|
|
47
|
+
}
|
|
30
48
|
var sendingInterval = null;
|
|
31
|
-
|
|
32
|
-
/** Starts the flush and getupdates intervals once; later calls do nothing until stopTimers(). */
|
|
49
|
+
/** Starts the flush interval once; later calls do nothing until stopTimers(). */
|
|
33
50
|
function startTimers() {
|
|
34
51
|
if (sendingInterval === null) {
|
|
35
52
|
sendingInterval = setInterval(function () {
|
|
@@ -46,29 +63,14 @@ function startTimers() {
|
|
|
46
63
|
});
|
|
47
64
|
}, getConfig('batch_flush_interval')); // no i18n
|
|
48
65
|
}
|
|
49
|
-
if (getUpdatesInterval === null) {
|
|
50
|
-
// the interval is the floor, not the schedule: getsdkconfig answers with next_check_after,
|
|
51
|
-
// and asking again before then is a call the server has already told us it will not answer
|
|
52
|
-
// differently. The timer still ticks so a server that sends no hint behaves as before.
|
|
53
|
-
getUpdatesInterval = setInterval(function () {
|
|
54
|
-
if (_ZAP._nextConfigCheck > 0 && nowMs() < _ZAP._nextConfigCheck) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
Console.log('scheduleToGetUpdatesFromServer: asking the server for its config'); // no i18n
|
|
58
|
-
getUpdatesFromServer().catch(function (err) {
|
|
59
|
-
Console.log(err);
|
|
60
|
-
});
|
|
61
|
-
}, getConfig('getupdates_interval')); // no i18n
|
|
62
|
-
}
|
|
63
66
|
}
|
|
64
67
|
function stopTimers() {
|
|
65
68
|
if (sendingInterval !== null)
|
|
66
69
|
clearInterval(sendingInterval);
|
|
67
|
-
if (getUpdatesInterval !== null)
|
|
68
|
-
clearInterval(getUpdatesInterval);
|
|
69
70
|
sendingInterval = null;
|
|
70
|
-
getUpdatesInterval = null;
|
|
71
71
|
clearDefer();
|
|
72
|
+
stopServerSettingChecks();
|
|
73
|
+
calledFlushAt = 0;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
export { flush, startTimers, stopTimers };
|
|
76
|
+
export { calledFlush, flush, startTimers, stopTimers };
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS } from './core/constants.js';
|
|
2
2
|
import type { UserBuilder } from './user/index.js';
|
|
3
3
|
import type { ApiTrackingBuilder, ApiTrackingConfig } from './engagement/api-rules.js';
|
|
4
|
-
import type { DefinedEvent } from './engagement/defined-events.js';
|
|
5
|
-
|
|
4
|
+
import type { DefinedEvent, DefinedEvents } from './engagement/defined-events.js';
|
|
5
|
+
/** One entry of screen_routes: a route pattern, or an exact path or a regular expression with the name to record. */
|
|
6
|
+
export type ScreenRoute = string | {
|
|
7
|
+
equals: string;
|
|
8
|
+
name: string;
|
|
9
|
+
} | {
|
|
10
|
+
regex: RegExp | string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
6
13
|
/** Loose record for legacy payloads and server JSON that are built and sent as-is. */
|
|
7
14
|
export type Dict = Record<string, any>;
|
|
8
15
|
/** An item in the engagement or error queue. */
|
|
@@ -30,14 +37,14 @@ export interface ServerResult<T = Dict> {
|
|
|
30
37
|
export type TrackingStatus = (typeof AP_TRACKING_STATUS)[keyof typeof AP_TRACKING_STATUS];
|
|
31
38
|
export type FeedbackType = (typeof AP_FEEDBACK_TYPE)[keyof typeof AP_FEEDBACK_TYPE];
|
|
32
39
|
export type Properties = Record<string, unknown>;
|
|
33
|
-
/** The config init() requires.
|
|
40
|
+
/** The config init() requires. */
|
|
34
41
|
export interface AppticsConfig {
|
|
35
|
-
/** Apptics host every request goes to, e.g. https://apptics.
|
|
36
|
-
|
|
37
|
-
/** The app's
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
|
|
42
|
+
/** Apptics host every request goes to, e.g. https://apptics.zoho.com (a trailing slash is ignored). Was `serviceUrl`. */
|
|
43
|
+
base_url: string;
|
|
44
|
+
/** The app's key from the console, sent as the `zak` header on app/addversion and device registration. Was `zak`. */
|
|
45
|
+
auth_key: string;
|
|
46
|
+
/** The app's domain as registered in the console, e.g. com.zoho.web.zylker. Was `identifier`. */
|
|
47
|
+
app_domain: string;
|
|
41
48
|
/**
|
|
42
49
|
* Your app's version or build number, e.g. '2.4.0' or 512. Required: everything the SDK reports
|
|
43
50
|
* is only meaningful against the build it came from, so there is no default. Changing it
|
|
@@ -54,12 +61,10 @@ export interface AppticsConfig {
|
|
|
54
61
|
zsoid?: string;
|
|
55
62
|
/** @deprecated ignored: app/addversion answers with the project id */
|
|
56
63
|
projectID?: string;
|
|
57
|
-
/** @deprecated console-snippet name for
|
|
64
|
+
/** @deprecated 1.x console-snippet name for base_url: still read, with a warning */
|
|
58
65
|
base_domain?: string;
|
|
59
|
-
/** @deprecated console-snippet name for
|
|
66
|
+
/** @deprecated 1.x console-snippet name for auth_key: still read, with a warning */
|
|
60
67
|
token?: string;
|
|
61
|
-
/** Data centre key for Quartz screen recording: US, EU, IN, AU, CN, CA, JP, SA, AE, Local, or '-' to disable. */
|
|
62
|
-
DC?: string;
|
|
63
68
|
/**
|
|
64
69
|
* Debug mode: send engagement, exception and log payloads to their `debug/` twins, which answer
|
|
65
70
|
* with a request id and a link to the server's own logs, for following in the Apptics web
|
|
@@ -69,17 +74,10 @@ export interface AppticsConfig {
|
|
|
69
74
|
/** Log the SDK's own activity to the browser console. Off by default. */
|
|
70
75
|
console_log?: boolean;
|
|
71
76
|
ignore_do_not_track?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Send the SDK's own failures to console/addlog, so they can be read from the Apptics console.
|
|
74
|
-
* This carries no app data: one line per failure, tagged with the SDK module it happened in.
|
|
75
|
-
*/
|
|
76
|
-
remote_log?: boolean;
|
|
77
|
-
quartz_workspace_key?: string;
|
|
78
|
-
quartz_department_key?: string;
|
|
79
77
|
/**
|
|
80
78
|
* Record the app's API calls automatically, by wrapping XHR and fetch. Off by default. The SDK's
|
|
81
79
|
* own requests are never recorded. Which hosts and endpoints are recorded, and under what path,
|
|
82
|
-
* is set with
|
|
80
|
+
* is set with AppticsApi.configure(new AppticsApi.ApiTrackingBuilder()...build()).
|
|
83
81
|
*/
|
|
84
82
|
track_api?: boolean;
|
|
85
83
|
/**
|
|
@@ -90,24 +88,48 @@ export interface AppticsConfig {
|
|
|
90
88
|
*/
|
|
91
89
|
track_screen?: boolean;
|
|
92
90
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
91
|
+
* Record uncaught errors and unhandled promise rejections automatically. On by default; set this
|
|
92
|
+
* false to record only the errors the app hands to AppticsError.trackError(). Switched later with
|
|
93
|
+
* AppticsError.setErrorTracking().
|
|
94
|
+
*/
|
|
95
|
+
track_error?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Record clicks on elements tagged `apeventaction` (or `data-apeventaction`) as events, in the
|
|
98
|
+
* group of the nearest `apgroupaction` around them. On by default; switched later with
|
|
99
|
+
* AppticsEvent.setClickTracking().
|
|
95
100
|
*/
|
|
96
|
-
|
|
101
|
+
track_click?: boolean;
|
|
97
102
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
103
|
+
* How automatic screen tracking names a path, tried in order; the first that matches wins, and a
|
|
104
|
+
* path none matches keeps its own name. Each entry is one of:
|
|
105
|
+
* - a route pattern, `'/users/{id}/orders'`: `{name}`, `:name` and `*` each match one segment,
|
|
106
|
+
* recorded as a star, so `/users/42/orders` and `/users/43/orders` are one screen;
|
|
107
|
+
* - `{ equals: '/', name: 'Home' }`: that path exactly;
|
|
108
|
+
* - `{ regex: /^\/orders\/\d+$/, name: 'Order detail' }`: any path the regular expression matches.
|
|
109
|
+
* Paths are matched without their query string.
|
|
100
110
|
*/
|
|
101
|
-
|
|
111
|
+
screen_routes?: ScreenRoute[];
|
|
112
|
+
/**
|
|
113
|
+
* The feedback form's theme: 'light', 'dark', or 'auto' (the default) to follow the visitor's
|
|
114
|
+
* system setting. The colors are CSS variables on the form (`--zasdk-primary-color` and the rest
|
|
115
|
+
* of the `--zasdk-*` set), which a page may override.
|
|
116
|
+
*/
|
|
117
|
+
feedback_theme?: 'light' | 'dark' | 'auto';
|
|
102
118
|
/** How often queued data is sent, in milliseconds. Default 30000, at least 1000. */
|
|
103
119
|
batch_flush_interval?: number;
|
|
104
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* How long to wait before reading the server's tracking settings again, in milliseconds, when its
|
|
122
|
+
* answer gives no time for the next check (next_check_after). Default 120000, at least 10000.
|
|
123
|
+
*/
|
|
105
124
|
getupdates_interval?: number;
|
|
106
125
|
/** Most items in one batch. Default 50, between 1 and 500. */
|
|
107
126
|
batch_size?: number;
|
|
108
127
|
/** Days an unsent item is kept before it is dropped. Default 7, between 1 and 30. */
|
|
109
128
|
batch_request_timeout?: number;
|
|
110
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Minutes a tab can be inactive (hidden, minimised, in the background) before its session ends,
|
|
131
|
+
* at the moment the user left. Default 30, between 1 and 1440.
|
|
132
|
+
*/
|
|
111
133
|
inactiveduration?: number;
|
|
112
134
|
/**
|
|
113
135
|
* How long a visit must last before its session is recorded, in milliseconds. Default 5000, at
|
|
@@ -116,8 +138,8 @@ export interface AppticsConfig {
|
|
|
116
138
|
*/
|
|
117
139
|
min_session_duration?: number;
|
|
118
140
|
/**
|
|
119
|
-
* Record where people click and how far they scroll. Off by default
|
|
120
|
-
*
|
|
141
|
+
* Record where people click and how far they scroll. Off by default;
|
|
142
|
+
* AppticsHeatmap.setHeatmapTracking() switches it later.
|
|
121
143
|
*/
|
|
122
144
|
track_heatmap?: boolean;
|
|
123
145
|
/** Most heatmap records one visit may produce. Default 500; capture pauses past it. */
|
|
@@ -140,6 +162,26 @@ export interface UserValidationResult {
|
|
|
140
162
|
keys: string[];
|
|
141
163
|
}>;
|
|
142
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Screen recording in the feedback form, as getsdkconfig's `quartz` block sets it up:
|
|
167
|
+
* { quartz_enabled, quartz_workspace, quartz_department, quartz_domain, quartz_cdn_url }
|
|
168
|
+
* The app passes none of it; the console's settings for the app decide.
|
|
169
|
+
*/
|
|
170
|
+
export interface QuartzSettings {
|
|
171
|
+
enabled: boolean;
|
|
172
|
+
/** quartz_workspace: the workspace the recording is filed under. */
|
|
173
|
+
workspace: string;
|
|
174
|
+
/** quartz_department: the department within it. */
|
|
175
|
+
department: string;
|
|
176
|
+
/** quartz_domain, e.g. zoho.com: recordings go to https://quartz.<domain>. */
|
|
177
|
+
domain: string;
|
|
178
|
+
/**
|
|
179
|
+
* quartz_cdn_url: the Quartz script, loaded by the SDK when the form needs it. When the answer
|
|
180
|
+
* has none, the SDK uses Zoho's CDN for the serviceUrl (static.localzohocdn.com for localzoho,
|
|
181
|
+
* static.zohocdn.com otherwise).
|
|
182
|
+
*/
|
|
183
|
+
cdnUrl: string;
|
|
184
|
+
}
|
|
143
185
|
export interface QuartzApi {
|
|
144
186
|
startRecording(details: {
|
|
145
187
|
workspaceLinkName: string;
|
|
@@ -151,8 +193,9 @@ export interface QuartzApi {
|
|
|
151
193
|
quartzBranding: boolean;
|
|
152
194
|
}): void;
|
|
153
195
|
clearFeedback(): void;
|
|
154
|
-
|
|
155
|
-
|
|
196
|
+
/** Resolves once the recording has ended and is stored; Quartz's own build returns a Promise. */
|
|
197
|
+
endRecording(): Promise<unknown> | void;
|
|
198
|
+
setVideoContent(element: Element | null): Promise<unknown> | void;
|
|
156
199
|
submitRecording(details: {
|
|
157
200
|
email: string;
|
|
158
201
|
subject: string;
|
|
@@ -216,97 +259,172 @@ export interface HeatmapRecord {
|
|
|
216
259
|
is_rage_click: 0 | 1;
|
|
217
260
|
is_dead_click: 0 | 1;
|
|
218
261
|
}
|
|
219
|
-
/** What `
|
|
262
|
+
/** What `AppticsError.trackError` accepts: a window `error` / `unhandledrejection` event or the same shape. */
|
|
220
263
|
export type ErrorLike = Event | {
|
|
221
264
|
type?: string;
|
|
222
265
|
error?: unknown;
|
|
223
266
|
reason?: unknown;
|
|
224
267
|
};
|
|
268
|
+
/** What sendFeedback() sends. Every key is optional. */
|
|
269
|
+
export interface SendFeedbackOptions {
|
|
270
|
+
/** AppticsFeedback.AP_FEEDBACK_TYPE: BUG (0), FEEDBACK (1, the default), HELP (2), REPORT (3). */
|
|
271
|
+
type?: FeedbackType;
|
|
272
|
+
/** The feedback's text. */
|
|
273
|
+
message?: string;
|
|
274
|
+
/** Files to attach: at most 5, 10 MB in all. */
|
|
275
|
+
attachments?: FileList | File[] | null;
|
|
276
|
+
/** Log files of the app's own to send along. */
|
|
277
|
+
logFiles?: FileList | File[] | null;
|
|
278
|
+
/** The addDiagnosticsInfo() entries: unset sends them when there are any, false never does. */
|
|
279
|
+
includeDiagnostics?: boolean;
|
|
280
|
+
/** The addFeedbackLog() lines: unset sends them when there are any, false never does. */
|
|
281
|
+
includeLog?: boolean;
|
|
282
|
+
/** Sends it from nobody. Unset, it is from the active user AppticsUser.setUser registered. */
|
|
283
|
+
isAnonymous?: boolean;
|
|
284
|
+
}
|
|
285
|
+
/** What feedbackFormOpen() fills the form in with. Every key is optional. */
|
|
286
|
+
export interface FeedbackOpenOptions {
|
|
287
|
+
/** The tab the form opens on: AppticsFeedback.AP_FEEDBACK_TYPE.BUG, FEEDBACK, HELP or REPORT. */
|
|
288
|
+
type?: FeedbackType;
|
|
289
|
+
/** Text already in the description. */
|
|
290
|
+
message?: string;
|
|
291
|
+
/** Starts the logs toggle on. */
|
|
292
|
+
includeLog?: boolean;
|
|
293
|
+
/** Starts the diagnostics toggle on. */
|
|
294
|
+
includeDiagnostics?: boolean;
|
|
295
|
+
/** Files already attached: at most 5, 10 MB in all. */
|
|
296
|
+
attachments?: FileList | File[] | null;
|
|
297
|
+
/** Log files of the app's own already attached. */
|
|
298
|
+
logFiles?: FileList | File[] | null;
|
|
299
|
+
/** Starts the user picker on Anonymous, even with a user registered. */
|
|
300
|
+
isAnonymous?: boolean;
|
|
301
|
+
}
|
|
225
302
|
/** The optional feedback modal, from '@zoho_apptics/apptics-js-sdk/feedback'. */
|
|
226
303
|
export interface AppticsFeedbackApi {
|
|
227
304
|
/**
|
|
228
305
|
* Sends feedback without the form. Resolves once it is sent; rejects when it wasn't: the SDK
|
|
229
306
|
* has not started (no init()), the browser is offline, or the server refused it.
|
|
230
307
|
*/
|
|
231
|
-
sendFeedback(
|
|
232
|
-
/**
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
308
|
+
sendFeedback(options?: SendFeedbackOptions): Promise<void>;
|
|
309
|
+
/** Opens the form, filled in with `options` when they are given. */
|
|
310
|
+
feedbackFormOpen(options?: FeedbackOpenOptions): void;
|
|
311
|
+
feedbackFormClose(): void;
|
|
312
|
+
/** The feedback types: BUG, FEEDBACK, HELP, REPORT. */
|
|
313
|
+
AP_FEEDBACK_TYPE: typeof AP_FEEDBACK_TYPE;
|
|
314
|
+
/** Records a timestamped line, sent as feedbacklog.txt with the next feedback submission. */
|
|
315
|
+
addFeedbackLog(message: string): void;
|
|
316
|
+
/** Records a diagnostics key/value under `heading`, sent inside dyninfo.txt with the next feedback. */
|
|
317
|
+
addDiagnosticsInfo(heading: string, key: string, value: unknown): void;
|
|
236
318
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* Anonymous even when a user is registered.
|
|
319
|
+
* The form's theme from now on, restyling one open now: 'light', 'dark', or 'auto' to follow
|
|
320
|
+
* the visitor's system setting. For a page with its own theme switch, called as it changes.
|
|
240
321
|
*/
|
|
241
|
-
|
|
242
|
-
feedbackClose(): void;
|
|
322
|
+
setFeedbackTheme(theme: 'light' | 'dark' | 'auto'): void;
|
|
243
323
|
}
|
|
244
|
-
export interface
|
|
245
|
-
/** Android's Apptics. */
|
|
324
|
+
export interface AppticsSdk {
|
|
325
|
+
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
246
326
|
Apptics: {
|
|
247
|
-
/** Starts the SDK
|
|
327
|
+
/** Starts the SDK with the app's config object, which is required. */
|
|
248
328
|
init(config: AppticsConfig): boolean;
|
|
329
|
+
/** Resolves true once start-up (storage load, device, session) has finished; false if it can't start. */
|
|
330
|
+
ready(): Promise<boolean>;
|
|
331
|
+
/**
|
|
332
|
+
* Sends stored engagements, errors and heatmap records now; resolves once they have gone out.
|
|
333
|
+
* At most once every 15 seconds: a call sooner than that sends nothing and resolves at once,
|
|
334
|
+
* and what is queued goes with the next timed send.
|
|
335
|
+
*/
|
|
336
|
+
flush(): Promise<void>;
|
|
337
|
+
/** Clears stored identity, queued data and remote config values, then starts again. */
|
|
338
|
+
reset(): void;
|
|
339
|
+
/**
|
|
340
|
+
* Turns debug mode on, before or after Apptics.init(). Engagement, exception and log then go to
|
|
341
|
+
* their `debug/` twins, whose answers carry a request id and a link into the server's own logs. It
|
|
342
|
+
* switches itself off after an hour with nothing tracked.
|
|
343
|
+
*/
|
|
344
|
+
enableDebug(): void;
|
|
345
|
+
/** Turns debug mode off, before or after Apptics.init(); wins over `debug` in init(). */
|
|
346
|
+
disableDebug(): void;
|
|
249
347
|
};
|
|
250
348
|
/** Android's AppticsEvents. */
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
|
|
254
|
-
/**
|
|
349
|
+
AppticsEvent: {
|
|
350
|
+
/** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
|
|
351
|
+
DefinedEvents: typeof DefinedEvents;
|
|
352
|
+
/** An event. The group is required: an event without one, or with an invalid name or group, is not logged, and the console says why. */
|
|
353
|
+
addEvent(eventName: string, groupName: string, properties?: Properties): void;
|
|
354
|
+
/** A defined event (AppticsEvent.DefinedEvents.AP_USER_LOGIN, …), which brings its own group. */
|
|
255
355
|
addEvent(definedEvent: DefinedEvent, properties?: Properties): void;
|
|
356
|
+
/**
|
|
357
|
+
* Turns click tracking from markup (`apeventaction`) on or off after Apptics.init(); `enabled`
|
|
358
|
+
* defaults to true. The `track_click` config flag sets it at start-up.
|
|
359
|
+
*/
|
|
360
|
+
setClickTracking(enabled?: boolean): void;
|
|
256
361
|
};
|
|
257
|
-
/** Apptics' defined events, as Android's DefinedEvents. */
|
|
258
|
-
DefinedEvents: Readonly<Record<string, DefinedEvent>>;
|
|
259
362
|
/** Android's AppticsScreenTracker. */
|
|
260
|
-
|
|
363
|
+
AppticsScreen: {
|
|
261
364
|
/** Records a screen view and returns its id, for outScreen; '' for an invalid name. */
|
|
262
365
|
inScreen(screenName: string, properties?: Properties): string;
|
|
263
366
|
/** Ends the screen view inScreen began, before the next screen would. */
|
|
264
367
|
outScreen(id: string): void;
|
|
368
|
+
/**
|
|
369
|
+
* Turns automatic screen tracking on or off after Apptics.init(); `enabled` defaults to true.
|
|
370
|
+
* The `track_screen` config flag sets it at start-up. inScreen() records either way.
|
|
371
|
+
*/
|
|
372
|
+
setScreenTracking(enabled?: boolean): void;
|
|
265
373
|
};
|
|
266
374
|
/** Android's AppticsApiTracker. */
|
|
267
|
-
|
|
375
|
+
AppticsApi: {
|
|
376
|
+
/** Builds the rules configure takes: `new AppticsApi.ApiTrackingBuilder()…build()`. */
|
|
377
|
+
ApiTrackingBuilder: typeof ApiTrackingBuilder;
|
|
268
378
|
/** Begins timing one call; returns the id endTrackApi takes. */
|
|
269
379
|
startTrackApi(url: string, method?: string): string;
|
|
270
380
|
/** Finishes the call startTrackApi began, and records it. */
|
|
271
381
|
endTrackApi(id: string, responseCode: number, responseMessage?: string): void;
|
|
272
382
|
/** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
|
|
273
383
|
configure(config: ApiTrackingConfig | ApiTrackingBuilder): void;
|
|
384
|
+
/**
|
|
385
|
+
* Turns automatic API tracking on or off after Apptics.init(); `enabled` defaults to true.
|
|
386
|
+
* The `track_api` config flag sets it at start-up.
|
|
387
|
+
*/
|
|
388
|
+
setApiTracking(enabled?: boolean): void;
|
|
389
|
+
/** @deprecated renamed setApiTracking; this name still works, with a console warning */
|
|
390
|
+
enableApiTracking(enabled?: boolean): void;
|
|
274
391
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
AppticsTrackError(error: ErrorLike, properties?: Properties): void;
|
|
295
|
-
enableGlobalErrorHandler(enabled?: boolean): void;
|
|
296
|
-
/** Properties may be a plain object, or the result of UserBuilder.build(). */
|
|
297
|
-
AppticsSetUser(userid: string, groupid?: string, properties?: Properties | UserValidationResult): void;
|
|
298
|
-
getUser(): UserInfo;
|
|
299
|
-
users: {
|
|
392
|
+
/** Errors the app caught, and the switch for tracking uncaught ones. */
|
|
393
|
+
AppticsError: {
|
|
394
|
+
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
395
|
+
trackError(error: ErrorLike, properties?: Properties): void;
|
|
396
|
+
/**
|
|
397
|
+
* Turns the automatic tracking of uncaught errors and unhandled rejections on or off after
|
|
398
|
+
* Apptics.init(); `enabled` defaults to true. The `track_error` config flag sets it at start-up.
|
|
399
|
+
*/
|
|
400
|
+
setErrorTracking(enabled?: boolean): void;
|
|
401
|
+
/** @deprecated renamed setErrorTracking; this name still works, with a console warning */
|
|
402
|
+
trackGlobalErrorHandler(enabled?: boolean): void;
|
|
403
|
+
};
|
|
404
|
+
/** Android's AppticsUser. */
|
|
405
|
+
AppticsUser: {
|
|
406
|
+
/** Registers the signed-in user. Properties may be a plain object, or the result of UserBuilder.build(). */
|
|
407
|
+
setUser(userid: string, groupid?: string, properties?: Properties | UserValidationResult): void;
|
|
408
|
+
/** The registered user, or {} when there is none. */
|
|
409
|
+
getUser(): UserInfo;
|
|
410
|
+
/** Builds the user's properties for setUser. */
|
|
300
411
|
UserBuilder: typeof UserBuilder;
|
|
301
412
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
413
|
+
/** Click and scroll capture for the console's heatmaps. */
|
|
414
|
+
AppticsHeatmap: {
|
|
415
|
+
/**
|
|
416
|
+
* Starts or stops recording clicks and scrolls; `enabled` defaults to true. The
|
|
417
|
+
* `track_heatmap` config flag sets it at start-up.
|
|
418
|
+
*/
|
|
419
|
+
setHeatmapTracking(enabled?: boolean): void;
|
|
420
|
+
/** @deprecated renamed setHeatmapTracking; this name still works, with a console warning */
|
|
421
|
+
trackHeatmap(on?: boolean): void;
|
|
422
|
+
};
|
|
423
|
+
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
424
|
+
AppticsSettings: {
|
|
425
|
+
/** The states setTrackingStatus takes. */
|
|
426
|
+
AP_TRACKING_STATUS: typeof AP_TRACKING_STATUS;
|
|
427
|
+
setTrackingStatus(status: TrackingStatus): void;
|
|
428
|
+
getTrackingStatus(): TrackingStatus;
|
|
429
|
+
};
|
|
312
430
|
}
|