|
| 1 | + |
| 2 | +import type { CookieConsentConfig } from 'vanilla-cookieconsent'; |
| 3 | +import { isChinaArea } from '@site/src/utils/tools'; |
| 4 | +const isCn = isChinaArea(); |
| 5 | + |
| 6 | +const pluginConfig: CookieConsentConfig = { |
| 7 | + guiOptions: { |
| 8 | + consentModal: { |
| 9 | + layout: 'box wide', |
| 10 | + position: 'bottom left', |
| 11 | + equalWeightButtons: true, |
| 12 | + flipButtons: false, |
| 13 | + }, |
| 14 | + preferencesModal: { |
| 15 | + layout: 'bar', |
| 16 | + position: 'right', |
| 17 | + equalWeightButtons: true, |
| 18 | + flipButtons: false, |
| 19 | + }, |
| 20 | + }, |
| 21 | + onFirstConsent: function () { |
| 22 | + console.log('onFirstAction fired'); |
| 23 | + }, |
| 24 | + |
| 25 | + onConsent: function ({ cookie }) { |
| 26 | + console.log('onConsent fired ...'); |
| 27 | + }, |
| 28 | + |
| 29 | + onChange: function ({ changedCategories, cookie }) { |
| 30 | + console.log('onChange fired ...'); |
| 31 | + }, |
| 32 | + onModalReady: ({ modalName, modal }) => { |
| 33 | + console.log('onModalReady fired ...', modalName, modal); |
| 34 | + }, |
| 35 | + |
| 36 | + categories: { |
| 37 | + necessary: { |
| 38 | + enabled: true, |
| 39 | + readOnly: true, |
| 40 | + }, |
| 41 | + analytics: { |
| 42 | + enabled: true, |
| 43 | + |
| 44 | + }, |
| 45 | + }, |
| 46 | + |
| 47 | + language: { |
| 48 | + default: isCn ? 'zh' : 'en', |
| 49 | + translations: { |
| 50 | + en: { |
| 51 | + consentModal: { |
| 52 | + title: "Hello traveller, it's cookie time!", |
| 53 | + description: |
| 54 | + 'Our website uses tracking cookies to understand how you interact with it. The tracking will be enabled only if you accept explicitly. <a href="#privacy-policy" data-cc="show-preferencesModal" class="cc__link">Manage preferences</a>', |
| 55 | + acceptAllBtn: 'Accept all', |
| 56 | + acceptNecessaryBtn: 'Reject all', |
| 57 | + showPreferencesBtn: 'Manage preferences', |
| 58 | + //closeIconLabel: 'Close', |
| 59 | + footer: ` |
| 60 | + <a href="https://www.databend.com/privacy/" target="_blank">Privacy Policy</a> |
| 61 | + <a href="https://www.databend.com/terms-of-service/" target="_blank">Terms of Use</a> |
| 62 | + `, |
| 63 | + }, |
| 64 | + preferencesModal: { |
| 65 | + title: 'Cookie preferences', |
| 66 | + acceptAllBtn: 'Accept all', |
| 67 | + acceptNecessaryBtn: 'Reject all', |
| 68 | + savePreferencesBtn: 'Save preferences', |
| 69 | + closeIconLabel: 'Close', |
| 70 | + sections: [ |
| 71 | + { |
| 72 | + title: 'Cookie Usage', |
| 73 | + description: |
| 74 | + `We use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a target="_blank" href="https://www.databend.com/privacy/" class="cc__link">privacy policy</a>.`, |
| 75 | + }, |
| 76 | + { |
| 77 | + title: 'Strictly necessary cookies', |
| 78 | + description: 'These cookies are essential for the website to function properly and cannot be switched off in our systems. They are usually set in response to actions made by you, such as setting your privacy preferences, logging in, or filling in forms.', |
| 79 | + linkedCategory: 'necessary', |
| 80 | + }, |
| 81 | + { |
| 82 | + title: 'Performance and Analytics cookies', |
| 83 | + linkedCategory: 'analytics', |
| 84 | + cookieTable: { |
| 85 | + headers: { |
| 86 | + name: 'Name', |
| 87 | + domain: 'Service', |
| 88 | + description: 'Description', |
| 89 | + expiration: 'Expiration', |
| 90 | + }, |
| 91 | + body: [ |
| 92 | + { |
| 93 | + name: '_ga', |
| 94 | + domain: 'Google Analytics', |
| 95 | + description: |
| 96 | + 'Cookie set by <a target="_blank" href="https://developers.google.com/analytics">Google Analytics</a>.', |
| 97 | + expiration: 'Expires after 15 days', |
| 98 | + }, |
| 99 | + { |
| 100 | + name: '_gid', |
| 101 | + domain: 'Google Analytics', |
| 102 | + description: |
| 103 | + 'Cookie set by <a target="_blank" href="https://developers.google.com/analytics">Google Analytics</a>', |
| 104 | + expiration: 'Session', |
| 105 | + }, |
| 106 | + { |
| 107 | + name: 'ko_id', |
| 108 | + domain: 'Koala Analytics', |
| 109 | + description: |
| 110 | + 'Cookie set by <a target="_blank" href="https://getkoala.com/">Koala Analytics</a>', |
| 111 | + expiration: 'Session', |
| 112 | + }, |
| 113 | + { |
| 114 | + name: 'ko_sid', |
| 115 | + domain: 'Koala Analytics', |
| 116 | + description: |
| 117 | + 'Cookie set by <a target="_blank" href="https://getkoala.com/">Koala Analytics</a>', |
| 118 | + expiration: 'Expires after 1 days', |
| 119 | + }, |
| 120 | + ], |
| 121 | + }, |
| 122 | + }, |
| 123 | + { |
| 124 | + title: 'More information', |
| 125 | + description: |
| 126 | + 'For any queries in relation to my policy on cookies and your choices, please <a class="cc__link" href="mailto:[email protected]">contact us</a>.', |
| 127 | + }, |
| 128 | + ], |
| 129 | + }, |
| 130 | + }, |
| 131 | + zh: { |
| 132 | + consentModal: { |
| 133 | + title: "探索我们的 Cookie 使用,轻松管理您的选择!", |
| 134 | + description: |
| 135 | + '我们的网站使用跟踪 cookie 来了解您与网站的互动。只有在您明确同意的情况下,跟踪功能才会启用。<a href="#privacy-policy" data-cc="show-preferencesModal" class="cc__link">管理偏好</a>', |
| 136 | + acceptAllBtn: '全部接受', |
| 137 | + acceptNecessaryBtn: '全部拒绝', |
| 138 | + showPreferencesBtn: '管理偏好', |
| 139 | + footer: ` |
| 140 | + <a href="https://www.databend.cn/privacy/" target="_blank">隐私政策</a> |
| 141 | + <a href="https://www.databend.cn/terms-of-service/" target="_blank">使用条款</a> |
| 142 | + `, |
| 143 | + }, |
| 144 | + preferencesModal: { |
| 145 | + title: 'Cookie 偏好设置', |
| 146 | + acceptAllBtn: '全部接受', |
| 147 | + acceptNecessaryBtn: '全部拒绝', |
| 148 | + savePreferencesBtn: '保存偏好', |
| 149 | + closeIconLabel: '关闭', |
| 150 | + sections: [ |
| 151 | + { |
| 152 | + title: 'Cookie 使用', |
| 153 | + description: |
| 154 | + '我们使用 cookie 来确保网站的基本功能并提升您的在线体验。您可以随时选择启用或禁用每个类别。如需了解有关 cookie 和其他敏感数据的更多详情,请阅读完整的<a target="_blank" href="https://www.databend.cn/privacy/" class="cc__link">隐私政策</a>。', |
| 155 | + }, |
| 156 | + { |
| 157 | + title: '严格必要的 cookie', |
| 158 | + description: '这些 Cookie 是网站正常运行所必需的,无法在我们的系统中被禁用。它们通常在您进行某些操作时设置,例如设置隐私偏好、登录或填写表单。', |
| 159 | + linkedCategory: 'necessary', |
| 160 | + }, |
| 161 | + { |
| 162 | + title: '性能和分析 cookie', |
| 163 | + linkedCategory: 'analytics', |
| 164 | + cookieTable: { |
| 165 | + headers: { |
| 166 | + name: '名称', |
| 167 | + domain: '服务', |
| 168 | + description: '描述', |
| 169 | + expiration: '有效期', |
| 170 | + }, |
| 171 | + body: [ |
| 172 | + { |
| 173 | + name: '_ga', |
| 174 | + domain: 'Google Analytics', |
| 175 | + description: |
| 176 | + '由 <a target="_blank" href="https://developers.google.com/analytics">Google Analytics</a> 设置的 cookie。', |
| 177 | + expiration: '15 天后过期', |
| 178 | + }, |
| 179 | + { |
| 180 | + name: '_gid', |
| 181 | + domain: 'Google Analytics', |
| 182 | + description: |
| 183 | + '由 <a target="_blank" href="https://developers.google.com/analytics">Google Analytics</a> 设置的 cookie。', |
| 184 | + expiration: '会话结束', |
| 185 | + }, |
| 186 | + { |
| 187 | + name: 'ko_id', |
| 188 | + domain: 'Koala Analytics', |
| 189 | + description: |
| 190 | + '由 <a target="_blank" href="https://getkoala.com/">Koala Analytics</a> 设置的 cookie。', |
| 191 | + expiration: '会话结束', |
| 192 | + }, |
| 193 | + { |
| 194 | + name: 'ko_sid', |
| 195 | + domain: 'Koala Analytics', |
| 196 | + description: |
| 197 | + '由 <a target="_blank" href="https://getkoala.com/">Koala Analytics</a> 设置的 cookie。', |
| 198 | + expiration: '1 天后过期', |
| 199 | + }, |
| 200 | + ], |
| 201 | + }, |
| 202 | + }, |
| 203 | + { |
| 204 | + title: '更多信息', |
| 205 | + description: |
| 206 | + '如有关于 cookie 政策或您的选择的任何疑问,请<a class="cc__link" href="mailto:[email protected]">联系我们</a>。', |
| 207 | + }, |
| 208 | + ], |
| 209 | + }, |
| 210 | + } |
| 211 | + }, |
| 212 | + }, |
| 213 | +}; |
| 214 | + |
| 215 | +export default pluginConfig; |
0 commit comments