@zoho_apptics/apptics-js-sdk 2.0.0-beta → 2.0.0-beta.1
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 +111 -5
- package/README.md +399 -300
- 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-VYr43KcB.min.js +3 -0
- package/dist/chunks/lifecycle-VYr43KcB.min.js.map +1 -0
- package/dist/cjs/auto-init.d.ts +3 -3
- package/dist/cjs/auto-init.js +1 -1
- package/dist/cjs/core/attempts.js +1 -1
- package/dist/cjs/core/batch.js +2 -1
- package/dist/cjs/core/callsite.d.ts +6 -0
- package/dist/cjs/core/callsite.js +25 -3
- package/dist/cjs/core/consent.d.ts +5 -1
- package/dist/cjs/core/consent.js +8 -6
- package/dist/cjs/core/constants.d.ts +35 -10
- package/dist/cjs/core/constants.js +31 -15
- 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.js +1 -1
- 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 +2 -4
- package/dist/cjs/core/hooks.js +2 -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 +3 -2
- package/dist/cjs/core/state.js +2 -2
- package/dist/cjs/core/storage.d.ts +20 -5
- package/dist/cjs/core/storage.js +115 -17
- 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 +19 -4
- package/dist/cjs/core/utils.js +1 -1
- package/dist/cjs/core/validate.js +2 -2
- package/dist/cjs/device/appversion.d.ts +1 -6
- package/dist/cjs/device/appversion.js +13 -1
- package/dist/cjs/device/index.d.ts +11 -0
- package/dist/cjs/device/index.js +120 -20
- 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 +6 -1
- package/dist/cjs/engagement/session.d.ts +12 -3
- package/dist/cjs/engagement/session.js +161 -25
- package/dist/cjs/engagement/track.js +45 -20
- package/dist/cjs/errors/send.js +1 -1
- package/dist/cjs/errors/track.d.ts +1 -1
- package/dist/cjs/errors/track.js +46 -6
- package/dist/cjs/feedback/controls.d.ts +6 -0
- package/dist/cjs/feedback/controls.js +31 -1
- package/dist/cjs/feedback/index.d.ts +8 -7
- package/dist/cjs/feedback/index.js +32 -13
- package/dist/cjs/feedback/logs.d.ts +10 -5
- package/dist/cjs/feedback/logs.js +52 -13
- package/dist/cjs/feedback/quartz.d.ts +18 -0
- package/dist/cjs/feedback/quartz.js +105 -0
- package/dist/cjs/feedback/send.d.ts +3 -0
- package/dist/cjs/feedback/send.js +28 -3
- 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 +12 -12
- package/dist/cjs/feedback/ui.d.ts +14 -6
- package/dist/cjs/feedback/ui.js +126 -48
- package/dist/cjs/heatmap/send.js +1 -1
- package/dist/cjs/heatmap/track.d.ts +1 -1
- package/dist/cjs/heatmap/track.js +87 -16
- package/dist/cjs/index.d.ts +17 -63
- package/dist/cjs/index.js +104 -92
- package/dist/cjs/lifecycle.d.ts +8 -1
- package/dist/cjs/lifecycle.js +258 -62
- 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 +3 -3
- package/dist/cjs/remoteconfig/fetch.js +9 -23
- package/dist/cjs/remoteconfig/index.d.ts +10 -8
- package/dist/cjs/remoteconfig/index.js +65 -39
- package/dist/cjs/remoteconfig/store.js +1 -1
- package/dist/cjs/remoteconfig/tz-countries.d.ts +8 -0
- package/dist/cjs/remoteconfig/tz-countries.js +13 -0
- 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 +30 -58
- package/dist/cjs/remotelog/send.js +10 -10
- package/dist/cjs/remotelogger/index.d.ts +12 -0
- package/dist/cjs/remotelogger/index.js +18 -0
- package/dist/cjs/scheduler.js +2 -2
- package/dist/cjs/types.d.ts +155 -82
- package/dist/cjs/user/index.js +11 -6
- package/dist/esm/auto-init.d.ts +3 -3
- package/dist/esm/auto-init.js +1 -1
- package/dist/esm/core/attempts.js +1 -1
- package/dist/esm/core/batch.js +2 -1
- package/dist/esm/core/callsite.d.ts +6 -0
- package/dist/esm/core/callsite.js +25 -4
- package/dist/esm/core/consent.d.ts +5 -1
- package/dist/esm/core/consent.js +9 -7
- package/dist/esm/core/constants.d.ts +35 -10
- package/dist/esm/core/constants.js +30 -15
- 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.js +1 -1
- 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 +2 -4
- package/dist/esm/core/hooks.js +2 -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 +3 -2
- package/dist/esm/core/state.js +2 -2
- package/dist/esm/core/storage.d.ts +20 -5
- package/dist/esm/core/storage.js +113 -18
- 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 +19 -5
- package/dist/esm/core/utils.js +1 -1
- package/dist/esm/core/validate.js +2 -2
- package/dist/esm/device/appversion.d.ts +1 -6
- package/dist/esm/device/appversion.js +13 -2
- package/dist/esm/device/index.d.ts +11 -0
- package/dist/esm/device/index.js +123 -24
- 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 +6 -1
- package/dist/esm/engagement/session.d.ts +12 -3
- package/dist/esm/engagement/session.js +162 -29
- package/dist/esm/engagement/track.js +52 -27
- package/dist/esm/errors/send.js +1 -1
- package/dist/esm/errors/track.d.ts +1 -1
- package/dist/esm/errors/track.js +46 -6
- package/dist/esm/feedback/controls.d.ts +6 -0
- package/dist/esm/feedback/controls.js +31 -2
- package/dist/esm/feedback/index.d.ts +8 -7
- package/dist/esm/feedback/index.js +34 -13
- package/dist/esm/feedback/logs.d.ts +10 -5
- package/dist/esm/feedback/logs.js +54 -15
- package/dist/esm/feedback/quartz.d.ts +18 -0
- package/dist/esm/feedback/quartz.js +99 -0
- package/dist/esm/feedback/send.d.ts +3 -0
- package/dist/esm/feedback/send.js +28 -5
- 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 +12 -12
- package/dist/esm/feedback/ui.d.ts +14 -6
- package/dist/esm/feedback/ui.js +126 -49
- package/dist/esm/heatmap/send.js +1 -1
- package/dist/esm/heatmap/track.d.ts +1 -1
- package/dist/esm/heatmap/track.js +87 -16
- package/dist/esm/index.d.ts +17 -63
- package/dist/esm/index.js +108 -80
- package/dist/esm/lifecycle.d.ts +8 -1
- package/dist/esm/lifecycle.js +266 -71
- 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 +3 -3
- package/dist/esm/remoteconfig/fetch.js +9 -23
- package/dist/esm/remoteconfig/index.d.ts +10 -8
- package/dist/esm/remoteconfig/index.js +66 -40
- package/dist/esm/remoteconfig/store.js +1 -1
- package/dist/esm/remoteconfig/tz-countries.d.ts +8 -0
- package/dist/esm/remoteconfig/tz-countries.js +11 -0
- 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 +32 -60
- package/dist/esm/remotelog/send.js +12 -12
- package/dist/esm/remotelogger/index.d.ts +12 -0
- package/dist/esm/remotelogger/index.js +13 -0
- package/dist/esm/scheduler.js +2 -2
- package/dist/esm/types.d.ts +155 -82
- package/dist/esm/user/index.js +12 -6
- package/dist/feedback.esm.min.js +2 -2
- package/dist/feedback.esm.min.js.map +1 -1
- package/package.json +14 -16
- 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/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/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
package/dist/cjs/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. */
|
|
@@ -32,12 +39,12 @@ export type FeedbackType = (typeof AP_FEEDBACK_TYPE)[keyof typeof AP_FEEDBACK_TY
|
|
|
32
39
|
export type Properties = Record<string, unknown>;
|
|
33
40
|
/** The config init() requires. The console snippet provides the same shape as window.appticssettings._defaultoptions. */
|
|
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,15 +88,21 @@ export interface AppticsConfig {
|
|
|
90
88
|
*/
|
|
91
89
|
track_screen?: boolean;
|
|
92
90
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
91
|
+
* How automatic screen tracking names a path, tried in order; the first that matches wins, and a
|
|
92
|
+
* path none matches keeps its own name. Each entry is one of:
|
|
93
|
+
* - a route pattern, `'/users/{id}/orders'`: `{name}`, `:name` and `*` each match one segment,
|
|
94
|
+
* recorded as a star, so `/users/42/orders` and `/users/43/orders` are one screen;
|
|
95
|
+
* - `{ equals: '/', name: 'Home' }`: that path exactly;
|
|
96
|
+
* - `{ regex: /^\/orders\/\d+$/, name: 'Order detail' }`: any path the regular expression matches.
|
|
97
|
+
* Paths are matched without their query string.
|
|
95
98
|
*/
|
|
96
|
-
|
|
99
|
+
screen_routes?: ScreenRoute[];
|
|
97
100
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
101
|
+
* The feedback form's theme: 'light', 'dark', or 'auto' (the default) to follow the visitor's
|
|
102
|
+
* system setting. The colors are CSS variables on the form (`--zasdk-primary-color` and the rest
|
|
103
|
+
* of the `--zasdk-*` set), which a page may override.
|
|
100
104
|
*/
|
|
101
|
-
|
|
105
|
+
feedback_theme?: 'light' | 'dark' | 'auto';
|
|
102
106
|
/** How often queued data is sent, in milliseconds. Default 30000, at least 1000. */
|
|
103
107
|
batch_flush_interval?: number;
|
|
104
108
|
/** How often the server's tracking flags are fetched, in milliseconds. Default 120000, at least 10000. */
|
|
@@ -116,8 +120,8 @@ export interface AppticsConfig {
|
|
|
116
120
|
*/
|
|
117
121
|
min_session_duration?: number;
|
|
118
122
|
/**
|
|
119
|
-
* Record where people click and how far they scroll. Off by default
|
|
120
|
-
*
|
|
123
|
+
* Record where people click and how far they scroll. Off by default; AppticsHeatmap.trackHeatmap()
|
|
124
|
+
* switches it later.
|
|
121
125
|
*/
|
|
122
126
|
track_heatmap?: boolean;
|
|
123
127
|
/** Most heatmap records one visit may produce. Default 500; capture pauses past it. */
|
|
@@ -140,6 +144,26 @@ export interface UserValidationResult {
|
|
|
140
144
|
keys: string[];
|
|
141
145
|
}>;
|
|
142
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Screen recording in the feedback form, as getsdkconfig's `quartz` block sets it up:
|
|
149
|
+
* { quartz_enabled, quartz_workspace, quartz_department, quartz_domain, quartz_cdn_url }
|
|
150
|
+
* The app passes none of it; the console's settings for the app decide.
|
|
151
|
+
*/
|
|
152
|
+
export interface QuartzSettings {
|
|
153
|
+
enabled: boolean;
|
|
154
|
+
/** quartz_workspace: the workspace the recording is filed under. */
|
|
155
|
+
workspace: string;
|
|
156
|
+
/** quartz_department: the department within it. */
|
|
157
|
+
department: string;
|
|
158
|
+
/** quartz_domain, e.g. zoho.com: recordings go to https://quartz.<domain>. */
|
|
159
|
+
domain: string;
|
|
160
|
+
/**
|
|
161
|
+
* quartz_cdn_url: the Quartz script, loaded by the SDK when the form needs it. When the answer
|
|
162
|
+
* has none, the SDK uses Zoho's CDN for the serviceUrl (static.localzohocdn.com for localzoho,
|
|
163
|
+
* static.zohocdn.com otherwise).
|
|
164
|
+
*/
|
|
165
|
+
cdnUrl: string;
|
|
166
|
+
}
|
|
143
167
|
export interface QuartzApi {
|
|
144
168
|
startRecording(details: {
|
|
145
169
|
workspaceLinkName: string;
|
|
@@ -216,97 +240,146 @@ export interface HeatmapRecord {
|
|
|
216
240
|
is_rage_click: 0 | 1;
|
|
217
241
|
is_dead_click: 0 | 1;
|
|
218
242
|
}
|
|
219
|
-
/** What `
|
|
243
|
+
/** What `AppticsError.trackError` accepts: a window `error` / `unhandledrejection` event or the same shape. */
|
|
220
244
|
export type ErrorLike = Event | {
|
|
221
245
|
type?: string;
|
|
222
246
|
error?: unknown;
|
|
223
247
|
reason?: unknown;
|
|
224
248
|
};
|
|
249
|
+
/** What sendFeedback() sends. Every key is optional. */
|
|
250
|
+
export interface SendFeedbackOptions {
|
|
251
|
+
/** AppticsFeedback.AP_FEEDBACK_TYPE: BUG (0), FEEDBACK (1, the default), HELP (2), REPORT (3). */
|
|
252
|
+
type?: FeedbackType;
|
|
253
|
+
/** The feedback's text. */
|
|
254
|
+
message?: string;
|
|
255
|
+
/** Files to attach: at most 5, 10 MB in all. */
|
|
256
|
+
attachments?: FileList | File[] | null;
|
|
257
|
+
/** Log files of the app's own to send along. */
|
|
258
|
+
logFiles?: FileList | File[] | null;
|
|
259
|
+
/** The addDiagnosticsInfo() entries and the device's details: unset sends them when there are entries waiting. */
|
|
260
|
+
includeDiagnostics?: boolean;
|
|
261
|
+
/** The addFeedbackLog() lines: unset sends them when there are any, false never does. */
|
|
262
|
+
includeLog?: boolean;
|
|
263
|
+
/** Sends it from nobody. Unset, it is from the active user AppticsUser.setUser registered. */
|
|
264
|
+
isAnonymous?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/** What feedbackFormOpen() fills the form in with. Every key is optional. */
|
|
267
|
+
export interface FeedbackOpenOptions {
|
|
268
|
+
/** The tab the form opens on: AppticsFeedback.AP_FEEDBACK_TYPE.BUG, FEEDBACK, HELP or REPORT. */
|
|
269
|
+
type?: FeedbackType;
|
|
270
|
+
/** Text already in the description. */
|
|
271
|
+
message?: string;
|
|
272
|
+
/** Starts the logs toggle on. */
|
|
273
|
+
includeLog?: boolean;
|
|
274
|
+
/** Starts the diagnostics toggle on. */
|
|
275
|
+
includeDiagnostics?: boolean;
|
|
276
|
+
/** Files already attached: at most 5, 10 MB in all. */
|
|
277
|
+
attachments?: FileList | File[] | null;
|
|
278
|
+
/** Log files of the app's own already attached. */
|
|
279
|
+
logFiles?: FileList | File[] | null;
|
|
280
|
+
/** Starts the user picker on Anonymous, even with a user registered. */
|
|
281
|
+
isAnonymous?: boolean;
|
|
282
|
+
}
|
|
225
283
|
/** The optional feedback modal, from '@zoho_apptics/apptics-js-sdk/feedback'. */
|
|
226
284
|
export interface AppticsFeedbackApi {
|
|
227
285
|
/**
|
|
228
286
|
* Sends feedback without the form. Resolves once it is sent; rejects when it wasn't: the SDK
|
|
229
287
|
* has not started (no init()), the browser is offline, or the server refused it.
|
|
230
288
|
*/
|
|
231
|
-
sendFeedback(
|
|
232
|
-
/**
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
289
|
+
sendFeedback(options?: SendFeedbackOptions): Promise<void>;
|
|
290
|
+
/** Opens the form, filled in with `options` when they are given. */
|
|
291
|
+
feedbackFormOpen(options?: FeedbackOpenOptions): void;
|
|
292
|
+
feedbackFormClose(): void;
|
|
293
|
+
/** The feedback types: BUG, FEEDBACK, HELP, REPORT. */
|
|
294
|
+
AP_FEEDBACK_TYPE: typeof AP_FEEDBACK_TYPE;
|
|
295
|
+
/** Records a timestamped line, sent as feedbacklog.txt with the next feedback submission. */
|
|
296
|
+
addFeedbackLog(message: string): void;
|
|
297
|
+
/** Records a diagnostics key/value under `heading`, sent inside dyninfo.txt with the next feedback. */
|
|
298
|
+
addDiagnosticsInfo(heading: string, key: string, value: unknown): void;
|
|
236
299
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* Anonymous even when a user is registered.
|
|
300
|
+
* The form's theme from now on, restyling one open now: 'light', 'dark', or 'auto' to follow
|
|
301
|
+
* the visitor's system setting. For a page with its own theme switch, called as it changes.
|
|
240
302
|
*/
|
|
241
|
-
|
|
242
|
-
feedbackClose(): void;
|
|
303
|
+
setFeedbackTheme(theme: 'light' | 'dark' | 'auto'): void;
|
|
243
304
|
}
|
|
244
|
-
export interface
|
|
245
|
-
/** Android's Apptics. */
|
|
305
|
+
export interface AppticsSdk {
|
|
306
|
+
/** Android's Apptics: starting the SDK, and what applies to all of it. */
|
|
246
307
|
Apptics: {
|
|
247
308
|
/** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
|
|
248
309
|
init(config: AppticsConfig): boolean;
|
|
310
|
+
/** Resolves true once start-up (storage load, device, session) has finished; false if it can't start. */
|
|
311
|
+
ready(): Promise<boolean>;
|
|
312
|
+
/** Sends stored engagements, errors and heatmap records now; resolves once they have gone out. */
|
|
313
|
+
flush(): Promise<void>;
|
|
314
|
+
/** Clears stored identity, queued data and remote config values, then starts again. */
|
|
315
|
+
reset(): void;
|
|
316
|
+
/**
|
|
317
|
+
* Turns debug mode on, before or after Apptics.init(). Engagement, exception and log then go to
|
|
318
|
+
* their `debug/` twins, whose answers carry a request id and a link into the server's own logs. It
|
|
319
|
+
* switches itself off after an hour with nothing tracked.
|
|
320
|
+
*/
|
|
321
|
+
enableDebug(): void;
|
|
322
|
+
/** Turns debug mode off, before or after Apptics.init(); wins over `debug` in init(). */
|
|
323
|
+
disableDebug(): void;
|
|
249
324
|
};
|
|
250
325
|
/** Android's AppticsEvents. */
|
|
251
|
-
|
|
326
|
+
AppticsEvent: {
|
|
327
|
+
/** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
|
|
328
|
+
DefinedEvents: typeof DefinedEvents;
|
|
252
329
|
/** An event. An invalid name or group is not logged; a group left out is `default`. */
|
|
253
330
|
addEvent(eventName: string, groupName?: string, properties?: Properties): void;
|
|
254
|
-
/** A defined event (DefinedEvents.AP_USER_LOGIN, …), which brings its own group. */
|
|
331
|
+
/** A defined event (AppticsEvent.DefinedEvents.AP_USER_LOGIN, …), which brings its own group. */
|
|
255
332
|
addEvent(definedEvent: DefinedEvent, properties?: Properties): void;
|
|
256
333
|
};
|
|
257
|
-
/** Apptics' defined events, as Android's DefinedEvents. */
|
|
258
|
-
DefinedEvents: Readonly<Record<string, DefinedEvent>>;
|
|
259
334
|
/** Android's AppticsScreenTracker. */
|
|
260
|
-
|
|
335
|
+
AppticsScreen: {
|
|
261
336
|
/** Records a screen view and returns its id, for outScreen; '' for an invalid name. */
|
|
262
337
|
inScreen(screenName: string, properties?: Properties): string;
|
|
263
338
|
/** Ends the screen view inScreen began, before the next screen would. */
|
|
264
339
|
outScreen(id: string): void;
|
|
265
340
|
};
|
|
266
341
|
/** Android's AppticsApiTracker. */
|
|
267
|
-
|
|
342
|
+
AppticsApi: {
|
|
343
|
+
/** Builds the rules configure takes: `new AppticsApi.ApiTrackingBuilder()…build()`. */
|
|
344
|
+
ApiTrackingBuilder: typeof ApiTrackingBuilder;
|
|
268
345
|
/** Begins timing one call; returns the id endTrackApi takes. */
|
|
269
346
|
startTrackApi(url: string, method?: string): string;
|
|
270
347
|
/** Finishes the call startTrackApi began, and records it. */
|
|
271
348
|
endTrackApi(id: string, responseCode: number, responseMessage?: string): void;
|
|
272
349
|
/** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
|
|
273
350
|
configure(config: ApiTrackingConfig | ApiTrackingBuilder): void;
|
|
351
|
+
/**
|
|
352
|
+
* Turns automatic API tracking on or off after Apptics.init(). Equivalent to the `track_api`
|
|
353
|
+
* config flag, which is the usual way to set it.
|
|
354
|
+
*/
|
|
355
|
+
enableApiTracking(enabled?: boolean): void;
|
|
274
356
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* Turns automatic API tracking on or off after Apptics.init(). Equivalent to the `track_api`
|
|
290
|
-
* config flag, which is the usual way to set it.
|
|
291
|
-
*/
|
|
292
|
-
enableApiTracking(enabled?: boolean): void;
|
|
293
|
-
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
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: {
|
|
357
|
+
/** Errors the app caught, and the switch for tracking uncaught ones. */
|
|
358
|
+
AppticsError: {
|
|
359
|
+
/** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
|
|
360
|
+
trackError(error: ErrorLike, properties?: Properties): void;
|
|
361
|
+
/** Turns the automatic tracking of uncaught errors and unhandled rejections on or off. */
|
|
362
|
+
trackGlobalErrorHandler(enabled?: boolean): void;
|
|
363
|
+
};
|
|
364
|
+
/** Android's AppticsUser. */
|
|
365
|
+
AppticsUser: {
|
|
366
|
+
/** Registers the signed-in user. Properties may be a plain object, or the result of UserBuilder.build(). */
|
|
367
|
+
setUser(userid: string, groupid?: string, properties?: Properties | UserValidationResult): void;
|
|
368
|
+
/** The registered user, or {} when there is none. */
|
|
369
|
+
getUser(): UserInfo;
|
|
370
|
+
/** Builds the user's properties for setUser. */
|
|
300
371
|
UserBuilder: typeof UserBuilder;
|
|
301
372
|
};
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
373
|
+
/** Click and scroll capture for the console's heatmaps. */
|
|
374
|
+
AppticsHeatmap: {
|
|
375
|
+
/** Starts or stops recording clicks and scrolls; `on` defaults to true. */
|
|
376
|
+
trackHeatmap(on?: boolean): void;
|
|
377
|
+
};
|
|
378
|
+
/** Android's AppticsSettings: what the SDK may track for this visitor. */
|
|
379
|
+
AppticsSettings: {
|
|
380
|
+
/** The states setTrackingStatus takes. */
|
|
381
|
+
AP_TRACKING_STATUS: typeof AP_TRACKING_STATUS;
|
|
382
|
+
setTrackingStatus(status: TrackingStatus): void;
|
|
383
|
+
getTrackingStatus(): TrackingStatus;
|
|
384
|
+
};
|
|
312
385
|
}
|
package/dist/cjs/user/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var constants = require('../core/constants.js');
|
|
@@ -25,7 +25,7 @@ function asUserProperties(jsonObj) {
|
|
|
25
25
|
? maybeBuilt
|
|
26
26
|
: validate.userValidateJSON(jsonObj);
|
|
27
27
|
built.message.forEach(function (problem) {
|
|
28
|
-
logger.logFailure(constants.AP_LOG_MODULE.PROPERTIES, '
|
|
28
|
+
logger.logFailure(constants.AP_LOG_MODULE.PROPERTIES, 'AppticsUser.setUser: dropped ' + problem.keys.join(', ') + ' (error ' + problem.code + ')'); // no i18n
|
|
29
29
|
});
|
|
30
30
|
return built;
|
|
31
31
|
}
|
|
@@ -37,7 +37,7 @@ function setUser(userid, groupid, jsonObj) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (utils.isEmpty(userid)) {
|
|
40
|
-
logger.logFailure(constants.AP_LOG_MODULE.PROPERTIES, '
|
|
40
|
+
logger.logFailure(constants.AP_LOG_MODULE.PROPERTIES, 'AppticsUser.setUser: Invalid userid'); // no i18n
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
var user_info = {
|
|
@@ -68,8 +68,16 @@ function addOrUpdateUser(user_info) {
|
|
|
68
68
|
users.push(user_info);
|
|
69
69
|
}
|
|
70
70
|
storage.user_defaults.add('users', users); // no i18n
|
|
71
|
+
// the user setUser registered, on its own as well: what this browser is tracking as now
|
|
72
|
+
storage.user_defaults.add('user_info', users[index !== -1 ? index : users.length - 1]); // no i18n
|
|
71
73
|
}
|
|
72
74
|
function getUserInfo() {
|
|
75
|
+
var stored = storage.user_defaults.item('user_info'); // no i18n
|
|
76
|
+
if (stored && typeof stored === 'object' && !utils.isEmpty(stored.userid)) { // no i18n
|
|
77
|
+
state._ZAP._user_info = stored;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// registered before user_info was kept: the active one of the users list
|
|
73
81
|
var users = storage.user_defaults.item('users') || []; // no i18n
|
|
74
82
|
var activeuser = {};
|
|
75
83
|
if (users.length > 0) {
|
|
@@ -166,8 +174,6 @@ class UserBuilder {
|
|
|
166
174
|
return validate.userValidateJSON(user);
|
|
167
175
|
}
|
|
168
176
|
}
|
|
169
|
-
// Users module for user management
|
|
170
|
-
const users = { UserBuilder: UserBuilder };
|
|
171
177
|
|
|
172
178
|
exports.UserBuilder = UserBuilder;
|
|
173
179
|
exports.addOrUpdateUser = addOrUpdateUser;
|
|
@@ -175,4 +181,3 @@ exports.getUser = getUser;
|
|
|
175
181
|
exports.getUserInfo = getUserInfo;
|
|
176
182
|
exports.registerUserWithApptics = registerUserWithApptics;
|
|
177
183
|
exports.setUser = setUser;
|
|
178
|
-
exports.users = users;
|
package/dist/esm/auto-init.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AppticsSdk } from './types.js';
|
|
2
2
|
/** Calls Apptics.init() when the page has the console snippet (window.appticssettings) and it hasn't run. */
|
|
3
|
-
export declare function autoInit(api:
|
|
3
|
+
export declare function autoInit(api: AppticsSdk['Apptics']): boolean;
|
|
4
4
|
/**
|
|
5
5
|
* Queues autoInit so an app that sets window.appticssettings and calls init() in its
|
|
6
6
|
* top-level code runs first (autoInit then sees init() already ran).
|
|
7
7
|
*/
|
|
8
|
-
export declare function scheduleAutoInit(api:
|
|
8
|
+
export declare function scheduleAutoInit(api: AppticsSdk['Apptics']): void;
|
package/dist/esm/auto-init.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { _ZAP } from './core/state.js';
|
|
3
3
|
import { getSnippetOptions } from './core/env.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { RETRY_CAPABLE_PATHS } from './constants.js';
|
|
3
3
|
import { user_defaults } from './storage.js';
|
|
4
4
|
import { nowMs } from './utils.js';
|
package/dist/esm/core/batch.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { _ZAP, isExpired } from './state.js';
|
|
3
3
|
import { Console, warnAlways } from './logger.js';
|
|
4
4
|
import { isEmptyObj, sizeof } from './utils.js';
|
|
5
5
|
import './constants.js';
|
|
6
|
+
import './db.js';
|
|
6
7
|
import { shouldTrackOrSendData } from './consent.js';
|
|
7
8
|
import { attemptsExhausted, MAX_ATTEMPTS, resetAttempts } from './attempts.js';
|
|
8
9
|
import { rejectIfDisabled, rejectIfNoDeviceIds, getMetaObj, postKeepalive, apiHeaders, postToApptics } from './transport.js';
|
|
@@ -15,6 +15,12 @@ export interface CallSite {
|
|
|
15
15
|
fn?: string;
|
|
16
16
|
}
|
|
17
17
|
export declare const NO_CALL_SITE: CallSite;
|
|
18
|
+
/**
|
|
19
|
+
* A call typed in the browser's developer console: there is no file, line or function to report,
|
|
20
|
+
* only the console's own placeholder for its input, so the line says plainly that it came from
|
|
21
|
+
* nowhere in the app. file_name and the function field both accept `-`.
|
|
22
|
+
*/
|
|
23
|
+
export declare const CONSOLE_CALL_SITE: CallSite;
|
|
18
24
|
/**
|
|
19
25
|
* The frame `skip` frames down a stack, counting only the ones that name a file — V8 heads its
|
|
20
26
|
* stacks with an `Error` line and Firefox does not, so counting raw lines would read a different
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
/**
|
|
3
3
|
* Where a log line was raised, for logSDK's `filename` and `linenumber`.
|
|
4
4
|
*
|
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
* wrapped so a stack we cannot parse costs a line its call site and nothing more.
|
|
9
9
|
*/
|
|
10
10
|
const NO_CALL_SITE = { filename: '', linenumber: 0, fn: '' };
|
|
11
|
+
/**
|
|
12
|
+
* A call typed in the browser's developer console: there is no file, line or function to report,
|
|
13
|
+
* only the console's own placeholder for its input, so the line says plainly that it came from
|
|
14
|
+
* nowhere in the app. file_name and the function field both accept `-`.
|
|
15
|
+
*/
|
|
16
|
+
const CONSOLE_CALL_SITE = { filename: '-', linenumber: 0, fn: '-' };
|
|
17
|
+
/**
|
|
18
|
+
* The frame of code run from the developer console, in each browser:
|
|
19
|
+
* V8 (Chrome, Edge): ` at <anonymous>:1:15` (the file is <anonymous>)
|
|
20
|
+
* Firefox: `@debugger eval code:1:15`
|
|
21
|
+
* Safari: `global code` or `eval code`, with no location at all
|
|
22
|
+
* V8 names a string run through eval or new Function <anonymous> too; it is no file either.
|
|
23
|
+
*/
|
|
24
|
+
const CONSOLE_FILE_V8 = '<anonymous>'; // no i18n
|
|
25
|
+
const CONSOLE_FIREFOX = /debugger eval code/; // no i18n
|
|
26
|
+
const CONSOLE_SAFARI = /^(global|eval) code(@|$)/; // no i18n
|
|
11
27
|
/** logSDK declares max-len="100" on filename. */
|
|
12
28
|
const FILENAME_MAX = 100;
|
|
13
29
|
/**
|
|
@@ -61,14 +77,19 @@ function callSiteFromStack(stack, skip) {
|
|
|
61
77
|
var lines = stack.split('\n');
|
|
62
78
|
var seen = 0;
|
|
63
79
|
for (var i = 0; i < lines.length; i++) {
|
|
64
|
-
var
|
|
80
|
+
var raw = (lines[i] || '').trim(); // no i18n
|
|
81
|
+
var frame = parseFrame(raw);
|
|
65
82
|
if (frame === null) {
|
|
83
|
+
// Safari's console frame has no location, so it is never a frame parseFrame reads
|
|
84
|
+
if (seen === skip && CONSOLE_SAFARI.test(raw)) {
|
|
85
|
+
return CONSOLE_CALL_SITE;
|
|
86
|
+
}
|
|
66
87
|
continue;
|
|
67
88
|
}
|
|
68
89
|
if (seen++ < skip) {
|
|
69
90
|
continue;
|
|
70
91
|
}
|
|
71
|
-
return frame;
|
|
92
|
+
return frame.filename === CONSOLE_FILE_V8 || CONSOLE_FIREFOX.test(raw) ? CONSOLE_CALL_SITE : frame;
|
|
72
93
|
}
|
|
73
94
|
return NO_CALL_SITE;
|
|
74
95
|
}
|
|
@@ -86,4 +107,4 @@ function callSite(skip) {
|
|
|
86
107
|
}
|
|
87
108
|
}
|
|
88
109
|
|
|
89
|
-
export { NO_CALL_SITE, callSite, callSiteFromStack };
|
|
110
|
+
export { CONSOLE_CALL_SITE, NO_CALL_SITE, callSite, callSiteFromStack };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { TrackingStatus } from '../types.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* DNT counts only when not ignored; while it counts, tracking is NO_TRACKING (opt_in_status).
|
|
4
|
+
* Decided on every visit and never stored: storing it made one visit with DNT on look like the
|
|
5
|
+
* visitor's own choice, so tracking stayed off after DNT was turned off or ignore_do_not_track set.
|
|
6
|
+
*/
|
|
3
7
|
export declare function hasDoNotTrackEnabled(): boolean;
|
|
4
8
|
export declare function opt_in_status(): TrackingStatus;
|
|
5
9
|
export declare function shouldTrackOrSendData(): boolean;
|
package/dist/esm/core/consent.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
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.1 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
import { AP_TRACKING_STATUS } from './constants.js';
|
|
3
3
|
import { _ZAP } from './state.js';
|
|
4
4
|
import { Console } from './logger.js';
|
|
5
5
|
import { isEmpty, isSuccess } from './utils.js';
|
|
6
6
|
import { tracking_preference } from './storage.js';
|
|
7
|
-
import {
|
|
7
|
+
import { is_apptics_disabled, isDntOn } from './env.js';
|
|
8
8
|
import { hooks } from './hooks.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* DNT counts only when not ignored; while it counts, tracking is NO_TRACKING (opt_in_status).
|
|
12
|
+
* Decided on every visit and never stored: storing it made one visit with DNT on look like the
|
|
13
|
+
* visitor's own choice, so tracking stayed off after DNT was turned off or ignore_do_not_track set.
|
|
14
|
+
*/
|
|
11
15
|
function hasDoNotTrackEnabled() {
|
|
12
16
|
if (_ZAP._ignoreDnt) {
|
|
13
17
|
return false;
|
|
14
18
|
}
|
|
15
19
|
if (isDntOn()) {
|
|
16
|
-
Console.warn('hasDoNotTrackEnabled: DoNotTrack is enabled'); // no i18n
|
|
17
|
-
setTrackingStatus(AP_TRACKING_STATUS.NO_TRACKING);
|
|
18
|
-
Console.log('hasDoNotTrackEnabled: Setting tracking status to NO_TRACKING'); // no i18n
|
|
20
|
+
Console.warn('hasDoNotTrackEnabled: DoNotTrack is enabled, so nothing is tracked'); // no i18n
|
|
19
21
|
return true;
|
|
20
22
|
}
|
|
21
23
|
return false;
|
|
@@ -41,7 +43,7 @@ function shouldTrackOrSendData() {
|
|
|
41
43
|
*/
|
|
42
44
|
function canTrack(caller) {
|
|
43
45
|
if (!_ZAP._token) {
|
|
44
|
-
Console.warn('apptics.' + caller + ': You must call
|
|
46
|
+
Console.warn('apptics.' + caller + ': You must call Apptics.init() first'); // no i18n
|
|
45
47
|
return false;
|
|
46
48
|
}
|
|
47
49
|
if (is_apptics_disabled()) {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A screen_routes entry as init() keeps it, ready to match: a route pattern, or an exact path or a
|
|
3
|
+
* regular expression with the name it records.
|
|
4
|
+
*/
|
|
5
|
+
export type ScreenRouteRule = {
|
|
6
|
+
kind: 'pattern';
|
|
7
|
+
pattern: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'equals';
|
|
10
|
+
path: string;
|
|
11
|
+
name: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'regex';
|
|
14
|
+
regex: RegExp;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
1
17
|
export declare const AP_TRACKING_STATUS: Readonly<{
|
|
2
18
|
readonly USAGE_TRACKING_WITH_PII: 1;
|
|
3
19
|
readonly USAGE_TRACKING_WITHOUT_PII: 4;
|
|
@@ -117,7 +133,6 @@ export declare const AP_CONFIG: Readonly<{
|
|
|
117
133
|
debug: boolean;
|
|
118
134
|
track_by_default: true;
|
|
119
135
|
ignore_do_not_track: boolean;
|
|
120
|
-
remote_log: boolean;
|
|
121
136
|
/**
|
|
122
137
|
* Wrap XHR and fetch to record the app's API calls without it calling startTrackApi(). Off by
|
|
123
138
|
* default: the hostnames and paths of every request an app makes is a wider grant than events
|
|
@@ -130,15 +145,16 @@ export declare const AP_CONFIG: Readonly<{
|
|
|
130
145
|
*/
|
|
131
146
|
track_screen: boolean;
|
|
132
147
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
148
|
+
* How automatic screen tracking names a path, as init() keeps the config's screen_routes: route
|
|
149
|
+
* patterns (`/users/{id}/orders`, each id recorded as a star), exact paths and regular
|
|
150
|
+
* expressions with a name. Tried in order; a path none matches keeps its own name.
|
|
135
151
|
*/
|
|
136
|
-
|
|
152
|
+
screen_routes: ScreenRouteRule[];
|
|
137
153
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
154
|
+
* The feedback form's theme: 'light', 'dark', or 'auto' to follow the visitor's system setting.
|
|
155
|
+
* 'auto' by default.
|
|
140
156
|
*/
|
|
141
|
-
|
|
157
|
+
feedback_theme: "light" | "dark" | "auto";
|
|
142
158
|
/**
|
|
143
159
|
* How long a visit must last before its session is stored, in milliseconds. A shorter visit with
|
|
144
160
|
* nothing tracked in it is dropped: a bounce or a crawler is not a session. Anything tracked
|
|
@@ -187,7 +203,13 @@ export type ApConfig = {
|
|
|
187
203
|
* What init() must be given. Everything else the SDK needs — aaid, the portal and project ids that
|
|
188
204
|
* go in every url — comes back from app/addversion, which these four are enough to call.
|
|
189
205
|
*/
|
|
190
|
-
export declare const REQUIRED_CONFIG: readonly ["
|
|
206
|
+
export declare const REQUIRED_CONFIG: readonly ["base_url", "auth_key", "app_domain", "appversion"];
|
|
207
|
+
/**
|
|
208
|
+
* The init() keys and the names the SDK keeps them under inside (and in app_version_info, which
|
|
209
|
+
* already-visited browsers have stored): base_url is the host, auth_key the `zak` header, and
|
|
210
|
+
* app_domain the app's identifier.
|
|
211
|
+
*/
|
|
212
|
+
export declare const CONFIG_KEYS: Readonly<Record<string, string>>;
|
|
191
213
|
/**
|
|
192
214
|
* Paths with a `debug/` twin. The debug endpoints take the same body and answer with a request id
|
|
193
215
|
* and a link to the server-side logs for that request, which is how a payload is traced end to
|
|
@@ -207,6 +229,9 @@ export declare const RETRY_CAPABLE_PATHS: Readonly<Record<string, boolean>>;
|
|
|
207
229
|
* called before those ids are known, so it cannot carry them.
|
|
208
230
|
*/
|
|
209
231
|
export declare const PATHS_WITHOUT_ORG: Readonly<Record<string, boolean>>;
|
|
210
|
-
/**
|
|
211
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Earlier names of the init() keys: 2.0.0-beta's serviceUrl, zak and identifier, and the 1.x
|
|
234
|
+
* console snippet's base_domain and token. Still read, with a warning naming the key to use.
|
|
235
|
+
*/
|
|
236
|
+
export declare const RETIRED_CONFIG_NAMES: Readonly<Record<string, string>>;
|
|
212
237
|
export declare const BLOCKED_WS: readonly string[];
|