genesys-cloud-streaming-client 19.4.1-develop.11 → 19.4.1-develop.12

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.
@@ -345,6 +345,7 @@ class Notifications {
345
345
  return this.xmppUnsubscribe(topic);
346
346
  }
347
347
  async bulkSubscribe(topics, options = { replace: false, force: false }, priorities = {}) {
348
+ var _a;
348
349
  this.setTopicPriorities(priorities);
349
350
  let toSubscribe = mergeAndDedup(topics, []);
350
351
  if (options.replace && !options.force) {
@@ -360,29 +361,38 @@ class Notifications {
360
361
  if (response && response.data && 'entities' in response.data && Array.isArray(response.data.entities)) {
361
362
  topicResponseEntities = response.data.entities;
362
363
  }
363
- const topicResponsesById = {};
364
+ const result = {};
364
365
  for (const topicEntity of topicResponseEntities) {
365
- topicResponsesById[topicEntity.id] = topicEntity;
366
+ const { id, state, rejectionReason } = topicEntity;
367
+ result[id] = { topic: id, state, rejectionReason };
368
+ // If response entity is a combined topic ID like "a.b?c&d" include individualized topic IDs
369
+ // as keys in the map. This could either point to the same result as the combined topic ID
370
+ // or to a specific result for that individual topic if backend provides a specific result.
371
+ // Example: caller asked to subscribe "a.b?c&d" but user lacks permission for topic "a.b.d"
372
+ // In this case, API response will include "a.b?c&d" as success along with "a.b.d" as failure.
373
+ if (id.includes('?')) {
374
+ for (const individualTopic of (0, utils_1.splitIntoIndividualTopics)(id)) {
375
+ const hasIndividualTopicResult = result.hasOwnProperty(individualTopic);
376
+ // Only use the combined topic result for this individual topic ID if there isn't already
377
+ // a result for the individual topic itself. Exact topic result takes precedence.
378
+ if (!hasIndividualTopicResult) {
379
+ result[individualTopic] = result[id];
380
+ }
381
+ }
382
+ }
366
383
  }
367
- const result = {};
368
384
  if (options.replace) {
369
385
  this.bulkSubscriptions = {};
370
386
  }
371
387
  topics.forEach(topic => {
372
388
  this.bulkSubscriptions[topic] = true;
373
- if (this.enablePartialBulkResubscribe) {
374
- if (topic in topicResponsesById) {
375
- const { state, rejectionReason } = topicResponsesById[topic];
376
- result[topic] = { topic, state, rejectionReason };
377
- }
378
- else {
379
- result[topic] = { topic, state: 'Unknown' };
380
- }
381
- }
382
- else {
383
- result[topic] = { topic, state: 'Permitted' };
384
- }
385
389
  });
390
+ // Add a fallback result for any topic in the toSubscribe list that isn't already in result.
391
+ // With partial bulk resubscribe enabled missing result means "Unknown" state but when not
392
+ // enabled the fallback is "Permitted" for backward compatibility (success response means OK).
393
+ for (const topic of toSubscribe) {
394
+ (_a = result[topic]) !== null && _a !== void 0 ? _a : (result[topic] = { topic, state: this.enablePartialBulkResubscribe ? 'Unknown' : 'Permitted' });
395
+ }
386
396
  return result;
387
397
  }
388
398
  get expose() {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "19.4.1-develop",
3
- "build": "11",
4
- "buildDate": "2025-10-13T14:10:01.001Z",
3
+ "build": "12",
4
+ "buildDate": "2025-11-03T21:47:30.341Z",
5
5
  "indexFiles": [
6
6
  {
7
7
  "file": "v19.4.1/streaming-client.browser.js"