(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({ 1: [function (require, module, exports) { "use strict"; /** * Parent module for all modules in Api/ */ Object.defineProperty(exports, "__esModule", { value: true }); var ISurveyInfo = require("./../ISurveyInfo"); exports.ISurveyInfo = ISurveyInfo; var IActivityListener = require("./IActivityListener"); exports.IActivityListener = IActivityListener; var IFloodgateSettingIdMap = require("./IFloodgateSettingIdMap"); exports.IFloodgateSettingIdMap = IFloodgateSettingIdMap; var IFloodgateStorageProvider = require("./IFloodgateStorageProvider"); exports.IFloodgateStorageProvider = IFloodgateStorageProvider; var IFloodgateStringProvider = require("./IFloodgateStringProvider"); exports.IFloodgateStringProvider = IFloodgateStringProvider; var ISurvey = require("./ISurvey"); exports.ISurvey = ISurvey; var ISurveyComponent = require("./ISurveyComponent"); exports.ISurveyComponent = ISurveyComponent; },{"./../ISurveyInfo":8,"./IActivityListener":2,"./IFloodgateSettingIdMap":3,"./IFloodgateStorageProvider":4,"./IFloodgateStringProvider":5,"./ISurvey":6,"./ISurveyComponent":7}],2:[function(require,module,exports){ "use strict"; var IActivityListener; (function (IActivityListener) { var ActivityName = /** @class */ (function () { function ActivityName() { } ActivityName.AppLaunch = "AppLaunch"; ActivityName.AppUsageTime = "AppUsageTime"; ActivityName.AppResume = "AppResume"; return ActivityName; }()); IActivityListener.ActivityName = ActivityName; })(IActivityListener || (IActivityListener = {})); module.exports = IActivityListener; },{}],3:[function(require,module,exports){ "use strict"; var IFloodgateSettingIdMap; (function (IFloodgateSettingIdMap) { /** * Collection of setting names and ids */ IFloodgateSettingIdMap.RoamingSettingIdMap = { CampaignStates: 1258, GovernedChannelStates: 1257, SurveyActivationStats: 1259, }; })(IFloodgateSettingIdMap || (IFloodgateSettingIdMap = {})); module.exports = IFloodgateSettingIdMap; },{}],4:[function(require,module,exports){ "use strict"; var IFloodgateStorageProvider; (function (IFloodgateStorageProvider) { /** * Enum for the files used by floodgate */ var FileType; (function (FileType) { FileType[FileType["FloodgateSettings"] = 0] = "FloodgateSettings"; FileType[FileType["SurveyActivationStats"] = 1] = "SurveyActivationStats"; FileType[FileType["SurveyEventActivityStats"] = 2] = "SurveyEventActivityStats"; FileType[FileType["CampaignDefinitions"] = 3] = "CampaignDefinitions"; FileType[FileType["CampaignStates"] = 4] = "CampaignStates"; FileType[FileType["GovernedChannelStates"] = 5] = "GovernedChannelStates"; })(FileType = IFloodgateStorageProvider.FileType || (IFloodgateStorageProvider.FileType = {})); })(IFloodgateStorageProvider || (IFloodgateStorageProvider = {})); module.exports = IFloodgateStorageProvider; },{}],5:[function(require,module,exports){ "use strict"; var IFloodgateStringProvider; (function (IFloodgateStringProvider) { /** * Enum for the strings used by floodgate */ var StringType; (function (StringType) { StringType[StringType["NpsPromptTitle"] = 0] = "NpsPromptTitle"; StringType[StringType["NpsPromptQuestion"] = 1] = "NpsPromptQuestion"; StringType[StringType["NpsPromptYesLabel"] = 2] = "NpsPromptYesLabel"; StringType[StringType["NpsPromptNotNowLabel"] = 3] = "NpsPromptNotNowLabel"; StringType[StringType["NpsRatingQuestion"] = 4] = "NpsRatingQuestion"; StringType[StringType["Nps11RatingValue0"] = 5] = "Nps11RatingValue0"; StringType[StringType["Nps11RatingValue1"] = 6] = "Nps11RatingValue1"; StringType[StringType["Nps11RatingValue2"] = 7] = "Nps11RatingValue2"; StringType[StringType["Nps11RatingValue3"] = 8] = "Nps11RatingValue3"; StringType[StringType["Nps11RatingValue4"] = 9] = "Nps11RatingValue4"; StringType[StringType["Nps11RatingValue5"] = 10] = "Nps11RatingValue5"; StringType[StringType["Nps11RatingValue6"] = 11] = "Nps11RatingValue6"; StringType[StringType["Nps11RatingValue7"] = 12] = "Nps11RatingValue7"; StringType[StringType["Nps11RatingValue8"] = 13] = "Nps11RatingValue8"; StringType[StringType["Nps11RatingValue9"] = 14] = "Nps11RatingValue9"; StringType[StringType["Nps11RatingValue10"] = 15] = "Nps11RatingValue10"; StringType[StringType["Nps5RatingValue1"] = 16] = "Nps5RatingValue1"; StringType[StringType["Nps5RatingValue2"] = 17] = "Nps5RatingValue2"; StringType[StringType["Nps5RatingValue3"] = 18] = "Nps5RatingValue3"; StringType[StringType["Nps5RatingValue4"] = 19] = "Nps5RatingValue4"; StringType[StringType["Nps5RatingValue5"] = 20] = "Nps5RatingValue5"; StringType[StringType["NpsCommentQuestion"] = 21] = "NpsCommentQuestion"; StringType[StringType["PsatPromptTitle"] = 22] = "PsatPromptTitle"; StringType[StringType["PsatPromptQuestion"] = 23] = "PsatPromptQuestion"; StringType[StringType["PsatPromptYesLabel"] = 24] = "PsatPromptYesLabel"; StringType[StringType["PsatPromptNotNowLabel"] = 25] = "PsatPromptNotNowLabel"; StringType[StringType["PsatRatingQuestion"] = 26] = "PsatRatingQuestion"; StringType[StringType["PsatRatingValue1"] = 27] = "PsatRatingValue1"; StringType[StringType["PsatRatingValue2"] = 28] = "PsatRatingValue2"; StringType[StringType["PsatRatingValue3"] = 29] = "PsatRatingValue3"; StringType[StringType["PsatRatingValue4"] = 30] = "PsatRatingValue4"; StringType[StringType["PsatRatingValue5"] = 31] = "PsatRatingValue5"; StringType[StringType["PsatCommentQuestion"] = 32] = "PsatCommentQuestion"; StringType[StringType["BpsPromptTitle"] = 33] = "BpsPromptTitle"; StringType[StringType["BpsPromptQuestion"] = 34] = "BpsPromptQuestion"; StringType[StringType["BpsPromptYesLabel"] = 35] = "BpsPromptYesLabel"; StringType[StringType["BpsPromptNotNowLabel"] = 36] = "BpsPromptNotNowLabel"; StringType[StringType["BpsRatingQuestion"] = 37] = "BpsRatingQuestion"; StringType[StringType["BpsRatingValue1"] = 38] = "BpsRatingValue1"; StringType[StringType["BpsRatingValue2"] = 39] = "BpsRatingValue2"; StringType[StringType["BpsCommentQuestion"] = 40] = "BpsCommentQuestion"; })(StringType = IFloodgateStringProvider.StringType || (IFloodgateStringProvider.StringType = {})); })(IFloodgateStringProvider || (IFloodgateStringProvider = {})); module.exports = IFloodgateStringProvider; },{}],6:[function(require,module,exports){ "use strict"; var ISurvey; (function (ISurvey) { var Type; (function (Type) { // A Feedback survey. Contains a single question with a free-form text response Type[Type["Feedback"] = 0] = "Feedback"; // An NPS (net promoter score) survey. Asks user to rate "whether or not they would recommend this product to family/friends". // Contains a prompt, question, and rating Type[Type["Nps"] = 1] = "Nps"; // A PSAT (product satisfaction) survey. Asks user to rate "overall, based on their experience, how satisifed are they with this app" // Contains a prompt, question, and rating Type[Type["Psat"] = 2] = "Psat"; // A BPS (build promotion) survey. Asks user to choose between Yes and No options of promoting the current build to the next audience ring // Contains a prompt, question, and rating (Yes/No) Type[Type["Bps"] = 3] = "Bps"; // A FPS (feature promotion) survey. Asks user to rate a given app feature. // Contains a prompt, question, and rating Type[Type["Fps"] = 4] = "Fps"; // A NLQS (net language quality score) survey. Asks user to rate the language quality. // Contains a prompt, question, and rating Type[Type["Nlqs"] = 5] = "Nlqs"; // A Generic surface survey that uses content metadata to render a surface. // As of 4th Feb 2019 there are 11 types defined in Mso hence giving a value of 12. Type[Type["GenericMessagingSurface"] = 12] = "GenericMessagingSurface"; })(Type = ISurvey.Type || (ISurvey.Type = {})); ISurvey.DOM_FEEDBACKSURVEY_TAGNAME = "FeedbackSurvey"; ISurvey.DOM_NPS_TAGNAME = "Nps"; ISurvey.DOM_PSAT_TAGNAME = "Psat"; ISurvey.DOM_BPS_TAGNAME = "Bps"; ISurvey.DOM_FPS_TAGNAME = "Fps"; ISurvey.DOM_NLQS_TAGNAME = "Nlqs"; // If the launcher type is null or undefined in campaign definition then this value will be used as default ISurvey.LAUNCHER_TYPE_DEFAULT = "survey"; })(ISurvey || (ISurvey = {})); module.exports = ISurvey; },{}],7:[function(require,module,exports){ "use strict"; var ISurveyComponent; (function (ISurveyComponent) { var Type; (function (Type) { // A quick pop-up requesting participation in a survey Type[Type["Prompt"] = "Prompt"] = "Prompt"; // A question paired with a free-form text response Type[Type["Comment"] = "Comment"] = "Comment"; // A question asking for a selection from a list of allowed values with numeric meaning Type[Type["Rating"] = "Rating"] = "Rating"; // A question asking for one or more selections from a list of allowed values Type[Type["MultipleChoice"] = "MultipleChoice"] = "MultipleChoice"; })(Type = ISurveyComponent.Type || (ISurveyComponent.Type = {})); ISurveyComponent.DOM_PROMPT_TAGNAME = "Prompt"; ISurveyComponent.DOM_COMMENT_TAGNAME = "Comment"; ISurveyComponent.DOM_RATING_TAGNAME = "Rating"; ISurveyComponent.DOM_MULTIPLECHOICE_TAGNAME = "MultipleChoice"; ISurveyComponent.JSON_PROMPT_KEYNAME = "prompt"; ISurveyComponent.JSON_COMMENT_KEYNAME = "comment"; ISurveyComponent.JSON_RATING_KEYNAME = "rating"; ISurveyComponent.JSON_MULTIPLECHOICE_KEYNAME = "multipleChoice"; ISurveyComponent.JSON_APPLICATION_KEYNAME = "application"; ISurveyComponent.JSON_EXTENDEDMANIFESTDATA_KEYNAME = "extendedManifestData"; })(ISurveyComponent || (ISurveyComponent = {})); module.exports = ISurveyComponent; },{}],8:[function(require,module,exports){ "use strict"; var ISurveyInfo; (function (ISurveyInfo) { var LaunchType; (function (LaunchType) { // No launch type specified, defer to the launcher factory code LaunchType[LaunchType["Default"] = "Default"] = "Default"; // Prefer a notification-based launcher (like the windows toast launcher when present) LaunchType[LaunchType["Notification"] = "Notification"] = "Notification"; // Prefer a modal-dialog based launcher LaunchType[LaunchType["Modal"] = "Modal"] = "Modal"; })(LaunchType = ISurveyInfo.LaunchType || (ISurveyInfo.LaunchType = {})); var AdditionalDataType; (function (AdditionalDataType) { // Request email address AdditionalDataType[AdditionalDataType["EmailAddress"] = 0] = "EmailAddress"; })(AdditionalDataType = ISurveyInfo.AdditionalDataType || (ISurveyInfo.AdditionalDataType = {})); ISurveyInfo.DOM_TYPE_TAGNAME = "Type"; ISurveyInfo.DOM_TYPE_VALUE = "Survey"; ISurveyInfo.DOM_ID_TAGNAME = "SurveyID"; ISurveyInfo.JSON_SURVEY_KEYNAME = "survey"; ISurveyInfo.JSON_ID_KEYNAME = "surveyId"; })(ISurveyInfo || (ISurveyInfo = {})); module.exports = ISurveyInfo; },{}],9:[function(require,module,exports){ (function (process,global){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.6+9869a4bc */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.ES6Promise = factory()); }(this, (function () { 'use strict'; function objectOrFunction(x) { var type = typeof x; return x !== null && (type === 'object' || type === 'function'); } function isFunction(x) { return typeof x === 'function'; } var _isArray = void 0; if (Array.isArray) { _isArray = Array.isArray; } else { _isArray = function (x) { return Object.prototype.toString.call(x) === '[object Array]'; }; } var isArray = _isArray; var len = 0; var vertxNext = void 0; var customSchedulerFn = void 0; var asap = function asap(callback, arg) { queue[len] = callback; queue[len + 1] = arg; len += 2; if (len === 2) { // If len is 2, that means that we need to schedule an async flush. // If additional callbacks are queued before the queue is flushed, they // will be processed by this flush that we are scheduling. if (customSchedulerFn) { customSchedulerFn(flush); } else { scheduleFlush(); } } }; function setScheduler(scheduleFn) { customSchedulerFn = scheduleFn; } function setAsap(asapFn) { asap = asapFn; } var browserWindow = typeof window !== 'undefined' ? window : undefined; var browserGlobal = browserWindow || {}; var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; // test for web worker but not in IE10 var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; // node function useNextTick() { // node version 0.10.x displays a deprecation warning when nextTick is used recursively // see https://github.com/cujojs/when/issues/410 for details return function () { return process.nextTick(flush); }; } // vertx function useVertxTimer() { if (typeof vertxNext !== 'undefined') { return function () { vertxNext(flush); }; } return useSetTimeout(); } function useMutationObserver() { var iterations = 0; var observer = new BrowserMutationObserver(flush); var node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function () { node.data = iterations = ++iterations % 2; }; } // web worker function useMessageChannel() { var channel = new MessageChannel(); channel.port1.onmessage = flush; return function () { return channel.port2.postMessage(0); }; } function useSetTimeout() { // Store setTimeout reference so es6-promise will be unaffected by // other code modifying setTimeout (like sinon.useFakeTimers()) var globalSetTimeout = setTimeout; return function () { return globalSetTimeout(flush, 1); }; } var queue = new Array(1000); function flush() { for (var i = 0; i < len; i += 2) { var callback = queue[i]; var arg = queue[i + 1]; callback(arg); queue[i] = undefined; queue[i + 1] = undefined; } len = 0; } function attemptVertx() { try { var vertx = Function('return this')().require('vertx'); vertxNext = vertx.runOnLoop || vertx.runOnContext; return useVertxTimer(); } catch (e) { return useSetTimeout(); } } var scheduleFlush = void 0; // Decide what async method to use to triggering processing of queued callbacks: if (isNode) { scheduleFlush = useNextTick(); } else if (BrowserMutationObserver) { scheduleFlush = useMutationObserver(); } else if (isWorker) { scheduleFlush = useMessageChannel(); } else if (browserWindow === undefined && typeof require === 'function') { scheduleFlush = attemptVertx(); } else { scheduleFlush = useSetTimeout(); } function then(onFulfillment, onRejection) { var parent = this; var child = new this.constructor(noop); if (child[PROMISE_ID] === undefined) { makePromise(child); } var _state = parent._state; if (_state) { var callback = arguments[_state - 1]; asap(function () { return invokeCallback(_state, child, callback, parent._result); }); } else { subscribe(parent, child, onFulfillment, onRejection); } return child; } /** `Promise.resolve` returns a promise that will become resolved with the passed `value`. It is shorthand for the following: ```javascript let promise = new Promise(function(resolve, reject){ resolve(1); }); promise.then(function(value){ // value === 1 }); ``` Instead of writing the above, your code now simply becomes the following: ```javascript let promise = Promise.resolve(1); promise.then(function(value){ // value === 1 }); ``` @method resolve @static @param {Any} value value that the returned promise will be resolved with Useful for tooling. @return {Promise} a promise that will become fulfilled with the given `value` */ function resolve$1(object) { /*jshint validthis:true */ var Constructor = this; if (object && typeof object === 'object' && object.constructor === Constructor) { return object; } var promise = new Constructor(noop); resolve(promise, object); return promise; } var PROMISE_ID = Math.random().toString(36).substring(2); function noop() {} var PENDING = void 0; var FULFILLED = 1; var REJECTED = 2; var TRY_CATCH_ERROR = { error: null }; function selfFulfillment() { return new TypeError("You cannot resolve a promise with itself"); } function cannotReturnOwn() { return new TypeError('A promises callback cannot return that same promise.'); } function getThen(promise) { try { return promise.then; } catch (error) { TRY_CATCH_ERROR.error = error; return TRY_CATCH_ERROR; } } function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { try { then$$1.call(value, fulfillmentHandler, rejectionHandler); } catch (e) { return e; } } function handleForeignThenable(promise, thenable, then$$1) { asap(function (promise) { var sealed = false; var error = tryThen(then$$1, thenable, function (value) { if (sealed) { return; } sealed = true; if (thenable !== value) { resolve(promise, value); } else { fulfill(promise, value); } }, function (reason) { if (sealed) { return; } sealed = true; reject(promise, reason); }, 'Settle: ' + (promise._label || ' unknown promise')); if (!sealed && error) { sealed = true; reject(promise, error); } }, promise); } function handleOwnThenable(promise, thenable) { if (thenable._state === FULFILLED) { fulfill(promise, thenable._result); } else if (thenable._state === REJECTED) { reject(promise, thenable._result); } else { subscribe(thenable, undefined, function (value) { return resolve(promise, value); }, function (reason) { return reject(promise, reason); }); } } function handleMaybeThenable(promise, maybeThenable, then$$1) { if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { handleOwnThenable(promise, maybeThenable); } else { if (then$$1 === TRY_CATCH_ERROR) { reject(promise, TRY_CATCH_ERROR.error); TRY_CATCH_ERROR.error = null; } else if (then$$1 === undefined) { fulfill(promise, maybeThenable); } else if (isFunction(then$$1)) { handleForeignThenable(promise, maybeThenable, then$$1); } else { fulfill(promise, maybeThenable); } } } function resolve(promise, value) { if (promise === value) { reject(promise, selfFulfillment()); } else if (objectOrFunction(value)) { handleMaybeThenable(promise, value, getThen(value)); } else { fulfill(promise, value); } } function publishRejection(promise) { if (promise._onerror) { promise._onerror(promise._result); } publish(promise); } function fulfill(promise, value) { if (promise._state !== PENDING) { return; } promise._result = value; promise._state = FULFILLED; if (promise._subscribers.length !== 0) { asap(publish, promise); } } function reject(promise, reason) { if (promise._state !== PENDING) { return; } promise._state = REJECTED; promise._result = reason; asap(publishRejection, promise); } function subscribe(parent, child, onFulfillment, onRejection) { var _subscribers = parent._subscribers; var length = _subscribers.length; parent._onerror = null; _subscribers[length] = child; _subscribers[length + FULFILLED] = onFulfillment; _subscribers[length + REJECTED] = onRejection; if (length === 0 && parent._state) { asap(publish, parent); } } function publish(promise) { var subscribers = promise._subscribers; var settled = promise._state; if (subscribers.length === 0) { return; } var child = void 0, callback = void 0, detail = promise._result; for (var i = 0; i < subscribers.length; i += 3) { child = subscribers[i]; callback = subscribers[i + settled]; if (child) { invokeCallback(settled, child, callback, detail); } else { callback(detail); } } promise._subscribers.length = 0; } function tryCatch(callback, detail) { try { return callback(detail); } catch (e) { TRY_CATCH_ERROR.error = e; return TRY_CATCH_ERROR; } } function invokeCallback(settled, promise, callback, detail) { var hasCallback = isFunction(callback), value = void 0, error = void 0, succeeded = void 0, failed = void 0; if (hasCallback) { value = tryCatch(callback, detail); if (value === TRY_CATCH_ERROR) { failed = true; error = value.error; value.error = null; } else { succeeded = true; } if (promise === value) { reject(promise, cannotReturnOwn()); return; } } else { value = detail; succeeded = true; } if (promise._state !== PENDING) { // noop } else if (hasCallback && succeeded) { resolve(promise, value); } else if (failed) { reject(promise, error); } else if (settled === FULFILLED) { fulfill(promise, value); } else if (settled === REJECTED) { reject(promise, value); } } function initializePromise(promise, resolver) { try { resolver(function resolvePromise(value) { resolve(promise, value); }, function rejectPromise(reason) { reject(promise, reason); }); } catch (e) { reject(promise, e); } } var id = 0; function nextId() { return id++; } function makePromise(promise) { promise[PROMISE_ID] = id++; promise._state = undefined; promise._result = undefined; promise._subscribers = []; } function validationError() { return new Error('Array Methods must be provided an Array'); } var Enumerator = function () { function Enumerator(Constructor, input) { this._instanceConstructor = Constructor; this.promise = new Constructor(noop); if (!this.promise[PROMISE_ID]) { makePromise(this.promise); } if (isArray(input)) { this.length = input.length; this._remaining = input.length; this._result = new Array(this.length); if (this.length === 0) { fulfill(this.promise, this._result); } else { this.length = this.length || 0; this._enumerate(input); if (this._remaining === 0) { fulfill(this.promise, this._result); } } } else { reject(this.promise, validationError()); } } Enumerator.prototype._enumerate = function _enumerate(input) { for (var i = 0; this._state === PENDING && i < input.length; i++) { this._eachEntry(input[i], i); } }; Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { var c = this._instanceConstructor; var resolve$$1 = c.resolve; if (resolve$$1 === resolve$1) { var _then = getThen(entry); if (_then === then && entry._state !== PENDING) { this._settledAt(entry._state, i, entry._result); } else if (typeof _then !== 'function') { this._remaining--; this._result[i] = entry; } else if (c === Promise$1) { var promise = new c(noop); handleMaybeThenable(promise, entry, _then); this._willSettleAt(promise, i); } else { this._willSettleAt(new c(function (resolve$$1) { return resolve$$1(entry); }), i); } } else { this._willSettleAt(resolve$$1(entry), i); } }; Enumerator.prototype._settledAt = function _settledAt(state, i, value) { var promise = this.promise; if (promise._state === PENDING) { this._remaining--; if (state === REJECTED) { reject(promise, value); } else { this._result[i] = value; } } if (this._remaining === 0) { fulfill(promise, this._result); } }; Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { var enumerator = this; subscribe(promise, undefined, function (value) { return enumerator._settledAt(FULFILLED, i, value); }, function (reason) { return enumerator._settledAt(REJECTED, i, reason); }); }; return Enumerator; }(); /** `Promise.all` accepts an array of promises, and returns a new promise which is fulfilled with an array of fulfillment values for the passed promises, or rejected with the reason of the first passed promise to be rejected. It casts all elements of the passed iterable to promises as it runs this algorithm. Example: ```javascript let promise1 = resolve(1); let promise2 = resolve(2); let promise3 = resolve(3); let promises = [ promise1, promise2, promise3 ]; Promise.all(promises).then(function(array){ // The array here would be [ 1, 2, 3 ]; }); ``` If any of the `promises` given to `all` are rejected, the first promise that is rejected will be given as an argument to the returned promises's rejection handler. For example: Example: ```javascript let promise1 = resolve(1); let promise2 = reject(new Error("2")); let promise3 = reject(new Error("3")); let promises = [ promise1, promise2, promise3 ]; Promise.all(promises).then(function(array){ // Code here never runs because there are rejected promises! }, function(error) { // error.message === "2" }); ``` @method all @static @param {Array} entries array of promises @param {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} promise that is fulfilled when all `promises` have been fulfilled, or rejected if any of them become rejected. @static */ function all(entries) { return new Enumerator(this, entries).promise; } /** `Promise.race` returns a new promise which is settled in the same way as the first passed promise to settle. Example: ```javascript let promise1 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 1'); }, 200); }); let promise2 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 2'); }, 100); }); Promise.race([promise1, promise2]).then(function(result){ // result === 'promise 2' because it was resolved before promise1 // was resolved. }); ``` `Promise.race` is deterministic in that only the state of the first settled promise matters. For example, even if other promises given to the `promises` array argument are resolved, but the first settled promise has become rejected before the other promises became fulfilled, the returned promise will become rejected: ```javascript let promise1 = new Promise(function(resolve, reject){ setTimeout(function(){ resolve('promise 1'); }, 200); }); let promise2 = new Promise(function(resolve, reject){ setTimeout(function(){ reject(new Error('promise 2')); }, 100); }); Promise.race([promise1, promise2]).then(function(result){ // Code here never runs }, function(reason){ // reason.message === 'promise 2' because promise 2 became rejected before // promise 1 became fulfilled }); ``` An example real-world use case is implementing timeouts: ```javascript Promise.race([ajax('foo.json'), timeout(5000)]) ``` @method race @static @param {Array} promises array of promises to observe Useful for tooling. @return {Promise} a promise which settles in the same way as the first passed promise to settle. */ function race(entries) { /*jshint validthis:true */ var Constructor = this; if (!isArray(entries)) { return new Constructor(function (_, reject) { return reject(new TypeError('You must pass an array to race.')); }); } else { return new Constructor(function (resolve, reject) { var length = entries.length; for (var i = 0; i < length; i++) { Constructor.resolve(entries[i]).then(resolve, reject); } }); } } /** `Promise.reject` returns a promise rejected with the passed `reason`. It is shorthand for the following: ```javascript let promise = new Promise(function(resolve, reject){ reject(new Error('WHOOPS')); }); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` Instead of writing the above, your code now simply becomes the following: ```javascript let promise = Promise.reject(new Error('WHOOPS')); promise.then(function(value){ // Code here doesn't run because the promise is rejected! }, function(reason){ // reason.message === 'WHOOPS' }); ``` @method reject @static @param {Any} reason value that the returned promise will be rejected with. Useful for tooling. @return {Promise} a promise rejected with the given `reason`. */ function reject$1(reason) { /*jshint validthis:true */ var Constructor = this; var promise = new Constructor(noop); reject(promise, reason); return promise; } function needsResolver() { throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); } function needsNew() { throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); } /** Promise objects represent the eventual result of an asynchronous operation. The primary way of interacting with a promise is through its `then` method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. Terminology ----------- - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - `thenable` is an object or function that defines a `then` method. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - `exception` is a value that is thrown using the throw statement. - `reason` is a value that indicates why a promise was rejected. - `settled` the final resting state of a promise, fulfilled or rejected. A promise can be in one of three states: pending, fulfilled, or rejected. Promises that are fulfilled have a fulfillment value and are in the fulfilled state. Promises that are rejected have a rejection reason and are in the rejected state. A fulfillment value is never a thenable. Promises can also be said to *resolve* a value. If this value is also a promise, then the original promise's settled state will match the value's settled state. So a promise that *resolves* a promise that rejects will itself reject, and a promise that *resolves* a promise that fulfills will itself fulfill. Basic Usage: ------------ ```js let promise = new Promise(function(resolve, reject) { // on success resolve(value); // on failure reject(reason); }); promise.then(function(value) { // on fulfillment }, function(reason) { // on rejection }); ``` Advanced Usage: --------------- Promises shine when abstracting away asynchronous interactions such as `XMLHttpRequest`s. ```js function getJSON(url) { return new Promise(function(resolve, reject){ let xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.onreadystatechange = handler; xhr.responseType = 'json'; xhr.setRequestHeader('Accept', 'applicationhttps://www.microsoft.com/json'); xhr.send(); function handler() { if (this.readyState === this.DONE) { if (this.status === 200) { resolve(this.response); } else { reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); } } }; }); } getJSON('/posts.json').then(function(json) { // on fulfillment }, function(reason) { // on rejection }); ``` Unlike callbacks, promises are great composable primitives. ```js Promise.all([ getJSON('/posts'), getJSON('/comments') ]).then(function(values){ values[0] // => postsJSON values[1] // => commentsJSON return values; }); ``` @class Promise @param {Function} resolver Useful for tooling. @constructor */ var Promise$1 = function () { function Promise(resolver) { this[PROMISE_ID] = nextId(); this._result = this._state = undefined; this._subscribers = []; if (noop !== resolver) { typeof resolver !== 'function' && needsResolver(); this instanceof Promise ? initializePromise(this, resolver) : needsNew(); } } /** The primary way of interacting with a promise is through its `then` method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. ```js findUser().then(function(user){ // user is available }, function(reason){ // user is unavailable, and you are given the reason why }); ``` Chaining -------- The return value of `then` is itself a promise. This second, 'downstream' promise is resolved with the return value of the first promise's fulfillment or rejection handler, or rejected if the handler throws an exception. ```js findUser().then(function (user) { return user.name; }, function (reason) { return 'default name'; }).then(function (userName) { // If `findUser` fulfilled, `userName` will be the user's name, otherwise it // will be `'default name'` }); findUser().then(function (user) { throw new Error('Found user, but still unhappy'); }, function (reason) { throw new Error('`findUser` rejected and we're unhappy'); }).then(function (value) { // never reached }, function (reason) { // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. }); ``` If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. ```js findUser().then(function (user) { throw new PedagogicalException('Upstream error'); }).then(function (value) { // never reached }).then(function (value) { // never reached }, function (reason) { // The `PedgagocialException` is propagated all the way down to here }); ``` Assimilation ------------ Sometimes the value you want to propagate to a downstream promise can only be retrieved asynchronously. This can be achieved by returning a promise in the fulfillment or rejection handler. The downstream promise will then be pending until the returned promise is settled. This is called *assimilation*. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // The user's comments are now available }); ``` If the assimliated promise rejects, then the downstream promise will also reject. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // If `findCommentsByAuthor` fulfills, we'll have the value here }, function (reason) { // If `findCommentsByAuthor` rejects, we'll have the reason here }); ``` Simple Example -------------- Synchronous Example ```javascript let result; try { result = findResult(); // success } catch(reason) { // failure } ``` Errback Example ```js findResult(function(result, err){ if (err) { // failure } else { // success } }); ``` Promise Example; ```javascript findResult().then(function(result){ // success }, function(reason){ // failure }); ``` Advanced Example -------------- Synchronous Example ```javascript let author, books; try { author = findAuthor(); books = findBooksByAuthor(author); // success } catch(reason) { // failure } ``` Errback Example ```js function foundBooks(books) { } function failure(reason) { } findAuthor(function(author, err){ if (err) { failure(err); // failure } else { try { findBoooksByAuthor(author, function(books, err) { if (err) { failure(err); } else { try { foundBooks(books); } catch(reason) { failure(reason); } } }); } catch(error) { failure(err); } // success } }); ``` Promise Example; ```javascript findAuthor(). then(findBooksByAuthor). then(function(books){ // found books }).catch(function(reason){ // something went wrong }); ``` @method then @param {Function} onFulfilled @param {Function} onRejected Useful for tooling. @return {Promise} */ /** `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same as the catch block of a try/catch statement. ```js function findAuthor(){ throw new Error('couldn't find that author'); } // synchronous try { findAuthor(); } catch(reason) { // something went wrong } // async with promises findAuthor().catch(function(reason){ // something went wrong }); ``` @method catch @param {Function} onRejection Useful for tooling. @return {Promise} */ Promise.prototype.catch = function _catch(onRejection) { return this.then(null, onRejection); }; /** `finally` will be invoked regardless of the promise's fate just as native try/catch/finally behaves Synchronous example: ```js findAuthor() { if (Math.random() > 0.5) { throw new Error(); } return new Author(); } try { return findAuthor(); // succeed or fail } catch(error) { return findOtherAuther(); } finally { // always runs // doesn't affect the return value } ``` Asynchronous example: ```js findAuthor().catch(function(reason){ return findOtherAuther(); }).finally(function(){ // author was either found, or not }); ``` @method finally @param {Function} callback @return {Promise} */ Promise.prototype.finally = function _finally(callback) { var promise = this; var constructor = promise.constructor; if (isFunction(callback)) { return promise.then(function (value) { return constructor.resolve(callback()).then(function () { return value; }); }, function (reason) { return constructor.resolve(callback()).then(function () { throw reason; }); }); } return promise.then(callback, callback); }; return Promise; }(); Promise$1.prototype.then = then; Promise$1.all = all; Promise$1.race = race; Promise$1.resolve = resolve$1; Promise$1.reject = reject$1; Promise$1._setScheduler = setScheduler; Promise$1._setAsap = setAsap; Promise$1._asap = asap; /*global self*/ function polyfill() { var local = void 0; if (typeof global !== 'undefined') { local = global; } else if (typeof self !== 'undefined') { local = self; } else { try { local = Function('return this')(); } catch (e) { throw new Error('polyfill failed because global object is unavailable in this environment'); } } var P = local.Promise; if (P) { var promiseToString = null; try { promiseToString = Object.prototype.toString.call(P.resolve()); } catch (e) { // silently ignored } if (promiseToString === '[object Promise]' && !P.cast) { return; } } local.Promise = Promise$1; } // Strange compat.. Promise$1.polyfill = polyfill; Promise$1.Promise = Promise$1; return Promise$1; }))); }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"_process":10}],10:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],11:[function(require,module,exports){ "use strict"; /** * App_Common.ts * * Common logic for entrypoints. */ exports.__esModule = true; var UIStrings = require("./UIStrings/UIStrings"); var Version_1 = require("./Version"); var Configuration = require("./Configuration/Configuration"); var Window = require("./Window/Window"); var Logging = require("./Logging/Logging"); var Theme = require("./Theme"); var es6_promise_1 = require("es6-promise"); var APP_NAME = "OfficeFeedbackSDK"; /** * Has the SDK been initialized */ var initialized = false; /** * Load the style sheet * @param url The url of the stylesheet */ function loadStylesheet(url) { "use strict"; var link = document.createElement("link"); link.rel = "stylesheet"; link.type = "text/css"; link.href = url; var entry = document.getElementsByTagName("script")[0]; entry.parentNode.insertBefore(link, entry); } /** * Load the script and callback after it is loaded * @param url The url of the script * @param callback The callback */ function loadScript(url) { return new es6_promise_1.Promise(function (resolve, reject) { var script = document.createElement("script"); script.async = true; if (script.readyState) { // IE script.onreadystatechange = function () { if (script.readyState === "loaded" || script.readyState === "complete") { script.onreadystatechange = null; resolve(); } }; } else { // Others script.onload = function () { resolve(); }; } script.onerror = function () { reject(); }; script.src = url; // don't add if origin is not available or when containing "null". This is to mitigate possible // unexpected behavior with Chrome when a page hosting this SDK is being tested as a local file. // The behavior depends on Chrome.exe's --allow-file-access-from-files setting. var origin = window.origin; if (origin && origin !== "null") { script.crossOrigin = "anonymous"; } var entry = document.getElementsByTagName("script")[0]; entry.parentNode.insertBefore(script, entry); }); } /** * Initialize common modules * @param initOptions init options */ function initializeModules(initOptions) { Logging.initialize(initOptions.environment, APP_NAME, Version_1["default"], (initOptions.telemetryGroup) ? initOptions.telemetryGroup.audienceGroup : undefined, initOptions.appId.toString(), initOptions.sessionId, initOptions.build); Theme.initialize(initOptions.primaryColour, initOptions.secondaryColour); } /** * Set ui Strings. * @param data the ui strings */ function setUIStrings(data) { UIStrings.setUIStrings(data); } ; /** * Initialize */ function initialize() { return new es6_promise_1.Promise(function (resolve, reject) { if (!initialized) { if (!Window.get().OfficeBrowserFeedback.initOptions) { reject("Window.OfficeBrowserFeedback.initOptions not set"); return; } Window.get().OfficeBrowserFeedback.sdkVersion = Version_1["default"]; Configuration.get().setCommonInitOptions(Window.get().OfficeBrowserFeedback.initOptions); var initOptionsCommon_1 = Configuration.get().getCommonInitOptions(); loadStylesheet(initOptionsCommon_1.stylesUrl); var intlFileUrl_1 = initOptionsCommon_1.intlUrl + initOptionsCommon_1.locale.toLowerCase() + "/" + initOptionsCommon_1.intlFilename; loadScript(intlFileUrl_1) .then(function onLoadScriptFulfilled() { if (!UIStrings.getUIStrings()) { reject("UiStrings were not loaded from " + intlFileUrl_1); return; } initializeModules(initOptionsCommon_1); initialized = true; resolve(); })["catch"](function onLoadScriptRejected(err) { reject("Script load failed for " + intlFileUrl_1); }); } else { resolve(); } }); } exports.initialize = initialize; /** * Reset the module. Used in unit tests. */ function reset() { initialized = false; } exports.reset = reset; /* Make the setUIStrings method available globally */ Window.setSetUiStrings(setUIStrings); },{"./Configuration/Configuration":13,"./Logging/Logging":17,"./Theme":23,"./UIStrings/UIStrings":28,"./Version":48,"./Window/Window":50,"es6-promise":9}],12:[function(require,module,exports){ "use strict"; /** * App_inAppFeedback.ts * * The entry point for inAppFeedback. */ exports.__esModule = true; var App_Common = require("./App_Common"); var Configuration = require("./Configuration/Configuration"); var Logging = require("./Logging/Logging"); var UI = require("./UI/UI"); var Window = require("./Window/Window"); var es6_promise_1 = require("es6-promise"); /** * Has inAppFeedback been initialized */ var initialized = false; /** * Initialize * @returns A promise which will be rejected if the call fails. */ function initialize() { return new es6_promise_1.Promise(function (resolve, reject) { if (!initialized) { App_Common.initialize() .then(function onInitializeFulfilled() { if (!Window.get().OfficeBrowserFeedback.initOptions) { reject("Window.OfficeBrowserFeedback.initOptions not set"); return; } Configuration.get().setInAppFeedbackInitOptions(Window.get().OfficeBrowserFeedback.initOptions); initialized = true; resolve(); })["catch"](function onInitializeRejected(err) { reject("Initialization failed: {" + err + "}"); }); } else { resolve(); } }); } exports.initialize = initialize; /** * Has the control been opened. Prevents more than one dialog being generated. */ var opened = false; /** * Handler to launch the multi feedback dialog * @param launchOptions optional feedback properties * @returns A promise which will be rejected if the call fails. */ function multiFeedback(launchOptions) { return new es6_promise_1.Promise(function (resolve, reject) { if (opened) { reject("Control already open"); return; } initialize() .then(function onInitializeFulfilled() { Configuration.get().setInAppFeedbackLaunchOptions(launchOptions); UI.createBellyBandMulti(function () { opened = false; }); Logging.getLogger().logEvent(Logging.EventIds.InApp.UI.Picker.Shown.VALUE, { IsBugEnabled: Configuration.get().getInAppFeedbackInitOptions().bugForm, IsIdeaEnabled: Configuration.get().getInAppFeedbackInitOptions().userVoice !== undefined }); opened = true; resolve(); })["catch"](function onInitializeRejected(err) { reject("Initialization failed: {" + err + "}"); }); }); } exports.multiFeedback = multiFeedback; /** * Handler to launch the single feedback dialog * @param feedbackType the feedback type * @param launchOptions optional feedback properties * @returns A promise which will be rejected if the call fails. */ function singleFeedback(feedbackType, launchOptions) { return new es6_promise_1.Promise(function (resolve, reject) { if (opened) { reject("Control already open"); return; } var feedbackTypeEnum = Configuration.validateFeedbackType(feedbackType); initialize() .then(function onInitializeFulfilled() { Configuration.get().setInAppFeedbackLaunchOptions(launchOptions); UI.createBellyBandSingle(function () { opened = false; }, feedbackTypeEnum); Logging.getLogger().logEvent(Logging.EventIds.InApp.UI.Form.Shown.VALUE, { FeedbackType: feedbackTypeEnum }); opened = true; resolve(); })["catch"](function onInitializeRejected(err) { reject("Initialization failed: {" + err + "}"); }); }); } exports.singleFeedback = singleFeedback; /** * Reset the inappfeedback module. Used in unit tests. */ function reset() { App_Common.reset(); initialized = false; opened = false; } exports.reset = reset; /* Make the FeedbackDialog methods available globally */ Window.setMultiFeedback(multiFeedback); Window.setSingleFeedback(singleFeedback); },{"./App_Common":11,"./Configuration/Configuration":13,"./Logging/Logging":17,"./UI/UI":45,"./Window/Window":50,"es6-promise":9}],13:[function(require,module,exports){ "use strict"; /** * Configuration.ts * * Module for logic relating to the sdk user configuration */ exports.__esModule = true; var Utils = require("./../Utils"); var Constants = require("./../Constants"); var Localization = require("./../Localization"); /** * Class representing a configuration (user provided options) */ var Configuration = /** @class */ (function () { function Configuration() { } /** * Validate category options, default "show" to false if CategoryOptions is not provided. * @param categories Category options * @returns {ICategoryOptions} the validated CategoryOptions */ Configuration.validateCategoryOptions = function (categories) { if (!categories) { return { show: false }; } Utils.expectBoolean(categories.show, "categories.show"); if (categories.customCategories) { Utils.expectArray(categories.customCategories, "categories.customCategories"); for (var _i = 0, _a = categories.customCategories; _i < _a.length; _i++) { var customCategory = _a[_i]; Utils.expectString(customCategory, "custom category '" + customCategory + "'"); if (customCategory.length > 20) { throw "custom category '" + customCategory + "' too long, max 20 characters."; } } } return categories; }; Configuration.prototype.getCommonInitOptions = function () { return this.commonInitOptions; }; Configuration.prototype.getInAppFeedbackInitOptions = function () { return this.inAppFeedbackInitOptions; }; Configuration.prototype.getInAppFeedbackLaunchOptions = function () { return this.inAppFeedbackLaunchOptions; }; Configuration.prototype.getFloodgateInitOptions = function () { return this.floodgateInitOptions; }; Configuration.prototype.getFloodgateSurvey = function () { return this.floodgateSurvey; }; /** * Set initOptions for common functionality. */ Configuration.prototype.setCommonInitOptions = function (passedInitOptions) { Utils.expectObject(passedInitOptions, "passedInitOptions"); var initOptions = { appId: passedInitOptions.appId, applicationGroup: passedInitOptions.applicationGroup || {}, build: passedInitOptions.build, cid: passedInitOptions.cid, environment: passedInitOptions.environment, intlFilename: passedInitOptions.intlFilename, intlUrl: passedInitOptions.intlUrl, locale: passedInitOptions.locale, onError: passedInitOptions.onError, originalLocale: passedInitOptions.locale, primaryColour: passedInitOptions.primaryColour, secondaryColour: passedInitOptions.secondaryColour, sessionId: passedInitOptions.sessionId, stylesUrl: passedInitOptions.stylesUrl, telemetryGroup: passedInitOptions.telemetryGroup || {}, userEmail: passedInitOptions.userEmail, userEmailConsentDefault: passedInitOptions.userEmailConsentDefault, webGroup: passedInitOptions.webGroup || {} }; Utils.expectNumber(initOptions.appId, "initOptions.appId"); if (!(initOptions.appId % 1 === 0 && initOptions.appId > 0)) { throw "initOptions.appId is not a positive integer: " + initOptions.appId; } Utils.expectString(initOptions.stylesUrl, "initOptions.stylesUrl"); Utils.expectString(initOptions.intlUrl, "initOptions.intlUrl"); if (initOptions.intlFilename !== undefined) { Utils.expectString(initOptions.intlFilename, "initOptions.intlFilename"); } else { initOptions.intlFilename = "officebrowserfeedbackstrings.js"; } Utils.expectNumber(initOptions.environment, "initOptions.environment"); if (!(initOptions.environment === 1 || initOptions.environment === 0)) { throw "initOptions.environment has a bad value: " + initOptions.environment; } if (initOptions.userEmail !== undefined) { Utils.expectString(initOptions.userEmail, "initOptions.userEmail"); } if (initOptions.userEmailConsentDefault !== undefined) { Utils.expectBoolean(initOptions.userEmailConsentDefault, "initOptions.userEmailConsentDefault"); } if (initOptions.sessionId !== undefined) { Utils.expectString(initOptions.sessionId, "initOptions.sessionId"); } else { initOptions.sessionId = "00000000-0000-0000-0000-000000000000"; } // Copy sessionID over to telemetryGroup initOptions.telemetryGroup.processSessionId = initOptions.sessionId; if (initOptions.cid !== undefined) { Utils.expectString(initOptions.cid, "initOptions.cid"); // Copy cid over to extendedManifestData of applicationGroup initOptions.applicationGroup.extendedManifestData = JSON.stringify({ cid: initOptions.cid }); } if (initOptions.build !== undefined) { Utils.expectString(initOptions.build, "initOptions.build"); var buildRegex = "^[0-9]{1,9}(\\.[0-9]{1,9})?(\\.[0-9]{1,9})?(\\.[0-9]{1,9})?$"; if (!new RegExp(buildRegex).test(initOptions.build)) { initOptions.build = "0.0.0.0"; } } else { initOptions.build = "0.0.0.0"; } // Copy build over to telemetryGroup initOptions.telemetryGroup.officeBuild = initOptions.build; var hexColourRegex = new RegExp("^#[0-9a-f]{3}([0-9a-f]{3})?$", "i"); if (initOptions.primaryColour !== undefined) { if (!hexColourRegex.test(initOptions.primaryColour)) { initOptions.primaryColour = undefined; } } if (initOptions.secondaryColour !== undefined) { if (!hexColourRegex.test(initOptions.secondaryColour)) { initOptions.secondaryColour = undefined; } } if (initOptions.locale !== undefined) { Utils.expectString(initOptions.locale, "initOptions.locale"); initOptions.locale = Localization.validate(initOptions.locale); } else { initOptions.locale = "en"; } if (initOptions.onError === undefined) { initOptions.onError = function (err) { return; }; } this.commonInitOptions = initOptions; }; /** * Set init options for inAppFeedback */ Configuration.prototype.setInAppFeedbackInitOptions = function (passedInitOptions) { Utils.expectObject(passedInitOptions, "passedInitOptions"); var initOptions = { bugForm: passedInitOptions.bugForm, onDismiss: passedInitOptions.onDismiss, screenshot: passedInitOptions.screenshot, userEmail: passedInitOptions.userEmail, userVoice: passedInitOptions.userVoice !== undefined ? { url: passedInitOptions.userVoice.url } : undefined }; if (initOptions.onDismiss === undefined) { initOptions.onDismiss = function (submitted) { return; }; } if (initOptions.bugForm !== undefined) { Utils.expectBoolean(initOptions.bugForm, "initOptions.bugForm"); } else { initOptions.bugForm = false; } if (initOptions.userEmail !== undefined) { Utils.expectString(initOptions.userEmail, "initOptions.userEmail"); } if (initOptions.screenshot !== undefined) { Utils.expectBoolean(initOptions.screenshot, "initOptions.screenshot"); } else { initOptions.screenshot = true; } if (initOptions.userVoice !== undefined) { Utils.expectObject(initOptions.userVoice, "initOptions.userVoice"); Utils.expectString(initOptions.userVoice.url, "initOptions.userVoice.url"); } this.inAppFeedbackInitOptions = initOptions; }; /** * Set launch options for inAppFeedback */ Configuration.prototype.setInAppFeedbackLaunchOptions = function (launchOptions) { if (!this.commonInitOptions) { throw "commonInitOptions not set"; } if (!launchOptions) { launchOptions = {}; } // Override any setting done in LaunchOptions for the metadataGroups this.commonInitOptions.applicationGroup = Utils.overrideValues(launchOptions.applicationGroup, this.commonInitOptions.applicationGroup); this.commonInitOptions.telemetryGroup = Utils.overrideValues(launchOptions.telemetryGroup, this.commonInitOptions.telemetryGroup); this.commonInitOptions.webGroup = Utils.overrideValues(launchOptions.webGroup, this.commonInitOptions.webGroup); launchOptions.categories = Configuration.validateCategoryOptions(launchOptions.categories); this.inAppFeedbackLaunchOptions = launchOptions; }; /** * Set init options for floodgate */ Configuration.prototype.setFloodgateInitOptions = function (passedInitOptions) { Utils.expectObject(passedInitOptions, "passedInitOptions"); var initOptions = { autoDismiss: passedInitOptions.autoDismiss, campaignDefinitions: passedInitOptions.campaignDefinitions, onDismiss: passedInitOptions.onDismiss, onSurveyActivatedCallback: passedInitOptions.onSurveyActivatedCallback, settingStorageCallback: passedInitOptions.settingStorageCallback, uIStringGetter: passedInitOptions.uIStringGetter }; if (initOptions.autoDismiss === undefined) { initOptions.autoDismiss = Constants.AutoDismissValues.NoAutoDismiss; } if (initOptions.onDismiss === undefined) { initOptions.onDismiss = function (campaignId, submitted) { return; }; } if (initOptions.onSurveyActivatedCallback === undefined) { var defaultOnSurveyActivatedCallback = { onSurveyActivated: function (launcher) { launcher.launch(); } }; initOptions.onSurveyActivatedCallback = defaultOnSurveyActivatedCallback; } if (initOptions.uIStringGetter === undefined) { initOptions.uIStringGetter = function (str) { return str; }; // By default return the string as is. } this.floodgateInitOptions = initOptions; }; /** * Set the floodgate survey */ Configuration.prototype.setFloodgateSurvey = function (survey) { this.floodgateSurvey = survey; }; return Configuration; }()); exports.Configuration = Configuration; var configuration = new Configuration(); /** * Get the current configuration */ function get() { return configuration; } exports.get = get; /** * Validate feedbackType * @param feedbackType feedbackType * @returns {Constants.FeedbackType} the validated feedbackType */ function validateFeedbackType(feedbackType) { Utils.expectString(feedbackType, "feedbackType"); if (feedbackType === Constants.FeedbackType[Constants.FeedbackType.Smile]) { return Constants.FeedbackType.Smile; } else if (feedbackType === Constants.FeedbackType[Constants.FeedbackType.Frown]) { return Constants.FeedbackType.Frown; } else if (feedbackType === Constants.FeedbackType[Constants.FeedbackType.Bug]) { return Constants.FeedbackType.Bug; } else { throw "feedbackType should be one of Smile, Frown or Bug"; } } exports.validateFeedbackType = validateFeedbackType; },{"./../Constants":14,"./../Localization":15,"./../Utils":47}],14:[function(require,module,exports){ "use strict"; /** * Constants.ts * * A module for all the constants. */ exports.__esModule = true; /** * HTML attribute names */ var AttributeName = /** @class */ (function () { function AttributeName() { } AttributeName.AriaLabel = "aria-label"; AttributeName.Class = "class"; AttributeName.DataHtml2CanvasIgnore = "data-html2canvas-ignore"; AttributeName.Disabled = "disabled"; AttributeName.Fill = "fill"; AttributeName.For = "for"; AttributeName.Form = "form"; AttributeName.Height = "height"; AttributeName.HRef = "href"; AttributeName.Id = "id"; AttributeName.MaxLength = "maxlength"; AttributeName.Name = "name"; AttributeName.Placeholder = "placeholder"; AttributeName.Points = "points"; AttributeName.Rel = "rel"; AttributeName.Role = "role"; AttributeName.Source = "src"; AttributeName.Stroke = "stroke"; AttributeName.TabIndex = "tabindex"; AttributeName.Target = "target"; AttributeName.Transform = "transform"; AttributeName.Type = "type"; AttributeName.Value = "value"; AttributeName.ViewBox = "viewBox"; AttributeName.Width = "width"; AttributeName.xlinkHref = "xlink:href"; AttributeName.X = "x"; AttributeName.Y = "y"; return AttributeName; }()); exports.AttributeName = AttributeName; /** * HTML attribute values */ var AttributeValue = /** @class */ (function () { function AttributeValue() { } AttributeValue.BlankWindow = "_blank"; AttributeValue.Button = "button"; AttributeValue.Checkbox = "checkbox"; AttributeValue.Checked = "checked"; AttributeValue.False = "false"; AttributeValue.Zero = "0"; AttributeValue.Polite = "polite"; AttributeValue.Radio = "radio"; AttributeValue.Submit = "submit"; AttributeValue.Text = "text"; AttributeValue.TextAreaMaxLength = "1000"; AttributeValue.True = "true"; AttributeValue.Unchecked = "unchecked"; AttributeValue.NoReferrer = "noreferrer"; return AttributeValue; }()); exports.AttributeValue = AttributeValue; /** * URL Parameters */ var UrlParameters = /** @class */ (function () { function UrlParameters() { } UrlParameters.CLCID = "CLCID"; return UrlParameters; }()); exports.UrlParameters = UrlParameters; /** * CSS classes */ var Classes = /** @class */ (function () { function Classes() { } Classes.CheckBox = "obf-CheckBox"; Classes.FontSubtitle = "obf-FontSubtitle"; Classes.FontText = "obf-FontText"; Classes.FontSubText = "obf-FontSubText"; Classes.FontSubSubText = "obf-FontSubSubText"; Classes.Hidden = "obf-Hidden"; Classes.Link = "obf-Link"; Classes.MarginLeft60px = "obf-MarginLeft60px"; Classes.NarrowLayout = "obf-NarrowLayout"; Classes.PrivacyStatementLinkDiv = "obf-PrivacyStatementLinkDiv"; Classes.Rtl = "obf-Rtl"; Classes.Spinner = "obf-Spinner"; Classes.SpinnerCircle = "obf-SpinnerCircle"; Classes.SubmitButton = "obf-SubmitButton"; Classes.TextInput = "obf-TextInput"; Classes.Visible = "obf-Visible"; // rating control Classes.Rating = "obf-Rating"; Classes.RatingGraphic = "obf-RatingGraphic"; Classes.RatingGraphicFilled = "obf-RatingGraphic-Filled"; // choice group control Classes.ChoiceGroup = "obf-ChoiceGroup"; Classes.ChoiceGroupIcon = "obf-ChoiceGroupIcon"; // region BellyBand Classes.OverallAnchor = "obf-OverallAnchor"; Classes.OverallAnchorActive = "obf-OverallAnchorActive"; Classes.OverallImage = "obf-OverallImage"; Classes.OverallText = "obf-OverallText"; Classes.SingleLayout = "obf-SingleLayout"; Classes.ShowRightBorder = "obf-ShowRightBorder"; Classes.SlideLeft = "obf-slideLeft"; Classes.TextAlignLeft = "obf-TextAlignLeft"; Classes.FormContainer = "obf-FormContainer"; // form classes Classes.FormQuestionMiddleText = "obf-FormQuestionMiddleText"; Classes.FormMiddleText = "obf-FormMiddleText"; Classes.FormCategoriesDropdown = "obf-FormCategoriesDropdown"; Classes.FormComment = "obf-FormComment"; Classes.FormRatingContainer = "obf-FormRatingContainer"; Classes.FormRatingLabel = "obf-FormRatingLabel"; Classes.FormRating = "obf-FormRating"; Classes.FormEmailInput = "obf-FormEmailInput"; Classes.FormBottomContainer = "obf-FormBottomContainer"; Classes.FormSubmitButtonContainer = "obf-FormSubmitButtonContainer"; Classes.FormScreenshotContainer = "obf-FormScreenshotContainer"; Classes.FormScreenshotLabel = "obf-FormScreenshotLabel"; Classes.FormScreenshotCheckbox = "obf-FormScreenshotCheckbox"; // email textbox classes Classes.TFormEmailCheckbox = "obf-TFormEmailCheckbox"; Classes.TFormEmailLabel = "obf-TFormEmailLabel "; // email checkbox classes Classes.EmailCheckBoxLabel = "obf-EmailCheckBoxLabel"; // endregion // region Toast Classes.Toast = "obf-Toast"; return Classes; }()); exports.Classes = Classes; /** * HTML element ids */ var IDs = /** @class */ (function () { function IDs() { } // region BellyBand IDs.ColumnSeparatorDiv = "obf-ColumnSeparatorDiv"; IDs.OverallAnchorsContainer = "obf-OverallAnchorsContainer"; IDs.OverallFrownAnchor = "obf-OverallFrownAnchor"; IDs.OverallFrownDiv = "obf-OverallFrownDiv"; IDs.OverallFrownImage = "obf-OverallFrownImage"; IDs.OverallFrownText = "obf-OverallFrownText"; IDs.OverallSmileAnchor = "obf-OverallSmileAnchor"; IDs.OverallSmileDiv = "obf-OverallSmileDiv"; IDs.OverallSmileImage = "obf-OverallSmileImage"; IDs.OverallSmileText = "obf-OverallSmileText"; IDs.OverallIdeaAnchor = "obf-OverallIdeaAnchor"; IDs.OverallIdeaDiv = "obf-OverallIdeaDiv"; IDs.OverallIdeaImage = "obf-OverallIdeaImage"; IDs.OverallIdeaText = "obf-OverallIdeaText"; IDs.OverallBugAnchor = "obf-OverallBugAnchor"; IDs.OverallBugDiv = "obf-OverallBugDiv"; IDs.OverallBugImage = "obf-OverallBugImage"; IDs.OverallBugText = "obf-OverallBugText"; IDs.QuestionLeftText = "obf-QuestionLeftText"; IDs.LeftFormContainer = "obf-LeftFormContainer"; IDs.MainContainer = "obf-MainContainer"; IDs.MainContentHolder = "obf-MainContentHolder"; IDs.MiddleFormContainer = "obf-MiddleFormContainer"; IDs.OverlayBackground = "obf-OverlayBackground"; IDs.PrivacyStatementLink = "obf-PrivacyStatementLink"; IDs.FirstTabbable = "obf-FirstTabbable"; IDs.LastTabbable = "obf-LastTabbable"; // Single form ids IDs.SingleFormContainer = "obf-SingleFormContainer"; IDs.SingleFormQuestionMiddleText = "obf-SingleFormQuestionMiddleText"; IDs.SingleFormCategoriesDropdown = "obf-SingleFormCategoriesDropdown"; IDs.SingleFormComment = "obf-SingleFormComment"; IDs.SingleFormEmailInput = "obf-SingleFormEmailInput"; IDs.SingleFormRating = "obf-SingleFormRating"; IDs.SingleFormScreenshotCheckbox = "obf-SingleFormScreenshotCheckbox"; IDs.SingleFormSubmitButton = "obf-SingleFormSubmitButton"; IDs.SingleFormSubmitButtonSpinner = "obf-SingleFormSubmitButtonSpinner"; // Basic form ids IDs.BasicFormContainer = "obf-BasicFormContainer"; IDs.BasicFormQuestionMiddleText = "obf-BasicFormQuestionMiddleText"; IDs.BasicFormCategoriesDropdown = "obf-BasicFormCategoriesDropdown"; IDs.BasicFormComment = "obf-BasicFormComment"; IDs.BasicFormEmailInput = "obf-BasicFormEmailInput"; IDs.BasicFormRating = "obf-BasicFormRating"; IDs.BasicFormScreenshotCheckbox = "obf-BasicFormScreenshotCheckbox"; IDs.BasicFormSubmitButton = "obf-BasicFormSubmitButton"; IDs.BasicFormSubmitButtonSpinner = "obf-BasicFormSubmitButtonSpinner"; // UserVoice form ids IDs.UserVoiceFormContainer = "obf-UserVoiceFormContainer"; IDs.UserVoiceFormGoButton = "obf-UserVoiceFormGoButton"; // endregion // region Toast IDs.ToastContainer = "obf-ToastContainer"; IDs.ToastCancel = "obf-ToastCancel"; // Prompt ids IDs.TPromptContainer = "obf-TPromptContainer"; IDs.TPromptTitle = "obf-TPromptTitle"; IDs.TPromptText = "obf-TPromptText"; // Survey ids IDs.TFormContainer = "obf-TFormContainer"; IDs.TFormTitle = "obf-TFormTitle"; IDs.TFormRating = "obf-TFormRating"; IDs.TFormComment = "obf-TFormComment"; IDs.TFormEmailTextBox = "obf-TFormEmailTextBox"; IDs.TFormEmailCheckBox = "obf-TFormEmailCheckBox"; IDs.TFormEmailLabel = "obf-TFormEmailLabel"; IDs.TFormSubmitButton = "obf-TFormSubmitButton"; IDs.TFormSubmitButtonSpinner = "obf-TFormSubmitButtonSpinner"; IDs.TFormSubmitButtonContainer = "obf-TFormSubmitButtonContainer"; return IDs; }()); exports.IDs = IDs; /** * Keys */ var Keys = /** @class */ (function () { function Keys() { } Keys.Esc = 27; Keys.Tab = 9; return Keys; }()); exports.Keys = Keys; /** * Values for types of feedback that go into the json * Also used to determine the FormTemplate used on each one of the feedback types. */ var FeedbackType; (function (FeedbackType) { FeedbackType[FeedbackType["Smile"] = 0] = "Smile"; FeedbackType[FeedbackType["Frown"] = 1] = "Frown"; FeedbackType[FeedbackType["Idea"] = 2] = "Idea"; FeedbackType[FeedbackType["Bug"] = 3] = "Bug"; })(FeedbackType = exports.FeedbackType || (exports.FeedbackType = {})); /** * Values for the environment */ var Environment; (function (Environment) { Environment[Environment["Production"] = 0] = "Production"; Environment[Environment["Int"] = 1] = "Int"; })(Environment = exports.Environment || (exports.Environment = {})); /** * Values for autodismiss */ var AutoDismissValues; (function (AutoDismissValues) { AutoDismissValues[AutoDismissValues["NoAutoDismiss"] = 0] = "NoAutoDismiss"; AutoDismissValues[AutoDismissValues["SevenSeconds"] = 1] = "SevenSeconds"; AutoDismissValues[AutoDismissValues["FourteenSeconds"] = 2] = "FourteenSeconds"; AutoDismissValues[AutoDismissValues["TwentyOneSeconds"] = 3] = "TwentyOneSeconds"; AutoDismissValues[AutoDismissValues["TwentyEightSeconds"] = 4] = "TwentyEightSeconds"; })(AutoDismissValues = exports.AutoDismissValues || (exports.AutoDismissValues = {})); /** * HTML tags */ var Tags = /** @class */ (function () { function Tags() { } Tags.Anchor = "A"; Tags.Button = "button"; Tags.Defs = "defs"; Tags.Div = "div"; Tags.FieldSet = "fieldset"; Tags.Form = "form"; Tags.Img = "img"; Tags.Input = "input"; Tags.Label = "label"; Tags.Legend = "legend"; Tags.Option = "option"; Tags.Polygon = "polygon"; Tags.Select = "select"; Tags.Span = "span"; Tags.Svg = "svg"; Tags.TextArea = "textarea"; Tags.Use = "use"; return Tags; }()); exports.Tags = Tags; /** * URLs */ var Urls = /** @class */ (function () { function Urls() { } /** * Link to the feedback Privacy Statement */ Urls.PrivacyStatementLink = "http://go.microsoft.com/fwlink/?LinkID=390004"; return Urls; }()); exports.Urls = Urls; },{}],15:[function(require,module,exports){ "use strict"; /** * Localization.ts * * Module for Localization */ exports.__esModule = true; /** * List of supported Locales * REMINDER: update readme to match the list below if change is made */ var supportedLocales = [ "af", "am", "ar", "as", "az", "be", "bg", "bn-BD", "bn-IN", "bs", "ca", "ca-Es-VALENCIA", "chr-Cher", "cs", "cy", "da", "de", "el", "en-GB", "es", "es-MX", "et", "eu", "fa", "fi", "fil", "fr", "fr-CA", "ga", "gd", "gl", "gu", "ha-Latn-NG", "he", "hi", "hr", "hu", "hy", "id", "is", "it", "ja", "ka", "kk", "km-KH", "kn", "ko", "kok", "ky", "lb", "lo", "lt", "lv", "mi", "mk", "ml", "mn", "mr", "ms", "mt", "nb-NO", "ne", "nl", "nn-NO", "or", "pa", "pl", "prs", "pt-BR", "pt-PT", "quz", "ro", "ru", "sd", "si", "sk", "sl", "sq", "sr-Cyrl-BA", "sr-Cyrl-RS", "sr-Latn-RS", "sv", "sw", "ta", "te", "th", "tk", "tr", "tt", "ug", "uk", "ur", "uz-Latn-UZ", "vi", "zh-Hans", "zh-Hant", ]; var localeVariantToSupportedlocaleMap = { "ZH-CN": "zh-Hans", "ZH-HK": "zh-Hant", "ZH-MO": "zh-Hant", "ZH-SG": "zh-Hans", "ZH-TW": "zh-Hant" }; function validate(locale) { var localeUpperCase = locale.toLocaleUpperCase(); // support for Chinese ll-cc, VSO Bug 1583389 if (localeUpperCase in localeVariantToSupportedlocaleMap) { return localeVariantToSupportedlocaleMap[localeUpperCase]; } // return supported locale if exact match found for (var _i = 0, supportedLocales_1 = supportedLocales; _i < supportedLocales_1.length; _i++) { var supportedLocale = supportedLocales_1[_i]; if (supportedLocale.toUpperCase() === localeUpperCase) { return supportedLocale; } } var localePartOne = localeUpperCase.split("-")[0]; // return supported "ll" if exact match not found, but "ll" matches for (var _a = 0, supportedLocales_2 = supportedLocales; _a < supportedLocales_2.length; _a++) { var supportedLocale = supportedLocales_2[_a]; if (supportedLocale.toUpperCase() === localePartOne) { return supportedLocale; } } // default everything else to en return "en"; } exports.validate = validate; },{}],16:[function(require,module,exports){ "use strict"; /** * Constants.ts * * Module to hold logging-related constants */ exports.__esModule = true; var EventIds = /** @class */ (function () { function EventIds() { } var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9; EventIds.InApp = (_a = /** @class */ (function () { function class_1() { } return class_1; }()), _a.UI = (_b = /** @class */ (function () { function class_2() { } return class_2; }()), _b.Picker = (_c = /** @class */ (function () { function class_3() { } return class_3; }()), _c.Shown = (_d = /** @class */ (function () { function class_4() { } return class_4; }()), _d.VALUE = { name: "InApp_UI_Picker_Shown" }, _d), _c), _b.Form = (_e = /** @class */ (function () { function class_5() { } return class_5; }()), _e.Shown = (_f = /** @class */ (function () { function class_6() { } return class_6; }()), _f.VALUE = { name: "InApp_UI_Form_Shown" }, _f), _e.Submit = (_g = /** @class */ (function () { function class_7() { } return class_7; }()), _g.VALUE = { name: "InApp_UI_Form_Submit" }, _g), _e), _b), _a); EventIds.Survey = (_h = /** @class */ (function () { function class_8() { } return class_8; }()), _h.UI = (_j = /** @class */ (function () { function class_9() { } return class_9; }()), _j.Prompt = (_k = /** @class */ (function () { function class_10() { } return class_10; }()), _k.Shown = (_l = /** @class */ (function () { function class_11() { } return class_11; }()), _l.VALUE = { name: "Survey_UI_Prompt_Shown" }, _l), _k), _j.Form = (_m = /** @class */ (function () { function class_12() { } return class_12; }()), _m.Shown = (_o = /** @class */ (function () { function class_13() { } return class_13; }()), _o.VALUE = { name: "Survey_UI_Form_Shown" }, _o), _m.Submit = (_p = /** @class */ (function () { function class_14() { } return class_14; }()), _p.VALUE = { name: "Survey_UI_Form_Submit" }, _p), _m), _j), _h.Floodgate = (_q = /** @class */ (function () { function class_15() { } return class_15; }()), _q.TriggerMet = (_r = /** @class */ (function () { function class_16() { } return class_16; }()), _r.VALUE = { name: "Survey_Floodgate_TriggerMet" }, _r), _q.UserSelected = (_s = /** @class */ (function () { function class_17() { } return class_17; }()), _s.VALUE = { name: "Survey_Floodgate_UserSelected" }, _s), _q.CampaignLoad = (_t = /** @class */ (function () { function class_18() { } return class_18; }()), _t.Failed = (_u = /** @class */ (function () { function class_19() { } return class_19; }()), _u.VALUE = { name: "Survey_Floodgate_CampaignLoad_Failed" }, _u), _t), _q.FileWrite = (_v = /** @class */ (function () { function class_20() { } return class_20; }()), _v.Failed = (_w = /** @class */ (function () { function class_21() { } return class_21; }()), _w.VALUE = { name: "Survey_Floodgate_FileWrite_Failed" }, _w), _v), _q.FileRead = (_x = /** @class */ (function () { function class_22() { } return class_22; }()), _x.Failed = (_y = /** @class */ (function () { function class_23() { } return class_23; }()), _y.VALUE = { name: "Survey_Floodgate_FileRead_Failed" }, _y), _x), _q), _h); EventIds.Shared = (_z = /** @class */ (function () { function class_24() { } return class_24; }()), _z.Upload = (_0 = /** @class */ (function () { function class_25() { } return class_25; }()), _0.Failed = (_1 = /** @class */ (function () { function class_26() { } return class_26; }()), _1.VALUE = { name: "Shared_Upload_Failed" }, _1), _0), _z.Screenshot = (_2 = /** @class */ (function () { function class_27() { } return class_27; }()), _2.Render = (_3 = /** @class */ (function () { function class_28() { } return class_28; }()), _3.Failed = (_4 = /** @class */ (function () { function class_29() { } return class_29; }()), _4.VALUE = { name: "Shared_Screenshot_Render_Failed" }, _4), _3.Success = (_5 = /** @class */ (function () { function class_30() { } return class_30; }()), _5.VALUE = { name: "Shared_Screenshot_Render_Success" }, _5), _3), _2.GetContent = (_6 = /** @class */ (function () { function class_31() { } return class_31; }()), _6.Failed = (_7 = /** @class */ (function () { function class_32() { } return class_32; }()), _7.DefaultImage = (_8 = /** @class */ (function () { function class_33() { } return class_33; }()), _8.Returned = (_9 = /** @class */ (function () { function class_34() { } return class_34; }()), _9.VALUE = { name: "Shared_Screenshot_GetContent_Failed_DefaultImage_Returned" }, _9), _8), _7), _6), _2), _z); return EventIds; }()); exports.EventIds = EventIds; },{}],17:[function(require,module,exports){ "use strict"; exports.__esModule = true; var Constants_1 = require("./../Constants"); var Contracts_1 = require("./Telemetry/Contracts"); var Utils = require("./../Utils"); var TelemetryLoggerFactory_1 = require("./Telemetry/TelemetryLoggerFactory"); var Constants_2 = require("./Constants"); exports.EventIds = Constants_2.EventIds; var NAMESPACE = "Office_Feedback"; var logger; /** * Initialize the logging module * @param environment environment * @param appName app name * @param appVersion app version * @param audienceGroup audience group * @param hostId host id * @param hostSessionId host session Id * @param hostVersion host version */ function initialize(environment, appName, appVersion, audienceGroup, hostId, hostSessionId, hostVersion) { logger = new Logger(TelemetryLoggerFactory_1["default"].create(TokenManager.getTenantToken(environment), NAMESPACE, new Contracts_1.App(appName, appVersion), new Contracts_1.Session(Utils.guid()), new Contracts_1.Host(hostId, hostSessionId, hostVersion), new Contracts_1.Release(audienceGroup))); } exports.initialize = initialize; /** * Get the logger object */ function getLogger() { return logger; } exports.getLogger = getLogger; /** * Class representing a logger for the feedback SDK */ var Logger = /** @class */ (function () { function Logger(telemetryLogger) { if (!telemetryLogger) { throw new Error("telemetryLogger must not be null"); } this.telemetryLogger = telemetryLogger; } /** * Log an event * @param eventId event Id * @param customProperties custom properties to add to the log */ Logger.prototype.logEvent = function (eventId, customProperties) { if (!eventId) { throw new Error("eventId must not be null"); } customProperties = customProperties || {}; customProperties[Logger.EVENT_ID] = eventId.name; this.telemetryLogger.logEvent(Logger.EVENT_NAME, customProperties); }; Logger.EVENT_NAME = "SDK"; Logger.EVENT_ID = "EventId"; return Logger; }()); exports.Logger = Logger; var TokenManager = /** @class */ (function () { function TokenManager() { } TokenManager.getTenantToken = function (environment) { if (environment === Constants_1.Environment.Production) { return TokenManager.TENANT_TOKEN_PRODUCTION; } else { return TokenManager.TENANT_TOKEN_PRE_PRODUCTION; } }; TokenManager.TENANT_TOKEN_PRODUCTION = "d79e824386c4441cb8c1d4ae15690526-bd443309-5494-444a-aba9-0af9eef99f84-7360"; // "Office Feedback" Prod Aria tenant TokenManager.TENANT_TOKEN_PRE_PRODUCTION = "2bf6a2ffddca4a80a892a0b182132961-625cb102-8b0c-480e-af53-92e48695d08d-7736"; // "Office Feedback" Sandbox Aria tenant return TokenManager; }()); },{"./../Constants":14,"./../Utils":47,"./Constants":16,"./Telemetry/Contracts":20,"./Telemetry/TelemetryLoggerFactory":21}],18:[function(require,module,exports){ "use strict"; /** * Aria.ts * * Module for wrapper around Aria */ exports.__esModule = true; var aria = require("./../../thirdparty/aria-webjs-compact-sdk-1.2.2"); function AWT() { return aria.AWT; } exports.AWT = AWT; ; },{"./../../thirdparty/aria-webjs-compact-sdk-1.2.2":51}],19:[function(require,module,exports){ "use strict"; /** * An Aria-based logger */ exports.__esModule = true; var Aria = require("./Aria"); var Contracts_1 = require("./Contracts"); var AriaTelemetryLogger = /** @class */ (function () { function AriaTelemetryLogger(tenantToken, namespace, app, session, host, release) { if (!tenantToken) { throw new Error("tenantToken must not be null"); } if (!namespace) { throw new Error("namespace must not be null"); } if (!app) { throw new Error("app must not be null"); } if (!session) { throw new Error("session must not be null"); } Aria.AWT().initialize(tenantToken); this.namespace = namespace; this.oesApp = app; this.oesSession = session; this.oesHost = host; this.oesRelease = release; this.sequence = 1; // Sequence starts at 1 not 0 } AriaTelemetryLogger.setApp = function (properties, app) { properties["App.Name"] = app.getName(); properties["App.Platform"] = app.getPlatform(); properties["App.Version"] = app.getVersion(); }; AriaTelemetryLogger.setSession = function (properties, session) { properties["Session.Id"] = session.getId(); }; AriaTelemetryLogger.setHost = function (properties, host) { if (host) { properties["Host.Id"] = host.getId(); // To be GDPR compliant do not log Host.SessionId properties["Host.Version"] = host.getVersion(); } }; AriaTelemetryLogger.setEvent = function (properties, event) { properties["Event.Name"] = event.getName(); properties["Event.Id"] = event.getId(); properties["Event.Source"] = event.getSource(); properties["Event.SchemaVersion"] = event.getSchemaVersion(); properties["Event.Sequence"] = event.getSequence(); }; AriaTelemetryLogger.setRelease = function (properties, release) { if (release) { properties["Release.AudienceGroup"] = release.getAudienceGroup(); } }; AriaTelemetryLogger.prototype.logEvent = function (eventName, customProperties) { if (!eventName) { throw new Error("eventName must not be null"); } var oesEvent = new Contracts_1.Event(this.namespace + AriaTelemetryLogger.EVENT_NAME_DELIMITER + eventName, this.oesSession.getId(), this.sequence); var ariaProperties = {}; if (customProperties != null) { for (var key in customProperties) { if (customProperties.hasOwnProperty(key)) { ariaProperties[AriaTelemetryLogger.CUSTOM_PROPERTIES_FIELD_PREFIX + key] = customProperties[key]; } } } AriaTelemetryLogger.setApp(ariaProperties, this.oesApp); AriaTelemetryLogger.setSession(ariaProperties, this.oesSession); AriaTelemetryLogger.setHost(ariaProperties, this.oesHost); AriaTelemetryLogger.setRelease(ariaProperties, this.oesRelease); AriaTelemetryLogger.setEvent(ariaProperties, oesEvent); Aria.AWT().logEvent({ name: oesEvent.getName(), properties: ariaProperties }); this.sequence++; }; // Event.name is set as namespaceeventName AriaTelemetryLogger.EVENT_NAME_DELIMITER = "_"; AriaTelemetryLogger.CUSTOM_PROPERTIES_FIELD_PREFIX = "Data."; return AriaTelemetryLogger; }()); exports["default"] = AriaTelemetryLogger; },{"./Aria":18,"./Contracts":20}],20:[function(require,module,exports){ "use strict"; /** * Contracts enforced by OfficeEventSchema (OES) */ exports.__esModule = true; var App = /** @class */ (function () { function App(name, version) { if (!name) { throw new Error("name must not be null"); } if (!version) { throw new Error("version must not be null"); } this.name = name; this.version = version; } App.prototype.getName = function () { return this.name; }; App.prototype.getPlatform = function () { return App.PLATFORM; }; App.prototype.getVersion = function () { return this.version; }; App.PLATFORM = "Web"; return App; }()); exports.App = App; var Session = /** @class */ (function () { function Session(id) { if (!id) { throw new Error("id must not be null"); } this.id = id; } Session.prototype.getId = function () { return this.id; }; return Session; }()); exports.Session = Session; var Host = /** @class */ (function () { function Host(id, sessionId, version) { this.id = id; this.sessionId = sessionId; this.version = version; } Host.prototype.getId = function () { return this.id; }; Host.prototype.getSessionId = function () { return this.sessionId; }; Host.prototype.getVersion = function () { return this.version; }; return Host; }()); exports.Host = Host; var Event = /** @class */ (function () { function Event(name, sessionId, sequence) { if (!name) { throw new Error("name must not be null"); } if (!sessionId) { throw new Error("sessionId must not be null"); } if ((!sequence && sequence !== 0) || sequence < 0) { throw new Error("sequence must not be negative"); } this.name = name; this.id = sessionId + Event.ID_DELIMITER + sequence; this.sequence = sequence; } Event.prototype.getName = function () { return this.name; }; Event.prototype.getId = function () { return this.id; }; Event.prototype.getSource = function () { return Event.SOURCE; }; Event.prototype.getSchemaVersion = function () { return Event.SCHEMA_VERSION; }; Event.prototype.getSequence = function () { return this.sequence; }; // Id is set to sessionIdsequence Event.ID_DELIMITER = "."; Event.SOURCE = "MsoThin"; Event.SCHEMA_VERSION = 1; return Event; }()); exports.Event = Event; var Release = /** @class */ (function () { function Release(audienceGroup) { this.audienceGroup = audienceGroup; } Release.prototype.getAudienceGroup = function () { return this.audienceGroup; }; return Release; }()); exports.Release = Release; },{}],21:[function(require,module,exports){ "use strict"; /** * Factory to return ITelemetryLogger objects */ exports.__esModule = true; var AriaTelemetryLogger_1 = require("./AriaTelemetryLogger"); var TelemetryLoggerFactory = /** @class */ (function () { function TelemetryLoggerFactory() { } TelemetryLoggerFactory.create = function (tenantToken, namespace, app, session, host, release) { return new AriaTelemetryLogger_1["default"](tenantToken, namespace, app, session, host, release); }; return TelemetryLoggerFactory; }()); exports["default"] = TelemetryLoggerFactory; },{"./AriaTelemetryLogger":19}],22:[function(require,module,exports){ "use strict"; /** * Screenshot.ts * * A module for screenshot related logic. * Note: It uses the htnl2canvas package. The package could be used as is, it is not packaged correctly for browserify. * Using it without browserify would have polluted the global namespace by overriding "window.html2canvas". * Until these issues get fixed the code has been changed to pollute window.OfficeBrowserFeedback.html2canvas instead. */ exports.__esModule = true; var Window = require("./Window/Window"); /** * Create screenshot */ function createScreenShot() { var html2canvas = Window.get().OfficeBrowserFeedback.html2canvas(); return html2canvas(document.body, { background: "#ffffff" }); } exports.createScreenShot = createScreenShot; },{"./Window/Window":50}],23:[function(require,module,exports){ "use strict"; /** * Theme.ts * * Module for the UI Theme */ exports.__esModule = true; var Constants = require("./Constants"); var defaultPrimaryColour = "#0167B0"; var defaultSecondaryColour = "#194789"; /** * Init * @param {string} primaryColour Primary Colour * @param {string} secondaryColour Secondary Colour */ function initialize(primaryColour, secondaryColour) { if (primaryColour === void 0) { primaryColour = undefined; } if (secondaryColour === void 0) { secondaryColour = undefined; } if (!primaryColour) { primaryColour = defaultPrimaryColour; } if (!secondaryColour) { secondaryColour = defaultSecondaryColour; } var sheet = document.createElement("style"); sheet.textContent = "." + Constants.Classes.OverallAnchor + ":hover { background-color: " + secondaryColour + " } " + ("." + Constants.Classes.OverallAnchorActive + " { background-color: " + primaryColour + " } ") + ("." + Constants.Classes.SpinnerCircle + " { background-color: " + primaryColour + " } ") + ( // tslint:disable-next-line:max-line-length "." + Constants.Classes.ChoiceGroup + " input[type=radio]:checked+label>." + Constants.Classes.ChoiceGroupIcon + " { border-color: " + primaryColour + " } ") + ( // tslint:disable-next-line:max-line-length "." + Constants.Classes.ChoiceGroup + " input[type=radio]:hover+label>." + Constants.Classes.ChoiceGroupIcon + " { border-color: " + secondaryColour + " } ") + ( // tslint:disable-next-line:max-line-length "." + Constants.Classes.ChoiceGroup + " input[type=radio]:checked+label>." + Constants.Classes.ChoiceGroupIcon + ">span { background-color: " + primaryColour + " } ") + ("." + Constants.Classes.SubmitButton + " { background-color: " + primaryColour + " } ") + ("." + Constants.Classes.SubmitButton + ":hover { background-color: " + secondaryColour + " } ") + ("." + Constants.Classes.Link + " { color: " + primaryColour + " } ") + ("." + Constants.Classes.Link + ":hover { color: " + secondaryColour + " } ") + ("#" + Constants.IDs.TPromptTitle + " { color: " + primaryColour + " } ") + ("#" + Constants.IDs.TFormTitle + " { color: " + primaryColour + " } "); document.body.appendChild(sheet); } exports.initialize = initialize; },{"./Constants":14}],24:[function(require,module,exports){ "use strict"; /** * Manifest.ts * Module for managing the manifest file */ exports.__esModule = true; var Constants_1 = require("./../../Constants"); var Utils = require("./../../Utils"); var Manifest = /** @class */ (function () { function Manifest(manifestType, appId, submitTime, type, clientFeedbackId, applicationGroup, telemetryGroup, webGroup) { this.manifestData = { appId: appId, application: applicationGroup, clientFeedbackId: clientFeedbackId, manifestType: manifestType, source: "Client", submitTime: submitTime, telemetry: telemetryGroup, type: sanitizeType(type), web: webGroup }; } Manifest.prototype.setComment = function (comment) { this.manifestData.comment = comment; }; Manifest.prototype.setEmail = function (email) { this.manifestData.email = email; }; Manifest.prototype.setCategory = function (category) { this.manifestData.telemetry = this.manifestData.telemetry || {}; this.manifestData.telemetry.featureArea = category; }; /** * Set freeform custom values in manifest. Throws if values are already set. * @param values the values as a JS object */ Manifest.prototype.setValues = function (values) { if (values) { for (var field in values) { if (values.hasOwnProperty(field)) { if (this.manifestData.hasOwnProperty(field)) { this.manifestData[field] = Utils.overrideValues(values[field], this.manifestData[field]); } else { this.manifestData[field] = values[field]; } } } } }; Manifest.prototype.getContent = function () { return new Blob([JSON.stringify(this.manifestData)], { type: "applicationhttps://www.microsoft.com/json" }); }; return Manifest; }()); exports.Manifest = Manifest; function sanitizeType(type) { if (type === "Survey") { return type; } else { return Constants_1.FeedbackType[type]; } } },{"./../../Constants":14,"./../../Utils":47}],25:[function(require,module,exports){ "use strict"; /** * Screenshot.ts * Module for managing the screenshot file */ exports.__esModule = true; var Logging = require("./../../Logging/Logging"); var Screenshot = /** @class */ (function () { function Screenshot(screenshot) { this.screenshot = screenshot; } Screenshot.prototype.getContent = function () { var imgString; try { imgString = this.screenshot.toDataURL("image/jpeg").split(",")[1]; } catch (e) { Logging.getLogger().logEvent(Logging.EventIds.Shared.Screenshot.GetContent.Failed.DefaultImage.Returned.VALUE, { ErrorMessage: e.toString() }); // return an image with "Screenshot cannot be captured" message imgString = "iVBORw0KGgoAAAANSUhEUgAAAN0AAAA+AQMAAACV2ox1AAAABGdBTUEAALGPC/xhBQAAAAZQTFRFAAAA////pdmf3QAAAAlwSFlzAAAOwgAADsIBFShKgAAAAjtJREFUSMfV1M1rE0EUAHDBa5r8A9vkL6giFiI0JH+Ih9KLx8TaukkJugShHgrJzYvkVPQkUqgwSePLEELaU+zBg8JKVvSQQNydlsadwCQzziRZ82ETxYMfc3gD8+MxjzcfV8T80f0vkQ8i68tAPSMSQ0PkI6QDpEPkZBHy1Wp1/zjni2lrZq2T2uikDG17A54Hr0vsvwXIl3WXt02zeIHQBSq3DxHk7VO55zIFgLLrcmaaQBGiqCwQArBVQTbNZODNBB5Ee2EEr5eGiDG4k5mcqcy+Ksh+N8K2+bRI1Z68fRMVoV+XmcFwpQJZGohpkds1WtjppGLaq51a2b8yp310UW9/H8VfRj68CIKRsWCFPCCEM419S4bSAOmPmdb3TBrQ4lmnt9n4/Hiv5fTunsOzXbJfLR2rU3Fd5ugOe9mw0lvNOCNxyDdIHkpHCv0S3a+MS0yT+4wkAKx1gBJeVxeMRhSeNZpXJfY+zqAVl+g0mCFRJMgs6oy9+MCMrWZaJJwiWFjuWcIShf+Wk2W9e59OHu21WPdsswZNLKs9wV77mJiaMVbBQ+/1jGZDofFLuOBU/jzG6OQKnkLOZ5EvwolMX2Q19TAX9MWyy/aNarewfZptechdLn8B3TatB/YXB2j4MKw3jTHKX4AO0CbqaSddMokHUbr0PpSXmFG4O4WIu86asCVihfoM6nUmse5gGkbJOyThVesX4UI0d00LBYMr55VuIZl8MkY1uOiTy9v3c+ShuXj5+NdQdL8B+5gmw8WZuREAAAAASUVORK5CYII="; } var blobBin = atob(imgString); var array = []; for (var i = 0; i < blobBin.length; i++) { array.push(blobBin.charCodeAt(i)); } var file = new Blob([new Uint8Array(array)], { type: "image/jpeg" }); return file; }; return Screenshot; }()); exports.Screenshot = Screenshot; },{"./../../Logging/Logging":17}],26:[function(require,module,exports){ "use strict"; exports.__esModule = true; var es6_promise_1 = require("es6-promise"); var HTTP_TIMEOUT = 4000; // timeout in milliseconds /** * Make an http request with retries * @param method the http method "GET", "POST" etc * @param url the url * @param requestBody the request body * @param maxRetries the maximum number of retries * @param onLoad the onload handler */ function makeHttpRequest(method, url, requestBody, maxRetries, onLoad) { var makeRequest = function (retries) { return new es6_promise_1.Promise(function (resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open(method, url, true); xhr.timeout = HTTP_TIMEOUT; xhr.onload = function () { onLoad(xhr, resolve, reject); }; xhr.ontimeout = function () { if (retries > 0) { makeRequest(retries - 1).then(resolve, reject); } else { reject(new Error("Request to '" + url + "' timed out. timeout: " + HTTP_TIMEOUT)); } }; xhr.onerror = function () { if (retries > 0) { makeRequest(retries - 1).then(resolve, reject); } else { reject(new Error("Request to '" + url + "' errored. " + xhr.status + ": " + xhr.responseText)); } }; xhr.send(requestBody); }); }; return makeRequest(maxRetries); } var uploadEndpointInt = "https://petrol-int.office.microsoft.com/v1/feedback"; var uploadEndpointProd = "https://petrol.office.microsoft.com/v1/feedback"; /** * Send a payload to Petrol * @param isProduction is production? * @param manifest manifest content * @param screenshot screenshot content * @param diagnostics diagnostics content */ function send(isProduction, manifest, screenshot, diagnostics) { if (manifest === undefined) { return es6_promise_1.Promise.reject(new Error("Manifest cannot be undefined")); } var formData = new FormData(); formData.append("Manifest", manifest); if (screenshot) { formData.append("Screenshot", screenshot); } if (diagnostics) { formData.append("Diagnostics", diagnostics); } return makeHttpRequest("POST", isProduction ? uploadEndpointProd : uploadEndpointInt, formData, 2, function (xhr, resolve, reject) { if (xhr.status !== 200) { reject(new Error("Non-200 response with status code: " + xhr.status + ", response: " + xhr.responseText)); } resolve(); }); } exports.send = send; },{"es6-promise":9}],27:[function(require,module,exports){ "use strict"; /** * Feedback.ts * * Module for payload transport. */ exports.__esModule = true; var Constants = require("./../Constants"); var Utils = require("./../Utils"); var Logging = require("./../Logging/Logging"); var Petrol = require("./Petrol"); var Screenshot_1 = require("./Files/Screenshot"); var Configuration = require("../Configuration/Configuration"); var Manifest_1 = require("./Files/Manifest"); var Transporter = /** @class */ (function () { function Transporter(environment, manifestType, appId, type, applicationGroup, telemetryGroup, webGroup) { this.manifest = new Manifest_1.Manifest(manifestType, appId, new Date().toISOString(), type, Utils.guid(), applicationGroup, telemetryGroup, webGroup); this.environment = environment; } Transporter.prototype.setComment = function (comment) { this.manifest.setComment(comment); }; Transporter.prototype.setEmail = function (email) { this.manifest.setEmail(email); }; Transporter.prototype.setCategory = function (category) { this.manifest.setCategory(category); }; Transporter.prototype.setScreenshot = function (screenshot) { this.screenshot = new Screenshot_1.Screenshot(screenshot); }; /** * Set freeform custom values in manifest. Throws if values are already set. * @param values the values as a JS object */ Transporter.prototype.setManifestValues = function (values) { this.manifest.setValues(values); }; /** * Submit the payload */ Transporter.prototype.submit = function () { var manifestContent = this.manifest.getContent(); var screenshotContent = undefined; if (this.screenshot) { screenshotContent = this.screenshot.getContent(); } return Petrol.send(this.environment === Constants.Environment.Production, manifestContent, screenshotContent)["catch"](function onRejected(err) { Configuration.get().getCommonInitOptions().onError("Payload submission failed: " + err.message); Logging.getLogger().logEvent(Logging.EventIds.Shared.Upload.Failed.VALUE, { ErrorMessage: err.message }); }); }; return Transporter; }()); exports.Transporter = Transporter; },{"../Configuration/Configuration":13,"./../Constants":14,"./../Logging/Logging":17,"./../Utils":47,"./Files/Manifest":24,"./Files/Screenshot":25,"./Petrol":26}],28:[function(require,module,exports){ "use strict"; /** * UIStrings.ts * * Module for the strings to display */ exports.__esModule = true; /** * Localized UI strings */ var uIStrings; /** * Set UI strings * @param {string} data List of localized UI strings */ function setUIStrings(data) { uIStrings = data; } exports.setUIStrings = setUIStrings; /** * Get UI strings * @returns the UIStrings */ function getUIStrings() { return uIStrings; } exports.getUIStrings = getUIStrings; },{}],29:[function(require,module,exports){ "use strict"; /** * BellyBand.ts * * Module for the BellyBand UI */ exports.__esModule = true; var Constants_1 = require("./../../Constants"); var Events = require("./Events"); var Layout = require("./Layout"); var Renderer = require("./../Renderer"); var Utils = require("./../Utils"); var WindowProperties = require("./../../WindowProperties"); var BasicFormTemplate = require("./FormTemplates/BasicFormTemplate"); var UserVoiceFormTemplate = require("./FormTemplates/UserVoiceFormTemplate"); var Configuration = require("./../../Configuration/Configuration"); /** * UI initialization for multi, including creating all feedback related HTML elements and setting * initial visibility of elements */ function createMulti(onClose) { // Create the feedbackType -> IFormTemplate mapping var formTemplates = {}; formTemplates[Constants_1.FeedbackType.Smile] = BasicFormTemplate; formTemplates[Constants_1.FeedbackType.Frown] = BasicFormTemplate; // Show uservoice only if locale is en if (Configuration.get().getInAppFeedbackInitOptions().userVoice && Configuration.get().getCommonInitOptions().locale === "en") { formTemplates[Constants_1.FeedbackType.Idea] = UserVoiceFormTemplate; } else { formTemplates[Constants_1.FeedbackType.Idea] = BasicFormTemplate; } if (Configuration.get().getInAppFeedbackInitOptions().bugForm) { formTemplates[Constants_1.FeedbackType.Bug] = BasicFormTemplate; } create(Renderer.elementFromJson(Layout.generateMulti(formTemplates))); var useNarrowScreenLayout = WindowProperties.isNarrow(); Events.registerMulti(formTemplates, useNarrowScreenLayout, function (submitted) { Utils.setElementVisibility(Constants_1.IDs.OverlayBackground, false); Utils.deleteElementById(Constants_1.IDs.OverlayBackground); Configuration.get().getInAppFeedbackInitOptions().onDismiss(submitted); onClose(); }); // If the screen size is narrow, add the Narrow class to the outermost div so that // the CSS used corresponds to the small screen UI if (useNarrowScreenLayout) { Utils.addClassById(Constants_1.IDs.OverlayBackground, Constants_1.Classes.NarrowLayout); } } exports.createMulti = createMulti; /** * UI initialization for single, including creating all feedback related HTML elements and setting * initial visibility of elements * @return {void} */ function createSingle(onClose, feedbackType) { create(Renderer.elementFromJson(Layout.generateSingle())); Events.registerSingle(feedbackType, function (submitted) { Utils.setElementVisibility(Constants_1.IDs.OverlayBackground, false); Utils.deleteElementById(Constants_1.IDs.OverlayBackground); Configuration.get().getInAppFeedbackInitOptions().onDismiss(submitted); onClose(); }); Utils.addClassById(Constants_1.IDs.OverlayBackground, Constants_1.Classes.SingleLayout); } exports.createSingle = createSingle; /** * Attach the UI element to the DOM. * @param userInterface the UI element */ function create(userInterface) { document.body.insertBefore(userInterface, document.body.firstChild); Utils.setElementVisibility(Constants_1.IDs.OverlayBackground, true); if (Utils.getInternetExplorerVersion() > 9 || Utils.getInternetExplorerVersion() === -1) { // Show the main feedback UI after a certain time to wait for the CSS keyframes animation to finish if // the browser is IE10 and above or non-IE setTimeout(onMainContainerRender, 900); } else { onMainContainerRender(); } } /** * Code to run when the main container animation has completed. */ function onMainContainerRender() { // Show the MainContentHolder inside the MainContainer Utils.setElementVisibility(Constants_1.IDs.MainContentHolder, true); if (document.getElementById(Constants_1.IDs.OverallSmileAnchor)) { // Multi feedback document.getElementById(Constants_1.IDs.OverallSmileAnchor).focus(); } else if (document.getElementById(Constants_1.IDs.SingleFormComment)) { // Single feedback document.getElementById(Constants_1.IDs.SingleFormComment).focus(); } } /** * UI dismiss. Delete all feedback related HTML elements * @return {void} */ function dismiss() { return; } exports.dismiss = dismiss; },{"./../../Configuration/Configuration":13,"./../../Constants":14,"./../../WindowProperties":49,"./../Renderer":40,"./../Utils":46,"./Events":30,"./FormTemplates/BasicFormTemplate":31,"./FormTemplates/UserVoiceFormTemplate":34,"./Layout":35}],30:[function(require,module,exports){ "use strict"; /** * Events.ts * * A module for all Event handling. */ exports.__esModule = true; var Transport_1 = require("./../../Transport/Transport"); var Configuration = require("./../../Configuration/Configuration"); var Constants_1 = require("./../../Constants"); var Logging = require("./../../Logging/Logging"); var Screenshot = require("./../../Screenshot"); var SpinnerControl_1 = require("./../SpinnerControl"); var UiUtils = require("./../Utils"); var TabFocus = require("./TabFocus"); /** * Whether to use narrow layout */ var useNarrowLayout = false; /** * Callback for when the feedback dialog is dismissed */ var onDismiss; /** * The Selected feedback type, undefined if none selected */ var selectedFeedbackType = undefined; /** * feedbackType -> IFormTemplate mapping for multi BellyBand */ var formTemplates; /** * Dismiss all, including networking, UI, and events * @param submitted Was the control submitted (true), or cancelled (false)? */ function dismissAll(submitted) { unregister(); onDismiss(submitted); } /** * List of listeners and the ids they are attached to. This ensures all events are correctly unregistered. */ var listenersList = []; function addListener(id, event, listener) { UiUtils.registerListener(id, event, listener); listenersList.push({ event: event, id: id, listener: listener }); } function removeListeners() { for (var _i = 0, listenersList_1 = listenersList; _i < listenersList_1.length; _i++) { var listener = listenersList_1[_i]; UiUtils.unregisterListener(listener.id, listener.event, listener.listener); } listenersList = []; } /** * Register events for single belly band */ function registerSingle(feedbackType, ON_DISMISS) { if (ON_DISMISS === void 0) { ON_DISMISS = function (submitted) { return; }; } selectedFeedbackType = feedbackType; // SingleFormTemplate events addListener(Constants_1.IDs.SingleFormSubmitButton, "click", submitButtonHandlerFactory(Constants_1.IDs.SingleFormSubmitButton, Constants_1.IDs.SingleFormSubmitButtonSpinner, Constants_1.IDs.SingleFormComment, Constants_1.IDs.SingleFormEmailInput, Constants_1.IDs.SingleFormScreenshotCheckbox, Constants_1.IDs.SingleFormCategoriesDropdown)); registerCommon(ON_DISMISS); } exports.registerSingle = registerSingle; /** * Register events for multi belly band */ function registerMulti(FORMTEMPLATES, USE_NARROW_LAYOUT, ON_DISMISS) { if (ON_DISMISS === void 0) { ON_DISMISS = function (submitted) { return; }; } useNarrowLayout = USE_NARROW_LAYOUT; formTemplates = FORMTEMPLATES; addListener(Constants_1.IDs.OverallSmileAnchor, "click", overallSmileHandler); addListener(Constants_1.IDs.OverallFrownAnchor, "click", overallFrownHandler); addListener(Constants_1.IDs.OverallIdeaAnchor, "click", overallIdeaHandler); addListener(Constants_1.IDs.OverallBugAnchor, "click", overallBugHandler); // BasicFormTemplate events addListener(Constants_1.IDs.BasicFormSubmitButton, "click", submitButtonHandlerFactory(Constants_1.IDs.BasicFormSubmitButton, Constants_1.IDs.BasicFormSubmitButtonSpinner, Constants_1.IDs.BasicFormComment, Constants_1.IDs.BasicFormEmailInput, Constants_1.IDs.BasicFormScreenshotCheckbox, Constants_1.IDs.BasicFormCategoriesDropdown)); // UserVoiceFormTemplate events addListener(Constants_1.IDs.UserVoiceFormGoButton, "click", UserVoiceFormGoButtonHandler); registerCommon(ON_DISMISS); } exports.registerMulti = registerMulti; function registerCommon(ON_DISMISS) { onDismiss = ON_DISMISS; UiUtils.addEventListenerHelper(window, "keyup", keyEventHandler); addListener(Constants_1.IDs.OverlayBackground, "click", overlayBackgroundHandler); addListener(Constants_1.IDs.MainContainer, "click", mainContainerHandler); addListener(Constants_1.IDs.MainContainer, "keyup", tabKeyEventHandler); addListener(Constants_1.IDs.PrivacyStatementLink, "click", privacyStatementLinkHandler); } /** * Listener un-registration */ function unregister() { UiUtils.removeEventListenerHelper(window, "keyup", keyEventHandler); removeListeners(); } /** * Tab key event handler * @param event The Event object */ function tabKeyEventHandler(event) { var keyCode = event.keyCode || event.which; if (keyCode === Constants_1.Keys.Tab) { if ((document.activeElement.id === Constants_1.IDs.FirstTabbable && event.shiftKey) || (document.activeElement.id === Constants_1.IDs.LastTabbable && !event.shiftKey)) { event.stopPropagation(); TabFocus.cycleTabFocus(document.activeElement); } } } /** * Key event handler * @param event The Event object */ function keyEventHandler(event) { // dismiss feedback upon pressing the escape key if (event.keyCode === Constants_1.Keys.Esc) { event.preventDefault(); event.stopPropagation(); dismissAll(false /*submitted*/); } } /** * Overlay background event handler. Dismiss feedback upon clicking on the background area * @param event The Event object */ function overlayBackgroundHandler(event) { event.preventDefault(); event.stopPropagation(); dismissAll(false /*submitted*/); } /** * Main container event handler. When clicking on main container area, do not propagate the event to lower level. * @param event The Event object */ function mainContainerHandler(event) { event.stopPropagation(); } /** * Privacy statement link handler. When clicking on the privacy statement link, * do not propagate the event to lower level. * @param event The Event object */ function privacyStatementLinkHandler(event) { event.stopPropagation(); } /** * Overall button click handler * @param event The Event object * @param achorId The id of the anchor html element which was selected */ function overallHandler(event, anchorId) { event.preventDefault(); event.stopPropagation(); UiUtils.replaceClassesById(Constants_1.IDs.OverallSmileAnchor, Constants_1.Classes.OverallAnchorActive); UiUtils.replaceClassesById(Constants_1.IDs.OverallFrownAnchor, Constants_1.Classes.OverallAnchorActive); UiUtils.replaceClassesById(Constants_1.IDs.OverallIdeaAnchor, Constants_1.Classes.OverallAnchorActive); UiUtils.replaceClassesById(Constants_1.IDs.OverallBugAnchor, Constants_1.Classes.OverallAnchorActive); UiUtils.addClassById(anchorId, Constants_1.Classes.OverallAnchorActive); Logging.getLogger().logEvent(Logging.EventIds.InApp.UI.Form.Shown.VALUE, { FeedbackType: selectedFeedbackType }); var formTemplate = formTemplates[selectedFeedbackType]; mainContentHolderSlideLeft(formTemplate.containerId); formTemplate.onSelect(selectedFeedbackType); } /** * Smile button event handler * @param event The Event object */ function overallSmileHandler(event) { selectedFeedbackType = Constants_1.FeedbackType.Smile; overallHandler(event, Constants_1.IDs.OverallSmileAnchor); } /** * Frown button event handler * @param event The Event object */ function overallFrownHandler(event) { selectedFeedbackType = Constants_1.FeedbackType.Frown; overallHandler(event, Constants_1.IDs.OverallFrownAnchor); } /** * Idea button event handler * @param event The Event object */ function overallIdeaHandler(event) { selectedFeedbackType = Constants_1.FeedbackType.Idea; overallHandler(event, Constants_1.IDs.OverallIdeaAnchor); } /** * Bug button event handler * @param event The Event object */ function overallBugHandler(event) { selectedFeedbackType = Constants_1.FeedbackType.Bug; overallHandler(event, Constants_1.IDs.OverallBugAnchor); } /** * Main content holder slide left animation * @param {string} containerId The id of the container to be made visible * @return {void} */ function mainContentHolderSlideLeft(containerId) { for (var feedbackType in formTemplates) { if (formTemplates.hasOwnProperty(feedbackType)) { UiUtils.setElementVisibility(formTemplates[feedbackType].containerId, false); } } if (useNarrowLayout) { UiUtils.setElementVisibility(Constants_1.IDs.LeftFormContainer, false); UiUtils.setElementVisibility(Constants_1.IDs.MiddleFormContainer, true); UiUtils.setElementVisibility(containerId, true); } else { UiUtils.addClassById(Constants_1.IDs.ColumnSeparatorDiv, Constants_1.Classes.ShowRightBorder); UiUtils.setElementVisibility(Constants_1.IDs.MiddleFormContainer, true); UiUtils.setElementVisibility(containerId, true); UiUtils.addClassById(Constants_1.IDs.LeftFormContainer, Constants_1.Classes.SlideLeft); UiUtils.addClassById(Constants_1.IDs.MiddleFormContainer, Constants_1.Classes.SlideLeft); } } /** * Submit button event handler factory * @param event The Event object */ function submitButtonHandlerFactory(submitButtonId, spinnerId, commentInputId, emailInputId, screenshotCheckboxId, categoriesDropdownId) { return function (event) { event.preventDefault(); event.stopPropagation(); UiUtils.setElementVisibility(submitButtonId, false); var spinner = new SpinnerControl_1.Spinner(spinnerId); var transporter = new Transport_1.Transporter(Configuration.get().getCommonInitOptions().environment, "Sas", Configuration.get().getCommonInitOptions().appId, selectedFeedbackType, Configuration.get().getCommonInitOptions().applicationGroup, Configuration.get().getCommonInitOptions().telemetryGroup, Configuration.get().getCommonInitOptions().webGroup); var commentElement = document.getElementById(commentInputId); var commentEntered = (commentElement && !!commentElement.value); if (commentEntered) { transporter.setComment(commentElement.value); } var emailElement = document.getElementById(emailInputId); var isEmailIncluded = (emailElement && !!emailElement.value); if (isEmailIncluded) { transporter.setEmail(emailElement.value); } var screenshotCheckBox = document.getElementById(screenshotCheckboxId); var screenshotCheckBoxSelected = screenshotCheckBox && screenshotCheckBox.checked; var categoryElement = document.getElementById(categoriesDropdownId); var isCategorySelected = (categoryElement && categoryElement.selectedIndex > 0); if (isCategorySelected) { transporter.setCategory(categoryElement.value); } Logging.getLogger().logEvent(Logging.EventIds.InApp.UI.Form.Submit.VALUE, { FeedbackType: selectedFeedbackType, IsEmailIncluded: isEmailIncluded, IsScreenshotIncluded: screenshotCheckBoxSelected }); if (screenshotCheckBoxSelected) { var startTime_1 = performance.now(); Screenshot.createScreenShot().then(function (canvas) { var endTime = performance.now(); Logging.getLogger().logEvent(Logging.EventIds.Shared.Screenshot.Render.Success.VALUE, { TimeMilliseconds: endTime - startTime_1 }); transporter.setScreenshot(canvas); transporter.submit(); })["catch"](function (error) { var endTime = performance.now(); Logging.getLogger().logEvent(Logging.EventIds.Shared.Screenshot.Render.Failed.VALUE, { ErrorMessage: error, TimeMilliseconds: endTime - startTime_1 }); transporter.submit(); }); } else { transporter.submit(); } spinner.destroy(); dismissAll(true /*submitted*/); }; } /** * UserVoiceForm Go button event handler * Opens UserVoice forum in a new window * @param event The Event object */ function UserVoiceFormGoButtonHandler(event) { event.preventDefault(); event.stopPropagation(); window.open(document.getElementById(Constants_1.IDs.UserVoiceFormGoButton).getAttribute(Constants_1.AttributeName.Source)); dismissAll(false /* submitted */); } },{"./../../Configuration/Configuration":13,"./../../Constants":14,"./../../Logging/Logging":17,"./../../Screenshot":22,"./../../Transport/Transport":27,"./../SpinnerControl":41,"./../Utils":46,"./TabFocus":36}],31:[function(require,module,exports){ "use strict"; /** * BasicFormTemplate.ts * * A form template with contact info fields. */ exports.__esModule = true; var UIStrings = require("./../../../UIStrings/UIStrings"); var FormTemplateType_1 = require("./FormTemplateType"); var CategoriesDropdown = require("./../../CategoriesDropdown"); var RatingControl = require("./../../RatingControl"); var Constants = require("./../../../Constants"); var Configuration = require("./../../../Configuration/Configuration"); /** * Generate the markup * @returns the markup as json */ function generate() { var categories = Configuration.get().getInAppFeedbackLaunchOptions().categories; var formSchema = { children: [ { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.BasicFormComment }], classes: [ Constants.Classes.FontSubtitle, Constants.Classes.TextAlignLeft, Constants.Classes.FormQuestionMiddleText, ], id: Constants.IDs.BasicFormQuestionMiddleText, tag: Constants.Tags.Label }, { attributes: [{ name: Constants.AttributeName.Id, value: Constants.IDs.BasicFormCategoriesDropdown }], brs: categories.show, children: CategoriesDropdown.generate(categories ? categories.customCategories : null), classes: [Constants.Classes.FontSubText, Constants.Classes.FormCategoriesDropdown, Constants.Classes.TextInput], tag: Constants.Tags.Select }, { attributes: [ { name: Constants.AttributeName.Placeholder, value: UIStrings.getUIStrings().Form.CommentPlaceholder }, { name: Constants.AttributeName.MaxLength, value: Constants.AttributeValue.TextAreaMaxLength }, ], classes: [Constants.Classes.FontSubText, Constants.Classes.FormComment, Constants.Classes.TextInput], id: Constants.IDs.BasicFormComment, tag: Constants.Tags.TextArea }, { brs: false, children: [ { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.BasicFormRating }], classes: [Constants.Classes.FontText, Constants.Classes.TextAlignLeft, Constants.Classes.FormRatingLabel], innerText: UIStrings.getUIStrings().Form.RatingLabel, tag: Constants.Tags.Label }, RatingControl.generate(Constants.IDs.BasicFormRating), ], classes: [Constants.Classes.FormRatingContainer] }, { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Text }, { name: Constants.AttributeName.Placeholder, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.AriaLabel, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.Name, value: Constants.IDs.BasicFormEmailInput }, { name: Constants.AttributeName.MaxLength, value: Constants.AttributeValue.TextAreaMaxLength }, { name: Constants.AttributeName.Value, value: Configuration.get().getInAppFeedbackInitOptions().userEmail ? Configuration.get().getInAppFeedbackInitOptions().userEmail : "" }, ], classes: [Constants.Classes.FontSubText, Constants.Classes.FormEmailInput, Constants.Classes.TextInput], id: Constants.IDs.BasicFormEmailInput, tag: Constants.Tags.Input }, { children: [ { children: [ { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Checkbox }, { name: Constants.AttributeName.Value, value: Constants.AttributeValue.Unchecked }, ], brs: Configuration.get().getInAppFeedbackInitOptions().screenshot, classes: [Constants.Classes.FormScreenshotCheckbox, Constants.Classes.CheckBox], id: Constants.IDs.BasicFormScreenshotCheckbox, tag: Constants.Tags.Input }, { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.BasicFormScreenshotCheckbox }], brs: Configuration.get().getInAppFeedbackInitOptions().screenshot, classes: [Constants.Classes.FontText, Constants.Classes.TextAlignLeft, Constants.Classes.FormScreenshotLabel], innerText: UIStrings.getUIStrings().Form.ScreenshotLabel, tag: Constants.Tags.Label }, ], classes: [Constants.Classes.FormScreenshotContainer] }, { children: [ { classes: [ Constants.Classes.FontSubText, Constants.Classes.SubmitButton, ], id: Constants.IDs.BasicFormSubmitButton, innerText: UIStrings.getUIStrings().Form.Submit, tag: Constants.Tags.Button }, { classes: [Constants.Classes.Spinner, Constants.Classes.Hidden], id: Constants.IDs.BasicFormSubmitButtonSpinner, tag: Constants.Tags.Div }, ], classes: [Constants.Classes.FormSubmitButtonContainer] }, ], classes: [Constants.Classes.FormBottomContainer] }, ], classes: [Constants.Classes.Hidden, Constants.Classes.MarginLeft60px], id: exports.containerId }; return formSchema; } exports.generate = generate; /** * The id for the container. This is the id of the top-most element and should * be unique to each form */ exports.containerId = Constants.IDs.BasicFormContainer; /** * Forms may be used for different feedback types. This method executes form * specific logic when the feedback type is selected * @param feedbackType feedback type */ function onSelect(feedbackType) { switch (feedbackType) { case Constants.FeedbackType.Smile: { document.getElementById(Constants.IDs.BasicFormQuestionMiddleText).textContent = UIStrings.getUIStrings().SmileForm.Title; break; } case Constants.FeedbackType.Frown: { document.getElementById(Constants.IDs.BasicFormQuestionMiddleText).textContent = UIStrings.getUIStrings().FrownForm.Title; break; } case Constants.FeedbackType.Idea: { document.getElementById(Constants.IDs.BasicFormQuestionMiddleText).textContent = UIStrings.getUIStrings().IdeaForm.Title; break; } case Constants.FeedbackType.Bug: { document.getElementById(Constants.IDs.BasicFormQuestionMiddleText).textContent = UIStrings.getUIStrings().BugForm.Title; break; } default: { break; } } document.getElementById(Constants.IDs.BasicFormComment).focus(); } exports.onSelect = onSelect; /** * Form template type */ exports.type = FormTemplateType_1.FormTemplateType.Basic; },{"./../../../Configuration/Configuration":13,"./../../../Constants":14,"./../../../UIStrings/UIStrings":28,"./../../CategoriesDropdown":37,"./../../RatingControl":39,"./FormTemplateType":32}],32:[function(require,module,exports){ "use strict"; /** * FormTemplateType.ts * * An enum for the types of forms available. */ exports.__esModule = true; var FormTemplateType; (function (FormTemplateType) { FormTemplateType[FormTemplateType["Single"] = 0] = "Single"; FormTemplateType[FormTemplateType["Basic"] = 1] = "Basic"; FormTemplateType[FormTemplateType["UserVoice"] = 2] = "UserVoice"; })(FormTemplateType = exports.FormTemplateType || (exports.FormTemplateType = {})); },{}],33:[function(require,module,exports){ "use strict"; /** * SingleFormTemplate.ts * * A form template with contact info fields. */ exports.__esModule = true; var UIStrings = require("./../../../UIStrings/UIStrings"); var FormTemplateType_1 = require("./FormTemplateType"); var CategoriesDropdown = require("./../../CategoriesDropdown"); var RatingControl = require("./../../RatingControl"); var Configuration = require("./../../../Configuration/Configuration"); var Constants = require("./../../../Constants"); /** * Generate the markup * @returns the markup as json */ function generate() { var categories = Configuration.get().getInAppFeedbackLaunchOptions().categories; var formSchema = { children: [ { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.SingleFormComment }], classes: [ Constants.Classes.FontSubtitle, Constants.Classes.TextAlignLeft, Constants.Classes.FormQuestionMiddleText, ], id: Constants.IDs.SingleFormQuestionMiddleText, innerText: UIStrings.getUIStrings().SingleForm.Title, tag: Constants.Tags.Label }, { attributes: [{ name: Constants.AttributeName.Id, value: Constants.IDs.SingleFormCategoriesDropdown }], brs: categories.show, children: CategoriesDropdown.generate(categories ? categories.customCategories : null), classes: [Constants.Classes.FontSubText, Constants.Classes.FormCategoriesDropdown, Constants.Classes.TextInput], tag: Constants.Tags.Select }, { attributes: [ { name: Constants.AttributeName.Placeholder, value: UIStrings.getUIStrings().Form.CommentPlaceholder }, { name: Constants.AttributeName.MaxLength, value: Constants.AttributeValue.TextAreaMaxLength }, ], classes: [Constants.Classes.FontSubText, Constants.Classes.FormComment, Constants.Classes.TextInput], id: Constants.IDs.SingleFormComment, tag: Constants.Tags.TextArea }, { brs: false, children: [ { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.SingleFormRating }], classes: [ Constants.Classes.FontSubText, Constants.Classes.TextAlignLeft, Constants.Classes.FormRatingLabel, ], innerText: UIStrings.getUIStrings().Form.RatingLabel, tag: Constants.Tags.Label }, RatingControl.generate(Constants.IDs.SingleFormRating), ], classes: [Constants.Classes.FormRatingContainer] }, { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Text }, { name: Constants.AttributeName.Placeholder, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.AriaLabel, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.Name, value: Constants.IDs.SingleFormEmailInput }, { name: Constants.AttributeName.MaxLength, value: Constants.AttributeValue.TextAreaMaxLength }, { name: Constants.AttributeName.Value, value: Configuration.get().getInAppFeedbackInitOptions().userEmail ? Configuration.get().getInAppFeedbackInitOptions().userEmail : "" }, ], classes: [Constants.Classes.FontSubText, Constants.Classes.FormEmailInput, Constants.Classes.TextInput], id: Constants.IDs.SingleFormEmailInput, tag: Constants.Tags.Input }, { children: [ { attributes: [ { name: Constants.AttributeName.HRef, value: Constants.Urls.PrivacyStatementLink }, { name: Constants.AttributeName.Target, value: Constants.AttributeValue.BlankWindow }, { name: Constants.AttributeName.Rel, value: Constants.AttributeValue.NoReferrer }, ], classes: [Constants.Classes.Link], id: Constants.IDs.PrivacyStatementLink, innerText: UIStrings.getUIStrings().PrivacyStatement, tag: Constants.Tags.Anchor }, ], classes: [Constants.Classes.FontSubSubText, Constants.Classes.TextAlignLeft, Constants.Classes.PrivacyStatementLinkDiv] }, { children: [ { children: [ { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Checkbox }, { name: Constants.AttributeName.Value, value: Constants.AttributeValue.Unchecked }, ], brs: Configuration.get().getInAppFeedbackInitOptions().screenshot, classes: [Constants.Classes.FormScreenshotCheckbox, Constants.Classes.CheckBox], id: Constants.IDs.SingleFormScreenshotCheckbox, tag: Constants.Tags.Input }, { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.SingleFormScreenshotCheckbox }], brs: Configuration.get().getInAppFeedbackInitOptions().screenshot, classes: [Constants.Classes.FontText, Constants.Classes.TextAlignLeft, Constants.Classes.FormScreenshotLabel], innerText: UIStrings.getUIStrings().Form.ScreenshotLabel, tag: Constants.Tags.Label }, ], classes: [Constants.Classes.FormScreenshotContainer] }, { children: [ { classes: [ Constants.Classes.FontSubText, Constants.Classes.SubmitButton, ], id: Constants.IDs.SingleFormSubmitButton, innerText: UIStrings.getUIStrings().Form.Submit, tag: Constants.Tags.Button }, { classes: [Constants.Classes.Spinner, Constants.Classes.Hidden], id: Constants.IDs.SingleFormSubmitButtonSpinner, tag: Constants.Tags.Div }, ], classes: [Constants.Classes.FormSubmitButtonContainer] }, ], classes: [Constants.Classes.FormBottomContainer] }, ], id: exports.containerId }; return formSchema; } exports.generate = generate; /** * The id for the container. This is the id of the top-most element and should * be unique to each form */ exports.containerId = Constants.IDs.SingleFormContainer; /** * Forms may be used for different feedback types. This method executes form * specific logic when the feedback type is selected * @param feedbackType feedback type */ function onSelect(feedbackType) { document.getElementById(Constants.IDs.SingleFormComment).focus(); } exports.onSelect = onSelect; /** * Form template type */ exports.type = FormTemplateType_1.FormTemplateType.Single; },{"./../../../Configuration/Configuration":13,"./../../../Constants":14,"./../../../UIStrings/UIStrings":28,"./../../CategoriesDropdown":37,"./../../RatingControl":39,"./FormTemplateType":32}],34:[function(require,module,exports){ "use strict"; /** * UserVoiceFormTemplate * * A form template for directing to user voice. */ exports.__esModule = true; var UIStrings = require("./../../../UIStrings/UIStrings"); var FormTemplateType_1 = require("./FormTemplateType"); var Constants = require("./../../../Constants"); var Configuration = require("./../../../Configuration/Configuration"); /** * Generate the markup * @returns the markup as json */ function generate() { var initOptions = Configuration.get().getInAppFeedbackInitOptions().userVoice; var formSchema = { children: [ { classes: [Constants.Classes.FontSubtitle, Constants.Classes.TextAlignLeft, Constants.Classes.FormQuestionMiddleText], innerText: UIStrings.getUIStrings().UserVoiceForm.Title }, { classes: [Constants.Classes.FontText, Constants.Classes.TextAlignLeft, Constants.Classes.FormMiddleText], innerText: UIStrings.getUIStrings().UserVoiceForm.Text }, { children: [ { children: [ { attributes: [ { name: Constants.AttributeName.Source, value: initOptions.url }, ], classes: [ Constants.Classes.SubmitButton, Constants.Classes.FontSubText, ], id: Constants.IDs.UserVoiceFormGoButton, innerText: UIStrings.getUIStrings().UserVoiceForm.Button, tag: Constants.Tags.Button }, ], classes: [Constants.Classes.FormSubmitButtonContainer] }, ], classes: [Constants.Classes.FormBottomContainer] }, ], classes: [Constants.Classes.Hidden, Constants.Classes.MarginLeft60px], id: exports.containerId }; return formSchema; } exports.generate = generate; /** * The id for the container. This is the id of the top-most element and should * be unique to each form */ exports.containerId = Constants.IDs.UserVoiceFormContainer; /** * Forms may be used for different feedback types. This method executes form * specific logic when the feedback type is selected * @param feedbackType feedback type */ function onSelect(feedbackType) { document.getElementById(Constants.IDs.UserVoiceFormGoButton).focus(); } exports.onSelect = onSelect; /** * Form template type */ exports.type = FormTemplateType_1.FormTemplateType.UserVoice; },{"./../../../Configuration/Configuration":13,"./../../../Constants":14,"./../../../UIStrings/UIStrings":28,"./FormTemplateType":32}],35:[function(require,module,exports){ "use strict"; /** * Layout.ts * * Module for the layout */ exports.__esModule = true; var Constants_1 = require("./../../Constants"); var UIStrings = require("./../../UIStrings/UIStrings"); var Utils = require("./../Utils"); var SingleFormTemplate = require("./FormTemplates/SingleFormTemplate"); /** * Generates the multi layout as a Renderer.IUIAsJson object * * The TabFocus.ts has a dependency in the mainContainer. All tabbable elements * should be placed inside the mainContainer otherwise TabFocus.ts will not * function as expected. * @param {[key: number]: IFormTemplate} formTemplates FeedbackType -> FormTemplate mapping * @returns {Renderer.IUIAsJson} Renderer.IUIAsJson object */ function generateMulti(formTemplates) { var schema = { attributes: [{ name: Constants_1.AttributeName.DataHtml2CanvasIgnore, value: Constants_1.AttributeValue.True }], children: [ { attributes: [ { name: Constants_1.AttributeName.Role, value: "dialog" }, { name: "aria-modal", value: "true" }, { name: "aria-describedby", value: Constants_1.IDs.QuestionLeftText }, ], children: [ { // This adds a "first" dummy tabbable div to the mainContainer. It's used as a marker // to handle tabs and shift tabs so focus will stay with elements on just the feedback // dialog. Do not relocate this without updating the TabFocus.ts code. attributes: [{ name: Constants_1.AttributeName.TabIndex, value: Constants_1.AttributeValue.Zero }], id: Constants_1.IDs.FirstTabbable }, { children: [ { children: [ { classes: [Constants_1.Classes.FontSubtitle, Constants_1.Classes.TextAlignLeft], id: Constants_1.IDs.QuestionLeftText, innerText: UIStrings.getUIStrings().FeedbackSubtitle }, { children: [ { children: generateOverallAnchors(formTemplates), id: Constants_1.IDs.OverallAnchorsContainer }, ], id: Constants_1.IDs.ColumnSeparatorDiv }, { children: [ { attributes: [ { name: Constants_1.AttributeName.HRef, value: Constants_1.Urls.PrivacyStatementLink }, { name: Constants_1.AttributeName.Target, value: Constants_1.AttributeValue.BlankWindow }, { name: Constants_1.AttributeName.Rel, value: Constants_1.AttributeValue.NoReferrer }, ], classes: [Constants_1.Classes.Link], id: Constants_1.IDs.PrivacyStatementLink, innerText: UIStrings.getUIStrings().PrivacyStatement, tag: Constants_1.Tags.Anchor }, ], classes: [Constants_1.Classes.FontSubSubText, Constants_1.Classes.TextAlignLeft, Constants_1.Classes.PrivacyStatementLinkDiv] }, ], classes: [Constants_1.Classes.FormContainer], id: Constants_1.IDs.LeftFormContainer }, { children: generateMultiForms(formTemplates), classes: [Constants_1.Classes.FormContainer, Constants_1.Classes.Hidden], id: Constants_1.IDs.MiddleFormContainer }, ], classes: [Constants_1.Classes.Hidden], id: Constants_1.IDs.MainContentHolder, tag: Constants_1.Tags.Form }, { // This adds a "last" dummy tabbable div to the mainContainer. It's used as a marker // to handle tabs and shift tabs so focus will stay with elements on just the feedback // dialog. Do not relocate this without updating the TabFocus.ts code. attributes: [{ name: Constants_1.AttributeName.TabIndex, value: Constants_1.AttributeValue.Zero }], id: Constants_1.IDs.LastTabbable }, ], id: Constants_1.IDs.MainContainer }, ], classes: [Utils.isRightToLeft() ? Constants_1.Classes.Rtl : ""], id: Constants_1.IDs.OverlayBackground }; return schema; } exports.generateMulti = generateMulti; /** * Generates the single layout as a Renderer.IUIAsJson object * * The TabFocus.ts has a dependency in the mainContainer. All tabbable elements * should be placed inside the mainContainer otherwise TabFocus.ts will not * function as expected. * @returns {Renderer.IUIAsJson} Renderer.IUIAsJson object */ function generateSingle() { var schema = { attributes: [{ name: Constants_1.AttributeName.DataHtml2CanvasIgnore, value: Constants_1.AttributeValue.True }], children: [ { children: [ { // This adds a "first" dummy tabbable div to the mainContainer. It's used as a marker // to handle tabs and shift tabs so focus will stay with elements on just the feedback // dialog. Do not relocate this without updating the TabFocus.ts code. attributes: [{ name: Constants_1.AttributeName.TabIndex, value: Constants_1.AttributeValue.Zero }], id: Constants_1.IDs.FirstTabbable }, { children: [ { children: [SingleFormTemplate.generate()], classes: [Constants_1.Classes.FormContainer], id: Constants_1.IDs.MiddleFormContainer }, ], classes: [Constants_1.Classes.Hidden], id: Constants_1.IDs.MainContentHolder, tag: Constants_1.Tags.Form }, { // This adds a "last" dummy tabbable div to the mainContainer. It's used as a marker // to handle tabs and shift tabs so focus will stay with elements on just the feedback // dialog. Do not relocate this without updating the TabFocus.ts code. attributes: [{ name: Constants_1.AttributeName.TabIndex, value: Constants_1.AttributeValue.Zero }], id: Constants_1.IDs.LastTabbable }, ], id: Constants_1.IDs.MainContainer }, ], classes: [Constants_1.Classes.SingleLayout, Utils.isRightToLeft() ? Constants_1.Classes.Rtl : ""], id: Constants_1.IDs.OverlayBackground }; return schema; } exports.generateSingle = generateSingle; /** * Generate Renderer.IUIAsJson objects that holds the different forms that will be used on the bellyband. * This is used to generate just one form of each one of the templates that are actually going to be used. * @param {[key: number]: IFormTemplate} formTemplates FeedbackType -> FormTemplate mapping * @returns {Renderer.IUIAsJson} Renderer.IUIAsJson object */ function generateMultiForms(formTemplates) { var wrapper = { children: [] }; var pushedContainers = {}; for (var feedbackType in formTemplates) { if (formTemplates.hasOwnProperty(feedbackType)) { var notExists = !(formTemplates[feedbackType].containerId in pushedContainers); if (notExists) { wrapper.children.push(formTemplates[feedbackType].generate()); pushedContainers[formTemplates[feedbackType].containerId] = true; } } } return wrapper.children; } /** * Generates Renderer.IUIAsJson object that holds the different anchors that will be used on the bellyband. * @param {[key: number]: IFormTemplate} formTemplates FeedbackType -> FormTemplate mapping * @returns {Renderer.IUIAsJson} Renderer.IUIAsJson object */ function generateOverallAnchors(formTemplates) { var wrapper = { children: [] }; if (Constants_1.FeedbackType.Smile in formTemplates) { wrapper.children.push(generateOverallAnchor(Constants_1.IDs.OverallSmileAnchor, Constants_1.IDs.OverallSmileImage, // The svg code for the image // tslint:disable-next-line:max-line-length '', Constants_1.IDs.OverallSmileText, UIStrings.getUIStrings().SmileForm.Anchor)); } if (Constants_1.FeedbackType.Frown in formTemplates) { wrapper.children.push(generateOverallAnchor(Constants_1.IDs.OverallFrownAnchor, Constants_1.IDs.OverallFrownImage, // The svg code for the image // tslint:disable-next-line:max-line-length '', Constants_1.IDs.OverallFrownText, UIStrings.getUIStrings().FrownForm.Anchor)); } if (Constants_1.FeedbackType.Idea in formTemplates) { wrapper.children.push(generateOverallAnchor(Constants_1.IDs.OverallIdeaAnchor, Constants_1.IDs.OverallIdeaImage, // The svg code for the image // tslint:disable-next-line:max-line-length '', Constants_1.IDs.OverallIdeaText, UIStrings.getUIStrings().IdeaForm.Anchor)); } if (Constants_1.FeedbackType.Bug in formTemplates) { wrapper.children.push(generateOverallAnchor(Constants_1.IDs.OverallBugAnchor, Constants_1.IDs.OverallBugImage, // The svg code for the image // tslint:disable-next-line:max-line-length '', Constants_1.IDs.OverallBugText, UIStrings.getUIStrings().BugForm.Anchor)); } return wrapper.children; } /** * Generates a Renderer.IUIAsJson object that holds an anchor that will be used on the bellyband. * @param overallAnchorID the overall anchor id * @param overallImageID the image id * @param imageClass the image class (icon) * @param overallTextID the id for text box * @param uiString the string to display */ function generateOverallAnchor(overallAnchorID, overallImageID, svgImage, overallTextID, uiString) { return { attributes: [ { name: Constants_1.AttributeName.Type, value: Constants_1.AttributeValue.Button }, ], children: [ { classes: [Constants_1.Classes.OverallImage], id: overallImageID, innerHTML: svgImage, tag: Constants_1.Tags.Div }, { classes: [Constants_1.Classes.FontSubtitle, Constants_1.Classes.OverallText], id: overallTextID, innerText: uiString }, ], classes: [Constants_1.Classes.OverallAnchor, Constants_1.Classes.TextAlignLeft], id: overallAnchorID, tag: Constants_1.Tags.Button }; } },{"./../../Constants":14,"./../../UIStrings/UIStrings":28,"./../Utils":46,"./FormTemplates/SingleFormTemplate":33}],36:[function(require,module,exports){ "use strict"; /** * TabFocus.ts * * Module to handle tab and shift tab focus */ exports.__esModule = true; var Constants_1 = require("./../../Constants"); /** * Keeps tabs and shift tabs focus on visible elements of the feedback dialog * This prevents tabs and shift tabs cycle focus to elements of the background main page. * @param focusedElement The in-focus element object */ function cycleTabFocus(focusedElement) { var elements = getTabbableElements(); // when a tab lands on the last dummy tabbable element, set focus to the first // visible element which is the one after the first dummy tabbable element if (focusedElement.id === Constants_1.IDs.LastTabbable) { for (var i = 0; i < elements.length; i++) { var element = elements[i]; if (element.id === Constants_1.IDs.FirstTabbable || !checkVisible(element)) { continue; } element.focus(); return; } // when a shift tab lands on the first dummy tabbable element, set focus to the last // visible element which is the one before the last dummy tabbable element } else if (focusedElement.id === Constants_1.IDs.FirstTabbable) { for (var i = elements.length - 1; i >= 0; i--) { var element = elements[i]; if (element.id === Constants_1.IDs.LastTabbable || !checkVisible(element)) { continue; } element.focus(); return; } } } exports.cycleTabFocus = cycleTabFocus; /** * Returns a list of tabbable elements. * @returns {NodeListOf} list of tabbable elements */ function getTabbableElements() { var tabbableSelector = "a[href], area[href], input:not([disabled]):not([tabindex=\'-1\']), " + "button:not([disabled]):not([tabindex=\'-1\']), select:not([disabled]):not([tabindex=\'-1\']), " + "textarea:not([disabled]):not([tabindex =\'-1\']), " + "object, *[tabindex]:not([tabindex=\'-1\']), *[contenteditable=true]"; return document.getElementById(Constants_1.IDs.MainContainer).querySelectorAll(tabbableSelector); } /** * Returns visibility of an element by inspecting the element's parent class name for visible/hidden value. * Walk up the parent chain if needed. * @param element The element object * @returns {Boolean} whether the element is visible */ function checkVisible(element) { if (!element.parentElement) { return false; } // don't bother if parent element id is just whitespace or empty if (/\S/.test(element.parentElement.id)) { if (element.parentElement.className.indexOf(Constants_1.Classes.Visible) >= 0) { return true; } if (element.parentElement.className.indexOf(Constants_1.Classes.Hidden) >= 0) { return false; } } return checkVisible(element.parentElement); } },{"./../../Constants":14}],37:[function(require,module,exports){ "use strict"; /** * CategoriesDropdown.ts * * A module to render the categories dropdown */ exports.__esModule = true; var UIStrings = require("./../UIStrings/UIStrings"); var Constants = require("./../Constants"); /** * Generate custom categories drop-down list. The list will contain just the * placeholder string if customCategories contains no value. * @param customCategories category values */ function generate(customCategories) { var categories = customCategories ? customCategories : []; var result = [{ attributes: [{ name: "selected", value: "true" }], innerText: UIStrings.getUIStrings().Form.CategoryPlaceholder, tag: Constants.Tags.Option }]; for (var _i = 0, categories_1 = categories; _i < categories_1.length; _i++) { var category = categories_1[_i]; result.push({ innerText: category, tag: Constants.Tags.Option }); } return result; } exports.generate = generate; },{"./../Constants":14,"./../UIStrings/UIStrings":28}],38:[function(require,module,exports){ "use strict"; /** * ChoiceGroupControl.ts * * A module for rendering a choice group. */ exports.__esModule = true; var Constants = require("./../Constants"); function generateRadioGroup(id, question, choices) { var fieldSet = { children: [ { classes: [Constants.Classes.FontSubText], innerText: question, tag: Constants.Tags.Legend }, ], tag: Constants.Tags.FieldSet }; for (var _i = 0, choices_1 = choices; _i < choices_1.length; _i++) { var choice = choices_1[_i]; Array.prototype.push.apply(fieldSet.children, generateRadioButton(choice[0].toString(), choice[1], id)); } return { children: [fieldSet], classes: [Constants.Classes.ChoiceGroup], id: id }; } exports.generateRadioGroup = generateRadioGroup; function generateRadioButton(value, label, id) { return [ { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Radio }, { name: Constants.AttributeName.Value, value: value }, { name: Constants.AttributeName.Name, value: id }, ], id: value, tag: Constants.Tags.Input }, { attributes: [{ name: Constants.AttributeName.For, value: value }], children: [ { children: [{ tag: Constants.Tags.Span }], classes: [Constants.Classes.ChoiceGroupIcon], tag: Constants.Tags.Span }, { classes: ["obf-ChoiceGroupLabel"], innerHTML: label, tag: Constants.Tags.Span }, ], classes: [Constants.Classes.FontSubText], tag: Constants.Tags.Label }, ]; } },{"./../Constants":14}],39:[function(require,module,exports){ "use strict"; /** * RatingControl.ts * * A module for a rating control. */ exports.__esModule = true; var Constants = require("./../Constants"); var starId = "obf-star"; var starDefinition = { children: [ { attributes: [ { name: Constants.AttributeName.Id, value: starId }, { name: Constants.AttributeName.X, value: "0" }, { name: Constants.AttributeName.Y, value: "0" }, { name: Constants.AttributeName.Width, value: "105" }, { name: Constants.AttributeName.Height, value: "100" }, { name: Constants.AttributeName.Points, value: "52.5, 80.3 84, 100 76.3, 63 105, 38 67.2, 35 52.5, 0 37.8, 35 0, 38 28.7, 63 20, 100 52.5, 80.3" }, ], id: starId, tag: Constants.Tags.Polygon }, ], tag: Constants.Tags.Defs }; var firstStar = { attributes: [{ name: Constants.AttributeName.xlinkHref, value: "#" + starId }], tag: Constants.Tags.Use }; var secondStar = { attributes: [ { name: Constants.AttributeName.xlinkHref, value: "#" + starId }, { name: Constants.AttributeName.Transform, value: "translate(105 0)" }, ], tag: Constants.Tags.Use }; var thirdStar = { attributes: [ { name: Constants.AttributeName.xlinkHref, value: "#" + starId }, { name: Constants.AttributeName.Transform, value: "translate(210 0)" }, ], tag: Constants.Tags.Use }; var fourthStar = { attributes: [ { name: Constants.AttributeName.xlinkHref, value: "#" + starId }, { name: Constants.AttributeName.Transform, value: "translate(315 0)" }, ], tag: Constants.Tags.Use }; var fifthStar = { attributes: [ { name: Constants.AttributeName.xlinkHref, value: "#" + starId }, { name: Constants.AttributeName.Transform, value: "translate(420 0)" }, ], tag: Constants.Tags.Use }; var emptyStars = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 525 100" }], children: [starDefinition, firstStar, secondStar, thirdStar, fourthStar, fifthStar], classes: [Constants.Classes.RatingGraphic], tag: Constants.Tags.Svg }; var oneFilledStar = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 105 100" }], children: [starDefinition, firstStar], classes: [Constants.Classes.RatingGraphic, Constants.Classes.RatingGraphicFilled], tag: Constants.Tags.Svg }; var twoFilledStar = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 210 100" }], children: [starDefinition, firstStar, secondStar], classes: [Constants.Classes.RatingGraphic, Constants.Classes.RatingGraphicFilled], tag: Constants.Tags.Svg }; var threeFilledStar = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 315 100" }], children: [starDefinition, firstStar, secondStar, thirdStar], classes: [Constants.Classes.RatingGraphic, Constants.Classes.RatingGraphicFilled], tag: Constants.Tags.Svg }; var fourFilledStar = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 420 100" }], children: [starDefinition, firstStar, secondStar, thirdStar, fourthStar], classes: [Constants.Classes.RatingGraphic, Constants.Classes.RatingGraphicFilled], tag: Constants.Tags.Svg }; var fiveFilledStar = { attributes: [{ name: Constants.AttributeName.ViewBox, value: "0 0 525 100" }], children: [starDefinition, firstStar, secondStar, thirdStar, fourthStar, fifthStar], classes: [Constants.Classes.RatingGraphic, Constants.Classes.RatingGraphicFilled], tag: Constants.Tags.Svg }; function generate(id) { return { children: [ emptyStars, { attributes: [ { name: Constants.AttributeName.Type, value: "radio" }, { name: Constants.AttributeName.Name, value: id }, { name: Constants.AttributeName.Value, value: "1" }, ], tag: Constants.Tags.Input }, oneFilledStar, { attributes: [ { name: Constants.AttributeName.Type, value: "radio" }, { name: Constants.AttributeName.Name, value: id }, { name: Constants.AttributeName.Value, value: "2" }, ], tag: Constants.Tags.Input }, twoFilledStar, { attributes: [ { name: Constants.AttributeName.Type, value: "radio" }, { name: Constants.AttributeName.Name, value: id }, { name: Constants.AttributeName.Value, value: "3" }, ], tag: Constants.Tags.Input }, threeFilledStar, { attributes: [ { name: Constants.AttributeName.Type, value: "radio" }, { name: Constants.AttributeName.Name, value: id }, { name: Constants.AttributeName.Value, value: "4" }, ], tag: Constants.Tags.Input }, fourFilledStar, { attributes: [ { name: Constants.AttributeName.Type, value: "radio" }, { name: Constants.AttributeName.Name, value: id }, { name: Constants.AttributeName.Value, value: "5" }, ], tag: Constants.Tags.Input }, fiveFilledStar, ], classes: [Constants.Classes.Rating], id: id, tag: Constants.Tags.Span }; } exports.generate = generate; },{"./../Constants":14}],40:[function(require,module,exports){ "use strict"; /** * Renderer.ts * * Module for rendering the markup */ exports.__esModule = true; var Constants = require("./../Constants"); /** * Create DOM elements from Json structure * @param {UiAsJson} schema The Json structure * @param {boolean} svg Create svg element instead of html? * @return {HTMLElement} HTML elements with tree structure */ function elementFromJson(schema, svg) { if (typeof schema.brs === "undefined") { schema.brs = true; } if (!schema.brs) { return null; } if (!schema.tag) { schema.tag = Constants.Tags.Div; } var element; if (schema.tag === Constants.Tags.Svg) { svg = true; } if (svg) { element = document.createElementNS("http://www.w3.org/2000/svg", schema.tag); } else { element = document.createElement(schema.tag); } if (schema.attributes) { var attribute = void 0; for (var i = 0; i < schema.attributes.length; i++) { attribute = schema.attributes[i]; if (attribute.name === Constants.AttributeName.xlinkHref) { element.setAttributeNS("http://www.w3.org/1999/xlink", Constants.AttributeName.HRef, attribute.value); } else { element.setAttribute(attribute.name, attribute.value); } } } if (schema.id) { element.id = schema.id; } if (schema.classes) { var concatClasses = schema.classes.join(" "); if (svg) { element.setAttribute(Constants.AttributeName.Class, concatClasses); } else { element.className = concatClasses; } } if (schema.innerText && !svg) { element.textContent = schema.innerText; } if (schema.innerHTML && !svg) { element.innerHTML = schema.innerHTML; } if (schema.children) { for (var i = 0; i < schema.children.length; i++) { // Sometimes IE mis-reports length var cur = schema.children[i]; if (cur) { var child = elementFromJson(cur, svg); if (child) { element.appendChild(child); } } } } return element; } exports.elementFromJson = elementFromJson; },{"./../Constants":14}],41:[function(require,module,exports){ "use strict"; /** * Spinner.ts * * A module for a spinner. */ exports.__esModule = true; var Constants = require("./../Constants"); var Utils = require("./Utils"); var animationSpeed = 90; var numCircles = 8; var offsetSize = 0.2; var parentSize = 34; var fadeIncrement = 1 / numCircles; var Spinner = /** @class */ (function () { /** * Constructor * @param id id of the element to attach the spinner to */ function Spinner(id) { this.circleObjects = []; this.spinnerId = id; this.spinner = document.getElementById(this.spinnerId); this.createCirclesAndArrange(); this.initializeOpacities(); this.start(); Utils.setElementVisibility(id, true); } /** * Destroys the spinner */ Spinner.prototype.destroy = function () { Utils.setElementVisibility(this.spinnerId, false); this.stop(); }; /** * Starts the animation */ Spinner.prototype.start = function () { var _this = this; this.stop(); this.interval = setInterval(function () { var i = _this.circleObjects.length; while (i--) { fade(_this.circleObjects[i]); } }, animationSpeed); }; /** * Stops the animation */ Spinner.prototype.stop = function () { clearInterval(this.interval); }; Spinner.prototype.createCirclesAndArrange = function () { var angle = 0; var offset = parentSize * offsetSize; var step = (2 * Math.PI) / numCircles; var i = numCircles; var circleObject; var radius = (parentSize - offset) * 0.5; while (i--) { var circle = createCircle(); var x = Math.round(parentSize * 0.5 + radius * Math.cos(angle) - circle.clientWidth * 0.5) - offset * 0.5; var y = Math.round(parentSize * 0.5 + radius * Math.sin(angle) - circle.clientHeight * 0.5) - offset * 0.5; this.spinner.appendChild(circle); circle.style.left = x + "px"; circle.style.top = y + "px"; angle += step; circleObject = { element: circle, j: i }; this.circleObjects.push(circleObject); } }; Spinner.prototype.initializeOpacities = function () { var i = 0; var j = 1; var opacity; for (i; i < numCircles; i++) { var circleObject = this.circleObjects[i]; opacity = (fadeIncrement * j++); setOpacity(circleObject.element, opacity); } }; return Spinner; }()); exports.Spinner = Spinner; function fade(circleObject) { var opacity = getOpacity(circleObject.element) - fadeIncrement; if (opacity <= 0) { opacity = 1; } setOpacity(circleObject.element, opacity); } function getOpacity(element) { return parseFloat(window.getComputedStyle(element).getPropertyValue("opacity")); } function setOpacity(element, opacity) { element.style.opacity = opacity.toString(); } function createCircle() { var circle = document.createElement("div"); circle.classList.add(Constants.Classes.SpinnerCircle); circle.style.width = circle.style.height = parentSize * offsetSize + "px"; return circle; } },{"./../Constants":14,"./Utils":46}],42:[function(require,module,exports){ "use strict"; /** * Events.ts * * A module for all Event handling. */ exports.__esModule = true; var Transport_1 = require("./../../Transport/Transport"); var Constants_1 = require("./../../Constants"); var UiUtils = require("./../Utils"); var SpinnerControl_1 = require("./../SpinnerControl"); var Logging = require("./../../Logging/Logging"); var Configuration = require("./../../Configuration/Configuration"); var Api = require("@ms-ofb/officefloodgatecore/dist/src/Api/Api"); /** * Callback for when the feedback dialog is dismissed */ var onDismiss; /** * Is the prompt up */ var isPromptUp; /** * Dismiss all, including networking, UI, and events * @param submitted Was the control submitted (true), or cancelled (false)? */ function dismissAll(submitted) { unregister(); onDismiss(submitted); } /** * Listener un-registration */ function unregister() { removeListeners(); } /** * List of listeners and the ids they are attached to. This ensures all events are correctly unregistered. */ var listenersList = []; function addListener(id, event, listener) { UiUtils.registerListener(id, event, listener); listenersList.push({ event: event, id: id, listener: listener }); } function removeListeners() { for (var _i = 0, listenersList_1 = listenersList; _i < listenersList_1.length; _i++) { var listener = listenersList_1[_i]; UiUtils.unregisterListener(listener.id, listener.event, listener.listener); } listenersList = []; } /** * Register events for toast */ function register(ON_DISMISS) { if (ON_DISMISS === void 0) { ON_DISMISS = function (submitted) { return; }; } onDismiss = ON_DISMISS; isPromptUp = true; addListener(Constants_1.IDs.ToastContainer, "keyup", toastKeyEventHandler); addListener(Constants_1.IDs.ToastCancel, "click", toastCancelHandler); addListener(Constants_1.IDs.TPromptContainer, "click", promptContainerHandler); addListener(Constants_1.IDs.TFormSubmitButton, "click", submitButtonHandler); addListener(Constants_1.IDs.TFormEmailCheckBox, "click", emailCheckBoxHandler); emailCheckBoxHandler(null); // call the checkbox handler to process the initial state var ratingElements = document.querySelectorAll("input[name=\"" + Constants_1.IDs.TFormRating + "\"]"); for (var i = 0; i < ratingElements.length; ++i) { UiUtils.registerListenerToElement(ratingElements[i], "click", ratingInputHandler); } if (!Configuration.get().getFloodgateSurvey().showPrompt) { showSurveyScreen(); } else { Logging.getLogger().logEvent(Logging.EventIds.Survey.UI.Prompt.Shown.VALUE, { CampaignId: Configuration.get().getFloodgateSurvey().getCampaignId(), SurveyId: Configuration.get().getFloodgateSurvey().getId(), SurveyType: Configuration.get().getFloodgateSurvey().getSurveyType() }); } // Auto dismiss if needed var autoDimiss = Configuration.get().getFloodgateInitOptions().autoDismiss; if (autoDimiss !== Constants_1.AutoDismissValues.NoAutoDismiss) { var autoDimissDuration = void 0; switch (autoDimiss) { case (Constants_1.AutoDismissValues.SevenSeconds): autoDimissDuration = 7000; break; case (Constants_1.AutoDismissValues.FourteenSeconds): autoDimissDuration = 14000; break; case (Constants_1.AutoDismissValues.TwentyOneSeconds): autoDimissDuration = 21000; break; case (Constants_1.AutoDismissValues.TwentyEightSeconds): autoDimissDuration = 28000; break; default: } if (autoDimissDuration !== undefined) { setTimeout(function () { if (isPromptUp) { dismissAll(false); } }, autoDimissDuration); } } } exports.register = register; function emailCheckBoxHandler(event) { // show email if checked and show default string if unchecked var emailCheckBox = document.getElementById(Constants_1.IDs.TFormEmailCheckBox); if (emailCheckBox) { var emailTextBox = document.getElementById(Constants_1.IDs.TFormEmailTextBox); emailTextBox.value = emailCheckBox.checked ? Configuration.get().getCommonInitOptions().userEmail : null; emailTextBox.disabled = !emailCheckBox.checked; } } function toastKeyEventHandler(event) { // dismiss upon pressing the escape key if (event.keyCode === Constants_1.Keys.Esc) { event.preventDefault(); event.stopPropagation(); dismissAll(false); } } function toastCancelHandler(event) { event.preventDefault(); event.stopPropagation(); dismissAll(false); } function promptContainerHandler(event) { event.preventDefault(); event.stopPropagation(); showSurveyScreen(); } function showSurveyScreen() { isPromptUp = false; UiUtils.setElementVisibility(Constants_1.IDs.TPromptContainer, false); UiUtils.setElementVisibility(Constants_1.IDs.TFormContainer, true); Logging.getLogger().logEvent(Logging.EventIds.Survey.UI.Form.Shown.VALUE, { CampaignId: Configuration.get().getFloodgateSurvey().getCampaignId(), SurveyId: Configuration.get().getFloodgateSurvey().getId(), SurveyType: Configuration.get().getFloodgateSurvey().getSurveyType() }); } function ratingInputHandler(event) { document.getElementById(Constants_1.IDs.TFormSubmitButton).disabled = false; } function submitButtonHandler(event) { event.preventDefault(); event.stopPropagation(); UiUtils.setElementVisibility(Constants_1.IDs.TFormSubmitButton, false); var spinner = new SpinnerControl_1.Spinner(Constants_1.IDs.TFormSubmitButtonSpinner); var transporter = new Transport_1.Transporter(Configuration.get().getCommonInitOptions().environment, Api.ISurvey.Type[Configuration.get().getFloodgateSurvey().getSurveyType()], Configuration.get().getCommonInitOptions().appId, "Survey", Configuration.get().getCommonInitOptions().applicationGroup, Configuration.get().getCommonInitOptions().telemetryGroup, Configuration.get().getCommonInitOptions().webGroup); var commentElement = document.getElementById(Constants_1.IDs.TFormComment); var commentEntered = (commentElement && !!commentElement.value); var selectedRating = document.querySelector("input[name=\"" + Constants_1.IDs.TFormRating + "\"]:checked"); Configuration.get().getFloodgateSurvey().setValues(Number(selectedRating.value), commentEntered ? commentElement.value : ""); // Add survey-specific data to manifest transporter.setManifestValues(Configuration.get().getFloodgateSurvey().getJsonElements()); // Send email address if user gives consent var emailCheckBox = document.getElementById(Constants_1.IDs.TFormEmailCheckBox); var emailTextBox = document.getElementById(Constants_1.IDs.TFormEmailTextBox); if (emailCheckBox && emailCheckBox.checked && emailTextBox.value !== "") { transporter.setEmail(emailTextBox.value); } transporter.submit(); spinner.destroy(); dismissAll(true); Logging.getLogger().logEvent(Logging.EventIds.Survey.UI.Form.Submit.VALUE, { CampaignId: Configuration.get().getFloodgateSurvey().getCampaignId(), SurveyId: Configuration.get().getFloodgateSurvey().getId(), SurveyType: Configuration.get().getFloodgateSurvey().getSurveyType() }); } },{"./../../Configuration/Configuration":13,"./../../Constants":14,"./../../Logging/Logging":17,"./../../Transport/Transport":27,"./../SpinnerControl":41,"./../Utils":46,"@ms-ofb/officefloodgatecore/dist/src/Api/Api":1}],43:[function(require,module,exports){ "use strict"; /** * Layout.ts * * Module for the layout */ exports.__esModule = true; var ChoiceGroupControl = require("./../ChoiceGroupControl"); var Configuration = require("./../../Configuration/Configuration"); var Constants_1 = require("./../../Constants"); var UIStrings = require("./../../UIStrings/UIStrings"); var Utils = require("./../Utils"); var Constants = require("./../../Constants"); /** * Generates the toast * * @returns {Renderer.IUIAsJson} Renderer.IUIAsJson object */ function generate() { var schema = { attributes: [ { name: Constants_1.AttributeName.DataHtml2CanvasIgnore, value: Constants_1.AttributeValue.True }, { name: Constants_1.AttributeName.Role, value: "dialog" }, { name: "aria-labelledby", value: Constants_1.IDs.TPromptTitle }, { name: "aria-describedby", value: Constants_1.IDs.TPromptText }, ], children: [ { attributes: [ { name: Constants_1.AttributeName.Type, value: Constants_1.AttributeValue.Button }, { name: Constants_1.AttributeName.AriaLabel, value: UIStrings.getUIStrings().CloseLabel }, ], id: Constants_1.IDs.ToastCancel, // tslint:disable-next-line:max-line-length innerHTML: '', tag: Constants_1.Tags.Button }, generatePrompt(), generateForm(), ], classes: [Constants_1.Classes.Toast, Utils.isRightToLeft() ? Constants_1.Classes.Rtl : ""], id: Constants_1.IDs.ToastContainer }; return schema; } exports.generate = generate; function generatePrompt() { var promptSchema = { attributes: [{ name: "aria-labelledby", value: Constants_1.IDs.TPromptTitle }], children: [ { classes: [ Constants_1.Classes.FontText, Constants_1.Classes.TextAlignLeft, ], id: Constants_1.IDs.TPromptTitle, innerText: Configuration.get().getFloodgateSurvey().getTitle() }, { classes: [ Constants_1.Classes.FontSubText, Constants_1.Classes.TextAlignLeft, ], id: Constants_1.IDs.TPromptText, innerText: Configuration.get().getFloodgateSurvey().getPromptQuestion() }, ], id: Constants_1.IDs.TPromptContainer, tag: Constants_1.Tags.Button }; return promptSchema; } function userEmailConsentDefault() { var userEmailConsentDefault = Configuration.get().getCommonInitOptions().userEmailConsentDefault; return userEmailConsentDefault ? Constants.AttributeValue.Checked : Constants.AttributeValue.Unchecked; } function generateForm() { var formSchema = { children: [ { classes: [ Constants_1.Classes.FontText, Constants_1.Classes.TextAlignLeft, ], id: Constants_1.IDs.TFormTitle, innerText: Configuration.get().getFloodgateSurvey().getTitle() }, generateRatingControl(), { attributes: [ { name: Constants_1.AttributeName.Placeholder, value: Configuration.get().getFloodgateSurvey().getCommentQuestion() }, { name: Constants_1.AttributeName.AriaLabel, value: Configuration.get().getFloodgateSurvey().getCommentQuestion() }, { name: Constants_1.AttributeName.MaxLength, value: Constants_1.AttributeValue.TextAreaMaxLength }, ], classes: [Constants_1.Classes.FontSubText, Constants_1.Classes.TextInput], id: Constants_1.IDs.TFormComment, tag: Constants_1.Tags.TextArea }, { brs: Configuration.get().getFloodgateSurvey().showEmailRequest, children: [ { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Checkbox }, { name: userEmailConsentDefault(), value: "" }, ], classes: [Constants.Classes.TFormEmailCheckbox, Constants.Classes.CheckBox], id: Constants.IDs.TFormEmailCheckBox, tag: Constants.Tags.Input }, { attributes: [{ name: Constants.AttributeName.For, value: Constants.IDs.TFormEmailCheckBox }], classes: [Constants.Classes.FontSubText, Constants.Classes.TextAlignLeft, Constants.Classes.TFormEmailLabel], innerText: UIStrings.getUIStrings().Form.EmailCheckBoxLabel, tag: Constants.Tags.Label }, { attributes: [ { name: Constants.AttributeName.Type, value: Constants.AttributeValue.Text }, { name: Constants.AttributeName.Placeholder, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.AriaLabel, value: UIStrings.getUIStrings().Form.EmailPlaceholder }, { name: Constants.AttributeName.Name, value: Constants.IDs.BasicFormEmailInput }, { name: Constants.AttributeName.MaxLength, value: Constants.AttributeValue.TextAreaMaxLength }, { name: Constants.AttributeName.Value, value: Configuration.get().getCommonInitOptions().userEmailConsentDefault ? Configuration.get().getCommonInitOptions().userEmail : "" }, ], classes: [Constants.Classes.FontSubText, Constants.Classes.FormEmailInput, Constants.Classes.TextInput], id: Constants.IDs.TFormEmailTextBox, tag: Constants.Tags.Input }, ] }, { children: [ { attributes: [ { name: Constants_1.AttributeName.HRef, value: Constants_1.Urls.PrivacyStatementLink }, { name: Constants_1.AttributeName.Target, value: Constants_1.AttributeValue.BlankWindow }, { name: Constants_1.AttributeName.Rel, value: Constants_1.AttributeValue.NoReferrer }, ], classes: [Constants_1.Classes.Link], innerText: UIStrings.getUIStrings().PrivacyStatement, tag: Constants_1.Tags.Anchor }, ], classes: [Constants_1.Classes.FontSubSubText, Constants_1.Classes.TextAlignLeft, Constants_1.Classes.PrivacyStatementLinkDiv] }, { children: [ { attributes: [{ name: Constants_1.AttributeName.Disabled, value: Constants_1.AttributeValue.True }], classes: [ Constants_1.Classes.FontSubText, Constants_1.Classes.SubmitButton, ], id: Constants_1.IDs.TFormSubmitButton, innerText: UIStrings.getUIStrings().Form.Submit, tag: Constants_1.Tags.Button }, { classes: [Constants_1.Classes.Spinner, Constants_1.Classes.Hidden], id: Constants_1.IDs.TFormSubmitButtonSpinner, tag: Constants_1.Tags.Div }, ], id: Constants_1.IDs.TFormSubmitButtonContainer }, ], classes: [Constants_1.Classes.Hidden], id: Constants_1.IDs.TFormContainer }; return formSchema; } function generateRatingControl() { var choices = []; var ratingValues = Configuration.get().getFloodgateSurvey().getRatingValuesAscending(); var index = 0; for (var _i = 0, ratingValues_1 = ratingValues; _i < ratingValues_1.length; _i++) { var ratingValue = ratingValues_1[_i]; choices.push([index, ratingValue]); index++; } // Ratings need to be shown in descending order return ChoiceGroupControl.generateRadioGroup(Constants_1.IDs.TFormRating, Configuration.get().getFloodgateSurvey().getRatingQuestion(), choices.reverse()); } },{"./../../Configuration/Configuration":13,"./../../Constants":14,"./../../UIStrings/UIStrings":28,"./../ChoiceGroupControl":38,"./../Utils":46}],44:[function(require,module,exports){ "use strict"; /** * Toast.ts * * Module for the Toast UI */ exports.__esModule = true; var Constants_1 = require("./../../Constants"); var Events = require("./Events"); var Layout = require("./Layout"); var Renderer = require("./../Renderer"); var Utils = require("./../Utils"); var Configuration = require("./../../Configuration/Configuration"); /** * UI initialization for toast */ function createSurvey(onClose) { create(Renderer.elementFromJson(Layout.generate())); Events.register(function (submitted) { Utils.setElementVisibility(Constants_1.IDs.ToastContainer, false); Utils.deleteElementById(Constants_1.IDs.ToastContainer); Configuration.get().getFloodgateInitOptions().onDismiss(Configuration.get().getFloodgateSurvey().getCampaignId(), submitted); onClose(); }); } exports.createSurvey = createSurvey; function create(userInterface) { document.body.insertBefore(userInterface, document.body.firstChild); Utils.setElementVisibility(Constants_1.IDs.ToastContainer, true); } },{"./../../Configuration/Configuration":13,"./../../Constants":14,"./../Renderer":40,"./../Utils":46,"./Events":42,"./Layout":43}],45:[function(require,module,exports){ "use strict"; /** * UI.ts * * Module for the UI */ exports.__esModule = true; var BellyBand_1 = require("./BellyBand/BellyBand"); exports.createBellyBandMulti = BellyBand_1.createMulti; var BellyBand_2 = require("./BellyBand/BellyBand"); exports.createBellyBandSingle = BellyBand_2.createSingle; var Toast_1 = require("./Toast/Toast"); exports.createSurvey = Toast_1.createSurvey; },{"./BellyBand/BellyBand":29,"./Toast/Toast":44}],46:[function(require,module,exports){ "use strict"; /** * Utils.ts * * Module for utility functions */ exports.__esModule = true; var Constants = require("./../Constants"); /** * Set HTML element visibility * @param {string} id The Id of the HTML element * @param {any} vis The visibility to be set (true or false) * @return {void} */ function setElementVisibility(id, vis) { var oldClassName = vis ? Constants.Classes.Hidden : Constants.Classes.Visible; var newClassName = vis ? Constants.Classes.Visible : Constants.Classes.Hidden; replaceClassesById(id, oldClassName, newClassName); } exports.setElementVisibility = setElementVisibility; /** * Delete HTML element by Id * @param {string} id The Id of the HTML element * @return {void} */ function deleteElementById(id) { var element = document.getElementById(id); if (element != null && element.parentNode != null) { element.parentNode.removeChild(element); } } exports.deleteElementById = deleteElementById; /** * Add a CSS class to an HTML element by Id * @param {string} id The Id of the HTML element * @param {string} newClassName The name of CSS class to be added * @return {void} */ function addClassById(id, newClass) { var element = document.getElementById(id); if (!element) { return; } // check is the class already exists, if not add it if (!element.className.match(new RegExp("\\b" + newClass + "\\b"))) { // we use className instead of classList to support IE9 element.className = element.className + " " + newClass; } } exports.addClassById = addClassById; /** * Delete a CSS class of an HTML element by Id * @param {string} id The Id of the HTML element * @param {string} oldClassName The name of CSS class to be deleted * @return {void} */ function deleteClassById(id, oldClass) { var element = document.getElementById(id); if (!element) { return; } // we use className instead of classList to support IE9 // get rid of any occurrences of the class we don"t want element.className = element.className.split(new RegExp("\\b" + oldClass + "\\b", "i")).join(" "); // get rid of extra whitespaces element.className = element.className.split(/\s+/).join(" "); } exports.deleteClassById = deleteClassById; /** * Delete an CSS class and (or) add an CSS class to an HTML element by Id * @param {string} id The Id of the HTML element * @param {string} oldClassName The name of CSS class to be deleted * @param {string} newClassName The name of CSS class to be added * @return {void} */ function replaceClassesById(id, oldClassName, newClassName) { deleteClassById(id, oldClassName); addClassById(id, newClassName); } exports.replaceClassesById = replaceClassesById; /** * Set attribute on an HTML element * @param {string} id The Id of the HTML element * @param {string} attriName The attribute name * @param {string} attriValue The attribute value * @return {void} */ function setAttributeOnHtmlElement(id, attriName, attriValue) { var htmlElement = document.getElementById(id); if (htmlElement) { htmlElement.setAttribute(attriName, attriValue); } } exports.setAttributeOnHtmlElement = setAttributeOnHtmlElement; /** * Add event listener helper function (wrapper) that deals with IE 8 compatability * @param object The object to add event listener to * @param type The event type * @param listener The listener function */ function addEventListenerHelper(object, type, listener) { if (object.addEventListener) { object.addEventListener(type, listener, false); } else if (object.attachEvent) { object.attachEvent("on" + type, listener); } } exports.addEventListenerHelper = addEventListenerHelper; /** * Remove event listener helper function (wrapper) that deals with IE 8 compatability * @param object The object to remove event listener from * @param type The event type * @param listener The listener function */ function removeEventListenerHelper(object, type, listener) { if (object.removeEventListener) { object.removeEventListener(type, listener, false); } else if (object.detachEvent) { object.detachEvent("on" + type, listener); } } exports.removeEventListenerHelper = removeEventListenerHelper; /** * Register event listener * @param id The Id of the HTML element * @param type The event type * @param listener The listener function */ function registerListener(id, type, listener) { var element = document.getElementById(id); if (element) { addEventListenerHelper(element, type, listener); } } exports.registerListener = registerListener; /** * Register event listener * @param element The HTML element * @param type The event type * @param listener The listener function */ function registerListenerToElement(element, type, listener) { if (element) { addEventListenerHelper(element, type, listener); } } exports.registerListenerToElement = registerListenerToElement; /** * Un-register event listener * @param id The Id of the HTML element * @param type The event type * @param listener The listener function */ function unregisterListener(id, type, listener) { var element = document.getElementById(id); if (element) { removeEventListenerHelper(element, type, listener); } } exports.unregisterListener = unregisterListener; /** * Returns the version of Internet Explorer or -1 for non-IE browser * @return {number} The IE version */ function getInternetExplorerVersion() { var rv = -1; var ua = window.navigator.userAgent; // since IE 11, 'MSIE' is not a keyword in its user agent string anymore // determine whether the browser is IE or not, and the version of IE based on Trident keyword and its version if (ua.indexOf("Trident") > -1) { var re = new RegExp("Trident/([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) { rv = parseFloat(RegExp.$1); rv += 4; // trident version + 4 is the IE version } } return rv; } exports.getInternetExplorerVersion = getInternetExplorerVersion; /** * Check if the current text direction is right to left */ function isRightToLeft() { return getComputedStyle(document.documentElement).direction === "rtl"; } exports.isRightToLeft = isRightToLeft; },{"./../Constants":14}],47:[function(require,module,exports){ "use strict"; /* * Utils.ts * * Module for utility functions */ exports.__esModule = true; /** * Check if given value is a number * @param {any} value value */ function isNumber(value) { return (typeof value === "number"); } /** * Check if given value is an integer * @param {any} value value */ function isInteger(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; } exports.isInteger = isInteger; /** * Check if given value is a string * @param {any} value value */ function isString(value) { return (typeof value === "string"); } /** * Check if value is an object * @param {any} value value */ function isObject(value) { return (!isNullorUndefined(value) && typeof (value) === "object"); } /** * Check if value is an object * @param {any} value value */ function isBoolean(value) { return typeof (value) === "boolean"; } exports.isBoolean = isBoolean; /** * Check if value is "null" or "undefined" * @param {any} value value */ function isNullorUndefined(value) { return (value == null); } /** * Check if value is a valid guid * @param {any} value value */ function isGuid(value) { return (isString(value) && /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(value)); } /** * Throw if not object */ function expectObject(value, name) { if (!isObject(value)) { throw name + " is not an object: " + value; } } exports.expectObject = expectObject; /** * Throw if not number */ function expectNumber(value, name) { if (!isNumber(value)) { throw name + " is not a number: " + value; } } exports.expectNumber = expectNumber; /** * Throw if not string */ function expectString(value, name) { if (!isString(value)) { throw name + " is not a string: " + value; } } exports.expectString = expectString; /** * Throw if not boolean */ function expectBoolean(value, name) { if (!isBoolean(value)) { throw name + " is not a boolean: " + value; } } exports.expectBoolean = expectBoolean; /** * Throw if not guid */ function expectGuid(value, name) { if (!isGuid(value)) { throw name + " is not a guid: " + value; } } exports.expectGuid = expectGuid; /** * Throw if not array */ function expectArray(value, name) { if (!Array.isArray(value)) { throw name + " is not an array: " + value; } } exports.expectArray = expectArray; /** * Create guid string */ function guid() { // Stitch in '4' in the third group return (randomHex4() + randomHex4() + "-" + randomHex4() + "-4" + randomHex4().substr(0, 3) + "-" + randomHex4() + "-" + randomHex4() + randomHex4() + randomHex4()).toLowerCase(); } exports.guid = guid; /** * Create random Hex4 string */ function randomHex4() { return (Math.floor(((1 + Math.random()) * 0x10000))).toString(16).substring(1); } /** * Takes two objects (source, target) and returns the target object with values in the source added to it. * It overwrites any source properties which already exist in target. * @param sourceObject the source * @param targetobject the target * @returns the result */ function overrideValues(sourceObject, targetobject) { if (!targetobject) { return targetobject; } var result = targetobject; if (sourceObject) { for (var field in sourceObject) { if (sourceObject.hasOwnProperty(field)) { result[field] = sourceObject[field]; } } } return result; } exports.overrideValues = overrideValues; },{}],48:[function(require,module,exports){ "use strict"; exports.__esModule = true; exports["default"] = "1.3.2"; },{}],49:[function(require,module,exports){ "use strict"; /** * WindowProperties.ts * * Module to track window properties. */ exports.__esModule = true; /** * Is the window narrow? * @returns True if it is, false otherwise */ function isNarrow() { var narrowScreenBoundary = 800; if (window.innerWidth) { return window.innerWidth < narrowScreenBoundary; } // if we can't find the width; go with narrow. return true; } exports.isNarrow = isNarrow; },{}],50:[function(require,module,exports){ "use strict"; /** * Window.ts * * Module wrapping around the global window object */ exports.__esModule = true; /** * Get the IWindow object */ function get() { return window; } exports.get = get; /** * Set the setUiStrings() method * @param setUiStrings the method */ function setSetUiStrings(setUiStrings) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.setUiStrings = setUiStrings; } exports.setSetUiStrings = setSetUiStrings; /** * Set the singleFeedback() method * @param singleFeedback the method */ function setSingleFeedback(singleFeedback) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.singleFeedback = singleFeedback; } exports.setSingleFeedback = setSingleFeedback; /** * Set the multiFeedback() method * @param multiFeedback the method */ function setMultiFeedback(multiFeedback) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.multiFeedback = multiFeedback; } exports.setMultiFeedback = setMultiFeedback; /** * Set the floodgate showSurvey() method * @param floodgateShowSurvey the method */ function setFloodgateShowSurvey(floodgateShowSurvey) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.showSurvey = floodgateShowSurvey; } exports.setFloodgateShowSurvey = setFloodgateShowSurvey; /** * Set the floodgate showCustomSurvey() method * @param floodgateShowSurvey the method */ function setFloodgateShowCustomSurvey(floodgateShowCustomSurvey) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.showCustomSurvey = floodgateShowCustomSurvey; } exports.setFloodgateShowCustomSurvey = setFloodgateShowCustomSurvey; /** * Set the floodgate initialize() method * @param floodgateInitialize the method */ function setFloodgateInitialize(floodgateInitialize) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.initialize = floodgateInitialize; } exports.setFloodgateInitialize = setFloodgateInitialize; /** * Set the floodgate start() method * @param floodgateStart the method */ function setFloodgateStart(floodgateStart) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.start = floodgateStart; } exports.setFloodgateStart = setFloodgateStart; /** * Set the floodgate stop() method * @param floodgateStop the method */ function setFloodgateStop(floodgateStop) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.stop = floodgateStop; } exports.setFloodgateStop = setFloodgateStop; /** * Set the floodgate getEngine() method * @param floodgateGetEngine the method */ function setFloodgateGetEngine(floodgateGetEngine) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.getEngine = floodgateGetEngine; } exports.setFloodgateGetEngine = setFloodgateGetEngine; /** * Set the floodgate getSettingIdMap() method * @param floodgateSettingIdMap the method */ function getSettingIdMap(floodgateSettingIdMap) { window.OfficeBrowserFeedback = window.OfficeBrowserFeedback || {}; window.OfficeBrowserFeedback.floodgate = window.OfficeBrowserFeedback.floodgate || {}; window.OfficeBrowserFeedback.floodgate.getSettingIdMap = floodgateSettingIdMap; } exports.getSettingIdMap = getSettingIdMap; },{}],51:[function(require,module,exports){ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else { var a = factory(); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 15); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * microsoft.bond.primitives.ts * Copyright: Microsoft 2016 */ Object.defineProperty(exports, "__esModule", { value: true }); var Int64 = /** @class */ (function () { // BUG!!: need implement, currently, just handle 32bits number function Int64(numberStr) { this.low = 0; this.high = 0; this.low = parseInt(numberStr, 10); if (this.low < 0) { this.high = -1; } } Int64.prototype.Equals = function (numberStr) { var tmp = new Int64(numberStr); return this.low === tmp.low && this.high === tmp.high; }; return Int64; }()); exports.Int64 = Int64; var UInt64 = /** @class */ (function () { // BUG!!: need implement, currently, just handle 32bits number function UInt64(numberStr) { this.low = 0; this.high = 0; this.low = parseInt(numberStr, 10); } UInt64.prototype.Equals = function (numberStr) { var tmp = new UInt64(numberStr); return this.low === tmp.low && this.high === tmp.high; }; return UInt64; }()); exports.UInt64 = UInt64; var Number = /** @class */ (function () { function Number() { } Number.ToByte = function (value) { return this.ToUInt8(value); }; Number.ToInt16 = function (value) { var signMask = (value & 0x8000) << 16 >> 16; return (value & 0x7fff) | signMask; }; Number.ToInt32 = function (value) { var signMask = (value & 0x80000000); return (value & 0x7fffffff) | signMask; }; Number.ToUInt8 = function (value) { return value & 0xff; }; Number.ToUInt32 = function (value) { return value & 0xffffffff; }; return Number; }()); exports.Number = Number; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Enums.ts * Author: Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 * Common enum values used in the SDK. */ Object.defineProperty(exports, "__esModule", { value: true }); var AWTPiiKind; (function (AWTPiiKind) { AWTPiiKind[AWTPiiKind["NotSet"] = 0] = "NotSet"; AWTPiiKind[AWTPiiKind["DistinguishedName"] = 1] = "DistinguishedName"; AWTPiiKind[AWTPiiKind["GenericData"] = 2] = "GenericData"; AWTPiiKind[AWTPiiKind["IPV4Address"] = 3] = "IPV4Address"; AWTPiiKind[AWTPiiKind["IPv6Address"] = 4] = "IPv6Address"; AWTPiiKind[AWTPiiKind["MailSubject"] = 5] = "MailSubject"; AWTPiiKind[AWTPiiKind["PhoneNumber"] = 6] = "PhoneNumber"; AWTPiiKind[AWTPiiKind["QueryString"] = 7] = "QueryString"; AWTPiiKind[AWTPiiKind["SipAddress"] = 8] = "SipAddress"; AWTPiiKind[AWTPiiKind["SmtpAddress"] = 9] = "SmtpAddress"; AWTPiiKind[AWTPiiKind["Identity"] = 10] = "Identity"; AWTPiiKind[AWTPiiKind["Uri"] = 11] = "Uri"; AWTPiiKind[AWTPiiKind["Fqdn"] = 12] = "Fqdn"; // Supports scrubbing of the last octet in a IPV4 address. E.g. 10.121.227.147 becomes 10.121.227.* AWTPiiKind[AWTPiiKind["IPV4AddressLegacy"] = 13] = "IPV4AddressLegacy"; })(AWTPiiKind = exports.AWTPiiKind || (exports.AWTPiiKind = {})); /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * AWTBondSerializer.ts * Author: Brent Erickson (brericks) and Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 * Class to handler bond serialization. */ Object.defineProperty(exports, "__esModule", { value: true }); var Bond = __webpack_require__(9); var Enums_1 = __webpack_require__(1); var Utils = __webpack_require__(3); var AWTBondSerializer = /** @class */ (function () { function AWTBondSerializer() { } AWTBondSerializer.getPayloadBlob = function (requestDictionary, tokenCount) { var stream = new Bond.IO.MemoryStream(); var writer = new Bond.CompactBinaryProtocolWriter(stream); // Begin ClientCollector request //Write TokenToDataPackagesMap writer.WriteFieldBegin(Bond.BondDataType.BT_MAP, 3); writer.WriteMapContainerBegin(tokenCount, Bond.BondDataType.BT_STRING, Bond.BondDataType.BT_LIST); Object.keys(requestDictionary).forEach(function (token) { //write token writer.WriteString(token); var dataPackage = requestDictionary[token]; // Write list of DataPackages writer.WriteContainerBegin(1, Bond.BondDataType.BT_STRUCT); // Source writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 2); writer.WriteString('act_default_source'); // DataPackageId writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 5); writer.WriteString(Utils.newGuid()); // Timestamp writer.WriteFieldBegin(Bond.BondDataType.BT_INT64, 6); writer.WriteInt64(Utils.numberToBondInt64(Date.now())); // Records writer.WriteFieldBegin(Bond.BondDataType.BT_LIST, 8); writer.WriteContainerBegin(dataPackage.length, Bond.BondDataType.BT_STRUCT); for (var i = 0; i < dataPackage.length; ++i) { writer.WriteBlob(dataPackage[i]); } writer.WriteStructEnd(false); }); // End ClientCollector writer.WriteStructEnd(false); return stream.GetBuffer(); }; // As per mappings at https://skype.visualstudio.com/SCC/F.S4L.FUNDAMENTALS/_git/infrastructure_data_clienttelemetry? // path=%2Fclienttelemetry%2Fsrc%2Fbond%2FDataPackage.bond&version=GBdev2&_a=contents // Requires that the values of AWTEventData.properties must all be AWTEventProperty AWTBondSerializer.getEventBlob = function (eventData) { var stream = new Bond.IO.MemoryStream(); var writer = new Bond.CompactBinaryProtocolWriter(stream); // ID writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 1); writer.WriteString(eventData.id); // Timestamp writer.WriteFieldBegin(Bond.BondDataType.BT_INT64, 3); writer.WriteInt64(Utils.numberToBondInt64(eventData.timestamp)); // Type writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 5); writer.WriteString(eventData.type); // Event Type writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 6); writer.WriteString(eventData.name); var propsString = []; var piiProps = []; // Iterate across event data properties and separate based on pii Object.keys(eventData.properties).forEach(function (key) { var property = eventData.properties[key]; if (property.pii === Enums_1.AWTPiiKind.NotSet) { propsString.push(key); } else { piiProps.push(key); } }); //Extension map if (propsString.length) { writer.WriteFieldBegin(Bond.BondDataType.BT_MAP, 13); writer.WriteMapContainerBegin(propsString.length, Bond.BondDataType.BT_STRING, Bond.BondDataType.BT_STRING); propsString.forEach(function (name) { writer.WriteString(name); writer.WriteString(eventData.properties[name].value); }); } // Pii if (piiProps.length) { writer.WriteFieldBegin(Bond.BondDataType.BT_MAP, 30); writer.WriteMapContainerBegin(piiProps.length, Bond.BondDataType.BT_STRING, Bond.BondDataType.BT_STRUCT); piiProps.forEach(function (name) { writer.WriteString(name); // PII Data // O365 scrubber type writer.WriteFieldBegin(Bond.BondDataType.BT_INT32, 1); writer.WriteInt32(1); // PII Kind writer.WriteFieldBegin(Bond.BondDataType.BT_INT32, 2); writer.WriteInt32(eventData.properties[name].pii); // Value writer.WriteFieldBegin(Bond.BondDataType.BT_STRING, 3); writer.WriteString(eventData.properties[name].value); writer.WriteStructEnd(false); }); } writer.WriteStructEnd(false); return stream.GetBuffer(); }; AWTBondSerializer.base64Encode = function (data) { return Bond.Encoding.Base64.GetString(data); }; return AWTBondSerializer; }()); exports.default = AWTBondSerializer; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Utils.ts * Author: Brent Erickson (brericks) and Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 * Common functions used in the SDK. */ var microsoft_bond_primitives_1 = __webpack_require__(0); var GuidRegex = /[xy]/g; function numberToBondInt64(value) { // Construct bond timestamp for aria var bond_value = new microsoft_bond_primitives_1.Int64('0'); bond_value.low = value & 0xffffffff; bond_value.high = Math.floor(value / 0x100000000); return bond_value; } exports.numberToBondInt64 = numberToBondInt64; function newGuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(GuidRegex, function (c) { var r = (Math.random() * 16 | 0), v = (c === 'x' ? r : r & 0x3 | 0x8); return v.toString(16); }); } exports.newGuid = newGuid; function isPii(value) { if (!isNaN(value) && value !== null && value >= 0 && value <= 13) { return true; } return false; } exports.isPii = isPii; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Version.ts * Author: Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 * Class for SDK version. */ exports.Version = '1.2.2'; exports.FullVersionString = 'AWT-Web-CJS-' + exports.Version; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * AriaSDK.ts * Author: Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 */ var Enums_1 = __webpack_require__(1); exports.AWTPiiKind = Enums_1.AWTPiiKind; var AWT_1 = __webpack_require__(13); exports.AWT = AWT_1.default; exports.AWT_COLLECTOR_URL_UNITED_STATES = 'https://us.pipe.aria.microsoft.com/Collector/3.0/'; exports.AWT_COLLECTOR_URL_GERMANY = 'https://de.pipe.aria.microsoft.com/Collector/3.0/'; exports.AWT_COLLECTOR_URL_JAPAN = 'https://jp.pipe.aria.microsoft.com/Collector/3.0/'; exports.AWT_COLLECTOR_URL_AUSTRALIA = 'https://au.pipe.aria.microsoft.com/Collector/3.0/'; exports.AWT_COLLECTOR_URL_EUROPE = 'https://eu.pipe.aria.microsoft.com/Collector/3.0/'; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * bond_const.ts * Copyright: Microsoft 2016 */ Object.defineProperty(exports, "__esModule", { value: true }); //------------------------------------------------------------------------------ // // This code was generated by a tool. // // Tool : bondc, Version=3.0.1, Build=bond-git.debug.not // Template : Microsoft.Bond.Rules.dll#TypeScript.tt // File : bond_const.ts // // Changes to this file may cause incorrect behavior and will be lost when // the code is regenerated. // //------------------------------------------------------------------------------ var BondDataType; (function (BondDataType) { BondDataType[BondDataType["BT_STOP"] = 0] = "BT_STOP"; BondDataType[BondDataType["BT_STOP_BASE"] = 1] = "BT_STOP_BASE"; BondDataType[BondDataType["BT_UINT8"] = 3] = "BT_UINT8"; BondDataType[BondDataType["BT_UINT32"] = 5] = "BT_UINT32"; BondDataType[BondDataType["BT_UINT64"] = 6] = "BT_UINT64"; BondDataType[BondDataType["BT_STRING"] = 9] = "BT_STRING"; BondDataType[BondDataType["BT_STRUCT"] = 10] = "BT_STRUCT"; BondDataType[BondDataType["BT_LIST"] = 11] = "BT_LIST"; BondDataType[BondDataType["BT_MAP"] = 13] = "BT_MAP"; BondDataType[BondDataType["BT_INT32"] = 16] = "BT_INT32"; BondDataType[BondDataType["BT_INT64"] = 17] = "BT_INT64"; BondDataType[BondDataType["BT_UNAVAILABLE"] = 127] = "BT_UNAVAILABLE"; })(BondDataType = exports.BondDataType || (exports.BondDataType = {})); /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * microsoft.bond.encoding.ts * Copyright: Microsoft 2016 */ Object.defineProperty(exports, "__esModule", { value: true }); var microsoft_bond_primitives_1 = __webpack_require__(0); var Utf8 = /** @class */ (function () { function Utf8() { } Utf8.GetBytes = function (value) { var array = []; for (var i = 0; i < value.length; ++i) { var char = value.charCodeAt(i); if (char < 0x80) { array.push(char); } else if (char < 0x800) { array.push(0xc0 | (char >> 6), 0x80 | (char & 0x3f)); } else if (char < 0xd800 || char >= 0xe000) { array.push(0xe0 | (char >> 12), 0x80 | ((char >> 6) & 0x3f), 0x80 | (char & 0x3f)); } else { char = 0x10000 + (((char & 0x3ff) << 10) | (value.charCodeAt(++i) & 0x3ff)); array.push(0xf0 | (char >> 18), 0x80 | ((char >> 12) & 0x3f), 0x80 | ((char >> 6) & 0x3f), 0x80 | (char & 0x3f)); } } return array; }; return Utf8; }()); exports.Utf8 = Utf8; var Base64 = /** @class */ (function () { function Base64() { } Base64.GetString = function (inArray) { var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var output = []; var paddingBytes = inArray.length % 3; var toBase64 = function (num) { return [lookup.charAt((num >> 18) & 0x3F), lookup.charAt((num >> 12) & 0x3F), lookup.charAt((num >> 6) & 0x3F), lookup.charAt(num & 0x3F)].join(''); }; for (var i = 0, length_1 = inArray.length - paddingBytes; i < length_1; i += 3) { var temp = (inArray[i] << 16) + (inArray[i + 1] << 8) + (inArray[i + 2]); output.push(toBase64(temp)); } switch (paddingBytes) { case 1: var temp = inArray[inArray.length - 1]; output.push(lookup.charAt(temp >> 2)); output.push(lookup.charAt((temp << 4) & 0x3F)); output.push('=='); break; case 2: var temp2 = (inArray[inArray.length - 2] << 8) + (inArray[inArray.length - 1]); output.push(lookup.charAt(temp2 >> 10)); output.push(lookup.charAt((temp2 >> 4) & 0x3F)); output.push(lookup.charAt((temp2 << 2) & 0x3F)); output.push('='); break; } return output.join(''); }; return Base64; }()); exports.Base64 = Base64; var Varint = /** @class */ (function () { function Varint() { } Varint.GetBytes = function (value) { var array = []; while (value & 0xffffff80) { array.push((value & 0x7f) | 0x80); value >>>= 7; } array.push(value & 0x7f); return array; }; return Varint; }()); exports.Varint = Varint; var Varint64 = /** @class */ (function () { function Varint64() { } Varint64.GetBytes = function (value) { var low = value.low; var high = value.high; var array = []; while (high || (0xffffff80 & low)) { array.push((low & 0x7f) | 0x80); low = ((high & 0x7f) << 25) | (low >>> 7); high >>>= 7; } array.push(low & 0x7f); return array; }; return Varint64; }()); exports.Varint64 = Varint64; var Zigzag = /** @class */ (function () { function Zigzag() { } Zigzag.EncodeZigzag32 = function (value) { value = microsoft_bond_primitives_1.Number.ToInt32(value); return ((value << 1) ^ (value >> (4 /*sizeof(int)*/ * 8 - 1))); }; Zigzag.EncodeZigzag64 = function (value) { var low = value.low; var high = value.high; var tmpH = (high << 1) | (low >>> 31); var tmpL = low << 1; if (high & 0x80000000) { tmpH = ~tmpH; tmpL = ~tmpL; } var res = new microsoft_bond_primitives_1.UInt64('0'); res.low = tmpL; res.high = tmpH; return res; }; return Zigzag; }()); exports.Zigzag = Zigzag; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * microsoft.bond.io.ts * Copyright: Microsoft 2016 */ Object.defineProperty(exports, "__esModule", { value: true }); var microsoft_bond_primitives_1 = __webpack_require__(0); var MemoryStream = /** @class */ (function () { function MemoryStream() { this._buffer = []; } /*override*/ MemoryStream.prototype.WriteByte = function (byte) { this._buffer.push(microsoft_bond_primitives_1.Number.ToByte(byte)); }; /*override*/ MemoryStream.prototype.Write = function (buffer, offset, count) { while (count--) { this.WriteByte(buffer[offset++]); } }; /** * Returns the array of unsigned bytes from which this stream was created. */ MemoryStream.prototype.GetBuffer = function () { return this._buffer; }; return MemoryStream; }()); exports.MemoryStream = MemoryStream; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * microsoft.bond.ts * Copyright: Microsoft 2016 */ Object.defineProperty(exports, "__esModule", { value: true }); var bond_const_1 = __webpack_require__(6); exports.BondDataType = bond_const_1.BondDataType; var Encoding = __webpack_require__(7); exports.Encoding = Encoding; var IO = __webpack_require__(8); exports.IO = IO; var microsoft_bond_primitives_1 = __webpack_require__(0); exports.Int64 = microsoft_bond_primitives_1.Int64; exports.UInt64 = microsoft_bond_primitives_1.UInt64; exports.Number = microsoft_bond_primitives_1.Number; var CompactBinaryProtocolWriter = /** @class */ (function () { function CompactBinaryProtocolWriter(stream) { this._stream = stream; } /*override*/ CompactBinaryProtocolWriter.prototype.WriteBlob = function (blob) { this._stream.Write(blob, 0, blob.length); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteContainerBegin = function (size, elementType) { this.WriteUInt8(elementType); this.WriteUInt32(size); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteMapContainerBegin = function (size, keyType, valueType) { this.WriteUInt8(keyType); this.WriteUInt8(valueType); this.WriteUInt32(size); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteFieldBegin = function (type, id) { if (id <= 5) { this._stream.WriteByte(type | (id << 5)); } else if (id <= 0xff) { this._stream.WriteByte(type | (6 << 5)); this._stream.WriteByte(id); } else { this._stream.WriteByte(type | (7 << 5)); this._stream.WriteByte(id); this._stream.WriteByte(id >> 8); } }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteInt32 = function (value) { value = Encoding.Zigzag.EncodeZigzag32(value); this.WriteUInt32(value); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteInt64 = function (value) { this.WriteUInt64(Encoding.Zigzag.EncodeZigzag64(value)); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteString = function (value) { if (value === '') { this.WriteUInt32(0 /*length*/); } else { var array = Encoding.Utf8.GetBytes(value); this.WriteUInt32(array.length); this._stream.Write(array, 0, array.length); } }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteStructEnd = function (isBase) { this.WriteUInt8(isBase ? bond_const_1.BondDataType.BT_STOP_BASE : bond_const_1.BondDataType.BT_STOP); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteUInt32 = function (value) { var array = Encoding.Varint.GetBytes(microsoft_bond_primitives_1.Number.ToUInt32(value)); this._stream.Write(array, 0, array.length); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteUInt64 = function (value) { var array = Encoding.Varint64.GetBytes(value); this._stream.Write(array, 0, array.length); }; /*override*/ CompactBinaryProtocolWriter.prototype.WriteUInt8 = function (value) { this._stream.WriteByte(microsoft_bond_primitives_1.Number.ToUInt8(value)); }; return CompactBinaryProtocolWriter; }()); exports.CompactBinaryProtocolWriter = CompactBinaryProtocolWriter; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SecToMsMultiplier = 1000; var AWTKillSwitch = /** @class */ (function () { function AWTKillSwitch() { this._killedTokenDictionary = {}; } AWTKillSwitch.prototype.setKillSwitchTenants = function (killTokens, killDuration) { var _this = this; if (killTokens && killDuration) { try { var killedTokens = killTokens.split(','); if (killDuration === 'this-request-only') { return killedTokens; } var durationMs_1 = parseInt(killDuration, 10) * SecToMsMultiplier; killedTokens.forEach(function (token) { _this._killedTokenDictionary[token] = Date.now() + durationMs_1; }); } catch (ex) { return []; } } return []; }; AWTKillSwitch.prototype.isTenantKilled = function (tenantToken) { if (this._killedTokenDictionary[tenantToken] !== undefined && this._killedTokenDictionary[tenantToken] > Date.now()) { return true; } delete this._killedTokenDictionary[tenantToken]; return false; }; return AWTKillSwitch; }()); exports.default = AWTKillSwitch; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AWTBondSerializer_1 = __webpack_require__(2); var AWTRecordBatcher = /** @class */ (function () { function AWTRecordBatcher(_maxRequestSize, _outboundQueue) { this._maxRequestSize = _maxRequestSize; this._outboundQueue = _outboundQueue; this._currentBatch = {}; this._currentBatchSize = 0; } AWTRecordBatcher.prototype.addEventToBatch = function (event) { var serializedEvent = AWTBondSerializer_1.default.getEventBlob(event); if (serializedEvent.length > this._maxRequestSize) { //single event too big return; } if (this._currentBatchSize + serializedEvent.length > this._maxRequestSize) { this.flushBatch(); } else { if (this._currentBatch[event.tenantToken] === undefined) { this._currentBatch[event.tenantToken] = []; } this._currentBatch[event.tenantToken].push(serializedEvent); this._currentBatchSize += serializedEvent.length; } }; AWTRecordBatcher.prototype.flushBatch = function () { if (this._currentBatchSize > 0) { this._outboundQueue.push(this._currentBatch); this._currentBatch = {}; this._currentBatchSize = 0; } }; return AWTRecordBatcher; }()); exports.default = AWTRecordBatcher; /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * AWTRetryPolicy.ts * Author: Abhilash Panwar (abpanwar) * Copyright: Microsoft 2016 * Class for retry policy. */ var RandomizationLowerThreshold = 0.8; var RandomizationUpperThreshold = 1.2; var BaseBackoff = 3000; var MaxBackoff = 120000; var AWTRetryPolicy = /** @class */ (function () { function AWTRetryPolicy() { } AWTRetryPolicy.shouldRetryForStatus = function (httpStatusCode) { /* The below expression reads that we should only retry for: - HttpStatusCodes that are smaller than 300. - HttpStatusCodes greater or equal to 500 (except for 501-NotImplement and 505-HttpVersionNotSupport). - HttpStatusCode 408-RequestTimeout. This is based on Microsoft.WindowsAzure.Storage.RetryPolicies.ExponentialRetry class */ return !((httpStatusCode >= 300 && httpStatusCode < 500 && httpStatusCode !== 408) || (httpStatusCode === 501) || (httpStatusCode === 505)); }; AWTRetryPolicy.getMillisToBackoffForRetry = function (retriesSoFar) { var waitDuration = 0; var minBackoff = BaseBackoff * RandomizationLowerThreshold; var maxBackoff = BaseBackoff * RandomizationUpperThreshold; var randomBackoff = Math.floor(Math.random() * (maxBackoff - minBackoff)) + minBackoff; waitDuration = Math.pow(4, retriesSoFar) * randomBackoff; return Math.min(waitDuration, MaxBackoff); }; return AWTRetryPolicy; }()); exports.default = AWTRetryPolicy; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Enums_1 = __webpack_require__(1); var AWTTransmissionManager_1 = __webpack_require__(14); var Utils = __webpack_require__(3); var Version = __webpack_require__(4); var AllTokens = 'allTkns'; var EventNameAndTypeRegex = /^[a-zA-Z0-9]([a-zA-Z0-9]|_){2,98}[a-zA-Z0-9]$/; var EventNameDotRegex = /\./g; var PropertyNameRegex = /^[a-zA-Z0-9](([a-zA-Z0-9|_|\.]){0,98}[a-zA-Z0-9])?$/; var AWT = /** @class */ (function () { function AWT() { } AWT.initialize = function (tenantToken, configuration) { if (configuration === void 0) { configuration = {}; } if (this._isInitialized) { // tslint:disable-next-line throw 'Already Initialized'; } this._defaultTenantToken = tenantToken; this._overrideValuesFromConfig(configuration); //Create sender AWTTransmissionManager_1.default.initialize(this._config); this._isInitialized = true; }; AWT.flush = function (callback) { if (this._isInitialized && !this._isDestroyed) { AWTTransmissionManager_1.default.flush(callback); } }; AWT.flushAndTeardown = function () { if (this._isInitialized && !this._isDestroyed) { this._isDestroyed = true; AWTTransmissionManager_1.default.flushAndTeardown(); } }; AWT.setContext = function (name, property, tenantToken) { if (tenantToken === void 0) { tenantToken = AllTokens; } property = this._sanitizeProperty(name, property); if (property === null) { return; } if (!this._contextProperties[tenantToken]) { this._contextProperties[tenantToken] = {}; } this._contextProperties[tenantToken][name] = property; }; AWT.logEvent = function (event) { var _this = this; if (this._isInitialized) { if (!event.name || !event.properties) { return; } event.name = event.name.toLowerCase(); event.name.replace(EventNameDotRegex, '_'); var typePrefix = ''; if (!event.type) { event.type = 'custom'; } else { event.type.toLowerCase(); typePrefix = 'custom.'; } if (!EventNameAndTypeRegex.test(event.name) || !EventNameAndTypeRegex.test(event.type)) { return; } event.type = typePrefix + event.type; if (isNaN(event.timestamp)) { event.timestamp = (new Date()).getTime(); } if (!event.tenantToken) { event.tenantToken = this._defaultTenantToken; } event.id = Utils.newGuid(); Object.keys(event.properties).forEach(function (name) { event.properties[name] = _this._sanitizeProperty(name, event.properties[name]); if (event.properties[name] === null) { delete event.properties[name]; } }); this._addContextIfAbsent(event, event.tenantToken); this._addContextIfAbsent(event, AllTokens); if (Object.keys(event.properties).length === 0) { return; } this._setDefaultProperty(event, 'EventInfo.InitId', this._getInitId(event.tenantToken)); this._setDefaultProperty(event, 'EventInfo.Sequence', this._getSequenceId(event.tenantToken)); this._setDefaultProperty(event, 'EventInfo.SdkVersion', Version.FullVersionString); this._setDefaultProperty(event, 'EventInfo.Name', event.name); this._setDefaultProperty(event, 'EventInfo.Time', (new Date(event.timestamp)).toISOString()); AWTTransmissionManager_1.default.sendEvent(event); } }; AWT._overrideValuesFromConfig = function (config) { if (config.collectorUrl) { this._config.collectorUrl = config.collectorUrl; } if (config.sendingTimer > 1000) { this._config.sendingTimer = config.sendingTimer; } }; AWT._getInitId = function (tenantToken) { if (this._initIdMap[tenantToken] === undefined) { this._initIdMap[tenantToken] = Utils.newGuid(); } return this._initIdMap[tenantToken]; }; AWT._getSequenceId = function (tenantToken) { if (this._sequenceIdMap[tenantToken] === undefined) { this._sequenceIdMap[tenantToken] = 0; } return (++this._sequenceIdMap[tenantToken]).toString(); }; AWT._setDefaultProperty = function (event, name, value) { event.properties[name] = { value: value, pii: Enums_1.AWTPiiKind.NotSet }; }; AWT._addContextIfAbsent = function (event, tenantToken) { if (this._contextProperties[tenantToken]) { var context_1 = this._contextProperties[tenantToken]; Object.keys(context_1).forEach(function (name) { if (!event.properties[name]) { event.properties[name] = context_1[name]; } }); } }; AWT._sanitizeProperty = function (name, property) { if (typeof property === 'string' || typeof property === 'number' || typeof property === 'boolean') { property = { value: property }; } if (!PropertyNameRegex.test(name) || property === undefined || property === null || property.value === null || property.value === undefined || property.value === '') { return null; } if (typeof property.pii === 'undefined') { property.pii = Enums_1.AWTPiiKind.NotSet; } property.value = property.value.toString(); return Utils.isPii(property.pii) ? property : null; }; AWT._isInitialized = false; AWT._isDestroyed = false; AWT._contextProperties = {}; AWT._sequenceIdMap = {}; AWT._initIdMap = {}; AWT._config = { collectorUrl: 'https://browser.pipe.aria.microsoft.com/Collector/3.0/', sendingTimer: 1000 }; return AWT; }()); exports.default = AWT; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AWTRecordBatcher_1 = __webpack_require__(11); var AWTBondSerializer_1 = __webpack_require__(2); var AWTRetryPolicy_1 = __webpack_require__(12); var AWTKillSwitch_1 = __webpack_require__(10); var Version = __webpack_require__(4); var FlushCheckTimer = 250; var RequestSizeLimitBytes = 2936012; //approx 2.8 Mb var MaxRetries = 4; var AWTTransmissionManager = /** @class */ (function () { function AWTTransmissionManager() { } AWTTransmissionManager.initialize = function (config) { this._inboundQueues.push([]); this._recordBatcher = new AWTRecordBatcher_1.default(RequestSizeLimitBytes, this._outboundQueue); this._newEventsAllowed = true; if (typeof Uint8Array === 'undefined') { this._urlString += '&content-encoding=base64'; } this._sendingTimer = config.sendingTimer; this._urlString = config.collectorUrl + this._urlString + '&x-apikey='; }; //Push the event into the inbound queue and return AWTTransmissionManager.sendEvent = function (event) { var _this = this; if (this._newEventsAllowed) { //Add event to the last inbound queue this._inboundQueues[this._inboundQueues.length - 1].push(event); if (!this._running && this._timeout < 0 && !this._isCurrentlyFlushing) { this._timeout = setTimeout(function () { return _this._batchAndSendEvents(false); }, this._sendingTimer); } } }; AWTTransmissionManager.flushAndTeardown = function () { this._newEventsAllowed = false; this._batchAndSendEvents(true); }; AWTTransmissionManager.flush = function (callback) { this._inboundQueues.push([]); if (!this._isCurrentlyFlushing) { this._isCurrentlyFlushing = true; this._flush(callback); } else { this._flushQueue.push(callback); } }; AWTTransmissionManager._batchAndSendEvents = function (isTeardown) { this._running = true; while (this._inboundQueues[0].length > 0 && this._outboundQueue.length < 1) { this._recordBatcher.addEventToBatch(this._inboundQueues[0].pop()); } if (this._outboundQueue.length === 0) { this._recordBatcher.flushBatch(); } this._sendRequest(this._outboundQueue.pop(), 0, isTeardown); }; AWTTransmissionManager._retryRequestIfNeeded = function (conn, request, tokenCount, apikey, retryCount) { var _this = this; var shouldRetry = true; if (conn && typeof conn.status !== 'undefined') { var killedTokens = this._killSwitch.setKillSwitchTenants(conn.getResponseHeader('kill-tokens'), conn.getResponseHeader('kill-duration-seconds')); killedTokens.forEach(function (key) { delete request[key]; tokenCount--; }); if (!AWTRetryPolicy_1.default.shouldRetryForStatus(conn.status) || tokenCount <= 0) { shouldRetry = false; } } if (shouldRetry && retryCount < MaxRetries) { setTimeout(function () { return _this._sendRequest(request, retryCount + 1, false); }, AWTRetryPolicy_1.default.getMillisToBackoffForRetry(retryCount)); } else { this._handleRequestFinished(null); } }; AWTTransmissionManager._sendRequest = function (request, retryCount, isTeardown) { var _this = this; try { var conn_1 = new XMLHttpRequest(); var tokenCount_1 = 0; var apikey_1 = ''; Object.keys(request).forEach(function (token) { if (!_this._killSwitch.isTenantKilled(token)) { if (apikey_1.length > 0) { apikey_1 += ','; } apikey_1 += token; tokenCount_1++; } else { delete request[token]; } }); conn_1.open('POST', this._urlString + apikey_1, !isTeardown); if (!isTeardown) { conn_1.ontimeout = function () { _this._retryRequestIfNeeded(conn_1, request, tokenCount_1, apikey_1, retryCount); }; conn_1.onerror = function () { _this._retryRequestIfNeeded(conn_1, request, tokenCount_1, apikey_1, retryCount); }; conn_1.onload = function () { _this._handleRequestFinished(conn_1); }; } if (tokenCount_1 > 0) { var blob = AWTBondSerializer_1.default.getPayloadBlob(request, tokenCount_1); if (typeof Uint8Array === 'undefined') { conn_1.send(AWTBondSerializer_1.default.base64Encode(blob)); } else { conn_1.send(new Uint8Array(blob)); } } else if (isTeardown) { this._handleRequestFinished(null); } } catch (e) { this._handleRequestFinished(null); } }; AWTTransmissionManager._handleRequestFinished = function (conn) { var _this = this; if (conn) { this._killSwitch.setKillSwitchTenants(conn.getResponseHeader('kill-tokens'), conn.getResponseHeader('kill-duration-seconds')); } if (this._inboundQueues[0].length > 0) { this._timeout = setTimeout(function () { return _this._batchAndSendEvents(false); }, this._sendingTimer); } else { this._timeout = -1; this._running = false; } }; AWTTransmissionManager._flush = function (callback) { var _this = this; if (!this._running) { if (this._timeout > -1) { clearTimeout(this._timeout); this._timeout = -1; } if (this._inboundQueues[0].length > 0) { this._batchAndSendEvents(false); } } this._checkPrimaryInboundQueueEmpty(function () { //Move the next queue to be primary _this._inboundQueues.shift(); if (callback !== null && callback !== undefined) { callback(); } if (_this._flushQueue.length > 0) { setTimeout(function () { return _this._flush(_this._flushQueue.shift()); }, _this._sendingTimer); } else { _this._isCurrentlyFlushing = false; if (_this._inboundQueues[0].length > 0) { _this._timeout = setTimeout(function () { return _this._batchAndSendEvents(false); }, _this._sendingTimer); } } }); }; AWTTransmissionManager._checkPrimaryInboundQueueEmpty = function (callback) { var _this = this; if (this._inboundQueues[0].length === 0) { this._checkOutboundQueueEmptyAndSent(callback); } else { setTimeout(function () { return _this._checkPrimaryInboundQueueEmpty(callback); }, FlushCheckTimer); } }; AWTTransmissionManager._checkOutboundQueueEmptyAndSent = function (callback) { var _this = this; if (!this._running) { callback(); } else { setTimeout(function () { return _this._checkOutboundQueueEmptyAndSent(callback); }, FlushCheckTimer); } }; AWTTransmissionManager._outboundQueue = []; AWTTransmissionManager._inboundQueues = []; AWTTransmissionManager._newEventsAllowed = false; AWTTransmissionManager._killSwitch = new AWTKillSwitch_1.default(); AWTTransmissionManager._isCurrentlyFlushing = false; AWTTransmissionManager._flushQueue = []; AWTTransmissionManager._running = false; AWTTransmissionManager._timeout = -1; AWTTransmissionManager._urlString = '?qsp=true&content-type=application%2Fbond-compact-binary&client-id=NO_AUTH&sdk-version=' + Version.FullVersionString; return AWTTransmissionManager; }()); exports.default = AWTTransmissionManager; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(5); /***/ }) /******/ ]); }); },{}],52:[function(require,module,exports){ (function (global){ /* html2canvas 0.5.0-beta3 Copyright (c) 2016 Niklas von Hertzen Released under License */ var Promise = require('es6-promise').Promise; !function(e) {window.OfficeBrowserFeedback.html2canvas = e}(function () {var define, module, exports;return (function e(t, n, r) {function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++) s(r[o]); return s})({1: [function (_dereq_, module, exports) { (function (global){ /*! http://mths.be/punycode v1.2.4 by @mathias */ ;(function(root) { /** Detect free variables */ var freeExports = typeof exports == 'object' && exports; var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; var freeGlobal = typeof global == 'object' && global; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { root = freeGlobal; } /** * The `punycode` object. * @name punycode * @type Object */ var punycode, /** Highest positive signed 32-bit float value */ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 /** Bootstring parameters */ base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, // 0x80 delimiter = '-', // '\x2D' /** Regular expressions */ regexPunycode = /^xn--/, regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators /** Error messages */ errors = { 'overflow': 'Overflow: input needs wider integers to process', 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', 'invalid-input': 'Invalid input' }, /** Convenience shortcuts */ baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, /** Temporary variable */ key; /*--------------------------------------------------------------------------*/ /** * A generic error utility function. * @private * @param {String} type The error type. * @returns {Error} Throws a `RangeError` with the applicable error message. */ function error(type) { throw RangeError(errors[type]); } /** * A generic `Array#map` utility function. * @private * @param {Array} array The array to iterate over. * @param {Function} callback The function that gets called for every array * item. * @returns {Array} A new array of values returned by the callback function. */ function map(array, fn) { var length = array.length; while (length--) { array[length] = fn(array[length]); } return array; } /** * A simple `Array#map`-like wrapper to work with domain name strings. * @private * @param {String} domain The domain name. * @param {Function} callback The function that gets called for every * character. * @returns {Array} A new string of characters returned by the callback * function. */ function mapDomain(string, fn) { return map(string.split(regexSeparators), fn).join('.'); } /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. * @see `punycode.ucs2.encode` * @see * @memberOf punycode.ucs2 * @name decode * @param {String} string The Unicode input string (UCS-2). * @returns {Array} The new array of code points. */ function ucs2decode(string) { var output = [], counter = 0, length = string.length, value, extra; while (counter < length) { value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // high surrogate, and there is a next character extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // low surrogate output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // unmatched surrogate; only append this code unit, in case the next // code unit is the high surrogate of a surrogate pair output.push(value); counter--; } } else { output.push(value); } } return output; } /** * Creates a string based on an array of numeric code points. * @see `punycode.ucs2.decode` * @memberOf punycode.ucs2 * @name encode * @param {Array} codePoints The array of numeric code points. * @returns {String} The new Unicode string (UCS-2). */ function ucs2encode(array) { return map(array, function(value) { var output = ''; if (value > 0xFFFF) { value -= 0x10000; output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); value = 0xDC00 | value & 0x3FF; } output += stringFromCharCode(value); return output; }).join(''); } /** * Converts a basic code point into a digit/integer. * @see `digitToBasic()` * @private * @param {Number} codePoint The basic numeric code point value. * @returns {Number} The numeric value of a basic code point (for use in * representing integers) in the range `0` to `base - 1`, or `base` if * the code point does not represent a value. */ function basicToDigit(codePoint) { if (codePoint - 48 < 10) { return codePoint - 22; } if (codePoint - 65 < 26) { return codePoint - 65; } if (codePoint - 97 < 26) { return codePoint - 97; } return base; } /** * Converts a digit/integer into a basic code point. * @see `basicToDigit()` * @private * @param {Number} digit The numeric value of a basic code point. * @returns {Number} The basic code point whose value (when used for * representing integers) is `digit`, which needs to be in the range * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is * used; else, the lowercase form is used. The behavior is undefined * if `flag` is non-zero and `digit` has no uppercase form. */ function digitToBasic(digit, flag) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); } /** * Bias adaptation function as per section 3.4 of RFC 3492. * http://tools.ietf.org/html/rfc3492#section-3.4 * @private */ function adapt(delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); } /** * Converts a Punycode string of ASCII-only symbols to a string of Unicode * symbols. * @memberOf punycode * @param {String} input The Punycode string of ASCII-only symbols. * @returns {String} The resulting string of Unicode symbols. */ function decode(input) { // Don't use UCS-2 var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t, /** Cached calculation results */ baseMinusT; // Handle the basic code points: let `basic` be the number of input code // points before the last delimiter, or `0` if there is none, then copy // the first basic code points to the output. basic = input.lastIndexOf(delimiter); if (basic < 0) { basic = 0; } for (j = 0; j < basic; ++j) { // if it's not a basic code point if (input.charCodeAt(j) >= 0x80) { error('not-basic'); } output.push(input.charCodeAt(j)); } // Main decoding loop: start just after the last delimiter if any basic code // points were copied; start at the beginning otherwise. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { // `index` is the index of the next character to be consumed. // Decode a generalized variable-length integer into `delta`, // which gets added to `i`. The overflow checking is easier // if we increase `i` as we go, then subtract off its starting // value at the end to obtain `delta`. for (oldi = i, w = 1, k = base; /* no condition */; k += base) { if (index >= inputLength) { error('invalid-input'); } digit = basicToDigit(input.charCodeAt(index++)); if (digit >= base || digit > floor((maxInt - i) / w)) { error('overflow'); } i += digit * w; t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (digit < t) { break; } baseMinusT = base - t; if (w > floor(maxInt / baseMinusT)) { error('overflow'); } w *= baseMinusT; } out = output.length + 1; bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`, // incrementing `n` each time, so we'll fix that now: if (floor(i / out) > maxInt - n) { error('overflow'); } n += floor(i / out); i %= out; // Insert `n` at position `i` of the output output.splice(i++, 0, n); } return ucs2encode(output); } /** * Converts a string of Unicode symbols to a Punycode string of ASCII-only * symbols. * @memberOf punycode * @param {String} input The string of Unicode symbols. * @returns {String} The resulting Punycode string of ASCII-only symbols. */ function encode(input) { var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], /** `inputLength` will hold the number of code points in `input`. */ inputLength, /** Cached calculation results */ handledCPCountPlusOne, baseMinusT, qMinusT; // Convert the input in UCS-2 to Unicode input = ucs2decode(input); // Cache the length inputLength = input.length; // Initialize the state n = initialN; delta = 0; bias = initialBias; // Handle the basic code points for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < 0x80) { output.push(stringFromCharCode(currentValue)); } } handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled; // `basicLength` is the number of basic code points. // Finish the basic string - if it is not empty - with a delimiter if (basicLength) { output.push(delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next // larger one: for (m = maxInt, j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's state to , // but guard against overflow handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error('overflow'); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error('overflow'); } if (currentValue == n) { // Represent delta as a generalized variable-length integer for (q = delta, k = base; /* no condition */; k += base) { t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); } /** * Converts a Punycode string representing a domain name to Unicode. Only the * Punycoded parts of the domain name will be converted, i.e. it doesn't * matter if you call it on a string that has already been converted to * Unicode. * @memberOf punycode * @param {String} domain The Punycode domain name to convert to Unicode. * @returns {String} The Unicode representation of the given Punycode * string. */ function toUnicode(domain) { return mapDomain(domain, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } /** * Converts a Unicode string representing a domain name to Punycode. Only the * non-ASCII parts of the domain name will be converted, i.e. it doesn't * matter if you call it with a domain that's already in ASCII. * @memberOf punycode * @param {String} domain The domain name to convert, as a Unicode string. * @returns {String} The Punycode representation of the given domain name. */ function toASCII(domain) { return mapDomain(domain, function(string) { return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; }); } /*--------------------------------------------------------------------------*/ /** Define the public API */ punycode = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ 'version': '1.2.4', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see * @memberOf punycode * @type Object */ 'ucs2': { 'decode': ucs2decode, 'encode': ucs2encode }, 'decode': decode, 'encode': encode, 'toASCII': toASCII, 'toUnicode': toUnicode }; /** Expose `punycode` */ // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) { define('punycode', function() { return punycode; }); } else if (freeExports && !freeExports.nodeType) { if (freeModule) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = punycode; } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],2:[function(_dereq_,module,exports){ var log = _dereq_('./log'); function restoreOwnerScroll(ownerDocument, x, y) { if (ownerDocument.defaultView && (x !== ownerDocument.defaultView.pageXOffset || y !== ownerDocument.defaultView.pageYOffset)) { ownerDocument.defaultView.scrollTo(x, y); } } function cloneCanvasContents(canvas, clonedCanvas) { try { if (clonedCanvas) { clonedCanvas.width = canvas.width; clonedCanvas.height = canvas.height; clonedCanvas.getContext("2d").putImageData(canvas.getContext("2d").getImageData(0, 0, canvas.width, canvas.height), 0, 0); } } catch(e) { log("Unable to copy canvas content from", canvas, e); } } function cloneNode(node, javascriptEnabled) { var clone = node.nodeType === 3 ? document.createTextNode(node.nodeValue) : node.cloneNode(false); var child = node.firstChild; while(child) { if (javascriptEnabled === true || child.nodeType !== 1 || child.nodeName !== 'SCRIPT') { clone.appendChild(cloneNode(child, javascriptEnabled)); } child = child.nextSibling; } if (node.nodeType === 1) { clone._scrollTop = node.scrollTop; clone._scrollLeft = node.scrollLeft; if (node.nodeName === "CANVAS") { cloneCanvasContents(node, clone); } else if (node.nodeName === "TEXTAREA" || node.nodeName === "SELECT") { clone.value = node.value; } } return clone; } function initNode(node) { if (node.nodeType === 1) { node.scrollTop = node._scrollTop; node.scrollLeft = node._scrollLeft; var child = node.firstChild; while(child) { initNode(child); child = child.nextSibling; } } } module.exports = function(ownerDocument, containerDocument, width, height, options, x ,y) { var documentElement = cloneNode(ownerDocument.documentElement, options.javascriptEnabled); var container = containerDocument.createElement("iframe"); container.className = "html2canvas-container"; container.style.visibility = "hidden"; container.style.position = "fixed"; container.style.left = "-10000px"; container.style.top = "0px"; container.style.border = "0"; container.width = width; container.height = height; container.scrolling = "no"; // ios won't scroll without it containerDocument.body.appendChild(container); return new Promise(function(resolve) { var documentClone = container.contentWindow.document; /* Chrome doesn't detect relative background-images assigned in inline