@12-apps/notifications 4.8.0 → 4.9.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/ADOPTING.md +113 -0
- package/README.md +65 -0
- package/dist/catalog-BOVZ2b-b.d.ts +132 -0
- package/dist/chunk-EKUSNUBT.js +222 -0
- package/dist/chunk-EKUSNUBT.js.map +1 -0
- package/dist/chunk-FTFLU6KH.js +114 -0
- package/dist/chunk-FTFLU6KH.js.map +1 -0
- package/dist/{chunk-7234ROOP.js → chunk-KZG7QGFA.js} +21 -3
- package/dist/chunk-KZG7QGFA.js.map +1 -0
- package/dist/chunk-ZFIYBNZ7.js +502 -0
- package/dist/chunk-ZFIYBNZ7.js.map +1 -0
- package/dist/{create-api-notifications-WaexrZnn.d.ts → create-api-notifications-B-VMezVB.d.ts} +35 -4
- package/dist/{create-web-notifications-DrgqtU4Q.d.ts → create-web-notifications-B-xQ6R0B.d.ts} +2 -2
- package/dist/email/index.d.ts +26 -0
- package/dist/email/index.js +20 -0
- package/dist/email/index.js.map +1 -0
- package/dist/email/locales.d.ts +43 -0
- package/dist/email/locales.js +29 -0
- package/dist/email/locales.js.map +1 -0
- package/dist/email/previews/hono.d.ts +46 -0
- package/dist/email/previews/hono.js +33 -0
- package/dist/email/previews/hono.js.map +1 -0
- package/dist/email/previews/index.d.ts +67 -0
- package/dist/email/previews/index.js +12 -0
- package/dist/email/previews/index.js.map +1 -0
- package/dist/email/previews/react/index.d.ts +43 -0
- package/dist/email/previews/react/index.js +58 -0
- package/dist/email/previews/react/index.js.map +1 -0
- package/dist/{generators-CH5m8Ucj.d.ts → generators-BsuXe8Mp.d.ts} +1 -1
- package/dist/hono/index.d.ts +6 -5
- package/dist/hono/index.js +3 -2
- package/dist/hono/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/{jobs-CcsSA0YR.d.ts → jobs-D64B_bg7.d.ts} +1 -1
- package/dist/manifest/index.d.ts +39 -1
- package/dist/manifest/index.js +9 -0
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/server.d.ts +32 -7
- package/dist/manifest/server.js +13 -2
- package/dist/manifest/server.js.map +1 -1
- package/dist/manifest/web.d.ts +18 -4
- package/dist/manifest/web.js +8 -0
- package/dist/manifest/web.js.map +1 -1
- package/dist/preview-screen-DYJRAnAY.d.ts +83 -0
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.js +9 -9
- package/dist/server/index.d.ts +8 -7
- package/dist/server/index.js +3 -2
- package/dist/template-Dlt5S54z.d.ts +196 -0
- package/dist/{types-CYJN1xCM.d.ts → types-BFmAY0P5.d.ts} +1 -1
- package/dist/web-push/index.d.ts +2 -2
- package/dist/{web-push-iER5StBm.d.ts → web-push-D-ysQd5h.d.ts} +1 -1
- package/dist/{wire-CmRrB3_s.d.ts → wire-_coV3tJk.d.ts} +1 -1
- package/package.json +22 -2
- package/src/email/chrome.en-US.ts +8 -0
- package/src/email/chrome.pt-BR.ts +21 -0
- package/src/email/index.ts +43 -0
- package/src/email/locales.ts +29 -0
- package/src/email/previews/catalog.ts +208 -0
- package/src/email/previews/hono.ts +69 -0
- package/src/email/previews/index.ts +26 -0
- package/src/email/previews/react/copy.en-US.ts +24 -0
- package/src/email/previews/react/copy.pt-BR.ts +24 -0
- package/src/email/previews/react/copy.ts +42 -0
- package/src/email/previews/react/index.tsx +14 -0
- package/src/email/previews/react/loadable.tsx +83 -0
- package/src/email/previews/react/message-list.tsx +133 -0
- package/src/email/previews/react/message-view.tsx +167 -0
- package/src/email/previews/react/preview-screen.tsx +342 -0
- package/src/email/previews/react/transport.ts +60 -0
- package/src/email/previews/routes.ts +111 -0
- package/src/email/template.ts +365 -0
- package/src/email/text.ts +59 -0
- package/src/email/theme.ts +77 -0
- package/src/manifest/index.ts +37 -0
- package/src/manifest/server.ts +23 -0
- package/src/manifest/web.ts +13 -0
- package/src/server/transports/email.ts +62 -0
- package/dist/chunk-7234ROOP.js.map +0 -1
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { EmailPreviewRoute } from '../email/previews/index.js';
|
|
1
2
|
import * as _12_apps_wiring from '@12-apps/wiring';
|
|
2
3
|
import { WireRequest } from '@12-apps/wiring';
|
|
3
|
-
import { N as NotificationsServerConfig, A as ApiNotifications, b as NotificationsRoute } from '../create-api-notifications-
|
|
4
|
-
import { N as NotificationsJobDeps } from '../jobs-
|
|
5
|
-
import '../
|
|
6
|
-
import '../
|
|
7
|
-
import '../
|
|
8
|
-
import '../
|
|
4
|
+
import { N as NotificationsServerConfig, A as ApiNotifications, b as NotificationsRoute } from '../create-api-notifications-B-VMezVB.js';
|
|
5
|
+
import { N as NotificationsJobDeps } from '../jobs-D64B_bg7.js';
|
|
6
|
+
import { E as EmailPreviewsConfig } from '../catalog-BOVZ2b-b.js';
|
|
7
|
+
import '../generators-BsuXe8Mp.js';
|
|
8
|
+
import '../types-BFmAY0P5.js';
|
|
9
|
+
import '../wire-_coV3tJk.js';
|
|
10
|
+
import '../web-push-D-ysQd5h.js';
|
|
11
|
+
import '../template-Dlt5S54z.js';
|
|
9
12
|
|
|
10
13
|
/** One `NotificationsRoute` as the wiring contract reads it. */
|
|
11
14
|
declare function asWireRoute(route: NotificationsRoute): {
|
|
@@ -41,5 +44,27 @@ declare const notificationsServerManifest: {
|
|
|
41
44
|
};
|
|
42
45
|
};
|
|
43
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* The preview console's server half — the two endpoints over the catalogue.
|
|
49
|
+
*
|
|
50
|
+
* A CONSTANT, not a factory. `http.create(config)` receives whatever the host
|
|
51
|
+
* bound at adoption, and "which messages exist" is precisely a host's binding:
|
|
52
|
+
* a package cannot know that a product sends a "your quota is exhausted"
|
|
53
|
+
* notice, let alone what data it renders from. Writing `EmailPreviewsConfig`
|
|
54
|
+
* as a factory argument instead would move that decision out of
|
|
55
|
+
* `bindings.http`, where `assemble()` can report on it, into a call the report
|
|
56
|
+
* never sees.
|
|
57
|
+
*
|
|
58
|
+
* The routes carry `kind: 'authenticated'` — see `../email/previews/routes`
|
|
59
|
+
* for why the descriptor states a posture it cannot itself enforce.
|
|
60
|
+
*/
|
|
61
|
+
declare const notificationEmailPreviewsServerManifest: {
|
|
62
|
+
readonly name: "@12-apps/notifications-email-previews";
|
|
63
|
+
readonly http: {
|
|
64
|
+
readonly create: (config: EmailPreviewsConfig) => {
|
|
65
|
+
routes: EmailPreviewRoute[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
44
69
|
|
|
45
|
-
export { createWireApiNotifications, notificationsServerManifest };
|
|
70
|
+
export { createWireApiNotifications, notificationEmailPreviewsServerManifest, notificationsServerManifest };
|
package/dist/manifest/server.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
emailPreviewRoutes
|
|
3
|
+
} from "../chunk-FTFLU6KH.js";
|
|
1
4
|
import {
|
|
2
5
|
NOTIFICATIONS_JOBS
|
|
3
6
|
} from "../chunk-KU4FVOFA.js";
|
|
4
7
|
import {
|
|
5
8
|
createApiNotifications
|
|
6
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-KZG7QGFA.js";
|
|
7
10
|
import "../chunk-GGAZOLNN.js";
|
|
8
|
-
import "../chunk-BGI4BQ66.js";
|
|
9
11
|
import "../chunk-M2TVBVH2.js";
|
|
12
|
+
import "../chunk-BGI4BQ66.js";
|
|
13
|
+
import "../chunk-EKUSNUBT.js";
|
|
10
14
|
import {
|
|
11
15
|
__name
|
|
12
16
|
} from "../chunk-7QVYU63E.js";
|
|
@@ -51,8 +55,15 @@ var notificationsServerManifest = {
|
|
|
51
55
|
*/
|
|
52
56
|
jobs: NOTIFICATIONS_JOBS
|
|
53
57
|
};
|
|
58
|
+
var notificationEmailPreviewsServerManifest = {
|
|
59
|
+
name: "@12-apps/notifications-email-previews",
|
|
60
|
+
http: {
|
|
61
|
+
create: /* @__PURE__ */ __name((config) => ({ routes: emailPreviewRoutes(config) }), "create")
|
|
62
|
+
}
|
|
63
|
+
};
|
|
54
64
|
export {
|
|
55
65
|
createWireApiNotifications,
|
|
66
|
+
notificationEmailPreviewsServerManifest,
|
|
56
67
|
notificationsServerManifest
|
|
57
68
|
};
|
|
58
69
|
//# sourceMappingURL=server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/manifest/server.ts"],"sourcesContent":["/**\n * `@12-apps/notifications/manifest/server` — the server capabilities.\n *\n * `http.create` wraps `createApiNotifications` in a WIRE VIEW, and the reason\n * is one field. `NotificationsRequest` carries `headers` — the contract's\n * `WireRequest` does not, because headers are the adapter's business\n * everywhere else — and exactly one descriptor reads it: push-subscribe takes\n * `user-agent` as the DEVICE HINT it labels a subscription with. Without the\n * view the field would simply be absent at runtime while still type-checking,\n * and every saved device would come back unnamed: a silent quality loss, the\n * failure mode the wiring contract exists to convert into a loud one.\n *\n * So the view derives `headers` from the raw request the contract already\n * carries for the handlers `params`/`query`/`body` cannot serve. A host whose\n * adapter leaves `request` unset still gets a working surface — every route\n * answers, the subscription saves — with an unnamed device, which is the\n * honest degradation for a hint. `@12-apps/notifications/hono` populates it.\n *\n * Everything else rides beside the mapped routes on the aggregate unchanged:\n * `notify`, `notifyByPermission`, `dispatchDeliveries`, `drainPending`, the\n * three stores, `registerGenerator` and the transports registry. A host still\n * calls those directly — being mounted does not make the emit front door stop\n * being a library.\n */\n\nimport type { AnyServerManifest, WireRequest } from '@12-apps/wiring';\n\nimport {\n createApiNotifications,\n NOTIFICATIONS_JOBS,\n type ApiNotifications,\n type NotificationsRoute,\n type NotificationsServerConfig,\n} from '../server';\n\n/** The header names this surface reads — the device hint, and nothing else. */\nconst READ_HEADERS = ['user-agent'] as const;\n\n/** The headers the package expects, taken off the raw request when there is one. */\nfunction headersOf(request: WireRequest<never>): Record<string, string | undefined> {\n const raw = request.request;\n if (!raw) return {};\n return Object.fromEntries(\n READ_HEADERS.map((name) => [name, raw.headers.get(name) ?? undefined]),\n );\n}\n\n/** One `NotificationsRoute` as the wiring contract reads it. */\nfunction asWireRoute(route: NotificationsRoute): {\n method: NotificationsRoute['method'];\n path: string;\n handle(request: WireRequest<never>): Promise<{ status: number; body: unknown }>;\n} {\n return {\n method: route.method,\n path: route.path,\n handle: (request) =>\n route.handle({\n actor: request.actor,\n params: request.params,\n query: request.query,\n body: request.body,\n headers: headersOf(request),\n }),\n };\n}\n\n/** `createApiNotifications`, its routes re-shaped for the aggregate. */\nexport function createWireApiNotifications(\n config: NotificationsServerConfig,\n): Omit<ApiNotifications, 'routes'> & { routes: ReturnType<typeof asWireRoute>[] } {\n const api = createApiNotifications(config);\n return { ...api, routes: api.routes.map(asWireRoute) };\n}\n\nexport const notificationsServerManifest = {\n name: '@12-apps/notifications',\n http: { create: createWireApiNotifications },\n /**\n * The dispatch fast path and the retry sweep, with their cadence. The host\n * binds `{ dispatchDeliveries, drainPending }` off its own mount — the two\n * methods the aggregate already hands it — and deletes the hand-rolled\n * copies. See `../server/jobs` for why the numbers are the package's.\n */\n jobs: NOTIFICATIONS_JOBS,\n} as const satisfies AnyServerManifest;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/server.ts"],"sourcesContent":["/**\n * `@12-apps/notifications/manifest/server` — the server capabilities.\n *\n * `http.create` wraps `createApiNotifications` in a WIRE VIEW, and the reason\n * is one field. `NotificationsRequest` carries `headers` — the contract's\n * `WireRequest` does not, because headers are the adapter's business\n * everywhere else — and exactly one descriptor reads it: push-subscribe takes\n * `user-agent` as the DEVICE HINT it labels a subscription with. Without the\n * view the field would simply be absent at runtime while still type-checking,\n * and every saved device would come back unnamed: a silent quality loss, the\n * failure mode the wiring contract exists to convert into a loud one.\n *\n * So the view derives `headers` from the raw request the contract already\n * carries for the handlers `params`/`query`/`body` cannot serve. A host whose\n * adapter leaves `request` unset still gets a working surface — every route\n * answers, the subscription saves — with an unnamed device, which is the\n * honest degradation for a hint. `@12-apps/notifications/hono` populates it.\n *\n * Everything else rides beside the mapped routes on the aggregate unchanged:\n * `notify`, `notifyByPermission`, `dispatchDeliveries`, `drainPending`, the\n * three stores, `registerGenerator` and the transports registry. A host still\n * calls those directly — being mounted does not make the emit front door stop\n * being a library.\n */\n\nimport type { AnyServerManifest, WireRequest } from '@12-apps/wiring';\n\nimport { emailPreviewRoutes } from '../email/previews/routes';\nimport type { EmailPreviewsConfig } from '../email/previews/catalog';\nimport {\n createApiNotifications,\n NOTIFICATIONS_JOBS,\n type ApiNotifications,\n type NotificationsRoute,\n type NotificationsServerConfig,\n} from '../server';\n\n/** The header names this surface reads — the device hint, and nothing else. */\nconst READ_HEADERS = ['user-agent'] as const;\n\n/** The headers the package expects, taken off the raw request when there is one. */\nfunction headersOf(request: WireRequest<never>): Record<string, string | undefined> {\n const raw = request.request;\n if (!raw) return {};\n return Object.fromEntries(\n READ_HEADERS.map((name) => [name, raw.headers.get(name) ?? undefined]),\n );\n}\n\n/** One `NotificationsRoute` as the wiring contract reads it. */\nfunction asWireRoute(route: NotificationsRoute): {\n method: NotificationsRoute['method'];\n path: string;\n handle(request: WireRequest<never>): Promise<{ status: number; body: unknown }>;\n} {\n return {\n method: route.method,\n path: route.path,\n handle: (request) =>\n route.handle({\n actor: request.actor,\n params: request.params,\n query: request.query,\n body: request.body,\n headers: headersOf(request),\n }),\n };\n}\n\n/** `createApiNotifications`, its routes re-shaped for the aggregate. */\nexport function createWireApiNotifications(\n config: NotificationsServerConfig,\n): Omit<ApiNotifications, 'routes'> & { routes: ReturnType<typeof asWireRoute>[] } {\n const api = createApiNotifications(config);\n return { ...api, routes: api.routes.map(asWireRoute) };\n}\n\nexport const notificationsServerManifest = {\n name: '@12-apps/notifications',\n http: { create: createWireApiNotifications },\n /**\n * The dispatch fast path and the retry sweep, with their cadence. The host\n * binds `{ dispatchDeliveries, drainPending }` off its own mount — the two\n * methods the aggregate already hands it — and deletes the hand-rolled\n * copies. See `../server/jobs` for why the numbers are the package's.\n */\n jobs: NOTIFICATIONS_JOBS,\n} as const satisfies AnyServerManifest;\n\n/**\n * The preview console's server half — the two endpoints over the catalogue.\n *\n * A CONSTANT, not a factory. `http.create(config)` receives whatever the host\n * bound at adoption, and \"which messages exist\" is precisely a host's binding:\n * a package cannot know that a product sends a \"your quota is exhausted\"\n * notice, let alone what data it renders from. Writing `EmailPreviewsConfig`\n * as a factory argument instead would move that decision out of\n * `bindings.http`, where `assemble()` can report on it, into a call the report\n * never sees.\n *\n * The routes carry `kind: 'authenticated'` — see `../email/previews/routes`\n * for why the descriptor states a posture it cannot itself enforce.\n */\nexport const notificationEmailPreviewsServerManifest = {\n name: '@12-apps/notifications-email-previews',\n http: {\n create: (config: EmailPreviewsConfig) => ({ routes: emailPreviewRoutes(config) }),\n },\n} as const satisfies AnyServerManifest;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,IAAM,eAAe,CAAC,YAAY;AAGlC,SAAS,UAAU,SAAiE;AAClF,QAAM,MAAM,QAAQ;AACpB,MAAI,CAAC,IAAK,QAAO,CAAC;AAClB,SAAO,OAAO;AAAA,IACZ,aAAa,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,QAAQ,IAAI,IAAI,KAAK,MAAS,CAAC;AAAA,EACvE;AACF;AANS;AAST,SAAS,YAAY,OAInB;AACA,SAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,MAAM,MAAM;AAAA,IACZ,QAAQ,wBAAC,YACP,MAAM,OAAO;AAAA,MACX,OAAO,QAAQ;AAAA,MACf,QAAQ,QAAQ;AAAA,MAChB,OAAO,QAAQ;AAAA,MACf,MAAM,QAAQ;AAAA,MACd,SAAS,UAAU,OAAO;AAAA,IAC5B,CAAC,GAPK;AAAA,EAQV;AACF;AAjBS;AAoBF,SAAS,2BACd,QACiF;AACjF,QAAM,MAAM,uBAAuB,MAAM;AACzC,SAAO,EAAE,GAAG,KAAK,QAAQ,IAAI,OAAO,IAAI,WAAW,EAAE;AACvD;AALgB;AAOT,IAAM,8BAA8B;AAAA,EACzC,MAAM;AAAA,EACN,MAAM,EAAE,QAAQ,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3C,MAAM;AACR;AAgBO,IAAM,0CAA0C;AAAA,EACrD,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,QAAQ,wBAAC,YAAiC,EAAE,QAAQ,mBAAmB,MAAM,EAAE,IAAvE;AAAA,EACV;AACF;","names":[]}
|
package/dist/manifest/web.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { c as
|
|
1
|
+
import { c as createEmailPreviewScreen } from '../preview-screen-DYJRAnAY.js';
|
|
2
|
+
import { c as createWebNotifications } from '../create-web-notifications-B-xQ6R0B.js';
|
|
2
3
|
import 'react';
|
|
3
|
-
import '../wire-
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../wire-_coV3tJk.js';
|
|
5
|
+
import '../types-BFmAY0P5.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* `@12-apps/notifications/manifest/web` — the web capabilities.
|
|
@@ -47,5 +48,18 @@ declare const notificationsWebManifest: {
|
|
|
47
48
|
readonly create: typeof createWebNotifications;
|
|
48
49
|
};
|
|
49
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* The preview console's web half.
|
|
53
|
+
*
|
|
54
|
+
* One screen, named `page`, because a screen's NAME is what an area row
|
|
55
|
+
* resolves against — a surface that was itself the component is the shape that
|
|
56
|
+
* made an area row resolve to `undefined` in `@12-apps/auth` for a release.
|
|
57
|
+
*/
|
|
58
|
+
declare const notificationEmailPreviewsWebManifest: {
|
|
59
|
+
readonly name: "@12-apps/notifications-email-previews";
|
|
60
|
+
readonly surface: {
|
|
61
|
+
readonly create: typeof createEmailPreviewScreen;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
50
64
|
|
|
51
|
-
export { notificationsWebManifest };
|
|
65
|
+
export { notificationEmailPreviewsWebManifest, notificationsWebManifest };
|
package/dist/manifest/web.js
CHANGED
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
createWebNotifications
|
|
3
3
|
} from "../chunk-M5XTROYM.js";
|
|
4
4
|
import "../chunk-BW723CX2.js";
|
|
5
|
+
import {
|
|
6
|
+
createEmailPreviewScreen
|
|
7
|
+
} from "../chunk-ZFIYBNZ7.js";
|
|
5
8
|
import "../chunk-M2TVBVH2.js";
|
|
6
9
|
import "../chunk-7QVYU63E.js";
|
|
7
10
|
|
|
@@ -10,7 +13,12 @@ var notificationsWebManifest = {
|
|
|
10
13
|
name: "@12-apps/notifications",
|
|
11
14
|
surface: { create: createWebNotifications }
|
|
12
15
|
};
|
|
16
|
+
var notificationEmailPreviewsWebManifest = {
|
|
17
|
+
name: "@12-apps/notifications-email-previews",
|
|
18
|
+
surface: { create: createEmailPreviewScreen }
|
|
19
|
+
};
|
|
13
20
|
export {
|
|
21
|
+
notificationEmailPreviewsWebManifest,
|
|
14
22
|
notificationsWebManifest
|
|
15
23
|
};
|
|
16
24
|
//# sourceMappingURL=web.js.map
|
package/dist/manifest/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/manifest/web.ts"],"sourcesContent":["/**\n * `@12-apps/notifications/manifest/web` — the web capabilities.\n *\n * `surface.create` IS `createWebNotifications`, unchanged: the bell, the inbox\n * slide-over, the preferences screen and the bound store, built once per\n * adoption by the consumer's binder (the members are component TYPES, so\n * rebuilding per render unmounts the panel mid-interaction — the memoisation\n * rule every hand wiring carries as a comment today).\n *\n * ## Why this manifest exists now\n *\n * It was narrowed away with a reason that reads plausibly and is FALSE:\n * \"listing `web` would oblige every server host adopting this manifest to\n * answer for a React surface it never mounts.\" The consumer does not work\n * that way. A capability declared for the other runtime is reported\n * `out-of-scope` — \"a web host answers for this\" — and `assemble()` returns\n * fine; only a capability applicable to THIS runtime and unanswered is\n * `unbound`. `wiring`'s own fixture package declares both halves and its\n * server-host suite asserts exactly that.\n *\n * The narrowing therefore bought nothing and cost the thing the capability is\n * for. `./react` and `./web-push` ship Bell, Panel and Preferences — the exact\n * screens the adaptation report wanted to stop being hand-duplicated in hosts,\n * and the origin host duplicated the preferences screen and the push setup\n * anyway, because a manifest that never mentions them is a manifest nobody\n * discovers them from.\n *\n * ## Why there are no `areas`\n *\n * The bell is not a routed screen: it lives in a host's header chrome, beside\n * whatever else that host puts there, and no package can suggest a route for\n * it. Preferences IS routed, but where it belongs differs per host — under\n * account settings in one app, under a tenant's configuration in another — and\n * it is offered as `page` on the surface for the host to route at its own\n * call site. A suggested nav row would be wrong for every host but the first,\n * which is the `AreaContribution` doctrine's own test.\n */\n\nimport type { AnyWebManifest } from '@12-apps/wiring';\n\nimport { createWebNotifications } from '../react/create-web-notifications';\n\nexport const notificationsWebManifest = {\n name: '@12-apps/notifications',\n surface: { create: createWebNotifications },\n} as const satisfies AnyWebManifest;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/manifest/web.ts"],"sourcesContent":["/**\n * `@12-apps/notifications/manifest/web` — the web capabilities.\n *\n * `surface.create` IS `createWebNotifications`, unchanged: the bell, the inbox\n * slide-over, the preferences screen and the bound store, built once per\n * adoption by the consumer's binder (the members are component TYPES, so\n * rebuilding per render unmounts the panel mid-interaction — the memoisation\n * rule every hand wiring carries as a comment today).\n *\n * ## Why this manifest exists now\n *\n * It was narrowed away with a reason that reads plausibly and is FALSE:\n * \"listing `web` would oblige every server host adopting this manifest to\n * answer for a React surface it never mounts.\" The consumer does not work\n * that way. A capability declared for the other runtime is reported\n * `out-of-scope` — \"a web host answers for this\" — and `assemble()` returns\n * fine; only a capability applicable to THIS runtime and unanswered is\n * `unbound`. `wiring`'s own fixture package declares both halves and its\n * server-host suite asserts exactly that.\n *\n * The narrowing therefore bought nothing and cost the thing the capability is\n * for. `./react` and `./web-push` ship Bell, Panel and Preferences — the exact\n * screens the adaptation report wanted to stop being hand-duplicated in hosts,\n * and the origin host duplicated the preferences screen and the push setup\n * anyway, because a manifest that never mentions them is a manifest nobody\n * discovers them from.\n *\n * ## Why there are no `areas`\n *\n * The bell is not a routed screen: it lives in a host's header chrome, beside\n * whatever else that host puts there, and no package can suggest a route for\n * it. Preferences IS routed, but where it belongs differs per host — under\n * account settings in one app, under a tenant's configuration in another — and\n * it is offered as `page` on the surface for the host to route at its own\n * call site. A suggested nav row would be wrong for every host but the first,\n * which is the `AreaContribution` doctrine's own test.\n */\n\nimport type { AnyWebManifest } from '@12-apps/wiring';\n\nimport { createEmailPreviewScreen } from '../email/previews/react/preview-screen';\nimport { createWebNotifications } from '../react/create-web-notifications';\n\nexport const notificationsWebManifest = {\n name: '@12-apps/notifications',\n surface: { create: createWebNotifications },\n} as const satisfies AnyWebManifest;\n\n/**\n * The preview console's web half.\n *\n * One screen, named `page`, because a screen's NAME is what an area row\n * resolves against — a surface that was itself the component is the shape that\n * made an area row resolve to `undefined` in `@12-apps/auth` for a release.\n */\nexport const notificationEmailPreviewsWebManifest = {\n name: '@12-apps/notifications-email-previews',\n surface: { create: createEmailPreviewScreen },\n} as const satisfies AnyWebManifest;\n"],"mappings":";;;;;;;;;;;AA2CO,IAAM,2BAA2B;AAAA,EACtC,MAAM;AAAA,EACN,SAAS,EAAE,QAAQ,uBAAuB;AAC5C;AASO,IAAM,uCAAuC;AAAA,EAClD,MAAM;AAAA,EACN,SAAS,EAAE,QAAQ,yBAAyB;AAC9C;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The SHAPE of the operator screen's words — no words.
|
|
5
|
+
*
|
|
6
|
+
* REQUIRED config with no default in any language, the copy-portability
|
|
7
|
+
* doctrine. `./copy.pt-BR` and `./copy.en-US` ship packs a host passes BY NAME.
|
|
8
|
+
*
|
|
9
|
+
* What is NOT here is anything from the mails themselves: a subject, a body and
|
|
10
|
+
* a button label all arrive from the server already rendered in whichever
|
|
11
|
+
* language the preview was asked for. That separation is the point of the
|
|
12
|
+
* language switch — the CHROME follows the operator, the MESSAGE follows its
|
|
13
|
+
* own recipient.
|
|
14
|
+
*/
|
|
15
|
+
interface EmailPreviewScreenCopy {
|
|
16
|
+
readonly title: string;
|
|
17
|
+
readonly description: string;
|
|
18
|
+
/** The sidebar's filter field. */
|
|
19
|
+
readonly searchLabel: string;
|
|
20
|
+
readonly searchPlaceholder: string;
|
|
21
|
+
/** Nothing matched the filter. */
|
|
22
|
+
readonly noMatches: string;
|
|
23
|
+
/** No row is selected yet. */
|
|
24
|
+
readonly pickOne: string;
|
|
25
|
+
/** The three views of one message. */
|
|
26
|
+
readonly tabHtml: string;
|
|
27
|
+
readonly tabText: string;
|
|
28
|
+
readonly tabSource: string;
|
|
29
|
+
/** The two widths the HTML view renders at. */
|
|
30
|
+
readonly widthDesktop: string;
|
|
31
|
+
readonly widthMobile: string;
|
|
32
|
+
/** The subject line's label above the preview. */
|
|
33
|
+
readonly subjectLabel: string;
|
|
34
|
+
/** The sandboxed frame's title, for screen readers. */
|
|
35
|
+
readonly frameTitle: string;
|
|
36
|
+
/** The coverage strip, when the surface reports a gap. */
|
|
37
|
+
readonly coverageTitle: string;
|
|
38
|
+
readonly missingSamples: (keys: string) => string;
|
|
39
|
+
readonly orphanSamples: (keys: string) => string;
|
|
40
|
+
/** Loading and failure states. */
|
|
41
|
+
readonly loading: string;
|
|
42
|
+
readonly loadError: string;
|
|
43
|
+
readonly retry: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The operator screen over the `./email/previews` catalogue.
|
|
48
|
+
*
|
|
49
|
+
* ## What a host supplies, and what it does not
|
|
50
|
+
*
|
|
51
|
+
* `apiBase` — where the routes are mounted — and `copy`, by name. Nothing else:
|
|
52
|
+
* the owners, the languages, the messages and their subjects all arrive from
|
|
53
|
+
* the surface, because they are facts about the host's own mail that no prop
|
|
54
|
+
* could usefully restate.
|
|
55
|
+
*
|
|
56
|
+
* ## The selection lives in the URL, without a router
|
|
57
|
+
*
|
|
58
|
+
* `?id=` and `?locale=`, read and written through `history.replaceState`. A
|
|
59
|
+
* link to one mail in one language is the actual workflow this screen serves —
|
|
60
|
+
* "look at what the reset mail says now" — and local state would make every
|
|
61
|
+
* such conversation a set of instructions instead of a link.
|
|
62
|
+
*
|
|
63
|
+
* Deliberately NOT a router integration: this package cannot know whether a
|
|
64
|
+
* host runs react-router, TanStack Router or a framework's own, and a screen
|
|
65
|
+
* that imported one would be unmountable in the other two. `replaceState` is
|
|
66
|
+
* the one API all of them are built on, and `replace` rather than `push` so
|
|
67
|
+
* browsing twenty mails is not twenty back-button steps.
|
|
68
|
+
*/
|
|
69
|
+
interface EmailPreviewScreenConfig {
|
|
70
|
+
/** Where the routes are mounted, e.g. `/api/platform/email-previews`. */
|
|
71
|
+
readonly apiBase: string;
|
|
72
|
+
/** The screen's words. REQUIRED — see `./copy`. */
|
|
73
|
+
readonly copy: EmailPreviewScreenCopy;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build the screen. One call, one config object — the shape every factory in
|
|
77
|
+
* this estate has.
|
|
78
|
+
*/
|
|
79
|
+
declare function createEmailPreviewScreen(config: EmailPreviewScreenConfig): {
|
|
80
|
+
page: () => JSX.Element;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { type EmailPreviewScreenCopy as E, type EmailPreviewScreenConfig as a, createEmailPreviewScreen as c };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { N as NotificationsApiClient } from '../create-web-notifications-
|
|
2
|
-
export { B as BADGE_POLL_MS, a as BADGE_RECONCILE_MS, b as BellButtonProps, I as InboxListStatus, d as InboxState, e as InboxStore, f as NotificationsHttpError, g as NotificationsPanelProps, h as NotificationsResult, i as NotificationsSignalHook, j as NotificationsSubscribe, k as NotificationsTransport, l as NotificationsWebConfig, P as PAGE_SIZE, m as PreferencesPayload, n as PreferencesScreenProps, o as PushRegistrationPayload, W as WebNotifications, p as WebPushPlatformHint, q as WebPushSetupConfig, r as createInboxStore, s as createNotificationsApiClient, c as createWebNotifications, t as httpNotificationsTransport, u as useInboxList, v as useInboxState, w as useUnreadCount } from '../create-web-notifications-
|
|
1
|
+
import { N as NotificationsApiClient } from '../create-web-notifications-B-xQ6R0B.js';
|
|
2
|
+
export { B as BADGE_POLL_MS, a as BADGE_RECONCILE_MS, b as BellButtonProps, I as InboxListStatus, d as InboxState, e as InboxStore, f as NotificationsHttpError, g as NotificationsPanelProps, h as NotificationsResult, i as NotificationsSignalHook, j as NotificationsSubscribe, k as NotificationsTransport, l as NotificationsWebConfig, P as PAGE_SIZE, m as PreferencesPayload, n as PreferencesScreenProps, o as PushRegistrationPayload, W as WebNotifications, p as WebPushPlatformHint, q as WebPushSetupConfig, r as createInboxStore, s as createNotificationsApiClient, c as createWebNotifications, t as httpNotificationsTransport, u as useInboxList, v as useInboxState, w as useUnreadCount } from '../create-web-notifications-B-xQ6R0B.js';
|
|
3
3
|
import { JSX } from 'react';
|
|
4
|
-
import { N as NotificationMessages } from '../wire-
|
|
5
|
-
import '../types-
|
|
4
|
+
import { N as NotificationMessages } from '../wire-_coV3tJk.js';
|
|
5
|
+
import '../types-BFmAY0P5.js';
|
|
6
6
|
|
|
7
7
|
/** Inline SVG bell (no icon-library dependency in this package). */
|
|
8
8
|
|
package/dist/react/index.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
relativeTime
|
|
3
|
-
} from "../chunk-O5BVUXPO.js";
|
|
4
|
-
import {
|
|
5
|
-
disableWebPush,
|
|
6
|
-
enableWebPush,
|
|
7
|
-
getExistingPushSubscription,
|
|
8
|
-
pushSupported
|
|
9
|
-
} from "../chunk-CQZMTFPY.js";
|
|
10
1
|
import {
|
|
11
2
|
NotificationsHttpError,
|
|
12
3
|
createNotificationsApiClient,
|
|
13
4
|
createWebNotifications,
|
|
14
5
|
httpNotificationsTransport
|
|
15
6
|
} from "../chunk-M5XTROYM.js";
|
|
7
|
+
import {
|
|
8
|
+
relativeTime
|
|
9
|
+
} from "../chunk-O5BVUXPO.js";
|
|
16
10
|
import {
|
|
17
11
|
BADGE_POLL_MS,
|
|
18
12
|
BADGE_RECONCILE_MS,
|
|
@@ -23,6 +17,12 @@ import {
|
|
|
23
17
|
useInboxState,
|
|
24
18
|
useUnreadCount
|
|
25
19
|
} from "../chunk-BW723CX2.js";
|
|
20
|
+
import {
|
|
21
|
+
disableWebPush,
|
|
22
|
+
enableWebPush,
|
|
23
|
+
getExistingPushSubscription,
|
|
24
|
+
pushSupported
|
|
25
|
+
} from "../chunk-CQZMTFPY.js";
|
|
26
26
|
import "../chunk-M2TVBVH2.js";
|
|
27
27
|
import "../chunk-7QVYU63E.js";
|
|
28
28
|
export {
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { A as ApiNotifications } from '../create-api-notifications-
|
|
2
|
-
export { C as CommittedNotification, E as EMAIL_DRIVERS, c as EmailDriver, d as EmailDriverDeclaration, e as EmailMessage, f as ExtraDrivers, L as ListNotificationsInput, g as NotificationAudienceDirectory, h as NotificationChannelPolicy, i as NotificationCommittedListener, j as NotificationContactDirectory, k as NotificationCreateData, l as NotificationDelegate, m as NotificationDeliveryDelegate, n as NotificationDeliveryRow, o as NotificationDeliveryWhere, p as NotificationDispatchScheduler, q as NotificationInboxStore, r as NotificationPageAfter, s as NotificationPreferenceDelegate, t as NotificationPreferenceRow, u as NotificationPreferenceStore, v as NotificationRouter, w as NotificationWhere, a as NotificationsActor, x as NotificationsApiError, y as NotificationsDb, z as NotificationsDbClient, B as NotificationsDbProvider, D as NotificationsRequest, F as NotificationsResponse, b as NotificationsRoute, N as NotificationsServerConfig, G as NotifyByPermission, H as NotifyOptions, I as NotifyResult, P as PermissionNotificationResult, J as PermissionNotificationSkip, K as PushSubscriptionDelegate, M as PushSubscriptionInput, O as PushSubscriptionRow, Q as PushSubscriptionStore, S as SMS_DRIVERS, R as SmsDriver, T as SmsDriverDeclaration, U as SmsMessage, V as TransportDeclaration, W as TransportRegistry, X as WHATSAPP_DRIVERS, Y as WhatsAppDriver, Z as WhatsAppDriverDeclaration, _ as WhatsAppMessage, $ as createApiNotifications, a0 as createTransportRegistry, a1 as emailTransport, a2 as foldApiError, a3 as formatEmail, a4 as formatSms, a5 as formatWhatsApp, a6 as ok, a7 as smsTransport, a8 as whatsAppTransport } from '../create-api-notifications-
|
|
3
|
-
export { D as DriverDeclarationBase, F as FetchImpl, N as NotificationProviderError, W as WEB_PUSH_DRIVERS, a as WebPushDriverDeclaration, b as WebPushMessage, c as WebPushSender, d as WebPushSubscription, e as WebPushSubscriptionSource, f as absoluteLink, g as formatWebPush, w as webPushTransport } from '../web-push-
|
|
1
|
+
import { A as ApiNotifications } from '../create-api-notifications-B-VMezVB.js';
|
|
2
|
+
export { C as CommittedNotification, E as EMAIL_DRIVERS, c as EmailDriver, d as EmailDriverDeclaration, e as EmailMessage, f as ExtraDrivers, L as ListNotificationsInput, g as NotificationAudienceDirectory, h as NotificationChannelPolicy, i as NotificationCommittedListener, j as NotificationContactDirectory, k as NotificationCreateData, l as NotificationDelegate, m as NotificationDeliveryDelegate, n as NotificationDeliveryRow, o as NotificationDeliveryWhere, p as NotificationDispatchScheduler, q as NotificationInboxStore, r as NotificationPageAfter, s as NotificationPreferenceDelegate, t as NotificationPreferenceRow, u as NotificationPreferenceStore, v as NotificationRouter, w as NotificationWhere, a as NotificationsActor, x as NotificationsApiError, y as NotificationsDb, z as NotificationsDbClient, B as NotificationsDbProvider, D as NotificationsRequest, F as NotificationsResponse, b as NotificationsRoute, N as NotificationsServerConfig, G as NotifyByPermission, H as NotifyOptions, I as NotifyResult, P as PermissionNotificationResult, J as PermissionNotificationSkip, K as PushSubscriptionDelegate, M as PushSubscriptionInput, O as PushSubscriptionRow, Q as PushSubscriptionStore, S as SMS_DRIVERS, R as SmsDriver, T as SmsDriverDeclaration, U as SmsMessage, V as TransportDeclaration, W as TransportRegistry, X as WHATSAPP_DRIVERS, Y as WhatsAppDriver, Z as WhatsAppDriverDeclaration, _ as WhatsAppMessage, $ as createApiNotifications, a0 as createTransportRegistry, a1 as emailTransport, a2 as foldApiError, a3 as formatEmail, a4 as formatSms, a5 as formatWhatsApp, a6 as ok, a7 as smsTransport, a8 as whatsAppTransport } from '../create-api-notifications-B-VMezVB.js';
|
|
3
|
+
export { D as DriverDeclarationBase, F as FetchImpl, N as NotificationProviderError, W as WEB_PUSH_DRIVERS, a as WebPushDriverDeclaration, b as WebPushMessage, c as WebPushSender, d as WebPushSubscription, e as WebPushSubscriptionSource, f as absoluteLink, g as formatWebPush, w as webPushTransport } from '../web-push-D-ysQd5h.js';
|
|
4
4
|
import { NotifyPort } from '@12-apps/wiring/ports';
|
|
5
|
-
export { a as NOTIFICATIONS_DRAIN_CRON, b as NOTIFICATIONS_DRAIN_LEASE_MS, c as NOTIFICATIONS_JOBS, d as NOTIFICATIONS_SWEEP_QUEUE, N as NotificationsJobDeps } from '../jobs-
|
|
6
|
-
import '../generators-
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../wire-
|
|
5
|
+
export { a as NOTIFICATIONS_DRAIN_CRON, b as NOTIFICATIONS_DRAIN_LEASE_MS, c as NOTIFICATIONS_JOBS, d as NOTIFICATIONS_SWEEP_QUEUE, N as NotificationsJobDeps } from '../jobs-D64B_bg7.js';
|
|
6
|
+
import '../generators-BsuXe8Mp.js';
|
|
7
|
+
import '../types-BFmAY0P5.js';
|
|
8
|
+
import '../wire-_coV3tJk.js';
|
|
9
|
+
import '../template-Dlt5S54z.js';
|
|
9
10
|
import '@12-apps/wiring';
|
|
10
11
|
|
|
11
12
|
/**
|
package/dist/server/index.js
CHANGED
|
@@ -25,10 +25,11 @@ import {
|
|
|
25
25
|
smsTransport,
|
|
26
26
|
webPushTransport,
|
|
27
27
|
whatsAppTransport
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-KZG7QGFA.js";
|
|
29
29
|
import "../chunk-GGAZOLNN.js";
|
|
30
|
-
import "../chunk-BGI4BQ66.js";
|
|
31
30
|
import "../chunk-M2TVBVH2.js";
|
|
31
|
+
import "../chunk-BGI4BQ66.js";
|
|
32
|
+
import "../chunk-EKUSNUBT.js";
|
|
32
33
|
import "../chunk-7QVYU63E.js";
|
|
33
34
|
export {
|
|
34
35
|
EMAIL_DRIVERS,
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout's design tokens — the nine colours a mail is drawn from.
|
|
3
|
+
*
|
|
4
|
+
* ## Why a theme is a VALUE here and copy is required config
|
|
5
|
+
*
|
|
6
|
+
* The copy-portability doctrine is that a package ships no user-facing
|
|
7
|
+
* sentences: a default in the origin host's language reads as finished to the
|
|
8
|
+
* next host right up until somebody's customer gets mail in a language they do
|
|
9
|
+
* not speak. Colour is not that. {@link NEUTRAL_EMAIL_THEME} is not anybody's
|
|
10
|
+
* brand — it is grey on white, which reads as *unstyled but tidy* rather than
|
|
11
|
+
* as *somebody else's product*. A host that passes nothing gets a mail that
|
|
12
|
+
* looks plain, not a mail that looks like a different company.
|
|
13
|
+
*
|
|
14
|
+
* So this one has a default and the copy does not, and the difference is
|
|
15
|
+
* exactly whether getting it wrong is invisible. A missing theme is visible in
|
|
16
|
+
* the first preview; a wrong-language default is invisible until a customer
|
|
17
|
+
* complains.
|
|
18
|
+
*
|
|
19
|
+
* ## What a host should know before overriding it
|
|
20
|
+
*
|
|
21
|
+
* Two rungs of most brand palettes cannot carry light text, and a mail has no
|
|
22
|
+
* theme to fall back on when a client ignores a colour. {@link accent} is the
|
|
23
|
+
* one that MUST clear 4.5:1 against white — it is the CTA fill and every link.
|
|
24
|
+
* A warm mid-tone that looks fine on a screen at 2.6:1 is unreadable in an
|
|
25
|
+
* inbox, and nothing in the pipeline will say so.
|
|
26
|
+
*/
|
|
27
|
+
interface EmailTheme {
|
|
28
|
+
/** The page behind the card. Never pure white: a white card needs a ground. */
|
|
29
|
+
readonly page: string;
|
|
30
|
+
/** The card itself. */
|
|
31
|
+
readonly surface: string;
|
|
32
|
+
/** A quieter panel inside the card — the facts table. */
|
|
33
|
+
readonly panel: string;
|
|
34
|
+
/** Every hairline. */
|
|
35
|
+
readonly border: string;
|
|
36
|
+
/** Body text. */
|
|
37
|
+
readonly ink: string;
|
|
38
|
+
/** Secondary text: the footer, the fallback link, a fact's label. */
|
|
39
|
+
readonly muted: string;
|
|
40
|
+
/** The action colour — the CTA fill and every link. Must clear 4.5:1 on white. */
|
|
41
|
+
readonly accent: string;
|
|
42
|
+
/** Ink ON {@link accent}. */
|
|
43
|
+
readonly onAccent: string;
|
|
44
|
+
/** The rule under the wordmark. Decorative — nothing is written on it. */
|
|
45
|
+
readonly rule: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A brand-free default: greys, one blue, nothing anybody would mistake for a
|
|
49
|
+
* product. Every value clears its contrast requirement against its own ground.
|
|
50
|
+
*/
|
|
51
|
+
declare const NEUTRAL_EMAIL_THEME: EmailTheme;
|
|
52
|
+
/**
|
|
53
|
+
* The font stack, as one string.
|
|
54
|
+
*
|
|
55
|
+
* System fonts only, and no web font: a `@font-face` is stripped by Gmail and
|
|
56
|
+
* by Outlook, so a mail that depends on one renders in whatever the client
|
|
57
|
+
* substitutes — never the fallback the designer chose. The stack ends in the
|
|
58
|
+
* emoji faces so a status glyph in a subject line does not drop to a tofu box
|
|
59
|
+
* on Windows.
|
|
60
|
+
*/
|
|
61
|
+
declare const EMAIL_FONT_STACK = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'";
|
|
62
|
+
/** The card's width. 600px is the width every client lays out without scroll. */
|
|
63
|
+
declare const EMAIL_CONTENT_WIDTH = 600;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* THE transactional-mail layout: one document model, one HTML renderer, one
|
|
67
|
+
* plain-text twin.
|
|
68
|
+
*
|
|
69
|
+
* ## The problem it exists for
|
|
70
|
+
*
|
|
71
|
+
* A host that sends mail from more than one place ends up rendering it in more
|
|
72
|
+
* than one way — the notification pipeline emits a bold paragraph and a bare
|
|
73
|
+
* anchor, the sign-in flow emits a `div` with a max-width, the receipt builds
|
|
74
|
+
* its own list — and each grows its own `escapeHtml` and its own text twin. The
|
|
75
|
+
* three look like three different products, because a paragraph with no
|
|
76
|
+
* document around it inherits whatever the client decides: 13px Arial in Gmail,
|
|
77
|
+
* Times New Roman in Outlook, no centring anywhere.
|
|
78
|
+
*
|
|
79
|
+
* That is a LAYOUT problem rather than a wording one, which is what makes it a
|
|
80
|
+
* package's to solve. The words stay the host's; the document does not.
|
|
81
|
+
*
|
|
82
|
+
* ## Why the document is a MODEL and not a string
|
|
83
|
+
*
|
|
84
|
+
* Every caller hands over structure — a heading, some paragraphs, an optional
|
|
85
|
+
* facts table, at most one call to action — and never markup. Three things fall
|
|
86
|
+
* out of that, and each is a real defect in the hand-rolled renderers this
|
|
87
|
+
* replaces:
|
|
88
|
+
*
|
|
89
|
+
* 1. **Escaping cannot be forgotten.** Every field is escaped here, once. Of
|
|
90
|
+
* the three renderers this was extracted from, two escaped the body and
|
|
91
|
+
* interpolated the LINK raw.
|
|
92
|
+
* 2. **The plain-text twin cannot drift.** Both halves render from the same
|
|
93
|
+
* object, so a line added to one is in the other. A `text/html` part with no
|
|
94
|
+
* `text/plain` twin is scored by every major spam filter, and it is what a
|
|
95
|
+
* watch, a terminal client and a screen reader in plain-text mode show.
|
|
96
|
+
* 3. **A preview is honest.** `./server`'s catalogue renders exactly this, from
|
|
97
|
+
* exactly these inputs, so a preview cannot be right about a mail nobody
|
|
98
|
+
* gets.
|
|
99
|
+
*
|
|
100
|
+
* ## The client constraints this encodes
|
|
101
|
+
*
|
|
102
|
+
* Stated once here, so no caller has to know them:
|
|
103
|
+
*
|
|
104
|
+
* - **Tables, not divs.** Outlook 2016+ on Windows lays HTML out with Word,
|
|
105
|
+
* which supports no `flex`, no `grid` and no reliable `max-width` on a block.
|
|
106
|
+
* A centred 600px table is the one construction every client agrees on.
|
|
107
|
+
* - **Inline styles.** Gmail strips `<style>` from the document it renders in
|
|
108
|
+
* several contexts, and always in the Gmail app for a non-Gmail account. The
|
|
109
|
+
* `<style>` block below therefore carries only the mobile media query —
|
|
110
|
+
* progressive enhancement, never anything the layout depends on.
|
|
111
|
+
* - **No web fonts, no `color-mix()`, no CSS variables.** See `./theme`.
|
|
112
|
+
* - **A preheader.** The inbox list shows the first text in the body after the
|
|
113
|
+
* subject; without one it shows the footer's legal line.
|
|
114
|
+
* - **`role="presentation"`** on every layout table, so a screen reader reads
|
|
115
|
+
* the message rather than announcing a five-column grid.
|
|
116
|
+
*/
|
|
117
|
+
/** The words the LAYOUT itself needs — never the message's own sentences. */
|
|
118
|
+
interface EmailChromeCopy {
|
|
119
|
+
/** "If the button does not work, paste this address into your browser:" */
|
|
120
|
+
readonly fallbackHint: string;
|
|
121
|
+
/** "This is an automated message — please do not reply." */
|
|
122
|
+
readonly automated: string;
|
|
123
|
+
/** The footer's one line about the product, given the brand name. */
|
|
124
|
+
readonly tagline: (brand: string) => string;
|
|
125
|
+
}
|
|
126
|
+
/** The one call to action a message may carry. More than one dilutes both. */
|
|
127
|
+
interface EmailAction {
|
|
128
|
+
readonly label: string;
|
|
129
|
+
readonly href: string;
|
|
130
|
+
}
|
|
131
|
+
/** One row of the facts panel — a receipt's total, an order's reference. */
|
|
132
|
+
interface EmailFact {
|
|
133
|
+
readonly label: string;
|
|
134
|
+
readonly value: string;
|
|
135
|
+
/** Renders bolder and larger — the one number the reader came for. */
|
|
136
|
+
readonly emphasis?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/** Everything a message says, with no opinion about how it looks. */
|
|
139
|
+
interface EmailDocument {
|
|
140
|
+
/** The subject line. Also the document `<title>`. */
|
|
141
|
+
readonly subject: string;
|
|
142
|
+
/**
|
|
143
|
+
* The inbox-list preview, ~90 chars. Falls back to the first paragraph,
|
|
144
|
+
* which is right far more often than it is wrong.
|
|
145
|
+
*/
|
|
146
|
+
readonly preheader?: string;
|
|
147
|
+
/** The `<h1>`. Usually a restatement of the subject in the reader's terms. */
|
|
148
|
+
readonly heading: string;
|
|
149
|
+
/** The body, one entry per paragraph. Plain sentences — never markup. */
|
|
150
|
+
readonly paragraphs?: readonly string[];
|
|
151
|
+
/** An optional label/value panel under the body. */
|
|
152
|
+
readonly facts?: readonly EmailFact[];
|
|
153
|
+
/** At most one CTA. */
|
|
154
|
+
readonly action?: EmailAction;
|
|
155
|
+
/** Small print under the CTA — a deadline, a "you can ignore this". */
|
|
156
|
+
readonly notes?: readonly string[];
|
|
157
|
+
/**
|
|
158
|
+
* The layout's own words, in the recipient's language.
|
|
159
|
+
*
|
|
160
|
+
* REQUIRED, with no default in any language — the copy-portability doctrine.
|
|
161
|
+
* `@12-apps/notifications/email/locales` ships a pack per language and a host
|
|
162
|
+
* passes one BY
|
|
163
|
+
* NAME, which is a decision rather than a silence.
|
|
164
|
+
*/
|
|
165
|
+
readonly chrome: EmailChromeCopy;
|
|
166
|
+
/**
|
|
167
|
+
* The product name in the header and the footer. REQUIRED: a package that
|
|
168
|
+
* defaulted this would sign another company's mail.
|
|
169
|
+
*/
|
|
170
|
+
readonly brand: string;
|
|
171
|
+
/** The recipient's language, for the document's `lang` attribute. */
|
|
172
|
+
readonly locale: string;
|
|
173
|
+
/** Defaults to {@link NEUTRAL_EMAIL_THEME} — see `./theme` for why this one may. */
|
|
174
|
+
readonly theme?: EmailTheme;
|
|
175
|
+
}
|
|
176
|
+
/** A URL as an attribute value, or `#` when it is not one this layout will emit. */
|
|
177
|
+
declare function safeHref(href: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Render the document as the HTML half of the message.
|
|
180
|
+
*
|
|
181
|
+
* A complete document rather than a fragment: a `<!DOCTYPE>` is what puts
|
|
182
|
+
* Outlook into standards mode, and `x-apple-disable-message-reformatting` is
|
|
183
|
+
* what stops iOS Mail re-flowing the card to the screen width and shrinking the
|
|
184
|
+
* type with it.
|
|
185
|
+
*/
|
|
186
|
+
declare function renderEmailHtml(document: EmailDocument): string;
|
|
187
|
+
/** Both halves plus the subject — what every driver in this repo is handed. */
|
|
188
|
+
interface RenderedEmail {
|
|
189
|
+
readonly subject: string;
|
|
190
|
+
readonly html: string;
|
|
191
|
+
readonly text: string;
|
|
192
|
+
}
|
|
193
|
+
/** Render one document into the message shape `EmailDriver.send` takes. */
|
|
194
|
+
declare function renderEmail(document: EmailDocument): RenderedEmail;
|
|
195
|
+
|
|
196
|
+
export { type EmailDocument as E, NEUTRAL_EMAIL_THEME as N, type RenderedEmail as R, EMAIL_CONTENT_WIDTH as a, EMAIL_FONT_STACK as b, type EmailAction as c, type EmailChromeCopy as d, type EmailFact as e, type EmailTheme as f, renderEmailHtml as g, renderEmail as r, safeHref as s };
|
|
@@ -189,4 +189,4 @@ interface NotificationLogger {
|
|
|
189
189
|
error(message: string, ...meta: unknown[]): void;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
export { type DeliveryStatus as D,
|
|
192
|
+
export { type DeliveryStatus as D, type NotificationGenerator as N, type TransportRecipient as T, NOTIFICATION_CHANNELS as a, type NotificationCategory as b, type NotificationChannel as c, type NotificationContent as d, type NotificationEvent as e, type NotificationGenerateContext as f, type NotificationLogger as g, type NotificationRecipient as h, type NotificationTaxonomy as i, type NotificationTransport as j, taxonomyOf as t };
|
package/dist/web-push/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as WebPushSender } from '../web-push-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { c as WebPushSender } from '../web-push-D-ysQd5h.js';
|
|
2
|
+
import '../types-BFmAY0P5.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* `@12-apps/notifications/web-push` — the VAPID sender, behind its own subpath.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as NotificationLogger,
|
|
1
|
+
import { g as NotificationLogger, d as NotificationContent, j as NotificationTransport } from './types-BFmAY0P5.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The DRIVER port — the reason a host adds a vendor with a config entry and no
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/notifications",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Plug-and-play notification system (12-15): an always-on in-app inbox, per-user × per-category channel preferences, and email / SMS / WhatsApp / web-push transports behind vendor DRIVERS so a second provider is a config entry. Framework-free core (.), host-mounted backend surface (./server: inbox / preferences / push-subscription endpoints, the channel router with delivery records + retry sweep, the permission fan-out, duck-typed Prisma seam), Hono adapter (./hono), React surface (./react: bell + badge, inbox drawer, preferences screen), VAPID sender (./web-push) and the package-owned Prisma partial + migrations. Standardized adoption contract in ADOPTING.md.",
|
|
@@ -9,6 +9,26 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./email": {
|
|
13
|
+
"types": "./dist/email/index.d.ts",
|
|
14
|
+
"default": "./dist/email/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./email/locales": {
|
|
17
|
+
"types": "./dist/email/locales.d.ts",
|
|
18
|
+
"default": "./dist/email/locales.js"
|
|
19
|
+
},
|
|
20
|
+
"./email/previews": {
|
|
21
|
+
"types": "./dist/email/previews/index.d.ts",
|
|
22
|
+
"default": "./dist/email/previews/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./email/previews/hono": {
|
|
25
|
+
"types": "./dist/email/previews/hono.d.ts",
|
|
26
|
+
"default": "./dist/email/previews/hono.js"
|
|
27
|
+
},
|
|
28
|
+
"./email/previews/react": {
|
|
29
|
+
"types": "./dist/email/previews/react/index.d.ts",
|
|
30
|
+
"default": "./dist/email/previews/react/index.js"
|
|
31
|
+
},
|
|
12
32
|
"./server": {
|
|
13
33
|
"types": "./dist/server/index.d.ts",
|
|
14
34
|
"default": "./dist/server/index.js"
|
|
@@ -51,7 +71,7 @@
|
|
|
51
71
|
"prisma:sync:check": "node scripts/sync-notifications-schema.mjs --check"
|
|
52
72
|
},
|
|
53
73
|
"dependencies": {
|
|
54
|
-
"@12-apps/ui": "^6.
|
|
74
|
+
"@12-apps/ui": "^6.14.0"
|
|
55
75
|
},
|
|
56
76
|
"peerDependencies": {
|
|
57
77
|
"@12-apps/wiring": ">=1.3.0",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EmailChromeCopy } from './template';
|
|
2
|
+
|
|
3
|
+
/** US English — the twin that makes {@link PT_BR_EMAIL_CHROME} a choice. */
|
|
4
|
+
export const EN_US_EMAIL_CHROME: EmailChromeCopy = {
|
|
5
|
+
fallbackHint: 'If the button above does not work, copy and paste this address into your browser:',
|
|
6
|
+
automated: 'This is an automated message. Please do not reply to this email.',
|
|
7
|
+
tagline: (brand) => `Sent by ${brand}.`,
|
|
8
|
+
};
|