@zoho_apptics/apptics-js-sdk 2.0.0-beta → 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 (236) hide show
  1. package/CHANGELOG.md +191 -21
  2. package/README.md +519 -333
  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 +2 -2
  13. package/dist/cjs/core/consent.d.ts +18 -4
  14. package/dist/cjs/core/consent.js +31 -15
  15. package/dist/cjs/core/constants.d.ts +57 -27
  16. package/dist/cjs/core/constants.js +52 -33
  17. package/dist/cjs/core/db.d.ts +12 -4
  18. package/dist/cjs/core/db.js +167 -34
  19. package/dist/cjs/core/debug.js +1 -1
  20. package/dist/cjs/core/env.d.ts +0 -3
  21. package/dist/cjs/core/env.js +1 -9
  22. package/dist/cjs/core/framework-id.d.ts +1 -1
  23. package/dist/cjs/core/framework-id.js +3 -3
  24. package/dist/cjs/core/guard.d.ts +9 -0
  25. package/dist/cjs/core/guard.js +27 -13
  26. package/dist/cjs/core/hooks.d.ts +7 -4
  27. package/dist/cjs/core/hooks.js +3 -3
  28. package/dist/cjs/core/locks.d.ts +9 -0
  29. package/dist/cjs/core/locks.js +22 -0
  30. package/dist/cjs/core/logger.d.ts +3 -4
  31. package/dist/cjs/core/logger.js +4 -40
  32. package/dist/cjs/core/state.d.ts +9 -6
  33. package/dist/cjs/core/state.js +3 -5
  34. package/dist/cjs/core/storage.d.ts +20 -5
  35. package/dist/cjs/core/storage.js +115 -20
  36. package/dist/cjs/core/stylesheet.d.ts +8 -0
  37. package/dist/cjs/core/stylesheet.js +29 -0
  38. package/dist/cjs/core/transport.d.ts +2 -0
  39. package/dist/cjs/core/transport.js +30 -18
  40. package/dist/cjs/core/utils.js +1 -1
  41. package/dist/cjs/core/validate.js +2 -2
  42. package/dist/cjs/device/appversion.d.ts +10 -6
  43. package/dist/cjs/device/appversion.js +38 -3
  44. package/dist/cjs/device/index.d.ts +28 -2
  45. package/dist/cjs/device/index.js +312 -44
  46. package/dist/cjs/engagement/api-rules.d.ts +32 -67
  47. package/dist/cjs/engagement/api-rules.js +144 -157
  48. package/dist/cjs/engagement/auto-api.js +2 -2
  49. package/dist/cjs/engagement/auto-screen.d.ts +2 -0
  50. package/dist/cjs/engagement/auto-screen.js +67 -3
  51. package/dist/cjs/engagement/defined-events.js +1 -1
  52. package/dist/cjs/engagement/send.js +12 -3
  53. package/dist/cjs/engagement/session.d.ts +29 -3
  54. package/dist/cjs/engagement/session.js +253 -26
  55. package/dist/cjs/engagement/track.d.ts +4 -4
  56. package/dist/cjs/engagement/track.js +58 -30
  57. package/dist/cjs/errors/send.js +2 -2
  58. package/dist/cjs/errors/track.d.ts +2 -1
  59. package/dist/cjs/errors/track.js +49 -7
  60. package/dist/cjs/feedback/controls.d.ts +12 -0
  61. package/dist/cjs/feedback/controls.js +104 -25
  62. package/dist/cjs/feedback/index.d.ts +8 -7
  63. package/dist/cjs/feedback/index.js +32 -13
  64. package/dist/cjs/feedback/logs.d.ts +13 -11
  65. package/dist/cjs/feedback/logs.js +57 -28
  66. package/dist/cjs/feedback/quartz.d.ts +18 -0
  67. package/dist/cjs/feedback/quartz.js +105 -0
  68. package/dist/cjs/feedback/send.d.ts +5 -2
  69. package/dist/cjs/feedback/send.js +30 -28
  70. package/dist/cjs/feedback/styles.d.ts +10 -0
  71. package/dist/cjs/feedback/styles.js +8 -0
  72. package/dist/cjs/feedback/template.d.ts +1 -1
  73. package/dist/cjs/feedback/template.js +20 -12
  74. package/dist/cjs/feedback/ui.d.ts +21 -6
  75. package/dist/cjs/feedback/ui.js +283 -70
  76. package/dist/cjs/heatmap/send.d.ts +2 -0
  77. package/dist/cjs/heatmap/send.js +3 -5
  78. package/dist/cjs/heatmap/track.d.ts +1 -1
  79. package/dist/cjs/heatmap/track.js +87 -16
  80. package/dist/cjs/index.d.ts +16 -63
  81. package/dist/cjs/index.js +144 -95
  82. package/dist/cjs/lifecycle.d.ts +21 -3
  83. package/dist/cjs/lifecycle.js +353 -89
  84. package/dist/cjs/remoteconfig/country.d.ts +4 -0
  85. package/dist/cjs/remoteconfig/country.js +73 -0
  86. package/dist/cjs/remoteconfig/custom.d.ts +7 -7
  87. package/dist/cjs/remoteconfig/custom.js +31 -51
  88. package/dist/cjs/remoteconfig/evaluate.d.ts +3 -3
  89. package/dist/cjs/remoteconfig/evaluate.js +56 -43
  90. package/dist/cjs/remoteconfig/fetch.d.ts +16 -9
  91. package/dist/cjs/remoteconfig/fetch.js +120 -39
  92. package/dist/cjs/remoteconfig/index.d.ts +19 -8
  93. package/dist/cjs/remoteconfig/index.js +81 -39
  94. package/dist/cjs/remoteconfig/store.d.ts +15 -7
  95. package/dist/cjs/remoteconfig/store.js +68 -35
  96. package/dist/cjs/remoteconfig/tz-countries.d.ts +8 -0
  97. package/dist/cjs/remoteconfig/tz-countries.js +13 -0
  98. package/dist/{esm/core → cjs/remotelog}/callsite.d.ts +11 -4
  99. package/dist/cjs/{core → remotelog}/callsite.js +30 -7
  100. package/dist/cjs/remotelog/gate.d.ts +2 -11
  101. package/dist/cjs/remotelog/gate.js +9 -35
  102. package/dist/cjs/remotelog/index.d.ts +4 -21
  103. package/dist/cjs/remotelog/logger.d.ts +11 -17
  104. package/dist/cjs/remotelog/logger.js +31 -59
  105. package/dist/cjs/remotelog/send.js +11 -11
  106. package/dist/cjs/remotelogger/index.d.ts +12 -0
  107. package/dist/cjs/remotelogger/index.js +18 -0
  108. package/dist/cjs/scheduler.d.ts +3 -1
  109. package/dist/cjs/scheduler.js +25 -22
  110. package/dist/cjs/types.d.ts +208 -90
  111. package/dist/cjs/user/index.js +16 -7
  112. package/dist/esm/core/attempts.js +1 -1
  113. package/dist/esm/core/batch.js +2 -2
  114. package/dist/esm/core/consent.d.ts +18 -4
  115. package/dist/esm/core/consent.js +32 -17
  116. package/dist/esm/core/constants.d.ts +57 -27
  117. package/dist/esm/core/constants.js +51 -33
  118. package/dist/esm/core/db.d.ts +12 -4
  119. package/dist/esm/core/db.js +164 -35
  120. package/dist/esm/core/debug.js +1 -1
  121. package/dist/esm/core/env.d.ts +0 -3
  122. package/dist/esm/core/env.js +2 -9
  123. package/dist/esm/core/framework-id.d.ts +1 -1
  124. package/dist/esm/core/framework-id.js +3 -3
  125. package/dist/esm/core/guard.d.ts +9 -0
  126. package/dist/esm/core/guard.js +27 -14
  127. package/dist/esm/core/hooks.d.ts +7 -4
  128. package/dist/esm/core/hooks.js +3 -3
  129. package/dist/esm/core/locks.d.ts +9 -0
  130. package/dist/esm/core/locks.js +20 -0
  131. package/dist/esm/core/logger.d.ts +3 -4
  132. package/dist/esm/core/logger.js +4 -40
  133. package/dist/esm/core/state.d.ts +9 -6
  134. package/dist/esm/core/state.js +3 -5
  135. package/dist/esm/core/storage.d.ts +20 -5
  136. package/dist/esm/core/storage.js +113 -21
  137. package/dist/esm/core/stylesheet.d.ts +8 -0
  138. package/dist/esm/core/stylesheet.js +27 -0
  139. package/dist/esm/core/transport.d.ts +2 -0
  140. package/dist/esm/core/transport.js +30 -19
  141. package/dist/esm/core/utils.js +1 -1
  142. package/dist/esm/core/validate.js +2 -2
  143. package/dist/esm/device/appversion.d.ts +10 -6
  144. package/dist/esm/device/appversion.js +37 -4
  145. package/dist/esm/device/index.d.ts +28 -2
  146. package/dist/esm/device/index.js +313 -49
  147. package/dist/esm/engagement/api-rules.d.ts +32 -67
  148. package/dist/esm/engagement/api-rules.js +143 -155
  149. package/dist/esm/engagement/auto-api.js +3 -3
  150. package/dist/esm/engagement/auto-screen.d.ts +2 -0
  151. package/dist/esm/engagement/auto-screen.js +67 -4
  152. package/dist/esm/engagement/defined-events.js +1 -1
  153. package/dist/esm/engagement/send.js +12 -3
  154. package/dist/esm/engagement/session.d.ts +29 -3
  155. package/dist/esm/engagement/session.js +251 -30
  156. package/dist/esm/engagement/track.d.ts +4 -4
  157. package/dist/esm/engagement/track.js +65 -37
  158. package/dist/esm/errors/send.js +2 -2
  159. package/dist/esm/errors/track.d.ts +2 -1
  160. package/dist/esm/errors/track.js +49 -7
  161. package/dist/esm/feedback/controls.d.ts +12 -0
  162. package/dist/esm/feedback/controls.js +103 -26
  163. package/dist/esm/feedback/index.d.ts +8 -7
  164. package/dist/esm/feedback/index.js +34 -13
  165. package/dist/esm/feedback/logs.d.ts +13 -11
  166. package/dist/esm/feedback/logs.js +59 -30
  167. package/dist/esm/feedback/quartz.d.ts +18 -0
  168. package/dist/esm/feedback/quartz.js +99 -0
  169. package/dist/esm/feedback/send.d.ts +5 -2
  170. package/dist/esm/feedback/send.js +31 -31
  171. package/dist/esm/feedback/styles.d.ts +10 -0
  172. package/dist/esm/feedback/styles.js +4 -0
  173. package/dist/esm/feedback/template.d.ts +1 -1
  174. package/dist/esm/feedback/template.js +20 -12
  175. package/dist/esm/feedback/ui.d.ts +21 -6
  176. package/dist/esm/feedback/ui.js +283 -71
  177. package/dist/esm/heatmap/send.d.ts +2 -0
  178. package/dist/esm/heatmap/send.js +3 -5
  179. package/dist/esm/heatmap/track.d.ts +1 -1
  180. package/dist/esm/heatmap/track.js +87 -16
  181. package/dist/esm/index.d.ts +16 -63
  182. package/dist/esm/index.js +148 -83
  183. package/dist/esm/lifecycle.d.ts +21 -3
  184. package/dist/esm/lifecycle.js +359 -98
  185. package/dist/esm/remoteconfig/country.d.ts +4 -0
  186. package/dist/esm/remoteconfig/country.js +70 -0
  187. package/dist/esm/remoteconfig/custom.d.ts +7 -7
  188. package/dist/esm/remoteconfig/custom.js +32 -52
  189. package/dist/esm/remoteconfig/evaluate.d.ts +3 -3
  190. package/dist/esm/remoteconfig/evaluate.js +57 -44
  191. package/dist/esm/remoteconfig/fetch.d.ts +16 -9
  192. package/dist/esm/remoteconfig/fetch.js +120 -39
  193. package/dist/esm/remoteconfig/index.d.ts +19 -8
  194. package/dist/esm/remoteconfig/index.js +82 -40
  195. package/dist/esm/remoteconfig/store.d.ts +15 -7
  196. package/dist/esm/remoteconfig/store.js +68 -36
  197. package/dist/esm/remoteconfig/tz-countries.d.ts +8 -0
  198. package/dist/esm/remoteconfig/tz-countries.js +11 -0
  199. package/dist/{cjs/core → esm/remotelog}/callsite.d.ts +11 -4
  200. package/dist/esm/{core → remotelog}/callsite.js +30 -8
  201. package/dist/esm/remotelog/gate.d.ts +2 -11
  202. package/dist/esm/remotelog/gate.js +10 -32
  203. package/dist/esm/remotelog/index.d.ts +4 -21
  204. package/dist/esm/remotelog/logger.d.ts +11 -17
  205. package/dist/esm/remotelog/logger.js +33 -61
  206. package/dist/esm/remotelog/send.js +13 -13
  207. package/dist/esm/remotelogger/index.d.ts +12 -0
  208. package/dist/esm/remotelogger/index.js +13 -0
  209. package/dist/esm/scheduler.d.ts +3 -1
  210. package/dist/esm/scheduler.js +26 -24
  211. package/dist/esm/types.d.ts +208 -90
  212. package/dist/esm/user/index.js +18 -8
  213. package/dist/feedback.esm.min.js +2 -2
  214. package/dist/feedback.esm.min.js.map +1 -1
  215. package/dist/remoteconfig.esm.min.js +3 -0
  216. package/dist/remoteconfig.esm.min.js.map +1 -0
  217. package/dist/remotelogger.esm.min.js +3 -0
  218. package/dist/remotelogger.esm.min.js.map +1 -0
  219. package/package.json +16 -17
  220. package/dist/chunks/batch-BU_mTpm1.min.js +0 -3
  221. package/dist/chunks/batch-BU_mTpm1.min.js.map +0 -1
  222. package/dist/chunks/logs-Bea5zUW_.min.js +0 -3
  223. package/dist/chunks/logs-Bea5zUW_.min.js.map +0 -1
  224. package/dist/cjs/auto-init.d.ts +0 -8
  225. package/dist/cjs/auto-init.js +0 -32
  226. package/dist/cjs/heatmap/index.d.ts +0 -16
  227. package/dist/cjs/heatmap/index.js +0 -22
  228. package/dist/cjs/remotelog/index.js +0 -55
  229. package/dist/esm/auto-init.d.ts +0 -8
  230. package/dist/esm/auto-init.js +0 -29
  231. package/dist/esm/heatmap/index.d.ts +0 -16
  232. package/dist/esm/heatmap/index.js +0 -17
  233. package/dist/esm/remotelog/index.js +0 -51
  234. package/dist/heatmap.esm.min.js +0 -3
  235. package/dist/heatmap.esm.min.js.map +0 -1
  236. package/dist/style.css +0 -1
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  'use strict';
3
3
 
