@streamscloud/streams-api-client 3.0.0 → 3.1.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 +1 -1
- package/package.json +54 -54
- package/dist/adcampaignsquery.graphql +0 -42
- package/dist/adcampaignsquery.graphql.js +0 -3
- package/dist/articlequery.graphql +0 -135
- package/dist/articlequery.graphql.js +0 -3
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.js +0 -1
- package/dist/components/types.d.ts +0 -19
- package/dist/components/types.js +0 -12
- package/dist/components-data/component-data-provider.service.d.ts +0 -3
- package/dist/components-data/component-data-provider.service.js +0 -35
- package/dist/components-data/components-data-fetcher.service.d.ts +0 -5
- package/dist/components-data/components-data-fetcher.service.js +0 -35
- package/dist/components-data/components-data-parameters-reader.service.d.ts +0 -2
- package/dist/components-data/components-data-parameters-reader.service.js +0 -20
- package/dist/components-data/index.d.ts +0 -4
- package/dist/components-data/index.js +0 -3
- package/dist/components-data/types.d.ts +0 -24
- package/dist/components-data/types.js +0 -6
- package/dist/contentlistsquery.graphql +0 -12
- package/dist/contentlistsquery.graphql.js +0 -3
- package/dist/data-loaders/index.d.ts +0 -2
- package/dist/data-loaders/index.js +0 -2
- package/dist/data-loaders/short-videos-data-loader/index.d.ts +0 -2
- package/dist/data-loaders/short-videos-data-loader/loader.d.ts +0 -4
- package/dist/data-loaders/short-videos-data-loader/loader.js +0 -14
- package/dist/data-loaders/short-videos-data-loader/mapper.d.ts +0 -3
- package/dist/data-loaders/short-videos-data-loader/mapper.js +0 -51
- package/dist/data-loaders/short-videos-data-loader/types.d.ts +0 -33
- package/dist/data-loaders/streams-data-loader/index.d.ts +0 -2
- package/dist/data-loaders/streams-data-loader/loader.d.ts +0 -4
- package/dist/data-loaders/streams-data-loader/loader.js +0 -14
- package/dist/data-loaders/streams-data-loader/mapper.d.ts +0 -3
- package/dist/data-loaders/streams-data-loader/mapper.js +0 -20
- package/dist/data-loaders/streams-data-loader/types.d.ts +0 -16
- package/dist/data-loaders/types.d.ts +0 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/index.js.map +0 -1
- package/dist/postsquery.graphql +0 -152
- package/dist/postsquery.graphql.js +0 -3
- package/dist/services/embed-content-api-client.d.ts +0 -8
- package/dist/services/embed-content-api-client.js +0 -48
- package/dist/services/embed-content-client.service.d.ts +0 -2
- package/dist/services/embed-content-client.service.js +0 -5
- package/dist/services/index.d.ts +0 -2
- package/dist/services/index.js +0 -2
- package/dist/services/operations/posts-query.graphql.js +0 -3
- package/dist/services/operations/streams-query.graphql.js +0 -3
- package/dist/services/types.d.ts +0 -345
- package/dist/streams-api-client-model.d.ts +0 -5
- package/dist/streams-api-client-model.js +0 -2
- package/dist/streams-api-client-model.js.map +0 -1
- package/dist/streams-content-api-client.d.ts +0 -14
- package/dist/streams-content-api-client.js +0 -89
- package/dist/streams-content-api-client.js.map +0 -1
- package/dist/types.d.ts +0 -790
- package/dist/types.js +0 -222
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Streams API Client
|
|
1
|
+
Streams API Client
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@streamscloud/streams-api-client",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"svelte": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./data-loaders": {
|
|
15
|
-
"import": "./dist/data-loaders/index.js",
|
|
16
|
-
"types": "./dist/data-loaders/index.d.ts"
|
|
17
|
-
},
|
|
18
|
-
"./components-data": {
|
|
19
|
-
"import": "./dist/components-data/index.js",
|
|
20
|
-
"types": "./dist/components-data/index.d.ts"
|
|
21
|
-
},
|
|
22
|
-
"./services": {
|
|
23
|
-
"import": "./dist/services/index.js",
|
|
24
|
-
"types": "./dist/services/index.d.ts"
|
|
25
|
-
},
|
|
26
|
-
"./components": {
|
|
27
|
-
"import": "./dist/components/index.js",
|
|
28
|
-
"types": "./dist/components/index.d.ts"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"files": [
|
|
32
|
-
"dist"
|
|
33
|
-
],
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "rollup -c",
|
|
36
|
-
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
37
|
-
"format": "prettier --write 'src/**/*.{ts,tsx}'"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [],
|
|
40
|
-
"author": "StreamsCloud",
|
|
41
|
-
"description": "",
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
44
|
-
"@typescript-eslint/parser": "^8.28.0",
|
|
45
|
-
"eslint": "^9.23.0",
|
|
46
|
-
"eslint-config-prettier": "^10.1.1",
|
|
47
|
-
"eslint-plugin-prettier": "^5.2.5",
|
|
48
|
-
"prettier": "^3.5.3",
|
|
49
|
-
"rollup": "^4.37.0",
|
|
50
|
-
"rollup-plugin-string": "^3.0.0",
|
|
51
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
52
|
-
"typescript": "^5.8.2"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@streamscloud/streams-api-client",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"svelte": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./data-loaders": {
|
|
15
|
+
"import": "./dist/data-loaders/index.js",
|
|
16
|
+
"types": "./dist/data-loaders/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./components-data": {
|
|
19
|
+
"import": "./dist/components-data/index.js",
|
|
20
|
+
"types": "./dist/components-data/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./services": {
|
|
23
|
+
"import": "./dist/services/index.js",
|
|
24
|
+
"types": "./dist/services/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"./components": {
|
|
27
|
+
"import": "./dist/components/index.js",
|
|
28
|
+
"types": "./dist/components/index.d.ts"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rollup -c",
|
|
36
|
+
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
37
|
+
"format": "prettier --write 'src/**/*.{ts,tsx}'"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [],
|
|
40
|
+
"author": "StreamsCloud",
|
|
41
|
+
"description": "",
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.28.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.28.0",
|
|
45
|
+
"eslint": "^9.23.0",
|
|
46
|
+
"eslint-config-prettier": "^10.1.1",
|
|
47
|
+
"eslint-plugin-prettier": "^5.2.5",
|
|
48
|
+
"prettier": "^3.5.3",
|
|
49
|
+
"rollup": "^4.37.0",
|
|
50
|
+
"rollup-plugin-string": "^3.0.0",
|
|
51
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
52
|
+
"typescript": "^5.8.2"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
query SiteActiveCampaigns($filter: SiteActiveCampaignsFilterInput!, $pageQuery: PaginationOfAdCampaignsOrderByInput!) {
|
|
2
|
-
siteActiveCampaigns(filter: $filter, pagination: $pageQuery) {
|
|
3
|
-
total
|
|
4
|
-
items {
|
|
5
|
-
id
|
|
6
|
-
name
|
|
7
|
-
status
|
|
8
|
-
adGroupIds
|
|
9
|
-
adGroups {
|
|
10
|
-
name
|
|
11
|
-
ads {
|
|
12
|
-
..._adForGridPayloadFragment
|
|
13
|
-
}
|
|
14
|
-
adPlacement {
|
|
15
|
-
name
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
status
|
|
19
|
-
updatedAt
|
|
20
|
-
editorProfile {
|
|
21
|
-
id
|
|
22
|
-
name
|
|
23
|
-
handle
|
|
24
|
-
image
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
fragment _adForGridPayloadFragment on Ad {
|
|
31
|
-
id
|
|
32
|
-
media {
|
|
33
|
-
type
|
|
34
|
-
url
|
|
35
|
-
thumbnailUrl
|
|
36
|
-
}
|
|
37
|
-
name
|
|
38
|
-
title
|
|
39
|
-
description
|
|
40
|
-
status
|
|
41
|
-
updatedAt
|
|
42
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var SiteActiveCampaignsQuery = "query SiteActiveCampaigns($filter: SiteActiveCampaignsFilterInput!, $pageQuery: PaginationOfAdCampaignsOrderByInput!) {\n siteActiveCampaigns(filter: $filter, pagination: $pageQuery) {\n total\n items {\n id\n name\n status\n adGroupIds\n adGroups {\n name\n ads {\n ..._adForGridPayloadFragment\n }\n adPlacement {\n name\n }\n }\n status\n updatedAt\n editorProfile {\n id\n name\n handle\n image\n }\n }\n }\n}\n\nfragment _adForGridPayloadFragment on Ad {\n id\n media {\n type\n url\n thumbnailUrl\n }\n name\n title\n description\n status\n updatedAt\n}\n";
|
|
2
|
-
|
|
3
|
-
export { SiteActiveCampaignsQuery as default };
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
query SiteArticle($organizationId: String!, $slug: String!) {
|
|
2
|
-
siteArticle(filter: { organizationId: $organizationId, slug: $slug }) {
|
|
3
|
-
...ArticleFragment
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
fragment ArticleFragment on Article {
|
|
8
|
-
id
|
|
9
|
-
postId
|
|
10
|
-
slug
|
|
11
|
-
publishedAt
|
|
12
|
-
mainImage(scale: ORIGINAL_ENCODED)
|
|
13
|
-
sections {
|
|
14
|
-
...ArticleSectionPayloadFragment
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
fragment ArticleSectionPayloadFragment on ArticleSection {
|
|
19
|
-
id
|
|
20
|
-
isContentEditable
|
|
21
|
-
styles {
|
|
22
|
-
paddingBottom
|
|
23
|
-
paddingTop
|
|
24
|
-
paddingLeft
|
|
25
|
-
paddingRight
|
|
26
|
-
}
|
|
27
|
-
layouts {
|
|
28
|
-
..._ArticleLayoutPayloadFragment
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fragment _ArticleLayoutPayloadFragment on ArticleLayout {
|
|
33
|
-
id
|
|
34
|
-
type
|
|
35
|
-
styles {
|
|
36
|
-
paddingBottom
|
|
37
|
-
paddingTop
|
|
38
|
-
paddingLeft
|
|
39
|
-
paddingRight
|
|
40
|
-
}
|
|
41
|
-
fields {
|
|
42
|
-
..._ArticleFieldPayloadFragment
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
fragment _ArticleFieldPayloadFragment on ArticleField {
|
|
47
|
-
id
|
|
48
|
-
name
|
|
49
|
-
description
|
|
50
|
-
fieldData {
|
|
51
|
-
type
|
|
52
|
-
bylineData {
|
|
53
|
-
..._BylineFieldDataPayloadFragment
|
|
54
|
-
}
|
|
55
|
-
imageData {
|
|
56
|
-
..._ImageFieldDataPayloadFragment
|
|
57
|
-
}
|
|
58
|
-
mediaData {
|
|
59
|
-
..._MediaFieldDataPayloadFragment
|
|
60
|
-
}
|
|
61
|
-
mediaGalleryData {
|
|
62
|
-
..._MediaGalleryFieldDataPayloadFragment
|
|
63
|
-
}
|
|
64
|
-
richTextData {
|
|
65
|
-
..._RichTextFieldDataPayloadFragment
|
|
66
|
-
}
|
|
67
|
-
textData {
|
|
68
|
-
..._TextFieldDataPayloadFragment
|
|
69
|
-
}
|
|
70
|
-
videoData {
|
|
71
|
-
..._VideoFieldDataPayloadFragment
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
fragment _BylineFieldDataPayloadFragment on BylineFieldData {
|
|
77
|
-
authorName
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fragment _ImageFieldDataPayloadFragment on ImageFieldData {
|
|
81
|
-
image {
|
|
82
|
-
...MediaItemPayloadFragment
|
|
83
|
-
}
|
|
84
|
-
preferredMediaFormat
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
fragment _MediaFieldDataPayloadFragment on MediaFieldData {
|
|
88
|
-
media {
|
|
89
|
-
...MediaItemPayloadFragment
|
|
90
|
-
}
|
|
91
|
-
preferredMediaFormat
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
fragment _MediaGalleryFieldDataPayloadFragment on MediaGalleryFieldData {
|
|
95
|
-
media {
|
|
96
|
-
...MediaItemPayloadFragment
|
|
97
|
-
}
|
|
98
|
-
galleryMode
|
|
99
|
-
preferredMediaFormat
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
fragment _RichTextFieldDataPayloadFragment on RichTextFieldData {
|
|
103
|
-
text
|
|
104
|
-
textSize
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
fragment _TextFieldDataPayloadFragment on TextFieldData {
|
|
108
|
-
text
|
|
109
|
-
textMode
|
|
110
|
-
textSize
|
|
111
|
-
textWeight
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
fragment _VideoFieldDataPayloadFragment on VideoFieldData {
|
|
115
|
-
video {
|
|
116
|
-
...MediaItemPayloadFragment
|
|
117
|
-
}
|
|
118
|
-
preferredMediaFormat
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
fragment MediaItemPayloadFragment on MediaItem {
|
|
122
|
-
url(scale: ORIGINAL_ENCODED)
|
|
123
|
-
thumbnailUrl(scale: ORIGINAL_ENCODED)
|
|
124
|
-
type
|
|
125
|
-
metadata {
|
|
126
|
-
...MediaItemMetadataPayloadFragment
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
fragment MediaItemMetadataPayloadFragment on MediaItemMetadata {
|
|
131
|
-
fileName
|
|
132
|
-
width
|
|
133
|
-
height
|
|
134
|
-
durationSec
|
|
135
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var SiteArticleQuery = "query SiteArticle($organizationId: String!, $slug: String!) {\n siteArticle(filter: { organizationId: $organizationId, slug: $slug }) {\n ...ArticleFragment\n }\n}\n\nfragment ArticleFragment on Article {\n id\n postId\n slug\n publishedAt\n mainImage(scale: ORIGINAL_ENCODED)\n sections {\n ...ArticleSectionPayloadFragment\n }\n}\n\nfragment ArticleSectionPayloadFragment on ArticleSection {\n id\n isContentEditable\n styles {\n paddingBottom\n paddingTop\n paddingLeft\n paddingRight\n }\n layouts {\n ..._ArticleLayoutPayloadFragment\n }\n}\n\nfragment _ArticleLayoutPayloadFragment on ArticleLayout {\n id\n type\n styles {\n paddingBottom\n paddingTop\n paddingLeft\n paddingRight\n }\n fields {\n ..._ArticleFieldPayloadFragment\n }\n}\n\nfragment _ArticleFieldPayloadFragment on ArticleField {\n id\n name\n description\n fieldData {\n type\n bylineData {\n ..._BylineFieldDataPayloadFragment\n }\n imageData {\n ..._ImageFieldDataPayloadFragment\n }\n mediaData {\n ..._MediaFieldDataPayloadFragment\n }\n mediaGalleryData {\n ..._MediaGalleryFieldDataPayloadFragment\n }\n richTextData {\n ..._RichTextFieldDataPayloadFragment\n }\n textData {\n ..._TextFieldDataPayloadFragment\n }\n videoData {\n ..._VideoFieldDataPayloadFragment\n }\n }\n}\n\nfragment _BylineFieldDataPayloadFragment on BylineFieldData {\n authorName\n}\n\nfragment _ImageFieldDataPayloadFragment on ImageFieldData {\n image {\n ...MediaItemPayloadFragment\n }\n preferredMediaFormat\n}\n\nfragment _MediaFieldDataPayloadFragment on MediaFieldData {\n media {\n ...MediaItemPayloadFragment\n }\n preferredMediaFormat\n}\n\nfragment _MediaGalleryFieldDataPayloadFragment on MediaGalleryFieldData {\n media {\n ...MediaItemPayloadFragment\n }\n galleryMode\n preferredMediaFormat\n}\n\nfragment _RichTextFieldDataPayloadFragment on RichTextFieldData {\n text\n textSize\n}\n\nfragment _TextFieldDataPayloadFragment on TextFieldData {\n text\n textMode\n textSize\n textWeight\n}\n\nfragment _VideoFieldDataPayloadFragment on VideoFieldData {\n video {\n ...MediaItemPayloadFragment\n }\n preferredMediaFormat\n}\n\nfragment MediaItemPayloadFragment on MediaItem {\n url(scale: ORIGINAL_ENCODED)\n thumbnailUrl(scale: ORIGINAL_ENCODED)\n type\n metadata {\n ...MediaItemMetadataPayloadFragment\n }\n}\n\nfragment MediaItemMetadataPayloadFragment on MediaItemMetadata {\n fileName\n width\n height\n durationSec\n}\n";
|
|
2
|
-
|
|
3
|
-
export { SiteArticleQuery as default };
|
package/dist/components/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DataType, ParameterType } from './types.js';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ComponentData } from '../components-data';
|
|
2
|
-
export declare const DataType: {
|
|
3
|
-
Stream: string;
|
|
4
|
-
ShortVideo: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const ParameterType: {
|
|
7
|
-
String: string;
|
|
8
|
-
Text: string;
|
|
9
|
-
Number: string;
|
|
10
|
-
Color: string;
|
|
11
|
-
};
|
|
12
|
-
export type ParameterValue = unknown;
|
|
13
|
-
export type Parameters = {
|
|
14
|
-
[key: string]: ParameterValue;
|
|
15
|
-
};
|
|
16
|
-
export type ComponentProps = {
|
|
17
|
-
parameters?: Parameters;
|
|
18
|
-
data?: ComponentData;
|
|
19
|
-
};
|
package/dist/components/types.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ComponentData, ComponentDataProvider, ComponentsData, DataParameters } from './types';
|
|
2
|
-
export declare const createComponentDataProvider: (componentsData?: ComponentsData, preserveOriginalData?: boolean) => ComponentDataProvider;
|
|
3
|
-
export declare const getComponentData: (componentsData?: ComponentsData, parameters?: DataParameters) => ComponentData;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const createComponentDataProvider = (componentsData, preserveOriginalData = false) => {
|
|
2
|
-
if (preserveOriginalData) {
|
|
3
|
-
componentsData = structuredClone(componentsData);
|
|
4
|
-
}
|
|
5
|
-
return {
|
|
6
|
-
getData: (parameters) => getComponentData(componentsData, parameters)
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
const getComponentData = (componentsData, parameters) => {
|
|
10
|
-
const result = {};
|
|
11
|
-
if (!componentsData) {
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
if (!parameters) {
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
for (const [dataType, params] of Object.entries(parameters)) {
|
|
18
|
-
if (!params) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
const data = componentsData[dataType];
|
|
22
|
-
if (!data) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
result[dataType] = getModels(data, params);
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
const getModels = (content, ids) => ids.length
|
|
30
|
-
? content
|
|
31
|
-
.filter((x) => ids.includes(x.id))
|
|
32
|
-
.sort((a, b) => ids.indexOf(a.id) - ids.indexOf(b.id))
|
|
33
|
-
: [];
|
|
34
|
-
|
|
35
|
-
export { createComponentDataProvider, getComponentData };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EmbedContentApiClient } from '../services';
|
|
2
|
-
import { ComponentsData, ComponentsDataParameters } from './types';
|
|
3
|
-
export declare const createComponentsDataFetcher: (client: EmbedContentApiClient) => {
|
|
4
|
-
fetch: (dataParameters: ComponentsDataParameters) => Promise<ComponentsData>;
|
|
5
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { getShortVideosDataLoader } from '../data-loaders/short-videos-data-loader/loader.js';
|
|
2
|
-
import { getStreamsDataLoader } from '../data-loaders/streams-data-loader/loader.js';
|
|
3
|
-
import { DataType } from './types.js';
|
|
4
|
-
|
|
5
|
-
const createComponentsDataFetcher = (client) => {
|
|
6
|
-
const loadersMap = new Map([
|
|
7
|
-
[DataType.ShortVideo, getShortVideosDataLoader(client)],
|
|
8
|
-
[DataType.Stream, getStreamsDataLoader(client)]
|
|
9
|
-
]);
|
|
10
|
-
return {
|
|
11
|
-
fetch: async (dataParameters) => {
|
|
12
|
-
const result = {};
|
|
13
|
-
const fetchActions = [];
|
|
14
|
-
for (const [dataType, params] of Object.entries(dataParameters)) {
|
|
15
|
-
if (!params) {
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
const loader = loadersMap.get(dataType);
|
|
19
|
-
if (!loader) {
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
fetchActions.push((async () => {
|
|
23
|
-
result[dataType] = await loadContent(loader, params);
|
|
24
|
-
})());
|
|
25
|
-
}
|
|
26
|
-
await Promise.all(fetchActions);
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
const loadContent = async (dataLoader, contentParameters) => {
|
|
32
|
-
return contentParameters.ids.length ? await dataLoader.load(contentParameters.ids) : [];
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export { createComponentsDataFetcher };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const getComponentsDataParameters = (parameters) => {
|
|
2
|
-
const result = {};
|
|
3
|
-
const params = parameters
|
|
4
|
-
.flatMap((x) => Object.entries(x).filter(([_, v]) => Array.isArray(v)).map(([t, v]) => ({ type: t, value: v })));
|
|
5
|
-
const dataTypes = [...new Set(params.map(x => x.type))];
|
|
6
|
-
for (const dataType of dataTypes) {
|
|
7
|
-
result[dataType] = {
|
|
8
|
-
ids: getIds(params, dataType),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
return result;
|
|
12
|
-
};
|
|
13
|
-
const getIds = (parameters, dataType) => [
|
|
14
|
-
...new Set(parameters
|
|
15
|
-
.filter((x) => x.type === dataType && typeof Array.isArray(x.value))
|
|
16
|
-
.map((x) => x.value)
|
|
17
|
-
.flatMap((x) => x))
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
export { getComponentsDataParameters };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { ComponentDataProvider, ComponentsData, ComponentsDataParameters, ContentParameters, ComponentData, ComponentDataModel, DataParameters } from './types';
|
|
2
|
-
export { createComponentDataProvider } from './component-data-provider.service';
|
|
3
|
-
export { createComponentsDataFetcher } from './components-data-fetcher.service';
|
|
4
|
-
export { getComponentsDataParameters } from './components-data-parameters-reader.service';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ShortVideoModel, StreamModel } from '../data-loaders';
|
|
2
|
-
export declare const DataType: {
|
|
3
|
-
ShortVideo: string;
|
|
4
|
-
Stream: string;
|
|
5
|
-
};
|
|
6
|
-
export type ComponentsDataParameters = {
|
|
7
|
-
[key: string]: ContentParameters | undefined;
|
|
8
|
-
};
|
|
9
|
-
export type ContentParameters = {
|
|
10
|
-
ids: string[];
|
|
11
|
-
};
|
|
12
|
-
export type ComponentsData = {
|
|
13
|
-
[key: string]: ComponentDataModel[];
|
|
14
|
-
};
|
|
15
|
-
export type ComponentDataModel = ShortVideoModel | StreamModel;
|
|
16
|
-
export type DataParameters = {
|
|
17
|
-
[key: string]: string[] | undefined;
|
|
18
|
-
};
|
|
19
|
-
export type ComponentData = {
|
|
20
|
-
[key: string]: ComponentDataModel[] | undefined;
|
|
21
|
-
};
|
|
22
|
-
export type ComponentDataProvider = {
|
|
23
|
-
getData: (parameters?: DataParameters) => ComponentData;
|
|
24
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
query SiteContentLists($cursor: CursorOfSiteContentListsOrderByInput!, $filter: SiteContentListsFilterInput!) {
|
|
2
|
-
siteContentLists(cursor: $cursor, filter: $filter) {
|
|
3
|
-
items {
|
|
4
|
-
...ContentListFragment
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
fragment ContentListFragment on ContentList {
|
|
10
|
-
id
|
|
11
|
-
name
|
|
12
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var SiteContentListsQuery = "query SiteContentLists($cursor: CursorOfSiteContentListsOrderByInput!, $filter: SiteContentListsFilterInput!) {\n siteContentLists(cursor: $cursor, filter: $filter) {\n items {\n ...ContentListFragment\n }\n }\n}\n\nfragment ContentListFragment on ContentList {\n id\n name\n}\n";
|
|
2
|
-
|
|
3
|
-
export { SiteContentListsQuery as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { mapToSiteShortVideoModels } from './mapper.js';
|
|
2
|
-
|
|
3
|
-
const getShortVideosDataLoader = (client) => ({
|
|
4
|
-
async load(ids) {
|
|
5
|
-
const posts = await client.getPosts(ids);
|
|
6
|
-
if (!posts) {
|
|
7
|
-
console.error('Failed to fetch site short video posts: Null-payload received', posts);
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
return mapToSiteShortVideoModels(posts);
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { getShortVideosDataLoader };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
const mapToSiteShortVideoModels = (posts) => {
|
|
2
|
-
return posts.map((post) => {
|
|
3
|
-
const shortVideo = {
|
|
4
|
-
id: post.id,
|
|
5
|
-
displayDate: post.displayDate,
|
|
6
|
-
authorName: post.authorProfile.name,
|
|
7
|
-
authorImage: post.authorProfile.image ?? '',
|
|
8
|
-
ownerName: post.ownerProfile.name,
|
|
9
|
-
ownerImage: post.ownerProfile.image ?? '',
|
|
10
|
-
ownerType: post.ownerProfile.type,
|
|
11
|
-
authorType: post.authorProfile.type,
|
|
12
|
-
viewsCount: post.viewsCount ?? 0,
|
|
13
|
-
reactionsCount: post.social?.reactions.total ?? 0,
|
|
14
|
-
commentsCount: post.social?.commentsCount ?? 0,
|
|
15
|
-
sharesCount: post.social?.sharesCount ?? 0,
|
|
16
|
-
text: post.postData.shortVideoData.text ?? '',
|
|
17
|
-
media: post.postData.media.map((x) => {
|
|
18
|
-
const media = {
|
|
19
|
-
type: x.type,
|
|
20
|
-
url: x.url,
|
|
21
|
-
thumbnailUrl: x.thumbnailUrl
|
|
22
|
-
};
|
|
23
|
-
return media;
|
|
24
|
-
}),
|
|
25
|
-
products: post.allProducts?.map(x => {
|
|
26
|
-
const product = {
|
|
27
|
-
id: x.id,
|
|
28
|
-
link: x.link ?? '',
|
|
29
|
-
media: x.media.map(m => ({
|
|
30
|
-
type: m.type,
|
|
31
|
-
url: m.url,
|
|
32
|
-
thumbnailUrl: m.thumbnailUrl
|
|
33
|
-
})),
|
|
34
|
-
title: x.title,
|
|
35
|
-
description: x.shortDescription,
|
|
36
|
-
price: x.priceAndAvailability.price,
|
|
37
|
-
currency: x.priceAndAvailability.currency,
|
|
38
|
-
salesPrices: x.priceAndAvailability.productSalePrices?.map(sp => ({
|
|
39
|
-
salePrice: sp.salePrice,
|
|
40
|
-
salePriceEffectiveDateFrom: sp.salePriceEffectiveDateFrom,
|
|
41
|
-
salePriceEffectiveDateTo: sp.salePriceEffectiveDateTo
|
|
42
|
-
}))
|
|
43
|
-
};
|
|
44
|
-
return product;
|
|
45
|
-
})
|
|
46
|
-
};
|
|
47
|
-
return shortVideo;
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export { mapToSiteShortVideoModels };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Media } from '../../services/types';
|
|
2
|
-
export interface ShortVideoModel {
|
|
3
|
-
id: string;
|
|
4
|
-
text: string;
|
|
5
|
-
authorName: string;
|
|
6
|
-
authorImage: string;
|
|
7
|
-
authorType: string;
|
|
8
|
-
ownerName: string;
|
|
9
|
-
ownerImage: string;
|
|
10
|
-
ownerType: string;
|
|
11
|
-
displayDate: string;
|
|
12
|
-
viewsCount: number;
|
|
13
|
-
reactionsCount: number;
|
|
14
|
-
commentsCount: number;
|
|
15
|
-
sharesCount: number;
|
|
16
|
-
media: Media[];
|
|
17
|
-
products?: Product[];
|
|
18
|
-
}
|
|
19
|
-
export interface Product {
|
|
20
|
-
id: string;
|
|
21
|
-
link: string;
|
|
22
|
-
media: Media[];
|
|
23
|
-
title: string;
|
|
24
|
-
description?: string;
|
|
25
|
-
price: number;
|
|
26
|
-
currency: string;
|
|
27
|
-
salesPrices?: SalesPrices[];
|
|
28
|
-
}
|
|
29
|
-
export interface SalesPrices {
|
|
30
|
-
salePrice?: number;
|
|
31
|
-
salePriceEffectiveDateFrom?: string;
|
|
32
|
-
salePriceEffectiveDateTo?: string;
|
|
33
|
-
}
|