@zoho_apptics/apptics-js-sdk 2.0.0-beta.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +127 -16
- package/README.md +357 -215
- package/dist/apptics-pn-sw.js +3 -0
- package/dist/apptics-pn-sw.js.map +1 -0
- package/dist/apptics.esm.min.js +2 -2
- package/dist/apptics.esm.min.js.map +1 -1
- package/dist/apptics.min.js +2 -2
- package/dist/apptics.min.js.map +1 -1
- package/dist/chunks/batch-Axq9sTzR.min.js +3 -0
- package/dist/chunks/batch-Axq9sTzR.min.js.map +1 -0
- package/dist/chunks/lifecycle-Cvg78jN_.min.js +3 -0
- package/dist/chunks/lifecycle-Cvg78jN_.min.js.map +1 -0
- package/dist/chunks/send-DBpesydB.min.js +3 -0
- package/dist/chunks/send-DBpesydB.min.js.map +1 -0
- package/dist/chunks/transport-B21X39p4.min.js +3 -0
- package/dist/chunks/transport-B21X39p4.min.js.map +1 -0
- package/dist/cjs/core/attempts.js +1 -1
- package/dist/cjs/core/batch.js +4 -4
- package/dist/cjs/core/consent.d.ts +17 -4
- package/dist/cjs/core/consent.js +81 -14
- package/dist/cjs/core/console-call.d.ts +23 -0
- package/dist/cjs/core/console-call.js +63 -0
- package/dist/cjs/core/constants.d.ts +66 -17
- package/dist/cjs/core/constants.js +76 -19
- package/dist/cjs/core/db.js +31 -7
- package/dist/cjs/core/debug.d.ts +6 -4
- package/dist/cjs/core/debug.js +36 -12
- package/dist/cjs/core/env.d.ts +0 -3
- package/dist/cjs/core/env.js +1 -9
- package/dist/cjs/core/framework-id.d.ts +1 -1
- package/dist/cjs/core/framework-id.js +3 -3
- package/dist/cjs/core/guard.js +19 -4
- package/dist/cjs/core/hooks.d.ts +29 -0
- package/dist/cjs/core/hooks.js +12 -1
- package/dist/cjs/core/locks.js +1 -1
- package/dist/cjs/core/logger.js +1 -1
- package/dist/cjs/core/shield.d.ts +31 -0
- package/dist/cjs/core/shield.js +129 -0
- package/dist/cjs/core/state.d.ts +11 -5
- package/dist/cjs/core/state.js +4 -4
- package/dist/cjs/core/storage.d.ts +7 -0
- package/dist/cjs/core/storage.js +28 -9
- package/dist/cjs/core/stylesheet.js +1 -1
- package/dist/cjs/core/transport.d.ts +15 -4
- package/dist/cjs/core/transport.js +72 -25
- package/dist/cjs/core/utils.js +1 -1
- package/dist/cjs/core/validate.js +6 -5
- package/dist/cjs/device/appversion.d.ts +10 -1
- package/dist/cjs/device/appversion.js +26 -3
- package/dist/cjs/device/index.d.ts +17 -2
- package/dist/cjs/device/index.js +251 -35
- package/dist/cjs/engagement/api-rules.js +1 -1
- package/dist/cjs/engagement/auto-api.js +4 -3
- package/dist/cjs/engagement/auto-screen.js +10 -6
- package/dist/cjs/engagement/defined-events.d.ts +2 -3
- package/dist/cjs/engagement/defined-events.js +10 -16
- package/dist/cjs/engagement/send.js +7 -3
- package/dist/cjs/engagement/session.d.ts +17 -0
- package/dist/cjs/engagement/session.js +154 -23
- package/dist/cjs/engagement/track.d.ts +4 -4
- package/dist/cjs/engagement/track.js +23 -17
- package/dist/cjs/errors/send.js +2 -2
- package/dist/cjs/errors/track.d.ts +2 -1
- package/dist/cjs/errors/track.js +8 -5
- package/dist/cjs/feedback/controls.d.ts +36 -4
- package/dist/cjs/feedback/controls.js +302 -67
- package/dist/cjs/feedback/i18n/index.d.ts +31 -0
- package/dist/cjs/feedback/i18n/index.js +187 -0
- package/dist/cjs/feedback/i18n/strings.d.ts +9 -0
- package/dist/cjs/feedback/i18n/strings.js +8 -0
- package/dist/cjs/feedback/index.js +1 -1
- package/dist/cjs/feedback/logs.d.ts +3 -6
- package/dist/cjs/feedback/logs.js +12 -21
- package/dist/cjs/feedback/quartz.js +5 -2
- package/dist/cjs/feedback/send.d.ts +6 -3
- package/dist/cjs/feedback/send.js +59 -41
- package/dist/cjs/feedback/styles.js +2 -2
- package/dist/cjs/feedback/template.d.ts +4 -2
- package/dist/cjs/feedback/template.js +73 -44
- package/dist/cjs/feedback/ui.d.ts +47 -4
- package/dist/cjs/feedback/ui.js +351 -97
- package/dist/cjs/heatmap/send.d.ts +2 -0
- package/dist/cjs/heatmap/send.js +3 -5
- package/dist/cjs/heatmap/track.js +13 -9
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +55 -18
- package/dist/cjs/lifecycle.d.ts +13 -2
- package/dist/cjs/lifecycle.js +233 -118
- package/dist/cjs/pushnotification/display.d.ts +65 -0
- package/dist/cjs/pushnotification/display.js +112 -0
- package/dist/cjs/pushnotification/index.d.ts +20 -0
- package/dist/cjs/pushnotification/index.js +96 -0
- package/dist/cjs/pushnotification/kept-opens.d.ts +23 -0
- package/dist/cjs/pushnotification/kept-opens.js +64 -0
- package/dist/cjs/pushnotification/notify.d.ts +45 -0
- package/dist/cjs/pushnotification/notify.js +476 -0
- package/dist/cjs/pushnotification/payload.d.ts +65 -0
- package/dist/cjs/pushnotification/payload.js +279 -0
- package/dist/cjs/pushnotification/session.d.ts +46 -0
- package/dist/cjs/pushnotification/session.js +413 -0
- package/dist/cjs/pushnotification/stats.d.ts +45 -0
- package/dist/cjs/pushnotification/stats.js +244 -0
- package/dist/cjs/pushnotification/wms.d.ts +30 -0
- package/dist/cjs/pushnotification/wms.js +374 -0
- package/dist/cjs/remoteconfig/country.js +1 -1
- package/dist/cjs/remoteconfig/custom.js +4 -3
- package/dist/cjs/remoteconfig/evaluate.js +1 -1
- package/dist/cjs/remoteconfig/fetch.d.ts +17 -10
- package/dist/cjs/remoteconfig/fetch.js +146 -32
- package/dist/cjs/remoteconfig/index.d.ts +9 -5
- package/dist/cjs/remoteconfig/index.js +24 -32
- package/dist/cjs/remoteconfig/store.d.ts +15 -7
- package/dist/cjs/remoteconfig/store.js +68 -35
- package/dist/cjs/remoteconfig/tz-countries.js +1 -1
- package/dist/cjs/{core → remotelog}/callsite.d.ts +5 -4
- package/dist/cjs/{core → remotelog}/callsite.js +6 -5
- package/dist/cjs/remotelog/gate.js +1 -1
- package/dist/cjs/remotelog/logger.js +2 -2
- package/dist/cjs/remotelog/send.js +6 -5
- package/dist/cjs/remotelogger/index.js +1 -1
- package/dist/cjs/scheduler.d.ts +3 -1
- package/dist/cjs/scheduler.js +34 -25
- package/dist/cjs/sw/apptics-pn-sw.d.ts +83 -0
- package/dist/cjs/sw/timers.d.ts +44 -0
- package/dist/cjs/types.d.ts +90 -29
- package/dist/cjs/user/index.d.ts +7 -0
- package/dist/cjs/user/index.js +25 -3
- package/dist/esm/core/attempts.js +1 -1
- package/dist/esm/core/batch.js +4 -4
- package/dist/esm/core/consent.d.ts +17 -4
- package/dist/esm/core/consent.js +84 -20
- package/dist/esm/core/console-call.d.ts +23 -0
- package/dist/esm/core/console-call.js +60 -0
- package/dist/esm/core/constants.d.ts +66 -17
- package/dist/esm/core/constants.js +73 -20
- package/dist/esm/core/db.js +31 -7
- package/dist/esm/core/debug.d.ts +6 -4
- package/dist/esm/core/debug.js +37 -13
- package/dist/esm/core/env.d.ts +0 -3
- package/dist/esm/core/env.js +2 -9
- package/dist/esm/core/framework-id.d.ts +1 -1
- package/dist/esm/core/framework-id.js +3 -3
- package/dist/esm/core/guard.js +19 -4
- package/dist/esm/core/hooks.d.ts +29 -0
- package/dist/esm/core/hooks.js +12 -1
- package/dist/esm/core/locks.js +1 -1
- package/dist/esm/core/logger.js +1 -1
- package/dist/esm/core/shield.d.ts +31 -0
- package/dist/esm/core/shield.js +119 -0
- package/dist/esm/core/state.d.ts +11 -5
- package/dist/esm/core/state.js +4 -4
- package/dist/esm/core/storage.d.ts +7 -0
- package/dist/esm/core/storage.js +28 -11
- package/dist/esm/core/stylesheet.js +1 -1
- package/dist/esm/core/transport.d.ts +15 -4
- package/dist/esm/core/transport.js +73 -28
- package/dist/esm/core/utils.js +1 -1
- package/dist/esm/core/validate.js +6 -5
- package/dist/esm/device/appversion.d.ts +10 -1
- package/dist/esm/device/appversion.js +26 -4
- package/dist/esm/device/index.d.ts +17 -2
- package/dist/esm/device/index.js +255 -42
- package/dist/esm/engagement/api-rules.js +1 -1
- package/dist/esm/engagement/auto-api.js +4 -3
- package/dist/esm/engagement/auto-screen.js +10 -6
- package/dist/esm/engagement/defined-events.d.ts +2 -3
- package/dist/esm/engagement/defined-events.js +10 -16
- package/dist/esm/engagement/send.js +7 -3
- package/dist/esm/engagement/session.d.ts +17 -0
- package/dist/esm/engagement/session.js +152 -24
- package/dist/esm/engagement/track.d.ts +4 -4
- package/dist/esm/engagement/track.js +24 -18
- package/dist/esm/errors/send.js +2 -2
- package/dist/esm/errors/track.d.ts +2 -1
- package/dist/esm/errors/track.js +8 -5
- package/dist/esm/feedback/controls.d.ts +36 -4
- package/dist/esm/feedback/controls.js +298 -68
- package/dist/esm/feedback/i18n/index.d.ts +31 -0
- package/dist/esm/feedback/i18n/index.js +178 -0
- package/dist/esm/feedback/i18n/strings.d.ts +9 -0
- package/dist/esm/feedback/i18n/strings.js +4 -0
- package/dist/esm/feedback/index.js +1 -1
- package/dist/esm/feedback/logs.d.ts +3 -6
- package/dist/esm/feedback/logs.js +12 -21
- package/dist/esm/feedback/quartz.js +5 -2
- package/dist/esm/feedback/send.d.ts +6 -3
- package/dist/esm/feedback/send.js +61 -44
- package/dist/esm/feedback/styles.js +2 -2
- package/dist/esm/feedback/template.d.ts +4 -2
- package/dist/esm/feedback/template.js +73 -44
- package/dist/esm/feedback/ui.d.ts +47 -4
- package/dist/esm/feedback/ui.js +353 -99
- package/dist/esm/heatmap/send.d.ts +2 -0
- package/dist/esm/heatmap/send.js +3 -5
- package/dist/esm/heatmap/track.js +13 -9
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +58 -21
- package/dist/esm/lifecycle.d.ts +13 -2
- package/dist/esm/lifecycle.js +238 -125
- package/dist/esm/pushnotification/display.d.ts +65 -0
- package/dist/esm/pushnotification/display.js +95 -0
- package/dist/esm/pushnotification/index.d.ts +20 -0
- package/dist/esm/pushnotification/index.js +91 -0
- package/dist/esm/pushnotification/kept-opens.d.ts +23 -0
- package/dist/esm/pushnotification/kept-opens.js +62 -0
- package/dist/esm/pushnotification/notify.d.ts +45 -0
- package/dist/esm/pushnotification/notify.js +469 -0
- package/dist/esm/pushnotification/payload.d.ts +65 -0
- package/dist/esm/pushnotification/payload.js +272 -0
- package/dist/esm/pushnotification/session.d.ts +46 -0
- package/dist/esm/pushnotification/session.js +402 -0
- package/dist/esm/pushnotification/stats.d.ts +45 -0
- package/dist/esm/pushnotification/stats.js +238 -0
- package/dist/esm/pushnotification/wms.d.ts +30 -0
- package/dist/esm/pushnotification/wms.js +368 -0
- package/dist/esm/remoteconfig/country.js +1 -1
- package/dist/esm/remoteconfig/custom.js +4 -3
- package/dist/esm/remoteconfig/evaluate.js +1 -1
- package/dist/esm/remoteconfig/fetch.d.ts +17 -10
- package/dist/esm/remoteconfig/fetch.js +147 -33
- package/dist/esm/remoteconfig/index.d.ts +9 -5
- package/dist/esm/remoteconfig/index.js +24 -32
- package/dist/esm/remoteconfig/store.d.ts +15 -7
- package/dist/esm/remoteconfig/store.js +68 -36
- package/dist/esm/remoteconfig/tz-countries.js +1 -1
- package/dist/esm/{core → remotelog}/callsite.d.ts +5 -4
- package/dist/esm/{core → remotelog}/callsite.js +6 -5
- package/dist/esm/remotelog/gate.js +1 -1
- package/dist/esm/remotelog/logger.js +2 -2
- package/dist/esm/remotelog/send.js +6 -5
- package/dist/esm/remotelogger/index.js +1 -1
- package/dist/esm/scheduler.d.ts +3 -1
- package/dist/esm/scheduler.js +35 -27
- package/dist/esm/sw/apptics-pn-sw.d.ts +83 -0
- package/dist/esm/sw/timers.d.ts +44 -0
- package/dist/esm/types.d.ts +90 -29
- package/dist/esm/user/index.d.ts +7 -0
- package/dist/esm/user/index.js +26 -5
- package/dist/feedback.esm.min.js +2 -2
- package/dist/feedback.esm.min.js.map +1 -1
- package/dist/pushnotification.esm.min.js +3 -0
- package/dist/pushnotification.esm.min.js.map +1 -0
- package/dist/remoteconfig.esm.min.js +3 -0
- package/dist/remoteconfig.esm.min.js.map +1 -0
- package/dist/remotelogger.esm.min.js +3 -0
- package/dist/remotelogger.esm.min.js.map +1 -0
- package/package.json +17 -3
- package/dist/chunks/lifecycle-VYr43KcB.min.js +0 -3
- package/dist/chunks/lifecycle-VYr43KcB.min.js.map +0 -1
- package/dist/cjs/auto-init.d.ts +0 -8
- package/dist/cjs/auto-init.js +0 -32
- package/dist/esm/auto-init.d.ts +0 -8
- package/dist/esm/auto-init.js +0 -29
|
@@ -1,11 +1,40 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The visitor's tracking status: what setTrackingStatus takes and getTrackingStatus returns. Each
|
|
6
|
+
* value is its own name, so an app never deals in the numbers it is stored as (TRACKING_STATUS_CODE).
|
|
7
|
+
*/
|
|
4
8
|
const AP_TRACKING_STATUS = Object.freeze({
|
|
9
|
+
USAGE_TRACKING_WITH_PII: 'USAGE_TRACKING_WITH_PII', // no i18n
|
|
10
|
+
USAGE_TRACKING_WITHOUT_PII: 'USAGE_TRACKING_WITHOUT_PII', // no i18n
|
|
11
|
+
ANONYMOUS: 'ANONYMOUS', // no i18n
|
|
12
|
+
NO_TRACKING: 'NO_TRACKING', // no i18n
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* The number each tracking status is stored as, in trackinfo's tracking_status, and the number an
|
|
16
|
+
* app passed to setTrackingStatus before the status had names. These are the SDK's own values, not
|
|
17
|
+
* the server's device preference: deviceStatusFor() turns one into the devicestatus device/add
|
|
18
|
+
* sends. ANONYMOUS is 7, past the server's 1–6, because 4 is already stored by browsers that chose
|
|
19
|
+
* without PII and must keep meaning that.
|
|
20
|
+
*/
|
|
21
|
+
const TRACKING_STATUS_CODE = Object.freeze({
|
|
5
22
|
USAGE_TRACKING_WITH_PII: 1,
|
|
6
23
|
USAGE_TRACKING_WITHOUT_PII: 4,
|
|
24
|
+
ANONYMOUS: 7,
|
|
7
25
|
NO_TRACKING: -1,
|
|
8
26
|
});
|
|
27
|
+
/**
|
|
28
|
+
* The server's device preferences, devicestatus on device/add. With and without PII are both
|
|
29
|
+
* "all tracking with PII" (1): without PII only means no user is attached to the data. ANONYMOUS
|
|
30
|
+
* is "all tracking, anonymous" (4). The usage-only and crash-only preferences (2, 3, 5, 6) have no
|
|
31
|
+
* SDK status yet.
|
|
32
|
+
*/
|
|
33
|
+
const AP_DEVICE_STATUS = Object.freeze({
|
|
34
|
+
ALL_WITH_PII: 1,
|
|
35
|
+
ALL_ANONYMOUS: 4,
|
|
36
|
+
TRACKING_OFF: -1,
|
|
37
|
+
});
|
|
9
38
|
const AP_FEEDBACK_TYPE = Object.freeze({
|
|
10
39
|
BUG: 0,
|
|
11
40
|
FEEDBACK: 1,
|
|
@@ -40,6 +69,10 @@ const DEFAULT_API_PATHS = Object.freeze({
|
|
|
40
69
|
// v2 replaced console/addlog: one call now carries a batch of lines, not one line
|
|
41
70
|
consolelog: 'log/add', // no i18n
|
|
42
71
|
heatmap: 'heatmap/add', // no i18n
|
|
72
|
+
// registers this browser for push messages over WMS (status=register|unregister)
|
|
73
|
+
pushnotification: 'pushnotification/device', // no i18n
|
|
74
|
+
// push notification stats: received, opened, conversion
|
|
75
|
+
pnstats: 'channel/add', // no i18n
|
|
43
76
|
});
|
|
44
77
|
/**
|
|
45
78
|
* Which API version each path lives under.
|
|
@@ -61,6 +94,8 @@ const API_VERSIONS = Object.freeze({
|
|
|
61
94
|
getupdates: 'v2', // no i18n
|
|
62
95
|
consolelog: 'v2', // no i18n
|
|
63
96
|
heatmap: 'v2', // no i18n
|
|
97
|
+
pushnotification: 'v2', // no i18n
|
|
98
|
+
pnstats: 'v2', // no i18n
|
|
64
99
|
});
|
|
65
100
|
/**
|
|
66
101
|
* The SDK subsystem a remote log line is about, as console/addlog's `module` param.
|
|
@@ -85,9 +120,18 @@ const SDK_MODULE = Object.freeze({
|
|
|
85
120
|
* authority. Where they disagree, getsdkconfig wins.
|
|
86
121
|
*/
|
|
87
122
|
REMOTE_CONFIG: '2', // no i18n
|
|
123
|
+
EVENT: '5', // no i18n
|
|
124
|
+
API: '6', // no i18n
|
|
125
|
+
SCREEN: '10', // no i18n
|
|
88
126
|
SESSION: '11', // no i18n
|
|
89
127
|
FEEDBACK: '12', // no i18n
|
|
90
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Push notification over WMS. getsdkconfig answers with the `wms` block only when it is asked
|
|
130
|
+
* for this id in `moduleids` and push is on for the app.
|
|
131
|
+
*/
|
|
132
|
+
PUSH_NOTIFICATION: '16', // no i18n
|
|
133
|
+
/** Uncaught and reported JavaScript errors: js_error. 13 (crash) and 14 (nonfatal) are the native SDKs'. */
|
|
134
|
+
JS_ERROR: '15', // no i18n
|
|
91
135
|
REMOTE_LOGGER: '17', // no i18n
|
|
92
136
|
HEATMAP: '18', // no i18n
|
|
93
137
|
});
|
|
@@ -103,9 +147,10 @@ const LOG_FILENAME_MAX = 100;
|
|
|
103
147
|
*/
|
|
104
148
|
const DEVICE_NAME_MAX = 100;
|
|
105
149
|
/**
|
|
106
|
-
* The `level`
|
|
107
|
-
*
|
|
108
|
-
*
|
|
150
|
+
* The `level` a remote log line goes out with when it has none of its own: 3, Info. Every line an
|
|
151
|
+
* app writes with AppticsLogger carries its level (1 verbose to 5 error, see LOG_LEVEL in
|
|
152
|
+
* remotelog/logger.ts). Only a line an older SDK stored, when the SDK logged its own failures
|
|
153
|
+
* there, has none; it is sent as Info rather than having the batch refused for a missing level.
|
|
109
154
|
*/
|
|
110
155
|
const REMOTE_LOG_LEVEL = 3;
|
|
111
156
|
/**
|
|
@@ -115,30 +160,25 @@ const REMOTE_LOG_LEVEL = 3;
|
|
|
115
160
|
* enough that a tab left open overnight is not still sending every call to its debug twin.
|
|
116
161
|
*/
|
|
117
162
|
const DEBUG_IDLE_MS = 60 * 60 * 1000;
|
|
118
|
-
/**
|
|
163
|
+
/** Minutes a tab can be inactive before its session ends. Lives on state, not in _config, but defaults here. */
|
|
119
164
|
const DEFAULT_INACTIVE_MINUTES = 30;
|
|
165
|
+
/**
|
|
166
|
+
* The range both session timings may be set in: min_session_duration (how long a visit must last
|
|
167
|
+
* before its session is recorded) and max_session_duration (how long a tab may be inactive before its
|
|
168
|
+
* session ends). 5 seconds to 30 minutes; a value outside it is ignored and the default kept.
|
|
169
|
+
*/
|
|
170
|
+
const SESSION_TIMING_MIN_MS = 5 * 1000;
|
|
171
|
+
const SESSION_TIMING_MAX_MS = 30 * 60 * 1000;
|
|
120
172
|
/** Global defaults. `state._config` holds a mutable copy per init. */
|
|
121
173
|
const AP_CONFIG = Object.freeze({
|
|
122
174
|
// the version is per path (API_VERSIONS); this is only the part before it
|
|
123
175
|
endpoint: '/sdk/web/', // no i18n
|
|
124
176
|
method: 'POST', // no i18n
|
|
125
|
-
transport: 'XHR', // no i18n
|
|
126
|
-
track_link_timeout: 300,
|
|
127
|
-
cookie_expiration_days: 365,
|
|
128
|
-
storage_type: 'localStorage', // no i18n
|
|
129
|
-
enable_batch_requests: true,
|
|
130
177
|
batch_size: 50,
|
|
131
178
|
batch_flush_interval: 30000,
|
|
132
|
-
getupdates_interval: 120000, // 2 minutes in milliseconds
|
|
179
|
+
getupdates_interval: 120000, // 2 minutes in milliseconds, when getsdkconfig gives no next_check_after
|
|
133
180
|
batch_request_timeout: 7,
|
|
134
|
-
auto_starts_batch: true,
|
|
135
|
-
mode: 1,
|
|
136
|
-
default_group_name: 'default', // no i18n
|
|
137
|
-
default_optin_status: AP_TRACKING_STATUS.USAGE_TRACKING_WITHOUT_PII,
|
|
138
|
-
enable_pageview_tracking: false,
|
|
139
|
-
save_referrer: true,
|
|
140
181
|
debug: false,
|
|
141
|
-
track_by_default: true,
|
|
142
182
|
ignore_do_not_track: false,
|
|
143
183
|
/**
|
|
144
184
|
* Wrap XHR and fetch to record the app's API calls without it calling startTrackApi(). Off by
|
|
@@ -151,6 +191,16 @@ const AP_CONFIG = Object.freeze({
|
|
|
151
191
|
* default; the app's own inScreen() during a navigation replaces that navigation's view.
|
|
152
192
|
*/
|
|
153
193
|
track_screen: true,
|
|
194
|
+
/**
|
|
195
|
+
* Record uncaught errors and unhandled promise rejections, from the window's `error` and
|
|
196
|
+
* `unhandledrejection` events. On by default; AppticsError.setErrorTracking() switches it later.
|
|
197
|
+
*/
|
|
198
|
+
track_error: true,
|
|
199
|
+
/**
|
|
200
|
+
* Record clicks on elements tagged `apeventaction` (or `data-apeventaction`) as events. On by
|
|
201
|
+
* default; AppticsEvent.setClickTracking() switches it later.
|
|
202
|
+
*/
|
|
203
|
+
track_click: true,
|
|
154
204
|
/**
|
|
155
205
|
* How automatic screen tracking names a path, as init() keeps the config's screen_routes: route
|
|
156
206
|
* patterns (`/users/{id}/orders`, each id recorded as a star), exact paths and regular
|
|
@@ -189,6 +239,7 @@ const AP_CONFIG = Object.freeze({
|
|
|
189
239
|
* debug stream is no use to whoever is reading it.
|
|
190
240
|
*/
|
|
191
241
|
device_name: '',
|
|
242
|
+
/** Path of the site's service worker for push notifications (it imports apptics-pn-sw.js); '' for none. */
|
|
192
243
|
/**
|
|
193
244
|
* Most heatmap records one visit may produce. Clicks are cheap, but a page that scrolls a lot
|
|
194
245
|
* can produce them faster than they are sent, and an unbounded queue is a memory leak on a tab
|
|
@@ -244,6 +295,8 @@ const RETRY_CAPABLE_PATHS = Object.freeze({
|
|
|
244
295
|
consolelog: true, // no i18n
|
|
245
296
|
feedback: true, // no i18n
|
|
246
297
|
getupdates: true, // no i18n
|
|
298
|
+
pushnotification: true, // no i18n
|
|
299
|
+
pnstats: true, // no i18n
|
|
247
300
|
});
|
|
248
301
|
/**
|
|
249
302
|
* Paths that live directly under the version, with no org and project segments. app/addversion is
|
|
@@ -294,6 +347,7 @@ const BLOCKED_WS = Object.freeze([
|
|
|
294
347
|
exports.API_VERSIONS = API_VERSIONS;
|
|
295
348
|
exports.AP_CONFIG = AP_CONFIG;
|
|
296
349
|
exports.AP_CONSTANTS = AP_CONSTANTS;
|
|
350
|
+
exports.AP_DEVICE_STATUS = AP_DEVICE_STATUS;
|
|
297
351
|
exports.AP_FEEDBACK_TYPE = AP_FEEDBACK_TYPE;
|
|
298
352
|
exports.AP_LOG_MODULE = AP_LOG_MODULE;
|
|
299
353
|
exports.AP_TRACKING_STATUS = AP_TRACKING_STATUS;
|
|
@@ -313,3 +367,6 @@ exports.REQUIRED_CONFIG = REQUIRED_CONFIG;
|
|
|
313
367
|
exports.RETIRED_CONFIG_NAMES = RETIRED_CONFIG_NAMES;
|
|
314
368
|
exports.RETRY_CAPABLE_PATHS = RETRY_CAPABLE_PATHS;
|
|
315
369
|
exports.SDK_MODULE = SDK_MODULE;
|
|
370
|
+
exports.SESSION_TIMING_MAX_MS = SESSION_TIMING_MAX_MS;
|
|
371
|
+
exports.SESSION_TIMING_MIN_MS = SESSION_TIMING_MIN_MS;
|
|
372
|
+
exports.TRACKING_STATUS_CODE = TRACKING_STATUS_CODE;
|
package/dist/cjs/core/db.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var logger = require('./logger.js');
|
|
5
5
|
var utils = require('./utils.js');
|
|
6
|
+
var shield = require('./shield.js');
|
|
6
7
|
|
|
7
8
|
const DB_NAME = 'apptics'; // no i18n
|
|
8
9
|
// 3 added the heatmaps store. 4 renamed: each record's order key `seq` to `queue`, the logs store
|
|
@@ -189,12 +190,33 @@ function recordType(storeName, item) {
|
|
|
189
190
|
function putRecord(store, item, keepExisting) {
|
|
190
191
|
const id = String(item.id);
|
|
191
192
|
const lookup = store.get(id);
|
|
192
|
-
lookup.onsuccess = function () {
|
|
193
|
+
lookup.onsuccess = inTransaction(store.transaction, function () {
|
|
193
194
|
const existing = lookup.result;
|
|
194
195
|
if (existing && keepExisting) {
|
|
195
196
|
return;
|
|
196
197
|
}
|
|
197
198
|
store.put({ id: id, queue: existing ? existing.queue : nextQueue(), type: recordType(store.name, item), item: item });
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* An IndexedDB callback that never throws into the page (core/shield.ts). A throw in one aborts its
|
|
203
|
+
* transaction, which is how its caller hears that the write failed; that is kept, by aborting it here.
|
|
204
|
+
*/
|
|
205
|
+
function inTransaction(tx, fn) {
|
|
206
|
+
return function () {
|
|
207
|
+
try {
|
|
208
|
+
fn();
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
shield.sdkFailed('storage', err); // no i18n
|
|
212
|
+
try {
|
|
213
|
+
if (tx)
|
|
214
|
+
tx.abort();
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
// already finished: nothing left to undo
|
|
218
|
+
}
|
|
219
|
+
}
|
|
198
220
|
};
|
|
199
221
|
}
|
|
200
222
|
/** Our stores, as created by onupgradeneeded. */
|
|
@@ -255,7 +277,9 @@ function openOnce(factory, timeoutMs) {
|
|
|
255
277
|
return;
|
|
256
278
|
}
|
|
257
279
|
req.onupgradeneeded = function () {
|
|
258
|
-
|
|
280
|
+
inTransaction(req.transaction, function () {
|
|
281
|
+
upgrade(req.result, req.transaction);
|
|
282
|
+
})();
|
|
259
283
|
};
|
|
260
284
|
req.onsuccess = function () {
|
|
261
285
|
if (settled) {
|
|
@@ -333,7 +357,7 @@ function upgrade(db, tx) {
|
|
|
333
357
|
/** Calls `each` for every record of `store`, then `done`, inside the transaction `store` is in. */
|
|
334
358
|
function eachRecord(store, each, done) {
|
|
335
359
|
const req = store.openCursor();
|
|
336
|
-
req.onsuccess = function () {
|
|
360
|
+
req.onsuccess = inTransaction(store.transaction, function () {
|
|
337
361
|
const cursor = req.result;
|
|
338
362
|
if (!cursor) {
|
|
339
363
|
if (done)
|
|
@@ -342,7 +366,7 @@ function eachRecord(store, each, done) {
|
|
|
342
366
|
}
|
|
343
367
|
each(cursor.value, cursor);
|
|
344
368
|
cursor.continue();
|
|
345
|
-
};
|
|
369
|
+
});
|
|
346
370
|
}
|
|
347
371
|
/** A version 3 record under version 4's names: `queue` for `seq`, and the feedback types renamed. */
|
|
348
372
|
function renamedRecord(record, feedback, storeName) {
|
|
@@ -408,11 +432,11 @@ function createIndexedDBBackend(db) {
|
|
|
408
432
|
const settingsStore = tx.objectStore('settings'); // no i18n
|
|
409
433
|
Object.keys(settings).forEach(function (key) {
|
|
410
434
|
const lookup = settingsStore.get(key);
|
|
411
|
-
lookup.onsuccess = function () {
|
|
435
|
+
lookup.onsuccess = inTransaction(tx, function () {
|
|
412
436
|
if (lookup.result === undefined) {
|
|
413
437
|
settingsStore.put(settings[key], key);
|
|
414
438
|
}
|
|
415
|
-
};
|
|
439
|
+
});
|
|
416
440
|
});
|
|
417
441
|
QUEUES.forEach(function (name) {
|
|
418
442
|
const objectStore = tx.objectStore(name);
|
package/dist/cjs/core/debug.d.ts
CHANGED
|
@@ -13,10 +13,12 @@ export declare function noteDebugActivity(): void;
|
|
|
13
13
|
export declare function expireDebugIfIdle(): void;
|
|
14
14
|
/**
|
|
15
15
|
* Turns debug mode on, at any time: before init(), during start-up or while the SDK runs. The
|
|
16
|
-
* choice holds
|
|
16
|
+
* choice holds through init() and reset() for the rest of the page's life. Only from the console.
|
|
17
17
|
*/
|
|
18
18
|
export declare function enableDebug(): void;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Turns debug mode off, at any time, holding as enableDebug() does. Only from the console.
|
|
21
|
+
*/
|
|
20
22
|
export declare function disableDebug(): void;
|
|
21
|
-
/** What init() applies
|
|
22
|
-
export declare function applyDebugConfig(
|
|
23
|
+
/** What init() applies: off, unless enableDebug() or disableDebug() already chose. */
|
|
24
|
+
export declare function applyDebugConfig(): void;
|
package/dist/cjs/core/debug.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var constants = require('./constants.js');
|
|
5
5
|
var state = require('./state.js');
|
|
6
6
|
var logger = require('./logger.js');
|
|
7
|
+
var consoleCall = require('./console-call.js');
|
|
7
8
|
var utils = require('./utils.js');
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -16,8 +17,8 @@ var utils = require('./utils.js');
|
|
|
16
17
|
* not a deliberate switch-off. So the SDK closes it: an hour with nothing tracked turns debug
|
|
17
18
|
* back off by itself, and anything tracked pushes that hour out again.
|
|
18
19
|
*
|
|
19
|
-
* It lives in core because every send asks it:
|
|
20
|
-
*
|
|
20
|
+
* It lives in core because every send asks it: enableDebug(), typed in the browser console, is
|
|
21
|
+
* the only way to turn the twins on, and that alone must expire.
|
|
21
22
|
*/
|
|
22
23
|
/** Whether debug mode is on right now, idle hour included. */
|
|
23
24
|
function debugEnabled() {
|
|
@@ -50,10 +51,9 @@ function expireDebugIfIdle() {
|
|
|
50
51
|
setDebug(false);
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
|
-
* The
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* has chosen.
|
|
54
|
+
* The choice made in the console, by enableDebug() or disableDebug(): before init() runs or while
|
|
55
|
+
* the SDK is running, and an init() or reset() that comes after doesn't switch it back. null until
|
|
56
|
+
* one is called.
|
|
57
57
|
*/
|
|
58
58
|
var chosen = null;
|
|
59
59
|
/** Turning it on starts the idle hour; turning it off clears it, so the next on gets a whole hour. */
|
|
@@ -62,22 +62,46 @@ function setDebug(on) {
|
|
|
62
62
|
state._ZAP._debugUntil = on ? utils.nowMs() + constants.DEBUG_IDLE_MS : 0;
|
|
63
63
|
logger.Console.log('apptics: debug mode ' + (on ? 'on' : 'off')); // no i18n
|
|
64
64
|
}
|
|
65
|
+
/** The calls already refused for coming from code: said once per page each, not once per call. */
|
|
66
|
+
var refusedSaid = {};
|
|
67
|
+
/**
|
|
68
|
+
* Whether `call` was typed into the browser console. A call from the page's code is ignored and
|
|
69
|
+
* said once, debug or not, so a debug switch left in an app's code does nothing in production.
|
|
70
|
+
*/
|
|
71
|
+
function fromConsole(call) {
|
|
72
|
+
if (consoleCall.calledFromConsole()) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
if (!refusedSaid[call]) {
|
|
76
|
+
refusedSaid[call] = true;
|
|
77
|
+
logger.warnAlways('apptics: ' + call + '() works only when typed in the browser console; this call from code is ignored'); // no i18n
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
65
81
|
/**
|
|
66
82
|
* Turns debug mode on, at any time: before init(), during start-up or while the SDK runs. The
|
|
67
|
-
* choice holds
|
|
83
|
+
* choice holds through init() and reset() for the rest of the page's life. Only from the console.
|
|
68
84
|
*/
|
|
69
85
|
function enableDebug() {
|
|
86
|
+
if (!fromConsole('Apptics.enableDebug')) { // no i18n
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
70
89
|
chosen = true;
|
|
71
90
|
setDebug(true);
|
|
72
91
|
}
|
|
73
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Turns debug mode off, at any time, holding as enableDebug() does. Only from the console.
|
|
94
|
+
*/
|
|
74
95
|
function disableDebug() {
|
|
96
|
+
if (!fromConsole('Apptics.disableDebug')) { // no i18n
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
75
99
|
chosen = false;
|
|
76
100
|
setDebug(false);
|
|
77
101
|
}
|
|
78
|
-
/** What init() applies
|
|
79
|
-
function applyDebugConfig(
|
|
80
|
-
setDebug(chosen
|
|
102
|
+
/** What init() applies: off, unless enableDebug() or disableDebug() already chose. */
|
|
103
|
+
function applyDebugConfig() {
|
|
104
|
+
setDebug(chosen === true);
|
|
81
105
|
}
|
|
82
106
|
|
|
83
107
|
exports.applyDebugConfig = applyDebugConfig;
|
package/dist/cjs/core/env.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AppticsConfig } from '../types.js';
|
|
2
1
|
export declare function isBlockedWS(ua: string): boolean;
|
|
3
2
|
/** Device RAM as the API wants it ("4 GB"). Chromium only; empty elsewhere. */
|
|
4
3
|
export declare function getRam(): string;
|
|
@@ -24,5 +23,3 @@ export declare function getTimeZone(): string;
|
|
|
24
23
|
export declare function is_apptics_disabled(): boolean;
|
|
25
24
|
/** Pure DNT check (no side effects). consent.hasDoNotTrackEnabled() applies NO_TRACKING. */
|
|
26
25
|
export declare function isDntOn(): boolean;
|
|
27
|
-
/** The console snippet's config (window.appticssettings._defaultoptions), if the page defines one. */
|
|
28
|
-
export declare function getSnippetOptions(): AppticsConfig | undefined;
|
package/dist/cjs/core/env.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var constants = require('./constants.js');
|
|
@@ -242,13 +242,6 @@ function isDntOn() {
|
|
|
242
242
|
return utils.includes(dntValues, dntValue);
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
/** The console snippet's config (window.appticssettings._defaultoptions), if the page defines one. */
|
|
246
|
-
function getSnippetOptions() {
|
|
247
|
-
if (typeof window === 'undefined' || !window.appticssettings) { // no i18n
|
|
248
|
-
return undefined;
|
|
249
|
-
}
|
|
250
|
-
return window.appticssettings._defaultoptions;
|
|
251
|
-
}
|
|
252
245
|
|
|
253
246
|
exports.getBatteryPercent = getBatteryPercent;
|
|
254
247
|
exports.getBrowser = getBrowser;
|
|
@@ -260,7 +253,6 @@ exports.getOS = getOS;
|
|
|
260
253
|
exports.getOrientation = getOrientation;
|
|
261
254
|
exports.getRam = getRam;
|
|
262
255
|
exports.getReferringURL = getReferringURL;
|
|
263
|
-
exports.getSnippetOptions = getSnippetOptions;
|
|
264
256
|
exports.getTimeZone = getTimeZone;
|
|
265
257
|
exports.isBlockedWS = isBlockedWS;
|
|
266
258
|
exports.isDntOn = isDntOn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const FRAMEWORK_ID =
|
|
1
|
+
export declare const FRAMEWORK_ID = 6012;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
// Generated by scripts/register-version.mjs — do not edit by hand.
|
|
5
5
|
// The framework id Apptics issued for this SDK, from POST /sdk/web/v1/framework/addversion
|
|
6
|
-
// (version 2.0.0
|
|
7
|
-
const FRAMEWORK_ID =
|
|
6
|
+
// (version 2.0.0, platform Browser). Regenerated on every npm pack.
|
|
7
|
+
const FRAMEWORK_ID = 6012;
|
|
8
8
|
|
|
9
9
|
exports.FRAMEWORK_ID = FRAMEWORK_ID;
|
package/dist/cjs/core/guard.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var state = require('./state.js');
|
|
5
5
|
var logger = require('./logger.js');
|
|
6
|
+
var shield = require('./shield.js');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Calls that run immediately while storage is loading. Everything else is buffered and replayed in order.
|
|
@@ -18,9 +19,14 @@ const RUN_BEFORE_READY = {
|
|
|
18
19
|
// a switch, and a call that hands back the id endTrackApi needs: neither can wait in a queue
|
|
19
20
|
'AppticsApi.configure': true, 'AppticsApi.startTrackApi': true,
|
|
20
21
|
// these wait for ready() themselves, and a queued call would hand back undefined, not a Promise
|
|
21
|
-
'AppticsRemoteConfig.
|
|
22
|
+
'AppticsRemoteConfig.fetchValues': true,
|
|
22
23
|
'AppticsRemoteConfig.setCustomConditionValue': true,
|
|
23
24
|
'Apptics.enableDebug': true, 'Apptics.disableDebug': true,
|
|
25
|
+
// these wait for start-up themselves, for the same reason as remote config's
|
|
26
|
+
'AppticsPushNotification.setEnabled': true,
|
|
27
|
+
'AppticsPushNotification.isEnabled': true,
|
|
28
|
+
'AppticsPushNotification.requestPermission': true,
|
|
29
|
+
// 'AppticsPushNotification.onNotificationClick': true, (held back; see pushnotification/index.ts)
|
|
24
30
|
};
|
|
25
31
|
/**
|
|
26
32
|
* Calls that record or send something, and so are lost when the SDK hasn't started. Calls that only
|
|
@@ -31,7 +37,7 @@ const RUN_BEFORE_READY = {
|
|
|
31
37
|
const NEEDS_INIT = {
|
|
32
38
|
'AppticsEvent.addEvent': true, 'AppticsScreen.inScreen': true, 'AppticsScreen.outScreen': true,
|
|
33
39
|
'AppticsApi.endTrackApi': true, 'AppticsError.trackError': true, 'AppticsUser.setUser': true,
|
|
34
|
-
'Apptics.flush': true, AppticsLogger: true, 'AppticsFeedback.sendFeedback': true,
|
|
40
|
+
'Apptics.flush': true, AppticsLogger: true, 'AppticsFeedback.sendFeedback': true,
|
|
35
41
|
'AppticsRemoteConfig.fetchValues': true,
|
|
36
42
|
};
|
|
37
43
|
/** How a call is named in a message: every public call is named after its object, as `AppticsEvent.addEvent`. */
|
|
@@ -56,7 +62,16 @@ function guard(name, fn) {
|
|
|
56
62
|
return undefined;
|
|
57
63
|
}
|
|
58
64
|
try {
|
|
59
|
-
|
|
65
|
+
var result = fn(...args);
|
|
66
|
+
if (result && typeof result.then === 'function') { // no i18n
|
|
67
|
+
// a rejection the app leaves unhandled is still the SDK's failure, not the app's
|
|
68
|
+
// JS error (lifecycle's unhandledrejection listener)
|
|
69
|
+
return result.then(undefined, function (reason) {
|
|
70
|
+
shield.markSdkRejection(reason);
|
|
71
|
+
throw reason;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
60
75
|
}
|
|
61
76
|
catch (err) {
|
|
62
77
|
// a public call swallowing its own exception into a debug-gated console line is how
|
package/dist/cjs/core/hooks.d.ts
CHANGED
|
@@ -36,4 +36,33 @@ export declare const hooks: {
|
|
|
36
36
|
remoteConfigStarted: () => void;
|
|
37
37
|
/** Set by remoteconfig/fetch.ts: AppticsUser.setUser changed who this is, so conditions on the user re-apply. */
|
|
38
38
|
remoteConfigUserChanged: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Set by device/index.ts: getsdkconfig is asked now, outside its next_check_after. setUser calls
|
|
41
|
+
* it for a user whose customer group is not tracked, setTrackingStatus for that user when PII
|
|
42
|
+
* starts or stops, and remote config when getupdates reports a module changed.
|
|
43
|
+
*/
|
|
44
|
+
askServerSettings: () => void;
|
|
45
|
+
/** Set by user/index.ts: whether user/register answered customergrouptracking: false for the active user. */
|
|
46
|
+
activeUserGroupUntracked: () => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Set by pushnotification/session.ts: the module ids getsdkconfig is asked about in `moduleids`.
|
|
49
|
+
* Push's 16 is what makes the answer carry the `wms` block; without the push entry, none.
|
|
50
|
+
*/
|
|
51
|
+
sdkConfigModuleIds: () => string[];
|
|
52
|
+
/** Set by pushnotification/session.ts: getsdkconfig's push flag or wms block was applied, live or restored. */
|
|
53
|
+
pushConfigChanged: () => void;
|
|
54
|
+
/** Set by pushnotification/session.ts: the visitor's tracking status changed. */
|
|
55
|
+
pushTrackingChanged: () => void;
|
|
56
|
+
/** Set by pushnotification/session.ts: start-up has finished. */
|
|
57
|
+
pushStarted: () => void;
|
|
58
|
+
/** Set by pushnotification/session.ts, so reset() can forget the push session without importing it. */
|
|
59
|
+
resetPush: () => void;
|
|
60
|
+
/** Set by pushnotification/session.ts: device/add's ids are stored, the anonymousid among them. */
|
|
61
|
+
pushDeviceIdsChanged: () => void;
|
|
62
|
+
/** Set by pushnotification/session.ts: init() has begun start-up, so _ZAP._readyPromise exists. */
|
|
63
|
+
pushInitCalled: () => void;
|
|
64
|
+
/** Set by pushnotification/stats.ts, so flush() and the send interval send push stats too. */
|
|
65
|
+
sendPushStats: (forget?: boolean) => Promise<void>;
|
|
66
|
+
/** Set by pushnotification/stats.ts: the app tracked an event, which may be a push's conversion. */
|
|
67
|
+
pushEventTracked: (eventName: string, groupName: string) => void;
|
|
39
68
|
};
|
package/dist/cjs/core/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @zoho_apptics/apptics-js-sdk v2.0.0
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0 | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -17,6 +17,17 @@ const hooks = {
|
|
|
17
17
|
screenTrackedByApp: () => { },
|
|
18
18
|
remoteConfigStarted: () => { },
|
|
19
19
|
remoteConfigUserChanged: () => { },
|
|
20
|
+
askServerSettings: () => { },
|
|
21
|
+
activeUserGroupUntracked: () => false,
|
|
22
|
+
sdkConfigModuleIds: () => [],
|
|
23
|
+
pushConfigChanged: () => { },
|
|
24
|
+
pushTrackingChanged: () => { },
|
|
25
|
+
pushStarted: () => { },
|
|
26
|
+
resetPush: () => { },
|
|
27
|
+
pushDeviceIdsChanged: () => { },
|
|
28
|
+
pushInitCalled: () => { },
|
|
29
|
+
sendPushStats: () => Promise.resolve(),
|
|
30
|
+
pushEventTracked: () => { },
|
|
20
31
|
};
|
|
21
32
|
|
|
22
33
|
exports.hooks = hooks;
|
package/dist/cjs/core/locks.js
CHANGED
package/dist/cjs/core/logger.js
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's own failures stay the SDK's. A throw in one of its timers or listeners, or a rejection
|
|
3
|
+
* no one in the SDK waits on, would otherwise reach the page's `error` and `unhandledrejection`
|
|
4
|
+
* events, where the SDK's error tracking records it as the app's JS error and sends it.
|
|
5
|
+
*
|
|
6
|
+
* guard() shields the public calls; shield() and quietly() shield everything the SDK runs later.
|
|
7
|
+
* Element errors (the SDK's script, style and form elements) are told apart by isSdkElement.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Said in the console and nowhere else. An Error is a real failure (a bug, storage refusing), said
|
|
11
|
+
* whether or not debug is on; anything else is one of the SDK's own reasons for not doing
|
|
12
|
+
* something, as "nothing to send", said in debug mode.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sdkFailed(label: string, err: unknown): void;
|
|
15
|
+
/**
|
|
16
|
+
* A callback the SDK hands to the browser (a timer, a listener, a storage or network callback)
|
|
17
|
+
* that never throws into it. A promise it returns is waited on the same way, so an async
|
|
18
|
+
* listener's rejection is not left unhandled either. Wrap once and keep the wrapped function where
|
|
19
|
+
* it is removed again later: removeEventListener needs the same reference.
|
|
20
|
+
*/
|
|
21
|
+
export declare function shield<F extends (...args: any[]) => any>(label: string, fn: F): F;
|
|
22
|
+
/** A promise the SDK starts and does not wait on: its rejection is said in the console, not left unhandled. */
|
|
23
|
+
export declare function quietly(label: string, promise: PromiseLike<unknown> | unknown): void;
|
|
24
|
+
export declare function markSdkRejection(reason: unknown): void;
|
|
25
|
+
export declare function isSdkRejection(reason: unknown): boolean;
|
|
26
|
+
/** Marks the elements the SDK adds to the page; isSdkElement knows them and what is inside them. */
|
|
27
|
+
export declare const SDK_ELEMENT_ATTR = "data-apptics";
|
|
28
|
+
/** Whether an element is the SDK's own: its style, the Quartz script, the feedback form or the recording timer. */
|
|
29
|
+
export declare function isSdkElement(target: unknown): boolean;
|
|
30
|
+
export declare function noteSdkScript(src: string | null | undefined): void;
|
|
31
|
+
export declare function isSdkScript(filename: string | null | undefined): boolean;
|