[json] s

Viewer

  1. javascript:;
  2. (function(window){window.MDIGITAL=window.MDIGITAL||{};window.MDIGITAL.version='2.32.0';})(window);window.KAMPYLE_CONSTANT={SVGS:{NO_DATA_MODAL_IMG:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="450" height="278.118" viewBox="0 0 450 278.118"> <defs> <radialGradient id="radial-gradient" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#c7c7c8" stop-opacity="0.71"/> <stop offset="1" stop-color="#ddddde" stop-opacity="0"/> </radialGradient> <linearGradient id="linear-gradient" x1="0.747" y1="0.203" x2="0" y2="0.393" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#dbe4f1" stop-opacity="0"/> <stop offset="1" stop-color="#c7c7c8" stop-opacity="0.518"/> </linearGradient> <linearGradient id="linear-gradient-2" x1="0.521" y1="0.272" x2="1" y2="0.393" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#dbe4f1" stop-opacity="0"/> <stop offset="1" stop-color="#c7c7c8" stop-opacity="0.482"/> </linearGradient> <radialGradient id="radial-gradient-2" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#727272"/> <stop offset="1" stop-color="#cbd9ee" stop-opacity="0"/> </radialGradient> </defs> <g id="illustration" transform="translate(0 0.118)"> <ellipse id="Ellipse_57" data-name="Ellipse 57" cx="63" cy="8" rx="63" ry="8" transform="translate(158 262)" opacity="0.576" fill="url(#radial-gradient)"/> <g id="Group_6" data-name="Group 6" transform="translate(4 1)"> <g id="Group_4" data-name="Group 4" transform="translate(4 33)"> <path id="Path_383" data-name="Path 383" d="M2639.414-199.864l0,231.392L2865,75.031l-20.3-274.777Z" transform="translate(-2423 165.746)" opacity="0.9" fill="url(#linear-gradient)"/> <path id="Path_384" data-name="Path 384" d="M2863.758-199.746V31.526l-176.474,25.2L2639.34-199.746Z" transform="translate(-2647.34 165.746)" opacity="0.855" fill="url(#linear-gradient-2)"/> </g> <g id="Group_1" data-name="Group 1" transform="translate(-1463 535.503)"> <path id="Path_379" data-name="Path 379" d="M5.835,10.273,79.907,0a3.054,3.054,0,0,1,3.054,3.054L81.715,111.191c.063,2.486-2.975,6.563-5.475,6.741L3.054,124.1A3.054,3.054,0,0,1,0,121.046L2.781,13.328A3.054,3.054,0,0,1,5.835,10.273Z" transform="translate(1706.488 -454.452) rotate(48)"/> <path id="Path_375" data-name="Path 375" d="M5.835,10.273,79.907,0a3.054,3.054,0,0,1,3.054,3.054L81.455,111.911a6.165,6.165,0,0,1-6.024,5.684L3.054,124.1A3.054,3.054,0,0,1,0,121.046L2.781,13.328A3.054,3.054,0,0,1,5.835,10.273Z" transform="translate(1706.488 -456.743) rotate(48)" fill="#0a203b"/> <path id="Path_377" data-name="Path 377" d="M2076.8-429.738l-75.839,64.658,49,44.591,78.639-64.87Z" transform="translate(-376.238 -8.675)" fill="#c7c7c8"/> <path id="Path_378" data-name="Path 378" d="M2076.7-430.081l-75.638,64.93s15.716,16.233,28.546,23.725,29.693,9.832,46.565-.884,51.869-42.744,51.869-42.744Z" transform="translate(-376.262 -10.884)" fill="#fff"/> <path id="Path_376" data-name="Path 376" d="M3.054,4.947,37.394,0a3.054,3.054,0,0,1,3.054,3.054L40.187,14.4a3.054,3.054,0,0,1-3.054,3.054L3.3,21.832A3.054,3.054,0,0,1,.249,18.778L0,8A3.054,3.054,0,0,1,3.054,4.947Z" transform="translate(1721.953 -441.186) rotate(48)" fill="#0a203b"/> <path id="Path_380" data-name="Path 380" d="M3.054,4.947,37.394,0a3.054,3.054,0,0,1,3.054,3.054L40.187,14.4a3.054,3.054,0,0,1-3.054,3.054L3.3,21.832A3.054,3.054,0,0,1,.249,18.778L0,8A3.054,3.054,0,0,1,3.054,4.947Z" transform="translate(1721.953 -441.949) rotate(48)" fill="#0a203b"/> </g> <g id="Group_5" data-name="Group 5" transform="translate(-10 -14)"> <path id="Path_381" data-name="Path 381" d="M2592.494,263.491s9.979-1.826,24.476-6.086,20.113-11.228,20.113-11.228a133.644,133.644,0,0,0,20.467,18.252c11.729,8.324,26.451,15.046,26.451,15.046s-.792,6.831-30.43,9.428S2592.494,263.491,2592.494,263.491Z" transform="translate(-2483 -186.904)" fill="#fff"/> <path id="Path_382" data-name="Path 382" d="M2616.774,289.346s10.217,2.575,18.2,1.853a31.263,31.263,0,0,0,13.747-4.739s6.545,6.793,14.2,10.529a51.819,51.819,0,0,0,16.428,4.415,107.79,107.79,0,0,1-30.106,1.766C2633.395,301.7,2616.774,289.346,2616.774,289.346Z" transform="translate(-2491.962 -201.772)" fill="#ddddde"/> </g> <g id="Group_3" data-name="Group 3" transform="translate(312.821 125.927) rotate(-8)"> <path id="Path_385" data-name="Path 385" d="M2662.33,259.391a94.073,94.073,0,0,1-18.68-4.645,69.8,69.8,0,0,1-15.35-8.569,101.988,101.988,0,0,1-15.62,13.929,143.873,143.873,0,0,1-20.187,11.483s.6,5.213,23.224,7.2S2662.33,259.391,2662.33,259.391Z" transform="translate(-2592.493 -246.177)" fill="#fff"/> <path id="Path_386" data-name="Path 386" d="M2664.76,288.863a19.6,19.6,0,0,1-13.662,1.214c-8.043-2.008-10.491-3.617-10.491-3.617s-4.869,6.187-10.839,8.036-12.511,3.081-12.511,3.081,9.582,3.4,22.95,1.636S2664.76,288.863,2664.76,288.863Z" transform="translate(-2606.846 -267.064)" fill="#dcdcdd" opacity="0.675"/> </g> </g> <path id="Path_389" data-name="Path 389" d="M40.337,0C62.614,0,80.673,2.462,80.673,5.5S62.614,11,40.337,11,0,8.538,0,5.5,18.059,0,40.337,0Z" transform="translate(261 253)" opacity="0.15" fill="url(#radial-gradient-2)"/> <g id="Symbol_7_3" data-name="Symbol 7 â€“ 3" transform="matrix(0.839, 0.545, -0.545, 0.839, 296.825, 161.227)"> <rect id="Rectangle_786" data-name="Rectangle 786" width="9.48" height="49.43" transform="translate(43.68 17.037) rotate(45)" fill="#b7b7b7"/> <rect id="Rectangle_787" data-name="Rectangle 787" width="6.771" height="49.43" transform="translate(44.159 17.516) rotate(45)" fill="#c7c7c8"/> <rect id="Rectangle_788" data-name="Rectangle 788" width="2.708" height="49.43" transform="translate(43.68 17.037) rotate(45)" fill="#dcdcdd"/> <path id="Path_373" data-name="Path 373" d="M3.909,0H5.555L9.48,6.094H0Z" transform="translate(47.989 12.728) rotate(45)" fill="#e7e7e8"/> <path id="Path_374" data-name="Path 374" d="M.849,0l.858,1.535H0Z" transform="translate(51.833 14.401) rotate(45)" fill="#4d4d4d"/> </g> <g id="Group_7" data-name="Group 7" transform="translate(310.701 92.66) rotate(87)"> <rect id="Rectangle_790" data-name="Rectangle 790" width="21.145" height="2.917" rx="1.458" transform="translate(37 75.614)" fill="#ff6f6f"/> <rect id="Rectangle_791" data-name="Rectangle 791" width="21.145" height="2.917" rx="1.458" transform="translate(49.031 66.5) rotate(90)" fill="#ff6f6f"/> </g> </g> </svg>',CLOSE_NO_DATA_MODAL_BTN:'<svg id="close-no-json-modal" data-aut="no-json-modal-close-button" style="cursor:pointer; position:absolute; top:14px; right:14px;" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 13.998"><defs><style>.a{fill:rgba(0,0,0,0.36);}</style></defs><path class="a" d="M1421.292,5992.4l-4.9,4.9-2.1-2.1,4.9-4.9-4.9-4.9,2.1-2.1,4.9,4.9,4.9-4.9,2.1,2.1-4.9,4.9,4.9,4.9-2.1,2.1Z" transform="translate(-1414.292 -5983.293)"/></svg>',CLOSE_NO_DATA_MODAL_BTN_INNER_HTML:'<defs></defs><path class="a" d="M1421.292,5992.4l-4.9,4.9-2.1-2.1,4.9-4.9-4.9-4.9,2.1-2.1,4.9,4.9,4.9-4.9,2.1,2.1-4.9,4.9,4.9,4.9-2.1,2.1Z" transform="translate(-1414.292 -5983.293)"/>',NO_DATA_MODAL_IMG_INNER_HTML:'<defs> <radialGradient id="radial-gradient" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#c7c7c8" stop-opacity="0.71"/> <stop offset="1" stop-color="#ddddde" stop-opacity="0"/> </radialGradient> <linearGradient id="linear-gradient" x1="0.747" y1="0.203" x2="0" y2="0.393" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#dbe4f1" stop-opacity="0"/> <stop offset="1" stop-color="#c7c7c8" stop-opacity="0.518"/> </linearGradient> <linearGradient id="linear-gradient-2" x1="0.521" y1="0.272" x2="1" y2="0.393" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#dbe4f1" stop-opacity="0"/> <stop offset="1" stop-color="#c7c7c8" stop-opacity="0.482"/> </linearGradient> <radialGradient id="radial-gradient-2" cx="0.5" cy="0.5" r="0.5" gradientUnits="objectBoundingBox"> <stop offset="0" stop-color="#727272"/> <stop offset="1" stop-color="#cbd9ee" stop-opacity="0"/> </radialGradient> </defs> <g id="illustration" transform="translate(0 0.118)"> <ellipse id="Ellipse_57" data-name="Ellipse 57" cx="63" cy="8" rx="63" ry="8" transform="translate(158 262)" opacity="0.576" fill="url(#radial-gradient)"/> <g id="Group_6" data-name="Group 6" transform="translate(4 1)"> <g id="Group_4" data-name="Group 4" transform="translate(4 33)"> <path id="Path_383" data-name="Path 383" d="M2639.414-199.864l0,231.392L2865,75.031l-20.3-274.777Z" transform="translate(-2423 165.746)" opacity="0.9" fill="url(#linear-gradient)"/> <path id="Path_384" data-name="Path 384" d="M2863.758-199.746V31.526l-176.474,25.2L2639.34-199.746Z" transform="translate(-2647.34 165.746)" opacity="0.855" fill="url(#linear-gradient-2)"/> </g> <g id="Group_1" data-name="Group 1" transform="translate(-1463 535.503)"> <path id="Path_379" data-name="Path 379" d="M5.835,10.273,79.907,0a3.054,3.054,0,0,1,3.054,3.054L81.715,111.191c.063,2.486-2.975,6.563-5.475,6.741L3.054,124.1A3.054,3.054,0,0,1,0,121.046L2.781,13.328A3.054,3.054,0,0,1,5.835,10.273Z" transform="translate(1706.488 -454.452) rotate(48)"/> <path id="Path_375" data-name="Path 375" d="M5.835,10.273,79.907,0a3.054,3.054,0,0,1,3.054,3.054L81.455,111.911a6.165,6.165,0,0,1-6.024,5.684L3.054,124.1A3.054,3.054,0,0,1,0,121.046L2.781,13.328A3.054,3.054,0,0,1,5.835,10.273Z" transform="translate(1706.488 -456.743) rotate(48)" fill="#0a203b"/> <path id="Path_377" data-name="Path 377" d="M2076.8-429.738l-75.839,64.658,49,44.591,78.639-64.87Z" transform="translate(-376.238 -8.675)" fill="#c7c7c8"/> <path id="Path_378" data-name="Path 378" d="M2076.7-430.081l-75.638,64.93s15.716,16.233,28.546,23.725,29.693,9.832,46.565-.884,51.869-42.744,51.869-42.744Z" transform="translate(-376.262 -10.884)" fill="#fff"/> <path id="Path_376" data-name="Path 376" d="M3.054,4.947,37.394,0a3.054,3.054,0,0,1,3.054,3.054L40.187,14.4a3.054,3.054,0,0,1-3.054,3.054L3.3,21.832A3.054,3.054,0,0,1,.249,18.778L0,8A3.054,3.054,0,0,1,3.054,4.947Z" transform="translate(1721.953 -441.186) rotate(48)" fill="#0a203b"/> <path id="Path_380" data-name="Path 380" d="M3.054,4.947,37.394,0a3.054,3.054,0,0,1,3.054,3.054L40.187,14.4a3.054,3.054,0,0,1-3.054,3.054L3.3,21.832A3.054,3.054,0,0,1,.249,18.778L0,8A3.054,3.054,0,0,1,3.054,4.947Z" transform="translate(1721.953 -441.949) rotate(48)" fill="#0a203b"/> </g> <g id="Group_5" data-name="Group 5" transform="translate(-10 -14)"> <path id="Path_381" data-name="Path 381" d="M2592.494,263.491s9.979-1.826,24.476-6.086,20.113-11.228,20.113-11.228a133.644,133.644,0,0,0,20.467,18.252c11.729,8.324,26.451,15.046,26.451,15.046s-.792,6.831-30.43,9.428S2592.494,263.491,2592.494,263.491Z" transform="translate(-2483 -186.904)" fill="#fff"/> <path id="Path_382" data-name="Path 382" d="M2616.774,289.346s10.217,2.575,18.2,1.853a31.263,31.263,0,0,0,13.747-4.739s6.545,6.793,14.2,10.529a51.819,51.819,0,0,0,16.428,4.415,107.79,107.79,0,0,1-30.106,1.766C2633.395,301.7,2616.774,289.346,2616.774,289.346Z" transform="translate(-2491.962 -201.772)" fill="#ddddde"/> </g> <g id="Group_3" data-name="Group 3" transform="translate(312.821 125.927) rotate(-8)"> <path id="Path_385" data-name="Path 385" d="M2662.33,259.391a94.073,94.073,0,0,1-18.68-4.645,69.8,69.8,0,0,1-15.35-8.569,101.988,101.988,0,0,1-15.62,13.929,143.873,143.873,0,0,1-20.187,11.483s.6,5.213,23.224,7.2S2662.33,259.391,2662.33,259.391Z" transform="translate(-2592.493 -246.177)" fill="#fff"/> <path id="Path_386" data-name="Path 386" d="M2664.76,288.863a19.6,19.6,0,0,1-13.662,1.214c-8.043-2.008-10.491-3.617-10.491-3.617s-4.869,6.187-10.839,8.036-12.511,3.081-12.511,3.081,9.582,3.4,22.95,1.636S2664.76,288.863,2664.76,288.863Z" transform="translate(-2606.846 -267.064)" fill="#dcdcdd" opacity="0.675"/> </g> </g> <path id="Path_389" data-name="Path 389" d="M40.337,0C62.614,0,80.673,2.462,80.673,5.5S62.614,11,40.337,11,0,8.538,0,5.5,18.059,0,40.337,0Z" transform="translate(261 253)" opacity="0.15" fill="url(#radial-gradient-2)"/> <g id="Symbol_7_3" data-name="Symbol 7 â€“ 3" transform="matrix(0.839, 0.545, -0.545, 0.839, 296.825, 161.227)"> <rect id="Rectangle_786" data-name="Rectangle 786" width="9.48" height="49.43" transform="translate(43.68 17.037) rotate(45)" fill="#b7b7b7"/> <rect id="Rectangle_787" data-name="Rectangle 787" width="6.771" height="49.43" transform="translate(44.159 17.516) rotate(45)" fill="#c7c7c8"/> <rect id="Rectangle_788" data-name="Rectangle 788" width="2.708" height="49.43" transform="translate(43.68 17.037) rotate(45)" fill="#dcdcdd"/> <path id="Path_373" data-name="Path 373" d="M3.909,0H5.555L9.48,6.094H0Z" transform="translate(47.989 12.728) rotate(45)" fill="#e7e7e8"/> <path id="Path_374" data-name="Path 374" d="M.849,0l.858,1.535H0Z" transform="translate(51.833 14.401) rotate(45)" fill="#4d4d4d"/> </g> <g id="Group_7" data-name="Group 7" transform="translate(310.701 92.66) rotate(87)"> <rect id="Rectangle_790" data-name="Rectangle 790" width="21.145" height="2.917" rx="1.458" transform="translate(37 75.614)" fill="#ff6f6f"/> <rect id="Rectangle_791" data-name="Rectangle 791" width="21.145" height="2.917" rx="1.458" transform="translate(49.031 66.5) rotate(90)" fill="#ff6f6f"/> </g> </g> '},PLACEHOLDERS:{URL_PREFIX:'https://resources.digital-cloud-gov.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/',USERSNAP_V4_HOST_PREFIX:'//scp.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'},FEATURE_FLAGS:{WCAG:'WCAG'},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',ADOBE_CONCAT_LINK_TRACK_VARS:'adobeConcatLinkTrackVars',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',COOLADATA_SUBMITTED_BY_XHR:'cooladataSubmittedByXhr',DO_NOT_SURVEY_ON_UBT_NETWORK_FAIL:'doNotSurveyOnUBTNetworkFail',USER_SNAP_V4:'userSnapV4',CSP_RULES:'CSPRemoveInlineStyling',CREATE_SESSION:'cooladataCreateSessionEvent',},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',MDIGITAL_WARNING:'MDigital_warning',MDIGITAL_COULD_NOT_FETCH_DATA:'Mdigital_couldNotFetchData',NEB_EVENT_DISPATCHER_ERROR:'neb_eventDispatcherError',NEB_LOAD_FORM:'neb_loadForm',NEB_FORM_LOADING_HAS_FAILED:'neb_formLoadingHasFailed',CREATE_SESSION:'createSession',},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',FETCHING_DATA_IN_PROGRESS:'FETCHING_DATA_IN_PROGRESS_'},CSS_FONT_RULE:'CSSFontFaceRule',NETWORK:{RETRY_TIMEOUT:1000,REQUEST_TIMEOUT:2000,TIME_FOR_FORM_TO_LOAD_MS:60000,NUM_OF_RETRIES:3},ERROR_CODE:{SECURITY_ERROR:18},BROWSERS:{IE:'IE',CHROME:'Chrome'},URLS:{KMA_UDC:'https://nginx-log-post.kampyle.com/?data='},TEXTS:{SCREEN_CAPTURE:{DEFAULT_DESCRIPTION:'Click "Capture Image" button or drag the cursor to highlight a specific area'}}};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;}}}
  3. 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);}
  4. 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)){}
  5. KAMPYLE_SESSIONCAM.init();MDIGITAL.CUSTOM_EVENTS.init();createSession();subscribeToPageEvents();subscribeToCustomEvents();KAMPYLE_UTILS.setEventHandler(window,'hashchange',handleHashChanged);KAMPYLE_UTILS.triggerCustomEvent('neb_OnsiteLoaded');}
  6. 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;}
  7. if(!currForm.formWidth||currForm.formWidth==='null'){currForm.formWidth=KAMPYLE_CONSTANT.FORM_WIDTH;}}
  8. return formsObj;}
  9. 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);}
  10. 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});}}
  11. function loadMultipileForms(eventName,data){var formIds=(data||{}).formIds||[];formIds.forEach(function(fid){KAMPYLE_COMMON.loadForm(fid);});}
  12. function routeToForm(eventName,data){data=data||{};KAMPYLE_COMMON.closeForm(data.sourceFormId);if(!KAMPYLE_COMMON.showForm(data.formId)){throw new Error('Form cannot be loaded');}}
  13. function focusOnInviteIframe(){var iframe=document.querySelector('#kampyleInvite');if(iframe&&typeof iframe.focus==='function'){iframe.focus();}}
  14. function handleInviteApplicationUpdated(eventName,data){data=data||{};var shouldShowInvite=(KAMPYLE_DATA.getFormState(data.formId)||{}).inviteShown;if(shouldShowInvite&&MDIGITAL.FORM_STATE.isInviteLoaded(data.formId)&&isJsonDataLoaded(data.formId,true)&&!isAnyOtherFormAlreadyShown()){KAMPYLE_VIEW.showInvite("",{formId:data.formId});KAMPYLE_EVENT_DISPATCHER.trigger('neb_inviteReady',data);KAMPYLE_DATA.setMemoryData('inviteLoadedAndShown',true);}
  15. else if(hasApplicationLoadingFailed(data.formId,true)||isAnyOtherFormAlreadyShown()){KAMPYLE_DATA.setFormState(data.formId,{inviteShown:false});}}
  16. function subscribeToCustomEvents(){var eventMapping={neb_inviteDeclined:['neb_displayClosed'],neb_formClosed:['neb_displayClosed'],};KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);}
  17. function isFormAlreadyShown(formId){var shouldSkipShowingForm=KAMPYLE_DATA.isSkipInvitation(formId)&&isAnyOtherFormAlreadyShown(formId);if(shouldSkipShowingForm){KAMPYLE_EVENT_DISPATCHER.trigger('neb_formReady',{formId:formId});KAMPYLE_DATA.setFormState(formId,{shouldBeShown:false});KAMPYLE_EVENT_DISPATCHER.trigger('neb_skipShowingForm',{formId:formId});}
  18. return shouldSkipShowingForm;}
  19. function hasApplicationLoadingFailed(formId,isInvite){var jsonDataKey=(isInvite?KAMPYLE_CONSTANT.INVITE_JSON_DATA_KEY_PREFIX:KAMPYLE_CONSTANT.FORM_JSON_DATA_KEY_PREFIX)+formId;var currentMemoryData=KAMPYLE_DATA.getMemoryData(jsonDataKey);var formState=KAMPYLE_DATA.getFormState(formId);return currentMemoryData===false||(!isInvite&&formState&&formState.loaded===false)||(isInvite&&formState&&formState.inviteLoaded===false);}
  20. function isJsonDataLoaded(formId,isInvite){var jsonDataKey=(isInvite?KAMPYLE_CONSTANT.INVITE_JSON_DATA_KEY_PREFIX:KAMPYLE_CONSTANT.FORM_JSON_DATA_KEY_PREFIX)+formId;return!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION)||KAMPYLE_DATA.getMemoryData(jsonDataKey);}
  21. function shouldSkipFetchingFormData(formId,isInvite){var isFetchingDataInProgress=KAMPYLE_DATA.getMemoryData(KAMPYLE_CONSTANT.MEMORY_DATA_FIELDS.FETCHING_DATA_IN_PROGRESS+formId);return!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.FORM_TEMPLATE_DATA_SEPERATION)||hasApplicationLoadingFailed(formId,isInvite)||isJsonDataLoaded(formId,false)||isFetchingDataInProgress;}
  22. function handleFormLoadingFailed(eventName,data){setTimeout(function(){KAMPYLE_DATA.setFormState(data.formId,{shouldBeShown:false,loaded:false});},0);}
  23. function isFormLoaded(formId){var formData=KAMPYLE_DATA.getFormData(formId);var displayType=KAMPYLE_DATA.getDisplayType(formData);return MDIGITAL.FORM_STATE.isFormLoaded(formId)||displayType===KAMPYLE_CONSTANT.DISPLAY_TYPES.POPUP;}
  24. function prepareJsonData(eventName,data){var isInvite=eventName==='neb_loadInvitation';if(KAMPYLE_FUNC.shouldSkipFetchingFormData(data.formId,isInvite)){return;}
  25. else{KAMPYLE_DATA.setMemoryData(KAMPYLE_CONSTANT.MEMORY_DATA_FIELDS.FETCHING_DATA_IN_PROGRESS+data.formId+(isInvite?"_invite":''),true);}
  26. KAMPYLE_DATA.fetchFormJsonData({formId:data.formId,isInvite:isInvite,callback:function(){if(isInvite){KAMPYLE_FUNC.handleInviteApplicationUpdated("",data);}
  27. else{KAMPYLE_FUNC.handleFormStateUpdated(data);}},onError:onJsonFetchingFailed.bind(null,data,isInvite)});}
  28. function shouldRenderForm(data){var isFormLoadedSuccessfully=isFormLoaded(data.formId)&&isJsonDataLoaded(data.formId,false);var shouldShowForm=MDIGITAL.FORM_STATE.shouldFormBeShown(data.formId)&&!isFormAlreadyShown(data.formId);return isFormLoadedSuccessfully&&shouldShowForm;}
  29. function onJsonFetchingFailed(data,isInvite){if(isInvite){KAMPYLE_DATA.setMemoryData(KAMPYLE_CONSTANT.INVITE_JSON_DATA_KEY_PREFIX+data.formId,false);}
  30. else{KAMPYLE_DATA.setMemoryData(KAMPYLE_CONSTANT.FORM_JSON_DATA_KEY_PREFIX+data.formId,false);KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_FORM_LOADING_HAS_FAILED,{formId:data.formId});}
  31. KAMPYLE_COOLADATA.triggerCooladataEvent(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_COULD_NOT_FETCH_DATA,{formId:data.formId,isInvite:isInvite,err:'Could not fetch json data'});}
  32. function handleFormStateUpdated(data){if(shouldRenderForm(data)){KAMPYLE_EVENT_DISPATCHER.trigger('neb_showForm',{formId:data.formId});KAMPYLE_EVENT_DISPATCHER.trigger('neb_formReady',{formId:data.formId});KAMPYLE_DATA.setFormState(data.formId,{shown:true})}
  33. else if(hasApplicationLoadingFailed(data.formId,false)){KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_FORM_LOADING_HAS_FAILED,{formId:data.formId});}}
  34. function subscribeToPageEvents(){var eventMapping={neb_pageView:[increasePageViewCounter],neb_showInvitation:[setInviteState,KAMPYLE_UTILS.setCurrentScrollPosition,setFocusedElement,focusOnInviteIframe,handleInviteApplicationUpdated],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],neb_formLoadingHasFailed:[handleFormLoadingFailed]};KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);}
  35. function getTriggerTypeByEvent(eventName){var eventTriggerMapping={neb_buttonClicked:'Button',neb_sdkShowForm:'ByCode',neb_routeToForm:'ByCode',neb_skipInvitation:'Invitation',neb_inviteAccepted:'Invitation',};return eventTriggerMapping[eventName]||null;}
  36. 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,{shouldBeShown:true});handleFormStateUpdated(data);}
  37. 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={errorMessage:e.message,errorStack:e.stack,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;}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');}}}
  38. function isReferrerDifferentThanHost(){var referrerDomain=document.referrer.match(/:\/\/(.[^/]+)/);if(!referrerDomain){return true;}
  39. referrerDomain=referrerDomain[1];if(referrerDomain===window.location.host){return false;}
  40. var propertySharedSubdomain=KAMPYLE_DATA.getPropertySharedSubdomain();if(propertySharedSubdomain){return!KAMPYLE_UTILS.isHostMatchesSubdomain(referrerDomain,propertySharedSubdomain)||!KAMPYLE_UTILS.isHostMatchesSubdomain(window.location.host,propertySharedSubdomain);}
  41. return true;}
  42. function kampyleGetData(){var dataJson=KAMPYLE_DATA.getMemoryData('dataJson');if(dataJson){return dataJson;}
  43. 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":true,"cooladataNewEvents":null,"adobeAnalytics":null,"eventIncludeFeedbackContent":null,"userSnapV4":null,"dynamicModalSizeInCustomHtml":null,"customHtmlFormsEnable":true,"cooladataEventsLimit":null,"mobileSDKV2BannerRevamp":null,"mobileSDKV2AndroidNewSubmitButton":null,"targetingEventsReporting":null,"cspUsersnapV2Support":null,"sessionRecording":null,"mobileSdkFixIos12KeyboardIssue":null,"serverBasedTargeting":null,"CSPRemoveInlineStyling":null,"enableOverflow":null,"doNotSurveyOnUBTNetworkFail":null,"mobileInvitationLayout":null,"coolodataEventsByXhr":null,"addingRandomTimeForTimeInSession":null,"nativeScreenCapture":null,"mobileWebDynamicFormSizeInFormBuilder":true,"cookieStorageDisable":null,"screenCaptureEnabled":null,"mobileSDKV2UiRevamp":null,"skipInvitationOptimization":null,"formTemplatesWCAG":true,"formSpacing":null,"mobileSDKV2AppRating":null,"targetingRuleIdleTime":null,"onPremHybrid":null,"responsiveRatingComponent":null,"embeddedForms":null,"localizedForms":null,"UBTExtraEvents":null,"adobeAnalyticsObjectName":null,"mobileWebDynamicFormSize":null,"mobileSDKV2ScoreTargeting":null,"onsiteLogger":null,"underScoreLocalization":null,"disableButtonProximity":null,"thermoFisherTeaLeafIntegration":null,"alternativeUUID":null,"adobeConcatLinkTrackVars":null,"multiOptionsID":true,"adobeIncludeLinkTrackVars":null,"separateFormTemplateFromData":null,"cooladataIntegration":false,"cooladataCreateSessionEvent":null},"region":"digital-cloud-gov","websiteId":2,"accountId":1,"isSpa":false,"isWCAG":true,"isManuallyInviteTargeting":false,"isFormsPreloaded":true,"isGoogleAnalyticsClientGTM":false,"cookieExpirationTime":null,"sbtServerDomain":"NOT_SET","sbtEnvPrefix":"wdcgov_","endUserIdentifier":{},"formNodes":[{"formId":"254","isCustomHtmlEnabled":"false","formVersion":"2","formHtmlUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/254/form1588372194491.html","formDataUrl":"","formWidth":"450","formHeight":"450","isFixedSize":"false","isFullWidthEmbedded":"null","designSettings":{"formBackgroundColor":"","thankYouPageBackgroundColor":""},"formLocalizationSettings":{"defaultLanguage":"null","useCustomParam":"null","customParam":"null"},"functionFileUrl":"","customParams":"[{\"id\":\"4\",\"unique_name\":\"_gid\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_gid\",\"is_identifier\":\"false\"}, {\"id\":\"7\",\"unique_name\":\"_ga\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_ga\",\"is_identifier\":\"false\"}, {\"id\":\"6\",\"unique_name\":\"Number Randomizer\",\"type\":\"Number\",\"source\":\"Cookie\",\"source_name\":\"mab_usps\",\"is_identifier\":\"false\"}, {\"id\":\"5\",\"unique_name\":\"Cart Count\",\"type\":\"Number\",\"source\":\"Var\",\"source_name\":\"cart_count\",\"is_identifier\":\"false\"}]","formType":"invitation","formDisplay":{"displayType":"lightbox","displayDirection":"centerRight","isSelfHosted":"","selfHostedUrl":""},"inviteData":{"inviteUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/254/invitation1588015246826.html","inviteHeight":"400","inviteWidth":"700","skipInvitation":"true","invitationPosition":"top","inviteDataUrl":""},"onSiteData":{"genericRule":"{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"20\",\"formId\":-1,\"fieldId\":6,\"formName\":\"All Forms\",\"uniqueId\":\"customParam6\",\"condition\":\"greaterThan\",\"fieldName\":\"Number Randomizer\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"41\",\"formId\":-1,\"fieldId\":6,\"formName\":\"All Forms\",\"uniqueId\":\"customParam6\",\"condition\":\"smallerThan\",\"fieldName\":\"Number Randomizer\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"}]}]}","numberOfPagesViewed":{"numberOfRepeats":"2","compareString":"greaterThan"},"submitted":{"days":"60"},"kampyleTimeInSession":{"time":"5"},"kampyleInvitePerSession":{"inviteOncePerSession":"false"},"declined":{"days":"30"},"kampyleTimeOnPage":{"time":"5"},"kampyleInvitePercentageUsers":{"prec":"8.0"},"devicetypes":["desktop","mobile","tablet"]},"urlRules":{"exclusionUrl":{"rule":"/cart/;/cart;/checkout/;/checkout;/payment/;/payment;/shipping.jsp;/mobile-cart.jsp;/labelSummary.shtml;/createLabel.shtml;/LoginAction_input;/labelInformation;/store/cart/cart.jsp;/checkout/shipping.jsp;/store/checkout/confirm.jsp;/pse-form-enter.action;https://pay.usps.com;https://reg.usps.com;/checkout/login.jsp;/gxgLocationsDestinations.shtml;/customsInformationGxg.shtml;/customsInformation.shtml;/go/ZipLookupAction_input;/go/ScheduleAPickupAction!input.action;/go/POLocatorAction!input.action;/go/TrackConfirmAction_input;/holdmail/home.jsp;/holdmail/;/redelivery/;/redelivery/home.jsp;/pfs/home.jsp;/m/shipping.jsp;/m/login?;/payment/MCheckout_input;/m/POLocatorAction.action;/m/ZipLookupAction?search;/go/pages/myusps/loadNotificationsSettings.action?save=Preferences;/eddm/customer/routeSearch.action;/anyapp_outage_apology.htm;/authorizeUser.jsp;/searchResultSignedIn.do;/onlineApplicationOrg.do;/receiptNewCustLoadBack.do;/eregLanding.do;/\\/go\\/ScheduleAPickupAction!input.action/;/findBox.html?q=*;/pobol/app/secure/boxholds/holdPostLogin?;/reserveBox.html?;/pay/checkout.html;/pay;/store/cart/cart.jsp;/mobile-cart.jsp;/checkout/login.jsp;/checkout/shipping.jsp;/payment/MCheckout_input;/store/checkout/confirm.jsp;https://pay.usps.com/;https://catpx-pay.usps.com/;https://sitpx-pay.usps.com/;/pse-form-enter.action;/store/pse/pse-configure.jsp;/pfs/;/shippingCart.shtml;/zip-code-lookup.htm;/schedule-pickup-steps.htm;https://ecom-cat.usps.com/store/checkout/shipping.jsp;https://ecom-sit.usps.com/store/checkout/shipping.jsp;https://store.usps.com/store/checkout/shipping.jsp;https://postalpro.usps.com/;https://gateway.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;https://pfsr-cat.usps.com/;https://about.usps.com/;https://pe.usps.com/;http://about.usps.com/;http://pe.usps.com/;https://prodpx-promotool.usps.com/promoregadmin/editCampaignEmailAction.do;https://prodpx-promotool.usps.com/;http://origin-about.usps.com/;https://origin-about.usps.com/;http://origin-catpx-about.usps.com/;https://origin-catpx-about.usps.com/;http://irresistiblemail.com/;https://irresistiblemail.com/;https://delivercheer.com/;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx;https://fast.usps.com/;http://uspsid.com;https://m.usps.com/;https://gateway-dev.usps.com;https://gateway-sit.usps.com;https://gateway-cat.usps.com;https://dm.taradel.com/;https://usps.taradel.com/;https://www.usps.com/styleguide;dm.taradel.com/;dm.taradel.com;http://dm.taradel.com/;http://dm.taradel.com;https://postalpro.usps.com/;http://postalpro.usps.com/;postalpro.usps.com;https://pfsr.usps.com/;https://postalpro.usps.com/;https://gateway.usps.com/;https://gateway-cat.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;https://about.usps.com/;https://pe.usps.com/;https://pe.usps.gov/;http://about.usps.com/;http://pe.usps.com/;https://prodpx-promotool.usps.com/promoregadmin/editCampaignEmailAction.do;https://prodpx-promotool.usps.com/promoregadmin/editCampaignInfo.do;https://prodpx-promotool.usps.com/;http://origin-about.usps.com/;https://origin-about.usps.com/;http://origin-catpx-about.usps.com/;https://origin-catpx-about.usps.com/;http://irresistiblemail.com/;https://irresistiblemail.com/;https://gateway-cat.usps.com;https://postcalc.usps.com;https://postcalcsm.usps.com;https://postcalcea.usps.com;https://postcalc-cat.usps.com;https://postcalc-cat1.usps.com;https://postcalc-cat2.usps.com;https://postcalc-cat3.usps.com;https://postcalc-cat4.usps.com;https://postcalc-cat5.usps.com;https://postcalc-cat6.usps.com;https://postcalc-sit.usps.com;https://postcalc-sit1.usps.com;https://postcalc-sit2.usps.com;https://ibcalc.usps.com;https://ibcalcsm.usps.com;https://ibcalcea.usps.com;https://ibcalc-cat.usps.com;https://ibcalc-cat1.usps.com;https://ibcalc-cat2.usps.com;https://ibcalc-cat3.usps.com;https://ibcalc-cat4.usps.com;https://ibcalc-cat5.usps.com;https://ibcalc-cat6.usps.com;https://ibcalc-sit.usps.com;https://ibcalc-sit1.usps.com;https://ibcalc-sit2.usps.com;https://dbcalc.usps.com;https://dbcalcsm.usps.com;https://dbcalcea.usps.com;https://dbcalc-cat.usps.com;https://dbcalc-cat1.usps.com;https://dbcalc-cat2.usps.com;https://dbcalc-cat3.usps.com;https://dbcalc-cat4.usps.com;https://dbcalc-cat5.usps.com;https://dbcalc-cat6.usps.com;https://dbcalc-sit.usps.com;https://dbcalc-sit1.usps.com/;https://dbcalc-sit2.usps.com/;https://pe.usps.com;https://pe-ea.usps.com;https://pe-sm.usps.com;https://pe-cat.usps.com;https://pe-cat.usps.com;https://pe-sit.usps.com;https://www.usps.com/datadial;https://www.usps.com/datadial/;https://www.uspscybersafe.com/businesses;https://www.uspscybersafe.com/businesses/;https://smartbusinessmoments.usps.com;https://smartbusinessmoments.usps.com/;https://delivercheer.com/;http://delivercheer.com;http://delivercheer.com/;https://www.usps.com/holiday/holiday-shipping-dates.htm;https://stage-www.usps.com/holiday/holiday-shipping-dates.htm;https://tusps.usps.com/holiday/holiday-shipping-dates.htm;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx;https://www.imresearchcenter.com/;https://www.delivercheer.com/;http://stage.usps-op-santa-adopter2018.mrmclient.com/;https://www.uspsdelivers.com/;http://usprioritymailing.com/;https://fast.usps.com/;https://cat-tools.usps.com/schedule-pickup-steps.htm#;https://pe-sit.usps.com;https://pe-cat.usps.com;https://catpx-pay.usps.com;https://sitpx-pay.usps.com;https://pay.usps.com;uspsid.com;http://uspsid.com;https://usps.taradel.com;https://dm.taradel.com;http://www.deliveringinnovation.com/"},"inclusionUrl":{"rule":""}}},{"formId":"245","isCustomHtmlEnabled":"false","formVersion":"2","formHtmlUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/245/form1588372239124.html","formDataUrl":"","formWidth":"450","formHeight":"450","isFixedSize":"false","isFullWidthEmbedded":"null","designSettings":{"formBackgroundColor":"","thankYouPageBackgroundColor":""},"formLocalizationSettings":{"defaultLanguage":"null","useCustomParam":"null","customParam":"null"},"functionFileUrl":"","customParams":"[{\"id\":\"4\",\"unique_name\":\"_gid\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_gid\",\"is_identifier\":\"false\"}, {\"id\":\"7\",\"unique_name\":\"_ga\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_ga\",\"is_identifier\":\"false\"}, {\"id\":\"6\",\"unique_name\":\"Number Randomizer\",\"type\":\"Number\",\"source\":\"Cookie\",\"source_name\":\"mab_usps\",\"is_identifier\":\"false\"}, {\"id\":\"5\",\"unique_name\":\"Cart Count\",\"type\":\"Number\",\"source\":\"Var\",\"source_name\":\"cart_count\",\"is_identifier\":\"false\"}]","formType":"invitation","formDisplay":{"displayType":"lightbox","displayDirection":"centerRight","isSelfHosted":"","selfHostedUrl":""},"inviteData":{"inviteUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/245/invitation1588015247222.html","inviteHeight":"400","inviteWidth":"700","skipInvitation":"true","invitationPosition":"top","inviteDataUrl":""},"onSiteData":{"genericRule":"{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"21\",\"formId\":-1,\"fieldId\":6,\"formName\":\"All Forms\",\"uniqueId\":\"customParam6\",\"condition\":\"smallerThan\",\"fieldName\":\"Number Randomizer\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"}]}","numberOfPagesViewed":{"numberOfRepeats":"2","compareString":"greaterThan"},"submitted":{"days":"60"},"kampyleTimeInSession":{"time":"5"},"kampyleInvitePerSession":{"inviteOncePerSession":"false"},"declined":{"days":"30"},"kampyleTimeOnPage":{"time":"5"},"devicetypes":["desktop"],"kampyleInvitePercentageUsers":{"prec":"4.0"}},"urlRules":{"exclusionUrl":{"rule":"/cart/;/cart;/checkout/;/checkout;/payment/;/payment;/shipping;/mobile-cart.jsp;/labelSummary.shtml;/createLabel.shtml;/LoginAction_input;/labelInformation;/store/cart/cart.jsp;/checkout/shipping;/store/checkout/confirm.jsp;/pse-form-enter.action;https://pay.usps.com;https://reg.usps.com;/checkout/login.jsp;/gxgLocationsDestinations.shtml;/customsInformationGxg.shtml;/customsInformation.shtml;/go/ZipLookupAction_input;/go/ScheduleAPickupAction!input.action;/go/POLocatorAction!input.action;/go/TrackConfirmAction_input;/holdmail/home.jsp;/holdmail/;/redelivery/;/redelivery/home.jsp;/pfs/home.jsp;/m/shipping.jsp;/m/login?;/payment/MCheckout_input;/m/POLocatorAction.action;/m/ZipLookupAction?search;/go/pages/myusps/loadNotificationsSettings.action?save=Preferences;/eddm/customer/routeSearch.action;/anyapp_outage_apology.htm;/authorizeUser.jsp;/searchResultSignedIn.do;/onlineApplicationOrg.do;/receiptNewCustLoadBack.do;/eregLanding.do;/\\/go\\/ScheduleAPickupAction!input.action/;/findBox.html?q=*;/pobol/app/secure/boxholds/holdPostLogin?;/reserveBox.html?;/pay/checkout.html;/pay;/store/cart/cart.jsp;/mobile-cart.jsp;/checkout/login.jsp;/checkout/shipping;/payment/MCheckout_input;/store/checkout/confirm.jsp;https://pay.usps.com/;https://catpx-pay.usps.com/;https://sitpx-pay.usps.com/;/pse-form-enter.action;/store/pse/pse-configure.jsp;/pfs/;/shippingCart.shtml;/zip-code-lookup.htm;/schedule-pickup-steps.htm;https://ecom-cat.usps.com/store/checkout/shipping.jsp;https://ecom-sit.usps.com/store/checkout/shipping.jsp;https://store.usps.com/store/checkout/shipping.jsp;https://postalpro.usps.com/;https://gateway.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;http://irresistiblemail.com/;https://irresistiblemail.com/;https://pfsr-cat.usps.com/;https://about.usps.com/;https://pe.usps.com/;http://pe.usps.com/;https://prodpx-promotool.usps.com/promoregadmin/editCampaignEmailAction.do;https://prodpx-promotool.usps.com/promoregadmin/editCampaignInfo.do;https://prodpx-promotool.usps.com/;http://origin-about.usps.com/;https://origin-about.usps.com/;http://origin-catpx-about.usps.com/;https://origin-catpx-about.usps.com/;https://delivercheer.com/;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx;https://fast.usps.com/;http://uspsid.com;https://m.usps.com/;https://gateway-dev.usps.com;https://gateway-sit.usps.com;https://gateway-cat.usps.com;https://www.usps.com/styleguide;https://dm.taradel.com;https://dm.taradel.com/;dm.taradel.com;dm.taradel.com/;https://postalpro.usps.com/;http://postalpro.usps.com/;postalpro.usps.com;https://pfsr.usps.com/;https://postalpro.usps.com/;https://gateway.usps.com/;https://gateway-cat.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;https://about.usps.com/;https://pe.usps.com/;https://pe.usps.gov/;http://about.usps.com/;http://pe.usps.com/;https://prodpx-promotool.usps.com/promoregadmin/editCampaignEmailAction.do;https://prodpx-promotool.usps.com/promoregadmin/editCampaignInfo.do;https://prodpx-promotool.usps.com/;http://origin-about.usps.com/;https://origin-about.usps.com/;http://origin-catpx-about.usps.com/;https://origin-catpx-about.usps.com/;http://irresistiblemail.com/;https://irresistiblemail.com/;https://gateway-cat.usps.com;https://postcalc.usps.com;https://postcalcsm.usps.com;https://postcalcea.usps.com;https://postcalc-cat.usps.com;https://postcalc-cat1.usps.com;https://postcalc-cat2.usps.com;https://postcalc-cat3.usps.com;https://postcalc-cat4.usps.com;https://postcalc-cat5.usps.com;https://postcalc-cat6.usps.com;https://postcalc-sit.usps.com;https://postcalc-sit1.usps.com;https://postcalc-sit2.usps.com;https://ibcalc.usps.com;https://ibcalcsm.usps.com;https://ibcalcea.usps.com;https://ibcalc-cat.usps.com;https://ibcalc-cat1.usps.com;https://ibcalc-cat2.usps.com;https://ibcalc-cat3.usps.com;https://ibcalc-cat4.usps.com;https://ibcalc-cat5.usps.com;https://ibcalc-cat6.usps.com;https://ibcalc-sit.usps.com;https://ibcalc-sit1.usps.com;https://ibcalc-sit2.usps.com;https://dbcalc.usps.com;https://dbcalcsm.usps.com;https://dbcalcea.usps.com;https://dbcalc-cat.usps.com;https://dbcalc-cat1.usps.com;https://dbcalc-cat2.usps.com;https://dbcalc-cat3.usps.com;https://dbcalc-cat4.usps.com;https://dbcalc-cat5.usps.com;https://dbcalc-cat6.usps.com;https://dbcalc-sit.usps.com;https://dbcalc-sit1.usps.com/;https://dbcalc-sit2.usps.com/;https://pe.usps.com;https://pe-ea.usps.com;https://pe-sm.usps.com;https://pe-cat.usps.com;https://pe-cat.usps.com;https://pe-sit.usps.com;https://www.usps.com/datadial;https://www.usps.com/datadial/;https://www.uspscybersafe.com/businesses;https://www.uspscybersafe.com/businesses/;https://smartbusinessmoments.usps.com;https://smartbusinessmoments.usps.com/;https://delivercheer.com/;http://delivercheer.com;http://delivercheer.com/;https://www.usps.com/holiday/holiday-shipping-dates.htm;https://stage-www.usps.com/holiday/holiday-shipping-dates.htm;https://tusps.usps.com/holiday/holiday-shipping-dates.htm;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx;https://www.imresearchcenter.com/;https://www.delivercheer.com/;http://stage.usps-op-santa-adopter2018.mrmclient.com/;https://www.uspsdelivers.com/;http://usprioritymailing.com/;https://fast.usps.com/;https://cat-tools.usps.com/schedule-pickup-steps.htm#;https://pe-sit.usps.com;https://pe-cat.usps.com;https://catpx-pay.usps.com;https://sitpx-pay.usps.com;https://pay.usps.com;uspsid.com;http://uspsid.com;https://usps.taradel.com;https://dm.taradel.com;http://www.deliveringinnovation.com/"},"inclusionUrl":{"rule":""}}},{"formId":"11","isCustomHtmlEnabled":"false","formVersion":"2","formHtmlUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/11/form1588372428709.html","formDataUrl":"","formWidth":"450","formHeight":"450","isFixedSize":"false","isFullWidthEmbedded":"null","designSettings":{"formBackgroundColor":"","thankYouPageBackgroundColor":""},"formLocalizationSettings":{"defaultLanguage":"null","useCustomParam":"null","customParam":"null"},"functionFileUrl":"","customParams":"[{\"id\":\"4\",\"unique_name\":\"_gid\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_gid\",\"is_identifier\":\"false\"}, {\"id\":\"7\",\"unique_name\":\"_ga\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_ga\",\"is_identifier\":\"false\"}, {\"id\":\"5977\",\"unique_name\":\"Tracking Features\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"window.dataLayer.0.ecommerce.impressions.0.dimension149\",\"is_identifier\":\"false\"}, {\"id\":\"5973\",\"unique_name\":\"Tracking Category 2.0\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"window.dataLayer.0.ecommerce.impressions.0.category\",\"is_identifier\":\"false\"}, {\"id\":\"5975\",\"unique_name\":\"Tracking ID 2.0\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"window.dataLayer.0.ecommerce.impressions.0.id\",\"is_identifier\":\"false\"}, {\"id\":\"5974\",\"unique_name\":\"Tracking Name 2.0\",\"type\":\"Text\",\"source\":\"Var\",\"source_name\":\"window.dataLayer.0.ecommerce.impressions.0.name\",\"is_identifier\":\"false\"}, {\"id\":\"6\",\"unique_name\":\"Number Randomizer\",\"type\":\"Number\",\"source\":\"Cookie\",\"source_name\":\"mab_usps\",\"is_identifier\":\"false\"}, {\"id\":\"5\",\"unique_name\":\"Cart Count\",\"type\":\"Number\",\"source\":\"Var\",\"source_name\":\"cart_count\",\"is_identifier\":\"false\"}]","formType":"invitation","formDisplay":{"displayType":"lightbox","displayDirection":"centerRight","isSelfHosted":"","selfHostedUrl":""},"inviteData":{"inviteUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/11/invitation1544799414063.html","inviteHeight":"400","inviteWidth":"700","skipInvitation":"true","invitationPosition":"top","inviteDataUrl":""},"onSiteData":{"genericRule":"{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"60\",\"formId\":11,\"fieldId\":6,\"formName\":\"Tracking Survey\",\"uniqueId\":\"customParam6\",\"condition\":\"greaterThan\",\"fieldName\":\"Number Randomizer\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"},{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"101\",\"formId\":11,\"fieldId\":6,\"formName\":\"Tracking Survey\",\"uniqueId\":\"customParam6\",\"condition\":\"smallerThan\",\"fieldName\":\"Number Randomizer\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"}]}]}","submitted":{"days":"60"},"declined":{"days":"30"},"kampyleInvitePerSession":{"inviteOncePerSession":"true"},"devicetypes":["desktop","mobile","tablet"],"kampyleTimeOnPage":{"time":"8"},"kampyleInvitePercentageUsers":{"prec":"1.0"}},"urlRules":{"exclusionUrl":{"rule":"https://tools.usps.com/go/TrackConfirmAction_input;https://www.uspsdelivers.com/"},"inclusionUrl":{"rule":"https://tools.usps.com/go/TrackConfirmAction?tLabels=;https://tools.usps.com/go/TrackConfirmAction?tRef=;https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=;https://tools.usps.com/go/TrackConfirmAction"}}},{"formId":"7","isCustomHtmlEnabled":"false","formVersion":"2","formHtmlUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/7/form1588372260200.html","formDataUrl":"","formWidth":"450","formHeight":"450","isFixedSize":"false","isFullWidthEmbedded":"null","designSettings":{"formBackgroundColor":"","thankYouPageBackgroundColor":""},"formLocalizationSettings":{"defaultLanguage":"null","useCustomParam":"false","customParam":"null"},"functionFileUrl":"","customParams":"[{\"id\":\"4\",\"unique_name\":\"_gid\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_gid\",\"is_identifier\":\"false\"}, {\"id\":\"7\",\"unique_name\":\"_ga\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_ga\",\"is_identifier\":\"false\"}, {\"id\":\"6\",\"unique_name\":\"Number Randomizer\",\"type\":\"Number\",\"source\":\"Cookie\",\"source_name\":\"mab_usps\",\"is_identifier\":\"false\"}, {\"id\":\"5\",\"unique_name\":\"Cart Count\",\"type\":\"Number\",\"source\":\"Var\",\"source_name\":\"cart_count\",\"is_identifier\":\"false\"}]","formType":"invitation","formDisplay":{"displayType":"lightbox","displayDirection":"centerRight","isSelfHosted":"","selfHostedUrl":""},"inviteData":{"inviteUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/7/invitation1544799439471.html","inviteHeight":"400","inviteWidth":"700","skipInvitation":"true","invitationPosition":"top","inviteDataUrl":""},"onSiteData":{"genericRule":"{\"type\":\"criteriaGroup\",\"conjunction\":\"AND\",\"childrenCriterias\":[{\"type\":\"criteria\",\"value\":\"0\",\"formId\":7,\"fieldId\":5,\"formName\":\"Store Abandonment\",\"uniqueId\":\"customParam5\",\"condition\":\"greaterThan\",\"fieldName\":\"Cart Count\",\"fieldType\":\"Number\",\"fieldOrigin\":\"customParam\"}]}","submitted":{"days":"60"},"declined":{"days":"30"},"kampyleInvitePerSession":{"inviteOncePerSession":"false"},"abandon":{"height":"1","zIndex":"9999999"},"kampyleInvitePercentageUsers":{"prec":"2.0"},"devicetypes":["desktop"]},"urlRules":{"exclusionUrl":{"rule":"/mobile-cart.jsp;/checkout/login.jsp;/checkout/shipping.jsp;/checkout/;/payment/MCheckout_input;/store/checkout/confirm.jsp;https://pay.usps.com/;https://catpx-pay.usps.com/;https://sitpx-pay.usps.com/;/pse-form-enter.action;/store/pse/pse-configure.jsp;/pfs/;/schedule-pickup-steps.htm;https://ecom-cat.usps.com/store/checkout/shipping.jsp;https://ecom-sit.usps.com/store/checkout/shipping.jsp;https://store.usps.com/store/checkout/shipping.jsp;https://postalpro.usps.com/;https://gateway.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;https://about.usps.com/;https://pe.usps.com/;http://pe.usps.com/;https://delivercheer.com/;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx"},"inclusionUrl":{"rule":"https://ecom-sit.usps.com;https://ecom-cat.usps.com;https://store.usps.com"}}},{"formId":"244","isCustomHtmlEnabled":"false","formVersion":"2","formHtmlUrl":"https://resources.digital-cloud-gov.medallia.com/wdcgov/2/forms/244/form1588372090256.html","formDataUrl":"","formWidth":"450","formHeight":"450","isFixedSize":"false","isFullWidthEmbedded":"null","designSettings":{"formBackgroundColor":"","thankYouPageBackgroundColor":""},"formLocalizationSettings":{"defaultLanguage":"null","useCustomParam":"false","customParam":"null"},"functionFileUrl":"","customParams":"[{\"id\":\"4\",\"unique_name\":\"_gid\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_gid\",\"is_identifier\":\"false\"}, {\"id\":\"7\",\"unique_name\":\"_ga\",\"type\":\"Text\",\"source\":\"Cookie\",\"source_name\":\"_ga\",\"is_identifier\":\"false\"}, {\"id\":\"6\",\"unique_name\":\"Number Randomizer\",\"type\":\"Number\",\"source\":\"Cookie\",\"source_name\":\"mab_usps\",\"is_identifier\":\"false\"}, {\"id\":\"5\",\"unique_name\":\"Cart Count\",\"type\":\"Number\",\"source\":\"Var\",\"source_name\":\"cart_count\",\"is_identifier\":\"false\"}]","formType":"button","formDisplay":{"displayType":"lightbox","displayDirection":"centerRight","isSelfHosted":"","selfHostedUrl":""},"buttonData":{"type":"vertical","text":"Feedback","textColor":"#ffffff","backgroundColor":"#333366","buttonUrl":"","position":"right","cornerMargin":"0.0","verticalOffset":"0.0"},"urlRules":{"exclusionUrl":{"rule":"https://postalpro.usps.com/;https://gateway.usps.com/;https://gateway-cat.usps.com/;https://prodpx-promotool.usps.com/promoreg/campaignView.do;https://about.usps.com/;https://pe.usps.com/;https://pe.usps.gov/;http://about.usps.com/;http://pe.usps.com/;https://prodpx-promotool.usps.com/promoregadmin/editCampaignEmailAction.do;https://prodpx-promotool.usps.com/promoregadmin/editCampaignInfo.do;https://prodpx-promotool.usps.com/;http://origin-about.usps.com/;https://origin-about.usps.com/;http://origin-catpx-about.usps.com/;https://origin-catpx-about.usps.com/;http://irresistiblemail.com/;https://irresistiblemail.com/;https://gateway-cat.usps.com;https://postcalc.usps.com;https://postcalcsm.usps.com;https://postcalcea.usps.com;https://postcalc-cat.usps.com;https://postcalc-cat1.usps.com;https://postcalc-cat2.usps.com;https://postcalc-cat3.usps.com;https://postcalc-cat4.usps.com;https://postcalc-cat5.usps.com;https://postcalc-cat6.usps.com;https://postcalc-sit.usps.com;https://postcalc-sit1.usps.com;https://postcalc-sit2.usps.com;https://ibcalc.usps.com;https://ibcalcsm.usps.com;https://ibcalcea.usps.com;https://ibcalc-cat.usps.com;https://ibcalc-cat1.usps.com;https://ibcalc-cat2.usps.com;https://ibcalc-cat3.usps.com;https://ibcalc-cat4.usps.com;https://ibcalc-cat5.usps.com;https://ibcalc-cat6.usps.com;https://ibcalc-sit.usps.com;https://ibcalc-sit1.usps.com;https://ibcalc-sit2.usps.com;https://dbcalc.usps.com;https://dbcalcsm.usps.com;https://dbcalcea.usps.com;https://dbcalc-cat.usps.com;https://dbcalc-cat1.usps.com;https://dbcalc-cat2.usps.com;https://dbcalc-cat3.usps.com;https://dbcalc-cat4.usps.com;https://dbcalc-cat5.usps.com;https://dbcalc-cat6.usps.com;https://dbcalc-sit.usps.com;https://dbcalc-sit1.usps.com/;https://dbcalc-sit2.usps.com/;https://pe.usps.com;https://pe-ea.usps.com;https://pe-sm.usps.com;https://pe-cat.usps.com;https://pe-cat.usps.com;https://pe-sit.usps.com;https://www.usps.com/datadial;https://www.usps.com/datadial/;https://www.uspscybersafe.com/businesses;https://www.uspscybersafe.com/businesses/;https://smartbusinessmoments.usps.com;https://smartbusinessmoments.usps.com/;https://delivercheer.com/;http://delivercheer.com;http://delivercheer.com/;https://www.usps.com/holiday/holiday-shipping-dates.htm;https://stage-www.usps.com/holiday/holiday-shipping-dates.htm;https://tusps.usps.com/holiday/holiday-shipping-dates.htm;https://dbcalc-cat.usps.com/CalculatorSetPage.aspx;https://dbcalc.usps.com/CalculatorSetPage.aspx;https://www.imresearchcenter.com/;https://www.delivercheer.com/;http://stage.usps-op-santa-adopter2018.mrmclient.com/;https://www.uspsdelivers.com/;http://usprioritymailing.com/;https://fast.usps.com/;https://cat-tools.usps.com/schedule-pickup-steps.htm#;https://pe-sit.usps.com;https://pe-cat.usps.com;https://catpx-pay.usps.com;https://sitpx-pay.usps.com;https://pay.usps.com;uspsid.com;http://uspsid.com;https://usps.taradel.com;https://dm.taradel.com;http://www.deliveringinnovation.com/"},"inclusionUrl":{"rule":""}},"onSiteData":{"devicetypes":["desktop","tablet"]}}],"integrations":{"recordedSessions":[]},"adobeSdkName":null,"packageVersion":null,"sharedSubdomain":null,"customCssUpload":false,"usersnapEnvId":"NOT_USED"};}
  44. 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){handleInviteApplicationUpdated("",data);}}
  45. function handleFormLoading(eventName,data){data=data||{};KAMPYLE_DATA.setFormState(data.formId,{loading:true,});KAMPYLE_EVENT_DISPATCHER.trigger('neb_form_loaded',{formId:data.formId});}
  46. function sendInviteInitialData(eventName,data){data=data||{};if(!KAMPYLE_DATA.getFormState(data.formId).inviteLoaded){return false;}
  47. 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;}
  48. 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,});}}
  49. 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:null,inviteShown:false,});break;default:KAMPYLE_UTILS.showWarning('Unhandled event name '+eventName);}}
  50. function updatePreviewIframeStyle(formData){var currentFormId=formData.formId;var formWidth;var formHeight;if(formData){formWidth=parseInt(formData.formWidth,10);formHeight=parseInt(formData.formHeight,10);}
  51. 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',};}
  52. else{iframeStyleObject={position:'fixed',height:'100%',width:'100%',};}}
  53. var modal=document.getElementById('kampyleFormModal');if(modal&&modal.style&&modal.removeAttribute){modal.removeAttribute('style');KAMPYLE_UTILS.setElementStyle(modal,iframeStyleObject);}}
  54. 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%';}
  55. else{var height=KAMPYLE_UTILS.getUrlParam('height');var width=KAMPYLE_UTILS.getUrlParam('width');if(!!height&&!isNaN(height)){formHeight=height;}
  56. if(!!width&&!isNaN(width)){formWidth=width;}}
  57. 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);}
  58. else{url=location.protocol+'//'+location.host;window.location=url+'/#/error/404';}
  59. var provisions=decodeURIComponent(window.getUrlParam('provisions'));if(!!provisions){formUrl+='&provisions='+encodeURIComponent(provisions);}
  60. var currentWebsiteId=decodeURIComponent(window.getUrlParam('websiteId'));if(!!currentWebsiteId){formUrl+='&websiteId='+encodeURIComponent(currentWebsiteId);}
  61. var type=KAMPYLE_UTILS.getUrlParam('type')||'direct';var validTypes=['live','direct','preview'];if(validTypes.indexOf(type.toLowerCase())===-1){type='direct';}
  62. formUrl+='&type='+type;var iframeHeight='100%';var iframeWidth='100%';if(KAMPYLE_DATA.isCustomHtmlAndFixedSizeForm(formId)){iframeHeight=formHeight;iframeWidth=formWidth;}
  63. var iframe=KAMPYLE_UTILS.createIframe(formUrl,iframeWidth,iframeHeight,'kampyleForm'+formId);if(KAMPYLE_DATA.isCustomHtmlForm(formId)){updatePreviewIframeStyle({formId:formId,formHeight:formHeight,formWidth:formWidth,});}
  64. 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';}}}
  65. else{url=location.protocol+'//'+location.host;window.location=url+'/#/error/404';}}
  66. function getUserIdentifierVal(){var identifierCustomParam=KAMPYLE_DATA.getUserIdentifier();if(!identifierCustomParam){return null;}
  67. var userIdentifierVal=MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue({name:identifierCustomParam.source_name,type:identifierCustomParam.type,source:identifierCustomParam.source,});if(!userIdentifierVal){return null;}
  68. return userIdentifierVal;}
  69. function setIdentifierData(identifierData){KAMPYLE_DATA.setMemoryData('isSyncedIdentifierData',true);updateIdentifierDataIfNecessary(identifierData.data);}
  70. function updateIdentifierDataIfNecessary(identifierData){updateIdentifierDataIntegerIfNecessary(identifierData.DECLINED_DATE,'DECLINED_DATE');updateIdentifierDataIntegerIfNecessary(identifierData.SUBMITTED_DATE,'SUBMITTED_DATE');}
  71. 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;}
  72. if((identifierDataValue!==null&&localStorageDate===null)||identifierDataValue>localStorageDate){KAMPYLE_DATA.setData(userStateString,identifierDataValue);}
  73. else if((localStorageDate!==null&&identifierDataValue===null)||identifierDataValue<localStorageDate){KAMPYLE_FUNC.updateTargeting(userStateString,localStorageDate);}
  74. else{KAMPYLE_UTILS.showWarning('special case');}}
  75. 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);}
  76. function onSyncIdentifierDataSuccess(callback,data){if(!data||data.error){}else{setIdentifierData(data);}
  77. typeof callback==='function'&&callback();}
  78. function onSyncIdentifierDataFailure(callback,error){typeof callback==='function'&&callback();}
  79. 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);}
  80. function startCheckingTargeting(){if(isAnyOtherFormAlreadyShown()){return false;}
  81. KAMPYLE_DATA.setMemoryData('isInvitationShouldBeIgnored',false);KAMPYLE_EVENT_DISPATCHER.trigger('neb_pageView');if(KAMPYLE_DATA.getMemoryData('context')==='preview'){showPreviewForm();}
  82. 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});}}
  83. function increasePageViewCounter(){var sessionPageCounter=KAMPYLE_DATA.getData('kampyleSessionPageCounter')||0;sessionPageCounter=parseInt(sessionPageCounter);KAMPYLE_DATA.setData('kampyleSessionPageCounter',++sessionPageCounter);}
  84. 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});}
  85. KAMPYLE_FUNC.updateTargeting('DECLINED_DATE',date);}
  86. KAMPYLE_DATA.setMemoryData('formIsShown',false);var formData=KAMPYLE_DATA.getFormData(data.formId);KAMPYLE_DATA.setFormState(data.formId,{shouldBeShown:false,shown:false,loaded:null});refocusActiveElement();KAMPYLE_UTILS.triggerCustomEvent('neb_formClosed',{formId:data.formId});if(KAMPYLE_DATA.getMemoryData('context')==='preview'){window.close();}
  87. var formData=KAMPYLE_DATA.getFormData(KAMPYLE_DATA.getMemoryData('buttonFormId'));var delay=0;if(KAMPYLE_DATA.getDisplayType(formData)==='animation'){delay=1000;}
  88. if(KAMPYLE_DATA.getMemoryData('buttonFormId')){setTimeout(function(){KAMPYLE_EVENT_DISPATCHER.trigger('neb_showButton',{formId:KAMPYLE_DATA.getMemoryData('buttonFormId')});},delay);}}
  89. 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);}}
  90. 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});}
  91. if(checkProvision(KAMPYLE_CONSTANT.PROVISIONS.NATIVE_SCREEN_CAPTURE)){KAMPYLE_EVENT_DISPATCHER.trigger('neb_sendScreenCapture');}
  92. KAMPYLE_FUNC.updateTargeting('SUBMITTED_DATE',date);}
  93. 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});}
  94. KAMPYLE_FUNC.updateTargeting('DECLINED_DATE',date);refocusActiveElement();}
  95. function handleFormLoaded(eventName,data){KAMPYLE_DATA.setFormState(data.formId,{loading:false,loaded:true,});handleFormStateUpdated(data);}
  96. function loadScreenCaptureApi(eventName,data){data=data||{};}
  97. 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';}
  98. var iframeId=iframePrefix+data.formId;KAMPYLE_UTILS.sendMessageToIframe(iframeId,{action:'screenCaptureLoaded'});}
  99. function setFocusedElement(){KAMPYLE_DATA.setMemoryData('kampyleFocusedElement',document.activeElement);}
  100. function refocusActiveElement(){var focused=KAMPYLE_DATA.getMemoryData('kampyleFocusedElement');if(focused&&focused.focus){focused.focus();}}
  101. function checkProvision(name){var dataObj=kampyleGetData();return!!name&&!!dataObj&&!!dataObj.provisions&&(!!dataObj.provisions[name]||dataObj.provisions[name]==='true');}
  102. function getAllProvisions(){var allProvisions=KAMPYLE_FUNC.kampyleGetData().provisions;var provisions={};for(var provision in allProvisions){if(allProvisions.hasOwnProperty(provision)){provisions[provision]=checkProvision(provision);}}
  103. return provisions;}
  104. function checkDevice(){if(!KAMPYLE_DATA.getMemoryData('kampyleDevice')){KAMPYLE_DATA.setMemoryData('kampyleDevice',KAMPYLE_UTILS.getDeviceTypeByUserAgent(navigator.userAgent));}
  105. return KAMPYLE_DATA.getMemoryData('kampyleDevice')||'desktop';}
  106. function addScreenCaptureData(messageData){var version=KAMPYLE_DATA.getMemoryData('version');if(version===1){messageData.screenCapture={isTaken:false};}
  107. else{messageData.integrations.screenCapture={isTaken:false};}
  108. return messageData;}
  109. function sendFormExtraData(eventName,data){data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId);if(!formData||!data.formId){return false;}
  110. 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;}
  111. var origin='*';if(currIframe&&currIframe.getAttribute){origin=currIframe.getAttribute('origin')||'*';targetWindow=currIframe.contentWindow;}
  112. if(targetWindow&&targetWindow.postMessage){if(MDIGITAL.CUSTOM_PARAMETERS.hasCustomParams(data.formId))
  113. {var customParams=MDIGITAL.CUSTOM_PARAMETERS.formatCustomParams(data.formId);targetWindow.postMessage('{"action": "customParamsLoaded","customParams" : '+JSON.stringify(customParams)+'}',origin);}
  114. 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});}
  115. if(KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)){messageData.onPremPackageVersion=MDIGITAL_OnPrem.getPackageVersion();}
  116. var pendingExtraData=KAMPYLE_DATA.flushFormExtraData(data.formId);if(pendingExtraData){for(var extra in pendingExtraData){if(pendingExtraData.hasOwnProperty(extra)){messageData[extra]=pendingExtraData[extra];}}}
  117. 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;}
  118. 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);}}
  119. KAMPYLE_EVENT_DISPATCHER.trigger('neb_formShown',{formId:data.formId,feedbackUUID:data.uuid,});}
  120. function handleVersion(eventName,data){data=data||{};KAMPYLE_DATA.setMemoryData('NEB_FORM_VERSION',data.formVersion||0);}
  121. 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;}
  122. KAMPYLE_UTILS.sendMessageToIframe(iframeId,{action:'takenScreenCapture',data:data});}
  123. function isAnyInviteShown(){var allFormStates=KAMPYLE_DATA.getMemoryData('formsState')||{};for(var formId in allFormStates){if(allFormStates.hasOwnProperty(formId)){if(allFormStates[formId].inviteShown){return true;}}}
  124. return false;}
  125. function isAnyOtherFormAlreadyShown(currentFormId,shouldIgnoreSkipInvitation){var allFormStates=KAMPYLE_DATA.getMemoryData('formsState')||{};for(var formId in allFormStates){if(allFormStates.hasOwnProperty(formId)){var shouldIgnoreForm=!MDIGITAL.FORM_STATE.isFormAlreadyShown(formId)&&((currentFormId&&currentFormId==formId)||shouldIgnoreSkipInvitation&&KAMPYLE_DATA.isSkipInvitation(formId))
  126. if((allFormStates[formId].shown||allFormStates[formId].shouldBeShown)&&!KAMPYLE_DATA.isEmbeddedDisplayType(formId)&&!shouldIgnoreForm){return true;}}}
  127. return false;}
  128. 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;}
  129. if(currParamVal===''){currParamVal=null;}}
  130. if(currParamVal!==null){switch(currParamType.toLowerCase()){case'datetime':if(typeof currParamVal==='string')
  131. {currParamVal=parseInt(currParamVal)||null;}
  132. else if(!(currParamVal instanceof Date)&&(!currParamVal.getTime||isNaN(currParamVal.getTime())))
  133. {currParamVal=null;}
  134. else{currParamVal=currParamVal.getTime();}
  135. break;case'number':currParamVal=KAMPYLE_UTILS.getNumericValue(currParamVal);break;case'text':if(typeof(currParamVal)!=='string')
  136. {currParamVal=null;}
  137. break;case'boolean':if(currParamVal==='true')
  138. {currParamVal=true;}
  139. else if(currParamVal==='false')
  140. {currParamVal=false;}
  141. if(typeof(currParamVal)!=='boolean')
  142. {currParamVal=null;}
  143. break;default:currParamVal=null;console.error('Invalid custom parameter type '+currParamType);break;}}
  144. return currParamVal;}
  145. function isPreloadConfigured(){var data=KAMPYLE_FUNC.kampyleGetData();return(!!data&&data.isFormsPreloaded!=='false'&&data.isFormsPreloaded!==false);}
  146. function addToSessionCount(){var kampyleUserSessionsCount=KAMPYLE_DATA.getData('kampyleUserSessionsCount');kampyleUserSessionsCount=Number(kampyleUserSessionsCount)||0;KAMPYLE_DATA.setData('kampyleUserSessionsCount',++kampyleUserSessionsCount);}
  147. function handleHashChanged(){if(KAMPYLE_DATA.isFeatureEnabled('SPA')){startCheckingTargeting();}}
  148. function kampyleButtonClicked(formData){formData=formData||{};KAMPYLE_EVENT_DISPATCHER.trigger('neb_buttonClicked',{formId:formData.formId,});}
  149. function getTimeInSession(){var sessionStartTimestamp=Number(KAMPYLE_DATA.getData('kampyleUserSession'))||Date.now();return Math.floor(KAMPYLE_UTILS.getTimeDiff(sessionStartTimestamp,KAMPYLE_CONSTANT.TIME_FORMATS.SECONDS));}
  150. function getTimeOnPage(){var timeOnPage=Number(KAMPYLE_DATA.getData('kampylePageLoadedTimestamp'))||Date.now();return Math.floor(KAMPYLE_UTILS.getTimeDiff(timeOnPage,KAMPYLE_CONSTANT.TIME_FORMATS.SECONDS));}
  151. function getLastDeclineSubmit(key){var date=Number(KAMPYLE_DATA.getData(key));return!!date?KAMPYLE_UTILS.getTimeDiff(date,KAMPYLE_CONSTANT.TIME_FORMATS.DAYS):null;}
  152. 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);}
  153. return{increasePageViewCounter:increasePageViewCounter,subscribeToCustomEvents:subscribeToCustomEvents,subscribeToPageEvents:subscribeToPageEvents,createSession:createSession,updateTargeting:updateTargeting,checkProvision:checkProvision,getAllProvisions:getAllProvisions,onSyncIdentifierDataSuccess:onSyncIdentifierDataSuccess,shouldRenderForm:shouldRenderForm,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,prepareJsonData:prepareJsonData,shouldSkipFetchingFormData:shouldSkipFetchingFormData,init:init,startCheckingTargeting:startCheckingTargeting,isAnyOtherFormAlreadyShown:isAnyOtherFormAlreadyShown,isAnyInviteShown:isAnyInviteShown,getSafeCustomParamVal:getSafeCustomParamVal,isPreloadConfigured:isPreloadConfigured,kampyleGetData:kampyleGetData,kampyleButtonClicked:kampyleButtonClicked,loadMultipileForms:loadMultipileForms,routeToForm:routeToForm,updateIdentifierDataIntegerIfNecessary:updateIdentifierDataIntegerIfNecessary,syncIdentifierData:syncIdentifierData,getUserIdentifierVal:getUserIdentifierVal,handleFormStateUpdated:handleFormStateUpdated,hasApplicationLoadingFailed:hasApplicationLoadingFailed,isJsonDataLoaded:isJsonDataLoaded,handleInviteApplicationUpdated:handleInviteApplicationUpdated,isFormLoaded:isFormLoaded,};})();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].shouldBeShown){return formId;}}}
  154. return false;}
  155. 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:null,shouldBeShown:false,shown:false,inviteLoaded:null,inviteShown:false,targeting:{pageTargeting:null,behavioralTargeting:[],quarantineTargeting:[]}};}}
  156. setMemoryData('formsState',formsState);setMemoryData('hostingElementsHeights',{});}
  157. 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);}
  158. function getData(dataName){try{if(KAMPYLE_DATA.getPropertySharedSubdomain()){return KAMPYLE_UTILS.kampyleGetCookie(KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX+dataName);}
  159. return localStorage[dataName]||KAMPYLE_UTILS.kampyleGetCookie(dataName);}
  160. catch(e){return KAMPYLE_UTILS.kampyleGetCookie(dataName);}}
  161. function getMemoryData(dataName){dataName=dataName||'';return KAMPYLE_UTILS.getNestedPropertyValue(_memory,dataName);}
  162. function setMemoryData(dataName,dataValue){KAMPYLE_UTILS.setNestedPropertyValue(_memory,dataName,dataValue);}
  163. function deleteMemoryData(dataName){delete(_memory||{})[dataName];}
  164. function setData(dataName,dataValue,expriration){if(!KAMPYLE_DATA.getPropertySharedSubdomain()){try{localStorage[dataName]=dataValue;}
  165. catch(e){}}
  166. KAMPYLE_UTILS.kampyleSetCookie(dataName,dataValue,expriration||getCookieExpiration(),KAMPYLE_DATA.getPropertySharedSubdomain());return true;}
  167. var deleteData=function(dataName){var propertySharedSubdomain=KAMPYLE_DATA.getPropertySharedSubdomain();if(propertySharedSubdomain){KAMPYLE_UTILS.kampyleDeleteCookie(KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX+dataName,propertySharedSubdomain);return;}
  168. try{if(localStorage[dataName]!==undefined){delete localStorage[dataName];}}
  169. catch(e){}
  170. 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;}}
  171. return null;};function getMemory(){return _memory;}
  172. function getFormState(formId){formId=formId||'';return getMemoryData('formsState.'+formId)||null;}
  173. 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"&&allFormState[formId][prop]!==null){Object.assign(allFormState[formId][prop],data[prop]);}
  174. else{allFormState[formId][prop]=data[prop];}}
  175. setMemoryData('formsState',allFormState);}
  176. function getAllForms(){var allData=KAMPYLE_FUNC.kampyleGetData()||{};var allForms=allData.formNodes||[];return allForms;}
  177. function getInegrations(){var allData=KAMPYLE_FUNC.kampyleGetData()||{};return allData.integrations||{};}
  178. function getInviteData(formId){var formData=getFormData(formId);return!!formData?formData.inviteData:null;}
  179. function isNewMobileInvitation(){var hasProvision=KAMPYLE_FUNC.checkProvision('mobileInvitationLayout');var kampyleDevice=KAMPYLE_DATA.getMemoryData('kampyleDevice');return!!hasProvision&&kampyleDevice!=='desktop';}
  180. function isSkipInvitation(formId){var formData=getFormData(formId)||{};var isSkipInvitation=KAMPYLE_UTILS.getNestedPropertyValue(formData,'inviteData.skipInvitation')
  181. return isSkipInvitation&&isSkipInvitation!=="false";}
  182. function isFixedSize(formId){var formData=getFormData(formId)||{};return formData.isFixedSize===true||formData.isFixedSize==='true';}
  183. function isCustomHtmlAndFixedSizeForm(formId){var customHtmlForm=KAMPYLE_DATA.isCustomHtmlForm(formId);var hasProvision=KAMPYLE_FUNC.checkProvision('dynamicModalSizeInCustomHtml');return customHtmlForm&&(!hasProvision||hasProvision&&(isFixedSize(formId)));}
  184. 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;}
  185. else{return displayType||KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX;}}
  186. function saveFormExtraData(formId,extraData){extraData=extraData||{};var oldExtraData=(getFormState(formId)||{}).pendingExtraData||{};extraData=Object.assign(oldExtraData,extraData);setFormState(formId,{pendingExtraData:extraData});}
  187. function flushFormExtraData(formId){var formState=getFormState(formId)||{};var extraData={};if(formState&&formState.pendingExtraData){extraData=formState.pendingExtraData;delete formState.pendingExtraData;}
  188. return extraData;}
  189. function isCustomHtmlForm(formId){var formData=getFormData(formId)||{};var isCustomHtml=KAMPYLE_UTILS.getUrlParam('isCustomHtml');return formData.isCustomHtmlEnabled===true||formData.isCustomHtmlEnabled==='true'||isCustomHtml===true||isCustomHtml==='true';}
  190. function getCookieExpiration(){return KAMPYLE_UTILS.getNestedPropertyValue(dataJson,'cookieExpirationTime')||KAMPYLE_CONSTANT.COOKIE_EXPIRATION;}
  191. function getTargetingData(formId,targetingName){if(!formId||!targetingName||!TargetingMapping[targetingName]){return null;}
  192. var selectedForm=getFormData(formId)||{};var targetingRealName=TargetingMapping[targetingName];return KAMPYLE_UTILS.getNestedPropertyValue(selectedForm,'onSiteData.'+targetingRealName);}
  193. function getFormVersion(formId){var formData=KAMPYLE_DATA.getFormData(formId);return Number((formData||{}).formVersion)||0;}
  194. function getPropertyId(){return KAMPYLE_FUNC.kampyleGetData().websiteId||null;}
  195. 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;}
  196. function isMobile(){var device=KAMPYLE_DATA.getMemoryData('kampyleDevice');return(device&&device!=='desktop');}
  197. function getServerBasedTargetingPrefix(){return getMemoryData('dataJson.sbtServerDomain');}
  198. function getServerBasedTargetingEnv(){return getMemoryData('dataJson.sbtEnvPrefix');}
  199. function getCustomParams(){var formNodes=getMemoryData('dataJson.formNodes')||[];if(formNodes&&formNodes[0]&&formNodes[0].customParams){return formNodes[0].customParams;}
  200. return null;}
  201. function getPropertySharedSubdomain(){var sharedSubdomain=getMemoryData('dataJson.sharedSubdomain');return sharedSubdomain&&KAMPYLE_UTILS.isHostMatchesSubdomain(window.location.host,sharedSubdomain)?sharedSubdomain:null;}
  202. function getUserIdentifier(){var formNodes=KAMPYLE_DATA.getMemoryData('dataJson.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;}}
  203. return null;}
  204. function isPopupDisplayType(formId){var formData=getFormData(formId);return getDisplayType(formData)===KAMPYLE_CONSTANT.DISPLAY_TYPES.POPUP;}
  205. function isEmbeddedDisplayType(formId){var formData=getFormData(formId);return getDisplayType(formData)===KAMPYLE_CONSTANT.DISPLAY_TYPES.EMBEDDED;}
  206. function isLightBoxDisplayType(formId){var formData=getFormData(formId);return getDisplayType(formData)===KAMPYLE_CONSTANT.DISPLAY_TYPES.LIGHTBOX;}
  207. 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);}
  208. function getDataJsonUrl(formId,isInviteJson){var formData=KAMPYLE_DATA.getFormData(formId);var jsonDataUrl=KAMPYLE_UTILS.getNestedPropertyValue(formData,isInviteJson?'inviteData.inviteDataUrl':'formDataUrl')
  209. if(!jsonDataUrl){return null;}
  210. return KAMPYLE_DATA.localizeUrl(formId,jsonDataUrl);}
  211. 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);}
  212. if(!url){var error=new Error("Failed to get JSON data URL");return typeof obj.onError==="function"&&obj.onError(error);}
  213. 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});}
  214. if(!data){var error=new Error('Invalid form json data. Data: '+JSON.stringify(data));typeof obj.onError==="function"&&obj.onError(error);}else{KAMPYLE_DATA.setMemoryData(jsonDataMemoryKey,data);typeof obj.callback==="function"&&obj.callback(data);}},function(error){typeof obj.onError==="function"&&obj.onError(error);});}
  215. function getFormTriggerType(formId){var formType=KAMPYLE_UTILS.getNestedPropertyValue(KAMPYLE_DATA.getFormData(formId),'formType');return KAMPYLE_CONSTANT.FORM_TRIGGER_TYPES_MAP[formType]?formType:null;}
  216. 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,isSkipInvitation:isSkipInvitation,localizeUrl:localizeUrl,getMemory:getMemory,initFormState:initFormState,getDataJsonUrl:getDataJsonUrl};})();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',{});}
  217. function isDataValid(days,cookieName){var checkingDate=Number(KAMPYLE_DATA.getData(cookieName));days=Number(days);if(!checkingDate||!days){return false;}
  218. var msInOneDay=1000*60*60*24;return(checkingDate+(msInOneDay*days))>Date.now();}
  219. function handleButton(eventName,data){data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId);if(!formData){return false;}
  220. 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.EVENTS.NEB_LOAD_FORM,{formId:data.formId});}}
  221. KAMPYLE_DATA.setFormState(data.formId,{loaded:null});KAMPYLE_DATA.setMemoryData('buttonFormId',data.formId);KAMPYLE_EVENT_DISPATCHER.trigger('neb_showButton',{formId:data.formId});KAMPYLE_DATA.setMemoryData('isButtonShown',true);return true;}
  222. function getTextByQuarentine(quarentineKey){if(KAMPYLE_DATA.getData(quarentineKey)){return new Date(parseInt(KAMPYLE_DATA.getData(quarentineKey)));}
  223. else{return QUARANTINE_DEFAULT_TEXTS[quarentineKey];}}
  224. function isShowInvite(formData){var currentFormId=KAMPYLE_DATA.getMemoryData('currentInviteFormId');formData=formData||KAMPYLE_DATA.getFormData(currentFormId);if(!formData||KAMPYLE_DATA.getMemoryData('isInvitationShouldBeIgnored')){return false;}
  225. var targetingState=KAMPYLE_DATA.getMemoryData('targetingState');for(var index in targetingState){if(targetingState[index]!==true){return false;}}
  226. var shouldDisableIntercept=false;KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_BEHAVIORAL_TARGETING_PHASE_ENDED,formData);if(shouldDisableIntercept){return false;}
  227. var isQuarantinePassed=isQuarantinePhasePassed(formData);KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_QUARANTINED_SURVEY_PHASE_ENDED,formData);if(!isQuarantinePassed){return false;}
  228. 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;}
  229. function isQuarantinePhasePassed(formData){var isDeclined=false;var isSubmitted=false;var isFormIsShown=KAMPYLE_DATA.getMemoryData('formIsShown')===true;var isInviteAlreadyShown=KAMPYLE_TARGETING.isInviteAlreadyShownInSession(formData);isDeclined=isAlreadyDeclined(formData);isSubmitted=isAlreadySubmitted(formData);return(!isDeclined&&!isSubmitted&&!isFormIsShown&&!isInviteAlreadyShown)}
  230. function isUbtFailed(formData){var isUbtCheckFailed=KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.SERVER_BASED_TARGETING)&&KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.DO_NOT_SURVEY_ON_UBT_NETWORK_FAIL)&&!KAMPYLE_DATA.getMemoryData('isGuest')&&!KAMPYLE_DATA.getMemoryData('isSyncedIdentifierData');if(isUbtCheckFailed){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:!isUbtCheckFailed,expected:'should ignore quarantine rules evaluation',actual:isUbtCheckFailed,});}
  231. return isUbtCheckFailed;}
  232. 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;}
  233. function handleSkippedInvitaion(formData){if(!KAMPYLE_FUNC.isPreloadConfigured()){KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_LOAD_FORM,{formId:formData.formId});}
  234. KAMPYLE_EVENT_DISPATCHER.trigger('neb_skipInvitation',{formId:formData.formId});}
  235. function isAlreadySubmitted(formData){var isAlreadySubmitted=isSubmitted(formData.onSiteData)===true;var submittedDays=KAMPYLE_UTILS.getNestedPropertyValue(formData,'onSiteData.submitted.days');var submittedDateText=KAMPYLE_TARGETING.getTextByQuarentine("SUBMITTED_DATE");submittedDays&&KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:formData.formId,targetingRule:'DontInviteOnSubmitted',formTriggerType:KAMPYLE_DATA.getFormTriggerType(formData.formId),targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.QUARANTINE_TARGETING,isPassed:!isAlreadySubmitted,expected:submittedDays+" days",actual:"Current: "+Date()+" Submitted: "+submittedDateText,});return isAlreadySubmitted;}
  236. function isAlreadyDeclined(formData){var isAlreadyDeclined=isDeclined(formData.onSiteData)===true;var declinedDateText=KAMPYLE_TARGETING.getTextByQuarentine("DECLINED_DATE");var declinedDays=KAMPYLE_UTILS.getNestedPropertyValue(formData,'onSiteData.declined.days');declinedDays&&KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:formData.formId,targetingRule:'DontInviteOnDeclined',formTriggerType:KAMPYLE_DATA.getFormTriggerType(formData.formId),targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.QUARANTINE_TARGETING,isPassed:!isAlreadyDeclined,expected:declinedDays+" days",actual:"Current: "+Date()+" Declined: "+declinedDateText,});return isAlreadyDeclined;}
  237. function handleNotSkippedInvitaion(formData){if(KAMPYLE_DATA.getDisplayType(formData)===KAMPYLE_CONSTANT.DISPLAY_TYPES.POPUP){KAMPYLE_DATA.setFormState(formData.formId,{inviteShown:true});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.EVENTS.NEB_LOAD_FORM,{formId:formData.formId});}}
  238. function initTargetingObject(){var targetingState=KAMPYLE_DATA.getMemoryData('targetingState');targetingState.kampyleTimeInSession=false;if(KAMPYLE_DATA.getMemoryData('kampyleDevice')==='desktop'){targetingState.abandon=false;}
  239. targetingState.kampyleTimeOnPage=false;KAMPYLE_DATA.setMemoryData('targetingState',targetingState);}
  240. 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;}}
  241. 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;}}
  242. 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;}
  243. function isGenericRuleValid(data){if(data&&data.onSiteData&&data.onSiteData.genericRule){if(typeof data.onSiteData.genericRule==='string'){data.onSiteData.genericRule=JSON.parse(data.onSiteData.genericRule);}
  244. return KAMPYLE_TARGETING.evaluateRule(data.onSiteData.genericRule,data);}
  245. return true;}
  246. 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'),}));}
  247. return canShow;}
  248. function isUrlMatch(urlToMatch){if(!(typeof urlToMatch==='string')){return false;}
  249. urlToMatch=urlToMatch.toLowerCase();var currentUrl=document.location.href.toLowerCase();var matchUrl=currentUrl.substring(0,urlToMatch.length);if(matchUrl===urlToMatch){return true;}
  250. else{currentUrl=currentUrl.replace(/^(?:https?:\/\/)?(?:www\.)?([^\/]+)/i,'');matchUrl=currentUrl.substring(0,urlToMatch.length);if(matchUrl===urlToMatch){return true;}}
  251. return false;}
  252. 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;}}
  253. return false;}
  254. function isUrlExcluded(data){if(!!data.urlRules&&!!data.urlRules.exclusionUrl){if(!!data.urlRules.exclusionUrl.rule){var isExcluded=isUrlLimits(data.urlRules.exclusionUrl.rule);return isExcluded;}}
  255. return false;}
  256. function isUrlIncluded(data){if(!!data.urlRules&&!!data.urlRules.inclusionUrl){if(!!data.urlRules.inclusionUrl.rule){var isIncluded=isUrlLimits(data.urlRules.inclusionUrl.rule);return isIncluded;}}
  257. return true;}
  258. 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;}
  259. else{return true;}
  260. return true;}
  261. function evaluateCriteria(criteria,formData){var evaluation=false;var paramValue;var secondParamValue;var isAllowedOperator;if(!criteria){return false;}
  262. 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;}
  263. 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);}
  264. if(paramValue!==undefined&&isAllowedOperator){evaluation=KAMPYLE_UTILS.kampyleCompareByOperator(paramValue,secondParamValue,condition,customParamObj.type);}
  265. break;default:break;}}
  266. return evaluation;}
  267. 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')
  268. {finalEval=true;stopFlag=true;}
  269. else if(!tmpEval&&toEvaluate.conjunction==='AND')
  270. {finalEval=false;stopFlag=true;}
  271. else{finalEval=tmpEval;}}}
  272. else if(toEvaluate&&toEvaluate.type==='criteria'){finalEval=evaluateCriteria(toEvaluate,formData);}
  273. return finalEval;}
  274. 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;}}
  275. return false;}
  276. return true;}
  277. function checkPagesInSession(sessionPageObj){sessionPageObj=sessionPageObj||{};var pageCount=Number(KAMPYLE_DATA.getData('kampyleSessionPageCounter')||0);return KAMPYLE_UTILS.kampyleCompareByOperator(pageCount,parseInt(sessionPageObj.numberOfRepeats),sessionPageObj.compareString);}
  278. function timeInSession(time,formData){validateGap(time,formData);}
  279. function getTimeInSession(){var kampyleUserSession=KAMPYLE_DATA.getData('kampyleUserSession');var kampyleUserSessionTimestamp=parseInt(kampyleUserSession);var diff=KAMPYLE_UTILS.getTimeDiff(kampyleUserSessionTimestamp);return diff;}
  280. function validateGap(time,formData){var requiredTimeInSession=parseInt(time)*1000;var timeInSession=getTimeInSession();var targetingState=KAMPYLE_DATA.getMemoryData('targetingState');if(targetingState&&timeInSession>=requiredTimeInSession){targetingState.kampyleTimeInSession=true;KAMPYLE_DATA.setMemoryData('targetingState',targetingState);KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:formData.formId,targetingRule:'TimeInSession',formTriggerType:KAMPYLE_DATA.getFormTriggerType(formData.formId),targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.BEHAVIORAL_TARGETING,isPassed:true,expected:requiredTimeInSession,actual:"Over on the expected "+requiredTimeInSession,});isShowInvite();}
  281. else{var randomTime=0;var diff=requiredTimeInSession-timeInSession;var thisObj=this;setTimeout(function(){validateGap(time,formData);},diff+randomTime);}}
  282. function isDeclined(data){data=data||{};if(data.declined!==null&&data.declined!==undefined){var isStillDeclined=isDataValid(data.declined.days,'DECLINED_DATE');return isStillDeclined;}
  283. return false;}
  284. function isInviteShownInSession(oncePerSessionObj){var inviteShownFlag=KAMPYLE_DATA.getData('kampyleInvitePresented');var inviteShownFlag=(inviteShownFlag===true||inviteShownFlag==='true');oncePerSessionObj=oncePerSessionObj||{};var configuredOncePerSession=(oncePerSessionObj.inviteOncePerSession===true||oncePerSessionObj.inviteOncePerSession==='true');if(configuredOncePerSession===true){return false;}
  285. return!!inviteShownFlag;}
  286. function isSubmitted(data){if(KAMPYLE_UTILS.getNestedPropertyValue(data,'submitted')){var isStillSubmitted=isDataValid(data.submitted.days,'SUBMITTED_DATE');return isStillSubmitted;}
  287. return false;}
  288. function checkAbandon(formData){KAMPYLE_DATA.setMemoryData('targetingState.abandon',true);KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:formData.formId,targetingRule:'UserAbandonment',formTriggerType:KAMPYLE_DATA.getFormTriggerType(formData.formId),isPassed:true,targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.BEHAVIORAL_TARGETING,expected:"Mouse over user abandonment",actual:"Mouse was over user abandonment",});if(isShowInvite()===false){KAMPYLE_DATA.setMemoryData('targetingState.abandon',false);}}
  289. function abandon(abandonObj,formData){var zIndexDef="0",heightDef="5";if(!abandonObj){abandonObj={height:heightDef,zIndex:zIndexDef};}
  290. var zIndex=(!!abandonObj.zIndex)?abandonObj.zIndex:zIndexDef;var height=(!!abandonObj.height&&abandonObj.height!=="0")?abandonObj.height+'px':heightDef+'px';var abandon=document.getElementById('kampyle_abandon_zone');if(abandon===null){var abandon=document.createElement('div');abandon.id='kampyle_abandon_zone';abandon.style.width='100%';abandon.style.height=height;abandon.style.zIndex=zIndex;abandon.style.position='fixed';abandon.style.top='0px';abandon.onmouseover=function(){checkAbandon(formData);};document.body.appendChild(abandon);}
  291. else{abandon.style.height=height;abandon.style.zIndex=zIndex;}}
  292. function sendTimeOnPageEventData(formData){var timeOnPage=KAMPYLE_UTILS.getNestedPropertyValue(formData,'onSiteData.kampyleTimeOnPage.time');timeOnPage&&KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:formData.formId,targetingRule:'TimeOnPage',formTriggerType:KAMPYLE_DATA.getFormTriggerType(formData.formId),isPassed:true,targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.BEHAVIORAL_TARGETING,expected:timeOnPage,actual:"Over on the expecetd "+timeOnPage,});}
  293. function timeOnPage(time,formData){if(time===null){KAMPYLE_DATA.setMemoryData('targetingState.kampyleTimeOnPage',true);return;}
  294. var thisObj=this;var timeOnPageTimeOut=setTimeout(function(){KAMPYLE_DATA.setMemoryData('targetingState.kampyleTimeOnPage',true);sendTimeOnPageEventData(formData);isShowInvite();},time*1000);KAMPYLE_DATA.setData('kampylePageLoadedTimestamp',Date.now());}
  295. function getUserPercentile(formId){var percentile=KAMPYLE_DATA.getData('kampyleUserPercentile');if(!percentile&&percentile!=='0')
  296. {percentile=Math.random()*100;KAMPYLE_DATA.setData('kampyleUserPercentile',percentile);}
  297. if(Number(percentile)&&Number(percentile).toFixed){return Number(percentile).toFixed(1);}
  298. else{return Number(percentile);}}
  299. function invitePercentageUsers(precUsersObj){var userPercentile=getUserPercentile();if(!!precUsersObj&&!!userPercentile){var prec=Number(precUsersObj.prec);if(userPercentile>prec){return false;}}
  300. return true;}
  301. function initDynamicTargeting(formData){KAMPYLE_DATA.setMemoryData('isInviteActivated',true);var targetingState=KAMPYLE_DATA.getMemoryData('targetingState');if(formData.onSiteData.kampyleTimeInSession!==undefined){timeInSession(formData.onSiteData.kampyleTimeInSession.time,formData);}
  302. else{targetingState.kampyleTimeInSession=true;}
  303. if(!!formData.onSiteData.abandon){if(KAMPYLE_DATA.getMemoryData('kampyleDevice')==='desktop'){abandon(formData.onSiteData.abandon,formData);}}
  304. else{targetingState.abandon=true;}
  305. if(formData.onSiteData.kampyleTimeOnPage!==undefined){timeOnPage(formData.onSiteData.kampyleTimeOnPage.time,formData);}
  306. else{targetingState.kampyleTimeOnPage=true;}
  307. KAMPYLE_DATA.setMemoryData('targetingState',targetingState);for(var key in targetingState){if(targetingState.hasOwnProperty(key)&&!targetingState[key]){return false;}}
  308. isShowInvite(formData);}
  309. function initTargeting(eventName,data){initTargetingMemoryData();initTargetingObject();initEmbeddedTargeting();handleFormsTargeting(eventName,data);}
  310. 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',{});}
  311. function initEmbeddedTargeting(){var allForms=KAMPYLE_DATA.getAllForms();if(!allForms||!allForms.length){return;}
  312. 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.EVENTS.NEB_LOAD_FORM,{formId:allForms[i].formId});}}}}
  313. 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});}
  314. return userIdentifierVal;}
  315. 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);}}
  316. function initFormsTargeting(eventName,data){data=data||{};var allForms=KAMPYLE_DATA.getAllForms();if(!allForms||!allForms.length){return;}
  317. 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});}}
  318. 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]);}}
  319. if(KAMPYLE_DATA.getMemoryData('isInviteActivated')===true&&KAMPYLE_DATA.getMemoryData('isButtonShown')===true){break;}}
  320. KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_PAGE_TARGETING_PHASE_ENDED);}
  321. 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))}
  322. function validateInviteTargeting(formId){formId=formId||'';KAMPYLE_DATA.setMemoryData('currentInviteFormId',formId);var data=KAMPYLE_DATA.getFormData(formId);if(KAMPYLE_UTILS.getNestedPropertyValue(data,'onSiteData.kampyleInvitePercentageUsers.prec')){var invitePercentageUsersResult=invitePercentageUsers(data.onSiteData.kampyleInvitePercentageUsers);KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:data.formId,targetingRule:'UsersPercentage',formTriggerType:KAMPYLE_DATA.getFormTriggerType(data.formId),targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,isPassed:invitePercentageUsersResult,expected:KAMPYLE_UTILS.getNestedPropertyValue(data,'onSiteData.kampyleInvitePercentageUsers.prec'),actual:getUserPercentile(),});if(invitePercentageUsersResult===false){return false;}}
  323. var numberOfPagesResult=!!data.onSiteData.numberOfPagesViewed&&checkPagesInSession(data.onSiteData.numberOfPagesViewed)===false;(KAMPYLE_UTILS.getNestedPropertyValue(data,'onSiteData.numberOfPagesViewed.numberOfRepeats')&&KAMPYLE_EVENT_DISPATCHER.trigger('MDigital_targetingRuleEvaluated',{formId:data.formId,targetingRule:'NumberOfPagesViewed',targetingPhase:KAMPYLE_CONSTANT.TARGETING_PHASES.PAGE_TARGETING,isPassed:!numberOfPagesResult,expected:KAMPYLE_UTILS.getNestedPropertyValue(data,'onSiteData.numberOfPagesViewed.numberOfRepeats'),actual:KAMPYLE_DATA.getData('kampyleSessionPageCounter'),}));if(numberOfPagesResult){return false;}
  324. if(data.inviteData.skipInvitation===true||data.inviteData.skipInvitation==='true'){if(KAMPYLE_FUNC.isPreloadConfigured()){KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_LOAD_FORM,{formId:formId});}}
  325. else{KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadInvitation',{formId:formId});}
  326. return true;}
  327. function setTargetingState(targetingName,isPassed){KAMPYLE_DATA.setMemoryData('targetingState.'+targetingName,isPassed);}
  328. function generateShouldShowInviteParamName(formId){if(!formId){return null;}
  329. return'shouldShowInvite'+'_'+formId;}
  330. 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,checkPagesInSession:checkPagesInSession,targetingDevice:targetingDevice,getUserPercentile:getUserPercentile,invitePercentageUsers:invitePercentageUsers,validateGap:validateGap,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],neb_formLoadingHasFailed:[hideAnimationContainer],neb_skipShowingForm:[hideFormAnimationContainer]};KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);var formSpanPlacer=document.createElement('span');var divAnimationContainer=document.createElement('div');KAMPYLE_UTILS.addAttributesOnElement(divAnimationContainer,{id:CONSTANTS.CONTAINER_ID});divAnimationContainer.style.zIndex='2147483000';formSpanPlacer.appendChild(divAnimationContainer);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',});}
  331. hideAnimationContainer();}
  332. function animateWithInit(eventName,data){initAnimationPosition(eventName,data);setTimeout(function(){animateIn(eventName,data);},10);}
  333. function shouldIgnoreRenderAnimationForm(formData,animationContainer,formId){return!formData||!animationContainer||!isAnimationForm(formData)||KAMPYLE_FUNC.hasApplicationLoadingFailed(formId,false)}
  334. function animateIn(eventName,data){data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId);var animationContainer=document.getElementById(CONSTANTS.CONTAINER_ID);if(shouldIgnoreRenderAnimationForm(formData,animationContainer,data.formId)){return false;}
  335. KAMPYLE_DATA.setMemoryData('isInvitationShouldBeIgnored',true);var formIframe=document.getElementById(CONSTANTS.IFRAME_ID+data.formId);if(formIframe){formIframe.style.display='block';}
  336. 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;}}
  337. function hideAnimationContainer(){var animationContainer=document.getElementById(CONSTANTS.CONTAINER_ID);if(animationContainer){KAMPYLE_UTILS.setElementStyle(animationContainer,{width:0,height:0,});}}
  338. 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');}}}
  339. hideAnimationContainer();},1000);}
  340. function animateOut(eventName,data){var formData=KAMPYLE_DATA.getFormData(data.formId);if(KAMPYLE_DATA.getDisplayType(formData)!=='animation'){return false;}
  341. data=data||{};var animationContainer=document.getElementById(CONSTANTS.CONTAINER_ID);if(!formData||!animationContainer||!isAnimationForm(formData)){return false;}
  342. setAnimationContainerInitialPosition(formData,animationContainer);}
  343. function getMiddleHeight(formHeight){return String((window.innerHeight-parseInt(formHeight,10))/2)+'px';}
  344. function getDisplayDirection(formData){formData=formData||{};return KAMPYLE_UTILS.getNestedPropertyValue(formData,'formDisplay.displayDirection')||DEFAULTS.ANIMATION_DIRECTION;}
  345. 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;}}
  346. function isAnimationForm(formData){return KAMPYLE_DATA.getDisplayType(formData)==='animation';}
  347. function hideFormAnimationContainer(eventName,data){var formData=KAMPYLE_DATA.getFormData(data.formId);if(isAnimationForm(formData)){var formIframe=document.getElementById(CONSTANTS.IFRAME_ID+data.formId);if(formIframe){KAMPYLE_UTILS.setElementStyle(formIframe,{display:'none',});}}}
  348. 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;}
  349. 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);}
  350. var formHtml=formData.formHtmlUrl;formHtml=KAMPYLE_COMMON.createFormUrl(formHtml,data.formId);formIframe.src=formHtml;}
  351. function initAnimationPosition(eventName,data){data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId);var isSkipInvitation=KAMPYLE_DATA.isSkipInvitation(data.formId);var animationContainer=document.getElementById(CONSTANTS.CONTAINER_ID);if(!animationContainer||!formData||!isAnimationForm(formData)||(isSkipInvitation&&KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId))){return false;}
  352. if(!document.getElementById(CONSTANTS.IFRAME_ID+data.formId)){createFormIframe(eventName,data);}
  353. KAMPYLE_UTILS.setElementStyle(animationContainer,{height:formData.formHeight+'px',width:formData.formWidth+'px',});setAnimationContainerInitialPosition(formData,animationContainer);}
  354. return{initAnimationPosition:initAnimationPosition,getDisplayDirection:getDisplayDirection,init:init,hideAnimationContainer:hideAnimationContainer,hideFormAnimationContainer:hideFormAnimationContainer,};})();window.KAMPYLE_VIEW=(function(window,document){var DEFAULTS={CORNER_MARGIN:0,TRIANGULAR_MARGIN:0,VERTICAL_MARGIN:30,};var BUTTON_FUNCTION_ENUM={vertical:'getVerticalButton',triangular:'getTriangularButton',custom:'getCustomButton',}
  355. function handleInviteReady(eventName,data){data=data||{};if(KAMPYLE_FUNC.hasApplicationLoadingFailed(data.formId,true)){return;}
  356. var inviteContainer=document.getElementById('kampyleInviteContainer');if(newMobileInvite()){restoreHostingDOM();if(inviteContainer){KAMPYLE_UTILS.setElementStyle(inviteContainer,{top:'',bottom:'',left:'',right:'',background:'none',visibility:'',display:'none',},true);}}
  357. else{KAMPYLE_UTILS.setElementStyle(inviteContainer,{visibility:'visible',},true);var iframe=document.getElementById('kampyleInvite');if(iframe){KAMPYLE_UTILS.setElementStyle(iframe,{visibility:'visible',},true);}}}
  358. function onKeyboardClose(e){KAMPYLE_UTILS.showInvite();KAMPYLE_UTILS.removeEventHandler(e.srcElement,'blur',onKeyboardClose);}
  359. function onKeyboardOpen(e){KAMPYLE_UTILS.hideInvite();KAMPYLE_UTILS.setEventHandler(e.srcElement,'blur',onKeyboardClose);}
  360. 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]);}
  361. for(i=0;i<textarea.length;i++){allFocusableElements.push(textarea[i]);}
  362. return allFocusableElements;}
  363. 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);}}}
  364. 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);}}}
  365. 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);}}
  366. function scrollToEmbeddedForm(formId){document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX+formId).scrollIntoView();}
  367. function doScrollY(numOfPixels){window.scrollTo(0,numOfPixels);}
  368. function scrollToTop(eventName,data){data=data||{};if(!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)){doScrollY(0);}}
  369. 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);}
  370. else{KAMPYLE_VIEW.doScrollY(pixelsToScroll);}}
  371. function handleInvitationSkippedForms(eventName,data){if(KAMPYLE_DATA.getData('isSkipInvitationOptimized')!=='true'){return;}
  372. KAMPYLE_UTILS.setElementStyle(document.getElementById('kampyleFormContainer'),{visibility:'visible',},true);KAMPYLE_VIEW.prepareHostingDOM();KAMPYLE_DATA.setData('isSkipInvitationOptimized',false);}
  373. 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_inviteHeightChanged:[changeInviteHeight],neb_iFrameHeightChanged:[reactToIframeHeightChange],neb_scrollToTop:[scrollToTop],neb_scrollFromTop:[scrollFromTop],neb_inviteReady:[handleInviteReady,setupListenersForHideInviteWhenVirtualKeyboardIsOpen],neb_scrollToForm:[scrollToForm],neb_showButton:[showButton,alignButtonWithForm],neb_buttonClicked:[handleButtonClicked],neb_sdkShowForm:[hideButton],neb_captureInit:[hideVisibility,hideButton],neb_inviteAccepted:[hideInvite,hideButton,removeListenersForHideInviteWhenVirtualKeyboardIsOpen],neb_showForm:[showForm],neb_sdkPageView:[hideInvite,removeListenersForHideInviteWhenVirtualKeyboardIsOpen],neb_inviteDeclined:[hideInvite,removeListenersForHideInviteWhenVirtualKeyboardIsOpen],neb_formClosed:[hideForm],neb_popupBlocked:[hideForm],neb_formHide:[hideVisibility],neb_captureImageClicked:[showVisibility],neb_cancelCaptureClicked:[showVisibility],neb_formLoadingHasFailed:[showFormCouldNotFechtedErrorMsg],};eventMapping.neb_showButton.push(setVerticalOffset);KAMPYLE_EVENT_DISPATCHER.subscribeMany(eventMapping);if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){KAMPYLE_UTILS.addStyle('.noOutline{outline: none !important;}');KAMPYLE_UTILS.addStyle('.wcagOutline:focus{outline: 1px dashed #595959 !important;outline-offset: 2px !important;transition: none !important;}');}
  374. KAMPYLE_UTILS.setEventHandler(window,'resize',function(e){updateIframeStyle();});}
  375. 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});}}}
  376. function hideSpinner(eventName,data){toggleSpinner(false);}
  377. function showSpinner(eventName,data){toggleSpinner(true);}
  378. function scrollToForm(eventName,data){document.getElementById('kampyleFormContainer').scrollIntoView();}
  379. 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;}}
  380. else{margin=DEFAULTS.CORNER_MARGIN;}
  381. return parseInt(margin,10);}
  382. function getButtonDirection(formData){formData=formData||{};return KAMPYLE_UTILS.getNestedPropertyValue(formData,'buttonData.position')||'right';}
  383. 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;}
  384. var cornerMargin=getCornerMargin(formData)+'px';switch(getButtonDirection(formData)){case'bottomRight':buttonContainer.style.right=cornerMargin;break;case'bottomLeft':buttonContainer.style.left=cornerMargin;break;default:break;}}
  385. 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';}}}}
  386. function showVisibility(eventName,data){var currentFormId=KAMPYLE_DATA.getMemoryData('currentFormId');var formData=KAMPYLE_DATA.getFormData(currentFormId);if(KAMPYLE_DATA.getDisplayType(formData)==='animation'){return false;}
  387. var formContainer=document.getElementById('kampyleFormContainer');var formIframe=document.getElementById('kampyleForm'+currentFormId);if(!!formContainer&&!!formIframe)
  388. {KAMPYLE_UTILS.setElementStyle(formContainer,{display:'block',visibility:'visible',},true);}}
  389. function getWCAGClass(){return KAMPYLE_DATA.isFeatureEnabled('WCAG')?' wcagOutline ':' noOutline ';}
  390. function hideVisibility(){var currentFormId=KAMPYLE_DATA.getMemoryData('currentFormId');if(!currentFormId){return;}
  391. var formContainer=document.getElementById('kampyleFormContainer');var formIframe=document.getElementById('kampyleForm'+currentFormId);var noDataContainer=document.getElementById("mdigital-no-json-modal_"+currentFormId);if(!!formContainer&&(!!formIframe||!!noDataContainer))
  392. {KAMPYLE_UTILS.setElementStyle(formContainer,{display:'none',visibility:'hidden',},true);}}
  393. 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();}}
  394. KAMPYLE_UTILS.setElementStyle(currIframe,{display:'none',},true);if(currIframe.removeAttribute){currIframe.removeAttribute('origin');}}
  395. hideVisibility();restoreHostingDOM();}
  396. if(!KAMPYLE_FUNC.checkProvision("disableFormReloadOnClose")||KAMPYLE_DATA.isPopupDisplayType(currentFormId)){if(data.sourceWindow&&data.sourceWindow.close){data.sourceWindow.close();}}}
  397. 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;}
  398. 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;}
  399. function getTriangleButtonStyle(formData){var buttonText=KAMPYLE_VIEW.getButtonText(formData);var classDirection=getClassDirectonByPosition(formData.buttonData.position);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 data-aut="feedback" class="kampyle_button-text '+classDirection.topbottom+'">'+buttonText+'</div></button>';}
  400. 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;}
  401. 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 data-aut="feedback" class="kampyle_button-text">'+buttonText+'</div></button>';}
  402. 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'';}
  403. KAMPYLE_UTILS.addStyle(btnBuilders.style({textColor:formData.buttonData.textColor,backgroundColor:formData.buttonData.backgroundColor,}));return btnBuilders.html(formData);}
  404. 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;}
  405. 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>';}
  406. function showIframeContainers(formId){setMetaViewport('add');var kampyleFormContainer=document.getElementById('kampyleFormContainer');if(kampyleFormContainer){var currIframe=document.getElementById('kampyleForm'+formId);if(!!currIframe){KAMPYLE_UTILS.setElementStyle(currIframe,{display:'block',},true);}
  407. KAMPYLE_UTILS.setElementStyle(kampyleFormContainer,{display:'block',visibility:'visible',},true);}}
  408. function onErrModalClose(formId){var NO_JSON_MODAL_ID="mdigital-no-json-modal_"+formId;hideForm({formId:formId});document.getElementById(NO_JSON_MODAL_ID).style.display="none";KAMPYLE_DATA.setFormState(formId,{shown:false});showButton("",{formId:KAMPYLE_DATA.getMemoryData('buttonFormId')});KAMPYLE_UTILS.triggerCustomEvent('MD_errorModalClosed',{});}
  409. function getErrorFetchedModal(formId){var errorModalWidth=KAMPYLE_DATA.isMobile()?'98%':"450px";var NO_JSON_MODAL_ID="mdigital-no-json-modal_"+formId;if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){var errModal=document.createElement('div');errModal.innerHTML='<div id="'+NO_JSON_MODAL_ID+'" style="position:relative; text-align:center; background:rgba(255,255,255, 1); margin:auto; border: 1px solid #cccccc; box-shadow:8px 10px 58px 2px rgba(64, 64, 74, 0.56); color:rgb(64, 64, 74); margin-bottom:2%; height:500px; margin-top:5%; width:'+errorModalWidth+' ; ">'+
  410. KAMPYLE_CONSTANT.SVGS.NO_DATA_MODAL_IMG+
  411. KAMPYLE_CONSTANT.SVGS.CLOSE_NO_DATA_MODAL_BTN+'<span style="font-size:24px; font-weight:bold; margin:auto; display:block; font-family:helvetica, Bold; margin-top:38px">Oops...</span>'+'<span style="padding: 0 44px 0 44px; font-size:17px; margin:auto; display:block; font-family:helvetica; margin-top:10px">We can’t collect your feedback at the moment. </span>'+'<span style="padding: 0 44px 0 44px; font-size:17px; margin:auto; display:block; font-family:helvetica; margin-top:5px">Refresh your page and try again</span>'+'<div>';return errModal;}}
  412. function handleButtonClicked(eventName,data){var formData=KAMPYLE_DATA.getFormData(data.formId);var displayType=KAMPYLE_DATA.getDisplayType(formData);displayType=displayType.toLowerCase();if(displayType==='lightbox'){var kampyleFormContainer=document.getElementById('kampyleFormContainer');if(!kampyleFormContainer||KAMPYLE_FUNC.hasApplicationLoadingFailed(data.formId,false)||KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId,true)){return false;}
  413. KAMPYLE_UTILS.setElementStyle(kampyleFormContainer,{display:'block',visibility:'visible',},true);}}
  414. function getClassDirectonByPosition(position){var classDirection={topbottom:'kampyle_bottom',leftright:'kampyle_bottom-left'};switch(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;}
  415. return classDirection;}
  416. function shouldShowErrMsgOnForm(formId){var formTriggerType=KAMPYLE_DATA.getFormTriggerType(formId);return MDIGITAL.FORM_STATE.shouldFormBeShown(formId)&&(formTriggerType===KAMPYLE_CONSTANT.FORM_TYPES.BUTTON||formTriggerType===KAMPYLE_CONSTANT.FORM_TYPES.CODE);}
  417. function showFormCouldNotFechtedErrorMsg(eventName,data){if(KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId)||!KAMPYLE_VIEW.shouldShowErrMsgOnForm(data.formId)){return;}
  418. var NO_JSON_MODAL_ID="mdigital-no-json-modal_"+data.formId;var kampyleFormModal=document.getElementById('kampyleFormModal');hideSpinner();showIframeContainers(data.formId);if(document.getElementById(NO_JSON_MODAL_ID)){document.getElementById(NO_JSON_MODAL_ID).style.display="block";}
  419. else{var fetchedDataErrrModal=getErrorFetchedModal(data.formId);if(!kampyleFormModal){createFormContainer();kampyleFormModal=document.getElementById('kampyleFormModal');showIframeContainers(data.formId);}
  420. kampyleFormModal.innerHTML="";kampyleFormModal.appendChild(fetchedDataErrrModal);var closeBtnElem=document.querySelector("#"+NO_JSON_MODAL_ID+" #close-no-json-modal");closeBtnElem.onclick=onErrModalClose.bind(null,data.formId);}
  421. KAMPYLE_DATA.setFormState(data.formId,{shown:true});hideButton("",{formId:KAMPYLE_DATA.getMemoryData('buttonFormId')});}
  422. function showButton(eventName,data){var btnHtml='';data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId)||{};var buttonType=KAMPYLE_UTILS.getNestedPropertyValue(formData,'buttonData.type')||'';if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){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;}
  423. var spanContainer=document.getElementById('kampyleButtonContainer');if(spanContainer===null){spanContainer=document.createElement('span');spanContainer.innerHTML=btnHtml;spanContainer.id='kampyleButtonContainer';document.body.appendChild(spanContainer);}
  424. else{spanContainer.innerHTML=btnHtml;}}
  425. KAMPYLE_EVENT_DISPATCHER.trigger('neb_button_displayed',{formId:data.formId,position:KAMPYLE_UTILS.getNestedPropertyValue(formData,'buttonData.position')||'',});spanContainer.onclick=function(event){if(!KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId,true)){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;}
  426. 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);}
  427. else{KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm',{formId:data.formId});}
  428. 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:if(!KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId,true)){KAMPYLE_EVENT_DISPATCHER.trigger('neb_buttonClicked',{formId:data.formId});}
  429. break;default:break;}};}
  430. function setIframeOrigin(eventName,data){var formIframe=document.getElementById('kampyleForm'+data.formId);if(formIframe&&formIframe.setAttribute){formIframe.setAttribute('origin',data.origin);}}
  431. function updateIframeStyle(formData){var currentFormId=KAMPYLE_DATA.getMemoryData('currentFormId')||KAMPYLE_DATA.getShownFormId();if(document.getElementById('kampyleFormContainer')===null||!currentFormId){return;}
  432. formData=formData||KAMPYLE_DATA.getFormData(currentFormId)||{};if(KAMPYLE_DATA.isMobileDynamicSizing(formData.formId)){return updateDynamicIframeStyle(formData);}else{updateStaticIframeStyle(formData);}}
  433. 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;}
  434. 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,};}
  435. 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';}}
  436. else{iframeStyleObject={position:'fixed',height:'100%',width:'100%',};}
  437. var modal=document.getElementById('kampyleFormModal');if(modal&&modal.style&&modal.removeAttribute){modal.removeAttribute('style');KAMPYLE_UTILS.setElementStyle(modal,iframeStyleObject,true);}}
  438. function updateDynamicIframeStyle(formData){var spanContainer=document.getElementById('formLightboxContainer');if(spanContainer){spanContainer.setAttribute('aria-hidden',false);}
  439. var modal=document.getElementById('kampyleFormModal');if(modal){KAMPYLE_UTILS.setElementStyle(modal,{top:0,margin:0,width:'100%',},true);}}
  440. 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);var isPopupBlocked=!popupHandler||popupHandler.closed||typeof popupHandler.closed=='undefined'
  441. KAMPYLE_DATA.setMemoryData('popupHandler',popupHandler);setTimeout(function(){if(isPopupBlocked){if(eventName!=='neb_skipInvitation'){alert("The survey was blocked, please disable popup blocker and refresh the page.");}
  442. KAMPYLE_EVENT_DISPATCHER.trigger('neb_popupBlocked',{formId:formId});}},25);}
  443. function handlePopupShow(formUrl,formId,formWidth,formHeight,eventName){if(KAMPYLE_FUNC.shouldRenderForm({formId:formId})){openPopup(formUrl,formId,formWidth,formHeight,eventName);}}
  444. function showForm(eventName,data){var isSkipInvitationEvent=eventName==='neb_skipInvitation';data=data||{};var formData=KAMPYLE_DATA.getFormData(data.formId);if(KAMPYLE_VIEW.ignoreShowForm(formData)||KAMPYLE_FUNC.hasApplicationLoadingFailed(data.formId,false)||KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(data.formId,true)){return false;}
  445. 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);if(!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)){KAMPYLE_DATA.setMemoryData('formIsShown',true);KAMPYLE_DATA.setMemoryData('isInvitationShouldBeIgnored',true);}
  446. var kampyleDevice=KAMPYLE_DATA.getMemoryData('kampyleDevice');var shouldOptimizeSkipInvitation=isSkipInvitationEvent&&KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.SKIP_INVITATION_OPTIMIZATION);if(displayType==='lightbox'){if(!shouldOptimizeSkipInvitation){KAMPYLE_VIEW.prepareHostingDOM();}else{KAMPYLE_DATA.setData('isSkipInvitationOptimized',true);}
  447. 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);}
  448. KAMPYLE_UTILS.setElementStyle(kampyleFormContainer,{display:'block',visibility:shouldOptimizeSkipInvitation?'hidden':'visible',},true);}
  449. else{KAMPYLE_UTILS.showWarning("formContainer wasn't loaded properly");}}
  450. else if(displayType==='popup'){handlePopupShow(formUrl,data.formId,formWidth,formHeight,eventName);}
  451. return true;}
  452. function ignoreShowForm(formData){return(!formData||KAMPYLE_DATA.getDisplayType(formData)==='animation')}
  453. function hideInvite(){KAMPYLE_DATA.setMemoryData('inviteLoadedAndShown',false);setMetaViewport('remove');var inviteContainer=document.getElementById('kampyleInviteContainer');var kampyleInvite=document.getElementById('kampyleInvite');if(inviteContainer&&kampyleInvite){KAMPYLE_UTILS.setElementStyle(inviteContainer,{display:'none',},true);restoreHostingDOM();}}
  454. function changeInviteHeight(eventName,data){data=data||{};var positions=['top','bottom'];var isInviteShown=(KAMPYLE_DATA.getFormState(data.formId)||{}).inviteShown;if(!newMobileInvite()||!isInviteShown){return false;}
  455. 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();}
  456. 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);}
  457. function setMetaViewport(optional){optional=optional||'';if(KAMPYLE_DATA.getMemoryData('kampyleDevice')==='desktop'){return;}
  458. 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]);}}}
  459. 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;}
  460. else{if(savedViewportContent[i].remove){savedViewportContent[i].remove();}}}}
  461. 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';}
  462. break;case'remove':if(kampyleMeta){kampyleMeta.content='';kampyleMeta.name='';if(kampyleMeta.remove){kampyleMeta.remove();}}
  463. if(savedViewportContent&&savedViewportContent.length){for(var i=savedViewportContent.length-1;i>=0;i--){if(savedViewportContent[i].hasAttribute('id')&&savedViewportContent[i].id==='kampyleMetaViewport'){continue;}
  464. else{document.getElementsByTagName('head')[0].appendChild(savedViewportContent[i]);}}}
  465. break;}
  466. KAMPYLE_DATA.setMemoryData('hostedViewportContent',savedViewportContent);}
  467. function newMobileInvite(){return(Number(KAMPYLE_DATA.getMemoryData('inviteVersion'))>0)&&KAMPYLE_DATA.isNewMobileInvitation();}
  468. function getInvitePosition(formId){var formData=(KAMPYLE_DATA.getFormData(formId)||{});return(formData.inviteData||{}).invitationPosition||'top';}
  469. function showInvite(eventName,data){setMetaViewport('add');var inviteTop='25%';var inviteData=KAMPYLE_DATA.getInviteData(data.formId);if(!inviteData||!MDIGITAL.FORM_STATE.isInviteLoaded(data.formId)||!KAMPYLE_FUNC.isJsonDataLoaded(data.formId,true)){return false;}
  470. 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;}
  471. 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);}
  472. 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);}}
  473. return true;}
  474. 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';}}}}
  475. 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')||'';}
  476. document.body.style.position=KAMPYLE_DATA.getMemoryData('hostedBodyPositionAttr')||'';}}
  477. function createFormContainer(){var onPremRoot=MDIGITAL_OnPrem.getPackageRoot();var kloaderSrc=(onPremRoot?onPremRoot+'/':KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX)+'resources/onsite/images/kloader.gif';if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){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;document.body.appendChild(formSpanPlacer);}}
  478. function createIframe(eventName,data){data=data||{};var formState=KAMPYLE_DATA.getFormState(data.formId);if(formState&&formState.loaded||KAMPYLE_FUNC.hasApplicationLoadingFailed(data.formId,false)){return;}
  479. var formData=KAMPYLE_DATA.getFormData(data.formId);var displayType=KAMPYLE_DATA.getDisplayType(formData);if(!formData||!data.formId||displayType!=='lightbox'){return;}
  480. setTimeout(function(){if(!KAMPYLE_FUNC.isFormLoaded(data.formId)){KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_FORM_LOADING_HAS_FAILED,{formId:data.formId})}},KAMPYLE_CONSTANT.NETWORK.TIME_FOR_FORM_TO_LOAD_MS);if(!document.getElementById('kampyleFormContainer')){createFormContainer();}
  481. var formHtml=data.formHtmlUrl||formData.formHtmlUrl;formHtml=KAMPYLE_COMMON.createFormUrl(formHtml,data.formId);if(displayType==='popup'){}
  482. 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';}
  483. KAMPYLE_UTILS.setElementStyle(formIframe,iframeStyleObject,true);}
  484. formIframe.src=formHtml;document.getElementById('kampyleFormModal').appendChild(formIframe);}}
  485. function applyMobileDynamicStyles(eventName,data){var formId=data.formId;var kFormContainer=document.getElementById('kampyleFormContainer');if(!(formId&&kFormContainer&&KAMPYLE_DATA.isMobileDynamicSizing(formId))){return false;}
  486. KAMPYLE_UTILS.setElementStyle(kFormContainer,{height:KAMPYLE_UTILS.getDocumentSize().height+'px',position:'absolute',},true);}
  487. function getDefaultIframeHeight(){return KAMPYLE_UTILS.isIos()?'30px':'100%';}
  488. 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);}}
  489. 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);}}}
  490. 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);}
  491. KAMPYLE_DATA.setMemoryData('initialAriaHiddenValues',ariaHiddenValues);}
  492. 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;}
  493. if(storeValues[i].prevAriaHiddenValue===null){storeValues[i].element.removeAttribute('aria-hidden');}else{storeValues[i].element.setAttribute('aria-hidden',storeValues[i].prevAriaHiddenValue);}}
  494. KAMPYLE_DATA.deleteMemoryData('initialAriaHiddenValues');}
  495. 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';if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){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);}
  496. 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)
  497. {KAMPYLE_UTILS.setElementStyle(inviteModal,{height:'100%',width:'100%',},true);}}
  498. KAMPYLE_UTILS.setElementStyle(inviteIframe,{height:inviteHeight,width:inviteWidth,display:'none',border:'0',},true);if(KAMPYLE_DATA.isFeatureEnabled('WCAG')){data.inviteData.inviteUrl+='?isWCAG=true';}
  499. 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);}}
  500. setTimeout(function(){if(KAMPYLE_DATA.getFormState(data.formId).inviteLoaded!==true){KAMPYLE_DATA.setFormState(data.formId,{inviteLoaded:false,inviteShown:false});}},KAMPYLE_CONSTANT.NETWORK.TIME_FOR_FORM_TO_LOAD_MS);}
  501. function hideButton(eventName,data){var buttonElementById=document.getElementById('kampyleButtonContainer');if(!data||KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)||!buttonElementById){return false;}
  502. buttonElementById.innerHTML='';return true;}
  503. 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);}
  504. if(kampyleInviteContainer){KAMPYLE_UTILS.removeAllContent(kampyleInviteContainer);}}
  505. function getButtonText(formData){if(typeof MDIGITAL.LOCALIZATION!=='undefined'&&KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.LOCALIZED_FORMS)){return MDIGITAL.LOCALIZATION.getLocalizedButtonText(formData);}
  506. else{return formData.buttonData.text;}}
  507. function shouldAddScroll(formHeight){var bodyPosition=KAMPYLE_UTILS.getElementStyle(document.body,'position');return(bodyPosition==='fixed'||bodyPosition==='absolute')&&(KAMPYLE_UTILS.getDocumentSize().height<=formHeight);}
  508. return{ignoreShowForm:ignoreShowForm,scrollToEmbeddedForm:scrollToEmbeddedForm,scrollFromTop:scrollFromTop,doScrollY:doScrollY,removeAllShownElements:removeAllShownElements,createIframe:createIframe,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,shouldAddScroll:shouldAddScroll,shouldShowErrMsgOnForm:shouldShowErrMsgOnForm,init:init,setMetaViewport:setMetaViewport,showVisibility:showVisibility,getCornerMargin:getCornerMargin,showFormCouldNotFechtedErrorMsg:showFormCouldNotFechtedErrorMsg,handleInviteReady:handleInviteReady,getButtonText:getButtonText,showInvite:showInvite,getWCAGClass:getWCAGClass,getClassDirectonByPosition:getClassDirectonByPosition};})(window,document);window.KAMPYLE_MESSAGE=(function(){function init(){KAMPYLE_UTILS.setEventHandler(window,'message',handleMessage);}
  509. function validateMessageEvent(e){if(!e||!e.origin||!e.data){return false;}
  510. var baseUrl=KAMPYLE_CONSTANT.PLACEHOLDERS.URL_PREFIX;if(baseUrl.charAt(baseUrl.length-1)==='/'){baseUrl=baseUrl.slice(0,baseUrl.length-1);}
  511. return KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)||e.origin===baseUrl;}
  512. function handleMessage(e){if(!validateMessageEvent(e)){return false;}
  513. var currDate=new Date();var data;try{data=JSON.parse(e.data);}
  514. catch(e){return false;}
  515. 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;}
  516. 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);}
  517. return false;}}
  518. 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;},isIE:function(){return/rv:11.0/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent);},createIEEvent:function(eventName,data){var e=document.createEvent('HTMLEvents');e.initEvent(eventName,true,true);e.detail=data||{};return e;},triggerCustomEvent:function(eventName,data){var e;var isIE=KAMPYLE_UTILS.isIE();if(isIE){e=KAMPYLE_UTILS.createIEEvent(eventName,data);}else{data=data?{detail:data}:{};e=new CustomEvent(eventName,data);}
  519. try{window.dispatchEvent(e);}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){if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){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);}
  520. if(style.styleSheet){style.styleSheet.cssText+=cssStyle;}else{style.appendChild(document.createTextNode(cssStyle));}}
  521. else{console.error("Should not use this method if the provision csp rules is on");}},addAttributesOnElement:function(element,attributesObj){if(element&&attributesObj){for(var key in attributesObj){if(attributesObj.hasOwnProperty(key)){element.setAttribute(key,attributesObj[key]);}}}},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'';}
  522. var miliSecDiff=0;if(datetime<now){miliSecDiff=now-datetime;}else{miliSecDiff=datetime-now;}
  523. 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);}
  524. 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(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);}
  525. catch(e){element.style.setProperty(dashed,''+styleObj[k],'!'+isImportant);}}
  526. else{element.style[k]=styleObj[k];}}}}},isNear:function(elementId,distance,event){var element=document.getElementById(elementId);if(!element){return false;}
  527. 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;}
  528. 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);}
  529. var sval=null;params=params.split('&');var paramLenght=params.length;for(var i=0;i<paramLenght;i++)
  530. {var temp=params[i].split('=');if(temp&&[temp[0]]==name){sval=decodeURIComponent(temp[1]);}}
  531. 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;}
  532. iframe=document.getElementById(iframeId);if(!iframe||!iframe.getAttribute){return;}
  533. var origin=iframe.getAttribute('origin')||'*';var targetWindow=iframe.contentWindow;if(targetWindow&&targetWindow.postMessage)
  534. {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]||'',};}
  535. 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]||'',};}}
  536. 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)
  537. {if(eventObj.hasOwnProperty(prop))
  538. {KAMPYLE_EVENT_DISPATCHER.subscribe(prop,callback);}}},getRandomTimeMS:function(minValue,maxValue){return minValue+(Math.round(Math.random()*(maxValue-minValue)));},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());}}
  539. 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();}
  540. return uuid;},removeAllContent:function(elem){if(!elem){return;}
  541. while(elem.firstChild){elem.removeChild(elem.firstChild);}
  542. elem.parentNode.removeChild(elem);},safeToLower:function(toLower){if(typeof toLower!=='string')
  543. {return toLower;}
  544. else{return toLower.toLowerCase();}},buildQueryParams:function(params){return Object.keys(params||{}).map(function(key,index){return(index===0?'?':'')+key+'='+params[key];}).join('&')||'';},kampyleSetCookie:function(cookieName,cookieValue,exDays,propertySharedSubdomain){var currDate=new Date();currDate.setTime(currDate.getTime()+(exDays*24*60*60*1000));var isSecureProtocol=KAMPYLE_UTILS.isSecureProtocol();var expires='expires='+currDate.toUTCString();var domain=propertySharedSubdomain?';domain='+propertySharedSubdomain+';':'';var sameSiteValue=isSecureProtocol?'None':'Lax';var secure=isSecureProtocol?'Secure; ':'';cookieName=propertySharedSubdomain?KAMPYLE_UTILS.TOP_LEVEL_DOMAIN_COOKIE_PREFIX+cookieName:cookieName;document.cookie=cookieName+'='+cookieValue+'; SameSite='+sameSiteValue+'; '+secure+expires+';path=/'+domain;},isSecureProtocol:function(){return location.protocol==='https:';},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;}}
  545. return null;},getDomainFromHost:function(host){if(host===null){return null;}
  546. 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);}
  547. 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);}
  548. var result={};for(var i=kampyleDataNames.length-1;i>=0;i--){result[kampyleDataNames[i]]=KAMPYLE_DATA.getData(kampyleDataNames[i]);}
  549. return result;},kampyleDeleteCookie:function(cookieName,propertySharedSubdomain){var domain='';if(propertySharedSubdomain){domain=';domain='+propertySharedSubdomain+';';}
  550. 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)
  551. {if(typeof source!=='number'||typeof toCompare!=='number')
  552. {return false;}
  553. 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)
  554. {return ans;}
  555. operator=KAMPYLE_UTILS.safeToLower(operator);switch(operator){case KAMPYLE_CONSTANT.OPERATORS.EQUALS:if(varType==='datetime')
  556. {ans=KAMPYLE_UTILS.kampyleCompareTimestamps(source,toCompare,operator);}
  557. else{ans=(source===toCompare);}
  558. break;case KAMPYLE_CONSTANT.OPERATORS.DOES_NOT_EQUAL:if(varType==='datetime')
  559. {ans=KAMPYLE_UTILS.kampyleCompareTimestamps(source,toCompare,operator);}
  560. else{ans=(source!==toCompare);}
  561. break;break;case KAMPYLE_CONSTANT.OPERATORS.GREATER_THAN:ans=(source>toCompare);break;case KAMPYLE_CONSTANT.OPERATORS.LATER_THAN:if(varType==='datetime')
  562. {ans=KAMPYLE_UTILS.kampyleCompareTimestamps(source,toCompare,operator);}
  563. else{ans=(source>toCompare);}
  564. break;case KAMPYLE_CONSTANT.OPERATORS.SMALLER_THAN:ans=(source<toCompare);break;case KAMPYLE_CONSTANT.OPERATORS.EARLIER_THAN:if(varType==='datetime')
  565. {ans=KAMPYLE_UTILS.kampyleCompareTimestamps(source,toCompare,operator);}
  566. else{ans=(source>toCompare);}
  567. 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;}
  568. break;default:break;}
  569. 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]={};}
  570. schema=schema[elem];}
  571. schema[pList[len-1]]=value;},getNestedPropertyValue:function(obj,propString,fallback){if(!obj||!propString||typeof propString!=='string'){return null;}
  572. 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;}}
  573. 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);}
  574. return result;},camelToDash:function(str){if(typeof str!=='string'){return str;}
  575. 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);}
  576. if(runsCounter++<MAX_TIMEOUT_RUNS){window.setTimeout(timoutCallback,timeoutMs);}}
  577. 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;}
  578. if(typeof(val)!=='number'&&isNaN(Number(val))){return null;}
  579. 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);}}}
  580. 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);}}
  581. 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();}
  582. makeRequest();},httpPostRequest:function(url,jsonData,callback){var postRequestData={postData:Object.assign({},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;}}
  583. 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;}}}}
  584. i+=2;}
  585. if(!device[TYPE]||(device[TYPE]!==MOBILE&&device[TYPE]!==TABLET)){return DESKTOP;}
  586. return device[TYPE];},getElementStyle:function(domElement,styleProperty){if(domElement instanceof HTMLElement){try{return window.getComputedStyle(domElement).getPropertyValue(styleProperty);}catch(err){}}
  587. return null;},isTruthy:function(expression){if(typeof expression!=='string'){return expression;}
  588. try{expression=JSON.parse(expression);}catch(err){}
  589. 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;}
  590. 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);}
  591. catch(err){strigifyData=data;}}
  592. else{strigifyData=data;}
  593. 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]+';';}
  594. 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();}
  595. 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={};}
  596. function getEventSubscriptions(eventName){if(eventName&&eventSubscriptions&&eventSubscriptions[eventName]){return eventSubscriptions[eventName];}
  597. else{return eventSubscriptions;}};var unsubscribe=function(eventName,callback){if(!eventName||typeof eventName!=='string'||!callback||typeof callback!=='function'){return false;}
  598. var subscribers=eventSubscriptions[eventName];if(typeof subscribers!=='undefined'){var callbackIndex=subscribers.indexOf(callback);if(callbackIndex!==-1)
  599. {subscribers.splice(callbackIndex,1);}}
  600. return true;};var subscribe=function(eventName,callback){if(!eventName||typeof eventName!=='string'||!callback||(typeof callback!=='function'&&typeof callback!=='string')){return false;}
  601. var subscribers=eventSubscriptions[eventName];if(typeof subscribers==='undefined'){subscribers=eventSubscriptions[eventName]=[];}
  602. var callbackIndex=subscribers.indexOf(callback);if(callbackIndex===-1)
  603. {subscribers.push(callback);}
  604. 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};}
  605. return Object.assign(data,defaultValues);}
  606. var trigger=function(eventName,data,context,options){var subscribers=eventSubscriptions[eventName];var i,iMax;if(typeof subscribers==='undefined'){return false;}
  607. 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]);}
  608. 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);}}
  609. if(options&&options.isStrictMode){break;}
  610. continue;}}}
  611. 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);}}
  612. 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(){var isOnPrem=KAMPYLE_UTILS.getNestedPropertyValue(window,'KAMPYLE_EMBED.isOnPrem');return!!(KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.ON_PREM_HYBRID)&&(typeof isOnPrem==='function'&&isOnPrem()));}
  613. function resolveAbsolutePath(relativePath){if(!window.KAMPYLE_EMBED||!window.KAMPYLE_EMBED.getResourcesPrefix()){return relativePath;}else{return window.KAMPYLE_EMBED.getResourcesPrefix()+relativePath;}}
  614. function getPackageRoot(){return isOnPrem()?window.KAMPYLE_EMBED.getResourcesPrefix():null;}
  615. function getPackageVersion(){if(KAMPYLE_DATA&&KAMPYLE_DATA.getMemoryData('dataJson')){return KAMPYLE_DATA.getMemoryData('dataJson').packageVersion;}
  616. else{return null;}}
  617. function replaceOnPremPrefixes(rawText){rawText=rawText||'';var formattedText;if(rawText.indexOf(KAMPYLE_CONSTANT.ONPREM_URL_PREFIX)===-1){return rawText;}
  618. else{var formattedText=rawText.replace(KAMPYLE_CONSTANT.ONPREM_URL_PREFIX,KAMPYLE_EMBED.getResourcesPrefix());return formattedText;}}
  619. function replaceFormNodeUrls(node){if(!node){return false;}
  620. onPremRelatedPaths.forEach(function(path){var pathValue=KAMPYLE_UTILS.getNestedPropertyValue(node,path);if(pathValue){KAMPYLE_UTILS.setNestedPropertyValue(node,path,replaceOnPremPrefixes(pathValue))}});return node;}
  621. 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);}
  622. function isEmbeddedFullWidth(formId){var formData=KAMPYLE_DATA.getFormData(formId);return KAMPYLE_UTILS.getNestedPropertyValue(formData,'isFullWidthEmbedded');}
  623. function createEmbeddedIframe(eventName,data){data=data||{};if(!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)){return false;}
  624. var hostingElement=getHostingElement(data.formId);if(!isHostingElementValid(hostingElement)){return false;}
  625. if(hostingElement){var hostingElementHeight=parseInt(getComputedStyle(hostingElement).height);addHostingElementHeight(hostingElement.id,hostingElementHeight);}
  626. setTimeout(function(){if(!KAMPYLE_FUNC.isFormLoaded(data.formId)){KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.NEB_FORM_LOADING_HAS_FAILED,{formId:data.formId})}},KAMPYLE_CONSTANT.NETWORK.TIME_FOR_FORM_TO_LOAD_MS);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,{shouldBeShown:true});return true;}
  627. function showForm(eventName,data){if(!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)||KAMPYLE_FUNC.hasApplicationLoadingFailed(data.formId)){return false;}
  628. var currIframe=document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX+data.formId);if(!!currIframe){setIframeStyle(currIframe,{display:'block'});}
  629. return true;}
  630. function isHostingElementValid(element){return element!==null&&(!element.innerHTML||(typeof element.innerHTML==='string'&&element.innerHTML.trim()===""));}
  631. function getHostingElement(formId){var formData=KAMPYLE_DATA.getFormData(formId);return document.getElementById(KAMPYLE_UTILS.getNestedPropertyValue(formData,'embeddedData.pageElementId'));}
  632. 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'})}
  633. return formIframe;}
  634. function setIframeStyle(formIframe,style){var defaultStyle={border:0,width:'100%',height:'100%'};var formattedStyle=Object.assign({},defaultStyle,style);KAMPYLE_UTILS.setElementStyle(formIframe,formattedStyle,false);}
  635. 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;}
  636. var newHeightSettings=calculateHeights(hostingElement,formData,data);var newWidth=calculateWidth(hostingElement,formData);var iframeStyle={height:newHeightSettings.iframeHeight+'px',width:isEmbeddedFullWidth(data.formId)?'100%':newWidth+'px'}
  637. 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;}
  638. 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;}
  639. return getNewHeightSettings(formHeight,shouldBeStatic,isDynamicHost,hostMaxHeight,hostMinHeight,hostHeight);}
  640. function getNewHeightSettings(formHeight,shouldBeStatic,isDynamicHost,hostMaxHeight,hostMinHeight,hostHeight){var newIframeHeight;var newFormHeight=formHeight;if(isDynamicHost){newFormHeight=formHeight;newIframeHeight=newFormHeight;}
  641. else{if(hostMaxHeight!==0&&formHeight>=hostMaxHeight){newFormHeight=hostMaxHeight;shouldBeStatic=true;}
  642. newIframeHeight=newFormHeight;if(formHeight<hostMinHeight||formHeight<hostHeight){newIframeHeight=hostMinHeight!==0?hostMinHeight:hostHeight;}}
  643. return{formHeight:newFormHeight,iframeHeight:newIframeHeight,shouldBeStatic:shouldBeStatic}}
  644. function calculateWidth(hostingElement,formData){var formWidth=parseInt(formData.formWidth);return Math.min(formWidth,KAMPYLE_UTILS.getElementSize(hostingElement).width);}
  645. function deleteEmbeddedIframe(eventName,data){if(!KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)){return false;}
  646. var currIframe=document.getElementById(KAMPYLE_CONSTANT.EMBEDDED.IFRAME_ID_PREFIX+data.formId);if(currIframe===null){return false;}
  647. KAMPYLE_UTILS.removeAllContent(currIframe);return true;}
  648. function addHostingElementHeight(elementId,height){var elementsHeightsObj=KAMPYLE_DATA.getMemoryData('hostingElementsHeights');elementsHeightsObj[elementId]=height;KAMPYLE_DATA.setMemoryData('hostingElementsHeights',elementsHeightsObj);}
  649. function getHostingElementHeight(elementId){return KAMPYLE_DATA.getMemoryData('hostingElementsHeights')[elementId]||0;}
  650. function handleThankyouPage(eventName,data){data=data||{};if(KAMPYLE_DATA.isEmbeddedDisplayType(data.formId)&&KAMPYLE_DATA.isMobile()){KAMPYLE_VIEW.scrollToEmbeddedForm(data.formId);}}
  651. 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);}
  652. function updateTargetingState(eventName,data){if(!canUpdateState(data)){return false;}
  653. 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});}
  654. function isInviteLoaded(formId){var formState=KAMPYLE_DATA.getFormState(formId);return!!formState&&!!formState.inviteLoaded;}
  655. function isFormLoaded(formId){var formState=KAMPYLE_DATA.getFormState(formId);return!!formState&&!!formState.loaded}
  656. function shouldFormBeShown(formId){var formState=KAMPYLE_DATA.getFormState(formId);return formState&&formState.shouldBeShown;}
  657. function isFormAlreadyShown(formId){var formState=KAMPYLE_DATA.getFormState(formId);return formState&&formState.shown;}
  658. function getRuleData(data){var ruleData={targetingRule:"",isPassed:false,expected:"",actual:"",};Object.keys(ruleData).forEach(function(property){ruleData[property]=data[property];});return ruleData;}
  659. function canUpdateState(data){data=data||{};var formState=KAMPYLE_DATA.getFormState(data.formId);return!(!formState||!formState.targeting||!data.targetingPhase);}
  660. return{init:init,updateTargetingState:updateTargetingState,getRuleData:getRuleData,canUpdateState:canUpdateState,shouldFormBeShown:shouldFormBeShown,isFormLoaded:isFormLoaded,isInviteLoaded:isInviteLoaded,isFormAlreadyShown:isFormAlreadyShown,};})(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','color':'#FFF'},widgetFooterCapture:{'margin-left':'5px','background':'#020202','color':'#FFF'}};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;res.widgetFooterCancel.color=!!customSettings.closeButtonTextColor?customSettings.closeButtonTextColor:res.widgetFooterBtn.color;res.widgetFooterCapture.color=!!customSettings.submitButtonTextColor?customSettings.submitButtonTextColor:res.widgetFooterBtn.color;}
  661. return res;}
  662. 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];}}
  663. return res;}};function loadForm(formId){return KAMPYLE_ONSITE_SDK.loadForm(formId);}
  664. function showForm(formId,options){return KAMPYLE_ONSITE_SDK.showForm(formId,options);}
  665. function closeForm(formId){KAMPYLE_EVENT_DISPATCHER.trigger('neb_formClosed',{formId:formId});}
  666. 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];}
  667. url+='&referrer='+encodeURIComponent(fullUrl);var region=KAMPYLE_DATA.getMemoryData('region');if(region){url+='&region='+region;}
  668. if(KAMPYLE_DATA.isFeatureEnabled('WCAG')){url+='&isWCAG=true';}
  669. url+='&displayType='+KAMPYLE_DATA.getDisplayType(KAMPYLE_DATA.getFormData(formId));return url;}
  670. 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;}
  671. 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}}"','');}
  672. if(!formattedText||!formattedText.cancelScreenCaptureTooltip){widgetHtml=widgetHtml.replace('data-tips="{{cancelScreenCaptureTooltip}}"','');}
  673. for(var prop in formattedText){if(SCREEN_CAPTURE_DEFAULT_TEXTS.hasOwnProperty(prop)){widgetHtml=widgetHtml.replace('{{'+prop+'}}',SCREEN_CAPTURE_DEFAULT_TEXTS[prop]);}}
  674. var formattedStyles=overrideDefaultScreenCaptureStyles(formData.screenCaptureSettings);for(var element in formattedStyles){widgetHtml=KAMPYLE_UTILS.replaceAll(widgetHtml,'{'+element+'}',KAMPYLE_UTILS.styleObjToInline(defaultStyles[element]));}
  675. widgetHtml=widgetHtml.replace('{tooltipStyles}',screenCaptureTooltipStyles).replace('{buttonsOutlineStyle}',screenCaptureButtonsOutlineStyle);return KAMPYLE_UTILS.htmlDecode(widgetHtml);}
  676. function createScreenCaptureWidget(formData,scContainer){if(!KAMPYLE_FUNC.checkProvision(KAMPYLE_CONSTANT.PROVISIONS.CSP_RULES)){var widgetHtml=formatScreenCaptureWidget(formData);var scIframe=document.createElement('iframe');scIframe.id='nebScIframe';KAMPYLE_UTILS.setElementStyle(scIframe,{width:'310px',bottom:'20px',left:'20px',zIndex:2147483647,position:'fixed',});KAMPYLE_UTILS.setElementStyle(scIframe,{display:'block'},true);scIframe.frameBorder='0';scIframe.sandbox='allow-top-navigation allow-same-origin allow-scripts';if(scContainer){scContainer.parentNode.insertBefore(scIframe,scContainer);}
  677. else{document.body.appendChild(scIframe);}
  678. if(scIframe.contentWindow){scIframe.contentWindow.contents=widgetHtml;}
  679. scIframe.src='javascript:window["contents"]';setTimeout(function(){document.activeElement.blur();},100);return true;}}
  680. function cancelScreenCapture(){KAMPYLE_EVENT_DISPATCHER.trigger('neb_cancelCaptureClicked',{formId:KAMPYLE_DATA.getMemoryData('currentFormId'),feedbackUUID:KAMPYLE_DATA.getMemoryData('currentFeedbackUuid'),});}
  681. function screenCaptureClicked(){showScreenCaptureSpinner();}
  682. 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);}
  683. function getTealeafData(){if(KAMPYLE_THERMO_TEALEAF_FUNC.isTealeafEnabled()){return{sid:KAMPYLE_UTILS.kampyleGetCookie(TEALEAF_COOKIE_SESSION_ID),};}
  684. return null;}
  685. return{isTealeafEnabled:isTealeafEnabled,getTealeafData:getTealeafData,};})();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;}}
  686. return null;}
  687. 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;}}
  688. 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;}
  689. 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;}
  690. if(!formState.loaded){KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkLoadForm',{formId:formId});KAMPYLE_EVENT_DISPATCHER.trigger('neb_loadForm',{formId:formId});}
  691. return true;}
  692. 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;}
  693. if(KAMPYLE_DATA.getMemoryData('inviteLoadedAndShown')){KAMPYLE_UTILS.showWarning('There is already an invite displayed');return false;}
  694. if(KAMPYLE_FUNC.isAnyOtherFormAlreadyShown(formId,true)){KAMPYLE_UTILS.showWarning('There is already a form displayed');return false;}
  695. if(!formState.loaded){loadForm(formId);}
  696. 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];}}
  697. KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkShowForm',{formId:formId,triggerType:options.triggerType});return true;}
  698. function updatePageView(){KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkPageView');}
  699. function isSurveyDisplayed(){if(KAMPYLE_FUNC.isAnyInviteShown()||KAMPYLE_FUNC.isAnyOtherFormAlreadyShown()){return true;}
  700. KAMPYLE_EVENT_DISPATCHER.trigger('neb_sdkSurveyDisplayed');return false;}
  701. function startInviteTargeting(){if(!KAMPYLE_DATA.isFeatureEnabled(KAMPYLE_CONSTANT.PROPERTY_SETTINGS.MANUALLY_INVITE_TARGETING)){KAMPYLE_UTILS.showWarning('Manually invite targeting feature is disabled');return false;}
  702. KAMPYLE_EVENT_DISPATCHER.trigger(KAMPYLE_CONSTANT.EVENTS.MDIGITAL_MANUALLY_INVITE_TARGETING,{skipButtonTargeting:true,skipInviteTargeting:false});}
  703. 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');}
  704. var o=Object(this);var len=o.length>>>0;if(len===0){return false;}
  705. 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));}
  706. while(k<len){if(sameValueZero(o[k],searchElement)){return true;}
  707. k++;}
  708. return false;},});}
  709. if(!String.prototype.includes){String.prototype.includes=function(search,start){'use strict';if(typeof start!=='number'){start=0;}
  710. if(start+search.length>this.length){return false;}else{return this.indexOf(search,start)!==-1;}};}
  711. 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;}});}
  712. if(!Array.prototype.find){Object.defineProperty(Array.prototype,'find',{value:function(predicate){if(this==null){throw new TypeError('"this" is null or not defined');}
  713. var o=Object(this);var len=o.length>>>0;if(typeof predicate!=='function'){throw new TypeError('predicate must be a function');}
  714. var thisArg=arguments[1];var k=0;while(k<len){var kValue=o[k];if(predicate.call(thisArg,kValue,k,o)){return kValue;}
  715. k++;}
  716. return undefined;},});}
  717. if(typeof Object.assign!='function'){Object.assign=function(target,varArgs){if(target==null){throw new TypeError('Cannot convert undefined or null to object');}
  718. 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];}}}}
  719. return to;};}
  720. if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement,fromIndex){var k;if(this==null){throw new TypeError('"this" is null or not defined');}
  721. var o=Object(this);var len=o.length>>>0;if(len===0){return-1;}
  722. var n=+fromIndex||0;if(Math.abs(n)===Infinity){n=0;}
  723. if(n>=len){return-1;}
  724. k=Math.max(n>=0?n:len-Math.abs(n),0);while(k<len){if(in o&&o[k]===searchElement){return k;}
  725. k++;}
  726. return-1;};}
  727. if(!Array.prototype.filter){Array.prototype.filter=function(fun){'use strict';if(this===void 0||this===null){throw new TypeError();}
  728. var t=Object(this);var len=t.length>>>0;if(typeof fun!=='function'){throw new TypeError();}
  729. var res=[];var thisArg=arguments.length>=2?arguments[1]:void 0;for(var i=0;i<len;i++){if(in t){var val=t[i];if(fun.call(thisArg,val,i,t)){res.push(val);}}}
  730. return res;};}
  731. if(!Array.prototype.forEach){Array.prototype.forEach=function(callback){var T,k;if(this==null){throw new TypeError('this is null or not defined');}
  732. var O=Object(this);var len=O.length>>>0;if(typeof callback!=='function'){throw new TypeError(callback+' is not a function');}
  733. if(arguments.length>1){T=arguments[1];}
  734. k=0;while(k<len){var kValue;if(in O){kValue=O[k];callback.call(T,kValue,k,O);}
  735. k++;}};}
  736. 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++)
  737. 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))
  738. tmp.push(stringify(k)+': '+stringify(value[k]));}
  739. return'{'+tmp.join(', ')+'}';}}
  740. return'"'+value.toString().replace(escRE,escFunc)+'"';};})(),};}
  741. if(!Date.now){Date.now=function now(){return new Date().getTime();};}
  742. 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');}
  743. 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];}}}}
  744. return output;};})();}
  745. 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');}
  746. if(typeof fun!=='function'){throw new TypeError();}
  747. 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(in t&&fun.call(thisArg,t[i],i,t)){return true;}}
  748. return false;};}
  749. 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');}
  750. if(typeof callback!=='function'){throw new TypeError(callback+' is not a function');}
  751. 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&&!(in o)){k++;}
  752. if(k>=len){throw new TypeError('Reduce of empty array '+'with no initial value');}
  753. value=o[k++];}
  754. while(k<len){if(in o){value=callback(value,o[k],k,o);}
  755. k++;}
  756. return value;}});}
  757. (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;}
  758. 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');}
  759. var o=Object(this);var len=o.length>>>0;if(typeof predicate!=='function'){throw new TypeError('predicate must be a function');}
  760. var thisArg=arguments[1];var k=0;while(k<len){var kValue=o[k];if(predicate.call(thisArg,kValue,k,o)){return k;}
  761. k++;}
  762. return-1;},});}
  763. if(!Element.prototype.remove){Element.prototype.remove=function remove(){if(this.parentNode){this.parentNode.removeChild(this);}};}
  764. if(!String.prototype.endsWith){String.prototype.endsWith=function(search,this_len){if(this_len===undefined||this_len>this.length){this_len=this.length;}
  765. return this.substring(this_len-search.length,this_len)===search;};}
  766. 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;}
  767. if(number===0||!isFinite(number)){return number;}
  768. 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');}
  769. 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');}
  770. if(arguments.length>2){T=arguments[2];}}
  771. 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;}
  772. k+=1;}
  773. A.length=len;return A;};}());}
  774. 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;}
  775. else{return func.apply(getParamsBySourceParameters.context);}}
  776. catch(e){return null;}}
  777. else{return null;}
  778. case'url':return KAMPYLE_UTILS.getUrlParam(KAMPYLE_UTILS.getNestedPropertyValue(window,getParamsBySourceParameters.param));case'storage':return localStorage.getItem(KAMPYLE_UTILS.getNestedPropertyValue(window,getParamsBySourceParameters.param));default:}}
  779. 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');}
  780. valueBySource=getParameterBySource({source:isEnabledArray[i].source,param:isEnabledCurrName,context:integrationContext,predefinedArgs:isEnabledArray[i].predefinedArguments});if(paramValue===null){isEnabledCurr=(valueBySource!==undefined&&valueBySource!==null);}
  781. else{isEnabledCurr=paramValue===valueBySource;}
  782. isEnabledBol=isEnabledBol&&isEnabledCurr;}
  783. return isEnabledBol;}
  784. 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);}
  785. integrationDataJson={integrationName:integrationData.integrationName,parameters:parametersJson,};return integrationDataJson;}
  786. 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));}}}}
  787. return integrationData;}
  788. 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,}}
  789. function init(){try{KAMPYLE_UTILS.initEventSubscriptions(customEvents,triggerCustomEvent);return true;}catch(e){console.warn(e);}}
  790. function formatData(eventName,eventDispatcherData){if(!eventName||!eventDispatcherData){return null;}
  791. for(var eventProp in customEvents[eventName]){if(customEvents[eventName].hasOwnProperty(eventProp)){eventDispatcherData[eventProp]=customEvents[eventName][eventProp];}}
  792. eventDispatcherData.eventName=eventName;eventDispatcherData.formTriggerType=KAMPYLE_DATA.getFormTriggerType(eventDispatcherData.formId);return eventDispatcherData;}
  793. 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;}
  794. 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;}}
  795. return dataToSend;}
  796. function manipulateTriggerTypeValue(formTriggerType){return KAMPYLE_CONSTANT.FORM_TRIGGER_TYPES_MAP[formTriggerType]||KAMPYLE_CONSTANT.CUSTOM_EVENT_OTHER;}
  797. 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)}
  798. var cp=customParam||{};var extractedValue=MDIGITAL.CUSTOM_PARAMETERS.extractCPValue(cp);return MDIGITAL.CUSTOM_PARAMETERS.castCPValue(extractedValue,cp.type||'');}
  799. function formatCustomParams(formId){var customParams=MDIGITAL.CUSTOM_PARAMETERS.getFormCustomParams(formId)||[];return customParams.map(MDIGITAL.CUSTOM_PARAMETERS.appendValueToCPObject);}
  800. function getFormCustomParams(formId){var formData=KAMPYLE_DATA.getFormData(formId)||{};return formData.customParams||null;}
  801. function hasCustomParams(formId){var formData=KAMPYLE_DATA.getFormData(formId);return!!formData&&!!formData.customParams&&!!formData.customParams.length;}
  802. function getCustomParamValueById(id,formData){var customParam=MDIGITAL.CUSTOM_PARAMETERS.getCustomParamById(id,formData)||{};return MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue(customParam);}
  803. function getCustomParamValueByUniqueName(uniqueName){var customParam=MDIGITAL.CUSTOM_PARAMETERS.getCustomParamByUniqueName(uniqueName)||{};return MDIGITAL.CUSTOM_PARAMETERS.getCustomParamValue(customParam);}
  804. function getCustomParamById(fieldId,formData){if(fieldId!==undefined&&formData&&formData.customParams&&formData.customParams.length){return formData.customParams.find(function(cp){return cp.id==fieldId;})||null;}
  805. else{return null;}}
  806. function getCustomParamByUniqueName(uniqueName){var customParams=KAMPYLE_DATA.getCustomParams()||[];return customParams.find(function(cp){return cp.unique_name===uniqueName;});}
  807. 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;}}
  808. return value!==''?value:null;}
  809. function castCPValue(value,type){if(value===null){return value;}
  810. switch(type.toLowerCase()){case'datetime':return MDIGITAL.CUSTOM_PARAMETERS.handleDatetimeCasting(value);case'number':return KAMPYLE_UTILS.getNumericValue(value)
  811. 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;}}
  812. 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();}}
  813. function handleTextCasting(value){return(typeof value==='string')?value:null;}
  814. function handleBooleanCasting(value){if(value==='true'){return true;}else if(value==='false'){return false}
  815. return(typeof value==='boolean')?value:null;}
  816. 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});}
  817. 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();

Editor

You can edit this paste and save as new:


File Description
  • s
  • Paste Code
  • 01 Jul-2024
  • 245.01 Kb
You can Share it: