@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
@@ -1,15 +1,17 @@
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
  import { AP_TRACKING_STATUS } from '../core/constants.js';
3
3
  import { _ZAP } from '../core/state.js';
4
4
  import { Console, warnAlways } from '../core/logger.js';
5
5
  import { isEmpty, isEmptyObj } from '../core/utils.js';
6
6
  import { opt_in_status } from '../core/consent.js';
7
7
  import { timerHtml, feedbackUIHtml } from './template.js';
8
- import { sendFeedbackData } from './send.js';
9
- import { chooseUserForSend, userChoice, wireTimerDrag, wireDrag, wireUserPicker, wireLogControls, logChoice } from './controls.js';
8
+ import { sendFeedbackData, MAX_ATTACHMENTS, MAX_ATTACHMENT_SIZE_TEXT } from './send.js';
9
+ import { chooseUserForSend, userChoice, logChoice, wireLangPicker, wireDrag, wireUserPicker, wireLogControls, shownViewer, pickedUser, wireTimerDrag } from './controls.js';
10
+ import { english, getLocale, plural, feedbackLang } from './i18n/index.js';
10
11
  import { injectStylesheet } from '../core/stylesheet.js';
11
12
  import { recordingDomain, loadQuartz, quartzScriptSource } from './quartz.js';
12
13
  import css from './styles.js';
14
+ import { shield, quietly } from '../core/shield.js';
13
15
 
14
16
  // Quartz is an optional page-level SDK. Without it every call is a no-op (fix #5).
15
17
  const QUARTZ_NOOP = {
@@ -28,6 +30,8 @@ var recordingInProgress = false;
28
30
  var sendWhenEnded = false;
29
31
  /** How long the form takes to shrink away when a recording starts: the stylesheet's transition. */
30
32
  const HIDE_MS = 300;
33
+ /** The status message the form shows now, or null. */
34
+ var shownStatus = null;
31
35
  function hasQuartz() {
32
36
  return typeof Quartz !== 'undefined' && !!Quartz; // no i18n
33
37
  }
@@ -51,7 +55,7 @@ function submitFeedback(dataobj) {
51
55
  feedback.close();
52
56
  }
53
57
  else {
54
- feedback.handleStatusmsg(result.ok, result.message);
58
+ feedback.handleStatusmsg(result.ok, result.key);
55
59
  }
56
60
  return result;
57
61
  });
@@ -94,7 +98,7 @@ function sendFeedback(options) {
94
98
  throw new Error('AppticsFeedback.sendFeedback: not sent, the browser is offline or Apptics is disabled for this client'); // no i18n
95
99
  }
96
100
  if (!result.ok) {
97
- throw new Error('AppticsFeedback.sendFeedback: not sent, ' + result.message); // no i18n
101
+ throw new Error('AppticsFeedback.sendFeedback: not sent, ' + english(result.key)); // no i18n
98
102
  }
99
103
  });
100
104
  }
@@ -117,6 +121,72 @@ function buildFeedbackRequest(modal, message, quartzid) {
117
121
  quartzid: quartzid
118
122
  };
119
123
  }
