@zoho_apptics/apptics-js-sdk 2.0.0-beta.1 → 2.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +80 -16
  2. package/README.md +187 -100
  3. package/dist/apptics.esm.min.js +2 -2
  4. package/dist/apptics.esm.min.js.map +1 -1
  5. package/dist/apptics.min.js +2 -2
  6. package/dist/apptics.min.js.map +1 -1
  7. package/dist/chunks/lifecycle-C6m1W7jo.min.js +3 -0
  8. package/dist/chunks/lifecycle-C6m1W7jo.min.js.map +1 -0
  9. package/dist/chunks/send-CgUO82ne.min.js +3 -0
  10. package/dist/chunks/send-CgUO82ne.min.js.map +1 -0
  11. package/dist/cjs/core/attempts.js +1 -1
  12. package/dist/cjs/core/batch.js +1 -2
  13. package/dist/cjs/core/consent.d.ts +13 -3
  14. package/dist/cjs/core/consent.js +24 -10
  15. package/dist/cjs/core/constants.d.ts +22 -17
  16. package/dist/cjs/core/constants.js +22 -19
  17. package/dist/cjs/core/db.js +1 -1
  18. package/dist/cjs/core/debug.js +1 -1
  19. package/dist/cjs/core/env.d.ts +0 -3
  20. package/dist/cjs/core/env.js +1 -9
  21. package/dist/cjs/core/framework-id.d.ts +1 -1
  22. package/dist/cjs/core/framework-id.js +3 -3
  23. package/dist/cjs/core/guard.js +1 -1
  24. package/dist/cjs/core/hooks.d.ts +5 -0
  25. package/dist/cjs/core/hooks.js +2 -1
  26. package/dist/cjs/core/locks.js +1 -1
  27. package/dist/cjs/core/logger.js +1 -1
  28. package/dist/cjs/core/state.d.ts +6 -4
  29. package/dist/cjs/core/state.js +2 -4
  30. package/dist/cjs/core/storage.js +1 -4
  31. package/dist/cjs/core/stylesheet.js +1 -1
  32. package/dist/cjs/core/transport.js +13 -16
  33. package/dist/cjs/core/utils.js +1 -1
  34. package/dist/cjs/core/validate.js +1 -1
  35. package/dist/cjs/device/appversion.d.ts +10 -1
  36. package/dist/cjs/device/appversion.js +26 -3
  37. package/dist/cjs/device/index.d.ts +17 -2
  38. package/dist/cjs/device/index.js +195 -27
  39. package/dist/cjs/engagement/api-rules.js +1 -1
  40. package/dist/cjs/engagement/auto-api.js +1 -1
  41. package/dist/cjs/engagement/auto-screen.js +1 -1
  42. package/dist/cjs/engagement/defined-events.js +1 -1
  43. package/dist/cjs/engagement/send.js +7 -3
  44. package/dist/cjs/engagement/session.d.ts +17 -0
  45. package/dist/cjs/engagement/session.js +95 -4
  46. package/dist/cjs/engagement/track.d.ts +4 -4
  47. package/dist/cjs/engagement/track.js +15 -12
  48. package/dist/cjs/errors/send.js +2 -2
  49. package/dist/cjs/errors/track.d.ts +2 -1
  50. package/dist/cjs/errors/track.js +6 -4
  51. package/dist/cjs/feedback/controls.d.ts +6 -0
  52. package/dist/cjs/feedback/controls.js +74 -25
  53. package/dist/cjs/feedback/index.js +1 -1
  54. package/dist/cjs/feedback/logs.d.ts +3 -6
  55. package/dist/cjs/feedback/logs.js +8 -18
  56. package/dist/cjs/feedback/quartz.js +1 -1
  57. package/dist/cjs/feedback/send.d.ts +2 -2
  58. package/dist/cjs/feedback/send.js +4 -27
  59. package/dist/cjs/feedback/styles.js +2 -2
  60. package/dist/cjs/feedback/template.d.ts +1 -1
  61. package/dist/cjs/feedback/template.js +9 -1
  62. package/dist/cjs/feedback/ui.d.ts +7 -0
  63. package/dist/cjs/feedback/ui.js +160 -25
  64. package/dist/cjs/heatmap/send.d.ts +2 -0
  65. package/dist/cjs/heatmap/send.js +3 -5
  66. package/dist/cjs/heatmap/track.js +1 -1
  67. package/dist/cjs/index.d.ts +1 -2
  68. package/dist/cjs/index.js +54 -17
  69. package/dist/cjs/lifecycle.d.ts +13 -2
  70. package/dist/cjs/lifecycle.js +122 -54
  71. package/dist/cjs/remoteconfig/country.js +1 -1
  72. package/dist/cjs/remoteconfig/custom.js +1 -1
  73. package/dist/cjs/remoteconfig/evaluate.js +1 -1
  74. package/dist/cjs/remoteconfig/fetch.d.ts +17 -10
  75. package/dist/cjs/remoteconfig/fetch.js +126 -31
  76. package/dist/cjs/remoteconfig/index.d.ts +13 -4
  77. package/dist/cjs/remoteconfig/index.js +36 -20
  78. package/dist/cjs/remoteconfig/store.d.ts +15 -7
  79. package/dist/cjs/remoteconfig/store.js +68 -35
  80. package/dist/cjs/remoteconfig/tz-countries.js +1 -1
  81. package/dist/cjs/{core → remotelog}/callsite.d.ts +5 -4
  82. package/dist/cjs/{core → remotelog}/callsite.js +6 -5
  83. package/dist/cjs/remotelog/gate.js +1 -1
  84. package/dist/cjs/remotelog/logger.js +2 -2
  85. package/dist/cjs/remotelog/send.js +2 -2
  86. package/dist/cjs/remotelogger/index.js +1 -1
  87. package/dist/cjs/scheduler.d.ts +3 -1
  88. package/dist/cjs/scheduler.js +24 -21
  89. package/dist/cjs/types.d.ts +61 -16
  90. package/dist/cjs/user/index.js +6 -2
  91. package/dist/esm/core/attempts.js +1 -1
  92. package/dist/esm/core/batch.js +1 -2
  93. package/dist/esm/core/consent.d.ts +13 -3
  94. package/dist/esm/core/consent.js +24 -11
  95. package/dist/esm/core/constants.d.ts +22 -17
  96. package/dist/esm/core/constants.js +22 -19
  97. package/dist/esm/core/db.js +1 -1
  98. package/dist/esm/core/debug.js +1 -1
  99. package/dist/esm/core/env.d.ts +0 -3
  100. package/dist/esm/core/env.js +2 -9
  101. package/dist/esm/core/framework-id.d.ts +1 -1
  102. package/dist/esm/core/framework-id.js +3 -3
  103. package/dist/esm/core/guard.js +1 -1
  104. package/dist/esm/core/hooks.d.ts +5 -0
  105. package/dist/esm/core/hooks.js +2 -1
  106. package/dist/esm/core/locks.js +1 -1
  107. package/dist/esm/core/logger.js +1 -1
  108. package/dist/esm/core/state.d.ts +6 -4
  109. package/dist/esm/core/state.js +2 -4
  110. package/dist/esm/core/storage.js +1 -4
  111. package/dist/esm/core/stylesheet.js +1 -1
  112. package/dist/esm/core/transport.js +13 -16
  113. package/dist/esm/core/utils.js +1 -1
  114. package/dist/esm/core/validate.js +1 -1
  115. package/dist/esm/device/appversion.d.ts +10 -1
  116. package/dist/esm/device/appversion.js +26 -4
  117. package/dist/esm/device/index.d.ts +17 -2
  118. package/dist/esm/device/index.js +195 -30
  119. package/dist/esm/engagement/api-rules.js +1 -1
  120. package/dist/esm/engagement/auto-api.js +1 -1
  121. package/dist/esm/engagement/auto-screen.js +1 -1
  122. package/dist/esm/engagement/defined-events.js +1 -1
  123. package/dist/esm/engagement/send.js +7 -3
  124. package/dist/esm/engagement/session.d.ts +17 -0
  125. package/dist/esm/engagement/session.js +93 -5
  126. package/dist/esm/engagement/track.d.ts +4 -4
  127. package/dist/esm/engagement/track.js +16 -13
  128. package/dist/esm/errors/send.js +2 -2
  129. package/dist/esm/errors/track.d.ts +2 -1
  130. package/dist/esm/errors/track.js +6 -4
  131. package/dist/esm/feedback/controls.d.ts +6 -0
  132. package/dist/esm/feedback/controls.js +74 -26
  133. package/dist/esm/feedback/index.js +1 -1
  134. package/dist/esm/feedback/logs.d.ts +3 -6
  135. package/dist/esm/feedback/logs.js +8 -18
  136. package/dist/esm/feedback/quartz.js +1 -1
  137. package/dist/esm/feedback/send.d.ts +2 -2
  138. package/dist/esm/feedback/send.js +6 -29
  139. package/dist/esm/feedback/styles.js +2 -2
  140. package/dist/esm/feedback/template.d.ts +1 -1
  141. package/dist/esm/feedback/template.js +9 -1
  142. package/dist/esm/feedback/ui.d.ts +7 -0
  143. package/dist/esm/feedback/ui.js +161 -26
  144. package/dist/esm/heatmap/send.d.ts +2 -0
  145. package/dist/esm/heatmap/send.js +3 -5
  146. package/dist/esm/heatmap/track.js +1 -1
  147. package/dist/esm/index.d.ts +1 -2
  148. package/dist/esm/index.js +57 -20
  149. package/dist/esm/lifecycle.d.ts +13 -2
  150. package/dist/esm/lifecycle.js +126 -60
  151. package/dist/esm/remoteconfig/country.js +1 -1
  152. package/dist/esm/remoteconfig/custom.js +1 -1
  153. package/dist/esm/remoteconfig/evaluate.js +1 -1
  154. package/dist/esm/remoteconfig/fetch.d.ts +17 -10
  155. package/dist/esm/remoteconfig/fetch.js +127 -32
  156. package/dist/esm/remoteconfig/index.d.ts +13 -4
  157. package/dist/esm/remoteconfig/index.js +36 -20
  158. package/dist/esm/remoteconfig/store.d.ts +15 -7
  159. package/dist/esm/remoteconfig/store.js +68 -36
  160. package/dist/esm/remoteconfig/tz-countries.js +1 -1
  161. package/dist/esm/{core → remotelog}/callsite.d.ts +5 -4
  162. package/dist/esm/{core → remotelog}/callsite.js +6 -5
  163. package/dist/esm/remotelog/gate.js +1 -1
  164. package/dist/esm/remotelog/logger.js +2 -2
  165. package/dist/esm/remotelog/send.js +2 -2
  166. package/dist/esm/remotelogger/index.js +1 -1
  167. package/dist/esm/scheduler.d.ts +3 -1
  168. package/dist/esm/scheduler.js +25 -23
  169. package/dist/esm/types.d.ts +61 -16
  170. package/dist/esm/user/index.js +7 -3
  171. package/dist/feedback.esm.min.js +2 -2
  172. package/dist/feedback.esm.min.js.map +1 -1
  173. package/dist/remoteconfig.esm.min.js +3 -0
  174. package/dist/remoteconfig.esm.min.js.map +1 -0
  175. package/dist/remotelogger.esm.min.js +3 -0
  176. package/dist/remotelogger.esm.min.js.map +1 -0
  177. package/package.json +3 -2
  178. package/dist/chunks/lifecycle-VYr43KcB.min.js +0 -3
  179. package/dist/chunks/lifecycle-VYr43KcB.min.js.map +0 -1
  180. package/dist/cjs/auto-init.d.ts +0 -8
  181. package/dist/cjs/auto-init.js +0 -32
  182. package/dist/esm/auto-init.d.ts +0 -8
  183. package/dist/esm/auto-init.js +0 -29
