admin-lib-cms 1.2.5 → 1.2.7
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.d.mts +28 -22
- package/dist/index.d.ts +28 -22
- package/dist/index.js +461 -122
- package/dist/index.mjs +471 -132
- package/dist/types.d.mts +17 -1
- package/dist/types.d.ts +17 -1
- package/package.json +2 -2
- package/dist/chunk-6DZX6EAA.mjs +0 -37
- package/dist/chunk-CQW7KMB2.mjs +0 -120
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-ZG5XBIW7.mjs +0 -152
- package/dist/email.d.mts +0 -3
- package/dist/email.d.ts +0 -3
- package/dist/email.js +0 -144
- package/dist/email.mjs +0 -6
- package/dist/types-uBvGNd4_.d.mts +0 -78
- package/dist/types-uBvGNd4_.d.ts +0 -78
package/dist/types.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ interface CollectionField {
|
|
|
39
39
|
}[];
|
|
40
40
|
collection?: string;
|
|
41
41
|
displayField?: string;
|
|
42
|
+
valueField?: string;
|
|
42
43
|
source?: string;
|
|
43
44
|
hidden?: boolean;
|
|
44
45
|
multiple?: boolean;
|
|
@@ -52,18 +53,33 @@ interface CollectionDef {
|
|
|
52
53
|
fields: CollectionField[];
|
|
53
54
|
searchBy?: string[];
|
|
54
55
|
filterBy?: string[];
|
|
56
|
+
isSeparator?: boolean;
|
|
55
57
|
}
|
|
56
58
|
interface GlobalGroup {
|
|
57
59
|
id: string;
|
|
58
60
|
label: string;
|
|
59
61
|
fields: EditableMeta[];
|
|
60
62
|
}
|
|
63
|
+
interface MenuLabels {
|
|
64
|
+
dashboard?: string;
|
|
65
|
+
pages?: string;
|
|
66
|
+
collections?: string;
|
|
67
|
+
data?: string;
|
|
68
|
+
config?: string;
|
|
69
|
+
settings?: string;
|
|
70
|
+
subscription?: string;
|
|
71
|
+
}
|
|
61
72
|
interface CmsConfig {
|
|
62
73
|
siteName?: string;
|
|
63
74
|
pages: PageDef[];
|
|
64
75
|
collections?: CollectionDef[];
|
|
65
76
|
globals?: GlobalGroup[];
|
|
66
77
|
components?: PageDef[];
|
|
78
|
+
hideData?: boolean;
|
|
79
|
+
hideSettings?: boolean;
|
|
80
|
+
hideConfig?: boolean;
|
|
81
|
+
menuLabels?: MenuLabels;
|
|
82
|
+
showDashboard?: boolean;
|
|
67
83
|
}
|
|
68
84
|
type OverridesMap = Record<string, unknown>;
|
|
69
85
|
type CollectionEntry = {
|
|
@@ -92,4 +108,4 @@ interface StorageAdapter {
|
|
|
92
108
|
uploadImage?: (file: File) => Promise<string>;
|
|
93
109
|
}
|
|
94
110
|
|
|
95
|
-
export type { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, OverridesMap, PageDef, StorageAdapter, Submission };
|
|
111
|
+
export type { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, MenuLabels, OverridesMap, PageDef, StorageAdapter, Submission };
|
package/dist/types.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface CollectionField {
|
|
|
39
39
|
}[];
|
|
40
40
|
collection?: string;
|
|
41
41
|
displayField?: string;
|
|
42
|
+
valueField?: string;
|
|
42
43
|
source?: string;
|
|
43
44
|
hidden?: boolean;
|
|
44
45
|
multiple?: boolean;
|
|
@@ -52,18 +53,33 @@ interface CollectionDef {
|
|
|
52
53
|
fields: CollectionField[];
|
|
53
54
|
searchBy?: string[];
|
|
54
55
|
filterBy?: string[];
|
|
56
|
+
isSeparator?: boolean;
|
|
55
57
|
}
|
|
56
58
|
interface GlobalGroup {
|
|
57
59
|
id: string;
|
|
58
60
|
label: string;
|
|
59
61
|
fields: EditableMeta[];
|
|
60
62
|
}
|
|
63
|
+
interface MenuLabels {
|
|
64
|
+
dashboard?: string;
|
|
65
|
+
pages?: string;
|
|
66
|
+
collections?: string;
|
|
67
|
+
data?: string;
|
|
68
|
+
config?: string;
|
|
69
|
+
settings?: string;
|
|
70
|
+
subscription?: string;
|
|
71
|
+
}
|
|
61
72
|
interface CmsConfig {
|
|
62
73
|
siteName?: string;
|
|
63
74
|
pages: PageDef[];
|
|
64
75
|
collections?: CollectionDef[];
|
|
65
76
|
globals?: GlobalGroup[];
|
|
66
77
|
components?: PageDef[];
|
|
78
|
+
hideData?: boolean;
|
|
79
|
+
hideSettings?: boolean;
|
|
80
|
+
hideConfig?: boolean;
|
|
81
|
+
menuLabels?: MenuLabels;
|
|
82
|
+
showDashboard?: boolean;
|
|
67
83
|
}
|
|
68
84
|
type OverridesMap = Record<string, unknown>;
|
|
69
85
|
type CollectionEntry = {
|
|
@@ -92,4 +108,4 @@ interface StorageAdapter {
|
|
|
92
108
|
uploadImage?: (file: File) => Promise<string>;
|
|
93
109
|
}
|
|
94
110
|
|
|
95
|
-
export type { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, OverridesMap, PageDef, StorageAdapter, Submission };
|
|
111
|
+
export type { CmsConfig, CollectionDef, CollectionEntry, CollectionField, EditableMeta, FieldType, GlobalGroup, MenuLabels, OverridesMap, PageDef, StorageAdapter, Submission };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "admin-lib-cms",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Agnostic Admin CMS Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"typescript": "^5.0.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@sanity/client": "^6.15.0 || ^7.0.0",
|
|
89
|
+
"@sanity/client": "^6.15.0 || ^7.0.0 || ^8.0.0",
|
|
90
90
|
"firebase": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
91
91
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
92
92
|
"react": "^18.0.0 || ^19.0.0",
|
package/dist/chunk-6DZX6EAA.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
14
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
-
};
|
|
16
|
-
var __copyProps = (to, from, except, desc) => {
|
|
17
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
-
for (let key of __getOwnPropNames(from))
|
|
19
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
-
}
|
|
22
|
-
return to;
|
|
23
|
-
};
|
|
24
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
-
mod
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
export {
|
|
34
|
-
__require,
|
|
35
|
-
__commonJS,
|
|
36
|
-
__toESM
|
|
37
|
-
};
|
package/dist/chunk-CQW7KMB2.mjs
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
// src/email.ts
|
|
2
|
-
function generateEmailTemplate(data, title, description) {
|
|
3
|
-
const items = Object.entries(data).filter(([_, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => {
|
|
4
|
-
const label = key.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
|
|
5
|
-
const displayValue = Array.isArray(value) ? value.join(", ") : String(value);
|
|
6
|
-
return `
|
|
7
|
-
<div class="detail-item">
|
|
8
|
-
<span class="detail-label">${label}</span>
|
|
9
|
-
<span class="detail-value">${displayValue}</span>
|
|
10
|
-
</div>
|
|
11
|
-
`;
|
|
12
|
-
}).join("");
|
|
13
|
-
return `
|
|
14
|
-
<!DOCTYPE html>
|
|
15
|
-
<html lang="en">
|
|
16
|
-
<head>
|
|
17
|
-
<meta charset="UTF-8">
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
<title>${title}</title>
|
|
20
|
-
<style>
|
|
21
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
22
|
-
body {
|
|
23
|
-
background-color: #f4f4f5;
|
|
24
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
25
|
-
color: #18181b;
|
|
26
|
-
line-height: 1.5;
|
|
27
|
-
}
|
|
28
|
-
.wrapper { width: 100%; padding: 40px 20px; }
|
|
29
|
-
.container { max-width: 600px; margin: 0 auto; }
|
|
30
|
-
.card {
|
|
31
|
-
background: #ffffff;
|
|
32
|
-
border-radius: 12px;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
35
|
-
border: 1px solid #e4e4e7;
|
|
36
|
-
}
|
|
37
|
-
.header {
|
|
38
|
-
background: #5fa075;
|
|
39
|
-
padding: 40px 32px;
|
|
40
|
-
text-align: center;
|
|
41
|
-
border-bottom: 4px solid #48805c;
|
|
42
|
-
}
|
|
43
|
-
.header h1 {
|
|
44
|
-
color: #ffffff;
|
|
45
|
-
font-size: 24px;
|
|
46
|
-
font-weight: 700;
|
|
47
|
-
margin-bottom: 8px;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
letter-spacing: 0.05em;
|
|
50
|
-
}
|
|
51
|
-
.header p {
|
|
52
|
-
color: rgba(255, 255, 255, 0.9);
|
|
53
|
-
font-size: 14px;
|
|
54
|
-
}
|
|
55
|
-
.content { padding: 32px; }
|
|
56
|
-
.details-grid {
|
|
57
|
-
display: grid;
|
|
58
|
-
gap: 12px;
|
|
59
|
-
margin-bottom: 24px;
|
|
60
|
-
}
|
|
61
|
-
.detail-item {
|
|
62
|
-
background: #fafafa;
|
|
63
|
-
padding: 12px 16px;
|
|
64
|
-
border-radius: 8px;
|
|
65
|
-
border: 1px solid #f1f1f4;
|
|
66
|
-
}
|
|
67
|
-
.detail-label {
|
|
68
|
-
font-size: 11px;
|
|
69
|
-
font-weight: 700;
|
|
70
|
-
color: #71717a;
|
|
71
|
-
text-transform: uppercase;
|
|
72
|
-
letter-spacing: 0.05em;
|
|
73
|
-
display: block;
|
|
74
|
-
margin-bottom: 4px;
|
|
75
|
-
}
|
|
76
|
-
.detail-value {
|
|
77
|
-
font-size: 14px;
|
|
78
|
-
font-weight: 500;
|
|
79
|
-
color: #18181b;
|
|
80
|
-
word-break: break-word;
|
|
81
|
-
}
|
|
82
|
-
.footer {
|
|
83
|
-
padding: 24px 32px;
|
|
84
|
-
background: #f8fafc;
|
|
85
|
-
border-top: 1px solid #e2e8f0;
|
|
86
|
-
text-align: center;
|
|
87
|
-
}
|
|
88
|
-
.footer-text {
|
|
89
|
-
font-size: 12px;
|
|
90
|
-
color: #64748b;
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
93
|
-
</head>
|
|
94
|
-
<body>
|
|
95
|
-
<div class="wrapper">
|
|
96
|
-
<div class="container">
|
|
97
|
-
<div class="card">
|
|
98
|
-
<div class="header">
|
|
99
|
-
<h1>${title}</h1>
|
|
100
|
-
<p>${description}</p>
|
|
101
|
-
</div>
|
|
102
|
-
<div class="content">
|
|
103
|
-
<div class="details-grid">
|
|
104
|
-
${items}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
<div class="footer">
|
|
108
|
-
<p class="footer-text">\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} Serenity Wellness. This is an automated notification.</p>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</body>
|
|
114
|
-
</html>
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export {
|
|
119
|
-
generateEmailTemplate
|
|
120
|
-
};
|
package/dist/chunk-Y6FXYEAI.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
__require
|
|
10
|
-
};
|
package/dist/chunk-ZG5XBIW7.mjs
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// src/emails/templates/default.ts
|
|
2
|
-
function generateDefaultTemplate(data, title, description, companyName = "Admin CMS") {
|
|
3
|
-
const items = Object.entries(data).filter(([_, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => {
|
|
4
|
-
const label = key.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
|
|
5
|
-
const displayValue = Array.isArray(value) ? value.join(", ") : String(value);
|
|
6
|
-
return `
|
|
7
|
-
<div class="detail-item">
|
|
8
|
-
<span class="detail-label">${label}</span>
|
|
9
|
-
<span class="detail-value">${displayValue}</span>
|
|
10
|
-
</div>
|
|
11
|
-
`;
|
|
12
|
-
}).join("");
|
|
13
|
-
return `
|
|
14
|
-
<!DOCTYPE html>
|
|
15
|
-
<html lang="en">
|
|
16
|
-
<head>
|
|
17
|
-
<meta charset="UTF-8">
|
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
19
|
-
<title>${title}</title>
|
|
20
|
-
<style>
|
|
21
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
22
|
-
body {
|
|
23
|
-
background-color: #f4f4f5;
|
|
24
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
25
|
-
color: #18181b;
|
|
26
|
-
line-height: 1.5;
|
|
27
|
-
}
|
|
28
|
-
.wrapper { width: 100%; padding: 40px 20px; }
|
|
29
|
-
.container { max-width: 600px; margin: 0 auto; }
|
|
30
|
-
.card {
|
|
31
|
-
background: #ffffff;
|
|
32
|
-
border-radius: 12px;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
35
|
-
border: 1px solid #e4e4e7;
|
|
36
|
-
}
|
|
37
|
-
.header {
|
|
38
|
-
background: #1a2d42;
|
|
39
|
-
padding: 40px 32px;
|
|
40
|
-
text-align: center;
|
|
41
|
-
border-bottom: 4px solid #d4af37;
|
|
42
|
-
}
|
|
43
|
-
.header h1 {
|
|
44
|
-
color: #ffffff;
|
|
45
|
-
font-size: 24px;
|
|
46
|
-
font-weight: 700;
|
|
47
|
-
margin-bottom: 8px;
|
|
48
|
-
text-transform: uppercase;
|
|
49
|
-
letter-spacing: 0.05em;
|
|
50
|
-
}
|
|
51
|
-
.header p {
|
|
52
|
-
color: rgba(255, 255, 255, 0.9);
|
|
53
|
-
font-size: 14px;
|
|
54
|
-
}
|
|
55
|
-
.content { padding: 32px; }
|
|
56
|
-
.details-grid {
|
|
57
|
-
display: grid;
|
|
58
|
-
gap: 12px;
|
|
59
|
-
margin-bottom: 24px;
|
|
60
|
-
}
|
|
61
|
-
.detail-item {
|
|
62
|
-
background: #fafafa;
|
|
63
|
-
padding: 12px 16px;
|
|
64
|
-
border-radius: 8px;
|
|
65
|
-
border: 1px solid #f1f1f4;
|
|
66
|
-
}
|
|
67
|
-
.detail-label {
|
|
68
|
-
font-size: 11px;
|
|
69
|
-
font-weight: 700;
|
|
70
|
-
color: #71717a;
|
|
71
|
-
text-transform: uppercase;
|
|
72
|
-
letter-spacing: 0.05em;
|
|
73
|
-
display: block;
|
|
74
|
-
margin-bottom: 4px;
|
|
75
|
-
}
|
|
76
|
-
.detail-value {
|
|
77
|
-
font-size: 14px;
|
|
78
|
-
font-weight: 500;
|
|
79
|
-
color: #18181b;
|
|
80
|
-
word-break: break-word;
|
|
81
|
-
}
|
|
82
|
-
.footer {
|
|
83
|
-
padding: 24px 32px;
|
|
84
|
-
background: #f8fafc;
|
|
85
|
-
border-top: 1px solid #e2e8f0;
|
|
86
|
-
text-align: center;
|
|
87
|
-
}
|
|
88
|
-
.footer-text {
|
|
89
|
-
font-size: 12px;
|
|
90
|
-
color: #64748b;
|
|
91
|
-
}
|
|
92
|
-
</style>
|
|
93
|
-
</head>
|
|
94
|
-
<body>
|
|
95
|
-
<div class="wrapper">
|
|
96
|
-
<div class="container">
|
|
97
|
-
<div class="card">
|
|
98
|
-
<div class="header">
|
|
99
|
-
<h1>${title}</h1>
|
|
100
|
-
<p>${description}</p>
|
|
101
|
-
</div>
|
|
102
|
-
<div class="content">
|
|
103
|
-
<div class="details-grid">
|
|
104
|
-
${items}
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
<div class="footer">
|
|
108
|
-
<p class="footer-text">\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} ${companyName}. This is an automated notification.</p>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</body>
|
|
114
|
-
</html>
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/emails/index.ts
|
|
119
|
-
async function sendEmailNotification(content, apiUrl) {
|
|
120
|
-
try {
|
|
121
|
-
const url = apiUrl || process.env.API_URL || process.env.NEXT_PUBLIC_API_URL || "";
|
|
122
|
-
const response = await fetch(`${url}/api/send-email`, {
|
|
123
|
-
method: "POST",
|
|
124
|
-
headers: {
|
|
125
|
-
"Content-Type": "application/json"
|
|
126
|
-
},
|
|
127
|
-
body: JSON.stringify({
|
|
128
|
-
content: {
|
|
129
|
-
...content,
|
|
130
|
-
from: content.from || "Admin CMS <notifications@admincms.com>"
|
|
131
|
-
}
|
|
132
|
-
})
|
|
133
|
-
});
|
|
134
|
-
if (response.ok) {
|
|
135
|
-
const result = await response.json();
|
|
136
|
-
if (!result.success) {
|
|
137
|
-
console.error("Failed to send email:", result.error);
|
|
138
|
-
}
|
|
139
|
-
return result;
|
|
140
|
-
} else {
|
|
141
|
-
console.warn("Email API endpoint error:", response.status);
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
console.error("Error sending email:", error);
|
|
145
|
-
}
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export {
|
|
150
|
-
generateDefaultTemplate,
|
|
151
|
-
sendEmailNotification
|
|
152
|
-
};
|
package/dist/email.d.mts
DELETED
package/dist/email.d.ts
DELETED
package/dist/email.js
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/email.ts
|
|
21
|
-
var email_exports = {};
|
|
22
|
-
__export(email_exports, {
|
|
23
|
-
generateEmailTemplate: () => generateEmailTemplate
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(email_exports);
|
|
26
|
-
function generateEmailTemplate(data, title, description) {
|
|
27
|
-
const items = Object.entries(data).filter(([_, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => {
|
|
28
|
-
const label = key.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
|
|
29
|
-
const displayValue = Array.isArray(value) ? value.join(", ") : String(value);
|
|
30
|
-
return `
|
|
31
|
-
<div class="detail-item">
|
|
32
|
-
<span class="detail-label">${label}</span>
|
|
33
|
-
<span class="detail-value">${displayValue}</span>
|
|
34
|
-
</div>
|
|
35
|
-
`;
|
|
36
|
-
}).join("");
|
|
37
|
-
return `
|
|
38
|
-
<!DOCTYPE html>
|
|
39
|
-
<html lang="en">
|
|
40
|
-
<head>
|
|
41
|
-
<meta charset="UTF-8">
|
|
42
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
43
|
-
<title>${title}</title>
|
|
44
|
-
<style>
|
|
45
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
46
|
-
body {
|
|
47
|
-
background-color: #f4f4f5;
|
|
48
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
49
|
-
color: #18181b;
|
|
50
|
-
line-height: 1.5;
|
|
51
|
-
}
|
|
52
|
-
.wrapper { width: 100%; padding: 40px 20px; }
|
|
53
|
-
.container { max-width: 600px; margin: 0 auto; }
|
|
54
|
-
.card {
|
|
55
|
-
background: #ffffff;
|
|
56
|
-
border-radius: 12px;
|
|
57
|
-
overflow: hidden;
|
|
58
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
59
|
-
border: 1px solid #e4e4e7;
|
|
60
|
-
}
|
|
61
|
-
.header {
|
|
62
|
-
background: #5fa075;
|
|
63
|
-
padding: 40px 32px;
|
|
64
|
-
text-align: center;
|
|
65
|
-
border-bottom: 4px solid #48805c;
|
|
66
|
-
}
|
|
67
|
-
.header h1 {
|
|
68
|
-
color: #ffffff;
|
|
69
|
-
font-size: 24px;
|
|
70
|
-
font-weight: 700;
|
|
71
|
-
margin-bottom: 8px;
|
|
72
|
-
text-transform: uppercase;
|
|
73
|
-
letter-spacing: 0.05em;
|
|
74
|
-
}
|
|
75
|
-
.header p {
|
|
76
|
-
color: rgba(255, 255, 255, 0.9);
|
|
77
|
-
font-size: 14px;
|
|
78
|
-
}
|
|
79
|
-
.content { padding: 32px; }
|
|
80
|
-
.details-grid {
|
|
81
|
-
display: grid;
|
|
82
|
-
gap: 12px;
|
|
83
|
-
margin-bottom: 24px;
|
|
84
|
-
}
|
|
85
|
-
.detail-item {
|
|
86
|
-
background: #fafafa;
|
|
87
|
-
padding: 12px 16px;
|
|
88
|
-
border-radius: 8px;
|
|
89
|
-
border: 1px solid #f1f1f4;
|
|
90
|
-
}
|
|
91
|
-
.detail-label {
|
|
92
|
-
font-size: 11px;
|
|
93
|
-
font-weight: 700;
|
|
94
|
-
color: #71717a;
|
|
95
|
-
text-transform: uppercase;
|
|
96
|
-
letter-spacing: 0.05em;
|
|
97
|
-
display: block;
|
|
98
|
-
margin-bottom: 4px;
|
|
99
|
-
}
|
|
100
|
-
.detail-value {
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
font-weight: 500;
|
|
103
|
-
color: #18181b;
|
|
104
|
-
word-break: break-word;
|
|
105
|
-
}
|
|
106
|
-
.footer {
|
|
107
|
-
padding: 24px 32px;
|
|
108
|
-
background: #f8fafc;
|
|
109
|
-
border-top: 1px solid #e2e8f0;
|
|
110
|
-
text-align: center;
|
|
111
|
-
}
|
|
112
|
-
.footer-text {
|
|
113
|
-
font-size: 12px;
|
|
114
|
-
color: #64748b;
|
|
115
|
-
}
|
|
116
|
-
</style>
|
|
117
|
-
</head>
|
|
118
|
-
<body>
|
|
119
|
-
<div class="wrapper">
|
|
120
|
-
<div class="container">
|
|
121
|
-
<div class="card">
|
|
122
|
-
<div class="header">
|
|
123
|
-
<h1>${title}</h1>
|
|
124
|
-
<p>${description}</p>
|
|
125
|
-
</div>
|
|
126
|
-
<div class="content">
|
|
127
|
-
<div class="details-grid">
|
|
128
|
-
${items}
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
<div class="footer">
|
|
132
|
-
<p class="footer-text">\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} Serenity Wellness. This is an automated notification.</p>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
</body>
|
|
138
|
-
</html>
|
|
139
|
-
`;
|
|
140
|
-
}
|
|
141
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
142
|
-
0 && (module.exports = {
|
|
143
|
-
generateEmailTemplate
|
|
144
|
-
});
|
package/dist/email.mjs
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
type FieldType = "text" | "textarea" | "richtext" | "image" | "link" | "color" | "list" | "password";
|
|
2
|
-
interface EditableMeta {
|
|
3
|
-
id: string;
|
|
4
|
-
label?: string;
|
|
5
|
-
type: FieldType;
|
|
6
|
-
section?: string;
|
|
7
|
-
pageId?: string;
|
|
8
|
-
defaultValue?: unknown;
|
|
9
|
-
itemSchema?: {
|
|
10
|
-
key: string;
|
|
11
|
-
type: "text" | "textarea" | "boolean" | "icon" | "image" | "number";
|
|
12
|
-
label?: string;
|
|
13
|
-
options?: string[];
|
|
14
|
-
}[];
|
|
15
|
-
fixedLength?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface PageDef {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string;
|
|
20
|
-
path: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
}
|
|
23
|
-
interface CollectionField {
|
|
24
|
-
id: string;
|
|
25
|
-
label: string;
|
|
26
|
-
type: FieldType | "number" | "boolean" | "select" | "icon";
|
|
27
|
-
options?: string[] | {
|
|
28
|
-
label: string;
|
|
29
|
-
value: string;
|
|
30
|
-
}[];
|
|
31
|
-
defaultValue?: unknown;
|
|
32
|
-
}
|
|
33
|
-
interface CollectionDef {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
description?: string;
|
|
37
|
-
fields: CollectionField[];
|
|
38
|
-
}
|
|
39
|
-
interface GlobalGroup {
|
|
40
|
-
id: string;
|
|
41
|
-
label: string;
|
|
42
|
-
fields: EditableMeta[];
|
|
43
|
-
}
|
|
44
|
-
interface CmsConfig {
|
|
45
|
-
siteName?: string;
|
|
46
|
-
pages: PageDef[];
|
|
47
|
-
collections?: CollectionDef[];
|
|
48
|
-
globals?: GlobalGroup[];
|
|
49
|
-
components?: PageDef[];
|
|
50
|
-
}
|
|
51
|
-
type OverridesMap = Record<string, unknown>;
|
|
52
|
-
type CollectionEntry = {
|
|
53
|
-
id: string;
|
|
54
|
-
[k: string]: unknown;
|
|
55
|
-
};
|
|
56
|
-
interface Submission {
|
|
57
|
-
id: string;
|
|
58
|
-
formId: string;
|
|
59
|
-
submittedAt: string;
|
|
60
|
-
data: Record<string, unknown>;
|
|
61
|
-
read?: boolean;
|
|
62
|
-
}
|
|
63
|
-
interface StorageAdapter {
|
|
64
|
-
name: string;
|
|
65
|
-
getOverrides(): Promise<OverridesMap>;
|
|
66
|
-
setOverrides(map: OverridesMap): Promise<void>;
|
|
67
|
-
listEntries(collectionId: string): Promise<CollectionEntry[]>;
|
|
68
|
-
putEntry(collectionId: string, entry: CollectionEntry): Promise<void>;
|
|
69
|
-
deleteEntry(collectionId: string, entryId: string): Promise<void>;
|
|
70
|
-
saveSubmission(submission: Submission): Promise<void>;
|
|
71
|
-
listSubmissions(formId?: string): Promise<Submission[]>;
|
|
72
|
-
deleteSubmission(id: string): Promise<void>;
|
|
73
|
-
markSubmissionRead(id: string): Promise<void>;
|
|
74
|
-
/** Upload an image file and return its public URL (Sanity CDN, etc.) */
|
|
75
|
-
uploadImage?: (file: File) => Promise<string>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type { CmsConfig as C, EditableMeta as E, FieldType as F, GlobalGroup as G, OverridesMap as O, PageDef as P, StorageAdapter as S, CollectionDef as a, CollectionEntry as b, CollectionField as c, Submission as d };
|