diff --git a/lib/index.ts b/lib/index.ts index dc5dcadd..503e64cb 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -14,7 +14,7 @@ import { RichtextResolver } from "storyblok-js-client"; let richTextResolver; -const bridgeLatest = "https://app.storyblok.com/f/storyblok-v2-latest.js"; +let bridgeLatest = "https://app.storyblok.com/f/storyblok-v2-latest.js"; export const useStoryblokBridge = < T extends StoryblokComponentType = any @@ -62,6 +62,7 @@ export const storyblokInit = (pluginOptions: SbSDKOptions = {}) => { use = [], apiOptions = {}, richText = {}, + bridgeUrl } = pluginOptions; apiOptions.accessToken = apiOptions.accessToken || accessToken; @@ -74,6 +75,10 @@ export const storyblokInit = (pluginOptions: SbSDKOptions = {}) => { result = { ...result, ...pluginFactory(options) }; }); + if (bridgeUrl) { + bridgeLatest = bridgeUrl; + } + /* ** Load bridge if you are on the Visual Editor ** For more security: https://www.storyblok.com/faq/how-to-verify-the-preview-query-parameters-of-the-visual-editor diff --git a/lib/types.ts b/lib/types.ts index 3f3b611e..49d76718 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -35,6 +35,7 @@ export interface SbSDKOptions { use?: any[]; apiOptions?: ISbConfig; richText?: SbRichTextOptions; + bridgeUrl?: string; } export interface ISbEventPayload = any> {