Skip to content

Commit f02319b

Browse files
committed
Correct linter styles
1 parent 2706a49 commit f02319b

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/lib/WidgetStore.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@ class WidgetStore {
2121
this.store[ucId] = [];
2222
}
2323
this.store[ucId].push(widget);
24-
24+
2525
// Check if this service already has consent and activate immediately
2626
this.checkAndActivateService(ucId);
2727
}
2828

2929
/**
3030
* Check if a service has consent and activate if it does
31-
*
31+
*
3232
* @param {string} ucId Usercentrics Service ID
3333
*/
34-
async checkAndActivateService(ucId) {
34+
async checkAndActivateService (ucId) {
3535
// Skip if already activated
3636
if (this.activatedServices.has(ucId)) {
3737
return;
3838
}
3939

4040
const cmp = new UcBridge();
41-
41+
4242
// Wait for CMP to be ready
4343
cmp.waitForCmp(async () => {
4444
try {
4545
const consent = await cmp.getConsent(ucId);
4646
const hasConsent = consent === true || (consent && typeof consent.then === 'function' && await consent);
47-
47+
4848
if (hasConsent) {
4949
this.activate(ucId);
5050
}
@@ -100,7 +100,7 @@ class WidgetStore {
100100
for (let i = 0; i < widgets.length; i++) {
101101
widgets[i] && widgets[i].activate(false);
102102
}
103-
103+
104104
this.activatedServices.add(ucId);
105105
}
106106

@@ -110,19 +110,19 @@ class WidgetStore {
110110
/**
111111
* Check all registered services for consent and activate if granted
112112
*/
113-
async checkAllServicesConsent() {
113+
async checkAllServicesConsent () {
114114
const cmp = new UcBridge();
115-
115+
116116
for (const ucId of Object.keys(this.store)) {
117117
// Skip if already activated
118118
if (this.activatedServices.has(ucId)) {
119119
continue;
120120
}
121-
121+
122122
try {
123123
const consent = await cmp.getConsent(ucId);
124124
const hasConsent = consent === true || (consent && typeof consent.then === 'function' && await consent);
125-
125+
126126
if (hasConsent) {
127127
this.activate(ucId);
128128
}
@@ -135,7 +135,7 @@ class WidgetStore {
135135
/**
136136
* Setup enhanced event listeners for real-time consent changes
137137
*/
138-
setupEnhancedListeners() {
138+
setupEnhancedListeners () {
139139
if (this.isListening) return;
140140
this.isListening = true;
141141

@@ -185,8 +185,8 @@ class WidgetStore {
185185
window.addEventListener('UC_UI_VIEW_CHANGED', (e) => {
186186
if (e.detail) {
187187
// Check consent after dialog interactions
188-
if (e.detail.previousView &&
189-
e.detail.previousView !== 'NONE' &&
188+
if (e.detail.previousView &&
189+
e.detail.previousView !== 'NONE' &&
190190
e.detail.previousView !== 'PRIVACY_BUTTON' &&
191191
(e.detail.view === 'NONE' || e.detail.view === 'PRIVACY_BUTTON')) {
192192
// Dialog was closed, check for consent changes
@@ -222,7 +222,7 @@ class WidgetStore {
222222
if (e.detail && (e.detail.previousView === 'NONE' || e.detail.previousView === 'PRIVACY_BUTTON')) {
223223
return;
224224
}
225-
225+
226226
// Recheck all services after view change
227227
for (const ucId of Object.keys(this.store)) {
228228
if (!this.activatedServices.has(ucId)) {

src/widgets/Base.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ class Base {
3939
* @type {Element}
4040
*/
4141
this.el = el;
42-
42+
4343
/**
4444
* Track if widget is activated
4545
* @type {boolean}
4646
*/
4747
this.isActivated = false;
48-
48+
4949
/**
5050
* Widget configuration
5151
* @type {{}}
@@ -191,7 +191,7 @@ class Base {
191191
if (this.isActivated) {
192192
return;
193193
}
194-
194+
195195
this.isActivated = true;
196196
const ucId = this.cfg.ucId;
197197

@@ -202,48 +202,48 @@ class Base {
202202
const cmp = new UcBridge();
203203
cmp.setConsent(ucId);
204204
}
205-
205+
206206
// If we have a container, perform the actual replacement
207207
if (this.container) {
208208
this.performActivation();
209209
}
210210
}
211-
211+
212212
/**
213213
* Perform the actual widget activation and content replacement
214214
*/
215-
performActivation() {
215+
performActivation () {
216216
if (!this.container) return;
217-
217+
218218
// Store reference to container before replacement
219219
const containerToReplace = this.container;
220-
220+
221221
// Replace the container with the original element
222222
if (this.el && containerToReplace && containerToReplace.parentNode) {
223223
containerToReplace.replaceWith(this.el);
224-
224+
225225
// Clean up reference
226226
this.container = null;
227-
227+
228228
// Trigger any load events or scripts that might be needed
229229
if (this.el.tagName === 'IFRAME' && this.el.hasAttribute('data-uc-src')) {
230230
this.el.src = this.el.getAttribute('data-uc-src');
231231
}
232-
232+
233233
// Dispatch a custom event to signal activation
234-
this.el.dispatchEvent(new CustomEvent('ucw:activated', {
234+
this.el.dispatchEvent(new CustomEvent('ucw:activated', {
235235
detail: { ucId: this.cfg.ucId },
236-
bubbles: true
236+
bubbles: true
237237
}));
238238
}
239239
}
240240

241241
/**
242242
* Check if consent is already granted and auto-activate
243243
*/
244-
async checkInitialConsent() {
244+
async checkInitialConsent () {
245245
const cmp = new UcBridge();
246-
246+
247247
// Wait for CMP to be ready
248248
cmp.waitForCmp(async () => {
249249
try {
@@ -260,7 +260,7 @@ class Base {
260260
} else if (consent) {
261261
hasConsent = Boolean(consent);
262262
}
263-
263+
264264
if (hasConsent && this.container && !this.isActivated) {
265265
// Trigger click on accept button to activate properly
266266
const acceptButton = this.container.querySelector('.uc-widget-accept');
@@ -288,7 +288,7 @@ class Base {
288288
container.setAttribute('class', 'uc-widget-container');
289289
container.setAttribute('width', `${Math.floor(nodeWith)}px`);
290290
container.setAttribute('height', `${Math.floor(nodeHeight)}px`);
291-
291+
292292
// Store the UC ID on the container for easier identification
293293
container.setAttribute('data-uc-id', this.cfg.ucId);
294294
container.setAttribute('data-uc-name', this.cfg.ucName || '');
@@ -304,7 +304,7 @@ class Base {
304304
this.container = container;
305305

306306
widgetStore.register(this.cfg.ucId, this);
307-
307+
308308
// Check if consent is already granted
309309
this.checkInitialConsent();
310310
}

0 commit comments

Comments
 (0)