@vertebr/admin 0.4.0 → 0.5.0
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/api/catalog.d.ts +59 -0
- package/dist/api/catalog.d.ts.map +1 -0
- package/dist/api/catalog.js +85 -0
- package/dist/api/catalog.js.map +1 -0
- package/dist/api/configs.d.ts +15 -0
- package/dist/api/configs.d.ts.map +1 -0
- package/dist/api/configs.js +43 -0
- package/dist/api/configs.js.map +1 -0
- package/dist/api/emails.d.ts +85 -0
- package/dist/api/emails.d.ts.map +1 -0
- package/dist/api/emails.js +520 -0
- package/dist/api/emails.js.map +1 -0
- package/dist/api/gallery.d.ts +28 -0
- package/dist/api/gallery.d.ts.map +1 -0
- package/dist/api/gallery.js +91 -0
- package/dist/api/gallery.js.map +1 -0
- package/dist/api/metrics.d.ts +22 -0
- package/dist/api/metrics.d.ts.map +1 -0
- package/dist/api/metrics.js +38 -0
- package/dist/api/metrics.js.map +1 -0
- package/dist/api/public.d.ts +22 -0
- package/dist/api/public.d.ts.map +1 -0
- package/dist/api/public.js +69 -0
- package/dist/api/public.js.map +1 -0
- package/dist/api/request.d.ts +26 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +38 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/resources.d.ts +85 -0
- package/dist/api/resources.d.ts.map +1 -0
- package/dist/api/resources.js +263 -0
- package/dist/api/resources.js.map +1 -0
- package/dist/api/routes.d.ts +8 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +202 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/api/spa.d.ts +2 -0
- package/dist/api/spa.d.ts.map +1 -0
- package/dist/api/spa.js +34 -0
- package/dist/api/spa.js.map +1 -0
- package/dist/connectors/payments/connector.d.ts +30 -0
- package/dist/connectors/payments/connector.d.ts.map +1 -0
- package/dist/connectors/payments/connector.js +226 -0
- package/dist/connectors/payments/connector.js.map +1 -0
- package/dist/connectors/payments/index.d.ts +4 -0
- package/dist/connectors/payments/index.d.ts.map +1 -0
- package/dist/connectors/payments/index.js +10 -0
- package/dist/connectors/payments/index.js.map +1 -0
- package/dist/connectors/payments/stripe.d.ts +99 -0
- package/dist/connectors/payments/stripe.d.ts.map +1 -0
- package/dist/connectors/payments/stripe.js +189 -0
- package/dist/connectors/payments/stripe.js.map +1 -0
- package/dist/connectors/payments/types.d.ts +67 -0
- package/dist/connectors/payments/types.d.ts.map +1 -0
- package/dist/connectors/payments/types.js +16 -0
- package/dist/connectors/payments/types.js.map +1 -0
- package/dist/connectors/stripe.d.ts +19 -0
- package/dist/connectors/stripe.d.ts.map +1 -0
- package/dist/connectors/stripe.js +26 -0
- package/dist/connectors/stripe.js.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/createAdmin.d.ts +3 -0
- package/dist/createAdmin.d.ts.map +1 -0
- package/dist/createAdmin.js +152 -0
- package/dist/createAdmin.js.map +1 -0
- package/dist/database/connector.d.ts +1 -1
- package/dist/database/connector.d.ts.map +1 -1
- package/dist/database/connector.js +42 -6
- package/dist/database/connector.js.map +1 -1
- package/dist/database/types.d.ts +20 -5
- package/dist/database/types.d.ts.map +1 -1
- package/dist/errors.d.ts +17 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +36 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +9 -264
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -957
- package/dist/index.js.map +1 -1
- package/dist/mail.d.ts +23 -0
- package/dist/mail.d.ts.map +1 -0
- package/dist/mail.js +248 -0
- package/dist/mail.js.map +1 -0
- package/dist/schema.d.ts +6 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/services/environment.d.ts +8 -0
- package/dist/services/environment.d.ts.map +1 -0
- package/dist/services/environment.js +78 -0
- package/dist/services/environment.js.map +1 -0
- package/dist/services/registry.d.ts +6 -0
- package/dist/services/registry.d.ts.map +1 -0
- package/dist/services/registry.js +32 -0
- package/dist/services/registry.js.map +1 -0
- package/dist/services/state.d.ts +25 -0
- package/dist/services/state.d.ts.map +1 -0
- package/dist/services/state.js +3 -0
- package/dist/services/state.js.map +1 -0
- package/dist/types/actions.d.ts +15 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +3 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/admin.d.ts +83 -0
- package/dist/types/admin.d.ts.map +1 -0
- package/dist/types/admin.js +3 -0
- package/dist/types/admin.js.map +1 -0
- package/dist/types/auth.d.ts +67 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +3 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/config.d.ts +39 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/layout.d.ts +29 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/layout.js +3 -0
- package/dist/types/layout.js.map +1 -0
- package/dist/types/mail/catalog.d.ts +104 -0
- package/dist/types/mail/catalog.d.ts.map +1 -0
- package/dist/types/mail/catalog.js +3 -0
- package/dist/types/mail/catalog.js.map +1 -0
- package/dist/types/mail/definition.d.ts +68 -0
- package/dist/types/mail/definition.d.ts.map +1 -0
- package/dist/types/mail/definition.js +3 -0
- package/dist/types/mail/definition.js.map +1 -0
- package/dist/types/mail/index.d.ts +4 -0
- package/dist/types/mail/index.d.ts.map +1 -0
- package/dist/types/mail/index.js +3 -0
- package/dist/types/mail/index.js.map +1 -0
- package/dist/types/mail/message.d.ts +45 -0
- package/dist/types/mail/message.d.ts.map +1 -0
- package/dist/types/mail/message.js +3 -0
- package/dist/types/mail/message.js.map +1 -0
- package/dist/types/metrics.d.ts +46 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/metrics.js +3 -0
- package/dist/types/metrics.js.map +1 -0
- package/dist/types/resource.d.ts +41 -0
- package/dist/types/resource.d.ts.map +1 -0
- package/dist/types/resource.js +3 -0
- package/dist/types/resource.js.map +1 -0
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +29 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/config.d.ts +4 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +14 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/http.d.ts +7 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +61 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/metricsRange.d.ts +34 -0
- package/dist/utils/metricsRange.d.ts.map +1 -0
- package/dist/utils/metricsRange.js +121 -0
- package/dist/utils/metricsRange.js.map +1 -0
- package/dist/utils/sidebar.d.ts +2 -0
- package/dist/utils/sidebar.d.ts.map +1 -0
- package/dist/utils/sidebar.js +8 -0
- package/dist/utils/sidebar.js.map +1 -0
- package/dist/utils/staticDir.d.ts +2 -0
- package/dist/utils/staticDir.d.ts.map +1 -0
- package/dist/utils/staticDir.js +16 -0
- package/dist/utils/staticDir.js.map +1 -0
- package/dist/utils/uploads.d.ts +6 -0
- package/dist/utils/uploads.d.ts.map +1 -0
- package/dist/utils/uploads.js +66 -0
- package/dist/utils/uploads.js.map +1 -0
- package/package.json +1 -1
- package/static/assets/index-DKyVvFeT.js +332 -0
- package/static/assets/index-DUwFg1bw.css +1 -0
- package/static/index.html +2 -2
- package/static/assets/index-CZ7lykOe.css +0 -1
- package/static/assets/index-DvZiFDex.js +0 -329
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/types/actions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { GalleryDefinition } from "../schema";
|
|
2
|
+
import type { AdminAuth, AdminEnvironment } from "./auth";
|
|
3
|
+
import type { ConfigDefinition, ControlDefinition, PageDefinition } from "./config";
|
|
4
|
+
import type { LayoutDefinition } from "./layout";
|
|
5
|
+
import type { MailDefinition } from "./mail";
|
|
6
|
+
import type { MetricsDefinition } from "./metrics";
|
|
7
|
+
import type { ResourceDefinition } from "./resource";
|
|
8
|
+
export type Connector = {
|
|
9
|
+
id: string;
|
|
10
|
+
register: (admin: Admin) => void;
|
|
11
|
+
};
|
|
12
|
+
export type CreateAdminOptions = {
|
|
13
|
+
auth: AdminAuth;
|
|
14
|
+
basePath?: string;
|
|
15
|
+
/** Directory of built dashboard SPA (index.html + assets). */
|
|
16
|
+
staticDir?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Environments the owner can switch between.
|
|
19
|
+
* Omit or pass one entry for single-env apps.
|
|
20
|
+
*/
|
|
21
|
+
environments?: AdminEnvironment[];
|
|
22
|
+
/** Fallback when the client sends no env header. */
|
|
23
|
+
defaultEnvironment?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Run resource/config handlers inside host env scope
|
|
26
|
+
* (Firestore ALS, tenant context, etc.).
|
|
27
|
+
*/
|
|
28
|
+
onEnvironment?: <T>(env: string, run: () => Promise<T> | T) => Promise<T> | T;
|
|
29
|
+
};
|
|
30
|
+
export type Admin = {
|
|
31
|
+
resource: <T = unknown>(def: ResourceDefinition<T>) => Admin;
|
|
32
|
+
config: (def: ConfigDefinition) => Admin;
|
|
33
|
+
/**
|
|
34
|
+
* Register a store-backed control (dashboard form + optional public read).
|
|
35
|
+
* Prefer this over raw `config()` for site flags and copy.
|
|
36
|
+
*/
|
|
37
|
+
control: (def: ControlDefinition) => Admin;
|
|
38
|
+
/**
|
|
39
|
+
* Register page-specific content (appears under Pages in the sidebar).
|
|
40
|
+
* Equivalent to `control({ ...def, section: "page" })`.
|
|
41
|
+
*/
|
|
42
|
+
page: (def: PageDefinition) => Admin;
|
|
43
|
+
/**
|
|
44
|
+
* Register an owner-reorderable layout (preset + ordered blocks).
|
|
45
|
+
* Appears under Pages by default; expose with `public: true` for the storefront.
|
|
46
|
+
*/
|
|
47
|
+
layout: (def: LayoutDefinition) => Admin;
|
|
48
|
+
/** Register the overview metrics board. */
|
|
49
|
+
metrics: (def: MetricsDefinition) => Admin;
|
|
50
|
+
/**
|
|
51
|
+
* Register a media gallery (sidebar under Resources).
|
|
52
|
+
* Host lists/uploads/deletes assets; Vertebr renders the UI.
|
|
53
|
+
*/
|
|
54
|
+
gallery: (def: GalleryDefinition) => Admin;
|
|
55
|
+
/**
|
|
56
|
+
* Register host outbound mail. Resources opt in with
|
|
57
|
+
* `mail: ["sendEmail", "sendPromo"]` (or a binding object).
|
|
58
|
+
*/
|
|
59
|
+
mail: (def: MailDefinition) => Admin;
|
|
60
|
+
/** Server-side read of a registered config/control (auth not applied). */
|
|
61
|
+
readConfig: (id: string, env: string) => Promise<Record<string, unknown>>;
|
|
62
|
+
use: (connector: Connector) => Admin;
|
|
63
|
+
routes: () => AdminRoute[];
|
|
64
|
+
hapiRoutes: () => HapiCompatibleRoute[];
|
|
65
|
+
resources: () => ResourceDefinition[];
|
|
66
|
+
configs: () => ConfigDefinition[];
|
|
67
|
+
environments: () => AdminEnvironment[];
|
|
68
|
+
};
|
|
69
|
+
export type AdminRoute = {
|
|
70
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
71
|
+
path: string;
|
|
72
|
+
handler: (request: unknown) => Promise<unknown> | unknown;
|
|
73
|
+
};
|
|
74
|
+
export type HapiCompatibleRoute = {
|
|
75
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
76
|
+
path: string;
|
|
77
|
+
options?: {
|
|
78
|
+
auth?: false | string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
handler: (request: unknown, h: unknown) => Promise<unknown> | unknown;
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=admin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3D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;QAEtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/types/admin.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-environment auth — adjusted by the host app developer.
|
|
3
|
+
* Vertebr enforces these after resolving the user via `auth.getUser`.
|
|
4
|
+
*/
|
|
5
|
+
export type EnvironmentAuthConfig = {
|
|
6
|
+
/** Require a signed-in user for this environment. @default false */
|
|
7
|
+
required?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Custom claim key (e.g. `allowedEnvs`).
|
|
10
|
+
* Array/string claims must include `claimIncludes` (defaults to env id).
|
|
11
|
+
*/
|
|
12
|
+
claimKey?: string;
|
|
13
|
+
/** Value required in the claim. Defaults to this environment's id. */
|
|
14
|
+
claimIncludes?: string;
|
|
15
|
+
/** If set, user.roles must include at least one of these. */
|
|
16
|
+
roles?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Public browser auth configuration. Safe Firebase web config only;
|
|
19
|
+
* never put service-account credentials or secrets here.
|
|
20
|
+
*/
|
|
21
|
+
client?: {
|
|
22
|
+
provider: "firebase";
|
|
23
|
+
config: {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
authDomain: string;
|
|
26
|
+
projectId: string;
|
|
27
|
+
appId: string;
|
|
28
|
+
messagingSenderId?: string;
|
|
29
|
+
};
|
|
30
|
+
methods?: Array<"email" | "google">;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type AdminEnvironment = {
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
/** Optional UI hint — e.g. production = danger. */
|
|
37
|
+
tone?: "neutral" | "warn" | "danger";
|
|
38
|
+
/** Auth rules for this environment (developer-configurable). */
|
|
39
|
+
auth?: EnvironmentAuthConfig;
|
|
40
|
+
};
|
|
41
|
+
/** Public auth summary returned to the dashboard (no secrets). */
|
|
42
|
+
export type EnvironmentAuthPublic = {
|
|
43
|
+
required: boolean;
|
|
44
|
+
claimKey?: string;
|
|
45
|
+
roles?: string[];
|
|
46
|
+
client?: EnvironmentAuthConfig["client"];
|
|
47
|
+
};
|
|
48
|
+
export type VertebrUser = {
|
|
49
|
+
uid: string;
|
|
50
|
+
claims?: Record<string, unknown>;
|
|
51
|
+
roles?: string[];
|
|
52
|
+
};
|
|
53
|
+
export type AuthContext = {
|
|
54
|
+
env: string;
|
|
55
|
+
user: VertebrUser | null;
|
|
56
|
+
environment: AdminEnvironment;
|
|
57
|
+
};
|
|
58
|
+
export type AdminAuth = {
|
|
59
|
+
/** Resolve the current user (Firebase token, session, etc.). */
|
|
60
|
+
getUser?: (request: unknown) => Promise<VertebrUser | null> | VertebrUser | null;
|
|
61
|
+
/**
|
|
62
|
+
* Global gate after per-env auth rules.
|
|
63
|
+
* Return false to deny even when env auth passed.
|
|
64
|
+
*/
|
|
65
|
+
check: (request: unknown, ctx: AuthContext) => Promise<boolean> | boolean;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/types/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,oEAAoE;IACpE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AAC;IACZ,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,gEAAgE;IAChE,OAAO,CAAC,EAAE,CACR,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC;IACtD;;;OAGG;IACH,KAAK,EAAE,CACL,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,WAAW,KACb,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/types/auth.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ConfigStore } from "../store";
|
|
2
|
+
import type { FieldSchema, HandlerContext } from "../schema";
|
|
3
|
+
/** Sidebar group for configs / controls in the dashboard. */
|
|
4
|
+
export type ConfigSection = "config" | "page";
|
|
5
|
+
export type ConfigDefinition = {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
schema: Record<string, FieldSchema>;
|
|
9
|
+
/** Sidebar group — use `"page"` for page-specific content. @default "config" */
|
|
10
|
+
section?: ConfigSection;
|
|
11
|
+
/** Sidebar heading. Defaults to `"Config"` or `"Pages"` from `section`. */
|
|
12
|
+
group?: string;
|
|
13
|
+
get: (ctx: HandlerContext) => Promise<Record<string, unknown>> | Record<string, unknown>;
|
|
14
|
+
set: (value: Record<string, unknown>, ctx: HandlerContext) => Promise<void> | void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* High-level control registration — store-backed config with optional
|
|
18
|
+
* public storefront read.
|
|
19
|
+
*/
|
|
20
|
+
export type ControlDefinition = {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
schema: Record<string, FieldSchema>;
|
|
24
|
+
store: ConfigStore;
|
|
25
|
+
/** Sidebar group — use `"page"` for page-specific content. @default "config" */
|
|
26
|
+
section?: ConfigSection;
|
|
27
|
+
/** Sidebar heading. Defaults to `"Config"` or `"Pages"` from `section`. */
|
|
28
|
+
group?: string;
|
|
29
|
+
/** When true, exposed via `/api/public/controls` (no auth). */
|
|
30
|
+
public?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Defaults merged under stored values.
|
|
33
|
+
* Schema `default` values are applied first, then this.
|
|
34
|
+
*/
|
|
35
|
+
defaults?: Record<string, unknown> | ((env: string) => Record<string, unknown>);
|
|
36
|
+
};
|
|
37
|
+
/** Store-backed page content — same as `control()` with `section: "page"`. */
|
|
38
|
+
export type PageDefinition = Omit<ControlDefinition, "section">;
|
|
39
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,gFAAgF;IAChF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzF,GAAG,EAAE,CACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,KAAK,EAAE,WAAW,CAAC;IACnB,gFAAgF;IAChF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAChD,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public admin type surface — split by domain under `./types/`.
|
|
3
|
+
* Prefer importing from `@vertebr/admin` or `./types`.
|
|
4
|
+
*/
|
|
5
|
+
export type { ActionInputField, CollectionWideAction, ResourceAction, } from "./actions";
|
|
6
|
+
export type { MailComposeResult, MailMessage, MailSendReceipt, MailSendResult, MailSentHandler, MailTemplate, } from "./mail/message";
|
|
7
|
+
export type { MailCampaign, MailCampaignAudience, MailCampaignScheduleInput, MailCampaignStatus, MailDiscountOption, MailHistoryEntry, MailHistoryRecordInput, MailLibraryTemplate, MailProductOption, } from "./mail/catalog";
|
|
8
|
+
export type { MailDefinition, ResourceMailBinding, ResourceMailConfig, } from "./mail/definition";
|
|
9
|
+
export type { ResourceDefinition, ResourcePermissions, } from "./resource";
|
|
10
|
+
export type { ConfigDefinition, ConfigSection, ControlDefinition, PageDefinition, } from "./config";
|
|
11
|
+
export type { LayoutDefinition, LayoutPreset, LayoutSlot, } from "./layout";
|
|
12
|
+
export type { MetricCard, MetricChart, MetricChartPoint, MetricsDefinition, MetricsPayload, } from "./metrics";
|
|
13
|
+
export type { AdminAuth, AdminEnvironment, AuthContext, EnvironmentAuthConfig, EnvironmentAuthPublic, VertebrUser, } from "./auth";
|
|
14
|
+
export type { Admin, AdminRoute, Connector, CreateAdminOptions, HapiCompatibleRoute, } from "./admin";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,cAAc,GACf,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,GACX,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,GACZ,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,KAAK,EACL,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ConfigStore } from "../store";
|
|
2
|
+
import type { ConfigSection } from "./config";
|
|
3
|
+
/** Named slot in a host-rendered page layout. */
|
|
4
|
+
export type LayoutSlot = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
export type LayoutPreset = {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Owner-reorderable page layout. Vertebr stores the recipe; the host
|
|
14
|
+
* still owns CSS and rendering.
|
|
15
|
+
*/
|
|
16
|
+
export type LayoutDefinition = {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
slots: LayoutSlot[];
|
|
20
|
+
/** @default slot ids in declaration order */
|
|
21
|
+
defaultOrder?: string[];
|
|
22
|
+
presets?: LayoutPreset[];
|
|
23
|
+
store: ConfigStore;
|
|
24
|
+
public?: boolean;
|
|
25
|
+
section?: ConfigSection;
|
|
26
|
+
/** Sidebar heading. Defaults to `"Pages"`. */
|
|
27
|
+
group?: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/types/layout.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/** Scheduled / campaign send tracked on the Emails board. */
|
|
2
|
+
export type MailCampaignStatus = "scheduled" | "sending" | "sent" | "cancelled" | "failed";
|
|
3
|
+
export type MailCampaignAudience = {
|
|
4
|
+
mode: "all";
|
|
5
|
+
} | {
|
|
6
|
+
mode: "ids";
|
|
7
|
+
rowIds: string[];
|
|
8
|
+
} | {
|
|
9
|
+
mode: "emails";
|
|
10
|
+
emails: string[];
|
|
11
|
+
};
|
|
12
|
+
export type MailCampaign = {
|
|
13
|
+
id: string;
|
|
14
|
+
resourceId: string;
|
|
15
|
+
resourceLabel?: string;
|
|
16
|
+
templateId: string;
|
|
17
|
+
templateLabel?: string;
|
|
18
|
+
audience: MailCampaignAudience;
|
|
19
|
+
recipientCount?: number;
|
|
20
|
+
/** ISO timestamp — when to send. */
|
|
21
|
+
sendAt: string;
|
|
22
|
+
status: MailCampaignStatus;
|
|
23
|
+
createdAt?: string;
|
|
24
|
+
subject?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
};
|
|
27
|
+
export type MailCampaignScheduleInput = {
|
|
28
|
+
resourceId: string;
|
|
29
|
+
templateId: string;
|
|
30
|
+
input?: Record<string, unknown>;
|
|
31
|
+
audience: MailCampaignAudience;
|
|
32
|
+
sendAt: string;
|
|
33
|
+
/** Optional subject snapshot for the board list. */
|
|
34
|
+
subject?: string;
|
|
35
|
+
};
|
|
36
|
+
/** One outbound send logged on the Emails board. */
|
|
37
|
+
export type MailHistoryEntry = {
|
|
38
|
+
id: string;
|
|
39
|
+
at: string;
|
|
40
|
+
resourceId: string;
|
|
41
|
+
resourceLabel?: string;
|
|
42
|
+
templateId: string;
|
|
43
|
+
templateLabel?: string;
|
|
44
|
+
subject?: string;
|
|
45
|
+
recipientCount: number;
|
|
46
|
+
sent: number;
|
|
47
|
+
failed?: number;
|
|
48
|
+
status: "sent" | "partial" | "failed" | "scheduled";
|
|
49
|
+
source: "board" | "row" | "campaign";
|
|
50
|
+
campaignId?: string;
|
|
51
|
+
productIds?: string[];
|
|
52
|
+
/** Sample of recipient emails (capped). */
|
|
53
|
+
recipients?: string[];
|
|
54
|
+
/** Compose preset id when present. */
|
|
55
|
+
preset?: string;
|
|
56
|
+
discountCode?: string;
|
|
57
|
+
discountOffer?: string;
|
|
58
|
+
/** Order / confirmation reference when present (e.g. `MM-PENDING`). */
|
|
59
|
+
reference?: string;
|
|
60
|
+
};
|
|
61
|
+
export type MailHistoryRecordInput = Omit<MailHistoryEntry, "id"> & {
|
|
62
|
+
id?: string;
|
|
63
|
+
};
|
|
64
|
+
/** Owner-saved copy of a system preset (or freeform). */
|
|
65
|
+
export type MailLibraryTemplate = {
|
|
66
|
+
id: string;
|
|
67
|
+
label: string;
|
|
68
|
+
/** System preset this was duplicated from. */
|
|
69
|
+
fromPreset?: string;
|
|
70
|
+
subject: string;
|
|
71
|
+
body: string;
|
|
72
|
+
productIds?: string[];
|
|
73
|
+
/** Stripe coupon / promotion code id when discounts are wired. */
|
|
74
|
+
discountId?: string;
|
|
75
|
+
discountCode?: string;
|
|
76
|
+
discountOffer?: string;
|
|
77
|
+
discountExpires?: string;
|
|
78
|
+
kind?: "account" | "promo" | "discount" | "order";
|
|
79
|
+
/** Order confirmation extras (`kind: "order"`). */
|
|
80
|
+
eyebrow?: string;
|
|
81
|
+
headline?: string;
|
|
82
|
+
confirmationLabel?: string;
|
|
83
|
+
shippingNote?: string;
|
|
84
|
+
footer?: string;
|
|
85
|
+
signOff?: string;
|
|
86
|
+
createdAt?: string;
|
|
87
|
+
updatedAt?: string;
|
|
88
|
+
};
|
|
89
|
+
export type MailProductOption = {
|
|
90
|
+
id: string;
|
|
91
|
+
label: string;
|
|
92
|
+
imageUrl?: string;
|
|
93
|
+
priceLabel?: string;
|
|
94
|
+
};
|
|
95
|
+
/** Coupon / promo option for discount emails (e.g. Stripe). */
|
|
96
|
+
export type MailDiscountOption = {
|
|
97
|
+
id: string;
|
|
98
|
+
label: string;
|
|
99
|
+
code?: string;
|
|
100
|
+
/** e.g. "20% off" or "$10 off" */
|
|
101
|
+
offerLabel?: string;
|
|
102
|
+
expiresLabel?: string;
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/types/mail/catalog.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAC1B,WAAW,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mD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/types/mail/catalog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HandlerContext } from "../../schema";
|
|
2
|
+
import type { MailCampaign, MailCampaignScheduleInput, MailDiscountOption, MailHistoryEntry, MailHistoryRecordInput, MailLibraryTemplate, MailProductOption } from "./catalog";
|
|
3
|
+
import type { MailMessage, MailSendReceipt, MailSentHandler, MailTemplate } from "./message";
|
|
4
|
+
/**
|
|
5
|
+
* Host-owned outbound mail. Vertebr turns templates into row actions
|
|
6
|
+
* on resources that opt in via `mail`, and exposes an Emails board when
|
|
7
|
+
* `label` / campaigns are configured.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* vertebrAdmin.mail({
|
|
11
|
+
* label: "Emails",
|
|
12
|
+
* group: "Growth",
|
|
13
|
+
* send: (message) => enqueueEmail(message),
|
|
14
|
+
* templates: {
|
|
15
|
+
* sendEmail: {
|
|
16
|
+
* label: "Email",
|
|
17
|
+
* input: { subject: "string", body: "string" },
|
|
18
|
+
* compose: (_row, input) => branded(input),
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export type MailDefinition = {
|
|
24
|
+
/** Sidebar label for the Emails board. @default `"Emails"` */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Sidebar group. @default `"Growth"` */
|
|
27
|
+
group?: string;
|
|
28
|
+
send: (message: MailMessage, ctx: HandlerContext) => Promise<MailSendReceipt | void> | MailSendReceipt | void;
|
|
29
|
+
/** Row field used when compose omits `to`. @default `"email"` */
|
|
30
|
+
toField?: string;
|
|
31
|
+
prepare?: (message: MailMessage, ctx: HandlerContext) => MailMessage | Promise<MailMessage>;
|
|
32
|
+
templates: Record<string, MailTemplate>;
|
|
33
|
+
/**
|
|
34
|
+
* Optional host-backed schedule store. Without this, the Emails board
|
|
35
|
+
* can still send now (bulk / single) but cannot schedule drops.
|
|
36
|
+
*/
|
|
37
|
+
campaigns?: {
|
|
38
|
+
list: (ctx: HandlerContext) => Promise<MailCampaign[]>;
|
|
39
|
+
schedule: (input: MailCampaignScheduleInput, ctx: HandlerContext) => Promise<MailCampaign>;
|
|
40
|
+
cancel?: (id: string, ctx: HandlerContext) => Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
/** Optional send log for the Emails board Activity tab. */
|
|
43
|
+
history?: {
|
|
44
|
+
list: (ctx: HandlerContext) => Promise<MailHistoryEntry[]>;
|
|
45
|
+
record: (entry: MailHistoryRecordInput, ctx: HandlerContext) => Promise<MailHistoryEntry>;
|
|
46
|
+
};
|
|
47
|
+
/** Optional saved template copies (duplicate / edit). */
|
|
48
|
+
library?: {
|
|
49
|
+
list: (ctx: HandlerContext) => Promise<MailLibraryTemplate[]>;
|
|
50
|
+
save: (template: MailLibraryTemplate, ctx: HandlerContext) => Promise<MailLibraryTemplate>;
|
|
51
|
+
remove?: (id: string, ctx: HandlerContext) => Promise<void>;
|
|
52
|
+
};
|
|
53
|
+
/** Optional catalog products for compose (drop / promo emails). */
|
|
54
|
+
products?: (ctx: HandlerContext) => Promise<MailProductOption[]> | MailProductOption[];
|
|
55
|
+
/**
|
|
56
|
+
* Optional discount / coupon options for compose (Stripe promotion codes).
|
|
57
|
+
* Until wired, hosts can leave this empty and accept manual code fields.
|
|
58
|
+
*/
|
|
59
|
+
discounts?: (ctx: HandlerContext) => Promise<MailDiscountOption[]> | MailDiscountOption[];
|
|
60
|
+
};
|
|
61
|
+
export type ResourceMailBinding = {
|
|
62
|
+
templates: string[];
|
|
63
|
+
toField?: string;
|
|
64
|
+
onSent?: MailSentHandler;
|
|
65
|
+
};
|
|
66
|
+
/** Opt a resource into host mail templates. */
|
|
67
|
+
export type ResourceMailConfig = string[] | ResourceMailBinding;
|
|
68
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/types/mail/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,KAAK,CAAC,EAAE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AAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAC7D,CAAC;IACF,mEAAmE;IACnE,QAAQ,CAAC,EAAE,CACT,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,iBAAiB,EAAE,CAAC,GAAG,iBAAiB,EAAE,CAAC;IACxD;;;OAGG;IACH,SAAS,CAAC,EAAE,CACV,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,kBAAkB,EAAE,CAAC,GAAG,kBAAkB,EAAE,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,kBAAkB,GAAG,MAAM,EAAE,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../../src/types/mail/definition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { MailComposeResult, MailMessage, MailSendReceipt, MailSendResult, MailSentHandler, MailTemplate, } from "./message";
|
|
2
|
+
export type { MailCampaign, MailCampaignAudience, MailCampaignScheduleInput, MailCampaignStatus, MailDiscountOption, MailHistoryEntry, MailHistoryRecordInput, MailLibraryTemplate, MailProductOption, } from "./catalog";
|
|
3
|
+
export type { MailDefinition, ResourceMailBinding, ResourceMailConfig, } from "./definition";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/mail/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/mail/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { HandlerContext } from "../../schema";
|
|
2
|
+
import type { ActionInputField } from "../actions";
|
|
3
|
+
/** Outbound message the host `mail().send` handler receives. */
|
|
4
|
+
export type MailMessage = {
|
|
5
|
+
to: string | string[];
|
|
6
|
+
subject: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
html?: string;
|
|
9
|
+
replyTo?: string;
|
|
10
|
+
template?: string;
|
|
11
|
+
templateData?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
/** Compose may omit `to` — Vertebr fills it from the row's email field. */
|
|
14
|
+
export type MailComposeResult = Omit<MailMessage, "to"> & {
|
|
15
|
+
to?: string | string[];
|
|
16
|
+
};
|
|
17
|
+
export type MailSendResult = {
|
|
18
|
+
template: string;
|
|
19
|
+
id?: string;
|
|
20
|
+
message: MailMessage;
|
|
21
|
+
/** Host-provided reference after send (e.g. order confirmation). */
|
|
22
|
+
reference?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Optional fields `mail.send` may return after delivery. */
|
|
25
|
+
export type MailSendReceipt = {
|
|
26
|
+
id?: string;
|
|
27
|
+
/** Final subject if the host rewrote it (tokens, confirmations, …). */
|
|
28
|
+
subject?: string;
|
|
29
|
+
/** Durable reference to store on history (confirmation number, …). */
|
|
30
|
+
reference?: string;
|
|
31
|
+
};
|
|
32
|
+
export type MailSentHandler = (row: Record<string, unknown>, result: MailSendResult, ctx: HandlerContext) => Promise<unknown> | unknown;
|
|
33
|
+
export type MailTemplate = {
|
|
34
|
+
label: string;
|
|
35
|
+
/**
|
|
36
|
+
* Include on the Emails board for bulk / schedule.
|
|
37
|
+
* Row actions still appear when a resource opts in.
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
bulk?: boolean;
|
|
41
|
+
/** Form fields — use FieldSchema for enums / labels / optional copy. */
|
|
42
|
+
input?: Record<string, ActionInputField>;
|
|
43
|
+
compose: (row: Record<string, unknown>, input: Record<string, unknown> | undefined, ctx: HandlerContext) => MailComposeResult | Promise<MailComposeResult>;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/types/mail/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,gEAAgE;AAChE,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG;IACxD,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACj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