124
+ /**
125
+ * The consent block and the record button beside its checkbox are offered together: both when a
126
+ * recording can be made and none is going on, neither otherwise.
127
+ */
128
+ function offerRecording(modal, on) {
129
+ modal.querySelector("#zasdkreccheckcnt").style.display = on ? "block" : "none"; // no i18n
130
+ modal.querySelector("#zasdkRecBtnCnt").style.display = on ? "" : "none"; // no i18n
131
+ }
132
+ /** The record button can be pressed only once the consent box is ticked, as before the redesign. */
133
+ function syncRecordButton(modal) {
134
+ var consented = modal.querySelector('#zasdkqz-consent').checked; // no i18n
135
+ var button = modal.querySelector('#zasdkqz_rec_button'); // no i18n
136
+ button.disabled = !consented;
137
+ button.setAttribute('aria-disabled', consented ? 'false' : 'true'); // no i18n
138
+ }
139
+ /**
140
+ * Puts back into a newly built form what the user had in it before a language was picked: called
141
+ * once init() has wired everything, so each control takes it as if the user had done it again.
142
+ */
143
+ function restoreInput(modal, keep) {
144
+ if (keep.type) {
145
+ var tile = modal.querySelector('.zasdk-feedback-type[data-type="' + keep.type + '"]'); // no i18n
146
+ if (tile) {
147
+ modal.querySelectorAll('.zasdk-feedback-type').forEach(function (t) { t.classList.remove('zasdk-selected'); }); // no i18n
148
+ tile.classList.add('zasdk-selected'); // no i18n
149
+ }
150
+ }
151
+ modal.querySelector('#zasdkDescription').value = keep.message; // no i18n
152
+ if (keep.consent) {
153
+ modal.querySelector('#zasdkqz-consent').checked = true; // no i18n
154
+ modal.querySelector('#zasdkqz-content').classList.add('zasdkqz-show'); // no i18n
155
+ syncRecordButton(modal);
156
+ }
157
+ if (keep.files && feedback.fileInput) {
158
+ feedback.selectedFiles = keep.files;
159
+ feedback.fileInput.files = keep.files.files;
160
+ if (keep.files.files.length > 0) {
161
+ feedback.fileAttachment();
162
+ }
163
+ }
164
+ if (keep.clip) {
165
+ // the same video element, so the preview Quartz put in it plays on
166
+ modal.querySelector('#previewVideoElemId').replaceWith(keep.clip); // no i18n
167
+ modal.querySelector('#editRecordedVideo').style.display = 'block'; // no i18n
168
+ offerRecording(modal, false);
169
+ }
170
+ if (recordingInProgress) {
171
+ feedback.showRecordingStatus(true);
172
+ feedback.updateDisplay();
173
+ }
174
+ modal.querySelector('#zasdkFeedbackconatiner').style.cssText = keep.place; // no i18n
175
+ feedback.validateFeedbackField();
176
+ if (keep.status) {
177
+ feedback.handleStatusmsg(keep.status.ok, keep.status.key, keep.status.params);
178
+ }
179
+ if (keep.sending) {
180
+ var send = modal.querySelector('#zasdk_submit_btn'); // no i18n
181
+ send.disabled = true;
182
+ send.value = ''; // no i18n
183
+ modal.querySelector('#zasdk_submit_btnsubcnt').classList.add('zasdkbtndisabled'); // no i18n
184
+ }
185
+ try {
186
+ modal.querySelector('#zasdkLangTrigger').focus();
187
+ }
188
+ catch (err) { /* focus is a courtesy */ }
189
+ }
120
190
  /**
121
191
  * Opens the form, optionally pre-filled. `isAnonymous` starts the user picker on Anonymous even
122
192
  * when a user is registered; the include flags start their toggles on.
@@ -207,7 +277,7 @@ const feedback = {
207
277
  MaxFileSize: 10 * 1024 * 1024,
208
278
  _opts: {},
209
279
  typeObj: { 'bug': 0, 'feedback': 1, 'help': 2, 'report': 3 }, // no i18n
210
- init: function (opts) {
280
+ init: function (opts, keep) {
211
281
  feedback._opts = opts || {};
212
282
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
213
283
  if (!isEmpty(modal)) {
@@ -224,9 +294,12 @@ const feedback = {
224
294
  tempContainer.id = 'zasdkFeedbackModal'; // no i18n
225
295
  tempContainer.className = 'zasdk-modal'; // no i18n
226
296
  tempContainer.setAttribute('data-zasdk-theme', _ZAP._config.feedback_theme); // no i18n
227
- tempContainer.innerHTML = feedback.feedbackUIHtml;
297
+ // built in the form's language; screen readers and fonts follow its lang
298
+ tempContainer.innerHTML = feedback.feedbackUIHtml();
299
+ tempContainer.lang = feedbackLang();
228
300
  document.body.appendChild(tempContainer);
229
301
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
302
+ wireLangPicker(modal, feedback.rebuild);
230
303
  // screen recording as the console set it up for this app (getsdkconfig's quartz block)
231
304
  var qz = _ZAP._quartz;
232
305
  var qz_ws_key = qz.workspace;
@@ -246,8 +319,8 @@ const feedback = {
246
319
  const feedbackbox = modal.querySelector('#zasdkFeedbackconatiner'); // no i18n
247
320
  const descriptionField = modal.querySelector('#zasdkDescription'); // no i18n
248
321
  wireDrag(feedbackbox);
249
- wireUserPicker(modal, feedback._opts.isAnonymous === true);
250
- wireLogControls(modal, feedback._opts);
322
+ wireUserPicker(modal, feedback._opts.isAnonymous === true, keep && keep.user);
323
+ wireLogControls(modal, feedback._opts, keep && { includeLog: keep.includeLog, includeDyninfo: keep.includeDyninfo, viewer: keep.viewer });
251
324
  feedback.isScaled = false;
252
325
  feedback.isHidden = false;
253
326
  document.removeEventListener('quartz-feedback-state', feedback.bindQuartzEvent); // no i18n
@@ -260,32 +333,32 @@ const feedback = {
260
333
  // the form needs it, and the checkbox shows once it has arrived
261
334
  var recordingConfigured = qz.enabled && !isEmpty(qz_dc_key) && !isEmpty(qz_ws_key) && !isEmpty(qz_dp_key);
262
335
  var recordingBlock = modal.querySelector("#zasdkreccheckcnt"); // no i18n
263
- recordingBlock.style.display = recordingConfigured && hasQuartz() ? "block" : "none"; // no i18n
336
+ offerRecording(modal, recordingConfigured && hasQuartz());
264
337
  if (recordingConfigured && !hasQuartz()) {
265
338
  // quartz_cdn_url, or Zoho's CDN for this serviceUrl when the answer carries none
266
- loadQuartz(quartzScriptSource(qz.cdnUrl, String(_ZAP._defaultoptions.serviceUrl || ''))).then(function (loaded) {
339
+ quietly('AppticsFeedback', loadQuartz(quartzScriptSource(qz.cdnUrl, String(_ZAP._defaultoptions.serviceUrl || ''))).then(function (loaded) {
267
340
  if (loaded && recordingBlock.isConnected) {
268
- recordingBlock.style.display = "block"; // no i18n
341
+ offerRecording(modal, true);
269
342
  }
270
- });
343
+ }));
271
344
  }
272
- feedbackbox.addEventListener('transitionend', function (event) {
345
+ feedbackbox.addEventListener('transitionend', shield('AppticsFeedback', function (event) {
273
346
  if (event.propertyName === 'transform') { // no i18n
274
347
  feedback.finishHiding();
275
348
  }
276
- });
349
+ }));
277
350
  // the form, opened again while a recording goes on, says so and can stop it
278
351
  const recStop = modal.querySelector('#zasdkRecStatusStop'); // no i18n
279
- recStop.onclick = function () {
352
+ recStop.onclick = shield('AppticsFeedback', function () {
280
353
  feedback.stopRecording();
281
- };
282
- recStop.onkeydown = function (e) {
354
+ });
355
+ recStop.onkeydown = shield('AppticsFeedback', function (e) {
283
356
  if (e.key === 'Enter' || e.key === ' ') { // no i18n
284
357
  e.preventDefault();
285
358
  feedback.stopRecording();
286
359
  }
287
- };
288
- quartzrecbtn.onclick = function (e) {
360
+ });
361
+ quartzrecbtn.onclick = shield('AppticsFeedback', function (e) {
289
362
  e.stopImmediatePropagation();
290
363
  let recordingDetails = {
291
364
  workspaceLinkName: qz_ws_key,
@@ -296,47 +369,48 @@ const feedback = {
296
369
  // 1.x pressed on regardless and the button did nothing anyone could explain; the rest
297
370
  // of the form still works, so say what is missing and leave it usable
298
371
  if (!hasQuartz()) {
299
- feedback.handleStatusmsg(false, 'Screen recording is unavailable on this page.'); // no i18n
372
+ feedback.handleStatusmsg(false, 'fdk.status.recunavailable'); // no i18n
300
373
  return;
301
374
  }
302
375
  if (isEmpty(qz_ws_key) || isEmpty(qz_dp_key) || isEmpty(qz_dc_key)) {
303
- feedback.handleStatusmsg(false, 'Screen recording is not configured for this app.'); // no i18n
376
+ feedback.handleStatusmsg(false, 'fdk.status.recnotconfigured'); // no i18n
304
377
  return;
305
378
  }
306
379
  quartz().startRecording(recordingDetails);
307
- };
308
- closeBtn.onclick = function () {
380
+ });
381
+ closeBtn.onclick = shield('AppticsFeedback', function () {
309
382
  feedback.dismiss();
310
- };
383
+ });
311
384
  // keyboard: Enter or Space on the close control, and Escape anywhere, close the form
312
- closeBtn.onkeydown = function (e) {
385
+ closeBtn.onkeydown = shield('AppticsFeedback', function (e) {
313
386
  if (e.key === 'Enter' || e.key === ' ') { // no i18n
314
387
  e.preventDefault();
315
388
  feedback.dismiss();
316
389
  }
317
- };
390
+ });
318
391
  document.addEventListener('keydown', feedback.onEscape); // no i18n
319
- preivewButton.addEventListener('click', function () {
392
+ preivewButton.addEventListener('click', shield('AppticsFeedback', function () {
320
393
  quartz().previewVideo();
321
- });
322
- videoEditButton.addEventListener('click', function () {
394
+ }));
395
+ videoEditButton.addEventListener('click', shield('AppticsFeedback', function () {
323
396
  quartz().editVideo({ quartzBranding: false });
324
- });
325
- deleteVideoButton.addEventListener('click', function () {
397
+ }));
398
+ deleteVideoButton.addEventListener('click', shield('AppticsFeedback', function () {
326
399
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
327
400
  quartz().clearFeedback();
328
401
  checkbox.checked = false;
329
402
  content.classList.remove('zasdkqz-show'); // no i18n
403
+ syncRecordButton(modal);
330
404
  modal.querySelector("#editRecordedVideo").style.display = "none"; // no i18n
331
- modal.querySelector("#zasdkreccheckcnt").style.display = "block"; // no i18n
405
+ offerRecording(modal, true);
332
406
  feedback.validateFeedbackField();
333
- });
334
- submitbtn.addEventListener('click', async () => {
407
+ }));
408
+ submitbtn.addEventListener('click', shield('AppticsFeedback', async () => {
335
409
  // Disable button and show loader
336
410
  feedback.validateFeedbackField();
337
411
  submitbtn.disabled = true;
338
412
  submitbtncnt.classList.add('zasdkbtndisabled'); // no i18n
339
- submitbtn.value = '';
413
+ submitbtn.value = ''; // no i18n
340
414
  try {
341
415
  if (recordingInProgress) {
342
416
  // sent with the recording: stopped first, and sent once Quartz has stored it
@@ -352,25 +426,26 @@ const feedback = {
352
426
  else {
353
427
  let message = modal.querySelector('#zasdkDescription').value.trim(); // no i18n
354
428
  if (message.length > 0) {
355
- submitFeedback(buildFeedbackRequest(modal, message, '')); // no i18n
429
+ quietly('AppticsFeedback', submitFeedback(buildFeedbackRequest(modal, message, ''))); // no i18n
356
430
  }
357
431
  else {
358
- feedback.handleStatusmsg(false, 'Please provide more details for us to help you better.'); // no i18n
432
+ feedback.handleStatusmsg(false, 'fdk.status.required'); // no i18n
359
433
  }
360
434
  }
361
435
  }
362
436
  catch (error) {
363
437
  Console.error("sendFeedbackData : " + error); // no i18n
364
438
  }
365
- });
366
- checkbox.addEventListener('change', function () {
439
+ }));
440
+ checkbox.addEventListener('change', shield('AppticsFeedback', function () {
367
441
  if (this.checked) {
368
442
  content.classList.add('zasdkqz-show'); // no i18n
369
443
  }
370
444
  else {
371
445
  content.classList.remove('zasdkqz-show'); // no i18n
372
446
  }
373
- });
447
+ syncRecordButton(modal);
448
+ }));
374
449
  descriptionField.addEventListener('input', feedback.validateFeedbackField); // no i18n
375
450
  // keyboard and screen-reader users land in the form, not behind it
376
451
  try {
@@ -378,12 +453,12 @@ const feedback = {
378
453
  }
379
454
  catch (err) { /* focus is a courtesy */ }
380
455
  feedbackTypes.forEach(function (type) {
381
- type.addEventListener("click", function () {
456
+ type.addEventListener("click", shield('AppticsFeedback', function () {
382
457
  feedbackTypes.forEach(function (t) {
383
458
  t.classList.remove("zasdk-selected"); // no i18n
384
459
  });
385
460
  this.classList.add("zasdk-selected"); // no i18n
386
- });
461
+ }));
387
462
  });
388
463
  // what feedbackFormOpen() was given: select that type, fill the description
389
464
  if (typeof feedback._opts.type === 'number') { // no i18n
@@ -402,14 +477,14 @@ const feedback = {
402
477
  feedback.validateFeedbackField();
403
478
  }
404
479
  feedback.selectedFiles = newTransfer();
405
- feedback.fileInput.onchange = function () {
480
+ feedback.fileInput.onchange = shield('AppticsFeedback', function () {
406
481
  const self = this;
407
482
  var chosen = feedback.selectedFiles;
408
483
  if (chosen === null) {
409
484
  return; // no file list on this browser; see newTransfer()
410
485
  }
411
486
  if (chosen.files.length + self.files.length > 5) {
412
- feedback.handleStatusmsg(false, 'Maximum 5 attachments is allowed'); // no i18n
487
+ feedback.handleStatusmsg(false, 'fdk.limit.count', [MAX_ATTACHMENTS]); // no i18n
413
488
  feedback.fileInput.files = chosen.files;
414
489
  self.files = chosen.files;
415
490
  return;
@@ -419,7 +494,7 @@ const feedback = {
419
494
  for (let file of self.files) {
420
495
  filesize = filesize + file.size;
421
496
  if (filesize > 10485760) {
422
- feedback.handleStatusmsg(false, 'Maximum limit reached. The total file size cannot exceed 10MB.'); // no i18n
497
+ feedback.handleStatusmsg(false, 'fdk.limit.size', [MAX_ATTACHMENT_SIZE_TEXT]); // no i18n
423
498
  self.files = chosen.files;
424
499
  return;
425
500
  }
@@ -434,25 +509,55 @@ const feedback = {
434
509
  // Restore previous files if the user cancels
435
510
  self.files = chosen.files;
436
511
  }
437
- };
512
+ });
438
513
  feedback.handleStatusmsg();
439
514
  feedback.updateLeftCount();
515
+ if (keep) {
516
+ restoreInput(modal, keep);
517
+ }
518
+ },
519
+ rebuild: function () {
520
+ var old = document.getElementById("zasdkFeedbackModal"); // no i18n
521
+ if (!old) {
522
+ return;
523
+ }
524
+ var clipArea = old.querySelector('#editRecordedVideo'); // no i18n
525
+ var keep = {
526
+ type: old.querySelector('.zasdk-selected').getAttribute('data-type'), // no i18n
527
+ message: old.querySelector('#zasdkDescription').value, // no i18n
528
+ user: pickedUser(),
529
+ consent: old.querySelector('#zasdkqz-consent').checked, // no i18n
530
+ includeLog: logChoice.includeLog,
531
+ includeDyninfo: logChoice.includeDyninfo,
532
+ viewer: shownViewer(),
533
+ files: feedback.selectedFiles,
534
+ clip: clipArea.style.display === 'block' ? old.querySelector('#previewVideoElemId') : null, // no i18n
535
+ place: old.querySelector('#zasdkFeedbackconatiner').style.cssText, // no i18n
536
+ sending: old.querySelector('#zasdk_submit_btn').disabled, // no i18n
537
+ status: shownStatus
538
+ };
539
+ // the old form goes, and its listeners with it; the new one is wired as any form is
540
+ old.remove();
541
+ feedback.init(feedback._opts, keep);
542
+ // the recording timer, when there is one, is on the page rather than in the form
543
+ var timer = document.getElementById('zasdkrectimer'); // no i18n
544
+ if (timer) {
545
+ timer.lang = feedbackLang();
546
+ timer.querySelector('.zasdk-tooltip-top').textContent = getLocale('fdk.rec.stop'); // no i18n
547
+ }
440
548
  },
441
549
  updateLeftCount: function () {
442
550
  document.querySelectorAll("[reqname]").forEach(function (elem) {
443
551
  let val = elem.value;
444
552
  let maxLength = parseInt(elem.getAttribute("maxlength") || '', 10); // no i18n
445
- let counterElem = elem.parentElement ? elem.parentElement.querySelector(".zaleftcharcnt") : null; // no i18n
553
+ let counterElem = elem.parentElement ? elem.parentElement.querySelector(".zaleftchartxt") : null; // no i18n
446
554
  if (counterElem) {
447
- counterElem.textContent = String(maxLength - val.length); // Update remaining count
448
- var unit = counterElem.parentElement ? counterElem.parentElement.querySelector(".zaleftchartxt") : null; // no i18n
449
- if (unit) {
450
- unit.textContent = maxLength - val.length === 1 ? 'character left' : 'characters left'; // no i18n
451
- }
555
+ // the count and its words in one text, as each language orders them
556
+ counterElem.textContent = plural(maxLength - val.length, 'fdk.charleft'); // no i18n
452
557
  }
453
558
  });
454
559
  },
455
- handleStatusmsg: function (isSuccess, stsmsg) {
560
+ handleStatusmsg: function (isSuccess, key, params) {
456
561
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
457
562
  if (isEmpty(modal)) {
458
563
  return;
@@ -461,28 +566,31 @@ const feedback = {
461
566
  var submitbtn = modal.querySelector("#zasdk_submit_btn"); // no i18n
462
567
  var submitbtncnt = modal.querySelector("#zasdk_submit_btnsubcnt"); // no i18n
463
568
  var successmsgclass = ''; // no i18n
464
- var successmsg = ''; // no i18n
465
569
  stscnt.style.display = "none"; // no i18n
570
+ shownStatus = null;
466
571
  if (!isEmpty(isSuccess)) {
467
572
  successmsgclass = isSuccess ? 'zasdkstssucs' : 'zasdkstserror'; // no i18n
468
- successmsg = !isEmpty(stsmsg) ? stsmsg : ''; // no i18n
469
- stscnt.textContent = successmsg;
573
+ // kept as key and params, so the form rebuilt in another language says it too
574
+ shownStatus = { ok: !!isSuccess, key: key || '', params: params }; // no i18n
575
+ var asIs = Array.isArray(params) ? params[0] : params;
576
+ stscnt.textContent = key ? getLocale(key, params) : String(asIs !== undefined && asIs !== null ? asIs : ''); // no i18n
470
577
  stscnt.classList.add(successmsgclass);
471
578
  stscnt.style.display = "block"; // no i18n
472
579
  submitbtncnt.classList.remove('zasdkbtndisabled'); // no i18n
473
580
  submitbtn.disabled = false;
474
- submitbtn.value = 'Send'; // no i18n
581
+ submitbtn.value = getLocale('fdk.send'); // no i18n
475
582
  }
476
583
  },
477
- handleErrorQuartzEvent: function (event) {
584
+ handleErrorQuartzEvent: shield('AppticsFeedback', function (event) {
478
585
  let errorType = event.detail.error.name;
479
586
  let errorMessage = event.detail.error.message;
480
587
  if (errorType == quartzConstants().ErrorType.RECORDING_INTERRUPTED || errorType == quartzConstants().ErrorType.FEEDBACK_TIMEOUT) {
481
588
  feedback.stopRecording();
482
589
  }
483
- feedback.handleStatusmsg(false, errorMessage);
484
- },
485
- bindQuartzEvent: function (event) {
590
+ // Quartz's own words, shown as they are: '' asks for no translation
591
+ feedback.handleStatusmsg(false, '', [errorMessage]); // no i18n
592
+ }),
593
+ bindQuartzEvent: shield('AppticsFeedback', function (event) {
486
594
  let feedbackState = event.detail.feedbackState;
487
595
  if (feedbackState == quartzConstants().FeedbackState.RECORDING_COMPLETED) {
488
596
  // Quartz's own stop control and the browser's "Stop sharing" end the recording without
@@ -497,9 +605,10 @@ const feedback = {
497
605
  feedbacktimer.remove();
498
606
  }
499
607
  const tempDiv = document.createElement("div"); // no i18n
500
- tempDiv.innerHTML = feedback.timerHtml;
608
+ tempDiv.innerHTML = feedback.timerHtml();
501
609
  const node = tempDiv.firstElementChild;
502
610
  node.setAttribute('data-zasdk-theme', _ZAP._config.feedback_theme); // no i18n
611
+ node.lang = feedbackLang();
503
612
  document.body.appendChild(node);
504
613
  var feedbacktimer = document.getElementById("zasdkrectimer"); // no i18n
505
614
  // draggable anywhere on the page; wired before the click that stops the recording
@@ -509,18 +618,19 @@ const feedback = {
509
618
  feedback.TOTAL_TIME = 5 * 60; // 5 minutes in seconds
510
619
  feedback.remainingTime = feedback.TOTAL_TIME;
511
620
  feedback.isRecording = true;
621
+ feedback.timerInterval;
512
622
  feedback.recordButton.addEventListener('click', feedback.toggleRecording); // no i18n
513
623
  feedback.startRecording();
514
624
  feedback.updateDisplay();
515
625
  feedback.showRecordingStatus(true);
516
626
  feedback.toggleWindowAnimation();
517
627
  }
518
- },
519
- onEscape: function (e) {
628
+ }),
629
+ onEscape: shield('AppticsFeedback', function (e) {
520
630
  if (e.key === 'Escape') { // no i18n
521
631
  feedback.dismiss();
522
632
  }
523
- },
633
+ }),
524
634
  dismiss: function () {
525
635
  // the form's own close (its X, Escape) during a recording puts it out of sight rather than
526
636
  // throwing away what was typed: the recording goes on, and the next open brings it all back
@@ -539,7 +649,7 @@ const feedback = {
539
649
  }
540
650
  modal.querySelector("#zasdkrecstatus").style.display = on ? "flex" : "none"; // no i18n
541
651
  if (on) {
542
- modal.querySelector("#zasdkreccheckcnt").style.display = "none"; // no i18n
652
+ offerRecording(modal, false);
543
653
  }
544
654
  },
545
655
  close: function () {
@@ -579,7 +689,7 @@ const feedback = {
579
689
  setTimeout(feedback.finishHiding, HIDE_MS + 50);
580
690
  }
581
691
  },
582
- finishHiding: function () {
692
+ finishHiding: shield('AppticsFeedback', function () {
583
693
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
584
694
  // once only, and not when the form was brought back meanwhile
585
695
  if (!modal || !feedback.isScaled || feedback.isHidden) {
@@ -587,7 +697,7 @@ const feedback = {
587
697
  }
588
698
  modal.style.display = 'none'; // no i18n
589
699
  feedback.isHidden = true;
590
- },
700
+ }),
591
701
  fileAttachment: function () {
592
702
  var uploadedFiles = feedback.fileInput.files;
593
703
  feedback.uploadTotalSize = 0;
@@ -595,7 +705,7 @@ const feedback = {
595
705
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
596
706
  var sizeInfo = modal.querySelector("#zasdkfilesizeinfo"); // no i18n
597
707
  var fileUl = modal.querySelector("#zasakfileList"); // no i18n
598
- sizeInfo.textContent = ""; // no i18n
708
+ sizeInfo.textContent = ''; // no i18n
599
709
  if ((uploadedFiles.length) > 5) {
600
710
  feedback.fileLimitExceeded(false, true);
601
711
  feedback.validateFeedbackField();
@@ -617,25 +727,29 @@ const feedback = {
617
727
  span1.innerText = (fName.length > 10) ? fName.slice(0, 3) + "..." + fName.slice(-3) : fName; // no i18n
618
728
  var span2 = feedback.elementCreator("span"); // no i18n
619
729
  span2.innerText = "." + extension; // no i18n
730
+ var sizeSpan = feedback.elementCreator("span"); // no i18n
731
+ sizeSpan.className = "zasdkFdBckFlSize"; // no i18n
732
+ sizeSpan.textContent = feedback.formatFileSize(bytes);
620
733
  var span3 = feedback.elementCreator("span"); // no i18n
621
734
  span3.className = "zasdkFdBckFlCls"; // no i18n
622
735
  span3.setAttribute("data-name", fileName); // no i18n
623
736
  span3.innerHTML = "×"; // no i18N
624
737
  fileLi.appendChild(span1);
625
738
  fileLi.appendChild(span2);
739
+ fileLi.appendChild(sizeSpan);
626
740
  fileLi.appendChild(span3);
627
741
  fileUl.appendChild(fileLi);
628
742
  }
629
743
  var limitReached = totalSize > feedback.MaxFileSize;
630
744
  feedback.fileLimitExceeded(limitReached);
631
- sizeInfo.textContent = `${feedback.formatFileSize(totalSize)} Used / 10 MB`; // no i18n
745
+ sizeInfo.textContent = getLocale('fdk.size.used', [feedback.formatFileSize(totalSize), '10 MB']); // no i18n
632
746
  const clearFile = modal.querySelectorAll('.zasdkFdBckFlCls'); // no i18n
633
747
  Array.from(clearFile).forEach(function (element) {
634
- element.addEventListener('click', function () {
748
+ element.addEventListener('click', shield('AppticsFeedback', function () {
635
749
  feedback.handleStatusmsg();
636
750
  feedback.removeFileFromList(this);
637
751
  feedback.fileAttachment();
638
- });
752
+ }));
639
753
  });
640
754
  }
641
755
  feedback.validateFeedbackField();
@@ -644,11 +758,16 @@ const feedback = {
644
758
  return document.createElement(elType);
645
759
  },
646
760
  fileLimitExceeded: function (limitReached, filesLengthReached) {
647
- var infoMsg = "";
648
761
  if (filesLengthReached || limitReached) {
649
- infoMsg = filesLengthReached ? 'Maximum 5 attachments is allowed' : 'Maximum limit reached. The total file size cannot exceed 10MB.'; // no i18n
762
+ if (filesLengthReached) {
763
+ feedback.handleStatusmsg(false, 'fdk.limit.count', [MAX_ATTACHMENTS]); // no i18n
764
+ }
765
+ else {
766
+ feedback.handleStatusmsg(false, 'fdk.limit.size', [MAX_ATTACHMENT_SIZE_TEXT]); // no i18n
767
+ }
768
+ return;
650
769
  }
651
- feedback.handleStatusmsg(false, infoMsg);
770
+ feedback.handleStatusmsg(false, ''); // no i18n
652
771
  },
653
772
  removeFileFromList: function (elem) {
654
773
  elem.getAttribute('data-name'); // no i18n
@@ -686,7 +805,7 @@ const feedback = {
686
805
  return sizeInKB.toFixed(2) + ' KB'; // no i18n
687
806
  }
688
807
  },
689
- toggleRecording: function () {
808
+ toggleRecording: shield('AppticsFeedback', function () {
690
809
  feedback.isRecording = !feedback.isRecording;
691
810
  if (feedback.isRecording) {
692
811
  feedback.startRecording();
@@ -694,7 +813,7 @@ const feedback = {
694
813
  else {
695
814
  feedback.stopRecording();
696
815
  }
697
- },
816
+ }),
698
817
  startRecording: function () {
699
818
  if (!feedback.timerInterval) {
700
819
  feedback.timerInterval = setInterval(feedback.updateTimer, 1000);
@@ -709,9 +828,9 @@ const feedback = {
709
828
  clearInterval(feedback.timerInterval || undefined);
710
829
  feedback.timerInterval = null;
711
830
  // the preview is read from what Quartz stored, so only once the recording has ended
712
- Promise.resolve(quartz().endRecording()).catch(function (err) {
831
+ quietly('AppticsFeedback', Promise.resolve(quartz().endRecording()).catch(function (err) {
713
832
  Console.log('stopRecording: ' + err); // no i18n
714
- }).then(feedback.recordingEnded);
833
+ }).then(feedback.recordingEnded));
715
834
  },
716
835
  recordingEnded: function () {
717
836
  if (!recordingInProgress) {
@@ -734,15 +853,15 @@ const feedback = {
734
853
  feedback.showRecordingStatus(false);
735
854
  feedback.showForm();
736
855
  modal.querySelector("#editRecordedVideo").style.display = "block"; // no i18n
737
- modal.querySelector("#zasdkreccheckcnt").style.display = "none"; // no i18n
856
+ offerRecording(modal, false);
738
857
  let videoElem = modal.querySelector('#previewVideoElemId'); // no i18n
739
- Promise.resolve(quartz().setVideoContent(videoElem)).catch(function (err) {
858
+ quietly('AppticsFeedback', Promise.resolve(quartz().setVideoContent(videoElem)).catch(function (err) {
740
859
  Console.warn('AppticsFeedback: the recording could not be shown: ' + err); // no i18n
741
860
  }).then(function () {
742
861
  if (send && document.getElementById("zasdkFeedbackModal")) { // no i18n
743
862
  feedback.submitRecording();
744
863
  }
745
- });
864
+ }));
746
865
  },
747
866
  showForm: function () {
748
867
  // shown outright, not toggled: a recording that ends mid-way through the scale-down would
@@ -755,11 +874,11 @@ const feedback = {
755
874
  feedback.isHidden = false;
756
875
  feedback.isScaled = false;
757
876
  modal.style.display = 'block'; // no i18n
758
- setTimeout(() => {
877
+ setTimeout(shield('AppticsFeedback', () => {
759
878
  box.style.transform = 'scale(1)'; // no i18n
760
879
  box.style.opacity = '1'; // no i18n
761
880
  feedback.validateFeedbackField();
762
- }, 10);
881
+ }), 10);
763
882
  },
764
883
  submitRecording: function () {
765
884
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
@@ -779,16 +898,16 @@ const feedback = {
779
898
  })
780
899
  .then((response) => {
781
900
  var zqrecid = !isEmptyObj(response) && response && response.hasOwnProperty('feedbackLink') ? (response.feedbackLink || '') : ''; // no i18n
782
- submitFeedback(buildFeedbackRequest(modal, subject, zqrecid));
901
+ quietly('AppticsFeedback', submitFeedback(buildFeedbackRequest(modal, subject, zqrecid))); // no i18n
783
902
  })
784
903
  .catch((error) => {
785
904
  // the upload is Quartz's to do; if it fails, hand the form back rather than leaving
786
905
  // the submit button spinning with nothing said
787
906
  Console.error("submitRecording : " + error); // no i18n
788
- feedback.handleStatusmsg(false, 'Could not upload the recording. Please try again.'); // no i18n
907
+ feedback.handleStatusmsg(false, 'fdk.status.uploadfailed'); // no i18n
789
908
  });
790
909
  },
791
- updateTimer: function () {
910
+ updateTimer: shield('AppticsFeedback', function () {
792
911
  if (feedback.remainingTime > 0) {
793
912
  feedback.remainingTime--;
794
913
  feedback.updateDisplay();
@@ -796,7 +915,7 @@ const feedback = {
796
915
  else {
797
916
  feedback.stopRecording();
798
917
  }
799
- },
918
+ }),
800
919
  updateDisplay: function () {
801
920
  const minutes = Math.floor(feedback.remainingTime / 60);
802
921
  const seconds = feedback.remainingTime % 60;
@@ -810,7 +929,7 @@ const feedback = {
810
929
  inForm.textContent = shown;
811
930
  }
812
931
  },
813
- validateFeedbackField: function () {
932
+ validateFeedbackField: shield('AppticsFeedback', function () {
814
933
  feedback.updateLeftCount();
815
934
  var modal = document.getElementById("zasdkFeedbackModal"); // no i18n
816
935
  const descriptionField = modal.querySelector('#zasdkDescription'); // no i18n
@@ -829,7 +948,7 @@ const feedback = {
829
948
  else {
830
949
  sendButton.classList.add('zasdkbtndisableclr'); // no i18n
831
950
  }
832
- },
951
+ }),
833
952
  getVisibleErrorCount: function (elements) {
834
953
  return Array.from(elements).filter(element => element.offsetParent !== null).length;
835
954
  }