@janbox/contentful-marketplace-sdk 1.0.2 → 1.0.4
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 +21 -10
- package/dist/entries/banner-collection.d.ts +8 -4
- package/dist/entries/blog.d.ts +8 -7
- package/dist/entries/brand-collection.d.ts +7 -3
- package/dist/entries/documentation.d.ts +16 -14
- package/dist/entries/hyperlink-collection.d.ts +8 -3
- package/dist/entries/keyword-collection.d.ts +7 -3
- package/dist/index.cjs +83 -66
- package/dist/index.js +463 -407
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,10 +46,11 @@ const result = await listBannerCollections({
|
|
|
46
46
|
marketCode: "vn",
|
|
47
47
|
language: "en",
|
|
48
48
|
platform: "WEB",
|
|
49
|
-
|
|
49
|
+
page: 1,
|
|
50
|
+
size: 10,
|
|
50
51
|
});
|
|
51
52
|
|
|
52
|
-
console.log(result.
|
|
53
|
+
console.log(result.items);
|
|
53
54
|
```
|
|
54
55
|
|
|
55
56
|
## Configuration
|
|
@@ -74,7 +75,8 @@ Notes:
|
|
|
74
75
|
|
|
75
76
|
## API Methods
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
List methods return `{ page, total, size, items }`.
|
|
79
|
+
Detail methods return the entry object directly.
|
|
78
80
|
|
|
79
81
|
### Banner Collection
|
|
80
82
|
|
|
@@ -83,7 +85,8 @@ All methods return `{ data: ... }`.
|
|
|
83
85
|
```ts
|
|
84
86
|
await listBannerCollections({
|
|
85
87
|
slot: "home_hero",
|
|
86
|
-
|
|
88
|
+
page: 1,
|
|
89
|
+
size: 20,
|
|
87
90
|
platform: "WEB",
|
|
88
91
|
marketCode: "vn",
|
|
89
92
|
language: "en",
|
|
@@ -99,9 +102,10 @@ await listBannerCollections({
|
|
|
99
102
|
const posts = await listBlogPosts({
|
|
100
103
|
marketCode: "vn",
|
|
101
104
|
language: "en",
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
page: 1,
|
|
106
|
+
size: 10,
|
|
104
107
|
});
|
|
108
|
+
// paging response shape: { page, total, size, items }
|
|
105
109
|
|
|
106
110
|
const post = await getBlogPostDetail({
|
|
107
111
|
slug: "how-to-shop-online",
|
|
@@ -127,8 +131,10 @@ const postById = await getBlogPostDetail({
|
|
|
127
131
|
const categories = await listDocCategories({
|
|
128
132
|
marketCode: "vn",
|
|
129
133
|
language: "en",
|
|
130
|
-
|
|
134
|
+
page: 1,
|
|
135
|
+
size: 10,
|
|
131
136
|
});
|
|
137
|
+
// paging response shape: { page, total, size, items }
|
|
132
138
|
|
|
133
139
|
const category = await getDocCategoryDetail({
|
|
134
140
|
slug: "getting-started",
|
|
@@ -146,7 +152,8 @@ const articles = await listDocArticles({
|
|
|
146
152
|
categorySlug: "getting-started",
|
|
147
153
|
marketCode: "vn",
|
|
148
154
|
language: "en",
|
|
149
|
-
|
|
155
|
+
page: 1,
|
|
156
|
+
size: 10,
|
|
150
157
|
});
|
|
151
158
|
// listDocArticles returns summary fields only (no content, no seo)
|
|
152
159
|
|
|
@@ -173,10 +180,13 @@ const articleById = await getDocArticleDetail({
|
|
|
173
180
|
const brands = await listBrandCollections({
|
|
174
181
|
marketCode: "vn",
|
|
175
182
|
language: "en",
|
|
176
|
-
|
|
183
|
+
page: 1,
|
|
184
|
+
size: 20,
|
|
177
185
|
});
|
|
178
186
|
|
|
179
187
|
const links = await listHyperlinkCollections({
|
|
188
|
+
page: 1,
|
|
189
|
+
size: 20,
|
|
180
190
|
marketCode: "vn",
|
|
181
191
|
language: "en",
|
|
182
192
|
});
|
|
@@ -184,7 +194,8 @@ const links = await listHyperlinkCollections({
|
|
|
184
194
|
const keywords = await listKeywordCollections({
|
|
185
195
|
marketCode: "vn",
|
|
186
196
|
language: "en",
|
|
187
|
-
|
|
197
|
+
page: 1,
|
|
198
|
+
size: 20,
|
|
188
199
|
});
|
|
189
200
|
```
|
|
190
201
|
|
|
@@ -10,7 +10,7 @@ export type BannerCollectionGraphQLItem = {
|
|
|
10
10
|
sys: GraphQLEntrySys;
|
|
11
11
|
hyperlink: ({
|
|
12
12
|
sys: GraphQLEntrySys;
|
|
13
|
-
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "
|
|
13
|
+
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "marketHandling">) | null;
|
|
14
14
|
media: {
|
|
15
15
|
url: string;
|
|
16
16
|
width: number | null;
|
|
@@ -22,11 +22,15 @@ export type BannerCollectionGraphQLItem = {
|
|
|
22
22
|
};
|
|
23
23
|
} & Pick<BannerCollectionEntry["fields"], "name" | "slot" | "platform">;
|
|
24
24
|
export type ListBannerCollectionsResponse = {
|
|
25
|
-
|
|
25
|
+
page: number;
|
|
26
|
+
total: number;
|
|
27
|
+
size: number;
|
|
28
|
+
items: BannerCollectionGraphQLItem[];
|
|
26
29
|
};
|
|
27
|
-
export declare const listBannerCollections: ({ slot,
|
|
30
|
+
export declare const listBannerCollections: ({ slot, page, size, platform, marketCode, language, }: {
|
|
28
31
|
slot: BannerCollectionEntry["fields"]["slot"];
|
|
29
|
-
|
|
32
|
+
page?: number;
|
|
33
|
+
size?: number;
|
|
30
34
|
platform?: BannerCollectionEntry["fields"]["platform"][number];
|
|
31
35
|
marketCode?: string;
|
|
32
36
|
language?: string;
|
package/dist/entries/blog.d.ts
CHANGED
|
@@ -34,16 +34,17 @@ export interface BlogPostDetailGraphQLItem extends BlogPostGraphQLItem {
|
|
|
34
34
|
seo: GraphQLSeo | null;
|
|
35
35
|
}
|
|
36
36
|
export type ListBlogPostsResponse = {
|
|
37
|
-
|
|
37
|
+
page: number;
|
|
38
|
+
total: number;
|
|
39
|
+
size: number;
|
|
40
|
+
items: BlogPostGraphQLItem[];
|
|
38
41
|
};
|
|
39
|
-
export type GetBlogPostDetailResponse =
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
export declare const listBlogPosts: ({ marketCode, language, limit, skip, }?: {
|
|
42
|
+
export type GetBlogPostDetailResponse = BlogPostDetailGraphQLItem;
|
|
43
|
+
export declare const listBlogPosts: ({ marketCode, language, page, size, }?: {
|
|
43
44
|
marketCode?: string;
|
|
44
45
|
language?: string;
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
page?: number;
|
|
47
|
+
size?: number;
|
|
47
48
|
}) => Promise<ListBlogPostsResponse>;
|
|
48
49
|
export declare const getBlogPostDetail: ({ id, slug, marketCode, language, }: {
|
|
49
50
|
id?: string;
|
|
@@ -12,10 +12,14 @@ export type BrandCollectionGraphQLItem = {
|
|
|
12
12
|
};
|
|
13
13
|
} & Pick<BrandCollectionEntry["fields"], "name" | "slot">;
|
|
14
14
|
export type ListBrandCollectionsResponse = {
|
|
15
|
-
|
|
15
|
+
page: number;
|
|
16
|
+
total: number;
|
|
17
|
+
size: number;
|
|
18
|
+
items: BrandCollectionGraphQLItem[];
|
|
16
19
|
};
|
|
17
|
-
export declare const listBrandCollections: ({
|
|
18
|
-
|
|
20
|
+
export declare const listBrandCollections: ({ page, size, marketCode, language, }?: {
|
|
21
|
+
page?: number;
|
|
22
|
+
size?: number;
|
|
19
23
|
marketCode?: string;
|
|
20
24
|
language?: string;
|
|
21
25
|
}) => Promise<ListBrandCollectionsResponse>;
|
|
@@ -35,22 +35,24 @@ export interface DocArticleDetailGraphQLItem extends DocArticleGraphQLItem {
|
|
|
35
35
|
seo: GraphQLSeo | null;
|
|
36
36
|
}
|
|
37
37
|
export type ListDocCategoriesResponse = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
page: number;
|
|
39
|
+
total: number;
|
|
40
|
+
size: number;
|
|
41
|
+
items: DocCategoryGraphQLItem[];
|
|
42
42
|
};
|
|
43
|
+
export type GetDocCategoryDetailResponse = DocCategoryGraphQLItem;
|
|
43
44
|
export type ListDocArticlesResponse = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
page: number;
|
|
46
|
+
total: number;
|
|
47
|
+
size: number;
|
|
48
|
+
items: DocArticleGraphQLItem[];
|
|
48
49
|
};
|
|
49
|
-
export
|
|
50
|
+
export type GetDocArticleDetailResponse = DocArticleDetailGraphQLItem;
|
|
51
|
+
export declare const listDocCategories: ({ marketCode, language, page, size, }?: {
|
|
50
52
|
marketCode?: string;
|
|
51
53
|
language?: string;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
page?: number;
|
|
55
|
+
size?: number;
|
|
54
56
|
}) => Promise<ListDocCategoriesResponse>;
|
|
55
57
|
export declare const getDocCategoryDetail: ({ id, slug, marketCode, language, }: {
|
|
56
58
|
id?: string;
|
|
@@ -58,12 +60,12 @@ export declare const getDocCategoryDetail: ({ id, slug, marketCode, language, }:
|
|
|
58
60
|
marketCode?: string;
|
|
59
61
|
language?: string;
|
|
60
62
|
}) => Promise<GetDocCategoryDetailResponse>;
|
|
61
|
-
export declare const listDocArticles: ({ marketCode, language, categorySlug,
|
|
63
|
+
export declare const listDocArticles: ({ marketCode, language, categorySlug, page, size, }?: {
|
|
62
64
|
marketCode?: string;
|
|
63
65
|
language?: string;
|
|
64
66
|
categorySlug?: string;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
page?: number;
|
|
68
|
+
size?: number;
|
|
67
69
|
}) => Promise<ListDocArticlesResponse>;
|
|
68
70
|
export declare const getDocArticleDetail: ({ id, slug, marketCode, language, }: {
|
|
69
71
|
id?: string;
|
|
@@ -8,13 +8,18 @@ export type HyperlinkCollectionGraphQLItem = {
|
|
|
8
8
|
linksCollection: {
|
|
9
9
|
items: Array<{
|
|
10
10
|
sys: GraphQLEntrySys;
|
|
11
|
-
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" |
|
|
11
|
+
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | 'marketHandling'>>;
|
|
12
12
|
};
|
|
13
13
|
} & Pick<HyperlinkCollectionEntry["fields"], "name" | "slot" | "order">;
|
|
14
14
|
export type ListHyperlinkCollectionsResponse = {
|
|
15
|
-
|
|
15
|
+
page: number;
|
|
16
|
+
total: number;
|
|
17
|
+
size: number;
|
|
18
|
+
items: HyperlinkCollectionGraphQLItem[];
|
|
16
19
|
};
|
|
17
|
-
export declare const listHyperlinkCollections: ({ marketCode, language, }?: {
|
|
20
|
+
export declare const listHyperlinkCollections: ({ page, size, marketCode, language, }?: {
|
|
21
|
+
page?: number;
|
|
22
|
+
size?: number;
|
|
18
23
|
marketCode?: string;
|
|
19
24
|
language?: string;
|
|
20
25
|
}) => Promise<ListHyperlinkCollectionsResponse>;
|
|
@@ -6,10 +6,14 @@ export type KeywordCollectionGraphQLItem = {
|
|
|
6
6
|
sys: GraphQLEntrySys;
|
|
7
7
|
} & Pick<KeywordCollectionEntry["fields"], "name" | "slot" | "keywords">;
|
|
8
8
|
export type ListKeywordCollectionsResponse = {
|
|
9
|
-
|
|
9
|
+
page: number;
|
|
10
|
+
total: number;
|
|
11
|
+
size: number;
|
|
12
|
+
items: KeywordCollectionGraphQLItem[];
|
|
10
13
|
};
|
|
11
|
-
export declare const listKeywordCollections: ({
|
|
12
|
-
|
|
14
|
+
export declare const listKeywordCollections: ({ page, size, marketCode, language, }?: {
|
|
15
|
+
page?: number;
|
|
16
|
+
size?: number;
|
|
13
17
|
marketCode?: string;
|
|
14
18
|
language?: string;
|
|
15
19
|
}) => Promise<ListKeywordCollectionsResponse>;
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var $e=Function.prototype.toString,C=Object.create,Ce=Object.prototype.toString,Oe=(function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(t){return!!~this._keys.indexOf(t)},e.prototype.get=function(t){return this._values[this._keys.indexOf(t)]},e.prototype.set=function(t,r){this._keys.push(t),this._values.push(r)},e})();function Se(){return new Oe}function je(){return new WeakMap}var Ae=typeof WeakMap<"u"?je:Se;function N(e){if(!e)return C(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:C(e);if(t&&~$e.call(t).indexOf("[native code]"))try{return new t}catch{}return C(e)}function Te(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}function _e(e){return e.flags}var ke=/test/g.flags==="g"?_e:Te;function ae(e){var t=Ce.call(e);return t.substring(8,t.length-1)}function qe(e){return e[Symbol.toStringTag]||ae(e)}var Pe=typeof Symbol<"u"?qe:ae,De=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,ce=Object.prototype,ue=ce.hasOwnProperty,xe=ce.propertyIsEnumerable,le=typeof V=="function";function Ie(e){return se(e).concat(V(e))}var Ee=le?Ie:se;function $(e,t,r){for(var s=Ee(e),a=0,i=s.length,n=void 0,o=void 0;a<i;++a)if(n=s[a],!(n==="callee"||n==="caller")){if(o=Re(e,n),!o){t[n]=r.copier(e[n],r);continue}!o.get&&!o.set&&(o.value=r.copier(o.value,r));try{De(t,n,o)}catch{t[n]=o.value}}return t}function Le(e,t){var r=new t.Constructor;t.cache.set(e,r);for(var s=0,a=e.length;s<a;++s)r[s]=t.copier(e[s],t);return r}function Be(e,t){var r=new t.Constructor;return t.cache.set(e,r),$(e,r,t)}function fe(e,t){return e.slice(0)}function Ne(e,t){return e.slice(0,e.size,e.type)}function Ve(e,t){return new t.Constructor(fe(e.buffer))}function Qe(e,t){return new t.Constructor(e.getTime())}function ge(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s,a){r.set(a,t.copier(s,t))}),r}function Me(e,t){return $(e,ge(e,t),t)}function Fe(e,t){var r=N(t.prototype);t.cache.set(e,r);for(var s in e)ue.call(e,s)&&(r[s]=t.copier(e[s],t));return r}function Ge(e,t){var r=N(t.prototype);t.cache.set(e,r);for(var s in e)ue.call(e,s)&&(r[s]=t.copier(e[s],t));for(var a=V(e),i=0,n=a.length,o=void 0;i<n;++i)o=a[i],xe.call(e,o)&&(r[o]=t.copier(e[o],t));return r}var Ue=le?Ge:Fe;function Ke(e,t){var r=N(t.prototype);return t.cache.set(e,r),$(e,r,t)}function O(e,t){return new t.Constructor(e.valueOf())}function We(e,t){var r=new t.Constructor(e.source,ke(e));return r.lastIndex=e.lastIndex,r}function w(e,t){return e}function pe(e,t){var r=new t.Constructor;return t.cache.set(e,r),e.forEach(function(s){r.add(t.copier(s,t))}),r}function ze(e,t){return $(e,pe(e,t),t)}var Je=Array.isArray,Q=Object.assign,He=Object.getPrototypeOf||(function(e){return e.__proto__}),ye={array:Le,arrayBuffer:fe,blob:Ne,dataView:Ve,date:Qe,error:w,map:ge,object:Ue,regExp:We,set:pe},Ye=Q({},ye,{array:Be,map:Me,object:Ke,set:ze});function Xe(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,Blob:e.blob,Boolean:O,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:O,Object:e.object,Promise:w,RegExp:e.regExp,Set:e.set,String:O,WeakMap:w,WeakSet:w,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer,Uint64Array:e.arrayBuffer}}function he(e){var t=Q({},ye,e),r=Xe(t),s=r.Array,a=r.Object;function i(n,o){if(o.prototype=o.Constructor=void 0,!n||typeof n!="object")return n;if(o.cache.has(n))return o.cache.get(n);if(o.prototype=He(n),o.Constructor=o.prototype&&o.prototype.constructor,!o.Constructor||o.Constructor===Object)return a(n,o);if(Je(n))return s(n,o);var c=r[Pe(n)];return c?c(n,o):typeof n.then=="function"?n:a(n,o)}return function(o){return i(o,{Constructor:void 0,cache:Ae(),copier:i,prototype:void 0})}}function Ze(e){return he(Q({},Ye,e))}Ze({});he({});var b=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S={exports:{}},G;function et(){if(G)return S.exports;G=1;var e=S.exports={},t,r;function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?t=setTimeout:t=s}catch{t=s}try{typeof clearTimeout=="function"?r=clearTimeout:r=a}catch{r=a}})();function i(g){if(t===setTimeout)return setTimeout(g,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(g,0);try{return t(g,0)}catch{try{return t.call(null,g,0)}catch{return t.call(this,g,0)}}}function n(g){if(r===clearTimeout)return clearTimeout(g);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(g);try{return r(g)}catch{try{return r.call(null,g)}catch{return r.call(this,g)}}}var o=[],c=!1,u,l=-1;function f(){!c||!u||(c=!1,u.length?o=u.concat(o):l=-1,o.length&&h())}function h(){if(!c){var g=i(f);c=!0;for(var y=o.length;y;){for(u=o,o=[];++l<y;)u&&u[l].run();l=-1,y=o.length}u=null,c=!1,n(g)}}e.nextTick=function(g){var y=new Array(arguments.length-1);if(arguments.length>1)for(var m=1;m<arguments.length;m++)y[m-1]=arguments[m];o.push(new F(g,y)),o.length===1&&!c&&i(h)};function F(g,y){this.fun=g,this.array=y}F.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function d(){}return e.on=d,e.addListener=d,e.once=d,e.off=d,e.removeListener=d,e.removeAllListeners=d,e.emit=d,e.prependListener=d,e.prependOnceListener=d,e.listeners=function(g){return[]},e.binding=function(g){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(g){throw new Error("process.chdir is not supported")},e.umask=function(){return 0},S.exports}et();var j,U;function tt(){if(U)return j;U=1;var e=typeof b=="object"&&b&&b.Object===Object&&b;return j=e,j}var A,K;function rt(){if(K)return A;K=1;var e=tt(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return A=r,A}var T,W;function de(){if(W)return T;W=1;var e=rt(),t=e.Symbol;return T=t,T}var _,z;function nt(){if(z)return _;z=1;var e=de(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,a=e?e.toStringTag:void 0;function i(n){var o=r.call(n,a),c=n[a];try{n[a]=void 0;var u=!0}catch{}var l=s.call(n);return u&&(o?n[a]=c:delete n[a]),l}return _=i,_}var k,J;function it(){if(J)return k;J=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return k=r,k}var q,H;function me(){if(H)return q;H=1;var e=de(),t=nt(),r=it(),s="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function n(o){return o==null?o===void 0?a:s:i&&i in Object(o)?t(o):r(o)}return q=n,q}var P,Y;function ot(){if(Y)return P;Y=1;var e=Array.isArray;return P=e,P}var D,X;function be(){if(X)return D;X=1;function e(t){return t!=null&&typeof t=="object"}return D=e,D}var R,Z;function at(){if(Z)return R;Z=1;var e=me(),t=ot(),r=be(),s="[object String]";function a(i){return typeof i=="string"||!t(i)&&r(i)&&e(i)==s}return R=a,R}at();var x,ee;function st(){if(ee)return x;ee=1;function e(t,r){return function(s){return t(r(s))}}return x=e,x}var I,te;function ct(){if(te)return I;te=1;var e=st(),t=e(Object.getPrototypeOf,Object);return I=t,I}var E,re;function ut(){if(re)return E;re=1;var e=me(),t=ct(),r=be(),s="[object Object]",a=Function.prototype,i=Object.prototype,n=a.toString,o=i.hasOwnProperty,c=n.call(Object);function u(l){if(!r(l)||e(l)!=s)return!1;var f=t(l);if(f===null)return!0;var h=o.call(f,"constructor")&&f.constructor;return typeof h=="function"&&h instanceof h&&n.call(h)==c}return E=u,E}ut();var ve={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},we={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint(we[0])).join("");Object.fromEntries(Object.entries(we).map(e=>e.reverse()));Object.fromEntries(Object.entries(ve).map(e=>e.reverse()));`${Object.values(ve).map(e=>`\\u{${e.toString(16)}}`).join("")}`;var L,ne;function lt(){if(ne)return L;ne=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;return L=function(r,s,a){if(t.call(s)!=="[object Function]")throw new TypeError("iterator must be a function");var i=r.length;if(i===+i)for(var n=0;n<i;n++)s.call(a,r[n],n,r);else for(var o in r)e.call(r,o)&&s.call(a,r[o],o,r)},L}var B,ie;function ft(){if(ie)return B;ie=1;var e=lt();B=t;function t(r,s,a){if(arguments.length===3)return t.set(r,s,a);if(arguments.length===2)return t.get(r,s);var i=t.bind(t,r);for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n].bind(i,r));return i}return t.get=function(r,s){for(var a=Array.isArray(s)?s:t.parse(s),i=0;i<a.length;++i){var n=a[i];if(!(typeof r=="object"&&n in r))throw new Error("Invalid reference token: "+n);r=r[n]}return r},t.set=function(r,s,a){var i=Array.isArray(s)?s:t.parse(s),n=i[0];if(i.length===0)throw Error("Can not set the root object");for(var o=0;o<i.length-1;++o){var c=i[o];typeof c!="string"&&typeof c!="number"&&(c=String(c)),!(c==="__proto__"||c==="constructor"||c==="prototype")&&(c==="-"&&Array.isArray(r)&&(c=r.length),n=i[o+1],c in r||(n.match(/^(\d+|-)$/)?r[c]=[]:r[c]={}),r=r[c])}return n==="-"&&Array.isArray(r)&&(n=r.length),r[n]=a,this},t.remove=function(r,s){var a=Array.isArray(s)?s:t.parse(s),i=a[a.length-1];if(i===void 0)throw new Error('Invalid JSON pointer for remove: "'+s+'"');var n=t.get(r,a.slice(0,-1));if(Array.isArray(n)){var o=+i;if(i===""&&isNaN(o))throw new Error('Invalid array index: "'+i+'"');Array.prototype.splice.call(n,o,1)}else delete n[i]},t.dict=function(r,s){var a={};return t.walk(r,function(i,n){a[n]=i},s),a},t.walk=function(r,s,a){var i=[];a=a||function(n){var o=Object.prototype.toString.call(n);return o==="[object Object]"||o==="[object Array]"},(function n(o){e(o,function(c,u){i.push(String(u)),a(c)?n(c):s(c,t.compile(i)),i.pop()})})(r)},t.has=function(r,s){try{t.get(r,s)}catch{return!1}return!0},t.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},t.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},t.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(t.unescape)},t.compile=function(r){return r.length===0?"":"/"+r.map(t.escape).join("/")},B}ft();var v={exports:{}},oe;function gt(){return oe||(oe=1,(function(e,t){t=e.exports=r,t.getSerialize=s;function r(a,i,n,o){return JSON.stringify(a,s(i,o),n)}function s(a,i){var n=[],o=[];return i==null&&(i=function(c,u){return n[0]===u?"[Circular ~]":"[Circular ~."+o.slice(0,n.indexOf(u)).join(".")+"]"}),function(c,u){if(n.length>0){var l=n.indexOf(this);~l?n.splice(l+1):n.push(this),~l?o.splice(l,1/0,c):o.push(c),~n.indexOf(u)&&(u=i.call(this,c,u))}else n.push(u);return a==null?u:a.call(this,c,u)}}})(v,v.exports)),v.exports}gt();class p{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(t){this._clientParams={...t,environment:t.environment??"master"}}static async graphqlQuery(t,r={}){const{space:s,accessToken:a,environment:i="master"}=this.clientParams,n=await fetch(`https://graphql.contentful.com/content/v1/spaces/${s}/environments/${i}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({query:t,variables:r})});if(!n.ok){const c=await n.text();throw new Error(`GraphQL request failed: ${n.status} ${n.statusText}
|
|
2
|
-
${c}`)}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var wt=Function.prototype.toString,C=Object.create,St=Object.prototype.toString,Ct=(function(){function t(){this._keys=[],this._values=[]}return t.prototype.has=function(e){return!!~this._keys.indexOf(e)},t.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},t.prototype.set=function(e,r){this._keys.push(e),this._values.push(r)},t})();function Ot(){return new Ct}function At(){return new WeakMap}var jt=typeof WeakMap<"u"?At:Ot;function B(t){if(!t)return C(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:C(t);if(e&&~wt.call(e).indexOf("[native code]"))try{return new e}catch{}return C(t)}function kt(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}function Tt(t){return t.flags}var _t=/test/g.flags==="g"?Tt:kt;function at(t){var e=St.call(t);return e.substring(8,e.length-1)}function qt(t){return t[Symbol.toStringTag]||at(t)}var Pt=typeof Symbol<"u"?qt:at,xt=Object.defineProperty,Dt=Object.getOwnPropertyDescriptor,st=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,ct=Object.prototype,lt=ct.hasOwnProperty,Rt=ct.propertyIsEnumerable,ut=typeof N=="function";function It(t){return st(t).concat(N(t))}var Mt=ut?It:st;function S(t,e,r){for(var s=Mt(t),a=0,o=s.length,n=void 0,i=void 0;a<o;++a)if(n=s[a],!(n==="callee"||n==="caller")){if(i=Dt(t,n),!i){e[n]=r.copier(t[n],r);continue}!i.get&&!i.set&&(i.value=r.copier(i.value,r));try{xt(e,n,i)}catch{e[n]=i.value}}return e}function zt(t,e){var r=new e.Constructor;e.cache.set(t,r);for(var s=0,a=t.length;s<a;++s)r[s]=e.copier(t[s],e);return r}function Et(t,e){var r=new e.Constructor;return e.cache.set(t,r),S(t,r,e)}function gt(t,e){return t.slice(0)}function Lt(t,e){return t.slice(0,t.size,t.type)}function Bt(t,e){return new e.Constructor(gt(t.buffer))}function Nt(t,e){return new e.Constructor(t.getTime())}function ft(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(s,a){r.set(a,e.copier(s,e))}),r}function Vt(t,e){return S(t,ft(t,e),e)}function Qt(t,e){var r=B(e.prototype);e.cache.set(t,r);for(var s in t)lt.call(t,s)&&(r[s]=e.copier(t[s],e));return r}function Ft(t,e){var r=B(e.prototype);e.cache.set(t,r);for(var s in t)lt.call(t,s)&&(r[s]=e.copier(t[s],e));for(var a=N(t),o=0,n=a.length,i=void 0;o<n;++o)i=a[o],Rt.call(t,i)&&(r[i]=e.copier(t[i],e));return r}var Gt=ut?Ft:Qt;function Ut(t,e){var r=B(e.prototype);return e.cache.set(t,r),S(t,r,e)}function O(t,e){return new e.Constructor(t.valueOf())}function Kt(t,e){var r=new e.Constructor(t.source,_t(t));return r.lastIndex=t.lastIndex,r}function w(t,e){return t}function pt(t,e){var r=new e.Constructor;return e.cache.set(t,r),t.forEach(function(s){r.add(e.copier(s,e))}),r}function Wt(t,e){return S(t,pt(t,e),e)}var Jt=Array.isArray,V=Object.assign,Ht=Object.getPrototypeOf||(function(t){return t.__proto__}),ht={array:zt,arrayBuffer:gt,blob:Lt,dataView:Bt,date:Nt,error:w,map:ft,object:Gt,regExp:Kt,set:pt},Yt=V({},ht,{array:Et,map:Vt,object:Ut,set:Wt});function Xt(t){return{Arguments:t.object,Array:t.array,ArrayBuffer:t.arrayBuffer,Blob:t.blob,Boolean:O,DataView:t.dataView,Date:t.date,Error:t.error,Float32Array:t.arrayBuffer,Float64Array:t.arrayBuffer,Int8Array:t.arrayBuffer,Int16Array:t.arrayBuffer,Int32Array:t.arrayBuffer,Map:t.map,Number:O,Object:t.object,Promise:w,RegExp:t.regExp,Set:t.set,String:O,WeakMap:w,WeakSet:w,Uint8Array:t.arrayBuffer,Uint8ClampedArray:t.arrayBuffer,Uint16Array:t.arrayBuffer,Uint32Array:t.arrayBuffer,Uint64Array:t.arrayBuffer}}function yt(t){var e=V({},ht,t),r=Xt(e),s=r.Array,a=r.Object;function o(n,i){if(i.prototype=i.Constructor=void 0,!n||typeof n!="object")return n;if(i.cache.has(n))return i.cache.get(n);if(i.prototype=Ht(n),i.Constructor=i.prototype&&i.prototype.constructor,!i.Constructor||i.Constructor===Object)return a(n,i);if(Jt(n))return s(n,i);var c=r[Pt(n)];return c?c(n,i):typeof n.then=="function"?n:a(n,i)}return function(i){return o(i,{Constructor:void 0,cache:jt(),copier:o,prototype:void 0})}}function Zt(t){return yt(V({},Yt,t))}Zt({});yt({});var v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},A={exports:{}},F;function te(){if(F)return A.exports;F=1;var t=A.exports={},e,r;function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=s}catch{e=s}try{typeof clearTimeout=="function"?r=clearTimeout:r=a}catch{r=a}})();function o(p){if(e===setTimeout)return setTimeout(p,0);if((e===s||!e)&&setTimeout)return e=setTimeout,setTimeout(p,0);try{return e(p,0)}catch{try{return e.call(null,p,0)}catch{return e.call(this,p,0)}}}function n(p){if(r===clearTimeout)return clearTimeout(p);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(p);try{return r(p)}catch{try{return r.call(null,p)}catch{return r.call(this,p)}}}var i=[],c=!1,l,u=-1;function g(){!c||!l||(c=!1,l.length?i=l.concat(i):u=-1,i.length&&f())}function f(){if(!c){var p=o(g);c=!0;for(var d=i.length;d;){for(l=i,i=[];++u<d;)l&&l[u].run();u=-1,d=i.length}l=null,c=!1,n(p)}}t.nextTick=function(p){var d=new Array(arguments.length-1);if(arguments.length>1)for(var b=1;b<arguments.length;b++)d[b-1]=arguments[b];i.push(new y(p,d)),i.length===1&&!c&&o(f)};function y(p,d){this.fun=p,this.array=d}y.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={};function h(){}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){return[]},t.binding=function(p){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(p){throw new Error("process.chdir is not supported")},t.umask=function(){return 0},A.exports}te();var j,G;function ee(){if(G)return j;G=1;var t=typeof v=="object"&&v&&v.Object===Object&&v;return j=t,j}var k,U;function re(){if(U)return k;U=1;var t=ee(),e=typeof self=="object"&&self&&self.Object===Object&&self,r=t||e||Function("return this")();return k=r,k}var T,K;function mt(){if(K)return T;K=1;var t=re(),e=t.Symbol;return T=e,T}var _,W;function ne(){if(W)return _;W=1;var t=mt(),e=Object.prototype,r=e.hasOwnProperty,s=e.toString,a=t?t.toStringTag:void 0;function o(n){var i=r.call(n,a),c=n[a];try{n[a]=void 0;var l=!0}catch{}var u=s.call(n);return l&&(i?n[a]=c:delete n[a]),u}return _=o,_}var q,J;function ie(){if(J)return q;J=1;var t=Object.prototype,e=t.toString;function r(s){return e.call(s)}return q=r,q}var P,H;function dt(){if(H)return P;H=1;var t=mt(),e=ne(),r=ie(),s="[object Null]",a="[object Undefined]",o=t?t.toStringTag:void 0;function n(i){return i==null?i===void 0?a:s:o&&o in Object(i)?e(i):r(i)}return P=n,P}var x,Y;function oe(){if(Y)return x;Y=1;var t=Array.isArray;return x=t,x}var D,X;function bt(){if(X)return D;X=1;function t(e){return e!=null&&typeof e=="object"}return D=t,D}var R,Z;function ae(){if(Z)return R;Z=1;var t=dt(),e=oe(),r=bt(),s="[object String]";function a(o){return typeof o=="string"||!e(o)&&r(o)&&t(o)==s}return R=a,R}ae();var I,tt;function se(){if(tt)return I;tt=1;function t(e,r){return function(s){return e(r(s))}}return I=t,I}var M,et;function ce(){if(et)return M;et=1;var t=se(),e=t(Object.getPrototypeOf,Object);return M=e,M}var z,rt;function le(){if(rt)return z;rt=1;var t=dt(),e=ce(),r=bt(),s="[object Object]",a=Function.prototype,o=Object.prototype,n=a.toString,i=o.hasOwnProperty,c=n.call(Object);function l(u){if(!r(u)||t(u)!=s)return!1;var g=e(u);if(g===null)return!0;var f=i.call(g,"constructor")&&g.constructor;return typeof f=="function"&&f instanceof f&&n.call(f)==c}return z=l,z}le();var vt={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},$t={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint($t[0])).join("");Object.fromEntries(Object.entries($t).map(t=>t.reverse()));Object.fromEntries(Object.entries(vt).map(t=>t.reverse()));`${Object.values(vt).map(t=>`\\u{${t.toString(16)}}`).join("")}`;var E,nt;function ue(){if(nt)return E;nt=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString;return E=function(r,s,a){if(e.call(s)!=="[object Function]")throw new TypeError("iterator must be a function");var o=r.length;if(o===+o)for(var n=0;n<o;n++)s.call(a,r[n],n,r);else for(var i in r)t.call(r,i)&&s.call(a,r[i],i,r)},E}var L,it;function ge(){if(it)return L;it=1;var t=ue();L=e;function e(r,s,a){if(arguments.length===3)return e.set(r,s,a);if(arguments.length===2)return e.get(r,s);var o=e.bind(e,r);for(var n in e)e.hasOwnProperty(n)&&(o[n]=e[n].bind(o,r));return o}return e.get=function(r,s){for(var a=Array.isArray(s)?s:e.parse(s),o=0;o<a.length;++o){var n=a[o];if(!(typeof r=="object"&&n in r))throw new Error("Invalid reference token: "+n);r=r[n]}return r},e.set=function(r,s,a){var o=Array.isArray(s)?s:e.parse(s),n=o[0];if(o.length===0)throw Error("Can not set the root object");for(var i=0;i<o.length-1;++i){var c=o[i];typeof c!="string"&&typeof c!="number"&&(c=String(c)),!(c==="__proto__"||c==="constructor"||c==="prototype")&&(c==="-"&&Array.isArray(r)&&(c=r.length),n=o[i+1],c in r||(n.match(/^(\d+|-)$/)?r[c]=[]:r[c]={}),r=r[c])}return n==="-"&&Array.isArray(r)&&(n=r.length),r[n]=a,this},e.remove=function(r,s){var a=Array.isArray(s)?s:e.parse(s),o=a[a.length-1];if(o===void 0)throw new Error('Invalid JSON pointer for remove: "'+s+'"');var n=e.get(r,a.slice(0,-1));if(Array.isArray(n)){var i=+o;if(o===""&&isNaN(i))throw new Error('Invalid array index: "'+o+'"');Array.prototype.splice.call(n,i,1)}else delete n[o]},e.dict=function(r,s){var a={};return e.walk(r,function(o,n){a[n]=o},s),a},e.walk=function(r,s,a){var o=[];a=a||function(n){var i=Object.prototype.toString.call(n);return i==="[object Object]"||i==="[object Array]"},(function n(i){t(i,function(c,l){o.push(String(l)),a(c)?n(c):s(c,e.compile(o)),o.pop()})})(r)},e.has=function(r,s){try{e.get(r,s)}catch{return!1}return!0},e.escape=function(r){return r.toString().replace(/~/g,"~0").replace(/\//g,"~1")},e.unescape=function(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")},e.parse=function(r){if(r==="")return[];if(r.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+r);return r.substring(1).split(/\//).map(e.unescape)},e.compile=function(r){return r.length===0?"":"/"+r.map(e.escape).join("/")},L}ge();var $={exports:{}},ot;function fe(){return ot||(ot=1,(function(t,e){e=t.exports=r,e.getSerialize=s;function r(a,o,n,i){return JSON.stringify(a,s(o,i),n)}function s(a,o){var n=[],i=[];return o==null&&(o=function(c,l){return n[0]===l?"[Circular ~]":"[Circular ~."+i.slice(0,n.indexOf(l)).join(".")+"]"}),function(c,l){if(n.length>0){var u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?i.splice(u,1/0,c):i.push(c),~n.indexOf(l)&&(l=o.call(this,c,l))}else n.push(l);return a==null?l:a.call(this,c,l)}}})($,$.exports)),$.exports}fe();class m{static _clientParams;static get clientParams(){if(!this._clientParams)throw new Error("Client is not configured");return this._clientParams}static configure(e){this._clientParams={...e,environment:e.environment??"master"}}static async graphqlQuery(e,r={}){const{space:s,accessToken:a,environment:o="master"}=this.clientParams,n=await fetch(`https://graphql.contentful.com/content/v1/spaces/${s}/environments/${o}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({query:e,variables:r})});if(!n.ok){const c=await n.text();throw new Error(`GraphQL request failed: ${n.status} ${n.statusText}
|
|
2
|
+
${c}`)}const i=await n.json();if(i.errors)throw new Error(`GraphQL errors: ${JSON.stringify(i.errors,null,2)}`);return i.data}}const pe=async({slot:t,page:e=1,size:r=20,platform:s,marketCode:a,language:o})=>{const n=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(r)),c=["$slot: String!","$limit: Int!","$skip: Int!"],l={slot:t,limit:i,skip:(n-1)*i},u=["{ slot: $slot }"];s&&(c.push("$platform: String!"),l.platform=s,u.push("{ platform_contains_some: [$platform] }")),a&&(c.push("$marketCode: String!"),l.marketCode=a,u.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),o&&(c.push("$language: String!"),l.language=o,u.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const g=`(${c.join(", ")})`,f=`(
|
|
3
3
|
limit: $limit
|
|
4
|
+
skip: $skip
|
|
4
5
|
where: {
|
|
5
6
|
AND: [
|
|
6
|
-
${
|
|
7
|
+
${u.join(`
|
|
7
8
|
`)}
|
|
8
9
|
]
|
|
9
10
|
}
|
|
10
|
-
)`,
|
|
11
|
-
query${
|
|
12
|
-
bannerCollectionCollection${
|
|
11
|
+
)`,y=`
|
|
12
|
+
query${g} {
|
|
13
|
+
bannerCollectionCollection${f} {
|
|
14
|
+
total
|
|
13
15
|
items {
|
|
14
16
|
sys {
|
|
15
17
|
id
|
|
@@ -30,7 +32,7 @@ query${c} {
|
|
|
30
32
|
label
|
|
31
33
|
url
|
|
32
34
|
target
|
|
33
|
-
|
|
35
|
+
marketHandling
|
|
34
36
|
}
|
|
35
37
|
media {
|
|
36
38
|
url
|
|
@@ -43,22 +45,23 @@ query${c} {
|
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
`,{bannerCollectionCollection:
|
|
48
|
+
`,{bannerCollectionCollection:h}=await m.graphqlQuery(y,{...l});return{page:n,total:h.total,size:i,items:h.items}};class Q extends Response{constructor(...e){super(e[0]??"Not Found",{status:404,...e[1]})}}const he=async({marketCode:t,language:e,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(s)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=["limit: $limit","skip: $skip"],l=[];t&&(n.push("$marketCode: String!"),i.marketCode=t,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),e&&(n.push("$language: String!"),i.language=e,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
47
49
|
AND: [
|
|
48
|
-
${
|
|
50
|
+
${l.join(`
|
|
49
51
|
`)}
|
|
50
52
|
]
|
|
51
|
-
}`);const
|
|
52
|
-
${
|
|
53
|
+
}`);const u=n.length?`(${n.join(", ")})`:"",g=c.length?`(
|
|
54
|
+
${c.join(`
|
|
53
55
|
`)}
|
|
54
|
-
)`:"",
|
|
55
|
-
query${
|
|
56
|
-
blogPostCollection${
|
|
56
|
+
)`:"",f=`
|
|
57
|
+
query${u} {
|
|
58
|
+
blogPostCollection${g} {
|
|
59
|
+
total
|
|
57
60
|
items {
|
|
58
61
|
sys {
|
|
59
62
|
id
|
|
60
|
-
createdAt
|
|
61
|
-
updatedAt
|
|
63
|
+
createdAt: firstPublishedAt
|
|
64
|
+
updatedAt: publishedAt
|
|
62
65
|
}
|
|
63
66
|
title
|
|
64
67
|
shortDescription
|
|
@@ -76,7 +79,7 @@ query${c} {
|
|
|
76
79
|
}
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
`,{blogPostCollection:
|
|
82
|
+
`,{blogPostCollection:y}=await m.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},ye=async({id:t,slug:e,marketCode:r,language:s})=>{const a=[],o={},n=[];if(t)a.push("$id: String!"),o.id=t,n.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),o.slug=e,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
80
83
|
limit: 1
|
|
81
84
|
where: {
|
|
82
85
|
AND: [
|
|
@@ -84,14 +87,14 @@ query${c} {
|
|
|
84
87
|
`)}
|
|
85
88
|
]
|
|
86
89
|
}
|
|
87
|
-
)`,
|
|
88
|
-
query${
|
|
90
|
+
)`,l=`
|
|
91
|
+
query${i} {
|
|
89
92
|
blogPostCollection${c} {
|
|
90
93
|
items {
|
|
91
94
|
sys {
|
|
92
95
|
id
|
|
93
|
-
createdAt
|
|
94
|
-
updatedAt
|
|
96
|
+
createdAt: firstPublishedAt
|
|
97
|
+
updatedAt: publishedAt
|
|
95
98
|
}
|
|
96
99
|
title
|
|
97
100
|
shortDescription
|
|
@@ -127,19 +130,22 @@ query${o} {
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
`,{blogPostCollection:
|
|
133
|
+
`,{blogPostCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},me=async({page:t=1,size:e=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(e)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=`(${n.join(", ")})`,u=c.length?`(
|
|
131
134
|
limit: $limit
|
|
135
|
+
skip: $skip
|
|
132
136
|
where: {
|
|
133
137
|
AND: [
|
|
134
|
-
${
|
|
138
|
+
${c.join(`
|
|
135
139
|
`)}
|
|
136
140
|
]
|
|
137
141
|
}
|
|
138
142
|
)`:`(
|
|
139
143
|
limit: $limit
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
skip: $skip
|
|
145
|
+
)`,g=`
|
|
146
|
+
query${l} {
|
|
147
|
+
brandCollectionCollection${u} {
|
|
148
|
+
total
|
|
143
149
|
items {
|
|
144
150
|
sys {
|
|
145
151
|
id
|
|
@@ -158,22 +164,23 @@ query${n} {
|
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
}
|
|
161
|
-
`,{brandCollectionCollection:
|
|
167
|
+
`,{brandCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},de=async({marketCode:t,language:e,page:r=1,size:s=20}={})=>{const a=Math.max(1,Math.floor(r)),o=Math.max(1,Math.floor(s)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=["limit: $limit","skip: $skip"],l=[];t&&(n.push("$marketCode: String!"),i.marketCode=t,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),e&&(n.push("$language: String!"),i.language=e,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
162
168
|
AND: [
|
|
163
|
-
${
|
|
169
|
+
${l.join(`
|
|
164
170
|
`)}
|
|
165
171
|
]
|
|
166
|
-
}`);const
|
|
167
|
-
${
|
|
172
|
+
}`);const u=n.length?`(${n.join(", ")})`:"",g=c.length?`(
|
|
173
|
+
${c.join(`
|
|
168
174
|
`)}
|
|
169
|
-
)`:"",
|
|
170
|
-
query${
|
|
171
|
-
documentationCategoryCollection${
|
|
175
|
+
)`:"",f=`
|
|
176
|
+
query${u} {
|
|
177
|
+
documentationCategoryCollection${g} {
|
|
178
|
+
total
|
|
172
179
|
items {
|
|
173
180
|
sys {
|
|
174
181
|
id
|
|
175
|
-
createdAt
|
|
176
|
-
updatedAt
|
|
182
|
+
createdAt: firstPublishedAt
|
|
183
|
+
updatedAt: publishedAt
|
|
177
184
|
}
|
|
178
185
|
title
|
|
179
186
|
slug
|
|
@@ -188,7 +195,7 @@ query${c} {
|
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
197
|
}
|
|
191
|
-
`,{documentationCategoryCollection:
|
|
198
|
+
`,{documentationCategoryCollection:y}=await m.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},be=async({id:t,slug:e,marketCode:r,language:s})=>{const a=[],o={},n=[];if(t)a.push("$id: String!"),o.id=t,n.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),o.slug=e,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
192
199
|
limit: 1
|
|
193
200
|
where: {
|
|
194
201
|
AND: [
|
|
@@ -196,14 +203,14 @@ query${c} {
|
|
|
196
203
|
`)}
|
|
197
204
|
]
|
|
198
205
|
}
|
|
199
|
-
)`,
|
|
200
|
-
query${
|
|
206
|
+
)`,l=`
|
|
207
|
+
query${i} {
|
|
201
208
|
documentationCategoryCollection${c} {
|
|
202
209
|
items {
|
|
203
210
|
sys {
|
|
204
211
|
id
|
|
205
|
-
createdAt
|
|
206
|
-
updatedAt
|
|
212
|
+
createdAt: firstPublishedAt
|
|
213
|
+
updatedAt: publishedAt
|
|
207
214
|
}
|
|
208
215
|
title
|
|
209
216
|
slug
|
|
@@ -218,22 +225,23 @@ query${o} {
|
|
|
218
225
|
}
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
|
-
`,{documentationCategoryCollection:
|
|
228
|
+
`,{documentationCategoryCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},ve=async({marketCode:t,language:e,categorySlug:r,page:s=1,size:a=20}={})=>{const o=Math.max(1,Math.floor(s)),n=Math.max(1,Math.floor(a)),i=["$limit: Int!","$skip: Int!"],c={limit:n,skip:(o-1)*n},l=["limit: $limit","skip: $skip"],u=[];t&&(i.push("$marketCode: String!"),c.marketCode=t,u.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),e&&(i.push("$language: String!"),c.language=e,u.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),r&&(i.push("$categorySlug: String!"),c.categorySlug=r,u.push("{ category: { slug: $categorySlug } }")),u.length&&l.push(`where: {
|
|
222
229
|
AND: [
|
|
223
|
-
${
|
|
230
|
+
${u.join(`
|
|
224
231
|
`)}
|
|
225
232
|
]
|
|
226
|
-
}`);const
|
|
227
|
-
${
|
|
233
|
+
}`);const g=i.length?`(${i.join(", ")})`:"",f=l.length?`(
|
|
234
|
+
${l.join(`
|
|
228
235
|
`)}
|
|
229
|
-
)`:"",
|
|
230
|
-
query${
|
|
231
|
-
documentationArticleCollection${
|
|
236
|
+
)`:"",y=`
|
|
237
|
+
query${g} {
|
|
238
|
+
documentationArticleCollection${f} {
|
|
239
|
+
total
|
|
232
240
|
items {
|
|
233
241
|
sys {
|
|
234
242
|
id
|
|
235
|
-
createdAt
|
|
236
|
-
updatedAt
|
|
243
|
+
createdAt: firstPublishedAt
|
|
244
|
+
updatedAt: publishedAt
|
|
237
245
|
}
|
|
238
246
|
title
|
|
239
247
|
slug
|
|
@@ -255,7 +263,7 @@ query${u} {
|
|
|
255
263
|
}
|
|
256
264
|
}
|
|
257
265
|
}
|
|
258
|
-
`,{documentationArticleCollection:h}=await
|
|
266
|
+
`,{documentationArticleCollection:h}=await m.graphqlQuery(y,{...c});return{page:o,total:h.total,size:n,items:h.items}},$e=async({id:t,slug:e,marketCode:r,language:s})=>{const a=[],o={},n=[];if(t)a.push("$id: String!"),o.id=t,n.push("{ sys: { id: $id } }");else if(e)a.push("$slug: String!"),o.slug=e,n.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");r&&(a.push("$marketCode: String!"),o.marketCode=r,n.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(a.push("$language: String!"),o.language=s,n.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const i=`(${a.join(", ")})`,c=`(
|
|
259
267
|
limit: 1
|
|
260
268
|
where: {
|
|
261
269
|
AND: [
|
|
@@ -263,14 +271,14 @@ query${u} {
|
|
|
263
271
|
`)}
|
|
264
272
|
]
|
|
265
273
|
}
|
|
266
|
-
)`,
|
|
267
|
-
query${
|
|
274
|
+
)`,l=`
|
|
275
|
+
query${i} {
|
|
268
276
|
documentationArticleCollection${c} {
|
|
269
277
|
items {
|
|
270
278
|
sys {
|
|
271
279
|
id
|
|
272
|
-
createdAt
|
|
273
|
-
updatedAt
|
|
280
|
+
createdAt: firstPublishedAt
|
|
281
|
+
updatedAt: publishedAt
|
|
274
282
|
}
|
|
275
283
|
title
|
|
276
284
|
slug
|
|
@@ -301,16 +309,22 @@ query${o} {
|
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
|
-
`,{documentationArticleCollection:
|
|
312
|
+
`,{documentationArticleCollection:u}=await m.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},we=async({page:t=1,size:e=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(e)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=n.length?`(${n.join(", ")})`:"",u=c.length?`(
|
|
313
|
+
limit: $limit
|
|
314
|
+
skip: $skip
|
|
305
315
|
where: {
|
|
306
316
|
AND: [
|
|
307
|
-
${
|
|
317
|
+
${c.join(`
|
|
308
318
|
`)}
|
|
309
319
|
]
|
|
310
320
|
}
|
|
311
|
-
)
|
|
312
|
-
|
|
313
|
-
|
|
321
|
+
)`:`(
|
|
322
|
+
limit: $limit
|
|
323
|
+
skip: $skip
|
|
324
|
+
)`,g=`
|
|
325
|
+
query${l} {
|
|
326
|
+
hyperlinkCollectionCollection${u} {
|
|
327
|
+
total
|
|
314
328
|
items {
|
|
315
329
|
sys {
|
|
316
330
|
id
|
|
@@ -326,25 +340,28 @@ query${i} {
|
|
|
326
340
|
label
|
|
327
341
|
url
|
|
328
342
|
target
|
|
329
|
-
|
|
343
|
+
marketHandling
|
|
330
344
|
}
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
347
|
}
|
|
334
348
|
}
|
|
335
|
-
`,{hyperlinkCollectionCollection:
|
|
349
|
+
`,{hyperlinkCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},Se=async({page:t=1,size:e=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(t)),o=Math.max(1,Math.floor(e)),n=["$limit: Int!","$skip: Int!"],i={limit:o,skip:(a-1)*o},c=[];r&&(n.push("$marketCode: String!"),i.marketCode=r,c.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),s&&(n.push("$language: String!"),i.language=s,c.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }"));const l=`(${n.join(", ")})`,u=c.length?`(
|
|
336
350
|
limit: $limit
|
|
351
|
+
skip: $skip
|
|
337
352
|
where: {
|
|
338
353
|
AND: [
|
|
339
|
-
${
|
|
354
|
+
${c.join(`
|
|
340
355
|
`)}
|
|
341
356
|
]
|
|
342
357
|
}
|
|
343
358
|
)`:`(
|
|
344
359
|
limit: $limit
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
360
|
+
skip: $skip
|
|
361
|
+
)`,g=`
|
|
362
|
+
query${l} {
|
|
363
|
+
keywordCollectionCollection${u} {
|
|
364
|
+
total
|
|
348
365
|
items {
|
|
349
366
|
sys {
|
|
350
367
|
id
|
|
@@ -355,4 +372,4 @@ query${n} {
|
|
|
355
372
|
}
|
|
356
373
|
}
|
|
357
374
|
}
|
|
358
|
-
`,{keywordCollectionCollection:
|
|
375
|
+
`,{keywordCollectionCollection:f}=await m.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}};exports.ContentfulSDK=m;exports.getBlogPostDetail=ye;exports.getDocArticleDetail=$e;exports.getDocCategoryDetail=be;exports.listBannerCollections=pe;exports.listBlogPosts=he;exports.listBrandCollections=me;exports.listDocArticles=ve;exports.listDocCategories=de;exports.listHyperlinkCollections=we;exports.listKeywordCollections=Se;
|