const True = true const False = false const None = '' class CYTConsentBanner { tenant_id = 32 tenant_pc_html_code = '
How to Manage Your Account Information and Your Privacy Rights

HI-TEK Balancing Inc. believes in putting you in control of your personal information. Upon request, we will provide you with information about whether we hold any of your personal information and how it is used.

You may submit a privacy request to access, correct, or remove your personal information by visiting your user account at Privacy Center or by contacting us at privacy@hitekbalancing.com.

' pc_url = 'https://privacycenter.cytrio.com/hitekbalancing' API_URL = 'https://privacymanageradmin-api.cytrio.com' UI_URL = '' XCSRFToken = 'IjAyZDI5M2JiY2MxYTNmNzhlNzg2NjMyOTQ5NWU2OWQ4Yzg1ZjFmNTMi.Y5cbTg.5ZLKi-q7jIGJJEdhDzsmYAmABTk' template_values = {'colors': {'color_theme': 'light', 'cookie_notice_title_color': '#212121', 'cookie_notice_border_color': '#F4F4F4', 'cookie_notice_message_color': '#212121', 'opt_out_checkbox_enable_color': '#1863DC', 'cookie_notice_background_color': '#FFFFFF', 'opt_out_checkbox_disable_color': '#FFFFFF', 'blocked_content_button_text_color': '#000000', 'blocked_content_button_border_color': '#e6e7e8', 'cookie_notice_do_not_sell_text_color': '#1863DC', 'preference_center_enable_state_color': '#00B08B', 'opt_out_checkbox_save_pref_text_color': '#F4F4F4', 'preference_center_disable_state_color': '#D0D5D2', 'preference_center_save_pref_text_color': '#FF6900', 'blocked_content_button_background_color': '#e6e7e8', 'opt_out_checkbox_save_pref_border_color': '#FF6900', 'revisit_content_button_background_color': '#00B08B', 'preference_center_save_pref_border_color': '#FF6900', 'cookie_notice_customize_button_text_color': '#FF6900', 'opt_out_checkbox_cancel_button_text_color': '#FF6900', 'cookie_notice_accept_all_button_text_color': '#FFFFFF', 'cookie_notice_reject_all_button_text_color': '#FF6900', 'cookie_notice_cookie_policy_link_text_color': '#1863DC', 'cookie_notice_customize_button_border_color': '#FF6900', 'opt_out_checkbox_cancel_button_border_color': '#FF6900', 'opt_out_checkbox_save_pref_background_color': '#FF6900', 'cookie_notice_accept_all_button_border_color': '#FF6900', 'cookie_notice_reject_all_button_border_color': '#FF6900', 'preference_center_save_pref_background_color': '#FFFFFF', 'cookie_notice_cookie_policy_link_border_color': '#FFFFFF', 'cookie_notice_customize_button_background_color': '#FFFFFF', 'opt_out_checkbox_cancel_button_background_color': '#FFFFFF', 'cookie_notice_accept_all_button_background_color': '#FF6900', 'cookie_notice_reject_all_button_background_color': '#FFFFFF', 'cookie_notice_cookie_policy_link_background_color': '#FFFFFF'}, 'layout': {'type': 'banner_bottom'}, 'content': {'opt_out_title': 'Opt-out Preferences', 'cookie_list_cookie': 'Cookie', 'cookie_notice_title': 'We value your privacy', 'blocked_consent_text': 'Please accept cookies to access this content', 'cookie_list_category': '', 'cookie_list_duration': 'Duration', 'revisit_consent_logo': '', 'revisit_consent_text': 'Consent Preferences', 'cookie_notice_message': '

We use cookies to enhance your browsing experience, serve personalized ads or content, and analyze our traffic. By clicking Accept All, you consent to our use of cookies as described in our Privacy Policy.

', 'cookie_list_description': 'Description', 'preference_center_title': 'Customize Consent Preferences', 'opt_out_privacy_overview': 'We use third-party cookies that help us analyze how you use this website, store your preferences, and provide the content and advertisements that are relevant to you. However, you can opt out of these cookies by checking Do Not Sell or Share My Personal Information and clicking the Save My Preferences button. Once you opt out, you can opt in again at any time by unchecking Do Not Sell or Share My Personal Information and clicking the Save My Preferences button.', 'revisit_consent_position': 'left', 'ccpa_cookie_notice_message': 'This website or its third-party tools process personal data. You can opt out of the sale of your personal information by clicking on the “Do Not Sell or Share My Personal Information” link.', 'is_revisit_consent_visible': True, 'opt_out_cancel_button_text': 'Cancel', 'preference_center_overview': 'Necessary category cookies are stored on your browser as they are essential for enabling the basic functionalities of the site. We also use third-party cookies that help us analyze how you use this website, store your preferences, and provide the content and advertisements that are relevant to you. You can choose to enable or disable some or all of these cookies but disabling some of them may affect your browsing experience.', 'cookie_list_tracking_script': '', 'is_show_cookie_list_visible': True, 'cookie_notice_custom_logo_url': '', 'cookie_notice_do_not_sell_link': 'https://privacycenter.cytrio.com/hitekbalancing', 'cookie_notice_do_not_sell_text': 'Do Not Sell or Share My Personal Information', 'cookie_list_always_active_label': 'Always Active', 'cookie_notice_cookie_policy_url': '', 'cookie_notice_accept_button_text': 'Accept All', 'cookie_notice_cookie_policy_text': 'Cookie Policy', 'cookie_notice_reject_button_text': 'Reject All', 'cookie_notice_customize_button_text': 'Customize', 'cookie_notice_do_not_sell_link_text': 'Do Not Sell or Share My Personal Information', 'opt_out_save_preference_button_text': 'Save My Preference', 'is_cookie_notice_close_button_enable': False, 'is_cookie_notice_cookie_policy_enable': True, 'is_cookie_notice_reject_button_enable': True, 'cookie_list_no_cookies_to_display_label': 'No cookies to display', 'is_cookie_notice_customize_button_enable': True, 'is_cookie_notice_categories_on_first_layer': True, 'preference_center_save_preference_button_text': 'Save My Preferences','is_remove_cytrio_button_enable': True, 'is_language_toggle_enable': True}, 'general': {"is_tl": "enabled",'do_not_sell_link': 'Do Not Sell or Share My Personal Information', 'is_show_ccpa_banner': True, 'sale_of_personal_data': ['functional', 'analytics', 'performance', 'advertisement', 'other'], 'consent_expiration_days': '30', 'consent_geo_target_name': {'ccpa_target_name': 'United States', 'gdpr_target_name': 'EU Countries', 'ccpa_gdpr_target_name': 'Worldwide'}, 'load_cookies_prior_consent': [], 'hide_categories_from_banner': [], 'is_reload_page_on_consent_action': False}, 'custom_css': {}, 'default_logo': 'https://cytriocpmprod.blob.core.windows.net/cytrio-public/consentbanner_logo/default_consent_logo.svg', 'consent_template': 'GDPR & CCPA'} thirdPartyScripts = [{'category': 'Analytics', 'scripts': ['www.google-analytics.com/analytics.js']}] firstPartyScripts = [] domains = ['.hitekbalancing.com', 'www.hitekbalancing.com', '.doubleclick.net'] thirdPartyCookies = [{'category': 'Functional', 'cookies': ['test_cookie']}] firstPartyCookies = [{'category': 'Functional', 'cookies': ['__cf_bm']}, {'category': 'Unclassified', 'cookies': ['sbjs_migrations', 'sbjs_current_add', 'sbjs_first_add', 'sbjs_current', 'sbjs_first', 'sbjs_udata', 'sbjs_session', '_pk_id.253.783a', '_pk_ses.253.783a', '_ga_0KQRV2Q0MG']}, {'category': 'Marketing', 'cookies': ['_gcl_au']}, {'category': 'Analytics', 'cookies': ['_ga']}] revisitIconLink = 'https://cytriocpmprod.blob.core.windows.net/cytrio-public/consentbanner_logo/default_consent_logo.svg' banner_status = 'active' customize_consent_preferences_categories = [{'category_name': 'Functional', 'category_description': 'Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.', 'category_cookies': [{'hitekbalancing.com': [{'cookie_name': '__cf_bm', 'cookie_duration': '02/11/2024 00:53:14', 'cookie_description': 'This cookie is used to distinguish between humans and bots. This is beneficial for the website, in order to make valid reports on the use of their website.'}]}, {'doubleclick.net': [{'cookie_name': 'test_cookie', 'cookie_duration': '02/11/2024 00:38:25', 'cookie_description': "This cookie is set by DoubleClick (which is owned by Google) to determine if the website visitor's browser supports cookies."}]}]}, {'category_name': 'Unclassified', 'category_description': 'Unclassified uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.', 'category_cookies': [{'hitekbalancing.com': [{'cookie_name': 'sbjs_migrations', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_current_add', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_first_add', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_current', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_first', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_udata', 'cookie_duration': None, 'cookie_description': 'NA'}, {'cookie_name': 'sbjs_session', 'cookie_duration': '02/11/2024 00:53:20', 'cookie_description': 'NA'}, {'cookie_name': '_ga_0KQRV2Q0MG', 'cookie_duration': '02/10/2026 00:23:24', 'cookie_description': 'NA'}]}, {'www.hitekbalancing.com': [{'cookie_name': '_pk_id.253.783a', 'cookie_duration': '03/10/2025 00:23:22', 'cookie_description': 'NA'}, {'cookie_name': '_pk_ses.253.783a', 'cookie_duration': '02/11/2024 00:53:21', 'cookie_description': 'NA'}]}]}, {'category_name': 'Marketing', 'category_description': 'Marketing cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.', 'category_cookies': [{'hitekbalancing.com': [{'cookie_name': '_gcl_au', 'cookie_duration': '05/11/2024 00:23:22', 'cookie_description': 'Used by Google AdSense for experimenting with advertisement efficiency across websites using their services.'}]}]}, {'category_name': 'Analytics', 'category_description': 'Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.', 'category_cookies': [{'hitekbalancing.com': [{'cookie_name': '_ga', 'cookie_duration': '02/10/2026 00:23:24', 'cookie_description': 'ID used to identify users'}]}]}, {'category_name': 'Necessary', 'is_always_active': True, 'category_description': 'Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.', 'category_cookies': [{'cytrio.com': [{'cookie_name': 'cyt-consent', 'cookie_duration': '2024-04-26 15:28:11', 'cookie_description': "This cookie is set by CYTRIO to remember the users' consent settings so that the website recognizes the users the next time they visit."}]}]}] domain_id = 31 sub_domain_id = '' scriptSelector = 'data-cookie-category' scriptData all_categories_data eu_countries_code = [ 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', ] consent_template_to_show = 'gdpr' user_info = {} revisitConsentPositionClass = this.template_values.content.revisit_consent_position === 'left' ? 'cyt-revisitIcon-left' : 'cyt-revisitIcon-right' revisitConsentTextPositionClass = this.template_values.content.revisit_consent_position === 'left' ? 'cyt-revistIcon-text-left' : 'cyt-revistIcon-text-right' urlLinkIcon = ` ` css = ` .cyt-main-wrapper *{ margin:0; padding:0; } .cyt-modal *{ margin:0; padding:0; } .cyt-revisitIcon *{ margin:0; padding:0; } .cyt-accordion, .cyt-modal .cyt-modal-header { font-family: inherit; width:100%; } .cyt-switch { position: relative; display: inline-block; width: 36px; height: 20px; margin-right:10px; } .cyt-switch input { opacity: 0; } .cyt-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: 0.4s; transition: 0.4s; } .cyt-slider:before { position: absolute; content: ''; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: #fff; -webkit-transition: 0.4s; transition: 0.4s; } input:checked + .cyt-slider { background-color: #00B08B; } input:focus + .cyt-slider { box-shadow: 0 0 1px #2196f3; } input:checked + .cyt-slider:before { -webkit-transform: translateX(16px); -ms-transform: translateX(16px); transform: translateX(16px); } .cyt-slider.cyt-round { border-radius: 34px; } .cyt-slider.cyt-round:before { border-radius: 50%; } .cyt-main-wrapper { width: 100%; display: none; flex-direction: column; position: fixed; z-index: 999999999; font-family: inherit; line-height:24px; } .cyt-main-wrapper.cyt-consent-container-show { display: flex; } .cyt-main-wrapper.banner_top, .cyt-main-wrapper.classic_top { top: 0; } .cyt-main-wrapper.banner_bottom, .cyt-main-wrapper.classic_bottom { bottom: 0; } .cyt-main-wrapper.box_left_top { left: 10px; top: 10px; } .cyt-main-wrapper.box_right_top { right: 10px; top: 10px; } .cyt-main-wrapper.box_left_bottom { left: 10px; bottom: 10px; } .cyt-main-wrapper.box_right_bottom { right: 10px; bottom: 10px; } .cyt-main-wrapper .cookieNoticeMessageDiv { display: flex; padding-top: 5px; justify-content:space-between; flex:0 0 62%; } .cyt-main-wrapper .cookieNoticeTitleDiv, .cyt-main-wrapper .preferencesTitleDiv { font-weight: 700; font-size: 18px; line-height: 24px; margin: 0 0 10px; } .cyt-main-wrapper .cookieNoticeMessageTextDiv { padding-right: 10px; font-size:15px; line-height:24px; } .cyt-main-wrapper .overflowDiv { max-height: 200px; overflow: auto; padding:0 10px 0 0; } .cyt-modal .overflowDiv { max-height: 52vh; overflow: auto; padding:0 10px 0 0; } .cyt-main-wrapper .saveMyPreferencesButtonDiv, .cyt-modal .saveMyPreferencesButtonDiv { display: flex; justify-content: flex-end; padding-top:20px; position:relative; } .cyt-main-wrapper .preferencesOverviewDiv { font-weight: 400; font-size: 14px; line-height: 24px; margin: 0 0 10px; } .cyt-modal .optOutPreferencesCheckbox { margin: 10px 0; display:flex; align-items:center; } .optOutPreferencesCheckbox input{ margin:0 5px 0 0; width: 20px; height: 18.5px; } .cyt-modal { box-shadow: 0 32px 68px rgb(0 0 0 / 30%); margin: 0 auto; position: fixed; max-width: 100%; background: #fff; top: 50%; box-sizing: border-box; border-radius: 6px; z-index: 999999999; color: #212121; -webkit-transform: translate(-50%, 100%); -moz-transform: translate(-50%, 100%); -ms-transform: translate(-50%, 100%); -o-transform: translate(-50%, 100%); transform: translate(-50%, 100%); visibility: hidden; transition: none; padding:20px; } .cyt-modal.modal-open { display: flex; visibility: visible; -webkit-transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); -o-transform: translate(-50%, -50%); transform: translate(-50%, -50%); top: 50%; left: 50%; transition: 0.8s; overflow: hidden; width: 845px; max-height: 82vh; } .cyt-modal.modal-open .cyt-poweredBy { display: flex; align-items: center; font-size: 10px; right: 20px; color: #797979; } .cyt-modal.modal-open .cyt-poweredBy .cyt-closeIcon{ display:none; } .cyt-modal .cyt-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; } .cyt-accordion-header .cyt-accordion-btn, .cyt-modal .cyt-close-btn { background: 0 0; padding: 0; cursor: pointer; min-height: 0; text-shadow: none; box-shadow: none; } .cyt-modal .cyt-modal-title { font-size: 18px; font-weight: 700; line-height: 24px; } .cyt-modal .cyt-close-btn { margin: 0; vertical-align: middle; border: none; width: auto; height: auto; line-height: 0; } .cyt-preference-wrapper { display: none; border: 1.5px solid #f4f4f4; padding: 16.5px 24px; box-shadow: 0 3px 10px 0 #acabab4d; color: rgb(33,33,33); } .cyt-consent-bar { min-height: 100px; border: 1px solid; padding: 20px; box-shadow: 0 -1px 10px 0 #acabab4d; border-color: #f4f4f4; } .cyt-consent-container.cyt-consent-bar-expand .cyt-preference-wrapper { display: block; } .cyt-consent-container.classic_top .cyt-preference-wrapper { animation: 0.5s cyt-classic-top-expand; } .cyt-consent-container.classic_bottom.cyt-consent-bar-expand { animation: 0.5s cyt-classic-bottom-expand; } .cyt-consent-container.cyt-consent-bar-expand .cyt-btn-customize::after { transform: rotate(-180deg); } .cyt-btn-customize { position: relative; padding: 8px 27px; line-height: 24px; white-space: nowrap; } .cyt-btn{ white-space: nowrap; line-height: 24px; white-space: nowrap; margin-right: 8px; cursor: pointer; height: 30px; padding: 7px 10px; font-size: 13px; display: flex; align-items: center; justify-content: center; border-radius: 5px; } /* .cyt-consent-container .cyt-btn-customize::after { position: absolute; content: ''; display: inline-block; top: 18px; right: 12px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid; border-top-color: inherit; } */ .cyt-accordion .cyt-accordion-item, .cyt-accordion-item { display: flex; margin-top: 10px; } .cyt-accordion-chevron { margin-right: 20px; position: relative; cursor: pointer; padding: 1px; } .cyt-accordion-header-wrapper { cursor: pointer; width: 100%; } .cyt-accordion-item .cyt-accordion-header { display: flex; justify-content: space-between; align-items: center; } .cyt-accordion-header .cyt-accordion-btn { font-size: 14px; font-family: inherit; color: #212121; line-height: 24px; border: none; font-weight: 700; margin: 0; text-transform: none; } .cyt-accordion-header-des { color: #212121; font-size: 14px; line-height: 24px; margin: 0px 0 5px; } .cyt-accordion-header-des p{ font-size: 14px; margin:0; } .cyt-accordion-header .cyt-always-active { color: green; font-weight: 600; line-height: 24px; font-size: 14px; margin-right:10px; } .cyt-accordion-item .cyt-accordion-chevron i::before { content: ''; position: absolute; border-right: 2.4px solid; border-bottom: 2.4px solid; border-color: inherit; height: 6px; width: 6px; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); transition: 0.1s ease-in-out; top: 8px; } .cyt-accordion.cyt-accordion-active .cyt-accordion-chevron i::before { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); } .cyt-audit-table .cyt-cookie-des-table li { list-style-type: none; display: flex; padding: 3px 0; } .cyt-audit-table .cyt-cookie-des-table { font-size: 12px; line-height: 24px; font-weight: 400; padding:10px; margin: 0; } .cyt-cookie-des-table li div:first-child { width: 100px; font-weight: 600; word-break: break-word; word-wrap: break-word; } .cyt-cookie-des-table li div:last-child { flex: 1; word-break: break-word; word-wrap: break-word; margin-left: 8px; } .cyt-audit-table .cyt-cookie-des-table li:first-child { padding-top: 0; } .cyt-accordion .cyt-accordion-body { display: none; } .cyt-accordion.cyt-accordion-active .cyt-accordion-body { display: block; padding: 0 22px; margin-bottom: 16px; } .cyt-audit-table .cyt-empty-cookies-text { color: inherit; font-size: 12px; line-height: 24px; margin: 0; padding: 10px; } .cyt-poweredBy-bottom{ font-size: 11px; display: flex; justify-content: flex-end; background-color: #EDEDED; align-items: center; padding: 12px; margin: 20px -20px -15px -20px; line-height:24px; } .cyt-poweredBy-bottom span img, .cyt-poweredBy span img{ width:40px; margin:0 5px; } .cyt-main-wrapper .cookieNoticeTitleDiv{ display:flex; justify-content:space-between; align-items:center; } .cyt-main-wrapper .cookieNoticeTitleDiv .cyt-poweredBy{ display:flex; justify-content:space-between; align-items:center; font-size: 11px; font-weight:normal; color:#858788; top:5px; right:15px; color: #797979; } .cyt-do-not-sell-button{ padding:0; min-height:25px !important; } .cyt-revisitIcon{ display: flex; align-items: center; justify-content: center; background: #00B08B; width: 45px; height: 45px; border-radius: 50%; position: fixed; z-index: 999999; cursor: pointer; box-shadow: 0 32px 68px rgb(0 0 0 / 30%); } .cyt-revisitIcon-left{ bottom:15px; left:15px; } .cyt-revisitIcon-right{ bottom:15px; right:15px; } .cyt-revisitIcon button{ cursor: pointer; background:transparent; border:none; line-height:normal; } .cyt-revisitIcon img{ width:30px } .cyt-revisitIcon-hide{ display:none } .cyt-revistIcon-text-left{ display:none; position: absolute; top: 30%; width: 125px; left: 120%; background-color: black; color: #fff; border-radius: 4px; font-size: 11px; padding:4px; } .cyt-revisitIcon:hover .cyt-revistIcon-text-left{ display:block; } .cyt-revistIcon-text-left::after { content: " "; position: absolute; top: 25%; left: -9%; border-width: 5px; border-style: solid; border-color: transparent black transparent transparent; } .cyt-revistIcon-text-right{ display:none; position: absolute; top: 30%; width: 125px; right: 120%; background-color: black; color: #fff; padding: 4px; border-radius: 4px; font-size: 11px; } .cyt-revisitIcon:hover .cyt-revistIcon-text-right{ display:block; } .cyt-revistIcon-text-right::after { content: " "; position: absolute; top: 25%; right: -9%; border-width: 5px; border-style: solid; border-color: transparent transparent transparent black; padding: 4px; } .cyt-hide{ display:none !important; } .cyt-flex1{ flex:1 1 0%; padding:8px 27px; } .cyt-main-wrapper.box_left_top .cyt-ccpaDoNotSellAndSavePrefDiv ,.cyt-main-wrapper.box_right_top .cyt-ccpaDoNotSellAndSavePrefDiv, .cyt-main-wrapper.box_left_bottom .cyt-ccpaDoNotSellAndSavePrefDiv, .cyt-main-wrapper.box_right_bottom .cyt-ccpaDoNotSellAndSavePrefDiv{ flex-direction:column; } .cyt-blocked-content-div{ background-color:#e6e7e8; display:inline-flex; justify-content:center; align-items:center; line-height:24px; } .cyt-blocked-content-div p{ display:flex; justify-content:center; align-items:center; font-size:16px !important; } .cyt-blocked-content-div svg{ height:24px; width:24px; margin-right:4px; } .cyt-consentCount{ background-color: #d6d6d6; border-radius: 5em; display: inline-block; font-size: .8em; font-weight: 700; letter-spacing: .25px; line-height: 1.2em; margin-left: 0.2em; padding: 0.25em 0.5em; } .cyt-consentCount-arrow{ cursor:pointer; } .cyt-consentCount-arrow-up::after{ border-style: solid; border-width: 0.15em 0.15em 0 0; content: ""; display: inline-block; height: 6px; width: 6px; position: absolute; right: 1em; top: 1em; transform: rotate(-45deg); } .cyt-consentCount-arrow-down::after{ border-style: solid; border-width: 0.15em 0.15em 0 0; content: ""; display: inline-block; height: 6px; width: 6px; position: absolute; right: 1em; top: 1em; transform: rotate(-225deg); } .cyt-category-count-div{ display:flex; justify-content:space-between; margin: 20px 0 0px 0; } .cyt-category-title{ font-weight:700; font-size:16px; } .cyt-category-value{ margin-right:10px; font-size:14px; } .cyt-cookieStringDomainWraper{ border: 1px solid #d6d6d6; padding:10px; margin-bottom:10px; position:relative; cursor:pointer; border-radius:5px; } .cyt-getCookiesStringContainer{ display:none; transition: 0.1s ease-in-out; } .cyt-domainName{ font-weight:700; font-size:14px; display:flex; align-items:center; } .cyt-overlay{ background: #000000; opacity: 0.4; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 99999999; } .cookieNoticeMessageTextDiv p{ margin:0; display:inline; font-size: 14px; line-height: 24px; } .cyt-domainLink{ display: inline-flex; align-items: center; text-decoration: none; transition: all .3s ease-in-out; font-size:14px; position:relative; } .cyt-domainLink svg{ width:16px; height:16px; margin-left: 0.8em; } .cyt-urlIconTooltip{ display:none; top: 30%; width: 160px; right: 110%; background-color: black; color: #fff; padding: 3.2px; border-radius: 4px; font-size: 11px; margin-left: 0.8em; line-height: normal; } .cyt-urlIconTooltip::after{ content: " "; position: absolute; top: 25%; left: 13%; border-width: 5px; border-style: solid; border-color: transparent black transparent transparent; } .cyt-domainLink:hover .cyt-urlIconTooltip{ display:block; } .cyt-poweredBy-title{ display:flex; align-items:center; } .doNotSellDiv{ font-weight:bold; cursor:pointer; font-size:14px; } .doNotSellDiv a{ display: inline-flex; align-items: center; text-decoration: none; color:#1863DC; } .doNotSellDiv a:active{ color:#1863DC; } @keyframes cyt-classic-top-expand { 0% { opacity: 0; transform: translateY(-50%); } 50% { opacity: 0; } 100% { opacity: 1; transform: translateY(0); } } @keyframes cyt-classic-bottom-expand { 0% { transform: translateY(50%); } 100% { transform: translateY(0); } } @media only screen and (max-width: 1024px) { .cyt-main-wrapper .cookieNoticeMessageDiv { flex-direction:column; align-item:center margin-bottom:10px; } .cyt-main-wrapper .cookieNoticeMessageDiv .cookieNoticeMessageTextDiv{ margin-bottom:10px; } .cyt-do-not-sell-button{ text-align:left; padding:0; min-height:25px !important; } .cyt-consent-bar{ padding:10px 15px; } .cyt-modal.modal-open{ max-height:100vh; width:100%; } .cyt-ccpaDoNotSellAndSavePrefDiv{ flex-direction:column; } .cyt-ccpaDoNotSellButtonDiv{ width:100% !important; margin-top:10px; } } @media only screen and (max-width: 450px) { .cookieNoticeButtonsDiv{ flex-wrap:wrap; } .doNotSellTextAndButtonsContainer{ flex-direction:column; margin-top:0px !important; align-items:inherit !important; } .doNotSellDiv{ margin-bottom:10px !important; } .cyt-btn-customize { flex:1 1 0%; } .cyt-btn{ flex:1 1 0%; } .cyt-btn-acceptAll{ order:1; flex-basis:100% !important; margin-bottom: 10px; margin-top:10px; margin-right:10px !important; } .cyt-btn-customize{ order:2; flex-basis:0% !important; } .cyt-btn-reject{ order:3; margin-right:10px !important; flex-basis:0% !important; } .cyt-main-wrapper.box_left_top{ top:0; left:0; width:100% !important; } .cyt-main-wrapper.box_right_top{ right:0; top:0; width:100% !important; } .cyt-main-wrapper.box_left_bottom{ bottom:0; left:0; width:100% !important; } .cyt-main-wrapper.box_right_bottom{ right:0; bottom:0; width:100% !important; } .cyt-modal-button-container{ flex-wrap:wrap } .cyt-modal-button-container .cyt-cancel-button{ margin-bottom:10px !important; } .cyt-modal-button-container .cyt-flex1{ flex:1 0 100%; } .modal-open .saveMyPreferencesButtonDiv{ flex-wrap:wrap } .modal-open .saveMyPreferencesButtonDiv .cyt-btn{ flex:1 0 100%; } .modal-open .saveMyPreferencesButtonDiv .cyt-btn-acceptAll{ order:1; margin:0 0 10px 0 !important; } .modal-open .saveMyPreferencesButtonDiv .cyt-btn-reject{ order:3; margin:0px !important; } .modal-open .saveMyPreferencesButtonDiv .cyt-btn-savePref{ order:2; margin:0 0 10px 0 !important; } .cyt-poweredBy-title{ flex-direction:column; } } @media only screen and (max-width: 300px) { .cookieNoticeTitleDiv{ margin-top:10px !important; } } ` closeIcon = ` ` poweredByDivTop = '
Powered by
' poweredByDivBottom = '
Powered by
' infoIcon = ` ` revisitIcon = `
` showRevisitIcon = this.template_values.content.is_revisit_consent_visible !== 'false' && this.template_values.content.is_revisit_consent_visible is_lang_enable = this.template_values.general.is_tl === 'enabled' ? true : false constructor() { if(this.is_lang_enable){ this.translateLang() } else {} this.scriptData = localStorage?.getItem('scriptData') this.scriptData = JSON.parse(this.scriptData) this.addStylesToHead(this.css) this.template_values.consent_template = this.template_values.consent_template.toLowerCase() if (this.template_values.content.customer_logo){ if (this.template_values.content.is_cookie_notice_close_button_enable) { this.CustomerLogo += `${this.closeIcon}
` } else { this.CustomerLogo += `` } } else { if (this.template_values.content.is_cookie_notice_close_button_enable) { this.poweredByDivTop += `${this.closeIcon}` } else { this.poweredByDivTop += `` } } this.customize_consent_preferences_categories = this.reArrangeCustomizeConsentPrefrence( this.customize_consent_preferences_categories ) } translateLang(){ const template_data = this.template_values const unclassified_desc = "Unclassified uncategorized cookies are those that are being analyzed and have not been classified into a category as yet." const functional_desc = "Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features." const analytics_desc = "Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc." const marketing_desc = "Marketing cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns." const necessary_desc = "Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data." const advertisement_desc = "This cookie tells the company what original medium was used to send the link (i.e. referral, email, instant message, etc.)." const do_not_sell = template_data?.content?.cookie_notice_do_not_sell_link_text const categories = "Categories" const go_to_website = "Go to company website url" const requestBody = { q: [template_data?.content?.cookie_notice_title, template_data?.content?.cookie_notice_message, template_data?.content?.cookie_notice_accept_button_text, template_data?.content?.cookie_notice_reject_button_text, template_data?.content?.cookie_notice_customize_button_text, template_data?.content?.preference_center_title, template_data?.content?.preference_center_overview, "Unclassified", "Functional", "Analytics", "Marketing", "Necessary", "Advertisement", unclassified_desc, functional_desc, analytics_desc, marketing_desc, necessary_desc, advertisement_desc, do_not_sell, template_data?.content?.preference_center_save_preference_button_text, categories, go_to_website, template_data?.content?.cookie_list_always_active_label, template_data?.content?.cookie_list_no_cookies_to_display_label, template_data?.content?.opt_out_title, template_data?.content?.opt_out_privacy_overview, template_data?.content?.opt_out_save_preference_button_text, template_data?.content?.blocked_consent_text, template_data?.content?.revisit_consent_text, template_data?.content?.opt_out_cancel_button_text, "of", "Selected" ], target: navigator.language }; this.APIRequest('/api/v1/consent_template/lang_api/' + this.tenant_id, { method: 'POST', body: JSON.stringify(requestBody), }) .then(response => response.json()) .then(data => { this.tl_cookie_notice_title = data.data.cookie_title this.tl_cookie_notice_message = data.data.cookie_message this.tl_cookie_notice_accept_button_text = data.data.accept_button this.tl_cookie_notice_reject_button_text = data.data.reject_button this.tl_cookie_notice_customize_button_text = data.data.customized_button this.tl_preference_center_title = data.data.preference_title this.tl_preference_center_overview = data.data.preference_overview this.tl_unclassified = data.data.unclassified_title this.tl_functional = data.data.functional_title this.tl_analytics = data.data.analytics_title this.tl_marketing = data.data.marketing_title this.tl_necessary = data.data.necessary_title this.tl_advertisement = data.data.advertisement_title this.tl_unclassified_desc = data.data.unclassified_desc_res this.tl_functional_desc = data.data.functional_desc_res this.tl_analytics_desc = data.data.analytics_desc_res this.tl_marketing_desc = data.data.marketing_desc_res this.tl_necessary_desc = data.data.necessary_desc_res this.tl_advertisement_desc = data.data.advertisement_desc_res this.tl_do_not_sell_link_text = data.data.donot_sell_resp this.tl_preference_center_save_preference_button_text = data.data.preference_button this.tl_categories = data.data.categories_text this.tl_go_to_website = data.data.go_to_website_text this.tl_always_active = data.data.always_active_text this.tl_no_cookie_text = data.data.no_cookies_text this.tl_opt_out_title = data.data.opt_out_title_resp this.tl_opt_out_privacy_overview = data.data.opt_out_privacy_overview_resp this.tl_opt_out_save_preference_button_text = data.data.opt_out_save_preference_button_text_resp this.tl_blocked_consent_text = data.data.blocked_consent_text_resp this.tl_revisit_consent_text = data.data.revisit_consent_text_resp this.tl_opt_out_cancel_button_text = data.data.opt_out_cancel_button_text_resp this.tl_off = data.data.of_data this.tl_selected_data = data.data.selected_data }) .catch(this.handleError) } reArrangeCustomizeConsentPrefrence() { return [ { ...this.customize_consent_preferences_categories.find(value => value.category_name === 'Necessary') }, { ...this.customize_consent_preferences_categories.find(value => value.category_name === 'Functional'), }, { ...this.customize_consent_preferences_categories.find(value => value.category_name === 'Analytics'), }, { ...this.customize_consent_preferences_categories.find(value => value.category_name === 'Marketing'), }, { ...this.customize_consent_preferences_categories.find(value => value.category_name === 'Unclassified'), }, ] } setCategoryCountSelected() { let count = 0 this.customize_consent_preferences_categories?.forEach((e, index) => { const id = 'cyt-category-' + index const checkbox = document.getElementById(id) if (checkbox?.checked) { count++ } }) const categoryCountDiv = document.getElementById('cyt-categoryCountDiv') if (categoryCountDiv) { if(this.is_lang_enable){ categoryCountDiv.innerHTML = `${count} ${this.tl_off} ${this.customize_consent_preferences_categories.length} ${this.tl_selected_data}` }else{ categoryCountDiv.innerHTML = `${count} of ${this.customize_consent_preferences_categories.length} Selected` } } } // on page load make all third party script tags as plain text onLoadRemoveScripts() { let observer = new MutationObserver(callback) let _that = this function callback(mutations) { if (document.body) { for (let script of _that.thirdPartyScripts) { const scriptTag = document.querySelector('script[src*="' + script + '"]') if (scriptTag) { scriptTag.type = 'text/plain' scriptTag.dataset.cookieCategory = 'Testing' } } observer.disconnect() _that.modifyScripts() } } observer.observe(document.head, { childList: true, subtree: true, }) } enableScripts() { const scriptTags = document.querySelectorAll('script') const acceptedCookiesCategory = Object.keys(this.scriptData?.accepted_cookies_category || {}) const consentStatus = this.scriptData?.consent_status for (let script of scriptTags) { if (consentStatus === 'partially_accepted' && acceptedCookiesCategory.includes(script.dataset.cookiecategory)) { script.type = 'text/javascript' script.parentNode.replaceChild(script, script) } else if (script.type === 'text/plain') { script.type = 'text/javascript' script.parentNode.replaceChild(script, script) } } } enableIframeTags() { const iframeTags = document.querySelectorAll('iframe') const acceptedCookiesCategory = Object.keys(this.scriptData?.accepted_cookies_category || {}) const consentStatus = this.scriptData?.consent_status const enableIframe = iframe => { this.hideContentBlockedDiv('iframe') iframe.setAttribute('src', iframe.dataset.src) iframe.removeAttribute('data-src') iframe.style.display = 'initial' iframe.parentNode.replaceChild(iframe, iframe) } for (let iframe of iframeTags) { if (consentStatus === 'partially_accepted' && acceptedCookiesCategory.includes(iframe.dataset.cookiecategory)) { enableIframe(iframe) } else if (iframe.dataset.src) { enableIframe(iframe) } } } enableEmbedTags() { const embedTags = document.querySelectorAll('embed') const acceptedCookiesCategory = Object.keys(this.scriptData?.accepted_cookies_category || {}) const consentStatus = this.scriptData?.consent_status const enableEmbedTag = embed => { this.hideContentBlockedDiv('embed') embed.setAttribute('src', embed.dataset.src) embed.removeAttribute('data-src') embed.style.display = 'initial' embed.parentNode.replaceChild(embed, embed) } for (let embed of embedTags) { if (consentStatus === 'partially_accepted' && acceptedCookiesCategory.includes(embed.dataset.cookiecategory)) { enableEmbedTag(embed) } else if (embed.dataset.src) { enableEmbedTag(embed) } } } enableObjectTags() { const objectTags = document.querySelectorAll('object') const acceptedCookiesCategory = Object.keys(this.scriptData?.accepted_cookies_category || {}) const consentStatus = this.scriptData?.consent_status const enableObjectTag = object => { this.hideContentBlockedDiv('object') object.setAttribute('data', object.dataset.data) object.removeAttribute('data-data') object.style.display = 'initial' object.parentNode.replaceChild(object, object) } for (let object of objectTags) { if (consentStatus === 'partially_accepted' && acceptedCookiesCategory.includes(object.dataset.cookiecategory)) { enableObjectTag(object) } else if (object.dataset.data) { enableObjectTag(object) } } } hideContentBlockedDiv(tag) { Array.from(document.getElementsByClassName('cyt-blocked-content-div')).forEach(function (element, index, array) { if (element.dataset.tag === tag) { element.style.display = 'none' } }) } removeCookies(cookies, custom_path, domains) { var path = custom_path ? custom_path : '/' var expires = 'Expires=Thu, 01 Jan 1970 00:00:01 GMT;' for (var i = 0; i < cookies.length; i++) { for (var j = 0; j < domains.length; j++) { document.cookie = cookies[i] + '=; path=' + path + (domains[j].indexOf('.') == 0 ? '; domain=' + domains[j] : '') + '; ' + expires } } } removeFirstPartyCookies() { const consentStatus = localStorage.getItem('cyt_consent_given') const rejectedCookiesCategory = Object.keys(this.scriptData?.rejected_cookies_category || {}) for (let cookies in this.firstPartyCookies) { if (consentStatus === 'rejected') { this.removeCookies(this.firstPartyCookies[cookies].cookies, '/', this.domains) } else if ( consentStatus === 'partially_accepted' && rejectedCookiesCategory.includes(this.firstPartyCookies[cookies].category) ) { this.removeCookies(this.firstPartyCookies[cookies].cookies, '/', this.domains) } } } getCookies() { // array of names of all existing cookies let cookies = document.cookie.split(/;\s*/) let found = [] for (var i = 0; i < cookies.length; i++) { found.push(cookies[i].split('=')[0]) } return found } modifyScripts() { if (this.scriptData) { const scriptTags = document.querySelectorAll('script[' + this.scriptSelector + ']') for (let script of scriptTags) { let newType = script.type if (this.scriptData?.consent_status === 'accepted') { newType = 'text/javascript' } else if (this.scriptData?.consent_status === 'rejected') { newType = 'text/plain' } else { let acceptedCategories if (this.scriptData.accepted_cookies_category) { acceptedCategories = Object.keys(this.scriptData.accepted_cookies_category) } const category = script.getAttribute(this.scriptSelector) if (acceptedCategories?.includes(category)) { newType = 'text/javascript' } else { newType = 'text/plain' } } if (newType !== script.type) { const newScript = document.createElement('script') newScript.src = script.src newScript.type = newType script.parentNode.replaceChild(newScript, script) } } } } addStylesToHead(styleString) { const style = document.createElement('style') style.textContent = styleString document.head.append(style) } APIRequest(url, options) { return fetch(this.API_URL + url, { headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-CSRFToken': this.XCSRFToken, }, ...options, }) } handleError(e) {} getCookiesFromDocument() { let cookies = [] if (document && document.cookie && document.cookie != '') { let split = document.cookie.split(';') for (let i = 0; i < split.length; i++) { let name_value = split[i]?.split('=') if (name_value && name_value.length > 1) { name_value[0] = name_value[0]?.replace(/^ /, '') cookies.push({ name: decodeURIComponent(name_value[0]), value: decodeURIComponent(name_value[1]), }) } } } return cookies } async getCookiesArray() { let cookies try { const results = await cookieStore.getAll() if (results?.length > 0) { cookies = results } else { cookies = this.getCookiesFromDocument() } } catch (error) { cookies = this.getCookiesFromDocument() } return cookies } getScriptsArray() { const scriptElements = document.getElementsByTagName('script') let scripts = [] if (scriptElements?.length > 0) { for (const scriptElement of scriptElements) { if (scriptElement?.src) { scripts.push(scriptElement?.src) } } } return scripts } setCookie(cname, cvalue, exdays) { const d = new Date() d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000) let expires = 'expires=' + d.toUTCString() document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/' } scanCookies() { this.getCookiesArray() ?.then(cookies => { fetch('https://ipapi.co/json') ?.then(res => { res ?.json() ?.then(resJson => { const tenant_domain = location?.hostname const ipAddress = resJson?.ip const city = resJson?.city const country = resJson?.country_name const state = resJson?.region const scripts = this.getScriptsArray() const data = { tenant_domain, ipAddress, city, country, state, cookies, scripts, } this.APIRequest('/api/v1/cookies', { method: 'POST', body: JSON.stringify(data), })?.then(res => { localStorage.setItem('coookies_scanned', 'true') }) }) ?.catch(this.handleError) }) ?.catch(this.handleError) }) ?.catch(this.handleError) } getCookiesByCategoryCookies(category_cookies) { let cookieNames = [] category_cookies?.map(domain => { const domainKey = Object.keys(domain)[0] domain[domainKey]?.map(cookie => { cookieNames.push(cookie?.cookie_name) }) }) return cookieNames } sendUserConsent(consentStatus) { this.closeConsentBanner() //removing overlay document.querySelector('.cyt-overlay').classList.add('cyt-hide') let request = { consent_category: 'website', ip_address: '', consent_status: consentStatus, accepted_cookies_category: {}, rejected_cookies_category: {}, banner_type: this.template_values?.consent_template, } if (consentStatus === 'ccpa') { const checkbox = document.getElementById('opt-out-ccpa-checkbox') if (checkbox?.checked) { request.consent_status = 'rejected' localStorage.setItem('cyt_consent_given', 'rejected') } else { request.consent_status = 'accepted' localStorage.setItem('cyt_consent_given', 'accepted') } } else if (consentStatus === 'partially_accepted') { const isAllChecked = Object.values(document.querySelectorAll('.cyt-checkbox'))?.every(e => e.checked) const isAllUnChecked = Object.values(document.querySelectorAll('.cyt-checkbox'))?.every(e => !e.checked) if (isAllChecked) { request.consent_status = 'accepted' localStorage.setItem('cyt_consent_given', 'accepted') } else if (isAllUnChecked) { request.consent_status = 'rejected' localStorage.setItem('cyt_consent_given', 'rejected') } else { localStorage.setItem('cyt_consent_given', 'partially_accepted') let categories = {} this.customize_consent_preferences_categories?.forEach((e, index) => { const id = 'cyt-category-' + index const checkbox = document.getElementById(id) categories[e.category_name] = this.getCookiesByCategoryCookies(e.category_cookies) if (checkbox?.checked) { request.accepted_cookies_category[e.category_name] = this.getCookiesByCategoryCookies(e.category_cookies) } else { request.rejected_cookies_category[e.category_name] = this.getCookiesByCategoryCookies(e.category_cookies) } }) } } this.closeConsentBanner() request.ip_address = this.user_info.ip this.APIRequest('/api/v1/consent_logs/add/' + location?.hostname, { method: 'POST', body: JSON.stringify(request), }) ?.then(res => { this.scriptData = localStorage?.getItem('scriptData') this.scriptData = JSON.parse(this.scriptData) if (this.scriptData) { let newScriptData = { template_type: consentStatus == 'ccpa' ? 'ccpa' : 'gdpr', ...this.scriptData, ...request, consent_given_at: new Date(), } this.scriptData = newScriptData localStorage?.setItem('scriptData', JSON.stringify(newScriptData)) this.setCookie('cyt-consent', this.scriptData.consent_status, 30) window.location.reload() } }) ?.catch(this.handleError) } sendPrivacyCenterStatus(status) { this.scriptData = localStorage?.getItem('scriptData') this.scriptData = JSON.parse(this.scriptData) if (this.scriptData?.pc_status == status) { return } const tenant_status = status ? 'active' : 'NULL' const data = { tenant_status } this.APIRequest('/api/v1/tenants/tenant_pc_status/' + this.tenant_id, { method: 'PUT', body: JSON.stringify(data), }) .then(() => { localStorage?.setItem( 'scriptData', JSON.stringify({ UI_URL: this.UI_URL, tenant_id: this.tenant_id, tenant_pc_html_code: this.tenant_pc_html_code, pc_url: this.pc_url, pc_status: status, }) ) }) .catch(this.handleError) } findURLInDocument() { let source = document.getElementsByTagName('html')[0].innerHTML let foundIndex = source.indexOf(this.pc_url) return foundIndex > 1 } checkIfPCURLAlreadyExists() { if (!this.scriptData) { this.scriptData = localStorage?.getItem('scriptData') this.scriptData = JSON.parse(this.scriptData) } let pc_status = this.findURLInDocument() if (this.scriptData && pc_status != this.scriptData?.pc_status) { this.sendPrivacyCenterStatus(pc_status) } } createButton(text, textColor, backgroundColor, borderColor, width = 'auto', className = 'cyt-btn', margin = '10px') { const button = document.createElement('button') button.textContent = text button.style.fontSize = '14px' button.style.fontWeight = 500 button.style.borderRadius = '2px' button.style.backgroundColor = backgroundColor button.style.color = textColor button.style.marginRight = margin button.style.cursor = 'pointer' button.style.border = '2px solid ' + borderColor button.className = className return button } createDivWithClass(className) { const div = document.createElement('div') div.className = className return div } onCytButtonClick(btn) { const div = document.getElementById(btn.dataset.cytTag) if (!this.template_values.content.is_show_cookie_list_visible) { return } if (div.classList.contains('cyt-accordion-active')) { div.classList.remove('cyt-accordion-active') } else { div.classList.add('cyt-accordion-active') } } closeConsentBanner() { document.querySelector('.cyt-main-wrapper')?.classList.remove('cyt-consent-container-show') document.querySelector('.cyt-modal')?.classList.remove('modal-open') } showBanner(isShowBanner = false) { const data = this.template_values const body = document.getElementsByTagName('body')[0] if (this.showRevisitIcon && isShowBanner) { const revisitButton = document.getElementsByClassName('cyt-revisitIcon') if (revisitButton[0] && !localStorage.getItem('cyt-consent-given')) { revisitButton[0].classList.add('cyt-revisitIcon-hide') } } if (body) { const div = this.createDivWithClass( 'cyt-consent-container cyt-main-wrapper ' + (isShowBanner ? ' cyt-consent-container-show ' : '') + data?.layout?.type ) const cytConsentBar = this.createDivWithClass('cyt-consent-bar') let buttonsDivMarginTop = '' const cookieNoticeMessageDiv = this.createDivWithClass('cookieNoticeMessageDiv') if (data?.layout?.type.includes('box_')) { buttonsDivMarginTop = 'margin-top: 15px;' cookieNoticeMessageDiv.style.flexDirection = 'column' div.style.width = '450px' div.style.height = 'auto' div.style.borderRadius = '4px' } cytConsentBar.style.backgroundColor = data?.colors?.cookie_notice_background_color // Cookie notice title const cookieNoticeTitleDiv = this.createDivWithClass('cookieNoticeTitleDiv') cookieNoticeTitleDiv.style.color = data?.colors?.cookie_notice_title_color cookieNoticeTitleDiv.textContent = this.is_lang_enable ? this.tl_cookie_notice_title : data?.content?.cookie_notice_title if(this.template_values.content.is_remove_cytrio_button_enable) { if(this.template_values?.content?.customer_logo) { cookieNoticeTitleDiv.appendChild(this.htmlToElement(this.CustomerLogo)) }else { cookieNoticeTitleDiv.appendChild(this.htmlToElement(this.poweredByDivTop)) } } cytConsentBar.appendChild(cookieNoticeTitleDiv) const cookieNoticeCustomizeButton = this.createButton( this.is_lang_enable ? this.tl_cookie_notice_customize_button_text : data?.content?.cookie_notice_customize_button_text, data?.colors?.cookie_notice_customize_button_text_color, data?.colors?.cookie_notice_customize_button_background_color, data?.colors?.cookie_notice_customize_button_border_color, 'auto', 'cyt-btn' ) cookieNoticeCustomizeButton.addEventListener('click', () => { const overlayDiv = document.querySelector('.cyt-overlay') if (data.layout.type.includes('classic_')) { const consentContainer = document.querySelector('.cyt-consent-container') if (consentContainer?.classList.contains('cyt-consent-bar-expand')) { consentContainer?.classList.remove('cyt-consent-bar-expand') overlayDiv.classList.add('cyt-hide') } else { overlayDiv.classList.remove('cyt-hide') consentContainer?.classList.add('cyt-consent-bar-expand') } } else { document.querySelector('.cyt-main-wrapper')?.classList.remove('cyt-consent-container-show') document.querySelector('.cyt-modal')?.classList.add('modal-open') overlayDiv.classList.remove('cyt-hide') } }) const cookieNoticeRejectAllDiv = this.createButton( this.is_lang_enable ? this.tl_cookie_notice_reject_button_text : data?.content?.cookie_notice_reject_button_text, data?.colors?.cookie_notice_reject_all_button_text_color, data?.colors?.cookie_notice_reject_all_button_background_color, data?.colors?.cookie_notice_reject_all_button_border_color, '', 'cyt-btn-reject cyt-btn' ) cookieNoticeRejectAllDiv.addEventListener('click', () => { this.sendUserConsent('rejected') localStorage.setItem('cyt_consent_given', 'rejected') }) const cookieNoticeAcceptAllDiv = this.createButton( this.is_lang_enable ? this.tl_cookie_notice_accept_button_text : data?.content?.cookie_notice_accept_button_text, data?.colors?.cookie_notice_accept_all_button_text_color, data?.colors?.cookie_notice_accept_all_button_background_color, data?.colors?.cookie_notice_accept_all_button_border_color, 'auto', 'cyt-btn cyt-btn-acceptAll', '0px' ) cookieNoticeAcceptAllDiv.addEventListener('click', () => { this.sendUserConsent('accepted') localStorage.setItem('cyt_consent_given', 'accepted') }) const doNotSellMyPersonalInfoButton = this.createButton( this.is_lang_enable ? this.tl_do_not_sell_link_text : data?.content?.cookie_notice_do_not_sell_link_text, data?.colors?.cookie_notice_do_not_sell_text_color, '#FFF', '#FFF', '', 'cyt-do-not-sell-button' ) const saveMyPreferencesButton = this.createButton( this.is_lang_enable ? this.tl_opt_out_save_preference_button_text : this.template_values?.content?.opt_out_save_preference_button_text, this.template_values?.colors?.opt_out_checkbox_save_pref_text_color, this.template_values?.colors?.opt_out_checkbox_save_pref_background_color, this.template_values?.colors?.opt_out_checkbox_save_pref_border_color, '', 'cyt-btn cyt-flex1', '0px' ) saveMyPreferencesButton.addEventListener('click', () => this.sendUserConsent('ccpa')) const cancelButton = this.createButton( this.is_lang_enable ? this.tl_opt_out_cancel_button_text : this.template_values?.content?.opt_out_cancel_button_text, this.template_values?.colors?.opt_out_checkbox_cancel_button_text_color, this.template_values?.colors?.opt_out_checkbox_cancel_button_background_color, this.template_values?.colors?.opt_out_checkbox_cancel_button_border_color, '', 'cyt-btn cyt-flex1' ) cancelButton.addEventListener('click', () => { this.closeConsentBanner() document.getElementsByClassName('cyt-revisitIcon')[0].classList.remove('cyt-revisitIcon-hide') }) doNotSellMyPersonalInfoButton.addEventListener('click', () => { document.querySelector('.cyt-main-wrapper')?.classList.remove('cyt-consent-container-show') document.querySelector('.cyt-modal')?.classList.add('modal-open') }) // Cookie notice message const cookieNoticeMessageTextDiv = this.createDivWithClass('cookieNoticeMessageTextDiv') cookieNoticeMessageTextDiv.style.color = data?.colors?.cookie_notice_message_color cookieNoticeMessageTextDiv.appendChild(this.htmlToElement(this.is_lang_enable ? this.tl_cookie_notice_message : data?.content?.cookie_notice_message)) cookieNoticeMessageDiv.appendChild(cookieNoticeMessageTextDiv) // Cookie notice Button and do not sell link const cookieNoticeButtonsDiv = document.createElement('div') cookieNoticeButtonsDiv.setAttribute('class', 'doNotSellTextAndButtonsContainer') const showDoNotSellLink = data?.general?.is_show_do_not_sell_link && data?.consent_template === 'ccpa' cookieNoticeButtonsDiv.setAttribute( 'style', `display: flex;align-items: center; margin-top:1rem;${ showDoNotSellLink ? 'justify-content: space-between;' : 'justify-content: end;' }` + buttonsDivMarginTop ) //adding do not sell link if (showDoNotSellLink) { if (data.layout.type.includes('box_')) { cookieNoticeButtonsDiv.setAttribute('style', 'display:flex;flex-direction:column;align-items:end;') } cookieNoticeButtonsDiv.appendChild( this.htmlToElement( `
${this.is_lang_enable ? this.tl_do_not_sell_link_text : data?.content?.cookie_notice_do_not_sell_link_text}
` ) ) } // Adding buttons const cookieNoticeButtonsContainer = document.createElement('div') cookieNoticeButtonsContainer.setAttribute('class', 'cookieNoticeButtonsDiv') cookieNoticeButtonsContainer.style.display = 'flex' if (data?.content?.is_cookie_notice_customize_button_enable) { cookieNoticeButtonsContainer.appendChild(cookieNoticeCustomizeButton) } if (data?.content?.is_cookie_notice_reject_button_enable) { cookieNoticeButtonsContainer.appendChild(cookieNoticeRejectAllDiv) } cookieNoticeButtonsContainer.appendChild(cookieNoticeAcceptAllDiv) cookieNoticeButtonsDiv.appendChild(cookieNoticeButtonsContainer) cytConsentBar.appendChild(cookieNoticeMessageDiv) cytConsentBar.appendChild(cookieNoticeButtonsDiv) div.appendChild(cytConsentBar) if (data.layout.type.includes('classic_')) { const customizeConsentPreferencesDiv = this.getCustomizeConsentPreferences() div.appendChild(customizeConsentPreferencesDiv) } const overlayDiv = this.createDivWithClass('cyt-overlay') overlayDiv.classList.add('cyt-hide') body.appendChild(overlayDiv) body.appendChild(div) // Handling Close icon document.querySelector('.cyt-closeIcon')?.addEventListener('click', () => { this.closeConsentBanner() document.getElementsByClassName('cyt-revisitIcon')[0].classList.remove('cyt-revisitIcon-hide') }) } } handleDomainClick(element) { const getCookieStringDiv = element.querySelector('.cyt-getCookiesStringContainer') if (element.classList.contains('cyt-consentCount-arrow-up')) { getCookieStringDiv.style.display = 'none' element.classList.remove('cyt-consentCount-arrow-up') element.classList.add('cyt-consentCount-arrow-down') } else { getCookieStringDiv.style.display = 'block' element.classList.remove('cyt-consentCount-arrow-down') element.classList.add('cyt-consentCount-arrow-up') } } getCompanyNameByDomain(domain = '') { if (domain.charAt(0) === '.') { domain = domain.substring(1) } if (domain.split('.').length > 2) { domain = domain.split('.')[1] } else { domain = domain.split('.')[0] } return domain.charAt(0).toUpperCase() + domain.slice(1) } getShadowDiv() { const shadowDiv = document.createElement('span') shadowDiv.style.display = 'block' shadowDiv.style.width = '100%' shadowDiv.style.height = '40px' shadowDiv.style.background = 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 100%)' shadowDiv.style.position = 'absolute' shadowDiv.style.top = '-30px' return shadowDiv } getCustomizeConsentPreferences(isModal = false) { const customizeConsentPreferencesDiv = this.createDivWithClass( isModal ? 'cyt-preference-wrapper-modal' : 'cyt-preference-wrapper' ) customizeConsentPreferencesDiv.style.backgroundColor = this.template_values?.colors?.cookie_notice_background_color const overflowDiv = this.createDivWithClass('overflowDiv') let preferencesTitleDiv = this.createDivWithClass('preferencesTitleDiv') preferencesTitleDiv.style.color = this.template_values?.colors?.preference_center_title preferencesTitleDiv.textContent = this.is_lang_enable ? this.tl_preference_center_title : this.template_values?.content?.preference_center_title let poweredByDiv; if(this.template_values.content.is_remove_cytrio_button_enable) { poweredByDiv = this.template_values?.content?.customer_logo ? this.htmlToElement(this.CustomerLogo) : this.htmlToElement(this.poweredByDivTop) } else { poweredByDiv = this.htmlToElement("
"); } poweredByDiv.appendChild( this.htmlToElement(``) ) // Adding event listner to close modal poweredByDiv.getElementsByTagName('button')?.[0]?.addEventListener('click', this.onCloseIconClick) if (isModal) { const preferencesTitleDivHTML = `
${this.is_lang_enable ? this.tl_preference_center_title : this.template_values?.content?.preference_center_title}
` preferencesTitleDiv = this.htmlToElement(preferencesTitleDivHTML) preferencesTitleDiv.appendChild(poweredByDiv) } const preferencesOverviewDiv = this.createDivWithClass('preferencesOverviewDiv') preferencesOverviewDiv.style.color = this.template_values?.colors?.preference_center_overview preferencesOverviewDiv.style.fontSize = '14px' preferencesOverviewDiv.textContent = this.is_lang_enable ? this.tl_preference_center_overview : this.template_values?.content?.preference_center_overview let html = '
' html += `
${this.is_lang_enable ? this.tl_categories : "Categories"}
` this.customize_consent_preferences_categories?.forEach((e, index) => { let isChecked = 'checked' if (!this.scriptData?.consent_status || this.scriptData?.consent_status == 'rejected') { isChecked = '' } else if (this.scriptData?.consent_status == 'partially_accepted') { isChecked = e.category_name in this.scriptData?.accepted_cookies_category ? 'checked' : '' } const getCookiesString = cookieList => { let cookies = '' if (cookieList.length > 0) { cookieList?.forEach(cookie => { cookies += `
` }) } else { cookies = `

${this.is_lang_enable ? this.tl_no_cookie_text : this.template_values?.content?.cookie_list_no_cookies_to_display_label}

` } return cookies } const isFromSameDomain = domain => { return window.location.hostname === domain } const cookieStringDomainWraper = () => { let domainAndCookies = '' if (e.category_cookies?.length > 0) { e.category_cookies?.forEach(cookie => { const domainName = Object.keys(cookie)[0] domainAndCookies += `
${isFromSameDomain(domainName) ? domainName : this.getCompanyNameByDomain(domainName)}
${cookie[domainName].length || 0}
${this.urlLinkIcon} ${this.is_lang_enable ? this.tl_go_to_website : "Go to company website url"}
${getCookiesString(cookie[domainName])}
` }) } else { domainAndCookies = `

${this.is_lang_enable ? this.tl_no_cookie_text : this.template_values?.content?.cookie_list_no_cookies_to_display_label}

` } return domainAndCookies } html += `
${ e.is_always_active ? `${ this.is_lang_enable ? this.tl_always_active : this.template_values.content.cookie_list_always_active_label }` : ` ` }

${this.is_lang_enable && e.category_name === 'Analytics' ? this.tl_analytics_desc : this.is_lang_enable && e.category_name === 'Necessary' ? this.tl_necessary_desc : this.is_lang_enable && e.category_name === 'Unclassified' ? this.tl_unclassified_desc : this.is_lang_enable && e.category_name === 'Marketing' ? this.tl_marketing_desc : this.is_lang_enable && e.category_name === 'Functional' ? this.tl_functional_desc : this.is_lang_enable && e.category_name === 'Advertisement' ? this.tl_advertisement_desc : e.category_description}

${cookieStringDomainWraper()}
` }) html += '
' const cookiesListDiv = this.htmlToElement(html) cookiesListDiv.querySelectorAll('.cyt-checkbox')?.forEach((element, index) => { element.addEventListener('change', event => { this.setCategoryCountSelected() const slider = cookiesListDiv.querySelector(`#cyt-slider-${index + 1}`) if (event.currentTarget.checked) { slider.style.backgroundColor = this.template_values.colors.preference_center_enable_state_color } else { slider.style.backgroundColor = this.template_values.colors.preference_center_disable_state_color } }) }) cookiesListDiv.querySelectorAll('.cyt-accordion-header-wrapper')?.forEach(element => { element.addEventListener('click', () => { if (this.template_values.content.is_show_cookie_list_visible) { this.onCytButtonClick(element) } }) }) cookiesListDiv.querySelectorAll('.cyt-accordion-chevron')?.forEach(element => { element.addEventListener('click', () => { if (this.template_values.content.is_show_cookie_list_visible) { this.onCytButtonClick(element) } }) }) cookiesListDiv.querySelectorAll('.cyt-cookieStringDomainWraper')?.forEach(element => { element.addEventListener('click', () => { this.handleDomainClick(element) }) }) const saveMyPreferencesButtonDiv = this.createDivWithClass('saveMyPreferencesButtonDiv') const cookieNoticeRejectAllDiv = this.createButton( this.is_lang_enable ? this.tl_cookie_notice_reject_button_text : this.template_values?.content?.cookie_notice_reject_button_text, this.template_values?.colors?.cookie_notice_reject_all_button_text_color, this.template_values?.colors?.cookie_notice_reject_all_button_background_color, this.template_values?.colors?.cookie_notice_reject_all_button_border_color, '', 'cyt-btn-reject cyt-btn' ) cookieNoticeRejectAllDiv.addEventListener('click', () => { this.sendUserConsent('rejected') localStorage.setItem('cyt_consent_given', 'rejected') }) const cookieNoticeAcceptAllDiv = this.createButton( this.is_lang_enable ? this.tl_cookie_notice_accept_button_text : this.template_values?.content?.cookie_notice_accept_button_text, this.template_values?.colors?.cookie_notice_accept_all_button_text_color, this.template_values?.colors?.cookie_notice_accept_all_button_background_color, this.template_values?.colors?.cookie_notice_accept_all_button_border_color, '', 'cyt-btn-acceptAll cyt-btn', '0px' ) cookieNoticeAcceptAllDiv.addEventListener('click', () => { this.sendUserConsent('accepted') localStorage.setItem('cyt_consent_given', 'accepted') }) const saveMyPreferencesButton = this.createButton( this.is_lang_enable ? this.tl_preference_center_save_preference_button_text : this.template_values?.content?.preference_center_save_preference_button_text, this.template_values?.colors?.preference_center_save_pref_text_color, this.template_values?.colors?.preference_center_save_pref_background_color, this.template_values?.colors?.preference_center_save_pref_border_color, isModal ? 'auto' : '200px', 'cyt-btn cyt-btn-savePref', isModal ? '10px' : '0px' ) saveMyPreferencesButton.addEventListener('click', () => { this.sendUserConsent('partially_accepted') }) if (isModal) { saveMyPreferencesButtonDiv.appendChild(cookieNoticeRejectAllDiv) } saveMyPreferencesButtonDiv.appendChild(saveMyPreferencesButton) if (isModal) { saveMyPreferencesButtonDiv.appendChild(cookieNoticeAcceptAllDiv) } if (isModal) { customizeConsentPreferencesDiv.appendChild(preferencesTitleDiv) } else { overflowDiv.appendChild(preferencesTitleDiv) } saveMyPreferencesButtonDiv.appendChild(this.getShadowDiv()) overflowDiv.appendChild(preferencesOverviewDiv) overflowDiv.appendChild(cookiesListDiv) customizeConsentPreferencesDiv.appendChild(overflowDiv) customizeConsentPreferencesDiv.appendChild(saveMyPreferencesButtonDiv) return customizeConsentPreferencesDiv } htmlToElement(html, className = '') { let template = document.createElement('template') html = html.trim() template.innerHTML = html if (className) { template.classList.add(className) } return template.content.firstChild } onCloseIconClick() { document.querySelector('.cyt-modal')?.classList.remove('modal-open') document.querySelector('.cyt-consent-container')?.classList.add('cyt-consent-container-show') document.querySelector('.cyt-overlay').classList.add('cyt-hide') } showCCPAModal() { const modalContainer = this.createDivWithClass('cyt-modal-container') const modal = this.createDivWithClass('cyt-modal') const optOutPreferencesDiv = document.createElement('div') const optOutPreferencesTitleDiv = this.htmlToElement( `
${ this.is_lang_enable ? this.tl_opt_out_title : this.template_values?.content?.opt_out_title }
` ) optOutPreferencesTitleDiv.getElementsByTagName('button')[0].addEventListener('click', this.onCloseIconClick) const optOutPreferenceOverviewDiv = document.createElement('div') optOutPreferenceOverviewDiv.setAttribute( 'style', 'font-weight: normal;font-size: 14px;line-height: 24px;margin: 0 0 10px 0;' ) optOutPreferenceOverviewDiv.style.color = this.template_values?.colors?.opt_out_privacy_overview optOutPreferenceOverviewDiv.textContent = this.is_lang_enable ? this.tl_opt_out_privacy_overview : this.template_values?.content?.opt_out_privacy_overview const saveMyPreferencesButtonDiv = document.createElement('div') saveMyPreferencesButtonDiv.setAttribute('style', 'display:flex; margin: 10px 0px 0px 0px;') saveMyPreferencesButtonDiv.setAttribute('class', 'cyt-modal-button-container') const saveMyPreferencesButton = this.createButton( this.is_lang_enable ? this.tl_opt_out_save_preference_button_text : this.template_values?.content?.opt_out_save_preference_button_text, this.template_values?.colors?.opt_out_checkbox_save_pref_text_color, this.template_values?.colors?.opt_out_checkbox_save_pref_background_color, this.template_values?.colors?.opt_out_checkbox_save_pref_border_color, '', 'cyt-flex1' ) saveMyPreferencesButton.addEventListener('click', () => this.sendUserConsent('ccpa')) const cancelButton = this.createButton( this.is_lang_enable ? this.tl_opt_out_cancel_button_text : this.template_values?.content?.opt_out_cancel_button_text, this.template_values?.colors?.opt_out_checkbox_cancel_button_text_color, this.template_values?.colors?.opt_out_checkbox_cancel_button_background_color, this.template_values?.colors?.opt_out_checkbox_cancel_button_border_color, '', 'cyt-flex1 cyt-cancel-button' ) cancelButton.addEventListener('click', this.onCloseIconClick) saveMyPreferencesButtonDiv.appendChild(cancelButton) saveMyPreferencesButtonDiv.appendChild(saveMyPreferencesButton) const isChecked = this.scriptData?.consent_status == 'rejected' ? 'checked' : '' const optOutPreferencesCheckbox = this.htmlToElement( ` ` ) optOutPreferencesDiv.appendChild(optOutPreferencesTitleDiv) optOutPreferencesDiv.appendChild(optOutPreferenceOverviewDiv) optOutPreferencesDiv.appendChild(optOutPreferencesCheckbox) optOutPreferencesDiv.appendChild(saveMyPreferencesButtonDiv) if(this.template_values?.content?.customer_logo) { optOutPreferencesDiv.appendChild(this.htmlToElement(this.CustomerLogoDivBottom)) }else { optOutPreferencesDiv.appendChild(this.htmlToElement(this.poweredByDivBottom)) } modal.appendChild(optOutPreferencesDiv) modalContainer.appendChild(modal) document.body.appendChild(modalContainer) } showGDPRModal() { const modal = this.createDivWithClass('cyt-modal') modal.style.backgroundColor = this.template_values.colors.cookie_notice_background_color const div = this.getCustomizeConsentPreferences(true) modal.appendChild(div) document.body.appendChild(modal) this.setCategoryCountSelected() } addDays(date, days) { var result = new Date(date) result.setDate(result.getDate() + days) return result } modalInit() { if (!this.template_values) { return } // Check if consent is already given let shouldShowBanner = !localStorage.getItem('cyt_consent_given') // if consent is already given then check expiration days if (!shouldShowBanner) { const consent_given_at = this.addDays( this.scriptData?.consent_given_at, +this.template_values?.general?.consent_expiration_days ) const today = new Date() if (consent_given_at?.getTime() < today.getTime()) { shouldShowBanner = true localStorage.removeItem('cyt_consent_given') } } this.showBanner(shouldShowBanner) this.setCategoryCountSelected() if (this.consent_template_to_show === 'gdpr' && !this.template_values?.layout.type.includes('classic')) { this.showGDPRModal() } else { this.showCCPAModal() } } setInitialValues() { let all_categories_data = {} this.customize_consent_preferences_categories?.forEach(e => { all_categories_data[e.category_name] = this.getCookiesByCategoryCookies(e.category_cookies) }) this.all_categories_data = all_categories_data let pc_status = false pc_status = this.findURLInDocument() // this.sendPrivacyCenterStatus(pc_status) this.scriptData = localStorage?.getItem('scriptData') this.scriptData = JSON.parse(this.scriptData) this.scriptData = { ...this.scriptData, UI_URL: this.UI_URL, tenant_id: this.tenant_id, tenant_pc_html_code: this.tenant_pc_html_code, pc_url: this.pc_url, pc_status, } localStorage?.setItem('scriptData', JSON.stringify(this.scriptData)) const body = document.getElementsByTagName('body')[0] if (body && this.showRevisitIcon) { body.appendChild(this.htmlToElement(this.revisitIcon)) } const revisitButton = document.getElementsByClassName('cyt-revisitIcon') if (this.showRevisitIcon && revisitButton[0]) { revisitButton[0].addEventListener('click', () => { document.querySelector('.cyt-main-wrapper')?.classList.add('cyt-consent-container-show') revisitButton[0].classList.add('cyt-revisitIcon-hide') }) } } removeTags(str) { if (str === null || str === '') return false else { str = str.toString() } return str.replace(/(<([^>]+)>)/gi, '') } } //Initializing Banner const banner = new CYTConsentBanner() const consentStatus = localStorage.getItem('cyt_consent_given') const disableTag = banner.banner_status === 'active' && ((!consentStatus && banner.template_values.consent_template !== 'ccpa') || consentStatus === 'rejected' || consentStatus === 'partially_accepted') // Overiding Create element ;(function OverideCreateElement() { const originalCreateElement = document.createElement document.createElement = function (tagName) { const element = originalCreateElement.call(document, tagName) if (tagName === 'script') { Object.defineProperty(element, 'src', { get: function () { return element.getAttribute('src') }, set: function (value) { const src = value if (src && disableTag && GetSrcAndCategory(src).isSrcPresent) { element.setAttribute('type', 'text/plain') } element.setAttribute('src', src) }, }) } return element } })() //Sending banner view function SendBannerView() { let data = sessionStorage.getItem('cytVisitor') if (!data) { banner .APIRequest( '/api/v1/consent_template/banner_views/' + banner.tenant_id + `?domain_id=${banner.domain_id}${banner.sub_domain_id ? '&sub_domain_id=' + banner.sub_domain_id : ''}`, { method: 'POST', body: JSON.stringify({ banner_view: 1, }), } ) .then(() => { sessionStorage?.setItem('cytVisitor', 'true') }) .catch(this.handleError) } } function GetSrcAndCategory(src) { src +="" let isSrcPresent = false let cookiecategory = '' const consentStatus = localStorage.getItem('cyt_consent_given') const acceptedCookiesCategory = Object.keys(banner?.scriptData?.accepted_cookies_category || {}) for (let i = 0; i < banner?.thirdPartyScripts.length; i++) { for (let script in banner?.thirdPartyScripts[i].scripts) { if ( consentStatus === 'partially_accepted' && acceptedCookiesCategory.includes(banner?.thirdPartyScripts[i].category) && src.includes(banner?.thirdPartyScripts[i].scripts[script]) ) { isSrcPresent = false cookiecategory = '' break } else if (src.includes(banner?.thirdPartyScripts[i].scripts[script])) { isSrcPresent = true cookiecategory = banner?.thirdPartyScripts[i].category break } } } return { isSrcPresent, cookiecategory } } // eslint-disable-next-line no-unused-vars function revisitCkyConsent() { document.querySelector('.cyt-main-wrapper')?.classList.add('cyt-consent-container-show') } function containsOnlyNumbers(str) { return /^\d+$/.test(str) } function GetBlockedContentDiv(height = '315', width = '560') { const blockedContentDiv = banner.createDivWithClass('cyt-blocked-content-div') if (containsOnlyNumbers(height)) { blockedContentDiv.style.height = height + 'px' } else { blockedContentDiv.style.height = height } if (containsOnlyNumbers(width)) { blockedContentDiv.style.width = width + 'px' } else { blockedContentDiv.style.width = width } blockedContentDiv.style.backgroundColor = banner.template_values.blocked_content_button_background_color blockedContentDiv.style.color = banner.template_values.blocked_content_button_text_color blockedContentDiv.style.border = `1px solid ${banner.template_values.blocked_content_button_text_color}` const blockedContentText = banner.htmlToElement( `

${banner.infoIcon} ${this.is_lang_enable ? this.tl_blocked_consent_text : banner.template_values.content.blocked_consent_text}

` ) blockedContentDiv.appendChild(blockedContentText) return blockedContentDiv } function InitializeBanner({ country, countryCode, state }) { const isCcpa = banner.template_values.consent_template === 'ccpa' const isGdpr = banner.template_values.consent_template === 'gdpr' const isGdprCcpa = banner.template_values.consent_template === 'gdpr & ccpa' const ccpaTargetName = banner.template_values.general.consent_geo_target_name.ccpa_target_name const gdprTargetName = banner.template_values.general.consent_geo_target_name.gdpr_target_name let isBannerShown = false if (isCcpa && ccpaTargetName === 'Worldwide') { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } else if (isGdpr && gdprTargetName === 'Worldwide') { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } else { if ((isCcpa || isGdprCcpa) && ccpaTargetName === 'United States' && country === 'United States') { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } else { if (state === 'California') { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } } if ((isGdpr || isGdprCcpa) && gdprTargetName === 'EU Countries' && banner.eu_countries_code.includes(countryCode)) { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } else { if (country === 'United Kingdom') { banner.consent_template_to_show = 'gdpr' isBannerShown = true banner.setInitialValues() banner.modalInit() } } } if (!isBannerShown) { EnableAllTags() } } function EnableAllTags() { banner.enableScripts() banner.enableIframeTags() banner.enableEmbedTags() banner.enableObjectTags() } function GetIpAddress(url) { return new Promise((resolve, reject) => { const xhr = new XMLHttpRequest() xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { resolve(JSON.parse(xhr.responseText)) } else { reject(new Error('Request failed with status ' + xhr.status)) } } } xhr.open('GET', url) xhr.send() }) } async function CountryDetails() { try { const response = await GetIpAddress('https://api.ipgeolocation.io/getip') const countryInfo = await fetch(`${banner.API_URL}/api/v1/settings/geo-location/ip/${response.ip}`)?.then(res => res?.json() ) banner.user_info = countryInfo const state = countryInfo?.state_prov const countryCode = countryInfo?.country_code2 const country = countryInfo?.country_name SendBannerView() InitializeBanner({ country, countryCode, state }) } catch (error) { EnableAllTags() } } function DisableScript(node) { const src = node.src || '' const sourceAndCategory = GetSrcAndCategory(src) if (sourceAndCategory.isSrcPresent && disableTag) { node.type = 'text/plain' node.dataset.cookiecategory = sourceAndCategory.cookiecategory } } function DisableIframe(node) { const src = node.src || '' const sourceAndCategory = GetSrcAndCategory(src) if (sourceAndCategory.isSrcPresent && disableTag) { node.removeAttribute('src') node.dataset.cookiecategory = sourceAndCategory.cookiecategory node.dataset.src = src node.style.display = 'none' const blockedContentDiv = GetBlockedContentDiv(node.height, node.width) blockedContentDiv.setAttribute('data-tag', 'iframe') node.before(blockedContentDiv) } } function DisableEmbedTag(node) { const src = node.src || '' const sourceAndCategory = GetSrcAndCategory(src) if (sourceAndCategory.isSrcPresent && disableTag) { node.removeAttribute('src') node.dataset.cookiecategory = sourceAndCategory.cookiecategory node.dataset.src = src node.style.display = 'none' const blockedContentDiv = GetBlockedContentDiv(node.height, node.width) blockedContentDiv.setAttribute('data-tag', 'embed') node.before(blockedContentDiv) } } function DisableObjectTag(node) { const data = node.data || '' const sourceAndCategory = GetSrcAndCategory(data) if (sourceAndCategory.isSrcPresent && disableTag) { node.removeAttribute('data') node.dataset.cookiecategory = sourceAndCategory.cookiecategory node.dataset.data = data node.style.display = 'none' const blockedContentDiv = GetBlockedContentDiv(node.height, node.width) blockedContentDiv.setAttribute('data-tag', 'object') node.before(blockedContentDiv) } } const observer = new MutationObserver(mutations => { mutations.forEach(({ addedNodes }) => { addedNodes.forEach(node => { if (node.nodeType === 1 && node.tagName === 'SCRIPT') { DisableScript(node) } else if (node.nodeType === 1 && node.tagName === 'IFRAME') { DisableIframe(node) } else if (node.nodeType === 1 && node.tagName === 'EMBED') { DisableEmbedTag(node) } else if (node.nodeType === 1 && node.tagName === 'OBJECT') { DisableObjectTag(node) } observer.observe(document.documentElement, { childList: true, subtree: true, }) }) }) }) observer.observe(document.documentElement, { childList: true, subtree: true, }) window.addEventListener('DOMContentLoaded', () => { observer.disconnect() }) window.addEventListener('load', () => { if (banner.banner_status === 'active') { CountryDetails() const consentStatus = localStorage.getItem('cyt_consent_given') const removeCookies = consentStatus === 'rejected' || consentStatus === 'partially_accepted' if (!consentStatus && banner.template_values.consent_template === 'gdpr') { banner.removeFirstPartyCookies() for (let cookies in banner.thirdPartyCookies) { banner.removeCookies(banner.thirdPartyCookies[cookies].cookies, '/', banner.domains) } } else if (removeCookies) { banner.removeFirstPartyCookies() for (let cookies in banner.thirdPartyCookies) { banner.removeCookies(banner.thirdPartyCookies[cookies].cookies, '/', banner.domains) } } } })