@storyblok/js 1.8.6 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -0
- package/dist/storyblok-js.js +2 -6
- package/dist/storyblok-js.mjs +486 -551
- package/dist/types/index.d.ts +4 -4
- package/dist/types/types.d.ts +27 -7
- package/package.json +6 -9
package/dist/storyblok-js.mjs
CHANGED
@@ -5,19 +5,18 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
-
var __spreadValues = (
|
9
|
-
for (var prop in
|
10
|
-
if (__hasOwnProp.call(
|
11
|
-
__defNormalProp(
|
8
|
+
var __spreadValues = (a, b2) => {
|
9
|
+
for (var prop in b2 || (b2 = {}))
|
10
|
+
if (__hasOwnProp.call(b2, prop))
|
11
|
+
__defNormalProp(a, prop, b2[prop]);
|
12
12
|
if (__getOwnPropSymbols)
|
13
|
-
for (var prop of __getOwnPropSymbols(
|
14
|
-
if (__propIsEnum.call(
|
15
|
-
__defNormalProp(
|
13
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
14
|
+
if (__propIsEnum.call(b2, prop))
|
15
|
+
__defNormalProp(a, prop, b2[prop]);
|
16
16
|
}
|
17
|
-
return
|
17
|
+
return a;
|
18
18
|
};
|
19
|
-
var __spreadProps = (
|
20
|
-
import e from "axios";
|
19
|
+
var __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2));
|
21
20
|
let loaded = false;
|
22
21
|
const callbacks = [];
|
23
22
|
const loadBridge = (src) => {
|
@@ -49,619 +48,555 @@ const loadBridge = (src) => {
|
|
49
48
|
document.getElementsByTagName("head")[0].appendChild(script);
|
50
49
|
});
|
51
50
|
};
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
var m = Object.defineProperty;
|
52
|
+
var R = (i, t, e) => t in i ? m(i, t, { enumerable: true, configurable: true, writable: true, value: e }) : i[t] = e;
|
53
|
+
var l = (i, t, e) => (R(i, typeof t != "symbol" ? t + "" : t, e), e);
|
54
|
+
function y(i) {
|
55
|
+
return !(i !== i || i === 1 / 0 || i === -1 / 0);
|
56
|
+
}
|
57
|
+
function _(i, t, e) {
|
58
|
+
if (!y(t))
|
59
|
+
throw new TypeError("Expected `limit` to be a finite number");
|
60
|
+
if (!y(e))
|
61
|
+
throw new TypeError("Expected `interval` to be a finite number");
|
62
|
+
const s = [];
|
63
|
+
let r = [], n = 0;
|
64
|
+
const c = function() {
|
65
|
+
n++;
|
66
|
+
const a = setTimeout(function() {
|
67
|
+
n--, s.length > 0 && c(), r = r.filter(function(u) {
|
68
|
+
return u !== a;
|
69
|
+
});
|
70
|
+
}, e);
|
71
|
+
r.indexOf(a) < 0 && r.push(a);
|
72
|
+
const h = s.shift();
|
73
|
+
h.resolve(i.apply(h.self, h.args));
|
74
|
+
}, o = function(...a) {
|
75
|
+
const h = this;
|
76
|
+
return new Promise(function(u, g) {
|
77
|
+
s.push({
|
78
|
+
resolve: u,
|
79
|
+
reject: g,
|
80
|
+
args: a,
|
81
|
+
self: h
|
82
|
+
}), n < t && c();
|
83
|
+
});
|
84
|
+
};
|
85
|
+
return o.abort = function() {
|
86
|
+
r.forEach(clearTimeout), r = [], s.forEach(function(a) {
|
87
|
+
a.reject(function() {
|
88
|
+
Error.call(this, "Throttled function aborted"), this.name = "AbortError";
|
89
|
+
});
|
90
|
+
}), s.length = 0;
|
91
|
+
}, o;
|
92
|
+
}
|
93
|
+
const b = function(i, t) {
|
94
|
+
const e = {};
|
95
|
+
for (const s in i) {
|
96
|
+
const r = i[s];
|
97
|
+
t.indexOf(s) > -1 && r !== null && (e[s] = r);
|
98
|
+
}
|
99
|
+
return e;
|
100
|
+
}, $ = (i) => i === "email", w = () => ({
|
101
|
+
singleTag: "hr"
|
102
|
+
}), E = () => ({
|
103
|
+
tag: "blockquote"
|
104
|
+
}), x = () => ({
|
105
|
+
tag: "ul"
|
106
|
+
}), P = (i) => ({
|
107
|
+
tag: [
|
108
|
+
"pre",
|
109
|
+
{
|
110
|
+
tag: "code",
|
111
|
+
attrs: i.attrs
|
61
112
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
},
|
73
|
-
blockquote() {
|
74
|
-
return {
|
75
|
-
tag: "blockquote"
|
76
|
-
};
|
77
|
-
},
|
78
|
-
bullet_list() {
|
79
|
-
return {
|
80
|
-
tag: "ul"
|
81
|
-
};
|
82
|
-
},
|
83
|
-
code_block(node) {
|
84
|
-
return {
|
85
|
-
tag: [
|
86
|
-
"pre",
|
87
|
-
{
|
88
|
-
tag: "code",
|
89
|
-
attrs: node.attrs
|
90
|
-
}
|
91
|
-
]
|
92
|
-
};
|
93
|
-
},
|
94
|
-
hard_break() {
|
95
|
-
return {
|
96
|
-
singleTag: "br"
|
97
|
-
};
|
98
|
-
},
|
99
|
-
heading(node) {
|
100
|
-
return {
|
101
|
-
tag: `h${node.attrs.level}`
|
102
|
-
};
|
103
|
-
},
|
104
|
-
image(node) {
|
105
|
-
return {
|
106
|
-
singleTag: [
|
107
|
-
{
|
108
|
-
tag: "img",
|
109
|
-
attrs: pick(node.attrs, ["src", "alt", "title"])
|
110
|
-
}
|
111
|
-
]
|
112
|
-
};
|
113
|
-
},
|
114
|
-
list_item() {
|
115
|
-
return {
|
116
|
-
tag: "li"
|
117
|
-
};
|
118
|
-
},
|
119
|
-
ordered_list() {
|
120
|
-
return {
|
121
|
-
tag: "ol"
|
122
|
-
};
|
123
|
-
},
|
124
|
-
paragraph() {
|
125
|
-
return {
|
126
|
-
tag: "p"
|
127
|
-
};
|
113
|
+
]
|
114
|
+
}), O = () => ({
|
115
|
+
singleTag: "br"
|
116
|
+
}), S = (i) => ({
|
117
|
+
tag: `h${i.attrs.level}`
|
118
|
+
}), C = (i) => ({
|
119
|
+
singleTag: [
|
120
|
+
{
|
121
|
+
tag: "img",
|
122
|
+
attrs: b(i.attrs, ["src", "alt", "title"])
|
128
123
|
}
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
tag: "
|
154
|
-
|
155
|
-
},
|
156
|
-
italic() {
|
157
|
-
return {
|
158
|
-
tag: "i"
|
159
|
-
};
|
160
|
-
},
|
161
|
-
link(node) {
|
162
|
-
const attrs = __spreadValues({}, node.attrs);
|
163
|
-
const { linktype = "url" } = node.attrs;
|
164
|
-
if (isEmailLinkType(linktype)) {
|
165
|
-
attrs.href = `mailto:${attrs.href}`;
|
166
|
-
}
|
167
|
-
if (attrs.anchor) {
|
168
|
-
attrs.href = `${attrs.href}#${attrs.anchor}`;
|
169
|
-
delete attrs.anchor;
|
124
|
+
]
|
125
|
+
}), L = () => ({
|
126
|
+
tag: "li"
|
127
|
+
}), U = () => ({
|
128
|
+
tag: "ol"
|
129
|
+
}), H = () => ({
|
130
|
+
tag: "p"
|
131
|
+
}), A = () => ({
|
132
|
+
tag: "b"
|
133
|
+
}), I = () => ({
|
134
|
+
tag: "strike"
|
135
|
+
}), M = () => ({
|
136
|
+
tag: "u"
|
137
|
+
}), N = () => ({
|
138
|
+
tag: "strong"
|
139
|
+
}), q = () => ({
|
140
|
+
tag: "code"
|
141
|
+
}), z = () => ({
|
142
|
+
tag: "i"
|
143
|
+
}), F = (i) => {
|
144
|
+
const t = __spreadValues({}, i.attrs), { linktype: e = "url" } = i.attrs;
|
145
|
+
return $(e) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), {
|
146
|
+
tag: [
|
147
|
+
{
|
148
|
+
tag: "a",
|
149
|
+
attrs: t
|
170
150
|
}
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
};
|
179
|
-
},
|
180
|
-
styled(node) {
|
181
|
-
return {
|
182
|
-
tag: [
|
183
|
-
{
|
184
|
-
tag: "span",
|
185
|
-
attrs: node.attrs
|
186
|
-
}
|
187
|
-
]
|
188
|
-
};
|
151
|
+
]
|
152
|
+
};
|
153
|
+
}, V = (i) => ({
|
154
|
+
tag: [
|
155
|
+
{
|
156
|
+
tag: "span",
|
157
|
+
attrs: i.attrs
|
189
158
|
}
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
|
159
|
+
]
|
160
|
+
}), j = {
|
161
|
+
nodes: {
|
162
|
+
horizontal_rule: w,
|
163
|
+
blockquote: E,
|
164
|
+
bullet_list: x,
|
165
|
+
code_block: P,
|
166
|
+
hard_break: O,
|
167
|
+
heading: S,
|
168
|
+
image: C,
|
169
|
+
list_item: L,
|
170
|
+
ordered_list: U,
|
171
|
+
paragraph: H
|
172
|
+
},
|
173
|
+
marks: {
|
174
|
+
bold: A,
|
175
|
+
strike: I,
|
176
|
+
underline: M,
|
177
|
+
strong: N,
|
178
|
+
code: q,
|
179
|
+
italic: z,
|
180
|
+
link: F,
|
181
|
+
styled: V
|
182
|
+
}
|
183
|
+
}, J = function(i) {
|
184
|
+
const t = {
|
194
185
|
"&": "&",
|
195
186
|
"<": "<",
|
196
187
|
">": ">",
|
197
188
|
'"': """,
|
198
189
|
"'": "'"
|
199
|
-
};
|
200
|
-
|
201
|
-
const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
202
|
-
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, (chr) => htmlEscapes[chr]) : string;
|
190
|
+
}, e = /[&<>"']/g, s = RegExp(e.source);
|
191
|
+
return i && s.test(i) ? i.replace(e, (r) => t[r]) : i;
|
203
192
|
};
|
204
|
-
class
|
205
|
-
constructor(
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
html += this.renderNode(node);
|
223
|
-
});
|
224
|
-
return html;
|
225
|
-
}
|
226
|
-
console.warn("The render method must receive an object with a content field, which is an array");
|
227
|
-
return "";
|
228
|
-
}
|
229
|
-
renderNode(item) {
|
230
|
-
let html = [];
|
231
|
-
if (item.marks) {
|
232
|
-
item.marks.forEach((m) => {
|
233
|
-
const mark = this.getMatchingMark(m);
|
234
|
-
if (mark) {
|
235
|
-
html.push(this.renderOpeningTag(mark.tag));
|
236
|
-
}
|
237
|
-
});
|
238
|
-
}
|
239
|
-
const node = this.getMatchingNode(item);
|
240
|
-
if (node && node.tag) {
|
241
|
-
html.push(this.renderOpeningTag(node.tag));
|
193
|
+
class v {
|
194
|
+
constructor(t) {
|
195
|
+
l(this, "marks");
|
196
|
+
l(this, "nodes");
|
197
|
+
t || (t = j), this.marks = t.marks || [], this.nodes = t.nodes || [];
|
198
|
+
}
|
199
|
+
addNode(t, e) {
|
200
|
+
this.nodes[t] = e;
|
201
|
+
}
|
202
|
+
addMark(t, e) {
|
203
|
+
this.marks[t] = e;
|
204
|
+
}
|
205
|
+
render(t) {
|
206
|
+
if (t && t.content && Array.isArray(t.content)) {
|
207
|
+
let e = "";
|
208
|
+
return t.content.forEach((s) => {
|
209
|
+
e += this.renderNode(s);
|
210
|
+
}), e;
|
242
211
|
}
|
243
|
-
|
244
|
-
item.content.forEach((content) => {
|
245
|
-
html.push(this.renderNode(content));
|
246
|
-
});
|
247
|
-
} else if (item.text) {
|
248
|
-
html.push(escapeHTML(item.text));
|
249
|
-
} else if (node && node.singleTag) {
|
250
|
-
html.push(this.renderTag(node.singleTag, " /"));
|
251
|
-
} else if (node && node.html) {
|
252
|
-
html.push(node.html);
|
253
|
-
}
|
254
|
-
if (node && node.tag) {
|
255
|
-
html.push(this.renderClosingTag(node.tag));
|
256
|
-
}
|
257
|
-
if (item.marks) {
|
258
|
-
item.marks.slice(0).reverse().forEach((m) => {
|
259
|
-
const mark = this.getMatchingMark(m);
|
260
|
-
if (mark) {
|
261
|
-
html.push(this.renderClosingTag(mark.tag));
|
262
|
-
}
|
263
|
-
});
|
264
|
-
}
|
265
|
-
return html.join("");
|
212
|
+
return console.warn("The render method must receive an object with a content field, which is an array"), "";
|
266
213
|
}
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
214
|
+
renderNode(t) {
|
215
|
+
const e = [];
|
216
|
+
t.marks && t.marks.forEach((r) => {
|
217
|
+
const n = this.getMatchingMark(r);
|
218
|
+
n && e.push(this.renderOpeningTag(n.tag));
|
219
|
+
});
|
220
|
+
const s = this.getMatchingNode(t);
|
221
|
+
return s && s.tag && e.push(this.renderOpeningTag(s.tag)), t.content ? t.content.forEach((r) => {
|
222
|
+
e.push(this.renderNode(r));
|
223
|
+
}) : t.text ? e.push(J(t.text)) : s && s.singleTag ? e.push(this.renderTag(s.singleTag, " /")) : s && s.html && e.push(s.html), s && s.tag && e.push(this.renderClosingTag(s.tag)), t.marks && t.marks.slice(0).reverse().forEach((r) => {
|
224
|
+
const n = this.getMatchingMark(r);
|
225
|
+
n && e.push(this.renderClosingTag(n.tag));
|
226
|
+
}), e.join("");
|
227
|
+
}
|
228
|
+
renderTag(t, e) {
|
229
|
+
return t.constructor === String ? `<${t}${e}>` : t.map((r) => {
|
230
|
+
if (r.constructor === String)
|
231
|
+
return `<${r}${e}>`;
|
232
|
+
{
|
233
|
+
let n = `<${r.tag}`;
|
234
|
+
if (r.attrs)
|
235
|
+
for (const c in r.attrs) {
|
236
|
+
const o = r.attrs[c];
|
237
|
+
o !== null && (n += ` ${c}="${o}"`);
|
282
238
|
}
|
283
|
-
}
|
284
|
-
return `${h2}${ending}>`;
|
239
|
+
return `${n}${e}>`;
|
285
240
|
}
|
286
|
-
});
|
287
|
-
return all.join("");
|
241
|
+
}).join("");
|
288
242
|
}
|
289
|
-
renderOpeningTag(
|
290
|
-
return this.renderTag(
|
243
|
+
renderOpeningTag(t) {
|
244
|
+
return this.renderTag(t, "");
|
291
245
|
}
|
292
|
-
renderClosingTag(
|
293
|
-
|
294
|
-
return `</${tags}>`;
|
295
|
-
}
|
296
|
-
const all = tags.slice(0).reverse().map((tag) => {
|
297
|
-
if (tag.constructor === String) {
|
298
|
-
return `</${tag}>`;
|
299
|
-
} else {
|
300
|
-
return `</${tag.tag}>`;
|
301
|
-
}
|
302
|
-
});
|
303
|
-
return all.join("");
|
246
|
+
renderClosingTag(t) {
|
247
|
+
return t.constructor === String ? `</${t}>` : t.slice(0).reverse().map((s) => s.constructor === String ? `</${s}>` : `</${s.tag}>`).join("");
|
304
248
|
}
|
305
|
-
getMatchingNode(
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
return this.nodes[item.type](item);
|
249
|
+
getMatchingNode(t) {
|
250
|
+
const e = this.nodes[t.type];
|
251
|
+
if (typeof e == "function")
|
252
|
+
return e(t);
|
310
253
|
}
|
311
|
-
getMatchingMark(
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
return this.marks[item.type](item);
|
254
|
+
getMatchingMark(t) {
|
255
|
+
const e = this.marks[t.type];
|
256
|
+
if (typeof e == "function")
|
257
|
+
return e(t);
|
316
258
|
}
|
317
259
|
}
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
throw new TypeError("Expected `interval` to be a finite number");
|
331
|
-
var i2 = [], n2 = [], o2 = 0, a2 = function() {
|
332
|
-
o2++;
|
333
|
-
var t2 = setTimeout(function() {
|
334
|
-
o2--, i2.length > 0 && a2(), n2 = n2.filter(function(e3) {
|
335
|
-
return e3 !== t2;
|
336
|
-
});
|
337
|
-
}, r2);
|
338
|
-
n2.indexOf(t2) < 0 && n2.push(t2);
|
339
|
-
var s3 = i2.shift();
|
340
|
-
s3.resolve(e2.apply(s3.self, s3.args));
|
341
|
-
}, l2 = function() {
|
342
|
-
var e3 = arguments, t2 = this;
|
343
|
-
return new Promise(function(r3, n3) {
|
344
|
-
i2.push({ resolve: r3, reject: n3, args: e3, self: t2 }), o2 < s2 && a2();
|
260
|
+
class T {
|
261
|
+
constructor() {
|
262
|
+
l(this, "isCDNUrl", (t = "") => t.indexOf("/cdn/") > -1);
|
263
|
+
l(this, "getOptionsPage", (t, e = 25, s = 1) => __spreadProps(__spreadValues({}, t), {
|
264
|
+
per_page: e,
|
265
|
+
page: s
|
266
|
+
}));
|
267
|
+
l(this, "delay", (t) => new Promise((e) => setTimeout(e, t)));
|
268
|
+
l(this, "arrayFrom", (t = 0, e) => [...Array(t)].map(e));
|
269
|
+
l(this, "range", (t = 0, e = t) => {
|
270
|
+
const s = Math.abs(e - t) || 0, r = t < e ? 1 : -1;
|
271
|
+
return this.arrayFrom(s, (n, c) => c * r + t);
|
345
272
|
});
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
if (!e2)
|
358
|
-
return null;
|
359
|
-
let s2 = {};
|
360
|
-
for (let r2 in e2) {
|
361
|
-
let i2 = e2[r2];
|
362
|
-
t2.indexOf(r2) > -1 && i2 !== null && (s2[r2] = i2);
|
363
|
-
}
|
364
|
-
return s2;
|
365
|
-
};
|
366
|
-
var i = { nodes: { horizontal_rule: () => ({ singleTag: "hr" }), blockquote: () => ({ tag: "blockquote" }), bullet_list: () => ({ tag: "ul" }), code_block: (e2) => ({ tag: ["pre", { tag: "code", attrs: e2.attrs }] }), hard_break: () => ({ singleTag: "br" }), heading: (e2) => ({ tag: `h${e2.attrs.level}` }), image: (e2) => ({ singleTag: [{ tag: "img", attrs: r(e2.attrs, ["src", "alt", "title"]) }] }), list_item: () => ({ tag: "li" }), ordered_list: () => ({ tag: "ol" }), paragraph: () => ({ tag: "p" }) }, marks: { bold: () => ({ tag: "b" }), strike: () => ({ tag: "strike" }), underline: () => ({ tag: "u" }), strong: () => ({ tag: "strong" }), code: () => ({ tag: "code" }), italic: () => ({ tag: "i" }), link(e2) {
|
367
|
-
const t2 = __spreadValues({}, e2.attrs), { linktype: s2 = "url" } = e2.attrs;
|
368
|
-
return s2 === "email" && (t2.href = `mailto:${t2.href}`), t2.anchor && (t2.href = `${t2.href}#${t2.anchor}`, delete t2.anchor), { tag: [{ tag: "a", attrs: t2 }] };
|
369
|
-
}, styled: (e2) => ({ tag: [{ tag: "span", attrs: e2.attrs }] }) } };
|
370
|
-
class n {
|
371
|
-
constructor(e2) {
|
372
|
-
e2 || (e2 = i), this.marks = e2.marks || [], this.nodes = e2.nodes || [];
|
373
|
-
}
|
374
|
-
addNode(e2, t2) {
|
375
|
-
this.nodes[e2] = t2;
|
376
|
-
}
|
377
|
-
addMark(e2, t2) {
|
378
|
-
this.marks[e2] = t2;
|
379
|
-
}
|
380
|
-
render(e2 = {}) {
|
381
|
-
if (e2.content && Array.isArray(e2.content)) {
|
382
|
-
let t2 = "";
|
383
|
-
return e2.content.forEach((e3) => {
|
384
|
-
t2 += this.renderNode(e3);
|
385
|
-
}), t2;
|
273
|
+
l(this, "asyncMap", async (t, e) => Promise.all(t.map(e)));
|
274
|
+
l(this, "flatMap", (t = [], e) => t.map(e).reduce((s, r) => [...s, ...r], []));
|
275
|
+
}
|
276
|
+
stringify(t, e, s) {
|
277
|
+
const r = [];
|
278
|
+
for (const n in t) {
|
279
|
+
if (!Object.prototype.hasOwnProperty.call(t, n))
|
280
|
+
continue;
|
281
|
+
const c = t[n], o = s ? "" : encodeURIComponent(n);
|
282
|
+
let a;
|
283
|
+
typeof c == "object" ? a = this.stringify(c, e ? e + encodeURIComponent("[" + o + "]") : o, Array.isArray(c)) : a = (e ? e + encodeURIComponent("[" + o + "]") : o) + "=" + encodeURIComponent(c), r.push(a);
|
386
284
|
}
|
387
|
-
return
|
285
|
+
return r.join("&");
|
388
286
|
}
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
287
|
+
}
|
288
|
+
var f = /* @__PURE__ */ ((i) => (i.GET = "get", i.DELETE = "delete", i.POST = "post", i.PUT = "put", i))(f || {});
|
289
|
+
class G {
|
290
|
+
constructor(t) {
|
291
|
+
l(this, "baseURL");
|
292
|
+
l(this, "timeout");
|
293
|
+
l(this, "headers");
|
294
|
+
l(this, "responseInterceptor");
|
295
|
+
l(this, "ejectInterceptor");
|
296
|
+
l(this, "url");
|
297
|
+
l(this, "parameters");
|
298
|
+
this.baseURL = t.baseURL, this.timeout = t.timeout ? t.timeout * 1e3 : 1e3, this.headers = t.headers || [], this.responseInterceptor = t.responseInterceptor, this.ejectInterceptor = false, this.url = "", this.parameters = {};
|
299
|
+
}
|
300
|
+
get(t, e) {
|
301
|
+
return this.url = t, this.parameters = e, this._methodHandler(f.GET);
|
302
|
+
}
|
303
|
+
post(t, e) {
|
304
|
+
return this.url = t, this.parameters = e, this._methodHandler(f.POST);
|
305
|
+
}
|
306
|
+
put(t, e) {
|
307
|
+
return this.url = t, this.parameters = e, this._methodHandler(f.PUT);
|
308
|
+
}
|
309
|
+
delete(t, e) {
|
310
|
+
return this.url = t, this.parameters = e, this._methodHandler(f.DELETE);
|
311
|
+
}
|
312
|
+
async _responseHandler(t) {
|
313
|
+
const e = [], s = {
|
314
|
+
data: {},
|
315
|
+
headers: {},
|
316
|
+
status: 0,
|
317
|
+
statusText: ""
|
318
|
+
};
|
319
|
+
await t.json().then((r) => {
|
320
|
+
s.data = r;
|
394
321
|
});
|
395
|
-
const
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
}).join("");
|
422
|
-
}
|
423
|
-
renderOpeningTag(e2) {
|
424
|
-
return this.renderTag(e2, "");
|
425
|
-
}
|
426
|
-
renderClosingTag(e2) {
|
427
|
-
if (e2.constructor === String)
|
428
|
-
return `</${e2}>`;
|
429
|
-
return e2.slice(0).reverse().map((e3) => e3.constructor === String ? `</${e3}>` : `</${e3.tag}>`).join("");
|
322
|
+
for (const r of t.headers.entries())
|
323
|
+
e[r[0]] = r[1];
|
324
|
+
return s.headers = __spreadValues({}, e), s.status = t.status, s.statusText = t.statusText, s;
|
325
|
+
}
|
326
|
+
async _methodHandler(t) {
|
327
|
+
const e = new URL(`${this.baseURL}${this.url}`);
|
328
|
+
let s = null;
|
329
|
+
if (t === "get") {
|
330
|
+
const o = new T();
|
331
|
+
e.search = o.stringify(this.parameters);
|
332
|
+
} else
|
333
|
+
s = JSON.stringify(this.parameters);
|
334
|
+
const r = new AbortController(), { signal: n } = r, c = setTimeout(() => r.abort(), this.timeout);
|
335
|
+
try {
|
336
|
+
const o = await fetch(`${e}`, {
|
337
|
+
method: t,
|
338
|
+
headers: this.headers,
|
339
|
+
body: s,
|
340
|
+
signal: n
|
341
|
+
});
|
342
|
+
clearTimeout(c);
|
343
|
+
const a = await this._responseHandler(o);
|
344
|
+
return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(a)) : this._statusHandler(a);
|
345
|
+
} catch (o) {
|
346
|
+
return o;
|
347
|
+
}
|
430
348
|
}
|
431
|
-
|
432
|
-
|
433
|
-
return this.nodes[e2.type](e2);
|
349
|
+
eject() {
|
350
|
+
this.ejectInterceptor = true;
|
434
351
|
}
|
435
|
-
|
436
|
-
if (
|
437
|
-
return
|
352
|
+
_statusHandler(t) {
|
353
|
+
if (/20[01]/g.test(`${t.status}`))
|
354
|
+
return t;
|
355
|
+
throw {
|
356
|
+
message: new Error(t.statusText || `status: ${t.status}`),
|
357
|
+
response: t
|
358
|
+
};
|
438
359
|
}
|
439
360
|
}
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
if (!r2) {
|
458
|
-
let e2 = t2.region ? `-${t2.region}` : "", s2 = t2.https === false ? "http" : "https";
|
459
|
-
r2 = t2.oauthToken === void 0 ? `${s2}://api${e2}.storyblok.com/v2` : `${s2}://api${e2}.storyblok.com/v1`;
|
361
|
+
let p = {};
|
362
|
+
const d = {};
|
363
|
+
class Q {
|
364
|
+
constructor(t, e) {
|
365
|
+
l(this, "client");
|
366
|
+
l(this, "maxRetries");
|
367
|
+
l(this, "throttle");
|
368
|
+
l(this, "accessToken");
|
369
|
+
l(this, "cache");
|
370
|
+
l(this, "helpers");
|
371
|
+
l(this, "relations");
|
372
|
+
l(this, "links");
|
373
|
+
l(this, "richTextResolver");
|
374
|
+
l(this, "resolveNestedRelations");
|
375
|
+
if (!e) {
|
376
|
+
const n = t.region ? `-${t.region}` : "", c = t.https ? "https" : "http";
|
377
|
+
t.oauthToken ? e = `${c}://api${n}.storyblok.com/v1` : e = `${c}://api${n}.storyblok.com/v2`;
|
460
378
|
}
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
s2 += e2(t3.component, t3);
|
469
|
-
}), { html: s2 };
|
379
|
+
const s = Object.assign({}, t.headers);
|
380
|
+
let r = 5;
|
381
|
+
t.oauthToken && (s.Authorization = t.oauthToken, r = 3), t.rateLimit && (r = t.rateLimit), t.richTextSchema ? this.richTextResolver = new v(t.richTextSchema) : this.richTextResolver = new v(), t.componentResolver && this.setComponentResolver(t.componentResolver), this.maxRetries = t.maxRetries, this.throttle = _(this.throttledRequest, r, 1e3), this.accessToken = t.accessToken || "", this.relations = {}, this.links = {}, this.cache = t.cache || { clear: "manual" }, this.helpers = new T(), this.resolveNestedRelations = false, this.client = new G({
|
382
|
+
baseURL: e,
|
383
|
+
timeout: t.timeout || 0,
|
384
|
+
headers: s,
|
385
|
+
responseInterceptor: t.responseInterceptor
|
470
386
|
});
|
471
387
|
}
|
472
|
-
|
473
|
-
|
388
|
+
setComponentResolver(t) {
|
389
|
+
this.richTextResolver.addNode("blok", (e) => {
|
390
|
+
let s = "";
|
391
|
+
return e.attrs.body.forEach((r) => {
|
392
|
+
s += t(r.component, r);
|
393
|
+
}), {
|
394
|
+
html: s
|
395
|
+
};
|
396
|
+
});
|
474
397
|
}
|
475
|
-
|
476
|
-
return (
|
398
|
+
parseParams(t) {
|
399
|
+
return t.version || (t.version = "published"), t.token || (t.token = this.getToken()), t.cv || (t.cv = d[t.token]), Array.isArray(t.resolve_relations) && (t.resolve_relations = t.resolve_relations.join(",")), t;
|
477
400
|
}
|
478
|
-
|
479
|
-
|
480
|
-
return this.cacheResponse(e2, i2);
|
401
|
+
factoryParamOptions(t, e) {
|
402
|
+
return this.helpers.isCDNUrl(t) ? this.parseParams(e) : e;
|
481
403
|
}
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
return this.cacheResponse(s2, r2);
|
404
|
+
makeRequest(t, e, s, r) {
|
405
|
+
const n = this.factoryParamOptions(t, this.helpers.getOptionsPage(e, s, r));
|
406
|
+
return this.cacheResponse(t, n);
|
486
407
|
}
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
return ((e3 = [], t3) => e3.map(t3).reduce((e4, t4) => [...e4, ...t4], []))([a2, ...await (async (e3 = [], t3) => Promise.all(e3.map(t3)))(o(1, l2), async (e3) => this.makeRequest(i2, t2, r2, e3 + 1))], (e3) => Object.values(e3.data[s2]));
|
408
|
+
get(t, e) {
|
409
|
+
e || (e = {});
|
410
|
+
const s = `/${t}`, r = this.factoryParamOptions(s, e);
|
411
|
+
return this.cacheResponse(s, r);
|
492
412
|
}
|
493
|
-
|
494
|
-
|
495
|
-
return this.
|
413
|
+
async getAll(t, e, s) {
|
414
|
+
const r = (e == null ? void 0 : e.per_page) || 25, n = `/${t}`, c = n.split("/"), o = s || c[c.length - 1], a = 1, h = await this.makeRequest(n, e, r, a), u = h.total ? Math.ceil(h.total / r) : 1, g = await this.helpers.asyncMap(this.helpers.range(a, u), (k) => this.makeRequest(n, e, r, k + 1));
|
415
|
+
return this.helpers.flatMap([h, ...g], (k) => Object.values(k.data[o]));
|
496
416
|
}
|
497
|
-
|
498
|
-
|
499
|
-
return this.throttle("
|
417
|
+
post(t, e) {
|
418
|
+
const s = `/${t}`;
|
419
|
+
return Promise.resolve(this.throttle("post", s, e));
|
500
420
|
}
|
501
|
-
|
502
|
-
|
503
|
-
return this.throttle("
|
421
|
+
put(t, e) {
|
422
|
+
const s = `/${t}`;
|
423
|
+
return Promise.resolve(this.throttle("put", s, e));
|
504
424
|
}
|
505
|
-
|
506
|
-
|
425
|
+
delete(t, e) {
|
426
|
+
const s = `/${t}`;
|
427
|
+
return Promise.resolve(this.throttle("delete", s, e));
|
507
428
|
}
|
508
|
-
|
509
|
-
return this.get(
|
429
|
+
getStories(t) {
|
430
|
+
return this.get("cdn/stories", t);
|
510
431
|
}
|
511
|
-
|
512
|
-
this.
|
432
|
+
getStory(t, e) {
|
433
|
+
return this.get(`cdn/stories/${t}`, e);
|
513
434
|
}
|
514
435
|
getToken() {
|
515
436
|
return this.accessToken;
|
516
437
|
}
|
517
|
-
|
518
|
-
|
519
|
-
}
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
438
|
+
ejectInterceptor() {
|
439
|
+
this.client.eject();
|
440
|
+
}
|
441
|
+
_cleanCopy(t) {
|
442
|
+
return JSON.parse(JSON.stringify(t));
|
443
|
+
}
|
444
|
+
_insertLinks(t, e) {
|
445
|
+
const s = t[e];
|
446
|
+
s && s.fieldtype == "multilink" && s.linktype == "story" && typeof s.id == "string" && this.links[s.id] ? s.story = this._cleanCopy(this.links[s.id]) : s && s.linktype === "story" && typeof s.uuid == "string" && this.links[s.uuid] && (s.story = this._cleanCopy(this.links[s.uuid]));
|
447
|
+
}
|
448
|
+
_insertRelations(t, e, s) {
|
449
|
+
if (s.indexOf(`${t.component}.${e}`) > -1) {
|
450
|
+
if (typeof t[e] == "string")
|
451
|
+
this.relations[t[e]] && (t[e] = this._cleanCopy(this.relations[t[e]]));
|
452
|
+
else if (t[e] && t[e].constructor === Array) {
|
453
|
+
const r = [];
|
454
|
+
t[e].forEach((n) => {
|
455
|
+
this.relations[n] && r.push(this._cleanCopy(this.relations[n]));
|
456
|
+
}), t[e] = r;
|
533
457
|
}
|
534
458
|
}
|
535
459
|
}
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
if (e3.constructor === Array)
|
545
|
-
for (let t3 = 0; t3 < e3.length; t3++)
|
546
|
-
s2(e3[t3]);
|
547
|
-
else if (e3.constructor === Object) {
|
548
|
-
if (e3._stopResolving)
|
460
|
+
iterateTree(t, e) {
|
461
|
+
const s = (r) => {
|
462
|
+
if (r != null) {
|
463
|
+
if (r.constructor === Array)
|
464
|
+
for (let n = 0; n < r.length; n++)
|
465
|
+
s(r[n]);
|
466
|
+
else if (r.constructor === Object) {
|
467
|
+
if (r._stopResolving)
|
549
468
|
return;
|
550
|
-
for (
|
551
|
-
|
469
|
+
for (const n in r)
|
470
|
+
(r.component && r._uid || r.type === "link") && (this._insertRelations(r, n, e), this._insertLinks(r, n)), s(r[n]);
|
552
471
|
}
|
553
472
|
}
|
554
473
|
};
|
555
|
-
|
556
|
-
}
|
557
|
-
async resolveLinks(
|
558
|
-
let
|
559
|
-
if (
|
560
|
-
const
|
561
|
-
let
|
562
|
-
|
563
|
-
|
564
|
-
const s3 = Math.min(r2, t3 + n2);
|
565
|
-
i2.push(e2.link_uuids.slice(t3, s3));
|
474
|
+
s(t.content);
|
475
|
+
}
|
476
|
+
async resolveLinks(t, e) {
|
477
|
+
let s = [];
|
478
|
+
if (t.link_uuids) {
|
479
|
+
const r = t.link_uuids.length, n = [], c = 50;
|
480
|
+
for (let o = 0; o < r; o += c) {
|
481
|
+
const a = Math.min(r, o + c);
|
482
|
+
n.push(t.link_uuids.slice(o, a));
|
566
483
|
}
|
567
|
-
for (let
|
568
|
-
(await this.getStories({
|
569
|
-
|
484
|
+
for (let o = 0; o < n.length; o++)
|
485
|
+
(await this.getStories({
|
486
|
+
per_page: c,
|
487
|
+
language: e.language,
|
488
|
+
version: e.version,
|
489
|
+
by_uuids: n[o].join(",")
|
490
|
+
})).data.stories.forEach((h) => {
|
491
|
+
s.push(h);
|
570
492
|
});
|
571
|
-
}
|
572
493
|
} else
|
573
|
-
|
574
|
-
|
575
|
-
this.links[
|
494
|
+
s = t.links;
|
495
|
+
s.forEach((r) => {
|
496
|
+
this.links[r.uuid] = __spreadProps(__spreadValues({}, r), { _stopResolving: true });
|
576
497
|
});
|
577
498
|
}
|
578
|
-
async resolveRelations(
|
579
|
-
let
|
580
|
-
if (
|
581
|
-
const
|
582
|
-
let
|
583
|
-
|
584
|
-
|
585
|
-
const s3 = Math.min(r2, t3 + n2);
|
586
|
-
i2.push(e2.rel_uuids.slice(t3, s3));
|
499
|
+
async resolveRelations(t, e) {
|
500
|
+
let s = [];
|
501
|
+
if (t.rel_uuids) {
|
502
|
+
const r = t.rel_uuids.length, n = [], c = 50;
|
503
|
+
for (let o = 0; o < r; o += c) {
|
504
|
+
const a = Math.min(r, o + c);
|
505
|
+
n.push(t.rel_uuids.slice(o, a));
|
587
506
|
}
|
588
|
-
for (let
|
589
|
-
(await this.getStories({
|
590
|
-
|
507
|
+
for (let o = 0; o < n.length; o++)
|
508
|
+
(await this.getStories({
|
509
|
+
per_page: c,
|
510
|
+
language: e.language,
|
511
|
+
version: e.version,
|
512
|
+
by_uuids: n[o].join(",")
|
513
|
+
})).data.stories.forEach((h) => {
|
514
|
+
s.push(h);
|
591
515
|
});
|
592
|
-
}
|
593
516
|
} else
|
594
|
-
|
595
|
-
|
596
|
-
this.relations[
|
517
|
+
s = t.rels;
|
518
|
+
s && s.length > 0 && s.forEach((r) => {
|
519
|
+
this.relations[r.uuid] = __spreadProps(__spreadValues({}, r), { _stopResolving: true });
|
597
520
|
});
|
598
521
|
}
|
599
|
-
async resolveStories(
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
522
|
+
async resolveStories(t, e) {
|
523
|
+
var r, n;
|
524
|
+
let s = [];
|
525
|
+
if (typeof e.resolve_relations < "u" && e.resolve_relations.length > 0 && (s = e.resolve_relations.split(","), await this.resolveRelations(t, e)), e.resolve_links && ["1", "story", "url"].indexOf(e.resolve_links) > -1 && (((r = t.links) == null ? void 0 : r.length) || ((n = t.link_uuids) == null ? void 0 : n.length)) && await this.resolveLinks(t, e), this.resolveNestedRelations)
|
526
|
+
for (const c in this.relations)
|
527
|
+
this.iterateTree(this.relations[c], s);
|
528
|
+
t.story ? this.iterateTree(t.story, s) : t.stories.forEach((c) => {
|
529
|
+
this.iterateTree(c, s);
|
606
530
|
});
|
607
531
|
}
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
return e2;
|
616
|
-
this.iterateTree(r2, t2);
|
617
|
-
}
|
618
|
-
}
|
619
|
-
cacheResponse(e2, t2, s2) {
|
620
|
-
return s2 === void 0 && (s2 = 0), new Promise(async (r2, i2) => {
|
621
|
-
let n2 = a({ url: e2, params: t2 }), o2 = this.cacheProvider();
|
622
|
-
if (this.cache.clear === "auto" && t2.version === "draft" && await this.flushCache(), t2.version === "published" && e2 != "/cdn/spaces/me") {
|
623
|
-
const e3 = await o2.get(n2);
|
624
|
-
if (e3)
|
625
|
-
return r2(e3);
|
532
|
+
cacheResponse(t, e, s) {
|
533
|
+
return new Promise((r, n) => {
|
534
|
+
const c = this.helpers.stringify({ url: t, params: e }), o = this.cacheProvider();
|
535
|
+
if (this.cache.clear === "auto" && e.version === "draft" && this.flushCache(), e.version === "published" && t != "/cdn/spaces/me") {
|
536
|
+
const a = o.get(c);
|
537
|
+
if (a)
|
538
|
+
return r(a);
|
626
539
|
}
|
627
540
|
try {
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
541
|
+
(async () => {
|
542
|
+
var u;
|
543
|
+
const a = await this.throttle("get", t, e);
|
544
|
+
let h = { data: a.data, headers: a.headers };
|
545
|
+
if ((u = a.headers) != null && u["per-page"] && (h = Object.assign({}, h, {
|
546
|
+
perPage: a.headers["per-page"] ? parseInt(a.headers["per-page"]) : 0,
|
547
|
+
total: a.headers["per-page"] ? parseInt(a.headers.total) : 0
|
548
|
+
})), a.status != 200)
|
549
|
+
return n(a);
|
550
|
+
(h.data.story || h.data.stories) && await this.resolveStories(h.data, e), e.version === "published" && t != "/cdn/spaces/me" && o.set(c, h), h.data.cv && e.token && (e.version == "draft" && d[e.token] != h.data.cv && this.flushCache(), d[e.token] = h.data.cv), r(h);
|
551
|
+
})();
|
552
|
+
} catch {
|
636
553
|
}
|
637
|
-
var l2;
|
638
554
|
});
|
639
555
|
}
|
640
|
-
throttledRequest(
|
641
|
-
return this.client[
|
556
|
+
throttledRequest(t, e, s) {
|
557
|
+
return this.client[t](e, s);
|
642
558
|
}
|
643
559
|
cacheVersions() {
|
644
|
-
return
|
560
|
+
return d;
|
645
561
|
}
|
646
562
|
cacheVersion() {
|
647
|
-
return
|
563
|
+
return d[this.accessToken];
|
648
564
|
}
|
649
|
-
setCacheVersion(
|
650
|
-
this.accessToken && (
|
565
|
+
setCacheVersion(t) {
|
566
|
+
this.accessToken && (d[this.accessToken] = t);
|
651
567
|
}
|
652
568
|
cacheProvider() {
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
569
|
+
switch (this.cache.type) {
|
570
|
+
case "memory":
|
571
|
+
return {
|
572
|
+
get(t) {
|
573
|
+
return p[t];
|
574
|
+
},
|
575
|
+
getAll() {
|
576
|
+
return p;
|
577
|
+
},
|
578
|
+
set(t, e) {
|
579
|
+
p[t] = e;
|
580
|
+
},
|
581
|
+
flush() {
|
582
|
+
p = {};
|
583
|
+
}
|
584
|
+
};
|
585
|
+
default:
|
586
|
+
return {
|
587
|
+
get() {
|
588
|
+
},
|
589
|
+
getAll() {
|
590
|
+
},
|
591
|
+
set() {
|
592
|
+
},
|
593
|
+
flush() {
|
594
|
+
}
|
595
|
+
};
|
596
|
+
}
|
597
|
+
}
|
598
|
+
flushCache() {
|
599
|
+
return this.cacheProvider().flush(), this;
|
665
600
|
}
|
666
601
|
}
|
667
602
|
const apiFactory = (options = {}) => {
|
@@ -670,7 +605,7 @@ const apiFactory = (options = {}) => {
|
|
670
605
|
console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");
|
671
606
|
return;
|
672
607
|
}
|
673
|
-
const storyblokApi = new
|
608
|
+
const storyblokApi = new Q(apiOptions);
|
674
609
|
return { storyblokApi };
|
675
610
|
};
|
676
611
|
var editable = (blok) => {
|
@@ -725,7 +660,7 @@ const storyblokInit = (pluginOptions = {}) => {
|
|
725
660
|
if (bridge !== false) {
|
726
661
|
loadBridge(bridgeLatest);
|
727
662
|
}
|
728
|
-
richTextResolver = new
|
663
|
+
richTextResolver = new v(richText.schema);
|
729
664
|
if (richText.resolver) {
|
730
665
|
setComponentResolver(richTextResolver, richText.resolver);
|
731
666
|
}
|
@@ -757,7 +692,7 @@ const renderRichText = (data, options, resolverInstance) => {
|
|
757
692
|
return "";
|
758
693
|
}
|
759
694
|
if (options) {
|
760
|
-
localResolver = new
|
695
|
+
localResolver = new v(options.schema);
|
761
696
|
if (options.resolver) {
|
762
697
|
setComponentResolver(localResolver, options.resolver);
|
763
698
|
}
|
@@ -765,4 +700,4 @@ const renderRichText = (data, options, resolverInstance) => {
|
|
765
700
|
return localResolver.render(data);
|
766
701
|
};
|
767
702
|
const loadStoryblokBridge = () => loadBridge(bridgeLatest);
|
768
|
-
export {
|
703
|
+
export { apiFactory as apiPlugin, loadStoryblokBridge, useStoryblokBridge as registerStoryblokBridge, renderRichText, editable as storyblokEditable, storyblokInit, useStoryblokBridge };
|