@storyblok/svelte 2.3.6 → 2.3.8

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
@@ -32,17 +32,13 @@
32
32
  </a>
33
33
  </p>
34
34
 
35
- <!-- ## 🔎 TL; DR
35
+ ## 🚀 Usage
36
36
 
37
37
  `@storyblok/svelte` helps you connect your Svelte project to Storyblok by:
38
38
 
39
39
  - Providing the `getStoryblokApi` function to interact with the Storyblok APIs, using the [storyblok-js-client](https://github.com/storyblok/storyblok-js-client)
40
40
  - Enabling real time editing through the [Storyblok Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)
41
- - Providing the `StoryblokComponent` which allows you to connect your components to the Storyblok Visual Editor -->
42
-
43
- ## 🚀 Usage
44
-
45
- > If you are first-time user of the Storyblok, read the [Getting Started](https://www.storyblok.com/tp/add-a-headless-cms-to-svelte-in-5-minutes?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) guide to get a project ready in less than 5 minutes.
41
+ - Providing the `StoryblokComponent` which allows you to connect your components to the Storyblok Visual Editor
46
42
 
47
43
  ### Installation
48
44
 
@@ -50,10 +46,11 @@ Install `@storyblok/svelte`
50
46
 
51
47
  ```bash
52
48
  npm install @storyblok/svelte
53
- # yarn add @storyblok/svelte
54
49
  ```
55
50
 
56
- Initialize the library in your application (usually in `main.js`) by adding the `apiPlugin` and the [access token](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) of your Storyblok space:
51
+ Please note that you have to use npm - unfortunately we are currently not supporting yarn or pnpm for this SDK.
52
+
53
+ Initialize the library in your application by adding the `apiPlugin` and the [access token](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) of your Storyblok space:
57
54
 
58
55
  ```js
59
56
  import App from "./App.svelte";
@@ -62,232 +59,33 @@ import { storyblokInit, apiPlugin } from "@storyblok/svelte";
62
59
  storyblokInit({
63
60
  accessToken: "<your-token>",
64
61
  // bridge: false,
65
- // apiOptions: { },
66
62
  use: [apiPlugin],
63
+
67
64
  components: {
68
65
  teaser: Teaser,
69
66
  },
70
- });
71
- ```
72
-
73
- > Add all your components to the components object in the storyblokInit function. You can load all of them at the same time by adding them to the list.
74
-
75
- Now, all features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte), and _Storyblok Bridge_ for [real-time visual editing experience](https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte).
76
-
77
- > You can enable/disable some of these features if you don't need them, so you save some KB. Please read the "Features and API" section
78
-
79
- ### From a CDN
80
-
81
- Install the file from the CDN and access the methods via `window.storyblokSvelte`:
82
-
83
- ```html
84
- <script src="https://unpkg.com/@storyblok/svelte"></script>
85
- ```
86
-
87
- ## Getting started
88
-
89
- ### 1. Fetching Content
90
-
91
- Use the `getStoryblokApi()` gets your stories from the Storyblok CDN API:
92
-
93
- ```html
94
- <script>
95
- import { onMount } from "svelte";
96
- import { getStoryblokApi } from "@storyblok/svelte";
97
-
98
- onMount(async () => {
99
- const storyblokApi = getStoryblokApi();
100
- const { data } = await storyblokApi.get("cdn/stories/home", {
101
- version: "draft",
102
- });
103
- });
104
- </script>
105
- ```
106
-
107
- > Note: you can skip using `storyblokApi` if you prefer your own method or function to fetch your data.
108
-
109
- ### 2. Listen to Storyblok Visual Editor events
110
-
111
- Use `useStoryBridge` to get the updated story every time a change event is triggered from the Visual Editor. You need to pass the story id as first param, and a callback function as second param to update the new story:
112
-
113
- ```html
114
- <script>
115
- import { onMount } from "svelte";
116
- import { getStoryblokApi, useStoryblokBridge } from "@storyblok/svelte";
117
-
118
- let story = null;
119
-
120
- onMount(async () => {
121
- const storyblokApi = getStoryblokApi();
122
- const { data } = await storyblokApi.get("cdn/stories/home", {
123
- version: "draft",
124
- });
125
- story = data.story;
126
- useStoryblokBridge(story.id, (newStory) => (story = newStory));
127
- });
128
- </script>
129
- ```
130
-
131
- You can pass [Bridge options](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) as a third parameter as well:
132
-
133
- ```js
134
- useStoryblokBridge(story.id, (newStory) => (story = newStory), {
135
- resolveRelations: ["Article.author"],
136
- });
137
- ```
138
-
139
- ### 3. Link your components to Storyblok Visual Editor
140
-
141
- In order to link the storyblok components, you have to
142
-
143
- - Load them in components when calling `storyblokInit`
144
-
145
- - Use the `storyblokEditable` action on the root element of each component
146
-
147
- ```html
148
- <div use:storyblokEditable={blok} / >
149
- ```
150
-
151
- - Use the `StoryblokComponent` to load them by passing the blok property
152
-
153
- ```html
154
- <StoryblokComponent {blok} />
155
- ```
156
-
157
- > The `blok` is the actual blok data coming from [Storblok's Content Delivery API](https://www.storyblok.com/docs/api/content-delivery/v2?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte).
158
-
159
- ### Features and API
160
-
161
- You can **choose the features to use** when you initialize the plugin. In that way, you can improve Web Performance by optimizing your page load and save some bytes.
162
-
163
- #### Storyblok API
164
-
165
- You can use an `apiOptions` object. This is passed down to the [storyblok-js-client config object](https://github.com/storyblok/storyblok-js-client#class-storyblok):
166
-
167
- ```js
168
- storyblokInit({
169
- accessToken: "<your-token>",
170
- apiOptions: {
171
- //storyblok-js-client config object
172
- cache: { type: "memory" },
173
- },
174
- use: [apiPlugin],
175
- });
176
- ```
177
-
178
- If you prefer to use your own fetch method, just remove the `apiPlugin` and `storyblok-js-client` won't be added to your application. You can find out more about our [Content Delivery API](https://www.storyblok.com/docs/api/content-delivery?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte) in the documentation.
179
-
180
- #### Storyblok Bridge
181
-
182
- You can conditionally load it by using the `bridge` option. Very useful if you want to disable it in production:
183
-
184
- ```js
185
- storyblokInit({
186
- bridge: process.env.NODE_ENV !== "production",
187
- });
188
- ```
189
-
190
- Keep in mind you have still access to the raw `window.StoryblokBridge`:
191
-
192
- ```js
193
- const sbBridge = new window.StoryblokBridge(options);
194
-
195
- sbBridge.on(["input", "published", "change"], (event) => {
196
- // ...
197
- });
198
- ```
199
-
200
- For background information on the [Storyblok JS Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte), please check out documentation.
201
-
202
- ### Rendering Rich Text
203
-
204
- You can easily render rich text by using the `renderRichText`function that comes with `@storyblok/svelte`and Sveltes `{@html htmlstring}`directive.
205
-
206
- ```html
207
- <script>
208
- import { renderRichText } from "@storyblok/svelte";
209
-
210
- export let blok;
211
- $: articleHTML = renderRichText(blok.article);
212
- </script>
213
-
214
- <div>{@html articleHTML}</div>
215
- ```
216
-
217
- You can set a **custom Schema and component resolver globally** at init time by using the `richText` init option:
218
-
219
- ```js
220
- import { RichTextSchema, storyblokInit } from "@storyblok/svelte";
221
- import cloneDeep from "clone-deep";
222
-
223
- const mySchema = cloneDeep(RichTextSchema); // you can make a copy of the default RichTextSchema
224
- // ... and edit the nodes and marks, or add your own.
225
- // Check the base RichTextSchema source here https://github.com/storyblok/storyblok-js-client/blob/master/source/schema.js
226
-
227
- storyblokInit({
228
- accessToken: "<your-token>",
229
- richText: {
230
- schema: mySchema,
231
- resolver: (component, blok) => {
232
- switch (component) {
233
- case "my-custom-component":
234
- return `<div class="my-component-class">${blok.text}</div>`;
235
- default:
236
- return "Resolver not defined";
237
- }
238
- },
239
- },
240
- });
241
- ```
242
-
243
- You can also set a **custom Schema and component resolver only once** by passing the options as the second parameter to `renderRichText` function:
244
-
245
- ```js
246
- import { renderRichText } from "@storyblok/svelte";
247
-
248
- renderRichText(blok.richTextField, {
249
- schema: mySchema,
250
- resolver: (component, blok) => {
251
- switch (component) {
252
- case "my-custom-component":
253
- return `<div class="my-component-class">${blok.text}</div>`;
254
- break;
255
- default:
256
- return `Component ${component} not found`;
67
+ // if you are using a space located in US region
68
+ // you have to use apiOptions.region:
69
+ /*
70
+ apiOptions: {
71
+ region: "us" // region code here
257
72
  }
258
- },
73
+ */
259
74
  });
260
75
  ```
261
76
 
262
- ### Compatibility
263
-
264
- This plugin is for Svelte. Thus, it supports the [same browsers as Svelte 3](https://github.com/sveltejs/svelte/issues/558). In short: all modern browsers and IE10+.
265
-
266
- ## Troubleshooting
267
-
268
- ### Working with a Component Library
269
-
270
- When working with a component library, create an alias pointing '@storyblok/svelte' to './node_modules/@storyblok/svelte'. This will ensure the imported module will use the local version of storyblok. In your `svelte.config.js`, include:
271
-
272
- ```js
273
- kit: {
274
- alias: {
275
- '@storyblok/svelte': './node_modules/@storyblok/svelte'
276
- },
277
-
278
- ```
279
-
280
- Any module importing @storyblok/svelte will now get it from the aliased location. For more information and alternatives to this solution, please see [npm link, peerDependencies and webpack](https://penx.medium.com/managing-dependencies-in-a-node-package-so-that-they-are-compatible-with-npm-link-61befa5aaca7).
77
+ Add all your components to the components object in the storyblokInit function. You can load all of them at the same time by adding them to the list.
281
78
 
282
- Another option might also be using npm / yarn workspaces.
283
79
 
284
- ## 🔗 Related Links
80
+ ## ℹ️ More Resources
285
81
 
286
- - **[Add a headless CMS to Svelte in 5 minutes](https://www.storyblok.com/tp/add-a-headless-cms-to-svelte-in-5-minutes?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-svelte)**: Quick-start guide on getting up and running with Storyblok and Vue.
287
- - **[Storyblok CLI](https://github.com/storyblok/storyblok)**: A simple CLI for scaffolding Storyblok projects and fieldtypes.
288
- - [Svelte Documentation](https://svelte.dev/docs)
82
+ Please follow the step by step instructions available in [Ultimate Tutorial Series](https://www.storyblok.com/tp/the-storyblok-sveltekit-ultimate-tutorial). You can find all the different parts on this overview page and take it from here.
83
+ The parts are:
289
84
 
290
- ## ℹ️ More Resources
85
+ - Part 1: [Add a headless CMS to SvelteKit in 5 minutes](https://www.storyblok.com/tp/add-a-headless-cms-to-svelte-in-5-minutes) - [Source Code](https://github.com/storyblok/sveltekit-ultimate-tutorial-series/tree/part-1-sveltekit-ut)
86
+ - Part 2: [Render Storyblok Stories Dynamically in SvelteKit](https://www.storyblok.com/tp/render-storyblok-stories-dynamically-in-sveltekit) - [Source Code](https://github.com/storyblok/sveltekit-ultimate-tutorial-series/tree/part-2-sveltekit-ut)
87
+ - Part 3: [Create Dynamic Menus in Storyblok and SvelteKit](https://www.storyblok.com/tp/create-dynamic-menus-in-storyblok-and-sveltekit) - [Source Code](https://github.com/storyblok/sveltekit-ultimate-tutorial-series/tree/part-3-sveltekit-ut)
88
+ - Part 4: [Create Custom Components in Storyblok and SvelteKit](https://www.storyblok.com/tp/create-custom-components-in-storyblok-and-sveltekit) - [Source Code](https://github.com/storyblok/sveltekit-ultimate-tutorial-series/tree/part-4-sveltekit-ut)
291
89
 
292
90
  ### Support
293
91
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="svelte/types/runtime/ambient" />
2
1
  export { useStoryblokBridge, apiPlugin, renderRichText, RichTextSchema, } from "@storyblok/js";
3
2
  import type { SbSvelteSDKOptions, StoryblokClient, SbBlokData } from "./types";
4
3
  export declare const storyblokEditable: (node: HTMLElement, value: SbBlokData) => {
@@ -7,6 +6,6 @@ export declare const storyblokEditable: (node: HTMLElement, value: SbBlokData) =
7
6
  export declare const useStoryblokApi: () => StoryblokClient;
8
7
  export { useStoryblokApi as getStoryblokApi };
9
8
  export declare const storyblokInit: (options: SbSvelteSDKOptions) => void;
10
- export declare const getComponent: (componentName: string) => typeof import("*.svelte").default;
9
+ export declare const getComponent: (componentName: string) => any;
11
10
  export * from "./types";
12
11
  export { default as StoryblokComponent } from "./StoryblokComponent.svelte";
@@ -1,14 +1,14 @@
1
- (function(h,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h.storyblokSvelte={},h.e))})(this,function(h,m){"use strict";const ct=(r=>r&&typeof r=="object"&&"default"in r?r:{default:r})(m);var ut=Object.defineProperty,ht=Object.defineProperties,ft=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,B=(r,t,e)=>t in r?ut(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d=(r,t)=>{for(var e in t||(t={}))dt.call(t,e)&&B(r,e,t[e]);if(q)for(var e of q(t))pt.call(t,e)&&B(r,e,t[e]);return r},R=(r,t)=>ht(r,ft(t));let D=!1;const z=[],gt=r=>new Promise((t,e)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=s=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}D?s():z.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const n=document.createElement("script");n.async=!0,n.src=r,n.id="storyblok-javascript-bridge",n.onerror=s=>e(s),n.onload=s=>{z.forEach(o=>o()),D=!0,t(s)},document.getElementsByTagName("head")[0].appendChild(n)}),mt=function(r,t){if(!r)return null;let e={};for(let n in r){let s=r[n];t.indexOf(n)>-1&&s!==null&&(e[n]=s)}return e},yt=r=>r==="email";var U={nodes:{horizontal_rule(){return{singleTag:"hr"}},blockquote(){return{tag:"blockquote"}},bullet_list(){return{tag:"ul"}},code_block(r){return{tag:["pre",{tag:"code",attrs:r.attrs}]}},hard_break(){return{singleTag:"br"}},heading(r){return{tag:`h${r.attrs.level}`}},image(r){return{singleTag:[{tag:"img",attrs:mt(r.attrs,["src","alt","title"])}]}},list_item(){return{tag:"li"}},ordered_list(){return{tag:"ol"}},paragraph(){return{tag:"p"}}},marks:{bold(){return{tag:"b"}},strike(){return{tag:"strike"}},underline(){return{tag:"u"}},strong(){return{tag:"strong"}},code(){return{tag:"code"}},italic(){return{tag:"i"}},link(r){const t=d({},r.attrs),{linktype:e="url"}=r.attrs;return yt(e)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),{tag:[{tag:"a",attrs:t}]}},styled(r){return{tag:[{tag:"span",attrs:r.attrs}]}}}};const kt=function(r){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e=/[&<>"']/g,n=RegExp(e.source);return r&&n.test(r)?r.replace(e,s=>t[s]):r};class H{constructor(t){t||(t=U),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t={}){if(t.content&&Array.isArray(t.content)){let e="";return t.content.forEach(n=>{e+=this.renderNode(n)}),e}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(t){let e=[];t.marks&&t.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderOpeningTag(o.tag))});const n=this.getMatchingNode(t);return n&&n.tag&&e.push(this.renderOpeningTag(n.tag)),t.content?t.content.forEach(s=>{e.push(this.renderNode(s))}):t.text?e.push(kt(t.text)):n&&n.singleTag?e.push(this.renderTag(n.singleTag," /")):n&&n.html&&e.push(n.html),n&&n.tag&&e.push(this.renderClosingTag(n.tag)),t.marks&&t.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderClosingTag(o.tag))}),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map(s=>{if(s.constructor===String)return`<${s}${e}>`;{let o=`<${s.tag}`;if(s.attrs)for(let a in s.attrs){let i=s.attrs[a];i!==null&&(o+=` ${a}="${i}"`)}return`${o}${e}>`}}).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map(n=>n.constructor===String?`</${n}>`:`</${n.tag}>`).join("")}getMatchingNode(t){if(typeof this.nodes[t.type]=="function")return this.nodes[t.type](t)}getMatchingMark(t){if(typeof this.marks[t.type]=="function")return this.marks[t.type](t)}}/*!
1
+ (function(h,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("axios")):typeof define=="function"&&define.amd?define(["exports","axios"],m):(h=typeof globalThis<"u"?globalThis:h||self,m(h.storyblokSvelte={},h.e))})(this,function(h,m){"use strict";const ct=(r=>r&&typeof r=="object"&&"default"in r?r:{default:r})(m);var ut=Object.defineProperty,ht=Object.defineProperties,ft=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,pt=Object.prototype.propertyIsEnumerable,D=(r,t,e)=>t in r?ut(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,d=(r,t)=>{for(var e in t||(t={}))dt.call(t,e)&&D(r,e,t[e]);if(B)for(var e of B(t))pt.call(t,e)&&D(r,e,t[e]);return r},E=(r,t)=>ht(r,ft(t));let z=!1;const U=[],gt=r=>new Promise((t,e)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=s=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}z?s():U.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const n=document.createElement("script");n.async=!0,n.src=r,n.id="storyblok-javascript-bridge",n.onerror=s=>e(s),n.onload=s=>{U.forEach(o=>o()),z=!0,t(s)},document.getElementsByTagName("head")[0].appendChild(n)}),mt=function(r,t){if(!r)return null;let e={};for(let n in r){let s=r[n];t.indexOf(n)>-1&&s!==null&&(e[n]=s)}return e},yt=r=>r==="email";var H={nodes:{horizontal_rule(){return{singleTag:"hr"}},blockquote(){return{tag:"blockquote"}},bullet_list(){return{tag:"ul"}},code_block(r){return{tag:["pre",{tag:"code",attrs:r.attrs}]}},hard_break(){return{singleTag:"br"}},heading(r){return{tag:`h${r.attrs.level}`}},image(r){return{singleTag:[{tag:"img",attrs:mt(r.attrs,["src","alt","title"])}]}},list_item(){return{tag:"li"}},ordered_list(){return{tag:"ol"}},paragraph(){return{tag:"p"}}},marks:{bold(){return{tag:"b"}},strike(){return{tag:"strike"}},underline(){return{tag:"u"}},strong(){return{tag:"strong"}},code(){return{tag:"code"}},italic(){return{tag:"i"}},link(r){const t=d({},r.attrs),{linktype:e="url"}=r.attrs;return yt(e)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),{tag:[{tag:"a",attrs:t}]}},styled(r){return{tag:[{tag:"span",attrs:r.attrs}]}}}};const kt=function(r){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},e=/[&<>"']/g,n=RegExp(e.source);return r&&n.test(r)?r.replace(e,s=>t[s]):r};class V{constructor(t){t||(t=H),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t={}){if(t.content&&Array.isArray(t.content)){let e="";return t.content.forEach(n=>{e+=this.renderNode(n)}),e}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(t){let e=[];t.marks&&t.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderOpeningTag(o.tag))});const n=this.getMatchingNode(t);return n&&n.tag&&e.push(this.renderOpeningTag(n.tag)),t.content?t.content.forEach(s=>{e.push(this.renderNode(s))}):t.text?e.push(kt(t.text)):n&&n.singleTag?e.push(this.renderTag(n.singleTag," /")):n&&n.html&&e.push(n.html),n&&n.tag&&e.push(this.renderClosingTag(n.tag)),t.marks&&t.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderClosingTag(o.tag))}),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map(s=>{if(s.constructor===String)return`<${s}${e}>`;{let o=`<${s.tag}`;if(s.attrs)for(let a in s.attrs){let i=s.attrs[a];i!==null&&(o+=` ${a}="${i}"`)}return`${o}${e}>`}}).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map(n=>n.constructor===String?`</${n}>`:`</${n.tag}>`).join("")}getMatchingNode(t){if(typeof this.nodes[t.type]=="function")return this.nodes[t.type](t)}getMatchingMark(t){if(typeof this.marks[t.type]=="function")return this.marks[t.type](t)}}/*!
2
2
  * storyblok-js-client v4.5.2
3
3
  * Universal JavaScript SDK for Storyblok's API
4
4
  * (c) 2020-2022 Stobylok Team
5
- */function V(r){return typeof r=="number"&&r==r&&r!==1/0&&r!==-1/0}function J(r,t,e){if(!V(t))throw new TypeError("Expected `limit` to be a finite number");if(!V(e))throw new TypeError("Expected `interval` to be a finite number");var n=[],s=[],o=0,a=function(){o++;var l=setTimeout(function(){o--,n.length>0&&a(),s=s.filter(function(u){return u!==l})},e);s.indexOf(l)<0&&s.push(l);var c=n.shift();c.resolve(r.apply(c.self,c.args))},i=function(){var l=arguments,c=this;return new Promise(function(u,f){n.push({resolve:u,reject:f,args:l,self:c}),o<t&&a()})};return i.abort=function(){s.forEach(clearTimeout),s=[],n.forEach(function(l){l.reject(new throttle.AbortError)}),n.length=0},i}J.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const _t=function(r,t){if(!r)return null;let e={};for(let n in r){let s=r[n];t.indexOf(n)>-1&&s!==null&&(e[n]=s)}return e};var bt={nodes:{horizontal_rule:()=>({singleTag:"hr"}),blockquote:()=>({tag:"blockquote"}),bullet_list:()=>({tag:"ul"}),code_block:r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),hard_break:()=>({singleTag:"br"}),heading:r=>({tag:`h${r.attrs.level}`}),image:r=>({singleTag:[{tag:"img",attrs:_t(r.attrs,["src","alt","title"])}]}),list_item:()=>({tag:"li"}),ordered_list:()=>({tag:"ol"}),paragraph:()=>({tag:"p"})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link(r){const t=d({},r.attrs),{linktype:e="url"}=r.attrs;return e==="email"&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),{tag:[{tag:"a",attrs:t}]}},styled:r=>({tag:[{tag:"span",attrs:r.attrs}]})}};class vt{constructor(t){t||(t=bt),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t={}){if(t.content&&Array.isArray(t.content)){let e="";return t.content.forEach(n=>{e+=this.renderNode(n)}),e}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(t){let e=[];t.marks&&t.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderOpeningTag(o.tag))});const n=this.getMatchingNode(t);return n&&n.tag&&e.push(this.renderOpeningTag(n.tag)),t.content?t.content.forEach(s=>{e.push(this.renderNode(s))}):t.text?e.push(function(s){const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=/[&<>"']/g,i=RegExp(a.source);return s&&i.test(s)?s.replace(a,l=>o[l]):s}(t.text)):n&&n.singleTag?e.push(this.renderTag(n.singleTag," /")):n&&n.html&&e.push(n.html),n&&n.tag&&e.push(this.renderClosingTag(n.tag)),t.marks&&t.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderClosingTag(o.tag))}),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map(n=>{if(n.constructor===String)return`<${n}${e}>`;{let s=`<${n.tag}`;if(n.attrs)for(let o in n.attrs){let a=n.attrs[o];a!==null&&(s+=` ${o}="${a}"`)}return`${s}${e}>`}}).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map(e=>e.constructor===String?`</${e}>`:`</${e.tag}>`).join("")}getMatchingNode(t){if(typeof this.nodes[t.type]=="function")return this.nodes[t.type](t)}getMatchingMark(t){if(typeof this.marks[t.type]=="function")return this.marks[t.type](t)}}const $t=(r=0,t=r)=>{const e=Math.abs(t-r)||0,n=r<t?1:-1;return((s=0,o)=>[...Array(s)].map(o))(e,(s,o)=>o*n+r)},E=(r,t,e)=>{const n=[];for(const s in r){if(!Object.prototype.hasOwnProperty.call(r,s))continue;const o=r[s],a=e?"":encodeURIComponent(s);let i;i=typeof o=="object"?E(o,t?t+encodeURIComponent("["+a+"]"):a,Array.isArray(o)):(t?t+encodeURIComponent("["+a+"]"):a)+"="+encodeURIComponent(o),n.push(i)}return n.join("&")};let b={},g={};class wt{constructor(t,e){if(!e){let o=t.region?`-${t.region}`:"",a=t.https===!1?"http":"https";e=t.oauthToken===void 0?`${a}://api${o}.storyblok.com/v2`:`${a}://api${o}.storyblok.com/v1`}let n=Object.assign({},t.headers),s=5;t.oauthToken!==void 0&&(n.Authorization=t.oauthToken,s=3),t.rateLimit!==void 0&&(s=t.rateLimit),this.richTextResolver=new vt(t.richTextSchema),typeof t.componentResolver=="function"&&this.setComponentResolver(t.componentResolver),this.maxRetries=t.maxRetries||5,this.throttle=J(this.throttledRequest,s,1e3),this.accessToken=t.accessToken,this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.client=ct.default.create({baseURL:e,timeout:t.timeout||0,headers:n,proxy:t.proxy||!1}),t.responseInterceptor&&this.client.interceptors.response.use(o=>t.responseInterceptor(o)),this.resolveNestedRelations=t.resolveNestedRelations||!0}setComponentResolver(t){this.richTextResolver.addNode("blok",e=>{let n="";return e.attrs.body.forEach(s=>{n+=t(s.component,s)}),{html:n}})}parseParams(t={}){return t.version||(t.version="published"),t.token||(t.token=this.getToken()),t.cv||(t.cv=g[t.token]),Array.isArray(t.resolve_relations)&&(t.resolve_relations=t.resolve_relations.join(",")),t}factoryParamOptions(t,e={}){return((n="")=>n.indexOf("/cdn/")>-1)(t)?this.parseParams(e):e}makeRequest(t,e,n,s){const o=this.factoryParamOptions(t,((a={},i=25,l=1)=>R(d({},a),{per_page:i,page:l}))(e,n,s));return this.cacheResponse(t,o)}get(t,e){let n=`/${t}`;const s=this.factoryParamOptions(n,e);return this.cacheResponse(n,s)}async getAll(t,e={},n){const s=e.per_page||25,o=`/${t}`,a=o.split("/");n=n||a[a.length-1];const i=await this.makeRequest(o,e,s,1),l=i.total?Math.ceil(i.total/s):1;return((c=[],u)=>c.map(u).reduce((f,T)=>[...f,...T],[]))([i,...await(async(c=[],u)=>Promise.all(c.map(u)))($t(1,l),async c=>this.makeRequest(o,e,s,c+1))],c=>Object.values(c.data[n]))}post(t,e){let n=`/${t}`;return this.throttle("post",n,e)}put(t,e){let n=`/${t}`;return this.throttle("put",n,e)}delete(t,e){let n=`/${t}`;return this.throttle("delete",n,e)}getStories(t){return this.get("cdn/stories",t)}getStory(t,e){return this.get(`cdn/stories/${t}`,e)}setToken(t){this.accessToken=t}getToken(){return this.accessToken}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e){const n=t[e];n&&n.fieldtype=="multilink"&&n.linktype=="story"&&typeof n.id=="string"&&this.links[n.id]?n.story=this._cleanCopy(this.links[n.id]):n&&n.linktype==="story"&&typeof n.uuid=="string"&&this.links[n.uuid]&&(n.story=this._cleanCopy(this.links[n.uuid]))}_insertRelations(t,e,n){if(n.indexOf(t.component+"."+e)>-1){if(typeof t[e]=="string")this.relations[t[e]]&&(t[e]=this._cleanCopy(this.relations[t[e]]));else if(t[e].constructor===Array){let s=[];t[e].forEach(o=>{this.relations[o]&&s.push(this._cleanCopy(this.relations[o]))}),t[e]=s}}}_insertAssetsRelations(t,e){e.forEach(n=>{t.id===n.id&&(t.original=n,t.original.filename=t.filename,t.original.filename=t.original.filename.includes("https://s3.amazonaws.com/")?t.original.filename:t.original.filename.replace("https://","https://s3.amazonaws.com/"),delete t.original.s3_filename)})}iterateTree(t,e){let n=s=>{if(s!=null){if(s.constructor===Array)for(let o=0;o<s.length;o++)n(s[o]);else if(s.constructor===Object){if(s._stopResolving)return;for(let o in s)s.component&&s._uid||s.type==="link"?(this._insertRelations(s,o,e),this._insertLinks(s,o)):"id"in s&&s.fieldtype==="asset"&&this._insertAssetsRelations(s,e),n(s[o])}}};n(t.content)}async resolveLinks(t,e){let n=[];if(t.link_uuids){const s=t.link_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const l=Math.min(s,i+a);o.push(t.link_uuids.slice(i,l))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:e.language,version:e.version,by_uuids:o[i].join(",")})).data.stories.forEach(l=>{n.push(l)})}else n=t.links;n.forEach(s=>{this.links[s.uuid]=R(d({},s),{_stopResolving:!0})})}async resolveRelations(t,e){let n=[];if(t.rel_uuids){const s=t.rel_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const l=Math.min(s,i+a);o.push(t.rel_uuids.slice(i,l))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:e.language,version:e.version,by_uuids:o[i].join(",")})).data.stories.forEach(l=>{n.push(l)})}else n=t.rels;n.forEach(s=>{this.relations[s.uuid]=R(d({},s),{_stopResolving:!0})})}async resolveStories(t,e){let n=[];if(e.resolve_relations!==void 0&&e.resolve_relations.length>0&&(t.rels||t.rel_uuids)&&(n=e.resolve_relations.split(","),await this.resolveRelations(t,e)),["1","story","url"].indexOf(e.resolve_links)>-1&&(t.links||t.link_uuids)&&await this.resolveLinks(t,e),this.resolveNestedRelations)for(const s in this.relations)this.iterateTree(this.relations[s],n);t.story?this.iterateTree(t.story,n):t.stories.forEach(s=>{this.iterateTree(s,n)})}resolveAssetsRelations(t){const{assets:e,stories:n,story:s}=t;if(n)for(const o of n)this.iterateTree(o,e);else{if(!s)return t;this.iterateTree(s,e)}}cacheResponse(t,e,n){return n===void 0&&(n=0),new Promise(async(s,o)=>{let a=E({url:t,params:e}),i=this.cacheProvider();if(this.cache.clear==="auto"&&e.version==="draft"&&await this.flushCache(),e.version==="published"&&t!="/cdn/spaces/me"){const c=await i.get(a);if(c)return s(c)}try{let c=await this.throttle("get",t,{params:e,paramsSerializer:f=>E(f)}),u={data:c.data,headers:c.headers};if(u.data.assets&&u.data.assets.length&&this.resolveAssetsRelations(u.data),u=Object.assign({},u,{perPage:c.headers["per-page"]?parseInt(c.headers["per-page"]):0,total:c.headers["per-page"]?parseInt(c.headers.total):0}),c.status!=200)return o(c);(u.data.story||u.data.stories)&&await this.resolveStories(u.data,e),e.version==="published"&&t!="/cdn/spaces/me"&&i.set(a,u),u.data.cv&&(e.version=="draft"&&g[e.token]!=u.data.cv&&this.flushCache(),g[e.token]=u.data.cv),s(u)}catch(c){if(c.response&&c.response.status===429&&(n+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${n} seconds.`),await(l=1e3*n,new Promise(u=>setTimeout(u,l))),this.cacheResponse(t,e,n).then(s).catch(o);o(c)}var l})}throttledRequest(t,e,n){return this.client[t](e,n)}cacheVersions(){return g}cacheVersion(){return g[this.accessToken]}setCacheVersion(t){this.accessToken&&(g[this.accessToken]=t)}cacheProvider(){return this.cache.type==="memory"?{get:t=>b[t],getAll:()=>b,set(t,e){b[t]=e},flush(){b={}}}:{get(){},getAll(){},set(){},flush(){}}}async flushCache(){return await this.cacheProvider().flush(),this}}const Tt=(r={})=>{const{apiOptions:t}=r;if(!t.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new wt(t)}};var Rt=r=>{if(typeof r!="object"||typeof r._editable>"u")return{};const t=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(t),"data-blok-uid":t.id+"-"+t.uid}};let S;const Et="https://app.storyblok.com/f/storyblok-v2-latest.js",St=(r,t,e={})=>{if(!(typeof window>"u")){if(typeof window.storyblokRegisterEvent>"u"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}if(!r){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(e).on(["input","published","change"],s=>{s.action==="input"&&s.story.id===r?t(s.story):(s.action==="change"||s.action==="published")&&s.storyId===r&&window.location.reload()})})}},xt=(r={})=>{const{bridge:t,accessToken:e,use:n=[],apiOptions:s={},richText:o={}}=r;s.accessToken=s.accessToken||e;const a={bridge:t,apiOptions:s};let i={};return n.forEach(l=>{i=d(d({},i),l(a))}),t!==!1&&gt(Et),S=new H(o.schema),o.resolver&&Y(S,o.resolver),i},Y=(r,t)=>{r.addNode("blok",e=>{let n="";return e.attrs.body.forEach(s=>{n+=t(s.component,s)}),{html:n}})},Ot=(r,t,e)=>{let n=e||S;if(!n){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return r===""?"":r?(t&&(n=new H(t.schema),t.resolver&&Y(n,t.resolver)),n.render(r)):(console.warn(`${r} is not a valid Richtext object. This might be because the value of the richtext field is empty.
5
+ */function J(r){return typeof r=="number"&&r==r&&r!==1/0&&r!==-1/0}function Y(r,t,e){if(!J(t))throw new TypeError("Expected `limit` to be a finite number");if(!J(e))throw new TypeError("Expected `interval` to be a finite number");var n=[],s=[],o=0,a=function(){o++;var l=setTimeout(function(){o--,n.length>0&&a(),s=s.filter(function(u){return u!==l})},e);s.indexOf(l)<0&&s.push(l);var c=n.shift();c.resolve(r.apply(c.self,c.args))},i=function(){var l=arguments,c=this;return new Promise(function(u,f){n.push({resolve:u,reject:f,args:l,self:c}),o<t&&a()})};return i.abort=function(){s.forEach(clearTimeout),s=[],n.forEach(function(l){l.reject(new throttle.AbortError)}),n.length=0},i}Y.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const _t=function(r,t){if(!r)return null;let e={};for(let n in r){let s=r[n];t.indexOf(n)>-1&&s!==null&&(e[n]=s)}return e};var bt={nodes:{horizontal_rule:()=>({singleTag:"hr"}),blockquote:()=>({tag:"blockquote"}),bullet_list:()=>({tag:"ul"}),code_block:r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),hard_break:()=>({singleTag:"br"}),heading:r=>({tag:`h${r.attrs.level}`}),image:r=>({singleTag:[{tag:"img",attrs:_t(r.attrs,["src","alt","title"])}]}),list_item:()=>({tag:"li"}),ordered_list:()=>({tag:"ol"}),paragraph:()=>({tag:"p"})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link(r){const t=d({},r.attrs),{linktype:e="url"}=r.attrs;return e==="email"&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),{tag:[{tag:"a",attrs:t}]}},styled:r=>({tag:[{tag:"span",attrs:r.attrs}]})}};class vt{constructor(t){t||(t=bt),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t={}){if(t.content&&Array.isArray(t.content)){let e="";return t.content.forEach(n=>{e+=this.renderNode(n)}),e}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(t){let e=[];t.marks&&t.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderOpeningTag(o.tag))});const n=this.getMatchingNode(t);return n&&n.tag&&e.push(this.renderOpeningTag(n.tag)),t.content?t.content.forEach(s=>{e.push(this.renderNode(s))}):t.text?e.push(function(s){const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=/[&<>"']/g,i=RegExp(a.source);return s&&i.test(s)?s.replace(a,l=>o[l]):s}(t.text)):n&&n.singleTag?e.push(this.renderTag(n.singleTag," /")):n&&n.html&&e.push(n.html),n&&n.tag&&e.push(this.renderClosingTag(n.tag)),t.marks&&t.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&e.push(this.renderClosingTag(o.tag))}),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map(n=>{if(n.constructor===String)return`<${n}${e}>`;{let s=`<${n.tag}`;if(n.attrs)for(let o in n.attrs){let a=n.attrs[o];a!==null&&(s+=` ${o}="${a}"`)}return`${s}${e}>`}}).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map(e=>e.constructor===String?`</${e}>`:`</${e.tag}>`).join("")}getMatchingNode(t){if(typeof this.nodes[t.type]=="function")return this.nodes[t.type](t)}getMatchingMark(t){if(typeof this.marks[t.type]=="function")return this.marks[t.type](t)}}const $t=(r=0,t=r)=>{const e=Math.abs(t-r)||0,n=r<t?1:-1;return((s=0,o)=>[...Array(s)].map(o))(e,(s,o)=>o*n+r)},S=(r,t,e)=>{const n=[];for(const s in r){if(!Object.prototype.hasOwnProperty.call(r,s))continue;const o=r[s],a=e?"":encodeURIComponent(s);let i;i=typeof o=="object"?S(o,t?t+encodeURIComponent("["+a+"]"):a,Array.isArray(o)):(t?t+encodeURIComponent("["+a+"]"):a)+"="+encodeURIComponent(o),n.push(i)}return n.join("&")};let b={},g={};class wt{constructor(t,e){if(!e){let o=t.region?`-${t.region}`:"",a=t.https===!1?"http":"https";e=t.oauthToken===void 0?`${a}://api${o}.storyblok.com/v2`:`${a}://api${o}.storyblok.com/v1`}let n=Object.assign({},t.headers),s=5;t.oauthToken!==void 0&&(n.Authorization=t.oauthToken,s=3),t.rateLimit!==void 0&&(s=t.rateLimit),this.richTextResolver=new vt(t.richTextSchema),typeof t.componentResolver=="function"&&this.setComponentResolver(t.componentResolver),this.maxRetries=t.maxRetries||5,this.throttle=Y(this.throttledRequest,s,1e3),this.accessToken=t.accessToken,this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.client=ct.default.create({baseURL:e,timeout:t.timeout||0,headers:n,proxy:t.proxy||!1}),t.responseInterceptor&&this.client.interceptors.response.use(o=>t.responseInterceptor(o)),this.resolveNestedRelations=t.resolveNestedRelations||!0}setComponentResolver(t){this.richTextResolver.addNode("blok",e=>{let n="";return e.attrs.body.forEach(s=>{n+=t(s.component,s)}),{html:n}})}parseParams(t={}){return t.version||(t.version="published"),t.token||(t.token=this.getToken()),t.cv||(t.cv=g[t.token]),Array.isArray(t.resolve_relations)&&(t.resolve_relations=t.resolve_relations.join(",")),t}factoryParamOptions(t,e={}){return((n="")=>n.indexOf("/cdn/")>-1)(t)?this.parseParams(e):e}makeRequest(t,e,n,s){const o=this.factoryParamOptions(t,((a={},i=25,l=1)=>E(d({},a),{per_page:i,page:l}))(e,n,s));return this.cacheResponse(t,o)}get(t,e){let n=`/${t}`;const s=this.factoryParamOptions(n,e);return this.cacheResponse(n,s)}async getAll(t,e={},n){const s=e.per_page||25,o=`/${t}`,a=o.split("/");n=n||a[a.length-1];const i=await this.makeRequest(o,e,s,1),l=i.total?Math.ceil(i.total/s):1;return((c=[],u)=>c.map(u).reduce((f,R)=>[...f,...R],[]))([i,...await(async(c=[],u)=>Promise.all(c.map(u)))($t(1,l),async c=>this.makeRequest(o,e,s,c+1))],c=>Object.values(c.data[n]))}post(t,e){let n=`/${t}`;return this.throttle("post",n,e)}put(t,e){let n=`/${t}`;return this.throttle("put",n,e)}delete(t,e){let n=`/${t}`;return this.throttle("delete",n,e)}getStories(t){return this.get("cdn/stories",t)}getStory(t,e){return this.get(`cdn/stories/${t}`,e)}setToken(t){this.accessToken=t}getToken(){return this.accessToken}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e){const n=t[e];n&&n.fieldtype=="multilink"&&n.linktype=="story"&&typeof n.id=="string"&&this.links[n.id]?n.story=this._cleanCopy(this.links[n.id]):n&&n.linktype==="story"&&typeof n.uuid=="string"&&this.links[n.uuid]&&(n.story=this._cleanCopy(this.links[n.uuid]))}_insertRelations(t,e,n){if(n.indexOf(t.component+"."+e)>-1){if(typeof t[e]=="string")this.relations[t[e]]&&(t[e]=this._cleanCopy(this.relations[t[e]]));else if(t[e].constructor===Array){let s=[];t[e].forEach(o=>{this.relations[o]&&s.push(this._cleanCopy(this.relations[o]))}),t[e]=s}}}_insertAssetsRelations(t,e){e.forEach(n=>{t.id===n.id&&(t.original=n,t.original.filename=t.filename,t.original.filename=t.original.filename.includes("https://s3.amazonaws.com/")?t.original.filename:t.original.filename.replace("https://","https://s3.amazonaws.com/"),delete t.original.s3_filename)})}iterateTree(t,e){let n=s=>{if(s!=null){if(s.constructor===Array)for(let o=0;o<s.length;o++)n(s[o]);else if(s.constructor===Object){if(s._stopResolving)return;for(let o in s)s.component&&s._uid||s.type==="link"?(this._insertRelations(s,o,e),this._insertLinks(s,o)):"id"in s&&s.fieldtype==="asset"&&this._insertAssetsRelations(s,e),n(s[o])}}};n(t.content)}async resolveLinks(t,e){let n=[];if(t.link_uuids){const s=t.link_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const l=Math.min(s,i+a);o.push(t.link_uuids.slice(i,l))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:e.language,version:e.version,by_uuids:o[i].join(",")})).data.stories.forEach(l=>{n.push(l)})}else n=t.links;n.forEach(s=>{this.links[s.uuid]=E(d({},s),{_stopResolving:!0})})}async resolveRelations(t,e){let n=[];if(t.rel_uuids){const s=t.rel_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const l=Math.min(s,i+a);o.push(t.rel_uuids.slice(i,l))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:e.language,version:e.version,by_uuids:o[i].join(",")})).data.stories.forEach(l=>{n.push(l)})}else n=t.rels;n.forEach(s=>{this.relations[s.uuid]=E(d({},s),{_stopResolving:!0})})}async resolveStories(t,e){let n=[];if(e.resolve_relations!==void 0&&e.resolve_relations.length>0&&(t.rels||t.rel_uuids)&&(n=e.resolve_relations.split(","),await this.resolveRelations(t,e)),["1","story","url"].indexOf(e.resolve_links)>-1&&(t.links||t.link_uuids)&&await this.resolveLinks(t,e),this.resolveNestedRelations)for(const s in this.relations)this.iterateTree(this.relations[s],n);t.story?this.iterateTree(t.story,n):t.stories.forEach(s=>{this.iterateTree(s,n)})}resolveAssetsRelations(t){const{assets:e,stories:n,story:s}=t;if(n)for(const o of n)this.iterateTree(o,e);else{if(!s)return t;this.iterateTree(s,e)}}cacheResponse(t,e,n){return n===void 0&&(n=0),new Promise(async(s,o)=>{let a=S({url:t,params:e}),i=this.cacheProvider();if(this.cache.clear==="auto"&&e.version==="draft"&&await this.flushCache(),e.version==="published"&&t!="/cdn/spaces/me"){const c=await i.get(a);if(c)return s(c)}try{let c=await this.throttle("get",t,{params:e,paramsSerializer:f=>S(f)}),u={data:c.data,headers:c.headers};if(u.data.assets&&u.data.assets.length&&this.resolveAssetsRelations(u.data),u=Object.assign({},u,{perPage:c.headers["per-page"]?parseInt(c.headers["per-page"]):0,total:c.headers["per-page"]?parseInt(c.headers.total):0}),c.status!=200)return o(c);(u.data.story||u.data.stories)&&await this.resolveStories(u.data,e),e.version==="published"&&t!="/cdn/spaces/me"&&i.set(a,u),u.data.cv&&(e.version=="draft"&&g[e.token]!=u.data.cv&&this.flushCache(),g[e.token]=u.data.cv),s(u)}catch(c){if(c.response&&c.response.status===429&&(n+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${n} seconds.`),await(l=1e3*n,new Promise(u=>setTimeout(u,l))),this.cacheResponse(t,e,n).then(s).catch(o);o(c)}var l})}throttledRequest(t,e,n){return this.client[t](e,n)}cacheVersions(){return g}cacheVersion(){return g[this.accessToken]}setCacheVersion(t){this.accessToken&&(g[this.accessToken]=t)}cacheProvider(){return this.cache.type==="memory"?{get:t=>b[t],getAll:()=>b,set(t,e){b[t]=e},flush(){b={}}}:{get(){},getAll(){},set(){},flush(){}}}async flushCache(){return await this.cacheProvider().flush(),this}}const Tt=(r={})=>{const{apiOptions:t}=r;if(!t.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new wt(t)}};var Rt=r=>{if(typeof r!="object"||typeof r._editable>"u")return{};const t=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(t),"data-blok-uid":t.id+"-"+t.uid}};let x;const Et="https://app.storyblok.com/f/storyblok-v2-latest.js",St=(r,t,e={})=>{if(!(typeof window>"u")){if(typeof window.storyblokRegisterEvent>"u"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}if(!r){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(e).on(["input","published","change"],s=>{s.action==="input"&&s.story.id===r?t(s.story):(s.action==="change"||s.action==="published")&&s.storyId===r&&window.location.reload()})})}},xt=(r={})=>{const{bridge:t,accessToken:e,use:n=[],apiOptions:s={},richText:o={}}=r;s.accessToken=s.accessToken||e;const a={bridge:t,apiOptions:s};let i={};return n.forEach(l=>{i=d(d({},i),l(a))}),t!==!1&&gt(Et),x=new V(o.schema),o.resolver&&F(x,o.resolver),i},F=(r,t)=>{r.addNode("blok",e=>{let n="";return e.attrs.body.forEach(s=>{n+=t(s.component,s)}),{html:n}})},Ot=(r,t,e)=>{let n=e||x;if(!n){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return r===""?"":r?(t&&(n=new V(t.schema),t.resolver&&F(n,t.resolver)),n.render(r)):(console.warn(`${r} is not a valid Richtext object. This might be because the value of the richtext field is empty.
6
6
 
7
- For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`),"")};function x(){}function O(r,t){for(const e in t)r[e]=t[e];return r}function F(r){return r()}function K(){return Object.create(null)}function y(r){r.forEach(F)}function G(r){return typeof r=="function"}function jt(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Pt(r){return Object.keys(r).length===0}function At(r){const t={};for(const e in r)e[0]!=="$"&&(t[e]=r[e]);return t}function Q(r,t){const e={};t=new Set(t);for(const n in r)!t.has(n)&&n[0]!=="$"&&(e[n]=r[n]);return e}function Ct(r,t,e){r.insertBefore(t,e||null)}function W(r){r.parentNode.removeChild(r)}function Mt(r){return document.createTextNode(r)}function Nt(){return Mt("")}function It(r){return Array.from(r.childNodes)}function X(r,t){return new r(t)}let j;function k(r){j=r}const _=[],Z=[],v=[],tt=[],Lt=Promise.resolve();let P=!1;function qt(){P||(P=!0,Lt.then(et))}function A(r){v.push(r)}const C=new Set;let $=0;function et(){const r=j;do{for(;$<_.length;){const t=_[$];$++,k(t),Bt(t.$$)}for(k(null),_.length=0,$=0;Z.length;)Z.pop()();for(let t=0;t<v.length;t+=1){const e=v[t];C.has(e)||(C.add(e),e())}v.length=0}while(_.length);for(;tt.length;)tt.pop()();P=!1,C.clear(),k(r)}function Bt(r){if(r.fragment!==null){r.update(),y(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(A)}}const w=new Set;let p;function Dt(){p={r:0,c:[],p}}function zt(){p.r||y(p.c),p=p.p}function M(r,t){r&&r.i&&(w.delete(r),r.i(t))}function rt(r,t,e,n){if(r&&r.o){if(w.has(r))return;w.add(r),p.c.push(()=>{w.delete(r),n&&(e&&r.d(1),n())}),r.o(t)}else n&&n()}function Ut(r,t){const e={},n={},s={$$scope:1};let o=r.length;for(;o--;){const a=r[o],i=t[o];if(i){for(const l in a)l in i||(n[l]=1);for(const l in i)s[l]||(e[l]=i[l],s[l]=1);r[o]=i}else for(const l in a)s[l]=1}for(const a in n)a in e||(e[a]=void 0);return e}function Ht(r){return typeof r=="object"&&r!==null?r:{}}function nt(r){r&&r.c()}function N(r,t,e,n){const{fragment:s,after_update:o}=r.$$;s&&s.m(t,e),n||A(()=>{const a=r.$$.on_mount.map(F).filter(G);r.$$.on_destroy?r.$$.on_destroy.push(...a):y(a),r.$$.on_mount=[]}),o.forEach(A)}function I(r,t){const e=r.$$;e.fragment!==null&&(y(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Vt(r,t){r.$$.dirty[0]===-1&&(_.push(r),qt(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function Jt(r,t,e,n,s,o,a,i=[-1]){const l=j;k(r);const c=r.$$={fragment:null,ctx:[],props:o,update:x,not_equal:s,bound:K(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:K(),dirty:i,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let u=!1;if(c.ctx=e?e(r,t.props||{},(f,T,...at)=>{const lt=at.length?at[0]:T;return c.ctx&&s(c.ctx[f],c.ctx[f]=lt)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](lt),u&&Vt(r,f)),T}):[],c.update(),u=!0,y(c.before_update),c.fragment=n?n(c.ctx):!1,t.target){if(t.hydrate){const f=It(t.target);c.fragment&&c.fragment.l(f),f.forEach(W)}else c.fragment&&c.fragment.c();t.intro&&M(r.$$.fragment),N(r,t.target,t.anchor,t.customElement),et()}k(l)}class Yt{$destroy(){I(this,1),this.$destroy=x}$on(t,e){if(!G(e))return x;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const s=n.indexOf(e);s!==-1&&n.splice(s,1)}}$set(t){this.$$set&&!Pt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Ft(r){let t,e,n;const s=[{blok:r[0]},r[2]];var o=r[1];function a(i){let l={};for(let c=0;c<s.length;c+=1)l=O(l,s[c]);return{props:l}}return o&&(t=X(o,a())),{c(){t&&nt(t.$$.fragment),e=Nt()},m(i,l){t&&N(t,i,l),Ct(i,e,l),n=!0},p(i,[l]){const c=l&5?Ut(s,[l&1&&{blok:i[0]},l&4&&Ht(i[2])]):{};if(o!==(o=i[1])){if(t){Dt();const u=t;rt(u.$$.fragment,1,0,()=>{I(u,1)}),zt()}o?(t=X(o,a()),nt(t.$$.fragment),M(t.$$.fragment,1),N(t,e.parentNode,e)):t=null}else o&&t.$set(c)},i(i){n||(t&&M(t.$$.fragment,i),n=!0)},o(i){t&&rt(t.$$.fragment,i),n=!1},d(i){i&&W(e),t&&I(t,i)}}}function Kt(r,t,e){const n=["blok"];let s=Q(t,n),o,{blok:a}=t;return a?o=it(a.component):console.error("Please provide a 'blok' property to the StoryblokComponent"),r.$$set=i=>{t=O(O({},t),At(i)),e(2,s=Q(t,n)),"blok"in i&&e(0,a=i.blok)},[a,o,s]}class Gt extends Yt{constructor(t){super(),Jt(this,t,Kt,Ft,jt,{blok:0})}}const Qt=(r,t)=>{const e=n=>{const s=Rt(n);s["data-blok-c"]&&(r.setAttribute("data-blok-c",s["data-blok-c"]),r.setAttribute("data-blok-uid",s["data-blok-uid"]),r.classList.add("storyblok__outline"))};return e(t),{update(n){e(n)}}};let L=null;const st=()=>(L||console.log("You can't use getStoryblokApi if you're not loading apiPlugin."),L);let ot=null;const Wt=r=>{const{storyblokApi:t}=xt(r);L=t,ot=r.components||{}},it=r=>{const t=ot[r];return t||console.error(`You didn't load the ${r} component. Please load it in storyblokInit. For example:
7
+ For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`),"")};function O(){}function j(r,t){for(const e in t)r[e]=t[e];return r}function K(r){return r()}function G(){return Object.create(null)}function y(r){r.forEach(K)}function Q(r){return typeof r=="function"}function jt(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Pt(r){return Object.keys(r).length===0}function At(r){const t={};for(const e in r)e[0]!=="$"&&(t[e]=r[e]);return t}function W(r,t){const e={};t=new Set(t);for(const n in r)!t.has(n)&&n[0]!=="$"&&(e[n]=r[n]);return e}function Ct(r,t,e){r.insertBefore(t,e||null)}function X(r){r.parentNode&&r.parentNode.removeChild(r)}function Mt(r){return document.createTextNode(r)}function Nt(){return Mt("")}function It(r){return Array.from(r.childNodes)}function Z(r,t){return new r(t)}let P;function k(r){P=r}const _=[],tt=[],v=[],et=[],Lt=Promise.resolve();let A=!1;function qt(){A||(A=!0,Lt.then(rt))}function C(r){v.push(r)}const M=new Set;let $=0;function rt(){const r=P;do{for(;$<_.length;){const t=_[$];$++,k(t),Bt(t.$$)}for(k(null),_.length=0,$=0;tt.length;)tt.pop()();for(let t=0;t<v.length;t+=1){const e=v[t];M.has(e)||(M.add(e),e())}v.length=0}while(_.length);for(;et.length;)et.pop()();A=!1,M.clear(),k(r)}function Bt(r){if(r.fragment!==null){r.update(),y(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(C)}}const w=new Set;let p;function Dt(){p={r:0,c:[],p}}function zt(){p.r||y(p.c),p=p.p}function N(r,t){r&&r.i&&(w.delete(r),r.i(t))}function nt(r,t,e,n){if(r&&r.o){if(w.has(r))return;w.add(r),p.c.push(()=>{w.delete(r),n&&(e&&r.d(1),n())}),r.o(t)}else n&&n()}function Ut(r,t){const e={},n={},s={$$scope:1};let o=r.length;for(;o--;){const a=r[o],i=t[o];if(i){for(const l in a)l in i||(n[l]=1);for(const l in i)s[l]||(e[l]=i[l],s[l]=1);r[o]=i}else for(const l in a)s[l]=1}for(const a in n)a in e||(e[a]=void 0);return e}function Ht(r){return typeof r=="object"&&r!==null?r:{}}function st(r){r&&r.c()}function I(r,t,e,n){const{fragment:s,after_update:o}=r.$$;s&&s.m(t,e),n||C(()=>{const a=r.$$.on_mount.map(K).filter(Q);r.$$.on_destroy?r.$$.on_destroy.push(...a):y(a),r.$$.on_mount=[]}),o.forEach(C)}function L(r,t){const e=r.$$;e.fragment!==null&&(y(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Vt(r,t){r.$$.dirty[0]===-1&&(_.push(r),qt(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function Jt(r,t,e,n,s,o,a,i=[-1]){const l=P;k(r);const c=r.$$={fragment:null,ctx:[],props:o,update:O,not_equal:s,bound:G(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:G(),dirty:i,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let u=!1;if(c.ctx=e?e(r,t.props||{},(f,R,...at)=>{const lt=at.length?at[0]:R;return c.ctx&&s(c.ctx[f],c.ctx[f]=lt)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](lt),u&&Vt(r,f)),R}):[],c.update(),u=!0,y(c.before_update),c.fragment=n?n(c.ctx):!1,t.target){if(t.hydrate){const f=It(t.target);c.fragment&&c.fragment.l(f),f.forEach(X)}else c.fragment&&c.fragment.c();t.intro&&N(r.$$.fragment),I(r,t.target,t.anchor,t.customElement),rt()}k(l)}class Yt{$destroy(){L(this,1),this.$destroy=O}$on(t,e){if(!Q(e))return O;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const s=n.indexOf(e);s!==-1&&n.splice(s,1)}}$set(t){this.$$set&&!Pt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Ft(r){let t,e,n;const s=[{blok:r[0]},r[2]];var o=r[1];function a(i){let l={};for(let c=0;c<s.length;c+=1)l=j(l,s[c]);return{props:l}}return o&&(t=Z(o,a())),{c(){t&&st(t.$$.fragment),e=Nt()},m(i,l){t&&I(t,i,l),Ct(i,e,l),n=!0},p(i,[l]){const c=l&5?Ut(s,[l&1&&{blok:i[0]},l&4&&Ht(i[2])]):{};if(o!==(o=i[1])){if(t){Dt();const u=t;nt(u.$$.fragment,1,0,()=>{L(u,1)}),zt()}o?(t=Z(o,a()),st(t.$$.fragment),N(t.$$.fragment,1),I(t,e.parentNode,e)):t=null}else o&&t.$set(c)},i(i){n||(t&&N(t.$$.fragment,i),n=!0)},o(i){t&&nt(t.$$.fragment,i),n=!1},d(i){i&&X(e),t&&L(t,i)}}}function Kt(r,t,e){const n=["blok"];let s=W(t,n),o,{blok:a}=t;return a?o=it(a.component):console.error("Please provide a 'blok' property to the StoryblokComponent"),r.$$set=i=>{t=j(j({},t),At(i)),e(2,s=W(t,n)),"blok"in i&&e(0,a=i.blok)},[a,o,s]}class Gt extends Yt{constructor(t){super(),Jt(this,t,Kt,Ft,jt,{blok:0})}}const Qt=(r,t)=>{const e=n=>{const s=Rt(n);s["data-blok-c"]&&(r.setAttribute("data-blok-c",s["data-blok-c"]),r.setAttribute("data-blok-uid",s["data-blok-uid"]),r.classList.add("storyblok__outline"))};return e(t),{update(n){e(n)}}};let q=null;const ot=()=>(q||console.log("You can't use getStoryblokApi if you're not loading apiPlugin."),q);let T=null;const Wt=r=>{const{storyblokApi:t}=xt(r);q=t,T=r.components||{}},it=r=>{let t=null;return t=typeof T=="function"?T()[r]:T[r],t||console.error(`You didn't load the ${r} component. Please load it in storyblokInit. For example:
8
8
  storyblokInit({
9
9
  accessToken: "<your-token>",
10
10
  components: {
11
11
  "teaser": Teaser
12
12
  }
13
13
  })
14
- `),t};h.RichTextSchema=U,h.StoryblokComponent=Gt,h.apiPlugin=Tt,h.getComponent=it,h.getStoryblokApi=st,h.renderRichText=Ot,h.storyblokEditable=Qt,h.storyblokInit=Wt,h.useStoryblokApi=st,h.useStoryblokBridge=St,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ `),t};h.RichTextSchema=H,h.StoryblokComponent=Gt,h.apiPlugin=Tt,h.getComponent=it,h.getStoryblokApi=ot,h.renderRichText=Ot,h.storyblokEditable=Qt,h.storyblokInit=Wt,h.useStoryblokApi=ot,h.useStoryblokBridge=St,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,25 +1,25 @@
1
1
  import st from "axios";
2
- var ot = Object.defineProperty, it = Object.defineProperties, at = Object.getOwnPropertyDescriptors, L = Object.getOwnPropertySymbols, lt = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable, B = (r, t, e) => t in r ? ot(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, d = (r, t) => {
2
+ var ot = Object.defineProperty, it = Object.defineProperties, at = Object.getOwnPropertyDescriptors, B = Object.getOwnPropertySymbols, lt = Object.prototype.hasOwnProperty, ct = Object.prototype.propertyIsEnumerable, z = (r, t, e) => t in r ? ot(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e, d = (r, t) => {
3
3
  for (var e in t || (t = {}))
4
- lt.call(t, e) && B(r, e, t[e]);
5
- if (L)
6
- for (var e of L(t))
7
- ct.call(t, e) && B(r, e, t[e]);
4
+ lt.call(t, e) && z(r, e, t[e]);
5
+ if (B)
6
+ for (var e of B(t))
7
+ ct.call(t, e) && z(r, e, t[e]);
8
8
  return r;
9
- }, w = (r, t) => it(r, at(t));
10
- let z = !1;
11
- const D = [], ut = (r) => new Promise((t, e) => {
9
+ }, T = (r, t) => it(r, at(t));
10
+ let D = !1;
11
+ const U = [], ut = (r) => new Promise((t, e) => {
12
12
  if (typeof window > "u" || (window.storyblokRegisterEvent = (s) => {
13
13
  if (window.location === window.parent.location) {
14
14
  console.warn("You are not in Draft Mode or in the Visual Editor.");
15
15
  return;
16
16
  }
17
- z ? s() : D.push(s);
17
+ D ? s() : U.push(s);
18
18
  }, document.getElementById("storyblok-javascript-bridge")))
19
19
  return;
20
20
  const n = document.createElement("script");
21
21
  n.async = !0, n.src = r, n.id = "storyblok-javascript-bridge", n.onerror = (s) => e(s), n.onload = (s) => {
22
- D.forEach((o) => o()), z = !0, t(s);
22
+ U.forEach((o) => o()), D = !0, t(s);
23
23
  }, document.getElementsByTagName("head")[0].appendChild(n);
24
24
  }), ht = function(r, t) {
25
25
  if (!r)
@@ -159,7 +159,7 @@ const pt = function(r) {
159
159
  }, e = /[&<>"']/g, n = RegExp(e.source);
160
160
  return r && n.test(r) ? r.replace(e, (s) => t[s]) : r;
161
161
  };
162
- class Q {
162
+ class W {
163
163
  constructor(t) {
164
164
  t || (t = dt), this.marks = t.marks || [], this.nodes = t.nodes || [];
165
165
  }
@@ -227,13 +227,13 @@ class Q {
227
227
  * Universal JavaScript SDK for Storyblok's API
228
228
  * (c) 2020-2022 Stobylok Team
229
229
  */
230
- function U(r) {
230
+ function H(r) {
231
231
  return typeof r == "number" && r == r && r !== 1 / 0 && r !== -1 / 0;
232
232
  }
233
- function W(r, t, e) {
234
- if (!U(t))
233
+ function X(r, t, e) {
234
+ if (!H(t))
235
235
  throw new TypeError("Expected `limit` to be a finite number");
236
- if (!U(e))
236
+ if (!H(e))
237
237
  throw new TypeError("Expected `interval` to be a finite number");
238
238
  var n = [], s = [], o = 0, a = function() {
239
239
  o++;
@@ -257,7 +257,7 @@ function W(r, t, e) {
257
257
  }), n.length = 0;
258
258
  }, i;
259
259
  }
260
- W.AbortError = function() {
260
+ X.AbortError = function() {
261
261
  Error.call(this, "Throttled function aborted"), this.name = "AbortError";
262
262
  };
263
263
  const gt = function(r, t) {
@@ -343,14 +343,14 @@ class yt {
343
343
  const kt = (r = 0, t = r) => {
344
344
  const e = Math.abs(t - r) || 0, n = r < t ? 1 : -1;
345
345
  return ((s = 0, o) => [...Array(s)].map(o))(e, (s, o) => o * n + r);
346
- }, R = (r, t, e) => {
346
+ }, x = (r, t, e) => {
347
347
  const n = [];
348
348
  for (const s in r) {
349
349
  if (!Object.prototype.hasOwnProperty.call(r, s))
350
350
  continue;
351
351
  const o = r[s], a = e ? "" : encodeURIComponent(s);
352
352
  let i;
353
- i = typeof o == "object" ? R(o, t ? t + encodeURIComponent("[" + a + "]") : a, Array.isArray(o)) : (t ? t + encodeURIComponent("[" + a + "]") : a) + "=" + encodeURIComponent(o), n.push(i);
353
+ i = typeof o == "object" ? x(o, t ? t + encodeURIComponent("[" + a + "]") : a, Array.isArray(o)) : (t ? t + encodeURIComponent("[" + a + "]") : a) + "=" + encodeURIComponent(o), n.push(i);
354
354
  }
355
355
  return n.join("&");
356
356
  };
@@ -362,7 +362,7 @@ class _t {
362
362
  e = t.oauthToken === void 0 ? `${a}://api${o}.storyblok.com/v2` : `${a}://api${o}.storyblok.com/v1`;
363
363
  }
364
364
  let n = Object.assign({}, t.headers), s = 5;
365
- t.oauthToken !== void 0 && (n.Authorization = t.oauthToken, s = 3), t.rateLimit !== void 0 && (s = t.rateLimit), this.richTextResolver = new yt(t.richTextSchema), typeof t.componentResolver == "function" && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries || 5, this.throttle = W(this.throttledRequest, s, 1e3), this.accessToken = t.accessToken, this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.client = st.create({ baseURL: e, timeout: t.timeout || 0, headers: n, proxy: t.proxy || !1 }), t.responseInterceptor && this.client.interceptors.response.use((o) => t.responseInterceptor(o)), this.resolveNestedRelations = t.resolveNestedRelations || !0;
365
+ t.oauthToken !== void 0 && (n.Authorization = t.oauthToken, s = 3), t.rateLimit !== void 0 && (s = t.rateLimit), this.richTextResolver = new yt(t.richTextSchema), typeof t.componentResolver == "function" && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries || 5, this.throttle = X(this.throttledRequest, s, 1e3), this.accessToken = t.accessToken, this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.client = st.create({ baseURL: e, timeout: t.timeout || 0, headers: n, proxy: t.proxy || !1 }), t.responseInterceptor && this.client.interceptors.response.use((o) => t.responseInterceptor(o)), this.resolveNestedRelations = t.resolveNestedRelations || !0;
366
366
  }
367
367
  setComponentResolver(t) {
368
368
  this.richTextResolver.addNode("blok", (e) => {
@@ -379,7 +379,7 @@ class _t {
379
379
  return ((n = "") => n.indexOf("/cdn/") > -1)(t) ? this.parseParams(e) : e;
380
380
  }
381
381
  makeRequest(t, e, n, s) {
382
- const o = this.factoryParamOptions(t, ((a = {}, i = 25, l = 1) => w(d({}, a), { per_page: i, page: l }))(e, n, s));
382
+ const o = this.factoryParamOptions(t, ((a = {}, i = 25, l = 1) => T(d({}, a), { per_page: i, page: l }))(e, n, s));
383
383
  return this.cacheResponse(t, o);
384
384
  }
385
385
  get(t, e) {
@@ -474,7 +474,7 @@ class _t {
474
474
  } else
475
475
  n = t.links;
476
476
  n.forEach((s) => {
477
- this.links[s.uuid] = w(d({}, s), { _stopResolving: !0 });
477
+ this.links[s.uuid] = T(d({}, s), { _stopResolving: !0 });
478
478
  });
479
479
  }
480
480
  async resolveRelations(t, e) {
@@ -494,7 +494,7 @@ class _t {
494
494
  } else
495
495
  n = t.rels;
496
496
  n.forEach((s) => {
497
- this.relations[s.uuid] = w(d({}, s), { _stopResolving: !0 });
497
+ this.relations[s.uuid] = T(d({}, s), { _stopResolving: !0 });
498
498
  });
499
499
  }
500
500
  async resolveStories(t, e) {
@@ -519,14 +519,14 @@ class _t {
519
519
  }
520
520
  cacheResponse(t, e, n) {
521
521
  return n === void 0 && (n = 0), new Promise(async (s, o) => {
522
- let a = R({ url: t, params: e }), i = this.cacheProvider();
522
+ let a = x({ url: t, params: e }), i = this.cacheProvider();
523
523
  if (this.cache.clear === "auto" && e.version === "draft" && await this.flushCache(), e.version === "published" && t != "/cdn/spaces/me") {
524
524
  const c = await i.get(a);
525
525
  if (c)
526
526
  return s(c);
527
527
  }
528
528
  try {
529
- let c = await this.throttle("get", t, { params: e, paramsSerializer: (h) => R(h) }), u = { data: c.data, headers: c.headers };
529
+ let c = await this.throttle("get", t, { params: e, paramsSerializer: (h) => x(h) }), u = { data: c.data, headers: c.headers };
530
530
  if (u.data.assets && u.data.assets.length && this.resolveAssetsRelations(u.data), u = Object.assign({}, u, { perPage: c.headers["per-page"] ? parseInt(c.headers["per-page"]) : 0, total: c.headers["per-page"] ? parseInt(c.headers.total) : 0 }), c.status != 200)
531
531
  return o(c);
532
532
  (u.data.story || u.data.stories) && await this.resolveStories(u.data, e), e.version === "published" && t != "/cdn/spaces/me" && i.set(a, u), u.data.cv && (e.version == "draft" && p[e.token] != u.data.cv && this.flushCache(), p[e.token] = u.data.cv), s(u);
@@ -582,7 +582,7 @@ var bt = (r) => {
582
582
  "data-blok-uid": t.id + "-" + t.uid
583
583
  };
584
584
  };
585
- let x;
585
+ let E;
586
586
  const vt = "https://app.storyblok.com/f/storyblok-v2-latest.js", Jt = (r, t, e = {}) => {
587
587
  if (!(typeof window > "u")) {
588
588
  if (typeof window.storyblokRegisterEvent > "u") {
@@ -612,8 +612,8 @@ const vt = "https://app.storyblok.com/f/storyblok-v2-latest.js", Jt = (r, t, e =
612
612
  let i = {};
613
613
  return n.forEach((l) => {
614
614
  i = d(d({}, i), l(a));
615
- }), t !== !1 && ut(vt), x = new Q(o.schema), o.resolver && X(x, o.resolver), i;
616
- }, X = (r, t) => {
615
+ }), t !== !1 && ut(vt), E = new W(o.schema), o.resolver && Z(E, o.resolver), i;
616
+ }, Z = (r, t) => {
617
617
  r.addNode("blok", (e) => {
618
618
  let n = "";
619
619
  return e.attrs.body.forEach((s) => {
@@ -623,32 +623,32 @@ const vt = "https://app.storyblok.com/f/storyblok-v2-latest.js", Jt = (r, t, e =
623
623
  };
624
624
  });
625
625
  }, Yt = (r, t, e) => {
626
- let n = e || x;
626
+ let n = e || E;
627
627
  if (!n) {
628
628
  console.error("Please initialize the Storyblok SDK before calling the renderRichText function");
629
629
  return;
630
630
  }
631
- return r === "" ? "" : r ? (t && (n = new Q(t.schema), t.resolver && X(n, t.resolver)), n.render(r)) : (console.warn(`${r} is not a valid Richtext object. This might be because the value of the richtext field is empty.
631
+ return r === "" ? "" : r ? (t && (n = new W(t.schema), t.resolver && Z(n, t.resolver)), n.render(r)) : (console.warn(`${r} is not a valid Richtext object. This might be because the value of the richtext field is empty.
632
632
 
633
633
  For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`), "");
634
634
  };
635
- function E() {
635
+ function O() {
636
636
  }
637
- function O(r, t) {
637
+ function S(r, t) {
638
638
  for (const e in t)
639
639
  r[e] = t[e];
640
640
  return r;
641
641
  }
642
- function Z(r) {
642
+ function tt(r) {
643
643
  return r();
644
644
  }
645
- function H() {
645
+ function V() {
646
646
  return /* @__PURE__ */ Object.create(null);
647
647
  }
648
648
  function y(r) {
649
- r.forEach(Z);
649
+ r.forEach(tt);
650
650
  }
651
- function tt(r) {
651
+ function et(r) {
652
652
  return typeof r == "function";
653
653
  }
654
654
  function wt(r, t) {
@@ -663,7 +663,7 @@ function Rt(r) {
663
663
  e[0] !== "$" && (t[e] = r[e]);
664
664
  return t;
665
665
  }
666
- function V(r, t) {
666
+ function J(r, t) {
667
667
  const e = {};
668
668
  t = new Set(t);
669
669
  for (const n in r)
@@ -673,8 +673,8 @@ function V(r, t) {
673
673
  function xt(r, t, e) {
674
674
  r.insertBefore(t, e || null);
675
675
  }
676
- function et(r) {
677
- r.parentNode.removeChild(r);
676
+ function rt(r) {
677
+ r.parentNode && r.parentNode.removeChild(r);
678
678
  }
679
679
  function Et(r) {
680
680
  return document.createTextNode(r);
@@ -685,47 +685,47 @@ function Ot() {
685
685
  function St(r) {
686
686
  return Array.from(r.childNodes);
687
687
  }
688
- function J(r, t) {
688
+ function Y(r, t) {
689
689
  return new r(t);
690
690
  }
691
- let N;
691
+ let I;
692
692
  function m(r) {
693
- N = r;
693
+ I = r;
694
694
  }
695
- const g = [], Y = [], v = [], F = [], jt = Promise.resolve();
696
- let S = !1;
695
+ const g = [], F = [], v = [], K = [], jt = Promise.resolve();
696
+ let j = !1;
697
697
  function Pt() {
698
- S || (S = !0, jt.then(rt));
698
+ j || (j = !0, jt.then(nt));
699
699
  }
700
- function j(r) {
700
+ function P(r) {
701
701
  v.push(r);
702
702
  }
703
- const T = /* @__PURE__ */ new Set();
703
+ const R = /* @__PURE__ */ new Set();
704
704
  let b = 0;
705
- function rt() {
706
- const r = N;
705
+ function nt() {
706
+ const r = I;
707
707
  do {
708
708
  for (; b < g.length; ) {
709
709
  const t = g[b];
710
710
  b++, m(t), At(t.$$);
711
711
  }
712
- for (m(null), g.length = 0, b = 0; Y.length; )
713
- Y.pop()();
712
+ for (m(null), g.length = 0, b = 0; F.length; )
713
+ F.pop()();
714
714
  for (let t = 0; t < v.length; t += 1) {
715
715
  const e = v[t];
716
- T.has(e) || (T.add(e), e());
716
+ R.has(e) || (R.add(e), e());
717
717
  }
718
718
  v.length = 0;
719
719
  } while (g.length);
720
- for (; F.length; )
721
- F.pop()();
722
- S = !1, T.clear(), m(r);
720
+ for (; K.length; )
721
+ K.pop()();
722
+ j = !1, R.clear(), m(r);
723
723
  }
724
724
  function At(r) {
725
725
  if (r.fragment !== null) {
726
726
  r.update(), y(r.before_update);
727
727
  const t = r.dirty;
728
- r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, t), r.after_update.forEach(j);
728
+ r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, t), r.after_update.forEach(P);
729
729
  }
730
730
  }
731
731
  const $ = /* @__PURE__ */ new Set();
@@ -740,10 +740,10 @@ function Ct() {
740
740
  function Mt() {
741
741
  f.r || y(f.c), f = f.p;
742
742
  }
743
- function P(r, t) {
743
+ function A(r, t) {
744
744
  r && r.i && ($.delete(r), r.i(t));
745
745
  }
746
- function K(r, t, e, n) {
746
+ function G(r, t, e, n) {
747
747
  if (r && r.o) {
748
748
  if ($.has(r))
749
749
  return;
@@ -775,17 +775,17 @@ function Nt(r, t) {
775
775
  function It(r) {
776
776
  return typeof r == "object" && r !== null ? r : {};
777
777
  }
778
- function G(r) {
778
+ function Q(r) {
779
779
  r && r.c();
780
780
  }
781
- function A(r, t, e, n) {
781
+ function C(r, t, e, n) {
782
782
  const { fragment: s, after_update: o } = r.$$;
783
- s && s.m(t, e), n || j(() => {
784
- const a = r.$$.on_mount.map(Z).filter(tt);
783
+ s && s.m(t, e), n || P(() => {
784
+ const a = r.$$.on_mount.map(tt).filter(et);
785
785
  r.$$.on_destroy ? r.$$.on_destroy.push(...a) : y(a), r.$$.on_mount = [];
786
- }), o.forEach(j);
786
+ }), o.forEach(P);
787
787
  }
788
- function C(r, t) {
788
+ function M(r, t) {
789
789
  const e = r.$$;
790
790
  e.fragment !== null && (y(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
791
791
  }
@@ -793,48 +793,48 @@ function qt(r, t) {
793
793
  r.$$.dirty[0] === -1 && (g.push(r), Pt(), r.$$.dirty.fill(0)), r.$$.dirty[t / 31 | 0] |= 1 << t % 31;
794
794
  }
795
795
  function Lt(r, t, e, n, s, o, a, i = [-1]) {
796
- const l = N;
796
+ const l = I;
797
797
  m(r);
798
798
  const c = r.$$ = {
799
799
  fragment: null,
800
800
  ctx: [],
801
801
  props: o,
802
- update: E,
802
+ update: O,
803
803
  not_equal: s,
804
- bound: H(),
804
+ bound: V(),
805
805
  on_mount: [],
806
806
  on_destroy: [],
807
807
  on_disconnect: [],
808
808
  before_update: [],
809
809
  after_update: [],
810
810
  context: new Map(t.context || (l ? l.$$.context : [])),
811
- callbacks: H(),
811
+ callbacks: V(),
812
812
  dirty: i,
813
813
  skip_bound: !1,
814
814
  root: t.target || l.$$.root
815
815
  };
816
816
  a && a(c.root);
817
817
  let u = !1;
818
- if (c.ctx = e ? e(r, t.props || {}, (h, k, ...I) => {
819
- const q = I.length ? I[0] : k;
820
- return c.ctx && s(c.ctx[h], c.ctx[h] = q) && (!c.skip_bound && c.bound[h] && c.bound[h](q), u && qt(r, h)), k;
818
+ if (c.ctx = e ? e(r, t.props || {}, (h, k, ...q) => {
819
+ const L = q.length ? q[0] : k;
820
+ return c.ctx && s(c.ctx[h], c.ctx[h] = L) && (!c.skip_bound && c.bound[h] && c.bound[h](L), u && qt(r, h)), k;
821
821
  }) : [], c.update(), u = !0, y(c.before_update), c.fragment = n ? n(c.ctx) : !1, t.target) {
822
822
  if (t.hydrate) {
823
823
  const h = St(t.target);
824
- c.fragment && c.fragment.l(h), h.forEach(et);
824
+ c.fragment && c.fragment.l(h), h.forEach(rt);
825
825
  } else
826
826
  c.fragment && c.fragment.c();
827
- t.intro && P(r.$$.fragment), A(r, t.target, t.anchor, t.customElement), rt();
827
+ t.intro && A(r.$$.fragment), C(r, t.target, t.anchor, t.customElement), nt();
828
828
  }
829
829
  m(l);
830
830
  }
831
831
  class Bt {
832
832
  $destroy() {
833
- C(this, 1), this.$destroy = E;
833
+ M(this, 1), this.$destroy = O;
834
834
  }
835
835
  $on(t, e) {
836
- if (!tt(e))
837
- return E;
836
+ if (!et(e))
837
+ return O;
838
838
  const n = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
839
839
  return n.push(e), () => {
840
840
  const s = n.indexOf(e);
@@ -852,15 +852,15 @@ function zt(r) {
852
852
  function a(i) {
853
853
  let l = {};
854
854
  for (let c = 0; c < s.length; c += 1)
855
- l = O(l, s[c]);
855
+ l = S(l, s[c]);
856
856
  return { props: l };
857
857
  }
858
- return o && (t = J(o, a())), {
858
+ return o && (t = Y(o, a())), {
859
859
  c() {
860
- t && G(t.$$.fragment), e = Ot();
860
+ t && Q(t.$$.fragment), e = Ot();
861
861
  },
862
862
  m(i, l) {
863
- t && A(t, i, l), xt(i, e, l), n = !0;
863
+ t && C(t, i, l), xt(i, e, l), n = !0;
864
864
  },
865
865
  p(i, [l]) {
866
866
  const c = l & 5 ? Nt(s, [
@@ -871,30 +871,30 @@ function zt(r) {
871
871
  if (t) {
872
872
  Ct();
873
873
  const u = t;
874
- K(u.$$.fragment, 1, 0, () => {
875
- C(u, 1);
874
+ G(u.$$.fragment, 1, 0, () => {
875
+ M(u, 1);
876
876
  }), Mt();
877
877
  }
878
- o ? (t = J(o, a()), G(t.$$.fragment), P(t.$$.fragment, 1), A(t, e.parentNode, e)) : t = null;
878
+ o ? (t = Y(o, a()), Q(t.$$.fragment), A(t.$$.fragment, 1), C(t, e.parentNode, e)) : t = null;
879
879
  } else
880
880
  o && t.$set(c);
881
881
  },
882
882
  i(i) {
883
- n || (t && P(t.$$.fragment, i), n = !0);
883
+ n || (t && A(t.$$.fragment, i), n = !0);
884
884
  },
885
885
  o(i) {
886
- t && K(t.$$.fragment, i), n = !1;
886
+ t && G(t.$$.fragment, i), n = !1;
887
887
  },
888
888
  d(i) {
889
- i && et(e), t && C(t, i);
889
+ i && rt(e), t && M(t, i);
890
890
  }
891
891
  };
892
892
  }
893
893
  function Dt(r, t, e) {
894
894
  const n = ["blok"];
895
- let s = V(t, n), o, { blok: a } = t;
895
+ let s = J(t, n), o, { blok: a } = t;
896
896
  return a ? o = Ut(a.component) : console.error("Please provide a 'blok' property to the StoryblokComponent"), r.$$set = (i) => {
897
- t = O(O({}, t), Rt(i)), e(2, s = V(t, n)), "blok" in i && e(0, a = i.blok);
897
+ t = S(S({}, t), Rt(i)), e(2, s = J(t, n)), "blok" in i && e(0, a = i.blok);
898
898
  }, [a, o, s];
899
899
  }
900
900
  class Ft extends Bt {
@@ -913,17 +913,17 @@ const Kt = (r, t) => {
913
913
  }
914
914
  };
915
915
  };
916
- let M = null;
917
- const Gt = () => (M || console.log(
916
+ let N = null;
917
+ const Gt = () => (N || console.log(
918
918
  "You can't use getStoryblokApi if you're not loading apiPlugin."
919
- ), M);
920
- let nt = null;
919
+ ), N);
920
+ let w = null;
921
921
  const Qt = (r) => {
922
922
  const { storyblokApi: t } = $t(r);
923
- M = t, nt = r.components || {};
923
+ N = t, w = r.components || {};
924
924
  }, Ut = (r) => {
925
- const t = nt[r];
926
- return t || console.error(`You didn't load the ${r} component. Please load it in storyblokInit. For example:
925
+ let t = null;
926
+ return t = typeof w == "function" ? w()[r] : w[r], t || console.error(`You didn't load the ${r} component. Please load it in storyblokInit. For example:
927
927
  storyblokInit({
928
928
  accessToken: "<your-token>",
929
929
  components: {
package/dist/types.d.ts CHANGED
@@ -4,6 +4,6 @@ export interface SbSvelteComponentsMap {
4
4
  [name: string]: typeof SvelteComponent;
5
5
  }
6
6
  export interface SbSvelteSDKOptions extends SbSDKOptions {
7
- components?: SbSvelteComponentsMap;
7
+ components?: SbSvelteComponentsMap | CallableFunction;
8
8
  }
9
9
  export type { AlternateObject, Richtext, RichtextInstance, SbBlokData, SbBlokKeyDataTypes, SbSDKOptions, Stories, StoriesParams, Story, StoryData, StoryParams, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokCache, StoryblokCacheProvider, StoryblokClient, StoryblokComponentType, StoryblokConfig, StoryblokManagmentApiResult, StoryblokResult, apiPlugin, useStoryblokBridge, } from "@storyblok/js";
package/index.ts CHANGED
@@ -48,7 +48,7 @@ export const useStoryblokApi = (): StoryblokClient => {
48
48
 
49
49
  export { useStoryblokApi as getStoryblokApi };
50
50
 
51
- let componentsMap: SbSvelteComponentsMap = null;
51
+ let componentsMap: SbSvelteComponentsMap | CallableFunction = null;
52
52
 
53
53
  export const storyblokInit = (options: SbSvelteSDKOptions) => {
54
54
  const { storyblokApi } = sbInit(options);
@@ -57,7 +57,11 @@ export const storyblokInit = (options: SbSvelteSDKOptions) => {
57
57
  };
58
58
 
59
59
  export const getComponent = (componentName: string) => {
60
- const component = componentsMap[componentName];
60
+ let component = null;
61
+ component =
62
+ typeof componentsMap === "function"
63
+ ? componentsMap()[componentName]
64
+ : componentsMap[componentName];
61
65
 
62
66
  if (!component) {
63
67
  console.error(`You didn't load the ${componentName} component. Please load it in storyblokInit. For example:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/svelte",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "Storyblok SDK to connect Storyblok with Svelte",
5
5
  "main": "./dist/storyblok-svelte.js",
6
6
  "module": "./dist/storyblok-svelte.mjs",
@@ -31,17 +31,17 @@
31
31
  "@storyblok/js": "^1.8.6"
32
32
  },
33
33
  "devDependencies": {
34
- "@babel/core": "^7.19.3",
34
+ "@babel/core": "^7.20.5",
35
35
  "@cypress/vite-dev-server": "^2.2.3",
36
36
  "@tsconfig/svelte": "^3.0.0",
37
37
  "babel-jest": "^28.1.3",
38
38
  "cypress": "^9.6.0",
39
39
  "cypress-svelte-unit-test": "^3.3.4",
40
40
  "eslint-plugin-cypress": "^2.12.1",
41
- "eslint-plugin-jest": "^27.0.4",
41
+ "eslint-plugin-jest": "^27.1.7",
42
42
  "jest": "^29.2.1",
43
- "svelte-preprocess": "^4.10.7",
44
- "typescript": "^4.8.4",
43
+ "svelte-preprocess": "^5.0.0",
44
+ "typescript": "^4.9.4",
45
45
  "vite": "^3.1.8"
46
46
  },
47
47
  "eslintConfig": {
package/types.ts CHANGED
@@ -6,7 +6,7 @@ export interface SbSvelteComponentsMap {
6
6
  }
7
7
 
8
8
  export interface SbSvelteSDKOptions extends SbSDKOptions {
9
- components?: SbSvelteComponentsMap;
9
+ components?: SbSvelteComponentsMap | CallableFunction;
10
10
  }
11
11
 
12
12
  export type {