@zoho_apptics/apptics-js-sdk 1.0.2 → 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 (243) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/LICENSE +13 -0
  3. package/README.md +846 -11
  4. package/dist/apptics.esm.min.js +3 -0
  5. package/dist/apptics.esm.min.js.map +1 -0
  6. package/dist/apptics.min.js +3 -0
  7. package/dist/apptics.min.js.map +1 -0
  8. package/dist/chunks/lifecycle-VYr43KcB.min.js +3 -0
  9. package/dist/chunks/lifecycle-VYr43KcB.min.js.map +1 -0
  10. package/dist/cjs/auto-init.d.ts +8 -0
  11. package/dist/cjs/auto-init.js +32 -0
  12. package/dist/cjs/core/attempts.d.ts +28 -0
  13. package/dist/cjs/core/attempts.js +113 -0
  14. package/dist/cjs/core/batch.d.ts +32 -0
  15. package/dist/cjs/core/batch.js +116 -0
  16. package/dist/cjs/core/callsite.d.ts +34 -0
  17. package/dist/cjs/core/callsite.js +115 -0
  18. package/dist/cjs/core/consent.d.ts +27 -0
  19. package/dist/cjs/core/consent.js +132 -0
  20. package/dist/cjs/core/constants.d.ts +237 -0
  21. package/dist/cjs/core/constants.js +315 -0
  22. package/dist/cjs/core/db.d.ts +48 -0
  23. package/dist/cjs/core/db.js +467 -0
  24. package/dist/cjs/core/debug.d.ts +22 -0
  25. package/dist/cjs/core/debug.js +88 -0
  26. package/dist/cjs/core/env.d.ts +28 -0
  27. package/dist/cjs/core/env.js +267 -0
  28. package/dist/cjs/core/framework-id.d.ts +1 -0
  29. package/dist/cjs/core/framework-id.js +9 -0
  30. package/dist/cjs/core/guard.d.ts +11 -0
  31. package/dist/cjs/core/guard.js +86 -0
  32. package/dist/cjs/core/hooks.d.ts +39 -0
  33. package/dist/cjs/core/hooks.js +22 -0
  34. package/dist/cjs/core/locks.d.ts +9 -0
  35. package/dist/cjs/core/locks.js +22 -0
  36. package/dist/cjs/core/logger.d.ts +15 -0
  37. package/dist/cjs/core/logger.js +50 -0
  38. package/dist/cjs/core/state.d.ts +70 -0
  39. package/dist/cjs/core/state.js +78 -0
  40. package/dist/cjs/core/storage.d.ts +61 -0
  41. package/dist/cjs/core/storage.js +327 -0
  42. package/dist/cjs/core/stylesheet.d.ts +8 -0
  43. package/dist/cjs/core/stylesheet.js +29 -0
  44. package/dist/cjs/core/transport.d.ts +85 -0
  45. package/dist/cjs/core/transport.js +456 -0
  46. package/dist/cjs/core/utils.d.ts +26 -0
  47. package/dist/cjs/core/utils.js +175 -0
  48. package/dist/cjs/core/validate.d.ts +18 -0
  49. package/dist/cjs/core/validate.js +233 -0
  50. package/dist/cjs/device/appversion.d.ts +15 -0
  51. package/dist/cjs/device/appversion.js +170 -0
  52. package/dist/cjs/device/index.d.ts +34 -0
  53. package/dist/cjs/device/index.js +472 -0
  54. package/dist/cjs/engagement/api-rules.d.ts +49 -0
  55. package/dist/cjs/engagement/api-rules.js +206 -0
  56. package/dist/cjs/engagement/auto-api.d.ts +7 -0
  57. package/dist/cjs/engagement/auto-api.js +200 -0
  58. package/dist/cjs/engagement/auto-screen.d.ts +18 -0
  59. package/dist/cjs/engagement/auto-screen.js +305 -0
  60. package/dist/cjs/engagement/defined-events.d.ts +23 -0
  61. package/dist/cjs/engagement/defined-events.js +58 -0
  62. package/dist/cjs/engagement/send.d.ts +6 -0
  63. package/dist/cjs/engagement/send.js +104 -0
  64. package/dist/cjs/engagement/session.d.ts +51 -0
  65. package/dist/cjs/engagement/session.js +463 -0
  66. package/dist/cjs/engagement/track.d.ts +56 -0
  67. package/dist/cjs/engagement/track.js +375 -0
  68. package/dist/cjs/errors/send.d.ts +6 -0
  69. package/dist/cjs/errors/send.js +73 -0
  70. package/dist/cjs/errors/track.d.ts +4 -0
  71. package/dist/cjs/errors/track.js +167 -0
  72. package/dist/cjs/feedback/controls.d.ts +37 -0
  73. package/dist/cjs/feedback/controls.js +316 -0
  74. package/dist/cjs/feedback/index.d.ts +9 -0
  75. package/dist/cjs/feedback/index.js +56 -0
  76. package/dist/cjs/feedback/logs.d.ts +45 -0
  77. package/dist/cjs/feedback/logs.js +241 -0
  78. package/dist/cjs/feedback/quartz.d.ts +18 -0
  79. package/dist/cjs/feedback/quartz.js +105 -0
  80. package/dist/cjs/feedback/send.d.ts +28 -0
  81. package/dist/cjs/feedback/send.js +203 -0
  82. package/dist/cjs/feedback/styles.d.ts +10 -0
  83. package/dist/cjs/feedback/styles.js +8 -0
  84. package/dist/cjs/feedback/template.d.ts +2 -0
  85. package/dist/cjs/feedback/template.js +162 -0
  86. package/dist/cjs/feedback/ui.d.ts +63 -0
  87. package/dist/cjs/feedback/ui.js +709 -0
  88. package/dist/cjs/heatmap/send.d.ts +13 -0
  89. package/dist/cjs/heatmap/send.js +82 -0
  90. package/dist/cjs/heatmap/track.d.ts +4 -0
  91. package/dist/cjs/heatmap/track.js +448 -0
  92. package/dist/cjs/index.d.ts +22 -0
  93. package/dist/cjs/index.js +162 -0
  94. package/dist/cjs/lifecycle.d.ts +21 -0
  95. package/dist/cjs/lifecycle.js +734 -0
  96. package/dist/cjs/package.json +3 -0
  97. package/dist/cjs/remoteconfig/country.d.ts +4 -0
  98. package/dist/cjs/remoteconfig/country.js +73 -0
  99. package/dist/cjs/remoteconfig/custom.d.ts +10 -0
  100. package/dist/cjs/remoteconfig/custom.js +58 -0
  101. package/dist/cjs/remoteconfig/evaluate.d.ts +24 -0
  102. package/dist/cjs/remoteconfig/evaluate.js +184 -0
  103. package/dist/cjs/remoteconfig/fetch.d.ts +24 -0
  104. package/dist/cjs/remoteconfig/fetch.js +200 -0
  105. package/dist/cjs/remoteconfig/index.d.ts +15 -0
  106. package/dist/cjs/remoteconfig/index.js +116 -0
  107. package/dist/cjs/remoteconfig/store.d.ts +18 -0
  108. package/dist/cjs/remoteconfig/store.js +98 -0
  109. package/dist/cjs/remoteconfig/tz-countries.d.ts +8 -0
  110. package/dist/cjs/remoteconfig/tz-countries.js +13 -0
  111. package/dist/cjs/remotelog/gate.d.ts +2 -0
  112. package/dist/cjs/remotelog/gate.js +28 -0
  113. package/dist/cjs/remotelog/index.d.ts +8 -0
  114. package/dist/cjs/remotelog/logger.d.ts +22 -0
  115. package/dist/cjs/remotelog/logger.js +111 -0
  116. package/dist/cjs/remotelog/send.d.ts +13 -0
  117. package/dist/cjs/remotelog/send.js +153 -0
  118. package/dist/cjs/remotelogger/index.d.ts +12 -0
  119. package/dist/cjs/remotelogger/index.js +18 -0
  120. package/dist/cjs/scheduler.d.ts +8 -0
  121. package/dist/cjs/scheduler.js +78 -0
  122. package/dist/cjs/types.d.ts +385 -0
  123. package/dist/cjs/user/index.d.ts +33 -0
  124. package/dist/cjs/user/index.js +183 -0
  125. package/dist/esm/auto-init.d.ts +8 -0
  126. package/dist/esm/auto-init.js +29 -0
  127. package/dist/esm/core/attempts.d.ts +28 -0
  128. package/dist/esm/core/attempts.js +106 -0
  129. package/dist/esm/core/batch.d.ts +32 -0
  130. package/dist/esm/core/batch.js +109 -0
  131. package/dist/esm/core/callsite.d.ts +34 -0
  132. package/dist/esm/core/callsite.js +110 -0
  133. package/dist/esm/core/consent.d.ts +27 -0
  134. package/dist/esm/core/consent.js +122 -0
  135. package/dist/esm/core/constants.d.ts +237 -0
  136. package/dist/esm/core/constants.js +292 -0
  137. package/dist/esm/core/db.d.ts +48 -0
  138. package/dist/esm/core/db.js +453 -0
  139. package/dist/esm/core/debug.d.ts +22 -0
  140. package/dist/esm/core/debug.js +81 -0
  141. package/dist/esm/core/env.d.ts +28 -0
  142. package/dist/esm/core/env.js +251 -0
  143. package/dist/esm/core/framework-id.d.ts +1 -0
  144. package/dist/esm/core/framework-id.js +7 -0
  145. package/dist/esm/core/guard.d.ts +11 -0
  146. package/dist/esm/core/guard.js +83 -0
  147. package/dist/esm/core/hooks.d.ts +39 -0
  148. package/dist/esm/core/hooks.js +20 -0
  149. package/dist/esm/core/locks.d.ts +9 -0
  150. package/dist/esm/core/locks.js +20 -0
  151. package/dist/esm/core/logger.d.ts +15 -0
  152. package/dist/esm/core/logger.js +46 -0
  153. package/dist/esm/core/state.d.ts +70 -0
  154. package/dist/esm/core/state.js +73 -0
  155. package/dist/esm/core/storage.d.ts +61 -0
  156. package/dist/esm/core/storage.js +314 -0
  157. package/dist/esm/core/stylesheet.d.ts +8 -0
  158. package/dist/esm/core/stylesheet.js +27 -0
  159. package/dist/esm/core/transport.d.ts +85 -0
  160. package/dist/esm/core/transport.js +439 -0
  161. package/dist/esm/core/utils.d.ts +26 -0
  162. package/dist/esm/core/utils.js +161 -0
  163. package/dist/esm/core/validate.d.ts +18 -0
  164. package/dist/esm/core/validate.js +226 -0
  165. package/dist/esm/device/appversion.d.ts +15 -0
  166. package/dist/esm/device/appversion.js +164 -0
  167. package/dist/esm/device/index.d.ts +34 -0
  168. package/dist/esm/device/index.js +461 -0
  169. package/dist/esm/engagement/api-rules.d.ts +49 -0
  170. package/dist/esm/engagement/api-rules.js +199 -0
  171. package/dist/esm/engagement/auto-api.d.ts +7 -0
  172. package/dist/esm/engagement/auto-api.js +198 -0
  173. package/dist/esm/engagement/auto-screen.d.ts +18 -0
  174. package/dist/esm/engagement/auto-screen.js +301 -0
  175. package/dist/esm/engagement/defined-events.d.ts +23 -0
  176. package/dist/esm/engagement/defined-events.js +55 -0
  177. package/dist/esm/engagement/send.d.ts +6 -0
  178. package/dist/esm/engagement/send.js +101 -0
  179. package/dist/esm/engagement/session.d.ts +51 -0
  180. package/dist/esm/engagement/session.js +448 -0
  181. package/dist/esm/engagement/track.d.ts +56 -0
  182. package/dist/esm/engagement/track.js +365 -0
  183. package/dist/esm/errors/send.d.ts +6 -0
  184. package/dist/esm/errors/send.js +70 -0
  185. package/dist/esm/errors/track.d.ts +4 -0
  186. package/dist/esm/errors/track.js +163 -0
  187. package/dist/esm/feedback/controls.d.ts +37 -0
  188. package/dist/esm/feedback/controls.js +309 -0
  189. package/dist/esm/feedback/index.d.ts +9 -0
  190. package/dist/esm/feedback/index.js +51 -0
  191. package/dist/esm/feedback/logs.d.ts +45 -0
  192. package/dist/esm/feedback/logs.js +227 -0
  193. package/dist/esm/feedback/quartz.d.ts +18 -0
  194. package/dist/esm/feedback/quartz.js +99 -0
  195. package/dist/esm/feedback/send.d.ts +28 -0
  196. package/dist/esm/feedback/send.js +198 -0
  197. package/dist/esm/feedback/styles.d.ts +10 -0
  198. package/dist/esm/feedback/styles.js +4 -0
  199. package/dist/esm/feedback/template.d.ts +2 -0
  200. package/dist/esm/feedback/template.js +159 -0
  201. package/dist/esm/feedback/ui.d.ts +63 -0
  202. package/dist/esm/feedback/ui.js +703 -0
  203. package/dist/esm/heatmap/send.d.ts +13 -0
  204. package/dist/esm/heatmap/send.js +79 -0
  205. package/dist/esm/heatmap/track.d.ts +4 -0
  206. package/dist/esm/heatmap/track.js +445 -0
  207. package/dist/esm/index.d.ts +22 -0
  208. package/dist/esm/index.js +150 -0
  209. package/dist/esm/lifecycle.d.ts +21 -0
  210. package/dist/esm/lifecycle.js +729 -0
  211. package/dist/esm/package.json +3 -0
  212. package/dist/esm/remoteconfig/country.d.ts +4 -0
  213. package/dist/esm/remoteconfig/country.js +70 -0
  214. package/dist/esm/remoteconfig/custom.d.ts +10 -0
  215. package/dist/esm/remoteconfig/custom.js +54 -0
  216. package/dist/esm/remoteconfig/evaluate.d.ts +24 -0
  217. package/dist/esm/remoteconfig/evaluate.js +179 -0
  218. package/dist/esm/remoteconfig/fetch.d.ts +24 -0
  219. package/dist/esm/remoteconfig/fetch.js +196 -0
  220. package/dist/esm/remoteconfig/index.d.ts +15 -0
  221. package/dist/esm/remoteconfig/index.js +111 -0
  222. package/dist/esm/remoteconfig/store.d.ts +18 -0
  223. package/dist/esm/remoteconfig/store.js +91 -0
  224. package/dist/esm/remoteconfig/tz-countries.d.ts +8 -0
  225. package/dist/esm/remoteconfig/tz-countries.js +11 -0
  226. package/dist/esm/remotelog/gate.d.ts +2 -0
  227. package/dist/esm/remotelog/gate.js +26 -0
  228. package/dist/esm/remotelog/index.d.ts +8 -0
  229. package/dist/esm/remotelog/logger.d.ts +22 -0
  230. package/dist/esm/remotelog/logger.js +108 -0
  231. package/dist/esm/remotelog/send.d.ts +13 -0
  232. package/dist/esm/remotelog/send.js +149 -0
  233. package/dist/esm/remotelogger/index.d.ts +12 -0
  234. package/dist/esm/remotelogger/index.js +13 -0
  235. package/dist/esm/scheduler.d.ts +8 -0
  236. package/dist/esm/scheduler.js +74 -0
  237. package/dist/esm/types.d.ts +385 -0
  238. package/dist/esm/user/index.d.ts +33 -0
  239. package/dist/esm/user/index.js +176 -0
  240. package/dist/feedback.esm.min.js +3 -0
  241. package/dist/feedback.esm.min.js.map +1 -0
  242. package/package.json +122 -7
  243. package/src/appticssdk.js +0 -1
