@janbox/contentful-marketplace-sdk 1.0.4 → 1.0.6
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 +18 -18
- package/dist/entries/banner-collection.d.ts +5 -10
- package/dist/entries/blog.d.ts +9 -10
- package/dist/entries/brand-collection.d.ts +10 -5
- package/dist/entries/documentation.d.ts +12 -13
- package/dist/entries/hyperlink-collection.d.ts +3 -3
- package/dist/entries/keyword-collection.d.ts +3 -3
- package/dist/index.cjs +59 -13
- package/dist/index.js +151 -105
- package/dist/types/content-model.d.ts +145 -0
- package/dist/types/index.d.ts +11 -145
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ yarn add @janbox/contentful-marketplace-sdk contentful
|
|
|
29
29
|
```ts
|
|
30
30
|
import {
|
|
31
31
|
ContentfulSDK,
|
|
32
|
-
|
|
32
|
+
getBannerCollections,
|
|
33
33
|
} from "@janbox/contentful-marketplace-sdk";
|
|
34
34
|
import type { CreateClientParams } from "contentful";
|
|
35
35
|
|
|
@@ -41,7 +41,7 @@ const clientOptions: CreateClientParams = {
|
|
|
41
41
|
|
|
42
42
|
ContentfulSDK.configure(clientOptions);
|
|
43
43
|
|
|
44
|
-
const result = await
|
|
44
|
+
const result = await getBannerCollections({
|
|
45
45
|
slot: "home_hero",
|
|
46
46
|
marketCode: "vn",
|
|
47
47
|
language: "en",
|
|
@@ -75,15 +75,15 @@ Notes:
|
|
|
75
75
|
|
|
76
76
|
## API Methods
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
Collection methods return `{ page, total, size, items }`.
|
|
79
79
|
Detail methods return the entry object directly.
|
|
80
80
|
|
|
81
81
|
### Banner Collection
|
|
82
82
|
|
|
83
|
-
- `
|
|
83
|
+
- `getBannerCollections(options)`
|
|
84
84
|
|
|
85
85
|
```ts
|
|
86
|
-
await
|
|
86
|
+
await getBannerCollections({
|
|
87
87
|
slot: "home_hero",
|
|
88
88
|
page: 1,
|
|
89
89
|
size: 20,
|
|
@@ -95,11 +95,11 @@ await listBannerCollections({
|
|
|
95
95
|
|
|
96
96
|
### Blog
|
|
97
97
|
|
|
98
|
-
- `
|
|
98
|
+
- `getBlogPosts(options?)`
|
|
99
99
|
- `getBlogPostDetail({ id } | { slug })`
|
|
100
100
|
|
|
101
101
|
```ts
|
|
102
|
-
const posts = await
|
|
102
|
+
const posts = await getBlogPosts({
|
|
103
103
|
marketCode: "vn",
|
|
104
104
|
language: "en",
|
|
105
105
|
page: 1,
|
|
@@ -122,13 +122,13 @@ const postById = await getBlogPostDetail({
|
|
|
122
122
|
|
|
123
123
|
### Documentation
|
|
124
124
|
|
|
125
|
-
- `
|
|
125
|
+
- `getDocCategories(options?)`
|
|
126
126
|
- `getDocCategoryDetail({ id } | { slug })`
|
|
127
|
-
- `
|
|
127
|
+
- `getDocArticles(options?)`
|
|
128
128
|
- `getDocArticleDetail({ id } | { slug })`
|
|
129
129
|
|
|
130
130
|
```ts
|
|
131
|
-
const categories = await
|
|
131
|
+
const categories = await getDocCategories({
|
|
132
132
|
marketCode: "vn",
|
|
133
133
|
language: "en",
|
|
134
134
|
page: 1,
|
|
@@ -148,14 +148,14 @@ const categoryById = await getDocCategoryDetail({
|
|
|
148
148
|
language: "en",
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
const articles = await
|
|
151
|
+
const articles = await getDocArticles({
|
|
152
152
|
categorySlug: "getting-started",
|
|
153
153
|
marketCode: "vn",
|
|
154
154
|
language: "en",
|
|
155
155
|
page: 1,
|
|
156
156
|
size: 10,
|
|
157
157
|
});
|
|
158
|
-
//
|
|
158
|
+
// getDocArticles returns summary fields only (no content, no seo)
|
|
159
159
|
|
|
160
160
|
const article = await getDocArticleDetail({
|
|
161
161
|
slug: "payment-methods",
|
|
@@ -172,26 +172,26 @@ const articleById = await getDocArticleDetail({
|
|
|
172
172
|
|
|
173
173
|
### Brand / Hyperlink / Keyword Collections
|
|
174
174
|
|
|
175
|
-
- `
|
|
176
|
-
- `
|
|
177
|
-
- `
|
|
175
|
+
- `getBrandCollections(options?)`
|
|
176
|
+
- `getHyperlinkCollections(options?)`
|
|
177
|
+
- `getKeywordCollections(options?)`
|
|
178
178
|
|
|
179
179
|
```ts
|
|
180
|
-
const brands = await
|
|
180
|
+
const brands = await getBrandCollections({
|
|
181
181
|
marketCode: "vn",
|
|
182
182
|
language: "en",
|
|
183
183
|
page: 1,
|
|
184
184
|
size: 20,
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
-
const links = await
|
|
187
|
+
const links = await getHyperlinkCollections({
|
|
188
188
|
page: 1,
|
|
189
189
|
size: 20,
|
|
190
190
|
marketCode: "vn",
|
|
191
191
|
language: "en",
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
const keywords = await
|
|
194
|
+
const keywords = await getKeywordCollections({
|
|
195
195
|
marketCode: "vn",
|
|
196
196
|
language: "en",
|
|
197
197
|
page: 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TypeBannerCollectionSkeleton } from '../types';
|
|
1
|
+
import { GraphQLAsset, TypeBannerCollectionSkeleton } from '../types';
|
|
2
2
|
import { Entry, EntrySys } from 'contentful';
|
|
3
3
|
import { HyperlinkEntry } from './hyperlink';
|
|
4
4
|
type BannerCollectionEntry = Entry<TypeBannerCollectionSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
@@ -11,28 +11,23 @@ export type BannerCollectionGraphQLItem = {
|
|
|
11
11
|
hyperlink: ({
|
|
12
12
|
sys: GraphQLEntrySys;
|
|
13
13
|
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "marketHandling">) | null;
|
|
14
|
-
media:
|
|
15
|
-
url: string;
|
|
16
|
-
width: number | null;
|
|
17
|
-
height: number | null;
|
|
18
|
-
contentType: string;
|
|
19
|
-
};
|
|
14
|
+
media: GraphQLAsset;
|
|
20
15
|
name: string;
|
|
21
16
|
}>;
|
|
22
17
|
};
|
|
23
18
|
} & Pick<BannerCollectionEntry["fields"], "name" | "slot" | "platform">;
|
|
24
|
-
export type
|
|
19
|
+
export type GetBannerCollectionsResponse = {
|
|
25
20
|
page: number;
|
|
26
21
|
total: number;
|
|
27
22
|
size: number;
|
|
28
23
|
items: BannerCollectionGraphQLItem[];
|
|
29
24
|
};
|
|
30
|
-
export declare const
|
|
25
|
+
export declare const getBannerCollections: ({ slot, page, size, platform, marketCode, language, }: {
|
|
31
26
|
slot: BannerCollectionEntry["fields"]["slot"];
|
|
32
27
|
page?: number;
|
|
33
28
|
size?: number;
|
|
34
29
|
platform?: BannerCollectionEntry["fields"]["platform"][number];
|
|
35
30
|
marketCode?: string;
|
|
36
31
|
language?: string;
|
|
37
|
-
}) => Promise<
|
|
32
|
+
}) => Promise<GetBannerCollectionsResponse>;
|
|
38
33
|
export {};
|
package/dist/entries/blog.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { TypeBlogPostSkeleton } from '../types';
|
|
1
|
+
import { GraphQLAsset, GraphQLAssetLink, TypeBlogPostSkeleton } from '../types';
|
|
2
2
|
import { Entry, EntrySys } from 'contentful';
|
|
3
3
|
type BlogPostEntry = Entry<TypeBlogPostSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
4
4
|
type GraphQLEntrySys = Pick<EntrySys, "id" | "createdAt" | "updatedAt">;
|
|
5
|
-
type GraphQLAsset = {
|
|
6
|
-
url: string;
|
|
7
|
-
width: number | null;
|
|
8
|
-
height: number | null;
|
|
9
|
-
contentType: string;
|
|
10
|
-
};
|
|
11
5
|
type GraphQLSeo = {
|
|
12
6
|
metaTitle: string;
|
|
13
7
|
metaDescription: string | null;
|
|
@@ -30,22 +24,27 @@ export interface BlogPostDetailGraphQLItem extends BlogPostGraphQLItem {
|
|
|
30
24
|
} | null;
|
|
31
25
|
content: {
|
|
32
26
|
json: BlogPostEntry["fields"]["content"];
|
|
27
|
+
links: {
|
|
28
|
+
assets: {
|
|
29
|
+
block: GraphQLAssetLink[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
33
32
|
};
|
|
34
33
|
seo: GraphQLSeo | null;
|
|
35
34
|
}
|
|
36
|
-
export type
|
|
35
|
+
export type GetBlogPostsResponse = {
|
|
37
36
|
page: number;
|
|
38
37
|
total: number;
|
|
39
38
|
size: number;
|
|
40
39
|
items: BlogPostGraphQLItem[];
|
|
41
40
|
};
|
|
42
41
|
export type GetBlogPostDetailResponse = BlogPostDetailGraphQLItem;
|
|
43
|
-
export declare const
|
|
42
|
+
export declare const getBlogPosts: ({ marketCode, language, page, size, }?: {
|
|
44
43
|
marketCode?: string;
|
|
45
44
|
language?: string;
|
|
46
45
|
page?: number;
|
|
47
46
|
size?: number;
|
|
48
|
-
}) => Promise<
|
|
47
|
+
}) => Promise<GetBlogPostsResponse>;
|
|
49
48
|
export declare const getBlogPostDetail: ({ id, slug, marketCode, language, }: {
|
|
50
49
|
id?: string;
|
|
51
50
|
slug?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { TypeBrandCollectionSkeleton, TypeBrandSkeleton } from '../types';
|
|
1
|
+
import { GraphQLAsset, TypeBrandCollectionSkeleton, TypeBrandSkeleton } from '../types';
|
|
2
2
|
import { Entry, EntrySys } from 'contentful';
|
|
3
|
+
import { HyperlinkEntry } from './hyperlink';
|
|
3
4
|
type BrandEntry = Entry<TypeBrandSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
4
5
|
type BrandCollectionEntry = Entry<TypeBrandCollectionSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
6
|
type GraphQLEntrySys = Pick<EntrySys, "id">;
|
|
@@ -8,19 +9,23 @@ export type BrandCollectionGraphQLItem = {
|
|
|
8
9
|
brandsCollection: {
|
|
9
10
|
items: Array<{
|
|
10
11
|
sys: GraphQLEntrySys;
|
|
11
|
-
|
|
12
|
+
logo: GraphQLAsset | null;
|
|
13
|
+
hyperlink: ({
|
|
14
|
+
sys: GraphQLEntrySys;
|
|
15
|
+
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "marketHandling">) | null;
|
|
16
|
+
} & Pick<BrandEntry["fields"], "name">>;
|
|
12
17
|
};
|
|
13
18
|
} & Pick<BrandCollectionEntry["fields"], "name" | "slot">;
|
|
14
|
-
export type
|
|
19
|
+
export type GetBrandCollectionsResponse = {
|
|
15
20
|
page: number;
|
|
16
21
|
total: number;
|
|
17
22
|
size: number;
|
|
18
23
|
items: BrandCollectionGraphQLItem[];
|
|
19
24
|
};
|
|
20
|
-
export declare const
|
|
25
|
+
export declare const getBrandCollections: ({ page, size, marketCode, language, }?: {
|
|
21
26
|
page?: number;
|
|
22
27
|
size?: number;
|
|
23
28
|
marketCode?: string;
|
|
24
29
|
language?: string;
|
|
25
|
-
}) => Promise<
|
|
30
|
+
}) => Promise<GetBrandCollectionsResponse>;
|
|
26
31
|
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import { TypeDocumentationArticleSkeleton, TypeDocumentationCategorySkeleton } from '../types';
|
|
1
|
+
import { GraphQLAsset, GraphQLAssetLink, TypeDocumentationArticleSkeleton, TypeDocumentationCategorySkeleton } from '../types';
|
|
2
2
|
import { Entry, EntrySys } from 'contentful';
|
|
3
3
|
export type DocCategoryEntry = Entry<TypeDocumentationCategorySkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
4
4
|
export type DocArticleEntry = Entry<TypeDocumentationArticleSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
5
|
type GraphQLEntrySys = Pick<EntrySys, "id" | "createdAt" | "updatedAt">;
|
|
6
|
-
type GraphQLAsset = {
|
|
7
|
-
url: string | null;
|
|
8
|
-
width: number | null;
|
|
9
|
-
height: number | null;
|
|
10
|
-
contentType: string | null;
|
|
11
|
-
};
|
|
12
6
|
type GraphQLSeo = {
|
|
13
7
|
metaTitle: string;
|
|
14
8
|
metaDescription: string | null;
|
|
@@ -31,42 +25,47 @@ export type DocArticleGraphQLItem = {
|
|
|
31
25
|
export interface DocArticleDetailGraphQLItem extends DocArticleGraphQLItem {
|
|
32
26
|
content: {
|
|
33
27
|
json: DocArticleEntry["fields"]["content"];
|
|
28
|
+
links: {
|
|
29
|
+
assets: {
|
|
30
|
+
block: GraphQLAssetLink[];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
34
33
|
};
|
|
35
34
|
seo: GraphQLSeo | null;
|
|
36
35
|
}
|
|
37
|
-
export type
|
|
36
|
+
export type GetDocCategoriesResponse = {
|
|
38
37
|
page: number;
|
|
39
38
|
total: number;
|
|
40
39
|
size: number;
|
|
41
40
|
items: DocCategoryGraphQLItem[];
|
|
42
41
|
};
|
|
43
42
|
export type GetDocCategoryDetailResponse = DocCategoryGraphQLItem;
|
|
44
|
-
export type
|
|
43
|
+
export type getDocArticlesResponse = {
|
|
45
44
|
page: number;
|
|
46
45
|
total: number;
|
|
47
46
|
size: number;
|
|
48
47
|
items: DocArticleGraphQLItem[];
|
|
49
48
|
};
|
|
50
49
|
export type GetDocArticleDetailResponse = DocArticleDetailGraphQLItem;
|
|
51
|
-
export declare const
|
|
50
|
+
export declare const getDocCategories: ({ marketCode, language, page, size, }?: {
|
|
52
51
|
marketCode?: string;
|
|
53
52
|
language?: string;
|
|
54
53
|
page?: number;
|
|
55
54
|
size?: number;
|
|
56
|
-
}) => Promise<
|
|
55
|
+
}) => Promise<GetDocCategoriesResponse>;
|
|
57
56
|
export declare const getDocCategoryDetail: ({ id, slug, marketCode, language, }: {
|
|
58
57
|
id?: string;
|
|
59
58
|
slug?: string;
|
|
60
59
|
marketCode?: string;
|
|
61
60
|
language?: string;
|
|
62
61
|
}) => Promise<GetDocCategoryDetailResponse>;
|
|
63
|
-
export declare const
|
|
62
|
+
export declare const getDocArticles: ({ marketCode, language, categorySlug, page, size, }?: {
|
|
64
63
|
marketCode?: string;
|
|
65
64
|
language?: string;
|
|
66
65
|
categorySlug?: string;
|
|
67
66
|
page?: number;
|
|
68
67
|
size?: number;
|
|
69
|
-
}) => Promise<
|
|
68
|
+
}) => Promise<getDocArticlesResponse>;
|
|
70
69
|
export declare const getDocArticleDetail: ({ id, slug, marketCode, language, }: {
|
|
71
70
|
id?: string;
|
|
72
71
|
slug?: string;
|
|
@@ -11,16 +11,16 @@ export type HyperlinkCollectionGraphQLItem = {
|
|
|
11
11
|
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | 'marketHandling'>>;
|
|
12
12
|
};
|
|
13
13
|
} & Pick<HyperlinkCollectionEntry["fields"], "name" | "slot" | "order">;
|
|
14
|
-
export type
|
|
14
|
+
export type GetHyperlinkCollectionsResponse = {
|
|
15
15
|
page: number;
|
|
16
16
|
total: number;
|
|
17
17
|
size: number;
|
|
18
18
|
items: HyperlinkCollectionGraphQLItem[];
|
|
19
19
|
};
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const getHyperlinkCollections: ({ page, size, marketCode, language, }?: {
|
|
21
21
|
page?: number;
|
|
22
22
|
size?: number;
|
|
23
23
|
marketCode?: string;
|
|
24
24
|
language?: string;
|
|
25
|
-
}) => Promise<
|
|
25
|
+
}) => Promise<GetHyperlinkCollectionsResponse>;
|
|
26
26
|
export {};
|
|
@@ -5,16 +5,16 @@ type GraphQLEntrySys = Pick<EntrySys, "id">;
|
|
|
5
5
|
export type KeywordCollectionGraphQLItem = {
|
|
6
6
|
sys: GraphQLEntrySys;
|
|
7
7
|
} & Pick<KeywordCollectionEntry["fields"], "name" | "slot" | "keywords">;
|
|
8
|
-
export type
|
|
8
|
+
export type GetKeywordCollectionsResponse = {
|
|
9
9
|
page: number;
|
|
10
10
|
total: number;
|
|
11
11
|
size: number;
|
|
12
12
|
items: KeywordCollectionGraphQLItem[];
|
|
13
13
|
};
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const getKeywordCollections: ({ page, size, marketCode, language, }?: {
|
|
15
15
|
page?: number;
|
|
16
16
|
size?: number;
|
|
17
17
|
marketCode?: string;
|
|
18
18
|
language?: string;
|
|
19
|
-
}) => Promise<
|
|
19
|
+
}) => Promise<GetKeywordCollectionsResponse>;
|
|
20
20
|
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var we=Function.prototype.toString,C=Object.create,Se=Object.prototype.toString,Ce=(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 Oe(){return new Ce}function Ae(){return new WeakMap}var ke=typeof WeakMap<"u"?Ae:Oe;function B(e){if(!e)return C(null);var t=e.constructor;if(t===Object)return e===Object.prototype?{}:C(e);if(t&&~we.call(t).indexOf("[native code]"))try{return new t}catch{}return C(e)}function je(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 Te(e){return e.flags}var _e=/test/g.flags==="g"?Te:je;function ae(e){var t=Se.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,xe=Object.defineProperty,De=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols,ce=Object.prototype,le=ce.hasOwnProperty,Re=ce.propertyIsEnumerable,ue=typeof N=="function";function Ie(e){return se(e).concat(N(e))}var Me=ue?Ie:se;function S(e,t,r){for(var s=Me(e),a=0,o=s.length,n=void 0,i=void 0;a<o;++a)if(n=s[a],!(n==="callee"||n==="caller")){if(i=De(e,n),!i){t[n]=r.copier(e[n],r);continue}!i.get&&!i.set&&(i.value=r.copier(i.value,r));try{xe(t,n,i)}catch{t[n]=i.value}}return t}function ze(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 Ee(e,t){var r=new t.Constructor;return t.cache.set(e,r),S(e,r,t)}function ge(e,t){return e.slice(0)}function Le(e,t){return e.slice(0,e.size,e.type)}function Be(e,t){return new t.Constructor(ge(e.buffer))}function Ne(e,t){return new t.Constructor(e.getTime())}function fe(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 Ve(e,t){return S(e,fe(e,t),t)}function Qe(e,t){var r=B(t.prototype);t.cache.set(e,r);for(var s in e)le.call(e,s)&&(r[s]=t.copier(e[s],t));return r}function Fe(e,t){var r=B(t.prototype);t.cache.set(e,r);for(var s in e)le.call(e,s)&&(r[s]=t.copier(e[s],t));for(var a=N(e),o=0,n=a.length,i=void 0;o<n;++o)i=a[o],Re.call(e,i)&&(r[i]=t.copier(e[i],t));return r}var Ge=ue?Fe:Qe;function Ue(e,t){var r=B(t.prototype);return t.cache.set(e,r),S(e,r,t)}function O(e,t){return new t.Constructor(e.valueOf())}function Ke(e,t){var r=new t.Constructor(e.source,_e(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 We(e,t){return S(e,pe(e,t),t)}var He=Array.isArray,V=Object.assign,Je=Object.getPrototypeOf||(function(e){return e.__proto__}),he={array:ze,arrayBuffer:ge,blob:Le,dataView:Be,date:Ne,error:w,map:fe,object:Ge,regExp:Ke,set:pe},Ye=V({},he,{array:Ee,map:Ve,object:Ue,set:We});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 ye(e){var t=V({},he,e),r=Xe(t),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=Je(n),i.Constructor=i.prototype&&i.prototype.constructor,!i.Constructor||i.Constructor===Object)return a(n,i);if(He(n))return s(n,i);var c=r[Pe(n)];return c?c(n,i):typeof n.then=="function"?n:a(n,i)}return function(i){return o(i,{Constructor:void 0,cache:ke(),copier:o,prototype:void 0})}}function Ze(e){return ye(V({},Ye,e))}Ze({});ye({});var v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},A={exports:{}},F;function et(){if(F)return A.exports;F=1;var e=A.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 o(p){if(t===setTimeout)return setTimeout(p,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(p,0);try{return t(p,0)}catch{try{return t.call(null,p,0)}catch{return t.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 m=i.length;m;){for(l=i,i=[];++u<m;)l&&l[u].run();u=-1,m=i.length}l=null,c=!1,n(p)}}e.nextTick=function(p){var m=new Array(arguments.length-1);if(arguments.length>1)for(var b=1;b<arguments.length;b++)m[b-1]=arguments[b];i.push(new y(p,m)),i.length===1&&!c&&o(f)};function y(p,m){this.fun=p,this.array=m}y.prototype.run=function(){this.fun.apply(null,this.array)},e.title="browser",e.browser=!0,e.env={},e.argv=[],e.version="",e.versions={};function h(){}return e.on=h,e.addListener=h,e.once=h,e.off=h,e.removeListener=h,e.removeAllListeners=h,e.emit=h,e.prependListener=h,e.prependOnceListener=h,e.listeners=function(p){return[]},e.binding=function(p){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(p){throw new Error("process.chdir is not supported")},e.umask=function(){return 0},A.exports}et();var k,G;function tt(){if(G)return k;G=1;var e=typeof v=="object"&&v&&v.Object===Object&&v;return k=e,k}var j,U;function rt(){if(U)return j;U=1;var e=tt(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return j=r,j}var T,K;function de(){if(K)return T;K=1;var e=rt(),t=e.Symbol;return T=t,T}var _,W;function nt(){if(W)return _;W=1;var e=de(),t=Object.prototype,r=t.hasOwnProperty,s=t.toString,a=e?e.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,H;function it(){if(H)return q;H=1;var e=Object.prototype,t=e.toString;function r(s){return t.call(s)}return q=r,q}var P,J;function me(){if(J)return P;J=1;var e=de(),t=nt(),r=it(),s="[object Null]",a="[object Undefined]",o=e?e.toStringTag:void 0;function n(i){return i==null?i===void 0?a:s:o&&o in Object(i)?t(i):r(i)}return P=n,P}var x,Y;function ot(){if(Y)return x;Y=1;var e=Array.isArray;return x=e,x}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(o){return typeof o=="string"||!t(o)&&r(o)&&e(o)==s}return R=a,R}at();var I,ee;function st(){if(ee)return I;ee=1;function e(t,r){return function(s){return t(r(s))}}return I=e,I}var M,te;function ct(){if(te)return M;te=1;var e=st(),t=e(Object.getPrototypeOf,Object);return M=t,M}var z,re;function lt(){if(re)return z;re=1;var e=me(),t=ct(),r=be(),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)||e(u)!=s)return!1;var g=t(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}lt();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},$e={0:8203,1:8204,2:8205,3:65279};new Array(4).fill(String.fromCodePoint($e[0])).join("");Object.fromEntries(Object.entries($e).map(e=>e.reverse()));Object.fromEntries(Object.entries(ve).map(e=>e.reverse()));`${Object.values(ve).map(e=>`\\u{${e.toString(16)}}`).join("")}`;var E,ne;function ut(){if(ne)return E;ne=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;return E=function(r,s,a){if(t.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)e.call(r,i)&&s.call(a,r[i],i,r)},E}var L,ie;function gt(){if(ie)return L;ie=1;var e=ut();L=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 o=t.bind(t,r);for(var n in t)t.hasOwnProperty(n)&&(o[n]=t[n].bind(o,r));return o}return t.get=function(r,s){for(var a=Array.isArray(s)?s:t.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},t.set=function(r,s,a){var o=Array.isArray(s)?s:t.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},t.remove=function(r,s){var a=Array.isArray(s)?s:t.parse(s),o=a[a.length-1];if(o===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 i=+o;if(o===""&&isNaN(i))throw new Error('Invalid array index: "'+o+'"');Array.prototype.splice.call(n,i,1)}else delete n[o]},t.dict=function(r,s){var a={};return t.walk(r,function(o,n){a[n]=o},s),a},t.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){e(i,function(c,l){o.push(String(l)),a(c)?n(c):s(c,t.compile(o)),o.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("/")},L}gt();var $={exports:{}},oe;function ft(){return oe||(oe=1,(function(e,t){t=e.exports=r,t.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}ft();class d{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: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:t,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 pt=async({slot:e,page:t=1,size:r=20,platform:s,marketCode:a,language:o})=>{const n=Math.max(1,Math.floor(t)),i=Math.max(1,Math.floor(r)),c=["$slot: String!","$limit: Int!","$skip: Int!"],l={slot:e,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
4
|
skip: $skip
|
|
5
5
|
where: {
|
|
@@ -45,7 +45,7 @@ query${g} {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`,{bannerCollectionCollection:h}=await
|
|
48
|
+
`,{bannerCollectionCollection:h}=await d.graphqlQuery(y,{...l});return{page:n,total:h.total,size:i,items:h.items}};class Q extends Response{constructor(...t){super(t[0]??"Not Found",{status:404,...t[1]})}}const ht=async({marketCode:e,language:t,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=[];e&&(n.push("$marketCode: String!"),i.marketCode=e,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(n.push("$language: String!"),i.language=t,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
49
49
|
AND: [
|
|
50
50
|
${l.join(`
|
|
51
51
|
`)}
|
|
@@ -79,7 +79,7 @@ query${u} {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
`,{blogPostCollection:y}=await
|
|
82
|
+
`,{blogPostCollection:y}=await d.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},yt=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,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=`(
|
|
83
83
|
limit: 1
|
|
84
84
|
where: {
|
|
85
85
|
AND: [
|
|
@@ -120,6 +120,21 @@ query${i} {
|
|
|
120
120
|
}
|
|
121
121
|
content {
|
|
122
122
|
json
|
|
123
|
+
links {
|
|
124
|
+
assets {
|
|
125
|
+
block {
|
|
126
|
+
sys {
|
|
127
|
+
id
|
|
128
|
+
}
|
|
129
|
+
url
|
|
130
|
+
width
|
|
131
|
+
height
|
|
132
|
+
contentType
|
|
133
|
+
title
|
|
134
|
+
description
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
123
138
|
}
|
|
124
139
|
seo {
|
|
125
140
|
metaTitle
|
|
@@ -130,7 +145,7 @@ query${i} {
|
|
|
130
145
|
}
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
|
-
`,{blogPostCollection:u}=await
|
|
148
|
+
`,{blogPostCollection:u}=await d.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},dt=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),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?`(
|
|
134
149
|
limit: $limit
|
|
135
150
|
skip: $skip
|
|
136
151
|
where: {
|
|
@@ -158,13 +173,27 @@ query${l} {
|
|
|
158
173
|
id
|
|
159
174
|
}
|
|
160
175
|
name
|
|
161
|
-
|
|
176
|
+
logo {
|
|
177
|
+
url
|
|
178
|
+
width
|
|
179
|
+
height
|
|
180
|
+
contentType
|
|
181
|
+
}
|
|
182
|
+
hyperlink {
|
|
183
|
+
sys {
|
|
184
|
+
id
|
|
185
|
+
}
|
|
186
|
+
label
|
|
187
|
+
url
|
|
188
|
+
target
|
|
189
|
+
marketHandling
|
|
190
|
+
}
|
|
162
191
|
}
|
|
163
192
|
}
|
|
164
193
|
}
|
|
165
194
|
}
|
|
166
195
|
}
|
|
167
|
-
`,{brandCollectionCollection:f}=await
|
|
196
|
+
`,{brandCollectionCollection:f}=await d.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},mt=async({marketCode:e,language:t,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=[];e&&(n.push("$marketCode: String!"),i.marketCode=e,l.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(n.push("$language: String!"),i.language=t,l.push("{ OR: [{ language_exists: false }, { language: { code: $language } }] }")),l.length&&c.push(`where: {
|
|
168
197
|
AND: [
|
|
169
198
|
${l.join(`
|
|
170
199
|
`)}
|
|
@@ -195,7 +224,7 @@ query${u} {
|
|
|
195
224
|
}
|
|
196
225
|
}
|
|
197
226
|
}
|
|
198
|
-
`,{documentationCategoryCollection:y}=await
|
|
227
|
+
`,{documentationCategoryCollection:y}=await d.graphqlQuery(f,{...i});return{page:a,total:y.total,size:o,items:y.items}},bt=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,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=`(
|
|
199
228
|
limit: 1
|
|
200
229
|
where: {
|
|
201
230
|
AND: [
|
|
@@ -225,7 +254,7 @@ query${i} {
|
|
|
225
254
|
}
|
|
226
255
|
}
|
|
227
256
|
}
|
|
228
|
-
`,{documentationCategoryCollection:u}=await
|
|
257
|
+
`,{documentationCategoryCollection:u}=await d.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},vt=async({marketCode:e,language:t,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=[];e&&(i.push("$marketCode: String!"),c.marketCode=e,u.push("{ OR: [{ market_exists: false }, { market: { code: $marketCode } }] }")),t&&(i.push("$language: String!"),c.language=t,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: {
|
|
229
258
|
AND: [
|
|
230
259
|
${u.join(`
|
|
231
260
|
`)}
|
|
@@ -263,7 +292,7 @@ query${g} {
|
|
|
263
292
|
}
|
|
264
293
|
}
|
|
265
294
|
}
|
|
266
|
-
`,{documentationArticleCollection:h}=await
|
|
295
|
+
`,{documentationArticleCollection:h}=await d.graphqlQuery(y,{...c});return{page:o,total:h.total,size:n,items:h.items}},$t=async({id:e,slug:t,marketCode:r,language:s})=>{const a=[],o={},n=[];if(e)a.push("$id: String!"),o.id=e,n.push("{ sys: { id: $id } }");else if(t)a.push("$slug: String!"),o.slug=t,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=`(
|
|
267
296
|
limit: 1
|
|
268
297
|
where: {
|
|
269
298
|
AND: [
|
|
@@ -284,6 +313,21 @@ query${i} {
|
|
|
284
313
|
slug
|
|
285
314
|
content {
|
|
286
315
|
json
|
|
316
|
+
links {
|
|
317
|
+
assets {
|
|
318
|
+
block {
|
|
319
|
+
sys {
|
|
320
|
+
id
|
|
321
|
+
}
|
|
322
|
+
url
|
|
323
|
+
width
|
|
324
|
+
height
|
|
325
|
+
contentType
|
|
326
|
+
title
|
|
327
|
+
description
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
287
331
|
}
|
|
288
332
|
author {
|
|
289
333
|
name
|
|
@@ -309,9 +353,10 @@ query${i} {
|
|
|
309
353
|
}
|
|
310
354
|
}
|
|
311
355
|
}
|
|
312
|
-
`,{documentationArticleCollection:u}=await
|
|
356
|
+
`,{documentationArticleCollection:u}=await d.graphqlQuery(l,{...o}),g=u.items.at(0);if(!g)throw new Q;return g},wt=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),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
357
|
limit: $limit
|
|
314
358
|
skip: $skip
|
|
359
|
+
order: order_ASC
|
|
315
360
|
where: {
|
|
316
361
|
AND: [
|
|
317
362
|
${c.join(`
|
|
@@ -321,6 +366,7 @@ query${i} {
|
|
|
321
366
|
)`:`(
|
|
322
367
|
limit: $limit
|
|
323
368
|
skip: $skip
|
|
369
|
+
order: order_ASC
|
|
324
370
|
)`,g=`
|
|
325
371
|
query${l} {
|
|
326
372
|
hyperlinkCollectionCollection${u} {
|
|
@@ -346,7 +392,7 @@ query${l} {
|
|
|
346
392
|
}
|
|
347
393
|
}
|
|
348
394
|
}
|
|
349
|
-
`,{hyperlinkCollectionCollection:f}=await
|
|
395
|
+
`,{hyperlinkCollectionCollection:f}=await d.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}},St=async({page:e=1,size:t=20,marketCode:r,language:s}={})=>{const a=Math.max(1,Math.floor(e)),o=Math.max(1,Math.floor(t)),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?`(
|
|
350
396
|
limit: $limit
|
|
351
397
|
skip: $skip
|
|
352
398
|
where: {
|
|
@@ -372,4 +418,4 @@ query${l} {
|
|
|
372
418
|
}
|
|
373
419
|
}
|
|
374
420
|
}
|
|
375
|
-
`,{keywordCollectionCollection:f}=await
|
|
421
|
+
`,{keywordCollectionCollection:f}=await d.graphqlQuery(g,{...i});return{page:a,total:f.total,size:o,items:f.items}};exports.ContentfulSDK=d;exports.getBannerCollections=pt;exports.getBlogPostDetail=yt;exports.getBlogPosts=ht;exports.getBrandCollections=dt;exports.getDocArticleDetail=$t;exports.getDocArticles=vt;exports.getDocCategories=mt;exports.getDocCategoryDetail=bt;exports.getHyperlinkCollections=wt;exports.getKeywordCollections=St;
|