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