@tailor-cms/ce-accordion-manifest 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 +98 -124
- package/dist/index.d.cts +15 -16
- package/dist/index.d.mts +28 -0
- package/dist/index.mjs +109 -0
- package/package.json +18 -25
- package/dist/index.d.ts +0 -29
- package/dist/index.js +0 -117
package/dist/index.cjs
CHANGED
|
@@ -1,88 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name2 in all)
|
|
7
|
-
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/index.ts
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
ai: () => ai,
|
|
23
|
-
default: () => index_default,
|
|
24
|
-
initState: () => initState,
|
|
25
|
-
name: () => name,
|
|
26
|
-
type: () => type,
|
|
27
|
-
version: () => version
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(index_exports);
|
|
30
|
-
var import_uuid = require("uuid");
|
|
31
|
-
var id1 = (0, import_uuid.v4)();
|
|
32
|
-
var id2 = (0, import_uuid.v4)();
|
|
33
|
-
var type = "ACCORDION";
|
|
34
|
-
var name = "Accordion";
|
|
35
|
-
var initState = () => ({
|
|
36
|
-
embeds: {},
|
|
37
|
-
items: {
|
|
38
|
-
[id1]: {
|
|
39
|
-
id: id1,
|
|
40
|
-
header: "Accordion Item Title",
|
|
41
|
-
body: {},
|
|
42
|
-
position: 1
|
|
43
|
-
},
|
|
44
|
-
[id2]: {
|
|
45
|
-
id: id2,
|
|
46
|
-
header: "Accordion Item Title",
|
|
47
|
-
body: {},
|
|
48
|
-
position: 1
|
|
49
|
-
}
|
|
50
|
-
}
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
51
4
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
5
|
+
let uuid = require("uuid");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
const type = "ACCORDION";
|
|
8
|
+
const name = "Accordion";
|
|
9
|
+
const initState = () => {
|
|
10
|
+
const id1 = (0, uuid.v4)();
|
|
11
|
+
const id2 = (0, uuid.v4)();
|
|
12
|
+
return {
|
|
13
|
+
embeds: {},
|
|
14
|
+
items: {
|
|
15
|
+
[id1]: {
|
|
16
|
+
id: id1,
|
|
17
|
+
header: "",
|
|
18
|
+
body: {},
|
|
19
|
+
position: 1
|
|
20
|
+
},
|
|
21
|
+
[id2]: {
|
|
22
|
+
id: id2,
|
|
23
|
+
header: "",
|
|
24
|
+
body: {},
|
|
25
|
+
position: 2
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
59
29
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
30
|
+
const version = "1.0";
|
|
31
|
+
const ui = {
|
|
32
|
+
icon: "mdi-view-day",
|
|
33
|
+
forceFullWidth: true
|
|
34
|
+
};
|
|
35
|
+
const isEmpty = (data) => !data.items || Object.keys(data.items).length === 0;
|
|
36
|
+
const ai = {
|
|
37
|
+
Schema: {
|
|
38
|
+
type: "json_schema",
|
|
39
|
+
name: "ce_accordion",
|
|
40
|
+
schema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: { items: {
|
|
43
|
+
type: "array",
|
|
44
|
+
minItems: 2,
|
|
45
|
+
items: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
header: { type: "string" },
|
|
49
|
+
content: { type: "string" }
|
|
50
|
+
},
|
|
51
|
+
required: ["header", "content"],
|
|
52
|
+
additionalProperties: false
|
|
53
|
+
}
|
|
54
|
+
} },
|
|
55
|
+
required: ["items"],
|
|
56
|
+
additionalProperties: false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
getPrompt: () => `
|
|
86
60
|
Generate a accordion content element as an object with the following
|
|
87
61
|
properties:
|
|
88
62
|
{
|
|
@@ -100,46 +74,46 @@ var ai = {
|
|
|
100
74
|
The content should be relevant to the topic of the accordion and
|
|
101
75
|
have a few paragraphs about the topic.
|
|
102
76
|
`,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
77
|
+
processResponse: (val) => {
|
|
78
|
+
return val.items.reduce((acc, { header, content }, index) => {
|
|
79
|
+
const embedId = (0, uuid.v4)();
|
|
80
|
+
const itemId = (0, uuid.v4)();
|
|
81
|
+
acc.embeds[embedId] = {
|
|
82
|
+
id: embedId,
|
|
83
|
+
data: { content },
|
|
84
|
+
embedded: true,
|
|
85
|
+
position: 1,
|
|
86
|
+
type: "TIPTAP_HTML"
|
|
87
|
+
};
|
|
88
|
+
acc.items[itemId] = {
|
|
89
|
+
id: itemId,
|
|
90
|
+
body: { [embedId]: true },
|
|
91
|
+
header,
|
|
92
|
+
position: index + 1
|
|
93
|
+
};
|
|
94
|
+
return acc;
|
|
95
|
+
}, {
|
|
96
|
+
items: {},
|
|
97
|
+
embeds: {}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
126
100
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
101
|
+
const manifest = {
|
|
102
|
+
type,
|
|
103
|
+
version: "1.0",
|
|
104
|
+
name,
|
|
105
|
+
isComposite: true,
|
|
106
|
+
ssr: false,
|
|
107
|
+
initState,
|
|
108
|
+
isEmpty,
|
|
109
|
+
ui,
|
|
110
|
+
ai
|
|
136
111
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
112
|
+
//#endregion
|
|
113
|
+
exports.ai = ai;
|
|
114
|
+
exports.default = manifest;
|
|
115
|
+
exports.initState = initState;
|
|
116
|
+
exports.isEmpty = isEmpty;
|
|
117
|
+
exports.name = name;
|
|
118
|
+
exports.type = type;
|
|
119
|
+
exports.version = version;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import * as common from
|
|
2
|
-
import {
|
|
1
|
+
import * as common from "@tailor-cms/cek-common";
|
|
2
|
+
import { AiConfig } from "@tailor-cms/cek-common";
|
|
3
3
|
|
|
4
|
+
//#region src/interfaces.d.ts
|
|
4
5
|
interface AccordionItem {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
header: string;
|
|
8
|
+
body: Record<string, any>;
|
|
9
|
+
position: number;
|
|
9
10
|
}
|
|
10
11
|
interface ElementData extends common.ElementConfig {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
embeds: Record<string, any>;
|
|
13
|
+
items: Record<string, AccordionItem>;
|
|
13
14
|
}
|
|
14
15
|
type DataInitializer = common.DataInitializer<ElementData>;
|
|
15
16
|
type Element = common.Element<ElementData>;
|
|
16
17
|
type ElementManifest = common.ElementManifest<ElementData>;
|
|
17
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
18
20
|
declare const type = "ACCORDION";
|
|
19
21
|
declare const name = "Accordion";
|
|
20
22
|
declare const initState: DataInitializer;
|
|
21
23
|
declare const version = "1.0";
|
|
22
|
-
declare const
|
|
23
|
-
|
|
24
|
-
getPrompt: () => string;
|
|
25
|
-
processResponse: (val: any) => any;
|
|
26
|
-
};
|
|
24
|
+
declare const isEmpty: (data: ElementData) => boolean;
|
|
25
|
+
declare const ai: AiConfig;
|
|
27
26
|
declare const manifest: ElementManifest;
|
|
28
|
-
|
|
29
|
-
export {
|
|
27
|
+
//#endregion
|
|
28
|
+
export { AccordionItem, DataInitializer, Element, ElementData, ElementManifest, ai, manifest as default, initState, isEmpty, name, type, version };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as common from "@tailor-cms/cek-common";
|
|
2
|
+
import { AiConfig } from "@tailor-cms/cek-common";
|
|
3
|
+
|
|
4
|
+
//#region src/interfaces.d.ts
|
|
5
|
+
interface AccordionItem {
|
|
6
|
+
id: string;
|
|
7
|
+
header: string;
|
|
8
|
+
body: Record<string, any>;
|
|
9
|
+
position: number;
|
|
10
|
+
}
|
|
11
|
+
interface ElementData extends common.ElementConfig {
|
|
12
|
+
embeds: Record<string, any>;
|
|
13
|
+
items: Record<string, AccordionItem>;
|
|
14
|
+
}
|
|
15
|
+
type DataInitializer = common.DataInitializer<ElementData>;
|
|
16
|
+
type Element = common.Element<ElementData>;
|
|
17
|
+
type ElementManifest = common.ElementManifest<ElementData>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
20
|
+
declare const type = "ACCORDION";
|
|
21
|
+
declare const name = "Accordion";
|
|
22
|
+
declare const initState: DataInitializer;
|
|
23
|
+
declare const version = "1.0";
|
|
24
|
+
declare const isEmpty: (data: ElementData) => boolean;
|
|
25
|
+
declare const ai: AiConfig;
|
|
26
|
+
declare const manifest: ElementManifest;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { AccordionItem, DataInitializer, Element, ElementData, ElementManifest, ai, manifest as default, initState, isEmpty, name, type, version };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { v4 } from "uuid";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
const type = "ACCORDION";
|
|
4
|
+
const name = "Accordion";
|
|
5
|
+
const initState = () => {
|
|
6
|
+
const id1 = v4();
|
|
7
|
+
const id2 = v4();
|
|
8
|
+
return {
|
|
9
|
+
embeds: {},
|
|
10
|
+
items: {
|
|
11
|
+
[id1]: {
|
|
12
|
+
id: id1,
|
|
13
|
+
header: "",
|
|
14
|
+
body: {},
|
|
15
|
+
position: 1
|
|
16
|
+
},
|
|
17
|
+
[id2]: {
|
|
18
|
+
id: id2,
|
|
19
|
+
header: "",
|
|
20
|
+
body: {},
|
|
21
|
+
position: 2
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const version = "1.0";
|
|
27
|
+
const ui = {
|
|
28
|
+
icon: "mdi-view-day",
|
|
29
|
+
forceFullWidth: true
|
|
30
|
+
};
|
|
31
|
+
const isEmpty = (data) => !data.items || Object.keys(data.items).length === 0;
|
|
32
|
+
const ai = {
|
|
33
|
+
Schema: {
|
|
34
|
+
type: "json_schema",
|
|
35
|
+
name: "ce_accordion",
|
|
36
|
+
schema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: { items: {
|
|
39
|
+
type: "array",
|
|
40
|
+
minItems: 2,
|
|
41
|
+
items: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
header: { type: "string" },
|
|
45
|
+
content: { type: "string" }
|
|
46
|
+
},
|
|
47
|
+
required: ["header", "content"],
|
|
48
|
+
additionalProperties: false
|
|
49
|
+
}
|
|
50
|
+
} },
|
|
51
|
+
required: ["items"],
|
|
52
|
+
additionalProperties: false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
getPrompt: () => `
|
|
56
|
+
Generate a accordion content element as an object with the following
|
|
57
|
+
properties:
|
|
58
|
+
{
|
|
59
|
+
"items": [
|
|
60
|
+
{
|
|
61
|
+
"header": "",
|
|
62
|
+
"content": ""
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
where:
|
|
67
|
+
- 'items' is an array of accordion item objects where:
|
|
68
|
+
- 'header' is the title of the accordion item.
|
|
69
|
+
- 'content' is the text to be displayed in the accordion item.
|
|
70
|
+
The content should be relevant to the topic of the accordion and
|
|
71
|
+
have a few paragraphs about the topic.
|
|
72
|
+
`,
|
|
73
|
+
processResponse: (val) => {
|
|
74
|
+
return val.items.reduce((acc, { header, content }, index) => {
|
|
75
|
+
const embedId = v4();
|
|
76
|
+
const itemId = v4();
|
|
77
|
+
acc.embeds[embedId] = {
|
|
78
|
+
id: embedId,
|
|
79
|
+
data: { content },
|
|
80
|
+
embedded: true,
|
|
81
|
+
position: 1,
|
|
82
|
+
type: "TIPTAP_HTML"
|
|
83
|
+
};
|
|
84
|
+
acc.items[itemId] = {
|
|
85
|
+
id: itemId,
|
|
86
|
+
body: { [embedId]: true },
|
|
87
|
+
header,
|
|
88
|
+
position: index + 1
|
|
89
|
+
};
|
|
90
|
+
return acc;
|
|
91
|
+
}, {
|
|
92
|
+
items: {},
|
|
93
|
+
embeds: {}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const manifest = {
|
|
98
|
+
type,
|
|
99
|
+
version: "1.0",
|
|
100
|
+
name,
|
|
101
|
+
isComposite: true,
|
|
102
|
+
ssr: false,
|
|
103
|
+
initState,
|
|
104
|
+
isEmpty,
|
|
105
|
+
ui,
|
|
106
|
+
ai
|
|
107
|
+
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { ai, manifest as default, initState, isEmpty, name, type, version };
|
package/package.json
CHANGED
|
@@ -3,50 +3,43 @@
|
|
|
3
3
|
"description": "Tailor CMS accordion 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
|
-
"devDependencies": {
|
|
19
|
-
"@tailor-cms/cek-common": "^1.3.2",
|
|
20
|
-
"@tailor-cms/eslint-config": "1.1.2",
|
|
21
|
-
"tsup": "^8.5.0",
|
|
22
|
-
"typescript": "^5.8.3"
|
|
23
|
-
},
|
|
24
18
|
"dependencies": {
|
|
25
|
-
"
|
|
19
|
+
"@tailor-cms/cek-common": "2.0.1",
|
|
20
|
+
"uuid": "^14.0.0"
|
|
26
21
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@tailor-cms/eslint-config": "2.0.1",
|
|
24
|
+
"tsdown": "^0.21.10",
|
|
25
|
+
"typescript": "^6.0.3"
|
|
26
|
+
},
|
|
27
|
+
"tsdown": {
|
|
28
|
+
"target": "node24",
|
|
35
29
|
"format": [
|
|
36
30
|
"cjs",
|
|
37
31
|
"esm"
|
|
38
|
-
]
|
|
39
|
-
"bundle": true,
|
|
40
|
-
"minify": false,
|
|
41
|
-
"clean": false,
|
|
42
|
-
"dts": true
|
|
32
|
+
]
|
|
43
33
|
},
|
|
44
34
|
"publishConfig": {
|
|
45
35
|
"access": "public"
|
|
46
36
|
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=24"
|
|
39
|
+
},
|
|
47
40
|
"scripts": {
|
|
48
|
-
"dev": "
|
|
49
|
-
"build": "pnpm nuke:dist &&
|
|
41
|
+
"dev": "tsdown --watch",
|
|
42
|
+
"build": "pnpm nuke:dist && tsdown",
|
|
50
43
|
"lint": "eslint .",
|
|
51
44
|
"lint:fix": "pnpm lint --fix",
|
|
52
45
|
"nuke": "pnpm dlx del-cli dist node_modules",
|
package/dist/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as common from '@tailor-cms/cek-common';
|
|
2
|
-
import { OpenAISchema } from '@tailor-cms/cek-common';
|
|
3
|
-
|
|
4
|
-
interface AccordionItem {
|
|
5
|
-
id: string;
|
|
6
|
-
header: string;
|
|
7
|
-
body: Record<string, any>;
|
|
8
|
-
position: number;
|
|
9
|
-
}
|
|
10
|
-
interface ElementData extends common.ElementConfig {
|
|
11
|
-
embeds: Record<string, any>;
|
|
12
|
-
items: Record<string, AccordionItem>;
|
|
13
|
-
}
|
|
14
|
-
type DataInitializer = common.DataInitializer<ElementData>;
|
|
15
|
-
type Element = common.Element<ElementData>;
|
|
16
|
-
type ElementManifest = common.ElementManifest<ElementData>;
|
|
17
|
-
|
|
18
|
-
declare const type = "ACCORDION";
|
|
19
|
-
declare const name = "Accordion";
|
|
20
|
-
declare const initState: DataInitializer;
|
|
21
|
-
declare const version = "1.0";
|
|
22
|
-
declare const ai: {
|
|
23
|
-
Schema: OpenAISchema;
|
|
24
|
-
getPrompt: () => string;
|
|
25
|
-
processResponse: (val: any) => any;
|
|
26
|
-
};
|
|
27
|
-
declare const manifest: ElementManifest;
|
|
28
|
-
|
|
29
|
-
export { type AccordionItem, type DataInitializer, type Element, type ElementData, type ElementManifest, ai, manifest as default, initState, name, type, version };
|
package/dist/index.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
import { v4 as uuid } from "uuid";
|
|
3
|
-
var id1 = uuid();
|
|
4
|
-
var id2 = uuid();
|
|
5
|
-
var type = "ACCORDION";
|
|
6
|
-
var name = "Accordion";
|
|
7
|
-
var initState = () => ({
|
|
8
|
-
embeds: {},
|
|
9
|
-
items: {
|
|
10
|
-
[id1]: {
|
|
11
|
-
id: id1,
|
|
12
|
-
header: "Accordion Item Title",
|
|
13
|
-
body: {},
|
|
14
|
-
position: 1
|
|
15
|
-
},
|
|
16
|
-
[id2]: {
|
|
17
|
-
id: id2,
|
|
18
|
-
header: "Accordion Item Title",
|
|
19
|
-
body: {},
|
|
20
|
-
position: 1
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var version = "1.0";
|
|
25
|
-
var ui = {
|
|
26
|
-
// Display icon, https://pictogrammers.com/library/mdi/
|
|
27
|
-
icon: "mdi-view-day",
|
|
28
|
-
// Does element support only full width or can be used within layouts
|
|
29
|
-
// (e.g. 50/50 layout)
|
|
30
|
-
forceFullWidth: true
|
|
31
|
-
};
|
|
32
|
-
var ai = {
|
|
33
|
-
Schema: {
|
|
34
|
-
type: "json_schema",
|
|
35
|
-
name: "ce_accordion",
|
|
36
|
-
schema: {
|
|
37
|
-
type: "object",
|
|
38
|
-
properties: {
|
|
39
|
-
items: {
|
|
40
|
-
type: "array",
|
|
41
|
-
minItems: 2,
|
|
42
|
-
items: {
|
|
43
|
-
type: "object",
|
|
44
|
-
properties: {
|
|
45
|
-
header: { type: "string" },
|
|
46
|
-
content: { type: "string" }
|
|
47
|
-
},
|
|
48
|
-
required: ["header", "content"],
|
|
49
|
-
additionalProperties: false
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
required: ["items"],
|
|
54
|
-
additionalProperties: false
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
getPrompt: () => `
|
|
58
|
-
Generate a accordion content element as an object with the following
|
|
59
|
-
properties:
|
|
60
|
-
{
|
|
61
|
-
"items": [
|
|
62
|
-
{
|
|
63
|
-
"header": "",
|
|
64
|
-
"content": ""
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
where:
|
|
69
|
-
- 'items' is an array of accordion item objects where:
|
|
70
|
-
- 'header' is the title of the accordion item.
|
|
71
|
-
- 'content' is the text to be displayed in the accordion item.
|
|
72
|
-
The content should be relevant to the topic of the accordion and
|
|
73
|
-
have a few paragraphs about the topic.
|
|
74
|
-
`,
|
|
75
|
-
processResponse: (val) => {
|
|
76
|
-
return val.items.reduce(
|
|
77
|
-
(acc, { header, content }, index) => {
|
|
78
|
-
const embedId = uuid();
|
|
79
|
-
const itemId = uuid();
|
|
80
|
-
acc.embeds[embedId] = {
|
|
81
|
-
id: embedId,
|
|
82
|
-
data: { content },
|
|
83
|
-
embedded: true,
|
|
84
|
-
position: 1,
|
|
85
|
-
type: "TIPTAP_HTML"
|
|
86
|
-
};
|
|
87
|
-
acc.items[itemId] = {
|
|
88
|
-
id: itemId,
|
|
89
|
-
body: { [embedId]: true },
|
|
90
|
-
header,
|
|
91
|
-
position: index + 1
|
|
92
|
-
};
|
|
93
|
-
return acc;
|
|
94
|
-
},
|
|
95
|
-
{ items: {}, embeds: {} }
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
var manifest = {
|
|
100
|
-
type,
|
|
101
|
-
version: "1.0",
|
|
102
|
-
name,
|
|
103
|
-
isComposite: true,
|
|
104
|
-
ssr: false,
|
|
105
|
-
initState,
|
|
106
|
-
ui,
|
|
107
|
-
ai
|
|
108
|
-
};
|
|
109
|
-
var index_default = manifest;
|
|
110
|
-
export {
|
|
111
|
-
ai,
|
|
112
|
-
index_default as default,
|
|
113
|
-
initState,
|
|
114
|
-
name,
|
|
115
|
-
type,
|
|
116
|
-
version
|
|
117
|
-
};
|