@janbox/contentful-marketplace-sdk 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,17 +11,15 @@ TypeScript SDK for querying iChiba marketplace content from Contentful GraphQL.
11
11
 
12
12
  ## Installation
13
13
 
14
- `contentful` is a peer dependency and must be installed in your app.
15
-
16
14
  ```bash
17
15
  # pnpm
18
- pnpm add @janbox/contentful-marketplace-sdk contentful
16
+ pnpm add @janbox/contentful-marketplace-sdk
19
17
 
20
18
  # npm
21
- npm install @janbox/contentful-marketplace-sdk contentful
19
+ npm install @janbox/contentful-marketplace-sdk
22
20
 
23
21
  # yarn
24
- yarn add @janbox/contentful-marketplace-sdk contentful
22
+ yarn add @janbox/contentful-marketplace-sdk
25
23
  ```
26
24
 
27
25
  ## Quick Start
@@ -31,15 +29,13 @@ import {
31
29
  ContentfulSDK,
32
30
  getBannerCollections,
33
31
  } from "@janbox/contentful-marketplace-sdk";
34
- import type { CreateClientParams } from "contentful";
35
-
36
- const clientOptions: CreateClientParams = {
37
- space: process.env.CONTENTFUL_SPACE_ID!,
38
- accessToken: process.env.CONTENTFUL_ACCESS_TOKEN!,
39
- environment: "master", // optional, defaults to "master"
40
- };
41
32
 
42
- ContentfulSDK.configure(clientOptions);
33
+ ContentfulSDK.configure({
34
+ url: `https://graphql.contentful.com/content/v1/spaces/${process.env.CONTENTFUL_SPACE_ID}/environments/master`,
35
+ headers: {
36
+ Authorization: `Bearer ${process.env.CONTENTFUL_ACCESS_TOKEN}`,
37
+ },
38
+ });
43
39
 
44
40
  const result = await getBannerCollections({
45
41
  slot: "home_hero",
@@ -59,18 +55,24 @@ console.log(result.items);
59
55
 
60
56
  Configure the SDK once before calling entry methods.
61
57
 
58
+ | Parameter | Type | Required | Description |
59
+ |-----------|--------------------------|----------|-------------------------------------------|
60
+ | `url` | `string` | ✅ | GraphQL endpoint URL |
61
+ | `method` | `string` | — | HTTP method (defaults to `"POST"`) |
62
+ | `headers` | `Record<string, string>` | — | Custom headers (e.g. `Authorization`) |
63
+
62
64
  ```ts
63
65
  ContentfulSDK.configure({
64
- space: "your-space-id",
65
- accessToken: "your-delivery-access-token",
66
- environment: "master",
66
+ url: "https://graphql.contentful.com/content/v1/spaces/your-space-id/environments/master",
67
+ headers: {
68
+ Authorization: "Bearer your-delivery-access-token",
69
+ },
67
70
  });
68
71
  ```
69
72
 
70
73
  Notes:
71
74
 
72
- - `environment` defaults to `"master"` if omitted.
73
- - The SDK sends requests to `https://graphql.contentful.com/content/v1/...`.
75
+ - The SDK always sends `Content-Type: application/json`. Custom headers are merged on top.
74
76
  - Runtime requires `fetch` (Node.js 18+ recommended).
75
77
 
76
78
  ## API Methods
@@ -199,6 +201,21 @@ const keywords = await getKeywordCollections({
199
201
  });
200
202
  ```
201
203
 
204
+ ### Policy and Terms
205
+
206
+ - `getPolicyAndTerms(options?)` — returns a single entry (`limit: 1`), throws `404` if not found
207
+
208
+ ```ts
209
+ const policy = await getPolicyAndTerms({
210
+ marketCode: "vn",
211
+ locale: "vi",
212
+ });
213
+
214
+ // policy shape: { sys: { id }, title, locale, content: { json, links } | null }
215
+ ```
216
+
217
+ Filters `marketCode` / `locale` with global fallback (entries where `markets` / `locale` is not set are included).
218
+
202
219
  ## Error Handling
203
220
 
204
221
  `getBlogPostDetail`, `getDocCategoryDetail`, and `getDocArticleDetail` throw:
@@ -7,4 +7,5 @@ export * from './documentation';
7
7
  export * from './hyperlink-collection';
8
8
  export * from './hyperlink';
9
9
  export * from './keyword-collection';
10
+ export * from './policy-and-terms';
10
11
  export * from './seo';
@@ -0,0 +1,20 @@
1
+ import { GraphQLAssetLink, TypePolicyAndTermsSkeleton } from '../types';
2
+ import { Entry, EntrySys } from 'contentful';
3
+ type PolicyAndTermsEntry = Entry<TypePolicyAndTermsSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
4
+ type GraphQLEntrySys = Pick<EntrySys, "id">;
5
+ export type PolicyAndTermsGraphQLItem = {
6
+ sys: GraphQLEntrySys;
7
+ content: {
8
+ json: PolicyAndTermsEntry["fields"]["content"];
9
+ links: {
10
+ assets: {
11
+ block: GraphQLAssetLink[];
12
+ };
13
+ };
14
+ } | null;
15
+ } & Pick<PolicyAndTermsEntry["fields"], "title" | "locale">;
16
+ export declare const getPolicyAndTerms: ({ marketCode, locale, }?: {
17
+ marketCode?: string;
18
+ locale?: string;
19
+ }) => Promise<PolicyAndTermsGraphQLItem>;
20
+ export {};
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class p{static _config;static get config(){if(!this._config)throw new Error("Client is not configured");return this._config}static configure(l){this._config=l}static async graphqlQuery(l,a={}){const{url:r,method:o="POST",headers:e={}}=this.config,t=await fetch(r,{method:o,headers:{"Content-Type":"application/json",...e},body:JSON.stringify({query:l,variables:a})});if(!t.ok){const i=await t.text();throw new Error(`GraphQL request failed: ${t.status} ${t.statusText}
2
- ${i}`)}const s=await t.json();if(s.errors)throw new Error(`GraphQL errors: ${JSON.stringify(s.errors,null,2)}`);return s.data}}class ${page;total;size;items;totalPages;constructor({page:l,total:a,size:r,items:o}){this.page=l,this.total=a,this.size=r,this.items=o,this.totalPages=Math.ceil(this.total/this.size)}}const q=async({slot:c,page:l=1,size:a=20,platform:r,marketCode:o,locale:e})=>{const t=Math.max(1,Math.floor(l)),s=Math.max(1,Math.floor(a)),i=["$slot: String!","$limit: Int!","$skip: Int!"],n={slot:c,limit:s,skip:(t-1)*s},u=["{ slot: $slot }"];r&&(i.push("$platform: String!"),n.platform=r,u.push("{ platform_contains_some: [$platform] }")),o&&(i.push("$marketCode: String!"),n.marketCode=o,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(i.push("$locale: String!"),n.locale=e,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const h=`(${i.join(", ")})`,g=`(
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class d{static _config;static get config(){if(!this._config)throw new Error("Client is not configured");return this._config}static configure(l){this._config=l}static async graphqlQuery(l,n={}){const{url:r,method:i="POST",headers:e={}}=this.config,t=await fetch(r,{method:i,headers:{"Content-Type":"application/json",...e},body:JSON.stringify({query:l,variables:n})});if(!t.ok){const o=await t.text();throw new Error(`GraphQL request failed: ${t.status} ${t.statusText}
2
+ ${o}`)}const s=await t.json();if(s.errors)throw new Error(`GraphQL errors: ${JSON.stringify(s.errors,null,2)}`);return s.data}}class y{page;total;size;items;totalPages;constructor({page:l,total:n,size:r,items:i}){this.page=l,this.total=n,this.size=r,this.items=i,this.totalPages=Math.ceil(this.total/this.size)}}const q=async({slot:c,page:l=1,size:n=20,platform:r,marketCode:i,locale:e})=>{const t=Math.max(1,Math.floor(l)),s=Math.max(1,Math.floor(n)),o=["$slot: String!","$limit: Int!","$skip: Int!"],a={slot:c,limit:s,skip:(t-1)*s},u=["{ slot: $slot }"];r&&(o.push("$platform: String!"),a.platform=r,u.push("{ platform_contains_some: [$platform] }")),i&&(o.push("$marketCode: String!"),a.marketCode=i,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),e&&(o.push("$locale: String!"),a.locale=e,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const h=`(${o.join(", ")})`,g=`(
3
3
  limit: $limit
4
4
  skip: $skip
5
5
  where: {
@@ -45,7 +45,7 @@ query${h} {
45
45
  }
46
46
  }
47
47
  }
48
- `,{bannerCollectionCollection:d}=await p.graphqlQuery(m,{...n});return new $({page:t,total:d.total,size:s,items:d.items})};class y extends Response{constructor(...l){super(l[0]??"Not Found",{status:404,...l[1]})}}const S=async({marketCode:c,locale:l,collectionId:a,categoryId:r,page:o=1,size:e=20,skip:t=0}={})=>{const s=Math.max(1,Math.floor(o)),i=Math.max(1,Math.floor(e)),n=Math.max(0,Math.floor(t));if(a){const b=`
48
+ `,{bannerCollectionCollection:p}=await d.graphqlQuery(m,{...a});return new y({page:t,total:p.total,size:s,items:p.items})};class $ extends Response{constructor(...l){super(l[0]??"Not Found",{status:404,...l[1]})}}const S=async({marketCode:c,locale:l,collectionId:n,categoryId:r,page:i=1,size:e=20,skip:t=0}={})=>{const s=Math.max(1,Math.floor(i)),o=Math.max(1,Math.floor(e)),a=Math.max(0,Math.floor(t));if(n){const b=`
49
49
  query($collectionId: String!, $limit: Int!, $skip: Int!) {
50
50
  blogCollectionCollection(limit: 1 where: { sys: { id: $collectionId } }) {
51
51
  items {
@@ -86,16 +86,16 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
86
86
  }
87
87
  }
88
88
  }
89
- `,{blogCollectionCollection:A}=await p.graphqlQuery(b,{collectionId:a,limit:i,skip:(s-1)*i+n}),f=A.items.at(0);if(!f)throw new y;return new $({page:s,total:f.postsCollection?.total??0,size:i,items:f.postsCollection?.items??[]})}const u=["$limit: Int!","$skip: Int!"],h={limit:i,skip:(s-1)*i+n},g=["limit: $limit","skip: $skip"],m=[];c&&(u.push("$marketCode: String!"),h.marketCode=c,m.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(u.push("$locale: String!"),h.locale=l,m.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),r&&(u.push("$categoryId: String!"),h.categoryId=r,m.push("{ categories: { sys: { id: $categoryId } } }")),m.length&&g.push(`where: {
89
+ `,{blogCollectionCollection:A}=await d.graphqlQuery(b,{collectionId:n,limit:o,skip:(s-1)*o+a}),f=A.items.at(0);if(!f)throw new $;return new y({page:s,total:f.postsCollection?.total??0,size:o,items:f.postsCollection?.items??[]})}const u=["$limit: Int!","$skip: Int!"],h={limit:o,skip:(s-1)*o+a},g=["limit: $limit","skip: $skip"],m=[];c&&(u.push("$marketCode: String!"),h.marketCode=c,m.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(u.push("$locale: String!"),h.locale=l,m.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),r&&(u.push("$categoryId: String!"),h.categoryId=r,m.push("{ categories: { sys: { id: $categoryId } } }")),m.length&&g.push(`where: {
90
90
  AND: [
91
91
  ${m.join(`
92
92
  `)}
93
93
  ]
94
- }`);const d=u.length?`(${u.join(", ")})`:"",k=g.length?`(
94
+ }`);const p=u.length?`(${u.join(", ")})`:"",k=g.length?`(
95
95
  ${g.join(`
96
96
  `)}
97
97
  )`:"",w=`
98
- query${d} {
98
+ query${p} {
99
99
  blogPostCollection${k} {
100
100
  total
101
101
  items {
@@ -131,7 +131,7 @@ query${d} {
131
131
  }
132
132
  }
133
133
  }
134
- `,{blogPostCollection:C}=await p.graphqlQuery(w,{...h});return new $({page:s,total:C.total,size:i,items:C.items})},D=async({id:c,slug:l,marketCode:a,locale:r})=>{const o=[],e={},t=[];if(c)o.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)o.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");a&&(o.push("$marketCode: String!"),e.marketCode=a,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(o.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${o.join(", ")})`,i=`(
134
+ `,{blogPostCollection:C}=await d.graphqlQuery(w,{...h});return new y({page:s,total:C.total,size:o,items:C.items})},D=async({id:c,slug:l,marketCode:n,locale:r})=>{const i=[],e={},t=[];if(c)i.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)i.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");n&&(i.push("$marketCode: String!"),e.marketCode=n,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(i.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${i.join(", ")})`,o=`(
135
135
  limit: 1
136
136
  where: {
137
137
  AND: [
@@ -139,9 +139,9 @@ query${d} {
139
139
  `)}
140
140
  ]
141
141
  }
142
- )`,n=`
142
+ )`,a=`
143
143
  query${s} {
144
- blogPostCollection${i} {
144
+ blogPostCollection${o} {
145
145
  items {
146
146
  sys {
147
147
  id
@@ -208,13 +208,13 @@ query${s} {
208
208
  }
209
209
  }
210
210
  }
211
- `,{blogPostCollection:u}=await p.graphqlQuery(n,{...e}),h=u.items.at(0);if(!h)throw new y;return h},x=async({marketCode:c,locale:l,page:a=1,size:r=20}={})=>{const o=Math.max(1,Math.floor(a)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=["limit: $limit","skip: $skip"],n=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,n.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),n.length&&i.push(`where: {
211
+ `,{blogPostCollection:u}=await d.graphqlQuery(a,{...e}),h=u.items.at(0);if(!h)throw new $;return h},x=async({marketCode:c,locale:l,page:n=1,size:r=20}={})=>{const i=Math.max(1,Math.floor(n)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=["limit: $limit","skip: $skip"],a=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,a.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,a.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),a.length&&o.push(`where: {
212
212
  AND: [
213
- ${n.join(`
213
+ ${a.join(`
214
214
  `)}
215
215
  ]
216
- }`);const u=t.length?`(${t.join(", ")})`:"",h=i.length?`(
217
- ${i.join(`
216
+ }`);const u=t.length?`(${t.join(", ")})`:"",h=o.length?`(
217
+ ${o.join(`
218
218
  `)}
219
219
  )`:"",g=`
220
220
  query${u} {
@@ -235,7 +235,7 @@ query${u} {
235
235
  }
236
236
  }
237
237
  }
238
- `,{blogCategoryCollection:m}=await p.graphqlQuery(g,{...s});return new $({page:o,total:m.total,size:e,items:m.items})},z=async({id:c,slug:l,marketCode:a,locale:r})=>{const o=[],e={},t=[];if(c)o.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)o.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");a&&(o.push("$marketCode: String!"),e.marketCode=a,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(o.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${o.join(", ")})`,i=`(
238
+ `,{blogCategoryCollection:m}=await d.graphqlQuery(g,{...s});return new y({page:i,total:m.total,size:e,items:m.items})},z=async({id:c,slug:l,marketCode:n,locale:r})=>{const i=[],e={},t=[];if(c)i.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)i.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");n&&(i.push("$marketCode: String!"),e.marketCode=n,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(i.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${i.join(", ")})`,o=`(
239
239
  limit: 1
240
240
  where: {
241
241
  AND: [
@@ -243,9 +243,9 @@ query${u} {
243
243
  `)}
244
244
  ]
245
245
  }
246
- )`,n=`
246
+ )`,a=`
247
247
  query${s} {
248
- blogCategoryCollection${i} {
248
+ blogCategoryCollection${o} {
249
249
  items {
250
250
  sys {
251
251
  id
@@ -268,13 +268,13 @@ query${s} {
268
268
  }
269
269
  }
270
270
  }
271
- `,{blogCategoryCollection:u}=await p.graphqlQuery(n,{...e}),h=u.items.at(0);if(!h)throw new y;return h},M=async({marketCode:c,locale:l,page:a=1,size:r=20}={})=>{const o=Math.max(1,Math.floor(a)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=["limit: $limit","skip: $skip"],n=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,n.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),n.length&&i.push(`where: {
271
+ `,{blogCategoryCollection:u}=await d.graphqlQuery(a,{...e}),h=u.items.at(0);if(!h)throw new $;return h},M=async({marketCode:c,locale:l,page:n=1,size:r=20}={})=>{const i=Math.max(1,Math.floor(n)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=["limit: $limit","skip: $skip"],a=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,a.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,a.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),a.length&&o.push(`where: {
272
272
  AND: [
273
- ${n.join(`
273
+ ${a.join(`
274
274
  `)}
275
275
  ]
276
- }`);const u=t.length?`(${t.join(", ")})`:"",h=i.length?`(
277
- ${i.join(`
276
+ }`);const u=t.length?`(${t.join(", ")})`:"",h=o.length?`(
277
+ ${o.join(`
278
278
  `)}
279
279
  )`:"",g=`
280
280
  query${u} {
@@ -303,12 +303,12 @@ query${u} {
303
303
  }
304
304
  }
305
305
  }
306
- `,{blogCollectionCollection:m}=await p.graphqlQuery(g,{...s});return new $({page:o,total:m.total,size:e,items:m.items.map(d=>({...d,category:d.type==="category"?d.category:null,categoryId:d.type==="category"?d.category?.sys.id??null:null,collectionId:d.type==="manual"?d.sys.id:null}))})},j=async({page:c=1,size:l=20,marketCode:a,locale:r}={})=>{const o=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=[];a&&(t.push("$marketCode: String!"),s.marketCode=a,i.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${t.join(", ")})`,u=i.length?`(
306
+ `,{blogCollectionCollection:m}=await d.graphqlQuery(g,{...s});return new y({page:i,total:m.total,size:e,items:m.items.map(p=>({...p,category:p.type==="category"?p.category:null,categoryId:p.type==="category"?p.category?.sys.id??null:null,collectionId:p.type==="manual"?p.sys.id:null}))})},j=async({page:c=1,size:l=20,marketCode:n,locale:r}={})=>{const i=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=[];n&&(t.push("$marketCode: String!"),s.marketCode=n,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const a=`(${t.join(", ")})`,u=o.length?`(
307
307
  limit: $limit
308
308
  skip: $skip
309
309
  where: {
310
310
  AND: [
311
- ${i.join(`
311
+ ${o.join(`
312
312
  `)}
313
313
  ]
314
314
  }
@@ -316,7 +316,7 @@ query${u} {
316
316
  limit: $limit
317
317
  skip: $skip
318
318
  )`,h=`
319
- query${n} {
319
+ query${a} {
320
320
  brandCollectionCollection${u} {
321
321
  total
322
322
  items {
@@ -351,13 +351,13 @@ query${n} {
351
351
  }
352
352
  }
353
353
  }
354
- `,{brandCollectionCollection:g}=await p.graphqlQuery(h,{...s});return new $({page:o,total:g.total,size:e,items:g.items})},R=async({marketCode:c,locale:l,page:a=1,size:r=20}={})=>{const o=Math.max(1,Math.floor(a)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=["limit: $limit","skip: $skip"],n=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,n.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),n.length&&i.push(`where: {
354
+ `,{brandCollectionCollection:g}=await d.graphqlQuery(h,{...s});return new y({page:i,total:g.total,size:e,items:g.items})},R=async({marketCode:c,locale:l,page:n=1,size:r=20}={})=>{const i=Math.max(1,Math.floor(n)),e=Math.max(1,Math.floor(r)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=["limit: $limit","skip: $skip"],a=[];c&&(t.push("$marketCode: String!"),s.marketCode=c,a.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(t.push("$locale: String!"),s.locale=l,a.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),a.length&&o.push(`where: {
355
355
  AND: [
356
- ${n.join(`
356
+ ${a.join(`
357
357
  `)}
358
358
  ]
359
- }`);const u=t.length?`(${t.join(", ")})`:"",h=i.length?`(
360
- ${i.join(`
359
+ }`);const u=t.length?`(${t.join(", ")})`:"",h=o.length?`(
360
+ ${o.join(`
361
361
  `)}
362
362
  )`:"",g=`
363
363
  query${u} {
@@ -382,7 +382,7 @@ query${u} {
382
382
  }
383
383
  }
384
384
  }
385
- `,{documentationCategoryCollection:m}=await p.graphqlQuery(g,{...s});return new $({page:o,total:m.total,size:e,items:m.items})},I=async({id:c,slug:l,marketCode:a,locale:r})=>{const o=[],e={},t=[];if(c)o.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)o.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");a&&(o.push("$marketCode: String!"),e.marketCode=a,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(o.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${o.join(", ")})`,i=`(
385
+ `,{documentationCategoryCollection:m}=await d.graphqlQuery(g,{...s});return new y({page:i,total:m.total,size:e,items:m.items})},_=async({id:c,slug:l,marketCode:n,locale:r})=>{const i=[],e={},t=[];if(c)i.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)i.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");n&&(i.push("$marketCode: String!"),e.marketCode=n,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(i.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${i.join(", ")})`,o=`(
386
386
  limit: 1
387
387
  where: {
388
388
  AND: [
@@ -390,9 +390,9 @@ query${u} {
390
390
  `)}
391
391
  ]
392
392
  }
393
- )`,n=`
393
+ )`,a=`
394
394
  query${s} {
395
- documentationCategoryCollection${i} {
395
+ documentationCategoryCollection${o} {
396
396
  items {
397
397
  sys {
398
398
  id
@@ -412,13 +412,13 @@ query${s} {
412
412
  }
413
413
  }
414
414
  }
415
- `,{documentationCategoryCollection:u}=await p.graphqlQuery(n,{...e}),h=u.items.at(0);if(!h)throw new y;return h},_=async({marketCode:c,locale:l,categorySlug:a,page:r=1,size:o=20}={})=>{const e=Math.max(1,Math.floor(r)),t=Math.max(1,Math.floor(o)),s=["$limit: Int!","$skip: Int!"],i={limit:t,skip:(e-1)*t},n=["limit: $limit","skip: $skip"],u=[];c&&(s.push("$marketCode: String!"),i.marketCode=c,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(s.push("$locale: String!"),i.locale=l,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),a&&(s.push("$categorySlug: String!"),i.categorySlug=a,u.push("{ category: { slug: $categorySlug } }")),u.length&&n.push(`where: {
415
+ `,{documentationCategoryCollection:u}=await d.graphqlQuery(a,{...e}),h=u.items.at(0);if(!h)throw new $;return h},I=async({marketCode:c,locale:l,categorySlug:n,page:r=1,size:i=20}={})=>{const e=Math.max(1,Math.floor(r)),t=Math.max(1,Math.floor(i)),s=["$limit: Int!","$skip: Int!"],o={limit:t,skip:(e-1)*t},a=["limit: $limit","skip: $skip"],u=[];c&&(s.push("$marketCode: String!"),o.marketCode=c,u.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(s.push("$locale: String!"),o.locale=l,u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")),n&&(s.push("$categorySlug: String!"),o.categorySlug=n,u.push("{ category: { slug: $categorySlug } }")),u.length&&a.push(`where: {
416
416
  AND: [
417
417
  ${u.join(`
418
418
  `)}
419
419
  ]
420
- }`);const h=s.length?`(${s.join(", ")})`:"",g=n.length?`(
421
- ${n.join(`
420
+ }`);const h=s.length?`(${s.join(", ")})`:"",g=a.length?`(
421
+ ${a.join(`
422
422
  `)}
423
423
  )`:"",m=`
424
424
  query${h} {
@@ -450,7 +450,7 @@ query${h} {
450
450
  }
451
451
  }
452
452
  }
453
- `,{documentationArticleCollection:d}=await p.graphqlQuery(m,{...i});return new $({page:e,total:d.total,size:t,items:d.items})},O=async({id:c,slug:l,marketCode:a,locale:r})=>{const o=[],e={},t=[];if(c)o.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)o.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");a&&(o.push("$marketCode: String!"),e.marketCode=a,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(o.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${o.join(", ")})`,i=`(
453
+ `,{documentationArticleCollection:p}=await d.graphqlQuery(m,{...o});return new y({page:e,total:p.total,size:t,items:p.items})},O=async({id:c,slug:l,marketCode:n,locale:r})=>{const i=[],e={},t=[];if(c)i.push("$id: String!"),e.id=c,t.push("{ sys: { id: $id } }");else if(l)i.push("$slug: String!"),e.slug=l,t.push("{ slug: $slug }");else throw new Error("Either id or slug is required.");n&&(i.push("$marketCode: String!"),e.marketCode=n,t.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(i.push("$locale: String!"),e.locale=r,t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const s=`(${i.join(", ")})`,o=`(
454
454
  limit: 1
455
455
  where: {
456
456
  AND: [
@@ -458,9 +458,9 @@ query${h} {
458
458
  `)}
459
459
  ]
460
460
  }
461
- )`,n=`
461
+ )`,a=`
462
462
  query${s} {
463
- documentationArticleCollection${i} {
463
+ documentationArticleCollection${o} {
464
464
  items {
465
465
  sys {
466
466
  id
@@ -511,13 +511,13 @@ query${s} {
511
511
  }
512
512
  }
513
513
  }
514
- `,{documentationArticleCollection:u}=await p.graphqlQuery(n,{...e}),h=u.items.at(0);if(!h)throw new y;return h},P=async({page:c=1,size:l=20,marketCode:a,locale:r}={})=>{const o=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=[];a&&(t.push("$marketCode: String!"),s.marketCode=a,i.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=t.length?`(${t.join(", ")})`:"",u=i.length?`(
514
+ `,{documentationArticleCollection:u}=await d.graphqlQuery(a,{...e}),h=u.items.at(0);if(!h)throw new $;return h},P=async({page:c=1,size:l=20,marketCode:n,locale:r}={})=>{const i=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=[];n&&(t.push("$marketCode: String!"),s.marketCode=n,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const a=t.length?`(${t.join(", ")})`:"",u=o.length?`(
515
515
  limit: $limit
516
516
  skip: $skip
517
517
  order: order_ASC
518
518
  where: {
519
519
  AND: [
520
- ${i.join(`
520
+ ${o.join(`
521
521
  `)}
522
522
  ]
523
523
  }
@@ -526,7 +526,7 @@ query${s} {
526
526
  skip: $skip
527
527
  order: order_ASC
528
528
  )`,h=`
529
- query${n} {
529
+ query${a} {
530
530
  hyperlinkCollectionCollection${u} {
531
531
  total
532
532
  items {
@@ -550,12 +550,12 @@ query${n} {
550
550
  }
551
551
  }
552
552
  }
553
- `,{hyperlinkCollectionCollection:g}=await p.graphqlQuery(h,{...s});return new $({page:o,total:g.total,size:e,items:g.items})},T=async({page:c=1,size:l=20,marketCode:a,locale:r}={})=>{const o=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(o-1)*e},i=[];a&&(t.push("$marketCode: String!"),s.marketCode=a,i.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const n=`(${t.join(", ")})`,u=i.length?`(
553
+ `,{hyperlinkCollectionCollection:g}=await d.graphqlQuery(h,{...s});return new y({page:i,total:g.total,size:e,items:g.items})},T=async({page:c=1,size:l=20,marketCode:n,locale:r}={})=>{const i=Math.max(1,Math.floor(c)),e=Math.max(1,Math.floor(l)),t=["$limit: Int!","$skip: Int!"],s={limit:e,skip:(i-1)*e},o=[];n&&(t.push("$marketCode: String!"),s.marketCode=n,o.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),r&&(t.push("$locale: String!"),s.locale=r,o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const a=`(${t.join(", ")})`,u=o.length?`(
554
554
  limit: $limit
555
555
  skip: $skip
556
556
  where: {
557
557
  AND: [
558
- ${i.join(`
558
+ ${o.join(`
559
559
  `)}
560
560
  ]
561
561
  }
@@ -563,7 +563,7 @@ query${n} {
563
563
  limit: $limit
564
564
  skip: $skip
565
565
  )`,h=`
566
- query${n} {
566
+ query${a} {
567
567
  keywordCollectionCollection${u} {
568
568
  total
569
569
  items {
@@ -576,4 +576,42 @@ query${n} {
576
576
  }
577
577
  }
578
578
  }
579
- `,{keywordCollectionCollection:g}=await p.graphqlQuery(h,{...s});return new $({page:o,total:g.total,size:e,items:g.items})};exports.ContentfulSDK=p;exports.PaginatedResponse=$;exports.getBannerCollections=q;exports.getBlogCategories=x;exports.getBlogCategoryDetail=z;exports.getBlogCollections=M;exports.getBlogPostDetail=D;exports.getBlogPosts=S;exports.getBrandCollections=j;exports.getDocArticleDetail=O;exports.getDocArticles=_;exports.getDocCategories=R;exports.getDocCategoryDetail=I;exports.getHyperlinkCollections=P;exports.getKeywordCollections=T;
579
+ `,{keywordCollectionCollection:g}=await d.graphqlQuery(h,{...s});return new y({page:i,total:g.total,size:e,items:g.items})},V=async({marketCode:c,locale:l}={})=>{const n=[],r={},i=[];c&&(n.push("$marketCode: String!"),r.marketCode=c,i.push("{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }")),l&&(n.push("$locale: String!"),r.locale=l,i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));const e=n.length?`(${n.join(", ")})`:"",t=i.length?`(
580
+ limit: 1
581
+ where: {
582
+ AND: [
583
+ ${i.join(`
584
+ `)}
585
+ ]
586
+ }
587
+ )`:"(limit: 1)",s=`
588
+ query${e} {
589
+ policyAndTermsCollection${t} {
590
+ items {
591
+ sys {
592
+ id
593
+ }
594
+ title
595
+ locale
596
+ content {
597
+ json
598
+ links {
599
+ assets {
600
+ block {
601
+ sys {
602
+ id
603
+ }
604
+ url
605
+ width
606
+ height
607
+ contentType
608
+ title
609
+ description
610
+ }
611
+ }
612
+ }
613
+ }
614
+ }
615
+ }
616
+ }
617
+ `,{policyAndTermsCollection:o}=await d.graphqlQuery(s,{...r}),a=o.items.at(0);if(!a)throw new $;return a};exports.ContentfulSDK=d;exports.PaginatedResponse=y;exports.getBannerCollections=q;exports.getBlogCategories=x;exports.getBlogCategoryDetail=z;exports.getBlogCollections=M;exports.getBlogPostDetail=D;exports.getBlogPosts=S;exports.getBrandCollections=j;exports.getDocArticleDetail=O;exports.getDocArticles=I;exports.getDocCategories=R;exports.getDocCategoryDetail=_;exports.getHyperlinkCollections=P;exports.getKeywordCollections=T;exports.getPolicyAndTerms=V;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class d {
1
+ class p {
2
2
  static _config;
3
3
  static get config() {
4
4
  if (!this._config)
@@ -8,20 +8,20 @@ class d {
8
8
  static configure(l) {
9
9
  this._config = l;
10
10
  }
11
- static async graphqlQuery(l, a = {}) {
12
- const { url: r, method: o = "POST", headers: e = {} } = this.config, t = await fetch(r, {
13
- method: o,
11
+ static async graphqlQuery(l, n = {}) {
12
+ const { url: r, method: i = "POST", headers: e = {} } = this.config, t = await fetch(r, {
13
+ method: i,
14
14
  headers: {
15
15
  "Content-Type": "application/json",
16
16
  ...e
17
17
  },
18
- body: JSON.stringify({ query: l, variables: a })
18
+ body: JSON.stringify({ query: l, variables: n })
19
19
  });
20
20
  if (!t.ok) {
21
- const i = await t.text();
21
+ const o = await t.text();
22
22
  throw new Error(
23
23
  `GraphQL request failed: ${t.status} ${t.statusText}
24
- ${i}`
24
+ ${o}`
25
25
  );
26
26
  }
27
27
  const s = await t.json();
@@ -40,34 +40,34 @@ class $ {
40
40
  totalPages;
41
41
  constructor({
42
42
  page: l,
43
- total: a,
43
+ total: n,
44
44
  size: r,
45
- items: o
45
+ items: i
46
46
  }) {
47
- this.page = l, this.total = a, this.size = r, this.items = o, this.totalPages = Math.ceil(this.total / this.size);
47
+ this.page = l, this.total = n, this.size = r, this.items = i, this.totalPages = Math.ceil(this.total / this.size);
48
48
  }
49
49
  }
50
50
  const q = async ({
51
51
  slot: c,
52
52
  page: l = 1,
53
- size: a = 20,
53
+ size: n = 20,
54
54
  platform: r,
55
- marketCode: o,
55
+ marketCode: i,
56
56
  locale: e
57
57
  }) => {
58
- const t = Math.max(1, Math.floor(l)), s = Math.max(1, Math.floor(a)), i = [
58
+ const t = Math.max(1, Math.floor(l)), s = Math.max(1, Math.floor(n)), o = [
59
59
  "$slot: String!",
60
60
  "$limit: Int!",
61
61
  "$skip: Int!"
62
- ], n = {
62
+ ], a = {
63
63
  slot: c,
64
64
  limit: s,
65
65
  skip: (t - 1) * s
66
66
  }, u = ["{ slot: $slot }"];
67
- r && (i.push("$platform: String!"), n.platform = r, u.push("{ platform_contains_some: [$platform] }")), o && (i.push("$marketCode: String!"), n.marketCode = o, u.push(
67
+ r && (o.push("$platform: String!"), a.platform = r, u.push("{ platform_contains_some: [$platform] }")), i && (o.push("$marketCode: String!"), a.marketCode = i, u.push(
68
68
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
69
- )), e && (i.push("$locale: String!"), n.locale = e, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
70
- const h = `(${i.join(", ")})`, m = `(
69
+ )), e && (o.push("$locale: String!"), a.locale = e, u.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
70
+ const h = `(${o.join(", ")})`, m = `(
71
71
  limit: $limit
72
72
  skip: $skip
73
73
  where: {
@@ -113,14 +113,14 @@ query${h} {
113
113
  }
114
114
  }
115
115
  }
116
- `, { bannerCollectionCollection: p } = await d.graphqlQuery(g, {
117
- ...n
116
+ `, { bannerCollectionCollection: d } = await p.graphqlQuery(g, {
117
+ ...a
118
118
  });
119
119
  return new $({
120
120
  page: t,
121
- total: p.total,
121
+ total: d.total,
122
122
  size: s,
123
- items: p.items
123
+ items: d.items
124
124
  });
125
125
  };
126
126
  class y extends Response {
@@ -134,14 +134,14 @@ class y extends Response {
134
134
  const S = async ({
135
135
  marketCode: c,
136
136
  locale: l,
137
- collectionId: a,
137
+ collectionId: n,
138
138
  categoryId: r,
139
- page: o = 1,
139
+ page: i = 1,
140
140
  size: e = 20,
141
141
  skip: t = 0
142
142
  } = {}) => {
143
- const s = Math.max(1, Math.floor(o)), i = Math.max(1, Math.floor(e)), n = Math.max(0, Math.floor(t));
144
- if (a) {
143
+ const s = Math.max(1, Math.floor(i)), o = Math.max(1, Math.floor(e)), a = Math.max(0, Math.floor(t));
144
+ if (n) {
145
145
  const b = `
146
146
  query($collectionId: String!, $limit: Int!, $skip: Int!) {
147
147
  blogCollectionCollection(limit: 1 where: { sys: { id: $collectionId } }) {
@@ -183,23 +183,23 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
183
183
  }
184
184
  }
185
185
  }
186
- `, { blogCollectionCollection: A } = await d.graphqlQuery(b, {
187
- collectionId: a,
188
- limit: i,
189
- skip: (s - 1) * i + n
186
+ `, { blogCollectionCollection: A } = await p.graphqlQuery(b, {
187
+ collectionId: n,
188
+ limit: o,
189
+ skip: (s - 1) * o + a
190
190
  }), f = A.items.at(0);
191
191
  if (!f)
192
192
  throw new y();
193
193
  return new $({
194
194
  page: s,
195
195
  total: f.postsCollection?.total ?? 0,
196
- size: i,
196
+ size: o,
197
197
  items: f.postsCollection?.items ?? []
198
198
  });
199
199
  }
200
200
  const u = ["$limit: Int!", "$skip: Int!"], h = {
201
- limit: i,
202
- skip: (s - 1) * i + n
201
+ limit: o,
202
+ skip: (s - 1) * o + a
203
203
  }, m = ["limit: $limit", "skip: $skip"], g = [];
204
204
  c && (u.push("$marketCode: String!"), h.marketCode = c, g.push(
205
205
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
@@ -209,11 +209,11 @@ query($collectionId: String!, $limit: Int!, $skip: Int!) {
209
209
  `)}
210
210
  ]
211
211
  }`);
212
- const p = u.length ? `(${u.join(", ")})` : "", k = m.length ? `(
212
+ const d = u.length ? `(${u.join(", ")})` : "", k = m.length ? `(
213
213
  ${m.join(`
214
214
  `)}
215
215
  )` : "", w = `
216
- query${p} {
216
+ query${d} {
217
217
  blogPostCollection${k} {
218
218
  total
219
219
  items {
@@ -249,32 +249,32 @@ query${p} {
249
249
  }
250
250
  }
251
251
  }
252
- `, { blogPostCollection: C } = await d.graphqlQuery(w, {
252
+ `, { blogPostCollection: C } = await p.graphqlQuery(w, {
253
253
  ...h
254
254
  });
255
255
  return new $({
256
256
  page: s,
257
257
  total: C.total,
258
- size: i,
258
+ size: o,
259
259
  items: C.items
260
260
  });
261
261
  }, x = async ({
262
262
  id: c,
263
263
  slug: l,
264
- marketCode: a,
264
+ marketCode: n,
265
265
  locale: r
266
266
  }) => {
267
- const o = [], e = {}, t = [];
267
+ const i = [], e = {}, t = [];
268
268
  if (c)
269
- o.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
269
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
270
270
  else if (l)
271
- o.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
271
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
272
272
  else
273
273
  throw new Error("Either id or slug is required.");
274
- a && (o.push("$marketCode: String!"), e.marketCode = a, t.push(
274
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
275
275
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
276
- )), r && (o.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
277
- const s = `(${o.join(", ")})`, i = `(
276
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
277
+ const s = `(${i.join(", ")})`, o = `(
278
278
  limit: 1
279
279
  where: {
280
280
  AND: [
@@ -282,9 +282,9 @@ query${p} {
282
282
  `)}
283
283
  ]
284
284
  }
285
- )`, n = `
285
+ )`, a = `
286
286
  query${s} {
287
- blogPostCollection${i} {
287
+ blogPostCollection${o} {
288
288
  items {
289
289
  sys {
290
290
  id
@@ -351,7 +351,7 @@ query${s} {
351
351
  }
352
352
  }
353
353
  }
354
- `, { blogPostCollection: u } = await d.graphqlQuery(n, {
354
+ `, { blogPostCollection: u } = await p.graphqlQuery(a, {
355
355
  ...e
356
356
  }), h = u.items.at(0);
357
357
  if (!h)
@@ -360,23 +360,23 @@ query${s} {
360
360
  }, D = async ({
361
361
  marketCode: c,
362
362
  locale: l,
363
- page: a = 1,
363
+ page: n = 1,
364
364
  size: r = 20
365
365
  } = {}) => {
366
- const o = Math.max(1, Math.floor(a)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
366
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
367
367
  limit: e,
368
- skip: (o - 1) * e
369
- }, i = ["limit: $limit", "skip: $skip"], n = [];
370
- c && (t.push("$marketCode: String!"), s.marketCode = c, n.push(
368
+ skip: (i - 1) * e
369
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
370
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
371
371
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
372
- )), l && (t.push("$locale: String!"), s.locale = l, n.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), n.length && i.push(`where: {
372
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }")), a.length && o.push(`where: {
373
373
  AND: [
374
- ${n.join(`
374
+ ${a.join(`
375
375
  `)}
376
376
  ]
377
377
  }`);
378
- const u = t.length ? `(${t.join(", ")})` : "", h = i.length ? `(
379
- ${i.join(`
378
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
379
+ ${o.join(`
380
380
  `)}
381
381
  )` : "", m = `
382
382
  query${u} {
@@ -397,11 +397,11 @@ query${u} {
397
397
  }
398
398
  }
399
399
  }
400
- `, { blogCategoryCollection: g } = await d.graphqlQuery(m, {
400
+ `, { blogCategoryCollection: g } = await p.graphqlQuery(m, {
401
401
  ...s
402
402
  });
403
403
  return new $({
404
- page: o,
404
+ page: i,
405
405
  total: g.total,
406
406
  size: e,
407
407
  items: g.items
@@ -409,20 +409,20 @@ query${u} {
409
409
  }, z = async ({
410
410
  id: c,
411
411
  slug: l,
412
- marketCode: a,
412
+ marketCode: n,
413
413
  locale: r
414
414
  }) => {
415
- const o = [], e = {}, t = [];
415
+ const i = [], e = {}, t = [];
416
416
  if (c)
417
- o.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
417
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
418
418
  else if (l)
419
- o.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
419
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
420
420
  else
421
421
  throw new Error("Either id or slug is required.");
422
- a && (o.push("$marketCode: String!"), e.marketCode = a, t.push(
422
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
423
423
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
424
- )), r && (o.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
425
- const s = `(${o.join(", ")})`, i = `(
424
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
425
+ const s = `(${i.join(", ")})`, o = `(
426
426
  limit: 1
427
427
  where: {
428
428
  AND: [
@@ -430,9 +430,9 @@ query${u} {
430
430
  `)}
431
431
  ]
432
432
  }
433
- )`, n = `
433
+ )`, a = `
434
434
  query${s} {
435
- blogCategoryCollection${i} {
435
+ blogCategoryCollection${o} {
436
436
  items {
437
437
  sys {
438
438
  id
@@ -455,7 +455,7 @@ query${s} {
455
455
  }
456
456
  }
457
457
  }
458
- `, { blogCategoryCollection: u } = await d.graphqlQuery(n, {
458
+ `, { blogCategoryCollection: u } = await p.graphqlQuery(a, {
459
459
  ...e
460
460
  }), h = u.items.at(0);
461
461
  if (!h)
@@ -464,25 +464,25 @@ query${s} {
464
464
  }, M = async ({
465
465
  marketCode: c,
466
466
  locale: l,
467
- page: a = 1,
467
+ page: n = 1,
468
468
  size: r = 20
469
469
  } = {}) => {
470
- const o = Math.max(1, Math.floor(a)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
470
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
471
471
  limit: e,
472
- skip: (o - 1) * e
473
- }, i = ["limit: $limit", "skip: $skip"], n = [];
474
- c && (t.push("$marketCode: String!"), s.marketCode = c, n.push(
472
+ skip: (i - 1) * e
473
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
474
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
475
475
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
476
- )), l && (t.push("$locale: String!"), s.locale = l, n.push(
476
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push(
477
477
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
478
- )), n.length && i.push(`where: {
478
+ )), a.length && o.push(`where: {
479
479
  AND: [
480
- ${n.join(`
480
+ ${a.join(`
481
481
  `)}
482
482
  ]
483
483
  }`);
484
- const u = t.length ? `(${t.join(", ")})` : "", h = i.length ? `(
485
- ${i.join(`
484
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
485
+ ${o.join(`
486
486
  `)}
487
487
  )` : "", m = `
488
488
  query${u} {
@@ -511,39 +511,39 @@ query${u} {
511
511
  }
512
512
  }
513
513
  }
514
- `, { blogCollectionCollection: g } = await d.graphqlQuery(m, {
514
+ `, { blogCollectionCollection: g } = await p.graphqlQuery(m, {
515
515
  ...s
516
516
  });
517
517
  return new $({
518
- page: o,
518
+ page: i,
519
519
  total: g.total,
520
520
  size: e,
521
- items: g.items.map((p) => ({
522
- ...p,
523
- category: p.type === "category" ? p.category : null,
524
- categoryId: p.type === "category" ? p.category?.sys.id ?? null : null,
525
- collectionId: p.type === "manual" ? p.sys.id : null
521
+ items: g.items.map((d) => ({
522
+ ...d,
523
+ category: d.type === "category" ? d.category : null,
524
+ categoryId: d.type === "category" ? d.category?.sys.id ?? null : null,
525
+ collectionId: d.type === "manual" ? d.sys.id : null
526
526
  }))
527
527
  });
528
528
  }, j = async ({
529
529
  page: c = 1,
530
530
  size: l = 20,
531
- marketCode: a,
531
+ marketCode: n,
532
532
  locale: r
533
533
  } = {}) => {
534
- const o = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
534
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
535
535
  limit: e,
536
- skip: (o - 1) * e
537
- }, i = [];
538
- a && (t.push("$marketCode: String!"), s.marketCode = a, i.push(
536
+ skip: (i - 1) * e
537
+ }, o = [];
538
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
539
539
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
540
- )), r && (t.push("$locale: String!"), s.locale = r, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
541
- const n = `(${t.join(", ")})`, u = i.length ? `(
540
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
541
+ const a = `(${t.join(", ")})`, u = o.length ? `(
542
542
  limit: $limit
543
543
  skip: $skip
544
544
  where: {
545
545
  AND: [
546
- ${i.join(`
546
+ ${o.join(`
547
547
  `)}
548
548
  ]
549
549
  }
@@ -551,7 +551,7 @@ query${u} {
551
551
  limit: $limit
552
552
  skip: $skip
553
553
  )`, h = `
554
- query${n} {
554
+ query${a} {
555
555
  brandCollectionCollection${u} {
556
556
  total
557
557
  items {
@@ -586,37 +586,37 @@ query${n} {
586
586
  }
587
587
  }
588
588
  }
589
- `, { brandCollectionCollection: m } = await d.graphqlQuery(h, {
589
+ `, { brandCollectionCollection: m } = await p.graphqlQuery(h, {
590
590
  ...s
591
591
  });
592
592
  return new $({
593
- page: o,
593
+ page: i,
594
594
  total: m.total,
595
595
  size: e,
596
596
  items: m.items
597
597
  });
598
- }, I = async ({
598
+ }, R = async ({
599
599
  marketCode: c,
600
600
  locale: l,
601
- page: a = 1,
601
+ page: n = 1,
602
602
  size: r = 20
603
603
  } = {}) => {
604
- const o = Math.max(1, Math.floor(a)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
604
+ const i = Math.max(1, Math.floor(n)), e = Math.max(1, Math.floor(r)), t = ["$limit: Int!", "$skip: Int!"], s = {
605
605
  limit: e,
606
- skip: (o - 1) * e
607
- }, i = ["limit: $limit", "skip: $skip"], n = [];
608
- c && (t.push("$marketCode: String!"), s.marketCode = c, n.push(
606
+ skip: (i - 1) * e
607
+ }, o = ["limit: $limit", "skip: $skip"], a = [];
608
+ c && (t.push("$marketCode: String!"), s.marketCode = c, a.push(
609
609
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
610
- )), l && (t.push("$locale: String!"), s.locale = l, n.push(
610
+ )), l && (t.push("$locale: String!"), s.locale = l, a.push(
611
611
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
612
- )), n.length && i.push(`where: {
612
+ )), a.length && o.push(`where: {
613
613
  AND: [
614
- ${n.join(`
614
+ ${a.join(`
615
615
  `)}
616
616
  ]
617
617
  }`);
618
- const u = t.length ? `(${t.join(", ")})` : "", h = i.length ? `(
619
- ${i.join(`
618
+ const u = t.length ? `(${t.join(", ")})` : "", h = o.length ? `(
619
+ ${o.join(`
620
620
  `)}
621
621
  )` : "", m = `
622
622
  query${u} {
@@ -641,34 +641,34 @@ query${u} {
641
641
  }
642
642
  }
643
643
  }
644
- `, { documentationCategoryCollection: g } = await d.graphqlQuery(m, {
644
+ `, { documentationCategoryCollection: g } = await p.graphqlQuery(m, {
645
645
  ...s
646
646
  });
647
647
  return new $({
648
- page: o,
648
+ page: i,
649
649
  total: g.total,
650
650
  size: e,
651
651
  items: g.items
652
652
  });
653
- }, R = async ({
653
+ }, _ = async ({
654
654
  id: c,
655
655
  slug: l,
656
- marketCode: a,
656
+ marketCode: n,
657
657
  locale: r
658
658
  }) => {
659
- const o = [], e = {}, t = [];
659
+ const i = [], e = {}, t = [];
660
660
  if (c)
661
- o.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
661
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
662
662
  else if (l)
663
- o.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
663
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
664
664
  else
665
665
  throw new Error("Either id or slug is required.");
666
- a && (o.push("$marketCode: String!"), e.marketCode = a, t.push(
666
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
667
667
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
668
- )), r && (o.push("$locale: String!"), e.locale = r, t.push(
668
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push(
669
669
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
670
670
  ));
671
- const s = `(${o.join(", ")})`, i = `(
671
+ const s = `(${i.join(", ")})`, o = `(
672
672
  limit: 1
673
673
  where: {
674
674
  AND: [
@@ -676,9 +676,9 @@ query${u} {
676
676
  `)}
677
677
  ]
678
678
  }
679
- )`, n = `
679
+ )`, a = `
680
680
  query${s} {
681
- documentationCategoryCollection${i} {
681
+ documentationCategoryCollection${o} {
682
682
  items {
683
683
  sys {
684
684
  id
@@ -698,35 +698,35 @@ query${s} {
698
698
  }
699
699
  }
700
700
  }
701
- `, { documentationCategoryCollection: u } = await d.graphqlQuery(n, {
701
+ `, { documentationCategoryCollection: u } = await p.graphqlQuery(a, {
702
702
  ...e
703
703
  }), h = u.items.at(0);
704
704
  if (!h)
705
705
  throw new y();
706
706
  return h;
707
- }, _ = async ({
707
+ }, I = async ({
708
708
  marketCode: c,
709
709
  locale: l,
710
- categorySlug: a,
710
+ categorySlug: n,
711
711
  page: r = 1,
712
- size: o = 20
712
+ size: i = 20
713
713
  } = {}) => {
714
- const e = Math.max(1, Math.floor(r)), t = Math.max(1, Math.floor(o)), s = ["$limit: Int!", "$skip: Int!"], i = {
714
+ const e = Math.max(1, Math.floor(r)), t = Math.max(1, Math.floor(i)), s = ["$limit: Int!", "$skip: Int!"], o = {
715
715
  limit: t,
716
716
  skip: (e - 1) * t
717
- }, n = ["limit: $limit", "skip: $skip"], u = [];
718
- c && (s.push("$marketCode: String!"), i.marketCode = c, u.push(
717
+ }, a = ["limit: $limit", "skip: $skip"], u = [];
718
+ c && (s.push("$marketCode: String!"), o.marketCode = c, u.push(
719
719
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
720
- )), l && (s.push("$locale: String!"), i.locale = l, u.push(
720
+ )), l && (s.push("$locale: String!"), o.locale = l, u.push(
721
721
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
722
- )), a && (s.push("$categorySlug: String!"), i.categorySlug = a, u.push("{ category: { slug: $categorySlug } }")), u.length && n.push(`where: {
722
+ )), n && (s.push("$categorySlug: String!"), o.categorySlug = n, u.push("{ category: { slug: $categorySlug } }")), u.length && a.push(`where: {
723
723
  AND: [
724
724
  ${u.join(`
725
725
  `)}
726
726
  ]
727
727
  }`);
728
- const h = s.length ? `(${s.join(", ")})` : "", m = n.length ? `(
729
- ${n.join(`
728
+ const h = s.length ? `(${s.join(", ")})` : "", m = a.length ? `(
729
+ ${a.join(`
730
730
  `)}
731
731
  )` : "", g = `
732
732
  query${h} {
@@ -758,34 +758,34 @@ query${h} {
758
758
  }
759
759
  }
760
760
  }
761
- `, { documentationArticleCollection: p } = await d.graphqlQuery(g, {
762
- ...i
761
+ `, { documentationArticleCollection: d } = await p.graphqlQuery(g, {
762
+ ...o
763
763
  });
764
764
  return new $({
765
765
  page: e,
766
- total: p.total,
766
+ total: d.total,
767
767
  size: t,
768
- items: p.items
768
+ items: d.items
769
769
  });
770
770
  }, O = async ({
771
771
  id: c,
772
772
  slug: l,
773
- marketCode: a,
773
+ marketCode: n,
774
774
  locale: r
775
775
  }) => {
776
- const o = [], e = {}, t = [];
776
+ const i = [], e = {}, t = [];
777
777
  if (c)
778
- o.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
778
+ i.push("$id: String!"), e.id = c, t.push("{ sys: { id: $id } }");
779
779
  else if (l)
780
- o.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
780
+ i.push("$slug: String!"), e.slug = l, t.push("{ slug: $slug }");
781
781
  else
782
782
  throw new Error("Either id or slug is required.");
783
- a && (o.push("$marketCode: String!"), e.marketCode = a, t.push(
783
+ n && (i.push("$marketCode: String!"), e.marketCode = n, t.push(
784
784
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
785
- )), r && (o.push("$locale: String!"), e.locale = r, t.push(
785
+ )), r && (i.push("$locale: String!"), e.locale = r, t.push(
786
786
  "{ OR: [{ locale_exists: false }, { locale: $locale }] }"
787
787
  ));
788
- const s = `(${o.join(", ")})`, i = `(
788
+ const s = `(${i.join(", ")})`, o = `(
789
789
  limit: 1
790
790
  where: {
791
791
  AND: [
@@ -793,9 +793,9 @@ query${h} {
793
793
  `)}
794
794
  ]
795
795
  }
796
- )`, n = `
796
+ )`, a = `
797
797
  query${s} {
798
- documentationArticleCollection${i} {
798
+ documentationArticleCollection${o} {
799
799
  items {
800
800
  sys {
801
801
  id
@@ -846,32 +846,32 @@ query${s} {
846
846
  }
847
847
  }
848
848
  }
849
- `, { documentationArticleCollection: u } = await d.graphqlQuery(n, {
849
+ `, { documentationArticleCollection: u } = await p.graphqlQuery(a, {
850
850
  ...e
851
851
  }), h = u.items.at(0);
852
852
  if (!h)
853
853
  throw new y();
854
854
  return h;
855
- }, P = async ({
855
+ }, T = async ({
856
856
  page: c = 1,
857
857
  size: l = 20,
858
- marketCode: a,
858
+ marketCode: n,
859
859
  locale: r
860
860
  } = {}) => {
861
- const o = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
861
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
862
862
  limit: e,
863
- skip: (o - 1) * e
864
- }, i = [];
865
- a && (t.push("$marketCode: String!"), s.marketCode = a, i.push(
863
+ skip: (i - 1) * e
864
+ }, o = [];
865
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
866
866
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
867
- )), r && (t.push("$locale: String!"), s.locale = r, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
868
- const n = t.length ? `(${t.join(", ")})` : "", u = i.length ? `(
867
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
868
+ const a = t.length ? `(${t.join(", ")})` : "", u = o.length ? `(
869
869
  limit: $limit
870
870
  skip: $skip
871
871
  order: order_ASC
872
872
  where: {
873
873
  AND: [
874
- ${i.join(`
874
+ ${o.join(`
875
875
  `)}
876
876
  ]
877
877
  }
@@ -880,7 +880,7 @@ query${s} {
880
880
  skip: $skip
881
881
  order: order_ASC
882
882
  )`, h = `
883
- query${n} {
883
+ query${a} {
884
884
  hyperlinkCollectionCollection${u} {
885
885
  total
886
886
  items {
@@ -904,14 +904,14 @@ query${n} {
904
904
  }
905
905
  }
906
906
  }
907
- `, { hyperlinkCollectionCollection: m } = await d.graphqlQuery(
907
+ `, { hyperlinkCollectionCollection: m } = await p.graphqlQuery(
908
908
  h,
909
909
  {
910
910
  ...s
911
911
  }
912
912
  );
913
913
  return new $({
914
- page: o,
914
+ page: i,
915
915
  total: m.total,
916
916
  size: e,
917
917
  items: m.items
@@ -919,22 +919,22 @@ query${n} {
919
919
  }, V = async ({
920
920
  page: c = 1,
921
921
  size: l = 20,
922
- marketCode: a,
922
+ marketCode: n,
923
923
  locale: r
924
924
  } = {}) => {
925
- const o = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
925
+ const i = Math.max(1, Math.floor(c)), e = Math.max(1, Math.floor(l)), t = ["$limit: Int!", "$skip: Int!"], s = {
926
926
  limit: e,
927
- skip: (o - 1) * e
928
- }, i = [];
929
- a && (t.push("$marketCode: String!"), s.marketCode = a, i.push(
927
+ skip: (i - 1) * e
928
+ }, o = [];
929
+ n && (t.push("$marketCode: String!"), s.marketCode = n, o.push(
930
930
  "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
931
- )), r && (t.push("$locale: String!"), s.locale = r, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
932
- const n = `(${t.join(", ")})`, u = i.length ? `(
931
+ )), r && (t.push("$locale: String!"), s.locale = r, o.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
932
+ const a = `(${t.join(", ")})`, u = o.length ? `(
933
933
  limit: $limit
934
934
  skip: $skip
935
935
  where: {
936
936
  AND: [
937
- ${i.join(`
937
+ ${o.join(`
938
938
  `)}
939
939
  ]
940
940
  }
@@ -942,7 +942,7 @@ query${n} {
942
942
  limit: $limit
943
943
  skip: $skip
944
944
  )`, h = `
945
- query${n} {
945
+ query${a} {
946
946
  keywordCollectionCollection${u} {
947
947
  total
948
948
  items {
@@ -955,18 +955,70 @@ query${n} {
955
955
  }
956
956
  }
957
957
  }
958
- `, { keywordCollectionCollection: m } = await d.graphqlQuery(h, {
958
+ `, { keywordCollectionCollection: m } = await p.graphqlQuery(h, {
959
959
  ...s
960
960
  });
961
961
  return new $({
962
- page: o,
962
+ page: i,
963
963
  total: m.total,
964
964
  size: e,
965
965
  items: m.items
966
966
  });
967
+ }, P = async ({
968
+ marketCode: c,
969
+ locale: l
970
+ } = {}) => {
971
+ const n = [], r = {}, i = [];
972
+ c && (n.push("$marketCode: String!"), r.marketCode = c, i.push(
973
+ "{ OR: [{ marketsCollection_exists: false }, { markets: { code: $marketCode } }] }"
974
+ )), l && (n.push("$locale: String!"), r.locale = l, i.push("{ OR: [{ locale_exists: false }, { locale: $locale }] }"));
975
+ const e = n.length ? `(${n.join(", ")})` : "", t = i.length ? `(
976
+ limit: 1
977
+ where: {
978
+ AND: [
979
+ ${i.join(`
980
+ `)}
981
+ ]
982
+ }
983
+ )` : "(limit: 1)", s = `
984
+ query${e} {
985
+ policyAndTermsCollection${t} {
986
+ items {
987
+ sys {
988
+ id
989
+ }
990
+ title
991
+ locale
992
+ content {
993
+ json
994
+ links {
995
+ assets {
996
+ block {
997
+ sys {
998
+ id
999
+ }
1000
+ url
1001
+ width
1002
+ height
1003
+ contentType
1004
+ title
1005
+ description
1006
+ }
1007
+ }
1008
+ }
1009
+ }
1010
+ }
1011
+ }
1012
+ }
1013
+ `, { policyAndTermsCollection: o } = await p.graphqlQuery(s, {
1014
+ ...r
1015
+ }), a = o.items.at(0);
1016
+ if (!a)
1017
+ throw new y();
1018
+ return a;
967
1019
  };
968
1020
  export {
969
- d as ContentfulSDK,
1021
+ p as ContentfulSDK,
970
1022
  $ as PaginatedResponse,
971
1023
  q as getBannerCollections,
972
1024
  D as getBlogCategories,
@@ -976,9 +1028,10 @@ export {
976
1028
  S as getBlogPosts,
977
1029
  j as getBrandCollections,
978
1030
  O as getDocArticleDetail,
979
- _ as getDocArticles,
980
- I as getDocCategories,
981
- R as getDocCategoryDetail,
982
- P as getHyperlinkCollections,
983
- V as getKeywordCollections
1031
+ I as getDocArticles,
1032
+ R as getDocCategories,
1033
+ _ as getDocCategoryDetail,
1034
+ T as getHyperlinkCollections,
1035
+ V as getKeywordCollections,
1036
+ P as getPolicyAndTerms
984
1037
  };
@@ -15,7 +15,6 @@ export type TypeBanner<Modifiers extends ChainModifiers, Locales extends LocaleC
15
15
  export interface TypeBannerCollectionFields {
16
16
  name: EntryFieldTypes.Symbol;
17
17
  banners?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeBannerSkeleton>>;
18
- market?: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
19
18
  locale?: EntryFieldTypes.Symbol;
20
19
  platform: EntryFieldTypes.Array<EntryFieldTypes.Symbol<"MOBILE" | "WEB">>;
21
20
  slot: EntryFieldTypes.Symbol;
@@ -146,13 +145,20 @@ export type TypeMarket<Modifiers extends ChainModifiers, Locales extends LocaleC
146
145
  export interface TypeNoticeFields {
147
146
  title: EntryFieldTypes.Symbol;
148
147
  content: EntryFieldTypes.RichText;
149
- market?: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
150
148
  locale?: EntryFieldTypes.Symbol;
151
- variant?: EntryFieldTypes.Array<EntryFieldTypes.Symbol<"Featured" | "Promotion" | "Urgent">>;
149
+ variant?: EntryFieldTypes.Array<EntryFieldTypes.Symbol<"featured" | "promotion" | "urgent">>;
152
150
  markets?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeMarketSkeleton>>;
153
151
  }
154
152
  export type TypeNoticeSkeleton = EntrySkeletonType<TypeNoticeFields, "notice">;
155
153
  export type TypeNotice<Modifiers extends ChainModifiers, Locales extends LocaleCode = LocaleCode> = Entry<TypeNoticeSkeleton, Modifiers, Locales>;
154
+ export interface TypePolicyAndTermsFields {
155
+ title: EntryFieldTypes.Symbol;
156
+ content?: EntryFieldTypes.RichText;
157
+ locale?: EntryFieldTypes.Symbol;
158
+ markets?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<TypeMarketSkeleton>>;
159
+ }
160
+ export type TypePolicyAndTermsSkeleton = EntrySkeletonType<TypePolicyAndTermsFields, "policyAndTerms">;
161
+ export type TypePolicyAndTerms<Modifiers extends ChainModifiers, Locales extends LocaleCode = LocaleCode> = Entry<TypePolicyAndTermsSkeleton, Modifiers, Locales>;
156
162
  export interface TypeSeoFields {
157
163
  metaTitle: EntryFieldTypes.Symbol;
158
164
  metaDescription?: EntryFieldTypes.Text;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/contentful-marketplace-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",