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

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