4
4
  var constants = require('../core/constants.js');
@@ -24,6 +24,12 @@ var debug = require('../core/debug.js');
24
24
  */
25
25
  /** How long the page must be still before a scroll burst counts as one finished gesture. */
26
26
  const SCROLL_IDLE_MS = 150;
27
+ /**
28
+ * How much of the viewport, each way, an element must cover for its scrolling to be the page's.
29
+ * An app whose layout scrolls a content pane instead of the window (most dashboards do) still
30
+ * gets a scroll map; a dropdown list or a small table scrolling on its own is not the page moving.
31
+ */
32
+ const PAGE_SCROLLER_SHARE = 0.5;
27
33
  /** Clicks closer than this in time and space count as one angry repetition. */
28
34
  const RAGE_WINDOW_MS = 1000;
29
35
  const RAGE_RADIUS_PX = 30;
@@ -42,6 +48,10 @@ var scrollStart = 0;
42
48
  var scrollStartX = 0;
43
49
  var scrollStartY = 0;
44
50
  var scrollTimer = null;
51
+ /** What the gesture in progress scrolls: null for the window, else the page's content pane. */
52
+ var scrolling = null;
53
+ /** Where each content pane was after its last gesture, as lastX / lastY are for the window. */
54
+ var paneAt = new WeakMap();
45
55
  /**
46
56
  * Where the page was before the current gesture began.
47
57
  *
@@ -124,7 +134,7 @@ function labelFor(node) {
124
134
  if (!node) {
125
135
  return ''; // no i18n
126
136
  }
127
- var attributes = ['data-ap-label', 'apeventaction', 'aria-label', 'name', 'id', 'title']; // no i18n
137
+ var attributes = ['data-ap-label', 'apeventaction', 'data-apeventaction', 'aria-label', 'name', 'id', 'title']; // no i18n
128
138
  for (var i = 0; i < attributes.length; i++) {
129
139
  var value = node.getAttribute ? node.getAttribute(attributes[i]) : null;
130
140
  if (!utils.isEmpty(value)) {
@@ -280,14 +290,57 @@ function watchForDeadClick(record, target) {
280
290
  }
281
291
  }, DEAD_CLICK_MS);
282
292
  }
283
- function onScroll() {
293
+ /**
294
+ * What a scroll event moved, as a gesture counts it: null for the window (the event's target is
295
+ * the document), the element when it is big enough to be the page's own scrolling, and undefined
296
+ * for anything smaller, which is not recorded.
297
+ */
298
+ function scrollerOf(target) {
299
+ var doc = document;
300
+ // the window and the document are not elements: either is the page itself scrolling
301
+ if (!target || target.nodeType !== 1 || target === doc.documentElement || target === doc.body) {
302
+ return null;
303
+ }
304
+ var el = target;
305
+ var big = el.clientHeight >= (window.innerHeight || 0) * PAGE_SCROLLER_SHARE
306
+ && el.clientWidth >= viewportWidth() * PAGE_SCROLLER_SHARE;
307
+ return big ? el : undefined;
308
+ }
309
+ /** Where a scroller is now. */
310
+ function positionOf(scroller) {
311
+ return scroller === null
312
+ ? { x: Math.round(window.scrollX || window.pageXOffset || 0), y: Math.round(window.scrollY || window.pageYOffset || 0) }
313
+ : { x: Math.round(scroller.scrollLeft || 0), y: Math.round(scroller.scrollTop || 0) };
314
+ }
315
+ /**
316
+ * Where a scroller was before this gesture: what the last one left. A content pane seen for the
317
+ * first time is taken to have been at its top, which is where a pane starts.
318
+ */
319
+ function startOf(scroller) {
320
+ if (scroller === null) {
321
+ return { x: lastX, y: lastY };
322
+ }
323
+ return paneAt.get(scroller) || { x: 0, y: 0 };
324
+ }
325
+ function onScroll(event) {
284
326
  if (!consent.canTrackHeatmap('heatmap') || !underCap()) { // no i18n
285
327
  return;
286
328
  }
329
+ var scroller = scrollerOf(event ? event.target : null);
330
+ if (scroller === undefined) {
331
+ return;
332
+ }
333
+ if (scrollTimer !== null && scroller !== scrolling) {
334
+ // another scroller started moving: the gesture on the first one is over
335
+ clearTimeout(scrollTimer);
336
+ endScrollGesture();
337
+ }
287
338
  if (scrollTimer === null) {
339
+ scrolling = scroller;
340
+ var start = startOf(scroller);
288
341
  scrollStart = utils.nowMs();
289
- scrollStartX = lastX;
290
- scrollStartY = lastY;
342
+ scrollStartX = start.x;
343
+ scrollStartY = start.y;
291
344
  }
292
345
  else {
293
346
  clearTimeout(scrollTimer);
@@ -297,13 +350,21 @@ function onScroll() {
297
350
  /** One record for the whole burst, once the page has been still for SCROLL_IDLE_MS. */
298
351
  function endScrollGesture() {
299
352
  scrollTimer = null;
353
+ var scroller = scrolling;
354
+ scrolling = null;
300
355
  try {
301
- var endX = Math.round(window.scrollX || 0);
302
- var endY = Math.round(window.scrollY || 0);
356
+ var end = positionOf(scroller);
357
+ var endX = end.x;
358
+ var endY = end.y;
303
359
  var dx = endX - scrollStartX;
304
360
  var dy = endY - scrollStartY;
305
- lastX = endX;
306
- lastY = endY;
361
+ if (scroller === null) {
362
+ lastX = endX;
363
+ lastY = endY;
364
+ }
365
+ else {
366
+ paneAt.set(scroller, end);
367
+ }
307
368
  if (dx === 0 && dy === 0) {
308
369
  return;
309
370
  }
@@ -312,8 +373,14 @@ function endScrollGesture() {
312
373
  var direction = Math.abs(dy) >= Math.abs(dx)
313
374
  ? (dy > 0 ? 'down-scroll' : 'up-scroll') // no i18n
314
375
  : (dx > 0 ? 'right-scroll' : 'left-scroll'); // no i18n
315
- var height = contentHeight() || 1;
316
- store(Object.assign(common(), {
376
+ // the depth is of what scrolled: the document, or the content pane and its own content
377
+ var height = (scroller === null ? contentHeight() : scroller.scrollHeight) || 1;
378
+ var visible = scroller === null ? (window.innerHeight || 0) : scroller.clientHeight;
379
+ store(Object.assign(common(), scroller === null ? {} : {
380
+ content_height: scroller.scrollHeight,
381
+ scroll_offset_x: endX,
382
+ scroll_offset_y: endY,
383
+ }, {
317
384
  // the server accepts only event|default|buttonclick here; what kind of movement it
318
385
  // was belongs in gesture_type. input_type is left off rather than invented: a wheel
319
386
  // carries no pointer type, and the intended vocabulary has no value for "unknown"
@@ -326,7 +393,7 @@ function endScrollGesture() {
326
393
  coordinate_y: endY,
327
394
  normalized_x: 0,
328
395
  // how far down the page the gesture left them, which is what a scroll map reads
329
- normalized_y: fraction(endY + (window.innerHeight || 0), height),
396
+ normalized_y: fraction(endY + visible, height),
330
397
  velocity: Math.round((distance / duration) * 1000),
331
398
  is_clickable: 0,
332
399
  is_rage_click: 0,
@@ -338,7 +405,7 @@ function endScrollGesture() {
338
405
  }
339
406
  }
340
407
  /** Turns capture on or off. Listeners are passive, so they never delay a click or a scroll. */
341
- function enableHeatmap(status) {
408
+ function trackHeatmap(status) {
342
409
  var wanted = typeof status === 'boolean' ? status : true; // no i18n
343
410
  if (wanted === installed) {
344
411
  return;
@@ -355,10 +422,13 @@ function enableHeatmap(status) {
355
422
  }
356
423
  window.removeEventListener('pointerdown', onPointerDown, true); // no i18n
357
424
  window.removeEventListener('scroll', onScroll, true); // no i18n
425
+ // a gesture still settling when capture stops (a single-page app leaving a heatmap page) is
426
+ // recorded as it stands, not dropped: it was the visitor's last scroll on that page
358
427
  if (scrollTimer !== null) {
359
428
  clearTimeout(scrollTimer);
360
- scrollTimer = null;
429
+ endScrollGesture();
361
430
  }
431
+ scrolling = null;
362
432
  installed = false;
363
433
  logger.Console.log('apptics.heatmap: capture stopped'); // no i18n
364
434
  }
@@ -368,10 +438,11 @@ function resetHeatmapSession() {
368
438
  recentClicks = [];
369
439
  lastX = 0;
370
440
  lastY = 0;
441
+ paneAt = new WeakMap();
371
442
  }
372
443
  // init() and reset() drive capture through these, so neither has to import this module
373
- hooks.hooks.enableHeatmap = enableHeatmap;
444
+ hooks.hooks.trackHeatmap = trackHeatmap;
374
445
  hooks.hooks.resetHeatmap = resetHeatmapSession;
375
446
 
376
- exports.enableHeatmap = enableHeatmap;
377
447
  exports.resetHeatmapSession = resetHeatmapSession;
448
+ exports.trackHeatmap = trackHeatmap;
@@ -1,68 +1,21 @@
1
- import { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS } from './core/constants.js';
2
- import { init as initImpl, ready as readyImpl, reset as resetImpl } from './lifecycle.js';
3
- import { enableApiTracking as enableApiTrackingImpl } from './engagement/auto-api.js';
4
- import { DefinedEvents } from './engagement/defined-events.js';
5
- import { ApiTrackingBuilder } from './engagement/api-rules.js';
6
- import { enableGlobalErrorHandler as enableGlobalErrorHandlerImpl } from './errors/track.js';
7
- import { getUser as getUserImpl, UserBuilder, users } from './user/index.js';
8
- import { getTrackingStatus as getTrackingStatusImpl, setTrackingStatus as setTrackingStatusImpl } from './core/consent.js';
9
- import { flush as flushImpl } from './scheduler.js';
10
- import { addDiagnosticsInfo as addDiagnosticsInfoImpl, addFeedbackLog as addFeedbackLogImpl } from './feedback/logs.js';
11
- import type { AppticsApi } from './types.js';
12
- import { disableDebug as disableDebugImpl, enableDebug as enableDebugImpl } from './core/debug.js';
13
- import { AppticsLogger } from './remotelog/logger.js';
14
- export type { AppticsLogger as AppticsLoggerApi } from './remotelog/logger.js';
15
- export type { AppticsApi, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
16
- /** Android's Apptics: `Apptics.init(config)` starts the SDK. */
17
- export declare const Apptics: {
18
- /** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
19
- init: typeof initImpl;
20
- };
21
- export declare const ready: typeof readyImpl;
22
- /** Android's AppticsEvents: `addEvent(name, group?, properties?)`, or `addEvent(DefinedEvents.X, properties?)`. */
23
- export declare const AppticsEvents: {
24
- addEvent: AppticsApi["AppticsEvents"]["addEvent"];
25
- };
26
- /** Apptics' defined events, as Android's DefinedEvents, to log with AppticsEvents.addEvent. */
27
- export { DefinedEvents };
1
+ import type { AppticsSdk } from './types.js';
2
+ export type { AppticsSdk, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
3
+ /** Android's Apptics: starting the SDK, and what applies to all of it. */
4
+ export declare const Apptics: AppticsSdk['Apptics'];
5
+ export declare const AppticsEvent: AppticsSdk['AppticsEvent'];
28
6
  export type { DefinedEvent } from './engagement/defined-events.js';
29
7
  /** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
30
- export declare const AppticsScreenTracker: AppticsApi['AppticsScreenTracker'];
8
+ export declare const AppticsScreen: AppticsSdk['AppticsScreen'];
31
9
  /** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
32
- export declare const AppticsApiTracker: AppticsApi['AppticsApiTracker'];
33
- export { ApiTrackingBuilder };
10
+ export declare const AppticsApi: AppticsSdk['AppticsApi'];
34
11
  export type { ApiTrackingConfig } from './engagement/api-rules.js';
35
- /** Turns automatic API tracking on or off; the `track_api` config flag is the usual way to set it. */
36
- export declare const enableApiTracking: typeof enableApiTrackingImpl;
37
- /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
38
- export declare const AppticsTrackError: AppticsApi["AppticsTrackError"];
39
- export declare const enableGlobalErrorHandler: typeof enableGlobalErrorHandlerImpl;
40
- /** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
41
- export declare const AppticsSetUser: AppticsApi["AppticsSetUser"];
42
- export declare const getUser: typeof getUserImpl;
43
- export declare const setTrackingStatus: typeof setTrackingStatusImpl;
44
- export declare const getTrackingStatus: typeof getTrackingStatusImpl;
45
- export declare const flush: typeof flushImpl;
46
- /** Records a line for the next feedback submission. Costs nothing until feedback is sent. */
47
- export declare const addFeedbackLog: typeof addFeedbackLogImpl;
48
- /** Records a diagnostics key/value, grouped under `heading`, for the next feedback submission. */
49
- export declare const addDiagnosticsInfo: typeof addDiagnosticsInfoImpl;
50
- /**
51
- * Turns debug mode on; works before init(), and wins over `debug` in init().
52
- *
53
- * On, engagement, exception and log go to their `debug/` twins and the answers carry a request id
54
- * and a link into the server's own logs. It switches itself off after an hour with nothing
55
- * tracked, so a forgotten tab stops tracing on its own.
56
- */
57
- export declare const enableDebug: typeof enableDebugImpl;
58
- /** Turns debug mode off; works before init(), and wins over `debug` in init(). */
59
- export declare const disableDebug: typeof disableDebugImpl;
60
- export declare const reset: typeof resetImpl;
61
- /**
62
- * Android's AppticsLogger, shown on the console's Remote Logger page. Off until
63
- * `AppticsLogger.enable()`; then `AppticsLogger.v / d / i / w / e(tag, message, ...details)`.
64
- */
65
- export { AppticsLogger };
66
- export { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS, UserBuilder, users };
67
- declare const apptics: AppticsApi;
12
+ /** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
13
+ export declare const AppticsError: AppticsSdk['AppticsError'];
14
+ /** Android's AppticsUser: the signed-in user, and the builder for their properties. */
15
+ export declare const AppticsUser: AppticsSdk['AppticsUser'];
16
+ /** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
17
+ export declare const AppticsHeatmap: AppticsSdk['AppticsHeatmap'];
18
+ /** Android's AppticsSettings: what the SDK may track for this visitor. */
19
+ export declare const AppticsSettings: AppticsSdk['AppticsSettings'];
20
+ declare const apptics: AppticsSdk;
68
21
  export default apptics;
package/dist/cjs/index.js CHANGED
@@ -1,10 +1,11 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (c) Zoho Corporation Private Limited | see LICENSE */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('./core/constants.js');
7
7
  var guard = require('./core/guard.js');
8
+ var logger = require('./core/logger.js');
8
9
  var lifecycle = require('./lifecycle.js');
9
10
  var autoApi = require('./engagement/auto-api.js');
10
11
  var track = require('./engagement/track.js');
@@ -16,30 +17,80 @@ var track$1 = require('./errors/track.js');
16
17
  var index = require('./user/index.js');
17
18
  var consent = require('./core/consent.js');
18
19
  var scheduler = require('./scheduler.js');
19
- var logs = require('./feedback/logs.js');
20
- var autoInit = require('./auto-init.js');
20
+ var track$2 = require('./heatmap/track.js');
21
+ var send = require('./heatmap/send.js');
22
+ var hooks = require('./core/hooks.js');
21
23
  var debug = require('./core/debug.js');
22
- var logger = require('./remotelog/logger.js');
23
24
 
24
- /** Android's Apptics: `Apptics.init(config)` starts the SDK. */
25
+ // flush() and the flush timer send heatmap records through this hook. Set here, from a named
26
+ // import, rather than by heatmap/send.ts on being imported: the package's sideEffects list names
27
+ // only the CDN bundle, so a bundler drops a bare `import './heatmap/send.js'`, and with it every
28
+ // heatmap send, while capture carries on filling the queue
29
+ hooks.hooks.sendHeatmaps = send.sendHeatmapData;
30
+ /*
31
+ * Every public call below is a function of its own, with the parameter names the console shows
32
+ * on hover, forwarding to its guard()ed implementation (see forward).
33
+ */
34
+ const initGuarded = guard.guard('Apptics.init', lifecycle.init); // no i18n
35
+ const readyGuarded = guard.guard('Apptics.ready', lifecycle.ready); // no i18n
36
+ const flushGuarded = guard.guard('Apptics.flush', scheduler.calledFlush); // no i18n
37
+ const resetGuarded = guard.guard('Apptics.reset', lifecycle.reset); // no i18n
38
+ /**
39
+ * Debug mode, on or off; works before init(), and wins over `debug` in init(). On, engagement,
40
+ * exception and log go to their `debug/` twins and the answers carry a request id and a link into
41
+ * the server's own logs. It switches itself off after an hour with nothing tracked, so a forgotten
42
+ * tab stops tracing on its own.
43
+ */
44
+ const enableDebugGuarded = guard.guard('Apptics.enableDebug', debug.enableDebug); // no i18n
45
+ const disableDebugGuarded = guard.guard('Apptics.disableDebug', debug.disableDebug); // no i18n
46
+ /** The renamed calls already warned about: once per page each, not once per call. */
47
+ var warnedRenamed = {};
48
+ /** An earlier name of a call still works, with a console warning naming the call to use. */
49
+ function renamed(old, current) {
50
+ if (warnedRenamed[old]) {
51
+ return;
52
+ }
53
+ warnedRenamed[old] = true;
54
+ logger.warnAlways(old + ' is now ' + current + '; rename it in your code'); // no i18n
55
+ }
56
+ /** Android's Apptics: starting the SDK, and what applies to all of it. */
25
57
  const Apptics = {
26
- /** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
27
- init: guard.guard('Apptics.init', lifecycle.init), // no i18n
58
+ /** Starts the SDK with the app's config object, which is required. */
59
+ init: function init(config) { return guard.forward(initGuarded, arguments); },
60
+ /** Resolves true once the SDK is running, false if it can't start. */
61
+ ready: function ready() { return guard.forward(readyGuarded, arguments); },
62
+ /** Sends stored engagements, errors and heatmap records now; at most once every 15 seconds. */
63
+ flush: function flush() { return guard.forward(flushGuarded, arguments); },
64
+ /** Clears stored identity, queued data and remote config values, then starts again. */
65
+ reset: function reset() { return guard.forward(resetGuarded, arguments); },
66
+ enableDebug: function enableDebug() { return guard.forward(enableDebugGuarded, arguments); },
67
+ disableDebug: function disableDebug() { return guard.forward(disableDebugGuarded, arguments); },
28
68
  };
29
- const ready = guard.guard('ready', lifecycle.ready); // no i18n
30
- /** Android's AppticsEvents: `addEvent(name, group?, properties?)`, or `addEvent(DefinedEvents.X, properties?)`. */
31
- const AppticsEvents = {
32
- addEvent: guard.guard('AppticsEvents.addEvent', track.trackEvent), // no i18n
69
+ /**
70
+ * Android's AppticsEvents: `addEvent(name, group, properties?)`, or
71
+ * `addEvent(AppticsEvent.DefinedEvents.X, properties?)`.
72
+ */
73
+ const addEventGuarded = guard.guard('AppticsEvent.addEvent', track.trackEvent); // no i18n
74
+ const setClickTrackingGuarded = guard.guard('AppticsEvent.setClickTracking', lifecycle.setClickTracking); // no i18n
75
+ const AppticsEvent = {
76
+ /** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
77
+ DefinedEvents: definedEvents.DefinedEvents,
78
+ addEvent: function addEvent(eventName, groupName, properties) {
79
+ return guard.forward(addEventGuarded, arguments);
80
+ },
81
+ /** Turns click tracking from markup (apeventaction) on or off; the `track_click` config flag sets it at start-up. */
82
+ setClickTracking: function setClickTracking(enabled) { return guard.forward(setClickTrackingGuarded, arguments); },
33
83
  };
34
- const inScreenGuarded = guard.guard('AppticsScreenTracker.inScreen', track.inScreenAt); // no i18n
35
- const outScreenGuarded = guard.guard('AppticsScreenTracker.outScreen', track.outScreenAt); // no i18n
84
+ const inScreenGuarded = guard.guard('AppticsScreen.inScreen', track.inScreenAt); // no i18n
85
+ const outScreenGuarded = guard.guard('AppticsScreen.outScreen', track.outScreenAt); // no i18n
86
+ const setScreenTrackingGuarded = guard.guard('AppticsScreen.setScreenTracking', lifecycle.setScreenTracking); // no i18n
36
87
  /** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
37
- const AppticsScreenTracker = {
88
+ const AppticsScreen = {
38
89
  /**
39
90
  * Records a screen view and returns its id. The view ends at the next screen, when the page is
40
91
  * hidden or its session ends, or when the id is handed to outScreen. '' for an invalid name.
41
92
  */
42
- inScreen: function (screenName, properties) {
93
+ inScreen: function inScreen(screenName, properties) {
43
94
  if (!validate.validateScreenName(screenName)) {
44
95
  // inScreenAt reports it; the caller still needs an answer now
45
96
  inScreenGuarded(screenName, properties, '', utils.nowMs()); // no i18n
@@ -51,100 +102,98 @@ const AppticsScreenTracker = {
51
102
  return id;
52
103
  },
53
104
  /** Ends the screen view inScreen began, before the next screen would. */
54
- outScreen: function (id) {
105
+ outScreen: function outScreen(id) {
55
106
  outScreenGuarded(id, utils.nowMs());
56
107
  },
108
+ /** Turns automatic screen tracking on or off; the `track_screen` config flag sets it at start-up. */
109
+ setScreenTracking: function setScreenTracking(enabled) { return guard.forward(setScreenTrackingGuarded, arguments); },
57
110
  };
58
- const endTrackApiGuarded = guard.guard('AppticsApiTracker.endTrackApi', track.endTrackApiAt); // no i18n
111
+ const endTrackApiGuarded = guard.guard('AppticsApi.endTrackApi', track.endTrackApiAt); // no i18n
112
+ const startTrackApiGuarded = guard.guard('AppticsApi.startTrackApi', track.startTrackApi); // no i18n
113
+ const configureGuarded = guard.guard('AppticsApi.configure', apiRules.configureApiTracking); // no i18n
114
+ const setApiTrackingGuarded = guard.guard('AppticsApi.setApiTracking', autoApi.enableApiTracking); // no i18n
59
115
  /** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
60
- const AppticsApiTracker = {
116
+ const AppticsApi = {
61
117
  /** Begins timing one call: returns the id endTrackApi takes. */
62
- startTrackApi: guard.guard('AppticsApiTracker.startTrackApi', track.startTrackApi), // no i18n
118
+ startTrackApi: function startTrackApi(url, method) { return guard.forward(startTrackApiGuarded, arguments); },
63
119
  /** Finishes a call startTrackApi began and records it. */
64
- endTrackApi: function (id, responseCode, responseMessage) {
120
+ endTrackApi: function endTrackApi(id, responseCode, responseMessage) {
65
121
  // the end time now, not when a call made during start-up is replayed
66
122
  endTrackApiGuarded(id, responseCode, responseMessage, utils.nowMs());
67
123
  },
124
+ /** Builds the rules configure takes: `new AppticsApi.ApiTrackingBuilder()…build()`. */
125
+ ApiTrackingBuilder: apiRules.ApiTrackingBuilder,
68
126
  /** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
69
- configure: guard.guard('AppticsApiTracker.configure', apiRules.configureApiTracking), // no i18n
127
+ configure: function configure(config) { return guard.forward(configureGuarded, arguments); },
128
+ /** Turns automatic API tracking on or off; the `track_api` config flag sets it at start-up. */
129
+ setApiTracking: function setApiTracking(enabled) { return guard.forward(setApiTrackingGuarded, arguments); },
130
+ /** @deprecated the earlier name of setApiTracking, which it calls, with a warning */
131
+ enableApiTracking: function enableApiTracking(enabled) {
132
+ renamed('AppticsApi.enableApiTracking', 'AppticsApi.setApiTracking'); // no i18n
133
+ return guard.forward(setApiTrackingGuarded, arguments);
134
+ },
135
+ };
136
+ const trackErrorGuarded = guard.guard('AppticsError.trackError', track$1.trackError); // no i18n
137
+ const setErrorTrackingGuarded = guard.guard('AppticsError.setErrorTracking', track$1.setErrorTracking); // no i18n
138
+ /** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
139
+ const AppticsError = {
140
+ /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
141
+ trackError: function trackError(error, properties) { return guard.forward(trackErrorGuarded, arguments); },
142
+ /** Turns the automatic tracking of uncaught errors and unhandled rejections on or off; the `track_error` config flag sets it at start-up. */
143
+ setErrorTracking: function setErrorTracking(enabled) { return guard.forward(setErrorTrackingGuarded, arguments); },
144
+ /** @deprecated the earlier name of setErrorTracking, which it calls, with a warning */
145
+ trackGlobalErrorHandler: function trackGlobalErrorHandler(enabled) {
146
+ renamed('AppticsError.trackGlobalErrorHandler', 'AppticsError.setErrorTracking'); // no i18n
147
+ return guard.forward(setErrorTrackingGuarded, arguments);
148
+ },
149
+ };
150
+ const setUserGuarded = guard.guard('AppticsUser.setUser', index.setUser); // no i18n
151
+ const getUserGuarded = guard.guard('AppticsUser.getUser', index.getUser); // no i18n
152
+ /** Android's AppticsUser: the signed-in user, and the builder for their properties. */
153
+ const AppticsUser = {
154
+ /** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
155
+ setUser: function setUser(userid, groupid, properties) { return guard.forward(setUserGuarded, arguments); },
156
+ /** The registered user, or {} when there is none. */
157
+ getUser: function getUser() { return guard.forward(getUserGuarded, arguments); },
158
+ UserBuilder: index.UserBuilder,
159
+ };
160
+ const setHeatmapTrackingGuarded = guard.guard('AppticsHeatmap.setHeatmapTracking', track$2.trackHeatmap); // no i18n
161
+ /** Heatmap capture: AppticsHeatmap.setHeatmapTracking() starts or stops recording clicks and scrolls. */
162
+ const AppticsHeatmap = {
163
+ /** Starts or stops recording clicks and scrolls; the `track_heatmap` config flag sets it at start-up. */
164
+ setHeatmapTracking: function setHeatmapTracking(enabled) { return guard.forward(setHeatmapTrackingGuarded, arguments); },
165
+ /** @deprecated the earlier name of setHeatmapTracking, which it calls, with a warning */
166
+ trackHeatmap: function trackHeatmap(on) {
167
+ renamed('AppticsHeatmap.trackHeatmap', 'AppticsHeatmap.setHeatmapTracking'); // no i18n
168
+ return guard.forward(setHeatmapTrackingGuarded, arguments);
169
+ },
170
+ };
171
+ const setTrackingStatusGuarded = guard.guard('AppticsSettings.setTrackingStatus', consent.setTrackingStatus); // no i18n
172
+ const getTrackingStatusGuarded = guard.guard('AppticsSettings.getTrackingStatus', consent.getTrackingStatus); // no i18n
173
+ /** Android's AppticsSettings: what the SDK may track for this visitor. */
174
+ const AppticsSettings = {
175
+ /** The states setTrackingStatus takes: USAGE_TRACKING_WITH_PII, USAGE_TRACKING_WITHOUT_PII, NO_TRACKING. */
176
+ AP_TRACKING_STATUS: constants.AP_TRACKING_STATUS,
177
+ setTrackingStatus: function setTrackingStatus(status) { return guard.forward(setTrackingStatusGuarded, arguments); },
178
+ getTrackingStatus: function getTrackingStatus() { return guard.forward(getTrackingStatusGuarded, arguments); },
70
179
  };
71
- /** Turns automatic API tracking on or off; the `track_api` config flag is the usual way to set it. */
72
- const enableApiTracking = guard.guard('enableApiTracking', autoApi.enableApiTracking); // no i18n
73
- /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
74
- const AppticsTrackError = guard.guard('AppticsTrackError', track$1.trackError); // no i18n
75
- const enableGlobalErrorHandler = guard.guard('enableGlobalErrorHandler', track$1.enableGlobalErrorHandler); // no i18n
76
- /** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
77
- const AppticsSetUser = guard.guard('AppticsSetUser', index.setUser); // no i18n
78
- const getUser = guard.guard('getUser', index.getUser); // no i18n
79
- const setTrackingStatus = guard.guard('setTrackingStatus', consent.setTrackingStatus); // no i18n
80
- const getTrackingStatus = guard.guard('getTrackingStatus', consent.getTrackingStatus); // no i18n
81
- const flush = guard.guard('flush', scheduler.flush); // no i18n
82
- /** Records a line for the next feedback submission. Costs nothing until feedback is sent. */
83
- const addFeedbackLog = guard.guard('addFeedbackLog', logs.addFeedbackLog); // no i18n
84
- /** Records a diagnostics key/value, grouped under `heading`, for the next feedback submission. */
85
- const addDiagnosticsInfo = guard.guard('addDiagnosticsInfo', logs.addDiagnosticsInfo); // no i18n
86
- /**
87
- * Turns debug mode on; works before init(), and wins over `debug` in init().
88
- *
89
- * On, engagement, exception and log go to their `debug/` twins and the answers carry a request id
90
- * and a link into the server's own logs. It switches itself off after an hour with nothing
91
- * tracked, so a forgotten tab stops tracing on its own.
92
- */
93
- const enableDebug = guard.guard('enableDebug', debug.enableDebug); // no i18n
94
- /** Turns debug mode off; works before init(), and wins over `debug` in init(). */
95
- const disableDebug = guard.guard('disableDebug', debug.disableDebug); // no i18n
96
- const reset = guard.guard('reset', lifecycle.reset); // no i18n
97
180
  const apptics = {
98
181
  Apptics,
99
- AppticsEvents,
100
- AppticsScreenTracker,
101
- AppticsApiTracker,
102
- AppticsLogger: logger.AppticsLogger,
103
- DefinedEvents: definedEvents.DefinedEvents,
104
- ApiTrackingBuilder: apiRules.ApiTrackingBuilder,
105
- ready,
106
- enableDebug,
107
- disableDebug,
108
- enableApiTracking,
109
- AppticsTrackError,
110
- enableGlobalErrorHandler,
111
- AppticsSetUser,
112
- getUser,
113
- users: index.users,
114
- setTrackingStatus,
115
- getTrackingStatus,
116
- flush,
117
- addFeedbackLog,
118
- addDiagnosticsInfo,
119
- reset,
120
- AP_TRACKING_STATUS: constants.AP_TRACKING_STATUS,
121
- AP_FEEDBACK_TYPE: constants.AP_FEEDBACK_TYPE,
182
+ AppticsEvent,
183
+ AppticsScreen,
184
+ AppticsApi,
185
+ AppticsError,
186
+ AppticsUser,
187
+ AppticsSettings,
188
+ AppticsHeatmap,
122
189
  };
123
- autoInit.scheduleAutoInit(Apptics);
124
190
 
125
- exports.AP_FEEDBACK_TYPE = constants.AP_FEEDBACK_TYPE;
126
- exports.AP_TRACKING_STATUS = constants.AP_TRACKING_STATUS;
127
- exports.DefinedEvents = definedEvents.DefinedEvents;
128
- exports.ApiTrackingBuilder = apiRules.ApiTrackingBuilder;
129
- exports.UserBuilder = index.UserBuilder;
130
- exports.users = index.users;
131
- exports.AppticsLogger = logger.AppticsLogger;
132
191
  exports.Apptics = Apptics;
133
- exports.AppticsApiTracker = AppticsApiTracker;
134
- exports.AppticsEvents = AppticsEvents;
135
- exports.AppticsScreenTracker = AppticsScreenTracker;
136
- exports.AppticsSetUser = AppticsSetUser;
137
- exports.AppticsTrackError = AppticsTrackError;
138
- exports.addDiagnosticsInfo = addDiagnosticsInfo;
139
- exports.addFeedbackLog = addFeedbackLog;
192
+ exports.AppticsApi = AppticsApi;
193
+ exports.AppticsError = AppticsError;
194
+ exports.AppticsEvent = AppticsEvent;
195
+ exports.AppticsHeatmap = AppticsHeatmap;
196
+ exports.AppticsScreen = AppticsScreen;
197
+ exports.AppticsSettings = AppticsSettings;
198
+ exports.AppticsUser = AppticsUser;
140
199
  exports.default = apptics;
141
- exports.disableDebug = disableDebug;
142
- exports.enableApiTracking = enableApiTracking;
143
- exports.enableDebug = enableDebug;
144
- exports.enableGlobalErrorHandler = enableGlobalErrorHandler;
145
- exports.flush = flush;
146
- exports.getTrackingStatus = getTrackingStatus;
147
- exports.getUser = getUser;
148
- exports.ready = ready;
149
- exports.reset = reset;
150
- exports.setTrackingStatus = setTrackingStatus;
@@ -1,14 +1,32 @@
1
+ import { type ScreenRouteRule } from './core/constants.js';
1
2
  import type { AppticsConfig } from './types.js';
2
3
  /**
3
- * Starts the SDK. The config object is required: pass it directly, or let the console snippet
4
- * supply it (auto-init reads window.appticssettings._defaultoptions and calls init with it).
5
- * Returns true when the config has serviceUrl, zak, identifier and appversion and start-up has
4
+ * Starts the SDK. The config object is required: the SDK starts only when the app calls this.
5
+ * Returns true when the config has base_url, auth_key, app_domain and appversion and start-up has
6
6
  * begun (see ready()), false when it was already running, the config is missing or incomplete, or
7
7
  * there is no browser. Start-up calls app/addversion with those four, which answers with aaid, the
8
8
  * portal and project ids and the rest; then device/add registers the browser, as in 1.x.
9
9
  */
10
10
  export declare function init(config: AppticsConfig): boolean;
11
+ /**
12
+ * screen_routes as init() keeps it: each entry checked, an exact path cleaned up, a regex given as
13
+ * a string compiled. An entry that cannot be used is left out, and said, rather than matching
14
+ * something its author did not mean.
15
+ */
16
+ export declare function screenRouteRules(routes: unknown): ScreenRouteRule[];
11
17
  /** Resolves true once start-up has finished, false if init() refused or storage is unusable. */
12
18
  export declare function ready(): Promise<boolean>;
13
19
  /** Clears stored identity and queues, then starts again from the snippet. */
14
20
  export declare function reset(): void;
21
+ /**
22
+ * AppticsEvent.setClickTracking: click tracking from markup on or off, as the `track_click`
23
+ * config sets it. The listener stays; it checks the switch on every click.
24
+ */
25
+ export declare function setClickTracking(enabled?: boolean): void;
26
+ /**
27
+ * AppticsScreen.setScreenTracking: automatic screen tracking on or off, as the `track_screen`
28
+ * config sets it. Applied now once the SDK is running; before that it is only noted, and start()
29
+ * switches tracking to it. Like the other switches, the next init() (a reset() too) goes back to
30
+ * what its config says.
31
+ */
32
+ export declare function setScreenTracking(enabled?: boolean): void;