@tailor-cms/ce-flashcards-server 0.0.1 → 0.0.2
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 +4 -61
- package/dist/index.d.cts +3 -10
- package/dist/index.d.mts +3 -10
- package/dist/index.mjs +5 -55
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4,73 +4,16 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
});
|
|
5
5
|
let _tailor_cms_ce_flashcards_manifest = require("@tailor-cms/ce-flashcards-manifest");
|
|
6
6
|
//#region src/index.ts
|
|
7
|
-
const
|
|
8
|
-
const USER_STATE = {};
|
|
9
|
-
const beforeSave = (element) => {
|
|
10
|
-
console.log("Before save hook");
|
|
11
|
-
return element;
|
|
12
|
-
};
|
|
13
|
-
const afterSave = (element) => {
|
|
14
|
-
console.log("After save hook");
|
|
15
|
-
return element;
|
|
16
|
-
};
|
|
17
|
-
const afterLoaded = (element, _services, runtime) => {
|
|
18
|
-
console.log("After loaded hook", runtime);
|
|
19
|
-
return element;
|
|
20
|
-
};
|
|
21
|
-
const afterRetrieve = (element, _services, runtime) => {
|
|
22
|
-
console.log("After retrieve hook", runtime);
|
|
23
|
-
return element;
|
|
24
|
-
};
|
|
25
|
-
const beforeDisplay = (_element, context) => {
|
|
26
|
-
console.log("beforeDisplay hook");
|
|
27
|
-
console.log("beforeDisplay context", context);
|
|
28
|
-
return {
|
|
29
|
-
...context,
|
|
30
|
-
...USER_STATE
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
const onUserInteraction = (_element, context, payload) => {
|
|
34
|
-
console.log("onUserInteraction", context, payload);
|
|
35
|
-
if (IS_CEK) {
|
|
36
|
-
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
37
|
-
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
38
|
-
Object.assign(USER_STATE, payload);
|
|
39
|
-
}
|
|
40
|
-
return { updateDisplayState: true };
|
|
41
|
-
};
|
|
42
|
-
const procedures = {};
|
|
43
|
-
const hookMap = new Map(Object.entries({
|
|
44
|
-
beforeSave,
|
|
45
|
-
afterSave,
|
|
46
|
-
afterLoaded,
|
|
47
|
-
afterRetrieve,
|
|
48
|
-
onUserInteraction,
|
|
49
|
-
beforeDisplay
|
|
50
|
-
}));
|
|
7
|
+
const hookMap = /* @__PURE__ */ new Map();
|
|
51
8
|
const serverModule = {
|
|
52
9
|
type: _tailor_cms_ce_flashcards_manifest.type,
|
|
53
|
-
hookMap,
|
|
54
|
-
procedures,
|
|
55
10
|
initState: _tailor_cms_ce_flashcards_manifest.initState,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
afterLoaded,
|
|
59
|
-
afterRetrieve,
|
|
60
|
-
onUserInteraction,
|
|
61
|
-
beforeDisplay,
|
|
62
|
-
mocks: _tailor_cms_ce_flashcards_manifest.mocks
|
|
11
|
+
hookMap,
|
|
12
|
+
ai: _tailor_cms_ce_flashcards_manifest.ai
|
|
63
13
|
};
|
|
64
14
|
//#endregion
|
|
65
|
-
exports.
|
|
66
|
-
exports.afterRetrieve = afterRetrieve;
|
|
67
|
-
exports.afterSave = afterSave;
|
|
68
|
-
exports.beforeDisplay = beforeDisplay;
|
|
69
|
-
exports.beforeSave = beforeSave;
|
|
15
|
+
exports.ai = _tailor_cms_ce_flashcards_manifest.ai;
|
|
70
16
|
exports.default = serverModule;
|
|
71
17
|
exports.hookMap = hookMap;
|
|
72
18
|
exports.initState = _tailor_cms_ce_flashcards_manifest.initState;
|
|
73
|
-
exports.mocks = _tailor_cms_ce_flashcards_manifest.mocks;
|
|
74
|
-
exports.onUserInteraction = onUserInteraction;
|
|
75
|
-
exports.procedures = procedures;
|
|
76
19
|
exports.type = _tailor_cms_ce_flashcards_manifest.type;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Element, ai, initState, type } from "@tailor-cms/ce-flashcards-manifest";
|
|
2
|
+
import { HookMap, ServerModule } from "@tailor-cms/cek-common";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
declare const beforeSave: ElementHook<Element>;
|
|
6
|
-
declare const afterSave: ElementHook<Element>;
|
|
7
|
-
declare const afterLoaded: ElementHook<Element>;
|
|
8
|
-
declare const afterRetrieve: ElementHook<Element>;
|
|
9
|
-
declare const beforeDisplay: BeforeDisplayHook<Element>;
|
|
10
|
-
declare const onUserInteraction: OnUserInteractionHook<Element>;
|
|
11
|
-
declare const procedures: Record<string, ProcedureHandler>;
|
|
12
5
|
declare const hookMap: HookMap<Element>;
|
|
13
6
|
declare const serverModule: ServerModule<Element>;
|
|
14
7
|
//#endregion
|
|
15
|
-
export {
|
|
8
|
+
export { ai, serverModule as default, hookMap, initState, type };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { Element,
|
|
2
|
-
import {
|
|
1
|
+
import { Element, ai, initState, type } from "@tailor-cms/ce-flashcards-manifest";
|
|
2
|
+
import { HookMap, ServerModule } from "@tailor-cms/cek-common";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
declare const beforeSave: ElementHook<Element>;
|
|
6
|
-
declare const afterSave: ElementHook<Element>;
|
|
7
|
-
declare const afterLoaded: ElementHook<Element>;
|
|
8
|
-
declare const afterRetrieve: ElementHook<Element>;
|
|
9
|
-
declare const beforeDisplay: BeforeDisplayHook<Element>;
|
|
10
|
-
declare const onUserInteraction: OnUserInteractionHook<Element>;
|
|
11
|
-
declare const procedures: Record<string, ProcedureHandler>;
|
|
12
5
|
declare const hookMap: HookMap<Element>;
|
|
13
6
|
declare const serverModule: ServerModule<Element>;
|
|
14
7
|
//#endregion
|
|
15
|
-
export {
|
|
8
|
+
export { ai, serverModule as default, hookMap, initState, type };
|
package/dist/index.mjs
CHANGED
|
@@ -1,61 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ai, initState, type } from "@tailor-cms/ce-flashcards-manifest";
|
|
2
2
|
//#region src/index.ts
|
|
3
|
-
const
|
|
4
|
-
const USER_STATE = {};
|
|
5
|
-
const beforeSave = (element) => {
|
|
6
|
-
console.log("Before save hook");
|
|
7
|
-
return element;
|
|
8
|
-
};
|
|
9
|
-
const afterSave = (element) => {
|
|
10
|
-
console.log("After save hook");
|
|
11
|
-
return element;
|
|
12
|
-
};
|
|
13
|
-
const afterLoaded = (element, _services, runtime) => {
|
|
14
|
-
console.log("After loaded hook", runtime);
|
|
15
|
-
return element;
|
|
16
|
-
};
|
|
17
|
-
const afterRetrieve = (element, _services, runtime) => {
|
|
18
|
-
console.log("After retrieve hook", runtime);
|
|
19
|
-
return element;
|
|
20
|
-
};
|
|
21
|
-
const beforeDisplay = (_element, context) => {
|
|
22
|
-
console.log("beforeDisplay hook");
|
|
23
|
-
console.log("beforeDisplay context", context);
|
|
24
|
-
return {
|
|
25
|
-
...context,
|
|
26
|
-
...USER_STATE
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const onUserInteraction = (_element, context, payload) => {
|
|
30
|
-
console.log("onUserInteraction", context, payload);
|
|
31
|
-
if (IS_CEK) {
|
|
32
|
-
USER_STATE.interactionTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
33
|
-
context.contextTimestamp = USER_STATE.interactionTimestamp;
|
|
34
|
-
Object.assign(USER_STATE, payload);
|
|
35
|
-
}
|
|
36
|
-
return { updateDisplayState: true };
|
|
37
|
-
};
|
|
38
|
-
const procedures = {};
|
|
39
|
-
const hookMap = new Map(Object.entries({
|
|
40
|
-
beforeSave,
|
|
41
|
-
afterSave,
|
|
42
|
-
afterLoaded,
|
|
43
|
-
afterRetrieve,
|
|
44
|
-
onUserInteraction,
|
|
45
|
-
beforeDisplay
|
|
46
|
-
}));
|
|
3
|
+
const hookMap = /* @__PURE__ */ new Map();
|
|
47
4
|
const serverModule = {
|
|
48
5
|
type,
|
|
49
|
-
hookMap,
|
|
50
|
-
procedures,
|
|
51
6
|
initState,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
afterLoaded,
|
|
55
|
-
afterRetrieve,
|
|
56
|
-
onUserInteraction,
|
|
57
|
-
beforeDisplay,
|
|
58
|
-
mocks
|
|
7
|
+
hookMap,
|
|
8
|
+
ai
|
|
59
9
|
};
|
|
60
10
|
//#endregion
|
|
61
|
-
export {
|
|
11
|
+
export { ai, serverModule as default, hookMap, initState, type };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Tailor CMS flashcards 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.2",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"import": "./dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@tailor-cms/cek-common": "^2.0.1",
|
|
20
|
-
"@tailor-cms/ce-flashcards-manifest": "0.0.
|
|
20
|
+
"@tailor-cms/ce-flashcards-manifest": "0.0.2"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@tailor-cms/eslint-config": "^2.0.1",
|