@newlogic-digital/stimulus-components 0.0.1 → 0.0.2

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,13 +1,5 @@
1
1
  import { Controller } from '@hotwired/stimulus'
2
- import { appendCookieConsent, setCookieConsent } from '@newlogic-digital/cookieconsent-js'
3
-
4
- export const initCookieConsent = (element = document, type = []) => {
5
- element.querySelectorAll('[data-cookieconsent]').forEach((element) => {
6
- if (type.includes(element.getAttribute('data-cookieconsent'))) {
7
- appendCookieConsent(element)
8
- }
9
- })
10
- }
2
+ import { setCookieConsent, initCookieConsent } from '@newlogic-digital/cookieconsent-js'
11
3
 
12
4
  export class CookieConsentCommon extends Controller {
13
5
  cookieConsentItemKey = 'cookieconsent-js'
@@ -24,7 +16,7 @@ export class CookieConsentCommon extends Controller {
24
16
 
25
17
  export class CookieConsentDialog extends CookieConsentCommon {
26
18
  async connect() {
27
- initCookieConsent(document, this.getCookieConsentItem() ?? [])
19
+ initCookieConsent(this.getCookieConsentItem() ?? [])
28
20
 
29
21
  if (document.querySelector('.x-cookieconsent-form')) {
30
22
  return
@@ -53,7 +45,7 @@ export class CookieConsentDialog extends CookieConsentCommon {
53
45
  const { closeDialog } = await import('winduum/src/components/dialog/index.js')
54
46
 
55
47
  await setCookieConsent(type)
56
- initCookieConsent(document, type)
48
+ initCookieConsent(type)
57
49
  await closeDialog(this.element, { remove: true })
58
50
  }
59
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newlogic-digital/stimulus-components",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "eslint": "eslint '**/*.js'",
@@ -15,7 +15,7 @@
15
15
  "eslint": "^9.7.0",
16
16
  "@types/grecaptcha": "^3.0.9",
17
17
  "neostandard": "^0.11.1",
18
- "@newlogic-digital/cookieconsent-js": "^0.1.0",
18
+ "@newlogic-digital/cookieconsent-js": "^0.2.0",
19
19
  "winduum": "^2.0.0-next.15"
20
20
  },
21
21
  "files": [