@tailor-cms/ce-brightcove-video-server 0.1.0 → 2.0.1
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/dist/index.cjs +37 -98
- package/dist/index.d.cts +9 -24
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +31 -0
- package/package.json +18 -23
- package/dist/index.d.ts +0 -25
- package/dist/index.js +0 -67
package/dist/index.cjs
CHANGED
|
@@ -1,101 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let _tailor_cms_ce_brightcove_video_manifest = require("@tailor-cms/ce-brightcove-video-manifest");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
const IS_CEK = process.env.CEK_RUNTIME;
|
|
8
|
+
const USER_STATE = {};
|
|
9
|
+
const beforeDisplay = (_element, context) => {
|
|
10
|
+
return {
|
|
11
|
+
...context,
|
|
12
|
+
...USER_STATE
|
|
13
|
+
};
|
|
8
14
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const onUserInteraction = (_element, context, payload) => {
|
|
16
|
+
const { currentTime, furthestTime } = payload;
|
|
17
|
+
if (IS_CEK) {
|
|
18
|
+
context.currentTime = currentTime;
|
|
19
|
+
context.furthestTime = Math.max(context.furthestTime ?? 0, furthestTime);
|
|
20
|
+
}
|
|
21
|
+
return { updateDisplayState: true };
|
|
16
22
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
default: () => index_default,
|
|
28
|
-
hookMap: () => hookMap,
|
|
29
|
-
initState: () => initState,
|
|
30
|
-
onUserInteraction: () => onUserInteraction,
|
|
31
|
-
type: () => type
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(index_exports);
|
|
34
|
-
|
|
35
|
-
// ../manifest/dist/index.js
|
|
36
|
-
var type = "BRIGHTCOVE_VIDEO";
|
|
37
|
-
var initState = () => ({
|
|
38
|
-
accountId: "",
|
|
39
|
-
playerId: "",
|
|
40
|
-
videoId: ""
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// src/index.ts
|
|
44
|
-
var IS_CEK = process.env.CEK_RUNTIME;
|
|
45
|
-
var USER_STATE = {};
|
|
46
|
-
function beforeSave(element, _services) {
|
|
47
|
-
return element;
|
|
48
|
-
}
|
|
49
|
-
function afterSave(element, _services) {
|
|
50
|
-
return element;
|
|
51
|
-
}
|
|
52
|
-
function afterLoaded(element, _services, _runtime) {
|
|
53
|
-
return element;
|
|
54
|
-
}
|
|
55
|
-
function afterRetrieve(element, _services, _runtime) {
|
|
56
|
-
return element;
|
|
57
|
-
}
|
|
58
|
-
function beforeDisplay(_element, context) {
|
|
59
|
-
return { ...context, ...USER_STATE };
|
|
60
|
-
}
|
|
61
|
-
function onUserInteraction(_element, context, payload) {
|
|
62
|
-
if (IS_CEK) {
|
|
63
|
-
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
64
|
-
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
65
|
-
Object.assign(USER_STATE, payload);
|
|
66
|
-
}
|
|
67
|
-
return { updateDisplayState: true };
|
|
68
|
-
}
|
|
69
|
-
var hookMap = new Map(
|
|
70
|
-
Object.entries({
|
|
71
|
-
beforeSave,
|
|
72
|
-
afterSave,
|
|
73
|
-
afterLoaded,
|
|
74
|
-
afterRetrieve,
|
|
75
|
-
onUserInteraction,
|
|
76
|
-
beforeDisplay
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
var index_default = {
|
|
80
|
-
type,
|
|
81
|
-
hookMap,
|
|
82
|
-
initState,
|
|
83
|
-
beforeSave,
|
|
84
|
-
afterSave,
|
|
85
|
-
afterLoaded,
|
|
86
|
-
afterRetrieve,
|
|
87
|
-
onUserInteraction,
|
|
88
|
-
beforeDisplay
|
|
23
|
+
const hookMap = new Map(Object.entries({
|
|
24
|
+
beforeDisplay,
|
|
25
|
+
onUserInteraction
|
|
26
|
+
}));
|
|
27
|
+
const serverModule = {
|
|
28
|
+
type: _tailor_cms_ce_brightcove_video_manifest.type,
|
|
29
|
+
initState: _tailor_cms_ce_brightcove_video_manifest.initState,
|
|
30
|
+
hookMap,
|
|
31
|
+
beforeDisplay,
|
|
32
|
+
onUserInteraction
|
|
89
33
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
hookMap,
|
|
98
|
-
initState,
|
|
99
|
-
onUserInteraction,
|
|
100
|
-
type
|
|
101
|
-
});
|
|
34
|
+
//#endregion
|
|
35
|
+
exports.beforeDisplay = beforeDisplay;
|
|
36
|
+
exports.default = serverModule;
|
|
37
|
+
exports.hookMap = hookMap;
|
|
38
|
+
exports.initState = _tailor_cms_ce_brightcove_video_manifest.initState;
|
|
39
|
+
exports.onUserInteraction = onUserInteraction;
|
|
40
|
+
exports.type = _tailor_cms_ce_brightcove_video_manifest.type;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Element } from
|
|
3
|
-
export { initState, type } from '@tailor-cms/ce-brightcove-video-manifest';
|
|
4
|
-
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
1
|
+
import { BeforeDisplayHook, HookMap, OnUserInteractionHook, ServerModule } from "@tailor-cms/cek-common";
|
|
2
|
+
import { Element, initState, type } from "@tailor-cms/ce-brightcove-video-manifest";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
declare
|
|
8
|
-
declare
|
|
9
|
-
declare
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
declare const _default: {
|
|
14
|
-
type: string;
|
|
15
|
-
hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
16
|
-
initState: _tailor_cms_ce_brightcove_video_manifest.DataInitializer;
|
|
17
|
-
beforeSave: typeof beforeSave;
|
|
18
|
-
afterSave: typeof afterSave;
|
|
19
|
-
afterLoaded: typeof afterLoaded;
|
|
20
|
-
afterRetrieve: typeof afterRetrieve;
|
|
21
|
-
onUserInteraction: typeof onUserInteraction;
|
|
22
|
-
beforeDisplay: typeof beforeDisplay;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const beforeDisplay: BeforeDisplayHook<Element>;
|
|
6
|
+
declare const onUserInteraction: OnUserInteractionHook<Element>;
|
|
7
|
+
declare const hookMap: HookMap<Element>;
|
|
8
|
+
declare const serverModule: ServerModule<Element>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { beforeDisplay, serverModule as default, hookMap, initState, onUserInteraction, type };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Element, initState, type } from "@tailor-cms/ce-brightcove-video-manifest";
|
|
2
|
+
import { BeforeDisplayHook, HookMap, OnUserInteractionHook, ServerModule } from "@tailor-cms/cek-common";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
declare const beforeDisplay: BeforeDisplayHook<Element>;
|
|
6
|
+
declare const onUserInteraction: OnUserInteractionHook<Element>;
|
|
7
|
+
declare const hookMap: HookMap<Element>;
|
|
8
|
+
declare const serverModule: ServerModule<Element>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { beforeDisplay, serverModule as default, hookMap, initState, onUserInteraction, type };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { initState, type } from "@tailor-cms/ce-brightcove-video-manifest";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
const IS_CEK = process.env.CEK_RUNTIME;
|
|
4
|
+
const USER_STATE = {};
|
|
5
|
+
const beforeDisplay = (_element, context) => {
|
|
6
|
+
return {
|
|
7
|
+
...context,
|
|
8
|
+
...USER_STATE
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const onUserInteraction = (_element, context, payload) => {
|
|
12
|
+
const { currentTime, furthestTime } = payload;
|
|
13
|
+
if (IS_CEK) {
|
|
14
|
+
context.currentTime = currentTime;
|
|
15
|
+
context.furthestTime = Math.max(context.furthestTime ?? 0, furthestTime);
|
|
16
|
+
}
|
|
17
|
+
return { updateDisplayState: true };
|
|
18
|
+
};
|
|
19
|
+
const hookMap = new Map(Object.entries({
|
|
20
|
+
beforeDisplay,
|
|
21
|
+
onUserInteraction
|
|
22
|
+
}));
|
|
23
|
+
const serverModule = {
|
|
24
|
+
type,
|
|
25
|
+
initState,
|
|
26
|
+
hookMap,
|
|
27
|
+
beforeDisplay,
|
|
28
|
+
onUserInteraction
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { beforeDisplay, serverModule as default, hookMap, initState, onUserInteraction, type };
|
package/package.json
CHANGED
|
@@ -3,48 +3,43 @@
|
|
|
3
3
|
"description": "Tailor CMS Brightcove video element",
|
|
4
4
|
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.1
|
|
6
|
+
"version": "2.0.1",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"import": "./dist/index.
|
|
9
|
+
"import": "./dist/index.mjs",
|
|
10
10
|
"require": "./dist/index.cjs"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"main": "./dist/index.cjs",
|
|
14
|
-
"types": "./dist/index.d.
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@tailor-cms/cek-common": "2.0.1",
|
|
20
|
+
"@tailor-cms/ce-brightcove-video-manifest": "2.0.1"
|
|
21
|
+
},
|
|
18
22
|
"devDependencies": {
|
|
19
|
-
"@tailor-cms/
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"typescript": "^5.8.3",
|
|
23
|
-
"@tailor-cms/ce-brightcove-video-manifest": "0.1.0"
|
|
23
|
+
"@tailor-cms/eslint-config": "2.0.1",
|
|
24
|
+
"tsdown": "^0.21.10",
|
|
25
|
+
"typescript": "^6.0.3"
|
|
24
26
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"src/index.ts"
|
|
28
|
-
],
|
|
29
|
-
"target": [
|
|
30
|
-
"node14",
|
|
31
|
-
"es2022"
|
|
32
|
-
],
|
|
27
|
+
"tsdown": {
|
|
28
|
+
"target": "node24",
|
|
33
29
|
"format": [
|
|
34
30
|
"cjs",
|
|
35
31
|
"esm"
|
|
36
|
-
]
|
|
37
|
-
"bundle": true,
|
|
38
|
-
"minify": false,
|
|
39
|
-
"clean": false,
|
|
40
|
-
"dts": true
|
|
32
|
+
]
|
|
41
33
|
},
|
|
42
34
|
"publishConfig": {
|
|
43
35
|
"access": "public"
|
|
44
36
|
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=24"
|
|
39
|
+
},
|
|
45
40
|
"scripts": {
|
|
46
|
-
"dev": "
|
|
47
|
-
"build": "pnpm nuke:dist &&
|
|
41
|
+
"dev": "tsdown --watch src --watch ../manifest/dist",
|
|
42
|
+
"build": "pnpm nuke:dist && tsdown",
|
|
48
43
|
"lint": "eslint .",
|
|
49
44
|
"lint:fix": "pnpm lint --fix",
|
|
50
45
|
"nuke": "pnpm dlx del-cli dist node_modules",
|
package/dist/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as _tailor_cms_ce_brightcove_video_manifest from '@tailor-cms/ce-brightcove-video-manifest';
|
|
2
|
-
import { Element } from '@tailor-cms/ce-brightcove-video-manifest';
|
|
3
|
-
export { initState, type } from '@tailor-cms/ce-brightcove-video-manifest';
|
|
4
|
-
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
5
|
-
|
|
6
|
-
declare function beforeSave(element: Element, _services: HookServices): Element;
|
|
7
|
-
declare function afterSave(element: Element, _services: HookServices): Element;
|
|
8
|
-
declare function afterLoaded(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
9
|
-
declare function afterRetrieve(element: Element, _services: HookServices, _runtime: ServerRuntime): Element;
|
|
10
|
-
declare function beforeDisplay(_element: Element, context: any): any;
|
|
11
|
-
declare function onUserInteraction(_element: Element, context: any, payload: any): any;
|
|
12
|
-
declare const hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
13
|
-
declare const _default: {
|
|
14
|
-
type: string;
|
|
15
|
-
hookMap: Map<string, typeof beforeSave | typeof afterSave | typeof afterLoaded | typeof afterRetrieve | typeof onUserInteraction | typeof beforeDisplay>;
|
|
16
|
-
initState: _tailor_cms_ce_brightcove_video_manifest.DataInitializer;
|
|
17
|
-
beforeSave: typeof beforeSave;
|
|
18
|
-
afterSave: typeof afterSave;
|
|
19
|
-
afterLoaded: typeof afterLoaded;
|
|
20
|
-
afterRetrieve: typeof afterRetrieve;
|
|
21
|
-
onUserInteraction: typeof onUserInteraction;
|
|
22
|
-
beforeDisplay: typeof beforeDisplay;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
package/dist/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// ../manifest/dist/index.js
|
|
2
|
-
var type = "BRIGHTCOVE_VIDEO";
|
|
3
|
-
var initState = () => ({
|
|
4
|
-
accountId: "",
|
|
5
|
-
playerId: "",
|
|
6
|
-
videoId: ""
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
var IS_CEK = process.env.CEK_RUNTIME;
|
|
11
|
-
var USER_STATE = {};
|
|
12
|
-
function beforeSave(element, _services) {
|
|
13
|
-
return element;
|
|
14
|
-
}
|
|
15
|
-
function afterSave(element, _services) {
|
|
16
|
-
return element;
|
|
17
|
-
}
|
|
18
|
-
function afterLoaded(element, _services, _runtime) {
|
|
19
|
-
return element;
|
|
20
|
-
}
|
|
21
|
-
function afterRetrieve(element, _services, _runtime) {
|
|
22
|
-
return element;
|
|
23
|
-
}
|
|
24
|
-
function beforeDisplay(_element, context) {
|
|
25
|
-
return { ...context, ...USER_STATE };
|
|
26
|
-
}
|
|
27
|
-
function onUserInteraction(_element, context, payload) {
|
|
28
|
-
if (IS_CEK) {
|
|
29
|
-
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
30
|
-
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
31
|
-
Object.assign(USER_STATE, payload);
|
|
32
|
-
}
|
|
33
|
-
return { updateDisplayState: true };
|
|
34
|
-
}
|
|
35
|
-
var hookMap = new Map(
|
|
36
|
-
Object.entries({
|
|
37
|
-
beforeSave,
|
|
38
|
-
afterSave,
|
|
39
|
-
afterLoaded,
|
|
40
|
-
afterRetrieve,
|
|
41
|
-
onUserInteraction,
|
|
42
|
-
beforeDisplay
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
var index_default = {
|
|
46
|
-
type,
|
|
47
|
-
hookMap,
|
|
48
|
-
initState,
|
|
49
|
-
beforeSave,
|
|
50
|
-
afterSave,
|
|
51
|
-
afterLoaded,
|
|
52
|
-
afterRetrieve,
|
|
53
|
-
onUserInteraction,
|
|
54
|
-
beforeDisplay
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
afterLoaded,
|
|
58
|
-
afterRetrieve,
|
|
59
|
-
afterSave,
|
|
60
|
-
beforeDisplay,
|
|
61
|
-
beforeSave,
|
|
62
|
-
index_default as default,
|
|
63
|
-
hookMap,
|
|
64
|
-
initState,
|
|
65
|
-
onUserInteraction,
|
|
66
|
-
type
|
|
67
|
-
};
|