@compilacion/colleciones-clientos 2.0.24 → 2.0.28

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.
@@ -0,0 +1,574 @@
1
+ ___INFO___
2
+
3
+ {
4
+ "type": "TAG",
5
+ "id": "cvt_temp_public_id",
6
+ "version": 1,
7
+ "securityGroups": [],
8
+ "displayName": "Colleciones Clientès Etiqueta",
9
+ "brand": {
10
+ "id": "brand_compilacion",
11
+ "displayName": "Compilacion",
12
+ "thumbnail": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0Ij4KICA8dGl0bGU+Q29tcG9zdGVsYSBzY2FsbG9wPC90aXRsZT4KICA8cmVjdCB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHJ4PSIxMCIgZmlsbD0iIzFENEVEOCIvPgogIDxwYXRoIGQ9Ik0zMiA1NCBMNyAyOCBROSAxNCAyMiA4IFEzMiA0IDQyIDggUTU1IDE0IDU3IDI4IFoiCiAgICAgICAgZmlsbD0iI0ZDRDM0RCIgc3Ryb2tlPSIjMUQ0RUQ4IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KICA8ZyBzdHJva2U9IiMxRDRFRDgiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBmaWxsPSJub25lIj4KICAgIDxwYXRoIGQ9Ik0zMiA1NCBMMzIgNiIvPgogICAgPHBhdGggZD0iTTMyIDU0IEwyMSA4Ii8+CiAgICA8cGF0aCBkPSJNMzIgNTQgTDQzIDgiLz4KICAgIDxwYXRoIGQ9Ik0zMiA1NCBMMTIgMTciLz4KICAgIDxwYXRoIGQ9Ik0zMiA1NCBMNTIgMTciLz4KICAgIDxwYXRoIGQ9Ik0zMiA1NCBMNyAyOCIvPgogICAgPHBhdGggZD0iTTMyIDU0IEw1NyAyOCIvPgogIDwvZz4KPC9zdmc+Cg=="
13
+ },
14
+ "description": "",
15
+ "containerContexts": [
16
+ "WEB"
17
+ ]
18
+ }
19
+
20
+
21
+ ___TEMPLATE_PARAMETERS___
22
+
23
+ [
24
+ {
25
+ "type": "TEXT",
26
+ "name": "entity",
27
+ "displayName": "Entity",
28
+ "simpleValueType": true,
29
+ "valueValidators": [
30
+ {
31
+ "type": "NON_EMPTY"
32
+ },
33
+ {
34
+ "type": "STRING_LENGTH",
35
+ "args": [
36
+ 2,
37
+ 100
38
+ ]
39
+ }
40
+ ],
41
+ "alwaysInSummary": true
42
+ },
43
+ {
44
+ "type": "TEXT",
45
+ "name": "action",
46
+ "displayName": "Action",
47
+ "simpleValueType": true,
48
+ "alwaysInSummary": true,
49
+ "valueValidators": [
50
+ {
51
+ "type": "NON_EMPTY"
52
+ },
53
+ {
54
+ "type": "STRING_LENGTH",
55
+ "args": [
56
+ 2,
57
+ 100
58
+ ]
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "type": "GROUP",
64
+ "name": "IdentifiersGroup",
65
+ "displayName": "Identifiers",
66
+ "groupStyle": "ZIPPY_CLOSED",
67
+ "subParams": [
68
+ {
69
+ "type": "LABEL",
70
+ "name": "IdentifiersGroupExplaining",
71
+ "displayName": "This is a list of all possible identifiers for the entity, always a name, what you call the id and the value of the identifier"
72
+ },
73
+ {
74
+ "type": "SIMPLE_TABLE",
75
+ "name": "identifiers",
76
+ "displayName": "",
77
+ "simpleTableColumns": [
78
+ {
79
+ "defaultValue": "",
80
+ "displayName": "Name",
81
+ "name": "name",
82
+ "type": "TEXT"
83
+ },
84
+ {
85
+ "defaultValue": "",
86
+ "displayName": "Value",
87
+ "name": "value",
88
+ "type": "TEXT"
89
+ }
90
+ ]
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "type": "GROUP",
96
+ "name": "adjectivesGroup",
97
+ "displayName": "Adjectives",
98
+ "groupStyle": "ZIPPY_CLOSED",
99
+ "subParams": [
100
+ {
101
+ "type": "SIMPLE_TABLE",
102
+ "name": "adjectives",
103
+ "displayName": "",
104
+ "simpleTableColumns": [
105
+ {
106
+ "defaultValue": "",
107
+ "displayName": "",
108
+ "name": "adjective",
109
+ "type": "TEXT"
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ "type": "GROUP",
117
+ "name": "contextGroup",
118
+ "displayName": "Context",
119
+ "groupStyle": "ZIPPY_CLOSED",
120
+ "subParams": [
121
+ {
122
+ "type": "SIMPLE_TABLE",
123
+ "name": "contexts",
124
+ "displayName": "",
125
+ "simpleTableColumns": [
126
+ {
127
+ "defaultValue": "",
128
+ "displayName": "Key",
129
+ "name": "key",
130
+ "type": "TEXT"
131
+ },
132
+ {
133
+ "defaultValue": "",
134
+ "displayName": "Value",
135
+ "name": "value",
136
+ "type": "TEXT"
137
+ }
138
+ ]
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "type": "GROUP",
144
+ "name": "actorGroup",
145
+ "displayName": "Actor",
146
+ "groupStyle": "ZIPPY_CLOSED",
147
+ "subParams": [
148
+ {
149
+ "type": "TEXT",
150
+ "name": "actor",
151
+ "displayName": "Actor",
152
+ "simpleValueType": true
153
+ },
154
+ {
155
+ "type": "SIMPLE_TABLE",
156
+ "name": "actorIdentifiers",
157
+ "displayName": "",
158
+ "simpleTableColumns": [
159
+ {
160
+ "defaultValue": "",
161
+ "displayName": "Name",
162
+ "name": "name",
163
+ "type": "TEXT"
164
+ },
165
+ {
166
+ "defaultValue": "",
167
+ "displayName": "Value",
168
+ "name": "value",
169
+ "type": "TEXT"
170
+ }
171
+ ]
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ "type": "GROUP",
177
+ "name": "referencesGroup",
178
+ "displayName": "References",
179
+ "groupStyle": "ZIPPY_CLOSED",
180
+ "subParams": [
181
+ {
182
+ "type": "SIMPLE_TABLE",
183
+ "name": "references",
184
+ "displayName": "",
185
+ "simpleTableColumns": [
186
+ {
187
+ "defaultValue": "",
188
+ "displayName": "Entity",
189
+ "name": "entity",
190
+ "type": "TEXT"
191
+ },
192
+ {
193
+ "defaultValue": "",
194
+ "displayName": "identifier (name)",
195
+ "name": "identifierName",
196
+ "type": "TEXT"
197
+ },
198
+ {
199
+ "defaultValue": "",
200
+ "displayName": "Identifier value",
201
+ "name": "identifierValue",
202
+ "type": "TEXT"
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ "type": "GROUP",
210
+ "name": "collectionGroup",
211
+ "displayName": "Collection",
212
+ "groupStyle": "ZIPPY_CLOSED",
213
+ "subParams": [
214
+ {
215
+ "type": "PARAM_TABLE",
216
+ "name": "collections",
217
+ "displayName": "",
218
+ "paramTableColumns": [
219
+ {
220
+ "param": {
221
+ "type": "SELECT",
222
+ "name": "collectionVariable",
223
+ "displayName": "",
224
+ "macrosInSelect": true,
225
+ "selectItems": [],
226
+ "simpleValueType": true
227
+ },
228
+ "isUnique": false
229
+ }
230
+ ]
231
+ }
232
+ ]
233
+ },
234
+ {
235
+ "type": "GROUP",
236
+ "name": "trackerGroup",
237
+ "displayName": "Tracker Initialisation",
238
+ "groupStyle": "ZIPPY_CLOSED",
239
+ "subParams": [
240
+ {
241
+ "type": "SELECT",
242
+ "name": "trackerConfig",
243
+ "displayName": "Settings variable",
244
+ "macrosInSelect": true,
245
+ "selectItems": [],
246
+ "simpleValueType": true
247
+ }
248
+ ]
249
+ }
250
+ ]
251
+
252
+
253
+ ___SANDBOXED_JS_FOR_WEB_TEMPLATE___
254
+
255
+ var callInWindow = require('callInWindow');
256
+ var copyFromWindow = require('copyFromWindow');
257
+ var createQueue = require('createQueue');
258
+ var injectScript = require('injectScript');
259
+ var log = require('logToConsole');
260
+ var setInWindow = require('setInWindow');
261
+
262
+ var queuePusherName = 'compilacionCollecionesClientosQueuePusher';
263
+ var queueName = 'compilacionCollecionesClientosGtmQueue';
264
+
265
+ function getQueuePush() {
266
+ var existing = copyFromWindow(queuePusherName);
267
+ if (existing) {
268
+ return existing;
269
+ }
270
+
271
+ log('Creating new queue for', queueName);
272
+ createQueue(queueName);
273
+
274
+ setInWindow(queuePusherName, function () {
275
+ var args = [];
276
+ for (var i = 1; i < arguments.length; i++) {
277
+ args.push(arguments[i]);
278
+ }
279
+
280
+ var queued = {
281
+ method: arguments[0],
282
+ arguments: args
283
+ };
284
+
285
+ callInWindow(queueName + '.push', queued);
286
+ callInWindow('window.compilacionCollecionesClientosGtmFlush', '');
287
+ log('Queued method call:', queued);
288
+ });
289
+
290
+ return copyFromWindow(queuePusherName);
291
+ }
292
+
293
+ if (data.trackerConfig.type === "compilacionCollecionesClientosGtmVariable_configuracion") {
294
+ var cdn = false;
295
+
296
+ if (data.trackerConfig.jsLibSource === "SELF") {
297
+ cdn = data.trackerConfig.jsLibSource_selfHostedUrl;
298
+ } else if (data.trackerConfig.jsLibSource === "UNPKG") {
299
+ cdn = "https://unpkg.com/@compilacion/colleciones-clientos@latest/dist/browser.gtm.min.js";
300
+ }
301
+
302
+ var queuePush = getQueuePush();
303
+
304
+ if (cdn) {
305
+ injectScript(
306
+ cdn,
307
+ function () {
308
+ log('Script loaded. Executing tag.');
309
+ queuePush('tag', data);
310
+ data.gtmOnSuccess();
311
+ },
312
+ function () {
313
+ log('Failed to load script:', cdn);
314
+ data.gtmOnFailure();
315
+ },
316
+ 'compilacionCollecionesLib'
317
+ );
318
+ } else {
319
+ log('No script URL provided. Falling back to direct queue push.');
320
+ queuePush('tag', data);
321
+ data.gtmOnSuccess();
322
+ }
323
+
324
+ } else {
325
+ log('trackerConfig.type mismatch:', data.trackerConfig.type);
326
+ data.gtmOnFailure();
327
+ }
328
+
329
+
330
+ ___WEB_PERMISSIONS___
331
+
332
+ [
333
+ {
334
+ "instance": {
335
+ "key": {
336
+ "publicId": "logging",
337
+ "versionId": "1"
338
+ },
339
+ "param": [
340
+ {
341
+ "key": "environments",
342
+ "value": {
343
+ "type": 1,
344
+ "string": "debug"
345
+ }
346
+ }
347
+ ]
348
+ },
349
+ "clientAnnotations": {
350
+ "isEditedByUser": true
351
+ },
352
+ "isRequired": true
353
+ },
354
+ {
355
+ "instance": {
356
+ "key": {
357
+ "publicId": "access_globals",
358
+ "versionId": "1"
359
+ },
360
+ "param": [
361
+ {
362
+ "key": "keys",
363
+ "value": {
364
+ "type": 2,
365
+ "listItem": [
366
+ {
367
+ "type": 3,
368
+ "mapKey": [
369
+ {
370
+ "type": 1,
371
+ "string": "key"
372
+ },
373
+ {
374
+ "type": 1,
375
+ "string": "read"
376
+ },
377
+ {
378
+ "type": 1,
379
+ "string": "write"
380
+ },
381
+ {
382
+ "type": 1,
383
+ "string": "execute"
384
+ }
385
+ ],
386
+ "mapValue": [
387
+ {
388
+ "type": 1,
389
+ "string": "compilacionCollecionesClientosQueuePusher"
390
+ },
391
+ {
392
+ "type": 8,
393
+ "boolean": true
394
+ },
395
+ {
396
+ "type": 8,
397
+ "boolean": true
398
+ },
399
+ {
400
+ "type": 8,
401
+ "boolean": true
402
+ }
403
+ ]
404
+ },
405
+ {
406
+ "type": 3,
407
+ "mapKey": [
408
+ {
409
+ "type": 1,
410
+ "string": "key"
411
+ },
412
+ {
413
+ "type": 1,
414
+ "string": "read"
415
+ },
416
+ {
417
+ "type": 1,
418
+ "string": "write"
419
+ },
420
+ {
421
+ "type": 1,
422
+ "string": "execute"
423
+ }
424
+ ],
425
+ "mapValue": [
426
+ {
427
+ "type": 1,
428
+ "string": "compilacionCollecionesClientosGtmQueue"
429
+ },
430
+ {
431
+ "type": 8,
432
+ "boolean": true
433
+ },
434
+ {
435
+ "type": 8,
436
+ "boolean": true
437
+ },
438
+ {
439
+ "type": 8,
440
+ "boolean": false
441
+ }
442
+ ]
443
+ },
444
+ {
445
+ "type": 3,
446
+ "mapKey": [
447
+ {
448
+ "type": 1,
449
+ "string": "key"
450
+ },
451
+ {
452
+ "type": 1,
453
+ "string": "read"
454
+ },
455
+ {
456
+ "type": 1,
457
+ "string": "write"
458
+ },
459
+ {
460
+ "type": 1,
461
+ "string": "execute"
462
+ }
463
+ ],
464
+ "mapValue": [
465
+ {
466
+ "type": 1,
467
+ "string": "compilacionCollecionesClientosGtmQueue.push"
468
+ },
469
+ {
470
+ "type": 8,
471
+ "boolean": false
472
+ },
473
+ {
474
+ "type": 8,
475
+ "boolean": false
476
+ },
477
+ {
478
+ "type": 8,
479
+ "boolean": true
480
+ }
481
+ ]
482
+ },
483
+ {
484
+ "type": 3,
485
+ "mapKey": [
486
+ {
487
+ "type": 1,
488
+ "string": "key"
489
+ },
490
+ {
491
+ "type": 1,
492
+ "string": "read"
493
+ },
494
+ {
495
+ "type": 1,
496
+ "string": "write"
497
+ },
498
+ {
499
+ "type": 1,
500
+ "string": "execute"
501
+ }
502
+ ],
503
+ "mapValue": [
504
+ {
505
+ "type": 1,
506
+ "string": "compilacionCollecionesClientosGtmFlush"
507
+ },
508
+ {
509
+ "type": 8,
510
+ "boolean": false
511
+ },
512
+ {
513
+ "type": 8,
514
+ "boolean": false
515
+ },
516
+ {
517
+ "type": 8,
518
+ "boolean": true
519
+ }
520
+ ]
521
+ }
522
+ ]
523
+ }
524
+ }
525
+ ]
526
+ },
527
+ "clientAnnotations": {
528
+ "isEditedByUser": true
529
+ },
530
+ "isRequired": true
531
+ },
532
+ {
533
+ "instance": {
534
+ "key": {
535
+ "publicId": "inject_script",
536
+ "versionId": "1"
537
+ },
538
+ "param": [
539
+ {
540
+ "key": "urls",
541
+ "value": {
542
+ "type": 2,
543
+ "listItem": [
544
+ {
545
+ "type": 1,
546
+ "string": "https://unpkg.com/*"
547
+ },
548
+ {
549
+ "type": 1,
550
+ "string": "https://www.immoscoop.be/public/*"
551
+ }
552
+ ]
553
+ }
554
+ }
555
+ ]
556
+ },
557
+ "clientAnnotations": {
558
+ "isEditedByUser": true
559
+ },
560
+ "isRequired": true
561
+ }
562
+ ]
563
+
564
+
565
+ ___TESTS___
566
+
567
+ scenarios: []
568
+
569
+
570
+ ___NOTES___
571
+
572
+ Created on 02/07/2025, 13:59:46
573
+
574
+
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
3
+ <title>Compostela scallop</title>
4
+ <rect width="64" height="64" rx="10" fill="#1D4ED8"/>
5
+ <path d="M32 54 L7 28 Q9 14 22 8 Q32 4 42 8 Q55 14 57 28 Z"
6
+ fill="#FCD34D" stroke="#1D4ED8" stroke-width="2" stroke-linejoin="round"/>
7
+ <g stroke="#1D4ED8" stroke-width="2" stroke-linecap="round" fill="none">
8
+ <path d="M32 54 L32 6"/>
9
+ <path d="M32 54 L21 8"/>
10
+ <path d="M32 54 L43 8"/>
11
+ <path d="M32 54 L12 17"/>
12
+ <path d="M32 54 L52 17"/>
13
+ <path d="M32 54 L7 28"/>
14
+ <path d="M32 54 L57 28"/>
15
+ </g>
16
+ </svg>
package/dist/index.cjs CHANGED
@@ -718,10 +718,13 @@ class CollecionesWebTracker extends CollecionesTracker {
718
718
  class CollecionesEventGroup {
719
719
 
720
720
  /**
721
- * Creates a new event group with a generated groupId.
721
+ * Creates a new event group.
722
+ * The groupId is NOT generated up-front: a group's identity is defined by its composition,
723
+ * so the id is generated lazily in getEvents() and invalidated by every addEvent() call.
724
+ * Reading `group.groupId` before the first getEvents() returns null.
722
725
  */
723
726
  constructor() {
724
- this.groupId = generateId();
727
+ this.groupId = null;
725
728
  this._events = [];
726
729
  }
727
730
 
@@ -731,6 +734,9 @@ class CollecionesEventGroup {
731
734
  * keeping the same familiar contract as building events directly.
732
735
  * An existing CollecionesEvent instance may also be passed in.
733
736
  *
737
+ * Adding an event changes the composition of the group, so the cached groupId is invalidated
738
+ * — the next getEvents() call will generate a fresh id and re-stamp every event.
739
+ *
734
740
  * @param {CollecionesEvent|null} [event=null] - An existing event to register, or null to create a fresh one.
735
741
  * @returns {CollecionesEvent} The event that was added.
736
742
  * @throws {Error} If a non-null, non-CollecionesEvent value is passed.
@@ -741,20 +747,30 @@ class CollecionesEventGroup {
741
747
  }
742
748
  const newEvent = event ?? new CollecionesEvent();
743
749
  this._events.push(newEvent);
750
+ this.groupId = null;
744
751
  return newEvent;
745
752
  }
746
753
 
747
754
  /**
748
755
  * Materialises group metadata onto every event and returns the full list.
749
- * Each event receives:
750
- * - meta.eventGroup.id — the groupId of this group
756
+ * If no groupId is currently set, a new one is generated here. Each event then receives:
757
+ * - meta.eventGroup.id — the groupId of this group
751
758
  * - meta.eventGroup.groupClientEventIds — clientEventIds of the sibling events (not self)
752
759
  *
753
- * Safe to call multiple times; group metadata is always recalculated from the current state.
760
+ * Safe to call multiple times: idempotent as long as no addEvent() happened in between.
761
+ * After an addEvent() the cached groupId is null, so a subsequent getEvents() will mint a fresh id
762
+ * and re-stamp every event accordingly.
763
+ *
764
+ * Callers may also assign `group.groupId` directly (e.g. with a semantic name) before calling
765
+ * getEvents() to override the auto-generated value; do so AFTER all addEvent() calls,
766
+ * otherwise the next addEvent() will clear the override.
754
767
  *
755
768
  * @returns {CollecionesEvent[]} A shallow copy of the internal events array with group metadata applied.
756
769
  */
757
770
  getEvents() {
771
+ if (this.groupId === null) {
772
+ this.groupId = generateId();
773
+ }
758
774
  const allClientEventIds = this._events.map(e => e.meta.clientEventId);
759
775
  this._events.forEach(event => {
760
776
  const peers = allClientEventIds.filter(id => id !== event.meta.clientEventId);