@scalemule/nextjs 0.1.63 → 0.1.64

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.js CHANGED
@@ -48,12 +48,14 @@ function normalizeWord(raw) {
48
48
  return raw.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "");
49
49
  }
50
50
  var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE"]);
51
+ var SKIPPED_CONTENT = "[data-entity-card], [data-sm-narration-skip], [data-sm-narration-layer]";
51
52
  function collectDomWords(root) {
52
53
  const doc = root.ownerDocument ?? root;
53
54
  const walker = doc.createTreeWalker(root, 4, {
54
55
  acceptNode(node) {
55
56
  const parent = node.parentElement;
56
57
  if (parent && SKIPPED_TAGS.has(parent.tagName)) return 2;
58
+ if (parent?.closest(SKIPPED_CONTENT)) return 2;
57
59
  return 1;
58
60
  }
59
61
  });
@@ -441,7 +443,7 @@ function PlayerSession({
441
443
  highlightAbort.current = controller;
442
444
  setHighlightBusy(true);
443
445
  try {
444
- const resp = await fetch(narration.timingsUrl, { signal: controller.signal });
446
+ const resp = await fetch(narration.timingsUrl, { signal: controller.signal, cache: "no-store" });
445
447
  if (!resp.ok) throw new Error(`timings ${resp.status}`);
446
448
  const timings = parseTimingsPayload(await resp.json());
447
449
  const target = document.getElementById(narration.targetId);
@@ -1810,7 +1812,7 @@ function useArticleNarration(track, narration) {
1810
1812
  const timeout = setTimeout(() => controller.abort(), 15e3);
1811
1813
  void (async () => {
1812
1814
  try {
1813
- const response = await fetch(narration.timingsUrl, { signal: controller.signal });
1815
+ const response = await fetch(narration.timingsUrl, { signal: controller.signal, cache: "no-store" });
1814
1816
  if (!response.ok) return;
1815
1817
  const timings = parseTimingsPayload(await response.json());
1816
1818
  const target = document.getElementById(narration.targetId);
package/dist/audio.mjs CHANGED
@@ -18,12 +18,14 @@ function normalizeWord(raw) {
18
18
  return raw.normalize("NFKC").toLowerCase().replace(/[^\p{L}\p{N}]+/gu, "");
19
19
  }
20
20
  var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE"]);
21
+ var SKIPPED_CONTENT = "[data-entity-card], [data-sm-narration-skip], [data-sm-narration-layer]";
21
22
  function collectDomWords(root) {
22
23
  const doc = root.ownerDocument ?? root;
23
24
  const walker = doc.createTreeWalker(root, 4, {
24
25
  acceptNode(node) {
25
26
  const parent = node.parentElement;
26
27
  if (parent && SKIPPED_TAGS.has(parent.tagName)) return 2;
28
+ if (parent?.closest(SKIPPED_CONTENT)) return 2;
27
29
  return 1;
28
30
  }
29
31
  });
@@ -411,7 +413,7 @@ function PlayerSession({
411
413
  highlightAbort.current = controller;
412
414
  setHighlightBusy(true);
413
415
  try {
414
- const resp = await fetch(narration.timingsUrl, { signal: controller.signal });
416
+ const resp = await fetch(narration.timingsUrl, { signal: controller.signal, cache: "no-store" });
415
417
  if (!resp.ok) throw new Error(`timings ${resp.status}`);
416
418
  const timings = parseTimingsPayload(await resp.json());
417
419
  const target = document.getElementById(narration.targetId);
@@ -1789,7 +1791,7 @@ function useArticleNarration(track, narration) {
1789
1791
  const timeout = setTimeout(() => controller.abort(), 15e3);
1790
1792
  void (async () => {
1791
1793
  try {
1792
- const response = await fetch(narration.timingsUrl, { signal: controller.signal });
1794
+ const response = await fetch(narration.timingsUrl, { signal: controller.signal, cache: "no-store" });
1793
1795
  if (!response.ok) return;
1794
1796
  const timings = parseTimingsPayload(await response.json());
1795
1797
  const target = document.getElementById(narration.targetId);
@@ -100,6 +100,12 @@ import { ArticleAudioControls } from '@scalemule/nextjs/audio'
100
100
  ```
101
101
 
102
102
  Keep the existing article body with `id="article-narration-body"`. Mounting an
103
+ inline Event/Place card does not add its text to narration: the highlighter skips
104
+ `data-entity-card` elements. Mark any other non-spoken block with
105
+ `data-sm-narration-skip`. Timings are fetched without browser cache because an
106
+ article URL can acquire a newer recording after an editorial correction.
107
+
108
+ Mounting an
103
109
  article never selects or starts its audio. Listen selects it; Add to queue
104
110
  appends without interrupting playback. Identity is `(publicationId, id)` so IDs
105
111
  in different publications do not collide. The queue deduplicates entries and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
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",