@empathyco/x-components 8.13.2 → 8.13.4

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.13.4](https://github.com/empathyco/x/compare/@empathyco/x-components@8.13.3...@empathyco/x-components@8.13.4) (2026-08-27)
7
+
8
+ **Note:** Version bump only for package @empathyco/x-components
9
+
10
+
11
+
12
+
13
+
14
+ ## [8.13.3](https://github.com/empathyco/x/compare/@empathyco/x-components@8.13.2...@empathyco/x-components@8.13.3) (2026-08-25)
15
+
16
+ ### Code Refactoring
17
+
18
+ * **wiring:** remove unused UserClearedQuery event handling (#2161)
19
+
20
+
6
21
  ## [8.13.2](https://github.com/empathyco/x/compare/@empathyco/x-components@8.13.1...@empathyco/x-components@8.13.2) (2026-08-25)
7
22
 
8
23
  **Note:** Version bump only for package @empathyco/x-components
package/js/x-bus/x-bus.js CHANGED
@@ -110,6 +110,10 @@ class XPriorityBus {
110
110
  metadata: eventMetadata,
111
111
  };
112
112
  emitter.next(payloadObj);
113
+ if (this.isXDebugEnabled()) {
114
+ // eslint-disable-next-line no-console
115
+ console.debug('XEvent', key, payloadObj);
116
+ }
113
117
  this.emitCallbacks.forEach(callback => {
114
118
  callback(key, payloadObj);
115
119
  });
@@ -129,6 +133,18 @@ class XPriorityBus {
129
133
  this.pendingPopsIds.forEach(clearTimeout);
130
134
  this.pendingPopsIds.length = 0;
131
135
  }
136
+ /**
137
+ * Checks whether the `xdebug` query param is set to `true` in the current URL, to
138
+ * enable debug logging of the emitted events.
139
+ *
140
+ * @returns True if the `xdebug` query param is set to `true` in the URL.
141
+ *
142
+ * @internal
143
+ */
144
+ isXDebugEnabled() {
145
+ return (typeof window !== 'undefined' &&
146
+ new URLSearchParams(window.location.search).get('xdebug') === 'true');
147
+ }
132
148
  /**
133
149
  * Retrieves an observable for the event. See {@link XBus.on}.
134
150
  *
@@ -1 +1 @@
1
- {"version":3,"file":"x-bus.js","sources":["../../../src/x-bus/x-bus.ts"],"sourcesContent":["import type { AnyFunction, Dictionary } from '@empathyco/x-utils'\nimport type { Observable } from 'rxjs'\nimport type {\n EmittedData,\n Emitter,\n Emitters,\n EventPayload,\n Priority,\n SubjectPayload,\n XBus,\n XPriorityBusEventMetadata,\n XPriorityQueueNodeData,\n} from './x-bus.types'\nimport type { XPriorityQueue } from './x-priority-queue.types'\nimport { ReplaySubject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { BaseXPriorityQueue } from './x-priority-queue'\n\n/**\n * A default {@link XBus} implementation using a\n * {@link XPriorityQueue | priority queue} as its data structure to\n * prioritise the emission of events. The priorities are preconfigured based on event naming.\n *\n * @public\n */\nexport class XPriorityBus<\n SomeEvents extends Dictionary,\n SomeEventMetadata extends XPriorityBusEventMetadata,\n> implements XBus<SomeEvents, SomeEventMetadata> {\n /**\n * A {@link XPriorityQueue | priority queue} to store the events to\n * emit.\n *\n * @internal\n */\n protected queue: XPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>\n\n /**\n * A dictionary associating a priority to a key.\n *\n * @example\n * ```ts\n * const priorities: Dictionary<number> = {\n * '^StartsWith': 2,\n * Contains: 4,\n * EndWith$: 8\n * }\n * ```\n *\n * @internal\n */\n protected priorities: Dictionary<Priority>\n\n /**\n * The default value to use as priority for an event that doesn't have defined neither a custom\n * priority nor its name doesn't match any key of the {@link XPriorityBus.priorities | priorities} dictionary.\n *\n * @internal\n */\n protected defaultEventPriority: number\n\n /**\n * A list of functions to execute when an event is emitted.\n *\n * @internal\n */\n protected emitCallbacks: AnyFunction[]\n\n /**\n * A dictionary to store the created event emitters.\n *\n * @internal\n */\n protected emitters: Emitters<SomeEvents, SomeEventMetadata> = {}\n\n /**\n * A pending flush operation timeout identifier or undefined if there's none pending.\n *\n * @internal\n */\n protected pendingFlushId?: number\n\n /**\n * A list of pending pop operations timeout identifiers.\n *\n * @internal\n */\n protected pendingPopsIds: number[] = []\n\n /**\n * Creates a new instance of a {@link XPriorityBus}.\n *\n * @param config - A configuration object to initialise the bus.\n * - param config.queue - A {@link XPriorityQueue | priority queue} to store the events.\n * - param config.priorities - A Dictionary defining the priorities associated to a given string.\n * - param config.emitCallbacks - A list of functions to execute when an event is emitted.\n * - param config.defaultEventPriority - A default priority to assigned to an event.\n */\n public constructor(\n config: {\n queue?: XPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>\n priorities?: Dictionary<number>\n emitCallbacks?: AnyFunction[]\n defaultEventPriority?: number\n } = {},\n ) {\n this.queue =\n config.queue ??\n new BaseXPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>()\n this.priorities = config.priorities ?? {}\n this.emitCallbacks = config.emitCallbacks ?? []\n this.defaultEventPriority = config.defaultEventPriority ?? Number.MIN_SAFE_INTEGER\n }\n\n /**\n * Emits an event. See {@link XBus.emit}.\n *\n * @param event - Event to be emitted.\n * @param payload - Event payload.\n * @param metadata - Extra event data.\n *\n * @returns A promise that is resolved the moment the event is emitted.\n */\n // eslint-disable-next-line ts/promise-function-async\n emit<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n // TODO: Fix optional argument.\n payload?: EventPayload<SomeEvents, SomeEvent>,\n metadata = {} as SomeEventMetadata,\n ): Promise<EmittedData<SomeEvents, SomeEvent, SomeEventMetadata>> {\n return new Promise(resolve => {\n this.queue.push(event, this.getEventPriority(event, metadata), {\n // This type assertion is done because payload is optional.\n eventPayload: payload as EventPayload<SomeEvents, SomeEvent>,\n eventMetadata: metadata,\n replaceable: metadata.replaceable || false,\n // @ts-expect-error TODO: Fix type.\n resolve,\n })\n\n this.flushQueue()\n })\n }\n\n /**.\n * Retrieves the event priority based on:\n * - the defined event metadata priority\n * - the priority associated to the matching preconfigured priority key\n * - the configured {@link XPriorityBus.defaultEventPriority | defaultEventPriority} is assigned (by default, the min safe integer).\n *\n * @param event - The event to get the priority from.\n * @param metadata - The event metadata.\n *\n * @returns The priority for the given event.\n *\n * @internal\n */\n protected getEventPriority(event: keyof SomeEvents, metadata: SomeEventMetadata): Priority {\n if (metadata.priority != null) {\n return metadata.priority\n }\n\n const matchingKey = Object.keys(this.priorities).find(key => String(event).includes(key))\n if (matchingKey) {\n return this.priorities[matchingKey]\n }\n\n return this.defaultEventPriority\n }\n\n /**\n * Processes the events stored in the\n * {@link XPriorityQueue | priority queue} and resolves each event\n * whenever it is emitted.\n *\n * @remarks If another 'flushQueue' operation is running, it is discarded and a new one is\n * executed. The pending popping operations are also discarded.\n *\n * @internal\n */\n protected flushQueue(): void {\n clearTimeout(this.pendingFlushId)\n this.clearPendingPopsIds()\n\n this.pendingFlushId = window.setTimeout(() => {\n for (let i = 0; i < this.queue.size(); ++i) {\n const popTimeoutId = window.setTimeout(() => {\n const {\n key,\n data: { eventPayload, eventMetadata, resolve },\n } = this.queue.pop()!\n const emitter = this.getEmitter(key)\n const payloadObj = {\n eventPayload,\n metadata: eventMetadata,\n }\n\n emitter.next(payloadObj)\n\n this.emitCallbacks.forEach(callback => {\n callback(key, payloadObj)\n })\n resolve({ event: key, ...payloadObj })\n\n this.pendingPopsIds = this.pendingPopsIds.filter(timeoutId => timeoutId !== popTimeoutId)\n })\n\n this.pendingPopsIds.push(popTimeoutId)\n }\n })\n }\n\n /**\n * Discards existing pending pop operations and empties the array.\n *\n * @internal\n */\n private clearPendingPopsIds(): void {\n this.pendingPopsIds.forEach(clearTimeout)\n this.pendingPopsIds.length = 0\n }\n\n /**\n * Retrieves an observable for the event. See {@link XBus.on}.\n *\n * @param event - Event to retrieve the observable for.\n * @param withMetadata - Option to retrieve an observable with extra data about the event.\n *\n * @returns The emitter for the event passed.\n */\n on<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n withMetadata = false,\n ): typeof withMetadata extends true\n ? Observable<SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>>\n : Observable<EventPayload<SomeEvents, SomeEvent>> {\n // TODO: This type should work, but inference isn't working as expected. Check when updating ts.\n return withMetadata\n ? // @ts-expect-error Type is not assignable to type EventPayload<SomeEvents, SomeEvent\n this.getEmitter(event).asObservable()\n : this.getEmitter(event).pipe(\n map<\n SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>,\n EventPayload<SomeEvents, SomeEvent>\n >(value => value.eventPayload),\n )\n }\n\n /**\n * Retrieves an event {@link Emitter} for the given event.\n *\n * @param event - The event to retrieve the {@link Emitter} for.\n *\n * @returns The {@link Emitters} for the passed event.\n *\n * @internal\n */\n protected getEmitter<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n ): Emitter<SomeEvents, SomeEvent, SomeEventMetadata> {\n if (!this.emitters[event]) {\n this.createEmitter(event)\n }\n\n return this.emitters[event]!\n }\n\n /**\n * Creates an event {@link Emitter} for the given event.\n *\n * @remarks The emitter is implemented with a\n * {@Link https://www.learnrxjs.io/learn-rxjs/subjects/replaysubject | ReplaySubject} to allow any\n * new subscriber receive the last emitted value.\n *\n * @param event - The event to create the {@link Emitter} for.\n *\n * @internal\n */\n protected createEmitter<SomeEvent extends keyof SomeEvents>(event: SomeEvent): void {\n this.emitters[event] = new ReplaySubject<\n SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>\n >(1)\n }\n}\n"],"names":[],"mappings":";;;;AAkBA;;;;;;AAMG;MACU,YAAY,CAAA;AAgEvB;;;;;;;;AAQG;AACH,IAAA,WAAA,CACE,SAKI,EAAE,EAAA;AApCR;;;;AAIG;QACO,IAAA,CAAA,QAAQ,GAA4C,EAAE;AAShE;;;;AAIG;QACO,IAAA,CAAA,cAAc,GAAa,EAAE;AAmBrC,QAAA,IAAI,CAAC,KAAK;AACR,YAAA,MAAM,CAAC,KAAK;gBACZ,IAAI,kBAAkB,EAAqE;QAC7F,IAAI,CAAC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EAChB,YAAY,GAAG,KAAK,EAAA;;AAKpB,QAAA,OAAO;AACL;AACE,gBAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,YAAY;cACnC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CACzB,GAAG,CAGD,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,CAC/B;IACP;AAEA;;;;;;;;AAQG;AACO,IAAA,UAAU,CAClB,KAAgB,EAAA;QAEhB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACzB,YAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAC3B;AAEA,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAE;IAC9B;AAEA;;;;;;;;;;AAUG;AACO,IAAA,aAAa,CAAqC,KAAgB,EAAA;QAC1E,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,aAAa,CAEtC,CAAC,CAAC;IACN;AACD;;;;"}
1
+ {"version":3,"file":"x-bus.js","sources":["../../../src/x-bus/x-bus.ts"],"sourcesContent":["import type { AnyFunction, Dictionary } from '@empathyco/x-utils'\nimport type { Observable } from 'rxjs'\nimport type {\n EmittedData,\n Emitter,\n Emitters,\n EventPayload,\n Priority,\n SubjectPayload,\n XBus,\n XPriorityBusEventMetadata,\n XPriorityQueueNodeData,\n} from './x-bus.types'\nimport type { XPriorityQueue } from './x-priority-queue.types'\nimport { ReplaySubject } from 'rxjs'\nimport { map } from 'rxjs/operators'\nimport { BaseXPriorityQueue } from './x-priority-queue'\n\n/**\n * A default {@link XBus} implementation using a\n * {@link XPriorityQueue | priority queue} as its data structure to\n * prioritise the emission of events. The priorities are preconfigured based on event naming.\n *\n * @public\n */\nexport class XPriorityBus<\n SomeEvents extends Dictionary,\n SomeEventMetadata extends XPriorityBusEventMetadata,\n> implements XBus<SomeEvents, SomeEventMetadata> {\n /**\n * A {@link XPriorityQueue | priority queue} to store the events to\n * emit.\n *\n * @internal\n */\n protected queue: XPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>\n\n /**\n * A dictionary associating a priority to a key.\n *\n * @example\n * ```ts\n * const priorities: Dictionary<number> = {\n * '^StartsWith': 2,\n * Contains: 4,\n * EndWith$: 8\n * }\n * ```\n *\n * @internal\n */\n protected priorities: Dictionary<Priority>\n\n /**\n * The default value to use as priority for an event that doesn't have defined neither a custom\n * priority nor its name doesn't match any key of the {@link XPriorityBus.priorities | priorities} dictionary.\n *\n * @internal\n */\n protected defaultEventPriority: number\n\n /**\n * A list of functions to execute when an event is emitted.\n *\n * @internal\n */\n protected emitCallbacks: AnyFunction[]\n\n /**\n * A dictionary to store the created event emitters.\n *\n * @internal\n */\n protected emitters: Emitters<SomeEvents, SomeEventMetadata> = {}\n\n /**\n * A pending flush operation timeout identifier or undefined if there's none pending.\n *\n * @internal\n */\n protected pendingFlushId?: number\n\n /**\n * A list of pending pop operations timeout identifiers.\n *\n * @internal\n */\n protected pendingPopsIds: number[] = []\n\n /**\n * Creates a new instance of a {@link XPriorityBus}.\n *\n * @param config - A configuration object to initialise the bus.\n * - param config.queue - A {@link XPriorityQueue | priority queue} to store the events.\n * - param config.priorities - A Dictionary defining the priorities associated to a given string.\n * - param config.emitCallbacks - A list of functions to execute when an event is emitted.\n * - param config.defaultEventPriority - A default priority to assigned to an event.\n */\n public constructor(\n config: {\n queue?: XPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>\n priorities?: Dictionary<number>\n emitCallbacks?: AnyFunction[]\n defaultEventPriority?: number\n } = {},\n ) {\n this.queue =\n config.queue ??\n new BaseXPriorityQueue<SomeEvents, XPriorityQueueNodeData<SomeEvents, SomeEventMetadata>>()\n this.priorities = config.priorities ?? {}\n this.emitCallbacks = config.emitCallbacks ?? []\n this.defaultEventPriority = config.defaultEventPriority ?? Number.MIN_SAFE_INTEGER\n }\n\n /**\n * Emits an event. See {@link XBus.emit}.\n *\n * @param event - Event to be emitted.\n * @param payload - Event payload.\n * @param metadata - Extra event data.\n *\n * @returns A promise that is resolved the moment the event is emitted.\n */\n // eslint-disable-next-line ts/promise-function-async\n emit<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n // TODO: Fix optional argument.\n payload?: EventPayload<SomeEvents, SomeEvent>,\n metadata = {} as SomeEventMetadata,\n ): Promise<EmittedData<SomeEvents, SomeEvent, SomeEventMetadata>> {\n return new Promise(resolve => {\n this.queue.push(event, this.getEventPriority(event, metadata), {\n // This type assertion is done because payload is optional.\n eventPayload: payload as EventPayload<SomeEvents, SomeEvent>,\n eventMetadata: metadata,\n replaceable: metadata.replaceable || false,\n // @ts-expect-error TODO: Fix type.\n resolve,\n })\n\n this.flushQueue()\n })\n }\n\n /**.\n * Retrieves the event priority based on:\n * - the defined event metadata priority\n * - the priority associated to the matching preconfigured priority key\n * - the configured {@link XPriorityBus.defaultEventPriority | defaultEventPriority} is assigned (by default, the min safe integer).\n *\n * @param event - The event to get the priority from.\n * @param metadata - The event metadata.\n *\n * @returns The priority for the given event.\n *\n * @internal\n */\n protected getEventPriority(event: keyof SomeEvents, metadata: SomeEventMetadata): Priority {\n if (metadata.priority != null) {\n return metadata.priority\n }\n\n const matchingKey = Object.keys(this.priorities).find(key => String(event).includes(key))\n if (matchingKey) {\n return this.priorities[matchingKey]\n }\n\n return this.defaultEventPriority\n }\n\n /**\n * Processes the events stored in the\n * {@link XPriorityQueue | priority queue} and resolves each event\n * whenever it is emitted.\n *\n * @remarks If another 'flushQueue' operation is running, it is discarded and a new one is\n * executed. The pending popping operations are also discarded.\n *\n * @internal\n */\n protected flushQueue(): void {\n clearTimeout(this.pendingFlushId)\n this.clearPendingPopsIds()\n\n this.pendingFlushId = window.setTimeout(() => {\n for (let i = 0; i < this.queue.size(); ++i) {\n const popTimeoutId = window.setTimeout(() => {\n const {\n key,\n data: { eventPayload, eventMetadata, resolve },\n } = this.queue.pop()!\n const emitter = this.getEmitter(key)\n const payloadObj = {\n eventPayload,\n metadata: eventMetadata,\n }\n\n emitter.next(payloadObj)\n\n if (this.isXDebugEnabled()) {\n // eslint-disable-next-line no-console\n console.debug('XEvent', key, payloadObj)\n }\n\n this.emitCallbacks.forEach(callback => {\n callback(key, payloadObj)\n })\n resolve({ event: key, ...payloadObj })\n\n this.pendingPopsIds = this.pendingPopsIds.filter(timeoutId => timeoutId !== popTimeoutId)\n })\n\n this.pendingPopsIds.push(popTimeoutId)\n }\n })\n }\n\n /**\n * Discards existing pending pop operations and empties the array.\n *\n * @internal\n */\n private clearPendingPopsIds(): void {\n this.pendingPopsIds.forEach(clearTimeout)\n this.pendingPopsIds.length = 0\n }\n\n /**\n * Checks whether the `xdebug` query param is set to `true` in the current URL, to\n * enable debug logging of the emitted events.\n *\n * @returns True if the `xdebug` query param is set to `true` in the URL.\n *\n * @internal\n */\n private isXDebugEnabled(): boolean {\n return (\n typeof window !== 'undefined' &&\n new URLSearchParams(window.location.search).get('xdebug') === 'true'\n )\n }\n\n /**\n * Retrieves an observable for the event. See {@link XBus.on}.\n *\n * @param event - Event to retrieve the observable for.\n * @param withMetadata - Option to retrieve an observable with extra data about the event.\n *\n * @returns The emitter for the event passed.\n */\n on<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n withMetadata = false,\n ): typeof withMetadata extends true\n ? Observable<SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>>\n : Observable<EventPayload<SomeEvents, SomeEvent>> {\n // TODO: This type should work, but inference isn't working as expected. Check when updating ts.\n return withMetadata\n ? // @ts-expect-error Type is not assignable to type EventPayload<SomeEvents, SomeEvent\n this.getEmitter(event).asObservable()\n : this.getEmitter(event).pipe(\n map<\n SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>,\n EventPayload<SomeEvents, SomeEvent>\n >(value => value.eventPayload),\n )\n }\n\n /**\n * Retrieves an event {@link Emitter} for the given event.\n *\n * @param event - The event to retrieve the {@link Emitter} for.\n *\n * @returns The {@link Emitters} for the passed event.\n *\n * @internal\n */\n protected getEmitter<SomeEvent extends keyof SomeEvents>(\n event: SomeEvent,\n ): Emitter<SomeEvents, SomeEvent, SomeEventMetadata> {\n if (!this.emitters[event]) {\n this.createEmitter(event)\n }\n\n return this.emitters[event]!\n }\n\n /**\n * Creates an event {@link Emitter} for the given event.\n *\n * @remarks The emitter is implemented with a\n * {@Link https://www.learnrxjs.io/learn-rxjs/subjects/replaysubject | ReplaySubject} to allow any\n * new subscriber receive the last emitted value.\n *\n * @param event - The event to create the {@link Emitter} for.\n *\n * @internal\n */\n protected createEmitter<SomeEvent extends keyof SomeEvents>(event: SomeEvent): void {\n this.emitters[event] = new ReplaySubject<\n SubjectPayload<EventPayload<SomeEvents, SomeEvent>, SomeEventMetadata>\n >(1)\n }\n}\n"],"names":[],"mappings":";;;;AAkBA;;;;;;AAMG;MACU,YAAY,CAAA;AAgEvB;;;;;;;;AAQG;AACH,IAAA,WAAA,CACE,SAKI,EAAE,EAAA;AApCR;;;;AAIG;QACO,IAAA,CAAA,QAAQ,GAA4C,EAAE;AAShE;;;;AAIG;QACO,IAAA,CAAA,cAAc,GAAa,EAAE;AAmBrC,QAAA,IAAI,CAAC,KAAK;AACR,YAAA,MAAM,CAAC,KAAK;gBACZ,IAAI,kBAAkB,EAAqE;QAC7F,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE;QACzC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,EAAE;QAC/C,IAAI,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,IAAI,MAAM,CAAC,gBAAgB;IACpF;AAEA;;;;;;;;AAQG;;AAEH,IAAA,IAAI,CACF,KAAgB;;IAEhB,OAA6C,EAC7C,WAAW,EAAuB,EAAA;AAElC,QAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;AAC3B,YAAA,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI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AAC,UAAU,CAAC,KAAK,CAAC,CAAC,YAAY;cACnC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CACzB,GAAG,CAGD,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,CAC/B;IACP;AAEA;;;;;;;;AAQG;AACO,IAAA,UAAU,CAClB,KAAgB,EAAA;QAEhB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACzB,YAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAC3B;AAEA,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAE;IAC9B;AAEA;;;;;;;;;;AAUG;AACO,IAAA,aAAa,CAAqC,KAAgB,EAAA;QAC1E,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,aAAa,CAEtC,CAAC,CAAC;IACN;AACD;;;;"}
@@ -122,10 +122,6 @@ const nextQueriesWiring = createWiring({
122
122
  resetNextQueriesWire,
123
123
  setNextQueriesQuery,
124
124
  },
125
- UserClearedQuery: {
126
- resetNextQueriesWire,
127
- resetNextQueriesQuery,
128
- },
129
125
  UserBrowsedToCategory: {
130
126
  resetNextQueriesWire,
131
127
  resetNextQueriesQuery,
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/next-queries/wiring.ts"],"sourcesContent":["import type {\n NamespacedWireCommit,\n NamespacedWireCommitWithoutPayload,\n NamespacedWireDispatch,\n NamespacedWiringData,\n} from '../../wiring/namespaced-wiring.types'\nimport {\n namespacedWireCommit,\n namespacedWireCommitWithoutPayload,\n namespacedWireDispatch,\n} from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `nextQueries` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'nextQueries'\n\n/**\n * WireCommit for {@link NextQueriesXModule}.\n *\n * @internal\n */\nconst wireCommit: NamespacedWireCommit<typeof moduleName> = namespacedWireCommit(moduleName)\n\n/**\n * WireCommitWithoutPayload for {@link NextQueriesXModule}.\n */\nconst wireCommitWithoutPayload: NamespacedWireCommitWithoutPayload<typeof moduleName> =\n namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * WireDispatch for {@link NextQueriesXModule}.\n *\n * @internal\n */\nconst wireDispatch: NamespacedWireDispatch<typeof moduleName> = namespacedWireDispatch(moduleName)\n\n/**\n * Sets the next queries state `query`.\n *\n * @public\n */\nexport const setNextQueriesQuery = wireCommit('setQuery')\n\n/**\n * Reset the next queries state `query`.\n *\n * @public\n */\nexport const resetNextQueriesQuery = wireCommit('setQuery', '')\n\n/**\n * Sets the next queries state `relatedTags`.\n *\n * @public\n */\nexport const setNextQueriesRelatedTags = wireCommit('setRelatedTags')\n\n/**\n * Sets the next queries state `query` with a selectedQueryPreview's query.\n *\n * @public\n */\nexport const setNextQueriesQueryFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { query } }) => query,\n)\n\n/**\n * Sets the next queries state `query` from url.\n *\n * @public\n */\nconst setUrlParams = wireDispatch('setUrlParams')\n\n/**\n * Sets the next queries state `params`.\n *\n * @public\n */\nexport const setNextQueriesExtraParams = wireCommit('setParams')\n\n/**\n * Sets the next queries state `params` with a selectedQueryPreview's extraParams.\n *\n * @public\n */\nexport const setNextQueriesExtraParamsFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { extraParams } }) => extraParams,\n)\n\n/**\n * Requests and stores the next queries.\n *\n * @public\n */\nexport const fetchAndSaveNextQueriesWire = wireDispatch('fetchAndSaveNextQueries')\n\n/**\n * Sets the next queries state `query` with the last query in history queries.\n *\n * @public\n */\nexport const setQueryFromLastHistoryQueryWire = wireDispatch('setQueryFromLastHistoryQuery')\n\n/**\n * Requests and store the next query preview results.\n *\n * @public\n */\nexport const fetchAndSaveNextQueryPreviewWire = wireDispatch(\n 'fetchAndSaveNextQueryPreview',\n ({ eventPayload: query, metadata: { location } }: NamespacedWiringData<'nextQueries'>) => {\n return {\n query,\n location,\n }\n },\n)\n/**\n * Resets the next query preview results.\n *\n * @public\n */\nexport const resetResultsPreviewWire = wireCommitWithoutPayload('resetResultsPreview')\n\n/**\n * Resets the next queries list to an empty array.\n *\n * @public\n */\nexport const resetNextQueriesWire = wireCommitWithoutPayload('resetNextQueries')\n\n/**\n * Sets the next queries state `searchedQueries` with the list of history queries.\n *\n * @public\n */\nexport const setSearchedQueries = wireCommit('setSearchedQueries')\n\n/**\n * Wiring configuration for the {@link NextQueriesXModule | next queries module}.\n *\n * @internal\n */\nexport const nextQueriesWiring = createWiring({\n ParamsLoadedFromUrl: {\n setUrlParams,\n },\n NextQueriesChanged: {\n resetResultsPreviewWire,\n },\n UserAcceptedAQuery: {\n resetNextQueriesWire,\n setNextQueriesQuery,\n },\n UserClearedQuery: {\n resetNextQueriesWire,\n resetNextQueriesQuery,\n },\n UserBrowsedToCategory: {\n resetNextQueriesWire,\n resetNextQueriesQuery,\n },\n SelectedRelatedTagsChanged: {\n setNextQueriesRelatedTags,\n },\n SessionHistoryQueriesChanged: {\n setSearchedQueries,\n // TODO setQueryFromLastHistoryQuery it has to be called only one time\n setQueryFromLastHistoryQueryWire,\n },\n NextQueriesRequestUpdated: {\n fetchAndSaveNextQueriesWire,\n },\n ExtraParamsChanged: {\n setNextQueriesExtraParams,\n },\n NextQueryPreviewMountedHook: {\n fetchAndSaveNextQueryPreviewWire,\n },\n UserAcceptedAQueryPreview: {\n setNextQueriesQueryFromPreview,\n setNextQueriesExtraParamsFromPreview,\n },\n})\n"],"names":[],"mappings":";;;AAaA;;;;AAIG;AACH,MAAM,UAAU,GAAG,aAAa;AAEhC;;;;AAIG;AACH,MAAM,UAAU,GAA4C,oBAAoB,CAAC,UAAU,CAAC;AAE5F;;AAEG;AACH,MAAM,wBAAwB,GAC5B,kCAAkC,CAAC,UAAU,CAAC;AAEhD;;;;AAIG;AACH,MAAM,YAAY,GAA8C,sBAAsB,CAAC,UAAU,CAAC;AAElG;;;;AAIG;MACU,mB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BAAgB,EAAE;QAChB,oBAAoB;QACpB,qBAAqB;AACtB,KAAA;AACD,IAAA,qBAAqB,EAAE;QACrB,oBAAoB;QACpB,qBAAqB;AACtB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,yBAAyB;AAC1B,KAAA;AACD,IAAA,4BAA4B,EAAE;QAC5B,kBAAkB;;QAElB,gCAAgC;AACjC,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,2BAA2B;AAC5B,KAAA;AACD,IAAA,kBAAkB,EAAE;QAClB,yBAAyB;AAC1B,KAAA;AACD,IAAA,2BAA2B,EAAE;QAC3B,gCAAgC;AACjC,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,8BAA8B;QAC9B,oCAAoC;AACrC,KAAA;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"wiring.js","sources":["../../../../src/x-modules/next-queries/wiring.ts"],"sourcesContent":["import type {\n NamespacedWireCommit,\n NamespacedWireCommitWithoutPayload,\n NamespacedWireDispatch,\n NamespacedWiringData,\n} from '../../wiring/namespaced-wiring.types'\nimport {\n namespacedWireCommit,\n namespacedWireCommitWithoutPayload,\n namespacedWireDispatch,\n} from '../../wiring/namespaced-wires.factory'\nimport { createWiring } from '../../wiring/wiring.utils'\n\n/**\n * `nextQueries` {@link XModuleName | XModule name}.\n *\n * @internal\n */\nconst moduleName = 'nextQueries'\n\n/**\n * WireCommit for {@link NextQueriesXModule}.\n *\n * @internal\n */\nconst wireCommit: NamespacedWireCommit<typeof moduleName> = namespacedWireCommit(moduleName)\n\n/**\n * WireCommitWithoutPayload for {@link NextQueriesXModule}.\n */\nconst wireCommitWithoutPayload: NamespacedWireCommitWithoutPayload<typeof moduleName> =\n namespacedWireCommitWithoutPayload(moduleName)\n\n/**\n * WireDispatch for {@link NextQueriesXModule}.\n *\n * @internal\n */\nconst wireDispatch: NamespacedWireDispatch<typeof moduleName> = namespacedWireDispatch(moduleName)\n\n/**\n * Sets the next queries state `query`.\n *\n * @public\n */\nexport const setNextQueriesQuery = wireCommit('setQuery')\n\n/**\n * Reset the next queries state `query`.\n *\n * @public\n */\nexport const resetNextQueriesQuery = wireCommit('setQuery', '')\n\n/**\n * Sets the next queries state `relatedTags`.\n *\n * @public\n */\nexport const setNextQueriesRelatedTags = wireCommit('setRelatedTags')\n\n/**\n * Sets the next queries state `query` with a selectedQueryPreview's query.\n *\n * @public\n */\nexport const setNextQueriesQueryFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { query } }) => query,\n)\n\n/**\n * Sets the next queries state `query` from url.\n *\n * @public\n */\nconst setUrlParams = wireDispatch('setUrlParams')\n\n/**\n * Sets the next queries state `params`.\n *\n * @public\n */\nexport const setNextQueriesExtraParams = wireCommit('setParams')\n\n/**\n * Sets the next queries state `params` with a selectedQueryPreview's extraParams.\n *\n * @public\n */\nexport const setNextQueriesExtraParamsFromPreview = wireCommit(\n 'setParams',\n ({ eventPayload: { extraParams } }) => extraParams,\n)\n\n/**\n * Requests and stores the next queries.\n *\n * @public\n */\nexport const fetchAndSaveNextQueriesWire = wireDispatch('fetchAndSaveNextQueries')\n\n/**\n * Sets the next queries state `query` with the last query in history queries.\n *\n * @public\n */\nexport const setQueryFromLastHistoryQueryWire = wireDispatch('setQueryFromLastHistoryQuery')\n\n/**\n * Requests and store the next query preview results.\n *\n * @public\n */\nexport const fetchAndSaveNextQueryPreviewWire = wireDispatch(\n 'fetchAndSaveNextQueryPreview',\n ({ eventPayload: query, metadata: { location } }: NamespacedWiringData<'nextQueries'>) => {\n return {\n query,\n location,\n }\n },\n)\n/**\n * Resets the next query preview results.\n *\n * @public\n */\nexport const resetResultsPreviewWire = wireCommitWithoutPayload('resetResultsPreview')\n\n/**\n * Resets the next queries list to an empty array.\n *\n * @public\n */\nexport const resetNextQueriesWire = wireCommitWithoutPayload('resetNextQueries')\n\n/**\n * Sets the next queries state `searchedQueries` with the list of history queries.\n *\n * @public\n */\nexport const setSearchedQueries = wireCommit('setSearchedQueries')\n\n/**\n * Wiring configuration for the {@link NextQueriesXModule | next queries module}.\n *\n * @internal\n */\nexport const nextQueriesWiring = createWiring({\n ParamsLoadedFromUrl: {\n setUrlParams,\n },\n NextQueriesChanged: {\n resetResultsPreviewWire,\n },\n UserAcceptedAQuery: {\n resetNextQueriesWire,\n setNextQueriesQuery,\n },\n UserBrowsedToCategory: {\n resetNextQueriesWire,\n resetNextQueriesQuery,\n },\n SelectedRelatedTagsChanged: {\n setNextQueriesRelatedTags,\n },\n SessionHistoryQueriesChanged: {\n setSearchedQueries,\n // TODO setQueryFromLastHistoryQuery it has to be called only one time\n setQueryFromLastHistoryQueryWire,\n },\n NextQueriesRequestUpdated: {\n fetchAndSaveNextQueriesWire,\n },\n ExtraParamsChanged: {\n setNextQueriesExtraParams,\n },\n NextQueryPreviewMountedHook: {\n fetchAndSaveNextQueryPreviewWire,\n },\n UserAcceptedAQueryPreview: {\n setNextQueriesQueryFromPreview,\n setNextQueriesExtraParamsFromPreview,\n },\n})\n"],"names":[],"mappings":";;;AAaA;;;;AAIG;AACH,MAAM,UAAU,GAAG,aAAa;AAEhC;;;;AAIG;AACH,MAAM,UAAU,GAA4C,oBAAoB,CAAC,UAAU,CAAC;AAE5F;;AAEG;AACH,MAAM,wBAAwB,GAC5B,kCAAkC,CAAC,UAAU,CAAC;AAEhD;;;;AAIG;AACH,MAAM,YAAY,GAA8C,sBAAsB,CAAC,UAAU,CAAC;AAElG;;;;AAIG;MACU,mBAAmB,GAAG,UAAU,CAAC,UAAU;AAExD;;;;AAIG;AACI,MAAM,qBAAqB,GAAG,UAAU,CAAC,UAAU,EAAE,EAAE;AAE9D;;;;AAIG;MACU,yBAAyB,GAAG,UAAU,CAAC,gBAAgB;AAEpE;;;;AAIG;MACU,8BAA8B,GAAG,UAAU,CACtD,WAAW,EACX,CAAC,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK;AAGxC;;;;AAIG;AACH,MAAM,YAAY,GAAG,YAAY,CAAC,cAAc,CAAC;AAEjD;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BAAyB,EAAE;QACzB,8BAA8B;QAC9B,oCAAoC;AACrC,KAAA;AACF,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empathyco/x-components",
3
- "version": "8.13.2",
3
+ "version": "8.13.4",
4
4
  "description": "Empathy X Components",
5
5
  "author": "Empathy Systems Corporation S.L.",
6
6
  "license": "Apache-2.0",
@@ -117,5 +117,5 @@
117
117
  "access": "public",
118
118
  "directory": "dist"
119
119
  },
120
- "gitHead": "a7de5a0e295f6df7ea1b85a762142bcdb8e84225"
120
+ "gitHead": "393313b830c5f6d31aecbcec3818baf976275046"
121
121
  }
@@ -5068,10 +5068,6 @@ export const nextQueriesWiring: {
5068
5068
  resetNextQueriesWire: AnyWire;
5069
5069
  setNextQueriesQuery: Wire<string>;
5070
5070
  };
5071
- UserClearedQuery: {
5072
- resetNextQueriesWire: AnyWire;
5073
- resetNextQueriesQuery: AnyWire;
5074
- };
5075
5071
  UserBrowsedToCategory: {
5076
5072
  resetNextQueriesWire: AnyWire;
5077
5073
  resetNextQueriesQuery: AnyWire;
@@ -119,6 +119,15 @@ export declare class XPriorityBus<SomeEvents extends Dictionary, SomeEventMetada
119
119
  * @internal
120
120
  */
121
121
  private clearPendingPopsIds;
122
+ /**
123
+ * Checks whether the `xdebug` query param is set to `true` in the current URL, to
124
+ * enable debug logging of the emitted events.
125
+ *
126
+ * @returns True if the `xdebug` query param is set to `true` in the URL.
127
+ *
128
+ * @internal
129
+ */
130
+ private isXDebugEnabled;
122
131
  /**
123
132
  * Retrieves an observable for the event. See {@link XBus.on}.
124
133
  *
@@ -1 +1 @@
1
- {"version":3,"file":"x-bus.d.ts","sourceRoot":"","sources":["../../../../src/x-bus/x-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACtC,OAAO,KA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OAAO,CAAC,EAAE,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,EAC7C,QAAQ,GAAS,iBAAiB,GACjC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAC;IAejE;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,UAAU,EAAE,QAAQ,EAAE,iBAAiB,GAAG,QAAQ;IAa1F;;;;;;;;;OASG;IACH,SAAS,CAAC,UAAU,IAAI,IAAI;IAqC5B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAOvB;;;;;;;OAOG;IACH,EAAE,CAAC,SAAS,SAAS,MAAM,UAAU,EACnC,KAAK,EAAE,SAAS,EAChB,YAAY,UAAQ,GACnB,OAAO,YAAY,SAAS,IAAI,GAC/B,UAAU,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,EAAE,iBAAiB,CAAC,CAAC,GAClF,UAAU,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAanD;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,CAAC,SAAS,SAAS,MAAM,UAAU,EACrD,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,EAAE,SAAS,EAAE,iBAAiB,CAAC;IAQpD;;;;;;;;;;OAUG;IACH,SAAS,CAAC,aAAa,CAAC,SAAS,SAAS,MAAM,UAAU,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI;CAKpF"}
@@ -86,10 +86,6 @@ export declare const nextQueriesWiring: {
86
86
  resetNextQueriesWire: import("../..").AnyWire;
87
87
  setNextQueriesQuery: import("../..").Wire<string>;
88
88
  };
89
- UserClearedQuery: {
90
- resetNextQueriesWire: import("../..").AnyWire;
91
- resetNextQueriesQuery: import("../..").AnyWire;
92
- };
93
89
  UserBrowsedToCategory: {
94
90
  resetNextQueriesWire: import("../..").AnyWire;
95
91
  resetNextQueriesQuery: import("../..").AnyWire;
@@ -1 +1 @@
1
- {"version":3,"file":"wiring.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/next-queries/wiring.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,8BAAyB,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,yBAA6B,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,iEAA+B,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,yBAG1C,CAAA;AASD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wEAA0B,CAAA;AAEhE;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,yBAGhD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,8EAA0C,CAAA;AAElF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,mEAA+C,CAAA;AAE5F;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,yBAQ5C,CAAA;AACD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,yBAAkD,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,yBAA+C,CAAA;AAEhF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,mEAAmC,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwC5B,CAAA"}
1
+ {"version":3,"file":"wiring.d.ts","sourceRoot":"","sources":["../../../../../src/x-modules/next-queries/wiring.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,8BAAyB,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,yBAA6B,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,iEAA+B,CAAA;AAErE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,yBAG1C,CAAA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