@janbox/contentful-marketplace-sdk 1.0.21 → 2.0.1

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/dist/index.js CHANGED
@@ -1,644 +1,73 @@
1
- var At = Function.prototype.toString, O = Object.create, Ot = Object.prototype.toString, jt = (
2
- /** @class */
3
- (function() {
4
- function t() {
5
- this._keys = [], this._values = [];
6
- }
7
- return t.prototype.has = function(e) {
8
- return !!~this._keys.indexOf(e);
9
- }, t.prototype.get = function(e) {
10
- return this._values[this._keys.indexOf(e)];
11
- }, t.prototype.set = function(e, r) {
12
- this._keys.push(e), this._values.push(r);
13
- }, t;
14
- })()
15
- );
16
- function Tt() {
17
- return new jt();
18
- }
19
- function qt() {
20
- return /* @__PURE__ */ new WeakMap();
21
- }
22
- var _t = typeof WeakMap < "u" ? qt : Tt;
23
- function Q(t) {
24
- if (!t)
25
- return O(null);
26
- var e = t.constructor;
27
- if (e === Object)
28
- return t === Object.prototype ? {} : O(t);
29
- if (e && ~At.call(e).indexOf("[native code]"))
30
- try {
31
- return new e();
32
- } catch {
33
- }
34
- return O(t);
35
- }
36
- function Pt(t) {
37
- var e = "";
38
- return t.global && (e += "g"), t.ignoreCase && (e += "i"), t.multiline && (e += "m"), t.unicode && (e += "u"), t.sticky && (e += "y"), e;
39
- }
40
- function xt(t) {
41
- return t.flags;
42
- }
43
- var It = /test/g.flags === "g" ? xt : Pt;
44
- function lt(t) {
45
- var e = Ot.call(t);
46
- return e.substring(8, e.length - 1);
47
- }
48
- function Rt(t) {
49
- return t[Symbol.toStringTag] || lt(t);
50
- }
51
- var Dt = typeof Symbol < "u" ? Rt : lt, Mt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, ct = Object.getOwnPropertyNames, F = Object.getOwnPropertySymbols, ut = Object.prototype, ft = ut.hasOwnProperty, Et = ut.propertyIsEnumerable, gt = typeof F == "function";
52
- function Lt(t) {
53
- return ct(t).concat(F(t));
54
- }
55
- var Vt = gt ? Lt : ct;
56
- function k(t, e, r) {
57
- for (var a = Vt(t), s = 0, n = a.length, o = void 0, i = void 0; s < n; ++s)
58
- if (o = a[s], !(o === "callee" || o === "caller")) {
59
- if (i = zt(t, o), !i) {
60
- e[o] = r.copier(t[o], r);
61
- continue;
62
- }
63
- !i.get && !i.set && (i.value = r.copier(i.value, r));
64
- try {
65
- Mt(e, o, i);
66
- } catch {
67
- e[o] = i.value;
68
- }
69
- }
70
- return e;
71
- }
72
- function Nt(t, e) {
73
- var r = new e.Constructor();
74
- e.cache.set(t, r);
75
- for (var a = 0, s = t.length; a < s; ++a)
76
- r[a] = e.copier(t[a], e);
77
- return r;
78
- }
79
- function Bt(t, e) {
80
- var r = new e.Constructor();
81
- return e.cache.set(t, r), k(t, r, e);
82
- }
83
- function ht(t, e) {
84
- return t.slice(0);
85
- }
86
- function Qt(t, e) {
87
- return t.slice(0, t.size, t.type);
88
- }
89
- function Ft(t, e) {
90
- return new e.Constructor(ht(t.buffer));
91
- }
92
- function Gt(t, e) {
93
- return new e.Constructor(t.getTime());
94
- }
95
- function pt(t, e) {
96
- var r = new e.Constructor();
97
- return e.cache.set(t, r), t.forEach(function(a, s) {
98
- r.set(s, e.copier(a, e));
99
- }), r;
100
- }
101
- function Ut(t, e) {
102
- return k(t, pt(t, e), e);
103
- }
104
- function Kt(t, e) {
105
- var r = Q(e.prototype);
106
- e.cache.set(t, r);
107
- for (var a in t)
108
- ft.call(t, a) && (r[a] = e.copier(t[a], e));
109
- return r;
110
- }
111
- function Wt(t, e) {
112
- var r = Q(e.prototype);
113
- e.cache.set(t, r);
114
- for (var a in t)
115
- ft.call(t, a) && (r[a] = e.copier(t[a], e));
116
- for (var s = F(t), n = 0, o = s.length, i = void 0; n < o; ++n)
117
- i = s[n], Et.call(t, i) && (r[i] = e.copier(t[i], e));
118
- return r;
119
- }
120
- var Jt = gt ? Wt : Kt;
121
- function Ht(t, e) {
122
- var r = Q(e.prototype);
123
- return e.cache.set(t, r), k(t, r, e);
124
- }
125
- function j(t, e) {
126
- return new e.Constructor(t.valueOf());
127
- }
128
- function Yt(t, e) {
129
- var r = new e.Constructor(t.source, It(t));
130
- return r.lastIndex = t.lastIndex, r;
131
- }
132
- function S(t, e) {
133
- return t;
134
- }
135
- function mt(t, e) {
136
- var r = new e.Constructor();
137
- return e.cache.set(t, r), t.forEach(function(a) {
138
- r.add(e.copier(a, e));
139
- }), r;
140
- }
141
- function Xt(t, e) {
142
- return k(t, mt(t, e), e);
143
- }
144
- var Zt = Array.isArray, G = Object.assign, te = Object.getPrototypeOf || (function(t) {
145
- return t.__proto__;
146
- }), yt = {
147
- array: Nt,
148
- arrayBuffer: ht,
149
- blob: Qt,
150
- dataView: Ft,
151
- date: Gt,
152
- error: S,
153
- map: pt,
154
- object: Jt,
155
- regExp: Yt,
156
- set: mt
157
- }, ee = G({}, yt, {
158
- array: Bt,
159
- map: Ut,
160
- object: Ht,
161
- set: Xt
162
- });
163
- function re(t) {
164
- return {
165
- Arguments: t.object,
166
- Array: t.array,
167
- ArrayBuffer: t.arrayBuffer,
168
- Blob: t.blob,
169
- Boolean: j,
170
- DataView: t.dataView,
171
- Date: t.date,
172
- Error: t.error,
173
- Float32Array: t.arrayBuffer,
174
- Float64Array: t.arrayBuffer,
175
- Int8Array: t.arrayBuffer,
176
- Int16Array: t.arrayBuffer,
177
- Int32Array: t.arrayBuffer,
178
- Map: t.map,
179
- Number: j,
180
- Object: t.object,
181
- Promise: S,
182
- RegExp: t.regExp,
183
- Set: t.set,
184
- String: j,
185
- WeakMap: S,
186
- WeakSet: S,
187
- Uint8Array: t.arrayBuffer,
188
- Uint8ClampedArray: t.arrayBuffer,
189
- Uint16Array: t.arrayBuffer,
190
- Uint32Array: t.arrayBuffer,
191
- Uint64Array: t.arrayBuffer
192
- };
193
- }
194
- function dt(t) {
195
- var e = G({}, yt, t), r = re(e), a = r.Array, s = r.Object;
196
- function n(o, i) {
197
- if (i.prototype = i.Constructor = void 0, !o || typeof o != "object")
198
- return o;
199
- if (i.cache.has(o))
200
- return i.cache.get(o);
201
- if (i.prototype = te(o), i.Constructor = i.prototype && i.prototype.constructor, !i.Constructor || i.Constructor === Object)
202
- return s(o, i);
203
- if (Zt(o))
204
- return a(o, i);
205
- var l = r[Dt(o)];
206
- return l ? l(o, i) : typeof o.then == "function" ? o : s(o, i);
207
- }
208
- return function(i) {
209
- return n(i, {
210
- Constructor: void 0,
211
- cache: _t(),
212
- copier: n,
213
- prototype: void 0
214
- });
215
- };
216
- }
217
- function oe(t) {
218
- return dt(G({}, ee, t));
219
- }
220
- oe({});
221
- dt({});
222
- var C = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, T = { exports: {} }, U;
223
- function ie() {
224
- if (U) return T.exports;
225
- U = 1;
226
- var t = T.exports = {}, e, r;
227
- function a() {
228
- throw new Error("setTimeout has not been defined");
229
- }
230
- function s() {
231
- throw new Error("clearTimeout has not been defined");
232
- }
233
- (function() {
234
- try {
235
- typeof setTimeout == "function" ? e = setTimeout : e = a;
236
- } catch {
237
- e = a;
238
- }
239
- try {
240
- typeof clearTimeout == "function" ? r = clearTimeout : r = s;
241
- } catch {
242
- r = s;
243
- }
244
- })();
245
- function n(p) {
246
- if (e === setTimeout)
247
- return setTimeout(p, 0);
248
- if ((e === a || !e) && setTimeout)
249
- return e = setTimeout, setTimeout(p, 0);
250
- try {
251
- return e(p, 0);
252
- } catch {
253
- try {
254
- return e.call(null, p, 0);
255
- } catch {
256
- return e.call(this, p, 0);
257
- }
258
- }
259
- }
260
- function o(p) {
261
- if (r === clearTimeout)
262
- return clearTimeout(p);
263
- if ((r === s || !r) && clearTimeout)
264
- return r = clearTimeout, clearTimeout(p);
265
- try {
266
- return r(p);
267
- } catch {
268
- try {
269
- return r.call(null, p);
270
- } catch {
271
- return r.call(this, p);
272
- }
273
- }
274
- }
275
- var i = [], l = !1, c, u = -1;
276
- function f() {
277
- !l || !c || (l = !1, c.length ? i = c.concat(i) : u = -1, i.length && g());
278
- }
279
- function g() {
280
- if (!l) {
281
- var p = n(f);
282
- l = !0;
283
- for (var d = i.length; d; ) {
284
- for (c = i, i = []; ++u < d; )
285
- c && c[u].run();
286
- u = -1, d = i.length;
287
- }
288
- c = null, l = !1, o(p);
289
- }
290
- }
291
- t.nextTick = function(p) {
292
- var d = new Array(arguments.length - 1);
293
- if (arguments.length > 1)
294
- for (var $ = 1; $ < arguments.length; $++)
295
- d[$ - 1] = arguments[$];
296
- i.push(new m(p, d)), i.length === 1 && !l && n(g);
297
- };
298
- function m(p, d) {
299
- this.fun = p, this.array = d;
300
- }
301
- m.prototype.run = function() {
302
- this.fun.apply(null, this.array);
303
- }, t.title = "browser", t.browser = !0, t.env = {}, t.argv = [], t.version = "", t.versions = {};
304
- function h() {
305
- }
306
- return t.on = h, t.addListener = h, t.once = h, t.off = h, t.removeListener = h, t.removeAllListeners = h, t.emit = h, t.prependListener = h, t.prependOnceListener = h, t.listeners = function(p) {
307
- return [];
308
- }, t.binding = function(p) {
309
- throw new Error("process.binding is not supported");
310
- }, t.cwd = function() {
311
- return "/";
312
- }, t.chdir = function(p) {
313
- throw new Error("process.chdir is not supported");
314
- }, t.umask = function() {
315
- return 0;
316
- }, T.exports;
317
- }
318
- ie();
319
- var q, K;
320
- function ne() {
321
- if (K) return q;
322
- K = 1;
323
- var t = typeof C == "object" && C && C.Object === Object && C;
324
- return q = t, q;
325
- }
326
- var _, W;
327
- function se() {
328
- if (W) return _;
329
- W = 1;
330
- var t = ne(), e = typeof self == "object" && self && self.Object === Object && self, r = t || e || Function("return this")();
331
- return _ = r, _;
332
- }
333
- var P, J;
334
- function bt() {
335
- if (J) return P;
336
- J = 1;
337
- var t = se(), e = t.Symbol;
338
- return P = e, P;
339
- }
340
- var x, H;
341
- function ae() {
342
- if (H) return x;
343
- H = 1;
344
- var t = bt(), e = Object.prototype, r = e.hasOwnProperty, a = e.toString, s = t ? t.toStringTag : void 0;
345
- function n(o) {
346
- var i = r.call(o, s), l = o[s];
347
- try {
348
- o[s] = void 0;
349
- var c = !0;
350
- } catch {
351
- }
352
- var u = a.call(o);
353
- return c && (i ? o[s] = l : delete o[s]), u;
354
- }
355
- return x = n, x;
356
- }
357
- var I, Y;
358
- function le() {
359
- if (Y) return I;
360
- Y = 1;
361
- var t = Object.prototype, e = t.toString;
362
- function r(a) {
363
- return e.call(a);
364
- }
365
- return I = r, I;
366
- }
367
- var R, X;
368
- function $t() {
369
- if (X) return R;
370
- X = 1;
371
- var t = bt(), e = ae(), r = le(), a = "[object Null]", s = "[object Undefined]", n = t ? t.toStringTag : void 0;
372
- function o(i) {
373
- return i == null ? i === void 0 ? s : a : n && n in Object(i) ? e(i) : r(i);
374
- }
375
- return R = o, R;
376
- }
377
- var D, Z;
378
- function ce() {
379
- if (Z) return D;
380
- Z = 1;
381
- var t = Array.isArray;
382
- return D = t, D;
383
- }
384
- var M, tt;
385
- function wt() {
386
- if (tt) return M;
387
- tt = 1;
388
- function t(e) {
389
- return e != null && typeof e == "object";
390
- }
391
- return M = t, M;
392
- }
393
- var z, et;
394
- function ue() {
395
- if (et) return z;
396
- et = 1;
397
- var t = $t(), e = ce(), r = wt(), a = "[object String]";
398
- function s(n) {
399
- return typeof n == "string" || !e(n) && r(n) && t(n) == a;
400
- }
401
- return z = s, z;
402
- }
403
- ue();
404
- var E, rt;
405
- function fe() {
406
- if (rt) return E;
407
- rt = 1;
408
- function t(e, r) {
409
- return function(a) {
410
- return e(r(a));
411
- };
412
- }
413
- return E = t, E;
414
- }
415
- var L, ot;
416
- function ge() {
417
- if (ot) return L;
418
- ot = 1;
419
- var t = fe(), e = t(Object.getPrototypeOf, Object);
420
- return L = e, L;
421
- }
422
- var V, it;
423
- function he() {
424
- if (it) return V;
425
- it = 1;
426
- var t = $t(), e = ge(), r = wt(), a = "[object Object]", s = Function.prototype, n = Object.prototype, o = s.toString, i = n.hasOwnProperty, l = o.call(Object);
427
- function c(u) {
428
- if (!r(u) || t(u) != a)
429
- return !1;
430
- var f = e(u);
431
- if (f === null)
432
- return !0;
433
- var g = i.call(f, "constructor") && f.constructor;
434
- return typeof g == "function" && g instanceof g && o.call(g) == l;
435
- }
436
- return V = c, V;
437
- }
438
- he();
439
- var Ct = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, vt = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 };
440
- new Array(4).fill(String.fromCodePoint(vt[0])).join("");
441
- Object.fromEntries(Object.entries(vt).map((t) => t.reverse()));
442
- Object.fromEntries(Object.entries(Ct).map((t) => t.reverse()));
443
- `${Object.values(Ct).map((t) => `\\u{${t.toString(16)}}`).join("")}`;
444
- var N, nt;
445
- function pe() {
446
- if (nt) return N;
447
- nt = 1;
448
- var t = Object.prototype.hasOwnProperty, e = Object.prototype.toString;
449
- return N = function(r, a, s) {
450
- if (e.call(a) !== "[object Function]")
451
- throw new TypeError("iterator must be a function");
452
- var n = r.length;
453
- if (n === +n)
454
- for (var o = 0; o < n; o++)
455
- a.call(s, r[o], o, r);
456
- else
457
- for (var i in r)
458
- t.call(r, i) && a.call(s, r[i], i, r);
459
- }, N;
460
- }
461
- var B, st;
462
- function me() {
463
- if (st) return B;
464
- st = 1;
465
- var t = pe();
466
- B = e;
467
- function e(r, a, s) {
468
- if (arguments.length === 3)
469
- return e.set(r, a, s);
470
- if (arguments.length === 2)
471
- return e.get(r, a);
472
- var n = e.bind(e, r);
473
- for (var o in e)
474
- e.hasOwnProperty(o) && (n[o] = e[o].bind(n, r));
475
- return n;
476
- }
477
- return e.get = function(r, a) {
478
- for (var s = Array.isArray(a) ? a : e.parse(a), n = 0; n < s.length; ++n) {
479
- var o = s[n];
480
- if (!(typeof r == "object" && o in r))
481
- throw new Error("Invalid reference token: " + o);
482
- r = r[o];
483
- }
484
- return r;
485
- }, e.set = function(r, a, s) {
486
- var n = Array.isArray(a) ? a : e.parse(a), o = n[0];
487
- if (n.length === 0)
488
- throw Error("Can not set the root object");
489
- for (var i = 0; i < n.length - 1; ++i) {
490
- var l = n[i];
491
- typeof l != "string" && typeof l != "number" && (l = String(l)), !(l === "__proto__" || l === "constructor" || l === "prototype") && (l === "-" && Array.isArray(r) && (l = r.length), o = n[i + 1], l in r || (o.match(/^(\d+|-)$/) ? r[l] = [] : r[l] = {}), r = r[l]);
492
- }
493
- return o === "-" && Array.isArray(r) && (o = r.length), r[o] = s, this;
494
- }, e.remove = function(r, a) {
495
- var s = Array.isArray(a) ? a : e.parse(a), n = s[s.length - 1];
496
- if (n === void 0)
497
- throw new Error('Invalid JSON pointer for remove: "' + a + '"');
498
- var o = e.get(r, s.slice(0, -1));
499
- if (Array.isArray(o)) {
500
- var i = +n;
501
- if (n === "" && isNaN(i))
502
- throw new Error('Invalid array index: "' + n + '"');
503
- Array.prototype.splice.call(o, i, 1);
504
- } else
505
- delete o[n];
506
- }, e.dict = function(r, a) {
507
- var s = {};
508
- return e.walk(r, function(n, o) {
509
- s[o] = n;
510
- }, a), s;
511
- }, e.walk = function(r, a, s) {
512
- var n = [];
513
- s = s || function(o) {
514
- var i = Object.prototype.toString.call(o);
515
- return i === "[object Object]" || i === "[object Array]";
516
- }, (function o(i) {
517
- t(i, function(l, c) {
518
- n.push(String(c)), s(l) ? o(l) : a(l, e.compile(n)), n.pop();
519
- });
520
- })(r);
521
- }, e.has = function(r, a) {
522
- try {
523
- e.get(r, a);
524
- } catch {
525
- return !1;
526
- }
527
- return !0;
528
- }, e.escape = function(r) {
529
- return r.toString().replace(/~/g, "~0").replace(/\//g, "~1");
530
- }, e.unescape = function(r) {
531
- return r.replace(/~1/g, "/").replace(/~0/g, "~");
532
- }, e.parse = function(r) {
533
- if (r === "")
534
- return [];
535
- if (r.charAt(0) !== "/")
536
- throw new Error("Invalid JSON pointer: " + r);
537
- return r.substring(1).split(/\//).map(e.unescape);
538
- }, e.compile = function(r) {
539
- return r.length === 0 ? "" : "/" + r.map(e.escape).join("/");
540
- }, B;
541
- }
542
- me();
543
- var v = { exports: {} }, at;
544
- function ye() {
545
- return at || (at = 1, (function(t, e) {
546
- e = t.exports = r, e.getSerialize = a;
547
- function r(s, n, o, i) {
548
- return JSON.stringify(s, a(n, i), o);
549
- }
550
- function a(s, n) {
551
- var o = [], i = [];
552
- return n == null && (n = function(l, c) {
553
- return o[0] === c ? "[Circular ~]" : "[Circular ~." + i.slice(0, o.indexOf(c)).join(".") + "]";
554
- }), function(l, c) {
555
- if (o.length > 0) {
556
- var u = o.indexOf(this);
557
- ~u ? o.splice(u + 1) : o.push(this), ~u ? i.splice(u, 1 / 0, l) : i.push(l), ~o.indexOf(c) && (c = n.call(this, l, c));
558
- } else o.push(c);
559
- return s == null ? c : s.call(this, l, c);
560
- };
561
- }
562
- })(v, v.exports)), v.exports;
563
- }
564
- ye();
565
- class y {
566
- static _clientParams;
567
- // static getter
568
- static get clientParams() {
569
- if (!this._clientParams)
1
+ class p {
2
+ static _config;
3
+ static get config() {
4
+ if (!this._config)
570
5
  throw new Error("Client is not configured");
571
- return this._clientParams;
6
+ return this._config;
572
7
  }
573
- static configure(e) {
574
- this._clientParams = {
575
- ...e,
576
- environment: e.environment ?? "master"
577
- };
8
+ static configure(l) {
9
+ this._config = l;
578
10
  }
579
- static async graphqlQuery(e, r = {}) {
580
- const { space: a, accessToken: s, environment: n = "master" } = this.clientParams, o = await fetch(
581
- `https://graphql.contentful.com/content/v1/spaces/${a}/environments/${n}`,
582
- {
583
- method: "POST",
584
- headers: {
585
- "Content-Type": "application/json",
586
- Authorization: `Bearer ${s}`
587
- },
588
- body: JSON.stringify({ query: e, variables: r })
589
- }
590
- );
591
- if (!o.ok) {
592
- const l = await o.text();
11
+ static async graphqlQuery(l, n = {}) {
12
+ const { url: r, method: i = "POST", headers: e = {} } = this.config, t = await fetch(r, {
13
+ method: i,
14
+ headers: {
15
+ "Content-Type": "application/json",
16
+ ...e
17
+ },
18
+ body: JSON.stringify({ query: l, variables: n })
19
+ });
20
+ if (!t.ok) {
21
+ const o = await t.text();
593
22
  throw new Error(
594
- `GraphQL request failed: ${o.status} ${o.statusText}
595
- ${l}`
23
+ `GraphQL request failed: ${t.status} ${t.statusText}
24
+ ${o}`
596
25
  );
597
26
  }
598
- const i = await o.json();
599
- if (i.errors)
27
+ const s = await t.json();
28
+ if (s.errors)
600
29
  throw new Error(
601
- `GraphQL errors: ${JSON.stringify(i.errors, null, 2)}`
30
+ `GraphQL errors: ${JSON.stringify(s.errors, null, 2)}`
602
31
  );
603
- return i.data;
32
+ return s.data;
604
33
  }
605
34
  }
606
- class b {
35
+ class $ {
607
36
  page;
608
37
  total;
609
38
  size;
610
39
  items;
611
40
  totalPages;
612
41
  constructor({
613
- page: e,
614
- total: r,
615
- size: a,
616
- items: s
42
+ page: l,
43
+ total: n,
44
+ size: r,
45
+ items: i
617
46
  }) {
618
- this.page = e, this.total = r, this.size = a, this.items = s, this.totalPages = Math.ceil(this.total / this.size);
47
+ this.page = l, this.total = n, this.size = r, this.items = i, this.totalPages = Math.ceil(this.total / this.size);
619
48
  }
620
49
  }
621
- const de = async ({
622
- slot: t,
623
- page: e = 1,
624
- size: r = 20,
625
- platform: a,
626
- marketCode: s,
627
- locale: n
50
+ const q = async ({
51
+ slot: c,
52
+ page: l = 1,
53
+ size: n = 20,
54
+ platform: r,
55
+ marketCode: i,
56
+ locale: e
628
57
  }) => {
629
- const o = Math.max(1, Math.floor(e)), i = Math.max(1, Math.floor(r)), l = [
58
+ const t = Math.max(1, Math.floor(l)), s = Math.max(1, Math.floor(n)), o = [
630
59
  "$slot: String!",
631
60
  "$limit: Int!",
632
61
  "$skip: Int!"
633
- ], c = {
634
- slot: t,
635
- limit: i,
636
- skip: (o - 1) * i
62
+ ], a = {
63
+ slot: c,
64
+ limit: s,
65
+ skip: (t - 1) * s
637
66
  }, u = ["{ slot: $slot }"];
638
- a && (l.push("$platform: String!"), c.platform = a, u.push("{ platform_contains_some: [$platform] }")), s && (l.push("$marketCode: String!"), c.marketCode = s, u.push(
67
+ r && (o.push("$platform: String!"), a.platform = r, u.push("{ platform_contains_some: [$platform] }")), i && (o.push("$marketCode: String!"), a.marketCode = i, u.push(
639
68
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
640
- )), n && (l.push("$locale: String!"), c.locale = n, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
641
- const f = `(${l.join(", ")})`, g = `(
69
+ )), e && (o.push("$locale: String!"), a.locale = e, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
70
+ const h = `(${o.join(", ")})`, m = `(
642
71
  limit: $limit
643
72
  skip: $skip
644
73
  where: {
@@ -647,9 +76,9 @@ const de = async ({
647
76
  `)}
648
77
  ]
649
78
  }
650
- )`, m = `
651
- query${f} {
652
- bannerCollectionCollection${g} {
79
+ )`, g = `
80
+ query${h} {
81
+ bannerCollectionCollection${m} {
653
82
  total
654
83
  items {
655
84
  sys {
@@ -684,36 +113,36 @@ query${f} {
684
113
  }
685
114
  }
686
115
  }
687
- `, { bannerCollectionCollection: h } = await y.graphqlQuery(m, {
688
- ...c
116
+ `, { bannerCollectionCollection: d } = await p.graphqlQuery(g, {
117
+ ...a
689
118
  });
690
- return new b({
691
- page: o,
692
- total: h.total,
693
- size: i,
694
- items: h.items
119
+ return new $({
120
+ page: t,
121
+ total: d.total,
122
+ size: s,
123
+ items: d.items
695
124
  });
696
125
  };
697
- class w extends Response {
698
- constructor(...e) {
699
- super(e[0] ?? "Not Found", {
126
+ class y extends Response {
127
+ constructor(...l) {
128
+ super(l[0] ?? "Not Found", {
700
129
  status: 404,
701
- ...e[1]
130
+ ...l[1]
702
131
  });
703
132
  }
704
133
  }
705
- const be = async ({
706
- marketCode: t,
707
- locale: e,
708
- collectionId: r,
709
- categoryId: a,
710
- page: s = 1,
711
- size: n = 20,
712
- skip: o = 0
134
+ const S = async ({
135
+ marketCode: c,
136
+ locale: l,
137
+ collectionId: n,
138
+ categoryId: r,
139
+ page: i = 1,
140
+ size: e = 20,
141
+ skip: t = 0
713
142
  } = {}) => {
714
- const i = Math.max(1, Math.floor(s)), l = Math.max(1, Math.floor(n)), c = Math.max(0, Math.floor(o));
715
- if (r) {
716
- const St = `
143
+ const s = Math.max(1, Math.floor(i)), o = Math.max(1, Math.floor(e)), a = Math.max(0, Math.floor(t));
144
+ if (n) {
145
+ const b = `
717
146
  query($collectionId: String!, $limit: Int!, $skip: Int!) {
718
147
  blogCollectionCollection(limit: 1 where: { sys: { id: $collectionId } }) {
719
148
  items {
@@ -754,38 +183,38 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
754
183
  }
755
184
  }
756
185
  }
757
- `, { blogCollectionCollection: kt } = await y.graphqlQuery(St, {
758
- collectionId: r,
759
- limit: l,
760
- skip: (i - 1) * l + c
761
- }), A = kt.items.at(0);
762
- if (!A)
763
- throw new w();
764
- return new b({
765
- page: i,
766
- total: A.postsCollection?.total ?? 0,
767
- size: l,
768
- items: A.postsCollection?.items ?? []
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 ?? []
769
198
  });
770
199
  }
771
- const u = ["$limit: Int!", "$skip: Int!"], f = {
772
- limit: l,
773
- skip: (i - 1) * l + c
774
- }, g = ["limit: $limit", "skip: $skip"], m = [];
775
- t && (u.push("$marketCode: String!"), f.marketCode = t, m.push(
200
+ const u = ["$limit: Int!", "$skip: Int!"], h = {
201
+ limit: o,
202
+ skip: (s - 1) * o + a
203
+ }, m = ["limit: $limit", "skip: $skip"], g = [];
204
+ c && (u.push("$marketCode: String!"), h.marketCode = c, g.push(
776
205
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
777
- )), e && (u.push("$locale: String!"), f.locale = e, m.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), a && (u.push("$categoryId: String!"), f.categoryId = a, m.push("{ categories: { sys: { id: $categoryId } } }")), m.length && g.push(`where: {
206
+ )), l && (u.push("$locale: String!"), h.locale = l, g.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), r && (u.push("$categoryId: String!"), h.categoryId = r, g.push("{ categories: { sys: { id: $categoryId } } }")), g.length && m.push(`where: {
778
207
  AND: [
779
- ${m.join(`
208
+ ${g.join(`
780
209
  `)}
781
210
  ]
782
211
  }`);
783
- const h = u.length ? `(${u.join(", ")})` : "", p = g.length ? `(
784
- ${g.join(`
212
+ const d = u.length ? `(${u.join(", ")})` : "", k = m.length ? `(
213
+ ${m.join(`
785
214
  `)}
786
- )` : "", d = `
787
- query${h} {
788
- blogPostCollection${p} {
215
+ )` : "", w = `
216
+ query${d} {
217
+ blogPostCollection${k} {
789
218
  total
790
219
  items {
791
220
  sys {
@@ -820,42 +249,42 @@ query${h} {
820
249
  }
821
250
  }
822
251
  }
823
- `, { blogPostCollection: $ } = await y.graphqlQuery(d, {
824
- ...f
252
+ `, { blogPostCollection: C } = await p.graphqlQuery(w, {
253
+ ...h
825
254
  });
826
- return new b({
827
- page: i,
828
- total: $.total,
829
- size: l,
830
- items: $.items
255
+ return new $({
256
+ page: s,
257
+ total: C.total,
258
+ size: o,
259
+ items: C.items
831
260
  });
832
- }, $e = async ({
833
- id: t,
834
- slug: e,
835
- marketCode: r,
836
- locale: a
261
+ }, x = async ({
262
+ id: c,
263
+ slug: l,
264
+ marketCode: n,
265
+ locale: r
837
266
  }) => {
838
- const s = [], n = {}, o = [];
839
- if (t)
840
- s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
841
- else if (e)
842
- s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
267
+ const i = [], e = {}, t = [];
268
+ if (c)
269
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
270
+ else if (l)
271
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
843
272
  else
844
273
  throw new Error("Either id or slug is required.");
845
- r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
274
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
846
275
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
847
- )), a && (s.push("$locale: String!"), n.locale = a, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
848
- const i = `(${s.join(", ")})`, l = `(
276
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
277
+ const s = `(${i.join(", ")})`, o = `(
849
278
  limit: 1
850
279
  where: {
851
280
  AND: [
852
- ${o.join(`
281
+ ${t.join(`
853
282
  `)}
854
283
  ]
855
284
  }
856
- )`, c = `
857
- query${i} {
858
- blogPostCollection${l} {
285
+ )`, a = `
286
+ query${s} {
287
+ blogPostCollection${o} {
859
288
  items {
860
289
  sys {
861
290
  id
@@ -922,36 +351,36 @@ query${i} {
922
351
  }
923
352
  }
924
353
  }
925
- `, { blogPostCollection: u } = await y.graphqlQuery(c, {
926
- ...n
927
- }), f = u.items.at(0);
928
- if (!f)
929
- throw new w();
930
- return f;
931
- }, we = async ({
932
- marketCode: t,
933
- locale: e,
934
- page: r = 1,
935
- size: a = 20
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
936
365
  } = {}) => {
937
- const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
938
- limit: n,
939
- skip: (s - 1) * n
940
- }, l = ["limit: $limit", "skip: $skip"], c = [];
941
- t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
366
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
367
+ limit: e,
368
+ skip: (i - 1) * e
369
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
370
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
942
371
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
943
- )), e && (o.push("$locale: String!"), i.locale = e, c.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), c.length && l.push(`where: {
372
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), a.length && o.push(`where: {
944
373
  AND: [
945
- ${c.join(`
374
+ ${a.join(`
946
375
  `)}
947
376
  ]
948
377
  }`);
949
- const u = o.length ? `(${o.join(", ")})` : "", f = l.length ? `(
950
- ${l.join(`
378
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
379
+ ${o.join(`
951
380
  `)}
952
- )` : "", g = `
381
+ )` : "", m = `
953
382
  query${u} {
954
- blogCategoryCollection${f} {
383
+ blogCategoryCollection${h} {
955
384
  total
956
385
  items {
957
386
  sys {
@@ -968,42 +397,42 @@ query${u} {
968
397
  }
969
398
  }
970
399
  }
971
- `, { blogCategoryCollection: m } = await y.graphqlQuery(g, {
972
- ...i
400
+ `, { blogCategoryCollection: g } = await p.graphqlQuery(m, {
401
+ ...s
973
402
  });
974
- return new b({
975
- page: s,
976
- total: m.total,
977
- size: n,
978
- items: m.items
403
+ return new $({
404
+ page: i,
405
+ total: g.total,
406
+ size: e,
407
+ items: g.items
979
408
  });
980
- }, Ce = async ({
981
- id: t,
982
- slug: e,
983
- marketCode: r,
984
- locale: a
409
+ }, z = async ({
410
+ id: c,
411
+ slug: l,
412
+ marketCode: n,
413
+ locale: r
985
414
  }) => {
986
- const s = [], n = {}, o = [];
987
- if (t)
988
- s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
989
- else if (e)
990
- s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
415
+ const i = [], e = {}, t = [];
416
+ if (c)
417
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
418
+ else if (l)
419
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
991
420
  else
992
421
  throw new Error("Either id or slug is required.");
993
- r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
422
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
994
423
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
995
- )), a && (s.push("$locale: String!"), n.locale = a, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
996
- const i = `(${s.join(", ")})`, l = `(
424
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
425
+ const s = `(${i.join(", ")})`, o = `(
997
426
  limit: 1
998
427
  where: {
999
428
  AND: [
1000
- ${o.join(`
429
+ ${t.join(`
1001
430
  `)}
1002
431
  ]
1003
432
  }
1004
- )`, c = `
1005
- query${i} {
1006
- blogCategoryCollection${l} {
433
+ )`, a = `
434
+ query${s} {
435
+ blogCategoryCollection${o} {
1007
436
  items {
1008
437
  sys {
1009
438
  id
@@ -1026,38 +455,38 @@ query${i} {
1026
455
  }
1027
456
  }
1028
457
  }
1029
- `, { blogCategoryCollection: u } = await y.graphqlQuery(c, {
1030
- ...n
1031
- }), f = u.items.at(0);
1032
- if (!f)
1033
- throw new w();
1034
- return f;
1035
- }, ve = async ({
1036
- marketCode: t,
1037
- locale: e,
1038
- page: r = 1,
1039
- size: a = 20
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
1040
469
  } = {}) => {
1041
- const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
1042
- limit: n,
1043
- skip: (s - 1) * n
1044
- }, l = ["limit: $limit", "skip: $skip"], c = [];
1045
- t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
470
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
471
+ limit: e,
472
+ skip: (i - 1) * e
473
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
474
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
1046
475
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1047
- )), e && (o.push("$locale: String!"), i.locale = e, c.push(
476
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push(
1048
477
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
1049
- )), c.length && l.push(`where: {
478
+ )), a.length && o.push(`where: {
1050
479
  AND: [
1051
- ${c.join(`
480
+ ${a.join(`
1052
481
  `)}
1053
482
  ]
1054
483
  }`);
1055
- const u = o.length ? `(${o.join(", ")})` : "", f = l.length ? `(
1056
- ${l.join(`
484
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
485
+ ${o.join(`
1057
486
  `)}
1058
- )` : "", g = `
487
+ )` : "", m = `
1059
488
  query${u} {
1060
- blogCollectionCollection${f} {
489
+ blogCollectionCollection${h} {
1061
490
  total
1062
491
  items {
1063
492
  name
@@ -1082,47 +511,47 @@ query${u} {
1082
511
  }
1083
512
  }
1084
513
  }
1085
- `, { blogCollectionCollection: m } = await y.graphqlQuery(g, {
1086
- ...i
514
+ `, { blogCollectionCollection: g } = await p.graphqlQuery(m, {
515
+ ...s
1087
516
  });
1088
- return new b({
1089
- page: s,
1090
- total: m.total,
1091
- size: n,
1092
- items: m.items.map((h) => ({
1093
- ...h,
1094
- category: h.type === "category" ? h.category : null,
1095
- categoryId: h.type === "category" ? h.category?.sys.id ?? null : null,
1096
- collectionId: h.type === "manual" ? h.sys.id : null
517
+ return new $({
518
+ page: i,
519
+ total: g.total,
520
+ size: e,
521
+ items: g.items.map((d) => ({
522
+ ...d,
523
+ category: d.type === "category" ? d.category : null,
524
+ categoryId: d.type === "category" ? d.category?.sys.id ?? null : null,
525
+ collectionId: d.type === "manual" ? d.sys.id : null
1097
526
  }))
1098
527
  });
1099
- }, Se = async ({
1100
- page: t = 1,
1101
- size: e = 20,
1102
- marketCode: r,
1103
- locale: a
528
+ }, j = async ({
529
+ page: c = 1,
530
+ size: l = 20,
531
+ marketCode: n,
532
+ locale: r
1104
533
  } = {}) => {
1105
- const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
1106
- limit: n,
1107
- skip: (s - 1) * n
1108
- }, l = [];
1109
- r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
534
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
535
+ limit: e,
536
+ skip: (i - 1) * e
537
+ }, o = [];
538
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
1110
539
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1111
- )), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
1112
- const c = `(${o.join(", ")})`, u = l.length ? `(
540
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
541
+ const a = `(${t.join(", ")})`, u = o.length ? `(
1113
542
  limit: $limit
1114
543
  skip: $skip
1115
544
  where: {
1116
545
  AND: [
1117
- ${l.join(`
546
+ ${o.join(`
1118
547
  `)}
1119
548
  ]
1120
549
  }
1121
550
  )` : `(
1122
551
  limit: $limit
1123
552
  skip: $skip
1124
- )`, f = `
1125
- query${c} {
553
+ )`, h = `
554
+ query${a} {
1126
555
  brandCollectionCollection${u} {
1127
556
  total
1128
557
  items {
@@ -1157,41 +586,41 @@ query${c} {
1157
586
  }
1158
587
  }
1159
588
  }
1160
- `, { brandCollectionCollection: g } = await y.graphqlQuery(f, {
1161
- ...i
589
+ `, { brandCollectionCollection: m } = await p.graphqlQuery(h, {
590
+ ...s
1162
591
  });
1163
- return new b({
1164
- page: s,
1165
- total: g.total,
1166
- size: n,
1167
- items: g.items
592
+ return new $({
593
+ page: i,
594
+ total: m.total,
595
+ size: e,
596
+ items: m.items
1168
597
  });
1169
- }, ke = async ({
1170
- marketCode: t,
1171
- locale: e,
1172
- page: r = 1,
1173
- size: a = 20
598
+ }, R = async ({
599
+ marketCode: c,
600
+ locale: l,
601
+ page: n = 1,
602
+ size: r = 20
1174
603
  } = {}) => {
1175
- const s = Math.max(1, Math.floor(r)), n = Math.max(1, Math.floor(a)), o = ["$limit: Int!", "$skip: Int!"], i = {
1176
- limit: n,
1177
- skip: (s - 1) * n
1178
- }, l = ["limit: $limit", "skip: $skip"], c = [];
1179
- t && (o.push("$marketCode: String!"), i.marketCode = t, c.push(
604
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
605
+ limit: e,
606
+ skip: (i - 1) * e
607
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
608
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
1180
609
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1181
- )), e && (o.push("$locale: String!"), i.locale = e, c.push(
610
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push(
1182
611
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
1183
- )), c.length && l.push(`where: {
612
+ )), a.length && o.push(`where: {
1184
613
  AND: [
1185
- ${c.join(`
614
+ ${a.join(`
1186
615
  `)}
1187
616
  ]
1188
617
  }`);
1189
- const u = o.length ? `(${o.join(", ")})` : "", f = l.length ? `(
1190
- ${l.join(`
618
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
619
+ ${o.join(`
1191
620
  `)}
1192
- )` : "", g = `
621
+ )` : "", m = `
1193
622
  query${u} {
1194
- documentationCategoryCollection${f} {
623
+ documentationCategoryCollection${h} {
1195
624
  total
1196
625
  items {
1197
626
  sys {
@@ -1212,44 +641,44 @@ query${u} {
1212
641
  }
1213
642
  }
1214
643
  }
1215
- `, { documentationCategoryCollection: m } = await y.graphqlQuery(g, {
1216
- ...i
644
+ `, { documentationCategoryCollection: g } = await p.graphqlQuery(m, {
645
+ ...s
1217
646
  });
1218
- return new b({
1219
- page: s,
1220
- total: m.total,
1221
- size: n,
1222
- items: m.items
647
+ return new $({
648
+ page: i,
649
+ total: g.total,
650
+ size: e,
651
+ items: g.items
1223
652
  });
1224
- }, Ae = async ({
1225
- id: t,
1226
- slug: e,
1227
- marketCode: r,
1228
- locale: a
653
+ }, _ = async ({
654
+ id: c,
655
+ slug: l,
656
+ marketCode: n,
657
+ locale: r
1229
658
  }) => {
1230
- const s = [], n = {}, o = [];
1231
- if (t)
1232
- s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
1233
- else if (e)
1234
- s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
659
+ const i = [], e = {}, t = [];
660
+ if (c)
661
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
662
+ else if (l)
663
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
1235
664
  else
1236
665
  throw new Error("Either id or slug is required.");
1237
- r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
666
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
1238
667
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1239
- )), a && (s.push("$locale: String!"), n.locale = a, o.push(
668
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push(
1240
669
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
1241
670
  ));
1242
- const i = `(${s.join(", ")})`, l = `(
671
+ const s = `(${i.join(", ")})`, o = `(
1243
672
  limit: 1
1244
673
  where: {
1245
674
  AND: [
1246
- ${o.join(`
675
+ ${t.join(`
1247
676
  `)}
1248
677
  ]
1249
678
  }
1250
- )`, c = `
1251
- query${i} {
1252
- documentationCategoryCollection${l} {
679
+ )`, a = `
680
+ query${s} {
681
+ documentationCategoryCollection${o} {
1253
682
  items {
1254
683
  sys {
1255
684
  id
@@ -1269,39 +698,39 @@ query${i} {
1269
698
  }
1270
699
  }
1271
700
  }
1272
- `, { documentationCategoryCollection: u } = await y.graphqlQuery(c, {
1273
- ...n
1274
- }), f = u.items.at(0);
1275
- if (!f)
1276
- throw new w();
1277
- return f;
1278
- }, Oe = async ({
1279
- marketCode: t,
1280
- locale: e,
1281
- categorySlug: r,
1282
- page: a = 1,
1283
- size: s = 20
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
1284
713
  } = {}) => {
1285
- const n = Math.max(1, Math.floor(a)), o = Math.max(1, Math.floor(s)), i = ["$limit: Int!", "$skip: Int!"], l = {
1286
- limit: o,
1287
- skip: (n - 1) * o
1288
- }, c = ["limit: $limit", "skip: $skip"], u = [];
1289
- t && (i.push("$marketCode: String!"), l.marketCode = t, u.push(
714
+ const e = Math.max(1, Math.floor(r)), t = Math.max(1, Math.floor(i)), s = ["$limit: Int!", "$skip: Int!"], o = {
715
+ limit: t,
716
+ skip: (e - 1) * t
717
+ }, a = ["limit: $limit", "skip: $skip"], u = [];
718
+ c && (s.push("$marketCode: String!"), o.marketCode = c, u.push(
1290
719
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1291
- )), e && (i.push("$locale: String!"), l.locale = e, u.push(
720
+ )), l && (s.push("$locale: String!"), o.locale = l, u.push(
1292
721
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
1293
- )), r && (i.push("$categorySlug: String!"), l.categorySlug = r, u.push("{ category: { slug: $categorySlug } }")), u.length && c.push(`where: {
722
+ )), n && (s.push("$categorySlug: String!"), o.categorySlug = n, u.push("{ category: { slug: $categorySlug } }")), u.length && a.push(`where: {
1294
723
  AND: [
1295
724
  ${u.join(`
1296
725
  `)}
1297
726
  ]
1298
727
  }`);
1299
- const f = i.length ? `(${i.join(", ")})` : "", g = c.length ? `(
1300
- ${c.join(`
728
+ const h = s.length ? `(${s.join(", ")})` : "", m = a.length ? `(
729
+ ${a.join(`
1301
730
  `)}
1302
- )` : "", m = `
1303
- query${f} {
1304
- documentationArticleCollection${g} {
731
+ )` : "", g = `
732
+ query${h} {
733
+ documentationArticleCollection${m} {
1305
734
  total
1306
735
  items {
1307
736
  sys {
@@ -1329,44 +758,44 @@ query${f} {
1329
758
  }
1330
759
  }
1331
760
  }
1332
- `, { documentationArticleCollection: h } = await y.graphqlQuery(m, {
1333
- ...l
761
+ `, { documentationArticleCollection: d } = await p.graphqlQuery(g, {
762
+ ...o
1334
763
  });
1335
- return new b({
1336
- page: n,
1337
- total: h.total,
1338
- size: o,
1339
- items: h.items
764
+ return new $({
765
+ page: e,
766
+ total: d.total,
767
+ size: t,
768
+ items: d.items
1340
769
  });
1341
- }, je = async ({
1342
- id: t,
1343
- slug: e,
1344
- marketCode: r,
1345
- locale: a
770
+ }, O = async ({
771
+ id: c,
772
+ slug: l,
773
+ marketCode: n,
774
+ locale: r
1346
775
  }) => {
1347
- const s = [], n = {}, o = [];
1348
- if (t)
1349
- s.push("$id: String!"), n.id = t, o.push("{ sys: { id: $id } }");
1350
- else if (e)
1351
- s.push("$slug: String!"), n.slug = e, o.push("{ slug: $slug }");
776
+ const i = [], e = {}, t = [];
777
+ if (c)
778
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
779
+ else if (l)
780
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
1352
781
  else
1353
782
  throw new Error("Either id or slug is required.");
1354
- r && (s.push("$marketCode: String!"), n.marketCode = r, o.push(
783
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
1355
784
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1356
- )), a && (s.push("$locale: String!"), n.locale = a, o.push(
785
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push(
1357
786
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
1358
787
  ));
1359
- const i = `(${s.join(", ")})`, l = `(
788
+ const s = `(${i.join(", ")})`, o = `(
1360
789
  limit: 1
1361
790
  where: {
1362
791
  AND: [
1363
- ${o.join(`
792
+ ${t.join(`
1364
793
  `)}
1365
794
  ]
1366
795
  }
1367
- )`, c = `
1368
- query${i} {
1369
- documentationArticleCollection${l} {
796
+ )`, a = `
797
+ query${s} {
798
+ documentationArticleCollection${o} {
1370
799
  items {
1371
800
  sys {
1372
801
  id
@@ -1417,32 +846,32 @@ query${i} {
1417
846
  }
1418
847
  }
1419
848
  }
1420
- `, { documentationArticleCollection: u } = await y.graphqlQuery(c, {
1421
- ...n
1422
- }), f = u.items.at(0);
1423
- if (!f)
1424
- throw new w();
1425
- return f;
1426
- }, Te = async ({
1427
- page: t = 1,
1428
- size: e = 20,
1429
- marketCode: r,
1430
- locale: a
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
1431
860
  } = {}) => {
1432
- const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
1433
- limit: n,
1434
- skip: (s - 1) * n
1435
- }, l = [];
1436
- r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
861
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
862
+ limit: e,
863
+ skip: (i - 1) * e
864
+ }, o = [];
865
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
1437
866
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1438
- )), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
1439
- const c = o.length ? `(${o.join(", ")})` : "", u = l.length ? `(
867
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
868
+ const a = t.length ? `(${t.join(", ")})` : "", u = o.length ? `(
1440
869
  limit: $limit
1441
870
  skip: $skip
1442
871
  order: order_ASC
1443
872
  where: {
1444
873
  AND: [
1445
- ${l.join(`
874
+ ${o.join(`
1446
875
  `)}
1447
876
  ]
1448
877
  }
@@ -1450,8 +879,8 @@ query${i} {
1450
879
  limit: $limit
1451
880
  skip: $skip
1452
881
  order: order_ASC
1453
- )`, f = `
1454
- query${c} {
882
+ )`, h = `
883
+ query${a} {
1455
884
  hyperlinkCollectionCollection${u} {
1456
885
  total
1457
886
  items {
@@ -1475,45 +904,45 @@ query${c} {
1475
904
  }
1476
905
  }
1477
906
  }
1478
- `, { hyperlinkCollectionCollection: g } = await y.graphqlQuery(
1479
- f,
907
+ `, { hyperlinkCollectionCollection: m } = await p.graphqlQuery(
908
+ h,
1480
909
  {
1481
- ...i
910
+ ...s
1482
911
  }
1483
912
  );
1484
- return new b({
1485
- page: s,
1486
- total: g.total,
1487
- size: n,
1488
- items: g.items
913
+ return new $({
914
+ page: i,
915
+ total: m.total,
916
+ size: e,
917
+ items: m.items
1489
918
  });
1490
- }, qe = async ({
1491
- page: t = 1,
1492
- size: e = 20,
1493
- marketCode: r,
1494
- locale: a
919
+ }, V = async ({
920
+ page: c = 1,
921
+ size: l = 20,
922
+ marketCode: n,
923
+ locale: r
1495
924
  } = {}) => {
1496
- const s = Math.max(1, Math.floor(t)), n = Math.max(1, Math.floor(e)), o = ["$limit: Int!", "$skip: Int!"], i = {
1497
- limit: n,
1498
- skip: (s - 1) * n
1499
- }, l = [];
1500
- r && (o.push("$marketCode: String!"), i.marketCode = r, l.push(
925
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
926
+ limit: e,
927
+ skip: (i - 1) * e
928
+ }, o = [];
929
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
1501
930
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
1502
- )), a && (o.push("$locale: String!"), i.locale = a, l.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
1503
- const c = `(${o.join(", ")})`, u = l.length ? `(
931
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
932
+ const a = `(${t.join(", ")})`, u = o.length ? `(
1504
933
  limit: $limit
1505
934
  skip: $skip
1506
935
  where: {
1507
936
  AND: [
1508
- ${l.join(`
937
+ ${o.join(`
1509
938
  `)}
1510
939
  ]
1511
940
  }
1512
941
  )` : `(
1513
942
  limit: $limit
1514
943
  skip: $skip
1515
- )`, f = `
1516
- query${c} {
944
+ )`, h = `
945
+ query${a} {
1517
946
  keywordCollectionCollection${u} {
1518
947
  total
1519
948
  items {
@@ -1526,30 +955,83 @@ query${c} {
1526
955
  }
1527
956
  }
1528
957
  }
1529
- `, { keywordCollectionCollection: g } = await y.graphqlQuery(f, {
1530
- ...i
958
+ `, { keywordCollectionCollection: m } = await p.graphqlQuery(h, {
959
+ ...s
1531
960
  });
1532
- return new b({
1533
- page: s,
1534
- total: g.total,
1535
- size: n,
1536
- items: g.items
961
+ return new $({
962
+ page: i,
963
+ total: m.total,
964
+ size: e,
965
+ items: m.items
1537
966
  });
967
+ }, P = async ({
968
+ marketCode: c,
969
+ locale: l
970
+ } = {}) => {
971
+ const n = [], r = {}, i = [];
972
+ c && (n.push("$marketCode: String!"), r.marketCode = c, i.push(
973
+ "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
974
+ )), l && (n.push("$locale: String!"), r.locale = l, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
975
+ const e = n.length ? `(${n.join(", ")})` : "", t = i.length ? `(
976
+ limit: 1
977
+ where: {
978
+ AND: [
979
+ ${i.join(`
980
+ `)}
981
+ ]
982
+ }
983
+ )` : "(limit: 1)", s = `
984
+ query${e} {
985
+ policyAndTermsCollection${t} {
986
+ items {
987
+ sys {
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;
1538
1019
  };
1539
1020
  export {
1540
- y as ContentfulSDK,
1541
- b as PaginatedResponse,
1542
- de as getBannerCollections,
1543
- we as getBlogCategories,
1544
- Ce as getBlogCategoryDetail,
1545
- ve as getBlogCollections,
1546
- $e as getBlogPostDetail,
1547
- be as getBlogPosts,
1548
- Se as getBrandCollections,
1549
- je as getDocArticleDetail,
1550
- Oe as getDocArticles,
1551
- ke as getDocCategories,
1552
- Ae as getDocCategoryDetail,
1553
- Te as getHyperlinkCollections,
1554
- qe as getKeywordCollections
1021
+ p as ContentfulSDK,
1022
+ $ as PaginatedResponse,
1023
+ q as getBannerCollections,
1024
+ D as getBlogCategories,
1025
+ z as getBlogCategoryDetail,
1026
+ M as getBlogCollections,
1027
+ x as getBlogPostDetail,
1028
+ S as getBlogPosts,
1029
+ j as getBrandCollections,
1030
+ O as getDocArticleDetail,
1031
+ I as getDocArticles,
1032
+ R as getDocCategories,
1033
+ _ as getDocCategoryDetail,
1034
+ T as getHyperlinkCollections,
1035
+ V as getKeywordCollections,
1036
+ P as getPolicyAndTerms
1555
1037
  };