Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var QueueIt;
- (function(b) {
- var a;
- (function(c) {
- var d = (function() {
- function e(f, g) {
- this.callbackArray = new Array();
- this.customerId = f;
- this.eventId = g
- }
- e.prototype.modelUpdated = function(f) {
- this.callbackArray.push(f)
- }
- ;
- e.prototype.doCallbacks = function(f) {
- for (var h = 0; h < this.callbackArray.length; h++) {
- try {
- if ($.isFunction(this.callbackArray[h])) {
- this.callbackArray[h](f)
- }
- } catch (g) {
- window.logger.Error({
- Message: "Error executing callback: " + g.message,
- Ex: g
- }, this.eventId, this.customerId)
- }
- }
- }
- ;
- e.prototype.logAjaxCallError = function(i, h, j, g, f) {
- if (f === void 0) {
- f = ""
- }
- if (!h) {
- return
- }
- if (h.status != 503 && h.status != 504) {
- window.logger.Error({
- Page: i,
- Message: "Error in ajax call," + f + " responseText: " + h.responseText + "; textstatus: " + j + "; errorThrown: " + g + "; jqXHR.status:" + h.status
- }, this.eventId, this.customerId)
- } else {
- console.info("server call error")
- }
- }
- ;
- return e
- })();
- c.ViewBase = d
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var __extends = (this && this.__extends) || function(e, c) {
- for (var f in c) {
- if (c.hasOwnProperty(f)) {
- e[f] = c[f]
- }
- }
- function a() {
- this.constructor = e
- }
- a.prototype = c.prototype;
- e.prototype = new a()
- }
- ;
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function(e) {
- __extends(f, e);
- function f(g, h, k, i, j) {
- e.call(this, g, h);
- this.jsErrors = 0;
- this.updateInterval = 5000;
- this.creole = new Parse.Simple.Creole({
- forIE: document.all
- });
- this.queueId = k;
- this.language = i;
- this.layoutName = j;
- this.message = ko.observable()
- }
- f.prototype.ajaxGetMessage = function() {
- var g = this;
- $.ajax({
- type: "GET",
- contentType: "application/json",
- url: "/after/" + this.customerId + "/" + this.eventId + "/" + this.queueId + "/status?cid=" + this.language + "&l=" + this.layoutName,
- success: function(h) {
- var i = h.redirectUrl;
- if (i) {
- document.location.href = i;
- return
- }
- g.refreshClientInfo(h);
- g.jsErrors = 0
- },
- error: function(i, j, h) {
- g.jsErrors = g.jsErrors + 1;
- g.logAjaxCallError("AfterPage", i, j, h)
- }
- })
- }
- ;
- f.prototype.updateTimer = function() {
- var g = this;
- setTimeout(function() {
- g.ajaxGetMessage();
- g.updateTimer()
- }, this.updateInterval)
- }
- ;
- f.prototype.getCreole = function() {
- return this.creole
- }
- ;
- f.prototype.init = function() {
- this.updateTimer()
- }
- ;
- f.prototype.refreshClientInfo = function(g) {
- this.updateInterval = g.updateInterval ? g.updateInterval : 5000;
- if (g.message && g.message.text) {
- this.message(new d.Message(g.message))
- } else {
- this.message(null )
- }
- }
- ;
- return f
- })(d.ViewBase);
- d.AfterView = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(e) {
- var d = (function(f) {
- __extends(g, f);
- function g(j, l, n, p, m, k, h, o, i) {
- f.call(this, j, l);
- this.jsErrors = 0;
- this.updateInterval = 5000;
- this.creole = new Parse.Simple.Creole({
- forIE: document.all
- });
- this.clientInfo = i;
- this.queueId = n;
- this.targetUrl = p;
- this.language = m;
- this.customUrlParams = k;
- this.appType = h;
- this.sdkVersion = o
- }
- g.prototype.ajaxQueueStatus = function() {
- var h = this;
- var i = "/before/" + this.customerId + "/" + this.eventId + "/" + this.queueId + "/status?cid=" + this.language + "&l=" + this.status.lastLayoutName();
- $.ajax({
- type: "POST",
- dataType: "json",
- contentType: "application/json",
- data: JSON.stringify({
- targetUrl: this.targetUrl,
- customUrlParams: this.customUrlParams,
- layoutVersion: this.status.lastLayoutVersion(),
- layoutName: this.status.lastLayoutName()
- }),
- url: i,
- success: function(j) {
- var k = j.redirectUrl;
- if (k != undefined) {
- document.location.href = k;
- return
- }
- h.refreshClientInfo(j);
- h.jsErrors = 0;
- h.isRunning(true)
- },
- error: function(k, l, j) {
- h.jsErrors = h.jsErrors + 1;
- h.logAjaxCallError("BeforePage", k, l, j)
- }
- })
- }
- ;
- g.prototype.setDetailStatusData = function(h) {
- this.status.eventStartTimeFormatted(h.eventStartTimeFormatted);
- this.status.secondsToStart(h.secondsToStart);
- this.status.timeZonePostfix(h.timeZonePostfix);
- this.status.usersInQueue(h.usersInQueue);
- this.status.lastLayoutVersion(h.lastLayoutVersion);
- this.status.lastLayoutName(h.lastLayoutName)
- }
- ;
- g.prototype.refreshClientInfo = function(h) {
- this.doCallbacks(h);
- this.updateInterval = (h.details.updateInterval) ? h.details.updateInterval : 40000;
- var j = h.details.secondsToStart;
- $("#defaultCountdown").countdown("option", {
- until: j
- });
- this.setDetailStatusData(h.details);
- if (h.layout) {
- this.layout.refresh(h.layout, false)
- }
- if (h.texts) {
- var i = h.texts.styleSheets;
- if (this.texts.styleSheets && this.texts.styleSheets != i) {
- this.switchPageCss(i)
- }
- this.texts.refresh(h.texts)
- }
- this.processMessageInfo(h)
- }
- ;
- g.prototype.switchPageCss = function(h) {
- $("head< link").filter("[href$='.css']").remove();
- $("head").html(h)
- }
- ;
- g.prototype.processMessageInfo = function(h) {
- if (h.message && h.message.text) {
- this.message(new e.Message(h.message))
- } else {
- this.message(null )
- }
- if (h.message && h.message.text) {
- if ($.isFunction(window.addMessageToFeed)) {
- window.addMessageToFeed({
- id: h.message.id,
- header: h.message.header,
- text: h.message.text,
- avatar: h.message.avatar,
- timestamp: h.message.timestamp
- })
- }
- }
- }
- ;
- g.prototype.updateTimer = function() {
- var h = this;
- setTimeout(function() {
- h.ajaxQueueStatus();
- h.updateTimer()
- }, this.updateInterval)
- }
- ;
- g.prototype.flashTimer = function() {
- var h = this;
- setTimeout(function() {
- if (h.jsErrors == 0) {
- $("#Pb1").toggleClass("active")
- } else {
- $("#Pb1").removeClass("active")
- }
- if (h.jsErrors > 3) {
- h.isRunning(false)
- }
- h.flashTimer()
- }, 2000)
- }
- ;
- g.prototype.getCreole = function() {
- return this.creole
- }
- ;
- g.prototype.init = function(h) {
- if (h === void 0) {
- h = true
- }
- this.doCallbacks(this.clientInfo);
- this.message = ko.observable();
- this.isRunning = ko.observable(true);
- this.status = new c();
- this.setDetailStatusData(this.clientInfo.details);
- this.layout = new e.Layout(this.clientInfo.layout,false);
- this.texts = new e.InQueueTexts(this.clientInfo.texts);
- this.processMessageInfo(this.clientInfo);
- if (h) {
- this.updateTimer();
- this.flashTimer()
- }
- }
- ;
- return g
- })(e.ViewBase);
- e.BeforeView = d;
- var c = (function() {
- function f() {
- this.eventStartTimeFormatted = ko.observable();
- this.timeZonePostfix = ko.observable();
- this.secondsToStart = ko.observable();
- this.usersInQueue = ko.observable(0);
- this.lastLayoutVersion = ko.observable();
- this.lastLayoutName = ko.observable()
- }
- return f
- })();
- e.BeforeStatusDetails = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function() {
- function e() {
- var f = this;
- try {
- document.addEventListener("visibilitychange", (function() {
- return f.handleVisibilityChange()
- }), false)
- } catch (g) {
- window.logger.Debug({
- Message: "Error in adding visibilitychange",
- Ex: g
- })
- }
- try {
- document.addEventListener("mozvisibilitychange", (function() {
- return f.handleVisibilityChange()
- }), false)
- } catch (g) {
- window.logger.Debug({
- Message: "Error in adding mozvisibilitychange",
- Ex: g
- })
- }
- try {
- document.addEventListener("webkitvisibilitychange", (function() {
- return f.handleVisibilityChange()
- }), false)
- } catch (g) {
- window.logger.Debug({
- Message: "Error in adding webkitvisibilitychange",
- Ex: g
- })
- }
- try {
- document.addEventListener("msvisibilitychange", (function() {
- return f.handleVisibilityChange()
- }), false)
- } catch (g) {
- window.logger.Debug({
- Message: "Error in adding msvisibilitychange",
- Ex: g
- })
- }
- }
- e.prototype.handleVisibilityChange = function() {
- var f = document;
- this._isHidden = (f.hidden || f.mozHidden || f.webkitHidden || f.msHidden)
- }
- ;
- e.prototype.isHidden = function() {
- return this._isHidden
- }
- ;
- return e
- })();
- d.InactivityDetector = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function(e) {
- __extends(f, e);
- function f(i, j, h) {
- var g = this;
- e.call(this, i.customerId, i.eventId);
- this.redirector = j;
- this.cssReplacer = h;
- this._firstInLine = false;
- this._soundIsPlayingFlag = false;
- this.isRedirectPromptDialogConfirmed = null ;
- this._logSoundPlayerInfo = {
- SoundPlayer_setup_IsCalled: false,
- SoundPlayer_onready_IsCalled: false,
- SoundPlayer_onready_Exception: false
- };
- this.waitingStateUpdateInterval = 60 * 1000;
- this.getStatus = function() {
- return g.status
- }
- ;
- this.getIsRedirectedToTarget = function() {
- return g.isRedirectedToTarget
- }
- ;
- this.getQueueId = function() {
- return g.options.queueId
- }
- ;
- this.updateNotify = function() {
- var k = this;
- $.ajax({
- type: "POST",
- dataType: "json",
- contentType: "application/json",
- data: JSON.stringify({
- email: this.emailAddress(),
- targetUrl: this.options.targetUrl,
- customUrlParams: this.options.customUrlParams
- }),
- url: "queue/" + this.options.customerId + "/" + this.options.eventId + "/" + this.options.queueId + "/UpdateEmail/?cid=" + ((this.options.culture) ? this.options.culture : "") + "&l=" + this.options.layout,
- success: function(l) {
- k.notify(l.Message, l.Status)
- },
- error: function(m, n, l) {
- k.notify("Error subscribing", "error");
- k.logAjaxCallError("InquePage", m, n, l, "Error subscribing")
- }
- })
- }
- ;
- this.options = i;
- this.status = "NotReadyYet";
- this.updateInterval = 2000;
- this.notReadyCount = 0;
- this.jsErrorCount = 0;
- this.lastTryUpdate = new Date();
- this.lastLayoutVersion = i.forecast.forecast.layoutVersion;
- this.lastLayoutName = i.forecast.forecast.layoutName;
- this.detector = new d.InactivityDetector();
- if (!this.redirector) {
- this.redirector = {
- redirect: function(k) {
- if (!k) {
- window.location.reload()
- } else {
- window.location.href = k
- }
- }
- }
- }
- if (!this.cssReplacer) {
- this.cssReplacer = {
- replace: function(k) {
- $("head< link").filter("[href$='.css']").remove();
- $("head").append(k)
- }
- }
- }
- this.creole = new Parse.Simple.Creole({
- forIE: document.all
- })
- }
- f.prototype.get_firstInLine = function() {
- return this._firstInLine
- }
- ;
- f.prototype.set_firstInLine = function(g) {
- if (this._firstInLine != g) {
- this._firstInLine = g;
- if (g && window.welcomeAudioPlayer) {
- this.playWelcomeSound()
- }
- }
- }
- ;
- f.prototype.init = function(g) {
- if (g === void 0) {
- g = true
- }
- this.doCallbacks(this.options.forecast);
- this.set_firstInLine(this.options.forecast.forecast.status == "FirstInLine");
- this.layout = new d.Layout(this.options.forecast.layout,this.get_firstInLine());
- this.message = this.options.forecast.message ? ko.observable(new d.Message(this.options.forecast.message)) : ko.observable();
- this.texts = new d.InQueueTexts(this.options.forecast.texts);
- this.ticket = new d.Ticket(this.options.forecast.ticket);
- this.isRunning = ko.observable(true);
- this.isRedirected = false;
- this.isRedirectedToTarget = false;
- this.emailAddress = ko.observable(this.options.emailAddress);
- this.isClientInactive = ko.observable(false);
- this.showConfirmRedirectDialog = ko.observable(false);
- this.initSoundTrack();
- if (g) {
- this.updateTimer();
- this.updateCheckTimer()
- }
- }
- ;
- f.prototype.getCreole = function() {
- return this.creole
- }
- ;
- f.prototype.refresh = function(g) {
- if (!g.forecast) {
- return
- }
- if (this.status != "NotReadyYet" && g.forecast && g.forecast.status == "NotReadyYet") {
- return
- }
- if (this.get_firstInLine() && g.forecast.status != "FirstInLine") {
- return
- }
- this.updateInterval = g.forecast.updateInterval;
- this.status = g.forecast.status;
- if (this.status === "NotReadyYet") {
- this.notReadyCount++
- }
- if (this.notReadyCount >= 10) {
- this.isRedirected = true;
- this.redirector.redirect()
- }
- this.doCallbacks(g);
- if (!this.isRedirectPromptDialogConfirmed && g.ticket.queuePaused == false && this.status == "FirstInLine") {
- if (this.layout.isRedirectPromptDialogEnabled || this.isClientInactive()) {
- if (this.ticket.windowStartTime()) {
- this.updateInterval = Math.max(this.updateInterval, this.waitingStateUpdateInterval)
- }
- this.showConfirmRedirectDialog(true);
- this.isRedirectPromptDialogConfirmed = false
- }
- }
- if (this.status == "FirstInLine") {
- this.set_firstInLine(true)
- }
- this.ticket.refresh(g.ticket);
- this.layout.refresh(g.layout, this.get_firstInLine());
- if (this.lastLayoutVersion >= g.forecast.layoutVersion && this.lastLayoutName == g.forecast.layoutName) {
- return
- }
- this.message(g.message ? new d.Message(g.message) : undefined);
- if (g.texts && g.texts.styleSheets !== this.texts.styleSheets) {
- this.cssReplacer.replace(g.texts.styleSheets)
- }
- this.texts.refresh(g.texts);
- this.initSoundTrack();
- this.lastLayoutVersion = g.forecast.layoutVersion;
- this.lastLayoutName = g.forecast.layoutName
- }
- ;
- f.prototype.updateTimer = function() {
- var g = this;
- setTimeout(function() {
- g.lastTryUpdate = new Date();
- if (!g.showConfirmRedirectDialog() && !g.isRedirectPromptDialogConfirmed) {
- g.isClientInactive(g.detector.isHidden())
- }
- g.ajaxGetForecast()
- }, this.updateInterval)
- }
- ;
- f.prototype.initSoundTrack = function() {
- var g = this;
- if (!window.welcomeAudioPlayer && this.texts.isWelcomeSoundEnabled) {
- try {
- this._logSoundPlayerInfo.SoundPlayer_setup_IsCalled = true;
- window.soundManager.setup({
- url: "/css/sound",
- debugMode: false,
- preferFlash: false,
- onready: function() {
- g._logSoundPlayerInfo.SoundPlayer_onready_IsCalled = true;
- try {
- window.welcomeAudioPlayer = window.soundManager.createSound({
- url: g.texts.notificationSoundUrls
- });
- if (g.get_firstInLine()) {
- g.playWelcomeSound()
- }
- } catch (i) {
- window.logger.Error({
- Message: "Error initing sound file",
- Ex: i,
- Page: "InqueuePage"
- }, g.eventId, g.customerId, g.options.queueId || "");
- g._logSoundPlayerInfo.SoundPlayer_onready_Exception = true
- }
- }
- })
- } catch (h) {
- window.logger.Error({
- Message: "Error setuping soundmanager",
- Ex: h,
- Page: "InqueuePage"
- }, this.eventId, this.customerId, this.options.queueId || "")
- }
- }
- }
- ;
- f.prototype.playWelcomeSound = function(i) {
- var g = this;
- try {
- this._soundIsPlayingFlag = true;
- setTimeout(function() {
- g._soundIsPlayingFlag = false
- }, 10000);
- if (this.texts.isWelcomeSoundEnabled) {
- if (window.welcomeAudioPlayer) {
- window.welcomeAudioPlayer.play({
- onfinish: function() {
- g._soundIsPlayingFlag = false;
- if (i) {
- i()
- }
- }
- })
- } else {
- window.logger.Debug({
- Message: "Not expected case in playing welcome sound"
- }, this.eventId, this.customerId, this.options.queueId || "", d.Helpers.ErrorSeverity.Information, this._logSoundPlayerInfo)
- }
- }
- } catch (h) {
- this._soundIsPlayingFlag = false;
- window.logger.Error({
- Message: "Error playing sound",
- Ex: h,
- Page: "InqueuePage"
- }, this.eventId, this.customerId, this.options.queueId || "")
- }
- }
- ;
- f.prototype.updateCheckTimer = function() {
- var g = this;
- setInterval(function() {
- if ((new Date().getTime() - g.lastTryUpdate.getTime()) > 1000 * 60) {
- setTimeout(function() {
- if ((new Date().getTime() - g.lastTryUpdate.getTime()) > 1000 * 60 * 2) {
- g.redirector.redirect()
- }
- }, 60000)
- }
- if (g.jsErrorCount == 0) {
- $("#defaultViewPb1").toggleClass("active")
- } else {
- $("#defaultViewPb1").removeClass("active")
- }
- if (g.jsErrorCount > 3) {
- g.isRunning(false)
- }
- }, 2000)
- }
- ;
- f.prototype.ajaxGetForecast = function(i, h) {
- var g = this;
- if (i === void 0) {
- i = this.isRedirectPromptDialogConfirmed
- }
- if (!this.isRedirected) {
- if (this._soundIsPlayingFlag) {
- this.updateTimer();
- return
- }
- var j = "/queue/" + this.options.customerId + "/" + this.options.eventId + "/" + this.options.queueId + "/getforecast?cid=" + ((this.options.culture) ? this.options.culture : "") + "&l=" + ((this.options.layout) ? this.options.layout : "");
- if (this.options.appType) {
- j += "&app=" + this.options.appType
- }
- if (this.options.sdkVersion) {
- j += "&sdkv=" + this.options.sdkVersion
- }
- $.ajax({
- type: "POST",
- dataType: "json",
- contentType: "application/json",
- data: JSON.stringify({
- targetUrl: this.options.targetUrl,
- customUrlParams: this.options.customUrlParams,
- layoutVersion: this.lastLayoutVersion,
- layoutName: this.lastLayoutName,
- isClientRedayToRedirect: this.GetClinetReadyToRedirect(i)
- }),
- url: j,
- success: function(k) {
- try {
- if (k.redirectUrl) {
- g.isRedirected = true;
- g.isRedirectedToTarget = k.isRedirectToTarget;
- if (!g.get_firstInLine()) {
- g._firstInLine = true;
- var m = setTimeout(function() {
- g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget)
- }, 10000);
- g.ticket.setProgressBar(100);
- g.playWelcomeSound(function() {
- clearTimeout(m);
- g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget)
- });
- return
- } else {
- g.redirector.redirect(k.redirectUrl, k.isRedirectToTarget);
- return
- }
- }
- g.refresh(k);
- g.jsErrorCount = 0;
- g.isRunning(true)
- } catch (l) {
- g.jsErrorCount++;
- window.logger.Error({
- Message: "Error in updating result ajaxGetForecast",
- Ex: l,
- Page: "InqueuePage"
- }, g.eventId, g.customerId, g.options.queueId || "")
- } finally {
- if (h) {
- h()
- }
- g.updateTimer()
- }
- },
- error: function(l, m, k) {
- g.logAjaxCallError("InquePage", l, m, k);
- try {
- if ($.isFunction(g.options.errorCallback)) {
- g.options.errorCallback()
- }
- } finally {
- g.jsErrorCount++;
- if (l && (l.status === 503 || l.status === 504)) {
- g.updateInterval *= 1.25;
- if (g.updateInterval > 40000 * 5) {
- g.updateInterval = 40000 * 5
- }
- }
- if (h) {
- h()
- }
- g.updateTimer()
- }
- }
- })
- }
- }
- ;
- f.prototype.notify = function(g, h) {
- $("#divEmailStatusFrame").removeClass().show().addClass(h == "Success" ? "submit_success alert alert-success" : "submit_failure alert alert-error").delay(20000).fadeOut().click(function() {
- $(this).stop(true, true).fadeOut()
- });
- $("#divEmailStatus").html(g)
- }
- ;
- f.prototype.setActiveClient = function() {
- var g = this;
- this.isClientInactive(false);
- this.showConfirmRedirectDialog(false);
- this.ajaxGetForecast(true, function() {
- g.isRedirectPromptDialogConfirmed = true
- })
- }
- ;
- f.prototype.GetClinetReadyToRedirect = function(g) {
- return g || (!this.layout.isRedirectPromptDialogEnabled && !this.isClientInactive())
- }
- ;
- return f
- })(d.ViewBase);
- d.InQueueView = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- function Cookie(b) {
- var c = this;
- this.name = b;
- this.get = function() {
- return a(b)
- }
- ;
- this.set = function(f, e) {
- if (!e) {
- e = 0
- }
- d(b, f, e)
- }
- ;
- this.clear = function() {
- this.setCookie(b, "")
- }
- ;
- function a(f) {
- var g, h, j, e = document.cookie.split(";");
- for (g = 0; g < e.length; g++) {
- h = e[g].substr(0, e[g].indexOf("="));
- j = e[g].substr(e[g].indexOf("=") + 1);
- h = h.replace(/^\s+|\s+$/g, "");
- if (h == f) {
- return decodeURIComponent(j)
- }
- }
- }
- function d(e, i, h) {
- var g = new Date();
- g.setMinutes(g.getMinutes() + h);
- var f = encodeURIComponent(i) + "; expires=" + g.toUTCString() + "; domain=.queue-it.net ; path=/";
- document.cookie = e + "=" + f
- }
- }
- function AjaxHelper(b) {
- var h = this;
- this.baseUrl = b;
- var c = false;
- try {
- var i = new XMLHttpRequest();
- if ("withCredentials" in i) {
- c = true
- }
- } catch (d) {}
- this.initialize = function() {
- if (c) {
- window.crossDomainRequestAsyncInit()
- } else {
- $("body").append('<iframe id="crossdomainajaxframe" name="crossdomainajaxframe" class="hidden" src="' + h.baseUrl + 'ajax/proxy"></iframe>')
- }
- }
- ;
- function f() {
- var e = new Cookie("MYQUEUEITASPXAUTH");
- return e.get()
- }
- this.get = function(j, e) {
- a(j, null , e, "GET")
- }
- ;
- this.post = function(k, e, j) {
- a(k, e, j, "POST")
- }
- ;
- this.put = function(k, e, j) {
- a(k, e, j, "PUT")
- }
- ;
- var a = function(o, j, m, n) {
- var e = f();
- var k = null ;
- if (e != null ) {
- k = {
- "X-Queueit-Auth": e
- }
- }
- o = b + o;
- if (c) {
- g(o, j, m, k, n)
- } else {
- var l = window.frames.crossdomainajaxframe;
- l.ajax(o, j, m, k, n)
- }
- }
- ;
- function g(m, e, k, j, l) {
- $.ajax(m, {
- type: l,
- dataType: "json",
- contentType: "application/json",
- data: e,
- headers: j,
- success: function(n) {
- if (k !== undefined && $.isFunction(k.onSuccess)) {
- k.onSuccess(n)
- }
- },
- error: function(n, o) {
- if (k !== undefined && $.isFunction(k.onError)) {
- k.onError()
- }
- },
- complete: function() {
- if (k !== undefined && $.isFunction(k.onComplete)) {
- k.onComplete()
- }
- },
- statusCode: {
- 401: function() {
- if (k !== undefined && $.isFunction(k.onUnauthorized)) {
- k.onUnauthorized()
- }
- }
- }
- })
- }
- }
- function GetQueueIdWhenRedirectedToTarget() {
- var a = window;
- if (!a.queueViewModel) {
- return null
- }
- if (!a.queueViewModel.getIsRedirectedToTarget) {
- return null
- }
- if (a.queueViewModel.getIsRedirectedToTarget()) {
- return a.queueViewModel.getQueueId()
- }
- }
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c;
- (function(f) {
- var g = (function() {
- function h() {
- var i = window.onerror;
- var j = this;
- window.onerror = function(m, n, l, k) {
- j.Error({
- Message: "Unhandled Exception in window.onerror: " + m + " , url:" + n + " lineno:" + l + " ,col:" + k
- }, null , null , null , e.Critical);
- if (i && typeof i === "function") {
- i.apply(window, arguments)
- }
- }
- }
- h.prototype.Log = function(m) {
- try {
- console.info(m.LogMessageInfo.Message + ((m.LogMessageInfo.Ex ? m.LogMessageInfo.Ex.message : "")));
- if (!this.logContainer) {
- this.logContainer = $("#queue-it_log");
- this.userId = this.logContainer.attr("data-userid");
- this.proxyUrl = this.logContainer.attr("data-proxyurl");
- if (!this.logContainer || !this.proxyUrl) {
- return
- }
- }
- var l = {};
- if (m.LogMessageInfo.Ex && m.LogMessageInfo.Ex.stack) {
- l.StackTrace = m.LogMessageInfo.Ex.stack
- }
- if (m.LogMessageInfo.Ex && m.LogMessageInfo.Ex.message) {
- l.ErrorMessage = m.LogMessageInfo.Ex.message
- }
- if (!m.LogMessageInfo.Message) {
- m.LogMessageInfo.Message = "Unexpectcted Error"
- }
- if (m.LogMessageInfo.Page) {
- m.LogMessageInfo.Message = m.LogMessageInfo.Message + "; in page: " + m.LogMessageInfo.Page
- }
- var n = window.queueViewModel;
- var i = m.CustomerId;
- if (!i && n) {
- i = n.customerId
- }
- var k = m.EventId;
- if (!k && n) {
- k = n.eventId
- }
- var o = m.QueueId;
- if (!o && n) {
- o = n.getQueueId()
- }
- this.logToProxy({
- Category: m.Category,
- QueueId: o,
- CustomerId: i,
- EventId: k,
- Message: m.LogMessageInfo.Message,
- Severity: m.Severity,
- Exception: l,
- UserId: this.userId,
- Service: "JavaScript(queuefront)",
- Url: window.location.href,
- UserAgent: navigator.userAgent,
- PlatformInfo: window.getClientInfo(),
- Timestamp: (new Date()).toISOString(),
- CustomInfo: m.CustomInfo
- })
- } catch (j) {
- console.debug(j)
- }
- }
- ;
- h.prototype.Error = function(l, k, i, m, n, j) {
- if (k === void 0) {
- k = ""
- }
- if (i === void 0) {
- i = ""
- }
- if (m === void 0) {
- m = ""
- }
- if (n === void 0) {
- n = e.Error
- }
- if (j === void 0) {
- j = null
- }
- this.Log({
- LogMessageInfo: l,
- Category: "Error",
- Severity: e[n],
- QueueId: m,
- CustomerId: i,
- EventId: k,
- CustomInfo: j
- })
- }
- ;
- h.prototype.Business = function(l, k, i, m, n, j) {
- if (k === void 0) {
- k = ""
- }
- if (i === void 0) {
- i = ""
- }
- if (m === void 0) {
- m = ""
- }
- if (n === void 0) {
- n = e.Information
- }
- if (j === void 0) {
- j = null
- }
- this.Log({
- LogMessageInfo: l,
- Category: "Business",
- Severity: e[n],
- QueueId: m,
- CustomerId: i,
- EventId: k,
- CustomInfo: j
- })
- }
- ;
- h.prototype.Debug = function(l, k, i, m, n, j) {
- if (k === void 0) {
- k = ""
- }
- if (i === void 0) {
- i = ""
- }
- if (m === void 0) {
- m = ""
- }
- if (n === void 0) {
- n = e.Information
- }
- if (j === void 0) {
- j = null
- }
- this.Log({
- LogMessageInfo: l,
- Category: "Debug",
- Severity: e[n],
- QueueId: m,
- CustomerId: i,
- EventId: k,
- CustomInfo: j
- })
- }
- ;
- h.prototype.logToProxy = function(i) {
- try {
- var k = this.objectToQuery(i, "");
- this.logContainer.append('<script type="text/javascript" src="' + this.proxyUrl + "?" + k + '"></script>')
- } catch (j) {
- if (window && window.console && typeof window.console.log === "function") {
- console.log("Failed to log to loggly because of this exception:\n" + j);
- console.log("Failed log data:", i)
- }
- }
- }
- ;
- h.prototype.objectToQuery = function(i, k) {
- var l = "";
- for (var j in i) {
- if (i.hasOwnProperty(j)) {
- if (!i[j]) {
- continue
- }
- if (l) {
- l += "&"
- }
- if (typeof i[j] === "object") {
- l += this.objectToQuery(i[j], j)
- } else {
- l += k + j.substr(0, 1).toUpperCase() + j.substr(1) + "=" + encodeURIComponent(i[j])
- }
- }
- }
- return l
- }
- ;
- return h
- })();
- f.Logger = g;
- (function(h) {
- h[h.Critical = 1] = "Critical";
- h[h.Error = 2] = "Error";
- h[h.Warning = 4] = "Warning";
- h[h.Information = 8] = "Information"
- })(f.ErrorSeverity || (f.ErrorSeverity = {}));
- var e = f.ErrorSeverity;
- window.logger = new g()
- })(c = d.Helpers || (d.Helpers = {}))
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function() {
- function e(f) {
- this.avatar = f == null ? null : f.avatar;
- this.header = f == null ? null : f.header;
- this.id = f == null ? null : f.id;
- this.text = f == null ? null : f.text;
- this.timestamp = (f && f.timestamp) ? new Date(parseInt(f.timestamp.substr(6))) : new Date();
- this.timestampFormatted = f == null ? null : f.timestampFormatted;
- this.timeZonePostfix = f == null ? null : f.timeZonePostfix
- }
- return e
- })();
- d.Message = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function() {
- function e(g, f) {
- this.servicedSoonDelayLengthMS = 15 * 1000;
- this.firstInLineTimeStamp = null ;
- this.avatarSrc = ko.observable();
- this.bottomPanelVisible = ko.observable();
- this.dynamicMessageVisible = ko.observable();
- this.expectedServiceTimeVisible = ko.observable();
- this.firstInLineVisible = ko.observable();
- this.highLoadVisible = ko.observable();
- this.leftPanelVisible = ko.observable();
- this.middlePanelVisible = ko.observable();
- this.queueIsPausedVisible = ko.observable();
- this.queueNumberVisible = ko.observable();
- this.queueNumberLoadingVisible = ko.observable();
- this.reminderEmailVisible = ko.observable();
- this.reminderVisible = ko.observable();
- this.rightPanelVisible = ko.observable();
- this.servicedSoonVisible = ko.observable();
- this.sidePanelVisible = ko.observable();
- this.topPanelVisible = ko.observable();
- this.usersInLineAheadOfYouVisible = ko.observable();
- this.usersInQueueVisible = ko.observable();
- this.logoVisible = ko.observable();
- this.whichIsInVisible = ko.observable();
- this.progressVisible = ko.observable();
- this.servicedSoonDelayVisible = ko.observable(false);
- this.languageSelectorVisible = ko.observable();
- this.refresh(g, f)
- }
- e.prototype.refresh = function(g, f) {
- if (!g) {
- return
- }
- this.isRedirectPromptDialogEnabled = g.isRedirectPromptDialogEnabled;
- this.bottomPanelVisible(g.bottomPanelVisible);
- this.dynamicMessageVisible(g.dynamicMessageVisible);
- this.expectedServiceTimeVisible(g.expectedServiceTimeVisible && !f);
- this.firstInLineVisible(f || g.firstInLineVisible);
- this.highLoadVisible(g.highLoadVisible);
- this.leftPanelVisible(g.leftPanelVisible);
- this.middlePanelVisible(g.middlePanelVisible);
- this.queueIsPausedVisible(g.queueIsPausedVisible);
- this.queueNumberVisible(g.queueNumberVisible);
- this.queueNumberLoadingVisible(g.queueNumberLoadingVisible);
- this.reminderEmailVisible(g.reminderEmailVisible);
- this.reminderVisible(g.reminderVisible);
- this.rightPanelVisible(g.rightPanelVisible);
- this.servicedSoonVisible(f && !g.queueIsPausedVisible);
- this.sidePanelVisible(g.sidePanelVisible);
- this.topPanelVisible(g.topPanelVisible);
- this.usersInLineAheadOfYouVisible(g.usersInLineAheadOfYouVisible && !f);
- this.usersInQueueVisible(g.usersInQueueVisible);
- this.logoVisible(g.logoVisible);
- this.whichIsInVisible(g.whichIsInVisible && !f);
- this.progressVisible(g.progressVisible);
- this.languageSelectorVisible(g.languageSelectorVisible);
- if (f && this.firstInLineTimeStamp == null ) {
- this.firstInLineTimeStamp = new Date()
- } else {
- if (f && this.firstInLineTimeStamp != null && !this.servicedSoonDelayVisible()) {
- if (Date.now() - this.firstInLineTimeStamp.valueOf() > this.servicedSoonDelayLengthMS) {
- this.servicedSoonDelayVisible(true)
- }
- }
- }
- }
- ;
- return e
- })();
- d.Layout = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(d) {
- var c = (function() {
- function e(f) {
- this.body = ko.observable();
- this.disclaimerText = ko.observable();
- this.header = ko.observable();
- this.avatarSrc = ko.observable();
- this.bottompanelIFrameSrc = ko.observable();
- this.leftpanelIFrameSrc = ko.observable();
- this.logoSrc = ko.observable();
- this.middlepanelIFrameSrc = ko.observable();
- this.rightpanelIFrameSrc = ko.observable();
- this.sidepanelIFrameSrc = ko.observable();
- this.toppanelIFrameSrc = ko.observable();
- this.styleSheets = ko.observable();
- this.whatIsThisUrl = ko.observable();
- this.languages = ko.observableArray();
- this.selectedLanguage = ko.observable();
- this.refresh(f)
- }
- e.prototype.refresh = function(f) {
- if (!f) {
- return
- }
- this.notificationSoundUrls = f.notificationSoundUrls;
- this.isWelcomeSoundEnabled = this.notificationSoundUrls && this.notificationSoundUrls.length > 0;
- if (this.body() != f.body) {
- this.body(f.body)
- }
- if (this.disclaimerText() != f.disclaimerText) {
- this.disclaimerText(f.disclaimerText)
- }
- if (this.header() != f.header) {
- this.header(f.header)
- }
- if (this.avatarSrc() != f.avatarSrc) {
- this.avatarSrc(f.avatarSrc)
- }
- if (this.logoSrc() != f.logoSrc) {
- this.logoSrc(f.logoSrc)
- }
- this.styleSheets = f.styleSheets;
- this.initLanguage(f);
- if (this.sidepanelIFrameSrc() != f.sidepanelIFrameSrc) {
- this.sidepanelIFrameSrc(f.sidepanelIFrameSrc)
- }
- if (this.toppanelIFrameSrc() != f.toppanelIFrameSrc) {
- this.toppanelIFrameSrc(f.toppanelIFrameSrc)
- }
- if (this.rightpanelIFrameSrc() != f.rightpanelIFrameSrc) {
- this.rightpanelIFrameSrc(f.rightpanelIFrameSrc)
- }
- if (this.middlepanelIFrameSrc() != f.middlepanelIFrameSrc) {
- this.middlepanelIFrameSrc(f.middlepanelIFrameSrc)
- }
- if (this.leftpanelIFrameSrc() != f.leftpanelIFrameSrc) {
- this.leftpanelIFrameSrc(f.leftpanelIFrameSrc)
- }
- if (this.bottompanelIFrameSrc() != f.bottompanelIFrameSrc) {
- this.bottompanelIFrameSrc(f.bottompanelIFrameSrc)
- }
- if (this.whatIsThisUrl() != f.whatIsThisUrl) {
- this.whatIsThisUrl(f.whatIsThisUrl)
- }
- }
- ;
- e.prototype.initLanguage = function(h) {
- var f = this;
- if (!h.languages) {
- return
- }
- if (this._selectedLanguageSubscribe) {
- this._selectedLanguageSubscribe.dispose()
- }
- this.languages.removeAll();
- for (var g = 0; g < h.languages.length; ++g) {
- this.languages.push({
- text: h.languages[g].Text,
- value: h.languages[g].Value
- });
- if (h.languages[g].Selected) {
- this.selectedLanguage(h.languages[g].Value)
- }
- }
- this._selectedLanguageSubscribe = this.selectedLanguage.subscribe(function() {
- return f.changeLanguage()
- })
- }
- ;
- e.prototype.changeLanguage = function() {
- var j = document.location.href;
- var k = j.split("?");
- if (k.length >= 2) {
- var h = encodeURIComponent("cid") + "=";
- var g = k[1].split(/[&;]/g);
- for (var f = g.length - 1; f >= 0; f--) {
- if (g[f].lastIndexOf(h, 0) !== -1) {
- g.splice(f, 1)
- }
- }
- j = k[0] + "?" + g.join("&")
- }
- document.location.href = j + "&cid=" + this.selectedLanguage()
- }
- ;
- return e
- })();
- d.InQueueTexts = c
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
- var QueueIt;
- (function(b) {
- var a;
- (function(c) {
- var d = (function() {
- function e(g) {
- var f = this;
- this.isReady = false;
- this.expectedServiceTime = ko.observable();
- this.lastUpdated = ko.observable();
- this.queueNumber = ko.observable();
- this.usersInLineAheadOfYou = ko.observable();
- this.whichIsIn = ko.observable();
- this.highLoad = ko.observable();
- this.progress = ko.observable(0.01);
- this.timeZonePostfix = ko.observable();
- this.windowStartTime = ko.observable();
- this.refresh(g);
- $(window).load(function() {
- f.isReady = true;
- f.setProgressBar(f.progress() * 100)
- })
- }
- e.prototype.refresh = function(f) {
- if (!f) {
- return
- }
- if (this.expectedServiceTime() != f.expectedServiceTime) {
- this.expectedServiceTime(f.expectedServiceTime)
- }
- if (this.lastUpdated() != f.lastUpdated) {
- this.lastUpdated(f.lastUpdated)
- }
- if (this.queueNumber() != f.queueNumber) {
- this.queueNumber(f.queueNumber)
- }
- if (this.usersInLineAheadOfYou() != f.usersInLineAheadOfYou) {
- if (isNaN(this.usersInLineAheadOfYou()) || isNaN(f.usersInLineAheadOfYou) || this.usersInLineAheadOfYou() > parseInt(f.usersInLineAheadOfYou)) {
- this.usersInLineAheadOfYou(parseInt(f.usersInLineAheadOfYou))
- }
- }
- if (this.whichIsIn() != f.whichIsIn) {
- this.whichIsIn(f.whichIsIn)
- }
- if (this.highLoad() != f.highLoad) {
- this.highLoad(f.highLoad)
- }
- if (f.progress != null && f.progress != this.progress()) {
- this.progress(f.progress);
- this.setProgressBar(this.progress() * 100)
- }
- this.timeZonePostfix(f.timeZonePostfix);
- if (!this.windowStartTime() && f.windowStartTime) {
- this.windowStartTime(f.windowStartTime)
- }
- }
- ;
- e.prototype.setProgressBar = function(f) {
- if (!this.isReady) {
- return
- }
- window.progressBar(f, $(".progressbar"))
- }
- ;
- return e
- })();
- c.Ticket = d
- })(a = b.Queue || (b.Queue = {}))
- })(QueueIt || (QueueIt = {}));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement