@zoho_apptics/apptics-js-sdk 2.0.0-beta.1 → 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 +80 -16
- package/README.md +187 -100
- 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 +1 -2
- package/dist/cjs/core/consent.d.ts +13 -3
- package/dist/cjs/core/consent.js +24 -10
- package/dist/cjs/core/constants.d.ts +22 -17
- package/dist/cjs/core/constants.js +22 -19
- package/dist/cjs/core/db.js +1 -1
- 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.js +1 -1
- package/dist/cjs/core/hooks.d.ts +5 -0
- package/dist/cjs/core/hooks.js +2 -1
- package/dist/cjs/core/locks.js +1 -1
- package/dist/cjs/core/logger.js +1 -1
- package/dist/cjs/core/state.d.ts +6 -4
- package/dist/cjs/core/state.js +2 -4
- package/dist/cjs/core/storage.js +1 -4
- package/dist/cjs/core/stylesheet.js +1 -1
- package/dist/cjs/core/transport.js +13 -16
- package/dist/cjs/core/utils.js +1 -1
- package/dist/cjs/core/validate.js +1 -1
- 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 +195 -27
- package/dist/cjs/engagement/api-rules.js +1 -1
- package/dist/cjs/engagement/auto-api.js +1 -1
- package/dist/cjs/engagement/auto-screen.js +1 -1
- package/dist/cjs/engagement/defined-events.js +1 -1
- package/dist/cjs/engagement/send.js +7 -3
- package/dist/cjs/engagement/session.d.ts +17 -0
- package/dist/cjs/engagement/session.js +95 -4
- package/dist/cjs/engagement/track.d.ts +4 -4
- package/dist/cjs/engagement/track.js +15 -12
- package/dist/cjs/errors/send.js +2 -2
- package/dist/cjs/errors/track.d.ts +2 -1
- package/dist/cjs/errors/track.js +6 -4
- package/dist/cjs/feedback/controls.d.ts +6 -0
- package/dist/cjs/feedback/controls.js +74 -25
- package/dist/cjs/feedback/index.js +1 -1
- package/dist/cjs/feedback/logs.d.ts +3 -6
- package/dist/cjs/feedback/logs.js +8 -18
- package/dist/cjs/feedback/quartz.js +1 -1
- package/dist/cjs/feedback/send.d.ts +2 -2
- package/dist/cjs/feedback/send.js +4 -27
- package/dist/cjs/feedback/styles.js +2 -2
- package/dist/cjs/feedback/template.d.ts +1 -1
- package/dist/cjs/feedback/template.js +9 -1
- package/dist/cjs/feedback/ui.d.ts +7 -0
- package/dist/cjs/feedback/ui.js +160 -25
- package/dist/cjs/heatmap/send.d.ts +2 -0
- package/dist/cjs/heatmap/send.js +3 -5
- package/dist/cjs/heatmap/track.js +1 -1
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +54 -17
- package/dist/cjs/lifecycle.d.ts +13 -2
- package/dist/cjs/lifecycle.js +122 -54
- package/dist/cjs/remoteconfig/country.js +1 -1
- package/dist/cjs/remoteconfig/custom.js +1 -1
- package/dist/cjs/remoteconfig/evaluate.js +1 -1
- package/dist/cjs/remoteconfig/fetch.d.ts +17 -10
- package/dist/cjs/remoteconfig/fetch.js +126 -31
- package/dist/cjs/remoteconfig/index.d.ts +13 -4
- package/dist/cjs/remoteconfig/index.js +36 -20
- 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 +2 -2
- package/dist/cjs/remotelogger/index.js +1 -1
- package/dist/cjs/scheduler.d.ts +3 -1
- package/dist/cjs/scheduler.js +24 -21
- package/dist/cjs/types.d.ts +61 -16
- package/dist/cjs/user/index.js +6 -2
- package/dist/esm/core/attempts.js +1 -1
- package/dist/esm/core/batch.js +1 -2
- package/dist/esm/core/consent.d.ts +13 -3
- package/dist/esm/core/consent.js +24 -11
- package/dist/esm/core/constants.d.ts +22 -17
- package/dist/esm/core/constants.js +22 -19
- package/dist/esm/core/db.js +1 -1
- 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.js +1 -1
- package/dist/esm/core/hooks.d.ts +5 -0
- package/dist/esm/core/hooks.js +2 -1
- package/dist/esm/core/locks.js +1 -1
- package/dist/esm/core/logger.js +1 -1
- package/dist/esm/core/state.d.ts +6 -4
- package/dist/esm/core/state.js +2 -4
- package/dist/esm/core/storage.js +1 -4
- package/dist/esm/core/stylesheet.js +1 -1
- package/dist/esm/core/transport.js +13 -16
- package/dist/esm/core/utils.js +1 -1
- package/dist/esm/core/validate.js +1 -1
- 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 +195 -30
- package/dist/esm/engagement/api-rules.js +1 -1
- package/dist/esm/engagement/auto-api.js +1 -1
- package/dist/esm/engagement/auto-screen.js +1 -1
- package/dist/esm/engagement/defined-events.js +1 -1
- package/dist/esm/engagement/send.js +7 -3
- package/dist/esm/engagement/session.d.ts +17 -0
- package/dist/esm/engagement/session.js +93 -5
- package/dist/esm/engagement/track.d.ts +4 -4
- package/dist/esm/engagement/track.js +16 -13
- package/dist/esm/errors/send.js +2 -2
- package/dist/esm/errors/track.d.ts +2 -1
- package/dist/esm/errors/track.js +6 -4
- package/dist/esm/feedback/controls.d.ts +6 -0
- package/dist/esm/feedback/controls.js +74 -26
- package/dist/esm/feedback/index.js +1 -1
- package/dist/esm/feedback/logs.d.ts +3 -6
- package/dist/esm/feedback/logs.js +8 -18
- package/dist/esm/feedback/quartz.js +1 -1
- package/dist/esm/feedback/send.d.ts +2 -2
- package/dist/esm/feedback/send.js +6 -29
- package/dist/esm/feedback/styles.js +2 -2
- package/dist/esm/feedback/template.d.ts +1 -1
- package/dist/esm/feedback/template.js +9 -1
- package/dist/esm/feedback/ui.d.ts +7 -0
- package/dist/esm/feedback/ui.js +161 -26
- package/dist/esm/heatmap/send.d.ts +2 -0
- package/dist/esm/heatmap/send.js +3 -5
- package/dist/esm/heatmap/track.js +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +57 -20
- package/dist/esm/lifecycle.d.ts +13 -2
- package/dist/esm/lifecycle.js +126 -60
- package/dist/esm/remoteconfig/country.js +1 -1
- package/dist/esm/remoteconfig/custom.js +1 -1
- package/dist/esm/remoteconfig/evaluate.js +1 -1
- package/dist/esm/remoteconfig/fetch.d.ts +17 -10
- package/dist/esm/remoteconfig/fetch.js +127 -32
- package/dist/esm/remoteconfig/index.d.ts +13 -4
- package/dist/esm/remoteconfig/index.js +36 -20
- 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 +2 -2
- package/dist/esm/remotelogger/index.js +1 -1
- package/dist/esm/scheduler.d.ts +3 -1
- package/dist/esm/scheduler.js +25 -23
- package/dist/esm/types.d.ts +61 -16
- package/dist/esm/user/index.js +7 -3
- 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 +3 -2
- 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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
/**
|
|
3
|
-
* Where
|
|
3
|
+
* Where in the app an AppticsLogger line was written, for logSDK's `filename`, `linenumber` and
|
|
4
|
+
* `function`: the Remote Logger page shows each line with them.
|
|
4
5
|
*
|
|
5
6
|
* There is no caller introspection in a browser, so the only way to answer "which line was this"
|
|
6
|
-
* is to
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* is to make an Error and read its stack, skipping the SDK's own frames. That costs a little on
|
|
8
|
+
* every line the app logs, and nothing on any other call. Everything here is wrapped so a stack
|
|
9
|
+
* that cannot be parsed costs a line its call site and nothing more: the line is still logged.
|
|
9
10
|
*/
|
|
10
11
|
const NO_CALL_SITE = { filename: '', linenumber: 0, fn: '' };
|
|
11
12
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { _ZAP } from '../core/state.js';
|
|
3
3
|
import { is_apptics_disabled } from '../core/env.js';
|
|
4
4
|
import { shouldTrackOrSendData } from '../core/consent.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { LOG_FUNCTION_MAX } from '../core/constants.js';
|
|
3
|
-
import { callSite } from '
|
|
3
|
+
import { callSite } from './callsite.js';
|
|
4
4
|
import { remotelog_transactions } from '../core/storage.js';
|
|
5
5
|
import { guard } from '../core/guard.js';
|
|
6
6
|
import { nowMs } from '../core/utils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
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';
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { AppticsLogger } from '../remotelog/logger.js';
|
|
3
3
|
|
|
4
4
|
/**
|
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.
|
|
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
|
/**
|
|
@@ -27,9 +27,26 @@ function flush(forget) {
|
|
|
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
|
@@ -37,7 +37,7 @@ export interface ServerResult<T = Dict> {
|
|
|
37
37
|
export type TrackingStatus = (typeof AP_TRACKING_STATUS)[keyof typeof AP_TRACKING_STATUS];
|
|
38
38
|
export type FeedbackType = (typeof AP_FEEDBACK_TYPE)[keyof typeof AP_FEEDBACK_TYPE];
|
|
39
39
|
export type Properties = Record<string, unknown>;
|
|
40
|
-
/** The config init() requires.
|
|
40
|
+
/** The config init() requires. */
|
|
41
41
|
export interface AppticsConfig {
|
|
42
42
|
/** Apptics host every request goes to, e.g. https://apptics.zoho.com (a trailing slash is ignored). Was `serviceUrl`. */
|
|
43
43
|
base_url: string;
|
|
@@ -87,6 +87,18 @@ export interface AppticsConfig {
|
|
|
87
87
|
* navigation replaces its automatic view; set this false to track only the app's own calls.
|
|
88
88
|
*/
|
|
89
89
|
track_screen?: boolean;
|
|
90
|
+
/**
|
|
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().
|
|
100
|
+
*/
|
|
101
|
+
track_click?: boolean;
|
|
90
102
|
/**
|
|
91
103
|
* How automatic screen tracking names a path, tried in order; the first that matches wins, and a
|
|
92
104
|
* path none matches keeps its own name. Each entry is one of:
|
|
@@ -105,13 +117,19 @@ export interface AppticsConfig {
|
|
|
105
117
|
feedback_theme?: 'light' | 'dark' | 'auto';
|
|
106
118
|
/** How often queued data is sent, in milliseconds. Default 30000, at least 1000. */
|
|
107
119
|
batch_flush_interval?: number;
|
|
108
|
-
/**
|
|
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
|
+
*/
|
|
109
124
|
getupdates_interval?: number;
|
|
110
125
|
/** Most items in one batch. Default 50, between 1 and 500. */
|
|
111
126
|
batch_size?: number;
|
|
112
127
|
/** Days an unsent item is kept before it is dropped. Default 7, between 1 and 30. */
|
|
113
128
|
batch_request_timeout?: number;
|
|
114
|
-
/**
|
|
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
|
+
*/
|
|
115
133
|
inactiveduration?: number;
|
|
116
134
|
/**
|
|
117
135
|
* How long a visit must last before its session is recorded, in milliseconds. Default 5000, at
|
|
@@ -120,8 +138,8 @@ export interface AppticsConfig {
|
|
|
120
138
|
*/
|
|
121
139
|
min_session_duration?: number;
|
|
122
140
|
/**
|
|
123
|
-
* Record where people click and how far they scroll. Off by default;
|
|
124
|
-
* switches it later.
|
|
141
|
+
* Record where people click and how far they scroll. Off by default;
|
|
142
|
+
* AppticsHeatmap.setHeatmapTracking() switches it later.
|
|
125
143
|
*/
|
|
126
144
|
track_heatmap?: boolean;
|
|
127
145
|
/** Most heatmap records one visit may produce. Default 500; capture pauses past it. */
|
|
@@ -175,8 +193,9 @@ export interface QuartzApi {
|
|
|
175
193
|
quartzBranding: boolean;
|
|
176
194
|
}): void;
|
|
177
195
|
clearFeedback(): void;
|
|
178
|
-
|
|
179
|
-
|
|
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;
|
|
180
199
|
submitRecording(details: {
|
|
181
200
|
email: string;
|
|
182
201
|
subject: string;
|
|
@@ -256,7 +275,7 @@ export interface SendFeedbackOptions {
|
|
|
256
275
|
attachments?: FileList | File[] | null;
|
|
257
276
|
/** Log files of the app's own to send along. */
|
|
258
277
|
logFiles?: FileList | File[] | null;
|
|
259
|
-
/** The addDiagnosticsInfo() entries
|
|
278
|
+
/** The addDiagnosticsInfo() entries: unset sends them when there are any, false never does. */
|
|
260
279
|
includeDiagnostics?: boolean;
|
|
261
280
|
/** The addFeedbackLog() lines: unset sends them when there are any, false never does. */
|
|
262
281
|
includeLog?: boolean;
|
|
@@ -305,11 +324,15 @@ export interface AppticsFeedbackApi {
|
|
|
305
324
|
export interface AppticsSdk {
|
|
306
325
|
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
307
326
|
Apptics: {
|
|
308
|
-
/** Starts the SDK
|
|
327
|
+
/** Starts the SDK with the app's config object, which is required. */
|
|
309
328
|
init(config: AppticsConfig): boolean;
|
|
310
329
|
/** Resolves true once start-up (storage load, device, session) has finished; false if it can't start. */
|
|
311
330
|
ready(): Promise<boolean>;
|
|
312
|
-
/**
|
|
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
|
+
*/
|
|
313
336
|
flush(): Promise<void>;
|
|
314
337
|
/** Clears stored identity, queued data and remote config values, then starts again. */
|
|
315
338
|
reset(): void;
|
|
@@ -326,10 +349,15 @@ export interface AppticsSdk {
|
|
|
326
349
|
AppticsEvent: {
|
|
327
350
|
/** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
|
|
328
351
|
DefinedEvents: typeof DefinedEvents;
|
|
329
|
-
/** An event.
|
|
330
|
-
addEvent(eventName: string, groupName
|
|
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;
|
|
331
354
|
/** A defined event (AppticsEvent.DefinedEvents.AP_USER_LOGIN, …), which brings its own group. */
|
|
332
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;
|
|
333
361
|
};
|
|
334
362
|
/** Android's AppticsScreenTracker. */
|
|
335
363
|
AppticsScreen: {
|
|
@@ -337,6 +365,11 @@ export interface AppticsSdk {
|
|
|
337
365
|
inScreen(screenName: string, properties?: Properties): string;
|
|
338
366
|
/** Ends the screen view inScreen began, before the next screen would. */
|
|
339
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;
|
|
340
373
|
};
|
|
341
374
|
/** Android's AppticsApiTracker. */
|
|
342
375
|
AppticsApi: {
|
|
@@ -349,16 +382,23 @@ export interface AppticsSdk {
|
|
|
349
382
|
/** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
|
|
350
383
|
configure(config: ApiTrackingConfig | ApiTrackingBuilder): void;
|
|
351
384
|
/**
|
|
352
|
-
* Turns automatic API tracking on or off after Apptics.init()
|
|
353
|
-
* config flag
|
|
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.
|
|
354
387
|
*/
|
|
388
|
+
setApiTracking(enabled?: boolean): void;
|
|
389
|
+
/** @deprecated renamed setApiTracking; this name still works, with a console warning */
|
|
355
390
|
enableApiTracking(enabled?: boolean): void;
|
|
356
391
|
};
|
|
357
392
|
/** Errors the app caught, and the switch for tracking uncaught ones. */
|
|
358
393
|
AppticsError: {
|
|
359
394
|
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
360
395
|
trackError(error: ErrorLike, properties?: Properties): void;
|
|
361
|
-
/**
|
|
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 */
|
|
362
402
|
trackGlobalErrorHandler(enabled?: boolean): void;
|
|
363
403
|
};
|
|
364
404
|
/** Android's AppticsUser. */
|
|
@@ -372,7 +412,12 @@ export interface AppticsSdk {
|
|
|
372
412
|
};
|
|
373
413
|
/** Click and scroll capture for the console's heatmaps. */
|
|
374
414
|
AppticsHeatmap: {
|
|
375
|
-
/**
|
|
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 */
|
|
376
421
|
trackHeatmap(on?: boolean): void;
|
|
377
422
|
};
|
|
378
423
|
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
package/dist/esm/user/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.
|
|
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_TRACKING_STATUS } from '../core/constants.js';
|
|
3
3
|
import { _ZAP } from '../core/state.js';
|
|
4
4
|
import { logFailure, Console } from '../core/logger.js';
|
|
5
5
|
import { isEmpty, nowMs, isEmptyObj, cloneMapExcludingKeys } from '../core/utils.js';
|
|
6
6
|
import { user_defaults } from '../core/storage.js';
|
|
7
|
-
import { canTrack,
|
|
7
|
+
import { canTrack, recordTrackingStatus } from '../core/consent.js';
|
|
8
8
|
import { rejectIfDisabled, rejectIfOffline, rejectIfNoDeviceIds, postToApptics, apiHeaders } from '../core/transport.js';
|
|
9
9
|
import { userValidateJSON } from '../core/validate.js';
|
|
10
10
|
import { hooks } from '../core/hooks.js';
|
|
@@ -102,11 +102,15 @@ function registerUserWithApptics(user_info) {
|
|
|
102
102
|
var data = result.data || {};
|
|
103
103
|
user_info.userid = data.userid;
|
|
104
104
|
user_info.groupid = data.customergroupid;
|
|
105
|
-
|
|
105
|
+
// stored only: user/register has told the server, and the device is registered already
|
|
106
|
+
recordTrackingStatus(AP_TRACKING_STATUS.USAGE_TRACKING_WITH_PII);
|
|
106
107
|
addOrUpdateUser(user_info);
|
|
107
108
|
getUserInfo();
|
|
108
109
|
// the user and their customer group are known now: remote config conditions on them re-apply
|
|
109
110
|
hooks.remoteConfigUserChanged();
|
|
111
|
+
// getsdkconfig answers for the user (with every module off for one whose customer group
|
|
112
|
+
// is not tracked, customergrouptracking: false), so it is asked again for them now
|
|
113
|
+
hooks.askServerSettings();
|
|
110
114
|
return data;
|
|
111
115
|
});
|
|
112
116
|
}
|