var robin = (function () {
return {};
})();
robin.constants = (function () {
return {
presence: {
online: 'online',
offline: 'offline',
serviceHours: 'servicehours'
},
url: {
chatSendMessage: 'Chat/SendMessage',
chatSendAttachment: 'Chat/SendAttachment',
getMissingMessages: 'Chat/GetMissingMessages',
setCartContents: 'ViewedProducts/SetCartContents',
addViewedProducts: 'ViewedProducts/AddViewedProducts',
relationIsTyping: 'Chat/RelationIsTyping',
relationStopsTyping: 'Chat/RelationStopsTyping',
getAttachment: 'Attachment',
getAttachmentThumbnail: 'Attachment/Thumbnail'
},
event: {
init: 'init',
setContext: 'setContext',
setCustomCss: 'setCustomCss',
resizeFrame: 'resizeFrame',
navigateTo: 'navigateTo',
inputFocus: 'inputFocus',
hideConversation: 'hideConversation',
maxIframeHeightReached: 'maxIframeHeightReached',
maxIframeHeightNotReached: 'maxIframeHeightNotReached',
setCartContents: 'setCartContents',
addViewedProducts: 'addViewedProducts',
resetViewedProducts: 'resetViewedProducts',
initViewedProducts: 'initViewedProducts',
tabClicked: 'tabClicked',
activateConversationMode: 'activateConversationMode',
showProActiveChatPopup: 'showProActiveChatPopup',
hideProActiveChatPopup: 'hideProActiveChatPopup',
stopProActiveChat: 'stopProActiveChat',
conversationStarted: 'conversationStarted'
},
topic: {
init: 'topic.init',
storeMessage: 'topic.storeMessage',
textAreaHeightChanged: 'topic.textAreaHeightChanged',
maxIframeHeightReached: 'topic.maxIframeHeightReached',
repositionCloseButton: 'topic.repositionCloseButton',
setCartContents: 'topic.setCartContents',
addViewedProducts: 'topic.addViewedProducts',
setFocus: 'topic.setFocus',
resizeFrame: 'topic.resizeFrame',
inputFocus: 'topic.inputFocus',
attachmentThumbnailLoaded: 'topic.attachmentThumbnailLoaded',
userIsTyping: 'userIsTyping',
userStoppedTyping: 'userStoppedTyping',
showUserTyping: 'showUserTyping',
hideUserTyping: 'hideUserTyping',
showChat: 'showChat',
showProActiveChatPopup: 'showProActiveChatPopup',
hideProActiveChatPopup: 'hideProActiveChatPopup',
startProActiveChatChat: 'startProActiveChatChat'
},
realtime: {
messageAdded: 'realtimeMessageAdded'
},
bubbleType: {
agent: 1,
shopper: 2,
initial: 3
},
mode: {
conversation: 1,
proActiveChat: 2
},
classNames: {
shopperBubbleClassName: 'shopper',
agentBubbleClassName: 'agent',
initialBubbleClassName: 'initial',
fixedCloseButtonClassName: 'fixed',
closeButtonClassName: 'normal',
maxHeightClassName: 'max-height',
focusClassName: 'focus',
phoneClassName: 'phone',
mobileClassName: 'mobile',
proActiveChatYesClassName: 'yes',
proActiveChatNoClassName: 'no'
},
storage: {
lastPopupTime: 'rbn_last_popup_time', // use same name as 'old' widget, so navigating between them handles this correctly
numberOfPopups: 'rbn_number_of_popups', // use same name as 'old' widget, so navigating between them handles this correctly
popupsShown: 'rbn_journey_popups', // use same name as 'old' widget, so navigating between them handles this correctly
journeyStopped: 'rbn_journey_stopped', // use same name as 'old' widget, so navigating between them handles this correctly
guid: 'conversationguid',
widgetActive: 'rbn_widgetActive',
conversationStarted: 'rbn_conversationStarted',
cart: 'rbn_cart_api',
viewedProducts: 'rbn_viewedProducts_api'
},
viewedProductType: {
product: 'product',
time: 'time'
},
proActiveChat: {
popupTypeEngagement: 1,
popupTypeExitGrabber: 2,
popupLayoutText: 1,
popupLayoutActions: 2,
popupLayoutInput: 3,
popupLayoutTextClass: 'text',
popupLayoutActionsClass: 'actions',
popupLayoutInputClass: 'input',
buttonTypeChat: 1,
buttonTypeClose: 2,
buttonTypeUrl: 3,
transitionDelayInMs: 2000
},
cosmetics: {
initialTextAreaHeight: 40,
brandingHeight: 18,
initialConversationHeight: 95,
additionalConversationBottom: 19,
additionalConversationHeight: -10,
additionalConversationBottomMobile: 9,
additionalConversationHeightMobile: 17,
additionalCloseButtonBottomMobile: -10,
additionalBubblesHeight: 26,
additionalBubbleHeight: 4,
additionalProActiveChatBottom: 93,
additionalProActiveChatBottomMobile: 81,
closeButtonHeight: 21
},
proActivechatActionPositionLeft: 'left',
proActivechatActionPositionRight: 'right'
};
})();
robin.shared = (function () {
var extend = function (destination, source) {
for (var property in source) {
if (destination[property] === undefined) {
destination[property] = source[property];
}
}
};
var _removeEmptyArrayItems = function (array) {
for (var i = array.length - 1; i >= 0; i--) {
if (array[i] == '') {
array.splice(i, 1);
}
}
};
var _getUrlObject = function (url) {
var parser = document.createElement('a');
parser.href = url;
return parser;
};
var urlFitsReferrer = function (url, referrer) {
if (url.indexOf('@') >= 0) {
return false;
}
if (url.indexOf('http://') != 0 && url.indexOf('https://') != 0) {
url = 'http://' + url;
}
var urlLocation = _getUrlObject(url);
var referrerLocation = _getUrlObject(referrer);
var urlSegments = urlLocation.pathname.split('/');
var referrerSegments = referrerLocation.pathname.split('/');
if (urlLocation.search.length > 0) {
urlSegments[urlSegments.length] = urlLocation.search;
}
if (referrerLocation.search.length > 0) {
referrerSegments[referrerSegments.length] = referrerLocation.search;
}
if (referrerLocation.host.indexOf(urlLocation.host, referrerLocation.host.length - urlLocation.host.length) === -1) return false;
if (referrerSegments.length < urlSegments.length) return false;
_removeEmptyArrayItems(urlSegments);
_removeEmptyArrayItems(referrerSegments);
for (var i = 0; i < urlSegments.length; i++) {
var referrerSegment = referrerSegments[i];
if (referrerSegment == undefined) return false;
var segment = urlSegments[i];
if (referrerSegment.indexOf('/', referrerSegment.length - 1) === -1) referrerSegment += '/';
if (segment.indexOf('/', segment.length - 1) === -1) segment += '/';
if (segment !== referrerSegment) return false;
}
return true;
};
var determineWebStoreBasedOnReferrer = function (referrer, webStores) {
//First try to find an exact match
for (var i = 0; i < webStores.length; i++) {
for (var j = 0; j < webStores[i].referrers.length; j++) {
if (referrer === webStores[i].referrers[j]) {
return webStores[i];
}
}
}
// Then try to find the longest (=best) domain match
var webStore = null;
var url = '';
for (var i = 0; i < webStores.length; i++) {
for (var j = 0; j < webStores[i].referrers.length; j++) {
if (urlFitsReferrer(webStores[i].referrers[j], referrer)) {
if (webStores[i].referrers[j].length > url.length) {
webStore = webStores[i];
url = webStores[i].referrers[j];
}
}
}
}
if (webStore != null) {
return webStore;
}
// Then the default webstore
for (var i = 0; i < webStores.length; i++) {
webStore = webStores[i];
if (webStore.defaultStore) {
return webStore;
}
}
return {
contactTabTemplate: {
tabStyle: 'icon-tab',
mobileTabStyle: null
}
};
};
var isInternetExplorer9OrLower = function (userAgent) {
if (userAgent === undefined) {
userAgent = navigator.userAgent;
}
if (/MSIE (\d+\.\d+);/.test(userAgent)) {
var ieversion = new Number(RegExp.$1);
if (ieversion <= 9) {
return true;
}
}
return false;
};
var isPhoneBrowser = function (userAgent) {
if (userAgent === undefined) {
userAgent = navigator.userAgent;
}
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(userAgent) ||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(userAgent.substr(0, 4))) {
return true;
} else {
return false;
}
};
var isMobileBrowser = function (userAgent) {
if (userAgent === undefined) {
userAgent = navigator.userAgent;
}
if (userAgent.match(/Android/i)
|| userAgent.match(/webOS/i)
|| userAgent.match(/iPhone/i)
|| userAgent.match(/iPad/i)
|| userAgent.match(/iPod/i)
|| userAgent.match(/BlackBerry/i)
|| userAgent.match(/Windows Phone/i)
) {
return true;
} else {
// return true;
return false;
}
};
var isIphoneBrowser = function (userAgent) {
if (userAgent === undefined) {
userAgent = navigator.userAgent;
}
if (/ip(hone|od)/i.test(userAgent) ) {
return true;
} else {
return false;
}
};
var isIosBrowser = function (userAgent) {
if (userAgent === undefined) {
userAgent = navigator.userAgent;
}
if (/iPad|iPhone|iPod/.test(userAgent)) {
return true;
} else {
return false;
}
};
var createGuid = function () {
var S4 = function () {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
return (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
};
var getCurrentDateTimeSinceEpoch = function () {
var d = new Date();
return d.getTime();
};
var getSessionData = function (name) {
var value = window.sessionStorage.getItem(name);
if (value == null) return '';
return value;
};
var setSessionData = function (name, value) {
window.sessionStorage.setItem(name, value);
};
var navigateTo = function(url) {
window.location.href = url;
};
var getTime = function() {
return new Date().getTime();
};
var getFormattedUrl = function(apikey, url) {
return '/' + apikey + '/' + url;
}
return {
determineWebStoreBasedOnReferrer: determineWebStoreBasedOnReferrer,
isInternetExplorer9OrLower: isInternetExplorer9OrLower,
isPhoneBrowser: isPhoneBrowser,
isIphoneBrowser: isIphoneBrowser,
isIosBrowser: isIosBrowser,
isMobileBrowser: isMobileBrowser,
extend: extend,
urlFitsReferrer: urlFitsReferrer,
createGuid: createGuid,
getCurrentDateTimeSinceEpoch: getCurrentDateTimeSinceEpoch,
getSessionData: getSessionData,
setSessionData: setSessionData,
navigateTo: navigateTo,
getTime: getTime,
getFormattedUrl: getFormattedUrl
};
})();
robin.api = (function () {
var setCartContents = function (cart) {
if (cart === undefined) {
cart = robin.shared.getSessionData(robin.constants.storage.cart);
if (cart === '') {
cart = [];
} else {
cart = JSON.parse(cart);
}
} else {
robin.shared.setSessionData(robin.constants.storage.cart, JSON.stringify(cart));
}
robin.tab.sendMessage(robin.constants.event.setCartContents, cart);
};
var addViewedProduct = function (viewedProduct, conversationStarted) {
var viewedProducts = robin.shared.getSessionData(robin.constants.storage.viewedProducts);
if (viewedProducts === '') {
viewedProducts = [];
}
else {
viewedProducts = JSON.parse(viewedProducts);
}
var first = true;
if (viewedProduct !== undefined) {
first = false;
viewedProducts.push({ type: robin.constants.viewedProductType.time, time: robin.shared.getTime() });
viewedProduct.type = robin.constants.viewedProductType.product;
viewedProducts.push(viewedProduct);
robin.shared.setSessionData(robin.constants.storage.viewedProducts, JSON.stringify(viewedProducts));
} else {
first = !conversationStarted;
}
robin.tab.sendMessage(robin.constants.event.addViewedProducts, {viewedProducts: viewedProducts, first: first });
};
var _onMessage = function(e) {
var event = e.data.event;
var data = e.data.data;
switch (event) {
case robin.constants.event.resetViewedProducts:
robin.shared.setSessionData(robin.constants.storage.viewedProducts, '');
break;
case robin.constants.event.initViewedProducts:
robin.api.setCartContents();
robin.api.addViewedProduct(undefined, data);
break;
}
};
var init = function() {
window.addEventListener('message', function (e) {
_onMessage(e);
});
};
return {
addViewedProduct: addViewedProduct,
setCartContents: setCartContents,
init: init
};
})();
window.__robin = robin.api;
robin.api.init();
var script = document.createElement("script");
script.src = 'https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js';
script.type = 'text/javascript';
script.onload = function () {
var robinJQuery = $.noConflict(true);
(function ($, jQuery) {
window._$ = window.$;
window.$ = $;
window._jQuery = window.jQuery;
window.jQuery = jQuery;
$.loadScript = function (src) {
var def = $.Deferred();
var script = document.createElement('script');
script.src = src;
script.onload = function () {
def.resolve();
}
script.onerror = function () {
def.reject();
}
document.body.appendChild(script);
return def.promise();
};
$.getMultiScripts = function (arr) {
var _arr = $.map(arr, function (src) {
return $.loadScript(src);
});
_arr.push($.Deferred(function (deferred) {
$(deferred.resolve);
}));
return $.when.apply($, _arr);
};
$.loadCSS = function (href) {
var cssLink = $("");
$("head").append(cssLink); //IE hack: append before setting href
cssLink.attr({
rel: "stylesheet",
type: "text/css",
href: href
});
};
robin.tab = (function () {
var baseUrl;
var webStore;
var agent;
var frameSelector = '.';
var frameClassName = 'robin_frame';
var tabSelector = '.';
var tabClassName = 'robin_tab';
var hasProActiveChat = false;
var init = function () {
baseUrl = robin_settings.newWidgetBaseUrl;
webStore = robin.shared.determineWebStoreBasedOnReferrer(window.location.href, robin_settings.webStores);
$('body').append(_getTabContainerHtml());
if (webStore.conversationTemplate.customStylesheetUrl !== undefined && webStore.conversationTemplate.customStylesheetUrl !== null) {
$.loadCSS(webStore.conversationTemplate.customStylesheetUrl);
}
window._$ = window.$;
window.$ = $;
window._jQuery = window.jQuery;
window.jQuery = jQuery;
var scripts = [];
if (robin_settings.features.viewedProducts) {
scripts.push(robin_settings.newWidgetBaseUrl + '/scripts/lib/robin.nosto.js');
}
$.getMultiScripts(scripts).done(function () {
window.$ = window._$;
window.jQuery = window._jQuery;
$(tabSelector + tabClassName).click(function () {
robin.proActiveChat.cancel(true);
robin.shared.setSessionData(robin.constants.storage.widgetActive, 'true');
_loadIframe(true, function() {
sendMessage(robin.constants.event.activateConversationMode, true);
sendMessage(robin.constants.event.tabClicked, {});
});
});
var conversationStarted = robin.shared.getSessionData(robin.constants.storage.conversationStarted);
var widgetActive = false;
var active = robin.shared.getSessionData(robin.constants.storage.widgetActive);
if (active !== '') {
widgetActive = JSON.parse(active);
_loadIframe(widgetActive, function () {
sendMessage(robin.constants.event.activateConversationMode, widgetActive);
});
}
if (conversationStarted === '') {
_initProActiveChat(!widgetActive);
}
}).fail(function (jqxhr, textStatus, error) {
var err = textStatus + ", " + error;
console.error("Error loading script(s): " + err);
});
};
_initProActiveChat = function(startEngine) {
if (robin_settings.features.proActiveChat) {
if (robin.presence.webStoreIsOnline(webStore) && webStore.proActiveChatTemplate !== null && webStore.proActiveChatTemplate !== undefined) {
// TODO - Determine whether iframe can be loaded delayed,
// what are the benefits of both strategies,
// create unittest accordingly
hasProActiveChat = true;
_loadIframe(false);
robin.proActiveChat.initialize(window.location.href, webStore.proActiveChatTemplate, _proActiveChatInitiator(), startEngine);
}
}
};
_getTabContainerHtml = function () {
var additionalClasses = '';
if (_usePhoneSettings()) {
additionalClasses += 'phone';
}
additionalClasses += ' ' + _getTabPosition();
additionalClasses += ' ' + _getOnlineClassName();
agent = null;
if (_getTabPersonalAvatar()) {
agent = robin.presence.getRandomOnlineUser(webStore);
if (agent != null) {
var personalAvatar = agent ? agent.avatar128 : '#';
additionalClasses += ' personal';
}
}
_loadThemeStyleSheet(_getTabTheme());
return '
' +
'
' +
'
' +
'
' +
'

' +
'
' +
'
' +
'
' +
'
' +
'
';
};
_proActiveChatInitiator = function() {
if (agent == null) {
return {
name: webStore.name,
avatar: webStore.onlineIconUrlLarge
};
} else {
return {
name: agent.firstName,
avatar: agent.avatar128
};
}
};
_loadThemeStyleSheet = function(theme) {
$.loadCSS(baseUrl + '/bundles/css/' + theme + '.css');
};
_getTabTheme = function() {
var tabTheme = webStore.contactTabTemplate.tabTheme;
if (_usePhoneSettings()) {
tabTheme = webStore.contactTabTemplate.mobileTabTheme;
}
return tabTheme;
};
_getTabPosition = function() {
var tabPosition = webStore.contactTabTemplate.tabPosition;
if (_usePhoneSettings()) {
tabPosition = webStore.contactTabTemplate.mobileTabPosition;
}
return tabPosition;
};
_getTabPersonalAvatar = function () {
var tabPersonalAvatar = webStore.contactTabTemplate.tabPersonalAvatar;
if (_usePhoneSettings()) {
tabPersonalAvatar = webStore.contactTabTemplate.mobiletabPersonalAvatar;
}
return tabPersonalAvatar;
};
_usePhoneSettings = function() {
if (robin.shared.isPhoneBrowser(navigator.userAgent) && webStore.contactTabTemplate.mobileSettings) {
return true;
}
return false;
};
_getOnlineClassName = function() {
if (robin.presence.webStoreIsOnline(webStore)) {
return 'online';
}
return '';
};
_getPersonalClassName = function () {
if (_getTabPersonalAvatar() && robin.presence.getRandomOnlineUser(webStore)) {
return 'personal';
}
return '';
};
_onMessage = function (e, oninitCallback) {
var event = e.data.event;
var data = e.data.data;
switch (event) {
case robin.constants.event.inputFocus:
break;
case robin.constants.event.conversationStarted:
robin.shared.setSessionData(robin.constants.storage.conversationStarted, 'true');
robin.shared.setSessionData(robin.constants.storage.widgetActive, 'true');
break;
case robin.constants.event.init:
if (oninitCallback !== undefined) {
oninitCallback();
}
sendMessage(robin.constants.event.setContext, {
apikey: robin_settings.apikey,
features: robin_settings.features,
agent: agent,
webStore: webStore,
position: _getTabPosition()
});
var styles = {
theme: _getTabTheme()
};
if (webStore.conversationTemplate.customStylesheetUrl !== undefined && webStore.conversationTemplate.customStylesheetUrl !== null) {
styles.customStylesheetUrl = webStore.conversationTemplate.customStylesheetUrl;
}
sendMessage(robin.constants.event.setCustomCss, styles);
break;
case robin.constants.event.resizeFrame:
_resizeIframe(data.height);
_compareWindowHeight(data.height);
break;
case robin.constants.event.hideConversation:
robin.shared.setSessionData(robin.constants.storage.widgetActive, 'false');
_hideIframe();
if (hasProActiveChat) {
robin.proActiveChat.resume();
}
break;
case robin.constants.event.cancelProActiveChat:
if (data.hide) {
_hideIframe();
}
break;
case robin.constants.event.navigateTo:
robin.shared.navigateTo(data);
break;
}
};
sendMessage = function (event, data, showIframe) {
if (showIframe === true) {
_showIframe();
}
if (showIframe === false) {
_hideIframe();
}
var e = {
event: event,
data: data
};
var robin_frame = $(frameSelector + frameClassName);
if (robin_frame.length === 1) {
robin_frame[0].contentWindow.postMessage(e, '*');
}
};
var scrollPosition = 0;
_showIframe = function() {
$(frameSelector + frameClassName).css('opacity', '1');
$(frameSelector + frameClassName).css('visibility', 'visible');
$(frameSelector + frameClassName).show();
$(tabSelector + tabClassName).hide();
};
_loadIframe = function (active, oninitCallback) {
if ($(frameSelector + frameClassName).attr('src') === '') {
// first time show, load and invoke callback when init is received
window.addEventListener('message', function(e) {
_onMessage(e, oninitCallback);
});
$(frameSelector + frameClassName).css('opacity', '0');
$(frameSelector + frameClassName).css('visibility', 'hidden');
$(frameSelector + frameClassName).show();
$(frameSelector + frameClassName).attr('src', baseUrl + '/Html/chat-' + webStore.language + '.html');
} else {
// already loaded, invoke callback directly
if (oninitCallback !== undefined) {
oninitCallback();
}
}
if (active) {
_showIframe();
if (robin.shared.isIosBrowser(navigator.userAgent)) {
scrollPosition = $('body').scrollTop();
$('body').css('position', 'fixed');
$('body').css('width', '100%');
$('body').css('margin-top', '-' + scrollPosition + 'px');
}
}
};
_hideIframe = function () {
$(frameSelector + frameClassName).hide();
$(tabSelector + tabClassName).show();
if (robin.shared.isIosBrowser(navigator.userAgent)) {
$('body').css('position', '');
$('body').css('width', '');
$('body').css('margin-top', '');
$('body').scrollTop(scrollPosition);
}
};
_resizeIframe = function (height) {
var iframe = document.getElementById('robin_frame');
iframe.height = height + "px";
};
_compareWindowHeight = function(height) {
if (height >= window.innerHeight - 5) {
sendMessage(robin.constants.event.maxIframeHeightReached);
} else {
sendMessage(robin.constants.event.maxIframeHeightNotReached);
}
};
window.onresize = function(event) {
_compareWindowHeight($(frameSelector + frameClassName).outerHeight());
};
return {
init: init,
sendMessage: sendMessage
};
})();
robin.tab.init();
})(robinJQuery, robinJQuery);
};
document.getElementsByTagName("head")[0].appendChild(script);
(function(n){function d(n,t,i){switch(arguments.length){case 2:return n!=null?n:t;case 3:return n!=null?n:t!=null?t:i;default:throw new Error("Implement me");}}function lt(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function g(n,i){function u(){t.suppressDeprecationWarnings===!1&&typeof console!="undefined"&&console.warn&&console.warn("Deprecation warning: "+n)}var r=!0;return l(function(){return r&&(u(),r=!1),i.apply(this,arguments)},i)}function vi(n,t){return function(i){return r(n.call(this,i),t)}}function ou(n,t){return function(i){return this.lang().ordinal(n.call(this,i),t)}}function yi(){}function at(n){gi(n);l(this,n)}function vt(n){var t=wi(n),i=t.year||0,r=t.quarter||0,u=t.month||0,f=t.week||0,e=t.day||0,o=t.hour||0,s=t.minute||0,h=t.second||0,c=t.millisecond||0;this._milliseconds=+c+h*1e3+s*6e4+o*36e5;this._days=+e+f*7;this._months=+u+r*3+i*12;this._data={};this._bubble()}function l(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);return t.hasOwnProperty("toString")&&(n.toString=t.toString),t.hasOwnProperty("valueOf")&&(n.valueOf=t.valueOf),n}function su(n){var i={};for(var t in n)n.hasOwnProperty(t)&&ri.hasOwnProperty(t)&&(i[t]=n[t]);return i}function w(n){return n<0?Math.ceil(n):Math.floor(n)}function r(n,t,i){for(var r=""+Math.abs(n),u=n>=0;r.length=0?Math.floor(t):Math.ceil(t)),i}function pt(n,t){return new Date(Date.UTC(n,t+1,0)).getUTCDate()}function bi(n,i,r){return k(t([n,11,31+i-r]),i,r).week}function ki(n){return di(n)?366:365}function di(n){return n%4==0&&n%100!=0||n%400==0}function gi(n){var t;n._a&&n._pf.overflow===-2&&(t=n._a[s]<0||n._a[s]>11?s:n._a[e]<1||n._a[e]>pt(n._a[o],n._a[s])?e:n._a[h]<0||n._a[h]>23?h:n._a[nt]<0||n._a[nt]>59?nt:n._a[tt]<0||n._a[tt]>59?tt:n._a[it]<0||n._a[it]>999?it:-1,n._pf._overflowDayOfYear&&(te)&&(t=e),n._pf.overflow=t)}function nr(n){return n._isValid==null&&(n._isValid=!isNaN(n._d.getTime())&&n._pf.overflow<0&&!n._pf.empty&&!n._pf.invalidMonth&&!n._pf.nullInput&&!n._pf.invalidFormat&&!n._pf.userInvalidated,n._strict&&(n._isValid=n._isValid&&n._pf.charsLeftOver===0&&n._pf.unusedTokens.length===0)),n._isValid}function wt(n){return n?n.toLowerCase().replace("_","-"):n}function bt(n,i){return i._isUTC?t(n).zone(i._offset||0):t(n).local()}function lu(n,t){return t.abbr=n,y[n]||(y[n]=new yi),y[n].set(t),y[n]}function au(n){delete y[n]}function f(n){var f=0,r,u,i,e,o=function(n){if(!y[n]&&ui)try{require("./lang/"+n)}catch(t){}return y[n]};if(!n)return t.fn._lang;if(!ft(n)){if(u=o(n),u)return u;n=[n]}while(f0;){if(u=o(e.slice(0,r).join("-")),u)return u;if(i&&i.length>=r&&pi(e,i,!0)>=r-1)break;r--}f++}return t.fn._lang}function vu(n){return n.match(/\[[\s\S]/)?n.replace(/^\[|\]$/g,""):n.replace(/\\/g,"")}function yu(n){for(var i=n.match(fi),t=0,r=i.length;t=0&&ut.test(n);)n=n.replace(ut,r),ut.lastIndex=0,i-=1;return n}function pu(n,t){var i=t._strict;switch(n){case"Q":return oi;case"DDDD":return hi;case"YYYY":case"GGGG":case"gggg":return i?nu:yr;case"Y":case"G":case"g":return iu;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return i?tu:pr;case"S":if(i)return oi;case"SS":if(i)return si;case"SSS":if(i)return hi;case"DDD":return vr;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return br;case"a":case"A":return f(t._l)._meridiemParse;case"X":return dr;case"Z":case"ZZ":return et;case"T":return kr;case"SSSS":return wr;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return i?si:ei;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return ei;case"Do":return gr;default:return new RegExp(nf(gu(n.replace("\\","")),"i"))}}function ir(n){n=n||"";var r=n.match(et)||[],f=r[r.length-1]||[],t=(f+"").match(uu)||["-",0,0],u=+(t[1]*60)+i(t[2]);return t[0]==="+"?-u:u}function wu(n,r,u){var l,c=u._a;switch(n){case"Q":r!=null&&(c[s]=(i(r)-1)*3);break;case"M":case"MM":r!=null&&(c[s]=i(r)-1);break;case"MMM":case"MMMM":l=f(u._l).monthsParse(r);l!=null?c[s]=l:u._pf.invalidMonth=r;break;case"D":case"DD":r!=null&&(c[e]=i(r));break;case"Do":r!=null&&(c[e]=i(parseInt(r,10)));break;case"DDD":case"DDDD":r!=null&&(u._dayOfYear=i(r));break;case"YY":c[o]=t.parseTwoDigitYear(r);break;case"YYYY":case"YYYYY":case"YYYYYY":c[o]=i(r);break;case"a":case"A":u._isPm=f(u._l).isPM(r);break;case"H":case"HH":case"h":case"hh":c[h]=i(r);break;case"m":case"mm":c[nt]=i(r);break;case"s":case"ss":c[tt]=i(r);break;case"S":case"SS":case"SSS":case"SSSS":c[it]=i(("0."+r)*1e3);break;case"X":u._d=new Date(parseFloat(r)*1e3);break;case"Z":case"ZZ":u._useUTC=!0;u._tzm=ir(r);break;case"dd":case"ddd":case"dddd":l=f(u._l).weekdaysParse(r);l!=null?(u._w=u._w||{},u._w.d=l):u._pf.invalidWeekday=r;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":n=n.substr(0,1);case"gggg":case"GGGG":case"GGGGG":n=n.substr(0,2);r&&(u._w=u._w||{},u._w[n]=i(r));break;case"gg":case"GG":u._w=u._w||{};u._w[n]=t.parseTwoDigitYear(r)}}function bu(n){var i,h,e,u,r,s,c,l;i=n._w;i.GG!=null||i.W!=null||i.E!=null?(r=1,s=4,h=d(i.GG,n._a[o],k(t(),1,4).year),e=d(i.W,1),u=d(i.E,1)):(l=f(n._l),r=l._week.dow,s=l._week.doy,h=d(i.gg,n._a[o],k(t(),r,s).year),e=d(i.w,1),i.d!=null?(u=i.d,uki(f)&&(n._pf._overflowDayOfYear=!0),i=ni(f,0,n._dayOfYear),n._a[s]=i.getUTCMonth(),n._a[e]=i.getUTCDate()),t=0;t<3&&n._a[t]==null;++t)n._a[t]=r[t]=u[t];for(;t<7;t++)n._a[t]=r[t]=n._a[t]==null?t===2?1:0:n._a[t];n._d=(n._useUTC?ni:ff).apply(null,r);n._tzm!=null&&n._d.setUTCMinutes(n._d.getUTCMinutes()+n._tzm)}}function ku(n){var t;n._d||(t=wi(n._i),n._a=[t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond],dt(n))}function du(n){var t=new Date;return n._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}function gt(n){if(n._f===t.ISO_8601){rr(n);return}n._a=[];n._pf.empty=!0;for(var a=f(n._l),i=""+n._i,r,u,s,v=i.length,l=0,o=tr(n._f,a).match(fi)||[],e=0;e0&&n._pf.unusedInput.push(s),i=i.slice(i.indexOf(r)+r.length),l+=r.length),c[u]?(r?n._pf.empty=!1:n._pf.unusedTokens.push(u),wu(u,r,n)):n._strict&&!r&&n._pf.unusedTokens.push(u);n._pf.charsLeftOver=v-l;i.length>0&&n._pf.unusedInput.push(i);n._isPm&&n._a[h]<12&&(n._a[h]+=12);n._isPm===!1&&n._a[h]===12&&(n._a[h]=0);dt(n);gi(n)}function gu(n){return n.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(n,t,i,r,u){return t||i||r||u})}function nf(n){return n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function tf(n){var t,f,u,r,i;if(n._f.length===0){n._pf.invalidFormat=!0;n._d=new Date(NaN);return}for(r=0;r0,e[4]=i,of.apply({},e)}function k(n,i,r){var e=r-i,u=r-n.day(),f;return u>e&&(u-=7),ur?7:0)-(f0?n:n-1,dayOfYear:e>0?e:ki(n-1)+e}}function ur(i){var r=i._i,u=i._f;return r===null||u===n&&r===""?t.invalid({nullInput:!0}):(typeof r=="string"&&(i._i=r=f().preparse(r)),t.isMoment(r)?(i=su(r),i._d=new Date(+r._d)):u?ft(u)?tf(i):gt(i):uf(i),new at(i))}function fr(n,i){var u,r;if(i.length===1&&ft(i[0])&&(i=i[0]),!i.length)return t();for(u=i[0],r=1;r=0?"+":"-";return t+r(Math.abs(n),6)},gg:function(){return r(this.weekYear()%100,2)},gggg:function(){return r(this.weekYear(),4)},ggggg:function(){return r(this.weekYear(),5)},GG:function(){return r(this.isoWeekYear()%100,2)},GGGG:function(){return r(this.isoWeekYear(),4)},GGGGG:function(){return r(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return i(this.milliseconds()/100)},SS:function(){return r(i(this.milliseconds()/10),2)},SSS:function(){return r(this.milliseconds(),3)},SSSS:function(){return r(this.milliseconds(),3)},Z:function(){var n=-this.zone(),t="+";return n<0&&(n=-n,t="-"),t+r(i(n/60),2)+":"+r(i(n)%60,2)},ZZ:function(){var n=-this.zone(),t="+";return n<0&&(n=-n,t="-"),t+r(i(n/60),2)+r(i(n)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},ai=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];ci.length;)u=ci.pop(),c[u+"o"]=ou(c[u],u);while(li.length)u=li.pop(),c[u+u]=vi(c[u],2);for(c.DDDD=vi(c.DDD,3),l(yi.prototype,{set:function(n){var t;for(var i in n)t=n[i],typeof t=="function"?this[i]=t:this["_"+i]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(n){return this._months[n.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(n){return this._monthsShort[n.month()]},monthsParse:function(n){var i,r,u;for(this._monthsParse||(this._monthsParse=[]),i=0;i<12;i++)if(this._monthsParse[i]||(r=t.utc([2e3,i]),u="^"+this.months(r,"")+"|^"+this.monthsShort(r,""),this._monthsParse[i]=new RegExp(u.replace(".",""),"i")),this._monthsParse[i].test(n))return i},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(n){return this._weekdays[n.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(n){return this._weekdaysShort[n.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(n){return this._weekdaysMin[n.day()]},weekdaysParse:function(n){var i,r,u;for(this._weekdaysParse||(this._weekdaysParse=[]),i=0;i<7;i++)if(this._weekdaysParse[i]||(r=t([2e3,1]).day(i),u="^"+this.weekdays(r,"")+"|^"+this.weekdaysShort(r,"")+"|^"+this.weekdaysMin(r,""),this._weekdaysParse[i]=new RegExp(u.replace(".",""),"i")),this._weekdaysParse[i].test(n))return i},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(n){var t=this._longDateFormat[n];return!t&&this._longDateFormat[n.toUpperCase()]&&(t=this._longDateFormat[n.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(n){return n.slice(1)}),this._longDateFormat[n]=t),t},isPM:function(n){return(n+"").toLowerCase().charAt(0)==="p"},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(n,t,i){return n>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(n,t){var i=this._calendar[n];return typeof i=="function"?i.apply(t):i},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(n,t,i,r){var u=this._relativeTime[i];return typeof u=="function"?u(n,t,i,r):u.replace(/%d/i,n)},pastFuture:function(n,t){var i=this._relativeTime[n>0?"future":"past"];return typeof i=="function"?i(t):i.replace(/%s/i,t)},ordinal:function(n){return this._ordinal.replace("%d",n)},_ordinal:"%d",preparse:function(n){return n},postformat:function(n){return n},week:function(n){return k(n,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),t=function(t,i,r,u){var f;return typeof r=="boolean"&&(u=r,r=n),f={},f._isAMomentObject=!0,f._i=t,f._f=i,f._l=r,f._strict=u,f._isUTC=!1,f._pf=lt(),ur(f)},t.suppressDeprecationWarnings=!1,t.createFromInputFallback=g("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(n){n._d=new Date(n._i)}),t.min=function(){var n=[].slice.call(arguments,0);return fr("isBefore",n)},t.max=function(){var n=[].slice.call(arguments,0);return fr("isAfter",n)},t.utc=function(t,i,r,u){var f;return typeof r=="boolean"&&(u=r,r=n),f={},f._isAMomentObject=!0,f._useUTC=!0,f._isUTC=!0,f._l=r,f._i=t,f._f=i,f._strict=u,f._pf=lt(),ur(f).utc()},t.unix=function(n){return t(n*1e3)},t.duration=function(n,r){var s=n,u=null,f,c,o;return t.isDuration(n)?s={ms:n._milliseconds,d:n._days,M:n._months}:typeof n=="number"?(s={},r?s[r]=n:s.milliseconds=n):(u=lr.exec(n))?(f=u[1]==="-"?-1:1,s={y:0,d:i(u[e])*f,h:i(u[h])*f,m:i(u[nt])*f,s:i(u[tt])*f,ms:i(u[it])*f}):!(u=ar.exec(n))||(f=u[1]==="-"?-1:1,o=function(n){var t=n&&parseFloat(n.replace(",","."));return(isNaN(t)?0:t)*f},s={y:o(u[2]),M:o(u[3]),d:o(u[4]),h:o(u[5]),m:o(u[6]),s:o(u[7]),w:o(u[8])}),c=new vt(s),t.isDuration(n)&&n.hasOwnProperty("_lang")&&(c._lang=n._lang),c},t.version="2.7.0",t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.ISO_8601=function(){},t.momentProperties=ri,t.updateOffset=function(){},t.relativeTimeThreshold=function(t,i){return p[t]===n?!1:(p[t]=i,!0)},t.lang=function(n,i){var r;return n?(i?lu(wt(n),i):i===null?(au(n),n="en"):y[n]||f(n),r=t.duration.fn._lang=t.fn._lang=f(n),r._abbr):t.fn._lang._abbr},t.langData=function(n){return n&&n._lang&&n._lang._abbr&&(n=n._lang._abbr),f(n)},t.isMoment=function(n){return n instanceof at||n!=null&&n.hasOwnProperty("_isAMomentObject")},t.isDuration=function(n){return n instanceof vt},u=ai.length-1;u>=0;--u)cu(ai[u]);t.normalizeUnits=function(n){return a(n)};t.invalid=function(n){var i=t.utc(NaN);return n!=null?l(i._pf,n):i._pf.userInvalidated=!0,i};t.parseZone=function(){return t.apply(null,arguments).parseZone()};t.parseTwoDigitYear=function(n){return i(n)+(i(n)>68?1900:2e3)};l(t.fn=at.prototype,{clone:function(){return t(this)},valueOf:function(){return+this._d+(this._offset||0)*6e4},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var n=t(this).utc();return 00:!1},parsingFlags:function(){return l({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(n){var i=kt(this,n||t.defaultFormat);return this.lang().postformat(i)},add:function(n,i){var r;return r=typeof n=="string"&&typeof i=="string"?t.duration(isNaN(+i)?+n:+i,isNaN(+i)?i:n):typeof n=="string"?t.duration(+i,n):t.duration(n,i),yt(this,r,1),this},subtract:function(n,i){var r;return r=typeof n=="string"&&typeof i=="string"?t.duration(isNaN(+i)?+n:+i,isNaN(+i)?i:n):typeof n=="string"?t.duration(+i,n):t.duration(n,i),yt(this,r,-1),this},diff:function(n,i,r){var f=bt(n,this),o=(this.zone()-f.zone())*6e4,u,e;return i=a(i),i==="year"||i==="month"?(u=(this.daysInMonth()+f.daysInMonth())*432e5,e=(this.year()-f.year())*12+(this.month()-f.month()),e+=(this-t(this).startOf("month")-(f-t(f).startOf("month")))/u,e-=(this.zone()-t(this).startOf("month").zone()-(f.zone()-t(f).startOf("month").zone()))*6e4/u,i==="year"&&(e=e/12)):(u=this-f,e=i==="second"?u/1e3:i==="minute"?u/6e4:i==="hour"?u/36e5:i==="day"?(u-o)/864e5:i==="week"?(u-o)/6048e5:u),r?e:w(e)},from:function(n,i){return t.duration(this.diff(n)).lang(this.lang()._abbr).humanize(!i)},fromNow:function(n){return this.from(t(),n)},calendar:function(n){var r=n||t(),u=bt(r,this).startOf("day"),i=this.diff(u,"days",!0),f=i<-6?"sameElse":i<-1?"lastWeek":i<0?"lastDay":i<1?"sameDay":i<2?"nextDay":i<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(f,this))},isLeapYear:function(){return di(this.year())},isDST:function(){return this.zone()+t(n).startOf(i)},isBefore:function(n,i){return i=typeof i!="undefined"?i:"millisecond",+this.clone().startOf(i)<+t(n).startOf(i)},isSame:function(n,t){return t=t||"ms",+this.clone().startOf(t)==+bt(n,this).startOf(t)},min:g("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(n){return n=t.apply(null,arguments),nthis?this:n}),zone:function(n,i){var r=this._offset||0;if(n!=null)typeof n=="string"&&(n=ir(n)),Math.abs(n)<16&&(n=n*60),this._offset=n,this._isUTC=!0,r!==n&&(!i||this._changeInProgress?yt(this,t.duration(r-n,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null));else return this._isUTC?r:this._d.getTimezoneOffset();return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):typeof this._i=="string"&&this.zone(this._i),this},hasAlignedHourOffset:function(n){return n=n?t(n).zone():0,(this.zone()-n)%60==0},daysInMonth:function(){return pt(this.year(),this.month())},dayOfYear:function(n){var i=b((t(this).startOf("day")-t(this).startOf("year"))/864e5)+1;return n==null?i:this.add("d",n-i)},quarter:function(n){return n==null?Math.ceil((this.month()+1)/3):this.month((n-1)*3+this.month()%3)},weekYear:function(n){var t=k(this,this.lang()._week.dow,this.lang()._week.doy).year;return n==null?t:this.add("y",n-t)},isoWeekYear:function(n){var t=k(this,1,4).year;return n==null?t:this.add("y",n-t)},week:function(n){var t=this.lang().week(this);return n==null?t:this.add("d",(n-t)*7)},isoWeek:function(n){var t=k(this,1,4).week;return n==null?t:this.add("d",(n-t)*7)},weekday:function(n){var t=(this.day()+7-this.lang()._week.dow)%7;return n==null?t:this.add("d",n-t)},isoWeekday:function(n){return n==null?this.day()||7:this.day(this.day()%7?n:n-7)},isoWeeksInYear:function(){return bi(this.year(),1,4)},weeksInYear:function(){var n=this._lang._week;return bi(this.year(),n.dow,n.doy)},get:function(n){return n=a(n),this[n]()},set:function(n,t){return n=a(n),typeof this[n]=="function"&&this[n](t),this},lang:function(t){return t===n?this._lang:(this._lang=f(t),this)}});t.fn.millisecond=t.fn.milliseconds=v("Milliseconds",!1);t.fn.second=t.fn.seconds=v("Seconds",!1);t.fn.minute=t.fn.minutes=v("Minutes",!1);t.fn.hour=t.fn.hours=v("Hours",!0);t.fn.date=v("Date",!0);t.fn.dates=g("dates accessor is deprecated. Use date instead.",v("Date",!0));t.fn.year=v("FullYear",!0);t.fn.years=g("years accessor is deprecated. Use year instead.",v("FullYear",!0));t.fn.days=t.fn.day;t.fn.months=t.fn.month;t.fn.weeks=t.fn.week;t.fn.isoWeeks=t.fn.isoWeek;t.fn.quarters=t.fn.quarter;t.fn.toJSON=t.fn.toISOString;l(t.duration.fn=vt.prototype,{_bubble:function(){var e=this._milliseconds,t=this._days,i=this._months,n=this._data,r,u,f,o;n.milliseconds=e%1e3;r=w(e/1e3);n.seconds=r%60;u=w(r/60);n.minutes=u%60;f=w(u/60);n.hours=f%24;t+=w(f/24);n.days=t%30;i+=w(t/30);n.months=i%12;o=w(i/12);n.years=o},weeks:function(){return w(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months%12*2592e6+i(this._months/12)*31536e6},humanize:function(n){var i=+this,t=sf(i,!n,this.lang());return n&&(t=this.lang().pastFuture(i,t)),this.lang().postformat(t)},add:function(n,i){var r=t.duration(n,i);return this._milliseconds+=r._milliseconds,this._days+=r._days,this._months+=r._months,this._bubble(),this},subtract:function(n,i){var r=t.duration(n,i);return this._milliseconds-=r._milliseconds,this._days-=r._days,this._months-=r._months,this._bubble(),this},get:function(n){return n=a(n),this[n.toLowerCase()+"s"]()},as:function(n){return n=a(n),this["as"+n.charAt(0).toUpperCase()+n.slice(1)+"s"]()},lang:t.fn.lang,toIsoString:function(){var r=Math.abs(this.years()),u=Math.abs(this.months()),f=Math.abs(this.days()),n=Math.abs(this.hours()),t=Math.abs(this.minutes()),i=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(r?r+"Y":"")+(u?u+"M":"")+(f?f+"D":"")+(n||t||i?"T":"")+(n?n+"H":"")+(t?t+"M":"")+(i?i+"S":""):"P0D"}});for(u in ht)ht.hasOwnProperty(u)&&(sr(u,ht[u]),cf(u.toLowerCase()));sr("Weeks",6048e5);t.duration.fn.asMonths=function(){return(+this-this.years()*31536e6)/2592e6+this.years()*12};t.lang("en",{ordinal:function(n){var t=n%10,r=i(n%100/10)===1?"th":t===1?"st":t===2?"nd":t===3?"rd":"th";return n+r}});ui?module.exports=t:typeof define=="function"&&define.amd?(define("moment",function(n,i,r){return r.config&&r.config()&&r.config().noGlobal===!0&&(rt.moment=ii),t}),hr(!0)):hr()}).call(this);
/*
//# sourceMappingURL=moment.min.js.map
*/
(function(n,t){"use strict";t(n.moment)})(this,function(n){"use strict";function c(n){return n>96?n-87:n>64?n-29:n-48}function l(n){var t=0,f=n.split("."),e=f[0],o=f[1]||"",u=1,i,r=0,s=1;for(n.charCodeAt(0)===45&&(t=1,s=-1),t;t 0 || offsetOrTimezoneId < 0) {
// offset
var currentTime = moment().tz('UTC').add(offsetOrTimezoneId, 'h');
} else {
// moment timezone id
var currentTime = moment().tz(offsetOrTimezoneId);
}
return {
dayOfWeek: currentTime.weekday(),
hour: currentTime.hour(),
minute: currentTime.minute()
};
};
return {
getCurrentTimeInTimezone: getCurrentTimeInTimezone
};
})();
robin.presence = (function () {
var webStoreIsOnline = function (webStore) {
if (webStore.presence === robin.constants.presence.offline) {
return false;
}
if (webStore.presence === robin.constants.presence.online) {
return true;
}
var timeInWebstoreTimezone = robin.timezones.getCurrentTimeInTimezone(webStore.serviceHoursTemplate.timeZoneId);
var time = 60 * timeInWebstoreTimezone.hour + timeInWebstoreTimezone.minute;
for (var i = 0; i < webStore.serviceHoursTemplate.openingHours.length; i++) {
if (webStore.serviceHoursTemplate.openingHours[i].dayOfWeek === timeInWebstoreTimezone.dayOfWeek) {
var fromTime = 60 * webStore.serviceHoursTemplate.openingHours[i].fromHours + webStore.serviceHoursTemplate.openingHours[i].fromMinutes;
var toTime = 60 * webStore.serviceHoursTemplate.openingHours[i].toHours + webStore.serviceHoursTemplate.openingHours[i].toMinutes;
if (time < fromTime) return false;
if (time > toTime) return false;
return true;
}
}
return false;
};
var _getWebStoreUsers = function (webStore) {
var open = webStoreIsOnline(webStore);
if (webStore.users) {
for (var i = 0; i < webStore.users.length; i++) {
webStore.users[i].actualPresence = webStore.users[i].presence;
if (webStore.users[i].actualPresence === robin.constants.presence.serviceHours) {
webStore.users[i].actualPresence = (open ? robin.constants.presence.online : robin.constants.presence.offline);
}
}
return webStore.users;
}
return [];
};
var getRandomOnlineUser = function (webStore) {
var users = _getWebStoreUsers(webStore);
if (users.length === 0) return null;
var onlineUsers = [];
for (var i = 0; i < webStore.users.length; i++) {
if (users[i].actualPresence === robin.constants.presence.online) {
onlineUsers.push(users[i]);
}
}
if (onlineUsers.length === 0) return null;
var index = Math.floor(onlineUsers.length * Math.random());
return onlineUsers[index];
};
return {
webStoreIsOnline: webStoreIsOnline,
getRandomOnlineUser: getRandomOnlineUser
};
})();
robin.proActiveChat = (function () {
var _initiator = null;
var _referrer = null;
var _popups = null;
var _maxPopups = 0;
var _betweenPopups = 0;
var _templateName = '';
var _showHandle = null;
var _hideHandle = null;
var _startPageTime = null;
var _timeInSeconds = function (t) { return t / 1000; };
var _getLastPopupTime = function() {
var lastPopupTime = robin.shared.getSessionData(robin.constants.storage.lastPopupTime);
if (lastPopupTime !== '') {
return parseInt(lastPopupTime);
}
return 0;
};
var _setLastPopupTime = function () {
var now = robin.shared.getTime();
robin.shared.setSessionData(robin.constants.storage.lastPopupTime, '' + now);
};
var _setJourneyIsStopped = function() {
robin.shared.setSessionData(robin.constants.storage.journeyStopped, 'true');
};
var _journeyIsStopped = function() {
var journeyStopped = robin.shared.getSessionData(robin.constants.storage.journeyStopped);
if (journeyStopped !== '') {
return true;
}
return false;
};
var _numberOfPopups = function() {
var numberOfPopups = robin.shared.getSessionData(robin.constants.storage.numberOfPopups);
if (numberOfPopups !== '') {
return parseInt(numberOfPopups);
}
return 0;
};
var _incrementNumberOfPopups = function() {
robin.shared.setSessionData(robin.constants.storage.numberOfPopups, '' + (_numberOfPopups() + 1));
};
var _popupsShown = function () {
var popupsShown = robin.shared.getSessionData(robin.constants.storage.popupsShown);
if (popupsShown !== '') {
return JSON.parse(popupsShown);
}
return [];
};
var _popupKey = function(popup) {
return _templateName + '_' + popup.popupName;
}
var _hasPopupBeenShown = function(popup) {
var popups = _popupsShown();
var popupKey = _popupKey(popup);
for (var i = 0; i < popups.length; i++) {
if (popups[i] === popupKey) {
return true;
}
}
return false;
};
var _setPopupIsShown = function(popup) {
if (popup.showOnce) {
var popups = _popupsShown();
popups.push(_popupKey(popup));
robin.shared.setSessionData(robin.constants.storage.popupsShown, JSON.stringify(popups));
}
};
var _findPopup = function (secondsOnPage) {
for (var i = 0; i < _popups.length; i++) {
var popup = _popups[i];
if (popup.popupType === robin.constants.proActiveChat.popupTypeEngagement) {
if (popup.showAfter > secondsOnPage) {
var doShow = true;
// Check URLS
if (popup.urls.length > 0) {
doShow = false;
for (var j = 0; j < popup.urls.length; j++) {
if (_referrer === popup.urls[j] || robin.shared.urlFitsReferrer(popup.urls[j], _referrer)) {
doShow = true;
}
}
}
// Check time between popups
if (doShow && _betweenPopups > 0) {
doShow = false;
var lastPopupTime = _getLastPopupTime();
var now = robin.shared.getTime();
if (((_timeInSeconds(now) + (popup.showAfter - secondsOnPage)) - _timeInSeconds(lastPopupTime)) > _betweenPopups) {
doShow = true
}
}
// Check showonce
if (doShow && popup.showOnce) {
doShow = !_hasPopupBeenShown(popup);
}
if (doShow) {
return popup;
}
}
}
}
return null;
};
var _showNextPopup = function () {
if (_journeyIsStopped() || _numberOfPopups() >= _maxPopups) {
return;
}
var now = robin.shared.getTime();
var secondsOnPage = (_timeInSeconds(now) - _timeInSeconds(_startPageTime));
var popup = _findPopup(secondsOnPage);
if (popup != null) {
_showHandle = setTimeout(function () {
_showHandle = null;
_incrementNumberOfPopups();
_setPopupIsShown(popup);
_hideHandle = setTimeout(function () {
_hideHandle = null;
_setLastPopupTime();
robin.tab.sendMessage(robin.constants.event.hideProActiveChatPopup, popup, false);
_showNextPopup();
}, popup.displayTime * 1000);
robin.tab.sendMessage(robin.constants.event.showProActiveChatPopup, { popup: popup, initiator: _initiator }, true);
}, (popup.showAfter - secondsOnPage) * 1000);
}
};
var _onMessage = function (e) {
var event = e.data.event;
var data = e.data.data;
if (event === robin.constants.event.cancelProActiveChat) {
robin.proActiveChat.cancel(data.stop);
}
};
var initialize = function (referrer, proActiveChatTemplate, initiator, startEngine) {
_startPageTime = robin.shared.getTime();
_referrer = referrer;
_initiator = initiator;
_maxPopups = proActiveChatTemplate.maxPopups;
_betweenPopups = proActiveChatTemplate.betweenPopups;
_templateName = proActiveChatTemplate.templateName;
_popups = proActiveChatTemplate.popups;
window.addEventListener('message', function (e) {
_onMessage(e);
});
if (startEngine) {
_showNextPopup();
}
};
var resume = function() {
_showNextPopup();
};
var cancel = function(stop) {
if (_showHandle !== null) clearTimeout(_showHandle);
if (_hideHandle !== null) clearTimeout(_hideHandle);
_setLastPopupTime();
if (stop) {
_setJourneyIsStopped();
}
else {
_showNextPopup();
}
};
return {
initialize: initialize,
resume: resume,
cancel: cancel
};
})();