@storyblok/react 2.1.5 → 2.1.7
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/dist/{client-7b1fd9f5.mjs → client-580f8a39.mjs} +10 -7
- package/dist/client-f55c03c7.js +1 -0
- package/dist/{index-c2e3dd49.js → index-45a2f239.js} +1 -1
- package/dist/{index-a23f03ba.mjs → index-b8bd6e01.mjs} +1 -1
- package/dist/{storyblok-js-1cafaa66.js → storyblok-js-5db94779.js} +1 -1
- package/dist/{storyblok-js-834d6ca5.mjs → storyblok-js-5fd880b4.mjs} +114 -112
- package/dist/storyblok-react.js +1 -1
- package/dist/storyblok-react.mjs +19 -21
- package/dist/storyblok-react2.js +1 -1
- package/dist/storyblok-react2.mjs +2 -2
- package/dist/storyblok-react3.js +1 -1
- package/dist/storyblok-react3.mjs +1 -1
- package/dist/storyblok-react4.js +1 -1
- package/dist/storyblok-react4.mjs +10 -8
- package/dist/types/story.d.ts +1 -1
- package/package.json +6 -6
- package/dist/client-85627252.js +0 -1
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { u as ue } from "./storyblok-js-
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { u as ue } from "./storyblok-js-5fd880b4.mjs";
|
|
3
3
|
const useStoryblokState = (initialStory = null, bridgeOptions = {}) => {
|
|
4
4
|
let [story, setStory] = useState(initialStory);
|
|
5
5
|
const isBridgeEnable = typeof window !== "undefined" && typeof window.storyblokRegisterEvent !== "undefined";
|
|
6
6
|
if (!isBridgeEnable || !initialStory) {
|
|
7
7
|
return initialStory;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
setStory(initialStory);
|
|
11
|
+
ue(
|
|
12
|
+
story.id,
|
|
13
|
+
(newStory) => setStory(newStory),
|
|
14
|
+
bridgeOptions
|
|
15
|
+
);
|
|
16
|
+
}, [initialStory]);
|
|
14
17
|
return story;
|
|
15
18
|
};
|
|
16
19
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react"),t=require("./storyblok-js-5db94779.js");exports.useStoryblokState=(r=null,o={})=>{let[s,u]=e.useState(r);return"undefined"!=typeof window&&void 0!==window.storyblokRegisterEvent&&r?(e.useEffect((()=>{u(r),t.ue(s.id,(e=>u(e)),o)}),[r]),s):r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./storyblok-js-
|
|
1
|
+
"use strict";const o=require("./storyblok-js-5db94779.js"),e=require("react"),t=e.forwardRef((({blok:o,...t},r)=>{if(!o)return console.error("Please provide a 'blok' property to the StoryblokComponent"),e.createElement("div",null,"Please provide a blok property to the StoryblokComponent");const n=l(o.component);return n?e.createElement(n,{ref:r,blok:o,...t}):e.createElement("div",null)}));t.displayName="StoryblokComponent";let r=null,n={};const l=o=>n[o]?n[o]:(console.error(`Component ${o} doesn't exist.`),!1);exports.StoryblokComponent=t,exports.getComponent=l,exports.storyblokInit=(e={})=>{const{storyblokApi:t}=o.pe(e);r=t,n=e.components},exports.useStoryblokApi=()=>(r||console.error("You can't use getStoryblokApi if you're not loading apiPlugin."),r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";let t=!1;const e=[],s=s=>new Promise(((r,o)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=s=>{window.location!==window.parent.location?t?s():e.push(s):console.warn("You are not in Draft Mode or in the Visual Editor.")},document.getElementById("storyblok-javascript-bridge")))return;const i=document.createElement("script");i.async=!0,i.src=s,i.id="storyblok-javascript-bridge",i.onerror=t=>o(t),i.onload=s=>{e.forEach((t=>t())),t=!0,r(s)},document.getElementsByTagName("head")[0].appendChild(i)}));var r=Object.defineProperty,o=(t,e,s)=>(((t,e,s)=>{e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(t,"symbol"!=typeof e?e+"":e,s),s);function i(t){return!(t!=t||t===1/0||t===-1/0)}const n=function(t,e){const s={};for(const r in t){const o=t[r];e.indexOf(r)>-1&&null!==o&&(s[r]=o)}return s},a={nodes:{horizontal_rule:()=>({singleTag:"hr"}),blockquote:()=>({tag:"blockquote"}),bullet_list:()=>({tag:"ul"}),code_block:t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),hard_break:()=>({singleTag:"br"}),heading:t=>({tag:`h${t.attrs.level}`}),image:t=>({singleTag:[{tag:"img",attrs:n(t.attrs,["src","alt","title"])}]}),list_item:()=>({tag:"li"}),ordered_list:()=>({tag:"ol"}),paragraph:()=>({tag:"p"}),emoji:t=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":t.attrs.name,emoji:t.attrs.emoji}}]})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link:t=>{const e={...t.attrs},{linktype:s="url"}=t.attrs;if((t=>"email"===t)(s)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),e.custom){for(const t in e.custom)e[t]=e.custom[t];delete e.custom}return{tag:[{tag:"a",attrs:e}]}},styled:t=>({tag:[{tag:"span",attrs:t.attrs}]}),subscript:()=>({tag:"sub"}),superscript:()=>({tag:"sup"}),anchor:t=>({tag:[{tag:"span",attrs:t.attrs}]}),highlight:t=>{var e;return null!=(e=t.attrs)&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${t.attrs.color};`}}]}:{tag:""}},textStyle:t=>{var e;return null!=(e=t.attrs)&&e.color?{tag:[{tag:"span",attrs:{style:`color:${t.attrs.color}`}}]}:{tag:""}}}};class l{constructor(t){o(this,"marks"),o(this,"nodes"),t||(t=a),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t,e={optimizeImages:!1}){if(t&&t.content&&Array.isArray(t.content)){let s="";return t.content.forEach((t=>{s+=this.renderNode(t)})),e.optimizeImages?this.optimizeImages(s,e.optimizeImages):s}return console.warn("The render method must receive an Object with a \"content\" field.\n\t\t\tThe \"content\" field must be an array of nodes as the type ISbRichtext.\n\t\t\tISbRichtext:\n\t\t\t\tcontent?: ISbRichtext[]\n\t\t\t\tmarks?: ISbRichtext[]\n\t\t\t\tattrs?: any\n\t\t\t\ttext?: string\n\t\t\t\ttype: string\n\t\t\t\t\n\t\t\t\tExample:\n\t\t\t\t{\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'Hello World',\n\t\t\t\t\t\t\t\t\ttype: 'text'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttype: 'paragraph'\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\ttype: 'doc'\n\t\t\t\t}"),""}optimizeImages(t,e){let s=0,r=0,o="",i="";"boolean"!=typeof e&&("number"==typeof e.width&&e.width>0&&(o+=`width="${e.width}" `,s=e.width),"number"==typeof e.height&&e.height>0&&(o+=`height="${e.height}" `,r=e.height),("lazy"===e.loading||"eager"===e.loading)&&(o+=`loading="${e.loading}" `),"string"==typeof e.class&&e.class.length>0&&(o+=`class="${e.class}" `),e.filters&&("number"==typeof e.filters.blur&&e.filters.blur>=0&&e.filters.blur<=100&&(i+=`:blur(${e.filters.blur})`),"number"==typeof e.filters.brightness&&e.filters.brightness>=-100&&e.filters.brightness<=100&&(i+=`:brightness(${e.filters.brightness})`),e.filters.fill&&(e.filters.fill.match(/[0-9A-Fa-f]{6}/g)||"transparent"===e.filters.fill)&&(i+=`:fill(${e.filters.fill})`),e.filters.format&&["webp","png","jpeg"].includes(e.filters.format)&&(i+=`:format(${e.filters.format})`),"boolean"==typeof e.filters.grayscale&&e.filters.grayscale&&(i+=":grayscale()"),"number"==typeof e.filters.quality&&e.filters.quality>=0&&e.filters.quality<=100&&(i+=`:quality(${e.filters.quality})`),e.filters.rotate&&[90,180,270].includes(e.filters.rotate)&&(i+=`:rotate(${e.filters.rotate})`),i.length>0&&(i="/filters"+i))),o.length>0&&(t=t.replace(/<img/g,`<img ${o.trim()}`));const n=s>0||r>0||i.length>0?`${s}x${r}${i}`:"";return t=t.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${n}`),"boolean"!=typeof e&&(e.sizes||e.srcset)&&(t=t.replace(/<img.*?src=["|'](.*?)["|']/g,(t=>{var s,r;const o=t.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(o&&o.length>0){const n={srcset:null==(s=e.srcset)?void 0:s.map((t=>{if("number"==typeof t)return`//${o}/m/${t}x0${i} ${t}w`;if("object"==typeof t&&2===t.length){let e=0,s=0;return"number"==typeof t[0]&&(e=t[0]),"number"==typeof t[1]&&(s=t[1]),`//${o}/m/${e}x${s}${i} ${e}w`}})).join(", "),sizes:null==(r=e.sizes)?void 0:r.map((t=>t)).join(", ")};let a="";return n.srcset&&(a+=`srcset="${n.srcset}" `),n.sizes&&(a+=`sizes="${n.sizes}" `),t.replace(/<img/g,`<img ${a.trim()}`)}return t}))),t}renderNode(t){const e=[];t.marks&&t.marks.forEach((t=>{const s=this.getMatchingMark(t);s&&""!==s.tag&&e.push(this.renderOpeningTag(s.tag))}));const s=this.getMatchingNode(t);return s&&s.tag&&e.push(this.renderOpeningTag(s.tag)),t.content?t.content.forEach((t=>{e.push(this.renderNode(t))})):t.text?e.push(function(t){const e={"&":"&","<":"<",">":">",'"':""","'":"'"},s=/[&<>"']/g,r=RegExp(s.source);return t&&r.test(t)?t.replace(s,(t=>e[t])):t}(t.text)):s&&s.singleTag?e.push(this.renderTag(s.singleTag," /")):s&&s.html?e.push(s.html):"emoji"===t.type&&e.push(this.renderEmoji(t)),s&&s.tag&&e.push(this.renderClosingTag(s.tag)),t.marks&&t.marks.slice(0).reverse().forEach((t=>{const s=this.getMatchingMark(t);s&&""!==s.tag&&e.push(this.renderClosingTag(s.tag))})),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map((t=>{if(t.constructor===String)return`<${t}${e}>`;{let s=`<${t.tag}`;if(t.attrs)for(const e in t.attrs){const r=t.attrs[e];null!==r&&(s+=` ${e}="${r}"`)}return`${s}${e}>`}})).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map((t=>t.constructor===String?`</${t}>`:`</${t.tag}>`)).join("")}getMatchingNode(t){const e=this.nodes[t.type];if("function"==typeof e)return e(t)}getMatchingMark(t){const e=this.marks[t.type];if("function"==typeof e)return e(t)}renderEmoji(t){if(t.attrs.emoji)return t.attrs.emoji;const e=[{tag:"img",attrs:{src:t.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(e," /")}}class c{constructor(){o(this,"isCDNUrl",((t="")=>t.indexOf("/cdn/")>-1)),o(this,"getOptionsPage",((t,e=25,s=1)=>({...t,per_page:e,page:s}))),o(this,"delay",(t=>new Promise((e=>setTimeout(e,t))))),o(this,"arrayFrom",((t=0,e)=>[...Array(t)].map(e))),o(this,"range",((t=0,e=t)=>{const s=Math.abs(e-t)||0,r=t<e?1:-1;return this.arrayFrom(s,((e,s)=>s*r+t))})),o(this,"asyncMap",(async(t,e)=>Promise.all(t.map(e)))),o(this,"flatMap",((t=[],e)=>t.map(e).reduce(((t,e)=>[...t,...e]),[])))}stringify(t,e,s){const r=[];for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const i=t[o],n=s?"":encodeURIComponent(o);let a;a="object"==typeof i?this.stringify(i,e?e+encodeURIComponent("["+n+"]"):n,Array.isArray(i)):(e?e+encodeURIComponent("["+n+"]"):n)+"="+encodeURIComponent(i),r.push(a)}return r.join("&")}getRegionURL(t){switch(t){case"us":return"api-us.storyblok.com";case"cn":return"app.storyblokchina.cn";default:return"api.storyblok.com"}}}class h{constructor(t){o(this,"baseURL"),o(this,"timeout"),o(this,"headers"),o(this,"responseInterceptor"),o(this,"fetch"),o(this,"ejectInterceptor"),o(this,"url"),o(this,"parameters"),this.baseURL=t.baseURL,this.headers=t.headers||new Headers,this.timeout=null!=t&&t.timeout?1e3*t.timeout:0,this.responseInterceptor=t.responseInterceptor,this.fetch=(...e)=>t.fetch?t.fetch(...e):fetch(...e),this.ejectInterceptor=!1,this.url="",this.parameters={}}get(t,e){return this.url=t,this.parameters=e,this._methodHandler("get")}post(t,e){return this.url=t,this.parameters=e,this._methodHandler("post")}put(t,e){return this.url=t,this.parameters=e,this._methodHandler("put")}delete(t,e){return this.url=t,this.parameters=e,this._methodHandler("delete")}async _responseHandler(t){const e=[],s={data:{},headers:{},status:0,statusText:""};204!==t.status&&await t.json().then((t=>{s.data=t}));for(const r of t.headers.entries())e[r[0]]=r[1];return s.headers={...e},s.status=t.status,s.statusText=t.statusText,s}async _methodHandler(t){let e=`${this.baseURL}${this.url}`,s=null;if("get"===t){const t=new c;e=`${this.baseURL}${this.url}?${t.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(e),o=new AbortController,{signal:i}=o;let n;this.timeout&&(n=setTimeout((()=>o.abort()),this.timeout));try{const e=await this.fetch(`${r}`,{method:t,headers:this.headers,body:s,signal:i});this.timeout&&clearTimeout(n);const o=await this._responseHandler(e);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(o)):this._statusHandler(o)}catch(a){return{message:a}}}eject(){this.ejectInterceptor=!0}_statusHandler(t){const e=/20[0-6]/g;return new Promise(((s,r)=>{if(e.test(`${t.status}`))return s(t);r({message:new Error(t.statusText),status:t.status,response:Array.isArray(t.data)?t.data[0]:t.data.error||t.data.slug})}))}}let u={};const p={};class d{constructor(t,e){if(o(this,"client"),o(this,"maxRetries"),o(this,"throttle"),o(this,"accessToken"),o(this,"cache"),o(this,"helpers"),o(this,"resolveCounter"),o(this,"relations"),o(this,"links"),o(this,"richTextResolver"),o(this,"resolveNestedRelations"),!e){const s=(new c).getRegionURL,r=!1===t.https?"http":"https";e=t.oauthToken?`${r}://${s(t.region)}/v1`:`${r}://${s(t.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),s.forEach(((e,r)=>{t.headers&&t.headers[r]&&s.set(r,t.headers[r])}));let r=5;t.oauthToken&&(s.set("Authorization",t.oauthToken),r=3),t.rateLimit&&(r=t.rateLimit),t.richTextSchema?this.richTextResolver=new l(t.richTextSchema):this.richTextResolver=new l,t.componentResolver&&this.setComponentResolver(t.componentResolver),this.maxRetries=t.maxRetries||5,this.throttle=function(t,e,s){if(!i(e))throw new TypeError("Expected `limit` to be a finite number");if(!i(s))throw new TypeError("Expected `interval` to be a finite number");const r=[];let o=[],n=0;const a=function(){n++;const e=setTimeout((function(){n--,r.length>0&&a(),o=o.filter((function(t){return t!==e}))}),s);o.indexOf(e)<0&&o.push(e);const i=r.shift();i.resolve(t.apply(i.self,i.args))},l=function(...t){const s=this;return new Promise((function(o,i){r.push({resolve:o,reject:i,args:t,self:s}),n<e&&a()}))};return l.abort=function(){o.forEach(clearTimeout),o=[],r.forEach((function(t){t.reject((function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"}))})),r.length=0},l}(this.throttledRequest,r,1e3),this.accessToken=t.accessToken||"",this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.helpers=new c,this.resolveCounter=0,this.resolveNestedRelations=t.resolveNestedRelations||!0,this.client=new h({baseURL:e,timeout:t.timeout||0,headers:s,responseInterceptor:t.responseInterceptor,fetch:t.fetch})}setComponentResolver(t){this.richTextResolver.addNode("blok",(e=>{let s="";return e.attrs.body&&e.attrs.body.forEach((e=>{s+=t(e.component,e)})),{html:s}}))}parseParams(t){return t.version||(t.version="published"),t.token||(t.token=this.getToken()),t.cv||(t.cv=p[t.token]),Array.isArray(t.resolve_relations)&&(t.resolve_relations=t.resolve_relations.join(",")),t}factoryParamOptions(t,e){return this.helpers.isCDNUrl(t)?this.parseParams(e):e}makeRequest(t,e,s,r){const o=this.factoryParamOptions(t,this.helpers.getOptionsPage(e,s,r));return this.cacheResponse(t,o)}get(t,e){e||(e={});const s=`/${t}`,r=this.factoryParamOptions(s,e);return this.cacheResponse(s,r)}async getAll(t,e,s){const r=(null==e?void 0:e.per_page)||25,o=`/${t}`,i=o.split("/"),n=s||i[i.length-1],a=await this.makeRequest(o,e,r,1),l=a.total?Math.ceil(a.total/r):1,c=await this.helpers.asyncMap(this.helpers.range(1,l),(t=>this.makeRequest(o,e,r,t+1)));return this.helpers.flatMap([a,...c],(t=>Object.values(t.data[n])))}post(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("post",s,e))}put(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("put",s,e))}delete(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("delete",s,e))}getStories(t){return this.get("cdn/stories",t)}getStory(t,e){return this.get(`cdn/stories/${t}`,e)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e,s){const r=t[e];r&&"multilink"==r.fieldtype&&"story"==r.linktype&&"string"==typeof r.id&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&"story"===r.linktype&&"string"==typeof r.uuid&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}_insertRelations(t,e,s,r){if(s.indexOf(`${t.component}.${e}`)>-1)if("string"==typeof t[e])this.relations[r][t[e]]&&(t[e]=this._cleanCopy(this.relations[r][t[e]]));else if(t[e]&&t[e].constructor===Array){const s=[];t[e].forEach((t=>{this.relations[r][t]&&s.push(this._cleanCopy(this.relations[r][t]))})),t[e]=s}}iterateTree(t,e,s){const r=t=>{if(null!=t)if(t.constructor===Array)for(let e=0;e<t.length;e++)r(t[e]);else if(t.constructor===Object){if(t._stopResolving)return;for(const o in t)(t.component&&t._uid||"link"===t.type)&&(this._insertRelations(t,o,e,s),this._insertLinks(t,o,s)),r(t[o])}};r(t.content)}async resolveLinks(t,e,s){let r=[];if(t.link_uuids){const s=t.link_uuids.length,o=[],i=50;for(let e=0;e<s;e+=i){const r=Math.min(s,e+i);o.push(t.link_uuids.slice(e,r))}for(let t=0;t<o.length;t++)(await this.getStories({per_page:i,language:e.language,version:e.version,by_uuids:o[t].join(",")})).data.stories.forEach((t=>{r.push(t)}))}else r=t.links;r.forEach((t=>{this.links[s][t.uuid]={...t,_stopResolving:!0}}))}async resolveRelations(t,e,s){let r=[];if(t.rel_uuids){const s=t.rel_uuids.length,o=[],i=50;for(let e=0;e<s;e+=i){const r=Math.min(s,e+i);o.push(t.rel_uuids.slice(e,r))}for(let t=0;t<o.length;t++)(await this.getStories({per_page:i,language:e.language,version:e.version,by_uuids:o[t].join(",")})).data.stories.forEach((t=>{r.push(t)}))}else r=t.rels;r&&r.length>0&&r.forEach((t=>{this.relations[s][t.uuid]={...t,_stopResolving:!0}}))}async resolveStories(t,e,s){var r,o;let i=[];if(this.links[s]={},this.relations[s]={},typeof e.resolve_relations<"u"&&e.resolve_relations.length>0&&("string"==typeof e.resolve_relations&&(i=e.resolve_relations.split(",")),await this.resolveRelations(t,e,s)),e.resolve_links&&["1","story","url"].indexOf(e.resolve_links)>-1&&(null!=(r=t.links)&&r.length||null!=(o=t.link_uuids)&&o.length)&&await this.resolveLinks(t,e,s),this.resolveNestedRelations)for(const n in this.relations[s])this.iterateTree(this.relations[s][n],i,s);t.story?this.iterateTree(t.story,i,s):t.stories.forEach((t=>{this.iterateTree(t,i,s)})),delete this.links[s],delete this.relations[s]}async cacheResponse(t,e,s){const r=this.helpers.stringify({url:t,params:e}),o=this.cacheProvider();if("auto"===this.cache.clear&&"draft"===e.version&&await this.flushCache(),"published"===e.version&&"/cdn/spaces/me"!=t){const t=await o.get(r);if(t)return Promise.resolve(t)}return new Promise(((s,i)=>{try{(async()=>{var n;try{const a=await this.throttle("get",t,e);let l={data:a.data,headers:a.headers};if(null!=(n=a.headers)&&n["per-page"]&&(l=Object.assign({},l,{perPage:a.headers["per-page"]?parseInt(a.headers["per-page"]):0,total:a.headers["per-page"]?parseInt(a.headers.total):0})),200!=a.status)return i(a);if(l.data.story||l.data.stories){const t=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(l.data,e,`${t}`)}return"published"===e.version&&"/cdn/spaces/me"!=t&&await o.set(r,l),l.data.cv&&e.token&&("draft"==e.version&&p[e.token]!=l.data.cv&&await this.flushCache(),p[e.token]=l.data.cv),s(l)}catch(a){return i(a)}})()}catch{}}))}throttledRequest(t,e,s){return this.client[t](e,s)}cacheVersions(){return p}cacheVersion(){return p[this.accessToken]}setCacheVersion(t){this.accessToken&&(p[this.accessToken]=t)}cacheProvider(){switch(this.cache.type){case"memory":return{get:t=>Promise.resolve(u[t]),getAll:()=>Promise.resolve(u),set:(t,e)=>(u[t]=e,Promise.resolve(void 0)),flush:()=>(u={},Promise.resolve(void 0))};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get:()=>Promise.resolve(void 0),getAll:()=>Promise.resolve(void 0),set:()=>Promise.resolve(void 0),flush:()=>Promise.resolve(void 0)}}}async flushCache(){return await this.cacheProvider().flush(),this}}let g;const f="https://app.storyblok.com/f/storyblok-v2-latest.js",m=(t,e)=>{t.addNode("blok",(t=>{let s="";return t.attrs.body.forEach((t=>{s+=e(t.component,t)})),{html:s}}))};exports.ce=(t={})=>{const{apiOptions:e}=t;if(e.accessToken)return{storyblokApi:new d(e)};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")},exports.de=(t,e,s)=>{let r=s||g;if(r)return(t=>{var e,s;return!t||"blok"!==(null==(e=null==t?void 0:t.content)?void 0:e[0].type)&&!(null!=(s=null==t?void 0:t.content)&&s[0].content)})(t)?"":(e&&(r=new l(e.schema),e.resolver&&m(r,e.resolver)),r.render(t));console.error("Please initialize the Storyblok SDK before calling the renderRichText function")},exports.ge=()=>s(f),exports.he=t=>{if("object"!=typeof t||typeof t._editable>"u")return{};const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}},exports.ie=a,exports.pe=(t={})=>{var e,r;const{bridge:o,accessToken:i,use:n=[],apiOptions:a={},richText:c={}}=t;a.accessToken=a.accessToken||i;const h={bridge:o,apiOptions:a};let u={};n.forEach((t=>{u={...u,...t(h)}}));const p=!(typeof window>"u")&&(null==(r=null==(e=window.location)?void 0:e.search)?void 0:r.includes("_storyblok_tk"));return!1!==o&&p&&s(f),g=new l(c.schema),c.resolver&&m(g,c.resolver),u},exports.ue=(t,e,s={})=>{var r;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",i=+new URL(null==(r=window.location)?void 0:r.href).searchParams.get("_storyblok")===t;if(o&&i){if(!t)return void console.warn("Story ID is not defined. Please provide a valid ID.");window.storyblokRegisterEvent((()=>{new window.StoryblokBridge(s).on(["input","published","change"],(s=>{"input"===s.action&&s.story.id===t?e(s.story):("change"===s.action||"published"===s.action)&&s.storyId===t&&window.location.reload()}))}))}},exports.y=l;
|
|
1
|
+
"use strict";let t=!1;const e=[],s=s=>new Promise(((r,o)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=s=>{window.location!==window.parent.location?t?s():e.push(s):console.warn("You are not in Draft Mode or in the Visual Editor.")},document.getElementById("storyblok-javascript-bridge")))return;const i=document.createElement("script");i.async=!0,i.src=s,i.id="storyblok-javascript-bridge",i.onerror=t=>o(t),i.onload=s=>{e.forEach((t=>t())),t=!0,r(s)},document.getElementsByTagName("head")[0].appendChild(i)}));var r=Object.defineProperty,o=(t,e,s)=>(((t,e,s)=>{e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s})(t,"symbol"!=typeof e?e+"":e,s),s);function i(t){return!(t!=t||t===1/0||t===-1/0)}const n=function(t,e){const s={};for(const r in t){const o=t[r];e.indexOf(r)>-1&&null!==o&&(s[r]=o)}return s},a={nodes:{horizontal_rule:()=>({singleTag:"hr"}),blockquote:()=>({tag:"blockquote"}),bullet_list:()=>({tag:"ul"}),code_block:t=>({tag:["pre",{tag:"code",attrs:t.attrs}]}),hard_break:()=>({singleTag:"br"}),heading:t=>({tag:`h${t.attrs.level}`}),image:t=>({singleTag:[{tag:"img",attrs:n(t.attrs,["src","alt","title"])}]}),list_item:()=>({tag:"li"}),ordered_list:()=>({tag:"ol"}),paragraph:()=>({tag:"p"}),emoji:t=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":t.attrs.name,emoji:t.attrs.emoji}}]})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link:t=>{const e={...t.attrs},{linktype:s="url"}=t.attrs;if((t=>"email"===t)(s)&&(e.href=`mailto:${e.href}`),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),e.custom){for(const t in e.custom)e[t]=e.custom[t];delete e.custom}return{tag:[{tag:"a",attrs:e}]}},styled:t=>({tag:[{tag:"span",attrs:t.attrs}]}),subscript:()=>({tag:"sub"}),superscript:()=>({tag:"sup"}),anchor:t=>({tag:[{tag:"span",attrs:t.attrs}]}),highlight:t=>{var e;return null!=(e=t.attrs)&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${t.attrs.color};`}}]}:{tag:""}},textStyle:t=>{var e;return null!=(e=t.attrs)&&e.color?{tag:[{tag:"span",attrs:{style:`color:${t.attrs.color}`}}]}:{tag:""}}}};class l{constructor(t){o(this,"marks"),o(this,"nodes"),t||(t=a),this.marks=t.marks||[],this.nodes=t.nodes||[]}addNode(t,e){this.nodes[t]=e}addMark(t,e){this.marks[t]=e}render(t,e={optimizeImages:!1}){if(t&&t.content&&Array.isArray(t.content)){let s="";return t.content.forEach((t=>{s+=this.renderNode(t)})),e.optimizeImages?this.optimizeImages(s,e.optimizeImages):s}return console.warn("The render method must receive an Object with a \"content\" field.\n\t\t\tThe \"content\" field must be an array of nodes as the type ISbRichtext.\n\t\t\tISbRichtext:\n\t\t\t\tcontent?: ISbRichtext[]\n\t\t\t\tmarks?: ISbRichtext[]\n\t\t\t\tattrs?: any\n\t\t\t\ttext?: string\n\t\t\t\ttype: string\n\t\t\t\t\n\t\t\t\tExample:\n\t\t\t\t{\n\t\t\t\t\tcontent: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: 'Hello World',\n\t\t\t\t\t\t\t\t\ttype: 'text'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttype: 'paragraph'\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\ttype: 'doc'\n\t\t\t\t}"),""}optimizeImages(t,e){let s=0,r=0,o="",i="";"boolean"!=typeof e&&("number"==typeof e.width&&e.width>0&&(o+=`width="${e.width}" `,s=e.width),"number"==typeof e.height&&e.height>0&&(o+=`height="${e.height}" `,r=e.height),("lazy"===e.loading||"eager"===e.loading)&&(o+=`loading="${e.loading}" `),"string"==typeof e.class&&e.class.length>0&&(o+=`class="${e.class}" `),e.filters&&("number"==typeof e.filters.blur&&e.filters.blur>=0&&e.filters.blur<=100&&(i+=`:blur(${e.filters.blur})`),"number"==typeof e.filters.brightness&&e.filters.brightness>=-100&&e.filters.brightness<=100&&(i+=`:brightness(${e.filters.brightness})`),e.filters.fill&&(e.filters.fill.match(/[0-9A-Fa-f]{6}/g)||"transparent"===e.filters.fill)&&(i+=`:fill(${e.filters.fill})`),e.filters.format&&["webp","png","jpeg"].includes(e.filters.format)&&(i+=`:format(${e.filters.format})`),"boolean"==typeof e.filters.grayscale&&e.filters.grayscale&&(i+=":grayscale()"),"number"==typeof e.filters.quality&&e.filters.quality>=0&&e.filters.quality<=100&&(i+=`:quality(${e.filters.quality})`),e.filters.rotate&&[90,180,270].includes(e.filters.rotate)&&(i+=`:rotate(${e.filters.rotate})`),i.length>0&&(i="/filters"+i))),o.length>0&&(t=t.replace(/<img/g,`<img ${o.trim()}`));const n=s>0||r>0||i.length>0?`${s}x${r}${i}`:"";return t=t.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${n}`),"boolean"!=typeof e&&(e.sizes||e.srcset)&&(t=t.replace(/<img.*?src=["|'](.*?)["|']/g,(t=>{var s,r;const o=t.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(o&&o.length>0){const n={srcset:null==(s=e.srcset)?void 0:s.map((t=>{if("number"==typeof t)return`//${o}/m/${t}x0${i} ${t}w`;if("object"==typeof t&&2===t.length){let e=0,s=0;return"number"==typeof t[0]&&(e=t[0]),"number"==typeof t[1]&&(s=t[1]),`//${o}/m/${e}x${s}${i} ${e}w`}})).join(", "),sizes:null==(r=e.sizes)?void 0:r.map((t=>t)).join(", ")};let a="";return n.srcset&&(a+=`srcset="${n.srcset}" `),n.sizes&&(a+=`sizes="${n.sizes}" `),t.replace(/<img/g,`<img ${a.trim()}`)}return t}))),t}renderNode(t){const e=[];t.marks&&t.marks.forEach((t=>{const s=this.getMatchingMark(t);s&&""!==s.tag&&e.push(this.renderOpeningTag(s.tag))}));const s=this.getMatchingNode(t);return s&&s.tag&&e.push(this.renderOpeningTag(s.tag)),t.content?t.content.forEach((t=>{e.push(this.renderNode(t))})):t.text?e.push(function(t){const e={"&":"&","<":"<",">":">",'"':""","'":"'"},s=/[&<>"']/g,r=RegExp(s.source);return t&&r.test(t)?t.replace(s,(t=>e[t])):t}(t.text)):s&&s.singleTag?e.push(this.renderTag(s.singleTag," /")):s&&s.html?e.push(s.html):"emoji"===t.type&&e.push(this.renderEmoji(t)),s&&s.tag&&e.push(this.renderClosingTag(s.tag)),t.marks&&t.marks.slice(0).reverse().forEach((t=>{const s=this.getMatchingMark(t);s&&""!==s.tag&&e.push(this.renderClosingTag(s.tag))})),e.join("")}renderTag(t,e){return t.constructor===String?`<${t}${e}>`:t.map((t=>{if(t.constructor===String)return`<${t}${e}>`;{let s=`<${t.tag}`;if(t.attrs)for(const e in t.attrs){const r=t.attrs[e];null!==r&&(s+=` ${e}="${r}"`)}return`${s}${e}>`}})).join("")}renderOpeningTag(t){return this.renderTag(t,"")}renderClosingTag(t){return t.constructor===String?`</${t}>`:t.slice(0).reverse().map((t=>t.constructor===String?`</${t}>`:`</${t.tag}>`)).join("")}getMatchingNode(t){const e=this.nodes[t.type];if("function"==typeof e)return e(t)}getMatchingMark(t){const e=this.marks[t.type];if("function"==typeof e)return e(t)}renderEmoji(t){if(t.attrs.emoji)return t.attrs.emoji;const e=[{tag:"img",attrs:{src:t.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(e," /")}}class c{constructor(){o(this,"isCDNUrl",((t="")=>t.indexOf("/cdn/")>-1)),o(this,"getOptionsPage",((t,e=25,s=1)=>({...t,per_page:e,page:s}))),o(this,"delay",(t=>new Promise((e=>setTimeout(e,t))))),o(this,"arrayFrom",((t=0,e)=>[...Array(t)].map(e))),o(this,"range",((t=0,e=t)=>{const s=Math.abs(e-t)||0,r=t<e?1:-1;return this.arrayFrom(s,((e,s)=>s*r+t))})),o(this,"asyncMap",(async(t,e)=>Promise.all(t.map(e)))),o(this,"flatMap",((t=[],e)=>t.map(e).reduce(((t,e)=>[...t,...e]),[])))}stringify(t,e,s){const r=[];for(const o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;const i=t[o],n=s?"":encodeURIComponent(o);let a;a="object"==typeof i?this.stringify(i,e?e+encodeURIComponent("["+n+"]"):n,Array.isArray(i)):(e?e+encodeURIComponent("["+n+"]"):n)+"="+encodeURIComponent(i),r.push(a)}return r.join("&")}getRegionURL(t){switch(t){case"us":return"api-us.storyblok.com";case"cn":return"app.storyblokchina.cn";default:return"api.storyblok.com"}}}class h{constructor(t){o(this,"baseURL"),o(this,"timeout"),o(this,"headers"),o(this,"responseInterceptor"),o(this,"fetch"),o(this,"ejectInterceptor"),o(this,"url"),o(this,"parameters"),this.baseURL=t.baseURL,this.headers=t.headers||new Headers,this.timeout=null!=t&&t.timeout?1e3*t.timeout:0,this.responseInterceptor=t.responseInterceptor,this.fetch=(...e)=>t.fetch?t.fetch(...e):fetch(...e),this.ejectInterceptor=!1,this.url="",this.parameters={}}get(t,e){return this.url=t,this.parameters=e,this._methodHandler("get")}post(t,e){return this.url=t,this.parameters=e,this._methodHandler("post")}put(t,e){return this.url=t,this.parameters=e,this._methodHandler("put")}delete(t,e){return this.url=t,this.parameters=e,this._methodHandler("delete")}async _responseHandler(t){const e=[],s={data:{},headers:{},status:0,statusText:""};204!==t.status&&await t.json().then((t=>{s.data=t}));for(const r of t.headers.entries())e[r[0]]=r[1];return s.headers={...e},s.status=t.status,s.statusText=t.statusText,s}async _methodHandler(t){let e=`${this.baseURL}${this.url}`,s=null;if("get"===t){const t=new c;e=`${this.baseURL}${this.url}?${t.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(e),o=new AbortController,{signal:i}=o;let n;this.timeout&&(n=setTimeout((()=>o.abort()),this.timeout));try{const e=await this.fetch(`${r}`,{method:t,headers:this.headers,body:s,signal:i});this.timeout&&clearTimeout(n);const o=await this._responseHandler(e);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(o)):this._statusHandler(o)}catch(a){return{message:a}}}eject(){this.ejectInterceptor=!0}_statusHandler(t){const e=/20[0-6]/g;return new Promise(((s,r)=>{if(e.test(`${t.status}`))return s(t);r({message:new Error(t.statusText),status:t.status,response:Array.isArray(t.data)?t.data[0]:t.data.error||t.data.slug})}))}}let u={};const p={};class d{constructor(t,e){o(this,"client"),o(this,"maxRetries"),o(this,"throttle"),o(this,"accessToken"),o(this,"cache"),o(this,"helpers"),o(this,"resolveCounter"),o(this,"relations"),o(this,"links"),o(this,"richTextResolver"),o(this,"resolveNestedRelations");let s=t.endpoint||e;if(!s){const e=(new c).getRegionURL,r=!1===t.https?"http":"https";s=t.oauthToken?`${r}://${e(t.region)}/v1`:`${r}://${e(t.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),r.forEach(((e,s)=>{t.headers&&t.headers[s]&&r.set(s,t.headers[s])}));let n=5;t.oauthToken&&(r.set("Authorization",t.oauthToken),n=3),t.rateLimit&&(n=t.rateLimit),t.richTextSchema?this.richTextResolver=new l(t.richTextSchema):this.richTextResolver=new l,t.componentResolver&&this.setComponentResolver(t.componentResolver),this.maxRetries=t.maxRetries||5,this.throttle=function(t,e,s){if(!i(e))throw new TypeError("Expected `limit` to be a finite number");if(!i(s))throw new TypeError("Expected `interval` to be a finite number");const r=[];let o=[],n=0;const a=function(){n++;const e=setTimeout((function(){n--,r.length>0&&a(),o=o.filter((function(t){return t!==e}))}),s);o.indexOf(e)<0&&o.push(e);const i=r.shift();i.resolve(t.apply(i.self,i.args))},l=function(...t){const s=this;return new Promise((function(o,i){r.push({resolve:o,reject:i,args:t,self:s}),n<e&&a()}))};return l.abort=function(){o.forEach(clearTimeout),o=[],r.forEach((function(t){t.reject((function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"}))})),r.length=0},l}(this.throttledRequest,n,1e3),this.accessToken=t.accessToken||"",this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.helpers=new c,this.resolveCounter=0,this.resolveNestedRelations=t.resolveNestedRelations||!0,this.client=new h({baseURL:s,timeout:t.timeout||0,headers:r,responseInterceptor:t.responseInterceptor,fetch:t.fetch})}setComponentResolver(t){this.richTextResolver.addNode("blok",(e=>{let s="";return e.attrs.body&&e.attrs.body.forEach((e=>{s+=t(e.component,e)})),{html:s}}))}parseParams(t){return t.version||(t.version="published"),t.token||(t.token=this.getToken()),t.cv||(t.cv=p[t.token]),Array.isArray(t.resolve_relations)&&(t.resolve_relations=t.resolve_relations.join(",")),t}factoryParamOptions(t,e){return this.helpers.isCDNUrl(t)?this.parseParams(e):e}makeRequest(t,e,s,r){const o=this.factoryParamOptions(t,this.helpers.getOptionsPage(e,s,r));return this.cacheResponse(t,o)}get(t,e){e||(e={});const s=`/${t}`,r=this.factoryParamOptions(s,e);return this.cacheResponse(s,r)}async getAll(t,e,s){const r=(null==e?void 0:e.per_page)||25,o=`/${t}`,i=o.split("/"),n=s||i[i.length-1],a=await this.makeRequest(o,e,r,1),l=a.total?Math.ceil(a.total/r):1,c=await this.helpers.asyncMap(this.helpers.range(1,l),(t=>this.makeRequest(o,e,r,t+1)));return this.helpers.flatMap([a,...c],(t=>Object.values(t.data[n])))}post(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("post",s,e))}put(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("put",s,e))}delete(t,e){const s=`/${t}`;return Promise.resolve(this.throttle("delete",s,e))}getStories(t){return this.get("cdn/stories",t)}getStory(t,e){return this.get(`cdn/stories/${t}`,e)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e,s){const r=t[e];r&&"multilink"==r.fieldtype&&"story"==r.linktype&&"string"==typeof r.id&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&"story"===r.linktype&&"string"==typeof r.uuid&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}_insertRelations(t,e,s,r){if(s.indexOf(`${t.component}.${e}`)>-1)if("string"==typeof t[e])this.relations[r][t[e]]&&(t[e]=this._cleanCopy(this.relations[r][t[e]]));else if(t[e]&&t[e].constructor===Array){const s=[];t[e].forEach((t=>{this.relations[r][t]&&s.push(this._cleanCopy(this.relations[r][t]))})),t[e]=s}}iterateTree(t,e,s){const r=t=>{if(null!=t)if(t.constructor===Array)for(let e=0;e<t.length;e++)r(t[e]);else if(t.constructor===Object){if(t._stopResolving)return;for(const o in t)(t.component&&t._uid||"link"===t.type)&&(this._insertRelations(t,o,e,s),this._insertLinks(t,o,s)),r(t[o])}};r(t.content)}async resolveLinks(t,e,s){let r=[];if(t.link_uuids){const s=t.link_uuids.length,o=[],i=50;for(let e=0;e<s;e+=i){const r=Math.min(s,e+i);o.push(t.link_uuids.slice(e,r))}for(let t=0;t<o.length;t++)(await this.getStories({per_page:i,language:e.language,version:e.version,by_uuids:o[t].join(",")})).data.stories.forEach((t=>{r.push(t)}))}else r=t.links;r.forEach((t=>{this.links[s][t.uuid]={...t,_stopResolving:!0}}))}async resolveRelations(t,e,s){let r=[];if(t.rel_uuids){const s=t.rel_uuids.length,o=[],i=50;for(let e=0;e<s;e+=i){const r=Math.min(s,e+i);o.push(t.rel_uuids.slice(e,r))}for(let t=0;t<o.length;t++)(await this.getStories({per_page:i,language:e.language,version:e.version,by_uuids:o[t].join(",")})).data.stories.forEach((t=>{r.push(t)}))}else r=t.rels;r&&r.length>0&&r.forEach((t=>{this.relations[s][t.uuid]={...t,_stopResolving:!0}}))}async resolveStories(t,e,s){var r,o;let i=[];if(this.links[s]={},this.relations[s]={},typeof e.resolve_relations<"u"&&e.resolve_relations.length>0&&("string"==typeof e.resolve_relations&&(i=e.resolve_relations.split(",")),await this.resolveRelations(t,e,s)),e.resolve_links&&["1","story","url"].indexOf(e.resolve_links)>-1&&(null!=(r=t.links)&&r.length||null!=(o=t.link_uuids)&&o.length)&&await this.resolveLinks(t,e,s),this.resolveNestedRelations)for(const n in this.relations[s])this.iterateTree(this.relations[s][n],i,s);t.story?this.iterateTree(t.story,i,s):t.stories.forEach((t=>{this.iterateTree(t,i,s)})),delete this.links[s],delete this.relations[s]}async cacheResponse(t,e,s){const r=this.helpers.stringify({url:t,params:e}),o=this.cacheProvider();if("auto"===this.cache.clear&&"draft"===e.version&&await this.flushCache(),"published"===e.version&&"/cdn/spaces/me"!=t){const t=await o.get(r);if(t)return Promise.resolve(t)}return new Promise(((s,i)=>{try{(async()=>{var n;try{const a=await this.throttle("get",t,e);let l={data:a.data,headers:a.headers};if(null!=(n=a.headers)&&n["per-page"]&&(l=Object.assign({},l,{perPage:a.headers["per-page"]?parseInt(a.headers["per-page"]):0,total:a.headers["per-page"]?parseInt(a.headers.total):0})),200!=a.status)return i(a);if(l.data.story||l.data.stories){const t=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(l.data,e,`${t}`)}return"published"===e.version&&"/cdn/spaces/me"!=t&&await o.set(r,l),l.data.cv&&e.token&&("draft"==e.version&&p[e.token]!=l.data.cv&&await this.flushCache(),p[e.token]=l.data.cv),s(l)}catch(a){return i(a)}})()}catch{}}))}throttledRequest(t,e,s){return this.client[t](e,s)}cacheVersions(){return p}cacheVersion(){return p[this.accessToken]}setCacheVersion(t){this.accessToken&&(p[this.accessToken]=t)}cacheProvider(){switch(this.cache.type){case"memory":return{get:t=>Promise.resolve(u[t]),getAll:()=>Promise.resolve(u),set:(t,e)=>(u[t]=e,Promise.resolve(void 0)),flush:()=>(u={},Promise.resolve(void 0))};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get:()=>Promise.resolve(void 0),getAll:()=>Promise.resolve(void 0),set:()=>Promise.resolve(void 0),flush:()=>Promise.resolve(void 0)}}}async flushCache(){return await this.cacheProvider().flush(),this}}let g;const f="https://app.storyblok.com/f/storyblok-v2-latest.js",m=(t,e)=>{t.addNode("blok",(t=>{let s="";return t.attrs.body.forEach((t=>{s+=e(t.component,t)})),{html:s}}))};exports.ce=(t={})=>{const{apiOptions:e}=t;if(e.accessToken)return{storyblokApi:new d(e)};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")},exports.de=(t,e,s)=>{let r=s||g;if(r)return(t=>{var e,s;return!t||"blok"!==(null==(e=null==t?void 0:t.content)?void 0:e[0].type)&&!(null!=(s=null==t?void 0:t.content)&&s[0].content)})(t)?"":(e&&(r=new l(e.schema),e.resolver&&m(r,e.resolver)),r.render(t));console.error("Please initialize the Storyblok SDK before calling the renderRichText function")},exports.ge=()=>s(f),exports.he=t=>{if("object"!=typeof t||typeof t._editable>"u")return{};const e=JSON.parse(t._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}},exports.ie=a,exports.pe=(t={})=>{var e,r;const{bridge:o,accessToken:i,use:n=[],apiOptions:a={},richText:c={}}=t;a.accessToken=a.accessToken||i;const h={bridge:o,apiOptions:a};let u={};n.forEach((t=>{u={...u,...t(h)}}));const p=!(typeof window>"u")&&(null==(r=null==(e=window.location)?void 0:e.search)?void 0:r.includes("_storyblok_tk"));return!1!==o&&p&&s(f),g=new l(c.schema),c.resolver&&m(g,c.resolver),u},exports.ue=(t,e,s={})=>{var r;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",i=+new URL(null==(r=window.location)?void 0:r.href).searchParams.get("_storyblok")===t;if(o&&i){if(!t)return void console.warn("Story ID is not defined. Please provide a valid ID.");window.storyblokRegisterEvent((()=>{new window.StoryblokBridge(s).on(["input","published","change"],(s=>{"input"===s.action&&s.story.id===t?e(s.story):("change"===s.action||"published"===s.action)&&s.storyId===t&&window.location.reload()}))}))}},exports.y=l;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let R = false;
|
|
2
|
-
const T = [], j = (
|
|
2
|
+
const T = [], j = (n) => new Promise((e, t) => {
|
|
3
3
|
if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
|
|
4
4
|
if (window.location === window.parent.location) {
|
|
5
5
|
console.warn("You are not in Draft Mode or in the Visual Editor.");
|
|
@@ -9,31 +9,31 @@ const T = [], j = (o) => new Promise((e, t) => {
|
|
|
9
9
|
}, document.getElementById("storyblok-javascript-bridge")))
|
|
10
10
|
return;
|
|
11
11
|
const s = document.createElement("script");
|
|
12
|
-
s.async = true, s.src =
|
|
12
|
+
s.async = true, s.src = n, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
|
|
13
13
|
T.forEach((i) => i()), R = true, e(r);
|
|
14
14
|
}, document.getElementsByTagName("head")[0].appendChild(s);
|
|
15
15
|
});
|
|
16
|
-
var I = Object.defineProperty, P = (
|
|
17
|
-
function _(
|
|
18
|
-
return !(
|
|
16
|
+
var I = Object.defineProperty, P = (n, e, t) => e in n ? I(n, e, { enumerable: true, configurable: true, writable: true, value: t }) : n[e] = t, h = (n, e, t) => (P(n, typeof e != "symbol" ? e + "" : e, t), t);
|
|
17
|
+
function _(n) {
|
|
18
|
+
return !(n !== n || n === 1 / 0 || n === -1 / 0);
|
|
19
19
|
}
|
|
20
|
-
function S(
|
|
20
|
+
function S(n, e, t) {
|
|
21
21
|
if (!_(e))
|
|
22
22
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
23
23
|
if (!_(t))
|
|
24
24
|
throw new TypeError("Expected `interval` to be a finite number");
|
|
25
25
|
const s = [];
|
|
26
26
|
let r = [], i = 0;
|
|
27
|
-
const
|
|
27
|
+
const o = function() {
|
|
28
28
|
i++;
|
|
29
29
|
const a = setTimeout(function() {
|
|
30
|
-
i--, s.length > 0 &&
|
|
30
|
+
i--, s.length > 0 && o(), r = r.filter(function(u) {
|
|
31
31
|
return u !== a;
|
|
32
32
|
});
|
|
33
33
|
}, t);
|
|
34
34
|
r.indexOf(a) < 0 && r.push(a);
|
|
35
35
|
const l = s.shift();
|
|
36
|
-
l.resolve(
|
|
36
|
+
l.resolve(n.apply(l.self, l.args));
|
|
37
37
|
}, c = function(...a) {
|
|
38
38
|
const l = this;
|
|
39
39
|
return new Promise(function(u, p) {
|
|
@@ -42,7 +42,7 @@ function S(o, e, t) {
|
|
|
42
42
|
reject: p,
|
|
43
43
|
args: a,
|
|
44
44
|
self: l
|
|
45
|
-
}), i < e &&
|
|
45
|
+
}), i < e && o();
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
return c.abort = function() {
|
|
@@ -53,36 +53,36 @@ function S(o, e, t) {
|
|
|
53
53
|
}), s.length = 0;
|
|
54
54
|
}, c;
|
|
55
55
|
}
|
|
56
|
-
const C = function(
|
|
56
|
+
const C = function(n, e) {
|
|
57
57
|
const t = {};
|
|
58
|
-
for (const s in
|
|
59
|
-
const r =
|
|
58
|
+
for (const s in n) {
|
|
59
|
+
const r = n[s];
|
|
60
60
|
e.indexOf(s) > -1 && r !== null && (t[s] = r);
|
|
61
61
|
}
|
|
62
62
|
return t;
|
|
63
|
-
}, O = (
|
|
63
|
+
}, O = (n) => n === "email", A = () => ({
|
|
64
64
|
singleTag: "hr"
|
|
65
65
|
}), N = () => ({
|
|
66
66
|
tag: "blockquote"
|
|
67
67
|
}), L = () => ({
|
|
68
68
|
tag: "ul"
|
|
69
|
-
}), M = (
|
|
69
|
+
}), M = (n) => ({
|
|
70
70
|
tag: [
|
|
71
71
|
"pre",
|
|
72
72
|
{
|
|
73
73
|
tag: "code",
|
|
74
|
-
attrs:
|
|
74
|
+
attrs: n.attrs
|
|
75
75
|
}
|
|
76
76
|
]
|
|
77
77
|
}), z = () => ({
|
|
78
78
|
singleTag: "br"
|
|
79
|
-
}), U = (
|
|
80
|
-
tag: `h${
|
|
81
|
-
}), q = (
|
|
79
|
+
}), U = (n) => ({
|
|
80
|
+
tag: `h${n.attrs.level}`
|
|
81
|
+
}), q = (n) => ({
|
|
82
82
|
singleTag: [
|
|
83
83
|
{
|
|
84
84
|
tag: "img",
|
|
85
|
-
attrs: C(
|
|
85
|
+
attrs: C(n.attrs, ["src", "alt", "title"])
|
|
86
86
|
}
|
|
87
87
|
]
|
|
88
88
|
}), H = () => ({
|
|
@@ -91,14 +91,14 @@ const C = function(o, e) {
|
|
|
91
91
|
tag: "ol"
|
|
92
92
|
}), D = () => ({
|
|
93
93
|
tag: "p"
|
|
94
|
-
}), J = (
|
|
94
|
+
}), J = (n) => ({
|
|
95
95
|
tag: [
|
|
96
96
|
{
|
|
97
97
|
tag: "span",
|
|
98
98
|
attrs: {
|
|
99
99
|
["data-type"]: "emoji",
|
|
100
|
-
["data-name"]:
|
|
101
|
-
emoji:
|
|
100
|
+
["data-name"]: n.attrs.name,
|
|
101
|
+
emoji: n.attrs.emoji
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
]
|
|
@@ -114,8 +114,8 @@ const C = function(o, e) {
|
|
|
114
114
|
tag: "code"
|
|
115
115
|
}), G = () => ({
|
|
116
116
|
tag: "i"
|
|
117
|
-
}), Q = (
|
|
118
|
-
const e = { ...
|
|
117
|
+
}), Q = (n) => {
|
|
118
|
+
const e = { ...n.attrs }, { linktype: t = "url" } = n.attrs;
|
|
119
119
|
if (O(t) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), e.custom) {
|
|
120
120
|
for (const s in e.custom)
|
|
121
121
|
e[s] = e.custom[s];
|
|
@@ -129,46 +129,46 @@ const C = function(o, e) {
|
|
|
129
129
|
}
|
|
130
130
|
]
|
|
131
131
|
};
|
|
132
|
-
}, X = (
|
|
132
|
+
}, X = (n) => ({
|
|
133
133
|
tag: [
|
|
134
134
|
{
|
|
135
135
|
tag: "span",
|
|
136
|
-
attrs:
|
|
136
|
+
attrs: n.attrs
|
|
137
137
|
}
|
|
138
138
|
]
|
|
139
139
|
}), Z = () => ({
|
|
140
140
|
tag: "sub"
|
|
141
141
|
}), ee = () => ({
|
|
142
142
|
tag: "sup"
|
|
143
|
-
}), te = (
|
|
143
|
+
}), te = (n) => ({
|
|
144
144
|
tag: [
|
|
145
145
|
{
|
|
146
146
|
tag: "span",
|
|
147
|
-
attrs:
|
|
147
|
+
attrs: n.attrs
|
|
148
148
|
}
|
|
149
149
|
]
|
|
150
|
-
}), se = (
|
|
150
|
+
}), se = (n) => {
|
|
151
151
|
var e;
|
|
152
|
-
return (e =
|
|
152
|
+
return (e = n.attrs) != null && e.color ? {
|
|
153
153
|
tag: [
|
|
154
154
|
{
|
|
155
155
|
tag: "span",
|
|
156
156
|
attrs: {
|
|
157
|
-
style: `background-color:${
|
|
157
|
+
style: `background-color:${n.attrs.color};`
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
]
|
|
161
161
|
} : {
|
|
162
162
|
tag: ""
|
|
163
163
|
};
|
|
164
|
-
}, re = (
|
|
164
|
+
}, re = (n) => {
|
|
165
165
|
var e;
|
|
166
|
-
return (e =
|
|
166
|
+
return (e = n.attrs) != null && e.color ? {
|
|
167
167
|
tag: [
|
|
168
168
|
{
|
|
169
169
|
tag: "span",
|
|
170
170
|
attrs: {
|
|
171
|
-
style: `color:${
|
|
171
|
+
style: `color:${n.attrs.color}`
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
]
|
|
@@ -204,7 +204,7 @@ const C = function(o, e) {
|
|
|
204
204
|
highlight: se,
|
|
205
205
|
textStyle: re
|
|
206
206
|
}
|
|
207
|
-
},
|
|
207
|
+
}, ne = function(n) {
|
|
208
208
|
const e = {
|
|
209
209
|
"&": "&",
|
|
210
210
|
"<": "<",
|
|
@@ -212,7 +212,7 @@ const C = function(o, e) {
|
|
|
212
212
|
'"': """,
|
|
213
213
|
"'": "'"
|
|
214
214
|
}, t = /[&<>"']/g, s = RegExp(t.source);
|
|
215
|
-
return
|
|
215
|
+
return n && s.test(n) ? n.replace(t, (r) => e[r]) : n;
|
|
216
216
|
};
|
|
217
217
|
class y {
|
|
218
218
|
constructor(e) {
|
|
@@ -259,9 +259,9 @@ class y {
|
|
|
259
259
|
), "";
|
|
260
260
|
}
|
|
261
261
|
optimizeImages(e, t) {
|
|
262
|
-
let s = 0, r = 0, i = "",
|
|
263
|
-
typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (i += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (i += `height="${t.height}" `, r = t.height), (t.loading === "lazy" || t.loading === "eager") && (i += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (i += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (
|
|
264
|
-
const c = s > 0 || r > 0 ||
|
|
262
|
+
let s = 0, r = 0, i = "", o = "";
|
|
263
|
+
typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (i += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (i += `height="${t.height}" `, r = t.height), (t.loading === "lazy" || t.loading === "eager") && (i += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (i += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (o += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (o += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (o += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (o += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (o += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (o += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (o += `:rotate(${t.filters.rotate})`), o.length > 0 && (o = "/filters" + o))), i.length > 0 && (e = e.replace(/<img/g, `<img ${i.trim()}`));
|
|
264
|
+
const c = s > 0 || r > 0 || o.length > 0 ? `${s}x${r}${o}` : "";
|
|
265
265
|
return e = e.replace(
|
|
266
266
|
/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
|
|
267
267
|
`a.storyblok.com/f/$1/$2.$3/m/${c}`
|
|
@@ -274,10 +274,10 @@ class y {
|
|
|
274
274
|
const g = {
|
|
275
275
|
srcset: (l = t.srcset) == null ? void 0 : l.map((d) => {
|
|
276
276
|
if (typeof d == "number")
|
|
277
|
-
return `//${p}/m/${d}x0${
|
|
277
|
+
return `//${p}/m/${d}x0${o} ${d}w`;
|
|
278
278
|
if (typeof d == "object" && d.length === 2) {
|
|
279
279
|
let v = 0, $ = 0;
|
|
280
|
-
return typeof d[0] == "number" && (v = d[0]), typeof d[1] == "number" && ($ = d[1]), `//${p}/m/${v}x${$}${
|
|
280
|
+
return typeof d[0] == "number" && (v = d[0]), typeof d[1] == "number" && ($ = d[1]), `//${p}/m/${v}x${$}${o} ${v}w`;
|
|
281
281
|
}
|
|
282
282
|
}).join(", "),
|
|
283
283
|
sizes: (u = t.sizes) == null ? void 0 : u.map((d) => d).join(", ")
|
|
@@ -297,7 +297,7 @@ class y {
|
|
|
297
297
|
const s = this.getMatchingNode(e);
|
|
298
298
|
return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((r) => {
|
|
299
299
|
t.push(this.renderNode(r));
|
|
300
|
-
}) : e.text ? t.push(
|
|
300
|
+
}) : e.text ? t.push(ne(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
|
|
301
301
|
const i = this.getMatchingMark(r);
|
|
302
302
|
i && i.tag !== "" && t.push(this.renderClosingTag(i.tag));
|
|
303
303
|
}), t.join("");
|
|
@@ -310,8 +310,8 @@ class y {
|
|
|
310
310
|
let r = `<${s.tag}`;
|
|
311
311
|
if (s.attrs)
|
|
312
312
|
for (const i in s.attrs) {
|
|
313
|
-
const
|
|
314
|
-
|
|
313
|
+
const o = s.attrs[i];
|
|
314
|
+
o !== null && (r += ` ${i}="${o}"`);
|
|
315
315
|
}
|
|
316
316
|
return `${r}${t}>`;
|
|
317
317
|
}
|
|
@@ -358,7 +358,7 @@ class k {
|
|
|
358
358
|
page: s
|
|
359
359
|
})), 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) => {
|
|
360
360
|
const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
|
|
361
|
-
return this.arrayFrom(s, (i,
|
|
361
|
+
return this.arrayFrom(s, (i, o) => o * r + e);
|
|
362
362
|
}), h(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), h(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []));
|
|
363
363
|
}
|
|
364
364
|
/**
|
|
@@ -373,13 +373,13 @@ class k {
|
|
|
373
373
|
for (const i in e) {
|
|
374
374
|
if (!Object.prototype.hasOwnProperty.call(e, i))
|
|
375
375
|
continue;
|
|
376
|
-
const
|
|
376
|
+
const o = e[i], c = s ? "" : encodeURIComponent(i);
|
|
377
377
|
let a;
|
|
378
|
-
typeof
|
|
379
|
-
|
|
378
|
+
typeof o == "object" ? a = this.stringify(
|
|
379
|
+
o,
|
|
380
380
|
t ? t + encodeURIComponent("[" + c + "]") : c,
|
|
381
|
-
Array.isArray(
|
|
382
|
-
) : a = (t ? t + encodeURIComponent("[" + c + "]") : c) + "=" + encodeURIComponent(
|
|
381
|
+
Array.isArray(o)
|
|
382
|
+
) : a = (t ? t + encodeURIComponent("[" + c + "]") : c) + "=" + encodeURIComponent(o), r.push(a);
|
|
383
383
|
}
|
|
384
384
|
return r.join("&");
|
|
385
385
|
}
|
|
@@ -400,7 +400,7 @@ class k {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class oe {
|
|
404
404
|
constructor(e) {
|
|
405
405
|
h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = false, this.url = "", this.parameters = {};
|
|
406
406
|
}
|
|
@@ -445,7 +445,7 @@ class ne {
|
|
|
445
445
|
)}`;
|
|
446
446
|
} else
|
|
447
447
|
s = JSON.stringify(this.parameters);
|
|
448
|
-
const r = new URL(t), i = new AbortController(), { signal:
|
|
448
|
+
const r = new URL(t), i = new AbortController(), { signal: o } = i;
|
|
449
449
|
let c;
|
|
450
450
|
this.timeout && (c = setTimeout(() => i.abort(), this.timeout));
|
|
451
451
|
try {
|
|
@@ -453,7 +453,7 @@ class ne {
|
|
|
453
453
|
method: e,
|
|
454
454
|
headers: this.headers,
|
|
455
455
|
body: s,
|
|
456
|
-
signal:
|
|
456
|
+
signal: o
|
|
457
457
|
});
|
|
458
458
|
this.timeout && clearTimeout(c);
|
|
459
459
|
const l = await this._responseHandler(a);
|
|
@@ -490,19 +490,21 @@ class ae {
|
|
|
490
490
|
* @param endpoint string, optional
|
|
491
491
|
*/
|
|
492
492
|
constructor(e, t) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
493
|
+
h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "resolveCounter"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations");
|
|
494
|
+
let s = e.endpoint || t;
|
|
495
|
+
if (!s) {
|
|
496
|
+
const o = new k().getRegionURL, c = e.https === false ? "http" : "https";
|
|
497
|
+
e.oauthToken ? s = `${c}://${o(e.region)}/v1` : s = `${c}://${o(e.region)}/v2`;
|
|
496
498
|
}
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
e.headers && e.headers[
|
|
499
|
+
const r = new Headers();
|
|
500
|
+
r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, c) => {
|
|
501
|
+
e.headers && e.headers[c] && r.set(c, e.headers[c]);
|
|
500
502
|
});
|
|
501
|
-
let
|
|
502
|
-
e.oauthToken && (
|
|
503
|
-
baseURL:
|
|
503
|
+
let i = 5;
|
|
504
|
+
e.oauthToken && (r.set("Authorization", e.oauthToken), i = 3), e.rateLimit && (i = e.rateLimit), e.richTextSchema ? this.richTextResolver = new y(e.richTextSchema) : this.richTextResolver = new y(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 5, this.throttle = S(this.throttledRequest, i, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new k(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || true, this.client = new oe({
|
|
505
|
+
baseURL: s,
|
|
504
506
|
timeout: e.timeout || 0,
|
|
505
|
-
headers:
|
|
507
|
+
headers: r,
|
|
506
508
|
responseInterceptor: e.responseInterceptor,
|
|
507
509
|
fetch: e.fetch
|
|
508
510
|
});
|
|
@@ -536,7 +538,7 @@ class ae {
|
|
|
536
538
|
return this.cacheResponse(s, r);
|
|
537
539
|
}
|
|
538
540
|
async getAll(e, t, s) {
|
|
539
|
-
const r = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`,
|
|
541
|
+
const r = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, o = i.split("/"), c = s || o[o.length - 1], a = 1, l = await this.makeRequest(i, t, r, a), u = l.total ? Math.ceil(l.total / r) : 1, p = await this.helpers.asyncMap(
|
|
540
542
|
this.helpers.range(a, u),
|
|
541
543
|
(g) => this.makeRequest(i, t, r, g + 1)
|
|
542
544
|
);
|
|
@@ -584,8 +586,8 @@ class ae {
|
|
|
584
586
|
));
|
|
585
587
|
else if (e[t] && e[t].constructor === Array) {
|
|
586
588
|
const i = [];
|
|
587
|
-
e[t].forEach((
|
|
588
|
-
this.relations[r][
|
|
589
|
+
e[t].forEach((o) => {
|
|
590
|
+
this.relations[r][o] && i.push(this._cleanCopy(this.relations[r][o]));
|
|
589
591
|
}), e[t] = i;
|
|
590
592
|
}
|
|
591
593
|
}
|
|
@@ -594,22 +596,22 @@ class ae {
|
|
|
594
596
|
const r = (i) => {
|
|
595
597
|
if (i != null) {
|
|
596
598
|
if (i.constructor === Array)
|
|
597
|
-
for (let
|
|
598
|
-
r(i[
|
|
599
|
+
for (let o = 0; o < i.length; o++)
|
|
600
|
+
r(i[o]);
|
|
599
601
|
else if (i.constructor === Object) {
|
|
600
602
|
if (i._stopResolving)
|
|
601
603
|
return;
|
|
602
|
-
for (const
|
|
604
|
+
for (const o in i)
|
|
603
605
|
(i.component && i._uid || i.type === "link") && (this._insertRelations(
|
|
604
606
|
i,
|
|
605
|
-
|
|
607
|
+
o,
|
|
606
608
|
t,
|
|
607
609
|
s
|
|
608
610
|
), this._insertLinks(
|
|
609
611
|
i,
|
|
610
|
-
|
|
612
|
+
o,
|
|
611
613
|
s
|
|
612
|
-
)), r(i[
|
|
614
|
+
)), r(i[o]);
|
|
613
615
|
}
|
|
614
616
|
}
|
|
615
617
|
};
|
|
@@ -618,17 +620,17 @@ class ae {
|
|
|
618
620
|
async resolveLinks(e, t, s) {
|
|
619
621
|
let r = [];
|
|
620
622
|
if (e.link_uuids) {
|
|
621
|
-
const i = e.link_uuids.length,
|
|
623
|
+
const i = e.link_uuids.length, o = [], c = 50;
|
|
622
624
|
for (let a = 0; a < i; a += c) {
|
|
623
625
|
const l = Math.min(i, a + c);
|
|
624
|
-
|
|
626
|
+
o.push(e.link_uuids.slice(a, l));
|
|
625
627
|
}
|
|
626
|
-
for (let a = 0; a <
|
|
628
|
+
for (let a = 0; a < o.length; a++)
|
|
627
629
|
(await this.getStories({
|
|
628
630
|
per_page: c,
|
|
629
631
|
language: t.language,
|
|
630
632
|
version: t.version,
|
|
631
|
-
by_uuids:
|
|
633
|
+
by_uuids: o[a].join(",")
|
|
632
634
|
})).data.stories.forEach(
|
|
633
635
|
(l) => {
|
|
634
636
|
r.push(l);
|
|
@@ -646,17 +648,17 @@ class ae {
|
|
|
646
648
|
async resolveRelations(e, t, s) {
|
|
647
649
|
let r = [];
|
|
648
650
|
if (e.rel_uuids) {
|
|
649
|
-
const i = e.rel_uuids.length,
|
|
651
|
+
const i = e.rel_uuids.length, o = [], c = 50;
|
|
650
652
|
for (let a = 0; a < i; a += c) {
|
|
651
653
|
const l = Math.min(i, a + c);
|
|
652
|
-
|
|
654
|
+
o.push(e.rel_uuids.slice(a, l));
|
|
653
655
|
}
|
|
654
|
-
for (let a = 0; a <
|
|
656
|
+
for (let a = 0; a < o.length; a++)
|
|
655
657
|
(await this.getStories({
|
|
656
658
|
per_page: c,
|
|
657
659
|
language: t.language,
|
|
658
660
|
version: t.version,
|
|
659
|
-
by_uuids:
|
|
661
|
+
by_uuids: o[a].join(",")
|
|
660
662
|
})).data.stories.forEach((l) => {
|
|
661
663
|
r.push(l);
|
|
662
664
|
});
|
|
@@ -671,26 +673,26 @@ class ae {
|
|
|
671
673
|
}
|
|
672
674
|
async resolveStories(e, t, s) {
|
|
673
675
|
var r, i;
|
|
674
|
-
let
|
|
675
|
-
if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (
|
|
676
|
+
let o = [];
|
|
677
|
+
if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (i = e.link_uuids) != null && i.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
|
|
676
678
|
for (const c in this.relations[s])
|
|
677
679
|
this.iterateTree(
|
|
678
680
|
this.relations[s][c],
|
|
679
|
-
|
|
681
|
+
o,
|
|
680
682
|
s
|
|
681
683
|
);
|
|
682
|
-
e.story ? this.iterateTree(e.story,
|
|
683
|
-
this.iterateTree(c,
|
|
684
|
+
e.story ? this.iterateTree(e.story, o, s) : e.stories.forEach((c) => {
|
|
685
|
+
this.iterateTree(c, o, s);
|
|
684
686
|
}), delete this.links[s], delete this.relations[s];
|
|
685
687
|
}
|
|
686
688
|
async cacheResponse(e, t, s) {
|
|
687
689
|
const r = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
|
|
688
690
|
if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
691
|
-
return Promise.resolve(
|
|
691
|
+
const o = await i.get(r);
|
|
692
|
+
if (o)
|
|
693
|
+
return Promise.resolve(o);
|
|
692
694
|
}
|
|
693
|
-
return new Promise((
|
|
695
|
+
return new Promise((o, c) => {
|
|
694
696
|
try {
|
|
695
697
|
(async () => {
|
|
696
698
|
var a;
|
|
@@ -706,7 +708,7 @@ class ae {
|
|
|
706
708
|
const p = this.resolveCounter = ++this.resolveCounter % 1e3;
|
|
707
709
|
await this.resolveStories(u.data, t, `${p}`);
|
|
708
710
|
}
|
|
709
|
-
return t.version === "published" && e != "/cdn/spaces/me" && await i.set(r, u), u.data.cv && t.token && (t.version == "draft" && f[t.token] != u.data.cv && await this.flushCache(), f[t.token] = u.data.cv),
|
|
711
|
+
return t.version === "published" && e != "/cdn/spaces/me" && await i.set(r, u), u.data.cv && t.token && (t.version == "draft" && f[t.token] != u.data.cv && await this.flushCache(), f[t.token] = u.data.cv), o(u);
|
|
710
712
|
} catch (l) {
|
|
711
713
|
return c(l);
|
|
712
714
|
}
|
|
@@ -768,8 +770,8 @@ class ae {
|
|
|
768
770
|
return await this.cacheProvider().flush(), this;
|
|
769
771
|
}
|
|
770
772
|
}
|
|
771
|
-
const ce = (
|
|
772
|
-
const { apiOptions: e } =
|
|
773
|
+
const ce = (n = {}) => {
|
|
774
|
+
const { apiOptions: e } = n;
|
|
773
775
|
if (!e.accessToken) {
|
|
774
776
|
console.error(
|
|
775
777
|
"You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
|
|
@@ -777,11 +779,11 @@ const ce = (o = {}) => {
|
|
|
777
779
|
return;
|
|
778
780
|
}
|
|
779
781
|
return { storyblokApi: new ae(e) };
|
|
780
|
-
}, he = (
|
|
781
|
-
if (typeof
|
|
782
|
+
}, he = (n) => {
|
|
783
|
+
if (typeof n != "object" || typeof n._editable > "u")
|
|
782
784
|
return {};
|
|
783
785
|
const e = JSON.parse(
|
|
784
|
-
|
|
786
|
+
n._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
|
|
785
787
|
);
|
|
786
788
|
return {
|
|
787
789
|
"data-blok-c": JSON.stringify(e),
|
|
@@ -789,23 +791,23 @@ const ce = (o = {}) => {
|
|
|
789
791
|
};
|
|
790
792
|
};
|
|
791
793
|
let w;
|
|
792
|
-
const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (
|
|
794
|
+
const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (n, e, t = {}) => {
|
|
793
795
|
var c;
|
|
794
|
-
const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u",
|
|
796
|
+
const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((c = window.location) == null ? void 0 : c.href).searchParams.get(
|
|
795
797
|
"_storyblok"
|
|
796
|
-
) ===
|
|
797
|
-
if (!(!r || !
|
|
798
|
-
if (!
|
|
798
|
+
) === n;
|
|
799
|
+
if (!(!r || !o)) {
|
|
800
|
+
if (!n) {
|
|
799
801
|
console.warn("Story ID is not defined. Please provide a valid ID.");
|
|
800
802
|
return;
|
|
801
803
|
}
|
|
802
804
|
window.storyblokRegisterEvent(() => {
|
|
803
805
|
new window.StoryblokBridge(t).on(["input", "published", "change"], (l) => {
|
|
804
|
-
l.action === "input" && l.story.id ===
|
|
806
|
+
l.action === "input" && l.story.id === n ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === n && window.location.reload();
|
|
805
807
|
});
|
|
806
808
|
});
|
|
807
809
|
}
|
|
808
|
-
}, pe = (
|
|
810
|
+
}, pe = (n = {}) => {
|
|
809
811
|
var u, p;
|
|
810
812
|
const {
|
|
811
813
|
bridge: e,
|
|
@@ -813,17 +815,17 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
|
|
|
813
815
|
use: s = [],
|
|
814
816
|
apiOptions: r = {},
|
|
815
817
|
richText: i = {}
|
|
816
|
-
} =
|
|
818
|
+
} = n;
|
|
817
819
|
r.accessToken = r.accessToken || t;
|
|
818
|
-
const
|
|
820
|
+
const o = { bridge: e, apiOptions: r };
|
|
819
821
|
let c = {};
|
|
820
822
|
s.forEach((g) => {
|
|
821
|
-
c = { ...c, ...g(
|
|
823
|
+
c = { ...c, ...g(o) };
|
|
822
824
|
});
|
|
823
825
|
const l = !(typeof window > "u") && ((p = (u = window.location) == null ? void 0 : u.search) == null ? void 0 : p.includes("_storyblok_tk"));
|
|
824
826
|
return e !== false && l && j(x), w = new y(i.schema), i.resolver && E(w, i.resolver), c;
|
|
825
|
-
}, E = (
|
|
826
|
-
|
|
827
|
+
}, E = (n, e) => {
|
|
828
|
+
n.addNode("blok", (t) => {
|
|
827
829
|
let s = "";
|
|
828
830
|
return t.attrs.body.forEach((r) => {
|
|
829
831
|
s += e(r.component, r);
|
|
@@ -831,10 +833,10 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
|
|
|
831
833
|
html: s
|
|
832
834
|
};
|
|
833
835
|
});
|
|
834
|
-
}, le = (
|
|
836
|
+
}, le = (n) => {
|
|
835
837
|
var e, t;
|
|
836
|
-
return !
|
|
837
|
-
}, de = (
|
|
838
|
+
return !n || ((e = n == null ? void 0 : n.content) == null ? void 0 : e[0].type) !== "blok" && !((t = n == null ? void 0 : n.content) != null && t[0].content);
|
|
839
|
+
}, de = (n, e, t) => {
|
|
838
840
|
let s = t || w;
|
|
839
841
|
if (!s) {
|
|
840
842
|
console.error(
|
|
@@ -842,7 +844,7 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
|
|
|
842
844
|
);
|
|
843
845
|
return;
|
|
844
846
|
}
|
|
845
|
-
return le(
|
|
847
|
+
return le(n) ? "" : (e && (s = new y(e.schema), e.resolver && E(s, e.resolver)), s.render(n));
|
|
846
848
|
}, ge = () => j(x);
|
|
847
849
|
export {
|
|
848
850
|
ce as c,
|
package/dist/storyblok-react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=require("./storyblok-js-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react"),o=require("./storyblok-js-5db94779.js"),t=require("./index-45a2f239.js"),r=require("./client-f55c03c7.js");exports.RichTextResolver=o.y,exports.RichTextSchema=o.ie,exports.apiPlugin=o.ce,exports.loadStoryblokBridge=o.ge,exports.registerStoryblokBridge=o.ue,exports.renderRichText=o.de,exports.storyblokEditable=o.he,exports.useStoryblokBridge=o.ue,exports.StoryblokComponent=t.StoryblokComponent,exports.getComponent=t.getComponent,exports.getStoryblokApi=t.useStoryblokApi,exports.storyblokInit=t.storyblokInit,exports.useStoryblokApi=t.useStoryblokApi,exports.useStoryblokState=r.useStoryblokState,exports.useStoryblok=(r,s={},i={})=>{const n=t.useStoryblokApi();if(!n)return console.error("You can't use useStoryblok if you're not loading apiPlugin."),null;let[l,u]=e.useState({});const p="undefined"!=typeof window&&void 0!==window.storyblokRegisterEvent;return e.useEffect((()=>{!async function(){const{data:e}=await n.get(`cdn/stories/${r}`,s);u(e.story),p&&e.story.id&&o.ue(e.story.id,(e=>u(e)),i)}()}),[r,JSON.stringify(s)]),l};
|
package/dist/storyblok-react.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
|
-
import { u as ue } from "./storyblok-js-
|
|
3
|
-
import { y, i, c, g, d, h } from "./storyblok-js-
|
|
4
|
-
import { u as useStoryblokApi } from "./index-
|
|
5
|
-
import { S, g as g2, s } from "./index-
|
|
6
|
-
import { u } from "./client-
|
|
2
|
+
import { u as ue } from "./storyblok-js-5fd880b4.mjs";
|
|
3
|
+
import { y, i, c, g, d, h } from "./storyblok-js-5fd880b4.mjs";
|
|
4
|
+
import { u as useStoryblokApi } from "./index-b8bd6e01.mjs";
|
|
5
|
+
import { S, g as g2, s } from "./index-b8bd6e01.mjs";
|
|
6
|
+
import { u } from "./client-580f8a39.mjs";
|
|
7
7
|
const useStoryblok = (slug, apiOptions = {}, bridgeOptions = {}) => {
|
|
8
8
|
const storyblokApiInstance = useStoryblokApi();
|
|
9
9
|
if (!storyblokApiInstance) {
|
|
@@ -14,25 +14,23 @@ const useStoryblok = (slug, apiOptions = {}, bridgeOptions = {}) => {
|
|
|
14
14
|
}
|
|
15
15
|
let [story, setStory] = useState({});
|
|
16
16
|
const isBridgeEnable = typeof window !== "undefined" && typeof window.storyblokRegisterEvent !== "undefined";
|
|
17
|
-
const initStory = async () => {
|
|
18
|
-
const { data } = await storyblokApiInstance.get(
|
|
19
|
-
`cdn/stories/${slug}`,
|
|
20
|
-
apiOptions
|
|
21
|
-
);
|
|
22
|
-
setStory(data.story);
|
|
23
|
-
};
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
initStory();
|
|
26
|
-
}, [slug, apiOptions]);
|
|
27
17
|
useEffect(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
bridgeOptions
|
|
18
|
+
async function initStory() {
|
|
19
|
+
const { data } = await storyblokApiInstance.get(
|
|
20
|
+
`cdn/stories/${slug}`,
|
|
21
|
+
apiOptions
|
|
33
22
|
);
|
|
23
|
+
setStory(data.story);
|
|
24
|
+
if (isBridgeEnable && data.story.id) {
|
|
25
|
+
ue(
|
|
26
|
+
data.story.id,
|
|
27
|
+
(story2) => setStory(story2),
|
|
28
|
+
bridgeOptions
|
|
29
|
+
);
|
|
30
|
+
}
|
|
34
31
|
}
|
|
35
|
-
|
|
32
|
+
initStory();
|
|
33
|
+
}, [slug, JSON.stringify(apiOptions)]);
|
|
36
34
|
return story;
|
|
37
35
|
};
|
|
38
36
|
export {
|
package/dist/storyblok-react2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-45a2f239.js"),o=require("./storyblok-js-5db94779.js");require("react"),exports.StoryblokComponent=e.StoryblokComponent,exports.getComponent=e.getComponent,exports.getStoryblokApi=e.useStoryblokApi,exports.storyblokInit=e.storyblokInit,exports.useStoryblokApi=e.useStoryblokApi,exports.RichTextResolver=o.y,exports.RichTextSchema=o.ie,exports.apiPlugin=o.ce,exports.loadStoryblokBridge=o.ge,exports.registerStoryblokBridge=o.ue,exports.renderRichText=o.de,exports.storyblokEditable=o.he,exports.useStoryblokBridge=o.ue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S, g, u, s, u as u2 } from "./index-
|
|
2
|
-
import { y, i, c, g as g2, u as u3, d, h, u as u4 } from "./storyblok-js-
|
|
1
|
+
import { S, g, u, s, u as u2 } from "./index-b8bd6e01.mjs";
|
|
2
|
+
import { y, i, c, g as g2, u as u3, d, h, u as u4 } from "./storyblok-js-5fd880b4.mjs";
|
|
3
3
|
import "react";
|
|
4
4
|
export {
|
|
5
5
|
y as RichTextResolver,
|
package/dist/storyblok-react3.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";const e=require("react"),o=require("./storyblok-js-
|
|
1
|
+
"use strict";"use client";const e=require("react"),o=require("./storyblok-js-5db94779.js");module.exports=({options:t})=>((async e=>{await o.ge(),new window.StoryblokBridge(e).on(["published","change"],(()=>{window.location.reload()}))})(t),e.createElement(e.Fragment,null));
|
package/dist/storyblok-react4.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";const e=require("react"),
|
|
1
|
+
"use strict";"use client";const e=require("react"),r=require("./client-f55c03c7.js"),t=require("./index-45a2f239.js");require("./storyblok-js-5db94779.js");const o=e.forwardRef((({story:o,...s},n)=>(o=r.useStoryblokState(o),e.createElement(t.StoryblokComponent,{ref:n,blok:o.content,...s}))));module.exports=o;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { u as useStoryblokState } from "./client-
|
|
4
|
-
import { S as StoryblokComponent } from "./index-
|
|
5
|
-
import "./storyblok-js-
|
|
6
|
-
const StoryblokStory = (
|
|
7
|
-
story
|
|
8
|
-
|
|
9
|
-
};
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { u as useStoryblokState } from "./client-580f8a39.mjs";
|
|
4
|
+
import { S as StoryblokComponent } from "./index-b8bd6e01.mjs";
|
|
5
|
+
import "./storyblok-js-5fd880b4.mjs";
|
|
6
|
+
const StoryblokStory = forwardRef(
|
|
7
|
+
({ story, ...restProps }, ref) => {
|
|
8
|
+
story = useStoryblokState(story);
|
|
9
|
+
return /* @__PURE__ */ React.createElement(StoryblokComponent, { ref, blok: story.content, ...restProps });
|
|
10
|
+
}
|
|
11
|
+
);
|
|
10
12
|
export {
|
|
11
13
|
StoryblokStory as default
|
|
12
14
|
};
|
package/dist/types/story.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ interface StoryblokStoryProps {
|
|
|
4
4
|
story: ISbStoryData;
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
}
|
|
7
|
-
declare const StoryblokStory:
|
|
7
|
+
declare const StoryblokStory: React.ForwardRefExoticComponent<Omit<StoryblokStoryProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
8
8
|
export default StoryblokStory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.7",
|
|
4
4
|
"description": "SDK to integrate Storyblok into your project using React.",
|
|
5
5
|
"main": "./dist/storyblok-react.js",
|
|
6
6
|
"module": "./dist/storyblok-react.mjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build && cp ../README.md ./"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@storyblok/js": "^2.2.
|
|
47
|
+
"@storyblok/js": "^2.2.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@babel/core": "^7.22.5",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
"@cypress/react": "^5.12.5",
|
|
53
53
|
"@cypress/vite-dev-server": "^2.2.3",
|
|
54
54
|
"@tsconfig/recommended": "^1.0.2",
|
|
55
|
-
"@types/react": "18.2.
|
|
56
|
-
"@vitejs/plugin-react": "^4.0.
|
|
55
|
+
"@types/react": "18.2.14",
|
|
56
|
+
"@vitejs/plugin-react": "^4.0.1",
|
|
57
57
|
"babel-jest": "^29.5.0",
|
|
58
58
|
"cypress": "^9.7.0",
|
|
59
59
|
"eslint-plugin-cypress": "^2.13.3",
|
|
60
|
-
"eslint-plugin-jest": "^27.2.
|
|
60
|
+
"eslint-plugin-jest": "^27.2.2",
|
|
61
61
|
"jest": "^29.5.0",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0",
|
|
64
64
|
"start-server-and-test": "^2.0.0",
|
|
65
|
-
"terser": "^5.18.
|
|
65
|
+
"terser": "^5.18.1",
|
|
66
66
|
"vite": "^4.1.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
package/dist/client-85627252.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react"),t=require("./storyblok-js-1cafaa66.js");exports.useStoryblokState=(r=null,o={})=>{let[s,i]=e.useState(r);return"undefined"!=typeof window&&void 0!==window.storyblokRegisterEvent&&r?(t.ue(s.id,(e=>i(e)),o),s):r};
|