@@ -1,11 +1,12 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  /**
3
- * Where a log line was raised, for logSDK's `filename` and `linenumber`.
3
+ * Where in the app an AppticsLogger line was written, for logSDK's `filename`, `linenumber` and
4
+ * `function`: the Remote Logger page shows each line with them.
4
5
  *
5
6
  * There is no caller introspection in a browser, so the only way to answer "which line was this"
6
- * is to throw an Error nobody catches and read its stack. That is cheap enough for a channel that
7
- * only carries the SDK's own failures, but it is never on the app's path: everything here is
8
- * wrapped so a stack we cannot parse costs a line its call site and nothing more.
7
+ * is to make an Error and read its stack, skipping the SDK's own frames. That costs a little on
8
+ * every line the app logs, and nothing on any other call. Everything here is wrapped so a stack
9
+ * that cannot be parsed costs a line its call site and nothing more: the line is still logged.
9
10
  */
10
11
  const NO_CALL_SITE = { filename: '', linenumber: 0, fn: '' };
11
12
  /**
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { _ZAP } from '../core/state.js';
3
3
  import { is_apptics_disabled } from '../core/env.js';
4
4
  import { shouldTrackOrSendData } from '../core/consent.js';
@@ -1,6 +1,6 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { LOG_FUNCTION_MAX } from '../core/constants.js';
3
- import { callSite } from '../core/callsite.js';
3
+ import { callSite } from './callsite.js';
4
4
  import { remotelog_transactions } from '../core/storage.js';
5
5
  import { guard } from '../core/guard.js';
6
6
  import { nowMs } from '../core/utils.js';
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { LOG_FUNCTION_MAX, CONSOLE_LOG_MAX_BODY, REMOTE_LOG_LEVEL, LOG_FILENAME_MAX } from '../core/constants.js';
3
3
  import { _ZAP } from '../core/state.js';
4
4
  import { warnAlways, Console } from '../core/logger.js';
@@ -40,7 +40,7 @@ function entryFor(item) {
40
40
  var entry = {
41
41
  sessionstarttime: _ZAP._current_session.starttime || item.happenedat || nowMs(),
42
42
  logtime: item.happenedat || nowMs(),
43
- // an app's line carries the level it was logged at; the SDK's own failures carry none
43
+ // an app's line carries the level it was logged at; only a line an older SDK stored has none
44
44
  level: Number(item.level) || REMOTE_LOG_LEVEL,
45
45
  logmessage: String(item.exceptionlog).slice(0, CONSOLE_LOG_MAX_BODY),
46
46
  function: String(item.module || 'SDK').slice(0, LOG_FUNCTION_MAX), // no i18n
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { AppticsLogger } from '../remotelog/logger.js';
3
3
 
4
4
  /**
@@ -3,6 +3,8 @@
3
3
  * response (page hide), so they survive the page going away.
4
4
  */
