@zcomponent/core 1.9.0 → 1.9.1

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.
@@ -34,112 +34,112 @@ export declare class DefaultCookieConsent extends Component {
34
34
  * @zgrouppriority 20
35
35
  * @zdefault "This website uses cookies to store information on your computer."
36
36
  */
37
- title: Observable<string>;
37
+ title: Observable<string, never>;
38
38
  /**
39
39
  * @zprop
40
40
  * @zgroup Consent Screen
41
41
  * @zgrouppriority 20
42
42
  * @zdefault "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
43
43
  */
44
- description: Observable<string>;
44
+ description: Observable<string, never>;
45
45
  /**
46
46
  * @zprop
47
47
  * @zgroup Settings
48
48
  * @zgrouppriority 10
49
49
  * @zdefault "Privacy Policy"
50
50
  */
51
- privacyPolicyText: Observable<string>;
51
+ privacyPolicyText: Observable<string, never>;
52
52
  /**
53
53
  * @zprop
54
54
  * @zgroup Settings
55
55
  * @zgrouppriority 10
56
56
  * @zdefault ""
57
57
  */
58
- privacyPolicyURL: Observable<string>;
58
+ privacyPolicyURL: Observable<string, never>;
59
59
  /**
60
60
  * @zprop
61
61
  * @zgroup Consent Screen
62
62
  * @zgrouppriority 20
63
63
  * @zdefault "I Accept Cookies"
64
64
  */
65
- acceptButton: Observable<string>;
65
+ acceptButton: Observable<string, never>;
66
66
  /**
67
67
  * @zprop
68
68
  * @zgroup Consent Screen
69
69
  * @zgrouppriority 20
70
70
  * @zdefault "Settings"
71
71
  */
72
- settingsButton: Observable<string>;
72
+ settingsButton: Observable<string, never>;
73
73
  /**
74
74
  * @zprop
75
75
  * @zgroup Consent Screen
76
76
  * @zgrouppriority 20
77
77
  * @zdefault "Save"
78
78
  */
79
- saveButton: Observable<string>;
79
+ saveButton: Observable<string, never>;
80
80
  /**
81
81
  * @zprop
82
82
  * @zgroup Settings
83
83
  * @zgrouppriority 10
84
84
  * @zdefault "Essential"
85
85
  */
86
- essentialTitle: Observable<string>;
86
+ essentialTitle: Observable<string, never>;
87
87
  /**
88
88
  * @zprop
89
89
  * @zgroup Settings
90
90
  * @zgrouppriority 10
91
91
  * @zdefault "Cookies that are necessary to provide the service."
92
92
  */
93
- essentialDescription: Observable<string>;
93
+ essentialDescription: Observable<string, never>;
94
94
  /**
95
95
  * @zprop
96
96
  * @zgroup Settings
97
97
  * @zgrouppriority 10
98
98
  * @zdefault "Functional"
99
99
  */
100
- functionalTitle: Observable<string>;
100
+ functionalTitle: Observable<string, never>;
101
101
  /**
102
102
  * @zprop
103
103
  * @zgroup Settings
104
104
  * @zgrouppriority 10
105
105
  * @zdefault "Cookies that provide you with useful functionality, such as saving your preferences."
106
106
  */
107
- functionalDescription: Observable<string>;
107
+ functionalDescription: Observable<string, never>;
108
108
  /**
109
109
  * @zprop
110
110
  * @zgroup Settings
111
111
  * @zgrouppriority 10
112
112
  * @zdefault "Performance"
113
113
  */
114
- performanceTitle: Observable<string>;
114
+ performanceTitle: Observable<string, never>;
115
115
  /**
116
116
  * @zprop
117
117
  * @zgroup Settings
118
118
  * @zgrouppriority 10
119
119
  * @zdefault "Cookies that help us measure and understand how the site is being used."
120
120
  */
121
- performanceDescription: Observable<string>;
121
+ performanceDescription: Observable<string, never>;
122
122
  /**
123
123
  * @zprop
124
124
  * @zgroup Settings
125
125
  * @zgrouppriority 10
126
126
  * @zdefault "Marketing"
127
127
  */
128
- marketingTitle: Observable<string>;
128
+ marketingTitle: Observable<string, never>;
129
129
  /**
130
130
  * @zprop
131
131
  * @zgroup Settings
132
132
  * @zgrouppriority 10
133
133
  * @zdefault "Cookies that help us market our site and services."
134
134
  */
135
- marketingDescription: Observable<string>;
135
+ marketingDescription: Observable<string, never>;
136
136
  /**
137
137
  * @zprop
138
138
  * @zgroup Settings
139
139
  * @zgrouppriority 10
140
140
  * @zdefault "Required"
141
141
  */
142
- required: Observable<string>;
142
+ required: Observable<string, never>;
143
143
  private _dom;
144
144
  private _functional;
145
145
  private _performance;
@@ -19,6 +19,118 @@ export class DefaultCookieConsent extends Component {
19
19
  constructor(contextManager, constructorProps) {
20
20
  super(contextManager, constructorProps);
21
21
  this.constructorProps = constructorProps;
22
+ /**
23
+ * @zprop
24
+ * @zgroup Consent Screen
25
+ * @zgrouppriority 20
26
+ * @zdefault "This website uses cookies to store information on your computer."
27
+ */
28
+ this.title = new Observable("This website uses cookies to store information on your computer.");
29
+ /**
30
+ * @zprop
31
+ * @zgroup Consent Screen
32
+ * @zgrouppriority 20
33
+ * @zdefault "Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used."
34
+ */
35
+ this.description = new Observable("Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.");
36
+ /**
37
+ * @zprop
38
+ * @zgroup Settings
39
+ * @zgrouppriority 10
40
+ * @zdefault "Privacy Policy"
41
+ */
42
+ this.privacyPolicyText = new Observable("Privacy Policy");
43
+ /**
44
+ * @zprop
45
+ * @zgroup Settings
46
+ * @zgrouppriority 10
47
+ * @zdefault ""
48
+ */
49
+ this.privacyPolicyURL = new Observable("");
50
+ /**
51
+ * @zprop
52
+ * @zgroup Consent Screen
53
+ * @zgrouppriority 20
54
+ * @zdefault "I Accept Cookies"
55
+ */
56
+ this.acceptButton = new Observable("I Accept Cookies");
57
+ /**
58
+ * @zprop
59
+ * @zgroup Consent Screen
60
+ * @zgrouppriority 20
61
+ * @zdefault "Settings"
62
+ */
63
+ this.settingsButton = new Observable("Settings");
64
+ /**
65
+ * @zprop
66
+ * @zgroup Consent Screen
67
+ * @zgrouppriority 20
68
+ * @zdefault "Save"
69
+ */
70
+ this.saveButton = new Observable("Save");
71
+ /**
72
+ * @zprop
73
+ * @zgroup Settings
74
+ * @zgrouppriority 10
75
+ * @zdefault "Essential"
76
+ */
77
+ this.essentialTitle = new Observable("Essential");
78
+ /**
79
+ * @zprop
80
+ * @zgroup Settings
81
+ * @zgrouppriority 10
82
+ * @zdefault "Cookies that are necessary to provide the service."
83
+ */
84
+ this.essentialDescription = new Observable("Cookies that are necessary to provide the service.");
85
+ /**
86
+ * @zprop
87
+ * @zgroup Settings
88
+ * @zgrouppriority 10
89
+ * @zdefault "Functional"
90
+ */
91
+ this.functionalTitle = new Observable("Functional");
92
+ /**
93
+ * @zprop
94
+ * @zgroup Settings
95
+ * @zgrouppriority 10
96
+ * @zdefault "Cookies that provide you with useful functionality, such as saving your preferences."
97
+ */
98
+ this.functionalDescription = new Observable("Cookies that provide you with useful functionality, such as saving your preferences.");
99
+ /**
100
+ * @zprop
101
+ * @zgroup Settings
102
+ * @zgrouppriority 10
103
+ * @zdefault "Performance"
104
+ */
105
+ this.performanceTitle = new Observable("Performance");
106
+ /**
107
+ * @zprop
108
+ * @zgroup Settings
109
+ * @zgrouppriority 10
110
+ * @zdefault "Cookies that help us measure and understand how the site is being used."
111
+ */
112
+ this.performanceDescription = new Observable("Cookies that help us measure and understand how the site is being used.");
113
+ /**
114
+ * @zprop
115
+ * @zgroup Settings
116
+ * @zgrouppriority 10
117
+ * @zdefault "Marketing"
118
+ */
119
+ this.marketingTitle = new Observable("Marketing");
120
+ /**
121
+ * @zprop
122
+ * @zgroup Settings
123
+ * @zgrouppriority 10
124
+ * @zdefault "Cookies that help us market our site and services."
125
+ */
126
+ this.marketingDescription = new Observable("Cookies that help us market our site and services.");
127
+ /**
128
+ * @zprop
129
+ * @zgroup Settings
130
+ * @zgrouppriority 10
131
+ * @zdefault "Required"
132
+ */
133
+ this.required = new Observable("Required");
22
134
  this._dom = document.createElement('div');
23
135
  this._functional = document.createElement('input');
24
136
  this._performance = document.createElement('input');
@@ -30,8 +142,6 @@ export class DefaultCookieConsent extends Component {
30
142
  context.status.value = Status.initialized;
31
143
  context.showSettings.value = () => this.show(true);
32
144
  this._dom.classList.add('zcomponent-cookieconsent');
33
- this.privacyPolicyText = new Observable('Privacy Policy');
34
- this.privacyPolicyURL = new Observable('');
35
145
  if (constructorProps.waitForStart)
36
146
  started(contextManager).then(() => this.show(false));
37
147
  else
@@ -46,32 +156,25 @@ export class DefaultCookieConsent extends Component {
46
156
  if (!panel)
47
157
  return;
48
158
  const title = this._dom.querySelector('#zcomponent-cookieconsent-title');
49
- this.title = new Observable('This website uses cookies to store information on your computer.', v => { if (title)
50
- title.textContent = v; });
159
+ this.title.addListener(v => { if (title)
160
+ title.textContent = v; }, undefined, true);
51
161
  const description = this._dom.querySelector('#zcomponent-cookieconsent-description');
52
- this.description = new Observable('Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.', v => { if (description)
53
- description.textContent = v; });
162
+ this.description.addListener(v => { if (description)
163
+ description.textContent = v; }, undefined, true);
54
164
  const privacyPolicy = this._dom.querySelector('#zcomponent-cookieconsent-privacypolicy');
55
165
  this.privacyPolicyText.addListener(val => { if (privacyPolicy && privacyPolicy instanceof HTMLAnchorElement)
56
- privacyPolicy.innerText = val; });
166
+ privacyPolicy.innerText = val; }, undefined, true);
57
167
  this.privacyPolicyURL.addListener(val => {
58
168
  if (!privacyPolicy || !(privacyPolicy instanceof HTMLAnchorElement))
59
169
  return;
60
170
  privacyPolicy.style.display = val.length === 0 ? 'none' : 'block';
61
171
  privacyPolicy.href = val;
62
- });
172
+ }, undefined, true);
63
173
  if (isSettings) {
64
- this.essentialTitle = new Observable('Essential');
65
- this.essentialDescription = new Observable('Cookies that are necessary to provide the service.');
66
- this.functionalTitle = new Observable('Functional');
67
- this.functionalDescription = new Observable('Cookies that provide you with useful functionality, such as saving your preferences.');
68
- this.performanceTitle = new Observable('Performance');
69
- this.performanceDescription = new Observable('Cookies that help us measure and understand how the site is being used.');
70
- this.marketingTitle = new Observable('Marketing');
71
- this.marketingDescription = new Observable('Cookies that help us market our site and services.');
72
174
  const requiredDOM = document.createElement('span');
73
175
  requiredDOM.innerText = 'Required';
74
- this.required = new Observable('Required', val => requiredDOM.innerText = val);
176
+ this.required.addListener(v => { if (requiredDOM)
177
+ requiredDOM.textContent = v; }, undefined, true);
75
178
  requiredDOM.style.float = 'right';
76
179
  panel.appendChild(this._createEntry(this.essentialTitle, this.essentialDescription, [], requiredDOM));
77
180
  panel.appendChild(this._createEntry(this.functionalTitle, this.functionalDescription, [], this._functional));
@@ -82,7 +185,8 @@ export class DefaultCookieConsent extends Component {
82
185
  this._marketing.checked = useCookieConsentMarketing(this.contextManager).value === ConsentStatus.granted;
83
186
  const saveButton = document.createElement('button');
84
187
  saveButton.id = 'zcomponent-cookieconsent-save';
85
- this.saveButton = new Observable('Save', v => { saveButton.textContent = v; });
188
+ this.saveButton.addListener(v => { if (saveButton)
189
+ saveButton.textContent = v; }, undefined, true);
86
190
  panel.appendChild(saveButton);
87
191
  if (!isDesignTime(this.contextManager)) {
88
192
  saveButton.addEventListener('click', () => this._save());
@@ -91,11 +195,13 @@ export class DefaultCookieConsent extends Component {
91
195
  }
92
196
  const acceptButton = document.createElement('button');
93
197
  acceptButton.id = 'zcomponent-cookieconsent-accept';
94
- this.acceptButton = new Observable('I Accept Cookies', v => { acceptButton.textContent = v; });
198
+ this.acceptButton.addListener(v => { if (acceptButton)
199
+ acceptButton.textContent = v; }, undefined, true);
95
200
  panel.appendChild(acceptButton);
96
201
  const settingsButton = document.createElement('button');
97
202
  settingsButton.id = 'zcomponent-cookieconsent-settings';
98
- this.settingsButton = new Observable('Settings', v => { settingsButton.textContent = v; });
203
+ this.settingsButton.addListener(v => { if (settingsButton)
204
+ settingsButton.textContent = v; }, undefined, true);
99
205
  settingsButton.addEventListener('click', () => {
100
206
  console.log('Settings click');
101
207
  this._loadDOM(true);
@@ -118,10 +224,10 @@ export class DefaultCookieConsent extends Component {
118
224
  container.classList.add('zcomponent-cookieconsent-type');
119
225
  container.appendChild(elm);
120
226
  const header = document.createElement('h3');
121
- title.addListener(val => header.innerText = val);
227
+ title.addListener(val => header.innerText = val, undefined, true);
122
228
  container.appendChild(header);
123
229
  const descriptionDom = document.createElement('div');
124
- description.addListener(val => descriptionDom.innerText = val);
230
+ description.addListener(val => descriptionDom.innerText = val, undefined, true);
125
231
  container.appendChild(descriptionDom);
126
232
  if (vendors.length === 0)
127
233
  return container;
@@ -136,7 +242,7 @@ export class DefaultCookieConsent extends Component {
136
242
  li.append(document.createElement('br'));
137
243
  if (vendor.privacyPolicyUrl?.length > 0) {
138
244
  const privacy = document.createElement('a');
139
- this.privacyPolicyText.addListener(val => privacy.innerText = val);
245
+ this.privacyPolicyText.addListener(val => privacy.innerText = val, undefined, true);
140
246
  privacy.href = vendor.privacyPolicyUrl;
141
247
  privacy.rel = 'noreferrer noopener';
142
248
  privacy.target = '_blank';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",