@storyblok/js 1.8.6 → 2.0.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 +6 -0
- package/dist/storyblok-js.js +2 -6
- package/dist/storyblok-js.mjs +486 -551
- package/dist/types/index.d.ts +4 -4
- package/dist/types/types.d.ts +27 -7
- package/package.json +6 -9
package/dist/types/index.d.ts
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
import { SbSDKOptions, StoryblokBridgeConfigV2,
|
2
|
-
|
3
|
-
export declare const useStoryblokBridge: <T extends StoryblokComponentType<string> = any>(id: Number, cb: (newStory:
|
1
|
+
import { SbSDKOptions, StoryblokBridgeConfigV2, ISbStoryData, SbInitResult, ISbRichtext, StoryblokComponentType, SbRichTextOptions } from "./types";
|
2
|
+
import { RichtextResolver } from "storyblok-js-client";
|
3
|
+
export declare const useStoryblokBridge: <T extends StoryblokComponentType<string> = any>(id: Number, cb: (newStory: ISbStoryData<T>) => void, options?: StoryblokBridgeConfigV2) => void;
|
4
4
|
export { useStoryblokBridge as registerStoryblokBridge };
|
5
5
|
export { default as apiPlugin } from "./modules/api";
|
6
6
|
export { default as storyblokEditable } from "./modules/editable";
|
7
7
|
export declare const storyblokInit: (pluginOptions?: SbSDKOptions) => SbInitResult;
|
8
|
-
export declare const renderRichText: (data:
|
8
|
+
export declare const renderRichText: (data: ISbRichtext, options?: SbRichTextOptions, resolverInstance?: RichtextResolver) => string;
|
9
9
|
export declare const loadStoryblokBridge: () => Promise<unknown>;
|
10
10
|
export * from "./types";
|
package/dist/types/types.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import StoryblokJSClient, {
|
1
|
+
import StoryblokJSClient, { ISbConfig, ISbComponentType, ISbStoryData } from "storyblok-js-client";
|
2
2
|
export declare type StoryblokClient = StoryblokJSClient;
|
3
3
|
declare global {
|
4
4
|
interface Window {
|
@@ -13,20 +13,29 @@ export interface SbInitResult {
|
|
13
13
|
}
|
14
14
|
export declare type SbPluginFactory = (options: SbSDKOptions) => any;
|
15
15
|
export declare type SbBlokKeyDataTypes = string | number | object | boolean | undefined;
|
16
|
-
export interface SbBlokData extends
|
16
|
+
export interface SbBlokData extends ISbComponentType<string> {
|
17
17
|
[index: string]: SbBlokKeyDataTypes;
|
18
18
|
}
|
19
19
|
export interface SbRichTextOptions {
|
20
|
-
schema?:
|
21
|
-
resolver?:
|
20
|
+
schema?: ISbConfig["richTextSchema"];
|
21
|
+
resolver?: ISbConfig["componentResolver"];
|
22
22
|
}
|
23
23
|
export interface SbSDKOptions {
|
24
24
|
bridge?: boolean;
|
25
25
|
accessToken?: string;
|
26
26
|
use?: any[];
|
27
|
-
apiOptions?:
|
27
|
+
apiOptions?: ISbConfig;
|
28
28
|
richText?: SbRichTextOptions;
|
29
29
|
}
|
30
|
+
export interface ISbEventPayload<S extends ISbComponentType<string> = any> {
|
31
|
+
action: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode";
|
32
|
+
event?: string;
|
33
|
+
story?: ISbStoryData<S>;
|
34
|
+
slug?: string;
|
35
|
+
slugChanged?: boolean;
|
36
|
+
storyId?: number;
|
37
|
+
reload?: boolean;
|
38
|
+
}
|
30
39
|
export interface StoryblokBridgeConfigV2 {
|
31
40
|
resolveRelations?: string[];
|
32
41
|
customParent?: string;
|
@@ -37,6 +46,17 @@ export interface StoryblokBridgeV2 {
|
|
37
46
|
pingEditor: (event: any) => void;
|
38
47
|
isInEditor: () => boolean;
|
39
48
|
enterEditmode: () => void;
|
40
|
-
on: (event: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode" | string[], callback: (payload?:
|
49
|
+
on: (event: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode" | string[], callback: (payload?: ISbEventPayload) => void) => void;
|
41
50
|
}
|
42
|
-
export type {
|
51
|
+
export type { ISbConfig, // previously StoryblokConfig
|
52
|
+
ISbCache, // previously StoryblokCache
|
53
|
+
ISbResult, // previously StoryblokResult
|
54
|
+
ISbResponse, ISbError, ISbNode, ISbSchema, ThrottleFn, AsyncFn, ArrayFn, ISbContentMangmntAPI, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
|
55
|
+
ISbStories, // previously Stories
|
56
|
+
ISbStory, // previously Story
|
57
|
+
ISbDimensions, ISbComponentType as StoryblokComponentType, ISbStoryData, // previously StoryData
|
58
|
+
ISbAlternateObject, // previously AlternateObject
|
59
|
+
ISbStoriesParams, // previously StoriesParams
|
60
|
+
ISbStoryParams, // previously StoryParams
|
61
|
+
ISbRichtext, // previously Richtext
|
62
|
+
RichtextResolver, } from "storyblok-js-client";
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storyblok/js",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0",
|
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",
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"dev": "vite build --watch",
|
19
19
|
"build": "vite build && tsc --project tsconfig.json",
|
20
20
|
"test": "npm run test:unit && npm run test:e2e",
|
21
|
-
"test:unit": "
|
21
|
+
"test:unit": "vitest run",
|
22
22
|
"test:e2e": "start-server-and-test cy:playground http-get://localhost:3000/ cy:run",
|
23
23
|
"test:e2e-watch": "start-server-and-test cy:playground http-get://localhost:3000/ cy:open",
|
24
24
|
"cy:playground": "npm run demo --prefix ../playground",
|
@@ -27,20 +27,17 @@
|
|
27
27
|
"prepublishOnly": "npm run build && cp ../README.md ./"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"storyblok-js-client": "^
|
30
|
+
"storyblok-js-client": "^5.1.1"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
33
|
-
"@babel/core": "^7.19.0",
|
34
|
-
"@babel/preset-env": "^7.19.0",
|
35
33
|
"@tsconfig/recommended": "^1.0.1",
|
36
|
-
"babel-jest": "^28.1.0",
|
37
34
|
"cypress": "^9.6.1",
|
38
35
|
"eslint-plugin-cypress": "^2.12.1",
|
39
36
|
"eslint-plugin-jest": "^26.9.0",
|
40
|
-
"
|
41
|
-
"jest-console": "^0.1.0",
|
37
|
+
"isomorphic-fetch": "^3.0.0",
|
42
38
|
"start-server-and-test": "^1.14.0",
|
43
|
-
"vite": "^2.9.15"
|
39
|
+
"vite": "^2.9.15",
|
40
|
+
"vitest": "^0.25.3"
|
44
41
|
},
|
45
42
|
"babel": {
|
46
43
|
"presets": [
|