@cntrl-site/sdk 1.25.11-components.0 → 1.25.11
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/lib/Client/Client.d.ts +0 -4
- package/lib/Client/Client.js +0 -30
- package/lib/ScrollPlaybackVideoManager/ScrollPlaybackVideoManager.js +6 -1
- package/lib/index.d.ts +0 -1
- package/lib/schemas/article/Item.schema.js +1 -2
- package/lib/types/article/Item.d.ts +0 -1
- package/package.json +1 -1
- package/lib/types/customComponent/CustomComponentMeta.d.ts +0 -5
- package/lib/types/customComponent/CustomComponentMeta.js +0 -2
package/lib/Client/Client.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Project } from '../types/project/Project';
|
|
|
3
3
|
import { Layout } from '../types/project/Layout';
|
|
4
4
|
import { Article } from '../types/article/Article';
|
|
5
5
|
import { KeyframeAny } from '../types/keyframe/Keyframe';
|
|
6
|
-
import { CustomComponentMeta } from '../types/customComponent/CustomComponentMeta';
|
|
7
6
|
export declare class Client {
|
|
8
7
|
private fetchImpl;
|
|
9
8
|
private url;
|
|
@@ -12,8 +11,6 @@ export declare class Client {
|
|
|
12
11
|
getPageData(pageSlug: string, buildMode?: 'default' | 'self-hosted'): Promise<CntrlPageData>;
|
|
13
12
|
getProjectPagesPaths(): Promise<string[]>;
|
|
14
13
|
getLayouts(): Promise<Layout[]>;
|
|
15
|
-
fetchCustomComponents(buildMode?: 'default' | 'self-hosted'): Promise<CustomComponentMeta[]>;
|
|
16
|
-
fetchCustomComponentBundle(componentId: string, buildMode?: 'default' | 'self-hosted'): Promise<string>;
|
|
17
14
|
private fetchProject;
|
|
18
15
|
private fetchArticle;
|
|
19
16
|
private findArticleIdByPageSlug;
|
|
@@ -21,7 +18,6 @@ export declare class Client {
|
|
|
21
18
|
interface FetchImplResponse {
|
|
22
19
|
ok: boolean;
|
|
23
20
|
json(): Promise<any>;
|
|
24
|
-
text(): Promise<string>;
|
|
25
21
|
statusText: string;
|
|
26
22
|
}
|
|
27
23
|
type FetchImpl = (url: string, init?: RequestInit) => Promise<FetchImplResponse>;
|
package/lib/Client/Client.js
CHANGED
|
@@ -81,36 +81,6 @@ class Client {
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
fetchCustomComponents() {
|
|
85
|
-
return __awaiter(this, arguments, void 0, function* (buildMode = 'default') {
|
|
86
|
-
const { username: projectId, password: apiKey, origin } = this.url;
|
|
87
|
-
const url = new url_1.URL(`/projects/${projectId}/custom-components?buildMode=${buildMode}`, origin);
|
|
88
|
-
const response = yield this.fetchImpl(url.href, {
|
|
89
|
-
headers: {
|
|
90
|
-
Authorization: `Bearer ${apiKey}`
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
if (!response.ok) {
|
|
94
|
-
throw new Error(`Failed to fetch custom components for project #${projectId}: ${response.statusText}`);
|
|
95
|
-
}
|
|
96
|
-
return response.json();
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
fetchCustomComponentBundle(componentId_1) {
|
|
100
|
-
return __awaiter(this, arguments, void 0, function* (componentId, buildMode = 'default') {
|
|
101
|
-
const { username: projectId, password: apiKey, origin } = this.url;
|
|
102
|
-
const url = new url_1.URL(`/projects/${projectId}/custom-components/${componentId}/bundle.js?buildMode=${buildMode}`, origin);
|
|
103
|
-
const response = yield this.fetchImpl(url.href, {
|
|
104
|
-
headers: {
|
|
105
|
-
Authorization: `Bearer ${apiKey}`
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
if (!response.ok) {
|
|
109
|
-
throw new Error(`Failed to fetch bundle for custom component #${componentId}: ${response.statusText}`);
|
|
110
|
-
}
|
|
111
|
-
return response.text();
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
84
|
fetchProject() {
|
|
115
85
|
return __awaiter(this, arguments, void 0, function* (buildMode = 'default') {
|
|
116
86
|
const { username: projectId, password: apiKey, origin } = this.url;
|
|
@@ -87,8 +87,13 @@ class ScrollPlaybackVideoManager {
|
|
|
87
87
|
this.video.pause();
|
|
88
88
|
this.video.load();
|
|
89
89
|
this.container.appendChild(this.video);
|
|
90
|
-
const
|
|
90
|
+
const ua = new ua_parser_js_1.default();
|
|
91
|
+
const browserEngine = ua.getEngine();
|
|
91
92
|
this.isSafari = browserEngine.name === 'WebKit';
|
|
93
|
+
const deviceType = ua.getDevice().type;
|
|
94
|
+
if (deviceType === 'mobile' || deviceType === 'tablet') {
|
|
95
|
+
this.useWebCodecs = false;
|
|
96
|
+
}
|
|
92
97
|
if (this.debug && this.isSafari)
|
|
93
98
|
console.info('Safari browser detected');
|
|
94
99
|
this.video.addEventListener('loadedmetadata', () => this.setTargetTimePercent(0, true), { once: true });
|
package/lib/index.d.ts
CHANGED
|
@@ -21,4 +21,3 @@ export type { Meta } from './types/project/Meta';
|
|
|
21
21
|
export type { KeyframeValueMap, KeyframeAny } from './types/keyframe/Keyframe';
|
|
22
22
|
export type { CompoundSettings } from './types/article/CompoundSettings';
|
|
23
23
|
export type { Dimensions, Left, Position, RectCoordinates, RectObject, ScaleOrigin, Sides, Top } from './types/article/Rect';
|
|
24
|
-
export type { CustomComponentMeta } from './types/customComponent/CustomComponentMeta';
|
|
@@ -191,8 +191,7 @@ const ComponentItemSchema = ItemBase_schema_1.ItemBaseSchema.extend({
|
|
|
191
191
|
type: zod_1.z.literal(ArticleItemType_1.ArticleItemType.Component),
|
|
192
192
|
commonParams: zod_1.z.object({
|
|
193
193
|
componentId: zod_1.z.string(),
|
|
194
|
-
content: zod_1.z.any().optional()
|
|
195
|
-
parameters: zod_1.z.record(zod_1.z.any()).optional()
|
|
194
|
+
content: zod_1.z.any().optional()
|
|
196
195
|
}),
|
|
197
196
|
sticky: zod_1.z.record(zod_1.z.object({
|
|
198
197
|
from: zod_1.z.number(),
|
package/package.json
CHANGED