@janbox/contentful-marketplace-sdk 4.0.0-alpha.0 → 4.0.0-alpha.2

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
@@ -191,6 +191,50 @@ const articleById = await getDocArticleDetail({
191
191
  });
192
192
  ```
193
193
 
194
+ ### Help Center
195
+
196
+ - `getHelpCategories(options?)`
197
+ - `getHelpCategoryDetail({ id } | { slug })`
198
+ - `getHelpArticles(options?)`
199
+ - `getHelpArticleDetail({ id } | { slug })`
200
+
201
+ ```ts
202
+ // Categories are flat: build the tree from parentId (null = top level).
203
+ const categories = await getHelpCategories({ locale: "vi", size: 1000 });
204
+
205
+ // One category, same shape as a list item.
206
+ const category = await getHelpCategoryDetail({
207
+ slug: "thanh-toan",
208
+ locale: "vi",
209
+ });
210
+
211
+ // Article summaries (no body). Filter by category or featured flag.
212
+ const articles = await getHelpArticles({ locale: "vi", size: 1000 });
213
+ const featured = await getHelpArticles({ locale: "vi", featured: true });
214
+ const subcategory = categories.items.find((c) => c.parentId !== null);
215
+ const inCategory = await getHelpArticles({
216
+ locale: "vi",
217
+ categoryId: subcategory?.sys.id,
218
+ });
219
+
220
+ const article = await getHelpArticleDetail({
221
+ slug: "bao-lau-hang-ve-viet-nam",
222
+ locale: "vi",
223
+ });
224
+ // article.body: { json, links: { assets: { block } } } | null
225
+ ```
226
+
227
+ Notes:
228
+
229
+ - Results are ordered by `position`.
230
+ - To load a whole locale, pass `size: 1000` (the maximum the CMS accepts) and check `totalPages`. A larger `size` is rejected with `CmsError` `InvalidQuery`.
231
+ - `path` is the path stored on the CMS for the entry.
232
+ - An article slug is unique within a locale only, so pass `locale` when looking an article up by slug.
233
+ - A category slug is not always unique, even within a locale: a subcategory can share its parent's slug. `getHelpCategoryDetail({ slug })` then returns the category that comes first by `position`; use `id` to get a specific one.
234
+ - Every item has `locale` (`null` when the entry has none), so an article fetched by `id`, or a list fetched without `locale`, still tells which language it belongs to.
235
+ - `categoryId` is `null` for an article with no category.
236
+ - The `categoryId` filter matches an article's own category only, not its subcategories. To list a whole branch, load all articles once and group them by `categoryId` along the tree.
237
+
194
238
  ### Brand / Hyperlink / Keyword Collections
195
239
 
196
240
  - `getBrandCollections(options?)`
@@ -239,7 +283,7 @@ Filters `marketCode` / `locale` with global fallback (entries where `markets` /
239
283
 
240
284
  Every error from the CMS is a `CmsError` of `@janbox/headless-cms-sdk` (`id`, `status`, `requestId`, `details`, `url`). The SDK README lists the `id` values.
241
285
 
242
- - The detail functions (`getBlogPostDetail`, `getBlogCategoryDetail`, `getDocCategoryDetail`, `getDocArticleDetail`), `getPolicyAndTerms` and `getBlogPosts({ collectionId })` throw a `CmsError` with `id: "NotFound"`, `status: 404` and `message: "Entry not found"` when no entry matches.
286
+ - The detail functions (`getBlogPostDetail`, `getBlogCategoryDetail`, `getDocCategoryDetail`, `getDocArticleDetail`, `getHelpCategoryDetail`, `getHelpArticleDetail`), `getPolicyAndTerms` and `getBlogPosts({ collectionId })` throw a `CmsError` with `id: "NotFound"`, `status: 404` and `message: "Entry not found"` when no entry matches.
243
287
  - The detail functions throw `Error("Either id or slug is required.")` if neither `id` nor `slug` is provided.
244
288
  - Calling a function before `configure` throws `Error("Client is not configured")`.
245
289
 
@@ -275,6 +319,7 @@ The package exports:
275
319
  - client and entry functions from `src/client` and `src/entries`
276
320
  - content model field types (`TypeXxxFields`) from `src/types`
277
321
  - response item types such as `BlogPostGraphQLItem` and `DocArticleGraphQLItem` (names kept from 2.x)
322
+ - help center item types `HelpCategoryItem`, `HelpArticleItem`, `HelpArticleDetailItem`, and `RichText` (the shape of rich text fields such as `body`)
278
323
 
279
324
  CMS data, query, config and error types (`Entry`, `Asset`, `Link`, `RawEntryCollection`, `EntriesQuery`, `ClientConfig`, `CmsClient`, `CmsError`) come from `@janbox/headless-cms-sdk`; this package does not re-export them.
280
325
 
@@ -0,0 +1,56 @@
1
+ import { PaginatedResponse } from '../utils';
2
+ import { RichText } from '../utils/resolve';
3
+ type HelpEntrySys = {
4
+ id: string;
5
+ createdAt: string;
6
+ updatedAt: string;
7
+ };
8
+ export type HelpCategoryItem = {
9
+ sys: HelpEntrySys;
10
+ title: string | null;
11
+ slug: string | null;
12
+ path: string | null;
13
+ locale: string | null;
14
+ position: number | null;
15
+ parentId: string | null;
16
+ };
17
+ export type HelpArticleItem = {
18
+ sys: HelpEntrySys;
19
+ title: string | null;
20
+ slug: string | null;
21
+ path: string | null;
22
+ locale: string | null;
23
+ position: number | null;
24
+ featured: boolean;
25
+ categoryId: string | null;
26
+ };
27
+ export type GetHelpCategoriesResponse = PaginatedResponse<HelpCategoryItem>;
28
+ export type GetHelpCategoryDetailResponse = HelpCategoryItem;
29
+ export type GetHelpArticlesResponse = PaginatedResponse<HelpArticleItem>;
30
+ export interface HelpArticleDetailItem extends HelpArticleItem {
31
+ body: RichText | null;
32
+ }
33
+ export type GetHelpArticleDetailResponse = HelpArticleDetailItem;
34
+ export declare const getHelpCategories: ({ locale, page, size, }?: {
35
+ locale?: string;
36
+ page?: number;
37
+ size?: number;
38
+ }) => Promise<GetHelpCategoriesResponse>;
39
+ export declare const getHelpCategoryDetail: ({ id, slug, locale, }: {
40
+ id?: string;
41
+ slug?: string;
42
+ locale?: string;
43
+ }) => Promise<GetHelpCategoryDetailResponse>;
44
+ export declare const getHelpArticles: ({ locale, categoryId, featured, page, size, }?: {
45
+ locale?: string;
46
+ categoryId?: string;
47
+ featured?: boolean;
48
+ page?: number;
49
+ size?: number;
50
+ }) => Promise<GetHelpArticlesResponse>;
51
+ export declare const getHelpArticleDetail: ({ id, slug, locale, }: {
52
+ id?: string;
53
+ slug?: string;
54
+ locale?: string;
55
+ }) => Promise<GetHelpArticleDetailResponse>;
56
+ export {};
@@ -4,6 +4,7 @@ export * from './blog-category';
4
4
  export * from './blog-collection';
5
5
  export * from './brand-collection';
6
6
  export * from './documentation';
7
+ export * from './help-center';
7
8
  export * from './hyperlink-collection';
8
9
  export * from './hyperlink';
9
10
  export * from './keyword-collection';
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("@janbox/headless-cms-sdk"),U=["baseUrl","accessToken","headers","fetch","timeout","retry"];class d{static _config;static _client;static get config(){if(!this._config)throw new Error("Client is not configured");return this._config}static get client(){const t=this.config,i=this._client;if(i&&U.every(s=>i.builtFrom[s]===t[s]))return i.client;const l=A.createClient(t);return this._client={client:l,builtFrom:{...t}},l}static configure(t){this._config=t}}class h{page;total;size;items;totalPages;constructor({page:t,total:i,size:l,items:s}){this.page=t,this.total=i,this.size=l,this.items=s,this.totalPages=Math.ceil(this.total/this.size)}}const m="-sys.updatedAt",g=e=>e?A.or("market",[{"fields.markets[exists]":"false"},{"fields.markets.sys.contentType.sys.id":"market","fields.markets.fields.code":e}]):{},p=e=>e?A.or("locale",[{"fields.locale[exists]":"false"},{"fields.locale":e}]):{},v=({id:e,slug:t})=>{if(e)return{"sys.id":e,limit:1};if(t)return{"fields.slug":t,limit:1};throw new Error("Either id or slug is required.")},w=(e,t,i=0)=>{const l=Math.max(1,Math.floor(e)),s=Math.max(1,Math.floor(t)),n=Math.max(0,Math.floor(i));return{page:l,size:s,params:{limit:s,skip:(l-1)*s+n}}},f=e=>{const t=new Map,i=new Map;for(const s of[...e.items,...e.includes?.Entry??[]])t.set(s.sys.id,s);for(const s of e.includes?.Asset??[])i.set(s.sys.id,s);const l=s=>(s&&t.get(s.sys.id))??null;return{entry:l,asset:s=>(s&&i.get(s.sys.id))??null,entries:s=>(s??[]).map(n=>l(n)).filter(n=>n!==null)}},o=e=>e??null,k=e=>{const t=e?.fields.file;return t?{url:t.url,width:t.details.image?.width??null,height:t.details.image?.height??null,contentType:t.contentType}:null},q=e=>({sys:{id:e.sys.id},url:e.fields.file?.url,width:e.fields.file?.details.image?.width??null,height:e.fields.file?.details.image?.height??null,contentType:e.fields.file?.contentType,title:o(e.fields.title),description:o(e.fields.description)}),S=(e,t)=>{if(!e||typeof e!="object")return t;const i=e;if(i.nodeType==="embedded-asset-block"){const l=i.data?.target?.sys?.id;l&&!t.includes(l)&&t.push(l)}for(const l of i.content??[])S(l,t);return t},T=(e,t)=>{if(!e)return null;const i=S(e,[]).map(l=>t.asset({sys:{type:"Link",linkType:"Asset",id:l}})).filter(l=>l!==null&&!!l.fields.file).map(q);return{json:e,links:{assets:{block:i}}}},z=e=>e?{metaTitle:o(e.fields.metaTitle),metaDescription:o(e.fields.metaDescription),metaKeywords:o(e.fields.metaKeywords),metaRobots:o(e.fields.metaRobots)}:null,b=e=>e?{sys:{id:e.sys.id},label:o(e.fields.label),url:o(e.fields.url),target:o(e.fields.target),marketHandling:o(e.fields.marketHandling)}:null,R=(e,t)=>e?{name:o(e.fields.name),avatar:k(t.asset(e.fields.avatar))}:null,G=async({slot:e,page:t=1,size:i=20,platform:l,marketCode:s,locale:n})=>{const c=w(t,i),a=await d.client.getEntries({content_type:"bannerCollection","fields.slot":e,"fields.platform":l||void 0,select:"sys.id,fields.name,fields.slot,fields.platform,fields.banners",include:2,order:m,...c.params,...g(s),...p(n)},{resolveLinks:!1}),r=f(a);return new h({page:c.page,total:a.total,size:c.size,items:a.items.map(u=>({sys:{id:u.sys.id},name:o(u.fields.name),slot:o(u.fields.slot),platform:o(u.fields.platform),bannersCollection:{items:r.entries(u.fields.banners).map(C=>({sys:{id:C.sys.id},name:o(C.fields.name),hyperlink:b(r.entry(C.fields.hyperlink)),media:k(r.asset(C.fields.media))}))}}))})},E=()=>new A.CmsError({id:"NotFound",message:"Entry not found",url:`${d.config.baseUrl.trim().replace(/\/+$/,"")}/entries`,status:404}),I="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage",L=(e,t)=>({sys:{id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt},title:o(e.fields.title),shortDescription:o(e.fields.shortDescription),slug:o(e.fields.slug),categoriesCollection:{items:t.entries(e.fields.categories).map(i=>({sys:{id:i.sys.id},title:o(i.fields.title),slug:o(i.fields.slug),featuredImage:k(t.asset(i.fields.featuredImage))}))},featuredImage:k(t.asset(e.fields.featuredImage))}),Y=async({marketCode:e,locale:t,collectionId:i,categoryId:l,page:s=1,size:n=20,skip:c=0}={})=>{const a=w(s,n,c);if(i){const B=(await d.client.getEntries({content_type:"blogCollection","sys.id":i,select:"sys.id,fields.posts",include:0,limit:1},{resolveLinks:!1})).items.at(0);if(!B)throw E();const _=(B.fields.posts??[]).filter(y=>y.sys.linkType==="Entry").map(y=>y.sys.id),D=_.slice(a.params.skip,a.params.skip+a.size);if(!D.length)return new h({page:a.page,total:_.length,size:a.size,items:[]});const P=await d.client.getEntries({content_type:"blogPost","sys.id[in]":D.join(","),select:I,include:2,limit:a.size},{resolveLinks:!1}),j=f(P),N=new Map(P.items.map(y=>[y.sys.id,y]));return new h({page:a.page,total:_.length,size:a.size,items:D.map(y=>N.get(y)).filter(y=>y!==void 0).map(y=>L(y,j))})}const r=await d.client.getEntries({content_type:"blogPost","fields.categories.sys.id":l||void 0,select:I,include:2,order:m,...a.params,...g(e),...p(t)},{resolveLinks:!1}),u=f(r);return new h({page:a.page,total:r.total,size:a.size,items:r.items.map(C=>L(C,u))})},J=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=v({id:e,slug:t}),n=await d.client.getEntries({content_type:"blogPost",...s,select:`${I},fields.author,fields.content,fields.seo`,include:2,order:m,...g(i),...p(l)},{resolveLinks:!1}),c=n.items.at(0);if(!c)throw E();const a=f(n);return{...L(c,a),author:R(a.entry(c.fields.author),a),content:T(c.fields.content,a),seo:z(a.entry(c.fields.seo))}},M="sys.id,fields.title,fields.slug,fields.featuredImage",F=(e,t)=>({sys:{id:e.sys.id},title:o(e.fields.title),slug:o(e.fields.slug),featuredImage:k(t.asset(e.fields.featuredImage))}),Q=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),n=await d.client.getEntries({content_type:"blogCategory",select:M,include:1,order:m,...s.params,...g(e),...p(t)},{resolveLinks:!1}),c=f(n);return new h({page:s.page,total:n.total,size:s.size,items:n.items.map(a=>F(a,c))})},V=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=v({id:e,slug:t}),n=await d.client.getEntries({content_type:"blogCategory",...s,select:`${M},fields.description,fields.seo`,include:1,order:m,...g(i),...p(l)},{resolveLinks:!1}),c=n.items.at(0);if(!c)throw E();const a=f(n);return{...F(c,a),description:o(c.fields.description),seo:z(a.entry(c.fields.seo))}},W=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),n=await d.client.getEntries({content_type:"blogCollection",select:"sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",include:1,order:m,...s.params,...g(e),...p(t)},{resolveLinks:!1}),c=f(n),a=n.items.map(r=>{const u=c.entry(r.fields.category);return{name:o(r.fields.name),type:o(r.fields.type),order:o(r.fields.order),sys:{id:r.sys.id},category:u?{sys:{id:u.sys.id},title:o(u.fields.title),slug:o(u.fields.slug)}:null,featuredImage:k(c.asset(r.fields.featuredImage))}});return new h({page:s.page,total:n.total,size:s.size,items:a.map(r=>({...r,category:r.type==="category"?r.category:null,categoryId:r.type==="category"?r.category?.sys.id??null:null,collectionId:r.type==="manual"?r.sys.id:null}))})},X=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),n=await d.client.getEntries({content_type:"brandCollection",select:"sys.id,fields.name,fields.slot,fields.brands",include:2,order:m,...s.params,...g(i),...p(l)},{resolveLinks:!1}),c=f(n);return new h({page:s.page,total:n.total,size:s.size,items:n.items.map(a=>({sys:{id:a.sys.id},name:o(a.fields.name),slot:o(a.fields.slot),brandsCollection:{items:c.entries(a.fields.brands).map(r=>({sys:{id:r.sys.id},name:o(r.fields.name),logo:k(c.asset(r.fields.logo)),hyperlink:b(c.entry(r.fields.hyperlink))}))}}))})},x="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo",O="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category",K=e=>({id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt}),H=(e,t)=>({sys:K(e),title:o(e.fields.title),slug:o(e.fields.slug),description:o(e.fields.description),order:o(e.fields.order),seo:z(t.entry(e.fields.seo))}),$=(e,t)=>{const i=t.entry(e.fields.category);return{sys:K(e),title:o(e.fields.title),slug:o(e.fields.slug),author:R(t.entry(e.fields.author),t),category:i?{title:o(i.fields.title),slug:o(i.fields.slug),description:o(i.fields.description),order:o(i.fields.order)}:null}},Z=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=w(i,l),n=await d.client.getEntries({content_type:"documentationCategory",select:x,include:1,order:m,...s.params,...g(e),...p(t)},{resolveLinks:!1}),c=f(n);return new h({page:s.page,total:n.total,size:s.size,items:n.items.map(a=>H(a,c))})},ee=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=v({id:e,slug:t}),n=await d.client.getEntries({content_type:"documentationCategory",...s,select:x,include:1,order:m,...g(i),...p(l)},{resolveLinks:!1}),c=n.items.at(0);if(!c)throw E();return H(c,f(n))},te=async({marketCode:e,locale:t,categorySlug:i,page:l=1,size:s=20}={})=>{const n=w(l,s),c=await d.client.getEntries({content_type:"documentationArticle",...i?{"fields.category.sys.contentType.sys.id":"documentationCategory","fields.category.fields.slug":i}:{},select:O,include:2,order:m,...n.params,...g(e),...p(t)},{resolveLinks:!1}),a=f(c);return new h({page:n.page,total:c.total,size:n.size,items:c.items.map(r=>$(r,a))})},se=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=v({id:e,slug:t}),n=await d.client.getEntries({content_type:"documentationArticle",...s,select:`${O},fields.content,fields.seo`,include:2,order:m,...g(i),...p(l)},{resolveLinks:!1}),c=n.items.at(0);if(!c)throw E();const a=f(n);return{...$(c,a),content:T(c.fields.content,a),seo:z(a.entry(c.fields.seo))}},ie=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),n=await d.client.getEntries({content_type:"hyperlinkCollection",select:"sys.id,fields.name,fields.slot,fields.order,fields.links",include:1,order:"fields.order",...s.params,...g(i),...p(l)},{resolveLinks:!1}),c=f(n);return new h({page:s.page,total:n.total,size:s.size,items:n.items.map(a=>({sys:{id:a.sys.id},name:o(a.fields.name),slot:o(a.fields.slot),order:o(a.fields.order),linksCollection:{items:c.entries(a.fields.links).map(r=>b(r))}}))})},le=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=w(e,t),n=await d.client.getEntries({content_type:"keywordCollection",select:"sys.id,fields.name,fields.slot,fields.keywords",include:0,order:m,...s.params,...g(i),...p(l)},{resolveLinks:!1});return new h({page:s.page,total:n.total,size:s.size,items:n.items.map(c=>({sys:{id:c.sys.id},name:o(c.fields.name),slot:o(c.fields.slot),keywords:o(c.fields.keywords)}))})},oe=async({marketCode:e,locale:t}={})=>{const i=await d.client.getEntries({content_type:"policyAndTerms",select:"sys.id,fields.title,fields.locale,fields.content",include:1,order:m,limit:1,...g(e),...p(t)},{resolveLinks:!1}),l=i.items.at(0);if(!l)throw E();return{sys:{id:l.sys.id},title:o(l.fields.title),locale:o(l.fields.locale),content:T(l.fields.content,f(i))}};exports.ContentfulSDK=d;exports.PaginatedResponse=h;exports.getBannerCollections=G;exports.getBlogCategories=Q;exports.getBlogCategoryDetail=V;exports.getBlogCollections=W;exports.getBlogPostDetail=J;exports.getBlogPosts=Y;exports.getBrandCollections=X;exports.getDocArticleDetail=se;exports.getDocArticles=te;exports.getDocCategories=Z;exports.getDocCategoryDetail=ee;exports.getHyperlinkCollections=ie;exports.getKeywordCollections=le;exports.getPolicyAndTerms=oe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("@janbox/headless-cms-sdk"),X=["baseUrl","accessToken","headers","fetch","timeout","retry"];class r{static _config;static _client;static get config(){if(!this._config)throw new Error("Client is not configured");return this._config}static get client(){const t=this.config,i=this._client;if(i&&X.every(s=>i.builtFrom[s]===t[s]))return i.client;const l=_.createClient(t);return this._client={client:l,builtFrom:{...t}},l}static configure(t){this._config=t}}class p{page;total;size;items;totalPages;constructor({page:t,total:i,size:l,items:s}){this.page=t,this.total=i,this.size=l,this.items=s,this.totalPages=Math.ceil(this.total/this.size)}}const m="-sys.updatedAt",u=e=>e?_.or("market",[{"fields.markets[exists]":"false"},{"fields.markets.sys.contentType.sys.id":"market","fields.markets.fields.code":e}]):{},f=e=>e?_.or("locale",[{"fields.locale[exists]":"false"},{"fields.locale":e}]):{},A=({id:e,slug:t})=>{if(e)return{"sys.id":e,limit:1};if(t)return{"fields.slug":t,limit:1};throw new Error("Either id or slug is required.")},C=(e,t,i=0)=>{const l=Math.max(1,Math.floor(e)),s=Math.max(1,Math.floor(t)),o=Math.max(0,Math.floor(i));return{page:l,size:s,params:{limit:s,skip:(l-1)*s+o}}},g=e=>{const t=new Map,i=new Map;for(const s of[...e.items,...e.includes?.Entry??[]])t.set(s.sys.id,s);for(const s of e.includes?.Asset??[])i.set(s.sys.id,s);const l=s=>(s&&t.get(s.sys.id))??null;return{entry:l,asset:s=>(s&&i.get(s.sys.id))??null,entries:s=>(s??[]).map(o=>l(o)).filter(o=>o!==null)}},n=e=>e??null,k=e=>{const t=e?.fields.file;return t?{url:t.url,width:t.details.image?.width??null,height:t.details.image?.height??null,contentType:t.contentType}:null},Z=e=>({sys:{id:e.sys.id},url:e.fields.file?.url,width:e.fields.file?.details.image?.width??null,height:e.fields.file?.details.image?.height??null,contentType:e.fields.file?.contentType,title:n(e.fields.title),description:n(e.fields.description)}),R=(e,t)=>{if(!e||typeof e!="object")return t;const i=e;if(i.nodeType==="embedded-asset-block"){const l=i.data?.target?.sys?.id;l&&!t.includes(l)&&t.push(l)}for(const l of i.content??[])R(l,t);return t},L=(e,t)=>{if(!e)return null;const i=R(e,[]).map(l=>t.asset({sys:{type:"Link",linkType:"Asset",id:l}})).filter(l=>l!==null&&!!l.fields.file).map(Z);return{json:e,links:{assets:{block:i}}}},T=e=>e?{metaTitle:n(e.fields.metaTitle),metaDescription:n(e.fields.metaDescription),metaKeywords:n(e.fields.metaKeywords),metaRobots:n(e.fields.metaRobots)}:null,P=e=>e?{sys:{id:e.sys.id},label:n(e.fields.label),url:n(e.fields.url),target:n(e.fields.target),marketHandling:n(e.fields.marketHandling)}:null,S=(e,t)=>e?{name:n(e.fields.name),avatar:k(t.asset(e.fields.avatar))}:null,ee=async({slot:e,page:t=1,size:i=20,platform:l,marketCode:s,locale:o})=>{const a=C(t,i),c=await r.client.getEntries({content_type:"bannerCollection","fields.slot":e,"fields.platform":l||void 0,select:"sys.id,fields.name,fields.slot,fields.platform,fields.banners",include:2,order:m,...a.params,...u(s),...f(o)},{resolveLinks:!1}),d=g(c);return new p({page:a.page,total:c.total,size:a.size,items:c.items.map(y=>({sys:{id:y.sys.id},name:n(y.fields.name),slot:n(y.fields.slot),platform:n(y.fields.platform),bannersCollection:{items:d.entries(y.fields.banners).map(w=>({sys:{id:w.sys.id},name:n(w.fields.name),hyperlink:P(d.entry(w.fields.hyperlink)),media:k(d.asset(w.fields.media))}))}}))})},E=()=>new _.CmsError({id:"NotFound",message:"Entry not found",url:`${r.config.baseUrl.trim().replace(/\/+$/,"")}/entries`,status:404}),I="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage",b=(e,t)=>({sys:{id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt},title:n(e.fields.title),shortDescription:n(e.fields.shortDescription),slug:n(e.fields.slug),categoriesCollection:{items:t.entries(e.fields.categories).map(i=>({sys:{id:i.sys.id},title:n(i.fields.title),slug:n(i.fields.slug),featuredImage:k(t.asset(i.fields.featuredImage))}))},featuredImage:k(t.asset(e.fields.featuredImage))}),te=async({marketCode:e,locale:t,collectionId:i,categoryId:l,page:s=1,size:o=20,skip:a=0}={})=>{const c=C(s,o,a);if(i){const H=(await r.client.getEntries({content_type:"blogCollection","sys.id":i,select:"sys.id,fields.posts",include:0,limit:1},{resolveLinks:!1})).items.at(0);if(!H)throw E();const z=(H.fields.posts??[]).filter(h=>h.sys.linkType==="Entry").map(h=>h.sys.id),D=z.slice(c.params.skip,c.params.skip+c.size);if(!D.length)return new p({page:c.page,total:z.length,size:c.size,items:[]});const B=await r.client.getEntries({content_type:"blogPost","sys.id[in]":D.join(","),select:I,include:2,limit:c.size},{resolveLinks:!1}),V=g(B),W=new Map(B.items.map(h=>[h.sys.id,h]));return new p({page:c.page,total:z.length,size:c.size,items:D.map(h=>W.get(h)).filter(h=>h!==void 0).map(h=>b(h,V))})}const d=await r.client.getEntries({content_type:"blogPost","fields.categories.sys.id":l||void 0,select:I,include:2,order:m,...c.params,...u(e),...f(t)},{resolveLinks:!1}),y=g(d);return new p({page:c.page,total:d.total,size:c.size,items:d.items.map(w=>b(w,y))})},se=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=A({id:e,slug:t}),o=await r.client.getEntries({content_type:"blogPost",...s,select:`${I},fields.author,fields.content,fields.seo`,include:2,order:m,...u(i),...f(l)},{resolveLinks:!1}),a=o.items.at(0);if(!a)throw E();const c=g(o);return{...b(a,c),author:S(c.entry(a.fields.author),c),content:L(a.fields.content,c),seo:T(c.entry(a.fields.seo))}},O="sys.id,fields.title,fields.slug,fields.featuredImage",M=(e,t)=>({sys:{id:e.sys.id},title:n(e.fields.title),slug:n(e.fields.slug),featuredImage:k(t.asset(e.fields.featuredImage))}),ie=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=C(i,l),o=await r.client.getEntries({content_type:"blogCategory",select:O,include:1,order:m,...s.params,...u(e),...f(t)},{resolveLinks:!1}),a=g(o);return new p({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>M(c,a))})},le=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=A({id:e,slug:t}),o=await r.client.getEntries({content_type:"blogCategory",...s,select:`${O},fields.description,fields.seo`,include:1,order:m,...u(i),...f(l)},{resolveLinks:!1}),a=o.items.at(0);if(!a)throw E();const c=g(o);return{...M(a,c),description:n(a.fields.description),seo:T(c.entry(a.fields.seo))}},oe=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=C(i,l),o=await r.client.getEntries({content_type:"blogCollection",select:"sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",include:1,order:m,...s.params,...u(e),...f(t)},{resolveLinks:!1}),a=g(o),c=o.items.map(d=>{const y=a.entry(d.fields.category);return{name:n(d.fields.name),type:n(d.fields.type),order:n(d.fields.order),sys:{id:d.sys.id},category:y?{sys:{id:y.sys.id},title:n(y.fields.title),slug:n(y.fields.slug)}:null,featuredImage:k(a.asset(d.fields.featuredImage))}});return new p({page:s.page,total:o.total,size:s.size,items:c.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}))})},ne=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=C(e,t),o=await r.client.getEntries({content_type:"brandCollection",select:"sys.id,fields.name,fields.slot,fields.brands",include:2,order:m,...s.params,...u(i),...f(l)},{resolveLinks:!1}),a=g(o);return new p({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>({sys:{id:c.sys.id},name:n(c.fields.name),slot:n(c.fields.slot),brandsCollection:{items:a.entries(c.fields.brands).map(d=>({sys:{id:d.sys.id},name:n(d.fields.name),logo:k(a.asset(d.fields.logo)),hyperlink:P(a.entry(d.fields.hyperlink))}))}}))})},F="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo",x="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category",N=e=>({id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt}),$=(e,t)=>({sys:N(e),title:n(e.fields.title),slug:n(e.fields.slug),description:n(e.fields.description),order:n(e.fields.order),seo:T(t.entry(e.fields.seo))}),K=(e,t)=>{const i=t.entry(e.fields.category);return{sys:N(e),title:n(e.fields.title),slug:n(e.fields.slug),author:S(t.entry(e.fields.author),t),category:i?{title:n(i.fields.title),slug:n(i.fields.slug),description:n(i.fields.description),order:n(i.fields.order)}:null}},ae=async({marketCode:e,locale:t,page:i=1,size:l=20}={})=>{const s=C(i,l),o=await r.client.getEntries({content_type:"documentationCategory",select:F,include:1,order:m,...s.params,...u(e),...f(t)},{resolveLinks:!1}),a=g(o);return new p({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>$(c,a))})},ce=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=A({id:e,slug:t}),o=await r.client.getEntries({content_type:"documentationCategory",...s,select:F,include:1,order:m,...u(i),...f(l)},{resolveLinks:!1}),a=o.items.at(0);if(!a)throw E();return $(a,g(o))},de=async({marketCode:e,locale:t,categorySlug:i,page:l=1,size:s=20}={})=>{const o=C(l,s),a=await r.client.getEntries({content_type:"documentationArticle",...i?{"fields.category.sys.contentType.sys.id":"documentationCategory","fields.category.fields.slug":i}:{},select:x,include:2,order:m,...o.params,...u(e),...f(t)},{resolveLinks:!1}),c=g(a);return new p({page:o.page,total:a.total,size:o.size,items:a.items.map(d=>K(d,c))})},re=async({id:e,slug:t,marketCode:i,locale:l})=>{const s=A({id:e,slug:t}),o=await r.client.getEntries({content_type:"documentationArticle",...s,select:`${x},fields.content,fields.seo`,include:2,order:m,...u(i),...f(l)},{resolveLinks:!1}),a=o.items.at(0);if(!a)throw E();const c=g(o);return{...K(a,c),content:L(a.fields.content,c),seo:T(c.entry(a.fields.seo))}},Y="crispHelpCategory",j="crispHelpArticle",v="fields.position,sys.id",G="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.path,fields.locale,fields.position,fields.parent",U="sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.path,fields.locale,fields.position,fields.featured,fields.category",q=e=>({id:e.sys.id,createdAt:e.sys.createdAt,updatedAt:e.sys.updatedAt}),J=e=>({sys:q(e),title:n(e.fields.title),slug:n(e.fields.slug),path:n(e.fields.path),locale:n(e.fields.locale),position:n(e.fields.position),parentId:e.fields.parent?.sys.id??null}),Q=e=>({sys:q(e),title:n(e.fields.title),slug:n(e.fields.slug),path:n(e.fields.path),locale:n(e.fields.locale),position:n(e.fields.position),featured:e.fields.featured===!0,categoryId:e.fields.category?.sys.id??null}),fe=async({locale:e,page:t=1,size:i=20}={})=>{const l=C(t,i),s=await r.client.getEntries({content_type:Y,select:G,include:0,order:v,...l.params,...f(e)},{resolveLinks:!1});return new p({page:l.page,total:s.total,size:l.size,items:s.items.map(J)})},ge=async({id:e,slug:t,locale:i})=>{const l=A({id:e,slug:t}),o=(await r.client.getEntries({content_type:Y,...l,select:G,include:0,order:v,...f(i)},{resolveLinks:!1})).items.at(0);if(!o)throw E();return J(o)},pe=async({locale:e,categoryId:t,featured:i,page:l=1,size:s=20}={})=>{const o=C(l,s),a=await r.client.getEntries({content_type:j,...t?{"fields.category.sys.id":t}:{},...i!==void 0?{"fields.featured":i}:{},select:U,include:0,order:v,...o.params,...f(e)},{resolveLinks:!1});return new p({page:o.page,total:a.total,size:o.size,items:a.items.map(Q)})},ue=async({id:e,slug:t,locale:i})=>{const l=A({id:e,slug:t}),s=await r.client.getEntries({content_type:j,...l,select:`${U},fields.body`,include:1,order:v,...f(i)},{resolveLinks:!1}),o=s.items.at(0);if(!o)throw E();return{...Q(o),body:L(o.fields.body,g(s))}},me=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=C(e,t),o=await r.client.getEntries({content_type:"hyperlinkCollection",select:"sys.id,fields.name,fields.slot,fields.order,fields.links",include:1,order:"fields.order",...s.params,...u(i),...f(l)},{resolveLinks:!1}),a=g(o);return new p({page:s.page,total:o.total,size:s.size,items:o.items.map(c=>({sys:{id:c.sys.id},name:n(c.fields.name),slot:n(c.fields.slot),order:n(c.fields.order),linksCollection:{items:a.entries(c.fields.links).map(d=>P(d))}}))})},ye=async({page:e=1,size:t=20,marketCode:i,locale:l}={})=>{const s=C(e,t),o=await r.client.getEntries({content_type:"keywordCollection",select:"sys.id,fields.name,fields.slot,fields.keywords",include:0,order:m,...s.params,...u(i),...f(l)},{resolveLinks:!1});return new p({page:s.page,total:o.total,size:s.size,items:o.items.map(a=>({sys:{id:a.sys.id},name:n(a.fields.name),slot:n(a.fields.slot),keywords:n(a.fields.keywords)}))})},he=async({marketCode:e,locale:t}={})=>{const i=await r.client.getEntries({content_type:"policyAndTerms",select:"sys.id,fields.title,fields.locale,fields.content",include:1,order:m,limit:1,...u(e),...f(t)},{resolveLinks:!1}),l=i.items.at(0);if(!l)throw E();return{sys:{id:l.sys.id},title:n(l.fields.title),locale:n(l.fields.locale),content:L(l.fields.content,g(i))}};exports.ContentfulSDK=r;exports.PaginatedResponse=p;exports.getBannerCollections=ee;exports.getBlogCategories=ie;exports.getBlogCategoryDetail=le;exports.getBlogCollections=oe;exports.getBlogPostDetail=se;exports.getBlogPosts=te;exports.getBrandCollections=ne;exports.getDocArticleDetail=re;exports.getDocArticles=de;exports.getDocCategories=ae;exports.getDocCategoryDetail=ce;exports.getHelpArticleDetail=ue;exports.getHelpArticles=pe;exports.getHelpCategories=fe;exports.getHelpCategoryDetail=ge;exports.getHyperlinkCollections=me;exports.getKeywordCollections=ye;exports.getPolicyAndTerms=he;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { createClient as U, or as P, CmsError as G } from "@janbox/headless-cms-sdk";
2
- const q = [
1
+ import { createClient as X, or as H, CmsError as Z } from "@janbox/headless-cms-sdk";
2
+ const ee = [
3
3
  "baseUrl",
4
4
  "accessToken",
5
5
  "headers",
@@ -17,16 +17,16 @@ class r {
17
17
  }
18
18
  static get client() {
19
19
  const s = this.config, i = this._client;
20
- if (i && q.every((t) => i.builtFrom[t] === s[t]))
20
+ if (i && ee.every((t) => i.builtFrom[t] === s[t]))
21
21
  return i.client;
22
- const l = U(s);
22
+ const l = X(s);
23
23
  return this._client = { client: l, builtFrom: { ...s } }, l;
24
24
  }
25
25
  static configure(s) {
26
26
  this._config = s;
27
27
  }
28
28
  }
29
- class h {
29
+ class u {
30
30
  page;
31
31
  total;
32
32
  size;
@@ -41,16 +41,16 @@ class h {
41
41
  this.page = s, this.total = i, this.size = l, this.items = t, this.totalPages = Math.ceil(this.total / this.size);
42
42
  }
43
43
  }
44
- const m = "-sys.updatedAt", g = (e) => e ? P("market", [
44
+ const m = "-sys.updatedAt", p = (e) => e ? H("market", [
45
45
  { "fields.markets[exists]": "false" },
46
46
  {
47
47
  "fields.markets.sys.contentType.sys.id": "market",
48
48
  "fields.markets.fields.code": e
49
49
  }
50
- ]) : {}, p = (e) => e ? P("locale", [
50
+ ]) : {}, f = (e) => e ? H("locale", [
51
51
  { "fields.locale[exists]": "false" },
52
52
  { "fields.locale": e }
53
- ]) : {}, z = ({
53
+ ]) : {}, A = ({
54
54
  id: e,
55
55
  slug: s
56
56
  }) => {
@@ -59,17 +59,17 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
59
59
  if (s)
60
60
  return { "fields.slug": s, limit: 1 };
61
61
  throw new Error("Either id or slug is required.");
62
- }, w = (e, s, i = 0) => {
63
- const l = Math.max(1, Math.floor(e)), t = Math.max(1, Math.floor(s)), n = Math.max(0, Math.floor(i));
62
+ }, E = (e, s, i = 0) => {
63
+ const l = Math.max(1, Math.floor(e)), t = Math.max(1, Math.floor(s)), o = Math.max(0, Math.floor(i));
64
64
  return {
65
65
  page: l,
66
66
  size: t,
67
67
  params: {
68
68
  limit: t,
69
- skip: (l - 1) * t + n
69
+ skip: (l - 1) * t + o
70
70
  }
71
71
  };
72
- }, f = (e) => {
72
+ }, g = (e) => {
73
73
  const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
74
74
  for (const t of [...e.items, ...e.includes?.Entry ?? []])
75
75
  s.set(t.sys.id, t);
@@ -79,9 +79,9 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
79
79
  return {
80
80
  entry: l,
81
81
  asset: (t) => (t && i.get(t.sys.id)) ?? null,
82
- entries: (t) => (t ?? []).map((n) => l(n)).filter((n) => n !== null)
82
+ entries: (t) => (t ?? []).map((o) => l(o)).filter((o) => o !== null)
83
83
  };
84
- }, o = (e) => e ?? null, E = (e) => {
84
+ }, n = (e) => e ?? null, C = (e) => {
85
85
  const s = e?.fields.file;
86
86
  return s ? {
87
87
  url: s.url,
@@ -89,15 +89,15 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
89
89
  height: s.details.image?.height ?? null,
90
90
  contentType: s.contentType
91
91
  } : null;
92
- }, Y = (e) => ({
92
+ }, se = (e) => ({
93
93
  sys: { id: e.sys.id },
94
94
  url: e.fields.file?.url,
95
95
  width: e.fields.file?.details.image?.width ?? null,
96
96
  height: e.fields.file?.details.image?.height ?? null,
97
97
  contentType: e.fields.file?.contentType,
98
- title: o(e.fields.title),
99
- description: o(e.fields.description)
100
- }), R = (e, s) => {
98
+ title: n(e.fields.title),
99
+ description: n(e.fields.description)
100
+ }), B = (e, s) => {
101
101
  if (!e || typeof e != "object")
102
102
  return s;
103
103
  const i = e;
@@ -106,36 +106,36 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
106
106
  l && !s.includes(l) && s.push(l);
107
107
  }
108
108
  for (const l of i.content ?? [])
109
- R(l, s);
109
+ B(l, s);
110
110
  return s;
111
- }, T = (e, s) => {
111
+ }, _ = (e, s) => {
112
112
  if (!e)
113
113
  return null;
114
- const i = R(e, []).map((l) => s.asset({ sys: { type: "Link", linkType: "Asset", id: l } })).filter((l) => l !== null && !!l.fields.file).map(Y);
114
+ const i = B(e, []).map((l) => s.asset({ sys: { type: "Link", linkType: "Asset", id: l } })).filter((l) => l !== null && !!l.fields.file).map(se);
115
115
  return { json: e, links: { assets: { block: i } } };
116
- }, _ = (e) => e ? {
117
- metaTitle: o(e.fields.metaTitle),
118
- metaDescription: o(e.fields.metaDescription),
119
- metaKeywords: o(e.fields.metaKeywords),
120
- metaRobots: o(e.fields.metaRobots)
121
- } : null, b = (e) => e ? {
116
+ }, L = (e) => e ? {
117
+ metaTitle: n(e.fields.metaTitle),
118
+ metaDescription: n(e.fields.metaDescription),
119
+ metaKeywords: n(e.fields.metaKeywords),
120
+ metaRobots: n(e.fields.metaRobots)
121
+ } : null, D = (e) => e ? {
122
122
  sys: { id: e.sys.id },
123
- label: o(e.fields.label),
124
- url: o(e.fields.url),
125
- target: o(e.fields.target),
126
- marketHandling: o(e.fields.marketHandling)
123
+ label: n(e.fields.label),
124
+ url: n(e.fields.url),
125
+ target: n(e.fields.target),
126
+ marketHandling: n(e.fields.marketHandling)
127
127
  } : null, S = (e, s) => e ? {
128
- name: o(e.fields.name),
129
- avatar: E(s.asset(e.fields.avatar))
130
- } : null, Q = async ({
128
+ name: n(e.fields.name),
129
+ avatar: C(s.asset(e.fields.avatar))
130
+ } : null, ie = async ({
131
131
  slot: e,
132
132
  page: s = 1,
133
133
  size: i = 20,
134
134
  platform: l,
135
135
  marketCode: t,
136
- locale: n
136
+ locale: o
137
137
  }) => {
138
- const c = w(s, i), a = await r.client.getEntries(
138
+ const a = E(s, i), c = await r.client.getEntries(
139
139
  {
140
140
  content_type: "bannerCollection",
141
141
  "fields.slot": e,
@@ -143,70 +143,70 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
143
143
  select: "sys.id,fields.name,fields.slot,fields.platform,fields.banners",
144
144
  include: 2,
145
145
  order: m,
146
- ...c.params,
147
- ...g(t),
148
- ...p(n)
146
+ ...a.params,
147
+ ...p(t),
148
+ ...f(o)
149
149
  },
150
150
  { resolveLinks: !1 }
151
- ), d = f(a);
152
- return new h({
153
- page: c.page,
154
- total: a.total,
155
- size: c.size,
156
- items: a.items.map(
157
- (u) => ({
158
- sys: { id: u.sys.id },
159
- name: o(u.fields.name),
160
- slot: o(u.fields.slot),
161
- platform: o(u.fields.platform),
151
+ ), d = g(c);
152
+ return new u({
153
+ page: a.page,
154
+ total: c.total,
155
+ size: a.size,
156
+ items: c.items.map(
157
+ (y) => ({
158
+ sys: { id: y.sys.id },
159
+ name: n(y.fields.name),
160
+ slot: n(y.fields.slot),
161
+ platform: n(y.fields.platform),
162
162
  bannersCollection: {
163
- items: d.entries(u.fields.banners).map((k) => ({
163
+ items: d.entries(y.fields.banners).map((k) => ({
164
164
  sys: { id: k.sys.id },
165
- name: o(k.fields.name),
166
- hyperlink: b(
165
+ name: n(k.fields.name),
166
+ hyperlink: D(
167
167
  d.entry(k.fields.hyperlink)
168
168
  ),
169
- media: E(d.asset(k.fields.media))
169
+ media: C(d.asset(k.fields.media))
170
170
  }))
171
171
  }
172
172
  })
173
173
  )
174
174
  });
175
- }, C = () => new G({
175
+ }, w = () => new Z({
176
176
  id: "NotFound",
177
177
  message: "Entry not found",
178
178
  url: `${r.config.baseUrl.trim().replace(/\/+$/, "")}/entries`,
179
179
  status: 404
180
- }), I = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage", L = (e, s) => ({
180
+ }), I = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.shortDescription,fields.slug,fields.categories,fields.featuredImage", b = (e, s) => ({
181
181
  sys: {
182
182
  id: e.sys.id,
183
183
  createdAt: e.sys.createdAt,
184
184
  updatedAt: e.sys.updatedAt
185
185
  },
186
- title: o(e.fields.title),
187
- shortDescription: o(e.fields.shortDescription),
188
- slug: o(e.fields.slug),
186
+ title: n(e.fields.title),
187
+ shortDescription: n(e.fields.shortDescription),
188
+ slug: n(e.fields.slug),
189
189
  categoriesCollection: {
190
190
  items: s.entries(e.fields.categories).map((i) => ({
191
191
  sys: { id: i.sys.id },
192
- title: o(i.fields.title),
193
- slug: o(i.fields.slug),
194
- featuredImage: E(s.asset(i.fields.featuredImage))
192
+ title: n(i.fields.title),
193
+ slug: n(i.fields.slug),
194
+ featuredImage: C(s.asset(i.fields.featuredImage))
195
195
  }))
196
196
  },
197
- featuredImage: E(s.asset(e.fields.featuredImage))
198
- }), V = async ({
197
+ featuredImage: C(s.asset(e.fields.featuredImage))
198
+ }), le = async ({
199
199
  marketCode: e,
200
200
  locale: s,
201
201
  collectionId: i,
202
202
  categoryId: l,
203
203
  page: t = 1,
204
- size: n = 20,
205
- skip: c = 0
204
+ size: o = 20,
205
+ skip: a = 0
206
206
  } = {}) => {
207
- const a = w(t, n, c);
207
+ const c = E(t, o, a);
208
208
  if (i) {
209
- const D = (await r.client.getEntries(
209
+ const P = (await r.client.getEntries(
210
210
  {
211
211
  content_type: "blogCollection",
212
212
  "sys.id": i,
@@ -216,31 +216,31 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
216
216
  },
217
217
  { resolveLinks: !1 }
218
218
  )).items.at(0);
219
- if (!D)
220
- throw C();
221
- const v = (D.fields.posts ?? []).filter((y) => y.sys.linkType === "Entry").map((y) => y.sys.id), A = v.slice(a.params.skip, a.params.skip + a.size);
222
- if (!A.length)
223
- return new h({
224
- page: a.page,
219
+ if (!P)
220
+ throw w();
221
+ const v = (P.fields.posts ?? []).filter((h) => h.sys.linkType === "Entry").map((h) => h.sys.id), z = v.slice(c.params.skip, c.params.skip + c.size);
222
+ if (!z.length)
223
+ return new u({
224
+ page: c.page,
225
225
  total: v.length,
226
- size: a.size,
226
+ size: c.size,
227
227
  items: []
228
228
  });
229
- const B = await r.client.getEntries(
229
+ const R = await r.client.getEntries(
230
230
  {
231
231
  content_type: "blogPost",
232
- "sys.id[in]": A.join(","),
232
+ "sys.id[in]": z.join(","),
233
233
  select: I,
234
234
  include: 2,
235
- limit: a.size
235
+ limit: c.size
236
236
  },
237
237
  { resolveLinks: !1 }
238
- ), N = f(B), j = new Map(B.items.map((y) => [y.sys.id, y]));
239
- return new h({
240
- page: a.page,
238
+ ), V = g(R), W = new Map(R.items.map((h) => [h.sys.id, h]));
239
+ return new u({
240
+ page: c.page,
241
241
  total: v.length,
242
- size: a.size,
243
- items: A.map((y) => j.get(y)).filter((y) => y !== void 0).map((y) => L(y, N))
242
+ size: c.size,
243
+ items: z.map((h) => W.get(h)).filter((h) => h !== void 0).map((h) => b(h, V))
244
244
  });
245
245
  }
246
246
  const d = await r.client.getEntries(
@@ -250,374 +250,484 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
250
250
  select: I,
251
251
  include: 2,
252
252
  order: m,
253
- ...a.params,
254
- ...g(e),
255
- ...p(s)
253
+ ...c.params,
254
+ ...p(e),
255
+ ...f(s)
256
256
  },
257
257
  { resolveLinks: !1 }
258
- ), u = f(d);
259
- return new h({
260
- page: a.page,
258
+ ), y = g(d);
259
+ return new u({
260
+ page: c.page,
261
261
  total: d.total,
262
- size: a.size,
263
- items: d.items.map((k) => L(k, u))
262
+ size: c.size,
263
+ items: d.items.map((k) => b(k, y))
264
264
  });
265
- }, W = async ({
265
+ }, oe = async ({
266
266
  id: e,
267
267
  slug: s,
268
268
  marketCode: i,
269
269
  locale: l
270
270
  }) => {
271
- const t = z({ id: e, slug: s }), n = await r.client.getEntries(
271
+ const t = A({ id: e, slug: s }), o = await r.client.getEntries(
272
272
  {
273
273
  content_type: "blogPost",
274
274
  ...t,
275
275
  select: `${I},fields.author,fields.content,fields.seo`,
276
276
  include: 2,
277
277
  order: m,
278
- ...g(i),
279
- ...p(l)
278
+ ...p(i),
279
+ ...f(l)
280
280
  },
281
281
  { resolveLinks: !1 }
282
- ), c = n.items.at(0);
283
- if (!c)
284
- throw C();
285
- const a = f(n);
282
+ ), a = o.items.at(0);
283
+ if (!a)
284
+ throw w();
285
+ const c = g(o);
286
286
  return {
287
- ...L(c, a),
288
- author: S(a.entry(c.fields.author), a),
289
- content: T(c.fields.content, a),
290
- seo: _(a.entry(c.fields.seo))
287
+ ...b(a, c),
288
+ author: S(c.entry(a.fields.author), c),
289
+ content: _(a.fields.content, c),
290
+ seo: L(c.entry(a.fields.seo))
291
291
  };
292
- }, M = "sys.id,fields.title,fields.slug,fields.featuredImage", x = (e, s) => ({
292
+ }, O = "sys.id,fields.title,fields.slug,fields.featuredImage", M = (e, s) => ({
293
293
  sys: { id: e.sys.id },
294
- title: o(e.fields.title),
295
- slug: o(e.fields.slug),
296
- featuredImage: E(s.asset(e.fields.featuredImage))
297
- }), X = async ({
294
+ title: n(e.fields.title),
295
+ slug: n(e.fields.slug),
296
+ featuredImage: C(s.asset(e.fields.featuredImage))
297
+ }), ne = async ({
298
298
  marketCode: e,
299
299
  locale: s,
300
300
  page: i = 1,
301
301
  size: l = 20
302
302
  } = {}) => {
303
- const t = w(i, l), n = await r.client.getEntries(
303
+ const t = E(i, l), o = await r.client.getEntries(
304
304
  {
305
305
  content_type: "blogCategory",
306
- select: M,
306
+ select: O,
307
307
  include: 1,
308
308
  order: m,
309
309
  ...t.params,
310
- ...g(e),
311
- ...p(s)
310
+ ...p(e),
311
+ ...f(s)
312
312
  },
313
313
  { resolveLinks: !1 }
314
- ), c = f(n);
315
- return new h({
314
+ ), a = g(o);
315
+ return new u({
316
316
  page: t.page,
317
- total: n.total,
317
+ total: o.total,
318
318
  size: t.size,
319
- items: n.items.map((a) => x(a, c))
319
+ items: o.items.map((c) => M(c, a))
320
320
  });
321
- }, Z = async ({
321
+ }, ae = async ({
322
322
  id: e,
323
323
  slug: s,
324
324
  marketCode: i,
325
325
  locale: l
326
326
  }) => {
327
- const t = z({ id: e, slug: s }), n = await r.client.getEntries(
327
+ const t = A({ id: e, slug: s }), o = await r.client.getEntries(
328
328
  {
329
329
  content_type: "blogCategory",
330
330
  ...t,
331
- select: `${M},fields.description,fields.seo`,
331
+ select: `${O},fields.description,fields.seo`,
332
332
  include: 1,
333
333
  order: m,
334
- ...g(i),
335
- ...p(l)
334
+ ...p(i),
335
+ ...f(l)
336
336
  },
337
337
  { resolveLinks: !1 }
338
- ), c = n.items.at(0);
339
- if (!c)
340
- throw C();
341
- const a = f(n);
338
+ ), a = o.items.at(0);
339
+ if (!a)
340
+ throw w();
341
+ const c = g(o);
342
342
  return {
343
- ...x(c, a),
344
- description: o(c.fields.description),
345
- seo: _(a.entry(c.fields.seo))
343
+ ...M(a, c),
344
+ description: n(a.fields.description),
345
+ seo: L(c.entry(a.fields.seo))
346
346
  };
347
- }, ee = async ({
347
+ }, ce = async ({
348
348
  marketCode: e,
349
349
  locale: s,
350
350
  page: i = 1,
351
351
  size: l = 20
352
352
  } = {}) => {
353
- const t = w(i, l), n = await r.client.getEntries(
353
+ const t = E(i, l), o = await r.client.getEntries(
354
354
  {
355
355
  content_type: "blogCollection",
356
356
  select: "sys.id,fields.name,fields.type,fields.order,fields.category,fields.featuredImage",
357
357
  include: 1,
358
358
  order: m,
359
359
  ...t.params,
360
- ...g(e),
361
- ...p(s)
360
+ ...p(e),
361
+ ...f(s)
362
362
  },
363
363
  { resolveLinks: !1 }
364
- ), c = f(n), a = n.items.map((d) => {
365
- const u = c.entry(d.fields.category);
364
+ ), a = g(o), c = o.items.map((d) => {
365
+ const y = a.entry(d.fields.category);
366
366
  return {
367
- name: o(d.fields.name),
368
- type: o(d.fields.type),
369
- order: o(d.fields.order),
367
+ name: n(d.fields.name),
368
+ type: n(d.fields.type),
369
+ order: n(d.fields.order),
370
370
  sys: { id: d.sys.id },
371
- category: u ? {
372
- sys: { id: u.sys.id },
373
- title: o(u.fields.title),
374
- slug: o(u.fields.slug)
371
+ category: y ? {
372
+ sys: { id: y.sys.id },
373
+ title: n(y.fields.title),
374
+ slug: n(y.fields.slug)
375
375
  } : null,
376
- featuredImage: E(c.asset(d.fields.featuredImage))
376
+ featuredImage: C(a.asset(d.fields.featuredImage))
377
377
  };
378
378
  });
379
- return new h({
379
+ return new u({
380
380
  page: t.page,
381
- total: n.total,
381
+ total: o.total,
382
382
  size: t.size,
383
- items: a.map((d) => ({
383
+ items: c.map((d) => ({
384
384
  ...d,
385
385
  category: d.type === "category" ? d.category : null,
386
386
  categoryId: d.type === "category" ? d.category?.sys.id ?? null : null,
387
387
  collectionId: d.type === "manual" ? d.sys.id : null
388
388
  }))
389
389
  });
390
- }, se = async ({
390
+ }, de = async ({
391
391
  page: e = 1,
392
392
  size: s = 20,
393
393
  marketCode: i,
394
394
  locale: l
395
395
  } = {}) => {
396
- const t = w(e, s), n = await r.client.getEntries(
396
+ const t = E(e, s), o = await r.client.getEntries(
397
397
  {
398
398
  content_type: "brandCollection",
399
399
  select: "sys.id,fields.name,fields.slot,fields.brands",
400
400
  include: 2,
401
401
  order: m,
402
402
  ...t.params,
403
- ...g(i),
404
- ...p(l)
403
+ ...p(i),
404
+ ...f(l)
405
405
  },
406
406
  { resolveLinks: !1 }
407
- ), c = f(n);
408
- return new h({
407
+ ), a = g(o);
408
+ return new u({
409
409
  page: t.page,
410
- total: n.total,
410
+ total: o.total,
411
411
  size: t.size,
412
- items: n.items.map(
413
- (a) => ({
414
- sys: { id: a.sys.id },
415
- name: o(a.fields.name),
416
- slot: o(a.fields.slot),
412
+ items: o.items.map(
413
+ (c) => ({
414
+ sys: { id: c.sys.id },
415
+ name: n(c.fields.name),
416
+ slot: n(c.fields.slot),
417
417
  brandsCollection: {
418
- items: c.entries(a.fields.brands).map((d) => ({
418
+ items: a.entries(c.fields.brands).map((d) => ({
419
419
  sys: { id: d.sys.id },
420
- name: o(d.fields.name),
421
- logo: E(c.asset(d.fields.logo)),
422
- hyperlink: b(
423
- c.entry(d.fields.hyperlink)
420
+ name: n(d.fields.name),
421
+ logo: C(a.asset(d.fields.logo)),
422
+ hyperlink: D(
423
+ a.entry(d.fields.hyperlink)
424
424
  )
425
425
  }))
426
426
  }
427
427
  })
428
428
  )
429
429
  });
430
- }, F = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo", O = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category", $ = (e) => ({
430
+ }, x = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.description,fields.order,fields.seo", F = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.author,fields.category", N = (e) => ({
431
431
  id: e.sys.id,
432
432
  createdAt: e.sys.createdAt,
433
433
  updatedAt: e.sys.updatedAt
434
- }), H = (e, s) => ({
435
- sys: $(e),
436
- title: o(e.fields.title),
437
- slug: o(e.fields.slug),
438
- description: o(e.fields.description),
439
- order: o(e.fields.order),
440
- seo: _(s.entry(e.fields.seo))
441
- }), K = (e, s) => {
434
+ }), $ = (e, s) => ({
435
+ sys: N(e),
436
+ title: n(e.fields.title),
437
+ slug: n(e.fields.slug),
438
+ description: n(e.fields.description),
439
+ order: n(e.fields.order),
440
+ seo: L(s.entry(e.fields.seo))
441
+ }), Y = (e, s) => {
442
442
  const i = s.entry(e.fields.category);
443
443
  return {
444
- sys: $(e),
445
- title: o(e.fields.title),
446
- slug: o(e.fields.slug),
444
+ sys: N(e),
445
+ title: n(e.fields.title),
446
+ slug: n(e.fields.slug),
447
447
  author: S(s.entry(e.fields.author), s),
448
448
  category: i ? {
449
- title: o(i.fields.title),
450
- slug: o(i.fields.slug),
451
- description: o(i.fields.description),
452
- order: o(i.fields.order)
449
+ title: n(i.fields.title),
450
+ slug: n(i.fields.slug),
451
+ description: n(i.fields.description),
452
+ order: n(i.fields.order)
453
453
  } : null
454
454
  };
455
- }, te = async ({
455
+ }, re = async ({
456
456
  marketCode: e,
457
457
  locale: s,
458
458
  page: i = 1,
459
459
  size: l = 20
460
460
  } = {}) => {
461
- const t = w(i, l), n = await r.client.getEntries(
461
+ const t = E(i, l), o = await r.client.getEntries(
462
462
  {
463
463
  content_type: "documentationCategory",
464
- select: F,
464
+ select: x,
465
465
  include: 1,
466
466
  order: m,
467
467
  ...t.params,
468
- ...g(e),
469
- ...p(s)
468
+ ...p(e),
469
+ ...f(s)
470
470
  },
471
471
  { resolveLinks: !1 }
472
- ), c = f(n);
473
- return new h({
472
+ ), a = g(o);
473
+ return new u({
474
474
  page: t.page,
475
- total: n.total,
475
+ total: o.total,
476
476
  size: t.size,
477
- items: n.items.map((a) => H(a, c))
477
+ items: o.items.map((c) => $(c, a))
478
478
  });
479
- }, ie = async ({
479
+ }, fe = async ({
480
480
  id: e,
481
481
  slug: s,
482
482
  marketCode: i,
483
483
  locale: l
484
484
  }) => {
485
- const t = z({ id: e, slug: s }), n = await r.client.getEntries(
485
+ const t = A({ id: e, slug: s }), o = await r.client.getEntries(
486
486
  {
487
487
  content_type: "documentationCategory",
488
488
  ...t,
489
- select: F,
489
+ select: x,
490
490
  include: 1,
491
491
  order: m,
492
- ...g(i),
493
- ...p(l)
492
+ ...p(i),
493
+ ...f(l)
494
494
  },
495
495
  { resolveLinks: !1 }
496
- ), c = n.items.at(0);
497
- if (!c)
498
- throw C();
499
- return H(c, f(n));
500
- }, le = async ({
496
+ ), a = o.items.at(0);
497
+ if (!a)
498
+ throw w();
499
+ return $(a, g(o));
500
+ }, ge = async ({
501
501
  marketCode: e,
502
502
  locale: s,
503
503
  categorySlug: i,
504
504
  page: l = 1,
505
505
  size: t = 20
506
506
  } = {}) => {
507
- const n = w(l, t), c = await r.client.getEntries(
507
+ const o = E(l, t), a = await r.client.getEntries(
508
508
  {
509
509
  content_type: "documentationArticle",
510
510
  ...i ? {
511
511
  "fields.category.sys.contentType.sys.id": "documentationCategory",
512
512
  "fields.category.fields.slug": i
513
513
  } : {},
514
- select: O,
514
+ select: F,
515
515
  include: 2,
516
516
  order: m,
517
- ...n.params,
518
- ...g(e),
519
- ...p(s)
517
+ ...o.params,
518
+ ...p(e),
519
+ ...f(s)
520
520
  },
521
521
  { resolveLinks: !1 }
522
- ), a = f(c);
523
- return new h({
524
- page: n.page,
525
- total: c.total,
526
- size: n.size,
527
- items: c.items.map((d) => K(d, a))
522
+ ), c = g(a);
523
+ return new u({
524
+ page: o.page,
525
+ total: a.total,
526
+ size: o.size,
527
+ items: a.items.map((d) => Y(d, c))
528
528
  });
529
- }, oe = async ({
529
+ }, pe = async ({
530
530
  id: e,
531
531
  slug: s,
532
532
  marketCode: i,
533
533
  locale: l
534
534
  }) => {
535
- const t = z({ id: e, slug: s }), n = await r.client.getEntries(
535
+ const t = A({ id: e, slug: s }), o = await r.client.getEntries(
536
536
  {
537
537
  content_type: "documentationArticle",
538
538
  ...t,
539
- select: `${O},fields.content,fields.seo`,
539
+ select: `${F},fields.content,fields.seo`,
540
540
  include: 2,
541
541
  order: m,
542
- ...g(i),
543
- ...p(l)
542
+ ...p(i),
543
+ ...f(l)
544
+ },
545
+ { resolveLinks: !1 }
546
+ ), a = o.items.at(0);
547
+ if (!a)
548
+ throw w();
549
+ const c = g(o);
550
+ return {
551
+ ...Y(a, c),
552
+ content: _(a.fields.content, c),
553
+ seo: L(c.entry(a.fields.seo))
554
+ };
555
+ }, G = "crispHelpCategory", K = "crispHelpArticle", T = "fields.position,sys.id", j = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.path,fields.locale,fields.position,fields.parent", U = "sys.id,sys.createdAt,sys.updatedAt,fields.title,fields.slug,fields.path,fields.locale,fields.position,fields.featured,fields.category", q = (e) => ({
556
+ id: e.sys.id,
557
+ createdAt: e.sys.createdAt,
558
+ updatedAt: e.sys.updatedAt
559
+ }), J = (e) => ({
560
+ sys: q(e),
561
+ title: n(e.fields.title),
562
+ slug: n(e.fields.slug),
563
+ path: n(e.fields.path),
564
+ locale: n(e.fields.locale),
565
+ position: n(e.fields.position),
566
+ parentId: e.fields.parent?.sys.id ?? null
567
+ }), Q = (e) => ({
568
+ sys: q(e),
569
+ title: n(e.fields.title),
570
+ slug: n(e.fields.slug),
571
+ path: n(e.fields.path),
572
+ locale: n(e.fields.locale),
573
+ position: n(e.fields.position),
574
+ featured: e.fields.featured === !0,
575
+ categoryId: e.fields.category?.sys.id ?? null
576
+ }), ue = async ({
577
+ locale: e,
578
+ page: s = 1,
579
+ size: i = 20
580
+ } = {}) => {
581
+ const l = E(s, i), t = await r.client.getEntries(
582
+ {
583
+ content_type: G,
584
+ select: j,
585
+ include: 0,
586
+ order: T,
587
+ ...l.params,
588
+ ...f(e)
589
+ },
590
+ { resolveLinks: !1 }
591
+ );
592
+ return new u({
593
+ page: l.page,
594
+ total: t.total,
595
+ size: l.size,
596
+ items: t.items.map(J)
597
+ });
598
+ }, me = async ({
599
+ id: e,
600
+ slug: s,
601
+ locale: i
602
+ }) => {
603
+ const l = A({ id: e, slug: s }), o = (await r.client.getEntries(
604
+ {
605
+ content_type: G,
606
+ ...l,
607
+ select: j,
608
+ include: 0,
609
+ order: T,
610
+ ...f(i)
611
+ },
612
+ { resolveLinks: !1 }
613
+ )).items.at(0);
614
+ if (!o)
615
+ throw w();
616
+ return J(o);
617
+ }, ye = async ({
618
+ locale: e,
619
+ categoryId: s,
620
+ featured: i,
621
+ page: l = 1,
622
+ size: t = 20
623
+ } = {}) => {
624
+ const o = E(l, t), a = await r.client.getEntries(
625
+ {
626
+ content_type: K,
627
+ ...s ? { "fields.category.sys.id": s } : {},
628
+ ...i !== void 0 ? { "fields.featured": i } : {},
629
+ select: U,
630
+ include: 0,
631
+ order: T,
632
+ ...o.params,
633
+ ...f(e)
634
+ },
635
+ { resolveLinks: !1 }
636
+ );
637
+ return new u({
638
+ page: o.page,
639
+ total: a.total,
640
+ size: o.size,
641
+ items: a.items.map(Q)
642
+ });
643
+ }, he = async ({
644
+ id: e,
645
+ slug: s,
646
+ locale: i
647
+ }) => {
648
+ const l = A({ id: e, slug: s }), t = await r.client.getEntries(
649
+ {
650
+ content_type: K,
651
+ ...l,
652
+ select: `${U},fields.body`,
653
+ include: 1,
654
+ order: T,
655
+ ...f(i)
544
656
  },
545
657
  { resolveLinks: !1 }
546
- ), c = n.items.at(0);
547
- if (!c)
548
- throw C();
549
- const a = f(n);
658
+ ), o = t.items.at(0);
659
+ if (!o)
660
+ throw w();
550
661
  return {
551
- ...K(c, a),
552
- content: T(c.fields.content, a),
553
- seo: _(a.entry(c.fields.seo))
662
+ ...Q(o),
663
+ body: _(o.fields.body, g(t))
554
664
  };
555
- }, ne = async ({
665
+ }, Ee = async ({
556
666
  page: e = 1,
557
667
  size: s = 20,
558
668
  marketCode: i,
559
669
  locale: l
560
670
  } = {}) => {
561
- const t = w(e, s), n = await r.client.getEntries(
671
+ const t = E(e, s), o = await r.client.getEntries(
562
672
  {
563
673
  content_type: "hyperlinkCollection",
564
674
  select: "sys.id,fields.name,fields.slot,fields.order,fields.links",
565
675
  include: 1,
566
676
  order: "fields.order",
567
677
  ...t.params,
568
- ...g(i),
569
- ...p(l)
678
+ ...p(i),
679
+ ...f(l)
570
680
  },
571
681
  { resolveLinks: !1 }
572
- ), c = f(n);
573
- return new h({
682
+ ), a = g(o);
683
+ return new u({
574
684
  page: t.page,
575
- total: n.total,
685
+ total: o.total,
576
686
  size: t.size,
577
- items: n.items.map(
578
- (a) => ({
579
- sys: { id: a.sys.id },
580
- name: o(a.fields.name),
581
- slot: o(a.fields.slot),
582
- order: o(a.fields.order),
687
+ items: o.items.map(
688
+ (c) => ({
689
+ sys: { id: c.sys.id },
690
+ name: n(c.fields.name),
691
+ slot: n(c.fields.slot),
692
+ order: n(c.fields.order),
583
693
  linksCollection: {
584
- items: c.entries(a.fields.links).map((d) => b(d))
694
+ items: a.entries(c.fields.links).map((d) => D(d))
585
695
  }
586
696
  })
587
697
  )
588
698
  });
589
- }, ae = async ({
699
+ }, we = async ({
590
700
  page: e = 1,
591
701
  size: s = 20,
592
702
  marketCode: i,
593
703
  locale: l
594
704
  } = {}) => {
595
- const t = w(e, s), n = await r.client.getEntries(
705
+ const t = E(e, s), o = await r.client.getEntries(
596
706
  {
597
707
  content_type: "keywordCollection",
598
708
  select: "sys.id,fields.name,fields.slot,fields.keywords",
599
709
  include: 0,
600
710
  order: m,
601
711
  ...t.params,
602
- ...g(i),
603
- ...p(l)
712
+ ...p(i),
713
+ ...f(l)
604
714
  },
605
715
  { resolveLinks: !1 }
606
716
  );
607
- return new h({
717
+ return new u({
608
718
  page: t.page,
609
- total: n.total,
719
+ total: o.total,
610
720
  size: t.size,
611
- items: n.items.map(
612
- (c) => ({
613
- sys: { id: c.sys.id },
614
- name: o(c.fields.name),
615
- slot: o(c.fields.slot),
616
- keywords: o(c.fields.keywords)
721
+ items: o.items.map(
722
+ (a) => ({
723
+ sys: { id: a.sys.id },
724
+ name: n(a.fields.name),
725
+ slot: n(a.fields.slot),
726
+ keywords: n(a.fields.keywords)
617
727
  })
618
728
  )
619
729
  });
620
- }, ce = async ({
730
+ }, ke = async ({
621
731
  marketCode: e,
622
732
  locale: s
623
733
  } = {}) => {
@@ -628,35 +738,39 @@ const m = "-sys.updatedAt", g = (e) => e ? P("market", [
628
738
  include: 1,
629
739
  order: m,
630
740
  limit: 1,
631
- ...g(e),
632
- ...p(s)
741
+ ...p(e),
742
+ ...f(s)
633
743
  },
634
744
  { resolveLinks: !1 }
635
745
  ), l = i.items.at(0);
636
746
  if (!l)
637
- throw C();
747
+ throw w();
638
748
  return {
639
749
  sys: { id: l.sys.id },
640
- title: o(l.fields.title),
641
- locale: o(l.fields.locale),
642
- content: T(l.fields.content, f(i))
750
+ title: n(l.fields.title),
751
+ locale: n(l.fields.locale),
752
+ content: _(l.fields.content, g(i))
643
753
  };
644
754
  };
645
755
  export {
646
756
  r as ContentfulSDK,
647
- h as PaginatedResponse,
648
- Q as getBannerCollections,
649
- X as getBlogCategories,
650
- Z as getBlogCategoryDetail,
651
- ee as getBlogCollections,
652
- W as getBlogPostDetail,
653
- V as getBlogPosts,
654
- se as getBrandCollections,
655
- oe as getDocArticleDetail,
656
- le as getDocArticles,
657
- te as getDocCategories,
658
- ie as getDocCategoryDetail,
659
- ne as getHyperlinkCollections,
660
- ae as getKeywordCollections,
661
- ce as getPolicyAndTerms
757
+ u as PaginatedResponse,
758
+ ie as getBannerCollections,
759
+ ne as getBlogCategories,
760
+ ae as getBlogCategoryDetail,
761
+ ce as getBlogCollections,
762
+ oe as getBlogPostDetail,
763
+ le as getBlogPosts,
764
+ de as getBrandCollections,
765
+ pe as getDocArticleDetail,
766
+ ge as getDocArticles,
767
+ re as getDocCategories,
768
+ fe as getDocCategoryDetail,
769
+ he as getHelpArticleDetail,
770
+ ye as getHelpArticles,
771
+ ue as getHelpCategories,
772
+ me as getHelpCategoryDetail,
773
+ Ee as getHyperlinkCollections,
774
+ we as getKeywordCollections,
775
+ ke as getPolicyAndTerms
662
776
  };
@@ -82,6 +82,24 @@ export interface TypeDocumentationCategoryFields {
82
82
  seo?: Link<"Entry">;
83
83
  markets?: Link<"Entry">[];
84
84
  }
85
+ export interface TypeHelpArticleFields {
86
+ title: string;
87
+ slug: string;
88
+ path: string;
89
+ locale?: string;
90
+ position?: number;
91
+ featured?: boolean;
92
+ category?: Link<"Entry">;
93
+ body?: Document;
94
+ }
95
+ export interface TypeHelpCategoryFields {
96
+ title: string;
97
+ slug: string;
98
+ path: string;
99
+ locale?: string;
100
+ position?: number;
101
+ parent?: Link<"Entry">;
102
+ }
85
103
  export interface TypeHyperlinkFields {
86
104
  label: string;
87
105
  url: string;
@@ -11,3 +11,4 @@ export declare class PaginatedResponse<T> {
11
11
  items: T[];
12
12
  });
13
13
  }
14
+ export type { RichText } from './resolve';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janbox/contentful-marketplace-sdk",
3
- "version": "4.0.0-alpha.0",
3
+ "version": "4.0.0-alpha.2",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",