@castlabs/ui 7.24.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /* @castlabs/ui v7.24.2 */
1
+ /* @castlabs/ui v8.0.0 */
2
2
 
3
3
  /*!
4
4
  * Bootstrap v5.3.8 (https://getbootstrap.com/)
@@ -112,110 +112,6 @@ function clSidenavInitiallyOpen () {
112
112
  }
113
113
  }
114
114
 
115
- const cookieName = 'cl_banner_nok'
116
-
117
- function clCookieBannerSetup (siteId = 1, forced = false) {
118
- if (
119
- !window.location.hostname.match(/castlabs.com$/) &&
120
- !window.location.search.match('mtm=DEBUG') &&
121
- !forced
122
- ) {
123
- console.info(`skipping cookie banner on ${window.location.hostname ?? 'unknown domain'}`)
124
- return
125
- }
126
-
127
- clMatomoSetup(siteId)
128
- let show = true
129
- for (const cookie of document?.cookie?.split(/; */) ?? []) {
130
- const [name, value] = cookie.split('=')
131
- if (name === cookieName && ['-mtm', '+mtm'].includes(value)) {
132
- show = false
133
- break // for
134
- }
135
- }
136
- if (show) clCookieBannerShow()
137
- }
138
-
139
- function clCookieBannerHide () {
140
- const banner = document.querySelector('div.cl-cookie-banner')
141
- banner.classList.add('cl-fade-away')
142
- setTimeout(() => {
143
- banner.parentNode.removeChild(banner)
144
- }, 500)
145
- }
146
-
147
- function clCookieBannerAccept () {
148
- document.cookie = `cl_banner_nok=+mtm; max-age=${60 * 60 * 24 * 395}; domain=.castlabs.com; path=/; SameSite=Lax;`
149
- clCookieBannerHide()
150
-
151
- const _paq = (window._paq = window._paq || [])
152
- _paq.push(['rememberCookieConsentGiven', 9480])
153
- _paq.push(['trackPageView'])
154
- _paq.push(['enableLinkTracking'])
155
- }
156
-
157
- function clCookieBannerDecline () {
158
- document.cookie = `cl_banner_nok=-mtm; max-age=${60 * 60 * 24 * 395}; domain=.castlabs.com; path=/; SameSite=Lax;`
159
- clCookieBannerHide()
160
- }
161
-
162
- function clCookieBannerShow (accept = clCookieBannerAccept, decline = clCookieBannerDecline) {
163
- const banner = document.createElement('div')
164
- banner.classList.add('card', 'cl-card', 'cl-cookie-banner')
165
- banner.innerHTML = `
166
- <div class="card-body">
167
- <p class="cl-p-small">
168
- For our services to work, we use essential cookies which we control.
169
- We'd also like to include others to analyze how our site is used to help
170
- improve it - but only if you accept. Learn more in our
171
- <a
172
- class="cl-a-text"
173
- href="https://castlabs.com/privacy-cookie-policy/"
174
- >privacy policy</a>.
175
- </p>
176
-
177
- <div class="cl-spacing-box cl-spread">
178
- <button
179
- id="cl-button-cookie-decline"
180
- type="button"
181
- class="btn btn-sm cl-color-night it-cancel"
182
- >
183
- Decline
184
- </button>
185
- <button
186
- id="cl-button-cookie-accept"
187
- type="button"
188
- class="btn btn-sm cl-color-red it-ok"
189
- >
190
- Accept
191
- </button>
192
- </div>
193
- </div>
194
- `
195
- document.body.appendChild(banner)
196
- document.getElementById('cl-button-cookie-accept').addEventListener('click', accept)
197
- document.getElementById('cl-button-cookie-decline').addEventListener('click', decline)
198
- }
199
-
200
- function clMatomoSetup (siteId = 1, domain = 'castlabs.com') {
201
- const _paq = (window._paq = window._paq || [])
202
- _paq.push(['requireCookieConsent'])
203
- _paq.push(['setDocumentTitle', document.domain + '/' + document.title])
204
- _paq.push(['setCookieDomain', `*.${domain}`])
205
- _paq.push(['setDomains', [`*.${domain}`]])
206
- _paq.push(['trackPageView'])
207
- _paq.push(['enableLinkTracking'])
208
- ;(function () {
209
- _paq.push(['setTrackerUrl', 'https://castlabs.matomo.cloud/matomo.php'])
210
- _paq.push(['setSiteId', `${siteId}`])
211
- const g = document.createElement('script')
212
- const s = document.getElementsByTagName('script')[0]
213
- g.async = true
214
- g.src = '//cdn.matomo.cloud/castlabs.matomo.cloud/matomo.js'
215
- s.parentNode.insertBefore(g, s)
216
- })()
217
- }
218
-
219
115
  function clTableSetupResize (id, auto = false) {
220
116
  document.querySelectorAll(`#${id} .cl-resizer`).forEach(resizer => {
221
117
  clTableSetResizeListeners(resizer, auto)