@janbox/contentful-marketplace-sdk 0.0.9 → 1.0.0
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 +127 -285
- package/dist/client/index.d.ts +1 -3
- package/dist/entries/banner-collection.d.ts +39 -0
- package/dist/entries/blog.d.ts +57 -11
- package/dist/entries/brand-collection.d.ts +26 -0
- package/dist/entries/documentation.d.ts +81 -27
- package/dist/entries/hyperlink-collection.d.ts +25 -0
- package/dist/entries/index.d.ts +4 -3
- package/dist/entries/keyword-collection.d.ts +20 -0
- package/dist/index.cjs +375 -20
- package/dist/index.js +1150 -184
- package/dist/types/index.d.ts +52 -48
- package/package.json +3 -3
- package/dist/entries/banner.d.ts +0 -8
- package/dist/entries/footer-content.d.ts +0 -21
- package/dist/entries/footer-menu.d.ts +0 -24
package/README.md
CHANGED
|
@@ -1,363 +1,205 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @janbox/contentful-marketplace-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for querying iChiba marketplace content from Contentful GraphQL.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- 🎯 **Selective queries**: Optimized queries with field selection
|
|
12
|
-
- ⚡ **Performance**: Built on top of the official Contentful SDK
|
|
7
|
+
- Typed API for marketplace content entries.
|
|
8
|
+
- Built-in market/language filtering in query builders.
|
|
9
|
+
- `find*` methods with 404 handling.
|
|
10
|
+
- Works in both ESM and CJS builds.
|
|
13
11
|
|
|
14
12
|
## Installation
|
|
15
13
|
|
|
14
|
+
`contentful` is a peer dependency and must be installed in your app.
|
|
15
|
+
|
|
16
16
|
```bash
|
|
17
|
-
#
|
|
18
|
-
|
|
17
|
+
# pnpm
|
|
18
|
+
pnpm add @janbox/contentful-marketplace-sdk contentful
|
|
19
19
|
|
|
20
|
-
#
|
|
21
|
-
|
|
20
|
+
# npm
|
|
21
|
+
npm install @janbox/contentful-marketplace-sdk contentful
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
23
|
+
# yarn
|
|
24
|
+
yarn add @janbox/contentful-marketplace-sdk contentful
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Quick Start
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
```ts
|
|
30
|
+
import {
|
|
31
|
+
ContentfulSDK,
|
|
32
|
+
listBannerCollectionEntries,
|
|
33
|
+
} 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
|
+
|
|
42
|
+
ContentfulSDK.configure(clientOptions);
|
|
43
|
+
|
|
44
|
+
const result = await listBannerCollectionEntries({
|
|
45
|
+
slot: "home_hero",
|
|
46
|
+
marketCode: "vn",
|
|
47
|
+
language: "en",
|
|
48
|
+
platform: "WEB",
|
|
49
|
+
limit: 10,
|
|
39
50
|
});
|
|
51
|
+
|
|
52
|
+
console.log(result.data);
|
|
40
53
|
```
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import {
|
|
46
|
-
listBannerEntries,
|
|
47
|
-
listBlogPostEntries,
|
|
48
|
-
findBlogPostEntry,
|
|
49
|
-
listDocCategoryEntries,
|
|
50
|
-
listDocArticleEntries
|
|
51
|
-
} from '@janbox/contentful-marketplace-sdk';
|
|
52
|
-
|
|
53
|
-
// Get banners for a specific market and language
|
|
54
|
-
const banners = await listBannerEntries({
|
|
55
|
-
marketId: 'vn',
|
|
56
|
-
language: 'vi',
|
|
57
|
-
query: {
|
|
58
|
-
'fields.platform[in]': 'WEB',
|
|
59
|
-
limit: 10
|
|
60
|
-
}
|
|
61
|
-
});
|
|
55
|
+
## Configuration
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
const blogPosts = await listBlogPostEntries({
|
|
65
|
-
marketId: 'vn',
|
|
66
|
-
language: 'vi',
|
|
67
|
-
query: {
|
|
68
|
-
order: '-sys.createdAt',
|
|
69
|
-
limit: 5
|
|
70
|
-
}
|
|
71
|
-
});
|
|
57
|
+
### `ContentfulSDK.configure(params)`
|
|
72
58
|
|
|
73
|
-
|
|
74
|
-
const blogPost = await findBlogPostEntry({
|
|
75
|
-
marketId: 'vn',
|
|
76
|
-
language: 'vi',
|
|
77
|
-
query: {
|
|
78
|
-
'fields.slug': 'how-to-shop-online'
|
|
79
|
-
}
|
|
80
|
-
});
|
|
59
|
+
Configure the SDK once before calling entry methods.
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
order: 'fields.order'
|
|
88
|
-
}
|
|
61
|
+
```ts
|
|
62
|
+
ContentfulSDK.configure({
|
|
63
|
+
space: "your-space-id",
|
|
64
|
+
accessToken: "your-delivery-access-token",
|
|
65
|
+
environment: "master",
|
|
89
66
|
});
|
|
90
67
|
```
|
|
91
68
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### 🎯 Banners
|
|
95
|
-
- **Type**: `banner`
|
|
96
|
-
- **Methods**: `listBannerEntries()`
|
|
97
|
-
- **Fields**: name, image, redirectUrl, market, language, platform
|
|
98
|
-
- **Platforms**: `MOBILE`, `WEB`
|
|
99
|
-
|
|
100
|
-
### 📝 Blog Posts
|
|
101
|
-
- **Type**: `blogPost`
|
|
102
|
-
- **Methods**: `listBlogPostEntries()`, `findBlogPostEntry()`
|
|
103
|
-
- **Fields**: title, slug, author, featuredImage, content, category, shortDescription, seo
|
|
104
|
-
- **Features**: Related posts, categories, SEO metadata
|
|
105
|
-
|
|
106
|
-
### 📚 Documentation
|
|
107
|
-
- **Types**: `documentationCategory`, `documentationArticle`
|
|
108
|
-
- **Methods**: `listDocCategoryEntries()`, `findDocCategoryEntry()`, `listDocArticleEntries()`, `findDocArticleEntry()`
|
|
109
|
-
- **Features**: Hierarchical categories, searchable articles, SVG icons
|
|
110
|
-
|
|
111
|
-
### 👤 Authors
|
|
112
|
-
- **Type**: `author`
|
|
113
|
-
- **Fields**: name, avatar
|
|
69
|
+
Notes:
|
|
114
70
|
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
71
|
+
- `environment` defaults to `"master"` if omitted.
|
|
72
|
+
- The SDK sends requests to `https://graphql.contentful.com/content/v1/...`.
|
|
73
|
+
- Runtime requires `fetch` (Node.js 18+ recommended).
|
|
118
74
|
|
|
119
|
-
|
|
120
|
-
- **Type**: `seo`
|
|
121
|
-
- **Fields**: metaTitle, metaDescription, metaKeywords, metaRobots
|
|
75
|
+
## API Methods
|
|
122
76
|
|
|
123
|
-
|
|
77
|
+
All methods return `{ data: ... }`.
|
|
124
78
|
|
|
125
|
-
###
|
|
79
|
+
### Banner Collection
|
|
126
80
|
|
|
127
|
-
|
|
81
|
+
- `listBannerCollectionEntries(options)`
|
|
128
82
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
host?: string, // Custom host (optional)
|
|
137
|
-
// ... other Contentful client options
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Banner Methods
|
|
142
|
-
|
|
143
|
-
#### `listBannerEntries(options)`
|
|
144
|
-
|
|
145
|
-
Retrieve multiple banner entries.
|
|
146
|
-
|
|
147
|
-
```typescript
|
|
148
|
-
const banners = await listBannerEntries({
|
|
149
|
-
marketId: 'vn',
|
|
150
|
-
language: 'vi',
|
|
151
|
-
query: {
|
|
152
|
-
'fields.platform[in]': 'WEB,MOBILE',
|
|
153
|
-
limit: 10,
|
|
154
|
-
order: '-sys.createdAt'
|
|
155
|
-
}
|
|
83
|
+
```ts
|
|
84
|
+
await listBannerCollectionEntries({
|
|
85
|
+
slot: "home_hero",
|
|
86
|
+
limit: 20,
|
|
87
|
+
platform: "WEB",
|
|
88
|
+
marketCode: "vn",
|
|
89
|
+
language: "en",
|
|
156
90
|
});
|
|
157
91
|
```
|
|
158
92
|
|
|
159
|
-
### Blog
|
|
160
|
-
|
|
161
|
-
#### `listBlogPostEntries(options)`
|
|
93
|
+
### Blog
|
|
162
94
|
|
|
163
|
-
|
|
95
|
+
- `listBlogPostEntries(options?)`
|
|
96
|
+
- `findBlogPostEntry(options)`
|
|
164
97
|
|
|
165
|
-
```
|
|
98
|
+
```ts
|
|
166
99
|
const posts = await listBlogPostEntries({
|
|
167
|
-
|
|
168
|
-
language:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
limit: 10,
|
|
172
|
-
skip: 0
|
|
173
|
-
}
|
|
100
|
+
marketCode: "vn",
|
|
101
|
+
language: "en",
|
|
102
|
+
limit: 10,
|
|
103
|
+
skip: 0,
|
|
174
104
|
});
|
|
175
|
-
```
|
|
176
105
|
|
|
177
|
-
#### `findBlogPostEntry(options)`
|
|
178
|
-
|
|
179
|
-
Retrieve a single blog post with full content.
|
|
180
|
-
|
|
181
|
-
```typescript
|
|
182
106
|
const post = await findBlogPostEntry({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
'fields.slug': 'my-blog-post'
|
|
187
|
-
}
|
|
107
|
+
slug: "how-to-shop-online",
|
|
108
|
+
marketCode: "vn",
|
|
109
|
+
language: "en",
|
|
188
110
|
});
|
|
189
111
|
```
|
|
190
112
|
|
|
191
|
-
### Documentation
|
|
192
|
-
|
|
193
|
-
#### `listDocCategoryEntries(options)`
|
|
113
|
+
### Documentation
|
|
194
114
|
|
|
195
|
-
|
|
115
|
+
- `listDocCategoryEntries(options?)`
|
|
116
|
+
- `findDocCategoryEntry(options)`
|
|
117
|
+
- `listDocArticleEntries(options?)`
|
|
118
|
+
- `findDocArticleEntry(options)`
|
|
196
119
|
|
|
197
|
-
```
|
|
120
|
+
```ts
|
|
198
121
|
const categories = await listDocCategoryEntries({
|
|
199
|
-
|
|
200
|
-
language:
|
|
201
|
-
|
|
202
|
-
order: 'fields.order'
|
|
203
|
-
}
|
|
122
|
+
marketCode: "vn",
|
|
123
|
+
language: "en",
|
|
124
|
+
limit: 10,
|
|
204
125
|
});
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
#### `findDocCategoryEntry(options)`
|
|
208
126
|
|
|
209
|
-
|
|
127
|
+
const articles = await listDocArticleEntries({
|
|
128
|
+
categorySlug: "getting-started",
|
|
129
|
+
marketCode: "vn",
|
|
130
|
+
language: "en",
|
|
131
|
+
limit: 10,
|
|
132
|
+
});
|
|
210
133
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
language:
|
|
215
|
-
query: {
|
|
216
|
-
'fields.slug': 'getting-started'
|
|
217
|
-
}
|
|
134
|
+
const article = await findDocArticleEntry({
|
|
135
|
+
slug: "payment-methods",
|
|
136
|
+
marketCode: "vn",
|
|
137
|
+
language: "en",
|
|
218
138
|
});
|
|
219
139
|
```
|
|
220
140
|
|
|
221
|
-
|
|
141
|
+
### Brand / Hyperlink / Keyword Collections
|
|
222
142
|
|
|
223
|
-
|
|
143
|
+
- `listBrandCollectionEntries(options?)`
|
|
144
|
+
- `listHyperlinkCollectionEntries(options?)`
|
|
145
|
+
- `listKeywordCollectionEntries(options?)`
|
|
224
146
|
|
|
225
|
-
```
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
language:
|
|
229
|
-
|
|
230
|
-
'fields.category.sys.id': 'category-id',
|
|
231
|
-
order: '-sys.updatedAt'
|
|
232
|
-
}
|
|
147
|
+
```ts
|
|
148
|
+
const brands = await listBrandCollectionEntries({
|
|
149
|
+
marketCode: "vn",
|
|
150
|
+
language: "en",
|
|
151
|
+
limit: 20,
|
|
233
152
|
});
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
#### `findDocArticleEntry(options)`
|
|
237
153
|
|
|
238
|
-
|
|
154
|
+
const links = await listHyperlinkCollectionEntries({
|
|
155
|
+
marketCode: "vn",
|
|
156
|
+
language: "en",
|
|
157
|
+
});
|
|
239
158
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
query: {
|
|
245
|
-
'fields.slug': 'payment-methods'
|
|
246
|
-
}
|
|
159
|
+
const keywords = await listKeywordCollectionEntries({
|
|
160
|
+
marketCode: "vn",
|
|
161
|
+
language: "en",
|
|
162
|
+
limit: 20,
|
|
247
163
|
});
|
|
248
164
|
```
|
|
249
165
|
|
|
250
166
|
## Error Handling
|
|
251
167
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
```typescript
|
|
255
|
-
import { NotFoundResponse } from '@janbox/contentful-marketplace-sdk';
|
|
168
|
+
`findBlogPostEntry`, `findDocCategoryEntry`, and `findDocArticleEntry` throw a `Response` with status `404` when not found.
|
|
256
169
|
|
|
170
|
+
```ts
|
|
257
171
|
try {
|
|
258
|
-
|
|
259
|
-
marketId: 'vn',
|
|
260
|
-
language: 'vi',
|
|
261
|
-
query: { 'fields.slug': 'non-existent-post' }
|
|
262
|
-
});
|
|
172
|
+
await findDocArticleEntry({ slug: "unknown-slug" });
|
|
263
173
|
} catch (error) {
|
|
264
|
-
if (error instanceof
|
|
265
|
-
console.log(
|
|
174
|
+
if (error instanceof Response && error.status === 404) {
|
|
175
|
+
console.log("Entry not found");
|
|
266
176
|
}
|
|
267
177
|
}
|
|
268
178
|
```
|
|
269
179
|
|
|
270
|
-
##
|
|
271
|
-
|
|
272
|
-
The SDK exports comprehensive TypeScript types for all content:
|
|
273
|
-
|
|
274
|
-
```typescript
|
|
275
|
-
import type {
|
|
276
|
-
// Entry Types
|
|
277
|
-
BannerEntry,
|
|
278
|
-
BlogPostEntry,
|
|
279
|
-
DocCategoryEntry,
|
|
280
|
-
DocArticleEntry,
|
|
281
|
-
|
|
282
|
-
// Skeleton Types
|
|
283
|
-
TypeBannerSkeleton,
|
|
284
|
-
TypeBlogPostSkeleton,
|
|
285
|
-
TypeDocumentationCategorySkeleton,
|
|
286
|
-
TypeDocumentationArticleSkeleton,
|
|
287
|
-
|
|
288
|
-
// Field Types
|
|
289
|
-
TypeBannerFields,
|
|
290
|
-
TypeBlogPostFields,
|
|
291
|
-
// ... and many more
|
|
292
|
-
} from '@janbox/contentful-marketplace-sdk';
|
|
293
|
-
```
|
|
180
|
+
## Market/Language Filtering Behavior
|
|
294
181
|
|
|
295
|
-
|
|
182
|
+
When `marketCode` or `language` is provided, queries include both:
|
|
296
183
|
|
|
297
|
-
|
|
184
|
+
- entries matching the given code
|
|
185
|
+
- entries where that field is not set
|
|
298
186
|
|
|
299
|
-
|
|
300
|
-
- `skip`: Number of entries to skip
|
|
301
|
-
- `order`: Sort order (e.g., '-sys.createdAt', 'fields.title')
|
|
302
|
-
- `fields.*`: Filter by field values
|
|
303
|
-
- `sys.*`: Filter by system properties
|
|
304
|
-
- `include`: Include linked entries (0-10)
|
|
305
|
-
- `select`: Choose specific fields to return
|
|
187
|
+
This supports global fallback content.
|
|
306
188
|
|
|
307
|
-
##
|
|
189
|
+
## Exported Types
|
|
308
190
|
|
|
309
|
-
|
|
191
|
+
The package exports:
|
|
310
192
|
|
|
311
|
-
-
|
|
312
|
-
-
|
|
193
|
+
- client and entry functions from `src/client` and `src/entries`
|
|
194
|
+
- Contentful schema types from `src/types`
|
|
195
|
+
- entry aliases such as `BlogPostEntry`, `DocArticleEntry`, and `DocCategoryEntry`
|
|
313
196
|
|
|
314
|
-
|
|
197
|
+
## Development
|
|
315
198
|
|
|
316
|
-
|
|
317
|
-
# Clone the repository
|
|
318
|
-
git clone https://github.com/your-org/ichiba-contentful-sdk.git
|
|
199
|
+
From repository root:
|
|
319
200
|
|
|
320
|
-
|
|
201
|
+
```bash
|
|
321
202
|
pnpm install
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
pnpm build:packages
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Project Structure
|
|
328
|
-
|
|
329
|
-
```
|
|
330
|
-
ichiba-contentful-sdk/
|
|
331
|
-
├── packages/
|
|
332
|
-
│ └── marketplace-sdk/
|
|
333
|
-
│ ├── src/
|
|
334
|
-
│ │ ├── client/ # SDK client configuration
|
|
335
|
-
│ │ ├── entries/ # Content type methods
|
|
336
|
-
│ │ ├── http-responses/ # Custom error responses
|
|
337
|
-
│ │ ├── types/ # TypeScript type definitions
|
|
338
|
-
│ │ └── index.ts # Main export file
|
|
339
|
-
│ ├── dist/ # Built files
|
|
340
|
-
│ └── package.json
|
|
341
|
-
├── examples/ # Usage examples
|
|
342
|
-
└── package.json
|
|
203
|
+
pnpm --filter @janbox/contentful-marketplace-sdk build
|
|
204
|
+
pnpm --filter @janbox/contentful-marketplace-sdk test
|
|
343
205
|
```
|
|
344
|
-
|
|
345
|
-
## Contributing
|
|
346
|
-
|
|
347
|
-
1. Fork the repository
|
|
348
|
-
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
349
|
-
3. Commit your changes: `git commit -m 'Add amazing feature'`
|
|
350
|
-
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
351
|
-
5. Open a Pull Request
|
|
352
|
-
|
|
353
|
-
## License
|
|
354
|
-
|
|
355
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
356
|
-
|
|
357
|
-
## Support
|
|
358
|
-
|
|
359
|
-
For questions and support, please contact the iChiba development team or create an issue in the repository.
|
|
360
|
-
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
**Built with ❤️ by the iChiba team**
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateClientParams } from 'contentful';
|
|
2
2
|
export declare class ContentfulSDK {
|
|
3
|
-
private static _client;
|
|
4
3
|
private static _clientParams;
|
|
5
4
|
static get clientParams(): CreateClientParams;
|
|
6
|
-
static get client(): ContentfulClientApi<undefined>;
|
|
7
5
|
static configure(params: CreateClientParams): void;
|
|
8
6
|
static graphqlQuery<T extends object>(query: string, variables?: Record<string, any>): Promise<T>;
|
|
9
7
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TypeBannerCollectionSkeleton } from '../types';
|
|
2
|
+
import { Entry, EntrySys } from 'contentful';
|
|
3
|
+
import { HyperlinkEntry } from './hyperlink';
|
|
4
|
+
type BannerCollectionEntry = Entry<TypeBannerCollectionSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
|
+
type GraphQLEntrySys = Pick<EntrySys, "id">;
|
|
6
|
+
type BannerCollectionGraphQLItem = {
|
|
7
|
+
sys: GraphQLEntrySys;
|
|
8
|
+
bannersCollection: {
|
|
9
|
+
items: Array<{
|
|
10
|
+
sys: GraphQLEntrySys;
|
|
11
|
+
hyperlink: ({
|
|
12
|
+
sys: GraphQLEntrySys;
|
|
13
|
+
} & Pick<HyperlinkEntry["fields"], "label" | "url" | "target" | "includesMarketCode">) | null;
|
|
14
|
+
media: {
|
|
15
|
+
url: string;
|
|
16
|
+
width: number | null;
|
|
17
|
+
height: number | null;
|
|
18
|
+
contentType: string;
|
|
19
|
+
};
|
|
20
|
+
name: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
} & Pick<BannerCollectionEntry["fields"], "name" | "slot" | "platform">;
|
|
24
|
+
type BannerCollectionGraphQLResponse = {
|
|
25
|
+
bannerCollectionCollection: {
|
|
26
|
+
items: Array<BannerCollectionGraphQLItem>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ListBannerCollectionEntriesResponse = {
|
|
30
|
+
data: BannerCollectionGraphQLResponse["bannerCollectionCollection"]["items"];
|
|
31
|
+
};
|
|
32
|
+
export declare const listBannerCollectionEntries: ({ slot, limit, platform, marketCode, language, }: {
|
|
33
|
+
slot: BannerCollectionEntry["fields"]["slot"];
|
|
34
|
+
limit?: number;
|
|
35
|
+
platform?: BannerCollectionEntry["fields"]["platform"][number];
|
|
36
|
+
marketCode?: string;
|
|
37
|
+
language?: string;
|
|
38
|
+
}) => Promise<ListBannerCollectionEntriesResponse>;
|
|
39
|
+
export {};
|
package/dist/entries/blog.d.ts
CHANGED
|
@@ -1,13 +1,59 @@
|
|
|
1
|
-
import { EntriesQueries, Entry } from 'contentful';
|
|
2
1
|
import { TypeBlogPostSkeleton } from '../types';
|
|
2
|
+
import { Entry, EntrySys } from 'contentful';
|
|
3
3
|
export type BlogPostEntry = Entry<TypeBlogPostSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
type GraphQLEntrySys = Pick<EntrySys, "id">;
|
|
5
|
+
type GraphQLAsset = {
|
|
6
|
+
url: string | null;
|
|
7
|
+
width: number | null;
|
|
8
|
+
height: number | null;
|
|
9
|
+
contentType: string | null;
|
|
10
|
+
};
|
|
11
|
+
type BlogPostGraphQLItem = {
|
|
12
|
+
sys: GraphQLEntrySys;
|
|
13
|
+
category: {
|
|
14
|
+
sys: GraphQLEntrySys;
|
|
15
|
+
title: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
} | null;
|
|
18
|
+
featuredImage: GraphQLAsset | null;
|
|
19
|
+
} & Pick<BlogPostEntry["fields"], "title" | "shortDescription" | "slug">;
|
|
20
|
+
type BlogPostDetailGraphQLItem = BlogPostGraphQLItem & {
|
|
21
|
+
author: {
|
|
22
|
+
sys: GraphQLEntrySys;
|
|
23
|
+
name: string;
|
|
24
|
+
avatar: GraphQLAsset | null;
|
|
25
|
+
} | null;
|
|
26
|
+
content: {
|
|
27
|
+
json: BlogPostEntry["fields"]["content"];
|
|
28
|
+
} | null;
|
|
29
|
+
seo: {
|
|
30
|
+
sys: GraphQLEntrySys;
|
|
31
|
+
metaTitle: string;
|
|
32
|
+
metaDescription: string | null;
|
|
33
|
+
metaKeywords: string[] | null;
|
|
34
|
+
metaRobots: string[] | null;
|
|
35
|
+
} | null;
|
|
36
|
+
};
|
|
37
|
+
type BlogPostGraphQLResponse = {
|
|
38
|
+
blogPostCollection: {
|
|
39
|
+
items: Array<BlogPostGraphQLItem>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export type ListBlogPostEntriesResponse = {
|
|
43
|
+
data: BlogPostGraphQLResponse["blogPostCollection"]["items"];
|
|
44
|
+
};
|
|
45
|
+
export type FindBlogPostEntryResponse = {
|
|
46
|
+
data: BlogPostDetailGraphQLItem;
|
|
47
|
+
};
|
|
48
|
+
export declare const listBlogPostEntries: ({ marketCode, language, limit, skip, }?: {
|
|
49
|
+
marketCode?: string;
|
|
50
|
+
language?: string;
|
|
51
|
+
limit?: number;
|
|
52
|
+
skip?: number;
|
|
53
|
+
}) => Promise<ListBlogPostEntriesResponse>;
|
|
54
|
+
export declare const findBlogPostEntry: ({ slug, marketCode, language, }: {
|
|
55
|
+
slug: string;
|
|
56
|
+
marketCode?: string;
|
|
57
|
+
language?: string;
|
|
58
|
+
}) => Promise<FindBlogPostEntryResponse>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TypeBrandCollectionSkeleton } from '../types';
|
|
2
|
+
import { Entry, EntrySys } from 'contentful';
|
|
3
|
+
import { BrandEntry } from './brand';
|
|
4
|
+
type BrandCollectionEntry = Entry<TypeBrandCollectionSkeleton, "WITHOUT_UNRESOLVABLE_LINKS", string>;
|
|
5
|
+
type GraphQLEntrySys = Pick<EntrySys, "id">;
|
|
6
|
+
type BrandCollectionGraphQLResponse = {
|
|
7
|
+
brandCollectionCollection: {
|
|
8
|
+
items: Array<{
|
|
9
|
+
sys: GraphQLEntrySys;
|
|
10
|
+
brandsCollection: {
|
|
11
|
+
items: Array<{
|
|
12
|
+
sys: GraphQLEntrySys;
|
|
13
|
+
} & Pick<BrandEntry["fields"], "name" | "slug">>;
|
|
14
|
+
};
|
|
15
|
+
} & Pick<BrandCollectionEntry["fields"], "name" | "slot">>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type ListBrandCollectionEntriesResponse = {
|
|
19
|
+
data: BrandCollectionGraphQLResponse["brandCollectionCollection"]["items"];
|
|
20
|
+
};
|
|
21
|
+
export declare const listBrandCollectionEntries: ({ limit, marketCode, language, }?: {
|
|
22
|
+
limit?: number;
|
|
23
|
+
marketCode?: string;
|
|
24
|
+
language?: string;
|
|
25
|
+
}) => Promise<ListBrandCollectionEntriesResponse>;
|
|
26
|
+
export {};
|