@zoho_apptics/apptics-js-sdk 1.0.2 → 2.0.0-beta
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 +87 -0
- package/LICENSE +13 -0
- package/README.md +747 -11
- package/dist/apptics.esm.min.js +3 -0
- package/dist/apptics.esm.min.js.map +1 -0
- package/dist/apptics.min.js +3 -0
- package/dist/apptics.min.js.map +1 -0
- package/dist/chunks/batch-BU_mTpm1.min.js +3 -0
- package/dist/chunks/batch-BU_mTpm1.min.js.map +1 -0
- package/dist/chunks/logs-Bea5zUW_.min.js +3 -0
- package/dist/chunks/logs-Bea5zUW_.min.js.map +1 -0
- package/dist/cjs/auto-init.d.ts +8 -0
- package/dist/cjs/auto-init.js +32 -0
- package/dist/cjs/core/attempts.d.ts +28 -0
- package/dist/cjs/core/attempts.js +113 -0
- package/dist/cjs/core/batch.d.ts +32 -0
- package/dist/cjs/core/batch.js +115 -0
- package/dist/cjs/core/callsite.d.ts +28 -0
- package/dist/cjs/core/callsite.js +93 -0
- package/dist/cjs/core/consent.d.ts +23 -0
- package/dist/cjs/core/consent.js +130 -0
- package/dist/cjs/core/constants.d.ts +212 -0
- package/dist/cjs/core/constants.js +299 -0
- package/dist/cjs/core/db.d.ts +40 -0
- package/dist/cjs/core/db.js +334 -0
- package/dist/cjs/core/debug.d.ts +22 -0
- package/dist/cjs/core/debug.js +88 -0
- package/dist/cjs/core/env.d.ts +28 -0
- package/dist/cjs/core/env.js +267 -0
- package/dist/cjs/core/framework-id.d.ts +1 -0
- package/dist/cjs/core/framework-id.js +9 -0
- package/dist/cjs/core/guard.d.ts +2 -0
- package/dist/cjs/core/guard.js +72 -0
- package/dist/cjs/core/hooks.d.ts +41 -0
- package/dist/cjs/core/hooks.js +23 -0
- package/dist/cjs/core/logger.d.ts +16 -0
- package/dist/cjs/core/logger.js +86 -0
- package/dist/cjs/core/state.d.ts +69 -0
- package/dist/cjs/core/state.js +78 -0
- package/dist/cjs/core/storage.d.ts +46 -0
- package/dist/cjs/core/storage.js +229 -0
- package/dist/cjs/core/transport.d.ts +83 -0
- package/dist/cjs/core/transport.js +441 -0
- package/dist/cjs/core/utils.d.ts +26 -0
- package/dist/cjs/core/utils.js +175 -0
- package/dist/cjs/core/validate.d.ts +18 -0
- package/dist/cjs/core/validate.js +233 -0
- package/dist/cjs/device/appversion.d.ts +20 -0
- package/dist/cjs/device/appversion.js +158 -0
- package/dist/cjs/device/index.d.ts +23 -0
- package/dist/cjs/device/index.js +372 -0
- package/dist/cjs/engagement/api-rules.d.ts +84 -0
- package/dist/cjs/engagement/api-rules.js +219 -0
- package/dist/cjs/engagement/auto-api.d.ts +7 -0
- package/dist/cjs/engagement/auto-api.js +200 -0
- package/dist/cjs/engagement/auto-screen.d.ts +16 -0
- package/dist/cjs/engagement/auto-screen.js +241 -0
- package/dist/cjs/engagement/defined-events.d.ts +23 -0
- package/dist/cjs/engagement/defined-events.js +58 -0
- package/dist/cjs/engagement/send.d.ts +6 -0
- package/dist/cjs/engagement/send.js +99 -0
- package/dist/cjs/engagement/session.d.ts +42 -0
- package/dist/cjs/engagement/session.js +327 -0
- package/dist/cjs/engagement/track.d.ts +56 -0
- package/dist/cjs/engagement/track.js +350 -0
- package/dist/cjs/errors/send.d.ts +6 -0
- package/dist/cjs/errors/send.js +73 -0
- package/dist/cjs/errors/track.d.ts +4 -0
- package/dist/cjs/errors/track.js +127 -0
- package/dist/cjs/feedback/controls.d.ts +31 -0
- package/dist/cjs/feedback/controls.js +286 -0
- package/dist/cjs/feedback/index.d.ts +8 -0
- package/dist/cjs/feedback/index.js +37 -0
- package/dist/cjs/feedback/logs.d.ts +40 -0
- package/dist/cjs/feedback/logs.js +202 -0
- package/dist/cjs/feedback/send.d.ts +25 -0
- package/dist/cjs/feedback/send.js +178 -0
- package/dist/cjs/feedback/template.d.ts +2 -0
- package/dist/cjs/feedback/template.js +162 -0
- package/dist/cjs/feedback/ui.d.ts +55 -0
- package/dist/cjs/feedback/ui.js +631 -0
- package/dist/cjs/heatmap/index.d.ts +16 -0
- package/dist/cjs/heatmap/index.js +22 -0
- package/dist/cjs/heatmap/send.d.ts +13 -0
- package/dist/cjs/heatmap/send.js +82 -0
- package/dist/cjs/heatmap/track.d.ts +4 -0
- package/dist/cjs/heatmap/track.js +377 -0
- package/dist/cjs/index.d.ts +68 -0
- package/dist/cjs/index.js +150 -0
- package/dist/cjs/lifecycle.d.ts +14 -0
- package/dist/cjs/lifecycle.js +538 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/remoteconfig/custom.d.ts +10 -0
- package/dist/cjs/remoteconfig/custom.js +78 -0
- package/dist/cjs/remoteconfig/evaluate.d.ts +24 -0
- package/dist/cjs/remoteconfig/evaluate.js +171 -0
- package/dist/cjs/remoteconfig/fetch.d.ts +24 -0
- package/dist/cjs/remoteconfig/fetch.js +214 -0
- package/dist/cjs/remoteconfig/index.d.ts +13 -0
- package/dist/cjs/remoteconfig/index.js +90 -0
- package/dist/cjs/remoteconfig/store.d.ts +18 -0
- package/dist/cjs/remoteconfig/store.js +98 -0
- package/dist/cjs/remotelog/gate.d.ts +11 -0
- package/dist/cjs/remotelog/gate.js +54 -0
- package/dist/cjs/remotelog/index.d.ts +25 -0
- package/dist/cjs/remotelog/index.js +55 -0
- package/dist/cjs/remotelog/logger.d.ts +28 -0
- package/dist/cjs/remotelog/logger.js +139 -0
- package/dist/cjs/remotelog/send.d.ts +13 -0
- package/dist/cjs/remotelog/send.js +153 -0
- package/dist/cjs/scheduler.d.ts +8 -0
- package/dist/cjs/scheduler.js +78 -0
- package/dist/cjs/types.d.ts +312 -0
- package/dist/cjs/user/index.d.ts +33 -0
- package/dist/cjs/user/index.js +178 -0
- package/dist/esm/auto-init.d.ts +8 -0
- package/dist/esm/auto-init.js +29 -0
- package/dist/esm/core/attempts.d.ts +28 -0
- package/dist/esm/core/attempts.js +106 -0
- package/dist/esm/core/batch.d.ts +32 -0
- package/dist/esm/core/batch.js +108 -0
- package/dist/esm/core/callsite.d.ts +28 -0
- package/dist/esm/core/callsite.js +89 -0
- package/dist/esm/core/consent.d.ts +23 -0
- package/dist/esm/core/consent.js +120 -0
- package/dist/esm/core/constants.d.ts +212 -0
- package/dist/esm/core/constants.js +277 -0
- package/dist/esm/core/db.d.ts +40 -0
- package/dist/esm/core/db.js +324 -0
- package/dist/esm/core/debug.d.ts +22 -0
- package/dist/esm/core/debug.js +81 -0
- package/dist/esm/core/env.d.ts +28 -0
- package/dist/esm/core/env.js +251 -0
- package/dist/esm/core/framework-id.d.ts +1 -0
- package/dist/esm/core/framework-id.js +7 -0
- package/dist/esm/core/guard.d.ts +2 -0
- package/dist/esm/core/guard.js +70 -0
- package/dist/esm/core/hooks.d.ts +41 -0
- package/dist/esm/core/hooks.js +21 -0
- package/dist/esm/core/logger.d.ts +16 -0
- package/dist/esm/core/logger.js +82 -0
- package/dist/esm/core/state.d.ts +69 -0
- package/dist/esm/core/state.js +73 -0
- package/dist/esm/core/storage.d.ts +46 -0
- package/dist/esm/core/storage.js +219 -0
- package/dist/esm/core/transport.d.ts +83 -0
- package/dist/esm/core/transport.js +425 -0
- package/dist/esm/core/utils.d.ts +26 -0
- package/dist/esm/core/utils.js +161 -0
- package/dist/esm/core/validate.d.ts +18 -0
- package/dist/esm/core/validate.js +226 -0
- package/dist/esm/device/appversion.d.ts +20 -0
- package/dist/esm/device/appversion.js +153 -0
- package/dist/esm/device/index.d.ts +23 -0
- package/dist/esm/device/index.js +362 -0
- package/dist/esm/engagement/api-rules.d.ts +84 -0
- package/dist/esm/engagement/api-rules.js +211 -0
- package/dist/esm/engagement/auto-api.d.ts +7 -0
- package/dist/esm/engagement/auto-api.js +198 -0
- package/dist/esm/engagement/auto-screen.d.ts +16 -0
- package/dist/esm/engagement/auto-screen.js +238 -0
- package/dist/esm/engagement/defined-events.d.ts +23 -0
- package/dist/esm/engagement/defined-events.js +55 -0
- package/dist/esm/engagement/send.d.ts +6 -0
- package/dist/esm/engagement/send.js +96 -0
- package/dist/esm/engagement/session.d.ts +42 -0
- package/dist/esm/engagement/session.js +315 -0
- package/dist/esm/engagement/track.d.ts +56 -0
- package/dist/esm/engagement/track.js +340 -0
- package/dist/esm/errors/send.d.ts +6 -0
- package/dist/esm/errors/send.js +70 -0
- package/dist/esm/errors/track.d.ts +4 -0
- package/dist/esm/errors/track.js +123 -0
- package/dist/esm/feedback/controls.d.ts +31 -0
- package/dist/esm/feedback/controls.js +280 -0
- package/dist/esm/feedback/index.d.ts +8 -0
- package/dist/esm/feedback/index.js +30 -0
- package/dist/esm/feedback/logs.d.ts +40 -0
- package/dist/esm/feedback/logs.js +188 -0
- package/dist/esm/feedback/send.d.ts +25 -0
- package/dist/esm/feedback/send.js +175 -0
- package/dist/esm/feedback/template.d.ts +2 -0
- package/dist/esm/feedback/template.js +159 -0
- package/dist/esm/feedback/ui.d.ts +55 -0
- package/dist/esm/feedback/ui.js +626 -0
- package/dist/esm/heatmap/index.d.ts +16 -0
- package/dist/esm/heatmap/index.js +17 -0
- package/dist/esm/heatmap/send.d.ts +13 -0
- package/dist/esm/heatmap/send.js +79 -0
- package/dist/esm/heatmap/track.d.ts +4 -0
- package/dist/esm/heatmap/track.js +374 -0
- package/dist/esm/index.d.ts +68 -0
- package/dist/esm/index.js +122 -0
- package/dist/esm/lifecycle.d.ts +14 -0
- package/dist/esm/lifecycle.js +534 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/remoteconfig/custom.d.ts +10 -0
- package/dist/esm/remoteconfig/custom.js +74 -0
- package/dist/esm/remoteconfig/evaluate.d.ts +24 -0
- package/dist/esm/remoteconfig/evaluate.js +166 -0
- package/dist/esm/remoteconfig/fetch.d.ts +24 -0
- package/dist/esm/remoteconfig/fetch.js +210 -0
- package/dist/esm/remoteconfig/index.d.ts +13 -0
- package/dist/esm/remoteconfig/index.js +85 -0
- package/dist/esm/remoteconfig/store.d.ts +18 -0
- package/dist/esm/remoteconfig/store.js +91 -0
- package/dist/esm/remotelog/gate.d.ts +11 -0
- package/dist/esm/remotelog/gate.js +48 -0
- package/dist/esm/remotelog/index.d.ts +25 -0
- package/dist/esm/remotelog/index.js +51 -0
- package/dist/esm/remotelog/logger.d.ts +28 -0
- package/dist/esm/remotelog/logger.js +136 -0
- package/dist/esm/remotelog/send.d.ts +13 -0
- package/dist/esm/remotelog/send.js +149 -0
- package/dist/esm/scheduler.d.ts +8 -0
- package/dist/esm/scheduler.js +74 -0
- package/dist/esm/types.d.ts +312 -0
- package/dist/esm/user/index.d.ts +33 -0
- package/dist/esm/user/index.js +170 -0
- package/dist/feedback.esm.min.js +3 -0
- package/dist/feedback.esm.min.js.map +1 -0
- package/dist/heatmap.esm.min.js +3 -0
- package/dist/heatmap.esm.min.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +124 -7
- package/src/appticssdk.js +0 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var state = require('./state.js');
|
|
5
|
+
var logger = require('./logger.js');
|
|
6
|
+
var utils = require('./utils.js');
|
|
7
|
+
require('./constants.js');
|
|
8
|
+
var consent = require('./consent.js');
|
|
9
|
+
var attempts = require('./attempts.js');
|
|
10
|
+
var transport = require('./transport.js');
|
|
11
|
+
|
|
12
|
+
/** Retries `send` in 500 ms, replacing any retry already scheduled. */
|
|
13
|
+
function defer(send) {
|
|
14
|
+
if (state._ZAP._deferSendTimer) {
|
|
15
|
+
clearTimeout(state._ZAP._deferSendTimer);
|
|
16
|
+
}
|
|
17
|
+
state._ZAP._deferSendTimer = setTimeout(send, 500);
|
|
18
|
+
}
|
|
19
|
+
function clearDefer() {
|
|
20
|
+
if (state._ZAP._deferSendTimer) {
|
|
21
|
+
clearTimeout(state._ZAP._deferSendTimer);
|
|
22
|
+
state._ZAP._deferSendTimer = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Only one tab sends a queue at a time. Without the Web Locks API, runs directly (1.x behaviour). */
|
|
26
|
+
function withSendLock(name, run) {
|
|
27
|
+
var locks = typeof navigator !== 'undefined' ? navigator.locks : undefined; // no i18n
|
|
28
|
+
if (!locks || typeof locks.request !== 'function') { // no i18n
|
|
29
|
+
return run();
|
|
30
|
+
}
|
|
31
|
+
return locks.request('apptics-send-' + name, { ifAvailable: true }, function (lock) {
|
|
32
|
+
return lock ? run() : undefined;
|
|
33
|
+
}).then(function () { return undefined; });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The batch to send: closed items within batch_request_timeout days.
|
|
37
|
+
* Expired items are removed from the queue without being sent.
|
|
38
|
+
*/
|
|
39
|
+
function freshItems(queue, isClosed, timeOf) {
|
|
40
|
+
return queue.payload().then(function (items) {
|
|
41
|
+
var fresh = [];
|
|
42
|
+
var expired = [];
|
|
43
|
+
items.forEach(function (item) {
|
|
44
|
+
if (!isClosed(item)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
(state.isExpired(timeOf(item)) ? expired : fresh).push(item);
|
|
48
|
+
});
|
|
49
|
+
return expired.length ? queue.remove(expired).then(function () { return fresh; }) : fresh;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Sends one batch of queued items. Resolves only when the server has accepted it, so the caller
|
|
54
|
+
* removes the items then and not before: a batch that fails stays queued and goes again on the
|
|
55
|
+
* next pass, as attempt 2, which `attempt` and `firstattempttime` let the server recognise as a
|
|
56
|
+
* copy rather than store twice.
|
|
57
|
+
*
|
|
58
|
+
* With `forget` (the page is closing) it goes by keepalive, and the promise settles if the answer
|
|
59
|
+
* arrives before the page is gone. See postKeepalive.
|
|
60
|
+
*
|
|
61
|
+
* Five attempts is the cap, because `attempt` is declared regex="[1-5]" and a sixth would be
|
|
62
|
+
* refused for the param rather than for the payload.
|
|
63
|
+
*/
|
|
64
|
+
function sendBatch(path, label, _payload, forget) {
|
|
65
|
+
var blocked = transport.rejectIfDisabled(label);
|
|
66
|
+
if (blocked) {
|
|
67
|
+
return blocked;
|
|
68
|
+
}
|
|
69
|
+
if (!consent.shouldTrackOrSendData()) {
|
|
70
|
+
return Promise.reject(label + ': tracking is off'); // no i18n
|
|
71
|
+
}
|
|
72
|
+
if (utils.isEmptyObj(_payload)) {
|
|
73
|
+
return Promise.reject(label + ': nothing to send'); // no i18n
|
|
74
|
+
}
|
|
75
|
+
var missing = transport.rejectIfNoDeviceIds(label);
|
|
76
|
+
if (missing) {
|
|
77
|
+
return missing;
|
|
78
|
+
}
|
|
79
|
+
if (!_payload.hasOwnProperty('meta')) { // no i18n
|
|
80
|
+
_payload.meta = transport.getMetaObj();
|
|
81
|
+
}
|
|
82
|
+
if (attempts.attemptsExhausted(path)) {
|
|
83
|
+
// five passes without a confirmed landing. Keeping it would block every later batch
|
|
84
|
+
// behind a payload the proxy will now refuse for its attempt number alone
|
|
85
|
+
logger.warnAlways('apptics: dropping a ' + label + ' batch after ' + attempts.MAX_ATTEMPTS + ' attempts'); // no i18n
|
|
86
|
+
attempts.resetAttempts(path);
|
|
87
|
+
return Promise.resolve({ result: 'success' }); // no i18n
|
|
88
|
+
}
|
|
89
|
+
logger.Console.log(label + ': Payload size : ' + (utils.sizeof(_payload) / 1024)); // no i18n
|
|
90
|
+
var body = JSON.stringify(_payload);
|
|
91
|
+
return forget
|
|
92
|
+
? transport.postKeepalive(path, body, transport.apiHeaders(), label)
|
|
93
|
+
: transport.postToApptics(path, body, transport.apiHeaders(), label);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Hands a send's outcome back to a sender. Normally the sender waits for it. While the page
|
|
97
|
+
* closes it does not: the request is already out, and waiting would hold the next queue's send
|
|
98
|
+
* until after the page has gone. The outcome is still handled whenever it arrives.
|
|
99
|
+
*/
|
|
100
|
+
function awaitUnlessClosing(landed, forget, label) {
|
|
101
|
+
if (!forget) {
|
|
102
|
+
return landed.then(function () { return undefined; });
|
|
103
|
+
}
|
|
104
|
+
landed.catch(function (err) {
|
|
105
|
+
logger.Console.log(label + ': not confirmed before the page closed, kept for the next send: ' + String(err)); // no i18n
|
|
106
|
+
});
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
exports.awaitUnlessClosing = awaitUnlessClosing;
|
|
111
|
+
exports.clearDefer = clearDefer;
|
|
112
|
+
exports.defer = defer;
|
|
113
|
+
exports.freshItems = freshItems;
|
|
114
|
+
exports.sendBatch = sendBatch;
|
|
115
|
+
exports.withSendLock = withSendLock;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a log line was raised, for logSDK's `filename` and `linenumber`.
|
|
3
|
+
*
|
|
4
|
+
* There is no caller introspection in a browser, so the only way to answer "which line was this"
|
|
5
|
+
* is to throw an Error nobody catches and read its stack. That is cheap enough for a channel that
|
|
6
|
+
* only carries the SDK's own failures, but it is never on the app's path: everything here is
|
|
7
|
+
* wrapped so a stack we cannot parse costs a line its call site and nothing more.
|
|
8
|
+
*/
|
|
9
|
+
export interface CallSite {
|
|
10
|
+
/** The script's basename, not its url: logSDK caps filename at 100 characters. */
|
|
11
|
+
filename: string;
|
|
12
|
+
/** 0 when the stack gave us nothing — see entryFor() for why it is still sent. */
|
|
13
|
+
linenumber: number;
|
|
14
|
+
/** The calling function's name, when the frame has one. Anonymous callers have none. */
|
|
15
|
+
fn?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const NO_CALL_SITE: CallSite;
|
|
18
|
+
/**
|
|
19
|
+
* The frame `skip` frames down a stack, counting only the ones that name a file — V8 heads its
|
|
20
|
+
* stacks with an `Error` line and Firefox does not, so counting raw lines would read a different
|
|
21
|
+
* frame in each browser.
|
|
22
|
+
*/
|
|
23
|
+
export declare function callSiteFromStack(stack: string | undefined, skip: number): CallSite;
|
|
24
|
+
/**
|
|
25
|
+
* Where the caller `skip` levels above this call sits. `skip` is 0 for this function's own
|
|
26
|
+
* caller; each wrapper between that caller and the place worth reporting adds one.
|
|
27
|
+
*/
|
|
28
|
+
export declare function callSite(skip: number): CallSite;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where a log line was raised, for logSDK's `filename` and `linenumber`.
|
|
6
|
+
*
|
|
7
|
+
* There is no caller introspection in a browser, so the only way to answer "which line was this"
|
|
8
|
+
* is to throw an Error nobody catches and read its stack. That is cheap enough for a channel that
|
|
9
|
+
* only carries the SDK's own failures, but it is never on the app's path: everything here is
|
|
10
|
+
* wrapped so a stack we cannot parse costs a line its call site and nothing more.
|
|
11
|
+
*/
|
|
12
|
+
const NO_CALL_SITE = { filename: '', linenumber: 0, fn: '' };
|
|
13
|
+
/** logSDK declares max-len="100" on filename. */
|
|
14
|
+
const FILENAME_MAX = 100;
|
|
15
|
+
/**
|
|
16
|
+
* The file and line out of one stack frame, in either shape a browser produces:
|
|
17
|
+
* V8: ` at doThing (https://host/app.js:12:34)`
|
|
18
|
+
* Firefox/Safari: `doThing@https://host/app.js:12:34`
|
|
19
|
+
* Both end in `:line:column`, which is the only part that is the same everywhere, so the match is
|
|
20
|
+
* anchored there and the column is read only so that it can be thrown away — without it the
|
|
21
|
+
* pattern would take the column for the line.
|
|
22
|
+
*/
|
|
23
|
+
const FRAME = /([^\s(@]+):(\d+):(\d+)\)?$/;
|
|
24
|
+
/** `https://host/path/app.js?v=2` -> `app.js`. The url would not fit in 100 characters. */
|
|
25
|
+
function basename(url) {
|
|
26
|
+
var path = url.split(/[?#]/)[0] || url;
|
|
27
|
+
var parts = path.split('/');
|
|
28
|
+
return (parts[parts.length - 1] || path).slice(0, FILENAME_MAX);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The function a frame names, in either shape:
|
|
32
|
+
* V8: `at doThing (` — or `at async doThing (`
|
|
33
|
+
* Firefox/Safari: `doThing@`
|
|
34
|
+
* A frame without one (`at https://…` or `@https://…`) is an anonymous caller, and gets ''.
|
|
35
|
+
*/
|
|
36
|
+
const FRAME_FN_V8 = /^at\s+(?:async\s+)?(.+?)\s+\(/;
|
|
37
|
+
const FRAME_FN_OTHER = /^([^@\s]+)@/;
|
|
38
|
+
function frameFunction(frame) {
|
|
39
|
+
var match = FRAME_FN_V8.exec(frame) || FRAME_FN_OTHER.exec(frame);
|
|
40
|
+
return match ? (match[1] || '') : ''; // no i18n
|
|
41
|
+
}
|
|
42
|
+
function parseFrame(line) {
|
|
43
|
+
var trimmed = line.trim();
|
|
44
|
+
var match = FRAME.exec(trimmed);
|
|
45
|
+
if (match === null) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
var line_no = Number(match[2]);
|
|
49
|
+
if (!isFinite(line_no)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return { filename: basename(match[1] || ''), linenumber: line_no, fn: frameFunction(trimmed) };
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The frame `skip` frames down a stack, counting only the ones that name a file — V8 heads its
|
|
56
|
+
* stacks with an `Error` line and Firefox does not, so counting raw lines would read a different
|
|
57
|
+
* frame in each browser.
|
|
58
|
+
*/
|
|
59
|
+
function callSiteFromStack(stack, skip) {
|
|
60
|
+
if (!stack) {
|
|
61
|
+
return NO_CALL_SITE;
|
|
62
|
+
}
|
|
63
|
+
var lines = stack.split('\n');
|
|
64
|
+
var seen = 0;
|
|
65
|
+
for (var i = 0; i < lines.length; i++) {
|
|
66
|
+
var frame = parseFrame(lines[i] || '');
|
|
67
|
+
if (frame === null) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (seen++ < skip) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
return frame;
|
|
74
|
+
}
|
|
75
|
+
return NO_CALL_SITE;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Where the caller `skip` levels above this call sits. `skip` is 0 for this function's own
|
|
79
|
+
* caller; each wrapper between that caller and the place worth reporting adds one.
|
|
80
|
+
*/
|
|
81
|
+
function callSite(skip) {
|
|
82
|
+
try {
|
|
83
|
+
// +1 for this function's own frame, which is never the answer
|
|
84
|
+
return callSiteFromStack(new Error().stack, skip + 1);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
return NO_CALL_SITE;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.NO_CALL_SITE = NO_CALL_SITE;
|
|
92
|
+
exports.callSite = callSite;
|
|
93
|
+
exports.callSiteFromStack = callSiteFromStack;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TrackingStatus } from '../types.js';
|
|
2
|
+
/** DNT counts only when not ignored; when it counts, tracking switches to NO_TRACKING. */
|
|
3
|
+
export declare function hasDoNotTrackEnabled(): boolean;
|
|
4
|
+
export declare function opt_in_status(): TrackingStatus;
|
|
5
|
+
export declare function shouldTrackOrSendData(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The guard every tracking call starts with: init() has run, the client isn't a crawler,
|
|
8
|
+
* and consent / server flags allow tracking.
|
|
9
|
+
*/
|
|
10
|
+
export declare function canTrack(caller: string): boolean;
|
|
11
|
+
/** canTrack plus the server's `engagementtracking` flag from getupdates (events, screens, sessions, api calls). */
|
|
12
|
+
export declare function canTrackEngagement(caller: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* canTrack plus the server's heatmap flag (getsdkconfig module 18).
|
|
15
|
+
*
|
|
16
|
+
* Heatmap rode the engagement flag until v2 gave it one of its own, which matters: an app may
|
|
17
|
+
* well want events while declining to have every click's coordinates recorded.
|
|
18
|
+
*/
|
|
19
|
+
export declare function canTrackHeatmap(caller: string): boolean;
|
|
20
|
+
/** canTrack plus the server's `errortracking` flag from getupdates. */
|
|
21
|
+
export declare function canTrackErrors(caller: string): boolean;
|
|
22
|
+
export declare function setTrackingStatus(trackingState: TrackingStatus): void;
|
|
23
|
+
export declare function getTrackingStatus(): TrackingStatus;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var constants = require('./constants.js');
|
|
5
|
+
var state = require('./state.js');
|
|
6
|
+
var logger = require('./logger.js');
|
|
7
|
+
var utils = require('./utils.js');
|
|
8
|
+
var storage = require('./storage.js');
|
|
9
|
+
var env = require('./env.js');
|
|
10
|
+
var hooks = require('./hooks.js');
|
|
11
|
+
|
|
12
|
+
/** DNT counts only when not ignored; when it counts, tracking switches to NO_TRACKING. */
|
|
13
|
+
function hasDoNotTrackEnabled() {
|
|
14
|
+
if (state._ZAP._ignoreDnt) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (env.isDntOn()) {
|
|
18
|
+
logger.Console.warn('hasDoNotTrackEnabled: DoNotTrack is enabled'); // no i18n
|
|
19
|
+
setTrackingStatus(constants.AP_TRACKING_STATUS.NO_TRACKING);
|
|
20
|
+
logger.Console.log('hasDoNotTrackEnabled: Setting tracking status to NO_TRACKING'); // no i18n
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
function opt_in_status() {
|
|
26
|
+
if (hasDoNotTrackEnabled()) {
|
|
27
|
+
logger.Console.warn('opt_in_status: It seems "Do Not Track" is enabled in this browser. Please enable tracking in the browser settings to continue tracking.'); // no i18n
|
|
28
|
+
return constants.AP_TRACKING_STATUS.NO_TRACKING;
|
|
29
|
+
}
|
|
30
|
+
var status = storage.tracking_preference.opt_in_status();
|
|
31
|
+
if (status == -1) {
|
|
32
|
+
logger.Console.warn('opt_in_status: You are opted out of Apptics tracking. This will prevent the our SDK from sending no data to our server.'); // no i18n
|
|
33
|
+
}
|
|
34
|
+
return status;
|
|
35
|
+
}
|
|
36
|
+
function shouldTrackOrSendData() {
|
|
37
|
+
var optInStatus = opt_in_status();
|
|
38
|
+
return optInStatus > -1 && state._ZAP._shouldTrack;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The guard every tracking call starts with: init() has run, the client isn't a crawler,
|
|
42
|
+
* and consent / server flags allow tracking.
|
|
43
|
+
*/
|
|
44
|
+
function canTrack(caller) {
|
|
45
|
+
if (!state._ZAP._token) {
|
|
46
|
+
logger.Console.warn('apptics.' + caller + ': You must call apptics.init() first'); // no i18n
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (env.is_apptics_disabled()) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return shouldTrackOrSendData();
|
|
53
|
+
}
|
|
54
|
+
/** canTrack plus the server's `engagementtracking` flag from getupdates (events, screens, sessions, api calls). */
|
|
55
|
+
function canTrackEngagement(caller) {
|
|
56
|
+
if (!canTrack(caller)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (!state._ZAP._engagementTracking) {
|
|
60
|
+
logger.Console.log('apptics.' + caller + ': engagement tracking is turned off by the server'); // no i18n
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* canTrack plus the server's heatmap flag (getsdkconfig module 18).
|
|
67
|
+
*
|
|
68
|
+
* Heatmap rode the engagement flag until v2 gave it one of its own, which matters: an app may
|
|
69
|
+
* well want events while declining to have every click's coordinates recorded.
|
|
70
|
+
*/
|
|
71
|
+
function canTrackHeatmap(caller) {
|
|
72
|
+
if (!canTrack(caller)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!state._ZAP._heatmapTracking) {
|
|
76
|
+
logger.Console.log('apptics.' + caller + ': heatmap tracking is turned off by the server'); // no i18n
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
/** canTrack plus the server's `errortracking` flag from getupdates. */
|
|
82
|
+
function canTrackErrors(caller) {
|
|
83
|
+
if (!canTrack(caller)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!state._ZAP._errorTracking) {
|
|
87
|
+
logger.Console.log('apptics.' + caller + ': error tracking is turned off by the server'); // no i18n
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
function setTrackingStatus(trackingState) {
|
|
93
|
+
if (utils.isEmpty(trackingState)) {
|
|
94
|
+
logger.Console.warn('setTrackingStatus: trackingStatus is Empty'); // no i18n
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (storage.tracking_preference.opt_in_status() == trackingState) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
storage.tracking_preference.update_status(trackingState);
|
|
101
|
+
state._ZAP._devicestatus = storage.tracking_preference.opt_in_status();
|
|
102
|
+
state._ZAP._isanonrequired = storage.tracking_preference.opt_in_status() == constants.AP_TRACKING_STATUS.USAGE_TRACKING_WITH_PII ? false : state._ZAP._isanonrequired;
|
|
103
|
+
if (storage.tracking_preference.opt_in_status() != constants.AP_TRACKING_STATUS.NO_TRACKING) {
|
|
104
|
+
logger.Console.log('setTrackingStatus: Updating device info with new tracking status'); // no i18n
|
|
105
|
+
hooks.hooks.updateDevice(state._ZAP._device_info).then(function (result) {
|
|
106
|
+
if (utils.isSuccess(result)) {
|
|
107
|
+
logger.Console.log('setTrackingStatus: Device info updated with new tracking status' + JSON.stringify(result.data)); // no i18n
|
|
108
|
+
logger.Console.dir(result.data);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
logger.Console.log('setTrackingStatus: Error updating device info with new tracking status: ' + JSON.stringify(result)); // no i18n
|
|
112
|
+
}
|
|
113
|
+
}).catch(function (err) {
|
|
114
|
+
logger.Console.warn('setTrackingStatus: Error updating device info with new tracking status: ' + JSON.stringify(err)); // no i18n
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function getTrackingStatus() {
|
|
119
|
+
return opt_in_status();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
exports.canTrack = canTrack;
|
|
123
|
+
exports.canTrackEngagement = canTrackEngagement;
|
|
124
|
+
exports.canTrackErrors = canTrackErrors;
|
|
125
|
+
exports.canTrackHeatmap = canTrackHeatmap;
|
|
126
|
+
exports.getTrackingStatus = getTrackingStatus;
|
|
127
|
+
exports.hasDoNotTrackEnabled = hasDoNotTrackEnabled;
|
|
128
|
+
exports.opt_in_status = opt_in_status;
|
|
129
|
+
exports.setTrackingStatus = setTrackingStatus;
|
|
130
|
+
exports.shouldTrackOrSendData = shouldTrackOrSendData;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
export declare const AP_TRACKING_STATUS: Readonly<{
|
|
2
|
+
readonly USAGE_TRACKING_WITH_PII: 1;
|
|
3
|
+
readonly USAGE_TRACKING_WITHOUT_PII: 4;
|
|
4
|
+
readonly NO_TRACKING: -1;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const AP_FEEDBACK_TYPE: Readonly<{
|
|
7
|
+
readonly BUG: 0;
|
|
8
|
+
readonly FEEDBACK: 1;
|
|
9
|
+
readonly HELP: 2;
|
|
10
|
+
readonly REPORT: 3;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const AP_CONSTANTS: Readonly<{
|
|
13
|
+
readonly SCREEN: "screen";
|
|
14
|
+
readonly SESSION: "session";
|
|
15
|
+
readonly EVENT: "event";
|
|
16
|
+
readonly API: "api";
|
|
17
|
+
readonly ERROR: "error";
|
|
18
|
+
readonly SUCCESS: "success";
|
|
19
|
+
readonly BROWSER: "Browser";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const DEFAULT_API_PATHS: Readonly<{
|
|
22
|
+
readonly addversion: "app/addversion";
|
|
23
|
+
readonly regdevice: "device/add";
|
|
24
|
+
readonly reguser: "user/register";
|
|
25
|
+
readonly engagement: "engagement/add";
|
|
26
|
+
readonly error: "exception/error";
|
|
27
|
+
readonly feedback: "feedback/add";
|
|
28
|
+
readonly sdkconfig: "getsdkconfig";
|
|
29
|
+
readonly getupdates: "getupdates";
|
|
30
|
+
readonly consolelog: "log/add";
|
|
31
|
+
readonly heatmap: "heatmap/add";
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Which API version each path lives under.
|
|
35
|
+
*
|
|
36
|
+
* Every path the SDK calls is defined under v2 in the proxy's security-sdk.xml, and four of them —
|
|
37
|
+
* app/addversion, getsdkconfig, heatmap/add and log/add — are defined there *only* under v2: there
|
|
38
|
+
* is no v1 url for them to fall back to, so sending v1 reaches nothing. It stays a per-path map
|
|
39
|
+
* rather than one shared prefix because v1 urls do still exist for the other five, so a path can
|
|
40
|
+
* be moved back on its own if one of them turns out not to be ready.
|
|
41
|
+
*/
|
|
42
|
+
export declare const API_VERSIONS: Readonly<Record<keyof typeof DEFAULT_API_PATHS, string>>;
|
|
43
|
+
/**
|
|
44
|
+
* The SDK subsystem a remote log line is about, as console/addlog's `module` param.
|
|
45
|
+
* These are the server's own names, so they are sent exactly as written here.
|
|
46
|
+
*/
|
|
47
|
+
export declare const AP_LOG_MODULE: Readonly<{
|
|
48
|
+
readonly SESSION: "Session";
|
|
49
|
+
readonly SCREEN: "Screen";
|
|
50
|
+
readonly EVENT: "Event";
|
|
51
|
+
readonly API: "API";
|
|
52
|
+
readonly HEATMAP: "Heatmap";
|
|
53
|
+
readonly PROPERTIES: "Properties";
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* The modules getsdkconfig reports on, by the ids it keys them with. The SDK acts on the ones it
|
|
57
|
+
* has something to switch off; anything else the server sends is stored but unused.
|
|
58
|
+
*/
|
|
59
|
+
export declare const SDK_MODULE: Readonly<{
|
|
60
|
+
/**
|
|
61
|
+
* Remote config. It is the one module both answers report on: getupdates names it in
|
|
62
|
+
* `moduleids` and reports its flag back, and getsdkconfig reports the same flag as the
|
|
63
|
+
* authority. Where they disagree, getsdkconfig wins.
|
|
64
|
+
*/
|
|
65
|
+
readonly REMOTE_CONFIG: "2";
|
|
66
|
+
readonly SESSION: "11";
|
|
67
|
+
readonly FEEDBACK: "12";
|
|
68
|
+
readonly CRASH: "13";
|
|
69
|
+
readonly REMOTE_LOGGER: "17";
|
|
70
|
+
readonly HEATMAP: "18";
|
|
71
|
+
}>;
|
|
72
|
+
/** logSDK declares max-len="10000" on logmessage, so a line is trimmed to fit that. */
|
|
73
|
+
export declare const CONSOLE_LOG_MAX_BODY = 10000;
|
|
74
|
+
/** logSDK caps `function` at 100 characters. */
|
|
75
|
+
export declare const LOG_FUNCTION_MAX = 100;
|
|
76
|
+
/** logSDK caps `filename` at 100 too, which is why a call site carries a basename, not a url. */
|
|
77
|
+
export declare const LOG_FILENAME_MAX = 100;
|
|
78
|
+
/**
|
|
79
|
+
* How much of `devicename` is sent. The url declares no max-len, only safe_string, but this is a
|
|
80
|
+
* label a person reads in a list: anything longer is a paragraph, not a name.
|
|
81
|
+
*/
|
|
82
|
+
export declare const DEVICE_NAME_MAX = 100;
|
|
83
|
+
/**
|
|
84
|
+
* The `level` every line goes out with. Everything the remote logger carries is a failure inside
|
|
85
|
+
* the SDK — logFailure is its only caller — so the level never varies. 3 is what the v2 reference
|
|
86
|
+
* shows in its only example; the scale itself is not documented anywhere we can see.
|
|
87
|
+
*/
|
|
88
|
+
export declare const REMOTE_LOG_LEVEL = 3;
|
|
89
|
+
/**
|
|
90
|
+
* How long debug mode survives with nothing tracked, before switching itself off.
|
|
91
|
+
*
|
|
92
|
+
* An hour is long enough to cover reading a payload, changing the app and reloading, and short
|
|
93
|
+
* enough that a tab left open overnight is not still sending every call to its debug twin.
|
|
94
|
+
*/
|
|
95
|
+
export declare const DEBUG_IDLE_MS: number;
|
|
96
|
+
/** Idle minutes that end a session. Lives on state, not in _config, but defaults here. */
|
|
97
|
+
export declare const DEFAULT_INACTIVE_MINUTES = 30;
|
|
98
|
+
/** Global defaults. `state._config` holds a mutable copy per init. */
|
|
99
|
+
export declare const AP_CONFIG: Readonly<{
|
|
100
|
+
endpoint: "/sdk/web/";
|
|
101
|
+
method: "POST";
|
|
102
|
+
transport: "XHR";
|
|
103
|
+
track_link_timeout: 300;
|
|
104
|
+
cookie_expiration_days: 365;
|
|
105
|
+
storage_type: "localStorage";
|
|
106
|
+
enable_batch_requests: true;
|
|
107
|
+
batch_size: 50;
|
|
108
|
+
batch_flush_interval: 30000;
|
|
109
|
+
getupdates_interval: 120000;
|
|
110
|
+
batch_request_timeout: 7;
|
|
111
|
+
auto_starts_batch: true;
|
|
112
|
+
mode: 1;
|
|
113
|
+
default_group_name: "default";
|
|
114
|
+
default_optin_status: number;
|
|
115
|
+
enable_pageview_tracking: false;
|
|
116
|
+
save_referrer: true;
|
|
117
|
+
debug: boolean;
|
|
118
|
+
track_by_default: true;
|
|
119
|
+
ignore_do_not_track: boolean;
|
|
120
|
+
remote_log: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Wrap XHR and fetch to record the app's API calls without it calling startTrackApi(). Off by
|
|
123
|
+
* default: the hostnames and paths of every request an app makes is a wider grant than events
|
|
124
|
+
* and screens, so the app opts in.
|
|
125
|
+
*/
|
|
126
|
+
track_api: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Record a screen view for the first page and every navigation after it, from the url. On by
|
|
129
|
+
* default; the app's own inScreen() during a navigation replaces that navigation's view.
|
|
130
|
+
*/
|
|
131
|
+
track_screen: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Print each app logger line to the browser console as well, as Android's showLogs prints to
|
|
134
|
+
* Logcat. Off by default; console_log is the SDK's own activity, this is the app's lines.
|
|
135
|
+
*/
|
|
136
|
+
show_logs: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Record sessions automatically. On by default; false is Android's
|
|
139
|
+
* automaticSessionsTrackingStatus = false: no sessions, while events and screens still are.
|
|
140
|
+
*/
|
|
141
|
+
track_session: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* How long a visit must last before its session is stored, in milliseconds. A shorter visit with
|
|
144
|
+
* nothing tracked in it is dropped: a bounce or a crawler is not a session. Anything tracked
|
|
145
|
+
* inside the window writes the session immediately, keeping its original start time. 0 disables
|
|
146
|
+
* the wait and stores every session as it starts.
|
|
147
|
+
*/
|
|
148
|
+
min_session_duration: number;
|
|
149
|
+
/**
|
|
150
|
+
* Record where people click and how far they scroll, for the console's heatmaps. Off by default:
|
|
151
|
+
* coordinates and element labels are a wider grant than events and screens, so the app opts in.
|
|
152
|
+
*/
|
|
153
|
+
track_heatmap: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Send engagement, exception and log payloads to their `debug/` twins, which answer with a
|
|
156
|
+
* request id and a link to the server's own logs for that request. For tracing a payload that
|
|
157
|
+
* is not showing up in the console; off in normal use, and it does not change what is sent.
|
|
158
|
+
*/
|
|
159
|
+
debug_api: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* What to call this device in the debug stream. Engagement, exception and log are the three
|
|
162
|
+
* urls that declare `devicename`, and it is what tells one tester's browser from another's
|
|
163
|
+
* when several are tracing the same build. Empty by default: it rides on every one of those
|
|
164
|
+
* calls, so an app that is not tracing should not pay for it. With `debug_api` on and nothing
|
|
165
|
+
* set here, a label is derived from the browser and OS instead, since an unnamed row in the
|
|
166
|
+
* debug stream is no use to whoever is reading it.
|
|
167
|
+
*/
|
|
168
|
+
device_name: string;
|
|
169
|
+
/**
|
|
170
|
+
* Most heatmap records one visit may produce. Clicks are cheap, but a page that scrolls a lot
|
|
171
|
+
* can produce them faster than they are sent, and an unbounded queue is a memory leak on a tab
|
|
172
|
+
* left open for a day. Reached, capture stops for the rest of the session.
|
|
173
|
+
*/
|
|
174
|
+
heatmap_max_per_session: number;
|
|
175
|
+
}>;
|
|
176
|
+
export type ApConfig = {
|
|
177
|
+
-readonly [K in keyof typeof AP_CONFIG]: (typeof AP_CONFIG)[K];
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Config keys `init()` refuses to start without (after the snippet aliases are resolved).
|
|
181
|
+
*
|
|
182
|
+
* `appversion` is here rather than defaulted on purpose. Every error, every device registration
|
|
183
|
+
* and every uploaded source map is only meaningful against the build it came from, and a default
|
|
184
|
+
* would answer that question wrongly and silently for every app that forgot to set it.
|
|
185
|
+
*/
|
|
186
|
+
/**
|
|
187
|
+
* What init() must be given. Everything else the SDK needs — aaid, the portal and project ids that
|
|
188
|
+
* go in every url — comes back from app/addversion, which these four are enough to call.
|
|
189
|
+
*/
|
|
190
|
+
export declare const REQUIRED_CONFIG: readonly ["serviceUrl", "zak", "identifier", "appversion"];
|
|
191
|
+
/**
|
|
192
|
+
* Paths with a `debug/` twin. The debug endpoints take the same body and answer with a request id
|
|
193
|
+
* and a link to the server-side logs for that request, which is how a payload is traced end to
|
|
194
|
+
* end when the console does not show what was expected.
|
|
195
|
+
*/
|
|
196
|
+
export declare const DEBUG_CAPABLE_PATHS: Readonly<Record<string, boolean>>;
|
|
197
|
+
/**
|
|
198
|
+
* Paths that declare `attempt`, `firstattempttime` and `lst`.
|
|
199
|
+
*
|
|
200
|
+
* Every url that carries data declares all three. app/addversion and getsdkconfig declare none:
|
|
201
|
+
* they are start-up calls whose answers the SDK needs, not payloads it is pushing, and sending
|
|
202
|
+
* an undeclared param is refused outright as EXTRA_PARAM_FOUND.
|
|
203
|
+
*/
|
|
204
|
+
export declare const RETRY_CAPABLE_PATHS: Readonly<Record<string, boolean>>;
|
|
205
|
+
/**
|
|
206
|
+
* Paths that live directly under the version, with no org and project segments. app/addversion is
|
|
207
|
+
* called before those ids are known, so it cannot carry them.
|
|
208
|
+
*/
|
|
209
|
+
export declare const PATHS_WITHOUT_ORG: Readonly<Record<string, boolean>>;
|
|
210
|
+
/** Console-snippet names accepted for the canonical keys above. */
|
|
211
|
+
export declare const CONFIG_ALIASES: Readonly<Record<string, string>>;
|
|
212
|
+
export declare const BLOCKED_WS: readonly string[];
|