Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More →
Socket
Sign inDemoInstall
Socket

@storyblok/react

Package Overview
Dependencies
Maintainers
7
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storyblok/react - npm Package Compare versions

Comparing version 1.3.5 to 2.0.0

8

dist/storyblok-react.js

@@ -1,7 +0,3 @@

(function(l,h){typeof exports=="object"&&typeof module!="undefined"?h(exports,require("react"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","axios"],h):(l=typeof globalThis!="undefined"?globalThis:l||self,h(l.storyblokReact={},l.React,l.e))})(this,function(l,h,p){"use strict";var fe=Object.defineProperty;var T=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var B=(l,h,p)=>h in l?fe(l,h,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[h]=p,U=(l,h)=>{for(var p in h||(h={}))z.call(h,p)&&B(l,p,h[p]);if(T)for(var p of T(h))D.call(h,p)&&B(l,p,h[p]);return l};var H=(l,h)=>{var p={};for(var f in l)z.call(l,f)&&h.indexOf(f)<0&&(p[f]=l[f]);if(l!=null&&T)for(var f of T(l))h.indexOf(f)<0&&D.call(l,f)&&(p[f]=l[f]);return p};function f(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var _=f(h),V=f(p),J=Object.defineProperty,Y=Object.defineProperties,F=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,O=(n,e,t)=>e in n?J(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,g=(n,e)=>{for(var t in e||(e={}))G.call(e,t)&&O(n,t,e[t]);if(E)for(var t of E(e))Q.call(e,t)&&O(n,t,e[t]);return n},w=(n,e)=>Y(n,F(e));let P=!1;const j=[],W=n=>new Promise((e,t)=>{if(typeof window=="undefined"||(window.storyblokRegisterEvent=s=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}P?s():j.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=n,r.id="storyblok-javascript-bridge",r.onerror=s=>t(s),r.onload=s=>{j.forEach(o=>o()),P=!0,e(s)},document.getElementsByTagName("head")[0].appendChild(r)}),X=function(n,e){if(!n)return null;let t={};for(let r in n){let s=n[r];e.indexOf(r)>-1&&s!==null&&(t[r]=s)}return t},Z=n=>n==="email";var C={nodes:{horizontal_rule(){return{singleTag:"hr"}},blockquote(){return{tag:"blockquote"}},bullet_list(){return{tag:"ul"}},code_block(n){return{tag:["pre",{tag:"code",attrs:n.attrs}]}},hard_break(){return{singleTag:"br"}},heading(n){return{tag:`h${n.attrs.level}`}},image(n){return{singleTag:[{tag:"img",attrs:X(n.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(n){const e=g({},n.attrs),{linktype:t="url"}=n.attrs;return Z(t)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},styled(n){return{tag:[{tag:"span",attrs:n.attrs}]}}}};const K=function(n){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,r=RegExp(t.source);return n&&r.test(n)?n.replace(t,s=>e[s]):n};class A{constructor(e){e||(e=C),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e={}){if(e.content&&Array.isArray(e.content)){let t="";return e.content.forEach(r=>{t+=this.renderNode(r)}),t}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){let t=[];e.marks&&e.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderOpeningTag(o.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&t.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(s=>{t.push(this.renderNode(s))}):e.text?t.push(K(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html&&t.push(r.html),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderClosingTag(o.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{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}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(r=>r.constructor===String?`</${r}>`:`</${r.tag}>`).join("")}getMatchingNode(e){if(typeof this.nodes[e.type]=="function")return this.nodes[e.type](e)}getMatchingMark(e){if(typeof this.marks[e.type]=="function")return this.marks[e.type](e)}}/*!
* storyblok-js-client v4.5.2
* Universal JavaScript SDK for Storyblok's API
* (c) 2020-2022 Stobylok Team
*/function M(n){return typeof n=="number"&&n==n&&n!==1/0&&n!==-1/0}function x(n,e,t){if(!M(e))throw new TypeError("Expected `limit` to be a finite number");if(!M(t))throw new TypeError("Expected `interval` to be a finite number");var r=[],s=[],o=0,a=function(){o++;var u=setTimeout(function(){o--,r.length>0&&a(),s=s.filter(function(d){return d!==u})},t);s.indexOf(u)<0&&s.push(u);var c=r.shift();c.resolve(n.apply(c.self,c.args))},i=function(){var u=arguments,c=this;return new Promise(function(d,k){r.push({resolve:d,reject:k,args:u,self:c}),o<e&&a()})};return i.abort=function(){s.forEach(clearTimeout),s=[],r.forEach(function(u){u.reject(new throttle.AbortError)}),r.length=0},i}x.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const ee=function(n,e){if(!n)return null;let t={};for(let r in n){let s=n[r];e.indexOf(r)>-1&&s!==null&&(t[r]=s)}return t};var te={nodes:{horizontal_rule:()=>({singleTag:"hr"}),blockquote:()=>({tag:"blockquote"}),bullet_list:()=>({tag:"ul"}),code_block:n=>({tag:["pre",{tag:"code",attrs:n.attrs}]}),hard_break:()=>({singleTag:"br"}),heading:n=>({tag:`h${n.attrs.level}`}),image:n=>({singleTag:[{tag:"img",attrs:ee(n.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(n){const e=g({},n.attrs),{linktype:t="url"}=n.attrs;return t==="email"&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},styled:n=>({tag:[{tag:"span",attrs:n.attrs}]})}};class re{constructor(e){e||(e=te),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e={}){if(e.content&&Array.isArray(e.content)){let t="";return e.content.forEach(r=>{t+=this.renderNode(r)}),t}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){let t=[];e.marks&&e.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderOpeningTag(o.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&t.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(s=>{t.push(this.renderNode(s))}):e.text?t.push(function(s){const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=/[&<>"']/g,i=RegExp(a.source);return s&&i.test(s)?s.replace(a,u=>o[u]):s}(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html&&t.push(r.html),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderClosingTag(o.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(r=>{if(r.constructor===String)return`<${r}${t}>`;{let s=`<${r.tag}`;if(r.attrs)for(let o in r.attrs){let a=r.attrs[o];a!==null&&(s+=` ${o}="${a}"`)}return`${s}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){if(typeof this.nodes[e.type]=="function")return this.nodes[e.type](e)}getMatchingMark(e){if(typeof this.marks[e.type]=="function")return this.marks[e.type](e)}}const se=(n=0,e=n)=>{const t=Math.abs(e-n)||0,r=n<e?1:-1;return((s=0,o)=>[...Array(s)].map(o))(t,(s,o)=>o*r+n)},R=(n,e,t)=>{const r=[];for(const s in n){if(!Object.prototype.hasOwnProperty.call(n,s))continue;const o=n[s],a=t?"":encodeURIComponent(s);let i;i=typeof o=="object"?R(o,e?e+encodeURIComponent("["+a+"]"):a,Array.isArray(o)):(e?e+encodeURIComponent("["+a+"]"):a)+"="+encodeURIComponent(o),r.push(i)}return r.join("&")};let b={},y={};class ne{constructor(e,t){if(!t){let o=e.region?`-${e.region}`:"",a=e.https===!1?"http":"https";t=e.oauthToken===void 0?`${a}://api${o}.storyblok.com/v2`:`${a}://api${o}.storyblok.com/v1`}let r=Object.assign({},e.headers),s=5;e.oauthToken!==void 0&&(r.Authorization=e.oauthToken,s=3),e.rateLimit!==void 0&&(s=e.rateLimit),this.richTextResolver=new re(e.richTextSchema),typeof e.componentResolver=="function"&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=x(this.throttledRequest,s,1e3),this.accessToken=e.accessToken,this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.client=V.default.create({baseURL:t,timeout:e.timeout||0,headers:r,proxy:e.proxy||!1}),e.responseInterceptor&&this.client.interceptors.response.use(o=>e.responseInterceptor(o)),this.resolveNestedRelations=e.resolveNestedRelations||!0}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})}parseParams(e={}){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=y[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,t={}){return((r="")=>r.indexOf("/cdn/")>-1)(e)?this.parseParams(t):t}makeRequest(e,t,r,s){const o=this.factoryParamOptions(e,((a={},i=25,u=1)=>w(g({},a),{per_page:i,page:u}))(t,r,s));return this.cacheResponse(e,o)}get(e,t){let r=`/${e}`;const s=this.factoryParamOptions(r,t);return this.cacheResponse(r,s)}async getAll(e,t={},r){const s=t.per_page||25,o=`/${e}`,a=o.split("/");r=r||a[a.length-1];const i=await this.makeRequest(o,t,s,1),u=i.total?Math.ceil(i.total/s):1;return((c=[],d)=>c.map(d).reduce((k,pe)=>[...k,...pe],[]))([i,...await(async(c=[],d)=>Promise.all(c.map(d)))(se(1,u),async c=>this.makeRequest(o,t,s,c+1))],c=>Object.values(c.data[r]))}post(e,t){let r=`/${e}`;return this.throttle("post",r,t)}put(e,t){let r=`/${e}`;return this.throttle("put",r,t)}delete(e,t){let r=`/${e}`;return this.throttle("delete",r,t)}getStories(e){return this.get("cdn/stories",e)}getStory(e,t){return this.get(`cdn/stories/${e}`,t)}setToken(e){this.accessToken=e}getToken(){return this.accessToken}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[r.id]?r.story=this._cleanCopy(this.links[r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[r.uuid]&&(r.story=this._cleanCopy(this.links[r.uuid]))}_insertRelations(e,t,r){if(r.indexOf(e.component+"."+t)>-1){if(typeof e[t]=="string")this.relations[e[t]]&&(e[t]=this._cleanCopy(this.relations[e[t]]));else if(e[t].constructor===Array){let s=[];e[t].forEach(o=>{this.relations[o]&&s.push(this._cleanCopy(this.relations[o]))}),e[t]=s}}}_insertAssetsRelations(e,t){t.forEach(r=>{e.id===r.id&&(e.original=r,e.original.filename=e.filename,e.original.filename=e.original.filename.includes("https://s3.amazonaws.com/")?e.original.filename:e.original.filename.replace("https://","https://s3.amazonaws.com/"),delete e.original.s3_filename)})}iterateTree(e,t){let r=s=>{if(s!=null){if(s.constructor===Array)for(let o=0;o<s.length;o++)r(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,t),this._insertLinks(s,o)):"id"in s&&s.fieldtype==="asset"&&this._insertAssetsRelations(s,t),r(s[o])}}};r(e.content)}async resolveLinks(e,t){let r=[];if(e.link_uuids){const s=e.link_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const u=Math.min(s,i+a);o.push(e.link_uuids.slice(i,u))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:o[i].join(",")})).data.stories.forEach(u=>{r.push(u)})}else r=e.links;r.forEach(s=>{this.links[s.uuid]=w(g({},s),{_stopResolving:!0})})}async resolveRelations(e,t){let r=[];if(e.rel_uuids){const s=e.rel_uuids.length;let o=[];const a=50;for(let i=0;i<s;i+=a){const u=Math.min(s,i+a);o.push(e.rel_uuids.slice(i,u))}for(let i=0;i<o.length;i++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:o[i].join(",")})).data.stories.forEach(u=>{r.push(u)})}else r=e.rels;r.forEach(s=>{this.relations[s.uuid]=w(g({},s),{_stopResolving:!0})})}async resolveStories(e,t){let r=[];if(t.resolve_relations!==void 0&&t.resolve_relations.length>0&&(e.rels||e.rel_uuids)&&(r=t.resolve_relations.split(","),await this.resolveRelations(e,t)),["1","story","url"].indexOf(t.resolve_links)>-1&&(e.links||e.link_uuids)&&await this.resolveLinks(e,t),this.resolveNestedRelations)for(const s in this.relations)this.iterateTree(this.relations[s],r);e.story?this.iterateTree(e.story,r):e.stories.forEach(s=>{this.iterateTree(s,r)})}resolveAssetsRelations(e){const{assets:t,stories:r,story:s}=e;if(r)for(const o of r)this.iterateTree(o,t);else{if(!s)return e;this.iterateTree(s,t)}}cacheResponse(e,t,r){return r===void 0&&(r=0),new Promise(async(s,o)=>{let a=R({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const c=await i.get(a);if(c)return s(c)}try{let c=await this.throttle("get",e,{params:t,paramsSerializer:k=>R(k)}),d={data:c.data,headers:c.headers};if(d.data.assets&&d.data.assets.length&&this.resolveAssetsRelations(d.data),d=Object.assign({},d,{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);(d.data.story||d.data.stories)&&await this.resolveStories(d.data,t),t.version==="published"&&e!="/cdn/spaces/me"&&i.set(a,d),d.data.cv&&(t.version=="draft"&&y[t.token]!=d.data.cv&&this.flushCache(),y[t.token]=d.data.cv),s(d)}catch(c){if(c.response&&c.response.status===429&&(r+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${r} seconds.`),await(u=1e3*r,new Promise(d=>setTimeout(d,u))),this.cacheResponse(e,t,r).then(s).catch(o);o(c)}var u})}throttledRequest(e,t,r){return this.client[e](t,r)}cacheVersions(){return y}cacheVersion(){return y[this.accessToken]}setCacheVersion(e){this.accessToken&&(y[this.accessToken]=e)}cacheProvider(){return this.cache.type==="memory"?{get:e=>b[e],getAll:()=>b,set(e,t){b[e]=t},flush(){b={}}}:{get(){},getAll(){},set(){},flush(){}}}async flushCache(){return await this.cacheProvider().flush(),this}}const oe=(n={})=>{const{apiOptions:e}=n;if(!e.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 ne(e)}};var ie=n=>{if(typeof n!="object"||typeof n._editable=="undefined")return{};const e=JSON.parse(n._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};let S;const ae="https://app.storyblok.com/f/storyblok-v2-latest.js",v=(n,e,t={})=>{if(typeof window!="undefined"){if(typeof window.storyblokRegisterEvent=="undefined"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}if(!n){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],s=>{s.action==="input"&&s.story.id===n?e(s.story):(s.action==="change"||s.action==="published")&&s.storyId===n&&window.location.reload()})})}},le=(n={})=>{const{bridge:e,accessToken:t,use:r=[],apiOptions:s={},richText:o={}}=n;s.accessToken=s.accessToken||t;const a={bridge:e,apiOptions:s};let i={};return r.forEach(u=>{i=g(g({},i),u(a))}),e!==!1&&W(ae),S=new A(o.schema),o.resolver&&N(S,o.resolver),i},N=(n,e)=>{n.addNode("blok",t=>{let r="";return t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})},ce=(n,e,t)=>{let r=t||S;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return n===""?"":n?(e&&(r=new A(e.schema),e.resolver&&N(r,e.resolver)),r.render(n)):(console.warn(`${n} is not a valid Richtext object. This might be because the value of the richtext field is empty.
(function(l,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(l=typeof globalThis!="undefined"?globalThis:l||self,u(l.storyblokReact={},l.React))})(this,function(l,u){"use strict";var Ce=Object.defineProperty;var T=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var D=(l,u,p)=>u in l?Ce(l,u,{enumerable:!0,configurable:!0,writable:!0,value:p}):l[u]=p,J=(l,u)=>{for(var p in u||(u={}))H.call(u,p)&&D(l,p,u[p]);if(T)for(var p of T(u))q.call(u,p)&&D(l,p,u[p]);return l};var V=(l,u)=>{var p={};for(var g in l)H.call(l,g)&&u.indexOf(g)<0&&(p[g]=l[g]);if(l!=null&&T)for(var g of T(l))u.indexOf(g)<0&&q.call(l,g)&&(p[g]=l[g]);return p};function p(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var g=p(u),F=Object.defineProperty,z=Object.defineProperties,Y=Object.getOwnPropertyDescriptors,j=Object.getOwnPropertySymbols,G=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,$=(o,e,t)=>e in o?F(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,y=(o,e)=>{for(var t in e||(e={}))G.call(e,t)&&$(o,t,e[t]);if(j)for(var t of j(e))Q.call(e,t)&&$(o,t,e[t]);return o},R=(o,e)=>z(o,Y(e));let C=!1;const I=[],W=o=>new Promise((e,t)=>{if(typeof window=="undefined"||(window.storyblokRegisterEvent=s=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}C?s():I.push(s)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=o,r.id="storyblok-javascript-bridge",r.onerror=s=>t(s),r.onload=s=>{I.forEach(n=>n()),C=!0,e(s)},document.getElementsByTagName("head")[0].appendChild(r)});var X=Object.defineProperty,Z=(o,e,t)=>e in o?X(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,h=(o,e,t)=>(Z(o,typeof e!="symbol"?e+"":e,t),t);function x(o){return!(o!==o||o===1/0||o===-1/0)}function K(o,e,t){if(!x(e))throw new TypeError("Expected `limit` to be a finite number");if(!x(t))throw new TypeError("Expected `interval` to be a finite number");const r=[];let s=[],n=0;const a=function(){n++;const c=setTimeout(function(){n--,r.length>0&&a(),s=s.filter(function(f){return f!==c})},t);s.indexOf(c)<0&&s.push(c);const d=r.shift();d.resolve(o.apply(d.self,d.args))},i=function(...c){const d=this;return new Promise(function(f,P){r.push({resolve:f,reject:P,args:c,self:d}),n<e&&a()})};return i.abort=function(){s.forEach(clearTimeout),s=[],r.forEach(function(c){c.reject(function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"})}),r.length=0},i}const ee=function(o,e){const t={};for(const r in o){const s=o[r];e.indexOf(r)>-1&&s!==null&&(t[r]=s)}return t},te=o=>o==="email",re=()=>({singleTag:"hr"}),se=()=>({tag:"blockquote"}),oe=()=>({tag:"ul"}),ne=o=>({tag:["pre",{tag:"code",attrs:o.attrs}]}),ie=()=>({singleTag:"br"}),ae=o=>({tag:`h${o.attrs.level}`}),le=o=>({singleTag:[{tag:"img",attrs:ee(o.attrs,["src","alt","title"])}]}),ce=()=>({tag:"li"}),he=()=>({tag:"ol"}),ue=()=>({tag:"p"}),de=()=>({tag:"b"}),pe=()=>({tag:"strike"}),fe=()=>({tag:"u"}),ge=()=>({tag:"strong"}),ye=()=>({tag:"code"}),me=()=>({tag:"i"}),be=o=>{const e=y({},o.attrs),{linktype:t="url"}=o.attrs;return te(t)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},ke=o=>({tag:[{tag:"span",attrs:o.attrs}]}),A={nodes:{horizontal_rule:re,blockquote:se,bullet_list:oe,code_block:ne,hard_break:ie,heading:ae,image:le,list_item:ce,ordered_list:he,paragraph:ue},marks:{bold:de,strike:pe,underline:fe,strong:ge,code:ye,italic:me,link:be,styled:ke}},ve=function(o){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,r=RegExp(t.source);return o&&r.test(o)?o.replace(t,s=>e[s]):o};class b{constructor(e){h(this,"marks"),h(this,"nodes"),e||(e=A),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e){if(e&&e.content&&Array.isArray(e.content)){let t="";return e.content.forEach(r=>{t+=this.renderNode(r)}),t}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){const t=[];e.marks&&e.marks.forEach(s=>{const n=this.getMatchingMark(s);n&&t.push(this.renderOpeningTag(n.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&t.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(s=>{t.push(this.renderNode(s))}):e.text?t.push(ve(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html&&t.push(r.html),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(s=>{const n=this.getMatchingMark(s);n&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(r=>{if(r.constructor===String)return`<${r}${t}>`;{let s=`<${r.tag}`;if(r.attrs)for(const n in r.attrs){const a=r.attrs[n];a!==null&&(s+=` ${n}="${a}"`)}return`${s}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}}class M{constructor(){h(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),h(this,"getOptionsPage",(e,t=25,r=1)=>R(y({},e),{per_page:t,page:r})),h(this,"delay",e=>new Promise(t=>setTimeout(t,e))),h(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),h(this,"range",(e=0,t=e)=>{const r=Math.abs(t-e)||0,s=e<t?1:-1;return this.arrayFrom(r,(n,a)=>a*s+e)}),h(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),h(this,"flatMap",(e=[],t)=>e.map(t).reduce((r,s)=>[...r,...s],[]))}stringify(e,t,r){const s=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const a=e[n],i=r?"":encodeURIComponent(n);let c;typeof a=="object"?c=this.stringify(a,t?t+encodeURIComponent("["+i+"]"):i,Array.isArray(a)):c=(t?t+encodeURIComponent("["+i+"]"):i)+"="+encodeURIComponent(a),s.push(c)}return s.join("&")}}var k=(o=>(o.GET="get",o.DELETE="delete",o.POST="post",o.PUT="put",o))(k||{});class we{constructor(e){h(this,"baseURL"),h(this,"timeout"),h(this,"headers"),h(this,"responseInterceptor"),h(this,"ejectInterceptor"),h(this,"url"),h(this,"parameters"),this.baseURL=e.baseURL,this.timeout=e.timeout?e.timeout*1e3:1e3,this.headers=e.headers||[],this.responseInterceptor=e.responseInterceptor,this.ejectInterceptor=!1,this.url="",this.parameters={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler(k.GET)}post(e,t){return this.url=e,this.parameters=t,this._methodHandler(k.POST)}put(e,t){return this.url=e,this.parameters=t,this._methodHandler(k.PUT)}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler(k.DELETE)}async _responseHandler(e){const t=[],r={data:{},headers:{},status:0,statusText:""};await e.json().then(s=>{r.data=s});for(const s of e.headers.entries())t[s[0]]=s[1];return r.headers=y({},t),r.status=e.status,r.statusText=e.statusText,r}async _methodHandler(e){const t=new URL(`${this.baseURL}${this.url}`);let r=null;if(e==="get"){const i=new M;t.search=i.stringify(this.parameters)}else r=JSON.stringify(this.parameters);const s=new AbortController,{signal:n}=s,a=setTimeout(()=>s.abort(),this.timeout);try{const i=await fetch(`${t}`,{method:e,headers:this.headers,body:r,signal:n});clearTimeout(a);const c=await this._responseHandler(i);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}catch(i){return i}}eject(){this.ejectInterceptor=!0}_statusHandler(e){if(/20[01]/g.test(`${e.status}`))return e;throw{message:new Error(e.statusText||`status: ${e.status}`),response:e}}}let w={};const m={};class _e{constructor(e,t){if(h(this,"client"),h(this,"maxRetries"),h(this,"throttle"),h(this,"accessToken"),h(this,"cache"),h(this,"helpers"),h(this,"relations"),h(this,"links"),h(this,"richTextResolver"),h(this,"resolveNestedRelations"),!t){const n=e.region?`-${e.region}`:"",a=e.https===!1?"http":"https";e.oauthToken?t=`${a}://api${n}.storyblok.com/v1`:t=`${a}://api${n}.storyblok.com/v2`}const r=Object.assign({},e.headers);let s=5;e.oauthToken&&(r.Authorization=e.oauthToken,s=3),e.rateLimit&&(s=e.rateLimit),e.richTextSchema?this.richTextResolver=new b(e.richTextSchema):this.richTextResolver=new b,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries,this.throttle=K(this.throttledRequest,s,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new M,this.resolveNestedRelations=!1,this.client=new we({baseURL:t,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})}parseParams(e){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=m[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,r,s){const n=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,s));return this.cacheResponse(e,n)}get(e,t){t||(t={});const r=`/${e}`,s=this.factoryParamOptions(r,t);return this.cacheResponse(r,s)}async getAll(e,t,r){const s=(t==null?void 0:t.per_page)||25,n=`/${e}`,a=n.split("/"),i=r||a[a.length-1],c=1,d=await this.makeRequest(n,t,s,c),f=d.total?Math.ceil(d.total/s):1,P=await this.helpers.asyncMap(this.helpers.range(c,f),O=>this.makeRequest(n,t,s,O+1));return this.helpers.flatMap([d,...P],O=>Object.values(O.data[i]))}post(e,t){const r=`/${e}`;return Promise.resolve(this.throttle("post",r,t))}put(e,t){const r=`/${e}`;return Promise.resolve(this.throttle("put",r,t))}delete(e,t){const r=`/${e}`;return Promise.resolve(this.throttle("delete",r,t))}getStories(e){return this.get("cdn/stories",e)}getStory(e,t){return this.get(`cdn/stories/${e}`,t)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[r.id]?r.story=this._cleanCopy(this.links[r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[r.uuid]&&(r.story=this._cleanCopy(this.links[r.uuid]))}_insertRelations(e,t,r){if(r.indexOf(`${e.component}.${t}`)>-1){if(typeof e[t]=="string")this.relations[e[t]]&&(e[t]=this._cleanCopy(this.relations[e[t]]));else if(e[t]&&e[t].constructor===Array){const s=[];e[t].forEach(n=>{this.relations[n]&&s.push(this._cleanCopy(this.relations[n]))}),e[t]=s}}}iterateTree(e,t){const r=s=>{if(s!=null){if(s.constructor===Array)for(let n=0;n<s.length;n++)r(s[n]);else if(s.constructor===Object){if(s._stopResolving)return;for(const n in s)(s.component&&s._uid||s.type==="link")&&(this._insertRelations(s,n,t),this._insertLinks(s,n)),r(s[n])}}};r(e.content)}async resolveLinks(e,t){let r=[];if(e.link_uuids){const s=e.link_uuids.length,n=[],a=50;for(let i=0;i<s;i+=a){const c=Math.min(s,i+a);n.push(e.link_uuids.slice(i,c))}for(let i=0;i<n.length;i++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:n[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(s=>{this.links[s.uuid]=R(y({},s),{_stopResolving:!0})})}async resolveRelations(e,t){let r=[];if(e.rel_uuids){const s=e.rel_uuids.length,n=[],a=50;for(let i=0;i<s;i+=a){const c=Math.min(s,i+a);n.push(e.rel_uuids.slice(i,c))}for(let i=0;i<n.length;i++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:n[i].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.rels;r&&r.length>0&&r.forEach(s=>{this.relations[s.uuid]=R(y({},s),{_stopResolving:!0})})}async resolveStories(e,t){var r,s;let n=[];if(typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(n=t.resolve_relations.split(","),await this.resolveRelations(e,t)),t.resolve_links&&["1","story","url"].indexOf(t.resolve_links)>-1&&(((r=e.links)==null?void 0:r.length)||((s=e.link_uuids)==null?void 0:s.length))&&await this.resolveLinks(e,t),this.resolveNestedRelations)for(const a in this.relations)this.iterateTree(this.relations[a],n);e.story?this.iterateTree(e.story,n):e.stories.forEach(a=>{this.iterateTree(a,n)})}cacheResponse(e,t,r){return new Promise((s,n)=>{const a=this.helpers.stringify({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const c=i.get(a);if(c)return s(c)}try{(async()=>{var c;const d=await this.throttle("get",e,t);let f={data:d.data,headers:d.headers};if((c=d.headers)!=null&&c["per-page"]&&(f=Object.assign({},f,{perPage:d.headers["per-page"]?parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?parseInt(d.headers.total):0})),d.status!=200)return n(d);(f.data.story||f.data.stories)&&await this.resolveStories(f.data,t),t.version==="published"&&e!="/cdn/spaces/me"&&i.set(a,f),f.data.cv&&t.token&&(t.version=="draft"&&m[t.token]!=f.data.cv&&this.flushCache(),m[t.token]=f.data.cv),s(f)})()}catch{}})}throttledRequest(e,t,r){return this.client[e](t,r)}cacheVersions(){return m}cacheVersion(){return m[this.accessToken]}setCacheVersion(e){this.accessToken&&(m[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return w[e]},getAll(){return w},set(e,t){w[e]=t},flush(){w={}}};default:return{get(){},getAll(){},set(){},flush(){}}}}flushCache(){return this.cacheProvider().flush(),this}}const Te=(o={})=>{const{apiOptions:e}=o;if(!e.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 _e(e)}};var Re=o=>{if(typeof o!="object"||typeof o._editable=="undefined")return{};const e=JSON.parse(o._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};let E;const Ee="https://app.storyblok.com/f/storyblok-v2-latest.js",_=(o,e,t={})=>{if(typeof window!="undefined"){if(typeof window.storyblokRegisterEvent=="undefined"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}if(!o){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],s=>{s.action==="input"&&s.story.id===o?e(s.story):(s.action==="change"||s.action==="published")&&s.storyId===o&&window.location.reload()})})}},Se=(o={})=>{const{bridge:e,accessToken:t,use:r=[],apiOptions:s={},richText:n={}}=o;s.accessToken=s.accessToken||t;const a={bridge:e,apiOptions:s};let i={};return r.forEach(c=>{i=y(y({},i),c(a))}),e!==!1&&W(Ee),E=new b(n.schema),n.resolver&&N(E,n.resolver),i},N=(o,e)=>{o.addNode("blok",t=>{let r="";return t.attrs.body.forEach(s=>{r+=e(s.component,s)}),{html:r}})},Pe=(o,e,t)=>{let r=t||E;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return o===""?"":o?(e&&(r=new b(e.schema),e.resolver&&N(r,e.resolver)),r.render(o)):(console.warn(`${o} is not a valid Richtext object. This might be because the value of the richtext field is empty.
For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`),"")},I=h.forwardRef((r,t)=>{var s=r,{blok:n}=s,e=H(s,["blok"]);if(!n)return console.error("Please provide a 'blok' property to the StoryblokComponent"),_.default.createElement("div",null,"Please provide a blok property to the StoryblokComponent");const o=L(n.component);return o?_.default.createElement(o,U({ref:t,blok:n},e)):_.default.createElement("div",null)});I.displayName="StoryblokComponent";const ue=(n,e={},t={})=>{let[r,s]=h.useState({});return m?(v(r.id,o=>s(o),t),h.useEffect(()=>{async function o(){const{data:a}=await m.get(`cdn/stories/${n}`,e);s(a.story)}o()},[n]),r):(console.error("You can't use useStoryblok if you're not loading apiPlugin."),null)},he=(n={},e={},t=!0)=>{let[r,s]=h.useState(n);return t?(h.useEffect(()=>{v(r.id,o=>s(o),e),s(n)},[n]),r):n};let m=null;const q=()=>(m||console.error("You can't use getStoryblokApi if you're not loading apiPlugin."),m);let $={};const L=n=>$[n]?$[n]:(console.error(`Component ${n} doesn't exist.`),!1),de=(n={})=>{const{storyblokApi:e}=le(n);m=e,$=n.components};l.RichTextSchema=C,l.StoryblokComponent=I,l.apiPlugin=oe,l.getComponent=L,l.getStoryblokApi=q,l.registerStoryblokBridge=v,l.renderRichText=ce,l.storyblokEditable=ie,l.storyblokInit=de,l.useStoryblok=ue,l.useStoryblokApi=q,l.useStoryblokBridge=v,l.useStoryblokState=he,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
For more info about the richtext object check https://github.com/storyblok/storyblok-js#rendering-rich-text`),"")},L=u.forwardRef((r,t)=>{var s=r,{blok:o}=s,e=V(s,["blok"]);if(!o)return console.error("Please provide a 'blok' property to the StoryblokComponent"),g.default.createElement("div",null,"Please provide a blok property to the StoryblokComponent");const n=B(o.component);return n?g.default.createElement(n,J({ref:t,blok:o},e)):g.default.createElement("div",null)});L.displayName="StoryblokComponent";const Oe=(o,e={},t={})=>{let[r,s]=u.useState({});if(!v)return console.error("You can't use useStoryblok if you're not loading apiPlugin."),null;const n=typeof window!="undefined"&&typeof window.storyblokRegisterEvent!="undefined";return u.useEffect(()=>{async function a(){const{data:i}=await v.get(`cdn/stories/${o}`,e);s(i.story),n&&i.story.id&&_(i.story.id,c=>s(c),t)}a()},[o]),r},je=(o=null,e={})=>{let[t,r]=u.useState(o);return!(typeof window!="undefined"&&typeof window.storyblokRegisterEvent!="undefined")||!o?o:(u.useEffect(()=>{r(o),_(t.id,n=>r(n),e)},[o]),t)};let v=null;const U=()=>(v||console.error("You can't use getStoryblokApi if you're not loading apiPlugin."),v);let S={};const B=o=>S[o]?S[o]:(console.error(`Component ${o} doesn't exist.`),!1),$e=(o={})=>{const{storyblokApi:e}=Se(o);v=e,S=o.components};l.RichTextResolver=b,l.RichTextSchema=A,l.StoryblokComponent=L,l.apiPlugin=Te,l.getComponent=B,l.getStoryblokApi=U,l.registerStoryblokBridge=_,l.renderRichText=Pe,l.storyblokEditable=Re,l.storyblokInit=$e,l.useStoryblok=Oe,l.useStoryblokApi=U,l.useStoryblokBridge=_,l.useStoryblokState=je,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
/// <reference types="react" />
import { SbReactSDKOptions, StoriesParams, StoryblokBridgeConfigV2, StoryblokClient, StoryData } from "./types";
import { SbReactSDKOptions, ISbStoriesParams, StoryblokBridgeConfigV2, StoryblokClient, ISbStoryData } from "./types";
export { default as StoryblokComponent } from "./components/storyblok-component";
export { storyblokEditable, apiPlugin, useStoryblokBridge, registerStoryblokBridge, renderRichText, RichTextSchema, } from "@storyblok/js";
export declare const useStoryblok: (slug: string, apiOptions?: StoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => StoryData<import("storyblok-js-client").StoryblokComponent<string> & {
export { storyblokEditable, apiPlugin, useStoryblokBridge, registerStoryblokBridge, renderRichText, RichTextResolver, RichTextSchema, } from "@storyblok/js";
export declare const useStoryblok: (slug: string, apiOptions?: ISbStoriesParams, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<import("@storyblok/js").StoryblokComponentType<string> & {
[index: string]: any;
}>;
export declare const useStoryblokState: <T = void>(initialStory?: StoryData<T>, bridgeOptions?: StoryblokBridgeConfigV2, preview?: boolean) => StoryData<T>;
export declare const useStoryblokState: <T = void>(initialStory?: ISbStoryData<T>, bridgeOptions?: StoryblokBridgeConfigV2) => ISbStoryData<T>;
export declare const useStoryblokApi: () => StoryblokClient;

@@ -10,0 +10,0 @@ export { useStoryblokApi as getStoryblokApi };

@@ -9,2 +9,2 @@ import { SbSDKOptions } from "@storyblok/js";

}
export type { AlternateObject, Richtext, RichtextInstance, SbBlokData, SbBlokKeyDataTypes, SbRichTextOptions, SbSDKOptions, Stories, StoriesParams, Story, StoryData, StoryParams, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokCache, StoryblokCacheProvider, StoryblokClient, StoryblokComponentType, StoryblokConfig, StoryblokManagmentApiResult, StoryblokResult, apiPlugin, useStoryblokBridge, } from "@storyblok/js";
export type { ISbConfig, ISbCache, ISbResult, ISbResponse, ISbError, ISbNode, ISbSchema, ThrottleFn, AsyncFn, ArrayFn, ISbContentMangmntAPI, ISbManagmentApiResult, ISbStories, ISbStory, ISbDimensions, ISbStoryData, ISbAlternateObject, ISbStoriesParams, ISbStoryParams, ISbRichtext, SbBlokData, SbBlokKeyDataTypes, SbRichTextOptions, SbSDKOptions, StoryblokBridgeConfigV2, StoryblokBridgeV2, StoryblokClient, StoryblokComponentType, useStoryblokBridge, } from "@storyblok/js";
{
"name": "@storyblok/react",
"version": "1.3.5",
"version": "2.0.0",
"description": "SDK to integrate Storyblok into your project using React.",

@@ -27,3 +27,3 @@ "main": "./dist/storyblok-react.js",

"dependencies": {
"@storyblok/js": "^1.8.6"
"@storyblok/js": "^2.0.5"
},

@@ -30,0 +30,0 @@ "devDependencies": {

@@ -39,9 +39,11 @@ <div align="center">

Install `@storyblok/react` and it's peer dependency `axios`:
Install `@storyblok/react`:
```bash
npm install @storyblok/react axios
// yarn add @storyblok/react axios
npm install @storyblok/react
// yarn add @storyblok/react
```
> ⚠ī¸ This SDK uses the Fetch API under the hood. If your environment doesn't support it, you need to install a polyfill like [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch). More info on [storyblok-js-client docs](https://github.com/storyblok/storyblok-js-client#fetch-use-polyfill-if-needed---version-5).
#### From a CDN

@@ -48,0 +50,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡ī¸ by Socket Inc