@@ -0,0 +1,267 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ var constants = require('./constants.js');
5
+ var utils = require('./utils.js');
6
+
7
+ function isBlockedWS(ua) {
8
+ var i;
9
+ ua = ua.toLowerCase();
10
+ for (i = 0; i < constants.BLOCKED_WS.length; i++) {
11
+ if (ua.indexOf(constants.BLOCKED_WS[i]) !== -1) {
12
+ return true;
13
+ }
14
+ }
15
+ return false;
16
+ }
17
+ /** Device RAM as the API wants it ("4 GB"). Chromium only; empty elsewhere. */
18
+ function getRam() {
19
+ var gb = navigator.deviceMemory;
20
+ return typeof gb === 'number' && gb > 0 ? gb + ' GB' : ''; // no i18n
21
+ }
22
+ function getConnectionType() {
23
+ var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || {};
24
+ return connection.effectiveType || connection.type || ''; // no i18n
25
+ }
26
+ function getNetworkStatus() {
27
+ return window.navigator.onLine ? 0 : -1;
28
+ }
29
+ /**
30
+ * The battery as a whole percentage, or null where the browser will not say.
31
+ *
32
+ * feedbackWebSDK types `battery` as an int and the console shows it next to a report, which is
33
+ * what makes "it died while I was filling this in" legible. The Battery Status API is behind a
34
+ * promise and is absent in Firefox and Safari entirely, so this answers null rather than 0 -
35
+ * a real 0% and "no answer" are different things, and only one of them belongs in a report.
36
+ */
37
+ function getBatteryPercent() {
38
+ try {
39
+ var getBattery = navigator.getBattery;
40
+ if (typeof getBattery !== 'function') { // no i18n
41
+ return Promise.resolve(null);
42
+ }
43
+ return getBattery.call(navigator).then(function (battery) {
44
+ var level = battery && typeof battery.level === 'number' ? battery.level : -1; // no i18n
45
+ return level >= 0 && level <= 1 ? Math.round(level * 100) : null;
46
+ }, function () {
47
+ return null;
48
+ });
49
+ }
50
+ catch (err) {
51
+ return Promise.resolve(null);
52
+ }
53
+ }
54
+ function getOrientation() {
55
+ var orientation = (window.screen && window.screen.orientation && window.screen.orientation.type) || ''; // no i18n
56
+ if (utils.includes(orientation, 'portrait-primary')) { // no i18n
57
+ return 0;
58
+ }
59
+ if (utils.includes(orientation, 'landscape-primary')) { // no i18n
60
+ return 1;
61
+ }
62
+ if (utils.includes(orientation, 'landscape-secondary')) { // no i18n
63
+ return 2;
64
+ }
65
+ if (utils.includes(orientation, 'portrait-secondary')) { // no i18n
66
+ return 3;
67
+ }
68
+ return -1;
69
+ }
70
+ function getDevice() {
71
+ var ua = navigator.userAgent;
72
+ if (/Windows/i.test(ua)) {
73
+ return (/Phone/.test(ua) || /WPDesktop/.test(ua)) ? 'Windows Phone' : 'Windows'; // no i18n
74
+ }
75
+ if (/iPad/.test(ua)) {
76
+ return 'iPad'; // no i18n
77
+ }
78
+ if (/iPod/.test(ua)) {
79
+ return 'iPod Touch'; // no i18n
80
+ }
81
+ if (/iPhone/.test(ua)) {
82
+ return 'iPhone'; // no i18n
83
+ }
84
+ if (/(BlackBerry|PlayBook|BB10)/i.test(ua)) {
85
+ return 'BlackBerry'; // no i18n
86
+ }
87
+ if (/Android/.test(ua)) {
88
+ return 'Android'; // no i18n
89
+ }
90
+ if (/Mac/i.test(ua)) {
91
+ return 'Mac'; // no i18n
92
+ }
93
+ if (/Linux/.test(ua)) {
94
+ return 'Linux'; // no i18n
95
+ }
96
+ if (/CrOS/.test(ua)) {
97
+ return 'Chrome'; // no i18n
98
+ }
99
+ return ''; // no i18n
100
+ }
101
+ function getOS() {
102
+ var ua = navigator.userAgent;
103
+ if (/Windows/i.test(ua)) {
104
+ return (/Phone/.test(ua) || /WPDesktop/.test(ua)) ? 'Windows Phone' : 'Windows'; // no i18n
105
+ }
106
+ if (/(iPhone|iPad|iPod)/.test(ua)) {
107
+ return 'iOS'; // no i18n
108
+ }
109
+ if (/Android/.test(ua)) {
110
+ return 'Android'; // no i18n
111
+ }
112
+ if (/(BlackBerry|PlayBook|BB10)/i.test(ua)) {
113
+ return 'BlackBerry'; // no i18n
114
+ }
115
+ if (/Mac/i.test(ua)) {
116
+ return 'Mac OS X'; // no i18n
117
+ }
118
+ if (/Linux/.test(ua)) {
119
+ return 'Linux'; // no i18n
120
+ }
121
+ if (/CrOS/.test(ua)) {
122
+ return 'Chrome OS'; // no i18n
123
+ }
124
+ return ''; // no i18n
125
+ }
126
+ function getBrowser() {
127
+ var ua = navigator.userAgent;
128
+ var vendor = navigator.vendor || ''; // no i18n // vendor is undefined for at least IE9
129
+ var opera = window.opera;
130
+ if (opera || utils.includes(ua, ' OPR/')) { // no i18n
131
+ return (utils.includes(ua, 'Mini')) ? 'Opera Mini' : 'Opera'; // no i18n
132
+ }
133
+ if (/(BlackBerry|PlayBook|BB10)/i.test(ua)) {
134
+ return 'BlackBerry'; // no i18n
135
+ }
136
+ if (utils.includes(ua, 'IEMobile') || utils.includes(ua, 'WPDesktop')) { // no i18n
137
+ return 'Internet Explorer Mobile'; // no i18n
138
+ }
139
+ if (utils.includes(ua, 'SamsungBrowser/')) { // no i18n
140
+ return 'Samsung Internet'; // no i18n
141
+ }
142
+ if (utils.includes(ua, 'Edge') || utils.includes(ua, 'Edg/')) { // no i18n
143
+ return 'Microsoft Edge'; // no i18n
144
+ }
145
+ if (utils.includes(ua, 'FBIOS')) { // no i18n
146
+ return 'Facebook Mobile'; // no i18n
147
+ }
148
+ if (utils.includes(ua, 'Chrome')) { // no i18n
149
+ if (typeof ulaa == 'object') {
150
+ return 'Ulaa'; // no i18n
151
+ }
152
+ else if (window.navigator.brave != undefined && window.navigator.brave.isBrave.name == "isBrave") { // no i18n
153
+ return 'Brave'; // no i18n
154
+ }
155
+ else {
156
+ return 'Chrome'; // no i18n
157
+ }
158
+ }
159
+ if (utils.includes(ua, 'CriOS')) { // no i18n
160
+ return 'Chrome iOS'; // no i18n
161
+ }
162
+ if (utils.includes(ua, 'UCWEB') || utils.includes(ua, 'UCBrowser')) { // no i18n
163
+ return 'UC Browser'; // no i18n
164
+ }
165
+ if (utils.includes(ua, 'FxiOS')) { // no i18n
166
+ return 'Firefox iOS'; // no i18n
167
+ }
168
+ if (utils.includes(vendor, 'Apple')) { // no i18n
169
+ return (utils.includes(ua, 'Mobile')) ? 'Mobile Safari' : 'Safari'; // no i18n
170
+ }
171
+ if (utils.includes(ua, 'Android')) { // no i18n
172
+ return 'Android Mobile'; // no i18n
173
+ }
174
+ if (utils.includes(ua, 'Konqueror')) { // no i18n
175
+ return 'Konqueror'; // no i18n
176
+ }
177
+ if (utils.includes(ua, 'Firefox')) { // no i18n
178
+ return 'Firefox'; // no i18n
179
+ }
180
+ if (utils.includes(ua, 'MSIE') || utils.includes(ua, 'Trident/')) { // no i18n
181
+ return 'Internet Explorer'; // no i18n
182
+ }
183
+ if (utils.includes(ua, 'Gecko')) { // no i18n
184
+ return 'Mozilla'; // no i18n
185
+ }
186
+ return ''; // no i18n
187
+ }
188
+ function getBrowserVersion() {
189
+ var browser = getBrowser();
190
+ var ua = navigator.userAgent;
191
+ var versionRegexs = {
192
+ 'Internet Explorer Mobile': /rv:(\d+(\.\d+)?)/, // no i18n
193
+ 'Microsoft Edge': /Edg\/(\d+(\.\d+)?)/, // no i18n
194
+ 'Chrome': /Chrome\/(\d+(\.\d+)?)/, // no i18n
195
+ 'Brave': /Chrome\/(\d+(\.\d+)?)/, // no i18n
196
+ 'Chrome iOS': /CriOS\/(\d+(\.\d+)?)/, // no i18n
197
+ 'UC Browser': /(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/, // no i18n
198
+ 'Safari': /Version\/(\d+(\.\d+)?)/, // no i18n
199
+ 'Mobile Safari': /Version\/(\d+(\.\d+)?)/, // no i18n
200
+ 'Opera': /(Opera|OPR)\/(\d+(\.\d+)?)/, // no i18n
201
+ 'Firefox': /Firefox\/(\d+(\.\d+)?)/, // no i18n
202
+ 'Firefox iOS': /FxiOS\/(\d+(\.\d+)?)/, // no i18n
203
+ 'Konqueror': /Konqueror:(\d+(\.\d+)?)/, // no i18n
204
+ 'BlackBerry': /BlackBerry (\d+(\.\d+)?)/, // no i18n
205
+ 'Android Mobile': /android\s(\d+(\.\d+)?)/, // no i18n
206
+ 'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/, // no i18n
207
+ 'Mozilla': /rv:(\d+(\.\d+)?)/ // no i18n
208
+ };
209
+ // Check for Ulaa browser version
210
+ if (browser === 'Ulaa' && typeof ulaa === 'object') { // no i18n
211
+ return ulaa.getVersion();
212
+ }
213
+ var regex = versionRegexs[browser];
214
+ if (regex === undefined) {
215
+ return ''; // no i18n
216
+ }
217
+ var matches = ua.match(regex);
218
+ if (!matches) {
219
+ return ''; // no i18n
220
+ }
221
+ return parseFloat(matches[matches.length - 2]);
222
+ }
223
+ function getReferringURL() {
224
+ var split = String(window.location.href || '').split(window.location.pathname); // no i18n
225
+ if (split.length >= 2) {
226
+ return split[1].length > 500 ? split[1].substring(0, 500) : split[1];
227
+ }
228
+ return ''; // no i18n
229
+ }
230
+ function getTimeZone() {
231
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
232
+ }
233
+ /** True for crawlers and non-browser environments; the SDK does nothing for them. */
234
+ function is_apptics_disabled() {
235
+ return typeof navigator === 'undefined' || isBlockedWS(navigator.userAgent || ''); // no i18n
236
+ }
237
+ /** Pure DNT check (no side effects). consent.hasDoNotTrackEnabled() applies NO_TRACKING. */
238
+ function isDntOn() {
239
+ var nav = window.navigator || {};
240
+ var dntValues = [true, 1, '1', 'yes']; // no i18n
241
+ return [nav.doNotTrack, nav.msDoNotTrack, window.doNotTrack].some(function (dntValue) {
242
+ return utils.includes(dntValues, dntValue);
243
+ });
244
+ }
245
+ /** The console snippet's config (window.appticssettings._defaultoptions), if the page defines one. */
246
+ function getSnippetOptions() {
247
+ if (typeof window === 'undefined' || !window.appticssettings) { // no i18n
248
+ return undefined;
249
+ }
250
+ return window.appticssettings._defaultoptions;
251
+ }
252
+
253
+ exports.getBatteryPercent = getBatteryPercent;
254
+ exports.getBrowser = getBrowser;
255
+ exports.getBrowserVersion = getBrowserVersion;
256
+ exports.getConnectionType = getConnectionType;
257
+ exports.getDevice = getDevice;
258
+ exports.getNetworkStatus = getNetworkStatus;
259
+ exports.getOS = getOS;
260
+ exports.getOrientation = getOrientation;
261
+ exports.getRam = getRam;
262
+ exports.getReferringURL = getReferringURL;
263
+ exports.getSnippetOptions = getSnippetOptions;
264
+ exports.getTimeZone = getTimeZone;
265
+ exports.isBlockedWS = isBlockedWS;
266
+ exports.isDntOn = isDntOn;
267
+ exports.is_apptics_disabled = is_apptics_disabled;
@@ -0,0 +1 @@
1
+ export declare const FRAMEWORK_ID = 6002;
@@ -0,0 +1,9 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ // Generated by scripts/register-version.mjs — do not edit by hand.
5
+ // The framework id Apptics issued for this SDK, from POST /sdk/web/v1/framework/addversion
6
+ // (version 2.0.0-beta.1, platform Browser). Regenerated on every npm pack.
7
+ const FRAMEWORK_ID = 6002;
8
+
9
+ exports.FRAMEWORK_ID = FRAMEWORK_ID;
@@ -0,0 +1,11 @@
1
+ /** Public calls never throw into the host app, and are buffered until start-up finishes. */
2
+ export declare function guard<F extends (...args: any[]) => any>(name: string, fn: F): F;
3
+ /**
4
+ * Hands a public call's own `arguments` to its guarded function, exactly as they were given.
5
+ *
6
+ * guard() returns a wrapper that takes `...args`, so a browser console shows every public call as
7
+ * `(...args)`. Each public call is therefore its own function with named parameters, which is what
8
+ * the console shows, and forwards through this: `arguments` rather than the named parameters, so
9
+ * a call keeps its argument count (addEvent tells its two forms apart by it).
10
+ */
11
+ export declare function forward<F extends (...args: any[]) => any>(guarded: F, args: IArguments): ReturnType<F>;
@@ -0,0 +1,86 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ var state = require('./state.js');
5
+ var logger = require('./logger.js');
6
+
7
+ /**
8
+ * Calls that run immediately while storage is loading. Everything else is buffered and replayed in order.
9
+ * getUser / getTrackingStatus answer from defaults until then; sendFeedback waits for ready() itself.
10
+ * The two log collectors run now so an entry keeps the time it actually happened.
11
+ */
12
+ const RUN_BEFORE_READY = {
13
+ 'Apptics.init': true, 'Apptics.ready': true, 'Apptics.reset': true, 'AppticsUser.getUser': true,
14
+ 'AppticsSettings.getTrackingStatus': true, 'AppticsFeedback.sendFeedback': true,
15
+ 'AppticsFeedback.addFeedbackLog': true, 'AppticsFeedback.addDiagnosticsInfo': true,
16
+ // a switch, which init() must not undo: it keeps what was set when its config has no theme
17
+ 'AppticsFeedback.setFeedbackTheme': true,
18
+ // a switch, and a call that hands back the id endTrackApi needs: neither can wait in a queue
19
+ 'AppticsApi.configure': true, 'AppticsApi.startTrackApi': true,
20
+ // these wait for ready() themselves, and a queued call would hand back undefined, not a Promise
21
+ 'AppticsRemoteConfig.fetchValue': true, 'AppticsRemoteConfig.fetchValues': true,
22
+ 'AppticsRemoteConfig.setCustomConditionValue': true,
23
+ 'Apptics.enableDebug': true, 'Apptics.disableDebug': true,
24
+ };
25
+ /**
26
+ * Calls that record or send something, and so are lost when the SDK hasn't started. Calls that only
27
+ * set a switch or read a value (Apptics.enableDebug, AppticsLogger.enable, AppticsFeedback.addFeedbackLog,
28
+ * AppticsUser.getUser, …)
29
+ * work without Apptics.init() and are not listed.
30
+ */
31
+ const NEEDS_INIT = {
32
+ 'AppticsEvent.addEvent': true, 'AppticsScreen.inScreen': true, 'AppticsScreen.outScreen': true,
33
+ 'AppticsApi.endTrackApi': true, 'AppticsError.trackError': true, 'AppticsUser.setUser': true,
34
+ 'Apptics.flush': true, AppticsLogger: true, 'AppticsFeedback.sendFeedback': true, 'AppticsRemoteConfig.fetchValue': true,
35
+ 'AppticsRemoteConfig.fetchValues': true,
36
+ };
37
+ /** How a call is named in a message: every public call is named after its object, as `AppticsEvent.addEvent`. */
38
+ function publicName(name) {
39
+ return name.indexOf('Apptics') === 0 ? name : 'apptics.' + name; // no i18n
40
+ }
41
+ /** Warned once per page: one line is a clue, a line per call would bury the console. */
42
+ var warnedNotStarted = false;
43
+ /** Public calls never throw into the host app, and are buffered until start-up finishes. */
44
+ function guard(name, fn) {
45
+ const guarded = function (...args) {
46
+ // not started: init() wasn't called, or it refused the config. Say so whether or not
47
+ // console_log is on, since console_log itself is only switched on by init()
48
+ if (!state._ZAP._initialised && NEEDS_INIT[name] && !warnedNotStarted) {
49
+ warnedNotStarted = true;
50
+ logger.warnAlways(publicName(name) + ': the SDK has not started, so this call is ignored. Call Apptics.init() first, and check its warnings if you did.'); // no i18n
51
+ }
52
+ if (state._ZAP._initialised && !state._ZAP._ready && !RUN_BEFORE_READY[name]) {
53
+ state._ZAP._pending.push(function () {
54
+ guarded(...args);
55
+ });
56
+ return undefined;
57
+ }
58
+ try {
59
+ return fn(...args);
60
+ }
61
+ catch (err) {
62
+ // a public call swallowing its own exception into a debug-gated console line is how
63
+ // "the modal does not open" looks from the outside: nothing happens, nothing is said.
64
+ // The app is still shielded - the call returns undefined rather than throwing - but
65
+ // the failure is now visible without debug, and reaches the remote logger
66
+ logger.warnAlways(publicName(name) + ' failed:', err); // no i18n
67
+ logger.logFailure(name, err);
68
+ return undefined;
69
+ }
70
+ };
71
+ return guarded;
72
+ }
73
+ /**
74
+ * Hands a public call's own `arguments` to its guarded function, exactly as they were given.
75
+ *
76
+ * guard() returns a wrapper that takes `...args`, so a browser console shows every public call as
77
+ * `(...args)`. Each public call is therefore its own function with named parameters, which is what
78
+ * the console shows, and forwards through this: `arguments` rather than the named parameters, so
79
+ * a call keeps its argument count (addEvent tells its two forms apart by it).
80
+ */
81
+ function forward(guarded, args) {
82
+ return guarded.apply(null, Array.prototype.slice.call(args));
83
+ }
84
+
85
+ exports.forward = forward;
86
+ exports.guard = guard;
@@ -0,0 +1,39 @@
1
+ import type { DeviceInfo, ServerResult } from '../types.js';
2
+ /**
3
+ * Late-bound calls from lower modules up to the modules above them (see spec §5). device.ts and
4
+ * remotelog/index.ts assign these when they are evaluated; the defaults only run if that module
5
+ * was never imported.
6
+ */
7
+ export declare const hooks: {
8
+ updateDevice: (deviceInfo: DeviceInfo) => Promise<ServerResult>;
9
+ refreshDeviceInfo: () => void;
10
+ /** Set by remotelog/index.ts. Here, not imported, so the logger doesn't depend on the sender. */
11
+ /**
12
+ * Set by feedback/controls.ts: the user picked in the feedback form, or null for anonymous.
13
+ * Here so transport can read the choice without importing the modal.
14
+ */
15
+ feedbackUser: () => {
16
+ userid: string;
17
+ groupid: string;
18
+ } | null;
19
+ /**
20
+ * Set by heatmap/send.ts. Here so the scheduler can flush heatmap records without importing
21
+ * the module — an app that never imports the heatmap entry keeps the default no-op.
22
+ */
23
+ sendHeatmaps: (forget?: boolean) => Promise<void>;
24
+ /** Set by heatmap/track.ts, so init() and reset() can switch capture without importing it. */
25
+ trackHeatmap: (status?: boolean) => void;
26
+ /** Set by heatmap/track.ts: clears what this visit recorded, so the cap starts again. */
27
+ resetHeatmap: () => void;
28
+ /** Set by remoteconfig/fetch.ts, so reset() can forget the rule set without importing it. */
29
+ resetRemoteConfig: () => void;
30
+ /**
31
+ * Set by engagement/auto-screen.ts: the app called inScreen() itself. Here because
32
+ * auto-screen records through track.ts, so track.ts cannot import it back.
33
+ */
34
+ screenTrackedByApp: () => void;
35
+ /** Set by remoteconfig/fetch.ts: start-up has finished, so remote config fetches its values. */
36
+ remoteConfigStarted: () => void;
37
+ /** Set by remoteconfig/fetch.ts: AppticsUser.setUser changed who this is, so conditions on the user re-apply. */
38
+ remoteConfigUserChanged: () => void;
39
+ };
@@ -0,0 +1,22 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ /**
5
+ * Late-bound calls from lower modules up to the modules above them (see spec §5). device.ts and
6
+ * remotelog/index.ts assign these when they are evaluated; the defaults only run if that module
7
+ * was never imported.
8
+ */
9
+ const hooks = {
10
+ updateDevice: () => Promise.reject('apptics: device module not loaded'), // no i18n
11
+ refreshDeviceInfo: () => { },
12
+ feedbackUser: () => null,
13
+ sendHeatmaps: () => Promise.resolve(),
14
+ trackHeatmap: () => { },
15
+ resetHeatmap: () => { },
16
+ resetRemoteConfig: () => { },
17
+ screenTrackedByApp: () => { },
18
+ remoteConfigStarted: () => { },
19
+ remoteConfigUserChanged: () => { },
20
+ };
21
+
22
+ exports.hooks = hooks;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runs `run` while holding the Web Lock `name`, waiting for it if another tab of this site holds
3
+ * it. Locks are shared by every tab of an origin, which is what keeps two tabs from registering
4
+ * the same browser twice or overwriting each other's session.
5
+ *
6
+ * Without the Web Locks API (older browsers), `run` simply runs, as it did before locks were used.
7
+ * Not reentrant: `run` must not ask for the same lock again, or it waits for itself.
8
+ */
9
+ export declare function withLock<T>(name: string, run: () => Promise<T>): Promise<T>;
@@ -0,0 +1,22 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ /**
5
+ * Runs `run` while holding the Web Lock `name`, waiting for it if another tab of this site holds
6
+ * it. Locks are shared by every tab of an origin, which is what keeps two tabs from registering
7
+ * the same browser twice or overwriting each other's session.
8
+ *
9
+ * Without the Web Locks API (older browsers), `run` simply runs, as it did before locks were used.
10
+ * Not reentrant: `run` must not ask for the same lock again, or it waits for itself.
11
+ */
12
+ function withLock(name, run) {
13
+ var locks = typeof navigator !== 'undefined' ? navigator.locks : undefined; // no i18n
14
+ if (!locks || typeof locks.request !== 'function') { // no i18n
15
+ return run();
16
+ }
17
+ return locks.request('apptics-' + name, function () {
18
+ return run();
19
+ });
20
+ }
21
+
22
+ exports.withLock = withLock;
@@ -0,0 +1,15 @@
1
+ export declare const Console: {
2
+ log: (...args: unknown[]) => void;
3
+ warn: (...args: unknown[]) => void;
4
+ error: (...args: unknown[]) => void;
5
+ info: (...args: unknown[]) => void;
6
+ dir(arg: unknown): void;
7
+ };
8
+ /** Warnings the integrator must see even with debug off (e.g. missing required config). */
9
+ export declare function warnAlways(...args: unknown[]): void;
10
+ /**
11
+ * A failure inside one of the SDK's own modules, `module` one of AP_LOG_MODULE's values: said in
12
+ * the browser console in debug mode. Nothing is sent: the Remote Logger page carries only the
13
+ * lines an app logs with AppticsLogger.
14
+ */
15
+ export declare function logFailure(module: string, ...args: unknown[]): void;
@@ -0,0 +1,50 @@
1
+ /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.1 | (c) Zoho Corporation Private Limited | see LICENSE */
2
+ 'use strict';
3
+
4
+ var state = require('./state.js');
5
+ var utils = require('./utils.js');
6
+
7
+ const APConsole = typeof console !== 'undefined' ? console : null;
8
+ function gated(method) {
9
+ return function (...args) {
10
+ if (state._ZAP._config.debug && APConsole) {
11
+ try {
12
+ APConsole[method].apply(APConsole, args);
13
+ }
14
+ catch (err) {
15
+ utils.each(args, function (arg) {
16
+ APConsole[method](arg);
17
+ });
18
+ }
19
+ }
20
+ };
21
+ }
22
+ // Console override
23
+ const Console = {
24
+ log: gated('log'),
25
+ warn: gated('warn'),
26
+ error: gated('error'),
27
+ info: gated('info'),
28
+ dir(arg) {
29
+ if (state._ZAP._config.debug && APConsole) {
30
+ APConsole.dir(arg);
31
+ }
32
+ },
33
+ };
34
+ /** Warnings the integrator must see even with debug off (e.g. missing required config). */
35
+ function warnAlways(...args) {
36
+ if (APConsole)
37
+ APConsole.warn(...args);
38
+ }
39
+ /**
40
+ * A failure inside one of the SDK's own modules, `module` one of AP_LOG_MODULE's values: said in
41
+ * the browser console in debug mode. Nothing is sent: the Remote Logger page carries only the
42
+ * lines an app logs with AppticsLogger.
43
+ */
44
+ function logFailure(module, ...args) {
45
+ Console.error.apply(null, args);
46
+ }
47
+
48
+ exports.Console = Console;
49
+ exports.logFailure = logFailure;
50
+ exports.warnAlways = warnAlways;
@@ -0,0 +1,70 @@
1
+ import { type ApConfig } from './constants.js';
2
+ import type { DeviceInfo, Dict, QuartzSettings, TrackingStatus, UserInfo } from '../types.js';
3
+ /** Runtime state shared by every module (the former `_ZAP` object). */
4
+ export interface State {
5
+ _initialised: boolean;
6
+ /** Start-up finished (storage loaded, session open, timers running). */
7
+ _ready: boolean;
8
+ /** Public calls made after init() and before _ready, replayed in order. */
9
+ _pending: Array<() => void>;
10
+ _readyPromise: Promise<boolean> | null;
11
+ _regDeviceSending: boolean;
12
+ _regDeviceResolve: Array<(value: any) => void>;
13
+ _regDeviceReject: Array<(reason: any) => void>;
14
+ _sending: boolean;
15
+ _deferSendTimer: ReturnType<typeof setTimeout> | null;
16
+ _config: ApConfig;
17
+ _defaultoptions: Dict;
18
+ inactiveduration: number;
19
+ _token: string;
20
+ _frameworkID: number;
21
+ _platform: string;
22
+ _isanonrequired: boolean;
23
+ _devicestatus: TrackingStatus;
24
+ _uuid: string;
25
+ _apid: string;
26
+ _mapid: string;
27
+ _device_info: DeviceInfo;
28
+ _user_info: UserInfo;
29
+ _current_screen: Dict;
30
+ _current_session: Dict;
31
+ _properties: Dict;
32
+ _ignoreDnt: boolean;
33
+ _isGlobalErrorTracking: boolean;
34
+ _shouldTrack: boolean;
35
+ _engagementTracking: boolean;
36
+ _errorTracking: boolean;
37
+ /** getsdkconfig module 18. Heatmap has its own flag in v2; before that it rode engagement. */
38
+ _heatmapTracking: boolean;
39
+ /** getsdkconfig module 17. */
40
+ _remoteLoggerEnabled: boolean;
41
+ /** getsdkconfig's module flag for remote config, which is the authority on whether it runs. */
42
+ _remoteConfigEnabled: boolean;
43
+ /** What the last getupdates answer said, used only to stop asking about a module it reported off. */
44
+ _remoteConfigReported: boolean;
45
+ /** getsdkconfig module 12. */
46
+ _feedbackEnabled: boolean;
47
+ /** getsdkconfig's `quartz` block: screen recording in the feedback form. Off until it says otherwise. */
48
+ _quartz: QuartzSettings;
49
+ /** Epoch ms getsdkconfig asked us to wait until before asking again. 0 means no answer yet. */
50
+ _nextConfigCheck: number;
51
+ /**
52
+ * When debug mode switches itself off, as a timestamp; 0 while it is not running.
53
+ * Every tracked item pushes it back, so it only arrives after a genuinely idle hour.
54
+ */
55
+ _debugUntil: number;
56
+ _trackinfo: Dict;
57
+ }
58
+ export declare const _ZAP: State;
59
+ /** Restores every field to its default. The object identity is kept, since modules hold a reference to it. */
60
+ export declare function resetState(): void;
61
+ export declare function getConfig<K extends keyof ApConfig>(key: K): ApConfig[K];
62
+ /** The oldest timestamp still worth keeping: now minus batch_request_timeout days. */
63
+ export declare function oldestKeptTime(): number;
64
+ /**
65
+ * True for an item too old (or dated far enough in the future to be nonsense) to be worth
66
+ * sending. Queues use it to drop such items on the way in, and the sender uses it to drop the
67
+ * ones already stored. A minute of slack absorbs clock differences between tabs and machines,
68
+ * so an item a few milliseconds ahead of this clock is still kept.
69
+ */
70
+ export declare function isExpired(time: unknown): boolean;