@tailor-cms/ce-embed-server 0.0.2 → 0.0.4
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 +1 -14
- package/dist/index.d.cts +1 -7
- package/dist/index.d.ts +1 -7
- package/dist/index.js +1 -13
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,6 @@ __export(src_exports, {
|
|
|
27
27
|
default: () => src_default,
|
|
28
28
|
hookMap: () => hookMap,
|
|
29
29
|
initState: () => initState,
|
|
30
|
-
mocks: () => mocks,
|
|
31
30
|
onUserInteraction: () => onUserInteraction,
|
|
32
31
|
type: () => type
|
|
33
32
|
});
|
|
@@ -36,36 +35,26 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
35
|
// ../manifest/dist/index.js
|
|
37
36
|
var type = "CE_EMBED";
|
|
38
37
|
var initState = () => ({ height: 260 });
|
|
39
|
-
var mocks = {
|
|
40
|
-
displayContexts: [{ name: "No selection", data: {} }]
|
|
41
|
-
};
|
|
42
38
|
|
|
43
39
|
// src/index.ts
|
|
44
40
|
var IS_CEK = process.env.CEK_RUNTIME;
|
|
45
41
|
var USER_STATE = {};
|
|
46
42
|
function beforeSave(element, services) {
|
|
47
|
-
console.log("Before save hook");
|
|
48
43
|
return element;
|
|
49
44
|
}
|
|
50
45
|
function afterSave(element, services) {
|
|
51
|
-
console.log("After save hook");
|
|
52
46
|
return element;
|
|
53
47
|
}
|
|
54
48
|
function afterLoaded(element, services, runtime) {
|
|
55
|
-
console.log("After loaded hook");
|
|
56
49
|
return element;
|
|
57
50
|
}
|
|
58
51
|
function afterRetrieve(element, services, runtime) {
|
|
59
|
-
console.log("After retrieve hook");
|
|
60
52
|
return element;
|
|
61
53
|
}
|
|
62
54
|
function beforeDisplay(element, context) {
|
|
63
|
-
console.log("beforeDisplay hook");
|
|
64
|
-
console.log("beforeDisplay context", context);
|
|
65
55
|
return { ...context, ...USER_STATE };
|
|
66
56
|
}
|
|
67
57
|
function onUserInteraction(element, context, payload) {
|
|
68
|
-
console.log("onUserInteraction", context, payload);
|
|
69
58
|
if (IS_CEK) {
|
|
70
59
|
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
71
60
|
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
@@ -92,8 +81,7 @@ var src_default = {
|
|
|
92
81
|
afterLoaded,
|
|
93
82
|
afterRetrieve,
|
|
94
83
|
onUserInteraction,
|
|
95
|
-
beforeDisplay
|
|
96
|
-
mocks
|
|
84
|
+
beforeDisplay
|
|
97
85
|
};
|
|
98
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
87
|
0 && (module.exports = {
|
|
@@ -104,7 +92,6 @@ var src_default = {
|
|
|
104
92
|
beforeSave,
|
|
105
93
|
hookMap,
|
|
106
94
|
initState,
|
|
107
|
-
mocks,
|
|
108
95
|
onUserInteraction,
|
|
109
96
|
type
|
|
110
97
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tailor_cms_ce_embed_manifest from '@tailor-cms/ce-embed-manifest';
|
|
2
2
|
import { Element } from '@tailor-cms/ce-embed-manifest';
|
|
3
|
-
export { initState,
|
|
3
|
+
export { initState, type } from '@tailor-cms/ce-embed-manifest';
|
|
4
4
|
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
5
5
|
|
|
6
6
|
declare function beforeSave(element: Element, services: HookServices): Element;
|
|
@@ -20,12 +20,6 @@ declare const _default: {
|
|
|
20
20
|
afterRetrieve: typeof afterRetrieve;
|
|
21
21
|
onUserInteraction: typeof onUserInteraction;
|
|
22
22
|
beforeDisplay: typeof beforeDisplay;
|
|
23
|
-
mocks: {
|
|
24
|
-
displayContexts: {
|
|
25
|
-
name: string;
|
|
26
|
-
data: {};
|
|
27
|
-
}[];
|
|
28
|
-
};
|
|
29
23
|
};
|
|
30
24
|
|
|
31
25
|
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _tailor_cms_ce_embed_manifest from '@tailor-cms/ce-embed-manifest';
|
|
2
2
|
import { Element } from '@tailor-cms/ce-embed-manifest';
|
|
3
|
-
export { initState,
|
|
3
|
+
export { initState, type } from '@tailor-cms/ce-embed-manifest';
|
|
4
4
|
import { HookServices, ServerRuntime } from '@tailor-cms/cek-common';
|
|
5
5
|
|
|
6
6
|
declare function beforeSave(element: Element, services: HookServices): Element;
|
|
@@ -20,12 +20,6 @@ declare const _default: {
|
|
|
20
20
|
afterRetrieve: typeof afterRetrieve;
|
|
21
21
|
onUserInteraction: typeof onUserInteraction;
|
|
22
22
|
beforeDisplay: typeof beforeDisplay;
|
|
23
|
-
mocks: {
|
|
24
|
-
displayContexts: {
|
|
25
|
-
name: string;
|
|
26
|
-
data: {};
|
|
27
|
-
}[];
|
|
28
|
-
};
|
|
29
23
|
};
|
|
30
24
|
|
|
31
25
|
export { afterLoaded, afterRetrieve, afterSave, beforeDisplay, beforeSave, _default as default, hookMap, onUserInteraction };
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
// ../manifest/dist/index.js
|
|
2
2
|
var type = "CE_EMBED";
|
|
3
3
|
var initState = () => ({ height: 260 });
|
|
4
|
-
var mocks = {
|
|
5
|
-
displayContexts: [{ name: "No selection", data: {} }]
|
|
6
|
-
};
|
|
7
4
|
|
|
8
5
|
// src/index.ts
|
|
9
6
|
var IS_CEK = process.env.CEK_RUNTIME;
|
|
10
7
|
var USER_STATE = {};
|
|
11
8
|
function beforeSave(element, services) {
|
|
12
|
-
console.log("Before save hook");
|
|
13
9
|
return element;
|
|
14
10
|
}
|
|
15
11
|
function afterSave(element, services) {
|
|
16
|
-
console.log("After save hook");
|
|
17
12
|
return element;
|
|
18
13
|
}
|
|
19
14
|
function afterLoaded(element, services, runtime) {
|
|
20
|
-
console.log("After loaded hook");
|
|
21
15
|
return element;
|
|
22
16
|
}
|
|
23
17
|
function afterRetrieve(element, services, runtime) {
|
|
24
|
-
console.log("After retrieve hook");
|
|
25
18
|
return element;
|
|
26
19
|
}
|
|
27
20
|
function beforeDisplay(element, context) {
|
|
28
|
-
console.log("beforeDisplay hook");
|
|
29
|
-
console.log("beforeDisplay context", context);
|
|
30
21
|
return { ...context, ...USER_STATE };
|
|
31
22
|
}
|
|
32
23
|
function onUserInteraction(element, context, payload) {
|
|
33
|
-
console.log("onUserInteraction", context, payload);
|
|
34
24
|
if (IS_CEK) {
|
|
35
25
|
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
36
26
|
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
@@ -57,8 +47,7 @@ var src_default = {
|
|
|
57
47
|
afterLoaded,
|
|
58
48
|
afterRetrieve,
|
|
59
49
|
onUserInteraction,
|
|
60
|
-
beforeDisplay
|
|
61
|
-
mocks
|
|
50
|
+
beforeDisplay
|
|
62
51
|
};
|
|
63
52
|
export {
|
|
64
53
|
afterLoaded,
|
|
@@ -69,7 +58,6 @@ export {
|
|
|
69
58
|
src_default as default,
|
|
70
59
|
hookMap,
|
|
71
60
|
initState,
|
|
72
|
-
mocks,
|
|
73
61
|
onUserInteraction,
|
|
74
62
|
type
|
|
75
63
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tailor-cms/ce-embed-server",
|
|
3
|
-
"description": "Tailor CMS embed element",
|
|
3
|
+
"description": "Tailor CMS embed element server component",
|
|
4
4
|
"author": "Studion <info@gostudion.com> (https://github.com/tailor-cms)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.4",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@tailor-cms/eslint-config": "0.0.2",
|
|
21
21
|
"tsup": "^7.2.0",
|
|
22
22
|
"typescript": "^5.1.6",
|
|
23
|
-
"@tailor-cms/ce-embed-manifest": "0.0.
|
|
23
|
+
"@tailor-cms/ce-embed-manifest": "0.0.4"
|
|
24
24
|
},
|
|
25
25
|
"tsup": {
|
|
26
26
|
"entry": [
|