Skip to content

Instantly share code, notes, and snippets.

@nicoandmee
Created July 21, 2019 03:43
Show Gist options
  • Select an option

  • Save nicoandmee/6d2db6b6a251b6b311e5585243f9199d to your computer and use it in GitHub Desktop.

Select an option

Save nicoandmee/6d2db6b6a251b6b311e5585243f9199d to your computer and use it in GitHub Desktop.
more citibank mysteries
(function(window) {
window.MDIGITAL = window.MDIGITAL || {};
}
)(window);
window.KAMPYLE_CONSTANT = {
PLACEHOLDERS: {
URL_PREFIX: 'https://resources.digital-cloud-citi.medallia.com/',
USERSNAP_CDN_URL: '//screencaptue-cdn.kampyle.com/',
USERSNAP_HOST_PREFIX: '//screencapture.kampyle.com/',
USERSNAP_CDN_V2_URL: '//screencapturev2-cdn.kampyle.com/',
COOLADATA_SRC_PREFIX: '//nebula-cdn.kampyle.com/',
COOLDATA_API_HOST: 'udc-neb.kampyle.com/'
},
SRC: {
OPEN_SANS: 'resources/form/FormBuilder/vendor/fonts-googleapis/css/open-sans-v14.css',
KLOADER: 'resources/onsite/images/kloader.gif',
COOLADATA: 'resources/onsite/js/cool-2.1.15.min.js'
},
FORM_HEIGHT: '450',
FORM_WIDTH: '450',
COOKIE_EXPIRATION: 365,
DEVICES: {
DESKTOP: 'desktop',
MOBILE: 'mobile',
TABLET: 'tablet',
},
FEATURE_VERSIONS: {
MOBILE_DYNAMIC_SIZING: 2,
},
TIME_FORMATS: {
SECONDS: 'seconds',
MINUTES: 'minutes',
HOURS: 'hours',
DAYS: 'days',
WEEKS: 'weeks',
MONTHS: 'months',
YEARS: 'years',
},
DISPLAY_TYPES: {
LIGHTBOX: 'lightbox',
ANIMATION: 'animation',
POPUP: 'popup',
EMBEDDED: 'embedded',
},
FORM_TYPES: {
EMBEDDED: 'embedded',
INVITATION: 'invitation',
BUTTON: 'button',
CODE: 'code',
},
EVENT_DATA: {
PAGE_NUMBER: 'pageNumber',
UUID: 'feedbackUUID',
},
EVENT_NAME: {
NEB_LOAD_FORM: 'neb_loadForm',
},
PROVISIONS: {
cooladataNewEvents: 'cooladataNewEvents',
NEW_SCREEN_CAPTURE_CONFIG: 'newScreenCaptureConfiguration',
ON_PREM_HYBRID: 'onPremHybrid',
API_GATEWAY: 'apiGateway',
LOCALIZED_FORMS: 'localizedForms',
FORM_TEMPLATE_DATA_SEPERATION: 'separateFormTemplateFromData',
EVENT_INCLUDE_FEEDBACK_CONTENT: 'eventIncludeFeedbackContent',
CP_EXT_REFACTOR: 'cpExtractRefactor',
ADOBE_INCLUDE_LINK_TRACK_VARS: 'adobeIncludeLinkTrackVars',
ADOBE_ANALYTICS_OBJECT_NAME: 'adobeAnalyticsObjectName',
ENABLE_OVERFLOW: 'enableOverflow',
SERVER_BASED_TARGETING: 'serverBasedTargeting',
NATIVE_SCREEN_CAPTURE: 'nativeScreenCapture',
COOLADATA_EVNETS_LIMIT: 'cooladataEventsLimit',
UBT_EXTRA_EVENTS: 'UBTExtraEvents',
ALTERNATIVE_UUID: 'alternativeUUID',
DISABLE_COOKIE_STORAGE: 'cookieStorageDisable',
SHARE_PROPERTY_DOMAIN: 'sharePropertyBetweenSubdomains',
SKIP_INVITATION_OPTIMIZATION: 'skipInvitationOptimization',
},
MEDALLIA_DIGITAL_EMBED_FILE: 'medallia-digital-embed.js',
DEFAULT_ADOBE_SDK_NAME: 's',
ONPREM_URL_PREFIX: '/****ONPREM_URL_PREFIX****/',
ONPREM_UDC_PREFIX: '/****JS_UDC****/',
ANALYTICS_EVENT_FORBIDDEN_PROPERTIES: {
sourceWindow: true,
content: true
},
FORM_TRIGGER_TYPES_MAP: {
embedded: 'Embedded',
invitation: 'Intercept',
button: 'AlwaysOn',
code: 'TriggeredByCode',
},
LANG_MEMORY_DATA_KEY_PREFIX: 'formLanguage:',
FORM_JSON_DATA_KEY_PREFIX: 'formJsonData:',
INVITE_JSON_DATA_KEY_PREFIX: 'inviteJsonData:',
FORM_BUTTON: 'button',
FORM_INVITATION: 'invitation',
CUSTOM_EVENT_OTHER: 'Other',
EXPOSED_FORM_ID_LABEL: 'Form_ID',
EXPOSED_FORM_TYPE_LABEL: 'Form_Type',
EXPOSED_FEEDBACK_UUID_LABEL: 'Feedback_UUID',
EXPOSED_FEEDBACK_CONTENT_LABEL: 'Content',
LOCALIZED_FORM_DEFAULT_REPLACE_VALUE: 'default',
EMBEDDED: {
IFRAME_ID_PREFIX: "embeddedIframe",
},
PROPERTY_SETTINGS: {
MANUALLY_INVITE_TARGETING: 'MANUALLY_INVITE_TARGETING',
CUSTOM_CSS_UPLOAD: 'CUSTOM_CSS_UPLOAD'
},
EVENTS: {
MDIGITAL_MANUALLY_INVITE_TARGETING: 'MDigital_manuallyInviteTargeting',
MDIGITAL_PAGE_TARGETING_PHASE_ENDED: 'MDigital_pageTargetingPhaseEnded',
MDIGITAL_BEHAVIORAL_TARGETING_PHASE_ENDED: 'MDigital_behavioralTargetingPhaseEnded',
MDIGITAL_QUARANTINED_SURVEY_PHASE_ENDED: 'MDigital_quarantinedSurveyPhaseEnded',
MDIGITAL_TARGETING_RULE_EVALUATED: 'MDigital_targetingRuleEvaluated',
MDIGITAL_SCREEN_CAPTURE_LOADED: 'neb_screenCaptureLoaded',
MDIGITAL_SDK_PAGE_VIEW: 'neb_sdkPageView',
},
LOG_MESSAGES: {
TRIGGER_MESSAGE_TEMPLATE: 'Event {{EVENT_NAME}} has been {{STATUS}}. \n the data is: {{DATA}}. \n the context is :{{CONTEXT}}. \n the options are : {{OPTIONS}}.\n',
ERROR_LOG_TEMPLATE: 'Error Message is {{ERROR_MESSAGE}}'
},
LOG_STATUSES: {
FAILED: 'failed',
TRIGGERED: 'triggered'
},
OPERATORS: {
REGEX: 'regex',
EQUALS: 'equals',
DOES_NOT_EQUAL: 'doesnotequal',
CONTAINS: 'contains',
DOES_NOT_CONTAIN: 'doesnotcontain',
STARTS_WITH: 'startswith',
ENDS_WITH: 'endswith',
HAS_VALUE: 'hasvalue',
LATER_THAN: 'laterthan',
EARLIER_THAN: 'earlierthan',
GREATER_THAN: 'greaterthan',
SMALLER_THAN: 'smallerthan'
},
TARGETING_STATUS: {
CANDIDACY: 'candidacy',
TRIGGERED: 'triggered',
QUARANTINED: 'quarantined'
},
TARGETING_PHASES: {
PAGE_TARGETING: "pageTargeting",
BEHAVIORAL_TARGETING: "behavioralTargeting",
QUARANTINE_TARGETING: "quarantineTargeting"
},
REGIONS: {
DEV: 'dev',
QA: 'qa',
COLO_QA: 'digital-cloud-qa',
COLO_US: 'digital-cloud-us',
},
MEMORY_DATA_FIELDS: {
MDIGITAL_ALTERNATIVE_UUID: 'mdigital_alternative_uuid'
},
CSS_FONT_RULE: 'CSSFontFaceRule',
NETWORK: {
RETRY_TIMEOUT: 1000,
REQUEST_TIMEOUT: 2000,
NUM_OF_RETRIES: 3
},
ERROR_CODE: {
SECURITY_ERROR: 18
}
};
window.KAMPYLE_FUNC = (function() {
function init() {
var formattedFormData;
formattedFormData = kampyleGetData() || {};
var customParams;
if (formattedFormData.formNodes && formattedFormData.formNodes.length) {
for (var i = 0; i < formattedFormData.formNodes.length; i++) {
if (formattedFormData.formNodes[i].customParams) {
customParams = JSON.parse(formattedFormData.formNodes[i].customParams);
formattedFormData.formNodes[i].customParams = customParams;
}
}
}
KAMPYLE_EVENT_DISPATCHER.init();
KAMPYLE_DATA.init();
subscribeFirstToPageEvents();
KAMPYLE_VIEW.init();
window.MDIGITAL && window.MDIGITAL.EMBEDDED && window.MDIGITAL.EMBEDDED.init();
KAMPYLE_TARGETING.init();
KAMPYLE_MESSAGE.init();
KAMPYLE_ANIMATION.init();
var region = formattedFormData ? formattedFormData.region : 'dev';
formattedFormData = validateFormContract(formattedFormData);
if (MDIGITAL_OnPrem.isOnPrem()) {
formattedFormData.formNodes.forEach(MDIGITAL_OnPrem.replaceFormNodeUrls);
}
KAMPYLE_DATA.setMemoryData('dataJson', formattedFormData);
var context = KAMPYLE_UTILS.getUrlParam('nebContext') || 'live';
KAMPYLE_DATA.setMemoryData('context', context);
KAMPYLE_DATA.setMemoryData('region', region);
KAMPYLE_DATA.setMemoryData('kampyleDevice', checkDevice());
KAMPYLE_DATA.setMemoryData('hostedViewportContent', []);
KAMPYLE_DATA.setMemoryData('isGuest', true);
var browser = KAMPYLE_UTILS.getBrowser();
if (KAMPYLE_DATA.getMemoryData('context') !== 'preview' && (browser.name !== 'MSIE' || parseInt(browser.version, 10) > 9)) {
KAMPYLE_ADOBE_ANALYTICS.init();
}
KAMPYLE_COOLADATA.init();
KAMPYLE_SESSIONCAM.init();
MDIGITAL.CUSTOM_EVENTS.init();
createSession();
subscribeToPageEvents();
subscribeToCustomEvents();
KAMPYLE_UTILS.setEventHandler(window, 'hashchange', handleHashChanged);
KAMPYLE_UTILS.triggerCustomEvent('neb_OnsiteLoaded');
}
function validateFormContract(formsObj) {
formsObj.formNodes = formsObj.formNodes || [];
var currForm;
for (var i = formsObj.formNodes.length - 1; i >= 0; i--) {
currForm = formsObj.formNodes[i];
if (!currForm.formHeight || currForm.formHeight === 'null') {
currForm.formHeight = KAMPYLE_CONSTANT.FORM_HEIGHT;
}
if (!currForm.formWidth || currForm.formWidth === 'null') {
currForm.formWidth = KAMPYLE_CONSTANT.FORM_WIDTH;
}
}
return formsObj;
}
function subscribeFirstToPageEvents() {
var eventMapping = {
neb_inviteReady: [sendInviteInitialData],
neb_buttonClicked: [loadFormFirst],
neb_inviteAccepted: [loadFormFirst],
neb_showInvitation: [prepareInviteTriggeringData],
neb_sdkPageView: [setInviteState, KAMPYLE_DATA.initFormState],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
}
function loadFormFirst(eventName, data) {
var formState = KAMPYLE_DATA.getFormState(data.formId);
if (!formState.loaded && !formState.loading) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: data.formId
});
}
}
function loadMultipileForms(eventName, data) {
var formIds = (data || {}).formIds || [];
formIds.forEach(function(fid) {
KAMPYLE_COMMON.loadForm(fid);
});
}
function routeToForm(eventName, data) {
data = data || {};
KAMPYLE_COMMON.closeForm(data.sourceFormId);
if (!KAMPYLE_COMMON.showForm(data.formId)) {
throw new Error('Form cannot be loaded');
}
}
function focusOnInviteIframe() {
var iframe = document.querySelector('#kampyleInvite');
if (iframe && typeof iframe.focus === 'function') {
iframe.focus();
}
}
function triggerInviteReady(eventName, data) {
data = data || {};
if (KAMPYLE_DATA.getFormState(data.formId).inviteLoaded) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteReady', data);
}
}
function subscribeToCustomEvents() {
var eventMapping = {
neb_inviteDeclined: ['neb_displayClosed'],
neb_formClosed: ['neb_displayClosed'],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
}
function prepareJsonData(eventName, data) {
if (!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION)) {
return;
}
KAMPYLE_DATA.fetchFormJsonData({
formId: data.formId,
isInvite: eventName === 'neb_loadInvitation',
});
}
function subscribeToPageEvents() {
var eventMapping = {
neb_pageView: [increasePageViewCounter],
neb_showInvitation: [setInviteState, KAMPYLE_UTILS.setCurrentScrollPosition, setFocusedElement, focusOnInviteIframe, triggerInviteReady],
neb_buttonClicked: [KAMPYLE_UTILS.setCurrentScrollPosition, setFocusedElement, handleShowForm],
neb_sdkShowForm: [KAMPYLE_UTILS.setCurrentScrollPosition, setFocusedElement, handleShowForm],
neb_skipInvitation: [KAMPYLE_UTILS.setCurrentScrollPosition, handleShowForm],
neb_inviteLoaded: [setInviteState, handleInviteLoaded],
neb_inviteAccepted: [setInviteState, KAMPYLE_UTILS.setCurrentScrollPosition, handleShowForm],
neb_inviteDeclined: [setInviteState, handleInviteDeclined, KAMPYLE_UTILS.scrollToLastPosition],
neb_formClosed: [handleFormClosed, KAMPYLE_UTILS.scrollToLastPosition],
neb_popupBlocked: [handleFormClosed, KAMPYLE_UTILS.scrollToLastPosition],
neb_loadForm: [prepareJsonData, handleFormLoading],
neb_loadInvitation: [prepareJsonData],
neb_formLoaded: [handleFormLoaded],
neb_loadMultipileForms: [loadMultipileForms],
neb_routeToForm: [routeToForm],
neb_formReady: [sendFormExtraData, handleVersion, loadScreenCaptureApi],
neb_feedbackSubmitted: [handleFeedbackSubmitted],
neb_captureImageClicked: [handleTakenScreenCapture],
neb_sdkPageView: [startCheckingTargeting],
neb_screenCaptureLoaded: [handleScreenCaptureApiLoaded],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
}
function getTriggerTypeByEvent(eventName) {
var eventTriggerMapping = {
neb_buttonClicked: 'Button',
neb_sdkShowForm: 'ByCode',
neb_routeToForm: 'ByCode',
neb_skipInvitation: 'Invitation',
neb_inviteAccepted: 'Invitation',
};
return eventTriggerMapping[eventName] || null;
}
function handleShowForm(eventName, data) {
data = data || {};
data.triggerType = data.triggerType || getTriggerTypeByEvent(eventName);
KAMPYLE_DATA.saveFormExtraData(data.formId, {
triggerType: data.triggerType,
});
KAMPYLE_DATA.setMemoryData('currentFormId', data.formId);
KAMPYLE_DATA.setMemoryData('formIsShown', true);
KAMPYLE_DATA.setFormState(data.formId, {
shown: true
});
if (KAMPYLE_FUNC.isFormLoaded(data.formId)) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formReady', {
formId: data.formId
});
}
}
function createSession() {
var referrerDifferentThanHost = isReferrerDifferentThanHost();
var kampyleUserSession = KAMPYLE_DATA.getData('kampyleUserSession');
var isDirectNavigation = false;
try {
isDirectNavigation = document.referrer === '' || window.parent.document.referrer === '';
} catch (e) {
var data = {};
data.errorMessage = e.message;
data.errorStack = e.stack;
if (e.code === KAMPYLE_CONSTANT.ERROR_CODE.SECURITY_ERROR) {
data.additionalInfo = "createSession- failed to access document.referrer, probably CORS problem when the customer's iframe is hosted in a website with different domain.";
referrerDifferentThanHost = false;
}
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError(data);
} finally {
if (!kampyleUserSession || isDirectNavigation || referrerDifferentThanHost) {
var currentTime = new Date();
KAMPYLE_DATA.setMemoryData('isSyncedIdentifierData', false);
KAMPYLE_DATA.setData('kampyleUserSession', currentTime.getTime());
KAMPYLE_DATA.setData('kampyleSessionPageCounter', 0);
addToSessionCount();
KAMPYLE_DATA.deleteData('kampyleUserPercentile');
KAMPYLE_DATA.deleteData('kampyleInvitePresented');
}
}
}
function isReferrerDifferentThanHost() {
var referrerDomain = document.referrer.match(/:\/\/(.[^/]+)/);
if (!referrerDomain) {
return true;
}
referrerDomain = referrerDomain[1];
if (referrerDomain === window.location.host) {
return false;
}
var propertySharedSubdomain = KAMPYLE_DATA.getPropertySharedSubdomain();
if (propertySharedSubdomain) {
return !KAMPYLE_UTILS.isHostMatchesSubdomain(referrerDomain, propertySharedSubdomain) || !KAMPYLE_UTILS.isHostMatchesSubdomain(window.location.host, propertySharedSubdomain);
}
return true;
}
function kampyleGetData() {
var dataJson = KAMPYLE_DATA.getMemoryData('dataJson');
if (dataJson) {
return dataJson;
}
return {
"provisions": {
"mobileSDKV2AppRatingsAndroidDestination": null,
"mobileSDKUseSDKMetaDataInsteadOfUA": null,
"ibmIncludeSpecificCPsInCooladataEvent": null,
"cpExtractRefactor": null,
"exportFeedbackSpinner": null,
"disableFormReloadOnClose": null,
"customEventsBroadcast": true,
"sharePropertyBetweenSubdomains": null,
"mobileSDKV2FormWCAGSupport": null,
"googleAnalyticsClientEventsEnabled": null,
"spaUrlPolling": null,
"tealeafEnabled": null,
"mobileSdkSupport": null,
"customCssUpload": null,
"cooladataNewEvents": null,
"adobeAnalytics": true,
"eventIncludeFeedbackContent": true,
"dynamicModalSizeInCustomHtml": true,
"customHtmlFormsEnable": true,
"cooladataEventsLimit": null,
"mobileSDKV2AndroidNewSubmitButton": null,
"targetingEventsReporting": null,
"sessionRecording": null,
"mobileSdkFixIos12KeyboardIssue": null,
"serverBasedTargeting": null,
"enableOverflow": null,
"mobileInvitationLayout": true,
"nativeScreenCapture": null,
"mobileWebDynamicFormSizeInFormBuilder": true,
"filterByRegex": true,
"cookieStorageDisable": null,
"screenCaptureEnabled": false,
"mobileSDKV2UiRevamp": null,
"skipInvitationOptimization": null,
"ratingSingleSelectStyling": true,
"formTemplatesWCAG": true,
"formSpacing": true,
"mobileSDKV2AppRating": null,
"targetingRuleIdleTime": null,
"onPremHybrid": null,
"responsiveRatingComponent": true,
"embeddedForms": true,
"localizedForms": false,
"newScreenCaptureConfiguration": null,
"UBTExtraEvents": null,
"adobeAnalyticsObjectName": true,
"mobileWebDynamicFormSize": true,
"mobileSDKV2ScoreTargeting": null,
"onsiteLogger": null,
"disableButtonProximity": null,
"thermoFisherTeaLeafIntegration": null,
"alternativeUUID": null,
"sortFormListView": null,
"multiOptionsID": true,
"adobeIncludeLinkTrackVars": true,
"separateFormTemplateFromData": true,
"cooladataIntegration": true
},
"region": "digital-cloud-us-citi",
"websiteId": 50,
"accountId": 49,
"isSpa": false,
"isWCAG": true,
"isManuallyInviteTargeting": false,
"isFormsPreloaded": true,
"isGoogleAnalyticsClientGTM": false,
"cookieExpirationTime": null,
"sbtServerDomain": "https://sbt-qa.kampyle.com",
"sbtEnvPrefix": "wdcusciti_",
"endUserIdentifier": {},
"formNodes": [{
"formId": "304",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/304/form1562354769600.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/304/formData1562354769748_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_copy_copy_1551286869362_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"doesNotEqual\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat2.online.citi.com/"
}
}
}, {
"formId": "303",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/303/form1562354587549.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/303/formData1562354587697_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Comentario",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_copy_1554390808023_Feedback-Spanish.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"equals\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat2.online.citi.com/"
}
}
}, {
"formId": "265",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/265/form1561367018683.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/265/formData1561367018835_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Comentario",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_1554390808023_Feedback-Spanish.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"equals\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://uat3.online.citi.com/"
},
"inclusionUrl": {
"rule": "https://online.citi.com/"
}
}
}, {
"formId": "264",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/264/form1561367028389.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/264/formData1561367028482_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_copy_1551286869362_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"urlRules": {
"exclusionUrl": {
"rule": "https://uat3.online.citi.com/;https://test3.benefitbuilder.acxiom.com/"
},
"inclusionUrl": {
"rule": "https://online.citi.com/"
}
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"],
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"doesNotEqual\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}"
}
}, {
"formId": "261",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/261/form1561367023969.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/261/formData1561367024105_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Comentario",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_1554390808023_Feedback-Spanish.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"],
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":234,\"formName\":\"All Forms\",\"uniqueId\":\"customParam234\",\"condition\":\"equals\",\"fieldName\":\"citiLanguage-cookie\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}"
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat1.online.citi.com/"
}
}
}, {
"formId": "260",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/260/form1561367031528.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/260/formData1561367031641_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_copy_1551286869362_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat1.online.citi.com/"
}
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"],
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":234,\"formName\":\"All Forms\",\"uniqueId\":\"customParam234\",\"condition\":\"doesNotEqual\",\"fieldName\":\"citiLanguage-cookie\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}"
}
}, {
"formId": "248",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/248/form1561367019443.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/248/formData1561367019560_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Comentario",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/1554390808023_Feedback-Spanish.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"equals\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat3.online.citi.com/"
}
}
}, {
"formId": "237",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/237/form1561367019423.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/237/formData1561367019510_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "true",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_1551286885461_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "0.0"
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://dit33.online.citi.com/;https://sit33.online.citi.com/;https://uat2.online.citi.com/;https://uat3.online.citi.com/;https://uat1.online.citi.com/"
}
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"],
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"contains\",\"fieldName\":\"pageDef\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}"
}
}, {
"formId": "236",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/236/form1561367028190.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/236/formData1561367028310_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_1551286869362_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"doesNotContain\",\"fieldName\":\"URL\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"true\",\"formId\":-1,\"fieldId\":121,\"formName\":\"All Forms\",\"uniqueId\":\"customParam121\",\"condition\":\"equals\",\"fieldName\":\"citiNGA\",\"fieldType\":\"Boolean\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteria\",\"value\":\"es_US\",\"formId\":-1,\"fieldId\":233,\"formName\":\"All Forms\",\"uniqueId\":\"customParam233\",\"condition\":\"doesNotEqual\",\"fieldName\":\"citiLanguage\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://uat3.online.citi.com/"
}
}
}, {
"formId": "65",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/65/form1561367020627.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/65/formData1561367020723_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/1551286885461_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "0.0"
},
"onSiteData": {
"genericRule": "{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"mortgage\",\"formId\":-1,\"fieldId\":71,\"formName\":\"All Forms\",\"uniqueId\":\"customParam71\",\"condition\":\"contains\",\"fieldName\":\"pageDef\",\"fieldType\":\"Text\",\"fieldOrigin\":\"customParam\"}]}",
"devicetypes": ["desktop", "mobile", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": ""
},
"inclusionUrl": {
"rule": "https://online.citi.com/"
}
}
}, {
"formId": "280",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/280/form1561367022731.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/280/formData1561367022833_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/1559939503968_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"urlRules": {
"exclusionUrl": {
"rule": "https://online.citi.com/"
},
"inclusionUrl": {
"rule": "https://test3.benefitbuilder.acxiom.com/;https://test2.benefitbuilder.acxiom.com/"
}
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"]
}
}, {
"formId": "277",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/277/form1561367023489.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/277/formData1561367023803_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "button",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
},
"buttonData": {
"type": "custom",
"text": "Feedback",
"textColor": "#ffffff",
"backgroundColor": "#6b6b6b",
"buttonUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/resources/image/copy_copy_copy_1551286869362_Feedback.png",
"position": "right",
"cornerMargin": "0.0",
"verticalOffset": "-215.0"
},
"onSiteData": {
"devicetypes": ["desktop", "tablet"]
},
"urlRules": {
"exclusionUrl": {
"rule": "https://test3.benefitbuilder.acxiom.com/"
},
"inclusionUrl": {
"rule": "https://www.cardbenefits.citi.com/;https://cardbenefits.citi.com/"
}
}
}, {
"formId": "263",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/263/form1561367021679.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/263/formData1561367021849_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "code",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
}
}, {
"formId": "262",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/262/form1561367023086.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/262/formData1561367023220_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "code",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
}
}, {
"formId": "105",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/105/form1561411176350.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/105/formData1561411176445_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"94\",\"unique_name\":\"citi_profile\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"citi_profile\",\"is_identifier\":\"false\"}, {\"id\":\"93\",\"unique_name\":\"lob\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"lob\",\"is_identifier\":\"false\"}, {\"id\":\"92\",\"unique_name\":\"app_ver\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"app_ver\",\"is_identifier\":\"false\"}, {\"id\":\"91\",\"unique_name\":\"app_flavor\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"app_flavor\",\"is_identifier\":\"false\"}, {\"id\":\"90\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "code",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
}
}, {
"formId": "94",
"isCustomHtmlEnabled": "false",
"formVersion": "2",
"formHtmlUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/94/form1561367023351.html",
"formDataUrl": "https://resources.digital-cloud-citi.medallia.com/wdcusciti/50/forms/94/formData1561367023442_###LANGUAGE_CODE###.json",
"formWidth": "500",
"formHeight": "700",
"isFixedSize": "false",
"isFullWidthEmbedded": "null",
"designSettings": {
"formBackgroundColor": "",
"thankYouPageBackgroundColor": ""
},
"formLocalizationSettings": {
"defaultLanguage": "en",
"useCustomParam": "false",
"customParam": "null"
},
"functionFileUrl": "",
"customParams": "[{\"id\":\"255\",\"unique_name\":\"Login Status\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"LoggedIn\",\"is_identifier\":\"false\"}, {\"id\":\"254\",\"unique_name\":\"Customer Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar100\",\"is_identifier\":\"false\"}, {\"id\":\"253\",\"unique_name\":\"Citi Products\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar53\",\"is_identifier\":\"false\"}, {\"id\":\"252\",\"unique_name\":\"User Type\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar51\",\"is_identifier\":\"false\"}, {\"id\":\"251\",\"unique_name\":\"Platform\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar42\",\"is_identifier\":\"false\"}, {\"id\":\"249\",\"unique_name\":\"LOB1\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"s.eVar30\",\"is_identifier\":\"false\"}, {\"id\":\"89\",\"unique_name\":\"customer_segment\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"customer_segment\",\"is_identifier\":\"false\"}, {\"id\":\"88\",\"unique_name\":\"ccs_id\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"ccs_id\",\"is_identifier\":\"false\"}, {\"id\":\"234\",\"unique_name\":\"citiLanguage-cookie\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"locale\",\"is_identifier\":\"false\"}, {\"id\":\"233\",\"unique_name\":\"citiLanguage\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"citiLocale\",\"is_identifier\":\"false\"}, {\"id\":\"121\",\"unique_name\":\"citiNGA\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"citiNGA\",\"is_identifier\":\"false\"}, {\"id\":\"82\",\"unique_name\":\"CCS ID\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"CCSID\",\"is_identifier\":\"false\"}, {\"id\":\"117\",\"unique_name\":\"isLoggedin\",\"type\":\"Boolean\",\"source\":\"Var\",\"source_name\":\"isLoggedin\",\"is_identifier\":\"false\"}, {\"id\":\"115\",\"unique_name\":\"customerType\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"customerType\",\"is_identifier\":\"false\"}, {\"id\":\"71\",\"unique_name\":\"pageDef\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"pageDef\",\"is_identifier\":\"false\"}, {\"id\":\"81\",\"unique_name\":\"pageID\",\"type\":\"Text\",\"source\":\"URL\",\"source_name\":\"pageID\",\"is_identifier\":\"false\"}]",
"formType": "code",
"formDisplay": {
"displayType": "lightbox",
"displayDirection": "centerRight",
"isSelfHosted": "",
"selfHostedUrl": ""
}
}],
"integrations": {
"recordedSessions": [{
"isEnabled": [{
"source": "cookie",
"param": "_cls_s",
"paramValue": null,
"predefinedArguments": null
}],
"parameters": [{
"source": "cookie",
"param": "_cls_s",
"putIn": "sessionId",
"predefinedArguments": null
}],
"integrationName": "glassbox"
}]
},
"adobeSdkName": null,
"packageVersion": null,
"sharedSubdomain": null,
"customCssUpload": false
};
}
function handleInviteLoaded(eventName, data) {
data = data || {};
var inviteVersion = KAMPYLE_UTILS.getNestedPropertyValue(data, 'inviteVersion');
KAMPYLE_DATA.setMemoryData('inviteVersion', inviteVersion);
var formState = KAMPYLE_DATA.getFormState(data.formId) || {};
if (formState.inviteShown) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteReady', data);
}
}
function handleFormLoading(eventName, data) {
data = data || {};
KAMPYLE_DATA.setFormState(data.formId, {
loading: true,
});
KAMPYLE_EVENT_DISPATCHER.trigger('neb_form_loaded', {
formId: data.formId
});
}
function sendInviteInitialData(eventName, data) {
data = data || {};
if (!KAMPYLE_DATA.getFormState(data.formId).inviteLoaded) {
return false;
}
KAMPYLE_UTILS.sendMessageToIframe('kampyleInvite', {
action: 'inviteShown',
});
var messageData = {
accountId: data.accountId,
websiteId: data.websiteId,
environment: data.enviroment,
url: document.location.href,
kampyle_version: window.KAMPYLE_REVISION || '0.0.0.0',
formId: data.formId,
cookie_size: KAMPYLE_UTILS.getByteSize(document.cookie),
isWCAG: KAMPYLE_DATA.isFeatureEnabled('WCAG'),
deviceType: checkDevice(),
provisions: getAllProvisions(),
position: KAMPYLE_VIEW.getInvitePosition(data.formId),
customCssUpload: KAMPYLE_DATA.isFeatureEnabled(KAMPYLE_CONSTANT.PROPERTY_SETTINGS.CUSTOM_CSS_UPLOAD)
};
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION)) {
var callbackFunction = function(jsonData) {
messageData = Object.assign({}, messageData, {
inviteData: jsonData
});
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.LOCALIZED_FORMS)) {
messageData.formLanguage = MDIGITAL.LOCALIZATION.getFormLanguage(data.formId) || null;
}
KAMPYLE_UTILS.sendMessageToIframe('kampyleInvite', {
action: 'setExtraData',
data: messageData,
});
};
var onError = function(error) {
console.error(error);
};
KAMPYLE_DATA.fetchFormJsonData({
formId: data.formId,
callback: callbackFunction,
onError: onError,
isInvite: true
}, true)
} else {
KAMPYLE_UTILS.sendMessageToIframe('kampyleInvite', {
action: 'setExtraData',
data: messageData,
});
}
}
function setInviteState(eventName, data) {
data = data || {};
data.formId = data.formId || KAMPYLE_DATA.getMemoryData('currentFormId');
switch (eventName) {
case 'neb_showInvitation':
KAMPYLE_DATA.setFormState(data.formId, {
inviteShown: true,
});
break;
case 'neb_inviteDeclined':
case 'neb_inviteAccepted':
KAMPYLE_DATA.setFormState(data.formId, {
inviteShown: false,
});
break;
case 'neb_inviteLoaded':
KAMPYLE_DATA.setFormState(data.formId, {
inviteLoaded: true,
});
break;
case 'neb_sdkPageView':
KAMPYLE_DATA.setFormState(data.formId, {
inviteLoaded: false,
inviteShown: false,
});
break;
default:
KAMPYLE_UTILS.showWarning('Unhandled event name ' + eventName);
}
}
function updatePreviewIframeStyle(formData) {
var currentFormId = formData.formId;
var formWidth;
var formHeight;
if (formData) {
formWidth = parseInt(formData.formWidth, 10);
formHeight = parseInt(formData.formHeight, 10);
}
var hostWidth = document.documentElement.clientWidth;
var hostHeight = document.documentElement.clientHeight;
var innerContainerStyle = {
overflowY: 'auto',
height: '100%',
};
KAMPYLE_UTILS.setElementStyle(document.getElementById('innerContainer'), innerContainerStyle);
var iframeStyleObject = {
border: 0,
position: 'relative',
margin: '50px auto 50px',
height: formHeight + 'px',
width: formWidth + 'px',
};
if (hostWidth > formWidth && hostHeight > formHeight) {
if (KAMPYLE_DATA.isCustomHtmlAndFixedSizeForm(currentFormId)) {
iframeStyleObject = {
position: 'absolute',
top: '50%',
'margin-top': -formHeight / 2 + 'px',
left: '50%',
'margin-left': -formWidth / 2 + 'px',
height: formHeight + 'px',
width: formWidth + 'px',
};
} else {
iframeStyleObject = {
position: 'fixed',
height: '100%',
width: '100%',
};
}
}
var modal = document.getElementById('kampyleFormModal');
if (modal && modal.style && modal.removeAttribute) {
modal.removeAttribute('style');
KAMPYLE_UTILS.setElementStyle(modal, iframeStyleObject);
}
}
function showPreviewForm() {
var formHeight = 450;
var formWidth = 450;
var formUrl = KAMPYLE_UTILS.getUrlParam('url');
var url;
if (KAMPYLE_DATA.getMemoryData('kampyleDevice') === KAMPYLE_CONSTANT.DEVICES.MOBILE) {
formWidth = '100%';
formHeight = '100%';
} else {
var height = KAMPYLE_UTILS.getUrlParam('height');
var width = KAMPYLE_UTILS.getUrlParam('width');
if (!!height && !isNaN(height)) {
formHeight = height;
}
if (!!width && !isNaN(width)) {
formWidth = width;
}
}
if (!!formUrl && KAMPYLE_UTILS.validateKampyleDomain(decodeURIComponent(formUrl))) {
formUrl = decodeURIComponent(formUrl);
formUrl += '?region=' + KAMPYLE_DATA.getMemoryData('region');
var formId = KAMPYLE_UTILS.getUrlParam('formId');
if (!!formId) {
formUrl += '&formId=' + formId;
KAMPYLE_DATA.setMemoryData('currentFormId', formId);
} else {
url = location.protocol + '//' + location.host;
window.location = url + '/#/error/404';
}
var provisions = decodeURIComponent(window.getUrlParam('provisions'));
if (!!provisions) {
formUrl += '&provisions=' + encodeURIComponent(provisions);
}
var currentWebsiteId = decodeURIComponent(window.getUrlParam('websiteId'));
if (!!currentWebsiteId) {
formUrl += '&websiteId=' + encodeURIComponent(currentWebsiteId);
}
var type = KAMPYLE_UTILS.getUrlParam('type') || 'direct';
var validTypes = ['live', 'direct', 'preview'];
if (validTypes.indexOf(type.toLowerCase()) === -1) {
type = 'direct';
}
formUrl += '&type=' + type;
var iframeHeight = '100%';
var iframeWidth = '100%';
if (KAMPYLE_DATA.isCustomHtmlAndFixedSizeForm(formId)) {
iframeHeight = formHeight;
iframeWidth = formWidth;
}
var iframe = KAMPYLE_UTILS.createIframe(formUrl, iframeWidth, iframeHeight, 'kampyleForm' + formId);
if (KAMPYLE_DATA.isCustomHtmlForm(formId)) {
updatePreviewIframeStyle({
formId: formId,
formHeight: formHeight,
formWidth: formWidth,
});
}
var modal = document.getElementById('kampyleFormModal');
if (!!modal) {
modal.appendChild(iframe);
if (iframe.offsetTop < 30 && !KAMPYLE_DATA.getMemoryData('kampyleDevice') === KAMPYLE_CONSTANT.DEVICES.MOBILE) {
modal.style.paddingTop = 30 - iframe.offsetTop + 'px';
}
}
} else {
url = location.protocol + '//' + location.host;
window.location = url + '/#/error/404';
}
}
function getUserIdentifierVal() {
var identifierCustomParam = KAMPYLE_DATA.getUserIdentifier();
if (!identifierCustomParam) {
return null;
}
var userIdentifierVal = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue({
name: identifierCustomParam.source_name,
type: identifierCustomParam.type,
source: identifierCustomParam.source,
});
if (!userIdentifierVal) {
return null;
}
return userIdentifierVal;
}
function setIdentifierData(identifierData) {
KAMPYLE_DATA.setMemoryData('isSyncedIdentifierData', true);
updateIdentifierDataIfNecessary(identifierData.data);
}
function updateIdentifierDataIfNecessary(identifierData) {
updateIdentifierDataIntegerIfNecessary(identifierData.DECLINED_DATE, 'DECLINED_DATE');
updateIdentifierDataIntegerIfNecessary(identifierData.SUBMITTED_DATE, 'SUBMITTED_DATE');
}
function updateIdentifierDataIntegerIfNecessary(identifierDataValue, userStateString) {
var localStorageDate = parseInt(KAMPYLE_DATA.getData(userStateString));
localStorageDate = localStorageDate ? localStorageDate : null;
var identifierDataToSync = {
identifierDataState: userStateString,
identifierValOnLocalStorage: localStorageDate
};
var identifierDataValues = {
identifierDataState: userStateString,
identifierValOnSbt: identifierDataValue,
identifierValOnLocalStorage: localStorageDate
};
identifierDataValue = identifierDataValue ? identifierDataValue : null;
if (identifierDataValue === localStorageDate) {
return null;
}
if ((identifierDataValue !== null && localStorageDate === null) || identifierDataValue > localStorageDate) {
KAMPYLE_DATA.setData(userStateString, identifierDataValue);
} else if ((localStorageDate !== null && identifierDataValue === null) || identifierDataValue < localStorageDate) {
KAMPYLE_FUNC.updateTargeting(userStateString, localStorageDate);
} else {
KAMPYLE_UTILS.showWarning('special case');
}
}
function syncIdentifierData(userIdentifierVal, callback) {
var propertyId = kampyleGetData().websiteId || null;
var urlPrefix = KAMPYLE_DATA.getServerBasedTargetingPrefix();
var envPrefix = KAMPYLE_DATA.getServerBasedTargetingEnv();
var url = urlPrefix + '/api/targeting/property/' + envPrefix + propertyId + '/identity/' + userIdentifierVal;
var onSuccess = KAMPYLE_FUNC.onSyncIdentifierDataSuccess.bind(null, callback);
var onFailure = onSyncIdentifierDataFailure.bind(null, callback);
KAMPYLE_UTILS.httpGetRequest(url, onSuccess, onFailure);
}
function onSyncIdentifierDataSuccess(callback, data) {
if (!data || data.error) {
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError({
message: 'Invalid identifier data. Data: ' + JSON.stringify(data)
});
} else {
setIdentifierData(data);
}
typeof callback === 'function' && callback();
}
function onSyncIdentifierDataFailure(callback, error) {
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError({
message: 'Failed to fetch identifier data. Error: ' + JSON.stringify(error)
});
typeof callback === 'function' && callback();
}
function shouldSyncIdentifier(newUserIdentifierVal) {
var prevUserIdentifierVal = KAMPYLE_DATA.getMemoryData('identifierValue');
var isSyncedIdentifierData = KAMPYLE_DATA.getMemoryData('isSyncedIdentifierData') === true;
var isSBTOn = !!KAMPYLE_FUNC.checkProvision('serverBasedTargeting');
var isIdentifiedUser = !!newUserIdentifierVal;
return isIdentifiedUser && isSBTOn && (!isSyncedIdentifierData || prevUserIdentifierVal !== newUserIdentifierVal);
}
function startCheckingTargeting() {
if (isAnyBlockingFormShown()) {
return false;
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_pageView');
if (KAMPYLE_DATA.getMemoryData('context') === 'preview') {
showPreviewForm();
} else if (window.KAMPYLE_ONSITE_STATE !== 'manual') {
var shouldSkipInviteTargeting = KAMPYLE_DATA.isFeatureEnabled(KAMPYLE_CONSTANT.PROPERTY_SETTINGS.MANUALLY_INVITE_TARGETING);
KAMPYLE_EVENT_DISPATCHER.trigger('neb_targetingInit', {
skipInviteTargeting: shouldSkipInviteTargeting
});
}
}
function increasePageViewCounter() {
var sessionPageCounter = KAMPYLE_DATA.getData('kampyleSessionPageCounter') || 0;
sessionPageCounter = parseInt(sessionPageCounter);
KAMPYLE_DATA.setData('kampyleSessionPageCounter', ++sessionPageCounter);
}
function handleFormClosed(eventName, data) {
data = data || {};
if (!data.isFormSubmitted) {
var date = Date.now();
KAMPYLE_DATA.setData('DECLINED_DATE', date);
if (!!KAMPYLE_FUNC.checkProvision('serverBasedTargeting')) {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_updateTargetingWithDeclinedDateFormClosed', {
declinedDate: date
});
}
KAMPYLE_FUNC.updateTargeting('DECLINED_DATE', date);
}
KAMPYLE_DATA.setMemoryData('formIsShown', false);
KAMPYLE_DATA.setFormState(data.formId, {
shown: false,
loaded: false
});
refocusActiveElement();
KAMPYLE_UTILS.triggerCustomEvent('neb_formClosed', {
formId: data.formId
});
if (KAMPYLE_DATA.getMemoryData('context') === 'preview') {
window.close();
}
var formData = KAMPYLE_DATA.getFormData(KAMPYLE_DATA.getMemoryData('buttonFormId'));
var delay = 0;
if (KAMPYLE_DATA.getDisplayType(formData) === 'animation') {
delay = 1000;
}
if (KAMPYLE_DATA.getMemoryData('buttonFormId')) {
setTimeout(function() {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_showButton', {
formId: KAMPYLE_DATA.getMemoryData('buttonFormId')
});
}, delay);
}
}
function updateTargeting(stateType, data) {
if (!!checkProvision('serverBasedTargeting') && !!KAMPYLE_DATA.getMemoryData('identifierValue')) {
var dataJson = {};
dataJson[stateType] = data;
var urlPrefix = KAMPYLE_DATA.getServerBasedTargetingPrefix();
var envPrefix = KAMPYLE_DATA.getServerBasedTargetingEnv();
var url = urlPrefix + '/api/targeting/property/' + envPrefix + kampyleGetData().websiteId + '/identity/' + KAMPYLE_DATA.getMemoryData('identifierValue');
var dataStateType = dataJson[stateType];
var dataObjForSbt = {
dataState: dataStateType,
dataValue: data
};
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_updatingSbtServer', dataObjForSbt);
KAMPYLE_UTILS.httpPostRequest(url, dataJson);
}
}
function handleFeedbackSubmitted(eventMapping, data) {
var date = Date.now();
KAMPYLE_DATA.setData('SUBMITTED_DATE', date);
if (!!KAMPYLE_FUNC.checkProvision('serverBasedTargeting')) {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_updateTargetingWithSubmittedDate', {
submittedDate: date
});
}
KAMPYLE_FUNC.updateTargeting('SUBMITTED_DATE', date);
}
function handleInviteDeclined(eventName, data) {
var date = Date.now();
KAMPYLE_DATA.setData('DECLINED_DATE', date);
if (!!KAMPYLE_FUNC.checkProvision('serverBasedTargeting')) {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_updateTargetingWithDeclinedDateInviteDeclined', {
declinedDate: date
});
}
KAMPYLE_FUNC.updateTargeting('DECLINED_DATE', date);
refocusActiveElement();
}
function handleFormLoaded(eventName, data) {
KAMPYLE_DATA.setFormState(data.formId, {
loading: false,
loaded: true,
});
if (isFormShown(data.formId)) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formReady', {
formId: data.formId
});
}
}
function loadScreenCaptureApi(eventName, data) {
data = data || {};
}
function handleScreenCaptureApiLoaded(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
var iframePrefix;
switch (KAMPYLE_DATA.getDisplayType(formData)) {
case KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX:
iframePrefix = 'kampyleForm';
break;
case KAMPYLE_CONSTANT.DISPLAY_TYPES.ANIMATION:
iframePrefix = 'kampyleFormAnimation';
break;
default:
iframePrefix = 'kampyleForm';
}
var iframeId = iframePrefix + data.formId;
KAMPYLE_UTILS.sendMessageToIframe(iframeId, {
action: 'screenCaptureLoaded'
});
}
function setFocusedElement() {
KAMPYLE_DATA.setMemoryData('kampyleFocusedElement', document.activeElement);
}
function refocusActiveElement() {
var focused = KAMPYLE_DATA.getMemoryData('kampyleFocusedElement');
if (focused && focused.focus) {
focused.focus();
}
}
function checkProvision(name) {
var dataObj = kampyleGetData();
return !!name && !!dataObj && !!dataObj.provisions && (!!dataObj.provisions[name] || dataObj.provisions[name] === 'true');
}
function getAllProvisions() {
var allProvisions = KAMPYLE_FUNC.kampyleGetData().provisions;
var provisions = {};
for (var provision in allProvisions) {
if (allProvisions.hasOwnProperty(provision)) {
provisions[provision] = checkProvision(provision);
}
}
return provisions;
}
function checkDevice() {
if (!KAMPYLE_DATA.getMemoryData('kampyleDevice')) {
KAMPYLE_DATA.setMemoryData('kampyleDevice', KAMPYLE_UTILS.getDeviceTypeByUserAgent(navigator.userAgent));
}
return KAMPYLE_DATA.getMemoryData('kampyleDevice') || 'desktop';
}
function isFormShown(formId) {
var formState = KAMPYLE_DATA.getFormState(formId);
return formState && formState.shown;
}
function isFormLoaded(formId) {
var formState = KAMPYLE_DATA.getFormState(formId);
return !!formState && !!formState.loaded;
}
function addScreenCaptureData(messageData) {
var version = KAMPYLE_DATA.getMemoryData('version');
if (version === 1) {
messageData.screenCapture = {
isTaken: false
};
} else {
messageData.integrations.screenCapture = {
isTaken: false
};
}
return messageData;
}
function sendFormExtraData(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
if (!formData || !data.formId) {
return false;
}
var targetWindow;
var currIframe;
var formDisplayType = KAMPYLE_DATA.getDisplayType(formData);
switch (formDisplayType) {
case 'animation':
currIframe = document.getElementById('kampyleFormAnimation' + data.formId);
break;
case 'lightbox':
currIframe = document.getElementById('kampyleForm' + data.formId);
break;
case 'popup':
targetWindow = KAMPYLE_DATA.getMemoryData('popupHandler');
break;
case KAMPYLE_CONSTANT.DISPLAY_TYPES.EMBEDDED:
currIframe = document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId);
break;
default:
KAMPYLE_UTILS.showWarning('Invalid display type - ' + formDisplayType);
return false;
}
var origin = '*';
if (currIframe && currIframe.getAttribute) {
origin = currIframe.getAttribute('origin') || '*';
targetWindow = currIframe.contentWindow;
}
if (targetWindow && targetWindow.postMessage) {
if (MDIGITAL.CUSTOM_PARAMETERS.hasCustomParams(data.formId)) {
var customParams = MDIGITAL.CUSTOM_PARAMETERS.formatCustomParams(data.formId);
targetWindow.postMessage('{"action": "customParamsLoaded","customParams" : ' + JSON.stringify(customParams) + '}', origin);
}
var messageData = '{"action": "setFormId","formId" : ' + data.formId + '}';
targetWindow.postMessage(messageData, origin);
messageData = {
action: 'setExtraData',
};
messageData.provisions = getAllProvisions();
messageData.integrations = KAMPYLE_INTEGRATION.getIntegrationData();
messageData.websiteId = kampyleGetData().websiteId || null;
messageData.device = KAMPYLE_DATA.getMemoryData('kampyleDevice');
messageData.context = KAMPYLE_DATA.getMemoryData('context');
messageData.url = encodeURIComponent(document.location.href);
messageData.customCssUpload = KAMPYLE_DATA.isFeatureEnabled(KAMPYLE_CONSTANT.PROPERTY_SETTINGS.CUSTOM_CSS_UPLOAD),
messageData.displayType = KAMPYLE_DATA.getDisplayType(formData);
if (KAMPYLE_FUNC.checkProvision('serverBasedTargeting')) {
messageData.endUserIdentifier = getUserIdentifierVal();
KAMPYLE_EVENT_DISPATCHER.trigger('neb_initUserIdentifierOnExtraData', {
hasIdentifierValue: messageData.endUserIdentifier !== null
});
}
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)) {
messageData.onPremPackageVersion = MDIGITAL_OnPrem.getPackageVersion();
}
var pendingExtraData = KAMPYLE_DATA.flushFormExtraData(data.formId);
if (pendingExtraData) {
for (var extra in pendingExtraData) {
if (pendingExtraData.hasOwnProperty(extra)) {
messageData[extra] = pendingExtraData[extra];
}
}
}
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION)) {
var callbackFunction = function(jsonData) {
messageData = Object.assign({}, messageData, {
formData: jsonData
});
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.LOCALIZED_FORMS)) {
messageData.formLanguage = MDIGITAL.LOCALIZATION.getFormLanguage(data.formId) || null;
}
targetWindow.postMessage(JSON.stringify(messageData), origin);
};
var onError = function(error) {
console.error(error);
};
KAMPYLE_DATA.fetchFormJsonData({
formId: formData.formId,
callback: callbackFunction,
onError: onError
}, true);
} else {
targetWindow.postMessage(JSON.stringify(messageData), origin);
}
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formShown', {
formId: data.formId,
feedbackUUID: data.uuid,
});
}
function handleVersion(eventName, data) {
data = data || {};
KAMPYLE_DATA.setMemoryData('NEB_FORM_VERSION', data.formVersion || 0);
}
function handleTakenScreenCapture(eventName, data) {
data = data || {};
var iframeId = 'kampyleForm' + data.formId;
var formData = KAMPYLE_DATA.getFormData(data.formId);
if (KAMPYLE_DATA.getDisplayType(formData) === 'animation') {
iframeId = 'kampyleFormAnimation' + data.formId;
}
KAMPYLE_UTILS.sendMessageToIframe(iframeId, {
action: 'takenScreenCapture',
data: data
});
}
function isAnyInviteShown() {
var allFormStates = KAMPYLE_DATA.getMemoryData('formsState') || {};
for (var formId in allFormStates) {
if (allFormStates.hasOwnProperty(formId)) {
if (allFormStates[formId].inviteShown) {
return true;
}
}
}
return false;
}
function isAnyBlockingFormShown() {
var allFormStates = KAMPYLE_DATA.getMemoryData('formsState') || {};
for (var formId in allFormStates) {
if (allFormStates.hasOwnProperty(formId)) {
if (allFormStates[formId].shown && isFormBlocking(formId)) {
return true;
}
}
}
return false;
}
function isFormBlocking(formId) {
return !KAMPYLE_DATA.isEmbeddedDisplayType(formId);
}
function getSafeCustomParamVal(currParam) {
currParam = currParam || {};
var currParamVal = currParam.value;
var currParamSource = currParam.source || 'var';
var currParamType = currParam.type || '';
var currParamName = currParam.name || currParam.source_name || '';
if (currParamVal === undefined) {
switch (KAMPYLE_UTILS.safeToLower(currParamSource)) {
case 'var':
currParamVal = KAMPYLE_UTILS.getNestedPropertyValue(window, currParamName);
break;
case 'url':
currParamVal = KAMPYLE_UTILS.getUrlParam(currParamName);
break;
case 'cookie':
currParamVal = KAMPYLE_UTILS.getCookie(currParamName);
break;
default:
currParamVal = null;
break;
}
if (currParamVal === '') {
currParamVal = null;
}
}
if (currParamVal !== null) {
switch (currParamType.toLowerCase()) {
case 'datetime':
if (typeof currParamVal === 'string') {
currParamVal = parseInt(currParamVal) || null;
} else if (!(currParamVal instanceof Date) && (!currParamVal.getTime || isNaN(currParamVal.getTime()))) {
currParamVal = null;
} else {
currParamVal = currParamVal.getTime();
}
break;
case 'number':
currParamVal = KAMPYLE_UTILS.getNumericValue(currParamVal);
break;
case 'text':
if (typeof (currParamVal) !== 'string') {
currParamVal = null;
}
break;
case 'boolean':
if (currParamVal === 'true') {
currParamVal = true;
} else if (currParamVal === 'false') {
currParamVal = false;
}
if (typeof (currParamVal) !== 'boolean') {
currParamVal = null;
}
break;
default:
currParamVal = null;
console.error('Invalid custom parameter type ' + currParamType);
break;
}
}
return currParamVal;
}
function isPreloadConfigured() {
var data = KAMPYLE_FUNC.kampyleGetData();
return (!!data && data.isFormsPreloaded !== 'false' && data.isFormsPreloaded !== false);
}
function addToSessionCount() {
var kampyleUserSessionsCount = KAMPYLE_DATA.getData('kampyleUserSessionsCount');
kampyleUserSessionsCount = Number(kampyleUserSessionsCount) || 0;
KAMPYLE_DATA.setData('kampyleUserSessionsCount', ++kampyleUserSessionsCount);
}
function handleHashChanged() {
if (KAMPYLE_DATA.isFeatureEnabled('SPA')) {
startCheckingTargeting();
}
}
function kampyleButtonClicked(formData) {
formData = formData || {};
KAMPYLE_EVENT_DISPATCHER.trigger('neb_buttonClicked', {
formId: formData.formId,
});
}
function getTimeInSession() {
var sessionStartTimestamp = Number(KAMPYLE_DATA.getData('kampyleUserSession')) || Date.now();
return Math.floor(KAMPYLE_UTILS.getTimeDiff(sessionStartTimestamp, KAMPYLE_CONSTANT.TIME_FORMATS.SECONDS));
}
function getTimeOnPage() {
var timeOnPage = Number(KAMPYLE_DATA.getData('kampylePageLoadedTimestamp')) || Date.now();
return Math.floor(KAMPYLE_UTILS.getTimeDiff(timeOnPage, KAMPYLE_CONSTANT.TIME_FORMATS.SECONDS));
}
function getLastDeclineSubmit(key) {
var date = Number(KAMPYLE_DATA.getData(key));
return !!date ? KAMPYLE_UTILS.getTimeDiff(date, KAMPYLE_CONSTANT.TIME_FORMATS.DAYS) : null;
}
function prepareInviteTriggeringData(eventName, data) {
var deviceName = (KAMPYLE_DATA.getMemoryData('kampyleDevice') || KAMPYLE_CONSTANT.DEVICES.DESKTOP).toLowerCase();
var formData = KAMPYLE_DATA.getFormData(data.formId);
var inviteTriggeringData = {
desktop: deviceName === KAMPYLE_CONSTANT.DEVICES.DESKTOP,
mobile: deviceName === KAMPYLE_CONSTANT.DEVICES.MOBILE,
tablet: deviceName === KAMPYLE_CONSTANT.DEVICES.TABLET,
abandon: !!KAMPYLE_DATA.getMemoryData('targetingState.abandon'),
time_in_session: getTimeInSession(),
time_on_page: getTimeOnPage(),
excluded_urls: KAMPYLE_UTILS.getNestedPropertyValue(formData, 'urlRules.exclusionUrl.rule'),
included_urls: KAMPYLE_UTILS.getNestedPropertyValue(formData, 'urlRules.inclusionUrl.rule'),
number_of_visits: Number(KAMPYLE_DATA.getData('kampyleUserSessionsCount')) || 1,
last_declined: getLastDeclineSubmit('DECLINED_DATE'),
last_feedback: getLastDeclineSubmit('SUBMITTED_DATE'),
percentage: KAMPYLE_TARGETING.getUserPercentile(data.formId),
};
KAMPYLE_DATA.setMemoryData('invitationTriggeringData', inviteTriggeringData);
}
return {
increasePageViewCounter: increasePageViewCounter,
subscribeToCustomEvents: subscribeToCustomEvents,
subscribeToPageEvents: subscribeToPageEvents,
createSession: createSession,
updateTargeting: updateTargeting,
checkProvision: checkProvision,
getAllProvisions: getAllProvisions,
onSyncIdentifierDataSuccess: onSyncIdentifierDataSuccess,
addScreenCaptureData: addScreenCaptureData,
sendFormExtraData: sendFormExtraData,
handleVersion: handleVersion,
showPreviewForm: showPreviewForm,
updatePreviewIframeStyle: updatePreviewIframeStyle,
validateFormContract: validateFormContract,
getTriggerTypeByEvent: getTriggerTypeByEvent,
prepareInviteTriggeringData: prepareInviteTriggeringData,
loadScreenCaptureApi: loadScreenCaptureApi,
handleInviteLoaded: handleInviteLoaded,
sendInviteInitialData: sendInviteInitialData,
checkDevice: checkDevice,
shouldSyncIdentifier: shouldSyncIdentifier,
init: init,
startCheckingTargeting: startCheckingTargeting,
isAnyFormShown: isAnyBlockingFormShown,
isAnyInviteShown: isAnyInviteShown,
getSafeCustomParamVal: getSafeCustomParamVal,
isPreloadConfigured: isPreloadConfigured,
kampyleGetData: kampyleGetData,
isFormLoaded: isFormLoaded,
kampyleButtonClicked: kampyleButtonClicked,
loadMultipileForms: loadMultipileForms,
routeToForm: routeToForm,
updateIdentifierDataIntegerIfNecessary: updateIdentifierDataIntegerIfNecessary,
syncIdentifierData: syncIdentifierData,
getUserIdentifierVal: getUserIdentifierVal
};
}
)();
window.KAMPYLE_DATA = (function() {
var dataJson;
var _memory;
var TargetingMapping = {
abandon: 'abandon',
percentage: 'kampyleInvitePercentageUsers',
timeInSession: 'kampyleTimeInSession',
timeOnPage: 'kampyleTimeOnPage',
deviceTypes: 'devicetypes',
pageEvents: 'pageElementEvent',
};
var init = function() {
dataJson = KAMPYLE_FUNC.kampyleGetData() || {};
_memory = {};
initFormState();
};
function getShownFormId() {
var allFormStates = KAMPYLE_DATA.getMemoryData('formsState') || {};
for (var formId in allFormStates) {
if (allFormStates.hasOwnProperty(formId)) {
if (allFormStates[formId].shown) {
return formId;
}
}
}
return false;
}
function initFormState() {
var formsState = {};
var allData = KAMPYLE_FUNC.kampyleGetData() || {};
var allForms = allData.formNodes || [];
var len = allForms.length;
var curr;
for (var i = 0; i < len; i++) {
curr = allForms[i];
if (curr) {
formsState[curr.formId] = {
loading: false,
loaded: false,
shown: false,
inviteLoaded: false,
inviteShown: false,
targeting: {
pageTargeting: null,
behavioralTargeting: [],
quarantineTargeting: []
}
};
}
}
setMemoryData('formsState', formsState);
setMemoryData('hostingElementsHeights', {});
}
function isFeatureEnabled(featureName) {
var featureToPathMapping = {
'GTM': 'isGoogleAnalyticsClientGTM',
'WCAG': 'isWCAG',
'SPA': 'isSpa',
'MANUALLY_INVITE_TARGETING': 'isManuallyInviteTargeting',
'CUSTOM_CSS_UPLOAD': 'customCssUpload'
};
var path = featureToPathMapping[featureName];
return !!path && !!KAMPYLE_UTILS.getNestedPropertyValue(dataJson, path);
}
function getData(dataName) {
try {
if (KAMPYLE_DATA.getPropertySharedSubdomain()) {
return KAMPYLE_UTILS.kampyleGetCookie(KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX + dataName);
}
return localStorage[dataName] || KAMPYLE_UTILS.kampyleGetCookie(dataName);
} catch (e) {
return KAMPYLE_UTILS.kampyleGetCookie(dataName);
}
}
function getMemoryData(dataName) {
dataName = dataName || '';
return KAMPYLE_UTILS.getNestedPropertyValue(_memory, dataName);
}
function setMemoryData(dataName, dataValue) {
KAMPYLE_UTILS.setNestedPropertyValue(_memory, dataName, dataValue);
}
function deleteMemoryData(dataName) {
delete (_memory || {})[dataName];
}
function setData(dataName, dataValue, expriration) {
if (!KAMPYLE_DATA.getPropertySharedSubdomain()) {
try {
localStorage[dataName] = dataValue;
} catch (e) {}
}
KAMPYLE_UTILS.kampyleSetCookie(dataName, dataValue, expriration || getCookieExpiration(), KAMPYLE_DATA.getPropertySharedSubdomain());
return true;
}
var deleteData = function(dataName) {
var propertySharedSubdomain = KAMPYLE_DATA.getPropertySharedSubdomain();
if (propertySharedSubdomain) {
KAMPYLE_UTILS.kampyleDeleteCookie(KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX + dataName, propertySharedSubdomain);
return;
}
try {
if (localStorage[dataName] !== undefined) {
delete localStorage[dataName];
}
} catch (e) {}
KAMPYLE_UTILS.kampyleDeleteCookie(dataName);
};
function getFormData(formId) {
var allForms = getAllForms();
var len = allForms.length, curr;
for (var i = 0; i < len; i++) {
curr = allForms[i];
if (parseInt(formId) === parseInt(curr.formId)) {
return curr;
}
}
return null;
}
;function getMemory() {
return _memory;
}
function getFormState(formId) {
formId = formId || '';
return getMemoryData('formsState.' + formId) || null;
}
function setFormState(formId, data) {
data = data || {};
var allFormState = getMemoryData('formsState') || {};
allFormState[formId] = allFormState[formId] || {};
for (var prop in data) {
if (typeof allFormState[formId][prop] === "object") {
Object.assign(allFormState[formId][prop], data[prop]);
} else {
allFormState[formId][prop] = data[prop];
}
}
setMemoryData('formsState', allFormState);
}
function getAllForms() {
var allData = KAMPYLE_FUNC.kampyleGetData() || {};
var allForms = allData.formNodes || [];
return allForms;
}
function getInegrations() {
var allData = KAMPYLE_FUNC.kampyleGetData() || {};
return allData.integrations || {};
}
function getInviteData(formId) {
var formData = getFormData(formId);
return !!formData ? formData.inviteData : null;
}
function isNewMobileInvitation() {
var hasProvision = KAMPYLE_FUNC.checkProvision('mobileInvitationLayout');
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
return !!hasProvision && kampyleDevice !== 'desktop';
}
function isFixedSize(formId) {
var formData = getFormData(formId) || {};
return formData.isFixedSize === true || formData.isFixedSize === 'true';
}
function isCustomHtmlAndFixedSizeForm(formId) {
var customHtmlForm = KAMPYLE_DATA.isCustomHtmlForm(formId);
var hasProvision = KAMPYLE_FUNC.checkProvision('dynamicModalSizeInCustomHtml');
return customHtmlForm && (!hasProvision || hasProvision && (isFixedSize(formId)));
}
function getDisplayType(formData) {
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
var displayType = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'formDisplay.displayType');
if (kampyleDevice !== KAMPYLE_CONSTANT.DEVICES.DESKTOP) {
return displayType === KAMPYLE_CONSTANT.DISPLAY_TYPES.EMBEDDED ? KAMPYLE_CONSTANT.DISPLAY_TYPES.EMBEDDED : KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX;
} else {
return displayType || KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX;
}
}
function saveFormExtraData(formId, extraData) {
extraData = extraData || {};
var oldExtraData = (getFormState(formId) || {}).pendingExtraData || {};
extraData = Object.assign(oldExtraData, extraData);
setFormState(formId, {
pendingExtraData: extraData
});
}
function flushFormExtraData(formId) {
var formState = getFormState(formId) || {};
var extraData = {};
if (formState && formState.pendingExtraData) {
extraData = formState.pendingExtraData;
delete formState.pendingExtraData;
}
return extraData;
}
function isCustomHtmlForm(formId) {
var formData = getFormData(formId) || {};
var isCustomHtml = KAMPYLE_UTILS.getUrlParam('isCustomHtml');
return formData.isCustomHtmlEnabled === true || formData.isCustomHtmlEnabled === 'true' || isCustomHtml === true || isCustomHtml === 'true';
}
function getCookieExpiration() {
return KAMPYLE_UTILS.getNestedPropertyValue(dataJson, 'cookieExpirationTime') || KAMPYLE_CONSTANT.COOKIE_EXPIRATION;
}
function getTargetingData(formId, targetingName) {
if (!formId || !targetingName || !TargetingMapping[targetingName]) {
return null;
}
var selectedForm = getFormData(formId) || {};
var targetingRealName = TargetingMapping[targetingName];
return KAMPYLE_UTILS.getNestedPropertyValue(selectedForm, 'onSiteData.' + targetingRealName);
}
function getFormVersion(formId) {
var formData = KAMPYLE_DATA.getFormData(formId);
return Number((formData || {}).formVersion) || 0;
}
function getPropertyId() {
return KAMPYLE_FUNC.kampyleGetData().websiteId || null;
}
function isMobileDynamicSizing(formId) {
var device = KAMPYLE_DATA.getMemoryData('kampyleDevice');
var requiredVersion = KAMPYLE_CONSTANT.FEATURE_VERSIONS.MOBILE_DYNAMIC_SIZING;
formId = formId || KAMPYLE_DATA.getMemoryData('currentFormId');
var isCustomHtml = KAMPYLE_DATA.isCustomHtmlForm(formId);
var isProvisioned = ((isCustomHtml && KAMPYLE_FUNC.checkProvision('mobileWebDynamicFormSize')) || (!isCustomHtml && KAMPYLE_FUNC.checkProvision('mobileWebDynamicFormSizeInFormBuilder')));
return isProvisioned && (device && device !== 'desktop') && KAMPYLE_DATA.getFormVersion(formId) >= requiredVersion;
}
function isMobile() {
var device = KAMPYLE_DATA.getMemoryData('kampyleDevice');
return (device && device !== 'desktop');
}
function getServerBasedTargetingPrefix() {
var jsonData = getMemoryData('dataJson');
return KAMPYLE_UTILS.getNestedPropertyValue(jsonData, 'sbtServerDomain');
}
function getServerBasedTargetingEnv() {
var jsonData = getMemoryData('dataJson');
return KAMPYLE_UTILS.getNestedPropertyValue(jsonData, 'sbtEnvPrefix');
}
function getCustomParams() {
var jsonData = getMemoryData('dataJson');
var formNodes = KAMPYLE_UTILS.getNestedPropertyValue(jsonData, 'formNodes');
if (formNodes && formNodes[0] && formNodes[0].customParams) {
return formNodes[0].customParams;
}
return null;
}
function getPropertySharedSubdomain() {
var jsonData = getMemoryData('dataJson');
var sharedSubdomain = KAMPYLE_UTILS.getNestedPropertyValue(jsonData, 'sharedSubdomain');
return sharedSubdomain && KAMPYLE_UTILS.isHostMatchesSubdomain(window.location.host, sharedSubdomain) ? sharedSubdomain : null;
}
function getUserIdentifier() {
var jsonData = KAMPYLE_DATA.getMemoryData('dataJson');
var formNodes = KAMPYLE_UTILS.getNestedPropertyValue(jsonData, 'formNodes') || [];
for (var i = 0; i < formNodes.length; i++) {
var identifierCp = (formNodes[i].customParams || []).find(function(cp) {
return cp.is_identifier.toLowerCase() === 'true'
}) || null;
if (identifierCp !== null) {
return identifierCp;
}
}
;return null;
}
function isPopupDisplayType(formId) {
var formData = getFormData(formId);
return getDisplayType(formData) === KAMPYLE_CONSTANT.DISPLAY_TYPES.POPUP;
}
function isEmbeddedDisplayType(formId) {
var formData = getFormData(formId);
return getDisplayType(formData) === KAMPYLE_CONSTANT.DISPLAY_TYPES.EMBEDDED;
}
function isLightBoxDisplayType(formId) {
var formData = getFormData(formId);
return getDisplayType(formData) === KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX;
}
function localizeUrl(formId, url) {
var langCode = (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.LOCALIZED_FORMS) && MDIGITAL.LOCALIZATION.getFormLanguage(formId)) || KAMPYLE_CONSTANT.LOCALIZED_FORM_DEFAULT_REPLACE_VALUE;
return url.replace('###LANGUAGE_CODE###', langCode);
}
function getDataJsonUrl(formId, isInviteJson) {
var formData = KAMPYLE_DATA.getFormData(formId);
var jsonDataUrl = KAMPYLE_UTILS.getNestedPropertyValue(formData, isInviteJson ? 'inviteData.inviteDataUrl' : 'formDataUrl')
if (!jsonDataUrl) {
return null;
}
return KAMPYLE_DATA.localizeUrl(formId, jsonDataUrl);
}
function fetchFormJsonData(obj, isSecondCall) {
var jsonDataMemoryKey = (obj.isInvite ? KAMPYLE_CONSTANT.INVITE_JSON_DATA_KEY_PREFIX : KAMPYLE_CONSTANT.FORM_JSON_DATA_KEY_PREFIX) + obj.formId;
var jsonData = KAMPYLE_DATA.getMemoryData(jsonDataMemoryKey);
var url = KAMPYLE_DATA.getDataJsonUrl(obj.formId, obj.isInvite);
if (jsonData) {
return typeof obj.callback === "function" && obj.callback(jsonData);
}
if (!url) {
var error = new Error("Failed to get JSON data URL");
return typeof obj.onError === "function" && obj.onError(error);
}
KAMPYLE_UTILS.httpGetRequest(url, function(data) {
if (isSecondCall) {
var warnMessage = 'second http request have been made to the url: ' + url;
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_warning', {
message: warnMessage
});
}
if (!data) {
var error = new Error('Invalid form json data. Data: ' + JSON.stringify(data));
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError(error);
typeof obj.onError === "function" && obj.onError(error);
} else {
KAMPYLE_DATA.setMemoryData(jsonDataMemoryKey, data);
typeof obj.callback === "function" && obj.callback(data);
}
}, function(error) {
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError({
message: 'Failed to fetch JSON data. Error: ' + JSON.stringify(error)
});
typeof obj.onError === "function" && obj.onError(error);
});
}
function getFormTriggerType(formId) {
var formType = KAMPYLE_UTILS.getNestedPropertyValue(KAMPYLE_DATA.getFormData(formId), 'formType');
return KAMPYLE_CONSTANT.FORM_TRIGGER_TYPES_MAP[formType] ? formType : null;
}
function hasFormJsonData(formData) {
var memoryDataKey = (formData.formType === KAMPYLE_CONSTANT.FORM_TYPES.INVITATION ? KAMPYLE_CONSTANT.INVITE_JSON_DATA_KEY_PREFIX : KAMPYLE_CONSTANT.FORM_JSON_DATA_KEY_PREFIX) + formData.formId;
var formJsonData = KAMPYLE_DATA.getMemoryData(memoryDataKey);
return !KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION) || !!formJsonData;
}
return {
init: init,
isFeatureEnabled: isFeatureEnabled,
getData: getData,
setData: setData,
deleteData: deleteData,
getAllForms: getAllForms,
getInegrations: getInegrations,
getFormData: getFormData,
getMemoryData: getMemoryData,
getTargetingData: getTargetingData,
setMemoryData: setMemoryData,
getShownFormId: getShownFormId,
getFormState: getFormState,
setFormState: setFormState,
getInviteData: getInviteData,
getDisplayType: getDisplayType,
saveFormExtraData: saveFormExtraData,
flushFormExtraData: flushFormExtraData,
isCustomHtmlForm: isCustomHtmlForm,
getCookieExpiration: getCookieExpiration,
isNewMobileInvitation: isNewMobileInvitation,
isCustomHtmlAndFixedSizeForm: isCustomHtmlAndFixedSizeForm,
deleteMemoryData: deleteMemoryData,
getFormVersion: getFormVersion,
isMobileDynamicSizing: isMobileDynamicSizing,
getCustomParams: getCustomParams,
getPropertySharedSubdomain: getPropertySharedSubdomain,
getUserIdentifier: getUserIdentifier,
getServerBasedTargetingPrefix: getServerBasedTargetingPrefix,
getServerBasedTargetingEnv: getServerBasedTargetingEnv,
isPopupDisplayType: isPopupDisplayType,
isEmbeddedDisplayType: isEmbeddedDisplayType,
isLightBoxDisplayType: isLightBoxDisplayType,
fetchFormJsonData: fetchFormJsonData,
getFormTriggerType: getFormTriggerType,
getPropertyId: getPropertyId,
isMobile: isMobile,
localizeUrl: localizeUrl,
getMemory: getMemory,
initFormState: initFormState,
getDataJsonUrl: getDataJsonUrl,
hasFormJsonData: hasFormJsonData
};
}
)();
window.KAMPYLE_TARGETING = (function(window, document) {
var QUARANTINE_DEFAULT_TEXTS = {
DECLINED_DATE: 'The user did not decline',
SUBMITTED_DATE: 'The user did not submit'
};
function init() {
var eventMapping = {
neb_targetingInit: [initTargeting],
MDigital_manuallyInviteTargeting: [handleFormsTargeting],
neb_initButton: [handleButton],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
KAMPYLE_DATA.setMemoryData('targetingState', {});
}
function isDataValid(days, cookieName) {
var checkingDate = Number(KAMPYLE_DATA.getData(cookieName));
days = Number(days);
if (!checkingDate || !days) {
return false;
}
var msInOneDay = 1000 * 60 * 60 * 24;
return (checkingDate + (msInOneDay * days)) > Date.now();
}
function handleButton(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
if (!formData) {
return false;
}
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
if (kampyleDevice === KAMPYLE_CONSTANT.DEVICES.MOBILE || kampyleDevice === KAMPYLE_CONSTANT.DEVICES.TABLET) {
if (KAMPYLE_FUNC.isPreloadConfigured()) {
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENT_NAME.NEB_LOAD_FORM, {
formId: data.formId
});
}
}
KAMPYLE_DATA.setFormState(data.formId, {
loaded: false
});
KAMPYLE_DATA.setMemoryData('buttonFormId', data.formId);
KAMPYLE_EVENT_DISPATCHER.trigger('neb_showButton', {
formId: data.formId
});
KAMPYLE_DATA.setMemoryData('isButtonShown', true);
return true;
}
function getTextByQuarentine(quarentineKey) {
if (KAMPYLE_DATA.getData(quarentineKey)) {
return new Date(parseInt(KAMPYLE_DATA.getData(quarentineKey)));
} else {
return QUARANTINE_DEFAULT_TEXTS[quarentineKey];
}
}
function isShowInvite(formData) {
var currentFormId = KAMPYLE_DATA.getMemoryData('currentFormId');
formData = formData || KAMPYLE_DATA.getFormData(currentFormId);
if (!formData) {
return false;
}
var targetingState = KAMPYLE_DATA.getMemoryData('targetingState');
for (var index in targetingState) {
if (targetingState[index] !== true) {
return false;
}
}
var shouldDisableIntercept = false;
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_BEHAVIORAL_TARGETING_PHASE_ENDED, formData);
if (shouldDisableIntercept) {
return false;
}
var isQuarantinePassed = isQuarantinePhasePassed(formData);
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_QUARANTINED_SURVEY_PHASE_ENDED, formData);
if (!isQuarantinePassed) {
return false;
}
KAMPYLE_DATA.setData('kampyleInvitePresented', true);
var isSkipInvitation = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'inviteData.skipInvitation');
KAMPYLE_UTILS.isTruthy(isSkipInvitation) ? handleSkippedInvitaion(formData) : KAMPYLE_TARGETING.handleNotSkippedInvitaion(formData);
return true;
}
function isQuarantinePhasePassed(formData) {
var isDeclined = false;
var isSubmitted = false;
var isFormIsShown = KAMPYLE_DATA.getMemoryData('formIsShown') === true;
var isInviteAlreadyShown = KAMPYLE_TARGETING.isInviteAlreadyShownInSession(formData);
return (!isDeclined && !isSubmitted && !isFormIsShown && !isInviteAlreadyShown)
}
function isUbtFailed(formData) {
var isUbtFailed = KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.SERVER_BASED_TARGETING) && !KAMPYLE_DATA.getMemoryData('isGuest') && !KAMPYLE_DATA.getMemoryData('isSyncedIdentifierData');
if (isUbtFailed) {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: formData.formId,
targetingRule: 'ubtFailed',
formTriggerType: KAMPYLE_DATA.getFormTriggerType(formData.formId),
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,
isPassed: !isUbtFailed,
expected: 'should ignore quarantine rules evaluation',
actual: isUbtFailed,
});
}
return isUbtFailed;
}
function isInviteAlreadyShownInSession(formData) {
var isInviteAlreadyShownInSession = KAMPYLE_TARGETING.isInviteShownInSession(formData.onSiteData.kampyleInvitePerSession) === true;
var configuredMoreThanOncePerSession = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'onSiteData.kampyleInvitePerSession.inviteOncePerSession');
configuredMoreThanOncePerSession = configuredMoreThanOncePerSession === true || configuredMoreThanOncePerSession === 'true';
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: formData.formId,
targetingRule: 'InvitePerSession',
formTriggerType: KAMPYLE_DATA.getFormTriggerType(formData.formId),
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.QUARANTINE_TARGETING,
isPassed: !isInviteAlreadyShownInSession,
expected: "Display Invite more than once per session",
actual: configuredMoreThanOncePerSession || !isInviteAlreadyShownInSession,
});
return isInviteAlreadyShownInSession;
}
function handleSkippedInvitaion(formData) {
if (!KAMPYLE_FUNC.isPreloadConfigured()) {
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENT_NAME.NEB_LOAD_FORM, {
formId: formData.formId
});
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_skipInvitation', {
formId: formData.formId
});
}
function handleNotSkippedInvitaion(formData) {
if (KAMPYLE_DATA.getDisplayType(formData) === KAMPYLE_CONSTANT.DISPLAY_TYPES.POPUP) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_showInvitation', {
formId: formData.formId
});
} else {
KAMPYLE_DATA.setMemoryData(KAMPYLE_TARGETING.generateShouldShowInviteParamName(formData.formId), true);
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENT_NAME.NEB_LOAD_FORM, {
formId: formData.formId
});
}
}
function initTargetingObject() {
var targetingState = KAMPYLE_DATA.getMemoryData('targetingState');
KAMPYLE_DATA.setMemoryData('targetingState', targetingState);
}
function validateCommonTargetingOnForm(form) {
var canShow = true;
var isUrlExcludedResult;
if (canShow === true) {
isUrlExcludedResult = isUrlExcluded(form);
KAMPYLE_UTILS.getNestedPropertyValue(form, 'urlRules.exclusionUrl.rule') && KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: form.formId,
targetingRule: 'UrlExclude',
formTriggerType: KAMPYLE_DATA.getFormTriggerType(form.formId),
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,
isPassed: !isUrlExcludedResult,
expected: KAMPYLE_UTILS.getNestedPropertyValue(form, 'urlRules.exclusionUrl.rule'),
actual: location.href,
});
if (isUrlExcludedResult === true) {
canShow = false;
}
}
if (canShow === true) {
var isIncluded = isUrlIncluded(form);
(KAMPYLE_UTILS.getNestedPropertyValue(form, 'urlRules.inclusionUrl.rule') && KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: form.formId,
formTriggerType: KAMPYLE_DATA.getFormTriggerType(form.formId),
targetingRule: 'UrlInclude',
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,
isPassed: isIncluded,
expected: KAMPYLE_UTILS.getNestedPropertyValue(form, 'urlRules.inclusionUrl.rule'),
actual: location.href,
}));
if (isIncluded === false) {
canShow = false;
}
}
if (canShow === true) {
var isGenericRuleValidResult = isGenericRuleValid(form);
(KAMPYLE_UTILS.getNestedPropertyValue(form, 'onSiteData.genericRule') && KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: form.formId,
targetingRule: 'GenericRule',
formTriggerType: KAMPYLE_DATA.getFormTriggerType(form.formId),
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,
isPassed: isGenericRuleValidResult,
expected: "Generic rule evaluation result should be true",
actual: isGenericRuleValidResult,
}));
canShow = isGenericRuleValidResult;
}
function isGenericRuleValid(data) {
if (data && data.onSiteData && data.onSiteData.genericRule) {
if (typeof data.onSiteData.genericRule === 'string') {
data.onSiteData.genericRule = JSON.parse(data.onSiteData.genericRule);
}
return KAMPYLE_TARGETING.evaluateRule(data.onSiteData.genericRule, data);
}
return true;
}
if (canShow === true) {
canShow = targetingDevice(form);
(KAMPYLE_UTILS.getNestedPropertyValue(form, 'onSiteData.devicetypes') && KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated', {
formId: form.formId,
targetingRule: 'DeviceTypes',
formTriggerType: KAMPYLE_DATA.getFormTriggerType(form.formId),
targetingPhase: KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,
isPassed: canShow,
expected: KAMPYLE_UTILS.getNestedPropertyValue(form, 'onSiteData.devicetypes').toString(),
actual: KAMPYLE_DATA.getMemoryData('kampyleDevice'),
}));
}
return canShow;
}
function isUrlMatch(urlToMatch) {
if (!(typeof urlToMatch === 'string')) {
return false;
}
urlToMatch = urlToMatch.toLowerCase();
var currentUrl = document.location.href.toLowerCase();
var matchUrl = currentUrl.substring(0, urlToMatch.length);
if (matchUrl === urlToMatch) {
return true;
} else {
currentUrl = currentUrl.replace(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i, '');
matchUrl = currentUrl.substring(0, urlToMatch.length);
if (matchUrl === urlToMatch) {
return true;
}
}
return false;
}
function isUrlLimits(urlsData) {
urlsData = urlsData.split(';');
var length = urlsData.length;
for (var i = 0; i < length; i++) {
var res = isUrlMatch(urlsData[i]);
if (res === true) {
return true;
}
}
return false;
}
function isUrlExcluded(data) {
if (!!data.urlRules && !!data.urlRules.exclusionUrl) {
if (!!data.urlRules.exclusionUrl.rule) {
var isExcluded = isUrlLimits(data.urlRules.exclusionUrl.rule);
return isExcluded;
}
}
return false;
}
function isUrlIncluded(data) {
if (!!data.urlRules && !!data.urlRules.inclusionUrl) {
if (!!data.urlRules.inclusionUrl.rule) {
var isIncluded = isUrlLimits(data.urlRules.inclusionUrl.rule);
return isIncluded;
}
}
return true;
}
function checkAllowedOperator(paramType, operator) {
var paramTypeToOperator = {
'text': [KAMPYLE_CONSTANT.OPERATORS.EQUALS, KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_EQUAL, KAMPYLE_CONSTANT.OPERATORS.CONTAINS, KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_CONTAIN, KAMPYLE_CONSTANT.OPERATORS.STARTS_WITH, KAMPYLE_CONSTANT.OPERATORS.ENDS_WITH, KAMPYLE_CONSTANT.OPERATORS.HAS_VALUE, KAMPYLE_CONSTANT.OPERATORS.REGEX],
'boolean': [KAMPYLE_CONSTANT.OPERATORS.EQUALS, KAMPYLE_CONSTANT.OPERATORS.HAS_VALUE],
'datetime': [KAMPYLE_CONSTANT.OPERATORS.EQUALS, KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_EQUAL, KAMPYLE_CONSTANT.OPERATORS.LATER_THAN, KAMPYLE_CONSTANT.OPERATORS.EARLIER_THAN, KAMPYLE_CONSTANT.OPERATORS.HAS_VALUE],
'number': [KAMPYLE_CONSTANT.OPERATORS.EQUALS, KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_EQUAL, KAMPYLE_CONSTANT.OPERATORS.GREATER_THAN, KAMPYLE_CONSTANT.OPERATORS.SMALLER_THAN, KAMPYLE_CONSTANT.OPERATORS.HAS_VALUE]
};
paramType = KAMPYLE_UTILS.safeToLower(paramType);
operator = KAMPYLE_UTILS.safeToLower(operator);
if (!paramType || !operator || !paramTypeToOperator[paramType] || paramTypeToOperator[paramType].indexOf(operator) === -1) {
return false;
} else {
return true;
}
return true;
}
function evaluateCriteria(criteria, formData) {
var evaluation = false;
var paramValue;
var secondParamValue;
var isAllowedOperator;
if (!criteria) {
return false;
}
var allowedTypes = ['customParam'];
var condition = KAMPYLE_UTILS.safeToLower(criteria.condition);
if (!criteria || criteria.value === undefined || criteria.value === null || allowedTypes.indexOf(criteria.fieldOrigin) === -1) {
evaluation = false;
} else {
switch (criteria.fieldOrigin) {
case 'customParam':
var customParamObj = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamById(criteria.fieldId, formData);
if (customParamObj && customParamObj.source_name) {
paramValue = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue({
type: customParamObj.type,
name: customParamObj.source_name,
source: customParamObj.source
});
secondParamValue = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue({
type: customParamObj.type,
name: customParamObj.source_name,
source: customParamObj.source,
value: criteria.value
});
isAllowedOperator = checkAllowedOperator(customParamObj.type, criteria.condition);
}
if (paramValue !== undefined && isAllowedOperator) {
evaluation = KAMPYLE_UTILS.kampyleCompareByOperator(paramValue, secondParamValue, condition, customParamObj.type);
}
break;
default:
break;
}
}
return evaluation;
}
function evaluateRule(toEvaluate, formData) {
var tmpEval;
var finalEval = false;
var stopFlag = false;
if (toEvaluate && toEvaluate.type === 'criteriaGroup' && toEvaluate.childrenCriterias && toEvaluate.childrenCriterias.length && toEvaluate.conjunction) {
for (var i = 0; i < toEvaluate.childrenCriterias.length && !stopFlag; i++) {
tmpEval = KAMPYLE_TARGETING.evaluateRule(toEvaluate.childrenCriterias[i], formData);
if (tmpEval && toEvaluate.conjunction === 'OR') {
finalEval = true;
stopFlag = true;
} else if (!tmpEval && toEvaluate.conjunction === 'AND') {
finalEval = false;
stopFlag = true;
} else {
finalEval = tmpEval;
}
}
} else if (toEvaluate && toEvaluate.type === 'criteria') {
finalEval = evaluateCriteria(toEvaluate, formData);
}
return finalEval;
}
function targetingDevice(data) {
if (data && data.onSiteData && data.onSiteData.devicetypes) {
var devicetypesLength = data.onSiteData.devicetypes.length;
for (var i = 0; i < devicetypesLength; i++) {
if (data.onSiteData.devicetypes[i] === KAMPYLE_DATA.getMemoryData('kampyleDevice')) {
return true;
}
}
return false;
}
return true;
}
function isInviteShownInSession(oncePerSessionObj) {
var inviteShownFlag = KAMPYLE_DATA.getData('kampyleInvitePresented');
var inviteShownFlag = (inviteShownFlag === true || inviteShownFlag === 'true');
return !!inviteShownFlag;
}
function getUserPercentile(formId) {
var percentile = KAMPYLE_DATA.getData('kampyleUserPercentile');
if (!percentile && percentile !== '0') {
percentile = Math.random() * 100;
KAMPYLE_DATA.setData('kampyleUserPercentile', percentile);
}
if (Number(percentile) && Number(percentile).toFixed) {
return Number(percentile).toFixed(1);
} else {
return Number(percentile);
}
}
function initDynamicTargeting(formData) {
KAMPYLE_DATA.setMemoryData('isInviteActivated', true);
var targetingState = KAMPYLE_DATA.getMemoryData('targetingState');
KAMPYLE_DATA.setMemoryData('targetingState', targetingState);
for (var key in targetingState) {
if (targetingState.hasOwnProperty(key) && !targetingState[key]) {
return false;
}
}
isShowInvite(formData);
}
function initTargeting(eventName, data) {
initTargetingMemoryData();
initTargetingObject();
initEmbeddedTargeting();
handleFormsTargeting(eventName, data);
}
function initTargetingMemoryData() {
KAMPYLE_DATA.setMemoryData('invitationTimeStamp', null);
KAMPYLE_DATA.setMemoryData('formIsShown', false);
KAMPYLE_DATA.setMemoryData('isButtonShown', false);
KAMPYLE_DATA.setMemoryData('isInviteActivated', false);
KAMPYLE_DATA.setMemoryData('targetingState', {});
}
function initEmbeddedTargeting() {
var allForms = KAMPYLE_DATA.getAllForms();
if (!allForms || !allForms.length) {
return;
}
var canShow;
for (var i = allForms.length - 1; i >= 0; i--) {
if (allForms[i].formType === KAMPYLE_CONSTANT.FORM_TYPES.EMBEDDED) {
canShow = KAMPYLE_TARGETING.validateCommonTargetingOnForm(allForms[i]);
if (canShow) {
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENT_NAME.NEB_LOAD_FORM, {
formId: allForms[i].formId
});
}
}
}
}
function initUserIdentifier() {
var userIdentifierVal = null;
if (!!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.SERVER_BASED_TARGETING)) {
userIdentifierVal = KAMPYLE_FUNC.getUserIdentifierVal();
var hasIdentifierValue = userIdentifierVal !== null;
KAMPYLE_DATA.setMemoryData('isGuest', !hasIdentifierValue);
KAMPYLE_EVENT_DISPATCHER.trigger('neb_initUserIdentifier', {
hasIdentifierValue: hasIdentifierValue
});
}
return userIdentifierVal;
}
function handleFormsTargeting(eventName, data) {
var userIdentifierVal = initUserIdentifier();
if (KAMPYLE_FUNC.shouldSyncIdentifier(userIdentifierVal)) {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_settingIdentifierValueOnMemory', {
hasIdentifierValue: userIdentifierVal !== null
});
KAMPYLE_DATA.setMemoryData('identifierValue', userIdentifierVal);
KAMPYLE_FUNC.syncIdentifierData(userIdentifierVal, initFormsTargeting.bind(this, arguments[0], arguments[1]));
} else {
KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_shouldNotSyncIdentifier');
initFormsTargeting(eventName, data);
}
}
function initFormsTargeting(eventName, data) {
data = data || {};
var allForms = KAMPYLE_DATA.getAllForms();
if (!allForms || !allForms.length) {
return;
}
var canShow;
for (var i = allForms.length - 1; i >= 0; i--) {
if (allForms[i].formType === KAMPYLE_CONSTANT.FORM_TYPES.BUTTON && !data.skipButtonTargeting && KAMPYLE_DATA.getMemoryData('isButtonShown') === false) {
canShow = KAMPYLE_TARGETING.validateCommonTargetingOnForm(allForms[i]);
if (canShow === true) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_initButton', {
formId: allForms[i].formId
});
}
} else if (KAMPYLE_TARGETING.shouldCheckInvite(allForms[i], data)) {
canShow = KAMPYLE_TARGETING.validateCommonTargetingOnForm(allForms[i]) && KAMPYLE_TARGETING.validateInviteTargeting(allForms[i].formId);
if (canShow === true) {
KAMPYLE_TARGETING.initDynamicTargeting(allForms[i]);
}
}
if (KAMPYLE_DATA.getMemoryData('isInviteActivated') === true && KAMPYLE_DATA.getMemoryData('isButtonShown') === true) {
break;
}
}
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_PAGE_TARGETING_PHASE_ENDED);
}
function shouldCheckInvite(form, targetingSettings) {
return (form.formType === KAMPYLE_CONSTANT.FORM_TYPES.INVITATION && KAMPYLE_UTILS.kampyleIsCookieEnabled() && !targetingSettings.skipInviteTargeting && KAMPYLE_DATA.getMemoryData('isInviteActivated') === false && !KAMPYLE_TARGETING.isUbtFailed(form))
}
function validateInviteTargeting(formId) {
formId = formId || '';
KAMPYLE_DATA.setMemoryData('currentFormId', formId);
var data = KAMPYLE_DATA.getFormData(formId);
if (data.inviteData.skipInvitation === true || data.inviteData.skipInvitation === 'true') {
if (KAMPYLE_FUNC.isPreloadConfigured()) {
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENT_NAME.NEB_LOAD_FORM, {
formId: formId
});
}
} else {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadInvitation', {
formId: formId
});
}
return true;
}
function setTargetingState(targetingName, isPassed) {
KAMPYLE_DATA.setMemoryData('targetingState.' + targetingName, isPassed);
}
function generateShouldShowInviteParamName(formId) {
if (!formId) {
return null;
}
return 'shouldShowInvite' + '_' + formId;
}
return {
init: init,
isInviteAlreadyShownInSession: isInviteAlreadyShownInSession,
initTargeting: initTargeting,
initFormsTargeting: initFormsTargeting,
validateCommonTargetingOnForm: validateCommonTargetingOnForm,
isShowInvite: isShowInvite,
handleButton: handleButton,
isDataValid: isDataValid,
generateShouldShowInviteParamName: generateShouldShowInviteParamName,
handleNotSkippedInvitaion: handleNotSkippedInvitaion,
initDynamicTargeting: initDynamicTargeting,
validateInviteTargeting: validateInviteTargeting,
isUbtFailed: isUbtFailed,
evaluateRule: evaluateRule,
targetingDevice: targetingDevice,
getUserPercentile: getUserPercentile,
setTargetingState: setTargetingState,
isInviteShownInSession: isInviteShownInSession,
getTextByQuarentine: getTextByQuarentine,
shouldCheckInvite: shouldCheckInvite
};
}
)(window, document);
window.KAMPYLE_ANIMATION = (function() {
var DEFAULTS = {
ANIMATION_DIRECTION: 'centerRight',
};
var CONSTANTS = {
CONTAINER_ID: 'KampyleAnimationContainer',
IFRAME_ID: 'kampyleFormAnimation',
};
function init() {
var eventMapping = {
neb_buttonClicked: [animateWithInit],
neb_sdkShowForm: [animateWithInit],
neb_loadForm: [createFormIframe, initAnimationPosition],
neb_inviteAccepted: [animateWithInit],
neb_skipInvitation: [animateWithInit],
neb_formClosed: [animateOut, refreshFormIframe],
neb_popupBlocked: [animateOut, refreshFormIframe],
neb_captureInit: [animateOut],
neb_captureImageClicked: [animateIn],
neb_cancelCaptureClicked: [animateIn],
neb_formHide: [animateOut],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
var formSpanPlacer = document.createElement('span');
var innerHtml = '<div id="{{CONTAINER_ID}}" style="z-index: 2147483000"></div>';
innerHtml = innerHtml.replace(/{{CONTAINER_ID}}/g, CONSTANTS.CONTAINER_ID);
formSpanPlacer.innerHTML = innerHtml;
document.body.appendChild(formSpanPlacer);
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (animationContainer) {
KAMPYLE_UTILS.setElementStyle(animationContainer, {
border: 0,
position: 'fixed',
display: 'block',
zIndex: '2147483000',
});
}
hideAnimationContainer();
}
function animateWithInit(eventName, data) {
initAnimationPosition(eventName, data);
setTimeout(function() {
animateIn(eventName, data);
}, 10);
}
function animateIn(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (!formData || !animationContainer || !isAnimationForm(formData)) {
return false;
}
var formIframe = document.getElementById(CONSTANTS.IFRAME_ID + data.formId);
if (formIframe) {
formIframe.style.display = 'block';
}
var displayDirection = getDisplayDirection(formData);
switch (displayDirection) {
case 'centerRight':
KAMPYLE_UTILS.setElementStyle(animationContainer, {
right: 0,
});
break;
case 'centerLeft':
KAMPYLE_UTILS.setElementStyle(animationContainer, {
left: 0,
});
break;
case 'bottomRight':
case 'bottomLeft':
KAMPYLE_UTILS.setElementStyle(animationContainer, {
bottom: 0,
});
break;
default:
KAMPYLE_UTILS.showWarning('Invalid animation type - ' + displayDirection);
return false;
}
}
function hideAnimationContainer() {
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (animationContainer) {
KAMPYLE_UTILS.setElementStyle(animationContainer, {
width: 0,
height: 0,
});
}
}
function refreshFormIframe(eventName, data) {
setTimeout(function() {
var formData = KAMPYLE_DATA.getFormData(data.formId);
var currIframe = document.getElementById(CONSTANTS.IFRAME_ID + data.formId);
if (!!currIframe) {
if (KAMPYLE_FUNC.checkProvision("disableFormReloadOnClose")) {
currIframe.remove();
KAMPYLE_DATA.initFormState();
} else {
currIframe.src = currIframe.src;
currIframe.style.display = 'none';
if (currIframe.removeAttribute) {
currIframe.removeAttribute('origin');
}
}
}
hideAnimationContainer();
}, 1000);
}
function animateOut(eventName, data) {
var formData = KAMPYLE_DATA.getFormData(data.formId);
if (KAMPYLE_DATA.getDisplayType(formData) !== 'animation') {
return false;
}
data = data || {};
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (!formData || !animationContainer || !isAnimationForm(formData)) {
return false;
}
setAnimationContainerInitialPosition(formData, animationContainer);
}
function getMiddleHeight(formHeight) {
return String((window.innerHeight - parseInt(formHeight, 10)) / 2) + 'px';
}
function getDisplayDirection(formData) {
formData = formData || {};
return KAMPYLE_UTILS.getNestedPropertyValue(formData, 'formDisplay.displayDirection') || DEFAULTS.ANIMATION_DIRECTION;
}
function setAnimationContainerInitialPosition(formData, animationContainer) {
var cornerMargin;
switch (getDisplayDirection(formData)) {
case 'centerRight':
KAMPYLE_UTILS.setElementStyle(animationContainer, {
top: getMiddleHeight(animationContainer.style.height),
right: '-' + formData.formWidth + 'px',
bottom: null,
left: null,
transition: 'right 1s ease-in-out',
});
break;
case 'centerLeft':
KAMPYLE_UTILS.setElementStyle(animationContainer, {
top: getMiddleHeight(animationContainer.style.height),
right: null,
bottom: null,
left: '-' + formData.formWidth + 'px',
transition: 'left 1s ease-in-out',
});
break;
case 'bottomRight':
cornerMargin = KAMPYLE_VIEW.getCornerMargin(formData) + 'px';
KAMPYLE_UTILS.setElementStyle(animationContainer, {
top: null,
right: cornerMargin,
bottom: '-' + formData.formHeight + 'px',
left: null,
transition: 'bottom 1s ease-in-out',
});
break;
case 'bottomLeft':
cornerMargin = KAMPYLE_VIEW.getCornerMargin(formData) + 'px';
KAMPYLE_UTILS.setElementStyle(animationContainer, {
top: null,
right: null,
bottom: '-' + formData.formHeight + 'px',
left: cornerMargin,
transition: 'bottom 1s ease-in-out',
});
break;
default:
KAMPYLE_UTILS.showWarning('Invalid animation type - ' + formData.formDisplayDirection);
return false;
}
}
function isAnimationForm(formData) {
return KAMPYLE_DATA.getDisplayType(formData) === 'animation';
}
function createFormIframe(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (!animationContainer || !formData || !isAnimationForm(formData)) {
return false;
}
var formIframe = document.getElementById(CONSTANTS.IFRAME_ID + data.formId);
if (!formIframe) {
formIframe = document.createElement('iframe');
KAMPYLE_UTILS.setElementStyle(formIframe, {
border: 0,
height: formData.formHeight + 'px',
width: formData.formWidth + 'px',
display: 'none',
});
formIframe.id = CONSTANTS.IFRAME_ID + data.formId;
animationContainer.appendChild(formIframe);
}
var formHtml = formData.formHtmlUrl;
formHtml = KAMPYLE_COMMON.createFormUrl(formHtml, data.formId);
formIframe.src = formHtml;
}
function initAnimationPosition(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
var animationContainer = document.getElementById(CONSTANTS.CONTAINER_ID);
if (!animationContainer || !formData || !isAnimationForm(formData)) {
return false;
}
if (!document.getElementById(CONSTANTS.IFRAME_ID + data.formId)) {
createFormIframe(eventName, data);
}
KAMPYLE_UTILS.setElementStyle(animationContainer, {
height: formData.formHeight + 'px',
width: formData.formWidth + 'px',
});
setAnimationContainerInitialPosition(formData, animationContainer);
}
return {
initAnimationPosition: initAnimationPosition,
getDisplayDirection: getDisplayDirection,
init: init,
};
}
)();
window.KAMPYLE_VIEW = (function(window, document) {
var DEFAULTS = {
CORNER_MARGIN: 0,
TRIANGULAR_MARGIN: 0,
VERTICAL_MARGIN: 30,
};
function handleInviteReady(eventName, data) {
data = data || {};
var inviteContainer = document.getElementById('kampyleInviteContainer');
if (newMobileInvite()) {
restoreHostingDOM();
if (inviteContainer) {
KAMPYLE_UTILS.setElementStyle(inviteContainer, {
top: '',
bottom: '',
left: '',
right: '',
background: 'none',
visibility: '',
display: 'none',
}, true);
}
} else {
KAMPYLE_UTILS.setElementStyle(inviteContainer, {
visibility: 'visible',
}, true);
var iframe = document.getElementById('kampyleInvite');
if (iframe) {
KAMPYLE_UTILS.setElementStyle(iframe, {
visibility: 'visible',
}, true);
}
}
}
function onKeyboardClose(e) {
KAMPYLE_UTILS.showInvite();
KAMPYLE_UTILS.removeEventHandler(e.srcElement, 'blur', onKeyboardClose);
}
function onKeyboardOpen(e) {
KAMPYLE_UTILS.hideInvite();
KAMPYLE_UTILS.setEventHandler(e.srcElement, 'blur', onKeyboardClose);
}
function getAllFocusableElements() {
var inputs = document.querySelectorAll('input');
var textarea = document.querySelectorAll('textarea');
var allFocusableElements = [];
var i;
for (i = 0; i < inputs.length; i++) {
allFocusableElements.push(inputs[i]);
}
for (i = 0; i < textarea.length; i++) {
allFocusableElements.push(textarea[i]);
}
return allFocusableElements;
}
function setupListenersForHideInviteWhenVirtualKeyboardIsOpen(eventName, data) {
data = data || {};
data.formId = data.formId || KAMPYLE_DATA.getMemoryData('currentFormId');
var pos = KAMPYLE_VIEW.getInvitePosition(data.formId);
if (newMobileInvite() && pos === 'bottom') {
var allFocusableElements = getAllFocusableElements();
for (var i = 0; i < allFocusableElements.length; i++) {
KAMPYLE_UTILS.setEventHandler(allFocusableElements[i], 'focus', onKeyboardOpen);
}
}
}
function removeListenersForHideInviteWhenVirtualKeyboardIsOpen(eventName, data) {
data = data || {};
data.formId = data.formId || KAMPYLE_DATA.getMemoryData('currentFormId');
var pos = KAMPYLE_VIEW.getInvitePosition(data.formId);
if (newMobileInvite() && pos === 'bottom') {
var allFocusableElements = getAllFocusableElements();
for (var i = 0; i < allFocusableElements.length; i++) {
KAMPYLE_UTILS.removeEventHandler(allFocusableElements[i], 'focus', onKeyboardOpen);
}
}
}
function showInviteIfNeeded(eventName, params) {
var shouldShowParamName = KAMPYLE_TARGETING.generateShouldShowInviteParamName(params.formId);
var shouldShowInvite = KAMPYLE_DATA.getMemoryData(shouldShowParamName);
if (shouldShowInvite) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_invitation_loaded', {
formId: params.formId
});
KAMPYLE_EVENT_DISPATCHER.trigger('neb_showInvitation', {
formId: params.formId
});
KAMPYLE_DATA.deleteMemoryData(shouldShowParamName);
}
}
function scrollToEmbeddedForm(formId) {
document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + formId).scrollIntoView();
}
function doScrollY(numOfPixels) {
window.scrollTo(0, numOfPixels);
}
function scrollToTop(eventName, data) {
data = data || {};
if (!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)) {
doScrollY(0);
}
}
function scrollFromTop(eventName, data) {
var pixelsToScroll = (data || {}).numberOfPixels || 0;
if (KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)) {
scrollToEmbeddedForm(data.formId);
var scrollY = (KAMPYLE_UTILS.getScrollPosition() || {}).y || 0;
KAMPYLE_VIEW.doScrollY(pixelsToScroll + scrollY);
} else {
KAMPYLE_VIEW.doScrollY(pixelsToScroll);
}
}
function handleInvitationSkippedForms(eventName, data) {
if (KAMPYLE_DATA.getData('isSkipInvitationOptimized') !== 'true') {
return;
}
KAMPYLE_UTILS.setElementStyle(document.getElementById('kampyleFormContainer'), {
visibility: 'visible',
}, true);
KAMPYLE_VIEW.prepareHostingDOM();
KAMPYLE_DATA.setData('isSkipInvitationOptimized', false);
}
function init() {
var eventMapping = {
neb_targetingInit: [removeAllShownElements],
neb_loadInvitation: [createInviteIframe],
neb_loadForm: [createIframe, showSpinner, applyMobileDynamicStyles],
neb_formReady: [hideButton],
neb_formLoaded: [setIframeOrigin, hideSpinner, showInviteIfNeeded],
neb_formShown: [handleInvitationSkippedForms],
neb_showInvitation: [showInvite],
neb_inviteHeightChanged: [changeInviteHeight],
neb_iFrameHeightChanged: [reactToIframeHeightChange],
neb_scrollToTop: [scrollToTop],
neb_scrollFromTop: [scrollFromTop],
neb_inviteReady: [handleInviteReady, setupListenersForHideInviteWhenVirtualKeyboardIsOpen],
neb_scrollToForm: [scrollToForm],
neb_showButton: [showButton, alignButtonWithForm],
neb_buttonClicked: [showForm],
neb_sdkShowForm: [showForm, hideButton],
neb_captureInit: [hideVisibility, hideButton],
neb_inviteAccepted: [hideInvite, showForm, hideButton, removeListenersForHideInviteWhenVirtualKeyboardIsOpen],
neb_skipInvitation: [showForm, hideButton],
neb_sdkPageView: [hideInvite, removeListenersForHideInviteWhenVirtualKeyboardIsOpen],
neb_inviteDeclined: [hideInvite, removeListenersForHideInviteWhenVirtualKeyboardIsOpen],
neb_formClosed: [hideForm],
neb_popupBlocked: [hideForm],
neb_formHide: [hideVisibility],
neb_captureImageClicked: [showVisibility],
neb_cancelCaptureClicked: [showVisibility],
};
eventMapping.neb_showButton.push(setVerticalOffset);
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
KAMPYLE_UTILS.addStyle('.noOutline{outline: none !important;}');
KAMPYLE_UTILS.addStyle('.wcagOutline:focus{outline: 1px dashed #595959 !important;outline-offset: 2px !important;transition: none !important;}');
KAMPYLE_UTILS.setEventHandler(window, 'resize', function(e) {
updateIframeStyle();
});
}
function toggleSpinner(isShow) {
var display = isShow ? 'block' : 'none';
var spinners = document.getElementsByClassName('neb-loading-spinner');
if (spinners && spinners.length) {
for (var i = spinners.length - 1; i >= 0; i--) {
KAMPYLE_UTILS.setElementStyle(spinners[i], {
display: display
});
}
}
}
function hideSpinner(eventName, data) {
toggleSpinner(false);
}
function showSpinner(eventName, data) {
toggleSpinner(true);
}
function scrollToForm(eventName, data) {
document.getElementById('kampyleFormContainer').scrollIntoView();
}
function getCornerMargin(formData) {
formData = formData || {};
var isInvite = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'formType') === 'invitation';
var margin;
if (!isInvite) {
var buttonType = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData.type');
switch (buttonType) {
case 'vertical':
case 'triangular':
margin = DEFAULTS.TRIANGULAR_MARGIN;
break;
case 'custom':
margin = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData.cornerMargin') || DEFAULTS.CORNER_MARGIN;
break;
default:
margin = DEFAULTS.CORNER_MARGIN;
break;
}
} else {
margin = DEFAULTS.CORNER_MARGIN;
}
return parseInt(margin, 10);
}
function getButtonDirection(formData) {
formData = formData || {};
return KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData.position') || 'right';
}
function alignButtonWithForm(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
var buttonContainer = document.getElementById('nebula_div_btn');
if (!buttonContainer || !formData) {
return false;
}
var cornerMargin = getCornerMargin(formData) + 'px';
switch (getButtonDirection(formData)) {
case 'bottomRight':
buttonContainer.style.right = cornerMargin;
break;
case 'bottomLeft':
buttonContainer.style.left = cornerMargin;
break;
default:
break;
}
}
function setVerticalOffset(eventName, data) {
var formData = KAMPYLE_DATA.getFormData(data.formId);
var buttonData = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData');
var offset = KAMPYLE_UTILS.getNestedPropertyValue(buttonData, 'verticalOffset') || 0;
if (!isNaN(offset)) {
var nebButton = document.getElementById('nebula_div_btn');
if (nebButton && nebButton.style) {
if (buttonData.position.indexOf('bottom') > -1) {
nebButton.style.marginBottom = offset + 'px';
} else {
offset = Number(offset) * -1;
nebButton.style.marginTop = offset + 'px';
}
}
}
}
function showVisibility(eventName, data) {
var currentFormId = KAMPYLE_DATA.getMemoryData('currentFormId');
var formData = KAMPYLE_DATA.getFormData(currentFormId);
if (KAMPYLE_DATA.getDisplayType(formData) === 'animation') {
return false;
}
var formContainer = document.getElementById('kampyleFormContainer');
var formIframe = document.getElementById('kampyleForm' + currentFormId);
if (!!formContainer && !!formIframe) {
KAMPYLE_UTILS.setElementStyle(formContainer, {
display: 'block',
visibility: 'visible',
}, true);
}
}
function getWCAGClass() {
return KAMPYLE_DATA.isFeatureEnabled('WCAG') ? ' wcagOutline ' : ' noOutline ';
}
function hideVisibility() {
var currentFormId = KAMPYLE_DATA.getMemoryData('currentFormId');
if (!currentFormId) {
return;
}
var formContainer = document.getElementById('kampyleFormContainer');
var formIframe = document.getElementById('kampyleForm' + currentFormId);
if (!!formContainer && !!formIframe) {
KAMPYLE_UTILS.setElementStyle(formContainer, {
display: 'none',
visibility: 'hidden',
}, true);
}
}
function hideForm(eventName, data) {
data = data || {};
var currentFormId = KAMPYLE_DATA.getMemoryData('currentFormId');
setMetaViewport('remove');
if (document.getElementById('kampyleFormContainer') !== null) {
var currIframe = document.getElementById('kampyleForm' + currentFormId);
if (!!currIframe) {
if (!KAMPYLE_FUNC.checkProvision("disableFormReloadOnClose")) {
currIframe.src = currIframe.src;
KAMPYLE_EVENT_DISPATCHER.trigger('neb_load_form_form_reload', {
formId: data.formId
});
} else {
KAMPYLE_DATA.initFormState();
var kampyleFormContainer = document.getElementById('kampyleFormContainer');
if (kampyleFormContainer) {
kampyleFormContainer.remove();
}
}
KAMPYLE_UTILS.setElementStyle(currIframe, {
display: 'none',
}, true);
if (currIframe.removeAttribute) {
currIframe.removeAttribute('origin');
}
}
hideVisibility();
restoreHostingDOM();
}
if (!KAMPYLE_FUNC.checkProvision("disableFormReloadOnClose") || KAMPYLE_DATA.isPopupDisplayType(currentFormId)) {
if (data.sourceWindow && data.sourceWindow.close) {
data.sourceWindow.close();
}
}
}
function formatTriangularStyle(data) {
data = data || {};
var triangularStyle = ['button#nebula_div_btn { height: auto !important }', '.kampyle_feedback-button{', 'background-color:transparent !important;font-family:"Open Sans",sans-serif;cursor:pointer;position:fixed;z-index:99999990', '}', '.kampyle_feedback-button .kampyle_triangle{position:absolute;width:0;height:0;z-index:-1}', '.kampyle_feedback-button .kampyle_button-text{ ', 'height:81px;width:81px;text-align:center;z-index:1000;color:{{BUTTON_TEXT_COLOR}};font-size:14px;font-weight:normal !important;', '}', '.kampyle_feedback-button .kampyle_bottom{', 'line-height:108px !important;', '}', '.kampyle_feedback-button .kampyle_top {', 'line-height:53px !important;', '}', '.kampyle_feedback-button.kampyle_top-right{ ', 'top:0;right:0', '}', '.kampyle_feedback-button.kampyle_top-right .kampyle_triangle {', 'top:0;right:0;border-top:81px solid {{BUTTON_BACKGROUND_COLOR}};border-left:81px solid transparent ', '}', '.kampyle_feedback-button.kampyle_top-right .kampyle_button-text { ', '-ms-transform:rotate(45deg); -webkit-transform:rotate(45deg); transform:rotate(45deg)', '}', '.kampyle_feedback-button.kampyle_top-left {', 'top:0;left:0;', '}', '.kampyle_feedback-button.kampyle_top-left .kampyle_triangle {', 'top:0;left:0;border-top:81px solid {{BUTTON_BACKGROUND_COLOR}};border-right:81px solid transparent;', '}', '.kampyle_feedback-button.kampyle_top-left .kampyle_button-text {', '-ms-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);transform:rotate(-45deg)', '}', '.kampyle_feedback-button.kampyle_bottom-right {', 'bottom:0;right:0;', '}', '.kampyle_feedback-button.kampyle_bottom-right .kampyle_triangle {', 'bottom:0;right:0;border-bottom:81px solid {{BUTTON_BACKGROUND_COLOR}};border-left:81px solid transparent', '}', '.kampyle_feedback-button.kampyle_bottom-right .kampyle_button-text {', '-ms-transform:rotate(-45deg);-webkit-transform:rotate(-45deg);transform:rotate(-45deg);', '}', '.kampyle_feedback-button.kampyle_bottom-left {', 'bottom:0;left:0;', '}', '.kampyle_feedback-button.kampyle_bottom-left .kampyle_triangle {', 'bottom:0;left:0;border-bottom:81px solid {{BUTTON_BACKGROUND_COLOR}};border-right:81px solid transparent', '}', '.kampyle_feedback-button.kampyle_bottom-left .kampyle_button-text {', '-ms-transform:rotate(45deg);-webkit-transform:rotate(45deg);transform:rotate(45deg);', '}', '.kampyle_feedback-button.kampyle_bottom-left, .kampyle_feedback-button.kampyle_bottom-right, .kampyle_feedback-button.kampyle_top-left, .kampyle_feedback-button.kampyle_top-right {', 'padding: 0 !important;', '}', ].join(' ');
triangularStyle = triangularStyle.replace(/{{BUTTON_TEXT_COLOR}}/g, data.textColor);
triangularStyle = triangularStyle.replace(/{{BUTTON_BACKGROUND_COLOR}}/g, data.backgroundColor);
return triangularStyle;
}
function formatVerticalStyle(data) {
data = data || {};
var verticalStyle = ['button#nebula_div_btn { height: auto !important }', '.kampyle_vertical_button {', 'background-color:transparent !important;font-family:"Open Sans",sans-serif;cursor:pointer;position:fixed;top:45%;z-index:99999990;height:35px !important;min-height: 35px !important;max-height: 35px !important;width:125px !important;max-width: 125px !important;min-width: 125px !important;-ms-transform:rotate(90deg);-webkit-transform:rotate(90deg);transform:rotate(90deg)', '}', '.kampyle_vertical_button .kampyle_button {', 'height:35px;min-height: 35px !important;max-height: 35px !important;width:125px !important;min-width: 125px !important;max-width: 125px !important; background:{{BUTTON_BACKGROUND_COLOR}};color:{{BUTTON_TEXT_COLOR}};position:absolute;top:0;left:0;z-index:-1;', '}', '.kampyle_vertical_button .kampyle_button-text {', 'color:{{BUTTON_TEXT_COLOR}};font-size:14px;line-height:35px;text-align:center;font-weight:normal !important;', '}', '.kampyle_vertical_button.kampyle_left .kampyle_button {', '-webkit-border-radius:3px 3px 0 0;-moz-border-radius:3px 3px 0 0;-ms-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;', '}', '.kampyle_vertical_button.kampyle_right {', 'right:-45px;', '}', '.kampyle_vertical_button.kampyle_left {', 'left:-45px', '}', '.kampyle_vertical_button.kampyle_right .kampyle_button {', '-webkit-border-radius:0 0 3px 3px;-moz-border-radius:0 0 3px 3px;-ms-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px', '}', '.kampyle_vertical_button.kampyle_right, .kampyle_vertical_button.kampyle_left {', 'padding: 0 !important;', '}', ].join(' ');
verticalStyle = verticalStyle.replace(/{{BUTTON_TEXT_COLOR}}/g, data.textColor);
verticalStyle = verticalStyle.replace(/{{BUTTON_BACKGROUND_COLOR}}/g, data.backgroundColor);
return verticalStyle;
}
function getTriangleButtonStyle(formData) {
var buttonText = KAMPYLE_VIEW.getButtonText(formData);
var classDirection = {
topbottom: 'kampyle_bottom',
leftright: 'kampyle_bottom-left'
};
switch (formData.buttonData.position) {
case 'bottomLeft':
classDirection.leftright = 'kampyle_bottom-left';
classDirection.topbottom = 'kampyle_bottom';
break;
case 'bottomRight':
classDirection.leftright = 'kampyle_bottom-right';
classDirection.topbottom = 'kampyle_bottom';
break;
case 'topLeft':
classDirection.leftright = 'kampyle_top-left';
classDirection.topbottom = 'kampyle_top';
break;
case 'topRight':
classDirection.leftright = 'kampyle_top-right';
classDirection.topbottom = 'kampyle_top';
break;
default:
break;
}
return '<button id="nebula_div_btn" style="border: none; background: none" alt="' + buttonText + '" tabindex="0" class="kampyle_feedback-button ' + classDirection.leftright + ' ' + getWCAGClass() + '"><div class="kampyle_triangle"></div><div class="kampyle_button-text ' + classDirection.topbottom + '">' + buttonText + '</div></button>';
}
function getVerticalButtonStyle(formData) {
var direction = 'kampyle_left';
var buttonText = KAMPYLE_VIEW.getButtonText(formData);
switch (formData.buttonData.position) {
case 'left':
direction = 'kampyle_left';
break;
case 'right':
direction = 'kampyle_right';
break;
}
return '<button id="nebula_div_btn" style="position: fixed !important; border: none" alt="' + buttonText + '" tabindex="0" class="kampyle_vertical_button ' + direction + ' ' + getWCAGClass() + '"><div class="kampyle_button"></div><div class="kampyle_button-text">' + buttonText + '</div></button>';
}
function displayGenericFormBtn(formData) {
var btnBuilders = ({
vertical: {
html: getVerticalButtonStyle,
style: formatVerticalStyle
},
triangular: {
html: getTriangleButtonStyle,
style: formatTriangularStyle
}
})[formData.buttonData.type];
if (!btnBuilders) {
KAMPYLE_UTILS.showWarning('Invalid button type ' + formData.buttonData.type);
return '';
}
KAMPYLE_UTILS.addStyle(btnBuilders.style({
textColor: formData.buttonData.textColor,
backgroundColor: formData.buttonData.backgroundColor,
}));
return btnBuilders.html(formData);
}
function displayImageFormBtn(formData) {
var divStyle = 'z-index: 99999990 !important;position: fixed !important;cursor: pointer !important;line-height:1px !important; padding:0;';
var buttonText = KAMPYLE_VIEW.getButtonText(formData);
var imageBtnStyles = ['.nebula_image_button {', 'width: auto !important;', 'background: transparent !important;', '}', ].join(' ');
KAMPYLE_UTILS.addStyle(imageBtnStyles);
switch (formData.buttonData.position) {
case 'bottomLeft':
divStyle += 'bottom:0;left:0;';
break;
case 'bottomRight':
divStyle += 'bottom:0;right:0;';
break;
case 'topLeft':
divStyle += 'top:0;left:0;';
break;
case 'topRight':
divStyle += 'top:0;right:0;';
break;
case 'left':
divStyle += 'left:0;top:50%;';
break;
case 'right':
divStyle += 'right:0;top:50%;';
break;
default:
break;
}
return '<button id="nebula_div_btn" class="nebula_image_button ' + getWCAGClass() + '" style="' + divStyle + ';border: none" tabindex="0"><img alt="' + buttonText + '" src="' + formData.buttonData.buttonUrl + '" /></button>';
}
function showButton(eventName, data) {
var btnHtml = '';
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId) || {};
var buttonType = KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData.type') || '';
switch (buttonType.toLowerCase()) {
case 'vertical':
case 'triangular':
btnHtml = displayGenericFormBtn(formData);
break;
case 'custom':
btnHtml = displayImageFormBtn(formData);
break;
default:
KAMPYLE_UTILS.showWarning('Invalid button type - ' + buttonType);
return false;
}
var spanContainer = document.getElementById('kampyleButtonContainer');
if (spanContainer === null) {
spanContainer = document.createElement('span');
spanContainer.innerHTML = btnHtml;
spanContainer.id = 'kampyleButtonContainer';
var s = document.body.appendChild(spanContainer);
} else {
spanContainer.innerHTML = btnHtml;
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_button_displayed', {
formId: data.formId,
position: KAMPYLE_UTILS.getNestedPropertyValue(formData, 'buttonData.position') || '',
});
spanContainer.onclick = function(event) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_buttonClicked', {
formId: data.formId
});
event.preventDefault();
event.stopPropagation();
}
;
var isDesktop = KAMPYLE_DATA.getMemoryData('kampyleDevice') === KAMPYLE_CONSTANT.DEVICES.DESKTOP;
if (isDesktop) {
KAMPYLE_UTILS.setEventHandler(spanContainer, 'mouseover', function(event) {
if (!KAMPYLE_DATA.getFormState(data.formId).loaded) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: data.formId
});
}
});
var buttonProximityFunc = function(event) {
var formState = KAMPYLE_DATA.getFormState(data.formId);
if (!formState || formState.loading || formState.loaded) {
return false;
}
var isNear = KAMPYLE_UTILS.isNear('nebula_div_btn', 100, event);
if (isNear) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_load_form_preload_proximity', {
formId: data.formId
});
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: data.formId
});
}
};
KAMPYLE_UTILS.setEventHandler(window, 'mousemove', buttonProximityFunc);
} else {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: data.formId
});
}
spanContainer.onkeyup = function(event) {
switch (event.keyCode) {
case 9:
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: data.formId
});
break;
default:
break;
}
}
;
spanContainer.onkeypress = function(event) {
switch (event.keyCode) {
case 13:
KAMPYLE_EVENT_DISPATCHER.trigger('neb_buttonClicked', {
formId: data.formId
});
break;
default:
break;
}
}
;
}
function setIframeOrigin(eventName, data) {
var formIframe = document.getElementById('kampyleForm' + data.formId);
if (formIframe && formIframe.setAttribute) {
formIframe.setAttribute('origin', data.origin);
}
}
function updateIframeStyle(formData) {
var currentFormId = KAMPYLE_DATA.getMemoryData('currentFormId') || KAMPYLE_DATA.getShownFormId();
if (document.getElementById('kampyleFormContainer') === null || !currentFormId) {
return;
}
formData = formData || KAMPYLE_DATA.getFormData(currentFormId) || {};
if (KAMPYLE_DATA.isMobileDynamicSizing(formData.formId)) {
return updateDynamicIframeStyle(formData);
} else {
updateStaticIframeStyle(formData);
}
}
function updateStaticIframeStyle(formData) {
var currentFormId = (formData || {}).formId || KAMPYLE_DATA.getMemoryData('currentFormId') || KAMPYLE_DATA.getShownFormId();
var formWidth;
var formHeight;
if (formData) {
formWidth = parseInt(formData.formWidth, 10) || 450;
formHeight = parseInt(formData.formHeight, 10) || 450;
}
var hostHeight = document.documentElement.clientHeight;
var innerContainerStyle = {
overflowY: 'auto',
height: '100%',
};
KAMPYLE_UTILS.setElementStyle(document.getElementById('innerContainer'), innerContainerStyle);
var iframeStyleObject = {
border: 0,
position: 'relative',
margin: '50px auto 50px',
height: formHeight + 'px',
width: formWidth + 'px',
};
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
if (kampyleDevice === KAMPYLE_CONSTANT.DEVICES.MOBILE || kampyleDevice === KAMPYLE_CONSTANT.DEVICES.TABLET) {
formHeight = '100%';
formWidth = '100%';
iframeStyleObject = {
position: 'relative',
margin: '0',
height: formHeight,
width: formWidth,
};
} else if (KAMPYLE_DATA.isCustomHtmlAndFixedSizeForm(currentFormId)) {
iframeStyleObject = {
position: 'absolute',
top: '50%',
'margin-top': -formHeight / 2 + 'px',
left: '50%',
'margin-left': -formWidth / 2 + 'px',
height: formHeight + 'px',
width: formWidth + 'px',
};
if (hostHeight < formHeight) {
iframeStyleObject.position = 'relative';
iframeStyleObject.top = '0';
iframeStyleObject['margin-top'] = '50px';
iframeStyleObject['margin-bottom'] = '50px';
}
} else {
iframeStyleObject = {
position: 'fixed',
height: '100%',
width: '100%',
};
}
var modal = document.getElementById('kampyleFormModal');
if (modal && modal.style && modal.removeAttribute) {
modal.removeAttribute('style');
KAMPYLE_UTILS.setElementStyle(modal, iframeStyleObject, true);
}
}
function updateDynamicIframeStyle(formData) {
var spanContainer = document.getElementById('formLightboxContainer');
if (spanContainer) {
spanContainer.setAttribute('aria-hidden', false);
}
var modal = document.getElementById('kampyleFormModal');
if (modal) {
KAMPYLE_UTILS.setElementStyle(modal, {
top: 0,
margin: 0,
width: '100%',
}, true);
}
}
function openPopup(formUrl, formId, formWidth, formHeight, eventName) {
formUrl = KAMPYLE_COMMON.createFormUrl(formUrl, formId);
var popupPageName = 'NebulaCX' + formId;
var popupSettings = 'width=' + formWidth + ', height=' + formHeight + ',scrollbars=yes';
var popupHandler = window.open(formUrl, popupPageName, popupSettings);
KAMPYLE_DATA.setMemoryData('popupHandler', popupHandler);
setTimeout(function() {
if (!popupHandler || popupHandler.outerHeight === 0) {
if (eventName !== 'neb_skipInvitation') {
alert('Can\'t open pop-up, please disable pop-up blocker and try again.');
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_popupBlocked', {
formId: formId,
});
}
}, 25);
}
function showForm(eventName, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId);
if (KAMPYLE_VIEW.ignoreShowForm(formData)) {
return false;
}
var formUrl = formData.formHtmlUrl;
var formWidth = formData.formWidth;
var formHeight = formData.formHeight;
var displayType = KAMPYLE_DATA.getDisplayType(formData);
displayType = displayType.toLowerCase();
setMetaViewport('add');
KAMPYLE_DATA.setMemoryData('currentFormId', data.formId);
KAMPYLE_DATA.setMemoryData('formIsShown', true);
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
var shouldOptimizeSkipInvitation = eventName === 'neb_skipInvitation' && KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.SKIP_INVITATION_OPTIMIZATION);
if (displayType === 'lightbox') {
if (!shouldOptimizeSkipInvitation) {
KAMPYLE_VIEW.prepareHostingDOM();
} else {
KAMPYLE_DATA.setData('isSkipInvitationOptimized', true);
}
var kampyleFormContainer = document.getElementById('kampyleFormContainer');
if (kampyleFormContainer) {
updateIframeStyle(formData);
var currIframe = document.getElementById('kampyleForm' + data.formId);
if (!!currIframe) {
KAMPYLE_UTILS.setElementStyle(currIframe, {
display: 'block',
}, true);
}
KAMPYLE_UTILS.setElementStyle(kampyleFormContainer, {
display: 'block',
visibility: shouldOptimizeSkipInvitation ? 'hidden' : 'visible',
}, true);
} else {
KAMPYLE_UTILS.showWarning("formContainer wasn't loaded properly");
}
} else if (displayType === 'popup') {
openPopup(formUrl, data.formId, formWidth, formHeight, eventName);
}
return true;
}
function ignoreShowForm(formData) {
return (!formData || KAMPYLE_DATA.getDisplayType(formData) === 'animation')
}
function hideInvite() {
setMetaViewport('remove');
var inviteContainer = document.getElementById('kampyleInviteContainer');
var kampyleInvite = document.getElementById('kampyleInvite');
if (inviteContainer && kampyleInvite) {
KAMPYLE_UTILS.setElementStyle(inviteContainer, {
display: 'none',
}, true);
restoreHostingDOM();
}
}
function changeInviteHeight(eventName, data) {
data = data || {};
var positions = ['top', 'bottom'];
var isInviteShown = (KAMPYLE_DATA.getFormState(data.formId) || {}).inviteShown;
if (!newMobileInvite() || !isInviteShown) {
return false;
}
var pos = KAMPYLE_VIEW.getInvitePosition(data.formId);
var inviteContainer = document.getElementById('kampyleInviteContainer');
var inviteIframe = document.getElementById('kampyleInvite');
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
KAMPYLE_UTILS.hideInvite();
KAMPYLE_UTILS.setEventHandler(document.activeElement, 'blur', (function(elm) {
return function onBlurCallback() {
KAMPYLE_UTILS.removeEventHandler(elm, 'blur', onBlurCallback);
KAMPYLE_UTILS.showInvite();
}
;
}
)(document.activeElement));
} else {
KAMPYLE_UTILS.showInvite();
}
var style = {
display: 'block',
height: data.newHeight + 'px',
left: '0',
right: '0',
};
style[pos] = 0;
style[positions[(positions.indexOf(pos) + 1) % 2]] = '';
KAMPYLE_UTILS.setElementStyle(inviteContainer, style, true);
}
function setMetaViewport(optional) {
optional = optional || '';
if (KAMPYLE_DATA.getMemoryData('kampyleDevice') === 'desktop') {
return;
}
var kampyleMeta = document.getElementById('kampyleMetaViewport');
var hostedViewportContent = document.getElementsByName('viewport');
var savedViewportContent = KAMPYLE_DATA.getMemoryData('hostedViewportContent') || [];
if (hostedViewportContent && hostedViewportContent.length && !savedViewportContent.length) {
for (var i = hostedViewportContent.length - 1; i >= 0; i--) {
if (hostedViewportContent[i].hasAttribute('content')) {
savedViewportContent.push(hostedViewportContent[i]);
}
}
}
switch (optional.toLowerCase()) {
case 'add':
if (savedViewportContent && savedViewportContent.length) {
for (var i = savedViewportContent.length - 1; i >= 0; i--) {
if (savedViewportContent[i].hasAttribute('id') && savedViewportContent[i].id === 'kampyleMetaViewport') {
continue;
} else {
if (savedViewportContent[i].remove) {
savedViewportContent[i].remove();
}
}
}
}
if (!kampyleMeta) {
var meta = document.createElement('meta');
meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';
meta.name = 'viewport';
meta.id = 'kampyleMetaViewport';
document.getElementsByTagName('head')[0].appendChild(meta);
} else {
kampyleMeta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';
kampyleMeta.name = 'viewport';
}
break;
case 'remove':
if (kampyleMeta) {
kampyleMeta.content = '';
kampyleMeta.name = '';
if (kampyleMeta.remove) {
kampyleMeta.remove();
}
}
if (savedViewportContent && savedViewportContent.length) {
for (var i = savedViewportContent.length - 1; i >= 0; i--) {
if (savedViewportContent[i].hasAttribute('id') && savedViewportContent[i].id === 'kampyleMetaViewport') {
continue;
} else {
document.getElementsByTagName('head')[0].appendChild(savedViewportContent[i]);
}
}
}
break;
}
KAMPYLE_DATA.setMemoryData('hostedViewportContent', savedViewportContent);
}
function newMobileInvite() {
return (Number(KAMPYLE_DATA.getMemoryData('inviteVersion')) > 0) && KAMPYLE_DATA.isNewMobileInvitation();
}
function getInvitePosition(formId) {
var formData = (KAMPYLE_DATA.getFormData(formId) || {});
return (formData.inviteData || {}).invitationPosition || 'top';
}
function showInvite(eventName, data) {
setMetaViewport('add');
var inviteTop = '25%';
var inviteData = KAMPYLE_DATA.getInviteData(data.formId);
if (!inviteData) {
return false;
}
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
if (kampyleDevice === KAMPYLE_CONSTANT.DEVICES.MOBILE || kampyleDevice === KAMPYLE_CONSTANT.DEVICES.TABLET) {
inviteData.inviteHeight = '100%';
inviteData.inviteWidth = '100%';
inviteTop = 0;
}
var invitationTimeStamp = new Date().getTime();
KAMPYLE_DATA.setMemoryData('invitationTimeStamp', invitationTimeStamp);
KAMPYLE_DATA.setData('LAST_INVITATION_VIEW', invitationTimeStamp);
var inviteContainer = document.getElementById('kampyleInviteContainer');
if (inviteContainer && KAMPYLE_DATA.getMemoryData('formIsShown') === false) {
KAMPYLE_UTILS.setElementStyle(inviteContainer, {
display: 'block',
visibility: KAMPYLE_DATA.isNewMobileInvitation() ? 'hidden' : 'visible',
}, true);
prepareHostingDOM();
KAMPYLE_EVENT_DISPATCHER.trigger('neb_invitation_ready', {
formId: data.formId
});
var inviteModal = document.getElementById('kampyleInviteModal');
if (inviteModal) {
KAMPYLE_UTILS.setElementStyle(inviteModal, {
top: inviteTop,
width: inviteData.inviteWidth + 'px',
'max-width': inviteData.inviteWidth + 'px',
height: inviteData.inviteHeight + 'px',
'max-height': inviteData.inviteHeight + 'px',
display: 'block',
}, true);
}
var inviteIframe = document.getElementById('kampyleInvite');
if (inviteIframe) {
KAMPYLE_UTILS.setElementStyle(inviteIframe, {
width: inviteData.inviteWidth + 'px',
'max-width': inviteData.inviteWidth + 'px',
height: inviteData.inviteHeight + 'px',
'max-height': inviteData.inviteHeight + 'px',
display: 'block',
visibility: KAMPYLE_DATA.isNewMobileInvitation() ? 'hidden' : 'visible',
}, true);
}
}
}
function prepareHostingDOM() {
if (KAMPYLE_DATA.isMobileDynamicSizing()) {
KAMPYLE_VIEW.manipulateAriaHiddens();
KAMPYLE_DATA.setMemoryData('hostedBodyOverflowXAttr', document.body.style.overflowX);
document.body.style.overflowX = 'hidden';
} else {
KAMPYLE_DATA.setMemoryData('hostedBodyPositionAttr', document.body.style.position);
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ENABLE_OVERFLOW)) {
return false;
} else {
KAMPYLE_DATA.setMemoryData('hostedBodyOverflowAttr', document.body.style.overflow);
document.body.style.overflow = 'hidden';
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
if (kampyleDevice === KAMPYLE_CONSTANT.DEVICES.MOBILE || kampyleDevice === KAMPYLE_CONSTANT.DEVICES.TABLET) {
document.body.style.position = 'fixed';
}
}
}
}
function restoreHostingDOM() {
if (KAMPYLE_DATA.isMobileDynamicSizing()) {
var modal = document.getElementById('kampyleFormModal');
KAMPYLE_UTILS.setElementStyle(modal, {
height: '100%'
}, true);
KAMPYLE_VIEW.restoreAriaHidden();
document.body.style.overflowX = KAMPYLE_DATA.getMemoryData('hostedBodyOverflowXAttr') || '';
} else {
if (!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ENABLE_OVERFLOW)) {
document.body.style.overflow = KAMPYLE_DATA.getMemoryData('hostedBodyOverflowAttr') || '';
}
document.body.style.position = KAMPYLE_DATA.getMemoryData('hostedBodyPositionAttr') || '';
}
}
function createIframe(eventName, data) {
data = data || {};
var formState = KAMPYLE_DATA.getFormState(data.formId);
if (formState && formState.loaded) {
return;
}
var formData = KAMPYLE_DATA.getFormData(data.formId);
var displayType = KAMPYLE_DATA.getDisplayType(formData);
if (!formData || !data.formId || displayType !== 'lightbox') {
return;
}
if (!document.getElementById('kampyleFormContainer')) {
var onPremRoot = MDIGITAL_OnPrem.getPackageRoot();
var kloaderSrc = (onPremRoot ? onPremRoot + '/' : KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX) + 'resources/onsite/images/kloader.gif';
var formSpanPlacer = document.createElement('span');
formSpanPlacer.id = 'formLightboxContainer';
var html = '';
html += '<div id="kampyleFormContainer" style="top:0 !important;left:0 !important;width: 100% !important;height: 100% !important;position: fixed !important;visibility:hidden !important;display:table !important;background-color: rgba(102,102,102,0.4) !important;z-index:99999999 !important;-webkit-overflow-scrolling: touch !important; ">';
html += ' <div id="innerContainer">';
html += ' <img class="neb-loading-spinner" alt="Loading" style="position:absolute !important;top:50% !important;left:50% !important; margin-top: -30px !important;margin-left: -30px !important; max-width:60px !important;" src="' + kloaderSrc + '"/>';
html += ' <div id="kampyleFormModal" style="z-index:99999999 !important; -webkit-overflow-scrolling: touch !important;"></div>';
html += ' </div>';
html += '</div>';
formSpanPlacer.innerHTML = html;
var s = document.body.appendChild(formSpanPlacer);
}
var formHtml = data.formHtmlUrl || formData.formHtmlUrl;
formHtml = KAMPYLE_COMMON.createFormUrl(formHtml, data.formId);
if (displayType === 'popup') {} else {
var formIframe = document.getElementById('kampyleForm' + data.formId);
if (!formIframe) {
var iframeStyleObject = {
border: 0,
height: '100%',
'max-height': '100%',
'min-height': '100%',
width: '100%',
'max-width': '100%',
'min-width': '100%',
display: 'none',
};
formIframe = document.createElement('iframe');
formIframe.id = 'kampyleForm' + data.formId;
formIframe.setAttribute('title', 'Feedback Survey');
if (!KAMPYLE_DATA.isCustomHtmlForm(data.formId) && !KAMPYLE_DATA.isMobileDynamicSizing(formData.formId)) {
iframeStyleObject.position = 'fixed';
}
KAMPYLE_UTILS.setElementStyle(formIframe, iframeStyleObject, true);
}
formIframe.src = formHtml;
document.getElementById('kampyleFormModal').appendChild(formIframe);
}
}
function applyMobileDynamicStyles(eventName, data) {
var formId = data.formId;
var kFormContainer = document.getElementById('kampyleFormContainer');
if (!(formId && kFormContainer && KAMPYLE_DATA.isMobileDynamicSizing(formId))) {
return false;
}
KAMPYLE_UTILS.setElementStyle(kFormContainer, {
height: KAMPYLE_UTILS.getDocumentSize().height + 'px',
position: 'absolute',
}, true);
}
function getDefaultIframeHeight() {
return KAMPYLE_UTILS.isIos() ? '30px' : '100%';
}
function iFrameHeightChangedHandler(eventData) {
if (KAMPYLE_DATA.isLightBoxDisplayType(eventData.formId)) {
var modal = document.getElementById('kampyleFormModal');
var newHeight = Number((eventData || {}).newHeight);
newHeight = isNaN(newHeight) ? getDefaultIframeHeight() : (newHeight) + 'px';
KAMPYLE_UTILS.setElementStyle(modal, {
height: newHeight
}, true);
}
}
function reactToIframeHeightChange(eventName, eventData) {
if (KAMPYLE_DATA.isMobileDynamicSizing((eventData || {}).formId)) {
iFrameHeightChangedHandler(eventData);
var formHeight = KAMPYLE_UTILS.getNestedPropertyValue(eventData, 'newHeight');
if (KAMPYLE_VIEW.shouldAddScroll(formHeight)) {
var kFormContainer = document.getElementById('kampyleFormContainer');
KAMPYLE_UTILS.setElementStyle(kFormContainer, {
overflowY: 'auto'
}, true);
}
}
}
function manipulateAriaHiddens() {
var bodyChilds = document.body.children;
var ariaHiddenValues = [];
for (var i = 0; i < bodyChilds.length; i++) {
ariaHiddenValues.push({
element: bodyChilds[i],
prevAriaHiddenValue: bodyChilds[i].getAttribute('aria-hidden'),
});
bodyChilds[i].setAttribute('aria-hidden', true);
}
KAMPYLE_DATA.setMemoryData('initialAriaHiddenValues', ariaHiddenValues);
}
function restoreAriaHidden() {
var storeValues = KAMPYLE_DATA.getMemoryData('initialAriaHiddenValues') || [];
for (var i = 0; i < storeValues.length; i++) {
if (!(storeValues[i].element && storeValues[i].element instanceof Element)) {
continue;
}
if (storeValues[i].prevAriaHiddenValue === null) {
storeValues[i].element.removeAttribute('aria-hidden');
} else {
storeValues[i].element.setAttribute('aria-hidden', storeValues[i].prevAriaHiddenValue);
}
}
KAMPYLE_DATA.deleteMemoryData('initialAriaHiddenValues');
}
function createInviteIframe(eventName, eventData) {
var data = KAMPYLE_DATA.getFormData(eventData.formId);
var inviteSpanPlacer = document.createElement('span');
var onPremRoot = MDIGITAL_OnPrem.getPackageRoot();
var kloaderSrc = (onPremRoot ? onPremRoot + '/' : KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX) + 'resources/onsite/images/kloader.gif';
var inviteContainerStyles = 'top:0 !important;left:0 !important;width: 100% !important;';
inviteContainerStyles += 'height: 100% !important;position: fixed !important;visibility:hidden !important;';
inviteContainerStyles += 'display:none !important;background-color: rgba(22,22,22,0.5) !important;';
inviteContainerStyles += 'z-index:99999999 !important;overflow:auto !important';
var spinnerStyles = 'position:absolute !important;top:50% !important;left:50% !important;';
spinnerStyles += 'margin-top: -30px !important;margin-left: -30px !important; max-width:60px !important;';
inviteSpanPlacer.innerHTML = '<div id="kampyleInviteContainer" style="' + inviteContainerStyles + '"><img class="neb-loading-spinner" alt="Loading" style="' + spinnerStyles + '" src="' + kloaderSrc + '"/><div id="kampyleInviteModal" style="overflow: hidden;margin: 0 auto;height:' + data.inviteData.inviteHeight + ';width:' + data.inviteData.inviteWidth + ';position:relative;z-index:99999999;top: 25%;-webkit-box-shadow:0 0 10px rgba(0,0,0,0.4);-moz-box-shadow:0 0 10px rgba(0,0,0,0.4); box-shadow:0 0 10px rgba(0,0,0,0.4);"></div></div>';
var s = document.body.appendChild(inviteSpanPlacer);
var inviteIframe = document.createElement('iframe');
inviteIframe.id = 'kampyleInvite';
inviteIframe.title = 'Invitation to provide feedback';
var inviteHeight = data.inviteData.inviteHeight;
var inviteWidth = data.inviteData.inviteWidth;
var kampyleDevice = KAMPYLE_DATA.getMemoryData('kampyleDevice');
if (kampyleDevice === KAMPYLE_CONSTANT.DEVICES.MOBILE || kampyleDevice === KAMPYLE_CONSTANT.DEVICES.TABLET) {
inviteHeight = '100%';
inviteWidth = '100%';
var inviteModal = document.getElementById('kampyleInviteModal');
if (!!inviteModal) {
KAMPYLE_UTILS.setElementStyle(inviteModal, {
height: '100%',
width: '100%',
}, true);
}
}
KAMPYLE_UTILS.setElementStyle(inviteIframe, {
height: inviteHeight,
width: inviteWidth,
display: 'none',
border: '0',
}, true);
if (KAMPYLE_DATA.isFeatureEnabled('WCAG')) {
data.inviteData.inviteUrl += '?isWCAG=true';
}
inviteIframe.src = data.inviteData.inviteUrl;
document.getElementById('kampyleInviteModal').appendChild(inviteIframe);
if (KAMPYLE_DATA.isNewMobileInvitation()) {
var spinner = document.getElementsByClassName('neb-loading-spinner')[0];
KAMPYLE_UTILS.setElementStyle(spinner, {
display: 'none',
}, true);
KAMPYLE_UTILS.setElementStyle(inviteSpanPlacer, {
'z-index': 99999998,
}, true);
var inviteContainer = document.getElementById('kampyleInviteContainer');
if (inviteContainer) {
KAMPYLE_UTILS.setElementStyle(inviteContainer, {
'z-index': 99999998,
}, true);
}
}
}
function hideButton(eventName, data) {
var buttonElementById = document.getElementById('kampyleButtonContainer');
if (!data || KAMPYLE_DATA.isEmbeddedDisplayType(data.formId) || !buttonElementById) {
return false;
}
buttonElementById.innerHTML = '';
return true;
}
function removeAllShownElements(eventName, data) {
var kampyleFormContainer = document.getElementById('kampyleFormContainer');
var kampyleInviteContainer = document.getElementById('kampyleInviteContainer');
KAMPYLE_VIEW.hideButton(eventName, data);
if (kampyleFormContainer) {
KAMPYLE_UTILS.removeAllContent(kampyleFormContainer);
}
if (kampyleInviteContainer) {
KAMPYLE_UTILS.removeAllContent(kampyleInviteContainer);
}
}
function getButtonText(formData) {
if (typeof MDIGITAL.LOCALIZATION !== 'undefined' && KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.LOCALIZED_FORMS)) {
return MDIGITAL.LOCALIZATION.getLocalizedButtonText(formData);
} else {
return formData.buttonData.text;
}
}
function shouldAddScroll(formHeight) {
var bodyPosition = KAMPYLE_UTILS.getElementStyle(document.body, 'position');
return (bodyPosition === 'fixed' || bodyPosition === 'absolute') && (KAMPYLE_UTILS.getDocumentSize().height <= formHeight);
}
return {
ignoreShowForm: ignoreShowForm,
scrollToEmbeddedForm: scrollToEmbeddedForm,
scrollFromTop: scrollFromTop,
doScrollY: doScrollY,
removeAllShownElements: removeAllShownElements,
createIframe: createIframe,
showInvite: showInvite,
showForm: showForm,
hideForm: hideForm,
showButton: showButton,
hideInvite: hideInvite,
hideButton: hideButton,
handleInvitationSkippedForms: handleInvitationSkippedForms,
updateIframeStyle: updateIframeStyle,
formatTriangularStyle: formatTriangularStyle,
formatVerticalStyle: formatVerticalStyle,
prepareHostingDOM: prepareHostingDOM,
restoreHostingDOM: restoreHostingDOM,
getInvitePosition: getInvitePosition,
newMobileInvite: newMobileInvite,
changeInviteHeight: changeInviteHeight,
iFrameHeightChangedHandler: iFrameHeightChangedHandler,
manipulateAriaHiddens: manipulateAriaHiddens,
restoreAriaHidden: restoreAriaHidden,
getDefaultIframeHeight: getDefaultIframeHeight,
getButtonText: getButtonText,
shouldAddScroll: shouldAddScroll,
init: init,
setMetaViewport: setMetaViewport,
showVisibility: showVisibility,
getCornerMargin: getCornerMargin,
};
}
)(window, document);
window.KAMPYLE_MESSAGE = (function() {
function init() {
KAMPYLE_UTILS.setEventHandler(window, 'message', handleMessage);
}
function validateMessageEvent(e) {
if (!e || !e.origin || !e.data) {
return false;
}
var baseUrl = KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX;
if (baseUrl.charAt(baseUrl.length - 1) === '/') {
baseUrl = baseUrl.slice(0, baseUrl.length - 1);
}
return KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID) || e.origin === baseUrl;
}
function handleMessage(e) {
if (!validateMessageEvent(e)) {
return false;
}
var currDate = new Date();
var data;
try {
data = JSON.parse(e.data);
} catch (e) {
return false;
}
switch (data.action) {
case 'inviteAccepted':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteAccepted', {
'formId': data.formId
});
break;
case 'inviteDeclined':
case 'inviteDefered':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteDeclined', {
'formId': data.formId
});
break;
case 'inviteHeightChanged':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteHeightChanged', {
formId: data.formId,
newHeight: data.newHeight,
});
break;
case 'formLoaded':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formLoaded', {
'formId': data.formId,
origin: e.origin,
isScreenCaptureEnabled: data.isScreenCaptureEnabled,
});
break;
case 'formSubmitPending':
case 'formHide':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formHide', {
'formId': data.formId
});
break;
case 'formSubmitted':
var payload = {
formId: data.formId,
feedbackUUID: data.uuid,
};
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.EVENT_INCLUDE_FEEDBACK_CONTENT) && data.content) {
payload.content = data.content;
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_feedbackSubmitted', payload);
break;
case 'formClose':
var payload = {
formId: data.formId,
feedbackUUID: data.uuid,
sourceWindow: e.source,
isFormSubmitted: data.isFormSubmitted,
};
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formClosed', payload);
break;
case 'formPageShown':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formPageShown', {
'formId': data.formId,
'feedbackUUID': data.uuid,
'pageNumber': data.pageNumber,
});
break;
case 'triggerScreenCapture':
break;
case 'scrollToForm':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_scrollToForm', {
formId: data.formId
});
break;
case 'iFrameHeightChanged':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_iFrameHeightChanged', {
formId: data.formId,
newHeight: data.newHeight,
});
break;
case 'scrollToTop':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_scrollToTop', {
formId: data.formId,
});
break;
case 'scrollFromTop':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_scrollFromTop', {
formId: data.formId,
numberOfPixels: data.numberOfPixels
});
break;
case 'inviteLoaded':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteLoaded', {
formId: data.formId,
inviteVersion: data.inviteVersion,
});
break;
case 'loadMultipleForms':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadMultipileForms', {
formId: data.formId,
formIds: data.formIds,
});
break;
case 'routeToForm':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_routeToForm', {
formId: data.destinationForm,
sourceFormId: data.formId,
}, null, {
isStrictMode: true
});
break;
case 'submitFeedbackFailed':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_submitFeedbackFailed', data);
break;
case 'feedbackUUIDisNull':
KAMPYLE_EVENT_DISPATCHER.trigger('neb_feedbackUUIDisNull', data);
break;
case 'MDigital_Form_Next_Page':
case 'MDigital_Form_Back_Page':
case 'MDigital_ThankYou_Displayed':
case 'MDigital_ThankYou_Close':
case 'MDigital_Form_Close_No_Submit':
case 'MDigital_Form_Close_Submitted':
KAMPYLE_EVENT_DISPATCHER.trigger(data.action, data);
break;
default:
if (!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)) {
KAMPYLE_UTILS.showWarning('invalid action - ' + data.action);
}
return false;
}
}
return {
init: init,
handleMessage: handleMessage,
validateMessageEvent: validateMessageEvent
};
}
)();
window.KAMPYLE_UTILS = {
TOP_LEVEL_DOMAIN_COOKIE_PREFIX: 'Tld-',
startsWith: function(originalString, searchString, position) {
return originalString.substr(position || 0, searchString.length) === searchString;
},
isIos: function() {
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
},
isSafari: function() {
return navigator.userAgent.indexOf("Safari") > -1 && navigator.userAgent.indexOf("Chrome") < 0;
},
triggerCustomEvent: function(eventName, data) {
data = data ? {
detail: data
} : {};
var event = new CustomEvent(eventName,data);
try {
window.dispatchEvent(event);
} catch (e) {
KAMPYLE_UTILS.showWarning('Could not trigger custom event ' + eventName);
}
},
isDebugMode: function() {
var region = KAMPYLE_DATA.getMemoryData('region');
return (region === 'dev' || region === 'qa');
},
showErrorStack: function(e) {
if (KAMPYLE_UTILS.isDebugMode()) {
console.warn(e.stack);
}
},
showWarning: function(message) {
if (KAMPYLE_UTILS.isDebugMode()) {
console.warn(message);
}
},
addStyle: function(cssStyle, referencedDocument) {
referencedDocument = referencedDocument || window.document;
var style = referencedDocument.getElementById('kampyleStyle');
if (style === null) {
style = referencedDocument.createElement('style');
style.type = 'text/css';
style.id = 'kampyleStyle';
var head = referencedDocument.head || referencedDocument.getElementsByTagName('head')[0];
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText += cssStyle;
} else {
style.appendChild(document.createTextNode(cssStyle));
}
},
getViewportSize: function() {
return {
width: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),
height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0),
};
},
getDocumentSize: function() {
var body = document.body;
var html = document.documentElement;
var height = Math.max(body.scrollHeight || 0, body.offsetHeight || 0, html.clientHeight || 0, html.scrollHeight || 0, html.offsetHeight || 0);
var width = Math.max(body.scrollWidth || 0, html.scrollWidth || 0, body.offsetWidth || 0, html.offsetWidth || 0, html.clientWidth || 0);
return {
width: width + (body.getBoundingClientRect ? body.getBoundingClientRect().left || 0 : 0),
height: height + (body.getBoundingClientRect ? body.getBoundingClientRect().top || 0 : 0),
};
},
getElementSize: function(element) {
var height = Math.max(element.scrollHeight || 0, element.offsetHeight || 0, element.clientHeight || 0);
var width = Math.max(element.scrollWidth || 0, element.offsetWidth || 0, element.clientWidth || 0);
return {
width: width,
height: height,
};
},
getTimeDiff: function(time, format) {
var datetime = typeof time !== 'undefined' ? time : '2014-01-01 01:02:03.123456';
datetime = new Date(datetime).getTime();
var now = Date.now();
if (isNaN(datetime)) {
return '';
}
var miliSecDiff = 0;
if (datetime < now) {
miliSecDiff = now - datetime;
} else {
miliSecDiff = datetime - now;
}
switch (format) {
case KAMPYLE_CONSTANT.TIME_FORMATS.SECONDS:
return miliSecDiff.toFixed(1) / 1000;
case KAMPYLE_CONSTANT.TIME_FORMATS.DAYS:
return Math.floor(miliSecDiff / 1000 / 60 / 60 / 24);
default:
return miliSecDiff;
}
},
setEventHandler: function(elem, eventType, handler) {
if (elem.addEventListener) {
elem.addEventListener(eventType, handler, false);
} else if (elem.attachEvent) {
elem.attachEvent('on' + eventType, handler);
}
},
subscribeToCustomEvent: function(eventType, handler) {
if (window && window.addEventListener && typeof handler === "function") {
window.addEventListener(eventType, function(event) {
var payload = event && event.detail;
handler.apply(null, [eventType, payload]);
}, false);
}
},
removeEventHandler: function(elem, eventType, handler) {
if (elem.removeEventListener) {
elem.removeEventListener(eventType, handler);
} else if (elem.detachEvent) {
elem.detachEvent('on' + eventType, handler);
}
},
setElementStyle: function(element, styleObj, isImportant) {
var k;
var dashed;
isImportant = !!isImportant ? 'important' : '';
if (element) {
for (k in styleObj) {
if (styleObj.hasOwnProperty(k)) {
if (isImportant && element && element.style.setProperty) {
dashed = KAMPYLE_UTILS.camelToDash(k);
try {
element.style.setProperty(dashed, '' + styleObj[k], isImportant);
} catch (e) {
element.style.setProperty(dashed, '' + styleObj[k], '!' + isImportant);
}
} else {
element.style[k] = styleObj[k];
}
}
}
}
},
isNear: function(elementId, distance, event) {
var element = document.getElementById(elementId);
if (!element) {
return false;
}
var left = KAMPYLE_UTILS.offset(element).left - distance;
var top = KAMPYLE_UTILS.offset(element).top - distance;
var right = left + element.clientWidth + (2 * distance);
var bottom = top + element.clientHeight + (2 * distance);
var x = event.pageX;
var y = event.pageY;
return (x > left && x < right && y > top && y < bottom);
},
offset: function(element) {
if (!element) {
return false;
}
var rect = element.getBoundingClientRect();
var bodyElm = document.body;
return {
top: +rect.top + bodyElm.scrollTop,
left: rect.left + bodyElm.scrollLeft,
};
},
createIframe: function(src, width, height, iframeId) {
var iframe = document.createElement('iframe');
iframe.width = width;
iframe.height = height;
iframe.src = src;
iframe.id = iframeId;
iframe.style.border = 0;
iframe.frameBorder = 0;
iframe.style.display = 'inline-block';
return iframe;
},
getUrlParam: function(name) {
var params = location.search.substr(location.search.indexOf('?') + 1);
if (params === '') {
params = location.hash.substr(location.hash.indexOf('?') + 1);
}
var sval = null;
params = params.split('&');
var paramLenght = params.length;
for (var i = 0; i < paramLenght; i++) {
var temp = params[i].split('=');
if (temp && [temp[0]] == name) {
sval = decodeURIComponent(temp[1]);
}
}
return sval;
},
htmlDecode: function(inputHtml) {
inputHtml = inputHtml || '';
var re;
re = new RegExp('&lt','g');
inputHtml = inputHtml.replace(re, '<');
re = new RegExp('&gt','g');
inputHtml = inputHtml.replace(re, '>');
return inputHtml;
},
escapeRegExp: function(str) {
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
},
replaceAll: function(str, find, replace) {
return str.replace(new RegExp(KAMPYLE_UTILS.escapeRegExp(find),'g'), replace);
},
sendMessageToIframe: function(iframeId, message) {
var origin;
var targetWindow;
var iframe;
if (!iframeId) {
return;
}
iframe = document.getElementById(iframeId);
if (!iframe || !iframe.getAttribute) {
return;
}
var origin = iframe.getAttribute('origin') || '*';
var targetWindow = iframe.contentWindow;
if (targetWindow && targetWindow.postMessage) {
targetWindow.postMessage(JSON.stringify(message), origin);
}
},
getBrowser: function() {
var ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {
name: 'IE',
version: tem[1] || '',
};
}
if (M[1] === 'Chrome') {
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
if (tem != null) {
var temArr = tem.slice(1);
return {
name: temArr[0].replace('OPR', 'Opera'),
version: temArr[1] || '',
};
}
}
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
if ((tem = ua.match(/version\/(\d+)/i)) != null)
M.splice(1, 1, tem[1]);
return {
name: M[0],
version: M[1],
};
},
initEventSubscriptions: function(eventObj, callback) {
for (var prop in eventObj) {
if (eventObj.hasOwnProperty(prop)) {
KAMPYLE_EVENT_DISPATCHER.subscribe(prop, callback);
}
}
},
kampyleGetUserId: function() {
var userid = KAMPYLE_DATA.getData('kampyle_userid');
if (!userid) {
userid = KAMPYLE_UTILS.kampyleCreateUUID();
KAMPYLE_DATA.setData('kampyle_userid', userid);
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ALTERNATIVE_UUID)) {
KAMPYLE_DATA.setData(KAMPYLE_CONSTANT.MEMORY_DATA_FIELDS.MDIGITAL_ALTERNATIVE_UUID, KAMPYLE_UTILS.generateUUID());
}
}
return userid;
},
kampyleCreateUUID: function() {
var numAttempts = 8;
var uuidAlgorithm = function() {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
};
var uuid = uuidAlgorithm();
for (var i = 0; i < numAttempts - 1; i++) {
uuid += '-' + uuidAlgorithm();
}
return uuid;
},
removeAllContent: function(elem) {
if (!elem) {
return;
}
while (elem.firstChild) {
elem.removeChild(elem.firstChild);
}
elem.parentNode.removeChild(elem);
},
safeToLower: function(toLower) {
if (typeof toLower !== 'string') {
return toLower;
} else {
return toLower.toLowerCase();
}
},
kampyleSetCookie: function(cookieName, cookieValue, exDays, propertySharedSubdomain) {
var currDate = new Date();
currDate.setTime(currDate.getTime() + (exDays * 24 * 60 * 60 * 1000));
var expires = 'expires=' + currDate.toUTCString();
var domain = '';
if (propertySharedSubdomain) {
domain = ';domain=' + propertySharedSubdomain + ';';
cookieName = KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX + cookieName;
}
document.cookie = cookieName + '=' + cookieValue + '; ' + expires + ';path=/' + domain;
},
getCookie: function(cookieName) {
this.name = cookieName + '=';
this.ca = document.cookie.split(';');
for (var i = 0; i < this.ca.length; i++) {
this.c = this.ca[i];
while (this.c.charAt(0) === ' ')
this.c = this.c.substring(1);
if (this.c.indexOf(this.name) === 0) {
var valueToReturn = this.c.substring(this.name.length, this.c.length);
return valueToReturn;
}
}
return null;
},
getDomainFromHost: function(host) {
if (host === null) {
return null;
}
var portStartIndex = host.indexOf(':');
var lastDomainCharacter = portStartIndex === -1 ? host.length : portStartIndex;
return host.substring(0, lastDomainCharacter);
},
isHostMatchesSubdomain: function(host, subdomain) {
var domain = KAMPYLE_UTILS.getDomainFromHost(host);
return domain === subdomain || domain.endsWith('.' + subdomain);
},
kampyleGetCookie: function(cookieName) {
this.name = cookieName + '=';
this.ca = document.cookie.split(';');
for (var i = 0; i < this.ca.length; i++) {
this.c = this.ca[i];
while (this.c.charAt(0) === ' ')
this.c = this.c.substring(1);
if (this.c.indexOf(this.name) === 0)
return this.c.substring(this.name.length, this.c.length);
}
return '';
},
getByteSize: function(s) {
return encodeURIComponent('<q></q>' + s).length;
},
getAllKampyleData: function() {
var kampyleDataNames = ['SUBMITTED_DATE', 'kampyleUserPercentile', 'kampyleUserSession', 'kampyle_userid', 'kampyleInvitePresented', 'DECLINED_DATE', 'LAST_INVITATION_VIEW', ];
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ALTERNATIVE_UUID)) {
kampyleDataNames.push(KAMPYLE_CONSTANT.MEMORY_DATA_FIELDS.MDIGITAL_ALTERNATIVE_UUID);
}
var result = {};
for (var i = kampyleDataNames.length - 1; i >= 0; i--) {
result[kampyleDataNames[i]] = KAMPYLE_DATA.getData(kampyleDataNames[i]);
}
return result;
},
kampyleDeleteCookie: function(cookieName, propertySharedSubdomain) {
var domain = '';
if (propertySharedSubdomain) {
domain = ';domain=' + propertySharedSubdomain + ';';
}
var expires = 'expires=Thu, 01 Jan 1970 00:00:00 UTC';
document.cookie = cookieName + '= ; ' + expires + '; path=/' + domain;
},
kampyleIsCookieEnabled: function() {
return navigator.cookieEnabled;
},
kampyleCompareTimestamps: function(source, toCompare, operator) {
if (typeof source !== 'number' || typeof toCompare !== 'number') {
return false;
}
source = new Date(source);
toCompare = new Date(toCompare);
source.setHours(0, 0, 0, 0);
switch (operator) {
case 'equals':
toCompare.setHours(0, 0, 0, 0);
return (source.getTime() === toCompare.getTime());
break;
case 'laterthan':
toCompare.setHours(23, 59, 59, 999);
return (source > toCompare);
break;
case 'earlierthan':
toCompare.setHours(0, 0, 0, 0);
return (source < toCompare);
break;
case 'doesnotequal':
toCompare.setHours(0, 0, 0, 0);
return (source.getTime() !== toCompare.getTime());
break;
default:
return false;
break;
}
},
kampyleCompareByOperator: function(source, toCompare, operator, varType) {
varType = KAMPYLE_UTILS.safeToLower(varType);
var ans = false;
if (source === undefined) {
return ans;
}
operator = KAMPYLE_UTILS.safeToLower(operator);
switch (operator) {
case KAMPYLE_CONSTANT.OPERATORS.EQUALS:
if (varType === 'datetime') {
ans = KAMPYLE_UTILS.kampyleCompareTimestamps(source, toCompare, operator);
} else {
ans = (source === toCompare);
}
break;
case KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_EQUAL:
if (varType === 'datetime') {
ans = KAMPYLE_UTILS.kampyleCompareTimestamps(source, toCompare, operator);
} else {
ans = (source !== toCompare);
}
break;
break;
case KAMPYLE_CONSTANT.OPERATORS.GREATER_THAN:
ans = (source > toCompare);
break;
case KAMPYLE_CONSTANT.OPERATORS.LATER_THAN:
if (varType === 'datetime') {
ans = KAMPYLE_UTILS.kampyleCompareTimestamps(source, toCompare, operator);
} else {
ans = (source > toCompare);
}
break;
case KAMPYLE_CONSTANT.OPERATORS.SMALLER_THAN:
ans = (source < toCompare);
break;
case KAMPYLE_CONSTANT.OPERATORS.EARLIER_THAN:
if (varType === 'datetime') {
ans = KAMPYLE_UTILS.kampyleCompareTimestamps(source, toCompare, operator);
} else {
ans = (source > toCompare);
}
break;
case KAMPYLE_CONSTANT.OPERATORS.CONTAINS:
ans = (!!source && source.indexOf && source.indexOf(toCompare) !== -1);
break;
case KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_CONTAIN:
ans = (!!source && source.indexOf && source.indexOf(toCompare) === -1);
break;
case KAMPYLE_CONSTANT.OPERATORS.STARTS_WITH:
ans = (!!source && source.indexOf && source.indexOf(toCompare) === 0);
break;
case KAMPYLE_CONSTANT.OPERATORS.ENDS_WITH:
ans = (!!source && source.indexOf && source.length && source.indexOf(toCompare, source.length - source.length) !== -1);
break;
case KAMPYLE_CONSTANT.OPERATORS.HAS_VALUE:
ans = (!!source || source === '' || source === false || source === 0);
break;
case KAMPYLE_CONSTANT.OPERATORS.REGEX:
try {
var regex = new RegExp(toCompare);
ans = (!!source && regex.exec(source) !== null);
} catch (e) {
ans = false;
}
break;
default:
break;
}
return ans;
},
setNestedPropertyValue: function(obj, propString, value) {
var schema = obj;
var pList = propString.split('.');
var len = pList.length;
for (var i = 0; i < len - 1; i++) {
var elem = pList[i];
if (!schema[elem]) {
schema[elem] = {};
}
schema = schema[elem];
}
schema[pList[len - 1]] = value;
},
getNestedPropertyValue: function(obj, propString, fallback) {
if (!obj || !propString || typeof propString !== 'string') {
return null;
}
var propNameDotPlaceholder = '#DOT#';
var props = propString.split('.');
var tmpObj = obj;
var len = props.length;
for (var i = 0; i < len; i++) {
var currProp = props[i].split(propNameDotPlaceholder).join('.');
if (!!tmpObj && (tmpObj.hasOwnProperty(currProp) || tmpObj[currProp])) {
tmpObj = tmpObj[currProp];
} else {
return typeof fallback === "undefined" ? null : fallback;
}
}
return tmpObj;
},
validateKampyleDomain: function(url) {
var urlRegex = /(^https?:\/\/[A-Za-z0-9\-]+\.kampyle\.com(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?)/;
var result = urlRegex.test(url);
if (!result) {
console.warn('Invalid url in validateKampyleDomain: ' + url);
}
return result;
},
camelToDash: function(str) {
if (typeof str !== 'string') {
return str;
} else {
return str.replace(/\W+/g, '-').replace(/([a-z\d])([A-Z])/g, '$1-$2').toLowerCase();
}
},
objectPropertyObserver: function(obj, pathToProperty, callback) {
var MAX_TIMEOUT_RUNS = 100;
var timeoutMs = 100;
var runsCounter = 0;
function timoutCallback() {
var propertyValue = KAMPYLE_UTILS.getNestedPropertyValue(obj, pathToProperty);
if (!!propertyValue && callback instanceof Function) {
return callback(propertyValue);
}
if (runsCounter++ < MAX_TIMEOUT_RUNS) {
window.setTimeout(timoutCallback, timeoutMs);
}
}
window.setTimeout(timoutCallback, timeoutMs);
},
showInvite: function() {
var inviteIframe = document.getElementById('kampyleInvite');
KAMPYLE_UTILS.setElementStyle(inviteIframe, {
visibility: 'visible'
}, true);
},
hideInvite: function() {
var inviteIframe = document.getElementById('kampyleInvite');
KAMPYLE_UTILS.setElementStyle(inviteIframe, {
visibility: 'hidden'
}, true);
},
getNumericValue: function(val) {
if (val === '' || val === null) {
return null;
}
if (typeof (val) !== 'number' && isNaN(Number(val))) {
return null;
}
return Number(val);
},
httpGetRequest: function(url, onSuccess, onError, config) {
var counter = 0;
var numOfTimes = (config || {}).numOfTimes || KAMPYLE_CONSTANT.NETWORK.NUM_OF_RETRIES;
var timeout = (config || {}).timeout || KAMPYLE_CONSTANT.NETWORK.REQUEST_TIMEOUT;
function handleError(error, eventName, eventData) {
if (counter < numOfTimes) {
counter++;
var timeoutBetweenRetries = KAMPYLE_UTILS.getRetryTimeout();
setTimeout(makeRequest, timeoutBetweenRetries);
} else {
KAMPYLE_EVENT_DISPATCHER.trigger(eventName, eventData);
if (typeof onError === 'function') {
onError(error);
}
}
}
function makeRequest() {
var beforeRequestData = {
attemptNumber: counter,
url: url,
maxTimes: numOfTimes
};
KAMPYLE_EVENT_DISPATCHER.trigger('neb_beforeHttpGetRequest', {
httpRequestData: beforeRequestData
});
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.timeout = timeout || 0;
xhr.onerror = function(error) {
handleError(error, 'neb_afterHttpGetRequestOnError', {
httpRequestData: {
error: JSON.stringify(error)
}
});
}
;
xhr.ontimeout = function(error) {
handleError(error, 'neb_afterHttpGetRequestOnTimeout', {
httpRequestData: {
attemptNumber: counter,
error: JSON.stringify(error)
}
});
}
;
xhr.onload = function() {
if (xhr.status === 200) {
var data = KAMPYLE_UTILS.safeJsonParse(xhr.responseText);
KAMPYLE_EVENT_DISPATCHER.trigger('neb_afterHttpGetRequest', {
httpRequestData: data
});
if (typeof onSuccess === 'function') {
onSuccess(data);
}
} else {
var afterRequestData = {
responseStatus: xhr.status,
responseText: KAMPYLE_UTILS.safeJsonParse(xhr.responseText),
attemptNumber: counter
};
handleError(xhr.status, 'neb_afterHttpGetRequest', {
httpRequestData: afterRequestData,
error: xhr.status
});
}
}
;
xhr.send();
}
makeRequest();
},
httpPostRequest: function(url, jsonData, callback) {
var postRequestData = {
postData: Object.assign({
cdUserID: KAMPYLE_COOLADATA.getUserId()
}, jsonData),
};
KAMPYLE_EVENT_DISPATCHER.trigger('neb_beforeHttpPostRequest', postRequestData);
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onerror = function() {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_afterHttpPostRequestOnError', {
postData: xhr.status
});
if (typeof callback === 'function') {
callback();
} else {
return;
}
}
xhr.onload = function() {
if (xhr.status === 200) {
var data = KAMPYLE_UTILS.safeJsonParse(xhr.responseText);
if (typeof callback === 'function') {
callback(null, data);
} else {
return;
}
} else {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_afterHttpPostRequest', {
postData: xhr.status
});
if (typeof callback === 'function') {
callback(xhr.status);
} else {
return;
}
}
}
;
xhr.send(JSON.stringify(postRequestData.postData));
},
lowerize: function(str) {
return str.toLowerCase();
},
trim: function(str) {
return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
},
getDeviceTypeByUserAgent: function(agent) {
var FUNC_TYPE = 'function'
, MODEL = 'model'
, OBJ_TYPE = 'object'
, TYPE = 'type'
, VENDOR = 'vendor'
, CONSOLE = 'console'
, MOBILE = 'mobile'
, TABLET = 'tablet'
, SMARTTV = 'smarttv'
, WEARABLE = 'wearable'
, DESKTOP = 'desktop';
var device = {};
var arrays = [[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i], [MODEL, VENDOR, [TYPE, TABLET]], [/applecoremedia\/[\w\.]+ \((ipad)/], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [/(archos)\s(gamepad2?)/i, /(hp).+(touchpad)/i, /(hp).+(tablet)/i, /(kindle)\/([\w\.]+)/i, /\s(nook)[\w\s]+build\/(\w+)/i, /(dell)\s(strea[kpr\s\d]*[\dko])/i, /SHIELD Tablet/, /A500/, /LG-V410\/V41020c/, /Puffin/, /^(?!.*Mobile).*Android.*$/], [VENDOR, MODEL, [TYPE, TABLET]], [/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [/\((ip[honed|\s\w*]+);.+(apple)/i], [MODEL, VENDOR, [TYPE, MOBILE]], [/\((ip[honed|\s\w*]+);/i], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [/(blackberry)[\s-]?(\w+)/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, /(hp)\s([\w\s]+\w)/i, /(asus)-?(\w+)/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/\(bb10;\s(\w+)/i], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [/(sony)\s(tablet\s[ps])\sbuild\//i, /(sony)?(?:sgp.+)\sbuild\//i], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i], [[VENDOR, 'Sony'], [MODEL, 'Xperia Phone'], [TYPE, MOBILE]], [/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i], [VENDOR, MODEL, [TYPE, TABLET]], [/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, /(zte)-(\w+)*/i, /(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [/(nexus\s9)/i], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [/(nexus\s6p)/i], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [/(microsoft);\s(lumia[\s\w]+)/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/(kin\.[onetw]{3})/i], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [/smart-tv.+(samsung)/i], [VENDOR, [TYPE, SMARTTV], MODEL], [/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [/sie-(\w+)*/i], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [/(maemo|nokia).*(n900|lumia\s\d+)/i, /(nokia)[\s_-]?([\w-]+)*/i], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [/android\s3\.[\s\w;-]{10}(a\d{3})/i], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [/(nexus\s[45])/i, /lg[e;\s\/-]+(\w+)*/i], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [/android.+(ideatab[a-z0-9\-\s]+)/i], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [/linux;.+((jolla));/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i], [VENDOR, MODEL, [TYPE, MOBILE]], [/android.+;\s(pixel c)\s/i], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [/android.+;\s(pixel xl|pixel)\s/i], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [/android.+(\w+)\s+build\/hm\1/i, /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [/android.+a000(1)\s+build/i], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [/\s(tablet)[;\/]/i, /\s(mobile)(?:[;\/]|\ssafari)/i], [[TYPE, KAMPYLE_UTILS.lowerize], VENDOR, MODEL], [/Mobile|iP(hone|od|ad)|(Android).*(Mobile|sdk)|BlackBerry|portalmmm|BOLT|Vodafone|WindowsCE|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/], [VENDOR, MODEL, [TYPE, MOBILE]], ];
var ua = agent || navigator.userAgent;
var i = 0, j, k, p, q, matches, match;
while (i < arrays.length && !matches) {
var regex = arrays[i]
, props = arrays[i + 1];
j = k = 0;
while (j < regex.length && !matches) {
matches = regex[j++].exec(ua);
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
if (typeof q === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof q[1] == FUNC_TYPE) {
device[q[0]] = q[1].call(device, match);
} else {
device[q[0]] = q[1];
}
} else if (q.length == 3) {
if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {
device[q[0]] = match ? q[1].call(device, match, q[2]) : undefined;
} else {
device[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
device[q[0]] = match ? q[3].call(device, match.replace(q[1], q[2])) : undefined;
}
} else {
device[q] = match ? match : undefined;
}
}
}
}
i += 2;
}
if (!device[TYPE] || (device[TYPE] !== MOBILE && device[TYPE] !== TABLET)) {
return DESKTOP;
}
return device[TYPE];
},
getElementStyle: function(domElement, styleProperty) {
if (domElement instanceof HTMLElement) {
try {
return window.getComputedStyle(domElement).getPropertyValue(styleProperty);
} catch (err) {}
}
return null;
},
isTruthy: function(expression) {
if (typeof expression !== 'string') {
return expression;
}
try {
expression = JSON.parse(expression);
} catch (err) {}
return expression;
},
safeJsonParse: function(str, msgOnFail) {
try {
return JSON.parse(str);
} catch (e) {
KAMPYLE_UTILS.showWarning(msgOnFail ? msgOnFail : 'Failed to parse JSON, error message: ' + (e || {}).message);
KAMPYLE_UTILS.showErrorStack(e || {});
return null;
}
},
scrollToLastPosition: function() {
var position = KAMPYLE_DATA.getMemoryData('scrollPosition');
if (position) {
window.scroll(position.x, position.y);
KAMPYLE_DATA.deleteMemoryData('scrollPosition');
}
},
setCurrentScrollPosition: function() {
if (document.body !== document.activeElement) {
return false;
}
var axis = KAMPYLE_UTILS.getScrollPosition() || {};
KAMPYLE_DATA.setMemoryData('scrollPosition', {
x: axis.x,
y: axis.y
});
},
getScrollPosition: function() {
var isPageOffsetSupported = window.pageXOffset !== undefined;
var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
var x = isPageOffsetSupported ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
var y = isPageOffsetSupported ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
return {
x: x,
y: y
}
},
getStrigifiedData: function(data) {
var strigifyData;
if (typeof data === 'object' && data !== null) {
try {
strigifyData = JSON.stringify(data);
} catch (err) {
strigifyData = data;
}
} else {
strigifyData = data;
}
return strigifyData;
},
appendScript: function(scriptSrc) {
var s = document.createElement('script');
s.src = scriptSrc;
document.body.appendChild(s);
},
toBase64: function(str) {
str = str || '';
return btoa(unescape(encodeURIComponent(str)));
},
styleObjToInline: function(styleObj) {
var inlineStyle = '';
for (var prop in styleObj) {
inlineStyle += prop + ':' + styleObj[prop] + ';';
}
return inlineStyle;
},
getBaseUrl: function() {
return location.origin + location.pathname;
},
generateUUID: function() {
var seed = Date.now();
if (window.performance && typeof window.performance.now === 'function') {
seed += performance.now();
}
var UUID = 'xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx'.replace(/[x]/g, function() {
var random = (seed + Math.random() * 16) % 16 | 0;
seed = Math.floor(seed / 16);
return random.toString(16);
});
return UUID;
},
getRetryTimeout: function() {
var dataJson = KAMPYLE_DATA.getMemoryData('dataJson');
return KAMPYLE_UTILS.getNestedPropertyValue(dataJson, 'retryTimout') || KAMPYLE_CONSTANT.NETWORK.RETRY_TIMEOUT;
},
};
window.KAMPYLE_EVENT_DISPATCHER = (function(window, document) {
var eventSubscriptions;
function init() {
eventSubscriptions = {};
}
function getEventSubscriptions(eventName) {
if (eventName && eventSubscriptions && eventSubscriptions[eventName]) {
return eventSubscriptions[eventName];
} else {
return eventSubscriptions;
}
}
;var unsubscribe = function(eventName, callback) {
if (!eventName || typeof eventName !== 'string' || !callback || typeof callback !== 'function') {
return false;
}
var subscribers = eventSubscriptions[eventName];
if (typeof subscribers !== 'undefined') {
var callbackIndex = subscribers.indexOf(callback);
if (callbackIndex !== -1) {
subscribers.splice(callbackIndex, 1);
}
}
return true;
};
var subscribe = function(eventName, callback) {
if (!eventName || typeof eventName !== 'string' || !callback || (typeof callback !== 'function' && typeof callback !== 'string')) {
return false;
}
var subscribers = eventSubscriptions[eventName];
if (typeof subscribers === 'undefined') {
subscribers = eventSubscriptions[eventName] = [];
}
var callbackIndex = subscribers.indexOf(callback);
if (callbackIndex === -1) {
subscribers.push(callback);
}
return true;
};
function appendDefaultEventParams(data) {
data = data || {};
var allData = KAMPYLE_FUNC.kampyleGetData();
var defaultValues = {};
if (allData) {
defaultValues = {
'accountId': allData.accountId,
'websiteId': allData.websiteId,
'enviroment': allData.region
};
}
return Object.assign(data, defaultValues);
}
var trigger = function(eventName, data, context, options) {
var subscribers = eventSubscriptions[eventName];
var i, iMax;
if (typeof subscribers === 'undefined') {
return false;
}
data = appendDefaultEventParams(data);
var dataAsArray = (data instanceof Array) ? data : [data];
context = context || null;
iMax = subscribers.length;
for (i = 0; i < iMax; i += 1) {
if (typeof subscribers[i] === 'string') {
KAMPYLE_UTILS.triggerCustomEvent(subscribers[i]);
} else {
try {
subscribers[i].apply(context, [eventName].concat(dataAsArray));
} catch (e) {
KAMPYLE_UTILS.showErrorStack(e);
if (window.KAMPYLE_COOLADATA) {
if (data) {
data.errorMessage = e.message;
data.errorStack = e.stack;
KAMPYLE_COOLADATA.triggerCooladataEventDispatcherError(data);
}
}
if (options && options.isStrictMode) {
break;
}
continue;
}
}
}
return true;
};
var subscribeMany = function(eventMapping) {
for (var eventName in eventMapping) {
if (eventMapping.hasOwnProperty(eventName)) {
for (var i = 0; i < eventMapping[eventName].length; i++) {
subscribe(eventName, eventMapping[eventName][i]);
}
}
}
};
function subscribeOnce(eventName, callback) {
var subscribers = getEventSubscriptions(eventName);
if (!subscribers[eventName] || subscribers.indexOf(callback) === -1) {
subscribe(eventName, callback);
}
}
return {
subscribe: subscribe,
subscribeOnce: subscribeOnce,
subscribeMany: subscribeMany,
trigger: trigger,
unsubscribe: unsubscribe,
init: init,
getEventSubscriptions: getEventSubscriptions,
appendDefaultEventParams: appendDefaultEventParams
}
}
)(window, document);
window.MDIGITAL_OnPrem = (function() {
var onPremRelatedPaths = ['formHtmlUrl', 'buttonData.buttonUrl', 'formDataUrl', 'inviteData.inviteUrl', 'inviteData.inviteDataUrl'];
function isOnPrem() {
return !!(KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID) && (window.KAMPYLE_EMBED && window.KAMPYLE_EMBED.isOnPrem()));
}
function resolveAbsolutePath(relativePath) {
if (!window.KAMPYLE_EMBED || !window.KAMPYLE_EMBED.getResourcesPrefix()) {
return relativePath;
} else {
return window.KAMPYLE_EMBED.getResourcesPrefix() + relativePath;
}
}
function getPackageRoot() {
return isOnPrem() ? window.KAMPYLE_EMBED.getResourcesPrefix() : null;
}
function getPackageVersion() {
if (KAMPYLE_DATA && KAMPYLE_DATA.getMemoryData('dataJson')) {
return KAMPYLE_DATA.getMemoryData('dataJson').packageVersion;
} else {
return null;
}
}
function replaceOnPremPrefixes(rawText) {
rawText = rawText || '';
var formattedText;
if (rawText.indexOf(KAMPYLE_CONSTANT.ONPREM_URL_PREFIX) === -1) {
return rawText;
} else {
var formattedText = rawText.replace(KAMPYLE_CONSTANT.ONPREM_URL_PREFIX, KAMPYLE_EMBED.getResourcesPrefix());
return formattedText;
}
}
function replaceFormNodeUrls(node) {
if (!node) {
return false;
}
onPremRelatedPaths.forEach(function(path) {
var pathValue = KAMPYLE_UTILS.getNestedPropertyValue(node, path);
if (pathValue) {
KAMPYLE_UTILS.setNestedPropertyValue(node, path, replaceOnPremPrefixes(pathValue))
}
});
return node;
}
return {
resolveAbsolutePath: resolveAbsolutePath,
getPackageVersion: getPackageVersion,
getPackageRoot: getPackageRoot,
replaceFormNodeUrls: replaceFormNodeUrls,
isOnPrem: isOnPrem,
};
}
)();
window.MDIGITAL = window.MDIGITAL || {};
window.MDIGITAL.EMBEDDED = (function(window, document) {
function init() {
var eventMapping = {
neb_loadForm: [createEmbeddedIframe],
neb_formLoaded: [showForm],
neb_iFrameHeightChanged: [calculateFormSize],
neb_formClosed: [deleteEmbeddedIframe],
MDigital_ThankYou_Displayed: [handleThankyouPage]
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
}
function isEmbeddedFullWidth(formId) {
var formData = KAMPYLE_DATA.getFormData(formId);
return KAMPYLE_UTILS.getNestedPropertyValue(formData, 'isFullWidthEmbedded');
}
function createEmbeddedIframe(eventName, data) {
data = data || {};
if (!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)) {
return false;
}
var hostingElement = getHostingElement(data.formId);
if (hostingElement) {
var hostingElementHeight = parseInt(getComputedStyle(hostingElement).height);
addHostingElementHeight(hostingElement.id, hostingElementHeight);
}
if (!isHostingElementValid(hostingElement)) {
return false;
}
var formIframe = getOrCreateIframe(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId);
var formData = KAMPYLE_DATA.getFormData(data.formId);
formIframe.src = KAMPYLE_COMMON.createFormUrl(formData.formHtmlUrl, data.formId);
hostingElement.appendChild(formIframe);
KAMPYLE_DATA.setFormState(data.formId, {
shown: true
});
return true;
}
function showForm(eventName, data) {
if (!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId) || !KAMPYLE_DATA.hasFormJsonData(data)) {
return false;
}
var currIframe = document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId);
if (!!currIframe) {
setIframeStyle(currIframe, {
display: 'block'
});
}
return true;
}
function isHostingElementValid(element) {
return element !== null && (!element.innerHTML || (typeof element.innerHTML === 'string' && element.innerHTML.trim() === ""));
}
function getHostingElement(formId) {
var formData = KAMPYLE_DATA.getFormData(formId);
return document.getElementById(KAMPYLE_UTILS.getNestedPropertyValue(formData, 'embeddedData.pageElementId'));
}
function getOrCreateIframe(iframeId) {
var formIframe = document.getElementById(iframeId);
if (!formIframe) {
formIframe = document.createElement('iframe');
formIframe.id = iframeId;
formIframe.setAttribute('title', 'Feedback Survey');
setIframeStyle(formIframe, {
display: 'none'
})
}
return formIframe;
}
function setIframeStyle(formIframe, style) {
var defaultStyle = {
border: 0,
width: '100%',
height: '100%'
};
var formattedStyle = Object.assign({}, defaultStyle, style);
KAMPYLE_UTILS.setElementStyle(formIframe, formattedStyle, false);
}
function calculateFormSize(event, data) {
data = data || {};
var formData = KAMPYLE_DATA.getFormData(data.formId) || {};
var hostingElement = getHostingElement(data.formId);
var formIframe = document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId);
if (!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId) || hostingElement === null || formIframe === null) {
return false;
}
var newHeightSettings = calculateHeights(hostingElement, formData, data);
var newWidth = calculateWidth(hostingElement, formData);
var iframeStyle = {
height: newHeightSettings.iframeHeight + 'px',
width: isEmbeddedFullWidth(data.formId) ? '100%' : newWidth + 'px'
}
setIframeStyle(formIframe, iframeStyle);
var messageData = {
height: newHeightSettings.formHeight,
width: newWidth,
shouldBeStatic: newHeightSettings.shouldBeStatic
};
KAMPYLE_UTILS.sendMessageToIframe(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId, {
action: 'setFormStyle',
data: messageData,
});
return messageData;
}
function calculateHeights(hostingElement, formData, data) {
var isStatic = formData.isFixedSize === 'true' || formData.isFixedSize === true;
var shouldBeStatic = isStatic;
var formHeight = isStatic ? parseInt(formData.formHeight) : data.newHeight;
var hostingElementComputedStyle = getComputedStyle(hostingElement);
var hostHeight = getHostingElementHeight(hostingElement.id);
hostHeight = isNaN(hostHeight) ? parseInt(hostingElement.style.height || 0) : hostHeight;
var hostMaxHeight = isNaN(parseInt(hostingElementComputedStyle.maxHeight)) ? (hostHeight || 0) : parseInt(hostingElementComputedStyle.maxHeight);
var hostMinHeight = isNaN(parseInt(hostingElementComputedStyle.minHeight)) ? 0 : parseInt(hostingElementComputedStyle.minHeight);
var isDynamicHost = hostMaxHeight === 0 && hostMinHeight === 0;
if (hostMaxHeight !== 0 && hostMinHeight > hostMaxHeight) {
hostMaxHeight = hostMinHeight;
}
return getNewHeightSettings(formHeight, shouldBeStatic, isDynamicHost, hostMaxHeight, hostMinHeight, hostHeight);
}
function getNewHeightSettings(formHeight, shouldBeStatic, isDynamicHost, hostMaxHeight, hostMinHeight, hostHeight) {
var newIframeHeight;
var newFormHeight = formHeight;
if (isDynamicHost) {
newFormHeight = formHeight;
newIframeHeight = newFormHeight;
} else {
if (hostMaxHeight !== 0 && formHeight >= hostMaxHeight) {
newFormHeight = hostMaxHeight;
shouldBeStatic = true;
}
newIframeHeight = newFormHeight;
if (formHeight < hostMinHeight || formHeight < hostHeight) {
newIframeHeight = hostMinHeight !== 0 ? hostMinHeight : hostHeight;
}
}
return {
formHeight: newFormHeight,
iframeHeight: newIframeHeight,
shouldBeStatic: shouldBeStatic
}
}
function calculateWidth(hostingElement, formData) {
var formWidth = parseInt(formData.formWidth);
return Math.min(formWidth, KAMPYLE_UTILS.getElementSize(hostingElement).width);
}
function deleteEmbeddedIframe(eventName, data) {
if (!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)) {
return false;
}
var currIframe = document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX + data.formId);
if (currIframe === null) {
return false;
}
KAMPYLE_UTILS.removeAllContent(currIframe);
return true;
}
function addHostingElementHeight(elementId, height) {
var elementsHeightsObj = KAMPYLE_DATA.getMemoryData('hostingElementsHeights');
elementsHeightsObj[elementId] = height;
KAMPYLE_DATA.setMemoryData('hostingElementsHeights', elementsHeightsObj);
}
function getHostingElementHeight(elementId) {
return KAMPYLE_DATA.getMemoryData('hostingElementsHeights')[elementId] || 0;
}
function handleThankyouPage(eventName, data) {
data = data || {};
if (KAMPYLE_DATA.isEmbeddedDisplayType(data.formId) && KAMPYLE_DATA.isMobile()) {
KAMPYLE_VIEW.scrollToEmbeddedForm(data.formId);
}
}
return {
init: init,
createEmbeddedIframe: createEmbeddedIframe,
showForm: showForm,
calculateFormSize: calculateFormSize,
deleteEmbeddedIframe: deleteEmbeddedIframe,
addHostingElementHeight: addHostingElementHeight,
getHostingElementHeight: getHostingElementHeight,
handleThankyouPage: handleThankyouPage,
};
}
)(window, document);
window.MDIGITAL = window.MDIGITAL || {};
window.MDIGITAL.FORM_STATE = (function(window, document) {
function init() {
var eventMapping = {
MDigital_targetingRuleEvaluated: [updateTargetingState],
};
KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);
}
function updateTargetingState(eventName, data) {
if (!canUpdateState(data)) {
return false;
}
var formState = KAMPYLE_DATA.getFormState(data.formId);
var phaseRules = [].concat(formState.targeting[data.targetingPhase] || []);
phaseRules.push(getRuleData(data));
var targetingPhaseState = {};
targetingPhaseState[data.targetingPhase] = phaseRules;
KAMPYLE_DATA.setFormState(data.formId, {
targeting: targetingPhaseState
});
}
function getRuleData(data) {
var ruleData = {
targetingRule: "",
isPassed: false,
expected: "",
actual: "",
};
Object.keys(ruleData).forEach(function(property) {
ruleData[property] = data[property];
});
return ruleData;
}
function canUpdateState(data) {
data = data || {};
var formState = KAMPYLE_DATA.getFormState(data.formId);
return !(!formState || !formState.targeting || !data.targetingPhase);
}
return {
init: init,
updateTargetingState: updateTargetingState,
getRuleData: getRuleData,
canUpdateState: canUpdateState
};
}
)(window, document);
window.KAMPYLE_COOLADATA = (function(window, document) {
var COOLADATA_CONFIGURATION = {
API_GATEWAY_ENDPOINT: 'uwbhzazjt4.execute-api.eu-west-1.amazonaws.com/Production',
COOLADATA_APP_KEY: {
PROD: 'qceuv8449dzg58ptt1bhda9g8ue19c7s',
QA: 'lf5shxz66ckwmizs7kowapgs2rkoejcl'
}
};
var rateLimitCounterMap = {};
var COMMON_FIELDS;
var COOLADATA_SRC_PREFIX = (window.MDIGITAL_OnPrem && MDIGITAL_OnPrem.isOnPrem()) ? window.KAMPYLE_EMBED.getResourcesPrefix() + '/' : KAMPYLE_CONSTANT.PLACEHOLDERS.COOLADATA_SRC_PREFIX;
var COOLADATA_SRC = COOLADATA_SRC_PREFIX + KAMPYLE_CONSTANT.SRC.COOLADATA;
var cooladataEvents = {
neb_pageView: {
eventId: 'nebula_page_view',
},
neb_inviteAccepted: {
eventId: 'nebula_invite_accepted',
},
neb_inviteDeclined: {
eventId: 'nebula_invite_declined',
},
neb_showInvitation: {
eventId: 'nebula_invitation_show',
memoryDataKey: 'invitationTriggeringData',
},
neb_feedbackSubmitted: {
eventId: 'nebula_form_submitted',
},
neb_formShown: {
eventId: 'nebula_form_show',
},
neb_buttonClicked: {
eventId: 'nebula_button_clicked',
},
neb_sdkLoadForm: {
eventId: 'nebula_load_form_bycode',
},
neb_sdkShowForm: {
eventId: 'nebula_code_trigger_form',
},
neb_routeToForm: {
eventId: 'nebula_route_to_form',
},
neb_formClosed: {
eventId: 'nebula_form_closed',
},
neb_popupBlocked: {
eventId: 'nebula_popup_blocked',
},
neb_skipInvitation: {
eventId: 'nebula_invitation_skipped',
},
neb_formPageShown: {
eventId: 'nebula_form_page_displayed',
},
neb_captureInit: {
eventId: 'nebula_capture_init',
},
neb_captureImageClicked: {
eventId: 'nebula_capture_image_clicked',
},
neb_cancelCaptureClicked: {
eventId: 'nebula_cancel_capture_clicked',
},
neb_load_form_preload_proximity: {
eventId: 'nebula_load_form_preload_proximity',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_cancel_capture_clicked: {
eventId: 'nebula_cancel_capture_clicked',
},
neb_load_form_form_reload: {
eventId: 'nebula_load_form_form_reload',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_button_displayed: {
eventId: 'nebula_button_displayed',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_invitation_loaded: {
eventId: 'nebula_invitation_loaded',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_invitation_ready: {
eventId: 'nebula_invitation_ready',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_form_loaded: {
eventId: 'nebula_form_loaded',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_formReady: {
eventId: 'nebula_form_ready',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents,
},
neb_sdkSurveyDisplayed: {
eventId: 'nebula_code_survey_displayed',
},
neb_beforeHttpGetRequest: {
eventId: 'nebula_before_http_get_request',
eventDataKey: 'httpRequestData',
},
neb_afterHttpGetRequestOnError: {
eventId: 'nebula_after_http_get_request_on_error',
eventDataKey: 'httpRequestData',
},
neb_afterHttpGetRequestOnTimeout: {
eventId: 'nebula_after_http_get_request_on_timeout',
eventDataKey: 'httpRequestData',
},
neb_afterHttpGetRequest: {
eventId: 'nebula_after_http_get_request',
eventDataKey: 'httpRequestData',
},
MDigital_updatingSbtServer: {
eventId: 'MDigital_updating_sbt_server',
eventDataKey: 'dataObjForSbt',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
MDigital_settingIdentifierValueOnMemory: {
eventId: 'MDigital_setting_identifier_value_on_memory',
eventDataKey: 'hasIdentifierValue',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
MDigital_shouldNotSyncIdentifier: {
eventId: 'MDigital_should_not_sync_identifier',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
neb_beforeHttpPostRequest: {
eventId: 'nebula_before_http_post_request',
eventDataKey: 'postData',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
neb_afterHttpPostRequestOnError: {
eventId: 'nebula_after_http_post_request_on_error',
eventDataKey: 'postData',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
neb_afterHttpPostRequest: {
eventId: 'nebula_after_http_post_request',
eventDataKey: 'postData',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
MDigital_updateTargetingWithDeclinedDateInviteDeclined: {
eventId: 'MDigital_update_targeting_with_declined_date_invite_declined',
eventDataKey: 'declinedDate',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
MDigital_updateTargetingWithSubmittedDate: {
eventId: 'MDigital_update_targeting_with_submitted_date',
eventDataKey: 'submittedDate',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
MDigital_updateTargetingWithDeclinedDateFormClosed: {
eventId: 'MDigital_update_targeting_with_declined_date_form_closed',
eventDataKey: 'declinedDate',
provision: KAMPYLE_CONSTANT.PROVISIONS.UBT_EXTRA_EVENTS,
},
neb_initUserIdentifier: {
eventId: 'nebula_init_user_identifier',
eventDataKey: 'hasIdentifierValue',
},
neb_initUserIdentifierOnExtraData: {
eventId: 'nebula_init_user_identifier_on_extra_data',
eventDataKey: 'hasIdentifierValue',
},
neb_eventDispatcherError: {
eventId: 'nebula_eventDispatcherError',
eventDataKeys: ['errorMessage', 'errorStack', 'additionalInfo']
},
neb_feedbackUUIDisNull: {
eventId: 'nebula_feedbackUuidIsNull'
},
neb_submitFeedbackFailed: {
eventId: 'nebula_submitFeedbackFailed',
eventDataKeys: ['uuid', 'errorMessage', 'errorStack']
},
MDigital_Form_Next_Page: {
eventId: 'MDigital_Form_Next_Page',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents
},
MDigital_Form_Back_Page: {
eventId: 'MDigital_Form_Back_Page',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents
},
MDigital_Form_Close_No_Submit: {
eventId: 'MDigital_Form_Close_No_Submit',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents
},
MDigital_ThankYou_Displayed: {
eventId: 'MDigital_ThankYou_Displayed',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents
},
MDigital_ThankYou_Close: {
eventId: 'MDigital_ThankYou_Close',
provision: KAMPYLE_CONSTANT.PROVISIONS.cooladataNewEvents
},
MDigital_warning: {
eventId: 'MDigital_warning',
eventDataKey: 'message'
},
};
function initRateLimiting() {
Object.keys(cooladataEvents).forEach(function(ev) {
var eventObj = cooladataEvents[ev];
if (isEventDefinedAsRateLimited(eventObj)) {
rateLimitCounterMap[eventObj.eventId] = 0;
}
});
}
function getDataToSend(dataFormatted) {
dataFormatted.uuid = dataFormatted.feedbackUUID || dataFormatted.uuid;
var dataToSend = {
enviroment: dataFormatted.enviroment,
accountId: dataFormatted.accountId,
url: dataFormatted.pageURL,
websiteId: dataFormatted.websiteId,
feedback_uuid: dataFormatted.uuid || null,
formId: dataFormatted.formId || null,
formTriggerType: dataFormatted.formTriggerType || null,
kampyle_data: dataFormatted.kampyle_data || null,
cookie_size: dataFormatted.cookie_size || null,
kampyle_version: dataFormatted.kampyle_version || '',
history_length: window.history.length,
event_local_timestamp: Date.now(),
position: dataFormatted.position || null,
isUserIdentified: !!KAMPYLE_DATA.getMemoryData('identifierValue'),
};
if (dataFormatted.eventId === 'nebula_form_page_shown') {
dataToSend.pageNumber = dataFormatted.pageNumber;
}
if (dataFormatted.eventId === 'nebula_route_to_form') {
dataToSend.destinationForm = dataFormatted.formId;
}
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)) {
dataToSend.packageVersion = MDIGITAL_OnPrem.getPackageVersion();
}
addEventDataKeys(dataFormatted, dataToSend)
return dataToSend;
}
function addEventDataKeys(dataFormatted, dataToSend) {
var cooladataEvent = cooladataEvents[dataFormatted.eventName];
var eventDataKeys = cooladataEvent ? cooladataEvent.eventDataKeys : null;
if (eventDataKeys) {
for (var i = 0; i < eventDataKeys.length; i++) {
dataToSend[eventDataKeys[i]] = dataFormatted[eventDataKeys[i]] || null;
}
}
}
function kampyleSendCoolaData(dataFormatted) {
if (!dataFormatted || !window.cooladata) {
return false;
}
var dataToSend = getDataToSend(dataFormatted);
makeCooladataCall(dataFormatted.eventId, dataToSend);
return true;
}
function formatData(eventName, oData) {
if (!eventName || !oData) {
return null;
}
var result = Object.assign({}, result, oData);
for (var prop in COMMON_FIELDS) {
result[prop] = COMMON_FIELDS[prop];
}
for (var eventProp in cooladataEvents[eventName]) {
result[eventProp] = cooladataEvents[eventName][eventProp];
}
var kampyleData = appendDataByEventName(eventName, KAMPYLE_UTILS.getAllKampyleData(), result);
result.kampyle_data = kampyleData;
result.cookie_size = KAMPYLE_UTILS.getByteSize(document.cookie);
result.kampyle_version = window.KAMPYLE_REVISION || '0.0.0.0';
result.eventName = eventName;
return result;
}
var triggerCooladataEvent = function(eventName, oData) {
var eventObj = cooladataEvents[eventName];
if (!(eventObj && isEventProvisioned(eventObj)) || isRateLimitExceeded(eventObj)) {
return false;
}
var shouldFormatEventData = eventObj.formatDataFunc && typeof eventObj.formatDataFunc === 'function';
if (shouldFormatEventData) {
oData = eventObj.formatDataFunc.call(this, oData);
}
var oDataFormatted = formatData(eventName, oData);
KAMPYLE_COOLADATA.kampyleSendCoolaData(oDataFormatted);
};
function isEventProvisioned(eventObj) {
return !eventObj.provision || !!KAMPYLE_FUNC.checkProvision(eventObj.provision);
}
function isEventDefinedAsRateLimited(eventObj) {
return typeof eventObj.rateLimit === 'number' && eventObj.rateLimit > 0;
}
function getEventCallsCounter(eventId) {
var counter = rateLimitCounterMap[eventId];
return typeof counter === 'number' ? counter : null;
}
function isRateLimitExceeded(eventObj) {
var counter = getEventCallsCounter(eventObj.eventId);
return KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.COOLADATA_EVNETS_LIMIT) && typeof counter === 'number' && counter >= eventObj.rateLimit;
}
function increaseEventCallsCounter(eventId) {
if (getEventCallsCounter(eventId) === null) {
return null;
}
return ++(rateLimitCounterMap[eventId]);
}
function triggerCooladataEventDispatcherError(eventData) {
if (!eventData || !window.cooladata) {
return false;
}
var dataFormatted = formatData('neb_eventDispatcherError', eventData);
var dataToSend = getDataToSend(dataFormatted);
makeCooladataCall(dataFormatted.eventId, dataToSend);
return dataToSend;
}
function makeCooladataCall(eventId, dataToSend) {
try {
window.cooladata.trackEvent(eventId, dataToSend);
getEventCallsCounter(eventId) !== null && increaseEventCallsCounter(eventId);
} catch (e) {
console.warn(e);
}
}
function init() {
try {
if (!window.cooladata) {
(function(d, a) {
if (!a.__SV) {
var b, c, g, e;
window.cooladata = a;
a._i = [];
a.init = function(b, c, f) {
function d(a, b) {
var c = b.split(".");
2 == c.length && (a = a[c[0]],
b = c[1]);
a[b] = function() {
a.push([b].concat(Array.prototype.slice.call(arguments, 0)))
}
}
var h = a;
"undefined" !== typeof f ? h = a[f] = [] : f = "cooladata";
g = ["trackEvent", "trackEventLater", "trackPageload", "flush", "setConfig"];
for (e = 0; e < g.length; e++)
d(h, g[e]);
a._i.push([b, c, f])
}
;
a.__SV = 1.2;
b = d.createElement("script");
b.type = "text/javascript";
b.async = !0;
b.src = COOLADATA_SRC;
c = d.getElementsByTagName("script")[0];
c.parentNode.insertBefore(b, c)
}
}
)(document, window.cooladata || []);
}
COMMON_FIELDS = {
pageURL: location.href,
userid: KAMPYLE_UTILS.kampyleGetUserId(),
};
if (window.cooladata) {
var cooladataApiHost = KAMPYLE_CONSTANT.PLACEHOLDERS.COOLDATA_API_HOST;
if (cooladataApiHost.endsWith('/')) {
cooladataApiHost = cooladataApiHost.substr(0, cooladataApiHost.length - 1);
}
try {
window.cooladata.init({
cookie_expiration: KAMPYLE_DATA.getCookieExpiration(),
app_key: KAMPYLE_UTILS.isDebugMode() ? COOLADATA_CONFIGURATION.COOLADATA_APP_KEY.QA : COOLADATA_CONFIGURATION.COOLADATA_APP_KEY.PROD,
track_pageload: false,
img_src_get_request: true,
api_host: KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.API_GATEWAY) ? COOLADATA_CONFIGURATION.API_GATEWAY_ENDPOINT : cooladataApiHost,
});
if (KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.COOLADATA_EVNETS_LIMIT)) {
initRateLimiting();
KAMPYLE_EVENT_DISPATCHER.subscribeOnce(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_SDK_PAGE_VIEW, initRateLimiting);
}
} catch (e) {
console.warn(e);
}
}
KAMPYLE_UTILS.initEventSubscriptions(cooladataEvents, triggerCooladataEvent);
return true;
} catch (e) {
console.warn(e);
}
}
function getUserId() {
var userId;
try {
userId = KAMPYLE_DATA.getData('cd_user_id') || window.cooladata.config.user_id || null;
} catch (e) {
console.warn(e);
}
return userId;
}
function appendDataByEventName(eventName, dataObj, eventJsonData) {
eventJsonData = eventJsonData || {};
var memoryDataKey = cooladataEvents[eventName].memoryDataKey;
var memoryData = KAMPYLE_DATA.getMemoryData(memoryDataKey);
if (memoryData) {
dataObj[memoryDataKey] = memoryData;
}
var eventDataKey = cooladataEvents[eventName].eventDataKey;
var eventData = eventJsonData[eventDataKey];
if (eventData) {
dataObj[eventDataKey] = eventData;
}
return dataObj;
}
return {
kampyleSendCoolaData: kampyleSendCoolaData,
formatData: formatData,
appendDataByEventName: appendDataByEventName,
addEventDataKeys: addEventDataKeys,
rateLimitCounterMap: rateLimitCounterMap,
isEventProvisioned: isEventProvisioned,
isEventDefinedAsRateLimited: isEventDefinedAsRateLimited,
getEventCallsCounter: getEventCallsCounter,
isRateLimitExceeded: isRateLimitExceeded,
increaseEventCallsCounter: increaseEventCallsCounter,
initRateLimiting: initRateLimiting,
init: init,
triggerCooladataEvent: triggerCooladataEvent,
getUserId: getUserId,
triggerCooladataEventDispatcherError: triggerCooladataEventDispatcherError,
};
}
)(window, document);
window.KAMPYLE_COMMON = (function(window, document) {
var screenCaptureTooltipStyles = '[data-tips]{position:relative;text-decoration:none}[data-tips]:after,[data-tips]:before{position:absolute;z-index:100;opacity:0}[data-tips]:after{content:attr(data-tips);line-height:20px;padding:0 10px;font-size:12px;text-align:center;color:#fff;background:#222;border-radius:5px;text-shadow:0 0 5px #000;-moz-box-shadow:0 0 5px rgba(0, 0, 0, .3);-webkit-box-shadow:0 0 5px rgba(0, 0, 0, .3);box-shadow:0 0 5px rgba(0, 0, 0, .3);white-space:normal;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;width:135px;word-wrap:break-word}[data-tips]:before{content:"";width:0;height:0;border-width:6px;border-style:solid}[data-tips]:hover:after,[data-tips]:hover:before{opacity:1}[data-tips].top-tip:after,[data-tips].top-tip:before{-webkit-transition:bottom .25s ease-in-out, opacity .25s ease-in-out;-moz-transition:bottom .25s ease-in-out, opacity .25s ease-in-out;transition:bottom .25s ease-in-out, opacity .25s ease-in-out;bottom:90%;left:-9999px;margin-bottom:12px}[data-tips].top-tip:before{border-color:#222 transparent transparent;margin-bottom:0}[data-tips].top-tip:hover:after,[data-tips].top-tip:hover:before{bottom:100%;left:0}[data-tips].top-tip:hover:before{left:15px}[data-tips].bottom-tip:after,[data-tips].bottom-tip:before{-webkit-transition:top .25s ease-in-out, opacity .25s ease-in-out;-moz-transition:top .25s ease-in-out, opacity .25s ease-in-out;transition:top .25s ease-in-out, opacity .25s ease-in-out;top:90%;left:-9999px;margin-top:12px}[data-tips].bottom-tip:before{border-color:transparent transparent #222;margin-top:0}[data-tips].bottom-tip:hover:after,[data-tips].bottom-tip:hover:before{top:100%;left:0}[data-tips].bottom-tip:hover:before{left:15px}[data-tips].left-tip:after,[data-tips].left-tip:before{-webkit-transition:left .25s ease-in-out, opacity .25s ease-in-out;-moz-transition:left .25s ease-in-out, opacity .25s ease-in-out;transition:left .25s ease-in-out, opacity .25s ease-in-out;top:-9999px;left:96%;margin-left:12px}[data-tips].left-tip:before{border-color:transparent #222 transparent transparent;margin-left:0}[data-tips].left-tip:hover:after,[data-tips].left-tip:hover:before{left:100%;top:0}[data-tips].left-tip:hover:before{top:7px}[data-tips].right-tip:after,[data-tips].right-tip:before{-webkit-transition:right .25s ease-in-out, opacity .25s ease-in-out;-moz-transition:right .25s ease-in-out, opacity .25s ease-in-out;transition:right .25s ease-in-out, opacity .25s ease-in-out;top:-9999px;right:96%;margin-right:12px}[data-tips].right-tip:before{border-color:transparent transparent transparent #222;margin-right:0}[data-tips].right-tip:hover:after,[data-tips].right-tip:hover:before{right:100%;top:0}[data-tips].right-tip:hover:before{top:7px}';
var screenCaptureButtonsOutlineStyle = '.scTitle:focus, .scParagraph:focus, .sc-widget-footer-cancel:focus, .sc-widget-footer-capture:focus, p:focus { border: 2px solid #8e8e93 !important; box-shadow: 0 0 7px #8e8e93 !important;}';
var SCREEN_CAPTURE_DEFAULT_TEXTS = {
submitScreenCaptureLabel: 'Capture Image',
cancelScreenCaptureLabel: 'Cancel',
instructionsScreenCapture: '<h2 class="scTitle" style="font-size: 1.5em;">Screen Capture</h2><p class="scParagraph" style="font-size: 1em; margin-top: 10px;">Drag the cursor around the area you want to highlight.<br>Press Capture Image to take the snapshot and return to your feedback</p>',
submitScreenCaptureTooltip: 'Take snapshot',
cancelScreenCaptureTooltip: 'Back to Feedback',
};
var screenCaptureWidgetTemplate = ['<html>', '<head>', '<link rel="stylesheet" type="text/css" href="' + KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX + KAMPYLE_CONSTANT.SRC.OPEN_SANS + '" />', '<script type="text/javascript">', 'function resizeIframe() {', 'parent.document.getElementById("nebScIframe").height = document.getElementById("sc-widget").scrollHeight + 15;', 'var SCWidget = parent.document.getElementById("nebScIframe");', 'if (SCWidget) {', 'SCWidget.focus();', '}', '}', '</script>', '<style>{tooltipStyles} {buttonsOutlineStyle}</style>', '</head>', '<body onload="resizeIframe();" style="margin:0px;overflow:hidden;">', '<div id="sc-widget" class="sc-widget" style="{widget}">', '<div class="sc-widget-content" style="{widgetContent}">', '{{instructionsScreenCapture}}', '</div>', '<div class="sc-widget-footer" style="{widgetFooter}">', '<button onclick="parent.KAMPYLE_COMMON.cancelScreenCapture();" class="sc-widget-footer-cancel top-tip" ' + 'data-tips="{{cancelScreenCaptureTooltip}}" style="{widgetFooterBtn} {widgetFooterCancel}">', '{{cancelScreenCaptureLabel}}', '</button>', '<button onclick="parent.KAMPYLE_COMMON.screenCaptureClicked();" class="sc-widget-footer-capture top-tip" ' + 'data-tips="{{submitScreenCaptureTooltip}}" style="{widgetFooterBtn} {widgetFooterCapture}">', '<img alt="Loading" src="' + KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX + KAMPYLE_CONSTANT.SRC.KLOADER + '" id="widgetFooterCaptureImg" style="width:20px;height:20px;display: none;" />', '<span id="widgetFooterCaptureText">{{submitScreenCaptureLabel}}</span>', '</button>', '</div>', '</div>', '</body></html>', ].join(' ');
var defaultStyles = {
overlay: {
'position': 'fixed',
'top': '0',
'left': '0',
'z-index': '2147483646 !important',
'right': '0',
'bottom': '0',
'display': 'block',
'pointer-events': 'none'
},
widget: {
'font-family': '\'Open Sans\'',
'border': '1px solid #999',
'width': '285px',
'border-radius': '5px',
'position': 'absolute',
'z-index': '2147483647 !important',
'pointer-events': 'auto',
'background': '#FFFFFF',
'text-align': 'center',
'line-height': '20px'
},
widgetContent: {
'padding': '10px 14px',
'outline': 'none'
},
widgetFooter: {
'font-family': '\'Open Sans\' !important',
'padding': '10px',
'font-size': '14px',
'padding-top': '0',
'font-stretch': 'normal',
'font-style': 'normal',
'font-variant': 'normal',
'font-weight': 'normal',
'letter-spacing': 'normal',
'line-height': '20px'
},
widgetFooterBtn: {
'height': '34px',
'margin': '0 0 2px 5px',
'min-width': '100px',
'padding': '6px 12px',
'display': 'inline-block',
'border-radius': '4px',
'cursor': 'pointer',
'transition-delay': '0s',
'transition-duration': '0.3s',
'transition-property': 'all',
'transition-timing-function': 'ease',
'vertical-align': 'middle',
'white-space': 'nowrap',
'word-spacing': '0px',
'border': 'none',
'color': '#FFF',
},
widgetFooterCancel: {
'background': '#A2A2A2'
},
widgetFooterCapture: {
'margin-left': '5px',
'background': '#020202'
}
};
function overrideDefaultScreenCaptureStyles(customSettings) {
var res = defaultStyles;
if (!!customSettings) {
res.widget.background = !!customSettings.backgroundColor ? customSettings.backgroundColor : res.widget.background;
res.widgetFooterCapture.background = !!customSettings.submitButtoncolor ? customSettings.submitButtoncolor : res.widgetFooterCapture.background;
res.widgetFooterCancel.background = !!customSettings.closeButtoncolor ? customSettings.closeButtoncolor : res.widgetFooterCancel.background;
}
return res;
}
function overrideDefaultScreenCaptureTexts(customSettings) {
var res = SCREEN_CAPTURE_DEFAULT_TEXTS;
if (!!customSettings) {
for (var prop in res) {
if (customSettings.hasOwnProperty(prop) && res.hasOwnProperty(prop)) {
res[prop] = customSettings[prop];
}
}
return res;
}
}
;function loadForm(formId) {
return KAMPYLE_ONSITE_SDK.loadForm(formId);
}
function showForm(formId, options) {
return KAMPYLE_ONSITE_SDK.showForm(formId, options);
}
function closeForm(formId) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_formClosed', {
formId: formId
});
}
function createFormUrl(url, formId) {
url += '?formId=' + formId;
url += '&type=live';
var fullUrl = window.location.href;
var splitted = fullUrl.split('?');
if (splitted && splitted.length) {
fullUrl = splitted[0];
}
url += '&referrer=' + encodeURIComponent(fullUrl);
var region = KAMPYLE_DATA.getMemoryData('region');
if (region) {
url += '&region=' + region;
}
if (KAMPYLE_DATA.isFeatureEnabled('WCAG')) {
url += '&isWCAG=true';
}
url += '&displayType=' + KAMPYLE_DATA.getDisplayType(KAMPYLE_DATA.getFormData(formId));
url += '&isSeparateFormTemplateFromData=true';
return url;
}
function showScreenCaptureSpinner() {
var iframeDocument = document.getElementById('nebScIframe').contentDocument;
var spinner = iframeDocument.getElementById('widgetFooterCaptureImg');
if (!!spinner) {
spinner.style.display = 'inline';
var text = iframeDocument.getElementById('widgetFooterCaptureText');
if (!!text) {
text.style.display = 'none';
}
}
}
;function isScreenCaptureEnabled(formId) {
var browser = KAMPYLE_UTILS.getBrowser();
var formJson = KAMPYLE_DATA.getFormData(formId);
if (!formJson) {
return false;
}
var displayType = KAMPYLE_DATA.getDisplayType(formJson);
return !!browser && (browser.name !== 'MSIE' || Number(browser.version) > 8) && !!displayType && displayType !== 'popup';
}
;function formatScreenCaptureWidget(formData) {
formData = formData || {};
var widgetHtml = screenCaptureWidgetTemplate;
var formattedText = overrideDefaultScreenCaptureTexts(formData.screenCaptureSettings);
if (!formattedText || !formattedText.submitScreenCaptureTooltip) {
widgetHtml = widgetHtml.replace('data-tips="{{submitScreenCaptureTooltip}}"', '');
}
if (!formattedText || !formattedText.cancelScreenCaptureTooltip) {
widgetHtml = widgetHtml.replace('data-tips="{{cancelScreenCaptureTooltip}}"', '');
}
for (var prop in formattedText) {
if (SCREEN_CAPTURE_DEFAULT_TEXTS.hasOwnProperty(prop)) {
widgetHtml = widgetHtml.replace('{{' + prop + '}}', SCREEN_CAPTURE_DEFAULT_TEXTS[prop]);
}
}
var formattedStyles = overrideDefaultScreenCaptureStyles(formData.screenCaptureSettings);
for (var element in formattedStyles) {
widgetHtml = KAMPYLE_UTILS.replaceAll(widgetHtml, '{' + element + '}', KAMPYLE_UTILS.styleObjToInline(defaultStyles[element]));
}
widgetHtml = widgetHtml.replace('{tooltipStyles}', screenCaptureTooltipStyles).replace('{buttonsOutlineStyle}', screenCaptureButtonsOutlineStyle);
return KAMPYLE_UTILS.htmlDecode(widgetHtml);
}
function createScreenCaptureWidget(formdata, scContainer) {
var widgetHtml = formatScreenCaptureWidget(formdata);
var scIframe = document.createElement('iframe');
scIframe.id = 'nebScIframe';
scIframe.style.width = '310px';
scIframe.frameBorder = '0';
scIframe.style.bottom = '20px';
scIframe.style.left = '20px';
scIframe.style.zIndex = 2147483647;
scIframe.style.position = 'fixed';
scIframe.sandbox = 'allow-top-navigation allow-same-origin allow-scripts';
if (scContainer) {
scContainer.parentNode.insertBefore(scIframe, scContainer);
} else {
document.body.appendChild(scIframe);
}
if (scIframe.contentWindow) {
scIframe.contentWindow.contents = widgetHtml;
}
scIframe.src = 'javascript:window["contents"]';
setTimeout(function() {
document.activeElement.blur();
}, 100);
return true;
}
function cancelScreenCapture() {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_cancelCaptureClicked', {
formId: KAMPYLE_DATA.getMemoryData('currentFormId'),
feedbackUUID: KAMPYLE_DATA.getMemoryData('currentFeedbackUuid'),
});
}
function screenCaptureClicked() {
showScreenCaptureSpinner();
}
return {
loadForm: loadForm,
showForm: showForm,
closeForm: closeForm,
createFormUrl: createFormUrl,
createScreenCaptureWidget: createScreenCaptureWidget,
isScreenCaptureEnabled: isScreenCaptureEnabled,
cancelScreenCapture: cancelScreenCapture,
screenCaptureClicked: screenCaptureClicked,
overrideDefaultScreenCaptureStyles: overrideDefaultScreenCaptureStyles,
formatScreenCaptureWidget: formatScreenCaptureWidget,
overrideDefaultScreenCaptureTexts: overrideDefaultScreenCaptureTexts,
};
}
)(window, document);
window.KAMPYLE_THERMO_TEALEAF_FUNC = (function() {
var TEALEAF_COOKIE_SESSION_ID = 'TLTSID';
function isTealeafEnabled() {
return !!KAMPYLE_UTILS.kampyleGetCookie(TEALEAF_COOKIE_SESSION_ID);
}
function getTealeafData() {
if (KAMPYLE_THERMO_TEALEAF_FUNC.isTealeafEnabled()) {
return {
sid: KAMPYLE_UTILS.kampyleGetCookie(TEALEAF_COOKIE_SESSION_ID),
};
}
return null;
}
return {
isTealeafEnabled: isTealeafEnabled,
getTealeafData: getTealeafData,
};
}
)();
window.KAMPYLE_ADOBE_ANALYTICS = (function(window, document) {
var eventQueue = [];
var numAttempts = 0;
var CONFIG = {
POLLING_INTERVAL: 5000,
POLLING_COUNTER: 3
};
var COMMON_FIELDS = {
CONTEXT_NAME: 'NebulaCX_Activity',
};
var events = {
'neb_formShown': {
action: 'form_displayed',
},
'neb_showInvitation': {
action: 'invite_triggered',
},
'neb_inviteDeclined': {
action: 'invite_rejected',
},
'neb_inviteAccepted': {
action: 'invite_accepted',
},
'neb_buttonClicked': {
action: 'button_clicked',
},
'neb_feedbackSubmitted': {
action: 'feedback_submitted',
},
'neb_formClosed': {
action: 'form_close',
},
'neb_formPageShown': {
action: 'form_page_displayed',
},
'neb_captureInit': {
action: 'screen_capture_init',
},
'neb_captureImageClicked': {
action: 'capture_image_click',
},
'neb_cancelCaptureClicked': {
action: 'cancel_capture_click',
},
'MDigital_Form_Close_No_Submit': {
action: 'form_close_no_submit',
},
'MDigital_Form_Next_Page': {
action: 'form_next_page',
},
'MDigital_Form_Back_Page': {
action: 'form_back_page',
},
'MDigital_ThankYou_Displayed': {
action: 'thankyou_displayed',
},
'MDigital_ThankYou_Close': {
action: 'thankyou_close',
},
'MDigital_Form_Close_Submitted': {
action: 'form_close_submit',
},
'neb_sdkShowForm': {
action: 'form_triggered_by_code',
}
};
var adobeSdkName;
var sendAAEvent = function(eventName, data) {
var action = (!!events[eventName] && !!events[eventName].action) ? events[eventName].action : undefined;
var processedData = processDataForAA(data);
if (!!window[adobeSdkName] && !!window[adobeSdkName].tl) {
KAMPYLE_UTILS.setNestedPropertyValue(window, getPropString(adobeSdkName, 'contextData', 'eventName'), action);
var isAdobeLinkTrackVarsProvisionOn = KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ADOBE_INCLUDE_LINK_TRACK_VARS);
if (isAdobeLinkTrackVarsProvisionOn) {
window[adobeSdkName].linkTrackVars = ['contextData.eventName'];
}
for (var key in processedData) {
if (processedData.hasOwnProperty(key) && !KAMPYLE_CONSTANT.ANALYTICS_EVENT_FORBIDDEN_PROPERTIES[key]) {
KAMPYLE_UTILS.setNestedPropertyValue(window, getPropString(adobeSdkName, 'contextData', key), processedData[key]);
if (isAdobeLinkTrackVarsProvisionOn) {
window[adobeSdkName].linkTrackVars.push('contextData.' + key);
}
}
}
if (isAdobeLinkTrackVarsProvisionOn) {
window[adobeSdkName].linkTrackVars = window[adobeSdkName].linkTrackVars.join(',');
}
window[adobeSdkName].tl(this, 'o', COMMON_FIELDS.CONTEXT_NAME);
}
};
function processDataForAA(data) {
var processedData = Object.assign({}, data);
if (Array.isArray(processedData.content)) {
for (var i = 0; i < processedData.content.length; i++) {
processedData[processedData.content[i].unique_name] = processedData.content[i].value;
}
}
return processedData;
}
var dequeueEvents = function(eventName, data) {
if (!window[adobeSdkName] || !window[adobeSdkName].tl) {
numAttempts++;
if (numAttempts < CONFIG.POLLING_COUNTER) {
window.setTimeout(KAMPYLE_ADOBE_ANALYTICS.dequeueEvents, CONFIG.POLLING_INTERVAL);
}
} else {
var queueLen = eventQueue.length;
for (var i = 0; i < queueLen; i++) {
sendAAEvent(eventQueue[i].eventName, eventQueue[i].data);
}
numAttempts = 0;
eventQueue = [];
}
};
var triggerEvent = function(eventName, data) {
eventQueue = eventQueue || [];
if (!!eventName && !!data) {
eventQueue.push({
eventName: eventName,
data: data
});
}
dequeueEvents();
};
function init() {
adobeSdkName = KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ADOBE_ANALYTICS_OBJECT_NAME) ? getAdobeSdkName() : KAMPYLE_CONSTANT.DEFAULT_ADOBE_SDK_NAME;
for (var prop in events) {
KAMPYLE_EVENT_DISPATCHER.subscribe(prop, triggerEvent);
}
return true;
}
;function getAdobeSdkName() {
return KAMPYLE_UTILS.getNestedPropertyValue(KAMPYLE_FUNC.kampyleGetData(), 'adobeSdkName') || KAMPYLE_CONSTANT.DEFAULT_ADOBE_SDK_NAME;
}
function getPropString() {
return Array.prototype.join.call(arguments, '.');
}
return {
init: init,
triggerEvent: triggerEvent,
getAdobeSdkName: getAdobeSdkName,
sendAAEvent: sendAAEvent,
processDataForAA: processDataForAA,
};
}
)(window, document);
window.KAMPYLE_CLICKTALE_FUNC = (function() {
function isClicktaleEnabled() {
return (!!window.ClickTale && !!window.ClickTale.KampyleLink);
}
;function getClicktaleData() {
if (KAMPYLE_CLICKTALE_FUNC.isClicktaleEnabled()) {
if (window.ClickTale.KampyleLink !== 'NOT_RECORDING') {
var clicktaleData = {
recordingUrl: window.ClickTale.KampyleLink
};
return clicktaleData;
}
}
return null;
}
return {
isClicktaleEnabled: isClicktaleEnabled,
getClicktaleData: getClicktaleData
};
}
)();
window.KAMPYLE_SESSIONCAM = {
isSessionCamEnabled: function() {
return (!!window.sessionCamRecorder);
},
getSessionCamData: function() {
if (KAMPYLE_SESSIONCAM.isSessionCamEnabled()) {
var sessionId = window.sessionCamRecorder.sessionId();
if (!!sessionId) {
var sessionCamData = {
recordingUrl: "https://console.sessioncam.com/Console/Recordings/PlaybackSession?sessionId=" + sessionId
};
return sessionCamData;
}
}
return null;
},
sendCustomParam: function(key, value) {
window.sessioncamConfiguration = window.sessioncamConfiguration || {};
window.sessioncamConfiguration.customDataObjects = window.sessioncamConfiguration.customDataObjects || [];
var item = {
key: key,
value: value
};
window.sessioncamConfiguration.customDataObjects.push(item);
},
init: function() {
KAMPYLE_EVENT_DISPATCHER.subscribe("neb_feedbackSubmitted", this.sessionCamFormSubmittedCallback);
},
sessionCamFormSubmittedCallback: function(eventName, oData) {
if (eventName !== 'neb_feedbackSubmitted') {
return;
}
KAMPYLE_SESSIONCAM.sendCustomParam("nebula_feedback_uuid", oData.feedbackUUID);
}
};
window.KAMPYLE_ONSITE_SDK = (function(window, document) {
function loadForm(formId) {
var formState = KAMPYLE_DATA.getFormState(formId);
if (!formState) {
KAMPYLE_UTILS.showWarning('Error fetching data for form id ' + formId);
return false;
}
if (!formState.loaded) {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkLoadForm', {
formId: formId
});
KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm', {
formId: formId
});
}
return true;
}
function showForm(formId, options) {
options = options || {};
var formState = KAMPYLE_DATA.getFormState(formId);
if (!formState) {
KAMPYLE_UTILS.showWarning('Error fetching data for form id ' + formId);
return false;
}
if (KAMPYLE_FUNC.isAnyInviteShown()) {
KAMPYLE_UTILS.showWarning('There is already an invite displayed');
return false;
}
if (KAMPYLE_FUNC.isAnyFormShown()) {
KAMPYLE_UTILS.showWarning('There is already a form displayed');
return false;
}
if (!formState.loaded) {
loadForm(formId);
}
options.triggerType = options.triggerType || 'ByCode';
KAMPYLE_DATA.saveFormExtraData(formId, options);
var extraData = {
formId: formId,
};
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
extraData[prop] = options[prop];
}
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkShowForm', {
formId: formId,
triggerType: options.triggerType
});
return true;
}
function updatePageView() {
KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkPageView');
}
function isSurveyDisplayed() {
if (KAMPYLE_FUNC.isAnyInviteShown() || KAMPYLE_FUNC.isAnyFormShown()) {
return true;
}
KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkSurveyDisplayed');
return false;
}
function startInviteTargeting() {
if (!KAMPYLE_DATA.isFeatureEnabled(KAMPYLE_CONSTANT.PROPERTY_SETTINGS.MANUALLY_INVITE_TARGETING)) {
KAMPYLE_UTILS.showWarning('Manually invite targeting feature is disabled');
return false;
}
KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_MANUALLY_INVITE_TARGETING, {
skipButtonTargeting: true,
skipInviteTargeting: false
});
}
return {
loadForm: loadForm,
showForm: showForm,
updatePageView: updatePageView,
isSurveyDisplayed: isSurveyDisplayed,
startInviteTargeting: startInviteTargeting,
};
}
)(window, document);
window.KAMPYLE_POLYFILLS = (function(window, document) {
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function(searchElement, fromIndex) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (len === 0) {
return false;
}
var n = fromIndex | 0;
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
function sameValueZero(x, y) {
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
}
while (k < len) {
if (sameValueZero(o[k], searchElement)) {
return true;
}
k++;
}
return false;
},
});
}
if (!String.prototype.includes) {
String.prototype.includes = function(search, start) {
'use strict';
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > this.length) {
return false;
} else {
return this.indexOf(search, start) !== -1;
}
}
;
}
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
value: function(search, pos) {
pos = !pos || pos < 0 ? 0 : +pos;
return this.substring(pos, pos + search.length) === search;
}
});
}
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function(predicate) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var thisArg = arguments[1];
var k = 0;
while (k < len) {
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return kValue;
}
k++;
}
return undefined;
},
});
}
if (typeof Object.assign != 'function') {
Object.assign = function(target, varArgs) {
if (target == null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) {
for (var nextKey in nextSource) {
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
}
;
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) {
var k;
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (len === 0) {
return -1;
}
var n = +fromIndex || 0;
if (Math.abs(n) === Infinity) {
n = 0;
}
if (n >= len) {
return -1;
}
k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
while (k < len) {
if (k in o && o[k] === searchElement) {
return k;
}
k++;
}
return -1;
}
;
}
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun) {
'use strict';
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== 'function') {
throw new TypeError();
}
var res = [];
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i];
if (fun.call(thisArg, val, i, t)) {
res.push(val);
}
}
}
return res;
}
;
}
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(callback) {
var T, k;
if (this == null) {
throw new TypeError('this is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
if (arguments.length > 1) {
T = arguments[1];
}
k = 0;
while (k < len) {
var kValue;
if (k in O) {
kValue = O[k];
callback.call(T, kValue, k, O);
}
k++;
}
}
;
}
if (!window.JSON) {
window.JSON = {
parse: function(sJSON) {
return eval('(' + sJSON + ')');
},
stringify: (function() {
var toString = Object.prototype.toString;
var isArray = Array.isArray || function(a) {
return toString.call(a) === '[object Array]';
}
;
var escMap = {
'"': '\\"',
'\\': '\\\\',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t'
};
var escFunc = function(m) {
return escMap[m] || '\\u' + (m.charCodeAt(0) + 0x10000).toString(16).substr(1);
};
var escRE = /[\\"\u0000-\u001F\u2028\u2029]/g;
return function stringify(value) {
if (value == null) {
return 'null';
} else if (typeof value === 'number') {
return isFinite(value) ? value.toString() : 'null';
} else if (typeof value === 'boolean') {
return value.toString();
} else if (typeof value === 'object') {
if (typeof value.toJSON === 'function') {
return stringify(value.toJSON());
} else if (isArray(value)) {
var res = '[';
for (var i = 0; i < value.length; i++)
res += (i ? ', ' : '') + stringify(value[i]);
return res + ']';
} else if (toString.call(value) === '[object Object]') {
var tmp = [];
for (var k in value) {
if (value.hasOwnProperty(k))
tmp.push(stringify(k) + ': ' + stringify(value[k]));
}
return '{' + tmp.join(', ') + '}';
}
}
return '"' + value.toString().replace(escRE, escFunc) + '"';
}
;
}
)(),
};
}
if (!Date.now) {
Date.now = function now() {
return new Date().getTime();
}
;
}
if (typeof Object.assign != 'function') {
(function() {
Object.assign = function(target) {
'use strict';
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
}
;
}
)();
}
if (!Array.prototype.some) {
Array.prototype.some = function(fun) {
'use strict';
if (this == null) {
throw new TypeError('Array.prototype.some called on null or undefined');
}
if (typeof fun !== 'function') {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t && fun.call(thisArg, t[i], i, t)) {
return true;
}
}
return false;
}
;
}
if (!Array.prototype.reduce) {
Object.defineProperty(Array.prototype, 'reduce', {
value: function(callback) {
if (this === null) {
throw new TypeError('Array.prototype.reduce ' + 'called on null or undefined');
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function');
}
var o = Object(this);
var len = o.length >>> 0;
var k = 0;
var value;
if (arguments.length >= 2) {
value = arguments[1];
} else {
while (k < len && !(k in o)) {
k++;
}
if (k >= len) {
throw new TypeError('Reduce of empty array ' + 'with no initial value');
}
value = o[k++];
}
while (k < len) {
if (k in o) {
value = callback(value, o[k], k, o);
}
k++;
}
return value;
}
});
}
(function() {
if (typeof window.CustomEvent === 'function')
return false;
function CustomEvent(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
}
CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent;
}
)();
}
)(window, document);
if (!Array.prototype.findIndex) {
Object.defineProperty(Array.prototype, 'findIndex', {
value: function(predicate) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
var o = Object(this);
var len = o.length >>> 0;
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var thisArg = arguments[1];
var k = 0;
while (k < len) {
var kValue = o[k];
if (predicate.call(thisArg, kValue, k, o)) {
return k;
}
k++;
}
return -1;
},
});
}
if (!Element.prototype.remove) {
Element.prototype.remove = function remove() {
if (this.parentNode) {
this.parentNode.removeChild(this);
}
}
;
}
if (!String.prototype.endsWith) {
String.prototype.endsWith = function(search, this_len) {
if (this_len === undefined || this_len > this.length) {
this_len = this.length;
}
return this.substring(this_len - search.length, this_len) === search;
}
;
}
if (!Array.from) {
Array.from = (function() {
var toStr = Object.prototype.toString;
var isCallable = function(fn) {
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
};
var toInteger = function(value) {
var number = Number(value);
if (isNaN(number)) {
return 0;
}
if (number === 0 || !isFinite(number)) {
return number;
}
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
};
var maxSafeInteger = Math.pow(2, 53) - 1;
var toLength = function(value) {
var len = toInteger(value);
return Math.min(Math.max(len, 0), maxSafeInteger);
};
return function from(arrayLike) {
var C = this;
var items = Object(arrayLike);
if (arrayLike == null) {
throw new TypeError('Array.from requires an array-like object - not null or undefined');
}
var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
var T;
if (typeof mapFn !== 'undefined') {
if (!isCallable(mapFn)) {
throw new TypeError('Array.from: when provided, the second argument must be a function');
}
if (arguments.length > 2) {
T = arguments[2];
}
}
var len = toLength(items.length);
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
var k = 0;
var kValue;
while (k < len) {
kValue = items[k];
if (mapFn) {
A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
} else {
A[k] = kValue;
}
k += 1;
}
A.length = len;
return A;
}
;
}());
}
window.KAMPYLE_INTEGRATION = (function() {
var INTEGRATION_CONTEXT = {
sessionCam: 'sessionCamRecorder',
quantumMetrics: 'QuantumMetricAPI',
};
function getParameterBySource(getParamsBySourceParameters) {
switch (getParamsBySourceParameters.source) {
case 'var':
return KAMPYLE_UTILS.getNestedPropertyValue(window, getParamsBySourceParameters.param);
case 'cookie':
return KAMPYLE_UTILS.kampyleGetCookie(getParamsBySourceParameters.param);
case 'function':
var func = KAMPYLE_UTILS.getNestedPropertyValue(window, getParamsBySourceParameters.param);
if (typeof func === 'function') {
try {
var predefinedArgs = getParamsBySourceParameters.predefinedArgs;
if (predefinedArgs) {
predefinedArgs = predefinedArgs.split(',');
return (predefinedArgs instanceof Array) ? func.apply(getParamsBySourceParameters.context, predefinedArgs) : null;
} else {
return func.apply(getParamsBySourceParameters.context);
}
} catch (e) {
return null;
}
} else {
return null;
}
case 'url':
return KAMPYLE_UTILS.getUrlParam(KAMPYLE_UTILS.getNestedPropertyValue(window, getParamsBySourceParameters.param));
case 'storage':
return localStorage.getItem(KAMPYLE_UTILS.getNestedPropertyValue(window, getParamsBySourceParameters.param));
default:
}
}
function isEnabled(integrationData) {
var isEnabledBol = true;
var valueBySource;
var paramValue;
var isEnabledArray = integrationData.isEnabled;
var contextParam = INTEGRATION_CONTEXT[integrationData.integrationName];
var integrationContext = KAMPYLE_UTILS.getNestedPropertyValue(window, contextParam);
for (var i = 0; i < isEnabledArray.length; i++) {
var isEnabledCurr = false;
var isEnabledCurrName = isEnabledArray[i].param;
paramValue = isEnabledArray[i].paramValue;
if (!isEnabledCurrName) {
KAMPYLE_UTILS.showWarning('no current name found');
}
valueBySource = getParameterBySource({
source: isEnabledArray[i].source,
param: isEnabledCurrName,
context: integrationContext,
predefinedArgs: isEnabledArray[i].predefinedArguments
});
if (paramValue === null) {
isEnabledCurr = (valueBySource !== undefined && valueBySource !== null);
} else {
isEnabledCurr = paramValue === valueBySource;
}
isEnabledBol = isEnabledBol && isEnabledCurr;
}
return isEnabledBol;
}
function prepareIntegrationData(integrationData) {
var parametersJson = {};
var integrationDataJson = {};
var parametersArray = integrationData.parameters || [];
var contextParam = INTEGRATION_CONTEXT[integrationData.integrationName] || null;
var integrationContext = KAMPYLE_UTILS.getNestedPropertyValue(window, contextParam);
for (var i = 0; i < parametersArray.length; i++) {
var paramValue = getParameterBySource({
source: parametersArray[i].source,
param: parametersArray[i].param,
context: integrationContext,
predefinedArgs: parametersArray[i].predefinedArguments
});
var putIn = integrationData.parameters[i].putIn;
KAMPYLE_UTILS.setNestedPropertyValue(parametersJson, putIn, paramValue);
}
integrationDataJson = {
integrationName: integrationData.integrationName,
parameters: parametersJson,
};
return integrationDataJson;
}
function getIntegrationData() {
var integrations = KAMPYLE_DATA.getInegrations() || {};
var integrationData = {};
var currIntegration;
for (var integrationType in integrations) {
if (integrations.hasOwnProperty(integrationType)) {
var currIntegrationType = integrations[integrationType];
for (var i = 0; i < currIntegrationType.length; i++) {
currIntegration = currIntegrationType[i];
if (isEnabled(currIntegration)) {
integrationData[integrationType] = integrationData[integrationType] || [];
integrationData[integrationType].push(prepareIntegrationData(currIntegration));
}
}
}
}
return integrationData;
}
return {
isEnabled: isEnabled,
prepareIntegrationData: prepareIntegrationData,
getParameterBySource: getParameterBySource,
getIntegrationData: getIntegrationData,
};
}
)();
window.MDIGITAL = window.MDIGITAL || {};
window.MDIGITAL.CUSTOM_EVENTS = (function() {
var FORM_ID = 'formId';
var FORM_TRIGGER_TYPE = 'formTriggerType';
var FEEDBACK_UUID = 'feedbackUUID';
var FEEDBACK_CONTENT = 'content';
var IS_PASSED = 'isPassed';
var TARGETING_RULE = 'targetingRule';
var EXPECTED = 'expected';
var ACTUAL = 'actual';
var customEvents = {
MDigital_Form_Close_Submitted: {
customEventId: 'MDigital_Form_Close_Submitted',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
neb_formReady: {
customEventId: 'MDigital_Form_Displayed',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
neb_pageView: {
customEventId: 'MDigital_Page_View',
payload: [],
},
MDigital_Form_Next_Page: {
customEventId: 'MDigital_Form_Next_Page',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
MDigital_Form_Back_Page: {
customEventId: 'MDigital_Form_Back_Page',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
MDigital_Form_Close_No_Submit: {
customEventId: 'MDigital_Form_Close_No_Submit',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
MDigital_ThankYou_Displayed: {
customEventId: 'MDigital_ThankYou_Displayed',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
MDigital_ThankYou_Close: {
customEventId: 'MDigital_ThankYou_Close',
payload: [FORM_ID, FORM_TRIGGER_TYPE, FEEDBACK_UUID]
},
neb_feedbackSubmitted: {
customEventId: 'MDigital_Submit_Feedback',
payload: [FORM_ID, FORM_TRIGGER_TYPE, FEEDBACK_UUID].concat(KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.EVENT_INCLUDE_FEEDBACK_CONTENT) ? FEEDBACK_CONTENT : [])
},
neb_inviteAccepted: {
customEventId: 'MDigital_Invite_Accepted',
payload: [FORM_ID]
},
neb_showInvitation: {
customEventId: 'MDigital_Invite_Displayed',
payload: [FORM_ID]
},
neb_inviteDeclined: {
customEventId: 'MDigital_Invite_Declined',
payload: [FORM_ID]
},
neb_skipInvitation: {
customEventId: 'MDigital_invite_Skipped',
payload: [FORM_ID]
},
neb_buttonClicked: {
customEventId: 'MDigital_Feedback_Button_Clicked',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
neb_captureInit: {
customEventId: 'MDigital_CaptureButton_Clicked',
payload: [FORM_ID, FORM_TRIGGER_TYPE, FEEDBACK_UUID]
},
neb_captureImageClicked: {
customEventId: 'MDigital_CaptureButton_Taken',
payload: [FORM_ID, FORM_TRIGGER_TYPE, FEEDBACK_UUID]
},
neb_cancelCaptureClicked: {
customEventId: 'MDigital_CaptureButton_Cancel',
payload: [FORM_ID, FORM_TRIGGER_TYPE, FEEDBACK_UUID]
},
neb_sdkShowForm: {
customEventId: 'MDigital_ShowForm_Called',
payload: [FORM_ID, FORM_TRIGGER_TYPE]
},
MDigital_targetingRuleEvaluated: {
customEventId: 'MDigital_targetingRuleEvaluated',
payload: [FORM_ID, IS_PASSED, TARGETING_RULE, EXPECTED, ACTUAL, FORM_TRIGGER_TYPE],
},
};
var dataToSendMapping = {
formId: {
exposedProperty: KAMPYLE_CONSTANT.EXPOSED_FORM_ID_LABEL,
manipulateValueMethod: null
},
formTriggerType: {
exposedProperty: KAMPYLE_CONSTANT.EXPOSED_FORM_TYPE_LABEL,
manipulateValueMethod: manipulateTriggerTypeValue
},
feedbackUUID: {
exposedProperty: KAMPYLE_CONSTANT.EXPOSED_FEEDBACK_UUID_LABEL,
manipulateValueMethod: null
},
content: {
exposedProperty: KAMPYLE_CONSTANT.EXPOSED_FEEDBACK_CONTENT_LABEL,
manipulateValueMethod: null,
}
}
function init() {
try {
KAMPYLE_UTILS.initEventSubscriptions(customEvents, triggerCustomEvent);
return true;
} catch (e) {
console.warn(e);
}
}
function formatData(eventName, eventDispatcherData) {
if (!eventName || !eventDispatcherData) {
return null;
}
for (var eventProp in customEvents[eventName]) {
if (customEvents[eventName].hasOwnProperty(eventProp)) {
eventDispatcherData[eventProp] = customEvents[eventName][eventProp];
}
}
eventDispatcherData.eventName = eventName;
eventDispatcherData.formTriggerType = KAMPYLE_DATA.getFormTriggerType(eventDispatcherData.formId);
return eventDispatcherData;
}
function triggerCustomEvent(eventName, eventDispatcherData) {
var eventDispatcherDataFormatted = formatData(eventName, eventDispatcherData);
var customEventData = getCustomEventDataToSend(eventDispatcherDataFormatted);
if (customEventData) {
KAMPYLE_UTILS.triggerCustomEvent(eventDispatcherDataFormatted.customEventId, customEventData);
}
}
;function getCustomEventDataToSend(eventDispatcherDataFormatted) {
var dataToSend = {};
if (!eventDispatcherDataFormatted || !eventDispatcherDataFormatted.payload) {
return null;
}
for (var i = 0; i < eventDispatcherDataFormatted.payload.length; i++) {
var payloadProperty = eventDispatcherDataFormatted.payload[i];
var payloadValue = KAMPYLE_UTILS.getNestedPropertyValue(eventDispatcherDataFormatted, payloadProperty);
var mappingObject;
if (payloadValue !== undefined && payloadValue !== null) {
mappingObject = dataToSendMapping[payloadProperty];
if (mappingObject && mappingObject.exposedProperty) {
dataToSend[mappingObject.exposedProperty] = mappingObject.manipulateValueMethod ? mappingObject.manipulateValueMethod.apply(this, [payloadValue]) : payloadValue;
} else {
dataToSend[payloadProperty] = payloadValue;
}
} else {
dataToSend = null;
break;
}
}
return dataToSend;
}
function manipulateTriggerTypeValue(formTriggerType) {
return KAMPYLE_CONSTANT.FORM_TRIGGER_TYPES_MAP[formTriggerType] || KAMPYLE_CONSTANT.CUSTOM_EVENT_OTHER;
}
return {
init: init,
triggerCustomEvent: triggerCustomEvent,
getCustomEventDataToSend: getCustomEventDataToSend,
};
}
)();
window.MDIGITAL = window.MDIGITAL || {};
window.MDIGITAL.CUSTOM_PARAMETERS = (function(window, document) {
function getCustomParamValue(customParam) {
if (!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CP_EXT_REFACTOR)) {
return KAMPYLE_FUNC.getSafeCustomParamVal(customParam)
}
var cp = customParam || {};
var extractedValue = MDIGITAL.CUSTOM_PARAMETERS.extractCPValue(cp);
return MDIGITAL.CUSTOM_PARAMETERS.castCPValue(extractedValue, cp.type || '');
}
function formatCustomParams(formId) {
var customParams = MDIGITAL.CUSTOM_PARAMETERS.getFormCustomParams(formId) || [];
return customParams.map(MDIGITAL.CUSTOM_PARAMETERS.appendValueToCPObject);
}
function getFormCustomParams(formId) {
var formData = KAMPYLE_DATA.getFormData(formId) || {};
return formData.customParams || null;
}
function hasCustomParams(formId) {
var formData = KAMPYLE_DATA.getFormData(formId);
return !!formData && !!formData.customParams && !!formData.customParams.length;
}
function getCustomParamValueById(id, formData) {
var customParam = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamById(id, formData) || {};
return MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue(customParam);
}
function getCustomParamValueByUniqueName(uniqueName) {
var customParam = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamByUniqueName(uniqueName) || {};
return MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue(customParam);
}
function getCustomParamById(fieldId, formData) {
if (fieldId !== undefined && formData && formData.customParams && formData.customParams.length) {
return formData.customParams.find(function(cp) {
return cp.id == fieldId;
}) || null;
} else {
return null;
}
}
function getCustomParamByUniqueName(uniqueName) {
var customParams = KAMPYLE_DATA.getCustomParams() || [];
return customParams.find(function(cp) {
return cp.unique_name === uniqueName;
});
}
function extractCPValue(cp) {
var value = cp.value;
var source = (cp.source || 'var').toLowerCase();
var name = cp.name || cp.source_name || '';
if (value === undefined) {
switch (source) {
case 'var':
value = KAMPYLE_UTILS.getNestedPropertyValue(window, name);
break;
case 'url':
value = KAMPYLE_UTILS.getUrlParam(name);
break;
case 'cookie':
value = KAMPYLE_UTILS.getCookie(name);
break;
default:
value = null;
break;
}
}
return value !== '' ? value : null;
}
function castCPValue(value, type) {
if (value === null) {
return value;
}
switch (type.toLowerCase()) {
case 'datetime':
return MDIGITAL.CUSTOM_PARAMETERS.handleDatetimeCasting(value);
case 'number':
return KAMPYLE_UTILS.getNumericValue(value)
case 'text':
return MDIGITAL.CUSTOM_PARAMETERS.handleTextCasting(value);
case 'boolean':
return MDIGITAL.CUSTOM_PARAMETERS.handleBooleanCasting(value);
default:
console.error('Invalid custom parameter type ' + type);
return null;
}
}
function handleDatetimeCasting(value) {
if (typeof value === 'string') {
return Number(value) || null;
} else if (!(value instanceof Date) && (!(value || {}).getTime || isNaN(value.getTime()))) {
return null;
} else {
return value.getTime();
}
}
function handleTextCasting(value) {
return (typeof value === 'string') ? value : null;
}
function handleBooleanCasting(value) {
if (value === 'true') {
return true;
} else if (value === 'false') {
return false
}
return (typeof value === 'boolean') ? value : null;
}
function appendValueToCPObject(cp) {
cp = cp || {};
var cpValue = MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue({
name: cp.source_name,
type: cp.type,
source: cp.source,
});
return Object.assign(cp, {
value: cpValue
});
}
return {
getCustomParamValue: getCustomParamValue,
getCustomParamValueById: getCustomParamValueById,
getCustomParamValueByUniqueName: getCustomParamValueByUniqueName,
formatCustomParams: formatCustomParams,
getFormCustomParams: getFormCustomParams,
hasCustomParams: hasCustomParams,
getCustomParamById: getCustomParamById,
getCustomParamByUniqueName: getCustomParamByUniqueName,
extractCPValue: extractCPValue,
castCPValue: castCPValue,
handleDatetimeCasting: handleDatetimeCasting,
handleTextCasting: handleTextCasting,
handleBooleanCasting: handleBooleanCasting,
appendValueToCPObject: appendValueToCPObject,
};
}
)(window, document);
KAMPYLE_FUNC.init();
KAMPYLE_FUNC.startCheckingTargeting();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment