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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +111 -5
  2. package/README.md +399 -300
  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-VYr43KcB.min.js +3 -0
  8. package/dist/chunks/lifecycle-VYr43KcB.min.js.map +1 -0
  9. package/dist/cjs/auto-init.d.ts +3 -3
  10. package/dist/cjs/auto-init.js +1 -1
  11. package/dist/cjs/core/attempts.js +1 -1
  12. package/dist/cjs/core/batch.js +2 -1
  13. package/dist/cjs/core/callsite.d.ts +6 -0
  14. package/dist/cjs/core/callsite.js +25 -3
  15. package/dist/cjs/core/consent.d.ts +5 -1
  16. package/dist/cjs/core/consent.js +8 -6
  17. package/dist/cjs/core/constants.d.ts +35 -10
  18. package/dist/cjs/core/constants.js +31 -15
  19. package/dist/cjs/core/db.d.ts +12 -4
  20. package/dist/cjs/core/db.js +167 -34
  21. package/dist/cjs/core/debug.js +1 -1
  22. package/dist/cjs/core/env.js +1 -1
  23. package/dist/cjs/core/framework-id.d.ts +1 -1
  24. package/dist/cjs/core/framework-id.js +3 -3
  25. package/dist/cjs/core/guard.d.ts +9 -0
  26. package/dist/cjs/core/guard.js +27 -13
  27. package/dist/cjs/core/hooks.d.ts +2 -4
  28. package/dist/cjs/core/hooks.js +2 -3
  29. package/dist/cjs/core/locks.d.ts +9 -0
  30. package/dist/cjs/core/locks.js +22 -0
  31. package/dist/cjs/core/logger.d.ts +3 -4
  32. package/dist/cjs/core/logger.js +4 -40
  33. package/dist/cjs/core/state.d.ts +3 -2
  34. package/dist/cjs/core/state.js +2 -2
  35. package/dist/cjs/core/storage.d.ts +20 -5
  36. package/dist/cjs/core/storage.js +115 -17
  37. package/dist/cjs/core/stylesheet.d.ts +8 -0
  38. package/dist/cjs/core/stylesheet.js +29 -0
  39. package/dist/cjs/core/transport.d.ts +2 -0
  40. package/dist/cjs/core/transport.js +19 -4
  41. package/dist/cjs/core/utils.js +1 -1
  42. package/dist/cjs/core/validate.js +2 -2
  43. package/dist/cjs/device/appversion.d.ts +1 -6
  44. package/dist/cjs/device/appversion.js +13 -1
  45. package/dist/cjs/device/index.d.ts +11 -0
  46. package/dist/cjs/device/index.js +120 -20
  47. package/dist/cjs/engagement/api-rules.d.ts +32 -67
  48. package/dist/cjs/engagement/api-rules.js +144 -157
  49. package/dist/cjs/engagement/auto-api.js +2 -2
  50. package/dist/cjs/engagement/auto-screen.d.ts +2 -0
  51. package/dist/cjs/engagement/auto-screen.js +67 -3
  52. package/dist/cjs/engagement/defined-events.js +1 -1
  53. package/dist/cjs/engagement/send.js +6 -1
  54. package/dist/cjs/engagement/session.d.ts +12 -3
  55. package/dist/cjs/engagement/session.js +161 -25
  56. package/dist/cjs/engagement/track.js +45 -20
  57. package/dist/cjs/errors/send.js +1 -1
  58. package/dist/cjs/errors/track.d.ts +1 -1
  59. package/dist/cjs/errors/track.js +46 -6
  60. package/dist/cjs/feedback/controls.d.ts +6 -0
  61. package/dist/cjs/feedback/controls.js +31 -1
  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 +10 -5
  65. package/dist/cjs/feedback/logs.js +52 -13
  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 +3 -0
  69. package/dist/cjs/feedback/send.js +28 -3
  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 +12 -12
  74. package/dist/cjs/feedback/ui.d.ts +14 -6
  75. package/dist/cjs/feedback/ui.js +126 -48
  76. package/dist/cjs/heatmap/send.js +1 -1
  77. package/dist/cjs/heatmap/track.d.ts +1 -1
  78. package/dist/cjs/heatmap/track.js +87 -16
  79. package/dist/cjs/index.d.ts +17 -63
  80. package/dist/cjs/index.js +104 -92
  81. package/dist/cjs/lifecycle.d.ts +8 -1
  82. package/dist/cjs/lifecycle.js +258 -62
  83. package/dist/cjs/remoteconfig/country.d.ts +4 -0
  84. package/dist/cjs/remoteconfig/country.js +73 -0
  85. package/dist/cjs/remoteconfig/custom.d.ts +7 -7
  86. package/dist/cjs/remoteconfig/custom.js +31 -51
  87. package/dist/cjs/remoteconfig/evaluate.d.ts +3 -3
  88. package/dist/cjs/remoteconfig/evaluate.js +56 -43
  89. package/dist/cjs/remoteconfig/fetch.d.ts +3 -3
  90. package/dist/cjs/remoteconfig/fetch.js +9 -23
  91. package/dist/cjs/remoteconfig/index.d.ts +10 -8
  92. package/dist/cjs/remoteconfig/index.js +65 -39
  93. package/dist/cjs/remoteconfig/store.js +1 -1
  94. package/dist/cjs/remoteconfig/tz-countries.d.ts +8 -0
  95. package/dist/cjs/remoteconfig/tz-countries.js +13 -0
  96. package/dist/cjs/remotelog/gate.d.ts +2 -11
  97. package/dist/cjs/remotelog/gate.js +9 -35
  98. package/dist/cjs/remotelog/index.d.ts +4 -21
  99. package/dist/cjs/remotelog/logger.d.ts +11 -17
  100. package/dist/cjs/remotelog/logger.js +30 -58
  101. package/dist/cjs/remotelog/send.js +10 -10
  102. package/dist/cjs/remotelogger/index.d.ts +12 -0
  103. package/dist/cjs/remotelogger/index.js +18 -0
  104. package/dist/cjs/scheduler.js +2 -2
  105. package/dist/cjs/types.d.ts +155 -82
  106. package/dist/cjs/user/index.js +11 -6
  107. package/dist/esm/auto-init.d.ts +3 -3
  108. package/dist/esm/auto-init.js +1 -1
  109. package/dist/esm/core/attempts.js +1 -1
  110. package/dist/esm/core/batch.js +2 -1
  111. package/dist/esm/core/callsite.d.ts +6 -0
  112. package/dist/esm/core/callsite.js +25 -4
  113. package/dist/esm/core/consent.d.ts +5 -1
  114. package/dist/esm/core/consent.js +9 -7
  115. package/dist/esm/core/constants.d.ts +35 -10
  116. package/dist/esm/core/constants.js +30 -15
  117. package/dist/esm/core/db.d.ts +12 -4
  118. package/dist/esm/core/db.js +164 -35
  119. package/dist/esm/core/debug.js +1 -1
  120. package/dist/esm/core/env.js +1 -1
  121. package/dist/esm/core/framework-id.d.ts +1 -1
  122. package/dist/esm/core/framework-id.js +3 -3
  123. package/dist/esm/core/guard.d.ts +9 -0
  124. package/dist/esm/core/guard.js +27 -14
  125. package/dist/esm/core/hooks.d.ts +2 -4
  126. package/dist/esm/core/hooks.js +2 -3
  127. package/dist/esm/core/locks.d.ts +9 -0
  128. package/dist/esm/core/locks.js +20 -0
  129. package/dist/esm/core/logger.d.ts +3 -4
  130. package/dist/esm/core/logger.js +4 -40
  131. package/dist/esm/core/state.d.ts +3 -2
  132. package/dist/esm/core/state.js +2 -2
  133. package/dist/esm/core/storage.d.ts +20 -5
  134. package/dist/esm/core/storage.js +113 -18
  135. package/dist/esm/core/stylesheet.d.ts +8 -0
  136. package/dist/esm/core/stylesheet.js +27 -0
  137. package/dist/esm/core/transport.d.ts +2 -0
  138. package/dist/esm/core/transport.js +19 -5
  139. package/dist/esm/core/utils.js +1 -1
  140. package/dist/esm/core/validate.js +2 -2
  141. package/dist/esm/device/appversion.d.ts +1 -6
  142. package/dist/esm/device/appversion.js +13 -2
  143. package/dist/esm/device/index.d.ts +11 -0
  144. package/dist/esm/device/index.js +123 -24
  145. package/dist/esm/engagement/api-rules.d.ts +32 -67
  146. package/dist/esm/engagement/api-rules.js +143 -155
  147. package/dist/esm/engagement/auto-api.js +3 -3
  148. package/dist/esm/engagement/auto-screen.d.ts +2 -0
  149. package/dist/esm/engagement/auto-screen.js +67 -4
  150. package/dist/esm/engagement/defined-events.js +1 -1
  151. package/dist/esm/engagement/send.js +6 -1
  152. package/dist/esm/engagement/session.d.ts +12 -3
  153. package/dist/esm/engagement/session.js +162 -29
  154. package/dist/esm/engagement/track.js +52 -27
  155. package/dist/esm/errors/send.js +1 -1
  156. package/dist/esm/errors/track.d.ts +1 -1
  157. package/dist/esm/errors/track.js +46 -6
  158. package/dist/esm/feedback/controls.d.ts +6 -0
  159. package/dist/esm/feedback/controls.js +31 -2
  160. package/dist/esm/feedback/index.d.ts +8 -7
  161. package/dist/esm/feedback/index.js +34 -13
  162. package/dist/esm/feedback/logs.d.ts +10 -5
  163. package/dist/esm/feedback/logs.js +54 -15
  164. package/dist/esm/feedback/quartz.d.ts +18 -0
  165. package/dist/esm/feedback/quartz.js +99 -0
  166. package/dist/esm/feedback/send.d.ts +3 -0
  167. package/dist/esm/feedback/send.js +28 -5
  168. package/dist/esm/feedback/styles.d.ts +10 -0
  169. package/dist/esm/feedback/styles.js +4 -0
  170. package/dist/esm/feedback/template.d.ts +1 -1
  171. package/dist/esm/feedback/template.js +12 -12
  172. package/dist/esm/feedback/ui.d.ts +14 -6
  173. package/dist/esm/feedback/ui.js +126 -49
  174. package/dist/esm/heatmap/send.js +1 -1
  175. package/dist/esm/heatmap/track.d.ts +1 -1
  176. package/dist/esm/heatmap/track.js +87 -16
  177. package/dist/esm/index.d.ts +17 -63
  178. package/dist/esm/index.js +108 -80
  179. package/dist/esm/lifecycle.d.ts +8 -1
  180. package/dist/esm/lifecycle.js +266 -71
  181. package/dist/esm/remoteconfig/country.d.ts +4 -0
  182. package/dist/esm/remoteconfig/country.js +70 -0
  183. package/dist/esm/remoteconfig/custom.d.ts +7 -7
  184. package/dist/esm/remoteconfig/custom.js +32 -52
  185. package/dist/esm/remoteconfig/evaluate.d.ts +3 -3
  186. package/dist/esm/remoteconfig/evaluate.js +57 -44
  187. package/dist/esm/remoteconfig/fetch.d.ts +3 -3
  188. package/dist/esm/remoteconfig/fetch.js +9 -23
  189. package/dist/esm/remoteconfig/index.d.ts +10 -8
  190. package/dist/esm/remoteconfig/index.js +66 -40
  191. package/dist/esm/remoteconfig/store.js +1 -1
  192. package/dist/esm/remoteconfig/tz-countries.d.ts +8 -0
  193. package/dist/esm/remoteconfig/tz-countries.js +11 -0
  194. package/dist/esm/remotelog/gate.d.ts +2 -11
  195. package/dist/esm/remotelog/gate.js +10 -32
  196. package/dist/esm/remotelog/index.d.ts +4 -21
  197. package/dist/esm/remotelog/logger.d.ts +11 -17
  198. package/dist/esm/remotelog/logger.js +32 -60
  199. package/dist/esm/remotelog/send.js +12 -12
  200. package/dist/esm/remotelogger/index.d.ts +12 -0
  201. package/dist/esm/remotelogger/index.js +13 -0
  202. package/dist/esm/scheduler.js +2 -2
  203. package/dist/esm/types.d.ts +155 -82
  204. package/dist/esm/user/index.js +12 -6
  205. package/dist/feedback.esm.min.js +2 -2
  206. package/dist/feedback.esm.min.js.map +1 -1
  207. package/package.json +14 -16
  208. package/dist/chunks/batch-BU_mTpm1.min.js +0 -3
  209. package/dist/chunks/batch-BU_mTpm1.min.js.map +0 -1
  210. package/dist/chunks/logs-Bea5zUW_.min.js +0 -3
  211. package/dist/chunks/logs-Bea5zUW_.min.js.map +0 -1
  212. package/dist/cjs/heatmap/index.d.ts +0 -16
  213. package/dist/cjs/heatmap/index.js +0 -22
  214. package/dist/cjs/remotelog/index.js +0 -55
  215. package/dist/esm/heatmap/index.d.ts +0 -16
  216. package/dist/esm/heatmap/index.js +0 -17
  217. package/dist/esm/remotelog/index.js +0 -51
  218. package/dist/heatmap.esm.min.js +0 -3
  219. package/dist/heatmap.esm.min.js.map +0 -1
  220. package/dist/style.css +0 -1
@@ -1,68 +1,22 @@
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 './heatmap/send.js';
2
+ import type { AppticsSdk } from './types.js';
3
+ export type { AppticsSdk, AppticsConfig, ErrorLike, FeedbackType, Properties, TrackingStatus, UserInfo, UserValidationResult, } from './types.js';
4
+ /** Android's Apptics: starting the SDK, and what applies to all of it. */
5
+ export declare const Apptics: AppticsSdk['Apptics'];
6
+ export declare const AppticsEvent: AppticsSdk['AppticsEvent'];
28
7
  export type { DefinedEvent } from './engagement/defined-events.js';
29
8
  /** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
30
- export declare const AppticsScreenTracker: AppticsApi['AppticsScreenTracker'];
9
+ export declare const AppticsScreen: AppticsSdk['AppticsScreen'];
31
10
  /** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
32
- export declare const AppticsApiTracker: AppticsApi['AppticsApiTracker'];
33
- export { ApiTrackingBuilder };
11
+ export declare const AppticsApi: AppticsSdk['AppticsApi'];
34
12
  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;
13
+ /** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
14
+ export declare const AppticsError: AppticsSdk['AppticsError'];
15
+ /** Android's AppticsUser: the signed-in user, and the builder for their properties. */
16
+ export declare const AppticsUser: AppticsSdk['AppticsUser'];
17
+ /** Heatmap capture: AppticsHeatmap.trackHeatmap() starts or stops recording clicks and scrolls. */
18
+ export declare const AppticsHeatmap: AppticsSdk['AppticsHeatmap'];
19
+ /** Android's AppticsSettings: what the SDK may track for this visitor. */
20
+ export declare const AppticsSettings: AppticsSdk['AppticsSettings'];
21
+ declare const apptics: AppticsSdk;
68
22
  export default apptics;
package/dist/esm/index.js CHANGED
@@ -1,42 +1,72 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta | (c) Zoho Corporation Private Limited | see LICENSE */
2
- import { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS } from './core/constants.js';
3
- import { guard } from './core/guard.js';
4
- import { init, reset as reset$1, ready as ready$1 } from './lifecycle.js';
5
- import { enableApiTracking as enableApiTracking$1 } from './engagement/auto-api.js';
6
- import { startTrackApi, trackEvent, endTrackApiAt, outScreenAt, inScreenAt } from './engagement/track.js';
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ import { AP_TRACKING_STATUS } from './core/constants.js';
3
+ import { forward, guard } from './core/guard.js';
4
+ import { reset, ready, init } from './lifecycle.js';
5
+ import { enableApiTracking } from './engagement/auto-api.js';
6
+ import { endTrackApiAt, outScreenAt, inScreenAt, startTrackApi, trackEvent } from './engagement/track.js';
7
7
  import { DefinedEvents } from './engagement/defined-events.js';
8
8
  import { nowMs, getNewUUID } from './core/utils.js';
9
9
  import { validateScreenName } from './core/validate.js';
10
10
  import { ApiTrackingBuilder, configureApiTracking } from './engagement/api-rules.js';
11
- import { trackError, enableGlobalErrorHandler as enableGlobalErrorHandler$1 } from './errors/track.js';
12
- import { users, setUser, getUser as getUser$1 } from './user/index.js';
13
- export { UserBuilder } from './user/index.js';
14
- import { getTrackingStatus as getTrackingStatus$1, setTrackingStatus as setTrackingStatus$1 } from './core/consent.js';
15
- import { flush as flush$1 } from './scheduler.js';
16
- import { addDiagnosticsInfo as addDiagnosticsInfo$1, addFeedbackLog as addFeedbackLog$1 } from './feedback/logs.js';
11
+ import { trackGlobalErrorHandler, trackError } from './errors/track.js';
12
+ import { UserBuilder, getUser, setUser } from './user/index.js';
13
+ import { getTrackingStatus, setTrackingStatus } from './core/consent.js';
14
+ import { flush } from './scheduler.js';
15
+ import { trackHeatmap } from './heatmap/track.js';
16
+ import './heatmap/send.js';
17
17
  import { scheduleAutoInit } from './auto-init.js';
18
- import { disableDebug as disableDebug$1, enableDebug as enableDebug$1 } from './core/debug.js';
19
- import { AppticsLogger } from './remotelog/logger.js';
18
+ import { disableDebug, enableDebug } from './core/debug.js';
20
19
 
21
- /** Android's Apptics: `Apptics.init(config)` starts the SDK. */
20
+ /*
21
+ * Every public call below is a function of its own, with the parameter names the console shows
22
+ * on hover, forwarding to its guard()ed implementation (see forward).
23
+ */
24
+ const initGuarded = guard('Apptics.init', init); // no i18n
25
+ const readyGuarded = guard('Apptics.ready', ready); // no i18n
26
+ const flushGuarded = guard('Apptics.flush', flush); // no i18n
27
+ const resetGuarded = guard('Apptics.reset', reset); // no i18n
28
+ /**
29
+ * Debug mode, on or off; works before init(), and wins over `debug` in init(). On, engagement,
30
+ * exception and log go to their `debug/` twins and the answers carry a request id and a link into
31
+ * the server's own logs. It switches itself off after an hour with nothing tracked, so a forgotten
32
+ * tab stops tracing on its own.
33
+ */
34
+ const enableDebugGuarded = guard('Apptics.enableDebug', enableDebug); // no i18n
35
+ const disableDebugGuarded = guard('Apptics.disableDebug', disableDebug); // no i18n
36
+ /** Android's Apptics: starting the SDK, and what applies to all of it. */
22
37
  const Apptics = {
23
38
  /** Starts the SDK. The config object is required; the console snippet supplies it via auto-init. */
24
- init: guard('Apptics.init', init), // no i18n
39
+ init: function init(config) { return forward(initGuarded, arguments); },
40
+ /** Resolves true once the SDK is running, false if it can't start. */
41
+ ready: function ready() { return forward(readyGuarded, arguments); },
42
+ /** Sends stored engagements, errors and heatmap records now. */
43
+ flush: function flush() { return forward(flushGuarded, arguments); },
44
+ /** Clears stored identity, queued data and remote config values, then starts again. */
45
+ reset: function reset() { return forward(resetGuarded, arguments); },
46
+ enableDebug: function enableDebug() { return forward(enableDebugGuarded, arguments); },
47
+ disableDebug: function disableDebug() { return forward(disableDebugGuarded, arguments); },
25
48
  };
26
- const ready = guard('ready', ready$1); // no i18n
27
- /** Android's AppticsEvents: `addEvent(name, group?, properties?)`, or `addEvent(DefinedEvents.X, properties?)`. */
28
- const AppticsEvents = {
29
- addEvent: guard('AppticsEvents.addEvent', trackEvent), // no i18n
49
+ /**
50
+ * Android's AppticsEvents: `addEvent(name, group?, properties?)`, or
51
+ * `addEvent(AppticsEvent.DefinedEvents.X, properties?)`.
52
+ */
53
+ const addEventGuarded = guard('AppticsEvent.addEvent', trackEvent); // no i18n
54
+ const AppticsEvent = {
55
+ /** Apptics' defined events, as Android's DefinedEvents, to log with addEvent. */
56
+ DefinedEvents: DefinedEvents,
57
+ addEvent: function addEvent(eventName, groupName, properties) {
58
+ return forward(addEventGuarded, arguments);
59
+ },
30
60
  };
31
- const inScreenGuarded = guard('AppticsScreenTracker.inScreen', inScreenAt); // no i18n
32
- const outScreenGuarded = guard('AppticsScreenTracker.outScreen', outScreenAt); // no i18n
61
+ const inScreenGuarded = guard('AppticsScreen.inScreen', inScreenAt); // no i18n
62
+ const outScreenGuarded = guard('AppticsScreen.outScreen', outScreenAt); // no i18n
33
63
  /** Android's AppticsScreenTracker: inScreen(name) returns the view's id, outScreen(id) ends it. */
34
- const AppticsScreenTracker = {
64
+ const AppticsScreen = {
35
65
  /**
36
66
  * Records a screen view and returns its id. The view ends at the next screen, when the page is
37
67
  * hidden or its session ends, or when the id is handed to outScreen. '' for an invalid name.
38
68
  */
39
- inScreen: function (screenName, properties) {
69
+ inScreen: function inScreen(screenName, properties) {
40
70
  if (!validateScreenName(screenName)) {
41
71
  // inScreenAt reports it; the caller still needs an answer now
42
72
  inScreenGuarded(screenName, properties, '', nowMs()); // no i18n
@@ -48,75 +78,73 @@ const AppticsScreenTracker = {
48
78
  return id;
49
79
  },
50
80
  /** Ends the screen view inScreen began, before the next screen would. */
51
- outScreen: function (id) {
81
+ outScreen: function outScreen(id) {
52
82
  outScreenGuarded(id, nowMs());
53
83
  },
54
84
  };
55
- const endTrackApiGuarded = guard('AppticsApiTracker.endTrackApi', endTrackApiAt); // no i18n
85
+ const endTrackApiGuarded = guard('AppticsApi.endTrackApi', endTrackApiAt); // no i18n
86
+ const startTrackApiGuarded = guard('AppticsApi.startTrackApi', startTrackApi); // no i18n
87
+ const configureGuarded = guard('AppticsApi.configure', configureApiTracking); // no i18n
88
+ const enableApiTrackingGuarded = guard('AppticsApi.enableApiTracking', enableApiTracking); // no i18n
56
89
  /** Android's AppticsApiTracker: startTrackApi / endTrackApi, and configure for the rules. */
57
- const AppticsApiTracker = {
90
+ const AppticsApi = {
58
91
  /** Begins timing one call: returns the id endTrackApi takes. */
59
- startTrackApi: guard('AppticsApiTracker.startTrackApi', startTrackApi), // no i18n
92
+ startTrackApi: function startTrackApi(url, method) { return forward(startTrackApiGuarded, arguments); },
60
93
  /** Finishes a call startTrackApi began and records it. */
61
- endTrackApi: function (id, responseCode, responseMessage) {
94
+ endTrackApi: function endTrackApi(id, responseCode, responseMessage) {
62
95
  // the end time now, not when a call made during start-up is replayed
63
96
  endTrackApiGuarded(id, responseCode, responseMessage, nowMs());
64
97
  },
98
+ /** Builds the rules configure takes: `new AppticsApi.ApiTrackingBuilder()…build()`. */
99
+ ApiTrackingBuilder: ApiTrackingBuilder,
65
100
  /** The rules API tracking records by, from ApiTrackingBuilder. Works before Apptics.init(). */
66
- configure: guard('AppticsApiTracker.configure', configureApiTracking), // no i18n
101
+ configure: function configure(config) { return forward(configureGuarded, arguments); },
102
+ /** Turns automatic API tracking on or off; the `track_api` config flag is the usual way to set it. */
103
+ enableApiTracking: function enableApiTracking(enabled) { return forward(enableApiTrackingGuarded, arguments); },
104
+ };
105
+ const trackErrorGuarded = guard('AppticsError.trackError', trackError); // no i18n
106
+ const trackGlobalErrorHandlerGuarded = guard('AppticsError.trackGlobalErrorHandler', trackGlobalErrorHandler); // no i18n
107
+ /** Errors: the ones the app caught, and the switch for the uncaught ones tracked on their own. */
108
+ const AppticsError = {
109
+ /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
110
+ trackError: function trackError(error, properties) { return forward(trackErrorGuarded, arguments); },
111
+ /** Turns the automatic tracking of uncaught errors and unhandled rejections on or off. */
112
+ trackGlobalErrorHandler: function trackGlobalErrorHandler(enabled) { return forward(trackGlobalErrorHandlerGuarded, arguments); },
113
+ };
114
+ const setUserGuarded = guard('AppticsUser.setUser', setUser); // no i18n
115
+ const getUserGuarded = guard('AppticsUser.getUser', getUser); // no i18n
116
+ /** Android's AppticsUser: the signed-in user, and the builder for their properties. */
117
+ const AppticsUser = {
118
+ /** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
119
+ setUser: function setUser(userid, groupid, properties) { return forward(setUserGuarded, arguments); },
120
+ /** The registered user, or {} when there is none. */
121
+ getUser: function getUser() { return forward(getUserGuarded, arguments); },
122
+ UserBuilder: UserBuilder,
123
+ };
124
+ const trackHeatmapGuarded = guard('AppticsHeatmap.trackHeatmap', trackHeatmap); // no i18n
125
+ /** Heatmap capture: AppticsHeatmap.trackHeatmap() starts or stops recording clicks and scrolls. */
126
+ const AppticsHeatmap = {
127
+ trackHeatmap: function trackHeatmap(on) { return forward(trackHeatmapGuarded, arguments); },
128
+ };
129
+ const setTrackingStatusGuarded = guard('AppticsSettings.setTrackingStatus', setTrackingStatus); // no i18n
130
+ const getTrackingStatusGuarded = guard('AppticsSettings.getTrackingStatus', getTrackingStatus); // no i18n
131
+ /** Android's AppticsSettings: what the SDK may track for this visitor. */
132
+ const AppticsSettings = {
133
+ /** The states setTrackingStatus takes: USAGE_TRACKING_WITH_PII, USAGE_TRACKING_WITHOUT_PII, NO_TRACKING. */
134
+ AP_TRACKING_STATUS: AP_TRACKING_STATUS,
135
+ setTrackingStatus: function setTrackingStatus(status) { return forward(setTrackingStatusGuarded, arguments); },
136
+ getTrackingStatus: function getTrackingStatus() { return forward(getTrackingStatusGuarded, arguments); },
67
137
  };
68
- /** Turns automatic API tracking on or off; the `track_api` config flag is the usual way to set it. */
69
- const enableApiTracking = guard('enableApiTracking', enableApiTracking$1); // no i18n
70
- /** Reports an error the app caught, or an `error` / `unhandledrejection` event. */
71
- const AppticsTrackError = guard('AppticsTrackError', trackError); // no i18n
72
- const enableGlobalErrorHandler = guard('enableGlobalErrorHandler', enableGlobalErrorHandler$1); // no i18n
73
- /** Registers the signed-in user; properties may be a plain object or UserBuilder.build(). */
74
- const AppticsSetUser = guard('AppticsSetUser', setUser); // no i18n
75
- const getUser = guard('getUser', getUser$1); // no i18n
76
- const setTrackingStatus = guard('setTrackingStatus', setTrackingStatus$1); // no i18n
77
- const getTrackingStatus = guard('getTrackingStatus', getTrackingStatus$1); // no i18n
78
- const flush = guard('flush', flush$1); // no i18n
79
- /** Records a line for the next feedback submission. Costs nothing until feedback is sent. */
80
- const addFeedbackLog = guard('addFeedbackLog', addFeedbackLog$1); // no i18n
81
- /** Records a diagnostics key/value, grouped under `heading`, for the next feedback submission. */
82
- const addDiagnosticsInfo = guard('addDiagnosticsInfo', addDiagnosticsInfo$1); // no i18n
83
- /**
84
- * Turns debug mode on; works before init(), and wins over `debug` in init().
85
- *
86
- * On, engagement, exception and log go to their `debug/` twins and the answers carry a request id
87
- * and a link into the server's own logs. It switches itself off after an hour with nothing
88
- * tracked, so a forgotten tab stops tracing on its own.
89
- */
90
- const enableDebug = guard('enableDebug', enableDebug$1); // no i18n
91
- /** Turns debug mode off; works before init(), and wins over `debug` in init(). */
92
- const disableDebug = guard('disableDebug', disableDebug$1); // no i18n
93
- const reset = guard('reset', reset$1); // no i18n
94
138
  const apptics = {
95
139
  Apptics,
96
- AppticsEvents,
97
- AppticsScreenTracker,
98
- AppticsApiTracker,
99
- AppticsLogger,
100
- DefinedEvents,
101
- ApiTrackingBuilder,
102
- ready,
103
- enableDebug,
104
- disableDebug,
105
- enableApiTracking,
106
- AppticsTrackError,
107
- enableGlobalErrorHandler,
108
- AppticsSetUser,
109
- getUser,
110
- users,
111
- setTrackingStatus,
112
- getTrackingStatus,
113
- flush,
114
- addFeedbackLog,
115
- addDiagnosticsInfo,
116
- reset,
117
- AP_TRACKING_STATUS,
118
- AP_FEEDBACK_TYPE,
140
+ AppticsEvent,
141
+ AppticsScreen,
142
+ AppticsApi,
143
+ AppticsError,
144
+ AppticsUser,
145
+ AppticsSettings,
146
+ AppticsHeatmap,
119
147
  };
120
148
  scheduleAutoInit(Apptics);
121
149
 
122
- export { AP_FEEDBACK_TYPE, AP_TRACKING_STATUS, ApiTrackingBuilder, Apptics, AppticsApiTracker, AppticsEvents, AppticsLogger, AppticsScreenTracker, AppticsSetUser, AppticsTrackError, DefinedEvents, addDiagnosticsInfo, addFeedbackLog, apptics as default, disableDebug, enableApiTracking, enableDebug, enableGlobalErrorHandler, flush, getTrackingStatus, getUser, ready, reset, setTrackingStatus, users };
150
+ export { Apptics, AppticsApi, AppticsError, AppticsEvent, AppticsHeatmap, AppticsScreen, AppticsSettings, AppticsUser, apptics as default };
@@ -1,13 +1,20 @@
1
+ import { type ScreenRouteRule } from './core/constants.js';
1
2
  import type { AppticsConfig } from './types.js';
2
3
  /**
3
4
  * Starts the SDK. The config object is required: pass it directly, or let the console snippet
4
5
  * 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
6
+ * Returns true when the config has base_url, auth_key, app_domain and appversion and start-up has
6
7
  * begun (see ready()), false when it was already running, the config is missing or incomplete, or
7
8
  * there is no browser. Start-up calls app/addversion with those four, which answers with aaid, the
8
9
  * portal and project ids and the rest; then device/add registers the browser, as in 1.x.
9
10
  */
10
11
  export declare function init(config: AppticsConfig): boolean;
12
+ /**
13
+ * screen_routes as init() keeps it: each entry checked, an exact path cleaned up, a regex given as
14
+ * a string compiled. An entry that cannot be used is left out, and said, rather than matching
15
+ * something its author did not mean.
16
+ */
17
+ export declare function screenRouteRules(routes: unknown): ScreenRouteRule[];
11
18
  /** Resolves true once start-up has finished, false if init() refused or storage is unusable. */
12
19
  export declare function ready(): Promise<boolean>;
13
20
  /** Clears stored identity and queues, then starts again from the snippet. */