@storyblok/react 2.1.8 → 2.2.0
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/README.md +5 -1
- package/dist/storyblok-react4.js +1 -1
- package/dist/storyblok-react4.mjs +2 -2
- package/dist/types/story.d.ts +2 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -178,6 +178,7 @@ useStoryblok(
|
|
|
178
178
|
{ version: "draft", resolveRelations: ["Article.author"] },
|
|
179
179
|
{
|
|
180
180
|
resolveRelations: ["Article.author"],
|
|
181
|
+
resolveLinks: "url",
|
|
181
182
|
preventClicks: true,
|
|
182
183
|
}
|
|
183
184
|
);
|
|
@@ -271,7 +272,10 @@ export async function fetchData() {
|
|
|
271
272
|
}
|
|
272
273
|
```
|
|
273
274
|
|
|
274
|
-
`StoryblokStory` keeps the state for thet story behind the scenes and uses `StoryblokComponent` to render the route components dynamically, using the list of components loaded during the initialization inside the `storyblokInit` function. You can use the `StoryblokComponent` inside the components to
|
|
275
|
+
`StoryblokStory` keeps the state for thet story behind the scenes and uses `StoryblokComponent` to render the route components dynamically, using the list of components loaded during the initialization inside the `storyblokInit` function. You can use the `StoryblokComponent` inside the components to render the nested components dynamically. You can also pass bridge options to `StoryblokStory` using the prop `bridgeOptions`.
|
|
276
|
+
```js
|
|
277
|
+
<StoryblokStory story={data.story} bridgeOptions={bridgeOptions} />
|
|
278
|
+
```
|
|
275
279
|
|
|
276
280
|
> Note: To use this approach (with `getStoryblokApi`), you need to include the `apiPlugin` module when calling `storyblokInit` function. If you don't use `apiPlugin`, you can use your preferred method or function to fetch your data.
|
|
277
281
|
|
package/dist/storyblok-react4.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";const e=require("react"),t=require("./client-0cdf4d8e.js"),r=require("./index-364d653e.js");require("./storyblok-js-5db94779.js");const o=e.forwardRef((({story:o,...
|
|
1
|
+
"use strict";"use client";const e=require("react"),t=require("./client-0cdf4d8e.js"),r=require("./index-364d653e.js");require("./storyblok-js-5db94779.js");const o=e.forwardRef((({story:o,bridgeOptions:n,...s},c)=>("string"==typeof o.content&&(o.content=JSON.parse(o.content)),o=t.useStoryblokState(o,n),e.createElement(r.StoryblokComponent,{ref:c,blok:o.content,...s}))));module.exports=o;
|
|
@@ -4,11 +4,11 @@ import { u as useStoryblokState } from "./client-798eb80c.mjs";
|
|
|
4
4
|
import { S as StoryblokComponent } from "./index-4af66cd0.mjs";
|
|
5
5
|
import "./storyblok-js-5fd880b4.mjs";
|
|
6
6
|
const StoryblokStory = forwardRef(
|
|
7
|
-
({ story, ...restProps }, ref) => {
|
|
7
|
+
({ story, bridgeOptions, ...restProps }, ref) => {
|
|
8
8
|
if (typeof story.content === "string") {
|
|
9
9
|
story.content = JSON.parse(story.content);
|
|
10
10
|
}
|
|
11
|
-
story = useStoryblokState(story);
|
|
11
|
+
story = useStoryblokState(story, bridgeOptions);
|
|
12
12
|
return /* @__PURE__ */ React.createElement(StoryblokComponent, { ref, blok: story.content, ...restProps });
|
|
13
13
|
}
|
|
14
14
|
);
|
package/dist/types/story.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ISbStoryData } from "./types";
|
|
2
|
+
import { ISbStoryData, StoryblokBridgeConfigV2 } from "./types";
|
|
3
3
|
interface StoryblokStoryProps {
|
|
4
4
|
story: ISbStoryData;
|
|
5
|
+
bridgeOptions: StoryblokBridgeConfigV2;
|
|
5
6
|
[key: string]: unknown;
|
|
6
7
|
}
|
|
7
8
|
declare const StoryblokStory: React.ForwardRefExoticComponent<Omit<StoryblokStoryProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "SDK to integrate Storyblok into your project using React.",
|
|
5
5
|
"main": "./dist/storyblok-react.js",
|
|
6
6
|
"module": "./dist/storyblok-react.mjs",
|
|
@@ -44,25 +44,25 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build && cp ../README.md ./"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@storyblok/js": "^2.2.
|
|
47
|
+
"@storyblok/js": "^2.2.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/core": "^7.22.
|
|
51
|
-
"@babel/preset-env": "^7.22.
|
|
50
|
+
"@babel/core": "^7.22.9",
|
|
51
|
+
"@babel/preset-env": "^7.22.9",
|
|
52
52
|
"@cypress/react": "^5.12.5",
|
|
53
53
|
"@cypress/vite-dev-server": "^2.2.3",
|
|
54
54
|
"@tsconfig/recommended": "^1.0.2",
|
|
55
|
-
"@types/react": "18.2.
|
|
56
|
-
"@vitejs/plugin-react": "^4.0.
|
|
57
|
-
"babel-jest": "^29.
|
|
55
|
+
"@types/react": "18.2.15",
|
|
56
|
+
"@vitejs/plugin-react": "^4.0.3",
|
|
57
|
+
"babel-jest": "^29.6.1",
|
|
58
58
|
"cypress": "^9.7.0",
|
|
59
59
|
"eslint-plugin-cypress": "^2.13.3",
|
|
60
|
-
"eslint-plugin-jest": "^27.2.
|
|
61
|
-
"jest": "^29.6.
|
|
60
|
+
"eslint-plugin-jest": "^27.2.3",
|
|
61
|
+
"jest": "^29.6.1",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0",
|
|
64
64
|
"start-server-and-test": "^2.0.0",
|
|
65
|
-
"terser": "^5.
|
|
65
|
+
"terser": "^5.19.0",
|
|
66
66
|
"vite": "^4.1.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|