@streamscloud/streams-api-client 2.1.1 → 2.2.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.
@@ -2,11 +2,11 @@ const mapToSiteShortVideoModels = (posts) => {
2
2
  return posts.map((post) => {
3
3
  const shortVideo = {
4
4
  id: post.id,
5
- displayDate: post.postHeading.postDisplayDate,
6
- authorName: post.postHeading.sourceName,
7
- authorImage: post.postHeading.sourceImage ?? '',
8
- authorType: post.postHeading.sourceType,
9
- viewsCount: post.postHeading.postViewsCount,
5
+ displayDate: post.displayDate,
6
+ authorName: post.authorProfile.name,
7
+ authorImage: post.authorProfile.image ?? '',
8
+ authorType: post.authorProfile.type,
9
+ viewsCount: post.viewsCount ?? 0,
10
10
  reactionsCount: post.social?.reactions.total ?? 0,
11
11
  commentsCount: post.social?.commentsCount ?? 0,
12
12
  sharesCount: post.social?.sharesCount ?? 0,
@@ -18,6 +18,27 @@ const mapToSiteShortVideoModels = (posts) => {
18
18
  thumbnailUrl: x.thumbnailUrl
19
19
  };
20
20
  return media;
21
+ }),
22
+ products: post.allProducts?.map(x => {
23
+ const product = {
24
+ id: x.id,
25
+ link: x.link,
26
+ media: x.media.map(m => ({
27
+ type: m.type,
28
+ url: m.url,
29
+ thumbnailUrl: m.thumbnailUrl
30
+ })),
31
+ title: x.title,
32
+ description: x.shortDescription,
33
+ price: x.priceAndAvailability.price,
34
+ currency: x.priceAndAvailability.currency,
35
+ salesPrices: x.priceAndAvailability.productSalePrices?.map(sp => ({
36
+ salePrice: sp.salePrice,
37
+ salePriceEffectiveDateFrom: sp.salePriceEffectiveDateFrom,
38
+ salePriceEffectiveDateTo: sp.salePriceEffectiveDateTo
39
+ }))
40
+ };
41
+ return product;
21
42
  })
22
43
  };
23
44
  return shortVideo;
@@ -11,4 +11,20 @@ export interface ShortVideoModel {
11
11
  commentsCount: number;
12
12
  sharesCount: number;
13
13
  media: Media[];
14
+ products?: Product[];
15
+ }
16
+ export interface Product {
17
+ id: string;
18
+ link: string;
19
+ media: Media[];
20
+ title: string;
21
+ description?: string;
22
+ price: number;
23
+ currency: string;
24
+ salesPrices?: SalesPrices[];
25
+ }
26
+ export interface SalesPrices {
27
+ salePrice?: number;
28
+ salePriceEffectiveDateFrom?: string;
29
+ salePriceEffectiveDateTo?: string;
14
30
  }
@@ -2,7 +2,13 @@ const mapToStreamModels = (streams) => {
2
2
  return streams.map((s) => {
3
3
  const stream = {
4
4
  id: s.id,
5
- cover: s.cover.url
5
+ cover: s.cover.url,
6
+ categories: s.categories.map(c => ({ name: c.name })),
7
+ pagesCount: s.pagesCount,
8
+ title: s.title,
9
+ subTitle: s.subTitle,
10
+ status: s.status,
11
+ publishedAt: s.publishedAt
6
12
  };
7
13
  return stream;
8
14
  });
@@ -1,4 +1,13 @@
1
1
  export interface StreamModel {
2
2
  id: string;
3
3
  cover: string;
4
+ categories: Category[];
5
+ pagesCount: number;
6
+ title: string;
7
+ subTitle: string;
8
+ status: string;
9
+ publishedAt: string;
10
+ }
11
+ export interface Category {
12
+ name: string;
4
13
  }
@@ -1,3 +1,3 @@
1
- var EmbedPostsQuery = "query EmbedPosts($input: EmbedPostsInput!) {\n embedPosts(input: $input) {\n items {\n id\n postHeading {\n postDisplayDate\n postViewsCount\n sourceId\n sourceImage\n sourceName\n sourceType\n }\n social {\n commentsCount\n sharesCount\n reactions {\n total\n }\n }\n postData {\n postType\n media {\n thumbnailUrl(scale: ORIGINAL_ENCODED)\n url(scale: ORIGINAL_ENCODED)\n type\n }\n shortVideoData {\n text\n }\n }\n }\n }\n}";
1
+ var EmbedPostsQuery = "query EmbedPosts($input: EmbedPostsInput!) {\n embedPosts(input: $input) {\n items {\n id\n postData {\n shortVideoData {\n text\n }\n media {\n type\n url\n thumbnailUrl\n }\n }\n authorProfile {\n name\n image\n type\n }\n displayDate\n viewsCount\n social {\n reactions {\n total\n }\n commentsCount\n sharesCount\n }\n allProducts {\n id\n link\n media {\n thumbnailUrl\n }\n title\n shortDescription\n priceAndAvailability {\n price\n productSalePrices {\n salePrice\n salePriceEffectiveDateFrom\n salePriceEffectiveDateTo\n }\n currency\n }\n }\n }\n }\n}";
2
2
 
3
3
  export { EmbedPostsQuery as default };
@@ -1,3 +1,3 @@
1
- var EmbedStreamsQuery = "query EmbedStreams($input: EmbedStreamsInput!) {\n embedStreams(input: $input) {\n items {\n id\n cover {\n url\n }\n }\n continuationToken\n }\n}";
1
+ var EmbedStreamsQuery = "query EmbedStreams($input: EmbedStreamsInput!) {\n embedStreams(input: $input) {\n items {\n id\n cover {\n url\n }\n categories {\n name\n }\n pagesCount\n title\n subTitle\n status\n publishedAt\n }\n continuationToken\n }\n}";
2
2
 
3
3
  export { EmbedStreamsQuery as default };
@@ -1,4 +1,3 @@
1
- import { MediaItem } from '../types';
2
1
  export type EmbedContentApiClientModel = {
3
2
  streamsGqlEndpoint: string;
4
3
  };
@@ -46,6 +45,11 @@ export type CtaButton = {
46
45
  textColor: string;
47
46
  url: string;
48
47
  };
48
+ export declare enum Currency {
49
+ Eur = "EUR",
50
+ Nok = "NOK",
51
+ Usd = "USD"
52
+ }
49
53
  export type IMediaItem = {
50
54
  blobId: string;
51
55
  metadata: MediaItemMetadata;
@@ -58,6 +62,14 @@ export declare enum MediaFormat {
58
62
  W4H3 = "W4H3",
59
63
  W16H9 = "W16H9"
60
64
  }
65
+ export type MediaItem = IMediaItem & {
66
+ blobId: string;
67
+ metadata: MediaItemMetadata;
68
+ thumbnailBlobId?: string;
69
+ thumbnailUrl?: string;
70
+ type: MediaType;
71
+ url: string;
72
+ };
61
73
  export type MediaItemMetadata = {
62
74
  durationSec?: number;
63
75
  fileName?: string;
@@ -126,10 +138,11 @@ export type CursorResultOfPost = {
126
138
  items: Post[];
127
139
  };
128
140
  export type Post = {
141
+ allProducts: Product[];
129
142
  authorProfile: Profile;
130
143
  createdAt: Date;
131
144
  createdBy: string;
132
- displayDate: Date;
145
+ displayDate: any;
133
146
  editorProfile: Profile;
134
147
  enableSocialInteractions: boolean;
135
148
  expiresOn?: Date;
@@ -218,6 +231,24 @@ export declare enum ProfileType {
218
231
  Organization = "ORGANIZATION",
219
232
  User = "USER"
220
233
  }
234
+ export type Product = {
235
+ id: string;
236
+ link: string;
237
+ media: Media[];
238
+ priceAndAvailability: PriceAndAvailability;
239
+ shortDescription?: string;
240
+ title: string;
241
+ };
242
+ export type PriceAndAvailability = {
243
+ currency: Currency;
244
+ price: number;
245
+ productSalePrices?: ProductSalePrice[];
246
+ };
247
+ export type ProductSalePrice = {
248
+ salePrice: number;
249
+ salePriceEffectiveDateFrom?: Date;
250
+ salePriceEffectiveDateTo?: Date;
251
+ };
221
252
  export type PublishTarget = {
222
253
  enableMoments: boolean;
223
254
  enablePostsSocialInteractionsByDefault: boolean;
@@ -273,6 +304,15 @@ export declare enum Status {
273
304
  export type Stream = {
274
305
  id: string;
275
306
  cover: MediaItem;
307
+ categories: StreamCategory[];
308
+ pagesCount: number;
309
+ publishedAt: any;
310
+ status: any;
311
+ subTitle: string;
312
+ title: string;
313
+ };
314
+ export type StreamCategory = {
315
+ name: string;
276
316
  };
277
317
  export type TagPosition = {
278
318
  itemId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/streams-api-client",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",