@storyblok/vue 5.0.1 → 6.0.2
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 +78 -57
- package/dist/storyblok-vue.js +3 -10
- package/dist/storyblok-vue.mjs +213 -1269
- package/package.json +15 -22
package/dist/storyblok-vue.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,6 +14,26 @@ var __spreadValues = (a2, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a2;
|
|
18
16
|
};
|
|
17
|
+
import { openBlock, createBlock, resolveDynamicComponent, normalizeProps, guardReactiveProps, ref, onMounted } from "vue";
|
|
18
|
+
import t from "axios";
|
|
19
|
+
var __defProp2 = Object.defineProperty;
|
|
20
|
+
var __defProps = Object.defineProperties;
|
|
21
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
22
|
+
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
23
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
24
|
+
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
25
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
26
|
+
var __spreadValues2 = (a2, b) => {
|
|
27
|
+
for (var prop in b || (b = {}))
|
|
28
|
+
if (__hasOwnProp2.call(b, prop))
|
|
29
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
30
|
+
if (__getOwnPropSymbols2)
|
|
31
|
+
for (var prop of __getOwnPropSymbols2(b)) {
|
|
32
|
+
if (__propIsEnum2.call(b, prop))
|
|
33
|
+
__defNormalProp2(a2, prop, b[prop]);
|
|
34
|
+
}
|
|
35
|
+
return a2;
|
|
36
|
+
};
|
|
19
37
|
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
|
|
20
38
|
let loaded = false;
|
|
21
39
|
const callbacks = [];
|
|
@@ -48,1104 +66,15 @@ const loadBridge = (src) => {
|
|
|
48
66
|
document.getElementsByTagName("head")[0].appendChild(script);
|
|
49
67
|
});
|
|
50
68
|
};
|
|
51
|
-
var axios$2 = { exports: {} };
|
|
52
|
-
var bind$2 = function bind(fn, thisArg) {
|
|
53
|
-
return function wrap() {
|
|
54
|
-
var args = new Array(arguments.length);
|
|
55
|
-
for (var i2 = 0; i2 < args.length; i2++) {
|
|
56
|
-
args[i2] = arguments[i2];
|
|
57
|
-
}
|
|
58
|
-
return fn.apply(thisArg, args);
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
var bind$1 = bind$2;
|
|
62
|
-
var toString = Object.prototype.toString;
|
|
63
|
-
function isArray(val) {
|
|
64
|
-
return toString.call(val) === "[object Array]";
|
|
65
|
-
}
|
|
66
|
-
function isUndefined(val) {
|
|
67
|
-
return typeof val === "undefined";
|
|
68
|
-
}
|
|
69
|
-
function isBuffer(val) {
|
|
70
|
-
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
|
|
71
|
-
}
|
|
72
|
-
function isArrayBuffer(val) {
|
|
73
|
-
return toString.call(val) === "[object ArrayBuffer]";
|
|
74
|
-
}
|
|
75
|
-
function isFormData(val) {
|
|
76
|
-
return typeof FormData !== "undefined" && val instanceof FormData;
|
|
77
|
-
}
|
|
78
|
-
function isArrayBufferView(val) {
|
|
79
|
-
var result;
|
|
80
|
-
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
81
|
-
result = ArrayBuffer.isView(val);
|
|
82
|
-
} else {
|
|
83
|
-
result = val && val.buffer && val.buffer instanceof ArrayBuffer;
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
function isString(val) {
|
|
88
|
-
return typeof val === "string";
|
|
89
|
-
}
|
|
90
|
-
function isNumber(val) {
|
|
91
|
-
return typeof val === "number";
|
|
92
|
-
}
|
|
93
|
-
function isObject(val) {
|
|
94
|
-
return val !== null && typeof val === "object";
|
|
95
|
-
}
|
|
96
|
-
function isPlainObject(val) {
|
|
97
|
-
if (toString.call(val) !== "[object Object]") {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
var prototype = Object.getPrototypeOf(val);
|
|
101
|
-
return prototype === null || prototype === Object.prototype;
|
|
102
|
-
}
|
|
103
|
-
function isDate(val) {
|
|
104
|
-
return toString.call(val) === "[object Date]";
|
|
105
|
-
}
|
|
106
|
-
function isFile(val) {
|
|
107
|
-
return toString.call(val) === "[object File]";
|
|
108
|
-
}
|
|
109
|
-
function isBlob(val) {
|
|
110
|
-
return toString.call(val) === "[object Blob]";
|
|
111
|
-
}
|
|
112
|
-
function isFunction(val) {
|
|
113
|
-
return toString.call(val) === "[object Function]";
|
|
114
|
-
}
|
|
115
|
-
function isStream(val) {
|
|
116
|
-
return isObject(val) && isFunction(val.pipe);
|
|
117
|
-
}
|
|
118
|
-
function isURLSearchParams(val) {
|
|
119
|
-
return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
|
|
120
|
-
}
|
|
121
|
-
function trim(str) {
|
|
122
|
-
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
|
123
|
-
}
|
|
124
|
-
function isStandardBrowserEnv() {
|
|
125
|
-
if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
|
126
|
-
return false;
|
|
127
|
-
}
|
|
128
|
-
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
129
|
-
}
|
|
130
|
-
function forEach(obj, fn) {
|
|
131
|
-
if (obj === null || typeof obj === "undefined") {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (typeof obj !== "object") {
|
|
135
|
-
obj = [obj];
|
|
136
|
-
}
|
|
137
|
-
if (isArray(obj)) {
|
|
138
|
-
for (var i2 = 0, l2 = obj.length; i2 < l2; i2++) {
|
|
139
|
-
fn.call(null, obj[i2], i2, obj);
|
|
140
|
-
}
|
|
141
|
-
} else {
|
|
142
|
-
for (var key in obj) {
|
|
143
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
144
|
-
fn.call(null, obj[key], key, obj);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function merge() {
|
|
150
|
-
var result = {};
|
|
151
|
-
function assignValue(val, key) {
|
|
152
|
-
if (isPlainObject(result[key]) && isPlainObject(val)) {
|
|
153
|
-
result[key] = merge(result[key], val);
|
|
154
|
-
} else if (isPlainObject(val)) {
|
|
155
|
-
result[key] = merge({}, val);
|
|
156
|
-
} else if (isArray(val)) {
|
|
157
|
-
result[key] = val.slice();
|
|
158
|
-
} else {
|
|
159
|
-
result[key] = val;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
for (var i2 = 0, l2 = arguments.length; i2 < l2; i2++) {
|
|
163
|
-
forEach(arguments[i2], assignValue);
|
|
164
|
-
}
|
|
165
|
-
return result;
|
|
166
|
-
}
|
|
167
|
-
function extend(a2, b, thisArg) {
|
|
168
|
-
forEach(b, function assignValue(val, key) {
|
|
169
|
-
if (thisArg && typeof val === "function") {
|
|
170
|
-
a2[key] = bind$1(val, thisArg);
|
|
171
|
-
} else {
|
|
172
|
-
a2[key] = val;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
return a2;
|
|
176
|
-
}
|
|
177
|
-
function stripBOM(content) {
|
|
178
|
-
if (content.charCodeAt(0) === 65279) {
|
|
179
|
-
content = content.slice(1);
|
|
180
|
-
}
|
|
181
|
-
return content;
|
|
182
|
-
}
|
|
183
|
-
var utils$d = {
|
|
184
|
-
isArray,
|
|
185
|
-
isArrayBuffer,
|
|
186
|
-
isBuffer,
|
|
187
|
-
isFormData,
|
|
188
|
-
isArrayBufferView,
|
|
189
|
-
isString,
|
|
190
|
-
isNumber,
|
|
191
|
-
isObject,
|
|
192
|
-
isPlainObject,
|
|
193
|
-
isUndefined,
|
|
194
|
-
isDate,
|
|
195
|
-
isFile,
|
|
196
|
-
isBlob,
|
|
197
|
-
isFunction,
|
|
198
|
-
isStream,
|
|
199
|
-
isURLSearchParams,
|
|
200
|
-
isStandardBrowserEnv,
|
|
201
|
-
forEach,
|
|
202
|
-
merge,
|
|
203
|
-
extend,
|
|
204
|
-
trim,
|
|
205
|
-
stripBOM
|
|
206
|
-
};
|
|
207
|
-
var utils$c = utils$d;
|
|
208
|
-
function encode(val) {
|
|
209
|
-
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
210
|
-
}
|
|
211
|
-
var buildURL$2 = function buildURL(url, params, paramsSerializer) {
|
|
212
|
-
if (!params) {
|
|
213
|
-
return url;
|
|
214
|
-
}
|
|
215
|
-
var serializedParams;
|
|
216
|
-
if (paramsSerializer) {
|
|
217
|
-
serializedParams = paramsSerializer(params);
|
|
218
|
-
} else if (utils$c.isURLSearchParams(params)) {
|
|
219
|
-
serializedParams = params.toString();
|
|
220
|
-
} else {
|
|
221
|
-
var parts = [];
|
|
222
|
-
utils$c.forEach(params, function serialize(val, key) {
|
|
223
|
-
if (val === null || typeof val === "undefined") {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
if (utils$c.isArray(val)) {
|
|
227
|
-
key = key + "[]";
|
|
228
|
-
} else {
|
|
229
|
-
val = [val];
|
|
230
|
-
}
|
|
231
|
-
utils$c.forEach(val, function parseValue(v) {
|
|
232
|
-
if (utils$c.isDate(v)) {
|
|
233
|
-
v = v.toISOString();
|
|
234
|
-
} else if (utils$c.isObject(v)) {
|
|
235
|
-
v = JSON.stringify(v);
|
|
236
|
-
}
|
|
237
|
-
parts.push(encode(key) + "=" + encode(v));
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
serializedParams = parts.join("&");
|
|
241
|
-
}
|
|
242
|
-
if (serializedParams) {
|
|
243
|
-
var hashmarkIndex = url.indexOf("#");
|
|
244
|
-
if (hashmarkIndex !== -1) {
|
|
245
|
-
url = url.slice(0, hashmarkIndex);
|
|
246
|
-
}
|
|
247
|
-
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
248
|
-
}
|
|
249
|
-
return url;
|
|
250
|
-
};
|
|
251
|
-
var utils$b = utils$d;
|
|
252
|
-
function InterceptorManager$1() {
|
|
253
|
-
this.handlers = [];
|
|
254
|
-
}
|
|
255
|
-
InterceptorManager$1.prototype.use = function use(fulfilled, rejected, options) {
|
|
256
|
-
this.handlers.push({
|
|
257
|
-
fulfilled,
|
|
258
|
-
rejected,
|
|
259
|
-
synchronous: options ? options.synchronous : false,
|
|
260
|
-
runWhen: options ? options.runWhen : null
|
|
261
|
-
});
|
|
262
|
-
return this.handlers.length - 1;
|
|
263
|
-
};
|
|
264
|
-
InterceptorManager$1.prototype.eject = function eject(id) {
|
|
265
|
-
if (this.handlers[id]) {
|
|
266
|
-
this.handlers[id] = null;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
InterceptorManager$1.prototype.forEach = function forEach2(fn) {
|
|
270
|
-
utils$b.forEach(this.handlers, function forEachHandler(h) {
|
|
271
|
-
if (h !== null) {
|
|
272
|
-
fn(h);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
var InterceptorManager_1 = InterceptorManager$1;
|
|
277
|
-
var utils$a = utils$d;
|
|
278
|
-
var normalizeHeaderName$1 = function normalizeHeaderName(headers, normalizedName) {
|
|
279
|
-
utils$a.forEach(headers, function processHeader(value, name2) {
|
|
280
|
-
if (name2 !== normalizedName && name2.toUpperCase() === normalizedName.toUpperCase()) {
|
|
281
|
-
headers[normalizedName] = value;
|
|
282
|
-
delete headers[name2];
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
var enhanceError$2 = function enhanceError(error, config, code, request2, response) {
|
|
287
|
-
error.config = config;
|
|
288
|
-
if (code) {
|
|
289
|
-
error.code = code;
|
|
290
|
-
}
|
|
291
|
-
error.request = request2;
|
|
292
|
-
error.response = response;
|
|
293
|
-
error.isAxiosError = true;
|
|
294
|
-
error.toJSON = function toJSON() {
|
|
295
|
-
return {
|
|
296
|
-
message: this.message,
|
|
297
|
-
name: this.name,
|
|
298
|
-
description: this.description,
|
|
299
|
-
number: this.number,
|
|
300
|
-
fileName: this.fileName,
|
|
301
|
-
lineNumber: this.lineNumber,
|
|
302
|
-
columnNumber: this.columnNumber,
|
|
303
|
-
stack: this.stack,
|
|
304
|
-
config: this.config,
|
|
305
|
-
code: this.code
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
return error;
|
|
309
|
-
};
|
|
310
|
-
var enhanceError$1 = enhanceError$2;
|
|
311
|
-
var createError$2 = function createError(message, config, code, request2, response) {
|
|
312
|
-
var error = new Error(message);
|
|
313
|
-
return enhanceError$1(error, config, code, request2, response);
|
|
314
|
-
};
|
|
315
|
-
var createError$1 = createError$2;
|
|
316
|
-
var settle$1 = function settle(resolve, reject, response) {
|
|
317
|
-
var validateStatus2 = response.config.validateStatus;
|
|
318
|
-
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
319
|
-
resolve(response);
|
|
320
|
-
} else {
|
|
321
|
-
reject(createError$1("Request failed with status code " + response.status, response.config, null, response.request, response));
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
var utils$9 = utils$d;
|
|
325
|
-
var cookies$1 = utils$9.isStandardBrowserEnv() ? function standardBrowserEnv() {
|
|
326
|
-
return {
|
|
327
|
-
write: function write(name2, value, expires, path, domain, secure) {
|
|
328
|
-
var cookie = [];
|
|
329
|
-
cookie.push(name2 + "=" + encodeURIComponent(value));
|
|
330
|
-
if (utils$9.isNumber(expires)) {
|
|
331
|
-
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
332
|
-
}
|
|
333
|
-
if (utils$9.isString(path)) {
|
|
334
|
-
cookie.push("path=" + path);
|
|
335
|
-
}
|
|
336
|
-
if (utils$9.isString(domain)) {
|
|
337
|
-
cookie.push("domain=" + domain);
|
|
338
|
-
}
|
|
339
|
-
if (secure === true) {
|
|
340
|
-
cookie.push("secure");
|
|
341
|
-
}
|
|
342
|
-
document.cookie = cookie.join("; ");
|
|
343
|
-
},
|
|
344
|
-
read: function read(name2) {
|
|
345
|
-
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name2 + ")=([^;]*)"));
|
|
346
|
-
return match ? decodeURIComponent(match[3]) : null;
|
|
347
|
-
},
|
|
348
|
-
remove: function remove(name2) {
|
|
349
|
-
this.write(name2, "", Date.now() - 864e5);
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
}() : function nonStandardBrowserEnv() {
|
|
353
|
-
return {
|
|
354
|
-
write: function write() {
|
|
355
|
-
},
|
|
356
|
-
read: function read() {
|
|
357
|
-
return null;
|
|
358
|
-
},
|
|
359
|
-
remove: function remove() {
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
}();
|
|
363
|
-
var isAbsoluteURL$1 = function isAbsoluteURL(url) {
|
|
364
|
-
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
365
|
-
};
|
|
366
|
-
var combineURLs$1 = function combineURLs(baseURL, relativeURL) {
|
|
367
|
-
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
368
|
-
};
|
|
369
|
-
var isAbsoluteURL2 = isAbsoluteURL$1;
|
|
370
|
-
var combineURLs2 = combineURLs$1;
|
|
371
|
-
var buildFullPath$1 = function buildFullPath(baseURL, requestedURL) {
|
|
372
|
-
if (baseURL && !isAbsoluteURL2(requestedURL)) {
|
|
373
|
-
return combineURLs2(baseURL, requestedURL);
|
|
374
|
-
}
|
|
375
|
-
return requestedURL;
|
|
376
|
-
};
|
|
377
|
-
var utils$8 = utils$d;
|
|
378
|
-
var ignoreDuplicateOf = [
|
|
379
|
-
"age",
|
|
380
|
-
"authorization",
|
|
381
|
-
"content-length",
|
|
382
|
-
"content-type",
|
|
383
|
-
"etag",
|
|
384
|
-
"expires",
|
|
385
|
-
"from",
|
|
386
|
-
"host",
|
|
387
|
-
"if-modified-since",
|
|
388
|
-
"if-unmodified-since",
|
|
389
|
-
"last-modified",
|
|
390
|
-
"location",
|
|
391
|
-
"max-forwards",
|
|
392
|
-
"proxy-authorization",
|
|
393
|
-
"referer",
|
|
394
|
-
"retry-after",
|
|
395
|
-
"user-agent"
|
|
396
|
-
];
|
|
397
|
-
var parseHeaders$1 = function parseHeaders(headers) {
|
|
398
|
-
var parsed = {};
|
|
399
|
-
var key;
|
|
400
|
-
var val;
|
|
401
|
-
var i2;
|
|
402
|
-
if (!headers) {
|
|
403
|
-
return parsed;
|
|
404
|
-
}
|
|
405
|
-
utils$8.forEach(headers.split("\n"), function parser(line) {
|
|
406
|
-
i2 = line.indexOf(":");
|
|
407
|
-
key = utils$8.trim(line.substr(0, i2)).toLowerCase();
|
|
408
|
-
val = utils$8.trim(line.substr(i2 + 1));
|
|
409
|
-
if (key) {
|
|
410
|
-
if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
if (key === "set-cookie") {
|
|
414
|
-
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
415
|
-
} else {
|
|
416
|
-
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
return parsed;
|
|
421
|
-
};
|
|
422
|
-
var utils$7 = utils$d;
|
|
423
|
-
var isURLSameOrigin$1 = utils$7.isStandardBrowserEnv() ? function standardBrowserEnv2() {
|
|
424
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
425
|
-
var urlParsingNode = document.createElement("a");
|
|
426
|
-
var originURL;
|
|
427
|
-
function resolveURL(url) {
|
|
428
|
-
var href = url;
|
|
429
|
-
if (msie) {
|
|
430
|
-
urlParsingNode.setAttribute("href", href);
|
|
431
|
-
href = urlParsingNode.href;
|
|
432
|
-
}
|
|
433
|
-
urlParsingNode.setAttribute("href", href);
|
|
434
|
-
return {
|
|
435
|
-
href: urlParsingNode.href,
|
|
436
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
437
|
-
host: urlParsingNode.host,
|
|
438
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
439
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
440
|
-
hostname: urlParsingNode.hostname,
|
|
441
|
-
port: urlParsingNode.port,
|
|
442
|
-
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
originURL = resolveURL(window.location.href);
|
|
446
|
-
return function isURLSameOrigin2(requestURL) {
|
|
447
|
-
var parsed = utils$7.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
448
|
-
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
449
|
-
};
|
|
450
|
-
}() : function nonStandardBrowserEnv2() {
|
|
451
|
-
return function isURLSameOrigin2() {
|
|
452
|
-
return true;
|
|
453
|
-
};
|
|
454
|
-
}();
|
|
455
|
-
var utils$6 = utils$d;
|
|
456
|
-
var settle2 = settle$1;
|
|
457
|
-
var cookies = cookies$1;
|
|
458
|
-
var buildURL$1 = buildURL$2;
|
|
459
|
-
var buildFullPath2 = buildFullPath$1;
|
|
460
|
-
var parseHeaders2 = parseHeaders$1;
|
|
461
|
-
var isURLSameOrigin = isURLSameOrigin$1;
|
|
462
|
-
var createError2 = createError$2;
|
|
463
|
-
var xhr = function xhrAdapter(config) {
|
|
464
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
465
|
-
var requestData = config.data;
|
|
466
|
-
var requestHeaders = config.headers;
|
|
467
|
-
var responseType = config.responseType;
|
|
468
|
-
if (utils$6.isFormData(requestData)) {
|
|
469
|
-
delete requestHeaders["Content-Type"];
|
|
470
|
-
}
|
|
471
|
-
var request2 = new XMLHttpRequest();
|
|
472
|
-
if (config.auth) {
|
|
473
|
-
var username = config.auth.username || "";
|
|
474
|
-
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : "";
|
|
475
|
-
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
|
476
|
-
}
|
|
477
|
-
var fullPath = buildFullPath2(config.baseURL, config.url);
|
|
478
|
-
request2.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
|
|
479
|
-
request2.timeout = config.timeout;
|
|
480
|
-
function onloadend() {
|
|
481
|
-
if (!request2) {
|
|
482
|
-
return;
|
|
483
|
-
}
|
|
484
|
-
var responseHeaders = "getAllResponseHeaders" in request2 ? parseHeaders2(request2.getAllResponseHeaders()) : null;
|
|
485
|
-
var responseData = !responseType || responseType === "text" || responseType === "json" ? request2.responseText : request2.response;
|
|
486
|
-
var response = {
|
|
487
|
-
data: responseData,
|
|
488
|
-
status: request2.status,
|
|
489
|
-
statusText: request2.statusText,
|
|
490
|
-
headers: responseHeaders,
|
|
491
|
-
config,
|
|
492
|
-
request: request2
|
|
493
|
-
};
|
|
494
|
-
settle2(resolve, reject, response);
|
|
495
|
-
request2 = null;
|
|
496
|
-
}
|
|
497
|
-
if ("onloadend" in request2) {
|
|
498
|
-
request2.onloadend = onloadend;
|
|
499
|
-
} else {
|
|
500
|
-
request2.onreadystatechange = function handleLoad() {
|
|
501
|
-
if (!request2 || request2.readyState !== 4) {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
if (request2.status === 0 && !(request2.responseURL && request2.responseURL.indexOf("file:") === 0)) {
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
setTimeout(onloadend);
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
request2.onabort = function handleAbort() {
|
|
511
|
-
if (!request2) {
|
|
512
|
-
return;
|
|
513
|
-
}
|
|
514
|
-
reject(createError2("Request aborted", config, "ECONNABORTED", request2));
|
|
515
|
-
request2 = null;
|
|
516
|
-
};
|
|
517
|
-
request2.onerror = function handleError() {
|
|
518
|
-
reject(createError2("Network Error", config, null, request2));
|
|
519
|
-
request2 = null;
|
|
520
|
-
};
|
|
521
|
-
request2.ontimeout = function handleTimeout() {
|
|
522
|
-
var timeoutErrorMessage = "timeout of " + config.timeout + "ms exceeded";
|
|
523
|
-
if (config.timeoutErrorMessage) {
|
|
524
|
-
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
525
|
-
}
|
|
526
|
-
reject(createError2(timeoutErrorMessage, config, config.transitional && config.transitional.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", request2));
|
|
527
|
-
request2 = null;
|
|
528
|
-
};
|
|
529
|
-
if (utils$6.isStandardBrowserEnv()) {
|
|
530
|
-
var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0;
|
|
531
|
-
if (xsrfValue) {
|
|
532
|
-
requestHeaders[config.xsrfHeaderName] = xsrfValue;
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
if ("setRequestHeader" in request2) {
|
|
536
|
-
utils$6.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
537
|
-
if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
|
|
538
|
-
delete requestHeaders[key];
|
|
539
|
-
} else {
|
|
540
|
-
request2.setRequestHeader(key, val);
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
if (!utils$6.isUndefined(config.withCredentials)) {
|
|
545
|
-
request2.withCredentials = !!config.withCredentials;
|
|
546
|
-
}
|
|
547
|
-
if (responseType && responseType !== "json") {
|
|
548
|
-
request2.responseType = config.responseType;
|
|
549
|
-
}
|
|
550
|
-
if (typeof config.onDownloadProgress === "function") {
|
|
551
|
-
request2.addEventListener("progress", config.onDownloadProgress);
|
|
552
|
-
}
|
|
553
|
-
if (typeof config.onUploadProgress === "function" && request2.upload) {
|
|
554
|
-
request2.upload.addEventListener("progress", config.onUploadProgress);
|
|
555
|
-
}
|
|
556
|
-
if (config.cancelToken) {
|
|
557
|
-
config.cancelToken.promise.then(function onCanceled(cancel) {
|
|
558
|
-
if (!request2) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
request2.abort();
|
|
562
|
-
reject(cancel);
|
|
563
|
-
request2 = null;
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
if (!requestData) {
|
|
567
|
-
requestData = null;
|
|
568
|
-
}
|
|
569
|
-
request2.send(requestData);
|
|
570
|
-
});
|
|
571
|
-
};
|
|
572
|
-
var utils$5 = utils$d;
|
|
573
|
-
var normalizeHeaderName2 = normalizeHeaderName$1;
|
|
574
|
-
var enhanceError2 = enhanceError$2;
|
|
575
|
-
var DEFAULT_CONTENT_TYPE = {
|
|
576
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
577
|
-
};
|
|
578
|
-
function setContentTypeIfUnset(headers, value) {
|
|
579
|
-
if (!utils$5.isUndefined(headers) && utils$5.isUndefined(headers["Content-Type"])) {
|
|
580
|
-
headers["Content-Type"] = value;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
function getDefaultAdapter() {
|
|
584
|
-
var adapter;
|
|
585
|
-
if (typeof XMLHttpRequest !== "undefined") {
|
|
586
|
-
adapter = xhr;
|
|
587
|
-
} else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") {
|
|
588
|
-
adapter = xhr;
|
|
589
|
-
}
|
|
590
|
-
return adapter;
|
|
591
|
-
}
|
|
592
|
-
function stringifySafely(rawValue, parser, encoder) {
|
|
593
|
-
if (utils$5.isString(rawValue)) {
|
|
594
|
-
try {
|
|
595
|
-
(parser || JSON.parse)(rawValue);
|
|
596
|
-
return utils$5.trim(rawValue);
|
|
597
|
-
} catch (e2) {
|
|
598
|
-
if (e2.name !== "SyntaxError") {
|
|
599
|
-
throw e2;
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
604
|
-
}
|
|
605
|
-
var defaults$3 = {
|
|
606
|
-
transitional: {
|
|
607
|
-
silentJSONParsing: true,
|
|
608
|
-
forcedJSONParsing: true,
|
|
609
|
-
clarifyTimeoutError: false
|
|
610
|
-
},
|
|
611
|
-
adapter: getDefaultAdapter(),
|
|
612
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
613
|
-
normalizeHeaderName2(headers, "Accept");
|
|
614
|
-
normalizeHeaderName2(headers, "Content-Type");
|
|
615
|
-
if (utils$5.isFormData(data) || utils$5.isArrayBuffer(data) || utils$5.isBuffer(data) || utils$5.isStream(data) || utils$5.isFile(data) || utils$5.isBlob(data)) {
|
|
616
|
-
return data;
|
|
617
|
-
}
|
|
618
|
-
if (utils$5.isArrayBufferView(data)) {
|
|
619
|
-
return data.buffer;
|
|
620
|
-
}
|
|
621
|
-
if (utils$5.isURLSearchParams(data)) {
|
|
622
|
-
setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
|
|
623
|
-
return data.toString();
|
|
624
|
-
}
|
|
625
|
-
if (utils$5.isObject(data) || headers && headers["Content-Type"] === "application/json") {
|
|
626
|
-
setContentTypeIfUnset(headers, "application/json");
|
|
627
|
-
return stringifySafely(data);
|
|
628
|
-
}
|
|
629
|
-
return data;
|
|
630
|
-
}],
|
|
631
|
-
transformResponse: [function transformResponse(data) {
|
|
632
|
-
var transitional2 = this.transitional;
|
|
633
|
-
var silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
634
|
-
var forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
635
|
-
var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
|
|
636
|
-
if (strictJSONParsing || forcedJSONParsing && utils$5.isString(data) && data.length) {
|
|
637
|
-
try {
|
|
638
|
-
return JSON.parse(data);
|
|
639
|
-
} catch (e2) {
|
|
640
|
-
if (strictJSONParsing) {
|
|
641
|
-
if (e2.name === "SyntaxError") {
|
|
642
|
-
throw enhanceError2(e2, this, "E_JSON_PARSE");
|
|
643
|
-
}
|
|
644
|
-
throw e2;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
return data;
|
|
649
|
-
}],
|
|
650
|
-
timeout: 0,
|
|
651
|
-
xsrfCookieName: "XSRF-TOKEN",
|
|
652
|
-
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
653
|
-
maxContentLength: -1,
|
|
654
|
-
maxBodyLength: -1,
|
|
655
|
-
validateStatus: function validateStatus(status) {
|
|
656
|
-
return status >= 200 && status < 300;
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
defaults$3.headers = {
|
|
660
|
-
common: {
|
|
661
|
-
"Accept": "application/json, text/plain, */*"
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
utils$5.forEach(["delete", "get", "head"], function forEachMethodNoData(method) {
|
|
665
|
-
defaults$3.headers[method] = {};
|
|
666
|
-
});
|
|
667
|
-
utils$5.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
668
|
-
defaults$3.headers[method] = utils$5.merge(DEFAULT_CONTENT_TYPE);
|
|
669
|
-
});
|
|
670
|
-
var defaults_1 = defaults$3;
|
|
671
|
-
var utils$4 = utils$d;
|
|
672
|
-
var defaults$2 = defaults_1;
|
|
673
|
-
var transformData$1 = function transformData(data, headers, fns) {
|
|
674
|
-
var context = this || defaults$2;
|
|
675
|
-
utils$4.forEach(fns, function transform(fn) {
|
|
676
|
-
data = fn.call(context, data, headers);
|
|
677
|
-
});
|
|
678
|
-
return data;
|
|
679
|
-
};
|
|
680
|
-
var isCancel$1 = function isCancel(value) {
|
|
681
|
-
return !!(value && value.__CANCEL__);
|
|
682
|
-
};
|
|
683
|
-
var utils$3 = utils$d;
|
|
684
|
-
var transformData2 = transformData$1;
|
|
685
|
-
var isCancel2 = isCancel$1;
|
|
686
|
-
var defaults$1 = defaults_1;
|
|
687
|
-
function throwIfCancellationRequested(config) {
|
|
688
|
-
if (config.cancelToken) {
|
|
689
|
-
config.cancelToken.throwIfRequested();
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
var dispatchRequest$1 = function dispatchRequest(config) {
|
|
693
|
-
throwIfCancellationRequested(config);
|
|
694
|
-
config.headers = config.headers || {};
|
|
695
|
-
config.data = transformData2.call(config, config.data, config.headers, config.transformRequest);
|
|
696
|
-
config.headers = utils$3.merge(config.headers.common || {}, config.headers[config.method] || {}, config.headers);
|
|
697
|
-
utils$3.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function cleanHeaderConfig(method) {
|
|
698
|
-
delete config.headers[method];
|
|
699
|
-
});
|
|
700
|
-
var adapter = config.adapter || defaults$1.adapter;
|
|
701
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
702
|
-
throwIfCancellationRequested(config);
|
|
703
|
-
response.data = transformData2.call(config, response.data, response.headers, config.transformResponse);
|
|
704
|
-
return response;
|
|
705
|
-
}, function onAdapterRejection(reason) {
|
|
706
|
-
if (!isCancel2(reason)) {
|
|
707
|
-
throwIfCancellationRequested(config);
|
|
708
|
-
if (reason && reason.response) {
|
|
709
|
-
reason.response.data = transformData2.call(config, reason.response.data, reason.response.headers, config.transformResponse);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
return Promise.reject(reason);
|
|
713
|
-
});
|
|
714
|
-
};
|
|
715
|
-
var utils$2 = utils$d;
|
|
716
|
-
var mergeConfig$2 = function mergeConfig(config1, config2) {
|
|
717
|
-
config2 = config2 || {};
|
|
718
|
-
var config = {};
|
|
719
|
-
var valueFromConfig2Keys = ["url", "method", "data"];
|
|
720
|
-
var mergeDeepPropertiesKeys = ["headers", "auth", "proxy", "params"];
|
|
721
|
-
var defaultToConfig2Keys = [
|
|
722
|
-
"baseURL",
|
|
723
|
-
"transformRequest",
|
|
724
|
-
"transformResponse",
|
|
725
|
-
"paramsSerializer",
|
|
726
|
-
"timeout",
|
|
727
|
-
"timeoutMessage",
|
|
728
|
-
"withCredentials",
|
|
729
|
-
"adapter",
|
|
730
|
-
"responseType",
|
|
731
|
-
"xsrfCookieName",
|
|
732
|
-
"xsrfHeaderName",
|
|
733
|
-
"onUploadProgress",
|
|
734
|
-
"onDownloadProgress",
|
|
735
|
-
"decompress",
|
|
736
|
-
"maxContentLength",
|
|
737
|
-
"maxBodyLength",
|
|
738
|
-
"maxRedirects",
|
|
739
|
-
"transport",
|
|
740
|
-
"httpAgent",
|
|
741
|
-
"httpsAgent",
|
|
742
|
-
"cancelToken",
|
|
743
|
-
"socketPath",
|
|
744
|
-
"responseEncoding"
|
|
745
|
-
];
|
|
746
|
-
var directMergeKeys = ["validateStatus"];
|
|
747
|
-
function getMergedValue(target, source2) {
|
|
748
|
-
if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source2)) {
|
|
749
|
-
return utils$2.merge(target, source2);
|
|
750
|
-
} else if (utils$2.isPlainObject(source2)) {
|
|
751
|
-
return utils$2.merge({}, source2);
|
|
752
|
-
} else if (utils$2.isArray(source2)) {
|
|
753
|
-
return source2.slice();
|
|
754
|
-
}
|
|
755
|
-
return source2;
|
|
756
|
-
}
|
|
757
|
-
function mergeDeepProperties(prop) {
|
|
758
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
759
|
-
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
760
|
-
} else if (!utils$2.isUndefined(config1[prop])) {
|
|
761
|
-
config[prop] = getMergedValue(void 0, config1[prop]);
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
utils$2.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
|
|
765
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
766
|
-
config[prop] = getMergedValue(void 0, config2[prop]);
|
|
767
|
-
}
|
|
768
|
-
});
|
|
769
|
-
utils$2.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
770
|
-
utils$2.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
|
|
771
|
-
if (!utils$2.isUndefined(config2[prop])) {
|
|
772
|
-
config[prop] = getMergedValue(void 0, config2[prop]);
|
|
773
|
-
} else if (!utils$2.isUndefined(config1[prop])) {
|
|
774
|
-
config[prop] = getMergedValue(void 0, config1[prop]);
|
|
775
|
-
}
|
|
776
|
-
});
|
|
777
|
-
utils$2.forEach(directMergeKeys, function merge2(prop) {
|
|
778
|
-
if (prop in config2) {
|
|
779
|
-
config[prop] = getMergedValue(config1[prop], config2[prop]);
|
|
780
|
-
} else if (prop in config1) {
|
|
781
|
-
config[prop] = getMergedValue(void 0, config1[prop]);
|
|
782
|
-
}
|
|
783
|
-
});
|
|
784
|
-
var axiosKeys = valueFromConfig2Keys.concat(mergeDeepPropertiesKeys).concat(defaultToConfig2Keys).concat(directMergeKeys);
|
|
785
|
-
var otherKeys = Object.keys(config1).concat(Object.keys(config2)).filter(function filterAxiosKeys(key) {
|
|
786
|
-
return axiosKeys.indexOf(key) === -1;
|
|
787
|
-
});
|
|
788
|
-
utils$2.forEach(otherKeys, mergeDeepProperties);
|
|
789
|
-
return config;
|
|
790
|
-
};
|
|
791
|
-
const name = "axios";
|
|
792
|
-
const version = "0.21.4";
|
|
793
|
-
const description = "Promise based HTTP client for the browser and node.js";
|
|
794
|
-
const main = "index.js";
|
|
795
|
-
const scripts = {
|
|
796
|
-
test: "grunt test",
|
|
797
|
-
start: "node ./sandbox/server.js",
|
|
798
|
-
build: "NODE_ENV=production grunt build",
|
|
799
|
-
preversion: "npm test",
|
|
800
|
-
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
|
|
801
|
-
postversion: "git push && git push --tags",
|
|
802
|
-
examples: "node ./examples/server.js",
|
|
803
|
-
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
804
|
-
fix: "eslint --fix lib/**/*.js"
|
|
805
|
-
};
|
|
806
|
-
const repository = {
|
|
807
|
-
type: "git",
|
|
808
|
-
url: "https://github.com/axios/axios.git"
|
|
809
|
-
};
|
|
810
|
-
const keywords = [
|
|
811
|
-
"xhr",
|
|
812
|
-
"http",
|
|
813
|
-
"ajax",
|
|
814
|
-
"promise",
|
|
815
|
-
"node"
|
|
816
|
-
];
|
|
817
|
-
const author = "Matt Zabriskie";
|
|
818
|
-
const license = "MIT";
|
|
819
|
-
const bugs = {
|
|
820
|
-
url: "https://github.com/axios/axios/issues"
|
|
821
|
-
};
|
|
822
|
-
const homepage = "https://axios-http.com";
|
|
823
|
-
const devDependencies = {
|
|
824
|
-
coveralls: "^3.0.0",
|
|
825
|
-
"es6-promise": "^4.2.4",
|
|
826
|
-
grunt: "^1.3.0",
|
|
827
|
-
"grunt-banner": "^0.6.0",
|
|
828
|
-
"grunt-cli": "^1.2.0",
|
|
829
|
-
"grunt-contrib-clean": "^1.1.0",
|
|
830
|
-
"grunt-contrib-watch": "^1.0.0",
|
|
831
|
-
"grunt-eslint": "^23.0.0",
|
|
832
|
-
"grunt-karma": "^4.0.0",
|
|
833
|
-
"grunt-mocha-test": "^0.13.3",
|
|
834
|
-
"grunt-ts": "^6.0.0-beta.19",
|
|
835
|
-
"grunt-webpack": "^4.0.2",
|
|
836
|
-
"istanbul-instrumenter-loader": "^1.0.0",
|
|
837
|
-
"jasmine-core": "^2.4.1",
|
|
838
|
-
karma: "^6.3.2",
|
|
839
|
-
"karma-chrome-launcher": "^3.1.0",
|
|
840
|
-
"karma-firefox-launcher": "^2.1.0",
|
|
841
|
-
"karma-jasmine": "^1.1.1",
|
|
842
|
-
"karma-jasmine-ajax": "^0.1.13",
|
|
843
|
-
"karma-safari-launcher": "^1.0.0",
|
|
844
|
-
"karma-sauce-launcher": "^4.3.6",
|
|
845
|
-
"karma-sinon": "^1.0.5",
|
|
846
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
847
|
-
"karma-webpack": "^4.0.2",
|
|
848
|
-
"load-grunt-tasks": "^3.5.2",
|
|
849
|
-
minimist: "^1.2.0",
|
|
850
|
-
mocha: "^8.2.1",
|
|
851
|
-
sinon: "^4.5.0",
|
|
852
|
-
"terser-webpack-plugin": "^4.2.3",
|
|
853
|
-
typescript: "^4.0.5",
|
|
854
|
-
"url-search-params": "^0.10.0",
|
|
855
|
-
webpack: "^4.44.2",
|
|
856
|
-
"webpack-dev-server": "^3.11.0"
|
|
857
|
-
};
|
|
858
|
-
const browser = {
|
|
859
|
-
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
860
|
-
};
|
|
861
|
-
const jsdelivr = "dist/axios.min.js";
|
|
862
|
-
const unpkg = "dist/axios.min.js";
|
|
863
|
-
const typings = "./index.d.ts";
|
|
864
|
-
const dependencies = {
|
|
865
|
-
"follow-redirects": "^1.14.0"
|
|
866
|
-
};
|
|
867
|
-
const bundlesize = [
|
|
868
|
-
{
|
|
869
|
-
path: "./dist/axios.min.js",
|
|
870
|
-
threshold: "5kB"
|
|
871
|
-
}
|
|
872
|
-
];
|
|
873
|
-
var require$$0 = {
|
|
874
|
-
name,
|
|
875
|
-
version,
|
|
876
|
-
description,
|
|
877
|
-
main,
|
|
878
|
-
scripts,
|
|
879
|
-
repository,
|
|
880
|
-
keywords,
|
|
881
|
-
author,
|
|
882
|
-
license,
|
|
883
|
-
bugs,
|
|
884
|
-
homepage,
|
|
885
|
-
devDependencies,
|
|
886
|
-
browser,
|
|
887
|
-
jsdelivr,
|
|
888
|
-
unpkg,
|
|
889
|
-
typings,
|
|
890
|
-
dependencies,
|
|
891
|
-
bundlesize
|
|
892
|
-
};
|
|
893
|
-
var pkg = require$$0;
|
|
894
|
-
var validators$1 = {};
|
|
895
|
-
["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i2) {
|
|
896
|
-
validators$1[type] = function validator2(thing) {
|
|
897
|
-
return typeof thing === type || "a" + (i2 < 1 ? "n " : " ") + type;
|
|
898
|
-
};
|
|
899
|
-
});
|
|
900
|
-
var deprecatedWarnings = {};
|
|
901
|
-
var currentVerArr = pkg.version.split(".");
|
|
902
|
-
function isOlderVersion(version2, thanVersion) {
|
|
903
|
-
var pkgVersionArr = thanVersion ? thanVersion.split(".") : currentVerArr;
|
|
904
|
-
var destVer = version2.split(".");
|
|
905
|
-
for (var i2 = 0; i2 < 3; i2++) {
|
|
906
|
-
if (pkgVersionArr[i2] > destVer[i2]) {
|
|
907
|
-
return true;
|
|
908
|
-
} else if (pkgVersionArr[i2] < destVer[i2]) {
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
return false;
|
|
913
|
-
}
|
|
914
|
-
validators$1.transitional = function transitional(validator2, version2, message) {
|
|
915
|
-
var isDeprecated = version2 && isOlderVersion(version2);
|
|
916
|
-
function formatMessage(opt, desc) {
|
|
917
|
-
return "[Axios v" + pkg.version + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
918
|
-
}
|
|
919
|
-
return function(value, opt, opts) {
|
|
920
|
-
if (validator2 === false) {
|
|
921
|
-
throw new Error(formatMessage(opt, " has been removed in " + version2));
|
|
922
|
-
}
|
|
923
|
-
if (isDeprecated && !deprecatedWarnings[opt]) {
|
|
924
|
-
deprecatedWarnings[opt] = true;
|
|
925
|
-
console.warn(formatMessage(opt, " has been deprecated since v" + version2 + " and will be removed in the near future"));
|
|
926
|
-
}
|
|
927
|
-
return validator2 ? validator2(value, opt, opts) : true;
|
|
928
|
-
};
|
|
929
|
-
};
|
|
930
|
-
function assertOptions(options, schema, allowUnknown) {
|
|
931
|
-
if (typeof options !== "object") {
|
|
932
|
-
throw new TypeError("options must be an object");
|
|
933
|
-
}
|
|
934
|
-
var keys = Object.keys(options);
|
|
935
|
-
var i2 = keys.length;
|
|
936
|
-
while (i2-- > 0) {
|
|
937
|
-
var opt = keys[i2];
|
|
938
|
-
var validator2 = schema[opt];
|
|
939
|
-
if (validator2) {
|
|
940
|
-
var value = options[opt];
|
|
941
|
-
var result = value === void 0 || validator2(value, opt, options);
|
|
942
|
-
if (result !== true) {
|
|
943
|
-
throw new TypeError("option " + opt + " must be " + result);
|
|
944
|
-
}
|
|
945
|
-
continue;
|
|
946
|
-
}
|
|
947
|
-
if (allowUnknown !== true) {
|
|
948
|
-
throw Error("Unknown option " + opt);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
var validator$1 = {
|
|
953
|
-
isOlderVersion,
|
|
954
|
-
assertOptions,
|
|
955
|
-
validators: validators$1
|
|
956
|
-
};
|
|
957
|
-
var utils$1 = utils$d;
|
|
958
|
-
var buildURL2 = buildURL$2;
|
|
959
|
-
var InterceptorManager = InterceptorManager_1;
|
|
960
|
-
var dispatchRequest2 = dispatchRequest$1;
|
|
961
|
-
var mergeConfig$1 = mergeConfig$2;
|
|
962
|
-
var validator = validator$1;
|
|
963
|
-
var validators = validator.validators;
|
|
964
|
-
function Axios$1(instanceConfig) {
|
|
965
|
-
this.defaults = instanceConfig;
|
|
966
|
-
this.interceptors = {
|
|
967
|
-
request: new InterceptorManager(),
|
|
968
|
-
response: new InterceptorManager()
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
Axios$1.prototype.request = function request(config) {
|
|
972
|
-
if (typeof config === "string") {
|
|
973
|
-
config = arguments[1] || {};
|
|
974
|
-
config.url = arguments[0];
|
|
975
|
-
} else {
|
|
976
|
-
config = config || {};
|
|
977
|
-
}
|
|
978
|
-
config = mergeConfig$1(this.defaults, config);
|
|
979
|
-
if (config.method) {
|
|
980
|
-
config.method = config.method.toLowerCase();
|
|
981
|
-
} else if (this.defaults.method) {
|
|
982
|
-
config.method = this.defaults.method.toLowerCase();
|
|
983
|
-
} else {
|
|
984
|
-
config.method = "get";
|
|
985
|
-
}
|
|
986
|
-
var transitional2 = config.transitional;
|
|
987
|
-
if (transitional2 !== void 0) {
|
|
988
|
-
validator.assertOptions(transitional2, {
|
|
989
|
-
silentJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
|
|
990
|
-
forcedJSONParsing: validators.transitional(validators.boolean, "1.0.0"),
|
|
991
|
-
clarifyTimeoutError: validators.transitional(validators.boolean, "1.0.0")
|
|
992
|
-
}, false);
|
|
993
|
-
}
|
|
994
|
-
var requestInterceptorChain = [];
|
|
995
|
-
var synchronousRequestInterceptors = true;
|
|
996
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
997
|
-
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
1001
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
1002
|
-
});
|
|
1003
|
-
var responseInterceptorChain = [];
|
|
1004
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
1005
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
1006
|
-
});
|
|
1007
|
-
var promise;
|
|
1008
|
-
if (!synchronousRequestInterceptors) {
|
|
1009
|
-
var chain = [dispatchRequest2, void 0];
|
|
1010
|
-
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
1011
|
-
chain = chain.concat(responseInterceptorChain);
|
|
1012
|
-
promise = Promise.resolve(config);
|
|
1013
|
-
while (chain.length) {
|
|
1014
|
-
promise = promise.then(chain.shift(), chain.shift());
|
|
1015
|
-
}
|
|
1016
|
-
return promise;
|
|
1017
|
-
}
|
|
1018
|
-
var newConfig = config;
|
|
1019
|
-
while (requestInterceptorChain.length) {
|
|
1020
|
-
var onFulfilled = requestInterceptorChain.shift();
|
|
1021
|
-
var onRejected = requestInterceptorChain.shift();
|
|
1022
|
-
try {
|
|
1023
|
-
newConfig = onFulfilled(newConfig);
|
|
1024
|
-
} catch (error) {
|
|
1025
|
-
onRejected(error);
|
|
1026
|
-
break;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
try {
|
|
1030
|
-
promise = dispatchRequest2(newConfig);
|
|
1031
|
-
} catch (error) {
|
|
1032
|
-
return Promise.reject(error);
|
|
1033
|
-
}
|
|
1034
|
-
while (responseInterceptorChain.length) {
|
|
1035
|
-
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
1036
|
-
}
|
|
1037
|
-
return promise;
|
|
1038
|
-
};
|
|
1039
|
-
Axios$1.prototype.getUri = function getUri(config) {
|
|
1040
|
-
config = mergeConfig$1(this.defaults, config);
|
|
1041
|
-
return buildURL2(config.url, config.params, config.paramsSerializer).replace(/^\?/, "");
|
|
1042
|
-
};
|
|
1043
|
-
utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
1044
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
1045
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
1046
|
-
method,
|
|
1047
|
-
url,
|
|
1048
|
-
data: (config || {}).data
|
|
1049
|
-
}));
|
|
1050
|
-
};
|
|
1051
|
-
});
|
|
1052
|
-
utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
1053
|
-
Axios$1.prototype[method] = function(url, data, config) {
|
|
1054
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
1055
|
-
method,
|
|
1056
|
-
url,
|
|
1057
|
-
data
|
|
1058
|
-
}));
|
|
1059
|
-
};
|
|
1060
|
-
});
|
|
1061
|
-
var Axios_1 = Axios$1;
|
|
1062
|
-
function Cancel$1(message) {
|
|
1063
|
-
this.message = message;
|
|
1064
|
-
}
|
|
1065
|
-
Cancel$1.prototype.toString = function toString2() {
|
|
1066
|
-
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
1067
|
-
};
|
|
1068
|
-
Cancel$1.prototype.__CANCEL__ = true;
|
|
1069
|
-
var Cancel_1 = Cancel$1;
|
|
1070
|
-
var Cancel = Cancel_1;
|
|
1071
|
-
function CancelToken(executor) {
|
|
1072
|
-
if (typeof executor !== "function") {
|
|
1073
|
-
throw new TypeError("executor must be a function.");
|
|
1074
|
-
}
|
|
1075
|
-
var resolvePromise;
|
|
1076
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
1077
|
-
resolvePromise = resolve;
|
|
1078
|
-
});
|
|
1079
|
-
var token = this;
|
|
1080
|
-
executor(function cancel(message) {
|
|
1081
|
-
if (token.reason) {
|
|
1082
|
-
return;
|
|
1083
|
-
}
|
|
1084
|
-
token.reason = new Cancel(message);
|
|
1085
|
-
resolvePromise(token.reason);
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
1089
|
-
if (this.reason) {
|
|
1090
|
-
throw this.reason;
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
CancelToken.source = function source() {
|
|
1094
|
-
var cancel;
|
|
1095
|
-
var token = new CancelToken(function executor(c2) {
|
|
1096
|
-
cancel = c2;
|
|
1097
|
-
});
|
|
1098
|
-
return {
|
|
1099
|
-
token,
|
|
1100
|
-
cancel
|
|
1101
|
-
};
|
|
1102
|
-
};
|
|
1103
|
-
var CancelToken_1 = CancelToken;
|
|
1104
|
-
var spread = function spread2(callback) {
|
|
1105
|
-
return function wrap(arr) {
|
|
1106
|
-
return callback.apply(null, arr);
|
|
1107
|
-
};
|
|
1108
|
-
};
|
|
1109
|
-
var isAxiosError = function isAxiosError2(payload) {
|
|
1110
|
-
return typeof payload === "object" && payload.isAxiosError === true;
|
|
1111
|
-
};
|
|
1112
|
-
var utils = utils$d;
|
|
1113
|
-
var bind2 = bind$2;
|
|
1114
|
-
var Axios = Axios_1;
|
|
1115
|
-
var mergeConfig2 = mergeConfig$2;
|
|
1116
|
-
var defaults = defaults_1;
|
|
1117
|
-
function createInstance(defaultConfig) {
|
|
1118
|
-
var context = new Axios(defaultConfig);
|
|
1119
|
-
var instance = bind2(Axios.prototype.request, context);
|
|
1120
|
-
utils.extend(instance, Axios.prototype, context);
|
|
1121
|
-
utils.extend(instance, context);
|
|
1122
|
-
return instance;
|
|
1123
|
-
}
|
|
1124
|
-
var axios$1 = createInstance(defaults);
|
|
1125
|
-
axios$1.Axios = Axios;
|
|
1126
|
-
axios$1.create = function create(instanceConfig) {
|
|
1127
|
-
return createInstance(mergeConfig2(axios$1.defaults, instanceConfig));
|
|
1128
|
-
};
|
|
1129
|
-
axios$1.Cancel = Cancel_1;
|
|
1130
|
-
axios$1.CancelToken = CancelToken_1;
|
|
1131
|
-
axios$1.isCancel = isCancel$1;
|
|
1132
|
-
axios$1.all = function all(promises) {
|
|
1133
|
-
return Promise.all(promises);
|
|
1134
|
-
};
|
|
1135
|
-
axios$1.spread = spread;
|
|
1136
|
-
axios$1.isAxiosError = isAxiosError;
|
|
1137
|
-
axios$2.exports = axios$1;
|
|
1138
|
-
axios$2.exports.default = axios$1;
|
|
1139
|
-
var axios = axios$2.exports;
|
|
1140
69
|
/*!
|
|
1141
70
|
* storyblok-js-client v0.0.0-development
|
|
1142
71
|
* Universal JavaScript SDK for Storyblok's API
|
|
1143
72
|
* (c) 2020-2022 Stobylok Team
|
|
1144
73
|
*/
|
|
1145
|
-
function e(
|
|
1146
|
-
return typeof
|
|
74
|
+
function e(t2) {
|
|
75
|
+
return typeof t2 == "number" && (t2 == t2 && t2 !== 1 / 0 && t2 !== -1 / 0);
|
|
1147
76
|
}
|
|
1148
|
-
function r(
|
|
77
|
+
function r(t2, r2, s2) {
|
|
1149
78
|
if (!e(r2))
|
|
1150
79
|
throw new TypeError("Expected `limit` to be a finite number");
|
|
1151
80
|
if (!e(s2))
|
|
@@ -1153,121 +82,121 @@ function r(t, r2, s2) {
|
|
|
1153
82
|
var n2 = [], i2 = [], o2 = 0, a2 = function() {
|
|
1154
83
|
o2++;
|
|
1155
84
|
var e2 = setTimeout(function() {
|
|
1156
|
-
o2--, n2.length > 0 && a2(), i2 = i2.filter(function(
|
|
1157
|
-
return
|
|
85
|
+
o2--, n2.length > 0 && a2(), i2 = i2.filter(function(t3) {
|
|
86
|
+
return t3 !== e2;
|
|
1158
87
|
});
|
|
1159
88
|
}, s2);
|
|
1160
89
|
i2.indexOf(e2) < 0 && i2.push(e2);
|
|
1161
90
|
var r3 = n2.shift();
|
|
1162
|
-
r3.resolve(
|
|
91
|
+
r3.resolve(t2.apply(r3.self, r3.args));
|
|
1163
92
|
}, l2 = function() {
|
|
1164
|
-
var
|
|
93
|
+
var t3 = arguments, e2 = this;
|
|
1165
94
|
return new Promise(function(s3, i3) {
|
|
1166
|
-
n2.push({ resolve: s3, reject: i3, args:
|
|
95
|
+
n2.push({ resolve: s3, reject: i3, args: t3, self: e2 }), o2 < r2 && a2();
|
|
1167
96
|
});
|
|
1168
97
|
};
|
|
1169
98
|
return l2.abort = function() {
|
|
1170
|
-
i2.forEach(clearTimeout), i2 = [], n2.forEach(function(
|
|
1171
|
-
|
|
99
|
+
i2.forEach(clearTimeout), i2 = [], n2.forEach(function(t3) {
|
|
100
|
+
t3.reject(new throttle.AbortError());
|
|
1172
101
|
}), n2.length = 0;
|
|
1173
102
|
}, l2;
|
|
1174
103
|
}
|
|
1175
104
|
r.AbortError = function() {
|
|
1176
105
|
Error.call(this, "Throttled function aborted"), this.name = "AbortError";
|
|
1177
106
|
};
|
|
1178
|
-
const s = function(
|
|
1179
|
-
if (!
|
|
107
|
+
const s = function(t2, e2) {
|
|
108
|
+
if (!t2)
|
|
1180
109
|
return null;
|
|
1181
110
|
let r2 = {};
|
|
1182
|
-
for (let s2 in
|
|
1183
|
-
let n2 =
|
|
111
|
+
for (let s2 in t2) {
|
|
112
|
+
let n2 = t2[s2];
|
|
1184
113
|
e2.indexOf(s2) > -1 && n2 !== null && (r2[s2] = n2);
|
|
1185
114
|
}
|
|
1186
115
|
return r2;
|
|
1187
116
|
};
|
|
1188
|
-
var n = { nodes: { horizontal_rule: (
|
|
1189
|
-
const e2 =
|
|
117
|
+
var n = { nodes: { horizontal_rule: (t2) => ({ singleTag: "hr" }), blockquote: (t2) => ({ tag: "blockquote" }), bullet_list: (t2) => ({ tag: "ul" }), code_block: (t2) => ({ tag: ["pre", { tag: "code", attrs: t2.attrs }] }), hard_break: (t2) => ({ singleTag: "br" }), heading: (t2) => ({ tag: "h" + t2.attrs.level }), image: (t2) => ({ singleTag: [{ tag: "img", attrs: s(t2.attrs, ["src", "alt", "title"]) }] }), list_item: (t2) => ({ tag: "li" }), ordered_list: (t2) => ({ tag: "ol" }), paragraph: (t2) => ({ tag: "p" }) }, marks: { bold: () => ({ tag: "b" }), strike: () => ({ tag: "strike" }), underline: () => ({ tag: "u" }), strong: () => ({ tag: "strong" }), code: () => ({ tag: "code" }), italic: () => ({ tag: "i" }), link(t2) {
|
|
118
|
+
const e2 = __spreadValues2({}, t2.attrs), { linktype: r2 = "url" } = t2.attrs;
|
|
1190
119
|
return r2 === "email" && (e2.href = "mailto:" + e2.href), e2.anchor && (e2.href = `${e2.href}#${e2.anchor}`, delete e2.anchor), { tag: [{ tag: "a", attrs: e2 }] };
|
|
1191
|
-
}, styled: (
|
|
120
|
+
}, styled: (t2) => ({ tag: [{ tag: "span", attrs: t2.attrs }] }) } };
|
|
1192
121
|
class i {
|
|
1193
|
-
constructor(
|
|
1194
|
-
|
|
122
|
+
constructor(t2) {
|
|
123
|
+
t2 || (t2 = n), this.marks = t2.marks || [], this.nodes = t2.nodes || [];
|
|
1195
124
|
}
|
|
1196
|
-
addNode(
|
|
1197
|
-
this.nodes[
|
|
125
|
+
addNode(t2, e2) {
|
|
126
|
+
this.nodes[t2] = e2;
|
|
1198
127
|
}
|
|
1199
|
-
addMark(
|
|
1200
|
-
this.marks[
|
|
128
|
+
addMark(t2, e2) {
|
|
129
|
+
this.marks[t2] = e2;
|
|
1201
130
|
}
|
|
1202
|
-
render(
|
|
1203
|
-
if (
|
|
131
|
+
render(t2 = {}) {
|
|
132
|
+
if (t2.content && Array.isArray(t2.content)) {
|
|
1204
133
|
let e2 = "";
|
|
1205
|
-
return
|
|
1206
|
-
e2 += this.renderNode(
|
|
134
|
+
return t2.content.forEach((t3) => {
|
|
135
|
+
e2 += this.renderNode(t3);
|
|
1207
136
|
}), e2;
|
|
1208
137
|
}
|
|
1209
138
|
return console.warn("The render method must receive an object with a content field, which is an array"), "";
|
|
1210
139
|
}
|
|
1211
|
-
renderNode(
|
|
140
|
+
renderNode(t2) {
|
|
1212
141
|
let e2 = [];
|
|
1213
|
-
|
|
1214
|
-
const r3 = this.getMatchingMark(
|
|
142
|
+
t2.marks && t2.marks.forEach((t3) => {
|
|
143
|
+
const r3 = this.getMatchingMark(t3);
|
|
1215
144
|
r3 && e2.push(this.renderOpeningTag(r3.tag));
|
|
1216
145
|
});
|
|
1217
|
-
const r2 = this.getMatchingNode(
|
|
1218
|
-
return r2 && r2.tag && e2.push(this.renderOpeningTag(r2.tag)),
|
|
1219
|
-
e2.push(this.renderNode(
|
|
1220
|
-
}) :
|
|
146
|
+
const r2 = this.getMatchingNode(t2);
|
|
147
|
+
return r2 && r2.tag && e2.push(this.renderOpeningTag(r2.tag)), t2.content ? t2.content.forEach((t3) => {
|
|
148
|
+
e2.push(this.renderNode(t3));
|
|
149
|
+
}) : t2.text ? e2.push(function(t3) {
|
|
1221
150
|
const e3 = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, r3 = /[&<>"']/g, s2 = RegExp(r3.source);
|
|
1222
|
-
return
|
|
1223
|
-
}(
|
|
1224
|
-
const r3 = this.getMatchingMark(
|
|
151
|
+
return t3 && s2.test(t3) ? t3.replace(r3, (t4) => e3[t4]) : t3;
|
|
152
|
+
}(t2.text)) : r2 && r2.singleTag ? e2.push(this.renderTag(r2.singleTag, " /")) : r2 && r2.html && e2.push(r2.html), r2 && r2.tag && e2.push(this.renderClosingTag(r2.tag)), t2.marks && t2.marks.slice(0).reverse().forEach((t3) => {
|
|
153
|
+
const r3 = this.getMatchingMark(t3);
|
|
1225
154
|
r3 && e2.push(this.renderClosingTag(r3.tag));
|
|
1226
155
|
}), e2.join("");
|
|
1227
156
|
}
|
|
1228
|
-
renderTag(
|
|
1229
|
-
if (
|
|
1230
|
-
return `<${
|
|
1231
|
-
return
|
|
1232
|
-
if (
|
|
1233
|
-
return `<${
|
|
157
|
+
renderTag(t2, e2) {
|
|
158
|
+
if (t2.constructor === String)
|
|
159
|
+
return `<${t2}${e2}>`;
|
|
160
|
+
return t2.map((t3) => {
|
|
161
|
+
if (t3.constructor === String)
|
|
162
|
+
return `<${t3}${e2}>`;
|
|
1234
163
|
{
|
|
1235
|
-
let r2 = "<" +
|
|
1236
|
-
if (
|
|
1237
|
-
for (let e3 in
|
|
1238
|
-
let s2 =
|
|
164
|
+
let r2 = "<" + t3.tag;
|
|
165
|
+
if (t3.attrs)
|
|
166
|
+
for (let e3 in t3.attrs) {
|
|
167
|
+
let s2 = t3.attrs[e3];
|
|
1239
168
|
s2 !== null && (r2 += ` ${e3}="${s2}"`);
|
|
1240
169
|
}
|
|
1241
170
|
return `${r2}${e2}>`;
|
|
1242
171
|
}
|
|
1243
172
|
}).join("");
|
|
1244
173
|
}
|
|
1245
|
-
renderOpeningTag(
|
|
1246
|
-
return this.renderTag(
|
|
174
|
+
renderOpeningTag(t2) {
|
|
175
|
+
return this.renderTag(t2, "");
|
|
1247
176
|
}
|
|
1248
|
-
renderClosingTag(
|
|
1249
|
-
if (
|
|
1250
|
-
return `</${
|
|
1251
|
-
return
|
|
177
|
+
renderClosingTag(t2) {
|
|
178
|
+
if (t2.constructor === String)
|
|
179
|
+
return `</${t2}>`;
|
|
180
|
+
return t2.slice(0).reverse().map((t3) => t3.constructor === String ? `</${t3}>` : `</${t3.tag}>`).join("");
|
|
1252
181
|
}
|
|
1253
|
-
getMatchingNode(
|
|
1254
|
-
if (typeof this.nodes[
|
|
1255
|
-
return this.nodes[
|
|
182
|
+
getMatchingNode(t2) {
|
|
183
|
+
if (typeof this.nodes[t2.type] == "function")
|
|
184
|
+
return this.nodes[t2.type](t2);
|
|
1256
185
|
}
|
|
1257
|
-
getMatchingMark(
|
|
1258
|
-
if (typeof this.marks[
|
|
1259
|
-
return this.marks[
|
|
186
|
+
getMatchingMark(t2) {
|
|
187
|
+
if (typeof this.marks[t2.type] == "function")
|
|
188
|
+
return this.marks[t2.type](t2);
|
|
1260
189
|
}
|
|
1261
190
|
}
|
|
1262
|
-
const o = (
|
|
1263
|
-
const r2 = Math.abs(e2 -
|
|
1264
|
-
return ((
|
|
1265
|
-
}, a = (
|
|
191
|
+
const o = (t2 = 0, e2 = t2) => {
|
|
192
|
+
const r2 = Math.abs(e2 - t2) || 0, s2 = t2 < e2 ? 1 : -1;
|
|
193
|
+
return ((t3 = 0, e3) => [...Array(t3)].map(e3))(r2, (e3, r3) => r3 * s2 + t2);
|
|
194
|
+
}, a = (t2, e2, r2) => {
|
|
1266
195
|
const s2 = [];
|
|
1267
|
-
for (const n2 in
|
|
1268
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
196
|
+
for (const n2 in t2) {
|
|
197
|
+
if (!Object.prototype.hasOwnProperty.call(t2, n2))
|
|
1269
198
|
continue;
|
|
1270
|
-
const i2 =
|
|
199
|
+
const i2 = t2[n2], o2 = r2 ? "" : encodeURIComponent(n2);
|
|
1271
200
|
let l2;
|
|
1272
201
|
l2 = typeof i2 == "object" ? a(i2, e2 ? e2 + encodeURIComponent("[" + o2 + "]") : o2, Array.isArray(i2)) : (e2 ? e2 + encodeURIComponent("[" + o2 + "]") : o2) + "=" + encodeURIComponent(i2), s2.push(l2);
|
|
1273
202
|
}
|
|
@@ -1277,174 +206,174 @@ let l = {}, c = {};
|
|
|
1277
206
|
class StoryblokClient {
|
|
1278
207
|
constructor(e2, s2) {
|
|
1279
208
|
if (!s2) {
|
|
1280
|
-
let
|
|
1281
|
-
s2 = e2.oauthToken === void 0 ? `${r2}://api${
|
|
209
|
+
let t2 = e2.region ? "-" + e2.region : "", r2 = e2.https === false ? "http" : "https";
|
|
210
|
+
s2 = e2.oauthToken === void 0 ? `${r2}://api${t2}.storyblok.com/v2` : `${r2}://api${t2}.storyblok.com/v1`;
|
|
1282
211
|
}
|
|
1283
212
|
let n2 = Object.assign({}, e2.headers), o2 = 5;
|
|
1284
|
-
e2.oauthToken !== void 0 && (n2.Authorization = e2.oauthToken, o2 = 3), e2.rateLimit !== void 0 && (o2 = e2.rateLimit), this.richTextResolver = new i(e2.richTextSchema), typeof e2.componentResolver == "function" && this.setComponentResolver(e2.componentResolver), this.maxRetries = e2.maxRetries || 5, this.throttle = r(this.throttledRequest, o2, 1e3), this.accessToken = e2.accessToken, this.relations = {}, this.links = {}, this.cache = e2.cache || { clear: "manual" }, this.client =
|
|
213
|
+
e2.oauthToken !== void 0 && (n2.Authorization = e2.oauthToken, o2 = 3), e2.rateLimit !== void 0 && (o2 = e2.rateLimit), this.richTextResolver = new i(e2.richTextSchema), typeof e2.componentResolver == "function" && this.setComponentResolver(e2.componentResolver), this.maxRetries = e2.maxRetries || 5, this.throttle = r(this.throttledRequest, o2, 1e3), this.accessToken = e2.accessToken, this.relations = {}, this.links = {}, this.cache = e2.cache || { clear: "manual" }, this.client = t.create({ baseURL: s2, timeout: e2.timeout || 0, headers: n2, proxy: e2.proxy || false }), e2.responseInterceptor && this.client.interceptors.response.use((t2) => e2.responseInterceptor(t2));
|
|
1285
214
|
}
|
|
1286
|
-
setComponentResolver(
|
|
215
|
+
setComponentResolver(t2) {
|
|
1287
216
|
this.richTextResolver.addNode("blok", (e2) => {
|
|
1288
217
|
let r2 = "";
|
|
1289
218
|
return e2.attrs.body.forEach((e3) => {
|
|
1290
|
-
r2 +=
|
|
219
|
+
r2 += t2(e3.component, e3);
|
|
1291
220
|
}), { html: r2 };
|
|
1292
221
|
});
|
|
1293
222
|
}
|
|
1294
|
-
parseParams(
|
|
1295
|
-
return
|
|
223
|
+
parseParams(t2 = {}) {
|
|
224
|
+
return t2.version || (t2.version = "published"), t2.token || (t2.token = this.getToken()), t2.cv || (t2.cv = c[t2.token]), Array.isArray(t2.resolve_relations) && (t2.resolve_relations = t2.resolve_relations.join(",")), t2;
|
|
1296
225
|
}
|
|
1297
|
-
factoryParamOptions(
|
|
1298
|
-
return ((
|
|
226
|
+
factoryParamOptions(t2, e2 = {}) {
|
|
227
|
+
return ((t3 = "") => t3.indexOf("/cdn/") > -1)(t2) ? this.parseParams(e2) : e2;
|
|
1299
228
|
}
|
|
1300
|
-
makeRequest(
|
|
1301
|
-
const n2 = this.factoryParamOptions(
|
|
1302
|
-
return this.cacheResponse(
|
|
229
|
+
makeRequest(t2, e2, r2, s2) {
|
|
230
|
+
const n2 = this.factoryParamOptions(t2, ((t3 = {}, e3 = 25, r3 = 1) => __spreadProps(__spreadValues2({}, t3), { per_page: e3, page: r3 }))(e2, r2, s2));
|
|
231
|
+
return this.cacheResponse(t2, n2);
|
|
1303
232
|
}
|
|
1304
|
-
get(
|
|
1305
|
-
let r2 = "/" +
|
|
233
|
+
get(t2, e2) {
|
|
234
|
+
let r2 = "/" + t2;
|
|
1306
235
|
const s2 = this.factoryParamOptions(r2, e2);
|
|
1307
236
|
return this.cacheResponse(r2, s2);
|
|
1308
237
|
}
|
|
1309
|
-
async getAll(
|
|
1310
|
-
const s2 = e2.per_page || 25, n2 = "/" +
|
|
238
|
+
async getAll(t2, e2 = {}, r2) {
|
|
239
|
+
const s2 = e2.per_page || 25, n2 = "/" + t2, i2 = n2.split("/");
|
|
1311
240
|
r2 = r2 || i2[i2.length - 1];
|
|
1312
241
|
const a2 = await this.makeRequest(n2, e2, s2, 1), l2 = Math.ceil(a2.total / s2);
|
|
1313
|
-
return ((
|
|
242
|
+
return ((t3 = [], e3) => t3.map(e3).reduce((t4, e4) => [...t4, ...e4], []))([a2, ...await (async (t3 = [], e3) => Promise.all(t3.map(e3)))(o(1, l2), async (t3) => this.makeRequest(n2, e2, s2, t3 + 1))], (t3) => Object.values(t3.data[r2]));
|
|
1314
243
|
}
|
|
1315
|
-
post(
|
|
1316
|
-
let r2 = "/" +
|
|
244
|
+
post(t2, e2) {
|
|
245
|
+
let r2 = "/" + t2;
|
|
1317
246
|
return this.throttle("post", r2, e2);
|
|
1318
247
|
}
|
|
1319
|
-
put(
|
|
1320
|
-
let r2 = "/" +
|
|
248
|
+
put(t2, e2) {
|
|
249
|
+
let r2 = "/" + t2;
|
|
1321
250
|
return this.throttle("put", r2, e2);
|
|
1322
251
|
}
|
|
1323
|
-
delete(
|
|
1324
|
-
let r2 = "/" +
|
|
252
|
+
delete(t2, e2) {
|
|
253
|
+
let r2 = "/" + t2;
|
|
1325
254
|
return this.throttle("delete", r2, e2);
|
|
1326
255
|
}
|
|
1327
|
-
getStories(
|
|
1328
|
-
return this.get("cdn/stories",
|
|
256
|
+
getStories(t2) {
|
|
257
|
+
return this.get("cdn/stories", t2);
|
|
1329
258
|
}
|
|
1330
|
-
getStory(
|
|
1331
|
-
return this.get("cdn/stories/" +
|
|
259
|
+
getStory(t2, e2) {
|
|
260
|
+
return this.get("cdn/stories/" + t2, e2);
|
|
1332
261
|
}
|
|
1333
|
-
setToken(
|
|
1334
|
-
this.accessToken =
|
|
262
|
+
setToken(t2) {
|
|
263
|
+
this.accessToken = t2;
|
|
1335
264
|
}
|
|
1336
265
|
getToken() {
|
|
1337
266
|
return this.accessToken;
|
|
1338
267
|
}
|
|
1339
|
-
_cleanCopy(
|
|
1340
|
-
return JSON.parse(JSON.stringify(
|
|
268
|
+
_cleanCopy(t2) {
|
|
269
|
+
return JSON.parse(JSON.stringify(t2));
|
|
1341
270
|
}
|
|
1342
|
-
_insertLinks(
|
|
1343
|
-
const r2 =
|
|
271
|
+
_insertLinks(t2, e2) {
|
|
272
|
+
const r2 = t2[e2];
|
|
1344
273
|
r2 && r2.fieldtype == "multilink" && r2.linktype == "story" && typeof r2.id == "string" && this.links[r2.id] ? r2.story = this._cleanCopy(this.links[r2.id]) : r2 && r2.linktype === "story" && typeof r2.uuid == "string" && this.links[r2.uuid] && (r2.story = this._cleanCopy(this.links[r2.uuid]));
|
|
1345
274
|
}
|
|
1346
|
-
_insertRelations(
|
|
1347
|
-
if (r2.indexOf(
|
|
1348
|
-
if (typeof
|
|
1349
|
-
this.relations[
|
|
1350
|
-
else if (
|
|
275
|
+
_insertRelations(t2, e2, r2) {
|
|
276
|
+
if (r2.indexOf(t2.component + "." + e2) > -1) {
|
|
277
|
+
if (typeof t2[e2] == "string")
|
|
278
|
+
this.relations[t2[e2]] && (t2[e2] = this._cleanCopy(this.relations[t2[e2]]));
|
|
279
|
+
else if (t2[e2].constructor === Array) {
|
|
1351
280
|
let r3 = [];
|
|
1352
|
-
|
|
1353
|
-
this.relations[
|
|
1354
|
-
}),
|
|
281
|
+
t2[e2].forEach((t3) => {
|
|
282
|
+
this.relations[t3] && r3.push(this._cleanCopy(this.relations[t3]));
|
|
283
|
+
}), t2[e2] = r3;
|
|
1355
284
|
}
|
|
1356
285
|
}
|
|
1357
286
|
}
|
|
1358
|
-
iterateTree(
|
|
1359
|
-
let r2 = (
|
|
1360
|
-
if (
|
|
1361
|
-
if (
|
|
1362
|
-
for (let e3 = 0; e3 <
|
|
1363
|
-
r2(
|
|
1364
|
-
else if (
|
|
1365
|
-
if (
|
|
287
|
+
iterateTree(t2, e2) {
|
|
288
|
+
let r2 = (t3) => {
|
|
289
|
+
if (t3 != null) {
|
|
290
|
+
if (t3.constructor === Array)
|
|
291
|
+
for (let e3 = 0; e3 < t3.length; e3++)
|
|
292
|
+
r2(t3[e3]);
|
|
293
|
+
else if (t3.constructor === Object) {
|
|
294
|
+
if (t3._stopResolving)
|
|
1366
295
|
return;
|
|
1367
|
-
for (let s2 in
|
|
1368
|
-
(
|
|
296
|
+
for (let s2 in t3)
|
|
297
|
+
(t3.component && t3._uid || t3.type === "link") && (this._insertRelations(t3, s2, e2), this._insertLinks(t3, s2)), r2(t3[s2]);
|
|
1369
298
|
}
|
|
1370
299
|
}
|
|
1371
300
|
};
|
|
1372
|
-
r2(
|
|
301
|
+
r2(t2.content);
|
|
1373
302
|
}
|
|
1374
|
-
async resolveLinks(
|
|
303
|
+
async resolveLinks(t2, e2) {
|
|
1375
304
|
let r2 = [];
|
|
1376
|
-
if (
|
|
1377
|
-
const s2 =
|
|
305
|
+
if (t2.link_uuids) {
|
|
306
|
+
const s2 = t2.link_uuids.length;
|
|
1378
307
|
let n2 = [];
|
|
1379
308
|
const i2 = 50;
|
|
1380
309
|
for (let e3 = 0; e3 < s2; e3 += i2) {
|
|
1381
310
|
const r3 = Math.min(s2, e3 + i2);
|
|
1382
|
-
n2.push(
|
|
311
|
+
n2.push(t2.link_uuids.slice(e3, r3));
|
|
1383
312
|
}
|
|
1384
|
-
for (let
|
|
1385
|
-
(await this.getStories({ per_page: i2, language: e2.language, version: e2.version, by_uuids: n2[
|
|
1386
|
-
r2.push(
|
|
313
|
+
for (let t3 = 0; t3 < n2.length; t3++) {
|
|
314
|
+
(await this.getStories({ per_page: i2, language: e2.language, version: e2.version, by_uuids: n2[t3].join(",") })).data.stories.forEach((t4) => {
|
|
315
|
+
r2.push(t4);
|
|
1387
316
|
});
|
|
1388
317
|
}
|
|
1389
318
|
} else
|
|
1390
|
-
r2 =
|
|
1391
|
-
r2.forEach((
|
|
1392
|
-
this.links[
|
|
319
|
+
r2 = t2.links;
|
|
320
|
+
r2.forEach((t3) => {
|
|
321
|
+
this.links[t3.uuid] = __spreadProps(__spreadValues2({}, t3), { _stopResolving: true });
|
|
1393
322
|
});
|
|
1394
323
|
}
|
|
1395
|
-
async resolveRelations(
|
|
324
|
+
async resolveRelations(t2, e2) {
|
|
1396
325
|
let r2 = [];
|
|
1397
|
-
if (
|
|
1398
|
-
const s2 =
|
|
326
|
+
if (t2.rel_uuids) {
|
|
327
|
+
const s2 = t2.rel_uuids.length;
|
|
1399
328
|
let n2 = [];
|
|
1400
329
|
const i2 = 50;
|
|
1401
330
|
for (let e3 = 0; e3 < s2; e3 += i2) {
|
|
1402
331
|
const r3 = Math.min(s2, e3 + i2);
|
|
1403
|
-
n2.push(
|
|
332
|
+
n2.push(t2.rel_uuids.slice(e3, r3));
|
|
1404
333
|
}
|
|
1405
|
-
for (let
|
|
1406
|
-
(await this.getStories({ per_page: i2, language: e2.language, version: e2.version, by_uuids: n2[
|
|
1407
|
-
r2.push(
|
|
334
|
+
for (let t3 = 0; t3 < n2.length; t3++) {
|
|
335
|
+
(await this.getStories({ per_page: i2, language: e2.language, version: e2.version, by_uuids: n2[t3].join(",") })).data.stories.forEach((t4) => {
|
|
336
|
+
r2.push(t4);
|
|
1408
337
|
});
|
|
1409
338
|
}
|
|
1410
339
|
} else
|
|
1411
|
-
r2 =
|
|
1412
|
-
r2.forEach((
|
|
1413
|
-
this.relations[
|
|
340
|
+
r2 = t2.rels;
|
|
341
|
+
r2.forEach((t3) => {
|
|
342
|
+
this.relations[t3.uuid] = __spreadProps(__spreadValues2({}, t3), { _stopResolving: true });
|
|
1414
343
|
});
|
|
1415
344
|
}
|
|
1416
|
-
async resolveStories(
|
|
345
|
+
async resolveStories(t2, e2) {
|
|
1417
346
|
let r2 = [];
|
|
1418
|
-
e2.resolve_relations !== void 0 && e2.resolve_relations.length > 0 && (r2 = e2.resolve_relations.split(","), await this.resolveRelations(
|
|
1419
|
-
for (const
|
|
1420
|
-
this.iterateTree(this.relations[
|
|
1421
|
-
|
|
1422
|
-
this.iterateTree(
|
|
347
|
+
e2.resolve_relations !== void 0 && e2.resolve_relations.length > 0 && (r2 = e2.resolve_relations.split(","), await this.resolveRelations(t2, e2)), ["1", "story", "url"].indexOf(e2.resolve_links) > -1 && await this.resolveLinks(t2, e2);
|
|
348
|
+
for (const t3 in this.relations)
|
|
349
|
+
this.iterateTree(this.relations[t3], r2);
|
|
350
|
+
t2.story ? this.iterateTree(t2.story, r2) : t2.stories.forEach((t3) => {
|
|
351
|
+
this.iterateTree(t3, r2);
|
|
1423
352
|
});
|
|
1424
353
|
}
|
|
1425
|
-
cacheResponse(
|
|
354
|
+
cacheResponse(t2, e2, r2) {
|
|
1426
355
|
return r2 === void 0 && (r2 = 0), new Promise(async (s2, n2) => {
|
|
1427
|
-
let i2 = a({ url:
|
|
1428
|
-
if (this.cache.clear === "auto" && e2.version === "draft" && await this.flushCache(), e2.version === "published" &&
|
|
1429
|
-
const
|
|
1430
|
-
if (
|
|
1431
|
-
return s2(
|
|
356
|
+
let i2 = a({ url: t2, params: e2 }), o2 = this.cacheProvider();
|
|
357
|
+
if (this.cache.clear === "auto" && e2.version === "draft" && await this.flushCache(), e2.version === "published" && t2 != "/cdn/spaces/me") {
|
|
358
|
+
const t3 = await o2.get(i2);
|
|
359
|
+
if (t3)
|
|
360
|
+
return s2(t3);
|
|
1432
361
|
}
|
|
1433
362
|
try {
|
|
1434
|
-
let r3 = await this.throttle("get",
|
|
363
|
+
let r3 = await this.throttle("get", t2, { params: e2, paramsSerializer: (t3) => a(t3) }), l3 = { data: r3.data, headers: r3.headers };
|
|
1435
364
|
if (r3.headers["per-page"] && (l3 = Object.assign({}, l3, { perPage: parseInt(r3.headers["per-page"]), total: parseInt(r3.headers.total) })), r3.status != 200)
|
|
1436
365
|
return n2(r3);
|
|
1437
|
-
(l3.data.story || l3.data.stories) && await this.resolveStories(l3.data, e2), e2.version === "published" &&
|
|
366
|
+
(l3.data.story || l3.data.stories) && await this.resolveStories(l3.data, e2), e2.version === "published" && t2 != "/cdn/spaces/me" && o2.set(i2, l3), l3.data.cv && (e2.version == "draft" && c[e2.token] != l3.data.cv && this.flushCache(), c[e2.token] = l3.data.cv), s2(l3);
|
|
1438
367
|
} catch (i3) {
|
|
1439
368
|
if (i3.response && i3.response.status === 429 && (r2 += 1) < this.maxRetries)
|
|
1440
|
-
return console.log(`Hit rate limit. Retrying in ${r2} seconds.`), await (l2 = 1e3 * r2, new Promise((
|
|
369
|
+
return console.log(`Hit rate limit. Retrying in ${r2} seconds.`), await (l2 = 1e3 * r2, new Promise((t3) => setTimeout(t3, l2))), this.cacheResponse(t2, e2, r2).then(s2).catch(n2);
|
|
1441
370
|
n2(i3);
|
|
1442
371
|
}
|
|
1443
372
|
var l2;
|
|
1444
373
|
});
|
|
1445
374
|
}
|
|
1446
|
-
throttledRequest(
|
|
1447
|
-
return this.client[
|
|
375
|
+
throttledRequest(t2, e2, r2) {
|
|
376
|
+
return this.client[t2](e2, r2);
|
|
1448
377
|
}
|
|
1449
378
|
cacheVersions() {
|
|
1450
379
|
return c;
|
|
@@ -1452,14 +381,14 @@ class StoryblokClient {
|
|
|
1452
381
|
cacheVersion() {
|
|
1453
382
|
return c[this.accessToken];
|
|
1454
383
|
}
|
|
1455
|
-
setCacheVersion(
|
|
1456
|
-
this.accessToken && (c[this.accessToken] =
|
|
384
|
+
setCacheVersion(t2) {
|
|
385
|
+
this.accessToken && (c[this.accessToken] = t2);
|
|
1457
386
|
}
|
|
1458
387
|
cacheProvider() {
|
|
1459
388
|
switch (this.cache.type) {
|
|
1460
389
|
case "memory":
|
|
1461
|
-
return { get: (
|
|
1462
|
-
l[
|
|
390
|
+
return { get: (t2) => l[t2], getAll: () => l, set(t2, e2) {
|
|
391
|
+
l[t2] = e2;
|
|
1463
392
|
}, flush() {
|
|
1464
393
|
l = {};
|
|
1465
394
|
} };
|
|
@@ -1514,20 +443,28 @@ const useStoryblokBridge = (id, cb, options = {}) => {
|
|
|
1514
443
|
});
|
|
1515
444
|
};
|
|
1516
445
|
const storyblokInit = (pluginOptions = {}) => {
|
|
1517
|
-
const { bridge, accessToken, use
|
|
446
|
+
const { bridge, accessToken, use = [], apiOptions = {} } = pluginOptions;
|
|
1518
447
|
apiOptions.accessToken = apiOptions.accessToken || accessToken;
|
|
1519
448
|
const options = { bridge, apiOptions };
|
|
1520
449
|
let result = {};
|
|
1521
|
-
|
|
1522
|
-
result =
|
|
450
|
+
use.forEach((pluginFactory) => {
|
|
451
|
+
result = __spreadValues2(__spreadValues2({}, result), pluginFactory(options));
|
|
1523
452
|
});
|
|
1524
453
|
if (bridge !== false) {
|
|
1525
454
|
loadBridge("https://app.storyblok.com/f/storyblok-v2-latest.js");
|
|
1526
455
|
}
|
|
1527
456
|
return result;
|
|
1528
457
|
};
|
|
458
|
+
const _sfc_main = {
|
|
459
|
+
props: { blok: Object },
|
|
460
|
+
setup(__props) {
|
|
461
|
+
return (_ctx, _cache) => {
|
|
462
|
+
return openBlock(), createBlock(resolveDynamicComponent(__props.blok.component), normalizeProps(guardReactiveProps(__spreadValues(__spreadValues({}, _ctx.$props), _ctx.$attrs))), null, 16);
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
};
|
|
1529
466
|
const vEditableDirective = {
|
|
1530
|
-
|
|
467
|
+
beforeMount(el, binding) {
|
|
1531
468
|
if (binding.value) {
|
|
1532
469
|
const options = editable(binding.value);
|
|
1533
470
|
el.setAttribute("data-blok-c", options["data-blok-c"]);
|
|
@@ -1536,29 +473,36 @@ const vEditableDirective = {
|
|
|
1536
473
|
}
|
|
1537
474
|
}
|
|
1538
475
|
};
|
|
476
|
+
const printError = (fnName) => {
|
|
477
|
+
console.error(`You can't use ${fnName} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
|
|
478
|
+
`);
|
|
479
|
+
};
|
|
1539
480
|
let storyblokApiInstance = null;
|
|
1540
481
|
const useStoryblokApi = () => {
|
|
1541
|
-
if (!storyblokApiInstance)
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
import { StoryblokVue, apiPlugin } from "@storyblok/vue";
|
|
1545
|
-
app.use(StoryblokVue, {
|
|
1546
|
-
accessToken: "<your-token>",
|
|
1547
|
-
use: [apiPlugin], // use it only if you need it
|
|
1548
|
-
});
|
|
1549
|
-
`);
|
|
1550
|
-
}
|
|
482
|
+
if (!storyblokApiInstance)
|
|
483
|
+
printError("useStoryblokApi");
|
|
1551
484
|
return storyblokApiInstance;
|
|
1552
485
|
};
|
|
486
|
+
const useStoryblok = async (url, apiOptions = {}, bridgeOptions = {}) => {
|
|
487
|
+
const story = ref(null);
|
|
488
|
+
onMounted(() => {
|
|
489
|
+
if (story.value && story.value.id) {
|
|
490
|
+
useStoryblokBridge(story.value.id, (evStory) => story.value = evStory, bridgeOptions);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
if (storyblokApiInstance) {
|
|
494
|
+
const { data } = await storyblokApiInstance.get(`cdn/stories/${url}`, apiOptions);
|
|
495
|
+
story.value = data.story;
|
|
496
|
+
} else
|
|
497
|
+
printError("useStoryblok");
|
|
498
|
+
return story;
|
|
499
|
+
};
|
|
1553
500
|
const StoryblokVue = {
|
|
1554
501
|
install(app, pluginOptions = {}) {
|
|
1555
502
|
app.directive("editable", vEditableDirective);
|
|
503
|
+
app.component("StoryblokComponent", _sfc_main);
|
|
1556
504
|
const { storyblokApi } = storyblokInit(pluginOptions);
|
|
1557
505
|
storyblokApiInstance = storyblokApi;
|
|
1558
|
-
app.prototype.$storyblokApi = storyblokApi;
|
|
1559
506
|
}
|
|
1560
507
|
};
|
|
1561
|
-
|
|
1562
|
-
window.Vue.use(StoryblokVue);
|
|
1563
|
-
}
|
|
1564
|
-
export { StoryblokVue, api as apiPlugin, useStoryblokApi, useStoryblokBridge };
|
|
508
|
+
export { _sfc_main as StoryblokComponent, StoryblokVue, api as apiPlugin, useStoryblok, useStoryblokApi, useStoryblokBridge };
|