5
5
  export declare function flush(forget?: boolean): Promise<void>;
6
- /** Starts the flush and getupdates intervals once; later calls do nothing until stopTimers(). */
6
+ /** Apptics.flush(): flush(), at most once every CALLED_FLUSH_GAP_MS. A call sooner sends nothing. */
7
+ export declare function calledFlush(): Promise<void>;
8
+ /** Starts the flush interval once; later calls do nothing until stopTimers(). */
7
9
  export declare function startTimers(): void;
8
10
  export declare function stopTimers(): void;
@@ -1,13 +1,13 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { _ZAP, getConfig } from './core/state.js';
3
- import { nowMs } from './core/utils.js';
4
3
  import { Console } from './core/logger.js';
4
+ import { nowMs } from './core/utils.js';
5
5
  import { canTrack } from './core/consent.js';
6
6
  import { clearDefer } from './core/batch.js';
7
7
  import { sendEngagementData } from './engagement/send.js';
8
8
  import { sendErrorData } from './errors/send.js';
9
9
  import { hooks } from './core/hooks.js';
10
- import { getUpdatesFromServer } from './device/index.js';
10
+ import { stopServerSettingChecks } from './device/index.js';
11
11
  import { expireDebugIfIdle } from './core/debug.js';
12
12
 
13
13
  /**
@@ -27,9 +27,26 @@ function flush(forget) {
27
27
  return hooks.sendHeatmaps(forget);
28
28
  });
29
29
  }
30
+ /**
31
+ * How often Apptics.flush() sends when it is called by hand, from the console or the app's own
32
+ * code: once every 15 seconds, however often it is called. The SDK's own sends (the flush
33
+ * interval, page hide and close, back online) call flush() directly and are not held to it.
34
+ */
35
+ const CALLED_FLUSH_GAP_MS = 15 * 1000;
36
+ /** When Apptics.flush() last sent; 0 until it has. */
37
+ var calledFlushAt = 0;
38
+ /** Apptics.flush(): flush(), at most once every CALLED_FLUSH_GAP_MS. A call sooner sends nothing. */
39
+ function calledFlush() {
40
+ var now = nowMs();
41
+ if (calledFlushAt > 0 && now - calledFlushAt < CALLED_FLUSH_GAP_MS) {
42
+ Console.log('Apptics.flush: sent ' + (now - calledFlushAt) + ' ms ago; it sends at most once every ' + CALLED_FLUSH_GAP_MS + ' ms, and the timer sends the rest'); // no i18n
43
+ return Promise.resolve();
44
+ }
45
+ calledFlushAt = now;
46
+ return flush();
47
+ }
30
48
  var sendingInterval = null;
31
- var getUpdatesInterval = null;
32
- /** Starts the flush and getupdates intervals once; later calls do nothing until stopTimers(). */
49
+ /** Starts the flush interval once; later calls do nothing until stopTimers(). */
33
50
  function startTimers() {
34
51
  if (sendingInterval === null) {
35
52
  sendingInterval = setInterval(function () {
@@ -46,29 +63,14 @@ function startTimers() {
46
63
  });
47
64
  }, getConfig('batch_flush_interval')); // no i18n
48
65
  }
49
- if (getUpdatesInterval === null) {
50
- // the interval is the floor, not the schedule: getsdkconfig answers with next_check_after,
51
- // and asking again before then is a call the server has already told us it will not answer
52
- // differently. The timer still ticks so a server that sends no hint behaves as before.
53
- getUpdatesInterval = setInterval(function () {
54
- if (_ZAP._nextConfigCheck > 0 && nowMs() < _ZAP._nextConfigCheck) {
55
- return;
56
- }
57
- Console.log('scheduleToGetUpdatesFromServer: asking the server for its config'); // no i18n
58
- getUpdatesFromServer().catch(function (err) {
59
- Console.log(err);
60
- });
61
- }, getConfig('getupdates_interval')); // no i18n
62
- }
63
66
  }
64
67
  function stopTimers() {
65
68
  if (sendingInterval !== null)
66
69
  clearInterval(sendingInterval);
67
- if (getUpdatesInterval !== null)
68
- clearInterval(getUpdatesInterval);
69
70
  sendingInterval = null;
70
- getUpdatesInterval = null;
71
71
  clearDefer();
72
+ stopServerSettingChecks();
73
+ calledFlushAt = 0;
72
74
  }
73
75
 
