@storyblok/vue 2.1.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,8 +4,8 @@
4
4
  </a>
5
5
  <h1 align="center">@storyblok/vue</h1>
6
6
  <p align="center">
7
- Vue plugin to make any <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue" target="_blank">Storyblok</a> component editable with a simple <code>v-editable</code> directive.
8
- </p>
7
+ The Vue plugin you need to interact with <a href="http://www.storyblok.com?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue" target="_blank">Storyblok API</a> and enable the <a href="https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue" target="_blank">Real-time Visual Editing Experience</a>.
8
+ </p>
9
9
  <br />
10
10
  </div>
11
11
 
@@ -30,7 +30,7 @@
30
30
  </a>
31
31
  </p>
32
32
 
33
- **Note**: This plugin is for Vue 2. [Check out the @next version for Vue 3](https://github.com/storyblok/storyblok-vue/tree/next)
33
+ **Note**: This plugin is for Vue 3. [Check out the docs for Vue 2 version](https://github.com/storyblok/storyblok-vue/tree/master).
34
34
 
35
35
  ## 🚀 Usage
36
36
 
@@ -38,33 +38,97 @@
38
38
 
39
39
  ### Installation
40
40
 
41
- Install `@storyblok/vue`:
41
+ Install `@storyblok/vue@next`
42
42
 
43
43
  ```bash
44
- npm install --save-dev @storyblok/vue
45
- // yarn add -D @storyblok/vue
44
+ npm install --save-dev @storyblok/vue@next
45
+ # yarn add -D @storyblok/vue@next
46
46
  ```
47
47
 
48
- Register it globally on your application (usually in `main.js`):
48
+ Register the plugin on your application (usually in `main.js`), add the `apiPlugin` and add the [access token](https://www.storyblok.com/docs/api/content-delivery#topics/authentication?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) of your Storyblok space:
49
49
 
50
50
  ```js
51
- import Vue from "vue";
52
- import StoryblokVue from "@storyblok/vue";
51
+ import { createApp } from "vue";
52
+ import { StoryblokVue, apiPlugin } from "@storyblok/vue";
53
+ import App from "./App.vue";
53
54
 
54
- Vue.use(StoryblokVue);
55
+ const app = createApp(App);
56
+
57
+ app.use(StoryblokVue, {
58
+ accessToken: "YOUR_ACCESS_TOKEN",
59
+ use: [apiPlugin],
60
+ });
55
61
  ```
56
62
 
63
+ That's it! All the features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery#topics/introduction?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue), and _Storyblok Bridge_ for [real-time visual editing experience](https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
64
+
65
+ > You can enable/disable some of these features if you don't need them, so you save some KB. Please read the "Features and API" section.
66
+
57
67
  #### From a CDN
58
68
 
59
- Install the file from the CDN:
69
+ Install the file from the CDN and access the methods via `window.storyblokVue`:
70
+
71
+ ```html
72
+ <script src="https://unpkg.com/@storyblok/vue@next"></script>
73
+ ```
74
+
75
+ ### Getting started
76
+
77
+ `@storyblok/vue` does three actions when you initialize it:
78
+
79
+ - Provides a `storyblokApi` object in your app, which is an instance of [storyblok-js-client](https://github.com/storyblok/storyblok-js-client)
80
+ - Loads [Storyblok Bridge](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) for real-time visual updates
81
+ - Provides a `v-editable` directive to link editable components to the Storyblok Visual Editor
82
+
83
+ #### 1. Fetching Content
84
+
85
+ Inject `storyblokApi` when using Composition API:
86
+
87
+ ```html
88
+ <template>
89
+ <div>
90
+ <p v-for="story in stories" :key="story.id">{{ story.name }}</p>
91
+ </div>
92
+ </template>
93
+
94
+ <script setup>
95
+ import { useStoryblokApi } from "@storyblok/vue";
96
+
97
+ const storyblokApi = useStoryblokApi();
98
+ const { data } = await storyblokApi.get("cdn/stories", { version: "draft" });
99
+ </script>
100
+ ```
101
+
102
+ > Note: you can skip using `apiPlugin` if you prefer your own method or function to fetch your data.
103
+
104
+ #### 2. Listen to Storyblok Visual Editor events
105
+
106
+ Use `useStoryBridge` to get the new story every time is triggered a `change` event from the Visual Editor. You need to pass the story id as first param, and a callback function as second param to update the new story:
60
107
 
61
108
  ```html
62
- <script src="https://unpkg.com/@storyblok/vue"></script>
109
+ <script setup>
110
+ import { onMounted } from "vue";
111
+ import { useStoryblokBridge, useStoryblokApi } from "@storyblok/vue";
112
+
113
+ const storyblokApi = useStoryblokApi();
114
+ const { data } = await storyblokApi.get("cdn/stories", { version: "draft" });
115
+ const state = reactive({ story: data.story });
116
+
117
+ onMounted(() => {
118
+ useStoryblokBridge(state.story.id, story => (state.story = story));
119
+ });
120
+ </script>
63
121
  ```
64
122
 
65
- That's it, the plugin is auto-registered for you 😉.
123
+ You can pass [Bridge options](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) as a third parameter as well:
124
+
125
+ ```js
126
+ useStoryblokBridge(state.story.id, (story) => (state.story = story), {
127
+ resolveRelations: ["Article.author"],
128
+ });
129
+ ```
66
130
 
67
- ### Getting Started
131
+ #### 3. Link your components to Storyblok Visual Editor
68
132
 
69
133
  For every component you've defined in your Storyblok space, add the `v-editable` directive with the blok content:
70
134
 
@@ -76,11 +140,56 @@ For every component you've defined in your Storyblok space, add the `v-editable`
76
140
 
77
141
  Where `blok` is the actual blok data coming from [Storblok's Content Delivery API](https://www.storyblok.com/docs/api/content-delivery?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
78
142
 
79
- Check out the [playground](/../../tree/master/playground) for a full example.
143
+ Check out the [playground](/../../tree/next/playground) for a full example.
144
+
145
+ ### Features and API
146
+
147
+ You can **choose the features to use** when you initialize the plugin. In that way, you can improve Web Performance by optimizing your page load and save some bytes.
148
+
149
+ #### Storyblok API
150
+
151
+ You can use an `apiOptions` object. This is passed down to the (storyblok-js-client config object](https://github.com/storyblok/storyblok-js-client#class-storyblok):
152
+
153
+ ```js
154
+ app.use(StoryblokVue, {
155
+ accessToken: "<your-token>",
156
+ apiOptions: {
157
+ // storyblok-js-client config object
158
+ cache: { type: "memory" },
159
+ },
160
+ use: [apiPlugin],
161
+ });
162
+ ```
163
+
164
+ If you prefer to use your own fetch method, just remove the `apiPlugin` and `storyblok-js-client` won't be added to your application.
165
+
166
+ ```js
167
+ app.use(StoryblokVue);
168
+ ```
169
+
170
+ #### Storyblok Bridge
171
+
172
+ You can conditionally load it by using the `bridge` option. Very useful if you want to disable it in production:
173
+
174
+ ```js
175
+ app.use(StoryblokVue, {
176
+ bridge: process.env.NODE_ENV !== "production",
177
+ });
178
+ ```
179
+
180
+ In case you need it, you have still access to the raw `window.StoryblokBridge`:
181
+
182
+ ```js
183
+ const sbBridge = new window.StoryblokBridge(options);
184
+
185
+ sbBridge.on(["input", "published", "change"], (event) => {
186
+ // ...
187
+ });
188
+ ```
80
189
 
81
190
  ### Compatibility
82
191
 
83
- This plugin is for Vue 2. Thus, it supports the [same browsers as Vue 2](https://vuejs.org/v2/guide/installation.html#Compatibility-Note).
192
+ This plugin is for Vue 3. Thus, it supports the [same browsers as Vue 3](https://github.com/vuejs/rfcs/blob/master/active-rfcs/0038-vue3-ie11-support.md). In short: all modern browsers, dropping IE support.
84
193
 
85
194
  ## 🔗 Related Links
86
195
 
@@ -99,7 +208,3 @@ This plugin is for Vue 2. Thus, it supports the [same browsers as Vue 2](https:/
99
208
 
100
209
  Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
101
210
  This project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
102
-
103
- ### License
104
-
105
- This repository is published under the [MIT](./LICENSE) license.
@@ -0,0 +1,13 @@
1
+ (function(y,x){typeof exports=="object"&&typeof module!="undefined"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(y=typeof globalThis!="undefined"?globalThis:y||self,x(y.storyblokVue={}))})(this,function(y){"use strict";var x=Object.defineProperty,Ae=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,ee=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e)=>{for(var t in e||(e={}))_e.call(e,t)&&ee(r,t,e[t]);if(Q)for(var t of Q(e))je.call(e,t)&&ee(r,t,e[t]);return r},q=(r,e)=>Ae(r,Pe(e));let te=!1;const re=[],$e=r=>(window.storyblokRegisterEvent=e=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}te?e():re.push(e)},new Promise((e,t)=>{if(document.getElementById("storyblok-javascript-bridge"))return;const n=document.createElement("script");n.async=!0,n.src=r,n.id="storyblok-javascript-bridge",n.onerror=s=>t(s),n.onload=s=>{re.forEach(o=>o()),te=!0,e(s)},document.getElementsByTagName("head")[0].appendChild(n)}));var D={exports:{}},ne=function(e,t){return function(){for(var s=new Array(arguments.length),o=0;o<s.length;o++)s[o]=arguments[o];return e.apply(t,s)}},Ne=ne,k=Object.prototype.toString;function M(r){return k.call(r)==="[object Array]"}function I(r){return typeof r=="undefined"}function Ue(r){return r!==null&&!I(r)&&r.constructor!==null&&!I(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Le(r){return k.call(r)==="[object ArrayBuffer]"}function Be(r){return typeof FormData!="undefined"&&r instanceof FormData}function qe(r){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&r.buffer instanceof ArrayBuffer,e}function De(r){return typeof r=="string"}function Me(r){return typeof r=="number"}function se(r){return r!==null&&typeof r=="object"}function A(r){if(k.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function Ie(r){return k.call(r)==="[object Date]"}function He(r){return k.call(r)==="[object File]"}function Je(r){return k.call(r)==="[object Blob]"}function oe(r){return k.call(r)==="[object Function]"}function Fe(r){return se(r)&&oe(r.pipe)}function Ve(r){return typeof URLSearchParams!="undefined"&&r instanceof URLSearchParams}function ze(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Ke(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function H(r,e){if(!(r===null||typeof r=="undefined"))if(typeof r!="object"&&(r=[r]),M(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&e.call(null,r[s],s,r)}function J(){var r={};function e(s,o){A(r[o])&&A(s)?r[o]=J(r[o],s):A(s)?r[o]=J({},s):M(s)?r[o]=s.slice():r[o]=s}for(var t=0,n=arguments.length;t<n;t++)H(arguments[t],e);return r}function We(r,e,t){return H(e,function(s,o){t&&typeof s=="function"?r[o]=Ne(s,t):r[o]=s}),r}function Xe(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}var v={isArray:M,isArrayBuffer:Le,isBuffer:Ue,isFormData:Be,isArrayBufferView:qe,isString:De,isNumber:Me,isObject:se,isPlainObject:A,isUndefined:I,isDate:Ie,isFile:He,isBlob:Je,isFunction:oe,isStream:Fe,isURLSearchParams:Ve,isStandardBrowserEnv:Ke,forEach:H,merge:J,extend:We,trim:ze,stripBOM:Xe},T=v;function ae(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ie=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(T.isURLSearchParams(t))s=t.toString();else{var o=[];T.forEach(t,function(a,l){a===null||typeof a=="undefined"||(T.isArray(a)?l=l+"[]":a=[a],T.forEach(a,function(h){T.isDate(h)?h=h.toISOString():T.isObject(h)&&(h=JSON.stringify(h)),o.push(ae(l)+"="+ae(h))}))}),s=o.join("&")}if(s){var i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e},Ye=v;function P(){this.handlers=[]}P.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},P.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},P.prototype.forEach=function(e){Ye.forEach(this.handlers,function(n){n!==null&&e(n)})};var Ge=P,Ze=v,Qe=function(e,t){Ze.forEach(e,function(s,o){o!==t&&o.toUpperCase()===t.toUpperCase()&&(e[t]=s,delete e[o])})},ue=function(e,t,n,s,o){return e.config=t,n&&(e.code=n),e.request=s,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},et=ue,le=function(e,t,n,s,o){var i=new Error(e);return et(i,t,n,s,o)},tt=le,rt=function(e,t,n){var s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(tt("Request failed with status code "+n.status,n.config,null,n.request,n))},_=v,nt=_.isStandardBrowserEnv()?function(){return{write:function(t,n,s,o,i,u){var a=[];a.push(t+"="+encodeURIComponent(n)),_.isNumber(s)&&a.push("expires="+new Date(s).toGMTString()),_.isString(o)&&a.push("path="+o),_.isString(i)&&a.push("domain="+i),u===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),st=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},ot=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},at=st,it=ot,ut=function(e,t){return e&&!at(t)?it(e,t):t},F=v,lt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ct=function(e){var t={},n,s,o;return e&&F.forEach(e.split(`
2
+ `),function(u){if(o=u.indexOf(":"),n=F.trim(u.substr(0,o)).toLowerCase(),s=F.trim(u.substr(o+1)),n){if(t[n]&&lt.indexOf(n)>=0)return;n==="set-cookie"?t[n]=(t[n]?t[n]:[]).concat([s]):t[n]=t[n]?t[n]+", "+s:s}}),t},ce=v,dt=ce.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function s(o){var i=o;return e&&(t.setAttribute("href",i),i=t.href),t.setAttribute("href",i),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=s(window.location.href),function(i){var u=ce.isString(i)?s(i):i;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}(),j=v,ft=rt,ht=nt,pt=ie,mt=ut,vt=ct,gt=dt,V=le,de=function(e){return new Promise(function(n,s){var o=e.data,i=e.headers,u=e.responseType;j.isFormData(o)&&delete i["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",f=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.Authorization="Basic "+btoa(l+":"+f)}var h=mt(e.baseURL,e.url);a.open(e.method.toUpperCase(),pt(h,e.params,e.paramsSerializer),!0),a.timeout=e.timeout;function d(){if(!!a){var w="getAllResponseHeaders"in a?vt(a.getAllResponseHeaders()):null,b=!u||u==="text"||u==="json"?a.responseText:a.response,C={data:b,status:a.status,statusText:a.statusText,headers:w,config:e,request:a};ft(n,s,C),a=null}}if("onloadend"in a?a.onloadend=d:a.onreadystatechange=function(){!a||a.readyState!==4||a.status===0&&!(a.responseURL&&a.responseURL.indexOf("file:")===0)||setTimeout(d)},a.onabort=function(){!a||(s(V("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){s(V("Network Error",e,null,a)),a=null},a.ontimeout=function(){var b="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(b=e.timeoutErrorMessage),s(V(b,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",a)),a=null},j.isStandardBrowserEnv()){var c=(e.withCredentials||gt(h))&&e.xsrfCookieName?ht.read(e.xsrfCookieName):void 0;c&&(i[e.xsrfHeaderName]=c)}"setRequestHeader"in a&&j.forEach(i,function(b,C){typeof o=="undefined"&&C.toLowerCase()==="content-type"?delete i[C]:a.setRequestHeader(C,b)}),j.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),u&&u!=="json"&&(a.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&a.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(b){!a||(a.abort(),s(b),a=null)}),o||(o=null),a.send(o)})},p=v,fe=Qe,yt=ue,bt={"Content-Type":"application/x-www-form-urlencoded"};function he(r,e){!p.isUndefined(r)&&p.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function kt(){var r;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(r=de),r}function wt(r,e,t){if(p.isString(r))try{return(e||JSON.parse)(r),p.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var $={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:kt(),transformRequest:[function(e,t){return fe(t,"Accept"),fe(t,"Content-Type"),p.isFormData(e)||p.isArrayBuffer(e)||p.isBuffer(e)||p.isStream(e)||p.isFile(e)||p.isBlob(e)?e:p.isArrayBufferView(e)?e.buffer:p.isURLSearchParams(e)?(he(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):p.isObject(e)||t&&t["Content-Type"]==="application/json"?(he(t,"application/json"),wt(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,o=!n&&this.responseType==="json";if(o||s&&p.isString(e)&&e.length)try{return JSON.parse(e)}catch(i){if(o)throw i.name==="SyntaxError"?yt(i,this,"E_JSON_PARSE"):i}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};$.headers={common:{Accept:"application/json, text/plain, */*"}},p.forEach(["delete","get","head"],function(e){$.headers[e]={}}),p.forEach(["post","put","patch"],function(e){$.headers[e]=p.merge(bt)});var z=$,Et=v,Tt=z,Rt=function(e,t,n){var s=this||Tt;return Et.forEach(n,function(i){e=i.call(s,e,t)}),e},pe=function(e){return!!(e&&e.__CANCEL__)},me=v,K=Rt,St=pe,xt=z;function W(r){r.cancelToken&&r.cancelToken.throwIfRequested()}var Ot=function(e){W(e),e.headers=e.headers||{},e.data=K.call(e,e.data,e.headers,e.transformRequest),e.headers=me.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),me.forEach(["delete","get","head","post","put","patch","common"],function(s){delete e.headers[s]});var t=e.adapter||xt.adapter;return t(e).then(function(s){return W(e),s.data=K.call(e,s.data,s.headers,e.transformResponse),s},function(s){return St(s)||(W(e),s&&s.response&&(s.response.data=K.call(e,s.response.data,s.response.headers,e.transformResponse))),Promise.reject(s)})},m=v,ve=function(e,t){t=t||{};var n={},s=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function a(d,c){return m.isPlainObject(d)&&m.isPlainObject(c)?m.merge(d,c):m.isPlainObject(c)?m.merge({},c):m.isArray(c)?c.slice():c}function l(d){m.isUndefined(t[d])?m.isUndefined(e[d])||(n[d]=a(void 0,e[d])):n[d]=a(e[d],t[d])}m.forEach(s,function(c){m.isUndefined(t[c])||(n[c]=a(void 0,t[c]))}),m.forEach(o,l),m.forEach(i,function(c){m.isUndefined(t[c])?m.isUndefined(e[c])||(n[c]=a(void 0,e[c])):n[c]=a(void 0,t[c])}),m.forEach(u,function(c){c in t?n[c]=a(e[c],t[c]):c in e&&(n[c]=a(void 0,e[c]))});var f=s.concat(o).concat(i).concat(u),h=Object.keys(e).concat(Object.keys(t)).filter(function(c){return f.indexOf(c)===-1});return m.forEach(h,l),n},Ct={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},ge=Ct,X={};["object","boolean","number","function","string","symbol"].forEach(function(r,e){X[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var ye={},At=ge.version.split(".");function be(r,e){for(var t=e?e.split("."):At,n=r.split("."),s=0;s<3;s++){if(t[s]>n[s])return!0;if(t[s]<n[s])return!1}return!1}X.transitional=function(e,t,n){var s=t&&be(t);function o(i,u){return"[Axios v"+ge.version+"] Transitional option '"+i+"'"+u+(n?". "+n:"")}return function(i,u,a){if(e===!1)throw new Error(o(u," has been removed in "+t));return s&&!ye[u]&&(ye[u]=!0,console.warn(o(u," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,u,a):!0}};function Pt(r,e,t){if(typeof r!="object")throw new TypeError("options must be an object");for(var n=Object.keys(r),s=n.length;s-- >0;){var o=n[s],i=e[o];if(i){var u=r[o],a=u===void 0||i(u,o,r);if(a!==!0)throw new TypeError("option "+o+" must be "+a);continue}if(t!==!0)throw Error("Unknown option "+o)}}var _t={isOlderVersion:be,assertOptions:Pt,validators:X},ke=v,jt=ie,we=Ge,Ee=Ot,N=ve,Te=_t,R=Te.validators;function O(r){this.defaults=r,this.interceptors={request:new we,response:new we}}O.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=N(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;t!==void 0&&Te.assertOptions(t,{silentJSONParsing:R.transitional(R.boolean,"1.0.0"),forcedJSONParsing:R.transitional(R.boolean,"1.0.0"),clarifyTimeoutError:R.transitional(R.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(e)===!1||(s=s&&d.synchronous,n.unshift(d.fulfilled,d.rejected))});var o=[];this.interceptors.response.forEach(function(d){o.push(d.fulfilled,d.rejected)});var i;if(!s){var u=[Ee,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(o),i=Promise.resolve(e);u.length;)i=i.then(u.shift(),u.shift());return i}for(var a=e;n.length;){var l=n.shift(),f=n.shift();try{a=l(a)}catch(h){f(h);break}}try{i=Ee(a)}catch(h){return Promise.reject(h)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},O.prototype.getUri=function(e){return e=N(this.defaults,e),jt(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ke.forEach(["delete","get","head","options"],function(e){O.prototype[e]=function(t,n){return this.request(N(n||{},{method:e,url:t,data:(n||{}).data}))}}),ke.forEach(["post","put","patch"],function(e){O.prototype[e]=function(t,n,s){return this.request(N(s||{},{method:e,url:t,data:n}))}});var $t=O;function Y(r){this.message=r}Y.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Y.prototype.__CANCEL__=!0;var Re=Y,Nt=Re;function U(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(s){e=s});var t=this;r(function(s){t.reason||(t.reason=new Nt(s),e(t.reason))})}U.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},U.source=function(){var e,t=new U(function(s){e=s});return{token:t,cancel:e}};var Ut=U,Lt=function(e){return function(n){return e.apply(null,n)}},Bt=function(e){return typeof e=="object"&&e.isAxiosError===!0},Se=v,qt=ne,L=$t,Dt=ve,Mt=z;function xe(r){var e=new L(r),t=qt(L.prototype.request,e);return Se.extend(t,L.prototype,e),Se.extend(t,e),t}var g=xe(Mt);g.Axios=L,g.create=function(e){return xe(Dt(g.defaults,e))},g.Cancel=Re,g.CancelToken=Ut,g.isCancel=pe,g.all=function(e){return Promise.all(e)},g.spread=Lt,g.isAxiosError=Bt,D.exports=g,D.exports.default=g;var It=D.exports;/*!
3
+ * storyblok-js-client v0.0.0-development
4
+ * Universal JavaScript SDK for Storyblok's API
5
+ * (c) 2020-2022 Stobylok Team
6
+ */function Oe(r){return typeof r=="number"&&r==r&&r!==1/0&&r!==-1/0}function Ce(r,e,t){if(!Oe(e))throw new TypeError("Expected `limit` to be a finite number");if(!Oe(t))throw new TypeError("Expected `interval` to be a finite number");var n=[],s=[],o=0,i=function(){o++;var a=setTimeout(function(){o--,n.length>0&&i(),s=s.filter(function(f){return f!==a})},t);s.indexOf(a)<0&&s.push(a);var l=n.shift();l.resolve(r.apply(l.self,l.args))},u=function(){var a=arguments,l=this;return new Promise(function(f,h){n.push({resolve:f,reject:h,args:a,self:l}),o<e&&i()})};return u.abort=function(){s.forEach(clearTimeout),s=[],n.forEach(function(a){a.reject(new throttle.AbortError)}),n.length=0},u}Ce.AbortError=function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"};const Ht=function(r,e){if(!r)return null;let t={};for(let n in r){let s=r[n];e.indexOf(n)>-1&&s!==null&&(t[n]=s)}return t};var Jt={nodes:{horizontal_rule:r=>({singleTag:"hr"}),blockquote:r=>({tag:"blockquote"}),bullet_list:r=>({tag:"ul"}),code_block:r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),hard_break:r=>({singleTag:"br"}),heading:r=>({tag:"h"+r.attrs.level}),image:r=>({singleTag:[{tag:"img",attrs:Ht(r.attrs,["src","alt","title"])}]}),list_item:r=>({tag:"li"}),ordered_list:r=>({tag:"ol"}),paragraph:r=>({tag:"p"})},marks:{bold:()=>({tag:"b"}),strike:()=>({tag:"strike"}),underline:()=>({tag:"u"}),strong:()=>({tag:"strong"}),code:()=>({tag:"code"}),italic:()=>({tag:"i"}),link(r){const e=E({},r.attrs),{linktype:t="url"}=r.attrs;return t==="email"&&(e.href="mailto:"+e.href),e.anchor&&(e.href=`${e.href}#${e.anchor}`,delete e.anchor),{tag:[{tag:"a",attrs:e}]}},styled:r=>({tag:[{tag:"span",attrs:r.attrs}]})}};class Ft{constructor(e){e||(e=Jt),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e={}){if(e.content&&Array.isArray(e.content)){let t="";return e.content.forEach(n=>{t+=this.renderNode(n)}),t}return console.warn("The render method must receive an object with a content field, which is an array"),""}renderNode(e){let t=[];e.marks&&e.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderOpeningTag(o.tag))});const n=this.getMatchingNode(e);return n&&n.tag&&t.push(this.renderOpeningTag(n.tag)),e.content?e.content.forEach(s=>{t.push(this.renderNode(s))}):e.text?t.push(function(s){const o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},i=/[&<>"']/g,u=RegExp(i.source);return s&&u.test(s)?s.replace(i,a=>o[a]):s}(e.text)):n&&n.singleTag?t.push(this.renderTag(n.singleTag," /")):n&&n.html&&t.push(n.html),n&&n.tag&&t.push(this.renderClosingTag(n.tag)),e.marks&&e.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&t.push(this.renderClosingTag(o.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(n=>{if(n.constructor===String)return`<${n}${t}>`;{let s="<"+n.tag;if(n.attrs)for(let o in n.attrs){let i=n.attrs[o];i!==null&&(s+=` ${o}="${i}"`)}return`${s}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){if(typeof this.nodes[e.type]=="function")return this.nodes[e.type](e)}getMatchingMark(e){if(typeof this.marks[e.type]=="function")return this.marks[e.type](e)}}const Vt=(r=0,e=r)=>{const t=Math.abs(e-r)||0,n=r<e?1:-1;return((s=0,o)=>[...Array(s)].map(o))(t,(s,o)=>o*n+r)},G=(r,e,t)=>{const n=[];for(const s in r){if(!Object.prototype.hasOwnProperty.call(r,s))continue;const o=r[s],i=t?"":encodeURIComponent(s);let u;u=typeof o=="object"?G(o,e?e+encodeURIComponent("["+i+"]"):i,Array.isArray(o)):(e?e+encodeURIComponent("["+i+"]"):i)+"="+encodeURIComponent(o),n.push(u)}return n.join("&")};let B={},S={};class zt{constructor(e,t){if(!t){let o=e.region?"-"+e.region:"",i=e.https===!1?"http":"https";t=e.oauthToken===void 0?`${i}://api${o}.storyblok.com/v2`:`${i}://api${o}.storyblok.com/v1`}let n=Object.assign({},e.headers),s=5;e.oauthToken!==void 0&&(n.Authorization=e.oauthToken,s=3),e.rateLimit!==void 0&&(s=e.rateLimit),this.richTextResolver=new Ft(e.richTextSchema),typeof e.componentResolver=="function"&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=Ce(this.throttledRequest,s,1e3),this.accessToken=e.accessToken,this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.client=It.create({baseURL:t,timeout:e.timeout||0,headers:n,proxy:e.proxy||!1}),e.responseInterceptor&&this.client.interceptors.response.use(o=>e.responseInterceptor(o))}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let n="";return t.attrs.body.forEach(s=>{n+=e(s.component,s)}),{html:n}})}parseParams(e={}){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=S[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,t={}){return((n="")=>n.indexOf("/cdn/")>-1)(e)?this.parseParams(t):t}makeRequest(e,t,n,s){const o=this.factoryParamOptions(e,((i={},u=25,a=1)=>q(E({},i),{per_page:u,page:a}))(t,n,s));return this.cacheResponse(e,o)}get(e,t){let n="/"+e;const s=this.factoryParamOptions(n,t);return this.cacheResponse(n,s)}async getAll(e,t={},n){const s=t.per_page||25,o="/"+e,i=o.split("/");n=n||i[i.length-1];const u=await this.makeRequest(o,t,s,1),a=Math.ceil(u.total/s);return((l=[],f)=>l.map(f).reduce((h,d)=>[...h,...d],[]))([u,...await(async(l=[],f)=>Promise.all(l.map(f)))(Vt(1,a),async l=>this.makeRequest(o,t,s,l+1))],l=>Object.values(l.data[n]))}post(e,t){let n="/"+e;return this.throttle("post",n,t)}put(e,t){let n="/"+e;return this.throttle("put",n,t)}delete(e,t){let n="/"+e;return this.throttle("delete",n,t)}getStories(e){return this.get("cdn/stories",e)}getStory(e,t){return this.get("cdn/stories/"+e,t)}setToken(e){this.accessToken=e}getToken(){return this.accessToken}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t){const n=e[t];n&&n.fieldtype=="multilink"&&n.linktype=="story"&&typeof n.id=="string"&&this.links[n.id]?n.story=this._cleanCopy(this.links[n.id]):n&&n.linktype==="story"&&typeof n.uuid=="string"&&this.links[n.uuid]&&(n.story=this._cleanCopy(this.links[n.uuid]))}_insertRelations(e,t,n){if(n.indexOf(e.component+"."+t)>-1){if(typeof e[t]=="string")this.relations[e[t]]&&(e[t]=this._cleanCopy(this.relations[e[t]]));else if(e[t].constructor===Array){let s=[];e[t].forEach(o=>{this.relations[o]&&s.push(this._cleanCopy(this.relations[o]))}),e[t]=s}}}iterateTree(e,t){let n=s=>{if(s!=null){if(s.constructor===Array)for(let o=0;o<s.length;o++)n(s[o]);else if(s.constructor===Object){if(s._stopResolving)return;for(let o in s)(s.component&&s._uid||s.type==="link")&&(this._insertRelations(s,o,t),this._insertLinks(s,o)),n(s[o])}}};n(e.content)}async resolveLinks(e,t){let n=[];if(e.link_uuids){const s=e.link_uuids.length;let o=[];const i=50;for(let u=0;u<s;u+=i){const a=Math.min(s,u+i);o.push(e.link_uuids.slice(u,a))}for(let u=0;u<o.length;u++)(await this.getStories({per_page:i,language:t.language,version:t.version,by_uuids:o[u].join(",")})).data.stories.forEach(a=>{n.push(a)})}else n=e.links;n.forEach(s=>{this.links[s.uuid]=q(E({},s),{_stopResolving:!0})})}async resolveRelations(e,t){let n=[];if(e.rel_uuids){const s=e.rel_uuids.length;let o=[];const i=50;for(let u=0;u<s;u+=i){const a=Math.min(s,u+i);o.push(e.rel_uuids.slice(u,a))}for(let u=0;u<o.length;u++)(await this.getStories({per_page:i,language:t.language,version:t.version,by_uuids:o[u].join(",")})).data.stories.forEach(a=>{n.push(a)})}else n=e.rels;n.forEach(s=>{this.relations[s.uuid]=q(E({},s),{_stopResolving:!0})})}async resolveStories(e,t){let n=[];t.resolve_relations!==void 0&&t.resolve_relations.length>0&&(n=t.resolve_relations.split(","),await this.resolveRelations(e,t)),["1","story","url"].indexOf(t.resolve_links)>-1&&await this.resolveLinks(e,t);for(const s in this.relations)this.iterateTree(this.relations[s],n);e.story?this.iterateTree(e.story,n):e.stories.forEach(s=>{this.iterateTree(s,n)})}cacheResponse(e,t,n){return n===void 0&&(n=0),new Promise(async(s,o)=>{let i=G({url:e,params:t}),u=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const l=await u.get(i);if(l)return s(l)}try{let l=await this.throttle("get",e,{params:t,paramsSerializer:h=>G(h)}),f={data:l.data,headers:l.headers};if(l.headers["per-page"]&&(f=Object.assign({},f,{perPage:parseInt(l.headers["per-page"]),total:parseInt(l.headers.total)})),l.status!=200)return o(l);(f.data.story||f.data.stories)&&await this.resolveStories(f.data,t),t.version==="published"&&e!="/cdn/spaces/me"&&u.set(i,f),f.data.cv&&(t.version=="draft"&&S[t.token]!=f.data.cv&&this.flushCache(),S[t.token]=f.data.cv),s(f)}catch(l){if(l.response&&l.response.status===429&&(n+=1)<this.maxRetries)return console.log(`Hit rate limit. Retrying in ${n} seconds.`),await(a=1e3*n,new Promise(f=>setTimeout(f,a))),this.cacheResponse(e,t,n).then(s).catch(o);o(l)}var a})}throttledRequest(e,t,n){return this.client[e](t,n)}cacheVersions(){return S}cacheVersion(){return S[this.accessToken]}setCacheVersion(e){this.accessToken&&(S[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get:e=>B[e],getAll:()=>B,set(e,t){B[e]=t},flush(){B={}}};default:return{get(){},getAll(){},set(){},flush(){}}}}async flushCache(){return await this.cacheProvider().flush(),this}}var Kt=(r={})=>{const{apiOptions:e}=r;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new zt(e)}},Wt=r=>{if(typeof r!="object"||typeof r._editable=="undefined")return{};const e=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};const Xt=(r,e,t={})=>{if(typeof window!="undefined"){if(typeof window.storyblokRegisterEvent=="undefined"){console.error("Storyblok Bridge is disabled. Please enable it to use it. Read https://github.com/storyblok/storyblok-js");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],s=>{s.action=="input"&&s.story.id===r?e(s.story):window.location.reload()})})}},Yt=(r={})=>{const{bridge:e,accessToken:t,use:n=[],apiOptions:s={}}=r;s.accessToken=s.accessToken||t;const o={bridge:e,apiOptions:s};let i={};return n.forEach(u=>{i=E(E({},i),u(o))}),e!==!1&&$e("https://app.storyblok.com/f/storyblok-v2-latest.js"),i},Gt={beforeMount(r,e){if(e.value){const t=Wt(e.value);r.setAttribute("data-blok-c",t["data-blok-c"]),r.setAttribute("data-blok-uid",t["data-blok-uid"]),r.classList.add("storyblok__outline")}}};let Z=null;const Zt=()=>(Z||console.error(`You can't use useStoryblokApi if you're not loading apiPlugin. Please enable it like in this example:
7
+
8
+ import { StoryblokVue, apiPlugin } from "@storyblok/vue";
9
+ app.use(StoryblokVue, {
10
+ accessToken: "<your-token>",
11
+ use: [apiPlugin], // use it only if you need it
12
+ });
13
+ `),Z),Qt={install(r,e={}){r.directive("editable",Gt);const{storyblokApi:t}=Yt(e);Z=t}};y.StoryblokVue=Qt,y.apiPlugin=Kt,y.useStoryblokApi=Zt,y.useStoryblokBridge=Xt,Object.defineProperty(y,"__esModule",{value:!0}),y[Symbol.toStringTag]="Module"});