@compilacion/colleciones-clientos 2.0.28 → 2.0.29

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.
@@ -835,6 +835,15 @@
835
835
  if (!tracker) return false;
836
836
  if (!arg || typeof arg !== 'object') return false;
837
837
 
838
+ // GTM variables can resolve to numbers/booleans or be left empty. Coerce
839
+ // entity/action/actor names to a string so a mistyped or empty config value
840
+ // cannot throw inside CollecionesEvent (formatToCamelCase) and drop the event.
841
+ const toEventName = (value) => {
842
+ if (typeof value === 'string') return value;
843
+ if (typeof value === 'number' || typeof value === 'boolean') return String(value);
844
+ return '';
845
+ };
846
+
838
847
  const normalizeIdentifiers = (identifiers) => {
839
848
  if (Array.isArray(identifiers)) {
840
849
  return identifiers.flatMap(identifier => {
@@ -970,24 +979,27 @@
970
979
  };
971
980
 
972
981
  const populateEvent = (eventArg, event) => {
973
- event.setEntity(eventArg.entity);
974
- event.setAction(eventArg.action);
982
+ event.setEntity(toEventName(eventArg.entity));
983
+ event.setAction(toEventName(eventArg.action));
975
984
 
976
985
  normalizeIdentifiers(eventArg.identifiers).forEach(identifier => {
977
986
  if (typeof identifier !== 'object' || identifier === null) return;
978
- if (!identifier.name || !identifier.value) return;
987
+ // Reject only an absent name or a null/undefined value; falsy-but-valid
988
+ // values such as 0 or '' must still be kept (matches addCollectionItem).
989
+ if (!identifier.name || identifier.value == null) return;
979
990
  event.setIdentifier(identifier.name, identifier.value);
980
991
  });
981
992
 
982
- if (eventArg.actor?.entity) {
983
- event.setActor(eventArg.actor.entity);
993
+ const actorName = toEventName(eventArg.actor?.entity ?? eventArg.actor?.name);
994
+ if (actorName) {
995
+ event.setActor(actorName);
984
996
  let identifiers = eventArg.actor?.identifiers;
985
997
  if (!Array.isArray(identifiers)) {
986
- identifiers = identifiers?.[eventArg.actor.entity] ?? identifiers;
998
+ identifiers = identifiers?.[actorName] ?? identifiers;
987
999
  }
988
1000
  normalizeIdentifiers(identifiers).forEach(identifier => {
989
1001
  if (typeof identifier !== 'object' || identifier === null) return;
990
- if (!identifier.name || !identifier.value) return;
1002
+ if (!identifier.name || identifier.value == null) return;
991
1003
  event.setActorIdentifier(identifier.name, identifier.value);
992
1004
  });
993
1005
  }
@@ -995,15 +1007,30 @@
995
1007
  const relations = eventArg?.relations ?? eventArg?.rerelations;
996
1008
  if (relations && typeof relations === 'object') {
997
1009
  Object.keys(relations).forEach(relationName => {
1010
+ const relationIdentifiers = relations[relationName];
998
1011
  event.setReference(relationName);
999
- Object.keys(relations[relationName]).forEach(identifierName => {
1000
- event.setReferenceIdentifier(relationName, identifierName, relations[relationName][identifierName]);
1001
- });
1012
+ // A relation can be declared while its identifier object is left empty
1013
+ // (an unfilled GTM variable resolves to undefined/null). Guard against
1014
+ // non-object values so Object.keys cannot throw and drop the event.
1015
+ if (relationIdentifiers && typeof relationIdentifiers === 'object') {
1016
+ Object.keys(relationIdentifiers).forEach(identifierName => {
1017
+ event.setReferenceIdentifier(relationName, identifierName, relationIdentifiers[identifierName]);
1018
+ });
1019
+ }
1002
1020
  });
1003
1021
  }
1004
- if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {
1022
+ // Adjectives may arrive as an array of values or as an object keyed by adjective.
1023
+ if (Array.isArray(eventArg?.adjectives)) {
1024
+ eventArg.adjectives.forEach(adjective => {
1025
+ if (typeof adjective === 'string' && adjective.length > 0) {
1026
+ event.addAdjective(adjective);
1027
+ }
1028
+ });
1029
+ } else if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {
1005
1030
  Object.keys(eventArg.adjectives).forEach(adjectiveName => {
1006
- event.addAdjective(adjectiveName, eventArg.adjectives[adjectiveName]);
1031
+ if (adjectiveName.length > 0) {
1032
+ event.addAdjective(adjectiveName);
1033
+ }
1007
1034
  });
1008
1035
  }
1009
1036
 
@@ -1022,10 +1049,17 @@
1022
1049
  let added = 0;
1023
1050
  arg.events.forEach(eventArg => {
1024
1051
  if (!eventArg || typeof eventArg !== 'object') return;
1025
- if (!eventArg.entity || !eventArg.action) return;
1026
- const event = group.addEvent();
1027
- populateEvent(eventArg, event);
1028
- added++;
1052
+ if (!toEventName(eventArg.entity) || !toEventName(eventArg.action)) return;
1053
+ // Build the event before registering it so a single malformed event cannot
1054
+ // throw and take the whole group (including its valid siblings) down with it.
1055
+ try {
1056
+ const event = new CollecionesEvent();
1057
+ populateEvent(eventArg, event);
1058
+ group.addEvent(event);
1059
+ added++;
1060
+ } catch (e) {
1061
+ console.error('Colleciones: skipped malformed grouped event', e);
1062
+ }
1029
1063
  });
1030
1064
  if (added === 0) return false;
1031
1065
  // Apply the semantic group name AFTER addEvent calls: each addEvent invalidates
@@ -1037,7 +1071,7 @@
1037
1071
  return true;
1038
1072
  }
1039
1073
 
1040
- if (!arg.entity || !arg.action) return false;
1074
+ if (!toEventName(arg.entity) || !toEventName(arg.action)) return false;
1041
1075
  const event = new CollecionesEvent();
1042
1076
  populateEvent(arg, event);
1043
1077
  tracker.track(event);
@@ -1063,7 +1097,13 @@
1063
1097
  while (processedQueueLength < queue.length) {
1064
1098
  const args = queue[processedQueueLength];
1065
1099
  processedQueueLength += 1;
1066
- track(args);
1100
+ // Never let one bad queue entry abort the flush loop: the index has already
1101
+ // advanced, so an uncaught throw here would permanently skip the rest of the batch.
1102
+ try {
1103
+ track(args);
1104
+ } catch (e) {
1105
+ console.error('Colleciones: failed to process queued event', e);
1106
+ }
1067
1107
  }
1068
1108
  };
1069
1109
 
@@ -1 +1 @@
1
- {"version":3,"file":"browser.domainModel.gtm.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesEventGroup.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/browser.domainModel.gtm.constants.js","../src/browser.domainModel.gtm.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nconst formatToCamelCase = function(input) {\n return input\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word, index) => {\n if (index === 0) return word;\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nconst generateId = () => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n};\n\n\nexport {\n fromBase64,\n formatToCamelCase,\n getBrowserContext,\n toBase64,\n generateId,\n};","/**\n * CollecionesEvent\n * -----------------\n * Base class representing a semantically structured event object.\n * Each event models a specific interaction with an entity, optionally performed by an actor,\n * and may reference related entities or include contextual metadata.\n *\n * Key features:\n * - Captures structured semantics: entity, action, actor, context, references\n * - Supports multiple identifiers for both the main entity and the actor\n * - Allows origin tagging for cross-context or cross-application references\n * - Supports referencing collections of entities or grouped data\n * - Includes timestamps and tracker/app metadata for auditability\n * - Fully serializable and deserializable via toJSON/fromJSON\n */\n\nimport {formatToCamelCase, generateId } from './utils/utils.js';\n\nclass CollecionesEvent {\n\n /**\n * Constructs a new CollecionesEvent with default structure and timestamps.\n * Initializes empty containers for semantic attributes such as:\n * - entity: the subject of the event\n * - adjectives: descriptors of the entity\n * - identifiers: identifiers of the entity\n * - action: what happened to the entity\n * - actor: who or what triggered the event (with identifiers in actorIdentifiers)\n * - context: environmental data related to the event\n * - references: external entities involved, optionally scoped by origin\n * - collections: groups of related entities\n * - meta: tracking metadata and timestamps\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n this.collections = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.clientEventId = generateId();\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = formatToCamelCase(entity);\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = formatToCamelCase(action);\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(formatToCamelCase(adjective));\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * Identifiers allow multiple keys to uniquely identify the entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user', 'system').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * Supports multiple identifiers to uniquely identify the actor.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * Context can include any additional environmental or situational data.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Alias for `setReference` for compatibility.\n * Declares an external entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setRefence = function(entity, origin=null) {\n return this.setReference(entity, origin);\n }\n\n /**\n * Declares an entity referenced by this event.\n * References may include multiple identifiers and an optional origin to scope the reference.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setReference = function(entity, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * Ensures the reference is declared and sets the identifier under that reference.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setRefenceIdentifier = function(entity, name, identifier, origin=null) {\n return this.setReferenceIdentifier(entity, name, identifier, origin);\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setReferenceIdentifier = function(entity, name, identifier, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity, origin);\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Declares a collection of related entities for this event.\n * Collections group multiple related items and may include identifiers and origin metadata.\n * @param {string} entity - The collection name.\n * @param {string|null} origin - Optional origin identifier (e.g. system name).\n */\n setCollection = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {\n items: [],\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds a new item to a collection and returns its index key.\n * Items represent individual elements within the collection.\n * @param {string} entity - The name of the collection.\n * @returns {number} Index of the newly added item in the collection.\n */\n setCollectionItem = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n this.collections[entity].items.push({});\n let itemKey = this.collections[entity].items.length - 1;\n return itemKey;\n }\n\n /**\n * Assigns a reference (identifier) to a specific item in a collection.\n * Useful for tagging individual collection elements with identifiers.\n * @param {string} entity - Collection name.\n * @param {number} itemKey - The index of the item in the collection.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @throws {Error} If the item does not exist at the given index.\n */\n setCollectionItemReference = function(entity, itemKey, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n if(typeof this.collections[entity].items[itemKey] !== 'object') {\n throw new Error('bad bad man, the collection key does not exists');\n }\n this.collections[entity].items[itemKey][name] = identifier;\n }\n \n /**\n * Sets a static identifier that applies to the entire collection.\n * These identifiers describe the collection as a whole.\n * @param {string} entity - Collection name.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setCollectionIdentifier = function(entity, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {};\n }\n this.collections[entity].identifiers[name] = identifier;\n }\n\n /**\n * Sets the event group metadata on this event.\n * Called by CollecionesEventGroup.getEvents() to inject group membership.\n * @param {string} groupId - The shared group id for all events in the occurrence.\n * @param {string[]} groupClientEventIds - The clientEventIds of the other events in the group.\n */\n setEventGroup(groupId, groupClientEventIds) {\n if (typeof groupId !== 'string') {\n throw new Error('groupId must be a string');\n }\n if (!Array.isArray(groupClientEventIds)) {\n throw new Error('groupClientEventIds must be an array');\n }\n this.meta.eventGroup = {\n id: groupId,\n groupClientEventIds: [...groupClientEventIds]\n };\n }\n\n /**\n * Serializes the event instance to a plain object suitable for transport or storage.\n * The output includes all semantic fields and metadata.\n * @returns {object} A plain JavaScript object representing the event.\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta,\n collections: this.collections\n };\n }\n\n /**\n * Recreates a CollecionesEvent instance from a plain object.\n * Used when deserializing events from storage or network transport.\n * @param {object} obj - The input object containing event data.\n * @returns {CollecionesEvent} A rehydrated event instance.\n * @throws {Error} If the class type is not 'CollecionesEvent'.\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n instance.collections = obj.collections || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize || !this.flushInterval || this.flushInterval < 1) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","/**\n * CollecionesEventGroup\n * ----------------------\n * A client-side grouping interface for events that belong to the same business occurrence.\n *\n * Design principles:\n * - A group is purely a build-time construct; it does not change the wire format.\n * - Each event in the group remains a standalone CollecionesEvent.\n * - When getEvents() is called, group metadata is materialised onto each event:\n * meta.eventGroup.id — the shared group id\n * meta.eventGroup.groupClientEventIds — clientEventIds of all other events in the group\n * - Semantic meaning of the relations between events is intentionally left to the domain model.\n *\n * Usage:\n * const group = new CollecionesEventGroup();\n *\n * const eventA = group.addEvent();\n * eventA.setEntity('listing');\n * eventA.setAction('viewed');\n *\n * const eventB = group.addEvent();\n * eventB.setEntity('session');\n * eventB.setAction('active');\n *\n * tracker.trackGroup(group);\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport { generateId } from './utils/utils.js';\n\nclass CollecionesEventGroup {\n\n /**\n * Creates a new event group.\n * The groupId is NOT generated up-front: a group's identity is defined by its composition,\n * so the id is generated lazily in getEvents() and invalidated by every addEvent() call.\n * Reading `group.groupId` before the first getEvents() returns null.\n */\n constructor() {\n this.groupId = null;\n this._events = [];\n }\n\n /**\n * Adds an event to the group.\n * When called without arguments it acts as an alias for `new CollecionesEvent()`,\n * keeping the same familiar contract as building events directly.\n * An existing CollecionesEvent instance may also be passed in.\n *\n * Adding an event changes the composition of the group, so the cached groupId is invalidated\n * — the next getEvents() call will generate a fresh id and re-stamp every event.\n *\n * @param {CollecionesEvent|null} [event=null] - An existing event to register, or null to create a fresh one.\n * @returns {CollecionesEvent} The event that was added.\n * @throws {Error} If a non-null, non-CollecionesEvent value is passed.\n */\n addEvent(event = null) {\n if (event !== null && !(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n const newEvent = event ?? new CollecionesEvent();\n this._events.push(newEvent);\n this.groupId = null;\n return newEvent;\n }\n\n /**\n * Materialises group metadata onto every event and returns the full list.\n * If no groupId is currently set, a new one is generated here. Each event then receives:\n * - meta.eventGroup.id — the groupId of this group\n * - meta.eventGroup.groupClientEventIds — clientEventIds of the sibling events (not self)\n *\n * Safe to call multiple times: idempotent as long as no addEvent() happened in between.\n * After an addEvent() the cached groupId is null, so a subsequent getEvents() will mint a fresh id\n * and re-stamp every event accordingly.\n *\n * Callers may also assign `group.groupId` directly (e.g. with a semantic name) before calling\n * getEvents() to override the auto-generated value; do so AFTER all addEvent() calls,\n * otherwise the next addEvent() will clear the override.\n *\n * @returns {CollecionesEvent[]} A shallow copy of the internal events array with group metadata applied.\n */\n getEvents() {\n if (this.groupId === null) {\n this.groupId = generateId();\n }\n const allClientEventIds = this._events.map(e => e.meta.clientEventId);\n this._events.forEach(event => {\n const peers = allClientEventIds.filter(id => id !== event.meta.clientEventId);\n event.setEventGroup(this.groupId, peers);\n });\n return [...this._events];\n }\n}\n\nexport default CollecionesEventGroup;\n","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n\n /**\n * Dispatches all events in a CollecionesEventGroup.\n * Calls getEvents() to materialise group metadata onto each event,\n * then forwards every individual event to track().\n * @param {CollecionesEventGroup} group - The group to track.\n * @throws {Error} If group does not expose a getEvents() method.\n */\n trackGroup(group) {\n if (typeof group?.getEvents !== 'function') {\n throw new Error('Group must be an instance of CollecionesEventGroup');\n }\n group.getEvents().forEach(event => this.track(event));\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","var constants = {\n 'sharedWindowObjectNames': {\n 'queue': 'compilacionCollecionesClientosGtmQueue',\n 'configVariable': 'compilacionCollecionesClientosGtmTypeCastConfig'\n },\n 'config': {\n 'sourceName': 'jsLibSource',\n 'jsLibUrlVariable': 'jsLibSource_selfHostedUrl',\n 'selfHostedValue': 'SELF',\n 'unpkgHostedValue': 'UNPKG',\n 'flushInterval': 'flushInterval',\n 'flushSize': 'flushSize',\n 'trackerName': 'trackerName',\n 'appName': 'appName',\n 'emitterEndpoint': 'emitterEndpoint',\n 'typeName': 'type'\n },\n 'collecionesObject': 'compilacionCollecionesClientosGtm',\n 'typeCastGtmVariableConfig': 'compilacionCollecionesClientosGtmTypeCastConfig'\n};\n\nexport default constants;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesEventGroup from './CollecionesEventGroup.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport constants from './browser.domainModel.gtm.constants.js';\n\nif (!window[constants.collecionesObject]) {\n window[constants.collecionesObject] = (() => {\n\n let initialized = false;\n let emitter = null;\n let tracker = null;\n const queueWaitInterval = 250;\n let queueWatcherTimer = null;\n let queueWatcherInterval = null;\n let queueReference = null;\n let processedQueueLength = 0;\n\n let init = () => {\n if (initialized) return true;\n if (window[constants.sharedWindowObjectNames.configVariable] === undefined) return false;\n let config = window[constants.sharedWindowObjectNames.configVariable];\n if (config.type === undefined || config.type !== constants.typeCastGtmVariableConfig) return false;\n let flushInterval = config[constants.config.flushInterval];\n let flushSize = config[constants.config.flushSize];\n let trackerName = config[constants.config.trackerName];\n let appName = config[constants.config.appName];\n let emitterEndpoint = config[constants.config.emitterEndpoint] ?? config.endpoint;\n try {\n emitter = new CollecionesEmitter(emitterEndpoint, flushSize, flushInterval);\n tracker = new CollecionesWebTracker([emitter], trackerName, appName);\n initialized = true;\n return true;\n } catch (e) {\n console.error('Error initializing CollecionesEmitter:', e);\n return false;\n }\n }\n\n let track = (arg) => {\n init();\n if (!initialized) return false;\n if (!tracker) return false;\n if (!arg || typeof arg !== 'object') return false;\n\n const normalizeIdentifiers = (identifiers) => {\n if (Array.isArray(identifiers)) {\n return identifiers.flatMap(identifier => {\n if (typeof identifier !== 'object' || identifier === null) {\n return [];\n }\n if (identifier.name !== undefined || identifier.value !== undefined) {\n return [identifier];\n }\n return Object.entries(identifier).map(([name, value]) => ({ name, value }));\n });\n }\n if (!identifiers || typeof identifiers !== 'object') {\n return [];\n }\n return Object.entries(identifiers).map(([name, value]) => ({ name, value }));\n };\n\n const collectionOperators = {\n '==': (left, right) => left == right,\n '===': (left, right) => left === right,\n '!=': (left, right) => left != right,\n '!==': (left, right) => left !== right,\n '>': (left, right) => left > right,\n '>=': (left, right) => left >= right,\n '<': (left, right) => left < right,\n '<=': (left, right) => left <= right,\n 'in': (left, right) => Array.isArray(right) && right.includes(left)\n };\n\n // Small path resolver used by evaluated collections and filters.\n const getByPath = (obj, path) => {\n if (!path || typeof path !== 'string') {\n return undefined;\n }\n return path.split('.').reduce((acc, key) => {\n return (acc && acc[key] !== undefined) ? acc[key] : undefined;\n }, obj);\n };\n\n // Collection items are stored as `{ identifierField: value }` on the event.\n const addCollectionItem = (event, collectionName, identifierName, identifierValue) => {\n if (!collectionName || !identifierName || identifierValue === undefined || identifierValue === null) {\n return;\n }\n const collectionKey = event.setCollectionItem(collectionName);\n event.setCollectionItemReference(collectionName, collectionKey, identifierName, identifierValue);\n };\n\n // ARRAY collections are the simplest form:\n // they are arrays of primitive values that should be copied into the event\n // using the configured identifier field.\n const applyArrayCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.array)) {\n return false;\n }\n const identifierName = collectionConfig.identifierField;\n collectionConfig.array.forEach((value) => {\n if (Array.isArray(value)) {\n value.forEach((nestedValue) => addCollectionItem(event, collectionName, identifierName, nestedValue));\n return;\n }\n addCollectionItem(event, collectionName, identifierName, value);\n });\n return true;\n };\n\n // EVALUATED collections derive their identifier value from a path on each item.\n // An optional filter object narrows the source array before mapping.\n const applyEvaluatedCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.itemsField)) {\n return false;\n }\n\n let items = collectionConfig.itemsField;\n const filter = collectionConfig.filter;\n if (\n filter &&\n typeof filter === 'object' &&\n filter.path &&\n filter.operator &&\n collectionOperators[filter.operator]\n ) {\n items = items.filter((item) => {\n return collectionOperators[filter.operator](getByPath(item, filter.path), filter.value);\n });\n }\n\n const identifierName = collectionConfig.identifierField;\n items.forEach((item) => {\n const identifierValue = getByPath(item, collectionConfig.path) ?? item?.[identifierName] ?? item?.id;\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n // PARAMTABLE rows use dynamic field names that are prefixed by the collection name:\n // e.g. `listingParamTableItemsField` and `listingIdentifierValueParamTable`.\n const applyParamTableCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.table)) {\n return false;\n }\n\n const identifierNameKey = `${collectionName}ParamTableItemsField`;\n const identifierValueKey = `${collectionName}IdentifierValueParamTable`;\n collectionConfig.table.forEach((row) => {\n if (!row || typeof row !== 'object') {\n return;\n }\n const identifierName = row[identifierNameKey];\n const identifierValue = row[identifierValueKey];\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n const applyCollectionConfig = (event, collectionName, collectionConfig) => {\n if (!collectionConfig || typeof collectionConfig !== 'object') {\n return;\n }\n\n if (collectionConfig.type === 'ARRAY') {\n applyArrayCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'EVALUATED') {\n applyEvaluatedCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'PARAMTABLE') {\n applyParamTableCollection(event, collectionName, collectionConfig);\n }\n };\n\n const populateEvent = (eventArg, event) => {\n event.setEntity(eventArg.entity);\n event.setAction(eventArg.action);\n\n normalizeIdentifiers(eventArg.identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || !identifier.value) return;\n event.setIdentifier(identifier.name, identifier.value);\n });\n\n if (eventArg.actor?.entity) {\n event.setActor(eventArg.actor.entity);\n let identifiers = eventArg.actor?.identifiers;\n if (!Array.isArray(identifiers)) {\n identifiers = identifiers?.[eventArg.actor.entity] ?? identifiers;\n }\n normalizeIdentifiers(identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || !identifier.value) return;\n event.setActorIdentifier(identifier.name, identifier.value);\n });\n }\n\n const relations = eventArg?.relations ?? eventArg?.rerelations;\n if (relations && typeof relations === 'object') {\n Object.keys(relations).forEach(relationName => {\n event.setReference(relationName);\n Object.keys(relations[relationName]).forEach(identifierName => {\n event.setReferenceIdentifier(relationName, identifierName, relations[relationName][identifierName]);\n });\n });\n }\n if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {\n Object.keys(eventArg.adjectives).forEach(adjectiveName => {\n event.addAdjective(adjectiveName, eventArg.adjectives[adjectiveName]);\n });\n }\n\n if (eventArg?.collections && typeof eventArg.collections === 'object') {\n Object.keys(eventArg.collections).forEach(collectionName => {\n applyCollectionConfig(event, collectionName, eventArg.collections[collectionName]);\n });\n }\n };\n\n // Group form: payload carries an `events` array (and optionally a semantic `eventGroup` name).\n // Each item is a standalone event spec; they are bundled into a CollecionesEventGroup so that\n // shared group metadata (id + sibling clientEventIds) is materialised onto every event.\n if (Array.isArray(arg.events)) {\n const group = new CollecionesEventGroup();\n let added = 0;\n arg.events.forEach(eventArg => {\n if (!eventArg || typeof eventArg !== 'object') return;\n if (!eventArg.entity || !eventArg.action) return;\n const event = group.addEvent();\n populateEvent(eventArg, event);\n added++;\n });\n if (added === 0) return false;\n // Apply the semantic group name AFTER addEvent calls: each addEvent invalidates\n // group.groupId, so an override set earlier would be cleared by the loop above.\n if (typeof arg.eventGroup === 'string' && arg.eventGroup.length > 0) {\n group.groupId = arg.eventGroup;\n }\n tracker.trackGroup(group);\n return true;\n }\n\n if (!arg.entity || !arg.action) return false;\n const event = new CollecionesEvent();\n populateEvent(arg, event);\n tracker.track(event);\n return true;\n }\n\n let flush = () => {\n if (!init()) {\n return;\n }\n const queue = ensureQueue();\n if (!queue) return;\n\n if (queue !== queueReference) {\n queueReference = queue;\n processedQueueLength = 0;\n }\n\n if (queue.length < processedQueueLength) {\n processedQueueLength = 0;\n }\n\n while (processedQueueLength < queue.length) {\n const args = queue[processedQueueLength];\n processedQueueLength += 1;\n track(args);\n }\n }\n\n let ensureQueue = () => {\n let queue = window[constants.sharedWindowObjectNames.queue];\n if (!Array.isArray(queue)) {\n queueReference = null;\n processedQueueLength = 0;\n return null;\n }\n return queue;\n }\n\n let startQueueWatcher = (interval = queueWaitInterval) => {\n if (queueWatcherInterval === interval && queueWatcherTimer) {\n return;\n }\n if (queueWatcherTimer) {\n clearInterval(queueWatcherTimer);\n }\n queueWatcherInterval = interval;\n queueWatcherTimer = setInterval(() => {\n const queue = ensureQueue();\n if (!queue) {\n return;\n }\n if (queue.length > 0) {\n flush();\n }\n }, interval);\n }\n\n startQueue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EACvC,gBAAgB,cAAc,GAAG,IAAI;EACrC,gBAAgB,oBAAoB,GAAG,CAAC;EACxC,gBAAgB,OAAO,IAAI;EAC3B,YAAY;EACZ,YAAY,OAAO,KAAK;EACxB,QAAQ;;EAER,QAAQ,IAAI,iBAAiB,GAAG,CAAC,QAAQ,GAAG,iBAAiB,KAAK;EAClE,YAAY,IAAI,oBAAoB,KAAK,QAAQ,IAAI,iBAAiB,EAAE;EACxE,gBAAgB;EAChB,YAAY;EACZ,YAAY,IAAI,iBAAiB,EAAE;EACnC,gBAAgB,aAAa,CAAC,iBAAiB,CAAC;EAChD,YAAY;EACZ,YAAY,oBAAoB,GAAG,QAAQ;EAC3C,YAAY,iBAAiB,GAAG,WAAW,CAAC,MAAM;EAClD,gBAAgB,MAAM,KAAK,GAAG,WAAW,EAAE;EAC3C,gBAAgB,IAAI,CAAC,KAAK,EAAE;EAC5B,oBAAoB;EACpB,gBAAgB;EAChB,gBAAgB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;EACtC,oBAAoB,KAAK,EAAE;EAC3B,gBAAgB;EAChB,YAAY,CAAC,EAAE,QAAQ,CAAC;EACxB,QAAQ;;EAER,QAAQ,iBAAiB,CAAC,iBAAiB,CAAC;;EAE5C,QAAQ,OAAO;EACf,YAAY;EACZ;EACA,IAAI,CAAC,GAAG;EACR,IAAI,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE;EAC/C;;;;;;"}
1
+ {"version":3,"file":"browser.domainModel.gtm.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesEventGroup.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/browser.domainModel.gtm.constants.js","../src/browser.domainModel.gtm.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nconst formatToCamelCase = function(input) {\n return input\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word, index) => {\n if (index === 0) return word;\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nconst generateId = () => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n};\n\n\nexport {\n fromBase64,\n formatToCamelCase,\n getBrowserContext,\n toBase64,\n generateId,\n};","/**\n * CollecionesEvent\n * -----------------\n * Base class representing a semantically structured event object.\n * Each event models a specific interaction with an entity, optionally performed by an actor,\n * and may reference related entities or include contextual metadata.\n *\n * Key features:\n * - Captures structured semantics: entity, action, actor, context, references\n * - Supports multiple identifiers for both the main entity and the actor\n * - Allows origin tagging for cross-context or cross-application references\n * - Supports referencing collections of entities or grouped data\n * - Includes timestamps and tracker/app metadata for auditability\n * - Fully serializable and deserializable via toJSON/fromJSON\n */\n\nimport {formatToCamelCase, generateId } from './utils/utils.js';\n\nclass CollecionesEvent {\n\n /**\n * Constructs a new CollecionesEvent with default structure and timestamps.\n * Initializes empty containers for semantic attributes such as:\n * - entity: the subject of the event\n * - adjectives: descriptors of the entity\n * - identifiers: identifiers of the entity\n * - action: what happened to the entity\n * - actor: who or what triggered the event (with identifiers in actorIdentifiers)\n * - context: environmental data related to the event\n * - references: external entities involved, optionally scoped by origin\n * - collections: groups of related entities\n * - meta: tracking metadata and timestamps\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n this.collections = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.clientEventId = generateId();\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = formatToCamelCase(entity);\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = formatToCamelCase(action);\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(formatToCamelCase(adjective));\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * Identifiers allow multiple keys to uniquely identify the entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user', 'system').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * Supports multiple identifiers to uniquely identify the actor.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * Context can include any additional environmental or situational data.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Alias for `setReference` for compatibility.\n * Declares an external entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setRefence = function(entity, origin=null) {\n return this.setReference(entity, origin);\n }\n\n /**\n * Declares an entity referenced by this event.\n * References may include multiple identifiers and an optional origin to scope the reference.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setReference = function(entity, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * Ensures the reference is declared and sets the identifier under that reference.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setRefenceIdentifier = function(entity, name, identifier, origin=null) {\n return this.setReferenceIdentifier(entity, name, identifier, origin);\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setReferenceIdentifier = function(entity, name, identifier, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity, origin);\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Declares a collection of related entities for this event.\n * Collections group multiple related items and may include identifiers and origin metadata.\n * @param {string} entity - The collection name.\n * @param {string|null} origin - Optional origin identifier (e.g. system name).\n */\n setCollection = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {\n items: [],\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds a new item to a collection and returns its index key.\n * Items represent individual elements within the collection.\n * @param {string} entity - The name of the collection.\n * @returns {number} Index of the newly added item in the collection.\n */\n setCollectionItem = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n this.collections[entity].items.push({});\n let itemKey = this.collections[entity].items.length - 1;\n return itemKey;\n }\n\n /**\n * Assigns a reference (identifier) to a specific item in a collection.\n * Useful for tagging individual collection elements with identifiers.\n * @param {string} entity - Collection name.\n * @param {number} itemKey - The index of the item in the collection.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @throws {Error} If the item does not exist at the given index.\n */\n setCollectionItemReference = function(entity, itemKey, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n if(typeof this.collections[entity].items[itemKey] !== 'object') {\n throw new Error('bad bad man, the collection key does not exists');\n }\n this.collections[entity].items[itemKey][name] = identifier;\n }\n \n /**\n * Sets a static identifier that applies to the entire collection.\n * These identifiers describe the collection as a whole.\n * @param {string} entity - Collection name.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setCollectionIdentifier = function(entity, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {};\n }\n this.collections[entity].identifiers[name] = identifier;\n }\n\n /**\n * Sets the event group metadata on this event.\n * Called by CollecionesEventGroup.getEvents() to inject group membership.\n * @param {string} groupId - The shared group id for all events in the occurrence.\n * @param {string[]} groupClientEventIds - The clientEventIds of the other events in the group.\n */\n setEventGroup(groupId, groupClientEventIds) {\n if (typeof groupId !== 'string') {\n throw new Error('groupId must be a string');\n }\n if (!Array.isArray(groupClientEventIds)) {\n throw new Error('groupClientEventIds must be an array');\n }\n this.meta.eventGroup = {\n id: groupId,\n groupClientEventIds: [...groupClientEventIds]\n };\n }\n\n /**\n * Serializes the event instance to a plain object suitable for transport or storage.\n * The output includes all semantic fields and metadata.\n * @returns {object} A plain JavaScript object representing the event.\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta,\n collections: this.collections\n };\n }\n\n /**\n * Recreates a CollecionesEvent instance from a plain object.\n * Used when deserializing events from storage or network transport.\n * @param {object} obj - The input object containing event data.\n * @returns {CollecionesEvent} A rehydrated event instance.\n * @throws {Error} If the class type is not 'CollecionesEvent'.\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n instance.collections = obj.collections || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize || !this.flushInterval || this.flushInterval < 1) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","/**\n * CollecionesEventGroup\n * ----------------------\n * A client-side grouping interface for events that belong to the same business occurrence.\n *\n * Design principles:\n * - A group is purely a build-time construct; it does not change the wire format.\n * - Each event in the group remains a standalone CollecionesEvent.\n * - When getEvents() is called, group metadata is materialised onto each event:\n * meta.eventGroup.id — the shared group id\n * meta.eventGroup.groupClientEventIds — clientEventIds of all other events in the group\n * - Semantic meaning of the relations between events is intentionally left to the domain model.\n *\n * Usage:\n * const group = new CollecionesEventGroup();\n *\n * const eventA = group.addEvent();\n * eventA.setEntity('listing');\n * eventA.setAction('viewed');\n *\n * const eventB = group.addEvent();\n * eventB.setEntity('session');\n * eventB.setAction('active');\n *\n * tracker.trackGroup(group);\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport { generateId } from './utils/utils.js';\n\nclass CollecionesEventGroup {\n\n /**\n * Creates a new event group.\n * The groupId is NOT generated up-front: a group's identity is defined by its composition,\n * so the id is generated lazily in getEvents() and invalidated by every addEvent() call.\n * Reading `group.groupId` before the first getEvents() returns null.\n */\n constructor() {\n this.groupId = null;\n this._events = [];\n }\n\n /**\n * Adds an event to the group.\n * When called without arguments it acts as an alias for `new CollecionesEvent()`,\n * keeping the same familiar contract as building events directly.\n * An existing CollecionesEvent instance may also be passed in.\n *\n * Adding an event changes the composition of the group, so the cached groupId is invalidated\n * — the next getEvents() call will generate a fresh id and re-stamp every event.\n *\n * @param {CollecionesEvent|null} [event=null] - An existing event to register, or null to create a fresh one.\n * @returns {CollecionesEvent} The event that was added.\n * @throws {Error} If a non-null, non-CollecionesEvent value is passed.\n */\n addEvent(event = null) {\n if (event !== null && !(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n const newEvent = event ?? new CollecionesEvent();\n this._events.push(newEvent);\n this.groupId = null;\n return newEvent;\n }\n\n /**\n * Materialises group metadata onto every event and returns the full list.\n * If no groupId is currently set, a new one is generated here. Each event then receives:\n * - meta.eventGroup.id — the groupId of this group\n * - meta.eventGroup.groupClientEventIds — clientEventIds of the sibling events (not self)\n *\n * Safe to call multiple times: idempotent as long as no addEvent() happened in between.\n * After an addEvent() the cached groupId is null, so a subsequent getEvents() will mint a fresh id\n * and re-stamp every event accordingly.\n *\n * Callers may also assign `group.groupId` directly (e.g. with a semantic name) before calling\n * getEvents() to override the auto-generated value; do so AFTER all addEvent() calls,\n * otherwise the next addEvent() will clear the override.\n *\n * @returns {CollecionesEvent[]} A shallow copy of the internal events array with group metadata applied.\n */\n getEvents() {\n if (this.groupId === null) {\n this.groupId = generateId();\n }\n const allClientEventIds = this._events.map(e => e.meta.clientEventId);\n this._events.forEach(event => {\n const peers = allClientEventIds.filter(id => id !== event.meta.clientEventId);\n event.setEventGroup(this.groupId, peers);\n });\n return [...this._events];\n }\n}\n\nexport default CollecionesEventGroup;\n","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n\n /**\n * Dispatches all events in a CollecionesEventGroup.\n * Calls getEvents() to materialise group metadata onto each event,\n * then forwards every individual event to track().\n * @param {CollecionesEventGroup} group - The group to track.\n * @throws {Error} If group does not expose a getEvents() method.\n */\n trackGroup(group) {\n if (typeof group?.getEvents !== 'function') {\n throw new Error('Group must be an instance of CollecionesEventGroup');\n }\n group.getEvents().forEach(event => this.track(event));\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","var constants = {\n 'sharedWindowObjectNames': {\n 'queue': 'compilacionCollecionesClientosGtmQueue',\n 'configVariable': 'compilacionCollecionesClientosGtmTypeCastConfig'\n },\n 'config': {\n 'sourceName': 'jsLibSource',\n 'jsLibUrlVariable': 'jsLibSource_selfHostedUrl',\n 'selfHostedValue': 'SELF',\n 'unpkgHostedValue': 'UNPKG',\n 'flushInterval': 'flushInterval',\n 'flushSize': 'flushSize',\n 'trackerName': 'trackerName',\n 'appName': 'appName',\n 'emitterEndpoint': 'emitterEndpoint',\n 'typeName': 'type'\n },\n 'collecionesObject': 'compilacionCollecionesClientosGtm',\n 'typeCastGtmVariableConfig': 'compilacionCollecionesClientosGtmTypeCastConfig'\n};\n\nexport default constants;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesEventGroup from './CollecionesEventGroup.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport constants from './browser.domainModel.gtm.constants.js';\n\nif (!window[constants.collecionesObject]) {\n window[constants.collecionesObject] = (() => {\n\n let initialized = false;\n let emitter = null;\n let tracker = null;\n const queueWaitInterval = 250;\n let queueWatcherTimer = null;\n let queueWatcherInterval = null;\n let queueReference = null;\n let processedQueueLength = 0;\n\n let init = () => {\n if (initialized) return true;\n if (window[constants.sharedWindowObjectNames.configVariable] === undefined) return false;\n let config = window[constants.sharedWindowObjectNames.configVariable];\n if (config.type === undefined || config.type !== constants.typeCastGtmVariableConfig) return false;\n let flushInterval = config[constants.config.flushInterval];\n let flushSize = config[constants.config.flushSize];\n let trackerName = config[constants.config.trackerName];\n let appName = config[constants.config.appName];\n let emitterEndpoint = config[constants.config.emitterEndpoint] ?? config.endpoint;\n try {\n emitter = new CollecionesEmitter(emitterEndpoint, flushSize, flushInterval);\n tracker = new CollecionesWebTracker([emitter], trackerName, appName);\n initialized = true;\n return true;\n } catch (e) {\n console.error('Error initializing CollecionesEmitter:', e);\n return false;\n }\n }\n\n let track = (arg) => {\n init();\n if (!initialized) return false;\n if (!tracker) return false;\n if (!arg || typeof arg !== 'object') return false;\n\n // GTM variables can resolve to numbers/booleans or be left empty. Coerce\n // entity/action/actor names to a string so a mistyped or empty config value\n // cannot throw inside CollecionesEvent (formatToCamelCase) and drop the event.\n const toEventName = (value) => {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n return '';\n };\n\n const normalizeIdentifiers = (identifiers) => {\n if (Array.isArray(identifiers)) {\n return identifiers.flatMap(identifier => {\n if (typeof identifier !== 'object' || identifier === null) {\n return [];\n }\n if (identifier.name !== undefined || identifier.value !== undefined) {\n return [identifier];\n }\n return Object.entries(identifier).map(([name, value]) => ({ name, value }));\n });\n }\n if (!identifiers || typeof identifiers !== 'object') {\n return [];\n }\n return Object.entries(identifiers).map(([name, value]) => ({ name, value }));\n };\n\n const collectionOperators = {\n '==': (left, right) => left == right,\n '===': (left, right) => left === right,\n '!=': (left, right) => left != right,\n '!==': (left, right) => left !== right,\n '>': (left, right) => left > right,\n '>=': (left, right) => left >= right,\n '<': (left, right) => left < right,\n '<=': (left, right) => left <= right,\n 'in': (left, right) => Array.isArray(right) && right.includes(left)\n };\n\n // Small path resolver used by evaluated collections and filters.\n const getByPath = (obj, path) => {\n if (!path || typeof path !== 'string') {\n return undefined;\n }\n return path.split('.').reduce((acc, key) => {\n return (acc && acc[key] !== undefined) ? acc[key] : undefined;\n }, obj);\n };\n\n // Collection items are stored as `{ identifierField: value }` on the event.\n const addCollectionItem = (event, collectionName, identifierName, identifierValue) => {\n if (!collectionName || !identifierName || identifierValue === undefined || identifierValue === null) {\n return;\n }\n const collectionKey = event.setCollectionItem(collectionName);\n event.setCollectionItemReference(collectionName, collectionKey, identifierName, identifierValue);\n };\n\n // ARRAY collections are the simplest form:\n // they are arrays of primitive values that should be copied into the event\n // using the configured identifier field.\n const applyArrayCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.array)) {\n return false;\n }\n const identifierName = collectionConfig.identifierField;\n collectionConfig.array.forEach((value) => {\n if (Array.isArray(value)) {\n value.forEach((nestedValue) => addCollectionItem(event, collectionName, identifierName, nestedValue));\n return;\n }\n addCollectionItem(event, collectionName, identifierName, value);\n });\n return true;\n };\n\n // EVALUATED collections derive their identifier value from a path on each item.\n // An optional filter object narrows the source array before mapping.\n const applyEvaluatedCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.itemsField)) {\n return false;\n }\n\n let items = collectionConfig.itemsField;\n const filter = collectionConfig.filter;\n if (\n filter &&\n typeof filter === 'object' &&\n filter.path &&\n filter.operator &&\n collectionOperators[filter.operator]\n ) {\n items = items.filter((item) => {\n return collectionOperators[filter.operator](getByPath(item, filter.path), filter.value);\n });\n }\n\n const identifierName = collectionConfig.identifierField;\n items.forEach((item) => {\n const identifierValue = getByPath(item, collectionConfig.path) ?? item?.[identifierName] ?? item?.id;\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n // PARAMTABLE rows use dynamic field names that are prefixed by the collection name:\n // e.g. `listingParamTableItemsField` and `listingIdentifierValueParamTable`.\n const applyParamTableCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.table)) {\n return false;\n }\n\n const identifierNameKey = `${collectionName}ParamTableItemsField`;\n const identifierValueKey = `${collectionName}IdentifierValueParamTable`;\n collectionConfig.table.forEach((row) => {\n if (!row || typeof row !== 'object') {\n return;\n }\n const identifierName = row[identifierNameKey];\n const identifierValue = row[identifierValueKey];\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n const applyCollectionConfig = (event, collectionName, collectionConfig) => {\n if (!collectionConfig || typeof collectionConfig !== 'object') {\n return;\n }\n\n if (collectionConfig.type === 'ARRAY') {\n applyArrayCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'EVALUATED') {\n applyEvaluatedCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'PARAMTABLE') {\n applyParamTableCollection(event, collectionName, collectionConfig);\n }\n };\n\n const populateEvent = (eventArg, event) => {\n event.setEntity(toEventName(eventArg.entity));\n event.setAction(toEventName(eventArg.action));\n\n normalizeIdentifiers(eventArg.identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n // Reject only an absent name or a null/undefined value; falsy-but-valid\n // values such as 0 or '' must still be kept (matches addCollectionItem).\n if (!identifier.name || identifier.value == null) return;\n event.setIdentifier(identifier.name, identifier.value);\n });\n\n const actorName = toEventName(eventArg.actor?.entity ?? eventArg.actor?.name);\n if (actorName) {\n event.setActor(actorName);\n let identifiers = eventArg.actor?.identifiers;\n if (!Array.isArray(identifiers)) {\n identifiers = identifiers?.[actorName] ?? identifiers;\n }\n normalizeIdentifiers(identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || identifier.value == null) return;\n event.setActorIdentifier(identifier.name, identifier.value);\n });\n }\n\n const relations = eventArg?.relations ?? eventArg?.rerelations;\n if (relations && typeof relations === 'object') {\n Object.keys(relations).forEach(relationName => {\n const relationIdentifiers = relations[relationName];\n event.setReference(relationName);\n // A relation can be declared while its identifier object is left empty\n // (an unfilled GTM variable resolves to undefined/null). Guard against\n // non-object values so Object.keys cannot throw and drop the event.\n if (relationIdentifiers && typeof relationIdentifiers === 'object') {\n Object.keys(relationIdentifiers).forEach(identifierName => {\n event.setReferenceIdentifier(relationName, identifierName, relationIdentifiers[identifierName]);\n });\n }\n });\n }\n // Adjectives may arrive as an array of values or as an object keyed by adjective.\n if (Array.isArray(eventArg?.adjectives)) {\n eventArg.adjectives.forEach(adjective => {\n if (typeof adjective === 'string' && adjective.length > 0) {\n event.addAdjective(adjective);\n }\n });\n } else if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {\n Object.keys(eventArg.adjectives).forEach(adjectiveName => {\n if (adjectiveName.length > 0) {\n event.addAdjective(adjectiveName);\n }\n });\n }\n\n if (eventArg?.collections && typeof eventArg.collections === 'object') {\n Object.keys(eventArg.collections).forEach(collectionName => {\n applyCollectionConfig(event, collectionName, eventArg.collections[collectionName]);\n });\n }\n };\n\n // Group form: payload carries an `events` array (and optionally a semantic `eventGroup` name).\n // Each item is a standalone event spec; they are bundled into a CollecionesEventGroup so that\n // shared group metadata (id + sibling clientEventIds) is materialised onto every event.\n if (Array.isArray(arg.events)) {\n const group = new CollecionesEventGroup();\n let added = 0;\n arg.events.forEach(eventArg => {\n if (!eventArg || typeof eventArg !== 'object') return;\n if (!toEventName(eventArg.entity) || !toEventName(eventArg.action)) return;\n // Build the event before registering it so a single malformed event cannot\n // throw and take the whole group (including its valid siblings) down with it.\n try {\n const event = new CollecionesEvent();\n populateEvent(eventArg, event);\n group.addEvent(event);\n added++;\n } catch (e) {\n console.error('Colleciones: skipped malformed grouped event', e);\n }\n });\n if (added === 0) return false;\n // Apply the semantic group name AFTER addEvent calls: each addEvent invalidates\n // group.groupId, so an override set earlier would be cleared by the loop above.\n if (typeof arg.eventGroup === 'string' && arg.eventGroup.length > 0) {\n group.groupId = arg.eventGroup;\n }\n tracker.trackGroup(group);\n return true;\n }\n\n if (!toEventName(arg.entity) || !toEventName(arg.action)) return false;\n const event = new CollecionesEvent();\n populateEvent(arg, event);\n tracker.track(event);\n return true;\n }\n\n let flush = () => {\n if (!init()) {\n return;\n }\n const queue = ensureQueue();\n if (!queue) return;\n\n if (queue !== queueReference) {\n queueReference = queue;\n processedQueueLength = 0;\n }\n\n if (queue.length < processedQueueLength) {\n processedQueueLength = 0;\n }\n\n while (processedQueueLength < queue.length) {\n const args = queue[processedQueueLength];\n processedQueueLength += 1;\n // Never let one bad queue entry abort the flush loop: the index has already\n // advanced, so an uncaught throw here would permanently skip the rest of the batch.\n try {\n track(args);\n } catch (e) {\n console.error('Colleciones: failed to process queued event', e);\n }\n }\n }\n\n let ensureQueue = () => {\n let queue = window[constants.sharedWindowObjectNames.queue];\n if (!Array.isArray(queue)) {\n queueReference = null;\n processedQueueLength = 0;\n return null;\n }\n return queue;\n }\n\n let startQueueWatcher = (interval = queueWaitInterval) => {\n if (queueWatcherInterval === interval && queueWatcherTimer) {\n return;\n }\n if (queueWatcherTimer) {\n clearInterval(queueWatcherTimer);\n }\n queueWatcherInterval = interval;\n queueWatcherTimer = setInterval(() => {\n const queue = ensureQueue();\n if (!queue) {\n return;\n }\n if (queue.length > 0) {\n flush();\n }\n }, interval);\n }\n\n startQueueWatcher(queueWaitInterval);\n\n return {\n flush\n }\n })();\n window[constants.collecionesObject].flush();\n}\n"],"names":[],"mappings":";;;EAAA;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA,MAAM,QAAQ,GAAG,UAAU,GAAG,EAAE;EAChC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;EAC5E,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;EAC7D,IAAI,CAAC,MAAM;EACX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AY;EACZ,YAAY,IAAI,iBAAiB,EAAE;EACnC,gBAAgB,aAAa,CAAC,iBAAiB,CAAC;EAChD,YAAY;EACZ,YAAY,oBAAoB,GAAG,QAAQ;EAC3C,YAAY,iBAAiB,GAAG,WAAW,CAAC,MAAM;EAClD,gBAAgB,MAAM,KAAK,GAAG,WAAW,EAAE;EAC3C,gBAAgB,IAAI,CAAC,KAAK,EAAE;EAC5B,oBAAoB;EACpB,gBAAgB;EAChB,gBAAgB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;EACtC,oBAAoB,KAAK,EAAE;EAC3B,gBAAgB;EAChB,YAAY,CAAC,EAAE,QAAQ,CAAC;EACxB,QAAQ;;EAER,QAAQ,iBAAiB,CAAC,iBAAiB,CAAC;;EAE5C,QAAQ,OAAO;EACf,YAAY;EACZ;EACA,IAAI,CAAC,GAAG;EACR,IAAI,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE;EAC/C;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(){"use strict";const e=function(e){return e.replace(/[^a-zA-Z0-9]+/g," ").trim().split(/\s+/).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},t=()=>"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});class n{constructor(){this.entity="",this.adjevtives=[],this.identifiers={},this.action="",this.actor={},this.actorIdentifiers={},this.context={},this.references={},this.collections={},this.meta={eventFormat:"CollecionesEvent",eventFormatVersion:"1"},this.meta.tracker="",this.meta.app="",this.meta.clientEventId=t(),this.meta.timestamps={},this.meta.timestamps.clientDatetimeUtc=(new Date).toISOString(),"undefined"!=typeof window&&"undefined"!=typeof navigator&&navigator.language?(this.meta.timestamps.clientDatetimeLocal=new Date(Date.now()-6e4*(new Date).getTimezoneOffset()).toISOString(),this.meta.timestamps.timeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.meta.timestamps.timeZoneOffset=(new Date).getTimezoneOffset()):(this.meta.timestamps.clientDatetimeLocal=(new Date).toISOString(),this.meta.timestamps.timeZone="UTC")}getEventFormat(){let e=this.meta?.eventFormat;return void 0!==e?e:"1"}getEventFormatVersion(){let e=this?.meta?.eventFormatVersion;return void 0!==e?e:"CollecionesEvent"}overrideDatetime(e={}){for(const[t,n]of Object.entries(e))this.meta.timestamps[t]=n}setTracker(e){this.meta.tracker=e}setAppName(e){this.meta.appName=e}setSchema(e){if("string"!=typeof e)throw new Error("Schema must be a string");this.meta.schema=e}setEntity=function(t){this.entity=e(t)};setAction=function(t){this.action=e(t)};addAdjective=function(t){if("string"!=typeof t)throw new Error("Adjective must be a string");this.adjevtives.push(e(t))};setIdentifier=function(e,t){if("string"!=typeof e)throw new Error("Identifier name must be a string");this.identifiers[e]=t};setActor=function(e){if("string"!=typeof e)throw new Error("Actor name must be a string");this.actor.name=e};setActorIdentifier=function(e,t){if("string"!=typeof e)throw new Error("Actor Identifier name must be a string");this.actorIdentifiers[e]=t};setContext=function(e,t){if("string"!=typeof e)throw new Error("Context must be a string");this.context[e]=t};setRefence=function(e,t=null){return this.setReference(e,t)};setReference=function(t,n=null){if("string"!=typeof t)throw new Error("Referenced entity must be a string");t=e(t),null!==n&&(t=`${n}.${t}`),void 0===this.references[t]&&(this.references[t]={identifiers:{},origin:n})};setRefenceIdentifier=function(e,t,n,i=null){return this.setReferenceIdentifier(e,t,n,i)};setReferenceIdentifier=function(t,n,i,r=null){if("string"!=typeof t)throw new Error("Referenced entity name must be a string");if("string"!=typeof n)throw new Error("Actor Identifier name must be a string");this.setRefence(t,r),t=e(t),null!==r&&(t=`${r}.${t}`),this.references[t].identifiers[n]=i};setCollection=function(t,n=null){t=e(t),null!==n&&(t=`${n}.${t}`),null==this.collections[t]&&(this.collections[t]={items:[],identifiers:{},origin:n})};setCollectionItem=function(t,n=null){return t=e(t),null!==n&&(t=`${n}.${t}`),this.setCollection(t),this.collections[t].items.push({}),this.collections[t].items.length-1};setCollectionItemReference=function(t,n,i,r,o=null){if(t=e(t),null!==o&&(t=`${o}.${t}`),this.setCollection(t),"object"!=typeof this.collections[t].items[n])throw new Error("bad bad man, the collection key does not exists");this.collections[t].items[n][i]=r};setCollectionIdentifier=function(t,n,i,r=null){t=e(t),null!==r&&(t=`${r}.${t}`),null==this.collections[t]&&(this.collections[t]={}),this.collections[t].identifiers[n]=i};setEventGroup(e,t){if("string"!=typeof e)throw new Error("groupId must be a string");if(!Array.isArray(t))throw new Error("groupClientEventIds must be an array");this.meta.eventGroup={id:e,groupClientEventIds:[...t]}}toJSON(){return{class:"CollecionesEvent",entity:this.entity,adjectives:this.adjevtives,identifiers:this.identifiers,action:this.action,actor:this.actor,actorIdentifiers:this.actorIdentifiers,actorIds:this.actorIds,context:this.context,references:this.references,meta:this.meta,collections:this.collections}}static fromJSON(e){if(!e||"CollecionesEvent"!==e.class)throw new Error("Invalid or missing event class type");const t=new n;return t.entity=e.entity,t.adjevtives=e.adjectives||[],t.identifiers=e.identifiers||{},t.action=e.action,t.actor=e.actor,t.actorIdentifiers=e.actorIdentifiers,t.actorIds=e.actorIds,t.context=e.context||{},t.references=e.references||{},t.meta=e.meta||{},t.collections=e.collections||{},t}}class i{constructor(e="/collect",t=10,n=!1){this.endpoint=e,this.flushInterval=n,this.flushSize=t,this.buffer=[],this.timer=null,this.lastPayload=null}startTimer(){this.stopTimer(),"number"==typeof this.flushInterval&&this.flushInterval>0&&(this.timer=setInterval(()=>this.flush(),this.flushInterval))}startTimerIfStopped(){this.timer||this.startTimer()}stopTimer(){this.timer&&clearInterval(this.timer),this.timer=null}track(e){if(!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");this.trackAsync(e)}async trackAsync(e){if(!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");return this.startTimerIfStopped(),this.buffer.push(e),this.buffer.length>=this.flushSize||!this.flushInterval||this.flushInterval<1?this.flush():Promise.resolve()}async flush(){if(0===this.buffer.length)return;this.stopTimer();const e=this.buildBody();this.lastPayload=e,this.buffer=[];try{const t=await fetch(this.endpoint,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:e});return t.ok||console.log(`Failed to send events: ${t.statusText}`),!0}catch(e){console.log(`Network error sending events: ${e.message}`)}}buildBody(){return JSON.stringify(this.buffer.map(e=>{return t=JSON.stringify(e.toJSON()),"undefined"!=typeof window&&"function"==typeof window.btoa?window.btoa(unescape(encodeURIComponent(t))):Buffer.from(t,"utf-8").toString("base64");var t}))}}class r{constructor(){this.groupId=null,this._events=[]}addEvent(e=null){if(null!==e&&!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");const t=e??new n;return this._events.push(t),this.groupId=null,t}getEvents(){null===this.groupId&&(this.groupId=t());const e=this._events.map(e=>e.meta.clientEventId);return this._events.forEach(t=>{const n=e.filter(e=>e!==t.meta.clientEventId);t.setEventGroup(this.groupId,n)}),[...this._events]}}class o{constructor(e,t,n){this.emitters=e,this.trackerName=t,this.appName=n}track(e){if(!(e instanceof n))throw new Error("Event must be of type CollecionesEvent");e.setTracker(this.trackerName),e.setAppName(this.appName),this.emitters.forEach(t=>{t.track(e,this.trackerName,this.appName)})}trackGroup(e){if("function"!=typeof e?.getEvents)throw new Error("Group must be an instance of CollecionesEventGroup");e.getEvents().forEach(e=>this.track(e))}}class s extends o{constructor(e,t,n){super(e,t,n)}track(e){if(!(e instanceof n))throw new Error("Event must be of type CollecionesEvent");e.setContext("browserContext","undefined"==typeof window||"undefined"==typeof navigator?{}:{hasFocus:document.hasFocus(),language:navigator.language,platform:navigator.platform,referrer:document.referrer,screenHeight:window.screen.height,screenWidth:window.screen.width,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,url:window.location.href,userAgent:navigator.userAgent,viewportHeight:window.innerHeight,viewportWidth:window.innerWidth}),super.track(e)}}var a={queue:"compilacionCollecionesClientosGtmQueue",configVariable:"compilacionCollecionesClientosGtmTypeCastConfig"},c={flushInterval:"flushInterval",flushSize:"flushSize",trackerName:"trackerName",appName:"appName",emitterEndpoint:"emitterEndpoint"},l="compilacionCollecionesClientosGtm",f="compilacionCollecionesClientosGtmTypeCastConfig";window[l]||(window[l]=(()=>{let e=!1,t=null,o=null;let l=null,u=null,h=null,m=0,d=()=>{if(e)return!0;if(void 0===window[a.configVariable])return!1;let n=window[a.configVariable];if(void 0===n.type||n.type!==f)return!1;let r=n[c.flushInterval],l=n[c.flushSize],u=n[c.trackerName],h=n[c.appName],m=n[c.emitterEndpoint]??n.endpoint;try{return t=new i(m,l,r),o=new s([t],u,h),e=!0,!0}catch(e){return console.error("Error initializing CollecionesEmitter:",e),!1}},p=t=>{if(d(),!e)return!1;if(!o)return!1;if(!t||"object"!=typeof t)return!1;const i=e=>Array.isArray(e)?e.flatMap(e=>"object"!=typeof e||null===e?[]:void 0!==e.name||void 0!==e.value?[e]:Object.entries(e).map(([e,t])=>({name:e,value:t}))):e&&"object"==typeof e?Object.entries(e).map(([e,t])=>({name:e,value:t})):[],s={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,in:(e,t)=>Array.isArray(t)&&t.includes(e)},a=(e,t)=>{if(t&&"string"==typeof t)return t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e)},c=(e,t,n,i)=>{if(!t||!n||null==i)return;const r=e.setCollectionItem(t);e.setCollectionItemReference(t,r,n,i)},l=(e,t,n)=>{n&&"object"==typeof n&&("ARRAY"!==n.type?"EVALUATED"!==n.type?"PARAMTABLE"===n.type&&((e,t,n)=>{if(!Array.isArray(n.table))return!1;const i=`${t}ParamTableItemsField`,r=`${t}IdentifierValueParamTable`;n.table.forEach(n=>{if(!n||"object"!=typeof n)return;const o=n[i],s=n[r];c(e,t,o,s)})})(e,t,n):((e,t,n)=>{if(!Array.isArray(n.itemsField))return!1;let i=n.itemsField;const r=n.filter;r&&"object"==typeof r&&r.path&&r.operator&&s[r.operator]&&(i=i.filter(e=>s[r.operator](a(e,r.path),r.value)));const o=n.identifierField;i.forEach(i=>{const r=a(i,n.path)??i?.[o]??i?.id;c(e,t,o,r)})})(e,t,n):((e,t,n)=>{if(!Array.isArray(n.array))return!1;const i=n.identifierField;n.array.forEach(n=>{Array.isArray(n)?n.forEach(n=>c(e,t,i,n)):c(e,t,i,n)})})(e,t,n))},f=(e,t)=>{if(t.setEntity(e.entity),t.setAction(e.action),i(e.identifiers).forEach(e=>{"object"==typeof e&&null!==e&&e.name&&e.value&&t.setIdentifier(e.name,e.value)}),e.actor?.entity){t.setActor(e.actor.entity);let n=e.actor?.identifiers;Array.isArray(n)||(n=n?.[e.actor.entity]??n),i(n).forEach(e=>{"object"==typeof e&&null!==e&&e.name&&e.value&&t.setActorIdentifier(e.name,e.value)})}const n=e?.relations??e?.rerelations;n&&"object"==typeof n&&Object.keys(n).forEach(e=>{t.setReference(e),Object.keys(n[e]).forEach(i=>{t.setReferenceIdentifier(e,i,n[e][i])})}),e?.adjectives&&"object"==typeof e.adjectives&&Object.keys(e.adjectives).forEach(n=>{t.addAdjective(n,e.adjectives[n])}),e?.collections&&"object"==typeof e.collections&&Object.keys(e.collections).forEach(n=>{l(t,n,e.collections[n])})};if(Array.isArray(t.events)){const e=new r;let n=0;return t.events.forEach(t=>{if(!t||"object"!=typeof t)return;if(!t.entity||!t.action)return;const i=e.addEvent();f(t,i),n++}),0===n?!1:("string"==typeof t.eventGroup&&t.eventGroup.length>0&&(e.groupId=t.eventGroup),o.trackGroup(e),!0)}if(!t.entity||!t.action)return!1;const u=new n;return f(t,u),o.track(u),!0},v=()=>{if(!d())return;const e=y();if(e)for(e!==h&&(h=e,m=0),e.length<m&&(m=0);m<e.length;){const t=e[m];m+=1,p(t)}},y=()=>{let e=window[a.queue];return Array.isArray(e)?e:(h=null,m=0,null)};return((e=250)=>{u===e&&l||(l&&clearInterval(l),u=e,l=setInterval(()=>{const e=y();e&&e.length>0&&v()},e))})(250),{flush:v}})(),window[l].flush())}();
1
+ !function(){"use strict";const e=function(e){return e.replace(/[^a-zA-Z0-9]+/g," ").trim().split(/\s+/).map((e,t)=>0===t?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")},t=()=>"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});class n{constructor(){this.entity="",this.adjevtives=[],this.identifiers={},this.action="",this.actor={},this.actorIdentifiers={},this.context={},this.references={},this.collections={},this.meta={eventFormat:"CollecionesEvent",eventFormatVersion:"1"},this.meta.tracker="",this.meta.app="",this.meta.clientEventId=t(),this.meta.timestamps={},this.meta.timestamps.clientDatetimeUtc=(new Date).toISOString(),"undefined"!=typeof window&&"undefined"!=typeof navigator&&navigator.language?(this.meta.timestamps.clientDatetimeLocal=new Date(Date.now()-6e4*(new Date).getTimezoneOffset()).toISOString(),this.meta.timestamps.timeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.meta.timestamps.timeZoneOffset=(new Date).getTimezoneOffset()):(this.meta.timestamps.clientDatetimeLocal=(new Date).toISOString(),this.meta.timestamps.timeZone="UTC")}getEventFormat(){let e=this.meta?.eventFormat;return void 0!==e?e:"1"}getEventFormatVersion(){let e=this?.meta?.eventFormatVersion;return void 0!==e?e:"CollecionesEvent"}overrideDatetime(e={}){for(const[t,n]of Object.entries(e))this.meta.timestamps[t]=n}setTracker(e){this.meta.tracker=e}setAppName(e){this.meta.appName=e}setSchema(e){if("string"!=typeof e)throw new Error("Schema must be a string");this.meta.schema=e}setEntity=function(t){this.entity=e(t)};setAction=function(t){this.action=e(t)};addAdjective=function(t){if("string"!=typeof t)throw new Error("Adjective must be a string");this.adjevtives.push(e(t))};setIdentifier=function(e,t){if("string"!=typeof e)throw new Error("Identifier name must be a string");this.identifiers[e]=t};setActor=function(e){if("string"!=typeof e)throw new Error("Actor name must be a string");this.actor.name=e};setActorIdentifier=function(e,t){if("string"!=typeof e)throw new Error("Actor Identifier name must be a string");this.actorIdentifiers[e]=t};setContext=function(e,t){if("string"!=typeof e)throw new Error("Context must be a string");this.context[e]=t};setRefence=function(e,t=null){return this.setReference(e,t)};setReference=function(t,n=null){if("string"!=typeof t)throw new Error("Referenced entity must be a string");t=e(t),null!==n&&(t=`${n}.${t}`),void 0===this.references[t]&&(this.references[t]={identifiers:{},origin:n})};setRefenceIdentifier=function(e,t,n,i=null){return this.setReferenceIdentifier(e,t,n,i)};setReferenceIdentifier=function(t,n,i,r=null){if("string"!=typeof t)throw new Error("Referenced entity name must be a string");if("string"!=typeof n)throw new Error("Actor Identifier name must be a string");this.setRefence(t,r),t=e(t),null!==r&&(t=`${r}.${t}`),this.references[t].identifiers[n]=i};setCollection=function(t,n=null){t=e(t),null!==n&&(t=`${n}.${t}`),null==this.collections[t]&&(this.collections[t]={items:[],identifiers:{},origin:n})};setCollectionItem=function(t,n=null){return t=e(t),null!==n&&(t=`${n}.${t}`),this.setCollection(t),this.collections[t].items.push({}),this.collections[t].items.length-1};setCollectionItemReference=function(t,n,i,r,o=null){if(t=e(t),null!==o&&(t=`${o}.${t}`),this.setCollection(t),"object"!=typeof this.collections[t].items[n])throw new Error("bad bad man, the collection key does not exists");this.collections[t].items[n][i]=r};setCollectionIdentifier=function(t,n,i,r=null){t=e(t),null!==r&&(t=`${r}.${t}`),null==this.collections[t]&&(this.collections[t]={}),this.collections[t].identifiers[n]=i};setEventGroup(e,t){if("string"!=typeof e)throw new Error("groupId must be a string");if(!Array.isArray(t))throw new Error("groupClientEventIds must be an array");this.meta.eventGroup={id:e,groupClientEventIds:[...t]}}toJSON(){return{class:"CollecionesEvent",entity:this.entity,adjectives:this.adjevtives,identifiers:this.identifiers,action:this.action,actor:this.actor,actorIdentifiers:this.actorIdentifiers,actorIds:this.actorIds,context:this.context,references:this.references,meta:this.meta,collections:this.collections}}static fromJSON(e){if(!e||"CollecionesEvent"!==e.class)throw new Error("Invalid or missing event class type");const t=new n;return t.entity=e.entity,t.adjevtives=e.adjectives||[],t.identifiers=e.identifiers||{},t.action=e.action,t.actor=e.actor,t.actorIdentifiers=e.actorIdentifiers,t.actorIds=e.actorIds,t.context=e.context||{},t.references=e.references||{},t.meta=e.meta||{},t.collections=e.collections||{},t}}class i{constructor(e="/collect",t=10,n=!1){this.endpoint=e,this.flushInterval=n,this.flushSize=t,this.buffer=[],this.timer=null,this.lastPayload=null}startTimer(){this.stopTimer(),"number"==typeof this.flushInterval&&this.flushInterval>0&&(this.timer=setInterval(()=>this.flush(),this.flushInterval))}startTimerIfStopped(){this.timer||this.startTimer()}stopTimer(){this.timer&&clearInterval(this.timer),this.timer=null}track(e){if(!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");this.trackAsync(e)}async trackAsync(e){if(!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");return this.startTimerIfStopped(),this.buffer.push(e),this.buffer.length>=this.flushSize||!this.flushInterval||this.flushInterval<1?this.flush():Promise.resolve()}async flush(){if(0===this.buffer.length)return;this.stopTimer();const e=this.buildBody();this.lastPayload=e,this.buffer=[];try{const t=await fetch(this.endpoint,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:e});return t.ok||console.log(`Failed to send events: ${t.statusText}`),!0}catch(e){console.log(`Network error sending events: ${e.message}`)}}buildBody(){return JSON.stringify(this.buffer.map(e=>{return t=JSON.stringify(e.toJSON()),"undefined"!=typeof window&&"function"==typeof window.btoa?window.btoa(unescape(encodeURIComponent(t))):Buffer.from(t,"utf-8").toString("base64");var t}))}}class r{constructor(){this.groupId=null,this._events=[]}addEvent(e=null){if(null!==e&&!(e instanceof n))throw new Error("Event must be an instance of CollecionesEvent");const t=e??new n;return this._events.push(t),this.groupId=null,t}getEvents(){null===this.groupId&&(this.groupId=t());const e=this._events.map(e=>e.meta.clientEventId);return this._events.forEach(t=>{const n=e.filter(e=>e!==t.meta.clientEventId);t.setEventGroup(this.groupId,n)}),[...this._events]}}class o{constructor(e,t,n){this.emitters=e,this.trackerName=t,this.appName=n}track(e){if(!(e instanceof n))throw new Error("Event must be of type CollecionesEvent");e.setTracker(this.trackerName),e.setAppName(this.appName),this.emitters.forEach(t=>{t.track(e,this.trackerName,this.appName)})}trackGroup(e){if("function"!=typeof e?.getEvents)throw new Error("Group must be an instance of CollecionesEventGroup");e.getEvents().forEach(e=>this.track(e))}}class s extends o{constructor(e,t,n){super(e,t,n)}track(e){if(!(e instanceof n))throw new Error("Event must be of type CollecionesEvent");e.setContext("browserContext","undefined"==typeof window||"undefined"==typeof navigator?{}:{hasFocus:document.hasFocus(),language:navigator.language,platform:navigator.platform,referrer:document.referrer,screenHeight:window.screen.height,screenWidth:window.screen.width,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,url:window.location.href,userAgent:navigator.userAgent,viewportHeight:window.innerHeight,viewportWidth:window.innerWidth}),super.track(e)}}var a={queue:"compilacionCollecionesClientosGtmQueue",configVariable:"compilacionCollecionesClientosGtmTypeCastConfig"},c={flushInterval:"flushInterval",flushSize:"flushSize",trackerName:"trackerName",appName:"appName",emitterEndpoint:"emitterEndpoint"},l="compilacionCollecionesClientosGtm",f="compilacionCollecionesClientosGtmTypeCastConfig";window[l]||(window[l]=(()=>{let e=!1,t=null,o=null;let l=null,u=null,h=null,m=0,d=()=>{if(e)return!0;if(void 0===window[a.configVariable])return!1;let n=window[a.configVariable];if(void 0===n.type||n.type!==f)return!1;let r=n[c.flushInterval],l=n[c.flushSize],u=n[c.trackerName],h=n[c.appName],m=n[c.emitterEndpoint]??n.endpoint;try{return t=new i(m,l,r),o=new s([t],u,h),e=!0,!0}catch(e){return console.error("Error initializing CollecionesEmitter:",e),!1}},p=t=>{if(d(),!e)return!1;if(!o)return!1;if(!t||"object"!=typeof t)return!1;const i=e=>"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):"",s=e=>Array.isArray(e)?e.flatMap(e=>"object"!=typeof e||null===e?[]:void 0!==e.name||void 0!==e.value?[e]:Object.entries(e).map(([e,t])=>({name:e,value:t}))):e&&"object"==typeof e?Object.entries(e).map(([e,t])=>({name:e,value:t})):[],a={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,in:(e,t)=>Array.isArray(t)&&t.includes(e)},c=(e,t)=>{if(t&&"string"==typeof t)return t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:void 0,e)},l=(e,t,n,i)=>{if(!t||!n||null==i)return;const r=e.setCollectionItem(t);e.setCollectionItemReference(t,r,n,i)},f=(e,t,n)=>{n&&"object"==typeof n&&("ARRAY"!==n.type?"EVALUATED"!==n.type?"PARAMTABLE"===n.type&&((e,t,n)=>{if(!Array.isArray(n.table))return!1;const i=`${t}ParamTableItemsField`,r=`${t}IdentifierValueParamTable`;n.table.forEach(n=>{if(!n||"object"!=typeof n)return;const o=n[i],s=n[r];l(e,t,o,s)})})(e,t,n):((e,t,n)=>{if(!Array.isArray(n.itemsField))return!1;let i=n.itemsField;const r=n.filter;r&&"object"==typeof r&&r.path&&r.operator&&a[r.operator]&&(i=i.filter(e=>a[r.operator](c(e,r.path),r.value)));const o=n.identifierField;i.forEach(i=>{const r=c(i,n.path)??i?.[o]??i?.id;l(e,t,o,r)})})(e,t,n):((e,t,n)=>{if(!Array.isArray(n.array))return!1;const i=n.identifierField;n.array.forEach(n=>{Array.isArray(n)?n.forEach(n=>l(e,t,i,n)):l(e,t,i,n)})})(e,t,n))},u=(e,t)=>{t.setEntity(i(e.entity)),t.setAction(i(e.action)),s(e.identifiers).forEach(e=>{"object"==typeof e&&null!==e&&e.name&&null!=e.value&&t.setIdentifier(e.name,e.value)});const n=i(e.actor?.entity??e.actor?.name);if(n){t.setActor(n);let i=e.actor?.identifiers;Array.isArray(i)||(i=i?.[n]??i),s(i).forEach(e=>{"object"==typeof e&&null!==e&&e.name&&null!=e.value&&t.setActorIdentifier(e.name,e.value)})}const r=e?.relations??e?.rerelations;r&&"object"==typeof r&&Object.keys(r).forEach(e=>{const n=r[e];t.setReference(e),n&&"object"==typeof n&&Object.keys(n).forEach(i=>{t.setReferenceIdentifier(e,i,n[i])})}),Array.isArray(e?.adjectives)?e.adjectives.forEach(e=>{"string"==typeof e&&e.length>0&&t.addAdjective(e)}):e?.adjectives&&"object"==typeof e.adjectives&&Object.keys(e.adjectives).forEach(e=>{e.length>0&&t.addAdjective(e)}),e?.collections&&"object"==typeof e.collections&&Object.keys(e.collections).forEach(n=>{f(t,n,e.collections[n])})};if(Array.isArray(t.events)){const e=new r;let s=0;return t.events.forEach(t=>{if(t&&"object"==typeof t&&i(t.entity)&&i(t.action))try{const i=new n;u(t,i),e.addEvent(i),s++}catch(e){console.error("Colleciones: skipped malformed grouped event",e)}}),0===s?!1:("string"==typeof t.eventGroup&&t.eventGroup.length>0&&(e.groupId=t.eventGroup),o.trackGroup(e),!0)}if(!i(t.entity)||!i(t.action))return!1;const h=new n;return u(t,h),o.track(h),!0},y=()=>{if(!d())return;const e=v();if(e)for(e!==h&&(h=e,m=0),e.length<m&&(m=0);m<e.length;){const t=e[m];m+=1;try{p(t)}catch(e){console.error("Colleciones: failed to process queued event",e)}}},v=()=>{let e=window[a.queue];return Array.isArray(e)?e:(h=null,m=0,null)};return((e=250)=>{u===e&&l||(l&&clearInterval(l),u=e,l=setInterval(()=>{const e=v();e&&e.length>0&&y()},e))})(250),{flush:y}})(),window[l].flush())}();
2
2
  //# sourceMappingURL=browser.domainModel.gtm.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.domainModel.gtm.min.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesEventGroup.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/browser.domainModel.gtm.constants.js","../src/browser.domainModel.gtm.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nconst formatToCamelCase = function(input) {\n return input\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word, index) => {\n if (index === 0) return word;\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nconst generateId = () => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n};\n\n\nexport {\n fromBase64,\n formatToCamelCase,\n getBrowserContext,\n toBase64,\n generateId,\n};","/**\n * CollecionesEvent\n * -----------------\n * Base class representing a semantically structured event object.\n * Each event models a specific interaction with an entity, optionally performed by an actor,\n * and may reference related entities or include contextual metadata.\n *\n * Key features:\n * - Captures structured semantics: entity, action, actor, context, references\n * - Supports multiple identifiers for both the main entity and the actor\n * - Allows origin tagging for cross-context or cross-application references\n * - Supports referencing collections of entities or grouped data\n * - Includes timestamps and tracker/app metadata for auditability\n * - Fully serializable and deserializable via toJSON/fromJSON\n */\n\nimport {formatToCamelCase, generateId } from './utils/utils.js';\n\nclass CollecionesEvent {\n\n /**\n * Constructs a new CollecionesEvent with default structure and timestamps.\n * Initializes empty containers for semantic attributes such as:\n * - entity: the subject of the event\n * - adjectives: descriptors of the entity\n * - identifiers: identifiers of the entity\n * - action: what happened to the entity\n * - actor: who or what triggered the event (with identifiers in actorIdentifiers)\n * - context: environmental data related to the event\n * - references: external entities involved, optionally scoped by origin\n * - collections: groups of related entities\n * - meta: tracking metadata and timestamps\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n this.collections = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.clientEventId = generateId();\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = formatToCamelCase(entity);\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = formatToCamelCase(action);\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(formatToCamelCase(adjective));\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * Identifiers allow multiple keys to uniquely identify the entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user', 'system').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * Supports multiple identifiers to uniquely identify the actor.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * Context can include any additional environmental or situational data.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Alias for `setReference` for compatibility.\n * Declares an external entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setRefence = function(entity, origin=null) {\n return this.setReference(entity, origin);\n }\n\n /**\n * Declares an entity referenced by this event.\n * References may include multiple identifiers and an optional origin to scope the reference.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setReference = function(entity, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * Ensures the reference is declared and sets the identifier under that reference.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setRefenceIdentifier = function(entity, name, identifier, origin=null) {\n return this.setReferenceIdentifier(entity, name, identifier, origin);\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setReferenceIdentifier = function(entity, name, identifier, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity, origin);\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Declares a collection of related entities for this event.\n * Collections group multiple related items and may include identifiers and origin metadata.\n * @param {string} entity - The collection name.\n * @param {string|null} origin - Optional origin identifier (e.g. system name).\n */\n setCollection = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {\n items: [],\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds a new item to a collection and returns its index key.\n * Items represent individual elements within the collection.\n * @param {string} entity - The name of the collection.\n * @returns {number} Index of the newly added item in the collection.\n */\n setCollectionItem = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n this.collections[entity].items.push({});\n let itemKey = this.collections[entity].items.length - 1;\n return itemKey;\n }\n\n /**\n * Assigns a reference (identifier) to a specific item in a collection.\n * Useful for tagging individual collection elements with identifiers.\n * @param {string} entity - Collection name.\n * @param {number} itemKey - The index of the item in the collection.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @throws {Error} If the item does not exist at the given index.\n */\n setCollectionItemReference = function(entity, itemKey, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n if(typeof this.collections[entity].items[itemKey] !== 'object') {\n throw new Error('bad bad man, the collection key does not exists');\n }\n this.collections[entity].items[itemKey][name] = identifier;\n }\n \n /**\n * Sets a static identifier that applies to the entire collection.\n * These identifiers describe the collection as a whole.\n * @param {string} entity - Collection name.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setCollectionIdentifier = function(entity, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {};\n }\n this.collections[entity].identifiers[name] = identifier;\n }\n\n /**\n * Sets the event group metadata on this event.\n * Called by CollecionesEventGroup.getEvents() to inject group membership.\n * @param {string} groupId - The shared group id for all events in the occurrence.\n * @param {string[]} groupClientEventIds - The clientEventIds of the other events in the group.\n */\n setEventGroup(groupId, groupClientEventIds) {\n if (typeof groupId !== 'string') {\n throw new Error('groupId must be a string');\n }\n if (!Array.isArray(groupClientEventIds)) {\n throw new Error('groupClientEventIds must be an array');\n }\n this.meta.eventGroup = {\n id: groupId,\n groupClientEventIds: [...groupClientEventIds]\n };\n }\n\n /**\n * Serializes the event instance to a plain object suitable for transport or storage.\n * The output includes all semantic fields and metadata.\n * @returns {object} A plain JavaScript object representing the event.\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta,\n collections: this.collections\n };\n }\n\n /**\n * Recreates a CollecionesEvent instance from a plain object.\n * Used when deserializing events from storage or network transport.\n * @param {object} obj - The input object containing event data.\n * @returns {CollecionesEvent} A rehydrated event instance.\n * @throws {Error} If the class type is not 'CollecionesEvent'.\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n instance.collections = obj.collections || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize || !this.flushInterval || this.flushInterval < 1) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","/**\n * CollecionesEventGroup\n * ----------------------\n * A client-side grouping interface for events that belong to the same business occurrence.\n *\n * Design principles:\n * - A group is purely a build-time construct; it does not change the wire format.\n * - Each event in the group remains a standalone CollecionesEvent.\n * - When getEvents() is called, group metadata is materialised onto each event:\n * meta.eventGroup.id — the shared group id\n * meta.eventGroup.groupClientEventIds — clientEventIds of all other events in the group\n * - Semantic meaning of the relations between events is intentionally left to the domain model.\n *\n * Usage:\n * const group = new CollecionesEventGroup();\n *\n * const eventA = group.addEvent();\n * eventA.setEntity('listing');\n * eventA.setAction('viewed');\n *\n * const eventB = group.addEvent();\n * eventB.setEntity('session');\n * eventB.setAction('active');\n *\n * tracker.trackGroup(group);\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport { generateId } from './utils/utils.js';\n\nclass CollecionesEventGroup {\n\n /**\n * Creates a new event group.\n * The groupId is NOT generated up-front: a group's identity is defined by its composition,\n * so the id is generated lazily in getEvents() and invalidated by every addEvent() call.\n * Reading `group.groupId` before the first getEvents() returns null.\n */\n constructor() {\n this.groupId = null;\n this._events = [];\n }\n\n /**\n * Adds an event to the group.\n * When called without arguments it acts as an alias for `new CollecionesEvent()`,\n * keeping the same familiar contract as building events directly.\n * An existing CollecionesEvent instance may also be passed in.\n *\n * Adding an event changes the composition of the group, so the cached groupId is invalidated\n * — the next getEvents() call will generate a fresh id and re-stamp every event.\n *\n * @param {CollecionesEvent|null} [event=null] - An existing event to register, or null to create a fresh one.\n * @returns {CollecionesEvent} The event that was added.\n * @throws {Error} If a non-null, non-CollecionesEvent value is passed.\n */\n addEvent(event = null) {\n if (event !== null && !(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n const newEvent = event ?? new CollecionesEvent();\n this._events.push(newEvent);\n this.groupId = null;\n return newEvent;\n }\n\n /**\n * Materialises group metadata onto every event and returns the full list.\n * If no groupId is currently set, a new one is generated here. Each event then receives:\n * - meta.eventGroup.id — the groupId of this group\n * - meta.eventGroup.groupClientEventIds — clientEventIds of the sibling events (not self)\n *\n * Safe to call multiple times: idempotent as long as no addEvent() happened in between.\n * After an addEvent() the cached groupId is null, so a subsequent getEvents() will mint a fresh id\n * and re-stamp every event accordingly.\n *\n * Callers may also assign `group.groupId` directly (e.g. with a semantic name) before calling\n * getEvents() to override the auto-generated value; do so AFTER all addEvent() calls,\n * otherwise the next addEvent() will clear the override.\n *\n * @returns {CollecionesEvent[]} A shallow copy of the internal events array with group metadata applied.\n */\n getEvents() {\n if (this.groupId === null) {\n this.groupId = generateId();\n }\n const allClientEventIds = this._events.map(e => e.meta.clientEventId);\n this._events.forEach(event => {\n const peers = allClientEventIds.filter(id => id !== event.meta.clientEventId);\n event.setEventGroup(this.groupId, peers);\n });\n return [...this._events];\n }\n}\n\nexport default CollecionesEventGroup;\n","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n\n /**\n * Dispatches all events in a CollecionesEventGroup.\n * Calls getEvents() to materialise group metadata onto each event,\n * then forwards every individual event to track().\n * @param {CollecionesEventGroup} group - The group to track.\n * @throws {Error} If group does not expose a getEvents() method.\n */\n trackGroup(group) {\n if (typeof group?.getEvents !== 'function') {\n throw new Error('Group must be an instance of CollecionesEventGroup');\n }\n group.getEvents().forEach(event => this.track(event));\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","var constants = {\n 'sharedWindowObjectNames': {\n 'queue': 'compilacionCollecionesClientosGtmQueue',\n 'configVariable': 'compilacionCollecionesClientosGtmTypeCastConfig'\n },\n 'config': {\n 'sourceName': 'jsLibSource',\n 'jsLibUrlVariable': 'jsLibSource_selfHostedUrl',\n 'selfHostedValue': 'SELF',\n 'unpkgHostedValue': 'UNPKG',\n 'flushInterval': 'flushInterval',\n 'flushSize': 'flushSize',\n 'trackerName': 'trackerName',\n 'appName': 'appName',\n 'emitterEndpoint': 'emitterEndpoint',\n 'typeName': 'type'\n },\n 'collecionesObject': 'compilacionCollecionesClientosGtm',\n 'typeCastGtmVariableConfig': 'compilacionCollecionesClientosGtmTypeCastConfig'\n};\n\nexport default constants;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesEventGroup from './CollecionesEventGroup.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport constants from './browser.domainModel.gtm.constants.js';\n\nif (!window[constants.collecionesObject]) {\n window[constants.collecionesObject] = (() => {\n\n let initialized = false;\n let emitter = null;\n let tracker = null;\n const queueWaitInterval = 250;\n let queueWatcherTimer = null;\n let queueWatcherInterval = null;\n let queueReference = null;\n let processedQueueLength = 0;\n\n let init = () => {\n if (initialized) return true;\n if (window[constants.sharedWindowObjectNames.configVariable] === undefined) return false;\n let config = window[constants.sharedWindowObjectNames.configVariable];\n if (config.type === undefined || config.type !== constants.typeCastGtmVariableConfig) return false;\n let flushInterval = config[constants.config.flushInterval];\n let flushSize = config[constants.config.flushSize];\n let trackerName = config[constants.config.trackerName];\n let appName = config[constants.config.appName];\n let emitterEndpoint = config[constants.config.emitterEndpoint] ?? config.endpoint;\n try {\n emitter = new CollecionesEmitter(emitterEndpoint, flushSize, flushInterval);\n tracker = new CollecionesWebTracker([emitter], trackerName, appName);\n initialized = true;\n return true;\n } catch (e) {\n console.error('Error initializing CollecionesEmitter:', e);\n return false;\n }\n }\n\n let track = (arg) => {\n init();\n if (!initialized) return false;\n if (!tracker) return false;\n if (!arg || typeof arg !== 'object') return false;\n\n const normalizeIdentifiers = (identifiers) => {\n if (Array.isArray(identifiers)) {\n return identifiers.flatMap(identifier => {\n if (typeof identifier !== 'object' || identifier === null) {\n return [];\n }\n if (identifier.name !== undefined || identifier.value !== undefined) {\n return [identifier];\n }\n return Object.entries(identifier).map(([name, value]) => ({ name, value }));\n });\n }\n if (!identifiers || typeof identifiers !== 'object') {\n return [];\n }\n return Object.entries(identifiers).map(([name, value]) => ({ name, value }));\n };\n\n const collectionOperators = {\n '==': (left, right) => left == right,\n '===': (left, right) => left === right,\n '!=': (left, right) => left != right,\n '!==': (left, right) => left !== right,\n '>': (left, right) => left > right,\n '>=': (left, right) => left >= right,\n '<': (left, right) => left < right,\n '<=': (left, right) => left <= right,\n 'in': (left, right) => Array.isArray(right) && right.includes(left)\n };\n\n // Small path resolver used by evaluated collections and filters.\n const getByPath = (obj, path) => {\n if (!path || typeof path !== 'string') {\n return undefined;\n }\n return path.split('.').reduce((acc, key) => {\n return (acc && acc[key] !== undefined) ? acc[key] : undefined;\n }, obj);\n };\n\n // Collection items are stored as `{ identifierField: value }` on the event.\n const addCollectionItem = (event, collectionName, identifierName, identifierValue) => {\n if (!collectionName || !identifierName || identifierValue === undefined || identifierValue === null) {\n return;\n }\n const collectionKey = event.setCollectionItem(collectionName);\n event.setCollectionItemReference(collectionName, collectionKey, identifierName, identifierValue);\n };\n\n // ARRAY collections are the simplest form:\n // they are arrays of primitive values that should be copied into the event\n // using the configured identifier field.\n const applyArrayCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.array)) {\n return false;\n }\n const identifierName = collectionConfig.identifierField;\n collectionConfig.array.forEach((value) => {\n if (Array.isArray(value)) {\n value.forEach((nestedValue) => addCollectionItem(event, collectionName, identifierName, nestedValue));\n return;\n }\n addCollectionItem(event, collectionName, identifierName, value);\n });\n return true;\n };\n\n // EVALUATED collections derive their identifier value from a path on each item.\n // An optional filter object narrows the source array before mapping.\n const applyEvaluatedCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.itemsField)) {\n return false;\n }\n\n let items = collectionConfig.itemsField;\n const filter = collectionConfig.filter;\n if (\n filter &&\n typeof filter === 'object' &&\n filter.path &&\n filter.operator &&\n collectionOperators[filter.operator]\n ) {\n items = items.filter((item) => {\n return collectionOperators[filter.operator](getByPath(item, filter.path), filter.value);\n });\n }\n\n const identifierName = collectionConfig.identifierField;\n items.forEach((item) => {\n const identifierValue = getByPath(item, collectionConfig.path) ?? item?.[identifierName] ?? item?.id;\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n // PARAMTABLE rows use dynamic field names that are prefixed by the collection name:\n // e.g. `listingParamTableItemsField` and `listingIdentifierValueParamTable`.\n const applyParamTableCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.table)) {\n return false;\n }\n\n const identifierNameKey = `${collectionName}ParamTableItemsField`;\n const identifierValueKey = `${collectionName}IdentifierValueParamTable`;\n collectionConfig.table.forEach((row) => {\n if (!row || typeof row !== 'object') {\n return;\n }\n const identifierName = row[identifierNameKey];\n const identifierValue = row[identifierValueKey];\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n const applyCollectionConfig = (event, collectionName, collectionConfig) => {\n if (!collectionConfig || typeof collectionConfig !== 'object') {\n return;\n }\n\n if (collectionConfig.type === 'ARRAY') {\n applyArrayCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'EVALUATED') {\n applyEvaluatedCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'PARAMTABLE') {\n applyParamTableCollection(event, collectionName, collectionConfig);\n }\n };\n\n const populateEvent = (eventArg, event) => {\n event.setEntity(eventArg.entity);\n event.setAction(eventArg.action);\n\n normalizeIdentifiers(eventArg.identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || !identifier.value) return;\n event.setIdentifier(identifier.name, identifier.value);\n });\n\n if (eventArg.actor?.entity) {\n event.setActor(eventArg.actor.entity);\n let identifiers = eventArg.actor?.identifiers;\n if (!Array.isArray(identifiers)) {\n identifiers = identifiers?.[eventArg.actor.entity] ?? identifiers;\n }\n normalizeIdentifiers(identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || !identifier.value) return;\n event.setActorIdentifier(identifier.name, identifier.value);\n });\n }\n\n const relations = eventArg?.relations ?? eventArg?.rerelations;\n if (relations && typeof relations === 'object') {\n Object.keys(relations).forEach(relationName => {\n event.setReference(relationName);\n Object.keys(relations[relationName]).forEach(identifierName => {\n event.setReferenceIdentifier(relationName, identifierName, relations[relationName][identifierName]);\n });\n });\n }\n if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {\n Object.keys(eventArg.adjectives).forEach(adjectiveName => {\n event.addAdjective(adjectiveName, eventArg.adjectives[adjectiveName]);\n });\n }\n\n if (eventArg?.collections && typeof eventArg.collections === 'object') {\n Object.keys(eventArg.collections).forEach(collectionName => {\n applyCollectionConfig(event, collectionName, eventArg.collections[collectionName]);\n });\n }\n };\n\n // Group form: payload carries an `events` array (and optionally a semantic `eventGroup` name).\n // Each item is a standalone event spec; they are bundled into a CollecionesEventGroup so that\n // shared group metadata (id + sibling clientEventIds) is materialised onto every event.\n if (Array.isArray(arg.events)) {\n const group = new CollecionesEventGroup();\n let added = 0;\n arg.events.forEach(eventArg => {\n if (!eventArg || typeof eventArg !== 'object') return;\n if (!eventArg.entity || !eventArg.action) return;\n const event = group.addEvent();\n populateEvent(eventArg, event);\n added++;\n });\n if (added === 0) return false;\n // Apply the semantic group name AFTER addEvent calls: each addEvent invalidates\n // group.groupId, so an override set earlier would be cleared by the loop above.\n if (typeof arg.eventGroup === 'string' && arg.eventGroup.length > 0) {\n group.groupId = arg.eventGroup;\n }\n tracker.trackGroup(group);\n return true;\n }\n\n if (!arg.entity || !arg.action) return false;\n const event = new CollecionesEvent();\n populateEvent(arg, event);\n tracker.track(event);\n return true;\n }\n\n let flush = () => {\n if (!init()) {\n return;\n }\n const queue = ensureQueue();\n if (!queue) return;\n\n if (queue !== queueReference) {\n queueReference = queue;\n processedQueueLength = 0;\n }\n\n if (queue.length < processedQueueLength) {\n processedQueueLength = 0;\n }\n\n while (processedQueueLength < queue.length) {\n const args = queue[processedQueueLength];\n processedQueueLength += 1;\n track(args);\n }\n }\n\n let ensureQueue = () => {\n let queue = window[constants.sharedWindowObjectNames.queue];\n if (!Array.isArray(queue)) {\n queueReference = null;\n processedQueueLength = 0;\n return null;\n }\n return queue;\n }\n\n let startQueueWatcher = (interval = queueWaitInterval) => {\n if (queueWatcherInterval === interval && queueWatcherTimer) {\n return;\n }\n if (queueWatcherTimer) {\n clearInterval(queueWatcherTimer);\n }\n queueWatcherInterval = interval;\n queueWatcherTimer = setInterval(() => {\n const queue = ensureQueue();\n if (!queue) {\n return;\n }\n if (queue.length > 0) {\n flush();\n }\n }, interval);\n }\n\n startQueueWatcher(queueWaitInterval);\n\n return {\n flush\n }\n })();\n window[constants.collecionesObject].flush();\n}\n"],"names":["formatToCamelCase","input","replace","trim","split","map","word","index","charAt","toUpperCase","slice","toLowerCase","join","generateId","crypto","randomUUID","c","r","Math","random","toString","CollecionesEvent","constructor","this","entity","adjevtives","identifiers","action","actor","actorIdentifiers","context","references","collections","meta","eventFormat","eventFormatVersion","tracker","app","clientEventId","timestamps","clientDatetimeUtc","Date","toISOString","window","navigator","language","clientDatetimeLocal","now","getTimezoneOffset","timeZone","Intl","DateTimeFormat","resolvedOptions","timeZoneOffset","getEventFormat","v","getEventFormatVersion","overrideDatetime","dateTimeObject","key","value","Object","entries","setTracker","name","setAppName","appName","setSchema","schema","Error","setEntity","setAction","addAdjective","adjective","push","setIdentifier","identifier","setActor","setActorIdentifier","setContext","setRefence","origin","setReference","undefined","setRefenceIdentifier","setReferenceIdentifier","setCollection","items","setCollectionItem","length","setCollectionItemReference","itemKey","setCollectionIdentifier","setEventGroup","groupId","groupClientEventIds","Array","isArray","eventGroup","id","toJSON","class","adjectives","actorIds","fromJSON","obj","instance","CollecionesEmitter","endpoint","flushSize","flushInterval","buffer","timer","lastPayload","startTimer","stopTimer","setInterval","flush","startTimerIfStopped","clearInterval","track","event","trackAsync","Promise","resolve","body","buildBody","response","fetch","method","credentials","headers","ok","console","log","statusText","error","message","JSON","stringify","e","toBase64","str","btoa","unescape","encodeURIComponent","Buffer","from","CollecionesEventGroup","_events","addEvent","newEvent","getEvents","allClientEventIds","forEach","peers","filter","CollecionesTracker","emitters","trackerName","collecionesEvent","element","trackGroup","group","CollecionesWebTracker","super","hasFocus","document","platform","referrer","screenHeight","screen","height","screenWidth","width","timezone","url","location","href","userAgent","viewportHeight","innerHeight","viewportWidth","innerWidth","constants","queue","configVariable","emitterEndpoint","initialized","emitter","queueWatcherTimer","queueWatcherInterval","queueReference","processedQueueLength","init","config","type","arg","normalizeIdentifiers","flatMap","collectionOperators","left","right","in","includes","getByPath","path","reduce","acc","addCollectionItem","collectionName","identifierName","identifierValue","collectionKey","applyCollectionConfig","collectionConfig","table","identifierNameKey","identifierValueKey","row","applyParamTableCollection","itemsField","operator","item","identifierField","applyEvaluatedCollection","array","nestedValue","applyArrayCollection","populateEvent","eventArg","relations","rerelations","keys","relationName","adjectiveName","events","added","ensureQueue","args","interval","startQueueWatcher"],"mappings":"yBASA,MA8CMA,EAAoB,SAASC,GACjC,OAAOA,EACJC,QAAQ,iBAAkB,KAC1BC,OACAC,MAAM,OACNC,IAAI,CAACC,EAAMC,IACI,IAAVA,EAAoBD,EACjBA,EAAKE,OAAO,GAAGC,cAAgBH,EAAKI,MAAM,GAAGC,eAErDC,KAAK,GACV,EAEMC,EAAa,IACO,oBAAXC,QAAuD,mBAAtBA,OAAOC,WACxCD,OAAOC,aAEX,uCAAuCb,QAAQ,QAASc,IAC3D,MAAMC,EAAoB,GAAhBC,KAAKC,SAAgB,EAC/B,OAAc,MAANH,EAAYC,EAAS,EAAJA,EAAU,GAAMG,SAAS,MCvD1D,MAAMC,EAeF,WAAAC,GAEIC,KAAKC,OAAS,GACdD,KAAKE,WAAa,GAClBF,KAAKG,YAAc,CAAA,EACnBH,KAAKI,OAAS,GACdJ,KAAKK,MAAQ,CAAA,EACbL,KAAKM,iBAAmB,CAAA,EACxBN,KAAKO,QAAU,CAAA,EACfP,KAAKQ,WAAa,CAAA,EAClBR,KAAKS,YAAc,CAAA,EAEnBT,KAAKU,KAAO,CACRC,YAAa,mBACbC,mBAAoB,KAExBZ,KAAKU,KAAKG,QAAU,GACpBb,KAAKU,KAAKI,IAAM,GAChBd,KAAKU,KAAKK,cA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AAO6I,GAA6BnE"}
1
+ {"version":3,"file":"browser.domainModel.gtm.min.js","sources":["../src/utils/utils.js","../src/CollecionesEvent.js","../src/CollecionesEmitter.js","../src/CollecionesEventGroup.js","../src/CollecionesTracker.js","../src/CollecionesWebTracker.js","../src/browser.domainModel.gtm.constants.js","../src/browser.domainModel.gtm.js"],"sourcesContent":["// helper 'private' functions\n\n\n/**\n * Encodes a string to Base64.\n * Uses browser or Node.js method depending on environment.\n * @param {string} str\n * @returns {string}\n */\nconst toBase64 = function (str) {\n if (typeof window !== 'undefined' && typeof window.btoa === 'function') {\n return window.btoa(unescape(encodeURIComponent(str)));\n } else {\n return Buffer.from(str, 'utf-8').toString('base64');\n }\n}\n\n/**\n * Decodes a Base64 string to UTF-8.\n * Uses browser or Node.js method depending on environment.\n * @param {string} b64\n * @returns {string}\n */\nconst fromBase64 = function (b64) {\n if (typeof window !== 'undefined' && typeof window.atob === 'function') {\n return decodeURIComponent(escape(window.atob(b64)));\n } else {\n return Buffer.from(b64, 'base64').toString('utf-8');\n }\n}\n\n/**\n * Collects browser-related context values like screen size, language, etc.\n * Returns an empty object if not in browser environment.\n * @returns {Object}\n */\nconst getBrowserContext = function() {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return {};\n }\n return {\n hasFocus: document.hasFocus(),\n language: navigator.language,\n platform: navigator.platform,\n referrer: document.referrer,\n screenHeight: window.screen.height,\n screenWidth: window.screen.width,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,\n url: window.location.href,\n userAgent: navigator.userAgent,\n viewportHeight: window.innerHeight,\n viewportWidth: window.innerWidth,\n };\n}\n\nconst formatToCamelCase = function(input) {\n return input\n .replace(/[^a-zA-Z0-9]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word, index) => {\n if (index === 0) return word;\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join('');\n};\n\nconst generateId = () => {\n if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {\n return crypto.randomUUID();\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {\n const r = Math.random() * 16 | 0;\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);\n });\n};\n\n\nexport {\n fromBase64,\n formatToCamelCase,\n getBrowserContext,\n toBase64,\n generateId,\n};","/**\n * CollecionesEvent\n * -----------------\n * Base class representing a semantically structured event object.\n * Each event models a specific interaction with an entity, optionally performed by an actor,\n * and may reference related entities or include contextual metadata.\n *\n * Key features:\n * - Captures structured semantics: entity, action, actor, context, references\n * - Supports multiple identifiers for both the main entity and the actor\n * - Allows origin tagging for cross-context or cross-application references\n * - Supports referencing collections of entities or grouped data\n * - Includes timestamps and tracker/app metadata for auditability\n * - Fully serializable and deserializable via toJSON/fromJSON\n */\n\nimport {formatToCamelCase, generateId } from './utils/utils.js';\n\nclass CollecionesEvent {\n\n /**\n * Constructs a new CollecionesEvent with default structure and timestamps.\n * Initializes empty containers for semantic attributes such as:\n * - entity: the subject of the event\n * - adjectives: descriptors of the entity\n * - identifiers: identifiers of the entity\n * - action: what happened to the entity\n * - actor: who or what triggered the event (with identifiers in actorIdentifiers)\n * - context: environmental data related to the event\n * - references: external entities involved, optionally scoped by origin\n * - collections: groups of related entities\n * - meta: tracking metadata and timestamps\n */\n constructor() {\n // initialize event properties\n this.entity = '';\n this.adjevtives = [];\n this.identifiers = {};\n this.action = '';\n this.actor = {};\n this.actorIdentifiers = {};\n this.context = {};\n this.references = {};\n this.collections = {};\n // set default values\n this.meta = {\n eventFormat: 'CollecionesEvent',\n eventFormatVersion: '1'\n };\n this.meta.tracker = '';\n this.meta.app = '';\n this.meta.clientEventId = generateId();\n this.meta.timestamps = {};\n this.meta.timestamps.clientDatetimeUtc = new Date().toISOString();\n if (typeof window !== 'undefined' && typeof navigator !== 'undefined' && navigator.language) {\n this.meta.timestamps.clientDatetimeLocal = new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString();\n this.meta.timestamps.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;\n this.meta.timestamps.timeZoneOffset = new Date().getTimezoneOffset()\n } else {\n this.meta.timestamps.clientDatetimeLocal = new Date().toISOString();\n this.meta.timestamps.timeZone = 'UTC';\n }\n }\n\n /**\n * Returns the declared event format.\n * @returns {string} The format name (e.g. 'CollecionesEvent').\n */\n getEventFormat() {\n let v = this.meta?.eventFormat;\n return (typeof v !== 'undefined') ? v : '1';\n }\n\n /**\n * Returns the version of the event format.\n * @returns {string} The format version string.\n */\n getEventFormatVersion() {\n let v = this?.meta?.eventFormatVersion;\n return (typeof v !== 'undefined') ? v : 'CollecionesEvent';\n }\n\n /**\n * Overrides or supplements the event's timestamp fields with custom values.\n * @param {object} dateTimeObject - Key-value pairs to merge into the existing timestamp object.\n */\n overrideDatetime(dateTimeObject = {}) {\n for (const [key, value] of Object.entries(dateTimeObject)) {\n this.meta.timestamps[key] = value;\n }\n }\n\n /**\n * Sets the name of the tracker responsible for generating this event.\n * @param {string} name - Tracker name.\n */\n setTracker(name) {\n this.meta.tracker = name;\n }\n\n /**\n * Sets the name of the application that generated the event.\n * @param {string} name - Application name.\n */\n setAppName(name) {\n this.meta.appName = name;\n }\n\n /**\n * Sets the expected schema name for this event.\n * @param {string} schema - The name of the schema.\n */\n setSchema(schema) {\n if (typeof schema !== 'string') {\n throw new Error('Schema must be a string');\n }\n this.meta.schema = schema;\n }\n\n /**\n * Sets the entity (subject) of the event.\n * @param {string} entity - The entity name.\n */\n setEntity = function(entity) {\n this.entity = formatToCamelCase(entity);\n }\n \n /**\n * Defines the main action of the event (e.g., 'clicked').\n * @param {string} action - The action string.\n */\n setAction = function(action) {\n this.action = formatToCamelCase(action);\n }\n\n /**\n * Adds an adjective that describes the entity in more detail.\n * @param {string} adjective - An adjective string.\n */\n addAdjective = function(adjective) {\n if (typeof adjective !== 'string') {\n throw new Error('Adjective must be a string');\n }\n this.adjevtives.push(formatToCamelCase(adjective));\n }\n\n /**\n * Adds or updates an identifier for the primary entity.\n * Identifiers allow multiple keys to uniquely identify the entity.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n */\n setIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Identifier name must be a string');\n }\n this.identifiers[name] = identifier;\n }\n\n /**\n * Defines the name of the actor (who or what performed the action).\n * @param {string} name - Actor name (e.g., 'user', 'system').\n */\n setActor = function(name) {\n if (typeof name !== 'string') {\n throw new Error('Actor name must be a string');\n }\n this.actor.name = name;\n }\n\n /**\n * Adds or updates an identifier for the actor.\n * Supports multiple identifiers to uniquely identify the actor.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setActorIdentifier = function(name, identifier) {\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.actorIdentifiers[name] = identifier;\n }\n\n /**\n * Adds contextual information to the event.\n * Context can include any additional environmental or situational data.\n * @param {string} context - The key of the context field.\n * @param {*} value - The value of the context field.\n */\n setContext = function(context, value) {\n if (typeof context !== 'string') {\n throw new Error('Context must be a string');\n }\n this.context[context] = value;\n }\n\n /**\n * Alias for `setReference` for compatibility.\n * Declares an external entity referenced by this event.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setRefence = function(entity, origin=null) {\n return this.setReference(entity, origin);\n }\n\n /**\n * Declares an entity referenced by this event.\n * References may include multiple identifiers and an optional origin to scope the reference.\n * @param {string} entity - The referenced entity name.\n * @param {string|null} origin - The origin application or context (optional).\n */\n setReference = function(entity, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity must be a string');\n }\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.references[entity] === undefined) {\n this.references[entity] = {\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * Ensures the reference is declared and sets the identifier under that reference.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setRefenceIdentifier = function(entity, name, identifier, origin=null) {\n return this.setReferenceIdentifier(entity, name, identifier, origin);\n }\n\n /**\n * Adds or updates an identifier for a referenced entity.\n * @param {string} entity - The referenced entity name.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @param {string|null} origin - Optional origin context.\n */\n setReferenceIdentifier = function(entity, name, identifier, origin=null) {\n if (typeof entity !== 'string') {\n throw new Error('Referenced entity name must be a string');\n }\n if (typeof name !== 'string') {\n throw new Error('Actor Identifier name must be a string');\n }\n this.setRefence(entity, origin);\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.references[entity].identifiers[name] = identifier;\n }\n\n /**\n * Declares a collection of related entities for this event.\n * Collections group multiple related items and may include identifiers and origin metadata.\n * @param {string} entity - The collection name.\n * @param {string|null} origin - Optional origin identifier (e.g. system name).\n */\n setCollection = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {\n items: [],\n identifiers: {},\n origin\n };\n }\n }\n\n /**\n * Adds a new item to a collection and returns its index key.\n * Items represent individual elements within the collection.\n * @param {string} entity - The name of the collection.\n * @returns {number} Index of the newly added item in the collection.\n */\n setCollectionItem = function(entity, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n this.collections[entity].items.push({});\n let itemKey = this.collections[entity].items.length - 1;\n return itemKey;\n }\n\n /**\n * Assigns a reference (identifier) to a specific item in a collection.\n * Useful for tagging individual collection elements with identifiers.\n * @param {string} entity - Collection name.\n * @param {number} itemKey - The index of the item in the collection.\n * @param {string} name - The identifier key.\n * @param {*} identifier - The identifier value.\n * @throws {Error} If the item does not exist at the given index.\n */\n setCollectionItemReference = function(entity, itemKey, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n this.setCollection(entity);\n if(typeof this.collections[entity].items[itemKey] !== 'object') {\n throw new Error('bad bad man, the collection key does not exists');\n }\n this.collections[entity].items[itemKey][name] = identifier;\n }\n \n /**\n * Sets a static identifier that applies to the entire collection.\n * These identifiers describe the collection as a whole.\n * @param {string} entity - Collection name.\n * @param {string} name - Identifier key.\n * @param {*} identifier - Identifier value.\n */\n setCollectionIdentifier = function(entity, name, identifier, origin=null) {\n entity = formatToCamelCase(entity);\n if (origin !== null) {\n entity = `${origin}.${entity}`;\n }\n if(this.collections[entity] == undefined) {\n this.collections[entity] = {};\n }\n this.collections[entity].identifiers[name] = identifier;\n }\n\n /**\n * Sets the event group metadata on this event.\n * Called by CollecionesEventGroup.getEvents() to inject group membership.\n * @param {string} groupId - The shared group id for all events in the occurrence.\n * @param {string[]} groupClientEventIds - The clientEventIds of the other events in the group.\n */\n setEventGroup(groupId, groupClientEventIds) {\n if (typeof groupId !== 'string') {\n throw new Error('groupId must be a string');\n }\n if (!Array.isArray(groupClientEventIds)) {\n throw new Error('groupClientEventIds must be an array');\n }\n this.meta.eventGroup = {\n id: groupId,\n groupClientEventIds: [...groupClientEventIds]\n };\n }\n\n /**\n * Serializes the event instance to a plain object suitable for transport or storage.\n * The output includes all semantic fields and metadata.\n * @returns {object} A plain JavaScript object representing the event.\n */\n toJSON() {\n return {\n class: 'CollecionesEvent',\n entity: this.entity,\n adjectives: this.adjevtives,\n identifiers: this.identifiers,\n action: this.action,\n actor: this.actor,\n actorIdentifiers: this.actorIdentifiers,\n actorIds: this.actorIds,\n context: this.context,\n references: this.references,\n meta: this.meta,\n collections: this.collections\n };\n }\n\n /**\n * Recreates a CollecionesEvent instance from a plain object.\n * Used when deserializing events from storage or network transport.\n * @param {object} obj - The input object containing event data.\n * @returns {CollecionesEvent} A rehydrated event instance.\n * @throws {Error} If the class type is not 'CollecionesEvent'.\n */\n static fromJSON(obj) { \n if (!obj || obj.class !== 'CollecionesEvent') {\n throw new Error('Invalid or missing event class type'); \n } \n const instance = new CollecionesEvent();\n instance.entity = obj.entity;\n instance.adjevtives = obj.adjectives || [];\n instance.identifiers = obj.identifiers || {};\n instance.action = obj.action;\n instance.actor = obj.actor;\n instance.actorIdentifiers = obj.actorIdentifiers;\n instance.actorIds = obj.actorIds;\n instance.context = obj.context || {};\n instance.references = obj.references || {};\n instance.meta = obj.meta || {};\n instance.collections = obj.collections || {};\n return instance;\n }\n \n}\n\nexport default CollecionesEvent;","import { fromBase64, toBase64 } from './utils/utils.js';\nimport CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * CollecionesEmitter\n * -------------------\n * This class collects and sends event objects to a remote endpoint (e.g., an event collector API).\n * It is used in both client- and server-side tracking scenarios, typically in combination with\n * CollecionesEvent or subclasses like CollecionesBaseEvent.\n *\n * Behavior:\n * - Events are buffered via `.track()` or `.trackAsync()`.\n * - If the number of buffered events reaches `flushSize`, the buffer is automatically flushed.\n * - If `flushInterval` is provided, the buffer is flushed at a fixed interval.\n * - Flushing serializes each event using `.toJSON()`, encodes it with base64, and posts\n * the resulting array to the configured endpoint.\n *\n * Example usage:\n * const emitter = new CollecionesEmitter('/track', 5, 10000);\n * emitter.track(new CollecionesEvent());\n *\n * Note:\n * This class is stateful. To stop periodic flushing, call `.stopTimer()` when the emitter is no longer in use.\n */\nclass CollecionesEmitter {\n\n /**\n * Initializes the emitter with buffering settings.\n * @param {string} [endpoint='/collect'] - The URL to send events to.\n * @param {number} [flushSize=10] - Number of events to buffer before flushing.\n * @param {number|boolean} [flushInterval=false] - Time in ms to flush events periodically.\n */\n constructor(endpoint = '/collect', flushSize = 10, flushInterval = false) {\n this.endpoint = endpoint;\n this.flushInterval = flushInterval;\n this.flushSize = flushSize;\n this.buffer = [];\n this.timer = null;\n this.lastPayload = null;\n }\n\n /**\n * Starts the flush timer if a valid interval is set.\n * @returns {void}\n */\n startTimer() {\n this.stopTimer();\n if (typeof this.flushInterval == 'number' && this.flushInterval > 0) {\n this.timer = setInterval(() => this.flush(), this.flushInterval);\n }\n }\n\n /**\n * Starts the flush timer only if not already running.\n * @returns {void}\n */\n startTimerIfStopped() {\n if (!this.timer) {\n this.startTimer();\n }\n }\n\n /**\n * Stops the active flush timer.\n * @returns {void}\n */\n stopTimer() {\n if (this.timer) {\n clearInterval(this.timer);\n }\n this.timer = null;\n }\n\n /**\n * Adds an event to the buffer and flushes if threshold is reached.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {void}\n */\n track(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.trackAsync(event);\n }\n\n /**\n * Asynchronously adds an event and flushes if the buffer size is exceeded.\n * Validates that the event is an instance of CollecionesEvent to ensure correct event type.\n * @param {CollecionesEvent} event - Event instance to be tracked asynchronously.\n * @throws {Error} Throws if event is not a CollecionesEvent instance.\n * @returns {Promise<void>} Resolves when event is added and flush triggered if needed.\n */\n async trackAsync(event) {\n if (!(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n this.startTimerIfStopped();\n this.buffer.push(event);\n return (this.buffer.length >= this.flushSize || !this.flushInterval || this.flushInterval < 1) ? this.flush() : Promise.resolve();\n }\n\n /**\n * Sends all buffered events in a single POST request to the server.\n * Each event is serialized via `.toJSON()` and encoded as a base64 string.\n * Response status is checked for HTTP success; errors are logged but not thrown.\n *\n * @returns {Promise<boolean|undefined>} Resolves true if flush was triggered, or undefined if buffer was empty.\n */\n async flush() {\n if (this.buffer.length === 0) return;\n this.stopTimer();\n const body = this.buildBody();\n this.lastPayload = body;\n this.buffer = [];\n try {\n const response = await fetch(this.endpoint, {\n method: 'POST',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json'\n },\n body\n });\n if (!response.ok) {\n console.log(`Failed to send events: ${response.statusText}`);\n }\n return true;\n } catch (error) { \n console.log(`Network error sending events: ${error.message}`);\n } \n }\n\n /**\n * Builds a POST-ready payload from the current buffer, without clearing it.\n * @returns {string} JSON string of base64-encoded serialized events.\n */\n buildBody() {\n return JSON.stringify(this.buffer.map(e => toBase64(JSON.stringify(e.toJSON()))));\n }\n\n}\n\nexport default CollecionesEmitter;","/**\n * CollecionesEventGroup\n * ----------------------\n * A client-side grouping interface for events that belong to the same business occurrence.\n *\n * Design principles:\n * - A group is purely a build-time construct; it does not change the wire format.\n * - Each event in the group remains a standalone CollecionesEvent.\n * - When getEvents() is called, group metadata is materialised onto each event:\n * meta.eventGroup.id — the shared group id\n * meta.eventGroup.groupClientEventIds — clientEventIds of all other events in the group\n * - Semantic meaning of the relations between events is intentionally left to the domain model.\n *\n * Usage:\n * const group = new CollecionesEventGroup();\n *\n * const eventA = group.addEvent();\n * eventA.setEntity('listing');\n * eventA.setAction('viewed');\n *\n * const eventB = group.addEvent();\n * eventB.setEntity('session');\n * eventB.setAction('active');\n *\n * tracker.trackGroup(group);\n */\n\nimport CollecionesEvent from './CollecionesEvent.js';\nimport { generateId } from './utils/utils.js';\n\nclass CollecionesEventGroup {\n\n /**\n * Creates a new event group.\n * The groupId is NOT generated up-front: a group's identity is defined by its composition,\n * so the id is generated lazily in getEvents() and invalidated by every addEvent() call.\n * Reading `group.groupId` before the first getEvents() returns null.\n */\n constructor() {\n this.groupId = null;\n this._events = [];\n }\n\n /**\n * Adds an event to the group.\n * When called without arguments it acts as an alias for `new CollecionesEvent()`,\n * keeping the same familiar contract as building events directly.\n * An existing CollecionesEvent instance may also be passed in.\n *\n * Adding an event changes the composition of the group, so the cached groupId is invalidated\n * — the next getEvents() call will generate a fresh id and re-stamp every event.\n *\n * @param {CollecionesEvent|null} [event=null] - An existing event to register, or null to create a fresh one.\n * @returns {CollecionesEvent} The event that was added.\n * @throws {Error} If a non-null, non-CollecionesEvent value is passed.\n */\n addEvent(event = null) {\n if (event !== null && !(event instanceof CollecionesEvent)) {\n throw new Error('Event must be an instance of CollecionesEvent');\n }\n const newEvent = event ?? new CollecionesEvent();\n this._events.push(newEvent);\n this.groupId = null;\n return newEvent;\n }\n\n /**\n * Materialises group metadata onto every event and returns the full list.\n * If no groupId is currently set, a new one is generated here. Each event then receives:\n * - meta.eventGroup.id — the groupId of this group\n * - meta.eventGroup.groupClientEventIds — clientEventIds of the sibling events (not self)\n *\n * Safe to call multiple times: idempotent as long as no addEvent() happened in between.\n * After an addEvent() the cached groupId is null, so a subsequent getEvents() will mint a fresh id\n * and re-stamp every event accordingly.\n *\n * Callers may also assign `group.groupId` directly (e.g. with a semantic name) before calling\n * getEvents() to override the auto-generated value; do so AFTER all addEvent() calls,\n * otherwise the next addEvent() will clear the override.\n *\n * @returns {CollecionesEvent[]} A shallow copy of the internal events array with group metadata applied.\n */\n getEvents() {\n if (this.groupId === null) {\n this.groupId = generateId();\n }\n const allClientEventIds = this._events.map(e => e.meta.clientEventId);\n this._events.forEach(event => {\n const peers = allClientEventIds.filter(id => id !== event.meta.clientEventId);\n event.setEventGroup(this.groupId, peers);\n });\n return [...this._events];\n }\n}\n\nexport default CollecionesEventGroup;\n","import CollecionesEvent from './CollecionesEvent.js';\n\n/**\n * Tracks events by enriching them with shared identifiers and routing through configured emitters.\n */\nclass CollecionesTracker {\n\n /**\n * Constructs a new tracker instance.\n * @param {Array} emitters - Array of emitter instances responsible for sending events.\n * @param {string} trackerName - Name identifying this tracker.\n * @param {string} appName - Name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n this.emitters = emitters;\n this.trackerName = trackerName;\n this.appName = appName;\n }\n\n /**\n * Sends an event to all emitters after enriching it with identifiers and metadata.\n * @param {CollecionesEvent} collecionesEvent - The event to be sent.\n * @throws {Error} If the input is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setTracker(this.trackerName);\n collecionesEvent.setAppName(this.appName); \n this.emitters.forEach(element => {\n element.track(collecionesEvent, this.trackerName, this.appName);\n });\n }\n\n /**\n * Dispatches all events in a CollecionesEventGroup.\n * Calls getEvents() to materialise group metadata onto each event,\n * then forwards every individual event to track().\n * @param {CollecionesEventGroup} group - The group to track.\n * @throws {Error} If group does not expose a getEvents() method.\n */\n trackGroup(group) {\n if (typeof group?.getEvents !== 'function') {\n throw new Error('Group must be an instance of CollecionesEventGroup');\n }\n group.getEvents().forEach(event => this.track(event));\n }\n}\n\nexport default CollecionesTracker;","import CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesTracker from './CollecionesTracker.js';\nimport { getBrowserContext } from './utils/utils.js';\n\n/**\n * Web-specific tracker that enriches events with browser context before sending them.\n * Extends the base CollecionesTracker.\n */\nclass CollecionesWebTracker extends CollecionesTracker {\n /**\n * Creates a new instance of CollecionesWebTracker.\n * @param {Array} emitters - A list of emitter instances used to send the event.\n * @param {string} trackerName - The name of the tracker.\n * @param {string} appName - The name of the application generating events.\n */\n constructor(emitters, trackerName, appName) {\n super(emitters, trackerName, appName);\n }\n\n /**\n * Tracks an event, enriching it with browser context information.\n * @param {CollecionesEvent} collecionesEvent - The event object to track.\n * @throws {Error} If the event is not an instance of CollecionesEvent.\n */\n track(collecionesEvent) {\n if (!(collecionesEvent instanceof CollecionesEvent)) {\n throw new Error('Event must be of type CollecionesEvent');\n }\n collecionesEvent.setContext('browserContext', getBrowserContext());\n super.track(collecionesEvent); \n }\n}\n\nexport default CollecionesWebTracker;","var constants = {\n 'sharedWindowObjectNames': {\n 'queue': 'compilacionCollecionesClientosGtmQueue',\n 'configVariable': 'compilacionCollecionesClientosGtmTypeCastConfig'\n },\n 'config': {\n 'sourceName': 'jsLibSource',\n 'jsLibUrlVariable': 'jsLibSource_selfHostedUrl',\n 'selfHostedValue': 'SELF',\n 'unpkgHostedValue': 'UNPKG',\n 'flushInterval': 'flushInterval',\n 'flushSize': 'flushSize',\n 'trackerName': 'trackerName',\n 'appName': 'appName',\n 'emitterEndpoint': 'emitterEndpoint',\n 'typeName': 'type'\n },\n 'collecionesObject': 'compilacionCollecionesClientosGtm',\n 'typeCastGtmVariableConfig': 'compilacionCollecionesClientosGtmTypeCastConfig'\n};\n\nexport default constants;","import CollecionesEmitter from './CollecionesEmitter.js';\nimport CollecionesEvent from './CollecionesEvent.js';\nimport CollecionesEventGroup from './CollecionesEventGroup.js';\nimport CollecionesWebTracker from './CollecionesWebTracker.js';\nimport constants from './browser.domainModel.gtm.constants.js';\n\nif (!window[constants.collecionesObject]) {\n window[constants.collecionesObject] = (() => {\n\n let initialized = false;\n let emitter = null;\n let tracker = null;\n const queueWaitInterval = 250;\n let queueWatcherTimer = null;\n let queueWatcherInterval = null;\n let queueReference = null;\n let processedQueueLength = 0;\n\n let init = () => {\n if (initialized) return true;\n if (window[constants.sharedWindowObjectNames.configVariable] === undefined) return false;\n let config = window[constants.sharedWindowObjectNames.configVariable];\n if (config.type === undefined || config.type !== constants.typeCastGtmVariableConfig) return false;\n let flushInterval = config[constants.config.flushInterval];\n let flushSize = config[constants.config.flushSize];\n let trackerName = config[constants.config.trackerName];\n let appName = config[constants.config.appName];\n let emitterEndpoint = config[constants.config.emitterEndpoint] ?? config.endpoint;\n try {\n emitter = new CollecionesEmitter(emitterEndpoint, flushSize, flushInterval);\n tracker = new CollecionesWebTracker([emitter], trackerName, appName);\n initialized = true;\n return true;\n } catch (e) {\n console.error('Error initializing CollecionesEmitter:', e);\n return false;\n }\n }\n\n let track = (arg) => {\n init();\n if (!initialized) return false;\n if (!tracker) return false;\n if (!arg || typeof arg !== 'object') return false;\n\n // GTM variables can resolve to numbers/booleans or be left empty. Coerce\n // entity/action/actor names to a string so a mistyped or empty config value\n // cannot throw inside CollecionesEvent (formatToCamelCase) and drop the event.\n const toEventName = (value) => {\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n return '';\n };\n\n const normalizeIdentifiers = (identifiers) => {\n if (Array.isArray(identifiers)) {\n return identifiers.flatMap(identifier => {\n if (typeof identifier !== 'object' || identifier === null) {\n return [];\n }\n if (identifier.name !== undefined || identifier.value !== undefined) {\n return [identifier];\n }\n return Object.entries(identifier).map(([name, value]) => ({ name, value }));\n });\n }\n if (!identifiers || typeof identifiers !== 'object') {\n return [];\n }\n return Object.entries(identifiers).map(([name, value]) => ({ name, value }));\n };\n\n const collectionOperators = {\n '==': (left, right) => left == right,\n '===': (left, right) => left === right,\n '!=': (left, right) => left != right,\n '!==': (left, right) => left !== right,\n '>': (left, right) => left > right,\n '>=': (left, right) => left >= right,\n '<': (left, right) => left < right,\n '<=': (left, right) => left <= right,\n 'in': (left, right) => Array.isArray(right) && right.includes(left)\n };\n\n // Small path resolver used by evaluated collections and filters.\n const getByPath = (obj, path) => {\n if (!path || typeof path !== 'string') {\n return undefined;\n }\n return path.split('.').reduce((acc, key) => {\n return (acc && acc[key] !== undefined) ? acc[key] : undefined;\n }, obj);\n };\n\n // Collection items are stored as `{ identifierField: value }` on the event.\n const addCollectionItem = (event, collectionName, identifierName, identifierValue) => {\n if (!collectionName || !identifierName || identifierValue === undefined || identifierValue === null) {\n return;\n }\n const collectionKey = event.setCollectionItem(collectionName);\n event.setCollectionItemReference(collectionName, collectionKey, identifierName, identifierValue);\n };\n\n // ARRAY collections are the simplest form:\n // they are arrays of primitive values that should be copied into the event\n // using the configured identifier field.\n const applyArrayCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.array)) {\n return false;\n }\n const identifierName = collectionConfig.identifierField;\n collectionConfig.array.forEach((value) => {\n if (Array.isArray(value)) {\n value.forEach((nestedValue) => addCollectionItem(event, collectionName, identifierName, nestedValue));\n return;\n }\n addCollectionItem(event, collectionName, identifierName, value);\n });\n return true;\n };\n\n // EVALUATED collections derive their identifier value from a path on each item.\n // An optional filter object narrows the source array before mapping.\n const applyEvaluatedCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.itemsField)) {\n return false;\n }\n\n let items = collectionConfig.itemsField;\n const filter = collectionConfig.filter;\n if (\n filter &&\n typeof filter === 'object' &&\n filter.path &&\n filter.operator &&\n collectionOperators[filter.operator]\n ) {\n items = items.filter((item) => {\n return collectionOperators[filter.operator](getByPath(item, filter.path), filter.value);\n });\n }\n\n const identifierName = collectionConfig.identifierField;\n items.forEach((item) => {\n const identifierValue = getByPath(item, collectionConfig.path) ?? item?.[identifierName] ?? item?.id;\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n // PARAMTABLE rows use dynamic field names that are prefixed by the collection name:\n // e.g. `listingParamTableItemsField` and `listingIdentifierValueParamTable`.\n const applyParamTableCollection = (event, collectionName, collectionConfig) => {\n if (!Array.isArray(collectionConfig.table)) {\n return false;\n }\n\n const identifierNameKey = `${collectionName}ParamTableItemsField`;\n const identifierValueKey = `${collectionName}IdentifierValueParamTable`;\n collectionConfig.table.forEach((row) => {\n if (!row || typeof row !== 'object') {\n return;\n }\n const identifierName = row[identifierNameKey];\n const identifierValue = row[identifierValueKey];\n addCollectionItem(event, collectionName, identifierName, identifierValue);\n });\n return true;\n };\n\n const applyCollectionConfig = (event, collectionName, collectionConfig) => {\n if (!collectionConfig || typeof collectionConfig !== 'object') {\n return;\n }\n\n if (collectionConfig.type === 'ARRAY') {\n applyArrayCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'EVALUATED') {\n applyEvaluatedCollection(event, collectionName, collectionConfig);\n return;\n }\n if (collectionConfig.type === 'PARAMTABLE') {\n applyParamTableCollection(event, collectionName, collectionConfig);\n }\n };\n\n const populateEvent = (eventArg, event) => {\n event.setEntity(toEventName(eventArg.entity));\n event.setAction(toEventName(eventArg.action));\n\n normalizeIdentifiers(eventArg.identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n // Reject only an absent name or a null/undefined value; falsy-but-valid\n // values such as 0 or '' must still be kept (matches addCollectionItem).\n if (!identifier.name || identifier.value == null) return;\n event.setIdentifier(identifier.name, identifier.value);\n });\n\n const actorName = toEventName(eventArg.actor?.entity ?? eventArg.actor?.name);\n if (actorName) {\n event.setActor(actorName);\n let identifiers = eventArg.actor?.identifiers;\n if (!Array.isArray(identifiers)) {\n identifiers = identifiers?.[actorName] ?? identifiers;\n }\n normalizeIdentifiers(identifiers).forEach(identifier => {\n if (typeof identifier !== 'object' || identifier === null) return;\n if (!identifier.name || identifier.value == null) return;\n event.setActorIdentifier(identifier.name, identifier.value);\n });\n }\n\n const relations = eventArg?.relations ?? eventArg?.rerelations;\n if (relations && typeof relations === 'object') {\n Object.keys(relations).forEach(relationName => {\n const relationIdentifiers = relations[relationName];\n event.setReference(relationName);\n // A relation can be declared while its identifier object is left empty\n // (an unfilled GTM variable resolves to undefined/null). Guard against\n // non-object values so Object.keys cannot throw and drop the event.\n if (relationIdentifiers && typeof relationIdentifiers === 'object') {\n Object.keys(relationIdentifiers).forEach(identifierName => {\n event.setReferenceIdentifier(relationName, identifierName, relationIdentifiers[identifierName]);\n });\n }\n });\n }\n // Adjectives may arrive as an array of values or as an object keyed by adjective.\n if (Array.isArray(eventArg?.adjectives)) {\n eventArg.adjectives.forEach(adjective => {\n if (typeof adjective === 'string' && adjective.length > 0) {\n event.addAdjective(adjective);\n }\n });\n } else if (eventArg?.adjectives && typeof eventArg.adjectives === 'object') {\n Object.keys(eventArg.adjectives).forEach(adjectiveName => {\n if (adjectiveName.length > 0) {\n event.addAdjective(adjectiveName);\n }\n });\n }\n\n if (eventArg?.collections && typeof eventArg.collections === 'object') {\n Object.keys(eventArg.collections).forEach(collectionName => {\n applyCollectionConfig(event, collectionName, eventArg.collections[collectionName]);\n });\n }\n };\n\n // Group form: payload carries an `events` array (and optionally a semantic `eventGroup` name).\n // Each item is a standalone event spec; they are bundled into a CollecionesEventGroup so that\n // shared group metadata (id + sibling clientEventIds) is materialised onto every event.\n if (Array.isArray(arg.events)) {\n const group = new CollecionesEventGroup();\n let added = 0;\n arg.events.forEach(eventArg => {\n if (!eventArg || typeof eventArg !== 'object') return;\n if (!toEventName(eventArg.entity) || !toEventName(eventArg.action)) return;\n // Build the event before registering it so a single malformed event cannot\n // throw and take the whole group (including its valid siblings) down with it.\n try {\n const event = new CollecionesEvent();\n populateEvent(eventArg, event);\n group.addEvent(event);\n added++;\n } catch (e) {\n console.error('Colleciones: skipped malformed grouped event', e);\n }\n });\n if (added === 0) return false;\n // Apply the semantic group name AFTER addEvent calls: each addEvent invalidates\n // group.groupId, so an override set earlier would be cleared by the loop above.\n if (typeof arg.eventGroup === 'string' && arg.eventGroup.length > 0) {\n group.groupId = arg.eventGroup;\n }\n tracker.trackGroup(group);\n return true;\n }\n\n if (!toEventName(arg.entity) || !toEventName(arg.action)) return false;\n const event = new CollecionesEvent();\n populateEvent(arg, event);\n tracker.track(event);\n return true;\n }\n\n let flush = () => {\n if (!init()) {\n return;\n }\n const queue = ensureQueue();\n if (!queue) return;\n\n if (queue !== queueReference) {\n queueReference = queue;\n processedQueueLength = 0;\n }\n\n if (queue.length < processedQueueLength) {\n processedQueueLength = 0;\n }\n\n while (processedQueueLength < queue.length) {\n const args = queue[processedQueueLength];\n processedQueueLength += 1;\n // Never let one bad queue entry abort the flush loop: the index has already\n // advanced, so an uncaught throw here would permanently skip the rest of the batch.\n try {\n track(args);\n } catch (e) {\n console.error('Colleciones: failed to process queued event', e);\n }\n }\n }\n\n let ensureQueue = () => {\n let queue = window[constants.sharedWindowObjectNames.queue];\n if (!Array.isArray(queue)) {\n queueReference = null;\n processedQueueLength = 0;\n return null;\n }\n return queue;\n }\n\n let startQueueWatcher = (interval = queueWaitInterval) => {\n if (queueWatcherInterval === interval && queueWatcherTimer) {\n return;\n }\n if (queueWatcherTimer) {\n clearInterval(queueWatcherTimer);\n }\n queueWatcherInterval = interval;\n queueWatcherTimer = setInterval(() => {\n const queue = ensureQueue();\n if (!queue) {\n return;\n }\n if (queue.length > 0) {\n flush();\n }\n }, interval);\n }\n\n startQueueWatcher(queueWaitInterval);\n\n return {\n flush\n }\n })();\n window[constants.collecionesObject].flush();\n}\n"],"names":["formatToCamelCase","input","replace","trim","split","map","word","index","charAt","toUpperCase","slice","toLowerCase","join","generateId","crypto","randomUUID","c","r","Math","random","toString","CollecionesEvent","constructor","this","entity","adjevtives","identifiers","action","actor","actorIdentifiers","context","references","collections","meta","eventFormat","eventFormatVersion","tracker","app","clientEventId","timestamps","clientDatetimeUtc","Date","toISOString","window","navigator","language","clientDatetimeLocal","now","getTimezoneOffset","timeZone","Intl","DateTimeFormat","resolvedOptions","timeZoneOffset","getEventFormat","v","getEventFormatVersion","overrideDatetime","dateTimeObject","key","value","Object","entries","setTracker","name","setAppName","appName","setSchema","schema","Error","setEntity","setAction","addAdjective","adjective","push","setIdentifier","identifier","setActor","setActorIdentifier","setContext","setRefence","origin","setReference","undefined","setRefenceIdentifier","setReferenceIdentifier","setCollection","items","setCollectionItem","length","setCollectionItemReference","itemKey","setCollectionIdentifier","setEventGroup","groupId","groupClientEventIds","Array","isArray","eventGroup","id","toJSON","class","adjectives","actorIds","fromJSON","obj","instance","CollecionesEmitter","endpoint","flushSize","flushInterval","buffer","timer","lastPayload","startTimer","stopTimer","setInterval","flush","startTimerIfStopped","clearInterval","track","event","trackAsync","Promise","resolve","body","buildBody","response","fetch","method","credentials","headers","ok","console","log","statusText","error","message","JSON","stringify","e","toBase64","str","btoa","unescape","encodeURIComponent","Buffer","from","CollecionesEventGroup","_events","addEvent","newEvent","getEvents","allClientEventIds","forEach","peers","filter","CollecionesTracker","emitters","trackerName","collecionesEvent","element","trackGroup","group","CollecionesWebTracker","super","hasFocus","document","platform","referrer","screenHeight","screen","height","screenWidth","width","timezone","url","location","href","userAgent","viewportHeight","innerHeight","viewportWidth","innerWidth","constants","queue","configVariable","emitterEndpoint","initialized","emitter","queueWatcherTimer","queueWatcherInterval","queueReference","processedQueueLength","init","config","type","arg","toEventName","String","normalizeIdentifiers","flatMap","collectionOperators","left","right","in","includes","getByPath","path","reduce","acc","addCollectionItem","collectionName","identifierName","identifierValue","collectionKey","applyCollectionConfig","collectionConfig","table","identifierNameKey","identifierValueKey","row","applyParamTableCollection","itemsField","operator","item","identifierField","applyEvaluatedCollection","array","nestedValue","applyArrayCollection","populateEvent","eventArg","actorName","relations","rerelations","keys","relationName","relationIdentifiers","adjectiveName","events","added","ensureQueue","args","interval","startQueueWatcher"],"mappings":"yBASA,MA8CMA,EAAoB,SAASC,GACjC,OAAOA,EACJC,QAAQ,iBAAkB,KAC1BC,OACAC,MAAM,OACNC,IAAI,CAACC,EAAMC,IACI,IAAVA,EAAoBD,EACjBA,EAAKE,OAAO,GAAGC,cAAgBH,EAAKI,MAAM,GAAGC,eAErDC,KAAK,GACV,EAEMC,EAAa,IACO,oBAAXC,QAAuD,mBAAtBA,OAAOC,WACxCD,OAAOC,aAEX,uCAAuCb,QAAQ,QAASc,IAC3D,MAAMC,EAAoB,GAAhBC,KAAKC,SAAgB,EAC/B,OAAc,MAANH,EAAYC,EAAS,EAAJA,EAAU,GAAMG,SAAS,MCvD1D,MAAMC,EAeF,WAAAC,GAEIC,KAAKC,OAAS,GACdD,KAAKE,WAAa,GAClBF,KAAKG,YAAc,CAAA,EACnBH,KAAKI,OAAS,GACdJ,KAAKK,MAAQ,CAAA,EACbL,KAAKM,iBAAmB,CAAA,EACxBN,KAAKO,QAAU,CAAA,EACfP,KAAKQ,WAAa,CAAA,EAClBR,KAAKS,YAAc,CAAA,EAEnBT,KAAKU,KAAO,CACRC,YAAa,mBACbC,mBAAoB,KAExBZ,KAAKU,KAAKG,QAAU,GACpBb,KAAKU,KAAKI,IAAM,GAChBd,KAAKU,KAAKK,cAAgBzB,IAC1BU,KAAKU,KAAKM,WAAa,CAAA,EACvBhB,KAAKU,KAAKM,WAAWC,mBAAoB,IAAIC,MAAOC,cAC9B,oBAAXC,QAA+C,oBAAdC,WAA6BA,UAAUC,UAC/EtB,KAAKU,KAAKM,WAAWO,oBAAsB,IAAIL,KAAKA,KAAKM,MAAyC,KAAjC,IAAIN,MAAOO,qBAA6BN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AACmD,EA3TC,OA4TlBrD,IAAyBqD,GAAYtD,IAGrCA,GACAvE,cAAcuE,GAElBC,EAAuBqD,EACvBtD,EAAoB1E,YAAY,KAC5B,MAAMqE,EAAQyD,IACTzD,GAGDA,EAAMhG,OAAS,GACf4B,KAEL+H,KAGPC,CA9U0B,KAgVnB,CACHhI,QAEP,EAxVqC,GAyVtC1E,OAAO6I,GAA6BnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilacion/colleciones-clientos",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",