@storyblok/js 3.1.9 → 3.2.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.
@@ -1,13 +1,64 @@
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
- export declare const storyblokInit: (pluginOptions?: SbSDKOptions) => SbInitResult;
5
- export declare const isRichTextEmpty: (data?: ISbRichtext) => boolean;
6
- export declare const renderRichText: (data?: ISbRichtext, options?: SbRichTextOptions, resolverInstance?: RichtextResolver) => string;
7
- export declare const loadStoryblokBridge: () => Promise<unknown>;
8
- export { useStoryblokBridge as registerStoryblokBridge };
9
- export { default as apiPlugin } from "./modules/api";
10
- export { default as storyblokEditable } from "./modules/editable";
11
- export { RichtextResolver as RichTextResolver, RichtextSchema as RichTextSchema, } from "storyblok-js-client";
12
- export * from "./types";
13
- export { BlockTypes, MarkTypes, richTextResolver, TextTypes, type StoryblokRichTextOptions, type StoryblokRichTextDocumentNode, type StoryblokRichTextNodeTypes, type StoryblokRichTextNode, type StoryblokRichTextResolvers, type StoryblokRichTextNodeResolver, type StoryblokRichTextImageOptimizationOptions, } from "@storyblok/richtext";
1
+ import { ISbComponentType, ISbConfig, ISbStoryData, default as StoryblokJSClient } from 'storyblok-js-client';
2
+ export type StoryblokClient = StoryblokJSClient;
3
+ declare global {
4
+ interface Window {
5
+ storyblokRegisterEvent: (cb: () => void) => void;
6
+ StoryblokBridge: {
7
+ new (options?: StoryblokBridgeConfigV2): StoryblokBridgeV2;
8
+ };
9
+ }
10
+ }
11
+ export interface SbInitResult {
12
+ storyblokApi?: StoryblokClient;
13
+ }
14
+ export type SbPluginFactory = (options: SbSDKOptions) => any;
15
+ export type SbBlokKeyDataTypes = string | number | object | boolean | undefined;
16
+ export interface SbBlokData extends ISbComponentType<string> {
17
+ [index: string]: SbBlokKeyDataTypes;
18
+ }
19
+ export interface SbRichTextOptions {
20
+ schema?: ISbConfig['richTextSchema'];
21
+ resolver?: ISbConfig['componentResolver'];
22
+ }
23
+ export interface SbSDKOptions {
24
+ bridge?: boolean;
25
+ accessToken?: string;
26
+ use?: any[];
27
+ apiOptions?: ISbConfig;
28
+ richText?: SbRichTextOptions;
29
+ bridgeUrl?: string;
30
+ }
31
+ export interface ISbEventPayload<S extends ISbComponentType<string> = any> {
32
+ action: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode';
33
+ event?: string;
34
+ story?: ISbStoryData<S>;
35
+ slug?: string;
36
+ slugChanged?: boolean;
37
+ storyId?: number;
38
+ reload?: boolean;
39
+ }
40
+ export interface StoryblokBridgeConfigV2 {
41
+ resolveRelations?: string | string[];
42
+ customParent?: string;
43
+ preventClicks?: boolean;
44
+ language?: string;
45
+ resolveLinks?: 'url' | 'story' | '0' | '1' | 'link';
46
+ }
47
+ export interface StoryblokBridgeV2 {
48
+ pingEditor: (event: any) => void;
49
+ isInEditor: () => boolean;
50
+ enterEditmode: () => void;
51
+ on: (event: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode' | string[], callback: (payload?: ISbEventPayload) => void) => void;
52
+ }
53
+ export type { ArrayFn, AsyncFn, ISbAlternateObject, // previously AlternateObject
54
+ ISbCache, // previously StoryblokCache
55
+ ISbComponentType as StoryblokComponentType, ISbConfig, // previously StoryblokConfig
56
+ ISbContentMangmntAPI, ISbDimensions, ISbError, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
57
+ ISbNode, ISbResponse, ISbResult, // previously StoryblokResult
58
+ ISbRichtext, // previously Richtext
59
+ ISbSchema, ISbStories, // previously Stories
60
+ ISbStoriesParams, // previously StoriesParams
61
+ ISbStory, // previously Story
62
+ ISbStoryData, // previously StoryData
63
+ ISbStoryParams, // previously StoryParams
64
+ ISbThrottle, ISbThrottledRequest, } from 'storyblok-js-client';
package/package.json CHANGED
@@ -1,90 +1,82 @@
1
1
  {
2
2
  "name": "@storyblok/js",
3
- "version": "3.1.9",
3
+ "type": "module",
4
+ "version": "3.2.1",
5
+ "private": false,
6
+ "packageManager": "pnpm@9.15.1",
4
7
  "description": "SDK to integrate Storyblok into your project using JavaScript.",
5
- "main": "./dist/storyblok-js.js",
6
- "module": "./dist/storyblok-js.mjs",
7
- "types": "./dist/types/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/storyblok/storyblok-js"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/storyblok/storyblok-js/issues"
15
+ },
11
16
  "exports": {
12
17
  ".": {
13
- "types": "./dist/types/index.d.ts",
18
+ "types": "./dist/index.d.ts",
14
19
  "import": "./dist/storyblok-js.mjs",
15
20
  "require": "./dist/storyblok-js.js"
16
21
  }
17
22
  },
23
+ "main": "./dist/storyblok-js.js",
24
+ "module": "./dist/storyblok-js.mjs",
25
+ "types": "./dist/index.d.ts",
26
+ "files": [
27
+ "dist"
28
+ ],
18
29
  "scripts": {
19
- "dev": "vite build --watch",
20
- "build": "vite build && tsc --project tsconfig.json",
21
- "test": "npm run test:unit && npm run test:e2e",
22
- "test:unit": "vitest run",
30
+ "dev": "vite",
31
+ "build": "vite build",
32
+ "test": "pnpm run test:unit:ci && pnpm run test:e2e",
33
+ "test:unit": "vitest",
34
+ "test:unit:ci": "vitest run",
35
+ "test:unit:ui": "vitest --ui",
23
36
  "test:e2e": "start-server-and-test cy:playground http://localhost:5173/ cy:run",
24
37
  "test:e2e-watch": "start-server-and-test cy:playground http://localhost:5173/ cy:open",
25
- "cy:playground": "npm run demo --prefix ../playground",
38
+ "cy:playground": "pnpm --filter='./playground/vanilla' dev",
39
+ "lint": "eslint .",
40
+ "lint:fix": "eslint . --fix",
26
41
  "cy:run": "cypress run",
27
- "cy:open": "cypress open",
28
- "prepublishOnly": "npm run build && cp ../README.md ./"
42
+ "cy:open": "cypress open"
29
43
  },
30
44
  "dependencies": {
31
- "@storyblok/richtext": "^3.0.0",
32
- "storyblok-js-client": "^6.10.3"
45
+ "@storyblok/richtext": "3.0.2",
46
+ "storyblok-js-client": "6.10.6"
33
47
  },
34
48
  "devDependencies": {
49
+ "@commitlint/cli": "^19.6.1",
50
+ "@commitlint/config-conventional": "^19.6.0",
51
+ "@storyblok/eslint-config": "^0.3.0",
35
52
  "@tsconfig/recommended": "^1.0.8",
36
- "cypress": "^13.16.0",
37
- "eslint-plugin-cypress": "^2.15.2",
38
- "eslint-plugin-jest": "^28.9.0",
39
- "isomorphic-fetch": "^3.0.0",
40
- "start-server-and-test": "^2.0.8",
41
- "vite": "^5.4.11",
42
- "vitest": "^2.1.5"
53
+ "@types/node": "^22.10.2",
54
+ "cypress": "^13.17.0",
55
+ "eslint": "^9.17.0",
56
+ "eslint-plugin-cypress": "^4.1.0",
57
+ "kolorist": "^1.8.0",
58
+ "pathe": "^1.1.2",
59
+ "simple-git-hooks": "^2.11.1",
60
+ "start-server-and-test": "^2.0.9",
61
+ "typescript": "^5.7.2",
62
+ "vite": "^6.0.5",
63
+ "vite-plugin-banner": "^0.8.0",
64
+ "vite-plugin-dts": "^4.4.0",
65
+ "vite-plugin-qrcode": "^0.2.3",
66
+ "vitest": "^2.1.8"
43
67
  },
44
- "babel": {
45
- "presets": [
46
- [
47
- "@babel/preset-env",
48
- {
49
- "targets": {
50
- "node": "current"
51
- }
52
- }
53
- ]
68
+ "commitlint": {
69
+ "extends": [
70
+ "@commitlint/config-conventional"
54
71
  ]
55
72
  },
56
- "jest": {
57
- "moduleFileExtensions": [
58
- "js",
59
- "json"
60
- ],
61
- "transform": {
62
- "^.+\\.js$": "babel-jest"
63
- }
64
- },
65
73
  "release": {
66
74
  "branches": [
67
- "main",
68
- {
69
- "name": "next",
70
- "prerelease": true
71
- },
72
- {
73
- "name": "beta",
74
- "prerelease": true
75
- }
75
+ "main"
76
76
  ]
77
77
  },
78
- "repository": {
79
- "type": "git",
80
- "url": "https://github.com/storyblok/storyblok-js"
81
- },
82
- "author": "Storyblok",
83
- "bugs": {
84
- "url": "https://github.com/storyblok/storyblok-js/issues"
85
- },
86
- "homepage": "https://github.com/storyblok/storyblok-js",
87
- "publishConfig": {
88
- "access": "public"
78
+ "simple-git-hooks": {
79
+ "pre-commit": "pnpm lint",
80
+ "pre-push": "pnpm commitlint --last --verbose"
89
81
  }
90
82
  }
@@ -1,9 +0,0 @@
1
- import { SbBlokData } from "../types";
2
- declare const _default: (blok: SbBlokData) => {
3
- "data-blok-c"?: undefined;
4
- "data-blok-uid"?: undefined;
5
- } | {
6
- "data-blok-c": string;
7
- "data-blok-uid": string;
8
- };
9
- export default _default;
@@ -1,63 +0,0 @@
1
- import StoryblokJSClient, { ISbConfig, ISbComponentType, ISbStoryData } from "storyblok-js-client";
2
- export type StoryblokClient = StoryblokJSClient;
3
- declare global {
4
- interface Window {
5
- storyblokRegisterEvent: (cb: Function) => void;
6
- StoryblokBridge: {
7
- new (options?: StoryblokBridgeConfigV2): StoryblokBridgeV2;
8
- };
9
- }
10
- }
11
- export interface SbInitResult {
12
- storyblokApi?: StoryblokClient;
13
- }
14
- export type SbPluginFactory = (options: SbSDKOptions) => any;
15
- export type SbBlokKeyDataTypes = string | number | object | boolean | undefined;
16
- export interface SbBlokData extends ISbComponentType<string> {
17
- [index: string]: SbBlokKeyDataTypes;
18
- }
19
- export interface SbRichTextOptions {
20
- schema?: ISbConfig["richTextSchema"];
21
- resolver?: ISbConfig["componentResolver"];
22
- }
23
- export interface SbSDKOptions {
24
- bridge?: boolean;
25
- accessToken?: string;
26
- use?: any[];
27
- apiOptions?: ISbConfig;
28
- richText?: SbRichTextOptions;
29
- bridgeUrl?: string;
30
- }
31
- export interface ISbEventPayload<S extends ISbComponentType<string> = any> {
32
- action: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode";
33
- event?: string;
34
- story?: ISbStoryData<S>;
35
- slug?: string;
36
- slugChanged?: boolean;
37
- storyId?: number;
38
- reload?: boolean;
39
- }
40
- export interface StoryblokBridgeConfigV2 {
41
- resolveRelations?: string | string[];
42
- customParent?: string;
43
- preventClicks?: boolean;
44
- language?: string;
45
- resolveLinks?: "url" | "story" | "0" | "1" | "link";
46
- }
47
- export interface StoryblokBridgeV2 {
48
- pingEditor: (event: any) => void;
49
- isInEditor: () => boolean;
50
- enterEditmode: () => void;
51
- on: (event: "customEvent" | "published" | "input" | "change" | "unpublished" | "enterEditmode" | string[], callback: (payload?: ISbEventPayload) => void) => void;
52
- }
53
- export type { ISbConfig, // previously StoryblokConfig
54
- ISbCache, // previously StoryblokCache
55
- ISbResult, // previously StoryblokResult
56
- ISbResponse, ISbError, ISbNode, ISbSchema, ISbThrottle, ISbThrottledRequest, AsyncFn, ArrayFn, ISbContentMangmntAPI, ISbManagmentApiResult, // previously StoryblokManagmentApiResult
57
- ISbStories, // previously Stories
58
- ISbStory, // previously Story
59
- ISbDimensions, ISbComponentType as StoryblokComponentType, ISbStoryData, // previously StoryData
60
- ISbAlternateObject, // previously AlternateObject
61
- ISbStoriesParams, // previously StoriesParams
62
- ISbStoryParams, // previously StoryParams
63
- ISbRichtext, } from "storyblok-js-client";
File without changes