@janbox/contentful-marketplace-sdk 2.0.1 → 3.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 +26 -11
- package/dist/client/index.d.ts +4 -1
- package/dist/entries/banner-collection.d.ts +9 -11
- package/dist/entries/blog-category.d.ts +2 -5
- package/dist/entries/blog-collection.d.ts +2 -4
- package/dist/entries/blog-post.d.ts +8 -6
- package/dist/entries/brand-collection.d.ts +7 -9
- package/dist/entries/documentation.d.ts +10 -9
- package/dist/entries/hyperlink-collection.d.ts +6 -7
- package/dist/entries/hyperlink.d.ts +6 -3
- package/dist/entries/keyword-collection.d.ts +5 -5
- package/dist/entries/policy-and-terms.d.ts +6 -6
- package/dist/index.cjs +2 -617
- package/dist/index.js +560 -975
- package/dist/types/cms.d.ts +61 -0
- package/dist/types/content-model.d.ts +108 -143
- package/dist/types/index.d.ts +4 -2
- package/dist/utils/query.d.ts +17 -0
- package/dist/utils/resolve.d.ts +31 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,1037 +1,622 @@
|
|
|
1
|
-
|
|
1
|
+
const m = "-sys.updatedAt", g = (e) => e ? {
|
|
2
|
+
"or.market.0.fields.markets[exists]": "false",
|
|
3
|
+
"or.market.1.fields.markets.sys.contentType.sys.id": "market",
|
|
4
|
+
"or.market.1.fields.markets.fields.code": e
|
|
5
|
+
} : {}, p = (e) => e ? {
|
|
6
|
+
"or.locale.0.fields.locale[exists]": "false",
|
|
7
|
+
"or.locale.1.fields.locale": e
|
|
8
|
+
} : {}, z = ({ id: e, slug: t }) => {
|
|
9
|
+
if (e)
|
|
10
|
+
return { "sys.id": e, limit: 1 };
|
|
11
|
+
if (t)
|
|
12
|
+
return { "fields.slug": t, limit: 1 };
|
|
13
|
+
throw new Error("Either id or slug is required.");
|
|
14
|
+
}, w = (e, t, i = 0) => {
|
|
15
|
+
const o = Math.max(1, Math.floor(e)), s = Math.max(1, Math.floor(t)), l = Math.max(0, Math.floor(i));
|
|
16
|
+
return {
|
|
17
|
+
page: o,
|
|
18
|
+
size: s,
|
|
19
|
+
params: {
|
|
20
|
+
limit: s,
|
|
21
|
+
skip: (o - 1) * s + l
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, N = (e) => {
|
|
25
|
+
const t = new URLSearchParams();
|
|
26
|
+
for (const [i, o] of Object.entries(e))
|
|
27
|
+
o !== void 0 && t.append(i, String(o));
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
class c {
|
|
2
31
|
static _config;
|
|
3
32
|
static get config() {
|
|
4
33
|
if (!this._config)
|
|
5
34
|
throw new Error("Client is not configured");
|
|
6
35
|
return this._config;
|
|
7
36
|
}
|
|
8
|
-
static configure(
|
|
9
|
-
this._config =
|
|
37
|
+
static configure(t) {
|
|
38
|
+
this._config = t;
|
|
10
39
|
}
|
|
11
|
-
static async
|
|
12
|
-
const { url:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
40
|
+
static async getEntries(t) {
|
|
41
|
+
const { url: i, headers: o = {} } = this.config, s = await fetch(
|
|
42
|
+
`${i.replace(/\/+$/, "")}/entries?${N(t)}`,
|
|
43
|
+
{
|
|
44
|
+
method: "GET",
|
|
45
|
+
headers: {
|
|
46
|
+
Accept: "application/json",
|
|
47
|
+
...o
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
if (!s.ok) {
|
|
52
|
+
const l = await s.text();
|
|
22
53
|
throw new Error(
|
|
23
|
-
`
|
|
24
|
-
${
|
|
54
|
+
`Request failed: ${s.status} ${s.statusText}
|
|
55
|
+
${l}`
|
|
25
56
|
);
|
|
26
57
|
}
|
|
27
|
-
|
|
28
|
-
if (s.errors)
|
|
29
|
-
throw new Error(
|
|
30
|
-
`GraphQL errors: ${JSON.stringify(s.errors, null, 2)}`
|
|
31
|
-
);
|
|
32
|
-
return s.data;
|
|
58
|
+
return s.json();
|
|
33
59
|
}
|
|
34
60
|
}
|
|
35
|
-
class
|
|
61
|
+
class h {
|
|
36
62
|
page;
|
|
37
63
|
total;
|
|
38
64
|
size;
|
|
39
65
|
items;
|
|
40
66
|
totalPages;
|
|
41
67
|
constructor({
|
|
42
|
-
page:
|
|
43
|
-
total:
|
|
44
|
-
size:
|
|
45
|
-
items:
|
|
68
|
+
page: t,
|
|
69
|
+
total: i,
|
|
70
|
+
size: o,
|
|
71
|
+
items: s
|
|
46
72
|
}) {
|
|
47
|
-
this.page =
|
|
73
|
+
this.page = t, this.total = i, this.size = o, this.items = s, this.totalPages = Math.ceil(this.total / this.size);
|
|
48
74
|
}
|
|
49
75
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
const f = (e) => {
|
|
77
|
+
const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
78
|
+
for (const s of [...e.items, ...e.includes?.Entry ?? []])
|
|
79
|
+
t.set(s.sys.id, s);
|
|
80
|
+
for (const s of e.includes?.Asset ?? [])
|
|
81
|
+
i.set(s.sys.id, s);
|
|
82
|
+
const o = (s) => (s && t.get(s.sys.id)) ?? null;
|
|
83
|
+
return {
|
|
84
|
+
entry: o,
|
|
85
|
+
asset: (s) => (s && i.get(s.sys.id)) ?? null,
|
|
86
|
+
entries: (s) => (s ?? []).map((l) => o(l)).filter((l) => l !== null)
|
|
87
|
+
};
|
|
88
|
+
}, n = (e) => e ?? null, C = (e) => {
|
|
89
|
+
const t = e?.fields.file;
|
|
90
|
+
return t ? {
|
|
91
|
+
url: t.url,
|
|
92
|
+
width: t.details.image?.width ?? null,
|
|
93
|
+
height: t.details.image?.height ?? null,
|
|
94
|
+
contentType: t.contentType
|
|
95
|
+
} : null;
|
|
96
|
+
}, G = (e) => ({
|
|
97
|
+
sys: { id: e.sys.id },
|
|
98
|
+
url: e.fields.file?.url,
|
|
99
|
+
width: e.fields.file?.details.image?.width ?? null,
|
|
100
|
+
height: e.fields.file?.details.image?.height ?? null,
|
|
101
|
+
contentType: e.fields.file?.contentType,
|
|
102
|
+
title: n(e.fields.title),
|
|
103
|
+
description: n(e.fields.description)
|
|
104
|
+
}), B = (e, t) => {
|
|
105
|
+
if (!e || typeof e != "object")
|
|
106
|
+
return t;
|
|
107
|
+
const i = e;
|
|
108
|
+
if (i.nodeType === "embedded-asset-block") {
|
|
109
|
+
const o = i.data?.target?.sys?.id;
|
|
110
|
+
o && !t.includes(o) && t.push(o);
|
|
111
|
+
}
|
|
112
|
+
for (const o of i.content ?? [])
|
|
113
|
+
B(o, t);
|
|
114
|
+
return t;
|
|
115
|
+
}, D = (e, t) => {
|
|
116
|
+
if (!e)
|
|
117
|
+
return null;
|
|
118
|
+
const i = B(e, []).map((o) => t.asset({ sys: { type: "Link", linkType: "Asset", id: o } })).filter((o) => o !== null && !!o.fields.file).map(G);
|
|
119
|
+
return { json: e, links: { assets: { block: i } } };
|
|
120
|
+
}, A = (e) => e ? {
|
|
121
|
+
metaTitle: n(e.fields.metaTitle),
|
|
122
|
+
metaDescription: n(e.fields.metaDescription),
|
|
123
|
+
metaKeywords: n(e.fields.metaKeywords),
|
|
124
|
+
metaRobots: n(e.fields.metaRobots)
|
|
125
|
+
} : null, v = (e) => e ? {
|
|
126
|
+
sys: { id: e.sys.id },
|
|
127
|
+
label: n(e.fields.label),
|
|
128
|
+
url: n(e.fields.url),
|
|
129
|
+
target: n(e.fields.target),
|
|
130
|
+
marketHandling: n(e.fields.marketHandling)
|
|
131
|
+
} : null, x = (e, t) => e ? {
|
|
132
|
+
name: n(e.fields.name),
|
|
133
|
+
avatar: C(t.asset(e.fields.avatar))
|
|
134
|
+
} : null, q = async ({
|
|
135
|
+
slot: e,
|
|
136
|
+
page: t = 1,
|
|
137
|
+
size: i = 20,
|
|
138
|
+
platform: o,
|
|
139
|
+
marketCode: s,
|
|
140
|
+
locale: l
|
|
57
141
|
}) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
slot
|
|
89
|
-
platform
|
|
90
|
-
bannersCollection {
|
|
91
|
-
items {
|
|
92
|
-
sys {
|
|
93
|
-
id
|
|
94
|
-
}
|
|
95
|
-
name
|
|
96
|
-
hyperlink {
|
|
97
|
-
sys {
|
|
98
|
-
id
|
|
99
|
-
}
|
|
100
|
-
label
|
|
101
|
-
url
|
|
102
|
-
target
|
|
103
|
-
marketHandling
|
|
104
|
-
}
|
|
105
|
-
media {
|
|
106
|
-
url
|
|
107
|
-
width
|
|
108
|
-
height
|
|
109
|
-
contentType
|
|
110
|
-
}
|
|
142
|
+
const d = w(t, i), a = await c.getEntries({
|
|
143
|
+
content_type: "bannerCollection",
|
|
144
|
+
"fields.slot": e,
|
|
145
|
+
"fields.platform": o || void 0,
|
|
146
|
+
select: "sys.id,fields.name,fields.slot,fields.platform,fields.banners",
|
|
147
|
+
include: 2,
|
|
148
|
+
order: m,
|
|
149
|
+
...d.params,
|
|
150
|
+
...g(s),
|
|
151
|
+
...p(l)
|
|
152
|
+
}), r = f(a);
|
|
153
|
+
return new h({
|
|
154
|
+
page: d.page,
|
|
155
|
+
total: a.total,
|
|
156
|
+
size: d.size,
|
|
157
|
+
items: a.items.map(
|
|
158
|
+
(u) => ({
|
|
159
|
+
sys: { id: u.sys.id },
|
|
160
|
+
name: n(u.fields.name),
|
|
161
|
+
slot: n(u.fields.slot),
|
|
162
|
+
platform: n(u.fields.platform),
|
|
163
|
+
bannersCollection: {
|
|
164
|
+
items: r.entries(u.fields.banners).map((E) => ({
|
|
165
|
+
sys: { id: E.sys.id },
|
|
166
|
+
name: n(E.fields.name),
|
|
167
|
+
hyperlink: v(
|
|
168
|
+
r.entry(E.fields.hyperlink)
|
|
169
|
+
),
|
|
170
|
+
media: C(r.asset(E.fields.media))
|
|
171
|
+
}))
|
|
111
172
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`, { bannerCollectionCollection: d } = await p.graphqlQuery(g, {
|
|
117
|
-
...a
|
|
118
|
-
});
|
|
119
|
-
return new $({
|
|
120
|
-
page: t,
|
|
121
|
-
total: d.total,
|
|
122
|
-
size: s,
|
|
123
|
-
items: d.items
|
|
173
|
+
})
|
|
174
|
+
)
|
|
124
175
|
});
|
|
125
176
|
};
|
|
126
|
-
class
|
|
127
|
-
constructor(...
|
|
128
|
-
super(
|
|
177
|
+
class k extends Response {
|
|
178
|
+
constructor(...t) {
|
|
179
|
+
super(t[0] ?? "Not Found", {
|
|
129
180
|
status: 404,
|
|
130
|
-
...
|
|
181
|
+
...t[1]
|
|
131
182
|
});
|
|
132
183
|
}
|
|
133
184
|
}
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
185
|
+
const I = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage", b = (e, t) => ({
|
|
186
|
+
sys: {
|
|
187
|
+
id: e.sys.id,
|
|
188
|
+
createdAt: e.sys.createdAt,
|
|
189
|
+
updatedAt: e.sys.updatedAt
|
|
190
|
+
},
|
|
191
|
+
title: n(e.fields.title),
|
|
192
|
+
shortDescription: n(e.fields.shortDescription),
|
|
193
|
+
slug: n(e.fields.slug),
|
|
194
|
+
categoriesCollection: {
|
|
195
|
+
items: t.entries(e.fields.categories).map((i) => ({
|
|
196
|
+
sys: { id: i.sys.id },
|
|
197
|
+
title: n(i.fields.title),
|
|
198
|
+
slug: n(i.fields.slug),
|
|
199
|
+
featuredImage: C(t.asset(i.fields.featuredImage))
|
|
200
|
+
}))
|
|
201
|
+
},
|
|
202
|
+
featuredImage: C(t.asset(e.fields.featuredImage))
|
|
203
|
+
}), U = async ({
|
|
204
|
+
marketCode: e,
|
|
205
|
+
locale: t,
|
|
206
|
+
collectionId: i,
|
|
207
|
+
categoryId: o,
|
|
208
|
+
page: s = 1,
|
|
209
|
+
size: l = 20,
|
|
210
|
+
skip: d = 0
|
|
142
211
|
} = {}) => {
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
featuredImage {
|
|
176
|
-
url
|
|
177
|
-
width
|
|
178
|
-
height
|
|
179
|
-
contentType
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
`, { blogCollectionCollection: A } = await p.graphqlQuery(b, {
|
|
187
|
-
collectionId: n,
|
|
188
|
-
limit: o,
|
|
189
|
-
skip: (s - 1) * o + a
|
|
190
|
-
}), f = A.items.at(0);
|
|
191
|
-
if (!f)
|
|
192
|
-
throw new y();
|
|
193
|
-
return new $({
|
|
194
|
-
page: s,
|
|
195
|
-
total: f.postsCollection?.total ?? 0,
|
|
196
|
-
size: o,
|
|
197
|
-
items: f.postsCollection?.items ?? []
|
|
212
|
+
const a = w(s, l, d);
|
|
213
|
+
if (i) {
|
|
214
|
+
const R = (await c.getEntries({
|
|
215
|
+
content_type: "blogCollection",
|
|
216
|
+
"sys.id": i,
|
|
217
|
+
select: "sys.id,fields.posts",
|
|
218
|
+
include: 0,
|
|
219
|
+
limit: 1
|
|
220
|
+
})).items.at(0);
|
|
221
|
+
if (!R)
|
|
222
|
+
throw new k();
|
|
223
|
+
const _ = (R.fields.posts ?? []).filter((y) => y.sys.linkType === "Entry").map((y) => y.sys.id), T = _.slice(a.params.skip, a.params.skip + a.size);
|
|
224
|
+
if (!T.length)
|
|
225
|
+
return new h({
|
|
226
|
+
page: a.page,
|
|
227
|
+
total: _.length,
|
|
228
|
+
size: a.size,
|
|
229
|
+
items: []
|
|
230
|
+
});
|
|
231
|
+
const P = await c.getEntries({
|
|
232
|
+
content_type: "blogPost",
|
|
233
|
+
"sys.id[in]": T.join(","),
|
|
234
|
+
select: I,
|
|
235
|
+
include: 2,
|
|
236
|
+
limit: a.size
|
|
237
|
+
}), H = f(P), K = new Map(P.items.map((y) => [y.sys.id, y]));
|
|
238
|
+
return new h({
|
|
239
|
+
page: a.page,
|
|
240
|
+
total: _.length,
|
|
241
|
+
size: a.size,
|
|
242
|
+
items: T.map((y) => K.get(y)).filter((y) => y !== void 0).map((y) => b(y, H))
|
|
198
243
|
});
|
|
199
244
|
}
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
)` : "", w = `
|
|
216
|
-
query${d} {
|
|
217
|
-
blogPostCollection${k} {
|
|
218
|
-
total
|
|
219
|
-
items {
|
|
220
|
-
sys {
|
|
221
|
-
id
|
|
222
|
-
createdAt: firstPublishedAt
|
|
223
|
-
updatedAt: publishedAt
|
|
224
|
-
}
|
|
225
|
-
title
|
|
226
|
-
shortDescription
|
|
227
|
-
slug
|
|
228
|
-
categoriesCollection {
|
|
229
|
-
items {
|
|
230
|
-
sys {
|
|
231
|
-
id
|
|
232
|
-
}
|
|
233
|
-
title
|
|
234
|
-
slug
|
|
235
|
-
featuredImage {
|
|
236
|
-
url
|
|
237
|
-
width
|
|
238
|
-
height
|
|
239
|
-
contentType
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
featuredImage {
|
|
244
|
-
url
|
|
245
|
-
width
|
|
246
|
-
height
|
|
247
|
-
contentType
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
`, { blogPostCollection: C } = await p.graphqlQuery(w, {
|
|
253
|
-
...h
|
|
254
|
-
});
|
|
255
|
-
return new $({
|
|
256
|
-
page: s,
|
|
257
|
-
total: C.total,
|
|
258
|
-
size: o,
|
|
259
|
-
items: C.items
|
|
245
|
+
const r = await c.getEntries({
|
|
246
|
+
content_type: "blogPost",
|
|
247
|
+
"fields.categories.sys.id": o || void 0,
|
|
248
|
+
select: I,
|
|
249
|
+
include: 2,
|
|
250
|
+
order: m,
|
|
251
|
+
...a.params,
|
|
252
|
+
...g(e),
|
|
253
|
+
...p(t)
|
|
254
|
+
}), u = f(r);
|
|
255
|
+
return new h({
|
|
256
|
+
page: a.page,
|
|
257
|
+
total: r.total,
|
|
258
|
+
size: a.size,
|
|
259
|
+
items: r.items.map((E) => b(E, u))
|
|
260
260
|
});
|
|
261
|
-
},
|
|
262
|
-
id:
|
|
263
|
-
slug:
|
|
264
|
-
marketCode:
|
|
265
|
-
locale:
|
|
261
|
+
}, Y = async ({
|
|
262
|
+
id: e,
|
|
263
|
+
slug: t,
|
|
264
|
+
marketCode: i,
|
|
265
|
+
locale: o
|
|
266
266
|
}) => {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
shortDescription
|
|
296
|
-
slug
|
|
297
|
-
categoriesCollection {
|
|
298
|
-
items {
|
|
299
|
-
sys {
|
|
300
|
-
id
|
|
301
|
-
}
|
|
302
|
-
title
|
|
303
|
-
slug
|
|
304
|
-
featuredImage {
|
|
305
|
-
url
|
|
306
|
-
width
|
|
307
|
-
height
|
|
308
|
-
contentType
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
featuredImage {
|
|
313
|
-
url
|
|
314
|
-
width
|
|
315
|
-
height
|
|
316
|
-
contentType
|
|
317
|
-
}
|
|
318
|
-
author {
|
|
319
|
-
name
|
|
320
|
-
avatar {
|
|
321
|
-
url
|
|
322
|
-
width
|
|
323
|
-
height
|
|
324
|
-
contentType
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
content {
|
|
328
|
-
json
|
|
329
|
-
links {
|
|
330
|
-
assets {
|
|
331
|
-
block {
|
|
332
|
-
sys {
|
|
333
|
-
id
|
|
334
|
-
}
|
|
335
|
-
url
|
|
336
|
-
width
|
|
337
|
-
height
|
|
338
|
-
contentType
|
|
339
|
-
title
|
|
340
|
-
description
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
seo {
|
|
346
|
-
metaTitle
|
|
347
|
-
metaDescription
|
|
348
|
-
metaKeywords
|
|
349
|
-
metaRobots
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
`, { blogPostCollection: u } = await p.graphqlQuery(a, {
|
|
355
|
-
...e
|
|
356
|
-
}), h = u.items.at(0);
|
|
357
|
-
if (!h)
|
|
358
|
-
throw new y();
|
|
359
|
-
return h;
|
|
360
|
-
}, D = async ({
|
|
361
|
-
marketCode: c,
|
|
362
|
-
locale: l,
|
|
363
|
-
page: n = 1,
|
|
364
|
-
size: r = 20
|
|
267
|
+
const s = z({ id: e, slug: t }), l = await c.getEntries({
|
|
268
|
+
content_type: "blogPost",
|
|
269
|
+
...s,
|
|
270
|
+
select: `${I},fields.author,fields.content,fields.seo`,
|
|
271
|
+
include: 2,
|
|
272
|
+
order: m,
|
|
273
|
+
...g(i),
|
|
274
|
+
...p(o)
|
|
275
|
+
}), d = l.items.at(0);
|
|
276
|
+
if (!d)
|
|
277
|
+
throw new k();
|
|
278
|
+
const a = f(l);
|
|
279
|
+
return {
|
|
280
|
+
...b(d, a),
|
|
281
|
+
author: x(a.entry(d.fields.author), a),
|
|
282
|
+
content: D(d.fields.content, a),
|
|
283
|
+
seo: A(a.entry(d.fields.seo))
|
|
284
|
+
};
|
|
285
|
+
}, S = "sys.id,fields.title,fields.slug,fields.featuredImage", L = (e, t) => ({
|
|
286
|
+
sys: { id: e.sys.id },
|
|
287
|
+
title: n(e.fields.title),
|
|
288
|
+
slug: n(e.fields.slug),
|
|
289
|
+
featuredImage: C(t.asset(e.fields.featuredImage))
|
|
290
|
+
}), J = async ({
|
|
291
|
+
marketCode: e,
|
|
292
|
+
locale: t,
|
|
293
|
+
page: i = 1,
|
|
294
|
+
size: o = 20
|
|
365
295
|
} = {}) => {
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
`)}
|
|
381
|
-
)` : "", m = `
|
|
382
|
-
query${u} {
|
|
383
|
-
blogCategoryCollection${h} {
|
|
384
|
-
total
|
|
385
|
-
items {
|
|
386
|
-
sys {
|
|
387
|
-
id
|
|
388
|
-
}
|
|
389
|
-
title
|
|
390
|
-
slug
|
|
391
|
-
featuredImage {
|
|
392
|
-
url
|
|
393
|
-
width
|
|
394
|
-
height
|
|
395
|
-
contentType
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
`, { blogCategoryCollection: g } = await p.graphqlQuery(m, {
|
|
401
|
-
...s
|
|
296
|
+
const s = w(i, o), l = await c.getEntries({
|
|
297
|
+
content_type: "blogCategory",
|
|
298
|
+
select: S,
|
|
299
|
+
include: 1,
|
|
300
|
+
order: m,
|
|
301
|
+
...s.params,
|
|
302
|
+
...g(e),
|
|
303
|
+
...p(t)
|
|
304
|
+
}), d = f(l);
|
|
305
|
+
return new h({
|
|
306
|
+
page: s.page,
|
|
307
|
+
total: l.total,
|
|
308
|
+
size: s.size,
|
|
309
|
+
items: l.items.map((a) => L(a, d))
|
|
402
310
|
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
});
|
|
409
|
-
}, z = async ({
|
|
410
|
-
id: c,
|
|
411
|
-
slug: l,
|
|
412
|
-
marketCode: n,
|
|
413
|
-
locale: r
|
|
311
|
+
}, Q = async ({
|
|
312
|
+
id: e,
|
|
313
|
+
slug: t,
|
|
314
|
+
marketCode: i,
|
|
315
|
+
locale: o
|
|
414
316
|
}) => {
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
sys {
|
|
438
|
-
id
|
|
439
|
-
}
|
|
440
|
-
title
|
|
441
|
-
slug
|
|
442
|
-
description
|
|
443
|
-
featuredImage {
|
|
444
|
-
url
|
|
445
|
-
width
|
|
446
|
-
height
|
|
447
|
-
contentType
|
|
448
|
-
}
|
|
449
|
-
seo {
|
|
450
|
-
metaTitle
|
|
451
|
-
metaDescription
|
|
452
|
-
metaKeywords
|
|
453
|
-
metaRobots
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
`, { blogCategoryCollection: u } = await p.graphqlQuery(a, {
|
|
459
|
-
...e
|
|
460
|
-
}), h = u.items.at(0);
|
|
461
|
-
if (!h)
|
|
462
|
-
throw new y();
|
|
463
|
-
return h;
|
|
464
|
-
}, M = async ({
|
|
465
|
-
marketCode: c,
|
|
466
|
-
locale: l,
|
|
467
|
-
page: n = 1,
|
|
468
|
-
size: r = 20
|
|
317
|
+
const s = z({ id: e, slug: t }), l = await c.getEntries({
|
|
318
|
+
content_type: "blogCategory",
|
|
319
|
+
...s,
|
|
320
|
+
select: `${S},fields.description,fields.seo`,
|
|
321
|
+
include: 1,
|
|
322
|
+
order: m,
|
|
323
|
+
...g(i),
|
|
324
|
+
...p(o)
|
|
325
|
+
}), d = l.items.at(0);
|
|
326
|
+
if (!d)
|
|
327
|
+
throw new k();
|
|
328
|
+
const a = f(l);
|
|
329
|
+
return {
|
|
330
|
+
...L(d, a),
|
|
331
|
+
description: n(d.fields.description),
|
|
332
|
+
seo: A(a.entry(d.fields.seo))
|
|
333
|
+
};
|
|
334
|
+
}, V = async ({
|
|
335
|
+
marketCode: e,
|
|
336
|
+
locale: t,
|
|
337
|
+
page: i = 1,
|
|
338
|
+
size: o = 20
|
|
469
339
|
} = {}) => {
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
)), a
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
name
|
|
493
|
-
type
|
|
494
|
-
order
|
|
495
|
-
sys {
|
|
496
|
-
id
|
|
497
|
-
}
|
|
498
|
-
category {
|
|
499
|
-
sys {
|
|
500
|
-
id
|
|
501
|
-
}
|
|
502
|
-
title
|
|
503
|
-
slug
|
|
504
|
-
}
|
|
505
|
-
featuredImage {
|
|
506
|
-
url
|
|
507
|
-
width
|
|
508
|
-
height
|
|
509
|
-
contentType
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
`, { blogCollectionCollection: g } = await p.graphqlQuery(m, {
|
|
515
|
-
...s
|
|
340
|
+
const s = w(i, o), l = await c.getEntries({
|
|
341
|
+
content_type: "blogCollection",
|
|
342
|
+
select: "sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",
|
|
343
|
+
include: 1,
|
|
344
|
+
order: m,
|
|
345
|
+
...s.params,
|
|
346
|
+
...g(e),
|
|
347
|
+
...p(t)
|
|
348
|
+
}), d = f(l), a = l.items.map((r) => {
|
|
349
|
+
const u = d.entry(r.fields.category);
|
|
350
|
+
return {
|
|
351
|
+
name: n(r.fields.name),
|
|
352
|
+
type: n(r.fields.type),
|
|
353
|
+
order: n(r.fields.order),
|
|
354
|
+
sys: { id: r.sys.id },
|
|
355
|
+
category: u ? {
|
|
356
|
+
sys: { id: u.sys.id },
|
|
357
|
+
title: n(u.fields.title),
|
|
358
|
+
slug: n(u.fields.slug)
|
|
359
|
+
} : null,
|
|
360
|
+
featuredImage: C(d.asset(r.fields.featuredImage))
|
|
361
|
+
};
|
|
516
362
|
});
|
|
517
|
-
return new
|
|
518
|
-
page:
|
|
519
|
-
total:
|
|
520
|
-
size:
|
|
521
|
-
items:
|
|
522
|
-
...
|
|
523
|
-
category:
|
|
524
|
-
categoryId:
|
|
525
|
-
collectionId:
|
|
363
|
+
return new h({
|
|
364
|
+
page: s.page,
|
|
365
|
+
total: l.total,
|
|
366
|
+
size: s.size,
|
|
367
|
+
items: a.map((r) => ({
|
|
368
|
+
...r,
|
|
369
|
+
category: r.type === "category" ? r.category : null,
|
|
370
|
+
categoryId: r.type === "category" ? r.category?.sys.id ?? null : null,
|
|
371
|
+
collectionId: r.type === "manual" ? r.sys.id : null
|
|
526
372
|
}))
|
|
527
373
|
});
|
|
528
|
-
},
|
|
529
|
-
page:
|
|
530
|
-
size:
|
|
531
|
-
marketCode:
|
|
532
|
-
locale:
|
|
374
|
+
}, W = async ({
|
|
375
|
+
page: e = 1,
|
|
376
|
+
size: t = 20,
|
|
377
|
+
marketCode: i,
|
|
378
|
+
locale: o
|
|
533
379
|
} = {}) => {
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
name
|
|
562
|
-
slot
|
|
563
|
-
brandsCollection {
|
|
564
|
-
items {
|
|
565
|
-
sys {
|
|
566
|
-
id
|
|
567
|
-
}
|
|
568
|
-
name
|
|
569
|
-
logo {
|
|
570
|
-
url
|
|
571
|
-
width
|
|
572
|
-
height
|
|
573
|
-
contentType
|
|
574
|
-
}
|
|
575
|
-
hyperlink {
|
|
576
|
-
sys {
|
|
577
|
-
id
|
|
578
|
-
}
|
|
579
|
-
label
|
|
580
|
-
url
|
|
581
|
-
target
|
|
582
|
-
marketHandling
|
|
583
|
-
}
|
|
380
|
+
const s = w(e, t), l = await c.getEntries({
|
|
381
|
+
content_type: "brandCollection",
|
|
382
|
+
select: "sys.id,fields.name,fields.slot,fields.brands",
|
|
383
|
+
include: 2,
|
|
384
|
+
order: m,
|
|
385
|
+
...s.params,
|
|
386
|
+
...g(i),
|
|
387
|
+
...p(o)
|
|
388
|
+
}), d = f(l);
|
|
389
|
+
return new h({
|
|
390
|
+
page: s.page,
|
|
391
|
+
total: l.total,
|
|
392
|
+
size: s.size,
|
|
393
|
+
items: l.items.map(
|
|
394
|
+
(a) => ({
|
|
395
|
+
sys: { id: a.sys.id },
|
|
396
|
+
name: n(a.fields.name),
|
|
397
|
+
slot: n(a.fields.slot),
|
|
398
|
+
brandsCollection: {
|
|
399
|
+
items: d.entries(a.fields.brands).map((r) => ({
|
|
400
|
+
sys: { id: r.sys.id },
|
|
401
|
+
name: n(r.fields.name),
|
|
402
|
+
logo: C(d.asset(r.fields.logo)),
|
|
403
|
+
hyperlink: v(
|
|
404
|
+
d.entry(r.fields.hyperlink)
|
|
405
|
+
)
|
|
406
|
+
}))
|
|
584
407
|
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
`, { brandCollectionCollection: m } = await p.graphqlQuery(h, {
|
|
590
|
-
...s
|
|
408
|
+
})
|
|
409
|
+
)
|
|
591
410
|
});
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
411
|
+
}, M = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo", $ = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category", O = (e) => ({
|
|
412
|
+
id: e.sys.id,
|
|
413
|
+
createdAt: e.sys.createdAt,
|
|
414
|
+
updatedAt: e.sys.updatedAt
|
|
415
|
+
}), j = (e, t) => ({
|
|
416
|
+
sys: O(e),
|
|
417
|
+
title: n(e.fields.title),
|
|
418
|
+
slug: n(e.fields.slug),
|
|
419
|
+
description: n(e.fields.description),
|
|
420
|
+
order: n(e.fields.order),
|
|
421
|
+
seo: A(t.entry(e.fields.seo))
|
|
422
|
+
}), F = (e, t) => {
|
|
423
|
+
const i = t.entry(e.fields.category);
|
|
424
|
+
return {
|
|
425
|
+
sys: O(e),
|
|
426
|
+
title: n(e.fields.title),
|
|
427
|
+
slug: n(e.fields.slug),
|
|
428
|
+
author: x(t.entry(e.fields.author), t),
|
|
429
|
+
category: i ? {
|
|
430
|
+
title: n(i.fields.title),
|
|
431
|
+
slug: n(i.fields.slug),
|
|
432
|
+
description: n(i.fields.description),
|
|
433
|
+
order: n(i.fields.order)
|
|
434
|
+
} : null
|
|
435
|
+
};
|
|
436
|
+
}, X = async ({
|
|
437
|
+
marketCode: e,
|
|
438
|
+
locale: t,
|
|
439
|
+
page: i = 1,
|
|
440
|
+
size: o = 20
|
|
603
441
|
} = {}) => {
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
)
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
|
|
619
|
-
${o.join(`
|
|
620
|
-
`)}
|
|
621
|
-
)` : "", m = `
|
|
622
|
-
query${u} {
|
|
623
|
-
documentationCategoryCollection${h} {
|
|
624
|
-
total
|
|
625
|
-
items {
|
|
626
|
-
sys {
|
|
627
|
-
id
|
|
628
|
-
createdAt: firstPublishedAt
|
|
629
|
-
updatedAt: publishedAt
|
|
630
|
-
}
|
|
631
|
-
title
|
|
632
|
-
slug
|
|
633
|
-
description
|
|
634
|
-
order
|
|
635
|
-
seo {
|
|
636
|
-
metaTitle
|
|
637
|
-
metaDescription
|
|
638
|
-
metaKeywords
|
|
639
|
-
metaRobots
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
`, { documentationCategoryCollection: g } = await p.graphqlQuery(m, {
|
|
645
|
-
...s
|
|
646
|
-
});
|
|
647
|
-
return new $({
|
|
648
|
-
page: i,
|
|
649
|
-
total: g.total,
|
|
650
|
-
size: e,
|
|
651
|
-
items: g.items
|
|
442
|
+
const s = w(i, o), l = await c.getEntries({
|
|
443
|
+
content_type: "documentationCategory",
|
|
444
|
+
select: M,
|
|
445
|
+
include: 1,
|
|
446
|
+
order: m,
|
|
447
|
+
...s.params,
|
|
448
|
+
...g(e),
|
|
449
|
+
...p(t)
|
|
450
|
+
}), d = f(l);
|
|
451
|
+
return new h({
|
|
452
|
+
page: s.page,
|
|
453
|
+
total: l.total,
|
|
454
|
+
size: s.size,
|
|
455
|
+
items: l.items.map((a) => j(a, d))
|
|
652
456
|
});
|
|
653
|
-
},
|
|
654
|
-
id:
|
|
655
|
-
slug:
|
|
656
|
-
marketCode:
|
|
657
|
-
locale:
|
|
457
|
+
}, Z = async ({
|
|
458
|
+
id: e,
|
|
459
|
+
slug: t,
|
|
460
|
+
marketCode: i,
|
|
461
|
+
locale: o
|
|
658
462
|
}) => {
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
));
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
]
|
|
678
|
-
}
|
|
679
|
-
)`, a = `
|
|
680
|
-
query${s} {
|
|
681
|
-
documentationCategoryCollection${o} {
|
|
682
|
-
items {
|
|
683
|
-
sys {
|
|
684
|
-
id
|
|
685
|
-
createdAt: firstPublishedAt
|
|
686
|
-
updatedAt: publishedAt
|
|
687
|
-
}
|
|
688
|
-
title
|
|
689
|
-
slug
|
|
690
|
-
description
|
|
691
|
-
order
|
|
692
|
-
seo {
|
|
693
|
-
metaTitle
|
|
694
|
-
metaDescription
|
|
695
|
-
metaKeywords
|
|
696
|
-
metaRobots
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
`, { documentationCategoryCollection: u } = await p.graphqlQuery(a, {
|
|
702
|
-
...e
|
|
703
|
-
}), h = u.items.at(0);
|
|
704
|
-
if (!h)
|
|
705
|
-
throw new y();
|
|
706
|
-
return h;
|
|
707
|
-
}, I = async ({
|
|
708
|
-
marketCode: c,
|
|
709
|
-
locale: l,
|
|
710
|
-
categorySlug: n,
|
|
711
|
-
page: r = 1,
|
|
712
|
-
size: i = 20
|
|
463
|
+
const s = z({ id: e, slug: t }), l = await c.getEntries({
|
|
464
|
+
content_type: "documentationCategory",
|
|
465
|
+
...s,
|
|
466
|
+
select: M,
|
|
467
|
+
include: 1,
|
|
468
|
+
order: m,
|
|
469
|
+
...g(i),
|
|
470
|
+
...p(o)
|
|
471
|
+
}), d = l.items.at(0);
|
|
472
|
+
if (!d)
|
|
473
|
+
throw new k();
|
|
474
|
+
return j(d, f(l));
|
|
475
|
+
}, ee = async ({
|
|
476
|
+
marketCode: e,
|
|
477
|
+
locale: t,
|
|
478
|
+
categorySlug: i,
|
|
479
|
+
page: o = 1,
|
|
480
|
+
size: s = 20
|
|
713
481
|
} = {}) => {
|
|
714
|
-
const
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
${a.join(`
|
|
730
|
-
`)}
|
|
731
|
-
)` : "", g = `
|
|
732
|
-
query${h} {
|
|
733
|
-
documentationArticleCollection${m} {
|
|
734
|
-
total
|
|
735
|
-
items {
|
|
736
|
-
sys {
|
|
737
|
-
id
|
|
738
|
-
createdAt: firstPublishedAt
|
|
739
|
-
updatedAt: publishedAt
|
|
740
|
-
}
|
|
741
|
-
title
|
|
742
|
-
slug
|
|
743
|
-
author {
|
|
744
|
-
name
|
|
745
|
-
avatar {
|
|
746
|
-
url
|
|
747
|
-
width
|
|
748
|
-
height
|
|
749
|
-
contentType
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
category {
|
|
753
|
-
title
|
|
754
|
-
slug
|
|
755
|
-
description
|
|
756
|
-
order
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
`, { documentationArticleCollection: d } = await p.graphqlQuery(g, {
|
|
762
|
-
...o
|
|
763
|
-
});
|
|
764
|
-
return new $({
|
|
765
|
-
page: e,
|
|
482
|
+
const l = w(o, s), d = await c.getEntries({
|
|
483
|
+
content_type: "documentationArticle",
|
|
484
|
+
...i ? {
|
|
485
|
+
"fields.category.sys.contentType.sys.id": "documentationCategory",
|
|
486
|
+
"fields.category.fields.slug": i
|
|
487
|
+
} : {},
|
|
488
|
+
select: $,
|
|
489
|
+
include: 2,
|
|
490
|
+
order: m,
|
|
491
|
+
...l.params,
|
|
492
|
+
...g(e),
|
|
493
|
+
...p(t)
|
|
494
|
+
}), a = f(d);
|
|
495
|
+
return new h({
|
|
496
|
+
page: l.page,
|
|
766
497
|
total: d.total,
|
|
767
|
-
size:
|
|
768
|
-
items: d.items
|
|
498
|
+
size: l.size,
|
|
499
|
+
items: d.items.map((r) => F(r, a))
|
|
769
500
|
});
|
|
770
|
-
},
|
|
771
|
-
id:
|
|
772
|
-
slug:
|
|
773
|
-
marketCode:
|
|
774
|
-
locale:
|
|
501
|
+
}, te = async ({
|
|
502
|
+
id: e,
|
|
503
|
+
slug: t,
|
|
504
|
+
marketCode: i,
|
|
505
|
+
locale: o
|
|
775
506
|
}) => {
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
)
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
documentationArticleCollection${o} {
|
|
799
|
-
items {
|
|
800
|
-
sys {
|
|
801
|
-
id
|
|
802
|
-
createdAt: firstPublishedAt
|
|
803
|
-
updatedAt: publishedAt
|
|
804
|
-
}
|
|
805
|
-
title
|
|
806
|
-
slug
|
|
807
|
-
content {
|
|
808
|
-
json
|
|
809
|
-
links {
|
|
810
|
-
assets {
|
|
811
|
-
block {
|
|
812
|
-
sys {
|
|
813
|
-
id
|
|
814
|
-
}
|
|
815
|
-
url
|
|
816
|
-
width
|
|
817
|
-
height
|
|
818
|
-
contentType
|
|
819
|
-
title
|
|
820
|
-
description
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
author {
|
|
826
|
-
name
|
|
827
|
-
avatar {
|
|
828
|
-
url
|
|
829
|
-
width
|
|
830
|
-
height
|
|
831
|
-
contentType
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
category {
|
|
835
|
-
title
|
|
836
|
-
slug
|
|
837
|
-
description
|
|
838
|
-
order
|
|
839
|
-
}
|
|
840
|
-
seo {
|
|
841
|
-
metaTitle
|
|
842
|
-
metaDescription
|
|
843
|
-
metaKeywords
|
|
844
|
-
metaRobots
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
`, { documentationArticleCollection: u } = await p.graphqlQuery(a, {
|
|
850
|
-
...e
|
|
851
|
-
}), h = u.items.at(0);
|
|
852
|
-
if (!h)
|
|
853
|
-
throw new y();
|
|
854
|
-
return h;
|
|
855
|
-
}, T = async ({
|
|
856
|
-
page: c = 1,
|
|
857
|
-
size: l = 20,
|
|
858
|
-
marketCode: n,
|
|
859
|
-
locale: r
|
|
507
|
+
const s = z({ id: e, slug: t }), l = await c.getEntries({
|
|
508
|
+
content_type: "documentationArticle",
|
|
509
|
+
...s,
|
|
510
|
+
select: `${$},fields.content,fields.seo`,
|
|
511
|
+
include: 2,
|
|
512
|
+
order: m,
|
|
513
|
+
...g(i),
|
|
514
|
+
...p(o)
|
|
515
|
+
}), d = l.items.at(0);
|
|
516
|
+
if (!d)
|
|
517
|
+
throw new k();
|
|
518
|
+
const a = f(l);
|
|
519
|
+
return {
|
|
520
|
+
...F(d, a),
|
|
521
|
+
content: D(d.fields.content, a),
|
|
522
|
+
seo: A(a.entry(d.fields.seo))
|
|
523
|
+
};
|
|
524
|
+
}, se = async ({
|
|
525
|
+
page: e = 1,
|
|
526
|
+
size: t = 20,
|
|
527
|
+
marketCode: i,
|
|
528
|
+
locale: o
|
|
860
529
|
} = {}) => {
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
)`, h = `
|
|
883
|
-
query${a} {
|
|
884
|
-
hyperlinkCollectionCollection${u} {
|
|
885
|
-
total
|
|
886
|
-
items {
|
|
887
|
-
sys {
|
|
888
|
-
id
|
|
889
|
-
}
|
|
890
|
-
name
|
|
891
|
-
slot
|
|
892
|
-
order
|
|
893
|
-
linksCollection {
|
|
894
|
-
items {
|
|
895
|
-
sys {
|
|
896
|
-
id
|
|
897
|
-
}
|
|
898
|
-
label
|
|
899
|
-
url
|
|
900
|
-
target
|
|
901
|
-
marketHandling
|
|
530
|
+
const s = w(e, t), l = await c.getEntries({
|
|
531
|
+
content_type: "hyperlinkCollection",
|
|
532
|
+
select: "sys.id,fields.name,fields.slot,fields.order,fields.links",
|
|
533
|
+
include: 1,
|
|
534
|
+
order: "fields.order",
|
|
535
|
+
...s.params,
|
|
536
|
+
...g(i),
|
|
537
|
+
...p(o)
|
|
538
|
+
}), d = f(l);
|
|
539
|
+
return new h({
|
|
540
|
+
page: s.page,
|
|
541
|
+
total: l.total,
|
|
542
|
+
size: s.size,
|
|
543
|
+
items: l.items.map(
|
|
544
|
+
(a) => ({
|
|
545
|
+
sys: { id: a.sys.id },
|
|
546
|
+
name: n(a.fields.name),
|
|
547
|
+
slot: n(a.fields.slot),
|
|
548
|
+
order: n(a.fields.order),
|
|
549
|
+
linksCollection: {
|
|
550
|
+
items: d.entries(a.fields.links).map((r) => v(r))
|
|
902
551
|
}
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
`, { hyperlinkCollectionCollection: m } = await p.graphqlQuery(
|
|
908
|
-
h,
|
|
909
|
-
{
|
|
910
|
-
...s
|
|
911
|
-
}
|
|
912
|
-
);
|
|
913
|
-
return new $({
|
|
914
|
-
page: i,
|
|
915
|
-
total: m.total,
|
|
916
|
-
size: e,
|
|
917
|
-
items: m.items
|
|
552
|
+
})
|
|
553
|
+
)
|
|
918
554
|
});
|
|
919
|
-
},
|
|
920
|
-
page:
|
|
921
|
-
size:
|
|
922
|
-
marketCode:
|
|
923
|
-
locale:
|
|
555
|
+
}, ie = async ({
|
|
556
|
+
page: e = 1,
|
|
557
|
+
size: t = 20,
|
|
558
|
+
marketCode: i,
|
|
559
|
+
locale: o
|
|
924
560
|
} = {}) => {
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
limit: $limit
|
|
934
|
-
skip: $skip
|
|
935
|
-
where: {
|
|
936
|
-
AND: [
|
|
937
|
-
${o.join(`
|
|
938
|
-
`)}
|
|
939
|
-
]
|
|
940
|
-
}
|
|
941
|
-
)` : `(
|
|
942
|
-
limit: $limit
|
|
943
|
-
skip: $skip
|
|
944
|
-
)`, h = `
|
|
945
|
-
query${a} {
|
|
946
|
-
keywordCollectionCollection${u} {
|
|
947
|
-
total
|
|
948
|
-
items {
|
|
949
|
-
sys {
|
|
950
|
-
id
|
|
951
|
-
}
|
|
952
|
-
name
|
|
953
|
-
slot
|
|
954
|
-
keywords
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
`, { keywordCollectionCollection: m } = await p.graphqlQuery(h, {
|
|
959
|
-
...s
|
|
561
|
+
const s = w(e, t), l = await c.getEntries({
|
|
562
|
+
content_type: "keywordCollection",
|
|
563
|
+
select: "sys.id,fields.name,fields.slot,fields.keywords",
|
|
564
|
+
include: 0,
|
|
565
|
+
order: m,
|
|
566
|
+
...s.params,
|
|
567
|
+
...g(i),
|
|
568
|
+
...p(o)
|
|
960
569
|
});
|
|
961
|
-
return new
|
|
962
|
-
page:
|
|
963
|
-
total:
|
|
964
|
-
size:
|
|
965
|
-
items:
|
|
570
|
+
return new h({
|
|
571
|
+
page: s.page,
|
|
572
|
+
total: l.total,
|
|
573
|
+
size: s.size,
|
|
574
|
+
items: l.items.map(
|
|
575
|
+
(d) => ({
|
|
576
|
+
sys: { id: d.sys.id },
|
|
577
|
+
name: n(d.fields.name),
|
|
578
|
+
slot: n(d.fields.slot),
|
|
579
|
+
keywords: n(d.fields.keywords)
|
|
580
|
+
})
|
|
581
|
+
)
|
|
966
582
|
});
|
|
967
|
-
},
|
|
968
|
-
marketCode:
|
|
969
|
-
locale:
|
|
583
|
+
}, oe = async ({
|
|
584
|
+
marketCode: e,
|
|
585
|
+
locale: t
|
|
970
586
|
} = {}) => {
|
|
971
|
-
const
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
limit: 1
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
id
|
|
989
|
-
}
|
|
990
|
-
title
|
|
991
|
-
locale
|
|
992
|
-
content {
|
|
993
|
-
json
|
|
994
|
-
links {
|
|
995
|
-
assets {
|
|
996
|
-
block {
|
|
997
|
-
sys {
|
|
998
|
-
id
|
|
999
|
-
}
|
|
1000
|
-
url
|
|
1001
|
-
width
|
|
1002
|
-
height
|
|
1003
|
-
contentType
|
|
1004
|
-
title
|
|
1005
|
-
description
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
`, { policyAndTermsCollection: o } = await p.graphqlQuery(s, {
|
|
1014
|
-
...r
|
|
1015
|
-
}), a = o.items.at(0);
|
|
1016
|
-
if (!a)
|
|
1017
|
-
throw new y();
|
|
1018
|
-
return a;
|
|
587
|
+
const i = await c.getEntries({
|
|
588
|
+
content_type: "policyAndTerms",
|
|
589
|
+
select: "sys.id,fields.title,fields.locale,fields.content",
|
|
590
|
+
include: 1,
|
|
591
|
+
order: m,
|
|
592
|
+
limit: 1,
|
|
593
|
+
...g(e),
|
|
594
|
+
...p(t)
|
|
595
|
+
}), o = i.items.at(0);
|
|
596
|
+
if (!o)
|
|
597
|
+
throw new k();
|
|
598
|
+
return {
|
|
599
|
+
sys: { id: o.sys.id },
|
|
600
|
+
title: n(o.fields.title),
|
|
601
|
+
locale: n(o.fields.locale),
|
|
602
|
+
content: D(o.fields.content, f(i))
|
|
603
|
+
};
|
|
1019
604
|
};
|
|
1020
605
|
export {
|
|
1021
|
-
|
|
1022
|
-
|
|
606
|
+
c as ContentfulSDK,
|
|
607
|
+
h as PaginatedResponse,
|
|
1023
608
|
q as getBannerCollections,
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
609
|
+
J as getBlogCategories,
|
|
610
|
+
Q as getBlogCategoryDetail,
|
|
611
|
+
V as getBlogCollections,
|
|
612
|
+
Y as getBlogPostDetail,
|
|
613
|
+
U as getBlogPosts,
|
|
614
|
+
W as getBrandCollections,
|
|
615
|
+
te as getDocArticleDetail,
|
|
616
|
+
ee as getDocArticles,
|
|
617
|
+
X as getDocCategories,
|
|
618
|
+
Z as getDocCategoryDetail,
|
|
619
|
+
se as getHyperlinkCollections,
|
|
620
|
+
ie as getKeywordCollections,
|
|
621
|
+
oe as getPolicyAndTerms
|
|
1037
622
|
};
|