74
- export { flush, startTimers, stopTimers };
76
+ export { calledFlush, flush, startTimers, stopTimers };
@@ -37,7 +37,7 @@ export interface ServerResult<T = Dict> {
37
37
  export type TrackingStatus = (typeof AP_TRACKING_STATUS)[keyof typeof AP_TRACKING_STATUS];
38
38
  export type FeedbackType = (typeof AP_FEEDBACK_TYPE)[keyof typeof AP_FEEDBACK_TYPE];
39
39
  export type Properties = Record<string, unknown>;
40
- /** The config init() requires. The console snippet provides the same shape as window.appticssettings._defaultoptions. */
40
+ /** The config init() requires. */
41
41
  export interface AppticsConfig {
42
42
  /** Apptics host every request goes to, e.g. https://apptics.zoho.com (a trailing slash is ignored). Was `serviceUrl`. */
43
43
  base_url: string;
@@ -87,6 +87,18 @@ export interface AppticsConfig {
87
87
  * navigation replaces its automatic view; set this false to track only the app's own calls.
88
88
  */
89
89
  track_screen?: boolean;
90
+ /**
91
+ * Record uncaught errors and unhandled promise rejections automatically. On by default; set this
92
+ * false to record only the errors the app hands to AppticsError.trackError(). Switched later with
93
+ * AppticsError.setErrorTracking().
94
+ */
95
+ track_error?: boolean;
96
+ /**
97
+ * Record clicks on elements tagged `apeventaction` (or `data-apeventaction`) as events, in the
98
+ * group of the nearest `apgroupaction` around them. On by default; switched later with
99
+ * AppticsEvent.setClickTracking().
100
+ */
101
+ track_click?: boolean;
90
102
  /**
91
103
  * How automatic screen tracking names a path, tried in order; the first that matches wins, and a
92
104
  * path none matches keeps its own name. Each entry is one of:
@@ -105,13 +117,19 @@ export interface AppticsConfig {
105
117
  feedback_theme?: 'light' | 'dark' | 'auto';
106
118
  /** How often queued data is sent, in milliseconds. Default 30000, at least 1000. */
107
119
  batch_flush_interval?: number;
108
- /** How often the server's tracking flags are fetched, in milliseconds. Default 120000, at least 10000. */
120
+ /**
121
+ * How long to wait before reading the server's tracking settings again, in milliseconds, when its
122
+ * answer gives no time for the next check (next_check_after). Default 120000, at least 10000.
123
+ */
109
124
  getupdates_interval?: number;
110
125
  /** Most items in one batch. Default 50, between 1 and 500. */
111
126
  batch_size?: number;
112
127
  /** Days an unsent item is kept before it is dropped. Default 7, between 1 and 30. */
113
128
  batch_request_timeout?: number;
114
- /** Idle minutes that end a session. Default 30, between 1 and 1440. */
129
+ /**
130
+ * Minutes a tab can be inactive (hidden, minimised, in the background) before its session ends,
131
+ * at the moment the user left. Default 30, between 1 and 1440.
132
+ */
115
133
  inactiveduration?: number;
116
134
  /**
117
135
  * How long a visit must last before its session is recorded, in milliseconds. Default 5000, at
@@ -120,8 +138,8 @@ export interface AppticsConfig {
120
138
  */
121
139
  min_session_duration?: number;
122
140
  /**
123
- * Record where people click and how far they scroll. Off by default; AppticsHeatmap.trackHeatmap()
124
- * switches it later.
141
+ * Record where people click and how far they scroll. Off by default;
142
+ * AppticsHeatmap.setHeatmapTracking() switches it later.
125
143
  */
126
144
  track_heatmap?: boolean;
127
145
  /** Most heatmap records one visit may produce. Default 500; capture pauses past it. */
@@ -175,8 +193,9 @@ export interface QuartzApi {
175
193
  quartzBranding: boolean;
176
194
  }): void;
177
195
  clearFeedback(): void;
178
- endRecording(): void;
179
- setVideoContent(element: Element | null): void;
196
+ /** Resolves once the recording has ended and is stored; Quartz's own build returns a Promise. */
197
+ endRecording(): Promise<unknown> | void;
198
+ setVideoContent(element: Element | null): Promise<unknown> | void;
180
199
  submitRecording(details: {
181
200
  email: string;
182
201
  subject: string;
@@ -256,7 +275,7 @@ export interface SendFeedbackOptions {
256
275
  attachments?: FileList | File[] | null;
257
276
  /** Log files of the app's own to send along. */
258
277
  logFiles?: FileList | File[] | null;
259
- /** The addDiagnosticsInfo() entries and the device's details: unset sends them when there are entries waiting. */
278
+ /** The addDiagnosticsInfo() entries: unset sends them when there are any, false never does. */
260
279
  includeDiagnostics?: boolean;
261
280
  /** The addFeedbackLog() lines: unset sends them when there are any, false never does. */
262
281
  includeLog?: boolean;
@@ -305,11 +324,15 @@ export interface AppticsFeedbackApi {
305
324
  export interface AppticsSdk {
306
325
  /** Android's Apptics: starting the SDK, and what applies to all of it. */
307
326
  Apptics: {
308
- /** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
327
+ /** Starts the SDK with the app's config object, which is required. */
309
328
  init(config: AppticsConfig): boolean;
310
329
  /** Resolves true once start-up (storage load, device, session) has finished; false if it can't start. */
311
330
  ready(): Promise<boolean>;
312
- /** Sends stored engagements, errors and heatmap records now; resolves once they have gone out. */
331
+ /**
332
+ * Sends stored engagements, errors and heatmap records now; resolves once they have gone out.
333
+ * At most once every 15 seconds: a call sooner than that sends nothing and resolves at once,
334
+ * and what is queued goes with the next timed send.
335
+ */
313
336
  flush(): Promise<void>;
314
337
  /** Clears stored identity, queued data and remote config values, then starts again. */
315
338
  reset(): void;
@@ -326,10 +349,15 @@ export interface AppticsSdk {
326
349
  AppticsEvent: {
327
350
  /** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
328
351
  DefinedEvents: typeof DefinedEvents;
329
- /** An event. An invalid name or group is not logged; a group left out is `default`. */
330
- addEvent(eventName: string, groupName?: string, properties?: Properties): void;
352
+ /** An event. The group is required: an event without one, or with an invalid name or group, is not logged, and the console says why. */
353
+ addEvent(eventName: string, groupName: string, properties?: Properties): void;
331
354
  /** A defined event (AppticsEvent.DefinedEvents.AP_USER_LOGIN, …), which brings its own group. */
332
355
  addEvent(definedEvent: DefinedEvent, properties?: Properties): void;
356
+ /**
357
+ * Turns click tracking from markup (`apeventaction`) on or off after Apptics.init(); `enabled`
358
+ * defaults to true. The `track_click` config flag sets it at start-up.
359
+ */
360
+ setClickTracking(enabled?: boolean): void;
333
361
  };
334
362
  /** Android's AppticsScreenTracker. */
335
363
  AppticsScreen: {
@@ -337,6 +365,11 @@ export interface AppticsSdk {
337
365
  inScreen(screenName: string, properties?: Properties): string;
338
366
  /** Ends the screen view inScreen began, before the next screen would. */
339
367
  outScreen(id: string): void;
368
+ /**
369
+ * Turns automatic screen tracking on or off after Apptics.init(); `enabled` defaults to true.
370
+ * The `track_screen` config flag sets it at start-up. inScreen() records either way.
371
+ */
372
+ setScreenTracking(enabled?: boolean): void;
340
373
  };
341
374
  /** Android's AppticsApiTracker. */
342
375
  AppticsApi: {
@@ -349,16 +382,23 @@ export interface AppticsSdk {
349
382
  /** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
350
383
  configure(config: ApiTrackingConfig | ApiTrackingBuilder): void;
351
384
  /**
352
- * Turns automatic API tracking on or off after Apptics.init(). Equivalent to the `track_api`
353
- * config flag, which is the usual way to set it.
385
+ * Turns automatic API tracking on or off after Apptics.init(); `enabled` defaults to true.
386
+ * The `track_api` config flag sets it at start-up.
354
387
  */
388
+ setApiTracking(enabled?: boolean): void;
389
+ /** @deprecated renamed setApiTracking; this name still works, with a console warning */
355
390
  enableApiTracking(enabled?: boolean): void;
356
391
  };
357
392
  /** Errors the app caught, and the switch for tracking uncaught ones. */
358
393
  AppticsError: {
359
394
  /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
360
395
  trackError(error: ErrorLike, properties?: Properties): void;
361
- /** Turns the automatic tracking of uncaught errors and unhandled rejections on or off. */
396
+ /**
397
+ * Turns the automatic tracking of uncaught errors and unhandled rejections on or off after
398
+ * Apptics.init(); `enabled` defaults to true. The `track_error` config flag sets it at start-up.
399
+ */
400
+ setErrorTracking(enabled?: boolean): void;
401
+ /** @deprecated renamed setErrorTracking; this name still works, with a console warning */
362
402
  trackGlobalErrorHandler(enabled?: boolean): void;
363
403
  };
364
404
  /** Android's AppticsUser. */
@@ -372,7 +412,12 @@ export interface AppticsSdk {
372
412
  };
373
413
  /** Click and scroll capture for the console's heatmaps. */
374
414
  AppticsHeatmap: {
375
- /** Starts or stops recording clicks and scrolls; `on` defaults to true. */
415
+ /**
416
+ * Starts or stops recording clicks and scrolls; `enabled` defaults to true. The
417
+ * `track_heatmap` config flag sets it at start-up.
418
+ */
419
+ setHeatmapTracking(enabled?: boolean): void;
420
+ /** @deprecated renamed setHeatmapTracking; this name still works, with a console warning */
376
421
  trackHeatmap(on?: boolean): void;
377
422
  };
378
423
  /** Android's AppticsSettings: what the SDK may track for this visitor. */
@@ -1,10 +1,10 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  import { AP_LOG_MODULE, AP_TRACKING_STATUS } from '../core/constants.js';
3
3
  import { _ZAP } from '../core/state.js';
4
4
  import { logFailure, Console } from '../core/logger.js';
5
5
  import { isEmpty, nowMs, isEmptyObj, cloneMapExcludingKeys } from '../core/utils.js';
6
6
  import { user_defaults } from '../core/storage.js';
7
- import { canTrack, setTrackingStatus } from '../core/consent.js';
7
+ import { canTrack, recordTrackingStatus } from '../core/consent.js';
8
8
  import { rejectIfDisabled, rejectIfOffline, rejectIfNoDeviceIds, postToApptics, apiHeaders } from '../core/transport.js';
9
9
  import { userValidateJSON } from '../core/validate.js';
10
10
  import { hooks } from '../core/hooks.js';
@@ -102,11 +102,15 @@ function registerUserWithApptics(user_info) {
102
102
  var data = result.data || {};
103
103
  user_info.userid = data.userid;
104
104
  user_info.groupid = data.customergroupid;
105
- setTrackingStatus(AP_TRACKING_STATUS.USAGE_TRACKING_WITH_PII);
105
+ // stored only: user/register has told the server, and the device is registered already
106
+ recordTrackingStatus(AP_TRACKING_STATUS.USAGE_TRACKING_WITH_PII);
106
107
  addOrUpdateUser(user_info);
107
108
  getUserInfo();
108
109
  // the user and their customer group are known now: remote config conditions on them re-apply
109
110
  hooks.remoteConfigUserChanged();
111
+ // getsdkconfig answers for the user (with every module off for one whose customer group
112
+ // is not tracked, customergrouptracking: false), so it is asked again for them now
113
+ hooks.askServerSettings();
110
114
  return data;
111
115
  });
112
116
  }