@whiplashmerch/whiplash-api-client 0.4.92 → 0.4.93

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.
@@ -24102,11 +24102,11 @@ var PusherBatchResponses;
24102
24102
  function getUserChannelName(userId, pusherPrefix) {
24103
24103
  return [pusherPrefix, 'user', userId].filter(item => item).join('-');
24104
24104
  }
24105
- function subscribe(pusherInstance, channelName, callback) {
24105
+ function subscribe(pusherInstance, channelName, callback, key = 'status') {
24106
24106
  // Pusher's subscribe method is misleadingly named. This method caches subscriptions and will get one if it already exists and only create when none is found
24107
24107
  const channel = pusherInstance.subscribe(channelName);
24108
24108
  if (callback) {
24109
- channel.bind('broadcast', callback);
24109
+ channel.bind(key, callback);
24110
24110
  }
24111
24111
  return channel;
24112
24112
  }
@@ -24128,7 +24128,7 @@ function waitForBatch(pusherInstance, batchChannelName) {
24128
24128
  case PusherBatchResponses.singleJobFailed:
24129
24129
  return reject(new Error(`At least on job failed while listening to ${batchChannelName}`));
24130
24130
  }
24131
- });
24131
+ }, 'broadcast');
24132
24132
  }
24133
24133
  catch (e) {
24134
24134
  reject(e);
@@ -24136,7 +24136,7 @@ function waitForBatch(pusherInstance, batchChannelName) {
24136
24136
  });
24137
24137
  }
24138
24138
  function subscribeToUserChannel(pusherInstance, userId, callback, pusherPrefix) {
24139
- return subscribe(pusherInstance, getUserChannelName(userId, pusherPrefix), callback);
24139
+ return subscribe(pusherInstance, getUserChannelName(userId, pusherPrefix), callback, 'broadcast');
24140
24140
  }
24141
24141
  function unsubscribeFromUserChannel(pusherInstance, userId, pusherPrefix) {
24142
24142
  unsubscribe(pusherInstance, getUserChannelName(userId, pusherPrefix));
@@ -24171,7 +24171,7 @@ function waitForJob(pusherInstance, statusChannelName) {
24171
24171
  return new Promise((resolve, reject) => {
24172
24172
  try {
24173
24173
  subscribe(pusherInstance, statusChannelName, (response) => {
24174
- switch (response) {
24174
+ switch (response.status) {
24175
24175
  case PusherJobStatus.success:
24176
24176
  return resolve();
24177
24177
  case PusherJobStatus.failure: