@livepreso/content-react 2.2.2 → 2.3.1

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.
@@ -70,7 +70,7 @@
70
70
  "eslint-scope@8.4.0": "eslint-scope@8.4.0:8sCuk/6sg3/iCXu4ikInhuUYyvcQoTXETHdBY6JCzr0=:",
71
71
  "eslint-visitor-keys@3.4.3": "eslint-visitor-keys@3.4.3:JgR2rf9Jpzva8lFrKE+5yhxLwgC8qNXtm9LsuSBeAT8=:",
72
72
  "eslint-visitor-keys@4.2.1": "eslint-visitor-keys@4.2.1:uyQNsuDcPZL1cJ29uclbt/ITeoMox36b0gbaWL8EB2E=:",
73
- "eslint@9.15.0(jiti@1.21.7)": "eslint@9.15.0(jiti@1.21.7):BBMkLm2PafjLl1mwKS36oeb1WbB2SxRLnq5E+fRoC04=:",
73
+ "eslint@9.15.0(jiti@1.21.7)": "eslint@9.15.0(jiti@1.21.7):5s8tqOQH56eedeB7EmuDjwdx9JjZeyXi4IS97WDGhbA=:",
74
74
  "espree@10.4.0": "espree@10.4.0:NLXs2uyUi7cK0j1u0OxWFDO6zYcblsb73pCi4SupIOE=:",
75
75
  "esquery@1.7.0": "esquery@1.7.0:7lTtVBqirWgWzvUR2UO+6Vgzeyg40AnBbmtPEJHSYnI=:",
76
76
  "esrecurse@4.3.0": "esrecurse@4.3.0:Uyo8CNm+VUgeJSS5C3ZgOky7Jzoy9NqvDpoJmqgzC1s=:",
package/CHANGELOG.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "@livepreso/content-react",
3
3
  "entries": [
4
+ {
5
+ "version": "2.3.1",
6
+ "tag": "@livepreso/content-react_v2.3.1",
7
+ "date": "Thu, 17 Sep 2026 01:30:15 GMT",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "comment": "Generate correct key when fetching user template values from the context."
12
+ }
13
+ ]
14
+ }
15
+ },
16
+ {
17
+ "version": "2.3.0",
18
+ "tag": "@livepreso/content-react_v2.3.0",
19
+ "date": "Tue, 08 Sep 2026 00:30:21 GMT",
20
+ "comments": {
21
+ "minor": [
22
+ {
23
+ "comment": "Surface slidePath in useSlide() hook"
24
+ }
25
+ ]
26
+ }
27
+ },
4
28
  {
5
29
  "version": "2.2.2",
6
30
  "tag": "@livepreso/content-react_v2.2.2",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @livepreso/content-react
2
2
 
3
- This log was last generated on Thu, 03 Sep 2026 03:12:08 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 17 Sep 2026 01:30:15 GMT and should not be manually modified.
4
+
5
+ ## 2.3.1
6
+ Thu, 17 Sep 2026 01:30:15 GMT
7
+
8
+ ### Patches
9
+
10
+ - Generate correct key when fetching user template values from the context.
11
+
12
+ ## 2.3.0
13
+ Tue, 08 Sep 2026 00:30:21 GMT
14
+
15
+ ### Minor changes
16
+
17
+ - Surface slidePath in useSlide() hook
4
18
 
5
19
  ## 2.2.2
6
20
  Thu, 03 Sep 2026 03:12:08 GMT
package/lib/contexts.js CHANGED
@@ -4,6 +4,7 @@ export const SlideContext = React.createContext({
4
4
  transitions: null,
5
5
  slideID: null,
6
6
  slideKey: null,
7
+ slidePath: null,
7
8
  isCurrentSlide: false,
8
9
  isUserTemplate: false,
9
10
  isUserTemplateLibrary: false,
@@ -3,6 +3,7 @@ import { useTransitions } from "./use-transitions";
3
3
  import { useSlideContext } from "./use-slide-context.js";
4
4
  import { useSlide, useSlideModel } from "./slide.js";
5
5
  import { useModes } from "./use-modes.js";
6
+ import { getUserTemplateFieldKey } from "../utils.js";
6
7
 
7
8
  function useUserTemplateCMS(id) {
8
9
  const { slideID, presentationKey, isUserTemplate, isUserTemplateLibrary } =
@@ -11,7 +12,7 @@ function useUserTemplateCMS(id) {
11
12
  let contextKey;
12
13
 
13
14
  if (isUserTemplate) {
14
- contextKey = `_userTemplateCMSvals.${slideID}--${id}-${presentationKey}`;
15
+ contextKey = `_userTemplateCMSvals.${slideID}--${getUserTemplateFieldKey(id, slideID)}`;
15
16
  } else if (isUserTemplateLibrary) {
16
17
  contextKey = `_userTemplateCMSvals.${presentationKey}--${id}`;
17
18
  }
@@ -53,11 +54,21 @@ function useDefaultCMSValueFromPresomanager(id, { slidePath = null } = {}) {
53
54
  return cmsVals?.find?.((c) => c.key === key)?.value ?? null;
54
55
  }
55
56
 
56
- export function useCMSVal(id, { enabled = true, slidePath = null } = {}) {
57
+ export function useCMSVal(
58
+ id,
59
+ { enabled = true, slidePath: slidePathOverride = null } = {},
60
+ ) {
57
61
  const { entered, entering } = useTransitions();
58
62
  const { isPresomanager, isEmptyPreview, isCdk, isThumbnailScreenshot } =
59
63
  useModes();
60
- const { isUserTemplate, isUserTemplateLibrary } = useSlide();
64
+ const {
65
+ isUserTemplate,
66
+ isUserTemplateLibrary,
67
+ slidePath: ownSlidePath,
68
+ } = useSlide();
69
+
70
+ // Defaults to the calling slide's path.
71
+ const slidePath = slidePathOverride ?? ownSlidePath;
61
72
  const [userTemplateValue, setUserTemplateValue] = useUserTemplateCMS(id);
62
73
  const defaultFromPM = useDefaultCMSValueFromPresomanager(id, { slidePath });
63
74
 
@@ -7,6 +7,7 @@ export function useSlide() {
7
7
  slideID,
8
8
  slideKey,
9
9
  presentationKey,
10
+ slidePath,
10
11
  isSlideReady,
11
12
  doneRegister,
12
13
  isCurrentSlide,
@@ -22,6 +23,7 @@ export function useSlide() {
22
23
  slideID,
23
24
  slideKey,
24
25
  presentationKey,
26
+ slidePath,
25
27
  isSlideReady,
26
28
  doneRegister,
27
29
  isCurrentSlide,
@@ -25,6 +25,7 @@ export function useRootSlide(article) {
25
25
  const slideID = article.attr("id");
26
26
  const key = article.data("slide-key");
27
27
  const presentationKey = article.data("presentation-key") || slideID;
28
+ const slidePath = article.data("slide-path") || null;
28
29
  const isCurrent = article.closest(".presoSlide").hasClass("current");
29
30
  const [synced, setSynced] = useState(!isRemote);
30
31
  const [internalSlideState, setInternalSlideState] = useAsyncReference({});
@@ -45,7 +46,7 @@ export function useRootSlide(article) {
45
46
  exited: !isCurrent,
46
47
  });
47
48
 
48
- const updateState = (stateName) => (e) => {
49
+ const updateState = (stateName) => () => {
49
50
  setTransitions({
50
51
  ...DEFAULT_TRANSITION_STATE,
51
52
  [stateName]: true,
@@ -163,6 +164,10 @@ export function useRootSlide(article) {
163
164
  // If for whatever reason this isn't in the dom, we fall back to the ID.
164
165
  presentationKey,
165
166
 
167
+ // This is the data-slide-path on the article. Slide path represented as
168
+ // "deck/section/slide". Useful for Bridge commands that require a path.
169
+ slidePath,
170
+
166
171
  isCurrentSlide: isCurrent,
167
172
  doneRegister,
168
173
  rootElement: article.get(0),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livepreso/content-react",
3
- "version": "2.2.2",
3
+ "version": "2.3.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {