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