@scalemule/nextjs 0.1.57 → 0.1.58

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/dist/audio.d.mts CHANGED
@@ -264,6 +264,8 @@ interface ListeningPersistence {
264
264
  /** Network and reader scope. Change this on account changes. */
265
265
  storageKey: string;
266
266
  networkId: string;
267
+ /** New player windows adopt the opener queue instead of restoring an older host queue. */
268
+ restoreQueue?: boolean;
267
269
  hubUrl?: string;
268
270
  allowedOrigins: readonly string[];
269
271
  }
package/dist/audio.d.ts CHANGED
@@ -264,6 +264,8 @@ interface ListeningPersistence {
264
264
  /** Network and reader scope. Change this on account changes. */
265
265
  storageKey: string;
266
266
  networkId: string;
267
+ /** New player windows adopt the opener queue instead of restoring an older host queue. */
268
+ restoreQueue?: boolean;
267
269
  hubUrl?: string;
268
270
  allowedOrigins: readonly string[];
269
271
  }
package/dist/audio.js CHANGED
@@ -1493,7 +1493,7 @@ function persistListening(controller, options) {
1493
1493
  const hubOrigin = options.hubUrl ? new URL(options.hubUrl).origin : null;
1494
1494
  try {
1495
1495
  const saved = JSON.parse(localStorage.getItem(options.storageKey) ?? "null");
1496
- if (validSnapshot(saved) && saved.queue.every((item) => allowed.has(new URL(item.articleUrl).origin))) controller.restore(saved);
1496
+ if (validSnapshot(saved) && saved.queue.every((item) => allowed.has(new URL(item.articleUrl).origin))) controller.restore(options.restoreQueue === false ? { ...saved, queue: [], index: -1, position: 0, duration: 0, hidden: false } : saved);
1497
1497
  } catch {
1498
1498
  }
1499
1499
  const url = new URL(window.location.href);
@@ -1651,8 +1651,8 @@ function NetworkAudioProvider({ children, resolveAudio, connection, host, checkp
1651
1651
  }, [controller, checkpointStorageKey]);
1652
1652
  const persistenceOrigins = JSON.stringify(persistence?.allowedOrigins ?? []);
1653
1653
  (0, import_react2.useEffect)(() => {
1654
- if (persistence) return persistListening(controller, { ...persistence, allowedOrigins: JSON.parse(persistenceOrigins) });
1655
- }, [controller, persistence?.storageKey, persistence?.networkId, persistence?.hubUrl, persistenceOrigins]);
1654
+ if (persistence) return persistListening(controller, { ...persistence, restoreQueue: host && window.opener ? false : persistence.restoreQueue, allowedOrigins: JSON.parse(persistenceOrigins) });
1655
+ }, [controller, persistence?.storageKey, persistence?.networkId, persistence?.hubUrl, persistence?.restoreQueue, host?.networkId, persistenceOrigins]);
1656
1656
  (0, import_react2.useEffect)(() => () => recommendationRequest.current?.abort(), []);
1657
1657
  const catchUp = (0, import_react2.useCallback)(async (minutes) => {
1658
1658
  if (!loadRecommendations) return;
package/dist/audio.mjs CHANGED
@@ -1472,7 +1472,7 @@ function persistListening(controller, options) {
1472
1472
  const hubOrigin = options.hubUrl ? new URL(options.hubUrl).origin : null;
1473
1473
  try {
1474
1474
  const saved = JSON.parse(localStorage.getItem(options.storageKey) ?? "null");
1475
- if (validSnapshot(saved) && saved.queue.every((item) => allowed.has(new URL(item.articleUrl).origin))) controller.restore(saved);
1475
+ if (validSnapshot(saved) && saved.queue.every((item) => allowed.has(new URL(item.articleUrl).origin))) controller.restore(options.restoreQueue === false ? { ...saved, queue: [], index: -1, position: 0, duration: 0, hidden: false } : saved);
1476
1476
  } catch {
1477
1477
  }
1478
1478
  const url = new URL(window.location.href);
@@ -1630,8 +1630,8 @@ function NetworkAudioProvider({ children, resolveAudio, connection, host, checkp
1630
1630
  }, [controller, checkpointStorageKey]);
1631
1631
  const persistenceOrigins = JSON.stringify(persistence?.allowedOrigins ?? []);
1632
1632
  useEffect2(() => {
1633
- if (persistence) return persistListening(controller, { ...persistence, allowedOrigins: JSON.parse(persistenceOrigins) });
1634
- }, [controller, persistence?.storageKey, persistence?.networkId, persistence?.hubUrl, persistenceOrigins]);
1633
+ if (persistence) return persistListening(controller, { ...persistence, restoreQueue: host && window.opener ? false : persistence.restoreQueue, allowedOrigins: JSON.parse(persistenceOrigins) });
1634
+ }, [controller, persistence?.storageKey, persistence?.networkId, persistence?.hubUrl, persistence?.restoreQueue, host?.networkId, persistenceOrigins]);
1635
1635
  useEffect2(() => () => recommendationRequest.current?.abort(), []);
1636
1636
  const catchUp = useCallback(async (minutes) => {
1637
1637
  if (!loadRecommendations) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "ScaleMule SDK for Next.js applications - authentication, storage, and user management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",