@storyblok/vue 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/storyblok-vue.js +2 -2
- package/dist/storyblok-vue.mjs +4 -1
- package/package.json +5 -3
package/dist/storyblok-vue.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* description: SDK to integrate Storyblok into your project using Vue.
|
|
5
5
|
* author: Storyblok
|
|
6
6
|
*/
|
|
7
|
-
(function(b,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(b=typeof globalThis<"u"?globalThis:b||self,g(b.storyblokVue={},b.Vue))})(this,function(b,g){"use strict";let F=!1;const V=[],re=s=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?o():V.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=s,r.id="storyblok-javascript-bridge",r.onerror=o=>t(o),r.onload=o=>{V.forEach(n=>n()),F=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(r)});var se=Object.defineProperty,oe=(s,e,t)=>e in s?se(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,
|
|
7
|
+
(function(b,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(b=typeof globalThis<"u"?globalThis:b||self,g(b.storyblokVue={},b.Vue))})(this,function(b,g){"use strict";let F=!1;const V=[],re=s=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?o():V.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=s,r.id="storyblok-javascript-bridge",r.onerror=o=>t(o),r.onload=o=>{V.forEach(n=>n()),F=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(r)});var se=Object.defineProperty,oe=(s,e,t)=>e in s?se(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,f=(s,e,t)=>oe(s,typeof e!="symbol"?e+"":e,t);class ne extends Error{constructor(e){super(e),this.name="AbortError"}}function ae(s,e,t){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(t))throw new TypeError("Expected `interval` to be a finite number");const r=[];let o=[],n=0,a=!1;const l=async()=>{n++;const h=r.shift();if(h)try{const p=await s(...h.args);h.resolve(p)}catch(p){h.reject(p)}const d=setTimeout(()=>{n--,r.length>0&&l(),o=o.filter(p=>p!==d)},t);o.includes(d)||o.push(d)},i=(...h)=>a?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((d,p)=>{r.push({resolve:d,reject:p,args:h}),n<e&&l()});return i.abort=()=>{a=!0,o.forEach(clearTimeout),o=[],r.forEach(h=>h.reject(()=>new ne("Throttle function aborted"))),r.length=0},i}class x{constructor(){f(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),f(this,"getOptionsPage",(e,t=25,r=1)=>({...e,per_page:t,page:r})),f(this,"delay",e=>new Promise(t=>setTimeout(t,e))),f(this,"arrayFrom",(e=0,t)=>Array.from({length:e},t)),f(this,"range",(e=0,t=e)=>{const r=Math.abs(t-e)||0,o=e<t?1:-1;return this.arrayFrom(r,(n,a)=>a*o+e)}),f(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),f(this,"flatMap",(e=[],t)=>e.map(t).reduce((r,o)=>[...r,...o],[])),f(this,"escapeHTML",function(e){const t={"&":"&","<":"<",">":">",'"':""","'":"'"},r=/[&<>"']/g,o=new RegExp(r.source);return e&&o.test(e)?e.replace(r,n=>t[n]):e})}stringify(e,t,r){const o=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const a=e[n];if(a==null)continue;const l=r?"":encodeURIComponent(n);let i;typeof a=="object"?i=this.stringify(a,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(a)):i=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(a)}`,o.push(i)}return o.join("&")}getRegionURL(e){const t="api.storyblok.com",r="api-us.storyblok.com",o="app.storyblokchina.cn",n="api-ap.storyblok.com",a="api-ca.storyblok.com";switch(e){case"us":return r;case"cn":return o;case"ap":return n;case"ca":return a;default:return t}}}const ie=function(s,e){const t={};for(const r in s){const o=s[r];e.includes(r)&&o!==null&&(t[r]=o)}return t},le=s=>s==="email",ce=()=>({singleTag:"hr"}),he=()=>({tag:"blockquote"}),ue=()=>({tag:"ul"}),de=s=>({tag:["pre",{tag:"code",attrs:s.attrs}]}),pe=()=>({singleTag:"br"}),ge=s=>({tag:`h${s.attrs.level}`}),fe=s=>({singleTag:[{tag:"img",attrs:ie(s.attrs,["src","alt","title"])}]}),me=()=>({tag:"li"}),ye=()=>({tag:"ol"}),be=()=>({tag:"p"}),ke=s=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":s.attrs.name,emoji:s.attrs.emoji}}]}),ve=()=>({tag:"b"}),$e=()=>({tag:"s"}),Te=()=>({tag:"u"}),we=()=>({tag:"strong"}),_e=()=>({tag:"code"}),Re=()=>({tag:"i"}),Se=s=>{if(!s.attrs)return{tag:""};const e=new x().escapeHTML,t={...s.attrs},{linktype:r="url"}=s.attrs;if(delete t.linktype,t.href&&(t.href=e(s.attrs.href||"")),le(r)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const o in t.custom)t[o]=t.custom[o];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},Ee=s=>({tag:[{tag:"span",attrs:s.attrs}]}),je=()=>({tag:"sub"}),Ce=()=>({tag:"sup"}),Ae=s=>({tag:[{tag:"span",attrs:s.attrs}]}),Ie=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${s.attrs.color};`}}]}:{tag:""}},Oe=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${s.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:ce,blockquote:he,bullet_list:ue,code_block:de,hard_break:pe,heading:ge,image:fe,list_item:me,ordered_list:ye,paragraph:be,emoji:ke},marks:{bold:ve,strike:$e,underline:Te,strong:we,code:_e,italic:Re,link:Se,styled:Ee,subscript:je,superscript:Ce,anchor:Ae,highlight:Ie,textStyle:Oe}},Le=function(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"},t=/[&<>"']/g,r=new RegExp(t.source);return s&&r.test(s)?s.replace(t,o=>e[o]):s};let G=!1;class A{constructor(e){f(this,"marks"),f(this,"nodes"),e||(e=q),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1},r=!0){if(!G&&r&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),G=!0),e&&e.content&&Array.isArray(e.content)){let o="";return e.content.forEach(n=>{o+=this.renderNode(n)}),t.optimizeImages?this.optimizeImages(o,t.optimizeImages):o}return console.warn(`The render method must receive an Object with a "content" field.
|
|
8
8
|
The "content" field must be an array of nodes as the type ISbRichtext.
|
|
9
9
|
ISbRichtext:
|
|
10
10
|
content?: ISbRichtext[]
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
}
|
|
28
28
|
],
|
|
29
29
|
type: 'doc'
|
|
30
|
-
}`),""}optimizeImages(e,t){let r=0,o=0,n="",a="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,r=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,o=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(a+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(a+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(a+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(a+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(a+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(a+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(a+=`:rotate(${t.filters.rotate})`),a.length>0&&(a=`/filters${a}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=r>0||o>0||a.length>0?`${r}x${o}${a}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,i=>{var h,d;const p=i.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(p&&p.length>0){const $={srcset:(h=t.srcset)==null?void 0:h.map(_=>{if(typeof _=="number")return`//${p}/m/${_}x0${a} ${_}w`;if(typeof _=="object"&&_.length===2){let C=0,L=0;return typeof _[0]=="number"&&(C=_[0]),typeof _[1]=="number"&&(L=_[1]),`//${p}/m/${C}x${L}${a} ${C}w`}return""}).join(", "),sizes:(d=t.sizes)==null?void 0:d.map(_=>_).join(", ")};let T="";return $.srcset&&(T+=`srcset="${$.srcset}" `),$.sizes&&(T+=`sizes="${$.sizes}" `),i.replace(/<img/g,`<img ${T.trim()}`)}return i})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&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(o=>{t.push(this.renderNode(o))}):e.text?t.push(Le(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html?t.push(r.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&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 o=`<${r.tag}`;if(r.attrs){for(const n in r.attrs)if(Object.prototype.hasOwnProperty.call(r.attrs,n)){const a=r.attrs[n];a!==null&&(o+=` ${n}="${a}"`)}}return`${o}${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)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}class xe{constructor(e){m(this,"baseURL"),m(this,"timeout"),m(this,"headers"),m(this,"responseInterceptor"),m(this,"fetch"),m(this,"ejectInterceptor"),m(this,"url"),m(this,"parameters"),m(this,"fetchOptions"),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=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t??{},this._methodHandler("delete")}async _responseHandler(e){const t=[],r={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(o=>{r.data=o});for(const o of e.headers.entries())t[o[0]]=o[1];return r.headers={...t},r.status=e.status,r.statusText=e.statusText,r}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,r=null;if(e==="get"){const i=new x;t=`${this.baseURL}${this.url}?${i.stringify(this.parameters)}`}else r=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:a}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const i=await this.fetch(`${o}`,{method:e,headers:this.headers,body:r,signal:a,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(i);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(i){return{message:i}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((r,o)=>{if(t.test(`${e.status}`))return r(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};o(n)})}}const J="SB-Agent",D={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let P={};const j={};class Pe{constructor(e,t){m(this,"client"),m(this,"maxRetries"),m(this,"retriesDelay"),m(this,"throttle"),m(this,"accessToken"),m(this,"cache"),m(this,"helpers"),m(this,"resolveCounter"),m(this,"relations"),m(this,"links"),m(this,"richTextResolver"),m(this,"resolveNestedRelations"),m(this,"stringifiedStoriesCache");let r=e.endpoint||t;if(!r){const a=new x().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?r=`${l}://${a(e.region)}/v1`:r=`${l}://${a(e.region)}/v2`}const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([a,l])=>{o.set(a,l)}),o.has(J)||(o.set(J,D.defaultAgentName),o.set(D.defaultAgentVersion,D.packageVersion));let n=5;e.oauthToken&&(o.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new A(e.richTextSchema):this.richTextResolver=new A,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=ae(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new x,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new xe({baseURL:r,timeout:e.timeout||0,headers:o,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body&&t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=j[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,r,o,n){const a=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,o));return this.cacheResponse(e,a,void 0,n)}get(e,t,r){t||(t={});const o=`/${e}`,n=this.factoryParamOptions(o,t);return this.cacheResponse(o,n,void 0,r)}async getAll(e,t,r,o){const n=(t==null?void 0:t.per_page)||25,a=`/${e}`.replace(/\/$/,""),l=r??a.substring(a.lastIndexOf("/")+1),i=1,h=await this.makeRequest(a,t,n,i,o),d=h.total?Math.ceil(h.total/n):1,p=await this.helpers.asyncMap(this.helpers.range(i,d),$=>this.makeRequest(a,t,n,$+1,o));return this.helpers.flatMap([h,...p],$=>Object.values($.data[l]))}post(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("post",o,t,r))}put(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("put",o,t,r))}delete(e,t,r){t||(t={});const o=`/${e}`;return Promise.resolve(this.throttle("delete",o,t,r))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,r){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,r)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,r){const o=e[t];o&&o.fieldtype==="multilink"&&o.linktype==="story"&&typeof o.id=="string"&&this.links[r][o.id]?o.story=this._cleanCopy(this.links[r][o.id]):o&&o.linktype==="story"&&typeof o.uuid=="string"&&this.links[r][o.uuid]&&(o.story=this._cleanCopy(this.links[r][o.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const o=e[t];typeof o=="string"?e[t]=this.getStoryReference(r,o):Array.isArray(o)&&(e[t]=o.map(n=>this.getStoryReference(r,n)).filter(Boolean))}_insertRelations(e,t,r,o){if(Array.isArray(r)?r.find(a=>a.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,o);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(n):r===n)&&this._resolveField(e,t,o)}iterateTree(e,t,r){const o=(n,a="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,i)=>o(l,`${a}[${i}]`));else if(typeof n=="object")for(const l in n){const i=a?`${a}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,r),this._insertLinks(n,l,r)),o(n[l],i)}}};o(e.content)}async resolveLinks(e,t,r){let o=[];if(e.link_uuids){const n=e.link_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.link_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(",")})).data.stories.forEach(h=>{o.push(h)})}else o=e.links;o.forEach(n=>{this.links[r][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,r){let o=[];if(e.rel_uuids){const n=e.rel_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.rel_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{o.push(h)})}else o=e.rels;o&&o.length>0&&o.forEach(n=>{this.relations[r][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,r){var o,n;let a=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(a=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((o=e.links)!=null&&o.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],a,r);e.story?this.iterateTree(e.story,a,r):e.stories.forEach(l=>{this.iterateTree(l,a,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,o){const n=this.helpers.stringify({url:e,params:t}),a=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const l=await a.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,i)=>{var h;try{const d=await this.throttle("get",e,t,o);if(d.status!==200)return i(d);let p={data:d.data,headers:d.headers};if((h=d.headers)!=null&&h["per-page"]&&(p=Object.assign({},p,{perPage:d.headers["per-page"]?Number.parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?Number.parseInt(d.headers.total):0})),p.data.story||p.data.stories){const T=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(p.data,t,`${T}`)}t.version==="published"&&e!=="/cdn/spaces/me"&&await a.set(n,p);const $=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&p.data.cv&&($&&j[t.token]&&j[t.token]!==p.data.cv&&await this.flushCache(),j[t.token]=p.data.cv),l(p)}catch(d){if(d.response&&d.status===429&&(r=typeof r>"u"?0:r+1,r<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(i);i(d)}})}throttledRequest(e,t,r,o){return this.client.setFetchOptions(o),this.client[e](t,r)}cacheVersions(){return j}cacheVersion(){return j[this.accessToken]}setCacheVersion(e){this.accessToken&&(j[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(j[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(P[e])},getAll(){return Promise.resolve(P)},set(e,t){return P[e]=t,Promise.resolve(void 0)},flush(){return P={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const Ne=(s={})=>{const{apiOptions:e}=s;if(!e||!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 Pe(e)}},Me=s=>{if(typeof s!="object"||typeof s._editable>"u")return{};try{const e=JSON.parse(s._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function De(s,e){if(!e)return{src:s,attrs:{}};let t=0,r=0;const o={},n=[];function a(i,h,d,p,$){typeof i!="number"||i<=h||i>=d?console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase()+p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`):$.push(`${p}(${i})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(o.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(o.height=e.height,r=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(o.loading=e.loading),e.class&&(o.class=e.class),e.filters){const{filters:i}=e||{},{blur:h,brightness:d,fill:p,format:$,grayscale:T,quality:_,rotate:C}=i||{};h&&a(h,0,100,"blur",n),_&&a(_,0,100,"quality",n),d&&a(d,0,100,"brightness",n),p&&n.push(`fill(${p})`),T&&n.push("grayscale()"),C&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${C})`),$&&["webp","png","jpeg"].includes($)&&n.push(`format(${$})`)}e.srcset&&(o.srcset=e.srcset.map(i=>{if(typeof i=="number")return`${s}/m/${i}x0/${n.length>0?`filters:${n.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[h,d]=i;return`${s}/m/${h}x${d}/${n.length>0?`filters:${n.join(":")}`:""} ${h}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(o.sizes=e.sizes.join(", "))}let l=`${s}/m/`;return t>0&&r>0&&(l=`${l}${t}x${r}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:o}}var v=(s=>(s.DOCUMENT="doc",s.HEADING="heading",s.PARAGRAPH="paragraph",s.QUOTE="blockquote",s.OL_LIST="ordered_list",s.UL_LIST="bullet_list",s.LIST_ITEM="list_item",s.CODE_BLOCK="code_block",s.HR="horizontal_rule",s.BR="hard_break",s.IMAGE="image",s.EMOJI="emoji",s.COMPONENT="blok",s.TABLE="table",s.TABLE_ROW="tableRow",s.TABLE_CELL="tableCell",s.TABLE_HEADER="tableHeader",s))(v||{}),E=(s=>(s.BOLD="bold",s.STRONG="strong",s.STRIKE="strike",s.UNDERLINE="underline",s.ITALIC="italic",s.CODE="code",s.LINK="link",s.ANCHOR="anchor",s.STYLED="styled",s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.TEXT_STYLE="textStyle",s.HIGHLIGHT="highlight",s))(E||{}),H=(s=>(s.TEXT="text",s))(H||{}),I=(s=>(s.URL="url",s.STORY="story",s.ASSET="asset",s.EMAIL="email",s))(I||{});const He=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Be=(s={})=>Object.keys(s).map(e=>`${e}="${s[e]}"`).join(" "),Ue=(s={})=>Object.keys(s).map(e=>`${e}: ${s[e]}`).join("; ");function ze(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const N=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!==void 0));function K(s,e={},t){const r=Be(e),o=r?`${s} ${r}`:s,n=Array.isArray(t)?t.join(""):t||"";if(s){if(He.includes(s))return`<${o}>`}else return n;return`<${o}>${n}</${s}>`}function Y(s={}){let e=0;const{renderFn:t=K,textFn:r=ze,resolvers:o={},optimizeImages:n=!1,keyedResolvers:a=!1}=s,l=t!==K,i=c=>u=>{const f=u.attrs||{};return a&&(f.key=`${c}-${e}`),t(c,f,u.children||null)},h=c=>{const{src:u,alt:f,title:k,srcset:S,sizes:w}=c.attrs||{};let y=u,R={};if(n){const{src:it,attrs:lt}=De(u,n);y=it,R=lt}a&&(R={...R,key:`img-${e}`});const at={src:y,alt:f,title:k,srcset:S,sizes:w,...R};return t("img",N(at))},d=c=>{const{level:u,...f}=c.attrs||{},k={...f};return a&&(k.key=`h${u}-${e}`),t(`h${u}`,k,c.children)},p=c=>{var u,f,k,S;const w=t("img",{src:(u=c.attrs)==null?void 0:u.fallbackImage,alt:(f=c.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),y={"data-type":"emoji","data-name":(k=c.attrs)==null?void 0:k.name,"data-emoji":(S=c.attrs)==null?void 0:S.emoji};return a&&(y.key=`emoji-${e}`),t("span",y,w)},$=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),T=(c,u=!1)=>({text:f,attrs:k})=>{const{class:S,id:w,...y}=k||{},R=u?{class:S,id:w,style:Ue(y)||void 0}:k||{};return a&&(R.key=`${c}-${e}`),t(c,N(R),f)},_=c=>z(c),C=c=>{const{marks:u,...f}=c;return"text"in c?u?u.reduce((k,S)=>_({...S,text:k}),_({...f,children:f.children})):r(f.text):""},L=c=>{const{linktype:u,href:f,anchor:k,...S}=c.attrs||{};let w="";switch(u){case I.ASSET:case I.URL:w=f;break;case I.EMAIL:w=`mailto:${f}`;break;case I.STORY:w=f,k&&(w=`${w}#${k}`);break;default:w=f;break}const y={...S};return w&&(y.href=w),a&&(y.key=`a-${e}`),t("a",y,c.text)},et=c=>{var u,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(u=c==null?void 0:c.attrs)==null?void 0:u.body[0],id:(f=c.attrs)==null?void 0:f.id,key:`component-${e}`,style:"display: none"})},tt=c=>{const u={};return a&&(u.key=`table-${e}`),t("table",u,c.children)},rt=c=>{const u={};return a&&(u.key=`tr-${e}`),t("tr",u,c.children)},st=c=>{const{colspan:u,rowspan:f,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),f>1&&(y.rowspan=f);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`td-${e}`),t("td",N(y),c.children)},ot=c=>{const{colspan:u,rowspan:f,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),f>1&&(y.rowspan=f);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`th-${e}`),t("th",N(y),c.children)},nt=new Map([[v.DOCUMENT,i("")],[v.HEADING,d],[v.PARAGRAPH,i("p")],[v.UL_LIST,i("ul")],[v.OL_LIST,i("ol")],[v.LIST_ITEM,i("li")],[v.IMAGE,h],[v.EMOJI,p],[v.CODE_BLOCK,$],[v.HR,i("hr")],[v.BR,i("br")],[v.QUOTE,i("blockquote")],[v.COMPONENT,et],[H.TEXT,C],[E.LINK,L],[E.ANCHOR,L],[E.STYLED,T("span",!0)],[E.BOLD,T("strong")],[E.TEXT_STYLE,T("span",!0)],[E.ITALIC,T("em")],[E.UNDERLINE,T("u")],[E.STRIKE,T("s")],[E.CODE,T("code")],[E.SUPERSCRIPT,T("sup")],[E.SUBSCRIPT,T("sub")],[E.HIGHLIGHT,T("mark")],[v.TABLE,tt],[v.TABLE_ROW,rt],[v.TABLE_CELL,st],[v.TABLE_HEADER,ot],...Object.entries(o).map(([c,u])=>[c,u])]);function M(c){e+=1;const u=nt.get(c.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return u(c);const f=c.content?c.content.map(z):void 0;return u({...c,children:f})}function z(c){return c.type==="doc"?l?c.content.map(M):c.content.map(M).join(""):Array.isArray(c)?c.map(M):M(c)}return{render:z}}let B,W="https://app.storyblok.com/f/storyblok-v2-latest.js";const X=(s,e,t={})=>{var r;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),a=n!==null&&+n===s;if(!(!o||!a)){if(!s){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{var i;l&&(l.action==="input"&&((i=l.story)==null?void 0:i.id)===s?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===s&&window.location.reload())})})}},Q=(s,e)=>{s.addNode("blok",t=>{let r="";return t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})},Fe=(s={})=>{var e,t;const{bridge:r,accessToken:o,use:n=[],apiOptions:a={},richText:l={},bridgeUrl:i}=s;a.accessToken=a.accessToken||o;const h={bridge:r,apiOptions:a};let d={};n.forEach($=>{d={...d,...$(h)}}),i&&(W=i);const p=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return r!==!1&&p&&re(W),B=new A(l.schema),l.resolver&&Q(B,l.resolver),d},Ve=s=>{var e;return!s||!((e=s==null?void 0:s.content)!=null&&e.some(t=>t.content||t.type==="blok"||t.type==="horizontal_rule"))},qe=(s,e,t)=>{let r=t||B;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ve(s)?"":(e&&(r=new A(e.schema),e.resolver&&Q(r,e.resolver)),r.render(s,{},!1))},U=g.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(s,{expose:e}){const t=s,r=g.ref();e({value:r});const o=typeof g.resolveDynamicComponent(t.blok.component)!="string",n=g.inject("VueSDKOptions"),a=g.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(a.value=n.customFallbackComponent??"FallbackComponent",typeof g.resolveDynamicComponent(a.value)=="string"&&console.error(`Is the Fallback component "${a.value}" registered properly?`)):console.error(`Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`)),(l,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(a.value),g.mergeProps({ref_key:"blokRef",ref:r},{...l.$props,...l.$attrs}),null,16))}}),Ge=s=>{var e,t;return g.h(U,{blok:(e=s==null?void 0:s.attrs)==null?void 0:e.body[0],id:(t=s.attrs)==null?void 0:t.id},s.children)};function Z(s){const e={renderFn:g.h,textFn:g.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:Ge,...s.resolvers}};return Y(e)}const ee=g.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(s){const e=s,t=g.ref(),r=()=>t.value;return g.watch([()=>e.doc,()=>e.resolvers],([o,n])=>{const{render:a}=Z({resolvers:n??{}});t.value=a(o)},{immediate:!0,deep:!0}),(o,n)=>(g.openBlock(),g.createBlock(r))}}),Je={beforeMount(s,e){if(e.value){const t=Me(e.value);Object.keys(t).length>0&&(s.setAttribute("data-blok-c",t["data-blok-c"]),s.setAttribute("data-blok-uid",t["data-blok-uid"]),s.classList.add("storyblok__outline"))}}},te=s=>{console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
|
|
30
|
+
}`),""}optimizeImages(e,t){let r=0,o=0,n="",a="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,r=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,o=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(a+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(a+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(a+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(a+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(a+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(a+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(a+=`:rotate(${t.filters.rotate})`),a.length>0&&(a=`/filters${a}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=r>0||o>0||a.length>0?`${r}x${o}${a}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,i=>{var h,d;const p=i.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(p&&p.length>0){const $={srcset:(h=t.srcset)==null?void 0:h.map(_=>{if(typeof _=="number")return`//${p}/m/${_}x0${a} ${_}w`;if(typeof _=="object"&&_.length===2){let C=0,L=0;return typeof _[0]=="number"&&(C=_[0]),typeof _[1]=="number"&&(L=_[1]),`//${p}/m/${C}x${L}${a} ${C}w`}return""}).join(", "),sizes:(d=t.sizes)==null?void 0:d.map(_=>_).join(", ")};let T="";return $.srcset&&(T+=`srcset="${$.srcset}" `),$.sizes&&(T+=`sizes="${$.sizes}" `),i.replace(/<img/g,`<img ${T.trim()}`)}return i})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&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(o=>{t.push(this.renderNode(o))}):e.text?t.push(Le(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html?t.push(r.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&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 o=`<${r.tag}`;if(r.attrs){for(const n in r.attrs)if(Object.prototype.hasOwnProperty.call(r.attrs,n)){const a=r.attrs[n];a!==null&&(o+=` ${n}="${a}"`)}}return`${o}${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)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}class xe{constructor(e){f(this,"baseURL"),f(this,"timeout"),f(this,"headers"),f(this,"responseInterceptor"),f(this,"fetch"),f(this,"ejectInterceptor"),f(this,"url"),f(this,"parameters"),f(this,"fetchOptions"),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=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t??{},this._methodHandler("delete")}async _responseHandler(e){const t=[],r={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(o=>{r.data=o});for(const o of e.headers.entries())t[o[0]]=o[1];return r.headers={...t},r.status=e.status,r.statusText=e.statusText,r}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,r=null;if(e==="get"){const i=new x;t=`${this.baseURL}${this.url}?${i.stringify(this.parameters)}`}else r=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:a}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const i=await this.fetch(`${o}`,{method:e,headers:this.headers,body:r,signal:a,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(i);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(i){return{message:i}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((r,o)=>{if(t.test(`${e.status}`))return r(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};o(n)})}}const J="SB-Agent",D={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let P={};const j={};class Pe{constructor(e,t){f(this,"client"),f(this,"maxRetries"),f(this,"retriesDelay"),f(this,"throttle"),f(this,"accessToken"),f(this,"cache"),f(this,"helpers"),f(this,"resolveCounter"),f(this,"relations"),f(this,"links"),f(this,"richTextResolver"),f(this,"resolveNestedRelations"),f(this,"stringifiedStoriesCache");let r=e.endpoint||t;if(!r){const a=new x().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?r=`${l}://${a(e.region)}/v1`:r=`${l}://${a(e.region)}/v2`}const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([a,l])=>{o.set(a,l)}),o.has(J)||(o.set(J,D.defaultAgentName),o.set(D.defaultAgentVersion,D.packageVersion));let n=5;e.oauthToken&&(o.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new A(e.richTextSchema):this.richTextResolver=new A,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=ae(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new x,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new xe({baseURL:r,timeout:e.timeout||0,headers:o,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body&&t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=j[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,r,o,n){const a=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,o));return this.cacheResponse(e,a,void 0,n)}get(e,t,r){t||(t={});const o=`/${e}`,n=this.factoryParamOptions(o,t);return this.cacheResponse(o,n,void 0,r)}async getAll(e,t,r,o){const n=(t==null?void 0:t.per_page)||25,a=`/${e}`.replace(/\/$/,""),l=r??a.substring(a.lastIndexOf("/")+1),i=1,h=await this.makeRequest(a,t,n,i,o),d=h.total?Math.ceil(h.total/n):1,p=await this.helpers.asyncMap(this.helpers.range(i,d),$=>this.makeRequest(a,t,n,$+1,o));return this.helpers.flatMap([h,...p],$=>Object.values($.data[l]))}post(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("post",o,t,r))}put(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("put",o,t,r))}delete(e,t,r){t||(t={});const o=`/${e}`;return Promise.resolve(this.throttle("delete",o,t,r))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,r){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,r)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,r){const o=e[t];o&&o.fieldtype==="multilink"&&o.linktype==="story"&&typeof o.id=="string"&&this.links[r][o.id]?o.story=this._cleanCopy(this.links[r][o.id]):o&&o.linktype==="story"&&typeof o.uuid=="string"&&this.links[r][o.uuid]&&(o.story=this._cleanCopy(this.links[r][o.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const o=e[t];typeof o=="string"?e[t]=this.getStoryReference(r,o):Array.isArray(o)&&(e[t]=o.map(n=>this.getStoryReference(r,n)).filter(Boolean))}_insertRelations(e,t,r,o){if(Array.isArray(r)?r.find(a=>a.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,o);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(n):r===n)&&this._resolveField(e,t,o)}iterateTree(e,t,r){const o=(n,a="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,i)=>o(l,`${a}[${i}]`));else if(typeof n=="object")for(const l in n){const i=a?`${a}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,r),this._insertLinks(n,l,r)),o(n[l],i)}}};o(e.content)}async resolveLinks(e,t,r){let o=[];if(e.link_uuids){const n=e.link_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.link_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(",")})).data.stories.forEach(h=>{o.push(h)})}else o=e.links;o.forEach(n=>{this.links[r][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,r){let o=[];if(e.rel_uuids){const n=e.rel_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.rel_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{o.push(h)})}else o=e.rels;o&&o.length>0&&o.forEach(n=>{this.relations[r][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,r){var o,n;let a=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(a=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((o=e.links)!=null&&o.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],a,r);e.story?this.iterateTree(e.story,a,r):e.stories.forEach(l=>{this.iterateTree(l,a,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,o){const n=this.helpers.stringify({url:e,params:t}),a=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const l=await a.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,i)=>{var h;try{const d=await this.throttle("get",e,t,o);if(d.status!==200)return i(d);let p={data:d.data,headers:d.headers};if((h=d.headers)!=null&&h["per-page"]&&(p=Object.assign({},p,{perPage:d.headers["per-page"]?Number.parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?Number.parseInt(d.headers.total):0})),p.data.story||p.data.stories){const T=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(p.data,t,`${T}`)}t.version==="published"&&e!=="/cdn/spaces/me"&&await a.set(n,p);const $=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&p.data.cv&&($&&j[t.token]&&j[t.token]!==p.data.cv&&await this.flushCache(),j[t.token]=p.data.cv),l(p)}catch(d){if(d.response&&d.status===429&&(r=typeof r>"u"?0:r+1,r<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(i);i(d)}})}throttledRequest(e,t,r,o){return this.client.setFetchOptions(o),this.client[e](t,r)}cacheVersions(){return j}cacheVersion(){return j[this.accessToken]}setCacheVersion(e){this.accessToken&&(j[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(j[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(P[e])},getAll(){return Promise.resolve(P)},set(e,t){return P[e]=t,Promise.resolve(void 0)},flush(){return P={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const Ne=(s={})=>{const{apiOptions:e}=s;if(!e||!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 Pe(e)}},Me=s=>{if(typeof s!="object"||typeof s._editable>"u")return{};try{const e=JSON.parse(s._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function De(s,e){if(!e)return{src:s,attrs:{}};let t=0,r=0;const o={},n=[];function a(i,h,d,p,$){typeof i!="number"||i<=h||i>=d?console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase()+p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`):$.push(`${p}(${i})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(o.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(o.height=e.height,r=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(o.loading=e.loading),e.class&&(o.class=e.class),e.filters){const{filters:i}=e||{},{blur:h,brightness:d,fill:p,format:$,grayscale:T,quality:_,rotate:C}=i||{};h&&a(h,0,100,"blur",n),_&&a(_,0,100,"quality",n),d&&a(d,0,100,"brightness",n),p&&n.push(`fill(${p})`),T&&n.push("grayscale()"),C&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${C})`),$&&["webp","png","jpeg"].includes($)&&n.push(`format(${$})`)}e.srcset&&(o.srcset=e.srcset.map(i=>{if(typeof i=="number")return`${s}/m/${i}x0/${n.length>0?`filters:${n.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[h,d]=i;return`${s}/m/${h}x${d}/${n.length>0?`filters:${n.join(":")}`:""} ${h}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(o.sizes=e.sizes.join(", "))}let l=`${s}/m/`;return t>0&&r>0&&(l=`${l}${t}x${r}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:o}}var v=(s=>(s.DOCUMENT="doc",s.HEADING="heading",s.PARAGRAPH="paragraph",s.QUOTE="blockquote",s.OL_LIST="ordered_list",s.UL_LIST="bullet_list",s.LIST_ITEM="list_item",s.CODE_BLOCK="code_block",s.HR="horizontal_rule",s.BR="hard_break",s.IMAGE="image",s.EMOJI="emoji",s.COMPONENT="blok",s.TABLE="table",s.TABLE_ROW="tableRow",s.TABLE_CELL="tableCell",s.TABLE_HEADER="tableHeader",s))(v||{}),E=(s=>(s.BOLD="bold",s.STRONG="strong",s.STRIKE="strike",s.UNDERLINE="underline",s.ITALIC="italic",s.CODE="code",s.LINK="link",s.ANCHOR="anchor",s.STYLED="styled",s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.TEXT_STYLE="textStyle",s.HIGHLIGHT="highlight",s))(E||{}),H=(s=>(s.TEXT="text",s))(H||{}),I=(s=>(s.URL="url",s.STORY="story",s.ASSET="asset",s.EMAIL="email",s))(I||{});const He=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Be=(s={})=>Object.keys(s).map(e=>`${e}="${s[e]}"`).join(" "),Ue=(s={})=>Object.keys(s).map(e=>`${e}: ${s[e]}`).join("; ");function ze(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}const N=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!==void 0));function K(s,e={},t){const r=Be(e),o=r?`${s} ${r}`:s,n=Array.isArray(t)?t.join(""):t||"";if(s){if(He.includes(s))return`<${o}>`}else return n;return`<${o}>${n}</${s}>`}function Y(s={}){let e=0;const{renderFn:t=K,textFn:r=ze,resolvers:o={},optimizeImages:n=!1,keyedResolvers:a=!1}=s,l=t!==K,i=c=>u=>{const m=u.attrs||{};return a&&(m.key=`${c}-${e}`),t(c,m,u.children||null)},h=c=>{const{src:u,alt:m,title:k,srcset:S,sizes:w}=c.attrs||{};let y=u,R={};if(n){const{src:it,attrs:lt}=De(u,n);y=it,R=lt}a&&(R={...R,key:`img-${e}`});const at={src:y,alt:m,title:k,srcset:S,sizes:w,...R};return t("img",N(at))},d=c=>{const{level:u,...m}=c.attrs||{},k={...m};return a&&(k.key=`h${u}-${e}`),t(`h${u}`,k,c.children)},p=c=>{var u,m,k,S;const w=t("img",{src:(u=c.attrs)==null?void 0:u.fallbackImage,alt:(m=c.attrs)==null?void 0:m.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),y={"data-type":"emoji","data-name":(k=c.attrs)==null?void 0:k.name,"data-emoji":(S=c.attrs)==null?void 0:S.emoji};return a&&(y.key=`emoji-${e}`),t("span",y,w)},$=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),T=(c,u=!1)=>({text:m,attrs:k})=>{const{class:S,id:w,...y}=k||{},R=u?{class:S,id:w,style:Ue(y)||void 0}:k||{};return a&&(R.key=`${c}-${e}`),t(c,N(R),m)},_=c=>z(c),C=c=>{const{marks:u,...m}=c;return"text"in c?u?u.reduce((k,S)=>_({...S,text:k}),_({...m,children:m.children})):r(m.text):""},L=c=>{const{linktype:u,href:m,anchor:k,...S}=c.attrs||{};let w="";switch(u){case I.ASSET:case I.URL:w=m;break;case I.EMAIL:w=`mailto:${m}`;break;case I.STORY:w=m,k&&(w=`${w}#${k}`);break;default:w=m;break}const y={...S};return w&&(y.href=w),a&&(y.key=`a-${e}`),t("a",y,c.text)},et=c=>{var u,m;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(u=c==null?void 0:c.attrs)==null?void 0:u.body[0],id:(m=c.attrs)==null?void 0:m.id,key:`component-${e}`,style:"display: none"})},tt=c=>{const u={};return a&&(u.key=`table-${e}`),t("table",u,c.children)},rt=c=>{const u={};return a&&(u.key=`tr-${e}`),t("tr",u,c.children)},st=c=>{const{colspan:u,rowspan:m,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),m>1&&(y.rowspan=m);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`td-${e}`),t("td",N(y),c.children)},ot=c=>{const{colspan:u,rowspan:m,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),m>1&&(y.rowspan=m);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`th-${e}`),t("th",N(y),c.children)},nt=new Map([[v.DOCUMENT,i("")],[v.HEADING,d],[v.PARAGRAPH,i("p")],[v.UL_LIST,i("ul")],[v.OL_LIST,i("ol")],[v.LIST_ITEM,i("li")],[v.IMAGE,h],[v.EMOJI,p],[v.CODE_BLOCK,$],[v.HR,i("hr")],[v.BR,i("br")],[v.QUOTE,i("blockquote")],[v.COMPONENT,et],[H.TEXT,C],[E.LINK,L],[E.ANCHOR,L],[E.STYLED,T("span",!0)],[E.BOLD,T("strong")],[E.TEXT_STYLE,T("span",!0)],[E.ITALIC,T("em")],[E.UNDERLINE,T("u")],[E.STRIKE,T("s")],[E.CODE,T("code")],[E.SUPERSCRIPT,T("sup")],[E.SUBSCRIPT,T("sub")],[E.HIGHLIGHT,T("mark")],[v.TABLE,tt],[v.TABLE_ROW,rt],[v.TABLE_CELL,st],[v.TABLE_HEADER,ot],...Object.entries(o).map(([c,u])=>[c,u])]);function M(c){e+=1;const u=nt.get(c.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return u(c);const m=c.content?c.content.map(z):void 0;return u({...c,children:m})}function z(c){return c.type==="doc"?l?c.content.map(M):c.content.map(M).join(""):Array.isArray(c)?c.map(M):M(c)}return{render:z}}let B,W="https://app.storyblok.com/f/storyblok-v2-latest.js";const X=(s,e,t={})=>{var r;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),a=n!==null&&+n===s;if(!(!o||!a)){if(!s){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{var i;l&&(l.action==="input"&&((i=l.story)==null?void 0:i.id)===s?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===s&&window.location.reload())})})}},Q=(s,e)=>{s.addNode("blok",t=>{let r="";return t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})},Fe=(s={})=>{var e,t;const{bridge:r,accessToken:o,use:n=[],apiOptions:a={},richText:l={},bridgeUrl:i}=s;a.accessToken=a.accessToken||o;const h={bridge:r,apiOptions:a};let d={};n.forEach($=>{d={...d,...$(h)}}),i&&(W=i);const p=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return r!==!1&&p&&re(W),B=new A(l.schema),l.resolver&&Q(B,l.resolver),d},Ve=s=>{var e;return!s||!((e=s==null?void 0:s.content)!=null&&e.some(t=>t.content||t.type==="blok"||t.type==="horizontal_rule"))},qe=(s,e,t)=>{let r=t||B;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ve(s)?"":(e&&(r=new A(e.schema),e.resolver&&Q(r,e.resolver)),r.render(s,{},!1))},U=g.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(s,{expose:e}){const t=s,r=g.ref();e({value:r});const o=typeof g.resolveDynamicComponent(t.blok.component)!="string",n=g.inject("VueSDKOptions"),a=g.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(a.value=n.customFallbackComponent??"FallbackComponent",typeof g.resolveDynamicComponent(a.value)=="string"&&console.error(`Is the Fallback component "${a.value}" registered properly?`)):console.error(`Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`)),(l,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(a.value),g.mergeProps({ref_key:"blokRef",ref:r},{...l.$props,...l.$attrs}),null,16))}}),Ge=s=>{var e,t;return g.h(U,{blok:(e=s==null?void 0:s.attrs)==null?void 0:e.body[0],id:(t=s.attrs)==null?void 0:t.id},s.children)};function Z(s){const e={renderFn:g.h,textFn:g.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:Ge,...s.resolvers}};return Y(e)}const ee=g.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(s){const e=s,t=g.ref(),r=()=>t.value;return g.watch([()=>e.doc,()=>e.resolvers],([o,n])=>{const{render:a}=Z({resolvers:n??{}});t.value=a(o)},{immediate:!0,deep:!0}),(o,n)=>(g.openBlock(),g.createBlock(r))}}),Je={beforeMount(s,e){if(e.value){const t=Me(e.value);Object.keys(t).length>0&&(s.setAttribute("data-blok-c",t["data-blok-c"]),s.setAttribute("data-blok-uid",t["data-blok-uid"]),s.classList.add("storyblok__outline"))}}},te=s=>{console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
|
|
31
31
|
`)};let O=null;const Ke=()=>(O||te("useStoryblokApi"),O),Ye=async(s,e={},t={})=>{const r=g.ref(null);if(t.resolveRelations=t.resolveRelations??e.resolve_relations,t.resolveLinks=t.resolveLinks??e.resolve_links,g.onMounted(()=>{r.value&&r.value.id&&X(r.value.id,o=>r.value=o,t)}),O){const{data:o}=await O.get(`cdn/stories/${s}`,e);r.value=o.story}else te("useStoryblok");return r},We={install(s,e={}){s.directive("editable",Je),s.component("StoryblokComponent",U),s.component("StoryblokRichText",ee),e.enableFallbackComponent&&!e.customFallbackComponent&&s.component("FallbackComponent",g.defineAsyncComponent(()=>Promise.resolve().then(()=>Ze)));const{storyblokApi:t}=Fe(e);O=t||null,s.provide("VueSDKOptions",e)}},Xe={class:"fallback-component"},Qe={class:"component"},Ze=Object.freeze(Object.defineProperty({__proto__:null,default:((s,e)=>{const t=s.__vccOpts||s;for(const[r,o]of e)t[r]=o;return t})(g.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(s){return(e,t)=>(g.openBlock(),g.createElementBlock("div",Xe,[g.createElementVNode("p",null,[t[0]||(t[0]=g.createTextVNode(" Component could not be found for blok ")),g.createElementVNode("span",Qe,g.toDisplayString(e.blok.component),1),t[1]||(t[1]=g.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));b.BlockTypes=v,b.MarkTypes=E,b.RichTextResolver=A,b.RichTextSchema=q,b.StoryblokComponent=U,b.StoryblokRichText=ee,b.StoryblokVue=We,b.TextTypes=H,b.apiPlugin=Ne,b.renderRichText=qe,b.richTextResolver=Y,b.useStoryblok=Ye,b.useStoryblokApi=Ke,b.useStoryblokBridge=X,b.useStoryblokRichText=Z,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/dist/storyblok-vue.mjs
CHANGED
|
@@ -96,7 +96,10 @@ class P {
|
|
|
96
96
|
for (const n in e) {
|
|
97
97
|
if (!Object.prototype.hasOwnProperty.call(e, n))
|
|
98
98
|
continue;
|
|
99
|
-
const a = e[n]
|
|
99
|
+
const a = e[n];
|
|
100
|
+
if (a == null)
|
|
101
|
+
continue;
|
|
102
|
+
const l = r ? "" : encodeURIComponent(n);
|
|
100
103
|
let i;
|
|
101
104
|
typeof a == "object" ? i = this.stringify(
|
|
102
105
|
a,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storyblok/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.2.
|
|
4
|
+
"version": "8.2.1",
|
|
5
5
|
"packageManager": "pnpm@10.2.0",
|
|
6
6
|
"description": "SDK to integrate Storyblok into your project using Vue.",
|
|
7
7
|
"author": "Storyblok",
|
|
@@ -40,13 +40,14 @@
|
|
|
40
40
|
"cy:run": "cypress run",
|
|
41
41
|
"cy:open": "cypress open",
|
|
42
42
|
"cy:components": "cypress run-ct",
|
|
43
|
-
"prepublishOnly": "pnpm build"
|
|
43
|
+
"prepublishOnly": "pnpm build",
|
|
44
|
+
"check-licenses": "node scripts/license-checker.mjs"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"vue": ">=3.4"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@storyblok/js": "3.3.
|
|
50
|
+
"@storyblok/js": "3.3.1"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@commitlint/cli": "^19.7.1",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
"eslint": "^9.19.0",
|
|
61
62
|
"eslint-plugin-vue": "^9.32.0",
|
|
62
63
|
"kolorist": "^1.8.0",
|
|
64
|
+
"license-checker": "^25.0.1",
|
|
63
65
|
"pathe": "^2.0.2",
|
|
64
66
|
"simple-git-hooks": "^2.11.1",
|
|
65
67
|
"typescript": "^5.7.3",
|