@zoho_apptics/apptics-js-sdk 2.0.0-beta.2 → 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 (223) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +229 -174
  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 -3
  19. package/dist/cjs/core/consent.d.ts +9 -6
  20. package/dist/cjs/core/consent.js +63 -10
  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 +44 -0
  24. package/dist/cjs/core/constants.js +55 -1
  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.js +1 -1
  29. package/dist/cjs/core/framework-id.d.ts +1 -1
  30. package/dist/cjs/core/framework-id.js +3 -3
  31. package/dist/cjs/core/guard.js +19 -4
  32. package/dist/cjs/core/hooks.d.ts +25 -1
  33. package/dist/cjs/core/hooks.js +11 -1
  34. package/dist/cjs/core/locks.js +1 -1
  35. package/dist/cjs/core/logger.js +1 -1
  36. package/dist/cjs/core/shield.d.ts +31 -0
  37. package/dist/cjs/core/shield.js +129 -0
  38. package/dist/cjs/core/state.d.ts +5 -1
  39. package/dist/cjs/core/state.js +3 -1
  40. package/dist/cjs/core/storage.d.ts +7 -0
  41. package/dist/cjs/core/storage.js +28 -6
  42. package/dist/cjs/core/stylesheet.js +1 -1
  43. package/dist/cjs/core/transport.d.ts +15 -4
  44. package/dist/cjs/core/transport.js +63 -13
  45. package/dist/cjs/core/utils.js +1 -1
  46. package/dist/cjs/core/validate.js +6 -5
  47. package/dist/cjs/device/appversion.js +1 -1
  48. package/dist/cjs/device/index.js +63 -15
  49. package/dist/cjs/engagement/api-rules.js +1 -1
  50. package/dist/cjs/engagement/auto-api.js +4 -3
  51. package/dist/cjs/engagement/auto-screen.js +10 -6
  52. package/dist/cjs/engagement/defined-events.d.ts +2 -3
  53. package/dist/cjs/engagement/defined-events.js +10 -16
  54. package/dist/cjs/engagement/send.js +1 -1
  55. package/dist/cjs/engagement/session.js +77 -37
  56. package/dist/cjs/engagement/track.js +9 -6
  57. package/dist/cjs/errors/send.js +1 -1
  58. package/dist/cjs/errors/track.js +3 -2
  59. package/dist/cjs/feedback/controls.d.ts +30 -4
  60. package/dist/cjs/feedback/controls.js +237 -51
  61. package/dist/cjs/feedback/i18n/index.d.ts +31 -0
  62. package/dist/cjs/feedback/i18n/index.js +187 -0
  63. package/dist/cjs/feedback/i18n/strings.d.ts +9 -0
  64. package/dist/cjs/feedback/i18n/strings.js +8 -0
  65. package/dist/cjs/feedback/index.js +1 -1
  66. package/dist/cjs/feedback/logs.js +5 -4
  67. package/dist/cjs/feedback/quartz.js +5 -2
  68. package/dist/cjs/feedback/send.d.ts +4 -1
  69. package/dist/cjs/feedback/send.js +56 -15
  70. package/dist/cjs/feedback/styles.js +2 -2
  71. package/dist/cjs/feedback/template.d.ts +4 -2
  72. package/dist/cjs/feedback/template.js +67 -46
  73. package/dist/cjs/feedback/ui.d.ts +40 -4
  74. package/dist/cjs/feedback/ui.js +208 -89
  75. package/dist/cjs/heatmap/send.js +1 -1
  76. package/dist/cjs/heatmap/track.js +13 -9
  77. package/dist/cjs/index.js +2 -2
  78. package/dist/cjs/lifecycle.js +119 -72
  79. package/dist/cjs/pushnotification/display.d.ts +65 -0
  80. package/dist/cjs/pushnotification/display.js +112 -0
  81. package/dist/cjs/pushnotification/index.d.ts +20 -0
  82. package/dist/cjs/pushnotification/index.js +96 -0
  83. package/dist/cjs/pushnotification/kept-opens.d.ts +23 -0
  84. package/dist/cjs/pushnotification/kept-opens.js +64 -0
  85. package/dist/cjs/pushnotification/notify.d.ts +45 -0
  86. package/dist/cjs/pushnotification/notify.js +476 -0
  87. package/dist/cjs/pushnotification/payload.d.ts +65 -0
  88. package/dist/cjs/pushnotification/payload.js +279 -0
  89. package/dist/cjs/pushnotification/session.d.ts +46 -0
  90. package/dist/cjs/pushnotification/session.js +413 -0
  91. package/dist/cjs/pushnotification/stats.d.ts +45 -0
  92. package/dist/cjs/pushnotification/stats.js +244 -0
  93. package/dist/cjs/pushnotification/wms.d.ts +30 -0
  94. package/dist/cjs/pushnotification/wms.js +374 -0
  95. package/dist/cjs/remoteconfig/country.js +1 -1
  96. package/dist/cjs/remoteconfig/custom.js +4 -3
  97. package/dist/cjs/remoteconfig/evaluate.js +1 -1
  98. package/dist/cjs/remoteconfig/fetch.js +27 -8
  99. package/dist/cjs/remoteconfig/index.d.ts +1 -6
  100. package/dist/cjs/remoteconfig/index.js +4 -28
  101. package/dist/cjs/remoteconfig/store.js +1 -1
  102. package/dist/cjs/remoteconfig/tz-countries.js +1 -1
  103. package/dist/cjs/remotelog/callsite.js +1 -1
  104. package/dist/cjs/remotelog/gate.js +1 -1
  105. package/dist/cjs/remotelog/logger.js +1 -1
  106. package/dist/cjs/remotelog/send.js +5 -4
  107. package/dist/cjs/remotelogger/index.js +1 -1
  108. package/dist/cjs/scheduler.js +11 -5
  109. package/dist/cjs/sw/apptics-pn-sw.d.ts +83 -0
  110. package/dist/cjs/sw/timers.d.ts +44 -0
  111. package/dist/cjs/types.d.ts +31 -15
  112. package/dist/cjs/user/index.d.ts +7 -0
  113. package/dist/cjs/user/index.js +25 -7
  114. package/dist/esm/core/attempts.js +1 -1
  115. package/dist/esm/core/batch.js +4 -3
  116. package/dist/esm/core/consent.d.ts +9 -6
  117. package/dist/esm/core/consent.js +67 -16
  118. package/dist/esm/core/console-call.d.ts +23 -0
  119. package/dist/esm/core/console-call.js +60 -0
  120. package/dist/esm/core/constants.d.ts +44 -0
  121. package/dist/esm/core/constants.js +52 -2
  122. package/dist/esm/core/db.js +31 -7
  123. package/dist/esm/core/debug.d.ts +6 -4
  124. package/dist/esm/core/debug.js +37 -13
  125. package/dist/esm/core/env.js +1 -1
  126. package/dist/esm/core/framework-id.d.ts +1 -1
  127. package/dist/esm/core/framework-id.js +3 -3
  128. package/dist/esm/core/guard.js +19 -4
  129. package/dist/esm/core/hooks.d.ts +25 -1
  130. package/dist/esm/core/hooks.js +11 -1
  131. package/dist/esm/core/locks.js +1 -1
  132. package/dist/esm/core/logger.js +1 -1
  133. package/dist/esm/core/shield.d.ts +31 -0
  134. package/dist/esm/core/shield.js +119 -0
  135. package/dist/esm/core/state.d.ts +5 -1
  136. package/dist/esm/core/state.js +3 -1
  137. package/dist/esm/core/storage.d.ts +7 -0
  138. package/dist/esm/core/storage.js +28 -8
  139. package/dist/esm/core/stylesheet.js +1 -1
  140. package/dist/esm/core/transport.d.ts +15 -4
  141. package/dist/esm/core/transport.js +64 -16
  142. package/dist/esm/core/utils.js +1 -1
  143. package/dist/esm/core/validate.js +6 -5
  144. package/dist/esm/device/appversion.js +1 -1
  145. package/dist/esm/device/index.js +67 -19
  146. package/dist/esm/engagement/api-rules.js +1 -1
  147. package/dist/esm/engagement/auto-api.js +4 -3
  148. package/dist/esm/engagement/auto-screen.js +10 -6
  149. package/dist/esm/engagement/defined-events.d.ts +2 -3
  150. package/dist/esm/engagement/defined-events.js +10 -16
  151. package/dist/esm/engagement/send.js +1 -1
  152. package/dist/esm/engagement/session.js +77 -37
  153. package/dist/esm/engagement/track.js +9 -6
  154. package/dist/esm/errors/send.js +1 -1
  155. package/dist/esm/errors/track.js +3 -2
  156. package/dist/esm/feedback/controls.d.ts +30 -4
  157. package/dist/esm/feedback/controls.js +234 -52
  158. package/dist/esm/feedback/i18n/index.d.ts +31 -0
  159. package/dist/esm/feedback/i18n/index.js +178 -0
  160. package/dist/esm/feedback/i18n/strings.d.ts +9 -0
  161. package/dist/esm/feedback/i18n/strings.js +4 -0
  162. package/dist/esm/feedback/index.js +1 -1
  163. package/dist/esm/feedback/logs.js +5 -4
  164. package/dist/esm/feedback/quartz.js +5 -2
  165. package/dist/esm/feedback/send.d.ts +4 -1
  166. package/dist/esm/feedback/send.js +56 -16
  167. package/dist/esm/feedback/styles.js +2 -2
  168. package/dist/esm/feedback/template.d.ts +4 -2
  169. package/dist/esm/feedback/template.js +67 -46
  170. package/dist/esm/feedback/ui.d.ts +40 -4
  171. package/dist/esm/feedback/ui.js +210 -91
  172. package/dist/esm/heatmap/send.js +1 -1
  173. package/dist/esm/heatmap/track.js +13 -9
  174. package/dist/esm/index.js +2 -2
  175. package/dist/esm/lifecycle.js +120 -73
  176. package/dist/esm/pushnotification/display.d.ts +65 -0
  177. package/dist/esm/pushnotification/display.js +95 -0
  178. package/dist/esm/pushnotification/index.d.ts +20 -0
  179. package/dist/esm/pushnotification/index.js +91 -0
  180. package/dist/esm/pushnotification/kept-opens.d.ts +23 -0
  181. package/dist/esm/pushnotification/kept-opens.js +62 -0
  182. package/dist/esm/pushnotification/notify.d.ts +45 -0
  183. package/dist/esm/pushnotification/notify.js +469 -0
  184. package/dist/esm/pushnotification/payload.d.ts +65 -0
  185. package/dist/esm/pushnotification/payload.js +272 -0
  186. package/dist/esm/pushnotification/session.d.ts +46 -0
  187. package/dist/esm/pushnotification/session.js +402 -0
  188. package/dist/esm/pushnotification/stats.d.ts +45 -0
  189. package/dist/esm/pushnotification/stats.js +238 -0
  190. package/dist/esm/pushnotification/wms.d.ts +30 -0
  191. package/dist/esm/pushnotification/wms.js +368 -0
  192. package/dist/esm/remoteconfig/country.js +1 -1
  193. package/dist/esm/remoteconfig/custom.js +4 -3
  194. package/dist/esm/remoteconfig/evaluate.js +1 -1
  195. package/dist/esm/remoteconfig/fetch.js +27 -8
  196. package/dist/esm/remoteconfig/index.d.ts +1 -6
  197. package/dist/esm/remoteconfig/index.js +4 -28
  198. package/dist/esm/remoteconfig/store.js +1 -1
  199. package/dist/esm/remoteconfig/tz-countries.js +1 -1
  200. package/dist/esm/remotelog/callsite.js +1 -1
  201. package/dist/esm/remotelog/gate.js +1 -1
  202. package/dist/esm/remotelog/logger.js +1 -1
  203. package/dist/esm/remotelog/send.js +5 -4
  204. package/dist/esm/remotelogger/index.js +1 -1
  205. package/dist/esm/scheduler.js +11 -5
  206. package/dist/esm/sw/apptics-pn-sw.d.ts +83 -0
  207. package/dist/esm/sw/timers.d.ts +44 -0
  208. package/dist/esm/types.d.ts +31 -15
  209. package/dist/esm/user/index.d.ts +7 -0
  210. package/dist/esm/user/index.js +26 -9
  211. package/dist/feedback.esm.min.js +2 -2
  212. package/dist/feedback.esm.min.js.map +1 -1
  213. package/dist/pushnotification.esm.min.js +3 -0
  214. package/dist/pushnotification.esm.min.js.map +1 -0
  215. package/dist/remoteconfig.esm.min.js +2 -2
  216. package/dist/remoteconfig.esm.min.js.map +1 -1
  217. package/dist/remotelogger.esm.min.js +2 -2
  218. package/dist/remotelogger.esm.min.js.map +1 -1
  219. package/package.json +15 -2
  220. package/dist/chunks/lifecycle-C6m1W7jo.min.js +0 -3
  221. package/dist/chunks/lifecycle-C6m1W7jo.min.js.map +0 -1
  222. package/dist/chunks/send-CgUO82ne.min.js +0 -3
  223. package/dist/chunks/send-CgUO82ne.min.js.map +0 -1
@@ -10,6 +10,14 @@ export type RequestBody = XMLHttpRequestBodyInit | null;
10
10
  export declare const REQUEST_TIMEOUT_MS = 30000;
11
11
  export declare function makeRequest(url: string, method: string, payload: RequestBody, headers?: RequestHeaders): Promise<string>;
12
12
  export declare function getHeaderParams(key: string): string;
13
+ /**
14
+ * Whether a call names the browser by its anonymousid rather than its deviceid: every call an
15
+ * anonymous browser makes, except the two that tie a person to the device. user/register registers
16
+ * the user against the deviceid, and feedback the reporter picked themselves on goes with their
17
+ * userid, so with the deviceid too. Feedback sent as Anonymous goes by the anonymousid.
18
+ * getsdkconfig names no device at all.
19
+ */
20
+ export declare function sendsByAnonymousId(path: ApiPath): boolean;
13
21
  export declare function getParameters(path: ApiPath): string;
14
22
  /**
15
23
  * `extra` appends params the path needs per call rather than per state, which console/addlog does
@@ -76,10 +84,13 @@ export declare function rejectIfOffline(label: string): Promise<never> | null;
76
84
  /** Device ids sent alongside every payload. */
77
85
  export declare function getMetaObj(): Dict;
78
86
  /**
79
- * Calls made after registration need apid/mapid. Without them this asks device.ts to
80
- * refresh device info (which registers) and returns a labelled rejection; otherwise null. Shared by sender, user
81
- * and feedback (P11).
87
+ * Calls made after registration need apid/mapid, and the id `path` goes out by: the deviceid, or
88
+ * while tracking is anonymous the anonymousid for the calls sendsByAnonymousId names. Without them
89
+ * this asks device.ts to refresh device info (which registers) and returns a labelled rejection;
90
+ * otherwise null. Shared by sender, user and feedback (P11).
82
91
  */
83
- export declare function rejectIfNoDeviceIds(label: string): Promise<never> | null;
92
+ export declare function rejectIfNoDeviceIds(label: string, path: ApiPath): Promise<never> | null;
84
93
  /** Whether device/add has given this browser its deviceid. */
85
94
  export declare function hasDeviceId(): boolean;
95
+ /** The ids data goes out by: the deviceid, and the anonymousid too while tracking is anonymous. */
96
+ export declare function hasSendIds(): boolean;
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var constants = require('./constants.js');
@@ -128,6 +128,19 @@ function deviceNameParam(path, existing) {
128
128
  var param = 'devicename=' + encodeURIComponent(name.slice(0, constants.DEVICE_NAME_MAX)); // no i18n
129
129
  return (existing === '' ? '?' : '&') + param; // no i18n
130
130
  }
131
+ /**
132
+ * Whether a call names the browser by its anonymousid rather than its deviceid: every call an
133
+ * anonymous browser makes, except the two that tie a person to the device. user/register registers
134
+ * the user against the deviceid, and feedback the reporter picked themselves on goes with their
135
+ * userid, so with the deviceid too. Feedback sent as Anonymous goes by the anonymousid.
136
+ * getsdkconfig names no device at all.
137
+ */
138
+ function sendsByAnonymousId(path) {
139
+ if (!consent.isAnonymous() || path === 'reguser' || path === 'sdkconfig') { // no i18n
140
+ return false;
141
+ }
142
+ return !(path === 'feedback' && hooks.hooks.feedbackUser()); // no i18n
143
+ }
131
144
  function getParameters(path) {
132
145
  let returnVal = ''; // no i18n
133
146
  // app/addversion runs before any id exists: it identifies the build, not the device
@@ -141,24 +154,32 @@ function getParameters(path) {
141
154
  // v2 device/add declares neither identifier, platform nor appversion: the build is already
142
155
  // known from app/addversion, and sending an undeclared param is refused as EXTRA_PARAM_FOUND.
143
156
  // What it does declare as mandatory is appversionid, which v1 treated as optional.
144
- // isanonrequired is always false: the web SDK has no anonymous mode, only the tracking
145
- // statuses (with PII, without PII, none), which devicestatus carries.
157
+ // isanonrequired asks for the anonymousid that an anonymous browser's data goes out by.
158
+ // devicestatus is the server's device preference for the stored status, read from storage:
159
+ // _devicestatus is only set when the status changes, so after a reload it is the default
146
160
  if (path == 'regdevice') { // no i18n
147
- returnVal = '?isanonrequired=false&devicestatus=' + state._ZAP._devicestatus; // no i18n
161
+ returnVal = '?isanonrequired=' + consent.isAnonymous() + '&devicestatus=' + consent.deviceStatusFor(storage.tracking_preference.opt_in_status()); // no i18n
148
162
  if (!utils.isEmpty(state._ZAP._device_info.deviceid)) {
149
163
  returnVal += '&deviceid=' + encodeURIComponent(String(state._ZAP._device_info.deviceid)); // no i18n
150
164
  }
165
+ // and the anonymous record it already has, so that one is amended rather than another made
166
+ if (consent.isAnonymous() && !utils.isEmpty(state._ZAP._device_info.anonymousid)) {
167
+ returnVal += '&anondeviceid=' + encodeURIComponent(String(state._ZAP._device_info.anonymousid)); // no i18n
168
+ }
151
169
  return returnVal + mandatoryParams(returnVal);
152
170
  }
153
171
  // getsdkconfig carries no deviceid: the user's ids below are what it answers for
154
172
  if (path != 'sdkconfig') { // no i18n
155
- if (utils.isEmpty(state._ZAP._device_info.deviceid)) {
173
+ // device/add answers with the anonymousid; the data urls declare it as anondeviceid
174
+ var anonymous = sendsByAnonymousId(path);
175
+ var key = anonymous ? 'anonymousid' : 'deviceid'; // no i18n
176
+ if (utils.isEmpty(state._ZAP._device_info[key])) {
156
177
  hooks.hooks.refreshDeviceInfo();
157
178
  // the device is missing, but appversionid and frameworkid are mandatory regardless:
158
179
  // dropping them turns one missing id into a refusal that names the wrong param
159
180
  return returnVal + mandatoryParams(returnVal);
160
181
  }
161
- returnVal = '?deviceid=' + encodeURIComponent(String(state._ZAP._device_info.deviceid)); // no i18n
182
+ returnVal = (anonymous ? '?anondeviceid=' : '?deviceid=') + encodeURIComponent(String(state._ZAP._device_info[key])); // no i18n
162
183
  }
163
184
  // feedback is attributed to whoever the form's user picker selected, not to the active user:
164
185
  // the person reporting may not be the one the app last registered, and may choose Anonymous
@@ -172,10 +193,12 @@ function getParameters(path) {
172
193
  }
173
194
  return returnVal + mandatoryParams(returnVal);
174
195
  }
175
- // add userid and groupid if opt_in_status is USAGE_TRACKING_WITH_PII. getupdates doesn't declare
196
+ // add userid and groupid if opt_in_status is USAGE_TRACKING_WITH_PII: never while anonymous,
197
+ // and not without PII either, with a user registered. getupdates doesn't declare
176
198
  // them, and refuses userid as EXTRA_PARAM_FOUND; it has no use for them either, since remote
177
199
  // config conditions on the user are evaluated here, against the rule set it answers with
178
- var carriesUser = path != 'reguser' && path != 'getupdates'; // no i18n
200
+ // pushnotification/device declares no user either: it registers the browser, not a person
201
+ var carriesUser = path != 'reguser' && path != 'getupdates' && path != 'pushnotification' && path != 'pnstats'; // no i18n
179
202
  if (carriesUser && consent.opt_in_status() == constants.AP_TRACKING_STATUS.USAGE_TRACKING_WITH_PII) {
180
203
  if (state._ZAP._user_info.hasOwnProperty('userid') && !utils.isEmpty(state._ZAP._user_info.userid)) { // no i18n
181
204
  // getsdkconfig has no deviceid before it, so its userid starts the query
@@ -186,6 +209,13 @@ function getParameters(path) {
186
209
  }
187
210
  }
188
211
  returnVal += deviceNameParam(path, returnVal);
212
+ // the modules getsdkconfig is asked about; it declares moduleids as at most 2, comma-split
213
+ if (path == 'sdkconfig') { // no i18n
214
+ var modules = hooks.hooks.sdkConfigModuleIds();
215
+ if (modules.length > 0) {
216
+ returnVal += (returnVal === '' ? '?' : '&') + 'moduleids=' + encodeURIComponent(modules.slice(0, 2).join(',')); // no i18n
217
+ }
218
+ }
189
219
  return returnVal + mandatoryParams(returnVal);
190
220
  }
191
221
  /**
@@ -293,7 +323,7 @@ function settle(path, label, response) {
293
323
  * nothing orders one behind another.
294
324
  */
295
325
  function postToApptics(path, payload, headers, label, extra) {
296
- var url = getUrlWithParams(path, Object.assign(attempts.beginAttempt(path), {}));
326
+ var url = getUrlWithParams(path, Object.assign(attempts.beginAttempt(path), extra || {}));
297
327
  return makeRequest(url, state.getConfig('method'), payload, headers).then(function (response) {
298
328
  return settle(path, label, response);
299
329
  }, function (err) {
@@ -412,11 +442,12 @@ function getMetaObj() {
412
442
  };
413
443
  }
414
444
  /**
415
- * Calls made after registration need apid/mapid. Without them this asks device.ts to
416
- * refresh device info (which registers) and returns a labelled rejection; otherwise null. Shared by sender, user
417
- * and feedback (P11).
445
+ * Calls made after registration need apid/mapid, and the id `path` goes out by: the deviceid, or
446
+ * while tracking is anonymous the anonymousid for the calls sendsByAnonymousId names. Without them
447
+ * this asks device.ts to refresh device info (which registers) and returns a labelled rejection;
448
+ * otherwise null. Shared by sender, user and feedback (P11).
418
449
  */
419
- function rejectIfNoDeviceIds(label) {
450
+ function rejectIfNoDeviceIds(label, path) {
420
451
  if (utils.isEmpty(getHeaderParams('apid')) && utils.isEmpty(getHeaderParams('mapid'))) { // no i18n
421
452
  hooks.hooks.refreshDeviceInfo();
422
453
  return Promise.reject(label + ': You must call Apptics.init() first'); // no i18n
@@ -428,12 +459,29 @@ function rejectIfNoDeviceIds(label) {
428
459
  hooks.hooks.refreshDeviceInfo();
429
460
  return Promise.reject(label + ': the device is not registered yet, kept for the next send'); // no i18n
430
461
  }
462
+ // anonymous, and device/add has not answered with the anonymousid yet: the call waits for it
463
+ // rather than go out by the deviceid it is meant to leave out
464
+ if (sendsByAnonymousId(path) && !hasAnonymousId()) {
465
+ hooks.hooks.refreshDeviceInfo();
466
+ return Promise.reject(label + ': the anonymous id has not arrived yet, kept for the next send'); // no i18n
467
+ }
431
468
  return null;
432
469
  }
470
+ /** Whether device/add has given this browser its anonymousid. */
471
+ function hasAnonymousId() {
472
+ return !utils.isEmpty(state._ZAP._device_info && state._ZAP._device_info.anonymousid) || !utils.isEmpty(storage.getKeyFromDeviceInfo('anonymousid')); // no i18n
473
+ }
433
474
  /** Whether device/add has given this browser its deviceid. */
434
475
  function hasDeviceId() {
435
476
  return !utils.isEmpty(state._ZAP._device_info && state._ZAP._device_info.deviceid) || !utils.isEmpty(storage.getKeyFromDeviceInfo('deviceid')); // no i18n
436
477
  }
478
+ /** The ids data goes out by: the deviceid, and the anonymousid too while tracking is anonymous. */
479
+ function hasSendIds() {
480
+ if (!hasDeviceId()) {
481
+ return false;
482
+ }
483
+ return !consent.isAnonymous() || hasAnonymousId();
484
+ }
437
485
 
438
486
  exports.KEEPALIVE_BUDGET = KEEPALIVE_BUDGET;
439
487
  exports.REQUEST_TIMEOUT_MS = REQUEST_TIMEOUT_MS;
@@ -443,6 +491,7 @@ exports.getMetaObj = getMetaObj;
443
491
  exports.getParameters = getParameters;
444
492
  exports.getUrlWithParams = getUrlWithParams;
445
493
  exports.hasDeviceId = hasDeviceId;
494
+ exports.hasSendIds = hasSendIds;
446
495
  exports.isPermanentRefusal = isPermanentRefusal;
447
496
  exports.makeRequest = makeRequest;
448
497
  exports.postKeepalive = postKeepalive;
@@ -450,4 +499,5 @@ exports.postToApptics = postToApptics;
450
499
  exports.rejectIfDisabled = rejectIfDisabled;
451
500
  exports.rejectIfNoDeviceIds = rejectIfNoDeviceIds;
452
501
  exports.rejectIfOffline = rejectIfOffline;
502
+ exports.sendsByAnonymousId = sendsByAnonymousId;
453
503
  exports.usesDebugApi = usesDebugApi;
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var constants = require('./constants.js');
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var logger = require('./logger.js');
@@ -31,16 +31,17 @@ const MAX_PROPERTIES_LENGTH = 7666;
31
31
  /** At most this many characters in one value. */
32
32
  const MAX_VALUE_LENGTH = 250;
33
33
  /**
34
- * A value as the payload carries it, with its type. Numbers are Number and booleans Boolean, sent
35
- * as 1 and 0 — the form the server has always received a Boolean in. Anything else (an object, an
36
- * array, null) is turned into text, as on Android, rather than dropped.
34
+ * A value as the payload carries it, with its type. Only true and false are Boolean, and they go
35
+ * as true and false; every number is Number and goes as the number, 1 and 0 included, so the two
36
+ * can't be mistaken for each other. Anything else (an object, an array, null) is turned into text,
37
+ * as on Android, rather than dropped.
37
38
  */
38
39
  function typedValue(value) {
39
40
  if (typeof value === 'number' && isFinite(value)) { // no i18n
40
41
  return { value: value, type: 'Number' }; // no i18n
41
42
  }
42
43
  if (typeof value === 'boolean') { // no i18n
43
- return { value: value ? 1 : 0, type: 'Boolean' }; // no i18n
44
+ return { value: value, type: 'Boolean' }; // no i18n
44
45
  }
45
46
  if (typeof value === 'string') { // no i18n
46
47
  return { value: value, type: 'String' }; // no i18n
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var state = require('../core/state.js');
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var constants = require('../core/constants.js');
@@ -11,6 +11,7 @@ var env = require('../core/env.js');
11
11
  var consent = require('../core/consent.js');
12
12
  var transport = require('../core/transport.js');
13
13
  var hooks = require('../core/hooks.js');
14
+ var shield = require('../core/shield.js');
14
15
  var appversion = require('./appversion.js');
15
16
 
16
17
  /** Server-assigned ids, never sent back in device payloads. */
@@ -109,12 +110,13 @@ function checkAndUpdateDeviceInfo() {
109
110
  addOrUpdateDeviceID(state._ZAP._device_info, previous);
110
111
  }
111
112
  /**
112
- * Whether device/add has registered this device: it has a deviceid. anonymousid is not required:
113
- * not every Apptics server sends one, nothing the SDK sends carries it, and requiring it had a
114
- * server that leaves it out register the same device again on every page load.
113
+ * Whether device/add has registered this device: it has a deviceid, and while tracking is
114
+ * anonymous the anonymousid its data goes out by. Outside anonymous tracking the anonymousid is
115
+ * not required: nothing else sends it, and requiring it had a server that leaves it out register
116
+ * the same device again on every page load.
115
117
  */
116
118
  function isRegistered(info) {
117
- return !!info && !utils.isEmpty(info.deviceid);
119
+ return !!info && !utils.isEmpty(info.deviceid) && (!consent.isAnonymous() || !utils.isEmpty(info.anonymousid));
118
120
  }
119
121
  function addOrUpdateDeviceID(device_info, previous) {
120
122
  var old_device_info = previous !== undefined ? previous : storage.user_defaults.item('device_info') || {}; // no i18n
@@ -156,6 +158,20 @@ function addOrUpdateDeviceID(device_info, previous) {
156
158
  * out as an empty header.
157
159
  */
158
160
  const DEVICE_RESPONSE_KEYS = ['deviceid', 'anonymousid', 'aaid', 'apid', 'mapid', 'appversionid', 'osversionid', 'timezoneid', 'platformid', 'devicetypeid', 'modelid']; // no i18n
161
+ /** Whether this page has said the server left the anonymousid out; said once, not per call. */
162
+ var missingAnonymousIdSaid = false;
163
+ /**
164
+ * An anonymous browser's data waits for the anonymousid, so an answer to its device/add without
165
+ * one is said out loud, debug or not: otherwise the data sits in storage with no sign of why, and
166
+ * expires after batch_request_timeout.
167
+ */
168
+ function noteMissingAnonymousId(data) {
169
+ if (missingAnonymousIdSaid || !consent.isAnonymous() || !utils.isEmpty(data.anonymousid) || !utils.isEmpty(state._ZAP._device_info.anonymousid)) {
170
+ return;
171
+ }
172
+ missingAnonymousIdSaid = true;
173
+ logger.warnAlways('apptics: device/add answered with no anonymousid for anonymous tracking, so anonymous data is kept, and anonymous feedback not sent, until it does'); // no i18n
174
+ }
159
175
  /** Copies server-assigned ids into state and persists device info; resolves once it is stored. */
160
176
  function applyDeviceResponse(data) {
161
177
  DEVICE_RESPONSE_KEYS.forEach(function (key) {
@@ -173,7 +189,10 @@ function applyDeviceResponse(data) {
173
189
  state._ZAP._mapid = data.mapid;
174
190
  }
175
191
  // stored before the registration counts as done, so another tab waiting to register reads it
176
- return storage.user_defaults.save('device_info', state._ZAP._device_info); // no i18n
192
+ return storage.user_defaults.save('device_info', state._ZAP._device_info).then(function () {
193
+ // push registers by these ids, and may have been waiting for the anonymousid
194
+ hooks.hooks.pushDeviceIdsChanged();
195
+ });
177
196
  }
178
197
  /**
179
198
  * The browser's uuid: the one in storage, or a new one stored now. Every tab of the site uses the
@@ -246,7 +265,7 @@ function prepareDevice() {
246
265
  function needsDevice() {
247
266
  // the app ids from app/addversion, and the deviceid from device/add: either missing, and the
248
267
  // device is registered before anything stored is sent
249
- return (utils.isEmpty(transport.getHeaderParams('apid')) && utils.isEmpty(transport.getHeaderParams('mapid'))) || !transport.hasDeviceId(); // no i18n
268
+ return (utils.isEmpty(transport.getHeaderParams('apid')) && utils.isEmpty(transport.getHeaderParams('mapid'))) || !transport.hasSendIds(); // no i18n
250
269
  }
251
270
  /**
252
271
  * Resolves once a registration that is in flight has settled, succeeded or not, and right away
@@ -307,6 +326,7 @@ function registerDeviceWithApptics() {
307
326
  // the time registration runs, so the first call can carry them like every later one.
308
327
  var headers = { zak: transport.getHeaderParams('zak'), uuid: transport.getHeaderParams('uuid'), ...transport.apiHeaders() }; // no i18n
309
328
  return transport.postToApptics('regdevice', payload, headers, label).then(function (result) {
329
+ noteMissingAnonymousId(result.data || {});
310
330
  return applyDeviceResponse(result.data || {}).then(function () {
311
331
  return result;
312
332
  });
@@ -334,14 +354,15 @@ function updateDeviceWithApptics(device_info) {
334
354
  var payload = deviceBody(device_info);
335
355
  var headers = { zak: transport.getHeaderParams('zak'), uuid: transport.getHeaderParams('uuid'), ...transport.apiHeaders() }; // no i18n
336
356
  return transport.postToApptics('regdevice', payload, headers, label).then(function (result) {
337
- applyDeviceResponse(result.data || {});
357
+ noteMissingAnonymousId(result.data || {});
358
+ shield.quietly('device/add', applyDeviceResponse(result.data || {})); // no i18n
338
359
  return result;
339
360
  });
340
361
  }
341
362
  // Function to get updates from the server
342
363
  function getUpdatesFromServer() {
343
364
  var label = 'getUpdatesFromServer'; // no i18n
344
- var blocked = transport.rejectIfOffline(label) || transport.rejectIfNoDeviceIds(label);
365
+ var blocked = transport.rejectIfOffline(label) || transport.rejectIfNoDeviceIds(label, 'sdkconfig');
345
366
  if (blocked) {
346
367
  return blocked;
347
368
  }
@@ -357,7 +378,7 @@ function getUpdatesFromServer() {
357
378
  }
358
379
  // the visitor's tracking status lives in trackinfo too, and is not the server's to replace
359
380
  var saved = storage.storedTrackingStatus();
360
- storage.user_defaults.add('trackinfo', saved === undefined ? state._ZAP._trackinfo : Object.assign({}, state._ZAP._trackinfo, { tracking_status: saved })); // no i18n
381
+ storage.user_defaults.add('trackinfo', saved === undefined ? state._ZAP._trackinfo : Object.assign({}, state._ZAP._trackinfo, { tracking_status: storage.trackingStatusCode(saved) })); // no i18n
361
382
  logger.Console.log('getUpdatesFromServer: ' + JSON.stringify(state._ZAP._trackinfo)); // no i18n
362
383
  return data;
363
384
  });
@@ -436,6 +457,13 @@ function applyServerFlags(data) {
436
457
  state._ZAP._remoteLoggerEnabled = flagOn('remotelogger', 'remoteloggerenabled'); // no i18n
437
458
  state._ZAP._feedbackEnabled = flagOn('feedback', 'feedbackenabled'); // no i18n
438
459
  }
460
+ // push notification: module 16 and the wms block it comes with. Live, the module flag decides;
461
+ // restored, the flag this SDK saved; with neither, the block itself, which the server sends
462
+ // only when push is on. Either way it is off without a usable wms block
463
+ state._ZAP._wmsConfig = wmsConfigFrom(data.wms);
464
+ var pushFlag = hasModules ? moduleEnabled(status, constants.SDK_MODULE.PUSH_NOTIFICATION)
465
+ : (data.hasOwnProperty('push') ? data.push === true : true); // no i18n
466
+ state._ZAP._pushEnabled = pushFlag && state._ZAP._wmsConfig !== null;
439
467
  // screen recording, set up in the console: everything the form needs comes from here
440
468
  var quartz = (data.quartz && typeof data.quartz === 'object' ? data.quartz : {});
441
469
  var text = function (value) {
@@ -466,7 +494,27 @@ function applyServerFlags(data) {
466
494
  quartz_cdn_url: state._ZAP._quartz.cdnUrl,
467
495
  },
468
496
  shouldtrack: state._ZAP._shouldTrack,
469
- next_check_after: state._ZAP._nextConfigCheck
497
+ next_check_after: state._ZAP._nextConfigCheck,
498
+ push: state._ZAP._pushEnabled,
499
+ wms: state._ZAP._wmsConfig,
500
+ };
501
+ // a no-op unless the push entry was imported, which sets the hook
502
+ hooks.hooks.pushConfigChanged();
503
+ }
504
+ /** getsdkconfig's wms block, or null when it has no wms_js_url to load. */
505
+ function wmsConfigFrom(value) {
506
+ if (!value || typeof value !== 'object') { // no i18n
507
+ return null;
508
+ }
509
+ var wms = value;
510
+ if (typeof wms.wms_js_url !== 'string' || wms.wms_js_url.trim() === '') { // no i18n
511
+ return null;
512
+ }
513
+ var sriValues = wms.wms_sri_values && typeof wms.wms_sri_values === 'object' ? wms.wms_sri_values : null; // no i18n
514
+ return {
515
+ wms_js_url: wms.wms_js_url.trim(),
516
+ wms_sri: typeof wms.wms_sri === 'string' ? wms.wms_sri : '', // no i18n
517
+ wms_sri_values: sriValues,
470
518
  };
471
519
  }
472
520
  /**
@@ -529,7 +577,7 @@ function refreshServerSettings() {
529
577
  markTabAsked();
530
578
  var round = configRound;
531
579
  var askedAt = utils.nowMs();
532
- getUpdatesFromServer().catch(function (err) {
580
+ shield.quietly('getsdkconfig', getUpdatesFromServer().catch(function (err) {
533
581
  logger.Console.log(err);
534
582
  }).then(function () {
535
583
  if (round !== configRound) {
@@ -545,7 +593,7 @@ function refreshServerSettings() {
545
593
  // an answer without a usable next_check_after, or a failed call, waits getupdates_interval
546
594
  configDueAt = state._ZAP._nextConfigCheck > utils.nowMs() ? state._ZAP._nextConfigCheck : askedAt + state.getConfig('getupdates_interval'); // no i18n
547
595
  scheduleServerSettingCheck();
548
- });
596
+ }));
549
597
  }
550
598
  /**
551
599
  * getsdkconfig now, not at the next check: setUser registered a user, or getupdates reported a
@@ -604,10 +652,10 @@ function scheduleServerSettingCheck() {
604
652
  }
605
653
  var wait = Math.min(Math.max(configDueAt - utils.nowMs(), 0), MAX_TIMEOUT);
606
654
  logger.Console.log('getsdkconfig: next check in ' + wait + ' ms'); // no i18n
607
- configTimer = setTimeout(function () {
655
+ configTimer = setTimeout(shield.shield('getsdkconfig', function () {
608
656
  configTimer = null;
609
657
  refreshServerSettings();
610
- }, wait);
658
+ }), wait);
611
659
  }
612
660
  /** reset(): no more checks, and the next init() asks again straight away. */
613
661
  function stopServerSettingChecks() {
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var logger = require('../core/logger.js');
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var state = require('../core/state.js');
@@ -6,6 +6,7 @@ var logger = require('../core/logger.js');
6
6
  var utils = require('../core/utils.js');
7
7
  var track = require('./track.js');
8
8
  var apiRules = require('./api-rules.js');
9
+ var shield = require('../core/shield.js');
9
10
 
10
11
  /**
11
12
  * Automatic API tracking: wraps XMLHttpRequest and fetch so calls the app makes are recorded
@@ -131,10 +132,10 @@ function installXhr() {
131
132
  tracked.starttime = utils.nowMs();
132
133
  // loadend fires for success, error, abort and timeout alike, so one listener covers
133
134
  // every ending; status 0 is how a network failure arrives here
134
- this.addEventListener('loadend', function () {
135
+ this.addEventListener('loadend', shield.shield('automatic api tracking', function () {
135
136
  var message = this.status === 0 ? 'Network Error' : (this.statusText || '-'); // no i18n
136
137
  record(tracked.method, tracked.url, tracked.starttime, this.status, message);
137
- });
138
+ }));
138
139
  }
139
140
  return originalSend.apply(this, arguments);
140
141
  };
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var logger = require('../core/logger.js');
@@ -6,6 +6,7 @@ var hooks = require('../core/hooks.js');
6
6
  var state = require('../core/state.js');
7
7
  var utils = require('../core/utils.js');
8
8
  var track = require('./track.js');
9
+ var shield = require('../core/shield.js');
9
10
 
10
11
  /**
11
12
  * Automatic screen tracking: a screen view for the page the SDK starts on, and one for every
@@ -165,7 +166,7 @@ function check() {
165
166
  state._ZAP._current_screen = Object.assign({}, state._ZAP._current_screen, { screen: name });
166
167
  pendingName = name;
167
168
  pendingAt = utils.nowMs();
168
- settleTimer = setTimeout(settle, settleMs);
169
+ settleTimer = setTimeout(shield.shield('automatic screen tracking', settle), settleMs); // no i18n
169
170
  }
170
171
  function settle() {
171
172
  settleTimer = null;
@@ -200,7 +201,10 @@ function cancelPending() {
200
201
  * that followed found the url already seen and recorded nothing: the page went untracked and the
201
202
  * view before it was never ended.
202
203
  */
203
- function navigated() {
204
+ const checkShielded = shield.shield('automatic screen tracking', check); // no i18n
205
+ // shielded: it runs inside the app's own history.pushState and replaceState calls, and a throw
206
+ // here would reach the app's code
207
+ const navigated = shield.shield('automatic screen tracking', function () {
204
208
  var name = currentName();
205
209
  if (name !== '' && (name === pendingName || (pendingName === '' && name === lastName))) { // no i18n
206
210
  return;
@@ -208,9 +212,9 @@ function navigated() {
208
212
  if (timer === null) {
209
213
  claimed = false;
210
214
  cancelPending();
211
- timer = setTimeout(check, 0);
215
+ timer = setTimeout(checkShielded, 0);
212
216
  }
213
- }
217
+ });
214
218
  /** The app recorded a screen itself; the automatic view of this navigation gives way to it. */
215
219
  function screenTrackedByApp() {
216
220
  claimed = true;
@@ -272,7 +276,7 @@ function enableScreenTracking(enabled, wait) {
272
276
  // the page the SDK starts on. Not through navigated(): a inScreen() the app made during
273
277
  // start-up was replayed just before this, and it is this screen's, so its claim stands
274
278
  if (timer === null) {
275
- timer = setTimeout(check, 0);
279
+ timer = setTimeout(checkShielded, 0);
276
280
  }
277
281
  return;
278
282
  }
@@ -1,13 +1,12 @@
1
1
  /**
2
- * Apptics' defined events, as Android's DefinedEvents: ready-made names in reserved `AP_` groups,
2
+ * Apptics' defined events for the browser: ready-made names in reserved `AP_` groups,
3
3
  * logged with trackEvent like any other event and never tracked automatically.
4
4
  *
5
5
  * trackEvent(DefinedEvents.AP_USER_LOGIN);
6
6
  * trackEvent(DefinedEvents.AP_SEARCH, { query_length: 12 });
7
7
  *
8
8
  * They are the only events allowed the `ap_` prefix: an app's own event, group or property may
9
- * not start with it. The list is Android's, so the console reads them the same from every platform;
10
- * some (battery, OS update, uninstall) have no meaning in a browser and are simply never sent.
9
+ * not start with it.
11
10
  */
12
11
  /** One defined event: the name and the group it is sent under. */
13
12
  export interface DefinedEvent {
@@ -1,35 +1,29 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  /**
5
- * Apptics' defined events, as Android's DefinedEvents: ready-made names in reserved `AP_` groups,
5
+ * Apptics' defined events for the browser: ready-made names in reserved `AP_` groups,
6
6
  * logged with trackEvent like any other event and never tracked automatically.
7
7
  *
8
8
  * trackEvent(DefinedEvents.AP_USER_LOGIN);
9
9
  * trackEvent(DefinedEvents.AP_SEARCH, { query_length: 12 });
10
10
  *
11
11
  * They are the only events allowed the `ap_` prefix: an app's own event, group or property may
12
- * not start with it. The list is Android's, so the console reads them the same from every platform;
13
- * some (battery, OS update, uninstall) have no meaning in a browser and are simply never sent.
12
+ * not start with it.
14
13
  */
15
14
  const GROUPS = {
16
- AP_APP_LIFE_CYCLE: [
17
- 'AP_APP_INSTALL', 'AP_APP_UNINSTALL', 'AP_APP_UPDATE', 'AP_APP_CRACKED', 'AP_APP_OPEN', 'AP_APP_CLEAR_DATA', // no i18n
18
- 'AP_APP_FOREGROUND', 'AP_APP_BACKGROUND', 'AP_APP_OUT_OF_MEMORY', 'AP_APP_FIRST_OPEN', 'AP_APP_LAUNCHING', // no i18n
19
- 'AP_APP_RESIGN_ACTIVE', 'AP_APP_WILL_CONNECT', // no i18n
20
- ],
21
15
  AP_USER_LIFE_CYCLE: ['AP_USER_SIGNUP', 'AP_USER_LOGIN', 'AP_USER_LOGOUT'], // no i18n
16
+ AP_PAGE_LIFE_CYCLE: ['AP_PAGE_LOAD', 'AP_PAGE_VISIBLE', 'AP_PAGE_HIDDEN', 'AP_PAGE_UNLOAD', 'AP_PAGE_PRINT'], // no i18n
22
17
  AP_APPLICATION: [
23
- 'AP_DEEP_LINK_OPEN', 'AP_DEEP_LINK_UPDATE', 'AP_DEEP_LINK_FIRST_OPEN', 'AP_IN_APP_PURCHASE', // no i18n
24
- 'AP_NOTIFICATION_RECEIVE', 'AP_NOTIFICATION_OPEN', 'AP_NOTIFICATION_DISMISS', 'AP_NOTIFICATION_FOREGROUND', // no i18n
25
- 'AP_SEARCH', 'AP_BATTERY_LOW', 'AP_BATTERY_FULL', 'AP_LOW_POWER_MODE_ON', 'AP_LOW_POWER_MODE_OFF', // no i18n
18
+ 'AP_PWA_INSTALL', 'AP_PWA_LAUNCH', 'AP_PURCHASE', 'AP_SEARCH', 'AP_SHARE', 'AP_FILE_DOWNLOAD', 'AP_COPY', // no i18n
19
+ 'AP_NOTIFICATION_RECEIVE', 'AP_NOTIFICATION_OPEN', 'AP_NOTIFICATION_DISMISS', // no i18n
20
+ 'AP_NOTIFICATION_PERMISSION_GRANTED', 'AP_NOTIFICATION_PERMISSION_DENIED', // no i18n
26
21
  ],
27
22
  AP_OTHERS: [
28
- 'AP_NETWORK_REACHABILITY_CHANGE', 'AP_NETWORK_BANDWIDTH_CHANGE', 'AP_SWITCH_THEME_LIGHT', // no i18n
29
- 'AP_SWITCH_THEME_DARK', 'AP_SWITCH_THEME_CUSTOM', 'AP_SWITCH_ORIENTATION_LANDSCAPE', // no i18n
30
- 'AP_SWITCH_ORIENTATION_PORTRAIT', // no i18n
23
+ 'AP_NETWORK_ONLINE', 'AP_NETWORK_OFFLINE', 'AP_SWITCH_THEME_LIGHT', 'AP_SWITCH_THEME_DARK', // no i18n
24
+ 'AP_SWITCH_THEME_CUSTOM', 'AP_SWITCH_LANGUAGE', 'AP_FULLSCREEN_ENTER', 'AP_FULLSCREEN_EXIT', // no i18n
31
25
  ],
32
- AP_OS: ['AP_OS_UPDATE', 'AP_OS_UNSUPPORTED'], // no i18n
26
+ AP_BROWSER: ['AP_BROWSER_UPDATE', 'AP_BROWSER_UNSUPPORTED'], // no i18n
33
27
  };
34
28
  function build() {
35
29
  var out = {};
@@ -1,4 +1,4 @@
1
- /*! @zoho_apptics/apptics-js-sdk v2.0.0-beta.2 | (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
  'use strict';
3
3
 
4
4
  var constants = require('../core/constants.js');