@storyblok/js 3.1.0-next.1 → 3.1.0-next.2

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 CHANGED
@@ -31,6 +31,7 @@
31
31
  </p>
32
32
 
33
33
  ## Kickstart a new project
34
+
34
35
  Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and a JavaScript frontend framework](https://www.storyblok.com/technologies?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-js)**, and get started in just a few minutes!
35
36
 
36
37
  ## Installation
@@ -144,7 +145,7 @@ You can pass [Bridge options](https://www.storyblok.com/docs/Guides/storyblok-la
144
145
  ```js
145
146
  useStoryblokBridge(story.id, (story) => (state.story = story), {
146
147
  resolveRelations: ["Article.author"],
147
- resolveLinks: "url"
148
+ resolveLinks: "url",
148
149
  });
149
150
  ```
150
151
 
@@ -1007,9 +1007,7 @@ function Ae(i = {}) {
1007
1007
  let A, C = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1008
1008
  const Ce = (i, e, t = {}) => {
1009
1009
  var c;
1010
- const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((c = window.location) == null ? void 0 : c.href).searchParams.get(
1011
- "_storyblok"
1012
- ) === i;
1010
+ const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((c = window.location) == null ? void 0 : c.href).searchParams.get("_storyblok") === i;
1013
1011
  if (!(!r || !o)) {
1014
1012
  if (!i) {
1015
1013
  console.warn("Story ID is not defined. Please provide a valid ID.");
@@ -1034,9 +1032,11 @@ const Ce = (i, e, t = {}) => {
1034
1032
  r.accessToken = r.accessToken || t;
1035
1033
  const c = { bridge: e, apiOptions: r };
1036
1034
  let a = {};
1037
- s.forEach((k) => {
1038
- a = { ...a, ...k(c) };
1039
- }), o && (C = o);
1035
+ s.forEach(
1036
+ (k) => {
1037
+ a = { ...a, ...k(c) };
1038
+ }
1039
+ ), o && (C = o);
1040
1040
  const u = !(typeof window > "u") && ((m = (p = window.location) == null ? void 0 : p.search) == null ? void 0 : m.includes("_storyblok_tk"));
1041
1041
  return e !== !1 && u && D(C), A = new x(n.schema), n.resolver && B(A, n.resolver), a;
1042
1042
  }, B = (i, e) => {
@@ -1048,7 +1048,9 @@ const Ce = (i, e, t = {}) => {
1048
1048
  html: s
1049
1049
  };
1050
1050
  });
1051
- }, xe = (i) => !i || !(i != null && i.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), Ne = (i, e, t) => {
1051
+ }, xe = (i) => !i || !(i != null && i.content.some(
1052
+ (e) => e.content || e.type === "blok" || e.type === "horizontal_rule"
1053
+ )), Ne = (i, e, t) => {
1052
1054
  let s = t || A;
1053
1055
  if (!s) {
1054
1056
  console.error(
@@ -1,7 +1,7 @@
1
+ import { type SbRichTextOptions as stdSbRichTextOptions } from "@storyblok/richtext";
1
2
  import { SbSDKOptions, StoryblokBridgeConfigV2, ISbStoryData, SbInitResult, ISbRichtext, StoryblokComponentType, SbRichTextOptions } from "./types";
2
3
  import { RichtextResolver } from "storyblok-js-client";
3
- import { type SbRichTextOptions as stdSbRichTextOptions } from "@storyblok/richtext";
4
- export declare const useStoryblokBridge: <T extends StoryblokComponentType<string> = any>(id: Number, cb: (newStory: ISbStoryData<T>) => void, options?: StoryblokBridgeConfigV2) => void;
4
+ export declare const useStoryblokBridge: <T extends StoryblokComponentType<string> = any>(id: number, cb: (newStory: ISbStoryData<T>) => void, options?: StoryblokBridgeConfigV2) => void;
5
5
  export declare const storyblokInit: (pluginOptions?: SbSDKOptions) => SbInitResult;
6
6
  export declare const isRichTextEmpty: (data?: ISbRichtext) => boolean;
7
7
  export declare const renderRichText: (data?: ISbRichtext, options?: SbRichTextOptions, resolverInstance?: RichtextResolver) => string;
@@ -15,5 +15,5 @@ export * from "./types";
15
15
  * This is a temporaly class to avoid type collision with the legacy richtext resolver.
16
16
  * It will become ~~`newSbRichTextOptions`~~ -> `SbRichTextOptions` on v4.x
17
17
  */
18
- export type newSbRichTextOptions = stdSbRichTextOptions;
18
+ export type newSbRichTextOptions<T = string, S = (tag: string, attrs: Record<string, any>, text: string) => T> = stdSbRichTextOptions<T, S>;
19
19
  export { BlockTypes, MarkTypes, richTextResolver, TextTypes, type SbRichTextDocumentNode, type SbRichTextNodeTypes, type SbRichTextNode, type SbRichTextResolvers, type SbRichTextNodeResolver, type SbRichTextImageOptimizationOptions, } from "@storyblok/richtext";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/js",
3
- "version": "3.1.0-next.1",
3
+ "version": "3.1.0-next.2",
4
4
  "description": "SDK to integrate Storyblok into your project using JavaScript.",
5
5
  "main": "./dist/storyblok-js.js",
6
6
  "module": "./dist/storyblok-js.mjs",